@m4l/components 9.3.21-JT15102025.beta.1 → 9.3.21-JT20102025.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/components/DataGrid/DataGrid.js +4 -4
- package/components/DataGrid/Datagrid.styles.js +2 -2
- package/components/DataGrid/contexts/DataGridContext/index.js +72 -10
- package/components/DataGrid/contexts/DataGridContext/types.d.ts +2 -2
- package/components/DataGrid/subcomponents/Cards/index.js +2 -2
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +1 -1
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +8 -8
- package/components/DataGrid/subcomponents/Cards/types.d.ts +3 -3
- package/components/DataGrid/subcomponents/HeaderActions/index.js +4 -5
- package/components/DataGrid/tests/helpers/useCardsViewConfig.d.ts +24 -0
- package/components/DataGrid/types.d.ts +42 -9
- package/package.json +1 -1
|
@@ -38,8 +38,8 @@ function DataGrid(props) {
|
|
|
38
38
|
size,
|
|
39
39
|
externalSortSettings,
|
|
40
40
|
externalFilterSettings,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
defaultViewMode,
|
|
42
|
+
cardsViewConfig
|
|
43
43
|
} = props;
|
|
44
44
|
const {
|
|
45
45
|
withSettings,
|
|
@@ -93,8 +93,8 @@ function DataGrid(props) {
|
|
|
93
93
|
size: currentSize,
|
|
94
94
|
externalSortSettings,
|
|
95
95
|
externalFilterSettings,
|
|
96
|
-
cardSettings,
|
|
97
96
|
defaultViewMode,
|
|
97
|
+
cardsViewConfig,
|
|
98
98
|
children: /* @__PURE__ */ jsxs(FilterProvider, { initialActiveFilters: false, children: [
|
|
99
99
|
withActions && actionsProps && /* @__PURE__ */ jsx(
|
|
100
100
|
HeaderActions,
|
|
@@ -122,7 +122,7 @@ function DataGrid(props) {
|
|
|
122
122
|
onSelectedRowsChange,
|
|
123
123
|
rowKeyGetter,
|
|
124
124
|
onRowsChange,
|
|
125
|
-
|
|
125
|
+
cardsViewConfig
|
|
126
126
|
}
|
|
127
127
|
),
|
|
128
128
|
withPager && /* @__PURE__ */ jsx(
|
|
@@ -729,9 +729,9 @@ const dataGridStyles = {
|
|
|
729
729
|
/**
|
|
730
730
|
* Header de la card con checkbox y acciones
|
|
731
731
|
*/
|
|
732
|
-
cardHeader: ({ theme }) => ({
|
|
732
|
+
cardHeader: ({ theme, ownerState }) => ({
|
|
733
733
|
display: "flex",
|
|
734
|
-
justifyContent: "space-between",
|
|
734
|
+
justifyContent: ownerState?.hasCheckedRows ? "space-between" : "flex-end",
|
|
735
735
|
alignItems: "center",
|
|
736
736
|
width: "100%",
|
|
737
737
|
height: "24px",
|
|
@@ -162,8 +162,8 @@ function DataGridProvider(props) {
|
|
|
162
162
|
size,
|
|
163
163
|
viewMode,
|
|
164
164
|
onViewModeChange,
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
defaultViewMode,
|
|
166
|
+
cardsViewConfig
|
|
167
167
|
} = props;
|
|
168
168
|
const isFirstRender = useFirstRender([columns, id]);
|
|
169
169
|
const isMobile = useIsMobile();
|
|
@@ -270,7 +270,50 @@ function DataGridProvider(props) {
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
|
|
273
|
+
if (cardsViewConfig !== void 0) {
|
|
274
|
+
const hasCustomRender = cardsViewConfig.customRender !== void 0;
|
|
275
|
+
const hasColumnsConfig = cardsViewConfig.columnsConfig !== void 0 && cardsViewConfig.columnsConfig.length > 0;
|
|
276
|
+
if (!hasCustomRender && !hasColumnsConfig) {
|
|
277
|
+
throw new Error(
|
|
278
|
+
`DataGridProvider: cardsViewConfig.enabled=true requiere configurar al menos una de estas opciones:
|
|
279
|
+
- cardsViewConfig.customRender (renderizado personalizado)
|
|
280
|
+
- cardsViewConfig.columnsConfig (configuración de columnas con al menos 1 elemento)
|
|
281
|
+
|
|
282
|
+
Configuración actual:
|
|
283
|
+
- customRender: ${hasCustomRender ? "definido" : "undefined"}
|
|
284
|
+
- columnsConfig: ${cardsViewConfig.columnsConfig?.length || 0} columnas
|
|
285
|
+
|
|
286
|
+
Ejemplo válido con columnsConfig:
|
|
287
|
+
cardsViewConfig={{
|
|
288
|
+
enabled: true,
|
|
289
|
+
columnsConfig: [
|
|
290
|
+
{ columnKey: 'name', showTitle: false },
|
|
291
|
+
{ columnKey: 'email', showTitle: true }
|
|
292
|
+
]
|
|
293
|
+
}}
|
|
294
|
+
|
|
295
|
+
Ejemplo válido con customRender:
|
|
296
|
+
cardsViewConfig={{
|
|
297
|
+
enabled: true,
|
|
298
|
+
customRender: {
|
|
299
|
+
renderContent: (row) => <CustomCard row={row} />,
|
|
300
|
+
minHeight: 200
|
|
301
|
+
}
|
|
302
|
+
}}
|
|
303
|
+
`
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
if (hasColumnsConfig && cardsViewConfig.columnsConfig) {
|
|
307
|
+
for (const cardCol of cardsViewConfig.columnsConfig) {
|
|
308
|
+
if (!keys.has(cardCol.columnKey)) {
|
|
309
|
+
throw new Error(
|
|
310
|
+
`DataGridProvider: cardsViewConfig.columnsConfig incluye columnKey="${cardCol.columnKey}", pero no existe ninguna columna con key="${cardCol.columnKey}".`
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}, [columns, sortSettings, filterSettings, cardsViewConfig]);
|
|
274
317
|
const finalRowHeights = useMemo(() => rowHeights, [rowHeights]);
|
|
275
318
|
let timerSaveColumns;
|
|
276
319
|
useEffect(() => {
|
|
@@ -287,15 +330,29 @@ function DataGridProvider(props) {
|
|
|
287
330
|
{ originalFrozen: false }
|
|
288
331
|
)
|
|
289
332
|
);
|
|
333
|
+
const finalCardsConfig = (() => {
|
|
334
|
+
if (defaultUserColumns?.columnsConfigCards) {
|
|
335
|
+
return defaultUserColumns.columnsConfigCards;
|
|
336
|
+
}
|
|
337
|
+
if (cardsViewConfig?.columnsConfig) {
|
|
338
|
+
return cardsViewConfig.columnsConfig.map((colConfig, index) => ({
|
|
339
|
+
key: colConfig.columnKey,
|
|
340
|
+
visible: true,
|
|
341
|
+
index,
|
|
342
|
+
showTitle: colConfig.showTitle
|
|
343
|
+
}));
|
|
344
|
+
}
|
|
345
|
+
return void 0;
|
|
346
|
+
})();
|
|
290
347
|
updateConfigColumns(
|
|
291
348
|
"cards",
|
|
292
349
|
getInitialColumnsConfig(
|
|
293
350
|
id,
|
|
294
351
|
columns,
|
|
295
352
|
"cards",
|
|
296
|
-
|
|
297
|
-
{ showTitle:
|
|
298
|
-
{ originalShowTitle:
|
|
353
|
+
finalCardsConfig,
|
|
354
|
+
{ showTitle: false },
|
|
355
|
+
{ originalShowTitle: false }
|
|
299
356
|
)
|
|
300
357
|
);
|
|
301
358
|
}
|
|
@@ -335,9 +392,14 @@ function DataGridProvider(props) {
|
|
|
335
392
|
);
|
|
336
393
|
if (newColumnsForView.length > 0) {
|
|
337
394
|
const colLength = currentConfig.length;
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
|
|
395
|
+
const viewSpecificDefaults = viewModeParam === "cards" ? { showTitle: false } : {
|
|
396
|
+
frozen: false
|
|
397
|
+
};
|
|
398
|
+
const originalViewSpecificDefaults = viewModeParam === "cards" ? {
|
|
399
|
+
originalShowTitle: false
|
|
400
|
+
} : {
|
|
401
|
+
originalFrozen: false
|
|
402
|
+
};
|
|
341
403
|
const newColConfig = getInitialColumnsConfig(
|
|
342
404
|
id,
|
|
343
405
|
newColumnsForView,
|
|
@@ -473,7 +535,7 @@ function DataGridProvider(props) {
|
|
|
473
535
|
size,
|
|
474
536
|
viewMode: viewModeState,
|
|
475
537
|
onViewModeChange: handleViewModeChange,
|
|
476
|
-
|
|
538
|
+
cardsViewConfig
|
|
477
539
|
},
|
|
478
540
|
children
|
|
479
541
|
}
|
|
@@ -79,7 +79,7 @@ export interface IGridConfig {
|
|
|
79
79
|
export interface IGridConfigExtended extends IGridConfig {
|
|
80
80
|
columnsConfigCards?: BaseConfigColumnCards[];
|
|
81
81
|
}
|
|
82
|
-
export interface DataGridProviderProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Pick<GridProps<TRow, TSummaryRow, TKey>, 'rows' | 'columns' | 'rowActionsGetter' | 'rowHeaderHeights' | 'rowHeights' | 'initialRowHeightVariant' | 'checkedRows' | 'onCheckedRowsChange' | 'rowKeyGetter' | 'onChangeUserColumns' | 'defaultUserColumns' | 'externalSortSettings' | 'externalFilterSettings' | '
|
|
82
|
+
export interface DataGridProviderProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Pick<GridProps<TRow, TSummaryRow, TKey>, 'rows' | 'columns' | 'rowActionsGetter' | 'rowHeaderHeights' | 'rowHeights' | 'initialRowHeightVariant' | 'checkedRows' | 'onCheckedRowsChange' | 'rowKeyGetter' | 'onChangeUserColumns' | 'defaultUserColumns' | 'externalSortSettings' | 'externalFilterSettings' | 'defaultViewMode' | 'cardsViewConfig'> {
|
|
83
83
|
id: number | string;
|
|
84
84
|
children: ReactNode;
|
|
85
85
|
rowsCount: number;
|
|
@@ -92,7 +92,7 @@ export type RowHeightState = {
|
|
|
92
92
|
rowHeight: number;
|
|
93
93
|
rowHeaderHeight: number;
|
|
94
94
|
};
|
|
95
|
-
export interface DataGridContextProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Pick<DataGridProviderProps<TRow, TSummaryRow, TKey>, 'rows' | 'checkedRows' | 'onCheckedRowsChange' | 'rowHeights' | 'rowsCount' | 'rowActionsGetter' | 'rowKeyGetter' | 'onChangeUserColumns' | 'externalSortSettings' | 'externalFilterSettings' | 'viewMode' | 'onViewModeChange' | '
|
|
95
|
+
export interface DataGridContextProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Pick<DataGridProviderProps<TRow, TSummaryRow, TKey>, 'rows' | 'checkedRows' | 'onCheckedRowsChange' | 'rowHeights' | 'rowsCount' | 'rowActionsGetter' | 'rowKeyGetter' | 'onChangeUserColumns' | 'externalSortSettings' | 'externalFilterSettings' | 'viewMode' | 'onViewModeChange' | 'defaultViewMode' | 'cardsViewConfig'> {
|
|
96
96
|
getConfigColumns: (viewMode: ViewMode) => IViewConfig[];
|
|
97
97
|
onChangeColumnsConfig: (viewMode: ViewMode, config: IViewConfig[]) => void;
|
|
98
98
|
onChangeColumnsOrder: (viewMode: ViewMode, sourceKey: string, targetKey: string) => void;
|
|
@@ -11,7 +11,7 @@ function Cards(props) {
|
|
|
11
11
|
selectedRows,
|
|
12
12
|
onSelectedRowsChange,
|
|
13
13
|
onRowsChange,
|
|
14
|
-
|
|
14
|
+
cardsViewConfig
|
|
15
15
|
} = props;
|
|
16
16
|
const processedColumns = useProcessedColumns(columns);
|
|
17
17
|
const allProcessedColumns = useProcessedColumns(columns, {
|
|
@@ -30,7 +30,7 @@ function Cards(props) {
|
|
|
30
30
|
selectedRows,
|
|
31
31
|
onSelectedRowsChange,
|
|
32
32
|
onRowsChange,
|
|
33
|
-
|
|
33
|
+
customRender: cardsViewConfig?.customRender
|
|
34
34
|
},
|
|
35
35
|
rowKeyGetter(row)
|
|
36
36
|
)) }) });
|
|
@@ -54,7 +54,7 @@ function CardHeader({ row, onOpenDetail }) {
|
|
|
54
54
|
}),
|
|
55
55
|
[]
|
|
56
56
|
);
|
|
57
|
-
return /* @__PURE__ */ jsxs(CardHeaderStyled, { children: [
|
|
57
|
+
return /* @__PURE__ */ jsxs(CardHeaderStyled, { ownerState: { hasCheckedRows: showCheckbox }, children: [
|
|
58
58
|
showCheckbox && /* @__PURE__ */ jsx(CardHeaderLeftStyled, { children: /* @__PURE__ */ jsx(
|
|
59
59
|
CheckboxCellAdapter,
|
|
60
60
|
{
|
|
@@ -3,4 +3,4 @@ import { CardRowProps } from '../../types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Componente que muestra una fila de tarjetas.
|
|
5
5
|
*/
|
|
6
|
-
export declare function CardRow<TRow, TKey extends RowKey = RowKey>({ row, columns, originalColumns, rowKeyGetter, selectedRows, onSelectedRowsChange, onRowsChange,
|
|
6
|
+
export declare function CardRow<TRow, TKey extends RowKey = RowKey>({ row, columns, originalColumns, rowKeyGetter, selectedRows, onSelectedRowsChange, onRowsChange, customRender, }: CardRowProps<TRow, TKey>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,10 +13,10 @@ function CardRow({
|
|
|
13
13
|
selectedRows,
|
|
14
14
|
onSelectedRowsChange,
|
|
15
15
|
onRowsChange,
|
|
16
|
-
|
|
16
|
+
customRender
|
|
17
17
|
}) {
|
|
18
18
|
const { checkedRows } = useDataGrid();
|
|
19
|
-
const
|
|
19
|
+
const hasCustomRender = customRender !== void 0;
|
|
20
20
|
const { cardContent, columnsCount, onOpenDetail } = useCardContent({
|
|
21
21
|
row,
|
|
22
22
|
columns,
|
|
@@ -28,14 +28,14 @@ function CardRow({
|
|
|
28
28
|
[checkedRows, rowKeyGetter, row]
|
|
29
29
|
);
|
|
30
30
|
const content = useMemo(() => {
|
|
31
|
-
if (
|
|
32
|
-
return
|
|
31
|
+
if (hasCustomRender) {
|
|
32
|
+
return customRender.renderContent(row);
|
|
33
33
|
}
|
|
34
34
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
35
35
|
/* @__PURE__ */ jsx(CardHeader, { row, onOpenDetail }),
|
|
36
36
|
cardContent
|
|
37
37
|
] });
|
|
38
|
-
}, [
|
|
38
|
+
}, [hasCustomRender, customRender, row, cardContent, onOpenDetail]);
|
|
39
39
|
const onCardClick = () => {
|
|
40
40
|
if (selectedRows && onSelectedRowsChange) {
|
|
41
41
|
if (selectedRows.has(rowKeyGetter(row))) {
|
|
@@ -46,11 +46,11 @@ function CardRow({
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
const dynamicMinHeight = useMemo(() => {
|
|
49
|
-
if (
|
|
50
|
-
return
|
|
49
|
+
if (hasCustomRender) {
|
|
50
|
+
return customRender.minHeight;
|
|
51
51
|
}
|
|
52
52
|
return Math.max(120, columnsCount * 32 + 40);
|
|
53
|
-
}, [
|
|
53
|
+
}, [hasCustomRender, customRender, columnsCount]);
|
|
54
54
|
return /* @__PURE__ */ jsx(LazyLoadCard, { threshold: 200, minHeight: dynamicMinHeight, children: /* @__PURE__ */ jsx(
|
|
55
55
|
CardStyled,
|
|
56
56
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Column, RowsChangeData } from 'react-data-grid';
|
|
2
|
-
import {
|
|
2
|
+
import { CardsViewConfig, RowKey } from '../../types';
|
|
3
3
|
import { Maybe } from '@m4l/core';
|
|
4
4
|
import { IViewConfig } from '../../contexts/DataGridContext/types';
|
|
5
5
|
import { Sizes } from '@m4l/styles';
|
|
@@ -95,9 +95,9 @@ export interface CardRowProps<TRow, TKey extends RowKey = RowKey> {
|
|
|
95
95
|
*/
|
|
96
96
|
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
98
|
+
* Indica si se debe renderizar el contenido personalizado de la tarjeta
|
|
99
99
|
*/
|
|
100
|
-
|
|
100
|
+
customRender?: CardsViewConfig<TRow>['customRender'];
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* Props para el componente CardDetails
|
|
@@ -17,11 +17,10 @@ function HeaderActions(props) {
|
|
|
17
17
|
rightActions,
|
|
18
18
|
withPager,
|
|
19
19
|
size,
|
|
20
|
-
columns
|
|
21
|
-
withViewMode = true
|
|
20
|
+
columns
|
|
22
21
|
} = props;
|
|
23
22
|
const isMobile = useIsMobile();
|
|
24
|
-
const { rowHeights, viewMode,
|
|
23
|
+
const { rowHeights, viewMode, cardsViewConfig } = useDataGrid();
|
|
25
24
|
const { currentSize } = useComponentSize(size);
|
|
26
25
|
return /* @__PURE__ */ jsx(ActionsRootStyled, { ownerState: { size: currentSize }, children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27
26
|
leftActions,
|
|
@@ -32,8 +31,8 @@ function HeaderActions(props) {
|
|
|
32
31
|
leftActions,
|
|
33
32
|
typeof rowHeights !== "number" && /* @__PURE__ */ jsx(Density, {}),
|
|
34
33
|
withLocalFilters && /* @__PURE__ */ jsx(Filter, {}),
|
|
35
|
-
withSettings && !(viewMode === "cards" &&
|
|
36
|
-
|
|
34
|
+
withSettings && !(viewMode === "cards" && cardsViewConfig?.customRender) && /* @__PURE__ */ jsx(Settings, { ...settingsProps, columns }),
|
|
35
|
+
cardsViewConfig !== void 0 && /* @__PURE__ */ jsx(ViewMode, {})
|
|
37
36
|
] }),
|
|
38
37
|
rightActions && /* @__PURE__ */ jsx(ContainerRightActionsStyled, { children: rightActions })
|
|
39
38
|
] }) });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CardsViewConfig } from '../../types';
|
|
2
|
+
interface UseCardsViewConfigProps {
|
|
3
|
+
/**
|
|
4
|
+
* Si es true, retorna cardsViewConfig con columnsConfig básica
|
|
5
|
+
*/
|
|
6
|
+
withBasicConfig?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Si es true, retorna cardsViewConfig con customRender
|
|
9
|
+
*/
|
|
10
|
+
withCustomRender?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Si es true, retorna cardsViewConfig solo con enabled=true (para demostrar error)
|
|
13
|
+
*/
|
|
14
|
+
withEnabledOnly?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Si es true, retorna cardsViewConfig con columnKey inválido (para demostrar error)
|
|
17
|
+
*/
|
|
18
|
+
withInvalidColumnKey?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Hook helper que genera configuraciones de cardsViewConfig para testing
|
|
22
|
+
*/
|
|
23
|
+
export declare const useCardsViewConfigHelper: <TRow = any>(props?: UseCardsViewConfigProps) => CardsViewConfig<TRow> | undefined;
|
|
24
|
+
export {};
|
|
@@ -150,14 +150,15 @@ export interface GridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> exte
|
|
|
150
150
|
* @default 'medium'
|
|
151
151
|
*/
|
|
152
152
|
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
153
|
-
/**
|
|
154
|
-
* Configuración personalizada para renderizado de cards
|
|
155
|
-
*/
|
|
156
|
-
cardSettings?: CardSettings<TRow>;
|
|
157
153
|
/**
|
|
158
154
|
* Modo por defecto de visualización
|
|
159
155
|
*/
|
|
160
156
|
defaultViewMode?: ViewMode;
|
|
157
|
+
/**
|
|
158
|
+
* Configuración de la vista de "cards"
|
|
159
|
+
* Incluye habilitación, configuración de columnas y renderizado personalizado
|
|
160
|
+
*/
|
|
161
|
+
cardsViewConfig?: CardsViewConfig<TRow>;
|
|
161
162
|
}
|
|
162
163
|
export declare const DATAGRID_TEST_ID = "m4ldatagrid";
|
|
163
164
|
export declare const PREFIX_TEST_ATTRIBUTE = "data-testid";
|
|
@@ -177,7 +178,6 @@ export interface ActionsProps {
|
|
|
177
178
|
withLocalFilters?: boolean;
|
|
178
179
|
leftActions?: React.ReactNode;
|
|
179
180
|
rightActions?: React.ReactNode;
|
|
180
|
-
withViewMode?: boolean;
|
|
181
181
|
}
|
|
182
182
|
/**
|
|
183
183
|
* Props para el hook useModalDetail
|
|
@@ -189,12 +189,44 @@ export interface UseModalDetailProps<TRow> {
|
|
|
189
189
|
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
192
|
-
* Configuración
|
|
192
|
+
* Configuración de una columna específica en vista "cards"
|
|
193
193
|
*/
|
|
194
|
-
export interface
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
export interface CardColumnConfig {
|
|
195
|
+
/**
|
|
196
|
+
* Key de la columna (debe coincidir con la key de la columna)
|
|
197
|
+
*/
|
|
198
|
+
columnKey: string;
|
|
199
|
+
/**
|
|
200
|
+
* Si se debe mostrar el título/label de esta columna en la card (Solo si no existe una config previa)
|
|
201
|
+
*/
|
|
202
|
+
showTitle: boolean;
|
|
197
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Cards con columnsConfig
|
|
206
|
+
*/
|
|
207
|
+
export interface CardsViewConfigWithColumns {
|
|
208
|
+
columnsConfig: CardColumnConfig[];
|
|
209
|
+
customRender?: never;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Cards con customRender
|
|
213
|
+
*/
|
|
214
|
+
export interface CardsViewConfigWithCustomRender<TRow> {
|
|
215
|
+
columnsConfig?: never;
|
|
216
|
+
customRender: {
|
|
217
|
+
renderContent: (row: TRow) => React.ReactNode;
|
|
218
|
+
minHeight: number;
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Configuración para la vista de "cards"
|
|
223
|
+
*
|
|
224
|
+
* IMPORTANTE:
|
|
225
|
+
* Es OBLIGATORIO configurar al menos 1 columna cuando customRender=undefined
|
|
226
|
+
* Se ignora completamente si customRender está definido
|
|
227
|
+
* @throws Error si customRender=undefined y array está vacío
|
|
228
|
+
*/
|
|
229
|
+
export type CardsViewConfig<TRow> = CardsViewConfigWithColumns | CardsViewConfigWithCustomRender<TRow>;
|
|
198
230
|
/**
|
|
199
231
|
* Opciones para el procesamiento de columnas
|
|
200
232
|
*/
|
|
@@ -219,6 +251,7 @@ export type DataGridOwnerState<TRow, TSummaryRow, TKey extends RowKey = RowKey>
|
|
|
219
251
|
viewMode?: ViewMode;
|
|
220
252
|
isActive?: boolean;
|
|
221
253
|
hasActions?: boolean;
|
|
254
|
+
hasCheckedRows?: boolean;
|
|
222
255
|
};
|
|
223
256
|
export type DataGridSlotsType = DataGridSlots | TextEditorSlots | ActionsSlots | RowsCountSlots | ColumnsConfigSlots | TableSlots | ControlNavigateSlots | ColumnIconFormatterSlots;
|
|
224
257
|
export type DataGridStyles = OverridesStyleRules<DataGridSlotsType, typeof DATAGRID_PREFIX_NAME, Theme>;
|