@envisiongroup/porygon 1.0.0-rc.8 → 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
package/dist/react-components/tables/EFWTable/hooks/useDefaultFilterButton/useDefaultFilterButton.js
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as g, useCallback as L } from "react";
|
|
3
|
+
import { mergeClasses as Z } from "@fluentui/react-components";
|
|
4
|
+
import { FilterDismiss20Regular as $, FilterAdd20Filled as ee, Filter20Regular as D } from "@fluentui/react-icons";
|
|
5
|
+
import { mergeButtonProps as te, generateFormProps as re } from "../../components/EFWTableCommandBar/EFWTableCommandBar.utils.js";
|
|
6
|
+
import { isEmptyFilterValue as x, EMPTY_CHOICE_FILTER_KEY as E } from "../../utils/filterFunctions.js";
|
|
7
|
+
import { useFormController as le } from "../../../../forms/EFWForm/EFWForm.hooks.js";
|
|
8
|
+
import { EFWForm as ne } from "../../../../forms/EFWForm/EFWForm.js";
|
|
9
|
+
const oe = (r) => {
|
|
10
|
+
switch (r) {
|
|
11
|
+
case "Text":
|
|
12
|
+
case "Note":
|
|
13
|
+
return "";
|
|
14
|
+
case "Number":
|
|
15
|
+
return null;
|
|
16
|
+
case "Choice":
|
|
17
|
+
case "MultiChoice":
|
|
18
|
+
case "Date":
|
|
19
|
+
case "Attachments":
|
|
20
|
+
return [];
|
|
21
|
+
case "Boolean":
|
|
22
|
+
return null;
|
|
23
|
+
default:
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}, se = (r, n) => {
|
|
27
|
+
const e = {
|
|
28
|
+
...r,
|
|
29
|
+
editable: !0,
|
|
30
|
+
disabled: !1,
|
|
31
|
+
required: !1,
|
|
32
|
+
hint: void 0,
|
|
33
|
+
infoLabel: void 0
|
|
34
|
+
};
|
|
35
|
+
switch (r.typeAsString) {
|
|
36
|
+
case "Text":
|
|
37
|
+
return {
|
|
38
|
+
...e,
|
|
39
|
+
minLength: void 0,
|
|
40
|
+
maxLength: void 0,
|
|
41
|
+
formatType: void 0,
|
|
42
|
+
labels: {
|
|
43
|
+
...r.labels ?? {},
|
|
44
|
+
placeholder: n.filterTextPlaceholder
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
case "Number":
|
|
48
|
+
return {
|
|
49
|
+
...e,
|
|
50
|
+
minValue: void 0,
|
|
51
|
+
maxValue: void 0,
|
|
52
|
+
labels: {
|
|
53
|
+
...r.labels ?? {},
|
|
54
|
+
placeholder: n.filterNumberPlaceholder
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
case "Note":
|
|
58
|
+
return {
|
|
59
|
+
...e,
|
|
60
|
+
labels: {
|
|
61
|
+
...r.labels ?? {},
|
|
62
|
+
placeholder: n.filterNotePlaceholder
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
case "Date":
|
|
66
|
+
return {
|
|
67
|
+
...e,
|
|
68
|
+
labels: {
|
|
69
|
+
...r.labels ?? {},
|
|
70
|
+
placeholder: n.filterDatePlaceholder
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
case "Choice":
|
|
74
|
+
return {
|
|
75
|
+
...e,
|
|
76
|
+
labels: {
|
|
77
|
+
...r.labels ?? {},
|
|
78
|
+
placeholder: n.filterChoicePlaceholder
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
case "MultiChoice":
|
|
82
|
+
return {
|
|
83
|
+
...e,
|
|
84
|
+
labels: {
|
|
85
|
+
...r.labels ?? {},
|
|
86
|
+
placeholder: n.filterMultiChoicePlaceholder
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
default:
|
|
90
|
+
return e;
|
|
91
|
+
}
|
|
92
|
+
}, ae = (r = [], n) => {
|
|
93
|
+
const e = r.filter((i) => i.key !== E);
|
|
94
|
+
return [{ key: E, text: n }, ...e];
|
|
95
|
+
}, he = (r, n) => {
|
|
96
|
+
const e = n, i = le(), F = g(null), B = g(/* @__PURE__ */ new Set()), R = g([]), y = g(), m = g(!1), N = te(
|
|
97
|
+
{
|
|
98
|
+
enabled: !0,
|
|
99
|
+
props: {
|
|
100
|
+
children: e.filterButtonLabel,
|
|
101
|
+
icon: /* @__PURE__ */ h(D, {}),
|
|
102
|
+
collapseLabel: "xs",
|
|
103
|
+
drawerConfig: {
|
|
104
|
+
title: e.filterDrawerTitle,
|
|
105
|
+
size: "small",
|
|
106
|
+
position: "end"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
r
|
|
111
|
+
), { enabled: P, props: V, form: k } = N, { children: S, appearance: M, collapseLabel: O, drawerConfig: _, style: j, className: z } = V || {}, {
|
|
112
|
+
title: W,
|
|
113
|
+
size: I,
|
|
114
|
+
position: Y,
|
|
115
|
+
modalType: q,
|
|
116
|
+
labels: H,
|
|
117
|
+
contentRenderDelay: K,
|
|
118
|
+
deferContentRendering: G
|
|
119
|
+
} = _ || {}, J = Object.values(i.values).some((u) => !x(u)), C = L((u) => [
|
|
120
|
+
{
|
|
121
|
+
kind: "EFWButton",
|
|
122
|
+
props: {
|
|
123
|
+
icon: /* @__PURE__ */ h($, {}),
|
|
124
|
+
children: e.filterClearButtonLabel,
|
|
125
|
+
disabled: !u,
|
|
126
|
+
onClick: (c, f) => {
|
|
127
|
+
const o = F.current;
|
|
128
|
+
if (!o) return { success: !1 };
|
|
129
|
+
const l = R.current.reduce((s, b) => (s[b.internalName] = oe(b.typeAsString), s), {});
|
|
130
|
+
return o.clearColumnFilters(), i.setValues(l, {
|
|
131
|
+
overwriteAll: !0,
|
|
132
|
+
triggerFieldLogic: !1,
|
|
133
|
+
triggerOnChange: !1
|
|
134
|
+
}), i.onValuesChange(l), m.current && (m.current = !1, y.current?.({ buttons: C(!1) })), { success: !0 };
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
kind: "EFWButton",
|
|
140
|
+
props: {
|
|
141
|
+
children: e.filterCloseButtonLabel,
|
|
142
|
+
onClick: (c, f) => {
|
|
143
|
+
f();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
], [i, e]), Q = L((u) => {
|
|
148
|
+
i.onValuesChange(u);
|
|
149
|
+
const c = {};
|
|
150
|
+
Object.entries(u).forEach(([l, s]) => {
|
|
151
|
+
B.current.has(l) && Array.isArray(s) ? c[l] = s.length === 0 ? null : s[0].key === "true" : c[l] = s;
|
|
152
|
+
}), F.current?.setColumnFilters(c);
|
|
153
|
+
const o = Object.values(c).some((l) => !x(l));
|
|
154
|
+
m.current !== o && (m.current = o, y.current?.({ buttons: C(o) }));
|
|
155
|
+
}, [C, i]);
|
|
156
|
+
return {
|
|
157
|
+
enabled: P,
|
|
158
|
+
kind: "EFWDrawerButton",
|
|
159
|
+
props: {
|
|
160
|
+
icon: J ? /* @__PURE__ */ h(ee, {}) : /* @__PURE__ */ h(D, {}),
|
|
161
|
+
children: S,
|
|
162
|
+
appearance: M,
|
|
163
|
+
collapseLabel: O,
|
|
164
|
+
style: j,
|
|
165
|
+
className: z,
|
|
166
|
+
onClick: (u, c, f) => {
|
|
167
|
+
const { tableMethods: o } = f;
|
|
168
|
+
F.current = o;
|
|
169
|
+
const l = o.getFilterableFields(), s = o.getColumnFilters(), b = Object.values(s).some((t) => !x(t)), v = /* @__PURE__ */ new Set();
|
|
170
|
+
l.forEach((t) => {
|
|
171
|
+
t.typeAsString === "Boolean" && v.add(t.internalName);
|
|
172
|
+
}), B.current = v;
|
|
173
|
+
const T = l.map((t) => {
|
|
174
|
+
const a = se(t, e);
|
|
175
|
+
if (t.typeAsString === "Boolean") {
|
|
176
|
+
const d = t.labels?.checkedText ?? e.filterBooleanTrueLabel, p = t.labels?.uncheckedText ?? e.filterBooleanFalseLabel;
|
|
177
|
+
return {
|
|
178
|
+
...a,
|
|
179
|
+
typeAsString: "Choice",
|
|
180
|
+
multiple: !1,
|
|
181
|
+
options: [
|
|
182
|
+
{ key: "true", text: d },
|
|
183
|
+
{ key: "false", text: p }
|
|
184
|
+
],
|
|
185
|
+
labels: {
|
|
186
|
+
placeholder: e.filterBooleanPlaceholder
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
if (t.typeAsString === "Choice") {
|
|
191
|
+
const d = t.beforeRenderOptions;
|
|
192
|
+
return {
|
|
193
|
+
...a,
|
|
194
|
+
multiple: !0,
|
|
195
|
+
beforeRenderOptions: (p) => {
|
|
196
|
+
const X = d ? d(p) : p;
|
|
197
|
+
return ae(X, e.filterEmptyChoiceOptionLabel);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
return t.typeAsString === "MultiChoice" ? {
|
|
202
|
+
...a,
|
|
203
|
+
multiple: !0
|
|
204
|
+
} : a;
|
|
205
|
+
});
|
|
206
|
+
R.current = T, y.current = c.updateDrawer, m.current = b;
|
|
207
|
+
const w = {};
|
|
208
|
+
l.forEach((t) => {
|
|
209
|
+
const a = s[t.internalName];
|
|
210
|
+
if (t.typeAsString === "Boolean" && a !== null && a !== void 0) {
|
|
211
|
+
const d = t.labels?.checkedText ?? e.filterBooleanTrueLabel, p = t.labels?.uncheckedText ?? e.filterBooleanFalseLabel;
|
|
212
|
+
w[t.internalName] = [
|
|
213
|
+
{ key: String(a), text: a ? d : p }
|
|
214
|
+
];
|
|
215
|
+
} else
|
|
216
|
+
w[t.internalName] = a;
|
|
217
|
+
});
|
|
218
|
+
const A = k ? re(
|
|
219
|
+
T,
|
|
220
|
+
k
|
|
221
|
+
) : { fields: T }, U = {
|
|
222
|
+
...A,
|
|
223
|
+
className: Z("efw-table-filter", A.className)
|
|
224
|
+
};
|
|
225
|
+
c({
|
|
226
|
+
size: I,
|
|
227
|
+
title: W,
|
|
228
|
+
position: Y,
|
|
229
|
+
modalType: q,
|
|
230
|
+
deferContentRendering: G ?? !0,
|
|
231
|
+
contentRenderDelay: K,
|
|
232
|
+
labels: {
|
|
233
|
+
closeButtonAriaLabel: e.drawerCloseButtonAriaLabel,
|
|
234
|
+
loadingContentText: e.drawerLoadingContentText,
|
|
235
|
+
...H ?? {}
|
|
236
|
+
},
|
|
237
|
+
content: /* @__PURE__ */ h(
|
|
238
|
+
ne,
|
|
239
|
+
{
|
|
240
|
+
...U,
|
|
241
|
+
description: e.filterDrawerDescription,
|
|
242
|
+
formRef: i.formRef,
|
|
243
|
+
onValuesChange: Q,
|
|
244
|
+
defaultValues: w
|
|
245
|
+
}
|
|
246
|
+
),
|
|
247
|
+
buttons: C(b)
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
export {
|
|
254
|
+
he as useDefaultFilterButton
|
|
255
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EFWFormFieldProps } from '../../../../forms/EFWForm';
|
|
2
2
|
import { EFWTableCommandBarButton, DefaultDrawerButtonProps } from '../../components/EFWTableCommandBar/EFWTableCommandBar.types';
|
|
3
|
+
import { EFWTableLocaleText } from '../../../../i18n';
|
|
3
4
|
|
|
4
|
-
export declare const useDefaultUpdateButton: <T extends readonly EFWFormFieldProps[] = EFWFormFieldProps[]>(editButtonConfig
|
|
5
|
+
export declare const useDefaultUpdateButton: <T extends readonly EFWFormFieldProps[] = EFWFormFieldProps[]>(editButtonConfig: DefaultDrawerButtonProps<T> | undefined, localeText: EFWTableLocaleText) => EFWTableCommandBarButton<T>;
|
package/dist/react-components/tables/EFWTable/hooks/useDefaultUpdateButton/useDefaultUpdateButton.js
CHANGED
|
@@ -1,78 +1,98 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Text as
|
|
3
|
-
import { Edit20Regular as
|
|
4
|
-
import { getErrorMessage as
|
|
5
|
-
import { mergeButtonProps as
|
|
6
|
-
import { useFormController as
|
|
7
|
-
import { EFWForm as
|
|
8
|
-
const
|
|
9
|
-
const { formRef:
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Text as J } from "@fluentui/react-components";
|
|
3
|
+
import { Edit20Regular as K } from "@fluentui/react-icons";
|
|
4
|
+
import { getErrorMessage as f } from "../../../../commons/utils.js";
|
|
5
|
+
import { mergeButtonProps as O, generateFormProps as Q } from "../../components/EFWTableCommandBar/EFWTableCommandBar.utils.js";
|
|
6
|
+
import { useFormController as X } from "../../../../forms/EFWForm/EFWForm.hooks.js";
|
|
7
|
+
import { EFWForm as Y } from "../../../../forms/EFWForm/EFWForm.js";
|
|
8
|
+
const le = (b = {}, w) => {
|
|
9
|
+
const e = w, { formRef: T, getValues: x, validateForm: C, addMessageBar: l, setDisabled: n, removeAllMessagesBar: h } = X(), y = O({
|
|
10
10
|
enabled: !0,
|
|
11
11
|
props: {
|
|
12
|
-
children:
|
|
13
|
-
icon: /* @__PURE__ */
|
|
12
|
+
children: e.updateButtonLabel,
|
|
13
|
+
icon: /* @__PURE__ */ o(K, {}),
|
|
14
|
+
collapseLabel: "xs",
|
|
14
15
|
drawerConfig: {
|
|
15
|
-
title:
|
|
16
|
+
title: e.updateDrawerTitle,
|
|
16
17
|
size: "small",
|
|
17
18
|
position: "end"
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
|
-
},
|
|
21
|
+
}, b), { enabled: B, props: E, form: D } = y, { children: d, appearance: F, icon: c, collapseLabel: L, drawerConfig: R, style: k, className: M } = E || {}, {
|
|
22
|
+
title: v,
|
|
23
|
+
size: z,
|
|
24
|
+
position: P,
|
|
25
|
+
modalType: A,
|
|
26
|
+
labels: S,
|
|
27
|
+
contentRenderDelay: W,
|
|
28
|
+
deferContentRendering: $
|
|
29
|
+
} = R || {};
|
|
21
30
|
return {
|
|
22
|
-
enabled:
|
|
31
|
+
enabled: B,
|
|
23
32
|
kind: "EFWDrawerButton",
|
|
24
33
|
props: {
|
|
25
34
|
icon: c,
|
|
26
|
-
children:
|
|
27
|
-
appearance:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
modalType:
|
|
40
|
-
|
|
35
|
+
children: d,
|
|
36
|
+
appearance: F,
|
|
37
|
+
collapseLabel: L,
|
|
38
|
+
style: k,
|
|
39
|
+
className: M,
|
|
40
|
+
onClick: (Z, _, I) => {
|
|
41
|
+
const { selectedRows: s, tableMethods: p } = I, V = p.getFields(), j = /* @__PURE__ */ o(J, { children: e.updateDrawerDescription }), u = s.length === 1 ? s[0].item : {}, N = s.map((a) => a.index), U = Q(V, D);
|
|
42
|
+
_({
|
|
43
|
+
size: z,
|
|
44
|
+
title: v,
|
|
45
|
+
position: P,
|
|
46
|
+
deferContentRendering: $ ?? !0,
|
|
47
|
+
contentRenderDelay: W,
|
|
48
|
+
modalType: A,
|
|
49
|
+
labels: {
|
|
50
|
+
closeButtonAriaLabel: e.drawerCloseButtonAriaLabel,
|
|
51
|
+
loadingContentText: e.drawerLoadingContentText,
|
|
52
|
+
...S ?? {}
|
|
53
|
+
},
|
|
54
|
+
content: /* @__PURE__ */ o(Y, { defaultValues: u, formRef: T, description: j, ...U }),
|
|
41
55
|
buttons: [
|
|
42
56
|
{
|
|
43
57
|
kind: "EFWButton",
|
|
44
58
|
props: {
|
|
45
59
|
icon: c,
|
|
46
|
-
children:
|
|
60
|
+
children: e.updateActionText || d,
|
|
47
61
|
appearance: "primary",
|
|
48
62
|
autoLoading: !0,
|
|
49
|
-
loadingText:
|
|
63
|
+
labels: { loadingText: e.updateLoadingText },
|
|
50
64
|
successConfig: {
|
|
51
|
-
text:
|
|
65
|
+
text: e.updateSuccessText
|
|
52
66
|
},
|
|
53
|
-
onClick: async (
|
|
54
|
-
if (
|
|
55
|
-
const
|
|
56
|
-
|
|
67
|
+
onClick: async (a, i) => {
|
|
68
|
+
if (C()) {
|
|
69
|
+
const q = x(), m = n(!0);
|
|
70
|
+
h();
|
|
57
71
|
try {
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
72
|
+
const t = await p.updateItem(N[0], { ...u, ...q });
|
|
73
|
+
if (t.failed?.length) {
|
|
74
|
+
n(!1, m);
|
|
75
|
+
const G = t.failed.map((r) => {
|
|
76
|
+
const g = f(r.error);
|
|
77
|
+
return {
|
|
78
|
+
key: `update-error-${r.index}-${g}`,
|
|
79
|
+
message: g
|
|
80
|
+
};
|
|
81
|
+
}), H = t.failed.length > 1;
|
|
82
|
+
return l({
|
|
63
83
|
id: "update-operation-error",
|
|
64
84
|
intent: "error",
|
|
65
|
-
title:
|
|
66
|
-
message: /* @__PURE__ */
|
|
85
|
+
title: H ? `${e.updateErrorTitleMultiple}:` : `${e.updateErrorTitleSingle}:`,
|
|
86
|
+
message: /* @__PURE__ */ o("ul", { children: G.map((r) => /* @__PURE__ */ o("li", { children: r.message }, r.key)) })
|
|
67
87
|
}), { success: !1 };
|
|
68
88
|
}
|
|
69
|
-
return setTimeout(
|
|
70
|
-
} catch (
|
|
71
|
-
return
|
|
89
|
+
return setTimeout(i, 100), { success: !0 };
|
|
90
|
+
} catch (t) {
|
|
91
|
+
return n(!1, m), console.error("Error durante actualización:", t), l({
|
|
72
92
|
id: "update-unexpected-error",
|
|
73
93
|
intent: "error",
|
|
74
|
-
title:
|
|
75
|
-
message:
|
|
94
|
+
title: e.updateErrorTitleSingle,
|
|
95
|
+
message: f(t)
|
|
76
96
|
}), { success: !1 };
|
|
77
97
|
}
|
|
78
98
|
} else
|
|
@@ -83,9 +103,9 @@ const re = (f = {}) => {
|
|
|
83
103
|
{
|
|
84
104
|
kind: "EFWButton",
|
|
85
105
|
props: {
|
|
86
|
-
children:
|
|
87
|
-
onClick: (
|
|
88
|
-
|
|
106
|
+
children: e.cancelButtonLabel,
|
|
107
|
+
onClick: (a, i) => {
|
|
108
|
+
i();
|
|
89
109
|
}
|
|
90
110
|
}
|
|
91
111
|
}
|
|
@@ -96,5 +116,5 @@ const re = (f = {}) => {
|
|
|
96
116
|
};
|
|
97
117
|
};
|
|
98
118
|
export {
|
|
99
|
-
|
|
119
|
+
le as useDefaultUpdateButton
|
|
100
120
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ColumnRenderers } from '../../EFWTable.types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Estabiliza la referencia de `columnRenderers` para evitar re-renders
|
|
5
|
+
* innecesarios cuando el consumidor la pasa como objeto inline.
|
|
6
|
+
*
|
|
7
|
+
* Solo actualiza la referencia interna si la estructura o las funciones
|
|
8
|
+
* renderer realmente cambiaron (shallow comparison por nivel).
|
|
9
|
+
*/
|
|
10
|
+
export declare function useStableColumnRenderers(columnRenderers?: ColumnRenderers): ColumnRenderers | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useRef as a } from "react";
|
|
2
|
+
function d(e, t) {
|
|
3
|
+
if (e === t) return !0;
|
|
4
|
+
if (!e || !t) return !1;
|
|
5
|
+
const i = Object.keys(e), l = Object.keys(t);
|
|
6
|
+
if (i.length !== l.length) return !1;
|
|
7
|
+
for (const o of i) {
|
|
8
|
+
const f = e[o], n = t[o];
|
|
9
|
+
if (f === n) continue;
|
|
10
|
+
if (!f || !n || f.default !== n.default) return !1;
|
|
11
|
+
const r = f.fields, s = n.fields;
|
|
12
|
+
if (r === s) continue;
|
|
13
|
+
if (!r || !s) return !1;
|
|
14
|
+
const u = Object.keys(r), y = Object.keys(s);
|
|
15
|
+
if (u.length !== y.length) return !1;
|
|
16
|
+
for (const c of u)
|
|
17
|
+
if (r[c] !== s[c])
|
|
18
|
+
return !1;
|
|
19
|
+
}
|
|
20
|
+
return !0;
|
|
21
|
+
}
|
|
22
|
+
function k(e) {
|
|
23
|
+
const t = a(e);
|
|
24
|
+
return d(t.current, e) || (t.current = e), t.current;
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
k as useStableColumnRenderers
|
|
28
|
+
};
|