@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
package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.js
CHANGED
|
@@ -13,6 +13,7 @@ const getInitialColumnsConfig = (id, columns, viewMode, defaultConfig, viewSpeci
|
|
|
13
13
|
return columns.map((column, index) => {
|
|
14
14
|
const existingConfig = columnsConfig.find((c) => c.key === column.key);
|
|
15
15
|
const columnConfigIndex = existingConfig ? columnsConfig.indexOf(existingConfig) : -1;
|
|
16
|
+
const groupedColumnsCount = columns.slice(0, index).filter((c) => c.grouped === true).length;
|
|
16
17
|
const baseConfig = {
|
|
17
18
|
key: column.key,
|
|
18
19
|
name: typeof column.name === "string" ? column.name : String(column.name),
|
|
@@ -22,10 +23,17 @@ const getInitialColumnsConfig = (id, columns, viewMode, defaultConfig, viewSpeci
|
|
|
22
23
|
originalIndex: index,
|
|
23
24
|
originalVisible: column.visible === void 0 ? true : column.visible
|
|
24
25
|
};
|
|
26
|
+
const groupingConfig = viewMode === "table" ? {
|
|
27
|
+
grouped: existingConfig?.grouped ?? column.grouped ?? false,
|
|
28
|
+
groupOrder: existingConfig?.groupOrder ?? (column.grouped ? groupedColumnsCount : index),
|
|
29
|
+
originalGrouped: column.grouped ?? false,
|
|
30
|
+
originalGroupOrder: column.grouped ? groupedColumnsCount : index
|
|
31
|
+
} : {};
|
|
25
32
|
return {
|
|
26
33
|
...baseConfig,
|
|
27
34
|
...viewSpecificDefaults,
|
|
28
35
|
...originalViewSpecificDefaults,
|
|
36
|
+
...groupingConfig,
|
|
29
37
|
...existingConfig || {}
|
|
30
38
|
};
|
|
31
39
|
}).sort((a, b) => a.index - b.index);
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
const getViewSpecificConfig = (viewMode) => {
|
|
2
2
|
const configs = {
|
|
3
3
|
table: {
|
|
4
|
-
defaults: { frozen: false },
|
|
5
|
-
originalDefaults: { originalFrozen: false },
|
|
4
|
+
defaults: { frozen: false, grouped: false, groupOrder: 0 },
|
|
5
|
+
originalDefaults: { originalFrozen: false, originalGrouped: false, originalGroupOrder: 0 },
|
|
6
|
+
/**
|
|
7
|
+
* Extrae las propiedades originales de frozen, grouped y groupOrder de un item.
|
|
8
|
+
* @param item - Item del cual extraer las propiedades
|
|
9
|
+
* @returns Objeto con las propiedades originales
|
|
10
|
+
*/
|
|
6
11
|
dynamicOriginalProperty: (item) => ({
|
|
7
|
-
originalFrozen: item?.frozen ?? false
|
|
12
|
+
originalFrozen: item?.frozen ?? false,
|
|
13
|
+
originalGrouped: item?.grouped ?? false,
|
|
14
|
+
originalGroupOrder: item?.groupOrder ?? 0
|
|
8
15
|
})
|
|
9
16
|
},
|
|
10
17
|
cards: {
|
|
@@ -3,6 +3,7 @@ import { UseChangeColumnsOrderParams, UseChangeColumnsOrderReturn } from './type
|
|
|
3
3
|
* Hook para manejar el cambio de orden de columnas.
|
|
4
4
|
*
|
|
5
5
|
* Reordena las columnas y llama a onChangeColumnsConfig para persistir.
|
|
6
|
+
* También recalcula groupOrder si las columnas están agrupadas.
|
|
6
7
|
* @param getConfigColumns Función para obtener la configuración de columnas
|
|
7
8
|
* @param onChangeColumnsConfig Función para cambiar la configuración de columnas
|
|
8
9
|
* @returns Función para cambiar el orden de columnas
|
|
@@ -21,10 +21,18 @@ const useChangeColumnsOrder = ({
|
|
|
21
21
|
0,
|
|
22
22
|
reorderedConfig.splice(sourceColumnIndex, 1)[0]
|
|
23
23
|
);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
let groupOrderCounter = 0;
|
|
25
|
+
const configWithUpdatedIndexes = reorderedConfig.map((col, idx) => {
|
|
26
|
+
const updatedCol = {
|
|
27
|
+
...col,
|
|
28
|
+
index: idx
|
|
29
|
+
};
|
|
30
|
+
if (col.grouped) {
|
|
31
|
+
updatedCol.groupOrder = groupOrderCounter;
|
|
32
|
+
groupOrderCounter++;
|
|
33
|
+
}
|
|
34
|
+
return updatedCol;
|
|
35
|
+
});
|
|
28
36
|
onChangeColumnsConfig(viewModeParam, configWithUpdatedIndexes);
|
|
29
37
|
},
|
|
30
38
|
[getConfigColumns, onChangeColumnsConfig]
|
|
@@ -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
|
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
const pathIcons = {
|
|
2
|
-
compact: "frontend/components/data_grid/assets/icons/compact.svg",
|
|
3
|
-
standard: "frontend/components/data_grid/assets/icons/standard.svg",
|
|
4
|
-
confortable: "frontend/components/data_grid/assets/icons/confortable.svg",
|
|
5
2
|
filter: "frontend/components/data_grid/assets/icons/list-filter.svg",
|
|
6
3
|
configuration: "frontend/components/data_grid/assets/icons/settings.svg",
|
|
7
|
-
menu: "frontend/components/data_grid/assets/icons/menu.svg",
|
|
8
4
|
moveFirstPlace: "frontend/components/data_grid/assets/icons/move_first_place.svg",
|
|
9
5
|
moveUpPlace: "frontend/components/data_grid/assets/icons/move_up_place.svg",
|
|
10
6
|
moveLastPlace: "frontend/components/data_grid/assets/icons/move_last_place.svg",
|
|
@@ -20,11 +16,11 @@ const pathIcons = {
|
|
|
20
16
|
freezeColumn: "frontend/components/data_grid/assets/icons/pin.svg",
|
|
21
17
|
unfreezeColumn: "frontend/components/data_grid/assets/icons/pin-off.svg",
|
|
22
18
|
hideColumn: "frontend/components/data_grid/assets/icons/eye-off.svg",
|
|
23
|
-
viewTable: "frontend/components/data_grid/assets/icons/table.svg",
|
|
24
|
-
viewCards: "frontend/components/data_grid/assets/icons/card.svg",
|
|
25
19
|
info: "frontend/components/data_grid/assets/icons/info.svg",
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
group: "frontend/components/data_grid/assets/icons/group.svg",
|
|
21
|
+
removeGroup: "frontend/components/data_grid/assets/icons/remove_group.svg",
|
|
22
|
+
groupUp: "frontend/components/data_grid/assets/icons/group_up.svg",
|
|
23
|
+
groupDown: "frontend/components/data_grid/assets/icons/group_down.svg"
|
|
28
24
|
};
|
|
29
25
|
export {
|
|
30
26
|
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,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
4
4
|
import { M as MenuActions } from "../../../../../MenuActions/MenuActions.js";
|
|
5
|
-
import { p as pathIcons } from "../../../../icons.js";
|
|
6
5
|
import { D as DICTIONARY } from "../../../../dictionary.js";
|
|
6
|
+
import { LayoutDensityCompactOutlined, LayoutDensityStandardOutlined, LayoutDensityConfortableOutlined } from "@m4l/icons";
|
|
7
7
|
import { u as useDataGrid } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
8
8
|
function Density() {
|
|
9
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
10
9
|
const { rowHeights, currentRowHeightVariant, setRowHeightVariant } = useDataGrid();
|
|
11
10
|
const { getLabel } = useModuleDictionary();
|
|
12
11
|
const menuActions = useMemo(() => {
|
|
@@ -16,21 +15,21 @@ function Density() {
|
|
|
16
15
|
return [
|
|
17
16
|
{
|
|
18
17
|
type: "menuItem",
|
|
19
|
-
startIcon:
|
|
18
|
+
startIcon: /* @__PURE__ */ jsx(LayoutDensityCompactOutlined, {}),
|
|
20
19
|
onClick: () => setRowHeightVariant("compact"),
|
|
21
20
|
disabled: currentRowHeightVariant === "compact",
|
|
22
21
|
label: getLabel(DICTIONARY.DENSITY_COMPACT)
|
|
23
22
|
},
|
|
24
23
|
{
|
|
25
24
|
type: "menuItem",
|
|
26
|
-
startIcon:
|
|
25
|
+
startIcon: /* @__PURE__ */ jsx(LayoutDensityStandardOutlined, {}),
|
|
27
26
|
onClick: () => setRowHeightVariant("standard"),
|
|
28
27
|
disabled: currentRowHeightVariant === "standard",
|
|
29
28
|
label: getLabel(DICTIONARY.DENSITY_STANDARD)
|
|
30
29
|
},
|
|
31
30
|
{
|
|
32
31
|
type: "menuItem",
|
|
33
|
-
startIcon:
|
|
32
|
+
startIcon: /* @__PURE__ */ jsx(LayoutDensityConfortableOutlined, {}),
|
|
34
33
|
onClick: () => setRowHeightVariant("confortable"),
|
|
35
34
|
disabled: currentRowHeightVariant === "confortable",
|
|
36
35
|
label: getLabel(DICTIONARY.DENSITY_CONFORTABLE)
|
|
@@ -40,19 +39,17 @@ function Density() {
|
|
|
40
39
|
rowHeights,
|
|
41
40
|
currentRowHeightVariant,
|
|
42
41
|
setRowHeightVariant,
|
|
43
|
-
host_static_assets,
|
|
44
|
-
environment_assets,
|
|
45
42
|
getLabel
|
|
46
43
|
]);
|
|
47
|
-
const
|
|
44
|
+
const currentViewIcon = useMemo(() => {
|
|
48
45
|
if (currentRowHeightVariant === "compact") {
|
|
49
|
-
return
|
|
46
|
+
return /* @__PURE__ */ jsx(LayoutDensityCompactOutlined, {});
|
|
50
47
|
}
|
|
51
48
|
if (currentRowHeightVariant === "standard") {
|
|
52
|
-
return
|
|
49
|
+
return /* @__PURE__ */ jsx(LayoutDensityStandardOutlined, {});
|
|
53
50
|
}
|
|
54
|
-
return
|
|
55
|
-
}, [currentRowHeightVariant
|
|
51
|
+
return /* @__PURE__ */ jsx(LayoutDensityConfortableOutlined, {});
|
|
52
|
+
}, [currentRowHeightVariant]);
|
|
56
53
|
if (menuActions.length === 0) {
|
|
57
54
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
58
55
|
}
|
|
@@ -63,7 +60,7 @@ function Density() {
|
|
|
63
60
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
64
61
|
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
65
62
|
menuActions,
|
|
66
|
-
icon:
|
|
63
|
+
icon: currentViewIcon,
|
|
67
64
|
toolTip: getLabel(DICTIONARY.DENSITY_TOOLTIP),
|
|
68
65
|
paperProps: { style: { marginTop: "5px" } }
|
|
69
66
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useModuleDictionary, useEnvironment } from "@m4l/core";
|
|
3
3
|
import { p as pathIcons } from "../../../../icons.js";
|
|
4
|
+
import { LayoutDensityCompactOutlined, LayoutDensityStandardOutlined, LayoutDensityConfortableOutlined, SettingsConfigOutlined, MenuMoreVerticalOutlined } from "@m4l/icons";
|
|
4
5
|
import { u as useModalSettings } from "../../../../views/TableView/subcomponents/Settings/hooks/useModalSettings/useModalSettings.js";
|
|
5
6
|
import { u as useModalSettings$1 } from "../../../../views/CardsView/subcomponents/Settings/hooks/useModalSettings/useModalSettings.js";
|
|
6
7
|
import { u as useDataGrid } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
@@ -21,21 +22,21 @@ const MobileMenuActions = (props) => {
|
|
|
21
22
|
const menuActions = [
|
|
22
23
|
{
|
|
23
24
|
type: "menuItem",
|
|
24
|
-
startIcon:
|
|
25
|
+
startIcon: /* @__PURE__ */ jsx(LayoutDensityCompactOutlined, {}),
|
|
25
26
|
onClick: () => setRowHeightVariant("compact"),
|
|
26
27
|
disabled: currentRowHeightVariant === "compact",
|
|
27
28
|
label: getLabel("data_grid.density_compact")
|
|
28
29
|
},
|
|
29
30
|
{
|
|
30
31
|
type: "menuItem",
|
|
31
|
-
startIcon:
|
|
32
|
+
startIcon: /* @__PURE__ */ jsx(LayoutDensityStandardOutlined, {}),
|
|
32
33
|
onClick: () => setRowHeightVariant("standard"),
|
|
33
34
|
disabled: currentRowHeightVariant === "standard",
|
|
34
35
|
label: getLabel("data_grid.density_standard")
|
|
35
36
|
},
|
|
36
37
|
{
|
|
37
38
|
type: "menuItem",
|
|
38
|
-
startIcon:
|
|
39
|
+
startIcon: /* @__PURE__ */ jsx(LayoutDensityConfortableOutlined, {}),
|
|
39
40
|
onClick: () => setRowHeightVariant("confortable"),
|
|
40
41
|
disabled: currentRowHeightVariant === "confortable",
|
|
41
42
|
label: getLabel("data_grid.density_confortable")
|
|
@@ -48,7 +49,7 @@ const MobileMenuActions = (props) => {
|
|
|
48
49
|
},
|
|
49
50
|
{
|
|
50
51
|
type: "menuItem",
|
|
51
|
-
startIcon:
|
|
52
|
+
startIcon: /* @__PURE__ */ jsx(SettingsConfigOutlined, {}),
|
|
52
53
|
onClick: () => modalSettings(),
|
|
53
54
|
label: getLabel("data_grid.tooltip_settings")
|
|
54
55
|
}
|
|
@@ -57,7 +58,7 @@ const MobileMenuActions = (props) => {
|
|
|
57
58
|
MenuActions,
|
|
58
59
|
{
|
|
59
60
|
className: "mobile-menu-actions",
|
|
60
|
-
icon:
|
|
61
|
+
icon: /* @__PURE__ */ jsx(MenuMoreVerticalOutlined, {}),
|
|
61
62
|
arrowType: "no-arrow",
|
|
62
63
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
63
64
|
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { jsxs, Fragment
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useMemo, useCallback } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
4
4
|
import { I as IconButton } from "../../../../../mui_extended/IconButton/IconButton.js";
|
|
5
5
|
import { P as Popover } from "../../../../../mui_extended/Popover/Popover.js";
|
|
6
|
-
import { p as pathIcons } from "../../../../icons.js";
|
|
7
6
|
import { D as DICTIONARY } from "../../../../dictionary.js";
|
|
8
7
|
import { g as ContainerToggleCardsStyled, h as CardToggleButtonStyled, T as TextToggleCardButtonStyled } from "../../../../slots/DataGridSlot.js";
|
|
8
|
+
import { LayoutTableOutlined, LayoutCardOutlined } from "@m4l/icons";
|
|
9
9
|
import { u as useDataGrid } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
10
10
|
import { I as Icon } from "../../../../../Icon/Icon.js";
|
|
11
11
|
function ViewMode() {
|
|
12
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
13
12
|
const { viewMode, onViewModeChange } = useDataGrid();
|
|
14
13
|
const { getLabel } = useModuleDictionary();
|
|
15
14
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -33,8 +32,8 @@ function ViewMode() {
|
|
|
33
32
|
},
|
|
34
33
|
[onViewModeChange, handleClose]
|
|
35
34
|
);
|
|
36
|
-
const
|
|
37
|
-
return viewMode === "table" ?
|
|
35
|
+
const RenderIconViewMode = useMemo(() => {
|
|
36
|
+
return viewMode === "table" ? /* @__PURE__ */ jsx(LayoutTableOutlined, {}) : /* @__PURE__ */ jsx(LayoutCardOutlined, {});
|
|
38
37
|
}, [viewMode]);
|
|
39
38
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
39
|
/* @__PURE__ */ jsx(
|
|
@@ -43,8 +42,8 @@ function ViewMode() {
|
|
|
43
42
|
tooltip: getLabel(DICTIONARY.TOOLTIP_VIEW_MODE),
|
|
44
43
|
onClick: handleClick,
|
|
45
44
|
"aria-label": "view-mode",
|
|
46
|
-
icon:
|
|
47
|
-
|
|
45
|
+
icon: RenderIconViewMode,
|
|
46
|
+
dataTestId: "view-mode-button"
|
|
48
47
|
}
|
|
49
48
|
),
|
|
50
49
|
/* @__PURE__ */ jsx(
|
|
@@ -73,7 +72,7 @@ function ViewMode() {
|
|
|
73
72
|
/* @__PURE__ */ jsx(
|
|
74
73
|
Icon,
|
|
75
74
|
{
|
|
76
|
-
|
|
75
|
+
icon: /* @__PURE__ */ jsx(LayoutTableOutlined, {}),
|
|
77
76
|
color: viewMode === "table" ? "primary.enabled" : "text.disabled"
|
|
78
77
|
}
|
|
79
78
|
),
|
|
@@ -100,7 +99,7 @@ function ViewMode() {
|
|
|
100
99
|
/* @__PURE__ */ jsx(
|
|
101
100
|
Icon,
|
|
102
101
|
{
|
|
103
|
-
|
|
102
|
+
icon: /* @__PURE__ */ jsx(LayoutCardOutlined, {}),
|
|
104
103
|
color: viewMode === "cards" ? "primary.enabled" : "text.disabled"
|
|
105
104
|
}
|
|
106
105
|
),
|
|
@@ -12,6 +12,16 @@ export interface SeedProps {
|
|
|
12
12
|
withMultipleIcons?: boolean;
|
|
13
13
|
withInteractiveCheck?: boolean;
|
|
14
14
|
withNestedValue?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Si es true, genera valores anidados con algunos null/undefined
|
|
17
|
+
* para mostrar el comportamiento del defaultValue ('-')
|
|
18
|
+
*/
|
|
19
|
+
withNestedValueWithNulls?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Si es true, genera valores anidados con null/undefined
|
|
22
|
+
* y usa un defaultValue personalizado ('N/A')
|
|
23
|
+
*/
|
|
24
|
+
withNestedValueCustomDefaultValue?: boolean;
|
|
15
25
|
withPoints?: boolean;
|
|
16
26
|
withPrice?: boolean;
|
|
17
27
|
withUncertainty?: boolean;
|
|
@@ -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
|
+
};
|
|
@@ -2,8 +2,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { j as ContainerLabelValueColumnStyled, k as ContentWrapperColumnStyled, L as LabelHeaderColumnStyled, E as EditorCellWrapperStyled, V as ValueColumnStyled, l as EditablePlaceholderStyled, m as IconButtonEditStyled } from "../../../../slots/DataGridSlot.js";
|
|
4
4
|
import { D as DICTIONARY } from "../../../../dictionary.js";
|
|
5
|
-
import { useModuleDictionary
|
|
6
|
-
import {
|
|
5
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
6
|
+
import { ActionsEditOutlined } from "@m4l/icons";
|
|
7
7
|
import { u as useComponentSize } from "../../../../../../hooks/useComponentSize/useComponentSize.js";
|
|
8
8
|
import { u as useDataGrid } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
9
9
|
function useCardContent({
|
|
@@ -15,7 +15,6 @@ function useCardContent({
|
|
|
15
15
|
}) {
|
|
16
16
|
const { getConfigColumns, size } = useDataGrid();
|
|
17
17
|
const { getLabel } = useModuleDictionary();
|
|
18
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
19
18
|
const { currentSize } = useComponentSize(size);
|
|
20
19
|
const [editingColumnKey, setEditingColumnKey] = useState(null);
|
|
21
20
|
const columnsConfig = getConfigColumns("cards");
|
|
@@ -95,7 +94,7 @@ function useCardContent({
|
|
|
95
94
|
/* @__PURE__ */ jsx(
|
|
96
95
|
IconButtonEditStyled,
|
|
97
96
|
{
|
|
98
|
-
src:
|
|
97
|
+
src: /* @__PURE__ */ jsx(ActionsEditOutlined, {}),
|
|
99
98
|
onClick: () => {
|
|
100
99
|
setEditingColumnKey(column.key);
|
|
101
100
|
},
|
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) {
|
|
@@ -2,8 +2,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useCallback } from "react";
|
|
3
3
|
import { o as CardDetailContainerStyled, j as ContainerLabelValueColumnStyled, k as ContentWrapperColumnStyled, L as LabelHeaderColumnStyled, E as EditorCellWrapperStyled, V as ValueColumnStyled, l as EditablePlaceholderStyled, m as IconButtonEditStyled } from "../../../../slots/DataGridSlot.js";
|
|
4
4
|
import { D as DICTIONARY } from "../../../../dictionary.js";
|
|
5
|
-
import { useModuleDictionary
|
|
6
|
-
import {
|
|
5
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
6
|
+
import { ActionsEditOutlined } from "@m4l/icons";
|
|
7
7
|
import { u as useComponentSize } from "../../../../../../hooks/useComponentSize/useComponentSize.js";
|
|
8
8
|
function CardDetails({
|
|
9
9
|
row,
|
|
@@ -17,7 +17,6 @@ function CardDetails({
|
|
|
17
17
|
const [editingColumnKey, setEditingColumnKey] = useState(null);
|
|
18
18
|
const [refreshCounter, setRefreshCounter] = useState(0);
|
|
19
19
|
const { getLabel } = useModuleDictionary();
|
|
20
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
21
20
|
const { currentSize } = useComponentSize(size);
|
|
22
21
|
const currentRow = rows[rowIndex] || row;
|
|
23
22
|
const handleForceRefresh = useCallback(() => {
|
|
@@ -116,7 +115,7 @@ function CardDetails({
|
|
|
116
115
|
/* @__PURE__ */ jsx(
|
|
117
116
|
IconButtonEditStyled,
|
|
118
117
|
{
|
|
119
|
-
src:
|
|
118
|
+
src: /* @__PURE__ */ jsx(ActionsEditOutlined, {}),
|
|
120
119
|
onClick: () => {
|
|
121
120
|
setEditingColumnKey(modifiedColumn.key);
|
|
122
121
|
},
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useCallback } from "react";
|
|
3
|
-
import { useEnvironment } from "@m4l/core";
|
|
4
3
|
import { s as CardHeaderStyled, t as CardHeaderLeftStyled, u as CardHeaderRightStyled } from "../../../../../../slots/DataGridSlot.js";
|
|
5
|
-
import {
|
|
4
|
+
import { LayoutExpandOutlined } from "@m4l/icons";
|
|
6
5
|
import { C as CheckboxCellAdapter } from "../../../../../adapters/CheckboxCellAdapter/CheckboxCellAdapter.js";
|
|
7
6
|
import { I as IconButton } from "../../../../../../../mui_extended/IconButton/IconButton.js";
|
|
8
7
|
import { u as useDataGrid } from "../../../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
@@ -16,7 +15,6 @@ function CardHeader({
|
|
|
16
15
|
onCheckedRowsChange
|
|
17
16
|
}) {
|
|
18
17
|
const { rowKeyGetter, rowActionsGetter, size, checkedRowsMultiple } = useDataGrid();
|
|
19
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
20
18
|
const rowKey = useMemo(() => rowKeyGetter(row), [rowKeyGetter, row]);
|
|
21
19
|
const onChange = useCallback(
|
|
22
20
|
(checked, _isShiftClick) => {
|
|
@@ -69,7 +67,7 @@ function CardHeader({
|
|
|
69
67
|
/* @__PURE__ */ jsx(
|
|
70
68
|
IconButton,
|
|
71
69
|
{
|
|
72
|
-
icon:
|
|
70
|
+
icon: /* @__PURE__ */ jsx(LayoutExpandOutlined, {}),
|
|
73
71
|
size,
|
|
74
72
|
variant: "text",
|
|
75
73
|
"data-testid": `card-details-button-${rowKey}`,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { I as IconButton } from "../../../../../mui_extended/IconButton/IconButton.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
4
|
+
import { SettingsConfigOutlined } from "@m4l/icons";
|
|
5
5
|
import { u as useDataGrid } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
6
6
|
import { u as useModalSettings } from "./hooks/useModalSettings/useModalSettings.js";
|
|
7
7
|
function Settings(props) {
|
|
8
8
|
const { columns } = props;
|
|
9
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
10
9
|
const { size } = useDataGrid();
|
|
11
10
|
const modalSettings = useModalSettings(size, columns);
|
|
12
11
|
const { getLabel } = useModuleDictionary();
|
|
@@ -19,7 +18,7 @@ function Settings(props) {
|
|
|
19
18
|
tooltip: getLabel("data_grid.tooltip_settings"),
|
|
20
19
|
onClick: handleClick,
|
|
21
20
|
"aria-label": "settings",
|
|
22
|
-
icon:
|
|
21
|
+
icon: /* @__PURE__ */ jsx(SettingsConfigOutlined, {}),
|
|
23
22
|
"data-testid": "settings-button"
|
|
24
23
|
}
|
|
25
24
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useModuleDictionary
|
|
2
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
3
3
|
import { useIsMobile } from "@m4l/graphics";
|
|
4
4
|
import { useRef, useCallback } from "react";
|
|
5
5
|
import { u as useModal } from "../../../../../../../../hooks/useModal/index.js";
|
|
6
6
|
import { n as ContentModalSettingStyled, D as DataGridRootStyled } from "../../../../../../slots/DataGridSlot.js";
|
|
7
|
-
import {
|
|
7
|
+
import { SettingsConfigOutlined } from "@m4l/icons";
|
|
8
8
|
import { C as ColumnsConfig } from "../../subcomponents/ColumnsConfig/ColumnsConfig.js";
|
|
9
9
|
import { A as ActionsContainer } from "../../../../../../../CommonActions/components/ActionsContainer/ActionsContainer.js";
|
|
10
10
|
import { u as useDataGrid } from "../../../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
@@ -16,7 +16,6 @@ const useModalSettings = (size, columns) => {
|
|
|
16
16
|
const { getConfigColumns, onChangeColumnsConfig, currentRowHeight, classes } = useDataGrid();
|
|
17
17
|
const columnsConfig = getConfigColumns("cards");
|
|
18
18
|
const { getLabel } = useModuleDictionary();
|
|
19
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
20
19
|
const isMobile = useIsMobile();
|
|
21
20
|
const ref = useRef(null);
|
|
22
21
|
const onCloseSettings = useCallback(() => {
|
|
@@ -39,7 +38,7 @@ const useModalSettings = (size, columns) => {
|
|
|
39
38
|
WindowBase,
|
|
40
39
|
{
|
|
41
40
|
title: getLabel("data_grid.settings_title"),
|
|
42
|
-
iconUrl:
|
|
41
|
+
iconUrl: /* @__PURE__ */ jsx(SettingsConfigOutlined, {}),
|
|
43
42
|
onClose: closeModal,
|
|
44
43
|
className: "settings-modal",
|
|
45
44
|
variant: "outlined",
|