@web-atoms/core 2.1.478 → 2.2.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/dist/App.js +189 -242
- package/dist/App.js.map +1 -1
- package/dist/Atom.js +123 -138
- package/dist/Atom.js.map +1 -1
- package/dist/MockApp.js +32 -32
- package/dist/MockApp.js.map +1 -1
- package/dist/Pack.js +11 -17
- package/dist/Pack.js.map +1 -1
- package/dist/core/AtomBinder.js +187 -199
- package/dist/core/AtomBinder.js.map +1 -1
- package/dist/core/AtomBridge.js +251 -274
- package/dist/core/AtomBridge.js.map +1 -1
- package/dist/core/AtomComponent.js +509 -592
- package/dist/core/AtomComponent.js.map +1 -1
- package/dist/core/AtomDispatcher.js +50 -54
- package/dist/core/AtomDispatcher.js.map +1 -1
- package/dist/core/AtomDisposableList.js +31 -36
- package/dist/core/AtomDisposableList.js.map +1 -1
- package/dist/core/AtomEnumerator.js +19 -21
- package/dist/core/AtomEnumerator.js.map +1 -1
- package/dist/core/AtomList.js +168 -232
- package/dist/core/AtomList.js.map +1 -1
- package/dist/core/AtomLoader.js +274 -257
- package/dist/core/AtomLoader.js.map +1 -1
- package/dist/core/AtomMap.js +15 -20
- package/dist/core/AtomMap.js.map +1 -1
- package/dist/core/AtomOnce.js +31 -71
- package/dist/core/AtomOnce.js.map +1 -1
- package/dist/core/AtomSelectableList.js +210 -223
- package/dist/core/AtomSelectableList.js.map +1 -1
- package/dist/core/AtomUri.js +78 -85
- package/dist/core/AtomUri.js.map +1 -1
- package/dist/core/AtomWatcher.js +112 -186
- package/dist/core/AtomWatcher.js.map +1 -1
- package/dist/core/Bind.js +288 -380
- package/dist/core/Bind.js.map +1 -1
- package/dist/core/BindableProperty.js +40 -59
- package/dist/core/BindableProperty.js.map +1 -1
- package/dist/core/CancelTokenFactory.js +42 -49
- package/dist/core/CancelTokenFactory.js.map +1 -1
- package/dist/core/Color.js +9 -13
- package/dist/core/Color.js.map +1 -1
- package/dist/core/Colors.js +254 -254
- package/dist/core/Colors.js.map +1 -1
- package/dist/core/Defer.js +37 -47
- package/dist/core/Defer.js.map +1 -1
- package/dist/core/EventScope.js +52 -49
- package/dist/core/EventScope.js.map +1 -1
- package/dist/core/ExpressionParser.js +152 -216
- package/dist/core/ExpressionParser.js.map +1 -1
- package/dist/core/FormattedError.js +17 -19
- package/dist/core/FormattedError.js.map +1 -1
- package/dist/core/FormattedString.js +14 -16
- package/dist/core/FormattedString.js.map +1 -1
- package/dist/core/IFetchEvent.js +9 -13
- package/dist/core/IFetchEvent.js.map +1 -1
- package/dist/core/IScreen.js +9 -13
- package/dist/core/IScreen.js.map +1 -1
- package/dist/core/IValueConverter.js +9 -13
- package/dist/core/IValueConverter.js.map +1 -1
- package/dist/core/InheritedProperty.js +83 -99
- package/dist/core/InheritedProperty.js.map +1 -1
- package/dist/core/InjectProperty.js +22 -29
- package/dist/core/InjectProperty.js.map +1 -1
- package/dist/core/KeyValuePairs.js +9 -13
- package/dist/core/KeyValuePairs.js.map +1 -1
- package/dist/core/Markdown.js +22 -24
- package/dist/core/Markdown.js.map +1 -1
- package/dist/core/MarkdownError.js +20 -20
- package/dist/core/MarkdownError.js.map +1 -1
- package/dist/core/PropertyBinding.js +11 -16
- package/dist/core/PropertyBinding.js.map +1 -1
- package/dist/core/PropertyMap.js +37 -44
- package/dist/core/PropertyMap.js.map +1 -1
- package/dist/core/SingleInvoker.js +51 -54
- package/dist/core/SingleInvoker.js.map +1 -1
- package/dist/core/StringHelper.js +36 -39
- package/dist/core/StringHelper.js.map +1 -1
- package/dist/core/TransientDisposable.js +23 -26
- package/dist/core/TransientDisposable.js.map +1 -1
- package/dist/core/WatchProperty.js +34 -34
- package/dist/core/WatchProperty.js.map +1 -1
- package/dist/core/WebImage.js +15 -17
- package/dist/core/WebImage.js.map +1 -1
- package/dist/core/XNode.js +129 -157
- package/dist/core/XNode.js.map +1 -1
- package/dist/core/sleep.js +34 -40
- package/dist/core/sleep.js.map +1 -1
- package/dist/core/types.js +80 -88
- package/dist/core/types.js.map +1 -1
- package/dist/di/DISingleton.js +23 -21
- package/dist/di/DISingleton.js.map +1 -1
- package/dist/di/DITransient.js +23 -21
- package/dist/di/DITransient.js.map +1 -1
- package/dist/di/IMockOrInject.js +9 -13
- package/dist/di/IMockOrInject.js.map +1 -1
- package/dist/di/IServiceProvider.js +9 -13
- package/dist/di/IServiceProvider.js.map +1 -1
- package/dist/di/Inject.js +79 -88
- package/dist/di/Inject.js.map +1 -1
- package/dist/di/Register.js +49 -51
- package/dist/di/Register.js.map +1 -1
- package/dist/di/RegisterScoped.js +20 -20
- package/dist/di/RegisterScoped.js.map +1 -1
- package/dist/di/RegisterSingleton.js +20 -20
- package/dist/di/RegisterSingleton.js.map +1 -1
- package/dist/di/ServiceCollection.js +46 -45
- package/dist/di/ServiceCollection.js.map +1 -1
- package/dist/di/ServiceProvider.js +111 -109
- package/dist/di/ServiceProvider.js.map +1 -1
- package/dist/di/TypeKey.js +20 -43
- package/dist/di/TypeKey.js.map +1 -1
- package/dist/services/BusyIndicatorService.js +26 -32
- package/dist/services/BusyIndicatorService.js.map +1 -1
- package/dist/services/CacheService.js +112 -98
- package/dist/services/CacheService.js.map +1 -1
- package/dist/services/JsonService.js +131 -133
- package/dist/services/JsonService.js.map +1 -1
- package/dist/services/MockNavigationService.js +152 -221
- package/dist/services/MockNavigationService.js.map +1 -1
- package/dist/services/NavigationService.js +140 -154
- package/dist/services/NavigationService.js.map +1 -1
- package/dist/services/ReferenceService.js +47 -50
- package/dist/services/ReferenceService.js.map +1 -1
- package/dist/services/http/AjaxOptions.js +12 -16
- package/dist/services/http/AjaxOptions.js.map +1 -1
- package/dist/services/http/JsonError.js +17 -19
- package/dist/services/http/JsonError.js.map +1 -1
- package/dist/services/http/RestService.js +395 -583
- package/dist/services/http/RestService.js.map +1 -1
- package/dist/style/StyleRule.js +1830 -1844
- package/dist/style/StyleRule.js.map +1 -1
- package/dist/test.js +9 -66
- package/dist/test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/unit/AtomTest.js +54 -36
- package/dist/unit/AtomTest.js.map +1 -1
- package/dist/unit/AtomWebTest.js +64 -43
- package/dist/unit/AtomWebTest.js.map +1 -1
- package/dist/view-model/Action.js +152 -134
- package/dist/view-model/Action.js.map +1 -1
- package/dist/view-model/AtomViewModel.js +318 -416
- package/dist/view-model/AtomViewModel.js.map +1 -1
- package/dist/view-model/AtomWindowViewModel.js +55 -90
- package/dist/view-model/AtomWindowViewModel.js.map +1 -1
- package/dist/view-model/BindableUrlParameter.js +25 -25
- package/dist/view-model/BindableUrlParameter.js.map +1 -1
- package/dist/view-model/Delay.js +34 -46
- package/dist/view-model/Delay.js.map +1 -1
- package/dist/view-model/Disposable.js +31 -39
- package/dist/view-model/Disposable.js.map +1 -1
- package/dist/view-model/Load.js +119 -123
- package/dist/view-model/Load.js.map +1 -1
- package/dist/view-model/Once.js +48 -53
- package/dist/view-model/Once.js.map +1 -1
- package/dist/view-model/baseTypes.js +15 -20
- package/dist/view-model/baseTypes.js.map +1 -1
- package/dist/view-model/bindPromise.js +42 -48
- package/dist/view-model/bindPromise.js.map +1 -1
- package/dist/view-model/bindProperty.js +17 -27
- package/dist/view-model/bindProperty.js.map +1 -1
- package/dist/view-model/bindUrlParameter.js +55 -66
- package/dist/view-model/bindUrlParameter.js.map +1 -1
- package/dist/web/WebApp.js +136 -135
- package/dist/web/WebApp.js.map +1 -1
- package/dist/web/controls/AtomAlertWindow.js +61 -90
- package/dist/web/controls/AtomAlertWindow.js.map +1 -1
- package/dist/web/controls/AtomComboBox.js +82 -86
- package/dist/web/controls/AtomComboBox.js.map +1 -1
- package/dist/web/controls/AtomContentControl.js +52 -50
- package/dist/web/controls/AtomContentControl.js.map +1 -1
- package/dist/web/controls/AtomControl.js +435 -476
- package/dist/web/controls/AtomControl.js.map +1 -1
- package/dist/web/controls/AtomFrame.js +224 -226
- package/dist/web/controls/AtomFrame.js.map +1 -1
- package/dist/web/controls/AtomGridSplitter.js +67 -65
- package/dist/web/controls/AtomGridSplitter.js.map +1 -1
- package/dist/web/controls/AtomGridView.js +228 -254
- package/dist/web/controls/AtomGridView.js.map +1 -1
- package/dist/web/controls/AtomItemsControl.js +622 -761
- package/dist/web/controls/AtomItemsControl.js.map +1 -1
- package/dist/web/controls/AtomListBox.js +56 -64
- package/dist/web/controls/AtomListBox.js.map +1 -1
- package/dist/web/controls/AtomNotification.js +59 -54
- package/dist/web/controls/AtomNotification.js.map +1 -1
- package/dist/web/controls/AtomPage.js +18 -20
- package/dist/web/controls/AtomPage.js.map +1 -1
- package/dist/web/controls/AtomPageLink.js +131 -107
- package/dist/web/controls/AtomPageLink.js.map +1 -1
- package/dist/web/controls/AtomTabbedPage.js +269 -246
- package/dist/web/controls/AtomTabbedPage.js.map +1 -1
- package/dist/web/controls/AtomTemplate.js +14 -17
- package/dist/web/controls/AtomTemplate.js.map +1 -1
- package/dist/web/controls/AtomTemplateControl.js +38 -40
- package/dist/web/controls/AtomTemplateControl.js.map +1 -1
- package/dist/web/controls/AtomToggleButtonBar.js +37 -37
- package/dist/web/controls/AtomToggleButtonBar.js.map +1 -1
- package/dist/web/controls/AtomViewPager.js +87 -67
- package/dist/web/controls/AtomViewPager.js.map +1 -1
- package/dist/web/controls/AtomViewStack.js +30 -32
- package/dist/web/controls/AtomViewStack.js.map +1 -1
- package/dist/web/controls/AtomWindow.js +218 -233
- package/dist/web/controls/AtomWindow.js.map +1 -1
- package/dist/web/core/AtomUI.d.ts.map +1 -1
- package/dist/web/core/AtomUI.js +160 -172
- package/dist/web/core/AtomUI.js.map +1 -1
- package/dist/web/core/Encoder.js +152 -199
- package/dist/web/core/Encoder.js.map +1 -1
- package/dist/web/core/HtmlNode.js +165 -161
- package/dist/web/core/HtmlNode.js.map +1 -1
- package/dist/web/images/Busy.js +13 -14
- package/dist/web/images/Busy.js.map +1 -1
- package/dist/web/images/BusyDataUrl.js +14 -882
- package/dist/web/images/BusyDataUrl.js.map +1 -1
- package/dist/web/images/Button.js +13 -15
- package/dist/web/images/Button.js.map +1 -1
- package/dist/web/images/ButtonDataUrl.js +14 -43
- package/dist/web/images/ButtonDataUrl.js.map +1 -1
- package/dist/web/images/CloseButton.js +13 -14
- package/dist/web/images/CloseButton.js.map +1 -1
- package/dist/web/images/CloseButtonDataUrl.js +14 -43
- package/dist/web/images/CloseButtonDataUrl.js.map +1 -1
- package/dist/web/images/CloseButtonHover.js +13 -14
- package/dist/web/images/CloseButtonHover.js.map +1 -1
- package/dist/web/images/CloseButtonHoverDataUrl.js +14 -37
- package/dist/web/images/CloseButtonHoverDataUrl.js.map +1 -1
- package/dist/web/samples/MovieService.js +60 -49
- package/dist/web/samples/MovieService.js.map +1 -1
- package/dist/web/samples/demo/app.js +23 -23
- package/dist/web/samples/demo/app.js.map +1 -1
- package/dist/web/samples/demo/views/MovieList.js +64 -67
- package/dist/web/samples/demo/views/MovieList.js.map +1 -1
- package/dist/web/samples/demo/views/MovieListViewModel.js +102 -82
- package/dist/web/samples/demo/views/MovieListViewModel.js.map +1 -1
- package/dist/web/samples/tabs/app.js +57 -39
- package/dist/web/samples/tabs/app.js.map +1 -1
- package/dist/web/samples/tabs/views/List.js +13 -14
- package/dist/web/samples/tabs/views/List.js.map +1 -1
- package/dist/web/samples/tabs/views/ListDataUrl.js +14 -18
- package/dist/web/samples/tabs/views/ListDataUrl.js.map +1 -1
- package/dist/web/samples/tabs/views/Page1.js +94 -74
- package/dist/web/samples/tabs/views/Page1.js.map +1 -1
- package/dist/web/samples/tabs/views/TabHost.js +82 -63
- package/dist/web/samples/tabs/views/TabHost.js.map +1 -1
- package/dist/web/samples/window/WindowSample.js +27 -23
- package/dist/web/samples/window/WindowSample.js.map +1 -1
- package/dist/web/services/MarkdownService.js +35 -51
- package/dist/web/services/MarkdownService.js.map +1 -1
- package/dist/web/services/NotificationPopup.js +48 -44
- package/dist/web/services/NotificationPopup.js.map +1 -1
- package/dist/web/services/PopupService.js +770 -940
- package/dist/web/services/PopupService.js.map +1 -1
- package/dist/web/services/WebBusyIndicatorService.js +80 -86
- package/dist/web/services/WebBusyIndicatorService.js.map +1 -1
- package/dist/web/services/WindowService.js +332 -418
- package/dist/web/services/WindowService.js.map +1 -1
- package/dist/web/styles/AtomAlertWindowStyle.js +44 -34
- package/dist/web/styles/AtomAlertWindowStyle.js.map +1 -1
- package/dist/web/styles/AtomFrameStyle.js +27 -20
- package/dist/web/styles/AtomFrameStyle.js.map +1 -1
- package/dist/web/styles/AtomListBoxStyle.js +34 -32
- package/dist/web/styles/AtomListBoxStyle.js.map +1 -1
- package/dist/web/styles/AtomNotificationStyle.js +33 -33
- package/dist/web/styles/AtomNotificationStyle.js.map +1 -1
- package/dist/web/styles/AtomPageLinkStyle.js +21 -22
- package/dist/web/styles/AtomPageLinkStyle.js.map +1 -1
- package/dist/web/styles/AtomPopupStyle.js +21 -23
- package/dist/web/styles/AtomPopupStyle.js.map +1 -1
- package/dist/web/styles/AtomStyle.js +69 -73
- package/dist/web/styles/AtomStyle.js.map +1 -1
- package/dist/web/styles/AtomStyleSheet.js +54 -57
- package/dist/web/styles/AtomStyleSheet.js.map +1 -1
- package/dist/web/styles/AtomTabbedPageStyle.js +110 -105
- package/dist/web/styles/AtomTabbedPageStyle.js.map +1 -1
- package/dist/web/styles/AtomTheme.js +62 -65
- package/dist/web/styles/AtomTheme.js.map +1 -1
- package/dist/web/styles/AtomToggleButtonBarStyle.js +68 -49
- package/dist/web/styles/AtomToggleButtonBarStyle.js.map +1 -1
- package/dist/web/styles/AtomWindowStyle.js +108 -117
- package/dist/web/styles/AtomWindowStyle.js.map +1 -1
- package/dist/web/styles/CSS.js +71 -81
- package/dist/web/styles/CSS.js.map +1 -1
- package/dist/web/styles/CommonStyles.js +60 -66
- package/dist/web/styles/CommonStyles.js.map +1 -1
- package/dist/web/styles/IStyleDeclaration.js +9 -13
- package/dist/web/styles/IStyleDeclaration.js.map +1 -1
- package/dist/web/styles/StyleBuilder.js +74 -75
- package/dist/web/styles/StyleBuilder.js.map +1 -1
- package/dist/xf/XFApp.js +54 -50
- package/dist/xf/XFApp.js.map +1 -1
- package/dist/xf/controls/AtomXFControl.js +233 -229
- package/dist/xf/controls/AtomXFControl.js.map +1 -1
- package/dist/xf/services/XFBusyIndicatorService.js +34 -34
- package/dist/xf/services/XFBusyIndicatorService.js.map +1 -1
- package/dist/xf/services/XFNavigationService.js +150 -133
- package/dist/xf/services/XFNavigationService.js.map +1 -1
- package/package.json +2 -1
- package/src/web/core/AtomUI.ts +8 -6
|
@@ -1,998 +1,828 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
System.register(["../../core/AtomDisposableList", "../../core/Bind", "../../core/BindableProperty", "../../core/Colors", "../../core/InheritedProperty", "../../core/sleep", "../../core/types", "../../core/XNode", "../../style/StyleRule", "../controls/AtomControl", "../styles/CSS"], function (_export, _context) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var AtomDisposableList, Bind, BindableProperty, Colors, getOwnInheritedProperty, sleep, CancelToken, XNode, StyleRule, AtomControl, CSS, PopupControl, PopupWindow, ConfirmPopup, PopupService, __decorate, __metadata, __awaiter, __rest, popupCss, disableContain, popupId, lastTarget;
|
|
5
|
+
function findHostAndPosition(opener) {
|
|
6
|
+
let root = opener;
|
|
7
|
+
const body = document.body;
|
|
8
|
+
let rect = opener.getBoundingClientRect();
|
|
9
|
+
const offset = {
|
|
10
|
+
x: rect.left,
|
|
11
|
+
y: rect.top,
|
|
12
|
+
handler: null,
|
|
13
|
+
root
|
|
14
|
+
};
|
|
15
|
+
do {
|
|
16
|
+
root = root.parentElement;
|
|
17
|
+
if (root === body) {
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
if (root.parentElement.classList.contains("page-host")) {
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
if (root.classList.contains("popup-host")) {
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
if (root.dataset.popUpHost === "yes") {
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
} while (true);
|
|
30
|
+
rect = root.getBoundingClientRect();
|
|
31
|
+
offset.x -= rect.x;
|
|
32
|
+
offset.y -= rect.y;
|
|
33
|
+
offset.root = root;
|
|
34
|
+
return offset;
|
|
35
|
+
}
|
|
36
|
+
function findHost(opener, offset) {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
let host = opener.offsetParent;
|
|
39
|
+
while (host) {
|
|
40
|
+
const current = host;
|
|
41
|
+
if (host === document.body) {
|
|
42
|
+
return host;
|
|
43
|
+
}
|
|
44
|
+
if (host.classList.contains("popup-host")) {
|
|
45
|
+
return host;
|
|
46
|
+
}
|
|
47
|
+
if (host.dataset.popUpHost === "yes") {
|
|
48
|
+
return host;
|
|
49
|
+
}
|
|
50
|
+
host = host.offsetParent;
|
|
51
|
+
if (host.classList.contains("page-host")) {
|
|
52
|
+
host = current;
|
|
53
|
+
return host;
|
|
54
|
+
}
|
|
55
|
+
if (!host) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (!offset) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
offset.x += host.offsetLeft;
|
|
62
|
+
offset.y += host.offsetTop - ((_b = (_a = host.offsetParent) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : 0);
|
|
37
63
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const AtomControl_1 = require("../controls/AtomControl");
|
|
52
|
-
const CSS_1 = require("../styles/CSS");
|
|
53
|
-
// let lastTarget = null;
|
|
54
|
-
document.body.addEventListener("click", (e) => {
|
|
55
|
-
if (e.target.offsetParent) {
|
|
56
|
-
PopupService.lastTarget = e.target;
|
|
64
|
+
return host;
|
|
65
|
+
}
|
|
66
|
+
function closeHandler(host, opener, container, close) {
|
|
67
|
+
let handler = null;
|
|
68
|
+
handler = e => {
|
|
69
|
+
var _a;
|
|
70
|
+
let start = e.target;
|
|
71
|
+
if (e.defaultPrevented) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
while (start) {
|
|
75
|
+
if (start === host) {
|
|
76
|
+
break;
|
|
57
77
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
.alignItems("center")
|
|
139
|
-
.justifyItems("center")
|
|
140
|
-
.gridTemplateRows("auto 1fr")
|
|
141
|
-
.gridTemplateColumns("1fr")
|
|
142
|
-
.opacity("0")
|
|
143
|
-
.transition("opacity 0.3s cubic-bezier(0.55, 0.09, 0.97, 0.32)")
|
|
144
|
-
.and((0, StyleRule_1.default)("[data-ready=true]")
|
|
145
|
-
.opacity("1"))
|
|
146
|
-
.and((0, StyleRule_1.default)("[data-dragging=true]")
|
|
147
|
-
.opacity("0.5"))
|
|
148
|
-
.child((0, StyleRule_1.default)(".title")
|
|
149
|
-
.justifySelf("stretch")
|
|
150
|
-
.display("flex")
|
|
151
|
-
.backgroundColor(Colors_1.default.lightGray.withAlphaPercent(0.2))
|
|
152
|
-
.padding(5)
|
|
153
|
-
.alignItems("center")
|
|
154
|
-
.justifyItems("center")
|
|
155
|
-
.child((0, StyleRule_1.default)(".title-text")
|
|
156
|
-
.cursor("move")
|
|
157
|
-
.flexStretch())
|
|
158
|
-
.child((0, StyleRule_1.default)("*")
|
|
159
|
-
.flex("1 1 100%"))
|
|
160
|
-
.child((0, StyleRule_1.default)(".popup-close-button")
|
|
161
|
-
.fontFamily("arial")
|
|
162
|
-
.fontSize(15)
|
|
163
|
-
.flex("1 0 auto")
|
|
164
|
-
.cursor("pointer")
|
|
165
|
-
.width(30)
|
|
166
|
-
.height(30)
|
|
167
|
-
.backgroundColor(Colors_1.default.red.withAlphaPercent(0.1))
|
|
168
|
-
.border("none")
|
|
169
|
-
.borderRadius(9999)
|
|
170
|
-
.textTransform("capitalize")
|
|
171
|
-
.hoverBackgroundColor(Colors_1.default.red)))
|
|
172
|
-
.child((0, StyleRule_1.default)("*[data-window-content=window-content]")
|
|
173
|
-
.margin(5)
|
|
174
|
-
.alignSelf("stretch")
|
|
175
|
-
.justifySelf("stretch")
|
|
176
|
-
.flexStretch()
|
|
177
|
-
.overflow("auto")
|
|
178
|
-
// This is done to avoid absolute position
|
|
179
|
-
// to run out of content area
|
|
180
|
-
.position("relative")
|
|
181
|
-
// .display("flex")
|
|
182
|
-
// .child(StyleRule("*")
|
|
183
|
-
// .flex("1 1 100%")
|
|
184
|
-
// )
|
|
185
|
-
// .and(StyleRule("[data-window-content-fill] > *")
|
|
186
|
-
// .maximizeAbsolute()
|
|
187
|
-
// )
|
|
188
|
-
)
|
|
189
|
-
.child((0, StyleRule_1.default)(" * > .command-bar")
|
|
190
|
-
.backgroundColor(Colors_1.default.lightGray.withAlphaPercent(0.6))
|
|
191
|
-
.display("flex")
|
|
192
|
-
.margin(0)
|
|
193
|
-
.padding(5)
|
|
194
|
-
.gap(5)
|
|
195
|
-
.nested((0, StyleRule_1.default)("button")
|
|
196
|
-
.borderWidth(1)
|
|
197
|
-
.borderRadius(9999)
|
|
198
|
-
.padding(5)
|
|
199
|
-
.paddingLeft(10)
|
|
200
|
-
.paddingRight(10))), "*[data-popup-window=popup-window]");
|
|
201
|
-
class PopupControl extends AtomControl_1.AtomControl {
|
|
202
|
-
static showControl(opener, _a = {}) {
|
|
203
|
-
var { onClick = "close" } = _a, options = __rest(_a, ["onClick"]);
|
|
204
|
-
let openerElement = options === null || options === void 0 ? void 0 : options.parentElement;
|
|
205
|
-
let app;
|
|
206
|
-
if (opener instanceof AtomControl_1.AtomControl) {
|
|
207
|
-
openerElement !== null && openerElement !== void 0 ? openerElement : (openerElement = opener.element);
|
|
208
|
-
app = opener.app;
|
|
78
|
+
if (start === opener) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (start === container.element) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
start = start.parentElement;
|
|
85
|
+
}
|
|
86
|
+
close();
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
(_a = e.stopImmediatePropagation) === null || _a === void 0 ? void 0 : _a.call(e);
|
|
89
|
+
};
|
|
90
|
+
document.body.addEventListener("click", handler, true);
|
|
91
|
+
container.registerDisposable(() => document.body.removeEventListener("click", handler, true));
|
|
92
|
+
const onBack = e => {
|
|
93
|
+
var _a;
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
(_a = e.stopImmediatePropagation) === null || _a === void 0 ? void 0 : _a.call(e);
|
|
96
|
+
e.stopPropagation();
|
|
97
|
+
close();
|
|
98
|
+
};
|
|
99
|
+
document.body.addEventListener("backButton", onBack, true);
|
|
100
|
+
container.registerDisposable(() => document.body.removeEventListener("backButton", onBack, true));
|
|
101
|
+
setTimeout(() => {
|
|
102
|
+
container.registerDisposable(disableContain(container.element));
|
|
103
|
+
}, 10);
|
|
104
|
+
}
|
|
105
|
+
_export({
|
|
106
|
+
PopupControl: void 0,
|
|
107
|
+
PopupWindow: void 0,
|
|
108
|
+
ConfirmPopup: void 0,
|
|
109
|
+
default: void 0
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
setters: [function (_coreAtomDisposableList) {
|
|
113
|
+
AtomDisposableList = _coreAtomDisposableList.AtomDisposableList;
|
|
114
|
+
}, function (_coreBind) {
|
|
115
|
+
Bind = _coreBind.default;
|
|
116
|
+
}, function (_coreBindableProperty) {
|
|
117
|
+
BindableProperty = _coreBindableProperty.BindableProperty;
|
|
118
|
+
}, function (_coreColors) {
|
|
119
|
+
Colors = _coreColors.default;
|
|
120
|
+
}, function (_coreInheritedProperty) {
|
|
121
|
+
getOwnInheritedProperty = _coreInheritedProperty.getOwnInheritedProperty;
|
|
122
|
+
}, function (_coreSleep) {
|
|
123
|
+
sleep = _coreSleep.default;
|
|
124
|
+
}, function (_coreTypes) {
|
|
125
|
+
CancelToken = _coreTypes.CancelToken;
|
|
126
|
+
}, function (_coreXNode) {
|
|
127
|
+
XNode = _coreXNode.default;
|
|
128
|
+
}, function (_styleStyleRule) {
|
|
129
|
+
StyleRule = _styleStyleRule.default;
|
|
130
|
+
}, function (_controlsAtomControl) {
|
|
131
|
+
AtomControl = _controlsAtomControl.AtomControl;
|
|
132
|
+
}, function (_stylesCSS) {
|
|
133
|
+
CSS = _stylesCSS.default;
|
|
134
|
+
}],
|
|
135
|
+
execute: function () {
|
|
136
|
+
__decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
|
|
137
|
+
var c = arguments.length,
|
|
138
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
139
|
+
d;
|
|
140
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
141
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
142
|
+
};
|
|
143
|
+
__metadata = void 0 && (void 0).__metadata || function (k, v) {
|
|
144
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
145
|
+
};
|
|
146
|
+
__awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
147
|
+
function adopt(value) {
|
|
148
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
149
|
+
resolve(value);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
153
|
+
function fulfilled(value) {
|
|
154
|
+
try {
|
|
155
|
+
step(generator.next(value));
|
|
156
|
+
} catch (e) {
|
|
157
|
+
reject(e);
|
|
209
158
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if (!start) {
|
|
217
|
-
return Promise.reject("Could not create popup as target is not attached");
|
|
218
|
-
}
|
|
219
|
-
app = start.atomControl.app;
|
|
159
|
+
}
|
|
160
|
+
function rejected(value) {
|
|
161
|
+
try {
|
|
162
|
+
step(generator["throw"](value));
|
|
163
|
+
} catch (e) {
|
|
164
|
+
reject(e);
|
|
220
165
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
166
|
+
}
|
|
167
|
+
function step(result) {
|
|
168
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
169
|
+
}
|
|
170
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
__rest = void 0 && (void 0).__rest || function (s, e) {
|
|
174
|
+
var t = {};
|
|
175
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
176
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
177
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
178
|
+
}
|
|
179
|
+
return t;
|
|
180
|
+
};
|
|
181
|
+
document.body.addEventListener("click", e => {
|
|
182
|
+
if (e.target.offsetParent) {
|
|
183
|
+
PopupService.lastTarget = e.target;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
CSS(StyleRule().custom("contain", "none !important"), "[data-force-contain=none]");
|
|
187
|
+
CSS(StyleRule().position("relative").height(0).width(0).left(0).child(StyleRule("*").position("absolute").left(0).top(0).padding(5).maxHeight(300).overflow("auto").borderRadius(5).backgroundColor(Colors.white).zIndex(200).defaultBoxShadow()), "*[data-inline-popup=left]");
|
|
188
|
+
CSS(StyleRule().position("absolute").height(0).width(0).right(0).child(StyleRule("*").position("absolute").right(0).top(0).padding(5).maxHeight(300).overflow("auto").borderRadius(5).backgroundColor(Colors.white).zIndex(200).defaultBoxShadow()), "*[data-inline-popup=right]");
|
|
189
|
+
CSS(StyleRule().position("relative").height(0).width(0).left(0).child(StyleRule("*").position("absolute").left(0).top(0).padding(5).maxHeight(300).overflow("auto").borderRadius(5).backgroundColor(Colors.white).zIndex(200).defaultBoxShadow()), "*[data-inline-popup=inline-left]");
|
|
190
|
+
CSS(StyleRule("popup").position("fixed").left("50%").top("50%").transform("translate(-50%, -50%)").zIndex(10000).padding(5).backgroundColor(Colors.white).border("solid 1px lightgray").borderRadius(5).boxShadow("rgba(50, 50, 105, 0.15) 0px 2px 5px 0px, rgba(0, 0, 0, 0.05) 0px 1px 1px 0px;").display("inline-block"), "*[data-center-popup]");
|
|
191
|
+
popupCss = CSS(StyleRule("popup").padding(5).backgroundColor(Colors.white).border("solid 1px lightgray").borderRadius(5).boxShadow("rgba(50, 50, 105, 0.15) 0px 2px 5px 0px, rgba(0, 0, 0, 0.05) 0px 1px 1px 0px;").display("inline-block"));
|
|
192
|
+
CSS(StyleRule().position("absolute").border("solid 1px lightgray").borderRadius(5).backgroundColor(Colors.white).top("50%").left("50%").transform("translate(-50%,-50%)").boxShadow("0 0 20px 1px rgb(0 0 0 / 75%)").display("grid").alignItems("center").justifyItems("center").gridTemplateRows("auto 1fr").gridTemplateColumns("1fr").opacity("0").transition("opacity 0.3s cubic-bezier(0.55, 0.09, 0.97, 0.32)").and(StyleRule("[data-ready=true]").opacity("1")).and(StyleRule("[data-dragging=true]").opacity("0.5")).child(StyleRule(".title").justifySelf("stretch").display("flex").backgroundColor(Colors.lightGray.withAlphaPercent(0.2)).padding(5).alignItems("center").justifyItems("center").child(StyleRule(".title-text").cursor("move").flexStretch()).child(StyleRule("*").flex("1 1 100%")).child(StyleRule(".popup-close-button").fontFamily("arial").fontSize(15).flex("1 0 auto").cursor("pointer").width(30).height(30).backgroundColor(Colors.red.withAlphaPercent(0.1)).border("none").borderRadius(9999).textTransform("capitalize").hoverBackgroundColor(Colors.red))).child(StyleRule("*[data-window-content=window-content]").margin(5).alignSelf("stretch").justifySelf("stretch").flexStretch().overflow("auto").position("relative")).child(StyleRule(" * > .command-bar").backgroundColor(Colors.lightGray.withAlphaPercent(0.6)).display("flex").margin(0).padding(5).gap(5).nested(StyleRule("button").borderWidth(1).borderRadius(9999).padding(5).paddingLeft(10).paddingRight(10))), "*[data-popup-window=popup-window]");
|
|
193
|
+
_export("PopupControl", PopupControl = class PopupControl extends AtomControl {
|
|
194
|
+
static showControl(opener, _a = {}) {
|
|
195
|
+
var {
|
|
196
|
+
onClick = "close"
|
|
197
|
+
} = _a,
|
|
198
|
+
options = __rest(_a, ["onClick"]);
|
|
199
|
+
let openerElement = options === null || options === void 0 ? void 0 : options.parentElement;
|
|
200
|
+
let app;
|
|
201
|
+
if (opener instanceof AtomControl) {
|
|
202
|
+
openerElement !== null && openerElement !== void 0 ? openerElement : openerElement = opener.element;
|
|
203
|
+
app = opener.app;
|
|
204
|
+
} else {
|
|
205
|
+
openerElement !== null && openerElement !== void 0 ? openerElement : openerElement = opener;
|
|
206
|
+
let start = opener;
|
|
207
|
+
while (!start.atomControl) {
|
|
208
|
+
start = start.parentElement;
|
|
224
209
|
}
|
|
225
|
-
|
|
226
|
-
|
|
210
|
+
if (!start) {
|
|
211
|
+
return Promise.reject("Could not create popup as target is not attached");
|
|
227
212
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
213
|
+
app = start.atomControl.app;
|
|
214
|
+
}
|
|
215
|
+
const popup = new this(app);
|
|
216
|
+
if (onClick === "close") {
|
|
217
|
+
popup.bindEvent(popup.element, "click", () => setTimeout(() => popup.close(), 10));
|
|
218
|
+
} else if (onClick === "cancel") {
|
|
219
|
+
popup.bindEvent(popup.element, "click", () => setTimeout(() => popup.cancel(), 10));
|
|
220
|
+
}
|
|
221
|
+
const p = PopupService.show(openerElement, popup.element, options);
|
|
222
|
+
return new Promise((resolve, reject) => {
|
|
223
|
+
let resolved = false;
|
|
224
|
+
popup.close = r => {
|
|
225
|
+
if (resolved) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
resolved = true;
|
|
229
|
+
PopupService.lastTarget = openerElement;
|
|
230
|
+
resolve(r);
|
|
231
|
+
p.dispose();
|
|
232
|
+
};
|
|
233
|
+
popup.cancel = e => {
|
|
234
|
+
if (resolved) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
resolved = true;
|
|
238
|
+
PopupService.lastTarget = openerElement;
|
|
239
|
+
reject(e);
|
|
240
|
+
p.dispose();
|
|
241
|
+
};
|
|
242
|
+
});
|
|
253
243
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
class PopupWindow extends AtomControl_1.AtomControl {
|
|
244
|
+
});
|
|
245
|
+
_export("PopupWindow", PopupWindow = class PopupWindow extends AtomControl {
|
|
257
246
|
static showWindow(window, options) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
});
|
|
247
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
248
|
+
if (arguments.length <= 1) {
|
|
249
|
+
options = arguments[0];
|
|
250
|
+
window = this;
|
|
251
|
+
}
|
|
252
|
+
yield sleep(1);
|
|
253
|
+
return PopupService.showWindow(PopupService.lastTarget, window, options);
|
|
254
|
+
});
|
|
267
255
|
}
|
|
268
256
|
static showModal(window, options) {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
init() {
|
|
283
|
-
// do nothing...
|
|
257
|
+
var _a;
|
|
258
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
259
|
+
if (arguments.length <= 1) {
|
|
260
|
+
options = arguments[0];
|
|
261
|
+
window = this;
|
|
262
|
+
}
|
|
263
|
+
options !== null && options !== void 0 ? options : options = {};
|
|
264
|
+
(_a = options.modal) !== null && _a !== void 0 ? _a : options.modal = true;
|
|
265
|
+
yield sleep(1);
|
|
266
|
+
return PopupService.showWindow(PopupService.lastTarget, window, options);
|
|
267
|
+
});
|
|
284
268
|
}
|
|
269
|
+
init() {}
|
|
285
270
|
requestCancel() {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
}))) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
271
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
272
|
+
if (this.closeWarning) {
|
|
273
|
+
if (!(yield ConfirmPopup.showModal({
|
|
274
|
+
parameters: {
|
|
275
|
+
message: this.closeWarning
|
|
295
276
|
}
|
|
296
|
-
|
|
297
|
-
|
|
277
|
+
}))) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
this.cancel();
|
|
282
|
+
});
|
|
298
283
|
}
|
|
299
284
|
preCreate() {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
// }
|
|
315
|
-
// });
|
|
316
|
-
this.element.dataset.popupWindow = "popup-window";
|
|
317
|
-
setTimeout((p) => {
|
|
318
|
-
p.dataset.ready = "true";
|
|
319
|
-
}, 10, this.element);
|
|
285
|
+
this.title = null;
|
|
286
|
+
this.viewModelTitle = null;
|
|
287
|
+
const handler = e => {
|
|
288
|
+
if (e.key === "Escape") {
|
|
289
|
+
this.app.runAsync(() => this.requestCancel());
|
|
290
|
+
e.preventDefault();
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
this.bindEvent(this.element, "keydown", handler);
|
|
295
|
+
this.element.dataset.popupWindow = "popup-window";
|
|
296
|
+
setTimeout(p => {
|
|
297
|
+
p.dataset.ready = "true";
|
|
298
|
+
}, 10, this.element);
|
|
320
299
|
}
|
|
321
300
|
render(node, e, creator) {
|
|
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
|
-
cb.focus();
|
|
356
|
-
}
|
|
357
|
-
return;
|
|
301
|
+
var _a, _b, _c, _d, _e;
|
|
302
|
+
this.render = super.render;
|
|
303
|
+
const titleContent = (_b = (_a = this.titleRenderer) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : XNode.create("span", {
|
|
304
|
+
class: "title-text",
|
|
305
|
+
text: Bind.oneWay(() => this.title || this.viewModelTitle)
|
|
306
|
+
});
|
|
307
|
+
const closeButton = (_d = (_c = this.closeButtonRenderer) === null || _c === void 0 ? void 0 : _c.call(this)) !== null && _d !== void 0 ? _d : XNode.create("button", {
|
|
308
|
+
class: "popup-close-button",
|
|
309
|
+
text: "x",
|
|
310
|
+
eventClick: Bind.event(() => this.requestCancel())
|
|
311
|
+
});
|
|
312
|
+
const a = (_e = node.attributes) !== null && _e !== void 0 ? _e : node.attributes = {};
|
|
313
|
+
a["data-window-content"] = "window-content";
|
|
314
|
+
const extracted = this.extractControlProperties(node);
|
|
315
|
+
super.render(XNode.create("div", Object.assign({
|
|
316
|
+
viewModelTitle: Bind.oneWay(() => this.viewModel.title)
|
|
317
|
+
}, extracted), XNode.create("div", {
|
|
318
|
+
class: "title title-host"
|
|
319
|
+
}, titleContent, closeButton), node));
|
|
320
|
+
this.runAfterInit(() => {
|
|
321
|
+
if (!this.element) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const host = this.element.getElementsByClassName("title-host")[0];
|
|
325
|
+
this.setupDragging(host);
|
|
326
|
+
const anyAutofocus = this.element.querySelector(`*[autofocus]`);
|
|
327
|
+
if (!anyAutofocus) {
|
|
328
|
+
const windowContent = this.element.querySelector("[data-window-content]");
|
|
329
|
+
if (windowContent) {
|
|
330
|
+
const firstInput = windowContent.querySelector("input,button,a");
|
|
331
|
+
if (firstInput) {
|
|
332
|
+
firstInput.focus();
|
|
333
|
+
return;
|
|
358
334
|
}
|
|
359
|
-
|
|
335
|
+
}
|
|
336
|
+
const cb = this.element.querySelector(".popup-close-button");
|
|
337
|
+
if (cb) {
|
|
338
|
+
cb.focus();
|
|
339
|
+
}
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
});
|
|
360
343
|
}
|
|
361
344
|
setupDragging(tp) {
|
|
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
|
-
});
|
|
345
|
+
this.bindEvent(tp, "mousedown", startEvent => {
|
|
346
|
+
startEvent.preventDefault();
|
|
347
|
+
const disposables = [];
|
|
348
|
+
const element = this.element;
|
|
349
|
+
const offset = {
|
|
350
|
+
x: element.offsetLeft,
|
|
351
|
+
y: element.offsetTop
|
|
352
|
+
};
|
|
353
|
+
if (element.style.transform !== "none") {
|
|
354
|
+
offset.x -= element.offsetWidth / 2;
|
|
355
|
+
offset.y -= element.offsetHeight / 2;
|
|
356
|
+
element.style.left = offset.x + "px";
|
|
357
|
+
element.style.top = offset.y + "px";
|
|
358
|
+
element.style.transform = "none";
|
|
359
|
+
}
|
|
360
|
+
this.element.dataset.dragging = "true";
|
|
361
|
+
const rect = {
|
|
362
|
+
x: startEvent.clientX,
|
|
363
|
+
y: startEvent.clientY
|
|
364
|
+
};
|
|
365
|
+
const cursor = tp.style.cursor;
|
|
366
|
+
tp.style.cursor = "move";
|
|
367
|
+
disposables.push(this.bindEvent(document.body, "mousemove", moveEvent => {
|
|
368
|
+
const {
|
|
369
|
+
clientX,
|
|
370
|
+
clientY
|
|
371
|
+
} = moveEvent;
|
|
372
|
+
const dx = clientX - rect.x;
|
|
373
|
+
const dy = clientY - rect.y;
|
|
374
|
+
const finalX = offset.x + dx;
|
|
375
|
+
const finalY = offset.y + dy;
|
|
376
|
+
if (finalX < 0 || finalY < 0) {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
offset.x = finalX;
|
|
380
|
+
offset.y = finalY;
|
|
381
|
+
this.element.style.left = offset.x + "px";
|
|
382
|
+
this.element.style.top = offset.y + "px";
|
|
383
|
+
rect.x = clientX;
|
|
384
|
+
rect.y = clientY;
|
|
385
|
+
}));
|
|
386
|
+
disposables.push(this.bindEvent(document.body, "mouseup", endEvent => {
|
|
387
|
+
tp.style.cursor = cursor;
|
|
388
|
+
this.element.removeAttribute("data-dragging");
|
|
389
|
+
for (const iterator of disposables) {
|
|
390
|
+
iterator.dispose();
|
|
391
|
+
}
|
|
392
|
+
}));
|
|
393
|
+
});
|
|
403
394
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
.margin(5)
|
|
425
|
-
.marginRight(10)
|
|
426
|
-
.backgroundColor(Colors_1.default.lightGreen))
|
|
427
|
-
.nested((0, StyleRule_1.default)(".no")
|
|
428
|
-
.borderRadius(9999)
|
|
429
|
-
.paddingLeft(10)
|
|
430
|
-
.paddingRight(10)
|
|
431
|
-
.borderWidth(1)
|
|
432
|
-
.borderColor(Colors_1.default.transparent)
|
|
433
|
-
.margin(5)
|
|
434
|
-
.marginRight(10)
|
|
435
|
-
.backgroundColor(Colors_1.default.red)
|
|
436
|
-
.color(Colors_1.default.white))
|
|
437
|
-
.nested((0, StyleRule_1.default)(".cancel")
|
|
438
|
-
.borderRadius(9999)
|
|
439
|
-
.paddingLeft(10)
|
|
440
|
-
.paddingRight(10)
|
|
441
|
-
.borderWidth(1)
|
|
442
|
-
.borderColor(Colors_1.default.transparent)
|
|
443
|
-
.margin(5)
|
|
444
|
-
.marginRight(10)
|
|
445
|
-
.backgroundColor(Colors_1.default.gray))
|
|
446
|
-
.child((0, StyleRule_1.default)("[data-element=message]")
|
|
447
|
-
.overflow("auto")), "div[data-confirm-popup=confirm-popup]");
|
|
448
|
-
class ConfirmPopup extends PopupWindow {
|
|
449
|
-
static confirm({ message, title = "Confirm", yesLabel = "Yes", noLabel = "No", cancelLabel = null }) {
|
|
450
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
451
|
-
try {
|
|
452
|
-
const popup = class extends ConfirmPopup {
|
|
453
|
-
create() {
|
|
454
|
-
this.render(XNode_1.default.create("div", null, message instanceof XNode_1.default ? message : XNode_1.default.create("div", { text: message })));
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
return yield popup.showModal({
|
|
458
|
-
parameters: {
|
|
459
|
-
message,
|
|
460
|
-
yesLabel,
|
|
461
|
-
noLabel,
|
|
462
|
-
cancelLabel
|
|
463
|
-
},
|
|
464
|
-
title
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
catch (e) {
|
|
468
|
-
if (types_1.CancelToken.isCancelled(e)) {
|
|
469
|
-
return false;
|
|
470
|
-
}
|
|
471
|
-
throw e;
|
|
395
|
+
});
|
|
396
|
+
__decorate([BindableProperty, __metadata("design:type", String)], PopupWindow.prototype, "title", void 0);
|
|
397
|
+
__decorate([BindableProperty, __metadata("design:type", String)], PopupWindow.prototype, "closeWarning", void 0);
|
|
398
|
+
delete PopupWindow.prototype.init;
|
|
399
|
+
CSS(StyleRule().display("grid").nested(StyleRule(".yes").borderRadius(9999).paddingLeft(10).paddingRight(10).borderWidth(1).borderColor(Colors.transparent).margin(5).marginRight(10).backgroundColor(Colors.lightGreen)).nested(StyleRule(".no").borderRadius(9999).paddingLeft(10).paddingRight(10).borderWidth(1).borderColor(Colors.transparent).margin(5).marginRight(10).backgroundColor(Colors.red).color(Colors.white)).nested(StyleRule(".cancel").borderRadius(9999).paddingLeft(10).paddingRight(10).borderWidth(1).borderColor(Colors.transparent).margin(5).marginRight(10).backgroundColor(Colors.gray)).child(StyleRule("[data-element=message]").overflow("auto")), "div[data-confirm-popup=confirm-popup]");
|
|
400
|
+
_export("ConfirmPopup", ConfirmPopup = class ConfirmPopup extends PopupWindow {
|
|
401
|
+
static confirm({
|
|
402
|
+
message,
|
|
403
|
+
title = "Confirm",
|
|
404
|
+
yesLabel = "Yes",
|
|
405
|
+
noLabel = "No",
|
|
406
|
+
cancelLabel = null
|
|
407
|
+
}) {
|
|
408
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
409
|
+
try {
|
|
410
|
+
const popup = class extends ConfirmPopup {
|
|
411
|
+
create() {
|
|
412
|
+
this.render(XNode.create("div", null, message instanceof XNode ? message : XNode.create("div", {
|
|
413
|
+
text: message
|
|
414
|
+
})));
|
|
472
415
|
}
|
|
473
|
-
|
|
416
|
+
};
|
|
417
|
+
return yield popup.showModal({
|
|
418
|
+
parameters: {
|
|
419
|
+
message,
|
|
420
|
+
yesLabel,
|
|
421
|
+
noLabel,
|
|
422
|
+
cancelLabel
|
|
423
|
+
},
|
|
424
|
+
title
|
|
425
|
+
});
|
|
426
|
+
} catch (e) {
|
|
427
|
+
if (CancelToken.isCancelled(e)) {
|
|
428
|
+
return false;
|
|
429
|
+
}
|
|
430
|
+
throw e;
|
|
431
|
+
}
|
|
432
|
+
});
|
|
474
433
|
}
|
|
475
434
|
preCreate() {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
435
|
+
super.preCreate();
|
|
436
|
+
this.yesLabel = "Yes";
|
|
437
|
+
this.noLabel = "No";
|
|
438
|
+
this.cancelLabel = null;
|
|
480
439
|
}
|
|
481
440
|
render(node, e, creator) {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
441
|
+
var _a;
|
|
442
|
+
this.render = super.render;
|
|
443
|
+
this.element.dataset.confirmPopup = "confirm-popup";
|
|
444
|
+
this.closeButtonRenderer = () => XNode.create("div", null);
|
|
445
|
+
const extracted = this.extractControlProperties(node);
|
|
446
|
+
const na = (_a = node.attributes) !== null && _a !== void 0 ? _a : node.attributes = {};
|
|
447
|
+
na["data-element"] = "message";
|
|
448
|
+
super.render(XNode.create("div", Object.assign({}, extracted), node, XNode.create("div", {
|
|
449
|
+
"data-element": "buttons"
|
|
450
|
+
}, XNode.create("button", {
|
|
451
|
+
class: "yes",
|
|
452
|
+
autofocus: true,
|
|
453
|
+
text: Bind.oneWay(() => this.yesLabel),
|
|
454
|
+
eventClick: () => this.close(true),
|
|
455
|
+
"style-display": Bind.oneWay(() => !!this.yesLabel)
|
|
456
|
+
}), XNode.create("button", {
|
|
457
|
+
class: "no",
|
|
458
|
+
text: Bind.oneWay(() => this.noLabel),
|
|
459
|
+
eventClick: () => this.close(false),
|
|
460
|
+
"style-display": Bind.oneWay(() => !!this.noLabel)
|
|
461
|
+
}), XNode.create("button", {
|
|
462
|
+
class: "cancel",
|
|
463
|
+
text: Bind.oneWay(() => this.cancelLabel),
|
|
464
|
+
eventClick: () => this.requestCancel(),
|
|
465
|
+
"style-display": Bind.oneWay(() => !!this.cancelLabel)
|
|
466
|
+
}))));
|
|
495
467
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
function findHostAndPosition(opener) {
|
|
499
|
-
let root = opener;
|
|
500
|
-
const body = document.body;
|
|
501
|
-
let rect = opener.getBoundingClientRect();
|
|
502
|
-
const offset = {
|
|
503
|
-
x: rect.left,
|
|
504
|
-
y: rect.top,
|
|
505
|
-
handler: null,
|
|
506
|
-
root
|
|
507
|
-
};
|
|
508
|
-
do {
|
|
509
|
-
root = root.parentElement;
|
|
510
|
-
if (root === body) {
|
|
511
|
-
break;
|
|
512
|
-
}
|
|
513
|
-
if (root.parentElement.classList.contains("page-host")) {
|
|
514
|
-
break;
|
|
515
|
-
}
|
|
516
|
-
if (root.classList.contains("popup-host")) {
|
|
517
|
-
break;
|
|
518
|
-
}
|
|
519
|
-
if (root.dataset.popUpHost === "yes") {
|
|
520
|
-
break;
|
|
521
|
-
}
|
|
522
|
-
} while (true);
|
|
523
|
-
rect = root.getBoundingClientRect();
|
|
524
|
-
offset.x -= rect.x;
|
|
525
|
-
offset.y -= rect.y;
|
|
526
|
-
offset.root = root;
|
|
527
|
-
return offset;
|
|
528
|
-
}
|
|
529
|
-
function findHost(opener, offset) {
|
|
530
|
-
// let us find scrollable target offsetParent
|
|
531
|
-
var _a, _b;
|
|
532
|
-
// find host...
|
|
533
|
-
let host = opener.offsetParent;
|
|
534
|
-
while (host) {
|
|
535
|
-
const current = host;
|
|
536
|
-
if (host === document.body) {
|
|
537
|
-
// we have reached top...
|
|
538
|
-
return host;
|
|
539
|
-
}
|
|
540
|
-
if (host.classList.contains("popup-host")) {
|
|
541
|
-
// let us use this..
|
|
542
|
-
return host;
|
|
543
|
-
}
|
|
544
|
-
if (host.dataset.popUpHost === "yes") {
|
|
545
|
-
return host;
|
|
546
|
-
}
|
|
547
|
-
host = host.offsetParent;
|
|
548
|
-
if (host.classList.contains("page-host")) {
|
|
549
|
-
// we have reached popup host...
|
|
550
|
-
host = current;
|
|
551
|
-
return host;
|
|
552
|
-
}
|
|
553
|
-
if (!host) {
|
|
554
|
-
continue;
|
|
555
|
-
}
|
|
556
|
-
if (!offset) {
|
|
557
|
-
continue;
|
|
558
|
-
}
|
|
559
|
-
offset.x += host.offsetLeft;
|
|
560
|
-
offset.y += host.offsetTop - ((_b = (_a = host.offsetParent) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : 0);
|
|
561
|
-
}
|
|
562
|
-
return host;
|
|
563
|
-
}
|
|
564
|
-
const disableContain = (ce) => {
|
|
468
|
+
});
|
|
469
|
+
_export("disableContain", disableContain = ce => {
|
|
565
470
|
const containNoneList = [];
|
|
566
471
|
while (ce) {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
472
|
+
const style = window.getComputedStyle(ce);
|
|
473
|
+
const isNotNone = style.contain !== "none";
|
|
474
|
+
if (isNotNone) {
|
|
475
|
+
ce.dataset.forceContain = "none";
|
|
476
|
+
containNoneList.push(ce);
|
|
477
|
+
}
|
|
478
|
+
ce = ce.parentElement;
|
|
574
479
|
}
|
|
575
480
|
return () => {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
481
|
+
for (const iterator of containNoneList) {
|
|
482
|
+
delete iterator.dataset.forceContain;
|
|
483
|
+
}
|
|
579
484
|
};
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
let handler = null;
|
|
584
|
-
handler = (e) => {
|
|
585
|
-
var _a;
|
|
586
|
-
let start = e.target;
|
|
587
|
-
if (e.defaultPrevented) {
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
while (start) {
|
|
591
|
-
if (start === host) {
|
|
592
|
-
break;
|
|
593
|
-
}
|
|
594
|
-
if (start === opener) {
|
|
595
|
-
return;
|
|
596
|
-
}
|
|
597
|
-
if (start === container.element) {
|
|
598
|
-
return;
|
|
599
|
-
}
|
|
600
|
-
start = start.parentElement;
|
|
601
|
-
}
|
|
602
|
-
close();
|
|
603
|
-
e.preventDefault();
|
|
604
|
-
(_a = e.stopImmediatePropagation) === null || _a === void 0 ? void 0 : _a.call(e);
|
|
605
|
-
};
|
|
606
|
-
document.body.addEventListener("click", handler, true);
|
|
607
|
-
container.registerDisposable(() => document.body.removeEventListener("click", handler, true));
|
|
608
|
-
const onBack = (e) => {
|
|
609
|
-
var _a;
|
|
610
|
-
e.preventDefault();
|
|
611
|
-
(_a = e.stopImmediatePropagation) === null || _a === void 0 ? void 0 : _a.call(e);
|
|
612
|
-
e.stopPropagation();
|
|
613
|
-
close();
|
|
614
|
-
};
|
|
615
|
-
document.body.addEventListener("backButton", onBack, true);
|
|
616
|
-
container.registerDisposable(() => document.body.removeEventListener("backButton", onBack, true));
|
|
617
|
-
setTimeout(() => {
|
|
618
|
-
container.registerDisposable((0, exports.disableContain)(container.element));
|
|
619
|
-
}, 10);
|
|
620
|
-
}
|
|
621
|
-
let popupId = 1001;
|
|
622
|
-
let lastTarget = {
|
|
485
|
+
});
|
|
486
|
+
popupId = 1001;
|
|
487
|
+
lastTarget = {
|
|
623
488
|
element: null,
|
|
624
489
|
x: 10,
|
|
625
490
|
y: 10
|
|
626
|
-
|
|
627
|
-
|
|
491
|
+
};
|
|
492
|
+
_export("default", PopupService = class PopupService {
|
|
628
493
|
static get lastTarget() {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
return
|
|
494
|
+
var _a, _b;
|
|
495
|
+
const {
|
|
496
|
+
element,
|
|
497
|
+
x = 0,
|
|
498
|
+
y = 0
|
|
499
|
+
} = lastTarget;
|
|
500
|
+
if (element === null || element === void 0 ? void 0 : element.isConnected) {
|
|
501
|
+
return element;
|
|
502
|
+
}
|
|
503
|
+
const e = (_b = (_a = document.elementFromPoint) === null || _a === void 0 ? void 0 : _a.call(document, x, y)) !== null && _b !== void 0 ? _b : document.body;
|
|
504
|
+
PopupService.lastTarget = e;
|
|
505
|
+
return e;
|
|
637
506
|
}
|
|
638
507
|
static set lastTarget(element) {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
508
|
+
if (!element.isConnected) {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
const rect = element.getBoundingClientRect();
|
|
512
|
+
lastTarget = {
|
|
513
|
+
element,
|
|
514
|
+
x: rect.left + rect.width / 2,
|
|
515
|
+
y: rect.top + rect.height / 2
|
|
516
|
+
};
|
|
648
517
|
}
|
|
649
|
-
static alert({
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
noLabel: ""
|
|
662
|
-
},
|
|
663
|
-
title
|
|
664
|
-
});
|
|
518
|
+
static alert({
|
|
519
|
+
message,
|
|
520
|
+
title = "Alert",
|
|
521
|
+
yesLabel = "Ok"
|
|
522
|
+
}) {
|
|
523
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
524
|
+
try {
|
|
525
|
+
const popup = class extends ConfirmPopup {
|
|
526
|
+
create() {
|
|
527
|
+
this.render(XNode.create("div", null, message instanceof XNode ? message : XNode.create("div", {
|
|
528
|
+
text: message
|
|
529
|
+
})));
|
|
665
530
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
531
|
+
};
|
|
532
|
+
return yield popup.showModal({
|
|
533
|
+
parameters: {
|
|
534
|
+
message,
|
|
535
|
+
yesLabel,
|
|
536
|
+
noLabel: ""
|
|
537
|
+
},
|
|
538
|
+
title
|
|
539
|
+
});
|
|
540
|
+
} catch (e) {
|
|
541
|
+
if (CancelToken.isCancelled(e)) {
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
throw e;
|
|
545
|
+
}
|
|
546
|
+
});
|
|
673
547
|
}
|
|
674
|
-
static confirm({
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
},
|
|
689
|
-
title
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
catch (e) {
|
|
693
|
-
if (types_1.CancelToken.isCancelled(e)) {
|
|
694
|
-
return false;
|
|
695
|
-
}
|
|
696
|
-
throw e;
|
|
548
|
+
static confirm({
|
|
549
|
+
message,
|
|
550
|
+
title = "Confirm",
|
|
551
|
+
yesLabel = "Yes",
|
|
552
|
+
noLabel = "No",
|
|
553
|
+
cancelLabel = null
|
|
554
|
+
}) {
|
|
555
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
556
|
+
try {
|
|
557
|
+
const popup = class extends ConfirmPopup {
|
|
558
|
+
create() {
|
|
559
|
+
this.render(XNode.create("div", null, message instanceof XNode ? message : XNode.create("div", {
|
|
560
|
+
text: message
|
|
561
|
+
})));
|
|
697
562
|
}
|
|
698
|
-
|
|
563
|
+
};
|
|
564
|
+
return yield popup.showModal({
|
|
565
|
+
parameters: {
|
|
566
|
+
message,
|
|
567
|
+
yesLabel,
|
|
568
|
+
noLabel,
|
|
569
|
+
cancelLabel
|
|
570
|
+
},
|
|
571
|
+
title
|
|
572
|
+
});
|
|
573
|
+
} catch (e) {
|
|
574
|
+
if (CancelToken.isCancelled(e)) {
|
|
575
|
+
return false;
|
|
576
|
+
}
|
|
577
|
+
throw e;
|
|
578
|
+
}
|
|
579
|
+
});
|
|
699
580
|
}
|
|
700
581
|
static showWindow(opener, popupClass, popupOptions) {
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
activeElement === null || activeElement === void 0 ? void 0 : activeElement.focus();
|
|
730
|
-
}
|
|
731
|
-
catch (error) {
|
|
732
|
-
// tslint:disable-next-line: no-console
|
|
733
|
-
console.error(error);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
}, 1);
|
|
737
|
-
};
|
|
738
|
-
const cancel = (r) => {
|
|
739
|
-
// this is to allow binding events
|
|
740
|
-
// to refresh the data
|
|
741
|
-
setTimeout(() => {
|
|
742
|
-
if (!resolved) {
|
|
743
|
-
resolved = true;
|
|
744
|
-
setTimeout(reject, 1, r !== null && r !== void 0 ? r : "cancelled");
|
|
745
|
-
// if control's element is null
|
|
746
|
-
// control has been disposed and no need to dispose it
|
|
747
|
-
if (control.element) {
|
|
748
|
-
control.element.remove();
|
|
749
|
-
control.dispose();
|
|
750
|
-
}
|
|
751
|
-
element === null || element === void 0 ? void 0 : element.remove();
|
|
752
|
-
element = undefined;
|
|
753
|
-
PopupService.lastTarget = previousTarget;
|
|
754
|
-
try {
|
|
755
|
-
activeElement === null || activeElement === void 0 ? void 0 : activeElement.focus();
|
|
756
|
-
}
|
|
757
|
-
catch (error) {
|
|
758
|
-
// tslint:disable-next-line: no-console
|
|
759
|
-
console.error(error);
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
}, 1);
|
|
763
|
-
};
|
|
764
|
-
let isModal = false;
|
|
765
|
-
if (popupOptions) {
|
|
766
|
-
const { width, height, minHeight, maxHeight, minWidth, maxWidth, maximize, title, parameters, cancelToken, modal } = popupOptions;
|
|
767
|
-
if (title) {
|
|
768
|
-
vm.title = title;
|
|
769
|
-
}
|
|
770
|
-
let widthSet = false;
|
|
771
|
-
let heightSet = false;
|
|
772
|
-
if (maximize) {
|
|
773
|
-
element.style.width = "95%";
|
|
774
|
-
element.style.height = "95%";
|
|
775
|
-
widthSet = heightSet = true;
|
|
776
|
-
}
|
|
777
|
-
else {
|
|
778
|
-
if (width) {
|
|
779
|
-
element.style.width = typeof width === "number" ? width + "px" : width;
|
|
780
|
-
widthSet = true;
|
|
781
|
-
}
|
|
782
|
-
if (height) {
|
|
783
|
-
element.style.height = typeof height === "number" ? height + "px" : height;
|
|
784
|
-
heightSet = true;
|
|
785
|
-
}
|
|
786
|
-
if (minWidth) {
|
|
787
|
-
element.style.minWidth = typeof minWidth === "number" ? minWidth + "px" : minWidth;
|
|
788
|
-
widthSet = true;
|
|
789
|
-
}
|
|
790
|
-
if (minHeight) {
|
|
791
|
-
element.style.minHeight = typeof minHeight === "number" ? minHeight + "px" : minHeight;
|
|
792
|
-
heightSet = true;
|
|
793
|
-
}
|
|
794
|
-
if (maxWidth) {
|
|
795
|
-
element.style.maxWidth = typeof maxWidth === "number" ? maxWidth + "px" : maxWidth;
|
|
796
|
-
widthSet = true;
|
|
797
|
-
}
|
|
798
|
-
else {
|
|
799
|
-
element.style.maxWidth = "95%";
|
|
800
|
-
}
|
|
801
|
-
if (maxHeight) {
|
|
802
|
-
element.style.maxHeight = typeof maxHeight === "number" ? maxHeight + "px" : maxHeight;
|
|
803
|
-
heightSet = true;
|
|
804
|
-
}
|
|
805
|
-
else {
|
|
806
|
-
element.style.maxHeight = "95%";
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
if (!widthSet) {
|
|
810
|
-
element.style.maxWidth = "95%";
|
|
811
|
-
element.style.minWidth = "300px";
|
|
812
|
-
}
|
|
813
|
-
if (!heightSet) {
|
|
814
|
-
element.style.maxHeight = "95%";
|
|
815
|
-
element.style.minHeight = "100px";
|
|
816
|
-
}
|
|
817
|
-
if (parameters) {
|
|
818
|
-
for (const key in parameters) {
|
|
819
|
-
if (Object.prototype.hasOwnProperty.call(parameters, key)) {
|
|
820
|
-
const e = parameters[key];
|
|
821
|
-
vm[key] = e;
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
(_e = (_d = (_c = control).init) === null || _d === void 0 ? void 0 : _d.call(_c)) === null || _e === void 0 ? void 0 : _e.catch((error) => {
|
|
825
|
-
if (!types_1.CancelToken.isCancelled(error)) {
|
|
826
|
-
console.error(error);
|
|
827
|
-
}
|
|
828
|
-
});
|
|
829
|
-
}
|
|
830
|
-
cancelToken === null || cancelToken === void 0 ? void 0 : cancelToken.registerForCancel(cancel);
|
|
831
|
-
isModal = modal;
|
|
582
|
+
return new Promise((resolve, reject) => {
|
|
583
|
+
var _a, _b, _c, _d, _e;
|
|
584
|
+
var _f;
|
|
585
|
+
const activeElement = document.activeElement;
|
|
586
|
+
const previousTarget = opener;
|
|
587
|
+
const parent = AtomControl.from(opener);
|
|
588
|
+
const control = new popupClass(parent.app, document.createElement("div"));
|
|
589
|
+
const vm = (_a = getOwnInheritedProperty(control, "viewModel")) !== null && _a !== void 0 ? _a : "parameters" in control ? (_b = (_f = control).parameters) !== null && _b !== void 0 ? _b : _f.parameters = {} : control;
|
|
590
|
+
let element = control.element;
|
|
591
|
+
element.style.zIndex = `${popupId++}`;
|
|
592
|
+
let resolved = false;
|
|
593
|
+
const close = r => {
|
|
594
|
+
setTimeout(() => {
|
|
595
|
+
if (!resolved) {
|
|
596
|
+
resolved = true;
|
|
597
|
+
setTimeout(resolve, 1, r);
|
|
598
|
+
if (control.element) {
|
|
599
|
+
control.element.remove();
|
|
600
|
+
control.dispose();
|
|
601
|
+
}
|
|
602
|
+
element === null || element === void 0 ? void 0 : element.remove();
|
|
603
|
+
element = undefined;
|
|
604
|
+
PopupService.lastTarget = previousTarget;
|
|
605
|
+
try {
|
|
606
|
+
activeElement === null || activeElement === void 0 ? void 0 : activeElement.focus();
|
|
607
|
+
} catch (error) {
|
|
608
|
+
console.error(error);
|
|
609
|
+
}
|
|
832
610
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
if (
|
|
838
|
-
|
|
839
|
-
|
|
611
|
+
}, 1);
|
|
612
|
+
};
|
|
613
|
+
const cancel = r => {
|
|
614
|
+
setTimeout(() => {
|
|
615
|
+
if (!resolved) {
|
|
616
|
+
resolved = true;
|
|
617
|
+
setTimeout(reject, 1, r !== null && r !== void 0 ? r : "cancelled");
|
|
618
|
+
if (control.element) {
|
|
619
|
+
control.element.remove();
|
|
620
|
+
control.dispose();
|
|
621
|
+
}
|
|
622
|
+
element === null || element === void 0 ? void 0 : element.remove();
|
|
623
|
+
element = undefined;
|
|
624
|
+
PopupService.lastTarget = previousTarget;
|
|
625
|
+
try {
|
|
626
|
+
activeElement === null || activeElement === void 0 ? void 0 : activeElement.focus();
|
|
627
|
+
} catch (error) {
|
|
628
|
+
console.error(error);
|
|
629
|
+
}
|
|
840
630
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
631
|
+
}, 1);
|
|
632
|
+
};
|
|
633
|
+
let isModal = false;
|
|
634
|
+
if (popupOptions) {
|
|
635
|
+
const {
|
|
636
|
+
width,
|
|
637
|
+
height,
|
|
638
|
+
minHeight,
|
|
639
|
+
maxHeight,
|
|
640
|
+
minWidth,
|
|
641
|
+
maxWidth,
|
|
642
|
+
maximize,
|
|
643
|
+
title,
|
|
644
|
+
parameters,
|
|
645
|
+
cancelToken,
|
|
646
|
+
modal
|
|
647
|
+
} = popupOptions;
|
|
648
|
+
if (title) {
|
|
649
|
+
vm.title = title;
|
|
650
|
+
}
|
|
651
|
+
let widthSet = false;
|
|
652
|
+
let heightSet = false;
|
|
653
|
+
if (maximize) {
|
|
654
|
+
element.style.width = "95%";
|
|
655
|
+
element.style.height = "95%";
|
|
656
|
+
widthSet = heightSet = true;
|
|
657
|
+
} else {
|
|
658
|
+
if (width) {
|
|
659
|
+
element.style.width = typeof width === "number" ? width + "px" : width;
|
|
660
|
+
widthSet = true;
|
|
854
661
|
}
|
|
855
|
-
|
|
856
|
-
|
|
662
|
+
if (height) {
|
|
663
|
+
element.style.height = typeof height === "number" ? height + "px" : height;
|
|
664
|
+
heightSet = true;
|
|
857
665
|
}
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
* Display given popup attached to given opener and returns
|
|
862
|
-
* disposable that can be used to dispose the popup
|
|
863
|
-
* @param opener Element which opens this popup
|
|
864
|
-
* @param popup Popup Element, it must be rendered within the opener's parent
|
|
865
|
-
* @param options IPopupOptions
|
|
866
|
-
* @returns IDisposable
|
|
867
|
-
*/
|
|
868
|
-
static show(opener, popup, options) {
|
|
869
|
-
var _a, _b;
|
|
870
|
-
const previousTarget = opener;
|
|
871
|
-
const container = {
|
|
872
|
-
element: document.createElement("div"),
|
|
873
|
-
disposables: new AtomDisposableList_1.AtomDisposableList(),
|
|
874
|
-
registerDisposable: null,
|
|
875
|
-
dispose: null,
|
|
876
|
-
};
|
|
877
|
-
container.registerDisposable = (f) => container.disposables.add(f);
|
|
878
|
-
let alignment = (_a = options === null || options === void 0 ? void 0 : options.alignment) !== null && _a !== void 0 ? _a : "auto";
|
|
879
|
-
if (alignment === "auto") {
|
|
880
|
-
const rect = opener.getBoundingClientRect();
|
|
881
|
-
const w = window.visualViewport.width;
|
|
882
|
-
if (rect.left > w / 2) {
|
|
883
|
-
alignment = "bottomRight";
|
|
666
|
+
if (minWidth) {
|
|
667
|
+
element.style.minWidth = typeof minWidth === "number" ? minWidth + "px" : minWidth;
|
|
668
|
+
widthSet = true;
|
|
884
669
|
}
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
container.element._logicalParent = opener;
|
|
889
|
-
container.element.classList.add(popupStyle);
|
|
890
|
-
if (isCenterOfScreen) {
|
|
891
|
-
container.element.dataset.centerPopup = "center";
|
|
892
|
-
}
|
|
893
|
-
else {
|
|
894
|
-
container.element.dataset.inlinePopup = "left";
|
|
895
|
-
const alignPopup = () => {
|
|
896
|
-
switch (alignment) {
|
|
897
|
-
case "bottomRight":
|
|
898
|
-
container.element.style.top = (opener.offsetTop + opener.offsetHeight) + "px";
|
|
899
|
-
container.element.style.right = "0px";
|
|
900
|
-
container.element.dataset.inlinePopup = "right";
|
|
901
|
-
opener.insertAdjacentElement("afterend", container.element);
|
|
902
|
-
break;
|
|
903
|
-
case "topRight":
|
|
904
|
-
case "right":
|
|
905
|
-
container.element.style.top = (opener.offsetTop) + "px";
|
|
906
|
-
container.element.style.left = (opener.offsetWidth) + "px";
|
|
907
|
-
opener.insertAdjacentElement("afterend", container.element);
|
|
908
|
-
break;
|
|
909
|
-
case "bottomLeft":
|
|
910
|
-
container.element.dataset.inlinePopup = "inline-left";
|
|
911
|
-
container.element.style.top = (opener.offsetTop + opener.offsetHeight) + "px";
|
|
912
|
-
opener.insertAdjacentElement("beforebegin", container.element);
|
|
913
|
-
break;
|
|
914
|
-
default:
|
|
915
|
-
container.element.style.top = (opener.offsetTop + opener.offsetHeight) + "px";
|
|
916
|
-
opener.insertAdjacentElement("afterend", container.element);
|
|
917
|
-
break;
|
|
918
|
-
}
|
|
919
|
-
};
|
|
920
|
-
if (opener.offsetParent !== opener.parentElement) {
|
|
921
|
-
opener.parentElement.style.position = "relative";
|
|
922
|
-
setTimeout(alignPopup, 5);
|
|
670
|
+
if (minHeight) {
|
|
671
|
+
element.style.minHeight = typeof minHeight === "number" ? minHeight + "px" : minHeight;
|
|
672
|
+
heightSet = true;
|
|
923
673
|
}
|
|
924
|
-
|
|
925
|
-
|
|
674
|
+
if (maxWidth) {
|
|
675
|
+
element.style.maxWidth = typeof maxWidth === "number" ? maxWidth + "px" : maxWidth;
|
|
676
|
+
widthSet = true;
|
|
677
|
+
} else {
|
|
678
|
+
element.style.maxWidth = "95%";
|
|
926
679
|
}
|
|
680
|
+
if (maxHeight) {
|
|
681
|
+
element.style.maxHeight = typeof maxHeight === "number" ? maxHeight + "px" : maxHeight;
|
|
682
|
+
heightSet = true;
|
|
683
|
+
} else {
|
|
684
|
+
element.style.maxHeight = "95%";
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
if (!widthSet) {
|
|
688
|
+
element.style.maxWidth = "95%";
|
|
689
|
+
element.style.minWidth = "300px";
|
|
690
|
+
}
|
|
691
|
+
if (!heightSet) {
|
|
692
|
+
element.style.maxHeight = "95%";
|
|
693
|
+
element.style.minHeight = "100px";
|
|
694
|
+
}
|
|
695
|
+
if (parameters) {
|
|
696
|
+
for (const key in parameters) {
|
|
697
|
+
if (Object.prototype.hasOwnProperty.call(parameters, key)) {
|
|
698
|
+
const e = parameters[key];
|
|
699
|
+
vm[key] = e;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
(_e = (_d = (_c = control).init) === null || _d === void 0 ? void 0 : _d.call(_c)) === null || _e === void 0 ? void 0 : _e.catch(error => {
|
|
703
|
+
if (!CancelToken.isCancelled(error)) {
|
|
704
|
+
console.error(error);
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
cancelToken === null || cancelToken === void 0 ? void 0 : cancelToken.registerForCancel(cancel);
|
|
709
|
+
isModal = modal;
|
|
927
710
|
}
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
711
|
+
const host = findHost(opener);
|
|
712
|
+
host.appendChild(control.element);
|
|
713
|
+
vm.cancel = cancel;
|
|
714
|
+
vm.close = close;
|
|
715
|
+
if (vm !== control) {
|
|
716
|
+
control.cancel = cancel;
|
|
717
|
+
control.close = close;
|
|
935
718
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
// style.transform = "translate(-50%,-50%)";
|
|
948
|
-
// } else {
|
|
949
|
-
// if (!options || options?.alignment === "auto") {
|
|
950
|
-
// // check where is more space??
|
|
951
|
-
// if (offset.x < (host.offsetWidth / 2)) {
|
|
952
|
-
// style.left = offset.x + "px";
|
|
953
|
-
// } else {
|
|
954
|
-
// style.right = `${(host.offsetWidth - (offset.x + opener.offsetWidth))}px`;
|
|
955
|
-
// }
|
|
956
|
-
// if (offset.y < (hostHeight / 2)) {
|
|
957
|
-
// style.top = offset.y + "px";
|
|
958
|
-
// } else {
|
|
959
|
-
// style.top = `${offset.y - opener.offsetHeight}px`;
|
|
960
|
-
// style.transform = "translate(0, -100%)";
|
|
961
|
-
// }
|
|
962
|
-
// } else {
|
|
963
|
-
// offset.y -= opener.offsetHeight;
|
|
964
|
-
// style.top = offset.y + "px";
|
|
965
|
-
// if (options?.alignment === "right") {
|
|
966
|
-
// style.left = `${(opener.offsetLeft + opener.offsetWidth)}px`;
|
|
967
|
-
// } else {
|
|
968
|
-
// style.left = offset.x + "px";
|
|
969
|
-
// }
|
|
970
|
-
// }
|
|
971
|
-
// }
|
|
972
|
-
style.zIndex = `${popupId++}`;
|
|
973
|
-
// host.appendChild(container.element);
|
|
974
|
-
container.dispose = () => {
|
|
975
|
-
if (!container.disposables) {
|
|
976
|
-
return;
|
|
719
|
+
if (isModal) {
|
|
720
|
+
const bg = document.createElement("div");
|
|
721
|
+
bg.style.position = "absolute";
|
|
722
|
+
bg.style.right = "0";
|
|
723
|
+
bg.style.bottom = "0";
|
|
724
|
+
bg.style.left = "0";
|
|
725
|
+
bg.style.top = "0";
|
|
726
|
+
host.appendChild(bg);
|
|
727
|
+
control.registerDisposable({
|
|
728
|
+
dispose: () => {
|
|
729
|
+
bg.remove();
|
|
977
730
|
}
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
731
|
+
});
|
|
732
|
+
} else {
|
|
733
|
+
closeHandler(host, opener, control, cancel);
|
|
734
|
+
}
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
static show(opener, popup, options) {
|
|
738
|
+
var _a, _b;
|
|
739
|
+
const previousTarget = opener;
|
|
740
|
+
const container = {
|
|
741
|
+
element: document.createElement("div"),
|
|
742
|
+
disposables: new AtomDisposableList(),
|
|
743
|
+
registerDisposable: null,
|
|
744
|
+
dispose: null
|
|
745
|
+
};
|
|
746
|
+
container.registerDisposable = f => container.disposables.add(f);
|
|
747
|
+
let alignment = (_a = options === null || options === void 0 ? void 0 : options.alignment) !== null && _a !== void 0 ? _a : "auto";
|
|
748
|
+
if (alignment === "auto") {
|
|
749
|
+
const rect = opener.getBoundingClientRect();
|
|
750
|
+
const w = window.visualViewport.width;
|
|
751
|
+
if (rect.left > w / 2) {
|
|
752
|
+
alignment = "bottomRight";
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
const isCenterOfScreen = alignment === "centerOfScreen";
|
|
756
|
+
const popupStyle = (_b = options === null || options === void 0 ? void 0 : options.popupStyle) !== null && _b !== void 0 ? _b : popupCss;
|
|
757
|
+
container.element._logicalParent = opener;
|
|
758
|
+
container.element.classList.add(popupStyle);
|
|
759
|
+
if (isCenterOfScreen) {
|
|
760
|
+
container.element.dataset.centerPopup = "center";
|
|
761
|
+
} else {
|
|
762
|
+
container.element.dataset.inlinePopup = "left";
|
|
763
|
+
const alignPopup = () => {
|
|
764
|
+
switch (alignment) {
|
|
765
|
+
case "bottomRight":
|
|
766
|
+
container.element.style.top = opener.offsetTop + opener.offsetHeight + "px";
|
|
767
|
+
container.element.style.right = "0px";
|
|
768
|
+
container.element.dataset.inlinePopup = "right";
|
|
769
|
+
opener.insertAdjacentElement("afterend", container.element);
|
|
770
|
+
break;
|
|
771
|
+
case "topRight":
|
|
772
|
+
case "right":
|
|
773
|
+
container.element.style.top = opener.offsetTop + "px";
|
|
774
|
+
container.element.style.left = opener.offsetWidth + "px";
|
|
775
|
+
opener.insertAdjacentElement("afterend", container.element);
|
|
776
|
+
break;
|
|
777
|
+
case "bottomLeft":
|
|
778
|
+
container.element.dataset.inlinePopup = "inline-left";
|
|
779
|
+
container.element.style.top = opener.offsetTop + opener.offsetHeight + "px";
|
|
780
|
+
opener.insertAdjacentElement("beforebegin", container.element);
|
|
781
|
+
break;
|
|
782
|
+
default:
|
|
783
|
+
container.element.style.top = opener.offsetTop + opener.offsetHeight + "px";
|
|
784
|
+
opener.insertAdjacentElement("afterend", container.element);
|
|
785
|
+
break;
|
|
786
|
+
}
|
|
983
787
|
};
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
788
|
+
if (opener.offsetParent !== opener.parentElement) {
|
|
789
|
+
opener.parentElement.style.position = "relative";
|
|
790
|
+
setTimeout(alignPopup, 5);
|
|
791
|
+
} else {
|
|
792
|
+
alignPopup();
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
const parent = AtomControl.from(opener);
|
|
796
|
+
if (popup instanceof XNode) {
|
|
797
|
+
parent.render(popup, container);
|
|
798
|
+
} else {
|
|
799
|
+
container.element.appendChild(popup);
|
|
800
|
+
}
|
|
801
|
+
const style = container.element.style;
|
|
802
|
+
style.zIndex = `${popupId++}`;
|
|
803
|
+
container.dispose = () => {
|
|
804
|
+
if (!container.disposables) {
|
|
805
|
+
return;
|
|
992
806
|
}
|
|
993
|
-
|
|
807
|
+
container.disposables.dispose();
|
|
808
|
+
parent.dispose(container.element);
|
|
809
|
+
container.element.remove();
|
|
810
|
+
container.disposables = null;
|
|
811
|
+
PopupService.lastTarget = previousTarget;
|
|
812
|
+
};
|
|
813
|
+
closeHandler(opener.parentElement, opener, container, () => {
|
|
814
|
+
const e = container.element;
|
|
815
|
+
container.dispose();
|
|
816
|
+
e.remove();
|
|
817
|
+
});
|
|
818
|
+
const ct = options === null || options === void 0 ? void 0 : options.cancelToken;
|
|
819
|
+
if (ct) {
|
|
820
|
+
ct.registerForCancel(() => container.dispose());
|
|
821
|
+
}
|
|
822
|
+
return container;
|
|
994
823
|
}
|
|
824
|
+
});
|
|
995
825
|
}
|
|
996
|
-
|
|
997
|
-
});
|
|
998
|
-
//# sourceMappingURL
|
|
826
|
+
};
|
|
827
|
+
});
|
|
828
|
+
//# sourceMappingURL=/home/runner/work/core/core/dist/web/services/PopupService.js.map
|