@rolster/react-forms 18.7.3 → 18.8.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 +87 -24
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +87 -25
- package/dist/es/index.js.map +1 -1
- package/dist/esm/form-array/{form-array-control.hook.d.ts → form-array-control.d.ts} +25 -19
- package/dist/esm/form-array/{form-array-control.hook.js → form-array-control.js} +37 -22
- package/dist/esm/form-array/form-array-control.js.map +1 -0
- package/dist/esm/form-array/{form-array-group.hook.d.ts → form-array-group.d.ts} +2 -2
- package/dist/esm/form-array/{form-array-group.hook.js → form-array-group.js} +2 -5
- package/dist/esm/form-array/form-array-group.js.map +1 -0
- package/dist/esm/form-array/form-array-list.d.ts +25 -0
- package/dist/esm/form-array/form-array-list.js +52 -0
- package/dist/esm/form-array/form-array-list.js.map +1 -0
- package/dist/esm/form-array/{form-array.hook.js → form-array.js} +2 -2
- package/dist/esm/form-array/form-array.js.map +1 -0
- package/dist/esm/form-array/index.d.ts +4 -3
- package/dist/esm/form-array/index.js +4 -3
- package/dist/esm/form-array/index.js.map +1 -1
- package/dist/esm/{form-control.hook.d.ts → form-control.d.ts} +4 -4
- package/dist/esm/{form-control.hook.js → form-control.js} +1 -1
- package/dist/esm/form-control.js.map +1 -0
- package/dist/esm/{form-group.hook.js → form-group.js} +1 -1
- package/dist/esm/form-group.js.map +1 -0
- package/dist/esm/{form-ref.hook.d.ts → form-ref.d.ts} +2 -2
- package/dist/esm/{form-ref.hook.js → form-ref.js} +2 -2
- package/dist/esm/form-ref.js.map +1 -0
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types.d.ts +7 -1
- package/package.json +2 -2
- package/dist/esm/form-array/form-array-control.hook.js.map +0 -1
- package/dist/esm/form-array/form-array-group.hook.js.map +0 -1
- package/dist/esm/form-array/form-array.hook.js.map +0 -1
- package/dist/esm/form-control.hook.js.map +0 -1
- package/dist/esm/form-group.hook.js.map +0 -1
- package/dist/esm/form-ref.hook.js.map +0 -1
- /package/dist/esm/form-array/{form-array.hook.d.ts → form-array.d.ts} +0 -0
- /package/dist/esm/{form-group.hook.d.ts → form-group.d.ts} +0 -0
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../esm/form-array/form-array-control.hook.js","../esm/form-array/form-array-group.hook.js","../esm/form-array/form-array.hook.js","../esm/form-control.hook.js","../esm/form-group.hook.js"],"sourcesContent":["import { createFormControlOptions } from '@rolster/forms/arguments';\r\nimport { controlIsValid, hasError, someErrors } from '@rolster/forms/helpers';\r\nimport { v4 as uuid } from 'uuid';\r\nexport class RolsterArrayControl {\r\n constructor(options) {\r\n this.initialValue = options.initialValue;\r\n this.uuid = options.uuid;\r\n this.focused = !!options.focused;\r\n this.unfocused = !this.focused;\r\n this.touched = !!options.touched;\r\n this.untouched = !this.touched;\r\n this.dirty = !!options.dirty;\r\n this.pristine = !this.dirty;\r\n this.disabled = !!options.disabled;\r\n this.enabled = !this.disabled;\r\n const { value, validators } = options;\r\n this.value = value;\r\n this.validators = validators;\r\n this.errors = validators ? controlIsValid({ value, validators }) : [];\r\n this.error = this.errors[0];\r\n this.valid = this.errors.length === 0;\r\n this.invalid = !this.valid;\r\n this.wrong = this.touched && this.invalid;\r\n }\r\n focus() {\r\n this.unfocused && this.update({ focused: true });\r\n }\r\n blur() {\r\n this.focused && this.update({ focused: false, touched: true });\r\n }\r\n disable() {\r\n this.enabled && this.update({ disabled: true });\r\n }\r\n enable() {\r\n this.disabled && this.update({ disabled: false });\r\n }\r\n touch() {\r\n this.untouched && this.update({ touched: true });\r\n }\r\n setValue(value) {\r\n this.update({ value });\r\n }\r\n setValidators(validators) {\r\n this.update({ validators });\r\n }\r\n subscribe(listener) {\r\n this.subscriber = listener;\r\n }\r\n hasError(key) {\r\n return hasError(this.errors, key);\r\n }\r\n someErrors(keys) {\r\n return someErrors(this.errors, keys);\r\n }\r\n reset() {\r\n this.update({ value: this.initialValue, dirty: false, touched: false });\r\n }\r\n update(changes) {\r\n this.subscriber &&\r\n this.subscriber({\r\n ...this,\r\n ...changes,\r\n initialValue: this.initialValue\r\n });\r\n }\r\n}\r\nfunction arrayControl(options, validators) {\r\n const controlOptions = createFormControlOptions(options, validators);\r\n return new RolsterArrayControl({\r\n ...controlOptions,\r\n uuid: uuid(),\r\n initialValue: controlOptions.value\r\n });\r\n}\r\nexport function reactArrayControl(options, validators) {\r\n return arrayControl(options, validators);\r\n}\r\nexport function formArrayControl(options, validators) {\r\n return arrayControl(options, validators);\r\n}\r\nexport function inputArrayControl(options, validators) {\r\n return arrayControl(options, validators);\r\n}\r\n//# sourceMappingURL=form-array-control.hook.js.map","import { createFormGroupOptions } from '@rolster/forms/arguments';\r\nimport { controlsAllChecked, controlsPartialChecked, controlsToValue, groupIsValid } from '@rolster/forms/helpers';\r\nimport { v4 as uuid } from 'uuid';\r\nimport { RolsterArrayControl } from './form-array-control.hook';\r\nexport class RolsterArrayGroup {\r\n constructor(options) {\r\n const { controls, resource, uuid, validators } = options;\r\n this.uuid = uuid;\r\n this.controls = controls;\r\n this.validators = validators;\r\n this.resource = resource;\r\n this.errors = validators ? groupIsValid({ controls, validators }) : [];\r\n this.error = this.errors[0];\r\n this.valid =\r\n this.errors.length === 0 && controlsAllChecked(controls, 'valid');\r\n this.invalid = !this.valid;\r\n this.dirty = controlsPartialChecked(controls, 'dirty');\r\n this.dirtyAll = controlsAllChecked(controls, 'dirty');\r\n this.touched = controlsPartialChecked(controls, 'touched');\r\n this.touchedAll = controlsAllChecked(controls, 'touched');\r\n this.untouched = !this.touched;\r\n this.untouchedAll = !this.touchedAll;\r\n this.pristine = !this.dirty;\r\n this.pristineAll = !this.dirtyAll;\r\n this.wrong = this.touched && this.invalid;\r\n this.value = controlsToValue(controls);\r\n const subscriber = (options) => {\r\n this.update({\r\n controls: Object.entries(this.controls).reduce((controls, [key, control]) => {\r\n controls[key] =\r\n control.uuid === options.uuid\r\n ? new RolsterArrayControl(options)\r\n : control;\r\n return controls;\r\n }, {})\r\n });\r\n };\r\n Object.values(controls).forEach((control) => {\r\n control.subscribe(subscriber);\r\n });\r\n }\r\n setValidators(validators) {\r\n this.update({ validators });\r\n }\r\n subscribe(subscriber) {\r\n this.subscriber = subscriber;\r\n }\r\n update(changes) {\r\n this.subscriber && this.subscriber({ ...this, ...changes });\r\n }\r\n}\r\nexport function formArrayGroup(options, validators) {\r\n const groupOptions = createFormGroupOptions(options, validators);\r\n return new RolsterArrayGroup({ ...groupOptions, uuid: uuid() });\r\n}\r\n//# sourceMappingURL=form-array-group.hook.js.map","import { createFormArrayOptions } from '@rolster/forms/arguments';\r\nimport { arrayIsValid, controlsToValue, groupAllChecked, groupPartialChecked, hasError as rolsterHasError, someErrors as rolsterSomeErrors } from '@rolster/forms/helpers';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport { RolsterArrayGroup } from './form-array-group.hook';\r\nexport function useFormArray(options, arrayValidators) {\r\n const arrayOptions = createFormArrayOptions(options, arrayValidators);\r\n const groups = arrayOptions.groups || [];\r\n const currentState = useRef(groups);\r\n const [state, setState] = useState({\r\n controls: groups.map(({ controls }) => controls),\r\n disabled: false,\r\n groups,\r\n value: groups.map(({ controls }) => controlsToValue(controls)),\r\n validators: arrayOptions.validators\r\n });\r\n const errors = state.validators\r\n ? arrayIsValid({ groups, validators: state.validators })\r\n : [];\r\n const error = errors[0];\r\n const valid = errors.length === 0 && groupAllChecked(state.groups, 'valid');\r\n const dirty = groupPartialChecked(state.groups, 'dirty');\r\n const dirtyAll = groupAllChecked(state.groups, 'dirty');\r\n const touched = groupPartialChecked(state.groups, 'touched');\r\n const touchedAll = groupAllChecked(state.groups, 'touched');\r\n useEffect(() => {\r\n const subscriber = (options) => {\r\n setGroups(state.groups.map((group) => group.uuid === options.uuid\r\n ? new RolsterArrayGroup(options)\r\n : group));\r\n };\r\n state.groups.forEach((group) => {\r\n group.subscribe(subscriber);\r\n });\r\n }, [state.groups]);\r\n function disable() {\r\n setState((state) => ({ ...state, disabled: true }));\r\n }\r\n function enable() {\r\n setState((state) => ({ ...state, disabled: false }));\r\n }\r\n function setGroups(groups) {\r\n setState((currentState) => ({\r\n ...currentState,\r\n groups,\r\n controls: groups.map(({ controls }) => controls),\r\n value: groups.map(({ controls }) => controlsToValue(controls))\r\n }));\r\n }\r\n function push(group) {\r\n setGroups([...state.groups, group]);\r\n }\r\n function merge(groups) {\r\n setGroups([...state.groups, ...groups]);\r\n }\r\n function set(groups) {\r\n setGroups(groups);\r\n }\r\n function remove({ uuid }) {\r\n setGroups(state.groups.filter((group) => group.uuid !== uuid));\r\n }\r\n function hasError(key) {\r\n return rolsterHasError(errors, key);\r\n }\r\n function someErrors(keys) {\r\n return rolsterSomeErrors(errors, keys);\r\n }\r\n function reset() {\r\n setGroups(currentState.current);\r\n }\r\n function setValidators(validators) {\r\n setState((state) => ({ ...state, validators }));\r\n }\r\n return {\r\n ...state,\r\n dirty,\r\n dirtyAll,\r\n disable,\r\n enable,\r\n enabled: !state.disabled,\r\n error,\r\n errors,\r\n hasError,\r\n invalid: !valid,\r\n merge,\r\n pristine: !dirty,\r\n pristineAll: !dirtyAll,\r\n push,\r\n remove,\r\n reset,\r\n set,\r\n setValidators,\r\n someErrors,\r\n touched,\r\n touchedAll,\r\n untouched: !touched,\r\n untouchedAll: !touchedAll,\r\n valid,\r\n wrong: touched && !valid\r\n };\r\n}\r\n//# sourceMappingURL=form-array.hook.js.map","import { createFormControlOptions } from '@rolster/forms/arguments';\r\nimport { controlIsValid, hasError as rolsterHasError, someErrors as rolsterSomeErrors } from '@rolster/forms/helpers';\r\nimport { useRef, useState } from 'react';\r\nfunction useControl(controlOptions, controlValidators) {\r\n const { value, touched, validators } = createFormControlOptions(controlOptions, controlValidators);\r\n const [state, setState] = useState({\r\n dirty: false,\r\n disabled: false,\r\n focused: false,\r\n touched: !!touched,\r\n validators,\r\n value\r\n });\r\n const initialValue = useRef(value);\r\n const elementRef = useRef(null);\r\n const errors = state.validators\r\n ? controlIsValid({\r\n value: state.value,\r\n validators: state.validators\r\n })\r\n : [];\r\n const valid = errors.length === 0;\r\n function focus() {\r\n setState((state) => ({ ...state, focused: true }));\r\n }\r\n function blur() {\r\n setState((state) => ({ ...state, focused: false, touched: true }));\r\n }\r\n function disable() {\r\n setState((state) => ({ ...state, disabled: true }));\r\n }\r\n function enable() {\r\n setState((state) => ({ ...state, disabled: false }));\r\n }\r\n function touch() {\r\n setState((state) => ({ ...state, touched: true }));\r\n }\r\n function setValue(value) {\r\n setState((state) => ({ ...state, dirty: true, value }));\r\n }\r\n function setValidators(validators) {\r\n setState((state) => ({ ...state, validators }));\r\n }\r\n function hasError(key) {\r\n return rolsterHasError(errors, key);\r\n }\r\n function someErrors(keys) {\r\n return rolsterSomeErrors(errors, keys);\r\n }\r\n function reset() {\r\n setState((state) => ({\r\n ...state,\r\n dirty: false,\r\n value: initialValue.current,\r\n touched: false\r\n }));\r\n }\r\n return {\r\n ...state,\r\n blur,\r\n disable,\r\n elementRef,\r\n enable,\r\n enabled: !state.disabled,\r\n error: errors[0],\r\n errors,\r\n focus,\r\n hasError,\r\n invalid: !valid,\r\n pristine: !state.dirty,\r\n reset,\r\n setValidators,\r\n setValue,\r\n someErrors,\r\n touch,\r\n unfocused: !state.focused,\r\n untouched: !state.touched,\r\n valid,\r\n wrong: state.touched && !valid\r\n };\r\n}\r\nexport function useReactControl(options, validators) {\r\n return useControl(options, validators);\r\n}\r\nexport function useFormControl(options, validators) {\r\n return useControl(options, validators);\r\n}\r\nexport function useInputControl(options, validators) {\r\n return useControl(options, validators);\r\n}\r\n//# sourceMappingURL=form-control.hook.js.map","import { createFormGroupOptions } from '@rolster/forms/arguments';\r\nimport { controlsAllChecked, controlsPartialChecked, controlsToValue, groupIsValid } from '@rolster/forms/helpers';\r\nimport { useState } from 'react';\r\nexport function useFormGroup(options, groupValidators) {\r\n const groupOptions = createFormGroupOptions(options, groupValidators);\r\n const [validators, setValidators] = useState(groupOptions.validators);\r\n const { controls } = groupOptions;\r\n const errors = validators ? groupIsValid({ controls, validators }) : [];\r\n const valid = errors.length === 0 && controlsAllChecked(controls, 'valid');\r\n const value = controlsToValue(controls);\r\n const dirty = controlsPartialChecked(controls, 'dirty');\r\n const dirtyAll = controlsAllChecked(controls, 'dirty');\r\n const touched = controlsPartialChecked(controls, 'touched');\r\n const touchedAll = controlsAllChecked(controls, 'touched');\r\n function reset() {\r\n Object.values(controls).forEach((control) => {\r\n control.reset();\r\n });\r\n }\r\n return {\r\n controls,\r\n dirty,\r\n dirtyAll,\r\n error: errors[0],\r\n errors,\r\n invalid: !valid,\r\n pristine: !dirty,\r\n pristineAll: !dirtyAll,\r\n reset,\r\n setValidators,\r\n touched,\r\n touchedAll,\r\n untouched: !touched,\r\n untouchedAll: !touchedAll,\r\n valid,\r\n value,\r\n wrong: touched && !valid\r\n };\r\n}\r\n//# sourceMappingURL=form-group.hook.js.map"],"names":["uuid","hasError","rolsterHasError","someErrors","rolsterSomeErrors"],"mappings":";;;;;AAGO,MAAM,mBAAmB,CAAC;AACjC,IAAI,WAAW,CAAC,OAAO,EAAE;AACzB,QAAQ,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;AACjD,QAAQ,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AACjC,QAAQ,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;AACzC,QAAQ,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;AACvC,QAAQ,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;AACzC,QAAQ,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;AACvC,QAAQ,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,OAAO,CAA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C,KAAK,EAAE,CAAC;AAC5B,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,OAAO;AACX,QAAQ,QAAQ;AAChB,QAAQ,KAAK;AACb,QAAQ,QAAQ;AAChB,QAAQ,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AACxB,QAAQ,MAAM;AACd,QAAQ,OAAO,EAAE,CAAC,KAAK;AACvB,QAAQ,QAAQ,EAAE,CAAC,KAAK;AACxB,QAAQ,WAAW,EAAE,CAAC,QAAQ;AAC9B,QAAQ,KAAK;AACb,QAAQ,aAAa;AACrB,QAAQ,OAAO;AACf,QAAQ,UAAU;AAClB,QAAQ,SAAS,EAAE,CAAC,OAAO;AAC3B,QAAQ,YAAY,EAAE,CAAC,UAAU;AACjC,QAAQ,KAAK;AACb,QAAQ,KAAK;AACb,QAAQ,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK;AAChC,KAAK,CAAC;AACN;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../esm/form-array/form-array-control.js","../esm/form-array/form-array-group.js","../esm/form-array/form-array-list.js","../esm/form-array/form-array.js","../esm/form-control.js","../esm/form-group.js"],"sourcesContent":["import { createFormControlOptions } from '@rolster/forms/arguments';\r\nimport { controlIsValid, hasError, someErrors } from '@rolster/forms/helpers';\r\nimport { v4 as uuid } from 'uuid';\r\nexport class RolsterBaseArrayControl {\r\n constructor(options) {\r\n this.initialValue = options.initialValue;\r\n this.uuid = options.uuid;\r\n this.focused = !!options.focused;\r\n this.unfocused = !this.focused;\r\n this.touched = !!options.touched;\r\n this.untouched = !this.touched;\r\n this.dirty = !!options.dirty;\r\n this.pristine = !this.dirty;\r\n this.disabled = !!options.disabled;\r\n this.enabled = !this.disabled;\r\n const { value, validators } = options;\r\n this.value = value;\r\n this.validators = validators;\r\n this.errors = validators ? controlIsValid({ value, validators }) : [];\r\n this.error = this.errors[0];\r\n }\r\n get currentInitialValue() {\r\n return this.initialValue;\r\n }\r\n focus() {\r\n this.unfocused && this.refresh({ focused: true });\r\n }\r\n blur() {\r\n this.focused && this.refresh({ focused: false, touched: true });\r\n }\r\n disable() {\r\n this.enabled && this.refresh({ disabled: true });\r\n }\r\n enable() {\r\n this.disabled && this.refresh({ disabled: false });\r\n }\r\n touch() {\r\n this.untouched && this.refresh({ touched: true });\r\n }\r\n setValue(value) {\r\n this.refresh({ value });\r\n }\r\n setValidators(validators) {\r\n this.refresh({ validators });\r\n }\r\n subscribe(subscriber) {\r\n this.subscriber = subscriber;\r\n }\r\n hasError(key) {\r\n return hasError(this.errors, key);\r\n }\r\n someErrors(keys) {\r\n return someErrors(this.errors, keys);\r\n }\r\n reset() {\r\n this.refresh({\r\n dirty: false,\r\n touched: false,\r\n value: this.currentInitialValue\r\n });\r\n }\r\n refresh(changes) {\r\n this.subscriber &&\r\n this.subscriber({\r\n ...this,\r\n ...changes,\r\n initialValue: this.initialValue\r\n });\r\n }\r\n}\r\nexport class RolsterArrayControl extends RolsterBaseArrayControl {\r\n constructor(options) {\r\n super(options);\r\n this.valid = this.errors.length === 0;\r\n this.invalid = !this.valid;\r\n this.wrong = this.touched && this.invalid;\r\n }\r\n clone(options) {\r\n return new RolsterArrayControl(options);\r\n }\r\n}\r\nfunction rolsterArrayControl(options, validators) {\r\n const controlOptions = createFormControlOptions(options, validators);\r\n return new RolsterArrayControl({\r\n ...controlOptions,\r\n initialValue: controlOptions.value,\r\n uuid: uuid()\r\n });\r\n}\r\nexport function reactArrayControl(options, validators) {\r\n return rolsterArrayControl(options, validators);\r\n}\r\nexport function formArrayControl(options, validators) {\r\n return rolsterArrayControl(options, validators);\r\n}\r\nexport function inputArrayControl(options, validators) {\r\n return rolsterArrayControl(options, validators);\r\n}\r\n//# sourceMappingURL=form-array-control.js.map","import { createFormGroupOptions } from '@rolster/forms/arguments';\r\nimport { controlsAllChecked, controlsPartialChecked, controlsToValue, groupIsValid } from '@rolster/forms/helpers';\r\nimport { v4 as uuid } from 'uuid';\r\nexport class RolsterArrayGroup {\r\n constructor(options) {\r\n const { controls, resource, uuid, validators } = options;\r\n this.uuid = uuid;\r\n this.controls = controls;\r\n this.validators = validators;\r\n this.resource = resource;\r\n this.errors = validators ? groupIsValid({ controls, validators }) : [];\r\n this.error = this.errors[0];\r\n this.valid =\r\n this.errors.length === 0 && controlsAllChecked(controls, 'valid');\r\n this.invalid = !this.valid;\r\n this.dirty = controlsPartialChecked(controls, 'dirty');\r\n this.dirtyAll = controlsAllChecked(controls, 'dirty');\r\n this.touched = controlsPartialChecked(controls, 'touched');\r\n this.touchedAll = controlsAllChecked(controls, 'touched');\r\n this.untouched = !this.touched;\r\n this.untouchedAll = !this.touchedAll;\r\n this.pristine = !this.dirty;\r\n this.pristineAll = !this.dirtyAll;\r\n this.wrong = this.touched && this.invalid;\r\n this.value = controlsToValue(controls);\r\n const subscriber = (options) => {\r\n this.update({\r\n controls: Object.entries(this.controls).reduce((controls, [key, control]) => {\r\n controls[key] =\r\n control.uuid === options.uuid ? control.clone(options) : control;\r\n return controls;\r\n }, {})\r\n });\r\n };\r\n Object.values(controls).forEach((control) => {\r\n control.subscribe(subscriber);\r\n });\r\n }\r\n setValidators(validators) {\r\n this.update({ validators });\r\n }\r\n subscribe(subscriber) {\r\n this.subscriber = subscriber;\r\n }\r\n update(changes) {\r\n this.subscriber && this.subscriber({ ...this, ...changes });\r\n }\r\n}\r\nexport function formArrayGroup(options, validators) {\r\n const groupOptions = createFormGroupOptions(options, validators);\r\n return new RolsterArrayGroup({ ...groupOptions, uuid: uuid() });\r\n}\r\n//# sourceMappingURL=form-array-group.js.map","import { controlsAllChecked, controlsToValue } from '@rolster/forms/helpers';\r\nimport { v4 as uuid } from 'uuid';\r\nimport { RolsterBaseArrayControl } from './form-array-control';\r\nexport class RolsterArrayList extends RolsterBaseArrayControl {\r\n constructor(options) {\r\n super(options);\r\n this.valueToControls = options.valueToControls;\r\n this.controls = options.value.map((value) => this.createControls(value));\r\n this.valid =\r\n this.errors.length === 0 &&\r\n this.controls.reduce((valid, controls) => valid && controlsAllChecked(controls, 'valid'), true);\r\n this.invalid = !this.valid;\r\n this.wrong = this.touched && this.invalid;\r\n }\r\n push(value) {\r\n this.refresh({ value: [...this.value, value] });\r\n }\r\n remove(controls) {\r\n this.refresh({\r\n value: this.controls\r\n .filter((currentControls) => currentControls !== controls)\r\n .map((controls) => controlsToValue(controls))\r\n });\r\n }\r\n clone(options) {\r\n return new RolsterArrayList(options);\r\n }\r\n refresh(changes) {\r\n super.refresh(changes);\r\n }\r\n createControls(value) {\r\n const controls = this.valueToControls(value);\r\n Object.values(controls).forEach((control) => {\r\n control.subscribe(() => {\r\n this.refresh({\r\n value: this.controls.map((controls) => controlsToValue(controls))\r\n });\r\n });\r\n });\r\n return controls;\r\n }\r\n}\r\nexport function formArrayList(options) {\r\n const value = options.value || [];\r\n return new RolsterArrayList({\r\n ...options,\r\n value,\r\n initialValue: value,\r\n uuid: uuid()\r\n });\r\n}\r\n//# sourceMappingURL=form-array-list.js.map","import { createFormArrayOptions } from '@rolster/forms/arguments';\r\nimport { arrayIsValid, controlsToValue, groupAllChecked, groupPartialChecked, hasError as rolsterHasError, someErrors as rolsterSomeErrors } from '@rolster/forms/helpers';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport { RolsterArrayGroup } from './form-array-group';\r\nexport function useFormArray(options, arrayValidators) {\r\n const arrayOptions = createFormArrayOptions(options, arrayValidators);\r\n const groups = arrayOptions.groups || [];\r\n const currentState = useRef(groups);\r\n const [state, setState] = useState({\r\n controls: groups.map(({ controls }) => controls),\r\n disabled: false,\r\n groups,\r\n value: groups.map(({ controls }) => controlsToValue(controls)),\r\n validators: arrayOptions.validators\r\n });\r\n const errors = state.validators\r\n ? arrayIsValid({ groups, validators: state.validators })\r\n : [];\r\n const error = errors[0];\r\n const valid = errors.length === 0 && groupAllChecked(state.groups, 'valid');\r\n const dirty = groupPartialChecked(state.groups, 'dirty');\r\n const dirtyAll = groupAllChecked(state.groups, 'dirty');\r\n const touched = groupPartialChecked(state.groups, 'touched');\r\n const touchedAll = groupAllChecked(state.groups, 'touched');\r\n useEffect(() => {\r\n const subscriber = (options) => {\r\n setGroups(state.groups.map((group) => group.uuid === options.uuid\r\n ? new RolsterArrayGroup(options)\r\n : group));\r\n };\r\n state.groups.forEach((group) => {\r\n group.subscribe(subscriber);\r\n });\r\n }, [state.groups]);\r\n function disable() {\r\n setState((state) => ({ ...state, disabled: true }));\r\n }\r\n function enable() {\r\n setState((state) => ({ ...state, disabled: false }));\r\n }\r\n function setGroups(groups) {\r\n setState((currentState) => ({\r\n ...currentState,\r\n groups,\r\n controls: groups.map(({ controls }) => controls),\r\n value: groups.map(({ controls }) => controlsToValue(controls))\r\n }));\r\n }\r\n function push(group) {\r\n setGroups([...state.groups, group]);\r\n }\r\n function merge(groups) {\r\n setGroups([...state.groups, ...groups]);\r\n }\r\n function set(groups) {\r\n setGroups(groups);\r\n }\r\n function remove({ uuid }) {\r\n setGroups(state.groups.filter((group) => group.uuid !== uuid));\r\n }\r\n function hasError(key) {\r\n return rolsterHasError(errors, key);\r\n }\r\n function someErrors(keys) {\r\n return rolsterSomeErrors(errors, keys);\r\n }\r\n function reset() {\r\n setGroups(currentState.current);\r\n }\r\n function setValidators(validators) {\r\n setState((state) => ({ ...state, validators }));\r\n }\r\n return {\r\n ...state,\r\n dirty,\r\n dirtyAll,\r\n disable,\r\n enable,\r\n enabled: !state.disabled,\r\n error,\r\n errors,\r\n hasError,\r\n invalid: !valid,\r\n merge,\r\n pristine: !dirty,\r\n pristineAll: !dirtyAll,\r\n push,\r\n remove,\r\n reset,\r\n set,\r\n setValidators,\r\n someErrors,\r\n touched,\r\n touchedAll,\r\n untouched: !touched,\r\n untouchedAll: !touchedAll,\r\n valid,\r\n wrong: touched && !valid\r\n };\r\n}\r\n//# sourceMappingURL=form-array.js.map","import { createFormControlOptions } from '@rolster/forms/arguments';\r\nimport { controlIsValid, hasError as rolsterHasError, someErrors as rolsterSomeErrors } from '@rolster/forms/helpers';\r\nimport { useRef, useState } from 'react';\r\nfunction useControl(controlOptions, controlValidators) {\r\n const { value, touched, validators } = createFormControlOptions(controlOptions, controlValidators);\r\n const [state, setState] = useState({\r\n dirty: false,\r\n disabled: false,\r\n focused: false,\r\n touched: !!touched,\r\n validators,\r\n value\r\n });\r\n const initialValue = useRef(value);\r\n const elementRef = useRef(null);\r\n const errors = state.validators\r\n ? controlIsValid({\r\n value: state.value,\r\n validators: state.validators\r\n })\r\n : [];\r\n const valid = errors.length === 0;\r\n function focus() {\r\n setState((state) => ({ ...state, focused: true }));\r\n }\r\n function blur() {\r\n setState((state) => ({ ...state, focused: false, touched: true }));\r\n }\r\n function disable() {\r\n setState((state) => ({ ...state, disabled: true }));\r\n }\r\n function enable() {\r\n setState((state) => ({ ...state, disabled: false }));\r\n }\r\n function touch() {\r\n setState((state) => ({ ...state, touched: true }));\r\n }\r\n function setValue(value) {\r\n setState((state) => ({ ...state, dirty: true, value }));\r\n }\r\n function setValidators(validators) {\r\n setState((state) => ({ ...state, validators }));\r\n }\r\n function hasError(key) {\r\n return rolsterHasError(errors, key);\r\n }\r\n function someErrors(keys) {\r\n return rolsterSomeErrors(errors, keys);\r\n }\r\n function reset() {\r\n setState((state) => ({\r\n ...state,\r\n dirty: false,\r\n value: initialValue.current,\r\n touched: false\r\n }));\r\n }\r\n return {\r\n ...state,\r\n blur,\r\n disable,\r\n elementRef,\r\n enable,\r\n enabled: !state.disabled,\r\n error: errors[0],\r\n errors,\r\n focus,\r\n hasError,\r\n invalid: !valid,\r\n pristine: !state.dirty,\r\n reset,\r\n setValidators,\r\n setValue,\r\n someErrors,\r\n touch,\r\n unfocused: !state.focused,\r\n untouched: !state.touched,\r\n valid,\r\n wrong: state.touched && !valid\r\n };\r\n}\r\nexport function useReactControl(options, validators) {\r\n return useControl(options, validators);\r\n}\r\nexport function useFormControl(options, validators) {\r\n return useControl(options, validators);\r\n}\r\nexport function useInputControl(options, validators) {\r\n return useControl(options, validators);\r\n}\r\n//# sourceMappingURL=form-control.js.map","import { createFormGroupOptions } from '@rolster/forms/arguments';\r\nimport { controlsAllChecked, controlsPartialChecked, controlsToValue, groupIsValid } from '@rolster/forms/helpers';\r\nimport { useState } from 'react';\r\nexport function useFormGroup(options, groupValidators) {\r\n const groupOptions = createFormGroupOptions(options, groupValidators);\r\n const [validators, setValidators] = useState(groupOptions.validators);\r\n const { controls } = groupOptions;\r\n const errors = validators ? groupIsValid({ controls, validators }) : [];\r\n const valid = errors.length === 0 && controlsAllChecked(controls, 'valid');\r\n const value = controlsToValue(controls);\r\n const dirty = controlsPartialChecked(controls, 'dirty');\r\n const dirtyAll = controlsAllChecked(controls, 'dirty');\r\n const touched = controlsPartialChecked(controls, 'touched');\r\n const touchedAll = controlsAllChecked(controls, 'touched');\r\n function reset() {\r\n Object.values(controls).forEach((control) => {\r\n control.reset();\r\n });\r\n }\r\n return {\r\n controls,\r\n dirty,\r\n dirtyAll,\r\n error: errors[0],\r\n errors,\r\n invalid: !valid,\r\n pristine: !dirty,\r\n pristineAll: !dirtyAll,\r\n reset,\r\n setValidators,\r\n touched,\r\n touchedAll,\r\n untouched: !touched,\r\n untouchedAll: !touchedAll,\r\n valid,\r\n value,\r\n wrong: touched && !valid\r\n };\r\n}\r\n//# sourceMappingURL=form-group.js.map"],"names":["uuid","hasError","rolsterHasError","someErrors","rolsterSomeErrors"],"mappings":";;;;;AAGO,MAAM,uBAAuB,CAAC;AACrC,IAAI,WAAW,CAAC,OAAO,EAAE;AACzB,QAAQ,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;AACjD,QAAQ,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AACjC,QAAQ,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;AACzC,QAAQ,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;AACvC,QAAQ,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;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AAS,CAAC,CAAC;AAChE,IAAI,MAAM,UAAU,GAAG,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC/D,IAAI,SAAS,KAAK,GAAG;AACrB,QAAQ,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,KAAK;AACrD,YAAY,OAAO,CAAC,KAAK,EAAE,CAAC;AAC5B,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,OAAO;AACX,QAAQ,QAAQ;AAChB,QAAQ,KAAK;AACb,QAAQ,QAAQ;AAChB,QAAQ,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AACxB,QAAQ,MAAM;AACd,QAAQ,OAAO,EAAE,CAAC,KAAK;AACvB,QAAQ,QAAQ,EAAE,CAAC,KAAK;AACxB,QAAQ,WAAW,EAAE,CAAC,QAAQ;AAC9B,QAAQ,KAAK;AACb,QAAQ,aAAa;AACrB,QAAQ,OAAO;AACf,QAAQ,UAAU;AAClB,QAAQ,SAAS,EAAE,CAAC,OAAO;AAC3B,QAAQ,YAAY,EAAE,CAAC,UAAU;AACjC,QAAQ,KAAK;AACb,QAAQ,KAAK;AACb,QAAQ,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK;AAChC,KAAK,CAAC;AACN;;;;"}
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
import { FormArrayControlOptions } from '@rolster/forms';
|
|
2
2
|
import { ValidatorError, ValidatorFn } from '@rolster/validators';
|
|
3
3
|
import { RefObject } from 'react';
|
|
4
|
-
import { ReactArrayControl, ReactArrayControlOptions,
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { ReactArrayControl, ReactArrayControlOptions, ReactHtmlArrayControl, ReactInputArrayControl, ReactSubscriberControl } from '../types';
|
|
5
|
+
type BaseReactArrayControl<E extends HTMLElement = HTMLElement, T = any> = Omit<ReactArrayControl<E, T>, 'clone' | 'invalid' | 'valid' | 'wrong'>;
|
|
6
|
+
export declare class RolsterBaseArrayControl<E extends HTMLElement = HTMLElement, T = any> implements BaseReactArrayControl<E, T> {
|
|
7
|
+
readonly errors: ValidatorError<T>[];
|
|
7
8
|
readonly value: T;
|
|
8
|
-
readonly
|
|
9
|
-
readonly unfocused: boolean;
|
|
9
|
+
readonly dirty: boolean;
|
|
10
10
|
readonly disabled: boolean;
|
|
11
11
|
readonly enabled: boolean;
|
|
12
|
+
readonly focused: boolean;
|
|
13
|
+
readonly pristine: boolean;
|
|
12
14
|
readonly touched: boolean;
|
|
15
|
+
readonly unfocused: boolean;
|
|
16
|
+
readonly uuid: string;
|
|
13
17
|
readonly untouched: boolean;
|
|
14
|
-
readonly dirty: boolean;
|
|
15
|
-
readonly pristine: boolean;
|
|
16
|
-
readonly valid: boolean;
|
|
17
|
-
readonly invalid: boolean;
|
|
18
|
-
readonly wrong: boolean;
|
|
19
|
-
readonly errors: ValidatorError<T>[];
|
|
20
18
|
readonly error?: ValidatorError<T>;
|
|
21
19
|
readonly validators?: ValidatorFn<T>[];
|
|
22
20
|
elementRef?: RefObject<E>;
|
|
23
21
|
private initialValue;
|
|
24
|
-
|
|
22
|
+
protected subscriber?: ReactSubscriberControl<T>;
|
|
25
23
|
constructor(options: ReactArrayControlOptions<T>);
|
|
24
|
+
protected get currentInitialValue(): T;
|
|
26
25
|
focus(): void;
|
|
27
26
|
blur(): void;
|
|
28
27
|
disable(): void;
|
|
@@ -30,31 +29,38 @@ export declare class RolsterArrayControl<E extends HTMLElement = HTMLElement, T
|
|
|
30
29
|
touch(): void;
|
|
31
30
|
setValue(value: T): void;
|
|
32
31
|
setValidators(validators?: ValidatorFn<T>[]): void;
|
|
33
|
-
subscribe(
|
|
32
|
+
subscribe(subscriber: ReactSubscriberControl<T>): void;
|
|
34
33
|
hasError(key: string): boolean;
|
|
35
34
|
someErrors(keys: string[]): boolean;
|
|
36
35
|
reset(): void;
|
|
37
|
-
|
|
36
|
+
protected refresh(changes: Partial<ReactArrayControlOptions<T>>): void;
|
|
37
|
+
}
|
|
38
|
+
export declare class RolsterArrayControl<E extends HTMLElement = HTMLElement, T = any> extends RolsterBaseArrayControl<E, T> implements ReactArrayControl<E, T> {
|
|
39
|
+
readonly invalid: boolean;
|
|
40
|
+
readonly valid: boolean;
|
|
41
|
+
readonly wrong: boolean;
|
|
42
|
+
constructor(options: ReactArrayControlOptions<T>);
|
|
43
|
+
clone(options: ReactArrayControlOptions<T>): RolsterArrayControl<E, T>;
|
|
38
44
|
}
|
|
39
45
|
interface ReactControlOptions<T = any> extends Omit<FormArrayControlOptions<T>, 'uuid'> {
|
|
40
46
|
touched?: boolean;
|
|
41
47
|
}
|
|
42
|
-
type
|
|
43
|
-
type ReactValidatorsOptions<T> = Omit<ReactControlOptions<T>, '
|
|
48
|
+
type ReactValueOptions<T> = Omit<ReactControlOptions<T>, 'validators'>;
|
|
49
|
+
type ReactValidatorsOptions<T> = Omit<ReactControlOptions<T>, 'value'>;
|
|
44
50
|
export declare function reactArrayControl<E extends HTMLElement, T>(): ReactArrayControl<E, T | undefined>;
|
|
45
|
-
export declare function reactArrayControl<E extends HTMLElement, T>(options:
|
|
51
|
+
export declare function reactArrayControl<E extends HTMLElement, T>(options: ReactValueOptions<T>): ReactArrayControl<E, T>;
|
|
46
52
|
export declare function reactArrayControl<E extends HTMLElement, T>(options: ReactValidatorsOptions<T>): ReactArrayControl<E, T | undefined>;
|
|
47
53
|
export declare function reactArrayControl<E extends HTMLElement, T>(options: ReactControlOptions<T>): ReactArrayControl<E, T>;
|
|
48
54
|
export declare function reactArrayControl<E extends HTMLElement, T>(value: undefined, validators?: ValidatorFn<T>[]): ReactArrayControl<E, T | undefined>;
|
|
49
55
|
export declare function reactArrayControl<E extends HTMLElement, T>(value: T, validators?: ValidatorFn<T>[]): ReactArrayControl<E, T>;
|
|
50
56
|
export declare function formArrayControl<T>(): ReactHtmlArrayControl<T | undefined>;
|
|
51
|
-
export declare function formArrayControl<T>(options:
|
|
57
|
+
export declare function formArrayControl<T>(options: ReactValueOptions<T>): ReactHtmlArrayControl<T>;
|
|
52
58
|
export declare function formArrayControl<T>(options: ReactValidatorsOptions<T>): ReactHtmlArrayControl<T | undefined>;
|
|
53
59
|
export declare function formArrayControl<T>(options: ReactControlOptions<T>): ReactHtmlArrayControl<T>;
|
|
54
60
|
export declare function formArrayControl<T>(value: undefined, validators?: ValidatorFn<T>[]): ReactHtmlArrayControl<T | undefined>;
|
|
55
61
|
export declare function formArrayControl<T>(value: T, validators?: ValidatorFn<T>[]): ReactHtmlArrayControl<T>;
|
|
56
62
|
export declare function inputArrayControl<T>(): ReactInputArrayControl<T | undefined>;
|
|
57
|
-
export declare function inputArrayControl<T>(options:
|
|
63
|
+
export declare function inputArrayControl<T>(options: ReactValueOptions<T>): ReactInputArrayControl<T>;
|
|
58
64
|
export declare function inputArrayControl<T>(options: ReactValidatorsOptions<T>): ReactInputArrayControl<T | undefined>;
|
|
59
65
|
export declare function inputArrayControl<T>(options: ReactControlOptions<T>): ReactInputArrayControl<T>;
|
|
60
66
|
export declare function inputArrayControl<T>(value: undefined, validators?: ValidatorFn<T>[]): ReactInputArrayControl<T | undefined>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createFormControlOptions } from '@rolster/forms/arguments';
|
|
2
2
|
import { controlIsValid, hasError, someErrors } from '@rolster/forms/helpers';
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
|
-
export class
|
|
4
|
+
export class RolsterBaseArrayControl {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
this.initialValue = options.initialValue;
|
|
7
7
|
this.uuid = options.uuid;
|
|
@@ -18,33 +18,33 @@ export class RolsterArrayControl {
|
|
|
18
18
|
this.validators = validators;
|
|
19
19
|
this.errors = validators ? controlIsValid({ value, validators }) : [];
|
|
20
20
|
this.error = this.errors[0];
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
}
|
|
22
|
+
get currentInitialValue() {
|
|
23
|
+
return this.initialValue;
|
|
24
24
|
}
|
|
25
25
|
focus() {
|
|
26
|
-
this.unfocused && this.
|
|
26
|
+
this.unfocused && this.refresh({ focused: true });
|
|
27
27
|
}
|
|
28
28
|
blur() {
|
|
29
|
-
this.focused && this.
|
|
29
|
+
this.focused && this.refresh({ focused: false, touched: true });
|
|
30
30
|
}
|
|
31
31
|
disable() {
|
|
32
|
-
this.enabled && this.
|
|
32
|
+
this.enabled && this.refresh({ disabled: true });
|
|
33
33
|
}
|
|
34
34
|
enable() {
|
|
35
|
-
this.disabled && this.
|
|
35
|
+
this.disabled && this.refresh({ disabled: false });
|
|
36
36
|
}
|
|
37
37
|
touch() {
|
|
38
|
-
this.untouched && this.
|
|
38
|
+
this.untouched && this.refresh({ touched: true });
|
|
39
39
|
}
|
|
40
40
|
setValue(value) {
|
|
41
|
-
this.
|
|
41
|
+
this.refresh({ value });
|
|
42
42
|
}
|
|
43
43
|
setValidators(validators) {
|
|
44
|
-
this.
|
|
44
|
+
this.refresh({ validators });
|
|
45
45
|
}
|
|
46
|
-
subscribe(
|
|
47
|
-
this.subscriber =
|
|
46
|
+
subscribe(subscriber) {
|
|
47
|
+
this.subscriber = subscriber;
|
|
48
48
|
}
|
|
49
49
|
hasError(key) {
|
|
50
50
|
return hasError(this.errors, key);
|
|
@@ -53,9 +53,13 @@ export class RolsterArrayControl {
|
|
|
53
53
|
return someErrors(this.errors, keys);
|
|
54
54
|
}
|
|
55
55
|
reset() {
|
|
56
|
-
this.
|
|
56
|
+
this.refresh({
|
|
57
|
+
dirty: false,
|
|
58
|
+
touched: false,
|
|
59
|
+
value: this.currentInitialValue
|
|
60
|
+
});
|
|
57
61
|
}
|
|
58
|
-
|
|
62
|
+
refresh(changes) {
|
|
59
63
|
this.subscriber &&
|
|
60
64
|
this.subscriber({
|
|
61
65
|
...this,
|
|
@@ -64,21 +68,32 @@ export class RolsterArrayControl {
|
|
|
64
68
|
});
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
|
-
|
|
71
|
+
export class RolsterArrayControl extends RolsterBaseArrayControl {
|
|
72
|
+
constructor(options) {
|
|
73
|
+
super(options);
|
|
74
|
+
this.valid = this.errors.length === 0;
|
|
75
|
+
this.invalid = !this.valid;
|
|
76
|
+
this.wrong = this.touched && this.invalid;
|
|
77
|
+
}
|
|
78
|
+
clone(options) {
|
|
79
|
+
return new RolsterArrayControl(options);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function rolsterArrayControl(options, validators) {
|
|
68
83
|
const controlOptions = createFormControlOptions(options, validators);
|
|
69
84
|
return new RolsterArrayControl({
|
|
70
85
|
...controlOptions,
|
|
71
|
-
|
|
72
|
-
|
|
86
|
+
initialValue: controlOptions.value,
|
|
87
|
+
uuid: uuid()
|
|
73
88
|
});
|
|
74
89
|
}
|
|
75
90
|
export function reactArrayControl(options, validators) {
|
|
76
|
-
return
|
|
91
|
+
return rolsterArrayControl(options, validators);
|
|
77
92
|
}
|
|
78
93
|
export function formArrayControl(options, validators) {
|
|
79
|
-
return
|
|
94
|
+
return rolsterArrayControl(options, validators);
|
|
80
95
|
}
|
|
81
96
|
export function inputArrayControl(options, validators) {
|
|
82
|
-
return
|
|
97
|
+
return rolsterArrayControl(options, validators);
|
|
83
98
|
}
|
|
84
|
-
//# sourceMappingURL=form-array-control.
|
|
99
|
+
//# sourceMappingURL=form-array-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-array-control.js","sourceRoot":"","sources":["../../../src/form-array/form-array-control.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAG9E,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAclC,MAAM,OAAO,uBAAuB;IAqClC,YAAY,OAAoC;QAC9C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC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Q,uBAA6B;IASrC,YAAY,OAAoC;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;IAC5C,CAAC;IAEM,KAAK,CACV,OAAoC;QAEpC,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF;AAOD,SAAS,mBAAmB,CAC1B,OAAoC,EACpC,UAA6B;IAE7B,MAAM,cAAc,GAAG,wBAAwB,CAC7C,OAAO,EACP,UAAU,CACX,CAAC;IAEF,OAAO,IAAI,mBAAmB,CAAC;QAC7B,GAAG,cAAc;QACjB,YAAY,EAAE,cAAc,CAAC,KAAK;QAClC,IAAI,EAAE,IAAI,EAAE;KACb,CAAC,CAAC;AACL,CAAC;AA0BD,MAAM,UAAU,iBAAiB,CAC/B,OAAoC,EACpC,UAA6B;IAE7B,OAAO,mBAAmB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AAClD,CAAC;AAoBD,MAAM,UAAU,gBAAgB,CAC9B,OAAoC,EACpC,UAA6B;IAE7B,OAAO,mBAAmB,CAAc,OAAO,EAAE,UAAU,CAAC,CAAC;AAC/D,CAAC;AAoBD,MAAM,UAAU,iBAAiB,CAC/B,OAAoC,EACpC,UAA6B;IAE7B,OAAO,mBAAmB,CAAmB,OAAO,EAAE,UAAU,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ControlsValue, FormArrayGroupOptions, ValidatorGroupFn } from '@rolster/forms';
|
|
2
2
|
import { ValidatorError } from '@rolster/validators';
|
|
3
3
|
import { ReactArrayControls, ReactArrayGroup, ReactSubscriberGroup } from '../types';
|
|
4
4
|
export declare class RolsterArrayGroup<C extends ReactArrayControls = ReactArrayControls, R = any> implements ReactArrayGroup<C, R> {
|
|
5
5
|
readonly uuid: string;
|
|
6
6
|
readonly controls: C;
|
|
7
|
-
readonly value:
|
|
7
|
+
readonly value: ControlsValue<C>;
|
|
8
8
|
readonly dirty: boolean;
|
|
9
9
|
readonly dirtyAll: boolean;
|
|
10
10
|
readonly errors: ValidatorError<any>[];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createFormGroupOptions } from '@rolster/forms/arguments';
|
|
2
2
|
import { controlsAllChecked, controlsPartialChecked, controlsToValue, groupIsValid } from '@rolster/forms/helpers';
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
|
-
import { RolsterArrayControl } from './form-array-control.hook';
|
|
5
4
|
export class RolsterArrayGroup {
|
|
6
5
|
constructor(options) {
|
|
7
6
|
const { controls, resource, uuid, validators } = options;
|
|
@@ -28,9 +27,7 @@ export class RolsterArrayGroup {
|
|
|
28
27
|
this.update({
|
|
29
28
|
controls: Object.entries(this.controls).reduce((controls, [key, control]) => {
|
|
30
29
|
controls[key] =
|
|
31
|
-
control.uuid === options.uuid
|
|
32
|
-
? new RolsterArrayControl(options)
|
|
33
|
-
: control;
|
|
30
|
+
control.uuid === options.uuid ? control.clone(options) : control;
|
|
34
31
|
return controls;
|
|
35
32
|
}, {})
|
|
36
33
|
});
|
|
@@ -53,4 +50,4 @@ export function formArrayGroup(options, validators) {
|
|
|
53
50
|
const groupOptions = createFormGroupOptions(options, validators);
|
|
54
51
|
return new RolsterArrayGroup({ ...groupOptions, uuid: uuid() });
|
|
55
52
|
}
|
|
56
|
-
//# sourceMappingURL=form-array-group.
|
|
53
|
+
//# sourceMappingURL=form-array-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-array-group.js","sourceRoot":"","sources":["../../../src/form-array/form-array-group.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,E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AAI,CAAC,UAAU,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF;AAeD,MAAM,UAAU,cAAc,CAI5B,OAAsC,EACtC,UAAqC;IAErC,MAAM,YAAY,GAAG,sBAAsB,CACzC,OAAO,EACP,UAAU,CACX,CAAC;IAEF,OAAO,IAAI,iBAAiB,CAAC,EAAE,GAAG,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ArrayControlsValue, ArrayListValueToControls } from '@rolster/forms';
|
|
2
|
+
import { ValidatorFn } from '@rolster/validators';
|
|
3
|
+
import { ReactArrayControls, ReactArrayList, ReactArrayListOptions } from '../types';
|
|
4
|
+
import { RolsterBaseArrayControl } from './form-array-control';
|
|
5
|
+
export declare class RolsterArrayList<E extends HTMLElement = HTMLElement, C extends ReactArrayControls = ReactArrayControls> extends RolsterBaseArrayControl<E, ArrayControlsValue<C>[]> implements ReactArrayList<C> {
|
|
6
|
+
readonly controls: C[];
|
|
7
|
+
readonly invalid: boolean;
|
|
8
|
+
readonly valid: boolean;
|
|
9
|
+
readonly wrong: boolean;
|
|
10
|
+
protected valueToControls: ArrayListValueToControls<C>;
|
|
11
|
+
constructor(options: ReactArrayListOptions<C>);
|
|
12
|
+
push(value: ArrayControlsValue<C>): void;
|
|
13
|
+
remove(controls: C): void;
|
|
14
|
+
clone(options: ReactArrayListOptions<C>): RolsterArrayList<E, C>;
|
|
15
|
+
protected refresh(changes: Partial<ReactArrayListOptions<C>>): void;
|
|
16
|
+
private createControls;
|
|
17
|
+
}
|
|
18
|
+
interface ReactListOptions<C extends ReactArrayControls = ReactArrayControls> {
|
|
19
|
+
valueToControls: ArrayListValueToControls<C>;
|
|
20
|
+
touched?: boolean;
|
|
21
|
+
validators?: ValidatorFn<ArrayControlsValue<C>[] | undefined>[];
|
|
22
|
+
value?: ArrayControlsValue<C>[] | undefined;
|
|
23
|
+
}
|
|
24
|
+
export declare function formArrayList<C extends ReactArrayControls = ReactArrayControls>(options: ReactListOptions<C>): ReactArrayList<C>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { controlsAllChecked, controlsToValue } from '@rolster/forms/helpers';
|
|
2
|
+
import { v4 as uuid } from 'uuid';
|
|
3
|
+
import { RolsterBaseArrayControl } from './form-array-control';
|
|
4
|
+
export class RolsterArrayList extends RolsterBaseArrayControl {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
super(options);
|
|
7
|
+
this.valueToControls = options.valueToControls;
|
|
8
|
+
this.controls = options.value.map((value) => this.createControls(value));
|
|
9
|
+
this.valid =
|
|
10
|
+
this.errors.length === 0 &&
|
|
11
|
+
this.controls.reduce((valid, controls) => valid && controlsAllChecked(controls, 'valid'), true);
|
|
12
|
+
this.invalid = !this.valid;
|
|
13
|
+
this.wrong = this.touched && this.invalid;
|
|
14
|
+
}
|
|
15
|
+
push(value) {
|
|
16
|
+
this.refresh({ value: [...this.value, value] });
|
|
17
|
+
}
|
|
18
|
+
remove(controls) {
|
|
19
|
+
this.refresh({
|
|
20
|
+
value: this.controls
|
|
21
|
+
.filter((currentControls) => currentControls !== controls)
|
|
22
|
+
.map((controls) => controlsToValue(controls))
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
clone(options) {
|
|
26
|
+
return new RolsterArrayList(options);
|
|
27
|
+
}
|
|
28
|
+
refresh(changes) {
|
|
29
|
+
super.refresh(changes);
|
|
30
|
+
}
|
|
31
|
+
createControls(value) {
|
|
32
|
+
const controls = this.valueToControls(value);
|
|
33
|
+
Object.values(controls).forEach((control) => {
|
|
34
|
+
control.subscribe(() => {
|
|
35
|
+
this.refresh({
|
|
36
|
+
value: this.controls.map((controls) => controlsToValue(controls))
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
return controls;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function formArrayList(options) {
|
|
44
|
+
const value = options.value || [];
|
|
45
|
+
return new RolsterArrayList({
|
|
46
|
+
...options,
|
|
47
|
+
value,
|
|
48
|
+
initialValue: value,
|
|
49
|
+
uuid: uuid()
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=form-array-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-array-list.js","sourceRoot":"","sources":["../../../src/form-array/form-array-list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE7E,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAMlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,OAAO,gBAIX,SAAQ,uBAAmD;IAa3D,YAAY,OAAiC;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAE/C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;QAEzE,IAAI,CAAC,KAAK;YACR,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;gBACxB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAClB,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,KAAK,IAAI,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,EACnE,IAAI,CACL,CAAC;QAEJ,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;IAC5C,CAAC;IAEM,IAAI,CAAC,KAA4B;QACtC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AK;QACnB,IAAI,EAAE,IAAI,EAAE;KACb,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createFormArrayOptions } from '@rolster/forms/arguments';
|
|
2
2
|
import { arrayIsValid, controlsToValue, groupAllChecked, groupPartialChecked, hasError as rolsterHasError, someErrors as rolsterSomeErrors } from '@rolster/forms/helpers';
|
|
3
3
|
import { useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { RolsterArrayGroup } from './form-array-group
|
|
4
|
+
import { RolsterArrayGroup } from './form-array-group';
|
|
5
5
|
export function useFormArray(options, arrayValidators) {
|
|
6
6
|
const arrayOptions = createFormArrayOptions(options, arrayValidators);
|
|
7
7
|
const groups = arrayOptions.groups || [];
|
|
@@ -98,4 +98,4 @@ export function useFormArray(options, arrayValidators) {
|
|
|
98
98
|
wrong: touched && !valid
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
//# sourceMappingURL=form-array.
|
|
101
|
+
//# sourceMappingURL=form-array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-array.js","sourceRoot":"","sources":["../../../src/form-array/form-array.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,QAAQ,IAAI,eAAe,EAC3B,UAAU,IAAI,iBAAiB,EAChC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAOpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAgCvD,MAAM,UAAU,YAAY,CAK1B,OAA6D,EAC7D,eAA0C;IAE1C,MAAM,YAAY,GAAG,sBAAsB,CAKzC,OAAO,EAAE,eAAe,CAAC,CAAC;IAE5B,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,IAAI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-1,3 +1,4 @@
|
|
|
1
|
-
export { formArrayControl, inputArrayControl, reactArrayControl } from './form-array-control
|
|
2
|
-
export { formArrayGroup } from './form-array-group
|
|
3
|
-
export {
|
|
1
|
+
export { formArrayControl, inputArrayControl, reactArrayControl } from './form-array-control';
|
|
2
|
+
export { formArrayGroup } from './form-array-group';
|
|
3
|
+
export { formArrayList } from './form-array-list';
|
|
4
|
+
export { useFormArray } from './form-array';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { formArrayControl, inputArrayControl, reactArrayControl } from './form-array-control
|
|
2
|
-
export { formArrayGroup } from './form-array-group
|
|
3
|
-
export {
|
|
1
|
+
export { formArrayControl, inputArrayControl, reactArrayControl } from './form-array-control';
|
|
2
|
+
export { formArrayGroup } from './form-array-group';
|
|
3
|
+
export { formArrayList } from './form-array-list';
|
|
4
|
+
export { useFormArray } from './form-array';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/form-array/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/form-array/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -4,22 +4,22 @@ import { ReactFormControl, ReactHtmlControl, ReactInputControl } from './types';
|
|
|
4
4
|
interface ReactControlOptions<T = any> extends FormControlOptions<T> {
|
|
5
5
|
touched?: boolean;
|
|
6
6
|
}
|
|
7
|
-
type
|
|
7
|
+
type ReactValueOptions<T> = Omit<ReactControlOptions<T>, 'validators'>;
|
|
8
8
|
type ReactValidatorsOptions<T> = Omit<ReactControlOptions<T>, 'value'>;
|
|
9
9
|
export declare function useReactControl<E extends HTMLElement, T>(): ReactFormControl<E, T | undefined>;
|
|
10
|
-
export declare function useReactControl<E extends HTMLElement, T>(options:
|
|
10
|
+
export declare function useReactControl<E extends HTMLElement, T>(options: ReactValueOptions<T>): ReactFormControl<E, T>;
|
|
11
11
|
export declare function useReactControl<E extends HTMLElement, T>(options: ReactValidatorsOptions<T>): ReactFormControl<E, T | undefined>;
|
|
12
12
|
export declare function useReactControl<E extends HTMLElement, T>(options: ReactControlOptions<T>): ReactFormControl<E, T>;
|
|
13
13
|
export declare function useReactControl<E extends HTMLElement, T>(value: undefined, validators?: ValidatorFn<T>[]): ReactFormControl<E, T | undefined>;
|
|
14
14
|
export declare function useReactControl<E extends HTMLElement, T>(value: T, validators?: ValidatorFn<T>[]): ReactFormControl<E, T>;
|
|
15
15
|
export declare function useFormControl<T>(): ReactHtmlControl<T | undefined>;
|
|
16
|
-
export declare function useFormControl<T>(options:
|
|
16
|
+
export declare function useFormControl<T>(options: ReactValueOptions<T>): ReactHtmlControl<T>;
|
|
17
17
|
export declare function useFormControl<T>(options: ReactValidatorsOptions<T>): ReactHtmlControl<T | undefined>;
|
|
18
18
|
export declare function useFormControl<T>(options: ReactControlOptions<T>): ReactHtmlControl<T>;
|
|
19
19
|
export declare function useFormControl<T>(value: undefined, validators?: ValidatorFn<T>[]): ReactHtmlControl<T | undefined>;
|
|
20
20
|
export declare function useFormControl<T>(value: T, validators?: ValidatorFn<T>[]): ReactHtmlControl<T>;
|
|
21
21
|
export declare function useInputControl<T>(): ReactInputControl<T | undefined>;
|
|
22
|
-
export declare function useInputControl<T>(options:
|
|
22
|
+
export declare function useInputControl<T>(options: ReactValueOptions<T>): ReactInputControl<T>;
|
|
23
23
|
export declare function useInputControl<T>(options: ReactValidatorsOptions<T>): ReactInputControl<T | undefined>;
|
|
24
24
|
export declare function useInputControl<T>(options: ReactControlOptions<T>): ReactInputControl<T>;
|
|
25
25
|
export declare function useInputControl<T>(value: undefined, validators?: ValidatorFn<T>[]): ReactInputControl<T | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-control.js","sourceRoot":"","sources":["../../src/form-control.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,cAAc,EACd,QAAQ,IAAI,eAAe,EAC3B,UAAU,IAAI,iBAAiB,EAChC,MAAM,wBAAwB,CAAC;AAEhC,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,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAkB;QAClD,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,UAAU;QACV,KAAK;KACN,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,MAAM,CAAI,KAAK,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,MAAM,CAAI,IAAI,CAAC,CAAC;IAEnC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU;QAC7B,CAAC,CAAC,cAAc,CAAC;YACb,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,UAAU,EAAE,KAAK,CAAC,UAAU;SAC7B,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;IAElC,SAAS,KAAK;QACZ,QAAQ,CAAC,CAAC,KAAK,EAAE,E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QAChB,MAAM;QACN,OAAO,EAAE,CAAC,KAAK;QACf,QAAQ,EAAE,CAAC,KAAK;QAChB,WAAW,EAAE,CAAC,QAAQ;QACtB,KAAK;QACL,aAAa;QACb,OAAO;QACP,UAAU;QACV,SAAS,EAAE,CAAC,OAAO;QACnB,YAAY,EAAE,CAAC,UAAU;QACzB,KAAK;QACL,KAAK;QACL,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -10,8 +10,8 @@ type TextRefOptions = InputRefOptions<string>;
|
|
|
10
10
|
type NumberRefOptions = InputRefOptions<number>;
|
|
11
11
|
export declare function useTextRefControl(): ReactInputControl<string>;
|
|
12
12
|
export declare function useTextRefControl(options: TextRefOptions): ReactInputControl<string>;
|
|
13
|
-
export declare function useTextRefControl(
|
|
13
|
+
export declare function useTextRefControl(value: string, validators?: ValidatorFn<string>[]): ReactInputControl<string>;
|
|
14
14
|
export declare function useNumberRefControl(): ReactInputControl<number>;
|
|
15
15
|
export declare function useNumberRefControl(options: NumberRefOptions): ReactInputControl<number>;
|
|
16
|
-
export declare function useNumberRefControl(
|
|
16
|
+
export declare function useNumberRefControl(value: number, validators?: ValidatorFn<number>[]): ReactInputControl<number>;
|
|
17
17
|
export {};
|