@m4l/components 9.3.34-JT25112025.beta.1 → 9.3.34-JT25112025.beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/@types/export.d.ts +0 -3
  2. package/@types/types.d.ts +5 -26
  3. package/components/DataGrid/DataGrid.js +0 -2
  4. package/components/DataGrid/Datagrid.styles.js +111 -43
  5. package/components/DataGrid/contexts/DataGridContext/index.js +0 -2
  6. package/components/DataGrid/contexts/DataGridContext/types.d.ts +2 -2
  7. package/components/DataGrid/dictionary.d.ts +1 -0
  8. package/components/DataGrid/dictionary.js +2 -1
  9. package/components/DataGrid/formatters/ColumnTagsFormatter/tests/useColumnTags.test.d.ts +1 -0
  10. package/components/DataGrid/hooks/useModalCardDetail.d.ts +1 -1
  11. package/components/DataGrid/hooks/useModalCardDetail.js +6 -1
  12. package/components/DataGrid/icons.d.ts +1 -0
  13. package/components/DataGrid/icons.js +2 -1
  14. package/components/DataGrid/slots/DataGridEnum.d.ts +4 -1
  15. package/components/DataGrid/slots/DataGridEnum.js +3 -0
  16. package/components/DataGrid/slots/DataGridSlot.d.ts +3 -0
  17. package/components/DataGrid/slots/DataGridSlot.js +48 -33
  18. package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +1 -1
  19. package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +47 -5
  20. package/components/DataGrid/subcomponents/Cards/index.js +6 -3
  21. package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.d.ts +1 -1
  22. package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +59 -15
  23. package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +8 -16
  24. package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +2 -2
  25. package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +5 -1
  26. package/components/DataGrid/subcomponents/Cards/types.d.ts +16 -0
  27. package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +2 -5
  28. package/components/DataGrid/subcomponents/ControlNavigate/ControlNavigate.js +1 -1
  29. package/components/DataGrid/subcomponents/HeaderActions/index.js +2 -2
  30. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/RowsCount/index.js +1 -1
  31. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
  32. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.js +1 -1
  33. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.js +1 -1
  34. package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +2 -6
  35. package/components/DataGrid/subcomponents/Table/index.js +1 -1
  36. package/components/DataGrid/subcomponents/Table/subcomponents/CheckboxFormatter.js +1 -0
  37. package/components/DataGrid/subcomponents/Table/subcomponents/CustomIcons.js +39 -14
  38. package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +1 -1
  39. package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
  40. package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
  41. package/components/DataGrid/types.d.ts +12 -7
  42. package/components/mui_extended/index.d.ts +0 -1
  43. package/index.js +40 -42
  44. package/package.json +1 -1
  45. package/components/DataGrid/formatters/ColumnIconFormatter/constants.d.ts +0 -4
  46. package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.d.ts +0 -6
  47. package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.js +0 -20
  48. package/components/DataGrid/subcomponents/Table/subcomponents/RadioSelectColumn.d.ts +0 -64
  49. package/components/DataGrid/subcomponents/Table/subcomponents/RadioSelectColumn.js +0 -46
  50. package/components/mui_extended/RadioButton/RadioButton.d.ts +0 -24
  51. package/components/mui_extended/RadioButton/RadioButton.js +0 -110
  52. package/components/mui_extended/RadioButton/RadioButton.styles.d.ts +0 -2
  53. package/components/mui_extended/RadioButton/RadioButton.styles.js +0 -126
  54. package/components/mui_extended/RadioButton/constants.d.ts +0 -1
  55. package/components/mui_extended/RadioButton/constants.js +0 -4
  56. package/components/mui_extended/RadioButton/icons.d.ts +0 -4
  57. package/components/mui_extended/RadioButton/icons.js +0 -7
  58. package/components/mui_extended/RadioButton/index.d.ts +0 -1
  59. package/components/mui_extended/RadioButton/index.js +0 -1
  60. package/components/mui_extended/RadioButton/slots/RadioButtonEnum.d.ts +0 -8
  61. package/components/mui_extended/RadioButton/slots/RadioButtonEnum.js +0 -12
  62. package/components/mui_extended/RadioButton/slots/RadioButtonSlots.d.ts +0 -20
  63. package/components/mui_extended/RadioButton/slots/RadioButtonSlots.js +0 -39
  64. package/components/mui_extended/RadioButton/types.d.ts +0 -50
  65. /package/components/DataGrid/{tests/table/subcomponents/RadioButtonFormatter.test.d.ts → formatters/ColumnColorFormatter/tests/ColumnColorFormatter.test.d.ts} +0 -0
  66. /package/components/DataGrid/{tests/table/subcomponents/RadioSelectColumn.test.d.ts → formatters/ColumnColorFormatter/tests/useColumnColor.test.d.ts} +0 -0
  67. /package/components/{mui_extended/RadioButton/tests/RadioButton.test.d.ts → DataGrid/formatters/ColumnTagsFormatter/tests/ColumnTagsFormatter.test.d.ts} +0 -0
@@ -55,9 +55,6 @@ declare module '@mui/material/styles' {
55
55
  M4LCheckBox?: {
56
56
  styleOverrides?: ComponentsOverrides<Theme>['M4LCheckBox'];
57
57
  };
58
- M4LRadioButton?: {
59
- styleOverrides?: ComponentsOverrides<Theme>['M4LRadioButton'];
60
- };
61
58
  M4LDataGrid?: {
62
59
  styleOverrides?: ComponentsOverrides<Theme>['M4LDataGrid'];
63
60
  };
package/@types/types.d.ts CHANGED
@@ -76,10 +76,6 @@ import {
76
76
  CheckBoxOwnerState,
77
77
  CheckBoxSlotsType,
78
78
  } from '../components/mui_extended/CheckBox/types';
79
- import {
80
- RadioButtonOwnerState,
81
- RadioButtonSlotsType,
82
- } from '../components/mui_extended/RadioButton/types';
83
79
  import {
84
80
  RHFNumberInputOwnerState,
85
81
  RHFNumberInputSlotsType,
@@ -296,19 +292,10 @@ import {
296
292
  ImageTextOwnerState,
297
293
  ImageTextSlotsType,
298
294
  } from '../components/ImageText/types';
299
- import {
300
- FormContainerOwnerState,
301
- FormContainerSlotsType,
302
- } from '../components/FormContainer/types';
303
- import { TabsNavigatorSlotsType } from 'src/components/TabsNavigator/types';
304
- import {
305
- EditLabelOwnerState,
306
- EditLabelSlotsType,
307
- } from '../components/EditLabel/types';
308
- import {
309
- MFIsolationAppOwnerState,
310
- MFIsolationAppSlotsType,
311
- } from '../components/MFIsolationApp/types';
295
+ import { FormContainerOwnerState, FormContainerSlotsType } from '../components/FormContainer/types';
296
+ import { TabsNavigatorSlotsType } from '../components/TabsNavigator/types';
297
+ import { EditLabelOwnerState, EditLabelSlotsType } from '../components/EditLabel/types';
298
+ import { MFIsolationAppOwnerState, MFIsolationAppSlotsType } from '../components/MFIsolationApp/types';
312
299
  import {
313
300
  TagsFormatterOwnerState,
314
301
  TagsFormatterSlotsType,
@@ -341,7 +328,6 @@ declare module '@mui/material/styles' {
341
328
  M4LSelect: SelectSlotsType;
342
329
  M4LTypography: TypographySlotsType;
343
330
  M4LCheckBox: CheckBoxSlotsType;
344
- M4LRadioButton: RadioButtonSlotsType;
345
331
  M4LRHFNumberInput: RHFNumberInputSlotsType;
346
332
  M4LTab: TabSlotsType;
347
333
  M4LButton: ButtonSlotsType;
@@ -356,8 +342,7 @@ declare module '@mui/material/styles' {
356
342
  M4LChip: ChipSlotsType;
357
343
  M4LCircularProgress: CircularProgressSlotsType;
358
344
  M4LPaperForm: PaperFormSlotsType;
359
- M4LWindowBase: WindowBaseType;
360
- a;
345
+ M4LWindowBase: WindowBaseType;a
361
346
  M4LWindowConfirm: WindowConfirmType;
362
347
  M4LAppBar: AppBarSlotsType;
363
348
  M4LDialog: DialogType;
@@ -435,7 +420,6 @@ declare module '@mui/material/styles' {
435
420
  M4LSelect: Partial<SelectOwnerState>;
436
421
  M4LTypography: Partial<TypographyOwnerState>;
437
422
  M4LCheckBox: Partial<CheckBoxOwnerState>;
438
- M4LRadioButton: Partial<RadioButtonOwnerState>;
439
423
  M4LRHFNumberInput: Partial<RHFNumberInputOwnerState>;
440
424
  M4LTab: Partial<TabOwnerState>;
441
425
  M4LButton: Partial<ButtonOwnerState>;
@@ -627,11 +611,6 @@ declare module '@mui/material/styles' {
627
611
  styleOverrides?: ComponentsOverrides<Theme>['M4LCheckBox'];
628
612
  variants?: ComponentsVariants['M4LCheckBox'];
629
613
  };
630
- M4LRadioButton?: {
631
- defaultProps?: ComponentsPropsList['M4LRadioButton'];
632
- styleOverrides?: ComponentsOverrides<Theme>['M4LRadioButton'];
633
- variants?: ComponentsVariants['M4LRadioButton'];
634
- };
635
614
  M4LActionCancel?: {
636
615
  defaultProps?: ComponentsPropsList['M4LActionCancel'];
637
616
  styleOverrides?: ComponentsOverrides<Theme>['M4LActionCancel'];
@@ -30,7 +30,6 @@ function DataGrid(props) {
30
30
  initialRowHeightVariant,
31
31
  checkedRows,
32
32
  onCheckedRowsChange,
33
- checkedRowsMultiple,
34
33
  dataTestId = "",
35
34
  customHeader: CustomHeader,
36
35
  visibleCustomHeader = true,
@@ -88,7 +87,6 @@ function DataGrid(props) {
88
87
  checkedRows,
89
88
  rowActionsGetter,
90
89
  onCheckedRowsChange,
91
- checkedRowsMultiple,
92
90
  rowKeyGetter,
93
91
  rows,
94
92
  onChangeUserColumns,
@@ -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
+ "& .M4LIcon-icon": {
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
  }
@@ -380,33 +416,19 @@ const dataGridStyles = {
380
416
  outline: `2px solid var(--rdg-selection-color)`,
381
417
  outlineOffset: "-2px"
382
418
  },
419
+ "&:has(> .MuiCheckbox-root)": {
420
+ overflow: "visible",
421
+ paddingInline: 0
422
+ },
383
423
  "& .checkbox-checked": {
384
- "& path:first-of-type": {
385
- fill: theme.vars.palette.primary.main
386
- },
387
- ...getSizeStyles(
388
- theme,
389
- ownerState?.size || "medium",
390
- "base",
391
- (size) => ({
392
- minHeight: size,
393
- height: size
394
- })
395
- )
424
+ "& .M4LIcon-icon": {
425
+ backgroundColor: theme.vars.palette.primary.enabled
426
+ }
396
427
  },
397
428
  "& .checkbox-unChecked": {
398
- "& path": {
399
- fill: theme.vars.palette.text.primary
400
- },
401
- ...getSizeStyles(
402
- theme,
403
- ownerState?.size || "medium",
404
- "base",
405
- (size) => ({
406
- minHeight: size,
407
- height: size
408
- })
409
- )
429
+ "& .M4LIcon-icon": {
430
+ backgroundColor: theme.vars.palette.text.primary
431
+ }
410
432
  },
411
433
  "& .rdg-text-editor": {
412
434
  textAlign: "inherit",
@@ -423,10 +445,6 @@ const dataGridStyles = {
423
445
  borderColor: `${theme.vars.palette?.border.disabled} !important`,
424
446
  ...theme.colorSchemes.finalTheme.typography.body
425
447
  },
426
- "&:has(> .M4LRadioButton-root)": {
427
- overflow: "visible",
428
- paddingInline: 0
429
- },
430
448
  "&.rdg-cell-frozen": {
431
449
  display: "flex",
432
450
  boxShadow: "unset",
@@ -676,26 +694,54 @@ const dataGridStyles = {
676
694
  * Estilos para el wrapper del CheckboxCellAdapter
677
695
  * Aplica los mismos estilos que los checkboxes dentro de celdas rdg
678
696
  */
679
- checkboxCellWrapper: ({ theme, ownerState }) => ({
697
+ checkboxCellWrapper: ({ theme }) => ({
680
698
  "& .checkbox-checked": {
681
- "& path:first-of-type": {
682
- fill: theme.vars.palette.primary.main
683
- },
684
- ...getSizeStyles(theme, ownerState?.size || "medium", "base", (size) => ({
685
- minHeight: size,
686
- height: size
687
- }))
699
+ "& .M4LIcon-icon": {
700
+ backgroundColor: theme.vars.palette.primary.enabled
701
+ }
688
702
  },
689
703
  "& .checkbox-unChecked": {
690
- "& path": {
691
- fill: theme.vars.palette.text.primary
692
- },
693
- ...getSizeStyles(theme, ownerState?.size || "medium", "base", (size) => ({
694
- minHeight: size,
695
- height: size
696
- }))
704
+ "& .M4LIcon-icon": {
705
+ backgroundColor: theme.vars.palette.text.primary
706
+ }
697
707
  },
698
708
  "& .MuiCheckbox-root": {
709
+ overflow: "visible",
710
+ padding: 0,
711
+ ...theme.generalSettings.isMobile ? {
712
+ width: theme.vars.size.mobile.small.action,
713
+ height: theme.vars.size.mobile.small.action
714
+ } : {
715
+ width: theme.vars.size.desktop.small.action,
716
+ height: theme.vars.size.desktop.small.action
717
+ },
718
+ display: "inline-flex",
719
+ justifyContent: "center",
720
+ alignItems: "center",
721
+ borderRadius: theme.size.borderRadius.r1,
722
+ "&:hover": {
723
+ backgroundColor: theme.vars.palette.default.hoverOpacity
724
+ },
725
+ "&:active": {
726
+ backgroundColor: theme.vars.palette.default.activeOpacity
727
+ },
728
+ "&.Mui-checked": {
729
+ "&:hover": {
730
+ backgroundColor: theme.vars.palette.primary.hoverOpacity,
731
+ "& .M4LIcon-icon": {
732
+ backgroundColor: theme.vars.palette.primary.hover
733
+ }
734
+ },
735
+ "&:active": {
736
+ backgroundColor: theme.vars.palette.primary.activeOpacity,
737
+ "& .M4LIcon-icon": {
738
+ backgroundColor: theme.vars.palette.primary.active
739
+ }
740
+ }
741
+ },
742
+ "&.Mui-focusVisible, &:focus-visible": {
743
+ outline: `1px solid ${theme.vars.palette.primary.focusVisible}`
744
+ },
699
745
  "& > svg": {
700
746
  color: theme.vars.palette.text.secondary
701
747
  }
@@ -896,6 +942,28 @@ const dataGridStyles = {
896
942
  }
897
943
  }
898
944
  }),
945
+ /**
946
+ * Placeholder editable
947
+ */
948
+ editablePlaceholder: ({ theme }) => ({
949
+ display: "flex",
950
+ alignItems: "center",
951
+ gap: theme.spacing(1)
952
+ }),
953
+ /**
954
+ * EditLabel
955
+ */
956
+ editLabel: ({ theme, ownerState }) => ({
957
+ width: "auto",
958
+ opacity: 1,
959
+ transition: "opacity 0.3s ease",
960
+ ...getTypographyStyles(
961
+ theme.generalSettings.isMobile,
962
+ ownerState?.size || "medium",
963
+ "body"
964
+ )
965
+ }),
966
+ iconButtonEdit: () => ({}),
899
967
  /**
900
968
  * Header de la card personalizada (avatar + nombre + email)
901
969
  */
@@ -155,7 +155,6 @@ function DataGridProvider(props) {
155
155
  initialRowHeightVariant = "standard",
156
156
  checkedRows,
157
157
  onCheckedRowsChange,
158
- checkedRowsMultiple,
159
158
  rowKeyGetter,
160
159
  onChangeUserColumns,
161
160
  externalSortSettings: sortSettings,
@@ -531,7 +530,6 @@ function DataGridProvider(props) {
531
530
  rowActionsGetter,
532
531
  setRowHeightVariant: setCurrentRowHeightInternal,
533
532
  onCheckedRowsChange,
534
- checkedRowsMultiple,
535
533
  rowKeyGetter,
536
534
  onChangeUserColumns,
537
535
  sortColumns,
@@ -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' | 'checkedRowsMultiple' | 'rowKeyGetter' | 'onChangeUserColumns' | 'defaultUserColumns' | 'externalSortSettings' | 'externalFilterSettings' | 'defaultViewMode' | 'cardsViewConfig'> {
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' | 'checkedRowsMultiple' | 'rowHeights' | 'rowsCount' | 'rowActionsGetter' | 'rowKeyGetter' | 'onChangeUserColumns' | 'externalSortSettings' | 'externalFilterSettings' | 'viewMode' | 'onViewModeChange' | 'defaultViewMode' | 'cardsViewConfig'> {
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;
@@ -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
  ]