@schukai/monster 3.101.2 → 3.102.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 +21 -0
- package/package.json +1 -1
- package/source/components/content/copy.mjs +1 -5
- package/source/components/datatable/datatable.mjs +8 -8
- package/source/components/datatable/filter/date-range.mjs +1 -3
- package/source/components/datatable/style/column-bar.pcss +1 -1
- package/source/components/datatable/style/datatable.pcss +5 -1
- package/source/components/datatable/stylesheet/datatable.mjs +7 -14
- package/source/components/form/button-bar.mjs +1 -6
- package/source/components/form/field-set.mjs +6 -6
- package/source/components/form/popper-button.mjs +1 -5
- package/source/components/form/select.mjs +44 -12
- package/source/components/form/tree-select.mjs +1 -2
- package/source/components/host/call-button.mjs +124 -126
- package/source/components/host/viewer.mjs +1 -1
- package/source/components/layout/popper.mjs +1 -5
- package/source/data/datasource/server/restapi.mjs +191 -191
- package/source/data/transformer.mjs +827 -829
- package/source/dom/customelement.mjs +1 -1
- package/source/dom/updater.mjs +792 -768
- package/source/types/internal.mjs +1 -0
@@ -568,20 +568,15 @@ function updateResizeObserverObservation() {
|
|
568
568
|
});
|
569
569
|
|
570
570
|
requestAnimationFrame(() => {
|
571
|
-
|
572
571
|
let parent = this.parentNode;
|
573
|
-
while(!(parent instanceof HTMLElement) && parent !== null) {
|
572
|
+
while (!(parent instanceof HTMLElement) && parent !== null) {
|
574
573
|
parent = parent.parentNode;
|
575
574
|
}
|
576
575
|
|
577
576
|
if (parent instanceof HTMLElement) {
|
578
577
|
this[resizeObserverSymbol].observe(parent);
|
579
578
|
}
|
580
|
-
|
581
|
-
|
582
579
|
});
|
583
|
-
|
584
|
-
|
585
580
|
}
|
586
581
|
|
587
582
|
/**
|
@@ -404,18 +404,18 @@ function getTemplate() {
|
|
404
404
|
// language=HTML
|
405
405
|
return `
|
406
406
|
<div data-monster-role="control" part="control">
|
407
|
-
<div data-monster-role="header">
|
408
|
-
<div data-monster-replace="path:labels.title" data-monster-role="title"></div>
|
409
|
-
<div data-monster-role="extended-switch">
|
407
|
+
<div data-monster-role="header" part="header">
|
408
|
+
<div data-monster-replace="path:labels.title" data-monster-role="title" part="title"></div>
|
409
|
+
<div data-monster-role="extended-switch" part="extended-switch">
|
410
410
|
<label data-monster-replace="path:labels.toggleSwitchLabel"></label>
|
411
411
|
<monster-toggle-switch></monster-toggle-switch>
|
412
412
|
</div>
|
413
413
|
</div>
|
414
|
-
<div data-monster-role="container">
|
415
|
-
<div class="collapse-alignment">
|
414
|
+
<div data-monster-role="container" part="container">
|
415
|
+
<div class="collapse-alignment" part="content">
|
416
416
|
<slot part="content"></slot>
|
417
417
|
</div>
|
418
|
-
<monster-collapse data-monster-role="collapse">
|
418
|
+
<monster-collapse data-monster-role="collapse" part="collapse">
|
419
419
|
<slot name="extended" part="extended"></slot>
|
420
420
|
</monster-collapse>
|
421
421
|
</div>
|
@@ -346,19 +346,15 @@ function attachResizeObserver() {
|
|
346
346
|
});
|
347
347
|
|
348
348
|
requestAnimationFrame(() => {
|
349
|
-
|
350
349
|
let parent = this.parentNode;
|
351
|
-
while(!(parent instanceof HTMLElement) && parent !== null) {
|
350
|
+
while (!(parent instanceof HTMLElement) && parent !== null) {
|
352
351
|
parent = parent.parentNode;
|
353
352
|
}
|
354
353
|
|
355
354
|
if (parent instanceof HTMLElement) {
|
356
355
|
this[resizeObserverSymbol].observe(parent);
|
357
356
|
}
|
358
|
-
|
359
|
-
|
360
357
|
});
|
361
|
-
|
362
358
|
}
|
363
359
|
|
364
360
|
function disconnectResizeObserver() {
|
@@ -264,9 +264,8 @@ const FILTER_POSITION_INLINE = "inline";
|
|
264
264
|
/**
|
265
265
|
* A select control that can be used to select o
|
266
266
|
*
|
267
|
-
* ne or more options from a list.
|
268
|
-
*
|
269
267
|
* @issue @issue https://localhost.alvine.dev:8444/development/issues/closed/280.html
|
268
|
+
* @issue @issue https://localhost.alvine.dev:8444/development/issues/closed/287.html
|
270
269
|
*
|
271
270
|
* @fragments /fragments/components/form/select/
|
272
271
|
*
|
@@ -337,6 +336,18 @@ class Select extends CustomControl {
|
|
337
336
|
* @fires monster-selected this event is fired when the selection is set
|
338
337
|
*/
|
339
338
|
set value(value) {
|
339
|
+
|
340
|
+
let ignoreValues = this.getOption("ignoreValues", []);
|
341
|
+
if(!isArray(ignoreValues)){
|
342
|
+
ignoreValues = [];
|
343
|
+
}
|
344
|
+
|
345
|
+
for (const v of ignoreValues) {
|
346
|
+
if (value === v) {
|
347
|
+
return;
|
348
|
+
}
|
349
|
+
}
|
350
|
+
|
340
351
|
const result = convertValueToSelection.call(this, value);
|
341
352
|
setSelection
|
342
353
|
.call(this, result.selection)
|
@@ -400,6 +411,7 @@ class Select extends CustomControl {
|
|
400
411
|
* @property {String} mapping.labelTemplate template with the label placeholders in the form ${name}, where name is the key (**)
|
401
412
|
* @property {String} mapping.valueTemplate template with the value placeholders in the form ${name}, where name is the key
|
402
413
|
* @property {function|undefined} mapping.filter Filtering of values via a function
|
414
|
+
* @property {Array} ignoreValues Ignore values in the selection and value
|
403
415
|
* @property {Object} formatter
|
404
416
|
* @property {function|undefined} formatter.selection format selection label
|
405
417
|
*/
|
@@ -422,7 +434,7 @@ class Select extends CustomControl {
|
|
422
434
|
closeOnSelect: false,
|
423
435
|
emptyValueIfNoOptions: false,
|
424
436
|
storeFetchedData: false,
|
425
|
-
useStrictValueComparison: false
|
437
|
+
useStrictValueComparison: false
|
426
438
|
},
|
427
439
|
url: null,
|
428
440
|
lookup: {
|
@@ -461,8 +473,9 @@ class Select extends CustomControl {
|
|
461
473
|
selector: "*",
|
462
474
|
labelTemplate: "",
|
463
475
|
valueTemplate: "",
|
464
|
-
filter: null
|
476
|
+
filter: null
|
465
477
|
},
|
478
|
+
ignoreValues: [undefined, null, ""],
|
466
479
|
formatter: {
|
467
480
|
selection: buildSelectionLabel,
|
468
481
|
},
|
@@ -1105,7 +1118,6 @@ function attachResizeObserver() {
|
|
1105
1118
|
});
|
1106
1119
|
|
1107
1120
|
requestAnimationFrame(() => {
|
1108
|
-
|
1109
1121
|
let parent = this.parentNode;
|
1110
1122
|
while (!(parent instanceof HTMLElement) && parent !== null) {
|
1111
1123
|
parent = parent.parentNode;
|
@@ -1114,10 +1126,7 @@ function attachResizeObserver() {
|
|
1114
1126
|
if (parent instanceof HTMLElement) {
|
1115
1127
|
this[resizeObserverSymbol].observe(parent);
|
1116
1128
|
}
|
1117
|
-
|
1118
|
-
|
1119
1129
|
});
|
1120
|
-
|
1121
1130
|
}
|
1122
1131
|
|
1123
1132
|
/**
|
@@ -2185,7 +2194,7 @@ function convertValueToSelection(value) {
|
|
2185
2194
|
value: value,
|
2186
2195
|
});
|
2187
2196
|
} else if (isArray(value)) {
|
2188
|
-
|
2197
|
+
for (const v of value) {
|
2189
2198
|
selection.push({
|
2190
2199
|
label: getSelectionLabel.call(this, v),
|
2191
2200
|
value: v,
|
@@ -2232,11 +2241,12 @@ function convertSelectionToValue(selection) {
|
|
2232
2241
|
|
2233
2242
|
/**
|
2234
2243
|
* @private
|
2235
|
-
* @param {array} selection
|
2244
|
+
* @param {array|string} selection
|
2236
2245
|
* @return {Promise}
|
2237
2246
|
* @throws {Error} no shadow-root is defined
|
2238
2247
|
*/
|
2239
2248
|
function setSelection(selection) {
|
2249
|
+
|
2240
2250
|
if (isString(selection) || isInteger(selection)) {
|
2241
2251
|
const result = convertValueToSelection.call(this, selection);
|
2242
2252
|
selection = result?.selection;
|
@@ -2245,19 +2255,41 @@ function setSelection(selection) {
|
|
2245
2255
|
}
|
2246
2256
|
|
2247
2257
|
validateArray(selection);
|
2258
|
+
let ignoreValues = this.getOption("ignoreValues", []);
|
2259
|
+
if(!isArray(ignoreValues)) {
|
2260
|
+
ignoreValues = [];
|
2261
|
+
}
|
2248
2262
|
|
2263
|
+
let resultSelection = [];
|
2249
2264
|
for (let i = 0; i < selection.length; i++) {
|
2265
|
+
|
2266
|
+
let ignore = false;
|
2267
|
+
|
2268
|
+
for (const v of ignoreValues) {
|
2269
|
+
if (selection[i].value === v) {
|
2270
|
+
ignore = true
|
2271
|
+
break;
|
2272
|
+
}
|
2273
|
+
}
|
2274
|
+
if (ignore) {
|
2275
|
+
continue;
|
2276
|
+
}
|
2277
|
+
|
2250
2278
|
let l = getSelectionLabel.call(this, selection[i].value);
|
2251
2279
|
if (l === selection[i].value) {
|
2252
2280
|
l = selection[i].label;
|
2253
2281
|
}
|
2254
2282
|
|
2255
|
-
|
2283
|
+
|
2284
|
+
resultSelection.push({
|
2256
2285
|
label: l,
|
2257
2286
|
value: selection[i].value,
|
2258
|
-
}
|
2287
|
+
})
|
2288
|
+
|
2259
2289
|
}
|
2260
2290
|
|
2291
|
+
selection = resultSelection;
|
2292
|
+
|
2261
2293
|
this.setOption("selection", selection);
|
2262
2294
|
checkOptionState.call(this);
|
2263
2295
|
setSummaryAndControlText.call(this);
|
@@ -88,7 +88,7 @@ class TreeSelect extends Select {
|
|
88
88
|
* The individual configuration values can be found in the table.
|
89
89
|
*
|
90
90
|
* @extends Select
|
91
|
-
* @property {
|
91
|
+
* @property {Array} mapping.rootReferences=['0', undefined, null]
|
92
92
|
* @property {String} mapping.idTemplate=id
|
93
93
|
* @property {String} mapping.parentTemplate=parent
|
94
94
|
* @property {String} mapping.selection
|
@@ -288,7 +288,6 @@ function formatKeyLabel(node) {
|
|
288
288
|
* @return {Array}
|
289
289
|
*/
|
290
290
|
function buildTreeLabels(value) {
|
291
|
-
|
292
291
|
if (!this[internalNodesSymbol]) {
|
293
292
|
return [value];
|
294
293
|
}
|
@@ -12,20 +12,18 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
import {instanceSymbol} from "../../constants.mjs";
|
15
|
+
import { instanceSymbol } from "../../constants.mjs";
|
16
16
|
import {
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
assembleMethodSymbol,
|
18
|
+
CustomElement,
|
19
|
+
registerCustomElement,
|
20
20
|
} from "../../dom/customelement.mjs";
|
21
|
-
import {CallButtonStyleSheet} from "./stylesheet/call-button.mjs";
|
22
|
-
import {isArray, isObject, isFunction} from "../../types/is.mjs";
|
23
|
-
import {
|
24
|
-
|
25
|
-
} from "../../dom/util.mjs";
|
26
|
-
import {ATTRIBUTE_PREFIX} from "../../dom/constants.mjs";
|
21
|
+
import { CallButtonStyleSheet } from "./stylesheet/call-button.mjs";
|
22
|
+
import { isArray, isObject, isFunction } from "../../types/is.mjs";
|
23
|
+
import { findElementWithSelectorUpwards } from "../../dom/util.mjs";
|
24
|
+
import { ATTRIBUTE_PREFIX } from "../../dom/constants.mjs";
|
27
25
|
|
28
|
-
export {CallButton};
|
26
|
+
export { CallButton };
|
29
27
|
|
30
28
|
/**
|
31
29
|
* @private
|
@@ -49,69 +47,69 @@ const ATTRIBUTE_CALL = `${ATTRIBUTE_PREFIX}call`;
|
|
49
47
|
* @summary A call button component that can call a method of another element.
|
50
48
|
*/
|
51
49
|
class CallButton extends CustomElement {
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
50
|
+
/**
|
51
|
+
* This method is called by the `instanceof` operator.
|
52
|
+
* @return {symbol}
|
53
|
+
*/
|
54
|
+
static get [instanceSymbol]() {
|
55
|
+
return Symbol.for("@schukai/component-host/call-button@@instance");
|
56
|
+
}
|
57
|
+
|
58
|
+
/**
|
59
|
+
* To set the options via the HTML tag, the attribute `data-monster-options` must be used.
|
60
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
61
|
+
*
|
62
|
+
* The individual configuration values can be found in the table.
|
63
|
+
*
|
64
|
+
* @property {Object} templates Template definitions
|
65
|
+
* @property {string} templates.main Main template
|
66
|
+
*/
|
67
|
+
get defaults() {
|
68
|
+
return Object.assign(
|
69
|
+
{},
|
70
|
+
super.defaults,
|
71
|
+
{
|
72
|
+
templates: {
|
73
|
+
main: getTemplate(),
|
74
|
+
},
|
75
|
+
references: {
|
76
|
+
callableSelector: undefined,
|
77
|
+
},
|
78
|
+
|
79
|
+
call: undefined,
|
80
|
+
|
81
|
+
labels: {
|
82
|
+
button: "<slot>Toggle</slot>",
|
83
|
+
},
|
84
|
+
},
|
85
|
+
initOptionsFromArguments.call(this),
|
86
|
+
);
|
87
|
+
}
|
88
|
+
|
89
|
+
/**
|
90
|
+
*
|
91
|
+
* @return {string}
|
92
|
+
*/
|
93
|
+
static getTag() {
|
94
|
+
return "monster-call-button";
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* @return {CallButton}
|
99
|
+
*/
|
100
|
+
[assembleMethodSymbol]() {
|
101
|
+
super[assembleMethodSymbol]();
|
102
|
+
|
103
|
+
initControlReferences.call(this);
|
104
|
+
initEventHandler.call(this);
|
105
|
+
}
|
106
|
+
|
107
|
+
/**
|
108
|
+
* @return {Array}
|
109
|
+
*/
|
110
|
+
static getCSSStyleSheet() {
|
111
|
+
return [CallButtonStyleSheet];
|
112
|
+
}
|
115
113
|
}
|
116
114
|
|
117
115
|
/**
|
@@ -119,14 +117,14 @@ class CallButton extends CustomElement {
|
|
119
117
|
* @return {CallButton}
|
120
118
|
*/
|
121
119
|
function initControlReferences() {
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
120
|
+
if (!this.shadowRoot) {
|
121
|
+
throw new Error("no shadow-root is defined");
|
122
|
+
}
|
123
|
+
|
124
|
+
this[callButtonElementSymbol] = this.shadowRoot.querySelector(
|
125
|
+
"[data-monster-role=control]",
|
126
|
+
);
|
127
|
+
return this;
|
130
128
|
}
|
131
129
|
|
132
130
|
/**
|
@@ -136,26 +134,26 @@ function initControlReferences() {
|
|
136
134
|
* @throws {Error} the datasource could not be initialized
|
137
135
|
*/
|
138
136
|
function initOptionsFromArguments() {
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
137
|
+
const options = {};
|
138
|
+
const value = this.getAttribute(ATTRIBUTE_REFERENCE);
|
139
|
+
if (value) {
|
140
|
+
if (!isObject(options.references)) {
|
141
|
+
options.references = {};
|
142
|
+
}
|
143
|
+
const selectors = value.split(",");
|
144
|
+
if (isArray(selectors) && selectors.length === 0) {
|
145
|
+
throw new TypeError("incorrect arguments passed for the datasource");
|
146
|
+
}
|
147
|
+
|
148
|
+
options.references.callableSelector = selectors;
|
149
|
+
}
|
150
|
+
|
151
|
+
const call = this.getAttribute(ATTRIBUTE_CALL);
|
152
|
+
if (call) {
|
153
|
+
options.call = call;
|
154
|
+
}
|
155
|
+
|
156
|
+
return options;
|
159
157
|
}
|
160
158
|
|
161
159
|
/**
|
@@ -163,28 +161,28 @@ function initOptionsFromArguments() {
|
|
163
161
|
* @throws {Error} The option references.callableSelector must be an array
|
164
162
|
*/
|
165
163
|
function initEventHandler() {
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
164
|
+
this[callButtonElementSymbol].addEventListener("click", (event) => {
|
165
|
+
event.preventDefault();
|
166
|
+
|
167
|
+
const selectors = this.getOption("references.callableSelector");
|
168
|
+
if (!isArray(selectors)) {
|
169
|
+
throw new Error(
|
170
|
+
"The option references.callableSelector must be an array",
|
171
|
+
);
|
172
|
+
}
|
173
|
+
|
174
|
+
const call = this.getOption("call");
|
175
|
+
if (!call) {
|
176
|
+
throw new Error("The option call must be defined");
|
177
|
+
}
|
178
|
+
|
179
|
+
for (const selector of selectors) {
|
180
|
+
const element = findElementWithSelectorUpwards(this, selector);
|
181
|
+
if (element instanceof HTMLElement && isFunction(element?.[call])) {
|
182
|
+
element[call]();
|
183
|
+
}
|
184
|
+
}
|
185
|
+
});
|
188
186
|
}
|
189
187
|
|
190
188
|
/**
|
@@ -192,8 +190,8 @@ function initEventHandler() {
|
|
192
190
|
* @return {string}
|
193
191
|
*/
|
194
192
|
function getTemplate() {
|
195
|
-
|
196
|
-
|
193
|
+
// language=HTML
|
194
|
+
return `
|
197
195
|
<div data-monster-role="control" part="control"
|
198
196
|
data-monster-attributes="class path:references.callableSelector | ?::hidden">
|
199
197
|
<a href="#" data-monster-role="call-button" data-monster-replace="path:labels.button"></a>
|
@@ -358,19 +358,15 @@ function attachResizeObserver() {
|
|
358
358
|
});
|
359
359
|
|
360
360
|
requestAnimationFrame(() => {
|
361
|
-
|
362
361
|
let parent = this.parentNode;
|
363
|
-
while(!(parent instanceof HTMLElement) && parent !== null) {
|
362
|
+
while (!(parent instanceof HTMLElement) && parent !== null) {
|
364
363
|
parent = parent.parentNode;
|
365
364
|
}
|
366
365
|
|
367
366
|
if (parent instanceof HTMLElement) {
|
368
367
|
this[resizeObserverSymbol].observe(parent);
|
369
368
|
}
|
370
|
-
|
371
|
-
|
372
369
|
});
|
373
|
-
|
374
370
|
}
|
375
371
|
|
376
372
|
function disconnectResizeObserver() {
|