@tillsc/progressive-web-components 0.1.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/README.md +30 -0
- package/dist/all-bs5.js +783 -0
- package/dist/all.js +763 -0
- package/dist/dialog-opener-bs5.js +484 -0
- package/dist/dialog-opener.js +467 -0
- package/dist/modal-dialog-bs5.js +259 -0
- package/dist/modal-dialog.js +251 -0
- package/dist/multiselect-dual-list-bs5.js +368 -0
- package/dist/multiselect-dual-list.js +365 -0
- package/package.json +35 -0
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
// src/core/utils.js
|
|
2
|
+
function defineOnce(name, classDef) {
|
|
3
|
+
if (customElements.get(name)) return;
|
|
4
|
+
customElements.define(name, classDef);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// src/core/pwc-element.js
|
|
8
|
+
var PwcElement = class extends HTMLElement {
|
|
9
|
+
/**
|
|
10
|
+
* List of DOM event types to bind on the host element.
|
|
11
|
+
* Subclasses may override.
|
|
12
|
+
*
|
|
13
|
+
* Example:
|
|
14
|
+
* static events = ["click", "input"];
|
|
15
|
+
*/
|
|
16
|
+
static events = [];
|
|
17
|
+
static registerCss(cssText) {
|
|
18
|
+
const sheet = new CSSStyleSheet();
|
|
19
|
+
sheet.replaceSync(cssText);
|
|
20
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
if (this._connected) return;
|
|
24
|
+
this._connected = true;
|
|
25
|
+
this._bindEvents();
|
|
26
|
+
}
|
|
27
|
+
disconnectedCallback() {
|
|
28
|
+
if (!this._connected) return;
|
|
29
|
+
this._connected = false;
|
|
30
|
+
this._unbindEvents();
|
|
31
|
+
this.onDisconnect();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Optional cleanup hook for subclasses.
|
|
35
|
+
*/
|
|
36
|
+
onDisconnect() {
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Bind declared events using the handleEvent pattern.
|
|
40
|
+
*/
|
|
41
|
+
_bindEvents() {
|
|
42
|
+
const events = this.constructor.events ?? [];
|
|
43
|
+
for (const type of events) {
|
|
44
|
+
this.addEventListener(type, this);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Unbind all previously declared events.
|
|
49
|
+
*/
|
|
50
|
+
_unbindEvents() {
|
|
51
|
+
const events = this.constructor.events ?? [];
|
|
52
|
+
for (const type of events) {
|
|
53
|
+
this.removeEventListener(type, this);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Default event handler.
|
|
58
|
+
* Subclasses are expected to override this method
|
|
59
|
+
* and route events as needed.
|
|
60
|
+
*/
|
|
61
|
+
handleEvent(_event) {
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// src/dialog-opener/base.js
|
|
66
|
+
var BaseDialogOpener = class extends PwcElement {
|
|
67
|
+
static events = ["click"];
|
|
68
|
+
handleEvent(e) {
|
|
69
|
+
if (e.type !== "click") return;
|
|
70
|
+
if (e.defaultPrevented) return;
|
|
71
|
+
const link = e.target.closest("a");
|
|
72
|
+
if (!link || !this.contains(link)) return;
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
if (this.hasAttribute("local-reload") && !this.id) {
|
|
75
|
+
console.warn("<pwc-dialog-opener> has local-reload attribute but no id", this);
|
|
76
|
+
}
|
|
77
|
+
const href = link.getAttribute("href");
|
|
78
|
+
if (!href) return;
|
|
79
|
+
this.open(href);
|
|
80
|
+
}
|
|
81
|
+
open(href) {
|
|
82
|
+
const src = this.prepareIFrameLink(href);
|
|
83
|
+
this.findOrCreateDialog(src);
|
|
84
|
+
this.enhanceIFrame().then(() => this.modal.show());
|
|
85
|
+
}
|
|
86
|
+
prepareIFrameLink(src) {
|
|
87
|
+
const s = new URL(src, document.location.href);
|
|
88
|
+
const defaultValues = [...this.querySelectorAll("input")].map((input) => {
|
|
89
|
+
if (input.value) return input.value;
|
|
90
|
+
return null;
|
|
91
|
+
}).filter((item) => item !== null);
|
|
92
|
+
if (defaultValues.length > 0) {
|
|
93
|
+
s.searchParams.set("default", defaultValues.join(","));
|
|
94
|
+
}
|
|
95
|
+
s.searchParams.set("_layout", false);
|
|
96
|
+
return s.toString();
|
|
97
|
+
}
|
|
98
|
+
// Variant hook: must set this.dialog and this.modal
|
|
99
|
+
// eslint-disable-next-line no-unused-vars
|
|
100
|
+
findOrCreateDialog(_src) {
|
|
101
|
+
throw new Error("BaseDialogOpener: findOrCreateDialog(src) must be implemented by a variant");
|
|
102
|
+
}
|
|
103
|
+
createIFrame(src) {
|
|
104
|
+
const iframe = document.createElement("iframe");
|
|
105
|
+
iframe.src = src;
|
|
106
|
+
iframe.style.width = "100%";
|
|
107
|
+
iframe.style.height = getComputedStyle(this).getPropertyValue("--pwc-dialog-opener-height").trim() || "550px";
|
|
108
|
+
iframe.style.display = "none";
|
|
109
|
+
return iframe;
|
|
110
|
+
}
|
|
111
|
+
enhanceIFrame() {
|
|
112
|
+
this.iframe = this.dialog.querySelector("iframe");
|
|
113
|
+
return new Promise((resolve) => {
|
|
114
|
+
this.iframe.addEventListener(
|
|
115
|
+
"load",
|
|
116
|
+
(e) => this.iFrameLoad(e).then(resolve)
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
async iFrameLoad(_e) {
|
|
121
|
+
let uri;
|
|
122
|
+
try {
|
|
123
|
+
uri = new URL(this.iframe.contentWindow.location);
|
|
124
|
+
} catch (e) {
|
|
125
|
+
throw new Error(`<pwc-dialog-opener> cannot access iframe location (cross-origin?): ${e.message}`);
|
|
126
|
+
}
|
|
127
|
+
if (uri.searchParams.has("dialog_finished_with")) {
|
|
128
|
+
this.modal.hide();
|
|
129
|
+
uri.searchParams.delete("_layout");
|
|
130
|
+
uri.searchParams.set("dummy", Math.floor(Math.random() * 1e5));
|
|
131
|
+
const localReloadWorked = await this.tryLocalReload(uri);
|
|
132
|
+
if (!localReloadWorked) {
|
|
133
|
+
window.location.href = uri.toString();
|
|
134
|
+
}
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
this.moveElementsToOuterActions();
|
|
138
|
+
this.iframe.style.display = "unset";
|
|
139
|
+
}
|
|
140
|
+
async tryLocalReload(newUri) {
|
|
141
|
+
const currentUri = new URL(window.location.href);
|
|
142
|
+
if (currentUri.hostname !== newUri.hostname || currentUri.pathname !== newUri.pathname || currentUri.protocol !== newUri.protocol) {
|
|
143
|
+
console.log(`<dialog-opener> Warning: local-reload got different base uri (${newUri.toString()}) then window has (${currentUri.toString()}). This might lead to problems, but we'll try it anyway.`);
|
|
144
|
+
}
|
|
145
|
+
if (this.hasAttribute("local-reload") && this.id) {
|
|
146
|
+
const localReloadOptionTokens = document.createElement("div").classList;
|
|
147
|
+
if (this.hasAttribute("local-reload")) localReloadOptionTokens.add(...this.getAttribute("local-reload").split(/\s+/));
|
|
148
|
+
const localReloadOptions = {
|
|
149
|
+
replaceUrl: localReloadOptionTokens.contains("replace-url"),
|
|
150
|
+
pushUrl: localReloadOptionTokens.contains("push-url"),
|
|
151
|
+
withScripts: localReloadOptionTokens.contains("with-scripts")
|
|
152
|
+
};
|
|
153
|
+
newUri.searchParams.set("local_reload", this.id);
|
|
154
|
+
const res = await fetch(newUri);
|
|
155
|
+
if (res.ok) {
|
|
156
|
+
const html = await res.text();
|
|
157
|
+
const newDocument = new DOMParser().parseFromString(html, "text/html");
|
|
158
|
+
const fragment = newDocument.getElementById(this.id);
|
|
159
|
+
if (fragment) {
|
|
160
|
+
this.replaceChildren(...fragment.childNodes);
|
|
161
|
+
if (localReloadOptions.replaceUrl || localReloadOptions.pushUrl) {
|
|
162
|
+
if (localReloadOptions.pushUrl) {
|
|
163
|
+
history.pushState(null, "", newUri);
|
|
164
|
+
} else if (localReloadOptions.replaceUrl) {
|
|
165
|
+
history.replaceState(null, "", newUri);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (localReloadOptions.withScripts) {
|
|
169
|
+
this.executeInlineScripts(this);
|
|
170
|
+
}
|
|
171
|
+
this.dispatchEvent(
|
|
172
|
+
new CustomEvent("pwc-dialog-opener:local-reload", {
|
|
173
|
+
bubbles: true,
|
|
174
|
+
detail: { url: newUri.toString() }
|
|
175
|
+
})
|
|
176
|
+
);
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
console.log("local-reload not possible, falling back to full reload");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
executeInlineScripts(root) {
|
|
185
|
+
console.log("Executing inline scripts in local-reload fragment", root);
|
|
186
|
+
const scripts = Array.from(root.querySelectorAll("script"));
|
|
187
|
+
for (const old of scripts) {
|
|
188
|
+
if (old.src) {
|
|
189
|
+
console.warn("Ignoring external script in local-reload fragment:", old.src);
|
|
190
|
+
old.remove();
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const s = document.createElement("script");
|
|
194
|
+
if (old.type) s.type = old.type;
|
|
195
|
+
if (old.noModule) s.noModule = true;
|
|
196
|
+
s.textContent = old.textContent || "";
|
|
197
|
+
old.replaceWith(s);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
moveElementsToOuterActions() {
|
|
201
|
+
if (!this.getAttribute("move-out")) return;
|
|
202
|
+
const iframeDoc = this.iframe.contentWindow.document;
|
|
203
|
+
if (!iframeDoc) return;
|
|
204
|
+
let buttonContainer = this.dialog.querySelector("dialog-opener-buttons");
|
|
205
|
+
if (!buttonContainer) {
|
|
206
|
+
buttonContainer = document.createElement("dialog-opener-buttons");
|
|
207
|
+
this.dialog.querySelector(".pwc-dialog-opener-actions").prepend(buttonContainer);
|
|
208
|
+
} else {
|
|
209
|
+
buttonContainer.innerHTML = "";
|
|
210
|
+
}
|
|
211
|
+
const elements = iframeDoc.querySelectorAll(this._moveOutSelector());
|
|
212
|
+
for (let i = 0; i < elements.length; i++) {
|
|
213
|
+
const btn = elements[i];
|
|
214
|
+
const outerBtn = document.createElement(btn.tagName);
|
|
215
|
+
for (const attr of btn.attributes) {
|
|
216
|
+
outerBtn.setAttribute(attr.name, attr.value);
|
|
217
|
+
}
|
|
218
|
+
outerBtn.innerHTML = btn.innerHTML;
|
|
219
|
+
outerBtn.addEventListener("click", () => {
|
|
220
|
+
this.iframe.style.display = "none";
|
|
221
|
+
btn.click();
|
|
222
|
+
});
|
|
223
|
+
buttonContainer.append(outerBtn);
|
|
224
|
+
btn.style.visibility = "hidden";
|
|
225
|
+
btn.style.display = "none";
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
_moveOutSelector() {
|
|
229
|
+
let selector = this.getAttribute("move-out");
|
|
230
|
+
if (selector === "submit") {
|
|
231
|
+
selector = "button[type=submit], input[type=submit]";
|
|
232
|
+
}
|
|
233
|
+
return selector;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// src/dialog-opener/bs5/dialog-opener.js
|
|
238
|
+
var PwcDialogOpenerBs5 = class extends BaseDialogOpener {
|
|
239
|
+
findOrCreateDialog(src) {
|
|
240
|
+
const tag = "pwc-modal-dialog-bs5";
|
|
241
|
+
if (!this.dialog) {
|
|
242
|
+
this.dialog = this.querySelector(tag) || document.createElement(tag);
|
|
243
|
+
if (!this.dialog.isConnected) {
|
|
244
|
+
this.appendChild(this.dialog);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
this.dialog.open({
|
|
248
|
+
title: this.getAttribute("title") || "",
|
|
249
|
+
size: this.getAttribute("size") || "lg",
|
|
250
|
+
closeText: this.getAttribute("close") || "Close",
|
|
251
|
+
showClose: false,
|
|
252
|
+
backdrop: true,
|
|
253
|
+
keyboard: true,
|
|
254
|
+
focus: true
|
|
255
|
+
});
|
|
256
|
+
const closeText = this.getAttribute("close") || "Close";
|
|
257
|
+
this.dialog.footerEl.innerHTML = `
|
|
258
|
+
<div class="pwc-dialog-opener-actions">
|
|
259
|
+
<button type="button" class="btn btn-secondary" data-pwc-action="close" aria-label="${closeText}">
|
|
260
|
+
${closeText}
|
|
261
|
+
</button>
|
|
262
|
+
</div>
|
|
263
|
+
`;
|
|
264
|
+
const body = this.dialog.bodyEl;
|
|
265
|
+
body.replaceChildren(this.createIFrame(src));
|
|
266
|
+
this.modal = {
|
|
267
|
+
show: () => {
|
|
268
|
+
},
|
|
269
|
+
hide: () => this.dialog.close()
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
_moveOutSelector() {
|
|
273
|
+
let selector = super._moveOutSelector();
|
|
274
|
+
if (selector === "primary") {
|
|
275
|
+
selector = ".btn-primary[type=submit]";
|
|
276
|
+
}
|
|
277
|
+
return selector;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
function define() {
|
|
281
|
+
defineOnce("pwc-dialog-opener-bs5", PwcDialogOpenerBs5);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// src/core/pwc-simple-init-element.js
|
|
285
|
+
var PwcSimpleInitElement = class extends PwcElement {
|
|
286
|
+
connectedCallback() {
|
|
287
|
+
if (this._connected) return;
|
|
288
|
+
super.connectedCallback();
|
|
289
|
+
queueMicrotask(() => {
|
|
290
|
+
if (!this._connected) return;
|
|
291
|
+
this.onConnect();
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Hook for subclasses.
|
|
296
|
+
* Called once per connection, after microtask deferral.
|
|
297
|
+
*/
|
|
298
|
+
onConnect() {
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
// src/modal-dialog/base.js
|
|
303
|
+
var ModalDialogBase = class extends PwcSimpleInitElement {
|
|
304
|
+
static events = ["click"];
|
|
305
|
+
onDisconnect() {
|
|
306
|
+
this._teardown();
|
|
307
|
+
}
|
|
308
|
+
get ui() {
|
|
309
|
+
if (!this._ui) throw new Error("ui is only available after open()");
|
|
310
|
+
return this._ui;
|
|
311
|
+
}
|
|
312
|
+
get rootEl() {
|
|
313
|
+
return this.ui.rootEl;
|
|
314
|
+
}
|
|
315
|
+
get bodyEl() {
|
|
316
|
+
return this.ui.bodyEl;
|
|
317
|
+
}
|
|
318
|
+
get headerEl() {
|
|
319
|
+
return this.ui.headerEl;
|
|
320
|
+
}
|
|
321
|
+
get footerEl() {
|
|
322
|
+
return this.ui.footerEl;
|
|
323
|
+
}
|
|
324
|
+
isOpen() {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
open({ title = "", size = "lg", closeText = "Close", ...options }) {
|
|
328
|
+
if (!this.isConnected) {
|
|
329
|
+
this._autoRemove = true;
|
|
330
|
+
document.body.appendChild(this);
|
|
331
|
+
}
|
|
332
|
+
this._teardown();
|
|
333
|
+
const ui = this._render({ title, size, closeText, ...options });
|
|
334
|
+
this._ui = ui;
|
|
335
|
+
const parent = this._getOpenSibling();
|
|
336
|
+
this._parent = parent && parent !== ui.rootEl ? parent : null;
|
|
337
|
+
this._closed = false;
|
|
338
|
+
this._armFinalClose(ui, () => this._onFinalClose());
|
|
339
|
+
if (this._parent) {
|
|
340
|
+
this._parent.dataset.closeReason = "suspend";
|
|
341
|
+
this._suspend(this._parent);
|
|
342
|
+
}
|
|
343
|
+
this._show(ui, { title, size, closeText, ...options });
|
|
344
|
+
}
|
|
345
|
+
close() {
|
|
346
|
+
if (this._closed) return;
|
|
347
|
+
this._closed = true;
|
|
348
|
+
this.dataset.closeReason = "final";
|
|
349
|
+
this._hide(this._ui);
|
|
350
|
+
}
|
|
351
|
+
_onFinalClose() {
|
|
352
|
+
this._closed = true;
|
|
353
|
+
delete this.dataset.closeReason;
|
|
354
|
+
const parent = this._parent;
|
|
355
|
+
this._parent = null;
|
|
356
|
+
this._teardown();
|
|
357
|
+
if (parent && parent.isConnected) {
|
|
358
|
+
delete parent.dataset.closeReason;
|
|
359
|
+
queueMicrotask(() => this._restore(parent));
|
|
360
|
+
}
|
|
361
|
+
if (this._autoRemove && this.isConnected) this.remove();
|
|
362
|
+
}
|
|
363
|
+
handleEvent(e) {
|
|
364
|
+
if (e.type !== "click") return;
|
|
365
|
+
if (e.defaultPrevented) return;
|
|
366
|
+
const ui = this._ui;
|
|
367
|
+
if (!ui?.rootEl) return;
|
|
368
|
+
if (e.target === ui.rootEl) {
|
|
369
|
+
this.close();
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
const closeEl = e.target.closest('[data-pwc-action="close"]');
|
|
373
|
+
if (!closeEl || !this.contains(closeEl)) return;
|
|
374
|
+
this.close();
|
|
375
|
+
}
|
|
376
|
+
_teardown() {
|
|
377
|
+
const ui = this._ui;
|
|
378
|
+
this._ui = null;
|
|
379
|
+
ui?.teardown?.();
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
// src/modal-dialog/bs5/modal-dialog.js
|
|
384
|
+
var PwcModalDialogBs5 = class extends ModalDialogBase {
|
|
385
|
+
static events = ["click", "hidden.bs.modal"];
|
|
386
|
+
onConnect() {
|
|
387
|
+
this.classList.add("modal", "fade");
|
|
388
|
+
this.tabIndex = -1;
|
|
389
|
+
this.setAttribute("aria-hidden", "true");
|
|
390
|
+
}
|
|
391
|
+
isOpen() {
|
|
392
|
+
return this.classList.contains("show");
|
|
393
|
+
}
|
|
394
|
+
requireBsModal() {
|
|
395
|
+
const BsModal = globalThis.bootstrap?.Modal;
|
|
396
|
+
if (!BsModal) throw new Error("Bootstrap Modal required (globalThis.bootstrap.Modal)");
|
|
397
|
+
return BsModal;
|
|
398
|
+
}
|
|
399
|
+
_render({ title, size, closeText, showClose = true }) {
|
|
400
|
+
this.innerHTML = `
|
|
401
|
+
<div class="modal-dialog modal-dialog-centered modal-${size}">
|
|
402
|
+
<div class="modal-content">
|
|
403
|
+
<div class="modal-header">
|
|
404
|
+
<h3 class="modal-title"></h3>
|
|
405
|
+
</div>
|
|
406
|
+
<div class="modal-body"></div>
|
|
407
|
+
<div class="modal-footer"></div>
|
|
408
|
+
</div>
|
|
409
|
+
</div>
|
|
410
|
+
`;
|
|
411
|
+
this.querySelector(".modal-title").textContent = title;
|
|
412
|
+
if (showClose) {
|
|
413
|
+
const btn = document.createElement("button");
|
|
414
|
+
btn.type = "button";
|
|
415
|
+
btn.className = "btn-close";
|
|
416
|
+
btn.setAttribute("aria-label", closeText);
|
|
417
|
+
btn.setAttribute("data-pwc-action", "close");
|
|
418
|
+
this.querySelector(".modal-header").appendChild(btn);
|
|
419
|
+
}
|
|
420
|
+
return {
|
|
421
|
+
rootEl: this,
|
|
422
|
+
bodyEl: this.querySelector(".modal-body"),
|
|
423
|
+
headerEl: this.querySelector(".modal-header"),
|
|
424
|
+
footerEl: this.querySelector(".modal-footer"),
|
|
425
|
+
modal: null,
|
|
426
|
+
teardown: () => {
|
|
427
|
+
const BsModal = this.requireBsModal();
|
|
428
|
+
BsModal.getInstance(this)?.dispose();
|
|
429
|
+
this.innerHTML = "";
|
|
430
|
+
this._finalClose = null;
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
_getOpenSibling() {
|
|
435
|
+
const el = document.querySelector(".modal.show");
|
|
436
|
+
if (el === this) return null;
|
|
437
|
+
return el;
|
|
438
|
+
}
|
|
439
|
+
_suspend(el) {
|
|
440
|
+
const BsModal = this.requireBsModal();
|
|
441
|
+
BsModal.getOrCreateInstance(el).hide();
|
|
442
|
+
}
|
|
443
|
+
_restore(el) {
|
|
444
|
+
const BsModal = this.requireBsModal();
|
|
445
|
+
BsModal.getOrCreateInstance(el).show();
|
|
446
|
+
}
|
|
447
|
+
_show(ui, { backdrop = true, keyboard = true, focus = true } = {}) {
|
|
448
|
+
const BsModal = this.requireBsModal();
|
|
449
|
+
ui.modal = BsModal.getOrCreateInstance(this, { backdrop, keyboard, focus });
|
|
450
|
+
ui.modal.show();
|
|
451
|
+
}
|
|
452
|
+
_hide(ui) {
|
|
453
|
+
ui.modal?.hide();
|
|
454
|
+
}
|
|
455
|
+
_armFinalClose(_ui, onFinalClose) {
|
|
456
|
+
this._finalClose = onFinalClose;
|
|
457
|
+
}
|
|
458
|
+
handleEvent(e) {
|
|
459
|
+
if (e.type === "hidden.bs.modal") {
|
|
460
|
+
if (this.dataset.closeReason === "suspend") return;
|
|
461
|
+
const fn = this._finalClose;
|
|
462
|
+
this._finalClose = null;
|
|
463
|
+
if (typeof fn === "function") fn();
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
super.handleEvent(e);
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
var define2 = () => defineOnce("pwc-modal-dialog-bs5", PwcModalDialogBs5);
|
|
470
|
+
|
|
471
|
+
// src/modal-dialog/bs5/index.js
|
|
472
|
+
function register() {
|
|
473
|
+
define2();
|
|
474
|
+
}
|
|
475
|
+
register();
|
|
476
|
+
|
|
477
|
+
// src/dialog-opener/bs5/index.js
|
|
478
|
+
function register2() {
|
|
479
|
+
define();
|
|
480
|
+
}
|
|
481
|
+
register2();
|
|
482
|
+
export {
|
|
483
|
+
register2 as register
|
|
484
|
+
};
|