@rolster/react-forms 18.4.2 → 18.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +77 -139
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +58 -120
- package/dist/es/index.js.map +1 -1
- package/dist/esm/form-array/form-array-control.hook.d.ts +6 -6
- package/dist/esm/form-array/form-array-control.hook.js +9 -9
- package/dist/esm/form-array/form-array-group.hook.d.ts +2 -2
- package/dist/esm/form-array/form-array-group.hook.js +2 -2
- package/dist/esm/form-array/form-array.hook.js +17 -17
- package/dist/esm/form-array/form-array.hook.js.map +1 -1
- package/dist/esm/form-control.hook.d.ts +4 -4
- package/dist/esm/form-control.hook.js +26 -30
- package/dist/esm/form-control.hook.js.map +1 -1
- package/dist/esm/form-group.hook.js +3 -3
- package/dist/esm/form-group.hook.js.map +1 -1
- package/dist/esm/form-ref.hook.js +2 -2
- package/dist/esm/types.d.ts +7 -1
- package/package.json +5 -6
package/dist/es/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { controlIsValid, groupIsValid, controlsAllChecked, controlsPartialChecked, controlsToValue, arrayIsValid, groupAllChecked, groupPartialChecked } from '@rolster/forms/helpers';
|
|
1
2
|
import { v4 } from 'uuid';
|
|
2
3
|
import { useState, useRef, useEffect } from 'react';
|
|
3
4
|
|
|
4
5
|
function itIsFormControlOptions(props) {
|
|
5
|
-
return (typeof props === 'object' && ('
|
|
6
|
+
return (typeof props === 'object' && ('value' in props || 'validators' in props));
|
|
6
7
|
}
|
|
7
8
|
function itIsFormGroupOptions(props) {
|
|
8
9
|
return typeof props === 'object' && 'controls' in props;
|
|
@@ -13,13 +14,13 @@ function itIsFormArrayOptions(props) {
|
|
|
13
14
|
function createFormControlOptions(...argsProps) {
|
|
14
15
|
const [props, validators] = argsProps;
|
|
15
16
|
if (!props) {
|
|
16
|
-
return {
|
|
17
|
+
return { value: props, validators };
|
|
17
18
|
}
|
|
18
19
|
if (!validators && itIsFormControlOptions(props)) {
|
|
19
20
|
return props;
|
|
20
21
|
}
|
|
21
22
|
return {
|
|
22
|
-
|
|
23
|
+
value: props,
|
|
23
24
|
validators
|
|
24
25
|
};
|
|
25
26
|
}
|
|
@@ -47,68 +48,9 @@ function createFormArrayOptions(...argsProps) {
|
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
const FALSY_VALUE = ['false', 'undefined', '0', 0];
|
|
51
|
-
function itIsDefined(object) {
|
|
52
|
-
return typeof object !== 'undefined' && object !== null;
|
|
53
|
-
}
|
|
54
|
-
function itIsUndefined(object) {
|
|
55
|
-
return !itIsDefined(object);
|
|
56
|
-
}
|
|
57
|
-
function parseBoolean(value) {
|
|
58
|
-
return !(itIsUndefined(value) ||
|
|
59
|
-
value === false ||
|
|
60
|
-
FALSY_VALUE.includes(value));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const controlIsValid = ({ state, validators }) => {
|
|
64
|
-
return validators.reduce((errors, validator) => {
|
|
65
|
-
const error = validator(state);
|
|
66
|
-
if (error) {
|
|
67
|
-
errors.push(error);
|
|
68
|
-
}
|
|
69
|
-
return errors;
|
|
70
|
-
}, []);
|
|
71
|
-
};
|
|
72
|
-
const controlsAllChecked = (controls, key) => {
|
|
73
|
-
return Object.values(controls).reduce((value, control) => control.disabled ? value : value && parseBoolean(control[key]), true);
|
|
74
|
-
};
|
|
75
|
-
const controlsPartialChecked = (controls, key) => {
|
|
76
|
-
return Object.values(controls).reduce((value, control) => control.disabled ? value : value || parseBoolean(control[key]), false);
|
|
77
|
-
};
|
|
78
|
-
const controlsToState = (controls) => {
|
|
79
|
-
return Object.entries(controls).reduce((result, [key, { state }]) => {
|
|
80
|
-
result[key] = state;
|
|
81
|
-
return result;
|
|
82
|
-
}, {});
|
|
83
|
-
};
|
|
84
|
-
const groupIsValid = ({ controls, validators }) => {
|
|
85
|
-
return validators.reduce((errors, validator) => {
|
|
86
|
-
const error = validator(controls);
|
|
87
|
-
if (error) {
|
|
88
|
-
errors.push(error);
|
|
89
|
-
}
|
|
90
|
-
return errors;
|
|
91
|
-
}, []);
|
|
92
|
-
};
|
|
93
|
-
function groupAllChecked(groups, key) {
|
|
94
|
-
return groups.reduce((value, group) => value && parseBoolean(group[key]), true);
|
|
95
|
-
}
|
|
96
|
-
function groupPartialChecked(groups, key) {
|
|
97
|
-
return groups.reduce((value, group) => value || parseBoolean(group[key]), false);
|
|
98
|
-
}
|
|
99
|
-
const arrayIsValid = ({ groups, validators }) => {
|
|
100
|
-
return validators.reduce((errors, validator) => {
|
|
101
|
-
const error = validator(groups);
|
|
102
|
-
if (error) {
|
|
103
|
-
errors.push(error);
|
|
104
|
-
}
|
|
105
|
-
return errors;
|
|
106
|
-
}, []);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
51
|
class RolsterArrayControl {
|
|
110
52
|
constructor(options) {
|
|
111
|
-
this.
|
|
53
|
+
this.initialValue = options.initialValue;
|
|
112
54
|
this.uuid = options.uuid;
|
|
113
55
|
this.focused = !!options.focused;
|
|
114
56
|
this.unfocused = !this.focused;
|
|
@@ -118,10 +60,10 @@ class RolsterArrayControl {
|
|
|
118
60
|
this.pristine = !this.dirty;
|
|
119
61
|
this.disabled = !!options.disabled;
|
|
120
62
|
this.enabled = !this.disabled;
|
|
121
|
-
const {
|
|
122
|
-
this.
|
|
63
|
+
const { value, validators } = options;
|
|
64
|
+
this.value = value;
|
|
123
65
|
this.validators = validators;
|
|
124
|
-
this.errors = validators ? controlIsValid({
|
|
66
|
+
this.errors = validators ? controlIsValid({ value, validators }) : [];
|
|
125
67
|
this.error = this.errors[0];
|
|
126
68
|
this.valid = this.errors.length === 0;
|
|
127
69
|
this.invalid = !this.valid;
|
|
@@ -152,8 +94,8 @@ class RolsterArrayControl {
|
|
|
152
94
|
this.update({ touched: true });
|
|
153
95
|
}
|
|
154
96
|
}
|
|
155
|
-
|
|
156
|
-
this.update({
|
|
97
|
+
setValue(value) {
|
|
98
|
+
this.update({ value });
|
|
157
99
|
}
|
|
158
100
|
setValidators(validators) {
|
|
159
101
|
this.update({ validators });
|
|
@@ -162,14 +104,14 @@ class RolsterArrayControl {
|
|
|
162
104
|
this.subscriber = listener;
|
|
163
105
|
}
|
|
164
106
|
reset() {
|
|
165
|
-
this.update({
|
|
107
|
+
this.update({ value: this.initialValue, dirty: false, touched: false });
|
|
166
108
|
}
|
|
167
109
|
update(changes) {
|
|
168
110
|
if (this.subscriber) {
|
|
169
111
|
this.subscriber({
|
|
170
112
|
...this,
|
|
171
113
|
...changes,
|
|
172
|
-
|
|
114
|
+
initialValue: this.initialValue
|
|
173
115
|
});
|
|
174
116
|
}
|
|
175
117
|
}
|
|
@@ -179,7 +121,7 @@ function useArrayControl(options, validators) {
|
|
|
179
121
|
return new RolsterArrayControl({
|
|
180
122
|
...controlOptions,
|
|
181
123
|
uuid: v4(),
|
|
182
|
-
|
|
124
|
+
initialValue: controlOptions.value
|
|
183
125
|
});
|
|
184
126
|
}
|
|
185
127
|
function useReactArrayControl(options, validators) {
|
|
@@ -213,7 +155,7 @@ class RolsterArrayGroup {
|
|
|
213
155
|
this.pristine = !this.dirty;
|
|
214
156
|
this.pristineAll = !this.dirtyAll;
|
|
215
157
|
this.wrong = this.touched && this.invalid;
|
|
216
|
-
this.
|
|
158
|
+
this.value = controlsToValue(controls);
|
|
217
159
|
const subscriber = (options) => {
|
|
218
160
|
this.update({
|
|
219
161
|
controls: Object.entries(this.controls).reduce((controls, [key, control]) => {
|
|
@@ -250,27 +192,27 @@ function useFormArray(options, arrayValidators) {
|
|
|
250
192
|
const arrayOptions = createFormArrayOptions(options, arrayValidators);
|
|
251
193
|
const { validators } = arrayOptions;
|
|
252
194
|
const groups = arrayOptions.groups || [];
|
|
253
|
-
const [
|
|
195
|
+
const [state, setState] = useState({
|
|
254
196
|
controls: groups.map(({ controls }) => controls),
|
|
255
197
|
disabled: false,
|
|
256
198
|
groups,
|
|
257
|
-
|
|
199
|
+
value: groups.map(({ controls }) => controlsToValue(controls)),
|
|
258
200
|
validators
|
|
259
201
|
});
|
|
260
202
|
const currentState = useRef(groups);
|
|
261
203
|
useEffect(() => {
|
|
262
204
|
const subscriber = (options) => {
|
|
263
|
-
|
|
205
|
+
setState((state) => ({
|
|
264
206
|
...state,
|
|
265
|
-
groups:
|
|
207
|
+
groups: state.groups.map((group) => group.uuid === options.uuid
|
|
266
208
|
? new RolsterArrayGroup(options)
|
|
267
209
|
: group)
|
|
268
210
|
}));
|
|
269
211
|
};
|
|
270
|
-
|
|
212
|
+
state.groups.forEach((group) => {
|
|
271
213
|
group.subscribe(subscriber);
|
|
272
214
|
});
|
|
273
|
-
}, [
|
|
215
|
+
}, [state]);
|
|
274
216
|
const errors = validators ? arrayIsValid({ groups, validators }) : [];
|
|
275
217
|
const error = errors[0];
|
|
276
218
|
const valid = errors.length === 0 && groupAllChecked(groups, 'valid');
|
|
@@ -279,44 +221,44 @@ function useFormArray(options, arrayValidators) {
|
|
|
279
221
|
const touched = groupPartialChecked(groups, 'touched');
|
|
280
222
|
const touchedAll = groupAllChecked(groups, 'touched');
|
|
281
223
|
function disable() {
|
|
282
|
-
|
|
224
|
+
setState((state) => ({ ...state, disabled: true }));
|
|
283
225
|
}
|
|
284
226
|
function enable() {
|
|
285
|
-
|
|
227
|
+
setState((state) => ({ ...state, disabled: false }));
|
|
286
228
|
}
|
|
287
229
|
function setGroups(groups) {
|
|
288
|
-
|
|
230
|
+
setState((currentState) => ({
|
|
289
231
|
...currentState,
|
|
290
232
|
groups,
|
|
291
233
|
controls: groups.map(({ controls }) => controls),
|
|
292
|
-
|
|
234
|
+
value: groups.map(({ controls }) => controlsToValue(controls))
|
|
293
235
|
}));
|
|
294
236
|
}
|
|
295
237
|
function push(group) {
|
|
296
|
-
setGroups([...
|
|
238
|
+
setGroups([...state.groups, group]);
|
|
297
239
|
}
|
|
298
240
|
function merge(groups) {
|
|
299
|
-
setGroups([...
|
|
241
|
+
setGroups([...state.groups, ...groups]);
|
|
300
242
|
}
|
|
301
243
|
function set(groups) {
|
|
302
244
|
setGroups(groups);
|
|
303
245
|
}
|
|
304
246
|
function remove({ uuid }) {
|
|
305
|
-
setGroups(
|
|
247
|
+
setGroups(state.groups.filter((group) => group.uuid !== uuid));
|
|
306
248
|
}
|
|
307
249
|
function reset() {
|
|
308
250
|
setGroups(currentState.current);
|
|
309
251
|
}
|
|
310
252
|
function setValidators(validators) {
|
|
311
|
-
|
|
253
|
+
setState((state) => ({ ...state, validators }));
|
|
312
254
|
}
|
|
313
255
|
return {
|
|
314
|
-
...
|
|
256
|
+
...state,
|
|
315
257
|
dirty,
|
|
316
258
|
dirtyAll,
|
|
317
259
|
disable,
|
|
318
260
|
enable,
|
|
319
|
-
enabled: !
|
|
261
|
+
enabled: !state.disabled,
|
|
320
262
|
error,
|
|
321
263
|
errors,
|
|
322
264
|
invalid: !valid,
|
|
@@ -338,77 +280,73 @@ function useFormArray(options, arrayValidators) {
|
|
|
338
280
|
}
|
|
339
281
|
|
|
340
282
|
function useControl(controlOptions, controlValidators) {
|
|
341
|
-
const {
|
|
342
|
-
const [
|
|
283
|
+
const { value, touched, validators } = createFormControlOptions(controlOptions, controlValidators);
|
|
284
|
+
const [state, setState] = useState({
|
|
343
285
|
dirty: false,
|
|
344
286
|
disabled: false,
|
|
345
287
|
focused: false,
|
|
346
|
-
state: state,
|
|
347
288
|
touched: !!touched,
|
|
348
|
-
validators
|
|
289
|
+
validators,
|
|
290
|
+
value
|
|
349
291
|
});
|
|
350
|
-
const
|
|
292
|
+
const initialValue = useRef(value);
|
|
351
293
|
const elementRef = useRef(null);
|
|
352
|
-
const errors =
|
|
294
|
+
const errors = state.validators
|
|
353
295
|
? controlIsValid({
|
|
354
|
-
|
|
355
|
-
validators:
|
|
296
|
+
value: state.value,
|
|
297
|
+
validators: state.validators
|
|
356
298
|
})
|
|
357
299
|
: [];
|
|
358
300
|
const valid = errors.length === 0;
|
|
359
301
|
function focus() {
|
|
360
|
-
|
|
302
|
+
setState((state) => ({ ...state, focused: true }));
|
|
361
303
|
}
|
|
362
304
|
function blur() {
|
|
363
|
-
|
|
305
|
+
setState((state) => ({ ...state, focused: false, touched: true }));
|
|
364
306
|
}
|
|
365
307
|
function disable() {
|
|
366
|
-
|
|
308
|
+
setState((state) => ({ ...state, disabled: true }));
|
|
367
309
|
}
|
|
368
310
|
function enable() {
|
|
369
|
-
|
|
311
|
+
setState((state) => ({ ...state, disabled: false }));
|
|
370
312
|
}
|
|
371
313
|
function touch() {
|
|
372
|
-
|
|
314
|
+
setState((state) => ({ ...state, touched: true }));
|
|
373
315
|
}
|
|
374
|
-
function
|
|
375
|
-
|
|
376
|
-
...currentState,
|
|
377
|
-
dirty: true,
|
|
378
|
-
state
|
|
379
|
-
}));
|
|
316
|
+
function setValue(value) {
|
|
317
|
+
setState((state) => ({ ...state, dirty: true, value }));
|
|
380
318
|
}
|
|
381
319
|
function setValidators(validators) {
|
|
382
|
-
|
|
320
|
+
setState((state) => ({ ...state, validators }));
|
|
383
321
|
}
|
|
384
322
|
function reset() {
|
|
385
|
-
|
|
386
|
-
...
|
|
323
|
+
setState((state) => ({
|
|
324
|
+
...state,
|
|
387
325
|
dirty: false,
|
|
388
|
-
|
|
326
|
+
value: initialValue.current,
|
|
389
327
|
touched: false
|
|
390
328
|
}));
|
|
391
329
|
}
|
|
392
330
|
return {
|
|
393
|
-
...
|
|
331
|
+
...state,
|
|
394
332
|
blur,
|
|
395
333
|
disable,
|
|
396
334
|
elementRef,
|
|
397
335
|
enable,
|
|
398
|
-
enabled: !
|
|
336
|
+
enabled: !state.disabled,
|
|
399
337
|
error: errors[0],
|
|
400
338
|
errors,
|
|
401
339
|
focus,
|
|
402
340
|
invalid: !valid,
|
|
403
|
-
pristine: !
|
|
341
|
+
pristine: !state.dirty,
|
|
404
342
|
reset,
|
|
405
|
-
setState,
|
|
406
343
|
setValidators,
|
|
344
|
+
setValue,
|
|
407
345
|
touch,
|
|
408
|
-
unfocused: !
|
|
409
|
-
untouched: !
|
|
346
|
+
unfocused: !state.focused,
|
|
347
|
+
untouched: !state.touched,
|
|
410
348
|
valid,
|
|
411
|
-
wrong:
|
|
349
|
+
wrong: state.touched && !valid
|
|
412
350
|
};
|
|
413
351
|
}
|
|
414
352
|
function useReactControl(options, validators) {
|
|
@@ -427,7 +365,7 @@ function useFormGroup(options, groupValidators) {
|
|
|
427
365
|
const { controls } = groupOptions;
|
|
428
366
|
const errors = validators ? groupIsValid({ controls, validators }) : [];
|
|
429
367
|
const valid = errors.length === 0 && controlsAllChecked(controls, 'valid');
|
|
430
|
-
const
|
|
368
|
+
const value = controlsToValue(controls);
|
|
431
369
|
const dirty = controlsPartialChecked(controls, 'dirty');
|
|
432
370
|
const dirtyAll = controlsAllChecked(controls, 'dirty');
|
|
433
371
|
const touched = controlsPartialChecked(controls, 'touched');
|
|
@@ -448,12 +386,12 @@ function useFormGroup(options, groupValidators) {
|
|
|
448
386
|
pristineAll: !dirtyAll,
|
|
449
387
|
reset,
|
|
450
388
|
setValidators,
|
|
451
|
-
state,
|
|
452
389
|
touched,
|
|
453
390
|
touchedAll,
|
|
454
391
|
untouched: !touched,
|
|
455
392
|
untouchedAll: !touchedAll,
|
|
456
393
|
valid,
|
|
394
|
+
value,
|
|
457
395
|
wrong: touched && !valid
|
|
458
396
|
};
|
|
459
397
|
}
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../node_modules/@rolster/forms/dist/esm/arguments.js","../../node_modules/@rolster/commons/dist/esm/helpers.js","../../node_modules/@rolster/forms/dist/esm/helpers.js","../esm/form-array/form-array-control.hook.js","../esm/form-array/form-array-group.hook.js","../esm/form-array/form-array.hook.js","../esm/form-control.hook.js","../esm/form-group.hook.js"],"sourcesContent":["function itIsFormControlOptions(props) {\r\n return (typeof props === 'object' && ('state' in props || 'validators' in props));\r\n}\r\nfunction itIsFormGroupOptions(props) {\r\n return typeof props === 'object' && 'controls' in props;\r\n}\r\nfunction itIsFormArrayOptions(props) {\r\n return (typeof props === 'object' && ('groups' in props || 'validators' in props));\r\n}\r\nexport function createFormControlOptions(...argsProps) {\r\n const [props, validators] = argsProps;\r\n if (!props) {\r\n return { state: props, validators };\r\n }\r\n if (!validators && itIsFormControlOptions(props)) {\r\n return props;\r\n }\r\n return {\r\n state: props,\r\n validators\r\n };\r\n}\r\nexport function createFormGroupOptions(...argsProps) {\r\n const [props, validators] = argsProps;\r\n if (!validators && itIsFormGroupOptions(props)) {\r\n return props;\r\n }\r\n return {\r\n controls: props,\r\n validators\r\n };\r\n}\r\nexport function createFormArrayOptions(...argsProps) {\r\n const [props, validators] = argsProps;\r\n if (!props) {\r\n return { groups: props, validators };\r\n }\r\n if (!validators && itIsFormArrayOptions(props)) {\r\n return props;\r\n }\r\n return {\r\n groups: props,\r\n validators\r\n };\r\n}\r\n//# sourceMappingURL=arguments.js.map","const PRIMITIVES = [Date, RegExp, Function, String, Boolean, Number];\r\nconst SLICE_SIZE = 512;\r\nconst FALSY_VALUE = ['false', 'undefined', '0', 0];\r\nconst prototypeToString = Object.prototype.toString;\r\nfunction clone(object, caches) {\r\n if (typeof object !== 'object') {\r\n return object;\r\n }\r\n if (prototypeToString.call(object) === '[object Object]') {\r\n const [cacheObject] = caches.filter((cacheObject) => cacheObject === object);\r\n /* istanbul ignore if */\r\n if (cacheObject) {\r\n return cacheObject;\r\n }\r\n caches.push(object);\r\n }\r\n const prototypeObject = Object.getPrototypeOf(object);\r\n const ConstructorObject = prototypeObject.constructor;\r\n if (PRIMITIVES.includes(ConstructorObject)) {\r\n return new ConstructorObject(object);\r\n }\r\n const cloneObject = new ConstructorObject();\r\n for (const prop in object) {\r\n cloneObject[prop] = clone(object[prop], caches);\r\n }\r\n return cloneObject;\r\n}\r\nexport function itIsDefined(object) {\r\n return typeof object !== 'undefined' && object !== null;\r\n}\r\nexport function itIsUndefined(object) {\r\n return !itIsDefined(object);\r\n}\r\nexport function parseBoolean(value) {\r\n return !(itIsUndefined(value) ||\r\n value === false ||\r\n FALSY_VALUE.includes(value));\r\n}\r\nexport function parse(value) {\r\n try {\r\n return JSON.parse(value);\r\n }\r\n catch {\r\n return value;\r\n }\r\n}\r\nexport function evalValueOrFunction(value) {\r\n return typeof value === 'function' ? value() : value;\r\n}\r\nexport function deepClone(object) {\r\n return clone(object, []);\r\n}\r\nexport function deepFreeze(object) {\r\n for (const prop in object) {\r\n const value = object[prop];\r\n if (typeof value === 'object' && !Object.isFrozen(value)) {\r\n deepFreeze(value);\r\n }\r\n }\r\n return Object.freeze(object);\r\n}\r\nexport function callback(call, ...args) {\r\n return typeof call !== 'function' ? undefined : call.apply(call, args);\r\n}\r\n/* istanbul ignore next */\r\nexport function base64ToBlob(data64, mimeType) {\r\n const result64 = data64.replace(/^[^,]+,/, '').replace(/\\s/g, '');\r\n const byteCharacters = window.atob(result64);\r\n const byteArrays = [];\r\n for (let offset = 0; offset < byteCharacters.length; offset += SLICE_SIZE) {\r\n const slice = byteCharacters.slice(offset, offset + SLICE_SIZE);\r\n const byteNumbers = new Array(slice.length);\r\n for (let i = 0; i < slice.length; i++) {\r\n byteNumbers[i] = slice.charCodeAt(i);\r\n }\r\n const byteArray = new Uint8Array(byteNumbers);\r\n byteArrays.push(byteArray);\r\n }\r\n return new Blob(byteArrays, { type: mimeType });\r\n}\r\n//# sourceMappingURL=helpers.js.map","import { parseBoolean } from '@rolster/commons';\r\nexport const controlIsValid = ({ state, validators }) => {\r\n return validators.reduce((errors, validator) => {\r\n const error = validator(state);\r\n if (error) {\r\n errors.push(error);\r\n }\r\n return errors;\r\n }, []);\r\n};\r\nexport const controlsAllChecked = (controls, key) => {\r\n return Object.values(controls).reduce((value, control) => control.disabled ? value : value && parseBoolean(control[key]), true);\r\n};\r\nexport const controlsPartialChecked = (controls, key) => {\r\n return Object.values(controls).reduce((value, control) => control.disabled ? value : value || parseBoolean(control[key]), false);\r\n};\r\nexport const controlsToState = (controls) => {\r\n return Object.entries(controls).reduce((result, [key, { state }]) => {\r\n result[key] = state;\r\n return result;\r\n }, {});\r\n};\r\nexport const groupIsValid = ({ controls, validators }) => {\r\n return validators.reduce((errors, validator) => {\r\n const error = validator(controls);\r\n if (error) {\r\n errors.push(error);\r\n }\r\n return errors;\r\n }, []);\r\n};\r\nexport function groupAllChecked(groups, key) {\r\n return groups.reduce((value, group) => value && parseBoolean(group[key]), true);\r\n}\r\nexport function groupPartialChecked(groups, key) {\r\n return groups.reduce((value, group) => value || parseBoolean(group[key]), false);\r\n}\r\nexport const arrayIsValid = ({ groups, validators }) => {\r\n return validators.reduce((errors, validator) => {\r\n const error = validator(groups);\r\n if (error) {\r\n errors.push(error);\r\n }\r\n return errors;\r\n }, []);\r\n};\r\n//# sourceMappingURL=helpers.js.map","import { createFormControlOptions } from '@rolster/forms/arguments';\r\nimport { controlIsValid } from '@rolster/forms/helpers';\r\nimport { v4 as uuid } from 'uuid';\r\nexport class RolsterArrayControl {\r\n constructor(options) {\r\n this.initialState = options.initialState;\r\n this.uuid = options.uuid;\r\n this.focused = !!options.focused;\r\n this.unfocused = !this.focused;\r\n this.touched = !!options.touched;\r\n this.untouched = !this.touched;\r\n this.dirty = !!options.dirty;\r\n this.pristine = !this.dirty;\r\n this.disabled = !!options.disabled;\r\n this.enabled = !this.disabled;\r\n const { state, validators } = options;\r\n this.state = state;\r\n this.validators = validators;\r\n this.errors = validators ? controlIsValid({ state, validators }) : [];\r\n this.error = this.errors[0];\r\n this.valid = this.errors.length === 0;\r\n this.invalid = !this.valid;\r\n this.wrong = this.touched && this.invalid;\r\n }\r\n focus() {\r\n if (!this.focused) {\r\n this.update({ focused: true });\r\n }\r\n }\r\n blur() {\r\n if (this.focused) {\r\n this.update({ focused: false, touched: true });\r\n }\r\n }\r\n disable() {\r\n if (!this.disabled) {\r\n this.update({ disabled: true });\r\n }\r\n }\r\n enable() {\r\n if (this.disabled) {\r\n this.update({ disabled: false });\r\n }\r\n }\r\n touch() {\r\n if (this.touched) {\r\n this.update({ touched: true });\r\n }\r\n }\r\n setState(state) {\r\n this.update({ state });\r\n }\r\n setValidators(validators) {\r\n this.update({ validators });\r\n }\r\n subscribe(listener) {\r\n this.subscriber = listener;\r\n }\r\n reset() {\r\n this.update({ state: this.initialState, dirty: false, touched: false });\r\n }\r\n update(changes) {\r\n if (this.subscriber) {\r\n this.subscriber({\r\n ...this,\r\n ...changes,\r\n initialState: this.initialState\r\n });\r\n }\r\n }\r\n}\r\nfunction useArrayControl(options, validators) {\r\n const controlOptions = createFormControlOptions(options, validators);\r\n return new RolsterArrayControl({\r\n ...controlOptions,\r\n uuid: uuid(),\r\n initialState: controlOptions.state\r\n });\r\n}\r\nexport function useReactArrayControl(options, validators) {\r\n return useArrayControl(options, validators);\r\n}\r\nexport function useFormArrayControl(options, validators) {\r\n return useArrayControl(options, validators);\r\n}\r\nexport function useInputArrayControl(options, validators) {\r\n return useArrayControl(options, validators);\r\n}\r\n//# sourceMappingURL=form-array-control.hook.js.map","import { createFormGroupOptions } from '@rolster/forms/arguments';\r\nimport { controlsAllChecked, controlsPartialChecked, controlsToState, groupIsValid } from '@rolster/forms/helpers';\r\nimport { v4 as uuid } from 'uuid';\r\nimport { RolsterArrayControl } from './form-array-control.hook';\r\nexport class RolsterArrayGroup {\r\n constructor(options) {\r\n const { controls, resource, uuid, validators } = options;\r\n this.uuid = uuid;\r\n this.controls = controls;\r\n this.validators = validators;\r\n this.resource = resource;\r\n this.errors = validators ? groupIsValid({ controls, validators }) : [];\r\n this.error = this.errors[0];\r\n this.valid =\r\n this.errors.length === 0 && controlsAllChecked(controls, 'valid');\r\n this.invalid = !this.valid;\r\n this.dirty = controlsPartialChecked(controls, 'dirty');\r\n this.dirtyAll = controlsAllChecked(controls, 'dirty');\r\n this.touched = controlsPartialChecked(controls, 'touched');\r\n this.touchedAll = controlsAllChecked(controls, 'touched');\r\n this.untouched = !this.touched;\r\n this.untouchedAll = !this.touchedAll;\r\n this.pristine = !this.dirty;\r\n this.pristineAll = !this.dirtyAll;\r\n this.wrong = this.touched && this.invalid;\r\n this.state = controlsToState(controls);\r\n const subscriber = (options) => {\r\n this.update({\r\n controls: Object.entries(this.controls).reduce((controls, [key, control]) => {\r\n controls[key] =\r\n control.uuid === options.uuid\r\n ? new RolsterArrayControl(options)\r\n : control;\r\n return controls;\r\n }, {})\r\n });\r\n };\r\n Object.values(controls).forEach((control) => {\r\n control.subscribe(subscriber);\r\n });\r\n }\r\n setValidators(validators) {\r\n this.update({ validators });\r\n }\r\n subscribe(listener) {\r\n this.subscriber = listener;\r\n }\r\n update(changes) {\r\n if (this.subscriber) {\r\n this.subscriber({ ...this, ...changes });\r\n }\r\n }\r\n}\r\nexport function useFormArrayGroup(options, validators) {\r\n const groupOptions = createFormGroupOptions(options, validators);\r\n return new RolsterArrayGroup({ ...groupOptions, uuid: uuid() });\r\n}\r\n//# sourceMappingURL=form-array-group.hook.js.map","import { createFormArrayOptions } from '@rolster/forms/arguments';\r\nimport { arrayIsValid, controlsToState, groupAllChecked, groupPartialChecked } from '@rolster/forms/helpers';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport { RolsterArrayGroup } from './form-array-group.hook';\r\nexport function useFormArray(options, arrayValidators) {\r\n const arrayOptions = createFormArrayOptions(options, arrayValidators);\r\n const { validators } = arrayOptions;\r\n const groups = arrayOptions.groups || [];\r\n const [arrayState, setArrayState] = useState({\r\n controls: groups.map(({ controls }) => controls),\r\n disabled: false,\r\n groups,\r\n state: groups.map(({ controls }) => controlsToState(controls)),\r\n validators\r\n });\r\n const currentState = useRef(groups);\r\n useEffect(() => {\r\n const subscriber = (options) => {\r\n setArrayState((state) => ({\r\n ...state,\r\n groups: arrayState.groups.map((group) => group.uuid === options.uuid\r\n ? new RolsterArrayGroup(options)\r\n : group)\r\n }));\r\n };\r\n arrayState.groups.forEach((group) => {\r\n group.subscribe(subscriber);\r\n });\r\n }, [arrayState]);\r\n const errors = validators ? arrayIsValid({ groups, validators }) : [];\r\n const error = errors[0];\r\n const valid = errors.length === 0 && groupAllChecked(groups, 'valid');\r\n const dirty = groupPartialChecked(groups, 'dirty');\r\n const dirtyAll = groupAllChecked(groups, 'dirty');\r\n const touched = groupPartialChecked(groups, 'touched');\r\n const touchedAll = groupAllChecked(groups, 'touched');\r\n function disable() {\r\n setArrayState((state) => ({ ...state, disabled: true }));\r\n }\r\n function enable() {\r\n setArrayState((state) => ({ ...state, disabled: false }));\r\n }\r\n function setGroups(groups) {\r\n setArrayState((currentState) => ({\r\n ...currentState,\r\n groups,\r\n controls: groups.map(({ controls }) => controls),\r\n state: groups.map(({ controls }) => controlsToState(controls))\r\n }));\r\n }\r\n function push(group) {\r\n setGroups([...arrayState.groups, group]);\r\n }\r\n function merge(groups) {\r\n setGroups([...arrayState.groups, ...groups]);\r\n }\r\n function set(groups) {\r\n setGroups(groups);\r\n }\r\n function remove({ uuid }) {\r\n setGroups(arrayState.groups.filter((group) => group.uuid !== uuid));\r\n }\r\n function reset() {\r\n setGroups(currentState.current);\r\n }\r\n function setValidators(validators) {\r\n setArrayState((state) => ({ ...state, validators }));\r\n }\r\n return {\r\n ...arrayState,\r\n dirty,\r\n dirtyAll,\r\n disable,\r\n enable,\r\n enabled: !arrayState.disabled,\r\n error,\r\n errors,\r\n invalid: !valid,\r\n merge,\r\n pristine: !dirty,\r\n pristineAll: !dirtyAll,\r\n push,\r\n remove,\r\n reset,\r\n set,\r\n setValidators,\r\n touched,\r\n touchedAll,\r\n untouched: !touched,\r\n untouchedAll: !touchedAll,\r\n valid,\r\n wrong: touched && !valid\r\n };\r\n}\r\n//# sourceMappingURL=form-array.hook.js.map","import { createFormControlOptions } from '@rolster/forms/arguments';\r\nimport { controlIsValid } from '@rolster/forms/helpers';\r\nimport { useRef, useState } from 'react';\r\nfunction useControl(controlOptions, controlValidators) {\r\n const { state, touched, validators } = createFormControlOptions(controlOptions, controlValidators);\r\n const [controlState, setControlState] = useState({\r\n dirty: false,\r\n disabled: false,\r\n focused: false,\r\n state: state,\r\n touched: !!touched,\r\n validators: validators\r\n });\r\n const initialState = useRef(state);\r\n const elementRef = useRef(null);\r\n const errors = controlState.validators\r\n ? controlIsValid({\r\n state: controlState.state,\r\n validators: controlState.validators\r\n })\r\n : [];\r\n const valid = errors.length === 0;\r\n function focus() {\r\n setControlState((state) => ({ ...state, focused: true }));\r\n }\r\n function blur() {\r\n setControlState((state) => ({ ...state, focused: false, touched: true }));\r\n }\r\n function disable() {\r\n setControlState((state) => ({ ...state, disabled: true }));\r\n }\r\n function enable() {\r\n setControlState((state) => ({ ...state, disabled: false }));\r\n }\r\n function touch() {\r\n setControlState((state) => ({ ...state, touched: true }));\r\n }\r\n function setState(state) {\r\n setControlState((currentState) => ({\r\n ...currentState,\r\n dirty: true,\r\n state\r\n }));\r\n }\r\n function setValidators(validators) {\r\n setControlState((state) => ({ ...state, validators }));\r\n }\r\n function reset() {\r\n setControlState((currentState) => ({\r\n ...currentState,\r\n dirty: false,\r\n state: initialState.current,\r\n touched: false\r\n }));\r\n }\r\n return {\r\n ...controlState,\r\n blur,\r\n disable,\r\n elementRef,\r\n enable,\r\n enabled: !controlState.disabled,\r\n error: errors[0],\r\n errors,\r\n focus,\r\n invalid: !valid,\r\n pristine: !controlState.dirty,\r\n reset,\r\n setState,\r\n setValidators,\r\n touch,\r\n unfocused: !controlState.focused,\r\n untouched: !controlState.touched,\r\n valid,\r\n wrong: controlState.touched && !valid\r\n };\r\n}\r\nexport function useReactControl(options, validators) {\r\n return useControl(options, validators);\r\n}\r\nexport function useFormControl(options, validators) {\r\n return useControl(options, validators);\r\n}\r\nexport function useInputControl(options, validators) {\r\n return useControl(options, validators);\r\n}\r\n//# sourceMappingURL=form-control.hook.js.map","import { createFormGroupOptions } from '@rolster/forms/arguments';\r\nimport { controlsAllChecked, controlsPartialChecked, controlsToState, groupIsValid } from '@rolster/forms/helpers';\r\nimport { useState } from 'react';\r\nexport function useFormGroup(options, groupValidators) {\r\n const groupOptions = createFormGroupOptions(options, groupValidators);\r\n const [validators, setValidators] = useState(groupOptions.validators);\r\n const { controls } = groupOptions;\r\n const errors = validators ? groupIsValid({ controls, validators }) : [];\r\n const valid = errors.length === 0 && controlsAllChecked(controls, 'valid');\r\n const state = controlsToState(controls);\r\n const dirty = controlsPartialChecked(controls, 'dirty');\r\n const dirtyAll = controlsAllChecked(controls, 'dirty');\r\n const touched = controlsPartialChecked(controls, 'touched');\r\n const touchedAll = controlsAllChecked(controls, 'touched');\r\n function reset() {\r\n Object.values(controls).forEach((control) => {\r\n control.reset();\r\n });\r\n }\r\n return {\r\n controls,\r\n dirty,\r\n dirtyAll,\r\n error: errors[0],\r\n errors,\r\n invalid: !valid,\r\n pristine: !dirty,\r\n pristineAll: !dirtyAll,\r\n reset,\r\n setValidators,\r\n state,\r\n touched,\r\n touchedAll,\r\n untouched: !touched,\r\n untouchedAll: !touchedAll,\r\n valid,\r\n wrong: touched && !valid\r\n };\r\n}\r\n//# sourceMappingURL=form-group.hook.js.map"],"names":["uuid"],"mappings":";;;AAAA,SAAS,sBAAsB,CAAC,KAAK,EAAE;AACvC,IAAI,QAAQ,OAAO,KAAK,KAAK,QAAQ,KAAK,OAAO,IAAI,KAAK,IAAI,YAAY,IAAI,KAAK,CAAC,EAAE;AACtF,CAAC;AACD,SAAS,oBAAoB,CAAC,KAAK,EAAE;AACrC,IAAI,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,UAAU,IAAI,KAAK,CAAC;AAC5D,CAAC;AACD,SAAS,oBAAoB,CAAC,KAAK,EAAE;AACrC,IAAI,QAAQ,OAAO,KAAK,KAAK,QAAQ,KAAK,QAAQ,IAAI,KAAK,IAAI,YAAY,IAAI,KAAK,CAAC,EAAE;AACvF,CAAC;AACM,SAAS,wBAAwB,CAAC,GAAG,SAAS,EAAE;AACvD,IAAI,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,SAAS,CAAC;AAC1C,IAAI,IAAI,CAAC,KAAK,EAAE;AAChB,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK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QAAQ,EAAE,SAAS,CAAC,CAAC;AAChE,IAAI,MAAM,UAAU,GAAG,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC/D,IAAI,SAAS,KAAK,GAAG;AACrB,QAAQ,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,KAAK;AACrD,YAAY,OAAO,CAAC,KAAK,EAAE,CAAC;AAC5B,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,OAAO;AACX,QAAQ,QAAQ;AAChB,QAAQ,KAAK;AACb,QAAQ,QAAQ;AAChB,QAAQ,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AACxB,QAAQ,MAAM;AACd,QAAQ,OAAO,EAAE,CAAC,KAAK;AACvB,QAAQ,QAAQ,EAAE,CAAC,KAAK;AACxB,QAAQ,WAAW,EAAE,CAAC,QAAQ;AAC9B,QAAQ,KAAK;AACb,QAAQ,aAAa;AACrB,QAAQ,KAAK;AACb,QAAQ,OAAO;AACf,QAAQ,UAAU;AAClB,QAAQ,SAAS,EAAE,CAAC,OAAO;AAC3B,QAAQ,YAAY,EAAE,CAAC,UAAU;AACjC,QAAQ,KAAK;AACb,QAAQ,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK;AAChC,KAAK,CAAC;AACN;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../node_modules/@rolster/forms/dist/esm/arguments.js","../esm/form-array/form-array-control.hook.js","../esm/form-array/form-array-group.hook.js","../esm/form-array/form-array.hook.js","../esm/form-control.hook.js","../esm/form-group.hook.js"],"sourcesContent":["function itIsFormControlOptions(props) {\r\n return (typeof props === 'object' && ('value' in props || 'validators' in props));\r\n}\r\nfunction itIsFormGroupOptions(props) {\r\n return typeof props === 'object' && 'controls' in props;\r\n}\r\nfunction itIsFormArrayOptions(props) {\r\n return (typeof props === 'object' && ('groups' in props || 'validators' in props));\r\n}\r\nexport function createFormControlOptions(...argsProps) {\r\n const [props, validators] = argsProps;\r\n if (!props) {\r\n return { value: props, validators };\r\n }\r\n if (!validators && itIsFormControlOptions(props)) {\r\n return props;\r\n }\r\n return {\r\n value: props,\r\n validators\r\n };\r\n}\r\nexport function createFormGroupOptions(...argsProps) {\r\n const [props, validators] = argsProps;\r\n if (!validators && itIsFormGroupOptions(props)) {\r\n return props;\r\n }\r\n return {\r\n controls: props,\r\n validators\r\n };\r\n}\r\nexport function createFormArrayOptions(...argsProps) {\r\n const [props, validators] = argsProps;\r\n if (!props) {\r\n return { groups: props, validators };\r\n }\r\n if (!validators && itIsFormArrayOptions(props)) {\r\n return props;\r\n }\r\n return {\r\n groups: props,\r\n validators\r\n };\r\n}\r\n//# sourceMappingURL=arguments.js.map","import { createFormControlOptions } from '@rolster/forms/arguments';\r\nimport { controlIsValid } from '@rolster/forms/helpers';\r\nimport { v4 as uuid } from 'uuid';\r\nexport class RolsterArrayControl {\r\n constructor(options) {\r\n this.initialValue = options.initialValue;\r\n this.uuid = options.uuid;\r\n this.focused = !!options.focused;\r\n this.unfocused = !this.focused;\r\n this.touched = !!options.touched;\r\n this.untouched = !this.touched;\r\n this.dirty = !!options.dirty;\r\n this.pristine = !this.dirty;\r\n this.disabled = !!options.disabled;\r\n this.enabled = !this.disabled;\r\n const { value, validators } = options;\r\n this.value = value;\r\n this.validators = validators;\r\n this.errors = validators ? controlIsValid({ value, validators }) : [];\r\n this.error = this.errors[0];\r\n this.valid = this.errors.length === 0;\r\n this.invalid = !this.valid;\r\n this.wrong = this.touched && this.invalid;\r\n }\r\n focus() {\r\n if (!this.focused) {\r\n this.update({ focused: true });\r\n }\r\n }\r\n blur() {\r\n if (this.focused) {\r\n this.update({ focused: false, touched: true });\r\n }\r\n }\r\n disable() {\r\n if (!this.disabled) {\r\n this.update({ disabled: true });\r\n }\r\n }\r\n enable() {\r\n if (this.disabled) {\r\n this.update({ disabled: false });\r\n }\r\n }\r\n touch() {\r\n if (this.touched) {\r\n this.update({ touched: true });\r\n }\r\n }\r\n setValue(value) {\r\n this.update({ value });\r\n }\r\n setValidators(validators) {\r\n this.update({ validators });\r\n }\r\n subscribe(listener) {\r\n this.subscriber = listener;\r\n }\r\n reset() {\r\n this.update({ value: this.initialValue, dirty: false, touched: false });\r\n }\r\n update(changes) {\r\n if (this.subscriber) {\r\n this.subscriber({\r\n ...this,\r\n ...changes,\r\n initialValue: this.initialValue\r\n });\r\n }\r\n }\r\n}\r\nfunction useArrayControl(options, validators) {\r\n const controlOptions = createFormControlOptions(options, validators);\r\n return new RolsterArrayControl({\r\n ...controlOptions,\r\n uuid: uuid(),\r\n initialValue: controlOptions.value\r\n });\r\n}\r\nexport function useReactArrayControl(options, validators) {\r\n return useArrayControl(options, validators);\r\n}\r\nexport function useFormArrayControl(options, validators) {\r\n return useArrayControl(options, validators);\r\n}\r\nexport function useInputArrayControl(options, validators) {\r\n return useArrayControl(options, validators);\r\n}\r\n//# sourceMappingURL=form-array-control.hook.js.map","import { createFormGroupOptions } from '@rolster/forms/arguments';\r\nimport { controlsAllChecked, controlsPartialChecked, controlsToValue, groupIsValid } from '@rolster/forms/helpers';\r\nimport { v4 as uuid } from 'uuid';\r\nimport { RolsterArrayControl } from './form-array-control.hook';\r\nexport class RolsterArrayGroup {\r\n constructor(options) {\r\n const { controls, resource, uuid, validators } = options;\r\n this.uuid = uuid;\r\n this.controls = controls;\r\n this.validators = validators;\r\n this.resource = resource;\r\n this.errors = validators ? groupIsValid({ controls, validators }) : [];\r\n this.error = this.errors[0];\r\n this.valid =\r\n this.errors.length === 0 && controlsAllChecked(controls, 'valid');\r\n this.invalid = !this.valid;\r\n this.dirty = controlsPartialChecked(controls, 'dirty');\r\n this.dirtyAll = controlsAllChecked(controls, 'dirty');\r\n this.touched = controlsPartialChecked(controls, 'touched');\r\n this.touchedAll = controlsAllChecked(controls, 'touched');\r\n this.untouched = !this.touched;\r\n this.untouchedAll = !this.touchedAll;\r\n this.pristine = !this.dirty;\r\n this.pristineAll = !this.dirtyAll;\r\n this.wrong = this.touched && this.invalid;\r\n this.value = controlsToValue(controls);\r\n const subscriber = (options) => {\r\n this.update({\r\n controls: Object.entries(this.controls).reduce((controls, [key, control]) => {\r\n controls[key] =\r\n control.uuid === options.uuid\r\n ? new RolsterArrayControl(options)\r\n : control;\r\n return controls;\r\n }, {})\r\n });\r\n };\r\n Object.values(controls).forEach((control) => {\r\n control.subscribe(subscriber);\r\n });\r\n }\r\n setValidators(validators) {\r\n this.update({ validators });\r\n }\r\n subscribe(listener) {\r\n this.subscriber = listener;\r\n }\r\n update(changes) {\r\n if (this.subscriber) {\r\n this.subscriber({ ...this, ...changes });\r\n }\r\n }\r\n}\r\nexport function useFormArrayGroup(options, validators) {\r\n const groupOptions = createFormGroupOptions(options, validators);\r\n return new RolsterArrayGroup({ ...groupOptions, uuid: uuid() });\r\n}\r\n//# sourceMappingURL=form-array-group.hook.js.map","import { createFormArrayOptions } from '@rolster/forms/arguments';\r\nimport { arrayIsValid, controlsToValue, groupAllChecked, groupPartialChecked } from '@rolster/forms/helpers';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport { RolsterArrayGroup } from './form-array-group.hook';\r\nexport function useFormArray(options, arrayValidators) {\r\n const arrayOptions = createFormArrayOptions(options, arrayValidators);\r\n const { validators } = arrayOptions;\r\n const groups = arrayOptions.groups || [];\r\n const [state, setState] = useState({\r\n controls: groups.map(({ controls }) => controls),\r\n disabled: false,\r\n groups,\r\n value: groups.map(({ controls }) => controlsToValue(controls)),\r\n validators\r\n });\r\n const currentState = useRef(groups);\r\n useEffect(() => {\r\n const subscriber = (options) => {\r\n setState((state) => ({\r\n ...state,\r\n groups: state.groups.map((group) => group.uuid === options.uuid\r\n ? new RolsterArrayGroup(options)\r\n : group)\r\n }));\r\n };\r\n state.groups.forEach((group) => {\r\n group.subscribe(subscriber);\r\n });\r\n }, [state]);\r\n const errors = validators ? arrayIsValid({ groups, validators }) : [];\r\n const error = errors[0];\r\n const valid = errors.length === 0 && groupAllChecked(groups, 'valid');\r\n const dirty = groupPartialChecked(groups, 'dirty');\r\n const dirtyAll = groupAllChecked(groups, 'dirty');\r\n const touched = groupPartialChecked(groups, 'touched');\r\n const touchedAll = groupAllChecked(groups, 'touched');\r\n function disable() {\r\n setState((state) => ({ ...state, disabled: true }));\r\n }\r\n function enable() {\r\n setState((state) => ({ ...state, disabled: false }));\r\n }\r\n function setGroups(groups) {\r\n setState((currentState) => ({\r\n ...currentState,\r\n groups,\r\n controls: groups.map(({ controls }) => controls),\r\n value: groups.map(({ controls }) => controlsToValue(controls))\r\n }));\r\n }\r\n function push(group) {\r\n setGroups([...state.groups, group]);\r\n }\r\n function merge(groups) {\r\n setGroups([...state.groups, ...groups]);\r\n }\r\n function set(groups) {\r\n setGroups(groups);\r\n }\r\n function remove({ uuid }) {\r\n setGroups(state.groups.filter((group) => group.uuid !== uuid));\r\n }\r\n function reset() {\r\n setGroups(currentState.current);\r\n }\r\n function setValidators(validators) {\r\n setState((state) => ({ ...state, validators }));\r\n }\r\n return {\r\n ...state,\r\n dirty,\r\n dirtyAll,\r\n disable,\r\n enable,\r\n enabled: !state.disabled,\r\n error,\r\n errors,\r\n invalid: !valid,\r\n merge,\r\n pristine: !dirty,\r\n pristineAll: !dirtyAll,\r\n push,\r\n remove,\r\n reset,\r\n set,\r\n setValidators,\r\n touched,\r\n touchedAll,\r\n untouched: !touched,\r\n untouchedAll: !touchedAll,\r\n valid,\r\n wrong: touched && !valid\r\n };\r\n}\r\n//# sourceMappingURL=form-array.hook.js.map","import { createFormControlOptions } from '@rolster/forms/arguments';\r\nimport { controlIsValid } from '@rolster/forms/helpers';\r\nimport { useRef, useState } from 'react';\r\nfunction useControl(controlOptions, controlValidators) {\r\n const { value, touched, validators } = createFormControlOptions(controlOptions, controlValidators);\r\n const [state, setState] = useState({\r\n dirty: false,\r\n disabled: false,\r\n focused: false,\r\n touched: !!touched,\r\n validators,\r\n value\r\n });\r\n const initialValue = useRef(value);\r\n const elementRef = useRef(null);\r\n const errors = state.validators\r\n ? controlIsValid({\r\n value: state.value,\r\n validators: state.validators\r\n })\r\n : [];\r\n const valid = errors.length === 0;\r\n function focus() {\r\n setState((state) => ({ ...state, focused: true }));\r\n }\r\n function blur() {\r\n setState((state) => ({ ...state, focused: false, touched: true }));\r\n }\r\n function disable() {\r\n setState((state) => ({ ...state, disabled: true }));\r\n }\r\n function enable() {\r\n setState((state) => ({ ...state, disabled: false }));\r\n }\r\n function touch() {\r\n setState((state) => ({ ...state, touched: true }));\r\n }\r\n function setValue(value) {\r\n setState((state) => ({ ...state, dirty: true, value }));\r\n }\r\n function setValidators(validators) {\r\n setState((state) => ({ ...state, validators }));\r\n }\r\n function reset() {\r\n setState((state) => ({\r\n ...state,\r\n dirty: false,\r\n value: initialValue.current,\r\n touched: false\r\n }));\r\n }\r\n return {\r\n ...state,\r\n blur,\r\n disable,\r\n elementRef,\r\n enable,\r\n enabled: !state.disabled,\r\n error: errors[0],\r\n errors,\r\n focus,\r\n invalid: !valid,\r\n pristine: !state.dirty,\r\n reset,\r\n setValidators,\r\n setValue,\r\n touch,\r\n unfocused: !state.focused,\r\n untouched: !state.touched,\r\n valid,\r\n wrong: state.touched && !valid\r\n };\r\n}\r\nexport function useReactControl(options, validators) {\r\n return useControl(options, validators);\r\n}\r\nexport function useFormControl(options, validators) {\r\n return useControl(options, validators);\r\n}\r\nexport function useInputControl(options, validators) {\r\n return useControl(options, validators);\r\n}\r\n//# sourceMappingURL=form-control.hook.js.map","import { createFormGroupOptions } from '@rolster/forms/arguments';\r\nimport { controlsAllChecked, controlsPartialChecked, controlsToValue, groupIsValid } from '@rolster/forms/helpers';\r\nimport { useState } from 'react';\r\nexport function useFormGroup(options, groupValidators) {\r\n const groupOptions = createFormGroupOptions(options, groupValidators);\r\n const [validators, setValidators] = useState(groupOptions.validators);\r\n const { controls } = groupOptions;\r\n const errors = validators ? groupIsValid({ controls, validators }) : [];\r\n const valid = errors.length === 0 && controlsAllChecked(controls, 'valid');\r\n const value = controlsToValue(controls);\r\n const dirty = controlsPartialChecked(controls, 'dirty');\r\n const dirtyAll = controlsAllChecked(controls, 'dirty');\r\n const touched = controlsPartialChecked(controls, 'touched');\r\n const touchedAll = controlsAllChecked(controls, 'touched');\r\n function reset() {\r\n Object.values(controls).forEach((control) => {\r\n control.reset();\r\n });\r\n }\r\n return {\r\n controls,\r\n dirty,\r\n dirtyAll,\r\n error: errors[0],\r\n errors,\r\n invalid: !valid,\r\n pristine: !dirty,\r\n pristineAll: !dirtyAll,\r\n reset,\r\n setValidators,\r\n touched,\r\n touchedAll,\r\n untouched: !touched,\r\n untouchedAll: !touchedAll,\r\n valid,\r\n value,\r\n wrong: touched && !valid\r\n };\r\n}\r\n//# sourceMappingURL=form-group.hook.js.map"],"names":["uuid"],"mappings":";;;;AAAA,SAAS,sBAAsB,CAAC,KAAK,EAAE;AACvC,IAAI,QAAQ,OAAO,KAAK,KAAK,QAAQ,KAAK,OAAO,IAAI,KAAK,IAAI,YAAY,IAAI,KAAK,CAAC,EAAE;AACtF,CAAC;AACD,SAAS,oBAAoB,CAAC,KAAK,EAAE;AACrC,IAAI,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,UAAU,IAAI,KAAK,CAAC;AAC5D,CAAC;AACD,SAAS,oBAAoB,CAAC,KAAK,EAAE;AACrC,IAAI,QAAQ,OAAO,KAAK,KAAK,QAAQ,KAAK,QAAQ,IAAI,KAAK,IAAI,YAAY,IAAI,KAAK,CAAC,EAAE;AACvF,CAAC;AACM,SAAS,wBAAwB,CAAC,GAAG,SAAS,EAAE;AACvD,IAAI,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,SAAS,CAAC;AAC1C,IAAI,IAAI,CAAC,KAAK,EAAE;AAChB,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC5C,KAAK;AACL,IAAI,IAAI,CAAC,UAAU,IAAI,sBAAsB,CAAC,KAAK,CAAC,EAAE;AACtD,QAAQ,OAAO,KAAK,CAAC;AACrB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,QAAQ,YAAY,EAAE,CAAC,UAAU;AACjC,QAAQ,KAAK;AACb,QAAQ,KAAK;AACb,QAAQ,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK;AAChC,KAAK,CAAC;AACN;;;;"}
|
|
@@ -4,7 +4,7 @@ import { RefObject } from 'react';
|
|
|
4
4
|
import { ReactArrayControl, ReactArrayControlOptions, ReactSubscriberControl, ReactHtmlArrayControl, ReactInputArrayControl } from '../types';
|
|
5
5
|
export declare class RolsterArrayControl<E extends HTMLElement = HTMLElement, T = any> implements ReactArrayControl<E, T> {
|
|
6
6
|
readonly uuid: string;
|
|
7
|
-
readonly
|
|
7
|
+
readonly value: T;
|
|
8
8
|
readonly focused: boolean;
|
|
9
9
|
readonly unfocused: boolean;
|
|
10
10
|
readonly disabled: boolean;
|
|
@@ -20,7 +20,7 @@ export declare class RolsterArrayControl<E extends HTMLElement = HTMLElement, T
|
|
|
20
20
|
readonly error?: ValidatorError<T>;
|
|
21
21
|
readonly validators?: ValidatorFn<T>[];
|
|
22
22
|
elementRef?: RefObject<E>;
|
|
23
|
-
private
|
|
23
|
+
private initialValue;
|
|
24
24
|
private subscriber?;
|
|
25
25
|
constructor(options: ReactArrayControlOptions<T>);
|
|
26
26
|
focus(): void;
|
|
@@ -28,7 +28,7 @@ export declare class RolsterArrayControl<E extends HTMLElement = HTMLElement, T
|
|
|
28
28
|
disable(): void;
|
|
29
29
|
enable(): void;
|
|
30
30
|
touch(): void;
|
|
31
|
-
|
|
31
|
+
setValue(value: T): void;
|
|
32
32
|
setValidators(validators?: ValidatorFn<T>[]): void;
|
|
33
33
|
subscribe(listener: ReactSubscriberControl<T>): void;
|
|
34
34
|
reset(): void;
|
|
@@ -42,13 +42,13 @@ type ReactValidatorsOptions<T> = Omit<RolsterControlOptions<T>, 'state'>;
|
|
|
42
42
|
export declare function useReactArrayControl<E extends HTMLElement, T>(): ReactArrayControl<E, T | undefined>;
|
|
43
43
|
export declare function useReactArrayControl<E extends HTMLElement, T>(options: ReactStateOptions<T>): ReactArrayControl<E, T>;
|
|
44
44
|
export declare function useReactArrayControl<E extends HTMLElement, T>(options: ReactValidatorsOptions<T>): ReactArrayControl<E, T | undefined>;
|
|
45
|
-
export declare function useReactArrayControl<E extends HTMLElement, T>(
|
|
45
|
+
export declare function useReactArrayControl<E extends HTMLElement, T>(value: T, validators?: ValidatorFn<T>[]): ReactArrayControl<E, T>;
|
|
46
46
|
export declare function useFormArrayControl<T>(): ReactHtmlArrayControl<T | undefined>;
|
|
47
47
|
export declare function useFormArrayControl<T>(options: ReactStateOptions<T>): ReactHtmlArrayControl<T>;
|
|
48
48
|
export declare function useFormArrayControl<T>(options: ReactValidatorsOptions<T>): ReactHtmlArrayControl<T | undefined>;
|
|
49
|
-
export declare function useFormArrayControl<T>(
|
|
49
|
+
export declare function useFormArrayControl<T>(value: T, validators?: ValidatorFn<T>[]): ReactHtmlArrayControl<T>;
|
|
50
50
|
export declare function useInputArrayControl<T>(): ReactInputArrayControl<T | undefined>;
|
|
51
51
|
export declare function useInputArrayControl<T>(options: ReactStateOptions<T>): ReactInputArrayControl<T>;
|
|
52
52
|
export declare function useInputArrayControl<T>(options: ReactValidatorsOptions<T>): ReactInputArrayControl<T | undefined>;
|
|
53
|
-
export declare function useInputArrayControl<T>(
|
|
53
|
+
export declare function useInputArrayControl<T>(value: T, validators?: ValidatorFn<T>[]): ReactInputArrayControl<T>;
|
|
54
54
|
export {};
|
|
@@ -3,7 +3,7 @@ import { controlIsValid } from '@rolster/forms/helpers';
|
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
4
|
export class RolsterArrayControl {
|
|
5
5
|
constructor(options) {
|
|
6
|
-
this.
|
|
6
|
+
this.initialValue = options.initialValue;
|
|
7
7
|
this.uuid = options.uuid;
|
|
8
8
|
this.focused = !!options.focused;
|
|
9
9
|
this.unfocused = !this.focused;
|
|
@@ -13,10 +13,10 @@ export class RolsterArrayControl {
|
|
|
13
13
|
this.pristine = !this.dirty;
|
|
14
14
|
this.disabled = !!options.disabled;
|
|
15
15
|
this.enabled = !this.disabled;
|
|
16
|
-
const {
|
|
17
|
-
this.
|
|
16
|
+
const { value, validators } = options;
|
|
17
|
+
this.value = value;
|
|
18
18
|
this.validators = validators;
|
|
19
|
-
this.errors = validators ? controlIsValid({
|
|
19
|
+
this.errors = validators ? controlIsValid({ value, validators }) : [];
|
|
20
20
|
this.error = this.errors[0];
|
|
21
21
|
this.valid = this.errors.length === 0;
|
|
22
22
|
this.invalid = !this.valid;
|
|
@@ -47,8 +47,8 @@ export class RolsterArrayControl {
|
|
|
47
47
|
this.update({ touched: true });
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
this.update({
|
|
50
|
+
setValue(value) {
|
|
51
|
+
this.update({ value });
|
|
52
52
|
}
|
|
53
53
|
setValidators(validators) {
|
|
54
54
|
this.update({ validators });
|
|
@@ -57,14 +57,14 @@ export class RolsterArrayControl {
|
|
|
57
57
|
this.subscriber = listener;
|
|
58
58
|
}
|
|
59
59
|
reset() {
|
|
60
|
-
this.update({
|
|
60
|
+
this.update({ value: this.initialValue, dirty: false, touched: false });
|
|
61
61
|
}
|
|
62
62
|
update(changes) {
|
|
63
63
|
if (this.subscriber) {
|
|
64
64
|
this.subscriber({
|
|
65
65
|
...this,
|
|
66
66
|
...changes,
|
|
67
|
-
|
|
67
|
+
initialValue: this.initialValue
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -74,7 +74,7 @@ function useArrayControl(options, validators) {
|
|
|
74
74
|
return new RolsterArrayControl({
|
|
75
75
|
...controlOptions,
|
|
76
76
|
uuid: uuid(),
|
|
77
|
-
|
|
77
|
+
initialValue: controlOptions.value
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
export function useReactArrayControl(options, validators) {
|
|
@@ -3,8 +3,8 @@ import { ValidatorError } from '@rolster/validators';
|
|
|
3
3
|
import { ReactArrayControls, ReactArrayGroup, ReactSubscriberGroup } from '../types';
|
|
4
4
|
export declare class RolsterArrayGroup<C extends ReactArrayControls = ReactArrayControls, R = any> implements ReactArrayGroup<C, R> {
|
|
5
5
|
readonly uuid: string;
|
|
6
|
-
readonly resource?: R;
|
|
7
6
|
readonly controls: C;
|
|
7
|
+
readonly value: ArrayStateGroup<C>;
|
|
8
8
|
readonly dirty: boolean;
|
|
9
9
|
readonly dirtyAll: boolean;
|
|
10
10
|
readonly errors: ValidatorError<any>[];
|
|
@@ -19,7 +19,7 @@ export declare class RolsterArrayGroup<C extends ReactArrayControls = ReactArray
|
|
|
19
19
|
readonly wrong: boolean;
|
|
20
20
|
readonly error?: ValidatorError<any>;
|
|
21
21
|
readonly validators?: ValidatorGroupFn<C>[];
|
|
22
|
-
readonly
|
|
22
|
+
readonly resource?: R;
|
|
23
23
|
private subscriber?;
|
|
24
24
|
constructor(options: FormArrayGroupOptions<C, R>);
|
|
25
25
|
setValidators(validators: ValidatorGroupFn<C>[]): void;
|