@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
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
/**
|
|
5
5
|
* Genera una clave de caché completa para una celda
|
|
6
6
|
*/
|
|
7
|
-
export declare function createCacheKey<T extends EFWFormFieldType>(field: EFWFormFieldProps<T>, value: EFWFormFieldValue<T>, item: EFWTableItem, rowIndex: number, columnRenderers?: ColumnRenderers): string;
|
|
7
|
+
export declare function createCacheKey<T extends EFWFormFieldType>(field: EFWFormFieldProps<T>, value: EFWFormFieldValue<T>, item: EFWTableItem, rowIndex: number, columnRenderers?: ColumnRenderers, variantKey?: string): string;
|
|
8
8
|
/**
|
|
9
9
|
* Obtiene un valor del caché si existe y no ha expirado
|
|
10
10
|
* Versión optimizada con lazy cleanup
|
|
@@ -28,10 +28,3 @@ export declare const getRenderCacheStats: () => {
|
|
|
28
28
|
avgHitsPerEntry: number;
|
|
29
29
|
oldestEntry: number;
|
|
30
30
|
};
|
|
31
|
-
/**
|
|
32
|
-
* Pre-warm caché con valores comunes (opcional)
|
|
33
|
-
*/
|
|
34
|
-
export declare function prewarmCache(commonValues: Array<{
|
|
35
|
-
key: string;
|
|
36
|
-
result: React.ReactNode;
|
|
37
|
-
}>): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CACHE_CONFIG as f } from "./constants.js";
|
|
2
|
-
import { getRenderContextVersion as
|
|
3
|
-
import { hashString as
|
|
2
|
+
import { getRenderContextVersion as g } from "./context.js";
|
|
3
|
+
import { hashString as d, extractDateIdentifiers as y, extractAttachmentIdentifiers as w, extractOptionIdentifiers as S } from "./hashing.js";
|
|
4
4
|
function C(t, e) {
|
|
5
5
|
if (t == null)
|
|
6
6
|
return "null";
|
|
@@ -20,87 +20,88 @@ function C(t, e) {
|
|
|
20
20
|
n = S(t);
|
|
21
21
|
break;
|
|
22
22
|
case "Attachments":
|
|
23
|
-
n =
|
|
23
|
+
n = w(t);
|
|
24
24
|
break;
|
|
25
25
|
case "Date":
|
|
26
26
|
n = y(t);
|
|
27
27
|
break;
|
|
28
28
|
default:
|
|
29
|
-
n = t.map((
|
|
29
|
+
n = t.map((o, l) => `${l}-${String(o)}`);
|
|
30
30
|
}
|
|
31
31
|
n.sort();
|
|
32
|
-
const c = n.slice(0, 5).join(","),
|
|
33
|
-
return `array-${r}-${c}-${
|
|
32
|
+
const c = n.slice(0, 5).join(","), s = d(n.join("|"));
|
|
33
|
+
return `array-${r}-${c}-${s}`;
|
|
34
34
|
}
|
|
35
35
|
try {
|
|
36
|
-
return `object-${
|
|
36
|
+
return `object-${d(JSON.stringify(t))}`;
|
|
37
37
|
} catch {
|
|
38
38
|
return "complex-object";
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
function I(t, e, r, n, c) {
|
|
41
|
+
function I(t, e, r, n, c, s = "default") {
|
|
42
42
|
return [
|
|
43
43
|
t.internalName || t.id,
|
|
44
44
|
t.typeAsString,
|
|
45
45
|
C(e, t.typeAsString),
|
|
46
46
|
r._rowId || `row-${n}`,
|
|
47
|
-
c ?
|
|
48
|
-
|
|
47
|
+
c ? d(JSON.stringify(Object.keys(c))) : "no-renderers",
|
|
48
|
+
g().toString(),
|
|
49
|
+
s
|
|
49
50
|
].join("|");
|
|
50
51
|
}
|
|
51
|
-
const
|
|
52
|
+
const i = /* @__PURE__ */ new Map();
|
|
52
53
|
let a = !1, m = null;
|
|
53
|
-
function
|
|
54
|
+
function u() {
|
|
54
55
|
a || (a = !0, "requestIdleCallback" in window ? window.requestIdleCallback(() => {
|
|
55
|
-
|
|
56
|
+
p(), a = !1;
|
|
56
57
|
}, { timeout: 1e3 }) : setTimeout(() => {
|
|
57
|
-
|
|
58
|
+
p(), a = !1;
|
|
58
59
|
}, 0));
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
+
function p() {
|
|
61
62
|
const t = Date.now(), e = [];
|
|
62
|
-
for (const [r, n] of
|
|
63
|
+
for (const [r, n] of i.entries())
|
|
63
64
|
t - n.timestamp >= f.TTL_MS && e.push(r);
|
|
64
65
|
for (const r of e)
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
i.delete(r);
|
|
67
|
+
i.size > f.MAX_SIZE && b();
|
|
67
68
|
}
|
|
68
69
|
function b() {
|
|
69
70
|
const t = Math.floor(f.MAX_SIZE * 0.8);
|
|
70
|
-
if (
|
|
71
|
-
const e = Array.from(
|
|
72
|
-
const l = r -
|
|
73
|
-
return { key:
|
|
71
|
+
if (i.size <= t) return;
|
|
72
|
+
const e = Array.from(i.entries()), r = Date.now(), n = e.map(([s, o]) => {
|
|
73
|
+
const l = r - o.timestamp, h = o.hits / Math.max(1, l / 1e3);
|
|
74
|
+
return { key: s, score: h, entry: o };
|
|
74
75
|
});
|
|
75
|
-
n.sort((
|
|
76
|
-
const c = n.slice(0,
|
|
77
|
-
for (const { key:
|
|
78
|
-
|
|
76
|
+
n.sort((s, o) => s.score - o.score);
|
|
77
|
+
const c = n.slice(0, i.size - t);
|
|
78
|
+
for (const { key: s } of c)
|
|
79
|
+
i.delete(s);
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
-
const e =
|
|
81
|
+
function M(t) {
|
|
82
|
+
const e = i.get(t);
|
|
82
83
|
if (!e) return;
|
|
83
84
|
if (Date.now() - e.timestamp >= f.TTL_MS) {
|
|
84
|
-
m || (m = /* @__PURE__ */ new Set()), m.add(t),
|
|
85
|
+
m || (m = /* @__PURE__ */ new Set()), m.add(t), u();
|
|
85
86
|
return;
|
|
86
87
|
}
|
|
87
88
|
return e.hits++, e.result;
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
90
|
+
function T(t, e) {
|
|
91
|
+
i.set(t, {
|
|
91
92
|
result: e,
|
|
92
93
|
hits: 1,
|
|
93
94
|
timestamp: Date.now()
|
|
94
|
-
}),
|
|
95
|
+
}), i.size > f.MAX_SIZE * 1.1 && u();
|
|
95
96
|
}
|
|
96
|
-
const
|
|
97
|
-
|
|
97
|
+
const k = () => {
|
|
98
|
+
i.clear(), m = null, a = !1;
|
|
98
99
|
}, E = () => {
|
|
99
100
|
let t = 0, e = Date.now();
|
|
100
|
-
|
|
101
|
+
i.forEach((n) => {
|
|
101
102
|
t += n.hits, n.timestamp < e && (e = n.timestamp);
|
|
102
103
|
});
|
|
103
|
-
const r =
|
|
104
|
+
const r = i.size;
|
|
104
105
|
return {
|
|
105
106
|
size: r,
|
|
106
107
|
totalHits: t,
|
|
@@ -108,20 +109,10 @@ const T = () => {
|
|
|
108
109
|
oldestEntry: Date.now() - e
|
|
109
110
|
};
|
|
110
111
|
};
|
|
111
|
-
function $(t) {
|
|
112
|
-
const e = Date.now();
|
|
113
|
-
for (const { key: r, result: n } of t)
|
|
114
|
-
s.has(r) || s.set(r, {
|
|
115
|
-
result: n,
|
|
116
|
-
hits: 0,
|
|
117
|
-
timestamp: e
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
112
|
export {
|
|
121
|
-
|
|
113
|
+
k as clearRenderCache,
|
|
122
114
|
I as createCacheKey,
|
|
123
|
-
|
|
115
|
+
M as getCachedResult,
|
|
124
116
|
E as getRenderCacheStats,
|
|
125
|
-
|
|
126
|
-
M as setCachedResult
|
|
117
|
+
T as setCachedResult
|
|
127
118
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FilterFn } from '@tanstack/react-table';
|
|
2
|
+
import { EFWFormFieldProps } from '../../../forms/EFWForm';
|
|
3
|
+
import { EFWTableItem } from '../EFWTable.types';
|
|
4
|
+
|
|
5
|
+
export declare const EMPTY_CHOICE_FILTER_KEY = "__empty__";
|
|
6
|
+
/**
|
|
7
|
+
* Verifica si un valor de filtro está vacío (sin filtro aplicado).
|
|
8
|
+
* - null/undefined → vacío
|
|
9
|
+
* - string vacío/espacios → vacío
|
|
10
|
+
* - array vacío → vacío
|
|
11
|
+
*/
|
|
12
|
+
export declare const isEmptyFilterValue: (value: unknown) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Retorna la función de filtro correspondiente al tipo de campo.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getFilterFn: (typeAsString: EFWFormFieldProps["typeAsString"]) => FilterFn<EFWTableItem>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const m = "__empty__", o = (e) => e == null ? !0 : typeof e == "string" ? e.trim() === "" : Array.isArray(e) ? e.length === 0 : !1, a = (e, n, t) => o(t) ? !0 : String(e.getValue(n) ?? "").toLowerCase().includes(String(t).toLowerCase());
|
|
2
|
+
a.autoRemove = o;
|
|
3
|
+
const g = (e, n, t) => {
|
|
4
|
+
if (o(t) || t === null) return !0;
|
|
5
|
+
const r = e.getValue(n);
|
|
6
|
+
return r == null ? !1 : r === Number(t);
|
|
7
|
+
};
|
|
8
|
+
g.autoRemove = (e) => o(e) || e === null;
|
|
9
|
+
const F = (e, n, t) => t == null ? !0 : e.getValue(n) === t;
|
|
10
|
+
F.autoRemove = (e) => e == null;
|
|
11
|
+
const f = (e, n, t) => {
|
|
12
|
+
if (o(t)) return !0;
|
|
13
|
+
const r = t, s = new Set(
|
|
14
|
+
r.filter((u) => u.key !== m).map((u) => u.key)
|
|
15
|
+
), i = r.some((u) => u.key === m), l = e.getValue(n), c = !l || l.length === 0;
|
|
16
|
+
return i && c ? !0 : c || s.size === 0 ? !1 : l.some((u) => s.has(u.key));
|
|
17
|
+
};
|
|
18
|
+
f.autoRemove = o;
|
|
19
|
+
const y = (e, n, t) => {
|
|
20
|
+
if (o(t)) return !0;
|
|
21
|
+
const r = t, s = e.getValue(n);
|
|
22
|
+
return s?.length ? r.some((i) => {
|
|
23
|
+
const l = new Date(i).toDateString();
|
|
24
|
+
return s.some(
|
|
25
|
+
(c) => new Date(c).toDateString() === l
|
|
26
|
+
);
|
|
27
|
+
}) : !1;
|
|
28
|
+
};
|
|
29
|
+
y.autoRemove = o;
|
|
30
|
+
const d = (e) => {
|
|
31
|
+
switch (e) {
|
|
32
|
+
case "Text":
|
|
33
|
+
case "Note":
|
|
34
|
+
return a;
|
|
35
|
+
case "Number":
|
|
36
|
+
return g;
|
|
37
|
+
case "Boolean":
|
|
38
|
+
return F;
|
|
39
|
+
case "Choice":
|
|
40
|
+
case "MultiChoice":
|
|
41
|
+
return f;
|
|
42
|
+
case "Date":
|
|
43
|
+
return y;
|
|
44
|
+
default:
|
|
45
|
+
return a;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
m as EMPTY_CHOICE_FILTER_KEY,
|
|
50
|
+
d as getFilterFn,
|
|
51
|
+
o as isEmptyFilterValue
|
|
52
|
+
};
|
|
@@ -11,8 +11,8 @@ export declare function extractOptionIdentifiers(options: EFWFormFieldValue<'Cho
|
|
|
11
11
|
/**
|
|
12
12
|
* Extrae identificadores estables de archivos adjuntos
|
|
13
13
|
*/
|
|
14
|
-
export declare function extractAttachmentIdentifiers(attachments
|
|
14
|
+
export declare function extractAttachmentIdentifiers(attachments?: EFWFormFieldValue<'Attachments'>): string[];
|
|
15
15
|
/**
|
|
16
16
|
* Extrae identificadores estables de fechas
|
|
17
17
|
*/
|
|
18
|
-
export declare function extractDateIdentifiers(dates
|
|
18
|
+
export declare function extractDateIdentifiers(dates?: EFWFormFieldValue<'Date'>): string[];
|
|
@@ -15,7 +15,7 @@ function i(n) {
|
|
|
15
15
|
return "unknown";
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
function u(n) {
|
|
18
|
+
function u(n = []) {
|
|
19
19
|
return n.map((t) => {
|
|
20
20
|
if (typeof t == "object" && t !== null) {
|
|
21
21
|
const e = t;
|
|
@@ -24,7 +24,7 @@ function u(n) {
|
|
|
24
24
|
return "unknown-file";
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
function a(n) {
|
|
27
|
+
function a(n = []) {
|
|
28
28
|
return n.map((t) => {
|
|
29
29
|
if (t instanceof Date)
|
|
30
30
|
return isNaN(t.getTime()) ? "invalid-date" : t.getTime().toString();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envisiongroup/porygon",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Librerias de componentes de React creados por la empresa Envision",
|
|
5
5
|
"license": "CC-BY-ND-4.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
"import": "./dist/react-components/hooks/*/index.js",
|
|
45
45
|
"require": "./dist/react-components/hooks/*/index.js"
|
|
46
46
|
},
|
|
47
|
+
"./react-components/i18n/*": {
|
|
48
|
+
"types": "./dist/react-components/i18n/*/index.d.ts",
|
|
49
|
+
"import": "./dist/react-components/i18n/*/index.js",
|
|
50
|
+
"require": "./dist/react-components/i18n/*/index.js"
|
|
51
|
+
},
|
|
47
52
|
"./utils/*": {
|
|
48
53
|
"types": "./dist/utils/*/index.d.ts",
|
|
49
54
|
"import": "./dist/utils/*/index.js",
|
|
@@ -55,30 +60,16 @@
|
|
|
55
60
|
"README.md",
|
|
56
61
|
"LICENSE"
|
|
57
62
|
],
|
|
58
|
-
"scripts": {
|
|
59
|
-
"build": "npm run clean && vite build --config vite.lib.config.js",
|
|
60
|
-
"build:tsc": "npm run clean && tsc",
|
|
61
|
-
"clean": "rm -rf dist",
|
|
62
|
-
"prepublishOnly": "npm run build",
|
|
63
|
-
"dev": "vite build --config vite.lib.config.js --watch",
|
|
64
|
-
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
65
|
-
"analyze": "vite build --config vite.lib.config.js && npx vite-bundle-visualizer",
|
|
66
|
-
"verify:build": "npm run clean && npm run build",
|
|
67
|
-
"verify:types": "npm run typecheck",
|
|
68
|
-
"verify:pack": "npm pack --dry-run",
|
|
69
|
-
"verify:content": "npm pack && tar -tzf *.tgz | head -50",
|
|
70
|
-
"verify:all": "npm run verify:build && npm run verify:types && npm run verify:pack && echo '\n✅ All verifications passed! Ready to publish.'"
|
|
71
|
-
},
|
|
72
63
|
"peerDependencies": {
|
|
73
|
-
"@fluentui/react-components": "9.
|
|
74
|
-
"@fluentui/react-datepicker-compat": "^0.6.
|
|
64
|
+
"@fluentui/react-components": "9.73.1",
|
|
65
|
+
"@fluentui/react-datepicker-compat": "^0.6.24",
|
|
75
66
|
"@fluentui/react-icons": "^2.0.0",
|
|
67
|
+
"@griffel/react": "^1.5.0",
|
|
76
68
|
"@tanstack/react-table": "^8.21.3",
|
|
77
69
|
"@tanstack/react-virtual": "^3.13.9",
|
|
78
|
-
"uuid": "^11.1.0",
|
|
79
|
-
"@griffel/react": "^1.5.0",
|
|
80
70
|
"react": ">=17.0.0",
|
|
81
|
-
"react-dom": ">=17.0.0"
|
|
71
|
+
"react-dom": ">=17.0.0",
|
|
72
|
+
"uuid": "^11.1.0"
|
|
82
73
|
},
|
|
83
74
|
"peerDependenciesMeta": {
|
|
84
75
|
"@fluentui/react-components": {
|
|
@@ -95,9 +86,25 @@
|
|
|
95
86
|
}
|
|
96
87
|
},
|
|
97
88
|
"devDependencies": {
|
|
89
|
+
"@fluentui/react-components": "9.73.1",
|
|
90
|
+
"@fluentui/react-datepicker-compat": "0.6.24",
|
|
91
|
+
"@fluentui/react-icons": "2.0.319",
|
|
92
|
+
"@griffel/react": "1.5.0",
|
|
93
|
+
"@storybook/react": "^10.2.13",
|
|
94
|
+
"@tanstack/react-table": "8.21.3",
|
|
95
|
+
"@tanstack/react-virtual": "3.13.9",
|
|
96
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
97
|
+
"@testing-library/react": "^16.3.2",
|
|
98
|
+
"@testing-library/user-event": "^14.6.1",
|
|
99
|
+
"@types/jest": "^30.0.0",
|
|
98
100
|
"@types/react": "^18.2.0",
|
|
99
101
|
"@types/react-dom": "^18.2.0",
|
|
102
|
+
"jest": "^30.2.0",
|
|
103
|
+
"jest-environment-jsdom": "^30.4.1",
|
|
104
|
+
"prettier": "^3.8.4",
|
|
105
|
+
"ts-jest": "^29.4.6",
|
|
100
106
|
"typescript": "^5.3.0",
|
|
107
|
+
"uuid": "11.1.0",
|
|
101
108
|
"vite": "^5.4.20",
|
|
102
109
|
"vite-plugin-dts": "^3.9.1"
|
|
103
110
|
},
|
|
@@ -105,10 +112,30 @@
|
|
|
105
112
|
"react",
|
|
106
113
|
"components",
|
|
107
114
|
"ui",
|
|
108
|
-
"
|
|
115
|
+
"envision",
|
|
116
|
+
"porygon"
|
|
109
117
|
],
|
|
110
118
|
"publishConfig": {
|
|
111
119
|
"access": "public",
|
|
112
120
|
"registry": "https://registry.npmjs.org/"
|
|
121
|
+
},
|
|
122
|
+
"scripts": {
|
|
123
|
+
"build": "pnpm run clean && vite build --config vite.lib.config.js",
|
|
124
|
+
"build:tsc": "pnpm run clean && tsc",
|
|
125
|
+
"clean": "rm -rf dist",
|
|
126
|
+
"dev": "vite build --config vite.lib.config.js --watch",
|
|
127
|
+
"typecheck": "pnpm run typecheck:src && pnpm run typecheck:type-tests",
|
|
128
|
+
"typecheck:src": "tsc --noEmit -p tsconfig.json",
|
|
129
|
+
"typecheck:type-tests": "tsc --noEmit -p tsconfig.type-tests.json",
|
|
130
|
+
"analyze": "vite build --config vite.lib.config.js && npx vite-bundle-visualizer",
|
|
131
|
+
"verify:build": "pnpm run clean && pnpm run build",
|
|
132
|
+
"verify:types": "pnpm run typecheck",
|
|
133
|
+
"verify:pack": "pnpm pack --dry-run",
|
|
134
|
+
"verify:content": "pnpm pack && tar -tzf *.tgz | head -50",
|
|
135
|
+
"verify:all": "pnpm run verify:build && pnpm run verify:types && pnpm run verify:pack && echo '\n✅ All verifications passed! Ready to publish.'",
|
|
136
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest --config jest.config.cjs",
|
|
137
|
+
"test:fields": "NODE_OPTIONS=--experimental-vm-modules jest --config jest.config.cjs src/react-components/fields",
|
|
138
|
+
"format": "prettier --write .",
|
|
139
|
+
"format:check": "prettier --check ."
|
|
113
140
|
}
|
|
114
|
-
}
|
|
141
|
+
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { jsxs as C, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { makeStyles as j, mergeClasses as $, CardFooter as V, Button as D, Text as T } from "@fluentui/react-components";
|
|
3
|
-
import { useId as q, useRef as I, useMemo as P, useState as U, useEffect as S, useCallback as d } from "react";
|
|
4
|
-
import { EFWAttachmentsContainer as G } from "./EFWAttachmentsCard/EFWAttachmentsCard.js";
|
|
5
|
-
import { Attach20Regular as H } from "@fluentui/react-icons";
|
|
6
|
-
import { formatFileSize as J } from "../../commons/utils.js";
|
|
7
|
-
import { v4 as K } from "uuid";
|
|
8
|
-
const L = j({
|
|
9
|
-
efwAttachmentError: {
|
|
10
|
-
//...
|
|
11
|
-
},
|
|
12
|
-
efwAttachmentInput: {
|
|
13
|
-
display: "none"
|
|
14
|
-
},
|
|
15
|
-
efwAttachmentsButton: {
|
|
16
|
-
margin: "0px 0px 5px"
|
|
17
|
-
},
|
|
18
|
-
efwAttachmentsContainer: {
|
|
19
|
-
display: "flex"
|
|
20
|
-
}
|
|
21
|
-
}), te = (w) => {
|
|
22
|
-
const {
|
|
23
|
-
editable: f = !0,
|
|
24
|
-
disabled: i = !1,
|
|
25
|
-
files: y,
|
|
26
|
-
defaultFiles: u,
|
|
27
|
-
className: z = "",
|
|
28
|
-
validationState: E = "none",
|
|
29
|
-
setParentComponentState: c,
|
|
30
|
-
multiple: h = !0,
|
|
31
|
-
acceptedTypes: R = "*/*",
|
|
32
|
-
maxFileSize: m = 100 * 1024 * 1024,
|
|
33
|
-
// 100MB por defecto
|
|
34
|
-
onChange: a,
|
|
35
|
-
onRemoveAttachment: p
|
|
36
|
-
} = w, b = q(), A = L(), l = I(null), s = y !== void 0, F = P(() => u ?? [], [u]), [W, v] = U(() => u ?? []), t = s ? y ?? [] : W;
|
|
37
|
-
S(() => {
|
|
38
|
-
s || v(F);
|
|
39
|
-
}, [s, F]);
|
|
40
|
-
const x = d((n) => {
|
|
41
|
-
for (const o of n)
|
|
42
|
-
if (o.size !== void 0 && o.size > m)
|
|
43
|
-
return !1;
|
|
44
|
-
return !0;
|
|
45
|
-
}, [m]);
|
|
46
|
-
S(() => {
|
|
47
|
-
t.length > 0 ? x(t) ? c?.("none") : c?.("error", `Existe un adjunto que excede el peso máximo de ${J(m)}.`) : c?.("none");
|
|
48
|
-
}, [t, x, c, m]);
|
|
49
|
-
const k = d(() => {
|
|
50
|
-
l.current && !i && l.current.click();
|
|
51
|
-
}, [i]), B = d(async (n) => {
|
|
52
|
-
const o = t.find((e) => e.id === n);
|
|
53
|
-
if (!o) {
|
|
54
|
-
console.warn(`[EFWAttachment]: Attachment with id ${n} not found`);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
try {
|
|
58
|
-
if (p && !await p(o)) {
|
|
59
|
-
console.log(`[EFWAttachment]: Removal of file ${n} was cancelled`);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const e = t.filter((g) => g.id !== n);
|
|
63
|
-
s || v(e), a && a(e), console.log(`[EFWAttachment]: File ${n} removed successfully`);
|
|
64
|
-
} catch (e) {
|
|
65
|
-
console.error("[EFWAttachment]: Detele file error:", e);
|
|
66
|
-
}
|
|
67
|
-
}, [t, p, a, s]), M = d((n) => {
|
|
68
|
-
const o = Array.from(n.target.files || []).map((e) => ({
|
|
69
|
-
id: K(),
|
|
70
|
-
name: e.name,
|
|
71
|
-
size: e.size,
|
|
72
|
-
type: e.type,
|
|
73
|
-
lastModified: e.lastModified,
|
|
74
|
-
file: e
|
|
75
|
-
}));
|
|
76
|
-
if (o.length > 0) {
|
|
77
|
-
const e = h ? [...t, ...o] : o;
|
|
78
|
-
s || v(e), a?.(e);
|
|
79
|
-
}
|
|
80
|
-
l.current && (l.current.value = "");
|
|
81
|
-
}, [t, h, a, s]), N = $(
|
|
82
|
-
z,
|
|
83
|
-
E === "error" && A.efwAttachmentError
|
|
84
|
-
);
|
|
85
|
-
return /* @__PURE__ */ C("div", { className: N, children: [
|
|
86
|
-
f && /* @__PURE__ */ C(V, { style: { display: "disabled" }, children: [
|
|
87
|
-
/* @__PURE__ */ r(
|
|
88
|
-
"input",
|
|
89
|
-
{
|
|
90
|
-
ref: l,
|
|
91
|
-
id: b,
|
|
92
|
-
type: "file",
|
|
93
|
-
className: A.efwAttachmentInput,
|
|
94
|
-
accept: R,
|
|
95
|
-
multiple: h,
|
|
96
|
-
onChange: M,
|
|
97
|
-
disabled: i
|
|
98
|
-
}
|
|
99
|
-
),
|
|
100
|
-
/* @__PURE__ */ r(
|
|
101
|
-
D,
|
|
102
|
-
{
|
|
103
|
-
size: "medium",
|
|
104
|
-
onClick: k,
|
|
105
|
-
icon: /* @__PURE__ */ r(H, {}),
|
|
106
|
-
disabled: i,
|
|
107
|
-
className: A.efwAttachmentsButton,
|
|
108
|
-
children: "Adjuntar archivos"
|
|
109
|
-
}
|
|
110
|
-
)
|
|
111
|
-
] }),
|
|
112
|
-
!f && t.length === 0 ? /* @__PURE__ */ r(T, { style: { opacity: 0.7 }, children: "Sin archivos disponibles" }) : /* @__PURE__ */ r(
|
|
113
|
-
G,
|
|
114
|
-
{
|
|
115
|
-
enableRemoveButtons: f && !i,
|
|
116
|
-
onRemoveAttachment: B,
|
|
117
|
-
attachments: t,
|
|
118
|
-
emptyMessage: "Sin archivos disponibles"
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
] });
|
|
122
|
-
};
|
|
123
|
-
export {
|
|
124
|
-
te as EFWAttachment
|
|
125
|
-
};
|
package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/EFWAttachmentsCard.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { jsx as n, jsxs as p } from "react/jsx-runtime";
|
|
2
|
-
import { makeStyles as w, Menu as g, MenuTrigger as b, SplitButton as v, Text as y, Caption2 as k, Image as C, MenuPopover as L, MenuList as R, MenuItem as m } from "@fluentui/react-components";
|
|
3
|
-
import { ArrowDownload20Regular as U, Dismiss20Regular as N } from "@fluentui/react-icons";
|
|
4
|
-
import { formatFileSize as j, getFileIconUrl as W } from "../../../commons/utils.js";
|
|
5
|
-
const I = w({
|
|
6
|
-
text: {
|
|
7
|
-
overflow: "hidden",
|
|
8
|
-
maxWidth: "170px",
|
|
9
|
-
display: "block"
|
|
10
|
-
},
|
|
11
|
-
wrapper: {
|
|
12
|
-
columnGap: "15px",
|
|
13
|
-
display: "flex",
|
|
14
|
-
minWidth: "min-content"
|
|
15
|
-
},
|
|
16
|
-
iconImage: {
|
|
17
|
-
width: "20px",
|
|
18
|
-
height: "20px"
|
|
19
|
-
},
|
|
20
|
-
textContainer: {
|
|
21
|
-
//gap: "16px",
|
|
22
|
-
display: "flex",
|
|
23
|
-
flexDirection: "column",
|
|
24
|
-
alignItems: "baseline"
|
|
25
|
-
}
|
|
26
|
-
}), A = (e) => {
|
|
27
|
-
const l = e.split(".").pop()?.toLowerCase() || "";
|
|
28
|
-
return ["pdf", "jpg", "jpeg", "png", "gif", "webp", "svg", "txt", "html", "htm"].includes(l);
|
|
29
|
-
}, f = (e) => URL.createObjectURL(e), B = ({
|
|
30
|
-
attachment: e,
|
|
31
|
-
onRemoveAttachment: l,
|
|
32
|
-
enableRemoveButton: t = !0
|
|
33
|
-
}) => {
|
|
34
|
-
const i = I(), a = e.name.split(".").pop() || "", s = () => {
|
|
35
|
-
l && l(e.id);
|
|
36
|
-
}, x = () => {
|
|
37
|
-
console.log({ attachment: e });
|
|
38
|
-
try {
|
|
39
|
-
if (!e.file) {
|
|
40
|
-
console.error("No se encontró el archivo en el attachment");
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const r = f(e.file);
|
|
44
|
-
A(e.name) ? window.open(r, "_blank") ? setTimeout(() => {
|
|
45
|
-
URL.revokeObjectURL(r);
|
|
46
|
-
}, 6e4) : (console.warn("No se pudo abrir nueva ventana, iniciando descarga..."), d(e.file, e.name)) : (d(e.file, e.name), URL.revokeObjectURL(r));
|
|
47
|
-
} catch (r) {
|
|
48
|
-
console.error("Error al abrir el archivo:", r);
|
|
49
|
-
}
|
|
50
|
-
}, d = (r, u) => {
|
|
51
|
-
try {
|
|
52
|
-
const c = f(r), o = document.createElement("a");
|
|
53
|
-
o.href = c, o.download = u, o.classList.add("external"), o.target = "_blank", o.style.display = "none", document.body.appendChild(o), o.click(), document.body.removeChild(o), setTimeout(() => {
|
|
54
|
-
URL.revokeObjectURL(c);
|
|
55
|
-
}, 1e3);
|
|
56
|
-
} catch (c) {
|
|
57
|
-
console.error("Error al descargar el archivo:", c);
|
|
58
|
-
}
|
|
59
|
-
}, h = () => {
|
|
60
|
-
if (!e.file) {
|
|
61
|
-
console.error("No se encontró el archivo en el attachment");
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
d(e.file, e.name);
|
|
65
|
-
};
|
|
66
|
-
return /* @__PURE__ */ n("div", { className: i.wrapper, children: /* @__PURE__ */ p(g, { positioning: "below-end", children: [
|
|
67
|
-
/* @__PURE__ */ n(b, { disableButtonEnhancement: !0, children: (r) => /* @__PURE__ */ n(
|
|
68
|
-
v,
|
|
69
|
-
{
|
|
70
|
-
style: { maxWidth: "250px" },
|
|
71
|
-
primaryActionButton: { onClick: x },
|
|
72
|
-
menuButton: r,
|
|
73
|
-
icon: /* @__PURE__ */ n(C, { className: i.iconImage, src: W(a, 64) }),
|
|
74
|
-
children: /* @__PURE__ */ p("div", { className: i.textContainer, children: [
|
|
75
|
-
/* @__PURE__ */ n(y, { block: !0, size: 200, weight: "semibold", wrap: !1, truncate: !0, className: i.text, children: e.name }),
|
|
76
|
-
e.size && /* @__PURE__ */ n(k, { block: !0, truncate: !0, className: i.text, children: j(e.size) })
|
|
77
|
-
] })
|
|
78
|
-
}
|
|
79
|
-
) }),
|
|
80
|
-
/* @__PURE__ */ n(L, { children: /* @__PURE__ */ p(R, { children: [
|
|
81
|
-
/* @__PURE__ */ n(m, { onClick: h, icon: /* @__PURE__ */ n(U, {}), children: "Descargar" }),
|
|
82
|
-
t && /* @__PURE__ */ n(m, { onClick: s, icon: /* @__PURE__ */ n(N, {}), children: "Quitar datos adjuntos" })
|
|
83
|
-
] }) })
|
|
84
|
-
] }) });
|
|
85
|
-
}, M = ({
|
|
86
|
-
attachments: e = [],
|
|
87
|
-
onRemoveAttachment: l,
|
|
88
|
-
className: t = "",
|
|
89
|
-
cardClassName: i = "",
|
|
90
|
-
enableRemoveButtons: a = !0
|
|
91
|
-
}) => {
|
|
92
|
-
if (e.length !== 0)
|
|
93
|
-
return /* @__PURE__ */ n("div", { className: `attachments-container ${t}`.trim(), style: { display: "flex", gap: "8px", flexWrap: "wrap", margin: "8px 0 8px" }, children: e.map((s) => /* @__PURE__ */ n(
|
|
94
|
-
B,
|
|
95
|
-
{
|
|
96
|
-
attachment: s,
|
|
97
|
-
onRemoveAttachment: l,
|
|
98
|
-
className: i,
|
|
99
|
-
enableRemoveButton: a
|
|
100
|
-
},
|
|
101
|
-
s.id
|
|
102
|
-
)) });
|
|
103
|
-
};
|
|
104
|
-
export {
|
|
105
|
-
B as EFWAttachmentsCard,
|
|
106
|
-
M as EFWAttachmentsContainer
|
|
107
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|