@m4l/components 9.4.4 → 9.4.6-BE20251226-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/components/DataGrid/Datagrid.styles.js +142 -62
  2. package/components/DataGrid/contexts/DataGridContext/index.js +3 -0
  3. package/components/DataGrid/dictionary.d.ts +1 -0
  4. package/components/DataGrid/dictionary.js +2 -1
  5. package/components/DataGrid/formatters/ColumnColorFormatter/tests/ColumnColorFormatter.test.d.ts +1 -0
  6. package/components/DataGrid/formatters/ColumnColorFormatter/tests/useColumnColor.test.d.ts +1 -0
  7. package/components/DataGrid/formatters/ColumnTagsFormatter/tests/ColumnTagsFormatter.test.d.ts +1 -0
  8. package/components/DataGrid/formatters/ColumnTagsFormatter/tests/useColumnTags.test.d.ts +1 -0
  9. package/components/DataGrid/hooks/useModalCardDetail.d.ts +1 -1
  10. package/components/DataGrid/hooks/useModalCardDetail.js +6 -1
  11. package/components/DataGrid/icons.d.ts +1 -0
  12. package/components/DataGrid/icons.js +2 -1
  13. package/components/DataGrid/slots/DataGridEnum.d.ts +4 -1
  14. package/components/DataGrid/slots/DataGridEnum.js +3 -0
  15. package/components/DataGrid/slots/DataGridSlot.d.ts +3 -0
  16. package/components/DataGrid/slots/DataGridSlot.js +48 -33
  17. package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +1 -1
  18. package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +47 -5
  19. package/components/DataGrid/subcomponents/Cards/index.js +6 -3
  20. package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.d.ts +1 -1
  21. package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +57 -15
  22. package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +1 -1
  23. package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +2 -2
  24. package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +5 -1
  25. package/components/DataGrid/subcomponents/Cards/types.d.ts +16 -0
  26. package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +1 -1
  27. package/components/DataGrid/subcomponents/ControlNavigate/ControlNavigate.js +1 -1
  28. package/components/DataGrid/subcomponents/HeaderActions/index.js +2 -2
  29. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/RowsCount/index.js +1 -1
  30. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
  31. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.js +1 -1
  32. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.js +1 -1
  33. package/components/DataGrid/subcomponents/Table/index.js +1 -1
  34. package/components/DataGrid/subcomponents/Table/subcomponents/CheckboxFormatter.js +1 -0
  35. package/components/DataGrid/subcomponents/Table/subcomponents/CustomIcons.js +39 -14
  36. package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +1 -1
  37. package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
  38. package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
  39. package/components/DataGrid/types.d.ts +12 -0
  40. package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.d.ts +21 -1
  41. package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +22 -2
  42. package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.d.ts +21 -1
  43. package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +26 -2
  44. package/components/formatters/ImageFormatter/ImageFormatter.styles.js +1 -0
  45. package/hooks/useDataGridPersistence/useDataGridPersistence.test.d.ts +1 -0
  46. package/package.json +1 -1
  47. package/components/DataGrid/formatters/ColumnIconFormatter/constants.d.ts +0 -4
@@ -24,6 +24,42 @@ const dataGridStyles = {
24
24
  flex: 1,
25
25
  overflow: "hidden",
26
26
  "& .rdg .MuiCheckbox-root": {
27
+ overflow: "visible",
28
+ padding: 0,
29
+ ...theme.generalSettings.isMobile ? {
30
+ width: theme.vars.size.mobile.small.action,
31
+ height: theme.vars.size.mobile.small.action
32
+ } : {
33
+ width: theme.vars.size.desktop.small.action,
34
+ height: theme.vars.size.desktop.small.action
35
+ },
36
+ display: "inline-flex",
37
+ justifyContent: "center",
38
+ alignItems: "center",
39
+ borderRadius: theme.size.borderRadius.r1,
40
+ "&:hover": {
41
+ backgroundColor: theme.vars.palette.default.hoverOpacity
42
+ },
43
+ "&:active": {
44
+ backgroundColor: theme.vars.palette.default.activeOpacity
45
+ },
46
+ "&.Mui-checked": {
47
+ "&:hover": {
48
+ backgroundColor: theme.vars.palette.primary.hoverOpacity,
49
+ "& ..": {
50
+ backgroundColor: theme.vars.palette.primary.hover
51
+ }
52
+ },
53
+ "&:active": {
54
+ backgroundColor: theme.vars.palette.primary.activeOpacity,
55
+ "& .M4LIcon-icon": {
56
+ backgroundColor: theme.vars.palette.primary.active
57
+ }
58
+ }
59
+ },
60
+ "&.Mui-focusVisible, &:focus-visible": {
61
+ outline: `1px solid ${theme.vars.palette.primary.focusVisible}`
62
+ },
27
63
  "& > svg": {
28
64
  color: theme.vars.palette.text.secondary
29
65
  }
@@ -212,7 +248,7 @@ const dataGridStyles = {
212
248
  * Estilos el el input editor del DataGrid.
213
249
  * *****************************************
214
250
  */
215
- inputTexEditor: ({ theme }) => ({
251
+ inputTexEditor: ({ theme, ownerState }) => ({
216
252
  appearance: "none",
217
253
  boxSizing: "border-box",
218
254
  inlineSize: "100%",
@@ -222,13 +258,19 @@ const dataGridStyles = {
222
258
  textAlign: "right",
223
259
  fontFamily: "inherit",
224
260
  background: "transparent",
261
+ border: `1px solid ${theme.vars.palette?.border.secondary}`,
262
+ borderRadius: theme.vars.size.borderRadius["r1-5"],
263
+ ...getSizeStyles(theme, ownerState?.size || "medium", "case", (size) => ({
264
+ height: size
265
+ })),
266
+ padding: theme.vars.size.baseSpacings.sp1,
267
+ outline: "none",
225
268
  "&:focus": {
226
269
  outline: "none",
227
- border: "none",
270
+ border: `1px solid ${theme.vars.palette?.border.secondary}`,
228
271
  boxShadow: "none"
229
272
  },
230
273
  "&:hover": {
231
- border: "none",
232
274
  outline: "none"
233
275
  },
234
276
  "&::placeholder": {
@@ -388,39 +430,25 @@ const dataGridStyles = {
388
430
  // outline: `2px solid var(--rdg-selection-color)`,
389
431
  // outlineOffset: '-2px',
390
432
  },
433
+ "&:has(> .MuiCheckbox-root)": {
434
+ overflow: "visible",
435
+ paddingInline: 0
436
+ },
391
437
  "& .checkbox-checked": {
392
- "& path:first-of-type": {
393
- fill: theme.vars.palette.primary.main
394
- },
395
- ...getSizeStyles(
396
- theme,
397
- ownerState?.size || "medium",
398
- "base",
399
- (size) => ({
400
- minHeight: size,
401
- height: size
402
- })
403
- )
438
+ "& .M4LIcon-icon": {
439
+ backgroundColor: theme.vars.palette.primary.enabled
440
+ }
404
441
  },
405
442
  "& .checkbox-unChecked": {
406
- "& path": {
407
- fill: theme.vars.palette.text.primary
408
- },
409
- ...getSizeStyles(
410
- theme,
411
- ownerState?.size || "medium",
412
- "base",
413
- (size) => ({
414
- minHeight: size,
415
- height: size
416
- })
417
- )
443
+ "& .M4LIcon-icon": {
444
+ backgroundColor: theme.vars.palette.text.primary
445
+ }
418
446
  },
419
447
  "& .rdg-text-editor": {
420
448
  textAlign: "inherit",
421
449
  color: theme.vars.palette.text.secondary,
422
450
  padding: `${theme.vars.size.baseSpacings.sp0} ${theme.vars.size.baseSpacings.sp2}`,
423
- border: theme.vars.size.baseSpacings.sp0,
451
+ // border: theme.vars.size.baseSpacings.sp0,
424
452
  borderTop: "0.5px solid",
425
453
  //Se deja el valor directamente porque no está tokenizado
426
454
  borderBottom: theme.vars.size.borderStroke.container,
@@ -428,7 +456,7 @@ const dataGridStyles = {
428
456
  //Se deja el valor directamente porque no está tokenizado
429
457
  borderRight: "0.5px solid",
430
458
  //Se deja el valor directamente porque no está tokenizado
431
- borderColor: `${theme.vars.palette?.border.disabled} !important`,
459
+ borderColor: `${theme.vars.palette?.border.secondary} !important`,
432
460
  ...theme.colorSchemes.finalTheme.typography.body
433
461
  },
434
462
  "&:has(> .M4LRadio-root)": {
@@ -684,26 +712,54 @@ const dataGridStyles = {
684
712
  * Estilos para el wrapper del CheckboxCellAdapter
685
713
  * Aplica los mismos estilos que los checkboxes dentro de celdas rdg
686
714
  */
687
- checkboxCellWrapper: ({ theme, ownerState }) => ({
715
+ checkboxCellWrapper: ({ theme }) => ({
688
716
  "& .checkbox-checked": {
689
- "& path:first-of-type": {
690
- fill: theme.vars.palette.primary.main
691
- },
692
- ...getSizeStyles(theme, ownerState?.size || "medium", "base", (size) => ({
693
- minHeight: size,
694
- height: size
695
- }))
717
+ "& .M4LIcon-icon": {
718
+ backgroundColor: theme.vars.palette.primary.enabled
719
+ }
696
720
  },
697
721
  "& .checkbox-unChecked": {
698
- "& path": {
699
- fill: theme.vars.palette.text.primary
700
- },
701
- ...getSizeStyles(theme, ownerState?.size || "medium", "base", (size) => ({
702
- minHeight: size,
703
- height: size
704
- }))
722
+ "& .M4LIcon-icon": {
723
+ backgroundColor: theme.vars.palette.text.primary
724
+ }
705
725
  },
706
726
  "& .MuiCheckbox-root": {
727
+ overflow: "visible",
728
+ padding: 0,
729
+ ...theme.generalSettings.isMobile ? {
730
+ width: theme.vars.size.mobile.small.action,
731
+ height: theme.vars.size.mobile.small.action
732
+ } : {
733
+ width: theme.vars.size.desktop.small.action,
734
+ height: theme.vars.size.desktop.small.action
735
+ },
736
+ display: "inline-flex",
737
+ justifyContent: "center",
738
+ alignItems: "center",
739
+ borderRadius: theme.size.borderRadius.r1,
740
+ "&:hover": {
741
+ backgroundColor: theme.vars.palette.default.hoverOpacity
742
+ },
743
+ "&:active": {
744
+ backgroundColor: theme.vars.palette.default.activeOpacity
745
+ },
746
+ "&.Mui-checked": {
747
+ "&:hover": {
748
+ backgroundColor: theme.vars.palette.primary.hoverOpacity,
749
+ "& .M4LIcon-icon": {
750
+ backgroundColor: theme.vars.palette.primary.hover
751
+ }
752
+ },
753
+ "&:active": {
754
+ backgroundColor: theme.vars.palette.primary.activeOpacity,
755
+ "& .M4LIcon-icon": {
756
+ backgroundColor: theme.vars.palette.primary.active
757
+ }
758
+ }
759
+ },
760
+ "&.Mui-focusVisible, &:focus-visible": {
761
+ outline: `1px solid ${theme.vars.palette.primary.focusVisible}`
762
+ },
707
763
  "& > svg": {
708
764
  color: theme.vars.palette.text.secondary
709
765
  }
@@ -744,7 +800,10 @@ const dataGridStyles = {
744
800
  * Contenedor de los cards
745
801
  */
746
802
  cardsContainer: () => ({
747
- height: "auto",
803
+ flexGrow: 1,
804
+ flexShrink: 1,
805
+ flexBasis: 0,
806
+ minHeight: 0,
748
807
  overflow: "auto",
749
808
  "& > .M4LContainerFlow-root": {
750
809
  alignItems: "start"
@@ -882,33 +941,54 @@ const dataGridStyles = {
882
941
  width: "100%",
883
942
  textAlign: "inherit",
884
943
  color: theme.vars.palette.text.secondary,
885
- padding: `${theme.vars.size.baseSpacings.sp0} ${theme.vars.size.baseSpacings.sp2}`,
886
- border: theme.vars.size.baseSpacings.sp0,
887
- borderTop: "0.5px solid",
888
- borderBottom: theme.vars.size.borderStroke.container,
889
- borderLeft: "0.5px solid",
890
- borderRight: "0.5px solid",
891
- borderColor: "transparent",
944
+ padding: `${theme.vars.size.baseSpacings.sp0} ${theme.vars.size.baseSpacings.sp1}`,
945
+ border: `1px solid ${theme.vars.palette.border.secondary}`,
946
+ borderRadius: theme.vars.size.borderRadius["r1-5"],
947
+ outline: "none",
892
948
  ...theme.colorSchemes.finalTheme.typography.body,
949
+ ...getSizeStyles(theme, ownerState?.size || "medium", "case", (size) => ({
950
+ height: size
951
+ })),
893
952
  "&:focus": {
894
- borderTop: "0.5px solid",
895
- borderBottom: theme.vars.size.borderStroke.container,
896
- borderLeft: "0.5px solid",
897
- borderRight: "0.5px solid",
898
- borderColor: `${theme.vars.palette.primary.focusVisible} !important`,
953
+ border: `1px solid ${theme.vars.palette.border.secondary}`,
899
954
  outline: "none",
900
955
  boxShadow: "none"
901
956
  },
902
957
  "&:hover": {
903
- borderTop: "0.5px solid",
904
- borderBottom: theme.vars.size.borderStroke.container,
905
- borderLeft: "0.5px solid",
906
- borderRight: "0.5px solid",
907
- borderColor: "transparent",
958
+ border: `1px solid ${theme.vars.palette.border.secondary}`,
908
959
  outline: "none"
909
960
  }
910
961
  }
911
962
  }),
963
+ /**
964
+ * Placeholder editable
965
+ */
966
+ editablePlaceholder: ({ theme }) => ({
967
+ display: "flex",
968
+ alignItems: "center",
969
+ gap: theme.vars.size.baseSpacings.sp1
970
+ }),
971
+ /**
972
+ * EditLabel
973
+ */
974
+ editLabel: ({ theme, ownerState }) => ({
975
+ width: "auto",
976
+ opacity: 1,
977
+ transition: "opacity 0.3s ease",
978
+ ...getTypographyStyles(
979
+ theme.generalSettings.isMobile,
980
+ ownerState?.size || "medium",
981
+ "body"
982
+ )
983
+ }),
984
+ /**
985
+ * Botón para mostrar el input en los editores (cards)
986
+ */
987
+ iconButtonEdit: ({ theme }) => ({
988
+ "& .M4LIcon-icon": {
989
+ backgroundColor: `${theme.vars.palette.text.secondary} !important`
990
+ }
991
+ }),
912
992
  /**
913
993
  * Header de la card personalizada (avatar + nombre + email)
914
994
  */
@@ -182,6 +182,9 @@ function DataGridProvider(props) {
182
182
  setViewModeState(
183
183
  getViewMode(id, resolvedDefaultConfig, defaultViewMode) ?? "table"
184
184
  );
185
+ setViewModeState(
186
+ getViewMode(id, resolvedDefaultConfig, defaultViewMode) ?? "table"
187
+ );
185
188
  updateConfigColumns(
186
189
  "table",
187
190
  getInitialColumnsConfig(
@@ -38,4 +38,5 @@ export declare const DICTIONARY: {
38
38
  VIEW_MODE_CARDS: string;
39
39
  TOOLTIP_VIEW_MODE: string;
40
40
  DETAILS: string;
41
+ EDIT_PLACEHOLDER: string;
41
42
  };
@@ -37,7 +37,8 @@ const DICTIONARY = {
37
37
  VIEW_MODE_TABLE: `${DATAGRID_ID_DICTIONARY}.view_mode_table`,
38
38
  VIEW_MODE_CARDS: `${DATAGRID_ID_DICTIONARY}.view_mode_cards`,
39
39
  TOOLTIP_VIEW_MODE: `${DATAGRID_ID_DICTIONARY}.tooltip_view_mode`,
40
- DETAILS: `${DATAGRID_ID_DICTIONARY}.details`
40
+ DETAILS: `${DATAGRID_ID_DICTIONARY}.details`,
41
+ EDIT_PLACEHOLDER: `${DATAGRID_ID_DICTIONARY}.edit_placeholder`
41
42
  };
42
43
  export {
43
44
  DICTIONARY as D,
@@ -3,4 +3,4 @@ import { UseModalDetailProps } from '../types';
3
3
  * Hook que renderiza el modal de detalle para cualquier vista
4
4
  * mostrando TODAS las columnas sin excepción
5
5
  */
6
- export declare const useModalDetail: <TRow>({ columns, viewMode, onRowsChange, }: UseModalDetailProps<TRow>) => (row: TRow) => void;
6
+ export declare const useModalDetail: <TRow>({ columns, viewMode, onRowsChange, rows, }: UseModalDetailProps<TRow>) => (row: TRow) => void;
@@ -14,7 +14,8 @@ import { A as ActionCancel } from "../../CommonActions/components/ActionCancel/A
14
14
  const useModalDetail = ({
15
15
  columns,
16
16
  viewMode,
17
- onRowsChange
17
+ onRowsChange,
18
+ rows
18
19
  }) => {
19
20
  const { getConfigColumns, size } = useDataGrid();
20
21
  const { openModal, closeModal } = useModal();
@@ -24,6 +25,7 @@ const useModalDetail = ({
24
25
  const handleOpenDetail = useCallback(
25
26
  (row) => {
26
27
  const viewColumnsConfig = getConfigColumns(viewMode);
28
+ const rowIndex = rows.findIndex((r) => r === row);
27
29
  openModal({
28
30
  initialWidth: 500,
29
31
  initialHeight: 680,
@@ -42,6 +44,8 @@ const useModalDetail = ({
42
44
  CardDetails,
43
45
  {
44
46
  row,
47
+ rows,
48
+ rowIndex,
45
49
  columns,
46
50
  viewColumnsConfig,
47
51
  onRowsChange,
@@ -56,6 +60,7 @@ const useModalDetail = ({
56
60
  },
57
61
  [
58
62
  columns,
63
+ rows,
59
64
  onRowsChange,
60
65
  size,
61
66
  getConfigColumns,
@@ -27,4 +27,5 @@ export declare const pathIcons: {
27
27
  mail: string;
28
28
  smartphone: string;
29
29
  internet: string;
30
+ edit: string;
30
31
  };
@@ -23,7 +23,8 @@ const pathIcons = {
23
23
  viewTable: "frontend/components/data_grid/assets/icons/table.svg",
24
24
  viewCards: "frontend/components/data_grid/assets/icons/card.svg",
25
25
  info: "frontend/components/data_grid/assets/icons/info.svg",
26
- expanded: "frontend/components/data_grid/assets/icons/expanded.svg"
26
+ expanded: "frontend/components/data_grid/assets/icons/expanded.svg",
27
+ edit: "frontend/components/EditLabel/assets/icons/pencil.svg"
27
28
  };
28
29
  export {
29
30
  pathIcons as p
@@ -50,7 +50,10 @@ export declare enum TableSlots {
50
50
  customCardFieldContent = "customCardFieldContent",
51
51
  customCardIconContainer = "customCardIconContainer",
52
52
  checkboxCellWrapper = "checkboxCellWrapper",
53
- editorCellWrapper = "editorCellWrapper"
53
+ editorCellWrapper = "editorCellWrapper",
54
+ editablePlaceholder = "editablePlaceholder",
55
+ editLabel = "editLabel",
56
+ iconButtonEdit = "iconButtonEdit"
54
57
  }
55
58
  export declare enum TextEditorSlots {
56
59
  inputTexEditor = "inputTexEditor"
@@ -54,6 +54,9 @@ var TableSlots = /* @__PURE__ */ ((TableSlots2) => {
54
54
  TableSlots2["customCardIconContainer"] = "customCardIconContainer";
55
55
  TableSlots2["checkboxCellWrapper"] = "checkboxCellWrapper";
56
56
  TableSlots2["editorCellWrapper"] = "editorCellWrapper";
57
+ TableSlots2["editablePlaceholder"] = "editablePlaceholder";
58
+ TableSlots2["editLabel"] = "editLabel";
59
+ TableSlots2["iconButtonEdit"] = "iconButtonEdit";
57
60
  return TableSlots2;
58
61
  })(TableSlots || {});
59
62
  var TextEditorSlots = /* @__PURE__ */ ((TextEditorSlots2) => {
@@ -76,6 +76,9 @@ export declare const ButtonHeaderActionsStyled: import('@emotion/styled').Styled
76
76
  export declare const NameColumnIconStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
77
77
  export declare const IconColumnStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
78
78
  export declare const NameColumnStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
79
+ export declare const EditablePlaceholderStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
80
+ export declare const EditLabelStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
81
+ export declare const IconButtonEditStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
79
82
  /**
80
83
  * ****************
81
84
  * Slots TextEditor
@@ -6,6 +6,7 @@ import { d as dataGridStyles } from "../Datagrid.styles.js";
6
6
  import { I as Icon } from "../../Icon/Icon.js";
7
7
  import { C as Card } from "../../Card/Card.js";
8
8
  import { T as Typography } from "../../mui_extended/Typography/Typography.js";
9
+ import { I as IconButton } from "../../mui_extended/IconButton/IconButton.js";
9
10
  const DataGridRootStyled = styled("div", {
10
11
  name: DATAGRID_PREFIX_NAME,
11
12
  slot: DataGridSlots.datagridRoot
@@ -206,6 +207,18 @@ const NameColumnStyled = styled("div", {
206
207
  name: DATAGRID_PREFIX_NAME,
207
208
  slot: TableSlots.nameColumn
208
209
  })(dataGridStyles.nameColumn);
210
+ const EditablePlaceholderStyled = styled("div", {
211
+ name: DATAGRID_PREFIX_NAME,
212
+ slot: TableSlots.editablePlaceholder
213
+ })(dataGridStyles.editablePlaceholder);
214
+ styled(Typography, {
215
+ name: DATAGRID_PREFIX_NAME,
216
+ slot: TableSlots.editLabel
217
+ })(dataGridStyles.editLabel);
218
+ const IconButtonEditStyled = styled(IconButton, {
219
+ name: DATAGRID_PREFIX_NAME,
220
+ slot: TableSlots.iconButtonEdit
221
+ })(dataGridStyles.iconButtonEdit);
209
222
  const InputTextEditorStyled = styled("input", {
210
223
  name: DATAGRID_PREFIX_NAME,
211
224
  slot: TextEditorSlots.inputTexEditor
@@ -220,49 +233,51 @@ styled("div", {
220
233
  })(dataGridStyles.columnIconFormatter);
221
234
  export {
222
235
  ActionsRootStyled as A,
223
- NameColumnStyled as B,
236
+ TableContainerStyled as B,
224
237
  CustomHeaderStyled as C,
225
238
  DataGridRootStyled as D,
226
239
  EditorCellWrapperStyled as E,
227
- DraggableHeaderRootStyled as F,
228
- ButtonHeaderActionsStyled as G,
229
- DraggableWrapperInputBaseStyled as H,
230
- IconColumnStyled as I,
231
- IconSearchStyled as J,
232
- HeaderInputBaseStyled as K,
240
+ NameColumnStyled as F,
241
+ IconColumnStyled as G,
242
+ DraggableHeaderRootStyled as H,
243
+ IconButtonEditStyled as I,
244
+ ButtonHeaderActionsStyled as J,
245
+ DraggableWrapperInputBaseStyled as K,
233
246
  LabelHeaderColumnStyled as L,
234
- MenuListStyled as M,
247
+ IconSearchStyled as M,
235
248
  NameColumnIconStyled as N,
236
- HeaderRenderClickStyled as O,
237
- InputTextEditorStyled as P,
249
+ HeaderInputBaseStyled as O,
250
+ MenuListStyled as P,
251
+ HeaderRenderClickStyled as Q,
238
252
  RowsCountRootStyled as R,
253
+ InputTextEditorStyled as S,
239
254
  TableWrapperDataGridStyled as T,
240
255
  ValueColumnStyled as V,
241
256
  WrapperSkeletonStyled as W,
242
257
  ContentModalSettingStyled as a,
243
258
  ContainerLabelValueColumnStyled as b,
244
259
  ContentWrapperColumnStyled as c,
245
- CardsContainerStyled as d,
246
- CardDetailContainerStyled as e,
247
- CardHeaderStyled as f,
248
- CardHeaderLeftStyled as g,
249
- CardHeaderRightStyled as h,
250
- CardContentWrapperStyled as i,
251
- CardContentStyled as j,
252
- CardStyled as k,
253
- CheckboxCellWrapperStyled as l,
254
- ControlNavigateStyled as m,
255
- ActionsConfigContainerStyled as n,
256
- ContainerLeftActionsStyled as o,
257
- ContainerRightActionsStyled as p,
258
- RowsCountLabelStyled as q,
259
- RowsCountValueStyled as r,
260
- ColumnsConfigWrapperStyled as s,
261
- ColumnsConfigDataGridStyled as t,
262
- ColumnsConfigSelColumnsStyled as u,
263
- ColumnsConfigActiosStyled as v,
264
- ContainerToggleCardsStyled as w,
265
- CardToggleButtonStyled as x,
266
- TextToggleCardButtonStyled as y,
267
- TableContainerStyled as z
260
+ EditablePlaceholderStyled as d,
261
+ CardsContainerStyled as e,
262
+ CardDetailContainerStyled as f,
263
+ CardHeaderStyled as g,
264
+ CardHeaderLeftStyled as h,
265
+ CardHeaderRightStyled as i,
266
+ CardContentWrapperStyled as j,
267
+ CardContentStyled as k,
268
+ CardStyled as l,
269
+ CheckboxCellWrapperStyled as m,
270
+ ControlNavigateStyled as n,
271
+ ActionsConfigContainerStyled as o,
272
+ ContainerLeftActionsStyled as p,
273
+ ContainerRightActionsStyled as q,
274
+ RowsCountLabelStyled as r,
275
+ RowsCountValueStyled as s,
276
+ ColumnsConfigWrapperStyled as t,
277
+ ColumnsConfigDataGridStyled as u,
278
+ ColumnsConfigSelColumnsStyled as v,
279
+ ColumnsConfigActiosStyled as w,
280
+ ContainerToggleCardsStyled as x,
281
+ CardToggleButtonStyled as y,
282
+ TextToggleCardButtonStyled as z
268
283
  };
@@ -2,7 +2,7 @@ import { CardContentProps } from '../../../types';
2
2
  /**
3
3
  * Hook que encapsula toda la lógica de renderizado del contenido de una Card
4
4
  */
5
- export declare function useCardContent<TRow>({ row, columns, onRowsChange, }: CardContentProps<TRow>): {
5
+ export declare function useCardContent<TRow>({ row, rows, rowIndex, columns, onRowsChange, }: CardContentProps<TRow>): {
6
6
  cardContent: import("react/jsx-runtime").JSX.Element[];
7
7
  columnsCount: number;
8
8
  };
@@ -1,13 +1,22 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
4
- import { b as ContainerLabelValueColumnStyled, c as ContentWrapperColumnStyled, L as LabelHeaderColumnStyled, E as EditorCellWrapperStyled, V as ValueColumnStyled } from "../../../slots/DataGridSlot.js";
4
+ import { 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";
5
+ import { D as DICTIONARY } from "../../../dictionary.js";
6
+ import { useModuleDictionary, useEnvironment } from "@m4l/core";
7
+ import { p as pathIcons } from "../../../icons.js";
8
+ import { u as useComponentSize } from "../../../../../hooks/useComponentSize/useComponentSize.js";
5
9
  function useCardContent({
6
10
  row,
11
+ rows,
12
+ rowIndex,
7
13
  columns,
8
14
  onRowsChange
9
15
  }) {
10
16
  const { getConfigColumns, size } = useDataGrid();
17
+ const { getLabel } = useModuleDictionary();
18
+ const { host_static_assets, environment_assets } = useEnvironment();
19
+ const { currentSize } = useComponentSize(size);
11
20
  const [editingColumnKey, setEditingColumnKey] = useState(null);
12
21
  const columnsConfig = getConfigColumns("cards");
13
22
  const cardContent = columns.map((column, index) => {
@@ -34,8 +43,11 @@ function useCardContent({
34
43
  */
35
44
  onRowChange: (updatedRow) => {
36
45
  if (onRowsChange) {
37
- onRowsChange([updatedRow], {
38
- indexes: [index],
46
+ const updatedRows = rows.map(
47
+ (r, i) => i === rowIndex ? updatedRow : r
48
+ );
49
+ onRowsChange(updatedRows, {
50
+ indexes: [rowIndex],
39
51
  column
40
52
  });
41
53
  }
@@ -55,8 +67,11 @@ function useCardContent({
55
67
  */
56
68
  onRowChange: (updatedRow) => {
57
69
  if (onRowsChange) {
58
- onRowsChange([updatedRow], {
59
- indexes: [index],
70
+ const updatedRows = rows.map(
71
+ (r, i) => i === rowIndex ? updatedRow : r
72
+ );
73
+ onRowsChange(updatedRows, {
74
+ indexes: [rowIndex],
60
75
  column
61
76
  });
62
77
  }
@@ -64,6 +79,33 @@ function useCardContent({
64
79
  });
65
80
  return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: cellContent });
66
81
  }
82
+ const rawValue = row[column.key];
83
+ const isEmpty = rawValue === null || rawValue === void 0 || rawValue === "";
84
+ const isEditable = !!column.renderEditCell;
85
+ if (isEditable) {
86
+ return /* @__PURE__ */ jsxs(EditablePlaceholderStyled, { children: [
87
+ /* @__PURE__ */ jsx(
88
+ ValueColumnStyled,
89
+ {
90
+ variant: "body",
91
+ color: isEmpty ? "text.secondary" : "text.primary",
92
+ children: isEmpty ? getLabel(DICTIONARY.EDIT_PLACEHOLDER) : rawValue
93
+ }
94
+ ),
95
+ /* @__PURE__ */ jsx(
96
+ IconButtonEditStyled,
97
+ {
98
+ src: `${host_static_assets}/${environment_assets}/${pathIcons.edit}`,
99
+ onClick: () => {
100
+ setEditingColumnKey(column.key);
101
+ },
102
+ size: currentSize,
103
+ role: "button",
104
+ "aria-label": "Editar texto"
105
+ }
106
+ )
107
+ ] });
108
+ }
67
109
  return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: row[column.key] ?? "-" });
68
110
  })()
69
111
  ]
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useRef, useMemo, useEffect } from "react";
3
- import { d as CardsContainerStyled } from "../../slots/DataGridSlot.js";
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";
@@ -29,7 +29,8 @@ function Cards(props) {
29
29
  const handleOpenDetail = useModalDetail({
30
30
  columns: allProcessedColumns,
31
31
  viewMode: "cards",
32
- onRowsChange
32
+ onRowsChange,
33
+ rows
33
34
  });
34
35
  const cardHeight = useMemo(() => {
35
36
  const imageHeight = processedColumns.reduce((totalHeight, col) => {
@@ -77,7 +78,7 @@ function Cards(props) {
77
78
  if (processedColumns.length === 0) {
78
79
  return null;
79
80
  }
80
- return /* @__PURE__ */ jsx(CardsContainerStyled, { "data-testid": "cards-container", ref: containerRef, children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "grid-layout", minWidth: 280, children: rows.map((row) => {
81
+ return /* @__PURE__ */ jsx(CardsContainerStyled, { "data-testid": "cards-container", ref: containerRef, children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "grid-layout", minWidth: 280, children: rows.map((row, rowIndex) => {
81
82
  const rowKey = rowKeyGetter(row);
82
83
  const isChecked = checkedRows?.has(rowKey) || false;
83
84
  const showCheckbox = checkedRows !== void 0 && onCheckedRowsChange !== void 0;
@@ -85,6 +86,8 @@ function Cards(props) {
85
86
  CardRow,
86
87
  {
87
88
  row,
89
+ rows,
90
+ rowIndex,
88
91
  columns: processedColumns,
89
92
  originalColumns: allProcessedColumns,
90
93
  rowKeyGetter,