@singularsystems/neo-react 1.0.0-alpha.3 → 1.0.0-beta.1
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/CHANGELOG.md +98 -0
- package/README.md +4 -0
- package/dist/Modules/NeoReactModule.d.ts +4 -4
- package/dist/Modules/NeoReactModule.js +28 -26
- package/dist/Modules/ReactSetup.d.ts +2 -2
- package/dist/Modules/ReactSetup.js +17 -17
- package/dist/Modules/Types.d.ts +63 -61
- package/dist/Modules/Types.js +13 -12
- package/dist/React/AutoRunner.d.ts +5 -5
- package/dist/React/AutoRunner.js +94 -92
- package/dist/React/DataView.d.ts +6 -6
- package/dist/React/DataView.js +11 -11
- package/dist/React/ReactModelCreator.d.ts +11 -11
- package/dist/React/ReactModelCreator.js +165 -162
- package/dist/ReactComponents/Button.d.ts +24 -23
- package/dist/ReactComponents/Button.js +132 -123
- package/dist/ReactComponents/Card.d.ts +24 -23
- package/dist/ReactComponents/Card.js +57 -54
- package/dist/ReactComponents/Collapsable.d.ts +23 -23
- package/dist/ReactComponents/Collapsable.js +38 -38
- package/dist/ReactComponents/CollapsableBase.d.ts +13 -13
- package/dist/ReactComponents/CollapsableBase.js +42 -42
- package/dist/ReactComponents/ColorPicker.d.ts +26 -26
- package/dist/ReactComponents/ColorPicker.js +67 -67
- package/dist/ReactComponents/ComponentBase.d.ts +17 -17
- package/dist/ReactComponents/ComponentBase.js +33 -33
- package/dist/ReactComponents/ContextMenu/ContextMenu.d.ts +25 -24
- package/dist/ReactComponents/ContextMenu/ContextMenu.js +91 -89
- package/dist/ReactComponents/ContextMenu/ContextMenuContainer.d.ts +14 -14
- package/dist/ReactComponents/ContextMenu/ContextMenuContainer.js +48 -48
- package/dist/ReactComponents/ContextMenu/ContextMenuState.d.ts +8 -8
- package/dist/ReactComponents/ContextMenu/ContextMenuState.js +23 -24
- package/dist/ReactComponents/DatePicker.d.ts +20 -19
- package/dist/ReactComponents/DatePicker.js +57 -53
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.d.ts +97 -83
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +225 -188
- package/dist/ReactComponents/DropDown/DropDown.d.ts +44 -44
- package/dist/ReactComponents/DropDown/DropDown.js +138 -134
- package/dist/ReactComponents/DropDown/DropDownBase.d.ts +16 -15
- package/dist/ReactComponents/DropDown/DropDownBase.js +86 -108
- package/dist/ReactComponents/DropDown/LookupHelper.d.ts +13 -0
- package/dist/ReactComponents/DropDown/LookupHelper.js +45 -0
- package/dist/ReactComponents/ErrorHandler.d.ts +9 -9
- package/dist/ReactComponents/ErrorHandler.js +92 -93
- package/dist/ReactComponents/FileManager/FileBasicInput.d.ts +20 -20
- package/dist/ReactComponents/FileManager/FileBasicInput.js +70 -70
- package/dist/ReactComponents/FileManager/FileContext.d.ts +16 -16
- package/dist/ReactComponents/FileManager/FileContext.js +24 -24
- package/dist/ReactComponents/FileManager/FileDropArea.d.ts +19 -19
- package/dist/ReactComponents/FileManager/FileDropArea.js +66 -66
- package/dist/ReactComponents/FileManager/FileInput.d.ts +44 -43
- package/dist/ReactComponents/FileManager/FileInput.js +191 -191
- package/dist/ReactComponents/FileManager/FileUploadButton.d.ts +17 -17
- package/dist/ReactComponents/FileManager/FileUploadButton.js +49 -49
- package/dist/ReactComponents/FileManager/FileUploadProgress.d.ts +14 -14
- package/dist/ReactComponents/FileManager/FileUploadProgress.js +35 -35
- package/dist/ReactComponents/Form.d.ts +19 -19
- package/dist/ReactComponents/Form.js +90 -90
- package/dist/ReactComponents/FormContext.d.ts +33 -33
- package/dist/ReactComponents/FormContext.js +39 -40
- package/dist/ReactComponents/FormGroup/FormGroup.d.ts +37 -37
- package/dist/ReactComponents/FormGroup/FormGroup.js +83 -84
- package/dist/ReactComponents/FormGroup/FormGroupFloating.d.ts +19 -19
- package/dist/ReactComponents/FormGroup/FormGroupFloating.js +97 -97
- package/dist/ReactComponents/FormGroup/FormGroupInline.d.ts +11 -11
- package/dist/ReactComponents/FormGroup/FormGroupInline.js +43 -43
- package/dist/ReactComponents/Grid/ButtonColumn.d.ts +48 -47
- package/dist/ReactComponents/Grid/ButtonColumn.js +81 -82
- package/dist/ReactComponents/Grid/Column.d.ts +47 -47
- package/dist/ReactComponents/Grid/Column.js +205 -205
- package/dist/ReactComponents/Grid/ColumnHelper.d.ts +12 -12
- package/dist/ReactComponents/Grid/ColumnHelper.js +19 -19
- package/dist/ReactComponents/Grid/Grid.d.ts +95 -87
- package/dist/ReactComponents/Grid/Grid.js +218 -203
- package/dist/ReactComponents/Grid/Row.d.ts +81 -81
- package/dist/ReactComponents/Grid/Row.js +200 -202
- package/dist/ReactComponents/Grid/StickyTableHeader.d.ts +27 -0
- package/dist/ReactComponents/Grid/StickyTableHeader.js +107 -0
- package/dist/ReactComponents/Grid/_Exports.d.ts +5 -5
- package/dist/ReactComponents/Grid/_Exports.js +5 -5
- package/dist/ReactComponents/GridLayout.d.ts +20 -20
- package/dist/ReactComponents/GridLayout.js +38 -38
- package/dist/ReactComponents/Icons/FontAwesomeIconFactory.d.ts +23 -0
- package/dist/ReactComponents/Icons/FontAwesomeIconFactory.js +43 -0
- package/dist/ReactComponents/Icons/IIconFactory.d.ts +21 -0
- package/dist/ReactComponents/Icons/IIconFactory.js +1 -0
- package/dist/ReactComponents/Icons/IconFactory.d.ts +9 -0
- package/dist/ReactComponents/Icons/IconFactory.js +45 -0
- package/dist/ReactComponents/Icons/index.d.ts +3 -0
- package/dist/ReactComponents/Icons/index.js +2 -0
- package/dist/ReactComponents/Input.d.ts +45 -45
- package/dist/ReactComponents/Input.js +153 -153
- package/dist/ReactComponents/InputHelpers.d.ts +6 -5
- package/dist/ReactComponents/InputHelpers.js +29 -33
- package/dist/ReactComponents/Link.d.ts +13 -13
- package/dist/ReactComponents/Link.js +28 -28
- package/dist/ReactComponents/Loader.d.ts +18 -18
- package/dist/ReactComponents/Loader.js +57 -57
- package/dist/ReactComponents/Misc.d.ts +15 -15
- package/dist/ReactComponents/Misc.js +28 -28
- package/dist/ReactComponents/Modal/Modal.d.ts +11 -11
- package/dist/ReactComponents/Modal/Modal.js +133 -129
- package/dist/ReactComponents/Modal/ModalContainer.d.ts +17 -17
- package/dist/ReactComponents/Modal/ModalContainer.js +37 -37
- package/dist/ReactComponents/Modal/ModalPortal.d.ts +16 -16
- package/dist/ReactComponents/Modal/ModalPortal.js +27 -27
- package/dist/ReactComponents/Notifications/Alert.d.ts +7 -6
- package/dist/ReactComponents/Notifications/Alert.js +38 -35
- package/dist/ReactComponents/Notifications/Toast.d.ts +9 -8
- package/dist/ReactComponents/Notifications/Toast.js +47 -45
- package/dist/ReactComponents/Notifications/ToastContainer.d.ts +8 -8
- package/dist/ReactComponents/Notifications/ToastContainer.js +18 -18
- package/dist/ReactComponents/NumberInput.d.ts +57 -50
- package/dist/ReactComponents/NumberInput.js +267 -246
- package/dist/ReactComponents/Paging/BasicPagerControls.d.ts +26 -25
- package/dist/ReactComponents/Paging/BasicPagerControls.js +57 -55
- package/dist/ReactComponents/Paging/PageSizeControl.d.ts +11 -11
- package/dist/ReactComponents/Paging/PageSizeControl.js +21 -21
- package/dist/ReactComponents/Paging/Pager.d.ts +24 -24
- package/dist/ReactComponents/Paging/Pager.js +41 -41
- package/dist/ReactComponents/ProgressBar.d.ts +19 -19
- package/dist/ReactComponents/ProgressBar.js +52 -52
- package/dist/ReactComponents/PropTypes.d.ts +154 -161
- package/dist/ReactComponents/PropTypes.js +263 -236
- package/dist/ReactComponents/RadioList.d.ts +29 -29
- package/dist/ReactComponents/RadioList.js +59 -77
- package/dist/ReactComponents/Slider.d.ts +28 -28
- package/dist/ReactComponents/Slider.js +76 -76
- package/dist/ReactComponents/StateObserver.d.ts +15 -15
- package/dist/ReactComponents/StateObserver.js +35 -35
- package/dist/ReactComponents/Tabs/Tab.d.ts +42 -41
- package/dist/ReactComponents/Tabs/Tab.js +71 -72
- package/dist/ReactComponents/Tabs/TabContainer.d.ts +44 -44
- package/dist/ReactComponents/Tabs/TabContainer.js +98 -98
- package/dist/ReactComponents/Tabs/TabManager.d.ts +62 -62
- package/dist/ReactComponents/Tabs/TabManager.js +154 -154
- package/dist/ReactComponents/Tooltip.d.ts +20 -20
- package/dist/ReactComponents/Tooltip.js +51 -51
- package/dist/ReactComponents/TooltipHelper.d.ts +8 -8
- package/dist/ReactComponents/TooltipHelper.js +84 -84
- package/dist/ReactComponents/TooltipProvider.d.ts +30 -30
- package/dist/ReactComponents/TooltipProvider.js +111 -111
- package/dist/ReactComponents/ValidationSummary.d.ts +23 -22
- package/dist/ReactComponents/ValidationSummary.js +46 -43
- package/dist/ReactComponents/_Exports.d.ts +41 -41
- package/dist/ReactComponents/_Exports.js +41 -41
- package/dist/ReactComponents/_Managers.d.ts +4 -4
- package/dist/ReactComponents/_Managers.js +4 -4
- package/dist/Routing/BreadCrumbItem.d.ts +14 -14
- package/dist/Routing/BreadCrumbItem.js +12 -12
- package/dist/Routing/IRouteChangedProps.d.ts +31 -31
- package/dist/Routing/IRouteChangedProps.js +1 -1
- package/dist/Routing/IRouteParameter.d.ts +22 -22
- package/dist/Routing/IRouteParameter.js +9 -9
- package/dist/Routing/MenuRoute.d.ts +25 -24
- package/dist/Routing/MenuRoute.js +24 -24
- package/dist/Routing/NavigationHelper.d.ts +41 -40
- package/dist/Routing/NavigationHelper.js +61 -61
- package/dist/Routing/PageLeaveHandler.d.ts +13 -13
- package/dist/Routing/PageLeaveHandler.js +74 -75
- package/dist/Routing/RouteProvider.d.ts +31 -31
- package/dist/Routing/RouteProvider.js +92 -92
- package/dist/Routing/RouteView.d.ts +50 -50
- package/dist/Routing/RouteView.js +143 -143
- package/dist/Routing/RoutingState.d.ts +18 -18
- package/dist/Routing/RoutingState.js +45 -46
- package/dist/Routing/ViewParameter.d.ts +80 -58
- package/dist/Routing/ViewParameter.js +116 -96
- package/dist/Routing/ViewParameterList.d.ts +53 -53
- package/dist/Routing/ViewParameterList.js +163 -145
- package/dist/Routing/index.d.ts +9 -9
- package/dist/Routing/index.js +6 -6
- package/dist/Services/DisposeHelper.d.ts +15 -15
- package/dist/Services/DisposeHelper.js +40 -41
- package/dist/Services/IDisposeHelper.d.ts +12 -12
- package/dist/Services/IDisposeHelper.js +1 -1
- package/dist/Views/EmptyViewModel.d.ts +5 -5
- package/dist/Views/EmptyViewModel.js +14 -14
- package/dist/Views/IViewModel.d.ts +16 -16
- package/dist/Views/IViewModel.js +1 -1
- package/dist/Views/PersistentViewBase.d.ts +10 -10
- package/dist/Views/PersistentViewBase.js +21 -21
- package/dist/Views/ViewBase.d.ts +70 -70
- package/dist/Views/ViewBase.js +166 -155
- package/dist/Views/ViewComponentBase.d.ts +19 -13
- package/dist/Views/ViewComponentBase.js +24 -21
- package/dist/Views/ViewModelBase.d.ts +57 -56
- package/dist/Views/ViewModelBase.js +122 -118
- package/dist/Views/ViewState.d.ts +13 -13
- package/dist/Views/ViewState.js +9 -9
- package/dist/Views/index.d.ts +5 -5
- package/dist/Views/index.js +5 -5
- package/dist/index.d.ts +11 -10
- package/dist/index.js +10 -9
- package/package.json +18 -20
- package/styles/Card.scss +8 -1
- package/styles/DatePicker.scss +13 -2
- package/styles/Forms.scss +5 -0
- package/styles/Grid.scss +5 -0
- package/styles/Validation.scss +0 -9
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Model } from '@singularsystems/neo-core';
|
|
2
|
-
import { ModelCreatorBase } from '@singularsystems/neo-core/dist/Model/ModelCreatorBase';
|
|
3
|
-
import { NeoTypeInfo } from '@singularsystems/neo-core/dist/Model/NeoTypeInfo';
|
|
4
|
-
export declare class ReactModelCreator extends ModelCreatorBase {
|
|
5
|
-
convertInstance(instance: {}): {};
|
|
6
|
-
setupModel(typeInfo: NeoTypeInfo, model: Model.IModelBase): void;
|
|
7
|
-
setupObject(typeInfo: NeoTypeInfo, object: any): void;
|
|
8
|
-
private setMobxObservableType;
|
|
9
|
-
private addChangeTracking;
|
|
10
|
-
private setupList;
|
|
11
|
-
}
|
|
1
|
+
import { Model } from '@singularsystems/neo-core';
|
|
2
|
+
import { ModelCreatorBase } from '@singularsystems/neo-core/dist/Model/ModelCreatorBase';
|
|
3
|
+
import { NeoTypeInfo } from '@singularsystems/neo-core/dist/Model/NeoTypeInfo';
|
|
4
|
+
export declare class ReactModelCreator extends ModelCreatorBase {
|
|
5
|
+
convertInstance(instance: {}, options: Model.IMakeBindableOptions): {};
|
|
6
|
+
setupModel(typeInfo: NeoTypeInfo, model: Model.IModelBase, options: Model.IMakeBindableOptions): void;
|
|
7
|
+
setupObject(typeInfo: NeoTypeInfo, object: any, options: Model.IMakeBindableOptions): void;
|
|
8
|
+
private setMobxObservableType;
|
|
9
|
+
private addChangeTracking;
|
|
10
|
+
private setupList;
|
|
11
|
+
}
|
|
@@ -1,162 +1,165 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
|
-
import { observable, computed, intercept, reaction, makeObservable } from 'mobx';
|
|
3
|
-
import { List, Misc, Validation, Utils } from '@singularsystems/neo-core';
|
|
4
|
-
import { ModelCreatorBase } from '@singularsystems/neo-core/dist/Model/ModelCreatorBase';
|
|
5
|
-
import PropertyInstance from '@singularsystems/neo-core/dist/Model/PropertyInstance';
|
|
6
|
-
var
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
else {
|
|
84
|
-
annotations[propertyName] = observable.
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import { observable, computed, intercept, reaction, makeObservable, action } from 'mobx';
|
|
3
|
+
import { List, Misc, Validation, Utils } from '@singularsystems/neo-core';
|
|
4
|
+
import { ModelCreatorBase } from '@singularsystems/neo-core/dist/Model/ModelCreatorBase';
|
|
5
|
+
import PropertyInstance from '@singularsystems/neo-core/dist/Model/PropertyInstance';
|
|
6
|
+
var ReactModelCreator = /** @class */ (function (_super) {
|
|
7
|
+
__extends(ReactModelCreator, _super);
|
|
8
|
+
function ReactModelCreator() {
|
|
9
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
10
|
+
}
|
|
11
|
+
ReactModelCreator.prototype.convertInstance = function (instance, options) {
|
|
12
|
+
if (this.typeInfo.inheritsBindableBase) {
|
|
13
|
+
this.setupModel(this.typeInfo, instance, options);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
this.setupObject(this.typeInfo, instance, options);
|
|
17
|
+
}
|
|
18
|
+
return instance;
|
|
19
|
+
};
|
|
20
|
+
ReactModelCreator.prototype.setupModel = function (typeInfo, model, options) {
|
|
21
|
+
if (this.typeInfo.inheritsModelBase) {
|
|
22
|
+
model.validator = new Validation.ModelValidator(model, typeInfo.objectRules);
|
|
23
|
+
}
|
|
24
|
+
model.meta = {};
|
|
25
|
+
model.isSuspended = true;
|
|
26
|
+
this.setupObject(typeInfo, model, options);
|
|
27
|
+
model.isSuspended = false;
|
|
28
|
+
};
|
|
29
|
+
ReactModelCreator.prototype.setupObject = function (typeInfo, object, options) {
|
|
30
|
+
var _a, _b, _c;
|
|
31
|
+
var annotations = {};
|
|
32
|
+
var observables = {};
|
|
33
|
+
for (var _i = 0, _d = typeInfo.properties; _i < _d.length; _i++) {
|
|
34
|
+
var propertyInfo = _d[_i];
|
|
35
|
+
if (propertyInfo.isObservable !== false) {
|
|
36
|
+
var propertyName = propertyInfo.propertyName, makeObservable_1 = (_a = propertyInfo.isObservable) !== null && _a !== void 0 ? _a : options.makeObservable;
|
|
37
|
+
var propertyInstance = void 0;
|
|
38
|
+
if (this.typeInfo.inheritsBindableBase) {
|
|
39
|
+
var model = object;
|
|
40
|
+
propertyInstance = new PropertyInstance(model, propertyInfo, makeObservable_1);
|
|
41
|
+
model.meta[propertyName] = propertyInstance;
|
|
42
|
+
// Rules
|
|
43
|
+
if (propertyInfo.rules.length > 0 && model.validator) {
|
|
44
|
+
model.validator.addProperty(propertyInstance);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (propertyInfo.isComputed !== null) {
|
|
48
|
+
if (propertyInfo.descriptor && propertyInfo.isComputed) {
|
|
49
|
+
annotations[propertyName] = computed({ keepAlive: true });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else if (makeObservable_1) {
|
|
53
|
+
var property = { propertyInfo: propertyInfo, propertyInstance: propertyInstance };
|
|
54
|
+
observables[propertyName] = property;
|
|
55
|
+
this.setMobxObservableType(object, propertyName, property, annotations);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
for (var _e = 0, _f = Array.from(typeInfo.methods.values()); _e < _f.length; _e++) {
|
|
60
|
+
var methodInfo = _f[_e];
|
|
61
|
+
if ((_c = (_b = methodInfo.isAction) !== null && _b !== void 0 ? _b : options.autoActions) !== null && _c !== void 0 ? _c : options.makeObservable) {
|
|
62
|
+
annotations[methodInfo.name] = action;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Run mobx's setup for this instance.
|
|
66
|
+
makeObservable(object, annotations, { proxy: false });
|
|
67
|
+
// Setup once properties have been converted to observables.
|
|
68
|
+
for (var propertyKey in observables) {
|
|
69
|
+
var property = observables[propertyKey];
|
|
70
|
+
this.addChangeTracking(object, propertyKey, property);
|
|
71
|
+
if (property.convertList) {
|
|
72
|
+
this.setupList(object, propertyKey, property.convertList);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
ReactModelCreator.prototype.setMobxObservableType = function (object, propertyName, property, annotations) {
|
|
77
|
+
var propertyValue = object[propertyName], propertyInfo = property.propertyInfo;
|
|
78
|
+
this.ensureChildInfo(object, propertyInfo);
|
|
79
|
+
if (propertyInfo.relationType === Misc.RelationType.ChildList) {
|
|
80
|
+
annotations[propertyName] = observable.shallow;
|
|
81
|
+
property.convertList = propertyValue;
|
|
82
|
+
}
|
|
83
|
+
else if (propertyValue instanceof Array) {
|
|
84
|
+
annotations[propertyName] = observable.shallow;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
annotations[propertyName] = observable.ref;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
ReactModelCreator.prototype.addChangeTracking = function (object, propertyName, property) {
|
|
91
|
+
var _this = this;
|
|
92
|
+
var propertyInfo = property.propertyInfo, propertyInstance = property.propertyInstance;
|
|
93
|
+
var trackProperty = this.typeInfo.inheritsModelBase && !propertyInfo.noTrack && propertyInfo.relationType !== Misc.RelationType.ChildList;
|
|
94
|
+
var onChangedOptions = propertyInfo && propertyInfo.onChangedOptions;
|
|
95
|
+
if (onChangedOptions && onChangedOptions.requiresOldValue && !propertyInstance) {
|
|
96
|
+
throw Error("Cannot use previous value for OnChanged on property: ".concat(propertyName, ". Model does not extend BindableBase."));
|
|
97
|
+
}
|
|
98
|
+
if (propertyInstance && (trackProperty || propertyInfo.propertyType === Misc.DataType.Date || (onChangedOptions && onChangedOptions.requiresOldValue))) {
|
|
99
|
+
intercept(object, propertyName, function (onChange) {
|
|
100
|
+
var currentValue = object[propertyName];
|
|
101
|
+
if (!object.isSuspended) {
|
|
102
|
+
if (trackProperty && onChange.newValue !== currentValue)
|
|
103
|
+
object.isSelfDirty = true;
|
|
104
|
+
if (propertyInfo.propertyType === Misc.DataType.Date) {
|
|
105
|
+
if (typeof onChange.newValue === "string") {
|
|
106
|
+
throw "Error: tried to assign a string to a date property.";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
propertyInstance.previousValue = currentValue;
|
|
111
|
+
return onChange;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
var onChanged;
|
|
115
|
+
if (onChangedOptions && onChangedOptions.onChangedFn) {
|
|
116
|
+
if (propertyInstance && onChangedOptions.delayMs) {
|
|
117
|
+
onChanged = function (oldValue, newValue) {
|
|
118
|
+
Utils.debounce(propertyInstance, function (state) { return onChangedOptions.onChangedFn.call(object, state[0], newValue); }, onChangedOptions.delayMs, oldValue);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
onChanged = onChangedOptions.onChangedFn.bind(object);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (onChanged) {
|
|
126
|
+
var newValue_1;
|
|
127
|
+
reaction(function () {
|
|
128
|
+
newValue_1 = object[propertyName];
|
|
129
|
+
return newValue_1;
|
|
130
|
+
}, function () {
|
|
131
|
+
if (!_this.typeInfo.inheritsBindableBase || !object.isSuspended) {
|
|
132
|
+
onChanged.call(object, propertyInstance === null || propertyInstance === void 0 ? void 0 : propertyInstance.previousValue, newValue_1);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
ReactModelCreator.prototype.setupList = function (object, propertyName, originalList) {
|
|
138
|
+
var obsArray = object[propertyName];
|
|
139
|
+
List.copyMethods(obsArray);
|
|
140
|
+
originalList.setupProxy(obsArray, object);
|
|
141
|
+
// Don't allow list to change, just change the list contents.
|
|
142
|
+
intercept(object, propertyName, function (onChange) {
|
|
143
|
+
var newValue = onChange.newValue, currentValue = object[propertyName];
|
|
144
|
+
if (!newValue) {
|
|
145
|
+
currentValue.length = 0;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
if (newValue.childObjectType && newValue.setParent) {
|
|
149
|
+
// Cannot re-assign this property, so we have to clear the array, and copy the items from the source array.
|
|
150
|
+
Utils.batchUpdate(function () {
|
|
151
|
+
currentValue.length = 0;
|
|
152
|
+
currentValue.push.apply(currentValue, newValue);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
throw "Do not assign a plain array to a List property. Either call ".concat(propertyName, ".set(...) or ").concat(propertyName, ".update(...)");
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Instruct mobx to ignore the set.
|
|
160
|
+
return null;
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
return ReactModelCreator;
|
|
164
|
+
}(ModelCreatorBase));
|
|
165
|
+
export { ReactModelCreator };
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import ComponentBase from './ComponentBase';
|
|
3
|
-
import { Components } from '@singularsystems/neo-core';
|
|
4
|
-
|
|
5
|
-
interface IButtonState {
|
|
6
|
-
isExpanded: boolean;
|
|
7
|
-
}
|
|
8
|
-
export default class Button extends ComponentBase<IButtonProps, IButtonState> {
|
|
9
|
-
state: {
|
|
10
|
-
isExpanded: boolean;
|
|
11
|
-
};
|
|
12
|
-
btnGroupDom: React.RefObject<HTMLDivElement>;
|
|
13
|
-
menuDom: React.RefObject<HTMLDivElement>;
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
-
private
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import ComponentBase from './ComponentBase';
|
|
3
|
+
import { Components } from '@singularsystems/neo-core';
|
|
4
|
+
type IButtonProps = Components.IButtonOptions & React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
|
|
5
|
+
interface IButtonState {
|
|
6
|
+
isExpanded: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default class Button extends ComponentBase<IButtonProps, IButtonState> {
|
|
9
|
+
state: {
|
|
10
|
+
isExpanded: boolean;
|
|
11
|
+
};
|
|
12
|
+
btnGroupDom: React.RefObject<HTMLDivElement>;
|
|
13
|
+
menuDom: React.RefObject<HTMLDivElement>;
|
|
14
|
+
private iconFactory;
|
|
15
|
+
private windowClickHandler;
|
|
16
|
+
constructor(props: IButtonProps);
|
|
17
|
+
private showMenu;
|
|
18
|
+
private hideMenu;
|
|
19
|
+
private menuItemClicked;
|
|
20
|
+
private windowClicked;
|
|
21
|
+
afterRender(): void;
|
|
22
|
+
render(): JSX.Element;
|
|
23
|
+
}
|
|
24
|
+
export {};
|