@rolster/react-forms 18.0.6 → 18.0.8
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 +26 -16
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +25 -17
- package/dist/es/index.js.map +1 -1
- package/dist/esm/form-array.hook.d.ts +12 -10
- package/dist/esm/form-array.hook.js +22 -15
- package/dist/esm/form-array.hook.js.map +1 -1
- package/dist/esm/form-control.hook.js +2 -1
- package/dist/esm/form-control.hook.js.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -127,7 +127,7 @@ class RolsterArrayControl {
|
|
|
127
127
|
this.update({ state: this.initialState });
|
|
128
128
|
}
|
|
129
129
|
update(changes) {
|
|
130
|
-
this.group?.parent?.
|
|
130
|
+
this.group?.parent?.refreshControl(this, {
|
|
131
131
|
...changes,
|
|
132
132
|
initialState: this.initialState
|
|
133
133
|
});
|
|
@@ -147,21 +147,27 @@ class RolsterArrayGroup {
|
|
|
147
147
|
this.errors.length === 0 && controlsAllChecked(controls, 'valid');
|
|
148
148
|
this.invalid = !this.valid;
|
|
149
149
|
this.touched = controlsPartialChecked(controls, 'touched');
|
|
150
|
-
this.untouched = !this.touched;
|
|
151
150
|
this.toucheds = controlsAllChecked(controls, 'touched');
|
|
152
|
-
this.untoucheds = !this.toucheds;
|
|
153
151
|
this.dirty = controlsPartialChecked(controls, 'dirty');
|
|
154
|
-
this.pristine = !this.dirty;
|
|
155
152
|
this.dirties = controlsAllChecked(controls, 'dirty');
|
|
153
|
+
this.untouched = !this.touched;
|
|
154
|
+
this.untoucheds = !this.toucheds;
|
|
155
|
+
this.pristine = !this.dirty;
|
|
156
156
|
this.pristines = !this.dirties;
|
|
157
157
|
this.wrong = this.touched && this.invalid;
|
|
158
158
|
this.state = controlsToState(controls);
|
|
159
159
|
this.value = controlsToValue(controls);
|
|
160
160
|
}
|
|
161
161
|
setValidators(validators) {
|
|
162
|
-
this.parent?.
|
|
162
|
+
this.parent?.refreshGroup(this, { validators });
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
+
function cloneFormArrayControl(control, changes) {
|
|
166
|
+
return new RolsterArrayControl({ ...control, ...changes });
|
|
167
|
+
}
|
|
168
|
+
function cloneFormArrayGroup(group, changes) {
|
|
169
|
+
return new RolsterArrayGroup({ ...group, ...changes });
|
|
170
|
+
}
|
|
165
171
|
function useFormArrayControl(props) {
|
|
166
172
|
return new RolsterArrayControl({
|
|
167
173
|
...props,
|
|
@@ -179,8 +185,8 @@ function useInputArrayControl(props) {
|
|
|
179
185
|
function useFormArrayGroup(props) {
|
|
180
186
|
return new RolsterArrayGroup({ ...props, uuid: uuid.v4() });
|
|
181
187
|
}
|
|
182
|
-
function
|
|
183
|
-
const newControl =
|
|
188
|
+
function cloneFormControlForArrayGroup(group, control, changes) {
|
|
189
|
+
const newControl = cloneFormArrayControl(control, changes);
|
|
184
190
|
const { uuid } = newControl;
|
|
185
191
|
const controls = Object.entries(group.controls).reduce((controls, [key, control]) => {
|
|
186
192
|
controls[key] = control.uuid === uuid ? newControl : control;
|
|
@@ -214,16 +220,17 @@ function useFormArray(props) {
|
|
|
214
220
|
function set(groups) {
|
|
215
221
|
setGroups(groups);
|
|
216
222
|
}
|
|
217
|
-
function
|
|
218
|
-
const newGroup = new RolsterArrayGroup({ ...group, ...changes });
|
|
219
|
-
setGroups(groups.map((currentGroup) => currentGroup.uuid === group.uuid ? newGroup : currentGroup));
|
|
220
|
-
}
|
|
221
|
-
function updateControl(control, changes) {
|
|
223
|
+
function refreshControl(control, changes) {
|
|
222
224
|
if (control.group) {
|
|
223
|
-
const group =
|
|
225
|
+
const group = cloneFormControlForArrayGroup(control.group, control, changes);
|
|
224
226
|
setGroups(groups.map((currentGroup) => currentGroup.uuid === group.uuid ? group : currentGroup));
|
|
225
227
|
}
|
|
226
228
|
}
|
|
229
|
+
function refreshGroup(group, changes) {
|
|
230
|
+
const newGroup = cloneFormArrayGroup(group, changes);
|
|
231
|
+
const { uuid } = newGroup;
|
|
232
|
+
setGroups(groups.map((currentGroup) => currentGroup.uuid === uuid ? newGroup : currentGroup));
|
|
233
|
+
}
|
|
227
234
|
function remove(group) {
|
|
228
235
|
setGroups(groups.filter(({ uuid }) => group.uuid !== uuid));
|
|
229
236
|
}
|
|
@@ -242,6 +249,8 @@ function useFormArray(props) {
|
|
|
242
249
|
pristine: !dirty,
|
|
243
250
|
pristines: !dirties,
|
|
244
251
|
push,
|
|
252
|
+
refreshControl,
|
|
253
|
+
refreshGroup,
|
|
245
254
|
remove,
|
|
246
255
|
reset,
|
|
247
256
|
set,
|
|
@@ -251,8 +260,6 @@ function useFormArray(props) {
|
|
|
251
260
|
toucheds,
|
|
252
261
|
untouched: !touched,
|
|
253
262
|
untoucheds: !toucheds,
|
|
254
|
-
updateControl,
|
|
255
|
-
updateGroup,
|
|
256
263
|
valid,
|
|
257
264
|
value: state,
|
|
258
265
|
wrong: touched && !valid
|
|
@@ -309,7 +316,8 @@ function useReactControl(props = {}) {
|
|
|
309
316
|
setCurrentState(initialValue);
|
|
310
317
|
}
|
|
311
318
|
function subscribe(subscriber) {
|
|
312
|
-
|
|
319
|
+
const subscription = subscribers.subscribe(subscriber);
|
|
320
|
+
return () => subscription.unsubscribe();
|
|
313
321
|
}
|
|
314
322
|
return {
|
|
315
323
|
blur,
|
|
@@ -383,6 +391,8 @@ function useFormGroup(props) {
|
|
|
383
391
|
};
|
|
384
392
|
}
|
|
385
393
|
|
|
394
|
+
exports.cloneFormArrayControl = cloneFormArrayControl;
|
|
395
|
+
exports.cloneFormArrayGroup = cloneFormArrayGroup;
|
|
386
396
|
exports.useFormArray = useFormArray;
|
|
387
397
|
exports.useFormArrayControl = useFormArrayControl;
|
|
388
398
|
exports.useFormArrayGroup = useFormArrayGroup;
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../node_modules/@rolster/helpers-forms/dist/esm/helpers.js","../esm/form-array.hook.js","../esm/form-control.hook.js","../esm/form-group.hook.js"],"sourcesContent":["const FALSY_VALUE = ['false', 'undefined', '0', 0];\r\nconst toBoolean = (value) => {\r\n return !(!(typeof value !== 'undefined' && value !== null) ||\r\n value === false ||\r\n FALSY_VALUE.includes(value));\r\n};\r\nexport const controlIsValid = (props) => {\r\n const { state, validators } = props;\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, props) => {\r\n return Object.values(controls).reduce((value, control) => value && toBoolean(control[props]), true);\r\n};\r\nexport const controlsPartialChecked = (controls, props) => {\r\n return Object.values(controls).reduce((value, control) => value || toBoolean(control[props]), false);\r\n};\r\nexport const controlsToState = (controls) => {\r\n return Object.entries(controls).reduce((json, [key, { state }]) => {\r\n json[key] = state;\r\n return json;\r\n }, {});\r\n};\r\nexport const controlsToValue = (controls) => {\r\n return Object.entries(controls).reduce((json, [key, { value }]) => {\r\n json[key] = value;\r\n return json;\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 && toBoolean(group[key]), true);\r\n}\r\nexport function groupPartialChecked(groups, key) {\r\n return groups.reduce((value, group) => value || toBoolean(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 { arrayIsValid, controlIsValid, controlsAllChecked, controlsPartialChecked, controlsToState, controlsToValue, groupAllChecked, groupIsValid, groupPartialChecked } from '@rolster/helpers-forms/helpers';\r\nimport { useEffect, useState } from 'react';\r\nimport { v4 as uuid } from 'uuid';\r\nclass RolsterArrayControl {\r\n constructor(props) {\r\n const { uuid, focused, dirty, disabled, initialState, state, touched, validators } = props;\r\n this.uuid = uuid;\r\n this.focused = focused || false;\r\n this.unfocused = !this.focused;\r\n this.touched = touched || false;\r\n this.untouched = !this.touched;\r\n this.dirty = dirty || false;\r\n this.pristine = !this.dirty;\r\n this.disabled = disabled || false;\r\n this.enabled = !this.disabled;\r\n this.state = state;\r\n this.validators = validators;\r\n this.initialState = initialState;\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 this.value = state;\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 });\r\n }\r\n }\r\n touch() {\r\n if (!this.touched) {\r\n this.update({ touched: true });\r\n }\r\n }\r\n untouch() {\r\n if (this.touched) {\r\n this.update({ touched: false });\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 setState(state) {\r\n this.update({ state });\r\n }\r\n setValidators(validators) {\r\n this.update({ validators });\r\n }\r\n reset() {\r\n this.update({ state: this.initialState });\r\n }\r\n update(changes) {\r\n this.group?.parent?.updateControl(this, {\r\n ...changes,\r\n initialState: this.initialState\r\n });\r\n }\r\n}\r\nclass RolsterArrayGroup {\r\n constructor(props) {\r\n const { controls, resource, uuid, validators } = props;\r\n Object.values(controls).forEach((control) => (control.group = this));\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.touched = controlsPartialChecked(controls, 'touched');\r\n this.untouched = !this.touched;\r\n this.toucheds = controlsAllChecked(controls, 'touched');\r\n this.untoucheds = !this.toucheds;\r\n this.dirty = controlsPartialChecked(controls, 'dirty');\r\n this.pristine = !this.dirty;\r\n this.dirties = controlsAllChecked(controls, 'dirty');\r\n this.pristines = !this.dirties;\r\n this.wrong = this.touched && this.invalid;\r\n this.state = controlsToState(controls);\r\n this.value = controlsToValue(controls);\r\n }\r\n setValidators(validators) {\r\n this.parent?.updateGroup(this, { validators });\r\n }\r\n}\r\nexport function useFormArrayControl(props) {\r\n return new RolsterArrayControl({\r\n ...props,\r\n uuid: uuid(),\r\n initialState: props.state\r\n });\r\n}\r\nexport function useInputArrayControl(props) {\r\n return new RolsterArrayControl({\r\n ...props,\r\n uuid: uuid(),\r\n initialState: props.state\r\n });\r\n}\r\nexport function useFormArrayGroup(props) {\r\n return new RolsterArrayGroup({ ...props, uuid: uuid() });\r\n}\r\nfunction cloneFormArrayGroup(group, control, changes) {\r\n const newControl = new RolsterArrayControl({ ...control, ...changes });\r\n const { uuid } = newControl;\r\n const controls = Object.entries(group.controls).reduce((controls, [key, control]) => {\r\n controls[key] = control.uuid === uuid ? newControl : control;\r\n return controls;\r\n }, {});\r\n return new RolsterArrayGroup({ ...group, controls });\r\n}\r\nexport function useFormArray(props) {\r\n const [currentState] = useState(props.groups);\r\n const [state, setState] = useState([]);\r\n const [validators, setValidators] = useState(props.validators);\r\n const [controls, setControls] = useState([]);\r\n const [groups, setGroups] = useState(props.groups || []);\r\n useEffect(() => {\r\n setControls(groups.map(({ controls }) => controls));\r\n setState(groups.map(({ controls }) => controlsToState(controls)));\r\n }, [groups]);\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 touched = groupPartialChecked(groups, 'touched');\r\n const toucheds = groupAllChecked(groups, 'touched');\r\n const dirties = groupAllChecked(groups, 'dirty');\r\n const dirty = groupPartialChecked(groups, 'dirty');\r\n function push(group) {\r\n setGroups([...groups, group]);\r\n }\r\n function merge(newGroups) {\r\n setGroups([...groups, ...newGroups]);\r\n }\r\n function set(groups) {\r\n setGroups(groups);\r\n }\r\n function updateGroup(group, changes) {\r\n const newGroup = new RolsterArrayGroup({ ...group, ...changes });\r\n setGroups(groups.map((currentGroup) => currentGroup.uuid === group.uuid ? newGroup : currentGroup));\r\n }\r\n function updateControl(control, changes) {\r\n if (control.group) {\r\n const group = cloneFormArrayGroup(control.group, control, changes);\r\n setGroups(groups.map((currentGroup) => currentGroup.uuid === group.uuid ? group : currentGroup));\r\n }\r\n }\r\n function remove(group) {\r\n setGroups(groups.filter(({ uuid }) => group.uuid !== uuid));\r\n }\r\n function reset() {\r\n setGroups(currentState || []);\r\n }\r\n const formArray = {\r\n controls,\r\n dirty,\r\n dirties,\r\n error,\r\n errors,\r\n groups,\r\n invalid: !valid,\r\n merge,\r\n pristine: !dirty,\r\n pristines: !dirties,\r\n push,\r\n remove,\r\n reset,\r\n set,\r\n setValidators,\r\n state,\r\n touched,\r\n toucheds,\r\n untouched: !touched,\r\n untoucheds: !toucheds,\r\n updateControl,\r\n updateGroup,\r\n valid,\r\n value: state,\r\n wrong: touched && !valid\r\n };\r\n groups.forEach((group) => (group.parent = formArray));\r\n return formArray;\r\n}\r\n//# sourceMappingURL=form-array.hook.js.map","import { controlIsValid } from '@rolster/helpers-forms/helpers';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport { BehaviorSubject } from 'rxjs';\r\nexport function useReactControl(props = {}) {\r\n const [state, setCurrentState] = useState(props.state);\r\n const [value, setValue] = useState(props.state);\r\n const [touched, setTouched] = useState(props.touched || false);\r\n const [dirty, setDirty] = useState(false);\r\n const [focused, setFocused] = useState(false);\r\n const [disabled, setDisabled] = useState(false);\r\n const [initialValue] = useState(props.state);\r\n const [validators, setValidators] = useState(props.validators);\r\n const [subscribers] = useState(new BehaviorSubject(props.state));\r\n const elementRef = useRef(null);\r\n const errors = (() => validators ? controlIsValid({ state, validators }) : [])();\r\n const error = (() => errors[0])();\r\n const valid = (() => errors.length === 0)();\r\n useEffect(() => {\r\n if (state !== null && state !== undefined) {\r\n setValue(state);\r\n }\r\n subscribers.next(state);\r\n }, [state]);\r\n function focus() {\r\n setFocused(true);\r\n }\r\n function blur() {\r\n setFocused(false);\r\n }\r\n function disable() {\r\n setDisabled(true);\r\n }\r\n function enable() {\r\n setDisabled(false);\r\n }\r\n function touch() {\r\n setTouched(true);\r\n }\r\n function untouch() {\r\n setTouched(false);\r\n }\r\n function setState(state) {\r\n setDirty(true);\r\n setCurrentState(state);\r\n }\r\n function reset() {\r\n setTouched(false);\r\n setDirty(false);\r\n setCurrentState(initialValue);\r\n }\r\n function subscribe(subscriber) {\r\n return subscribers.subscribe(subscriber);\r\n }\r\n return {\r\n blur,\r\n dirty,\r\n disable,\r\n disabled,\r\n elementRef,\r\n enable,\r\n enabled: !disabled,\r\n error,\r\n errors,\r\n focus,\r\n focused,\r\n invalid: !valid,\r\n pristine: !dirty,\r\n reset,\r\n setState,\r\n setValidators,\r\n state,\r\n subscribe,\r\n touch,\r\n touched,\r\n unfocused: !focused,\r\n untouch,\r\n untouched: !touched,\r\n valid,\r\n value,\r\n wrong: touched && !valid\r\n };\r\n}\r\nexport function useFormControl(props = {}) {\r\n return useReactControl(props);\r\n}\r\nexport function useInputControl(props = {}) {\r\n return useReactControl(props);\r\n}\r\n//# sourceMappingURL=form-control.hook.js.map","import { controlsAllChecked, controlsPartialChecked, controlsToState, controlsToValue, groupIsValid } from '@rolster/helpers-forms/helpers';\r\nimport { useState } from 'react';\r\nexport function useFormGroup(props) {\r\n const [validators, setValidators] = useState(props.validators);\r\n const { controls } = props;\r\n const errors = (() => validators ? groupIsValid({ controls, validators }) : [])();\r\n const valid = (() => errors.length === 0 && controlsAllChecked(controls, 'valid'))();\r\n const touched = (() => controlsPartialChecked(controls, 'touched'))();\r\n const toucheds = (() => controlsAllChecked(controls, 'touched'))();\r\n const dirty = (() => controlsPartialChecked(controls, 'dirty'))();\r\n const dirties = (() => controlsAllChecked(controls, 'dirty'))();\r\n const state = (() => controlsToState(controls))();\r\n const value = (() => controlsToValue(controls))();\r\n function reset() {\r\n Object.values(controls).forEach((control) => control.reset());\r\n }\r\n return {\r\n controls,\r\n dirty,\r\n dirties,\r\n error: errors[0],\r\n errors,\r\n invalid: !valid,\r\n pristine: !dirty,\r\n pristines: !dirties,\r\n reset,\r\n state,\r\n setValidators,\r\n touched,\r\n toucheds,\r\n untouched: !touched,\r\n untoucheds: !toucheds,\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","useState","useEffect","BehaviorSubject","useRef"],"mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AACnD,MAAM,SAAS,GAAG,CAAC,KAAK,KAAK;AAC7B,IAAI,OAAO,EAAE,EAAE,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,CAAC;AAC9D,QAAQ,KAAK,KAAK,KAAK;AACvB,QAAQ,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC;AACK,MAAM,cAAc,GAAG,CAAC,KAAK,KAAK;AACzC,IAAI,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;AACxC,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,SAAS,KAAK;AACpD,QAAQ,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AACvC,QAAQ,IAAI,KAAK,EAAE;AACnB,YAAY,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/B,SAAS;AACT,QAAQ,OAAO,MAAM,CAAC;AACtB,KAAK,EA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ourcesContent":["const FALSY_VALUE = ['false', 'undefined', '0', 0];\r\nconst toBoolean = (value) => {\r\n return !(!(typeof value !== 'undefined' && value !== null) ||\r\n value === false ||\r\n FALSY_VALUE.includes(value));\r\n};\r\nexport const controlIsValid = (props) => {\r\n const { state, validators } = props;\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, props) => {\r\n return Object.values(controls).reduce((value, control) => value && toBoolean(control[props]), true);\r\n};\r\nexport const controlsPartialChecked = (controls, props) => {\r\n return Object.values(controls).reduce((value, control) => value || toBoolean(control[props]), false);\r\n};\r\nexport const controlsToState = (controls) => {\r\n return Object.entries(controls).reduce((json, [key, { state }]) => {\r\n json[key] = state;\r\n return json;\r\n }, {});\r\n};\r\nexport const controlsToValue = (controls) => {\r\n return Object.entries(controls).reduce((json, [key, { value }]) => {\r\n json[key] = value;\r\n return json;\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 && toBoolean(group[key]), true);\r\n}\r\nexport function groupPartialChecked(groups, key) {\r\n return groups.reduce((value, group) => value || toBoolean(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 { arrayIsValid, controlIsValid, controlsAllChecked, controlsPartialChecked, controlsToState, controlsToValue, groupAllChecked, groupIsValid, groupPartialChecked } from '@rolster/helpers-forms/helpers';\r\nimport { useEffect, useState } from 'react';\r\nimport { v4 as uuid } from 'uuid';\r\nclass RolsterArrayControl {\r\n constructor(props) {\r\n const { uuid, focused, dirty, disabled, initialState, state, touched, validators } = props;\r\n this.uuid = uuid;\r\n this.focused = focused || false;\r\n this.unfocused = !this.focused;\r\n this.touched = touched || false;\r\n this.untouched = !this.touched;\r\n this.dirty = dirty || false;\r\n this.pristine = !this.dirty;\r\n this.disabled = disabled || false;\r\n this.enabled = !this.disabled;\r\n this.state = state;\r\n this.validators = validators;\r\n this.initialState = initialState;\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 this.value = state;\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 });\r\n }\r\n }\r\n touch() {\r\n if (!this.touched) {\r\n this.update({ touched: true });\r\n }\r\n }\r\n untouch() {\r\n if (this.touched) {\r\n this.update({ touched: false });\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 setState(state) {\r\n this.update({ state });\r\n }\r\n setValidators(validators) {\r\n this.update({ validators });\r\n }\r\n reset() {\r\n this.update({ state: this.initialState });\r\n }\r\n update(changes) {\r\n this.group?.parent?.refreshControl(this, {\r\n ...changes,\r\n initialState: this.initialState\r\n });\r\n }\r\n}\r\nclass RolsterArrayGroup {\r\n constructor(props) {\r\n const { controls, resource, uuid, validators } = props;\r\n Object.values(controls).forEach((control) => (control.group = this));\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.touched = controlsPartialChecked(controls, 'touched');\r\n this.toucheds = controlsAllChecked(controls, 'touched');\r\n this.dirty = controlsPartialChecked(controls, 'dirty');\r\n this.dirties = controlsAllChecked(controls, 'dirty');\r\n this.untouched = !this.touched;\r\n this.untoucheds = !this.toucheds;\r\n this.pristine = !this.dirty;\r\n this.pristines = !this.dirties;\r\n this.wrong = this.touched && this.invalid;\r\n this.state = controlsToState(controls);\r\n this.value = controlsToValue(controls);\r\n }\r\n setValidators(validators) {\r\n this.parent?.refreshGroup(this, { validators });\r\n }\r\n}\r\nexport function cloneFormArrayControl(control, changes) {\r\n return new RolsterArrayControl({ ...control, ...changes });\r\n}\r\nexport function cloneFormArrayGroup(group, changes) {\r\n return new RolsterArrayGroup({ ...group, ...changes });\r\n}\r\nexport function useFormArrayControl(props) {\r\n return new RolsterArrayControl({\r\n ...props,\r\n uuid: uuid(),\r\n initialState: props.state\r\n });\r\n}\r\nexport function useInputArrayControl(props) {\r\n return new RolsterArrayControl({\r\n ...props,\r\n uuid: uuid(),\r\n initialState: props.state\r\n });\r\n}\r\nexport function useFormArrayGroup(props) {\r\n return new RolsterArrayGroup({ ...props, uuid: uuid() });\r\n}\r\nfunction cloneFormControlForArrayGroup(group, control, changes) {\r\n const newControl = cloneFormArrayControl(control, changes);\r\n const { uuid } = newControl;\r\n const controls = Object.entries(group.controls).reduce((controls, [key, control]) => {\r\n controls[key] = control.uuid === uuid ? newControl : control;\r\n return controls;\r\n }, {});\r\n return new RolsterArrayGroup({ ...group, controls });\r\n}\r\nexport function useFormArray(props) {\r\n const [currentState] = useState(props.groups);\r\n const [state, setState] = useState([]);\r\n const [validators, setValidators] = useState(props.validators);\r\n const [controls, setControls] = useState([]);\r\n const [groups, setGroups] = useState(props.groups || []);\r\n useEffect(() => {\r\n setControls(groups.map(({ controls }) => controls));\r\n setState(groups.map(({ controls }) => controlsToState(controls)));\r\n }, [groups]);\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 touched = groupPartialChecked(groups, 'touched');\r\n const toucheds = groupAllChecked(groups, 'touched');\r\n const dirties = groupAllChecked(groups, 'dirty');\r\n const dirty = groupPartialChecked(groups, 'dirty');\r\n function push(group) {\r\n setGroups([...groups, group]);\r\n }\r\n function merge(newGroups) {\r\n setGroups([...groups, ...newGroups]);\r\n }\r\n function set(groups) {\r\n setGroups(groups);\r\n }\r\n function refreshControl(control, changes) {\r\n if (control.group) {\r\n const group = cloneFormControlForArrayGroup(control.group, control, changes);\r\n setGroups(groups.map((currentGroup) => currentGroup.uuid === group.uuid ? group : currentGroup));\r\n }\r\n }\r\n function refreshGroup(group, changes) {\r\n const newGroup = cloneFormArrayGroup(group, changes);\r\n const { uuid } = newGroup;\r\n setGroups(groups.map((currentGroup) => currentGroup.uuid === uuid ? newGroup : currentGroup));\r\n }\r\n function remove(group) {\r\n setGroups(groups.filter(({ uuid }) => group.uuid !== uuid));\r\n }\r\n function reset() {\r\n setGroups(currentState || []);\r\n }\r\n const formArray = {\r\n controls,\r\n dirty,\r\n dirties,\r\n error,\r\n errors,\r\n groups,\r\n invalid: !valid,\r\n merge,\r\n pristine: !dirty,\r\n pristines: !dirties,\r\n push,\r\n refreshControl,\r\n refreshGroup,\r\n remove,\r\n reset,\r\n set,\r\n setValidators,\r\n state,\r\n touched,\r\n toucheds,\r\n untouched: !touched,\r\n untoucheds: !toucheds,\r\n valid,\r\n value: state,\r\n wrong: touched && !valid\r\n };\r\n groups.forEach((group) => (group.parent = formArray));\r\n return formArray;\r\n}\r\n//# sourceMappingURL=form-array.hook.js.map","import { controlIsValid } from '@rolster/helpers-forms/helpers';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport { BehaviorSubject } from 'rxjs';\r\nexport function useReactControl(props = {}) {\r\n const [state, setCurrentState] = useState(props.state);\r\n const [value, setValue] = useState(props.state);\r\n const [touched, setTouched] = useState(props.touched || false);\r\n const [dirty, setDirty] = useState(false);\r\n const [focused, setFocused] = useState(false);\r\n const [disabled, setDisabled] = useState(false);\r\n const [initialValue] = useState(props.state);\r\n const [validators, setValidators] = useState(props.validators);\r\n const [subscribers] = useState(new BehaviorSubject(props.state));\r\n const elementRef = useRef(null);\r\n const errors = (() => validators ? controlIsValid({ state, validators }) : [])();\r\n const error = (() => errors[0])();\r\n const valid = (() => errors.length === 0)();\r\n useEffect(() => {\r\n if (state !== null && state !== undefined) {\r\n setValue(state);\r\n }\r\n subscribers.next(state);\r\n }, [state]);\r\n function focus() {\r\n setFocused(true);\r\n }\r\n function blur() {\r\n setFocused(false);\r\n }\r\n function disable() {\r\n setDisabled(true);\r\n }\r\n function enable() {\r\n setDisabled(false);\r\n }\r\n function touch() {\r\n setTouched(true);\r\n }\r\n function untouch() {\r\n setTouched(false);\r\n }\r\n function setState(state) {\r\n setDirty(true);\r\n setCurrentState(state);\r\n }\r\n function reset() {\r\n setTouched(false);\r\n setDirty(false);\r\n setCurrentState(initialValue);\r\n }\r\n function subscribe(subscriber) {\r\n const subscription = subscribers.subscribe(subscriber);\r\n return () => subscription.unsubscribe();\r\n }\r\n return {\r\n blur,\r\n dirty,\r\n disable,\r\n disabled,\r\n elementRef,\r\n enable,\r\n enabled: !disabled,\r\n error,\r\n errors,\r\n focus,\r\n focused,\r\n invalid: !valid,\r\n pristine: !dirty,\r\n reset,\r\n setState,\r\n setValidators,\r\n state,\r\n subscribe,\r\n touch,\r\n touched,\r\n unfocused: !focused,\r\n untouch,\r\n untouched: !touched,\r\n valid,\r\n value,\r\n wrong: touched && !valid\r\n };\r\n}\r\nexport function useFormControl(props = {}) {\r\n return useReactControl(props);\r\n}\r\nexport function useInputControl(props = {}) {\r\n return useReactControl(props);\r\n}\r\n//# sourceMappingURL=form-control.hook.js.map","import { controlsAllChecked, controlsPartialChecked, controlsToState, controlsToValue, groupIsValid } from '@rolster/helpers-forms/helpers';\r\nimport { useState } from 'react';\r\nexport function useFormGroup(props) {\r\n const [validators, setValidators] = useState(props.validators);\r\n const { controls } = props;\r\n const errors = (() => validators ? groupIsValid({ controls, validators }) : [])();\r\n const valid = (() => errors.length === 0 && controlsAllChecked(controls, 'valid'))();\r\n const touched = (() => controlsPartialChecked(controls, 'touched'))();\r\n const toucheds = (() => controlsAllChecked(controls, 'touched'))();\r\n const dirty = (() => controlsPartialChecked(controls, 'dirty'))();\r\n const dirties = (() => controlsAllChecked(controls, 'dirty'))();\r\n const state = (() => controlsToState(controls))();\r\n const value = (() => controlsToValue(controls))();\r\n function reset() {\r\n Object.values(controls).forEach((control) => control.reset());\r\n }\r\n return {\r\n controls,\r\n dirty,\r\n dirties,\r\n error: errors[0],\r\n errors,\r\n invalid: !valid,\r\n pristine: !dirty,\r\n pristines: !dirties,\r\n reset,\r\n state,\r\n setValidators,\r\n touched,\r\n toucheds,\r\n untouched: !touched,\r\n untoucheds: !toucheds,\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","useState","useEffect","BehaviorSubject","useRef"],"mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AACnD,MAAM,SAAS,GAAG,CAAC,KAAK,KAAK;AAC7B,IAAI,OAAO,EAAE,EAAE,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,CAAC;AAC9D,QAAQ,KAAK,KAAK,KAAK;AACvB,QAAQ,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC;AACK,MAAM,cAAc,GAAG,CAAC,KAAK,KAAK;AACzC,IAAI,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;AACxC,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,SAAS,KAAK;AACpD,QAAQ,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AACvC,QAAQ,IAAI,KAAK,EAAE;AACn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AAE,CAAC,KAAK;AACxB,QAAQ,SAAS,EAAE,CAAC,OAAO;AAC3B,QAAQ,KAAK;AACb,QAAQ,KAAK;AACb,QAAQ,aAAa;AACrB,QAAQ,OAAO;AACf,QAAQ,QAAQ;AAChB,QAAQ,SAAS,EAAE,CAAC,OAAO;AAC3B,QAAQ,UAAU,EAAE,CAAC,QAAQ;AAC7B,QAAQ,KAAK;AACb,QAAQ,KAAK;AACb,QAAQ,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK;AAChC,KAAK,CAAC;AACN;;;;;;;;;;;;;"}
|
package/dist/es/index.js
CHANGED
|
@@ -123,7 +123,7 @@ class RolsterArrayControl {
|
|
|
123
123
|
this.update({ state: this.initialState });
|
|
124
124
|
}
|
|
125
125
|
update(changes) {
|
|
126
|
-
this.group?.parent?.
|
|
126
|
+
this.group?.parent?.refreshControl(this, {
|
|
127
127
|
...changes,
|
|
128
128
|
initialState: this.initialState
|
|
129
129
|
});
|
|
@@ -143,21 +143,27 @@ class RolsterArrayGroup {
|
|
|
143
143
|
this.errors.length === 0 && controlsAllChecked(controls, 'valid');
|
|
144
144
|
this.invalid = !this.valid;
|
|
145
145
|
this.touched = controlsPartialChecked(controls, 'touched');
|
|
146
|
-
this.untouched = !this.touched;
|
|
147
146
|
this.toucheds = controlsAllChecked(controls, 'touched');
|
|
148
|
-
this.untoucheds = !this.toucheds;
|
|
149
147
|
this.dirty = controlsPartialChecked(controls, 'dirty');
|
|
150
|
-
this.pristine = !this.dirty;
|
|
151
148
|
this.dirties = controlsAllChecked(controls, 'dirty');
|
|
149
|
+
this.untouched = !this.touched;
|
|
150
|
+
this.untoucheds = !this.toucheds;
|
|
151
|
+
this.pristine = !this.dirty;
|
|
152
152
|
this.pristines = !this.dirties;
|
|
153
153
|
this.wrong = this.touched && this.invalid;
|
|
154
154
|
this.state = controlsToState(controls);
|
|
155
155
|
this.value = controlsToValue(controls);
|
|
156
156
|
}
|
|
157
157
|
setValidators(validators) {
|
|
158
|
-
this.parent?.
|
|
158
|
+
this.parent?.refreshGroup(this, { validators });
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
+
function cloneFormArrayControl(control, changes) {
|
|
162
|
+
return new RolsterArrayControl({ ...control, ...changes });
|
|
163
|
+
}
|
|
164
|
+
function cloneFormArrayGroup(group, changes) {
|
|
165
|
+
return new RolsterArrayGroup({ ...group, ...changes });
|
|
166
|
+
}
|
|
161
167
|
function useFormArrayControl(props) {
|
|
162
168
|
return new RolsterArrayControl({
|
|
163
169
|
...props,
|
|
@@ -175,8 +181,8 @@ function useInputArrayControl(props) {
|
|
|
175
181
|
function useFormArrayGroup(props) {
|
|
176
182
|
return new RolsterArrayGroup({ ...props, uuid: v4() });
|
|
177
183
|
}
|
|
178
|
-
function
|
|
179
|
-
const newControl =
|
|
184
|
+
function cloneFormControlForArrayGroup(group, control, changes) {
|
|
185
|
+
const newControl = cloneFormArrayControl(control, changes);
|
|
180
186
|
const { uuid } = newControl;
|
|
181
187
|
const controls = Object.entries(group.controls).reduce((controls, [key, control]) => {
|
|
182
188
|
controls[key] = control.uuid === uuid ? newControl : control;
|
|
@@ -210,16 +216,17 @@ function useFormArray(props) {
|
|
|
210
216
|
function set(groups) {
|
|
211
217
|
setGroups(groups);
|
|
212
218
|
}
|
|
213
|
-
function
|
|
214
|
-
const newGroup = new RolsterArrayGroup({ ...group, ...changes });
|
|
215
|
-
setGroups(groups.map((currentGroup) => currentGroup.uuid === group.uuid ? newGroup : currentGroup));
|
|
216
|
-
}
|
|
217
|
-
function updateControl(control, changes) {
|
|
219
|
+
function refreshControl(control, changes) {
|
|
218
220
|
if (control.group) {
|
|
219
|
-
const group =
|
|
221
|
+
const group = cloneFormControlForArrayGroup(control.group, control, changes);
|
|
220
222
|
setGroups(groups.map((currentGroup) => currentGroup.uuid === group.uuid ? group : currentGroup));
|
|
221
223
|
}
|
|
222
224
|
}
|
|
225
|
+
function refreshGroup(group, changes) {
|
|
226
|
+
const newGroup = cloneFormArrayGroup(group, changes);
|
|
227
|
+
const { uuid } = newGroup;
|
|
228
|
+
setGroups(groups.map((currentGroup) => currentGroup.uuid === uuid ? newGroup : currentGroup));
|
|
229
|
+
}
|
|
223
230
|
function remove(group) {
|
|
224
231
|
setGroups(groups.filter(({ uuid }) => group.uuid !== uuid));
|
|
225
232
|
}
|
|
@@ -238,6 +245,8 @@ function useFormArray(props) {
|
|
|
238
245
|
pristine: !dirty,
|
|
239
246
|
pristines: !dirties,
|
|
240
247
|
push,
|
|
248
|
+
refreshControl,
|
|
249
|
+
refreshGroup,
|
|
241
250
|
remove,
|
|
242
251
|
reset,
|
|
243
252
|
set,
|
|
@@ -247,8 +256,6 @@ function useFormArray(props) {
|
|
|
247
256
|
toucheds,
|
|
248
257
|
untouched: !touched,
|
|
249
258
|
untoucheds: !toucheds,
|
|
250
|
-
updateControl,
|
|
251
|
-
updateGroup,
|
|
252
259
|
valid,
|
|
253
260
|
value: state,
|
|
254
261
|
wrong: touched && !valid
|
|
@@ -305,7 +312,8 @@ function useReactControl(props = {}) {
|
|
|
305
312
|
setCurrentState(initialValue);
|
|
306
313
|
}
|
|
307
314
|
function subscribe(subscriber) {
|
|
308
|
-
|
|
315
|
+
const subscription = subscribers.subscribe(subscriber);
|
|
316
|
+
return () => subscription.unsubscribe();
|
|
309
317
|
}
|
|
310
318
|
return {
|
|
311
319
|
blur,
|
|
@@ -379,5 +387,5 @@ function useFormGroup(props) {
|
|
|
379
387
|
};
|
|
380
388
|
}
|
|
381
389
|
|
|
382
|
-
export { useFormArray, useFormArrayControl, useFormArrayGroup, useFormControl, useFormGroup, useInputArrayControl, useInputControl, useReactControl };
|
|
390
|
+
export { cloneFormArrayControl, cloneFormArrayGroup, useFormArray, useFormArrayControl, useFormArrayGroup, useFormControl, useFormGroup, useInputArrayControl, useInputControl, useReactControl };
|
|
383
391
|
//# sourceMappingURL=index.js.map
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../node_modules/@rolster/helpers-forms/dist/esm/helpers.js","../esm/form-array.hook.js","../esm/form-control.hook.js","../esm/form-group.hook.js"],"sourcesContent":["const FALSY_VALUE = ['false', 'undefined', '0', 0];\r\nconst toBoolean = (value) => {\r\n return !(!(typeof value !== 'undefined' && value !== null) ||\r\n value === false ||\r\n FALSY_VALUE.includes(value));\r\n};\r\nexport const controlIsValid = (props) => {\r\n const { state, validators } = props;\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, props) => {\r\n return Object.values(controls).reduce((value, control) => value && toBoolean(control[props]), true);\r\n};\r\nexport const controlsPartialChecked = (controls, props) => {\r\n return Object.values(controls).reduce((value, control) => value || toBoolean(control[props]), false);\r\n};\r\nexport const controlsToState = (controls) => {\r\n return Object.entries(controls).reduce((json, [key, { state }]) => {\r\n json[key] = state;\r\n return json;\r\n }, {});\r\n};\r\nexport const controlsToValue = (controls) => {\r\n return Object.entries(controls).reduce((json, [key, { value }]) => {\r\n json[key] = value;\r\n return json;\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 && toBoolean(group[key]), true);\r\n}\r\nexport function groupPartialChecked(groups, key) {\r\n return groups.reduce((value, group) => value || toBoolean(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 { arrayIsValid, controlIsValid, controlsAllChecked, controlsPartialChecked, controlsToState, controlsToValue, groupAllChecked, groupIsValid, groupPartialChecked } from '@rolster/helpers-forms/helpers';\r\nimport { useEffect, useState } from 'react';\r\nimport { v4 as uuid } from 'uuid';\r\nclass RolsterArrayControl {\r\n constructor(props) {\r\n const { uuid, focused, dirty, disabled, initialState, state, touched, validators } = props;\r\n this.uuid = uuid;\r\n this.focused = focused || false;\r\n this.unfocused = !this.focused;\r\n this.touched = touched || false;\r\n this.untouched = !this.touched;\r\n this.dirty = dirty || false;\r\n this.pristine = !this.dirty;\r\n this.disabled = disabled || false;\r\n this.enabled = !this.disabled;\r\n this.state = state;\r\n this.validators = validators;\r\n this.initialState = initialState;\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 this.value = state;\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 });\r\n }\r\n }\r\n touch() {\r\n if (!this.touched) {\r\n this.update({ touched: true });\r\n }\r\n }\r\n untouch() {\r\n if (this.touched) {\r\n this.update({ touched: false });\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 setState(state) {\r\n this.update({ state });\r\n }\r\n setValidators(validators) {\r\n this.update({ validators });\r\n }\r\n reset() {\r\n this.update({ state: this.initialState });\r\n }\r\n update(changes) {\r\n this.group?.parent?.updateControl(this, {\r\n ...changes,\r\n initialState: this.initialState\r\n });\r\n }\r\n}\r\nclass RolsterArrayGroup {\r\n constructor(props) {\r\n const { controls, resource, uuid, validators } = props;\r\n Object.values(controls).forEach((control) => (control.group = this));\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.touched = controlsPartialChecked(controls, 'touched');\r\n this.untouched = !this.touched;\r\n this.toucheds = controlsAllChecked(controls, 'touched');\r\n this.untoucheds = !this.toucheds;\r\n this.dirty = controlsPartialChecked(controls, 'dirty');\r\n this.pristine = !this.dirty;\r\n this.dirties = controlsAllChecked(controls, 'dirty');\r\n this.pristines = !this.dirties;\r\n this.wrong = this.touched && this.invalid;\r\n this.state = controlsToState(controls);\r\n this.value = controlsToValue(controls);\r\n }\r\n setValidators(validators) {\r\n this.parent?.updateGroup(this, { validators });\r\n }\r\n}\r\nexport function useFormArrayControl(props) {\r\n return new RolsterArrayControl({\r\n ...props,\r\n uuid: uuid(),\r\n initialState: props.state\r\n });\r\n}\r\nexport function useInputArrayControl(props) {\r\n return new RolsterArrayControl({\r\n ...props,\r\n uuid: uuid(),\r\n initialState: props.state\r\n });\r\n}\r\nexport function useFormArrayGroup(props) {\r\n return new RolsterArrayGroup({ ...props, uuid: uuid() });\r\n}\r\nfunction cloneFormArrayGroup(group, control, changes) {\r\n const newControl = new RolsterArrayControl({ ...control, ...changes });\r\n const { uuid } = newControl;\r\n const controls = Object.entries(group.controls).reduce((controls, [key, control]) => {\r\n controls[key] = control.uuid === uuid ? newControl : control;\r\n return controls;\r\n }, {});\r\n return new RolsterArrayGroup({ ...group, controls });\r\n}\r\nexport function useFormArray(props) {\r\n const [currentState] = useState(props.groups);\r\n const [state, setState] = useState([]);\r\n const [validators, setValidators] = useState(props.validators);\r\n const [controls, setControls] = useState([]);\r\n const [groups, setGroups] = useState(props.groups || []);\r\n useEffect(() => {\r\n setControls(groups.map(({ controls }) => controls));\r\n setState(groups.map(({ controls }) => controlsToState(controls)));\r\n }, [groups]);\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 touched = groupPartialChecked(groups, 'touched');\r\n const toucheds = groupAllChecked(groups, 'touched');\r\n const dirties = groupAllChecked(groups, 'dirty');\r\n const dirty = groupPartialChecked(groups, 'dirty');\r\n function push(group) {\r\n setGroups([...groups, group]);\r\n }\r\n function merge(newGroups) {\r\n setGroups([...groups, ...newGroups]);\r\n }\r\n function set(groups) {\r\n setGroups(groups);\r\n }\r\n function updateGroup(group, changes) {\r\n const newGroup = new RolsterArrayGroup({ ...group, ...changes });\r\n setGroups(groups.map((currentGroup) => currentGroup.uuid === group.uuid ? newGroup : currentGroup));\r\n }\r\n function updateControl(control, changes) {\r\n if (control.group) {\r\n const group = cloneFormArrayGroup(control.group, control, changes);\r\n setGroups(groups.map((currentGroup) => currentGroup.uuid === group.uuid ? group : currentGroup));\r\n }\r\n }\r\n function remove(group) {\r\n setGroups(groups.filter(({ uuid }) => group.uuid !== uuid));\r\n }\r\n function reset() {\r\n setGroups(currentState || []);\r\n }\r\n const formArray = {\r\n controls,\r\n dirty,\r\n dirties,\r\n error,\r\n errors,\r\n groups,\r\n invalid: !valid,\r\n merge,\r\n pristine: !dirty,\r\n pristines: !dirties,\r\n push,\r\n remove,\r\n reset,\r\n set,\r\n setValidators,\r\n state,\r\n touched,\r\n toucheds,\r\n untouched: !touched,\r\n untoucheds: !toucheds,\r\n updateControl,\r\n updateGroup,\r\n valid,\r\n value: state,\r\n wrong: touched && !valid\r\n };\r\n groups.forEach((group) => (group.parent = formArray));\r\n return formArray;\r\n}\r\n//# sourceMappingURL=form-array.hook.js.map","import { controlIsValid } from '@rolster/helpers-forms/helpers';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport { BehaviorSubject } from 'rxjs';\r\nexport function useReactControl(props = {}) {\r\n const [state, setCurrentState] = useState(props.state);\r\n const [value, setValue] = useState(props.state);\r\n const [touched, setTouched] = useState(props.touched || false);\r\n const [dirty, setDirty] = useState(false);\r\n const [focused, setFocused] = useState(false);\r\n const [disabled, setDisabled] = useState(false);\r\n const [initialValue] = useState(props.state);\r\n const [validators, setValidators] = useState(props.validators);\r\n const [subscribers] = useState(new BehaviorSubject(props.state));\r\n const elementRef = useRef(null);\r\n const errors = (() => validators ? controlIsValid({ state, validators }) : [])();\r\n const error = (() => errors[0])();\r\n const valid = (() => errors.length === 0)();\r\n useEffect(() => {\r\n if (state !== null && state !== undefined) {\r\n setValue(state);\r\n }\r\n subscribers.next(state);\r\n }, [state]);\r\n function focus() {\r\n setFocused(true);\r\n }\r\n function blur() {\r\n setFocused(false);\r\n }\r\n function disable() {\r\n setDisabled(true);\r\n }\r\n function enable() {\r\n setDisabled(false);\r\n }\r\n function touch() {\r\n setTouched(true);\r\n }\r\n function untouch() {\r\n setTouched(false);\r\n }\r\n function setState(state) {\r\n setDirty(true);\r\n setCurrentState(state);\r\n }\r\n function reset() {\r\n setTouched(false);\r\n setDirty(false);\r\n setCurrentState(initialValue);\r\n }\r\n function subscribe(subscriber) {\r\n return subscribers.subscribe(subscriber);\r\n }\r\n return {\r\n blur,\r\n dirty,\r\n disable,\r\n disabled,\r\n elementRef,\r\n enable,\r\n enabled: !disabled,\r\n error,\r\n errors,\r\n focus,\r\n focused,\r\n invalid: !valid,\r\n pristine: !dirty,\r\n reset,\r\n setState,\r\n setValidators,\r\n state,\r\n subscribe,\r\n touch,\r\n touched,\r\n unfocused: !focused,\r\n untouch,\r\n untouched: !touched,\r\n valid,\r\n value,\r\n wrong: touched && !valid\r\n };\r\n}\r\nexport function useFormControl(props = {}) {\r\n return useReactControl(props);\r\n}\r\nexport function useInputControl(props = {}) {\r\n return useReactControl(props);\r\n}\r\n//# sourceMappingURL=form-control.hook.js.map","import { controlsAllChecked, controlsPartialChecked, controlsToState, controlsToValue, groupIsValid } from '@rolster/helpers-forms/helpers';\r\nimport { useState } from 'react';\r\nexport function useFormGroup(props) {\r\n const [validators, setValidators] = useState(props.validators);\r\n const { controls } = props;\r\n const errors = (() => validators ? groupIsValid({ controls, validators }) : [])();\r\n const valid = (() => errors.length === 0 && controlsAllChecked(controls, 'valid'))();\r\n const touched = (() => controlsPartialChecked(controls, 'touched'))();\r\n const toucheds = (() => controlsAllChecked(controls, 'touched'))();\r\n const dirty = (() => controlsPartialChecked(controls, 'dirty'))();\r\n const dirties = (() => controlsAllChecked(controls, 'dirty'))();\r\n const state = (() => controlsToState(controls))();\r\n const value = (() => controlsToValue(controls))();\r\n function reset() {\r\n Object.values(controls).forEach((control) => control.reset());\r\n }\r\n return {\r\n controls,\r\n dirty,\r\n dirties,\r\n error: errors[0],\r\n errors,\r\n invalid: !valid,\r\n pristine: !dirty,\r\n pristines: !dirties,\r\n reset,\r\n state,\r\n setValidators,\r\n touched,\r\n toucheds,\r\n untouched: !touched,\r\n untoucheds: !toucheds,\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,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AACnD,MAAM,SAAS,GAAG,CAAC,KAAK,KAAK;AAC7B,IAAI,OAAO,EAAE,EAAE,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,CAAC;AAC9D,QAAQ,KAAK,KAAK,KAAK;AACvB,QAAQ,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC;AACK,MAAM,cAAc,GAAG,CAAC,KAAK,KAAK;AACzC,IAAI,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;AACxC,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,SAAS,KAAK;AACpD,QAAQ,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AACvC,QAAQ,IAAI,KAAK,EAAE;AACnB,YAAY,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/B,SAAS;AACT,QAAQ,OAAO,MAAM,CAAC;AACtB,KAAK,EAAE,EAAE,CAAC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AAG,CAAC;AACvE,IAAI,MAAM,KAAK,GAAG,CAAC,MAAM,sBAAsB,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC;AACtE,IAAI,MAAM,OAAO,GAAG,CAAC,MAAM,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC;AACpE,IAAI,MAAM,KAAK,GAAG,CAAC,MAAM,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC;AACtD,IAAI,MAAM,KAAK,GAAG,CAAC,MAAM,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC;AACtD,IAAI,SAAS,KAAK,GAAG;AACrB,QAAQ,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;AACtE,KAAK;AACL,IAAI,OAAO;AACX,QAAQ,QAAQ;AAChB,QAAQ,KAAK;AACb,QAAQ,OAAO;AACf,QAAQ,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AACxB,QAAQ,MAAM;AACd,QAAQ,OAAO,EAAE,CAAC,KAAK;AACvB,QAAQ,QAAQ,EAAE,CAAC,KAAK;AACxB,QAAQ,SAAS,EAAE,CAAC,OAAO;AAC3B,QAAQ,KAAK;AACb,QAAQ,KAAK;AACb,QAAQ,aAAa;AACrB,QAAQ,OAAO;AACf,QAAQ,QAAQ;AAChB,QAAQ,SAAS,EAAE,CAAC,OAAO;AAC3B,QAAQ,UAAU,EAAE,CAAC,QAAQ;AAC7B,QAAQ,KAAK;AACb,QAAQ,KAAK;AACb,QAAQ,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK;AAChC,KAAK,CAAC;AACN;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../node_modules/@rolster/helpers-forms/dist/esm/helpers.js","../esm/form-array.hook.js","../esm/form-control.hook.js","../esm/form-group.hook.js"],"sourcesContent":["const FALSY_VALUE = ['false', 'undefined', '0', 0];\r\nconst toBoolean = (value) => {\r\n return !(!(typeof value !== 'undefined' && value !== null) ||\r\n value === false ||\r\n FALSY_VALUE.includes(value));\r\n};\r\nexport const controlIsValid = (props) => {\r\n const { state, validators } = props;\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, props) => {\r\n return Object.values(controls).reduce((value, control) => value && toBoolean(control[props]), true);\r\n};\r\nexport const controlsPartialChecked = (controls, props) => {\r\n return Object.values(controls).reduce((value, control) => value || toBoolean(control[props]), false);\r\n};\r\nexport const controlsToState = (controls) => {\r\n return Object.entries(controls).reduce((json, [key, { state }]) => {\r\n json[key] = state;\r\n return json;\r\n }, {});\r\n};\r\nexport const controlsToValue = (controls) => {\r\n return Object.entries(controls).reduce((json, [key, { value }]) => {\r\n json[key] = value;\r\n return json;\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 && toBoolean(group[key]), true);\r\n}\r\nexport function groupPartialChecked(groups, key) {\r\n return groups.reduce((value, group) => value || toBoolean(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 { arrayIsValid, controlIsValid, controlsAllChecked, controlsPartialChecked, controlsToState, controlsToValue, groupAllChecked, groupIsValid, groupPartialChecked } from '@rolster/helpers-forms/helpers';\r\nimport { useEffect, useState } from 'react';\r\nimport { v4 as uuid } from 'uuid';\r\nclass RolsterArrayControl {\r\n constructor(props) {\r\n const { uuid, focused, dirty, disabled, initialState, state, touched, validators } = props;\r\n this.uuid = uuid;\r\n this.focused = focused || false;\r\n this.unfocused = !this.focused;\r\n this.touched = touched || false;\r\n this.untouched = !this.touched;\r\n this.dirty = dirty || false;\r\n this.pristine = !this.dirty;\r\n this.disabled = disabled || false;\r\n this.enabled = !this.disabled;\r\n this.state = state;\r\n this.validators = validators;\r\n this.initialState = initialState;\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 this.value = state;\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 });\r\n }\r\n }\r\n touch() {\r\n if (!this.touched) {\r\n this.update({ touched: true });\r\n }\r\n }\r\n untouch() {\r\n if (this.touched) {\r\n this.update({ touched: false });\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 setState(state) {\r\n this.update({ state });\r\n }\r\n setValidators(validators) {\r\n this.update({ validators });\r\n }\r\n reset() {\r\n this.update({ state: this.initialState });\r\n }\r\n update(changes) {\r\n this.group?.parent?.refreshControl(this, {\r\n ...changes,\r\n initialState: this.initialState\r\n });\r\n }\r\n}\r\nclass RolsterArrayGroup {\r\n constructor(props) {\r\n const { controls, resource, uuid, validators } = props;\r\n Object.values(controls).forEach((control) => (control.group = this));\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.touched = controlsPartialChecked(controls, 'touched');\r\n this.toucheds = controlsAllChecked(controls, 'touched');\r\n this.dirty = controlsPartialChecked(controls, 'dirty');\r\n this.dirties = controlsAllChecked(controls, 'dirty');\r\n this.untouched = !this.touched;\r\n this.untoucheds = !this.toucheds;\r\n this.pristine = !this.dirty;\r\n this.pristines = !this.dirties;\r\n this.wrong = this.touched && this.invalid;\r\n this.state = controlsToState(controls);\r\n this.value = controlsToValue(controls);\r\n }\r\n setValidators(validators) {\r\n this.parent?.refreshGroup(this, { validators });\r\n }\r\n}\r\nexport function cloneFormArrayControl(control, changes) {\r\n return new RolsterArrayControl({ ...control, ...changes });\r\n}\r\nexport function cloneFormArrayGroup(group, changes) {\r\n return new RolsterArrayGroup({ ...group, ...changes });\r\n}\r\nexport function useFormArrayControl(props) {\r\n return new RolsterArrayControl({\r\n ...props,\r\n uuid: uuid(),\r\n initialState: props.state\r\n });\r\n}\r\nexport function useInputArrayControl(props) {\r\n return new RolsterArrayControl({\r\n ...props,\r\n uuid: uuid(),\r\n initialState: props.state\r\n });\r\n}\r\nexport function useFormArrayGroup(props) {\r\n return new RolsterArrayGroup({ ...props, uuid: uuid() });\r\n}\r\nfunction cloneFormControlForArrayGroup(group, control, changes) {\r\n const newControl = cloneFormArrayControl(control, changes);\r\n const { uuid } = newControl;\r\n const controls = Object.entries(group.controls).reduce((controls, [key, control]) => {\r\n controls[key] = control.uuid === uuid ? newControl : control;\r\n return controls;\r\n }, {});\r\n return new RolsterArrayGroup({ ...group, controls });\r\n}\r\nexport function useFormArray(props) {\r\n const [currentState] = useState(props.groups);\r\n const [state, setState] = useState([]);\r\n const [validators, setValidators] = useState(props.validators);\r\n const [controls, setControls] = useState([]);\r\n const [groups, setGroups] = useState(props.groups || []);\r\n useEffect(() => {\r\n setControls(groups.map(({ controls }) => controls));\r\n setState(groups.map(({ controls }) => controlsToState(controls)));\r\n }, [groups]);\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 touched = groupPartialChecked(groups, 'touched');\r\n const toucheds = groupAllChecked(groups, 'touched');\r\n const dirties = groupAllChecked(groups, 'dirty');\r\n const dirty = groupPartialChecked(groups, 'dirty');\r\n function push(group) {\r\n setGroups([...groups, group]);\r\n }\r\n function merge(newGroups) {\r\n setGroups([...groups, ...newGroups]);\r\n }\r\n function set(groups) {\r\n setGroups(groups);\r\n }\r\n function refreshControl(control, changes) {\r\n if (control.group) {\r\n const group = cloneFormControlForArrayGroup(control.group, control, changes);\r\n setGroups(groups.map((currentGroup) => currentGroup.uuid === group.uuid ? group : currentGroup));\r\n }\r\n }\r\n function refreshGroup(group, changes) {\r\n const newGroup = cloneFormArrayGroup(group, changes);\r\n const { uuid } = newGroup;\r\n setGroups(groups.map((currentGroup) => currentGroup.uuid === uuid ? newGroup : currentGroup));\r\n }\r\n function remove(group) {\r\n setGroups(groups.filter(({ uuid }) => group.uuid !== uuid));\r\n }\r\n function reset() {\r\n setGroups(currentState || []);\r\n }\r\n const formArray = {\r\n controls,\r\n dirty,\r\n dirties,\r\n error,\r\n errors,\r\n groups,\r\n invalid: !valid,\r\n merge,\r\n pristine: !dirty,\r\n pristines: !dirties,\r\n push,\r\n refreshControl,\r\n refreshGroup,\r\n remove,\r\n reset,\r\n set,\r\n setValidators,\r\n state,\r\n touched,\r\n toucheds,\r\n untouched: !touched,\r\n untoucheds: !toucheds,\r\n valid,\r\n value: state,\r\n wrong: touched && !valid\r\n };\r\n groups.forEach((group) => (group.parent = formArray));\r\n return formArray;\r\n}\r\n//# sourceMappingURL=form-array.hook.js.map","import { controlIsValid } from '@rolster/helpers-forms/helpers';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport { BehaviorSubject } from 'rxjs';\r\nexport function useReactControl(props = {}) {\r\n const [state, setCurrentState] = useState(props.state);\r\n const [value, setValue] = useState(props.state);\r\n const [touched, setTouched] = useState(props.touched || false);\r\n const [dirty, setDirty] = useState(false);\r\n const [focused, setFocused] = useState(false);\r\n const [disabled, setDisabled] = useState(false);\r\n const [initialValue] = useState(props.state);\r\n const [validators, setValidators] = useState(props.validators);\r\n const [subscribers] = useState(new BehaviorSubject(props.state));\r\n const elementRef = useRef(null);\r\n const errors = (() => validators ? controlIsValid({ state, validators }) : [])();\r\n const error = (() => errors[0])();\r\n const valid = (() => errors.length === 0)();\r\n useEffect(() => {\r\n if (state !== null && state !== undefined) {\r\n setValue(state);\r\n }\r\n subscribers.next(state);\r\n }, [state]);\r\n function focus() {\r\n setFocused(true);\r\n }\r\n function blur() {\r\n setFocused(false);\r\n }\r\n function disable() {\r\n setDisabled(true);\r\n }\r\n function enable() {\r\n setDisabled(false);\r\n }\r\n function touch() {\r\n setTouched(true);\r\n }\r\n function untouch() {\r\n setTouched(false);\r\n }\r\n function setState(state) {\r\n setDirty(true);\r\n setCurrentState(state);\r\n }\r\n function reset() {\r\n setTouched(false);\r\n setDirty(false);\r\n setCurrentState(initialValue);\r\n }\r\n function subscribe(subscriber) {\r\n const subscription = subscribers.subscribe(subscriber);\r\n return () => subscription.unsubscribe();\r\n }\r\n return {\r\n blur,\r\n dirty,\r\n disable,\r\n disabled,\r\n elementRef,\r\n enable,\r\n enabled: !disabled,\r\n error,\r\n errors,\r\n focus,\r\n focused,\r\n invalid: !valid,\r\n pristine: !dirty,\r\n reset,\r\n setState,\r\n setValidators,\r\n state,\r\n subscribe,\r\n touch,\r\n touched,\r\n unfocused: !focused,\r\n untouch,\r\n untouched: !touched,\r\n valid,\r\n value,\r\n wrong: touched && !valid\r\n };\r\n}\r\nexport function useFormControl(props = {}) {\r\n return useReactControl(props);\r\n}\r\nexport function useInputControl(props = {}) {\r\n return useReactControl(props);\r\n}\r\n//# sourceMappingURL=form-control.hook.js.map","import { controlsAllChecked, controlsPartialChecked, controlsToState, controlsToValue, groupIsValid } from '@rolster/helpers-forms/helpers';\r\nimport { useState } from 'react';\r\nexport function useFormGroup(props) {\r\n const [validators, setValidators] = useState(props.validators);\r\n const { controls } = props;\r\n const errors = (() => validators ? groupIsValid({ controls, validators }) : [])();\r\n const valid = (() => errors.length === 0 && controlsAllChecked(controls, 'valid'))();\r\n const touched = (() => controlsPartialChecked(controls, 'touched'))();\r\n const toucheds = (() => controlsAllChecked(controls, 'touched'))();\r\n const dirty = (() => controlsPartialChecked(controls, 'dirty'))();\r\n const dirties = (() => controlsAllChecked(controls, 'dirty'))();\r\n const state = (() => controlsToState(controls))();\r\n const value = (() => controlsToValue(controls))();\r\n function reset() {\r\n Object.values(controls).forEach((control) => control.reset());\r\n }\r\n return {\r\n controls,\r\n dirty,\r\n dirties,\r\n error: errors[0],\r\n errors,\r\n invalid: !valid,\r\n pristine: !dirty,\r\n pristines: !dirties,\r\n reset,\r\n state,\r\n setValidators,\r\n touched,\r\n toucheds,\r\n untouched: !touched,\r\n untoucheds: !toucheds,\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,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AACnD,MAAM,SAAS,GAAG,CAAC,KAAK,KAAK;AAC7B,IAAI,OAAO,EAAE,EAAE,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,CAAC;AAC9D,QAAQ,KAAK,KAAK,KAAK;AACvB,QAAQ,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC;AACK,MAAM,cAAc,GAAG,CAAC,KAAK,KAAK;AACzC,IAAI,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;AACxC,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,SAAS,KAAK;AACpD,QAAQ,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AACvC,QAAQ,IAAI,KAAK,EAAE;AACnB,YAAY,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/B,SAAS;AACT,QAAQ,O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Q,aAAa;AACrB,QAAQ,OAAO;AACf,QAAQ,QAAQ;AAChB,QAAQ,SAAS,EAAE,CAAC,OAAO;AAC3B,QAAQ,UAAU,EAAE,CAAC,QAAQ;AAC7B,QAAQ,KAAK;AACb,QAAQ,KAAK;AACb,QAAQ,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK;AAChC,KAAK,CAAC;AACN;;;;"}
|
|
@@ -13,22 +13,24 @@ interface AbstractRolsterArrayControl<T = any, C extends ReactArrayControls = an
|
|
|
13
13
|
validators?: ValidatorFn<T>[];
|
|
14
14
|
}
|
|
15
15
|
type RolsterArrayControls = ReactArrayControls<AbstractRolsterArrayControl>;
|
|
16
|
-
interface AbstractRolsterArrayGroup<
|
|
17
|
-
parent?: RolsterFormArray<
|
|
18
|
-
validators?: ValidatorGroupFn<
|
|
16
|
+
interface AbstractRolsterArrayGroup<C extends RolsterArrayControls = RolsterArrayControls, R = any> extends ReactArrayGroup<C, R> {
|
|
17
|
+
parent?: RolsterFormArray<C>;
|
|
18
|
+
validators?: ValidatorGroupFn<C>[];
|
|
19
19
|
}
|
|
20
|
-
interface RolsterFormArray<
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
interface RolsterFormArray<C extends ReactArrayControls> extends ReactFormArray<C> {
|
|
21
|
+
refreshControl(control: AbstractRolsterArrayControl<any, C>, changes: Partial<AbtractFormArrayControlProps<any>>): void;
|
|
22
|
+
refreshGroup(group: AbstractRolsterArrayGroup<C>, changes: Partial<FormArrayGroupProps<C>>): void;
|
|
23
23
|
}
|
|
24
24
|
interface RolsterControlProps<T = any> extends FormArrayControlProps<T> {
|
|
25
25
|
touched?: boolean;
|
|
26
26
|
}
|
|
27
27
|
type ReactControlProps<T = any> = Omit<RolsterControlProps<T>, 'uuid'>;
|
|
28
|
+
export declare function cloneFormArrayControl<T = any, C extends ReactArrayControls = ReactArrayControls, E extends HTMLElement = HTMLElement>(control: AbstractRolsterArrayControl<T, C, E>, changes: Partial<AbtractFormArrayControlProps<T>>): ReactArrayControl<E, T>;
|
|
29
|
+
export declare function cloneFormArrayGroup<C extends ReactArrayControls = ReactArrayControls>(group: AbstractRolsterArrayGroup<C>, changes: Partial<FormArrayGroupProps<C>>): ReactArrayGroup<C>;
|
|
28
30
|
export declare function useFormArrayControl<T = any, C extends ReactArrayControls = any, E extends HTMLElement = HTMLElement>(props: ReactControlProps<T>): AbstractRolsterArrayControl<T, C, E>;
|
|
29
31
|
export declare function useInputArrayControl<T = any, C extends ReactArrayControls = any>(props: ReactControlProps<T>): AbstractRolsterArrayControl<T, C, HTMLInputElement>;
|
|
30
|
-
type RolsterGroupProps<
|
|
31
|
-
export declare function useFormArrayGroup<
|
|
32
|
-
type RolsterArrayProps<
|
|
33
|
-
export declare function useFormArray<
|
|
32
|
+
type RolsterGroupProps<C extends RolsterArrayControls = RolsterArrayControls, R = any> = Omit<FormArrayGroupProps<C, R>, 'uuid'>;
|
|
33
|
+
export declare function useFormArrayGroup<C extends RolsterArrayControls = RolsterArrayControls, R = any>(props: RolsterGroupProps<C>): AbstractRolsterArrayGroup<C, R>;
|
|
34
|
+
type RolsterArrayProps<C extends ReactArrayControls = ReactArrayControls, R = any> = FormArrayProps<C, R, AbstractRolsterArrayGroup<C, R>>;
|
|
35
|
+
export declare function useFormArray<C extends ReactArrayControls, R = any>(props: RolsterArrayProps<C, R>): ReactFormArray<C, R>;
|
|
34
36
|
export {};
|
|
@@ -63,7 +63,7 @@ class RolsterArrayControl {
|
|
|
63
63
|
this.update({ state: this.initialState });
|
|
64
64
|
}
|
|
65
65
|
update(changes) {
|
|
66
|
-
this.group?.parent?.
|
|
66
|
+
this.group?.parent?.refreshControl(this, {
|
|
67
67
|
...changes,
|
|
68
68
|
initialState: this.initialState
|
|
69
69
|
});
|
|
@@ -83,21 +83,27 @@ class RolsterArrayGroup {
|
|
|
83
83
|
this.errors.length === 0 && controlsAllChecked(controls, 'valid');
|
|
84
84
|
this.invalid = !this.valid;
|
|
85
85
|
this.touched = controlsPartialChecked(controls, 'touched');
|
|
86
|
-
this.untouched = !this.touched;
|
|
87
86
|
this.toucheds = controlsAllChecked(controls, 'touched');
|
|
88
|
-
this.untoucheds = !this.toucheds;
|
|
89
87
|
this.dirty = controlsPartialChecked(controls, 'dirty');
|
|
90
|
-
this.pristine = !this.dirty;
|
|
91
88
|
this.dirties = controlsAllChecked(controls, 'dirty');
|
|
89
|
+
this.untouched = !this.touched;
|
|
90
|
+
this.untoucheds = !this.toucheds;
|
|
91
|
+
this.pristine = !this.dirty;
|
|
92
92
|
this.pristines = !this.dirties;
|
|
93
93
|
this.wrong = this.touched && this.invalid;
|
|
94
94
|
this.state = controlsToState(controls);
|
|
95
95
|
this.value = controlsToValue(controls);
|
|
96
96
|
}
|
|
97
97
|
setValidators(validators) {
|
|
98
|
-
this.parent?.
|
|
98
|
+
this.parent?.refreshGroup(this, { validators });
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
export function cloneFormArrayControl(control, changes) {
|
|
102
|
+
return new RolsterArrayControl({ ...control, ...changes });
|
|
103
|
+
}
|
|
104
|
+
export function cloneFormArrayGroup(group, changes) {
|
|
105
|
+
return new RolsterArrayGroup({ ...group, ...changes });
|
|
106
|
+
}
|
|
101
107
|
export function useFormArrayControl(props) {
|
|
102
108
|
return new RolsterArrayControl({
|
|
103
109
|
...props,
|
|
@@ -115,8 +121,8 @@ export function useInputArrayControl(props) {
|
|
|
115
121
|
export function useFormArrayGroup(props) {
|
|
116
122
|
return new RolsterArrayGroup({ ...props, uuid: uuid() });
|
|
117
123
|
}
|
|
118
|
-
function
|
|
119
|
-
const newControl =
|
|
124
|
+
function cloneFormControlForArrayGroup(group, control, changes) {
|
|
125
|
+
const newControl = cloneFormArrayControl(control, changes);
|
|
120
126
|
const { uuid } = newControl;
|
|
121
127
|
const controls = Object.entries(group.controls).reduce((controls, [key, control]) => {
|
|
122
128
|
controls[key] = control.uuid === uuid ? newControl : control;
|
|
@@ -150,16 +156,17 @@ export function useFormArray(props) {
|
|
|
150
156
|
function set(groups) {
|
|
151
157
|
setGroups(groups);
|
|
152
158
|
}
|
|
153
|
-
function
|
|
154
|
-
const newGroup = new RolsterArrayGroup({ ...group, ...changes });
|
|
155
|
-
setGroups(groups.map((currentGroup) => currentGroup.uuid === group.uuid ? newGroup : currentGroup));
|
|
156
|
-
}
|
|
157
|
-
function updateControl(control, changes) {
|
|
159
|
+
function refreshControl(control, changes) {
|
|
158
160
|
if (control.group) {
|
|
159
|
-
const group =
|
|
161
|
+
const group = cloneFormControlForArrayGroup(control.group, control, changes);
|
|
160
162
|
setGroups(groups.map((currentGroup) => currentGroup.uuid === group.uuid ? group : currentGroup));
|
|
161
163
|
}
|
|
162
164
|
}
|
|
165
|
+
function refreshGroup(group, changes) {
|
|
166
|
+
const newGroup = cloneFormArrayGroup(group, changes);
|
|
167
|
+
const { uuid } = newGroup;
|
|
168
|
+
setGroups(groups.map((currentGroup) => currentGroup.uuid === uuid ? newGroup : currentGroup));
|
|
169
|
+
}
|
|
163
170
|
function remove(group) {
|
|
164
171
|
setGroups(groups.filter(({ uuid }) => group.uuid !== uuid));
|
|
165
172
|
}
|
|
@@ -178,6 +185,8 @@ export function useFormArray(props) {
|
|
|
178
185
|
pristine: !dirty,
|
|
179
186
|
pristines: !dirties,
|
|
180
187
|
push,
|
|
188
|
+
refreshControl,
|
|
189
|
+
refreshGroup,
|
|
181
190
|
remove,
|
|
182
191
|
reset,
|
|
183
192
|
set,
|
|
@@ -187,8 +196,6 @@ export function useFormArray(props) {
|
|
|
187
196
|
toucheds,
|
|
188
197
|
untouched: !touched,
|
|
189
198
|
untoucheds: !toucheds,
|
|
190
|
-
updateControl,
|
|
191
|
-
updateGroup,
|
|
192
199
|
valid,
|
|
193
200
|
value: state,
|
|
194
201
|
wrong: touched && !valid
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-array.hook.js","sourceRoot":"","sources":["../../src/form-array.hook.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,YAAY,EACZ,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1B,SAAS,CACP,MAAM,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAC1B,YAAY,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CACrD,CACF,CAAC;IACJ,CAAC;IAED,SAAS,MAAM,CAAC,KAAyB;QACvC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED,SAAS,KAAK;QACZ,SAAS,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,MAAM,SAAS,GAAwB;QACrC,QAAQ;QACR,KAAK;QACL,OAAO;QACP,KAAK;QACL,MAAM;QACN,MAAM;QACN,OAAO,EAAE,CAAC,KAAK;QACf,KAAK;QACL,QAAQ,EAAE,CAAC,KAAK;QAChB,SAAS,EAAE,CAAC,OAAO;QACnB,IAAI;QACJ,cAAc;QACd,YAAY;QACZ,MAAM;QACN,KAAK;QACL,GAAG;QACH,aAAa;QACb,KAAK;QACL,OAAO;QACP,QAAQ;QACR,SAAS,EAAE,CAAC,OAAO;QACnB,UAAU,EAAE,CAAC,QAAQ;QACrB,KAAK;QACL,KAAK,EAAE,KAA6B;QACpC,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK;KACzB,CAAC;IAEF,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAEtD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -49,7 +49,8 @@ export function useReactControl(props = {}) {
|
|
|
49
49
|
setCurrentState(initialValue);
|
|
50
50
|
}
|
|
51
51
|
function subscribe(subscriber) {
|
|
52
|
-
|
|
52
|
+
const subscription = subscribers.subscribe(subscriber);
|
|
53
|
+
return () => subscription.unsubscribe();
|
|
53
54
|
}
|
|
54
55
|
return {
|
|
55
56
|
blur,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-control.hook.js","sourceRoot":"","sources":["../../src/form-control.hook.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"form-control.hook.js","sourceRoot":"","sources":["../../src/form-control.hook.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAOvC,MAAM,UAAU,eAAe,CAC7B,QAA8B,EAAE;IAEhC,MAAM,CAAC,KAAK,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAe,KAAK,CAAC,KAAK,CAAC,CAAC;IACrE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAI,KAAK,CAAC,KAAU,CAAC,CAAC;IACxD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC;IACxE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACnD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACvD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACzD,MAAM,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAe,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,CAAC,UAA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pC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,eAAe,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAED,SAAS,KAAK;QACZ,UAAU,CAAC,KAAK,CAAC,CAAC;QAClB,QAAQ,CAAC,KAAK,CAAC,CAAC;QAChB,eAAe,CAAC,YAAY,CAAC,CAAC;IAChC,CAAC;IAED,SAAS,SAAS,CAAC,UAAgC;QACjD,MAAM,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAEvD,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IAC1C,CAAC;IAED,OAAO;QACL,IAAI;QACJ,KAAK;QACL,OAAO;QACP,QAAQ;QACR,UAAU;QACV,MAAM;QACN,OAAO,EAAE,CAAC,QAAQ;QAClB,KAAK;QACL,MAAM;QACN,KAAK;QACL,OAAO;QACP,OAAO,EAAE,CAAC,KAAK;QACf,QAAQ,EAAE,CAAC,KAAK;QAChB,KAAK;QACL,QAAQ;QACR,aAAa;QACb,KAAK;QACL,SAAS;QACT,KAAK;QACL,OAAO;QACP,SAAS,EAAE,CAAC,OAAO;QACnB,OAAO;QACP,SAAS,EAAE,CAAC,OAAO;QACnB,KAAK;QACL,KAAK;QACL,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK;KACzB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,QAA8B,EAAE;IAEhC,OAAO,eAAe,CAAiB,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,QAA8B,EAAE;IAEhC,OAAO,eAAe,CAAsB,KAAK,CAAC,CAAC;AACrD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolster/react-forms",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.8",
|
|
4
4
|
"description": "It implements a set of classes that allow managing the control of states of the input components in React",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"prepublishOnly": "npm run build"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@rolster/helpers-forms": "^1.9.
|
|
30
|
-
"@rolster/validators": "^1.0.
|
|
29
|
+
"@rolster/helpers-forms": "^1.9.10",
|
|
30
|
+
"@rolster/validators": "^1.0.5",
|
|
31
31
|
"rxjs": "^7.8.0",
|
|
32
32
|
"uuid": "^9.0.1"
|
|
33
33
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@rollup/plugin-commonjs": "^25.0.4",
|
|
39
39
|
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
40
40
|
"@rollup/plugin-typescript": "^11.1.3",
|
|
41
|
-
"@rolster/types": "^1.0.
|
|
41
|
+
"@rolster/types": "^1.0.6",
|
|
42
42
|
"@types/jest": "^29.5.1",
|
|
43
43
|
"@types/react": "^18.2.42",
|
|
44
44
|
"@types/uuid": "^9.0.7",
|