@m4l/components 9.3.23 → 9.3.24-JT04112025.beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/export.d.ts +6 -0
- package/@types/types.d.ts +26 -1
- package/components/DataGrid/DataGrid.js +6 -2
- package/components/DataGrid/Datagrid.styles.js +67 -18
- package/components/DataGrid/constants.d.ts +19 -0
- package/components/DataGrid/formatters/ColumnIconFormatter/formatter.d.ts +1 -2
- package/components/DataGrid/formatters/ColumnIconFormatter/formatter.js +3 -6
- package/components/DataGrid/formatters/ColumnIconFormatter/types.d.ts +2 -4
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/formatter.js +7 -1
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/types.d.ts +1 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/formatter.d.ts +8 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/formatter.js +16 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/index.js +1 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/types.d.ts +5 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/useColumnTags.d.ts +9 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/useColumnTags.js +60 -0
- package/components/DataGrid/formatters/index.d.ts +1 -0
- package/components/DataGrid/hooks/useModalCardDetail.d.ts +2 -2
- package/components/DataGrid/hooks/useModalCardDetail.js +49 -48
- package/components/DataGrid/slots/DataGridEnum.d.ts +2 -0
- package/components/DataGrid/slots/DataGridEnum.js +2 -0
- package/components/DataGrid/slots/DataGridSlot.d.ts +3 -1
- package/components/DataGrid/slots/DataGridSlot.js +45 -37
- package/components/DataGrid/subcomponents/Cards/helpers/calculateCardHeight.d.ts +18 -0
- package/components/DataGrid/subcomponents/Cards/helpers/calculateCardHeight.js +10 -0
- package/components/DataGrid/subcomponents/Cards/helpers/scrollToCardElement.d.ts +9 -0
- package/components/DataGrid/subcomponents/Cards/helpers/scrollToCardElement.js +25 -0
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +1 -2
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +62 -73
- package/components/DataGrid/subcomponents/Cards/index.js +71 -16
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +36 -18
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +13 -20
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +6 -1
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +67 -36
- package/components/DataGrid/subcomponents/Cards/subcomponents/IntersectCard/index.js +9 -2
- package/components/DataGrid/subcomponents/Cards/subcomponents/LazyLoadCard/index.js +4 -2
- package/components/DataGrid/subcomponents/Cards/types.d.ts +50 -1
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +5 -2
- package/components/DataGrid/subcomponents/ControlNavigate/ControlNavigate.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/RowsCount/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/index.js +1 -1
- package/components/DataGrid/subcomponents/Table/index.js +60 -41
- package/components/DataGrid/subcomponents/Table/subcomponents/CheckboxFormatter.js +16 -18
- package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +3 -3
- package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
- package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
- package/components/DataGrid/tests/helpers/types.d.ts +3 -0
- package/components/DataGrid/types.d.ts +17 -2
- package/components/DynamicFilter/helpers/formatToInitialFilters.js +3 -3
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.js +11 -3
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.js +16 -4
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.js +11 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.js +21 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.js +18 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.js +5 -3
- package/components/ObjectLogs/slots/ObjectLogsSlots.js +3 -5
- package/components/formatters/IconsFormatter/IconsFormatter.d.ts +6 -0
- package/components/formatters/IconsFormatter/IconsFormatter.js +22 -0
- package/components/formatters/IconsFormatter/IconsFormatter.styles.d.ts +2 -0
- package/components/formatters/IconsFormatter/IconsFormatter.styles.js +29 -0
- package/components/formatters/IconsFormatter/constants.d.ts +1 -0
- package/components/formatters/IconsFormatter/constants.js +4 -0
- package/components/{DataGrid/formatters/ColumnIconFormatter → formatters/IconsFormatter}/helpers/renderIcon.d.ts +2 -2
- package/components/formatters/IconsFormatter/helpers/renderIcon.js +24 -0
- package/components/formatters/IconsFormatter/helpers/renderMultipleIcons.d.ts +7 -0
- package/components/formatters/IconsFormatter/helpers/renderMultipleIcons.js +16 -0
- package/components/formatters/IconsFormatter/index.d.ts +3 -0
- package/components/formatters/IconsFormatter/index.js +1 -0
- package/components/formatters/IconsFormatter/slots/IconsFormatterEnum.d.ts +5 -0
- package/components/formatters/IconsFormatter/slots/IconsFormatterEnum.js +9 -0
- package/components/formatters/IconsFormatter/slots/IconsFormatterSlots.d.ts +9 -0
- package/components/formatters/IconsFormatter/slots/IconsFormatterSlots.js +22 -0
- package/components/formatters/IconsFormatter/types.d.ts +57 -0
- package/components/formatters/IconsFormatter/types.js +1 -0
- package/components/formatters/TagsFormatter/TagsFormatter.d.ts +5 -0
- package/components/formatters/TagsFormatter/TagsFormatter.js +28 -0
- package/components/formatters/TagsFormatter/TagsFormatter.styles.d.ts +2 -0
- package/components/formatters/TagsFormatter/TagsFormatter.styles.js +41 -0
- package/components/formatters/TagsFormatter/constants.d.ts +5 -0
- package/components/formatters/TagsFormatter/constants.js +11 -0
- package/components/formatters/TagsFormatter/helpers/renderMultipleTag.d.ts +8 -0
- package/components/formatters/TagsFormatter/helpers/renderMultipleTag.js +19 -0
- package/components/formatters/TagsFormatter/helpers/renderTag.d.ts +7 -0
- package/components/formatters/TagsFormatter/helpers/renderTag.js +9 -0
- package/components/formatters/TagsFormatter/helpers/validateHexColor.d.ts +8 -0
- package/components/formatters/TagsFormatter/helpers/validateHexColor.js +9 -0
- package/components/formatters/TagsFormatter/index.d.ts +2 -0
- package/components/formatters/TagsFormatter/index.js +1 -0
- package/components/formatters/TagsFormatter/slots/TagsFormatterEnum.d.ts +5 -0
- package/components/formatters/TagsFormatter/slots/TagsFormatterEnum.js +9 -0
- package/components/formatters/TagsFormatter/slots/TagsFormatterSlots.d.ts +6 -0
- package/components/formatters/TagsFormatter/slots/TagsFormatterSlots.js +16 -0
- package/components/formatters/TagsFormatter/subcomponents/Tag/Tag.d.ts +5 -0
- package/components/formatters/TagsFormatter/subcomponents/Tag/Tag.js +35 -0
- package/components/formatters/TagsFormatter/subcomponents/Tag/index.d.ts +0 -0
- package/components/formatters/TagsFormatter/types.d.ts +47 -0
- package/components/formatters/index.d.ts +6 -5
- package/contexts/ModalContext/index.js +5 -5
- package/index.js +62 -56
- package/package.json +1 -1
- package/components/DataGrid/formatters/ColumnIconFormatter/constants.js +0 -4
- package/components/DataGrid/formatters/ColumnIconFormatter/helpers/renderIcon.js +0 -58
- package/components/DataGrid/formatters/ColumnIconFormatter/helpers/renderMultipleIcons.d.ts +0 -7
- package/components/DataGrid/formatters/ColumnIconFormatter/helpers/renderMultipleIcons.js +0 -19
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs,
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
import { j as CardStyled } from "../../../../slots/DataGridSlot.js";
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useMemo } from "react";
|
|
3
|
+
import { i as CardContentWrapperStyled, j as CardContentStyled, k as CardStyled } from "../../../../slots/DataGridSlot.js";
|
|
4
4
|
import { L as LazyLoadCard } from "../LazyLoadCard/index.js";
|
|
5
5
|
import { u as useCardContent } from "../../hooks/useCardContent.js";
|
|
6
6
|
import { C as CardHeader } from "../CardHeader/index.js";
|
|
7
|
-
import {
|
|
8
|
-
function
|
|
7
|
+
import { deepEqual } from "fast-equals";
|
|
8
|
+
function CardRowComponent({
|
|
9
9
|
row,
|
|
10
10
|
columns,
|
|
11
11
|
originalColumns,
|
|
@@ -13,30 +13,56 @@ function CardRow({
|
|
|
13
13
|
selectedRows,
|
|
14
14
|
onSelectedRowsChange,
|
|
15
15
|
onRowsChange,
|
|
16
|
-
customRender
|
|
16
|
+
customRender,
|
|
17
|
+
minHeight,
|
|
18
|
+
isChecked,
|
|
19
|
+
checkedRows,
|
|
20
|
+
showCheckbox,
|
|
21
|
+
onCheckedRowsChange,
|
|
22
|
+
onOpenDetail
|
|
17
23
|
}) {
|
|
18
|
-
const { checkedRows } = useDataGrid();
|
|
19
24
|
const hasCustomRender = customRender !== void 0;
|
|
20
|
-
const { cardContent
|
|
25
|
+
const { cardContent } = useCardContent({
|
|
21
26
|
row,
|
|
22
27
|
columns,
|
|
23
|
-
originalColumns,
|
|
24
28
|
onRowsChange
|
|
25
29
|
});
|
|
26
|
-
const isChecked = useMemo(
|
|
27
|
-
() => checkedRows?.has(rowKeyGetter(row)) || false,
|
|
28
|
-
[checkedRows, rowKeyGetter, row]
|
|
29
|
-
);
|
|
30
30
|
const content = useMemo(() => {
|
|
31
31
|
if (hasCustomRender) {
|
|
32
32
|
return customRender.renderContent(row);
|
|
33
33
|
}
|
|
34
|
-
return /* @__PURE__ */ jsxs(
|
|
35
|
-
/* @__PURE__ */ jsx(
|
|
36
|
-
|
|
34
|
+
return /* @__PURE__ */ jsxs(CardContentWrapperStyled, { children: [
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
CardHeader,
|
|
37
|
+
{
|
|
38
|
+
row,
|
|
39
|
+
onOpenDetail,
|
|
40
|
+
isChecked,
|
|
41
|
+
showCheckbox,
|
|
42
|
+
checkedRows,
|
|
43
|
+
onCheckedRowsChange
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ jsx(CardContentStyled, { children: cardContent })
|
|
37
47
|
] });
|
|
38
|
-
}, [
|
|
39
|
-
|
|
48
|
+
}, [
|
|
49
|
+
hasCustomRender,
|
|
50
|
+
customRender,
|
|
51
|
+
row,
|
|
52
|
+
cardContent,
|
|
53
|
+
isChecked,
|
|
54
|
+
showCheckbox,
|
|
55
|
+
checkedRows,
|
|
56
|
+
onCheckedRowsChange
|
|
57
|
+
]);
|
|
58
|
+
const onCardClick = (e) => {
|
|
59
|
+
const target = e.target;
|
|
60
|
+
const isInteractiveElement = target.closest(
|
|
61
|
+
'input, button, a, [role="button"], .MuiCheckbox-root, .MuiIconButton-root'
|
|
62
|
+
);
|
|
63
|
+
if (isInteractiveElement) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
40
66
|
if (selectedRows && onSelectedRowsChange) {
|
|
41
67
|
if (selectedRows.has(rowKeyGetter(row))) {
|
|
42
68
|
return;
|
|
@@ -45,27 +71,32 @@ function CardRow({
|
|
|
45
71
|
onSelectedRowsChange(mySet);
|
|
46
72
|
}
|
|
47
73
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return customRender.minHeight;
|
|
51
|
-
}
|
|
52
|
-
return Math.max(120, columnsCount * 32 + 40);
|
|
53
|
-
}, [hasCustomRender, customRender, columnsCount]);
|
|
54
|
-
return /* @__PURE__ */ jsx(LazyLoadCard, { threshold: 200, minHeight: dynamicMinHeight, children: /* @__PURE__ */ jsx(
|
|
55
|
-
CardStyled,
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
LazyLoadCard,
|
|
56
76
|
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
77
|
+
threshold: 200,
|
|
78
|
+
minHeight,
|
|
79
|
+
rowKey: rowKeyGetter(row),
|
|
80
|
+
children: /* @__PURE__ */ jsx(
|
|
81
|
+
CardStyled,
|
|
82
|
+
{
|
|
83
|
+
variant: "outlined",
|
|
84
|
+
selected: selectedRows?.has(rowKeyGetter(row)),
|
|
85
|
+
ownerState: {
|
|
86
|
+
checked: isChecked,
|
|
87
|
+
selected: selectedRows?.has(rowKeyGetter(row))
|
|
88
|
+
},
|
|
89
|
+
onClick: onCardClick,
|
|
90
|
+
"data-testid": "data-grid-card",
|
|
91
|
+
children: content
|
|
92
|
+
}
|
|
93
|
+
)
|
|
66
94
|
}
|
|
67
|
-
)
|
|
95
|
+
);
|
|
68
96
|
}
|
|
97
|
+
const CardRow = React.memo(CardRowComponent, (prevProps, nextProps) => {
|
|
98
|
+
return deepEqual(prevProps, nextProps);
|
|
99
|
+
});
|
|
69
100
|
export {
|
|
70
101
|
CardRow as C
|
|
71
102
|
};
|
|
@@ -22,7 +22,7 @@ const IntersectCardStyled = styled("div")(
|
|
|
22
22
|
})
|
|
23
23
|
);
|
|
24
24
|
function IntersectCard(props) {
|
|
25
|
-
const { setIsVisible, threshold, minHeight = 120 } = props;
|
|
25
|
+
const { setIsVisible, threshold, minHeight = 120, rowKey } = props;
|
|
26
26
|
const [observer] = useState(
|
|
27
27
|
getObserver(threshold)
|
|
28
28
|
);
|
|
@@ -39,7 +39,14 @@ function IntersectCard(props) {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
}, [observer, setIsVisible]);
|
|
42
|
-
return /* @__PURE__ */ jsx(
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
IntersectCardStyled,
|
|
44
|
+
{
|
|
45
|
+
ref: intersectCardRef,
|
|
46
|
+
minHeight,
|
|
47
|
+
"data-row-key": rowKey
|
|
48
|
+
}
|
|
49
|
+
);
|
|
43
50
|
}
|
|
44
51
|
export {
|
|
45
52
|
IntersectCard as I
|
|
@@ -9,7 +9,8 @@ function LazyLoadCard(props) {
|
|
|
9
9
|
children,
|
|
10
10
|
enableIntersectionObserver = true,
|
|
11
11
|
threshold = 100,
|
|
12
|
-
minHeight = 120
|
|
12
|
+
minHeight = 120,
|
|
13
|
+
rowKey
|
|
13
14
|
} = props;
|
|
14
15
|
const [isVisible, setIsVisible] = useState(
|
|
15
16
|
!(enableIntersectionObserver && isIntersectionObserverAvailable())
|
|
@@ -24,7 +25,8 @@ function LazyLoadCard(props) {
|
|
|
24
25
|
{
|
|
25
26
|
setIsVisible,
|
|
26
27
|
threshold,
|
|
27
|
-
minHeight
|
|
28
|
+
minHeight,
|
|
29
|
+
rowKey
|
|
28
30
|
}
|
|
29
31
|
)
|
|
30
32
|
) });
|
|
@@ -25,6 +25,10 @@ export interface IntersectCardProps {
|
|
|
25
25
|
* @default '120px'
|
|
26
26
|
*/
|
|
27
27
|
minHeight?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Clave de la fila
|
|
30
|
+
*/
|
|
31
|
+
rowKey?: string | number;
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
34
|
* Tipo extendido para el elemento div que incluye el método setIsVisible.
|
|
@@ -61,6 +65,10 @@ export interface LazyLoadCardProps {
|
|
|
61
65
|
* @default 120
|
|
62
66
|
*/
|
|
63
67
|
minHeight?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Clave de la fila
|
|
70
|
+
*/
|
|
71
|
+
rowKey?: string | number;
|
|
64
72
|
}
|
|
65
73
|
/**
|
|
66
74
|
* Props para el componente CardRow
|
|
@@ -98,6 +106,30 @@ export interface CardRowProps<TRow, TKey extends RowKey = RowKey> {
|
|
|
98
106
|
* Indica si se debe renderizar el contenido personalizado de la tarjeta
|
|
99
107
|
*/
|
|
100
108
|
customRender?: CardsViewConfig<TRow>['customRender'];
|
|
109
|
+
/**
|
|
110
|
+
* Altura mínima de la tarjeta
|
|
111
|
+
*/
|
|
112
|
+
minHeight: number;
|
|
113
|
+
/**
|
|
114
|
+
* Indica si la fila está chequeada
|
|
115
|
+
*/
|
|
116
|
+
isChecked: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Indica si se debe mostrar el checkbox para checkedRows
|
|
119
|
+
*/
|
|
120
|
+
showCheckbox: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Filas chequeadas actualmente
|
|
123
|
+
*/
|
|
124
|
+
checkedRows?: ReadonlySet<TKey>;
|
|
125
|
+
/**
|
|
126
|
+
* Función para manejar el cambio de filas chequeadas
|
|
127
|
+
*/
|
|
128
|
+
onCheckedRowsChange?: (mapRowsChecked: ReadonlySet<TKey>) => void;
|
|
129
|
+
/**
|
|
130
|
+
* Función para abrir el modal de detalle de la fila
|
|
131
|
+
*/
|
|
132
|
+
onOpenDetail: (row: TRow) => void;
|
|
101
133
|
}
|
|
102
134
|
/**
|
|
103
135
|
* Props para el componente CardDetails
|
|
@@ -114,5 +146,22 @@ export interface CardDetailsProps<TRow> {
|
|
|
114
146
|
*/
|
|
115
147
|
export interface CardHeaderProps<TRow> {
|
|
116
148
|
row: TRow;
|
|
117
|
-
onOpenDetail: () => void;
|
|
149
|
+
onOpenDetail: (row: TRow) => void;
|
|
150
|
+
isChecked?: boolean;
|
|
151
|
+
showCheckbox?: boolean;
|
|
152
|
+
checkedRows?: ReadonlySet<any>;
|
|
153
|
+
onCheckedRowsChange?: (rows: ReadonlySet<any>) => void;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Props para el helper calculateCardHeight
|
|
157
|
+
*/
|
|
158
|
+
export interface CalculateCardHeightProps {
|
|
159
|
+
/**
|
|
160
|
+
* Número de columnas visibles en la card
|
|
161
|
+
*/
|
|
162
|
+
visibleColumnsCount: number;
|
|
163
|
+
/**
|
|
164
|
+
* Altura mínima personalizada (opcional, para customRender)
|
|
165
|
+
*/
|
|
166
|
+
customMinHeight?: number;
|
|
118
167
|
}
|
|
@@ -3,7 +3,7 @@ import { forwardRef, useContext } from "react";
|
|
|
3
3
|
import { SelectCellFormatter } from "react-data-grid";
|
|
4
4
|
import { C as CheckboxFormatter } from "../Table/subcomponents/CheckboxFormatter.js";
|
|
5
5
|
import { a as DataGridContext } from "../../contexts/DataGridContext/index.js";
|
|
6
|
-
import {
|
|
6
|
+
import { l as CheckboxCellWrapperStyled } from "../../slots/DataGridSlot.js";
|
|
7
7
|
const CheckboxCellAdapter = forwardRef(function CheckboxCellAdapter2(props, ref) {
|
|
8
8
|
const {
|
|
9
9
|
value,
|
|
@@ -15,7 +15,10 @@ const CheckboxCellAdapter = forwardRef(function CheckboxCellAdapter2(props, ref)
|
|
|
15
15
|
const context = useContext(DataGridContext);
|
|
16
16
|
const viewMode = context?.viewMode ?? "cards";
|
|
17
17
|
if (viewMode !== "table") {
|
|
18
|
-
|
|
18
|
+
const handleClick = (e) => {
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ jsx(CheckboxCellWrapperStyled, { onClick: handleClick, children: /* @__PURE__ */ jsx(
|
|
19
22
|
CheckboxFormatter,
|
|
20
23
|
{
|
|
21
24
|
ref,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useIsMobile } from "@m4l/graphics";
|
|
3
|
-
import {
|
|
3
|
+
import { m as ControlNavigateStyled } from "../../slots/DataGridSlot.js";
|
|
4
4
|
import { R as RowsCount } from "../HeaderActions/subcomponents/RowsCount/index.js";
|
|
5
5
|
import { u as useComponentSize } from "../../../../hooks/useComponentSize/useComponentSize.js";
|
|
6
6
|
import { P as Pager } from "../../../Pager/Pager.js";
|
|
@@ -6,7 +6,7 @@ import { V as ViewMode } from "./subcomponents/ViewMode/index.js";
|
|
|
6
6
|
import { u as useDataGrid } from "../../hooks/useDataGrid.js";
|
|
7
7
|
import { useIsMobile } from "@m4l/graphics";
|
|
8
8
|
import { M as MobileMenuActions } from "./subcomponents/MobileMenuActions/index.js";
|
|
9
|
-
import { A as ActionsRootStyled,
|
|
9
|
+
import { A as ActionsRootStyled, n as ActionsConfigContainerStyled, o as ContainerLeftActionsStyled, p as ContainerRightActionsStyled } from "../../slots/DataGridSlot.js";
|
|
10
10
|
import { u as useComponentSize } from "../../../../hooks/useComponentSize/useComponentSize.js";
|
|
11
11
|
function HeaderActions(props) {
|
|
12
12
|
const {
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useModuleDictionary, useModuleSkeleton } from "@m4l/core";
|
|
3
3
|
import { Skeleton } from "@mui/material";
|
|
4
4
|
import { u as useDataGrid } from "../../../../hooks/useDataGrid.js";
|
|
5
|
-
import { R as RowsCountRootStyled,
|
|
5
|
+
import { R as RowsCountRootStyled, q as RowsCountLabelStyled, r as RowsCountValueStyled } from "../../../../slots/DataGridSlot.js";
|
|
6
6
|
function RowsCount() {
|
|
7
7
|
const { rowsCount, size } = useDataGrid();
|
|
8
8
|
const { getLabel } = useModuleDictionary();
|
|
@@ -4,7 +4,7 @@ import { useModuleDictionary, useEnvironment } from "@m4l/core";
|
|
|
4
4
|
import DataGrid from "react-data-grid";
|
|
5
5
|
import { I as IconButton } from "../../../../../../../mui_extended/IconButton/IconButton.js";
|
|
6
6
|
import { p as pathIcons } from "../../../../../../icons.js";
|
|
7
|
-
import {
|
|
7
|
+
import { s as ColumnsConfigWrapperStyled, t as ColumnsConfigDataGridStyled, u as ColumnsConfigSelColumnsStyled, T as TableWrapperDataGridStyled, v as ColumnsConfigActiosStyled } from "../../../../../../slots/DataGridSlot.js";
|
|
8
8
|
import { D as DICTIONARY } from "../../../../../../dictionary.js";
|
|
9
9
|
import { C as ColumnInteractiveCheckFormatter } from "../../../../../../formatters/ColumnInteractiveCheckFormatter/formatter.js";
|
|
10
10
|
function getRowsFromColumnsConfig(columnsConfig, columns) {
|
|
@@ -4,7 +4,7 @@ import { useModuleDictionary, useEnvironment } from "@m4l/core";
|
|
|
4
4
|
import DataGrid from "react-data-grid";
|
|
5
5
|
import { I as IconButton } from "../../../../../../../mui_extended/IconButton/IconButton.js";
|
|
6
6
|
import { p as pathIcons } from "../../../../../../icons.js";
|
|
7
|
-
import {
|
|
7
|
+
import { s as ColumnsConfigWrapperStyled, t as ColumnsConfigDataGridStyled, u as ColumnsConfigSelColumnsStyled, T as TableWrapperDataGridStyled, v as ColumnsConfigActiosStyled } from "../../../../../../slots/DataGridSlot.js";
|
|
8
8
|
import { D as DICTIONARY } from "../../../../../../dictionary.js";
|
|
9
9
|
import { C as ColumnInteractiveCheckFormatter } from "../../../../../../formatters/ColumnInteractiveCheckFormatter/formatter.js";
|
|
10
10
|
function getRowsFromColumnsConfigCards(columnsConfigCards, columns) {
|
|
@@ -6,7 +6,7 @@ import { I as IconButton } from "../../../../../mui_extended/IconButton/IconButt
|
|
|
6
6
|
import { P as Popover } from "../../../../../mui_extended/Popover/Popover.js";
|
|
7
7
|
import { p as pathIcons } from "../../../../icons.js";
|
|
8
8
|
import { D as DICTIONARY } from "../../../../dictionary.js";
|
|
9
|
-
import {
|
|
9
|
+
import { w as ContainerToggleCardsStyled, x as CardToggleButtonStyled, y as TextToggleCardButtonStyled } from "../../../../slots/DataGridSlot.js";
|
|
10
10
|
import { I as Icon } from "../../../../../Icon/Icon.js";
|
|
11
11
|
function ViewMode() {
|
|
12
12
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
@@ -5,7 +5,7 @@ import { useRef, useCallback } from "react";
|
|
|
5
5
|
import { u as useDataGrid } from "../../../../../hooks/useDataGrid.js";
|
|
6
6
|
import { u as useModal } from "../../../../../../../hooks/useModal/index.js";
|
|
7
7
|
import { C as ColumnsConfig } from "../../Settings/subcomponents/ColumnsConfig/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { a as ContentModalSettingStyled, D as DataGridRootStyled } from "../../../../../slots/DataGridSlot.js";
|
|
9
9
|
import { p as pathIcons } from "../../../../../icons.js";
|
|
10
10
|
import { A as ActionsContainer } from "../../../../../../CommonActions/components/ActionsContainer/ActionsContainer.js";
|
|
11
11
|
import { W as WindowBase } from "../../../../../../WindowBase/WindowBase.js";
|
|
@@ -4,7 +4,7 @@ import { useIsMobile } from "@m4l/graphics";
|
|
|
4
4
|
import { useRef, useCallback } from "react";
|
|
5
5
|
import { u as useDataGrid } from "../../../../../hooks/useDataGrid.js";
|
|
6
6
|
import { u as useModal } from "../../../../../../../hooks/useModal/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { a as ContentModalSettingStyled, D as DataGridRootStyled } from "../../../../../slots/DataGridSlot.js";
|
|
8
8
|
import { p as pathIcons } from "../../../../../icons.js";
|
|
9
9
|
import { C as ColumnsConfigCards } from "../../Settings/subcomponents/ColumnsConfigCards/index.js";
|
|
10
10
|
import { A as ActionsContainer } from "../../../../../../CommonActions/components/ActionsContainer/ActionsContainer.js";
|
|
@@ -8,7 +8,7 @@ import { a as filterHeight } from "./subcomponents/SelectColumn.js";
|
|
|
8
8
|
import { u as useSortColumnsRows } from "./hooks/useSortColumnsRows.js";
|
|
9
9
|
import { u as useFilters } from "../../hooks/useFilters.js";
|
|
10
10
|
import { u as useDataGrid } from "../../hooks/useDataGrid.js";
|
|
11
|
-
import {
|
|
11
|
+
import { z as TableContainerStyled, T as TableWrapperDataGridStyled } from "../../slots/DataGridSlot.js";
|
|
12
12
|
import { u as useHeaderMenuActions } from "./hooks/useHeaderMenuActions.js";
|
|
13
13
|
import { H as HeaderRenderClick } from "./subcomponents/HeaderRenderClick/HeaderRenderClick.js";
|
|
14
14
|
function Table(props) {
|
|
@@ -20,6 +20,7 @@ function Table(props) {
|
|
|
20
20
|
selectedRows,
|
|
21
21
|
onSelectedRowsChange,
|
|
22
22
|
defaultColumnOptions: defaultColumnOptionsProp,
|
|
23
|
+
focusOnRowKey,
|
|
23
24
|
...restProps
|
|
24
25
|
} = props;
|
|
25
26
|
const renderCheckbox = (formatterProps) => {
|
|
@@ -57,6 +58,7 @@ function Table(props) {
|
|
|
57
58
|
setRowsCount,
|
|
58
59
|
currentRowHeight,
|
|
59
60
|
currentRowHeaderHeight,
|
|
61
|
+
currentRowHeightVariant,
|
|
60
62
|
size,
|
|
61
63
|
sortColumns,
|
|
62
64
|
setSortColumns
|
|
@@ -109,6 +111,17 @@ function Table(props) {
|
|
|
109
111
|
useEffect(() => {
|
|
110
112
|
setRowsCount(finalRows.length);
|
|
111
113
|
}, [finalRows]);
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (!focusOnRowKey) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const rowIndex = finalRows.findIndex(
|
|
119
|
+
(row) => rowKeyGetter(row) === focusOnRowKey
|
|
120
|
+
);
|
|
121
|
+
if (rowIndex !== -1) {
|
|
122
|
+
ref_data_grid.current?.scrollToCell({ rowIdx: rowIndex });
|
|
123
|
+
}
|
|
124
|
+
}, [focusOnRowKey, finalRows, rowKeyGetter]);
|
|
112
125
|
const onColumnResize = (idx, width) => {
|
|
113
126
|
onChangeColumnWidth(finalColumns[idx].key, width);
|
|
114
127
|
};
|
|
@@ -123,47 +136,53 @@ function Table(props) {
|
|
|
123
136
|
Boolean(defaultColumnOptions.sortable),
|
|
124
137
|
handleSortFromPopover
|
|
125
138
|
);
|
|
126
|
-
return /* @__PURE__ */ jsx(TableContainerStyled, { id: "WrapperTable", children: /* @__PURE__ */ jsxs(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
{
|
|
154
|
-
externalOpen: popoverState.anchorEl,
|
|
155
|
-
onOpen: (open) => {
|
|
156
|
-
if (!open) {
|
|
157
|
-
setPopoverState({
|
|
158
|
-
anchorEl: null,
|
|
159
|
-
columnKey: null
|
|
160
|
-
});
|
|
139
|
+
return /* @__PURE__ */ jsx(TableContainerStyled, { id: "WrapperTable", children: /* @__PURE__ */ jsxs(
|
|
140
|
+
TableWrapperDataGridStyled,
|
|
141
|
+
{
|
|
142
|
+
ownerState: { size, currentRowHeightVariant, currentRowHeight },
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ jsx(DndProvider, { backend: HTML5Backend, context: window, children: /* @__PURE__ */ jsx(
|
|
145
|
+
DataGrid,
|
|
146
|
+
{
|
|
147
|
+
className: "rdg-light",
|
|
148
|
+
ref: ref_data_grid,
|
|
149
|
+
headerRowHeight: activeFilters ? currentRowHeaderHeight + filterHeight : currentRowHeaderHeight,
|
|
150
|
+
columns: finalColumns,
|
|
151
|
+
sortColumns,
|
|
152
|
+
onSortColumnsChange: handleSortColumnsChange,
|
|
153
|
+
onColumnResize,
|
|
154
|
+
rows: finalRows,
|
|
155
|
+
onRowsChange,
|
|
156
|
+
selectedRows,
|
|
157
|
+
onSelectedRowsChange,
|
|
158
|
+
onCellClick,
|
|
159
|
+
rowHeight: currentRowHeight,
|
|
160
|
+
rowKeyGetter,
|
|
161
|
+
renderers: {
|
|
162
|
+
renderCheckbox
|
|
163
|
+
},
|
|
164
|
+
defaultColumnOptions,
|
|
165
|
+
...restProps
|
|
161
166
|
}
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
+
) }),
|
|
168
|
+
popoverState.columnKey && popoverState.anchorEl instanceof HTMLDivElement && /* @__PURE__ */ jsx(
|
|
169
|
+
HeaderRenderClick,
|
|
170
|
+
{
|
|
171
|
+
externalOpen: popoverState.anchorEl,
|
|
172
|
+
onOpen: (open) => {
|
|
173
|
+
if (!open) {
|
|
174
|
+
setPopoverState({
|
|
175
|
+
anchorEl: null,
|
|
176
|
+
columnKey: null
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
menuActions
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
) });
|
|
167
186
|
}
|
|
168
187
|
export {
|
|
169
188
|
Table as T
|
|
@@ -2,25 +2,23 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { C as CheckboxIndeterminateIcon, a as CheckboxCheckedIcon, b as CheckboxIcon } from "./CustomIcons.js";
|
|
4
4
|
import { Checkbox } from "@mui/material";
|
|
5
|
-
const CheckboxFormatter = forwardRef(
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
onChange(e.target.checked, e.nativeEvent.shiftKey);
|
|
9
|
-
}
|
|
10
|
-
return /* @__PURE__ */ jsx(
|
|
11
|
-
Checkbox,
|
|
12
|
-
{
|
|
13
|
-
checked,
|
|
14
|
-
size: "small",
|
|
15
|
-
icon: /* @__PURE__ */ jsx(CheckboxIcon, {}),
|
|
16
|
-
checkedIcon: /* @__PURE__ */ jsx(CheckboxCheckedIcon, {}),
|
|
17
|
-
indeterminateIcon: /* @__PURE__ */ jsx(CheckboxIndeterminateIcon, {}),
|
|
18
|
-
onChange: handleChange,
|
|
19
|
-
...props
|
|
20
|
-
}
|
|
21
|
-
);
|
|
5
|
+
const CheckboxFormatter = forwardRef(function CheckboxFormatter2({ onChange, checked, ...props }, _ref) {
|
|
6
|
+
function handleChange(e) {
|
|
7
|
+
onChange(e.target.checked, e.nativeEvent.shiftKey);
|
|
22
8
|
}
|
|
23
|
-
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
Checkbox,
|
|
11
|
+
{
|
|
12
|
+
checked,
|
|
13
|
+
size: "small",
|
|
14
|
+
icon: /* @__PURE__ */ jsx(CheckboxIcon, {}),
|
|
15
|
+
checkedIcon: /* @__PURE__ */ jsx(CheckboxCheckedIcon, {}),
|
|
16
|
+
indeterminateIcon: /* @__PURE__ */ jsx(CheckboxIndeterminateIcon, {}),
|
|
17
|
+
onChange: handleChange,
|
|
18
|
+
...props
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
});
|
|
24
22
|
export {
|
|
25
23
|
CheckboxFormatter as C
|
|
26
24
|
};
|
|
@@ -5,7 +5,7 @@ import { useDrag, useDrop } from "react-dnd";
|
|
|
5
5
|
import { renderHeaderCell } from "react-data-grid";
|
|
6
6
|
import { u as useFocusRef } from "../hooks/useFocusRef.js";
|
|
7
7
|
import { u as useFilters } from "../../../hooks/useFilters.js";
|
|
8
|
-
import { N as NameColumnIconStyled,
|
|
8
|
+
import { N as NameColumnIconStyled, B as NameColumnStyled, I as IconColumnStyled, F as DraggableHeaderRootStyled, G as ButtonHeaderActionsStyled, H as DraggableWrapperInputBaseStyled, J as IconSearchStyled, K as HeaderInputBaseStyled } from "../../../slots/DataGridSlot.js";
|
|
9
9
|
import { p as pathIcons } from "../../../icons.js";
|
|
10
10
|
import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
|
|
11
11
|
import { I as Icon } from "../../../../Icon/Icon.js";
|
|
@@ -21,7 +21,7 @@ function DraggableHeaderRenderer(props) {
|
|
|
21
21
|
headerTabIndex !== void 0 && headerTabIndex >= 0
|
|
22
22
|
);
|
|
23
23
|
const { getLabel } = useModuleDictionary();
|
|
24
|
-
const { size, classes, externalSortSettings, externalFilterSettings } = useDataGrid();
|
|
24
|
+
const { size, classes, externalSortSettings, externalFilterSettings, currentRowHeightVariant } = useDataGrid();
|
|
25
25
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
26
26
|
const { activeFilters, filters, onChangeFilter } = useFilters();
|
|
27
27
|
const [filter, setFilter] = useState(filters?.get(column.key) || "");
|
|
@@ -117,7 +117,7 @@ function DraggableHeaderRenderer(props) {
|
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
newColumn.name = /* @__PURE__ */ jsxs(NameColumnIconStyled, { style: { justifyContent: getJustifyContent() }, children: [
|
|
120
|
-
/* @__PURE__ */ jsx(NameColumnStyled, { children: newColumn.name }),
|
|
120
|
+
/* @__PURE__ */ jsx(NameColumnStyled, { ownerState: { size, currentRowHeightVariant }, children: newColumn.name }),
|
|
121
121
|
/* @__PURE__ */ jsx(IconColumnStyled, { children: columnIcons })
|
|
122
122
|
] });
|
|
123
123
|
}
|
package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useMemo, useEffect, useCallback } from "react";
|
|
3
3
|
import { useModuleDictionary } from "@m4l/core";
|
|
4
4
|
import { M as MenuItem } from "../../../../../mui_extended/MenuItem/MenuItem.js";
|
|
5
|
-
import { M as MenuListStyled,
|
|
5
|
+
import { M as MenuListStyled, O as HeaderRenderClickStyled } from "../../../../slots/DataGridSlot.js";
|
|
6
6
|
import { M as MenuDivider } from "../../../../../mui_extended/MenuDivider/MenuDivider.js";
|
|
7
7
|
import { P as Popover } from "../../../../../mui_extended/Popover/Popover.js";
|
|
8
8
|
import { D as DICTIONARY } from "../../../../dictionary.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { P as InputTextEditorStyled } from "../../../slots/DataGridSlot.js";
|
|
3
3
|
function autoFocusAndSelect(input) {
|
|
4
4
|
input?.focus();
|
|
5
5
|
input?.select();
|
|
@@ -2,6 +2,7 @@ import { RenderHeaderCellProps } from 'react-data-grid';
|
|
|
2
2
|
import { ChipStatusFormatterProps } from '../../../formatters/ChipStatusFormatter/types';
|
|
3
3
|
import { DeepKeyOf } from '../../../../utils/types';
|
|
4
4
|
import { ColumnAlign } from '../../types';
|
|
5
|
+
import { TagConfig } from '../../../formatters/TagsFormatter/types';
|
|
5
6
|
export interface SeedProps {
|
|
6
7
|
quantity: number;
|
|
7
8
|
withBoolean?: boolean;
|
|
@@ -17,6 +18,7 @@ export interface SeedProps {
|
|
|
17
18
|
withSetCheck?: boolean;
|
|
18
19
|
withCesar?: boolean;
|
|
19
20
|
withChipStatus?: boolean;
|
|
21
|
+
withTags?: boolean;
|
|
20
22
|
withActions?: boolean;
|
|
21
23
|
withActionsUser?: boolean;
|
|
22
24
|
withBooleanStatus?: boolean;
|
|
@@ -52,6 +54,7 @@ export interface RowType {
|
|
|
52
54
|
symbol: string;
|
|
53
55
|
unit: string;
|
|
54
56
|
};
|
|
57
|
+
tags?: TagConfig[];
|
|
55
58
|
setCheck?: boolean;
|
|
56
59
|
cesar?: string;
|
|
57
60
|
status?: {
|
|
@@ -159,6 +159,11 @@ export interface GridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> exte
|
|
|
159
159
|
* Incluye habilitación, configuración de columnas y renderizado personalizado
|
|
160
160
|
*/
|
|
161
161
|
cardsViewConfig?: CardsViewConfig<TRow>;
|
|
162
|
+
/**
|
|
163
|
+
* Key de la fila a la que se debe hacer scroll y highlight automáticamente.
|
|
164
|
+
* Útil cuando se agrega un nuevo elemento y se quiere enfocar en él.
|
|
165
|
+
*/
|
|
166
|
+
focusOnRowKey?: TKey;
|
|
162
167
|
}
|
|
163
168
|
export declare const DATAGRID_TEST_ID = "m4ldatagrid";
|
|
164
169
|
export declare const PREFIX_TEST_ATTRIBUTE = "data-testid";
|
|
@@ -183,7 +188,6 @@ export interface ActionsProps {
|
|
|
183
188
|
* Props para el hook useModalDetail
|
|
184
189
|
*/
|
|
185
190
|
export interface UseModalDetailProps<TRow> {
|
|
186
|
-
row: TRow;
|
|
187
191
|
columns: readonly Column<TRow, any>[];
|
|
188
192
|
viewMode: ViewMode;
|
|
189
193
|
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
|
|
@@ -247,7 +251,18 @@ export interface CardContentProps<TRow> {
|
|
|
247
251
|
originalColumns: readonly Column<TRow, any>[];
|
|
248
252
|
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
|
|
249
253
|
}
|
|
250
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Configuración de densidad para el DataGrid.
|
|
256
|
+
* Define las alturas de filas, headers y la variante inicial.
|
|
257
|
+
*/
|
|
258
|
+
export interface DataGridDensityConfig {
|
|
259
|
+
rowHeights: RowHeights;
|
|
260
|
+
rowHeaderHeights: RowHeights;
|
|
261
|
+
initialRowHeightVariant: RowHeightVariants;
|
|
262
|
+
}
|
|
263
|
+
export type DataGridOwnerState<TRow, TSummaryRow, TKey extends RowKey = RowKey> = Pick<DataGridProps<TRow, TSummaryRow, TKey>, 'visibleCustomHeader' | 'size'> & {
|
|
264
|
+
currentRowHeightVariant?: RowHeightVariants;
|
|
265
|
+
currentRowHeight?: number;
|
|
251
266
|
viewMode?: ViewMode;
|
|
252
267
|
isActive?: boolean;
|
|
253
268
|
hasActions?: boolean;
|