@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
package/source/monster.mjs
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
* Copyright schukai GmbH and
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, 2024. All rights reserved.
|
|
4
3
|
* Node module: @schukai/monster
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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.
|
|
8
11
|
*/
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
// THIS FILE IS AUTOGENERATED. DO NOT EDIT THIS FILE DIRECTLY.
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
16
|
* Main namespace for Monster.
|
|
@@ -15,11 +18,13 @@
|
|
|
15
18
|
* @namespace Monster
|
|
16
19
|
* @author schukai GmbH
|
|
17
20
|
*/
|
|
18
|
-
|
|
21
|
+
export * from "./components/layout/collapse.mjs";
|
|
19
22
|
export * from "./components/layout/tabs.mjs";
|
|
20
23
|
export * from "./components/layout/split-panel.mjs";
|
|
21
|
-
export * from "./components/layout/
|
|
22
|
-
export * from "./components/layout/
|
|
24
|
+
export * from "./components/layout/popper.mjs";
|
|
25
|
+
export * from "./components/layout/width-toggle.mjs";
|
|
26
|
+
export * from "./components/layout/panel.mjs";
|
|
27
|
+
export * from "./components/layout/details.mjs";
|
|
23
28
|
export * from "./components/form/message-state-button.mjs";
|
|
24
29
|
export * from "./components/form/button-bar.mjs";
|
|
25
30
|
export * from "./components/form/reload.mjs";
|
|
@@ -29,7 +34,6 @@ export * from "./components/form/util/floating-ui.mjs";
|
|
|
29
34
|
export * from "./components/form/context-help.mjs";
|
|
30
35
|
export * from "./components/form/tabs.mjs";
|
|
31
36
|
export * from "./components/form/state-button.mjs";
|
|
32
|
-
export * from "./components/form/form-field.mjs";
|
|
33
37
|
export * from "./components/form/popper.mjs";
|
|
34
38
|
export * from "./components/form/select.mjs";
|
|
35
39
|
export * from "./components/form/confirm-button.mjs";
|
|
@@ -41,33 +45,15 @@ export * from "./components/form/tree-select.mjs";
|
|
|
41
45
|
export * from "./components/form/popper-button.mjs";
|
|
42
46
|
export * from "./components/form/shadow-reload.mjs";
|
|
43
47
|
export * from "./components/form/button.mjs";
|
|
48
|
+
export * from "./components/form/field-set.mjs";
|
|
44
49
|
export * from "./components/form/toggle-switch.mjs";
|
|
45
50
|
export * from "./components/form/types/state.mjs";
|
|
46
51
|
export * from "./components/form/template.mjs";
|
|
47
52
|
export * from "./components/form/constants.mjs";
|
|
48
|
-
export * from "./components/form/stylesheet/message-state-button.mjs";
|
|
49
|
-
export * from "./components/form/stylesheet/button-bar.mjs";
|
|
50
|
-
export * from "./components/form/stylesheet/context-help.mjs";
|
|
51
|
-
export * from "./components/form/stylesheet/state-button.mjs";
|
|
52
|
-
export * from "./components/form/stylesheet/form-field.mjs";
|
|
53
|
-
export * from "./components/form/stylesheet/popper.mjs";
|
|
54
|
-
export * from "./components/form/stylesheet/select.mjs";
|
|
55
|
-
export * from "./components/form/stylesheet/confirm-button.mjs";
|
|
56
|
-
export * from "./components/form/stylesheet/context-error.mjs";
|
|
57
|
-
export * from "./components/form/stylesheet/action-button.mjs";
|
|
58
|
-
export * from "./components/form/stylesheet/form.mjs";
|
|
59
|
-
export * from "./components/form/stylesheet/api-button.mjs";
|
|
60
|
-
export * from "./components/form/stylesheet/tree-select.mjs";
|
|
61
|
-
export * from "./components/form/stylesheet/popper-button.mjs";
|
|
62
|
-
export * from "./components/form/stylesheet/button.mjs";
|
|
63
|
-
export * from "./components/form/stylesheet/toggle-switch.mjs";
|
|
64
53
|
export * from "./components/notify/message.mjs";
|
|
65
54
|
export * from "./components/notify/notify.mjs";
|
|
66
55
|
export * from "./components/notify/constants.mjs";
|
|
67
|
-
export * from "./components/notify/stylesheet/message.mjs";
|
|
68
|
-
export * from "./components/notify/stylesheet/notify.mjs";
|
|
69
56
|
export * from "./components/tree-menu/tree-menu.mjs";
|
|
70
|
-
export * from "./components/tree-menu/stylesheet/tree-menu.mjs";
|
|
71
57
|
export * from "./components/host/collapse.mjs";
|
|
72
58
|
export * from "./components/host/config-manager.mjs";
|
|
73
59
|
export * from "./components/host/host.mjs";
|
|
@@ -78,14 +64,6 @@ export * from "./components/host/util.mjs";
|
|
|
78
64
|
export * from "./components/host/call-button.mjs";
|
|
79
65
|
export * from "./components/host/details.mjs";
|
|
80
66
|
export * from "./components/host/constants.mjs";
|
|
81
|
-
export * from "./components/host/stylesheet/collapse.mjs";
|
|
82
|
-
export * from "./components/host/stylesheet/config-manager.mjs";
|
|
83
|
-
export * from "./components/host/stylesheet/host.mjs";
|
|
84
|
-
export * from "./components/host/stylesheet/overlay.mjs";
|
|
85
|
-
export * from "./components/host/stylesheet/toggle-button.mjs";
|
|
86
|
-
export * from "./components/host/stylesheet/viewer.mjs";
|
|
87
|
-
export * from "./components/host/stylesheet/call-button.mjs";
|
|
88
|
-
export * from "./components/host/stylesheet/details.mjs";
|
|
89
67
|
export * from "./components/datatable/filter/input.mjs";
|
|
90
68
|
export * from "./components/datatable/filter/date-range.mjs";
|
|
91
69
|
export * from "./components/datatable/filter/abstract-base.mjs";
|
|
@@ -107,53 +85,12 @@ export * from "./components/datatable/embedded-pagination.mjs";
|
|
|
107
85
|
export * from "./components/datatable/status.mjs";
|
|
108
86
|
export * from "./components/datatable/change-button.mjs";
|
|
109
87
|
export * from "./components/datatable/constants.mjs";
|
|
110
|
-
export * from "./components/datatable/stylesheet/select-filter.mjs";
|
|
111
|
-
export * from "./components/datatable/stylesheet/datasource.mjs";
|
|
112
|
-
export * from "./components/datatable/stylesheet/column-bar.mjs";
|
|
113
|
-
export * from "./components/datatable/stylesheet/filter-button.mjs";
|
|
114
|
-
export * from "./components/datatable/stylesheet/filter-date-range.mjs";
|
|
115
|
-
export * from "./components/datatable/stylesheet/datatable.mjs";
|
|
116
|
-
export * from "./components/datatable/stylesheet/pagination.mjs";
|
|
117
|
-
export * from "./components/datatable/stylesheet/filter.mjs";
|
|
118
|
-
export * from "./components/datatable/stylesheet/save-button.mjs";
|
|
119
|
-
export * from "./components/datatable/stylesheet/dataset.mjs";
|
|
120
|
-
export * from "./components/datatable/stylesheet/embedded-pagination.mjs";
|
|
121
|
-
export * from "./components/datatable/stylesheet/filter-controls-defaults.mjs";
|
|
122
|
-
export * from "./components/datatable/stylesheet/status.mjs";
|
|
123
|
-
export * from "./components/datatable/stylesheet/change-button.mjs";
|
|
124
|
-
export * from "./components/datatable/stylesheet/filter-range.mjs";
|
|
125
88
|
export * from "./components/state/log/entry.mjs";
|
|
126
89
|
export * from "./components/state/state.mjs";
|
|
127
90
|
export * from "./components/state/log.mjs";
|
|
128
|
-
export * from "./components/
|
|
129
|
-
export * from "./components/state/stylesheet/log.mjs";
|
|
91
|
+
export * from "./components/navigation/table-of-content.mjs";
|
|
130
92
|
export * from "./components/constants.mjs";
|
|
131
93
|
export * from "./components/constants.mjs";
|
|
132
|
-
export * from "./components/stylesheet/host.mjs";
|
|
133
|
-
export * from "./components/stylesheet/badge.mjs";
|
|
134
|
-
export * from "./components/stylesheet/border.mjs";
|
|
135
|
-
export * from "./components/stylesheet/spinner.mjs";
|
|
136
|
-
export * from "./components/stylesheet/control.mjs";
|
|
137
|
-
export * from "./components/stylesheet/card.mjs";
|
|
138
|
-
export * from "./components/stylesheet/common.mjs";
|
|
139
|
-
export * from "./components/stylesheet/icons.mjs";
|
|
140
|
-
export * from "./components/stylesheet/popper.mjs";
|
|
141
|
-
export * from "./components/stylesheet/theme.mjs";
|
|
142
|
-
export * from "./components/stylesheet/data-grid.mjs";
|
|
143
|
-
export * from "./components/stylesheet/space.mjs";
|
|
144
|
-
export * from "./components/stylesheet/normalize.mjs";
|
|
145
|
-
export * from "./components/stylesheet/ripple.mjs";
|
|
146
|
-
export * from "./components/stylesheet/link.mjs";
|
|
147
|
-
export * from "./components/stylesheet/property.mjs";
|
|
148
|
-
export * from "./components/stylesheet/form.mjs";
|
|
149
|
-
export * from "./components/stylesheet/skeleton.mjs";
|
|
150
|
-
export * from "./components/stylesheet/typography.mjs";
|
|
151
|
-
export * from "./components/stylesheet/tree-menu.mjs";
|
|
152
|
-
export * from "./components/stylesheet/table.mjs";
|
|
153
|
-
export * from "./components/stylesheet/button.mjs";
|
|
154
|
-
export * from "./components/stylesheet/display.mjs";
|
|
155
|
-
export * from "./components/stylesheet/color.mjs";
|
|
156
|
-
export * from "./components/stylesheet/floating-ui.mjs";
|
|
157
94
|
export * from "./text/formatter.mjs";
|
|
158
95
|
export * from "./text/generate-range-comparison-expression.mjs";
|
|
159
96
|
export * from "./text/util.mjs";
|
|
@@ -261,7 +198,7 @@ export { Monster };
|
|
|
261
198
|
/**
|
|
262
199
|
* This class has no other purpose than to exist.
|
|
263
200
|
*
|
|
264
|
-
* @license AGPLv3
|
|
201
|
+
* @license AGPLv3 or commercial license
|
|
265
202
|
* @since 2.0.0
|
|
266
203
|
* @copyright schukai GmbH
|
|
267
204
|
* @memberOf Monster
|
|
@@ -12,13 +12,14 @@ import { ObserverList } from "./observerlist.mjs";
|
|
|
12
12
|
import { validateObject } from "./validate.mjs";
|
|
13
13
|
import { extend } from "../data/extend.mjs";
|
|
14
14
|
import { instanceSymbol } from "../constants.mjs";
|
|
15
|
+
import { clone } from "../util/clone.mjs";
|
|
15
16
|
export { ProxyObserver };
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* An observer manages a callback function
|
|
19
20
|
*
|
|
20
21
|
* With the ProxyObserver you can attach observer for observation.
|
|
21
|
-
* With each change at the object to be observed an update takes place.
|
|
22
|
+
* With each change at the object to be observed, an update takes place.
|
|
22
23
|
*
|
|
23
24
|
* This also applies to nested objects.
|
|
24
25
|
*
|
|
@@ -72,12 +73,13 @@ class ProxyObserver extends Base {
|
|
|
72
73
|
*/
|
|
73
74
|
setSubject(obj) {
|
|
74
75
|
let i;
|
|
76
|
+
const clonedObject = clone(obj);
|
|
75
77
|
const k = Object.keys(this.subject);
|
|
76
78
|
for (i = 0; i < k.length; i++) {
|
|
77
79
|
delete this.subject[k[i]];
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
this.subject = extend(this.subject,
|
|
82
|
+
this.subject = extend(this.subject, clonedObject);
|
|
81
83
|
return this;
|
|
82
84
|
}
|
|
83
85
|
|
package/source/types/version.mjs
CHANGED
package/test/cases/monster.mjs
CHANGED
package/test/web/tests.js
CHANGED
|
@@ -24173,7 +24173,7 @@ ${key.data.toString("base64")}
|
|
|
24173
24173
|
}
|
|
24174
24174
|
var splitScreenElementSymbol, draggerElementSymbol, startPanelElementSymbol, endPanelElementSymbol, handleElementSymbol, TYPE_VERTICAL, TYPE_HORIZONTAL, SplitScreen;
|
|
24175
24175
|
var init_split_screen2 = __esm({
|
|
24176
|
-
"source/components/layout/split-
|
|
24176
|
+
"source/components/layout/split-panel.mjs"() {
|
|
24177
24177
|
init_customelement();
|
|
24178
24178
|
init_notify2();
|
|
24179
24179
|
init_events();
|
|
@@ -24271,7 +24271,7 @@ ${key.data.toString("base64")}
|
|
|
24271
24271
|
* @return {string}
|
|
24272
24272
|
*/
|
|
24273
24273
|
static getTag() {
|
|
24274
|
-
return "monster-split-
|
|
24274
|
+
return "monster-split-panel";
|
|
24275
24275
|
}
|
|
24276
24276
|
/**
|
|
24277
24277
|
* @return {CSSStyleSheet[]}
|
|
@@ -35838,9 +35838,9 @@ span.monster-fx-ripple{animation:monster-fx-ripple .6s linear;background-color:h
|
|
|
35838
35838
|
chai_default.use(chaiDom);
|
|
35839
35839
|
var global3 = getGlobal();
|
|
35840
35840
|
var html12 = `
|
|
35841
|
-
<monster-split-
|
|
35841
|
+
<monster-split-panel id="my-split-screen">
|
|
35842
35842
|
|
|
35843
|
-
</monster-split-
|
|
35843
|
+
</monster-split-panel>
|
|
35844
35844
|
`;
|
|
35845
35845
|
var SplitScreen2;
|
|
35846
35846
|
describe("SplitScreen", function() {
|
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright schukai GmbH and contributors 2023. All Rights Reserved.
|
|
3
|
-
* Node module: @schukai/monster
|
|
4
|
-
* This file is licensed under the AGPLv3 License.
|
|
5
|
-
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
6
|
-
*/
|
|
7
|
-
import { instanceSymbol } from "../../constants.mjs";
|
|
8
|
-
import { addAttributeToken } from "../../dom/attributes.mjs";
|
|
9
|
-
import {
|
|
10
|
-
ATTRIBUTE_ERRORMESSAGE,
|
|
11
|
-
ATTRIBUTE_ROLE,
|
|
12
|
-
} from "../../dom/constants.mjs";
|
|
13
|
-
import { CustomControl } from "../../dom/customcontrol.mjs";
|
|
14
|
-
import {
|
|
15
|
-
assembleMethodSymbol,
|
|
16
|
-
attributeObserverSymbol,
|
|
17
|
-
registerCustomElement,
|
|
18
|
-
} from "../../dom/customelement.mjs";
|
|
19
|
-
import { findTargetElementFromEvent } from "../../dom/events.mjs";
|
|
20
|
-
import { isFunction } from "../../types/is.mjs";
|
|
21
|
-
import { ATTRIBUTE_BUTTON_CLASS } from "./constants.mjs";
|
|
22
|
-
import { ButtonStyleSheet } from "./stylesheet/button.mjs";
|
|
23
|
-
import { RippleStyleSheet } from "../stylesheet/ripple.mjs";
|
|
24
|
-
import { fireCustomEvent } from "../../dom/events.mjs";
|
|
25
|
-
|
|
26
|
-
export { FormField };
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* This CustomControl creates a container for form elements.
|
|
31
|
-
*
|
|
32
|
-
* <img src="./images/form-field.png">
|
|
33
|
-
*
|
|
34
|
-
* You can create this control either by specifying the HTML tag <monster-form-field />` directly in the HTML or using
|
|
35
|
-
* Javascript via the `document.createElement('monster-form-field');` method.
|
|
36
|
-
*
|
|
37
|
-
* ```html
|
|
38
|
-
* <monster-form-field></monster-form-field>
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* Or you can create this CustomControl directly in Javascript:
|
|
42
|
-
*
|
|
43
|
-
* ```js
|
|
44
|
-
* import {Button} from '@schukai/monster/components/form/form-field.mjs';
|
|
45
|
-
* document.createElement('monster-form-field');
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* The `data-monster-button-class` attribute can be used to change the CSS class of the button.
|
|
49
|
-
*
|
|
50
|
-
* @startuml form-field.png
|
|
51
|
-
* skinparam monochrome true
|
|
52
|
-
* skinparam shadowing false
|
|
53
|
-
* HTMLElement <|-- CustomElement
|
|
54
|
-
* CustomElement <|-- CustomControl
|
|
55
|
-
* CustomControl <|-- FormField
|
|
56
|
-
* @enduml
|
|
57
|
-
*
|
|
58
|
-
* @since 1.5.0
|
|
59
|
-
* @copyright schukai GmbH
|
|
60
|
-
* @memberOf Monster.Components.Form
|
|
61
|
-
* @summary A simple button
|
|
62
|
-
*/
|
|
63
|
-
class FormField extends CustomControl {
|
|
64
|
-
/**
|
|
65
|
-
* This method is called by the `instanceof` operator.
|
|
66
|
-
* @returns {symbol}
|
|
67
|
-
* @since 2.1.0
|
|
68
|
-
*/
|
|
69
|
-
static get [instanceSymbol]() {
|
|
70
|
-
return Symbol.for("@schukai/monster/components/form/button@@instance");
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
*
|
|
75
|
-
* @return {Monster.Components.Form.Button}
|
|
76
|
-
*/
|
|
77
|
-
[assembleMethodSymbol]() {
|
|
78
|
-
super[assembleMethodSymbol]();
|
|
79
|
-
initControlReferences.call(this);
|
|
80
|
-
initEventHandler.call(this);
|
|
81
|
-
return this;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* The Button.click() method simulates a click on the internal button element.
|
|
86
|
-
*
|
|
87
|
-
* @since 3.27.0
|
|
88
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click}
|
|
89
|
-
*/
|
|
90
|
-
click() {
|
|
91
|
-
if (this.getOption("disabled") === true) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
this[buttonElementSymbol] &&
|
|
97
|
-
isFunction(this[buttonElementSymbol].click)
|
|
98
|
-
) {
|
|
99
|
-
this[buttonElementSymbol].click();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* The Button.focus() method sets focus on the internal button element.
|
|
105
|
-
*
|
|
106
|
-
* @since 3.27.0
|
|
107
|
-
* @param {Object} options
|
|
108
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus}
|
|
109
|
-
*/
|
|
110
|
-
focus(options) {
|
|
111
|
-
if (this.getOption("disabled") === true) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (
|
|
116
|
-
this[buttonElementSymbol] &&
|
|
117
|
-
isFunction(this[buttonElementSymbol].focus)
|
|
118
|
-
) {
|
|
119
|
-
this[buttonElementSymbol].focus(options);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* The Button.blur() method removes focus from the internal button element.
|
|
125
|
-
*/
|
|
126
|
-
blur() {
|
|
127
|
-
if (
|
|
128
|
-
this[buttonElementSymbol] &&
|
|
129
|
-
isFunction(this[buttonElementSymbol].blur)
|
|
130
|
-
) {
|
|
131
|
-
this[buttonElementSymbol].blur();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* This method determines which attributes are to be monitored by `attributeChangedCallback()`.
|
|
137
|
-
*
|
|
138
|
-
* @return {string[]}
|
|
139
|
-
*/
|
|
140
|
-
static get observedAttributes() {
|
|
141
|
-
const attributes = super.observedAttributes;
|
|
142
|
-
attributes.push(ATTRIBUTE_BUTTON_CLASS);
|
|
143
|
-
return attributes;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals}
|
|
148
|
-
* @return {boolean}
|
|
149
|
-
*/
|
|
150
|
-
static get formAssociated() {
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* The current selection of the Select
|
|
156
|
-
*
|
|
157
|
-
* ```
|
|
158
|
-
* e = document.querySelector('monster-select');
|
|
159
|
-
* console.log(e.value)
|
|
160
|
-
* // ↦ 1
|
|
161
|
-
* // ↦ ['1','2']
|
|
162
|
-
* ```
|
|
163
|
-
*
|
|
164
|
-
* @property {string|array}
|
|
165
|
-
*/
|
|
166
|
-
get value() {
|
|
167
|
-
return this.getOption("value");
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Set selection
|
|
172
|
-
*
|
|
173
|
-
* ```
|
|
174
|
-
* e = document.querySelector('monster-select');
|
|
175
|
-
* e.value=1
|
|
176
|
-
* ```
|
|
177
|
-
*
|
|
178
|
-
* @property {string|array} value
|
|
179
|
-
* @since 1.2.0
|
|
180
|
-
* @throws {Error} unsupported type
|
|
181
|
-
*/
|
|
182
|
-
set value(value) {
|
|
183
|
-
this.setOption("value", value);
|
|
184
|
-
try {
|
|
185
|
-
this?.setFormValue(this.value);
|
|
186
|
-
} catch (e) {
|
|
187
|
-
addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* To set the options via the html tag the attribute `data-monster-options` must be used.
|
|
193
|
-
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
|
194
|
-
*
|
|
195
|
-
* The individual configuration values can be found in the table.
|
|
196
|
-
*
|
|
197
|
-
* @property {Object} templates Template definitions
|
|
198
|
-
* @property {string} templates.main Main template
|
|
199
|
-
* @property {Object} labels Labels
|
|
200
|
-
* @property {string} labels.button=<slot></slot> Button label
|
|
201
|
-
* @property {Object} actions Callbacks
|
|
202
|
-
* @property {string} actions.click="throw Error" Callback when clicked
|
|
203
|
-
* @property {Object} classes CSS classes
|
|
204
|
-
* @property {string} classes.button="monster-button-primary" CSS class for the button
|
|
205
|
-
* @property {boolean} disabled=false Disabled state
|
|
206
|
-
* @property {Object} effects Effects
|
|
207
|
-
* @property {boolean} effects.ripple=true Ripple effect
|
|
208
|
-
*/
|
|
209
|
-
get defaults() {
|
|
210
|
-
return Object.assign({}, super.defaults, {
|
|
211
|
-
templates: {
|
|
212
|
-
main: getTemplate(),
|
|
213
|
-
},
|
|
214
|
-
labels: {
|
|
215
|
-
button: "<slot></slot>",
|
|
216
|
-
},
|
|
217
|
-
classes: {
|
|
218
|
-
button: "monster-button-primary",
|
|
219
|
-
},
|
|
220
|
-
disabled: false,
|
|
221
|
-
actions: {
|
|
222
|
-
click: () => {
|
|
223
|
-
throw new Error("the click action is not defined");
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
effects: {
|
|
227
|
-
ripple: true,
|
|
228
|
-
},
|
|
229
|
-
value: null,
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
*
|
|
235
|
-
* @return {string}
|
|
236
|
-
*/
|
|
237
|
-
static getTag() {
|
|
238
|
-
return "monster-form-field";
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
*
|
|
243
|
-
* @return {Array<CSSStyleSheet>}
|
|
244
|
-
*/
|
|
245
|
-
static getCSSStyleSheet() {
|
|
246
|
-
return [FormFieldStyleSheet];
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* @private
|
|
252
|
-
* @return {initEventHandler}
|
|
253
|
-
* @fires Monster.Components.Form.event:monster-button-clicked
|
|
254
|
-
*/
|
|
255
|
-
function initEventHandler() {
|
|
256
|
-
const self = this;
|
|
257
|
-
const button = this[buttonElementSymbol];
|
|
258
|
-
|
|
259
|
-
const type = "click";
|
|
260
|
-
|
|
261
|
-
button.addEventListener(type, function (event) {
|
|
262
|
-
const callback = self.getOption("actions.click");
|
|
263
|
-
|
|
264
|
-
fireCustomEvent(self, "monster-button-clicked", {
|
|
265
|
-
button: self,
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
if (!isFunction(callback)) {
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
const element = findTargetElementFromEvent(
|
|
273
|
-
event,
|
|
274
|
-
ATTRIBUTE_ROLE,
|
|
275
|
-
"control",
|
|
276
|
-
);
|
|
277
|
-
|
|
278
|
-
if (!(element instanceof Node && self.hasNode(element))) {
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
callback.call(self, event);
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
if (self.getOption("effects.ripple")) {
|
|
286
|
-
button.addEventListener("click", createRipple.bind(self));
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// data-monster-options
|
|
290
|
-
self[attributeObserverSymbol][ATTRIBUTE_BUTTON_CLASS] = function (value) {
|
|
291
|
-
self.setOption("classes.button", value);
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
return this;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* @private
|
|
299
|
-
*/
|
|
300
|
-
function initControlReferences() {
|
|
301
|
-
this[buttonElementSymbol] = this.shadowRoot.querySelector(
|
|
302
|
-
`[${ATTRIBUTE_ROLE}=button]`,
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* @private
|
|
308
|
-
* @return {string}
|
|
309
|
-
*/
|
|
310
|
-
function getTemplate() {
|
|
311
|
-
// language=HTML
|
|
312
|
-
return `
|
|
313
|
-
<div data-monster-role="control" part="control">
|
|
314
|
-
<button data-monster-attributes="disabled path:disabled | if:true, class path:classes.button"
|
|
315
|
-
data-monster-role="button"
|
|
316
|
-
part="button"
|
|
317
|
-
data-monster-replace="path:labels.button"></button>
|
|
318
|
-
</div>`;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
function createRipple(event) {
|
|
322
|
-
const button = this[buttonElementSymbol];
|
|
323
|
-
|
|
324
|
-
const circle = document.createElement("span");
|
|
325
|
-
const diameter = Math.max(button.clientWidth, button.clientHeight);
|
|
326
|
-
const radius = diameter / 2;
|
|
327
|
-
|
|
328
|
-
circle.style.width = circle.style.height = `${diameter}px`;
|
|
329
|
-
circle.style.left = `${event.clientX - button.offsetLeft - radius}px`;
|
|
330
|
-
circle.style.top = `${event.clientY - button.offsetTop - radius}px`;
|
|
331
|
-
circle.classList.add("monster-fx-ripple");
|
|
332
|
-
|
|
333
|
-
const ripples = button.getElementsByClassName("monster-fx-ripple");
|
|
334
|
-
for (const ripple of ripples) {
|
|
335
|
-
ripple.remove();
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
button.appendChild(circle);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
registerCustomElement(FormField);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Copyright schukai GmbH and contributors 2024. All Rights Reserved.
|
|
4
|
-
* Node module: @schukai/monster
|
|
5
|
-
* This file is licensed under the AGPLv3 License.
|
|
6
|
-
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
|
10
|
-
import {ATTRIBUTE_ERRORMESSAGE} from "../../../dom/constants.mjs";
|
|
11
|
-
|
|
12
|
-
export {FormFieldStyleSheet}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @private
|
|
16
|
-
* @type {CSSStyleSheet}
|
|
17
|
-
*/
|
|
18
|
-
const FormFieldStyleSheet = new CSSStyleSheet();
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
FormFieldStyleSheet.insertRule(`
|
|
22
|
-
@layer formfield {
|
|
23
|
-
|
|
24
|
-
}`, 0);
|
|
25
|
-
} catch (e) {
|
|
26
|
-
addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
|
|
27
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|