@web-atoms/core 2.1.479 → 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.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/dist/core/Bind.js
CHANGED
|
@@ -1,425 +1,333 @@
|
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// }
|
|
49
|
-
// if (b.combined) {
|
|
50
|
-
// const a = {
|
|
51
|
-
// // it is `this`
|
|
52
|
-
// t: creator,
|
|
53
|
-
// // it is first parameter
|
|
54
|
-
// x: control
|
|
55
|
-
// };
|
|
56
|
-
// control.bind(e, name, b.combined , false, () => {
|
|
57
|
-
// // tslint:disable-next-line: ban-types
|
|
58
|
-
// return (b.sourcePath as Function).call(creator, control, e);
|
|
59
|
-
// }, a);
|
|
60
|
-
// return;
|
|
61
|
-
// }
|
|
62
|
-
// if (b.thisPathList) {
|
|
63
|
-
// control.bind(e, name, b.thisPathList , false, () => {
|
|
64
|
-
// // tslint:disable-next-line: ban-types
|
|
65
|
-
// return (b.sourcePath as Function).call(creator, control, e);
|
|
66
|
-
// }, creator);
|
|
67
|
-
// return;
|
|
68
|
-
// }
|
|
69
|
-
// }
|
|
70
|
-
// function twoWays(name: string, b: Bind, control: IAtomComponent, e: any, creator: any) {
|
|
71
|
-
// control.bind(e,
|
|
72
|
-
// name,
|
|
73
|
-
// b.thisPathList || b.pathList, (b.eventList as any) || true, null, b.thisPathList ? creator : undefined);
|
|
74
|
-
// }
|
|
75
|
-
function twoWaysConvert(name, b, control, e, creator) {
|
|
76
|
-
control.bind(e, name, b.thisPathList || b.pathList, b.eventList || true, null, b.thisPathList ? creator : undefined);
|
|
77
|
-
}
|
|
78
|
-
exports.bindSymbol = Symbol("Bind");
|
|
79
|
-
class Bind {
|
|
1
|
+
System.register(["./ExpressionParser", "./types"], function (_export, _context) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var parsePath, parsePathLists, CancelToken, ignoreValue, Bind, __awaiter, isEvent, bindSymbol;
|
|
5
|
+
function twoWaysConvert(name, b, control, e, creator) {
|
|
6
|
+
control.bind(e, name, b.thisPathList || b.pathList, b.eventList || true, null, b.thisPathList ? creator : undefined);
|
|
7
|
+
}
|
|
8
|
+
_export("default", void 0);
|
|
9
|
+
return {
|
|
10
|
+
setters: [function (_ExpressionParser) {
|
|
11
|
+
parsePath = _ExpressionParser.parsePath;
|
|
12
|
+
parsePathLists = _ExpressionParser.parsePathLists;
|
|
13
|
+
}, function (_types) {
|
|
14
|
+
CancelToken = _types.CancelToken;
|
|
15
|
+
ignoreValue = _types.ignoreValue;
|
|
16
|
+
}],
|
|
17
|
+
execute: function () {
|
|
18
|
+
__awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
19
|
+
function adopt(value) {
|
|
20
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
21
|
+
resolve(value);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
25
|
+
function fulfilled(value) {
|
|
26
|
+
try {
|
|
27
|
+
step(generator.next(value));
|
|
28
|
+
} catch (e) {
|
|
29
|
+
reject(e);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function rejected(value) {
|
|
33
|
+
try {
|
|
34
|
+
step(generator["throw"](value));
|
|
35
|
+
} catch (e) {
|
|
36
|
+
reject(e);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function step(result) {
|
|
40
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
41
|
+
}
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
isEvent = /^event/i;
|
|
46
|
+
_export("bindSymbol", bindSymbol = Symbol("Bind"));
|
|
47
|
+
_export("default", Bind = class Bind {
|
|
80
48
|
static forControl() {
|
|
81
|
-
|
|
49
|
+
return Bind;
|
|
82
50
|
}
|
|
83
51
|
static forData() {
|
|
84
|
-
|
|
52
|
+
return Bind;
|
|
85
53
|
}
|
|
86
54
|
static forViewModel() {
|
|
87
|
-
|
|
55
|
+
return Bind;
|
|
88
56
|
}
|
|
89
57
|
static forLocalViewModel() {
|
|
90
|
-
|
|
58
|
+
return Bind;
|
|
91
59
|
}
|
|
92
60
|
static presenter(name) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
c = c._logicalParent || c.parentElement;
|
|
106
|
-
}
|
|
107
|
-
((c && c.atomControl) || control)[n] = e;
|
|
61
|
+
return {
|
|
62
|
+
[bindSymbol](cn, control, e, creator) {
|
|
63
|
+
if (typeof name === "function") {
|
|
64
|
+
name(control);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const n = name || cn;
|
|
68
|
+
let c = control.element;
|
|
69
|
+
while (c) {
|
|
70
|
+
if (c.atomControl && c.atomControl[n] !== undefined) {
|
|
71
|
+
break;
|
|
108
72
|
}
|
|
109
|
-
|
|
73
|
+
c = c._logicalParent || c.parentElement;
|
|
74
|
+
}
|
|
75
|
+
(c && c.atomControl || control)[n] = e;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
110
78
|
}
|
|
111
|
-
// tslint:disable-next-line: ban-types
|
|
112
79
|
static event(sourcePath) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
control.bindEvent(e, name, (e1) => {
|
|
126
|
-
return sourcePath(control, e1);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
80
|
+
return {
|
|
81
|
+
[bindSymbol](name, control, e) {
|
|
82
|
+
control.runAfterInit(() => {
|
|
83
|
+
if (isEvent.test(name)) {
|
|
84
|
+
name = name.substring(5);
|
|
85
|
+
if (name.startsWith("-")) {
|
|
86
|
+
name = name.substring(1).replace(/-([a-z])/g, g => g[1].toUpperCase());
|
|
87
|
+
} else {
|
|
88
|
+
name = name[0].toLowerCase() + name.substring(1);
|
|
89
|
+
}
|
|
129
90
|
}
|
|
130
|
-
|
|
91
|
+
control.bindEvent(e, name, e1 => {
|
|
92
|
+
return sourcePath(control, e1);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
};
|
|
131
97
|
}
|
|
132
|
-
/**
|
|
133
|
-
* Bind the expression one time
|
|
134
|
-
* @param sourcePath Lambda Expression for binding
|
|
135
|
-
* @param now Default value to set immediately
|
|
136
|
-
*/
|
|
137
98
|
static oneTime(sourcePath, now) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
99
|
+
return {
|
|
100
|
+
[bindSymbol](name, control, e) {
|
|
101
|
+
control.runAfterInit(() => {
|
|
102
|
+
control.setLocalValue(e, name, sourcePath(control, e));
|
|
103
|
+
});
|
|
104
|
+
if (typeof now !== "undefined") {
|
|
105
|
+
control.setLocalValue(e, name, now);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
148
109
|
}
|
|
149
|
-
/**
|
|
150
|
-
* Bind the expression one time
|
|
151
|
-
* @param sourcePath Lambda Expression for binding
|
|
152
|
-
* @param now Default value to set immediately
|
|
153
|
-
*/
|
|
154
110
|
static oneTimeAsync(sourcePath, now) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
111
|
+
return {
|
|
112
|
+
[bindSymbol](name, control, e) {
|
|
113
|
+
control.runAfterInit(() => {
|
|
114
|
+
control.app.runAsync(() => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const value = yield sourcePath(control, e, new CancelToken());
|
|
116
|
+
control.setLocalValue(e, name, value);
|
|
117
|
+
}));
|
|
118
|
+
});
|
|
119
|
+
if (typeof now !== "undefined") {
|
|
120
|
+
control.setLocalValue(e, name, now);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
168
124
|
}
|
|
169
|
-
/**
|
|
170
|
-
* Bind the expression one way with source, you cannot reference
|
|
171
|
-
* `this` inside this context, it will not watch `this`
|
|
172
|
-
* @param source source to watch
|
|
173
|
-
* @param path Lambda Expression for binding
|
|
174
|
-
* @param now Default value to set immediately
|
|
175
|
-
*/
|
|
176
125
|
static source(source, path, now) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
126
|
+
const lists = parsePath(path, false).map(x => ["this", ...x]);
|
|
127
|
+
return {
|
|
128
|
+
[bindSymbol](name, control, e, creator) {
|
|
129
|
+
const self = {
|
|
130
|
+
control,
|
|
131
|
+
source
|
|
132
|
+
};
|
|
133
|
+
control.bind(e, name, lists, false, () => {
|
|
134
|
+
return path.call(self, self);
|
|
135
|
+
}, self);
|
|
136
|
+
if (typeof now !== "undefined") {
|
|
137
|
+
control.setLocalValue(e, name, now);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
189
141
|
}
|
|
190
|
-
static oneWayAsync(sourcePath, {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
142
|
+
static oneWayAsync(sourcePath, {
|
|
143
|
+
watchDelayInMS = 250,
|
|
144
|
+
default: defaultValue
|
|
145
|
+
} = {}) {
|
|
146
|
+
let pathList;
|
|
147
|
+
let combined;
|
|
148
|
+
let thisPathList;
|
|
149
|
+
if (Array.isArray(sourcePath)) {
|
|
150
|
+
pathList = sourcePath;
|
|
151
|
+
} else {
|
|
152
|
+
const lists = parsePathLists(sourcePath);
|
|
153
|
+
if (lists.combined.length) {
|
|
154
|
+
combined = lists.combined;
|
|
196
155
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (lists.combined.length) {
|
|
200
|
-
combined = lists.combined;
|
|
201
|
-
}
|
|
202
|
-
if (lists.pathList.length) {
|
|
203
|
-
pathList = lists.pathList;
|
|
204
|
-
}
|
|
205
|
-
if (lists.thisPath.length) {
|
|
206
|
-
thisPathList = lists.thisPath;
|
|
207
|
-
}
|
|
156
|
+
if (lists.pathList.length) {
|
|
157
|
+
pathList = lists.pathList;
|
|
208
158
|
}
|
|
209
|
-
if (
|
|
210
|
-
|
|
159
|
+
if (lists.thisPath.length) {
|
|
160
|
+
thisPathList = lists.thisPath;
|
|
211
161
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
162
|
+
}
|
|
163
|
+
if (!(combined || pathList || thisPathList)) {
|
|
164
|
+
throw new Error(`Failed to setup binding for ${sourcePath}, parsing failed`);
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
[bindSymbol](name, control, e, creator) {
|
|
168
|
+
let bindingSource;
|
|
169
|
+
let finalPathList = pathList;
|
|
170
|
+
if (combined) {
|
|
171
|
+
bindingSource = {
|
|
172
|
+
t: creator,
|
|
173
|
+
x: control
|
|
174
|
+
};
|
|
175
|
+
finalPathList = combined;
|
|
176
|
+
} else if (thisPathList) {
|
|
177
|
+
finalPathList = thisPathList;
|
|
178
|
+
bindingSource = creator;
|
|
179
|
+
}
|
|
180
|
+
const asyncState = {
|
|
181
|
+
token: 0,
|
|
182
|
+
cancelToken: undefined
|
|
183
|
+
};
|
|
184
|
+
control.bind(e, name, finalPathList, false, () => {
|
|
185
|
+
var _a;
|
|
186
|
+
const app = control.app;
|
|
187
|
+
(_a = asyncState.cancelToken) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
188
|
+
asyncState.cancelToken = undefined;
|
|
189
|
+
asyncState.token = app.setTimeoutAsync(() => __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
var _b, _c;
|
|
191
|
+
if ((_b = asyncState.cancelToken) === null || _b === void 0 ? void 0 : _b.cancelled) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
asyncState.token = undefined;
|
|
195
|
+
(_c = asyncState.cancelToken) === null || _c === void 0 ? void 0 : _c.cancel();
|
|
196
|
+
const ct = asyncState.cancelToken = new CancelToken();
|
|
197
|
+
const value = yield sourcePath.call(creator, control, e, ct);
|
|
198
|
+
if (!ct.cancelled) {
|
|
199
|
+
control.setLocalValue(e, name, value);
|
|
200
|
+
}
|
|
201
|
+
}), watchDelayInMS, asyncState.token);
|
|
202
|
+
return ignoreValue;
|
|
203
|
+
}, bindingSource);
|
|
204
|
+
if (typeof defaultValue !== "undefined") {
|
|
205
|
+
control.setLocalValue(e, name, defaultValue);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
};
|
|
256
209
|
}
|
|
257
|
-
/**
|
|
258
|
-
* Bind the expression one way
|
|
259
|
-
* @param sourcePath Lambda Expression for binding
|
|
260
|
-
* @param now Default value to set immediately
|
|
261
|
-
*/
|
|
262
210
|
static oneWay(sourcePath, now) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
211
|
+
let pathList;
|
|
212
|
+
let combined;
|
|
213
|
+
let thisPathList;
|
|
214
|
+
if (Array.isArray(sourcePath)) {
|
|
215
|
+
pathList = sourcePath;
|
|
216
|
+
} else {
|
|
217
|
+
const lists = parsePathLists(sourcePath);
|
|
218
|
+
if (lists.combined.length) {
|
|
219
|
+
combined = lists.combined;
|
|
268
220
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if (lists.combined.length) {
|
|
272
|
-
combined = lists.combined;
|
|
273
|
-
}
|
|
274
|
-
if (lists.pathList.length) {
|
|
275
|
-
pathList = lists.pathList;
|
|
276
|
-
}
|
|
277
|
-
if (lists.thisPath.length) {
|
|
278
|
-
thisPathList = lists.thisPath;
|
|
279
|
-
}
|
|
221
|
+
if (lists.pathList.length) {
|
|
222
|
+
pathList = lists.pathList;
|
|
280
223
|
}
|
|
281
|
-
if (
|
|
282
|
-
|
|
224
|
+
if (lists.thisPath.length) {
|
|
225
|
+
thisPathList = lists.thisPath;
|
|
283
226
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
return sourcePath.call(creator, control, e);
|
|
310
|
-
}, creator);
|
|
311
|
-
if (typeof now !== "undefined") {
|
|
312
|
-
control.setLocalValue(e, name, now);
|
|
313
|
-
}
|
|
227
|
+
}
|
|
228
|
+
if (!(combined || pathList || thisPathList)) {
|
|
229
|
+
throw new Error(`Failed to setup binding for ${sourcePath}, parsing failed`);
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
[bindSymbol](name, control, e, creator) {
|
|
233
|
+
if (pathList) {
|
|
234
|
+
control.bind(e, name, pathList, false, () => {
|
|
235
|
+
return sourcePath.call(creator, control, e);
|
|
236
|
+
});
|
|
237
|
+
if (typeof now !== "undefined") {
|
|
238
|
+
control.setLocalValue(e, name, now);
|
|
239
|
+
}
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (combined) {
|
|
243
|
+
const a = {
|
|
244
|
+
t: creator,
|
|
245
|
+
x: control
|
|
246
|
+
};
|
|
247
|
+
control.bind(e, name, combined, false, () => {
|
|
248
|
+
return sourcePath.call(creator, control, e);
|
|
249
|
+
}, a);
|
|
250
|
+
if (typeof now !== "undefined") {
|
|
251
|
+
control.setLocalValue(e, name, now);
|
|
314
252
|
}
|
|
315
|
-
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
control.bind(e, name, thisPathList, false, () => {
|
|
256
|
+
return sourcePath.call(creator, control, e);
|
|
257
|
+
}, creator);
|
|
258
|
+
if (typeof now !== "undefined") {
|
|
259
|
+
control.setLocalValue(e, name, now);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
316
263
|
}
|
|
317
|
-
/**
|
|
318
|
-
* Setup two way binding with given expression
|
|
319
|
-
* @param sourcePath Lambda Expression for binding
|
|
320
|
-
* @param events events on auto refresh
|
|
321
|
-
* @param converter IValueConverter for value conversion
|
|
322
|
-
*/
|
|
323
264
|
static twoWays(sourcePath, events, converter) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
265
|
+
let pathList;
|
|
266
|
+
let thisPathList;
|
|
267
|
+
if (Array.isArray(sourcePath)) {
|
|
268
|
+
pathList = sourcePath;
|
|
269
|
+
} else {
|
|
270
|
+
const lists = parsePathLists(sourcePath);
|
|
271
|
+
if (lists.combined.length) {
|
|
272
|
+
throw new Error("Cannot have combined binding for two ways");
|
|
329
273
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
if (lists.combined.length) {
|
|
333
|
-
// combined = lists.combined;
|
|
334
|
-
throw new Error("Cannot have combined binding for two ways");
|
|
335
|
-
}
|
|
336
|
-
if (lists.pathList.length) {
|
|
337
|
-
pathList = lists.pathList;
|
|
338
|
-
}
|
|
339
|
-
if (lists.thisPath.length) {
|
|
340
|
-
thisPathList = lists.thisPath;
|
|
341
|
-
}
|
|
274
|
+
if (lists.pathList.length) {
|
|
275
|
+
pathList = lists.pathList;
|
|
342
276
|
}
|
|
343
|
-
if (
|
|
344
|
-
|
|
277
|
+
if (lists.thisPath.length) {
|
|
278
|
+
thisPathList = lists.thisPath;
|
|
345
279
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
280
|
+
}
|
|
281
|
+
if (!(thisPathList || pathList)) {
|
|
282
|
+
throw new Error(`Failed to setup twoWay binding on ${sourcePath}`);
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
[bindSymbol](name, control, e, creator) {
|
|
286
|
+
control.bind(e, name, thisPathList || pathList, events || true, converter, thisPathList ? creator : undefined);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
351
289
|
}
|
|
352
|
-
/**
|
|
353
|
-
* Bind the expression one way with source, you cannot reference
|
|
354
|
-
* `this` inside this context, it will not watch `this`
|
|
355
|
-
* @param source source to watch
|
|
356
|
-
* @param path Lambda Expression for binding
|
|
357
|
-
* @param now Default value to set immediately
|
|
358
|
-
*/
|
|
359
290
|
static sourceTwoWays(source, path, events = ["input", "cut", "paste", "change"]) {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
291
|
+
const lists = parsePath(path, false).map(x => ["this", ...x]);
|
|
292
|
+
return {
|
|
293
|
+
[bindSymbol](name, control, e, creator) {
|
|
294
|
+
const self = {
|
|
295
|
+
control,
|
|
296
|
+
source
|
|
297
|
+
};
|
|
298
|
+
control.bind(e, name, lists, events, lists, self);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
367
301
|
}
|
|
368
|
-
// public static twoWaysConvert<T extends IAtomComponent = IAtomComponent>(
|
|
369
|
-
// sourcePath: bindingFunction<T>): Bind {
|
|
370
|
-
// const b = new Bind(twoWays, sourcePath, null, events);
|
|
371
|
-
// if (!(b.thisPathList || b.pathList)) {
|
|
372
|
-
// throw new Error(`Failed to setup twoWay binding on ${sourcePath}`);
|
|
373
|
-
// }
|
|
374
|
-
// return b;
|
|
375
|
-
// }
|
|
376
|
-
/**
|
|
377
|
-
* Use this for HTML only, this will fire two way binding
|
|
378
|
-
* as soon as the input/textarea box is updated
|
|
379
|
-
* @param sourcePath binding lambda expression
|
|
380
|
-
* @param converter Optional value converter
|
|
381
|
-
*/
|
|
382
302
|
static twoWaysImmediate(sourcePath, converter) {
|
|
383
|
-
|
|
384
|
-
// const b = new Bind(twoWays, sourcePath, null,
|
|
385
|
-
// ["change", "input", "paste"]);
|
|
386
|
-
// if (!(b.thisPathList || b.pathList)) {
|
|
387
|
-
// throw new Error(`Failed to setup twoWay binding on ${sourcePath}`);
|
|
388
|
-
// }
|
|
389
|
-
// return b;
|
|
303
|
+
return this.twoWays(sourcePath, ["change", "input", "paste", "cut"], converter);
|
|
390
304
|
}
|
|
391
305
|
constructor(setupFunction, sourcePath, name, eventList) {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
306
|
+
this.setupFunction = setupFunction;
|
|
307
|
+
this.name = name;
|
|
308
|
+
this.eventList = eventList;
|
|
309
|
+
this.sourcePath = sourcePath;
|
|
310
|
+
this[bindSymbol] = true;
|
|
311
|
+
if (!this.sourcePath) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (Array.isArray(this.sourcePath)) {
|
|
315
|
+
this.pathList = this.sourcePath;
|
|
316
|
+
} else {
|
|
317
|
+
const lists = parsePathLists(this.sourcePath);
|
|
318
|
+
if (lists.combined.length) {
|
|
319
|
+
this.combined = lists.combined;
|
|
399
320
|
}
|
|
400
|
-
if (
|
|
401
|
-
|
|
402
|
-
// this.setupFunction = null;
|
|
321
|
+
if (lists.pathList.length) {
|
|
322
|
+
this.pathList = lists.pathList;
|
|
403
323
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
if (lists.combined.length) {
|
|
407
|
-
this.combined = lists.combined;
|
|
408
|
-
}
|
|
409
|
-
if (lists.pathList.length) {
|
|
410
|
-
this.pathList = lists.pathList;
|
|
411
|
-
}
|
|
412
|
-
if (lists.thisPath.length) {
|
|
413
|
-
this.thisPathList = lists.thisPath;
|
|
414
|
-
}
|
|
415
|
-
// if (setupFunction === oneWay) {
|
|
416
|
-
// if (!(this.combined || this.pathList || this.thisPathList)) {
|
|
417
|
-
// throw new Error(`Failed to setup binding for ${this.sourcePath}, parsing failed`);
|
|
418
|
-
// }
|
|
419
|
-
// }
|
|
324
|
+
if (lists.thisPath.length) {
|
|
325
|
+
this.thisPathList = lists.thisPath;
|
|
420
326
|
}
|
|
327
|
+
}
|
|
421
328
|
}
|
|
329
|
+
});
|
|
422
330
|
}
|
|
423
|
-
|
|
424
|
-
});
|
|
425
|
-
//# sourceMappingURL
|
|
331
|
+
};
|
|
332
|
+
});
|
|
333
|
+
//# sourceMappingURL=/home/runner/work/core/core/dist/core/Bind.js.map
|