@web-atoms/core 2.6.21 → 2.6.25
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.d.ts +1 -1
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js.map +1 -1
- package/dist/core/SingleInvoker.d.ts.map +1 -1
- package/dist/core/SingleInvoker.js.map +1 -1
- package/dist/core/sleep.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist-esm/App.d.ts +1 -1
- package/dist-esm/App.d.ts.map +1 -1
- package/dist-esm/App.js +231 -235
- package/dist-esm/App.js.map +1 -1
- package/dist-esm/Atom.js +93 -96
- package/dist-esm/MockApp.js +17 -18
- package/dist-esm/Pack.js +1 -3
- package/dist-esm/core/AtomBinder.js +189 -187
- package/dist-esm/core/AtomComponent.js +479 -502
- package/dist-esm/core/AtomDispatcher.js +46 -48
- package/dist-esm/core/AtomDisposableList.js +24 -25
- package/dist-esm/core/AtomEnumerator.js +15 -16
- package/dist-esm/core/AtomList.js +193 -192
- package/dist-esm/core/AtomLoader.js +229 -215
- package/dist-esm/core/AtomMap.js +7 -8
- package/dist-esm/core/AtomOnce.js +22 -24
- package/dist-esm/core/AtomSelectableList.js +240 -243
- package/dist-esm/core/AtomUri.js +70 -72
- package/dist-esm/core/AtomWatcher.js +105 -111
- package/dist-esm/core/Bind.js +271 -269
- package/dist-esm/core/BindableProperty.js +26 -27
- package/dist-esm/core/CancelTokenFactory.js +21 -24
- package/dist-esm/core/Color.js +1 -2
- package/dist-esm/core/Colors.js +545 -231
- package/dist-esm/core/Command.js +236 -223
- package/dist-esm/core/Defer.js +21 -22
- package/dist-esm/core/EventScope.js +96 -88
- package/dist-esm/core/ExpressionParser.js +132 -144
- package/dist-esm/core/ExtendControl.js +7 -8
- package/dist-esm/core/FormattedError.js +7 -8
- package/dist-esm/core/FormattedString.js +4 -5
- package/dist-esm/core/Hacks.js +41 -42
- package/dist-esm/core/IFetchEvent.js +1 -2
- package/dist-esm/core/IScreen.js +1 -2
- package/dist-esm/core/IValueConverter.js +1 -2
- package/dist-esm/core/InheritedProperty.js +61 -63
- package/dist-esm/core/InjectProperty.js +12 -13
- package/dist-esm/core/KeyValuePairs.js +1 -2
- package/dist-esm/core/Markdown.js +14 -17
- package/dist-esm/core/MarkdownError.js +6 -7
- package/dist-esm/core/PropertyBinding.js +1 -2
- package/dist-esm/core/PropertyMap.js +28 -27
- package/dist-esm/core/Route.js +149 -148
- package/dist-esm/core/SingleInvoker.d.ts.map +1 -1
- package/dist-esm/core/SingleInvoker.js +32 -35
- package/dist-esm/core/SingleInvoker.js.map +1 -1
- package/dist-esm/core/StringHelper.js +49 -51
- package/dist-esm/core/TransientDisposable.js +14 -16
- package/dist-esm/core/WatchProperty.js +18 -17
- package/dist-esm/core/WebImage.js +7 -8
- package/dist-esm/core/XNode.js +134 -117
- package/dist-esm/core/sleep.js +21 -24
- package/dist-esm/core/sleep.js.map +1 -1
- package/dist-esm/core/types.js +102 -103
- package/dist-esm/di/DISingleton.js +7 -5
- package/dist-esm/di/DITransient.js +7 -5
- package/dist-esm/di/IMockOrInject.js +1 -2
- package/dist-esm/di/IServiceProvider.js +1 -2
- package/dist-esm/di/Inject.js +67 -67
- package/dist-esm/di/Register.js +25 -26
- package/dist-esm/di/RegisterScoped.js +4 -3
- package/dist-esm/di/RegisterSingleton.js +4 -3
- package/dist-esm/di/ServiceCollection.js +38 -37
- package/dist-esm/di/ServiceProvider.js +94 -94
- package/dist-esm/di/TypeKey.js +13 -12
- package/dist-esm/services/BusyIndicatorService.js +7 -11
- package/dist-esm/services/CacheService.js +54 -62
- package/dist-esm/services/FetchBuilder.js +327 -278
- package/dist-esm/services/JsonService.js +118 -116
- package/dist-esm/services/MockNavigationService.js +127 -126
- package/dist-esm/services/NavigationService.js +95 -102
- package/dist-esm/services/ReferenceService.js +30 -33
- package/dist-esm/services/http/AjaxOptions.js +1 -3
- package/dist-esm/services/http/JsonError.js +16 -15
- package/dist-esm/services/http/RestService.js +314 -323
- package/dist-esm/style/StyleRule.js +1 -2
- package/dist-esm/test.js +0 -1
- package/dist-esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist-esm/unit/AtomTest.js +10 -11
- package/dist-esm/view-model/Action.js +258 -223
- package/dist-esm/view-model/AtomViewModel.js +234 -232
- package/dist-esm/view-model/AtomWindowViewModel.js +13 -14
- package/dist-esm/view-model/BindableUrlParameter.js +7 -8
- package/dist-esm/view-model/Delay.js +21 -25
- package/dist-esm/view-model/Disposable.js +28 -29
- package/dist-esm/view-model/Load.js +72 -73
- package/dist-esm/view-model/Once.js +33 -35
- package/dist-esm/view-model/baseTypes.js +4 -5
- package/dist-esm/view-model/bindPromise.js +24 -27
- package/dist-esm/view-model/bindProperty.js +3 -4
- package/dist-esm/view-model/bindUrlParameter.js +39 -43
- package/dist-esm/web/controls/AtomComboBox.js +56 -63
- package/dist-esm/web/controls/AtomControl.js +485 -490
- package/dist-esm/web/controls/AtomGridSplitter.js +57 -50
- package/dist-esm/web/controls/AtomGridView.js +230 -222
- package/dist-esm/web/controls/AtomItemsControl.js +677 -688
- package/dist-esm/web/controls/AtomPage.js +6 -7
- package/dist-esm/web/controls/AtomTemplate.js +1 -3
- package/dist-esm/web/controls/AtomTemplateControl.js +28 -29
- package/dist-esm/web/controls/AtomViewStack.js +19 -20
- package/dist-esm/web/core/AtomUI.js +200 -200
- package/dist-esm/web/core/Encoder.js +142 -152
- package/dist-esm/web/core/HtmlNode.js +141 -139
- package/dist-esm/web/images/Busy.js +1 -2
- package/dist-esm/web/images/BusyDataUrl.js +2 -869
- package/dist-esm/web/images/Button.js +1 -2
- package/dist-esm/web/images/ButtonDataUrl.js +2 -30
- package/dist-esm/web/images/CloseButton.js +1 -2
- package/dist-esm/web/images/CloseButtonDataUrl.js +2 -30
- package/dist-esm/web/images/CloseButtonHover.js +1 -2
- package/dist-esm/web/images/CloseButtonHoverDataUrl.js +2 -24
- package/dist-esm/web/services/LastTarget.js +31 -29
- package/dist-esm/web/services/MarkdownService.js +19 -31
- package/dist-esm/web/services/NotificationPopup.js +28 -21
- package/dist-esm/web/services/PopupService.js +512 -478
- package/dist-esm/web/services/PopupWindow.js +266 -247
- package/dist-esm/web/styles/AtomAlertWindowStyle.js +39 -40
- package/dist-esm/web/styles/AtomFrameStyle.js +15 -16
- package/dist-esm/web/styles/AtomNotificationStyle.js +19 -20
- package/dist-esm/web/styles/AtomPageLinkStyle.js +11 -12
- package/dist-esm/web/styles/AtomPopupStyle.js +9 -10
- package/dist-esm/web/styles/AtomStyle.js +61 -64
- package/dist-esm/web/styles/AtomStyleSheet.js +50 -51
- package/dist-esm/web/styles/AtomWindowStyle.js +116 -117
- package/dist-esm/web/styles/IStyleDeclaration.js +1 -2
- package/dist-esm/web/styles/StyleBuilder.js +79 -80
- package/package.json +3 -1
- package/src/App.ts +1 -1
- package/src/core/SingleInvoker.ts +1 -1
- package/src/core/sleep.ts +1 -1
|
@@ -6,270 +6,289 @@ import sleep from "../../core/sleep.js";
|
|
|
6
6
|
import { CancelToken } from "../../core/types.js";
|
|
7
7
|
import { AtomControl } from "../controls/AtomControl.js";
|
|
8
8
|
import { ChildEnumerator } from "../core/AtomUI.js";
|
|
9
|
-
import
|
|
9
|
+
ESMPack.installStyleSheet(import.meta.resolve("./PopupWindow.global.css"));
|
|
10
10
|
let popupService;
|
|
11
11
|
const loadPopupService = async () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
if (popupService) {
|
|
13
|
+
return popupService;
|
|
14
|
+
}
|
|
15
|
+
return popupService = (await import("./PopupService.js")).default;
|
|
16
16
|
};
|
|
17
|
-
const focus =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const focus = popup => {
|
|
18
|
+
const element = popup.element;
|
|
19
|
+
if (!element) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const host = element.querySelector(`[data-window-element="title"]`) ?? element.querySelector(`[data-window-element="action-bar"]`);
|
|
23
|
+
if (host) {
|
|
24
|
+
popup.setupDragging(host);
|
|
25
|
+
}
|
|
26
|
+
const anyAutofocus = element.querySelector(`*[autofocus]`);
|
|
27
|
+
if (!anyAutofocus) {
|
|
28
|
+
const cb = element.querySelector(".popup-close-button");
|
|
29
|
+
if (cb) {
|
|
30
|
+
cb.focus();
|
|
21
31
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
popup.setupDragging(host);
|
|
26
|
-
}
|
|
27
|
-
const anyAutofocus = element.querySelector(`*[autofocus]`);
|
|
28
|
-
if (!anyAutofocus) {
|
|
29
|
-
const cb = element.querySelector(".popup-close-button");
|
|
30
|
-
if (cb) {
|
|
31
|
-
cb.focus();
|
|
32
|
-
}
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
anyAutofocus.focus?.();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
anyAutofocus.focus?.();
|
|
36
35
|
};
|
|
37
36
|
export default class PopupWindow extends AtomControl {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
constructor() {
|
|
38
|
+
super(...arguments);
|
|
39
|
+
this.initialized = false;
|
|
40
|
+
}
|
|
41
|
+
static async showWindow(window, options) {
|
|
42
|
+
if (arguments.length <= 1) {
|
|
43
|
+
options = arguments[0];
|
|
44
|
+
window = this;
|
|
41
45
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
await sleep(1);
|
|
47
|
+
const PS = await loadPopupService();
|
|
48
|
+
return PS.showWindow(PS.lastTarget, window, options);
|
|
49
|
+
}
|
|
50
|
+
static async showModal(window, options) {
|
|
51
|
+
if (arguments.length <= 1) {
|
|
52
|
+
options = arguments[0];
|
|
53
|
+
window = this;
|
|
50
54
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
options ??= {};
|
|
56
|
+
options.modal ??= true;
|
|
57
|
+
await sleep(1);
|
|
58
|
+
const PS = await loadPopupService();
|
|
59
|
+
return PS.showWindow(PS.lastTarget, window, options);
|
|
60
|
+
}
|
|
61
|
+
onPropertyChanged(name) {
|
|
62
|
+
super.onPropertyChanged(name);
|
|
63
|
+
switch (name) {
|
|
64
|
+
case "iconRenderer":
|
|
65
|
+
this.recreate(name, "icon");
|
|
66
|
+
break;
|
|
67
|
+
case "actionBarRenderer":
|
|
68
|
+
this.recreate(name, "action-bar");
|
|
69
|
+
break;
|
|
70
|
+
case "footerRenderer":
|
|
71
|
+
this.recreate(name, "footer");
|
|
72
|
+
break;
|
|
73
|
+
case "titleRenderer":
|
|
74
|
+
this.recreate(name, "title");
|
|
75
|
+
break;
|
|
76
|
+
case "headerRenderer":
|
|
77
|
+
this.recreate(name, "header");
|
|
78
|
+
break;
|
|
79
|
+
case "closeButtonRenderer":
|
|
80
|
+
this.recreate(name, "close");
|
|
81
|
+
break;
|
|
61
82
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
case "footerRenderer":
|
|
72
|
-
this.recreate(name, "footer");
|
|
73
|
-
break;
|
|
74
|
-
case "titleRenderer":
|
|
75
|
-
this.recreate(name, "title");
|
|
76
|
-
break;
|
|
77
|
-
case "headerRenderer":
|
|
78
|
-
this.recreate(name, "header");
|
|
79
|
-
break;
|
|
80
|
-
case "closeButtonRenderer":
|
|
81
|
-
this.recreate(name, "close");
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
83
|
+
}
|
|
84
|
+
init() {}
|
|
85
|
+
async requestCancel() {
|
|
86
|
+
if (this.closeWarning) {
|
|
87
|
+
if (!(await ConfirmPopup.confirm({
|
|
88
|
+
message: this.closeWarning
|
|
89
|
+
}))) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
84
92
|
}
|
|
85
|
-
|
|
93
|
+
this.cancel();
|
|
94
|
+
}
|
|
95
|
+
recreate(renderer, name) {
|
|
96
|
+
const node = this[renderer]?.() ?? undefined;
|
|
97
|
+
for (const e of ChildEnumerator.enumerate(this.element)) {
|
|
98
|
+
if (e.getAttribute("data-window-element") === name) {
|
|
99
|
+
this.dispose(e);
|
|
100
|
+
e.remove();
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
86
103
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
this.cancel();
|
|
104
|
+
if (node) {
|
|
105
|
+
const na = node.attributes ??= {};
|
|
106
|
+
na["data-window-element"] = name;
|
|
107
|
+
super.render(XNode.create("div", null, node));
|
|
108
|
+
return this.element.querySelector(`[data-window-element="${name}"]`);
|
|
96
109
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (node) {
|
|
107
|
-
const na = node.attributes ??= {};
|
|
108
|
-
na["data-window-element"] = name;
|
|
109
|
-
super.render(XNode.create("div", null, node));
|
|
110
|
-
return this.element.querySelector(`[data-window-element="${name}"]`);
|
|
111
|
-
}
|
|
112
|
-
return null;
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
rendererChanged() {
|
|
113
|
+
for (const content of ChildEnumerator.where(this.element, e => e.getAttribute("data-window-element") === "content")) {
|
|
114
|
+
this.dispose(content);
|
|
115
|
+
content.remove();
|
|
113
116
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
117
|
+
const r = this.renderer;
|
|
118
|
+
if (!r) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
delete this.render;
|
|
122
|
+
this.render(r);
|
|
123
|
+
}
|
|
124
|
+
preCreate() {
|
|
125
|
+
this.title = null;
|
|
126
|
+
this.viewModelTitle = null;
|
|
127
|
+
this.element.setAttribute("not-ready", "1");
|
|
128
|
+
const c = new CancelToken();
|
|
129
|
+
this.cancelToken = c;
|
|
130
|
+
this.registerDisposable({
|
|
131
|
+
dispose() {
|
|
132
|
+
c.cancel();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
const handler = e => {
|
|
136
|
+
if (e.key === "Escape") {
|
|
137
|
+
this.app.runAsync(() => this.requestCancel());
|
|
138
|
+
e.preventDefault();
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
this.bindEvent(this.element, "keydown", handler);
|
|
143
|
+
this.element.setAttribute("data-popup-window", "popup-window");
|
|
144
|
+
const p = this.element;
|
|
145
|
+
this.bindEvent(this.element, "popupReady", e => {
|
|
146
|
+
if (e.defaultPrevented) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
p.setAttribute("data-ready", "true");
|
|
150
|
+
const parent = p.offsetParent ?? document.body;
|
|
151
|
+
const left = `${(parent.offsetWidth - p.offsetWidth) / 2}px`;
|
|
152
|
+
const top = `${(parent.offsetHeight - p.offsetHeight) / 2}px`;
|
|
153
|
+
p.style.left = left;
|
|
154
|
+
p.style.top = top;
|
|
155
|
+
p.removeAttribute("not-ready");
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
render(node, e, creator) {
|
|
159
|
+
if (e || node?.attributes?.["data-window-element"]) {
|
|
160
|
+
super.render(node, e, creator);
|
|
161
|
+
return;
|
|
125
162
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
p.setAttribute("data-ready", "true");
|
|
152
|
-
const parent = (p.offsetParent ?? document.body);
|
|
153
|
-
const left = `${(parent.offsetWidth - p.offsetWidth) / 2}px`;
|
|
154
|
-
const top = `${(parent.offsetHeight - p.offsetHeight) / 2}px`;
|
|
155
|
-
p.style.left = left;
|
|
156
|
-
p.style.top = top;
|
|
157
|
-
p.removeAttribute("not-ready");
|
|
158
|
-
});
|
|
163
|
+
this.render = super.render;
|
|
164
|
+
this.titleRenderer ??= () => XNode.create("div", {
|
|
165
|
+
class: "title-text",
|
|
166
|
+
text: Bind.oneWay(() => this.title || this.viewModelTitle)
|
|
167
|
+
});
|
|
168
|
+
this.closeButtonRenderer ??= () => XNode.create("button", {
|
|
169
|
+
class: "popup-close-button",
|
|
170
|
+
text: "x",
|
|
171
|
+
eventClick: Bind.event(() => this.requestCancel())
|
|
172
|
+
});
|
|
173
|
+
this.actionBarRenderer ??= () => XNode.create("div", null);
|
|
174
|
+
const a = node.attributes ??= {};
|
|
175
|
+
a["data-window-content"] = "window-content";
|
|
176
|
+
a["data-window-element"] = "content";
|
|
177
|
+
const extracted = this.extractControlProperties(node);
|
|
178
|
+
super.render(XNode.create("div", {
|
|
179
|
+
viewModelTitle: Bind.oneWay(() => this.viewModel.title),
|
|
180
|
+
...extracted
|
|
181
|
+
}, node), e, creator);
|
|
182
|
+
if (!this.initialized) {
|
|
183
|
+
this.initialized = true;
|
|
184
|
+
this.runAfterInit(() => {
|
|
185
|
+
setTimeout(focus, 100, this);
|
|
186
|
+
});
|
|
159
187
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
188
|
+
}
|
|
189
|
+
setupDragging(tp) {
|
|
190
|
+
this.bindEvent(tp, "mousedown", startEvent => {
|
|
191
|
+
if (startEvent.target.tagName === "BUTTON") {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
startEvent.preventDefault();
|
|
195
|
+
const disposables = [];
|
|
196
|
+
const element = this.element;
|
|
197
|
+
const offset = {
|
|
198
|
+
x: element.offsetLeft,
|
|
199
|
+
y: element.offsetTop
|
|
200
|
+
};
|
|
201
|
+
this.element.dataset.dragging = "true";
|
|
202
|
+
const rect = {
|
|
203
|
+
x: startEvent.clientX,
|
|
204
|
+
y: startEvent.clientY
|
|
205
|
+
};
|
|
206
|
+
const cursor = tp.style.cursor;
|
|
207
|
+
tp.style.cursor = "move";
|
|
208
|
+
disposables.push(this.bindEvent(document.body, "mousemove", moveEvent => {
|
|
209
|
+
const {
|
|
210
|
+
clientX,
|
|
211
|
+
clientY
|
|
212
|
+
} = moveEvent;
|
|
213
|
+
const dx = clientX - rect.x;
|
|
214
|
+
const dy = clientY - rect.y;
|
|
215
|
+
const finalX = offset.x + dx;
|
|
216
|
+
const finalY = offset.y + dy;
|
|
217
|
+
if (finalX < 5 || finalY < 5) {
|
|
218
|
+
return;
|
|
164
219
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
this.
|
|
168
|
-
this.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
setTimeout(focus, 100, this);
|
|
178
|
-
});
|
|
220
|
+
offset.x = finalX;
|
|
221
|
+
offset.y = finalY;
|
|
222
|
+
this.element.style.left = offset.x + "px";
|
|
223
|
+
this.element.style.top = offset.y + "px";
|
|
224
|
+
rect.x = clientX;
|
|
225
|
+
rect.y = clientY;
|
|
226
|
+
}));
|
|
227
|
+
disposables.push(this.bindEvent(document.body, "mouseup", endEvent => {
|
|
228
|
+
tp.style.cursor = cursor;
|
|
229
|
+
this.element.removeAttribute("data-dragging");
|
|
230
|
+
for (const iterator of disposables) {
|
|
231
|
+
iterator.dispose();
|
|
179
232
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (startEvent.target.tagName === "BUTTON") {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
startEvent.preventDefault();
|
|
187
|
-
const disposables = [];
|
|
188
|
-
const element = this.element;
|
|
189
|
-
const offset = { x: element.offsetLeft, y: element.offsetTop };
|
|
190
|
-
this.element.dataset.dragging = "true";
|
|
191
|
-
const rect = { x: startEvent.clientX, y: startEvent.clientY };
|
|
192
|
-
const cursor = tp.style.cursor;
|
|
193
|
-
tp.style.cursor = "move";
|
|
194
|
-
disposables.push(this.bindEvent(document.body, "mousemove", (moveEvent) => {
|
|
195
|
-
const { clientX, clientY } = moveEvent;
|
|
196
|
-
const dx = clientX - rect.x;
|
|
197
|
-
const dy = clientY - rect.y;
|
|
198
|
-
const finalX = offset.x + dx;
|
|
199
|
-
const finalY = offset.y + dy;
|
|
200
|
-
if (finalX < 5 || finalY < 5) {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
offset.x = finalX;
|
|
204
|
-
offset.y = finalY;
|
|
205
|
-
this.element.style.left = offset.x + "px";
|
|
206
|
-
this.element.style.top = offset.y + "px";
|
|
207
|
-
rect.x = clientX;
|
|
208
|
-
rect.y = clientY;
|
|
209
|
-
}));
|
|
210
|
-
disposables.push(this.bindEvent(document.body, "mouseup", (endEvent) => {
|
|
211
|
-
tp.style.cursor = cursor;
|
|
212
|
-
this.element.removeAttribute("data-dragging");
|
|
213
|
-
for (const iterator of disposables) {
|
|
214
|
-
iterator.dispose();
|
|
215
|
-
}
|
|
216
|
-
}));
|
|
217
|
-
});
|
|
218
|
-
}
|
|
233
|
+
}));
|
|
234
|
+
});
|
|
235
|
+
}
|
|
219
236
|
}
|
|
220
|
-
__decorate([
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
], PopupWindow.prototype, "
|
|
224
|
-
__decorate([
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
], PopupWindow.prototype, "
|
|
228
|
-
__decorate([
|
|
229
|
-
BindableProperty,
|
|
230
|
-
__metadata("design:type", Function)
|
|
231
|
-
], PopupWindow.prototype, "closeButtonRenderer", void 0);
|
|
232
|
-
__decorate([
|
|
233
|
-
BindableProperty,
|
|
234
|
-
__metadata("design:type", Function)
|
|
235
|
-
], PopupWindow.prototype, "footerRenderer", void 0);
|
|
236
|
-
__decorate([
|
|
237
|
-
BindableProperty,
|
|
238
|
-
__metadata("design:type", Function)
|
|
239
|
-
], PopupWindow.prototype, "headerRenderer", void 0);
|
|
240
|
-
__decorate([
|
|
241
|
-
BindableProperty,
|
|
242
|
-
__metadata("design:type", Function)
|
|
243
|
-
], PopupWindow.prototype, "iconRenderer", void 0);
|
|
244
|
-
__decorate([
|
|
245
|
-
BindableProperty,
|
|
246
|
-
__metadata("design:type", Function)
|
|
247
|
-
], PopupWindow.prototype, "actionBarRenderer", void 0);
|
|
248
|
-
__decorate([
|
|
249
|
-
BindableProperty,
|
|
250
|
-
__metadata("design:type", String)
|
|
251
|
-
], PopupWindow.prototype, "closeWarning", void 0);
|
|
237
|
+
__decorate([BindableProperty, __metadata("design:type", String)], PopupWindow.prototype, "title", void 0);
|
|
238
|
+
__decorate([BindableProperty, __metadata("design:type", Function)], PopupWindow.prototype, "titleRenderer", void 0);
|
|
239
|
+
__decorate([BindableProperty, __metadata("design:type", Function)], PopupWindow.prototype, "closeButtonRenderer", void 0);
|
|
240
|
+
__decorate([BindableProperty, __metadata("design:type", Function)], PopupWindow.prototype, "footerRenderer", void 0);
|
|
241
|
+
__decorate([BindableProperty, __metadata("design:type", Function)], PopupWindow.prototype, "headerRenderer", void 0);
|
|
242
|
+
__decorate([BindableProperty, __metadata("design:type", Function)], PopupWindow.prototype, "iconRenderer", void 0);
|
|
243
|
+
__decorate([BindableProperty, __metadata("design:type", Function)], PopupWindow.prototype, "actionBarRenderer", void 0);
|
|
244
|
+
__decorate([BindableProperty, __metadata("design:type", String)], PopupWindow.prototype, "closeWarning", void 0);
|
|
252
245
|
delete PopupWindow.prototype.init;
|
|
253
246
|
export class ConfirmPopup extends PopupWindow {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
247
|
+
static async confirm({
|
|
248
|
+
message,
|
|
249
|
+
title = "Confirm",
|
|
250
|
+
yesLabel = "Yes",
|
|
251
|
+
noLabel = "No",
|
|
252
|
+
cancelLabel = null
|
|
253
|
+
}) {
|
|
254
|
+
const PS = await loadPopupService();
|
|
255
|
+
return PS.confirm({
|
|
256
|
+
title,
|
|
257
|
+
message,
|
|
258
|
+
yesLabel,
|
|
259
|
+
noLabel,
|
|
260
|
+
cancelLabel
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
preCreate() {
|
|
264
|
+
super.preCreate();
|
|
265
|
+
this.yesLabel = "Yes";
|
|
266
|
+
this.noLabel = "No";
|
|
267
|
+
this.cancelLabel = null;
|
|
268
|
+
this.element.setAttribute("data-confirm-popup", "confirm-popup");
|
|
269
|
+
this.footerRenderer = () => XNode.create("div", null, XNode.create("button", {
|
|
270
|
+
class: "yes",
|
|
271
|
+
autofocus: true,
|
|
272
|
+
text: Bind.oneWay(() => this.yesLabel),
|
|
273
|
+
eventClick: () => this.close(true),
|
|
274
|
+
"style-display": Bind.oneWay(() => !!this.yesLabel)
|
|
275
|
+
}), XNode.create("button", {
|
|
276
|
+
class: "no",
|
|
277
|
+
text: Bind.oneWay(() => this.noLabel),
|
|
278
|
+
eventClick: () => this.close(false),
|
|
279
|
+
"style-display": Bind.oneWay(() => !!this.noLabel)
|
|
280
|
+
}), XNode.create("button", {
|
|
281
|
+
class: "cancel",
|
|
282
|
+
text: Bind.oneWay(() => this.cancelLabel),
|
|
283
|
+
eventClick: () => this.requestCancel(),
|
|
284
|
+
"style-display": Bind.oneWay(() => !!this.cancelLabel)
|
|
285
|
+
}));
|
|
286
|
+
this.closeButtonRenderer = () => XNode.create("div", {
|
|
287
|
+
"style-display": "none"
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
requestCancel() {
|
|
291
|
+
this.cancel();
|
|
292
|
+
return Promise.resolve();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
import Colors from "../../core/Colors.js";
|
|
2
2
|
import { AtomWindowStyle } from "./AtomWindowStyle.js";
|
|
3
3
|
export default class AtomAlertWindowStyle extends AtomWindowStyle {
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=AtomAlertWindowStyle.js.map
|
|
4
|
+
get titleHost() {
|
|
5
|
+
return {
|
|
6
|
+
...this.getBaseProperty(AtomAlertWindowStyle, "titleHost"),
|
|
7
|
+
color: Colors.black,
|
|
8
|
+
backgroundColor: Colors.white
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
get contentPresenter() {
|
|
12
|
+
return {
|
|
13
|
+
...this.getBaseProperty(AtomAlertWindowStyle, "contentPresenter"),
|
|
14
|
+
padding: "0px 10px 30px 10px",
|
|
15
|
+
textAlign: "center",
|
|
16
|
+
color: Colors.rgba(51, 51, 51)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
get commandBar() {
|
|
20
|
+
return {
|
|
21
|
+
...this.getBaseProperty(AtomAlertWindowStyle, "commandBar"),
|
|
22
|
+
textAlign: "center",
|
|
23
|
+
subclasses: {
|
|
24
|
+
" button": this.buttonStyle,
|
|
25
|
+
" .yes-button": {
|
|
26
|
+
backgroundColor: Colors.rgba(0, 128, 0)
|
|
27
|
+
},
|
|
28
|
+
" .no-button": {
|
|
29
|
+
backgroundColor: Colors.rgba(255, 0, 0)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
get buttonStyle() {
|
|
35
|
+
return {
|
|
36
|
+
border: "none",
|
|
37
|
+
color: Colors.white,
|
|
38
|
+
width: "50%",
|
|
39
|
+
height: "40px"
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { AtomStyle } from "./AtomStyle.js";
|
|
2
2
|
import StyleBuilder from "./StyleBuilder.js";
|
|
3
3
|
export default class AtomFrameStyle extends AtomStyle {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=AtomFrameStyle.js.map
|
|
4
|
+
get root() {
|
|
5
|
+
return {
|
|
6
|
+
...StyleBuilder.newStyle.absolute(0, 0).toStyle(),
|
|
7
|
+
width: "100%",
|
|
8
|
+
height: "100%",
|
|
9
|
+
subclasses: {
|
|
10
|
+
" > *": {
|
|
11
|
+
...StyleBuilder.newStyle.absolute(0, 0).toStyle(),
|
|
12
|
+
width: "100%",
|
|
13
|
+
height: "100%"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|