@m4l/components 9.3.34-BE20251127-beta.1 → 9.3.34-JT20251210-beta.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/@types/export.d.ts +6 -0
- package/@types/types.d.ts +60 -6
- package/components/AccountPopover/AccountPopover.styles.js +5 -2
- package/components/AccountPopover/slots/AccountPopoverSlots.d.ts +6 -6
- package/components/ActionsGroup/ActionsGroup.d.ts +5 -0
- package/components/ActionsGroup/ActionsGroup.js +40 -0
- package/components/ActionsGroup/ActionsGroup.styles.d.ts +2 -0
- package/components/ActionsGroup/ActionsGroup.styles.js +95 -0
- package/components/ActionsGroup/__tests__/ActionsGroup.test.d.ts +1 -0
- package/components/ActionsGroup/constants.d.ts +2 -0
- package/components/ActionsGroup/constants.js +8 -0
- package/components/ActionsGroup/icons.d.ts +3 -0
- package/components/ActionsGroup/icons.js +6 -0
- package/components/ActionsGroup/index.d.ts +1 -0
- package/components/ActionsGroup/slots/ActionsGroupEnum.d.ts +8 -0
- package/components/ActionsGroup/slots/ActionsGroupEnum.js +12 -0
- package/components/ActionsGroup/slots/ActionsGroupSlots.d.ts +15 -0
- package/components/ActionsGroup/slots/ActionsGroupSlots.js +35 -0
- package/components/ActionsGroup/subcomponents/ActionIconButton/ActionIconButton.d.ts +6 -0
- package/components/ActionsGroup/subcomponents/ActionIconButton/ActionIconButton.js +76 -0
- package/components/ActionsGroup/subcomponents/ActionIconButton/types.d.ts +7 -0
- package/components/ActionsGroup/types.d.ts +60 -0
- package/components/AppBar/slots/AppBarSlots.d.ts +1 -1
- package/components/CheckableList/CheckableList.d.ts +20 -0
- package/components/CheckableList/CheckableList.js +225 -0
- package/components/CheckableList/CheckableList.styles.d.ts +2 -0
- package/components/CheckableList/CheckableList.styles.js +247 -0
- package/components/CheckableList/constants.d.ts +5 -0
- package/components/CheckableList/constants.js +17 -0
- package/components/CheckableList/dictionary.d.ts +14 -0
- package/components/CheckableList/dictionary.js +14 -0
- package/components/CheckableList/hooks/index.d.ts +6 -0
- package/components/CheckableList/hooks/useCheckableListHandlers.d.ts +21 -0
- package/components/CheckableList/hooks/useCheckableListHandlers.js +66 -0
- package/components/CheckableList/hooks/useCheckableListItems.d.ts +19 -0
- package/components/CheckableList/hooks/useCheckableListItems.js +79 -0
- package/components/CheckableList/hooks/useCheckableListRender.d.ts +52 -0
- package/components/CheckableList/hooks/useCheckableListRender.js +223 -0
- package/components/CheckableList/hooks/useCheckableListSelection.d.ts +19 -0
- package/components/CheckableList/hooks/useCheckableListSelection.js +69 -0
- package/components/CheckableList/hooks/useCheckableListState.d.ts +17 -0
- package/components/CheckableList/hooks/useCheckableListState.js +59 -0
- package/components/CheckableList/hooks/useCheckableListVirtualization.d.ts +14 -0
- package/components/CheckableList/hooks/useCheckableListVirtualization.js +42 -0
- package/components/CheckableList/icons.d.ts +5 -0
- package/components/CheckableList/icons.js +8 -0
- package/components/CheckableList/index.d.ts +3 -0
- package/components/CheckableList/slots/index.d.ts +2 -0
- package/components/CheckableList/slots/index.js +1 -0
- package/components/CheckableList/slots/slots.d.ts +26 -0
- package/components/CheckableList/slots/slots.js +30 -0
- package/components/CheckableList/slots/styled.d.ts +72 -0
- package/components/CheckableList/slots/styled.js +130 -0
- package/components/CheckableList/types.d.ts +277 -0
- package/components/Chip/slots/ChipSlots.d.ts +2 -2
- package/components/CommonActions/components/ActionCancel/slots/ActionsCancelSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionFormCancel/ActionFormCancel.js +1 -1
- package/components/CommonActions/components/ActionFormCancel/slots/ActionFormCancelSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionIntro/slots/ActionsIntroSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionsContainer/slots/ActionsContainerSlots.d.ts +1 -1
- package/components/ContainerFlow/ContainerFlow.js +1 -1
- package/components/DataGrid/DataGrid.js +9 -1
- package/components/DataGrid/Datagrid.styles.js +169 -72
- package/components/DataGrid/constants.d.ts +13 -0
- package/components/DataGrid/constants.js +11 -0
- package/components/DataGrid/contexts/DataGridContext/index.js +62 -275
- package/components/DataGrid/contexts/DataGridContext/types.d.ts +24 -23
- package/components/DataGrid/dictionary.d.ts +1 -0
- package/components/DataGrid/dictionary.js +2 -1
- package/components/DataGrid/formatters/ColumnColorFormatter/tests/ColumnColorFormatter.test.d.ts +1 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/tests/useColumnColor.test.d.ts +1 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/ImageFormatterCell.d.ts +13 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/ImageFormatterCell.js +33 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/constants.d.ts +6 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/constants.js +6 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/formatter.d.ts +8 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/formatter.js +25 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/index.js +1 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/tests/ColumnImageFormatter.test.d.ts +1 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/types.d.ts +44 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/types.js +1 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/useColumnImage.d.ts +9 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/useColumnImage.js +22 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/tests/ColumnTagsFormatter.test.d.ts +1 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/tests/useColumnTags.test.d.ts +1 -0
- package/components/DataGrid/formatters/index.d.ts +1 -0
- package/components/DataGrid/helpers/getAllViewModes/getAllViewModes.d.ts +19 -0
- package/components/DataGrid/helpers/getAllViewModes/getAllViewModes.js +6 -0
- package/components/DataGrid/helpers/getAllViewModes/getAllViewModes.test.d.ts +1 -0
- package/components/DataGrid/helpers/getAllViewModes/index.d.ts +1 -0
- package/components/DataGrid/helpers/getAllViewModes/index.js +1 -0
- package/components/DataGrid/helpers/getColumnsWidth/getColumnsWidth.d.ts +47 -0
- package/components/DataGrid/helpers/getColumnsWidth/getColumnsWidth.js +32 -0
- package/components/DataGrid/helpers/getColumnsWidth/getColumnsWidth.test.d.ts +1 -0
- package/components/DataGrid/helpers/getColumnsWidth/index.d.ts +1 -0
- package/components/DataGrid/helpers/getColumnsWidth/index.js +1 -0
- package/components/DataGrid/helpers/getIndexRowHeightVariant/getIndexRowHeightVariant.d.ts +24 -0
- package/components/DataGrid/helpers/getIndexRowHeightVariant/getIndexRowHeightVariant.js +12 -0
- package/components/DataGrid/helpers/getIndexRowHeightVariant/getIndexRowHeightVariant.test.d.ts +1 -0
- package/components/DataGrid/helpers/getIndexRowHeightVariant/index.d.ts +1 -0
- package/components/DataGrid/helpers/getIndexRowHeightVariant/index.js +1 -0
- package/components/DataGrid/helpers/getInitialColumnsConfig/getInitialColumnsConfig.d.ts +48 -0
- package/components/DataGrid/helpers/getInitialColumnsConfig/getInitialColumnsConfig.js +35 -0
- package/components/DataGrid/helpers/getInitialColumnsConfig/getInitialColumnsConfig.test.d.ts +1 -0
- package/components/DataGrid/helpers/getInitialColumnsConfig/index.d.ts +1 -0
- package/components/DataGrid/helpers/getInitialColumnsConfig/index.js +1 -0
- package/components/DataGrid/helpers/getViewMode/getViewMode.d.ts +41 -0
- package/components/DataGrid/helpers/getViewMode/getViewMode.js +19 -0
- package/components/DataGrid/helpers/getViewMode/getViewMode.test.d.ts +1 -0
- package/components/DataGrid/helpers/getViewMode/index.d.ts +1 -0
- package/components/DataGrid/helpers/getViewMode/index.js +1 -0
- package/components/DataGrid/helpers/getViewSpecificConfig/getViewSpecificConfig.d.ts +28 -0
- package/components/DataGrid/helpers/getViewSpecificConfig/getViewSpecificConfig.js +22 -0
- package/components/DataGrid/helpers/getViewSpecificConfig/getViewSpecificConfig.test.d.ts +1 -0
- package/components/DataGrid/helpers/getViewSpecificConfig/index.d.ts +1 -0
- package/components/DataGrid/helpers/getViewSpecificConfig/index.js +1 -0
- package/components/DataGrid/helpers/getViewSuffix/getViewSuffix.d.ts +24 -0
- package/components/DataGrid/helpers/getViewSuffix/getViewSuffix.js +9 -0
- package/components/DataGrid/helpers/getViewSuffix/getViewSuffix.test.d.ts +1 -0
- package/components/DataGrid/helpers/getViewSuffix/index.d.ts +1 -0
- package/components/DataGrid/helpers/getViewSuffix/index.js +1 -0
- package/components/DataGrid/helpers/index.d.ts +13 -0
- package/components/DataGrid/helpers/index.js +1 -0
- package/components/DataGrid/helpers/loadViewConfig/index.d.ts +1 -0
- package/components/DataGrid/helpers/loadViewConfig/index.js +1 -0
- package/components/DataGrid/helpers/loadViewConfig/loadViewConfig.d.ts +23 -0
- package/components/DataGrid/helpers/loadViewConfig/loadViewConfig.js +12 -0
- package/components/DataGrid/helpers/loadViewConfig/loadViewConfig.test.d.ts +1 -0
- package/components/DataGrid/helpers/saveColumnsWidth/index.d.ts +1 -0
- package/components/DataGrid/helpers/saveColumnsWidth/index.js +1 -0
- package/components/DataGrid/helpers/saveColumnsWidth/saveColumnsWidth.d.ts +52 -0
- package/components/DataGrid/helpers/saveColumnsWidth/saveColumnsWidth.js +18 -0
- package/components/DataGrid/helpers/saveColumnsWidth/saveColumnsWidth.test.d.ts +1 -0
- package/components/DataGrid/helpers/saveViewConfig/index.d.ts +1 -0
- package/components/DataGrid/helpers/saveViewConfig/index.js +1 -0
- package/components/DataGrid/helpers/saveViewConfig/saveViewConfig.d.ts +35 -0
- package/components/DataGrid/helpers/saveViewConfig/saveViewConfig.js +15 -0
- package/components/DataGrid/helpers/saveViewConfig/saveViewConfig.test.d.ts +1 -0
- package/components/DataGrid/helpers/saveViewMode/index.d.ts +1 -0
- package/components/DataGrid/helpers/saveViewMode/index.js +1 -0
- package/components/DataGrid/helpers/saveViewMode/saveViewMode.d.ts +33 -0
- package/components/DataGrid/helpers/saveViewMode/saveViewMode.js +13 -0
- package/components/DataGrid/helpers/saveViewMode/saveViewMode.test.d.ts +1 -0
- package/components/DataGrid/hooks/index.d.ts +6 -0
- package/components/DataGrid/hooks/index.js +1 -0
- package/components/DataGrid/hooks/useChangeColumnsConfig/index.d.ts +1 -0
- package/components/DataGrid/hooks/useChangeColumnsConfig/index.js +1 -0
- package/components/DataGrid/hooks/useChangeColumnsConfig/useChangeColumnsConfig.d.ts +9 -0
- package/components/DataGrid/hooks/useChangeColumnsConfig/useChangeColumnsConfig.js +27 -0
- package/components/DataGrid/hooks/useChangeColumnsConfig/useChangeColumnsConfig.test.d.ts +1 -0
- package/components/DataGrid/hooks/useChangeColumnsOrder/index.d.ts +1 -0
- package/components/DataGrid/hooks/useChangeColumnsOrder/index.js +1 -0
- package/components/DataGrid/hooks/useChangeColumnsOrder/useChangeColumnsOrder.d.ts +10 -0
- package/components/DataGrid/hooks/useChangeColumnsOrder/useChangeColumnsOrder.js +34 -0
- package/components/DataGrid/hooks/useChangeColumnsOrder/useChangeColumnsOrder.test.d.ts +1 -0
- package/components/DataGrid/hooks/useColumnsWidth/index.d.ts +1 -0
- package/components/DataGrid/hooks/useColumnsWidth/index.js +1 -0
- package/components/DataGrid/hooks/useColumnsWidth/useColumnsWidth.d.ts +11 -0
- package/components/DataGrid/hooks/useColumnsWidth/useColumnsWidth.js +29 -0
- package/components/DataGrid/hooks/useColumnsWidth/useColumnsWidth.test.d.ts +1 -0
- package/components/DataGrid/hooks/useModalCardDetail.d.ts +1 -1
- package/components/DataGrid/hooks/useModalCardDetail.js +6 -1
- package/components/DataGrid/hooks/useRowHeight/index.d.ts +1 -0
- package/components/DataGrid/hooks/useRowHeight/index.js +1 -0
- package/components/DataGrid/hooks/useRowHeight/useRowHeight.d.ts +28 -0
- package/components/DataGrid/hooks/useRowHeight/useRowHeight.js +51 -0
- package/components/DataGrid/hooks/useRowHeight/useRowHeight.test.d.ts +1 -0
- package/components/DataGrid/hooks/useViewConfig/index.d.ts +1 -0
- package/components/DataGrid/hooks/useViewConfig/index.js +1 -0
- package/components/DataGrid/hooks/useViewConfig/useViewConfig.d.ts +9 -0
- package/components/DataGrid/hooks/useViewConfig/useViewConfig.js +30 -0
- package/components/DataGrid/hooks/useViewConfig/useViewConfig.test.d.ts +1 -0
- package/components/DataGrid/hooks/useViewMode/index.d.ts +1 -0
- package/components/DataGrid/hooks/useViewMode/index.js +1 -0
- package/components/DataGrid/hooks/useViewMode/useViewMode.d.ts +31 -0
- package/components/DataGrid/hooks/useViewMode/useViewMode.js +44 -0
- package/components/DataGrid/hooks/useViewMode/useViewMode.test.d.ts +1 -0
- package/components/DataGrid/icons.d.ts +1 -0
- package/components/DataGrid/icons.js +2 -1
- package/components/DataGrid/index.d.ts +5 -4
- package/components/DataGrid/slots/DataGridEnum.d.ts +4 -1
- package/components/DataGrid/slots/DataGridEnum.js +3 -0
- package/components/DataGrid/slots/DataGridSlot.d.ts +3 -0
- package/components/DataGrid/slots/DataGridSlot.js +48 -33
- package/components/DataGrid/subcomponents/Cards/helpers/calculateCardHeight.d.ts +5 -4
- package/components/DataGrid/subcomponents/Cards/helpers/calculateCardHeight.js +4 -1
- package/components/DataGrid/subcomponents/Cards/helpers/scrollToCardElement.js +2 -2
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +1 -1
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +47 -5
- package/components/DataGrid/subcomponents/Cards/index.js +22 -6
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +57 -15
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +16 -8
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +2 -2
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +6 -1
- package/components/DataGrid/subcomponents/Cards/types.d.ts +16 -0
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +5 -2
- package/components/DataGrid/subcomponents/ControlNavigate/ControlNavigate.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/index.js +2 -2
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Density/index.js +0 -3
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/RowsCount/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.js +1 -1
- package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +6 -2
- package/components/DataGrid/subcomponents/Table/index.js +11 -2
- package/components/DataGrid/subcomponents/Table/subcomponents/ActionsColumn.js +0 -3
- package/components/DataGrid/subcomponents/Table/subcomponents/CheckboxFormatter.js +1 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/CustomIcons.js +39 -14
- package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioFormatter.d.ts +6 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioFormatter.js +12 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioSelectColumn.d.ts +64 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioSelectColumn.js +46 -0
- package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
- package/components/DataGrid/tests/helpers/types.d.ts +10 -0
- package/components/DataGrid/tests/table/subcomponents/RadioFormatter.test.d.ts +1 -0
- package/components/DataGrid/tests/table/subcomponents/RadioSelectColumn.test.d.ts +1 -0
- package/components/DataGrid/types.d.ts +49 -6
- package/components/DataGrid/types.helpers.d.ts +55 -0
- package/components/DataGrid/types.helpers.js +1 -0
- package/components/DataGrid/types.hooks.d.ts +81 -0
- package/components/DynamicFilter/DynamicFilter.styles.js +5 -2
- package/components/DynamicFilter/slots/dynamicFilterSlots.d.ts +2 -2
- package/components/DynamicFilter/store/DynamicFilterContext.js +11 -0
- package/components/DynamicFilter/store/DynamicFilterStore.js +9 -0
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/useDynamicFilterBase.d.ts +1 -1
- package/components/DynamicFilter/types.d.ts +4 -0
- package/components/DynamicSort/DynamicSort.styles.js +5 -2
- package/components/DynamicSort/slots/DynamicSortSlots.d.ts +2 -2
- package/components/DynamicSort/store/DynamicSortStore.js +6 -0
- package/components/DynamicSort/subcomponents/DynamicSortBase/useDynamicSortBase.d.ts +1 -1
- package/components/DynamicSort/subcomponents/PopoverMenuFields/PopoverMenuFields.js +3 -0
- package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +3 -0
- package/components/DynamicSort/types.d.ts +4 -0
- package/components/EditLabel/constants.d.ts +1 -1
- package/components/EditLabel/slots/EditLabelSlots.d.ts +4 -4
- package/components/GridLayout/styles.js +0 -1
- package/components/HelperError/slots/HelperErrorSlots.d.ts +1 -1
- package/components/ImageText/constants.d.ts +1 -1
- package/components/ImageText/slots/ImageTextSlots.d.ts +2 -2
- package/components/Label/index.d.ts +1 -1
- package/components/Label/slots/LabelSlots.d.ts +3 -3
- package/components/Label/types.d.ts +6 -0
- package/components/LanguagePopover/LanguagePopover.styles.js +13 -4
- package/components/LanguagePopover/slots/LanguagePopoverSlots.d.ts +1 -1
- package/components/LoadingError/slots/LoadingErrorSlots.d.ts +1 -1
- package/components/MFIsolationApp/slots/MFIsolationAppSlots.d.ts +2 -2
- package/components/MFLoader/styles.js +0 -1
- package/components/MenuActions/slots/MenuActionsSlots.d.ts +2 -2
- package/components/ModalDialog/ModalDialog.styles.js +8 -1
- package/components/ModalDialog/slots/ModalDialogSlots.d.ts +2 -2
- package/components/NumberInput/slots/NumberInputSlots.d.ts +2 -2
- package/components/ObjectLogs/slots/ObjectLogsSlots.d.ts +2 -2
- package/components/Pager/slots/PagerSlots.d.ts +3 -3
- package/components/PaperForm/slots/PaperFormSlots.d.ts +1 -1
- package/components/PrintingSystem/PrintingSystem.js +3 -1
- package/components/PrintingSystem/PrintingSystem.styles.js +179 -2
- package/components/SettingsLayout/slots/SettingsLayoutSlots.d.ts +3 -3
- package/components/SideBar/slots/SideBarSlots.d.ts +1 -1
- package/components/SideBar/subcomponents/SideBarMobile/index.js +0 -3
- package/components/Stepper/Stepper.styles.js +13 -8
- package/{helpers → components/Stepper/helpers}/getStepsAndValidationSchema/getStepsAndValidationSchema.d.ts +4 -4
- package/{helpers → components/Stepper/helpers}/getStepsAndValidationSchema/getStepsAndValidationSchema.js +6 -12
- package/components/Stepper/helpers/getStepsAndValidationSchema/index.js +1 -0
- package/{helpers → components/Stepper/helpers}/getStepsAndValidationSchema/types.d.ts +6 -3
- package/components/Stepper/helpers/getStepsAndValidationSchema/types.js +1 -0
- package/components/Stepper/hooks/useDynamicValidation/index.d.ts +2 -1
- package/components/Stepper/hooks/useDynamicValidation/index.js +31 -6
- package/components/Stepper/index.d.ts +1 -0
- package/components/Stepper/slots/StepperSlot.d.ts +4 -4
- package/components/TabsNavigator/slots/TabsNavigatorSlots.d.ts +12 -12
- package/components/ToastContainer/slots/toastContainerSlots.d.ts +4 -4
- package/components/WindowBase/WindowBase.styles.js +8 -0
- package/components/WindowBase/hooks/useDynamicMFParameters/index.d.ts +4 -4
- package/components/WindowBase/slots/WindowBaseSlots.d.ts +2 -2
- package/components/WindowBase/subcomponents/Header/useButtonActions.js +23 -13
- package/components/animate/variants/background.d.ts +9 -9
- package/components/animate/variants/bounce.d.ts +9 -9
- package/components/animate/variants/fade.d.ts +20 -20
- package/components/animate/variants/flip.d.ts +6 -6
- package/components/animate/variants/rotate.d.ts +3 -3
- package/components/animate/variants/scale.d.ts +6 -6
- package/components/animate/variants/slide.d.ts +16 -16
- package/components/animate/variants/transition.d.ts +3 -3
- package/components/animate/variants/zoom.d.ts +15 -15
- package/components/areas/components/AreasAdmin/slots/AreasAdminSlots.d.ts +3 -3
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/ChipMobile/ChipMobile.js +5 -0
- package/components/commercial/AppBarCommercial/styles.js +1 -3
- package/components/commercial/HamburgerMenu/styles.js +1 -3
- package/components/commercial/SectionCommercial/styles.d.ts +1 -1
- package/components/commercial/SectionCommercial/styles.js +1 -3
- package/components/commercial/TopBar/component/ConteinItem/subcomponets/NavItem/index.js +1 -3
- package/components/commercial/TopBar/style.js +1 -3
- package/components/extended/React-Resizable/Resizable/slots/ResizableSlots.d.ts +1 -1
- package/components/extended/React-Resizable/ResizableBox/slots/ResizableBoxSlots.d.ts +1 -1
- package/components/extended/React-resizable-panels/slots/SplitLayoutSlots.d.ts +6 -6
- package/components/formatters/BooleanFormatter/slots/BooleanFormatterSlots.d.ts +1 -1
- package/components/formatters/ConcatenatedFormatter/slots/ConcatenatedFormatterSlots.d.ts +1 -1
- package/components/formatters/DateFormatter/slots/DateFormatterSlots.d.ts +1 -1
- package/components/formatters/DistanceToNowFormatter/slots/DistanceToNowFormatterSlots.d.ts +1 -1
- package/components/formatters/ImageFormatter/ImageFormatter.d.ts +10 -0
- package/components/formatters/ImageFormatter/ImageFormatter.js +72 -0
- package/components/formatters/ImageFormatter/ImageFormatter.styles.d.ts +2 -0
- package/components/formatters/ImageFormatter/ImageFormatter.styles.js +42 -0
- package/components/formatters/ImageFormatter/constants.d.ts +5 -0
- package/components/formatters/ImageFormatter/constants.js +10 -0
- package/components/formatters/ImageFormatter/index.d.ts +2 -0
- package/components/formatters/ImageFormatter/index.js +1 -0
- package/components/formatters/ImageFormatter/slots/ImageFormatterEnum.d.ts +5 -0
- package/components/formatters/ImageFormatter/slots/ImageFormatterEnum.js +9 -0
- package/components/formatters/ImageFormatter/slots/ImageFormatterSlots.d.ts +9 -0
- package/components/formatters/ImageFormatter/slots/ImageFormatterSlots.js +23 -0
- package/components/formatters/ImageFormatter/tests/ImageFormatter.test.d.ts +1 -0
- package/components/formatters/ImageFormatter/types.d.ts +51 -0
- package/components/formatters/ImageFormatter/types.js +1 -0
- package/components/formatters/PeriodFormatter/slots/PeriodFormatterSlots.d.ts +1 -1
- package/components/formatters/PointsFormatter/slots/ointsFormatterSlots.d.ts +1 -1
- package/components/formatters/PriceFormatter/slots/PriceFormatterSlots.d.ts +1 -1
- package/components/formatters/UncertaintyFormatter/slots/UncertaintyFormatterSlots.d.ts +1 -1
- package/components/formatters/index.d.ts +1 -0
- package/components/hook-form/RHFActionsGroup/RHFActionsGroup.d.ts +7 -0
- package/components/hook-form/RHFActionsGroup/RHFActionsGroup.js +87 -0
- package/components/hook-form/RHFActionsGroup/RHFActionsGroupStyles.d.ts +2 -0
- package/components/hook-form/RHFActionsGroup/RHFActionsGroupStyles.js +14 -0
- package/components/hook-form/RHFActionsGroup/constants.d.ts +9 -0
- package/components/hook-form/RHFActionsGroup/constants.js +8 -0
- package/components/hook-form/RHFActionsGroup/index.d.ts +2 -0
- package/components/hook-form/RHFActionsGroup/index.js +1 -0
- package/components/hook-form/RHFActionsGroup/slots/RHFActionsGroupEnum.d.ts +3 -0
- package/components/hook-form/RHFActionsGroup/slots/RHFActionsGroupEnum.js +7 -0
- package/components/hook-form/RHFActionsGroup/slots/RHFActionsGroupSlots.d.ts +1 -0
- package/components/hook-form/RHFActionsGroup/slots/RHFActionsGroupSlots.js +11 -0
- package/components/hook-form/RHFActionsGroup/slots/index.d.ts +2 -0
- package/components/hook-form/RHFActionsGroup/slots/index.js +1 -0
- package/components/hook-form/RHFActionsGroup/tests/RHFActionsGroup.test.d.ts +1 -0
- package/components/hook-form/RHFActionsGroup/tests/common.d.ts +28 -0
- package/components/hook-form/RHFActionsGroup/types.d.ts +54 -0
- package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +2 -2
- package/components/hook-form/RHFCheckableList/RHFCheckableList.d.ts +7 -0
- package/components/hook-form/RHFCheckableList/RHFCheckableList.js +91 -0
- package/components/hook-form/RHFCheckableList/RHFCheckableList.styles.d.ts +2 -0
- package/components/hook-form/RHFCheckableList/RHFCheckableList.styles.js +30 -0
- package/components/hook-form/RHFCheckableList/constants.d.ts +8 -0
- package/components/hook-form/RHFCheckableList/constants.js +11 -0
- package/components/hook-form/RHFCheckableList/index.d.ts +2 -0
- package/components/hook-form/RHFCheckableList/index.js +1 -0
- package/components/hook-form/RHFCheckableList/slots/RHFCheckableListEnum.d.ts +6 -0
- package/components/hook-form/RHFCheckableList/slots/RHFCheckableListEnum.js +10 -0
- package/components/hook-form/RHFCheckableList/slots/RHFCheckableListSlots.d.ts +20 -0
- package/components/hook-form/RHFCheckableList/slots/RHFCheckableListSlots.js +29 -0
- package/components/hook-form/RHFCheckableList/slots/index.d.ts +2 -0
- package/components/hook-form/RHFCheckableList/types.d.ts +60 -0
- package/components/hook-form/RHFCheckbox/RHFCheckbox.js +2 -2
- package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxSlots.d.ts +1 -1
- package/components/hook-form/RHFColorPicker/RFHColorPicker.js +2 -2
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/useColorPicker.d.ts +1 -1
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.d.ts +1 -1
- package/components/hook-form/RHFDatePicker/RHFDatePicker.js +2 -2
- package/components/hook-form/RHFDatePicker/slots/RHFDatePickerSlots.d.ts +3 -3
- package/components/hook-form/RHFDateTime/RHFDateTime.js +2 -2
- package/components/hook-form/RHFNumberInput/RHFNumberInput.js +2 -2
- package/components/hook-form/RHFPeriod/RHFPeriod.js +2 -2
- package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +1 -1
- package/components/hook-form/RHFPeriod/subcomponents/Period/Period.js +4 -4
- package/components/hook-form/RHFRadioGroup/RHFRadioGroup.d.ts +3 -3
- package/components/hook-form/RHFRadioGroup/RHFRadioGroup.js +66 -24
- package/components/hook-form/RHFRadioGroup/RHFRadioGroup.styles.d.ts +5 -0
- package/components/hook-form/RHFRadioGroup/RHFRadioGroup.styles.js +29 -0
- package/components/hook-form/RHFRadioGroup/constants.d.ts +5 -0
- package/components/hook-form/RHFRadioGroup/constants.js +8 -0
- package/components/hook-form/RHFRadioGroup/formatters/OptionIconLabelFormatter/index.d.ts +2 -2
- package/components/hook-form/RHFRadioGroup/slots/slots.d.ts +5 -0
- package/components/hook-form/RHFRadioGroup/slots/slots.js +9 -0
- package/components/hook-form/RHFRadioGroup/slots/styled.d.ts +9 -0
- package/components/hook-form/RHFRadioGroup/slots/styled.js +20 -0
- package/components/hook-form/RHFRadioGroup/types.d.ts +55 -11
- package/components/hook-form/RHFSelect/RHFSelect.js +2 -2
- package/components/hook-form/RHFSelect/constants.d.ts +1 -1
- package/components/hook-form/RHFSelect/slots/RHFSlots.d.ts +1 -1
- package/components/hook-form/RHFTextField/RHFTextField.js +2 -2
- package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +1 -1
- package/components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.js +2 -2
- package/components/hook-form/RHFTextFieldPassword/slots/RHFTextFieldPasswordSlots.d.ts +2 -2
- package/components/hook-form/RHFUpload/RHFUploadImage/RHFUploadImage.js +3 -1
- package/components/hook-form/RHFUpload/RHFUploadImage/slots/RHFUploadImageSlots.d.ts +3 -3
- package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/UploadImage.js +5 -4
- package/components/hook-form/RHFUpload/RHFUploadImage/types.d.ts +4 -0
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.js +6 -4
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/constants.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/slots/RHFUploadSingleFileSlots.d.ts +7 -7
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/subcomponents/Preview/Preview.js +3 -2
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/subcomponents/Preview/types.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/subcomponents/UploadSingleFile/index.js +13 -4
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/types.d.ts +4 -0
- package/components/hook-form/RHFormProvider/classes/index.d.ts +1 -1
- package/components/hook-form/RHFormProvider/styles.js +4 -3
- package/components/hook-form/index.d.ts +2 -0
- package/components/index.d.ts +2 -0
- package/components/mui_extended/Accordion/Accordion.js +3 -3
- package/components/mui_extended/Accordion/slots/AccordionSlots.d.ts +3 -3
- package/components/mui_extended/Accordion/styles.js +8 -5
- package/components/mui_extended/Autocomplete/Autocomplete.styles.js +11 -1
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +6 -6
- package/components/mui_extended/Avatar/slots/AvatarSlots.d.ts +1 -1
- package/components/mui_extended/Badge/slots/BadgeSlots.d.ts +1 -1
- package/components/mui_extended/Button/slots/ButtonSlots.d.ts +2 -2
- package/components/mui_extended/CheckBox/CheckBox.js +2 -0
- package/components/mui_extended/CheckBox/slots/CheckBoxSlots.d.ts +2 -2
- package/components/mui_extended/DatePicker/constants.d.ts +1 -1
- package/components/mui_extended/DatePicker/slots/DatePickerSlots.d.ts +3 -3
- package/components/mui_extended/DateTimePicker/DateTimePicker.styles.js +158 -129
- package/components/mui_extended/DateTimePicker/slots/DateTimePickerSlots.d.ts +4 -4
- package/components/mui_extended/Divider/slots/DividerSlots.d.ts +1 -1
- package/components/mui_extended/IconButton/constants.d.ts +1 -1
- package/components/mui_extended/IconButton/slots/IconButtonSlots.d.ts +1 -1
- package/components/mui_extended/ImageButton/styles.js +1 -3
- package/components/mui_extended/LoadingButton/slots/LoadingButtonSlots.d.ts +1 -1
- package/components/mui_extended/MenuDivider/slots/MenuDividerSlots.d.ts +1 -1
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +2 -2
- package/components/mui_extended/NavLink/slots/NavLinkSlots.d.ts +1 -1
- package/components/mui_extended/Popover/Popover.styles.js +6 -1
- package/components/mui_extended/Popper/slots/PopperStlots.d.ts +1 -1
- package/components/mui_extended/Radio/Radio.d.ts +20 -0
- package/components/mui_extended/Radio/Radio.js +111 -0
- package/components/mui_extended/Radio/Radio.styles.d.ts +2 -0
- package/components/mui_extended/Radio/Radio.styles.js +101 -0
- package/components/mui_extended/Radio/constants.d.ts +2 -0
- package/components/mui_extended/Radio/constants.js +8 -0
- package/components/mui_extended/Radio/icons.d.ts +4 -0
- package/components/mui_extended/Radio/icons.js +7 -0
- package/components/mui_extended/Radio/index.d.ts +1 -0
- package/components/mui_extended/Radio/index.js +1 -0
- package/components/mui_extended/Radio/slots/slots.d.ts +6 -0
- package/components/mui_extended/Radio/slots/slots.js +10 -0
- package/components/mui_extended/Radio/slots/styled.d.ts +14 -0
- package/components/mui_extended/Radio/slots/styled.js +28 -0
- package/components/mui_extended/Radio/tests/Radio.test.d.ts +1 -0
- package/components/mui_extended/Radio/types.d.ts +53 -0
- package/components/mui_extended/Select/Select.js +2 -18
- package/components/mui_extended/Select/Select.styles.js +33 -1
- package/components/mui_extended/Select/constants.d.ts +2 -1
- package/components/mui_extended/Select/slots/SelectEnum.d.ts +2 -1
- package/components/mui_extended/Select/slots/SelectEnum.js +1 -0
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +5 -5
- package/components/mui_extended/Skeleton/Slots/skeletonSlots.d.ts +1 -1
- package/components/mui_extended/Stack/Stack.d.ts +1 -1
- package/components/mui_extended/Stack/Stack.js +5 -2
- package/components/mui_extended/Stack/slots/StackSlot.d.ts +1 -1
- package/components/mui_extended/Tab/Slots/TabSlots.d.ts +2 -2
- package/components/mui_extended/TabContent/TabContent.styles.js +2 -2
- package/components/mui_extended/Tabs/Tabs.js +48 -2
- package/components/mui_extended/Tabs/Tabs.styles.js +52 -26
- package/components/mui_extended/Tabs/icons.d.ts +4 -0
- package/components/mui_extended/Tabs/icons.js +7 -0
- package/components/mui_extended/Tabs/slots/TabsSlots.d.ts +1 -1
- package/components/mui_extended/Tabs/types.d.ts +4 -1
- package/components/mui_extended/TextField/TextField.styles.js +2 -1
- package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +4 -4
- package/components/mui_extended/TimePicker/slots/TimePickerSlots.d.ts +3 -3
- package/components/mui_extended/ToggleButton/slots/ToggleButtonSlots.d.ts +1 -1
- package/components/mui_extended/ToggleIconButton/slots/ToggleIconButtonSlots.d.ts +1 -1
- package/components/mui_extended/Tooltip/Tooltip.styles.js +22 -4
- package/components/mui_extended/Tooltip/constants.d.ts +1 -1
- package/components/mui_extended/Typography/slots/typographySlots.d.ts +1 -1
- package/components/mui_extended/index.d.ts +1 -0
- package/hooks/useDataGridPersistence/constants.d.ts +2 -0
- package/hooks/useDataGridPersistence/constants.js +6 -2
- package/hooks/useDataGridPersistence/helpers.d.ts +5 -1
- package/hooks/useDataGridPersistence/helpers.js +8 -1
- package/hooks/useDataGridPersistence/useDataGridPersistence.d.ts +11 -3
- package/hooks/useDataGridPersistence/useDataGridPersistence.js +65 -20
- package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortEnum.d.ts +2 -1
- package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortEnum.js +1 -0
- package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortSlots.d.ts +6 -3
- package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortSlots.js +6 -0
- package/hooks/useDynamicFilterAndSort/styles.js +23 -0
- package/hooks/useDynamicFilterAndSort/types.d.ts +2 -0
- package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +27 -21
- package/index.d.ts +0 -1
- package/index.js +258 -240
- package/package.json +1 -1
- package/components/DataGrid/formatters/ColumnIconFormatter/constants.d.ts +0 -4
- package/components/hook-form/RHFRadioGroup/formatters/OptionIconLabelFormatter/index.js +0 -16
- package/helpers/index.d.ts +0 -1
- /package/{helpers/getStepsAndValidationSchema → components/ActionsGroup}/index.js +0 -0
- /package/{helpers → components/CheckableList/hooks}/index.js +0 -0
- /package/{helpers/getStepsAndValidationSchema/types.js → components/CheckableList/index.js} +0 -0
- /package/{helpers → components/Stepper/helpers}/getStepsAndValidationSchema/index.d.ts +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Maybe } from '@m4l/core';
|
|
2
|
+
import { RowKey, OnChangeConfig } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Persiste la configuración de anchos de las columnas del DataGrid.
|
|
5
|
+
*
|
|
6
|
+
* ## Flujo de persistencia
|
|
7
|
+
*
|
|
8
|
+
* Esta función guarda los anchos de columnas siguiendo esta lógica:
|
|
9
|
+
*
|
|
10
|
+
* 1. **onChangeConfig** (Cookies de red) - Método principal en producción
|
|
11
|
+
* Si está disponible, envía la configuración al callback para que el consumidor
|
|
12
|
+
* la persista en cookies de red. En la siguiente carga, estos datos volverán
|
|
13
|
+
* como `defaultConfig` en `getColumnsWidth`.
|
|
14
|
+
*
|
|
15
|
+
* 2. **localStorage** - Fallback local
|
|
16
|
+
* Solo se usa cuando NO hay callback configurado.
|
|
17
|
+
* Útil para desarrollo o cuando no hay integración con cookies de red.
|
|
18
|
+
*
|
|
19
|
+
* ## Ciclo completo de persistencia
|
|
20
|
+
*
|
|
21
|
+
* ```
|
|
22
|
+
* Usuario redimensiona columna
|
|
23
|
+
* ↓
|
|
24
|
+
* saveColumnsWidth() envía via onChangeConfig
|
|
25
|
+
* ↓
|
|
26
|
+
* Se persiste en cookies de red
|
|
27
|
+
* ↓
|
|
28
|
+
* Próxima carga: datos vienen en defaultConfig
|
|
29
|
+
* ↓
|
|
30
|
+
* getColumnsWidth() lee de defaultConfig
|
|
31
|
+
* ```
|
|
32
|
+
* @param id - Identificador único del DataGrid. Se usa como prefijo en localStorage (fallback)
|
|
33
|
+
* @param storeColumnsWidth - Map con la configuración de anchos donde:
|
|
34
|
+
* - key: identificador de la columna (column.key)
|
|
35
|
+
* - value: ancho en píxeles (number) o string con unidad CSS
|
|
36
|
+
* @param onChangeConfig - Callback para enviar la configuración a cookies de red.
|
|
37
|
+
* Recibe un objeto con:
|
|
38
|
+
* - reason: 'columnsWidths' (identificador del tipo de cambio)
|
|
39
|
+
* - userConfig: Record con los anchos de columnas
|
|
40
|
+
* @example
|
|
41
|
+
* // Producción: Guardar mediante callback a cookies de red
|
|
42
|
+
* saveColumnsWidth('my-grid', columnsWidthsMap, ({ reason, userConfig }) => {
|
|
43
|
+
* // Persistir en cookies de red
|
|
44
|
+
* setCookie(userConfig);
|
|
45
|
+
* });
|
|
46
|
+
* @example
|
|
47
|
+
* // Desarrollo: Guardar en localStorage (sin cookies de red)
|
|
48
|
+
* saveColumnsWidth('my-grid', columnsWidthsMap);
|
|
49
|
+
* @see getColumnsWidth - Función complementaria para obtener la configuración
|
|
50
|
+
* @see castMapColumnsWidthToRecord - Helper usado para convertir el Map a Record
|
|
51
|
+
*/
|
|
52
|
+
export declare function saveColumnsWidth(id: RowKey, storeColumnsWidth: Map<string, Maybe<string | number>>, onChangeConfig?: OnChangeConfig): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { c as castMapColumnsWidthToRecord } from "../castMapColumnsWidthToRecord.js";
|
|
2
|
+
function saveColumnsWidth(id, storeColumnsWidth, onChangeConfig) {
|
|
3
|
+
if (onChangeConfig) {
|
|
4
|
+
const columnsWidthObject = castMapColumnsWidthToRecord(storeColumnsWidth);
|
|
5
|
+
onChangeConfig({
|
|
6
|
+
reason: "columnsWidths",
|
|
7
|
+
userConfig: columnsWidthObject
|
|
8
|
+
});
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
localStorage.setItem(
|
|
12
|
+
`${id}_columns_width`,
|
|
13
|
+
JSON.stringify([...storeColumnsWidth])
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
saveColumnsWidth as s
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { saveViewConfig } from './saveViewConfig';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { RowKey } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Guarda configuraciones de vista en localStorage o notifica via callback.
|
|
4
|
+
*
|
|
5
|
+
* ## Propósito
|
|
6
|
+
*
|
|
7
|
+
* Persiste la configuración de columnas para una vista específica.
|
|
8
|
+
* Soporta dos modos: localStorage directo o callback externo (cookies de red).
|
|
9
|
+
*
|
|
10
|
+
* ## Prioridad de persistencia
|
|
11
|
+
*
|
|
12
|
+
* 1. Si hay `onChangeConfig`, notifica al callback (para guardar en cookies de red)
|
|
13
|
+
* 2. Si no hay callback, guarda directamente en localStorage
|
|
14
|
+
*
|
|
15
|
+
* ## Formato de key en localStorage
|
|
16
|
+
*
|
|
17
|
+
* ```
|
|
18
|
+
* table: `${id}_columns_config`
|
|
19
|
+
* cards: `${id}_columns_config_cards`
|
|
20
|
+
* ```
|
|
21
|
+
* @param id - Identificador único del DataGrid
|
|
22
|
+
* @param viewSuffix - Sufijo para identificar la vista ('' para table, '_cards' para cards)
|
|
23
|
+
* @param config - Array de configuración a guardar
|
|
24
|
+
* @param onChangeConfig - Callback opcional para notificar cambios (prioridad sobre localStorage)
|
|
25
|
+
* @example
|
|
26
|
+
* // Guardar en localStorage
|
|
27
|
+
* saveViewConfig('my-grid', '', config);
|
|
28
|
+
*
|
|
29
|
+
* // Notificar via callback
|
|
30
|
+
* saveViewConfig('my-grid', '_cards', config, onChangeConfig);
|
|
31
|
+
*/
|
|
32
|
+
export declare const saveViewConfig: <T>(id: RowKey, viewSuffix: string, config: T[], onChangeConfig?: (data: {
|
|
33
|
+
reason: string;
|
|
34
|
+
userConfig: T[];
|
|
35
|
+
}) => void) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const saveViewConfig = (id, viewSuffix, config, onChangeConfig) => {
|
|
2
|
+
if (onChangeConfig) {
|
|
3
|
+
const reason = viewSuffix === "" ? "columnsConfig" : `columnsConfig${viewSuffix.replace("_", "").charAt(0).toUpperCase()}${viewSuffix.replace("_", "").slice(1)}`;
|
|
4
|
+
onChangeConfig({
|
|
5
|
+
reason,
|
|
6
|
+
userConfig: config
|
|
7
|
+
});
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const storageKey = viewSuffix === "" ? `${id}_columns_config` : `${id}_columns_config${viewSuffix}`;
|
|
11
|
+
localStorage.setItem(storageKey, JSON.stringify(config));
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
saveViewConfig as s
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { saveViewMode } from './saveViewMode';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ViewMode } from '../../contexts/DataGridContext/types';
|
|
2
|
+
import { OnChangeConfig, RowKey } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Guarda el modo de visualización (table o cards).
|
|
5
|
+
*
|
|
6
|
+
* ## Propósito
|
|
7
|
+
*
|
|
8
|
+
* Persiste la preferencia del usuario sobre el modo de vista seleccionado.
|
|
9
|
+
* Permite que al recargar la página se mantenga la última vista utilizada.
|
|
10
|
+
*
|
|
11
|
+
* ## Prioridad de guardado
|
|
12
|
+
*
|
|
13
|
+
* 1. Si existe `onChangeConfig` → Guarda en cookies de red
|
|
14
|
+
* 2. Si no existe → Fallback a localStorage
|
|
15
|
+
*
|
|
16
|
+
* ## Formato de key en localStorage (fallback)
|
|
17
|
+
*
|
|
18
|
+
* ```
|
|
19
|
+
* `${id}_view_mode` -> 'table' | 'cards'
|
|
20
|
+
* ```
|
|
21
|
+
* @param id - Identificador único del DataGrid
|
|
22
|
+
* @param viewMode - Modo de visualización ('table' | 'cards')
|
|
23
|
+
* @param onChangeConfig - Callback opcional para guardar en cookies de red
|
|
24
|
+
* @example
|
|
25
|
+
* // Con cookies de red
|
|
26
|
+
* saveViewMode('my-grid', 'cards', onChangeConfig);
|
|
27
|
+
* // Llama: onChangeConfig({ reason: 'viewMode', userConfig: 'cards' })
|
|
28
|
+
*
|
|
29
|
+
* // Sin cookies de red (fallback)
|
|
30
|
+
* saveViewMode('my-grid', 'cards');
|
|
31
|
+
* // localStorage: 'my-grid_view_mode' = 'cards'
|
|
32
|
+
*/
|
|
33
|
+
export declare const saveViewMode: (id: RowKey, viewMode: ViewMode, onChangeConfig?: OnChangeConfig) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const saveViewMode = (id, viewMode, onChangeConfig) => {
|
|
2
|
+
if (onChangeConfig) {
|
|
3
|
+
onChangeConfig({
|
|
4
|
+
reason: "viewMode",
|
|
5
|
+
userConfig: viewMode
|
|
6
|
+
});
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
localStorage.setItem(`${id}_view_mode`, viewMode);
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
saveViewMode as s
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useChangeColumnsConfig } from './useChangeColumnsConfig';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UseChangeColumnsConfigParams, UseChangeColumnsConfigReturn } from '../../types.hooks';
|
|
2
|
+
/**
|
|
3
|
+
* Hook para manejar el cambio de configuración de columnas.
|
|
4
|
+
*
|
|
5
|
+
* Guarda la configuración en localStorage y actualiza el estado.
|
|
6
|
+
* @param params - Parámetros del hook
|
|
7
|
+
* @returns Función para cambiar la configuración de columnas
|
|
8
|
+
*/
|
|
9
|
+
export declare const useChangeColumnsConfig: ({ id, onChangeConfig, updateConfigColumns, }: UseChangeColumnsConfigParams) => UseChangeColumnsConfigReturn;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { s as saveViewConfig } from "../../helpers/saveViewConfig/saveViewConfig.js";
|
|
3
|
+
import { g as getViewSuffix } from "../../helpers/getViewSuffix/getViewSuffix.js";
|
|
4
|
+
const useChangeColumnsConfig = ({
|
|
5
|
+
id,
|
|
6
|
+
onChangeConfig,
|
|
7
|
+
updateConfigColumns
|
|
8
|
+
}) => {
|
|
9
|
+
const onChangeColumnsConfig = useCallback(
|
|
10
|
+
(viewModeParam, newConfig) => {
|
|
11
|
+
saveViewConfig(
|
|
12
|
+
id,
|
|
13
|
+
getViewSuffix(viewModeParam),
|
|
14
|
+
newConfig,
|
|
15
|
+
onChangeConfig
|
|
16
|
+
);
|
|
17
|
+
updateConfigColumns(viewModeParam, newConfig);
|
|
18
|
+
},
|
|
19
|
+
[id, onChangeConfig, updateConfigColumns]
|
|
20
|
+
);
|
|
21
|
+
return {
|
|
22
|
+
onChangeColumnsConfig
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
useChangeColumnsConfig as u
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useChangeColumnsOrder } from './useChangeColumnsOrder';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UseChangeColumnsOrderParams, UseChangeColumnsOrderReturn } from '../../types.hooks';
|
|
2
|
+
/**
|
|
3
|
+
* Hook para manejar el cambio de orden de columnas.
|
|
4
|
+
*
|
|
5
|
+
* Reordena las columnas y llama a onChangeColumnsConfig para persistir.
|
|
6
|
+
* @param getConfigColumns Función para obtener la configuración de columnas
|
|
7
|
+
* @param onChangeColumnsConfig Función para cambiar la configuración de columnas
|
|
8
|
+
* @returns Función para cambiar el orden de columnas
|
|
9
|
+
*/
|
|
10
|
+
export declare const useChangeColumnsOrder: ({ getConfigColumns, onChangeColumnsConfig, }: UseChangeColumnsOrderParams) => UseChangeColumnsOrderReturn;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
const useChangeColumnsOrder = ({
|
|
3
|
+
getConfigColumns,
|
|
4
|
+
onChangeColumnsConfig
|
|
5
|
+
}) => {
|
|
6
|
+
const onChangeColumnsOrder = useCallback(
|
|
7
|
+
(viewModeParam, sourceKey, targetKey) => {
|
|
8
|
+
if (sourceKey === targetKey) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const currentConfig = getConfigColumns(viewModeParam);
|
|
12
|
+
const sourceColumnIndex = currentConfig.findIndex(
|
|
13
|
+
(c) => c.key === sourceKey
|
|
14
|
+
);
|
|
15
|
+
const targetColumnIndex = currentConfig.findIndex(
|
|
16
|
+
(c) => c.key === targetKey
|
|
17
|
+
);
|
|
18
|
+
const reorderedConfig = [...currentConfig];
|
|
19
|
+
reorderedConfig.splice(
|
|
20
|
+
targetColumnIndex,
|
|
21
|
+
0,
|
|
22
|
+
reorderedConfig.splice(sourceColumnIndex, 1)[0]
|
|
23
|
+
);
|
|
24
|
+
onChangeColumnsConfig(viewModeParam, reorderedConfig);
|
|
25
|
+
},
|
|
26
|
+
[getConfigColumns, onChangeColumnsConfig]
|
|
27
|
+
);
|
|
28
|
+
return {
|
|
29
|
+
onChangeColumnsOrder
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
useChangeColumnsOrder as u
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useColumnsWidth } from './useColumnsWidth';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UseColumnsWidthParams, UseColumnsWidthReturn } from '../../types.hooks';
|
|
2
|
+
/**
|
|
3
|
+
* Hook para manejar el estado del ancho de las columnas del DataGrid.
|
|
4
|
+
*
|
|
5
|
+
* Maneja:
|
|
6
|
+
* - Estado del ancho de cada columna
|
|
7
|
+
* - Guardado con debounce de 500ms al cambiar el ancho
|
|
8
|
+
* @param params - Parámetros del hook
|
|
9
|
+
* @returns Estado y función para cambiar el ancho de columnas
|
|
10
|
+
*/
|
|
11
|
+
export declare const useColumnsWidth: ({ id, onChangeConfig, }: UseColumnsWidthParams) => UseColumnsWidthReturn;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useState, useRef, useCallback } from "react";
|
|
2
|
+
import { s as saveColumnsWidth } from "../../helpers/saveColumnsWidth/saveColumnsWidth.js";
|
|
3
|
+
const useColumnsWidth = ({
|
|
4
|
+
id,
|
|
5
|
+
onChangeConfig
|
|
6
|
+
}) => {
|
|
7
|
+
const [columnsWidths, setColumnsWidths] = useState(/* @__PURE__ */ new Map());
|
|
8
|
+
const timerRef = useRef(null);
|
|
9
|
+
const onChangeColumnWidth = useCallback(
|
|
10
|
+
(columnKey, width) => {
|
|
11
|
+
columnsWidths.set(columnKey, Math.round(width));
|
|
12
|
+
if (timerRef.current) {
|
|
13
|
+
clearTimeout(timerRef.current);
|
|
14
|
+
}
|
|
15
|
+
timerRef.current = setTimeout(() => {
|
|
16
|
+
saveColumnsWidth(id, columnsWidths, onChangeConfig);
|
|
17
|
+
}, 500);
|
|
18
|
+
},
|
|
19
|
+
[id, columnsWidths, onChangeConfig]
|
|
20
|
+
);
|
|
21
|
+
return {
|
|
22
|
+
columnsWidths,
|
|
23
|
+
setColumnsWidths,
|
|
24
|
+
onChangeColumnWidth
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
useColumnsWidth as u
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,4 +3,4 @@ import { UseModalDetailProps } from '../types';
|
|
|
3
3
|
* Hook que renderiza el modal de detalle para cualquier vista
|
|
4
4
|
* mostrando TODAS las columnas sin excepción
|
|
5
5
|
*/
|
|
6
|
-
export declare const useModalDetail: <TRow>({ columns, viewMode, onRowsChange, }: UseModalDetailProps<TRow>) => (row: TRow) => void;
|
|
6
|
+
export declare const useModalDetail: <TRow>({ columns, viewMode, onRowsChange, rows, }: UseModalDetailProps<TRow>) => (row: TRow) => void;
|
|
@@ -14,7 +14,8 @@ import { A as ActionCancel } from "../../CommonActions/components/ActionCancel/A
|
|
|
14
14
|
const useModalDetail = ({
|
|
15
15
|
columns,
|
|
16
16
|
viewMode,
|
|
17
|
-
onRowsChange
|
|
17
|
+
onRowsChange,
|
|
18
|
+
rows
|
|
18
19
|
}) => {
|
|
19
20
|
const { getConfigColumns, size } = useDataGrid();
|
|
20
21
|
const { openModal, closeModal } = useModal();
|
|
@@ -24,6 +25,7 @@ const useModalDetail = ({
|
|
|
24
25
|
const handleOpenDetail = useCallback(
|
|
25
26
|
(row) => {
|
|
26
27
|
const viewColumnsConfig = getConfigColumns(viewMode);
|
|
28
|
+
const rowIndex = rows.findIndex((r) => r === row);
|
|
27
29
|
openModal({
|
|
28
30
|
initialWidth: 500,
|
|
29
31
|
initialHeight: 680,
|
|
@@ -42,6 +44,8 @@ const useModalDetail = ({
|
|
|
42
44
|
CardDetails,
|
|
43
45
|
{
|
|
44
46
|
row,
|
|
47
|
+
rows,
|
|
48
|
+
rowIndex,
|
|
45
49
|
columns,
|
|
46
50
|
viewColumnsConfig,
|
|
47
51
|
onRowsChange,
|
|
@@ -56,6 +60,7 @@ const useModalDetail = ({
|
|
|
56
60
|
},
|
|
57
61
|
[
|
|
58
62
|
columns,
|
|
63
|
+
rows,
|
|
59
64
|
onRowsChange,
|
|
60
65
|
size,
|
|
61
66
|
getConfigColumns,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useRowHeight } from './useRowHeight';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { UseRowHeightParams, UseRowHeightReturn } from '../../types.hooks';
|
|
2
|
+
/**
|
|
3
|
+
* Hook para manejar el estado de la altura de las filas del DataGrid.
|
|
4
|
+
*
|
|
5
|
+
* Soporta dos modos:
|
|
6
|
+
* - **Modo fijo**: rowHeights y rowHeaderHeights son números fijos
|
|
7
|
+
* - **Modo variable**: rowHeights y rowHeaderHeights son arrays de 3 elementos [compact, standard, confortable]
|
|
8
|
+
* @param params - Parámetros del hook
|
|
9
|
+
* @returns Estado actual y función para cambiar el variant
|
|
10
|
+
* @throws Error si rowHeights y rowHeaderHeights no son del mismo tipo
|
|
11
|
+
* @throws Error si los arrays no tienen exactamente 3 elementos
|
|
12
|
+
* @throws Error si se intenta cambiar el variant en modo fijo
|
|
13
|
+
* @example
|
|
14
|
+
* // Modo variable (permite cambiar variant)
|
|
15
|
+
* const { currentRowHeightVariant, setRowHeightVariant } = useRowHeight({
|
|
16
|
+
* rowHeights: [32, 40, 48],
|
|
17
|
+
* rowHeaderHeights: [36, 44, 52],
|
|
18
|
+
* initialRowHeightVariant: 'standard',
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Modo fijo (altura constante)
|
|
22
|
+
* const { currentRowHeightVariant } = useRowHeight({
|
|
23
|
+
* rowHeights: 40,
|
|
24
|
+
* rowHeaderHeights: 44,
|
|
25
|
+
* initialRowHeightVariant: 'standard',
|
|
26
|
+
* });
|
|
27
|
+
*/
|
|
28
|
+
export declare const useRowHeight: ({ rowHeights, rowHeaderHeights, initialRowHeightVariant, }: UseRowHeightParams) => UseRowHeightReturn;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useState, useCallback } from "react";
|
|
2
|
+
import { g as getIndexRowHeightVariant } from "../../helpers/getIndexRowHeightVariant/getIndexRowHeightVariant.js";
|
|
3
|
+
const useRowHeight = ({
|
|
4
|
+
rowHeights,
|
|
5
|
+
rowHeaderHeights,
|
|
6
|
+
initialRowHeightVariant
|
|
7
|
+
}) => {
|
|
8
|
+
const [currentRowHeightVariant, setCurrentRowHeightVariant] = useState(() => {
|
|
9
|
+
if (typeof rowHeights !== typeof rowHeaderHeights) {
|
|
10
|
+
throw new Error("Must be same type rowheights and rowHeaderTypes");
|
|
11
|
+
}
|
|
12
|
+
if (typeof rowHeights === "number" && typeof rowHeaderHeights === "number") {
|
|
13
|
+
return {
|
|
14
|
+
rowHVariant: "compact",
|
|
15
|
+
rowHeight: rowHeights,
|
|
16
|
+
rowHeaderHeight: rowHeaderHeights
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (typeof rowHeights !== "number" && rowHeights.length !== 3) {
|
|
20
|
+
throw new Error("Must be 3 heights");
|
|
21
|
+
}
|
|
22
|
+
if (typeof rowHeaderHeights !== "number" && rowHeaderHeights.length !== 3) {
|
|
23
|
+
throw new Error("Must be 3 HeaderHeights");
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
rowHVariant: initialRowHeightVariant,
|
|
27
|
+
rowHeight: typeof rowHeights !== "number" ? rowHeights[getIndexRowHeightVariant(initialRowHeightVariant)] : rowHeights,
|
|
28
|
+
rowHeaderHeight: typeof rowHeaderHeights !== "number" ? rowHeaderHeights[getIndexRowHeightVariant(initialRowHeightVariant)] : rowHeaderHeights
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
const setRowHeightVariant = useCallback(
|
|
32
|
+
(newVariant) => {
|
|
33
|
+
if (typeof rowHeights === "number" || typeof rowHeaderHeights === "number") {
|
|
34
|
+
throw new Error("Only use setCurrentRowHeight with vector rowHeights");
|
|
35
|
+
}
|
|
36
|
+
setCurrentRowHeightVariant({
|
|
37
|
+
rowHVariant: newVariant,
|
|
38
|
+
rowHeight: rowHeights[getIndexRowHeightVariant(newVariant)],
|
|
39
|
+
rowHeaderHeight: rowHeaderHeights[getIndexRowHeightVariant(newVariant)]
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
[rowHeights, rowHeaderHeights]
|
|
43
|
+
);
|
|
44
|
+
return {
|
|
45
|
+
currentRowHeightVariant,
|
|
46
|
+
setRowHeightVariant
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
useRowHeight as u
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useViewConfig } from './useViewConfig';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UseViewConfigReturn } from '../../types.hooks';
|
|
2
|
+
/**
|
|
3
|
+
* Hook para manejar el estado de la configuración de columnas por vista.
|
|
4
|
+
*
|
|
5
|
+
* Maneja un estado genérico unificado para las configuraciones de TODAS las vistas
|
|
6
|
+
* (table, cards, etc).
|
|
7
|
+
* @returns Estado y funciones para manejar la configuración de vistas
|
|
8
|
+
*/
|
|
9
|
+
export declare const useViewConfig: () => UseViewConfigReturn;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useState, useCallback } from "react";
|
|
2
|
+
const useViewConfig = () => {
|
|
3
|
+
const [viewConfig, setViewConfig] = useState(() => ({
|
|
4
|
+
table: [],
|
|
5
|
+
cards: []
|
|
6
|
+
}));
|
|
7
|
+
const getConfigColumns = useCallback(
|
|
8
|
+
(viewModeParam) => {
|
|
9
|
+
return viewConfig[viewModeParam];
|
|
10
|
+
},
|
|
11
|
+
[viewConfig]
|
|
12
|
+
);
|
|
13
|
+
const updateConfigColumns = useCallback(
|
|
14
|
+
(viewModeParam, config) => {
|
|
15
|
+
setViewConfig((prev) => ({
|
|
16
|
+
...prev,
|
|
17
|
+
[viewModeParam]: config
|
|
18
|
+
}));
|
|
19
|
+
},
|
|
20
|
+
[]
|
|
21
|
+
);
|
|
22
|
+
return {
|
|
23
|
+
viewConfig,
|
|
24
|
+
getConfigColumns,
|
|
25
|
+
updateConfigColumns
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
useViewConfig as u
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useViewMode } from './useViewMode';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { UseViewModeParams, UseViewModeReturn } from '../../types.hooks';
|
|
2
|
+
/**
|
|
3
|
+
* Hook para manejar el estado del modo de visualización (table/cards).
|
|
4
|
+
*
|
|
5
|
+
* ## Inicialización del viewMode
|
|
6
|
+
*
|
|
7
|
+
* El viewMode se inicializa siguiendo esta jerarquía de precedencia:
|
|
8
|
+
* 1. viewMode prop (modo controlado)
|
|
9
|
+
* 2. localStorage (configuración guardada localmente)
|
|
10
|
+
* 3. defaultViewMode (valor por defecto del desarrollador)
|
|
11
|
+
* 4. Fallback según dispositivo (mobile: 'cards', desktop: 'table')
|
|
12
|
+
*
|
|
13
|
+
* ## Persistencia del viewMode
|
|
14
|
+
*
|
|
15
|
+
* - Si `onChangeConfig` está definido → Guarda en cookies de red
|
|
16
|
+
* - Si no está definido → Fallback a localStorage
|
|
17
|
+
*
|
|
18
|
+
* ## Modo controlado vs no controlado
|
|
19
|
+
*
|
|
20
|
+
* - **Controlado**: Cuando se pasa `viewMode` prop, el padre controla el estado
|
|
21
|
+
* - **No controlado**: El hook maneja internamente el estado y persiste
|
|
22
|
+
* @param id - Identificador único del DataGrid
|
|
23
|
+
* @param viewMode - ViewMode controlado por el padre (opcional)
|
|
24
|
+
* @param defaultViewMode - ViewMode por defecto cuando no hay valor guardado
|
|
25
|
+
* @param onViewModeChange - Callback cuando cambia el viewMode (opcional)
|
|
26
|
+
* @param onChangeConfig - Callback para guardar en cookies de red (opcional)
|
|
27
|
+
* @returns viewModeState - Estado actual del viewMode
|
|
28
|
+
* @returns setViewModeState - Función para establecer el viewMode
|
|
29
|
+
* @returns handleViewModeChange - Función para cambiar el viewMode y persistirlo
|
|
30
|
+
*/
|
|
31
|
+
export declare const useViewMode: ({ id, viewMode, defaultViewMode, onViewModeChange, onChangeConfig, }: UseViewModeParams) => UseViewModeReturn;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useState, useCallback, useEffect } from "react";
|
|
2
|
+
import { useIsMobile } from "@m4l/graphics";
|
|
3
|
+
import { g as getViewMode } from "../../helpers/getViewMode/getViewMode.js";
|
|
4
|
+
import { s as saveViewMode } from "../../helpers/saveViewMode/saveViewMode.js";
|
|
5
|
+
const useViewMode = ({
|
|
6
|
+
id,
|
|
7
|
+
viewMode,
|
|
8
|
+
defaultViewMode,
|
|
9
|
+
onViewModeChange,
|
|
10
|
+
onChangeConfig
|
|
11
|
+
}) => {
|
|
12
|
+
const isMobile = useIsMobile();
|
|
13
|
+
const [viewModeState, setViewModeState] = useState(() => {
|
|
14
|
+
if (viewMode) {
|
|
15
|
+
return viewMode;
|
|
16
|
+
}
|
|
17
|
+
const savedViewMode = getViewMode(id, null, defaultViewMode);
|
|
18
|
+
if (savedViewMode) {
|
|
19
|
+
return savedViewMode;
|
|
20
|
+
}
|
|
21
|
+
return isMobile ? "cards" : "table";
|
|
22
|
+
});
|
|
23
|
+
const handleViewModeChange = useCallback(
|
|
24
|
+
(newViewMode) => {
|
|
25
|
+
setViewModeState(newViewMode);
|
|
26
|
+
saveViewMode(id, newViewMode, onChangeConfig);
|
|
27
|
+
onViewModeChange?.(newViewMode);
|
|
28
|
+
},
|
|
29
|
+
[id, onViewModeChange, onChangeConfig]
|
|
30
|
+
);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (viewMode !== void 0) {
|
|
33
|
+
setViewModeState(viewMode);
|
|
34
|
+
}
|
|
35
|
+
}, [viewMode]);
|
|
36
|
+
return {
|
|
37
|
+
viewModeState,
|
|
38
|
+
setViewModeState,
|
|
39
|
+
handleViewModeChange
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
useViewMode as u
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|