@schukai/monster 3.64.0 → 3.65.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 +32 -0
- package/example/components/form/button.mjs +1 -1
- package/example/components/form/field-set.mjs +4 -0
- package/example/components/form/select.mjs +1 -1
- package/package.json +2 -1
- package/source/components/datatable/datatable/header.mjs +228 -221
- package/source/components/datatable/style/dataset.pcss +1 -0
- package/source/components/datatable/style/datatable.pcss +1 -0
- package/source/components/datatable/stylesheet/change-button.mjs +8 -4
- package/source/components/datatable/stylesheet/column-bar.mjs +8 -4
- package/source/components/datatable/stylesheet/dataset.mjs +9 -5
- package/source/components/datatable/stylesheet/datasource.mjs +8 -4
- package/source/components/datatable/stylesheet/datatable.mjs +9 -5
- package/source/components/datatable/stylesheet/embedded-pagination.mjs +8 -4
- package/source/components/datatable/stylesheet/filter-button.mjs +8 -4
- package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +8 -4
- package/source/components/datatable/stylesheet/filter-date-range.mjs +8 -4
- package/source/components/datatable/stylesheet/filter-range.mjs +8 -4
- package/source/components/datatable/stylesheet/filter.mjs +8 -4
- package/source/components/datatable/stylesheet/pagination.mjs +8 -4
- package/source/components/datatable/stylesheet/save-button.mjs +8 -4
- package/source/components/datatable/stylesheet/select-filter.mjs +8 -4
- package/source/components/datatable/stylesheet/status.mjs +8 -4
- package/source/components/form/button.mjs +263 -281
- package/source/components/form/field-set.mjs +300 -0
- package/source/components/form/popper.mjs +13 -480
- package/source/components/form/style/field-set.pcss +13 -0
- package/source/components/form/stylesheet/action-button.mjs +8 -4
- package/source/components/form/stylesheet/api-button.mjs +8 -4
- package/source/components/form/stylesheet/button-bar.mjs +9 -5
- package/source/components/form/stylesheet/button.mjs +8 -4
- package/source/components/form/stylesheet/confirm-button.mjs +9 -5
- package/source/components/form/stylesheet/context-error.mjs +8 -4
- package/source/components/form/stylesheet/context-help.mjs +8 -4
- package/source/components/form/stylesheet/field-set.mjs +31 -0
- package/source/components/form/stylesheet/form.mjs +9 -5
- package/source/components/form/stylesheet/message-state-button.mjs +8 -4
- package/source/components/form/stylesheet/popper-button.mjs +8 -4
- package/source/components/form/stylesheet/select.mjs +8 -4
- package/source/components/form/stylesheet/state-button.mjs +8 -4
- package/source/components/form/stylesheet/toggle-switch.mjs +8 -4
- package/source/components/form/stylesheet/tree-select.mjs +8 -4
- package/source/components/host/collapse.mjs +14 -516
- package/source/components/host/config-manager.mjs +9 -2
- package/source/components/host/constants.mjs +9 -4
- package/source/components/host/details.mjs +14 -253
- package/source/components/host/stylesheet/call-button.mjs +8 -4
- package/source/components/host/stylesheet/config-manager.mjs +8 -4
- package/source/components/host/stylesheet/host.mjs +9 -5
- package/source/components/host/stylesheet/overlay.mjs +9 -5
- package/source/components/host/stylesheet/toggle-button.mjs +8 -4
- package/source/components/host/stylesheet/viewer.mjs +8 -4
- package/source/components/layout/collapse.mjs +542 -0
- package/source/components/layout/details.mjs +271 -0
- package/source/components/layout/panel.mjs +6 -0
- package/source/components/layout/popper.mjs +476 -0
- package/source/components/{host → layout}/stylesheet/collapse.mjs +8 -4
- package/source/components/{host → layout}/stylesheet/details.mjs +8 -4
- package/source/components/layout/stylesheet/panel.mjs +8 -4
- package/source/components/{form → layout}/stylesheet/popper.mjs +8 -4
- package/source/components/layout/stylesheet/split-panel.mjs +8 -4
- package/source/components/layout/stylesheet/tabs.mjs +8 -4
- package/source/components/layout/stylesheet/width-toggle.mjs +8 -4
- package/source/components/layout/tabs.mjs +3 -3
- package/source/components/layout/width-toggle.mjs +3 -3
- package/source/components/navigation/style/table-of-content.pcss +84 -0
- package/source/components/navigation/stylesheet/table-of-content.mjs +31 -0
- package/source/components/navigation/table-of-content.mjs +418 -0
- package/source/components/notify/stylesheet/message.mjs +8 -4
- package/source/components/notify/stylesheet/notify.mjs +8 -4
- package/source/components/state/stylesheet/log.mjs +8 -4
- package/source/components/state/stylesheet/state.mjs +9 -5
- package/source/components/style/link.pcss +0 -1
- package/source/components/style/mixin/typography.pcss +7 -7
- package/source/components/style/typography.pcss +1 -1
- package/source/components/stylesheet/badge.mjs +8 -4
- package/source/components/stylesheet/border.mjs +8 -4
- package/source/components/stylesheet/button.mjs +8 -4
- package/source/components/stylesheet/card.mjs +8 -4
- package/source/components/stylesheet/color.mjs +8 -4
- package/source/components/stylesheet/common.mjs +8 -4
- package/source/components/stylesheet/control.mjs +8 -4
- package/source/components/stylesheet/data-grid.mjs +8 -4
- package/source/components/stylesheet/display.mjs +8 -4
- package/source/components/stylesheet/floating-ui.mjs +8 -4
- package/source/components/stylesheet/form.mjs +8 -4
- package/source/components/stylesheet/host.mjs +8 -4
- package/source/components/stylesheet/icons.mjs +8 -4
- package/source/components/stylesheet/link.mjs +8 -4
- package/source/components/stylesheet/mixin/badge.mjs +31 -0
- package/source/components/stylesheet/mixin/button.mjs +31 -0
- package/source/components/stylesheet/mixin/form.mjs +31 -0
- package/source/components/stylesheet/mixin/hover.mjs +31 -0
- package/source/components/stylesheet/mixin/icon.mjs +31 -0
- package/source/components/stylesheet/mixin/media.mjs +31 -0
- package/source/components/stylesheet/mixin/property.mjs +31 -0
- package/source/components/stylesheet/mixin/skeleton.mjs +31 -0
- package/source/components/stylesheet/mixin/spinner.mjs +31 -0
- package/source/components/stylesheet/mixin/typography.mjs +31 -0
- package/source/components/stylesheet/normalize.mjs +8 -4
- package/source/components/stylesheet/popper.mjs +8 -4
- package/source/components/stylesheet/property.mjs +8 -4
- package/source/components/stylesheet/ripple.mjs +8 -4
- package/source/components/stylesheet/skeleton.mjs +8 -4
- package/source/components/stylesheet/space.mjs +8 -4
- package/source/components/stylesheet/spinner.mjs +8 -4
- package/source/components/stylesheet/table.mjs +8 -4
- package/source/components/stylesheet/theme.mjs +8 -4
- package/source/components/stylesheet/typography.mjs +9 -5
- package/source/components/tree-menu/stylesheet/tree-menu.mjs +8 -4
- package/source/dom/ready.mjs +10 -4
- package/source/monster.mjs +17 -80
- package/source/types/proxyobserver.mjs +4 -2
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
- package/test/web/tests.js +4 -4
- package/source/components/form/form-field.mjs +0 -341
- package/source/components/form/style/form-field.pcss +0 -4
- package/source/components/form/stylesheet/form-field.mjs +0 -27
- /package/source/components/{host → layout}/style/collapse.pcss +0 -0
- /package/source/components/{host → layout}/style/details.pcss +0 -0
- /package/source/components/{form → layout}/style/popper.pcss +0 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, {{copyRightYear}}. All rights reserved.
|
|
3
|
+
* Node module: @schukai/monster
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
7
|
+
*
|
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { instanceSymbol } from "../../constants.mjs";
|
|
14
|
+
import { addAttributeToken } from "../../dom/attributes.mjs";
|
|
15
|
+
import {
|
|
16
|
+
ATTRIBUTE_ERRORMESSAGE,
|
|
17
|
+
ATTRIBUTE_ROLE,
|
|
18
|
+
} from "../../dom/constants.mjs";
|
|
19
|
+
import { CustomControl } from "../../dom/customcontrol.mjs";
|
|
20
|
+
import {
|
|
21
|
+
assembleMethodSymbol,
|
|
22
|
+
registerCustomElement,
|
|
23
|
+
} from "../../dom/customelement.mjs";
|
|
24
|
+
import { findTargetElementFromEvent } from "../../dom/events.mjs";
|
|
25
|
+
import { isFunction } from "../../types/is.mjs";
|
|
26
|
+
import { FieldSetStyleSheet } from "./stylesheet/field-set.mjs";
|
|
27
|
+
import { fireCustomEvent } from "../../dom/events.mjs";
|
|
28
|
+
import "../layout/collapse.mjs";
|
|
29
|
+
|
|
30
|
+
export { FieldSet };
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @private
|
|
34
|
+
* @type {symbol}
|
|
35
|
+
*/
|
|
36
|
+
export const fieldSetElementSymbol = Symbol("fieldSetElement");
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* This CustomControl creates a FieldSet element with a variety of options.
|
|
40
|
+
*
|
|
41
|
+
* <img src="./images/field-set.png">
|
|
42
|
+
*
|
|
43
|
+
* You can create this control either by specifying the HTML tag <monster-field-set />` directly in the HTML or using
|
|
44
|
+
* Javascript via the `document.createElement('monster-field-set');` method.
|
|
45
|
+
*
|
|
46
|
+
* ```html
|
|
47
|
+
* <monster-field-set></monster-field-set>
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* Or you can create this CustomControl directly in Javascript:
|
|
51
|
+
*
|
|
52
|
+
* ```js
|
|
53
|
+
* import {FieldSet} from '@schukai/monster/source/components/form/field-set.mjs';
|
|
54
|
+
* document.createElement('monster-field-set');
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @externalExample ../..../example/components/form/field-set.mjs
|
|
58
|
+
* @startuml field-set.png
|
|
59
|
+
* skinparam monochrome true
|
|
60
|
+
* skinparam shadowing false
|
|
61
|
+
* HTMLElement <|-- CustomElement
|
|
62
|
+
* CustomElement <|-- CustomControl
|
|
63
|
+
* CustomControl <|-- FieldSet
|
|
64
|
+
* @enduml
|
|
65
|
+
*
|
|
66
|
+
* @since 3.65.0
|
|
67
|
+
* @copyright schukai GmbH
|
|
68
|
+
* @memberOf Monster.Components.Form
|
|
69
|
+
* @summary A simple FieldSet
|
|
70
|
+
*/
|
|
71
|
+
class FieldSet extends CustomControl {
|
|
72
|
+
/**
|
|
73
|
+
* This method is called by the `instanceof` operator.
|
|
74
|
+
* @returns {symbol}
|
|
75
|
+
*/
|
|
76
|
+
static get [instanceSymbol]() {
|
|
77
|
+
return Symbol.for("@schukai/monster/components/form/fieldset@@instance");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
*
|
|
82
|
+
* @return {Components.Form.FieldSet
|
|
83
|
+
*/
|
|
84
|
+
[assembleMethodSymbol]() {
|
|
85
|
+
super[assembleMethodSymbol]();
|
|
86
|
+
initControlReferences.call(this);
|
|
87
|
+
initEventHandler.call(this);
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* To set the options via the html tag the attribute `data-monster-options` must be used.
|
|
93
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
|
94
|
+
*
|
|
95
|
+
* The individual configuration values can be found in the table.
|
|
96
|
+
*
|
|
97
|
+
* @property {Object} templates Template definitions
|
|
98
|
+
* @property {string} templates.main Main template
|
|
99
|
+
* @property {Object} labels Label definitions
|
|
100
|
+
* @property {Object} actions Callbacks
|
|
101
|
+
* @property {string} actions.click="throw Error" Callback when clicked
|
|
102
|
+
* @property {Object} features Features
|
|
103
|
+
* @property {Object} classes CSS classes
|
|
104
|
+
* @property {boolean} disabled=false Disabled state
|
|
105
|
+
*/
|
|
106
|
+
get defaults() {
|
|
107
|
+
return Object.assign({}, super.defaults, {
|
|
108
|
+
templates: {
|
|
109
|
+
main: getTemplate(),
|
|
110
|
+
},
|
|
111
|
+
labels: {
|
|
112
|
+
},
|
|
113
|
+
classes: {
|
|
114
|
+
},
|
|
115
|
+
disabled: false,
|
|
116
|
+
features: {
|
|
117
|
+
},
|
|
118
|
+
actions: {
|
|
119
|
+
click: () => {
|
|
120
|
+
throw new Error("the click action is not defined");
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
value: null
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
* @return {string}
|
|
130
|
+
*/
|
|
131
|
+
static getTag() {
|
|
132
|
+
return "monster-field-set";
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
*
|
|
137
|
+
* @return {Array<CSSStyleSheet>}
|
|
138
|
+
*/
|
|
139
|
+
static getCSSStyleSheet() {
|
|
140
|
+
return [FieldSetStyleSheet];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The FieldSet.click() method simulates a click on the internal element.
|
|
146
|
+
*
|
|
147
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click}
|
|
148
|
+
*/
|
|
149
|
+
click() {
|
|
150
|
+
if (this.getOption("disabled") === true) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (
|
|
155
|
+
this[fieldSetElementSymbol] &&
|
|
156
|
+
isFunction(this[fieldSetElementSymbol].click)
|
|
157
|
+
) {
|
|
158
|
+
this[fieldSetElementSymbol].click();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The Button.focus() method sets focus on the internal element.
|
|
164
|
+
*
|
|
165
|
+
* @param {Object} options
|
|
166
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus}
|
|
167
|
+
*/
|
|
168
|
+
focus(options) {
|
|
169
|
+
if (this.getOption("disabled") === true) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (
|
|
174
|
+
this[fieldSetElementSymbol] &&
|
|
175
|
+
isFunction(this[fieldSetElementSymbol].focus)
|
|
176
|
+
) {
|
|
177
|
+
this[fieldSetElementSymbol].focus(options);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* The Button.blur() method removes focus from the internal element.
|
|
183
|
+
*/
|
|
184
|
+
blur() {
|
|
185
|
+
if (
|
|
186
|
+
this[fieldSetElementSymbol] &&
|
|
187
|
+
isFunction(this[fieldSetElementSymbol].blur)
|
|
188
|
+
) {
|
|
189
|
+
this[fieldSetElementSymbol].blur();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals}
|
|
195
|
+
* @return {boolean}
|
|
196
|
+
*/
|
|
197
|
+
static get formAssociated() {
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* The current value of the form control.
|
|
203
|
+
*
|
|
204
|
+
* ```js
|
|
205
|
+
* e = document.querySelector('monster-field-set');
|
|
206
|
+
* console.log(e.value)
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* @property {string}
|
|
210
|
+
*/
|
|
211
|
+
get value() {
|
|
212
|
+
return this.getOption("value");
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Set value of the form control.
|
|
217
|
+
*
|
|
218
|
+
* ```
|
|
219
|
+
* e = document.querySelector('monster-field-set');
|
|
220
|
+
* e.value=1
|
|
221
|
+
* ```
|
|
222
|
+
*
|
|
223
|
+
* @property {string} value
|
|
224
|
+
* @throws {Error} unsupported type
|
|
225
|
+
*/
|
|
226
|
+
set value(value) {
|
|
227
|
+
this.setOption("value", value);
|
|
228
|
+
try {
|
|
229
|
+
this?.setFormValue(this.value);
|
|
230
|
+
} catch (e) {
|
|
231
|
+
addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @private
|
|
240
|
+
* @return {initEventHandler}
|
|
241
|
+
* @fires Monster.Components.Form.event:monster-field-set-clicked
|
|
242
|
+
*/
|
|
243
|
+
function initEventHandler() {
|
|
244
|
+
const self = this;
|
|
245
|
+
const element = this[fieldSetElementSymbol];
|
|
246
|
+
|
|
247
|
+
const type = "click";
|
|
248
|
+
|
|
249
|
+
element.addEventListener(type, function (event) {
|
|
250
|
+
const callback = self.getOption("actions.click");
|
|
251
|
+
|
|
252
|
+
fireCustomEvent(self, "monster-field-set-clicked", {
|
|
253
|
+
element: self,
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
if (!isFunction(callback)) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const element = findTargetElementFromEvent(
|
|
261
|
+
event,
|
|
262
|
+
ATTRIBUTE_ROLE,
|
|
263
|
+
"control",
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
if (!(element instanceof Node && self.hasNode(element))) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
callback.call(self, event);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
return this;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* @private
|
|
278
|
+
*/
|
|
279
|
+
function initControlReferences() {
|
|
280
|
+
this[fieldSetElementSymbol] = this.shadowRoot.querySelector(
|
|
281
|
+
`[${ATTRIBUTE_ROLE}="control"]`,
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* @private
|
|
287
|
+
* @return {string}
|
|
288
|
+
*/
|
|
289
|
+
function getTemplate() {
|
|
290
|
+
// language=HTML
|
|
291
|
+
return `
|
|
292
|
+
<div data-monster-role="control" part="control">
|
|
293
|
+
<monster-collapse>
|
|
294
|
+
<slot></slot>
|
|
295
|
+
</monster-collapse>
|
|
296
|
+
</div>`;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
registerCustomElement(FieldSet);
|