Fix scoped jQuery proxy in components

This commit is contained in:
Katharina Bogad 2021-06-24 00:09:17 +02:00
parent 6b5440cf7a
commit 438a559897
11 changed files with 17 additions and 16 deletions

View File

@ -7,7 +7,7 @@ class BasePicker
this.scopeSelector = scopeSelector;
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
this.picker = null;
this.input_element = null;

View File

@ -8,7 +8,7 @@ class barcodescanner
this.scopeSelector = scopeSelector;
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
// init component
this.LiveVideoSizeAdjusted = false;

View File

@ -9,7 +9,7 @@ class batterycard
this.scopeSelector = scopeSelector;
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
}
Refresh(batteryId)

View File

@ -6,7 +6,7 @@ class calendarcard
this.scopeSelector = scopeSelector;
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
this.$('#calendar').datetimepicker(
{

View File

@ -9,7 +9,7 @@ class chorecard
this.scopeSelector = scopeSelector;
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
}
Refresh(choreId)

View File

@ -9,7 +9,7 @@ class datetimepicker
this.scopeSelector = scopeSelector;
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
this.basename = basename;

View File

@ -6,7 +6,7 @@ class numberpicker
this.scopeSelector = scopeSelector;
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
var self = this;
this.$(".numberpicker-down-button").unbind('click').on("click", () => self.valueDownHandler(this));

View File

@ -6,7 +6,7 @@ class productamountpicker
this.scopeSelector = scopeSelector;
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
Grocy.Use("numberpicker");
this.AllowAnyQuEnabled = false;

View File

@ -10,7 +10,7 @@ class productcard
this.scopeSelector = scopeSelector;
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
this.PriceHistoryChart = null;
var self = this;

View File

@ -11,7 +11,7 @@ class userfieldsform
this.scopeSelector = scopeSelector;
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
this.$(".userfield-link").keyup();
@ -181,15 +181,16 @@ class userfieldsform
}
});
self.$('.datetimepicker-wrapper').each(() =>
var pickers = $('.datetimepicker-wrapper');
for (let elem of pickers)
{
let picker = $(this);
let picker = $(elem);
var scopeId = uuid.v4();
picker.attr('id', scopeId);
picker.prop('id', scopeId);
this.components.push(new datetimepicker(self.Grocy, "#" + scopeId));
});
self.components.push(new datetimepicker(self.Grocy, "#" + scopeId));
}
},
function(xhr)
{

View File

@ -12,7 +12,7 @@
@php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp
@php if(empty($activateNumberPad)) { $activateNumberPad = false; } @endphp
<div id="datetimepicker-wrapper"
<div class="datetimepicker-wrapper"
class="form-group {{ $additionalGroupCssClasses }}">
<label for="{{ $id }}">{{ $__t($label) }}
@if(!empty($hint))