@schukai/monster 3.101.2 → 3.101.3
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 +9 -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 +2155 -2163
- 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/types/internal.mjs +1 -0
@@ -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() {
|