@schukai/monster 3.71.2 → 3.72.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +26 -0
- package/package.json +1 -1
- package/source/components/datatable/dataset.mjs +272 -272
- package/source/components/datatable/datasource/dom.mjs +1 -1
- package/source/components/datatable/datasource/rest.mjs +408 -410
- package/source/components/datatable/filter.mjs +0 -1
- package/source/components/datatable/style/datatable.pcss +7 -5
- package/source/components/datatable/style/embedded-pagination.pcss +1 -1
- package/source/components/datatable/style/pagination.pcss +1 -1
- package/source/components/datatable/stylesheet/change-button.mjs +2 -4
- package/source/components/datatable/stylesheet/column-bar.mjs +2 -4
- package/source/components/datatable/stylesheet/dataset.mjs +2 -4
- package/source/components/datatable/stylesheet/datasource.mjs +1 -3
- package/source/components/datatable/stylesheet/datatable.mjs +2 -4
- package/source/components/datatable/stylesheet/embedded-pagination.mjs +1 -1
- package/source/components/datatable/stylesheet/filter-button.mjs +1 -3
- package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +14 -7
- package/source/components/datatable/stylesheet/filter-date-range.mjs +1 -3
- package/source/components/datatable/stylesheet/filter-range.mjs +1 -3
- package/source/components/datatable/stylesheet/filter.mjs +2 -4
- package/source/components/datatable/stylesheet/pagination.mjs +2 -4
- package/source/components/datatable/stylesheet/save-button.mjs +2 -4
- package/source/components/datatable/stylesheet/select-filter.mjs +2 -4
- package/source/components/datatable/stylesheet/status.mjs +2 -4
- package/source/components/form/context-error.mjs +0 -2
- package/source/components/form/context-help.mjs +1 -2
- package/source/components/form/field-set.mjs +219 -219
- package/source/components/form/form.mjs +137 -187
- package/source/components/form/reload.mjs +211 -211
- package/source/components/form/select.mjs +12 -13
- package/source/components/form/style/field-set.pcss +2 -2
- package/source/components/form/style/form.pcss +8 -0
- package/source/components/form/stylesheet/action-button.mjs +2 -4
- package/source/components/form/stylesheet/api-button.mjs +1 -3
- package/source/components/form/stylesheet/button-bar.mjs +2 -4
- package/source/components/form/stylesheet/button.mjs +2 -4
- package/source/components/form/stylesheet/confirm-button.mjs +2 -4
- package/source/components/form/stylesheet/context-error.mjs +2 -4
- package/source/components/form/stylesheet/context-help.mjs +2 -4
- package/source/components/form/stylesheet/field-set.mjs +14 -7
- package/source/components/form/stylesheet/form.mjs +1 -1
- package/source/components/form/stylesheet/message-state-button.mjs +1 -3
- package/source/components/form/stylesheet/popper-button.mjs +2 -4
- package/source/components/form/stylesheet/select.mjs +14 -7
- package/source/components/form/stylesheet/state-button.mjs +2 -4
- package/source/components/form/stylesheet/tree-select.mjs +1 -3
- package/source/components/host/stylesheet/call-button.mjs +2 -4
- package/source/components/host/stylesheet/config-manager.mjs +1 -3
- package/source/components/host/stylesheet/host.mjs +2 -4
- package/source/components/host/stylesheet/overlay.mjs +2 -4
- package/source/components/host/stylesheet/toggle-button.mjs +2 -4
- package/source/components/host/stylesheet/viewer.mjs +2 -4
- package/source/components/layout/style/collapse.pcss +2 -2
- package/source/components/layout/style/details.pcss +2 -2
- package/source/components/layout/stylesheet/collapse.mjs +14 -7
- package/source/components/layout/stylesheet/details.mjs +2 -4
- package/source/components/layout/stylesheet/panel.mjs +2 -4
- package/source/components/layout/stylesheet/popper.mjs +2 -4
- package/source/components/layout/stylesheet/split-panel.mjs +1 -3
- package/source/components/layout/stylesheet/tabs.mjs +2 -4
- package/source/components/layout/stylesheet/width-toggle.mjs +1 -3
- package/source/components/navigation/stylesheet/table-of-content.mjs +2 -4
- package/source/components/notify/stylesheet/message.mjs +2 -4
- package/source/components/notify/stylesheet/notify.mjs +2 -4
- package/source/components/state/stylesheet/log.mjs +2 -4
- package/source/components/state/stylesheet/state.mjs +2 -4
- package/source/components/style/control.pcss +5 -0
- package/source/components/style/data-grid.pcss +2 -2
- package/source/components/style/mixin/typography.pcss +7 -1
- package/source/components/style/normalize.pcss +1 -1
- package/source/components/stylesheet/badge.mjs +1 -3
- package/source/components/stylesheet/border.mjs +1 -3
- package/source/components/stylesheet/button.mjs +1 -3
- package/source/components/stylesheet/card.mjs +1 -3
- package/source/components/stylesheet/color.mjs +1 -3
- package/source/components/stylesheet/common.mjs +1 -3
- package/source/components/stylesheet/control.mjs +2 -4
- package/source/components/stylesheet/data-grid.mjs +2 -4
- package/source/components/stylesheet/display.mjs +1 -3
- package/source/components/stylesheet/floating-ui.mjs +1 -3
- package/source/components/stylesheet/form.mjs +13 -6
- package/source/components/stylesheet/host.mjs +1 -3
- package/source/components/stylesheet/icons.mjs +1 -3
- package/source/components/stylesheet/mixin/badge.mjs +1 -3
- package/source/components/stylesheet/mixin/button.mjs +1 -3
- package/source/components/stylesheet/mixin/form.mjs +13 -6
- package/source/components/stylesheet/mixin/hover.mjs +1 -3
- package/source/components/stylesheet/mixin/icon.mjs +1 -3
- package/source/components/stylesheet/mixin/media.mjs +1 -3
- package/source/components/stylesheet/mixin/property.mjs +13 -6
- package/source/components/stylesheet/mixin/skeleton.mjs +1 -3
- package/source/components/stylesheet/mixin/spinner.mjs +1 -3
- package/source/components/stylesheet/mixin/typography.mjs +1 -3
- package/source/components/stylesheet/normalize.mjs +1 -3
- package/source/components/stylesheet/popper.mjs +1 -3
- package/source/components/stylesheet/property.mjs +2 -4
- package/source/components/stylesheet/ripple.mjs +1 -3
- package/source/components/stylesheet/skeleton.mjs +1 -3
- package/source/components/stylesheet/space.mjs +1 -3
- package/source/components/stylesheet/spinner.mjs +1 -3
- package/source/components/stylesheet/table.mjs +1 -3
- package/source/components/stylesheet/theme.mjs +1 -3
- package/source/components/stylesheet/typography.mjs +13 -6
- package/source/components/tree-menu/dragable-tree-menu.mjs +693 -0
- package/source/components/tree-menu/style/tree-menu.pcss +69 -42
- package/source/components/tree-menu/stylesheet/tree-menu.mjs +8 -17
- package/source/components/tree-menu/tree-menu.mjs +468 -532
- package/source/data/datasource/server/restapi.mjs +194 -191
- package/source/data/datasource/server.mjs +107 -105
- package/source/data/diff.mjs +1 -1
- package/source/dom/customelement.mjs +2 -6
- package/source/dom/slotted.mjs +89 -85
- package/test/cases/components/host/details.mjs +1 -1
- package/test/cases/components/host/host.mjs +1 -1
- package/test/cases/components/host/overlay.mjs +1 -1
- package/test/cases/dom/customcontrol.mjs +1 -1
- package/test/cases/dom/customelement.mjs +2 -2
@@ -12,25 +12,25 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
import {instanceSymbol} from "../../constants.mjs";
|
16
|
-
import {addAttributeToken} from "../../dom/attributes.mjs";
|
15
|
+
import { instanceSymbol } from "../../constants.mjs";
|
16
|
+
import { addAttributeToken } from "../../dom/attributes.mjs";
|
17
17
|
import {
|
18
|
-
|
19
|
-
|
18
|
+
ATTRIBUTE_ERRORMESSAGE,
|
19
|
+
ATTRIBUTE_ROLE,
|
20
20
|
} from "../../dom/constants.mjs";
|
21
|
-
import {CustomControl} from "../../dom/customcontrol.mjs";
|
21
|
+
import { CustomControl } from "../../dom/customcontrol.mjs";
|
22
22
|
import {
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
assembleMethodSymbol,
|
24
|
+
getSlottedElements,
|
25
|
+
registerCustomElement,
|
26
26
|
} from "../../dom/customelement.mjs";
|
27
|
-
import {isFunction} from "../../types/is.mjs";
|
28
|
-
import {FieldSetStyleSheet} from "./stylesheet/field-set.mjs";
|
27
|
+
import { isFunction } from "../../types/is.mjs";
|
28
|
+
import { FieldSetStyleSheet } from "./stylesheet/field-set.mjs";
|
29
29
|
import "../layout/collapse.mjs";
|
30
30
|
import "./toggle-switch.mjs";
|
31
31
|
|
32
|
-
export {FieldSet};
|
33
|
-
|
32
|
+
export { FieldSet };
|
33
|
+
|
34
34
|
/**
|
35
35
|
* @private
|
36
36
|
* @type {symbol}
|
@@ -101,178 +101,178 @@ const extendedSwitchElementSymbol = Symbol("extendedSwitchElement");
|
|
101
101
|
* @summary A simple FieldSet
|
102
102
|
*/
|
103
103
|
class FieldSet extends CustomControl {
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
104
|
+
/**
|
105
|
+
* This method is called by the `instanceof` operator.
|
106
|
+
* @returns {symbol}
|
107
|
+
*/
|
108
|
+
static get [instanceSymbol]() {
|
109
|
+
return Symbol.for("@schukai/monster/components/form/fieldset@@instance");
|
110
|
+
}
|
111
|
+
|
112
|
+
/**
|
113
|
+
* @return {Components.Form.FieldSet
|
114
|
+
*/
|
115
|
+
[assembleMethodSymbol]() {
|
116
|
+
super[assembleMethodSymbol]();
|
117
|
+
initControlReferences.call(this);
|
118
|
+
initEventHandler.call(this);
|
119
|
+
updateExtendedFields.call(this);
|
120
|
+
return this;
|
121
|
+
}
|
122
|
+
|
123
|
+
/**
|
124
|
+
* To set the options via the html tag the attribute `data-monster-options` must be used.
|
125
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
126
|
+
*
|
127
|
+
* The individual configuration values can be found in the table.
|
128
|
+
*
|
129
|
+
* @property {Object} templates Template definitions
|
130
|
+
* @property {string} templates.main Main template
|
131
|
+
* @property {Object} labels Label definitions
|
132
|
+
* @property {Object} actions Callbacks
|
133
|
+
* @property {string} actions.click="throw Error" Callback when clicked
|
134
|
+
* @property {Object} features Features
|
135
|
+
* @property {Object} classes CSS classes
|
136
|
+
* @property {boolean} disabled=false Disabled state
|
137
|
+
*/
|
138
|
+
get defaults() {
|
139
|
+
return Object.assign({}, super.defaults, {
|
140
|
+
templates: {
|
141
|
+
main: getTemplate(),
|
142
|
+
},
|
143
|
+
labels: {
|
144
|
+
"toggle-switch-on": "✔",
|
145
|
+
"toggle-switch-off": "✖",
|
146
|
+
"toggle-switch-label": "Expand",
|
147
|
+
title: "",
|
148
|
+
},
|
149
|
+
classes: {},
|
150
|
+
disabled: false,
|
151
|
+
features: {},
|
152
|
+
actions: {
|
153
|
+
click: () => {
|
154
|
+
throw new Error("the click action is not defined");
|
155
|
+
},
|
156
|
+
},
|
157
|
+
value: null,
|
158
|
+
});
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
*
|
163
|
+
* @return {string}
|
164
|
+
*/
|
165
|
+
static getTag() {
|
166
|
+
return "monster-field-set";
|
167
|
+
}
|
168
|
+
|
169
|
+
/**
|
170
|
+
*
|
171
|
+
* @return {CSSStyleSheet[]}
|
172
|
+
*/
|
173
|
+
static getCSSStyleSheet() {
|
174
|
+
return [FieldSetStyleSheet];
|
175
|
+
}
|
176
|
+
|
177
|
+
/**
|
178
|
+
* The FieldSet.click() method simulates a click on the internal element.
|
179
|
+
*
|
180
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click}
|
181
|
+
*/
|
182
|
+
click() {
|
183
|
+
if (this.getOption("disabled") === true) {
|
184
|
+
return;
|
185
|
+
}
|
186
|
+
|
187
|
+
if (
|
188
|
+
this[fieldSetElementSymbol] &&
|
189
|
+
isFunction(this[fieldSetElementSymbol].click)
|
190
|
+
) {
|
191
|
+
this[fieldSetElementSymbol].click();
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
/**
|
196
|
+
* The Button.focus() method sets focus on the internal element.
|
197
|
+
*
|
198
|
+
* @param {Object} options
|
199
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus}
|
200
|
+
*/
|
201
|
+
focus(options) {
|
202
|
+
if (this.getOption("disabled") === true) {
|
203
|
+
return;
|
204
|
+
}
|
205
|
+
|
206
|
+
if (
|
207
|
+
this[fieldSetElementSymbol] &&
|
208
|
+
isFunction(this[fieldSetElementSymbol].focus)
|
209
|
+
) {
|
210
|
+
this[fieldSetElementSymbol].focus(options);
|
211
|
+
}
|
212
|
+
}
|
213
|
+
|
214
|
+
/**
|
215
|
+
* The Button.blur() method removes focus from the internal element.
|
216
|
+
*/
|
217
|
+
blur() {
|
218
|
+
if (
|
219
|
+
this[fieldSetElementSymbol] &&
|
220
|
+
isFunction(this[fieldSetElementSymbol].blur)
|
221
|
+
) {
|
222
|
+
this[fieldSetElementSymbol].blur();
|
223
|
+
}
|
224
|
+
}
|
225
|
+
|
226
|
+
/**
|
227
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals}
|
228
|
+
* @return {boolean}
|
229
|
+
*/
|
230
|
+
static get formAssociated() {
|
231
|
+
return true;
|
232
|
+
}
|
233
|
+
|
234
|
+
/**
|
235
|
+
* The current value of the form control.
|
236
|
+
*
|
237
|
+
* ```js
|
238
|
+
* e = document.querySelector('monster-field-set');
|
239
|
+
* console.log(e.value)
|
240
|
+
* ```
|
241
|
+
*
|
242
|
+
* @property {string}
|
243
|
+
*/
|
244
|
+
get value() {
|
245
|
+
return this.getOption("value");
|
246
|
+
}
|
247
|
+
|
248
|
+
/**
|
249
|
+
* Set value of the form control.
|
250
|
+
*
|
251
|
+
* ```
|
252
|
+
* e = document.querySelector('monster-field-set');
|
253
|
+
* e.value=1
|
254
|
+
* ```
|
255
|
+
*
|
256
|
+
* @property {string} value
|
257
|
+
* @throws {Error} unsupported type
|
258
|
+
*/
|
259
|
+
set value(value) {
|
260
|
+
this.setOption("value", value);
|
261
|
+
try {
|
262
|
+
this?.setFormValue(this.value);
|
263
|
+
} catch (e) {
|
264
|
+
addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
|
265
|
+
}
|
266
|
+
}
|
267
267
|
}
|
268
268
|
|
269
269
|
function updateExtendedFields() {
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
270
|
+
const nodes = getSlottedElements.call(this, "", "extended");
|
271
|
+
if (nodes.size > 0) {
|
272
|
+
this[extendedSwitchSymbol].classList.remove("hidden");
|
273
|
+
} else {
|
274
|
+
this[extendedSwitchSymbol].classList.add("hidden");
|
275
|
+
}
|
276
276
|
}
|
277
277
|
|
278
278
|
/**
|
@@ -281,53 +281,53 @@ function updateExtendedFields() {
|
|
281
281
|
* @fires Monster.Components.Form.event:monster-field-set-clicked
|
282
282
|
*/
|
283
283
|
function initEventHandler() {
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
284
|
+
this[toggleSwitchElementSymbol].setOption(
|
285
|
+
"labels.toggle-switch-on",
|
286
|
+
this.getOption("labels.toggle-switch-on"),
|
287
|
+
);
|
288
|
+
this[toggleSwitchElementSymbol].setOption(
|
289
|
+
"labels.toggle-switch-off",
|
290
|
+
this.getOption("labels.toggle-switch-off"),
|
291
|
+
);
|
292
|
+
|
293
|
+
this[toggleSwitchElementSymbol].setOption("actions.on", () => {
|
294
|
+
this[collapseElementSymbol].open();
|
295
|
+
});
|
296
|
+
|
297
|
+
this[toggleSwitchElementSymbol].setOption("actions.off", () => {
|
298
|
+
this[collapseElementSymbol].close();
|
299
|
+
});
|
300
|
+
|
301
|
+
return this;
|
302
302
|
}
|
303
303
|
|
304
304
|
/**
|
305
305
|
* @private
|
306
306
|
*/
|
307
307
|
function initControlReferences() {
|
308
|
-
|
309
|
-
|
310
|
-
|
308
|
+
this[fieldSetElementSymbol] = this.shadowRoot.querySelector(
|
309
|
+
`[${ATTRIBUTE_ROLE}="control"]`,
|
310
|
+
);
|
311
311
|
|
312
|
-
|
313
|
-
|
314
|
-
|
312
|
+
this[extendedSwitchElementSymbol] = this.shadowRoot.querySelector(
|
313
|
+
`[${ATTRIBUTE_ROLE}="extended-switch"]`,
|
314
|
+
);
|
315
315
|
|
316
|
-
|
317
|
-
|
318
|
-
|
316
|
+
this[collapseElementSymbol] = this.shadowRoot.querySelector(
|
317
|
+
`[${ATTRIBUTE_ROLE}="collapse"]`,
|
318
|
+
);
|
319
319
|
|
320
|
-
|
321
|
-
|
322
|
-
|
320
|
+
this[headerElementSymbol] = this.shadowRoot.querySelector(
|
321
|
+
`[${ATTRIBUTE_ROLE}="header"]`,
|
322
|
+
);
|
323
323
|
|
324
|
-
|
325
|
-
|
326
|
-
|
324
|
+
this[extendedSwitchSymbol] = this.shadowRoot.querySelector(
|
325
|
+
`[${ATTRIBUTE_ROLE}="extended-switch"]`,
|
326
|
+
);
|
327
327
|
|
328
|
-
|
329
|
-
|
330
|
-
|
328
|
+
this[toggleSwitchElementSymbol] = this.shadowRoot.querySelector(
|
329
|
+
`monster-toggle-switch`,
|
330
|
+
);
|
331
331
|
}
|
332
332
|
|
333
333
|
/**
|
@@ -335,8 +335,8 @@ function initControlReferences() {
|
|
335
335
|
* @return {string}
|
336
336
|
*/
|
337
337
|
function getTemplate() {
|
338
|
-
|
339
|
-
|
338
|
+
// language=HTML
|
339
|
+
return `
|
340
340
|
<div data-monster-role="control" part="control">
|
341
341
|
<div data-monster-role="header">
|
342
342
|
<div data-monster-replace="path:labels.title" data-monster-role="title"></div>
|