@vixoniccom/modules 2.11.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/.vscode/settings.json +3 -0
- package/CHANGELOG.md +264 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +31 -0
- package/dist/lib/base.d.ts +36 -0
- package/dist/lib/base.js +58 -0
- package/dist/lib/containers/dynamic-matrix.d.ts +48 -0
- package/dist/lib/containers/dynamic-matrix.js +76 -0
- package/dist/lib/containers/group.d.ts +21 -0
- package/dist/lib/containers/group.js +47 -0
- package/dist/lib/containers/index.d.ts +6 -0
- package/dist/lib/containers/index.js +13 -0
- package/dist/lib/containers/list.d.ts +66 -0
- package/dist/lib/containers/list.js +105 -0
- package/dist/lib/errors.d.ts +22 -0
- package/dist/lib/errors.js +23 -0
- package/dist/lib/index.d.ts +29 -0
- package/dist/lib/index.js +128 -0
- package/dist/lib/inputs/autocomplete.d.ts +31 -0
- package/dist/lib/inputs/autocomplete.js +49 -0
- package/dist/lib/inputs/color-picker.d.ts +23 -0
- package/dist/lib/inputs/color-picker.js +42 -0
- package/dist/lib/inputs/date-input.d.ts +35 -0
- package/dist/lib/inputs/date-input.js +78 -0
- package/dist/lib/inputs/index.d.ts +24 -0
- package/dist/lib/inputs/index.js +49 -0
- package/dist/lib/inputs/number-input.d.ts +29 -0
- package/dist/lib/inputs/number-input.js +53 -0
- package/dist/lib/inputs/select-asset-kna.d.ts +34 -0
- package/dist/lib/inputs/select-asset-kna.js +50 -0
- package/dist/lib/inputs/select-input.d.ts +18 -0
- package/dist/lib/inputs/select-input.js +29 -0
- package/dist/lib/inputs/service-input.d.ts +27 -0
- package/dist/lib/inputs/service-input.js +41 -0
- package/dist/lib/inputs/slider.d.ts +33 -0
- package/dist/lib/inputs/slider.js +51 -0
- package/dist/lib/inputs/switch.d.ts +21 -0
- package/dist/lib/inputs/switch.js +39 -0
- package/dist/lib/inputs/text-area.d.ts +20 -0
- package/dist/lib/inputs/text-area.js +37 -0
- package/dist/lib/inputs/text-format.d.ts +28 -0
- package/dist/lib/inputs/text-format.js +37 -0
- package/dist/lib/inputs/text-input.d.ts +34 -0
- package/dist/lib/inputs/text-input.js +64 -0
- package/dist/lib/ui/index.d.ts +4 -0
- package/dist/lib/ui/index.js +5 -0
- package/dist/lib/ui/label.d.ts +18 -0
- package/dist/lib/ui/label.js +30 -0
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/index.js +22 -0
- package/dist/lib/utils/typeDefs.d.ts +7 -0
- package/dist/lib/utils/typeDefs.js +18 -0
- package/dist/lib/utils/validation.d.ts +7 -0
- package/dist/lib/utils/validation.js +26 -0
- package/dist/lib/values.d.ts +21 -0
- package/dist/lib/values.js +86 -0
- package/dist/lib/visibility.d.ts +2 -0
- package/dist/lib/visibility.js +20 -0
- package/package.json +22 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
<a name="2.11.0"></a>
|
|
6
|
+
# [2.11.0](https://bitbucket.org/vixonicmodules/modules/compare/v2.10.0...v2.11.0) (2019-01-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add extension attribute to select-asset ([a8592e5](https://bitbucket.org/vixonicmodules/modules/commits/a8592e5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<a name="2.10.0"></a>
|
|
16
|
+
# [2.10.0](https://bitbucket.org/vixonicmodules/modules/compare/v2.9.0...v2.10.0) (2019-01-08)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* added WeatherService to service input ([96dad52](https://bitbucket.org/vixonicmodules/modules/commits/96dad52))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
<a name="2.9.0"></a>
|
|
26
|
+
# [2.9.0](https://bitbucket.org/vixonicmodules/modules/compare/v2.8.0...v2.9.0) (2019-01-03)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* auto mode for color picker ([bcf53d6](https://bitbucket.org/vixonicmodules/modules/commits/bcf53d6))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<a name="2.8.0"></a>
|
|
36
|
+
# [2.8.0](https://bitbucket.org/vixonicmodules/modules/compare/v2.7.1...v2.8.0) (2019-01-03)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
* color picker output definition. ([69641c9](https://bitbucket.org/vixonicmodules/modules/commits/69641c9))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
<a name="2.7.1"></a>
|
|
46
|
+
## [2.7.1](https://bitbucket.org/vixonicmodules/modules/compare/v2.7.0...v2.7.1) (2018-11-06)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Bug Fixes
|
|
50
|
+
|
|
51
|
+
* Errors isArray returning isMap ([54467f7](https://bitbucket.org/vixonicmodules/modules/commits/54467f7))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
<a name="2.7.0"></a>
|
|
56
|
+
# [2.7.0](https://bitbucket.org/vixonicmodules/modules/compare/v2.6.0...v2.7.0) (2018-11-06)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Features
|
|
60
|
+
|
|
61
|
+
* range in lists ([f3d28b4](https://bitbucket.org/vixonicmodules/modules/commits/f3d28b4))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
<a name="2.6.0"></a>
|
|
66
|
+
# [2.6.0](https://bitbucket.org/vixonicmodules/modules/compare/v2.5.0...v2.6.0) (2018-10-19)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Features
|
|
70
|
+
|
|
71
|
+
* select asset kna now accepts multiple ([3ee9ae7](https://bitbucket.org/vixonicmodules/modules/commits/3ee9ae7))
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
<a name="2.5.0"></a>
|
|
76
|
+
# [2.5.0](https://bitbucket.org/vixonicmodules/modules/compare/v2.4.0...v2.5.0) (2018-10-19)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
### Features
|
|
80
|
+
|
|
81
|
+
* added facebook service. ([5724f50](https://bitbucket.org/vixonicmodules/modules/commits/5724f50))
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<a name="2.4.0"></a>
|
|
86
|
+
# [2.4.0](https://bitbucket.org/vixonicmodules/modules/compare/v2.3.1...v2.4.0) (2018-10-19)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Features
|
|
90
|
+
|
|
91
|
+
* dynamic matrix container ([1ff8fb5](https://bitbucket.org/vixonicmodules/modules/commits/1ff8fb5))
|
|
92
|
+
* dynamic matrix input. ([1a84c44](https://bitbucket.org/vixonicmodules/modules/commits/1a84c44))
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
<a name="2.3.1"></a>
|
|
97
|
+
## [2.3.1](https://bitbucket.org/vixonicmodules/modules/compare/v2.3.0...v2.3.1) (2018-09-28)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
### Bug Fixes
|
|
101
|
+
|
|
102
|
+
* **validation:** not visible containers should not validate. ([37be5a2](https://bitbucket.org/vixonicmodules/modules/commits/37be5a2))
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
<a name="2.3.0"></a>
|
|
107
|
+
# [2.3.0](https://bitbucket.org/vixonicmodules/modules/compare/v2.0.2...v2.3.0) (2018-09-27)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### Bug Fixes
|
|
111
|
+
|
|
112
|
+
* merge issues ([b846326](https://bitbucket.org/vixonicmodules/modules/commits/b846326))
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
<a name="2.2.0"></a>
|
|
117
|
+
# [2.2.0](https://bitbucket.org/vixonicmodules/modules/compare/v2.1.0...v2.2.0) (2018-09-18)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
### Bug Fixes
|
|
121
|
+
|
|
122
|
+
* added show to IBaseElement ([afbefbb](https://bitbucket.org/vixonicmodules/modules/commits/afbefbb))
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### Features
|
|
126
|
+
|
|
127
|
+
* added durationFormula and getDuration to configuration ([13ab357](https://bitbucket.org/vixonicmodules/modules/commits/13ab357))
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
<a name="2.1.0"></a>
|
|
132
|
+
# [2.1.0](https://bitbucket.org/vixonicmodules/modules/compare/v2.0.1...v2.1.0) (2018-09-17)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
### Features
|
|
136
|
+
|
|
137
|
+
* **list-container:** added showItemId attribute ([20ce544](https://bitbucket.org/vixonicmodules/modules/commits/20ce544))
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
<a name="2.2.0"></a>
|
|
142
|
+
# [2.2.0](https://bitbucket.org/vixonicmodules/modules/compare/v2.1.0...v2.2.0) (2018-09-18)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
### Bug Fixes
|
|
146
|
+
|
|
147
|
+
* added show to IBaseElement ([afbefbb](https://bitbucket.org/vixonicmodules/modules/commits/afbefbb))
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### Features
|
|
151
|
+
|
|
152
|
+
* added durationFormula and getDuration to configuration ([13ab357](https://bitbucket.org/vixonicmodules/modules/commits/13ab357))
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
<a name="2.1.0"></a>
|
|
157
|
+
# [2.1.0](https://bitbucket.org/vixonicmodules/modules/compare/v2.0.1...v2.1.0) (2018-09-17)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### Features
|
|
161
|
+
|
|
162
|
+
* **list-container:** added showItemId attribute ([20ce544](https://bitbucket.org/vixonicmodules/modules/commits/20ce544))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
<a name="2.0.2"></a>
|
|
167
|
+
## [2.0.2](https://bitbucket.org/vixonicmodules/modules/compare/v2.0.1...v2.0.2) (2018-09-17)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
<a name="2.0.1"></a>
|
|
172
|
+
## [2.0.1](https://bitbucket.org/vixonicmodules/modules/compare/v2.0.0...v2.0.1) (2018-09-14)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
### Bug Fixes
|
|
176
|
+
|
|
177
|
+
* change typescript target from es2015 to es5 ([b4284c4](https://bitbucket.org/vixonicmodules/modules/commits/b4284c4))
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
<a name="2.0.0"></a>
|
|
182
|
+
# [2.0.0](https://bitbucket.org/vixonicmodules/modules/compare/v1.4.1...v2.0.0) (2018-09-13)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
### Features
|
|
186
|
+
|
|
187
|
+
* **ts:** change typescript version ([86ec66e](https://bitbucket.org/vixonicmodules/modules/commits/86ec66e))
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
### BREAKING CHANGES
|
|
191
|
+
|
|
192
|
+
* **ts:** typescript version 2.4.2
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
<a name="1.4.1"></a>
|
|
197
|
+
## [1.4.1](https://bitbucket.org/vixonicmodules/modules/compare/v1.4.0...v1.4.1) (2018-09-13)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
### Bug Fixes
|
|
201
|
+
|
|
202
|
+
* date input value validation ([6ebba74](https://bitbucket.org/vixonicmodules/modules/commits/6ebba74))
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
<a name="1.4.0"></a>
|
|
207
|
+
# [1.4.0](https://bitbucket.org/vixonicmodules/modules/compare/v1.3.0...v1.4.0) (2018-09-12)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
### Features
|
|
211
|
+
|
|
212
|
+
* **validation-scheme:** new validation scheme. BREAKING CHANGE: Not compatible with previous versions. ([ad0835d](https://bitbucket.org/vixonicmodules/modules/commits/ad0835d))
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
<a name="1.3.0"></a>
|
|
217
|
+
# [1.3.0](https://bitbucket.org/vixonicmodules/modules/compare/v1.2.0...v1.3.0) (2018-09-10)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
### Features
|
|
221
|
+
|
|
222
|
+
* list attr sortDisabled changed to sortable. ([f471dc9](https://bitbucket.org/vixonicmodules/modules/commits/f471dc9))
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
<a name="1.2.0"></a>
|
|
227
|
+
# [1.2.0](https://bitbucket.org/vixonicmodules/modules/compare/v1.1.1...v1.2.0) (2018-09-05)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
### Features
|
|
231
|
+
|
|
232
|
+
* add LinkedInCompanyMediaService to ServiceInput ([6042e54](https://bitbucket.org/vixonicmodules/modules/commits/6042e54))
|
|
233
|
+
* add sortDisabled attribute to lists ([cca2f4e](https://bitbucket.org/vixonicmodules/modules/commits/cca2f4e))
|
|
234
|
+
* added standard-version ([e0b1611](https://bitbucket.org/vixonicmodules/modules/commits/e0b1611))
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
<a name="1.1.1"></a>
|
|
239
|
+
## 1.1.1 (2018-09-05)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
### Bug Fixes
|
|
243
|
+
|
|
244
|
+
* allow empty "" values in autocomplete and select-input. ([762eafa](https://bitbucket.org/vixonicmodules/modules/commits/762eafa))
|
|
245
|
+
* autocomplete multiple typeDef ([7f1924a](https://bitbucket.org/vixonicmodules/modules/commits/7f1924a))
|
|
246
|
+
* group show fixed ([381c1b5](https://bitbucket.org/vixonicmodules/modules/commits/381c1b5))
|
|
247
|
+
* Number input validation when no range is available ([45ebaa7](https://bitbucket.org/vixonicmodules/modules/commits/45ebaa7))
|
|
248
|
+
* select input value type array ([d3cb3ef](https://bitbucket.org/vixonicmodules/modules/commits/d3cb3ef))
|
|
249
|
+
* TextFormat value font should include id ([29f8583](https://bitbucket.org/vixonicmodules/modules/commits/29f8583))
|
|
250
|
+
* update text-format typeDef to match the value. ([19cb679](https://bitbucket.org/vixonicmodules/modules/commits/19cb679))
|
|
251
|
+
* VixonicData type definition. ([7309a48](https://bitbucket.org/vixonicmodules/modules/commits/7309a48))
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
### Features
|
|
255
|
+
|
|
256
|
+
* __isAsset in select-asset & text-format. Warn on duplicate ids when parsing toJSON. ([ccce2aa](https://bitbucket.org/vixonicmodules/modules/commits/ccce2aa))
|
|
257
|
+
* added show to label ([a30fa78](https://bitbucket.org/vixonicmodules/modules/commits/a30fa78))
|
|
258
|
+
* Added some utils, started validation ([cdc9f01](https://bitbucket.org/vixonicmodules/modules/commits/cdc9f01))
|
|
259
|
+
* adds service-input ([3ccafae](https://bitbucket.org/vixonicmodules/modules/commits/3ccafae))
|
|
260
|
+
* Date input validation fixes. ([9d29e42](https://bitbucket.org/vixonicmodules/modules/commits/9d29e42))
|
|
261
|
+
* list value and typedef for List ([99247a1](https://bitbucket.org/vixonicmodules/modules/commits/99247a1))
|
|
262
|
+
* service input now has InstagramMedia option. ([b5090fe](https://bitbucket.org/vixonicmodules/modules/commits/b5090fe))
|
|
263
|
+
* shared IDs now posible ([d2d1dd7](https://bitbucket.org/vixonicmodules/modules/commits/d2d1dd7))
|
|
264
|
+
* validation logic implemented ([2cf1fb7](https://bitbucket.org/vixonicmodules/modules/commits/2cf1fb7))
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Configuration } from './lib';
|
|
2
|
+
export { Errors, ErrorsMap } from './lib/errors';
|
|
3
|
+
export { Autocomplete, ColorPicker, DateInput, NumberInput, SelectAssetKna, SelectInput, Switch, Slider, TextArea, TextFormat, TextInput, ServiceInput, isInput, InputValue, InputComponent, isInputInstance } from './lib/inputs';
|
|
4
|
+
export { Label } from './lib/ui';
|
|
5
|
+
export { Group, List, DynamicMatrix } from './lib/containers';
|
|
6
|
+
export { RangeValue, DateRangeValue, NumberRangeValue } from './lib/values';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var lib_1 = require("./lib");
|
|
4
|
+
exports.Configuration = lib_1.Configuration;
|
|
5
|
+
var errors_1 = require("./lib/errors");
|
|
6
|
+
exports.Errors = errors_1.Errors;
|
|
7
|
+
var inputs_1 = require("./lib/inputs");
|
|
8
|
+
exports.Autocomplete = inputs_1.Autocomplete;
|
|
9
|
+
exports.ColorPicker = inputs_1.ColorPicker;
|
|
10
|
+
exports.DateInput = inputs_1.DateInput;
|
|
11
|
+
exports.NumberInput = inputs_1.NumberInput;
|
|
12
|
+
exports.SelectAssetKna = inputs_1.SelectAssetKna;
|
|
13
|
+
exports.SelectInput = inputs_1.SelectInput;
|
|
14
|
+
exports.Switch = inputs_1.Switch;
|
|
15
|
+
exports.Slider = inputs_1.Slider;
|
|
16
|
+
exports.TextArea = inputs_1.TextArea;
|
|
17
|
+
exports.TextFormat = inputs_1.TextFormat;
|
|
18
|
+
exports.TextInput = inputs_1.TextInput;
|
|
19
|
+
exports.ServiceInput = inputs_1.ServiceInput;
|
|
20
|
+
exports.isInput = inputs_1.isInput;
|
|
21
|
+
exports.isInputInstance = inputs_1.isInputInstance;
|
|
22
|
+
var ui_1 = require("./lib/ui");
|
|
23
|
+
exports.Label = ui_1.Label;
|
|
24
|
+
var containers_1 = require("./lib/containers");
|
|
25
|
+
exports.Group = containers_1.Group;
|
|
26
|
+
exports.List = containers_1.List;
|
|
27
|
+
exports.DynamicMatrix = containers_1.DynamicMatrix;
|
|
28
|
+
var values_1 = require("./lib/values");
|
|
29
|
+
exports.RangeValue = values_1.RangeValue;
|
|
30
|
+
exports.DateRangeValue = values_1.DateRangeValue;
|
|
31
|
+
exports.NumberRangeValue = values_1.NumberRangeValue;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { InputValue } from "./inputs";
|
|
2
|
+
import { ValueError, SimpleValueError } from "./errors";
|
|
3
|
+
import { Configuration } from ".";
|
|
4
|
+
export declare type Diff<T extends string, U extends string> = ({
|
|
5
|
+
[P in T]: P;
|
|
6
|
+
} & {
|
|
7
|
+
[P in U]: never;
|
|
8
|
+
} & {
|
|
9
|
+
[x: string]: never;
|
|
10
|
+
})[T];
|
|
11
|
+
export declare type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
|
|
12
|
+
export interface IBaseElement {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly label: string;
|
|
15
|
+
readonly show?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface IInput extends IBaseElement {
|
|
18
|
+
}
|
|
19
|
+
export declare abstract class ConfigurationElement {
|
|
20
|
+
readonly abstract type: string;
|
|
21
|
+
static readonly type: string;
|
|
22
|
+
protected show?: string;
|
|
23
|
+
shouldShow(values: Configuration.Value): boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare abstract class BaseElement extends ConfigurationElement implements IBaseElement {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly label: string;
|
|
28
|
+
readonly show?: string;
|
|
29
|
+
constructor({id, label, show}: IInput);
|
|
30
|
+
}
|
|
31
|
+
export declare abstract class Input<V extends InputValue = InputValue, E extends ValueError = ValueError> extends BaseElement {
|
|
32
|
+
validate: (value: V, ctx: Configuration.Value) => (SimpleValueError<"invalidValue"> | E)[];
|
|
33
|
+
abstract validateInput(value: V | undefined): E[];
|
|
34
|
+
abstract isValidValue(value?: any): value is V;
|
|
35
|
+
abstract valueTypeDef: () => string;
|
|
36
|
+
}
|
package/dist/lib/base.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return function (d, b) {
|
|
7
|
+
extendStatics(d, b);
|
|
8
|
+
function __() { this.constructor = d; }
|
|
9
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
var visibility_1 = require("./visibility");
|
|
14
|
+
var ConfigurationElement = (function () {
|
|
15
|
+
function ConfigurationElement() {
|
|
16
|
+
this.type = '';
|
|
17
|
+
}
|
|
18
|
+
ConfigurationElement.prototype.shouldShow = function (values) {
|
|
19
|
+
return visibility_1.shouldBeVisible(this, values);
|
|
20
|
+
};
|
|
21
|
+
return ConfigurationElement;
|
|
22
|
+
}());
|
|
23
|
+
exports.ConfigurationElement = ConfigurationElement;
|
|
24
|
+
var BaseElement = (function (_super) {
|
|
25
|
+
__extends(BaseElement, _super);
|
|
26
|
+
function BaseElement(_a) {
|
|
27
|
+
var id = _a.id, label = _a.label, show = _a.show;
|
|
28
|
+
var _this = _super.call(this) || this;
|
|
29
|
+
_this.id = id;
|
|
30
|
+
_this.label = label;
|
|
31
|
+
_this.show = show;
|
|
32
|
+
return _this;
|
|
33
|
+
}
|
|
34
|
+
return BaseElement;
|
|
35
|
+
}(ConfigurationElement));
|
|
36
|
+
exports.BaseElement = BaseElement;
|
|
37
|
+
var Input = (function (_super) {
|
|
38
|
+
__extends(Input, _super);
|
|
39
|
+
function Input() {
|
|
40
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
41
|
+
_this.validate = function (value, ctx) {
|
|
42
|
+
var show = _this.shouldShow(ctx);
|
|
43
|
+
if (!show)
|
|
44
|
+
return [];
|
|
45
|
+
var errors = [];
|
|
46
|
+
if (value !== undefined && !_this.isValidValue(value)) {
|
|
47
|
+
errors = errors.concat([{ type: 'invalidValue' }]);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
errors = errors.concat(_this.validateInput(value));
|
|
51
|
+
}
|
|
52
|
+
return errors;
|
|
53
|
+
};
|
|
54
|
+
return _this;
|
|
55
|
+
}
|
|
56
|
+
return Input;
|
|
57
|
+
}(BaseElement));
|
|
58
|
+
exports.Input = Input;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Omit, BaseElement, IBaseElement } from '../base';
|
|
2
|
+
import { List } from './list';
|
|
3
|
+
import { InputComponent } from '../inputs';
|
|
4
|
+
import { UIComponent } from '../ui';
|
|
5
|
+
import { TypeDefMap } from '../utils/typeDefs';
|
|
6
|
+
import { ErrorsMap, Errors } from '../errors';
|
|
7
|
+
import { Configuration } from '..';
|
|
8
|
+
export declare type DisplayClass = '2-lines' | '1-line';
|
|
9
|
+
export declare type DisplayAttributes = {
|
|
10
|
+
title: string;
|
|
11
|
+
subtitle?: string;
|
|
12
|
+
};
|
|
13
|
+
export interface IDynamicMatrix extends IBaseElement {
|
|
14
|
+
listIds: (string | List)[];
|
|
15
|
+
itemSchema: (InputComponent | UIComponent)[];
|
|
16
|
+
description?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ListJSON extends Omit<IDynamicMatrix, 'itemSchema'> {
|
|
19
|
+
itemSchema: {
|
|
20
|
+
type: string;
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
export declare type MatrixItem = {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
};
|
|
26
|
+
export declare namespace DynamicMatrix {
|
|
27
|
+
type Value = {
|
|
28
|
+
[key: string]: DynamicMatrix.Value | MatrixItem;
|
|
29
|
+
};
|
|
30
|
+
type ItemValue = MatrixItem;
|
|
31
|
+
type Error = {
|
|
32
|
+
type: 'InvalidValue';
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export declare class DynamicMatrix extends BaseElement {
|
|
36
|
+
static readonly type: string;
|
|
37
|
+
type: string;
|
|
38
|
+
readonly listIds: string[];
|
|
39
|
+
readonly itemSchema: (InputComponent | UIComponent)[];
|
|
40
|
+
readonly description?: string;
|
|
41
|
+
constructor(options: IDynamicMatrix);
|
|
42
|
+
validate(value: DynamicMatrix.Value | undefined, ctx: Configuration.Value): ErrorsMap | DynamicMatrix.Error[];
|
|
43
|
+
validateItem(value: DynamicMatrix.ItemValue, ctx: Configuration.Value): Errors<DynamicMatrix.Error>;
|
|
44
|
+
isValidValue(v: any): v is DynamicMatrix.Value;
|
|
45
|
+
valueTypeDef: () => TypeDefMap;
|
|
46
|
+
static fromJSON(value: ListJSON): DynamicMatrix;
|
|
47
|
+
static isInstance(instance: any): instance is DynamicMatrix;
|
|
48
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return function (d, b) {
|
|
7
|
+
extendStatics(d, b);
|
|
8
|
+
function __() { this.constructor = d; }
|
|
9
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
|
13
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
14
|
+
s = arguments[i];
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
}
|
|
18
|
+
return t;
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
var base_1 = require("../base");
|
|
22
|
+
var inputs_1 = require("../inputs");
|
|
23
|
+
var utils_1 = require("../utils");
|
|
24
|
+
var typeDefs_1 = require("../utils/typeDefs");
|
|
25
|
+
var DynamicMatrix = (function (_super) {
|
|
26
|
+
__extends(DynamicMatrix, _super);
|
|
27
|
+
function DynamicMatrix(options) {
|
|
28
|
+
var _this = _super.call(this, options) || this;
|
|
29
|
+
_this.type = DynamicMatrix.type;
|
|
30
|
+
_this.valueTypeDef = function () {
|
|
31
|
+
var declarations = [];
|
|
32
|
+
declarations = declarations.concat(typeDefs_1.getDefsFromInputs(_this.itemSchema.filter(inputs_1.isInput)));
|
|
33
|
+
return {
|
|
34
|
+
id: _this.id,
|
|
35
|
+
typeDef: _this.listIds.map(function (id) { return "{ [key: string]: "; }).join('') + " {" + typeDefs_1.defsMapToString(declarations) + "}" + _this.listIds.map(function (id) { return ' }'; }).join('')
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
_this.listIds = options.listIds.map(function (list) { return typeof list === 'string' ? list : list.id; });
|
|
39
|
+
_this.itemSchema = options.itemSchema;
|
|
40
|
+
_this.description = options.description;
|
|
41
|
+
return _this;
|
|
42
|
+
}
|
|
43
|
+
DynamicMatrix.prototype.validate = function (value, ctx) {
|
|
44
|
+
// No value, then is valid.
|
|
45
|
+
if (!value)
|
|
46
|
+
return {};
|
|
47
|
+
// Not a valid value.
|
|
48
|
+
if (!this.isValidValue(value))
|
|
49
|
+
return [{ type: 'InvalidValue' }];
|
|
50
|
+
else
|
|
51
|
+
return {};
|
|
52
|
+
};
|
|
53
|
+
DynamicMatrix.prototype.validateItem = function (value, ctx) {
|
|
54
|
+
var itemErrors = {};
|
|
55
|
+
this.itemSchema.forEach(function (input) {
|
|
56
|
+
if (inputs_1.isInput(input)) {
|
|
57
|
+
itemErrors[input.id] = input.validate(value[input.id], ctx);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return itemErrors;
|
|
61
|
+
};
|
|
62
|
+
DynamicMatrix.prototype.isValidValue = function (v) {
|
|
63
|
+
return v && typeof v === 'object';
|
|
64
|
+
};
|
|
65
|
+
DynamicMatrix.fromJSON = function (value) {
|
|
66
|
+
return new DynamicMatrix(__assign({}, value, { itemSchema: value.itemSchema.map(function (i) {
|
|
67
|
+
return utils_1.createComponentFromJSON(i.type, i);
|
|
68
|
+
}) }));
|
|
69
|
+
};
|
|
70
|
+
DynamicMatrix.isInstance = function (instance) {
|
|
71
|
+
return instance.type === DynamicMatrix.type;
|
|
72
|
+
};
|
|
73
|
+
DynamicMatrix.type = 'dynamic-matrix';
|
|
74
|
+
return DynamicMatrix;
|
|
75
|
+
}(base_1.BaseElement));
|
|
76
|
+
exports.DynamicMatrix = DynamicMatrix;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IBaseElement, BaseElement } from '../base';
|
|
2
|
+
import { InputComponent } from '../inputs';
|
|
3
|
+
import { UIComponent } from '../ui';
|
|
4
|
+
import { TypeDefMap } from '../utils/typeDefs';
|
|
5
|
+
export interface IGroup extends IBaseElement {
|
|
6
|
+
items: (InputComponent | UIComponent)[];
|
|
7
|
+
}
|
|
8
|
+
export interface GroupJSON extends IBaseElement {
|
|
9
|
+
items: {
|
|
10
|
+
type: string;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
export declare class Group extends BaseElement {
|
|
14
|
+
static readonly type: string;
|
|
15
|
+
type: string;
|
|
16
|
+
readonly items: (InputComponent | UIComponent)[];
|
|
17
|
+
constructor(options: IGroup);
|
|
18
|
+
valueTypeDef: () => TypeDefMap[];
|
|
19
|
+
static fromJSON(value: GroupJSON): Group;
|
|
20
|
+
static isInstance(instance: any): instance is Group;
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return function (d, b) {
|
|
7
|
+
extendStatics(d, b);
|
|
8
|
+
function __() { this.constructor = d; }
|
|
9
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
|
13
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
14
|
+
s = arguments[i];
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
}
|
|
18
|
+
return t;
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
var base_1 = require("../base");
|
|
22
|
+
var inputs_1 = require("../inputs");
|
|
23
|
+
var utils_1 = require("../utils");
|
|
24
|
+
var typeDefs_1 = require("../utils/typeDefs");
|
|
25
|
+
var Group = (function (_super) {
|
|
26
|
+
__extends(Group, _super);
|
|
27
|
+
function Group(options) {
|
|
28
|
+
var _this = _super.call(this, options) || this;
|
|
29
|
+
_this.type = Group.type;
|
|
30
|
+
_this.valueTypeDef = function () {
|
|
31
|
+
return typeDefs_1.getDefsFromInputs(_this.items.filter(inputs_1.isInput));
|
|
32
|
+
};
|
|
33
|
+
_this.items = options.items;
|
|
34
|
+
return _this;
|
|
35
|
+
}
|
|
36
|
+
Group.fromJSON = function (value) {
|
|
37
|
+
return new Group(__assign({}, value, { items: value.items.map(function (i) {
|
|
38
|
+
return utils_1.createComponentFromJSON(i.type, i);
|
|
39
|
+
}) }));
|
|
40
|
+
};
|
|
41
|
+
Group.isInstance = function (instance) {
|
|
42
|
+
return instance.type === Group.type;
|
|
43
|
+
};
|
|
44
|
+
Group.type = 'group';
|
|
45
|
+
return Group;
|
|
46
|
+
}(base_1.BaseElement));
|
|
47
|
+
exports.Group = Group;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Group } from './group';
|
|
2
|
+
import { List } from './list';
|
|
3
|
+
import { DynamicMatrix } from './dynamic-matrix';
|
|
4
|
+
export { Group, List, DynamicMatrix };
|
|
5
|
+
export declare type ContainerComponent = Group | List;
|
|
6
|
+
export declare const allContainer: (typeof Group | typeof List | typeof DynamicMatrix)[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var group_1 = require("./group");
|
|
4
|
+
exports.Group = group_1.Group;
|
|
5
|
+
var list_1 = require("./list");
|
|
6
|
+
exports.List = list_1.List;
|
|
7
|
+
var dynamic_matrix_1 = require("./dynamic-matrix");
|
|
8
|
+
exports.DynamicMatrix = dynamic_matrix_1.DynamicMatrix;
|
|
9
|
+
exports.allContainer = [
|
|
10
|
+
group_1.Group,
|
|
11
|
+
list_1.List,
|
|
12
|
+
dynamic_matrix_1.DynamicMatrix
|
|
13
|
+
];
|