@envisiongroup/porygon 1.0.0-rc.9 → 1.0.1
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 +388 -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
|
@@ -1,129 +1,164 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { Button as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
)
|
|
1
|
+
import { jsx as r, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import E, { Suspense as I } from "react";
|
|
3
|
+
import { Button as P, CompoundButton as D, Menu as T, MenuTrigger as x, SplitButton as H, MenuPopover as S, MenuList as b, MenuItem as g, MenuButton as j } from "@fluentui/react-components";
|
|
4
|
+
import { useButtonsLocaleText as z } from "../../i18n/PorygonI18nProvider.js";
|
|
5
|
+
import { EFWButton as A } from "../EFWButton/EFWButton.js";
|
|
6
|
+
const _ = E.lazy(
|
|
7
|
+
() => import("../EFWDrawerButton/EFWDrawerButton.js").then((f) => ({
|
|
8
|
+
default: f.EFWDrawerButton
|
|
9
|
+
}))
|
|
10
|
+
), p = (f) => f.length, Q = ({
|
|
8
11
|
buttons: f,
|
|
9
12
|
onClickParams: c,
|
|
10
13
|
style: M,
|
|
11
|
-
gap:
|
|
12
|
-
className:
|
|
14
|
+
gap: w = "8px",
|
|
15
|
+
className: $,
|
|
16
|
+
labels: F
|
|
13
17
|
}) => {
|
|
14
|
-
const
|
|
18
|
+
const m = z().groupButton.labels.invalidButtonText, y = F?.invalidButtonText, W = {
|
|
15
19
|
display: "flex",
|
|
16
|
-
|
|
20
|
+
width: "100%",
|
|
21
|
+
gap: w,
|
|
17
22
|
...M
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
}, L = E.useMemo(
|
|
24
|
+
() => y ?? m,
|
|
25
|
+
[y, m]
|
|
26
|
+
);
|
|
27
|
+
return /* @__PURE__ */ r("div", { style: W, className: $, children: f.map((v, k) => {
|
|
28
|
+
const { kind: a, props: o } = v, u = o.id ? `${o.id}-${k}` : `button-${k}`;
|
|
29
|
+
if (a === "Button") {
|
|
30
|
+
const e = o, i = {
|
|
31
|
+
...e,
|
|
32
|
+
...e.onClick && {
|
|
25
33
|
onClick: (n) => {
|
|
26
|
-
const t =
|
|
27
|
-
|
|
34
|
+
const t = e.onClick;
|
|
35
|
+
p(t) >= 2 && c ? t(n, c) : t(n);
|
|
28
36
|
}
|
|
29
37
|
}
|
|
30
38
|
};
|
|
31
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ r(P, { ...i, children: o.children }, u);
|
|
32
40
|
}
|
|
33
|
-
if (
|
|
34
|
-
const
|
|
35
|
-
...
|
|
36
|
-
...
|
|
41
|
+
if (a === "CompoundButton") {
|
|
42
|
+
const e = o, i = {
|
|
43
|
+
...e,
|
|
44
|
+
...e.onClick && {
|
|
37
45
|
onClick: (n) => {
|
|
38
|
-
const t =
|
|
39
|
-
|
|
46
|
+
const t = e.onClick;
|
|
47
|
+
p(t) >= 2 && c ? t(n, c) : t(n);
|
|
40
48
|
}
|
|
41
49
|
}
|
|
42
50
|
};
|
|
43
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ r(
|
|
52
|
+
D,
|
|
53
|
+
{
|
|
54
|
+
...i,
|
|
55
|
+
children: o.children
|
|
56
|
+
},
|
|
57
|
+
u
|
|
58
|
+
);
|
|
44
59
|
}
|
|
45
|
-
if (
|
|
46
|
-
const
|
|
47
|
-
const { onClick: n, menuTriggers: t, ...
|
|
48
|
-
|
|
60
|
+
if (a === "SplitButton") {
|
|
61
|
+
const e = o, i = (() => {
|
|
62
|
+
const { onClick: n, menuTriggers: t, ...d } = e, h = (l) => (B) => {
|
|
63
|
+
p(l) >= 2 && c ? l(B, c) : l(B);
|
|
49
64
|
};
|
|
50
|
-
if (!n && !t) return
|
|
51
|
-
const
|
|
52
|
-
return n && (
|
|
53
|
-
onClick:
|
|
54
|
-
}), t && t.length && (
|
|
55
|
-
(
|
|
56
|
-
|
|
65
|
+
if (!n && !t) return e;
|
|
66
|
+
const s = { ...d };
|
|
67
|
+
return n && (s.primaryActionButton = {
|
|
68
|
+
onClick: h(n)
|
|
69
|
+
}), t && t.length && (s.menuTriggers = t.map(
|
|
70
|
+
(l) => l.onClick ? {
|
|
71
|
+
...l,
|
|
72
|
+
onClick: h(
|
|
73
|
+
l.onClick
|
|
74
|
+
)
|
|
75
|
+
} : l
|
|
76
|
+
)), s;
|
|
57
77
|
})();
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
|
|
78
|
+
return /* @__PURE__ */ C(T, { positioning: "below-end", children: [
|
|
79
|
+
/* @__PURE__ */ r(x, { disableButtonEnhancement: !0, children: (n) => /* @__PURE__ */ r(
|
|
80
|
+
H,
|
|
61
81
|
{
|
|
62
82
|
menuButton: n,
|
|
63
83
|
...i,
|
|
64
84
|
children: o.children
|
|
65
85
|
}
|
|
66
86
|
) }),
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
(n, t) => /* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ r(S, { children: /* @__PURE__ */ r(b, { children: (i.menuTriggers || []).map(
|
|
88
|
+
(n, t) => /* @__PURE__ */ r(
|
|
89
|
+
g,
|
|
90
|
+
{
|
|
91
|
+
...n,
|
|
92
|
+
children: n.children
|
|
93
|
+
},
|
|
94
|
+
`${u}-menu-item-${t}`
|
|
95
|
+
)
|
|
69
96
|
) }) })
|
|
70
97
|
] }, u);
|
|
71
98
|
}
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
const { menuTriggers: n, ...t } =
|
|
75
|
-
|
|
99
|
+
if (a === "MenuButton") {
|
|
100
|
+
const e = o, i = (() => {
|
|
101
|
+
const { menuTriggers: n, ...t } = e, d = (s) => (l) => {
|
|
102
|
+
p(s) >= 2 && c ? s(l, c) : s(l);
|
|
76
103
|
};
|
|
77
|
-
if (!n) return
|
|
78
|
-
const
|
|
79
|
-
return n && (
|
|
80
|
-
(
|
|
81
|
-
|
|
104
|
+
if (!n) return e;
|
|
105
|
+
const h = { ...t };
|
|
106
|
+
return n && (h.menuTriggers = n.map(
|
|
107
|
+
(s) => s.onClick ? {
|
|
108
|
+
...s,
|
|
109
|
+
onClick: d(
|
|
110
|
+
s.onClick
|
|
111
|
+
)
|
|
112
|
+
} : s
|
|
113
|
+
)), h;
|
|
82
114
|
})();
|
|
83
|
-
return /* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
115
|
+
return /* @__PURE__ */ C(T, { positioning: "below-end", children: [
|
|
116
|
+
/* @__PURE__ */ r(x, { disableButtonEnhancement: !0, children: /* @__PURE__ */ r(j, { ...i, children: o.children }) }),
|
|
117
|
+
/* @__PURE__ */ r(S, { children: /* @__PURE__ */ r(b, { children: (i.menuTriggers || []).map(
|
|
118
|
+
(n, t) => /* @__PURE__ */ r(
|
|
119
|
+
g,
|
|
120
|
+
{
|
|
121
|
+
...n,
|
|
122
|
+
children: n.children
|
|
123
|
+
},
|
|
124
|
+
`${u}-menu-item-${t}`
|
|
125
|
+
)
|
|
126
|
+
) }) })
|
|
92
127
|
] }, u);
|
|
93
128
|
}
|
|
94
|
-
if (
|
|
95
|
-
const
|
|
96
|
-
...
|
|
97
|
-
...
|
|
129
|
+
if (a == "EFWButton") {
|
|
130
|
+
const e = o, i = {
|
|
131
|
+
...e,
|
|
132
|
+
...e.onClick && {
|
|
98
133
|
onClick: (n) => {
|
|
99
|
-
const t =
|
|
100
|
-
return
|
|
134
|
+
const t = e.onClick;
|
|
135
|
+
return p(t) >= 2 && c ? t(n, c) : t(n);
|
|
101
136
|
}
|
|
102
137
|
}
|
|
103
138
|
};
|
|
104
|
-
return /* @__PURE__ */
|
|
139
|
+
return /* @__PURE__ */ r(A, { ...i, children: o.children }, u);
|
|
105
140
|
}
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
...
|
|
109
|
-
...
|
|
141
|
+
if (a == "EFWDrawerButton") {
|
|
142
|
+
const e = o, i = {
|
|
143
|
+
...e,
|
|
144
|
+
...e.onClick && {
|
|
110
145
|
onClick: (n, t) => {
|
|
111
|
-
const
|
|
112
|
-
return
|
|
113
|
-
n,
|
|
114
|
-
t,
|
|
115
|
-
c
|
|
116
|
-
) : l(
|
|
117
|
-
n,
|
|
118
|
-
t
|
|
119
|
-
);
|
|
146
|
+
const d = e.onClick;
|
|
147
|
+
return p(d) >= 3 && c !== void 0 ? d(n, t, c) : d(n, t);
|
|
120
148
|
}
|
|
121
149
|
}
|
|
122
150
|
};
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
-
|
|
151
|
+
return /* @__PURE__ */ r(I, { fallback: null, children: /* @__PURE__ */ r(
|
|
152
|
+
_,
|
|
153
|
+
{
|
|
154
|
+
...i,
|
|
155
|
+
children: o.children
|
|
156
|
+
}
|
|
157
|
+
) }, u);
|
|
158
|
+
}
|
|
159
|
+
return /* @__PURE__ */ r("div", { children: L }, u);
|
|
125
160
|
}) });
|
|
126
161
|
};
|
|
127
162
|
export {
|
|
128
|
-
|
|
163
|
+
Q as EFWGroupButton
|
|
129
164
|
};
|
|
@@ -3,6 +3,9 @@ import { EFWButtonProps, EFWButtonActionResult } from '../EFWButton';
|
|
|
3
3
|
import { EFWDrawerButtonProps } from '../EFWDrawerButton/EFWDrawerButton.types';
|
|
4
4
|
import { DrawerOpenHandler } from '../../hooks/useDrawer';
|
|
5
5
|
|
|
6
|
+
export interface EFWGroupButtonLabels {
|
|
7
|
+
invalidButtonText?: string;
|
|
8
|
+
}
|
|
6
9
|
/**
|
|
7
10
|
* Tipo genérico para manejadores de eventos click flexibles en botones estándar de Fluent UI.
|
|
8
11
|
* |
|
|
@@ -78,7 +81,6 @@ export type EFWDrawerButtonClickHandler<T = undefined> = T extends undefined ? (
|
|
|
78
81
|
* };
|
|
79
82
|
* ```
|
|
80
83
|
*/
|
|
81
|
-
export type EFWDrawerHandler<T = undefined> = (() => void) | ((params: T) => void);
|
|
82
84
|
/**
|
|
83
85
|
* Configuración para un botón individual dentro de EFWGroupButton.
|
|
84
86
|
*
|
|
@@ -229,4 +231,8 @@ export interface EFWGroupButtonProps<T = undefined> {
|
|
|
229
231
|
* Clase CSS opcional para el contenedor
|
|
230
232
|
*/
|
|
231
233
|
className?: string;
|
|
234
|
+
/**
|
|
235
|
+
* Textos de UI internos del componente para localización.
|
|
236
|
+
*/
|
|
237
|
+
labels?: EFWGroupButtonLabels;
|
|
232
238
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { EFWGroupButton } from './EFWGroupButton';
|
|
2
|
-
export type { EFWGroupButtonProps, NormalClickHandler, EFWClickHandler, EFWGroupButtonConfig } from './EFWGroupButton.types';
|
|
2
|
+
export type { EFWGroupButtonProps, EFWGroupButtonLabels, NormalClickHandler, EFWClickHandler, EFWGroupButtonConfig } from './EFWGroupButton.types';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilidades compartidas para preservar la posición del caret cuando un input
|
|
3
|
+
* controlado reformatea su valor en `onChange` (máscaras, separadores de miles,
|
|
4
|
+
* etc.). Al reescribir el `value`, React/el navegador mueven el caret al final;
|
|
5
|
+
* estas funciones calculan dónde debería quedar para no interrumpir la edición.
|
|
6
|
+
*
|
|
7
|
+
* El core es agnóstico al formato: cada componente aporta su propio predicado
|
|
8
|
+
* `isPayloadChar` que distingue los datos reales (lo que la persona escribe) de
|
|
9
|
+
* la decoración que el formato inserta.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Determina si un carácter forma parte del "payload" (dato real escrito por la
|
|
13
|
+
* persona) en lugar de ser decoración estática insertada por el formato.
|
|
14
|
+
*/
|
|
15
|
+
export type PayloadCharTester = (char: string) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Calcula la posición de caret en `nextFormatted` tras una edición, preservando
|
|
18
|
+
* la posición lógica respecto al payload que la persona está editando.
|
|
19
|
+
*
|
|
20
|
+
* Estrategia (estilo cleave.js, robusta ante decoración insertada o removida):
|
|
21
|
+
* - Si el caret quedó al final del texto tecleado, se mantiene al final del
|
|
22
|
+
* texto formateado (cubre tipear al final y formatos que sintetizan prefijo).
|
|
23
|
+
* - En otro caso se cuenta cuántos caracteres de payload hay a la izquierda del
|
|
24
|
+
* caret y se reubica justo después de esa misma cantidad de payload en el
|
|
25
|
+
* texto formateado resultante.
|
|
26
|
+
*
|
|
27
|
+
* Es una función pura: no toca el DOM. El llamador decide cuándo aplicarla
|
|
28
|
+
* (típicamente en un layout effect, solo si el input sigue enfocado).
|
|
29
|
+
*/
|
|
30
|
+
export declare const computeCaretAfterReformat: ({ previousCaret, typedValue, nextFormatted, isPayloadChar, }: {
|
|
31
|
+
previousCaret: number;
|
|
32
|
+
typedValue: string;
|
|
33
|
+
nextFormatted: string;
|
|
34
|
+
isPayloadChar: PayloadCharTester;
|
|
35
|
+
}) => number;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const c = ({
|
|
2
|
+
previousCaret: i,
|
|
3
|
+
typedValue: f,
|
|
4
|
+
nextFormatted: n,
|
|
5
|
+
isPayloadChar: e
|
|
6
|
+
}) => {
|
|
7
|
+
const t = (l) => Math.max(0, Math.min(l, n.length));
|
|
8
|
+
if (i >= f.length)
|
|
9
|
+
return n.length;
|
|
10
|
+
let h = 0;
|
|
11
|
+
const r = Math.min(i, f.length);
|
|
12
|
+
for (let l = 0; l < r; l++)
|
|
13
|
+
e(f[l]) && h++;
|
|
14
|
+
if (h === 0) {
|
|
15
|
+
let l = 0;
|
|
16
|
+
for (; l < n.length && !e(n[l]); )
|
|
17
|
+
l++;
|
|
18
|
+
return t(l);
|
|
19
|
+
}
|
|
20
|
+
let g = 0;
|
|
21
|
+
for (let l = 0; l < n.length; l++)
|
|
22
|
+
if (e(n[l]) && (g++, g === h))
|
|
23
|
+
return t(l + 1);
|
|
24
|
+
return n.length;
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
c as computeCaretAfterReformat
|
|
28
|
+
};
|
|
@@ -52,4 +52,4 @@ export declare const getFileIconUrl: (doctype: string, size?: number) => string;
|
|
|
52
52
|
* getErrorMessage(undefined); // "Error desconocido"
|
|
53
53
|
* getErrorMessage(42); // "42"
|
|
54
54
|
*/
|
|
55
|
-
export declare const getErrorMessage: (error: any) =>
|
|
55
|
+
export declare const getErrorMessage: (error: any) => string;
|
|
@@ -9,7 +9,7 @@ const r = (t, e = 256) => {
|
|
|
9
9
|
return t = t.toLowerCase(), t == "folder" ? s + e + "/folder.svg" : t == "url" ? s + e + "/link.png" : t == "listitem" ? s + e + "/spo.png" : t == "txt" ? s + e + "/txt.png" : /doc|docm|docx|dot|dotm|dotx|odt/i.test(t) ? s + e + "/docx.png" : /odp|pot|potm|potx|ppa|ppam|pps|ppsm|ppsx|ppt|pptm|pptx/i.test(t) ? s + e + "/pptx.png" : /ods|csv|xla|xlam|xll|xls|xlsb|xlsm|xlsx|xlt|xltm|xltx/i.test(t) ? s + e + "/xlsx.png" : /jpg|jpeg|tiff|tif|png|gif|cr2/i.test(t) ? s + e + "/photo.png" : /wmv|ismv|m2v|mpeg|mpg|xesc|vob|ts|mod|avi|mts|m2ts|asf|3gp|3g2|3gp2|mp4|mov/i.test(t) ? s + e + "/video.png" : /pdf/i.test(t) ? s + e + "/pdf.png" : /psd/i.test(t) ? s + e + "/photo.png" : /ai/i.test(t) ? s + e + "/vector.png" : /msg|eml/i.test(t) ? s + e + "/email.png" : /zip/i.test(t) ? s + e + "/zip.png" : /aspx/i.test(t) ? s + e + "/spo.png" : s + e + "/genericfile.png";
|
|
10
10
|
}, f = (t) => {
|
|
11
11
|
let e;
|
|
12
|
-
return t instanceof Error ? e = t.message : typeof t == "string" ? e = t : t && typeof t == "object" && "message" in t ? e = t.message : e = String(t) || "Error desconocido", e;
|
|
12
|
+
return t instanceof Error ? e = t.message : typeof t == "string" ? e = t : t && typeof t == "object" && "message" in t ? e = String(t.message) : e = String(t) || "Error desconocido", e;
|
|
13
13
|
};
|
|
14
14
|
export {
|
|
15
15
|
p as formatFileSize,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determina si un valor debe considerarse vacío para validaciones semánticas.
|
|
3
|
+
* Los strings compuestos solo por whitespace se consideran vacíos.
|
|
4
|
+
*/
|
|
5
|
+
export declare const isSemanticallyEmptyValue: (value: unknown) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Normaliza listas opcionales a arrays para evitar null checks repetidos.
|
|
8
|
+
*/
|
|
9
|
+
export declare const normalizeArrayValue: <T>(value: T[] | null | undefined) => T[];
|
|
10
|
+
/**
|
|
11
|
+
* Determina si el valor de un campo debe considerarse vacío a efectos de
|
|
12
|
+
* validación de obligatoriedad (required).
|
|
13
|
+
*
|
|
14
|
+
* Mantiene un único criterio de "vacío" coherente para todo el formulario:
|
|
15
|
+
* - Para `Text` y `Note` se usa `isSemanticallyEmptyValue`, de modo que los
|
|
16
|
+
* strings compuestos solo por whitespace también cuentan como vacíos.
|
|
17
|
+
* - Para el resto de tipos se considera vacío `undefined`, `null`, `""` o un
|
|
18
|
+
* array sin elementos.
|
|
19
|
+
*
|
|
20
|
+
* Es la fuente única de verdad que usan tanto `EFWForm.validateForm` como la
|
|
21
|
+
* limpieza del error de obligatoriedad al escribir (`handleValueChange`),
|
|
22
|
+
* evitando duplicar la lógica de vacío entre ambos.
|
|
23
|
+
*
|
|
24
|
+
* @param value - Valor actual del campo.
|
|
25
|
+
* @param typeAsString - Tipo del campo (`EFWFormFieldType`).
|
|
26
|
+
* @returns `true` si el valor se considera vacío para validar obligatoriedad.
|
|
27
|
+
*/
|
|
28
|
+
export declare const isFieldEmptyForValidation: (value: unknown, typeAsString: string) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const i = (r) => r == null ? !0 : typeof r == "string" ? r.trim() === "" : Array.isArray(r) ? r.length === 0 : !1, n = (r) => Array.isArray(r) ? r : [], o = (r, t) => t === "Text" || t === "Note" ? i(r) : r == null || r === "" || Array.isArray(r) && r.length === 0;
|
|
2
|
+
export {
|
|
3
|
+
o as isFieldEmptyForValidation,
|
|
4
|
+
i as isSemanticallyEmptyValue,
|
|
5
|
+
n as normalizeArrayValue
|
|
6
|
+
};
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { jsx as l, jsxs as V } from "react/jsx-runtime";
|
|
2
|
+
import { makeStyles as _, mergeClasses as ee, Text as te, CardFooter as ae, Button as ne } from "@fluentui/react-components";
|
|
3
|
+
import { useMemo as $, useId as oe, useRef as le, useState as se, useEffect as j, useCallback as f } from "react";
|
|
4
|
+
import { EFWAttachmentsContainer as q } from "./EFWAttachmentsCard.js";
|
|
5
|
+
import { Attach20Regular as ce } from "@fluentui/react-icons";
|
|
6
|
+
import { formatFileSize as me } from "../../commons/utils.js";
|
|
7
|
+
import { v4 as re } from "uuid";
|
|
8
|
+
import { getAttachmentsFormattedValue as v } from "./EFWAttachments.utils.js";
|
|
9
|
+
import { normalizeArrayValue as O } from "../../commons/valueNormalization.js";
|
|
10
|
+
import { useFieldsLocaleText as ie } from "../../i18n/PorygonI18nProvider.js";
|
|
11
|
+
const de = _({
|
|
12
|
+
efwAttachmentError: {
|
|
13
|
+
//...
|
|
14
|
+
},
|
|
15
|
+
efwAttachmentInput: {
|
|
16
|
+
display: "none"
|
|
17
|
+
},
|
|
18
|
+
efwAttachmentsButton: {
|
|
19
|
+
margin: "0px 0px 5px"
|
|
20
|
+
},
|
|
21
|
+
efwAttachmentsContainer: {
|
|
22
|
+
display: "flex"
|
|
23
|
+
}
|
|
24
|
+
}), Ae = (P) => {
|
|
25
|
+
const {
|
|
26
|
+
editable: U = !0,
|
|
27
|
+
disabled: c = !1,
|
|
28
|
+
files: L,
|
|
29
|
+
defaultFiles: h,
|
|
30
|
+
className: G = "",
|
|
31
|
+
validationState: H = "none",
|
|
32
|
+
setParentComponentState: p,
|
|
33
|
+
multiple: M = !0,
|
|
34
|
+
acceptedTypes: J = "*/*",
|
|
35
|
+
maxFileSize: m = 100 * 1024 * 1024,
|
|
36
|
+
// 100MB por defecto
|
|
37
|
+
labels: r,
|
|
38
|
+
onChange: i,
|
|
39
|
+
onRemoveAttachment: b,
|
|
40
|
+
readOnlyRenderer: K
|
|
41
|
+
} = P, d = ie().attachments.labels, A = d.attachButtonLabel, F = d.emptyMessage, w = d.downloadMenuItemLabel, E = d.removeMenuItemLabel, z = d.maxFileSizeExceededMessage, I = r?.attachButtonLabel, S = r?.emptyMessage, R = r?.downloadMenuItemLabel, C = r?.removeMenuItemLabel, B = r?.maxFileSizeExceededMessage, o = $(() => ({
|
|
42
|
+
attachButtonLabel: I ?? A,
|
|
43
|
+
emptyMessage: S ?? F,
|
|
44
|
+
downloadMenuItemLabel: R ?? w,
|
|
45
|
+
removeMenuItemLabel: C ?? E,
|
|
46
|
+
maxFileSizeExceededMessage: B ?? z
|
|
47
|
+
}), [
|
|
48
|
+
I,
|
|
49
|
+
S,
|
|
50
|
+
R,
|
|
51
|
+
C,
|
|
52
|
+
B,
|
|
53
|
+
A,
|
|
54
|
+
F,
|
|
55
|
+
w,
|
|
56
|
+
E,
|
|
57
|
+
z
|
|
58
|
+
]), Q = oe(), g = de(), u = le(null), s = L !== void 0, N = $(
|
|
59
|
+
() => h ?? [],
|
|
60
|
+
[h]
|
|
61
|
+
), [X, x] = se(() => h ?? []), n = s ? L ?? [] : X;
|
|
62
|
+
j(() => {
|
|
63
|
+
s || x(N);
|
|
64
|
+
}, [s, N]);
|
|
65
|
+
const W = f(
|
|
66
|
+
(a) => {
|
|
67
|
+
for (const e of a)
|
|
68
|
+
if (e.size !== void 0 && e.size > m)
|
|
69
|
+
return !1;
|
|
70
|
+
return !0;
|
|
71
|
+
},
|
|
72
|
+
[m]
|
|
73
|
+
), k = f(() => {
|
|
74
|
+
const a = me(m), e = o.maxFileSizeExceededMessage;
|
|
75
|
+
return typeof e == "function" ? e(m, a) : typeof e == "string" && e.trim().length > 0 ? e : `Existe un adjunto que excede el peso máximo de ${a}.`;
|
|
76
|
+
}, [m, o.maxFileSizeExceededMessage]);
|
|
77
|
+
j(() => {
|
|
78
|
+
n.length > 0 && !W(n) ? p?.("error", k()) : p?.("none");
|
|
79
|
+
}, [
|
|
80
|
+
n,
|
|
81
|
+
W,
|
|
82
|
+
p,
|
|
83
|
+
k
|
|
84
|
+
]);
|
|
85
|
+
const Y = f(() => {
|
|
86
|
+
u.current && !c && u.current.click();
|
|
87
|
+
}, [c]), T = f(
|
|
88
|
+
async (a) => {
|
|
89
|
+
const e = n.find((t) => t.id === a);
|
|
90
|
+
if (!e) {
|
|
91
|
+
console.warn(
|
|
92
|
+
`[EFWAttachment]: Attachment with id ${a} not found`
|
|
93
|
+
);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
if (b && !await b(e)) {
|
|
98
|
+
console.log(
|
|
99
|
+
`[EFWAttachment]: Removal of file ${a} was cancelled`
|
|
100
|
+
);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const t = n.filter(
|
|
104
|
+
(D) => D.id !== a
|
|
105
|
+
);
|
|
106
|
+
s || x(t), i && i(
|
|
107
|
+
t,
|
|
108
|
+
v(
|
|
109
|
+
O(t)
|
|
110
|
+
)
|
|
111
|
+
), console.log(
|
|
112
|
+
`[EFWAttachment]: File ${a} removed successfully`
|
|
113
|
+
);
|
|
114
|
+
} catch (t) {
|
|
115
|
+
console.error("[EFWAttachment]: Detele file error:", t);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
[n, b, i, s]
|
|
119
|
+
), Z = f(
|
|
120
|
+
(a) => {
|
|
121
|
+
const e = Array.from(
|
|
122
|
+
a.target.files || []
|
|
123
|
+
).map((t) => ({
|
|
124
|
+
id: re(),
|
|
125
|
+
name: t.name,
|
|
126
|
+
size: t.size,
|
|
127
|
+
type: t.type,
|
|
128
|
+
lastModified: t.lastModified,
|
|
129
|
+
file: t
|
|
130
|
+
}));
|
|
131
|
+
if (e.length > 0) {
|
|
132
|
+
const t = M ? [...n, ...e] : e;
|
|
133
|
+
s || x(t), i?.(
|
|
134
|
+
t,
|
|
135
|
+
v(O(t))
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
u.current && (u.current.value = "");
|
|
139
|
+
},
|
|
140
|
+
[n, M, i, s]
|
|
141
|
+
), y = ee(
|
|
142
|
+
G,
|
|
143
|
+
H === "error" && g.efwAttachmentError
|
|
144
|
+
);
|
|
145
|
+
if (!U) {
|
|
146
|
+
const a = v(n) || o.emptyMessage, e = K?.(
|
|
147
|
+
n,
|
|
148
|
+
a
|
|
149
|
+
);
|
|
150
|
+
return e != null ? /* @__PURE__ */ l("div", { className: y, children: e }) : /* @__PURE__ */ l("div", { className: y, children: n.length === 0 ? /* @__PURE__ */ l(te, { style: { opacity: 0.7 }, children: o.emptyMessage }) : /* @__PURE__ */ l(
|
|
151
|
+
q,
|
|
152
|
+
{
|
|
153
|
+
enableRemoveButtons: !1,
|
|
154
|
+
onRemoveAttachment: T,
|
|
155
|
+
attachments: n,
|
|
156
|
+
emptyMessage: o.emptyMessage,
|
|
157
|
+
downloadMenuItemLabel: o.downloadMenuItemLabel,
|
|
158
|
+
removeMenuItemLabel: o.removeMenuItemLabel
|
|
159
|
+
}
|
|
160
|
+
) });
|
|
161
|
+
}
|
|
162
|
+
return /* @__PURE__ */ V("div", { className: y, children: [
|
|
163
|
+
/* @__PURE__ */ V(ae, { style: { display: "disabled" }, children: [
|
|
164
|
+
/* @__PURE__ */ l(
|
|
165
|
+
"input",
|
|
166
|
+
{
|
|
167
|
+
ref: u,
|
|
168
|
+
id: Q,
|
|
169
|
+
type: "file",
|
|
170
|
+
"aria-label": o.attachButtonLabel,
|
|
171
|
+
className: g.efwAttachmentInput,
|
|
172
|
+
accept: J,
|
|
173
|
+
multiple: M,
|
|
174
|
+
onChange: Z,
|
|
175
|
+
disabled: c
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
/* @__PURE__ */ l(
|
|
179
|
+
ne,
|
|
180
|
+
{
|
|
181
|
+
size: "medium",
|
|
182
|
+
onClick: Y,
|
|
183
|
+
icon: /* @__PURE__ */ l(ce, {}),
|
|
184
|
+
disabled: c,
|
|
185
|
+
className: g.efwAttachmentsButton,
|
|
186
|
+
children: o.attachButtonLabel
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] }),
|
|
190
|
+
/* @__PURE__ */ l(
|
|
191
|
+
q,
|
|
192
|
+
{
|
|
193
|
+
enableRemoveButtons: !c,
|
|
194
|
+
onRemoveAttachment: T,
|
|
195
|
+
attachments: n,
|
|
196
|
+
emptyMessage: o.emptyMessage,
|
|
197
|
+
downloadMenuItemLabel: o.downloadMenuItemLabel,
|
|
198
|
+
removeMenuItemLabel: o.removeMenuItemLabel
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
] });
|
|
202
|
+
};
|
|
203
|
+
export {
|
|
204
|
+
Ae as EFWAttachment
|
|
205
|
+
};
|
package/dist/react-components/fields/{EFWAttachments → Attachments}/EFWAttachments.types.d.ts
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { EFWFieldChildrenProps } from '../EFWField/EFWField.types';
|
|
1
|
+
import { EFWFieldChildrenProps } from '../_shared/EFWField/EFWField.types';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Valor que representa un archivo adjunto en el componente EFWAttachments.
|
|
@@ -25,9 +26,28 @@ export type EFWAttachmentsValue = {
|
|
|
25
26
|
/**
|
|
26
27
|
* Función callback ejecutada cuando cambia la lista de archivos adjuntos.
|
|
27
28
|
* @param values - Array de archivos adjuntos actualizados
|
|
28
|
-
* @param displayValue -
|
|
29
|
+
* @param displayValue - Texto formateado de la lista de adjuntos
|
|
29
30
|
*/
|
|
30
31
|
export type EFWAttachmentsOnChange = (values: EFWAttachmentsValue[], displayValue?: string) => void;
|
|
32
|
+
export type EFWAttachmentsNonEditableRenderer = (value: EFWAttachmentsValue[], displayValue: string) => ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Textos de la UI del componente EFWAttachments.
|
|
35
|
+
*/
|
|
36
|
+
export interface EFWAttachmentsLabels {
|
|
37
|
+
/** Texto del botón para adjuntar archivos. */
|
|
38
|
+
attachButtonLabel?: string;
|
|
39
|
+
/** Mensaje mostrado cuando no hay archivos adjuntos. */
|
|
40
|
+
emptyMessage?: string;
|
|
41
|
+
/** Texto del item de menú para descargar un archivo. */
|
|
42
|
+
downloadMenuItemLabel?: string;
|
|
43
|
+
/** Texto del item de menú para quitar un archivo adjunto. */
|
|
44
|
+
removeMenuItemLabel?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Mensaje de error cuando un archivo excede el tamaño máximo permitido.
|
|
47
|
+
* Si se define como función, recibe el tamaño máximo en bytes y formateado.
|
|
48
|
+
*/
|
|
49
|
+
maxFileSizeExceededMessage?: string | ((maxFileSize: number, maxFileSizeFormatted: string) => string);
|
|
50
|
+
}
|
|
31
51
|
/**
|
|
32
52
|
* Propiedades del componente EFWAttachments para gestionar archivos adjuntos.
|
|
33
53
|
*/
|
|
@@ -68,6 +88,11 @@ export interface EFWAttachmentsProps extends EFWFieldChildrenProps {
|
|
|
68
88
|
* @default 104857600 (100MB)
|
|
69
89
|
*/
|
|
70
90
|
maxFileSize?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Textos personalizables de la UI del componente.
|
|
93
|
+
* Permite sobreescribir los textos por defecto para internacionalización.
|
|
94
|
+
*/
|
|
95
|
+
labels?: EFWAttachmentsLabels;
|
|
71
96
|
/**
|
|
72
97
|
* Callback ejecutado al intentar eliminar un adjunto.
|
|
73
98
|
* Debe retornar una promesa que resuelve a true para confirmar la eliminación.
|
|
@@ -81,4 +106,9 @@ export interface EFWAttachmentsProps extends EFWFieldChildrenProps {
|
|
|
81
106
|
* @param displayValue - Valor de visualización opcional
|
|
82
107
|
*/
|
|
83
108
|
onChange?: EFWAttachmentsOnChange;
|
|
109
|
+
/**
|
|
110
|
+
* Renderiza contenido custom cuando `editable={false}`.
|
|
111
|
+
* Si retorna `null` o `undefined`, se utiliza el render no editable por defecto.
|
|
112
|
+
*/
|
|
113
|
+
readOnlyRenderer?: EFWAttachmentsNonEditableRenderer;
|
|
84
114
|
}
|