@schukai/monster 3.73.8 → 3.74.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 +30 -0
- package/package.json +1 -1
- package/source/components/datatable/change-button.mjs +4 -4
- package/source/components/datatable/columnbar.mjs +2 -2
- package/source/components/datatable/dataset.mjs +2 -2
- package/source/components/datatable/datasource/rest.mjs +9 -8
- package/source/components/datatable/datatable.mjs +6 -6
- package/source/components/datatable/filter/date-range.mjs +6 -6
- package/source/components/datatable/filter/input.mjs +2 -2
- package/source/components/datatable/filter/range.mjs +4 -4
- package/source/components/datatable/filter/select.mjs +6 -2
- package/source/components/datatable/filter.mjs +4 -4
- package/source/components/datatable/save-button.mjs +4 -4
- package/source/components/datatable/stylesheet/change-button.mjs +1 -1
- package/source/components/datatable/stylesheet/column-bar.mjs +1 -1
- package/source/components/datatable/stylesheet/dataset.mjs +1 -1
- package/source/components/datatable/stylesheet/datatable.mjs +13 -6
- package/source/components/datatable/stylesheet/embedded-pagination.mjs +1 -1
- package/source/components/datatable/stylesheet/filter-select.mjs +13 -6
- package/source/components/datatable/stylesheet/filter.mjs +13 -6
- package/source/components/datatable/stylesheet/pagination.mjs +1 -1
- package/source/components/datatable/stylesheet/save-button.mjs +1 -1
- package/source/components/datatable/stylesheet/status.mjs +1 -1
- package/source/components/datatable/util.mjs +2 -2
- package/source/components/form/action-button.mjs +12 -1
- package/source/components/form/api-button.mjs +16 -5
- package/source/components/form/button-bar.mjs +13 -1
- package/source/components/form/confirm-button.mjs +12 -1
- package/source/components/form/context-error.mjs +12 -1
- package/source/components/form/context-help.mjs +12 -1
- package/source/components/form/field-set.mjs +12 -1
- package/source/components/form/form.mjs +15 -0
- package/source/components/form/message-state-button.mjs +16 -1
- package/source/components/form/popper-button.mjs +16 -1
- package/source/components/form/reload.mjs +14 -2
- package/source/components/form/shadow-reload.mjs +5 -62
- package/source/components/form/state-button.mjs +4 -30
- package/source/components/form/stylesheet/action-button.mjs +1 -1
- package/source/components/form/stylesheet/field-set.mjs +1 -1
- package/source/components/form/stylesheet/state-button.mjs +1 -1
- package/source/components/form/stylesheet/toggle-switch.mjs +1 -1
- package/source/components/form/tabs.mjs +1 -37
- package/source/components/form/template.mjs +4 -29
- package/source/components/form/toggle-switch.mjs +16 -1
- package/source/components/form/tree-select.mjs +8 -36
- package/source/components/host/stylesheet/call-button.mjs +1 -1
- package/source/components/host/stylesheet/host.mjs +1 -1
- package/source/components/host/stylesheet/overlay.mjs +1 -1
- package/source/components/host/stylesheet/toggle-button.mjs +1 -1
- package/source/components/host/stylesheet/viewer.mjs +1 -1
- package/source/components/layout/popper.mjs +317 -317
- package/source/components/layout/slider.mjs +668 -0
- package/source/components/layout/style/slider.pcss +114 -0
- package/source/components/layout/stylesheet/collapse.mjs +1 -1
- package/source/components/layout/stylesheet/details.mjs +1 -1
- package/source/components/layout/stylesheet/panel.mjs +1 -1
- package/source/components/layout/stylesheet/slider.mjs +31 -0
- package/source/components/layout/stylesheet/tabs.mjs +1 -1
- package/source/components/navigation/stylesheet/table-of-content.mjs +14 -7
- package/source/components/navigation/table-of-content.mjs +22 -17
- package/source/components/notify/stylesheet/message.mjs +1 -1
- package/source/components/stylesheet/color.mjs +13 -6
- package/source/components/stylesheet/mixin/property.mjs +13 -6
- package/source/components/stylesheet/property.mjs +1 -1
- package/source/components/tree-menu/stylesheet/tree-menu.mjs +1 -1
- package/source/components/tree-menu/tree-menu.mjs +23 -5
- package/source/data/buildtree.mjs +63 -63
- package/source/data/datasource/server/restapi.mjs +1 -2
- package/source/data/pathfinder.mjs +22 -19
- package/source/dom/events.mjs +1 -1
- package/source/dom/updater.mjs +771 -759
- package/source/text/generate-range-comparison-expression.mjs +1 -1
- package/source/types/base.mjs +1 -1
- package/source/types/id.mjs +1 -1
- package/source/types/node.mjs +141 -142
- package/source/types/observer.mjs +7 -8
- package/source/types/version.mjs +1 -1
- package/test/cases/data/buildmap.mjs +0 -1
- package/test/cases/data/pathfinder.mjs +2 -1
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +240 -190
|
@@ -12,26 +12,26 @@
|
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {instanceSymbol} from "../../constants.mjs";
|
|
15
|
+
import { instanceSymbol } from "../../constants.mjs";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
addAttributeToken,
|
|
18
|
+
removeAttributeToken,
|
|
19
19
|
} from "../../dom/attributes.mjs";
|
|
20
|
-
import {ATTRIBUTE_ROLE} from "../../dom/constants.mjs";
|
|
20
|
+
import { ATTRIBUTE_ROLE } from "../../dom/constants.mjs";
|
|
21
21
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
assembleMethodSymbol,
|
|
23
|
+
CustomElement,
|
|
24
|
+
registerCustomElement,
|
|
25
25
|
} from "../../dom/customelement.mjs";
|
|
26
|
-
import {fireCustomEvent} from "../../dom/events.mjs";
|
|
27
|
-
import {getDocument} from "../../dom/util.mjs";
|
|
28
|
-
import {DeadMansSwitch} from "../../util/deadmansswitch.mjs";
|
|
29
|
-
import {STYLE_DISPLAY_MODE_BLOCK} from "../form/constants.mjs";
|
|
30
|
-
import {positionPopper} from "../form/util/floating-ui.mjs";
|
|
31
|
-
import {PopperStyleSheet} from "./stylesheet/popper.mjs";
|
|
32
|
-
import {isArray} from "../../types/is.mjs";
|
|
26
|
+
import { fireCustomEvent } from "../../dom/events.mjs";
|
|
27
|
+
import { getDocument } from "../../dom/util.mjs";
|
|
28
|
+
import { DeadMansSwitch } from "../../util/deadmansswitch.mjs";
|
|
29
|
+
import { STYLE_DISPLAY_MODE_BLOCK } from "../form/constants.mjs";
|
|
30
|
+
import { positionPopper } from "../form/util/floating-ui.mjs";
|
|
31
|
+
import { PopperStyleSheet } from "./stylesheet/popper.mjs";
|
|
32
|
+
import { isArray } from "../../types/is.mjs";
|
|
33
33
|
|
|
34
|
-
export {Popper};
|
|
34
|
+
export { Popper };
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* @private
|
|
@@ -96,144 +96,144 @@ const arrowElementSymbol = Symbol("arrowElement");
|
|
|
96
96
|
* @fires monster-popper-opened fired when the popper is opened.
|
|
97
97
|
*/
|
|
98
98
|
class Popper extends CustomElement {
|
|
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
|
-
|
|
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
|
-
|
|
99
|
+
/**
|
|
100
|
+
* This method is called by the `instanceof` operator.
|
|
101
|
+
* @returns {symbol}
|
|
102
|
+
*/
|
|
103
|
+
static get [instanceSymbol]() {
|
|
104
|
+
return Symbol.for("@schukai/monster/components/layout/popper@@instance");
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* To set the options via the html tag the attribute `data-monster-options` must be used.
|
|
109
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
|
110
|
+
*
|
|
111
|
+
* The individual configuration values can be found in the table.
|
|
112
|
+
*
|
|
113
|
+
* @property {Object} templates The templates for the control.
|
|
114
|
+
* @property {string} templates.main The main template.
|
|
115
|
+
* @property {string} mode The mode of the popper. Possible values are `click`, `enter`, `manual`, `focus`, "auto" or a combination of them.
|
|
116
|
+
* @property {string} content The content of the popper.
|
|
117
|
+
* @property {object} popper The popper options.
|
|
118
|
+
* @property {string} popper.placement The placement of the popper. Possible values are `top`, `bottom`, `left` and `right`.
|
|
119
|
+
* @property {function[]} popper.middleware The middleware functions of the popper.
|
|
120
|
+
* @property {Object} features The features of the popper.
|
|
121
|
+
* @property {boolean} features.preventOpenEventSent Prevents the open event from being sent.
|
|
122
|
+
*/
|
|
123
|
+
get defaults() {
|
|
124
|
+
return Object.assign({}, super.defaults, {
|
|
125
|
+
templates: {
|
|
126
|
+
main: getTemplate(),
|
|
127
|
+
},
|
|
128
|
+
mode: "auto focus",
|
|
129
|
+
content: "<slot></slot>",
|
|
130
|
+
popper: {
|
|
131
|
+
placement: "top",
|
|
132
|
+
middleware: ["autoPlacement", "shift", "offset:15", "arrow"],
|
|
133
|
+
},
|
|
134
|
+
features: {
|
|
135
|
+
preventOpenEventSent: false,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* This method is called by the `connectedCallback` method on the first call.
|
|
142
|
+
*
|
|
143
|
+
* @return {Void}
|
|
144
|
+
*/
|
|
145
|
+
[assembleMethodSymbol]() {
|
|
146
|
+
super[assembleMethodSymbol]();
|
|
147
|
+
initControlReferences.call(this);
|
|
148
|
+
initEventHandler.call(this);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* This method returns the tag name of the element.
|
|
153
|
+
*
|
|
154
|
+
* @return {string}
|
|
155
|
+
*/
|
|
156
|
+
static getTag() {
|
|
157
|
+
return "monster-popper";
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* This method returns the css styles of the element.
|
|
162
|
+
*
|
|
163
|
+
* @return {CSSStyleSheet[]}
|
|
164
|
+
*/
|
|
165
|
+
static getCSSStyleSheet() {
|
|
166
|
+
return [PopperStyleSheet];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* This method is called when the element is connected to the dom.
|
|
171
|
+
*
|
|
172
|
+
* @return {void}
|
|
173
|
+
*/
|
|
174
|
+
connectedCallback() {
|
|
175
|
+
super.connectedCallback();
|
|
176
|
+
|
|
177
|
+
const document = getDocument();
|
|
178
|
+
|
|
179
|
+
for (const [, type] of Object.entries(["click", "touch"])) {
|
|
180
|
+
// close on outside ui-events
|
|
181
|
+
document.addEventListener(type, this[closeEventHandler]);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
updatePopper.call(this);
|
|
185
|
+
attachResizeObserver.call(this);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* This method is called when the element is disconnected from the dom.
|
|
190
|
+
*
|
|
191
|
+
* @return {void}
|
|
192
|
+
*/
|
|
193
|
+
disconnectedCallback() {
|
|
194
|
+
super.disconnectedCallback();
|
|
195
|
+
|
|
196
|
+
// close on outside ui-events
|
|
197
|
+
for (const [, type] of Object.entries(["click", "touch"])) {
|
|
198
|
+
document.removeEventListener(type, this[closeEventHandler]);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
disconnectResizeObserver.call(this);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* With this method you can show the popper.
|
|
206
|
+
*
|
|
207
|
+
* @return {Popper}
|
|
208
|
+
*/
|
|
209
|
+
showDialog() {
|
|
210
|
+
show.call(this);
|
|
211
|
+
return this;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* With this method you can hide the popper.
|
|
216
|
+
*
|
|
217
|
+
* @return {Popper}
|
|
218
|
+
*/
|
|
219
|
+
hideDialog() {
|
|
220
|
+
hide.call(this);
|
|
221
|
+
return this;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* With this method you can toggle the popper.
|
|
226
|
+
*
|
|
227
|
+
* @return {Popper}
|
|
228
|
+
*/
|
|
229
|
+
toggleDialog() {
|
|
230
|
+
if (this[popperElementSymbol].style.display === STYLE_DISPLAY_MODE_BLOCK) {
|
|
231
|
+
this.hideDialog();
|
|
232
|
+
} else {
|
|
233
|
+
this.showDialog();
|
|
234
|
+
}
|
|
235
|
+
return this;
|
|
236
|
+
}
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
/**
|
|
@@ -241,38 +241,38 @@ class Popper extends CustomElement {
|
|
|
241
241
|
* @return {Popper}
|
|
242
242
|
*/
|
|
243
243
|
function initEventHandler() {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
244
|
+
this[closeEventHandler] = (event) => {
|
|
245
|
+
const path = event.composedPath();
|
|
246
|
+
|
|
247
|
+
for (const [, element] of Object.entries(path)) {
|
|
248
|
+
if (element === this) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
hide.call(this);
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
let modes = null;
|
|
256
|
+
const modeOption = this.getOption("mode");
|
|
257
|
+
|
|
258
|
+
if (typeof modeOption === "string") {
|
|
259
|
+
modes = modeOption.split(" ");
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (
|
|
263
|
+
modes === null ||
|
|
264
|
+
modes === undefined ||
|
|
265
|
+
isArray(modes) === false ||
|
|
266
|
+
modes.length === 0
|
|
267
|
+
) {
|
|
268
|
+
modes = ["manual"];
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
for (const [, mode] of Object.entries(modes)) {
|
|
272
|
+
initEventHandlerByMode.call(this, mode);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return this;
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
/**
|
|
@@ -282,159 +282,159 @@ function initEventHandler() {
|
|
|
282
282
|
* @throws Error
|
|
283
283
|
*/
|
|
284
284
|
function initEventHandlerByMode(mode) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
285
|
+
switch (mode) {
|
|
286
|
+
case "manual":
|
|
287
|
+
break;
|
|
288
|
+
|
|
289
|
+
case "focus":
|
|
290
|
+
this[buttonElementSymbol].addEventListener("focus", (event) => {
|
|
291
|
+
if (this.getOption("features.preventOpenEventSent") === true) {
|
|
292
|
+
event.preventDefault();
|
|
293
|
+
}
|
|
294
|
+
this.showDialog();
|
|
295
|
+
});
|
|
296
|
+
this[buttonElementSymbol].addEventListener("blur", (event) => {
|
|
297
|
+
if (this.getOption("features.preventOpenEventSent") === true) {
|
|
298
|
+
event.preventDefault();
|
|
299
|
+
}
|
|
300
|
+
this.hideDialog();
|
|
301
|
+
});
|
|
302
|
+
break;
|
|
303
|
+
|
|
304
|
+
case "click":
|
|
305
|
+
this[buttonElementSymbol].addEventListener("click", (event) => {
|
|
306
|
+
if (this.getOption("features.preventOpenEventSent") === true) {
|
|
307
|
+
event.preventDefault();
|
|
308
|
+
}
|
|
309
|
+
this.toggleDialog();
|
|
310
|
+
});
|
|
311
|
+
break;
|
|
312
|
+
case "enter":
|
|
313
|
+
this[buttonElementSymbol].addEventListener("mouseenter", (event) => {
|
|
314
|
+
if (this.getOption("features.preventOpenEventSent") === true) {
|
|
315
|
+
event.preventDefault();
|
|
316
|
+
}
|
|
317
|
+
this.showDialog();
|
|
318
|
+
});
|
|
319
|
+
break;
|
|
320
|
+
|
|
321
|
+
case "auto": // is hover
|
|
322
|
+
this[buttonElementSymbol].addEventListener("mouseenter", (event) => {
|
|
323
|
+
if (this.getOption("features.preventOpenEventSent") === true) {
|
|
324
|
+
event.preventDefault();
|
|
325
|
+
}
|
|
326
|
+
this.showDialog();
|
|
327
|
+
});
|
|
328
|
+
this[buttonElementSymbol].addEventListener("mouseleave", (event) => {
|
|
329
|
+
if (this.getOption("features.preventOpenEventSent") === true) {
|
|
330
|
+
event.preventDefault();
|
|
331
|
+
}
|
|
332
|
+
this.hideDialog();
|
|
333
|
+
});
|
|
334
|
+
break;
|
|
335
|
+
default:
|
|
336
|
+
throw new Error(`Unknown mode ${mode}`);
|
|
337
|
+
}
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
/**
|
|
341
341
|
* @private
|
|
342
342
|
*/
|
|
343
343
|
function attachResizeObserver() {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
344
|
+
// against flickering
|
|
345
|
+
this[resizeObserverSymbol] = new ResizeObserver((entries) => {
|
|
346
|
+
if (this[timerCallbackSymbol] instanceof DeadMansSwitch) {
|
|
347
|
+
try {
|
|
348
|
+
this[timerCallbackSymbol].touch();
|
|
349
|
+
return;
|
|
350
|
+
} catch (e) {
|
|
351
|
+
delete this[timerCallbackSymbol];
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
this[timerCallbackSymbol] = new DeadMansSwitch(200, () => {
|
|
356
|
+
updatePopper.call(this);
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
this[resizeObserverSymbol].observe(this.parentElement);
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
function disconnectResizeObserver() {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
if (this[resizeObserverSymbol] instanceof ResizeObserver) {
|
|
365
|
+
this[resizeObserverSymbol].disconnect();
|
|
366
|
+
}
|
|
367
367
|
}
|
|
368
368
|
|
|
369
369
|
/**
|
|
370
370
|
* @private
|
|
371
371
|
*/
|
|
372
372
|
function hide() {
|
|
373
|
-
|
|
373
|
+
const self = this;
|
|
374
374
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
375
|
+
fireCustomEvent(self, "monster-popper-hide", {
|
|
376
|
+
self,
|
|
377
|
+
});
|
|
378
378
|
|
|
379
|
-
|
|
380
|
-
|
|
379
|
+
self[popperElementSymbol].style.display = "none";
|
|
380
|
+
removeAttributeToken(self[controlElementSymbol], "class", "open");
|
|
381
381
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
382
|
+
setTimeout(() => {
|
|
383
|
+
fireCustomEvent(self, "monster-popper-hidden", {
|
|
384
|
+
self,
|
|
385
|
+
});
|
|
386
|
+
}, 0);
|
|
387
387
|
}
|
|
388
388
|
|
|
389
389
|
/**
|
|
390
390
|
* @private
|
|
391
391
|
*/
|
|
392
392
|
function show() {
|
|
393
|
-
|
|
393
|
+
const self = this;
|
|
394
394
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
395
|
+
if (self.getOption("disabled", false) === true) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
398
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
399
|
+
if (self[popperElementSymbol].style.display === STYLE_DISPLAY_MODE_BLOCK) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
402
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
403
|
+
fireCustomEvent(self, "monster-popper-open", {
|
|
404
|
+
self,
|
|
405
|
+
});
|
|
406
406
|
|
|
407
|
-
|
|
408
|
-
|
|
407
|
+
self[popperElementSymbol].style.visibility = "hidden";
|
|
408
|
+
self[popperElementSymbol].style.display = STYLE_DISPLAY_MODE_BLOCK;
|
|
409
409
|
|
|
410
|
-
|
|
411
|
-
|
|
410
|
+
addAttributeToken(self[controlElementSymbol], "class", "open");
|
|
411
|
+
updatePopper.call(self);
|
|
412
412
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
413
|
+
setTimeout(() => {
|
|
414
|
+
fireCustomEvent(self, "monster-popper-opened", {
|
|
415
|
+
self,
|
|
416
|
+
});
|
|
417
|
+
}, 0);
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
/**
|
|
421
421
|
* @private
|
|
422
422
|
*/
|
|
423
423
|
function updatePopper() {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
424
|
+
if (this[popperElementSymbol].style.display !== STYLE_DISPLAY_MODE_BLOCK) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
if (this.getOption("disabled", false) === true) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
positionPopper.call(
|
|
433
|
+
this,
|
|
434
|
+
this[controlElementSymbol],
|
|
435
|
+
this[popperElementSymbol],
|
|
436
|
+
this.getOption("popper", {}),
|
|
437
|
+
);
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
/**
|
|
@@ -442,19 +442,19 @@ function updatePopper() {
|
|
|
442
442
|
* @return {Popper}
|
|
443
443
|
*/
|
|
444
444
|
function initControlReferences() {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
445
|
+
this[controlElementSymbol] = this.shadowRoot.querySelector(
|
|
446
|
+
`[${ATTRIBUTE_ROLE}=control]`,
|
|
447
|
+
);
|
|
448
|
+
this[buttonElementSymbol] = this.shadowRoot.querySelector(
|
|
449
|
+
`[${ATTRIBUTE_ROLE}=button]`,
|
|
450
|
+
);
|
|
451
|
+
this[popperElementSymbol] = this.shadowRoot.querySelector(
|
|
452
|
+
`[${ATTRIBUTE_ROLE}=popper]`,
|
|
453
|
+
);
|
|
454
|
+
this[arrowElementSymbol] = this.shadowRoot.querySelector(
|
|
455
|
+
`[${ATTRIBUTE_ROLE}=arrow]`,
|
|
456
|
+
);
|
|
457
|
+
return this;
|
|
458
458
|
}
|
|
459
459
|
|
|
460
460
|
/**
|
|
@@ -462,8 +462,8 @@ function initControlReferences() {
|
|
|
462
462
|
* @return {string}
|
|
463
463
|
*/
|
|
464
464
|
function getTemplate() {
|
|
465
|
-
|
|
466
|
-
|
|
465
|
+
// language=HTML
|
|
466
|
+
return `
|
|
467
467
|
<div data-monster-role="control" part="control">
|
|
468
468
|
<slot name="button" data-monster-role="button"></slot>
|
|
469
469
|
|