@rolster/react-forms 18.4.2 → 18.5.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 +62 -66
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +62 -66
- 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 +1 -1
- package/package.json +3 -3
package/dist/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { v4 } from 'uuid';
|
|
|
2
2
|
import { useState, useRef, useEffect } from 'react';
|
|
3
3
|
|
|
4
4
|
function itIsFormControlOptions(props) {
|
|
5
|
-
return (typeof props === 'object' && ('
|
|
5
|
+
return (typeof props === 'object' && ('value' in props || 'validators' in props));
|
|
6
6
|
}
|
|
7
7
|
function itIsFormGroupOptions(props) {
|
|
8
8
|
return typeof props === 'object' && 'controls' in props;
|
|
@@ -13,13 +13,13 @@ function itIsFormArrayOptions(props) {
|
|
|
13
13
|
function createFormControlOptions(...argsProps) {
|
|
14
14
|
const [props, validators] = argsProps;
|
|
15
15
|
if (!props) {
|
|
16
|
-
return {
|
|
16
|
+
return { value: props, validators };
|
|
17
17
|
}
|
|
18
18
|
if (!validators && itIsFormControlOptions(props)) {
|
|
19
19
|
return props;
|
|
20
20
|
}
|
|
21
21
|
return {
|
|
22
|
-
|
|
22
|
+
value: props,
|
|
23
23
|
validators
|
|
24
24
|
};
|
|
25
25
|
}
|
|
@@ -60,9 +60,9 @@ function parseBoolean(value) {
|
|
|
60
60
|
FALSY_VALUE.includes(value));
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
const controlIsValid = ({
|
|
63
|
+
const controlIsValid = ({ value, validators }) => {
|
|
64
64
|
return validators.reduce((errors, validator) => {
|
|
65
|
-
const error = validator(
|
|
65
|
+
const error = validator(value);
|
|
66
66
|
if (error) {
|
|
67
67
|
errors.push(error);
|
|
68
68
|
}
|
|
@@ -75,9 +75,9 @@ const controlsAllChecked = (controls, key) => {
|
|
|
75
75
|
const controlsPartialChecked = (controls, key) => {
|
|
76
76
|
return Object.values(controls).reduce((value, control) => control.disabled ? value : value || parseBoolean(control[key]), false);
|
|
77
77
|
};
|
|
78
|
-
const
|
|
79
|
-
return Object.entries(controls).reduce((result, [key, {
|
|
80
|
-
result[key] =
|
|
78
|
+
const controlsToValue = (controls) => {
|
|
79
|
+
return Object.entries(controls).reduce((result, [key, { value }]) => {
|
|
80
|
+
result[key] = value;
|
|
81
81
|
return result;
|
|
82
82
|
}, {});
|
|
83
83
|
};
|
|
@@ -108,7 +108,7 @@ const arrayIsValid = ({ groups, validators }) => {
|
|
|
108
108
|
|
|
109
109
|
class RolsterArrayControl {
|
|
110
110
|
constructor(options) {
|
|
111
|
-
this.
|
|
111
|
+
this.initialValue = options.initialValue;
|
|
112
112
|
this.uuid = options.uuid;
|
|
113
113
|
this.focused = !!options.focused;
|
|
114
114
|
this.unfocused = !this.focused;
|
|
@@ -118,10 +118,10 @@ class RolsterArrayControl {
|
|
|
118
118
|
this.pristine = !this.dirty;
|
|
119
119
|
this.disabled = !!options.disabled;
|
|
120
120
|
this.enabled = !this.disabled;
|
|
121
|
-
const {
|
|
122
|
-
this.
|
|
121
|
+
const { value, validators } = options;
|
|
122
|
+
this.value = value;
|
|
123
123
|
this.validators = validators;
|
|
124
|
-
this.errors = validators ? controlIsValid({
|
|
124
|
+
this.errors = validators ? controlIsValid({ value, validators }) : [];
|
|
125
125
|
this.error = this.errors[0];
|
|
126
126
|
this.valid = this.errors.length === 0;
|
|
127
127
|
this.invalid = !this.valid;
|
|
@@ -152,8 +152,8 @@ class RolsterArrayControl {
|
|
|
152
152
|
this.update({ touched: true });
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
|
|
156
|
-
this.update({
|
|
155
|
+
setValue(value) {
|
|
156
|
+
this.update({ value });
|
|
157
157
|
}
|
|
158
158
|
setValidators(validators) {
|
|
159
159
|
this.update({ validators });
|
|
@@ -162,14 +162,14 @@ class RolsterArrayControl {
|
|
|
162
162
|
this.subscriber = listener;
|
|
163
163
|
}
|
|
164
164
|
reset() {
|
|
165
|
-
this.update({
|
|
165
|
+
this.update({ value: this.initialValue, dirty: false, touched: false });
|
|
166
166
|
}
|
|
167
167
|
update(changes) {
|
|
168
168
|
if (this.subscriber) {
|
|
169
169
|
this.subscriber({
|
|
170
170
|
...this,
|
|
171
171
|
...changes,
|
|
172
|
-
|
|
172
|
+
initialValue: this.initialValue
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -179,7 +179,7 @@ function useArrayControl(options, validators) {
|
|
|
179
179
|
return new RolsterArrayControl({
|
|
180
180
|
...controlOptions,
|
|
181
181
|
uuid: v4(),
|
|
182
|
-
|
|
182
|
+
initialValue: controlOptions.value
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
function useReactArrayControl(options, validators) {
|
|
@@ -213,7 +213,7 @@ class RolsterArrayGroup {
|
|
|
213
213
|
this.pristine = !this.dirty;
|
|
214
214
|
this.pristineAll = !this.dirtyAll;
|
|
215
215
|
this.wrong = this.touched && this.invalid;
|
|
216
|
-
this.
|
|
216
|
+
this.value = controlsToValue(controls);
|
|
217
217
|
const subscriber = (options) => {
|
|
218
218
|
this.update({
|
|
219
219
|
controls: Object.entries(this.controls).reduce((controls, [key, control]) => {
|
|
@@ -250,27 +250,27 @@ function useFormArray(options, arrayValidators) {
|
|
|
250
250
|
const arrayOptions = createFormArrayOptions(options, arrayValidators);
|
|
251
251
|
const { validators } = arrayOptions;
|
|
252
252
|
const groups = arrayOptions.groups || [];
|
|
253
|
-
const [
|
|
253
|
+
const [state, setState] = useState({
|
|
254
254
|
controls: groups.map(({ controls }) => controls),
|
|
255
255
|
disabled: false,
|
|
256
256
|
groups,
|
|
257
|
-
|
|
257
|
+
value: groups.map(({ controls }) => controlsToValue(controls)),
|
|
258
258
|
validators
|
|
259
259
|
});
|
|
260
260
|
const currentState = useRef(groups);
|
|
261
261
|
useEffect(() => {
|
|
262
262
|
const subscriber = (options) => {
|
|
263
|
-
|
|
263
|
+
setState((state) => ({
|
|
264
264
|
...state,
|
|
265
|
-
groups:
|
|
265
|
+
groups: state.groups.map((group) => group.uuid === options.uuid
|
|
266
266
|
? new RolsterArrayGroup(options)
|
|
267
267
|
: group)
|
|
268
268
|
}));
|
|
269
269
|
};
|
|
270
|
-
|
|
270
|
+
state.groups.forEach((group) => {
|
|
271
271
|
group.subscribe(subscriber);
|
|
272
272
|
});
|
|
273
|
-
}, [
|
|
273
|
+
}, [state]);
|
|
274
274
|
const errors = validators ? arrayIsValid({ groups, validators }) : [];
|
|
275
275
|
const error = errors[0];
|
|
276
276
|
const valid = errors.length === 0 && groupAllChecked(groups, 'valid');
|
|
@@ -279,44 +279,44 @@ function useFormArray(options, arrayValidators) {
|
|
|
279
279
|
const touched = groupPartialChecked(groups, 'touched');
|
|
280
280
|
const touchedAll = groupAllChecked(groups, 'touched');
|
|
281
281
|
function disable() {
|
|
282
|
-
|
|
282
|
+
setState((state) => ({ ...state, disabled: true }));
|
|
283
283
|
}
|
|
284
284
|
function enable() {
|
|
285
|
-
|
|
285
|
+
setState((state) => ({ ...state, disabled: false }));
|
|
286
286
|
}
|
|
287
287
|
function setGroups(groups) {
|
|
288
|
-
|
|
288
|
+
setState((currentState) => ({
|
|
289
289
|
...currentState,
|
|
290
290
|
groups,
|
|
291
291
|
controls: groups.map(({ controls }) => controls),
|
|
292
|
-
|
|
292
|
+
value: groups.map(({ controls }) => controlsToValue(controls))
|
|
293
293
|
}));
|
|
294
294
|
}
|
|
295
295
|
function push(group) {
|
|
296
|
-
setGroups([...
|
|
296
|
+
setGroups([...state.groups, group]);
|
|
297
297
|
}
|
|
298
298
|
function merge(groups) {
|
|
299
|
-
setGroups([...
|
|
299
|
+
setGroups([...state.groups, ...groups]);
|
|
300
300
|
}
|
|
301
301
|
function set(groups) {
|
|
302
302
|
setGroups(groups);
|
|
303
303
|
}
|
|
304
304
|
function remove({ uuid }) {
|
|
305
|
-
setGroups(
|
|
305
|
+
setGroups(state.groups.filter((group) => group.uuid !== uuid));
|
|
306
306
|
}
|
|
307
307
|
function reset() {
|
|
308
308
|
setGroups(currentState.current);
|
|
309
309
|
}
|
|
310
310
|
function setValidators(validators) {
|
|
311
|
-
|
|
311
|
+
setState((state) => ({ ...state, validators }));
|
|
312
312
|
}
|
|
313
313
|
return {
|
|
314
|
-
...
|
|
314
|
+
...state,
|
|
315
315
|
dirty,
|
|
316
316
|
dirtyAll,
|
|
317
317
|
disable,
|
|
318
318
|
enable,
|
|
319
|
-
enabled: !
|
|
319
|
+
enabled: !state.disabled,
|
|
320
320
|
error,
|
|
321
321
|
errors,
|
|
322
322
|
invalid: !valid,
|
|
@@ -338,77 +338,73 @@ function useFormArray(options, arrayValidators) {
|
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
function useControl(controlOptions, controlValidators) {
|
|
341
|
-
const {
|
|
342
|
-
const [
|
|
341
|
+
const { value, touched, validators } = createFormControlOptions(controlOptions, controlValidators);
|
|
342
|
+
const [state, setState] = useState({
|
|
343
343
|
dirty: false,
|
|
344
344
|
disabled: false,
|
|
345
345
|
focused: false,
|
|
346
|
-
state: state,
|
|
347
346
|
touched: !!touched,
|
|
348
|
-
validators
|
|
347
|
+
validators,
|
|
348
|
+
value
|
|
349
349
|
});
|
|
350
|
-
const
|
|
350
|
+
const initialValue = useRef(value);
|
|
351
351
|
const elementRef = useRef(null);
|
|
352
|
-
const errors =
|
|
352
|
+
const errors = state.validators
|
|
353
353
|
? controlIsValid({
|
|
354
|
-
|
|
355
|
-
validators:
|
|
354
|
+
value: state.value,
|
|
355
|
+
validators: state.validators
|
|
356
356
|
})
|
|
357
357
|
: [];
|
|
358
358
|
const valid = errors.length === 0;
|
|
359
359
|
function focus() {
|
|
360
|
-
|
|
360
|
+
setState((state) => ({ ...state, focused: true }));
|
|
361
361
|
}
|
|
362
362
|
function blur() {
|
|
363
|
-
|
|
363
|
+
setState((state) => ({ ...state, focused: false, touched: true }));
|
|
364
364
|
}
|
|
365
365
|
function disable() {
|
|
366
|
-
|
|
366
|
+
setState((state) => ({ ...state, disabled: true }));
|
|
367
367
|
}
|
|
368
368
|
function enable() {
|
|
369
|
-
|
|
369
|
+
setState((state) => ({ ...state, disabled: false }));
|
|
370
370
|
}
|
|
371
371
|
function touch() {
|
|
372
|
-
|
|
372
|
+
setState((state) => ({ ...state, touched: true }));
|
|
373
373
|
}
|
|
374
|
-
function
|
|
375
|
-
|
|
376
|
-
...currentState,
|
|
377
|
-
dirty: true,
|
|
378
|
-
state
|
|
379
|
-
}));
|
|
374
|
+
function setValue(value) {
|
|
375
|
+
setState((state) => ({ ...state, dirty: true, value }));
|
|
380
376
|
}
|
|
381
377
|
function setValidators(validators) {
|
|
382
|
-
|
|
378
|
+
setState((state) => ({ ...state, validators }));
|
|
383
379
|
}
|
|
384
380
|
function reset() {
|
|
385
|
-
|
|
386
|
-
...
|
|
381
|
+
setState((state) => ({
|
|
382
|
+
...state,
|
|
387
383
|
dirty: false,
|
|
388
|
-
|
|
384
|
+
value: initialValue.current,
|
|
389
385
|
touched: false
|
|
390
386
|
}));
|
|
391
387
|
}
|
|
392
388
|
return {
|
|
393
|
-
...
|
|
389
|
+
...state,
|
|
394
390
|
blur,
|
|
395
391
|
disable,
|
|
396
392
|
elementRef,
|
|
397
393
|
enable,
|
|
398
|
-
enabled: !
|
|
394
|
+
enabled: !state.disabled,
|
|
399
395
|
error: errors[0],
|
|
400
396
|
errors,
|
|
401
397
|
focus,
|
|
402
398
|
invalid: !valid,
|
|
403
|
-
pristine: !
|
|
399
|
+
pristine: !state.dirty,
|
|
404
400
|
reset,
|
|
405
|
-
setState,
|
|
406
401
|
setValidators,
|
|
402
|
+
setValue,
|
|
407
403
|
touch,
|
|
408
|
-
unfocused: !
|
|
409
|
-
untouched: !
|
|
404
|
+
unfocused: !state.focused,
|
|
405
|
+
untouched: !state.touched,
|
|
410
406
|
valid,
|
|
411
|
-
wrong:
|
|
407
|
+
wrong: state.touched && !valid
|
|
412
408
|
};
|
|
413
409
|
}
|
|
414
410
|
function useReactControl(options, validators) {
|
|
@@ -427,7 +423,7 @@ function useFormGroup(options, groupValidators) {
|
|
|
427
423
|
const { controls } = groupOptions;
|
|
428
424
|
const errors = validators ? groupIsValid({ controls, validators }) : [];
|
|
429
425
|
const valid = errors.length === 0 && controlsAllChecked(controls, 'valid');
|
|
430
|
-
const
|
|
426
|
+
const value = controlsToValue(controls);
|
|
431
427
|
const dirty = controlsPartialChecked(controls, 'dirty');
|
|
432
428
|
const dirtyAll = controlsAllChecked(controls, 'dirty');
|
|
433
429
|
const touched = controlsPartialChecked(controls, 'touched');
|
|
@@ -448,12 +444,12 @@ function useFormGroup(options, groupValidators) {
|
|
|
448
444
|
pristineAll: !dirtyAll,
|
|
449
445
|
reset,
|
|
450
446
|
setValidators,
|
|
451
|
-
state,
|
|
452
447
|
touched,
|
|
453
448
|
touchedAll,
|
|
454
449
|
untouched: !touched,
|
|
455
450
|
untouchedAll: !touchedAll,
|
|
456
451
|
valid,
|
|
452
|
+
value,
|
|
457
453
|
wrong: touched && !valid
|
|
458
454
|
};
|
|
459
455
|
}
|
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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,IAAI,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;AAC5C,IAAI,MAAM,KAAK,GAAG,sBAAsB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC5D,IAAI,MAAM,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC3D,IAAI,MAAM,OAAO,GAAG,sBAAsB,CAAC,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","../../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' && ('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","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 = ({ value, validators }) => {\r\n return validators.reduce((errors, validator) => {\r\n const error = validator(value);\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 controlsToValue = (controls) => {\r\n return Object.entries(controls).reduce((result, [key, { value }]) => {\r\n result[key] = value;\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.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,S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O,CAAC,CAAC;AAC3D,IAAI,MAAM,OAAO,GAAG,sBAAsB,CAAC,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,OAAO;AACf,QAAQ,UAAU;AAClB,QAAQ,SAAS,EAAE,CAAC,OAAO;AAC3B,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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createFormGroupOptions } from '@rolster/forms/arguments';
|
|
2
|
-
import { controlsAllChecked, controlsPartialChecked,
|
|
2
|
+
import { controlsAllChecked, controlsPartialChecked, controlsToValue, groupIsValid } from '@rolster/forms/helpers';
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
4
|
import { RolsterArrayControl } from './form-array-control.hook';
|
|
5
5
|
export class RolsterArrayGroup {
|
|
@@ -23,7 +23,7 @@ export class RolsterArrayGroup {
|
|
|
23
23
|
this.pristine = !this.dirty;
|
|
24
24
|
this.pristineAll = !this.dirtyAll;
|
|
25
25
|
this.wrong = this.touched && this.invalid;
|
|
26
|
-
this.
|
|
26
|
+
this.value = controlsToValue(controls);
|
|
27
27
|
const subscriber = (options) => {
|
|
28
28
|
this.update({
|
|
29
29
|
controls: Object.entries(this.controls).reduce((controls, [key, control]) => {
|