@m4l/components 9.3.34-JT25112025.beta.1 → 9.3.34-JT25112025.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 +0 -3
- package/@types/types.d.ts +5 -26
- package/components/DataGrid/DataGrid.js +0 -2
- package/components/DataGrid/Datagrid.styles.js +111 -43
- package/components/DataGrid/contexts/DataGridContext/index.js +0 -2
- package/components/DataGrid/contexts/DataGridContext/types.d.ts +2 -2
- package/components/DataGrid/dictionary.d.ts +1 -0
- package/components/DataGrid/dictionary.js +2 -1
- package/components/DataGrid/formatters/ColumnTagsFormatter/tests/useColumnTags.test.d.ts +1 -0
- package/components/DataGrid/hooks/useModalCardDetail.d.ts +1 -1
- package/components/DataGrid/hooks/useModalCardDetail.js +6 -1
- package/components/DataGrid/icons.d.ts +1 -0
- package/components/DataGrid/icons.js +2 -1
- package/components/DataGrid/slots/DataGridEnum.d.ts +4 -1
- package/components/DataGrid/slots/DataGridEnum.js +3 -0
- package/components/DataGrid/slots/DataGridSlot.d.ts +3 -0
- package/components/DataGrid/slots/DataGridSlot.js +48 -33
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +1 -1
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +47 -5
- package/components/DataGrid/subcomponents/Cards/index.js +6 -3
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +59 -15
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +8 -16
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +2 -2
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +5 -1
- package/components/DataGrid/subcomponents/Cards/types.d.ts +16 -0
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +2 -5
- package/components/DataGrid/subcomponents/ControlNavigate/ControlNavigate.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/index.js +2 -2
- 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/Table/hooks/useSortColumnsRows.js +2 -6
- package/components/DataGrid/subcomponents/Table/index.js +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/CheckboxFormatter.js +1 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/CustomIcons.js +39 -14
- package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
- package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
- package/components/DataGrid/types.d.ts +12 -7
- package/components/mui_extended/index.d.ts +0 -1
- package/index.js +40 -42
- package/package.json +1 -1
- package/components/DataGrid/formatters/ColumnIconFormatter/constants.d.ts +0 -4
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.d.ts +0 -6
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.js +0 -20
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioSelectColumn.d.ts +0 -64
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioSelectColumn.js +0 -46
- package/components/mui_extended/RadioButton/RadioButton.d.ts +0 -24
- package/components/mui_extended/RadioButton/RadioButton.js +0 -110
- package/components/mui_extended/RadioButton/RadioButton.styles.d.ts +0 -2
- package/components/mui_extended/RadioButton/RadioButton.styles.js +0 -126
- package/components/mui_extended/RadioButton/constants.d.ts +0 -1
- package/components/mui_extended/RadioButton/constants.js +0 -4
- package/components/mui_extended/RadioButton/icons.d.ts +0 -4
- package/components/mui_extended/RadioButton/icons.js +0 -7
- package/components/mui_extended/RadioButton/index.d.ts +0 -1
- package/components/mui_extended/RadioButton/index.js +0 -1
- package/components/mui_extended/RadioButton/slots/RadioButtonEnum.d.ts +0 -8
- package/components/mui_extended/RadioButton/slots/RadioButtonEnum.js +0 -12
- package/components/mui_extended/RadioButton/slots/RadioButtonSlots.d.ts +0 -20
- package/components/mui_extended/RadioButton/slots/RadioButtonSlots.js +0 -39
- package/components/mui_extended/RadioButton/types.d.ts +0 -50
- /package/components/DataGrid/{tests/table/subcomponents/RadioButtonFormatter.test.d.ts → formatters/ColumnColorFormatter/tests/ColumnColorFormatter.test.d.ts} +0 -0
- /package/components/DataGrid/{tests/table/subcomponents/RadioSelectColumn.test.d.ts → formatters/ColumnColorFormatter/tests/useColumnColor.test.d.ts} +0 -0
- /package/components/{mui_extended/RadioButton/tests/RadioButton.test.d.ts → DataGrid/formatters/ColumnTagsFormatter/tests/ColumnTagsFormatter.test.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useMemo, useEffect } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { e as CardsContainerStyled } from "../../slots/DataGridSlot.js";
|
|
4
4
|
import { C as CardRow } from "./subcomponents/CardRow/index.js";
|
|
5
5
|
import { u as useProcessedColumns } from "../../hooks/useProcessedColumns.js";
|
|
6
6
|
import { c as calculateCardHeight } from "./helpers/calculateCardHeight.js";
|
|
@@ -28,7 +28,8 @@ function Cards(props) {
|
|
|
28
28
|
const handleOpenDetail = useModalDetail({
|
|
29
29
|
columns: allProcessedColumns,
|
|
30
30
|
viewMode: "cards",
|
|
31
|
-
onRowsChange
|
|
31
|
+
onRowsChange,
|
|
32
|
+
rows
|
|
32
33
|
});
|
|
33
34
|
const cardHeight = useMemo(() => {
|
|
34
35
|
return calculateCardHeight({
|
|
@@ -64,7 +65,7 @@ function Cards(props) {
|
|
|
64
65
|
if (processedColumns.length === 0) {
|
|
65
66
|
return null;
|
|
66
67
|
}
|
|
67
|
-
return /* @__PURE__ */ jsx(CardsContainerStyled, { "data-testid": "cards-container", ref: containerRef, children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "grid-layout", minWidth: 280, children: rows.map((row) => {
|
|
68
|
+
return /* @__PURE__ */ jsx(CardsContainerStyled, { "data-testid": "cards-container", ref: containerRef, children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "grid-layout", minWidth: 280, children: rows.map((row, rowIndex) => {
|
|
68
69
|
const rowKey = rowKeyGetter(row);
|
|
69
70
|
const isChecked = checkedRows?.has(rowKey) || false;
|
|
70
71
|
const showCheckbox = checkedRows !== void 0 && onCheckedRowsChange !== void 0;
|
|
@@ -72,6 +73,8 @@ function Cards(props) {
|
|
|
72
73
|
CardRow,
|
|
73
74
|
{
|
|
74
75
|
row,
|
|
76
|
+
rows,
|
|
77
|
+
rowIndex,
|
|
75
78
|
columns: processedColumns,
|
|
76
79
|
originalColumns: allProcessedColumns,
|
|
77
80
|
rowKeyGetter,
|
|
@@ -5,4 +5,4 @@ import { CardDetailsProps } from '../../types';
|
|
|
5
5
|
*
|
|
6
6
|
* A diferencia del componente Cards, este muestra TODAS las columnas
|
|
7
7
|
*/
|
|
8
|
-
export declare function CardDetails<TRow>({ row, columns, viewColumnsConfig, onRowsChange, size, }: CardDetailsProps<TRow>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function CardDetails<TRow>({ row, columns, viewColumnsConfig, onRowsChange, size, rows, rowIndex, }: CardDetailsProps<TRow>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { f as CardDetailContainerStyled, b as ContainerLabelValueColumnStyled, c as ContentWrapperColumnStyled, L as LabelHeaderColumnStyled, E as EditorCellWrapperStyled, V as ValueColumnStyled, d as EditablePlaceholderStyled, I as IconButtonEditStyled } from "../../../../slots/DataGridSlot.js";
|
|
4
|
+
import { D as DICTIONARY } from "../../../../dictionary.js";
|
|
5
|
+
import { useModuleDictionary, useEnvironment } from "@m4l/core";
|
|
6
|
+
import { p as pathIcons } from "../../../../icons.js";
|
|
7
|
+
import { u as useComponentSize } from "../../../../../../hooks/useComponentSize/useComponentSize.js";
|
|
4
8
|
function CardDetails({
|
|
5
9
|
row,
|
|
6
10
|
columns,
|
|
7
11
|
viewColumnsConfig,
|
|
8
12
|
onRowsChange,
|
|
9
|
-
size = "medium"
|
|
13
|
+
size = "medium",
|
|
14
|
+
rows,
|
|
15
|
+
rowIndex
|
|
10
16
|
}) {
|
|
11
17
|
const [editingColumnKey, setEditingColumnKey] = useState(null);
|
|
12
18
|
const [refreshCounter, setRefreshCounter] = useState(0);
|
|
19
|
+
const { getLabel } = useModuleDictionary();
|
|
20
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
21
|
+
const { currentSize } = useComponentSize(size);
|
|
22
|
+
const currentRow = rows[rowIndex] || row;
|
|
13
23
|
const handleForceRefresh = useCallback(() => {
|
|
14
24
|
setRefreshCounter((prev) => prev + 1);
|
|
15
25
|
}, []);
|
|
@@ -17,10 +27,8 @@ function CardDetails({
|
|
|
17
27
|
if (column.renderCell) {
|
|
18
28
|
return {
|
|
19
29
|
...column,
|
|
20
|
-
// Agregar onAfterChange al objeto de la columna
|
|
21
|
-
|
|
22
|
-
onAfterChange: handleForceRefresh
|
|
23
|
-
}
|
|
30
|
+
// Agregar onAfterChange al objeto de la columna
|
|
31
|
+
onAfterChange: handleForceRefresh
|
|
24
32
|
};
|
|
25
33
|
}
|
|
26
34
|
return column;
|
|
@@ -30,7 +38,8 @@ function CardDetails({
|
|
|
30
38
|
(config) => config.key === modifiedColumn.key
|
|
31
39
|
);
|
|
32
40
|
const originalColumn = columns[index];
|
|
33
|
-
const
|
|
41
|
+
const hasInteractiveFormatter = !!modifiedColumn.onAfterChange;
|
|
42
|
+
const columnKey = hasInteractiveFormatter ? `${originalColumn.key}-${refreshCounter}` : `${originalColumn.key}`;
|
|
34
43
|
const shouldShowTitle = configColumn?.showTitle !== false;
|
|
35
44
|
return /* @__PURE__ */ jsx(ContainerLabelValueColumnStyled, { children: /* @__PURE__ */ jsxs(
|
|
36
45
|
ContentWrapperColumnStyled,
|
|
@@ -48,17 +57,21 @@ function CardDetails({
|
|
|
48
57
|
if (modifiedColumn.renderEditCell && editingColumnKey === modifiedColumn.key) {
|
|
49
58
|
return /* @__PURE__ */ jsx(EditorCellWrapperStyled, { ownerState: { size }, children: modifiedColumn.renderEditCell({
|
|
50
59
|
column: originalColumn,
|
|
51
|
-
row,
|
|
60
|
+
row: currentRow,
|
|
52
61
|
rowIdx: index,
|
|
53
62
|
/**
|
|
54
63
|
* onRowChange es una función que se ejecuta cuando el usuario edita una celda.
|
|
55
64
|
*/
|
|
56
65
|
onRowChange: (updatedRow) => {
|
|
57
66
|
if (onRowsChange) {
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
const updatedRows = rows.map(
|
|
68
|
+
(r, i) => i === rowIndex ? updatedRow : r
|
|
69
|
+
);
|
|
70
|
+
onRowsChange(updatedRows, {
|
|
71
|
+
indexes: [rowIndex],
|
|
60
72
|
column: originalColumn
|
|
61
73
|
});
|
|
74
|
+
handleForceRefresh();
|
|
62
75
|
}
|
|
63
76
|
},
|
|
64
77
|
onClose: () => setEditingColumnKey(null)
|
|
@@ -66,8 +79,8 @@ function CardDetails({
|
|
|
66
79
|
}
|
|
67
80
|
if (modifiedColumn.renderCell) {
|
|
68
81
|
const cellContent = modifiedColumn.renderCell({
|
|
69
|
-
column:
|
|
70
|
-
row,
|
|
82
|
+
column: modifiedColumn,
|
|
83
|
+
row: currentRow,
|
|
71
84
|
rowIdx: index,
|
|
72
85
|
isCellSelected: false,
|
|
73
86
|
tabIndex: -1,
|
|
@@ -76,16 +89,47 @@ function CardDetails({
|
|
|
76
89
|
*/
|
|
77
90
|
onRowChange: (updatedRow) => {
|
|
78
91
|
if (onRowsChange) {
|
|
79
|
-
|
|
80
|
-
|
|
92
|
+
const updatedRows = rows.map(
|
|
93
|
+
(r, i) => i === rowIndex ? updatedRow : r
|
|
94
|
+
);
|
|
95
|
+
onRowsChange(updatedRows, {
|
|
96
|
+
indexes: [rowIndex],
|
|
81
97
|
column: originalColumn
|
|
82
98
|
});
|
|
99
|
+
handleForceRefresh();
|
|
83
100
|
}
|
|
84
101
|
}
|
|
85
102
|
});
|
|
86
103
|
return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: cellContent });
|
|
87
104
|
}
|
|
88
|
-
|
|
105
|
+
const rawValue = currentRow[modifiedColumn.key];
|
|
106
|
+
const isEmpty = rawValue === null || rawValue === void 0 || rawValue === "";
|
|
107
|
+
const isEditable = !!modifiedColumn.renderEditCell;
|
|
108
|
+
if (isEditable) {
|
|
109
|
+
return /* @__PURE__ */ jsxs(EditablePlaceholderStyled, { children: [
|
|
110
|
+
/* @__PURE__ */ jsx(
|
|
111
|
+
ValueColumnStyled,
|
|
112
|
+
{
|
|
113
|
+
variant: "body",
|
|
114
|
+
color: isEmpty ? "text.secondary" : "text.primary",
|
|
115
|
+
children: isEmpty ? getLabel(DICTIONARY.EDIT_PLACEHOLDER) : rawValue
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
IconButtonEditStyled,
|
|
120
|
+
{
|
|
121
|
+
src: `${host_static_assets}/${environment_assets}/${pathIcons.edit}`,
|
|
122
|
+
onClick: () => {
|
|
123
|
+
setEditingColumnKey(modifiedColumn.key);
|
|
124
|
+
},
|
|
125
|
+
size: currentSize,
|
|
126
|
+
role: "button",
|
|
127
|
+
"aria-label": "Editar texto"
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] });
|
|
131
|
+
}
|
|
132
|
+
return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: rawValue ?? "-" });
|
|
89
133
|
})()
|
|
90
134
|
]
|
|
91
135
|
}
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo, useCallback } from "react";
|
|
3
3
|
import { useEnvironment } from "@m4l/core";
|
|
4
4
|
import { u as useDataGrid } from "../../../../hooks/useDataGrid.js";
|
|
5
|
-
import {
|
|
5
|
+
import { g as CardHeaderStyled, h as CardHeaderLeftStyled, i as CardHeaderRightStyled } from "../../../../slots/DataGridSlot.js";
|
|
6
6
|
import { p as pathIcons } from "../../../../icons.js";
|
|
7
7
|
import { C as CheckboxCellAdapter } from "../../../CheckboxCellAdapter/index.js";
|
|
8
8
|
import { I as IconButton } from "../../../../../mui_extended/IconButton/IconButton.js";
|
|
@@ -15,7 +15,7 @@ function CardHeader({
|
|
|
15
15
|
checkedRows,
|
|
16
16
|
onCheckedRowsChange
|
|
17
17
|
}) {
|
|
18
|
-
const { rowKeyGetter, rowActionsGetter, size
|
|
18
|
+
const { rowKeyGetter, rowActionsGetter, size } = useDataGrid();
|
|
19
19
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
20
20
|
const rowKey = useMemo(() => rowKeyGetter(row), [rowKeyGetter, row]);
|
|
21
21
|
const onChange = useCallback(
|
|
@@ -23,23 +23,15 @@ function CardHeader({
|
|
|
23
23
|
if (!onCheckedRowsChange || !checkedRows) {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} else {
|
|
30
|
-
onCheckedRowsChange(/* @__PURE__ */ new Set());
|
|
31
|
-
}
|
|
26
|
+
const newCheckedRows = new Set(checkedRows);
|
|
27
|
+
if (checked) {
|
|
28
|
+
newCheckedRows.add(rowKey);
|
|
32
29
|
} else {
|
|
33
|
-
|
|
34
|
-
if (checked) {
|
|
35
|
-
newCheckedRows.add(rowKey);
|
|
36
|
-
} else {
|
|
37
|
-
newCheckedRows.delete(rowKey);
|
|
38
|
-
}
|
|
39
|
-
onCheckedRowsChange(newCheckedRows);
|
|
30
|
+
newCheckedRows.delete(rowKey);
|
|
40
31
|
}
|
|
32
|
+
onCheckedRowsChange(newCheckedRows);
|
|
41
33
|
},
|
|
42
|
-
[checkedRows, onCheckedRowsChange, rowKey
|
|
34
|
+
[checkedRows, onCheckedRowsChange, rowKey]
|
|
43
35
|
);
|
|
44
36
|
const anchorOrigin = useMemo(
|
|
45
37
|
() => ({
|
|
@@ -3,9 +3,9 @@ import { CardRowProps } from '../../types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Componente que muestra una fila de tarjetas.
|
|
5
5
|
*/
|
|
6
|
-
declare function CardRowComponent<TRow, TKey extends RowKey = RowKey>({ row, columns, originalColumns, rowKeyGetter, selectedRows, onSelectedRowsChange, onRowsChange, customRender, minHeight, isChecked, checkedRows, showCheckbox, onCheckedRowsChange, onOpenDetail, }: CardRowProps<TRow, TKey>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function CardRowComponent<TRow, TKey extends RowKey = RowKey>({ row, rows, rowIndex, columns, originalColumns, rowKeyGetter, selectedRows, onSelectedRowsChange, onRowsChange, customRender, minHeight, isChecked, checkedRows, showCheckbox, onCheckedRowsChange, onOpenDetail, }: CardRowProps<TRow, TKey>): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Componente que muestra CardRow
|
|
9
9
|
*/
|
|
10
10
|
export declare const CardRow: typeof CardRowComponent;
|
|
11
11
|
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import React, { useMemo } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { j as CardContentWrapperStyled, k as CardContentStyled, l 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
7
|
import { deepEqual } from "fast-equals";
|
|
8
8
|
function CardRowComponent({
|
|
9
9
|
row,
|
|
10
|
+
rows,
|
|
11
|
+
rowIndex,
|
|
10
12
|
columns,
|
|
11
13
|
originalColumns,
|
|
12
14
|
rowKeyGetter,
|
|
@@ -24,6 +26,8 @@ function CardRowComponent({
|
|
|
24
26
|
const hasCustomRender = customRender !== void 0;
|
|
25
27
|
const { cardContent } = useCardContent({
|
|
26
28
|
row,
|
|
29
|
+
rows,
|
|
30
|
+
rowIndex,
|
|
27
31
|
columns,
|
|
28
32
|
onRowsChange
|
|
29
33
|
});
|
|
@@ -78,6 +78,14 @@ export interface CardRowProps<TRow, TKey extends RowKey = RowKey> {
|
|
|
78
78
|
* Fila que se mostrará en la tarjeta
|
|
79
79
|
*/
|
|
80
80
|
row: TRow;
|
|
81
|
+
/**
|
|
82
|
+
* Array completo de todas las filas (necesario para reconstruir el array al editar)
|
|
83
|
+
*/
|
|
84
|
+
rows: readonly TRow[];
|
|
85
|
+
/**
|
|
86
|
+
* Índice de la fila actual en el array de filas
|
|
87
|
+
*/
|
|
88
|
+
rowIndex: number;
|
|
81
89
|
/**
|
|
82
90
|
* Columnas que se mostrarán en la tarjeta (procesadas, filtradas por visibilidad)
|
|
83
91
|
*/
|
|
@@ -140,6 +148,14 @@ export interface CardDetailsProps<TRow> {
|
|
|
140
148
|
viewColumnsConfig: IViewConfig<any, any>[];
|
|
141
149
|
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
|
|
142
150
|
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
151
|
+
/**
|
|
152
|
+
* Array completo de todas las filas (necesario para reconstruir el array al editar)
|
|
153
|
+
*/
|
|
154
|
+
rows: readonly TRow[];
|
|
155
|
+
/**
|
|
156
|
+
* Índice de la fila actual en el array de filas
|
|
157
|
+
*/
|
|
158
|
+
rowIndex: number;
|
|
143
159
|
}
|
|
144
160
|
/**
|
|
145
161
|
* Props para el componente CardHeader
|
|
@@ -2,9 +2,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
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
|
-
import { R as RadioButtonFormatter } from "../Table/subcomponents/RadioButtonFormatter.js";
|
|
6
5
|
import { a as DataGridContext } from "../../contexts/DataGridContext/index.js";
|
|
7
|
-
import {
|
|
6
|
+
import { m as CheckboxCellWrapperStyled } from "../../slots/DataGridSlot.js";
|
|
8
7
|
const CheckboxCellAdapter = forwardRef(function CheckboxCellAdapter2(props, ref) {
|
|
9
8
|
const {
|
|
10
9
|
value,
|
|
@@ -15,14 +14,12 @@ const CheckboxCellAdapter = forwardRef(function CheckboxCellAdapter2(props, ref)
|
|
|
15
14
|
} = props;
|
|
16
15
|
const context = useContext(DataGridContext);
|
|
17
16
|
const viewMode = context?.viewMode ?? "cards";
|
|
18
|
-
const checkedRowsMultiple = context?.checkedRowsMultiple;
|
|
19
17
|
if (viewMode !== "table") {
|
|
20
18
|
const handleClick = (e) => {
|
|
21
19
|
e.stopPropagation();
|
|
22
20
|
};
|
|
23
|
-
const FormatterComponent = checkedRowsMultiple === false ? RadioButtonFormatter : CheckboxFormatter;
|
|
24
21
|
return /* @__PURE__ */ jsx(CheckboxCellWrapperStyled, { onClick: handleClick, children: /* @__PURE__ */ jsx(
|
|
25
|
-
|
|
22
|
+
CheckboxFormatter,
|
|
26
23
|
{
|
|
27
24
|
ref,
|
|
28
25
|
checked: value,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useIsMobile } from "@m4l/graphics";
|
|
3
|
-
import {
|
|
3
|
+
import { n 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, o as ActionsConfigContainerStyled, p as ContainerLeftActionsStyled, q 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 {
|
|
@@ -29,7 +29,7 @@ function HeaderActions(props) {
|
|
|
29
29
|
] }) : /* @__PURE__ */ jsxs(ActionsConfigContainerStyled, { ownerState: { withPager }, children: [
|
|
30
30
|
/* @__PURE__ */ jsxs(ContainerLeftActionsStyled, { children: [
|
|
31
31
|
leftActions,
|
|
32
|
-
typeof rowHeights !== "number" && /* @__PURE__ */ jsx(Density, {}),
|
|
32
|
+
typeof rowHeights !== "number" && viewMode !== "cards" && /* @__PURE__ */ jsx(Density, {}),
|
|
33
33
|
withLocalFilters && /* @__PURE__ */ jsx(Filter, {}),
|
|
34
34
|
withSettings && !(viewMode === "cards" && cardsViewConfig?.customRender) && /* @__PURE__ */ jsx(Settings, { ...settingsProps, columns }),
|
|
35
35
|
cardsViewConfig !== void 0 && /* @__PURE__ */ jsx(ViewMode, {})
|
|
@@ -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, r as RowsCountLabelStyled, s 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 { t as ColumnsConfigWrapperStyled, u as ColumnsConfigDataGridStyled, v as ColumnsConfigSelColumnsStyled, T as TableWrapperDataGridStyled, w 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 { t as ColumnsConfigWrapperStyled, u as ColumnsConfigDataGridStyled, v as ColumnsConfigSelColumnsStyled, T as TableWrapperDataGridStyled, w 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 { x as ContainerToggleCardsStyled, y as CardToggleButtonStyled, z 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();
|
|
@@ -2,7 +2,6 @@ import { useState, useEffect, useMemo } from "react";
|
|
|
2
2
|
import { g as getDragHeaderRenderer } from "./getDragHeaderRenderer.js";
|
|
3
3
|
import { A as ActionsColumn } from "../subcomponents/ActionsColumn.js";
|
|
4
4
|
import { f as filterColumnClassName, S as SelectColumn } from "../subcomponents/SelectColumn.js";
|
|
5
|
-
import { R as RadioSelectColumn } from "../subcomponents/RadioSelectColumn.js";
|
|
6
5
|
import { useModuleSkeleton, getPropertyByString } from "@m4l/core";
|
|
7
6
|
import { u as useFilters } from "../../../hooks/useFilters.js";
|
|
8
7
|
import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
|
|
@@ -39,7 +38,7 @@ function getComparator(columns, sortColumn) {
|
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
const getColumIndex = (key, columnsConfig) => columnsConfig.findIndex((columnConfig) => columnConfig.key === key);
|
|
42
|
-
const getInOrderColumns = (columns, hasCheckedRows,
|
|
41
|
+
const getInOrderColumns = (columns, hasCheckedRows, columnsConfig, columnsWidths, rowActionsGetter) => {
|
|
43
42
|
let filteredSortedColumns = columns.filter((column) => {
|
|
44
43
|
const columnConfigIndex = getColumIndex(column.key, columnsConfig);
|
|
45
44
|
const visible = columnConfigIndex > -1 ? columnsConfig[columnConfigIndex].visible : true;
|
|
@@ -65,8 +64,7 @@ const getInOrderColumns = (columns, hasCheckedRows, checkedRowsMultiple, columns
|
|
|
65
64
|
filteredSortedColumns = [ActionsColumn, ...filteredSortedColumns];
|
|
66
65
|
}
|
|
67
66
|
if (hasCheckedRows) {
|
|
68
|
-
|
|
69
|
-
filteredSortedColumns = [selectionColumn, ...filteredSortedColumns];
|
|
67
|
+
filteredSortedColumns = [SelectColumn, ...filteredSortedColumns];
|
|
70
68
|
}
|
|
71
69
|
return filteredSortedColumns;
|
|
72
70
|
};
|
|
@@ -91,7 +89,6 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
91
89
|
rowActionsGetter,
|
|
92
90
|
checkedRows,
|
|
93
91
|
onCheckedRowsChange,
|
|
94
|
-
checkedRowsMultiple,
|
|
95
92
|
sortColumns,
|
|
96
93
|
setSortColumns
|
|
97
94
|
} = useDataGrid();
|
|
@@ -112,7 +109,6 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
112
109
|
sourceColumns,
|
|
113
110
|
!!checkedRows && !!onCheckedRowsChange,
|
|
114
111
|
//Si están seteados se habilita el múltipe
|
|
115
|
-
checkedRowsMultiple,
|
|
116
112
|
columnsConfig,
|
|
117
113
|
columnsWidths,
|
|
118
114
|
rowActionsGetter
|
|
@@ -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 { B 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) {
|
|
@@ -12,6 +12,7 @@ const CheckboxFormatter = forwardRef(function CheckboxFormatter2({ onChange, che
|
|
|
12
12
|
checked,
|
|
13
13
|
size: "small",
|
|
14
14
|
icon: /* @__PURE__ */ jsx(CheckboxIcon, {}),
|
|
15
|
+
disableRipple: true,
|
|
15
16
|
checkedIcon: /* @__PURE__ */ jsx(CheckboxCheckedIcon, {}),
|
|
16
17
|
indeterminateIcon: /* @__PURE__ */ jsx(CheckboxIndeterminateIcon, {}),
|
|
17
18
|
onChange: handleChange,
|
|
@@ -1,22 +1,47 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEnvironment } from "@m4l/core";
|
|
3
|
+
import "@mui/material";
|
|
4
|
+
import { I as Icon } from "../../../../Icon/Icon.js";
|
|
3
5
|
function CheckboxIcon(props) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
7
|
+
const uncheckedIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/check_box/assets/icons/unchecked.svg`;
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
Icon,
|
|
10
|
+
{
|
|
11
|
+
src: uncheckedIconUrl,
|
|
12
|
+
size: "small",
|
|
13
|
+
color: "text.primary",
|
|
14
|
+
className: "checkbox-unChecked",
|
|
15
|
+
...props
|
|
16
|
+
}
|
|
17
|
+
);
|
|
8
18
|
}
|
|
9
19
|
function CheckboxCheckedIcon(props) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
21
|
+
const checkedIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/check_box/assets/icons/checked.svg`;
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
Icon,
|
|
24
|
+
{
|
|
25
|
+
src: checkedIconUrl,
|
|
26
|
+
size: "small",
|
|
27
|
+
color: "primary.enabled",
|
|
28
|
+
className: "checkbox-checked",
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
);
|
|
17
32
|
}
|
|
18
33
|
function CheckboxIndeterminateIcon(props) {
|
|
19
|
-
|
|
34
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
35
|
+
const indeterminateIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/check_box/assets/icons/indeterminate.svg`;
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
Icon,
|
|
38
|
+
{
|
|
39
|
+
src: indeterminateIconUrl,
|
|
40
|
+
size: "small",
|
|
41
|
+
color: "primary.enabled",
|
|
42
|
+
...props
|
|
43
|
+
}
|
|
44
|
+
);
|
|
20
45
|
}
|
|
21
46
|
export {
|
|
22
47
|
CheckboxIndeterminateIcon as C,
|
|
@@ -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, F as NameColumnStyled, G as IconColumnStyled, H as DraggableHeaderRootStyled, J as ButtonHeaderActionsStyled, K as DraggableWrapperInputBaseStyled, M as IconSearchStyled, O 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";
|
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 {
|
|
5
|
+
import { P as MenuListStyled, Q 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 { S as InputTextEditorStyled } from "../../../slots/DataGridSlot.js";
|
|
3
3
|
function autoFocusAndSelect(input) {
|
|
4
4
|
input?.focus();
|
|
5
5
|
input?.select();
|
|
@@ -137,13 +137,6 @@ export interface GridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> exte
|
|
|
137
137
|
onSelectedRowsChange?: (mapRowsSelected: ReadonlySet<TKey>) => void;
|
|
138
138
|
checkedRows?: ReadonlySet<TKey>;
|
|
139
139
|
onCheckedRowsChange?: (mapRowsSelected: ReadonlySet<TKey>) => void;
|
|
140
|
-
/**
|
|
141
|
-
* Define si la selección de filas es múltiple (checkboxes) o única (radio buttons).
|
|
142
|
-
*
|
|
143
|
-
* - `true` (default): Permite seleccionar múltiples filas con checkboxes
|
|
144
|
-
* - `false`: Permite seleccionar solo una fila con radio buttons
|
|
145
|
-
*/
|
|
146
|
-
checkedRowsMultiple?: boolean;
|
|
147
140
|
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, TSummaryRow>) => void>;
|
|
148
141
|
/**
|
|
149
142
|
* Propiedad opcional que recibe la configuración de las columnas
|
|
@@ -200,6 +193,10 @@ export interface UseModalDetailProps<TRow> {
|
|
|
200
193
|
columns: readonly Column<TRow, any>[];
|
|
201
194
|
viewMode: ViewMode;
|
|
202
195
|
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
|
|
196
|
+
/**
|
|
197
|
+
* Array completo de todas las filas (necesario para reconstruir el array al editar en el modal)
|
|
198
|
+
*/
|
|
199
|
+
rows: readonly TRow[];
|
|
203
200
|
}
|
|
204
201
|
/**
|
|
205
202
|
* Configuración de una columna específica en vista "cards"
|
|
@@ -259,6 +256,14 @@ export interface CardContentProps<TRow> {
|
|
|
259
256
|
columns: readonly Column<TRow, any>[];
|
|
260
257
|
originalColumns: readonly Column<TRow, any>[];
|
|
261
258
|
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
|
|
259
|
+
/**
|
|
260
|
+
* Array completo de todas las filas (necesario para reconstruir el array al editar)
|
|
261
|
+
*/
|
|
262
|
+
rows: readonly TRow[];
|
|
263
|
+
/**
|
|
264
|
+
* Índice de la fila actual en el array de filas
|
|
265
|
+
*/
|
|
266
|
+
rowIndex: number;
|
|
262
267
|
}
|
|
263
268
|
/**
|
|
264
269
|
* Configuración de densidad para el DataGrid.
|
|
@@ -8,7 +8,6 @@ export { Breadcrumbs } from './Breadcrumbs';
|
|
|
8
8
|
export type { TLink } from './Breadcrumbs/types';
|
|
9
9
|
export * from './Button/Button';
|
|
10
10
|
export * from './CheckBox';
|
|
11
|
-
export * from './RadioButton';
|
|
12
11
|
export { CircularProgress } from './CircularProgress';
|
|
13
12
|
export { Badge } from './Badge';
|
|
14
13
|
export * from './ImageButton/ImageButton';
|