@rolster/react-forms 18.2.9 → 18.3.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 +230 -214
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +231 -211
- package/dist/es/index.js.map +1 -1
- package/dist/esm/form-array/form-array-control.hook.d.ts +24 -18
- package/dist/esm/form-array/form-array-control.hook.js +32 -26
- package/dist/esm/form-array/form-array-control.hook.js.map +1 -1
- package/dist/esm/form-array/form-array-group.hook.d.ts +10 -9
- package/dist/esm/form-array/form-array-group.hook.js +33 -12
- package/dist/esm/form-array/form-array-group.hook.js.map +1 -1
- package/dist/esm/form-array/form-array.hook.d.ts +5 -11
- package/dist/esm/form-array/form-array.hook.js +45 -55
- package/dist/esm/form-array/form-array.hook.js.map +1 -1
- package/dist/esm/form-array/index.d.ts +2 -2
- package/dist/esm/form-array/index.js +2 -2
- package/dist/esm/form-array/index.js.map +1 -1
- package/dist/esm/form-control.hook.d.ts +16 -11
- package/dist/esm/form-control.hook.js +49 -58
- package/dist/esm/form-control.hook.js.map +1 -1
- package/dist/esm/form-group.hook.d.ts +3 -3
- package/dist/esm/form-group.hook.js +17 -17
- package/dist/esm/form-group.hook.js.map +1 -1
- package/dist/esm/form-ref.hook.d.ts +10 -10
- package/dist/esm/form-ref.hook.js +21 -17
- package/dist/esm/form-ref.hook.js.map +1 -1
- package/dist/esm/index.d.ts +2 -3
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types.d.ts +24 -10
- package/package.json +7 -5
- package/dist/esm/form-array/types.d.ts +0 -23
- package/dist/esm/form-array/types.js +0 -2
- package/dist/esm/form-array/types.js.map +0 -1
|
@@ -1,34 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { arrayIsValid, controlsToState, groupAllChecked, groupPartialChecked } from '@rolster/
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { RolsterArrayControl } from './form-array-control.hook';
|
|
1
|
+
import { createFormArrayOptions } from '@rolster/forms/arguments';
|
|
2
|
+
import { arrayIsValid, controlsToState, groupAllChecked, groupPartialChecked } from '@rolster/forms/helpers';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
4
|
import { RolsterArrayGroup } from './form-array-group.hook';
|
|
6
|
-
export function
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return controls;
|
|
18
|
-
}, {});
|
|
19
|
-
return new RolsterArrayGroup({ ...group, controls });
|
|
20
|
-
}
|
|
21
|
-
export function useFormArray(arrayProps, arrayValidators) {
|
|
22
|
-
const props = createFormArrayProps(arrayProps, arrayValidators);
|
|
23
|
-
const [currentState] = useState(props.groups);
|
|
24
|
-
const [state, setState] = useState([]);
|
|
25
|
-
const [validators, setValidators] = useState(props.validators);
|
|
26
|
-
const [controls, setControls] = useState([]);
|
|
27
|
-
const [groups, setGroups] = useState(props.groups || []);
|
|
5
|
+
export function useFormArray(options, arrayValidators) {
|
|
6
|
+
const arrayOptions = createFormArrayOptions(options, arrayValidators);
|
|
7
|
+
const { validators } = arrayOptions;
|
|
8
|
+
const groups = arrayOptions.groups || [];
|
|
9
|
+
const [arrayState, setArrayState] = useState({
|
|
10
|
+
controls: groups.map(({ controls }) => controls),
|
|
11
|
+
groups,
|
|
12
|
+
state: groups.map(({ controls }) => controlsToState(controls)),
|
|
13
|
+
validators
|
|
14
|
+
});
|
|
15
|
+
const currentState = useRef(groups);
|
|
28
16
|
useEffect(() => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
const subscriber = (options) => {
|
|
18
|
+
setArrayState((state) => ({
|
|
19
|
+
...state,
|
|
20
|
+
groups: arrayState.groups.map((group) => group.uuid === options.uuid
|
|
21
|
+
? new RolsterArrayGroup(options)
|
|
22
|
+
: group)
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
arrayState.groups.forEach((group) => {
|
|
26
|
+
group.subscribe(subscriber);
|
|
27
|
+
});
|
|
28
|
+
}, [arrayState]);
|
|
32
29
|
const errors = validators ? arrayIsValid({ groups, validators }) : [];
|
|
33
30
|
const error = errors[0];
|
|
34
31
|
const valid = errors.length === 0 && groupAllChecked(groups, 'valid');
|
|
@@ -36,60 +33,53 @@ export function useFormArray(arrayProps, arrayValidators) {
|
|
|
36
33
|
const toucheds = groupAllChecked(groups, 'touched');
|
|
37
34
|
const dirties = groupAllChecked(groups, 'dirty');
|
|
38
35
|
const dirty = groupPartialChecked(groups, 'dirty');
|
|
36
|
+
function setGroups(groups) {
|
|
37
|
+
setArrayState((currentState) => ({
|
|
38
|
+
...currentState,
|
|
39
|
+
groups,
|
|
40
|
+
controls: groups.map(({ controls }) => controls),
|
|
41
|
+
state: groups.map(({ controls }) => controlsToState(controls))
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
39
44
|
function push(group) {
|
|
40
|
-
setGroups([...groups, group]);
|
|
45
|
+
setGroups([...arrayState.groups, group]);
|
|
41
46
|
}
|
|
42
|
-
function merge(
|
|
43
|
-
setGroups([...groups, ...
|
|
47
|
+
function merge(groups) {
|
|
48
|
+
setGroups([...arrayState.groups, ...groups]);
|
|
44
49
|
}
|
|
45
50
|
function set(groups) {
|
|
46
51
|
setGroups(groups);
|
|
47
52
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
const group = cloneFormControlForArrayGroup(control.group, control, changes);
|
|
51
|
-
setGroups(groups.map((currentGroup) => currentGroup.uuid === group.uuid ? group : currentGroup));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function refreshGroup(group, changes) {
|
|
55
|
-
const newGroup = cloneFormArrayGroup(group, changes);
|
|
56
|
-
const { uuid } = newGroup;
|
|
57
|
-
setGroups(groups.map((currentGroup) => currentGroup.uuid === uuid ? newGroup : currentGroup));
|
|
58
|
-
}
|
|
59
|
-
function remove(group) {
|
|
60
|
-
setGroups(groups.filter(({ uuid }) => group.uuid !== uuid));
|
|
53
|
+
function remove({ uuid }) {
|
|
54
|
+
setGroups(arrayState.groups.filter((group) => group.uuid !== uuid));
|
|
61
55
|
}
|
|
62
56
|
function reset() {
|
|
63
|
-
setGroups(currentState
|
|
57
|
+
setGroups(currentState.current);
|
|
64
58
|
}
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
function setValidators(validators) {
|
|
60
|
+
setArrayState((state) => ({ ...state, validators }));
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
...arrayState,
|
|
67
64
|
dirty,
|
|
68
65
|
dirties,
|
|
69
66
|
error,
|
|
70
67
|
errors,
|
|
71
|
-
groups,
|
|
72
68
|
invalid: !valid,
|
|
73
69
|
merge,
|
|
74
70
|
pristine: !dirty,
|
|
75
71
|
pristines: !dirties,
|
|
76
72
|
push,
|
|
77
|
-
refreshControl,
|
|
78
|
-
refreshGroup,
|
|
79
73
|
remove,
|
|
80
74
|
reset,
|
|
81
75
|
set,
|
|
82
76
|
setValidators,
|
|
83
|
-
state,
|
|
84
77
|
touched,
|
|
85
78
|
toucheds,
|
|
86
79
|
untouched: !touched,
|
|
87
80
|
untoucheds: !toucheds,
|
|
88
81
|
valid,
|
|
89
|
-
value: state,
|
|
90
82
|
wrong: touched && !valid
|
|
91
83
|
};
|
|
92
|
-
groups.forEach((group) => (group.parent = formArray));
|
|
93
|
-
return formArray;
|
|
94
84
|
}
|
|
95
85
|
//# sourceMappingURL=form-array.hook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-array.hook.js","sourceRoot":"","sources":["../../../src/form-array/form-array.hook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-array.hook.js","sourceRoot":"","sources":["../../../src/form-array/form-array.hook.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;A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S,KAAK,CAAC,MAAW;QACxB,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,SAAS,GAAG,CAAC,MAAW;QACtB,SAAS,CAAC,MAAM,CAAC,CAAC;IACpB,CAAC;IAED,SAAS,MAAM,CAAC,EAAE,IAAI,EAAK;QACzB,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,SAAS,KAAK;QACZ,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,SAAS,aAAa,CAAC,UAAqC;QAC1D,aAAa,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,OAAO;QACL,GAAG,UAAU;QACb,KAAK;QACL,OAAO;QACP,KAAK;QACL,MAAM;QACN,OAAO,EAAE,CAAC,KAAK;QACf,KAAK;QACL,QAAQ,EAAE,CAAC,KAAK;QAChB,SAAS,EAAE,CAAC,OAAO;QACnB,IAAI;QACJ,MAAM;QACN,KAAK;QACL,GAAG;QACH,aAAa;QACb,OAAO;QACP,QAAQ;QACR,SAAS,EAAE,CAAC,OAAO;QACnB,UAAU,EAAE,CAAC,QAAQ;QACrB,KAAK;QACL,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { useFormArrayControl, useInputArrayControl } from './form-array-control.hook';
|
|
1
|
+
export { useReactArrayControl, useFormArrayControl, useInputArrayControl } from './form-array-control.hook';
|
|
2
2
|
export { useFormArrayGroup } from './form-array-group.hook';
|
|
3
|
-
export {
|
|
3
|
+
export { useFormArray } from './form-array.hook';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useFormArrayControl, useInputArrayControl } from './form-array-control.hook';
|
|
1
|
+
export { useReactArrayControl, useFormArrayControl, useInputArrayControl } from './form-array-control.hook';
|
|
2
2
|
export { useFormArrayGroup } from './form-array-group.hook';
|
|
3
|
-
export {
|
|
3
|
+
export { useFormArray } from './form-array.hook';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/form-array/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/form-array/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormControlOptions } from '@rolster/forms';
|
|
2
2
|
import { ValidatorFn } from '@rolster/validators';
|
|
3
3
|
import { ReactFormControl, ReactHtmlControl, ReactInputControl } from './types';
|
|
4
|
-
interface
|
|
4
|
+
interface ReactControlOptions<T = any> extends FormControlOptions<T> {
|
|
5
5
|
touched?: boolean;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare function useReactControl<E extends HTMLElement, T
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
14
|
-
export declare function
|
|
15
|
-
export declare function
|
|
7
|
+
type ReactStateOptions<T> = Omit<ReactControlOptions<T>, 'validators'>;
|
|
8
|
+
type ReactValidatorsOptions<T> = Omit<ReactControlOptions<T>, 'state'>;
|
|
9
|
+
export declare function useReactControl<E extends HTMLElement, T>(): ReactFormControl<E, T | undefined>;
|
|
10
|
+
export declare function useReactControl<E extends HTMLElement, T>(options: ReactStateOptions<T>): ReactFormControl<E, T>;
|
|
11
|
+
export declare function useReactControl<E extends HTMLElement, T>(options: ReactValidatorsOptions<T>): ReactFormControl<E, T | undefined>;
|
|
12
|
+
export declare function useReactControl<E extends HTMLElement, T>(state: T, validators?: ValidatorFn<T>[]): ReactFormControl<E, T>;
|
|
13
|
+
export declare function useFormControl<T>(): ReactHtmlControl<T | undefined>;
|
|
14
|
+
export declare function useFormControl<T>(options: ReactStateOptions<T>): ReactHtmlControl<T>;
|
|
15
|
+
export declare function useFormControl<T>(options: ReactValidatorsOptions<T>): ReactHtmlControl<T | undefined>;
|
|
16
|
+
export declare function useFormControl<T>(state: T, validators?: ValidatorFn<T>[]): ReactHtmlControl<T>;
|
|
17
|
+
export declare function useInputControl<T>(): ReactInputControl<T | undefined>;
|
|
18
|
+
export declare function useInputControl<T>(options: ReactStateOptions<T>): ReactInputControl<T>;
|
|
19
|
+
export declare function useInputControl<T>(options: ReactValidatorsOptions<T>): ReactInputControl<T | undefined>;
|
|
20
|
+
export declare function useInputControl<T>(state: T, validators?: ValidatorFn<T>[]): ReactInputControl<T>;
|
|
16
21
|
export {};
|
|
@@ -1,95 +1,86 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { controlIsValid } from '@rolster/
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const [subscribers] = useState(new BehaviorSubject(props.state));
|
|
1
|
+
import { createFormControlOptions } from '@rolster/forms/arguments';
|
|
2
|
+
import { controlIsValid } from '@rolster/forms/helpers';
|
|
3
|
+
import { useRef, useState } from 'react';
|
|
4
|
+
function useControl(controlOptions, controlValidators) {
|
|
5
|
+
const { state, touched, validators } = createFormControlOptions(controlOptions, controlValidators);
|
|
6
|
+
const [controlState, setControlState] = useState({
|
|
7
|
+
dirty: false,
|
|
8
|
+
disabled: false,
|
|
9
|
+
focused: false,
|
|
10
|
+
state: state,
|
|
11
|
+
touched: !!touched,
|
|
12
|
+
validators: validators
|
|
13
|
+
});
|
|
14
|
+
const initialState = useRef(state);
|
|
16
15
|
const elementRef = useRef(null);
|
|
17
|
-
const errors =
|
|
18
|
-
const
|
|
19
|
-
const valid = (() => errors.length === 0)();
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (state !== null && state !== undefined) {
|
|
22
|
-
setValue(state);
|
|
23
|
-
}
|
|
24
|
-
subscribers.next(state);
|
|
25
|
-
}, [state]);
|
|
16
|
+
const errors = validators ? controlIsValid({ state, validators }) : [];
|
|
17
|
+
const valid = errors.length === 0;
|
|
26
18
|
function focus() {
|
|
27
|
-
|
|
19
|
+
setControlState((state) => ({ ...state, focused: true }));
|
|
28
20
|
}
|
|
29
21
|
function blur() {
|
|
30
|
-
|
|
22
|
+
setControlState((state) => ({ ...state, focused: false }));
|
|
31
23
|
}
|
|
32
24
|
function disable() {
|
|
33
|
-
|
|
25
|
+
setControlState((state) => ({ ...state, disabled: true }));
|
|
34
26
|
}
|
|
35
27
|
function enable() {
|
|
36
|
-
|
|
28
|
+
setControlState((state) => ({ ...state, disabled: false }));
|
|
37
29
|
}
|
|
38
30
|
function touch() {
|
|
39
|
-
|
|
31
|
+
setControlState((state) => ({ ...state, touched: true }));
|
|
40
32
|
}
|
|
41
33
|
function untouch() {
|
|
42
|
-
|
|
34
|
+
setControlState((state) => ({ ...state, touched: false }));
|
|
43
35
|
}
|
|
44
36
|
function setState(state) {
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
setControlState((currentState) => ({
|
|
38
|
+
...currentState,
|
|
39
|
+
dirty: true,
|
|
40
|
+
state
|
|
41
|
+
}));
|
|
47
42
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
setDirty(false);
|
|
51
|
-
setCurrentState(initialValue);
|
|
43
|
+
function setValidators(validators) {
|
|
44
|
+
setControlState((state) => ({ ...state, validators }));
|
|
52
45
|
}
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
function reset() {
|
|
47
|
+
setControlState((currentState) => ({
|
|
48
|
+
...currentState,
|
|
49
|
+
dirty: false,
|
|
50
|
+
state: initialState.current,
|
|
51
|
+
touched: false
|
|
52
|
+
}));
|
|
56
53
|
}
|
|
57
54
|
return {
|
|
55
|
+
...controlState,
|
|
58
56
|
blur,
|
|
59
|
-
dirty,
|
|
60
57
|
disable,
|
|
61
|
-
disabled,
|
|
62
58
|
elementRef,
|
|
63
59
|
enable,
|
|
64
|
-
enabled: !disabled,
|
|
65
|
-
error,
|
|
60
|
+
enabled: !controlState.disabled,
|
|
61
|
+
error: errors[0],
|
|
66
62
|
errors,
|
|
67
63
|
focus,
|
|
68
|
-
focused,
|
|
69
64
|
invalid: !valid,
|
|
70
|
-
pristine: !dirty,
|
|
65
|
+
pristine: !controlState.dirty,
|
|
71
66
|
reset,
|
|
72
67
|
setState,
|
|
73
68
|
setValidators,
|
|
74
|
-
state,
|
|
75
|
-
subscribe,
|
|
76
69
|
touch,
|
|
77
|
-
|
|
78
|
-
unfocused: !focused,
|
|
70
|
+
unfocused: !controlState.focused,
|
|
79
71
|
untouch,
|
|
80
|
-
untouched: !touched,
|
|
72
|
+
untouched: !controlState.touched,
|
|
81
73
|
valid,
|
|
82
|
-
|
|
83
|
-
wrong: touched && !valid
|
|
74
|
+
wrong: controlState.touched && !valid
|
|
84
75
|
};
|
|
85
76
|
}
|
|
86
|
-
export function useReactControl(
|
|
87
|
-
return useControl(
|
|
77
|
+
export function useReactControl(options, validators) {
|
|
78
|
+
return useControl(options, validators);
|
|
88
79
|
}
|
|
89
|
-
export function useFormControl(
|
|
90
|
-
return useControl(
|
|
80
|
+
export function useFormControl(options, validators) {
|
|
81
|
+
return useControl(options, validators);
|
|
91
82
|
}
|
|
92
|
-
export function useInputControl(
|
|
93
|
-
return useControl(
|
|
83
|
+
export function useInputControl(options, validators) {
|
|
84
|
+
return useControl(options, validators);
|
|
94
85
|
}
|
|
95
86
|
//# sourceMappingURL=form-control.hook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-control.hook.js","sourceRoot":"","sources":["../../src/form-control.hook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-control.hook.js","sourceRoot":"","sources":["../../src/form-control.hook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAgBzC,SAAS,UAAU,CACjB,cAA2C,EAC3C,iBAAoC;IAEpC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,wBAAwB,CAG7D,cAAc,EAAE,iBAAiB,CAAC,CAAC;IAErC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAkB;QAChE,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,UAAU,EAAE,UAAU;KACvB,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,MAAM,CAAI,KAAK,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,MAAM,CAAI,IAAI,CAAC,CAAC;IAEnC,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,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
|
-
export declare function useFormGroup<
|
|
4
|
-
export declare function useFormGroup<
|
|
3
|
+
export declare function useFormGroup<C extends ReactControls>(options: FormGroupOptions<C>): ReactGroup<C>;
|
|
4
|
+
export declare function useFormGroup<C extends ReactControls>(controls: C, validators?: ValidatorGroupFn<C>[]): ReactGroup<C>;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { controlsAllChecked, controlsPartialChecked, controlsToState,
|
|
1
|
+
import { createFormGroupOptions } from '@rolster/forms/arguments';
|
|
2
|
+
import { controlsAllChecked, controlsPartialChecked, controlsToState, groupIsValid } from '@rolster/forms/helpers';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
export function useFormGroup(
|
|
5
|
-
const
|
|
6
|
-
const [validators, setValidators] = useState(
|
|
7
|
-
const { controls } =
|
|
8
|
-
const errors =
|
|
9
|
-
const valid =
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const value = (() => controlsToValue(controls))();
|
|
4
|
+
export function useFormGroup(options, groupValidators) {
|
|
5
|
+
const groupOptions = createFormGroupOptions(options, groupValidators);
|
|
6
|
+
const [validators, setValidators] = useState(groupOptions.validators);
|
|
7
|
+
const { controls } = groupOptions;
|
|
8
|
+
const errors = validators ? groupIsValid({ controls, validators }) : [];
|
|
9
|
+
const valid = errors.length === 0 && controlsAllChecked(controls, 'valid');
|
|
10
|
+
const state = controlsToState(controls);
|
|
11
|
+
const dirty = controlsPartialChecked(controls, 'dirty');
|
|
12
|
+
const dirties = controlsAllChecked(controls, 'dirty');
|
|
13
|
+
const touched = controlsPartialChecked(controls, 'touched');
|
|
14
|
+
const toucheds = controlsAllChecked(controls, 'touched');
|
|
16
15
|
function reset() {
|
|
17
|
-
Object.values(controls).forEach((control) =>
|
|
16
|
+
Object.values(controls).forEach((control) => {
|
|
17
|
+
control.reset();
|
|
18
|
+
});
|
|
18
19
|
}
|
|
19
20
|
return {
|
|
20
21
|
controls,
|
|
@@ -26,14 +27,13 @@ export function useFormGroup(groupProps, groupValidators) {
|
|
|
26
27
|
pristine: !dirty,
|
|
27
28
|
pristines: !dirties,
|
|
28
29
|
reset,
|
|
29
|
-
state,
|
|
30
30
|
setValidators,
|
|
31
|
+
state,
|
|
31
32
|
touched,
|
|
32
33
|
toucheds,
|
|
33
34
|
untouched: !touched,
|
|
34
35
|
untoucheds: !toucheds,
|
|
35
36
|
valid,
|
|
36
|
-
value,
|
|
37
37
|
wrong: touched && !valid
|
|
38
38
|
};
|
|
39
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-group.hook.js","sourceRoot":"","sources":["../../src/form-group.hook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-group.hook.js","sourceRoot":"","sources":["../../src/form-group.hook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAUjC,MAAM,UAAU,YAAY,CAC1B,OAAgC,EAChC,eAAuC;IAEvC,MAAM,YAAY,GAAG,sBAAsB,CACzC,OAAO,EACP,eAAe,CAChB,CAAC;IAEF,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAEtE,MAAM,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC;IAElC,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3E,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,sBAAsB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,sBAAsB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEzD,SAAS,KAAK;QACZ,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC1C,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,QAAQ;QACR,KAAK;QACL,OAAO;QACP,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;QAChB,MAAM;QACN,OAAO,EAAE,CAAC,KAAK;QACf,QAAQ,EAAE,CAAC,KAAK;QAChB,SAAS,EAAE,CAAC,OAAO;QACnB,KAAK;QACL,aAAa;QACb,KAAK;QACL,OAAO;QACP,QAAQ;QACR,SAAS,EAAE,CAAC,OAAO;QACnB,UAAU,EAAE,CAAC,QAAQ;QACrB,KAAK;QACL,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormControlOptions } from '@rolster/forms';
|
|
2
2
|
import { ValidatorFn } from '@rolster/validators';
|
|
3
3
|
import { ReactInputControl } from './types';
|
|
4
|
-
interface
|
|
5
|
-
setValue: (
|
|
4
|
+
interface ReactRefOptions<T = any> extends FormControlOptions<T> {
|
|
5
|
+
setValue: (control: ReactInputControl<T>, value: string) => void;
|
|
6
6
|
touched?: boolean;
|
|
7
7
|
}
|
|
8
|
-
type
|
|
9
|
-
type
|
|
10
|
-
type
|
|
8
|
+
type InputRefOptions<T = any> = Omit<ReactRefOptions<T>, 'setValue'>;
|
|
9
|
+
type TextRefOptions = InputRefOptions<string>;
|
|
10
|
+
type NumberRefOptions = InputRefOptions<number>;
|
|
11
11
|
export declare function useTextRefControl(): ReactInputControl<string>;
|
|
12
|
-
export declare function useTextRefControl(
|
|
13
|
-
export declare function useTextRefControl(state:
|
|
12
|
+
export declare function useTextRefControl(options: TextRefOptions): ReactInputControl<string>;
|
|
13
|
+
export declare function useTextRefControl(state: string, validators?: ValidatorFn<string>[]): ReactInputControl<string>;
|
|
14
14
|
export declare function useNumberRefControl(): ReactInputControl<number>;
|
|
15
|
-
export declare function useNumberRefControl(
|
|
16
|
-
export declare function useNumberRefControl(state:
|
|
15
|
+
export declare function useNumberRefControl(options: NumberRefOptions): ReactInputControl<number>;
|
|
16
|
+
export declare function useNumberRefControl(state: number, validators?: ValidatorFn<number>[]): ReactInputControl<number>;
|
|
17
17
|
export {};
|
|
@@ -1,36 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createFormControlOptions } from '@rolster/forms/arguments';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import { useInputControl } from './form-control.hook';
|
|
4
|
-
function useInputRefControl(
|
|
5
|
-
const { setValue, state, validators } =
|
|
6
|
-
const
|
|
4
|
+
function useInputRefControl(options) {
|
|
5
|
+
const { setValue, state, validators } = options;
|
|
6
|
+
const control = useInputControl(state, validators);
|
|
7
7
|
useEffect(() => {
|
|
8
|
-
const { elementRef } =
|
|
8
|
+
const { elementRef } = control;
|
|
9
9
|
elementRef?.current?.addEventListener('focus', () => {
|
|
10
|
-
|
|
10
|
+
control.focus();
|
|
11
11
|
});
|
|
12
12
|
elementRef?.current?.addEventListener('blur', () => {
|
|
13
|
-
|
|
14
|
-
if (!
|
|
15
|
-
|
|
13
|
+
control.blur();
|
|
14
|
+
if (!control.touched) {
|
|
15
|
+
control.touch();
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
elementRef?.current?.addEventListener('change', ({ target }) => {
|
|
19
|
-
setValue(
|
|
19
|
+
setValue(control, target.value);
|
|
20
20
|
});
|
|
21
21
|
}, []);
|
|
22
|
-
return
|
|
22
|
+
return control;
|
|
23
23
|
}
|
|
24
|
-
export function useTextRefControl(
|
|
24
|
+
export function useTextRefControl(options, validators) {
|
|
25
25
|
return useInputRefControl({
|
|
26
|
-
...
|
|
27
|
-
setValue: (
|
|
26
|
+
...createFormControlOptions(options, validators),
|
|
27
|
+
setValue: (control, value) => {
|
|
28
|
+
control.setState(value);
|
|
29
|
+
}
|
|
28
30
|
});
|
|
29
31
|
}
|
|
30
|
-
export function useNumberRefControl(
|
|
32
|
+
export function useNumberRefControl(options, validators) {
|
|
31
33
|
return useInputRefControl({
|
|
32
|
-
...
|
|
33
|
-
setValue: (
|
|
34
|
+
...createFormControlOptions(options, validators),
|
|
35
|
+
setValue: (control, value) => {
|
|
36
|
+
control.setState(+value);
|
|
37
|
+
}
|
|
34
38
|
});
|
|
35
39
|
}
|
|
36
40
|
//# sourceMappingURL=form-ref.hook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-ref.hook.js","sourceRoot":"","sources":["../../src/form-ref.hook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-ref.hook.js","sourceRoot":"","sources":["../../src/form-ref.hook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAYtD,SAAS,kBAAkB,CAAU,OAA2B;IAC9D,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAEhD,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAEnD,SAAS,CAA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
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { useFormArray, useFormArrayControl, useFormArrayGroup, useInputArrayControl, useReactArrayControl } from './form-array';
|
|
2
2
|
export { useFormControl, useInputControl, useReactControl } from './form-control.hook';
|
|
3
3
|
export { useFormGroup } from './form-group.hook';
|
|
4
|
-
export
|
|
5
|
-
export { ReactArrayControl, ReactArrayControls, ReactArrayGroup, ReactArrayHtmlControl, ReactArrayInputControl, ReactControl, ReactControls, ReactFormArray, ReactFormControl, ReactGroup, ReactHtmlControl, ReactInputControl } from './types';
|
|
4
|
+
export * from './types';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { useFormArray, useFormArrayControl, useFormArrayGroup, useInputArrayControl, useReactArrayControl } from './form-array';
|
|
2
2
|
export { useFormControl, useInputControl, useReactControl } from './form-control.hook';
|
|
3
3
|
export { useFormGroup } from './form-group.hook';
|
|
4
|
-
export
|
|
4
|
+
export * from './types';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,cAAc,EACd,eAAe,EACf,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,cAAc,SAAS,CAAC"}
|