@rolster/react-forms 18.11.4 → 18.12.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.
@@ -1 +1 @@
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","../../node_modules/@rolster/i18n/dist/esm/enums.js","../../node_modules/@rolster/i18n/dist/esm/i18n.js","../esm/form-array/form-array.js","../esm/form-control.js","../esm/form-group.js","../esm/helpers.js"],"sourcesContent":["import { createFormControlOptions } from '@rolster/forms/arguments';\nimport { controlIsValid, hasError, someErrors } from '@rolster/forms/helpers';\nimport { v4 as uuid } from 'uuid';\nexport class RolsterReactArrayControl {\n constructor(options) {\n this.initialValue = options.initialValue;\n this.uuid = options.uuid;\n this.focused = !!options.focused;\n this.unfocused = !this.focused;\n this.touched = !!options.touched;\n this.untouched = !this.touched;\n this.dirty = !!options.dirty;\n this.pristine = !this.dirty;\n this.disabled = !!options.disabled;\n this.enabled = !this.disabled;\n const { value, validators } = options;\n this.value = value;\n this.validators = validators;\n this.errors = validators ? controlIsValid({ value, validators }) : [];\n this.error = this.errors[0];\n }\n focus() {\n this.unfocused && this.refresh({ focused: true });\n }\n blur() {\n this.focused && this.refresh({ focused: false, touched: true });\n }\n disable() {\n this.enabled && this.refresh({ disabled: true });\n }\n enable() {\n this.disabled && this.refresh({ disabled: false });\n }\n touch() {\n this.untouched && this.refresh({ touched: true });\n }\n setInitialValue(value) {\n this.initialValue = value;\n this.setValue(value);\n }\n setValue(value) {\n this.refresh({ value });\n }\n setValidators(validators) {\n this.refresh({ validators });\n }\n subscribe(subscriber) {\n this.subscriber = subscriber;\n }\n hasError(key) {\n return hasError(this.errors, key);\n }\n someErrors(keys) {\n return someErrors(this.errors, keys);\n }\n reset() {\n this.refresh({\n dirty: false,\n touched: false,\n value: this.initialValue\n });\n }\n refresh(changes) {\n this.subscriber &&\n this.subscriber({\n ...this,\n ...changes,\n initialValue: this.initialValue\n });\n }\n}\nexport class RolsterArrayControl extends RolsterReactArrayControl {\n constructor(options) {\n super(options);\n this.valid = this.errors.length === 0;\n this.invalid = !this.valid;\n this.wrong = this.touched && this.invalid;\n }\n clone(options) {\n return new RolsterArrayControl(options);\n }\n}\nfunction rolsterArrayControl(options, validators) {\n const controlOptions = createFormControlOptions(options, validators);\n return new RolsterArrayControl({\n ...controlOptions,\n initialValue: controlOptions.value,\n uuid: uuid()\n });\n}\nexport function reactArrayControl(options, validators) {\n return rolsterArrayControl(options, validators);\n}\nexport function formArrayControl(options, validators) {\n return rolsterArrayControl(options, validators);\n}\nexport function inputArrayControl(options, validators) {\n return rolsterArrayControl(options, validators);\n}\n//# sourceMappingURL=form-array-control.js.map","import { createFormGroupOptions } from '@rolster/forms/arguments';\nimport { controlsAllChecked, controlsPartialChecked, controlsToValue, groupIsValid } from '@rolster/forms/helpers';\nimport { v4 as uuid } from 'uuid';\nexport class RolsterArrayGroup {\n constructor(options) {\n const { controls, resource, uuid, validators } = options;\n this.uuid = uuid;\n this.controls = controls;\n this.validators = validators;\n this.resource = resource;\n this.errors = validators ? groupIsValid({ controls, validators }) : [];\n this.error = this.errors[0];\n this.valid =\n this.errors.length === 0 && controlsAllChecked(controls, 'valid');\n this.invalid = !this.valid;\n this.dirty = controlsPartialChecked(controls, 'dirty');\n this.dirties = controlsAllChecked(controls, 'dirty');\n this.touched = controlsPartialChecked(controls, 'touched');\n this.toucheds = controlsAllChecked(controls, 'touched');\n this.pristine = !this.dirty;\n this.pristines = !this.dirties;\n this.untouched = !this.touched;\n this.untoucheds = !this.toucheds;\n this.wrong = this.touched && this.invalid;\n this.value = controlsToValue(controls);\n const subscriber = (options) => {\n this.refresh({\n controls: Object.entries(this.controls).reduce((controls, [key, control]) => {\n controls[key] =\n control.uuid === options.uuid ? control.clone(options) : control;\n return controls;\n }, {})\n });\n };\n Object.values(controls).forEach((control) => {\n control.subscribe(subscriber);\n });\n }\n setValidators(validators) {\n this.refresh({ validators });\n }\n subscribe(subscriber) {\n this.subscriber = subscriber;\n }\n refresh(changes) {\n this.subscriber && this.subscriber({ ...this, ...changes });\n }\n}\nexport function formArrayGroup(options, validators) {\n return new RolsterArrayGroup({\n ...createFormGroupOptions(options, validators),\n uuid: uuid()\n });\n}\n//# sourceMappingURL=form-array-group.js.map","import { controlsAllChecked, controlsToValue } from '@rolster/forms/helpers';\nimport { v4 as uuid } from 'uuid';\nimport { RolsterReactArrayControl } from './form-array-control';\nexport class RolsterArrayList extends RolsterReactArrayControl {\n constructor(options) {\n const value = options.controls.map((controls) => controlsToValue(controls));\n super({ ...options, value });\n this.valueToControls = options.valueToControls;\n this.controls = options.controls;\n this.valid =\n this.errors.length === 0 &&\n this.controls.reduce((valid, controls) => valid && controlsAllChecked(controls, 'valid'), true);\n this.invalid = !this.valid;\n this.wrong = this.touched && this.invalid;\n options.controls.forEach((controls) => {\n this.subscribeControls(controls);\n });\n }\n setValue(value) {\n this.refresh({\n controls: value.map((value) => this.valueToControls(value))\n });\n }\n clone(options) {\n return new RolsterArrayList(options);\n }\n push(controls) {\n this.refresh({\n controls: [...this.controls, controls]\n });\n }\n remove(controls) {\n this.refresh({\n controls: this.controls.filter((currentControls) => currentControls !== controls)\n });\n }\n refresh(changes) {\n super.refresh(changes);\n }\n subscribeControls(newControls) {\n Object.values(newControls).forEach((control) => {\n control.subscribe((options) => {\n const controls = this.controls.map((_controls) => _controls !== newControls\n ? _controls\n : Object.entries(newControls).reduce((controls, [key, control]) => {\n controls[key] =\n control.uuid === options.uuid\n ? control.clone(options)\n : control;\n return controls;\n }, {}));\n this.refresh({ controls });\n });\n });\n }\n}\nexport function formArrayList(valueToControls, options) {\n const value = options?.value || [];\n return new RolsterArrayList({\n ...options,\n valueToControls,\n controls: value.map((value) => valueToControls(value)),\n initialValue: value,\n uuid: uuid()\n });\n}\n//# sourceMappingURL=form-array-list.js.map","export var Language;\n(function (Language) {\n Language[\"English\"] = \"en\";\n Language[\"French\"] = \"fr\";\n Language[\"Portuguese\"] = \"pt\";\n Language[\"Spanish\"] = \"es\";\n})(Language || (Language = {}));\n//# sourceMappingURL=enums.js.map","import { interpolation } from '@rolster/strings';\nimport { Language } from './enums';\nlet languageCode = Language.Spanish;\nlet subscribers = [];\n/* istanbul ignore next */\nexport function i18nLanguage(language) {\n languageCode = language;\n subscribers.forEach((subscriber) => {\n subscriber(language);\n });\n}\nexport function i18nSubscribe(subscriber) {\n subscribers.push(subscriber);\n return () => {\n subscribers = subscribers.filter((currentSubscriber) => subscriber !== currentSubscriber);\n };\n}\nexport function i18n(dictionary) {\n return (() => {\n return (key, options) => {\n const collection = dictionary[options?.language || languageCode];\n return collection\n ? interpolation(collection[key], options?.interpolators)\n : '';\n };\n })();\n}\n//# sourceMappingURL=i18n.js.map","import { createFormArrayOptions } from '@rolster/forms/arguments';\nimport { arrayIsValid, controlsToValue, groupAllChecked, hasError as rolsterHasError, someErrors as rolsterSomeErrors } from '@rolster/forms/helpers';\nimport { i18nSubscribe } from '@rolster/i18n';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { RolsterArrayGroup } from './form-array-group';\nfunction errorsInArray(groups, validators) {\n return validators ? arrayIsValid({ groups, validators }) : [];\n}\nfunction validStateInArray(groups, validators) {\n const errors = errorsInArray(groups, validators);\n return {\n errors,\n valid: errors.length === 0 && groupAllChecked(groups, 'valid')\n };\n}\nfunction replaceStateInArray(groups, validators) {\n return {\n ...validStateInArray(groups, validators),\n groups,\n controls: groups.map(({ controls }) => controls),\n value: groups.map(({ controls }) => controlsToValue(controls))\n };\n}\nexport function useFormArray(options, validators) {\n const _options = createFormArrayOptions(options, validators);\n const groups = _options.groups || [];\n const initialValue = useRef(groups);\n const [state, setState] = useState({\n ...validStateInArray(groups, _options.validators),\n controls: groups.map(({ controls }) => controls),\n dirty: false,\n dirties: false,\n disabled: false,\n groups,\n touched: false,\n toucheds: false,\n value: groups.map(({ controls }) => controlsToValue(controls)),\n validators: _options.validators\n });\n useEffect(() => {\n return i18nSubscribe(() => {\n setState((state) => ({\n ...state,\n errors: errorsInArray(state.groups, state.validators)\n }));\n });\n }, []);\n useEffect(() => {\n const subscriber = (options) => {\n setState((state) => ({\n ...state,\n ...replaceStateInArray(state.groups.map((group) => group.uuid === options.uuid\n ? new RolsterArrayGroup(options)\n : group), state.validators)\n }));\n };\n state.groups.forEach((group) => {\n group.subscribe(subscriber);\n });\n }, [state.groups]);\n const disable = useCallback(() => {\n setState((state) => ({ ...state, disabled: true }));\n }, []);\n const enable = useCallback(() => {\n setState((state) => ({ ...state, disabled: false }));\n }, []);\n const setValue = useCallback((groups) => {\n setState((state) => ({\n ...state,\n ...replaceStateInArray(groups, state.validators)\n }));\n }, []);\n const setInitialValue = useCallback((groups) => {\n setState((state) => ({\n ...state,\n ...replaceStateInArray(groups, state.validators)\n }));\n initialValue.current = groups;\n }, []);\n const push = useCallback((group) => {\n setState((state) => ({\n ...state,\n ...replaceStateInArray([...state.groups, group], state.validators)\n }));\n }, []);\n const merge = useCallback((groups) => {\n setState((state) => ({\n ...state,\n ...replaceStateInArray([...state.groups, ...groups], state.validators)\n }));\n }, []);\n const remove = useCallback(({ uuid }) => {\n setState((state) => ({\n ...state,\n ...replaceStateInArray(state.groups.filter((group) => group.uuid !== uuid), state.validators)\n }));\n }, []);\n const reset = useCallback(() => {\n setState((state) => ({\n ...state,\n ...replaceStateInArray(initialValue.current, state.validators)\n }));\n }, []);\n const setValidators = useCallback((validators) => {\n setState((state) => ({\n ...state,\n ...validStateInArray(state.groups, validators),\n validators\n }));\n }, []);\n const hasError = useCallback((key) => rolsterHasError(state.errors, key), [state.errors]);\n const someErrors = useCallback((keys) => rolsterSomeErrors(state.errors, keys), [state.errors]);\n return {\n ...state,\n disable,\n enable,\n enabled: !state.disabled,\n error: state.errors[0],\n hasError,\n invalid: !state.valid,\n merge,\n pristine: !state.dirty,\n pristines: !state.dirties,\n push,\n remove,\n reset,\n setInitialValue,\n setValidators,\n setValue,\n someErrors,\n untouched: !state.touched,\n untoucheds: !state.toucheds,\n wrong: state.touched && !state.valid\n };\n}\n//# sourceMappingURL=form-array.js.map","import { createFormControlOptions } from '@rolster/forms/arguments';\nimport { controlIsValid, hasError as rolsterHasError, someErrors as rolsterSomeErrors } from '@rolster/forms/helpers';\nimport { i18nSubscribe } from '@rolster/i18n';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nfunction errorsInControl(value, validators) {\n return validators ? controlIsValid({ value, validators }) : [];\n}\nfunction useControl(options, validators) {\n const _options = createFormControlOptions(options, validators);\n const initialValue = useRef(_options.value);\n const [state, setState] = useState({\n dirty: false,\n disabled: false,\n errors: errorsInControl(_options.value, _options.validators),\n focused: false,\n touched: !!_options.touched,\n value: _options.value,\n validators: _options.validators\n });\n const elementRef = useRef(null);\n useEffect(() => {\n return i18nSubscribe(() => {\n setState((state) => ({\n ...state,\n errors: errorsInControl(state.value, state.validators)\n }));\n });\n }, []);\n const focus = useCallback(() => {\n setState((state) => ({ ...state, focused: true }));\n }, []);\n const blur = useCallback(() => {\n setState((state) => ({ ...state, focused: false, touched: true }));\n }, []);\n const disable = useCallback(() => {\n setState((state) => ({ ...state, disabled: true }));\n }, []);\n const enable = useCallback(() => {\n setState((state) => ({ ...state, disabled: false }));\n }, []);\n const touch = useCallback(() => {\n setState((state) => ({ ...state, touched: true }));\n }, []);\n const setInitialValue = useCallback((value) => {\n initialValue.current = value;\n setState((state) => ({\n ...state,\n dirty: true,\n errors: errorsInControl(value, state.validators),\n value\n }));\n }, []);\n const setValue = useCallback((value) => {\n setState((state) => ({\n ...state,\n dirty: true,\n errors: errorsInControl(value, state.validators),\n value\n }));\n }, []);\n const setValidators = useCallback((validators) => {\n setState((state) => ({\n ...state,\n errors: errorsInControl(state.value, validators),\n validators\n }));\n }, []);\n const reset = useCallback(() => {\n setState((state) => ({\n ...state,\n dirty: false,\n errors: errorsInControl(initialValue.current, state.validators),\n value: initialValue.current,\n touched: false\n }));\n }, []);\n const hasError = useCallback((key) => rolsterHasError(state.errors, key), [state.errors]);\n const someErrors = useCallback((keys) => rolsterSomeErrors(state.errors, keys), [state.errors]);\n const valid = state.errors.length === 0;\n return {\n ...state,\n blur,\n disable,\n elementRef,\n enable,\n enabled: !state.disabled,\n error: state.errors[0],\n focus,\n hasError,\n invalid: !valid,\n pristine: !state.dirty,\n reset,\n setInitialValue,\n setValidators,\n setValue,\n someErrors,\n touch,\n unfocused: !state.focused,\n untouched: !state.touched,\n valid,\n wrong: state.touched && !valid\n };\n}\nexport function useReactControl(options, validators) {\n return useControl(options, validators);\n}\nexport function useFormControl(options, validators) {\n return useControl(options, validators);\n}\nexport function useInputControl(options, validators) {\n return useControl(options, validators);\n}\n//# sourceMappingURL=form-control.js.map","import { createFormGroupOptions } from '@rolster/forms/arguments';\nimport { controlsAllChecked, controlsPartialChecked, controlsToValue, groupIsValid, reduceControlsToArray } from '@rolster/forms/helpers';\nimport { i18nSubscribe } from '@rolster/i18n';\nimport { useCallback, useEffect, useState } from 'react';\nfunction errorsInGroup(controls, validators) {\n return validators ? groupIsValid({ controls, validators }) : [];\n}\nfunction validStateInGroup(controls, validators) {\n const errors = errorsInGroup(controls, validators);\n return {\n errors,\n valid: errors.length === 0 && controlsAllChecked(controls, 'valid')\n };\n}\nexport function useFormGroup(options, validators) {\n const _options = createFormGroupOptions(options, validators);\n const { controls } = _options;\n const [state, setState] = useState({\n ...validStateInGroup(controls, _options.validators),\n controls,\n dirties: controlsAllChecked(controls, 'dirty'),\n dirty: controlsPartialChecked(controls, 'dirty'),\n touched: controlsPartialChecked(controls, 'touched'),\n toucheds: controlsAllChecked(controls, 'touched'),\n value: controlsToValue(controls),\n validators: _options.validators\n });\n useEffect(() => {\n return i18nSubscribe(() => {\n setState((state) => ({\n ...state,\n errors: errorsInGroup(state.controls, state.validators)\n }));\n });\n }, []);\n useEffect(() => {\n setState((state) => ({\n ...state,\n ...validStateInGroup(controls, state.validators),\n controls,\n value: controlsToValue(controls)\n }));\n }, reduceControlsToArray(controls, 'value'));\n useEffect(() => {\n setState((state) => ({\n ...state,\n controls\n }));\n }, [\n ...reduceControlsToArray(controls, 'disabled'),\n ...reduceControlsToArray(controls, 'focused')\n ]);\n useEffect(() => {\n setState((state) => ({\n ...state,\n controls,\n dirty: controlsPartialChecked(controls, 'dirty'),\n dirties: controlsAllChecked(controls, 'dirty')\n }));\n }, reduceControlsToArray(controls, 'dirty'));\n useEffect(() => {\n setState((state) => ({\n ...state,\n controls,\n touched: controlsPartialChecked(controls, 'touched'),\n toucheds: controlsAllChecked(controls, 'touched')\n }));\n }, reduceControlsToArray(controls, 'touched'));\n const setValidators = useCallback((validators) => {\n setState((state) => ({\n ...state,\n ...validStateInGroup(state.controls, validators)\n }));\n }, []);\n const reset = useCallback(() => {\n Object.values(controls).forEach((control) => {\n control.reset();\n });\n }, []);\n return {\n ...state,\n error: state.errors[0],\n invalid: !state.valid,\n pristine: !state.dirty,\n pristines: !state.dirties,\n reset,\n setValidators,\n untouched: !state.touched,\n untoucheds: !state.toucheds,\n wrong: state.touched && !state.valid\n };\n}\n//# sourceMappingURL=form-group.js.map","import { reduceControlsToArray } from '@rolster/forms/helpers';\nexport function reduceControlsToValues(controls) {\n return reduceControlsToArray(controls, 'value');\n}\nexport function reduceGroupToValues(group) {\n return reduceControlsToValues(group.controls);\n}\n//# sourceMappingURL=helpers.js.map"],"names":["uuid","hasError","rolsterHasError","someErrors","rolsterSomeErrors"],"mappings":";;;;;AAGO,MAAM,wBAAwB,CAAC;AACtC,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,O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AE,CAAC;AAC5B,SAAS,CAAC,CAAC;AACX,KAAK,EAAE,EAAE,CAAC,CAAC;AACX,IAAI,OAAO;AACX,QAAQ,GAAG,KAAK;AAChB,QAAQ,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9B,QAAQ,OAAO,EAAE,CAAC,KAAK,CAAC,KAAK;AAC7B,QAAQ,QAAQ,EAAE,CAAC,KAAK,CAAC,KAAK;AAC9B,QAAQ,SAAS,EAAE,CAAC,KAAK,CAAC,OAAO;AACjC,QAAQ,KAAK;AACb,QAAQ,aAAa;AACrB,QAAQ,SAAS,EAAE,CAAC,KAAK,CAAC,OAAO;AACjC,QAAQ,UAAU,EAAE,CAAC,KAAK,CAAC,QAAQ;AACnC,QAAQ,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK;AAC5C,KAAK,CAAC;AACN;;AC1FO,SAAS,sBAAsB,CAAC,QAAQ,EAAE;AACjD,IAAI,OAAO,qBAAqB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AACM,SAAS,mBAAmB,CAAC,KAAK,EAAE;AAC3C,IAAI,OAAO,sBAAsB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAClD;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../esm/form-array/form-array-control.js","../esm/utilities.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","../esm/helpers.js"],"sourcesContent":["import { createFormControlOptions } from '@rolster/forms/arguments';\nimport { controlIsValid, hasError, someErrors } from '@rolster/forms/helpers';\nimport { v4 as uuid } from 'uuid';\nexport class RolsterArrayControl {\n constructor(options) {\n this.uuid = options.uuid;\n this.value = options.value;\n this.initialValue = options.initialValue;\n this.focused = !!options.focused;\n this.unfocused = !this.focused;\n this.touched = !!options.touched;\n this.untouched = !this.touched;\n this.dirty = !!options.dirty;\n this.pristine = !this.dirty;\n this.disabled = !!options.disabled;\n this.enabled = !this.disabled;\n this.valid = this.isValid(options.errors);\n this.invalid = !this.valid;\n this.wrong = this.touched && this.invalid;\n this.errors = options.errors;\n this.error = this.errors[0];\n this.validators = options.validators;\n }\n focus() {\n this.unfocused && this.refresh('focused', { focused: true });\n }\n blur() {\n this.focused && this.refresh('focused', { focused: false, touched: true });\n }\n disable() {\n this.enabled && this.refresh('disabled', { disabled: true });\n }\n enable() {\n this.disabled && this.refresh('disabled', { disabled: false });\n }\n touch() {\n this.untouched && this.refresh('touched', { touched: true });\n }\n setInitialValue(value) {\n const { validators } = this;\n const errors = validators ? controlIsValid({ value, validators }) : [];\n this.refresh('value', { dirty: false, errors, initialValue: value, value });\n }\n setValue(value) {\n const { validators } = this;\n const errors = validators ? controlIsValid({ value, validators }) : [];\n this.refresh('value', { dirty: true, errors, value });\n }\n setValidators(validators) {\n const { value } = this;\n const errors = validators ? controlIsValid({ value, validators }) : [];\n this.refresh('validators', { errors, validators });\n }\n subscribe(subscriber) {\n this.subscriber = subscriber;\n }\n hasError(key) {\n return hasError(this.errors, key);\n }\n someErrors(keys) {\n return someErrors(this.errors, keys);\n }\n reset() {\n const { initialValue: value, validators } = this;\n const errors = validators ? controlIsValid({ value, validators }) : [];\n this.refresh('reset', {\n dirty: false,\n errors,\n touched: false,\n value\n });\n }\n isValid(errors) {\n return errors.length === 0;\n }\n builder(options) {\n return new RolsterArrayControl({ ...this, ...options });\n }\n refresh(action, options) {\n this.subscriber && this.subscriber(action, this.builder(options));\n }\n}\nclass ReactRolsterArrayControl extends RolsterArrayControl {\n constructor(options) {\n const { value, validators } = options;\n const errors = validators ? controlIsValid({ value, validators }) : [];\n super({ ...options, errors });\n }\n}\nfunction rolsterArrayControl(options, validators) {\n const _options = createFormControlOptions(options, validators);\n return new ReactRolsterArrayControl({\n ..._options,\n initialValue: _options.value,\n uuid: uuid()\n });\n}\nexport function reactArrayControl(options, validators) {\n return rolsterArrayControl(options, validators);\n}\nexport function formArrayControl(options, validators) {\n return rolsterArrayControl(options, validators);\n}\nexport function inputArrayControl(options, validators) {\n return rolsterArrayControl(options, validators);\n}\n//# sourceMappingURL=form-array-control.js.map","export function replaceControl(controls, control) {\n return Object.entries(controls).reduce((controls, [key, _control]) => {\n if (_control.uuid === control.uuid) {\n controls[key] = control;\n }\n return controls;\n }, controls);\n}\n//# sourceMappingURL=utilities.js.map","import { createFormGroupOptions } from '@rolster/forms/arguments';\nimport { controlsAllChecked, controlsPartialChecked, controlsToValue, groupIsValid } from '@rolster/forms/helpers';\nimport { v4 as uuid } from 'uuid';\nimport { replaceControl } from '../utilities';\nfunction refactorForValid(controls, validators) {\n const errors = validators ? groupIsValid({ controls, validators }) : [];\n return {\n errors,\n valid: errors.length === 0 && controlsAllChecked(controls, 'valid')\n };\n}\nfunction refactorForControls(group, controls, action) {\n switch (action) {\n case 'focused':\n case 'touched':\n return {\n touched: controlsPartialChecked(controls, 'touched'),\n toucheds: controlsAllChecked(controls, 'touched')\n };\n case 'validators':\n return refactorForValid(controls, group.validators);\n case 'reset':\n return {\n ...refactorForValid(controls, group.validators),\n dirty: controlsPartialChecked(controls, 'dirty'),\n dirties: controlsAllChecked(controls, 'dirty'),\n touched: controlsPartialChecked(controls, 'touched'),\n toucheds: controlsAllChecked(controls, 'touched'),\n value: controlsToValue(controls)\n };\n case 'list':\n case 'value':\n return {\n ...refactorForValid(controls, group.validators),\n dirty: controlsPartialChecked(controls, 'dirty'),\n dirties: controlsAllChecked(controls, 'dirty'),\n value: controlsToValue(controls)\n };\n default:\n return {};\n }\n}\nclass BaseArrayGroup {\n constructor(options) {\n this.uuid = options.uuid;\n this.controls = options.controls;\n this.value = options.value;\n this.resource = options.resource;\n this.dirty = !!options.dirty;\n this.dirties = !!options.dirties;\n this.pristine = !this.dirty;\n this.pristines = !this.dirties;\n this.touched = !!options.touched;\n this.toucheds = !!options.toucheds;\n this.untouched = !this.touched;\n this.untoucheds = !this.toucheds;\n this.valid = !!options.valid;\n this.invalid = !this.valid;\n this.wrong = this.touched && this.invalid;\n this.errors = options.errors;\n this.error = this.errors[0];\n this.validators = options.validators;\n const subscriber = (action, control) => {\n const controls = replaceControl(this.controls, control);\n this.refresh(action, {\n ...refactorForControls(this, controls, action),\n controls\n });\n };\n Object.values(this.controls).forEach((control) => {\n control.subscribe(subscriber);\n });\n }\n subscribe(subscriber) {\n this.subscriber = subscriber;\n }\n setValidators(validators) {\n this.refresh('validators', {\n ...refactorForValid(this.controls, validators),\n validators\n });\n }\n refresh(action, options) {\n this.subscriber &&\n this.subscriber(action, new BaseArrayGroup({ ...this, ...options }));\n }\n}\nclass RolsterArrayGroup extends BaseArrayGroup {\n constructor(options) {\n const { controls, validators } = options;\n const errors = validators ? groupIsValid({ controls, validators }) : [];\n super({\n ...options,\n errors,\n value: controlsToValue(controls),\n dirties: controlsAllChecked(controls, 'dirty'),\n dirty: controlsPartialChecked(controls, 'dirty'),\n touched: controlsPartialChecked(controls, 'touched'),\n toucheds: controlsAllChecked(controls, 'touched'),\n valid: errors.length === 0 && controlsAllChecked(controls, 'valid')\n });\n }\n}\nexport function formArrayGroup(options, validators) {\n return new RolsterArrayGroup({\n ...createFormGroupOptions(options, validators),\n uuid: uuid()\n });\n}\n//# sourceMappingURL=form-array-group.js.map","import { controlIsValid, controlsAllChecked, controlsToValue } from '@rolster/forms/helpers';\nimport { v4 as uuid } from 'uuid';\nimport { replaceControl } from '../utilities';\nimport { RolsterArrayControl } from './form-array-control';\nclass RolsterArrayList extends RolsterArrayControl {\n constructor(options) {\n const { controls, valueToControls, validators } = options;\n const value = controls.map((controls) => controlsToValue(controls));\n const errors = validators ? controlIsValid({ value, validators }) : [];\n super({ ...options, errors, value });\n this.valueToControls = valueToControls;\n this.controls = controls;\n this.valid =\n errors.length === 0 &&\n controls.reduce((valid, controls) => valid && controlsAllChecked(controls, 'valid'), true);\n this.invalid = !this.valid;\n this.wrong = this.touched && this.invalid;\n controls.forEach((reactControls) => {\n this._subscribe(reactControls);\n });\n }\n setValue(value) {\n this.refresh('list', {\n controls: value.map((value) => this.valueToControls(value))\n });\n }\n push(controls) {\n this.refresh('list', {\n controls: [...this.controls, controls]\n });\n }\n remove(controls) {\n this.refresh('list', {\n controls: this.controls.filter((_controls) => _controls !== controls)\n });\n }\n builder(options) {\n return new RolsterArrayList({\n ...this,\n ...options,\n valueToControls: this.valueToControls\n });\n }\n refresh(action, options) {\n super.refresh(action, options);\n }\n _subscribe(reactControls) {\n Object.values(reactControls).forEach((control) => {\n control.subscribe((action, _control) => {\n const _reactControls = this.controls.map((_controls) => reactControls !== _controls\n ? _controls\n : replaceControl(reactControls, _control));\n this.refresh(action, { controls: _reactControls });\n });\n });\n }\n}\nexport function formArrayList(options) {\n const value = options?.value || [];\n return new RolsterArrayList({\n ...options,\n controls: value.map((value) => options.valueToControls(value)),\n initialValue: value,\n uuid: uuid()\n });\n}\n//# sourceMappingURL=form-array-list.js.map","import { createFormArrayOptions } from '@rolster/forms/arguments';\nimport { arrayIsValid, controlsToValue, groupAllChecked, hasError as rolsterHasError, someErrors as rolsterSomeErrors } from '@rolster/forms/helpers';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nfunction refactorForValid(groups, validators) {\n const errors = validators ? arrayIsValid({ groups, validators }) : [];\n return {\n errors,\n valid: errors.length === 0 && groupAllChecked(groups, 'valid')\n };\n}\nfunction refactorForGroups(groups, validators) {\n return {\n ...refactorForValid(groups, validators),\n groups,\n controls: groups.map(({ controls }) => controls),\n value: groups.map(({ controls }) => controlsToValue(controls))\n };\n}\nfunction refactorForControls(state, groups, action) {\n switch (action) {\n case 'validators':\n return refactorForValid(groups, state.validators);\n case 'reset':\n case 'list':\n case 'value':\n return refactorForGroups(groups, state.validators);\n default:\n return { groups };\n }\n}\nexport function useFormArray(options, validators) {\n const _options = createFormArrayOptions(options, validators);\n const groups = _options.groups || [];\n const initialValue = useRef(groups);\n const [state, setState] = useState({\n ...refactorForValid(groups, _options.validators),\n controls: groups.map(({ controls }) => controls),\n dirty: false,\n dirties: false,\n disabled: false,\n groups,\n touched: false,\n toucheds: false,\n value: groups.map(({ controls }) => controlsToValue(controls)),\n validators: _options.validators\n });\n useEffect(() => {\n const subscriber = (action, group) => {\n setState((state) => {\n const groups = state.groups.map((_group) => _group.uuid === group.uuid ? group : _group);\n return {\n ...state,\n ...refactorForControls(state, groups, action)\n };\n });\n };\n state.groups.forEach((group) => {\n group.subscribe(subscriber);\n });\n }, [state.groups]);\n const disable = useCallback(() => {\n setState((state) => ({ ...state, disabled: true }));\n }, []);\n const enable = useCallback(() => {\n setState((state) => ({ ...state, disabled: false }));\n }, []);\n const setValue = useCallback((groups) => {\n setState((state) => ({\n ...state,\n ...refactorForGroups(groups, state.validators)\n }));\n }, []);\n const setInitialValue = useCallback((groups) => {\n setState((state) => ({\n ...state,\n ...refactorForGroups(groups, state.validators)\n }));\n initialValue.current = groups;\n }, []);\n const push = useCallback((group) => {\n setState((state) => ({\n ...state,\n ...refactorForGroups([...state.groups, group], state.validators)\n }));\n }, []);\n const merge = useCallback((groups) => {\n setState((state) => ({\n ...state,\n ...refactorForGroups([...state.groups, ...groups], state.validators)\n }));\n }, []);\n const remove = useCallback(({ uuid }) => {\n setState((state) => ({\n ...state,\n ...refactorForGroups(state.groups.filter((group) => group.uuid !== uuid), state.validators)\n }));\n }, []);\n const setValidators = useCallback((validators) => {\n setState((state) => ({\n ...state,\n ...refactorForValid(state.groups, validators),\n validators\n }));\n }, []);\n const hasError = useCallback((key) => rolsterHasError(state.errors, key), [state.errors]);\n const someErrors = useCallback((keys) => rolsterSomeErrors(state.errors, keys), [state.errors]);\n const reset = useCallback(() => {\n setState((state) => ({\n ...state,\n ...refactorForGroups(initialValue.current, state.validators)\n }));\n }, []);\n return {\n ...state,\n disable,\n enable,\n enabled: !state.disabled,\n error: state.errors[0],\n hasError,\n invalid: !state.valid,\n merge,\n pristine: !state.dirty,\n pristines: !state.dirties,\n push,\n remove,\n reset,\n setInitialValue,\n setValidators,\n setValue,\n someErrors,\n untouched: !state.touched,\n untoucheds: !state.toucheds,\n wrong: state.touched && !state.valid\n };\n}\n//# sourceMappingURL=form-array.js.map","import { createFormControlOptions } from '@rolster/forms/arguments';\nimport { controlIsValid, hasError as rolsterHasError, someErrors as rolsterSomeErrors } from '@rolster/forms/helpers';\nimport { useCallback, useRef, useState } from 'react';\nfunction errorsInControl(value, validators) {\n return validators ? controlIsValid({ value, validators }) : [];\n}\nfunction useControl(options, validators) {\n const _options = createFormControlOptions(options, validators);\n const initialValue = useRef(_options.value);\n const [state, setState] = useState({\n dirty: false,\n disabled: false,\n errors: errorsInControl(_options.value, _options.validators),\n focused: false,\n touched: !!_options.touched,\n value: _options.value,\n validators: _options.validators\n });\n const elementRef = useRef(null);\n const focus = useCallback(() => {\n setState((state) => ({ ...state, focused: true }));\n }, []);\n const blur = useCallback(() => {\n setState((state) => ({ ...state, focused: false, touched: true }));\n }, []);\n const disable = useCallback(() => {\n setState((state) => ({ ...state, disabled: true }));\n }, []);\n const enable = useCallback(() => {\n setState((state) => ({ ...state, disabled: false }));\n }, []);\n const touch = useCallback(() => {\n setState((state) => ({ ...state, touched: true }));\n }, []);\n const setInitialValue = useCallback((value) => {\n initialValue.current = value;\n setState((state) => ({\n ...state,\n dirty: true,\n errors: errorsInControl(value, state.validators),\n value\n }));\n }, []);\n const setValue = useCallback((value) => {\n setState((state) => ({\n ...state,\n dirty: true,\n errors: errorsInControl(value, state.validators),\n value\n }));\n }, []);\n const setValidators = useCallback((validators) => {\n setState((state) => ({\n ...state,\n errors: errorsInControl(state.value, validators),\n validators\n }));\n }, []);\n const reset = useCallback(() => {\n setState((state) => ({\n ...state,\n dirty: false,\n errors: errorsInControl(initialValue.current, state.validators),\n value: initialValue.current,\n touched: false\n }));\n }, []);\n const hasError = useCallback((key) => rolsterHasError(state.errors, key), [state.errors]);\n const someErrors = useCallback((keys) => rolsterSomeErrors(state.errors, keys), [state.errors]);\n const valid = state.errors.length === 0;\n return {\n ...state,\n blur,\n disable,\n elementRef,\n enable,\n enabled: !state.disabled,\n error: state.errors[0],\n focus,\n hasError,\n invalid: !valid,\n pristine: !state.dirty,\n reset,\n setInitialValue,\n setValidators,\n setValue,\n someErrors,\n touch,\n unfocused: !state.focused,\n untouched: !state.touched,\n valid,\n wrong: state.touched && !valid\n };\n}\nexport function useReactControl(options, validators) {\n return useControl(options, validators);\n}\nexport function useFormControl(options, validators) {\n return useControl(options, validators);\n}\nexport function useInputControl(options, validators) {\n return useControl(options, validators);\n}\n//# sourceMappingURL=form-control.js.map","import { createFormGroupOptions } from '@rolster/forms/arguments';\nimport { controlsAllChecked, controlsPartialChecked, controlsToValue, groupIsValid, reduceControlsToArray } from '@rolster/forms/helpers';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nfunction refactorForValid(controls, validators) {\n const errors = validators ? groupIsValid({ controls, validators }) : [];\n return {\n errors,\n valid: errors.length === 0 && controlsAllChecked(controls, 'valid')\n };\n}\nexport function useFormGroup(options, validators) {\n const _options = createFormGroupOptions(options, validators);\n const { controls } = _options;\n const firstEffects = useRef({\n dirty: true,\n disabledFocused: true,\n touched: true,\n value: true\n });\n const [state, setState] = useState({\n ...refactorForValid(controls, _options.validators),\n controls,\n dirties: controlsAllChecked(controls, 'dirty'),\n dirty: controlsPartialChecked(controls, 'dirty'),\n touched: controlsPartialChecked(controls, 'touched'),\n toucheds: controlsAllChecked(controls, 'touched'),\n value: controlsToValue(controls),\n validators: _options.validators\n });\n useEffect(() => {\n if (!firstEffects.current.value) {\n setState((state) => ({\n ...state,\n ...refactorForValid(controls, state.validators),\n controls,\n value: controlsToValue(controls)\n }));\n }\n else {\n firstEffects.current.value = false;\n }\n }, reduceControlsToArray(controls, 'value'));\n useEffect(() => {\n if (!firstEffects.current.disabledFocused) {\n setState((state) => ({\n ...state,\n controls\n }));\n }\n else {\n firstEffects.current.disabledFocused = false;\n }\n }, [\n ...reduceControlsToArray(controls, 'disabled'),\n ...reduceControlsToArray(controls, 'focused')\n ]);\n useEffect(() => {\n if (!firstEffects.current.dirty) {\n setState((state) => ({\n ...state,\n controls,\n dirty: controlsPartialChecked(controls, 'dirty'),\n dirties: controlsAllChecked(controls, 'dirty')\n }));\n }\n else {\n firstEffects.current.dirty = false;\n }\n }, reduceControlsToArray(controls, 'dirty'));\n useEffect(() => {\n if (!firstEffects.current.touched) {\n setState((state) => ({\n ...state,\n controls,\n touched: controlsPartialChecked(controls, 'touched'),\n toucheds: controlsAllChecked(controls, 'touched')\n }));\n }\n else {\n firstEffects.current.touched = false;\n }\n }, reduceControlsToArray(controls, 'touched'));\n const setValidators = useCallback((validators) => {\n setState((state) => ({\n ...state,\n ...refactorForValid(state.controls, validators)\n }));\n }, []);\n const reset = useCallback(() => {\n Object.values(controls).forEach((control) => {\n control.reset();\n });\n }, []);\n return {\n ...state,\n error: state.errors[0],\n invalid: !state.valid,\n pristine: !state.dirty,\n pristines: !state.dirties,\n reset,\n setValidators,\n untouched: !state.touched,\n untoucheds: !state.toucheds,\n wrong: state.touched && !state.valid\n };\n}\n//# sourceMappingURL=form-group.js.map","import { reduceControlsToArray } from '@rolster/forms/helpers';\nexport function reduceControlsToValues(controls) {\n return reduceControlsToArray(controls, 'value');\n}\nexport function reduceGroupToValues(group) {\n return reduceControlsToValues(group.controls);\n}\n//# sourceMappingURL=helpers.js.map"],"names":["uuid","refactorForValid","refactorForControls","hasError","rolsterHasError","someErrors","rolsterSomeErrors"],"mappings":";;;;;AAGO,MAAM,mBAAmB,CAAC;AACjC,IAAI,WAAW,CAAC,OAAO,EAAE;AACzB,QAAQ,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AACjC,QAAQ,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;AACnC,QAAQ,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;AACjD,QAAQ,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;AACzC,QAAQ,IAAI,CAAC,SAAS,GAAG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D,IAAI,OAAO,qBAAqB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AACM,SAAS,mBAAmB,CAAC,KAAK,EAAE;AAC3C,IAAI,OAAO,sBAAsB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAClD;;;;"}
@@ -1,26 +1,33 @@
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, ReactHtmlArrayControl, ReactInputArrayControl, ReactSubscriberControl } from '../types';
5
- type RolsterBaseArrayControl<E extends HTMLElement = HTMLElement, T = any> = Omit<ReactArrayControl<E, T>, 'clone' | 'invalid' | 'valid' | 'wrong'>;
6
- export declare class RolsterReactArrayControl<E extends HTMLElement = HTMLElement, T = any> implements RolsterBaseArrayControl<E, T> {
7
- readonly errors: ValidatorError<T>[];
4
+ import { ReactArrayControl, ReactArrayAction, ReactArrayControlOptions, ReactArrayControlSubscriber, ReactHtmlArrayControl, ReactInputArrayControl } from '../types';
5
+ interface ArrayControlOptions<T = any> extends ReactArrayControlOptions<T> {
6
+ errors: ValidatorError<T>[];
7
+ valid?: boolean;
8
+ }
9
+ type Options<T = any> = Partial<ArrayControlOptions<T>>;
10
+ export declare class RolsterArrayControl<E extends HTMLElement = HTMLElement, T = any> implements ReactArrayControl<E, T> {
11
+ readonly uuid: string;
8
12
  readonly value: T;
13
+ readonly initialValue: T;
9
14
  readonly dirty: boolean;
10
- readonly disabled: boolean;
11
- readonly enabled: boolean;
12
- readonly focused: boolean;
13
15
  readonly pristine: boolean;
14
16
  readonly touched: boolean;
15
- readonly unfocused: boolean;
16
- readonly uuid: string;
17
17
  readonly untouched: boolean;
18
+ readonly focused: boolean;
19
+ readonly unfocused: boolean;
20
+ readonly disabled: boolean;
21
+ readonly enabled: boolean;
22
+ readonly valid: boolean;
23
+ readonly invalid: boolean;
24
+ readonly wrong: boolean;
25
+ readonly errors: ValidatorError<T>[];
18
26
  readonly error?: ValidatorError<T>;
19
27
  readonly validators?: ValidatorFn<T>[];
20
28
  elementRef?: RefObject<E>;
21
- protected initialValue: T;
22
- protected subscriber?: ReactSubscriberControl<T>;
23
- constructor(options: ReactArrayControlOptions<T>);
29
+ protected subscriber?: ReactArrayControlSubscriber<E, T>;
30
+ constructor(options: ArrayControlOptions<T>);
24
31
  focus(): void;
25
32
  blur(): void;
26
33
  disable(): void;
@@ -28,19 +35,14 @@ export declare class RolsterReactArrayControl<E extends HTMLElement = HTMLElemen
28
35
  touch(): void;
29
36
  setInitialValue(value: T): void;
30
37
  setValue(value: T): void;
31
- setValidators(validators?: ValidatorFn<T>[]): void;
32
- subscribe(subscriber: ReactSubscriberControl<T>): void;
38
+ setValidators(validators?: ValidatorFn<T>[] | undefined): void;
39
+ subscribe(subscriber: ReactArrayControlSubscriber<E, T>): void;
33
40
  hasError(key: string): boolean;
34
41
  someErrors(keys: string[]): boolean;
35
42
  reset(): void;
36
- protected refresh(changes: Partial<ReactArrayControlOptions<T>>): void;
37
- }
38
- export declare class RolsterArrayControl<E extends HTMLElement = HTMLElement, T = any> extends RolsterReactArrayControl<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>;
43
+ protected isValid(errors: ValidatorError<T>[]): boolean;
44
+ protected builder(options: Options<T>): ReactArrayControl<E, T>;
45
+ protected refresh(action: ReactArrayAction, options: Options<T>): void;
44
46
  }
45
47
  interface ReactControlOptions<T = any> extends Omit<FormArrayControlOptions<T>, 'uuid'> {
46
48
  touched?: boolean;
@@ -1,10 +1,11 @@
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 RolsterReactArrayControl {
4
+ export class RolsterArrayControl {
5
5
  constructor(options) {
6
- this.initialValue = options.initialValue;
7
6
  this.uuid = options.uuid;
7
+ this.value = options.value;
8
+ this.initialValue = options.initialValue;
8
9
  this.focused = !!options.focused;
9
10
  this.unfocused = !this.focused;
10
11
  this.touched = !!options.touched;
@@ -13,36 +14,42 @@ export class RolsterReactArrayControl {
13
14
  this.pristine = !this.dirty;
14
15
  this.disabled = !!options.disabled;
15
16
  this.enabled = !this.disabled;
16
- const { value, validators } = options;
17
- this.value = value;
18
- this.validators = validators;
19
- this.errors = validators ? controlIsValid({ value, validators }) : [];
17
+ this.valid = this.isValid(options.errors);
18
+ this.invalid = !this.valid;
19
+ this.wrong = this.touched && this.invalid;
20
+ this.errors = options.errors;
20
21
  this.error = this.errors[0];
22
+ this.validators = options.validators;
21
23
  }
22
24
  focus() {
23
- this.unfocused && this.refresh({ focused: true });
25
+ this.unfocused && this.refresh('focused', { focused: true });
24
26
  }
25
27
  blur() {
26
- this.focused && this.refresh({ focused: false, touched: true });
28
+ this.focused && this.refresh('focused', { focused: false, touched: true });
27
29
  }
28
30
  disable() {
29
- this.enabled && this.refresh({ disabled: true });
31
+ this.enabled && this.refresh('disabled', { disabled: true });
30
32
  }
31
33
  enable() {
32
- this.disabled && this.refresh({ disabled: false });
34
+ this.disabled && this.refresh('disabled', { disabled: false });
33
35
  }
34
36
  touch() {
35
- this.untouched && this.refresh({ touched: true });
37
+ this.untouched && this.refresh('touched', { touched: true });
36
38
  }
37
39
  setInitialValue(value) {
38
- this.initialValue = value;
39
- this.setValue(value);
40
+ const { validators } = this;
41
+ const errors = validators ? controlIsValid({ value, validators }) : [];
42
+ this.refresh('value', { dirty: false, errors, initialValue: value, value });
40
43
  }
41
44
  setValue(value) {
42
- this.refresh({ value });
45
+ const { validators } = this;
46
+ const errors = validators ? controlIsValid({ value, validators }) : [];
47
+ this.refresh('value', { dirty: true, errors, value });
43
48
  }
44
49
  setValidators(validators) {
45
- this.refresh({ validators });
50
+ const { value } = this;
51
+ const errors = validators ? controlIsValid({ value, validators }) : [];
52
+ this.refresh('validators', { errors, validators });
46
53
  }
47
54
  subscribe(subscriber) {
48
55
  this.subscriber = subscriber;
@@ -54,37 +61,37 @@ export class RolsterReactArrayControl {
54
61
  return someErrors(this.errors, keys);
55
62
  }
56
63
  reset() {
57
- this.refresh({
64
+ const { initialValue: value, validators } = this;
65
+ const errors = validators ? controlIsValid({ value, validators }) : [];
66
+ this.refresh('reset', {
58
67
  dirty: false,
68
+ errors,
59
69
  touched: false,
60
- value: this.initialValue
70
+ value
61
71
  });
62
72
  }
63
- refresh(changes) {
64
- this.subscriber &&
65
- this.subscriber({
66
- ...this,
67
- ...changes,
68
- initialValue: this.initialValue
69
- });
73
+ isValid(errors) {
74
+ return errors.length === 0;
75
+ }
76
+ builder(options) {
77
+ return new RolsterArrayControl({ ...this, ...options });
78
+ }
79
+ refresh(action, options) {
80
+ this.subscriber && this.subscriber(action, this.builder(options));
70
81
  }
71
82
  }
72
- export class RolsterArrayControl extends RolsterReactArrayControl {
83
+ class ReactRolsterArrayControl extends RolsterArrayControl {
73
84
  constructor(options) {
74
- super(options);
75
- this.valid = this.errors.length === 0;
76
- this.invalid = !this.valid;
77
- this.wrong = this.touched && this.invalid;
78
- }
79
- clone(options) {
80
- return new RolsterArrayControl(options);
85
+ const { value, validators } = options;
86
+ const errors = validators ? controlIsValid({ value, validators }) : [];
87
+ super({ ...options, errors });
81
88
  }
82
89
  }
83
90
  function rolsterArrayControl(options, validators) {
84
- const controlOptions = createFormControlOptions(options, validators);
85
- return new RolsterArrayControl({
86
- ...controlOptions,
87
- initialValue: controlOptions.value,
91
+ const _options = createFormControlOptions(options, validators);
92
+ return new ReactRolsterArrayControl({
93
+ ..._options,
94
+ initialValue: _options.value,
88
95
  uuid: uuid()
89
96
  });
90
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"form-array-control.js","sourceRoot":"","sources":["../../../src/form-array/form-array-control.ts"],"names":[],"mappings":"AAC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,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,32 +1,6 @@
1
- import { ControlsValue, FormArrayGroupOptions, ValidatorGroupFn } from '@rolster/forms';
2
- import { ValidatorError } from '@rolster/validators';
3
- import { ReactArrayControls, ReactArrayGroup, ReactSubscriberGroup } from '../types';
4
- export declare class RolsterArrayGroup<C extends ReactArrayControls = ReactArrayControls, R = any> implements ReactArrayGroup<C, R> {
5
- readonly uuid: string;
6
- readonly controls: C;
7
- readonly value: ControlsValue<C>;
8
- readonly dirty: boolean;
9
- readonly dirties: boolean;
10
- readonly errors: ValidatorError<any>[];
11
- readonly invalid: boolean;
12
- readonly pristine: boolean;
13
- readonly pristines: boolean;
14
- readonly touched: boolean;
15
- readonly toucheds: boolean;
16
- readonly untouched: boolean;
17
- readonly untoucheds: boolean;
18
- readonly valid: boolean;
19
- readonly wrong: boolean;
20
- readonly error?: ValidatorError<any>;
21
- readonly validators?: ValidatorGroupFn<C>[];
22
- readonly resource?: R;
23
- protected subscriber?: ReactSubscriberGroup<C, R>;
24
- constructor(options: FormArrayGroupOptions<C, R>);
25
- setValidators(validators: ValidatorGroupFn<C>[]): void;
26
- subscribe(subscriber: ReactSubscriberGroup<C, R>): void;
27
- private refresh;
28
- }
29
- type RolsterGroupOptions<C extends ReactArrayControls = ReactArrayControls, R = any> = Omit<FormArrayGroupOptions<C, R>, 'uuid'>;
30
- export declare function formArrayGroup<C extends ReactArrayControls = ReactArrayControls, R = any>(options: RolsterGroupOptions<C, R>): ReactArrayGroup<C, R>;
1
+ import { FormArrayGroupOptions, ValidatorGroupFn } from '@rolster/forms';
2
+ import { ReactArrayControls, ReactArrayGroup } from '../types';
3
+ type ReactGroupOptions<C extends ReactArrayControls = ReactArrayControls, R = any> = Omit<FormArrayGroupOptions<C, R>, 'uuid'>;
4
+ export declare function formArrayGroup<C extends ReactArrayControls = ReactArrayControls, R = any>(options: ReactGroupOptions<C, R>): ReactArrayGroup<C, R>;
31
5
  export declare function formArrayGroup<C extends ReactArrayControls = ReactArrayControls, R = any>(controls: C, validators?: ValidatorGroupFn<C, R>[]): ReactArrayGroup<C, R>;
32
6
  export {};
@@ -1,49 +1,104 @@
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
- export class RolsterArrayGroup {
4
+ import { replaceControl } from '../utilities';
5
+ function refactorForValid(controls, validators) {
6
+ const errors = validators ? groupIsValid({ controls, validators }) : [];
7
+ return {
8
+ errors,
9
+ valid: errors.length === 0 && controlsAllChecked(controls, 'valid')
10
+ };
11
+ }
12
+ function refactorForControls(group, controls, action) {
13
+ switch (action) {
14
+ case 'focused':
15
+ case 'touched':
16
+ return {
17
+ touched: controlsPartialChecked(controls, 'touched'),
18
+ toucheds: controlsAllChecked(controls, 'touched')
19
+ };
20
+ case 'validators':
21
+ return refactorForValid(controls, group.validators);
22
+ case 'reset':
23
+ return {
24
+ ...refactorForValid(controls, group.validators),
25
+ dirty: controlsPartialChecked(controls, 'dirty'),
26
+ dirties: controlsAllChecked(controls, 'dirty'),
27
+ touched: controlsPartialChecked(controls, 'touched'),
28
+ toucheds: controlsAllChecked(controls, 'touched'),
29
+ value: controlsToValue(controls)
30
+ };
31
+ case 'list':
32
+ case 'value':
33
+ return {
34
+ ...refactorForValid(controls, group.validators),
35
+ dirty: controlsPartialChecked(controls, 'dirty'),
36
+ dirties: controlsAllChecked(controls, 'dirty'),
37
+ value: controlsToValue(controls)
38
+ };
39
+ default:
40
+ return {};
41
+ }
42
+ }
43
+ class BaseArrayGroup {
5
44
  constructor(options) {
6
- const { controls, resource, uuid, validators } = options;
7
- this.uuid = uuid;
8
- this.controls = controls;
9
- this.validators = validators;
10
- this.resource = resource;
11
- this.errors = validators ? groupIsValid({ controls, validators }) : [];
12
- this.error = this.errors[0];
13
- this.valid =
14
- this.errors.length === 0 && controlsAllChecked(controls, 'valid');
15
- this.invalid = !this.valid;
16
- this.dirty = controlsPartialChecked(controls, 'dirty');
17
- this.dirties = controlsAllChecked(controls, 'dirty');
18
- this.touched = controlsPartialChecked(controls, 'touched');
19
- this.toucheds = controlsAllChecked(controls, 'touched');
45
+ this.uuid = options.uuid;
46
+ this.controls = options.controls;
47
+ this.value = options.value;
48
+ this.resource = options.resource;
49
+ this.dirty = !!options.dirty;
50
+ this.dirties = !!options.dirties;
20
51
  this.pristine = !this.dirty;
21
52
  this.pristines = !this.dirties;
53
+ this.touched = !!options.touched;
54
+ this.toucheds = !!options.toucheds;
22
55
  this.untouched = !this.touched;
23
56
  this.untoucheds = !this.toucheds;
57
+ this.valid = !!options.valid;
58
+ this.invalid = !this.valid;
24
59
  this.wrong = this.touched && this.invalid;
25
- this.value = controlsToValue(controls);
26
- const subscriber = (options) => {
27
- this.refresh({
28
- controls: Object.entries(this.controls).reduce((controls, [key, control]) => {
29
- controls[key] =
30
- control.uuid === options.uuid ? control.clone(options) : control;
31
- return controls;
32
- }, {})
60
+ this.errors = options.errors;
61
+ this.error = this.errors[0];
62
+ this.validators = options.validators;
63
+ const subscriber = (action, control) => {
64
+ const controls = replaceControl(this.controls, control);
65
+ this.refresh(action, {
66
+ ...refactorForControls(this, controls, action),
67
+ controls
33
68
  });
34
69
  };
35
- Object.values(controls).forEach((control) => {
70
+ Object.values(this.controls).forEach((control) => {
36
71
  control.subscribe(subscriber);
37
72
  });
38
73
  }
39
- setValidators(validators) {
40
- this.refresh({ validators });
41
- }
42
74
  subscribe(subscriber) {
43
75
  this.subscriber = subscriber;
44
76
  }
45
- refresh(changes) {
46
- this.subscriber && this.subscriber({ ...this, ...changes });
77
+ setValidators(validators) {
78
+ this.refresh('validators', {
79
+ ...refactorForValid(this.controls, validators),
80
+ validators
81
+ });
82
+ }
83
+ refresh(action, options) {
84
+ this.subscriber &&
85
+ this.subscriber(action, new BaseArrayGroup({ ...this, ...options }));
86
+ }
87
+ }
88
+ class RolsterArrayGroup extends BaseArrayGroup {
89
+ constructor(options) {
90
+ const { controls, validators } = options;
91
+ const errors = validators ? groupIsValid({ controls, validators }) : [];
92
+ super({
93
+ ...options,
94
+ errors,
95
+ value: controlsToValue(controls),
96
+ dirties: controlsAllChecked(controls, 'dirty'),
97
+ dirty: controlsPartialChecked(controls, 'dirty'),
98
+ touched: controlsPartialChecked(controls, 'touched'),
99
+ toucheds: controlsAllChecked(controls, 'touched'),
100
+ valid: errors.length === 0 && controlsAllChecked(controls, 'valid')
101
+ });
47
102
  }
48
103
  }
49
104
  export function formArrayGroup(options, validators) {