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