@m4l/components 9.4.9 → 9.4.10-JT14012026.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/AccountPopover/slots/AccountPopoverSlots.d.ts +3 -3
- package/components/ActionsGroup/slots/ActionsGroupSlots.d.ts +1 -1
- package/components/CheckableList/slots/styled.d.ts +4 -4
- package/components/Chip/slots/ChipSlots.d.ts +1 -1
- package/components/EditLabel/slots/EditLabelSlots.d.ts +1 -1
- package/components/HelperError/slots/HelperErrorSlots.d.ts +1 -1
- package/components/ImageText/slots/ImageTextSlots.d.ts +2 -2
- package/components/Label/slots/LabelSlots.d.ts +2 -2
- package/components/LoadingError/slots/LoadingErrorSlots.d.ts +1 -1
- package/components/MFIsolationApp/slots/MFIsolationAppSlots.d.ts +2 -2
- package/components/NumberInput/hooks/useNumberInput/useNumberInput.js +0 -2
- package/components/ObjectLogs/slots/ObjectLogsSlots.d.ts +1 -1
- package/components/Pager/slots/PagerSlots.d.ts +3 -3
- package/components/PaperForm/slots/PaperFormSlots.d.ts +1 -1
- package/components/SettingsLayout/slots/SettingsLayoutSlots.d.ts +1 -1
- package/components/SideBar/subcomponents/ContentComponent/style.js +15 -2
- package/components/Stepper/slots/StepperSlot.d.ts +4 -4
- package/components/TabsNavigator/slots/TabsNavigatorSlots.d.ts +2 -2
- package/components/ToastContainer/slots/toastContainerSlots.d.ts +2 -2
- package/components/WindowBase/slots/WindowBaseSlots.d.ts +2 -2
- 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/useColumnIcon.d.ts +1 -0
- package/components/datagrids/formatters/ColumnIconFormatter/useColumnIcon.js +3 -1
- package/components/datagrids/formatters/ColumnImageFormatter/ColumnImageGroupFormatter.d.ts +15 -0
- package/components/datagrids/formatters/ColumnImageFormatter/ColumnImageGroupFormatter.js +33 -0
- package/components/datagrids/formatters/ColumnImageFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnImageFormatter/useColumnImage.d.ts +1 -0
- package/components/datagrids/formatters/ColumnImageFormatter/useColumnImage.js +3 -1
- package/components/datagrids/formatters/ColumnInteractiveCheckFormatter/formatter.d.ts +12 -1
- package/components/datagrids/formatters/ColumnInteractiveCheckFormatter/formatter.js +6 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/ColumnNestedValueGroupFormatter.d.ts +14 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/ColumnNestedValueGroupFormatter.js +22 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/useColumnNestedValue.d.ts +1 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/useColumnNestedValue.js +2 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/ColumnPointsGroupFormatter.d.ts +15 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/ColumnPointsGroupFormatter.js +28 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/useColumnPoints.d.ts +1 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/useColumnPoints.js +2 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/ColumnPriceGroupFormatter.d.ts +14 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/ColumnPriceGroupFormatter.js +26 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/useColumnPrice.d.ts +1 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/useColumnPrice.js +2 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/ColumnTagsGroupFormatter.d.ts +13 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/ColumnTagsGroupFormatter.js +21 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/useColumnTags.d.ts +1 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/useColumnTags.js +2 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/ColumnUncertaintyGroupFormatter.d.ts +15 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/ColumnUncertaintyGroupFormatter.js +27 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.d.ts +1 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.js +2 -0
- package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.js +8 -0
- package/components/datagrids/helpers/shared/getViewSpecificConfig/getViewSpecificConfig.js +10 -3
- package/components/datagrids/hooks/useChangeColumnsOrder/useChangeColumnsOrder.d.ts +1 -0
- package/components/datagrids/hooks/useChangeColumnsOrder/useChangeColumnsOrder.js +12 -4
- package/components/datagrids/icons.d.ts +5 -0
- package/components/datagrids/icons.js +5 -1
- package/components/datagrids/index.d.ts +2 -1
- package/components/datagrids/slots/DataGridEnum.d.ts +3 -1
- package/components/datagrids/slots/DataGridEnum.js +2 -0
- package/components/datagrids/slots/DataGridSlot.d.ts +2 -0
- package/components/datagrids/slots/DataGridSlot.js +12 -2
- package/components/datagrids/types.d.ts +52 -0
- package/components/datagrids/views/CardsView/hooks/useProcessedColumns/useProcessedColumns.d.ts +2 -0
- package/components/datagrids/views/CardsView/hooks/useProcessedColumns/useProcessedColumns.js +3 -2
- package/components/datagrids/views/TableView/TableView.d.ts +4 -4
- package/components/datagrids/views/TableView/TableView.js +41 -3
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/defaultRowGrouper.d.ts +28 -0
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/defaultRowGrouper.js +15 -0
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/defaultRowGrouper.test.d.ts +1 -0
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/index.d.ts +1 -0
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/index.js +1 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/getGroupBy.d.ts +20 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/getGroupBy.js +13 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/getGroupBy.test.d.ts +1 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/index.d.ts +1 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/index.js +1 -0
- package/components/datagrids/views/TableView/helpers/index.d.ts +2 -0
- package/components/datagrids/views/TableView/hooks/useHeaderMenuActions/useHeaderMenuActions.js +62 -1
- package/components/datagrids/views/TableView/hooks/useSortColumnsRows/useSortColumnsRows.js +39 -13
- package/components/datagrids/views/TableView/subcomponents/ActionsColumn/ActionsColumn.js +1 -1
- package/components/datagrids/views/TableView/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
- package/components/datagrids/views/TableView/subcomponents/RadioSelectColumn/RadioSelectColumn.js +2 -2
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/RenderGroupCell.d.ts +10 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/RenderGroupCell.js +35 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/RenderGroupCell.test.d.ts +1 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/index.d.ts +2 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/index.js +1 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/types.d.ts +12 -0
- package/components/datagrids/views/TableView/subcomponents/SelectColumn/SelectColumn.js +46 -14
- package/components/datagrids/views/TableView/subcomponents/Settings/hooks/useModalSettings/useModalSettings.js +13 -2
- package/components/datagrids/views/TableView/subcomponents/Settings/subcomponents/ColumnsConfig/ColumnsConfig.js +47 -13
- package/components/datagrids/views/TableView/subcomponents/Settings/subcomponents/ColumnsConfig/types.d.ts +22 -0
- package/components/datagrids/views/adapters/CheckboxCellAdapter/CheckboxCellAdapter.js +1 -1
- package/components/extended/React-resizable-panels/slots/SplitLayoutSlots.d.ts +2 -2
- package/components/formatters/BooleanFormatter/slots/BooleanFormatterSlots.d.ts +1 -1
- package/components/formatters/ConcatenatedFormatter/slots/ConcatenatedFormatterSlots.d.ts +1 -1
- package/components/formatters/DateFormatter/slots/DateFormatterSlots.d.ts +1 -1
- package/components/formatters/DistanceToNowFormatter/slots/DistanceToNowFormatterSlots.d.ts +1 -1
- package/components/formatters/ImageFormatter/slots/ImageFormatterSlots.d.ts +1 -1
- package/components/formatters/PeriodFormatter/slots/PeriodFormatterSlots.d.ts +1 -1
- package/components/formatters/PointsFormatter/slots/ointsFormatterSlots.d.ts +1 -1
- package/components/formatters/PriceFormatter/slots/PriceFormatterSlots.d.ts +1 -1
- package/components/formatters/UncertaintyFormatter/slots/UncertaintyFormatterSlots.d.ts +1 -1
- package/components/hook-form/RHFAutocompleteAsync/reducer/RHFAutocompleteReducer.js +0 -5
- package/components/hook-form/RHFUpload/RHFUploadImage/slots/RHFUploadImageSlots.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/slots/RHFUploadSingleFileSlots.d.ts +5 -5
- package/components/mui_extended/Accordion/slots/AccordionSlots.d.ts +1 -1
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +2 -2
- package/components/mui_extended/Button/slots/ButtonSlots.d.ts +1 -1
- package/components/mui_extended/CheckBox/slots/CheckBoxSlots.d.ts +1 -1
- package/components/mui_extended/MenuItem/MenuItem.js +13 -15
- package/components/mui_extended/MenuItem/MenuItem.styles.js +33 -46
- package/components/mui_extended/MenuItem/constants.d.ts +1 -1
- package/components/mui_extended/MenuItem/slots/MenuItemEnum.d.ts +0 -1
- package/components/mui_extended/MenuItem/slots/MenuItemEnum.js +0 -1
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +2 -5
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.js +1 -6
- package/components/mui_extended/NavLink/slots/NavLinkSlots.d.ts +1 -1
- package/components/mui_extended/Radio/slots/styled.d.ts +1 -1
- package/components/mui_extended/Select/Select.js +1 -1
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +3 -3
- package/components/mui_extended/Tab/Slots/TabSlots.d.ts +1 -1
- package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +3 -3
- package/components/mui_extended/Typography/slots/typographySlots.d.ts +1 -1
- package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortSlots.d.ts +3 -3
- package/index.js +108 -82
- package/not_recognized/index.js +25 -100
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getPropertyByString } from "@m4l/core";
|
|
2
|
+
import { C as ColumnNestedValueGroupFormatter } from "./ColumnNestedValueGroupFormatter.js";
|
|
2
3
|
import { useState, useRef, useEffect, useMemo } from "react";
|
|
3
4
|
import { deepEqual } from "fast-equals";
|
|
4
5
|
import { g as getNullGuard } from "../../../../utils/getNullGuard.js";
|
|
@@ -41,6 +42,7 @@ const useColumnNestedValue = (props) => {
|
|
|
41
42
|
}, [props]);
|
|
42
43
|
return useMemo(() => ({
|
|
43
44
|
formatter: ColumnNestedValueFormatter(stateProps),
|
|
45
|
+
renderGroupCell: ColumnNestedValueGroupFormatter(stateProps),
|
|
44
46
|
customFilter: getCustomNestedValueFilter(stateProps),
|
|
45
47
|
customSort: getCustomNestedValueSort(stateProps)
|
|
46
48
|
}), [stateProps]);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ColumnPointsFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar puntos de calibración en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar puntos en el encabezado del grupo. Usa la primera fila
|
|
8
|
+
* del grupo (childRows[0]) como fuente de datos representativa.
|
|
9
|
+
* @param props - Propiedades del formatter que incluyen:
|
|
10
|
+
* - fieldValue: Campo que contiene el valor de los puntos
|
|
11
|
+
* - fieldUnit: Campo que contiene la unidad de los puntos
|
|
12
|
+
* - Component: Componente wrapper opcional
|
|
13
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el PointsFormatter
|
|
14
|
+
*/
|
|
15
|
+
export declare const ColumnPointsGroupFormatter: <TRow>(props: ColumnPointsFormatterProps<TRow>) => (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { P as PointsFormatter } from "../../../formatters/PointsFormatter/PointsFormatter.js";
|
|
4
|
+
const ColumnPointsGroupFormatter = (props) => {
|
|
5
|
+
const { Component = React.Fragment } = props;
|
|
6
|
+
const fieldValue = props.fieldValue;
|
|
7
|
+
const fieldUnit = props.fieldUnit;
|
|
8
|
+
return (groupProps) => {
|
|
9
|
+
const { childRows } = groupProps;
|
|
10
|
+
if (childRows.length === 0) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "-" });
|
|
12
|
+
}
|
|
13
|
+
const representativeRow = childRows[0];
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
PointsFormatter,
|
|
16
|
+
{
|
|
17
|
+
obProps: representativeRow,
|
|
18
|
+
...props,
|
|
19
|
+
fieldValue,
|
|
20
|
+
fieldUnit,
|
|
21
|
+
Component
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
ColumnPointsGroupFormatter as C
|
|
28
|
+
};
|
|
@@ -5,6 +5,7 @@ import { ColumnPointsFormatterProps } from './types';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const useColumnPoints: <TRow>(props: ColumnPointsFormatterProps<TRow>) => {
|
|
7
7
|
formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
customFilter: (row: TRow, value: string) => boolean;
|
|
9
10
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
10
11
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useState, useRef, useEffect, useMemo } from "react";
|
|
2
2
|
import { deepEqual } from "fast-equals";
|
|
3
3
|
import { C as ColumnPointsFormatter } from "./formatter.js";
|
|
4
|
+
import { C as ColumnPointsGroupFormatter } from "./ColumnPointsGroupFormatter.js";
|
|
4
5
|
import { g as getFormatPoints } from "../../../formatters/PointsFormatter/PointsFormatter.js";
|
|
5
6
|
import { g as getColumnKey } from "../../helpers/shared/getColumnKey/getColumnKey.js";
|
|
6
7
|
const getCustomPointsFilter = (props) => {
|
|
@@ -36,6 +37,7 @@ const useColumnPoints = (props) => {
|
|
|
36
37
|
}, [props]);
|
|
37
38
|
return useMemo(() => ({
|
|
38
39
|
formatter: ColumnPointsFormatter(stateProps),
|
|
40
|
+
renderGroupCell: ColumnPointsGroupFormatter(stateProps),
|
|
39
41
|
customFilter: getCustomPointsFilter(stateProps),
|
|
40
42
|
customSort: getCustomPointsSort(stateProps)
|
|
41
43
|
}), [stateProps]);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ColumnPriceFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar un precio en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar un precio en el encabezado del grupo. Usa la primera fila
|
|
8
|
+
* del grupo (childRows[0]) como fuente de datos representativa.
|
|
9
|
+
* @param props - Propiedades del formatter que incluyen:
|
|
10
|
+
* - fieldValue: Campo que contiene el valor del precio
|
|
11
|
+
* - Component: Componente wrapper opcional
|
|
12
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el PriceFormatter
|
|
13
|
+
*/
|
|
14
|
+
export declare const ColumnPriceGroupFormatter: <TRow>(props: ColumnPriceFormatterProps<TRow>) => (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { P as PriceFormatter } from "../../../formatters/PriceFormatter/PriceFormatter.js";
|
|
4
|
+
const ColumnPriceGroupFormatter = (props) => {
|
|
5
|
+
const { Component = React.Fragment } = props;
|
|
6
|
+
const fieldValue = props.fieldValue;
|
|
7
|
+
return (groupProps) => {
|
|
8
|
+
const { childRows } = groupProps;
|
|
9
|
+
if (childRows.length === 0) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "-" });
|
|
11
|
+
}
|
|
12
|
+
const representativeRow = childRows[0];
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
PriceFormatter,
|
|
15
|
+
{
|
|
16
|
+
obProps: representativeRow,
|
|
17
|
+
...props,
|
|
18
|
+
fieldValue,
|
|
19
|
+
Component
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
ColumnPriceGroupFormatter as C
|
|
26
|
+
};
|
|
@@ -5,6 +5,7 @@ import { ColumnPriceFormatterProps } from './types';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const useColumnPrice: <TRow>(props: ColumnPriceFormatterProps<TRow>) => {
|
|
7
7
|
formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
customFilter: (row: TRow, value: string) => boolean;
|
|
9
10
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
10
11
|
};
|
|
@@ -3,6 +3,7 @@ import { useFormatter } from "@m4l/graphics";
|
|
|
3
3
|
import { getPropertyByString } from "@m4l/core";
|
|
4
4
|
import { deepEqual } from "fast-equals";
|
|
5
5
|
import { g as getFormatPrice } from "../../../formatters/PriceFormatter/PriceFormatter.js";
|
|
6
|
+
import { C as ColumnPriceGroupFormatter } from "./ColumnPriceGroupFormatter.js";
|
|
6
7
|
import { C as ColumnPriceFormatter } from "./formatter.js";
|
|
7
8
|
import { g as getColumnKey } from "../../helpers/shared/getColumnKey/getColumnKey.js";
|
|
8
9
|
const getCustomPriceFilter = (props) => {
|
|
@@ -51,6 +52,7 @@ const useColumnPrice = (props) => {
|
|
|
51
52
|
}, [props]);
|
|
52
53
|
return useMemo(() => ({
|
|
53
54
|
formatter: ColumnPriceFormatter(stateProps),
|
|
55
|
+
renderGroupCell: ColumnPriceGroupFormatter(stateProps),
|
|
54
56
|
customFilter,
|
|
55
57
|
customSort: getCustomPriceSort(stateProps)
|
|
56
58
|
}), [stateProps, customFilter]);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ColumnTagsFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar tags en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar tags en el encabezado del grupo. Usa la primera fila
|
|
8
|
+
* del grupo (childRows[0]) como fuente de datos representativa.
|
|
9
|
+
* @param props - Propiedades del formatter que incluyen:
|
|
10
|
+
* - fieldValue: Campo que contiene los tags
|
|
11
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el TagsFormatter
|
|
12
|
+
*/
|
|
13
|
+
export declare const ColumnTagsGroupFormatter: <TRow>(props: ColumnTagsFormatterProps<TRow>) => (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { getPropertyByString } from "@m4l/core";
|
|
3
|
+
import { T as TagsFormatter } from "../../../formatters/TagsFormatter/TagsFormatter.js";
|
|
4
|
+
const ColumnTagsGroupFormatter = (props) => {
|
|
5
|
+
const { fieldValue } = props;
|
|
6
|
+
return (groupProps) => {
|
|
7
|
+
const { childRows } = groupProps;
|
|
8
|
+
if (childRows.length === 0) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "-" });
|
|
10
|
+
}
|
|
11
|
+
const representativeRow = childRows[0];
|
|
12
|
+
const tags = getPropertyByString(
|
|
13
|
+
representativeRow,
|
|
14
|
+
fieldValue.toString()
|
|
15
|
+
);
|
|
16
|
+
return /* @__PURE__ */ jsx(TagsFormatter, { tags });
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
ColumnTagsGroupFormatter as C
|
|
21
|
+
};
|
|
@@ -4,6 +4,7 @@ import { ColumnTagsFormatterProps } from './types';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const useColumnTags: <TRow>(props: ColumnTagsFormatterProps<TRow>) => {
|
|
6
6
|
formatter: (renderProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
customFilter: (row: TRow, value: string) => boolean;
|
|
8
9
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
9
10
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getPropertyByString } from "@m4l/core";
|
|
2
2
|
import { C as ColumnTagsFormatter } from "./formatter.js";
|
|
3
|
+
import { C as ColumnTagsGroupFormatter } from "./ColumnTagsGroupFormatter.js";
|
|
3
4
|
import { deepEqual } from "fast-equals";
|
|
4
5
|
import { useState, useRef, useEffect, useMemo } from "react";
|
|
5
6
|
import { g as getColumnKey } from "../../helpers/shared/getColumnKey/getColumnKey.js";
|
|
@@ -49,6 +50,7 @@ const useColumnTags = (props) => {
|
|
|
49
50
|
return useMemo(
|
|
50
51
|
() => ({
|
|
51
52
|
formatter: ColumnTagsFormatter(stateProps),
|
|
53
|
+
renderGroupCell: ColumnTagsGroupFormatter(stateProps),
|
|
52
54
|
customFilter: getCustomTagFilter(stateProps),
|
|
53
55
|
customSort: getCustomTagSort(stateProps)
|
|
54
56
|
}),
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ColumnUncertaintyFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar valores de incertidumbre en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar el valor de incertidumbre en el encabezado del grupo. Usa la primera fila
|
|
8
|
+
* del grupo (childRows[0]) como fuente de datos representativa.
|
|
9
|
+
* @param props - Propiedades del formatter que incluyen:
|
|
10
|
+
* - fieldValue: Campo con los rangos de incertidumbre
|
|
11
|
+
* - fieldSymbol: Campo con el símbolo
|
|
12
|
+
* - fieldUnit: Campo con la unidad
|
|
13
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el UncertaintyFormatter
|
|
14
|
+
*/
|
|
15
|
+
export declare const ColumnUncertaintyGroupFormatter: <TRow>(props: ColumnUncertaintyFormatterProps<TRow>) => (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { U as UncertaintyFormatter } from "../../../formatters/UncertaintyFormatter/UncertaintyFormatter.js";
|
|
4
|
+
const ColumnUncertaintyGroupFormatter = (props) => {
|
|
5
|
+
const { Component = React.Fragment, fieldValue, fieldSymbol, fieldUnit } = props;
|
|
6
|
+
return (groupProps) => {
|
|
7
|
+
const { childRows } = groupProps;
|
|
8
|
+
if (childRows.length === 0) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "-" });
|
|
10
|
+
}
|
|
11
|
+
const representativeRow = childRows[0];
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
UncertaintyFormatter,
|
|
14
|
+
{
|
|
15
|
+
obProps: representativeRow,
|
|
16
|
+
...props,
|
|
17
|
+
fieldValue: fieldValue.toString(),
|
|
18
|
+
fieldSymbol: fieldSymbol.toString(),
|
|
19
|
+
fieldUnit: fieldUnit.toString(),
|
|
20
|
+
Component
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
ColumnUncertaintyGroupFormatter as C
|
|
27
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { ColumnUncertaintyFormatter } from './formatter';
|
|
2
|
+
export { ColumnUncertaintyGroupFormatter } from './ColumnUncertaintyGroupFormatter';
|
|
2
3
|
export type { ColumnUncertaintyFormatterProps } from './types';
|
|
3
4
|
export { useColumnUncertanity } from './useColumnUncertainty';
|
package/components/datagrids/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { ColumnUncertaintyFormatterProps } from './types';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const useColumnUncertanity: <TRow>(props: ColumnUncertaintyFormatterProps<TRow>) => {
|
|
7
7
|
formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
customFilter: (row: TRow, value: string) => boolean;
|
|
9
10
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
10
11
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useState, useRef, useEffect, useMemo } from "react";
|
|
2
2
|
import { deepEqual } from "fast-equals";
|
|
3
3
|
import { g as getUncertaintyFormat } from "../../../formatters/UncertaintyFormatter/UncertaintyFormatter.js";
|
|
4
|
+
import { C as ColumnUncertaintyGroupFormatter } from "./ColumnUncertaintyGroupFormatter.js";
|
|
4
5
|
import { C as ColumnUncertaintyFormatter } from "./formatter.js";
|
|
5
6
|
import { g as getColumnKey } from "../../helpers/shared/getColumnKey/getColumnKey.js";
|
|
6
7
|
const getCustomUncertaintyFilter = (props) => {
|
|
@@ -44,6 +45,7 @@ const useColumnUncertanity = (props) => {
|
|
|
44
45
|
}, [props]);
|
|
45
46
|
return useMemo(() => ({
|
|
46
47
|
formatter: ColumnUncertaintyFormatter(stateProps),
|
|
48
|
+
renderGroupCell: ColumnUncertaintyGroupFormatter(stateProps),
|
|
47
49
|
customFilter: getCustomUncertaintyFilter(stateProps),
|
|
48
50
|
customSort: getCustomUncertaintySort(stateProps)
|
|
49
51
|
}), [stateProps]);
|
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
|
};
|
|
@@ -24,7 +24,11 @@ const pathIcons = {
|
|
|
24
24
|
viewCards: "frontend/components/data_grid/assets/icons/card.svg",
|
|
25
25
|
info: "frontend/components/data_grid/assets/icons/info.svg",
|
|
26
26
|
expanded: "frontend/components/data_grid/assets/icons/expanded.svg",
|
|
27
|
-
edit: "frontend/components/EditLabel/assets/icons/pencil.svg"
|
|
27
|
+
edit: "frontend/components/EditLabel/assets/icons/pencil.svg",
|
|
28
|
+
group: "frontend/components/data_grid/assets/icons/group.svg",
|
|
29
|
+
removeGroup: "frontend/components/data_grid/assets/icons/remove_group.svg",
|
|
30
|
+
groupUp: "frontend/components/data_grid/assets/icons/group_up.svg",
|
|
31
|
+
groupDown: "frontend/components/data_grid/assets/icons/group_down.svg"
|
|
28
32
|
};
|
|
29
33
|
export {
|
|
30
34
|
pathIcons as p
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { DataGrid } from './components/DataGridMain';
|
|
2
|
+
export { TreeDataGrid } from './components/TreeDataGrid';
|
|
2
3
|
export * from './formatters';
|
|
3
4
|
export type { Column, RenderEditCellProps, RenderCellProps, } from 'react-data-grid';
|
|
4
|
-
export type { RowKey, ChangeConfig, ChangeUserColumn, RowActionsGetter, RowKeyGetter, } from './types';
|
|
5
|
+
export type { RowKey, ChangeConfig, ChangeUserColumn, RowActionsGetter, RowKeyGetter, TreeProps, TreeDataGridProps, } from './types';
|
|
5
6
|
export type { IGridConfigExtended, BaseConfigColumn, } from './contexts/DataGridContext/types';
|
|
6
7
|
export type { IGridConfig } from './helpers/persistence/getColumnsWidth/types';
|
|
7
8
|
export { getDataGridComponentsDictionary } from './dictionary';
|
|
@@ -53,7 +53,9 @@ export declare enum TableSlots {
|
|
|
53
53
|
editorCellWrapper = "editorCellWrapper",
|
|
54
54
|
editablePlaceholder = "editablePlaceholder",
|
|
55
55
|
editLabel = "editLabel",
|
|
56
|
-
iconButtonEdit = "iconButtonEdit"
|
|
56
|
+
iconButtonEdit = "iconButtonEdit",
|
|
57
|
+
defaultRenderGroupCellRoot = "defaultRenderGroupCellRoot",
|
|
58
|
+
defaultRenderGroupCellText = "defaultRenderGroupCellText"
|
|
57
59
|
}
|
|
58
60
|
export declare enum TextEditorSlots {
|
|
59
61
|
inputTexEditor = "inputTexEditor"
|
|
@@ -57,6 +57,8 @@ var TableSlots = /* @__PURE__ */ ((TableSlots2) => {
|
|
|
57
57
|
TableSlots2["editablePlaceholder"] = "editablePlaceholder";
|
|
58
58
|
TableSlots2["editLabel"] = "editLabel";
|
|
59
59
|
TableSlots2["iconButtonEdit"] = "iconButtonEdit";
|
|
60
|
+
TableSlots2["defaultRenderGroupCellRoot"] = "defaultRenderGroupCellRoot";
|
|
61
|
+
TableSlots2["defaultRenderGroupCellText"] = "defaultRenderGroupCellText";
|
|
60
62
|
return TableSlots2;
|
|
61
63
|
})(TableSlots || {});
|
|
62
64
|
var TextEditorSlots = /* @__PURE__ */ ((TextEditorSlots2) => {
|
|
@@ -97,3 +97,5 @@ export declare const ControlNavigateStyled: import('@emotion/styled').StyledComp
|
|
|
97
97
|
* ****************
|
|
98
98
|
*/
|
|
99
99
|
export declare const ColumnIconFormatterStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
100
|
+
export declare const DefaultRenderGroupCellRootStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof import('react').ClassAttributes<HTMLSpanElement> | keyof import('react').HTMLAttributes<HTMLSpanElement>>, {}>;
|
|
101
|
+
export declare const DefaultRenderGroupCellTextStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof import('react').ClassAttributes<HTMLSpanElement> | keyof import('react').HTMLAttributes<HTMLSpanElement>>, {}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styled } from "@mui/material/styles";
|
|
2
2
|
import { MenuList, InputBase } from "@mui/material";
|
|
3
3
|
import { D as DATAGRID_PREFIX_NAME } from "../constants.js";
|
|
4
|
-
import { D as DataGridSlots,
|
|
4
|
+
import { T as TextEditorSlots, D as DataGridSlots, b as TableSlots, A as ActionsSlots, C as ControlNavigateSlots, R as RowsCountSlots, a as ColumnsConfigSlots, c as ColumnIconFormatterSlots } from "./DataGridEnum.js";
|
|
5
5
|
import { d as dataGridStyles } from "../Datagrid.styles.js";
|
|
6
6
|
import { I as Icon } from "../../Icon/Icon.js";
|
|
7
7
|
import { C as Card } from "../../Card/Card.js";
|
|
@@ -231,6 +231,14 @@ styled("div", {
|
|
|
231
231
|
name: DATAGRID_PREFIX_NAME,
|
|
232
232
|
slot: ColumnIconFormatterSlots.columnIconFormatter
|
|
233
233
|
})(dataGridStyles.columnIconFormatter);
|
|
234
|
+
const DefaultRenderGroupCellRootStyled = styled("span", {
|
|
235
|
+
name: DATAGRID_PREFIX_NAME,
|
|
236
|
+
slot: TableSlots.defaultRenderGroupCellRoot
|
|
237
|
+
})(dataGridStyles.defaultRenderGroupCellRoot);
|
|
238
|
+
const DefaultRenderGroupCellTextStyled = styled("span", {
|
|
239
|
+
name: DATAGRID_PREFIX_NAME,
|
|
240
|
+
slot: TableSlots.defaultRenderGroupCellText
|
|
241
|
+
})(dataGridStyles.defaultRenderGroupCellText);
|
|
234
242
|
export {
|
|
235
243
|
ActionsRootStyled as A,
|
|
236
244
|
TableContainerStyled as B,
|
|
@@ -250,10 +258,12 @@ export {
|
|
|
250
258
|
MenuListStyled as P,
|
|
251
259
|
HeaderRenderClickStyled as Q,
|
|
252
260
|
RowsCountRootStyled as R,
|
|
253
|
-
|
|
261
|
+
DefaultRenderGroupCellRootStyled as S,
|
|
254
262
|
TextToggleCardButtonStyled as T,
|
|
263
|
+
DefaultRenderGroupCellTextStyled as U,
|
|
255
264
|
ValueColumnStyled as V,
|
|
256
265
|
WrapperSkeletonStyled as W,
|
|
266
|
+
CheckboxCellWrapperStyled as X,
|
|
257
267
|
ControlNavigateStyled as a,
|
|
258
268
|
RowsCountLabelStyled as b,
|
|
259
269
|
RowsCountValueStyled as c,
|
|
@@ -39,6 +39,18 @@ declare module 'react-data-grid' {
|
|
|
39
39
|
formatter?: (props: any) => JSX.Element;
|
|
40
40
|
/** @deprecated Usa renderEditCell en lugar de editor. Este atributo será removido en una futura versión. */
|
|
41
41
|
editor?: Maybe<(props: RenderEditCellProps<TRow, TSummaryRow>) => ReactNode>;
|
|
42
|
+
/**
|
|
43
|
+
* Si true, la columna puede ser agrupada/desagrupada por el usuario.
|
|
44
|
+
* Solo aplica para TreeDataGrid.
|
|
45
|
+
*/
|
|
46
|
+
groupable?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Si true, la columna está agrupada por defecto.
|
|
49
|
+
* - Con `groupable: true`: el usuario puede cambiar la agrupación.
|
|
50
|
+
* - Sin `groupable` o `groupable: false`: agrupación estática, no se puede cambiar.
|
|
51
|
+
* Solo aplica para TreeDataGrid.
|
|
52
|
+
*/
|
|
53
|
+
grouped?: boolean;
|
|
42
54
|
}
|
|
43
55
|
}
|
|
44
56
|
export declare type RowKey = string | number;
|
|
@@ -319,3 +331,43 @@ export type DataGridOwnerState<TRow, TSummaryRow, TKey extends RowKey = RowKey>
|
|
|
319
331
|
};
|
|
320
332
|
export type DataGridSlotsType = DataGridSlots | TextEditorSlots | ActionsSlots | RowsCountSlots | ColumnsConfigSlots | TableSlots | ControlNavigateSlots | ColumnIconFormatterSlots;
|
|
321
333
|
export type DataGridStyles = OverridesStyleRules<DataGridSlotsType, typeof DATAGRID_PREFIX_NAME, Theme>;
|
|
334
|
+
/**
|
|
335
|
+
* Props específicas de TreeDataGrid (de react-data-grid)
|
|
336
|
+
* Estas props controlan la funcionalidad de agrupación jerárquica.
|
|
337
|
+
*
|
|
338
|
+
* NOTA: groupBy se calcula automáticamente desde columnsConfig.grouped
|
|
339
|
+
* ordenadas por groupOrder. El desarrollador define grouped/groupable en columns.
|
|
340
|
+
*/
|
|
341
|
+
export interface TreeProps<TRow> {
|
|
342
|
+
/**
|
|
343
|
+
* Función que agrupa las filas por una columna.
|
|
344
|
+
*
|
|
345
|
+
* OPCIONAL: Si no se pasa, usa un rowGrouper genérico que agrupa
|
|
346
|
+
* por el valor directo de la columna (row[columnKey]).
|
|
347
|
+
*
|
|
348
|
+
* Solo necesitas pasar un rowGrouper personalizado si quieres
|
|
349
|
+
* transformar los valores antes de agrupar, por ejemplo:
|
|
350
|
+
* - Agrupar fechas por mes ("Enero 2024")
|
|
351
|
+
* - Agrupar números por rango ("$40k - $60k")
|
|
352
|
+
* @see defaultRowGrouper en helpers/defaultRowGrouper
|
|
353
|
+
*/
|
|
354
|
+
rowGrouper?: (rows: readonly TRow[], columnKey: string) => Record<string, readonly TRow[]>;
|
|
355
|
+
/** IDs de grupos expandidos */
|
|
356
|
+
expandedGroupIds?: ReadonlySet<unknown>;
|
|
357
|
+
/** Callback cuando cambian los grupos expandidos */
|
|
358
|
+
onExpandedGroupIdsChange?: (expandedGroupIds: Set<unknown>) => void;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Props completas de TreeDataGrid.
|
|
362
|
+
* Extiende DataGridProps pero sin cardsViewConfig ni defaultViewMode
|
|
363
|
+
* ya que TreeDataGrid solo soporta vista de tabla.
|
|
364
|
+
*/
|
|
365
|
+
export interface TreeDataGridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Omit<DataGridProps<TRow, TSummaryRow, TKey>, 'cardsViewConfig' | 'defaultViewMode'>, TreeProps<TRow> {
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Props para TableView con soporte opcional para TreeDataGrid
|
|
369
|
+
*/
|
|
370
|
+
export type TableViewProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> = GridProps<TRow, TSummaryRow, TKey> & {
|
|
371
|
+
/** Props para TreeDataGrid. Si se pasan, usa TreeDataGrid en lugar de DataGrid */
|
|
372
|
+
treeProps?: TreeProps<TRow>;
|
|
373
|
+
};
|
package/components/datagrids/views/CardsView/hooks/useProcessedColumns/useProcessedColumns.d.ts
CHANGED
|
@@ -47,4 +47,6 @@ export declare function useProcessedColumns<TRow, TSummaryRow>(columns: readonly
|
|
|
47
47
|
customSort?: ((a: TRow, b: TRow) => number) | undefined;
|
|
48
48
|
formatter?: ((props: any) => JSX.Element) | undefined;
|
|
49
49
|
editor?: import('@m4l/core').Maybe<(props: import('react-data-grid').RenderEditCellProps<TRow, TSummaryRow>) => import('react').ReactNode>;
|
|
50
|
+
groupable?: boolean;
|
|
51
|
+
grouped?: boolean;
|
|
50
52
|
}[];
|
package/components/datagrids/views/CardsView/hooks/useProcessedColumns/useProcessedColumns.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { SELECT_COLUMN_KEY } from "react-data-grid";
|
|
3
|
+
import { d as DATAGRID_ACTIONS_COLUMN_KEY } from "../../../../constants.js";
|
|
3
4
|
import { u as useDataGrid } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
4
5
|
function useProcessedColumns(columns, options = {}) {
|
|
5
6
|
const { applyVisibilityFilter = true } = options;
|
|
@@ -10,7 +11,7 @@ function useProcessedColumns(columns, options = {}) {
|
|
|
10
11
|
);
|
|
11
12
|
return useMemo(() => {
|
|
12
13
|
const processedColumns = columns.filter((column) => {
|
|
13
|
-
if (column.key ===
|
|
14
|
+
if (column.key === SELECT_COLUMN_KEY || column.key === DATAGRID_ACTIONS_COLUMN_KEY) {
|
|
14
15
|
return false;
|
|
15
16
|
}
|
|
16
17
|
if (!applyVisibilityFilter) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GridProps, RowKey } from '../../types';
|
|
1
|
+
import { RowKey, TableViewProps } from '../../types';
|
|
3
2
|
/**
|
|
4
3
|
* Componente que renderiza la tabla con las filas y columnas
|
|
5
|
-
* Acepta todos los props de DataGrid y prioriza las configuraciones personalizadas
|
|
4
|
+
* Acepta todos los props de DataGrid y prioriza las configuraciones personalizadas.
|
|
5
|
+
* Si se proporcionan treeProps, renderiza TreeDataGrid en lugar de DataGrid.
|
|
6
6
|
*/
|
|
7
|
-
export declare function TableView<TRow, TSummaryRow, TKey extends RowKey = RowKey>(props:
|
|
7
|
+
export declare function TableView<TRow, TSummaryRow, TKey extends RowKey = RowKey>(props: TableViewProps<TRow, TSummaryRow, TKey>): import("react/jsx-runtime").JSX.Element;
|