@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,243 +6,278 @@ import { CancelToken, errorHandled } from "../core/types.js";
|
|
|
6
6
|
import JsonError from "../services/http/JsonError.js";
|
|
7
7
|
import PopupService, { NotifyType } from "../web/services/PopupService.js";
|
|
8
8
|
export class MarkBusySet {
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
9
|
+
static {
|
|
10
|
+
this.none = new MarkBusySet(function* () {});
|
|
11
|
+
}
|
|
12
|
+
static {
|
|
13
|
+
this.target = new MarkBusySet(function* (t, ct) {
|
|
14
|
+
yield t;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
static {
|
|
18
|
+
this.currentTarget = new MarkBusySet(function* (t, ct) {
|
|
19
|
+
yield ct;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
static {
|
|
23
|
+
this.tillCurrentTarget = new MarkBusySet(function* (target, currentTarget) {
|
|
24
|
+
let start = target;
|
|
25
|
+
do {
|
|
26
|
+
yield start;
|
|
27
|
+
start = start.parentElement;
|
|
28
|
+
} while (start !== currentTarget);
|
|
29
|
+
yield currentTarget;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
static {
|
|
33
|
+
this.button = new MarkBusySet(function* (target, currentTarget) {
|
|
34
|
+
let start = target;
|
|
35
|
+
while (start) {
|
|
36
|
+
if (start.tagName === "BUTTON") {
|
|
37
|
+
yield start;
|
|
38
|
+
break;
|
|
33
39
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
start = start.parentElement;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
static {
|
|
45
|
+
this.buttonOrAnchor = new MarkBusySet(function* (target, currentTarget) {
|
|
46
|
+
let start = target;
|
|
47
|
+
while (start) {
|
|
48
|
+
if (start.tagName === "BUTTON" || start.tagName === "A") {
|
|
49
|
+
yield start;
|
|
50
|
+
break;
|
|
43
51
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
52
|
+
start = start.parentElement;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
static selector(selector) {
|
|
57
|
+
return new MarkBusySet(function* (target, currentTarget) {
|
|
58
|
+
let start = target;
|
|
59
|
+
while (start) {
|
|
60
|
+
if (start.matches(selector)) {
|
|
61
|
+
yield start;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
start = start.parentElement;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
static {
|
|
69
|
+
this.allAncestors = new MarkBusySet(function* (target, currentTarget) {
|
|
70
|
+
do {
|
|
71
|
+
yield target;
|
|
72
|
+
target = target.parentElement;
|
|
73
|
+
} while (target);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
constructor(set) {
|
|
77
|
+
this.set = set;
|
|
78
|
+
}
|
|
79
|
+
*find(event) {
|
|
80
|
+
yield* this.set(event.target, event.currentTarget);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const onEventHandler = (owner, blockMultipleExecution, key, busyKey, onEventSetBusy) => async ce => {
|
|
84
|
+
const element = ce.currentTarget;
|
|
85
|
+
if (owner[busyKey]) {
|
|
86
|
+
if (blockMultipleExecution) {
|
|
87
|
+
return;
|
|
56
88
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.set = set;
|
|
89
|
+
}
|
|
90
|
+
owner[busyKey] = true;
|
|
91
|
+
try {
|
|
92
|
+
if (onEventSetBusy) {
|
|
93
|
+
for (const iterator of onEventSetBusy.find(ce)) {
|
|
94
|
+
iterator.setAttribute("data-busy", "true");
|
|
95
|
+
}
|
|
65
96
|
}
|
|
66
|
-
|
|
67
|
-
|
|
97
|
+
const detail = ce.detail;
|
|
98
|
+
return await owner[key](detail, ce);
|
|
99
|
+
} finally {
|
|
100
|
+
delete owner[busyKey];
|
|
101
|
+
if (onEventSetBusy) {
|
|
102
|
+
for (const iterator of onEventSetBusy.find(ce)) {
|
|
103
|
+
iterator.removeAttribute("data-busy");
|
|
104
|
+
}
|
|
68
105
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
export default function Action({
|
|
109
|
+
onEvent = void 0,
|
|
110
|
+
onEventTarget = void 0,
|
|
111
|
+
onEventSetBusy,
|
|
112
|
+
blockMultipleExecution = true,
|
|
113
|
+
dispatchEvent,
|
|
114
|
+
authorize = void 0,
|
|
115
|
+
defer = void 0,
|
|
116
|
+
success = null,
|
|
117
|
+
successTitle = "Done",
|
|
118
|
+
successMode = "notify",
|
|
119
|
+
confirm = null,
|
|
120
|
+
confirmTitle = null,
|
|
121
|
+
validate = false,
|
|
122
|
+
validateTitle = null,
|
|
123
|
+
close = false,
|
|
124
|
+
notifyDelay = 2000
|
|
125
|
+
} = {}) {
|
|
126
|
+
return (target, key, descriptor) => {
|
|
127
|
+
const getEventNames = names => {
|
|
128
|
+
if (names === null || names === void 0) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (Array.isArray(names)) {
|
|
132
|
+
return names.map(getEventNames);
|
|
133
|
+
}
|
|
134
|
+
if (names instanceof Command) {
|
|
135
|
+
onEventTarget ??= window;
|
|
136
|
+
return names.eventScope.eventType;
|
|
137
|
+
}
|
|
138
|
+
if (names instanceof EventScope) {
|
|
139
|
+
onEventTarget ??= window;
|
|
140
|
+
return names.eventType;
|
|
141
|
+
}
|
|
142
|
+
return names;
|
|
143
|
+
};
|
|
144
|
+
onEvent = getEventNames(onEvent);
|
|
145
|
+
if (onEvent?.length > 0) {
|
|
146
|
+
const oldCreate = target.beginEdit;
|
|
147
|
+
if (oldCreate) {
|
|
148
|
+
const onEventName = Array.isArray(onEvent) ? onEvent.map(StringHelper.fromHyphenToCamel) : StringHelper.fromHyphenToCamel(onEvent);
|
|
149
|
+
const busyKey = Symbol.for("isBusy" + key.toString());
|
|
150
|
+
target.beginEdit = function () {
|
|
151
|
+
const result = oldCreate.apply(this, arguments);
|
|
152
|
+
const c = this;
|
|
153
|
+
let element = this.element;
|
|
154
|
+
if (element) {
|
|
155
|
+
if (onEventTarget) {
|
|
156
|
+
element = onEventTarget;
|
|
82
157
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
for (const iterator of onEventSetBusy.find(ce)) {
|
|
91
|
-
iterator.removeAttribute("data-busy");
|
|
158
|
+
const handler = onEventHandler(c, blockMultipleExecution, key, busyKey, onEventSetBusy);
|
|
159
|
+
if (typeof onEventName === "string") {
|
|
160
|
+
c.bindEvent(element, onEventName, handler);
|
|
161
|
+
} else {
|
|
162
|
+
for (const eventName of onEventName) {
|
|
163
|
+
c.bindEvent(element, eventName, handler);
|
|
164
|
+
}
|
|
92
165
|
}
|
|
93
|
-
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
94
170
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
171
|
+
const {
|
|
172
|
+
value
|
|
173
|
+
} = descriptor;
|
|
174
|
+
const deferSymbol = defer ? Symbol.for(`${key.toString()}Defer`) : void 0;
|
|
175
|
+
return {
|
|
176
|
+
get: function () {
|
|
177
|
+
const vm = this;
|
|
178
|
+
const oldMethod = value;
|
|
179
|
+
const fx = async function (...a) {
|
|
180
|
+
const vm = this;
|
|
181
|
+
if (defer) {
|
|
182
|
+
const previous = vm[deferSymbol];
|
|
183
|
+
if (previous !== 0) {
|
|
184
|
+
if (previous > 0) {
|
|
185
|
+
clearTimeout(previous);
|
|
186
|
+
}
|
|
187
|
+
vm[deferSymbol] = setTimeout(() => {
|
|
188
|
+
vm[deferSymbol] = 0;
|
|
189
|
+
const r = vm[key](...a);
|
|
190
|
+
delete vm[deferSymbol];
|
|
191
|
+
return r;
|
|
192
|
+
}, defer);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const app = vm.app;
|
|
197
|
+
try {
|
|
198
|
+
if (authorize && !App.authorize()) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (validate) {
|
|
202
|
+
if (!vm.isValid) {
|
|
203
|
+
const vMsg = typeof validate === "boolean" ? "Please enter correct information" : validate;
|
|
204
|
+
await PopupService.alert({
|
|
205
|
+
message: vMsg,
|
|
206
|
+
title: validateTitle || "Error"
|
|
207
|
+
});
|
|
100
208
|
return;
|
|
209
|
+
}
|
|
101
210
|
}
|
|
102
|
-
if (
|
|
103
|
-
|
|
211
|
+
if (confirm) {
|
|
212
|
+
if (!(await PopupService.confirm({
|
|
213
|
+
message: confirm,
|
|
214
|
+
title: confirmTitle || "Confirm"
|
|
215
|
+
}))) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
104
218
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
219
|
+
let result = oldMethod.apply(vm, a);
|
|
220
|
+
if (result?.then) {
|
|
221
|
+
result = await result;
|
|
108
222
|
}
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
|
|
223
|
+
if (success) {
|
|
224
|
+
if (successMode === "notify") {
|
|
225
|
+
await PopupService.notify(success, successTitle, NotifyType.Information, notifyDelay);
|
|
226
|
+
} else {
|
|
227
|
+
await PopupService.alert({
|
|
228
|
+
message: success,
|
|
229
|
+
title: successTitle
|
|
230
|
+
});
|
|
231
|
+
}
|
|
112
232
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
onEvent = getEventNames(onEvent);
|
|
116
|
-
if (onEvent?.length > 0) {
|
|
117
|
-
const oldCreate = target.beginEdit;
|
|
118
|
-
if (oldCreate) {
|
|
119
|
-
const onEventName = Array.isArray(onEvent)
|
|
120
|
-
? onEvent.map(StringHelper.fromHyphenToCamel)
|
|
121
|
-
: StringHelper.fromHyphenToCamel(onEvent);
|
|
122
|
-
const busyKey = Symbol.for("isBusy" + key.toString());
|
|
123
|
-
target.beginEdit = function () {
|
|
124
|
-
const result = oldCreate.apply(this, arguments);
|
|
125
|
-
const c = this;
|
|
126
|
-
let element = this.element;
|
|
127
|
-
if (element) {
|
|
128
|
-
if (onEventTarget) {
|
|
129
|
-
element = onEventTarget;
|
|
130
|
-
}
|
|
131
|
-
const handler = onEventHandler(c, blockMultipleExecution, key, busyKey, onEventSetBusy);
|
|
132
|
-
if (typeof onEventName === "string") {
|
|
133
|
-
c.bindEvent(element, onEventName, handler);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
for (const eventName of onEventName) {
|
|
137
|
-
c.bindEvent(element, eventName, handler);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return result;
|
|
142
|
-
};
|
|
233
|
+
if (close) {
|
|
234
|
+
vm.close?.(result);
|
|
143
235
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (authorize && !App.authorize()) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
if (validate) {
|
|
174
|
-
if (!vm.isValid) {
|
|
175
|
-
const vMsg = typeof validate === "boolean"
|
|
176
|
-
? "Please enter correct information"
|
|
177
|
-
: validate;
|
|
178
|
-
await PopupService.alert({ message: vMsg, title: validateTitle || "Error" });
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
if (confirm) {
|
|
183
|
-
if (!await PopupService.confirm({
|
|
184
|
-
message: confirm,
|
|
185
|
-
title: confirmTitle || "Confirm"
|
|
186
|
-
})) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
let result = oldMethod.apply(vm, a);
|
|
191
|
-
if (result?.then) {
|
|
192
|
-
result = await result;
|
|
193
|
-
}
|
|
194
|
-
if (success) {
|
|
195
|
-
if (successMode === "notify") {
|
|
196
|
-
await PopupService.notify(success, successTitle, NotifyType.Information, notifyDelay);
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
await PopupService.alert({ message: success, title: successTitle });
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
if (close) {
|
|
203
|
-
vm.close?.(result);
|
|
204
|
-
}
|
|
205
|
-
if (dispatchEvent) {
|
|
206
|
-
const element = (vm.element ?? document.body);
|
|
207
|
-
if (typeof dispatchEvent !== "string") {
|
|
208
|
-
dispatchEvent = dispatchEvent.eventType;
|
|
209
|
-
}
|
|
210
|
-
element.dispatchEvent(new CustomEvent(dispatchEvent, { detail: result, bubbles: true }));
|
|
211
|
-
}
|
|
212
|
-
return result;
|
|
213
|
-
}
|
|
214
|
-
catch (e) {
|
|
215
|
-
if (CancelToken.isCancelled(e)) {
|
|
216
|
-
throw e;
|
|
217
|
-
}
|
|
218
|
-
e[errorHandled] = true;
|
|
219
|
-
if (/^timeout$/i.test(e.toString().trim())) {
|
|
220
|
-
console.warn(e);
|
|
221
|
-
throw e;
|
|
222
|
-
}
|
|
223
|
-
if (e instanceof JsonError) {
|
|
224
|
-
if (e.details) {
|
|
225
|
-
await PopupService.alert({
|
|
226
|
-
message: e.message,
|
|
227
|
-
title: "Error",
|
|
228
|
-
detail: e.details
|
|
229
|
-
});
|
|
230
|
-
throw e;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
await PopupService.alert({ message: e, title: "Error" });
|
|
234
|
-
throw e;
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
Object.defineProperty(vm, key, {
|
|
238
|
-
value: fx,
|
|
239
|
-
writable: true,
|
|
240
|
-
enumerable: false
|
|
236
|
+
if (dispatchEvent) {
|
|
237
|
+
const element = vm.element ?? document.body;
|
|
238
|
+
if (typeof dispatchEvent !== "string") {
|
|
239
|
+
dispatchEvent = dispatchEvent.eventType;
|
|
240
|
+
}
|
|
241
|
+
element.dispatchEvent(new CustomEvent(dispatchEvent, {
|
|
242
|
+
detail: result,
|
|
243
|
+
bubbles: true
|
|
244
|
+
}));
|
|
245
|
+
}
|
|
246
|
+
return result;
|
|
247
|
+
} catch (e) {
|
|
248
|
+
if (CancelToken.isCancelled(e)) {
|
|
249
|
+
throw e;
|
|
250
|
+
}
|
|
251
|
+
e[errorHandled] = true;
|
|
252
|
+
if (/^timeout$/i.test(e.toString().trim())) {
|
|
253
|
+
console.warn(e);
|
|
254
|
+
throw e;
|
|
255
|
+
}
|
|
256
|
+
if (e instanceof JsonError) {
|
|
257
|
+
if (e.details) {
|
|
258
|
+
await PopupService.alert({
|
|
259
|
+
message: e.message,
|
|
260
|
+
title: "Error",
|
|
261
|
+
detail: e.details
|
|
241
262
|
});
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
263
|
+
throw e;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
await PopupService.alert({
|
|
267
|
+
message: e,
|
|
268
|
+
title: "Error"
|
|
269
|
+
});
|
|
270
|
+
throw e;
|
|
271
|
+
}
|
|
245
272
|
};
|
|
273
|
+
Object.defineProperty(vm, key, {
|
|
274
|
+
value: fx,
|
|
275
|
+
writable: true,
|
|
276
|
+
enumerable: false
|
|
277
|
+
});
|
|
278
|
+
return fx;
|
|
279
|
+
},
|
|
280
|
+
configurable: true
|
|
246
281
|
};
|
|
247
|
-
}
|
|
248
|
-
|
|
282
|
+
};
|
|
283
|
+
}
|