@schukai/monster 3.73.9 → 3.75.0

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 (35) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/package.json +1 -1
  3. package/source/components/datatable/change-button.mjs +4 -4
  4. package/source/components/datatable/columnbar.mjs +2 -2
  5. package/source/components/datatable/dataset.mjs +2 -2
  6. package/source/components/datatable/datasource/rest.mjs +8 -8
  7. package/source/components/datatable/datatable.mjs +6 -6
  8. package/source/components/datatable/filter/date-range.mjs +6 -6
  9. package/source/components/datatable/filter/range.mjs +4 -4
  10. package/source/components/datatable/filter.mjs +4 -4
  11. package/source/components/datatable/save-button.mjs +4 -4
  12. package/source/components/datatable/util.mjs +2 -2
  13. package/source/components/form/api-button.mjs +0 -1
  14. package/source/components/form/context-error.mjs +0 -1
  15. package/source/components/form/context-help.mjs +0 -1
  16. package/source/components/form/message-state-button.mjs +0 -1
  17. package/source/components/form/popper-button.mjs +0 -1
  18. package/source/components/form/select.mjs +16 -5
  19. package/source/components/form/toggle-switch.mjs +0 -3
  20. package/source/components/form/tree-select.mjs +0 -1
  21. package/source/components/layout/slider.mjs +649 -0
  22. package/source/components/layout/style/slider.pcss +114 -0
  23. package/source/components/layout/stylesheet/slider.mjs +38 -0
  24. package/source/components/navigation/table-of-content.mjs +0 -1
  25. package/source/components/tree-menu/dragable-tree-menu.mjs +4 -4
  26. package/source/components/tree-menu/tree-menu.mjs +6 -6
  27. package/source/data/datasource/server/restapi.mjs +0 -1
  28. package/source/dom/events.mjs +1 -1
  29. package/source/dom/updater.mjs +767 -772
  30. package/source/monster.mjs +11 -3
  31. package/source/types/observer.mjs +7 -8
  32. package/source/types/version.mjs +1 -1
  33. package/test/cases/monster.mjs +1 -1
  34. package/test/web/test.html +2 -2
  35. package/test/web/tests.js +243 -202
package/CHANGELOG.md CHANGED
@@ -2,6 +2,33 @@
2
2
 
3
3
 
4
4
 
5
+ ## [3.75.0] - 2024-09-23
6
+
7
+ ### Add Features
8
+
9
+ - marker for select filter [#240](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/240)
10
+ ### Changes
11
+
12
+ - remove unused files
13
+ - run webtests
14
+ - new development cert
15
+ ### Documentation
16
+
17
+ - fix some small issues
18
+
19
+
20
+
21
+ ## [3.74.0] - 2024-09-18
22
+
23
+ ### Add Features
24
+
25
+ - new slider [#237](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/237)
26
+ ### Bug Fixes
27
+
28
+ - performance tweak [#235](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/235)
29
+
30
+
31
+
5
32
  ## [3.73.9] - 2024-09-15
6
33
 
7
34
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.11","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.73.9"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.11","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.75.0"}
@@ -222,7 +222,7 @@ function initControlReferences() {
222
222
  );
223
223
 
224
224
  if (this[stateButtonElementSymbol]) {
225
- setTimeout(() => {
225
+ queueMicrotask(() => {
226
226
  const states = {
227
227
  changed: new State(
228
228
  "changed",
@@ -239,7 +239,7 @@ function initControlReferences() {
239
239
  "labels.button",
240
240
  this.getOption("labels.button"),
241
241
  );
242
- }, 1);
242
+ });
243
243
  }
244
244
 
245
245
  return this;
@@ -278,7 +278,7 @@ function getIndex() {
278
278
  * @private
279
279
  */
280
280
  function initEventHandler() {
281
- setTimeout(() => {
281
+ queueMicrotask(() => {
282
282
  this[stateButtonElementSymbol].setOption("actions.click", () => {
283
283
  const index = getIndex.call(this);
284
284
 
@@ -287,7 +287,7 @@ function initEventHandler() {
287
287
  this[overlayLinkedElementSymbol].open();
288
288
  }
289
289
  });
290
- }, 1);
290
+ });
291
291
  }
292
292
 
293
293
  /**
@@ -249,12 +249,12 @@ function initEventHandler() {
249
249
  if (self[settingsLayerElementSymbol].classList.contains("visible")) {
250
250
  self[popperInstanceSymbol].update();
251
251
 
252
- setTimeout(() => {
252
+ queueMicrotask(() => {
253
253
  document.body.addEventListener(
254
254
  "click",
255
255
  self[settingsButtonEventHandlerSymbol],
256
256
  );
257
- }, 0);
257
+ });
258
258
  }
259
259
  }
260
260
  });
@@ -198,7 +198,7 @@ class DataSet extends CustomElement {
198
198
  return;
199
199
  }
200
200
 
201
- setTimeout(() => {
201
+ queueMicrotask(() => {
202
202
  const path = this.getOption("mapping.data");
203
203
  const index = this.getOption("mapping.index");
204
204
 
@@ -224,7 +224,7 @@ class DataSet extends CustomElement {
224
224
  this[datasourceLinkedElementSymbol].data = ref;
225
225
 
226
226
  resolve();
227
- }, 0);
227
+ });
228
228
  });
229
229
  }
230
230
 
@@ -234,7 +234,7 @@ class Rest extends Datasource {
234
234
  datasource: this,
235
235
  });
236
236
 
237
- setTimeout(() => {
237
+ queueMicrotask(() => {
238
238
  this[dataSourceSymbol]
239
239
  .read()
240
240
  .then((response) => {
@@ -252,7 +252,7 @@ class Rest extends Datasource {
252
252
  addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, error.toString());
253
253
  reject(error);
254
254
  });
255
- }, 0);
255
+ });
256
256
  });
257
257
  }
258
258
 
@@ -289,11 +289,11 @@ class Rest extends Datasource {
289
289
  connectedCallback() {
290
290
  super.connectedCallback();
291
291
 
292
- setTimeout(() => {
292
+ queueMicrotask(() => {
293
293
  if (this.getOption("features.filter", false) === true) {
294
294
  initFilter.call(this);
295
295
  }
296
- }, 0);
296
+ });
297
297
  }
298
298
 
299
299
  /**
@@ -335,7 +335,7 @@ class Rest extends Datasource {
335
335
  datasource: this,
336
336
  });
337
337
 
338
- setTimeout(() => {
338
+ queueMicrotask(() => {
339
339
  this[dataSourceSymbol]
340
340
  .write()
341
341
  .then((response) => {
@@ -353,7 +353,7 @@ class Rest extends Datasource {
353
353
  addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, error.toString());
354
354
  reject(error);
355
355
  });
356
- }, 0);
356
+ });
357
357
  });
358
358
  }
359
359
  }
@@ -492,9 +492,9 @@ function initAutoInit() {
492
492
  return;
493
493
  }
494
494
 
495
- setTimeout(() => {
495
+ queueMicrotask(() => {
496
496
  this.fetch().catch(() => {});
497
- }, 0);
497
+ });
498
498
  }
499
499
 
500
500
  function initEventHandler() {
@@ -290,12 +290,12 @@ class DataTable extends CustomElement {
290
290
 
291
291
  this[datasourceLinkedElementSymbol] = element;
292
292
 
293
- setTimeout(() => {
293
+ queueMicrotask(() => {
294
294
  handleDataSourceChanges.call(this);
295
295
  element.datasource.attachObserver(
296
296
  new Observer(handleDataSourceChanges.bind(this)),
297
297
  );
298
- }, 0);
298
+ });
299
299
  }
300
300
 
301
301
  getHostConfig
@@ -658,7 +658,7 @@ function initEventHandler() {
658
658
 
659
659
  headers[index].changeDirection();
660
660
 
661
- setTimeout(function () {
661
+ queueMicrotask(function () {
662
662
  /** hotfix, normally this should be done via the updater, no idea why this is not possible. */
663
663
  element.setAttribute(
664
664
  ATTRIBUTE_DATATABLE_SORTABLE,
@@ -666,7 +666,7 @@ function initEventHandler() {
666
666
  );
667
667
 
668
668
  storeOrderStatement.call(self, true);
669
- }, 0);
669
+ });
670
670
  }
671
671
  });
672
672
  }
@@ -797,9 +797,9 @@ function initGridAndStructs(hostConfig, headerOrderMap) {
797
797
  }
798
798
 
799
799
  this.setOption("headers", headers);
800
- setTimeout(() => {
800
+ queueMicrotask(() => {
801
801
  storeOrderStatement.call(this, this.getOption("features.autoInit"));
802
- }, 0);
802
+ });
803
803
  }
804
804
 
805
805
  /**
@@ -480,9 +480,9 @@ function initEventHandler() {
480
480
 
481
481
  // change the input value if the user change the value of the radio button
482
482
  this[inputElementSymbol].addEventListener("change", (event) => {
483
- setTimeout(() => {
483
+ queueMicrotask(() => {
484
484
  updatePopperInputsFromMainValue.call(this);
485
- }, 0);
485
+ });
486
486
  });
487
487
 
488
488
  // if the user change the value of on of the input fields, we should update the value of the input field
@@ -514,9 +514,9 @@ function initEventHandler() {
514
514
  if (event.key === "Escape") {
515
515
  hide.call(this);
516
516
 
517
- setTimeout(() => {
517
+ queueMicrotask(() => {
518
518
  this[inputElementSymbol].focus();
519
- }, 10);
519
+ });
520
520
 
521
521
  return;
522
522
  }
@@ -600,10 +600,10 @@ function show() {
600
600
  clearAndDisableFormGroups.call(this);
601
601
  }
602
602
 
603
- setTimeout(() => {
603
+ queueMicrotask(() => {
604
604
  updatePopperInputsFromMainValue.call(this);
605
605
  updatePopper.call(this);
606
- }, 0);
606
+ });
607
607
  }
608
608
 
609
609
  /**
@@ -412,9 +412,9 @@ function initEventHandler() {
412
412
  // if key code esc than hide dialog
413
413
  if (event.key === "Escape") {
414
414
  hide.call(this);
415
- setTimeout(() => {
415
+ queueMicrotask(() => {
416
416
  this[inputElementSymbol].focus();
417
- }, 10);
417
+ });
418
418
 
419
419
  return;
420
420
  }
@@ -438,7 +438,7 @@ function initEventHandler() {
438
438
  if (radio) {
439
439
  radio.checked = true;
440
440
  }
441
- setTimeout(() => {
441
+ queueMicrotask(() => {
442
442
  // focus the input field
443
443
  const input = this[formContainerElementSymbol].querySelector(
444
444
  "input[type=radio][value=single] ~ input[name=singleValue]",
@@ -446,7 +446,7 @@ function initEventHandler() {
446
446
  if (input) {
447
447
  input.focus();
448
448
  }
449
- }, 10);
449
+ });
450
450
  }
451
451
  });
452
452
 
@@ -386,14 +386,14 @@ function initControlReferences() {
386
386
  }
387
387
 
388
388
  function updateFilterSelections() {
389
- setTimeout(() => {
389
+ queueMicrotask(() => {
390
390
  const options = this[settingsSymbol].getOptions();
391
391
  this[filterSelectElementSymbol].setOption("options", options);
392
- setTimeout(() => {
392
+ queueMicrotask(() => {
393
393
  this[filterSelectElementSymbol].value =
394
394
  this[settingsSymbol].getSelected();
395
- }, 10);
396
- }, 10);
395
+ });
396
+ });
397
397
  }
398
398
 
399
399
  /**
@@ -260,7 +260,7 @@ function initControlReferences() {
260
260
  );
261
261
 
262
262
  if (this[stateButtonElementSymbol]) {
263
- setTimeout(() => {
263
+ queueMicrotask(() => {
264
264
  const states = {
265
265
  changed: new State(
266
266
  "changed",
@@ -278,7 +278,7 @@ function initControlReferences() {
278
278
  "labels.button",
279
279
  this.getOption("labels.button"),
280
280
  );
281
- }, 1);
281
+ });
282
282
  }
283
283
 
284
284
  return this;
@@ -288,7 +288,7 @@ function initControlReferences() {
288
288
  * @private
289
289
  */
290
290
  function initEventHandler() {
291
- setTimeout(() => {
291
+ queueMicrotask(() => {
292
292
  this[stateButtonElementSymbol].setOption("actions.click", () => {
293
293
  this[datasourceLinkedElementSymbol]
294
294
  .write()
@@ -308,7 +308,7 @@ function initEventHandler() {
308
308
  addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, error.toString());
309
309
  });
310
310
  });
311
- }, 1);
311
+ });
312
312
  }
313
313
 
314
314
  /**
@@ -66,7 +66,7 @@ function handleDataSourceChanges() {
66
66
  return;
67
67
  }
68
68
 
69
- setTimeout(() => {
69
+ queueMicrotask(() => {
70
70
  this.setOption("data", data);
71
- }, 0);
71
+ });
72
72
  }
@@ -204,7 +204,6 @@ class ApiButton extends ActionButton {
204
204
  /**
205
205
  * Import buttons from a map.
206
206
  *
207
- * @since 0.16.0
208
207
  * @param {array|object|Map|Set} data
209
208
  * @return {Monster.Components.Form.ApiButton}
210
209
  * @throws {Error} map is not iterable
@@ -81,7 +81,6 @@ class ContextError extends Popper {
81
81
  * This method is called by the `instanceof` operator.
82
82
  *
83
83
  * @returns {symbol}
84
- * @since 2.1.0
85
84
  */
86
85
  static get [instanceSymbol]() {
87
86
  return Symbol.for(
@@ -71,7 +71,6 @@ class ContextHelp extends Popper {
71
71
  /**
72
72
  * This method is called by the `instanceof` operator.
73
73
  * @returns {symbol}
74
- * @since 2.1.0
75
74
  */
76
75
  static get [instanceSymbol]() {
77
76
  return Symbol.for(
@@ -88,7 +88,6 @@ class MessageStateButton extends Popper {
88
88
  /**
89
89
  * This method is called by the `instanceof` operator.
90
90
  * @returns {symbol}
91
- * @since 2.1.0
92
91
  */
93
92
  static get [instanceSymbol]() {
94
93
  return Symbol.for(
@@ -331,7 +331,6 @@ class PopperButton extends Popper {
331
331
  * ```
332
332
  *
333
333
  * @property {string|array} value
334
- * @since 1.2.0
335
334
  * @throws {Error} unsupported type
336
335
  */
337
336
  set value(value) {
@@ -277,7 +277,6 @@ const FILTER_POSITION_INLINE = "inline";
277
277
  * @example /examples/components/form/select-simple
278
278
  * @example /examples/components/form/select-with-options
279
279
  *
280
- * @since 1.0.0
281
280
  * @copyright schukai GmbH
282
281
  * @summary A beautiful select control that can make your life easier and also looks good.
283
282
  * @fires monster-options-set
@@ -297,7 +296,6 @@ class Select extends CustomControl {
297
296
  /**
298
297
  * This method is called by the `instanceof` operator.
299
298
  * @returns {Symbol}
300
- * @since 2.1.0
301
299
  */
302
300
  static get [instanceSymbol]() {
303
301
  return Symbol.for("@schukai/monster/components/form/select@@instance");
@@ -336,7 +334,6 @@ class Select extends CustomControl {
336
334
  * ```
337
335
  *
338
336
  * @property {string|array} value
339
- * @since 1.2.0
340
337
  * @throws {Error} unsupported type
341
338
  */
342
339
  set value(value) {
@@ -458,6 +455,10 @@ class Select extends CustomControl {
458
455
  defaultValue: "*",
459
456
  mode: FILTER_MODE_DISABLED,
460
457
  position: FILTER_POSITION_INLINE,
458
+ marker: {
459
+ open: "{",
460
+ close: "}",
461
+ },
461
462
  },
462
463
  classes: {
463
464
  badge: "monster-badge-primary",
@@ -721,7 +722,6 @@ class Select extends CustomControl {
721
722
  * Import Select Options from dataset
722
723
  * Not to be confused with the control defaults/options
723
724
  *
724
- * @since 0.16.0
725
725
  * @param {array|object|Map|Set} data
726
726
  * @return {Select}
727
727
  * @throws {Error} map is not iterable
@@ -1473,7 +1473,18 @@ function filterFromRemote() {
1473
1473
  );
1474
1474
  let url = optionUrl;
1475
1475
  if (filterValue.length > 0) {
1476
- url = new Formatter({ filter: filterValue }).format(optionUrl);
1476
+ const formatter = new Formatter({ filter: filterValue });
1477
+ const openMarker = this.getOption("formatter.marker.open");
1478
+ let closeMarker = this.getOption("formatter.marker.close");
1479
+ if (!closeMarker) {
1480
+ closeMarker = openMarker;
1481
+ }
1482
+
1483
+ if (openMarker && closeMarker) {
1484
+ formatter.setMarker(openMarker, closeMarker);
1485
+ }
1486
+
1487
+ url = formatter.format(optionUrl);
1477
1488
  }
1478
1489
 
1479
1490
  this.fetch(url)
@@ -105,8 +105,6 @@ class ToggleSwitch extends CustomControl {
105
105
  * @property {string} actions.off=specifies the action for the off state.
106
106
  * @property {Object} templates
107
107
  * @property {string} templates.main=specifies the main template used by the control.
108
- *
109
- * @since 3.57.0
110
108
  */
111
109
  get defaults() {
112
110
  return Object.assign({}, super.defaults, {
@@ -317,7 +315,6 @@ class ToggleSwitch extends CustomControl {
317
315
  /**
318
316
  * This method is called by the `instanceof` operator.
319
317
  * @returns {symbol}
320
- * @since 2.1.0
321
318
  */
322
319
  static get [instanceSymbol]() {
323
320
  return Symbol.for(
@@ -133,7 +133,6 @@ class TreeSelect extends Select {
133
133
  * Import Select Options from dataset
134
134
  * Not to be confused with the control defaults/options
135
135
  *
136
- * @since 0.16.0
137
136
  * @param {array|object|Map|Set} data
138
137
  * @return {Select}
139
138
  * @throws {Error} map is not iterable