@schukai/monster 3.115.3 → 3.116.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 +19 -0
- package/package.json +1 -1
- package/source/components/datatable/stylesheet/dataset.mjs +1 -1
- package/source/components/datatable/stylesheet/datatable.mjs +1 -1
- package/source/components/host/overlay.mjs +4 -295
- package/source/components/layout/board.mjs +711 -0
- package/source/components/layout/overlay.mjs +320 -0
- package/source/components/layout/style/board.pcss +34 -0
- package/source/components/layout/style/tabs.pcss +2 -1
- package/source/components/layout/stylesheet/board.mjs +31 -0
- package/source/components/layout/stylesheet/tabs.mjs +1 -1
- package/source/components/style/skeleton.css +60 -20
- package/source/components/style/typography.css +2 -2
- package/source/components/stylesheet/skeleton.mjs +1 -1
- package/source/components/tree-menu/tree-menu.mjs +10 -10
- package/source/monster.mjs +3 -1
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +40 -36
- /package/source/components/{host → layout}/style/overlay.pcss +0 -0
- /package/source/components/{host → layout}/stylesheet/overlay.mjs +0 -0
@@ -12,303 +12,12 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
import {
|
16
|
-
assembleMethodSymbol,
|
17
|
-
CustomElement,
|
18
|
-
registerCustomElement,
|
19
|
-
} from "../../dom/customelement.mjs";
|
20
|
-
import "../notify/notify.mjs";
|
21
|
-
import { OverlayStyleSheet } from "./stylesheet/overlay.mjs";
|
22
|
-
import { ATTRIBUTE_ROLE } from "../../dom/constants.mjs";
|
23
|
-
import {
|
24
|
-
findTargetElementFromEvent,
|
25
|
-
fireCustomEvent,
|
26
|
-
} from "../../dom/events.mjs";
|
27
|
-
import { instanceSymbol } from "../../constants.mjs";
|
28
|
-
|
15
|
+
import { Overlay as NewOverlay } from "../layout/overlay.mjs";
|
29
16
|
export { Overlay };
|
30
17
|
|
31
18
|
/**
|
32
|
-
* @
|
33
|
-
* @type {symbol}
|
34
|
-
*/
|
35
|
-
const overlayElementSymbol = Symbol("overlayElement");
|
36
|
-
|
37
|
-
/**
|
38
|
-
* @private
|
39
|
-
* @type {symbol}
|
40
|
-
*/
|
41
|
-
const overlayCloseElementSymbol = Symbol("overlayCloserElement");
|
42
|
-
|
43
|
-
/**
|
44
|
-
* @private
|
45
|
-
* @type {symbol}
|
46
|
-
*/
|
47
|
-
const overlayOpenElementSymbol = Symbol("overlayOpenElement");
|
48
|
-
|
49
|
-
/**
|
50
|
-
* @private
|
51
|
-
* @type {symbol}
|
52
|
-
*/
|
53
|
-
const closeEventHandlerSymbol = Symbol("closeEventHandler");
|
54
|
-
|
55
|
-
/**
|
56
|
-
* @private
|
57
|
-
* @type {symbol}
|
58
|
-
*/
|
59
|
-
const openEventHandlerSymbol = Symbol("openEventHandler");
|
60
|
-
|
61
|
-
/**
|
62
|
-
* @private
|
63
|
-
* @type {string}
|
64
|
-
*/
|
65
|
-
const ATTRIBUTE_VALUE_OVERLAY_OPEN = "overlay-open";
|
66
|
-
|
67
|
-
/**
|
68
|
-
* The Overlay component is used to show an overlay and a button to open the overlay.
|
69
|
-
*
|
19
|
+
* @since 1.10.0
|
70
20
|
* @copyright schukai GmbH
|
71
|
-
* @
|
72
|
-
* @fires monster-overlay-before-open
|
73
|
-
* @fires monster-overlay-open
|
74
|
-
* @fires monster-overlay-before-close
|
75
|
-
* @fires monster-overlay-closed
|
21
|
+
* @deprecated since 3.116.0 use Layout/Overlay instead
|
76
22
|
*/
|
77
|
-
class Overlay extends
|
78
|
-
/**
|
79
|
-
* This method is called by the `instanceof` operator.
|
80
|
-
* @return {symbol}
|
81
|
-
*/
|
82
|
-
static get [instanceSymbol]() {
|
83
|
-
return Symbol.for("@schukai/monster/components/host/overlay@@instance");
|
84
|
-
}
|
85
|
-
|
86
|
-
/**
|
87
|
-
* To set the options via the HTML tag, the attribute `data-monster-options` must be used.
|
88
|
-
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
89
|
-
*
|
90
|
-
* The individual configuration values can be found in the table.
|
91
|
-
*
|
92
|
-
* @property {Object} templates Template definitions
|
93
|
-
* @property {string} templates.main Main template
|
94
|
-
* @property {Object} container Container definitions
|
95
|
-
* @property {array} container Container definitions
|
96
|
-
* @property {string} container[].name Name of the container
|
97
|
-
* @property {string} container[].content Content of the container
|
98
|
-
* @property {string} container[].class Css class of the container
|
99
|
-
* @property {Object} classes Css classes
|
100
|
-
* @property {string} classes.body Css class to hide the body. This class is removed when the component is ready.
|
101
|
-
* @property {string} classes.overlay Css class to hide the overlay. This class is removed when the component is ready.
|
102
|
-
* @property {Object} features Feature definitions
|
103
|
-
* @property {boolean} features.escapeKey If true the overlay can be closed with the escape key
|
104
|
-
* @property {boolean} features.openButton If true the overlay can be opened with a button
|
105
|
-
*/
|
106
|
-
get defaults() {
|
107
|
-
return Object.assign({}, super.defaults, {
|
108
|
-
templates: {
|
109
|
-
main: getTemplate(),
|
110
|
-
},
|
111
|
-
overlay: [
|
112
|
-
{
|
113
|
-
name: "content",
|
114
|
-
content: "<slot></slot>",
|
115
|
-
class: "",
|
116
|
-
},
|
117
|
-
],
|
118
|
-
classes: {
|
119
|
-
body: "hidden",
|
120
|
-
overlay: "hide-empty",
|
121
|
-
},
|
122
|
-
features: {
|
123
|
-
escapeKey: true,
|
124
|
-
openButton: true,
|
125
|
-
},
|
126
|
-
});
|
127
|
-
}
|
128
|
-
|
129
|
-
/**
|
130
|
-
* @private
|
131
|
-
*/
|
132
|
-
connectedCallback() {
|
133
|
-
super.connectedCallback();
|
134
|
-
|
135
|
-
/**
|
136
|
-
* show the scroll bar always
|
137
|
-
* @type {string}
|
138
|
-
*/
|
139
|
-
document.documentElement.style.overflowY = "scroll";
|
140
|
-
|
141
|
-
const classNames = this.getOption("classes.body");
|
142
|
-
|
143
|
-
if (document.body.classList.contains(classNames)) {
|
144
|
-
document.body.classList.remove(classNames);
|
145
|
-
}
|
146
|
-
}
|
147
|
-
|
148
|
-
/**
|
149
|
-
*
|
150
|
-
* @return {Monster.Components.Host.Overlay}
|
151
|
-
*/
|
152
|
-
[assembleMethodSymbol]() {
|
153
|
-
super[assembleMethodSymbol]();
|
154
|
-
|
155
|
-
initControlReferences.call(this);
|
156
|
-
initEventHandler.call(this);
|
157
|
-
}
|
158
|
-
|
159
|
-
/**
|
160
|
-
*
|
161
|
-
* @return {Monster.Components.Host.Overlay}
|
162
|
-
*/
|
163
|
-
toggle() {
|
164
|
-
if (this[overlayElementSymbol].classList.contains("open")) {
|
165
|
-
this.close();
|
166
|
-
} else {
|
167
|
-
this.open();
|
168
|
-
}
|
169
|
-
return this;
|
170
|
-
}
|
171
|
-
|
172
|
-
/**
|
173
|
-
* @return {Monster.Components.Host.Overlay}
|
174
|
-
* @fires monster-overlay-before-open
|
175
|
-
* @fires monster-overlay-open
|
176
|
-
* @fires monster-overlay-before-close
|
177
|
-
* @fires monster-overlay-closed
|
178
|
-
*/
|
179
|
-
open() {
|
180
|
-
fireCustomEvent(this, "monster-overlay-before-open", {});
|
181
|
-
|
182
|
-
this[overlayElementSymbol].classList.remove("hide-empty");
|
183
|
-
|
184
|
-
setTimeout(() => {
|
185
|
-
this[overlayElementSymbol].classList.add("open");
|
186
|
-
setTimeout(() => {
|
187
|
-
fireCustomEvent(this, "monster-overlay-open", {});
|
188
|
-
}, 0);
|
189
|
-
}, 0);
|
190
|
-
|
191
|
-
return this;
|
192
|
-
}
|
193
|
-
|
194
|
-
/**
|
195
|
-
* @return {Monster.Components.Host.Overlay}
|
196
|
-
*/
|
197
|
-
close() {
|
198
|
-
fireCustomEvent(this, "monster-overlay-before-close", {});
|
199
|
-
setTimeout(() => {
|
200
|
-
this[overlayElementSymbol].classList.remove("open");
|
201
|
-
setTimeout(() => {
|
202
|
-
fireCustomEvent(this, "monster-overlay-closed", {});
|
203
|
-
}, 0);
|
204
|
-
}, 0);
|
205
|
-
return this;
|
206
|
-
}
|
207
|
-
|
208
|
-
/**
|
209
|
-
*
|
210
|
-
* @return {string}
|
211
|
-
*/
|
212
|
-
static getTag() {
|
213
|
-
return "monster-overlay";
|
214
|
-
}
|
215
|
-
|
216
|
-
/**
|
217
|
-
* @return {CSSStyleSheet[]}
|
218
|
-
*/
|
219
|
-
static getCSSStyleSheet() {
|
220
|
-
return [OverlayStyleSheet];
|
221
|
-
}
|
222
|
-
}
|
223
|
-
|
224
|
-
/**
|
225
|
-
* @private
|
226
|
-
* @return {Select}
|
227
|
-
* @throws {Error} no shadow-root is defined
|
228
|
-
*/
|
229
|
-
function initControlReferences() {
|
230
|
-
if (!this.shadowRoot) {
|
231
|
-
throw new Error("no shadow-root is defined");
|
232
|
-
}
|
233
|
-
|
234
|
-
this[overlayElementSymbol] = this.shadowRoot.getElementById("overlay");
|
235
|
-
this[overlayCloseElementSymbol] = this.shadowRoot.querySelector(
|
236
|
-
"[data-monster-role=overlay-close]",
|
237
|
-
);
|
238
|
-
this[overlayOpenElementSymbol] = this.shadowRoot.querySelector(
|
239
|
-
"[data-monster-role=overlay-open]",
|
240
|
-
);
|
241
|
-
}
|
242
|
-
|
243
|
-
/**
|
244
|
-
* @private
|
245
|
-
*/
|
246
|
-
function initEventHandler() {
|
247
|
-
/**
|
248
|
-
* @param {Event} event
|
249
|
-
*/
|
250
|
-
this[closeEventHandlerSymbol] = (event) => {
|
251
|
-
this.close();
|
252
|
-
};
|
253
|
-
|
254
|
-
this[overlayCloseElementSymbol].addEventListener(
|
255
|
-
"click",
|
256
|
-
this[closeEventHandlerSymbol],
|
257
|
-
);
|
258
|
-
|
259
|
-
/**
|
260
|
-
* @param {Event} event
|
261
|
-
*/
|
262
|
-
this[openEventHandlerSymbol] = (event) => {
|
263
|
-
const element = findTargetElementFromEvent(
|
264
|
-
event,
|
265
|
-
ATTRIBUTE_ROLE,
|
266
|
-
ATTRIBUTE_VALUE_OVERLAY_OPEN,
|
267
|
-
);
|
268
|
-
if (element) {
|
269
|
-
this.open();
|
270
|
-
}
|
271
|
-
};
|
272
|
-
|
273
|
-
this.addEventListener("click", this[openEventHandlerSymbol]);
|
274
|
-
|
275
|
-
if (this.getOption("features.escapeKey") === true) {
|
276
|
-
this.addEventListener("keydown", (event) => {
|
277
|
-
if (event.key === "Escape") {
|
278
|
-
const isNotCombinedKey = !(
|
279
|
-
event.ctrlKey ||
|
280
|
-
event.altKey ||
|
281
|
-
event.shiftKey
|
282
|
-
);
|
283
|
-
if (isNotCombinedKey) {
|
284
|
-
this.toggleOverlay();
|
285
|
-
}
|
286
|
-
}
|
287
|
-
});
|
288
|
-
}
|
289
|
-
|
290
|
-
return this;
|
291
|
-
}
|
292
|
-
|
293
|
-
/**
|
294
|
-
* @private
|
295
|
-
* @return {string}
|
296
|
-
*/
|
297
|
-
function getTemplate() {
|
298
|
-
// language=HTML
|
299
|
-
return `
|
300
|
-
<template id="host-overlay">
|
301
|
-
<div data-monster-replace="path:host-overlay.content"
|
302
|
-
data-monster-attributes="part path:host-overlay.name, data-monster-role path:host-container.overlay"></div>
|
303
|
-
</template>
|
304
|
-
|
305
|
-
<div data-monster-role="overlay-open" part="open"
|
306
|
-
data-monster-attributes="class path:features.openButton | if:visible:hidden"></div>
|
307
|
-
|
308
|
-
<div id="overlay" data-monster-role="overlay" part="overlay" data-monster-insert="host-overlay path:overlay"
|
309
|
-
data-monster-attributes="class path:classes.overlay">
|
310
|
-
<div data-monster-role="overlay-close" part="close"></div>
|
311
|
-
</div>`;
|
312
|
-
}
|
313
|
-
|
314
|
-
registerCustomElement(Overlay);
|
23
|
+
class Overlay extends NewOverlay {}
|