@web-atoms/core 2.2.49 → 2.2.51
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/dist/core/Command.js +1 -1
- package/dist/core/Command.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/web/services/PopupService.d.ts +4 -20
- package/dist/web/services/PopupService.d.ts.map +1 -1
- package/dist/web/services/PopupService.js +6 -224
- package/dist/web/services/PopupService.js.map +1 -1
- package/dist/web/services/PopupWindow.d.ts +45 -0
- package/dist/web/services/PopupWindow.d.ts.map +1 -0
- package/dist/web/services/PopupWindow.js +378 -0
- package/dist/web/services/PopupWindow.js.map +1 -0
- package/package.json +1 -1
- package/src/core/Command.ts +1 -1
- package/src/web/services/PopupService.tsx +350 -346
- package/src/web/services/PopupWindow.tsx +456 -0
|
@@ -13,6 +13,10 @@ import { AtomWindowViewModel } from "../../view-model/AtomWindowViewModel";
|
|
|
13
13
|
import { AtomControl } from "../controls/AtomControl";
|
|
14
14
|
import CSS from "../styles/CSS";
|
|
15
15
|
|
|
16
|
+
import PopupWindowA, { ConfirmPopup } from "./PopupWindow";
|
|
17
|
+
|
|
18
|
+
export const PopupWindow = PopupWindowA;
|
|
19
|
+
|
|
16
20
|
// let lastTarget = null;
|
|
17
21
|
document.body.addEventListener("click", (e) => {
|
|
18
22
|
if ((e.target as HTMLElement).offsetParent) {
|
|
@@ -149,91 +153,91 @@ export interface IDialogOptions {
|
|
|
149
153
|
maximize?: boolean;
|
|
150
154
|
}
|
|
151
155
|
|
|
152
|
-
CSS(StyleRule()
|
|
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
|
-
, "*[data-popup-window=popup-window]");
|
|
156
|
+
// CSS(StyleRule()
|
|
157
|
+
// .position("absolute")
|
|
158
|
+
// .border("solid 1px lightgray")
|
|
159
|
+
// .borderRadius(5)
|
|
160
|
+
// .backgroundColor(Colors.white)
|
|
161
|
+
// .top("50%")
|
|
162
|
+
// .left("50%")
|
|
163
|
+
// .transform("translate(-50%,-50%)" as any)
|
|
164
|
+
// .boxShadow("0 0 20px 1px rgb(0 0 0 / 75%)")
|
|
165
|
+
// .display("grid")
|
|
166
|
+
// .alignItems("center")
|
|
167
|
+
// .justifyItems("center")
|
|
168
|
+
// .gridTemplateRows("auto 1fr")
|
|
169
|
+
// .gridTemplateColumns("1fr")
|
|
170
|
+
// .opacity("0")
|
|
171
|
+
// .transition("opacity 0.3s cubic-bezier(0.55, 0.09, 0.97, 0.32)")
|
|
172
|
+
// .and(StyleRule("[data-ready=true]")
|
|
173
|
+
// .opacity("1")
|
|
174
|
+
// )
|
|
175
|
+
// .and(StyleRule("[data-dragging=true]")
|
|
176
|
+
// .opacity("0.5")
|
|
177
|
+
// )
|
|
178
|
+
// .child(StyleRule(".title")
|
|
179
|
+
// .justifySelf("stretch")
|
|
180
|
+
// .display("flex")
|
|
181
|
+
// .minWidth(0)
|
|
182
|
+
// .backgroundColor(Colors.lightGray.withAlphaPercent(0.2))
|
|
183
|
+
// .padding(5)
|
|
184
|
+
// .alignItems("center")
|
|
185
|
+
// .justifyItems("center")
|
|
186
|
+
// .child(
|
|
187
|
+
// StyleRule(".title-text")
|
|
188
|
+
// .cursor("move")
|
|
189
|
+
// .flexStretch()
|
|
190
|
+
// .textEllipsis()
|
|
191
|
+
// )
|
|
192
|
+
// .child(StyleRule("*")
|
|
193
|
+
// .flex("1 1 100%")
|
|
194
|
+
// )
|
|
195
|
+
// .child(StyleRule(".popup-close-button")
|
|
196
|
+
// .fontFamily("arial")
|
|
197
|
+
// .fontSize(15)
|
|
198
|
+
// .flex("1 0 auto")
|
|
199
|
+
// .cursor("pointer")
|
|
200
|
+
// .width(30)
|
|
201
|
+
// .height(30)
|
|
202
|
+
// .backgroundColor(Colors.red.withAlphaPercent(0.1))
|
|
203
|
+
// .border("none")
|
|
204
|
+
// .borderRadius(9999)
|
|
205
|
+
// .textTransform("capitalize")
|
|
206
|
+
// .hoverBackgroundColor(Colors.red)
|
|
207
|
+
// )
|
|
208
|
+
// )
|
|
209
|
+
// .child(StyleRule("*[data-window-content=window-content]")
|
|
210
|
+
// .margin(5)
|
|
211
|
+
// .alignSelf("stretch")
|
|
212
|
+
// .justifySelf("stretch")
|
|
213
|
+
// .flexStretch()
|
|
214
|
+
// .overflow("auto")
|
|
215
|
+
// // This is done to avoid absolute position
|
|
216
|
+
// // to run out of content area
|
|
217
|
+
// .position("relative")
|
|
218
|
+
// // .display("flex")
|
|
219
|
+
// // .child(StyleRule("*")
|
|
220
|
+
// // .flex("1 1 100%")
|
|
221
|
+
// // )
|
|
222
|
+
// // .and(StyleRule("[data-window-content-fill] > *")
|
|
223
|
+
// // .maximizeAbsolute()
|
|
224
|
+
// // )
|
|
225
|
+
// )
|
|
226
|
+
// .child(StyleRule(" * > .command-bar")
|
|
227
|
+
// .backgroundColor(Colors.lightGray.withAlphaPercent(0.6))
|
|
228
|
+
// .display("flex")
|
|
229
|
+
// .margin(0)
|
|
230
|
+
// .padding(5)
|
|
231
|
+
// .gap(5)
|
|
232
|
+
// .nested(StyleRule("button")
|
|
233
|
+
// .borderWidth(1)
|
|
234
|
+
// .borderRadius(9999)
|
|
235
|
+
// .padding(5)
|
|
236
|
+
// .paddingLeft(10)
|
|
237
|
+
// .paddingRight(10)
|
|
238
|
+
// )
|
|
239
|
+
// )
|
|
240
|
+
// , "*[data-popup-window=popup-window]");
|
|
237
241
|
|
|
238
242
|
export class PopupControl extends AtomControl {
|
|
239
243
|
|
|
@@ -300,198 +304,198 @@ export class PopupControl extends AtomControl {
|
|
|
300
304
|
|
|
301
305
|
}
|
|
302
306
|
|
|
303
|
-
export class PopupWindow extends AtomControl {
|
|
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
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
// @ts-ignore
|
|
494
|
-
delete PopupWindow.prototype.init;
|
|
307
|
+
// export class PopupWindow extends AtomControl {
|
|
308
|
+
|
|
309
|
+
// public static async showWindow<T>(options?: IDialogOptions): Promise<T>;
|
|
310
|
+
// public static async showWindow<T>(window: IClassOf<PopupWindow>, options?: IDialogOptions): Promise<T>;
|
|
311
|
+
// public static async showWindow<T>(
|
|
312
|
+
// window: IClassOf<PopupWindow> | IDialogOptions,
|
|
313
|
+
// options?: IDialogOptions): Promise<T> {
|
|
314
|
+
// if (arguments.length <= 1) {
|
|
315
|
+
// options = arguments[0];
|
|
316
|
+
// window = this;
|
|
317
|
+
// }
|
|
318
|
+
// // this will force lastTarget to be set
|
|
319
|
+
// await sleep(1);
|
|
320
|
+
// return PopupService.showWindow<T>(PopupService.lastTarget, window as any, options);
|
|
321
|
+
// }
|
|
322
|
+
|
|
323
|
+
// public static async showModal<T>(options?: IDialogOptions): Promise<T>;
|
|
324
|
+
// public static async showModal<T>(window: IClassOf<PopupWindow>, options?: IDialogOptions): Promise<T>;
|
|
325
|
+
// public static async showModal<T>(
|
|
326
|
+
// window: IClassOf<PopupWindow> | IDialogOptions,
|
|
327
|
+
// options?: IDialogOptions): Promise<T> {
|
|
328
|
+
// if (arguments.length <= 1) {
|
|
329
|
+
// options = arguments[0];
|
|
330
|
+
// window = this;
|
|
331
|
+
// }
|
|
332
|
+
// options ??= {};
|
|
333
|
+
// options.modal ??= true;
|
|
334
|
+
// // this will force lastTarget to be set
|
|
335
|
+
// await sleep(1);
|
|
336
|
+
// return PopupService.showWindow<T>(PopupService.lastTarget, window as any, options);
|
|
337
|
+
// }
|
|
338
|
+
|
|
339
|
+
// @BindableProperty
|
|
340
|
+
// public title?: string;
|
|
341
|
+
|
|
342
|
+
// public viewModelTitle?: string;
|
|
343
|
+
|
|
344
|
+
// public close: (r?) => void;
|
|
345
|
+
|
|
346
|
+
// public cancel: (r?) => void;
|
|
347
|
+
|
|
348
|
+
// public titleRenderer: () => XNode;
|
|
349
|
+
|
|
350
|
+
// public closeButtonRenderer: () => XNode;
|
|
351
|
+
|
|
352
|
+
// @BindableProperty
|
|
353
|
+
// public closeWarning: string;
|
|
354
|
+
|
|
355
|
+
// protected init() {
|
|
356
|
+
// // do nothing...
|
|
357
|
+
// }
|
|
358
|
+
|
|
359
|
+
// protected async requestCancel() {
|
|
360
|
+
// if (this.closeWarning) {
|
|
361
|
+
// if (!await ConfirmPopup.confirm({
|
|
362
|
+
// message : this.closeWarning
|
|
363
|
+
// })) {
|
|
364
|
+
// return;
|
|
365
|
+
// }
|
|
366
|
+
// }
|
|
367
|
+
// this.cancel();
|
|
368
|
+
// }
|
|
369
|
+
|
|
370
|
+
// protected preCreate(): void {
|
|
371
|
+
// this.title = null;
|
|
372
|
+
// this.viewModelTitle = null;
|
|
373
|
+
// const handler = (e: KeyboardEvent) => {
|
|
374
|
+
// if (e.key === "Escape") {
|
|
375
|
+
// this.app.runAsync(() => this.requestCancel());
|
|
376
|
+
// e.preventDefault();
|
|
377
|
+
// return;
|
|
378
|
+
// }
|
|
379
|
+
// };
|
|
380
|
+
// this.bindEvent(this.element, "keydown", handler);
|
|
381
|
+
// // document.body.addEventListener("keydown", handler);
|
|
382
|
+
// // this.registerDisposable({
|
|
383
|
+
// // dispose() {
|
|
384
|
+
// // document.body.removeEventListener("keydown", handler);
|
|
385
|
+
// // }
|
|
386
|
+
// // });
|
|
387
|
+
// this.element.dataset.popupWindow = "popup-window";
|
|
388
|
+
|
|
389
|
+
// setTimeout((p) => {
|
|
390
|
+
// p.dataset.ready = "true";
|
|
391
|
+
// }, 10, this.element);
|
|
392
|
+
// }
|
|
393
|
+
|
|
394
|
+
// protected render(node: XNode, e?: any, creator?: any): void {
|
|
395
|
+
// this.render = super.render;
|
|
396
|
+
// const titleContent = this.titleRenderer?.() ?? <span
|
|
397
|
+
// class="title-text" text={Bind.oneWay(() => this.title || this.viewModelTitle)}/>;
|
|
398
|
+
// const closeButton = this.closeButtonRenderer?.() ?? <button
|
|
399
|
+
// class="popup-close-button"
|
|
400
|
+
// text="x"
|
|
401
|
+
// eventClick={Bind.event(() => this.requestCancel())}/>;
|
|
402
|
+
// const a = node.attributes ??= {};
|
|
403
|
+
// a["data-window-content"] = "window-content";
|
|
404
|
+
// const extracted = this.extractControlProperties(node);
|
|
405
|
+
// super.render(<div
|
|
406
|
+
// viewModelTitle={Bind.oneWay(() => this.viewModel.title)}
|
|
407
|
+
// { ... extracted }>
|
|
408
|
+
// <div class="title title-host">
|
|
409
|
+
// { titleContent }
|
|
410
|
+
// { closeButton }
|
|
411
|
+
// </div>
|
|
412
|
+
// { node }
|
|
413
|
+
// </div>);
|
|
414
|
+
|
|
415
|
+
// this.runAfterInit(() => {
|
|
416
|
+
// if (!this.element) {
|
|
417
|
+
// return;
|
|
418
|
+
// }
|
|
419
|
+
// const host = this.element.getElementsByClassName("title-host")[0];
|
|
420
|
+
// this.setupDragging(host as HTMLElement);
|
|
421
|
+
// // this.element may become null if it was immediately
|
|
422
|
+
// // closed, very rare case, but possible if
|
|
423
|
+
// // supplied cancelToken was cancelled
|
|
424
|
+
// const anyAutofocus = this.element.querySelector(`*[autofocus]`);
|
|
425
|
+
// if (!anyAutofocus) {
|
|
426
|
+
// const windowContent = this.element.querySelector("[data-window-content]");
|
|
427
|
+
// if (windowContent) {
|
|
428
|
+
// const firstInput = windowContent.querySelector("input,button,a") as HTMLInputElement;
|
|
429
|
+
// if (firstInput) {
|
|
430
|
+
// firstInput.focus();
|
|
431
|
+
// return;
|
|
432
|
+
// }
|
|
433
|
+
// }
|
|
434
|
+
|
|
435
|
+
// const cb = this.element.querySelector(".popup-close-button") as HTMLButtonElement;
|
|
436
|
+
// if (cb) {
|
|
437
|
+
// cb.focus();
|
|
438
|
+
// }
|
|
439
|
+
// return;
|
|
440
|
+
// }
|
|
441
|
+
// });
|
|
442
|
+
// }
|
|
443
|
+
|
|
444
|
+
// protected setupDragging(tp: HTMLElement): void {
|
|
445
|
+
// this.bindEvent(tp, "mousedown", (startEvent: MouseEvent) => {
|
|
446
|
+
// if ((startEvent.target as HTMLElement).tagName === "BUTTON") {
|
|
447
|
+
// return;
|
|
448
|
+
// }
|
|
449
|
+
// startEvent.preventDefault();
|
|
450
|
+
// const disposables: IDisposable[] = [];
|
|
451
|
+
// // const offset = AtomUI.screenOffset(tp);
|
|
452
|
+
// const element = this.element;
|
|
453
|
+
// const offset = { x: element.offsetLeft, y: element.offsetTop };
|
|
454
|
+
// if (element.style.transform !== "none") {
|
|
455
|
+
// offset.x -= element.offsetWidth / 2;
|
|
456
|
+
// offset.y -= element.offsetHeight / 2;
|
|
457
|
+
// element.style.left = offset.x + "px";
|
|
458
|
+
// element.style.top = offset.y + "px";
|
|
459
|
+
// element.style.transform = "none";
|
|
460
|
+
// }
|
|
461
|
+
// this.element.dataset.dragging = "true";
|
|
462
|
+
// const rect: IRect = { x: startEvent.clientX, y: startEvent.clientY };
|
|
463
|
+
// const cursor = tp.style.cursor;
|
|
464
|
+
// tp.style.cursor = "move";
|
|
465
|
+
// disposables.push(this.bindEvent(document.body, "mousemove", (moveEvent: MouseEvent) => {
|
|
466
|
+
// const { clientX, clientY } = moveEvent;
|
|
467
|
+
// const dx = clientX - rect.x;
|
|
468
|
+
// const dy = clientY - rect.y;
|
|
469
|
+
|
|
470
|
+
// const finalX = offset.x + dx;
|
|
471
|
+
// const finalY = offset.y + dy;
|
|
472
|
+
// if (finalX < 5 || finalY < 5) {
|
|
473
|
+
// return;
|
|
474
|
+
// }
|
|
475
|
+
|
|
476
|
+
// offset.x = finalX;
|
|
477
|
+
// offset.y = finalY;
|
|
478
|
+
|
|
479
|
+
// this.element.style.left = offset.x + "px";
|
|
480
|
+
// this.element.style.top = offset.y + "px";
|
|
481
|
+
|
|
482
|
+
// rect.x = clientX;
|
|
483
|
+
// rect.y = clientY;
|
|
484
|
+
// }));
|
|
485
|
+
// disposables.push(this.bindEvent(document.body, "mouseup", (endEvent: MouseEvent) => {
|
|
486
|
+
// tp.style.cursor = cursor;
|
|
487
|
+
// this.element.removeAttribute("data-dragging");
|
|
488
|
+
// for (const iterator of disposables) {
|
|
489
|
+
// iterator.dispose();
|
|
490
|
+
// }
|
|
491
|
+
// }));
|
|
492
|
+
// });
|
|
493
|
+
// }
|
|
494
|
+
|
|
495
|
+
// }
|
|
496
|
+
|
|
497
|
+
// // @ts-ignore
|
|
498
|
+
// delete PopupWindow.prototype.init;
|
|
495
499
|
|
|
496
500
|
CSS(StyleRule()
|
|
497
501
|
.display("grid")
|
|
@@ -531,74 +535,74 @@ CSS(StyleRule()
|
|
|
531
535
|
)
|
|
532
536
|
, "div[data-confirm-popup=confirm-popup]");
|
|
533
537
|
|
|
534
|
-
class ConfirmPopup extends PopupWindow {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
}
|
|
538
|
+
// class ConfirmPopup extends PopupWindow {
|
|
539
|
+
|
|
540
|
+
// public static async confirm({
|
|
541
|
+
// message,
|
|
542
|
+
// title = "Confirm",
|
|
543
|
+
// yesLabel = "Yes",
|
|
544
|
+
// noLabel = "No",
|
|
545
|
+
// cancelLabel = null
|
|
546
|
+
// }): Promise<boolean> {
|
|
547
|
+
// return PopupService.confirm({ title, message, yesLabel, noLabel, cancelLabel});
|
|
548
|
+
// }
|
|
549
|
+
|
|
550
|
+
// public message: string;
|
|
551
|
+
|
|
552
|
+
// public messageRenderer: () => XNode;
|
|
553
|
+
|
|
554
|
+
// public yesLabel: string;
|
|
555
|
+
|
|
556
|
+
// public noLabel: string;
|
|
557
|
+
|
|
558
|
+
// public cancelLabel: string;
|
|
559
|
+
|
|
560
|
+
// protected preCreate(): void {
|
|
561
|
+
// super.preCreate();
|
|
562
|
+
// this.yesLabel = "Yes";
|
|
563
|
+
// this.noLabel = "No";
|
|
564
|
+
// this.cancelLabel = null;
|
|
565
|
+
// }
|
|
566
|
+
|
|
567
|
+
// protected requestCancel(): Promise<void> {
|
|
568
|
+
// this.cancel();
|
|
569
|
+
// return Promise.resolve();
|
|
570
|
+
// }
|
|
571
|
+
|
|
572
|
+
// protected render(node: XNode, e?: any, creator?: any) {
|
|
573
|
+
// this.render = super.render;
|
|
574
|
+
// this.element.dataset.confirmPopup = "confirm-popup";
|
|
575
|
+
// this.closeButtonRenderer = () => <div/>;
|
|
576
|
+
// const extracted = this.extractControlProperties(node);
|
|
577
|
+
// const na = node.attributes ??= {};
|
|
578
|
+
// na["data-element"] = "message";
|
|
579
|
+
// super.render(<div { ... extracted }>
|
|
580
|
+
// { node }
|
|
581
|
+
// <div data-element="buttons">
|
|
582
|
+
// <button
|
|
583
|
+
// class="yes"
|
|
584
|
+
// autofocus={true}
|
|
585
|
+
// text={Bind.oneWay(() => this.yesLabel)}
|
|
586
|
+
// eventClick={() => this.close(true)}
|
|
587
|
+
// style-display={Bind.oneWay(() => !!this.yesLabel)}
|
|
588
|
+
// />
|
|
589
|
+
// <button
|
|
590
|
+
// class="no"
|
|
591
|
+
// text={Bind.oneWay(() => this.noLabel)}
|
|
592
|
+
// eventClick={() => this.close(false)}
|
|
593
|
+
// style-display={Bind.oneWay(() => !!this.noLabel)}
|
|
594
|
+
// />
|
|
595
|
+
// <button
|
|
596
|
+
// class="cancel"
|
|
597
|
+
// text={Bind.oneWay(() => this.cancelLabel)}
|
|
598
|
+
// eventClick={() => this.requestCancel()}
|
|
599
|
+
// style-display={Bind.oneWay(() => !!this.cancelLabel)}
|
|
600
|
+
// />
|
|
601
|
+
// </div>
|
|
602
|
+
// </div>);
|
|
603
|
+
// }
|
|
604
|
+
|
|
605
|
+
// }
|
|
602
606
|
|
|
603
607
|
function findHostAndPosition(opener: HTMLElement) {
|
|
604
608
|
let root = opener;
|
|
@@ -833,7 +837,7 @@ export default class PopupService {
|
|
|
833
837
|
|
|
834
838
|
public static showWindow<T>(
|
|
835
839
|
opener: HTMLElement,
|
|
836
|
-
popupClass:
|
|
840
|
+
popupClass: typeof PopupWindow,
|
|
837
841
|
popupOptions?: IDialogOptions
|
|
838
842
|
): Promise<T> {
|
|
839
843
|
return new Promise<T>((resolve, reject) => {
|