@singularsystems/neo-react 1.0.0-alpha.2 → 1.0.0-beta.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/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 +131 -123
- package/dist/ReactComponents/Card.d.ts +24 -23
- package/dist/ReactComponents/Card.js +56 -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 -88
- 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 -7
- package/dist/ReactComponents/ContextMenu/ContextMenuState.js +23 -23
- package/dist/ReactComponents/DatePicker.d.ts +19 -19
- package/dist/ReactComponents/DatePicker.js +53 -53
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.d.ts +93 -83
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +222 -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 -8
- package/dist/ReactComponents/ErrorHandler.js +92 -91
- 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 -18
- package/dist/ReactComponents/FileManager/FileDropArea.js +66 -64
- package/dist/ReactComponents/FileManager/FileInput.d.ts +44 -42
- package/dist/ReactComponents/FileManager/FileInput.js +191 -189
- 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 -18
- package/dist/ReactComponents/Form.js +90 -90
- package/dist/ReactComponents/FormContext.d.ts +33 -31
- 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 +47 -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 +87 -90
- package/dist/ReactComponents/Grid/Grid.js +203 -203
- package/dist/ReactComponents/Grid/Row.d.ts +81 -81
- package/dist/ReactComponents/Grid/Row.js +200 -201
- 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 -152
- 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 +129 -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 -15
- 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 +260 -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 +161 -161
- package/dist/ReactComponents/PropTypes.js +253 -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 -19
- 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 -74
- 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 -144
- package/dist/Routing/RoutingState.d.ts +18 -15
- package/dist/Routing/RoutingState.js +45 -40
- package/dist/Routing/ViewParameter.d.ts +80 -58
- package/dist/Routing/ViewParameter.js +116 -95
- 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 -71
- package/dist/Views/ViewBase.js +166 -153
- 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 +26 -26
- package/styles/DatePicker.scss +2 -2
- package/styles/Forms.scss +5 -0
- package/styles/Validation.scss +0 -9
|
@@ -1,236 +1,253 @@
|
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
|
2
|
-
import { Misc, AppServices } from '@singularsystems/neo-core';
|
|
3
|
-
import DropDown from './DropDown/DropDown';
|
|
4
|
-
import NumberInput from './NumberInput';
|
|
5
|
-
import DatePicker from './DatePicker';
|
|
6
|
-
import Input from './Input';
|
|
7
|
-
import RadioList from './RadioList';
|
|
8
|
-
import * as React from 'react';
|
|
9
|
-
import { DataType } from '@singularsystems/neo-core/dist/Model/Misc';
|
|
10
|
-
import FileInput from './FileManager/FileInput';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
ControlType[ControlType["
|
|
15
|
-
ControlType[ControlType["
|
|
16
|
-
ControlType[ControlType["
|
|
17
|
-
ControlType[ControlType["
|
|
18
|
-
ControlType[ControlType["
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
CheckboxType[CheckboxType["
|
|
24
|
-
CheckboxType[CheckboxType["
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
var
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
//
|
|
128
|
-
|
|
129
|
-
//
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (!
|
|
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
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
};
|
|
185
|
-
BindPropsHelper.
|
|
186
|
-
var
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
domProps.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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
|
-
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import { Misc, AppServices } from '@singularsystems/neo-core';
|
|
3
|
+
import DropDown from './DropDown/DropDown';
|
|
4
|
+
import NumberInput from './NumberInput';
|
|
5
|
+
import DatePicker from './DatePicker';
|
|
6
|
+
import Input from './Input';
|
|
7
|
+
import RadioList from './RadioList';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { DataType } from '@singularsystems/neo-core/dist/Model/Misc';
|
|
10
|
+
import FileInput from './FileManager/FileInput';
|
|
11
|
+
import Tooltip from './Tooltip';
|
|
12
|
+
export var ControlType;
|
|
13
|
+
(function (ControlType) {
|
|
14
|
+
ControlType[ControlType["Date"] = 0] = "Date";
|
|
15
|
+
ControlType[ControlType["Number"] = 1] = "Number";
|
|
16
|
+
ControlType[ControlType["DropDown"] = 2] = "DropDown";
|
|
17
|
+
ControlType[ControlType["Text"] = 3] = "Text";
|
|
18
|
+
ControlType[ControlType["File"] = 4] = "File";
|
|
19
|
+
ControlType[ControlType["RadioList"] = 5] = "RadioList";
|
|
20
|
+
})(ControlType || (ControlType = {}));
|
|
21
|
+
export var CheckboxType;
|
|
22
|
+
(function (CheckboxType) {
|
|
23
|
+
CheckboxType[CheckboxType["None"] = 0] = "None";
|
|
24
|
+
CheckboxType[CheckboxType["Checkbox"] = 1] = "Checkbox";
|
|
25
|
+
CheckboxType[CheckboxType["Switch"] = 2] = "Switch";
|
|
26
|
+
})(CheckboxType || (CheckboxType = {}));
|
|
27
|
+
export var BindPropsHelper = /** @class */ (function () {
|
|
28
|
+
function BindPropsHelper() {
|
|
29
|
+
}
|
|
30
|
+
Object.defineProperty(BindPropsHelper, "config", {
|
|
31
|
+
get: function () {
|
|
32
|
+
if (!this._config) {
|
|
33
|
+
this._config = Misc.Globals.appService.get(AppServices.NeoTypes.Config.ConfigModel);
|
|
34
|
+
}
|
|
35
|
+
return this._config;
|
|
36
|
+
},
|
|
37
|
+
enumerable: false,
|
|
38
|
+
configurable: true
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Gets the correct input control type based on the props. E.g. Input / DatePicker / Select
|
|
42
|
+
* @param props Props passed to a multi type input container. E.g. FormGroup / Column
|
|
43
|
+
*/
|
|
44
|
+
BindPropsHelper.getFormControl = function (props) {
|
|
45
|
+
switch (BindPropsHelper.getControlType(props)) {
|
|
46
|
+
case ControlType.Date:
|
|
47
|
+
return React.createElement(DatePicker, props);
|
|
48
|
+
case ControlType.Number:
|
|
49
|
+
return React.createElement(NumberInput, props);
|
|
50
|
+
case ControlType.DropDown:
|
|
51
|
+
return React.createElement(DropDown, props);
|
|
52
|
+
case ControlType.File:
|
|
53
|
+
return React.createElement(FileInput, props);
|
|
54
|
+
case ControlType.Text:
|
|
55
|
+
return React.createElement(Input, props);
|
|
56
|
+
case ControlType.RadioList:
|
|
57
|
+
return React.createElement(RadioList, props);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
BindPropsHelper.getControlType = function (props) {
|
|
61
|
+
var propertyInfo = props.bind.propertyInfo;
|
|
62
|
+
if (props.dateProps || propertyInfo.propertyType === DataType.Date) {
|
|
63
|
+
return ControlType.Date;
|
|
64
|
+
}
|
|
65
|
+
else if (props.select) {
|
|
66
|
+
return ControlType.DropDown;
|
|
67
|
+
}
|
|
68
|
+
else if (props.numProps || propertyInfo.propertyType === Misc.DataType.Float || propertyInfo.propertyType === Misc.DataType.Int || propertyInfo.propertyType === Misc.DataType.Decimal) {
|
|
69
|
+
return ControlType.Number;
|
|
70
|
+
}
|
|
71
|
+
else if (props.fileProps) {
|
|
72
|
+
return ControlType.File;
|
|
73
|
+
}
|
|
74
|
+
else if (props.radioList) {
|
|
75
|
+
return ControlType.RadioList;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return ControlType.Text;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
BindPropsHelper.getCheckBoxType = function (props, instance) {
|
|
82
|
+
if (props.input && props.input.type) {
|
|
83
|
+
if (props.input.type === "checkbox")
|
|
84
|
+
return CheckboxType.Checkbox;
|
|
85
|
+
if (props.input.type === "switch")
|
|
86
|
+
return CheckboxType.Switch;
|
|
87
|
+
}
|
|
88
|
+
if (props.bind && !props.radioList) {
|
|
89
|
+
if (props.bind.propertyInfo.propertyType === Misc.DataType.NullableBoolean)
|
|
90
|
+
return CheckboxType.Checkbox;
|
|
91
|
+
if (props.bind.attachedTo && typeof props.bind.peek === "boolean")
|
|
92
|
+
return CheckboxType.Checkbox;
|
|
93
|
+
if (instance && typeof instance[props.bind.propertyInfo.propertyName] === "boolean")
|
|
94
|
+
return CheckboxType.Checkbox;
|
|
95
|
+
}
|
|
96
|
+
return CheckboxType.None;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Get the main bind property from a props object
|
|
100
|
+
*/
|
|
101
|
+
BindPropsHelper.getBindProperty = function (allProps) {
|
|
102
|
+
return (allProps.bind || allProps.display || allProps.bindContext);
|
|
103
|
+
};
|
|
104
|
+
BindPropsHelper.splitCommonEditorProps = function (props) {
|
|
105
|
+
var isReadOnly = props.isReadOnly, readOnly = props.readOnly, isDisabled = props.isDisabled, disabled = props.disabled, prependText = props.prependText, prepend = props.prepend, appendText = props.appendText, append = props.append, inputElement = props.inputElement, rest = __rest(props, ["isReadOnly", "readOnly", "isDisabled", "disabled", "prependText", "prepend", "appendText", "append", "inputElement"]);
|
|
106
|
+
return {
|
|
107
|
+
editor: {
|
|
108
|
+
isReadOnly: (isReadOnly !== null && isReadOnly !== void 0 ? isReadOnly : readOnly), isDisabled: (isDisabled !== null && isDisabled !== void 0 ? isDisabled : disabled),
|
|
109
|
+
prependText: prependText,
|
|
110
|
+
prepend: prepend,
|
|
111
|
+
appendText: appendText,
|
|
112
|
+
append: append,
|
|
113
|
+
inputElement: inputElement,
|
|
114
|
+
requiresGroup: prependText !== undefined || prepend !== undefined || appendText !== undefined || append !== undefined
|
|
115
|
+
},
|
|
116
|
+
rest: rest
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
BindPropsHelper.normaliseContainerProps = function (component, props, inGroup, isBootstrap) {
|
|
120
|
+
// Split flattened props into components.
|
|
121
|
+
var _a, _b, _c;
|
|
122
|
+
if (isBootstrap === void 0) { isBootstrap = true; }
|
|
123
|
+
var splitProps = this.splitCommonEditorProps(props);
|
|
124
|
+
var _d = splitProps.rest,
|
|
125
|
+
// Bindable editor props
|
|
126
|
+
bind = _d.bind, display = _d.display, placeholder = _d.placeholder,
|
|
127
|
+
// Editor selector props
|
|
128
|
+
select = _d.select, input = _d.input, dateProps = _d.dateProps, numProps = _d.numProps, fileProps = _d.fileProps, radioList = _d.radioList,
|
|
129
|
+
// Common container props
|
|
130
|
+
label = _d.label, editorProps = _d.editorProps, editorTooltip = _d.editorTooltip, editorClassName = _d.editorClassName, editorStyle = _d.editorStyle, suppressDefaultContent = _d.suppressDefaultContent, bindContext = _d.bindContext,
|
|
131
|
+
// Container dom
|
|
132
|
+
containerDom = __rest(_d, ["bind", "display", "placeholder", "select", "input", "dateProps", "numProps", "fileProps", "radioList", "label", "editorProps", "editorTooltip", "editorClassName", "editorStyle", "suppressDefaultContent", "bindContext"]);
|
|
133
|
+
var bindOrDisplay = BindPropsHelper.getBindProperty(props);
|
|
134
|
+
if (!bindOrDisplay) {
|
|
135
|
+
var child = containerDom.children;
|
|
136
|
+
var childBind = void 0;
|
|
137
|
+
if (child) {
|
|
138
|
+
if ((_a = child.type) === null || _a === void 0 ? void 0 : _a.getBindProp) {
|
|
139
|
+
childBind = (_b = child.type) === null || _b === void 0 ? void 0 : _b.getBindProp(child.props);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
childBind = (_c = child.props) === null || _c === void 0 ? void 0 : _c.bind;
|
|
143
|
+
}
|
|
144
|
+
if (childBind) {
|
|
145
|
+
bindOrDisplay = childBind;
|
|
146
|
+
bindContext = bindOrDisplay;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (bindOrDisplay && bindOrDisplay.propertyInfo.isReadOnly)
|
|
151
|
+
splitProps.editor.isReadOnly = true;
|
|
152
|
+
if (!props.bind && props.display)
|
|
153
|
+
splitProps.editor.isReadOnly = true;
|
|
154
|
+
if (!editorProps)
|
|
155
|
+
editorProps = {};
|
|
156
|
+
if (editorTooltip) {
|
|
157
|
+
Tooltip.setDomProperties(editorProps, editorTooltip);
|
|
158
|
+
}
|
|
159
|
+
if (editorClassName) {
|
|
160
|
+
editorProps.className = editorClassName;
|
|
161
|
+
}
|
|
162
|
+
if (editorStyle) {
|
|
163
|
+
editorProps.style = editorStyle;
|
|
164
|
+
}
|
|
165
|
+
if (bindContext && suppressDefaultContent === undefined) {
|
|
166
|
+
suppressDefaultContent = true;
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
bind: bindOrDisplay,
|
|
170
|
+
editor: __assign({ bind: bindOrDisplay, placeholder: this.getPlaceholderText(placeholder, bindOrDisplay === null || bindOrDisplay === void 0 ? void 0 : bindOrDisplay.propertyInfo) }, splitProps.editor),
|
|
171
|
+
editorDom: editorProps,
|
|
172
|
+
container: { label: label, editorTooltip: editorTooltip, editorClassName: editorClassName, editorStyle: editorStyle, bindContext: bindContext, suppressDefaultContent: suppressDefaultContent },
|
|
173
|
+
select: select,
|
|
174
|
+
input: input,
|
|
175
|
+
numProps: numProps,
|
|
176
|
+
dateProps: dateProps,
|
|
177
|
+
fileProps: fileProps,
|
|
178
|
+
radioList: radioList,
|
|
179
|
+
inGroup: inGroup,
|
|
180
|
+
uniqueID: (bindOrDisplay === null || bindOrDisplay === void 0 ? void 0 : bindOrDisplay.uniqueID) + "!" + component.uniqueId,
|
|
181
|
+
containerDom: containerDom,
|
|
182
|
+
isBootstrap: isBootstrap
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
BindPropsHelper.normaliseEditorProps = function (component, props) {
|
|
186
|
+
var nProps = props;
|
|
187
|
+
if (!nProps.editor) {
|
|
188
|
+
// Stand alone editor, normalise the props.
|
|
189
|
+
nProps = BindPropsHelper.normaliseContainerProps(component, props, false);
|
|
190
|
+
nProps.editorDom = nProps.containerDom;
|
|
191
|
+
}
|
|
192
|
+
return nProps;
|
|
193
|
+
};
|
|
194
|
+
BindPropsHelper.getPlaceholderText = function (placeholder, property) {
|
|
195
|
+
if (placeholder === true) {
|
|
196
|
+
return property.readableName;
|
|
197
|
+
}
|
|
198
|
+
else if (placeholder !== false) {
|
|
199
|
+
return placeholder;
|
|
200
|
+
}
|
|
201
|
+
return undefined;
|
|
202
|
+
};
|
|
203
|
+
BindPropsHelper.autoSetDomProperties = function (props, formContext, componentBlurFn, componentFocusFn) {
|
|
204
|
+
var _a;
|
|
205
|
+
var domProps = __assign({}, props.editorDom);
|
|
206
|
+
if (props.uniqueID) {
|
|
207
|
+
domProps.id = (_a = formContext.uniqueId) !== null && _a !== void 0 ? _a : props.uniqueID;
|
|
208
|
+
}
|
|
209
|
+
if (this.config.isTestOrDevelopment) {
|
|
210
|
+
domProps[BindPropsHelper.DataFieldName] = props.bind.propertyInfo.propertyName;
|
|
211
|
+
}
|
|
212
|
+
if (props.editor.isReadOnly || (formContext.allReadOnly && props.editor.isReadOnly === undefined)) {
|
|
213
|
+
domProps.readOnly = true;
|
|
214
|
+
if (!domProps.tabIndex)
|
|
215
|
+
domProps.tabIndex = -1;
|
|
216
|
+
}
|
|
217
|
+
if (props.editor.isDisabled || (formContext.allDisabled && props.editor.isDisabled === undefined)) {
|
|
218
|
+
domProps.disabled = true;
|
|
219
|
+
}
|
|
220
|
+
if (props.editor.placeholder) {
|
|
221
|
+
domProps.placeholder = props.editor.placeholder;
|
|
222
|
+
}
|
|
223
|
+
if (componentFocusFn) {
|
|
224
|
+
var parentFocusFn_1 = domProps.onFocus;
|
|
225
|
+
domProps.onFocus = function (e) {
|
|
226
|
+
if (parentFocusFn_1)
|
|
227
|
+
parentFocusFn_1(e);
|
|
228
|
+
componentFocusFn(e);
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
domProps.onBlur = BindPropsHelper.blurIntercept(props.editor, domProps.onBlur, componentBlurFn);
|
|
232
|
+
return domProps;
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Intercept the user specified blur event, and run the validation onBlur logic first.
|
|
236
|
+
* @param props Props specified on component.
|
|
237
|
+
* @param blurFn Blur function used internally by component.
|
|
238
|
+
*/
|
|
239
|
+
BindPropsHelper.blurIntercept = function (props, domPropsBlur, blurFn) {
|
|
240
|
+
return function (e) {
|
|
241
|
+
if (props.bind)
|
|
242
|
+
props.bind.validator.hasBlurred = true;
|
|
243
|
+
if (blurFn)
|
|
244
|
+
blurFn(e);
|
|
245
|
+
if (props.onBlur)
|
|
246
|
+
props.onBlur(e);
|
|
247
|
+
if (domPropsBlur)
|
|
248
|
+
domPropsBlur(e);
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
BindPropsHelper.DataFieldName = "data-field-name";
|
|
252
|
+
return BindPropsHelper;
|
|
253
|
+
}());
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IBindableEditorProps } from './PropTypes';
|
|
3
|
-
import ComponentBase from './ComponentBase';
|
|
4
|
-
import { FormContext } from './FormContext';
|
|
5
|
-
export interface IRadioListSpecificProps {
|
|
6
|
-
/** List of items to show. */
|
|
7
|
-
items?:
|
|
8
|
-
/** Enum to show as a radio button list. */
|
|
9
|
-
enumType?: any;
|
|
10
|
-
/** True if the radio buttons should be displayed inline (horizontally). */
|
|
11
|
-
inline?: boolean;
|
|
12
|
-
/** Property name to use for the id. Only applies when using items. */
|
|
13
|
-
valueMember?:
|
|
14
|
-
/** Property name to use for the radio button text. Only applies when using items. */
|
|
15
|
-
displayMember?:
|
|
16
|
-
}
|
|
17
|
-
export interface IRadioListProps extends IBindableEditorProps<HTMLSelectElement> {
|
|
18
|
-
radioList: IRadioListSpecificProps
|
|
19
|
-
}
|
|
20
|
-
export default class RadioList extends ComponentBase<IRadioListProps
|
|
21
|
-
static contextType: React.Context<import("./FormContext").FormContextParams>;
|
|
22
|
-
context: React.ContextType<typeof FormContext>;
|
|
23
|
-
private previousList?;
|
|
24
|
-
private previousEnumType?;
|
|
25
|
-
private items;
|
|
26
|
-
private preRender;
|
|
27
|
-
private createEnumList;
|
|
28
|
-
render(): JSX.Element;
|
|
29
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IBindableEditorProps } from './PropTypes';
|
|
3
|
+
import ComponentBase from './ComponentBase';
|
|
4
|
+
import { FormContext } from './FormContext';
|
|
5
|
+
export interface IRadioListSpecificProps<T> {
|
|
6
|
+
/** List of items to show. */
|
|
7
|
+
items?: T[];
|
|
8
|
+
/** Enum to show as a radio button list. */
|
|
9
|
+
enumType?: any;
|
|
10
|
+
/** True if the radio buttons should be displayed inline (horizontally). */
|
|
11
|
+
inline?: boolean;
|
|
12
|
+
/** Property name to use for the id. Only applies when using items. */
|
|
13
|
+
valueMember?: keyof T;
|
|
14
|
+
/** Property name to use for the radio button text. Only applies when using items. */
|
|
15
|
+
displayMember?: keyof T;
|
|
16
|
+
}
|
|
17
|
+
export interface IRadioListProps<T> extends IBindableEditorProps<HTMLSelectElement> {
|
|
18
|
+
radioList: IRadioListSpecificProps<T>;
|
|
19
|
+
}
|
|
20
|
+
export default class RadioList<T> extends ComponentBase<IRadioListProps<T>> {
|
|
21
|
+
static contextType: React.Context<import("./FormContext").FormContextParams>;
|
|
22
|
+
context: React.ContextType<typeof FormContext>;
|
|
23
|
+
private previousList?;
|
|
24
|
+
private previousEnumType?;
|
|
25
|
+
private items;
|
|
26
|
+
private preRender;
|
|
27
|
+
private createEnumList;
|
|
28
|
+
render(): JSX.Element;
|
|
29
|
+
}
|