@schukai/monster 3.55.0 → 3.55.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/source/components/datatable/datasource/rest.mjs +313 -326
  4. package/source/components/datatable/datatable/header.mjs +1 -1
  5. package/source/components/datatable/datatable.mjs +586 -591
  6. package/source/components/datatable/embedded-pagination.mjs +42 -49
  7. package/source/components/datatable/filter/util.mjs +115 -99
  8. package/source/components/datatable/filter.mjs +901 -842
  9. package/source/components/datatable/pagination.mjs +333 -334
  10. package/source/components/datatable/status.mjs +134 -156
  11. package/source/components/datatable/stylesheet/column-bar.mjs +14 -8
  12. package/source/components/datatable/stylesheet/dataset.mjs +14 -8
  13. package/source/components/datatable/stylesheet/datasource.mjs +14 -8
  14. package/source/components/datatable/stylesheet/datatable.mjs +14 -8
  15. package/source/components/datatable/stylesheet/embedded-pagination.mjs +14 -8
  16. package/source/components/datatable/stylesheet/filter-button.mjs +14 -8
  17. package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +14 -8
  18. package/source/components/datatable/stylesheet/filter-date-range.mjs +14 -8
  19. package/source/components/datatable/stylesheet/filter-range.mjs +14 -8
  20. package/source/components/datatable/stylesheet/filter.mjs +14 -8
  21. package/source/components/datatable/stylesheet/pagination.mjs +14 -8
  22. package/source/components/datatable/stylesheet/select-filter.mjs +14 -8
  23. package/source/components/datatable/stylesheet/status.mjs +14 -8
  24. package/source/components/form/action-button.mjs +3 -1
  25. package/source/components/form/confirm-button.mjs +3 -1
  26. package/source/components/form/context-error.mjs +161 -164
  27. package/source/components/form/context-help.mjs +3 -1
  28. package/source/components/form/form.mjs +3 -1
  29. package/source/components/form/message-state-button.mjs +3 -1
  30. package/source/components/form/popper-button.mjs +6 -4
  31. package/source/components/form/popper.mjs +310 -310
  32. package/source/components/form/select.mjs +2 -2
  33. package/source/components/form/state-button.mjs +3 -1
  34. package/source/components/form/stylesheet/action-button.mjs +14 -8
  35. package/source/components/form/stylesheet/api-button.mjs +14 -8
  36. package/source/components/form/stylesheet/button-bar.mjs +14 -8
  37. package/source/components/form/stylesheet/button.mjs +14 -8
  38. package/source/components/form/stylesheet/confirm-button.mjs +14 -8
  39. package/source/components/form/stylesheet/context-error.mjs +14 -8
  40. package/source/components/form/stylesheet/context-help.mjs +14 -8
  41. package/source/components/form/stylesheet/form.mjs +14 -8
  42. package/source/components/form/stylesheet/message-state-button.mjs +14 -8
  43. package/source/components/form/stylesheet/popper-button.mjs +14 -8
  44. package/source/components/form/stylesheet/popper.mjs +14 -8
  45. package/source/components/form/stylesheet/select.mjs +14 -8
  46. package/source/components/form/stylesheet/state-button.mjs +14 -8
  47. package/source/components/form/stylesheet/tabs.mjs +14 -8
  48. package/source/components/form/stylesheet/tree-select.mjs +14 -8
  49. package/source/components/form/tabs.mjs +754 -758
  50. package/source/components/host/collapse.mjs +2 -4
  51. package/source/components/host/config-manager.mjs +11 -9
  52. package/source/components/host/stylesheet/call-button.mjs +14 -8
  53. package/source/components/host/stylesheet/collapse.mjs +14 -8
  54. package/source/components/host/stylesheet/config-manager.mjs +14 -8
  55. package/source/components/host/stylesheet/details.mjs +14 -8
  56. package/source/components/host/stylesheet/host.mjs +14 -8
  57. package/source/components/host/stylesheet/overlay.mjs +14 -8
  58. package/source/components/host/stylesheet/toggle-button.mjs +14 -8
  59. package/source/components/host/stylesheet/viewer.mjs +14 -8
  60. package/source/components/host/util.mjs +2 -2
  61. package/source/components/notify/stylesheet/message.mjs +14 -8
  62. package/source/components/notify/stylesheet/notify.mjs +14 -8
  63. package/source/components/state/stylesheet/log.mjs +14 -8
  64. package/source/components/state/stylesheet/state.mjs +14 -8
  65. package/source/components/stylesheet/badge.mjs +14 -8
  66. package/source/components/stylesheet/border.mjs +14 -8
  67. package/source/components/stylesheet/button.mjs +14 -8
  68. package/source/components/stylesheet/card.mjs +14 -8
  69. package/source/components/stylesheet/color.mjs +14 -8
  70. package/source/components/stylesheet/common.mjs +14 -8
  71. package/source/components/stylesheet/control.mjs +14 -8
  72. package/source/components/stylesheet/data-grid.mjs +14 -8
  73. package/source/components/stylesheet/display.mjs +14 -8
  74. package/source/components/stylesheet/floating-ui.mjs +14 -8
  75. package/source/components/stylesheet/form.mjs +14 -8
  76. package/source/components/stylesheet/host.mjs +14 -8
  77. package/source/components/stylesheet/icons.mjs +14 -8
  78. package/source/components/stylesheet/link.mjs +14 -8
  79. package/source/components/stylesheet/normalize.mjs +14 -8
  80. package/source/components/stylesheet/popper.mjs +14 -8
  81. package/source/components/stylesheet/property.mjs +14 -8
  82. package/source/components/stylesheet/ripple.mjs +14 -8
  83. package/source/components/stylesheet/skeleton.mjs +14 -8
  84. package/source/components/stylesheet/space.mjs +14 -8
  85. package/source/components/stylesheet/spinner.mjs +14 -8
  86. package/source/components/stylesheet/table.mjs +14 -8
  87. package/source/components/stylesheet/theme.mjs +14 -8
  88. package/source/components/stylesheet/typography.mjs +14 -8
  89. package/source/components/tree-menu/stylesheet/tree-menu.mjs +14 -8
  90. package/source/data/transformer.mjs +6 -8
  91. package/source/dom/attributes.mjs +5 -5
  92. package/source/dom/customelement.mjs +1 -1
  93. package/source/dom/updater.mjs +697 -700
  94. package/source/dom/util.mjs +2 -2
  95. package/source/monster.mjs +0 -1
  96. package/source/types/noderecursiveiterator.mjs +9 -7
  97. package/source/types/version.mjs +1 -1
  98. package/source/util/sleep.mjs +3 -4
  99. package/test/cases/monster.mjs +1 -1
@@ -3,25 +3,25 @@
3
3
  * SPDX-License-Identifier: AGPL-3.0
4
4
  */
5
5
 
6
- import {addAttributeToken} from "../../../dom/attributes.mjs";
7
- import {ATTRIBUTE_ERRORMESSAGE} from "../../../dom/constants.mjs";
8
- import {Datasource, dataSourceSymbol} from "../datasource.mjs";
9
- import {DatasourceStyleSheet} from "../stylesheet/datasource.mjs";
10
- import {instanceSymbol} from "../../../constants.mjs";
6
+ import { addAttributeToken } from "../../../dom/attributes.mjs";
7
+ import { ATTRIBUTE_ERRORMESSAGE } from "../../../dom/constants.mjs";
8
+ import { Datasource, dataSourceSymbol } from "../datasource.mjs";
9
+ import { DatasourceStyleSheet } from "../stylesheet/datasource.mjs";
10
+ import { instanceSymbol } from "../../../constants.mjs";
11
11
  import {
12
- assembleMethodSymbol,
13
- registerCustomElement,
12
+ assembleMethodSymbol,
13
+ registerCustomElement,
14
14
  } from "../../../dom/customelement.mjs";
15
- import {RestAPI} from "../../../data/datasource/server/restapi.mjs";
16
- import {Formatter} from "../../../text/formatter.mjs";
17
- import {clone} from "../../../util/clone.mjs";
18
- import {validateBoolean} from "../../../types/validate.mjs";
19
- import {findElementWithIdUpwards} from "../../../dom/util.mjs";
20
- import {Observer} from "../../../types/observer.mjs";
21
- import {Pathfinder} from "../../../data/pathfinder.mjs";
22
- import {fireCustomEvent} from "../../../dom/events.mjs";
15
+ import { RestAPI } from "../../../data/datasource/server/restapi.mjs";
16
+ import { Formatter } from "../../../text/formatter.mjs";
17
+ import { clone } from "../../../util/clone.mjs";
18
+ import { validateBoolean } from "../../../types/validate.mjs";
19
+ import { findElementWithIdUpwards } from "../../../dom/util.mjs";
20
+ import { Observer } from "../../../types/observer.mjs";
21
+ import { Pathfinder } from "../../../data/pathfinder.mjs";
22
+ import { fireCustomEvent } from "../../../dom/events.mjs";
23
23
 
24
- export {Rest};
24
+ export { Rest };
25
25
 
26
26
  /**
27
27
  * @private
@@ -34,7 +34,7 @@ const intersectionObserverHandlerSymbol = Symbol("intersectionObserverHandler");
34
34
  * @type {symbol}
35
35
  */
36
36
  const intersectionObserverObserverSymbol = Symbol(
37
- "intersectionObserverObserver",
37
+ "intersectionObserverObserver",
38
38
  );
39
39
 
40
40
  /**
@@ -63,23 +63,23 @@ const filterObserverSymbol = Symbol("filterObserver");
63
63
  * @summary A rest api datasource
64
64
  */
65
65
  class Rest extends Datasource {
66
- /**
67
- * the constructor of the class
68
- */
69
- constructor() {
70
- super();
71
- this[dataSourceSymbol] = new RestAPI();
72
- }
73
-
74
- /**
75
- * This method is called by the `instanceof` operator.
76
- * @returns {symbol}
77
- */
78
- static get [instanceSymbol]() {
79
- return Symbol.for("@schukai/monster/components/datasource/rest@@instance");
80
- }
81
-
82
- /**
66
+ /**
67
+ * the constructor of the class
68
+ */
69
+ constructor() {
70
+ super();
71
+ this[dataSourceSymbol] = new RestAPI();
72
+ }
73
+
74
+ /**
75
+ * This method is called by the `instanceof` operator.
76
+ * @returns {symbol}
77
+ */
78
+ static get [instanceSymbol]() {
79
+ return Symbol.for("@schukai/monster/components/datasource/rest@@instance");
80
+ }
81
+
82
+ /**
83
83
  * To set the options via the html tag the attribute `data-monster-options` must be used.
84
84
  * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
85
85
  *
@@ -109,325 +109,312 @@ class Rest extends Datasource {
109
109
  * @property {Object} write Write configuration
110
110
 
111
111
  */
112
- get defaults() {
113
- const restOptions = new RestAPI().defaults;
114
-
115
- restOptions.read.parameters = {
116
- filter: undefined,
117
- oderBy: undefined,
118
- page: "1",
119
- };
120
-
121
- return Object.assign({}, super.defaults, restOptions, {
122
- templates: {
123
- main: getTemplate(),
124
- },
125
-
126
- features: {
127
- autoInit: true,
128
- filter: false,
129
- },
130
-
131
- autoInit: {
132
- intersectionObserver: false,
133
- oneTime: true,
134
- },
135
-
136
- filter: {
137
- id: undefined,
138
- },
139
-
140
- datatable: {
141
- id: undefined,
142
- },
143
-
144
- response: {
145
- errorMessagePath: "sys.message",
146
- },
147
- });
148
- }
149
-
150
- /**
151
- *
152
- * @param {string} page
153
- * @param {string} query
154
- * @param {string} orderBy
155
- * @returns {Monster.Components.Datatable.Datasource.Rest}
156
- */
157
- setParameters({page, query, orderBy}) {
158
- const parameters = this.getOption("read.parameters");
159
- if (query !== undefined) {
160
- parameters.query = `${query}`;
161
- parameters.page = "1";
162
- }
163
-
164
- // after a query the page is set to 1, so if the page is not set, it is set to 1
165
- if (page !== undefined) parameters.page = `${page}`;
166
- if (orderBy !== undefined) parameters.order = `${orderBy}`;
167
- this.setOption("read.parameters", parameters);
168
- return this;
169
- }
170
-
171
- /**
172
- *
173
- * @return {Monster.Components.Form.Form}
174
- */
175
- [assembleMethodSymbol]() {
176
- super[assembleMethodSymbol]();
177
-
178
- initEventHandler.call(this);
179
- initAutoInit.call(this);
180
- }
181
-
182
- /**
183
- * @deprecated 2023-06-25
184
- * @returns {Promise<never>|*}
185
- */
186
- reload() {
187
- return this.fetch();
188
- }
189
-
190
- /**
191
- * Fetches the data from the rest api
192
- * @returns {Promise<never>|*}
193
- */
194
- fetch() {
195
- const self = this;
196
- const opt = clone(this.getOption("read"));
197
- this[dataSourceSymbol].setOption("read", opt);
198
-
199
- let url = this.getOption("read.url");
200
- const formatter = new Formatter(this.getOption("read.parameters"));
201
-
202
- if (!url) {
203
- return Promise.reject(new Error("No url defined"));
204
- }
205
-
206
- url = formatter.format(url);
207
-
208
- this[dataSourceSymbol].setOption("read.url", url);
209
-
210
- return new Promise((resolve, reject) => {
211
-
212
- fireCustomEvent(self, "monster-datasource-fetch", {
213
- datasource: self,
214
- });
215
-
216
- setTimeout(() => {
217
- self[dataSourceSymbol].read().then((response) => {
218
- fireCustomEvent(self, "monster-datasource-fetched", {
219
- datasource: self,
220
- });
221
-
222
- resolve(response);
223
-
224
- })
225
- .catch((error) => {
226
- fireCustomEvent(self, "monster-datasource-error", {
227
- error: error,
228
- });
229
-
230
- addAttributeToken(self, ATTRIBUTE_ERRORMESSAGE, error.toString());
231
- reject(error);
232
-
233
- });
234
- },0);
235
-
236
- });
237
-
238
-
239
- }
240
-
241
- /**
242
- *
243
- * @return {CSSStyleSheet[]}
244
- */
245
- static getCSSStyleSheet() {
246
- return [DatasourceStyleSheet];
247
- }
248
-
249
- /**
250
- * @private
251
- * @return {string}
252
- */
253
- static getTag() {
254
- return "monster-datasource-rest";
255
- }
256
-
257
- /**
258
- * This method activates the intersection observer manually.
259
- * For this purpose, the option `autoInit.intersectionObserver` must be set to `false`.
260
- *
261
- * @returns {Monster.Components.Datatable.Datasource.Rest}
262
- */
263
- initIntersectionObserver() {
264
- initIntersectionObserver.call(this);
265
- return this;
266
- }
267
-
268
- /**
269
- * @private
270
- */
271
- connectedCallback() {
272
- super.connectedCallback();
273
-
274
- setTimeout(() => {
275
- if (this.getOption("features.filter", false) === true) {
276
- initFilter.call(this);
277
- }
278
- }, 0);
279
- }
280
-
281
- /**
282
- * @private
283
- */
284
- disconnectedCallback() {
285
- super.disconnectedCallback();
286
- removeFilter.call(this);
287
- }
112
+ get defaults() {
113
+ const restOptions = new RestAPI().defaults;
114
+
115
+ restOptions.read.parameters = {
116
+ filter: undefined,
117
+ oderBy: undefined,
118
+ page: "1",
119
+ };
120
+
121
+ return Object.assign({}, super.defaults, restOptions, {
122
+ templates: {
123
+ main: getTemplate(),
124
+ },
125
+
126
+ features: {
127
+ autoInit: true,
128
+ filter: false,
129
+ },
130
+
131
+ autoInit: {
132
+ intersectionObserver: false,
133
+ oneTime: true,
134
+ },
135
+
136
+ filter: {
137
+ id: undefined,
138
+ },
139
+
140
+ datatable: {
141
+ id: undefined,
142
+ },
143
+
144
+ response: {
145
+ errorMessagePath: "sys.message",
146
+ },
147
+ });
148
+ }
149
+
150
+ /**
151
+ *
152
+ * @param {string} page
153
+ * @param {string} query
154
+ * @param {string} orderBy
155
+ * @returns {Monster.Components.Datatable.Datasource.Rest}
156
+ */
157
+ setParameters({ page, query, orderBy }) {
158
+ const parameters = this.getOption("read.parameters");
159
+ if (query !== undefined) {
160
+ parameters.query = `${query}`;
161
+ parameters.page = "1";
162
+ }
163
+
164
+ // after a query the page is set to 1, so if the page is not set, it is set to 1
165
+ if (page !== undefined) parameters.page = `${page}`;
166
+ if (orderBy !== undefined) parameters.order = `${orderBy}`;
167
+ this.setOption("read.parameters", parameters);
168
+ return this;
169
+ }
170
+
171
+ /**
172
+ *
173
+ * @return {Monster.Components.Form.Form}
174
+ */
175
+ [assembleMethodSymbol]() {
176
+ super[assembleMethodSymbol]();
177
+
178
+ initEventHandler.call(this);
179
+ initAutoInit.call(this);
180
+ }
181
+
182
+ /**
183
+ * @deprecated 2023-06-25
184
+ * @returns {Promise<never>|*}
185
+ */
186
+ reload() {
187
+ return this.fetch();
188
+ }
189
+
190
+ /**
191
+ * Fetches the data from the rest api
192
+ * @returns {Promise<never>|*}
193
+ */
194
+ fetch() {;
195
+ const opt = clone(this.getOption("read"));
196
+ this[dataSourceSymbol].setOption("read", opt);
197
+
198
+ let url = this.getOption("read.url");
199
+ const formatter = new Formatter(this.getOption("read.parameters"));
200
+
201
+ if (!url) {
202
+ return Promise.reject(new Error("No url defined"));
203
+ }
204
+
205
+ url = formatter.format(url);
206
+
207
+ this[dataSourceSymbol].setOption("read.url", url);
208
+
209
+ return new Promise((resolve, reject) => {
210
+ fireCustomEvent(this, "monster-datasource-fetch", {
211
+ datasource: this,
212
+ });
213
+
214
+ setTimeout(() => {
215
+ this[dataSourceSymbol]
216
+ .read()
217
+ .then((response) => {
218
+ fireCustomEvent(this, "monster-datasource-fetched", {
219
+ datasource: this,
220
+ });
221
+
222
+ resolve(response);
223
+ })
224
+ .catch((error) => {
225
+ fireCustomEvent(this, "monster-datasource-error", {
226
+ error: error,
227
+ });
228
+
229
+ addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, error.toString());
230
+ reject(error);
231
+ });
232
+ }, 0);
233
+ });
234
+ }
235
+
236
+ /**
237
+ *
238
+ * @return {CSSStyleSheet[]}
239
+ */
240
+ static getCSSStyleSheet() {
241
+ return [DatasourceStyleSheet];
242
+ }
243
+
244
+ /**
245
+ * @private
246
+ * @return {string}
247
+ */
248
+ static getTag() {
249
+ return "monster-datasource-rest";
250
+ }
251
+
252
+ /**
253
+ * This method activates the intersection observer manually.
254
+ * For this purpose, the option `autoInit.intersectionObserver` must be set to `false`.
255
+ *
256
+ * @returns {Monster.Components.Datatable.Datasource.Rest}
257
+ */
258
+ initIntersectionObserver() {
259
+ initIntersectionObserver.call(this);
260
+ return this;
261
+ }
262
+
263
+ /**
264
+ * @private
265
+ */
266
+ connectedCallback() {
267
+ super.connectedCallback();
268
+
269
+ setTimeout(() => {
270
+ if (this.getOption("features.filter", false) === true) {
271
+ initFilter.call(this);
272
+ }
273
+ }, 0);
274
+ }
275
+
276
+ /**
277
+ * @private
278
+ */
279
+ disconnectedCallback() {
280
+ super.disconnectedCallback();
281
+ removeFilter.call(this);
282
+ }
288
283
  }
289
284
 
290
285
  /**
291
286
  * @private
292
287
  */
293
288
  function removeFilter() {
294
- const filterID = this.getOption("filter.id", undefined);
295
- if (!filterID) return;
289
+ const filterID = this.getOption("filter.id", undefined);
290
+ if (!filterID) return;
296
291
 
297
- const filterControl = findElementWithIdUpwards(this, filterID);
292
+ const filterControl = findElementWithIdUpwards(this, filterID);
298
293
 
299
- if (filterControl && this[filterObserverSymbol]) {
300
- filterControl?.detachObserver(this[filterObserverSymbol]);
301
- }
294
+ if (filterControl && this[filterObserverSymbol]) {
295
+ filterControl?.detachObserver(this[filterObserverSymbol]);
296
+ }
302
297
  }
303
298
 
304
-
305
299
  /**
306
300
  * @private
307
301
  */
308
302
  function initFilter() {
309
- const filterID = this.getOption("filter.id", undefined);
310
-
311
- if (!filterID)
312
- throw new Error("filter feature is enabled but no filter id is defined");
313
-
314
- const filterControl = findElementWithIdUpwards(this, filterID);
315
- if (!filterControl)
316
- throw new Error(
317
- "filter feature is enabled but no filter control with id " +
318
- filterID +
319
- " is found",
320
- );
321
-
322
- this[filterObserverSymbol] = new Observer(() => {
323
-
324
- const query = filterControl.getOption("query", undefined);
325
- this.setParameters({query: query});
326
- this.fetch()
327
- .then((response) => {
328
-
329
- if(!(response instanceof Response) ){
330
- throw new Error("Response is not an instance of Response");
331
- }
332
-
333
- if (response?.ok === true) {
334
- this.dispatchEvent(new CustomEvent("reload", {bubbles: true}));
335
- filterControl?.showSuccess();
336
- }
337
-
338
- response
339
- .json()
340
- .then((json) => {
341
- const path = new Pathfinder(json);
342
- const error = path.getVia(
343
- this.getOption("response.errorMessagePath"),
344
- );
345
- if (error) {
346
- filterControl?.showFailureMessage(error);
347
- return;
348
- }
349
-
350
- filterControl?.showFailureMessage(e.message);
351
- })
352
- .catch((e) => {
353
- filterControl?.showFailureMessage(e.message);
354
- });
355
-
356
-
357
- })
358
- .catch((e) => {
359
- this.dispatchEvent(
360
- new CustomEvent("error", {bubbles: true, detail: e}),
361
- );
362
-
363
- if (!(e instanceof Error)) {
364
- e = new Error(e);
365
- }
366
-
367
- filterControl?.showFailureMessage(e.message);
368
- return Promise.reject(e);
369
-
370
- });
371
- });
372
-
373
- filterControl.attachObserver(this[filterObserverSymbol]);
303
+ const filterID = this.getOption("filter.id", undefined);
304
+
305
+ if (!filterID)
306
+ throw new Error("filter feature is enabled but no filter id is defined");
307
+
308
+ const filterControl = findElementWithIdUpwards(this, filterID);
309
+ if (!filterControl)
310
+ throw new Error(
311
+ "filter feature is enabled but no filter control with id " +
312
+ filterID +
313
+ " is found",
314
+ );
315
+
316
+ this[filterObserverSymbol] = new Observer(() => {
317
+ const query = filterControl.getOption("query", undefined);
318
+ this.setParameters({ query: query });
319
+ this.fetch()
320
+ .then((response) => {
321
+ if (!(response instanceof Response)) {
322
+ throw new Error("Response is not an instance of Response");
323
+ }
324
+
325
+ if (response?.ok === true) {
326
+ this.dispatchEvent(new CustomEvent("reload", { bubbles: true }));
327
+ filterControl?.showSuccess();
328
+ }
329
+
330
+ response
331
+ .json()
332
+ .then((json) => {
333
+ const path = new Pathfinder(json);
334
+ const error = path.getVia(
335
+ this.getOption("response.errorMessagePath"),
336
+ );
337
+ if (error) {
338
+ filterControl?.showFailureMessage(error);
339
+ return;
340
+ }
341
+
342
+ filterControl?.showFailureMessage(e.message);
343
+ })
344
+ .catch((e) => {
345
+ filterControl?.showFailureMessage(e.message);
346
+ });
347
+ })
348
+ .catch((e) => {
349
+ this.dispatchEvent(
350
+ new CustomEvent("error", { bubbles: true, detail: e }),
351
+ );
352
+
353
+ if (!(e instanceof Error)) {
354
+ e = new Error(e);
355
+ }
356
+
357
+ filterControl?.showFailureMessage(e.message);
358
+ return Promise.reject(e);
359
+ });
360
+ });
361
+
362
+ filterControl.attachObserver(this[filterObserverSymbol]);
374
363
  }
375
364
 
376
365
  /**
377
366
  * @private
378
367
  */
379
368
  function initAutoInit() {
380
- const autoInit = this.getOption("features.autoInit");
381
- validateBoolean(autoInit);
369
+ const autoInit = this.getOption("features.autoInit");
370
+ validateBoolean(autoInit);
382
371
 
383
- if (autoInit !== true) return;
372
+ if (autoInit !== true) return;
384
373
 
385
- if (this.getOption("autoInit.intersectionObserver") === true) {
386
- initIntersectionObserver.call(this);
387
- return;
388
- }
374
+ if (this.getOption("autoInit.intersectionObserver") === true) {
375
+ initIntersectionObserver.call(this);
376
+ return;
377
+ }
389
378
 
390
- setTimeout(() => {
391
- this.fetch().catch(() => {
392
-
393
- });
394
- }, 0);
379
+ setTimeout(() => {
380
+ this.fetch().catch(() => {});
381
+ }, 0);
395
382
  }
396
383
 
397
384
  function initEventHandler() {
398
- this[intersectionObserverHandlerSymbol] = (entries) => {
399
- entries.forEach((entry) => {
400
- if (entry.isIntersecting) {
401
- if (entry.intersectionRatio > 0) {
402
- this.fetch();
403
- }
404
-
405
- // only load once
406
- if (
407
- this.getOption("autoInit.oneTime") === true &&
408
- this[intersectionObserverObserverSymbol] !== undefined
409
- ) {
410
- this[intersectionObserverObserverSymbol].unobserve(this);
411
- }
412
- }
413
- });
414
- };
385
+ this[intersectionObserverHandlerSymbol] = (entries) => {
386
+ entries.forEach((entry) => {
387
+ if (entry.isIntersecting) {
388
+ if (entry.intersectionRatio > 0) {
389
+ this.fetch();
390
+ }
391
+
392
+ // only load once
393
+ if (
394
+ this.getOption("autoInit.oneTime") === true &&
395
+ this[intersectionObserverObserverSymbol] !== undefined
396
+ ) {
397
+ this[intersectionObserverObserverSymbol].unobserve(this);
398
+ }
399
+ }
400
+ });
401
+ };
415
402
  }
416
403
 
417
404
  function initIntersectionObserver() {
418
- this.classList.add("intersection-observer");
419
-
420
- const options = {
421
- root: null,
422
- rootMargin: "0px",
423
- threshold: 0.1,
424
- };
425
-
426
- this[intersectionObserverObserverSymbol] = new IntersectionObserver(
427
- this[intersectionObserverHandlerSymbol],
428
- options,
429
- );
430
- this[intersectionObserverObserverSymbol].observe(this);
405
+ this.classList.add("intersection-observer");
406
+
407
+ const options = {
408
+ root: null,
409
+ rootMargin: "0px",
410
+ threshold: 0.1,
411
+ };
412
+
413
+ this[intersectionObserverObserverSymbol] = new IntersectionObserver(
414
+ this[intersectionObserverHandlerSymbol],
415
+ options,
416
+ );
417
+ this[intersectionObserverObserverSymbol].observe(this);
431
418
  }
432
419
 
433
420
  /**
@@ -435,8 +422,8 @@ function initIntersectionObserver() {
435
422
  * @return {string}
436
423
  */
437
424
  function getTemplate() {
438
- // language=HTML
439
- return `
425
+ // language=HTML
426
+ return `
440
427
  <slot></slot>`;
441
428
  }
442
429