@m4l/components 9.3.21 → 9.3.22
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 +9 -4
- package/components/DataGrid/Datagrid.styles.js +270 -0
- package/components/DataGrid/constants.js +2 -2
- package/components/DataGrid/contexts/DataGridContext/index.js +317 -112
- package/components/DataGrid/contexts/DataGridContext/types.d.ts +63 -4
- package/components/DataGrid/dictionary.d.ts +5 -0
- package/components/DataGrid/dictionary.js +6 -1
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/formatter.js +2 -2
- package/components/DataGrid/hooks/useModalCardDetail.d.ts +6 -0
- package/components/DataGrid/hooks/useModalCardDetail.js +74 -0
- package/components/DataGrid/hooks/useProcessedColumns.d.ts +50 -0
- package/components/DataGrid/hooks/useProcessedColumns.js +44 -0
- package/components/DataGrid/icons.d.ts +7 -0
- package/components/DataGrid/icons.js +5 -1
- package/components/DataGrid/index.d.ts +1 -1
- package/components/DataGrid/slots/DataGridEnum.d.ts +22 -1
- package/components/DataGrid/slots/DataGridEnum.js +21 -0
- package/components/DataGrid/slots/DataGridSlot.d.ts +24 -0
- package/components/DataGrid/slots/DataGridSlot.js +123 -21
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +9 -0
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +91 -0
- package/components/DataGrid/subcomponents/Cards/index.d.ts +5 -0
- package/components/DataGrid/subcomponents/Cards/index.js +40 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.d.ts +8 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +79 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.d.ts +7 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +98 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +6 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +71 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/IntersectCard/index.d.ts +20 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/IntersectCard/index.js +46 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/LazyLoadCard/index.d.ts +17 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/LazyLoadCard/index.js +34 -0
- package/components/DataGrid/subcomponents/Cards/types.d.ts +118 -0
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.d.ts +7 -0
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +43 -0
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/types.d.ts +7 -0
- package/components/DataGrid/subcomponents/ControlNavigate/ControlNavigate.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/index.js +5 -3
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/RowsCount/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/index.js +11 -2
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.d.ts +2 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.js +304 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/types.d.ts +31 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.d.ts +4 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.js +125 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.js +2 -2
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/index.d.ts +7 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/index.js +74 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/types.d.ts +4 -0
- package/components/DataGrid/subcomponents/RenderContent/index.d.ts +5 -0
- package/components/DataGrid/subcomponents/RenderContent/index.js +11 -0
- package/components/DataGrid/subcomponents/Table/hooks/useHeaderMenuActions.js +2 -2
- package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +1 -1
- package/components/DataGrid/subcomponents/Table/index.js +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/ActionsColumn.js +1 -1
- 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/tests/components/CardDetails.test.d.ts +1 -0
- package/components/DataGrid/tests/components/CardHeader.test.d.ts +1 -0
- package/components/DataGrid/tests/components/CardRow.test.d.ts +1 -0
- package/components/DataGrid/tests/components/Cards.test.d.ts +1 -0
- package/components/DataGrid/tests/components/CheckboxCellAdapter.test.d.ts +1 -0
- package/components/DataGrid/tests/components/ColumnsConfigCards.test.d.ts +1 -0
- package/components/DataGrid/tests/components/IntersectCard.test.d.ts +1 -0
- package/components/DataGrid/tests/components/ViewMode.test.d.ts +1 -0
- package/components/DataGrid/tests/helpers/useCardsViewConfig.d.ts +24 -0
- package/components/DataGrid/tests/helpers/useCustomCardExample.d.ts +7 -0
- package/components/DataGrid/tests/hooks/useCardContent.test.d.ts +1 -0
- package/components/DataGrid/tests/hooks/useModalDetail.test.d.ts +1 -0
- package/components/DataGrid/tests/hooks/useModalSettingsCards.test.d.ts +1 -0
- package/components/DataGrid/tests/hooks/useProcessedColumns.test.d.ts +1 -0
- package/components/DataGrid/types.d.ts +87 -5
- package/components/MFIsolationAppStorybook/MFIsolationAppStorybook.d.ts +5 -0
- package/components/MFIsolationAppStorybook/constants.d.ts +1 -0
- package/components/MFIsolationAppStorybook/icons.d.ts +3 -0
- package/components/MFIsolationAppStorybook/index.d.ts +1 -0
- package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/AppBarSettings.d.ts +4 -0
- package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/index.d.ts +1 -0
- package/components/MFIsolationAppStorybook/subcomponents/MFAuthAppStorybook/MFAuthAppStorybook.d.ts +5 -0
- package/components/MFIsolationAppStorybook/subcomponents/MFAuthAppStorybook/index.d.ts +1 -0
- package/components/MFIsolationAppStorybook/subcomponents/MFAuthAppStorybook/types.d.ts +4 -0
- package/components/MFIsolationAppStorybook/types.d.ts +31 -0
- package/components/MenuActions/MenuActions.js +105 -55
- package/components/areas/contexts/AreasContext/store.js +2 -2
- package/components/hook-form/RHFormContext/index.d.ts +1 -1
- package/hooks/useDataGridPersistence/helpers.d.ts +2 -2
- package/hooks/useDataGridPersistence/useDataGridPersistence.d.ts +2 -2
- package/hooks/useDataGridPersistence/useDataGridPersistence.js +5 -0
- package/index.js +8 -8
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { C as CheckboxCellAdapter } from "../../subcomponents/CheckboxCellAdapter/index.js";
|
|
3
3
|
function ColumnSetCheckFormatter(parameters) {
|
|
4
4
|
const { field, disabledGetter, rowKeyGetter, useHook } = parameters;
|
|
5
5
|
const formatter = (props) => {
|
|
@@ -19,7 +19,7 @@ function ColumnSetCheckFormatter(parameters) {
|
|
|
19
19
|
disabled = disabledGetter(row);
|
|
20
20
|
}
|
|
21
21
|
return /* @__PURE__ */ jsx(
|
|
22
|
-
|
|
22
|
+
CheckboxCellAdapter,
|
|
23
23
|
{
|
|
24
24
|
value: checkedRows.has(rowKeyGetter(row)) || false,
|
|
25
25
|
disabled,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseModalDetailProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook genérico que renderiza el modal de detalle para cualquier vista
|
|
4
|
+
* mostrando TODAS las columnas sin excepción
|
|
5
|
+
*/
|
|
6
|
+
export declare const useModalDetail: <TRow>({ row, columns, viewMode, onRowsChange, }: UseModalDetailProps<TRow>) => () => void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useModuleDictionary, useEnvironment } from "@m4l/core";
|
|
3
|
+
import { useIsMobile } from "@m4l/graphics";
|
|
4
|
+
import { useCallback } from "react";
|
|
5
|
+
import { u as useModal } from "../../../hooks/useModal/index.js";
|
|
6
|
+
import { b as ContentModalSettingStyled, D as DataGridRootStyled } from "../slots/DataGridSlot.js";
|
|
7
|
+
import { p as pathIcons } from "../icons.js";
|
|
8
|
+
import { C as CardDetails } from "../subcomponents/Cards/subcomponents/CardDetails/index.js";
|
|
9
|
+
import { D as DICTIONARY } from "../dictionary.js";
|
|
10
|
+
import { u as useDataGrid } from "./useDataGrid.js";
|
|
11
|
+
import { A as ActionsContainer } from "../../CommonActions/components/ActionsContainer/ActionsContainer.js";
|
|
12
|
+
import { W as WindowBase } from "../../WindowBase/WindowBase.js";
|
|
13
|
+
import { A as ActionCancel } from "../../CommonActions/components/ActionCancel/ActionCancel.js";
|
|
14
|
+
const useModalDetail = ({
|
|
15
|
+
row,
|
|
16
|
+
columns,
|
|
17
|
+
viewMode,
|
|
18
|
+
onRowsChange
|
|
19
|
+
}) => {
|
|
20
|
+
const { getConfigColumns, size } = useDataGrid();
|
|
21
|
+
const { openModal, closeModal } = useModal();
|
|
22
|
+
const { getLabel } = useModuleDictionary();
|
|
23
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
24
|
+
const isMobile = useIsMobile();
|
|
25
|
+
const onOpenDetail = useCallback(() => {
|
|
26
|
+
const viewColumnsConfig = getConfigColumns(viewMode);
|
|
27
|
+
openModal({
|
|
28
|
+
initialWidth: 500,
|
|
29
|
+
initialHeight: 680,
|
|
30
|
+
fullScreen: isMobile,
|
|
31
|
+
window: /* @__PURE__ */ jsx(
|
|
32
|
+
WindowBase,
|
|
33
|
+
{
|
|
34
|
+
title: getLabel(DICTIONARY.DETAILS),
|
|
35
|
+
iconUrl: `${host_static_assets}/${environment_assets}/${pathIcons.info}`,
|
|
36
|
+
onClose: closeModal,
|
|
37
|
+
className: "detail-modal",
|
|
38
|
+
variant: "outlined",
|
|
39
|
+
emergeType: "modal",
|
|
40
|
+
children: /* @__PURE__ */ jsxs(ContentModalSettingStyled, { children: [
|
|
41
|
+
/* @__PURE__ */ jsx(DataGridRootStyled, { children: /* @__PURE__ */ jsx(
|
|
42
|
+
CardDetails,
|
|
43
|
+
{
|
|
44
|
+
row,
|
|
45
|
+
columns,
|
|
46
|
+
viewColumnsConfig,
|
|
47
|
+
onRowsChange,
|
|
48
|
+
size: size || "medium"
|
|
49
|
+
}
|
|
50
|
+
) }),
|
|
51
|
+
/* @__PURE__ */ jsx(ActionsContainer, { children: /* @__PURE__ */ jsx(ActionCancel, { onClick: closeModal }) })
|
|
52
|
+
] })
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
});
|
|
56
|
+
}, [
|
|
57
|
+
row,
|
|
58
|
+
columns,
|
|
59
|
+
viewMode,
|
|
60
|
+
onRowsChange,
|
|
61
|
+
size,
|
|
62
|
+
getConfigColumns,
|
|
63
|
+
openModal,
|
|
64
|
+
closeModal,
|
|
65
|
+
getLabel,
|
|
66
|
+
host_static_assets,
|
|
67
|
+
environment_assets,
|
|
68
|
+
isMobile
|
|
69
|
+
]);
|
|
70
|
+
return onOpenDetail;
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
useModalDetail as u
|
|
74
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Column } from 'react-data-grid';
|
|
2
|
+
import { ProcessedColumnsOptions } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Hook que procesa columnas para cualquier vista que no sea Table.
|
|
5
|
+
* - Aplica configuración de visibilidad y orden (opcional)
|
|
6
|
+
* - Convierte formatters a renderCell
|
|
7
|
+
* - Filtra columnas especiales (SelectColumn, ActionsColumn)
|
|
8
|
+
* - Filtra cualquier columna con renderCell problemático
|
|
9
|
+
* @param columns - Columnas originales del DataGrid
|
|
10
|
+
* @param options - Opciones de procesamiento
|
|
11
|
+
* @returns Columnas procesadas y filtradas listas para usar en cualquier vista
|
|
12
|
+
*/
|
|
13
|
+
export declare function useProcessedColumns<TRow, TSummaryRow>(columns: readonly Column<TRow, TSummaryRow>[], options?: ProcessedColumnsOptions): {
|
|
14
|
+
name: string | import('react').ReactElement;
|
|
15
|
+
key: string;
|
|
16
|
+
width?: string | number | null | undefined;
|
|
17
|
+
minWidth?: number | null | undefined;
|
|
18
|
+
maxWidth?: number | null | undefined;
|
|
19
|
+
cellClass?: string | ((row: TRow) => string | null | undefined) | null | undefined;
|
|
20
|
+
headerCellClass?: string | null | undefined;
|
|
21
|
+
summaryCellClass?: string | ((row: TSummaryRow) => string | null | undefined) | null | undefined;
|
|
22
|
+
renderHeaderCell?: ((props: import('react-data-grid').RenderHeaderCellProps<TRow, TSummaryRow>) => import('react').ReactNode) | null | undefined;
|
|
23
|
+
renderCell?: ((props: import('react-data-grid').RenderCellProps<TRow, TSummaryRow>) => import('react').ReactNode) | null | undefined;
|
|
24
|
+
renderSummaryCell?: ((props: import('react-data-grid').RenderSummaryCellProps<TSummaryRow, TRow>) => import('react').ReactNode) | null | undefined;
|
|
25
|
+
renderGroupCell?: ((props: import('react-data-grid').RenderGroupCellProps<TRow, TSummaryRow>) => import('react').ReactNode) | null | undefined;
|
|
26
|
+
renderEditCell?: ((props: import('react-data-grid').RenderEditCellProps<TRow, TSummaryRow>) => import('react').ReactNode) | null | undefined;
|
|
27
|
+
editable?: boolean | ((row: TRow) => boolean) | null | undefined;
|
|
28
|
+
colSpan?: ((args: import('react-data-grid').ColSpanArgs<TRow, TSummaryRow>) => number | null | undefined) | null | undefined;
|
|
29
|
+
frozen?: boolean | null | undefined;
|
|
30
|
+
resizable?: boolean | null | undefined;
|
|
31
|
+
sortable?: boolean | null | undefined;
|
|
32
|
+
draggable?: boolean | null | undefined;
|
|
33
|
+
sortDescendingFirst?: boolean | null | undefined;
|
|
34
|
+
editorOptions?: {
|
|
35
|
+
readonly displayCellContent?: boolean | null | undefined;
|
|
36
|
+
readonly commitOnOutsideClick?: boolean | null | undefined;
|
|
37
|
+
} | null | undefined;
|
|
38
|
+
visible?: boolean;
|
|
39
|
+
hidden?: boolean;
|
|
40
|
+
fixed?: boolean;
|
|
41
|
+
type: import('../types').ColumnType;
|
|
42
|
+
align?: import('../types').ColumnAlign;
|
|
43
|
+
isDraggable?: boolean;
|
|
44
|
+
withFilter?: boolean;
|
|
45
|
+
withinHeaderRenderer?: import('react').FunctionComponent<import('react-data-grid').RenderHeaderCellProps<TRow, TSummaryRow>> | undefined;
|
|
46
|
+
customFilter?: ((row: TRow, value: string) => boolean) | undefined;
|
|
47
|
+
customSort?: ((a: TRow, b: TRow) => number) | undefined;
|
|
48
|
+
formatter?: ((props: any) => JSX.Element) | undefined;
|
|
49
|
+
editor?: import('@m4l/core').Maybe<(props: import('react-data-grid').RenderEditCellProps<TRow, TSummaryRow>) => import('react').ReactNode>;
|
|
50
|
+
}[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { u as useDataGrid } from "./useDataGrid.js";
|
|
3
|
+
import { d as DATAGRID_SELECT_COLUMN_KEY, e as DATAGRID_ACTIONS_COLUMN_KEY } from "../constants.js";
|
|
4
|
+
function useProcessedColumns(columns, options = {}) {
|
|
5
|
+
const { applyVisibilityFilter = true } = options;
|
|
6
|
+
const { getConfigColumns, viewMode } = useDataGrid();
|
|
7
|
+
const columnsConfig = useMemo(
|
|
8
|
+
() => getConfigColumns(viewMode || "cards"),
|
|
9
|
+
[getConfigColumns, viewMode]
|
|
10
|
+
);
|
|
11
|
+
return useMemo(() => {
|
|
12
|
+
const processedColumns = columns.filter((column) => {
|
|
13
|
+
if (column.key === DATAGRID_SELECT_COLUMN_KEY || column.key === DATAGRID_ACTIONS_COLUMN_KEY) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
if (!applyVisibilityFilter) {
|
|
17
|
+
return !column.hidden;
|
|
18
|
+
}
|
|
19
|
+
const columnConfig = columnsConfig.find((c) => c.key === column.key);
|
|
20
|
+
const visible = columnConfig ? columnConfig.visible : true;
|
|
21
|
+
return !column.hidden && visible;
|
|
22
|
+
}).map((column) => {
|
|
23
|
+
const newColumn = { ...column };
|
|
24
|
+
if (newColumn.formatter && !newColumn.renderCell) {
|
|
25
|
+
newColumn.renderCell = newColumn.formatter;
|
|
26
|
+
}
|
|
27
|
+
if (newColumn.editor && !newColumn.renderEditCell) {
|
|
28
|
+
newColumn.renderEditCell = newColumn.editor;
|
|
29
|
+
}
|
|
30
|
+
return newColumn;
|
|
31
|
+
});
|
|
32
|
+
processedColumns.sort((a, b) => {
|
|
33
|
+
const indexA = columnsConfig.findIndex((c) => c.key === a.key);
|
|
34
|
+
const indexB = columnsConfig.findIndex((c) => c.key === b.key);
|
|
35
|
+
const orderA = indexA === -1 ? columnsConfig.length : indexA;
|
|
36
|
+
const orderB = indexB === -1 ? columnsConfig.length : indexB;
|
|
37
|
+
return orderA - orderB;
|
|
38
|
+
});
|
|
39
|
+
return processedColumns;
|
|
40
|
+
}, [columns, columnsConfig, applyVisibilityFilter]);
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
useProcessedColumns as u
|
|
44
|
+
};
|
|
@@ -20,4 +20,11 @@ export declare const pathIcons: {
|
|
|
20
20
|
freezeColumn: string;
|
|
21
21
|
unfreezeColumn: string;
|
|
22
22
|
hideColumn: string;
|
|
23
|
+
viewTable: string;
|
|
24
|
+
viewCards: string;
|
|
25
|
+
info: string;
|
|
26
|
+
expanded: string;
|
|
27
|
+
mail: string;
|
|
28
|
+
smartphone: string;
|
|
29
|
+
internet: string;
|
|
23
30
|
};
|
|
@@ -19,7 +19,11 @@ const pathIcons = {
|
|
|
19
19
|
removeSort: "frontend/components/data_grid/assets/icons/eraser.svg",
|
|
20
20
|
freezeColumn: "frontend/components/data_grid/assets/icons/pin.svg",
|
|
21
21
|
unfreezeColumn: "frontend/components/data_grid/assets/icons/pin-off.svg",
|
|
22
|
-
hideColumn: "frontend/components/data_grid/assets/icons/eye-off.svg"
|
|
22
|
+
hideColumn: "frontend/components/data_grid/assets/icons/eye-off.svg",
|
|
23
|
+
viewTable: "frontend/components/data_grid/assets/icons/table.svg",
|
|
24
|
+
viewCards: "frontend/components/data_grid/assets/icons/card.svg",
|
|
25
|
+
info: "frontend/components/data_grid/assets/icons/info.svg",
|
|
26
|
+
expanded: "frontend/components/data_grid/assets/icons/expanded.svg"
|
|
23
27
|
};
|
|
24
28
|
export {
|
|
25
29
|
pathIcons as p
|
|
@@ -5,5 +5,5 @@ export type { RowKey, ChangeUserColumn } from './types';
|
|
|
5
5
|
export { getDataGridComponentsDictionary } from './dictionary';
|
|
6
6
|
export { TextEditor, NumberEditor } from './subcomponents/editors/TextEditor';
|
|
7
7
|
export { getDataGridRowsFromSet } from './utils/getDataGridRowsFromSet';
|
|
8
|
-
export type { IGridConfig, BaseConfigColumn } from './contexts/DataGridContext/types';
|
|
8
|
+
export type { IGridConfig, IGridConfigExtended, BaseConfigColumn } from './contexts/DataGridContext/types';
|
|
9
9
|
export { DATAGRID_SEMANTIC_WIDTHS, DATAGRID_ROW_HEADER_HEIGHTS, DATAGRID_ROW_HEIGHTS } from './constants';
|
|
@@ -27,7 +27,28 @@ export declare enum TableSlots {
|
|
|
27
27
|
buttonHeaderActions = "buttonHeaderActions",
|
|
28
28
|
nameColumnIcon = "nameColumnIcon",
|
|
29
29
|
iconColumn = "iconColumn",
|
|
30
|
-
nameColumn = "nameColumn"
|
|
30
|
+
nameColumn = "nameColumn",
|
|
31
|
+
containerToggleCards = "containerToggleCards",
|
|
32
|
+
cardToggleCardButton = "cardToggleCardButton",
|
|
33
|
+
textToggleCardButton = "textToggleCardButton",
|
|
34
|
+
card = "card",
|
|
35
|
+
cardsContainer = "cardsContainer",
|
|
36
|
+
cardHeader = "cardHeader",
|
|
37
|
+
cardHeaderLeft = "cardHeaderLeft",
|
|
38
|
+
cardHeaderRight = "cardHeaderRight",
|
|
39
|
+
containerLabelValueColumn = "containerLabelValueColumn",
|
|
40
|
+
contentWrapperColumn = "contentWrapperColumn",
|
|
41
|
+
cardDetailContainer = "cardDetailContainer",
|
|
42
|
+
labelHeaderColumn = "labelHeaderColumn",
|
|
43
|
+
valueColumn = "valueColumn",
|
|
44
|
+
customCardHeader = "customCardHeader",
|
|
45
|
+
customCardAvatar = "customCardAvatar",
|
|
46
|
+
customCardNameEmail = "customCardNameEmail",
|
|
47
|
+
customCardFieldWithIcon = "customCardFieldWithIcon",
|
|
48
|
+
customCardFieldContent = "customCardFieldContent",
|
|
49
|
+
customCardIconContainer = "customCardIconContainer",
|
|
50
|
+
checkboxCellWrapper = "checkboxCellWrapper",
|
|
51
|
+
editorCellWrapper = "editorCellWrapper"
|
|
31
52
|
}
|
|
32
53
|
export declare enum TextEditorSlots {
|
|
33
54
|
inputTexEditor = "inputTexEditor"
|
|
@@ -31,6 +31,27 @@ var TableSlots = /* @__PURE__ */ ((TableSlots2) => {
|
|
|
31
31
|
TableSlots2["nameColumnIcon"] = "nameColumnIcon";
|
|
32
32
|
TableSlots2["iconColumn"] = "iconColumn";
|
|
33
33
|
TableSlots2["nameColumn"] = "nameColumn";
|
|
34
|
+
TableSlots2["containerToggleCards"] = "containerToggleCards";
|
|
35
|
+
TableSlots2["cardToggleCardButton"] = "cardToggleCardButton";
|
|
36
|
+
TableSlots2["textToggleCardButton"] = "textToggleCardButton";
|
|
37
|
+
TableSlots2["card"] = "card";
|
|
38
|
+
TableSlots2["cardsContainer"] = "cardsContainer";
|
|
39
|
+
TableSlots2["cardHeader"] = "cardHeader";
|
|
40
|
+
TableSlots2["cardHeaderLeft"] = "cardHeaderLeft";
|
|
41
|
+
TableSlots2["cardHeaderRight"] = "cardHeaderRight";
|
|
42
|
+
TableSlots2["containerLabelValueColumn"] = "containerLabelValueColumn";
|
|
43
|
+
TableSlots2["contentWrapperColumn"] = "contentWrapperColumn";
|
|
44
|
+
TableSlots2["cardDetailContainer"] = "cardDetailContainer";
|
|
45
|
+
TableSlots2["labelHeaderColumn"] = "labelHeaderColumn";
|
|
46
|
+
TableSlots2["valueColumn"] = "valueColumn";
|
|
47
|
+
TableSlots2["customCardHeader"] = "customCardHeader";
|
|
48
|
+
TableSlots2["customCardAvatar"] = "customCardAvatar";
|
|
49
|
+
TableSlots2["customCardNameEmail"] = "customCardNameEmail";
|
|
50
|
+
TableSlots2["customCardFieldWithIcon"] = "customCardFieldWithIcon";
|
|
51
|
+
TableSlots2["customCardFieldContent"] = "customCardFieldContent";
|
|
52
|
+
TableSlots2["customCardIconContainer"] = "customCardIconContainer";
|
|
53
|
+
TableSlots2["checkboxCellWrapper"] = "checkboxCellWrapper";
|
|
54
|
+
TableSlots2["editorCellWrapper"] = "editorCellWrapper";
|
|
34
55
|
return TableSlots2;
|
|
35
56
|
})(TableSlots || {});
|
|
36
57
|
var TextEditorSlots = /* @__PURE__ */ ((TextEditorSlots2) => {
|
|
@@ -37,6 +37,30 @@ export declare const ColumnsConfigActiosStyled: import('@emotion/styled').Styled
|
|
|
37
37
|
* ****************
|
|
38
38
|
*/
|
|
39
39
|
export declare const TableContainerStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
40
|
+
export declare const ContainerToggleCardsStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
41
|
+
export declare const CardToggleButtonStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
|
|
42
|
+
export declare const TextToggleCardButtonStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
|
|
43
|
+
export declare const CardStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
|
|
44
|
+
export declare const CardHeaderStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
45
|
+
export declare const CardHeaderLeftStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
46
|
+
export declare const CardHeaderRightStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
47
|
+
export declare const CardsContainerStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
|
|
48
|
+
export declare const ContainerLabelValueColumnStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
49
|
+
export declare const ContentWrapperColumnStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
50
|
+
export declare const CardDetailContainerStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
51
|
+
export declare const LabelHeaderColumnStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
|
|
52
|
+
export declare const ValueColumnStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
|
|
53
|
+
export declare const CheckboxCellWrapperStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
54
|
+
export declare const EditorCellWrapperStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
55
|
+
/**
|
|
56
|
+
* Slots para cards personalizadas
|
|
57
|
+
*/
|
|
58
|
+
export declare const CustomCardHeaderStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
59
|
+
export declare const CustomCardAvatarStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
60
|
+
export declare const CustomCardNameEmailStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
61
|
+
export declare const CustomCardFieldWithIconStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
62
|
+
export declare const CustomCardFieldContentStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
63
|
+
export declare const CustomCardIconContainerStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
40
64
|
export declare const TableWrapperDataGridStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
41
65
|
export declare const DraggableHeaderRootStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
42
66
|
export declare const IconSearchStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
|
|
@@ -1,9 +1,12 @@
|
|
|
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, T as TextEditorSlots, A as ActionsSlots,
|
|
4
|
+
import { D as DataGridSlots, T as TextEditorSlots, A as ActionsSlots, C as ControlNavigateSlots, c as ColumnIconFormatterSlots, b as TableSlots, R as RowsCountSlots, a as ColumnsConfigSlots } from "./DataGridEnum.js";
|
|
5
5
|
import { d as dataGridStyles } from "../Datagrid.styles.js";
|
|
6
6
|
import { I as Icon } from "../../Icon/Icon.js";
|
|
7
|
+
import { C as Card } from "../../Card/Card.js";
|
|
8
|
+
import { C as ContainerFlow } from "../../ContainerFlow/ContainerFlow.js";
|
|
9
|
+
import { T as Typography } from "../../mui_extended/Typography/Typography.js";
|
|
7
10
|
const DataGridRootStyled = styled("div", {
|
|
8
11
|
name: DATAGRID_PREFIX_NAME,
|
|
9
12
|
slot: DataGridSlots.datagridRoot
|
|
@@ -60,6 +63,90 @@ const TableContainerStyled = styled("div", {
|
|
|
60
63
|
name: DATAGRID_PREFIX_NAME,
|
|
61
64
|
slot: TableSlots.tableContaniner
|
|
62
65
|
})(dataGridStyles.tableContaniner);
|
|
66
|
+
const ContainerToggleCardsStyled = styled("div", {
|
|
67
|
+
name: DATAGRID_PREFIX_NAME,
|
|
68
|
+
slot: TableSlots.containerToggleCards
|
|
69
|
+
})(dataGridStyles.containerToggleCards);
|
|
70
|
+
const CardToggleButtonStyled = styled(Card, {
|
|
71
|
+
name: DATAGRID_PREFIX_NAME,
|
|
72
|
+
slot: TableSlots.cardToggleCardButton
|
|
73
|
+
})(dataGridStyles.cardToggleCardButton);
|
|
74
|
+
const TextToggleCardButtonStyled = styled(Typography, {
|
|
75
|
+
name: DATAGRID_PREFIX_NAME,
|
|
76
|
+
slot: TableSlots.textToggleCardButton
|
|
77
|
+
})(dataGridStyles.textToggleCardButton);
|
|
78
|
+
const CardStyled = styled(Card, {
|
|
79
|
+
name: DATAGRID_PREFIX_NAME,
|
|
80
|
+
slot: TableSlots.card
|
|
81
|
+
})(dataGridStyles.card);
|
|
82
|
+
const CardHeaderStyled = styled("div", {
|
|
83
|
+
name: DATAGRID_PREFIX_NAME,
|
|
84
|
+
slot: TableSlots.cardHeader
|
|
85
|
+
})(dataGridStyles.cardHeader);
|
|
86
|
+
const CardHeaderLeftStyled = styled("div", {
|
|
87
|
+
name: DATAGRID_PREFIX_NAME,
|
|
88
|
+
slot: TableSlots.cardHeaderLeft
|
|
89
|
+
})(dataGridStyles.cardHeaderLeft);
|
|
90
|
+
const CardHeaderRightStyled = styled("div", {
|
|
91
|
+
name: DATAGRID_PREFIX_NAME,
|
|
92
|
+
slot: TableSlots.cardHeaderRight
|
|
93
|
+
})(dataGridStyles.cardHeaderRight);
|
|
94
|
+
const CardsContainerStyled = styled(ContainerFlow, {
|
|
95
|
+
name: DATAGRID_PREFIX_NAME,
|
|
96
|
+
slot: TableSlots.cardsContainer
|
|
97
|
+
})(dataGridStyles.cardsContainer);
|
|
98
|
+
const ContainerLabelValueColumnStyled = styled("div", {
|
|
99
|
+
name: DATAGRID_PREFIX_NAME,
|
|
100
|
+
slot: TableSlots.containerLabelValueColumn
|
|
101
|
+
})(dataGridStyles.containerLabelValueColumn);
|
|
102
|
+
const ContentWrapperColumnStyled = styled("div", {
|
|
103
|
+
name: DATAGRID_PREFIX_NAME,
|
|
104
|
+
slot: TableSlots.contentWrapperColumn
|
|
105
|
+
})(dataGridStyles.contentWrapperColumn);
|
|
106
|
+
const CardDetailContainerStyled = styled("div", {
|
|
107
|
+
name: DATAGRID_PREFIX_NAME,
|
|
108
|
+
slot: TableSlots.cardDetailContainer
|
|
109
|
+
})(dataGridStyles.cardDetailContainer);
|
|
110
|
+
const LabelHeaderColumnStyled = styled(Typography, {
|
|
111
|
+
name: DATAGRID_PREFIX_NAME,
|
|
112
|
+
slot: TableSlots.labelHeaderColumn
|
|
113
|
+
})(dataGridStyles.labelHeaderColumn);
|
|
114
|
+
const ValueColumnStyled = styled(Typography, {
|
|
115
|
+
name: DATAGRID_PREFIX_NAME,
|
|
116
|
+
slot: TableSlots.valueColumn
|
|
117
|
+
})(dataGridStyles.valueColumn);
|
|
118
|
+
const CheckboxCellWrapperStyled = styled("div", {
|
|
119
|
+
name: DATAGRID_PREFIX_NAME,
|
|
120
|
+
slot: TableSlots.checkboxCellWrapper
|
|
121
|
+
})(dataGridStyles.checkboxCellWrapper);
|
|
122
|
+
const EditorCellWrapperStyled = styled("div", {
|
|
123
|
+
name: DATAGRID_PREFIX_NAME,
|
|
124
|
+
slot: TableSlots.editorCellWrapper
|
|
125
|
+
})(dataGridStyles.editorCellWrapper);
|
|
126
|
+
styled("div", {
|
|
127
|
+
name: DATAGRID_PREFIX_NAME,
|
|
128
|
+
slot: TableSlots.customCardHeader
|
|
129
|
+
})(dataGridStyles.customCardHeader);
|
|
130
|
+
styled("div", {
|
|
131
|
+
name: DATAGRID_PREFIX_NAME,
|
|
132
|
+
slot: TableSlots.customCardAvatar
|
|
133
|
+
})(dataGridStyles.customCardAvatar);
|
|
134
|
+
styled("div", {
|
|
135
|
+
name: DATAGRID_PREFIX_NAME,
|
|
136
|
+
slot: TableSlots.customCardNameEmail
|
|
137
|
+
})(dataGridStyles.customCardNameEmail);
|
|
138
|
+
styled("div", {
|
|
139
|
+
name: DATAGRID_PREFIX_NAME,
|
|
140
|
+
slot: TableSlots.customCardFieldWithIcon
|
|
141
|
+
})(dataGridStyles.customCardFieldWithIcon);
|
|
142
|
+
styled("div", {
|
|
143
|
+
name: DATAGRID_PREFIX_NAME,
|
|
144
|
+
slot: TableSlots.customCardFieldContent
|
|
145
|
+
})(dataGridStyles.customCardFieldContent);
|
|
146
|
+
styled("div", {
|
|
147
|
+
name: DATAGRID_PREFIX_NAME,
|
|
148
|
+
slot: TableSlots.customCardIconContainer
|
|
149
|
+
})(dataGridStyles.customCardIconContainer);
|
|
63
150
|
const TableWrapperDataGridStyled = styled("div", {
|
|
64
151
|
name: DATAGRID_PREFIX_NAME,
|
|
65
152
|
slot: TableSlots.tableWrapperDataGrid
|
|
@@ -126,33 +213,48 @@ const ColumnIconFormatterStyled = styled("div", {
|
|
|
126
213
|
})(dataGridStyles.columnIconFormatter);
|
|
127
214
|
export {
|
|
128
215
|
ActionsRootStyled as A,
|
|
129
|
-
|
|
216
|
+
DraggableHeaderRootStyled as B,
|
|
130
217
|
CustomHeaderStyled as C,
|
|
131
218
|
DataGridRootStyled as D,
|
|
132
|
-
|
|
219
|
+
EditorCellWrapperStyled as E,
|
|
220
|
+
ButtonHeaderActionsStyled as F,
|
|
221
|
+
DraggableWrapperInputBaseStyled as G,
|
|
222
|
+
IconSearchStyled as H,
|
|
133
223
|
IconColumnStyled as I,
|
|
224
|
+
HeaderInputBaseStyled as J,
|
|
225
|
+
HeaderRenderClickStyled as K,
|
|
226
|
+
LabelHeaderColumnStyled as L,
|
|
134
227
|
MenuListStyled as M,
|
|
135
228
|
NameColumnIconStyled as N,
|
|
229
|
+
InputTextEditorStyled as O,
|
|
136
230
|
RowsCountRootStyled as R,
|
|
137
231
|
TableWrapperDataGridStyled as T,
|
|
232
|
+
ValueColumnStyled as V,
|
|
138
233
|
WrapperSkeletonStyled as W,
|
|
139
234
|
ColumnIconFormatterStyled as a,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
235
|
+
ContentModalSettingStyled as b,
|
|
236
|
+
ContainerLabelValueColumnStyled as c,
|
|
237
|
+
ContentWrapperColumnStyled as d,
|
|
238
|
+
CardsContainerStyled as e,
|
|
239
|
+
CardDetailContainerStyled as f,
|
|
240
|
+
CardHeaderStyled as g,
|
|
241
|
+
CardHeaderLeftStyled as h,
|
|
242
|
+
CardHeaderRightStyled as i,
|
|
243
|
+
CardStyled as j,
|
|
244
|
+
CheckboxCellWrapperStyled as k,
|
|
245
|
+
ControlNavigateStyled as l,
|
|
246
|
+
ActionsConfigContainerStyled as m,
|
|
247
|
+
ContainerLeftActionsStyled as n,
|
|
248
|
+
ContainerRightActionsStyled as o,
|
|
249
|
+
RowsCountLabelStyled as p,
|
|
250
|
+
RowsCountValueStyled as q,
|
|
251
|
+
ColumnsConfigWrapperStyled as r,
|
|
252
|
+
ColumnsConfigDataGridStyled as s,
|
|
253
|
+
ColumnsConfigSelColumnsStyled as t,
|
|
254
|
+
ColumnsConfigActiosStyled as u,
|
|
255
|
+
ContainerToggleCardsStyled as v,
|
|
256
|
+
CardToggleButtonStyled as w,
|
|
257
|
+
TextToggleCardButtonStyled as x,
|
|
258
|
+
TableContainerStyled as y,
|
|
259
|
+
NameColumnStyled as z
|
|
158
260
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CardContentProps } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook que encapsula toda la lógica de renderizado del contenido de una Card
|
|
4
|
+
*/
|
|
5
|
+
export declare function useCardContent<TRow>({ row, columns, originalColumns, onRowsChange, }: CardContentProps<TRow>): {
|
|
6
|
+
cardContent: import("react/jsx-runtime").JSX.Element[];
|
|
7
|
+
columnsCount: number;
|
|
8
|
+
onOpenDetail: () => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useMemo } from "react";
|
|
3
|
+
import { u as useModalDetail } from "../../../hooks/useModalCardDetail.js";
|
|
4
|
+
import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
|
|
5
|
+
import { c as ContainerLabelValueColumnStyled, d as ContentWrapperColumnStyled, L as LabelHeaderColumnStyled, E as EditorCellWrapperStyled, V as ValueColumnStyled } from "../../../slots/DataGridSlot.js";
|
|
6
|
+
function useCardContent({
|
|
7
|
+
row,
|
|
8
|
+
columns,
|
|
9
|
+
originalColumns,
|
|
10
|
+
onRowsChange
|
|
11
|
+
}) {
|
|
12
|
+
const { getConfigColumns, size } = useDataGrid();
|
|
13
|
+
const [editingColumnKey, setEditingColumnKey] = useState(null);
|
|
14
|
+
const columnsConfig = getConfigColumns("cards");
|
|
15
|
+
const onOpenDetail = useModalDetail({
|
|
16
|
+
row,
|
|
17
|
+
columns: originalColumns,
|
|
18
|
+
viewMode: "cards",
|
|
19
|
+
onRowsChange
|
|
20
|
+
});
|
|
21
|
+
const cardContent = useMemo(() => {
|
|
22
|
+
return columns.map((column, index) => {
|
|
23
|
+
const configColumn = columnsConfig.find(
|
|
24
|
+
(config) => config.key === column.key
|
|
25
|
+
);
|
|
26
|
+
const shouldShowTitle = configColumn?.showTitle !== false;
|
|
27
|
+
return /* @__PURE__ */ jsx(ContainerLabelValueColumnStyled, { children: /* @__PURE__ */ jsxs(
|
|
28
|
+
ContentWrapperColumnStyled,
|
|
29
|
+
{
|
|
30
|
+
onDoubleClick: column.renderEditCell && editingColumnKey !== column.key ? () => {
|
|
31
|
+
setEditingColumnKey(column.key);
|
|
32
|
+
} : void 0,
|
|
33
|
+
children: [
|
|
34
|
+
shouldShowTitle && /* @__PURE__ */ jsx(LabelHeaderColumnStyled, { variant: "body", color: "text.secondary", children: column.name }),
|
|
35
|
+
(() => {
|
|
36
|
+
if (column.renderEditCell && editingColumnKey === column.key) {
|
|
37
|
+
return /* @__PURE__ */ jsx(EditorCellWrapperStyled, { ownerState: { size }, children: column.renderEditCell({
|
|
38
|
+
column,
|
|
39
|
+
row,
|
|
40
|
+
rowIdx: index,
|
|
41
|
+
/**
|
|
42
|
+
* onRowChange es una función que se ejecuta cuando el usuario edita una celda.
|
|
43
|
+
*/
|
|
44
|
+
onRowChange: (updatedRow) => {
|
|
45
|
+
if (onRowsChange) {
|
|
46
|
+
onRowsChange([updatedRow], {
|
|
47
|
+
indexes: [index],
|
|
48
|
+
column
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
onClose: () => setEditingColumnKey(null)
|
|
53
|
+
}) });
|
|
54
|
+
}
|
|
55
|
+
if (column.renderCell) {
|
|
56
|
+
const cellContent = column.renderCell({
|
|
57
|
+
column,
|
|
58
|
+
row,
|
|
59
|
+
rowIdx: index,
|
|
60
|
+
isCellSelected: false,
|
|
61
|
+
tabIndex: -1,
|
|
62
|
+
/**
|
|
63
|
+
* onRowChange es una función que se ejecuta cuando el usuario edita una celda.
|
|
64
|
+
*/
|
|
65
|
+
onRowChange: (updatedRow) => {
|
|
66
|
+
if (onRowsChange) {
|
|
67
|
+
onRowsChange([updatedRow], {
|
|
68
|
+
indexes: [index],
|
|
69
|
+
column
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: cellContent });
|
|
75
|
+
}
|
|
76
|
+
return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: row[column.key] ?? "-" });
|
|
77
|
+
})()
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
) }, column.key);
|
|
81
|
+
});
|
|
82
|
+
}, [columns, columnsConfig, row, onRowsChange, editingColumnKey, size]);
|
|
83
|
+
return {
|
|
84
|
+
cardContent,
|
|
85
|
+
columnsCount: columns.length,
|
|
86
|
+
onOpenDetail
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
useCardContent as u
|
|
91
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GridProps, RowKey } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente que muestra las filas del DataGrid en formato de tarjetas.
|
|
4
|
+
*/
|
|
5
|
+
export declare function Cards<TRow, TSummaryRow, TKey extends RowKey = RowKey>(props: GridProps<TRow, TSummaryRow, TKey>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { e as CardsContainerStyled } from "../../slots/DataGridSlot.js";
|
|
3
|
+
import { C as CardRow } from "./subcomponents/CardRow/index.js";
|
|
4
|
+
import { u as useProcessedColumns } from "../../hooks/useProcessedColumns.js";
|
|
5
|
+
import { C as ContainerFlow } from "../../../ContainerFlow/ContainerFlow.js";
|
|
6
|
+
function Cards(props) {
|
|
7
|
+
const {
|
|
8
|
+
rows,
|
|
9
|
+
columns,
|
|
10
|
+
rowKeyGetter,
|
|
11
|
+
selectedRows,
|
|
12
|
+
onSelectedRowsChange,
|
|
13
|
+
onRowsChange,
|
|
14
|
+
cardsViewConfig
|
|
15
|
+
} = props;
|
|
16
|
+
const processedColumns = useProcessedColumns(columns);
|
|
17
|
+
const allProcessedColumns = useProcessedColumns(columns, {
|
|
18
|
+
applyVisibilityFilter: false
|
|
19
|
+
});
|
|
20
|
+
if (processedColumns.length === 0) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return /* @__PURE__ */ jsx(CardsContainerStyled, { "data-testid": "cards-container", children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "grid-layout", minWidth: 280, children: rows.map((row) => /* @__PURE__ */ jsx(
|
|
24
|
+
CardRow,
|
|
25
|
+
{
|
|
26
|
+
row,
|
|
27
|
+
columns: processedColumns,
|
|
28
|
+
originalColumns: allProcessedColumns,
|
|
29
|
+
rowKeyGetter,
|
|
30
|
+
selectedRows,
|
|
31
|
+
onSelectedRowsChange,
|
|
32
|
+
onRowsChange,
|
|
33
|
+
customRender: cardsViewConfig?.customRender
|
|
34
|
+
},
|
|
35
|
+
rowKeyGetter(row)
|
|
36
|
+
)) }) });
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
Cards as C
|
|
40
|
+
};
|