@envisiongroup/porygon 1.0.0-rc.9 → 1.0.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/README.md +50 -14
- package/dist/index.d.ts +9 -15
- package/dist/index.js +95 -55
- package/dist/react-components/buttons/EFWButton/EFWButton.d.ts +1 -1
- package/dist/react-components/buttons/EFWButton/EFWButton.hooks.js +32 -31
- package/dist/react-components/buttons/EFWButton/EFWButton.js +158 -90
- package/dist/react-components/buttons/EFWButton/EFWButton.types.d.ts +32 -6
- package/dist/react-components/buttons/EFWButton/index.d.ts +1 -1
- package/dist/react-components/buttons/EFWDrawerButton/EFWDrawerButton.d.ts +1 -1
- package/dist/react-components/buttons/EFWDrawerButton/EFWDrawerButton.types.d.ts +1 -1
- package/dist/react-components/buttons/EFWGroupButton/EFWGroupButton.d.ts +1 -63
- package/dist/react-components/buttons/EFWGroupButton/EFWGroupButton.js +120 -85
- package/dist/react-components/buttons/EFWGroupButton/EFWGroupButton.types.d.ts +7 -1
- package/dist/react-components/buttons/EFWGroupButton/index.d.ts +1 -1
- package/dist/react-components/commons/caretPositioning.d.ts +35 -0
- package/dist/react-components/commons/caretPositioning.js +28 -0
- package/dist/react-components/commons/utils.d.ts +1 -1
- package/dist/react-components/commons/utils.js +1 -1
- package/dist/react-components/commons/valueNormalization.d.ts +28 -0
- package/dist/react-components/commons/valueNormalization.js +6 -0
- package/dist/react-components/fields/Attachments/EFWAttachments.js +205 -0
- package/dist/react-components/fields/{EFWAttachments → Attachments}/EFWAttachments.types.d.ts +32 -2
- package/dist/react-components/fields/Attachments/EFWAttachments.utils.d.ts +8 -0
- package/dist/react-components/fields/Attachments/EFWAttachments.utils.js +4 -0
- package/dist/react-components/fields/{EFWAttachments/EFWAttachmentsCard → Attachments}/EFWAttachmentsCard.d.ts +2 -11
- package/dist/react-components/fields/Attachments/EFWAttachmentsCard.js +164 -0
- package/dist/react-components/fields/{EFWAttachments/EFWAttachmentsCard → Attachments}/EFWAttachmentsCard.types.d.ts +21 -1
- package/dist/react-components/fields/Attachments/EFWAttachmentsField.js +70 -0
- package/dist/react-components/fields/{EFWAttachmentsField → Attachments}/EFWAttachmentsField.types.d.ts +2 -2
- package/dist/react-components/fields/Attachments/index.d.ts +5 -0
- package/dist/react-components/fields/Attachments/index.js +8 -0
- package/dist/react-components/fields/{EFWDatePicker → DatePicker}/EFWDatePicker.d.ts +1 -3
- package/dist/react-components/fields/DatePicker/EFWDatePicker.js +134 -0
- package/dist/react-components/fields/{EFWDatePicker → DatePicker}/EFWDatePicker.types.d.ts +19 -7
- package/dist/react-components/fields/DatePicker/EFWDatePicker.utils.d.ts +19 -0
- package/dist/react-components/fields/DatePicker/EFWDatePicker.utils.js +179 -0
- package/dist/react-components/fields/DatePicker/EFWDatePickerField.js +251 -0
- package/dist/react-components/fields/DatePicker/EFWDatePickerField.types.d.ts +15 -0
- package/dist/react-components/fields/DatePicker/index.d.ts +6 -0
- package/dist/react-components/fields/DatePicker/index.js +11 -0
- package/dist/react-components/fields/Input/EFWInput.d.ts +10 -0
- package/dist/react-components/fields/Input/EFWInput.js +260 -0
- package/dist/react-components/fields/{EFWInput → Input}/EFWInput.types.d.ts +120 -25
- package/dist/react-components/fields/Input/EFWInput.utils.d.ts +101 -0
- package/dist/react-components/fields/Input/EFWInput.utils.js +222 -0
- package/dist/react-components/fields/Input/EFWInput.validation.d.ts +20 -0
- package/dist/react-components/fields/Input/EFWInput.validation.js +72 -0
- package/dist/react-components/fields/Input/EFWInputField.js +86 -0
- package/dist/react-components/fields/{EFWInputField → Input}/EFWInputField.types.d.ts +2 -2
- package/dist/react-components/fields/Input/index.d.ts +5 -0
- package/dist/react-components/fields/Input/index.js +8 -0
- package/dist/react-components/fields/NumberInput/EFWNumberInput.js +339 -0
- package/dist/react-components/fields/{EFWNumberInput → NumberInput}/EFWNumberInput.types.d.ts +33 -14
- package/dist/react-components/fields/{EFWNumberInput → NumberInput}/EFWNumberInput.utils.d.ts +20 -14
- package/dist/react-components/fields/NumberInput/EFWNumberInput.utils.js +86 -0
- package/dist/react-components/fields/NumberInput/EFWNumberInputField.js +84 -0
- package/dist/react-components/fields/{EFWNumberInputField → NumberInput}/EFWNumberInputField.types.d.ts +2 -2
- package/dist/react-components/fields/NumberInput/index.d.ts +5 -0
- package/dist/react-components/fields/NumberInput/index.js +8 -0
- package/dist/react-components/fields/Switch/EFWSwitch.js +75 -0
- package/dist/react-components/fields/{EFWSwitch → Switch}/EFWSwitch.types.d.ts +18 -10
- package/dist/react-components/fields/Switch/EFWSwitch.utils.d.ts +9 -0
- package/dist/react-components/fields/Switch/EFWSwitch.utils.js +4 -0
- package/dist/react-components/fields/Switch/EFWSwitchField.js +62 -0
- package/dist/react-components/fields/{EFWSwitchField → Switch}/EFWSwitchField.types.d.ts +6 -2
- package/dist/react-components/fields/Switch/index.d.ts +5 -0
- package/dist/react-components/fields/Switch/index.js +8 -0
- package/dist/react-components/fields/TagPicker/EFWTagPicker.js +384 -0
- package/dist/react-components/fields/{EFWTagPicker → TagPicker}/EFWTagPicker.types.d.ts +30 -17
- package/dist/react-components/fields/TagPicker/EFWTagPicker.utils.d.ts +6 -0
- package/dist/react-components/fields/TagPicker/EFWTagPicker.utils.js +4 -0
- package/dist/react-components/fields/TagPicker/EFWTagPickerField.js +83 -0
- package/dist/react-components/fields/{EFWTagPickerField → TagPicker}/EFWTagPickerField.types.d.ts +2 -2
- package/dist/react-components/fields/TagPicker/index.d.ts +5 -0
- package/dist/react-components/fields/TagPicker/index.js +8 -0
- package/dist/react-components/fields/TextArea/EFWTextArea.js +153 -0
- package/dist/react-components/fields/{EFWTextArea → TextArea}/EFWTextArea.types.d.ts +26 -8
- package/dist/react-components/fields/TextArea/EFWTextArea.utils.d.ts +6 -0
- package/dist/react-components/fields/TextArea/EFWTextArea.utils.js +4 -0
- package/dist/react-components/fields/TextArea/EFWTextAreaField.js +80 -0
- package/dist/react-components/fields/{EFWTextAreaField → TextArea}/EFWTextAreaField.types.d.ts +2 -2
- package/dist/react-components/fields/TextArea/index.d.ts +5 -0
- package/dist/react-components/fields/TextArea/index.js +8 -0
- package/dist/react-components/fields/_shared/EFWField/EFWField.js +119 -0
- package/dist/react-components/fields/{EFWField → _shared/EFWField}/EFWField.types.d.ts +24 -13
- package/dist/react-components/fields/_shared/EFWField/EFWField.utils.js +20 -0
- package/dist/react-components/fields/_shared/EFWField/useSyncedValidationState.d.ts +50 -0
- package/dist/react-components/fields/_shared/EFWField/useSyncedValidationState.js +41 -0
- package/dist/react-components/fields/test-utils/testUtils.js +10 -0
- package/dist/react-components/forms/EFWForm/EFWForm.converter.d.ts +16 -1
- package/dist/react-components/forms/EFWForm/EFWForm.converter.js +51 -20
- package/dist/react-components/forms/EFWForm/EFWForm.flatConverter.d.ts +130 -0
- package/dist/react-components/forms/EFWForm/EFWForm.flatConverter.js +279 -0
- package/dist/react-components/forms/EFWForm/EFWForm.hooks.js +21 -18
- package/dist/react-components/forms/EFWForm/EFWForm.js +866 -403
- package/dist/react-components/forms/EFWForm/EFWForm.types.d.ts +213 -89
- package/dist/react-components/forms/EFWForm/EFWForm.utils.d.ts +10 -5
- package/dist/react-components/forms/EFWForm/EFWForm.utils.js +356 -229
- package/dist/react-components/forms/EFWForm/index.d.ts +5 -2
- package/dist/react-components/forms/EFWForm/index.js +10 -6
- package/dist/react-components/forms/EFWFormMessageBarGroup/EFWFormMessageBarGroup.js +55 -55
- package/dist/react-components/forms/EFWMessageBarManager/EFWMessageBarManager.js +38 -29
- package/dist/react-components/hooks/useDrawer/component/EFWDrawer/EFWDrawer.js +49 -47
- package/dist/react-components/hooks/useDrawer/component/EFWDrawer/EFWDrawer.types.d.ts +1 -0
- package/dist/react-components/hooks/useDrawer/component/EFWDrawerLoader/EFWDrawerLoader.d.ts +5 -3
- package/dist/react-components/hooks/useDrawer/component/EFWDrawerLoader/EFWDrawerLoader.js +6 -6
- package/dist/react-components/hooks/useDrawer/index.d.ts +1 -1
- package/dist/react-components/hooks/useDrawer/useDrawer.d.ts +4 -2
- package/dist/react-components/hooks/useDrawer/useDrawer.js +216 -111
- package/dist/react-components/hooks/useDrawer/useDrawer.types.d.ts +15 -2
- package/dist/react-components/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +42 -0
- package/dist/react-components/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +5 -0
- package/dist/react-components/i18n/PorygonI18nProvider.d.ts +13 -0
- package/dist/react-components/i18n/PorygonI18nProvider.js +145 -0
- package/dist/react-components/i18n/defaultLocaleText.d.ts +6 -0
- package/dist/react-components/i18n/defaultLocaleText.js +176 -0
- package/dist/react-components/i18n/index.d.ts +4 -0
- package/dist/react-components/i18n/index.js +19 -0
- package/dist/react-components/i18n/localePresets.d.ts +10 -0
- package/dist/react-components/i18n/localePresets.js +366 -0
- package/dist/react-components/i18n/porygonI18n.types.d.ts +169 -0
- package/dist/react-components/layout/MainNavItems/MainNavItems.js +13 -13
- package/dist/react-components/tables/EFWTable/EFWTable.d.ts +2 -5
- package/dist/react-components/tables/EFWTable/EFWTable.js +916 -525
- package/dist/react-components/tables/EFWTable/EFWTable.types.d.ts +256 -62
- package/dist/react-components/tables/EFWTable/components/EFWTableBody/EFWTableBody.d.ts +5 -1
- package/dist/react-components/tables/EFWTable/components/EFWTableBody/EFWTableBody.js +97 -52
- package/dist/react-components/tables/EFWTable/components/EFWTableBody/EFWTableBody.types.d.ts +4 -1
- package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.d.ts +1 -12
- package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.js +47 -22
- package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.types.d.ts +13 -0
- package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.d.ts +1 -1
- package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.js +94 -69
- package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.types.d.ts +7 -16
- package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/index.d.ts +1 -1
- package/dist/react-components/tables/EFWTable/components/EFWTableHeader/EFWTableHeader.d.ts +1 -1
- package/dist/react-components/tables/EFWTable/components/EFWTableHeader/EFWTableHeader.js +218 -83
- package/dist/react-components/tables/EFWTable/components/EFWTableHeader/EFWTableHeader.types.d.ts +3 -0
- package/dist/react-components/tables/EFWTable/components/EFWTableOverlay/EFWTableOverlay.js +90 -88
- package/dist/react-components/tables/EFWTable/components/EFWTableOverlay/EFWTableOverlay.types.d.ts +5 -0
- package/dist/react-components/tables/EFWTable/components/EFWTableRow/EFWTableRow.d.ts +1 -18
- package/dist/react-components/tables/EFWTable/components/EFWTableRow/EFWTableRow.js +83 -45
- package/dist/react-components/tables/EFWTable/components/EFWTableRow/EFWTableRow.types.d.ts +23 -0
- package/dist/react-components/tables/EFWTable/hooks/useDefaultAddButton/useDefaultAddButton.d.ts +2 -1
- package/dist/react-components/tables/EFWTable/hooks/useDefaultAddButton/useDefaultAddButton.js +65 -48
- package/dist/react-components/tables/EFWTable/hooks/useDefaultDeleteButton/useDefaultDeleteButton.d.ts +2 -1
- package/dist/react-components/tables/EFWTable/hooks/useDefaultDeleteButton/useDefaultDeleteButton.js +71 -48
- package/dist/react-components/tables/EFWTable/hooks/useDefaultFilterButton/useDefaultFilterButton.d.ts +17 -0
- package/dist/react-components/tables/EFWTable/hooks/useDefaultFilterButton/useDefaultFilterButton.js +255 -0
- package/dist/react-components/tables/EFWTable/hooks/useDefaultUpdateButton/useDefaultUpdateButton.d.ts +2 -1
- package/dist/react-components/tables/EFWTable/hooks/useDefaultUpdateButton/useDefaultUpdateButton.js +72 -52
- package/dist/react-components/tables/EFWTable/hooks/useStableColumnRenderers/useStableColumnRenderers.d.ts +10 -0
- package/dist/react-components/tables/EFWTable/hooks/useStableColumnRenderers/useStableColumnRenderers.js +28 -0
- package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.js +151 -115
- package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.d.ts +1 -1
- package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.js +100 -53
- package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.types.d.ts +5 -1
- package/dist/react-components/tables/EFWTable/index.d.ts +4 -1
- package/dist/react-components/tables/EFWTable/index.js +7 -5
- package/dist/react-components/tables/EFWTable/utils/CellRenderer/CellRenderer.js +26 -23
- package/dist/react-components/tables/EFWTable/utils/cache.d.ts +1 -8
- package/dist/react-components/tables/EFWTable/utils/cache.js +40 -49
- package/dist/react-components/tables/EFWTable/utils/filterFunctions.d.ts +16 -0
- package/dist/react-components/tables/EFWTable/utils/filterFunctions.js +52 -0
- package/dist/react-components/tables/EFWTable/utils/hashing.d.ts +2 -2
- package/dist/react-components/tables/EFWTable/utils/hashing.js +2 -2
- package/package.json +49 -22
- package/dist/react-components/fields/EFWAttachments/EFWAttachments.js +0 -125
- package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/EFWAttachmentsCard.js +0 -107
- package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/index.d.ts +0 -1
- package/dist/react-components/fields/EFWAttachments/index.d.ts +0 -2
- package/dist/react-components/fields/EFWAttachments/index.js +0 -4
- package/dist/react-components/fields/EFWAttachmentsField/EFWAttachmentsField.js +0 -57
- package/dist/react-components/fields/EFWAttachmentsField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWAttachmentsField/index.js +0 -4
- package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.js +0 -114
- package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.utils.d.ts +0 -24
- package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.utils.js +0 -90
- package/dist/react-components/fields/EFWDatePicker/index.d.ts +0 -2
- package/dist/react-components/fields/EFWDatePicker/index.js +0 -4
- package/dist/react-components/fields/EFWDatePickerField/EFWDatePickerField.js +0 -65
- package/dist/react-components/fields/EFWDatePickerField/EFWDatePickerField.types.d.ts +0 -7
- package/dist/react-components/fields/EFWDatePickerField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWDatePickerField/index.js +0 -4
- package/dist/react-components/fields/EFWField/EFWField.js +0 -96
- package/dist/react-components/fields/EFWField/EFWField.utils.js +0 -17
- package/dist/react-components/fields/EFWInput/EFWInput.d.ts +0 -26
- package/dist/react-components/fields/EFWInput/EFWInput.js +0 -119
- package/dist/react-components/fields/EFWInput/EFWInput.utils.d.ts +0 -20
- package/dist/react-components/fields/EFWInput/EFWInput.utils.js +0 -83
- package/dist/react-components/fields/EFWInput/index.d.ts +0 -2
- package/dist/react-components/fields/EFWInput/index.js +0 -4
- package/dist/react-components/fields/EFWInputField/EFWInputField.js +0 -73
- package/dist/react-components/fields/EFWInputField/EFWInputField.utils.d.ts +0 -1
- package/dist/react-components/fields/EFWInputField/EFWInputField.utils.js +0 -0
- package/dist/react-components/fields/EFWInputField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWInputField/index.js +0 -4
- package/dist/react-components/fields/EFWNumberInput/EFWNumberInput.js +0 -198
- package/dist/react-components/fields/EFWNumberInput/EFWNumberInput.utils.js +0 -76
- package/dist/react-components/fields/EFWNumberInput/index.d.ts +0 -2
- package/dist/react-components/fields/EFWNumberInput/index.js +0 -4
- package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.js +0 -67
- package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.utils.d.ts +0 -1
- package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.utils.js +0 -0
- package/dist/react-components/fields/EFWNumberInputField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWNumberInputField/index.js +0 -4
- package/dist/react-components/fields/EFWSwitch/EFWSwitch.js +0 -55
- package/dist/react-components/fields/EFWSwitch/index.d.ts +0 -2
- package/dist/react-components/fields/EFWSwitch/index.js +0 -4
- package/dist/react-components/fields/EFWSwitchField/EFWSwitchField.js +0 -55
- package/dist/react-components/fields/EFWSwitchField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWSwitchField/index.js +0 -4
- package/dist/react-components/fields/EFWTagPicker/EFWTagPicker.js +0 -244
- package/dist/react-components/fields/EFWTagPicker/index.d.ts +0 -2
- package/dist/react-components/fields/EFWTagPicker/index.js +0 -4
- package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.js +0 -74
- package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.utils.d.ts +0 -1
- package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.utils.js +0 -0
- package/dist/react-components/fields/EFWTagPickerField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWTagPickerField/index.js +0 -4
- package/dist/react-components/fields/EFWTextArea/EFWTextArea.js +0 -105
- package/dist/react-components/fields/EFWTextArea/EFWTextArea.utils.d.ts +0 -1
- package/dist/react-components/fields/EFWTextArea/EFWTextArea.utils.js +0 -0
- package/dist/react-components/fields/EFWTextArea/index.d.ts +0 -2
- package/dist/react-components/fields/EFWTextArea/index.js +0 -4
- package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.js +0 -71
- package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.utils.d.ts +0 -1
- package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.utils.js +0 -0
- package/dist/react-components/fields/EFWTextAreaField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWTextAreaField/index.js +0 -4
- package/dist/react-components/fields/types.d.ts +0 -1
- package/dist/react-components/fields/types.js +0 -0
- package/dist/utils/htmlConverter.d.ts +0 -15
- package/dist/utils/htmlConverter.js +0 -12
- /package/dist/react-components/fields/{EFWAttachments → Attachments}/EFWAttachments.d.ts +0 -0
- /package/dist/react-components/fields/{EFWAttachmentsField → Attachments}/EFWAttachmentsField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWDatePickerField → DatePicker}/EFWDatePickerField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWInputField → Input}/EFWInputField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWNumberInput → NumberInput}/EFWNumberInput.d.ts +0 -0
- /package/dist/react-components/fields/{EFWNumberInputField → NumberInput}/EFWNumberInputField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWSwitch → Switch}/EFWSwitch.d.ts +0 -0
- /package/dist/react-components/fields/{EFWSwitchField → Switch}/EFWSwitchField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWTagPicker → TagPicker}/EFWTagPicker.d.ts +0 -0
- /package/dist/react-components/fields/{EFWTagPickerField → TagPicker}/EFWTagPickerField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWTextArea → TextArea}/EFWTextArea.d.ts +0 -0
- /package/dist/react-components/fields/{EFWTextAreaField → TextArea}/EFWTextAreaField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWField → _shared/EFWField}/EFWField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWField → _shared/EFWField}/EFWField.utils.d.ts +0 -0
- /package/dist/react-components/fields/{EFWField → _shared/EFWField}/index.d.ts +0 -0
- /package/dist/react-components/fields/{EFWField → _shared/EFWField}/index.js +0 -0
- /package/dist/{react-components/fields/EFWAttachments/EFWAttachmentsCard/index.js → vite-raw.d.js} +0 -0
|
@@ -4,18 +4,21 @@ import { InfoLabelProps, FieldProps } from '@fluentui/react-components';
|
|
|
4
4
|
* Estado de validación del campo, heredado de FieldProps.
|
|
5
5
|
* Define el estado actual de la validación del componente.
|
|
6
6
|
*
|
|
7
|
-
* @typedef {'
|
|
7
|
+
* @typedef {'none' | 'error' | 'warning' | 'success' | 'loading' | undefined} ValidationState
|
|
8
8
|
* @example
|
|
9
|
-
* // Campo
|
|
10
|
-
* const state: ValidationState = '
|
|
9
|
+
* // Campo exitoso
|
|
10
|
+
* const state: ValidationState = 'success';
|
|
11
11
|
*
|
|
12
12
|
* // Campo con error
|
|
13
|
-
* const errorState: ValidationState = '
|
|
13
|
+
* const errorState: ValidationState = 'error';
|
|
14
|
+
*
|
|
15
|
+
* // Campo en carga
|
|
16
|
+
* const loadingState: ValidationState = 'loading';
|
|
14
17
|
*
|
|
15
18
|
* // Campo sin validar
|
|
16
|
-
* const neutralState: ValidationState =
|
|
19
|
+
* const neutralState: ValidationState = 'none';
|
|
17
20
|
*/
|
|
18
|
-
export type ValidationState = FieldProps['validationState'] | string;
|
|
21
|
+
export type ValidationState = FieldProps['validationState'] | 'loading' | string;
|
|
19
22
|
/**
|
|
20
23
|
* Mensaje de validación del campo, heredado de FieldProps.
|
|
21
24
|
* Contiene el texto descriptivo del estado de validación.
|
|
@@ -51,7 +54,7 @@ export type ValidationMessage = FieldProps['validationMessage'];
|
|
|
51
54
|
* const advancedProps: EFWFieldProps = {
|
|
52
55
|
* title: "Email corporativo",
|
|
53
56
|
* required: true,
|
|
54
|
-
* validationState: "
|
|
57
|
+
* validationState: "error",
|
|
55
58
|
* validationMessage: "Formato de email inválido",
|
|
56
59
|
* onValidationChange: (validation) => {
|
|
57
60
|
* console.log('Estado:', validation.currentValidationState);
|
|
@@ -60,6 +63,10 @@ export type ValidationMessage = FieldProps['validationMessage'];
|
|
|
60
63
|
* };
|
|
61
64
|
*/
|
|
62
65
|
export interface EFWFieldProps {
|
|
66
|
+
/**
|
|
67
|
+
* Atributo de datos para identificar el internalName del campo en el DOM.
|
|
68
|
+
*/
|
|
69
|
+
'data-field-internal-name'?: string;
|
|
63
70
|
/**
|
|
64
71
|
* Título del campo, mostrado como etiqueta principal.
|
|
65
72
|
* Se renderiza generalmente como un label asociado al input.
|
|
@@ -160,15 +167,19 @@ export interface EFWFieldProps {
|
|
|
160
167
|
* Determina el estilo visual y comportamiento del campo.
|
|
161
168
|
*
|
|
162
169
|
* @example
|
|
163
|
-
* validationState="
|
|
170
|
+
* validationState="error"
|
|
164
171
|
*
|
|
165
172
|
* @example
|
|
166
173
|
* validationState="warning"
|
|
167
174
|
*
|
|
168
175
|
* @example
|
|
169
|
-
* validationState="
|
|
176
|
+
* validationState="success"
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* validationState="loading"
|
|
170
180
|
*/
|
|
171
181
|
validationState?: ValidationState;
|
|
182
|
+
validationMessageIcon?: FieldProps['validationMessageIcon'];
|
|
172
183
|
/**
|
|
173
184
|
* Mensaje asociado al estado de validación.
|
|
174
185
|
* Se muestra al usuario para explicar el estado de validación.
|
|
@@ -199,7 +210,7 @@ export interface EFWFieldProps {
|
|
|
199
210
|
*
|
|
200
211
|
* @example
|
|
201
212
|
* onValidationChange={({ currentValidationState, currentValidationMessage }) => {
|
|
202
|
-
* if (currentValidationState === '
|
|
213
|
+
* if (currentValidationState === 'success') {
|
|
203
214
|
* onFieldValid(fieldName);
|
|
204
215
|
* } else {
|
|
205
216
|
* onFieldInvalid(fieldName, currentValidationMessage);
|
|
@@ -223,9 +234,9 @@ export interface EFWFieldProps {
|
|
|
223
234
|
* onBlur={(value) => {
|
|
224
235
|
* // El hijo puede usar setParentComponentState para reportar validación
|
|
225
236
|
* if (!isValidEmail(value)) {
|
|
226
|
-
* setParentComponentState('
|
|
237
|
+
* setParentComponentState('error', 'Email inválido');
|
|
227
238
|
* } else {
|
|
228
|
-
* setParentComponentState('
|
|
239
|
+
* setParentComponentState('success');
|
|
229
240
|
* }
|
|
230
241
|
* }}
|
|
231
242
|
* />
|
|
@@ -288,7 +299,7 @@ export interface EFWFieldChildrenProps {
|
|
|
288
299
|
* Callback para comunicar cambios de estado al componente padre
|
|
289
300
|
* @param status - Nuevo estado de validación a propagar
|
|
290
301
|
* @param message - Mensaje opcional asociado al estado
|
|
291
|
-
* @example setParentComponentState('
|
|
302
|
+
* @example setParentComponentState('error', 'Este campo es requerido')
|
|
292
303
|
*/
|
|
293
304
|
setParentComponentState?: (status: ValidationState, message?: ValidationMessage) => void;
|
|
294
305
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Spinner as n } from "@fluentui/react-components";
|
|
3
|
+
import { CheckmarkCircle12Regular as t, Warning12Regular as a, ErrorCircle12Regular as i } from "@fluentui/react-icons";
|
|
4
|
+
const u = (e) => {
|
|
5
|
+
switch (e) {
|
|
6
|
+
case "error":
|
|
7
|
+
return /* @__PURE__ */ r(i, {});
|
|
8
|
+
case "warning":
|
|
9
|
+
return /* @__PURE__ */ r(a, {});
|
|
10
|
+
case "success":
|
|
11
|
+
return /* @__PURE__ */ r(t, {});
|
|
12
|
+
case "loading":
|
|
13
|
+
return /* @__PURE__ */ r(n, { size: "extra-tiny" });
|
|
14
|
+
default:
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
u as getValidationIcon
|
|
20
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ValidationMessage, ValidationState } from './EFWField.types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Argumentos del hook `useSyncedValidationState`.
|
|
5
|
+
*/
|
|
6
|
+
export interface UseSyncedValidationStateArgs {
|
|
7
|
+
/** Estado de validación impuesto por el componente padre (props externas). */
|
|
8
|
+
externalValidationState: ValidationState;
|
|
9
|
+
/** Mensaje de validación impuesto por el componente padre (props externas). */
|
|
10
|
+
externalValidationMessage: ValidationMessage;
|
|
11
|
+
/** Callback notificado cuando cambia el estado de validación efectivo. */
|
|
12
|
+
onValidationChange?: (validation: {
|
|
13
|
+
currentValidationState: ValidationState;
|
|
14
|
+
currentValidationMessage: ValidationMessage;
|
|
15
|
+
}) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resultado del hook `useSyncedValidationState`.
|
|
19
|
+
*/
|
|
20
|
+
export interface UseSyncedValidationStateResult {
|
|
21
|
+
/** Estado de validación efectivo que debe renderizar `EFWField`. */
|
|
22
|
+
validationState: ValidationState;
|
|
23
|
+
/** Mensaje de validación efectivo que debe renderizar `EFWField`. */
|
|
24
|
+
validationMessage: ValidationMessage;
|
|
25
|
+
/**
|
|
26
|
+
* Permite que el control hijo reporte su propio estado de validación.
|
|
27
|
+
* Si el hijo reporta valores no vacíos se usan; en otro caso se cae a las
|
|
28
|
+
* props externas (fallback). El último reporte crudo se recuerda para no
|
|
29
|
+
* suprimirlo cuando el padre limpia un error externo en la misma pulsación.
|
|
30
|
+
*/
|
|
31
|
+
setFieldState: (status?: ValidationState, message?: string) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Sincroniza el estado de validación de un campo entre dos fuentes:
|
|
35
|
+
*
|
|
36
|
+
* 1. **Props externas** (`externalValidationState`/`externalValidationMessage`):
|
|
37
|
+
* el padre (`EFWForm`) impone errores como el de obligatoriedad.
|
|
38
|
+
* 2. **Reporte del control hijo** (`setFieldState`): el campo concreto reporta
|
|
39
|
+
* sus propias reglas (minLength, formato, minValue, etc.).
|
|
40
|
+
*
|
|
41
|
+
* Regla clave de coexistencia: cuando el padre **limpia** un error externo
|
|
42
|
+
* (`error -> none`) en la misma pulsación en que el control hijo reportó un
|
|
43
|
+
* error propio, se **conserva** el error del hijo en vez de imponer `none`.
|
|
44
|
+
* Esto evita el "clobber" del error de regla propia al limpiar la
|
|
45
|
+
* obligatoriedad (p. ej. escribir una sola letra inválida con `minLength`).
|
|
46
|
+
*
|
|
47
|
+
* Se extrajo desde `EFWField` para aislar esta lógica de sincronización
|
|
48
|
+
* (antes embebida en dos `useEffect`) y reducir la complejidad del componente.
|
|
49
|
+
*/
|
|
50
|
+
export declare const useSyncedValidationState: ({ externalValidationState, externalValidationMessage, onValidationChange, }: UseSyncedValidationStateArgs) => UseSyncedValidationStateResult;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useState as h, useRef as v, useEffect as m, useCallback as S } from "react";
|
|
2
|
+
const k = ({
|
|
3
|
+
externalValidationState: r,
|
|
4
|
+
externalValidationMessage: n,
|
|
5
|
+
onValidationChange: E
|
|
6
|
+
}) => {
|
|
7
|
+
const [t, u] = h(
|
|
8
|
+
r
|
|
9
|
+
), [o, e] = h(
|
|
10
|
+
n
|
|
11
|
+
), R = v(!1), f = v(
|
|
12
|
+
null
|
|
13
|
+
), p = v(
|
|
14
|
+
r
|
|
15
|
+
);
|
|
16
|
+
m(() => {
|
|
17
|
+
if (!R.current) {
|
|
18
|
+
R.current = !0, p.current = r;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const s = p.current, c = f.current;
|
|
22
|
+
r === "none" && (n === "" || n === void 0) && s === "error" && c && c.state === "error" ? (u(c.state), e(c.msg)) : (u(r), e(n), r !== "none" && (f.current = null)), p.current = r;
|
|
23
|
+
}, [r, n]);
|
|
24
|
+
const w = S(
|
|
25
|
+
(s = "none", c = "") => {
|
|
26
|
+
f.current = { state: s ?? "none", msg: c };
|
|
27
|
+
const C = s !== "none" ? s : r, y = c !== "" ? c : n;
|
|
28
|
+
u(C), e(y);
|
|
29
|
+
},
|
|
30
|
+
[r, n]
|
|
31
|
+
);
|
|
32
|
+
return m(() => {
|
|
33
|
+
E?.({
|
|
34
|
+
currentValidationState: t,
|
|
35
|
+
currentValidationMessage: o
|
|
36
|
+
});
|
|
37
|
+
}, [t, o, E]), { validationState: t, validationMessage: o, setFieldState: w };
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
k as useSyncedValidationState
|
|
41
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { FluentProvider as m, webLightTheme as i } from "@fluentui/react-components";
|
|
3
|
+
import { render as p } from ".pnpm";
|
|
4
|
+
const f = (r, e) => p(r, {
|
|
5
|
+
wrapper: ({ children: t }) => /* @__PURE__ */ o(m, { theme: i, children: t }),
|
|
6
|
+
...e
|
|
7
|
+
});
|
|
8
|
+
export {
|
|
9
|
+
f as renderWithFluent
|
|
10
|
+
};
|
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
import { EFWFormFieldValue, EFWFormFieldProps, EFWFormFieldType } from './EFWForm.types';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface FormFieldDisplayTextOptions {
|
|
4
|
+
switchLabels?: {
|
|
5
|
+
checkedText?: string;
|
|
6
|
+
uncheckedText?: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Obtiene el texto de visualización para un campo de formulario.
|
|
11
|
+
* Es el punto de entrada público utilizado por componentes como `CellRenderer`
|
|
12
|
+
* para renderizar el contenido por defecto de una celda de tabla.
|
|
13
|
+
*
|
|
14
|
+
* @param formField - Props del campo de formulario que definen su tipo y configuración.
|
|
15
|
+
* @param cellValue - Valor actual del campo a representar como texto.
|
|
16
|
+
* @returns Texto formateado listo para mostrar en la UI, o cadena vacía si el valor es `null`/`undefined`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getFormFieldDisplayText: <T extends EFWFormFieldType>(formField: EFWFormFieldProps<T>, cellValue: EFWFormFieldValue<T>, options?: FormFieldDisplayTextOptions) => string;
|
|
@@ -1,30 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { getAttachmentsFormattedValue as m } from "../../fields/Attachments/EFWAttachments.utils.js";
|
|
2
|
+
import { getTagPickerFormattedValue as n } from "../../fields/TagPicker/EFWTagPicker.utils.js";
|
|
3
|
+
import { getSwitchFormattedValue as i } from "../../fields/Switch/EFWSwitch.utils.js";
|
|
4
|
+
import { getTextAreaFormattedValue as c } from "../../fields/TextArea/EFWTextArea.utils.js";
|
|
5
|
+
import { getNumberInputFormattedValue as u } from "../../fields/NumberInput/EFWNumberInput.utils.js";
|
|
6
|
+
import { getInputFormattedValue as s } from "../../fields/Input/EFWInput.utils.js";
|
|
7
|
+
import { getDatePickerFormattedValue as p } from "../../fields/DatePicker/EFWDatePicker.utils.js";
|
|
8
|
+
const d = {
|
|
9
|
+
Text: (r, t) => s(r, t.formatType, {
|
|
10
|
+
formatPattern: t.formatPattern,
|
|
11
|
+
formatFunction: t.formatFunction,
|
|
12
|
+
formatConfig: t.formatConfig
|
|
13
|
+
}),
|
|
14
|
+
Number: (r, t) => u(r, {
|
|
15
|
+
enableFormatting: t.enableFormatting,
|
|
16
|
+
thousandSeparator: t.thousandSeparator,
|
|
17
|
+
decimalSeparator: t.decimalSeparator
|
|
18
|
+
}),
|
|
19
|
+
Note: (r, t) => c(r),
|
|
20
|
+
Boolean: (r, t, e) => i(r, {
|
|
21
|
+
checkedText: t.labels?.checkedText ?? e?.switchLabels?.checkedText,
|
|
22
|
+
uncheckedText: t.labels?.uncheckedText ?? e?.switchLabels?.uncheckedText
|
|
23
|
+
}),
|
|
24
|
+
Choice: (r, t) => n(r),
|
|
25
|
+
MultiChoice: (r, t) => n(r),
|
|
26
|
+
Date: (r, t) => Array.isArray(r) ? r.map((e) => {
|
|
27
|
+
const a = new Date(e);
|
|
28
|
+
if (isNaN(a.getTime())) return "";
|
|
29
|
+
const o = t.includeTime ? `${a.getHours().toString().padStart(2, "0")}${a.getMinutes().toString().padStart(2, "0")}` : void 0;
|
|
30
|
+
return p(e, {
|
|
31
|
+
includeTime: t.includeTime,
|
|
32
|
+
timeValue: o
|
|
33
|
+
});
|
|
11
34
|
}).filter(Boolean).join(", ") : "",
|
|
12
|
-
Attachments: (r, t) =>
|
|
35
|
+
Attachments: (r, t) => m(r)
|
|
13
36
|
};
|
|
14
|
-
function
|
|
37
|
+
function g(r, t, e, a) {
|
|
15
38
|
if (t == null)
|
|
16
39
|
return "";
|
|
17
40
|
try {
|
|
18
|
-
const o =
|
|
19
|
-
return o(t,
|
|
41
|
+
const o = d[r];
|
|
42
|
+
return o(t, e, a);
|
|
20
43
|
} catch (o) {
|
|
21
|
-
return console.error(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
44
|
+
return console.error(
|
|
45
|
+
`Error al convertir valor para tipo de campo ${r}: ${o}`,
|
|
46
|
+
{
|
|
47
|
+
fieldValue: t,
|
|
48
|
+
error: o
|
|
49
|
+
}
|
|
50
|
+
), String(t);
|
|
25
51
|
}
|
|
26
52
|
}
|
|
27
|
-
const
|
|
53
|
+
const b = (r, t, e) => t == null ? "" : g(
|
|
54
|
+
r.typeAsString,
|
|
55
|
+
t,
|
|
56
|
+
r,
|
|
57
|
+
e
|
|
58
|
+
);
|
|
28
59
|
export {
|
|
29
|
-
|
|
60
|
+
b as getFormFieldDisplayText
|
|
30
61
|
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { EFWAttachmentsValue } from '../../fields/Attachments';
|
|
2
|
+
import { EFWFormFieldProps, EFWFormValues, EFWFormDatePickerFieldProps } from './EFWForm.types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Tipo derivado del array de fields que describe el shape "plano" natural
|
|
6
|
+
* para el consumer: primitivos, booleanos o arrays simples por field.
|
|
7
|
+
*
|
|
8
|
+
* Mapping por `typeAsString`:
|
|
9
|
+
* - `Text` / `Note` / `Choice` / `Date` → `string`
|
|
10
|
+
* - `Number` → `number`
|
|
11
|
+
* - `Boolean` → `boolean`
|
|
12
|
+
* - `MultiChoice` → `readonly string[]`
|
|
13
|
+
* - `Attachments` → `readonly EFWAttachmentsValue[]`
|
|
14
|
+
*
|
|
15
|
+
* Para `Choice` plano se usa la `key` del item seleccionado y para `MultiChoice`
|
|
16
|
+
* un array de `key`s, ya que `key` es el identificador estable.
|
|
17
|
+
*/
|
|
18
|
+
export type FlatValues<F extends readonly EFWFormFieldProps[] = EFWFormFieldProps[]> = {
|
|
19
|
+
[K in F[number] as K['internalName']]?: FlatValueOfField<K>;
|
|
20
|
+
};
|
|
21
|
+
export type FlatValueOfField<P extends EFWFormFieldProps> = P['typeAsString'] extends 'Text' ? string : P['typeAsString'] extends 'Number' ? number : P['typeAsString'] extends 'Note' ? string : P['typeAsString'] extends 'Boolean' ? boolean : P['typeAsString'] extends 'Choice' ? string : P['typeAsString'] extends 'MultiChoice' ? readonly string[] : P['typeAsString'] extends 'Date' ? string : P['typeAsString'] extends 'Attachments' ? readonly EFWAttachmentsValue[] : never;
|
|
22
|
+
/**
|
|
23
|
+
* Función personalizada para serializar un valor de fecha al ir de EFW → flat.
|
|
24
|
+
*/
|
|
25
|
+
export type DateSerializeFunction = (value: Date | string, field: EFWFormDatePickerFieldProps) => string;
|
|
26
|
+
export interface FlatToEFWOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Estrategia para resolver opciones en Choice/MultiChoice cuando se recibe
|
|
29
|
+
* sólo la `key`.
|
|
30
|
+
*
|
|
31
|
+
* - `'lookup'` (default): busca la key en `field.options` y arma `{ key, text, ... }`.
|
|
32
|
+
* Si la key no aparece, ver `unknownChoiceKey`.
|
|
33
|
+
* - `'passthrough'`: no busca; siempre genera `{ key, text: key }` directamente
|
|
34
|
+
* (útil cuando `field.options` es un loader async o el caller ya validó las keys).
|
|
35
|
+
*/
|
|
36
|
+
choiceLookup?: 'lookup' | 'passthrough';
|
|
37
|
+
/**
|
|
38
|
+
* Qué hacer cuando una `key` de Choice/MultiChoice no existe en `field.options`.
|
|
39
|
+
*
|
|
40
|
+
* - `'drop'` (default): omitir el item.
|
|
41
|
+
* - `'synthesize'`: generar `{ key, text: key }`.
|
|
42
|
+
* - `'error'`: lanzar `EFWConversionError`.
|
|
43
|
+
*/
|
|
44
|
+
unknownChoiceKey?: 'drop' | 'synthesize' | 'error';
|
|
45
|
+
/**
|
|
46
|
+
* Para Date: cómo interpretar el string ISO al construir el `Date[]` que
|
|
47
|
+
* espera el field.
|
|
48
|
+
*
|
|
49
|
+
* - `'as-utc'` (default): `new Date(flat)`. Strings tipo `'YYYY-MM-DD'` o
|
|
50
|
+
* ISO con `Z` se interpretan como UTC.
|
|
51
|
+
* - `'as-local'`: `new Date(flat)` interpretado por el runtime local.
|
|
52
|
+
* - `'string'`: no convierte; coloca el string crudo en el array (válido
|
|
53
|
+
* porque `EFWDatePickerValue = Date | string`).
|
|
54
|
+
*/
|
|
55
|
+
dateParse?: 'as-utc' | 'as-local' | 'string';
|
|
56
|
+
}
|
|
57
|
+
export interface EFWToFlatOptions {
|
|
58
|
+
/**
|
|
59
|
+
* Para Date: cómo serializar `Date | string` al string plano.
|
|
60
|
+
*
|
|
61
|
+
* - `'iso-date'` (default): `'YYYY-MM-DD'` UTC.
|
|
62
|
+
* - `'iso-datetime'`: ISO 8601 completo (`Date.prototype.toISOString`).
|
|
63
|
+
* - función custom `(value, field) => string`.
|
|
64
|
+
*/
|
|
65
|
+
dateSerialize?: 'iso-date' | 'iso-datetime' | DateSerializeFunction;
|
|
66
|
+
/**
|
|
67
|
+
* Para campos vacíos / null, decide si la clave se omite del output o se
|
|
68
|
+
* incluye como `undefined`. Default: `'omit'`.
|
|
69
|
+
*/
|
|
70
|
+
emptyKeys?: 'omit' | 'include';
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Códigos de error producidos por las conversiones planas de EFWForm.
|
|
74
|
+
*/
|
|
75
|
+
export type EFWConversionErrorCode = 'unknown-choice-key' | 'invalid-date' | 'invalid-number' | 'unsupported-field-type';
|
|
76
|
+
/**
|
|
77
|
+
* Error lanzado por `flatToEFWValues` / `EFWValuesToFlat` cuando una conversión
|
|
78
|
+
* falla de forma fatal o las opciones la fuerzan a fallar.
|
|
79
|
+
*/
|
|
80
|
+
export declare class EFWConversionError extends Error {
|
|
81
|
+
readonly code: EFWConversionErrorCode;
|
|
82
|
+
readonly fieldName: string;
|
|
83
|
+
readonly received: unknown;
|
|
84
|
+
constructor(params: {
|
|
85
|
+
code: EFWConversionErrorCode;
|
|
86
|
+
fieldName: string;
|
|
87
|
+
received: unknown;
|
|
88
|
+
message?: string;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Convierte un objeto plano (`{ field: primitive | array }`) al shape que
|
|
93
|
+
* espera `EFWForm` para sus `values` / `defaultValues` (ej. `Date` como
|
|
94
|
+
* `Date[]`, `Choice` como `EFWTagPickerOption[]`).
|
|
95
|
+
*
|
|
96
|
+
* - Las claves del input que no matcheen ningún `field.internalName` se
|
|
97
|
+
* ignoran silenciosamente.
|
|
98
|
+
* - Las claves declaradas en `fields` que no estén presentes en el input se
|
|
99
|
+
* omiten del output (no se completan con default).
|
|
100
|
+
* - Cuando una conversión no es posible (ej. Choice con key desconocida), el
|
|
101
|
+
* field correspondiente se devuelve como vacío salvo que las opciones
|
|
102
|
+
* indiquen lo contrario.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* const fields = [
|
|
106
|
+
* { id: '1', typeAsString: 'Text', internalName: 'name' },
|
|
107
|
+
* { id: '2', typeAsString: 'Choice', internalName: 'category', options: [{ key: 'a', text: 'A' }] },
|
|
108
|
+
* ] as const;
|
|
109
|
+
*
|
|
110
|
+
* flatToEFWValues(fields, { name: 'John', category: 'a' });
|
|
111
|
+
* // → { name: 'John', category: [{ key: 'a', text: 'A' }] }
|
|
112
|
+
*/
|
|
113
|
+
export declare function flatToEFWValues<F extends readonly EFWFormFieldProps[]>(fields: F, flat: FlatValues<F> | Partial<FlatValues<F>> | Record<string, unknown>, options?: FlatToEFWOptions): Partial<EFWFormValues<F>>;
|
|
114
|
+
/**
|
|
115
|
+
* Operación inversa de {@link flatToEFWValues}: toma valores en el shape que
|
|
116
|
+
* usa `EFWForm` y los reduce a primitivos / arrays planos según el tipo de
|
|
117
|
+
* cada field.
|
|
118
|
+
*
|
|
119
|
+
* - Las claves del input que no matcheen ningún field se ignoran.
|
|
120
|
+
* - Si un field está ausente o tiene valor vacío equivalente, la clave se
|
|
121
|
+
* omite del output (controlable con `emptyKeys: 'include'`).
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* EFWValuesToFlat(fields, {
|
|
125
|
+
* name: 'John',
|
|
126
|
+
* category: [{ key: 'a', text: 'A' }],
|
|
127
|
+
* });
|
|
128
|
+
* // → { name: 'John', category: 'a' }
|
|
129
|
+
*/
|
|
130
|
+
export declare function EFWValuesToFlat<F extends readonly EFWFormFieldProps[]>(fields: F, efwValues: Partial<EFWFormValues<F>>, options?: EFWToFlatOptions): Partial<FlatValues<F>>;
|