@zajno/common 1.3.16 → 1.4.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/coverage/clover.xml +2 -2
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/src/__tests__/helpers/index.html +1 -1
- package/coverage/lcov-report/src/__tests__/helpers/main.ts.html +1 -1
- package/coverage/lcov-report/src/async/arrays.ts.html +1 -1
- package/coverage/lcov-report/src/async/index.html +1 -1
- package/coverage/lcov-report/src/dates/calc.ts.html +1 -1
- package/coverage/lcov-report/src/dates/convert.ts.html +1 -1
- package/coverage/lcov-report/src/dates/datex.ts.html +1 -1
- package/coverage/lcov-report/src/dates/format.ts.html +1 -1
- package/coverage/lcov-report/src/dates/index.html +1 -1
- package/coverage/lcov-report/src/dates/index.ts.html +1 -1
- package/coverage/lcov-report/src/dates/parse.ts.html +1 -1
- package/coverage/lcov-report/src/dates/period.ts.html +1 -1
- package/coverage/lcov-report/src/dates/shift.ts.html +1 -1
- package/coverage/lcov-report/src/dates/types.ts.html +1 -1
- package/coverage/lcov-report/src/dates/yearDate.ts.html +1 -1
- package/coverage/lcov-report/src/enumHelper.ts.html +1 -1
- package/coverage/lcov-report/src/event.ts.html +1 -1
- package/coverage/lcov-report/src/fields/index.html +1 -1
- package/coverage/lcov-report/src/fields/update.ts.html +1 -1
- package/coverage/lcov-report/src/functions.ts.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/lazy.light.ts.html +1 -1
- package/coverage/lcov-report/src/logger/batch.ts.html +1 -1
- package/coverage/lcov-report/src/logger/console.ts.html +1 -1
- package/coverage/lcov-report/src/logger/index.html +1 -1
- package/coverage/lcov-report/src/logger/index.ts.html +1 -1
- package/coverage/lcov-report/src/logger/named.ts.html +1 -1
- package/coverage/lcov-report/src/logger/proxy.ts.html +1 -1
- package/coverage/lcov-report/src/math/arrays.ts.html +1 -1
- package/coverage/lcov-report/src/math/calc.ts.html +1 -1
- package/coverage/lcov-report/src/math/distribution.ts.html +1 -1
- package/coverage/lcov-report/src/math/index.html +1 -1
- package/coverage/lcov-report/src/math/index.ts.html +1 -1
- package/coverage/lcov-report/src/transitionObserver.ts.html +1 -1
- package/coverage/lcov-report/src/types.ts.html +1 -1
- package/coverage/lcov-report/src/validation/ValidationErrors.ts.html +1 -1
- package/coverage/lcov-report/src/validation/creditCard.ts.html +1 -1
- package/coverage/lcov-report/src/validation/helpers.ts.html +1 -1
- package/coverage/lcov-report/src/validation/index.html +1 -1
- package/coverage/lcov-report/src/validation/index.ts.html +1 -1
- package/coverage/lcov-report/src/validation/types.ts.html +1 -1
- package/coverage/lcov-report/src/validation/validators.ts.html +1 -1
- package/coverage/lcov-report/src/validation/wrappers.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/FlagModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/MultiSelectModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/NumberModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/SelectModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/Validatable.ts.html +2 -2
- package/coverage/lcov-report/src/viewModels/index.html +1 -1
- package/coverage/lcov-report/src/viewModels/wrappers.ts.html +1 -1
- package/lib/viewModels/CommonModel.d.ts +14 -0
- package/lib/viewModels/CommonModel.d.ts.map +1 -0
- package/lib/viewModels/CommonModel.js +48 -0
- package/lib/viewModels/CommonModel.js.map +1 -0
- package/lib/viewModels/Validatable.d.ts +1 -1
- package/lib/viewModels/Validatable.d.ts.map +1 -1
- package/lib/viewModels/index.d.ts +1 -0
- package/lib/viewModels/index.d.ts.map +1 -1
- package/lib/viewModels/index.js +1 -0
- package/lib/viewModels/index.js.map +1 -1
- package/package.json +1 -1
- package/src/viewModels/CommonModel.ts +46 -0
- package/src/viewModels/Validatable.ts +1 -1
- package/src/viewModels/index.ts +1 -0
package/coverage/clover.xml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="
|
|
3
|
-
<project timestamp="
|
|
2
|
+
<coverage generated="1643638218939" clover="3.2.0">
|
|
3
|
+
<project timestamp="1643638218939" name="All files">
|
|
4
4
|
<metrics statements="1206" coveredstatements="1025" conditionals="776" coveredconditionals="622" methods="356" coveredmethods="256" elements="2338" coveredelements="1903" complexity="0" loc="1206" ncloc="1206" packages="9" files="41" classes="41"/>
|
|
5
5
|
<package name="src">
|
|
6
6
|
<metrics statements="182" coveredstatements="159" conditionals="101" coveredconditionals="83" methods="68" coveredmethods="55"/>
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
216
216
|
Code coverage generated by
|
|
217
217
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
218
|
-
at
|
|
218
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
219
219
|
</div>
|
|
220
220
|
</div>
|
|
221
221
|
<script src="prettify.js"></script>
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
96
96
|
Code coverage generated by
|
|
97
97
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
98
|
-
at
|
|
98
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
99
99
|
</div>
|
|
100
100
|
</div>
|
|
101
101
|
<script src="../../../prettify.js"></script>
|
|
@@ -100,7 +100,7 @@ export const toArbitrary = (fakerGen) => {
|
|
|
100
100
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
101
101
|
Code coverage generated by
|
|
102
102
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
103
|
-
at
|
|
103
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
104
104
|
</div>
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../../../prettify.js"></script>
|
|
@@ -178,7 +178,7 @@ export async function <span class="fstat-no" title="function not covered" >mapAs
|
|
|
178
178
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
179
179
|
Code coverage generated by
|
|
180
180
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
181
|
-
at
|
|
181
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
182
182
|
</div>
|
|
183
183
|
</div>
|
|
184
184
|
<script src="../../prettify.js"></script>
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
96
96
|
Code coverage generated by
|
|
97
97
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
98
|
-
at
|
|
98
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
99
99
|
</div>
|
|
100
100
|
</div>
|
|
101
101
|
<script src="../../prettify.js"></script>
|
|
@@ -280,7 +280,7 @@ export function clamp(d: Date, low: Date, high: Date) {
|
|
|
280
280
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
281
281
|
Code coverage generated by
|
|
282
282
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
283
|
-
at
|
|
283
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
284
284
|
</div>
|
|
285
285
|
</div>
|
|
286
286
|
<script src="../../prettify.js"></script>
|
|
@@ -637,7 +637,7 @@ export function getDaysStreak(dates: number[], descentOrder: boolean): number {
|
|
|
637
637
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
638
638
|
Code coverage generated by
|
|
639
639
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
640
|
-
at
|
|
640
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
641
641
|
</div>
|
|
642
642
|
</div>
|
|
643
643
|
<script src="../../prettify.js"></script>
|
|
@@ -190,7 +190,7 @@ export namespace DateX {
|
|
|
190
190
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
191
191
|
Code coverage generated by
|
|
192
192
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
193
|
-
at
|
|
193
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
194
194
|
</div>
|
|
195
195
|
</div>
|
|
196
196
|
<script src="../../prettify.js"></script>
|
|
@@ -382,7 +382,7 @@ export namespace Format {
|
|
|
382
382
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
383
383
|
Code coverage generated by
|
|
384
384
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
385
|
-
at
|
|
385
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
386
386
|
</div>
|
|
387
387
|
</div>
|
|
388
388
|
<script src="../../prettify.js"></script>
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
231
231
|
Code coverage generated by
|
|
232
232
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
233
|
-
at
|
|
233
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
234
234
|
</div>
|
|
235
235
|
</div>
|
|
236
236
|
<script src="../../prettify.js"></script>
|
|
@@ -91,7 +91,7 @@ export * from './yearDate';
|
|
|
91
91
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
92
92
|
Code coverage generated by
|
|
93
93
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
94
|
-
at
|
|
94
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
95
95
|
</div>
|
|
96
96
|
</div>
|
|
97
97
|
<script src="../../prettify.js"></script>
|
|
@@ -136,7 +136,7 @@ export namespace Parse {
|
|
|
136
136
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
137
137
|
Code coverage generated by
|
|
138
138
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
139
|
-
at
|
|
139
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
140
140
|
</div>
|
|
141
141
|
</div>
|
|
142
142
|
<script src="../../prettify.js"></script>
|
|
@@ -133,7 +133,7 @@ export namespace Period {
|
|
|
133
133
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
134
134
|
Code coverage generated by
|
|
135
135
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
136
|
-
at
|
|
136
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
137
137
|
</div>
|
|
138
138
|
</div>
|
|
139
139
|
<script src="../../prettify.js"></script>
|
|
@@ -334,7 +334,7 @@ export function isSame(d1: Date | number, d2: Date | number, g: Granularity, loc
|
|
|
334
334
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
335
335
|
Code coverage generated by
|
|
336
336
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
337
|
-
at
|
|
337
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
338
338
|
</div>
|
|
339
339
|
</div>
|
|
340
340
|
<script src="../../prettify.js"></script>
|
|
@@ -160,7 +160,7 @@ export namespace ConstantGranularity {
|
|
|
160
160
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
161
161
|
Code coverage generated by
|
|
162
162
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
163
|
-
at
|
|
163
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
164
164
|
</div>
|
|
165
165
|
</div>
|
|
166
166
|
<script src="../../prettify.js"></script>
|
|
@@ -172,7 +172,7 @@ export namespace YearDate {
|
|
|
172
172
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
173
173
|
Code coverage generated by
|
|
174
174
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
175
|
-
at
|
|
175
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
176
176
|
</div>
|
|
177
177
|
</div>
|
|
178
178
|
<script src="../../prettify.js"></script>
|
|
@@ -433,7 +433,7 @@ export class EnumBitwiseHelper<T extends number> extends EnumHelper<T&g
|
|
|
433
433
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
434
434
|
Code coverage generated by
|
|
435
435
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
436
|
-
at
|
|
436
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
437
437
|
</div>
|
|
438
438
|
</div>
|
|
439
439
|
<script src="../prettify.js"></script>
|
|
@@ -262,7 +262,7 @@ export class Event<T = any> implements IEvent<T> {
|
|
|
262
262
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
263
263
|
Code coverage generated by
|
|
264
264
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
265
|
-
at
|
|
265
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
266
266
|
</div>
|
|
267
267
|
</div>
|
|
268
268
|
<script src="../prettify.js"></script>
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
96
96
|
Code coverage generated by
|
|
97
97
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
98
|
-
at
|
|
98
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
99
99
|
</div>
|
|
100
100
|
</div>
|
|
101
101
|
<script src="../../prettify.js"></script>
|
|
@@ -415,7 +415,7 @@ export function updateArray<T>(
|
|
|
415
415
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
416
416
|
Code coverage generated by
|
|
417
417
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
418
|
-
at
|
|
418
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
419
419
|
</div>
|
|
420
420
|
</div>
|
|
421
421
|
<script src="../../prettify.js"></script>
|
|
@@ -106,7 +106,7 @@ export function safeCall<T extends (...args: any) => any>(cb: T | undef
|
|
|
106
106
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
107
107
|
Code coverage generated by
|
|
108
108
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
109
|
-
at
|
|
109
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
110
110
|
</div>
|
|
111
111
|
</div>
|
|
112
112
|
<script src="../prettify.js"></script>
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
171
171
|
Code coverage generated by
|
|
172
172
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
173
|
-
at
|
|
173
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
174
174
|
</div>
|
|
175
175
|
</div>
|
|
176
176
|
<script src="../prettify.js"></script>
|
|
@@ -151,7 +151,7 @@ export function createLazy<T>(factory: () => T) {
|
|
|
151
151
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
152
152
|
Code coverage generated by
|
|
153
153
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
154
|
-
at
|
|
154
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
155
155
|
</div>
|
|
156
156
|
</div>
|
|
157
157
|
<script src="../prettify.js"></script>
|
|
@@ -91,7 +91,7 @@ export function batchLoggers(...loggers: ILogger[]): ILogger {
|
|
|
91
91
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
92
92
|
Code coverage generated by
|
|
93
93
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
94
|
-
at
|
|
94
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
95
95
|
</div>
|
|
96
96
|
</div>
|
|
97
97
|
<script src="../../prettify.js"></script>
|
|
@@ -220,7 +220,7 @@ export class BufferedConsoleLogger implements ILogger {
|
|
|
220
220
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
221
221
|
Code coverage generated by
|
|
222
222
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
223
|
-
at
|
|
223
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
224
224
|
</div>
|
|
225
225
|
</div>
|
|
226
226
|
<script src="../../prettify.js"></script>
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
156
156
|
Code coverage generated by
|
|
157
157
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
158
|
-
at
|
|
158
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
159
159
|
</div>
|
|
160
160
|
</div>
|
|
161
161
|
<script src="../../prettify.js"></script>
|
|
@@ -277,7 +277,7 @@ function _createImplementation(overrideMode: typeof Mode = undefined): ILogger {
|
|
|
277
277
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
278
278
|
Code coverage generated by
|
|
279
279
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
280
|
-
at
|
|
280
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
281
281
|
</div>
|
|
282
282
|
</div>
|
|
283
283
|
<script src="../../prettify.js"></script>
|
|
@@ -205,7 +205,7 @@ export abstract class NamedLogger implements ILogger, ILoggerSwitchable {
|
|
|
205
205
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
206
206
|
Code coverage generated by
|
|
207
207
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
208
|
-
at
|
|
208
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
209
209
|
</div>
|
|
210
210
|
</div>
|
|
211
211
|
<script src="../../prettify.js"></script>
|
|
@@ -151,7 +151,7 @@ export class ProxyLogger extends NamedLogger {
|
|
|
151
151
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
152
152
|
Code coverage generated by
|
|
153
153
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
154
|
-
at
|
|
154
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
155
155
|
</div>
|
|
156
156
|
</div>
|
|
157
157
|
<script src="../../prettify.js"></script>
|
|
@@ -847,7 +847,7 @@ export function arrayRepeat<T>(factory: Getter<T>, count = <span cla
|
|
|
847
847
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
848
848
|
Code coverage generated by
|
|
849
849
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
850
|
-
at
|
|
850
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
851
851
|
</div>
|
|
852
852
|
</div>
|
|
853
853
|
<script src="../../prettify.js"></script>
|
|
@@ -271,7 +271,7 @@ export function <span class="fstat-no" title="function not covered" >badRandomSt
|
|
|
271
271
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
272
272
|
Code coverage generated by
|
|
273
273
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
274
|
-
at
|
|
274
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
275
275
|
</div>
|
|
276
276
|
</div>
|
|
277
277
|
<script src="../../prettify.js"></script>
|
|
@@ -124,7 +124,7 @@ export function extendDistribution<T extends keyof any>(count: number, typ
|
|
|
124
124
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
125
125
|
Code coverage generated by
|
|
126
126
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
127
|
-
at
|
|
127
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
128
128
|
</div>
|
|
129
129
|
</div>
|
|
130
130
|
<script src="../../prettify.js"></script>
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
141
141
|
Code coverage generated by
|
|
142
142
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
143
|
-
at
|
|
143
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
144
144
|
</div>
|
|
145
145
|
</div>
|
|
146
146
|
<script src="../../prettify.js"></script>
|
|
@@ -145,7 +145,7 @@ export function format(n: number, digits?: number) {
|
|
|
145
145
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
146
146
|
Code coverage generated by
|
|
147
147
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
148
|
-
at
|
|
148
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
149
149
|
</div>
|
|
150
150
|
</div>
|
|
151
151
|
<script src="../../prettify.js"></script>
|
|
@@ -592,7 +592,7 @@ export class TransitionObserver<T> implements IDisposable {
|
|
|
592
592
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
593
593
|
Code coverage generated by
|
|
594
594
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
595
|
-
at
|
|
595
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
596
596
|
</div>
|
|
597
597
|
</div>
|
|
598
598
|
<script src="../prettify.js"></script>
|
|
@@ -154,7 +154,7 @@ export type TypedKeys<T extends Object, K> = {
|
|
|
154
154
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
155
155
|
Code coverage generated by
|
|
156
156
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
157
|
-
at
|
|
157
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
158
158
|
</div>
|
|
159
159
|
</div>
|
|
160
160
|
<script src="../prettify.js"></script>
|
|
@@ -142,7 +142,7 @@ export namespace <span class="branch-1 cbranch-no" title="branch not covered" >V
|
|
|
142
142
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
143
143
|
Code coverage generated by
|
|
144
144
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
145
|
-
at
|
|
145
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
146
146
|
</div>
|
|
147
147
|
</div>
|
|
148
148
|
<script src="../../prettify.js"></script>
|
|
@@ -139,7 +139,7 @@ export default {
|
|
|
139
139
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
140
140
|
Code coverage generated by
|
|
141
141
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
142
|
-
at
|
|
142
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
143
143
|
</div>
|
|
144
144
|
</div>
|
|
145
145
|
<script src="../../prettify.js"></script>
|
|
@@ -208,7 +208,7 @@ export function <span class="fstat-no" title="function not covered" >validateObj
|
|
|
208
208
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
209
209
|
Code coverage generated by
|
|
210
210
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
211
|
-
at
|
|
211
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
212
212
|
</div>
|
|
213
213
|
</div>
|
|
214
214
|
<script src="../../prettify.js"></script>
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
186
186
|
Code coverage generated by
|
|
187
187
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
188
|
-
at
|
|
188
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
189
189
|
</div>
|
|
190
190
|
</div>
|
|
191
191
|
<script src="../../prettify.js"></script>
|
|
@@ -91,7 +91,7 @@ export * from './helpers';
|
|
|
91
91
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
92
92
|
Code coverage generated by
|
|
93
93
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
94
|
-
at
|
|
94
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
95
95
|
</div>
|
|
96
96
|
</div>
|
|
97
97
|
<script src="../../prettify.js"></script>
|
|
@@ -109,7 +109,7 @@ export class ValidationError<TErrors = ValidationErrors> extends Error {
|
|
|
109
109
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
110
110
|
Code coverage generated by
|
|
111
111
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
112
|
-
at
|
|
112
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
113
113
|
</div>
|
|
114
114
|
</div>
|
|
115
115
|
<script src="../../prettify.js"></script>
|
|
@@ -229,7 +229,7 @@ export const Validators = {
|
|
|
229
229
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
230
230
|
Code coverage generated by
|
|
231
231
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
232
|
-
at
|
|
232
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
233
233
|
</div>
|
|
234
234
|
</div>
|
|
235
235
|
<script src="../../prettify.js"></script>
|
|
@@ -142,7 +142,7 @@ export const Wrappers = {
|
|
|
142
142
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
143
143
|
Code coverage generated by
|
|
144
144
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
145
|
-
at
|
|
145
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
146
146
|
</div>
|
|
147
147
|
</div>
|
|
148
148
|
<script src="../../prettify.js"></script>
|
|
@@ -253,7 +253,7 @@ export class FlagModel implements IFlagModel, IFlagModelReadonly {
|
|
|
253
253
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
254
254
|
Code coverage generated by
|
|
255
255
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
256
|
-
at
|
|
256
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
257
257
|
</div>
|
|
258
258
|
</div>
|
|
259
259
|
<script src="../../prettify.js"></script>
|
|
@@ -556,7 +556,7 @@ export class MultiSelectString<T extends string = string> extends MultiSel
|
|
|
556
556
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
557
557
|
Code coverage generated by
|
|
558
558
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
559
|
-
at
|
|
559
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
560
560
|
</div>
|
|
561
561
|
</div>
|
|
562
562
|
<script src="../../prettify.js"></script>
|
|
@@ -196,7 +196,7 @@ export default NumberModel;
|
|
|
196
196
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
197
197
|
Code coverage generated by
|
|
198
198
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
199
|
-
at
|
|
199
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
200
200
|
</div>
|
|
201
201
|
</div>
|
|
202
202
|
<script src="../../prettify.js"></script>
|
|
@@ -448,7 +448,7 @@ export class SelectString<T extends string = string> extends Select<T&g
|
|
|
448
448
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
449
449
|
Code coverage generated by
|
|
450
450
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
451
|
-
at
|
|
451
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
452
452
|
</div>
|
|
453
453
|
</div>
|
|
454
454
|
<script src="../../prettify.js"></script>
|
|
@@ -248,7 +248,7 @@ import { ValidatorFunction, ValidatorFunctionAsync, ValidationErrors, Validation
|
|
|
248
248
|
import { someAsync } from '../async/arrays';
|
|
249
249
|
|
|
250
250
|
export type ValueValidator<T, TErrors = ValidationErrors> = ValidatorFunction<T, TErrors> | ValidatorFunctionAsync<T, TErrors>;
|
|
251
|
-
export type ValidationErrorsStrings<TErrors extends string | number = number> = Record<TErrors, string>;
|
|
251
|
+
export type ValidationErrorsStrings<TErrors extends string | number = number> = Partial<Omit<Record<TErrors, string>, 0 | null>>;
|
|
252
252
|
|
|
253
253
|
export type ValidationConfig<T, TErrors extends string | number = ValidationErrors> = {
|
|
254
254
|
validator: ValueValidator<Readonly<T>, TErrors>,
|
|
@@ -343,7 +343,7 @@ export abstract class ValidatableModel<T = string> {
|
|
|
343
343
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
344
344
|
Code coverage generated by
|
|
345
345
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
346
|
-
at
|
|
346
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
347
347
|
</div>
|
|
348
348
|
</div>
|
|
349
349
|
<script src="../../prettify.js"></script>
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
171
171
|
Code coverage generated by
|
|
172
172
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
173
|
-
at
|
|
173
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
174
174
|
</div>
|
|
175
175
|
</div>
|
|
176
176
|
<script src="../../prettify.js"></script>
|
|
@@ -211,7 +211,7 @@ export function mixinLabel<T, TModel extends IValueModel<T>, TLabel = s
|
|
|
211
211
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
212
212
|
Code coverage generated by
|
|
213
213
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
214
|
-
at
|
|
214
|
+
at Mon Jan 31 2022 14:10:18 GMT+0000 (Coordinated Universal Time)
|
|
215
215
|
</div>
|
|
216
216
|
</div>
|
|
217
217
|
<script src="../../prettify.js"></script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ValidatableModel } from './Validatable';
|
|
2
|
+
export declare class CommonModel<T = any> extends ValidatableModel<T> {
|
|
3
|
+
private _value;
|
|
4
|
+
private _defaultValue;
|
|
5
|
+
private _validateOnChange;
|
|
6
|
+
constructor(v?: T);
|
|
7
|
+
validateOnChange(enable?: boolean): this;
|
|
8
|
+
protected get valueToValidate(): Readonly<T>;
|
|
9
|
+
get value(): T;
|
|
10
|
+
set value(v: T);
|
|
11
|
+
readonly setValue: (value: T) => void;
|
|
12
|
+
reset: () => void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=CommonModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommonModel.d.ts","sourceRoot":"","sources":["../../src/viewModels/CommonModel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,qBAAa,WAAW,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,gBAAgB,CAAC,CAAC,CAAC;IAGzD,OAAO,CAAC,MAAM,CAAW;IAEzB,OAAO,CAAC,aAAa,CAAW;IAChC,OAAO,CAAC,iBAAiB,CAAS;gBAEtB,CAAC,GAAE,CAAQ;IAOvB,gBAAgB,CAAC,MAAM,UAAO;IAK9B,SAAS,KAAK,eAAe,IAAI,QAAQ,CAAC,CAAC,CAAC,CAE3C;IAED,IAAW,KAAK,IACI,CAAC,CADqB;IAC1C,IAAW,KAAK,CAAC,CAAC,EAAE,CAAC,EAEpB;IAED,SACgB,QAAQ,UAAW,CAAC,UAMlC;IAEF,KAAK,aAGH;CACL"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommonModel = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const mobx_1 = require("mobx");
|
|
6
|
+
const Validatable_1 = require("./Validatable");
|
|
7
|
+
class CommonModel extends Validatable_1.ValidatableModel {
|
|
8
|
+
constructor(v = null) {
|
|
9
|
+
super();
|
|
10
|
+
this._value = null;
|
|
11
|
+
this._defaultValue = null;
|
|
12
|
+
this._validateOnChange = false;
|
|
13
|
+
this.setValue = (value) => {
|
|
14
|
+
this._value = value;
|
|
15
|
+
if (this._validateOnChange) {
|
|
16
|
+
this.validate();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
this.reset = () => {
|
|
20
|
+
super.reset();
|
|
21
|
+
this.value = this._defaultValue;
|
|
22
|
+
};
|
|
23
|
+
mobx_1.makeObservable(this);
|
|
24
|
+
this._value = v;
|
|
25
|
+
this._defaultValue = v;
|
|
26
|
+
}
|
|
27
|
+
validateOnChange(enable = true) {
|
|
28
|
+
this._validateOnChange = enable;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
get valueToValidate() {
|
|
32
|
+
return this._value;
|
|
33
|
+
}
|
|
34
|
+
get value() { return this._value; }
|
|
35
|
+
set value(v) {
|
|
36
|
+
this.setValue(v);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
tslib_1.__decorate([
|
|
40
|
+
mobx_1.observable.ref,
|
|
41
|
+
tslib_1.__metadata("design:type", Object)
|
|
42
|
+
], CommonModel.prototype, "_value", void 0);
|
|
43
|
+
tslib_1.__decorate([
|
|
44
|
+
mobx_1.action,
|
|
45
|
+
tslib_1.__metadata("design:type", Object)
|
|
46
|
+
], CommonModel.prototype, "setValue", void 0);
|
|
47
|
+
exports.CommonModel = CommonModel;
|
|
48
|
+
//# sourceMappingURL=CommonModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommonModel.js","sourceRoot":"","sources":["../../src/viewModels/CommonModel.ts"],"names":[],"mappings":";;;;AAAA,+BAA0D;AAC1D,+CAAiD;AAEjD,MAAa,WAAqB,SAAQ,8BAAmB;IAQzD,YAAY,IAAO,IAAI;QACnB,KAAK,EAAE,CAAC;QANJ,WAAM,GAAM,IAAI,CAAC;QAEjB,kBAAa,GAAM,IAAI,CAAC;QACxB,sBAAiB,GAAG,KAAK,CAAC;QAwBlB,aAAQ,GAAG,CAAC,KAAQ,EAAE,EAAE;YACpC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YAEpB,IAAI,IAAI,CAAC,iBAAiB,EAAE;gBACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;aACnB;QACL,CAAC,CAAC;QAEF,UAAK,GAAG,GAAG,EAAE;YACT,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC;QACpC,CAAC,CAAC;QA/BE,qBAAc,CAAC,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,gBAAgB,CAAC,MAAM,GAAG,IAAI;QAC1B,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAc,eAAe;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,IAAW,KAAK,KAAK,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,IAAW,KAAK,CAAC,CAAI;QACjB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;CAeJ;AAvCG;IADC,iBAAU,CAAC,GAAG;;2CACU;AA2BzB;IADC,aAAM;;6CAOL;AApCN,kCA0CC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ValidatorFunction, ValidatorFunctionAsync, ValidationErrors } from '../validation';
|
|
2
2
|
export declare type ValueValidator<T, TErrors = ValidationErrors> = ValidatorFunction<T, TErrors> | ValidatorFunctionAsync<T, TErrors>;
|
|
3
|
-
export declare type ValidationErrorsStrings<TErrors extends string | number = number> = Record<TErrors, string
|
|
3
|
+
export declare type ValidationErrorsStrings<TErrors extends string | number = number> = Partial<Omit<Record<TErrors, string>, 0 | null>>;
|
|
4
4
|
export declare type ValidationConfig<T, TErrors extends string | number = ValidationErrors> = {
|
|
5
5
|
validator: ValueValidator<Readonly<T>, TErrors>;
|
|
6
6
|
errors: ValidationErrorsStrings<TErrors>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Validatable.d.ts","sourceRoot":"","sources":["../../src/viewModels/Validatable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,gBAAgB,EAAmB,MAAM,eAAe,CAAC;AAG7G,oBAAY,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,gBAAgB,IAAI,iBAAiB,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,sBAAsB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAC/H,oBAAY,uBAAuB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Validatable.d.ts","sourceRoot":"","sources":["../../src/viewModels/Validatable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,gBAAgB,EAAmB,MAAM,eAAe,CAAC;AAG7G,oBAAY,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,gBAAgB,IAAI,iBAAiB,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,sBAAsB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAC/H,oBAAY,uBAAuB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AAEjI,oBAAY,gBAAgB,CAAC,CAAC,EAAE,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,gBAAgB,IAAI;IAClF,SAAS,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAChD,MAAM,EAAE,uBAAuB,CAAC,OAAO,CAAC,CAAC;CAC5C,CAAC;AAIF,8BAAsB,gBAAgB,CAAC,CAAC,GAAG,MAAM;IAE7C,OAAO,CAAC,UAAU,CAA0C;IAC5D,OAAO,CAAC,QAAQ,CAAsC;IAGtD,OAAO,CAAC,MAAM,CAAgB;IAE9B,OAAO,CAAC,gBAAgB,CAAyB;;IAMjD,SAAS,CAAC,QAAQ,KAAK,eAAe,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEtD,IAAI,OAAO,YAA2B;IAEtC,IAAI,KAAK,WAA0B;IAE5B,mBAAmB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,gBAAgB,EAAE,MAAM,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,OAAO,CAAC;IAMvG,YAAY,CAAC,KAAK,EAAE,CAAC;IAQ5B,QAAQ;IAyBR,YAAY;IAMlB,KAAK;WAKQ,aAAa,CAAC,YAAY,EAAE,aAAa,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,EAAE,UAAU,UAAO;CAQxG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/viewModels/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAE3B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AAEnC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/viewModels/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAE3B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AAEnC,cAAc,eAAe,CAAC"}
|
package/lib/viewModels/index.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./types"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./Validatable"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./CommonModel"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./TextModel"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./FlagModel"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./NumberModel"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/viewModels/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,wDAA8B;AAC9B,sDAA4B;AAC5B,sDAA4B;AAC5B,wDAA8B;AAC9B,qDAA2B;AAE3B,wDAA8B;AAC9B,6DAAmC;AAEnC,wDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/viewModels/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,wDAA8B;AAC9B,wDAA8B;AAC9B,sDAA4B;AAC5B,sDAA4B;AAC5B,wDAA8B;AAC9B,qDAA2B;AAE3B,wDAA8B;AAC9B,6DAAmC;AAEnC,wDAA8B"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { action, makeObservable, observable } from 'mobx';
|
|
2
|
+
import { ValidatableModel } from './Validatable';
|
|
3
|
+
|
|
4
|
+
export class CommonModel<T = any> extends ValidatableModel<T> {
|
|
5
|
+
|
|
6
|
+
@observable.ref
|
|
7
|
+
private _value: T = null;
|
|
8
|
+
|
|
9
|
+
private _defaultValue: T = null;
|
|
10
|
+
private _validateOnChange = false;
|
|
11
|
+
|
|
12
|
+
constructor(v: T = null) {
|
|
13
|
+
super();
|
|
14
|
+
makeObservable(this);
|
|
15
|
+
this._value = v;
|
|
16
|
+
this._defaultValue = v;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
validateOnChange(enable = true) {
|
|
20
|
+
this._validateOnChange = enable;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
protected get valueToValidate(): Readonly<T> {
|
|
25
|
+
return this._value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public get value() { return this._value; }
|
|
29
|
+
public set value(v: T) {
|
|
30
|
+
this.setValue(v);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@action
|
|
34
|
+
public readonly setValue = (value: T) => {
|
|
35
|
+
this._value = value;
|
|
36
|
+
|
|
37
|
+
if (this._validateOnChange) {
|
|
38
|
+
this.validate();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
reset = () => {
|
|
43
|
+
super.reset();
|
|
44
|
+
this.value = this._defaultValue;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -3,7 +3,7 @@ import { ValidatorFunction, ValidatorFunctionAsync, ValidationErrors, Validation
|
|
|
3
3
|
import { someAsync } from '../async/arrays';
|
|
4
4
|
|
|
5
5
|
export type ValueValidator<T, TErrors = ValidationErrors> = ValidatorFunction<T, TErrors> | ValidatorFunctionAsync<T, TErrors>;
|
|
6
|
-
export type ValidationErrorsStrings<TErrors extends string | number = number> = Record<TErrors, string
|
|
6
|
+
export type ValidationErrorsStrings<TErrors extends string | number = number> = Partial<Omit<Record<TErrors, string>, 0 | null>>;
|
|
7
7
|
|
|
8
8
|
export type ValidationConfig<T, TErrors extends string | number = ValidationErrors> = {
|
|
9
9
|
validator: ValueValidator<Readonly<T>, TErrors>,
|