components: fix jQuery find proxy

This commit is contained in:
Katharina Bogad 2021-06-24 00:24:31 +02:00
parent e916eab13b
commit 2981816d07
11 changed files with 19 additions and 11 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,7 +11,8 @@ class userfieldsform
this.scopeSelector = scopeSelector; this.scopeSelector = scopeSelector;
this.scope = scopeSelector != null ? $(scopeSelector) : $(document); this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $; var jScope = this.scope;
this.$ = scopeSelector != null ? (selector) => jScope.find(selector) : $;
this.$(".userfield-link").keyup(); this.$(".userfield-link").keyup();

View File

@ -5,10 +5,11 @@ class GrocyFrontendHelpers
{ {
this.Grocy = Grocy; this.Grocy = Grocy;
this.Api = Api; this.Api = Api;
var self = this;
if (scope != null) if (scope != null)
{ {
this.$scope = $(scope).find;
this.scope = $(scope); this.scope = $(scope);
this.$scope = (selector) => self.scope.find(selector);
this.scopeSelector = scope; this.scopeSelector = scope;
} }
else else