@schukai/monster 3.53.0 → 3.55.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 +16 -0
- package/package.json +1 -1
- package/source/components/datatable/datasource/rest.mjs +358 -309
- package/source/components/datatable/datatable/header.mjs +8 -0
- package/source/components/datatable/datatable.mjs +606 -557
- package/source/components/datatable/embedded-pagination.mjs +50 -62
- package/source/components/datatable/filter/util.mjs +122 -0
- package/source/components/datatable/filter.mjs +893 -708
- package/source/components/datatable/pagination.mjs +335 -310
- package/source/components/datatable/status.mjs +248 -0
- package/source/components/datatable/style/datatable.pcss +1 -0
- package/source/components/datatable/style/embedded-pagination.pcss +59 -2
- package/source/components/datatable/style/filter.pcss +4 -0
- package/source/components/datatable/style/pagination.pcss +28 -4
- package/source/components/datatable/style/status.pcss +42 -0
- package/source/components/datatable/stylesheet/column-bar.mjs +1 -1
- package/source/components/datatable/stylesheet/datatable.mjs +1 -1
- package/source/components/datatable/stylesheet/filter-button.mjs +1 -1
- package/source/components/datatable/stylesheet/filter.mjs +1 -1
- package/source/components/datatable/stylesheet/pagination.mjs +1 -1
- package/source/components/datatable/stylesheet/status.mjs +27 -0
- 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 +275 -0
- package/source/components/form/context-help.mjs +5 -5
- package/source/components/form/form.mjs +2 -2
- package/source/components/form/message-state-button.mjs +2 -2
- package/source/components/form/popper-button.mjs +7 -4
- package/source/components/form/popper.mjs +317 -309
- package/source/components/form/reload.mjs +1 -1
- package/source/components/form/select.mjs +9 -3
- package/source/components/form/shadow-reload.mjs +1 -1
- package/source/components/form/state-button.mjs +2 -1
- package/source/components/form/style/context-error.pcss +32 -0
- package/source/components/form/style/context-help.pcss +22 -5
- package/source/components/form/stylesheet/context-error.mjs +27 -0
- package/source/components/form/stylesheet/context-help.mjs +1 -1
- package/source/components/form/stylesheet/select.mjs +1 -1
- package/source/components/form/stylesheet/tabs.mjs +1 -1
- package/source/components/form/tabs.mjs +757 -707
- package/source/components/form/template.mjs +1 -1
- package/source/components/form/tree-select.mjs +1 -1
- package/source/components/host/collapse.mjs +22 -5
- package/source/components/host/config-manager.mjs +39 -2
- package/source/components/host/host.mjs +14 -0
- package/source/components/host/stylesheet/call-button.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/util.mjs +6 -1
- package/source/components/notify/stylesheet/message.mjs +1 -1
- package/source/components/stylesheet/icons.mjs +1 -1
- package/source/data/transformer.mjs +39 -42
- package/source/dom/customelement.mjs +1 -1
- package/source/dom/updater.mjs +700 -688
- package/source/dom/util.mjs +42 -0
- package/source/i18n/providers/embed.mjs +3 -3
- package/source/monster.mjs +6 -0
- package/source/text/formatter.mjs +2 -2
- package/source/types/observer.mjs +1 -1
- package/source/types/version.mjs +1 -1
- package/source/util/sleep.mjs +18 -0
- package/test/cases/components/form/button.mjs +2 -1
- package/test/cases/components/form/select.mjs +1 -1
- package/test/cases/components/form/tree-select.mjs +1 -1
- package/test/cases/data/transformer.mjs +2 -2
- package/test/cases/dom/updater.mjs +67 -46
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +18 -13
|
@@ -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 {
|
|
7
|
+
import {instanceSymbol} from "../../constants.mjs";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
addAttributeToken,
|
|
10
|
+
removeAttributeToken,
|
|
11
11
|
} from "../../dom/attributes.mjs";
|
|
12
|
-
import {
|
|
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 {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
export {
|
|
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,277 +116,285 @@ 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
|
/**
|
|
252
252
|
* @private
|
|
253
253
|
* @return {Monster.Components.Form.Popper}
|
|
254
254
|
*/
|
|
255
|
-
function
|
|
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
|
-
|
|
255
|
+
function initEventHandler() {
|
|
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
|
+
/**
|
|
290
|
+
* @private
|
|
291
|
+
* @param mode
|
|
292
|
+
* @return {Monster.Components.Form.Popper}
|
|
293
|
+
* @throws Error
|
|
294
|
+
*/
|
|
289
295
|
function initEventHandlerByMode(mode) {
|
|
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
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
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
|
+
}
|
|
341
349
|
}
|
|
342
350
|
|
|
343
351
|
/**
|
|
344
352
|
* @private
|
|
345
353
|
*/
|
|
346
354
|
function attachResizeObserver() {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
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);
|
|
364
372
|
}
|
|
365
373
|
|
|
366
374
|
function disconnectResizeObserver() {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
375
|
+
if (this[resizeObserverSymbol] instanceof ResizeObserver) {
|
|
376
|
+
this[resizeObserverSymbol].disconnect();
|
|
377
|
+
}
|
|
370
378
|
}
|
|
371
379
|
|
|
372
380
|
/**
|
|
373
381
|
* @private
|
|
374
382
|
*/
|
|
375
383
|
function hide() {
|
|
376
|
-
|
|
384
|
+
const self = this;
|
|
377
385
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
386
|
+
fireCustomEvent(self, "monster-popper-hide", {
|
|
387
|
+
self,
|
|
388
|
+
});
|
|
381
389
|
|
|
382
|
-
|
|
383
|
-
|
|
390
|
+
self[popperElementSymbol].style.display = "none";
|
|
391
|
+
removeAttributeToken(self[controlElementSymbol], "class", "open");
|
|
384
392
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
393
|
+
setTimeout(() => {
|
|
394
|
+
fireCustomEvent(self, "monster-popper-hidden", {
|
|
395
|
+
self,
|
|
396
|
+
});
|
|
397
|
+
}, 0);
|
|
390
398
|
}
|
|
391
399
|
|
|
392
400
|
/**
|
|
@@ -394,51 +402,51 @@ function hide() {
|
|
|
394
402
|
* @this PopperButton
|
|
395
403
|
*/
|
|
396
404
|
function show() {
|
|
397
|
-
|
|
405
|
+
const self = this;
|
|
398
406
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
407
|
+
if (self.getOption("disabled", false) === true) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
402
410
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
411
|
+
if (self[popperElementSymbol].style.display === STYLE_DISPLAY_MODE_BLOCK) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
406
414
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
415
|
+
fireCustomEvent(self, "monster-popper-open", {
|
|
416
|
+
self,
|
|
417
|
+
});
|
|
410
418
|
|
|
411
|
-
|
|
412
|
-
|
|
419
|
+
self[popperElementSymbol].style.visibility = "hidden";
|
|
420
|
+
self[popperElementSymbol].style.display = STYLE_DISPLAY_MODE_BLOCK;
|
|
413
421
|
|
|
414
|
-
|
|
415
|
-
|
|
422
|
+
addAttributeToken(self[controlElementSymbol], "class", "open");
|
|
423
|
+
updatePopper.call(self);
|
|
416
424
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
425
|
+
setTimeout(() => {
|
|
426
|
+
fireCustomEvent(self, "monster-popper-opened", {
|
|
427
|
+
self,
|
|
428
|
+
});
|
|
429
|
+
}, 0);
|
|
422
430
|
}
|
|
423
431
|
|
|
424
432
|
/**
|
|
425
433
|
* @private
|
|
426
434
|
*/
|
|
427
435
|
function updatePopper() {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
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
|
+
);
|
|
442
450
|
}
|
|
443
451
|
|
|
444
452
|
/**
|
|
@@ -446,19 +454,19 @@ function updatePopper() {
|
|
|
446
454
|
* @return {Monster.Components.Form.Popper}
|
|
447
455
|
*/
|
|
448
456
|
function initControlReferences() {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
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;
|
|
462
470
|
}
|
|
463
471
|
|
|
464
472
|
/**
|
|
@@ -466,8 +474,8 @@ function initControlReferences() {
|
|
|
466
474
|
* @return {string}
|
|
467
475
|
*/
|
|
468
476
|
function getTemplate() {
|
|
469
|
-
|
|
470
|
-
|
|
477
|
+
// language=HTML
|
|
478
|
+
return `
|
|
471
479
|
<div data-monster-role="control" part="control">
|
|
472
480
|
<slot name="button" data-monster-role="button"></slot>
|
|
473
481
|
|