@schukai/monster 3.95.2 → 3.96.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 (31) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +1 -1
  3. package/source/components/datatable/dataset.mjs +23 -19
  4. package/source/components/datatable/datasource/dom.mjs +4 -6
  5. package/source/components/datatable/datasource/rest.mjs +469 -471
  6. package/source/components/datatable/datasource.mjs +0 -8
  7. package/source/components/datatable/pagination.mjs +433 -439
  8. package/source/components/datatable/status.mjs +1 -3
  9. package/source/components/datatable/stylesheet/pagination.mjs +13 -6
  10. package/source/components/datatable/util.mjs +1 -1
  11. package/source/components/form/select.mjs +1 -1
  12. package/source/components/form/toggle-switch.mjs +2 -6
  13. package/source/components/layout/tabs.mjs +897 -895
  14. package/source/components/notify/message.mjs +10 -14
  15. package/source/components/notify/notify.mjs +9 -13
  16. package/source/components/notify/stylesheet/notify.mjs +13 -6
  17. package/source/components/state/log.mjs +184 -184
  18. package/source/components/state/stylesheet/log.mjs +13 -6
  19. package/source/data/datasource/server/restapi.mjs +2 -3
  20. package/source/data/transformer.mjs +803 -806
  21. package/source/dom/customelement.mjs +0 -34
  22. package/source/dom/updater.mjs +767 -767
  23. package/source/i18n/time-ago.mjs +1352 -636
  24. package/source/monster.mjs +2 -0
  25. package/source/types/has.mjs +3 -6
  26. package/source/types/version.mjs +1 -1
  27. package/test/cases/components/form/form.mjs +166 -125
  28. package/test/cases/monster.mjs +1 -1
  29. package/test/web/import.js +1 -0
  30. package/test/web/test.html +2 -2
  31. package/test/web/tests.js +2080 -1433
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
 
4
4
 
5
+ ## [3.96.0] - 2024-12-29
6
+
7
+ ### Add Features
8
+
9
+ - **tabs:** add auto open feature [#273](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/273)
10
+ ### Bug Fixes
11
+
12
+ - the form tests are outdated
13
+ ### Changes
14
+
15
+ - update project
16
+
17
+
18
+
5
19
  ## [3.95.2] - 2024-12-28
6
20
 
7
21
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.12","@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.95.2"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.12","@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.96.0"}
@@ -42,7 +42,7 @@ export {DataSet};
42
42
  *
43
43
  * @fragments /fragments/components/datatable/dataset
44
44
  *
45
- * @example /examples/components/datatable/dataset-simple
45
+ * @example /examples/components/datatable/dataset-dom
46
46
  * @example /examples/components/datatable/dataset-rest
47
47
  *
48
48
  * @issue https://localhost.alvine.dev:8443/development/issues/closed/272.html
@@ -224,7 +224,6 @@ class DataSet extends CustomElement {
224
224
  super[assembleMethodSymbol]();
225
225
 
226
226
  requestAnimationFrame(() => {
227
-
228
227
  if (!this[datasourceLinkedElementSymbol]) {
229
228
  const selector = this.getOption("datasource.selector");
230
229
 
@@ -257,9 +256,7 @@ class DataSet extends CustomElement {
257
256
  }
258
257
 
259
258
  initEventHandler.call(this);
260
-
261
259
  });
262
-
263
260
  }
264
261
 
265
262
  /**
@@ -274,8 +271,8 @@ class DataSet extends CustomElement {
274
271
  * @private
275
272
  */
276
273
  function initEventHandler() {
277
-
278
- this[attributeObserverSymbol][ATTRIBUTE_DATATABLE_INDEX] = () => { // @deprecated use data-monster-option-mapping-index
274
+ this[attributeObserverSymbol][ATTRIBUTE_DATATABLE_INDEX] = () => {
275
+ // @deprecated use data-monster-option-mapping-index
279
276
  const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX);
280
277
  if (index) {
281
278
  this.setOption("mapping.index", parseInt(index, 10));
@@ -292,32 +289,39 @@ function initEventHandler() {
292
289
  };
293
290
 
294
291
  if (this[datasourceLinkedElementSymbol]) {
295
-
296
292
  this[datasourceLinkedElementSymbol].datasource.attachObserver(
297
293
  new Observer(() => {
298
- const page = this[datasourceLinkedElementSymbol]?.currentPage();
299
- if (page !== null && page !== undefined && page !== "") {
300
- const index = parseInt(page, 10) - 1;
301
- this.setOption("mapping.index", index);
302
- handleDataSourceChanges.call(this);
294
+
295
+ let index = 0;
296
+ if (typeof this[datasourceLinkedElementSymbol]?.currentPage === "function") {
297
+ const page = this[datasourceLinkedElementSymbol].currentPage();
298
+ if (page !== null && page !== undefined && page !== "") {
299
+ index = parseInt(page, 10) - 1;
300
+ }
303
301
  }
302
+
303
+ this.setOption("mapping.index", index);
304
+ handleDataSourceChanges.call(this);
304
305
  }),
305
306
  );
306
307
 
307
308
  this[datasourceLinkedElementSymbol].attachObserver(
308
309
  new Observer(() => {
309
- const page = this[datasourceLinkedElementSymbol]?.currentPage();
310
- if (page !== null && page !== undefined && page !== "") {
311
- const index = parseInt(page, 10) - 1;
312
- this.setOption("mapping.index", index);
313
- handleDataSourceChanges.call(this);
310
+ let index = 0;
311
+ if (typeof this[datasourceLinkedElementSymbol]?.currentPage === "function") {
312
+ const page = this[datasourceLinkedElementSymbol].currentPage();
313
+ if (page !== null && page !== undefined && page !== "") {
314
+ index = parseInt(page, 10) - 1;
315
+ }
314
316
  }
317
+
318
+ this.setOption("mapping.index", index);
319
+ handleDataSourceChanges.call(this);
315
320
  }),
316
321
  );
317
322
 
318
323
  handleDataSourceChanges.call(this);
319
324
  }
320
-
321
325
  }
322
326
 
323
327
  /**
@@ -325,7 +329,7 @@ function initEventHandler() {
325
329
  * @param {Object} options
326
330
  */
327
331
  function updateOptionsFromArguments(options) {
328
- const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX); // @deprecated use data-monster-option-mapping-index
332
+ const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX); // @deprecated use data-monster-option-mapping-index
329
333
 
330
334
  if (index !== null && index !== undefined) {
331
335
  options.mapping.index = parseInt(index, 10);
@@ -72,8 +72,8 @@ class Dom extends Datasource {
72
72
  pages: 1,
73
73
  objectsPerPage: 10,
74
74
  currentPage: 1,
75
- }
76
- }
75
+ },
76
+ },
77
77
  });
78
78
  }
79
79
 
@@ -92,7 +92,7 @@ class Dom extends Datasource {
92
92
  * @param {string} page
93
93
  * @return {Dom}
94
94
  */
95
- setParameters({page}) {
95
+ setParameters({ page }) {
96
96
  this.setOption("sys.pagination.currentPage", page);
97
97
  return this;
98
98
  }
@@ -199,14 +199,12 @@ function updateDataSource() {
199
199
  }
200
200
 
201
201
  // set pagination
202
- this.setOption("sys.pagination.objectsPerPage", 1 );
202
+ this.setOption("sys.pagination.objectsPerPage", 1);
203
203
  this.setOption("sys.pagination.pages", data.length);
204
204
  this.setOption("sys.pagination.currentPage", 1);
205
205
 
206
206
  /** call setter */
207
207
  this.data = data;
208
-
209
-
210
208
  }
211
209
 
212
210
  /**