@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
|
@@ -1,10 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { DefaultDrawerButtonProps, EFWTableCommandBarButton } from './components/EFWTableCommandBar/EFWTableCommandBar.types';
|
|
1
|
+
import { RowData } from '@tanstack/react-table';
|
|
2
|
+
import { CardProps } from '@fluentui/react-components';
|
|
3
|
+
import { DefaultDrawerButtonProps, DefaultFilterButtonProps, EFWTableCommandBarButton } from './components/EFWTableCommandBar/EFWTableCommandBar.types';
|
|
4
4
|
import { EFWFormFieldProps, EFWFormFieldType, EFWFormFieldValue } from '../../forms/EFWForm';
|
|
5
5
|
import { ExtractFieldNames, GetFieldValue } from '../../forms/EFWForm/EFWForm.types';
|
|
6
6
|
import { EFWTableOverlayConfig, EFWTableOverlayState, EFWTableOverlayCustomization, EFWTableLoadingOptions, EFWTableErrorOptions, EFWTablePartialLoadingOptions, EFWTableEmptyOptions } from './components/EFWTableOverlay';
|
|
7
|
+
import { EFWTableExtendedLocaleText } from '../../i18n';
|
|
7
8
|
|
|
9
|
+
declare module '@tanstack/react-table' {
|
|
10
|
+
interface ColumnMeta<TData extends RowData, TValue> {
|
|
11
|
+
typeAsString?: string;
|
|
12
|
+
cellLineClamp?: number;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Tipo para los valores de filtro activos en la tabla.
|
|
17
|
+
* Las claves son los `internalName` de los campos y los valores son los valores de filtro.
|
|
18
|
+
*/
|
|
19
|
+
export type FilterValues<T extends readonly EFWFormFieldProps[] = EFWFormFieldProps[]> = string extends ExtractFieldNames<T> ? Record<string, EFWFormFieldValue | null | undefined> : Partial<{
|
|
20
|
+
[K in ExtractFieldNames<T>]: GetFieldValue<T, K> | null | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Descriptor público de ordenamiento de EFWTable.
|
|
24
|
+
* - `id`: internalName de la columna
|
|
25
|
+
* - `desc`: true = descendente, false = ascendente
|
|
26
|
+
*/
|
|
27
|
+
export interface EFWTableSort {
|
|
28
|
+
id: string;
|
|
29
|
+
desc: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Estado público de ordenamiento de EFWTable.
|
|
33
|
+
* Se mantiene desacoplado de tipos internos de TanStack.
|
|
34
|
+
*/
|
|
35
|
+
export type EFWTableSortingState = EFWTableSort[];
|
|
8
36
|
/**
|
|
9
37
|
* Tipo base para los elementos de la tabla (fallback genérico con index signature).
|
|
10
38
|
* Se usa internamente cuando no hay tipado específico disponible.
|
|
@@ -38,24 +66,26 @@ export type EFWTableItem<T extends readonly EFWFormFieldProps[] = EFWFormFieldPr
|
|
|
38
66
|
} & {
|
|
39
67
|
_rowId?: string;
|
|
40
68
|
};
|
|
41
|
-
/**
|
|
42
|
-
* Tipo para items de entrada (sin _rowId) - lo que el usuario proporciona.
|
|
43
|
-
* Útil para firmas de métodos como addItem/addItems donde el _rowId se genera internamente.
|
|
44
|
-
*/
|
|
45
|
-
export type EFWTableItemInput<T extends readonly EFWFormFieldProps[]> = string extends ExtractFieldNames<T> ? Omit<EFWTableItemBase, '_rowId'> : {
|
|
46
|
-
[K in ExtractFieldNames<T>]: GetFieldValue<T, K>;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Tipo para items con _rowId garantizado (uso interno).
|
|
50
|
-
* Representa un item que ya fue procesado y tiene un identificador único.
|
|
51
|
-
*/
|
|
52
|
-
export type EFWTableItemComplete<T extends readonly EFWFormFieldProps[]> = EFWTableItemInput<T> & {
|
|
53
|
-
readonly _rowId: string;
|
|
54
|
-
};
|
|
55
69
|
export interface EFWTableRow<T = EFWTableItem> {
|
|
56
70
|
index: number;
|
|
57
71
|
item: T;
|
|
58
72
|
}
|
|
73
|
+
export type EFWTableInsertPosition = 'start' | 'end';
|
|
74
|
+
export interface EFWTableRowAnimationOptions {
|
|
75
|
+
animateRows?: boolean;
|
|
76
|
+
}
|
|
77
|
+
export interface EFWTableRowAnimationConfig {
|
|
78
|
+
addRows?: boolean;
|
|
79
|
+
updateRows?: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface EFWTableAddOptions extends EFWTableRowAnimationOptions {
|
|
82
|
+
position?: EFWTableInsertPosition;
|
|
83
|
+
}
|
|
84
|
+
export type EFWTableUpdateOptions = EFWTableRowAnimationOptions;
|
|
85
|
+
export interface EFWTableRowAnimationSignal {
|
|
86
|
+
delay: number;
|
|
87
|
+
token: number;
|
|
88
|
+
}
|
|
59
89
|
export interface OperationResult<T> {
|
|
60
90
|
successful: {
|
|
61
91
|
index: number;
|
|
@@ -67,19 +97,53 @@ export interface OperationResult<T> {
|
|
|
67
97
|
error?: string | Error;
|
|
68
98
|
}[];
|
|
69
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Resultado flexible para el callback beforeUpdateItems.
|
|
102
|
+
*
|
|
103
|
+
* Permite reportar éxito solo con `index` y delegar al componente
|
|
104
|
+
* la reconstrucción del item completo antes de notificar/retornar.
|
|
105
|
+
*/
|
|
106
|
+
export interface BeforeUpdateItemsResult<T> {
|
|
107
|
+
successful: {
|
|
108
|
+
index: number;
|
|
109
|
+
item?: Partial<T>;
|
|
110
|
+
}[];
|
|
111
|
+
failed: {
|
|
112
|
+
index: number;
|
|
113
|
+
item?: Partial<T>;
|
|
114
|
+
error?: string | Error;
|
|
115
|
+
}[];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Resultado flexible para el callback beforeDeleteItems.
|
|
119
|
+
*
|
|
120
|
+
* Permite reportar éxito solo con `index` y delegar al componente
|
|
121
|
+
* la reconstrucción del item completo antes de notificar/retornar.
|
|
122
|
+
*/
|
|
123
|
+
export interface BeforeDeleteItemsResult<T> {
|
|
124
|
+
successful: {
|
|
125
|
+
index: number;
|
|
126
|
+
item?: Partial<T>;
|
|
127
|
+
}[];
|
|
128
|
+
failed: {
|
|
129
|
+
index: number;
|
|
130
|
+
item?: Partial<T>;
|
|
131
|
+
error?: string | Error;
|
|
132
|
+
}[];
|
|
133
|
+
}
|
|
70
134
|
/**
|
|
71
135
|
* Interfaz que define los métodos expuestos por el componente EFWForm para controlar su estado y comportamiento.
|
|
72
136
|
* Estos métodos permiten interactuar con los valores, estado de edición, validaciones y mensajes del formulario.
|
|
73
137
|
*/
|
|
74
138
|
export interface EFWTableMethods<T extends readonly EFWFormFieldProps[] = EFWFormFieldProps[]> {
|
|
75
139
|
getFields: () => T;
|
|
76
|
-
addItem: (item: Omit<EFWTableItem<T>, '_rowId'
|
|
77
|
-
addItems: (items: Omit<EFWTableItem<T>, '_rowId'>[]) => Promise<OperationResult<EFWTableItem<T>>>;
|
|
78
|
-
updateItem: (index: number, item: Partial<EFWTableItem<T
|
|
140
|
+
addItem: (item: Omit<EFWTableItem<T>, '_rowId'>, options?: EFWTableAddOptions) => Promise<OperationResult<EFWTableItem<T>>>;
|
|
141
|
+
addItems: (items: Omit<EFWTableItem<T>, '_rowId'>[], options?: EFWTableAddOptions) => Promise<OperationResult<EFWTableItem<T>>>;
|
|
142
|
+
updateItem: (index: number, item: Partial<EFWTableItem<T>>, options?: EFWTableUpdateOptions) => Promise<OperationResult<EFWTableItem<T>>>;
|
|
79
143
|
updateItems: (items: {
|
|
80
144
|
index: number;
|
|
81
145
|
item: Partial<EFWTableItem<T>>;
|
|
82
|
-
}[]) => Promise<OperationResult<EFWTableItem<T>>>;
|
|
146
|
+
}[], options?: EFWTableUpdateOptions) => Promise<OperationResult<EFWTableItem<T>>>;
|
|
83
147
|
deleteItem: (index: number) => Promise<OperationResult<EFWTableItem<T>>>;
|
|
84
148
|
deleteItems: (indexes: number[]) => Promise<OperationResult<EFWTableItem<T>>>;
|
|
85
149
|
getItem: (id: string | number) => EFWTableItem<T> | undefined;
|
|
@@ -128,42 +192,74 @@ export interface EFWTableMethods<T extends readonly EFWFormFieldProps[] = EFWFor
|
|
|
128
192
|
* Retorna el estado actual del overlay
|
|
129
193
|
*/
|
|
130
194
|
getOverlayState: () => EFWTableOverlayState;
|
|
195
|
+
/**
|
|
196
|
+
* Retorna los campos de la tabla que tienen el filtrado habilitado.
|
|
197
|
+
* Por defecto todas las columnas son filtrables, excepto:
|
|
198
|
+
* - las que tengan `filterable: false` en `columnConfig`
|
|
199
|
+
* - los campos de tipo `Attachments` (siempre excluidos del drawer de filtros)
|
|
200
|
+
*/
|
|
201
|
+
getFilterableFields: () => Exclude<T[number], EFWFormFieldProps<'Attachments'>>[];
|
|
202
|
+
/**
|
|
203
|
+
* Retorna los valores de filtro activos actualmente.
|
|
204
|
+
*/
|
|
205
|
+
getColumnFilters: () => FilterValues<T>;
|
|
206
|
+
/**
|
|
207
|
+
* Indica si hay al menos un filtro activo en la tabla.
|
|
208
|
+
*/
|
|
209
|
+
hasActiveFilters: () => boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Establece los valores de filtro de la tabla.
|
|
212
|
+
* @param filters - Mapa de `{ [internalName]: filterValue }`
|
|
213
|
+
*/
|
|
214
|
+
setColumnFilters: (filters: FilterValues<T>) => void;
|
|
215
|
+
/**
|
|
216
|
+
* Elimina todos los filtros activos de la tabla.
|
|
217
|
+
*/
|
|
218
|
+
clearColumnFilters: () => void;
|
|
219
|
+
/**
|
|
220
|
+
* Retorna el estado de ordenamiento activo.
|
|
221
|
+
*/
|
|
222
|
+
getSortingState: () => EFWTableSortingState;
|
|
223
|
+
/**
|
|
224
|
+
* Retorna la columna de ordenamiento primaria activa o null si no hay sorting.
|
|
225
|
+
*/
|
|
226
|
+
getPrimarySortedColumn: () => EFWTableSort | null;
|
|
227
|
+
/**
|
|
228
|
+
* Indica si hay al menos una columna ordenada.
|
|
229
|
+
*/
|
|
230
|
+
hasActiveSorting: () => boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Establece el estado de ordenamiento de la tabla.
|
|
233
|
+
* @param sortingState - Lista de columnas ordenadas por prioridad.
|
|
234
|
+
*/
|
|
235
|
+
setSortingState: (sortingState: EFWTableSortingState) => void;
|
|
236
|
+
/**
|
|
237
|
+
* Elimina todo el ordenamiento activo.
|
|
238
|
+
*/
|
|
239
|
+
clearSorting: () => void;
|
|
131
240
|
}
|
|
132
241
|
/**
|
|
133
242
|
* Tipo que representa la referencia al componente EFWForm.
|
|
134
243
|
* Puede ser un objeto con los métodos de `EFWFormMethods` o null si no está inicializado.
|
|
135
244
|
*/
|
|
136
245
|
export type EFWTableRef<T extends readonly EFWFormFieldProps[] = EFWFormFieldProps[]> = EFWTableMethods<T> | null;
|
|
137
|
-
export
|
|
138
|
-
key: string;
|
|
139
|
-
label?: string | (() => string);
|
|
140
|
-
icon?: React.ReactNode | (() => React.ReactNode);
|
|
141
|
-
appearance?: "primary" | "outline" | "subtle" | "secondary" | "transparent";
|
|
142
|
-
disabled?: boolean | ((selectedItems: EFWTableItem[], selectedIndexes: number[]) => boolean);
|
|
143
|
-
hidden?: boolean;
|
|
144
|
-
title?: string | (() => string);
|
|
145
|
-
loading?: boolean | (() => boolean);
|
|
146
|
-
className?: string;
|
|
147
|
-
onClick?: (e: React.MouseEvent) => void;
|
|
148
|
-
render?: (config: EFWTableButton, selectedItems: EFWTableItem[], selectedIndexes: number[]) => React.ReactNode;
|
|
149
|
-
}
|
|
150
|
-
export interface EFWTableRowData extends TableRowData<EFWTableItem> {
|
|
151
|
-
onClick: (e: React.MouseEvent) => void;
|
|
152
|
-
onKeyDown: (e: React.KeyboardEvent) => void;
|
|
153
|
-
onCheckboxClick: (e: React.MouseEvent) => void;
|
|
154
|
-
selected: boolean;
|
|
155
|
-
appearance: "brand" | "none" | "neutral";
|
|
156
|
-
}
|
|
157
|
-
export interface ReactWindowRenderFnProps extends ListChildComponentProps {
|
|
158
|
-
data: EFWTableRowData[];
|
|
159
|
-
fields: EFWFormFieldProps[];
|
|
160
|
-
columnSizing?: any;
|
|
161
|
-
resizableColumns: boolean;
|
|
162
|
-
customGetFieldIcon?: (internalName: string, item: EFWTableItem) => React.ReactNode;
|
|
163
|
-
}
|
|
246
|
+
export type EFWTableCommandBarButtonInput<T extends readonly EFWFormFieldProps[] = EFWFormFieldProps[]> = EFWTableCommandBarButton<T> | EFWTableCommandBarButton;
|
|
164
247
|
export interface EFWTableProps<T extends readonly EFWFormFieldProps[] = EFWFormFieldProps[]> {
|
|
165
248
|
appearance?: CardProps['appearance'];
|
|
166
249
|
fields: T;
|
|
250
|
+
/**
|
|
251
|
+
* Textos de localización para labels internos de tabla.
|
|
252
|
+
* Si se omite, se usan los defaults del provider global (o defaults internos en español).
|
|
253
|
+
*/
|
|
254
|
+
/**
|
|
255
|
+
* Textos de localización para labels internos de tabla.
|
|
256
|
+
* Si se omite, se usan los defaults del provider global (o defaults internos en español).
|
|
257
|
+
*
|
|
258
|
+
* Opcionalmente puede incluir `form`, `fields` y `buttons` para traducir
|
|
259
|
+
* los formularios, campos y botones dentro de los drawers CRUD de la tabla,
|
|
260
|
+
* sin necesidad de un `PorygonI18nProvider` externo.
|
|
261
|
+
*/
|
|
262
|
+
localeText?: Partial<EFWTableExtendedLocaleText>;
|
|
167
263
|
/**
|
|
168
264
|
* Items de la tabla en modo CONTROLLED.
|
|
169
265
|
* Cuando se proporciona `items`, el componente NO maneja el estado internamente.
|
|
@@ -194,6 +290,19 @@ export interface EFWTableProps<T extends readonly EFWFormFieldProps[] = EFWFormF
|
|
|
194
290
|
*/
|
|
195
291
|
height?: number;
|
|
196
292
|
itemSize?: number;
|
|
293
|
+
dense?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Configuración default para animar filas actualizadas mediante métodos de la tabla.
|
|
296
|
+
*
|
|
297
|
+
* La opción por llamada (`addItem(..., { animateRows })`) tiene prioridad sobre
|
|
298
|
+
* esta configuración global.
|
|
299
|
+
*/
|
|
300
|
+
rowAnimationConfig?: EFWTableRowAnimationConfig;
|
|
301
|
+
/**
|
|
302
|
+
* Número máximo de líneas visibles en celdas de tipo Text, Note, Choice, MultiChoice y Attachments.
|
|
303
|
+
* Se puede sobrescribir por columna usando `columnConfig[col].cellLineClamp`.
|
|
304
|
+
*/
|
|
305
|
+
cellLineClamp?: number;
|
|
197
306
|
enableSelection?: boolean;
|
|
198
307
|
enableCommandBar?: boolean;
|
|
199
308
|
tableStyle?: 'row' | 'grid';
|
|
@@ -202,33 +311,121 @@ export interface EFWTableProps<T extends readonly EFWFormFieldProps[] = EFWFormF
|
|
|
202
311
|
defaultSelectedItems?: Set<number>;
|
|
203
312
|
onSelectionChange?: (selectedItems: Set<number>) => void;
|
|
204
313
|
onRowClick?: (item: EFWTableItem<T>, index: number) => void;
|
|
314
|
+
onRowDoubleClick?: (item: EFWTableItem<T>, index: number) => void;
|
|
205
315
|
resizableColumns?: boolean;
|
|
206
316
|
autoSizeColumns?: boolean;
|
|
207
|
-
|
|
317
|
+
columnConfig?: Record<string, {
|
|
208
318
|
maxWidth?: number;
|
|
209
319
|
width?: number;
|
|
210
320
|
minWidth?: number;
|
|
211
321
|
sticky?: boolean;
|
|
212
322
|
/** Oculta la columna de la tabla */
|
|
213
323
|
hidden?: boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Habilita o deshabilita el ordenamiento para esta columna.
|
|
326
|
+
* @default true
|
|
327
|
+
*/
|
|
328
|
+
sortable?: boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Habilita el filtrado para esta columna.
|
|
331
|
+
* Por defecto está habilitado; usar `false` para ocultar el campo del drawer de filtros del `useDefaultFilterButton`.
|
|
332
|
+
* Nota: los campos de tipo `Attachments` se excluyen siempre del drawer de filtros.
|
|
333
|
+
* @default true
|
|
334
|
+
*/
|
|
335
|
+
filterable?: boolean;
|
|
336
|
+
/**
|
|
337
|
+
* Número máximo de líneas visibles en la celda (aplica a Text, Note, Choice, MultiChoice, Attachments).
|
|
338
|
+
* Sobrescribe el valor general `cellLineClamp` de EFWTableProps para esta columna.
|
|
339
|
+
*/
|
|
340
|
+
cellLineClamp?: number;
|
|
214
341
|
}>;
|
|
342
|
+
/**
|
|
343
|
+
* Estado inicial de ordenamiento (modo uncontrolled).
|
|
344
|
+
* @example [{ id: 'firstName', desc: false }]
|
|
345
|
+
*/
|
|
346
|
+
defaultSorting?: EFWTableSortingState;
|
|
347
|
+
/**
|
|
348
|
+
* Callback invocado cuando el usuario cambia el orden de una columna.
|
|
349
|
+
*
|
|
350
|
+
* Si se provee, se activa el modo **server-side sorting**: TanStack no ordena los datos
|
|
351
|
+
* internamente y delega esa responsabilidad al desarrollador. El desarrollador debe
|
|
352
|
+
* obtener los datos ordenados (por ejemplo, via API) y actualizar la tabla usando
|
|
353
|
+
* `tableMethods.replaceAllItems()`.
|
|
354
|
+
*
|
|
355
|
+
* Si no se provee, el ordenamiento es **client-side**: TanStack ordena los datos
|
|
356
|
+
* automáticamente con `getSortedRowModel`.
|
|
357
|
+
*
|
|
358
|
+
* @param sortingState - Estado actual de ordenamiento `{ id: string; desc: boolean }[]`
|
|
359
|
+
* @param tableMethods - Métodos de la tabla para actualizar los datos
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* // Server-side sorting
|
|
363
|
+
* const handleSortChange = async (sortingState, tableMethods) => {
|
|
364
|
+
* const [sort] = sortingState;
|
|
365
|
+
* if (!sort) return;
|
|
366
|
+
* const data = await api.getItems({ sortBy: sort.id, sortDir: sort.desc ? 'desc' : 'asc' });
|
|
367
|
+
* tableMethods.replaceAllItems(data);
|
|
368
|
+
* };
|
|
369
|
+
*/
|
|
370
|
+
onSortChange?: (sortingState: EFWTableSortingState, tableMethods: EFWTableMethods<T>) => void;
|
|
371
|
+
/**
|
|
372
|
+
* Callback invocado cuando el usuario cambia los filtros activos.
|
|
373
|
+
*
|
|
374
|
+
* Si se provee, se activa el modo **server-side filtering**: TanStack no filtra los datos
|
|
375
|
+
* internamente y delega esa responsabilidad al desarrollador. El desarrollador debe
|
|
376
|
+
* obtener los datos filtrados (por ejemplo, via API) y actualizar la tabla usando
|
|
377
|
+
* `tableMethods.replaceAllItems()`.
|
|
378
|
+
*
|
|
379
|
+
* Si no se provee, el filtrado es **client-side**: los datos se filtran automáticamente
|
|
380
|
+
* con `getFilteredRowModel` de TanStack.
|
|
381
|
+
*
|
|
382
|
+
* @param filters - Valores de filtro actuales por campo `{ [internalName]: filterValue }`
|
|
383
|
+
* @param tableMethods - Métodos de la tabla para actualizar los datos
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* // Server-side filtering
|
|
387
|
+
* const handleFilterChange = async (filters, tableMethods) => {
|
|
388
|
+
* const data = await api.getItems({ filters });
|
|
389
|
+
* tableMethods.replaceAllItems(data);
|
|
390
|
+
* };
|
|
391
|
+
*/
|
|
392
|
+
onFilterChange?: (filters: FilterValues<T>, tableMethods: EFWTableMethods<T>) => void;
|
|
215
393
|
useVirtualization?: boolean;
|
|
216
394
|
getFieldIcon?: (internalName: string, item: EFWTableItem<T>) => React.ReactNode;
|
|
217
395
|
tableRef?: React.MutableRefObject<EFWTableRef<T>>;
|
|
218
396
|
onItemsChange?: (newItems: EFWTableItem<T>[]) => void;
|
|
219
397
|
onBeforeDelete?: (selectedItems: EFWTableItem<T>[], selectedIndexes: number[]) => number[] | Promise<number[]>;
|
|
220
398
|
/** Botones que se renderizan siempre, independientemente de la selección. */
|
|
221
|
-
alwaysButtons?:
|
|
399
|
+
alwaysButtons?: EFWTableCommandBarButtonInput<T>[];
|
|
222
400
|
/** Botones que se renderizan solo cuando no hay filas seleccionadas. */
|
|
223
|
-
noSelectionButtons?:
|
|
401
|
+
noSelectionButtons?: EFWTableCommandBarButtonInput<T>[];
|
|
224
402
|
/** Botones que se renderizan solo cuando hay exactamente una fila seleccionada. */
|
|
225
|
-
singleSelectionButtons?:
|
|
403
|
+
singleSelectionButtons?: EFWTableCommandBarButtonInput<T>[];
|
|
226
404
|
/** Botones que se renderizan cuando hay más de una fila seleccionada. */
|
|
227
|
-
multiSelectionButtons?:
|
|
405
|
+
multiSelectionButtons?: EFWTableCommandBarButtonInput<T>[];
|
|
406
|
+
/**
|
|
407
|
+
* Callback genérico de scroll sobre el contenedor interno de la tabla.
|
|
408
|
+
*/
|
|
228
409
|
onScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
|
|
410
|
+
/**
|
|
411
|
+
* Se dispara cuando el scroll vertical está cerca del final de la tabla.
|
|
412
|
+
* Útil para implementar infinite scroll sin repetir lógica en cada consumidor.
|
|
413
|
+
*/
|
|
414
|
+
onScrollEnd?: () => void;
|
|
415
|
+
/**
|
|
416
|
+
* Distancia en píxeles antes del final para disparar `onScrollEnd`.
|
|
417
|
+
* @default 500
|
|
418
|
+
*/
|
|
419
|
+
scrollEndThreshold?: number;
|
|
420
|
+
/**
|
|
421
|
+
* Muestra un indicador de carga al final del contenido de la tabla.
|
|
422
|
+
* No se considera una fila real y no participa en selección ni virtualización.
|
|
423
|
+
*/
|
|
424
|
+
loadingMore?: boolean;
|
|
229
425
|
addButtonConfig?: DefaultDrawerButtonProps<T>;
|
|
230
426
|
updateButtonConfig?: DefaultDrawerButtonProps<T>;
|
|
231
427
|
deleteButtonConfig?: DefaultDrawerButtonProps<T>;
|
|
428
|
+
filterButtonConfig?: DefaultFilterButtonProps<T>;
|
|
232
429
|
/**
|
|
233
430
|
* Callback que se ejecuta antes de agregar elementos
|
|
234
431
|
*
|
|
@@ -301,9 +498,9 @@ export interface EFWTableProps<T extends readonly EFWFormFieldProps[] = EFWFormF
|
|
|
301
498
|
*
|
|
302
499
|
* @param {Array<{index: number, item: Partial<EFWTableItem>}>} items - Elementos a actualizar con sus índices
|
|
303
500
|
* @param {EFWTableMethods} tableMethods - Métodos de la tabla para operaciones adicionales
|
|
304
|
-
* @returns {Promise<
|
|
501
|
+
* @returns {Promise<BeforeUpdateItemsResult<EFWTableItem> | void>}
|
|
305
502
|
* - `void`: Continúa con la operación normal de actualización
|
|
306
|
-
* - `
|
|
503
|
+
* - `BeforeUpdateItemsResult`: Controla qué elementos se actualizan (el item en `successful` es opcional)
|
|
307
504
|
*
|
|
308
505
|
* @example
|
|
309
506
|
* // Validación de permisos - devuelve void si todo OK
|
|
@@ -356,7 +553,7 @@ export interface EFWTableProps<T extends readonly EFWFormFieldProps[] = EFWFormF
|
|
|
356
553
|
beforeUpdateItems?: (items: {
|
|
357
554
|
index: number;
|
|
358
555
|
item: Partial<EFWTableItem<T>>;
|
|
359
|
-
}[], tableMethods: EFWTableMethods<T>) => Promise<
|
|
556
|
+
}[], tableMethods: EFWTableMethods<T>) => Promise<BeforeUpdateItemsResult<EFWTableItem<T>> | void>;
|
|
360
557
|
/**
|
|
361
558
|
* Callback que se ejecuta antes de eliminar elementos
|
|
362
559
|
*
|
|
@@ -366,9 +563,9 @@ export interface EFWTableProps<T extends readonly EFWFormFieldProps[] = EFWFormF
|
|
|
366
563
|
*
|
|
367
564
|
* @param {Array<{index: number, item: Partial<EFWTableItem>}>} items - Elementos a eliminar con sus índices
|
|
368
565
|
* @param {EFWTableMethods} tableMethods - Métodos de la tabla para operaciones adicionales
|
|
369
|
-
* @returns {Promise<
|
|
566
|
+
* @returns {Promise<BeforeDeleteItemsResult<EFWTableItem> | void>}
|
|
370
567
|
* - `void`: Continúa con la operación normal de eliminación
|
|
371
|
-
* - `
|
|
568
|
+
* - `BeforeDeleteItemsResult`: Controla qué elementos se eliminan (el item en `successful` es opcional)
|
|
372
569
|
*
|
|
373
570
|
* @example
|
|
374
571
|
* // Validación de dependencias - devuelve void si todo OK
|
|
@@ -443,7 +640,7 @@ export interface EFWTableProps<T extends readonly EFWFormFieldProps[] = EFWFormF
|
|
|
443
640
|
beforeDeleteItems?: (items: {
|
|
444
641
|
index: number;
|
|
445
642
|
item: Partial<EFWTableItem<T>>;
|
|
446
|
-
}[], tableMethods: EFWTableMethods<T>) => Promise<
|
|
643
|
+
}[], tableMethods: EFWTableMethods<T>) => Promise<BeforeDeleteItemsResult<EFWTableItem<T>> | void>;
|
|
447
644
|
/**
|
|
448
645
|
* Renderers personalizados para tipos de campo.
|
|
449
646
|
* Si el renderer retorna null/undefined, se usará el renderer por defecto.
|
|
@@ -496,9 +693,6 @@ export interface CellRendererContext<T extends EFWFormFieldType> {
|
|
|
496
693
|
columnId: string;
|
|
497
694
|
}
|
|
498
695
|
export type CellRenderer<T extends EFWFormFieldType> = (context: CellRendererContext<T>) => React.ReactNode;
|
|
499
|
-
export type Renderers = {
|
|
500
|
-
[K in EFWFormFieldType]?: CellRenderer<K>;
|
|
501
|
-
};
|
|
502
696
|
export type ColumnRenderers = {
|
|
503
697
|
[K in EFWFormFieldType]?: {
|
|
504
698
|
default?: CellRenderer<K>;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { EFWTableBodyProps } from './EFWTableBody.types';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Wrapper exportado: delega a VirtualizedTableBody o PlainTableBody
|
|
5
|
+
* según la prop useVirtualization. Mantiene la misma interfaz pública.
|
|
6
|
+
*/
|
|
7
|
+
export declare const EFWTableBody: (props: EFWTableBodyProps) => React.ReactElement;
|
|
@@ -1,75 +1,120 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { useVirtualizer as
|
|
4
|
-
import { EFWTableRow as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx as g, jsxs as V } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as S } from "react";
|
|
3
|
+
import { useVirtualizer as A } from "@tanstack/react-virtual";
|
|
4
|
+
import { EFWTableRow as x } from "../EFWTableRow/EFWTableRow.js";
|
|
5
|
+
import { tokens as m } from "@fluentui/react-components";
|
|
6
|
+
const B = (e) => e ? {
|
|
7
|
+
fontSize: m.fontSizeBase200,
|
|
8
|
+
lineHeight: m.lineHeightBase200
|
|
9
|
+
} : {
|
|
10
|
+
fontSize: m.fontSizeBase300,
|
|
11
|
+
lineHeight: m.lineHeightBase300
|
|
12
|
+
}, I = (e) => {
|
|
13
|
+
S(() => {
|
|
14
|
+
const r = e.current;
|
|
15
|
+
if (!r) return;
|
|
16
|
+
let n = 0, i = !1, a = !1;
|
|
17
|
+
const l = () => {
|
|
18
|
+
cancelAnimationFrame(n), n = requestAnimationFrame(() => {
|
|
19
|
+
const c = r.scrollLeft > 0, u = r.scrollTop > 0;
|
|
20
|
+
c !== i && (r.classList.toggle("is-scrolling-x", c), i = c), u !== a && (r.classList.toggle("is-scrolling-y", u), a = u);
|
|
14
21
|
});
|
|
15
22
|
};
|
|
16
|
-
return
|
|
17
|
-
|
|
23
|
+
return r.addEventListener("scroll", l, { passive: !0 }), l(), () => {
|
|
24
|
+
r.removeEventListener("scroll", l), cancelAnimationFrame(n);
|
|
18
25
|
};
|
|
19
|
-
}, [
|
|
20
|
-
},
|
|
21
|
-
tableContainerRef:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
}, [e]);
|
|
27
|
+
}, F = ({
|
|
28
|
+
tableContainerRef: e,
|
|
29
|
+
enableSelection: r = !0,
|
|
30
|
+
itemSize: n,
|
|
31
|
+
dense: i = !0,
|
|
32
|
+
rowAnimationSignals: a,
|
|
33
|
+
table: l,
|
|
26
34
|
gridTemplateColumns: c,
|
|
27
|
-
columnSizing:
|
|
28
|
-
stickyColumnsInfo:
|
|
29
|
-
onRowClick:
|
|
35
|
+
columnSizing: u,
|
|
36
|
+
stickyColumnsInfo: h,
|
|
37
|
+
onRowClick: f,
|
|
38
|
+
onRowDoubleClick: w
|
|
30
39
|
}) => {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const o =
|
|
34
|
-
count:
|
|
35
|
-
getScrollElement: () =>
|
|
36
|
-
estimateSize: () =>
|
|
40
|
+
const d = l.getRowModel().rows.length, p = d > 0;
|
|
41
|
+
I(p ? e : { current: null });
|
|
42
|
+
const o = A({
|
|
43
|
+
count: d,
|
|
44
|
+
getScrollElement: () => e.current,
|
|
45
|
+
estimateSize: () => n ?? i ? 32 : 44,
|
|
37
46
|
measureElement: typeof window < "u" && navigator.userAgent.indexOf("Firefox") === -1 ? (t) => t?.getBoundingClientRect().height : void 0,
|
|
38
47
|
overscan: 10
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
});
|
|
49
|
+
S(() => {
|
|
50
|
+
requestAnimationFrame(() => {
|
|
42
51
|
try {
|
|
43
52
|
o.measure();
|
|
44
53
|
} catch (t) {
|
|
45
54
|
console.warn("Error al recalcular virtualizer:", t);
|
|
46
55
|
}
|
|
47
56
|
});
|
|
48
|
-
}, [
|
|
49
|
-
const
|
|
57
|
+
}, [d > 0, o]);
|
|
58
|
+
const s = o.getVirtualItems(), R = o.getTotalSize(), y = s.length > 0 ? s[0].start : 0, v = s.length > 0 ? R - s[s.length - 1].end : 0, T = s.map((t) => ({
|
|
50
59
|
virtualRow: t,
|
|
51
|
-
row:
|
|
52
|
-
}))
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
row: l.getRowModel().rows[t.index]
|
|
61
|
+
})), E = B(i);
|
|
62
|
+
return /* @__PURE__ */ V("div", { className: "table-body", style: E, children: [
|
|
63
|
+
y > 0 && /* @__PURE__ */ g("div", { style: { height: y } }),
|
|
64
|
+
T.map(({ row: t, virtualRow: z }) => /* @__PURE__ */ g(
|
|
65
|
+
x,
|
|
57
66
|
{
|
|
58
67
|
row: t,
|
|
59
|
-
|
|
68
|
+
stripeIndex: z.index,
|
|
69
|
+
virtualRow: z,
|
|
70
|
+
dense: i,
|
|
71
|
+
rowAnimationSignal: t.original._rowId ? a?.[String(t.original._rowId)] : void 0,
|
|
60
72
|
rowVirtualizer: o,
|
|
61
|
-
useVirtualization:
|
|
62
|
-
enableSelection:
|
|
73
|
+
useVirtualization: !0,
|
|
74
|
+
enableSelection: r,
|
|
63
75
|
gridTemplateColumns: c,
|
|
64
|
-
columnSizing:
|
|
65
|
-
stickyColumnsInfo:
|
|
66
|
-
onRowClick:
|
|
76
|
+
columnSizing: u,
|
|
77
|
+
stickyColumnsInfo: h,
|
|
78
|
+
onRowClick: f,
|
|
79
|
+
onRowDoubleClick: w
|
|
67
80
|
},
|
|
68
|
-
t.id
|
|
81
|
+
t.original._rowId || t.id
|
|
69
82
|
)),
|
|
70
|
-
|
|
83
|
+
v > 0 && /* @__PURE__ */ g("div", { style: { height: v } })
|
|
71
84
|
] });
|
|
72
|
-
}
|
|
85
|
+
}, _ = ({
|
|
86
|
+
tableContainerRef: e,
|
|
87
|
+
enableSelection: r = !0,
|
|
88
|
+
dense: n = !0,
|
|
89
|
+
rowAnimationSignals: i,
|
|
90
|
+
table: a,
|
|
91
|
+
gridTemplateColumns: l,
|
|
92
|
+
columnSizing: c,
|
|
93
|
+
stickyColumnsInfo: u,
|
|
94
|
+
onRowClick: h,
|
|
95
|
+
onRowDoubleClick: f
|
|
96
|
+
}) => {
|
|
97
|
+
const d = a.getRowModel().rows.length > 0, p = B(n);
|
|
98
|
+
return I(d ? e : { current: null }), /* @__PURE__ */ g("div", { className: "table-body", style: p, children: a.getRowModel().rows.map((o, s) => /* @__PURE__ */ g(
|
|
99
|
+
x,
|
|
100
|
+
{
|
|
101
|
+
row: o,
|
|
102
|
+
stripeIndex: s,
|
|
103
|
+
virtualRow: null,
|
|
104
|
+
dense: n,
|
|
105
|
+
rowAnimationSignal: o.original._rowId ? i?.[String(o.original._rowId)] : void 0,
|
|
106
|
+
rowVirtualizer: null,
|
|
107
|
+
useVirtualization: !1,
|
|
108
|
+
enableSelection: r,
|
|
109
|
+
gridTemplateColumns: l,
|
|
110
|
+
columnSizing: c,
|
|
111
|
+
stickyColumnsInfo: u,
|
|
112
|
+
onRowClick: h,
|
|
113
|
+
onRowDoubleClick: f
|
|
114
|
+
},
|
|
115
|
+
o.original._rowId || o.id
|
|
116
|
+
)) });
|
|
117
|
+
}, q = (e) => e.useVirtualization ? /* @__PURE__ */ g(F, { ...e }) : /* @__PURE__ */ g(_, { ...e });
|
|
73
118
|
export {
|
|
74
|
-
|
|
119
|
+
q as EFWTableBody
|
|
75
120
|
};
|
package/dist/react-components/tables/EFWTable/components/EFWTableBody/EFWTableBody.types.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Row, Table } from '@tanstack/react-table';
|
|
2
2
|
import { EFWFormFieldProps } from '../../../../forms/EFWForm';
|
|
3
|
-
import { EFWTableItem } from '../../EFWTable.types';
|
|
3
|
+
import { EFWTableItem, EFWTableRowAnimationSignal } from '../../EFWTable.types';
|
|
4
4
|
|
|
5
5
|
export interface EFWTableBodyProps {
|
|
6
6
|
tableContainerRef: React.RefObject<HTMLDivElement>;
|
|
7
7
|
useVirtualization: boolean;
|
|
8
8
|
enableSelection?: boolean;
|
|
9
9
|
itemSize: number;
|
|
10
|
+
dense: boolean;
|
|
11
|
+
rowAnimationSignals?: Record<string, EFWTableRowAnimationSignal>;
|
|
10
12
|
table: Table<EFWTableItem>;
|
|
11
13
|
gridTemplateColumns: string;
|
|
12
14
|
columnSizing: Record<string, number>;
|
|
@@ -16,4 +18,5 @@ export interface EFWTableBodyProps {
|
|
|
16
18
|
stickyPositions: Record<string, number>;
|
|
17
19
|
};
|
|
18
20
|
onRowClick: (row: Row<EFWTableItem>, event?: React.MouseEvent) => void;
|
|
21
|
+
onRowDoubleClick?: (row: Row<EFWTableItem>, event?: React.MouseEvent) => void;
|
|
19
22
|
}
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { EFWTableItem } from '../../EFWTable.types';
|
|
2
|
+
import { EFWTableCellProps } from './EFWTableCell.types';
|
|
4
3
|
|
|
5
|
-
interface EFWTableCellProps {
|
|
6
|
-
cell: Cell<EFWTableItem, unknown>;
|
|
7
|
-
columnSizing: Record<string, number>;
|
|
8
|
-
stickyColumnsInfo: {
|
|
9
|
-
stickyColumns: string[];
|
|
10
|
-
stickyPositions: Record<string, number>;
|
|
11
|
-
};
|
|
12
|
-
useVirtualization: boolean;
|
|
13
|
-
}
|
|
14
4
|
/**
|
|
15
5
|
* Componente EFWTableCell exportado directamente sin memoización.
|
|
16
6
|
* TanStack Table maneja internamente el estado y los objetos cell
|
|
17
7
|
* pueden mantener la misma referencia mientras cambia su estado interno.
|
|
18
8
|
*/
|
|
19
9
|
export declare const EFWTableCell: React.FC<EFWTableCellProps>;
|
|
20
|
-
export {};
|