@schukai/monster 4.57.0 → 4.58.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 (29) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +1 -1
  3. package/source/components/data/stylesheet/metric-graph.mjs +1 -1
  4. package/source/components/data/stylesheet/metric.mjs +1 -1
  5. package/source/components/datatable/datasource/rest.mjs +141 -14
  6. package/source/components/datatable/datatable.mjs +3 -7
  7. package/source/components/datatable/save-button.mjs +348 -334
  8. package/source/components/datatable/status.mjs +7 -0
  9. package/source/components/datatable/util.mjs +7 -0
  10. package/source/components/form/button-bar.mjs +193 -95
  11. package/source/components/form/field-set.mjs +283 -283
  12. package/source/components/form/form.mjs +407 -169
  13. package/source/components/form/login.mjs +1571 -1571
  14. package/source/components/form/quantity.mjs +233 -233
  15. package/source/components/form/select.mjs +3106 -3101
  16. package/source/components/form/style/field-set.pcss +6 -2
  17. package/source/components/form/style/form.pcss +8 -0
  18. package/source/components/form/stylesheet/field-set.mjs +1 -1
  19. package/source/components/form/stylesheet/form.mjs +1 -1
  20. package/source/components/form/stylesheet/select.mjs +13 -6
  21. package/source/components/style/typography.css +2 -2
  22. package/source/components/tree-menu/stylesheet/tree-menu.mjs +1 -1
  23. package/source/constraints/abstract.mjs +17 -17
  24. package/source/dom/customelement.mjs +962 -963
  25. package/source/dom/updater.mjs +874 -863
  26. package/source/dom/util/init-options-from-attributes.mjs +56 -56
  27. package/source/monster.mjs +0 -1
  28. package/source/net/webconnect.mjs +325 -325
  29. package/source/types/is.mjs +66 -66
@@ -15,14 +15,14 @@
15
15
  import { instanceSymbol } from "../../constants.mjs";
16
16
  import { addAttributeToken } from "../../dom/attributes.mjs";
17
17
  import {
18
- ATTRIBUTE_ERRORMESSAGE,
19
- ATTRIBUTE_ROLE,
18
+ ATTRIBUTE_ERRORMESSAGE,
19
+ ATTRIBUTE_ROLE,
20
20
  } from "../../dom/constants.mjs";
21
21
  import { CustomControl } from "../../dom/customcontrol.mjs";
22
22
  import {
23
- assembleMethodSymbol,
24
- getSlottedElements,
25
- registerCustomElement,
23
+ assembleMethodSymbol,
24
+ getSlottedElements,
25
+ registerCustomElement,
26
26
  } from "../../dom/customelement.mjs";
27
27
  import { isFunction } from "../../types/is.mjs";
28
28
  import { FieldSetStyleSheet } from "./stylesheet/field-set.mjs";
@@ -82,168 +82,168 @@ const extendedSwitchElementSymbol = Symbol("extendedSwitchElement");
82
82
  * @summary A field set control
83
83
  */
84
84
  class FieldSet extends CustomControl {
85
- /**
86
- * This method is called by the `instanceof` operator.
87
- * @return {symbol}
88
- */
89
- static get [instanceSymbol]() {
90
- return Symbol.for("@schukai/monster/components/form/fieldset@@instance");
91
- }
92
-
93
- /**
94
- * @return {Components.Form.FieldSet
95
- */
96
- [assembleMethodSymbol]() {
97
- super[assembleMethodSymbol]();
98
- initControlReferences.call(this);
99
- initEventHandler.call(this);
100
- updateExtendedFields.call(this);
101
- updateColumns.call(this);
102
- return this;
103
- }
104
-
105
- /**
106
- * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
107
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
108
- *
109
- * The individual configuration values can be found in the table.
110
- *
111
- * @property {Object} templates Template definitions
112
- * @property {string} templates.main Main template
113
- * @property {Object} labels Label definitions
114
- * @property {Object} actions Callbacks
115
- * @property {string} actions.click="throw Error" Callback when clicked
116
- * @property {Object} features Features
117
- * @property {boolean} features.multipleColumns=true Multiple columns
118
- * @property {Object} classes CSS classes
119
- * @property {boolean} disabled=false Disabled state
120
- */
121
- get defaults() {
122
- return Object.assign({}, super.defaults, {
123
- templates: {
124
- main: getTemplate(),
125
- },
126
- labels: getTranslations(),
127
- classes: {
128
- content: "collapse-alignment",
129
- },
130
- disabled: false,
131
- features: {
132
- multipleColumns: true,
133
- },
134
- actions: {
135
- click: () => {},
136
- },
137
- value: null,
138
- });
139
- }
140
-
141
- /**
142
- *
143
- * @return {string}
144
- */
145
- static getTag() {
146
- return "monster-field-set";
147
- }
148
-
149
- /**
150
- *
151
- * @return {CSSStyleSheet[]}
152
- */
153
- static getCSSStyleSheet() {
154
- return [FieldSetStyleSheet, InvalidStyleSheet];
155
- }
156
-
157
- /**
158
- * The FieldSet.click() method simulates a click on the internal element.
159
- *
160
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click}
161
- */
162
- click() {
163
- if (this.getOption("disabled") === true) {
164
- return;
165
- }
166
-
167
- if (
168
- this[fieldSetElementSymbol] &&
169
- isFunction(this[fieldSetElementSymbol].click)
170
- ) {
171
- this[fieldSetElementSymbol].click();
172
- }
173
- }
174
-
175
- /**
176
- * The Button.focus() method sets focus on the internal element.
177
- *
178
- * @param {Object} options
179
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus}
180
- */
181
- focus(options) {
182
- if (this.getOption("disabled") === true) {
183
- return;
184
- }
185
-
186
- if (
187
- this[fieldSetElementSymbol] &&
188
- isFunction(this[fieldSetElementSymbol].focus)
189
- ) {
190
- this[fieldSetElementSymbol].focus(options);
191
- }
192
- }
193
-
194
- /**
195
- * The Button.blur() method removes focus from the internal element.
196
- */
197
- blur() {
198
- if (
199
- this[fieldSetElementSymbol] &&
200
- isFunction(this[fieldSetElementSymbol].blur)
201
- ) {
202
- this[fieldSetElementSymbol].blur();
203
- }
204
- }
205
-
206
- /**
207
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals}
208
- * @return {boolean}
209
- */
210
- static get formAssociated() {
211
- return true;
212
- }
213
-
214
- /**
215
- * The current value of the form control.
216
- *
217
- * ```js
218
- * e = document.querySelector('monster-field-set');
219
- * console.log(e.value)
220
- * ```
221
- *
222
- * @property {string}
223
- */
224
- get value() {
225
- return this.getOption("value");
226
- }
227
-
228
- /**
229
- * Set the value of the form control.
230
- *
231
- * ```
232
- * e = document.querySelector('monster-field-set');
233
- * e.value=1
234
- * ```
235
- *
236
- * @property {string} value
237
- * @throws {Error} unsupported type
238
- */
239
- set value(value) {
240
- this.setOption("value", value);
241
- try {
242
- this?.setFormValue(this.value);
243
- } catch (e) {
244
- addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
245
- }
246
- }
85
+ /**
86
+ * This method is called by the `instanceof` operator.
87
+ * @return {symbol}
88
+ */
89
+ static get [instanceSymbol]() {
90
+ return Symbol.for("@schukai/monster/components/form/fieldset@@instance");
91
+ }
92
+
93
+ /**
94
+ * @return {Components.Form.FieldSet
95
+ */
96
+ [assembleMethodSymbol]() {
97
+ super[assembleMethodSymbol]();
98
+ initControlReferences.call(this);
99
+ initEventHandler.call(this);
100
+ updateExtendedFields.call(this);
101
+ updateColumns.call(this);
102
+ return this;
103
+ }
104
+
105
+ /**
106
+ * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
107
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
108
+ *
109
+ * The individual configuration values can be found in the table.
110
+ *
111
+ * @property {Object} templates Template definitions
112
+ * @property {string} templates.main Main template
113
+ * @property {Object} labels Label definitions
114
+ * @property {Object} actions Callbacks
115
+ * @property {string} actions.click="throw Error" Callback when clicked
116
+ * @property {Object} features Features
117
+ * @property {boolean} features.multipleColumns=true Multiple columns
118
+ * @property {Object} classes CSS classes
119
+ * @property {boolean} disabled=false Disabled state
120
+ */
121
+ get defaults() {
122
+ return Object.assign({}, super.defaults, {
123
+ templates: {
124
+ main: getTemplate(),
125
+ },
126
+ labels: getTranslations(),
127
+ classes: {
128
+ content: "collapse-alignment",
129
+ },
130
+ disabled: false,
131
+ features: {
132
+ multipleColumns: true,
133
+ },
134
+ actions: {
135
+ click: () => {},
136
+ },
137
+ value: null,
138
+ });
139
+ }
140
+
141
+ /**
142
+ *
143
+ * @return {string}
144
+ */
145
+ static getTag() {
146
+ return "monster-field-set";
147
+ }
148
+
149
+ /**
150
+ *
151
+ * @return {CSSStyleSheet[]}
152
+ */
153
+ static getCSSStyleSheet() {
154
+ return [FieldSetStyleSheet, InvalidStyleSheet];
155
+ }
156
+
157
+ /**
158
+ * The FieldSet.click() method simulates a click on the internal element.
159
+ *
160
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click}
161
+ */
162
+ click() {
163
+ if (this.getOption("disabled") === true) {
164
+ return;
165
+ }
166
+
167
+ if (
168
+ this[fieldSetElementSymbol] &&
169
+ isFunction(this[fieldSetElementSymbol].click)
170
+ ) {
171
+ this[fieldSetElementSymbol].click();
172
+ }
173
+ }
174
+
175
+ /**
176
+ * The Button.focus() method sets focus on the internal element.
177
+ *
178
+ * @param {Object} options
179
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus}
180
+ */
181
+ focus(options) {
182
+ if (this.getOption("disabled") === true) {
183
+ return;
184
+ }
185
+
186
+ if (
187
+ this[fieldSetElementSymbol] &&
188
+ isFunction(this[fieldSetElementSymbol].focus)
189
+ ) {
190
+ this[fieldSetElementSymbol].focus(options);
191
+ }
192
+ }
193
+
194
+ /**
195
+ * The Button.blur() method removes focus from the internal element.
196
+ */
197
+ blur() {
198
+ if (
199
+ this[fieldSetElementSymbol] &&
200
+ isFunction(this[fieldSetElementSymbol].blur)
201
+ ) {
202
+ this[fieldSetElementSymbol].blur();
203
+ }
204
+ }
205
+
206
+ /**
207
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals}
208
+ * @return {boolean}
209
+ */
210
+ static get formAssociated() {
211
+ return true;
212
+ }
213
+
214
+ /**
215
+ * The current value of the form control.
216
+ *
217
+ * ```js
218
+ * e = document.querySelector('monster-field-set');
219
+ * console.log(e.value)
220
+ * ```
221
+ *
222
+ * @property {string}
223
+ */
224
+ get value() {
225
+ return this.getOption("value");
226
+ }
227
+
228
+ /**
229
+ * Set the value of the form control.
230
+ *
231
+ * ```
232
+ * e = document.querySelector('monster-field-set');
233
+ * e.value=1
234
+ * ```
235
+ *
236
+ * @property {string} value
237
+ * @throws {Error} unsupported type
238
+ */
239
+ set value(value) {
240
+ this.setOption("value", value);
241
+ try {
242
+ this?.setFormValue(this.value);
243
+ } catch (e) {
244
+ addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
245
+ }
246
+ }
247
247
  }
248
248
 
249
249
  /**
@@ -251,97 +251,97 @@ class FieldSet extends CustomControl {
251
251
  * @returns {object}
252
252
  */
253
253
  function getTranslations() {
254
- const locale = getLocaleOfDocument();
255
- switch (locale.language) {
256
- case "de":
257
- return {
258
- toggleSwitchOn: "✔",
259
- toggleSwitchOff: "✖",
260
- toggleSwitchLabel: "Erweitern",
261
- title: "",
262
- };
263
- case "fr":
264
- return {
265
- toggleSwitchOn: "✔",
266
- toggleSwitchOff: "✖",
267
- toggleSwitchLabel: "Développer",
268
- title: "",
269
- };
270
- case "sp":
271
- return {
272
- toggleSwitchOn: "✔",
273
- toggleSwitchOff: "✖",
274
- toggleSwitchLabel: "Expandir",
275
- title: "",
276
- };
277
- case "it":
278
- return {
279
- toggleSwitchOn: "✔",
280
- toggleSwitchOff: "✖",
281
- toggleSwitchLabel: "Espandi",
282
- title: "",
283
- };
284
- case "pl":
285
- return {
286
- toggleSwitchOn: "✔",
287
- toggleSwitchOff: "✖",
288
- toggleSwitchLabel: "Rozwiń",
289
- title: "",
290
- };
291
- case "no":
292
- return {
293
- toggleSwitchOn: "✔",
294
- toggleSwitchOff: "✖",
295
- toggleSwitchLabel: "Utvid",
296
- title: "",
297
- };
298
- case "dk":
299
- return {
300
- toggleSwitchOn: "✔",
301
- toggleSwitchOff: "✖",
302
- toggleSwitchLabel: "Udvid",
303
- title: "",
304
- };
305
- case "sw":
306
- return {
307
- toggleSwitchOn: "✔",
308
- toggleSwitchOff: "✖",
309
- toggleSwitchLabel: "Expandera",
310
- title: "",
311
- };
312
- default:
313
- case "en":
314
- return {
315
- toggleSwitchOn: "✔",
316
- toggleSwitchOff: "✖",
317
- toggleSwitchLabel: "Expand",
318
- title: "",
319
- };
320
- }
254
+ const locale = getLocaleOfDocument();
255
+ switch (locale.language) {
256
+ case "de":
257
+ return {
258
+ toggleSwitchOn: "✔",
259
+ toggleSwitchOff: "✖",
260
+ toggleSwitchLabel: "Erweitern",
261
+ title: "",
262
+ };
263
+ case "fr":
264
+ return {
265
+ toggleSwitchOn: "✔",
266
+ toggleSwitchOff: "✖",
267
+ toggleSwitchLabel: "Développer",
268
+ title: "",
269
+ };
270
+ case "sp":
271
+ return {
272
+ toggleSwitchOn: "✔",
273
+ toggleSwitchOff: "✖",
274
+ toggleSwitchLabel: "Expandir",
275
+ title: "",
276
+ };
277
+ case "it":
278
+ return {
279
+ toggleSwitchOn: "✔",
280
+ toggleSwitchOff: "✖",
281
+ toggleSwitchLabel: "Espandi",
282
+ title: "",
283
+ };
284
+ case "pl":
285
+ return {
286
+ toggleSwitchOn: "✔",
287
+ toggleSwitchOff: "✖",
288
+ toggleSwitchLabel: "Rozwiń",
289
+ title: "",
290
+ };
291
+ case "no":
292
+ return {
293
+ toggleSwitchOn: "✔",
294
+ toggleSwitchOff: "✖",
295
+ toggleSwitchLabel: "Utvid",
296
+ title: "",
297
+ };
298
+ case "dk":
299
+ return {
300
+ toggleSwitchOn: "✔",
301
+ toggleSwitchOff: "✖",
302
+ toggleSwitchLabel: "Udvid",
303
+ title: "",
304
+ };
305
+ case "sw":
306
+ return {
307
+ toggleSwitchOn: "✔",
308
+ toggleSwitchOff: "✖",
309
+ toggleSwitchLabel: "Expandera",
310
+ title: "",
311
+ };
312
+ default:
313
+ case "en":
314
+ return {
315
+ toggleSwitchOn: "✔",
316
+ toggleSwitchOff: "✖",
317
+ toggleSwitchLabel: "Expand",
318
+ title: "",
319
+ };
320
+ }
321
321
  }
322
322
 
323
323
  /**
324
324
  * @private
325
325
  */
326
326
  function updateExtendedFields() {
327
- const nodes = getSlottedElements.call(this, "", "extended");
328
- if (nodes.size > 0) {
329
- this[extendedSwitchSymbol].classList.remove("hidden");
330
- } else {
331
- this[extendedSwitchSymbol].classList.add("hidden");
332
- }
327
+ const nodes = getSlottedElements.call(this, "", "extended");
328
+ if (nodes.size > 0) {
329
+ this[extendedSwitchSymbol].classList.remove("hidden");
330
+ } else {
331
+ this[extendedSwitchSymbol].classList.add("hidden");
332
+ }
333
333
  }
334
334
 
335
335
  /**
336
336
  * @private
337
337
  */
338
338
  function updateColumns() {
339
- if (this.getOption("features.multipleColumns") !== true) {
340
- this[fieldSetElementSymbol].classList.remove("multiple-columns");
341
- return;
342
- }
339
+ if (this.getOption("features.multipleColumns") !== true) {
340
+ this[fieldSetElementSymbol].classList.remove("multiple-columns");
341
+ return;
342
+ }
343
343
 
344
- this[fieldSetElementSymbol].classList.add("multiple-columns");
344
+ this[fieldSetElementSymbol].classList.add("multiple-columns");
345
345
  }
346
346
 
347
347
  /**
@@ -350,53 +350,53 @@ function updateColumns() {
350
350
  * @fires monster-field-set-clicked
351
351
  */
352
352
  function initEventHandler() {
353
- this[toggleSwitchElementSymbol].setOption(
354
- "labels.toggleSwitchOn",
355
- this.getOption("labels.toggleSwitchOn"),
356
- );
357
- this[toggleSwitchElementSymbol].setOption(
358
- "labels.toggleSwitchOff",
359
- this.getOption("labels.toggleSwitchOff"),
360
- );
361
-
362
- this[toggleSwitchElementSymbol].setOption("actions.on", () => {
363
- this[collapseElementSymbol].open();
364
- });
365
-
366
- this[toggleSwitchElementSymbol].setOption("actions.off", () => {
367
- this[collapseElementSymbol].close();
368
- });
369
-
370
- return this;
353
+ this[toggleSwitchElementSymbol].setOption(
354
+ "labels.toggleSwitchOn",
355
+ this.getOption("labels.toggleSwitchOn"),
356
+ );
357
+ this[toggleSwitchElementSymbol].setOption(
358
+ "labels.toggleSwitchOff",
359
+ this.getOption("labels.toggleSwitchOff"),
360
+ );
361
+
362
+ this[toggleSwitchElementSymbol].setOption("actions.on", () => {
363
+ this[collapseElementSymbol].open();
364
+ });
365
+
366
+ this[toggleSwitchElementSymbol].setOption("actions.off", () => {
367
+ this[collapseElementSymbol].close();
368
+ });
369
+
370
+ return this;
371
371
  }
372
372
 
373
373
  /**
374
374
  * @private
375
375
  */
376
376
  function initControlReferences() {
377
- this[fieldSetElementSymbol] = this.shadowRoot.querySelector(
378
- `[${ATTRIBUTE_ROLE}="control"]`,
379
- );
377
+ this[fieldSetElementSymbol] = this.shadowRoot.querySelector(
378
+ `[${ATTRIBUTE_ROLE}="control"]`,
379
+ );
380
380
 
381
- this[extendedSwitchElementSymbol] = this.shadowRoot.querySelector(
382
- `[${ATTRIBUTE_ROLE}="extended-switch"]`,
383
- );
381
+ this[extendedSwitchElementSymbol] = this.shadowRoot.querySelector(
382
+ `[${ATTRIBUTE_ROLE}="extended-switch"]`,
383
+ );
384
384
 
385
- this[collapseElementSymbol] = this.shadowRoot.querySelector(
386
- `[${ATTRIBUTE_ROLE}="collapse"]`,
387
- );
385
+ this[collapseElementSymbol] = this.shadowRoot.querySelector(
386
+ `[${ATTRIBUTE_ROLE}="collapse"]`,
387
+ );
388
388
 
389
- this[headerElementSymbol] = this.shadowRoot.querySelector(
390
- `[${ATTRIBUTE_ROLE}="header"]`,
391
- );
389
+ this[headerElementSymbol] = this.shadowRoot.querySelector(
390
+ `[${ATTRIBUTE_ROLE}="header"]`,
391
+ );
392
392
 
393
- this[extendedSwitchSymbol] = this.shadowRoot.querySelector(
394
- `[${ATTRIBUTE_ROLE}="extended-switch"]`,
395
- );
393
+ this[extendedSwitchSymbol] = this.shadowRoot.querySelector(
394
+ `[${ATTRIBUTE_ROLE}="extended-switch"]`,
395
+ );
396
396
 
397
- this[toggleSwitchElementSymbol] = this.shadowRoot.querySelector(
398
- `monster-toggle-switch`,
399
- );
397
+ this[toggleSwitchElementSymbol] = this.shadowRoot.querySelector(
398
+ `monster-toggle-switch`,
399
+ );
400
400
  }
401
401
 
402
402
  /**
@@ -404,8 +404,8 @@ function initControlReferences() {
404
404
  * @return {string}
405
405
  */
406
406
  function getTemplate() {
407
- // language=HTML
408
- return `
407
+ // language=HTML
408
+ return `
409
409
  <div data-monster-role="control" part="control">
410
410
  <div data-monster-role="header" part="header">
411
411
  <div data-monster-replace="path:labels.title" data-monster-role="title" part="title"></div>