@m4l/components 9.4.13 → 9.4.15-BE20260120
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 +2 -2
- package/components/ActionsGroup/slots/ActionsGroupSlots.d.ts +2 -2
- package/components/AppBar/slots/AppBarSlots.d.ts +1 -1
- package/components/CheckableList/slots/styled.d.ts +1 -1
- package/components/Chip/slots/ChipSlots.d.ts +2 -2
- 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 +2 -2
- package/components/Icon/Icon.d.ts +3 -0
- package/components/Icon/Icon.js +52 -28
- package/components/Icon/Icon.styles.js +53 -61
- package/components/Icon/constants.d.ts +1 -0
- package/components/Icon/constants.js +5 -1
- package/components/Icon/slots/IconSlots.js +3 -3
- package/components/Icon/types.d.ts +44 -7
- package/components/Label/slots/LabelSlots.d.ts +1 -1
- package/components/MenuActions/MenuActions.js +17 -5
- package/components/MenuActions/constants.js +2 -8
- package/components/MenuActions/slots/MenuActionsSlots.d.ts +1 -1
- package/components/MenuActions/slots/MenuActionsSlots.js +1 -1
- package/components/NumberInput/slots/NumberInputSlots.d.ts +2 -2
- package/components/ObjectLogs/slots/ObjectLogsSlots.d.ts +3 -3
- package/components/PaperForm/slots/PaperFormSlots.d.ts +1 -1
- package/components/SettingsLayout/slots/SettingsLayoutSlots.d.ts +2 -2
- package/components/SideBar/slots/SideBarSlots.d.ts +1 -1
- package/components/Stepper/slots/StepperSlot.d.ts +1 -1
- package/components/TabsNavigator/slots/TabsNavigatorSlots.d.ts +1 -1
- package/components/ToastContainer/slots/toastContainerSlots.d.ts +3 -3
- package/components/WindowBase/slots/WindowBaseSlots.d.ts +2 -2
- package/components/WindowBase/types.d.ts +2 -1
- package/components/areas/components/AreasAdmin/slots/AreasAdminSlots.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/types.d.ts +2 -1
- 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/formatter.d.ts +33 -1
- package/components/datagrids/formatters/ColumnNestedValueFormatter/formatter.js +3 -2
- package/components/datagrids/formatters/ColumnNestedValueFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/types.d.ts +19 -1
- package/components/datagrids/formatters/ColumnNestedValueFormatter/useColumnNestedValue.d.ts +35 -2
- package/components/datagrids/formatters/ColumnNestedValueFormatter/useColumnNestedValue.js +24 -8
- 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 +4 -8
- 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/subcomponents/HeaderActions/subcomponents/Density/Density.js +11 -14
- package/components/datagrids/subcomponents/HeaderActions/subcomponents/MobileMenuActions/MobileMenuActions.js +6 -5
- package/components/datagrids/subcomponents/HeaderActions/subcomponents/ViewMode/ViewMode.js +9 -10
- package/components/datagrids/tests/helpers/types.d.ts +10 -0
- package/components/datagrids/types.d.ts +52 -0
- package/components/datagrids/views/CardsView/hooks/useCardContent/useCardContent.js +3 -4
- 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/CardsView/subcomponents/CardDetails/CardDetails.js +3 -4
- package/components/datagrids/views/CardsView/subcomponents/CardRow/subcomponents/CardHeader/CardHeader.js +2 -4
- package/components/datagrids/views/CardsView/subcomponents/Settings/Settings.js +3 -4
- package/components/datagrids/views/CardsView/subcomponents/Settings/hooks/useModalSettings/useModalSettings.js +3 -4
- package/components/datagrids/views/CardsView/subcomponents/Settings/subcomponents/ColumnsConfig/ColumnsConfig.js +9 -10
- 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 +68 -21
- package/components/datagrids/views/TableView/hooks/useSortColumnsRows/useSortColumnsRows.js +39 -11
- 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-panels/slots/SplitLayoutSlots.d.ts +1 -1
- package/components/formatters/BooleanFormatter/slots/BooleanFormatterSlots.d.ts +2 -2
- package/components/formatters/IconsFormatter/slots/IconsFormatterSlots.d.ts +2 -2
- package/components/formatters/IconsFormatter/types.d.ts +2 -1
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.d.ts +1 -1
- package/components/hook-form/RHFDatePicker/slots/RHFDatePickerSlots.d.ts +1 -1
- package/components/hook-form/RHFTextFieldPassword/slots/RHFTextFieldPasswordSlots.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadImage/slots/RHFUploadImageSlots.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/slots/RHFUploadSingleFileSlots.d.ts +1 -1
- package/components/mui_extended/Accordion/Accordion.js +3 -2
- package/components/mui_extended/Accordion/constants.d.ts +0 -1
- package/components/mui_extended/Accordion/constants.js +1 -3
- package/components/mui_extended/Accordion/slots/AccordionSlots.d.ts +2 -2
- package/components/mui_extended/Autocomplete/hooks/useEndAdornments.js +3 -5
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +1 -1
- package/components/mui_extended/Button/slots/ButtonSlots.d.ts +1 -1
- package/components/mui_extended/CheckBox/slots/CheckBoxSlots.d.ts +2 -2
- package/components/mui_extended/DatePicker/DatePicker.styles.js +2 -2
- package/components/mui_extended/DatePicker/hooks/useDatePicker/useDatePicker.js +10 -11
- package/components/mui_extended/DatePicker/slots/DatePickerSlots.d.ts +1 -1
- package/components/mui_extended/DateTimePicker/DateTimePicker.d.ts +0 -4
- package/components/mui_extended/DateTimePicker/DateTimePicker.js +10 -11
- package/components/mui_extended/DateTimePicker/slots/DateTimePickerSlots.d.ts +1 -1
- package/components/mui_extended/IconButton/IconButton.js +19 -8
- package/components/mui_extended/IconButton/slots/IconButtonSlots.d.ts +1 -1
- package/components/mui_extended/IconButton/types.d.ts +3 -6
- package/components/mui_extended/MenuItem/MenuItem.js +14 -4
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +2 -2
- package/components/mui_extended/MenuItem/types.d.ts +3 -3
- package/components/mui_extended/Radio/Radio.js +4 -5
- package/components/mui_extended/Select/Select.d.ts +2 -1
- package/components/mui_extended/Select/Select.js +7 -5
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +2 -2
- package/components/mui_extended/Tab/Slots/TabSlots.d.ts +1 -1
- package/components/mui_extended/Tabs/Tabs.js +5 -9
- package/components/mui_extended/TimePicker/slots/TimePickerSlots.d.ts +1 -1
- package/components/mui_extended/ToggleIconButton/slots/ToggleIconButtonSlots.d.ts +1 -1
- package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortSlots.d.ts +1 -1
- package/index.js +108 -82
- package/package.json +2 -1
- package/components/hook-form/RHFDatePicker/icons.d.ts +0 -6
- package/components/mui_extended/Autocomplete/icons.js +0 -7
- package/components/mui_extended/DatePicker/icons.d.ts +0 -4
- package/components/mui_extended/DatePicker/icons.js +0 -10
- package/components/mui_extended/DateTimePicker/icons.d.ts +0 -4
- package/components/mui_extended/DateTimePicker/icons.js +0 -10
- package/components/mui_extended/Radio/icons.js +0 -7
- package/components/mui_extended/Tabs/icons.d.ts +0 -4
- package/components/mui_extended/Tabs/icons.js +0 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useRef, useState, useImperativeHandle, useMemo, useEffect } from "react";
|
|
3
|
-
import { useModuleDictionary
|
|
3
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
4
4
|
import DataGrid from "react-data-grid";
|
|
5
5
|
import { I as IconButton } from "../../../../../../../mui_extended/IconButton/IconButton.js";
|
|
6
|
-
import { p as pathIcons } from "../../../../../../icons.js";
|
|
7
6
|
import { v as ColumnsConfigWrapperStyled, w as ColumnsConfigDataGridStyled, x as ColumnsConfigSelColumnsStyled, y as TableWrapperDataGridStyled, z as ColumnsConfigActiosStyled } from "../../../../../../slots/DataGridSlot.js";
|
|
8
7
|
import { D as DICTIONARY } from "../../../../../../dictionary.js";
|
|
8
|
+
import { ArrowChevronUpOutlined, ArrowChevronMdUpOutlined, ArrowChevronDownOutlined, ArrowChevronMdDownOutlined, ActionsMultiCheckOutlined, ActionsCheckIndeterminateOutlined, ArrowRestoreOutlined } from "@m4l/icons";
|
|
9
9
|
import { C as ColumnInteractiveCheckFormatter } from "../../../../../../formatters/ColumnInteractiveCheckFormatter/formatter.js";
|
|
10
10
|
function getRowsFromColumnsConfig(columnsConfig, columns) {
|
|
11
11
|
return columnsConfig.filter((cConfig) => !cConfig.hidden).map(
|
|
@@ -48,7 +48,6 @@ const ColumnsConfig = forwardRef(
|
|
|
48
48
|
() => /* @__PURE__ */ new Set()
|
|
49
49
|
);
|
|
50
50
|
const divRef = useRef(null);
|
|
51
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
52
51
|
useImperativeHandle(ref, () => ({
|
|
53
52
|
onClickIntro: handleIntro,
|
|
54
53
|
current: divRef.current
|
|
@@ -234,7 +233,7 @@ const ColumnsConfig = forwardRef(
|
|
|
234
233
|
onClick: handleMoveFirst,
|
|
235
234
|
"aria-label": "move first place",
|
|
236
235
|
disabled: rowSelectedIndex < 1,
|
|
237
|
-
icon:
|
|
236
|
+
icon: /* @__PURE__ */ jsx(ArrowChevronUpOutlined, {})
|
|
238
237
|
}
|
|
239
238
|
),
|
|
240
239
|
/* @__PURE__ */ jsx(
|
|
@@ -244,7 +243,7 @@ const ColumnsConfig = forwardRef(
|
|
|
244
243
|
onClick: () => handleMoveUpDownd(-1),
|
|
245
244
|
"aria-label": "move up place",
|
|
246
245
|
disabled: rowSelectedIndex < 1,
|
|
247
|
-
icon:
|
|
246
|
+
icon: /* @__PURE__ */ jsx(ArrowChevronMdUpOutlined, {})
|
|
248
247
|
}
|
|
249
248
|
),
|
|
250
249
|
/* @__PURE__ */ jsx(
|
|
@@ -254,7 +253,7 @@ const ColumnsConfig = forwardRef(
|
|
|
254
253
|
onClick: handleMoveLast,
|
|
255
254
|
"aria-label": "move last place",
|
|
256
255
|
disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
|
|
257
|
-
icon:
|
|
256
|
+
icon: /* @__PURE__ */ jsx(ArrowChevronDownOutlined, {})
|
|
258
257
|
}
|
|
259
258
|
),
|
|
260
259
|
/* @__PURE__ */ jsx(
|
|
@@ -264,7 +263,7 @@ const ColumnsConfig = forwardRef(
|
|
|
264
263
|
onClick: () => handleMoveUpDownd(1),
|
|
265
264
|
"aria-label": "move down place",
|
|
266
265
|
disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
|
|
267
|
-
icon:
|
|
266
|
+
icon: /* @__PURE__ */ jsx(ArrowChevronMdDownOutlined, {})
|
|
268
267
|
}
|
|
269
268
|
),
|
|
270
269
|
/* @__PURE__ */ jsx(
|
|
@@ -273,7 +272,7 @@ const ColumnsConfig = forwardRef(
|
|
|
273
272
|
tooltip: getLabel(DICTIONARY.SETTINGS_VISIBLE_ALL),
|
|
274
273
|
onClick: checkAll,
|
|
275
274
|
"aria-label": "check visible all",
|
|
276
|
-
icon:
|
|
275
|
+
icon: /* @__PURE__ */ jsx(ActionsMultiCheckOutlined, {})
|
|
277
276
|
}
|
|
278
277
|
),
|
|
279
278
|
/* @__PURE__ */ jsx(
|
|
@@ -282,7 +281,7 @@ const ColumnsConfig = forwardRef(
|
|
|
282
281
|
tooltip: getLabel(DICTIONARY.SETTINGS_NO_VISIBLE_ALL),
|
|
283
282
|
onClick: unCheckAll,
|
|
284
283
|
"aria-label": "un check all",
|
|
285
|
-
icon:
|
|
284
|
+
icon: /* @__PURE__ */ jsx(ActionsCheckIndeterminateOutlined, {})
|
|
286
285
|
}
|
|
287
286
|
),
|
|
288
287
|
/* @__PURE__ */ jsx(
|
|
@@ -291,7 +290,7 @@ const ColumnsConfig = forwardRef(
|
|
|
291
290
|
tooltip: getLabel(DICTIONARY.SETTINGS_RESTORE),
|
|
292
291
|
onClick: restoreAll,
|
|
293
292
|
"aria-label": "Restore columns",
|
|
294
|
-
icon:
|
|
293
|
+
icon: /* @__PURE__ */ jsx(ArrowRestoreOutlined, {})
|
|
295
294
|
}
|
|
296
295
|
)
|
|
297
296
|
] })
|
|
@@ -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
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo } from "react";
|
|
2
3
|
import { useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
4
|
+
import { ActionsFilterOutlined } from "@m4l/icons";
|
|
3
5
|
import { D as DICTIONARY } from "../../../../dictionary.js";
|
|
4
6
|
import { p as pathIcons } from "../../../../icons.js";
|
|
5
7
|
import { u as useDataGrid } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
@@ -14,13 +16,16 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable, handleSo
|
|
|
14
16
|
} = useDataGrid();
|
|
15
17
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
16
18
|
const { getLabel } = useModuleDictionary();
|
|
17
|
-
const executeSortChange = (
|
|
18
|
-
|
|
19
|
-
handleSortFromPopover
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
const executeSortChange = useCallback(
|
|
20
|
+
(newSortColumns) => {
|
|
21
|
+
if (handleSortFromPopover) {
|
|
22
|
+
handleSortFromPopover(newSortColumns);
|
|
23
|
+
} else {
|
|
24
|
+
setSortColumns(newSortColumns);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
[handleSortFromPopover, setSortColumns]
|
|
28
|
+
);
|
|
24
29
|
const column = useMemo(() => {
|
|
25
30
|
return finalColumns.find((c) => c.key === columnKey);
|
|
26
31
|
}, [columnKey, finalColumns]);
|
|
@@ -123,6 +128,24 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable, handleSo
|
|
|
123
128
|
columnKey
|
|
124
129
|
});
|
|
125
130
|
}, [columnKey, column, externalFilterSettings]);
|
|
131
|
+
const canGroup = useMemo(() => {
|
|
132
|
+
if (!columnKey || !column) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
return column.groupable === true;
|
|
136
|
+
}, [columnKey, column]);
|
|
137
|
+
const isGrouped = useMemo(() => {
|
|
138
|
+
if (!columnKey) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
const colConfig = columnsConfig.find((c) => c.key === columnKey);
|
|
142
|
+
return colConfig?.grouped === true;
|
|
143
|
+
}, [columnKey, columnsConfig]);
|
|
144
|
+
const hasGroupableColumns = useMemo(() => {
|
|
145
|
+
return finalColumns.some(
|
|
146
|
+
(col) => col.groupable === true || col.grouped === true
|
|
147
|
+
);
|
|
148
|
+
}, [finalColumns]);
|
|
126
149
|
const isAddFilterDisabled = useMemo(() => {
|
|
127
150
|
if (!columnKey || !column) {
|
|
128
151
|
return true;
|
|
@@ -217,18 +240,33 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable, handleSo
|
|
|
217
240
|
disabled: externalSortSettings ? !hasAnySortApplied || !isRemovable : !(isAsc || isDesc)
|
|
218
241
|
}
|
|
219
242
|
];
|
|
220
|
-
const filterAction = externalFilterSettings ? [
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
onClick: () => {
|
|
227
|
-
addExternalFilter();
|
|
228
|
-
},
|
|
229
|
-
disabled: isAddFilterDisabled
|
|
243
|
+
const filterAction = externalFilterSettings ? [{ type: "menuItem", startIcon: /* @__PURE__ */ jsx(ActionsFilterOutlined, {}), label: getLabel(DICTIONARY.ADD_FILTER_COLUMN), dataTestId: "filter-add", onClick: () => {
|
|
244
|
+
addExternalFilter();
|
|
245
|
+
}, disabled: isAddFilterDisabled }] : [];
|
|
246
|
+
const toggleGrouped = (grouped) => {
|
|
247
|
+
if (!columnKey) {
|
|
248
|
+
return;
|
|
230
249
|
}
|
|
231
|
-
|
|
250
|
+
const currentGroupedColumns = columnsConfig.filter((c) => c.grouped);
|
|
251
|
+
const newGroupOrder = grouped ? currentGroupedColumns.length : 0;
|
|
252
|
+
const next = columnsConfig.map(
|
|
253
|
+
(c) => c.key === columnKey ? { ...c, grouped, groupOrder: grouped ? newGroupOrder : c.groupOrder } : c
|
|
254
|
+
);
|
|
255
|
+
onChangeColumnsConfig("table", next);
|
|
256
|
+
};
|
|
257
|
+
const groupActions = hasGroupableColumns ? [{ type: "menuItem", startIcon: `${host_static_assets}/${environment_assets}/${pathIcons.group}`, label: getLabel(DICTIONARY.GROUP_BY_COLUMN), dataTestId: "group-add", onClick: () => {
|
|
258
|
+
toggleGrouped(true);
|
|
259
|
+
}, disabled: !canGroup || isGrouped }, {
|
|
260
|
+
type: "menuItem",
|
|
261
|
+
startIcon: `${host_static_assets}/${environment_assets}/${pathIcons.removeGroup}`,
|
|
262
|
+
label: getLabel(DICTIONARY.REMOVE_GROUP_COLUMN),
|
|
263
|
+
dataTestId: "group-remove",
|
|
264
|
+
onClick: () => {
|
|
265
|
+
toggleGrouped(false);
|
|
266
|
+
},
|
|
267
|
+
/** Solo deshabilitado si no está agrupada O si es una agrupación estática (groupable=false)*/
|
|
268
|
+
disabled: !isGrouped || !canGroup
|
|
269
|
+
}] : [];
|
|
232
270
|
const baseActions = [
|
|
233
271
|
{
|
|
234
272
|
type: "menuItem",
|
|
@@ -246,7 +284,7 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable, handleSo
|
|
|
246
284
|
dataTestId: "hide-column"
|
|
247
285
|
}
|
|
248
286
|
];
|
|
249
|
-
return [...sortActions, ...filterAction, ...baseActions];
|
|
287
|
+
return [...sortActions, ...filterAction, ...groupActions, ...baseActions];
|
|
250
288
|
}, [
|
|
251
289
|
columnKey,
|
|
252
290
|
canSort,
|
|
@@ -258,13 +296,22 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable, handleSo
|
|
|
258
296
|
toggleFrozen,
|
|
259
297
|
toggleVisible,
|
|
260
298
|
columnsConfig,
|
|
299
|
+
onChangeColumnsConfig,
|
|
261
300
|
externalSortSettings,
|
|
262
301
|
externalFilterSettings,
|
|
302
|
+
hasGroupableColumns,
|
|
303
|
+
canGroup,
|
|
304
|
+
isGrouped,
|
|
263
305
|
host_static_assets,
|
|
264
306
|
environment_assets,
|
|
265
307
|
getLabel,
|
|
266
308
|
isAddFilterDisabled,
|
|
267
|
-
executeSortChange
|
|
309
|
+
executeSortChange,
|
|
310
|
+
addExternalFilter,
|
|
311
|
+
clearLocalSort,
|
|
312
|
+
isAsc,
|
|
313
|
+
isDesc,
|
|
314
|
+
isRemovable
|
|
268
315
|
]);
|
|
269
316
|
}
|
|
270
317
|
export {
|
|
@@ -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";
|
|
@@ -39,6 +41,12 @@ function getComparator(columns, sortColumn) {
|
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
const getColumIndex = (key, columnsConfig) => columnsConfig.findIndex((columnConfig) => columnConfig.key === key);
|
|
44
|
+
const findKeyInColumns = (key, columns) => {
|
|
45
|
+
const index = columns.findIndex(
|
|
46
|
+
(column) => key === column.key && column.hidden === false
|
|
47
|
+
);
|
|
48
|
+
return index !== -1;
|
|
49
|
+
};
|
|
42
50
|
const getInOrderColumns = (columns, hasCheckedRows, checkedRowsMultiple, columnsConfig, columnsWidths, rowActionsGetter) => {
|
|
43
51
|
let filteredSortedColumns = columns.filter((column) => {
|
|
44
52
|
const columnConfigIndex = getColumIndex(column.key, columnsConfig);
|
|
@@ -100,12 +108,6 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
100
108
|
);
|
|
101
109
|
const isSkeleton = useModuleSkeleton();
|
|
102
110
|
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
111
|
useEffect(() => {
|
|
110
112
|
setColumns(
|
|
111
113
|
getInOrderColumns(
|
|
@@ -124,7 +126,17 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
124
126
|
if (JSON.stringify(finalSortedColumns) !== JSON.stringify(sortColumns)) {
|
|
125
127
|
setSortColumns(finalSortedColumns);
|
|
126
128
|
}
|
|
127
|
-
}, [
|
|
129
|
+
}, [
|
|
130
|
+
sourceColumns,
|
|
131
|
+
columnsConfig,
|
|
132
|
+
rowActionsGetter,
|
|
133
|
+
checkedRows,
|
|
134
|
+
onCheckedRowsChange,
|
|
135
|
+
checkedRowsMultiple,
|
|
136
|
+
columnsWidths,
|
|
137
|
+
sortColumns,
|
|
138
|
+
setSortColumns
|
|
139
|
+
]);
|
|
128
140
|
const finalColumns = useMemo(() => {
|
|
129
141
|
const DragAndDropHeaderRenderer = getDragHeaderRenderer(
|
|
130
142
|
(sourceKey, targetKey) => onChangeColumnsOrder("table", sourceKey, targetKey),
|
|
@@ -139,7 +151,7 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
139
151
|
cellClass,
|
|
140
152
|
headerCellClass: cellClass
|
|
141
153
|
};
|
|
142
|
-
if (newColumn.key ===
|
|
154
|
+
if (newColumn.key === SELECT_COLUMN_KEY || newColumn.isDraggable !== void 0 && newColumn.isDraggable === false) {
|
|
143
155
|
return newColumn;
|
|
144
156
|
}
|
|
145
157
|
if (isSkeleton) {
|
|
@@ -161,6 +173,20 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
161
173
|
newColumn.headerCellClass = `${newColumn.headerCellClass} ${filterColumnClassName}`.trim();
|
|
162
174
|
}
|
|
163
175
|
newColumn.renderHeaderCell = DragAndDropHeaderRenderer;
|
|
176
|
+
const columnConfig = columnsConfig.find((cfg) => cfg.key === c.key);
|
|
177
|
+
const isGroupedInConfig = columnConfig?.grouped === true;
|
|
178
|
+
const originalColumn = sourceColumns.find((col) => col.key === c.key);
|
|
179
|
+
const hasCustomGroupCell = originalColumn?.renderGroupCell !== void 0;
|
|
180
|
+
if (isGroupedInConfig) {
|
|
181
|
+
const customGroupCell = hasCustomGroupCell ? originalColumn?.renderGroupCell : void 0;
|
|
182
|
+
newColumn.renderGroupCell = (cellProps) => /* @__PURE__ */ jsx(
|
|
183
|
+
RenderGroupCell,
|
|
184
|
+
{
|
|
185
|
+
...cellProps,
|
|
186
|
+
customRenderGroupCell: customGroupCell
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
}
|
|
164
190
|
return newColumn;
|
|
165
191
|
});
|
|
166
192
|
}, [
|
|
@@ -168,7 +194,9 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
168
194
|
columns,
|
|
169
195
|
activeFilters,
|
|
170
196
|
onChangeColumnsOrder,
|
|
171
|
-
popoverHandlers
|
|
197
|
+
popoverHandlers,
|
|
198
|
+
columnsConfig,
|
|
199
|
+
sourceColumns
|
|
172
200
|
]);
|
|
173
201
|
const finalRows = useMemo(() => {
|
|
174
202
|
const nextRows = sourceRows.filter((r) => {
|
|
@@ -226,7 +254,7 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
226
254
|
return 0;
|
|
227
255
|
});
|
|
228
256
|
return nextRows;
|
|
229
|
-
}, [sourceRows, sortColumns, filters]);
|
|
257
|
+
}, [sourceRows, sortColumns, filters, columns]);
|
|
230
258
|
return { finalColumns, sortColumns, setSortColumns, finalRows };
|
|
231
259
|
};
|
|
232
260
|
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,
|
package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/RenderGroupCell.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RenderGroupCellComponentProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente para renderizar las celdas de grupo en TreeDataGrid.
|
|
4
|
+
* Siempre muestra un icono de expansión/colapso al inicio.
|
|
5
|
+
* Si se proporciona customRenderGroupCell, renderiza ese contenido después del icono.
|
|
6
|
+
* De lo contrario, muestra el texto del grupo (groupKey).
|
|
7
|
+
* Respeta la alineación de la columna (align: left | center | right).
|
|
8
|
+
* @param props - Props de react-data-grid para grupo + customRenderGroupCell opcional
|
|
9
|
+
*/
|
|
10
|
+
export declare function RenderGroupCell<TRow>(props: RenderGroupCellComponentProps<TRow>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEnvironment } from "@m4l/core";
|
|
3
|
+
import { p as pathIcons } from "../../../../icons.js";
|
|
4
|
+
import { I as Icon } from "../../../../../Icon/Icon.js";
|
|
5
|
+
import { S as DefaultRenderGroupCellRootStyled, U as DefaultRenderGroupCellTextStyled } from "../../../../slots/DataGridSlot.js";
|
|
6
|
+
import { u as useDataGrid } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
7
|
+
function RenderGroupCell(props) {
|
|
8
|
+
const { groupKey, isExpanded, toggleGroup, column, customRenderGroupCell, ...restProps } = props;
|
|
9
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
10
|
+
const { size, currentRowHeightVariant } = useDataGrid();
|
|
11
|
+
const iconPath = isExpanded ? pathIcons.groupDown : pathIcons.groupUp;
|
|
12
|
+
const fullIconPath = `${host_static_assets}/${environment_assets}/${iconPath}`;
|
|
13
|
+
const align = column.align;
|
|
14
|
+
const originalProps = {
|
|
15
|
+
groupKey,
|
|
16
|
+
isExpanded,
|
|
17
|
+
toggleGroup,
|
|
18
|
+
column,
|
|
19
|
+
...restProps
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ jsxs(DefaultRenderGroupCellRootStyled, { ownerState: { align }, onClick: toggleGroup, children: [
|
|
22
|
+
/* @__PURE__ */ jsx(
|
|
23
|
+
Icon,
|
|
24
|
+
{
|
|
25
|
+
src: fullIconPath,
|
|
26
|
+
size,
|
|
27
|
+
ariaLabel: isExpanded ? "Colapsar grupo" : "Expandir grupo"
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
customRenderGroupCell ? customRenderGroupCell(originalProps) : /* @__PURE__ */ jsx(DefaultRenderGroupCellTextStyled, { ownerState: { currentRowHeightVariant }, children: String(groupKey) })
|
|
31
|
+
] });
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
RenderGroupCell as R
|
|
35
|
+
};
|
package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/RenderGroupCell.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Props para RenderGroupCell que permiten contenido personalizado.
|
|
5
|
+
*/
|
|
6
|
+
export interface RenderGroupCellComponentProps<TRow> extends RenderGroupCellProps<TRow> {
|
|
7
|
+
/**
|
|
8
|
+
* Función opcional para renderizar contenido personalizado después del icono.
|
|
9
|
+
* Si se proporciona, se renderiza en lugar del texto por defecto (groupKey).
|
|
10
|
+
*/
|
|
11
|
+
customRenderGroupCell?: (props: RenderGroupCellProps<TRow>) => ReactNode;
|
|
12
|
+
}
|