@schukai/monster 3.65.21 → 3.67.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.
package/CHANGELOG.md CHANGED
@@ -2,20 +2,48 @@
2
2
 
3
3
 
4
4
 
5
+ ## [3.67.0] - 2024-06-22
6
+
7
+ ### Add Features
8
+
9
+ - new options to define the markers that are used for the label template. [#203](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/203) See merge request oss/libraries/javascript/monster[!53](https://gitlab.schukai.com/oss/libraries/javascript/monster/merge_requests/53)
10
+ - new options to define the markers that are used for the label template [#203](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/203)
11
+
12
+ ## 2024-06-22
13
+ - new options to define the markers that are used for the label template [#203](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/203)
14
+
15
+ ## [3.66.0] - 2024-06-21
16
+
17
+ ### Add Features
18
+
19
+ - new flag feature.useStrictValueComparison [#206](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/206)
20
+ - new flag features.storeFetchedData and function Select::getLastFetchedData [#204](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/204)
21
+ ### Bug Fixes
22
+
23
+ - [#200](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/200)
24
+ - [#200](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/200) changes
25
+ - [#201](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/201)
26
+ - slight color adjustments
27
+ ### Changes
28
+
29
+ - tidy project files
30
+ - [#200](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/200) move to close
31
+ - [#200](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/200) move to close
32
+
33
+
34
+
5
35
  ## [3.65.21] - 2024-06-20
6
36
 
7
37
  ### Bug Fixes
8
38
 
9
- - exchange of document.selector with function findElementWithSelectorUpwards [#199](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/199)
39
+ - exchange of `document.selector` with function findElementWithSelectorUpwards [#199](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/199)
10
40
 
11
41
  ## [3.65.20] - 2024-06-20
12
42
 
13
- - Changeover to new release process
43
+ - Changeover to a new release process
14
44
 
15
45
  ## [3.65.3] - 2024-06-19
16
46
 
17
- ### Bug Fixes
18
-
19
47
  - switch nodejs_22 to nodejs_20 (segmentation fault)
20
48
 
21
49
  ## [3.65.1] - 2024-06-17
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.5","@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.65.21"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.5","@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.67.0"}
@@ -20,7 +20,7 @@ import {
20
20
  CustomElement,
21
21
  registerCustomElement,
22
22
  } from "../../dom/customelement.mjs";
23
- import {findElementWithSelectorUpwards} from "../../dom/util.mjs";
23
+ import { findElementWithSelectorUpwards } from "../../dom/util.mjs";
24
24
  import { isString } from "../../types/is.mjs";
25
25
  import { State } from "../form/types/state.mjs";
26
26
  import "../form/state-button.mjs";
@@ -190,9 +190,8 @@ function initControlReferences() {
190
190
  const selector = this.getOption("dataset.selector");
191
191
 
192
192
  if (isString(selector)) {
193
-
194
- const element = findElementWithSelectorUpwards( this,selector);
195
- if (element===null) {
193
+ const element = findElementWithSelectorUpwards(this, selector);
194
+ if (element === null) {
196
195
  throw new Error("the selector must match exactly one element");
197
196
  }
198
197
 
@@ -206,8 +205,8 @@ function initControlReferences() {
206
205
  const selector2 = this.getOption("overlay.selector");
207
206
 
208
207
  if (isString(selector2)) {
209
- const element = findElementWithSelectorUpwards( this,selector);
210
- if (element===null) {
208
+ const element = findElementWithSelectorUpwards(this, selector);
209
+ if (element === null) {
211
210
  throw new Error("the selector must match exactly one element");
212
211
  }
213
212
 
@@ -12,33 +12,33 @@
12
12
  * SPDX-License-Identifier: AGPL-3.0
13
13
  */
14
14
 
15
- import {instanceSymbol, internalSymbol} from "../../constants.mjs";
16
- import {Pathfinder} from "../../data/pathfinder.mjs";
17
- import {getLinkedObjects, hasObjectLink} from "../../dom/attributes.mjs";
18
- import {customElementUpdaterLinkSymbol} from "../../dom/constants.mjs";
15
+ import { instanceSymbol, internalSymbol } from "../../constants.mjs";
16
+ import { Pathfinder } from "../../data/pathfinder.mjs";
17
+ import { getLinkedObjects, hasObjectLink } from "../../dom/attributes.mjs";
18
+ import { customElementUpdaterLinkSymbol } from "../../dom/constants.mjs";
19
19
  import {
20
- assembleMethodSymbol,
21
- CustomElement,
22
- attributeObserverSymbol,
23
- registerCustomElement,
20
+ assembleMethodSymbol,
21
+ CustomElement,
22
+ attributeObserverSymbol,
23
+ registerCustomElement,
24
24
  } from "../../dom/customelement.mjs";
25
- import {findElementWithSelectorUpwards} from "../../dom/util.mjs";
26
- import {isString} from "../../types/is.mjs";
27
- import {Observer} from "../../types/observer.mjs";
28
- import {clone} from "../../util/clone.mjs";
25
+ import { findElementWithSelectorUpwards } from "../../dom/util.mjs";
26
+ import { isString } from "../../types/is.mjs";
27
+ import { Observer } from "../../types/observer.mjs";
28
+ import { clone } from "../../util/clone.mjs";
29
29
  import {
30
- ATTRIBUTE_DATASOURCE_SELECTOR,
31
- ATTRIBUTE_DATATABLE_INDEX,
30
+ ATTRIBUTE_DATASOURCE_SELECTOR,
31
+ ATTRIBUTE_DATATABLE_INDEX,
32
32
  } from "./constants.mjs";
33
- import {Datasource} from "./datasource.mjs";
34
- import {DatasetStyleSheet} from "./stylesheet/dataset.mjs";
33
+ import { Datasource } from "./datasource.mjs";
34
+ import { DatasetStyleSheet } from "./stylesheet/dataset.mjs";
35
35
  import {
36
- handleDataSourceChanges,
37
- datasourceLinkedElementSymbol,
36
+ handleDataSourceChanges,
37
+ datasourceLinkedElementSymbol,
38
38
  } from "./util.mjs";
39
- import {FormStyleSheet} from "../stylesheet/form.mjs";
39
+ import { FormStyleSheet } from "../stylesheet/form.mjs";
40
40
 
41
- export {DataSet};
41
+ export { DataSet };
42
42
 
43
43
  /**
44
44
  * The data set component is used to show the data of a data source.
@@ -79,184 +79,184 @@ export {DataSet};
79
79
  * @summary A data set
80
80
  */
81
81
  class DataSet extends CustomElement {
82
- /**
83
- * This method is called by the `instanceof` operator.
84
- * @returns {symbol}
85
- */
86
- static get [instanceSymbol]() {
87
- return Symbol.for("@schukai/monster/components/dataset@@instance");
88
- }
89
-
90
- /**
91
- * This method determines which attributes are to be monitored by `attributeChangedCallback()`.
92
- *
93
- * @return {string[]}
94
- * @since 1.15.0
95
- */
96
- static get observedAttributes() {
97
- const attributes = super.observedAttributes;
98
- attributes.push(ATTRIBUTE_DATATABLE_INDEX);
99
- return attributes;
100
- }
101
-
102
- /**
103
- * To set the options via the html tag the attribute `data-monster-options` must be used.
104
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
105
- *
106
- * The individual configuration values can be found in the table.
107
- *
108
- * @property {Object} templates Template definitions
109
- * @property {string} templates.main Main template
110
- * @property {object} datasource The datasource
111
- * @property {string} datasource.selector The selector of the datasource
112
- * @property {object} mapping The mapping
113
- * @property {string} mapping.data The data
114
- * @property {number} mapping.index The index
115
- * @property {Array} data The data
116
- */
117
- get defaults() {
118
- const obj = Object.assign({}, super.defaults, {
119
- templates: {
120
- main: getTemplate(),
121
- },
122
-
123
- datasource: {
124
- selector: null,
125
- },
126
-
127
- mapping: {
128
- data: "dataset",
129
- index: 0,
130
- },
131
-
132
- data: {},
133
- });
134
-
135
- updateOptionsFromArguments.call(this, obj);
136
- return obj;
137
- }
138
-
139
- /**
140
- *
141
- * @return {string}
142
- */
143
- static getTag() {
144
- return "monster-dataset";
145
- }
146
-
147
- write() {
148
- return new Promise((resolve, reject) => {
149
- if (!this[datasourceLinkedElementSymbol]) {
150
- reject(new Error("No datasource"));
151
- return;
152
- }
153
-
154
- const internalUpdateCloneData = this.getInternalUpdateCloneData();
155
- if (!internalUpdateCloneData) {
156
- reject(new Error("No update data"));
157
- return;
158
- }
159
-
160
- const internalData = internalUpdateCloneData?.["data"];
161
- if (
162
- internalData === undefined ||
163
- internalData === null ||
164
- internalData === ""
165
- ) {
166
- reject(new Error("No data"));
167
- return;
168
- }
169
-
170
- setTimeout(() => {
171
- const path = this.getOption("mapping.data");
172
- const index = this.getOption("mapping.index");
173
-
174
- let pathWithIndex;
175
-
176
- if (isString(path) && path !== "") {
177
- pathWithIndex = path + "." + index;
178
- } else {
179
- pathWithIndex = index;
180
- }
181
-
182
- const data = this[datasourceLinkedElementSymbol].data;
183
- const unref = JSON.stringify(data);
184
- const ref = JSON.parse(unref);
185
-
186
- new Pathfinder(ref).setVia(pathWithIndex, internalData);
187
-
188
- this[datasourceLinkedElementSymbol].data = ref;
189
-
190
- resolve();
191
- }, 0);
192
- });
193
- }
194
-
195
- /**
196
- * This method is responsible for assembling the component.
197
- *
198
- * It calls the parent's assemble method first, then initializes control references and event handlers.
199
- * If the `datasource.selector` option is provided and is a string, it searches for the corresponding
200
- * element in the DOM using that selector.
201
- *
202
- * If the selector matches exactly one element, it checks if the element is an instance of the `Datasource` class.
203
- *
204
- * If it is, the component's `datasourceLinkedElementSymbol` property is set to the element, and the component
205
- * attaches an observer to the datasource's changes.
206
- *
207
- * The observer is a function that calls the `handleDataSourceChanges` method in the context of the component.
208
- * Additionally, the component attaches an observer to itself, which also calls the `handleDataSourceChanges`
209
- * method in the component's context.
210
- */
211
- [assembleMethodSymbol]() {
212
- super[assembleMethodSymbol]();
213
-
214
- // initControlReferences.call(self);
215
- initEventHandler.call(this);
216
-
217
- const selector = this.getOption("datasource.selector");
218
-
219
- if (isString(selector)) {
220
- const element = findElementWithSelectorUpwards(this, selector);
221
- if (element === null) {
222
- throw new Error("the selector must match exactly one element");
223
- }
224
-
225
- if (!(element instanceof Datasource)) {
226
- throw new TypeError("the element must be a datasource");
227
- }
228
-
229
- this[datasourceLinkedElementSymbol] = element;
230
- element.datasource.attachObserver(
231
- new Observer(handleDataSourceChanges.bind(this)),
232
- );
233
- }
234
-
235
- this.attachObserver(
236
- new Observer(() => {
237
- handleDataSourceChanges.call(this);
238
- }),
239
- );
240
- }
241
-
242
- /**
243
- * @return [CSSStyleSheet]
244
- */
245
- static getCSSStyleSheet() {
246
- return [FormStyleSheet, DatasetStyleSheet];
247
- }
82
+ /**
83
+ * This method is called by the `instanceof` operator.
84
+ * @returns {symbol}
85
+ */
86
+ static get [instanceSymbol]() {
87
+ return Symbol.for("@schukai/monster/components/dataset@@instance");
88
+ }
89
+
90
+ /**
91
+ * This method determines which attributes are to be monitored by `attributeChangedCallback()`.
92
+ *
93
+ * @return {string[]}
94
+ * @since 1.15.0
95
+ */
96
+ static get observedAttributes() {
97
+ const attributes = super.observedAttributes;
98
+ attributes.push(ATTRIBUTE_DATATABLE_INDEX);
99
+ return attributes;
100
+ }
101
+
102
+ /**
103
+ * To set the options via the html tag the attribute `data-monster-options` must be used.
104
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
105
+ *
106
+ * The individual configuration values can be found in the table.
107
+ *
108
+ * @property {Object} templates Template definitions
109
+ * @property {string} templates.main Main template
110
+ * @property {object} datasource The datasource
111
+ * @property {string} datasource.selector The selector of the datasource
112
+ * @property {object} mapping The mapping
113
+ * @property {string} mapping.data The data
114
+ * @property {number} mapping.index The index
115
+ * @property {Array} data The data
116
+ */
117
+ get defaults() {
118
+ const obj = Object.assign({}, super.defaults, {
119
+ templates: {
120
+ main: getTemplate(),
121
+ },
122
+
123
+ datasource: {
124
+ selector: null,
125
+ },
126
+
127
+ mapping: {
128
+ data: "dataset",
129
+ index: 0,
130
+ },
131
+
132
+ data: {},
133
+ });
134
+
135
+ updateOptionsFromArguments.call(this, obj);
136
+ return obj;
137
+ }
138
+
139
+ /**
140
+ *
141
+ * @return {string}
142
+ */
143
+ static getTag() {
144
+ return "monster-dataset";
145
+ }
146
+
147
+ write() {
148
+ return new Promise((resolve, reject) => {
149
+ if (!this[datasourceLinkedElementSymbol]) {
150
+ reject(new Error("No datasource"));
151
+ return;
152
+ }
153
+
154
+ const internalUpdateCloneData = this.getInternalUpdateCloneData();
155
+ if (!internalUpdateCloneData) {
156
+ reject(new Error("No update data"));
157
+ return;
158
+ }
159
+
160
+ const internalData = internalUpdateCloneData?.["data"];
161
+ if (
162
+ internalData === undefined ||
163
+ internalData === null ||
164
+ internalData === ""
165
+ ) {
166
+ reject(new Error("No data"));
167
+ return;
168
+ }
169
+
170
+ setTimeout(() => {
171
+ const path = this.getOption("mapping.data");
172
+ const index = this.getOption("mapping.index");
173
+
174
+ let pathWithIndex;
175
+
176
+ if (isString(path) && path !== "") {
177
+ pathWithIndex = path + "." + index;
178
+ } else {
179
+ pathWithIndex = index;
180
+ }
181
+
182
+ const data = this[datasourceLinkedElementSymbol].data;
183
+ const unref = JSON.stringify(data);
184
+ const ref = JSON.parse(unref);
185
+
186
+ new Pathfinder(ref).setVia(pathWithIndex, internalData);
187
+
188
+ this[datasourceLinkedElementSymbol].data = ref;
189
+
190
+ resolve();
191
+ }, 0);
192
+ });
193
+ }
194
+
195
+ /**
196
+ * This method is responsible for assembling the component.
197
+ *
198
+ * It calls the parent's assemble method first, then initializes control references and event handlers.
199
+ * If the `datasource.selector` option is provided and is a string, it searches for the corresponding
200
+ * element in the DOM using that selector.
201
+ *
202
+ * If the selector matches exactly one element, it checks if the element is an instance of the `Datasource` class.
203
+ *
204
+ * If it is, the component's `datasourceLinkedElementSymbol` property is set to the element, and the component
205
+ * attaches an observer to the datasource's changes.
206
+ *
207
+ * The observer is a function that calls the `handleDataSourceChanges` method in the context of the component.
208
+ * Additionally, the component attaches an observer to itself, which also calls the `handleDataSourceChanges`
209
+ * method in the component's context.
210
+ */
211
+ [assembleMethodSymbol]() {
212
+ super[assembleMethodSymbol]();
213
+
214
+ // initControlReferences.call(self);
215
+ initEventHandler.call(this);
216
+
217
+ const selector = this.getOption("datasource.selector");
218
+
219
+ if (isString(selector)) {
220
+ const element = findElementWithSelectorUpwards(this, selector);
221
+ if (element === null) {
222
+ throw new Error("the selector must match exactly one element");
223
+ }
224
+
225
+ if (!(element instanceof Datasource)) {
226
+ throw new TypeError("the element must be a datasource");
227
+ }
228
+
229
+ this[datasourceLinkedElementSymbol] = element;
230
+ element.datasource.attachObserver(
231
+ new Observer(handleDataSourceChanges.bind(this)),
232
+ );
233
+ }
234
+
235
+ this.attachObserver(
236
+ new Observer(() => {
237
+ handleDataSourceChanges.call(this);
238
+ }),
239
+ );
240
+ }
241
+
242
+ /**
243
+ * @return [CSSStyleSheet]
244
+ */
245
+ static getCSSStyleSheet() {
246
+ return [FormStyleSheet, DatasetStyleSheet];
247
+ }
248
248
  }
249
249
 
250
250
  /**
251
251
  * @private
252
252
  */
253
253
  function initEventHandler() {
254
- this[attributeObserverSymbol][ATTRIBUTE_DATATABLE_INDEX] = () => {
255
- const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX);
256
- if (index) {
257
- this.setOption("mapping.index", parseInt(index, 10));
258
- }
259
- };
254
+ this[attributeObserverSymbol][ATTRIBUTE_DATATABLE_INDEX] = () => {
255
+ const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX);
256
+ if (index) {
257
+ this.setOption("mapping.index", parseInt(index, 10));
258
+ }
259
+ };
260
260
  }
261
261
 
262
262
  /**
@@ -264,17 +264,17 @@ function initEventHandler() {
264
264
  * @param {Object} options
265
265
  */
266
266
  function updateOptionsFromArguments(options) {
267
- const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX);
267
+ const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX);
268
268
 
269
- if (index !== null && index !== undefined) {
270
- options.mapping.index = parseInt(index, 10);
271
- }
269
+ if (index !== null && index !== undefined) {
270
+ options.mapping.index = parseInt(index, 10);
271
+ }
272
272
 
273
- const selector = this.getAttribute(ATTRIBUTE_DATASOURCE_SELECTOR);
273
+ const selector = this.getAttribute(ATTRIBUTE_DATASOURCE_SELECTOR);
274
274
 
275
- if (selector) {
276
- options.datasource.selector = selector;
277
- }
275
+ if (selector) {
276
+ options.datasource.selector = selector;
277
+ }
278
278
  }
279
279
 
280
280
  /**
@@ -282,8 +282,8 @@ function updateOptionsFromArguments(options) {
282
282
  * @return {string}
283
283
  */
284
284
  function getTemplate() {
285
- // language=HTML
286
- return `
285
+ // language=HTML
286
+ return `
287
287
  <div data-monster-role="control" part="control">
288
288
  <slot></slot>
289
289
  </div>
@@ -175,7 +175,7 @@ function updateDataSource() {
175
175
 
176
176
  data = Object.assign({}, d);
177
177
  });
178
-
178
+
179
179
  if (data === null) {
180
180
  data = [];
181
181
  }
@@ -65,7 +65,11 @@ import {
65
65
  } from "./util.mjs";
66
66
  import "./columnbar.mjs";
67
67
  import "./filter-button.mjs";
68
- import {findElementWithSelectorUpwards, getDocument, getWindow} from "../../dom/util.mjs";
68
+ import {
69
+ findElementWithSelectorUpwards,
70
+ getDocument,
71
+ getWindow,
72
+ } from "../../dom/util.mjs";
69
73
  import { addAttributeToken } from "../../dom/attributes.mjs";
70
74
  import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";
71
75
  import { getDocumentTranslations } from "../../i18n/translations.mjs";
@@ -275,8 +279,8 @@ class DataTable extends CustomElement {
275
279
  const selector = this.getOption("datasource.selector");
276
280
 
277
281
  if (isString(selector)) {
278
- const element = findElementWithSelectorUpwards( this,selector);
279
- if (element===null) {
282
+ const element = findElementWithSelectorUpwards(this, selector);
283
+ if (element === null) {
280
284
  throw new Error("the selector must match exactly one element");
281
285
  }
282
286
 
@@ -511,7 +515,7 @@ function getFilterConfigKey() {
511
515
  * @returns {Promise}
512
516
  */
513
517
  function getHostConfig(callback) {
514
- const host = findElementWithSelectorUpwards( this,"monster-host");
518
+ const host = findElementWithSelectorUpwards(this, "monster-host");
515
519
 
516
520
  if (!(host && this.id)) {
517
521
  return Promise.resolve({});
@@ -607,7 +611,7 @@ function updateConfigColumnBar() {
607
611
  map[option.name] = option.visible;
608
612
  }
609
613
 
610
- const host = findElementWithSelectorUpwards( this,"monster-host");
614
+ const host = findElementWithSelectorUpwards(this, "monster-host");
611
615
  if (!(host && this.id)) {
612
616
  return;
613
617
  }
@@ -814,7 +818,7 @@ function storeOrderStatement(doFetch) {
814
818
  const statement = createOrderStatement(headers);
815
819
  setDataSource.call(this, { orderBy: statement }, doFetch);
816
820
 
817
- const host = findElementWithSelectorUpwards( this,"monster-host");
821
+ const host = findElementWithSelectorUpwards(this, "monster-host");
818
822
  if (!(host && this.id)) {
819
823
  return;
820
824
  }