@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
package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.js
CHANGED
|
@@ -1,195 +1,231 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
const
|
|
3
|
-
const r =
|
|
4
|
-
I(
|
|
1
|
+
import { useRef as U, useState as m, useCallback as n, useEffect as g } from "react";
|
|
2
|
+
const te = (d) => {
|
|
3
|
+
const r = U(null), [a, o] = m([]), [f, I] = m(d || []), S = n(() => r.current?.getFields?.() || f, [f]), h = n((e) => {
|
|
4
|
+
I(e);
|
|
5
5
|
}, []);
|
|
6
|
-
|
|
6
|
+
g(() => {
|
|
7
7
|
(() => {
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const t = r.current?.getItems?.();
|
|
9
|
+
t && o(t);
|
|
10
10
|
})();
|
|
11
11
|
}, []);
|
|
12
|
-
const
|
|
12
|
+
const y = n(async (e, t = {}) => {
|
|
13
|
+
const { position: u = "end" } = t;
|
|
13
14
|
try {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const c = await r.current?.addItem?.(e, t);
|
|
16
|
+
if (c) {
|
|
17
|
+
if (c.successful.length > 0) {
|
|
18
|
+
const l = c.successful.map((s) => s.item);
|
|
19
|
+
o((s) => [
|
|
20
|
+
...u === "start" ? l : s,
|
|
21
|
+
...u === "start" ? s : l
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
return c;
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
19
27
|
successful: [],
|
|
20
|
-
failed: [{ index: -1, item:
|
|
28
|
+
failed: [{ index: -1, item: e, error: "Table reference not available" }]
|
|
21
29
|
};
|
|
22
|
-
} catch (
|
|
30
|
+
} catch (c) {
|
|
23
31
|
return {
|
|
24
32
|
successful: [],
|
|
25
|
-
failed: [{ index: -1, item:
|
|
33
|
+
failed: [{ index: -1, item: e, error: String(c) }]
|
|
26
34
|
};
|
|
27
35
|
}
|
|
28
|
-
}, []), b =
|
|
36
|
+
}, []), b = n(async (e, t = {}) => {
|
|
37
|
+
const { position: u = "end" } = t;
|
|
29
38
|
try {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
const c = await r.current?.addItems?.(e, t);
|
|
40
|
+
if (c) {
|
|
41
|
+
if (c.successful.length > 0) {
|
|
42
|
+
const l = c.successful.map((s) => s.item);
|
|
43
|
+
o((s) => [
|
|
44
|
+
...u === "start" ? l : s,
|
|
45
|
+
...u === "start" ? s : l
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
return c;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
35
51
|
successful: [],
|
|
36
|
-
failed:
|
|
37
|
-
index:
|
|
38
|
-
item:
|
|
52
|
+
failed: e.map((l, s) => ({
|
|
53
|
+
index: s,
|
|
54
|
+
item: l,
|
|
39
55
|
error: "Table reference not available"
|
|
40
56
|
}))
|
|
41
57
|
};
|
|
42
|
-
} catch (
|
|
58
|
+
} catch (c) {
|
|
43
59
|
return {
|
|
44
60
|
successful: [],
|
|
45
|
-
failed:
|
|
46
|
-
index:
|
|
47
|
-
item:
|
|
48
|
-
error: String(
|
|
61
|
+
failed: e.map((l, s) => ({
|
|
62
|
+
index: s,
|
|
63
|
+
item: l,
|
|
64
|
+
error: String(c)
|
|
49
65
|
}))
|
|
50
66
|
};
|
|
51
67
|
}
|
|
52
|
-
}, []),
|
|
68
|
+
}, []), p = n(async (e, t, u) => {
|
|
53
69
|
try {
|
|
54
|
-
const
|
|
55
|
-
return
|
|
56
|
-
const
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
}),
|
|
60
|
-
}),
|
|
70
|
+
const c = await r.current?.updateItem?.(e, t, u);
|
|
71
|
+
return c ? (c.successful.length > 0 && o((l) => {
|
|
72
|
+
const s = [...l];
|
|
73
|
+
return c.successful.forEach(({ index: i, item: $ }) => {
|
|
74
|
+
i >= 0 && i < s.length && (s[i] = $);
|
|
75
|
+
}), s;
|
|
76
|
+
}), c) : {
|
|
61
77
|
successful: [],
|
|
62
|
-
failed: [{ index:
|
|
78
|
+
failed: [{ index: e, item: t, error: "Table reference not available" }]
|
|
63
79
|
};
|
|
64
|
-
} catch (
|
|
80
|
+
} catch (c) {
|
|
65
81
|
return {
|
|
66
82
|
successful: [],
|
|
67
|
-
failed: [{ index:
|
|
83
|
+
failed: [{ index: e, item: t, error: String(c) }]
|
|
68
84
|
};
|
|
69
85
|
}
|
|
70
|
-
}, []),
|
|
86
|
+
}, []), F = n(async (e, t) => {
|
|
71
87
|
try {
|
|
72
|
-
const
|
|
73
|
-
return
|
|
74
|
-
const
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
}),
|
|
78
|
-
}),
|
|
88
|
+
const u = await r.current?.updateItems?.(e, t);
|
|
89
|
+
return u ? (u.successful.length > 0 && o((c) => {
|
|
90
|
+
const l = [...c];
|
|
91
|
+
return u.successful.forEach(({ index: s, item: i }) => {
|
|
92
|
+
s >= 0 && s < l.length && (l[s] = i);
|
|
93
|
+
}), l;
|
|
94
|
+
}), u) : {
|
|
79
95
|
successful: [],
|
|
80
|
-
failed:
|
|
81
|
-
index:
|
|
82
|
-
item:
|
|
96
|
+
failed: e.map(({ index: c, item: l }) => ({
|
|
97
|
+
index: c,
|
|
98
|
+
item: l,
|
|
83
99
|
error: "Table reference not available"
|
|
84
100
|
}))
|
|
85
101
|
};
|
|
86
|
-
} catch (
|
|
102
|
+
} catch (u) {
|
|
87
103
|
return {
|
|
88
104
|
successful: [],
|
|
89
|
-
failed:
|
|
90
|
-
index:
|
|
91
|
-
item:
|
|
92
|
-
error: String(
|
|
105
|
+
failed: e.map(({ index: c, item: l }) => ({
|
|
106
|
+
index: c,
|
|
107
|
+
item: l,
|
|
108
|
+
error: String(u)
|
|
93
109
|
}))
|
|
94
110
|
};
|
|
95
111
|
}
|
|
96
|
-
}, []),
|
|
112
|
+
}, []), w = n(async (e) => {
|
|
97
113
|
try {
|
|
98
|
-
const
|
|
99
|
-
return
|
|
100
|
-
const
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
}),
|
|
104
|
-
}),
|
|
114
|
+
const t = await r.current?.deleteItem?.(e);
|
|
115
|
+
return t ? (t.successful.length > 0 && o((u) => {
|
|
116
|
+
const c = [...u];
|
|
117
|
+
return t.successful.map((s) => s.index).sort((s, i) => i - s).forEach((s) => {
|
|
118
|
+
s >= 0 && s < c.length && c.splice(s, 1);
|
|
119
|
+
}), c;
|
|
120
|
+
}), t) : {
|
|
105
121
|
successful: [],
|
|
106
|
-
failed: [{ index:
|
|
122
|
+
failed: [{ index: e, error: "Table reference not available" }]
|
|
107
123
|
};
|
|
108
|
-
} catch (
|
|
124
|
+
} catch (t) {
|
|
109
125
|
return {
|
|
110
126
|
successful: [],
|
|
111
|
-
failed: [{ index:
|
|
127
|
+
failed: [{ index: e, error: String(t) }]
|
|
112
128
|
};
|
|
113
129
|
}
|
|
114
|
-
}, []),
|
|
130
|
+
}, []), C = n(async (e) => {
|
|
115
131
|
try {
|
|
116
|
-
const
|
|
117
|
-
return
|
|
118
|
-
const
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
}),
|
|
122
|
-
}),
|
|
132
|
+
const t = await r.current?.deleteItems?.(e);
|
|
133
|
+
return t ? (t.successful.length > 0 && o((u) => {
|
|
134
|
+
const c = [...u];
|
|
135
|
+
return t.successful.map((s) => s.index).sort((s, i) => i - s).forEach((s) => {
|
|
136
|
+
s >= 0 && s < c.length && c.splice(s, 1);
|
|
137
|
+
}), c;
|
|
138
|
+
}), t) : {
|
|
123
139
|
successful: [],
|
|
124
|
-
failed:
|
|
125
|
-
index:
|
|
140
|
+
failed: e.map((u) => ({
|
|
141
|
+
index: u,
|
|
126
142
|
error: "Table reference not available"
|
|
127
143
|
}))
|
|
128
144
|
};
|
|
129
|
-
} catch (
|
|
145
|
+
} catch (t) {
|
|
130
146
|
return {
|
|
131
147
|
successful: [],
|
|
132
|
-
failed:
|
|
133
|
-
index:
|
|
134
|
-
error: String(
|
|
148
|
+
failed: e.map((u) => ({
|
|
149
|
+
index: u,
|
|
150
|
+
error: String(t)
|
|
135
151
|
}))
|
|
136
152
|
};
|
|
137
153
|
}
|
|
138
|
-
}, []),
|
|
139
|
-
r.current?.replaceAllItems?.(
|
|
140
|
-
}, []),
|
|
141
|
-
r.current?.clearItems?.(),
|
|
142
|
-
}, []),
|
|
154
|
+
}, []), v = n((e) => r.current?.getItem?.(e) || a.find((t) => t._rowId === e), [a]), E = n((e) => r.current?.getItemByIndex?.(e) || a[e], [a]), A = n((e) => {
|
|
155
|
+
r.current?.replaceAllItems?.(e), o(e);
|
|
156
|
+
}, []), R = n(() => {
|
|
157
|
+
r.current?.clearItems?.(), o([]);
|
|
158
|
+
}, []), T = n((e) => r.current?.getItemIndex?.(e) ?? a.findIndex((t) => t._rowId === e), [a]), x = n((e) => r.current?.itemExists?.(e) ?? a.some((t) => t._rowId === e), [a]), L = n(() => r.current?.getItemsCount?.() ?? a.length, [a.length]), O = n(() => r.current?.getItems?.() ?? a, [a]), P = n(() => {
|
|
143
159
|
r.current?.deselectAllRows?.();
|
|
144
|
-
}, []),
|
|
145
|
-
r.current?.setLoading?.(
|
|
146
|
-
}, []), q =
|
|
147
|
-
r.current?.setError?.(
|
|
148
|
-
}, []), z =
|
|
149
|
-
r.current?.setPartialLoading?.(
|
|
150
|
-
}, []), D =
|
|
151
|
-
r.current?.setEmpty?.(
|
|
152
|
-
}, []), G =
|
|
160
|
+
}, []), _ = n(() => r.current?.getSelectedItems?.() ?? { items: [], indexes: [] }, []), B = n(() => r.current?.getSelectedRows?.() ?? [], []), k = n(() => r.current !== null, []), j = n((e, t) => {
|
|
161
|
+
r.current?.setLoading?.(e, t);
|
|
162
|
+
}, []), q = n((e, t) => {
|
|
163
|
+
r.current?.setError?.(e, t);
|
|
164
|
+
}, []), z = n((e, t) => {
|
|
165
|
+
r.current?.setPartialLoading?.(e, t);
|
|
166
|
+
}, []), D = n((e, t) => {
|
|
167
|
+
r.current?.setEmpty?.(e, t);
|
|
168
|
+
}, []), G = n(() => {
|
|
153
169
|
r.current?.clearOverlay?.();
|
|
154
|
-
}, []), H =
|
|
155
|
-
|
|
170
|
+
}, []), H = n(() => r.current?.getOverlayState?.() ?? "none", []), J = n(() => r.current?.getSortingState?.() ?? [], []), K = n(() => r.current?.getPrimarySortedColumn?.() ?? null, []), M = n(() => r.current?.hasActiveSorting?.() ?? !1, []), N = n((e) => {
|
|
171
|
+
r.current?.setSortingState?.(e);
|
|
172
|
+
}, []), Q = n(() => {
|
|
173
|
+
r.current?.clearSorting?.();
|
|
174
|
+
}, []), V = n(() => r.current?.getFilterableFields?.() ?? [], []), W = n(() => r.current?.getColumnFilters?.() ?? {}, []), X = n(() => r.current?.hasActiveFilters?.() ?? !1, []), Y = n((e) => {
|
|
175
|
+
r.current?.setColumnFilters?.(e);
|
|
176
|
+
}, []), Z = n(() => {
|
|
177
|
+
r.current?.clearColumnFilters?.();
|
|
178
|
+
}, []);
|
|
179
|
+
return g(() => () => {
|
|
156
180
|
r.current = null;
|
|
157
181
|
}, []), {
|
|
158
182
|
tableRef: r,
|
|
159
183
|
// Configuración
|
|
160
|
-
getFields:
|
|
184
|
+
getFields: S,
|
|
161
185
|
setFieldsConfig: h,
|
|
162
186
|
isTableReady: k,
|
|
163
187
|
// Operaciones CRUD
|
|
164
|
-
addItem:
|
|
188
|
+
addItem: y,
|
|
165
189
|
addItems: b,
|
|
166
|
-
updateItem:
|
|
167
|
-
updateItems:
|
|
168
|
-
deleteItem:
|
|
169
|
-
deleteItems:
|
|
190
|
+
updateItem: p,
|
|
191
|
+
updateItems: F,
|
|
192
|
+
deleteItem: w,
|
|
193
|
+
deleteItems: C,
|
|
170
194
|
// Consultas
|
|
171
|
-
getItem:
|
|
172
|
-
getItemByIndex:
|
|
195
|
+
getItem: v,
|
|
196
|
+
getItemByIndex: E,
|
|
173
197
|
getItems: O,
|
|
174
198
|
getItemsCount: L,
|
|
175
|
-
getItemIndex:
|
|
176
|
-
itemExists:
|
|
199
|
+
getItemIndex: T,
|
|
200
|
+
itemExists: x,
|
|
177
201
|
// Manipulación masiva
|
|
178
|
-
replaceAllItems:
|
|
179
|
-
clearItems:
|
|
202
|
+
replaceAllItems: A,
|
|
203
|
+
clearItems: R,
|
|
180
204
|
// Selección
|
|
181
|
-
deselectAllRows:
|
|
182
|
-
getSelectedItems:
|
|
183
|
-
getSelectedRows:
|
|
205
|
+
deselectAllRows: P,
|
|
206
|
+
getSelectedItems: _,
|
|
207
|
+
getSelectedRows: B,
|
|
184
208
|
// Overlay
|
|
185
209
|
setLoading: j,
|
|
186
210
|
setError: q,
|
|
187
211
|
setPartialLoading: z,
|
|
188
212
|
setEmpty: D,
|
|
189
213
|
clearOverlay: G,
|
|
190
|
-
getOverlayState: H
|
|
214
|
+
getOverlayState: H,
|
|
215
|
+
// Sorting
|
|
216
|
+
getSortingState: J,
|
|
217
|
+
getPrimarySortedColumn: K,
|
|
218
|
+
hasActiveSorting: M,
|
|
219
|
+
setSortingState: N,
|
|
220
|
+
clearSorting: Q,
|
|
221
|
+
// Filtrado
|
|
222
|
+
getFilterableFields: V,
|
|
223
|
+
getColumnFilters: W,
|
|
224
|
+
hasActiveFilters: X,
|
|
225
|
+
setColumnFilters: Y,
|
|
226
|
+
clearColumnFilters: Z
|
|
191
227
|
};
|
|
192
228
|
};
|
|
193
229
|
export {
|
|
194
|
-
|
|
230
|
+
te as useTableController
|
|
195
231
|
};
|
package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { EFWTableItem } from '../../EFWTable.types';
|
|
2
2
|
import { UseTableSelection, UseTableSelectionOptions } from './useTableSelection.types';
|
|
3
3
|
|
|
4
|
-
export declare const useTableSelection: <TItem extends EFWTableItem = EFWTableItem>({ initialSelection, onSelectionChange, enableSelection }?: UseTableSelectionOptions) => UseTableSelection<TItem>;
|
|
4
|
+
export declare const useTableSelection: <TItem extends EFWTableItem = EFWTableItem>({ initialSelection, onSelectionChange, enableSelection, items, getRowId }?: UseTableSelectionOptions<TItem>) => UseTableSelection<TItem>;
|
|
@@ -1,67 +1,114 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
initialSelection:
|
|
4
|
-
onSelectionChange:
|
|
5
|
-
enableSelection:
|
|
1
|
+
import { useCallback as l, useMemo as b, useState as z, useRef as T, useEffect as j } from "react";
|
|
2
|
+
const B = ({
|
|
3
|
+
initialSelection: p = /* @__PURE__ */ new Set(),
|
|
4
|
+
onSelectionChange: m,
|
|
5
|
+
enableSelection: f = !0,
|
|
6
|
+
items: c = [],
|
|
7
|
+
getRowId: u = (i, a) => a.toString()
|
|
6
8
|
} = {}) => {
|
|
7
|
-
const
|
|
8
|
-
const e =
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
const i = l((t) => {
|
|
10
|
+
const e = c[t];
|
|
11
|
+
return e ? u(e, t) : t.toString();
|
|
12
|
+
}, [u, c]), a = b(() => {
|
|
13
|
+
const t = /* @__PURE__ */ new Map();
|
|
14
|
+
return c.forEach((e, r) => {
|
|
15
|
+
t.set(u(e, r), r);
|
|
16
|
+
}), t;
|
|
17
|
+
}, [u, c]), [h, S] = z(() => {
|
|
18
|
+
const t = {};
|
|
19
|
+
return p.forEach((e) => {
|
|
20
|
+
const r = c[e];
|
|
21
|
+
t[r ? u(r, e) : e.toString()] = !0;
|
|
22
|
+
}), t;
|
|
23
|
+
}), g = T(/* @__PURE__ */ new Set()), s = b(() => {
|
|
24
|
+
const t = /* @__PURE__ */ new Set();
|
|
25
|
+
return Object.keys(h).filter((e) => h[e]).forEach((e) => {
|
|
26
|
+
const r = a.get(e);
|
|
27
|
+
if (r !== void 0) {
|
|
28
|
+
t.add(r);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const n = Number(e);
|
|
32
|
+
Number.isInteger(n) && n >= 0 && c[n] && t.add(n);
|
|
33
|
+
}), new Set([...t].sort((e, r) => e - r));
|
|
34
|
+
}, [c, a, h]);
|
|
35
|
+
j(() => {
|
|
36
|
+
S((t) => {
|
|
37
|
+
let e = !1;
|
|
38
|
+
const r = {};
|
|
39
|
+
Object.keys(t).forEach((o) => {
|
|
40
|
+
if (!t[o])
|
|
41
|
+
return;
|
|
42
|
+
if (a.has(o)) {
|
|
43
|
+
r[o] = !0;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const d = Number(o);
|
|
47
|
+
if (Number.isInteger(d) && d >= 0) {
|
|
48
|
+
const w = c[d];
|
|
49
|
+
if (w) {
|
|
50
|
+
const E = u(w, d);
|
|
51
|
+
r[E] = !0, e = e || E !== o;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
r[o] = !0;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
e = !0;
|
|
58
|
+
});
|
|
59
|
+
const n = Object.keys(t).filter((o) => t[o]).length;
|
|
60
|
+
return !e && Object.keys(r).length === n ? t : r;
|
|
23
61
|
});
|
|
24
|
-
}, [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
62
|
+
}, [u, c, a]), j(() => {
|
|
63
|
+
(s.size !== g.current.size || [...s].some((e) => !g.current.has(e))) && (g.current = new Set(s), m?.(s));
|
|
64
|
+
}, [s, m]);
|
|
65
|
+
const x = l(() => {
|
|
66
|
+
S({});
|
|
67
|
+
}, []), C = l((t) => {
|
|
68
|
+
f && S({
|
|
69
|
+
[i(t)]: !0
|
|
70
|
+
});
|
|
71
|
+
}, [f, i]), I = l((t) => {
|
|
72
|
+
f && S((e) => {
|
|
73
|
+
const r = i(t);
|
|
74
|
+
if (e[r]) {
|
|
75
|
+
const n = { ...e };
|
|
76
|
+
return delete n[r], n;
|
|
30
77
|
} else
|
|
31
78
|
return {
|
|
32
|
-
...
|
|
33
|
-
[
|
|
79
|
+
...e,
|
|
80
|
+
[r]: !0
|
|
34
81
|
};
|
|
35
82
|
});
|
|
36
|
-
}, [
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
}),
|
|
83
|
+
}, [f, i]), M = l((t) => {
|
|
84
|
+
f && S((e) => {
|
|
85
|
+
const r = { ...e };
|
|
86
|
+
return t.forEach((n) => {
|
|
87
|
+
r[i(n)] = !0;
|
|
88
|
+
}), r;
|
|
42
89
|
});
|
|
43
|
-
}, [
|
|
44
|
-
const
|
|
90
|
+
}, [f, i]), N = l((t) => {
|
|
91
|
+
const e = [...s];
|
|
45
92
|
return {
|
|
46
|
-
items:
|
|
47
|
-
indexes:
|
|
93
|
+
items: e.map((r) => t[r]).filter(Boolean),
|
|
94
|
+
indexes: e
|
|
48
95
|
};
|
|
49
|
-
}, [
|
|
50
|
-
index:
|
|
51
|
-
item: e
|
|
52
|
-
})).filter((
|
|
96
|
+
}, [s]), O = l((t) => [...s].map((e) => ({
|
|
97
|
+
index: e,
|
|
98
|
+
item: t[e]
|
|
99
|
+
})).filter((e) => e.item), [s]);
|
|
53
100
|
return {
|
|
54
|
-
rowSelection:
|
|
55
|
-
setRowSelection:
|
|
56
|
-
selectedIndexes:
|
|
57
|
-
deselectAll:
|
|
58
|
-
selectSingle:
|
|
59
|
-
toggleMultiple:
|
|
60
|
-
selectMultiple:
|
|
61
|
-
getSelectedItems:
|
|
62
|
-
getSelectedRows:
|
|
101
|
+
rowSelection: h,
|
|
102
|
+
setRowSelection: S,
|
|
103
|
+
selectedIndexes: s,
|
|
104
|
+
deselectAll: x,
|
|
105
|
+
selectSingle: C,
|
|
106
|
+
toggleMultiple: I,
|
|
107
|
+
selectMultiple: M,
|
|
108
|
+
getSelectedItems: N,
|
|
109
|
+
getSelectedRows: O
|
|
63
110
|
};
|
|
64
111
|
};
|
|
65
112
|
export {
|
|
66
|
-
|
|
113
|
+
B as useTableSelection
|
|
67
114
|
};
|
package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.types.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { RowSelectionState } from '@tanstack/react-table';
|
|
2
2
|
import { EFWTableItem } from '../../EFWTable.types';
|
|
3
3
|
|
|
4
|
-
export interface UseTableSelectionOptions {
|
|
4
|
+
export interface UseTableSelectionOptions<TItem extends EFWTableItem = EFWTableItem> {
|
|
5
5
|
/** Elementos seleccionados inicialmente por índice */
|
|
6
6
|
initialSelection?: Set<number>;
|
|
7
7
|
/** Callback cuando cambia la selección */
|
|
8
8
|
onSelectionChange?: (selectedIndexes: Set<number>) => void;
|
|
9
9
|
/** Si se permite selección (para mostrar checkboxes) */
|
|
10
10
|
enableSelection?: boolean;
|
|
11
|
+
/** Items actuales usados para convertir índices públicos a ids internos */
|
|
12
|
+
items?: TItem[];
|
|
13
|
+
/** Resolver de identidad estable para TanStack/react-table */
|
|
14
|
+
getRowId?: (item: TItem, index: number) => string;
|
|
11
15
|
}
|
|
12
16
|
export interface UseTableSelection<TItem extends EFWTableItem = EFWTableItem> {
|
|
13
17
|
/** Estado de selección compatible con react-table */
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export { EFWTable } from './EFWTable';
|
|
2
2
|
export { useTableController } from './hooks/useTableController/useTableController';
|
|
3
|
+
export { useDefaultFilterButton } from './hooks/useDefaultFilterButton/useDefaultFilterButton';
|
|
3
4
|
export { EFWTableOverlay, EFWTableEmpty } from './components/EFWTableOverlay';
|
|
4
|
-
export type { EFWTableProps, EFWTableItem, EFWTableRef, EFWTableMethods } from './EFWTable.types';
|
|
5
|
+
export type { EFWTableProps, EFWTableItem, EFWTableAddOptions, EFWTableRef, EFWTableMethods, EFWTableRowAnimationConfig, EFWTableRowAnimationOptions, EFWTableCommandBarButtonInput, EFWTableSort, EFWTableSortingState, EFWTableUpdateOptions, FilterValues, } from './EFWTable.types';
|
|
6
|
+
export type { EFWTableCommandBarButton, DefaultFilterButtonProps } from './components/EFWTableCommandBar';
|
|
7
|
+
export type { EFWTableLocaleText, EFWTableExtendedLocaleText } from '../../i18n';
|
|
5
8
|
export type { EFWTableOverlayProps, EFWTableOverlayConfig, EFWTableOverlayState, EFWTableOverlayDisplayType, EFWTableOverlayStateConfig, EFWTableOverlayCustomization, EFWTableOverlayBaseOptions, EFWTableLoadingOptions, EFWTableErrorOptions, EFWTablePartialLoadingOptions, EFWTableEmptyOptions, EFWTableEmptyProps, } from './components/EFWTableOverlay';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { EFWTable as o } from "./EFWTable.js";
|
|
2
|
-
import { useTableController as
|
|
3
|
-
import {
|
|
2
|
+
import { useTableController as l } from "./hooks/useTableController/useTableController.js";
|
|
3
|
+
import { useDefaultFilterButton as f } from "./hooks/useDefaultFilterButton/useDefaultFilterButton.js";
|
|
4
|
+
import { EFWTableEmpty as p, EFWTableOverlay as b } from "./components/EFWTableOverlay/EFWTableOverlay.js";
|
|
4
5
|
export {
|
|
5
6
|
o as EFWTable,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
p as EFWTableEmpty,
|
|
8
|
+
b as EFWTableOverlay,
|
|
9
|
+
f as useDefaultFilterButton,
|
|
10
|
+
l as useTableController
|
|
9
11
|
};
|
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { createCacheKey as
|
|
3
|
-
import { resolveRendererForField as
|
|
4
|
-
import { areValuesEqual as
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import * as f from "react";
|
|
2
|
+
import { createCacheKey as m, getCachedResult as h, setCachedResult as R } from "../cache.js";
|
|
3
|
+
import { resolveRendererForField as F } from "../renderers.js";
|
|
4
|
+
import { areValuesEqual as b } from "../comparison.js";
|
|
5
|
+
import { useFieldsLocaleText as y } from "../../../../i18n/PorygonI18nProvider.js";
|
|
6
|
+
import { getFormFieldDisplayText as T } from "../../../../forms/EFWForm/EFWForm.converter.js";
|
|
7
|
+
const C = f.memo(
|
|
7
8
|
({
|
|
8
9
|
field: e,
|
|
9
|
-
value:
|
|
10
|
-
item:
|
|
11
|
-
rowIndex:
|
|
12
|
-
columnRenderers:
|
|
13
|
-
useDefaultAsFallback:
|
|
10
|
+
value: t,
|
|
11
|
+
item: r,
|
|
12
|
+
rowIndex: i,
|
|
13
|
+
columnRenderers: o,
|
|
14
|
+
useDefaultAsFallback: d
|
|
14
15
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
let
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
16
|
+
const c = y().switch.labels, u = e.typeAsString === "Boolean" ? `switch:${c.checkedText}:${c.uncheckedText}` : "default", s = m(e, t, r, i, o, u);
|
|
17
|
+
let l = h(s);
|
|
18
|
+
if (l === void 0) {
|
|
19
|
+
const a = F(e, o), n = {
|
|
19
20
|
field: e,
|
|
20
|
-
value:
|
|
21
|
-
item:
|
|
22
|
-
rowIndex:
|
|
21
|
+
value: t,
|
|
22
|
+
item: r,
|
|
23
|
+
rowIndex: i,
|
|
23
24
|
columnId: e.internalName
|
|
24
25
|
};
|
|
25
|
-
|
|
26
|
+
a.fieldRenderer ? l = a.fieldRenderer(n) : a.defaultRenderer ? l = a.defaultRenderer(n) : d ? l = T(e, t, {
|
|
27
|
+
switchLabels: c
|
|
28
|
+
}) : l = null, R(s, l);
|
|
26
29
|
}
|
|
27
|
-
return
|
|
30
|
+
return l;
|
|
28
31
|
},
|
|
29
32
|
// Función de comparación para React.memo
|
|
30
|
-
(e,
|
|
33
|
+
(e, t) => e.field === t.field && e.item === t.item && e.rowIndex === t.rowIndex && e.columnRenderers === t.columnRenderers && e.useDefaultAsFallback === t.useDefaultAsFallback ? b(
|
|
31
34
|
e.value,
|
|
32
|
-
|
|
35
|
+
t.value,
|
|
33
36
|
e.field.typeAsString
|
|
34
37
|
) : !1
|
|
35
38
|
);
|
|
36
39
|
export {
|
|
37
|
-
|
|
40
|
+
C as CellRenderer
|
|
38
41
|
};
|