@m4l/components 9.4.12 → 9.4.14
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/components/AccountPopover/slots/AccountPopoverSlots.d.ts +6 -6
- package/components/ActionsGroup/slots/ActionsGroupSlots.d.ts +2 -2
- package/components/AppBar/slots/AppBarSlots.d.ts +1 -1
- package/components/Card/constants.d.ts +1 -1
- package/components/CheckableList/slots/styled.d.ts +9 -9
- 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/slots/ActionFormCancelSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/slots/ActionFormSubmitProgrammaticSlots.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/DynamicFilter/slots/dynamicFilterSlots.d.ts +2 -2
- package/components/DynamicSort/slots/DynamicSortSlots.d.ts +2 -2
- package/components/EditLabel/slots/EditLabelSlots.d.ts +4 -4
- package/components/GridLayout/classes/index.d.ts +1 -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/slots/LabelSlots.d.ts +3 -3
- 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/MenuActions/constants.d.ts +1 -1
- package/components/MenuActions/slots/MenuActionsSlots.d.ts +2 -2
- package/components/ModalDialog/slots/ModalDialogSlots.d.ts +2 -2
- package/components/NumberInput/hooks/useNumberInput/useNumberInput.js +0 -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/SettingsLayout/SettingsLayout.js +4 -3
- package/components/SettingsLayout/constants.d.ts +1 -0
- package/components/SettingsLayout/constants.js +5 -3
- package/components/SettingsLayout/slots/SettingsLayoutSlots.d.ts +3 -3
- package/components/SettingsLayout/slots/SettingsLayoutSlots.js +1 -1
- package/components/SettingsLayout/subcomponents/SettingsLayoutBase/SettingsLayoutBase.js +1 -1
- package/components/SettingsLayout/types.d.ts +4 -0
- package/components/SideBar/slots/SideBarSlots.d.ts +1 -1
- package/components/Stepper/slots/StepperSlot.d.ts +4 -4
- package/components/TabsNavigator/slots/TabsNavigatorSlots.d.ts +2 -2
- package/components/ToastContainer/slots/toastContainerSlots.d.ts +4 -4
- package/components/WindowBase/slots/WindowBaseSlots.d.ts +2 -2
- package/components/areas/components/AreasAdmin/slots/AreasAdminSlots.d.ts +3 -3
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.d.ts +1 -1
- package/components/datagrids/Datagrid.styles.js +24 -0
- package/components/datagrids/components/BaseDataGrid/BaseDataGrid.d.ts +12 -0
- package/components/datagrids/components/BaseDataGrid/BaseDataGrid.js +131 -0
- package/components/datagrids/components/BaseDataGrid/index.d.ts +1 -0
- package/components/datagrids/components/BaseDataGrid/index.js +1 -0
- package/components/datagrids/components/DataGridMain/DataGridMain.js +22 -134
- package/components/datagrids/components/TreeDataGrid/TreeDataGrid.d.ts +22 -0
- package/components/datagrids/components/TreeDataGrid/TreeDataGrid.js +50 -0
- package/components/datagrids/components/TreeDataGrid/TreeDataGrid.test.d.ts +1 -0
- package/components/datagrids/components/TreeDataGrid/index.d.ts +1 -0
- package/components/datagrids/components/TreeDataGrid/index.js +1 -0
- package/components/datagrids/constants.js +3 -5
- package/components/datagrids/contexts/DataGridContext/DataGridContext.js +8 -4
- package/components/datagrids/contexts/DataGridContext/types.d.ts +19 -3
- package/components/datagrids/dictionary.d.ts +3 -0
- package/components/datagrids/dictionary.js +4 -0
- package/components/datagrids/formatters/ColumnBooleanFormatter/ColumnBooleanGroupFormatter.d.ts +15 -0
- package/components/datagrids/formatters/ColumnBooleanFormatter/ColumnBooleanGroupFormatter.js +32 -0
- package/components/datagrids/formatters/ColumnBooleanFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnBooleanFormatter/useColumnBoolean.d.ts +1 -0
- package/components/datagrids/formatters/ColumnBooleanFormatter/useColumnBoolean.js +2 -0
- package/components/datagrids/formatters/ColumnChipStatusFormatter/ColumnChipStatusGroupFormatter.d.ts +16 -0
- package/components/datagrids/formatters/ColumnChipStatusFormatter/ColumnChipStatusGroupFormatter.js +37 -0
- package/components/datagrids/formatters/ColumnChipStatusFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnChipStatusFormatter/useColumnChipStatus.d.ts +1 -0
- package/components/datagrids/formatters/ColumnChipStatusFormatter/useColumnChipStatus.js +2 -0
- package/components/datagrids/formatters/ColumnColorFormatter/ColumnColorGroupFormatter.d.ts +14 -0
- package/components/datagrids/formatters/ColumnColorFormatter/ColumnColorGroupFormatter.js +24 -0
- package/components/datagrids/formatters/ColumnColorFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnColorFormatter/useColumnColor.d.ts +1 -0
- package/components/datagrids/formatters/ColumnColorFormatter/useColumnColor.js +3 -1
- package/components/datagrids/formatters/ColumnConcatenatedValuesFormatter/ColumnConcatenatedValuesGroupFormatter.d.ts +15 -0
- package/components/datagrids/formatters/ColumnConcatenatedValuesFormatter/ColumnConcatenatedValuesGroupFormatter.js +35 -0
- package/components/datagrids/formatters/ColumnConcatenatedValuesFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnConcatenatedValuesFormatter/useColumnConcatenatedValues.d.ts +1 -0
- package/components/datagrids/formatters/ColumnConcatenatedValuesFormatter/useColumnConcatenatedValues.js +2 -0
- package/components/datagrids/formatters/ColumnDateFormatter/ColumnDateGroupFormatter.d.ts +9 -0
- package/components/datagrids/formatters/ColumnDateFormatter/ColumnDateGroupFormatter.js +35 -0
- package/components/datagrids/formatters/ColumnDateFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnDateFormatter/useColumnDate.d.ts +1 -0
- package/components/datagrids/formatters/ColumnDateFormatter/useColumnDate.js +2 -0
- package/components/datagrids/formatters/ColumnIconFormatter/ColumnIconGroupFormatter.d.ts +13 -0
- package/components/datagrids/formatters/ColumnIconFormatter/ColumnIconGroupFormatter.js +17 -0
- package/components/datagrids/formatters/ColumnIconFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnIconFormatter/useColumnIcon.d.ts +1 -0
- package/components/datagrids/formatters/ColumnIconFormatter/useColumnIcon.js +3 -1
- package/components/datagrids/formatters/ColumnImageFormatter/ColumnImageGroupFormatter.d.ts +15 -0
- package/components/datagrids/formatters/ColumnImageFormatter/ColumnImageGroupFormatter.js +33 -0
- package/components/datagrids/formatters/ColumnImageFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnImageFormatter/useColumnImage.d.ts +1 -0
- package/components/datagrids/formatters/ColumnImageFormatter/useColumnImage.js +3 -1
- package/components/datagrids/formatters/ColumnInteractiveCheckFormatter/formatter.d.ts +12 -1
- package/components/datagrids/formatters/ColumnInteractiveCheckFormatter/formatter.js +6 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/ColumnNestedValueGroupFormatter.d.ts +14 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/ColumnNestedValueGroupFormatter.js +22 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/useColumnNestedValue.d.ts +1 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/useColumnNestedValue.js +2 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/ColumnPointsGroupFormatter.d.ts +15 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/ColumnPointsGroupFormatter.js +28 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/useColumnPoints.d.ts +1 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/useColumnPoints.js +2 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/ColumnPriceGroupFormatter.d.ts +14 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/ColumnPriceGroupFormatter.js +26 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/useColumnPrice.d.ts +1 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/useColumnPrice.js +2 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/ColumnTagsGroupFormatter.d.ts +13 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/ColumnTagsGroupFormatter.js +21 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/useColumnTags.d.ts +1 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/useColumnTags.js +2 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/ColumnUncertaintyGroupFormatter.d.ts +15 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/ColumnUncertaintyGroupFormatter.js +27 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.d.ts +1 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.js +2 -0
- package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.js +8 -0
- package/components/datagrids/helpers/shared/getViewSpecificConfig/getViewSpecificConfig.js +10 -3
- package/components/datagrids/hooks/useChangeColumnsOrder/useChangeColumnsOrder.d.ts +1 -0
- package/components/datagrids/hooks/useChangeColumnsOrder/useChangeColumnsOrder.js +12 -4
- package/components/datagrids/icons.d.ts +5 -0
- package/components/datagrids/icons.js +5 -1
- package/components/datagrids/index.d.ts +2 -1
- package/components/datagrids/slots/DataGridEnum.d.ts +3 -1
- package/components/datagrids/slots/DataGridEnum.js +2 -0
- package/components/datagrids/slots/DataGridSlot.d.ts +2 -0
- package/components/datagrids/slots/DataGridSlot.js +12 -2
- package/components/datagrids/types.d.ts +52 -0
- package/components/datagrids/views/CardsView/hooks/useProcessedColumns/useProcessedColumns.d.ts +2 -0
- package/components/datagrids/views/CardsView/hooks/useProcessedColumns/useProcessedColumns.js +3 -2
- package/components/datagrids/views/TableView/TableView.d.ts +4 -4
- package/components/datagrids/views/TableView/TableView.js +41 -3
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/defaultRowGrouper.d.ts +28 -0
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/defaultRowGrouper.js +15 -0
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/defaultRowGrouper.test.d.ts +1 -0
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/index.d.ts +1 -0
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/index.js +1 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/getGroupBy.d.ts +20 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/getGroupBy.js +13 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/getGroupBy.test.d.ts +1 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/index.d.ts +1 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/index.js +1 -0
- package/components/datagrids/views/TableView/helpers/index.d.ts +2 -0
- package/components/datagrids/views/TableView/hooks/useHeaderMenuActions/useHeaderMenuActions.js +62 -1
- package/components/datagrids/views/TableView/hooks/useSortColumnsRows/useSortColumnsRows.js +39 -13
- package/components/datagrids/views/TableView/subcomponents/ActionsColumn/ActionsColumn.js +1 -1
- package/components/datagrids/views/TableView/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
- package/components/datagrids/views/TableView/subcomponents/RadioSelectColumn/RadioSelectColumn.js +2 -2
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/RenderGroupCell.d.ts +10 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/RenderGroupCell.js +35 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/RenderGroupCell.test.d.ts +1 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/index.d.ts +2 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/index.js +1 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/types.d.ts +12 -0
- package/components/datagrids/views/TableView/subcomponents/SelectColumn/SelectColumn.js +46 -14
- package/components/datagrids/views/TableView/subcomponents/Settings/hooks/useModalSettings/useModalSettings.js +13 -2
- package/components/datagrids/views/TableView/subcomponents/Settings/subcomponents/ColumnsConfig/ColumnsConfig.js +47 -13
- package/components/datagrids/views/TableView/subcomponents/Settings/subcomponents/ColumnsConfig/types.d.ts +22 -0
- package/components/datagrids/views/adapters/CheckboxCellAdapter/CheckboxCellAdapter.js +1 -1
- 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/slots/ImageFormatterSlots.d.ts +1 -1
- 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/hook-form/RHFAutocompleteAsync/reducer/RHFAutocompleteReducer.js +0 -5
- package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxSlots.d.ts +1 -1
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.d.ts +1 -1
- package/components/hook-form/RHFDatePicker/slots/RHFDatePickerSlots.d.ts +3 -3
- package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +1 -1
- 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/slots/RHFTextFieldSlots.d.ts +1 -1
- package/components/hook-form/RHFTextFieldPassword/slots/RHFTextFieldPasswordSlots.d.ts +2 -2
- package/components/hook-form/RHFUpload/RHFUploadImage/slots/RHFUploadImageSlots.d.ts +3 -3
- 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/RHFormProvider/classes/index.d.ts +1 -1
- package/components/mui_extended/Accordion/slots/AccordionSlots.d.ts +3 -3
- 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/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/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/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/Popper/slots/PopperStlots.d.ts +1 -1
- package/components/mui_extended/Radio/slots/styled.d.ts +2 -2
- package/components/mui_extended/Select/constants.d.ts +1 -1
- 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/slots/StackSlot.d.ts +1 -1
- package/components/mui_extended/Tab/Slots/TabSlots.d.ts +2 -2
- package/components/mui_extended/Tabs/slots/TabsSlots.d.ts +1 -1
- package/components/mui_extended/TextField/constants.d.ts +1 -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/Typography/slots/typographySlots.d.ts +1 -1
- package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortSlots.d.ts +4 -4
- package/index.js +108 -82
- package/not_recognized/index.js +25 -100
- package/package.json +1 -1
- package/test/mocks.d.ts +2 -2
|
@@ -20,6 +20,7 @@ export declare const pathIcons: {
|
|
|
20
20
|
freezeColumn: string;
|
|
21
21
|
unfreezeColumn: string;
|
|
22
22
|
hideColumn: string;
|
|
23
|
+
groupColumn: string;
|
|
23
24
|
viewTable: string;
|
|
24
25
|
viewCards: string;
|
|
25
26
|
info: string;
|
|
@@ -28,4 +29,8 @@ export declare const pathIcons: {
|
|
|
28
29
|
smartphone: string;
|
|
29
30
|
internet: string;
|
|
30
31
|
edit: string;
|
|
32
|
+
group: string;
|
|
33
|
+
removeGroup: string;
|
|
34
|
+
groupUp: string;
|
|
35
|
+
groupDown: string;
|
|
31
36
|
};
|
|
@@ -24,7 +24,11 @@ const pathIcons = {
|
|
|
24
24
|
viewCards: "frontend/components/data_grid/assets/icons/card.svg",
|
|
25
25
|
info: "frontend/components/data_grid/assets/icons/info.svg",
|
|
26
26
|
expanded: "frontend/components/data_grid/assets/icons/expanded.svg",
|
|
27
|
-
edit: "frontend/components/EditLabel/assets/icons/pencil.svg"
|
|
27
|
+
edit: "frontend/components/EditLabel/assets/icons/pencil.svg",
|
|
28
|
+
group: "frontend/components/data_grid/assets/icons/group.svg",
|
|
29
|
+
removeGroup: "frontend/components/data_grid/assets/icons/remove_group.svg",
|
|
30
|
+
groupUp: "frontend/components/data_grid/assets/icons/group_up.svg",
|
|
31
|
+
groupDown: "frontend/components/data_grid/assets/icons/group_down.svg"
|
|
28
32
|
};
|
|
29
33
|
export {
|
|
30
34
|
pathIcons as p
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { DataGrid } from './components/DataGridMain';
|
|
2
|
+
export { TreeDataGrid } from './components/TreeDataGrid';
|
|
2
3
|
export * from './formatters';
|
|
3
4
|
export type { Column, RenderEditCellProps, RenderCellProps, } from 'react-data-grid';
|
|
4
|
-
export type { RowKey, ChangeConfig, ChangeUserColumn, RowActionsGetter, RowKeyGetter, } from './types';
|
|
5
|
+
export type { RowKey, ChangeConfig, ChangeUserColumn, RowActionsGetter, RowKeyGetter, TreeProps, TreeDataGridProps, } from './types';
|
|
5
6
|
export type { IGridConfigExtended, BaseConfigColumn, } from './contexts/DataGridContext/types';
|
|
6
7
|
export type { IGridConfig } from './helpers/persistence/getColumnsWidth/types';
|
|
7
8
|
export { getDataGridComponentsDictionary } from './dictionary';
|
|
@@ -53,7 +53,9 @@ export declare enum TableSlots {
|
|
|
53
53
|
editorCellWrapper = "editorCellWrapper",
|
|
54
54
|
editablePlaceholder = "editablePlaceholder",
|
|
55
55
|
editLabel = "editLabel",
|
|
56
|
-
iconButtonEdit = "iconButtonEdit"
|
|
56
|
+
iconButtonEdit = "iconButtonEdit",
|
|
57
|
+
defaultRenderGroupCellRoot = "defaultRenderGroupCellRoot",
|
|
58
|
+
defaultRenderGroupCellText = "defaultRenderGroupCellText"
|
|
57
59
|
}
|
|
58
60
|
export declare enum TextEditorSlots {
|
|
59
61
|
inputTexEditor = "inputTexEditor"
|
|
@@ -57,6 +57,8 @@ var TableSlots = /* @__PURE__ */ ((TableSlots2) => {
|
|
|
57
57
|
TableSlots2["editablePlaceholder"] = "editablePlaceholder";
|
|
58
58
|
TableSlots2["editLabel"] = "editLabel";
|
|
59
59
|
TableSlots2["iconButtonEdit"] = "iconButtonEdit";
|
|
60
|
+
TableSlots2["defaultRenderGroupCellRoot"] = "defaultRenderGroupCellRoot";
|
|
61
|
+
TableSlots2["defaultRenderGroupCellText"] = "defaultRenderGroupCellText";
|
|
60
62
|
return TableSlots2;
|
|
61
63
|
})(TableSlots || {});
|
|
62
64
|
var TextEditorSlots = /* @__PURE__ */ ((TextEditorSlots2) => {
|
|
@@ -97,3 +97,5 @@ export declare const ControlNavigateStyled: import('@emotion/styled').StyledComp
|
|
|
97
97
|
* ****************
|
|
98
98
|
*/
|
|
99
99
|
export declare const ColumnIconFormatterStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
100
|
+
export declare const DefaultRenderGroupCellRootStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof import('react').ClassAttributes<HTMLSpanElement> | keyof import('react').HTMLAttributes<HTMLSpanElement>>, {}>;
|
|
101
|
+
export declare const DefaultRenderGroupCellTextStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof import('react').ClassAttributes<HTMLSpanElement> | keyof import('react').HTMLAttributes<HTMLSpanElement>>, {}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styled } from "@mui/material/styles";
|
|
2
2
|
import { MenuList, InputBase } from "@mui/material";
|
|
3
3
|
import { D as DATAGRID_PREFIX_NAME } from "../constants.js";
|
|
4
|
-
import { D as DataGridSlots,
|
|
4
|
+
import { T as TextEditorSlots, D as DataGridSlots, b as TableSlots, A as ActionsSlots, C as ControlNavigateSlots, R as RowsCountSlots, a as ColumnsConfigSlots, c as ColumnIconFormatterSlots } from "./DataGridEnum.js";
|
|
5
5
|
import { d as dataGridStyles } from "../Datagrid.styles.js";
|
|
6
6
|
import { I as Icon } from "../../Icon/Icon.js";
|
|
7
7
|
import { C as Card } from "../../Card/Card.js";
|
|
@@ -231,6 +231,14 @@ styled("div", {
|
|
|
231
231
|
name: DATAGRID_PREFIX_NAME,
|
|
232
232
|
slot: ColumnIconFormatterSlots.columnIconFormatter
|
|
233
233
|
})(dataGridStyles.columnIconFormatter);
|
|
234
|
+
const DefaultRenderGroupCellRootStyled = styled("span", {
|
|
235
|
+
name: DATAGRID_PREFIX_NAME,
|
|
236
|
+
slot: TableSlots.defaultRenderGroupCellRoot
|
|
237
|
+
})(dataGridStyles.defaultRenderGroupCellRoot);
|
|
238
|
+
const DefaultRenderGroupCellTextStyled = styled("span", {
|
|
239
|
+
name: DATAGRID_PREFIX_NAME,
|
|
240
|
+
slot: TableSlots.defaultRenderGroupCellText
|
|
241
|
+
})(dataGridStyles.defaultRenderGroupCellText);
|
|
234
242
|
export {
|
|
235
243
|
ActionsRootStyled as A,
|
|
236
244
|
TableContainerStyled as B,
|
|
@@ -250,10 +258,12 @@ export {
|
|
|
250
258
|
MenuListStyled as P,
|
|
251
259
|
HeaderRenderClickStyled as Q,
|
|
252
260
|
RowsCountRootStyled as R,
|
|
253
|
-
|
|
261
|
+
DefaultRenderGroupCellRootStyled as S,
|
|
254
262
|
TextToggleCardButtonStyled as T,
|
|
263
|
+
DefaultRenderGroupCellTextStyled as U,
|
|
255
264
|
ValueColumnStyled as V,
|
|
256
265
|
WrapperSkeletonStyled as W,
|
|
266
|
+
CheckboxCellWrapperStyled as X,
|
|
257
267
|
ControlNavigateStyled as a,
|
|
258
268
|
RowsCountLabelStyled as b,
|
|
259
269
|
RowsCountValueStyled as c,
|
|
@@ -39,6 +39,18 @@ declare module 'react-data-grid' {
|
|
|
39
39
|
formatter?: (props: any) => JSX.Element;
|
|
40
40
|
/** @deprecated Usa renderEditCell en lugar de editor. Este atributo será removido en una futura versión. */
|
|
41
41
|
editor?: Maybe<(props: RenderEditCellProps<TRow, TSummaryRow>) => ReactNode>;
|
|
42
|
+
/**
|
|
43
|
+
* Si true, la columna puede ser agrupada/desagrupada por el usuario.
|
|
44
|
+
* Solo aplica para TreeDataGrid.
|
|
45
|
+
*/
|
|
46
|
+
groupable?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Si true, la columna está agrupada por defecto.
|
|
49
|
+
* - Con `groupable: true`: el usuario puede cambiar la agrupación.
|
|
50
|
+
* - Sin `groupable` o `groupable: false`: agrupación estática, no se puede cambiar.
|
|
51
|
+
* Solo aplica para TreeDataGrid.
|
|
52
|
+
*/
|
|
53
|
+
grouped?: boolean;
|
|
42
54
|
}
|
|
43
55
|
}
|
|
44
56
|
export declare type RowKey = string | number;
|
|
@@ -319,3 +331,43 @@ export type DataGridOwnerState<TRow, TSummaryRow, TKey extends RowKey = RowKey>
|
|
|
319
331
|
};
|
|
320
332
|
export type DataGridSlotsType = DataGridSlots | TextEditorSlots | ActionsSlots | RowsCountSlots | ColumnsConfigSlots | TableSlots | ControlNavigateSlots | ColumnIconFormatterSlots;
|
|
321
333
|
export type DataGridStyles = OverridesStyleRules<DataGridSlotsType, typeof DATAGRID_PREFIX_NAME, Theme>;
|
|
334
|
+
/**
|
|
335
|
+
* Props específicas de TreeDataGrid (de react-data-grid)
|
|
336
|
+
* Estas props controlan la funcionalidad de agrupación jerárquica.
|
|
337
|
+
*
|
|
338
|
+
* NOTA: groupBy se calcula automáticamente desde columnsConfig.grouped
|
|
339
|
+
* ordenadas por groupOrder. El desarrollador define grouped/groupable en columns.
|
|
340
|
+
*/
|
|
341
|
+
export interface TreeProps<TRow> {
|
|
342
|
+
/**
|
|
343
|
+
* Función que agrupa las filas por una columna.
|
|
344
|
+
*
|
|
345
|
+
* OPCIONAL: Si no se pasa, usa un rowGrouper genérico que agrupa
|
|
346
|
+
* por el valor directo de la columna (row[columnKey]).
|
|
347
|
+
*
|
|
348
|
+
* Solo necesitas pasar un rowGrouper personalizado si quieres
|
|
349
|
+
* transformar los valores antes de agrupar, por ejemplo:
|
|
350
|
+
* - Agrupar fechas por mes ("Enero 2024")
|
|
351
|
+
* - Agrupar números por rango ("$40k - $60k")
|
|
352
|
+
* @see defaultRowGrouper en helpers/defaultRowGrouper
|
|
353
|
+
*/
|
|
354
|
+
rowGrouper?: (rows: readonly TRow[], columnKey: string) => Record<string, readonly TRow[]>;
|
|
355
|
+
/** IDs de grupos expandidos */
|
|
356
|
+
expandedGroupIds?: ReadonlySet<unknown>;
|
|
357
|
+
/** Callback cuando cambian los grupos expandidos */
|
|
358
|
+
onExpandedGroupIdsChange?: (expandedGroupIds: Set<unknown>) => void;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Props completas de TreeDataGrid.
|
|
362
|
+
* Extiende DataGridProps pero sin cardsViewConfig ni defaultViewMode
|
|
363
|
+
* ya que TreeDataGrid solo soporta vista de tabla.
|
|
364
|
+
*/
|
|
365
|
+
export interface TreeDataGridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Omit<DataGridProps<TRow, TSummaryRow, TKey>, 'cardsViewConfig' | 'defaultViewMode'>, TreeProps<TRow> {
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Props para TableView con soporte opcional para TreeDataGrid
|
|
369
|
+
*/
|
|
370
|
+
export type TableViewProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> = GridProps<TRow, TSummaryRow, TKey> & {
|
|
371
|
+
/** Props para TreeDataGrid. Si se pasan, usa TreeDataGrid en lugar de DataGrid */
|
|
372
|
+
treeProps?: TreeProps<TRow>;
|
|
373
|
+
};
|
package/components/datagrids/views/CardsView/hooks/useProcessedColumns/useProcessedColumns.d.ts
CHANGED
|
@@ -47,4 +47,6 @@ export declare function useProcessedColumns<TRow, TSummaryRow>(columns: readonly
|
|
|
47
47
|
customSort?: ((a: TRow, b: TRow) => number) | undefined;
|
|
48
48
|
formatter?: ((props: any) => JSX.Element) | undefined;
|
|
49
49
|
editor?: import('@m4l/core').Maybe<(props: import('react-data-grid').RenderEditCellProps<TRow, TSummaryRow>) => import('react').ReactNode>;
|
|
50
|
+
groupable?: boolean;
|
|
51
|
+
grouped?: boolean;
|
|
50
52
|
}[];
|
package/components/datagrids/views/CardsView/hooks/useProcessedColumns/useProcessedColumns.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { SELECT_COLUMN_KEY } from "react-data-grid";
|
|
3
|
+
import { d as DATAGRID_ACTIONS_COLUMN_KEY } from "../../../../constants.js";
|
|
3
4
|
import { u as useDataGrid } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
4
5
|
function useProcessedColumns(columns, options = {}) {
|
|
5
6
|
const { applyVisibilityFilter = true } = options;
|
|
@@ -10,7 +11,7 @@ function useProcessedColumns(columns, options = {}) {
|
|
|
10
11
|
);
|
|
11
12
|
return useMemo(() => {
|
|
12
13
|
const processedColumns = columns.filter((column) => {
|
|
13
|
-
if (column.key ===
|
|
14
|
+
if (column.key === SELECT_COLUMN_KEY || column.key === DATAGRID_ACTIONS_COLUMN_KEY) {
|
|
14
15
|
return false;
|
|
15
16
|
}
|
|
16
17
|
if (!applyVisibilityFilter) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GridProps, RowKey } from '../../types';
|
|
1
|
+
import { RowKey, TableViewProps } from '../../types';
|
|
3
2
|
/**
|
|
4
3
|
* Componente que renderiza la tabla con las filas y columnas
|
|
5
|
-
* Acepta todos los props de DataGrid y prioriza las configuraciones personalizadas
|
|
4
|
+
* Acepta todos los props de DataGrid y prioriza las configuraciones personalizadas.
|
|
5
|
+
* Si se proporcionan treeProps, renderiza TreeDataGrid en lugar de DataGrid.
|
|
6
6
|
*/
|
|
7
|
-
export declare function TableView<TRow, TSummaryRow, TKey extends RowKey = RowKey>(props:
|
|
7
|
+
export declare function TableView<TRow, TSummaryRow, TKey extends RowKey = RowKey>(props: TableViewProps<TRow, TSummaryRow, TKey>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState, useRef, useEffect } from "react";
|
|
3
|
-
import DataGrid from "react-data-grid";
|
|
3
|
+
import DataGrid, { TreeDataGrid } from "react-data-grid";
|
|
4
4
|
import { DndProvider } from "react-dnd";
|
|
5
5
|
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
6
6
|
import { B as TableContainerStyled, y as TableWrapperDataGridStyled } from "../../slots/DataGridSlot.js";
|
|
7
7
|
import { u as useSortColumnsRows } from "./hooks/useSortColumnsRows/useSortColumnsRows.js";
|
|
8
|
+
import { g as getGroupBy } from "./helpers/getGroupBy/getGroupBy.js";
|
|
9
|
+
import { d as defaultRowGrouper } from "./helpers/defaultRowGrouper/defaultRowGrouper.js";
|
|
8
10
|
import { u as useHeaderMenuActions } from "./hooks/useHeaderMenuActions/useHeaderMenuActions.js";
|
|
9
11
|
import { f as filterHeight } from "./subcomponents/SelectColumn/SelectColumn.js";
|
|
10
12
|
import { H as HeaderRenderClick } from "./subcomponents/HeaderRenderClick/HeaderRenderClick.js";
|
|
@@ -21,6 +23,7 @@ function TableView(props) {
|
|
|
21
23
|
onSelectedRowsChange,
|
|
22
24
|
defaultColumnOptions: defaultColumnOptionsProp,
|
|
23
25
|
focusOnRowKey,
|
|
26
|
+
treeProps,
|
|
24
27
|
...restProps
|
|
25
28
|
} = props;
|
|
26
29
|
const renderCheckbox = (formatterProps) => {
|
|
@@ -61,8 +64,16 @@ function TableView(props) {
|
|
|
61
64
|
currentRowHeightVariant,
|
|
62
65
|
size,
|
|
63
66
|
sortColumns,
|
|
64
|
-
setSortColumns
|
|
67
|
+
setSortColumns,
|
|
68
|
+
columnsConfig
|
|
65
69
|
} = useDataGrid();
|
|
70
|
+
const groupBy = useMemo(() => {
|
|
71
|
+
if (!treeProps) {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
return getGroupBy(columnsConfig);
|
|
75
|
+
}, [columnsConfig, treeProps]);
|
|
76
|
+
const rowGrouper = treeProps?.rowGrouper ?? defaultRowGrouper;
|
|
66
77
|
const ref_data_grid = useRef(null);
|
|
67
78
|
const [popoverState, setPopoverState] = useState({
|
|
68
79
|
anchorEl: null,
|
|
@@ -150,7 +161,34 @@ function TableView(props) {
|
|
|
150
161
|
{
|
|
151
162
|
ownerState: { size, currentRowHeightVariant, currentRowHeight },
|
|
152
163
|
children: [
|
|
153
|
-
/* @__PURE__ */ jsx(DndProvider, { backend: HTML5Backend, context: window, children: /* @__PURE__ */ jsx(
|
|
164
|
+
/* @__PURE__ */ jsx(DndProvider, { backend: HTML5Backend, context: window, children: treeProps ? /* @__PURE__ */ jsx(
|
|
165
|
+
TreeDataGrid,
|
|
166
|
+
{
|
|
167
|
+
className: "rdg-light",
|
|
168
|
+
ref: ref_data_grid,
|
|
169
|
+
headerRowHeight: activeFilters ? currentRowHeaderHeight + filterHeight : currentRowHeaderHeight,
|
|
170
|
+
columns: finalColumns,
|
|
171
|
+
sortColumns,
|
|
172
|
+
onSortColumnsChange: handleSortColumnsChange,
|
|
173
|
+
onColumnResize,
|
|
174
|
+
rows: finalRows,
|
|
175
|
+
onRowsChange,
|
|
176
|
+
selectedRows,
|
|
177
|
+
onSelectedRowsChange,
|
|
178
|
+
onCellClick,
|
|
179
|
+
rowHeight: currentRowHeight,
|
|
180
|
+
rowKeyGetter,
|
|
181
|
+
renderers: {
|
|
182
|
+
renderCheckbox
|
|
183
|
+
},
|
|
184
|
+
defaultColumnOptions,
|
|
185
|
+
groupBy,
|
|
186
|
+
rowGrouper,
|
|
187
|
+
expandedGroupIds: treeProps.expandedGroupIds,
|
|
188
|
+
onExpandedGroupIdsChange: treeProps.onExpandedGroupIdsChange,
|
|
189
|
+
...restProps
|
|
190
|
+
}
|
|
191
|
+
) : /* @__PURE__ */ jsx(
|
|
154
192
|
DataGrid,
|
|
155
193
|
{
|
|
156
194
|
className: "rdg-light",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RowGrouper genérico por defecto.
|
|
3
|
+
*
|
|
4
|
+
* Se usa cuando NO pasas un rowGrouper personalizado al TreeDataGrid.
|
|
5
|
+
* Agrupa las filas usando el valor directo de la columna.
|
|
6
|
+
*
|
|
7
|
+
* Ideal para agrupar por campos de texto como:
|
|
8
|
+
* - Departamento
|
|
9
|
+
* - Estado
|
|
10
|
+
* - Ubicación
|
|
11
|
+
* @param rows - Todas las filas de la tabla
|
|
12
|
+
* @param columnKey - El nombre de la columna por la que agrupar (ej: 'department')
|
|
13
|
+
* @returns Un objeto donde cada llave es un valor único y cada valor es un array de filas
|
|
14
|
+
* @example
|
|
15
|
+
* const rows = [
|
|
16
|
+
* { id: 1, name: 'Juan', department: 'Ventas' },
|
|
17
|
+
* { id: 2, name: 'María', department: 'Tecnología' },
|
|
18
|
+
* { id: 3, name: 'Pedro', department: 'Ventas' },
|
|
19
|
+
* ];
|
|
20
|
+
*
|
|
21
|
+
* const groups = defaultRowGrouper(rows, 'department');
|
|
22
|
+
* // Resultado:
|
|
23
|
+
* // {
|
|
24
|
+
* // 'Ventas': [Juan, Pedro],
|
|
25
|
+
* // 'Tecnología': [María]
|
|
26
|
+
* // }
|
|
27
|
+
*/
|
|
28
|
+
export declare const defaultRowGrouper: <TRow>(rows: readonly TRow[], columnKey: string) => Record<string, readonly TRow[]>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const defaultRowGrouper = (rows, columnKey) => {
|
|
2
|
+
const groups = {};
|
|
3
|
+
for (const row of rows) {
|
|
4
|
+
const rawValue = row[columnKey];
|
|
5
|
+
const groupKey = String(rawValue ?? "");
|
|
6
|
+
if (!groups[groupKey]) {
|
|
7
|
+
groups[groupKey] = [];
|
|
8
|
+
}
|
|
9
|
+
groups[groupKey].push(row);
|
|
10
|
+
}
|
|
11
|
+
return groups;
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
defaultRowGrouper as d
|
|
15
|
+
};
|
package/components/datagrids/views/TableView/helpers/defaultRowGrouper/defaultRowGrouper.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defaultRowGrouper } from './defaultRowGrouper';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IConfigColumn } from '../../../../contexts/DataGridContext/types';
|
|
2
|
+
/**
|
|
3
|
+
* Calcula el array de keys de columnas que deben agruparse.
|
|
4
|
+
*
|
|
5
|
+
* Esta función:
|
|
6
|
+
* 1. Filtra las columnas que tienen grouped: true
|
|
7
|
+
* 2. Las ordena por groupOrder (menor = primer nivel de agrupación)
|
|
8
|
+
* 3. Retorna un array con las keys de esas columnas
|
|
9
|
+
* @param columnsConfig - Array de configuración de columnas del DataGrid
|
|
10
|
+
* @returns Array de keys de columnas ordenadas por nivel de agrupación
|
|
11
|
+
* @example
|
|
12
|
+
* // Si columnsConfig tiene:
|
|
13
|
+
* // - department: { grouped: true, groupOrder: 0 }
|
|
14
|
+
* // - team: { grouped: true, groupOrder: 1 }
|
|
15
|
+
* // - name: { grouped: false }
|
|
16
|
+
*
|
|
17
|
+
* const groupBy = getGroupBy(columnsConfig);
|
|
18
|
+
* // Resultado: ['department', 'team']
|
|
19
|
+
*/
|
|
20
|
+
export declare const getGroupBy: (columnsConfig: IConfigColumn[]) => string[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const getGroupBy = (columnsConfig) => {
|
|
2
|
+
const groupedColumns = columnsConfig.filter(
|
|
3
|
+
(column) => column.grouped === true
|
|
4
|
+
);
|
|
5
|
+
const sortedColumns = groupedColumns.sort(
|
|
6
|
+
(columnA, columnB) => (columnA.groupOrder ?? 0) - (columnB.groupOrder ?? 0)
|
|
7
|
+
);
|
|
8
|
+
const groupByKeys = sortedColumns.map((column) => column.key);
|
|
9
|
+
return groupByKeys;
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
getGroupBy as g
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getGroupBy } from './getGroupBy';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/components/datagrids/views/TableView/hooks/useHeaderMenuActions/useHeaderMenuActions.js
CHANGED
|
@@ -123,6 +123,24 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable, handleSo
|
|
|
123
123
|
columnKey
|
|
124
124
|
});
|
|
125
125
|
}, [columnKey, column, externalFilterSettings]);
|
|
126
|
+
const canGroup = useMemo(() => {
|
|
127
|
+
if (!columnKey || !column) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
return column.groupable === true;
|
|
131
|
+
}, [columnKey, column]);
|
|
132
|
+
const isGrouped = useMemo(() => {
|
|
133
|
+
if (!columnKey) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
const colConfig = columnsConfig.find((c) => c.key === columnKey);
|
|
137
|
+
return colConfig?.grouped === true;
|
|
138
|
+
}, [columnKey, columnsConfig]);
|
|
139
|
+
const hasGroupableColumns = useMemo(() => {
|
|
140
|
+
return finalColumns.some(
|
|
141
|
+
(col) => col.groupable === true || col.grouped === true
|
|
142
|
+
);
|
|
143
|
+
}, [finalColumns]);
|
|
126
144
|
const isAddFilterDisabled = useMemo(() => {
|
|
127
145
|
if (!columnKey || !column) {
|
|
128
146
|
return true;
|
|
@@ -229,6 +247,44 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable, handleSo
|
|
|
229
247
|
disabled: isAddFilterDisabled
|
|
230
248
|
}
|
|
231
249
|
] : [];
|
|
250
|
+
const toggleGrouped = (grouped) => {
|
|
251
|
+
if (!columnKey) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const currentGroupedColumns = columnsConfig.filter((c) => c.grouped);
|
|
255
|
+
const newGroupOrder = grouped ? currentGroupedColumns.length : 0;
|
|
256
|
+
const next = columnsConfig.map(
|
|
257
|
+
(c) => c.key === columnKey ? {
|
|
258
|
+
...c,
|
|
259
|
+
grouped,
|
|
260
|
+
groupOrder: grouped ? newGroupOrder : c.groupOrder
|
|
261
|
+
} : c
|
|
262
|
+
);
|
|
263
|
+
onChangeColumnsConfig("table", next);
|
|
264
|
+
};
|
|
265
|
+
const groupActions = hasGroupableColumns ? [
|
|
266
|
+
{
|
|
267
|
+
type: "menuItem",
|
|
268
|
+
startIcon: `${host_static_assets}/${environment_assets}/${pathIcons.group}`,
|
|
269
|
+
label: getLabel(DICTIONARY.GROUP_BY_COLUMN),
|
|
270
|
+
dataTestId: "group-add",
|
|
271
|
+
onClick: () => {
|
|
272
|
+
toggleGrouped(true);
|
|
273
|
+
},
|
|
274
|
+
disabled: !canGroup || isGrouped
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
type: "menuItem",
|
|
278
|
+
startIcon: `${host_static_assets}/${environment_assets}/${pathIcons.removeGroup}`,
|
|
279
|
+
label: getLabel(DICTIONARY.REMOVE_GROUP_COLUMN),
|
|
280
|
+
dataTestId: "group-remove",
|
|
281
|
+
onClick: () => {
|
|
282
|
+
toggleGrouped(false);
|
|
283
|
+
},
|
|
284
|
+
// Solo deshabilitado si no está agrupada O si es una agrupación estática (groupable=false)
|
|
285
|
+
disabled: !isGrouped || !canGroup
|
|
286
|
+
}
|
|
287
|
+
] : [];
|
|
232
288
|
const baseActions = [
|
|
233
289
|
{
|
|
234
290
|
type: "menuItem",
|
|
@@ -246,9 +302,10 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable, handleSo
|
|
|
246
302
|
dataTestId: "hide-column"
|
|
247
303
|
}
|
|
248
304
|
];
|
|
249
|
-
return [...sortActions, ...filterAction, ...baseActions];
|
|
305
|
+
return [...sortActions, ...filterAction, ...groupActions, ...baseActions];
|
|
250
306
|
}, [
|
|
251
307
|
columnKey,
|
|
308
|
+
column,
|
|
252
309
|
canSort,
|
|
253
310
|
canSortExternally,
|
|
254
311
|
hasExternalSortAsc,
|
|
@@ -258,8 +315,12 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable, handleSo
|
|
|
258
315
|
toggleFrozen,
|
|
259
316
|
toggleVisible,
|
|
260
317
|
columnsConfig,
|
|
318
|
+
onChangeColumnsConfig,
|
|
261
319
|
externalSortSettings,
|
|
262
320
|
externalFilterSettings,
|
|
321
|
+
hasGroupableColumns,
|
|
322
|
+
canGroup,
|
|
323
|
+
isGrouped,
|
|
263
324
|
host_static_assets,
|
|
264
325
|
environment_assets,
|
|
265
326
|
getLabel,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import { useState, useEffect, useMemo } from "react";
|
|
2
3
|
import { useModuleSkeleton, getPropertyByString } from "@m4l/core";
|
|
3
|
-
import {
|
|
4
|
+
import { SELECT_COLUMN_KEY } from "react-data-grid";
|
|
4
5
|
import { g as getDragHeaderRenderer } from "../../helpers/getDragHeaderRenderer/getDragHeaderRenderer.js";
|
|
5
6
|
import { S as SkeletonFormatter } from "../../subcomponents/SkeletonFormatter/SkeletonFormatter.js";
|
|
6
7
|
import { a as filterColumnClassName, S as SelectColumn } from "../../subcomponents/SelectColumn/SelectColumn.js";
|
|
8
|
+
import { R as RenderGroupCell } from "../../subcomponents/RenderGroupCell/RenderGroupCell.js";
|
|
7
9
|
import { A as ActionsColumn } from "../../subcomponents/ActionsColumn/ActionsColumn.js";
|
|
8
10
|
import { R as RadioSelectColumn } from "../../subcomponents/RadioSelectColumn/RadioSelectColumn.js";
|
|
9
11
|
import { u as useDataGrid } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
@@ -18,7 +20,6 @@ function getComparator(columns, sortColumn) {
|
|
|
18
20
|
return column.customSort;
|
|
19
21
|
}
|
|
20
22
|
switch (typeOrder) {
|
|
21
|
-
//Si el tipo de dato de la columna es un numerico, retorna una función de ordenamiento numérica
|
|
22
23
|
case "number":
|
|
23
24
|
return (a, b) => {
|
|
24
25
|
try {
|
|
@@ -27,7 +28,6 @@ function getComparator(columns, sortColumn) {
|
|
|
27
28
|
return -1;
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
|
-
//Por defecto retorna una función de ordenamiento de string
|
|
31
31
|
default:
|
|
32
32
|
return (a, b) => {
|
|
33
33
|
try {
|
|
@@ -39,6 +39,12 @@ function getComparator(columns, sortColumn) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
const getColumIndex = (key, columnsConfig) => columnsConfig.findIndex((columnConfig) => columnConfig.key === key);
|
|
42
|
+
const findKeyInColumns = (key, columns) => {
|
|
43
|
+
const index = columns.findIndex(
|
|
44
|
+
(column) => key === column.key && column.hidden === false
|
|
45
|
+
);
|
|
46
|
+
return index !== -1;
|
|
47
|
+
};
|
|
42
48
|
const getInOrderColumns = (columns, hasCheckedRows, checkedRowsMultiple, columnsConfig, columnsWidths, rowActionsGetter) => {
|
|
43
49
|
let filteredSortedColumns = columns.filter((column) => {
|
|
44
50
|
const columnConfigIndex = getColumIndex(column.key, columnsConfig);
|
|
@@ -100,12 +106,6 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
100
106
|
);
|
|
101
107
|
const isSkeleton = useModuleSkeleton();
|
|
102
108
|
const { activeFilters, filters } = useFilters();
|
|
103
|
-
const findKeyInColumns = (key, cols) => {
|
|
104
|
-
const index = cols.findIndex(
|
|
105
|
-
(column) => key === column.key && column.hidden === false
|
|
106
|
-
);
|
|
107
|
-
return index !== -1;
|
|
108
|
-
};
|
|
109
109
|
useEffect(() => {
|
|
110
110
|
setColumns(
|
|
111
111
|
getInOrderColumns(
|
|
@@ -124,7 +124,17 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
124
124
|
if (JSON.stringify(finalSortedColumns) !== JSON.stringify(sortColumns)) {
|
|
125
125
|
setSortColumns(finalSortedColumns);
|
|
126
126
|
}
|
|
127
|
-
}, [
|
|
127
|
+
}, [
|
|
128
|
+
sourceColumns,
|
|
129
|
+
columnsConfig,
|
|
130
|
+
rowActionsGetter,
|
|
131
|
+
checkedRows,
|
|
132
|
+
onCheckedRowsChange,
|
|
133
|
+
checkedRowsMultiple,
|
|
134
|
+
columnsWidths,
|
|
135
|
+
sortColumns,
|
|
136
|
+
setSortColumns
|
|
137
|
+
]);
|
|
128
138
|
const finalColumns = useMemo(() => {
|
|
129
139
|
const DragAndDropHeaderRenderer = getDragHeaderRenderer(
|
|
130
140
|
(sourceKey, targetKey) => onChangeColumnsOrder("table", sourceKey, targetKey),
|
|
@@ -139,7 +149,7 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
139
149
|
cellClass,
|
|
140
150
|
headerCellClass: cellClass
|
|
141
151
|
};
|
|
142
|
-
if (newColumn.key ===
|
|
152
|
+
if (newColumn.key === SELECT_COLUMN_KEY || newColumn.isDraggable !== void 0 && newColumn.isDraggable === false) {
|
|
143
153
|
return newColumn;
|
|
144
154
|
}
|
|
145
155
|
if (isSkeleton) {
|
|
@@ -161,6 +171,20 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
161
171
|
newColumn.headerCellClass = `${newColumn.headerCellClass} ${filterColumnClassName}`.trim();
|
|
162
172
|
}
|
|
163
173
|
newColumn.renderHeaderCell = DragAndDropHeaderRenderer;
|
|
174
|
+
const columnConfig = columnsConfig.find((cfg) => cfg.key === c.key);
|
|
175
|
+
const isGroupedInConfig = columnConfig?.grouped === true;
|
|
176
|
+
const originalColumn = sourceColumns.find((col) => col.key === c.key);
|
|
177
|
+
const hasCustomGroupCell = originalColumn?.renderGroupCell !== void 0;
|
|
178
|
+
if (isGroupedInConfig) {
|
|
179
|
+
const customGroupCell = hasCustomGroupCell ? originalColumn?.renderGroupCell : void 0;
|
|
180
|
+
newColumn.renderGroupCell = (cellProps) => /* @__PURE__ */ jsx(
|
|
181
|
+
RenderGroupCell,
|
|
182
|
+
{
|
|
183
|
+
...cellProps,
|
|
184
|
+
customRenderGroupCell: customGroupCell
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
}
|
|
164
188
|
return newColumn;
|
|
165
189
|
});
|
|
166
190
|
}, [
|
|
@@ -168,7 +192,9 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
168
192
|
columns,
|
|
169
193
|
activeFilters,
|
|
170
194
|
onChangeColumnsOrder,
|
|
171
|
-
popoverHandlers
|
|
195
|
+
popoverHandlers,
|
|
196
|
+
columnsConfig,
|
|
197
|
+
sourceColumns
|
|
172
198
|
]);
|
|
173
199
|
const finalRows = useMemo(() => {
|
|
174
200
|
const nextRows = sourceRows.filter((r) => {
|
|
@@ -226,7 +252,7 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
226
252
|
return 0;
|
|
227
253
|
});
|
|
228
254
|
return nextRows;
|
|
229
|
-
}, [sourceRows, sortColumns, filters]);
|
|
255
|
+
}, [sourceRows, sortColumns, filters, columns]);
|
|
230
256
|
return { finalColumns, sortColumns, setSortColumns, finalRows };
|
|
231
257
|
};
|
|
232
258
|
export {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { e as DATAGRID_SEMANTIC_WIDTHS, d as DATAGRID_ACTIONS_COLUMN_KEY } from "../../../../constants.js";
|
|
3
3
|
import { u as useDataGrid } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
4
4
|
import { M as MenuActions } from "../../../../../MenuActions/MenuActions.js";
|
|
5
5
|
function ActionsFormatter(props) {
|
package/components/datagrids/views/TableView/subcomponents/HeaderRenderClick/HeaderRenderClick.js
CHANGED
|
@@ -6,7 +6,7 @@ import { P as MenuListStyled, Q as HeaderRenderClickStyled } from "../../../../s
|
|
|
6
6
|
import { M as MenuDivider } from "../../../../../mui_extended/MenuDivider/MenuDivider.js";
|
|
7
7
|
import { P as Popover } from "../../../../../mui_extended/Popover/Popover.js";
|
|
8
8
|
import { D as DICTIONARY } from "../../../../dictionary.js";
|
|
9
|
-
import {
|
|
9
|
+
import { f as DATAGRID_HEADER_RENDER_CLICK_KEY } from "../../../../constants.js";
|
|
10
10
|
import { u as useFilters } from "../../../../hooks/shared/useFilters/useFilters.js";
|
|
11
11
|
function HeaderRenderClick(props) {
|
|
12
12
|
const {
|
package/components/datagrids/views/TableView/subcomponents/RadioSelectColumn/RadioSelectColumn.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { SELECT_COLUMN_KEY } from "react-data-grid";
|
|
3
3
|
import { u as useDataGrid } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
4
4
|
import { R as RadioFormatter } from "./subcomponents/RadioFormatter/RadioFormatter.js";
|
|
5
5
|
function RadioSelectGroupFormatter(_props) {
|
|
@@ -28,7 +28,7 @@ function RadioSelectColumnHeaderRenderer(_props) {
|
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
30
|
const RadioSelectColumn = {
|
|
31
|
-
key:
|
|
31
|
+
key: SELECT_COLUMN_KEY,
|
|
32
32
|
name: "",
|
|
33
33
|
width: 32,
|
|
34
34
|
minWidth: 32,
|