@m4l/components 9.3.34-JT25112025.beta.3 → 9.3.34-JT26112025.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 (67) hide show
  1. package/@types/export.d.ts +3 -3
  2. package/@types/types.d.ts +16 -26
  3. package/components/DataGrid/DataGrid.js +0 -2
  4. package/components/DataGrid/Datagrid.styles.js +2 -6
  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/formatters/ColumnImageFormatter/ImageFormatterCell.d.ts +13 -0
  8. package/components/DataGrid/formatters/ColumnImageFormatter/ImageFormatterCell.js +33 -0
  9. package/components/DataGrid/formatters/ColumnImageFormatter/constants.d.ts +6 -0
  10. package/components/DataGrid/formatters/ColumnImageFormatter/constants.js +6 -0
  11. package/components/DataGrid/formatters/ColumnImageFormatter/formatter.d.ts +8 -0
  12. package/components/DataGrid/formatters/ColumnImageFormatter/formatter.js +25 -0
  13. package/components/DataGrid/formatters/ColumnImageFormatter/index.d.ts +3 -0
  14. package/components/DataGrid/formatters/ColumnImageFormatter/types.d.ts +44 -0
  15. package/components/DataGrid/formatters/ColumnImageFormatter/types.js +1 -0
  16. package/components/DataGrid/formatters/ColumnImageFormatter/useColumnImage.d.ts +9 -0
  17. package/components/DataGrid/formatters/ColumnImageFormatter/useColumnImage.js +22 -0
  18. package/components/DataGrid/formatters/index.d.ts +1 -0
  19. package/components/DataGrid/subcomponents/Cards/helpers/scrollToCardElement.js +2 -2
  20. package/components/DataGrid/subcomponents/Cards/index.js +16 -3
  21. package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +7 -15
  22. package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +1 -0
  23. package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +1 -4
  24. package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +2 -6
  25. package/components/DataGrid/subcomponents/Table/index.js +10 -1
  26. package/components/DataGrid/tests/helpers/types.d.ts +10 -0
  27. package/components/DataGrid/types.d.ts +0 -7
  28. package/components/formatters/ImageFormatter/ImageFormatter.d.ts +10 -0
  29. package/components/formatters/ImageFormatter/ImageFormatter.js +72 -0
  30. package/components/formatters/ImageFormatter/ImageFormatter.styles.d.ts +2 -0
  31. package/components/formatters/ImageFormatter/ImageFormatter.styles.js +42 -0
  32. package/components/formatters/ImageFormatter/constants.d.ts +5 -0
  33. package/components/formatters/ImageFormatter/constants.js +10 -0
  34. package/components/formatters/ImageFormatter/index.d.ts +2 -0
  35. package/components/formatters/ImageFormatter/index.js +1 -0
  36. package/components/formatters/ImageFormatter/slots/ImageFormatterEnum.d.ts +5 -0
  37. package/components/formatters/ImageFormatter/slots/ImageFormatterEnum.js +9 -0
  38. package/components/formatters/ImageFormatter/slots/ImageFormatterSlots.d.ts +9 -0
  39. package/components/formatters/ImageFormatter/slots/ImageFormatterSlots.js +23 -0
  40. package/components/formatters/ImageFormatter/types.d.ts +51 -0
  41. package/components/formatters/ImageFormatter/types.js +1 -0
  42. package/components/formatters/index.d.ts +1 -0
  43. package/components/mui_extended/index.d.ts +0 -1
  44. package/index.js +107 -103
  45. package/package.json +1 -1
  46. package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.d.ts +0 -6
  47. package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.js +0 -12
  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/slots/RadioButtonEnum.d.ts +0 -8
  60. package/components/mui_extended/RadioButton/slots/RadioButtonEnum.js +0 -12
  61. package/components/mui_extended/RadioButton/slots/RadioButtonSlots.d.ts +0 -20
  62. package/components/mui_extended/RadioButton/slots/RadioButtonSlots.js +0 -39
  63. package/components/mui_extended/RadioButton/tests/RadioButton.test.d.ts +0 -1
  64. package/components/mui_extended/RadioButton/types.d.ts +0 -50
  65. /package/components/{mui_extended/RadioButton → DataGrid/formatters/ColumnImageFormatter}/index.js +0 -0
  66. /package/components/DataGrid/{tests/table/subcomponents/RadioButtonFormatter.test.d.ts → formatters/ColumnImageFormatter/tests/ColumnImageFormatter.test.d.ts} +0 -0
  67. /package/components/{DataGrid/tests/table/subcomponents/RadioSelectColumn.test.d.ts → formatters/ImageFormatter/tests/ImageFormatter.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
  };
@@ -244,5 +241,8 @@ declare module '@mui/material/styles' {
244
241
  M4LIconsFormatter?: {
245
242
  styleOverrides?: ComponentsOverrides<Theme>['M4LIconsFormatter'];
246
243
  };
244
+ M4LImageFormatter?: {
245
+ styleOverrides?: ComponentsOverrides<Theme>['M4LImageFormatter'];
246
+ };
247
247
  }
248
248
  }
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,
@@ -317,6 +304,10 @@ import {
317
304
  IconsFormatterOwnerState,
318
305
  IconsFormatterSlotsType,
319
306
  } from '../components/formatters/IconsFormatter/types';
307
+ import {
308
+ ImageFormatterOwnerState,
309
+ ImageFormatterSlotsType,
310
+ } from '../components/formatters/ImageFormatter';
320
311
 
321
312
  declare module '@mui/material/styles' {
322
313
  // Define the slots in the theme
@@ -341,7 +332,6 @@ declare module '@mui/material/styles' {
341
332
  M4LSelect: SelectSlotsType;
342
333
  M4LTypography: TypographySlotsType;
343
334
  M4LCheckBox: CheckBoxSlotsType;
344
- M4LRadioButton: RadioButtonSlotsType;
345
335
  M4LRHFNumberInput: RHFNumberInputSlotsType;
346
336
  M4LTab: TabSlotsType;
347
337
  M4LButton: ButtonSlotsType;
@@ -356,8 +346,7 @@ declare module '@mui/material/styles' {
356
346
  M4LChip: ChipSlotsType;
357
347
  M4LCircularProgress: CircularProgressSlotsType;
358
348
  M4LPaperForm: PaperFormSlotsType;
359
- M4LWindowBase: WindowBaseType;
360
- a;
349
+ M4LWindowBase: WindowBaseType;a
361
350
  M4LWindowConfirm: WindowConfirmType;
362
351
  M4LAppBar: AppBarSlotsType;
363
352
  M4LDialog: DialogType;
@@ -412,6 +401,7 @@ declare module '@mui/material/styles' {
412
401
  M4LMFIsolationApp: MFIsolationAppSlotsType;
413
402
  M4LTagsFormatter: TagsFormatterSlotsType;
414
403
  M4LIconsFormatter: IconsFormatterSlotsType;
404
+ M4LImageFormatter: ImageFormatterSlotsType;
415
405
  }
416
406
  interface ComponentsPropsList {
417
407
  // Extend ComponentsProps or ComponentsOwnerState(this extend ComponentProps)
@@ -435,7 +425,6 @@ declare module '@mui/material/styles' {
435
425
  M4LSelect: Partial<SelectOwnerState>;
436
426
  M4LTypography: Partial<TypographyOwnerState>;
437
427
  M4LCheckBox: Partial<CheckBoxOwnerState>;
438
- M4LRadioButton: Partial<RadioButtonOwnerState>;
439
428
  M4LRHFNumberInput: Partial<RHFNumberInputOwnerState>;
440
429
  M4LTab: Partial<TabOwnerState>;
441
430
  M4LButton: Partial<ButtonOwnerState>;
@@ -505,6 +494,7 @@ declare module '@mui/material/styles' {
505
494
  M4LMFIsolationApp: Partial<MFIsolationAppOwnerState>;
506
495
  M4LTagsFormatter: Partial<TagsFormatterOwnerState>;
507
496
  M4LIconsFormatter: Partial<IconsFormatterOwnerState>;
497
+ M4LImageFormatter: Partial<ImageFormatterOwnerState>;
508
498
  }
509
499
  interface Components {
510
500
  M4LDynamicFilter?: {
@@ -627,11 +617,6 @@ declare module '@mui/material/styles' {
627
617
  styleOverrides?: ComponentsOverrides<Theme>['M4LCheckBox'];
628
618
  variants?: ComponentsVariants['M4LCheckBox'];
629
619
  };
630
- M4LRadioButton?: {
631
- defaultProps?: ComponentsPropsList['M4LRadioButton'];
632
- styleOverrides?: ComponentsOverrides<Theme>['M4LRadioButton'];
633
- variants?: ComponentsVariants['M4LRadioButton'];
634
- };
635
620
  M4LActionCancel?: {
636
621
  defaultProps?: ComponentsPropsList['M4LActionCancel'];
637
622
  styleOverrides?: ComponentsOverrides<Theme>['M4LActionCancel'];
@@ -967,5 +952,10 @@ declare module '@mui/material/styles' {
967
952
  styleOverrides?: ComponentsOverrides<Theme>['M4LIconsFormatter'];
968
953
  variants?: ComponentsVariants['M4LIconsFormatter'];
969
954
  };
955
+ M4LImageFormatter?: {
956
+ defaultProps?: ComponentsPropsList['M4LImageFormatter'];
957
+ styleOverrides?: ComponentsOverrides<Theme>['M4LImageFormatter'];
958
+ variants?: ComponentsVariants['M4LImageFormatter'];
959
+ };
970
960
  }
971
961
  }
@@ -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,
@@ -270,6 +270,7 @@ const dataGridStyles = {
270
270
  border: theme.vars.size.borderStroke.container,
271
271
  borderColor: theme.vars.palette?.border.secondary,
272
272
  "& .rdg ": {
273
+ scrollBehavior: "smooth",
273
274
  display: "grid",
274
275
  contain: "content",
275
276
  boxSizing: "border-box",
@@ -423,10 +424,6 @@ const dataGridStyles = {
423
424
  borderColor: `${theme.vars.palette?.border.disabled} !important`,
424
425
  ...theme.colorSchemes.finalTheme.typography.body
425
426
  },
426
- "&:has(> .M4LRadioButton-root)": {
427
- overflow: "visible",
428
- paddingInline: 0
429
- },
430
427
  "&.rdg-cell-frozen": {
431
428
  display: "flex",
432
429
  boxShadow: "unset",
@@ -749,7 +746,6 @@ const dataGridStyles = {
749
746
  minWidth: "280px",
750
747
  maxWidth: "580px",
751
748
  cursor: "pointer",
752
- padding: theme.vars.size.baseSpacings["sp2-5"],
753
749
  // Si está checked (pero no selected), border de checked
754
750
  ...ownerState?.checked && !ownerState?.selected && {
755
751
  borderColor: theme.vars.palette.primary.activeOpacity
@@ -790,7 +786,7 @@ const dataGridStyles = {
790
786
  cardHeaderRight: ({ theme }) => ({
791
787
  display: "flex",
792
788
  alignItems: "center",
793
- gap: theme.vars.size.baseSpacings["sp0-5"]
789
+ gap: theme.vars.size.baseSpacings.sp1
794
790
  }),
795
791
  /**
796
792
  * Contenido de la card (body)
@@ -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;
@@ -0,0 +1,13 @@
1
+ import { ColumnImageFormatterProps } from './types';
2
+ import { RenderCellProps } from 'react-data-grid';
3
+ /**
4
+ * Componente interno que renderiza la celda y puede usar hooks
5
+ */
6
+ export declare function ImageFormatterCell<TRow>(props: {
7
+ formatterProps: RenderCellProps<TRow>;
8
+ fieldValue: ColumnImageFormatterProps<TRow>['fieldValue'];
9
+ fieldText: ColumnImageFormatterProps<TRow>['fieldText'];
10
+ width?: ColumnImageFormatterProps<TRow>['width'];
11
+ height?: ColumnImageFormatterProps<TRow>['height'];
12
+ cover?: ColumnImageFormatterProps<TRow>['cover'];
13
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,33 @@
1
+ import { jsx, Fragment } from "react/jsx-runtime";
2
+ import { useContext } from "react";
3
+ import { getPropertyByString } from "@m4l/core";
4
+ import { I as IMAGE_SIZES } from "./constants.js";
5
+ import { a as DataGridContext } from "../../contexts/DataGridContext/index.js";
6
+ import { I as ImageFormatter } from "../../../formatters/ImageFormatter/ImageFormatter.js";
7
+ function ImageFormatterCell(props) {
8
+ const { formatterProps, fieldValue, fieldText, width, height, cover } = props;
9
+ const context = useContext(DataGridContext);
10
+ const viewMode = context?.viewMode ?? "cards";
11
+ const hasCustomSize = width !== void 0 && height !== void 0;
12
+ const finalWidth = viewMode === "cards" && hasCustomSize ? width : viewMode === "cards" ? IMAGE_SIZES.cards : void 0;
13
+ const finalHeight = viewMode === "cards" && hasCustomSize ? height : viewMode === "cards" ? IMAGE_SIZES.cards : void 0;
14
+ const src = getPropertyByString(formatterProps.row, fieldValue) ?? void 0;
15
+ const text = fieldText ? getPropertyByString(formatterProps.row, fieldText) ?? void 0 : void 0;
16
+ if (!src) {
17
+ return /* @__PURE__ */ jsx(Fragment, { children: "-" });
18
+ }
19
+ return /* @__PURE__ */ jsx(
20
+ ImageFormatter,
21
+ {
22
+ src,
23
+ alt: text || src,
24
+ width: finalWidth,
25
+ height: finalHeight,
26
+ text,
27
+ cover
28
+ }
29
+ );
30
+ }
31
+ export {
32
+ ImageFormatterCell as I
33
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Dimensiones de imagen según densidad en vista tabla
3
+ */
4
+ export declare const IMAGE_SIZES: {
5
+ readonly cards: 60;
6
+ };
@@ -0,0 +1,6 @@
1
+ const IMAGE_SIZES = {
2
+ cards: 60
3
+ };
4
+ export {
5
+ IMAGE_SIZES as I
6
+ };
@@ -0,0 +1,8 @@
1
+ import { RenderCellProps } from 'react-data-grid';
2
+ import { ColumnImageFormatterProps } from './types';
3
+ /**
4
+ * Formatter para mostrar imágenes con o sin texto
5
+ * @param props - Propiedades del formatter
6
+ * @returns Función que recibe RenderCellProps y retorna el ImageFormatter
7
+ */
8
+ export declare function ColumnImageFormatter<TRow>(props: ColumnImageFormatterProps<TRow>): (formatterProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { I as ImageFormatterCell } from "./ImageFormatterCell.js";
3
+ function ColumnImageFormatter(props) {
4
+ const { fieldValue, fieldText, cover } = props;
5
+ const width = "width" in props && props.width !== void 0 ? props.width : void 0;
6
+ const height = "height" in props && props.height !== void 0 ? props.height : void 0;
7
+ const formatter = (formatterProps) => {
8
+ return /* @__PURE__ */ jsx(
9
+ ImageFormatterCell,
10
+ {
11
+ formatterProps,
12
+ fieldValue,
13
+ fieldText,
14
+ width,
15
+ height,
16
+ cover
17
+ }
18
+ );
19
+ };
20
+ formatter.__imageFormatterHeight = height ?? 60;
21
+ return formatter;
22
+ }
23
+ export {
24
+ ColumnImageFormatter as C
25
+ };
@@ -0,0 +1,3 @@
1
+ export { useColumnImage } from './useColumnImage';
2
+ export { ColumnImageFormatter } from './formatter';
3
+ export * from './types';
@@ -0,0 +1,44 @@
1
+ import { DeepKeyOf } from '../../../../utils/types';
2
+ interface ColumnImageFormatterBaseProps<TRow> {
3
+ /**
4
+ * Campo del row que contiene la URL de la imagen
5
+ */
6
+ fieldValue: DeepKeyOf<TRow>;
7
+ /**
8
+ * Campo opcional del row que contiene el texto a mostrar junto a la imagen
9
+ */
10
+ fieldText?: DeepKeyOf<TRow>;
11
+ /**
12
+ * Si es true, la imagen usa object-fit: cover (recorta si es necesario)
13
+ * Si es false o undefined, usa object-fit: contain (muestra completa)
14
+ * @default false
15
+ */
16
+ cover?: boolean;
17
+ }
18
+ /**
19
+ * Props sin dimensiones personalizadas (usa IMAGE_SIZES.cards por defecto)
20
+ */
21
+ interface ColumnImageFormatterWithoutSize<TRow> extends ColumnImageFormatterBaseProps<TRow> {
22
+ width?: never;
23
+ height?: never;
24
+ }
25
+ /**
26
+ * Props con dimensiones personalizadas para vista cards
27
+ * IMPORTANTE: width y height deben proporcionarse juntas
28
+ */
29
+ interface ColumnImageFormatterWithSize<TRow> extends ColumnImageFormatterBaseProps<TRow> {
30
+ /**
31
+ * Ancho personalizado para la imagen en vista cards (en píxeles)
32
+ */
33
+ width: number;
34
+ /**
35
+ * Alto personalizado para la imagen en vista cards (en píxeles)
36
+ */
37
+ height: number;
38
+ }
39
+ /**
40
+ * Props para ColumnImageFormatter
41
+ * Puede tener dimensiones personalizadas (width Y height juntas) o ninguna
42
+ */
43
+ export type ColumnImageFormatterProps<TRow> = ColumnImageFormatterWithoutSize<TRow> | ColumnImageFormatterWithSize<TRow>;
44
+ export {};
@@ -0,0 +1,9 @@
1
+ import { ColumnImageFormatterProps } from './types';
2
+ /**
3
+ * Hook que retorna el formatter para columnas con imágenes en DataGrid
4
+ * @param props - Propiedades del formatter
5
+ * @returns Objeto con el formatter
6
+ */
7
+ export declare const useColumnImage: <TRow>(props: ColumnImageFormatterProps<TRow>) => {
8
+ formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
9
+ };
@@ -0,0 +1,22 @@
1
+ import { useState, useRef, useEffect, useMemo } from "react";
2
+ import { deepEqual } from "fast-equals";
3
+ import { C as ColumnImageFormatter } from "./formatter.js";
4
+ const useColumnImage = (props) => {
5
+ const [stateProps, setStateProps] = useState(props);
6
+ const refProps = useRef({ ...props });
7
+ useEffect(() => {
8
+ if (!deepEqual(refProps.current, props)) {
9
+ refProps.current = props;
10
+ setStateProps(props);
11
+ }
12
+ }, [props]);
13
+ return useMemo(
14
+ () => ({
15
+ formatter: ColumnImageFormatter(stateProps)
16
+ }),
17
+ [stateProps]
18
+ );
19
+ };
20
+ export {
21
+ useColumnImage as u
22
+ };
@@ -11,3 +11,4 @@ export * from './ColumnUncertaintyFormatter';
11
11
  export * from './ColumnChipStatusFormatter';
12
12
  export * from './ColumnTagsFormatter';
13
13
  export * from './ColumnColorFormatter';
14
+ export * from './ColumnImageFormatter';
@@ -13,8 +13,8 @@ function scrollToCardElement(containerElement, rowKey, selectorType = "data-attr
13
13
  return;
14
14
  }
15
15
  foundElement.scrollIntoView({
16
- behavior: "auto",
17
- block: "center"
16
+ behavior: "smooth",
17
+ block: "end"
18
18
  });
19
19
  } catch (error) {
20
20
  console.error("scrollToCardElement: Error al hacer scroll", error);
@@ -21,6 +21,7 @@ function Cards(props) {
21
21
  onCheckedRowsChange
22
22
  } = props;
23
23
  const containerRef = useRef(null);
24
+ const hasScrolledToFocusRow = useRef(false);
24
25
  const processedColumns = useProcessedColumns(columns);
25
26
  const allProcessedColumns = useProcessedColumns(columns, {
26
27
  applyVisibilityFilter: false
@@ -31,13 +32,21 @@ function Cards(props) {
31
32
  onRowsChange
32
33
  });
33
34
  const cardHeight = useMemo(() => {
35
+ const imageHeight = processedColumns.reduce((totalHeight, col) => {
36
+ const formatterHeight = col.renderCell?.__imageFormatterHeight;
37
+ return formatterHeight ? totalHeight + formatterHeight : totalHeight;
38
+ }, 0);
34
39
  return calculateCardHeight({
35
40
  visibleColumnsCount: processedColumns.length,
36
41
  customMinHeight: cardsViewConfig?.customRender?.minHeight
37
- });
38
- }, [processedColumns.length, cardsViewConfig]);
42
+ }) + imageHeight;
43
+ }, [processedColumns, cardsViewConfig]);
39
44
  useEffect(() => {
40
45
  if (!focusOnRowKey) {
46
+ hasScrolledToFocusRow.current = false;
47
+ return;
48
+ }
49
+ if (hasScrolledToFocusRow.current) {
41
50
  return;
42
51
  }
43
52
  const rowIndex = rows.findIndex(
@@ -58,9 +67,13 @@ function Cards(props) {
58
67
  "data-attribute",
59
68
  "data-row-key"
60
69
  );
70
+ if (onSelectedRowsChange) {
71
+ onSelectedRowsChange(/* @__PURE__ */ new Set([focusOnRowKey]));
72
+ }
73
+ hasScrolledToFocusRow.current = true;
61
74
  }, 300);
62
75
  return () => clearTimeout(timer);
63
- }, [focusOnRowKey, rows, rowKeyGetter, cardHeight]);
76
+ }, [focusOnRowKey, rows, rowKeyGetter, cardHeight, onSelectedRowsChange]);
64
77
  if (processedColumns.length === 0) {
65
78
  return null;
66
79
  }
@@ -15,7 +15,7 @@ function CardHeader({
15
15
  checkedRows,
16
16
  onCheckedRowsChange
17
17
  }) {
18
- const { rowKeyGetter, rowActionsGetter, size, checkedRowsMultiple } = useDataGrid();
18
+ const { rowKeyGetter, rowActionsGetter, size } = useDataGrid();
19
19
  const { host_static_assets, environment_assets } = useEnvironment();
20
20
  const rowKey = useMemo(() => rowKeyGetter(row), [rowKeyGetter, row]);
21
21
  const onChange = useCallback(
@@ -23,23 +23,15 @@ function CardHeader({
23
23
  if (!onCheckedRowsChange || !checkedRows) {
24
24
  return;
25
25
  }
26
- if (checkedRowsMultiple === false) {
27
- if (checked) {
28
- onCheckedRowsChange(/* @__PURE__ */ new Set([rowKey]));
29
- } else {
30
- onCheckedRowsChange(/* @__PURE__ */ new Set());
31
- }
26
+ const newCheckedRows = new Set(checkedRows);
27
+ if (checked) {
28
+ newCheckedRows.add(rowKey);
32
29
  } else {
33
- const newCheckedRows = new Set(checkedRows);
34
- if (checked) {
35
- newCheckedRows.add(rowKey);
36
- } else {
37
- newCheckedRows.delete(rowKey);
38
- }
39
- onCheckedRowsChange(newCheckedRows);
30
+ newCheckedRows.delete(rowKey);
40
31
  }
32
+ onCheckedRowsChange(newCheckedRows);
41
33
  },
42
- [checkedRows, onCheckedRowsChange, rowKey, checkedRowsMultiple]
34
+ [checkedRows, onCheckedRowsChange, rowKey]
43
35
  );
44
36
  const anchorOrigin = useMemo(
45
37
  () => ({
@@ -88,6 +88,7 @@ function CardRowComponent({
88
88
  },
89
89
  onClick: onCardClick,
90
90
  "data-testid": "data-grid-card",
91
+ "data-row-key": rowKeyGetter(row),
91
92
  children: content
92
93
  }
93
94
  )
@@ -2,7 +2,6 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useContext } from "react";
3
3
  import { SelectCellFormatter } from "react-data-grid";
4
4
  import { C as CheckboxFormatter } from "../Table/subcomponents/CheckboxFormatter.js";
5
- import { R as RadioButtonFormatter } from "../Table/subcomponents/RadioButtonFormatter.js";
6
5
  import { a as DataGridContext } from "../../contexts/DataGridContext/index.js";
7
6
  import { l as CheckboxCellWrapperStyled } from "../../slots/DataGridSlot.js";
8
7
  const CheckboxCellAdapter = forwardRef(function CheckboxCellAdapter2(props, ref) {
@@ -15,14 +14,12 @@ const CheckboxCellAdapter = forwardRef(function CheckboxCellAdapter2(props, ref)
15
14
  } = props;
16
15
  const context = useContext(DataGridContext);
17
16
  const viewMode = context?.viewMode ?? "cards";
18
- const checkedRowsMultiple = context?.checkedRowsMultiple;
19
17
  if (viewMode !== "table") {
20
18
  const handleClick = (e) => {
21
19
  e.stopPropagation();
22
20
  };
23
- const FormatterComponent = checkedRowsMultiple === false ? RadioButtonFormatter : CheckboxFormatter;
24
21
  return /* @__PURE__ */ jsx(CheckboxCellWrapperStyled, { onClick: handleClick, children: /* @__PURE__ */ jsx(
25
- FormatterComponent,
22
+ CheckboxFormatter,
26
23
  {
27
24
  ref,
28
25
  checked: value,
@@ -2,7 +2,6 @@ import { useState, useEffect, useMemo } from "react";
2
2
  import { g as getDragHeaderRenderer } from "./getDragHeaderRenderer.js";
3
3
  import { A as ActionsColumn } from "../subcomponents/ActionsColumn.js";
4
4
  import { f as filterColumnClassName, S as SelectColumn } from "../subcomponents/SelectColumn.js";
5
- import { R as RadioSelectColumn } from "../subcomponents/RadioSelectColumn.js";
6
5
  import { useModuleSkeleton, getPropertyByString } from "@m4l/core";
7
6
  import { u as useFilters } from "../../../hooks/useFilters.js";
8
7
  import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
@@ -39,7 +38,7 @@ function getComparator(columns, sortColumn) {
39
38
  }
40
39
  }
41
40
  const getColumIndex = (key, columnsConfig) => columnsConfig.findIndex((columnConfig) => columnConfig.key === key);
42
- const getInOrderColumns = (columns, hasCheckedRows, checkedRowsMultiple, columnsConfig, columnsWidths, rowActionsGetter) => {
41
+ const getInOrderColumns = (columns, hasCheckedRows, columnsConfig, columnsWidths, rowActionsGetter) => {
43
42
  let filteredSortedColumns = columns.filter((column) => {
44
43
  const columnConfigIndex = getColumIndex(column.key, columnsConfig);
45
44
  const visible = columnConfigIndex > -1 ? columnsConfig[columnConfigIndex].visible : true;
@@ -65,8 +64,7 @@ const getInOrderColumns = (columns, hasCheckedRows, checkedRowsMultiple, columns
65
64
  filteredSortedColumns = [ActionsColumn, ...filteredSortedColumns];
66
65
  }
67
66
  if (hasCheckedRows) {
68
- const selectionColumn = checkedRowsMultiple === false ? RadioSelectColumn : SelectColumn;
69
- filteredSortedColumns = [selectionColumn, ...filteredSortedColumns];
67
+ filteredSortedColumns = [SelectColumn, ...filteredSortedColumns];
70
68
  }
71
69
  return filteredSortedColumns;
72
70
  };
@@ -91,7 +89,6 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
91
89
  rowActionsGetter,
92
90
  checkedRows,
93
91
  onCheckedRowsChange,
94
- checkedRowsMultiple,
95
92
  sortColumns,
96
93
  setSortColumns
97
94
  } = useDataGrid();
@@ -112,7 +109,6 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
112
109
  sourceColumns,
113
110
  !!checkedRows && !!onCheckedRowsChange,
114
111
  //Si están seteados se habilita el múltipe
115
- checkedRowsMultiple,
116
112
  columnsConfig,
117
113
  columnsWidths,
118
114
  rowActionsGetter
@@ -68,6 +68,7 @@ function Table(props) {
68
68
  anchorEl: null,
69
69
  columnKey: null
70
70
  });
71
+ const hasScrolledToFocusRow = useRef(false);
71
72
  const [allowSortChange, setAllowSortChange] = useState(false);
72
73
  const handleSortColumnsChange = (newSortColumns) => {
73
74
  if (allowSortChange) {
@@ -113,6 +114,10 @@ function Table(props) {
113
114
  }, [finalRows]);
114
115
  useEffect(() => {
115
116
  if (!focusOnRowKey) {
117
+ hasScrolledToFocusRow.current = false;
118
+ return;
119
+ }
120
+ if (hasScrolledToFocusRow.current) {
116
121
  return;
117
122
  }
118
123
  const rowIndex = finalRows.findIndex(
@@ -120,8 +125,12 @@ function Table(props) {
120
125
  );
121
126
  if (rowIndex !== -1) {
122
127
  ref_data_grid.current?.scrollToCell({ rowIdx: rowIndex });
128
+ if (onSelectedRowsChange) {
129
+ onSelectedRowsChange(/* @__PURE__ */ new Set([focusOnRowKey]));
130
+ }
131
+ hasScrolledToFocusRow.current = true;
123
132
  }
124
- }, [focusOnRowKey, finalRows, rowKeyGetter]);
133
+ }, [focusOnRowKey, finalRows, rowKeyGetter, onSelectedRowsChange]);
125
134
  const onColumnResize = (idx, width) => {
126
135
  onChangeColumnWidth(finalColumns[idx].key, width);
127
136
  };
@@ -20,6 +20,12 @@ export interface SeedProps {
20
20
  withCesar?: boolean;
21
21
  withChipStatus?: boolean;
22
22
  withTags?: boolean;
23
+ withImage?: boolean;
24
+ withImageCustomSize?: {
25
+ width: number;
26
+ height: number;
27
+ };
28
+ withImageWithoutText?: boolean;
23
29
  withActions?: boolean;
24
30
  withActionsUser?: boolean;
25
31
  withBooleanStatus?: boolean;
@@ -69,6 +75,10 @@ export interface RowType {
69
75
  currentStatus: 'superadmin' | 'admin' | 'user';
70
76
  };
71
77
  color?: string;
78
+ image?: {
79
+ url: string;
80
+ text?: string;
81
+ };
72
82
  }
73
83
  interface RangesUncertainty {
74
84
  cmcMin: number;
@@ -137,13 +137,6 @@ export interface GridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> exte
137
137
  onSelectedRowsChange?: (mapRowsSelected: ReadonlySet<TKey>) => void;
138
138
  checkedRows?: ReadonlySet<TKey>;
139
139
  onCheckedRowsChange?: (mapRowsSelected: ReadonlySet<TKey>) => void;
140
- /**
141
- * Define si la selección de filas es múltiple (checkboxes) o única (radio buttons).
142
- *
143
- * - `true` (default): Permite seleccionar múltiples filas con checkboxes
144
- * - `false`: Permite seleccionar solo una fila con radio buttons
145
- */
146
- checkedRowsMultiple?: boolean;
147
140
  onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, TSummaryRow>) => void>;
148
141
  /**
149
142
  * Propiedad opcional que recibe la configuración de las columnas