@schukai/monster 3.76.0 → 3.78.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 +20 -0
- package/package.json +1 -1
- package/source/components/content/copy.mjs +475 -0
- package/source/components/content/style/copy.pcss +33 -0
- package/source/components/content/stylesheet/copy.mjs +31 -0
- package/source/components/datatable/change-button.mjs +1 -1
- package/source/components/datatable/columnbar.mjs +1 -1
- package/source/components/datatable/dataset.mjs +1 -1
- package/source/components/datatable/datasource/dom.mjs +1 -1
- package/source/components/datatable/datasource/rest.mjs +1 -1
- package/source/components/datatable/datasource.mjs +1 -1
- package/source/components/datatable/datatable.mjs +1 -1
- package/source/components/datatable/filter/date-range.mjs +1 -1
- package/source/components/datatable/filter/input.mjs +1 -1
- package/source/components/datatable/filter/range.mjs +1 -1
- package/source/components/datatable/filter/select.mjs +1 -1
- package/source/components/datatable/filter-button.mjs +1 -1
- package/source/components/datatable/filter.mjs +1 -1
- package/source/components/datatable/pagination.mjs +1 -1
- package/source/components/datatable/save-button.mjs +1 -1
- package/source/components/datatable/status.mjs +1 -1
- package/source/components/form/action-button.mjs +1 -1
- package/source/components/form/api-button.mjs +1 -1
- package/source/components/form/button-bar.mjs +1 -1
- package/source/components/form/button.mjs +1 -1
- package/source/components/form/confirm-button.mjs +1 -1
- package/source/components/form/context-error.mjs +2 -2
- package/source/components/form/context-help.mjs +1 -37
- package/source/components/form/field-set.mjs +31 -44
- package/source/components/form/message-state-button.mjs +1 -1
- package/source/components/form/popper-button.mjs +1 -1
- package/source/components/form/reload.mjs +1 -1
- package/source/components/form/select.mjs +1 -1
- package/source/components/form/shadow-reload.mjs +1 -1
- package/source/components/form/state-button.mjs +1 -1
- package/source/components/form/style/field-set.pcss +164 -70
- package/source/components/form/stylesheet/field-set.mjs +7 -14
- package/source/components/form/template.mjs +1 -1
- package/source/components/form/toggle-switch.mjs +321 -340
- package/source/components/form/tree-select.mjs +1 -1
- package/source/components/host/call-button.mjs +1 -1
- package/source/components/host/collapse.mjs +1 -1
- package/source/components/host/config-manager.mjs +1 -1
- package/source/components/host/host.mjs +1 -1
- package/source/components/host/overlay.mjs +1 -1
- package/source/components/host/toggle-button.mjs +1 -1
- package/source/components/host/viewer.mjs +1 -1
- package/source/components/layout/collapse.mjs +21 -21
- package/source/components/layout/details.mjs +11 -11
- package/source/components/layout/iframe.mjs +1 -1
- package/source/components/layout/panel.mjs +1 -1
- package/source/components/layout/popper.mjs +1 -1
- package/source/components/layout/slider.mjs +1 -1
- package/source/components/layout/split-panel.mjs +1 -1
- package/source/components/layout/tabs.mjs +1 -1
- package/source/components/layout/width-toggle.mjs +17 -9
- package/source/components/navigation/table-of-content.mjs +1 -1
- package/source/components/state/log.mjs +167 -153
- package/source/components/state/state.mjs +9 -33
- package/source/components/stylesheet/form.mjs +6 -13
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import {instanceSymbol} from "../../constants.mjs";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
assembleMethodSymbol,
|
|
18
|
+
CustomElement,
|
|
19
|
+
getSlottedElements,
|
|
20
|
+
registerCustomElement,
|
|
21
21
|
} from "../../dom/customelement.mjs";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
22
|
+
import {LogStyleSheet} from "./stylesheet/log.mjs";
|
|
23
|
+
import {Entry} from "./log/entry.mjs";
|
|
24
|
+
import {validateInstance} from "../../types/validate.mjs";
|
|
25
25
|
import "./state.mjs";
|
|
26
26
|
|
|
27
|
-
export {
|
|
27
|
+
export {Log};
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* @private
|
|
@@ -71,118 +71,138 @@ const emptyStateElementSymbol = Symbol("emptyStateElement");
|
|
|
71
71
|
* @memberOf Monster.Components.State
|
|
72
72
|
* @summary Log is a control to show a log message.
|
|
73
73
|
*/
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* A Log component
|
|
78
|
+
*
|
|
79
|
+
* @fragments /fragments/components/layout/collapse/
|
|
80
|
+
*
|
|
81
|
+
* @example /examples/components/layout/collapse-simple
|
|
82
|
+
*
|
|
83
|
+
* @since 3.74.0
|
|
84
|
+
* @copyright schukai GmbH
|
|
85
|
+
* @summary A Log component to show a log message.
|
|
86
|
+
*/
|
|
74
87
|
class Log extends CustomElement {
|
|
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
|
-
|
|
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
|
-
|
|
88
|
+
/**
|
|
89
|
+
* @return {void}
|
|
90
|
+
*/
|
|
91
|
+
[assembleMethodSymbol]() {
|
|
92
|
+
super[assembleMethodSymbol]();
|
|
93
|
+
|
|
94
|
+
initControlReferences.call(this);
|
|
95
|
+
initEventHandler.call(this);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* This method is called by the `instanceof` operator.
|
|
100
|
+
* @returns {symbol}
|
|
101
|
+
*/
|
|
102
|
+
static get [instanceSymbol]() {
|
|
103
|
+
return Symbol.for("@schukai/monster/components/state/log@@instance");
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* To set the options via the HTML tag, the attribute `data-monster-options` must be used.
|
|
108
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
|
109
|
+
*
|
|
110
|
+
* The individual configuration values can be found in the table.
|
|
111
|
+
*
|
|
112
|
+
* @property {Object} templates Template definitions
|
|
113
|
+
* @property {string} templates.main Main template
|
|
114
|
+
* @property {Object} labels Labels
|
|
115
|
+
* @property {string} labels.nothingToReport Label for empty state
|
|
116
|
+
*/
|
|
117
|
+
get defaults() {
|
|
118
|
+
return Object.assign({}, super.defaults, {
|
|
119
|
+
templates: {
|
|
120
|
+
main: getTemplate(),
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
labels: {
|
|
124
|
+
nothingToReport: "There is nothing to report yet.",
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
entries: [],
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @return {void}
|
|
133
|
+
*/
|
|
134
|
+
connectedCallback() {
|
|
135
|
+
super.connectedCallback();
|
|
136
|
+
|
|
137
|
+
const slottedElements = getSlottedElements.call(this);
|
|
138
|
+
if (slottedElements.size > 0) {
|
|
139
|
+
this[emptyStateElementSymbol].style.display = "none";
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Clear the log
|
|
145
|
+
*
|
|
146
|
+
* @return {Log}
|
|
147
|
+
*/
|
|
148
|
+
clear() {
|
|
149
|
+
this[logElementSymbol].innerHTML = "";
|
|
150
|
+
this[emptyStateElementSymbol].style.display = "block";
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Add an entry to the log
|
|
156
|
+
* @param entry
|
|
157
|
+
* @returns {Log}
|
|
158
|
+
*/
|
|
159
|
+
addEntry(entry) {
|
|
160
|
+
validateInstance(entry, Entry);
|
|
161
|
+
|
|
162
|
+
const entries = this.getOption("entries");
|
|
163
|
+
entries.push(entry);
|
|
164
|
+
|
|
165
|
+
/** this field is not used, but triggers a change event */
|
|
166
|
+
this.setOption("length", entries.length - 1);
|
|
167
|
+
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Add a log message
|
|
173
|
+
* @param message
|
|
174
|
+
* @param date
|
|
175
|
+
* @returns {Log}
|
|
176
|
+
*/
|
|
177
|
+
addMessage(message, date) {
|
|
178
|
+
if (!date) {
|
|
179
|
+
date = new Date();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
this.addEntry(
|
|
183
|
+
new Entry({
|
|
184
|
+
message: message,
|
|
185
|
+
date: date,
|
|
186
|
+
}),
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
return this;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
*
|
|
194
|
+
* @return {string}
|
|
195
|
+
*/
|
|
196
|
+
static getTag() {
|
|
197
|
+
return "monster-log";
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @return {CSSStyleSheet[]}
|
|
202
|
+
*/
|
|
203
|
+
static getCSSStyleSheet() {
|
|
204
|
+
return [LogStyleSheet];
|
|
205
|
+
}
|
|
186
206
|
}
|
|
187
207
|
|
|
188
208
|
/**
|
|
@@ -191,43 +211,37 @@ class Log extends CustomElement {
|
|
|
191
211
|
* @throws {Error} no shadow-root is defined
|
|
192
212
|
*/
|
|
193
213
|
function initControlReferences() {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
214
|
+
if (!this.shadowRoot) {
|
|
215
|
+
throw new Error("no shadow-root is defined");
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
this[logElementSymbol] = this.shadowRoot.querySelector(
|
|
219
|
+
"[data-monster-role=control]",
|
|
220
|
+
);
|
|
221
|
+
this[emptyStateElementSymbol] = this.shadowRoot.querySelector(
|
|
222
|
+
"[data-monster-role=empty-state]",
|
|
223
|
+
);
|
|
204
224
|
}
|
|
205
225
|
|
|
206
226
|
/**
|
|
207
227
|
* @private
|
|
208
228
|
*/
|
|
209
229
|
function initEventHandler() {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
// self.toggle();
|
|
226
|
-
// }
|
|
227
|
-
//
|
|
228
|
-
// self[buttonElementSymbol].addEventListener('click', self[buttonEventHandlerSymbol]);
|
|
229
|
-
|
|
230
|
-
return this;
|
|
230
|
+
if (!this.shadowRoot) {
|
|
231
|
+
throw new Error("no shadow-root is defined");
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
this.shadowRoot.addEventListener("slotchange", (event) => {
|
|
235
|
+
const slottedElements = getSlottedElements.call(this);
|
|
236
|
+
|
|
237
|
+
if (slottedElements.size > 0) {
|
|
238
|
+
this[emptyStateElementSymbol].style.display = "none";
|
|
239
|
+
} else {
|
|
240
|
+
this[emptyStateElementSymbol].style.display = "block";
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
return this;
|
|
231
245
|
}
|
|
232
246
|
|
|
233
247
|
/**
|
|
@@ -235,8 +249,8 @@ function initEventHandler() {
|
|
|
235
249
|
* @return {string}
|
|
236
250
|
*/
|
|
237
251
|
function getTemplate() {
|
|
238
|
-
|
|
239
|
-
|
|
252
|
+
// language=HTML
|
|
253
|
+
return `
|
|
240
254
|
<template id="entry">
|
|
241
255
|
<li data-monster-role="entry">
|
|
242
256
|
<span></span>
|
|
@@ -29,44 +29,20 @@ export { State };
|
|
|
29
29
|
export const stateElementSymbol = Symbol("state");
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* A state component
|
|
33
33
|
*
|
|
34
|
-
*
|
|
34
|
+
* @fragments /fragments/components/state/state/
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* You can create this control either by specifying the HTML tag <monster-state />` directly in the HTML or using
|
|
39
|
-
* Javascript via the `document.createElement('monster-state');` method.
|
|
40
|
-
*
|
|
41
|
-
* ```html
|
|
42
|
-
* <monster-state></monster-state>
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* Or you can create this CustomControl directly in Javascript:
|
|
46
|
-
*
|
|
47
|
-
* ```js
|
|
48
|
-
* import {State} from '@schukai/component-state/source/state.js';
|
|
49
|
-
* document.createElement('monster-state');
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* @externalExample ../../../example/components/state/state.mjs
|
|
53
|
-
* @startuml state.png
|
|
54
|
-
* skinparam monochrome true
|
|
55
|
-
* skinparam shadowing false
|
|
56
|
-
* HTMLElement <|-- CustomElement
|
|
57
|
-
* CustomElement <|-- CustomControl
|
|
58
|
-
* CustomControl <|-- State
|
|
59
|
-
* @enduml
|
|
36
|
+
* @example /examples/components/state/state-simple
|
|
60
37
|
*
|
|
61
38
|
* @since 1.5.0
|
|
62
39
|
* @copyright schukai GmbH
|
|
63
|
-
* @
|
|
64
|
-
* @summary
|
|
65
|
-
|
|
40
|
+
* @summary States tell users that there’s a state. That's it!
|
|
41
|
+
* @summary The state control is used in the log control, among other things.
|
|
42
|
+
**/
|
|
66
43
|
class State extends CustomControl {
|
|
67
44
|
/**
|
|
68
|
-
*
|
|
69
|
-
* @return {Monster.Components.State.State}
|
|
45
|
+
* @return {void}
|
|
70
46
|
*/
|
|
71
47
|
[assembleMethodSymbol]() {
|
|
72
48
|
super[assembleMethodSymbol]();
|
|
@@ -77,11 +53,11 @@ class State extends CustomControl {
|
|
|
77
53
|
* @returns {symbol}
|
|
78
54
|
*/
|
|
79
55
|
static get [instanceSymbol]() {
|
|
80
|
-
return Symbol.for("@schukai/
|
|
56
|
+
return Symbol.for("@schukai/monster/components/state/state@@instance");
|
|
81
57
|
}
|
|
82
58
|
|
|
83
59
|
/**
|
|
84
|
-
* To set the options via the
|
|
60
|
+
* To set the options via the HTML tag, the attribute `data-monster-options` must be used.
|
|
85
61
|
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
|
86
62
|
*
|
|
87
63
|
* The individual configuration values can be found in the table.
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import {addAttributeToken} from "../../dom/attributes.mjs";
|
|
14
|
+
import {ATTRIBUTE_ERRORMESSAGE} from "../../dom/constants.mjs";
|
|
15
15
|
|
|
16
|
-
export {
|
|
16
|
+
export {FormStyleSheet}
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @private
|
|
@@ -22,17 +22,10 @@ export { FormStyleSheet };
|
|
|
22
22
|
const FormStyleSheet = new CSSStyleSheet();
|
|
23
23
|
|
|
24
24
|
try {
|
|
25
|
-
|
|
26
|
-
`
|
|
25
|
+
FormStyleSheet.insertRule(`
|
|
27
26
|
@layer form {
|
|
28
27
|
input,meter,progress,select,textarea{accent-color:var(--monster-color-secondary-2);background-color:var(--monster-bg-color-primary-1);border-color:var(--monster-theme-control-border-color);border-radius:var(--monster-theme-control-border-radius);border-style:var(--monster-theme-control-border-style);border-width:var(--monster-theme-control-border-width);box-sizing:border-box;color:var(--monster-color-primary-1);font-family:inherit;font-size:100%;margin:0;outline:none}input,select,textarea{height:-moz-fit-content;height:fit-content;padding:.4rem .6rem}textarea{min-height:6rem;resize:vertical}input[type=color]{height:2rem;margin:0;padding:.1rem;width:2rem}input:hover:not([type=radio]):not([type=checkbox]):not([type=range]),select:hover,textarea:hover{box-shadow:var(--monster-box-shadow-2);transition:background .8s,color .25s .0833333333s}input:focus,select:focus,textarea:focus{outline:1px dashed var(--monster-color-selection-3);outline-offset:3px}
|
|
29
|
-
}`,
|
|
30
|
-
0,
|
|
31
|
-
);
|
|
28
|
+
}`, 0);
|
|
32
29
|
} catch (e) {
|
|
33
|
-
|
|
34
|
-
document.getRootNode().querySelector("html"),
|
|
35
|
-
ATTRIBUTE_ERRORMESSAGE,
|
|
36
|
-
e + "",
|
|
37
|
-
);
|
|
30
|
+
addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
|
|
38
31
|
}
|