@m4l/components 9.2.62-JT09072025.beta.2 → 9.2.63-JT14072025.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 (53) hide show
  1. package/components/DataGrid/Datagrid.styles.js +22 -2
  2. package/components/DataGrid/formatters/ColumnBooleanFormatter/formatter.d.ts +2 -1
  3. package/components/DataGrid/formatters/ColumnBooleanFormatter/formatter.js +2 -3
  4. package/components/DataGrid/formatters/ColumnBooleanFormatter/useColumnBoolean.d.ts +1 -1
  5. package/components/DataGrid/formatters/ColumnChipStatusFormatter/formatter.d.ts +2 -1
  6. package/components/DataGrid/formatters/ColumnChipStatusFormatter/formatter.js +5 -4
  7. package/components/DataGrid/formatters/ColumnChipStatusFormatter/useColumnChipStatus.d.ts +1 -1
  8. package/components/DataGrid/formatters/ColumnConcatenatedValuesFormatter/formatter.d.ts +2 -1
  9. package/components/DataGrid/formatters/ColumnConcatenatedValuesFormatter/formatter.js +11 -4
  10. package/components/DataGrid/formatters/ColumnConcatenatedValuesFormatter/useColumnConcatenatedValues.d.ts +1 -1
  11. package/components/DataGrid/formatters/ColumnDateFormatter/formatter.d.ts +2 -1
  12. package/components/DataGrid/formatters/ColumnDateFormatter/formatter.js +13 -4
  13. package/components/DataGrid/formatters/ColumnDateFormatter/useColumnDate.d.ts +1 -1
  14. package/components/DataGrid/formatters/ColumnIconFormatter/formatter.d.ts +2 -1
  15. package/components/DataGrid/formatters/ColumnIconFormatter/formatter.js +2 -2
  16. package/components/DataGrid/formatters/ColumnIconFormatter/useColumnIcon.d.ts +1 -1
  17. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/types.d.ts +2 -2
  18. package/components/DataGrid/formatters/ColumnNestedValueFormatter/formatter.d.ts +2 -1
  19. package/components/DataGrid/formatters/ColumnNestedValueFormatter/formatter.js +4 -3
  20. package/components/DataGrid/formatters/ColumnNestedValueFormatter/useColumnNestedValue.d.ts +1 -1
  21. package/components/DataGrid/formatters/ColumnPointsFormatter/formatter.d.ts +2 -1
  22. package/components/DataGrid/formatters/ColumnPointsFormatter/formatter.js +13 -5
  23. package/components/DataGrid/formatters/ColumnPointsFormatter/useColumnPoints.d.ts +1 -1
  24. package/components/DataGrid/formatters/ColumnPriceFormatter/formatter.d.ts +2 -1
  25. package/components/DataGrid/formatters/ColumnPriceFormatter/formatter.js +11 -4
  26. package/components/DataGrid/formatters/ColumnPriceFormatter/useColumnPrice.d.ts +1 -1
  27. package/components/DataGrid/formatters/ColumnSetCheckFormatter/formatter.d.ts +2 -2
  28. package/components/DataGrid/formatters/ColumnSetCheckFormatter/formatter.js +1 -1
  29. package/components/DataGrid/formatters/ColumnSetCheckFormatter/useColumnSetCheck.d.ts +1 -1
  30. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/formatter.d.ts +2 -1
  31. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/formatter.js +15 -6
  32. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.d.ts +1 -1
  33. package/components/DataGrid/index.d.ts +1 -1
  34. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +4 -5
  35. package/components/DataGrid/subcomponents/Table/hooks/getDragHeaderRenderer.d.ts +2 -2
  36. package/components/DataGrid/subcomponents/Table/hooks/useHeaderMenuActions.d.ts +2 -2
  37. package/components/DataGrid/subcomponents/Table/hooks/useHeaderMenuActions.js +15 -6
  38. package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +9 -5
  39. package/components/DataGrid/subcomponents/Table/index.d.ts +3 -1
  40. package/components/DataGrid/subcomponents/Table/index.js +39 -9
  41. package/components/DataGrid/subcomponents/Table/subcomponents/ActionsColumn.js +1 -1
  42. package/components/DataGrid/subcomponents/Table/subcomponents/CheckboxFormatter.d.ts +2 -2
  43. package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.d.ts +2 -2
  44. package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +10 -8
  45. package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
  46. package/components/DataGrid/subcomponents/Table/subcomponents/SelectColumn.js +7 -7
  47. package/components/DataGrid/subcomponents/editors/TextEditor/index.d.ts +3 -3
  48. package/components/DataGrid/types.d.ts +5 -4
  49. package/components/mui_extended/MenuItem/MenuItem.js +2 -1
  50. package/components/mui_extended/MenuItem/types.d.ts +4 -0
  51. package/package.json +2 -2
  52. package/storybook/components/DataGrid/helpers/types.d.ts +2 -2
  53. package/helpers/getFieldValueWithRow.js +0 -10
@@ -335,6 +335,7 @@ const dataGridStyles = {
335
335
  alignItems: "center",
336
336
  textOverflow: "inline",
337
337
  gridTemplateColumns: "auto",
338
+ padding: "0 8px",
338
339
  ...getTypographyStyles(
339
340
  theme.generalSettings.isMobile,
340
341
  ownerState?.size || "medium",
@@ -400,6 +401,11 @@ const dataGridStyles = {
400
401
  },
401
402
  "& .m4l_icon": {
402
403
  height: "100%"
404
+ },
405
+ '&[role="columnheader"]': {
406
+ '&[aria-colindex="1"]': {
407
+ borderTopLeftRadius: theme.vars.size.baseSpacings.sp2
408
+ }
403
409
  }
404
410
  },
405
411
  '& .rdg-cell[role="columnheader"] .rdg-header-sort-name': {
@@ -576,6 +582,7 @@ const dataGridStyles = {
576
582
  alignItems: "center",
577
583
  backgroundColor: theme.vars.palette.default.enabled,
578
584
  padding: theme.vars.size.baseSpacings.sp1,
585
+ marginBottom: theme.vars.size.baseSpacings.sp2,
579
586
  gap: theme.vars.size.baseSpacings.sp1,
580
587
  borderRadius: theme.vars.size.borderRadius.r1,
581
588
  ...getSizeStyles(theme, ownerState?.size || "medium", "action", (size) => ({
@@ -664,11 +671,24 @@ const dataGridStyles = {
664
671
  /**
665
672
  * Estilos para el contenedor del boton de acciones del header
666
673
  */
667
- buttonHeaderActions: () => ({
674
+ buttonHeaderActions: ({ theme }) => ({
668
675
  display: "flex",
669
676
  alignItems: "center",
670
677
  justifyContent: "space-between",
671
- width: "100%"
678
+ width: "100%",
679
+ cursor: "pointer",
680
+ height: "100%",
681
+ "> span": {
682
+ display: "flex",
683
+ alignItems: "center",
684
+ justifyContent: "space-between",
685
+ width: "100%",
686
+ "& svg": {
687
+ width: "8px",
688
+ height: "8px",
689
+ color: theme.vars.palette.chips.default.contained.backgroundColorTone
690
+ }
691
+ }
672
692
  }),
673
693
  /**
674
694
  * Estilos para el formatter de iconos
@@ -1,5 +1,6 @@
1
1
  import { ColumnBooleanFormatterProps } from './types';
2
+ import { RenderCellProps } from 'react-data-grid';
2
3
  /**
3
4
  * Función para formatear un booleano en una columna de un DataGrid
4
5
  */
5
- export declare function ColumnBooleanFormatter<TRow>(props: ColumnBooleanFormatterProps<TRow>): (obProps: any) => import("react/jsx-runtime").JSX.Element;
6
+ export declare function ColumnBooleanFormatter<TRow>(props: ColumnBooleanFormatterProps<TRow>): (renderProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { getPropertyByString } from "@m4l/core";
3
3
  import React from "react";
4
- import { g as getFieldValueWithRow } from "../../../../helpers/getFieldValueWithRow.js";
5
4
  import { B as BooleanFormatter } from "../../../formatters/BooleanFormatter/BooleanFormatter.js";
6
5
  function ColumnBooleanFormatter(props) {
7
6
  const { fieldValue, presentationType, Component = React.Fragment } = props;
8
- return (obProps) => {
9
- const valueMaybeString = getPropertyByString(obProps, getFieldValueWithRow(fieldValue));
7
+ return (renderProps) => {
8
+ const valueMaybeString = getPropertyByString(renderProps.row, fieldValue);
10
9
  let fixedValue;
11
10
  if (typeof valueMaybeString === "boolean") {
12
11
  fixedValue = valueMaybeString;
@@ -3,7 +3,7 @@ import { ColumnBooleanFormatterProps } from './types';
3
3
  * Hook function that return the formatter, filter and customSort for a boolean column
4
4
  */
5
5
  export declare const useColumnBoolean: <TRow>(props: ColumnBooleanFormatterProps<TRow>) => {
6
- formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
6
+ formatter: (renderProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
7
7
  customFilter: (row: TRow, value: string) => boolean;
8
8
  customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
9
9
  };
@@ -1,7 +1,8 @@
1
1
  import { ColumnChipStatusFormatterProps } from './types';
2
+ import { RenderCellProps } from 'react-data-grid';
2
3
  /**
3
4
  * Formatter para mostrar un chip de estado en una columna de un DataGrid
4
5
  * @param props - Propiedades del formatter
5
6
  * @returns Componente ChipStatusFormatter
6
7
  */
7
- export declare const ColumnChipStatusFormatter: (props: ColumnChipStatusFormatterProps<any>) => (obProps: any) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const ColumnChipStatusFormatter: <TRow>(props: ColumnChipStatusFormatterProps<TRow>) => (renderProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,15 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { getPropertyByString } from "@m4l/core";
3
- import { g as getFieldValueWithRow } from "../../../../helpers/getFieldValueWithRow.js";
4
3
  import { C as ChipStatusFormatterColumnWrapperStyled } from "../../../formatters/ChipStatusFormatter/slots/ChipStatusFormatterSlots.js";
5
4
  import { g as getNullGuard } from "../../../../utils/getNullGuard.js";
6
5
  import { C as ChipStatusFormatter } from "../../../formatters/ChipStatusFormatter/ChipStatusFormatter.js";
7
6
  const ColumnChipStatusFormatter = (props) => {
8
7
  const { fieldStatus, fieldLabel, statusesColors, fallbackColor } = props;
9
- return (obProps) => {
10
- const status = getNullGuard(getPropertyByString(obProps, getFieldValueWithRow(fieldStatus.toString())));
11
- const label = typeof fieldLabel === "string" ? getNullGuard(getPropertyByString(obProps, getFieldValueWithRow(fieldLabel))) : fieldLabel(obProps.row, status);
8
+ return (renderProps) => {
9
+ const cleanFieldStatus = fieldStatus.toString().startsWith("row.") ? fieldStatus.toString().substring(4) : fieldStatus.toString();
10
+ const cleanFieldLabel = typeof fieldLabel === "string" && fieldLabel.startsWith("row.") ? fieldLabel.substring(4) : fieldLabel;
11
+ const status = getNullGuard(getPropertyByString(renderProps.row, cleanFieldStatus));
12
+ const label = typeof cleanFieldLabel === "string" ? getNullGuard(getPropertyByString(renderProps.row, cleanFieldLabel)) : typeof fieldLabel === "function" ? fieldLabel(renderProps.row, status) : "";
12
13
  return /* @__PURE__ */ jsx(
13
14
  ChipStatusFormatter,
14
15
  {
@@ -3,7 +3,7 @@ import { ColumnChipStatusFormatterProps } from './types';
3
3
  * Funcion helper que retorna el formatter, filter y customSort de la columna concatenada.
4
4
  */
5
5
  export declare const useColumnChipStatus: <TRow>(props: ColumnChipStatusFormatterProps<TRow>) => {
6
- formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
6
+ formatter: (renderProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
7
7
  customFilter: (row: TRow, value: string | number) => boolean;
8
8
  customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
9
9
  };
@@ -1,5 +1,6 @@
1
1
  import { ColumnConcatenatedValuesFormatterProps } from './types';
2
+ import { RenderCellProps } from 'react-data-grid';
2
3
  /**
3
4
  * Function to DataGrid that concatenates an array of strings
4
5
  */
5
- export declare function ColumnConcatenatedValuesFormatter<TRow>(props: ColumnConcatenatedValuesFormatterProps<TRow>): (obProps: any) => import("react/jsx-runtime").JSX.Element;
6
+ export declare function ColumnConcatenatedValuesFormatter<TRow>(props: ColumnConcatenatedValuesFormatterProps<TRow>): (renderProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
@@ -1,13 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { getPropertyByString } from "@m4l/core";
3
3
  import React from "react";
4
- import { g as getFieldValueWithRow } from "../../../../helpers/getFieldValueWithRow.js";
5
4
  import { C as ConcatenatedFormatter } from "../../../formatters/ConcatenatedFormatter/ConcatenatedFormatter.js";
6
5
  function ColumnConcatenatedValuesFormatter(props) {
7
6
  const { fieldValue, fieldSeparator, Component = React.Fragment } = props;
8
- return (obProps) => {
7
+ return (renderProps) => {
8
+ const rowData = renderProps.row;
9
9
  const values = fieldValue.map((element) => {
10
- const valueMaybeString = getPropertyByString(obProps, getFieldValueWithRow(element));
10
+ const valueMaybeString = getPropertyByString(rowData, element);
11
11
  let fixedValue;
12
12
  if (typeof valueMaybeString === "string" || typeof valueMaybeString === "number") {
13
13
  fixedValue = valueMaybeString.toString();
@@ -16,7 +16,14 @@ function ColumnConcatenatedValuesFormatter(props) {
16
16
  }
17
17
  return fixedValue;
18
18
  });
19
- return /* @__PURE__ */ jsx(ConcatenatedFormatter, { values, separator: fieldSeparator, Component });
19
+ return /* @__PURE__ */ jsx(
20
+ ConcatenatedFormatter,
21
+ {
22
+ values,
23
+ separator: fieldSeparator,
24
+ Component
25
+ }
26
+ );
20
27
  };
21
28
  }
22
29
  export {
@@ -3,7 +3,7 @@ import { ColumnConcatenatedValuesFormatterProps } from './types';
3
3
  * Funcion helper que retorna el formatter, filter y customSort de la columna concatenada.
4
4
  */
5
5
  export declare const useColumnConcatenatedValues: <TRow>(props: ColumnConcatenatedValuesFormatterProps<TRow>) => {
6
- formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
6
+ formatter: (renderProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
7
7
  customFilter: (row: TRow, value: string) => boolean;
8
8
  customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
9
9
  };
@@ -1,5 +1,6 @@
1
1
  import { ColumnDateFormatterProps } from './types';
2
+ import { RenderCellProps } from 'react-data-grid';
2
3
  /**
3
4
  * Function to format a date in a column of a DataGrid
4
5
  */
5
- export declare function ColumnDateFormatter<TRow>(props: ColumnDateFormatterProps<TRow>): (obProps: any) => import("react/jsx-runtime").JSX.Element;
6
+ export declare function ColumnDateFormatter<TRow>(props: ColumnDateFormatterProps<TRow>): (formatterProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
@@ -1,19 +1,28 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { getPropertyByString } from "@m4l/core";
3
3
  import React from "react";
4
- import { g as getFieldValueWithRow } from "../../../../helpers/getFieldValueWithRow.js";
5
4
  import { D as DateFormatter } from "../../../formatters/DateFormatter/DateFormatter.js";
6
5
  function ColumnDateFormatter(props) {
7
6
  const { fieldValue, presentationType, Component = React.Fragment } = props;
8
- return (obProps) => {
9
- const valueMaybeDateStringNumber = getPropertyByString(obProps, getFieldValueWithRow(fieldValue));
7
+ return (formatterProps) => {
8
+ const valueMaybeDateStringNumber = getPropertyByString(
9
+ formatterProps.row,
10
+ fieldValue
11
+ );
10
12
  let fixedValue;
11
13
  if (typeof valueMaybeDateStringNumber === "string" || typeof valueMaybeDateStringNumber === "number" || valueMaybeDateStringNumber instanceof Date) {
12
14
  fixedValue = valueMaybeDateStringNumber;
13
15
  } else {
14
16
  fixedValue = "";
15
17
  }
16
- return /* @__PURE__ */ jsx(DateFormatter, { presentationType, value: fixedValue, Component });
18
+ return /* @__PURE__ */ jsx(
19
+ DateFormatter,
20
+ {
21
+ presentationType,
22
+ value: fixedValue,
23
+ Component
24
+ }
25
+ );
17
26
  };
18
27
  }
19
28
  export {
@@ -8,7 +8,7 @@ export declare const useCustomDateFilter: <TRow>(props: ColumnDateFormatterProps
8
8
  * customFilter and customSort of a date column
9
9
  */
10
10
  export declare const useColumnDate: <TRow>(props: ColumnDateFormatterProps<TRow>) => {
11
- formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
11
+ formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
12
12
  customFilter: (row: TRow, value: string) => boolean;
13
13
  customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
14
14
  };
@@ -1,6 +1,7 @@
1
1
  import { ColumnIconFormatterProps } from './types';
2
+ import { RenderCellProps } from 'react-data-grid';
2
3
  /**
3
4
  * Function to format an icon in a column of a DataGrid
4
5
  * @template TRow - Tipo de datos de la fila
5
6
  */
6
- export declare function ColumnIconFormatter<TRow>(props: ColumnIconFormatterProps<TRow>): (rowData: TRow) => JSX.Element;
7
+ export declare function ColumnIconFormatter<TRow>(props: ColumnIconFormatterProps<TRow>): (renderProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
@@ -2,8 +2,8 @@ import { r as renderMultipleIcons } from "./helpers/renderMultipleIcons.js";
2
2
  import { r as renderIcon } from "./helpers/renderIcon.js";
3
3
  function ColumnIconFormatter(props) {
4
4
  const { getIconProps } = props;
5
- return (rowData) => {
6
- const iconProps = getIconProps(rowData);
5
+ return (renderProps) => {
6
+ const iconProps = getIconProps(renderProps.row);
7
7
  if (Array.isArray(iconProps)) {
8
8
  return renderMultipleIcons(iconProps);
9
9
  }
@@ -4,5 +4,5 @@ import { ColumnIconFormatterProps } from './types';
4
4
  * el formatter de la columna
5
5
  */
6
6
  export declare const useColumnIcon: <TRow>(props: ColumnIconFormatterProps<TRow>) => {
7
- formatter: (rowData: TRow) => JSX.Element;
7
+ formatter: (renderProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
8
8
  };
@@ -1,2 +1,2 @@
1
- import { FormatterProps as RDGFormatterProps } from 'react-data-grid';
2
- export type ColumnInteractiveCheckFormatterProps<Row> = RDGFormatterProps<Row>;
1
+ import { RenderCellProps } from 'react-data-grid';
2
+ export type ColumnInteractiveCheckFormatterProps<Row> = RenderCellProps<Row>;
@@ -1,5 +1,6 @@
1
1
  import { ColumnNestedValueFormatterProps } from './types';
2
+ import { RenderCellProps } from 'react-data-grid';
2
3
  /**
3
4
  * Function to format a nested value in a column of a DataGrid
4
5
  */
5
- export declare function ColumnNestedValueFormatter<TRow>(props: ColumnNestedValueFormatterProps<TRow>): (obProps: any) => import("react/jsx-runtime").JSX.Element;
6
+ export declare function ColumnNestedValueFormatter<TRow>(props: ColumnNestedValueFormatterProps<TRow>): (formatterProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { getPropertyByString } from "@m4l/core";
3
3
  import React from "react";
4
- import { g as getFieldValueWithRow } from "../../../../helpers/getFieldValueWithRow.js";
5
4
  import { g as getNullGuard } from "../../../../utils/getNullGuard.js";
6
5
  function ColumnNestedValueFormatter(props) {
7
6
  const { fieldValue, Component = React.Fragment } = props;
8
- return (obProps) => {
9
- const property = getNullGuard(getPropertyByString(obProps, getFieldValueWithRow(fieldValue)));
7
+ return (formatterProps) => {
8
+ const property = getNullGuard(
9
+ getPropertyByString(formatterProps.row, fieldValue)
10
+ );
10
11
  const value = typeof property === "object" ? JSON.stringify(property) : property;
11
12
  return /* @__PURE__ */ jsx(Component, { children: value });
12
13
  };
@@ -4,7 +4,7 @@ import { ColumnNestedValueFormatterProps } from './types';
4
4
  * of the column for ColumnNestedValueFormatter.
5
5
  */
6
6
  export declare const useColumnNestedValue: <TRow>(props: ColumnNestedValueFormatterProps<TRow>) => {
7
- formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
7
+ formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
8
8
  customFilter: (row: TRow, value: string) => any;
9
9
  customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
10
10
  };
@@ -1,5 +1,6 @@
1
1
  import { ColumnPointsFormatterProps } from './types';
2
+ import { RenderCellProps } from 'react-data-grid';
2
3
  /**
3
4
  * Formatter for column points in DataGrid
4
5
  */
5
- export declare function ColumnPointsFormatter<TRow>(props: ColumnPointsFormatterProps<TRow>): (obProps: any) => import("react/jsx-runtime").JSX.Element;
6
+ export declare function ColumnPointsFormatter<TRow>(props: ColumnPointsFormatterProps<TRow>): (formatterProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
@@ -1,13 +1,21 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import React from "react";
3
3
  import { P as PointsFormatter } from "../../../formatters/PointsFormatter/PointsFormatter.js";
4
- import { g as getFieldValueWithRow } from "../../../../helpers/getFieldValueWithRow.js";
5
4
  function ColumnPointsFormatter(props) {
6
5
  const { Component = React.Fragment } = props;
7
- const fieldValue = getFieldValueWithRow(props.fieldValue);
8
- const fieldUnit = getFieldValueWithRow(props.fieldUnit);
9
- return (obProps) => {
10
- return /* @__PURE__ */ jsx(PointsFormatter, { obProps, ...props, fieldValue, fieldUnit, Component });
6
+ const fieldValue = props.fieldValue;
7
+ const fieldUnit = props.fieldUnit;
8
+ return (formatterProps) => {
9
+ return /* @__PURE__ */ jsx(
10
+ PointsFormatter,
11
+ {
12
+ obProps: formatterProps.row,
13
+ ...props,
14
+ fieldValue,
15
+ fieldUnit,
16
+ Component
17
+ }
18
+ );
11
19
  };
12
20
  }
13
21
  export {
@@ -4,7 +4,7 @@ import { ColumnPointsFormatterProps } from './types';
4
4
  * return formatter, customFilter and customSort.
5
5
  */
6
6
  export declare const useColumnPoints: <TRow>(props: ColumnPointsFormatterProps<TRow>) => {
7
- formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
7
+ formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
8
8
  customFilter: (row: TRow, value: string) => boolean;
9
9
  customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
10
10
  };
@@ -1,5 +1,6 @@
1
1
  import { ColumnPriceFormatterProps } from './types';
2
+ import { RenderCellProps } from 'react-data-grid';
2
3
  /**
3
4
  * Formatter for column price in DataGrid
4
5
  */
5
- export declare function ColumnPriceFormatter<TRow>(props: ColumnPriceFormatterProps<TRow>): (obProps: any) => import("react/jsx-runtime").JSX.Element;
6
+ export declare function ColumnPriceFormatter<TRow>(props: ColumnPriceFormatterProps<TRow>): (formatterProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,19 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import React from "react";
3
3
  import { P as PriceFormatter } from "../../../formatters/PriceFormatter/PriceFormatter.js";
4
- import { g as getFieldValueWithRow } from "../../../../helpers/getFieldValueWithRow.js";
5
4
  function ColumnPriceFormatter(props) {
6
5
  const { Component = React.Fragment } = props;
7
- const fieldValue = getFieldValueWithRow(props.fieldValue);
8
- return (obProps) => {
9
- return /* @__PURE__ */ jsx(PriceFormatter, { obProps, ...props, fieldValue, Component });
6
+ const fieldValue = props.fieldValue;
7
+ return (formatterProps) => {
8
+ return /* @__PURE__ */ jsx(
9
+ PriceFormatter,
10
+ {
11
+ obProps: formatterProps.row,
12
+ ...props,
13
+ fieldValue,
14
+ Component
15
+ }
16
+ );
10
17
  };
11
18
  }
12
19
  export {
@@ -4,7 +4,7 @@ import { ColumnPriceFormatterProps } from './types';
4
4
  * Returns formatter, customFilter and customSort.
5
5
  */
6
6
  export declare const useColumnPrice: <TRow>(props: ColumnPriceFormatterProps<TRow>) => {
7
- formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
7
+ formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
8
8
  customFilter: (row: TRow, value: string) => boolean;
9
9
  customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
10
10
  };
@@ -1,4 +1,4 @@
1
- import { FormatterProps } from 'react-data-grid';
1
+ import { RenderCellProps } from 'react-data-grid';
2
2
  import { ColumnSetCheckFormatterProps } from './types';
3
3
  import { RowKey } from '../../types';
4
4
  /**
@@ -6,4 +6,4 @@ import { RowKey } from '../../types';
6
6
  * acualizando un Set/Setter por medio de un hook generico el cual es invocado con el argumento field para ,
7
7
  * sin la necesidad de entrar en edición como lo hace un editor
8
8
  */
9
- export declare function ColumnSetCheckFormatter<Row, TKey extends RowKey = RowKey>(parameters: ColumnSetCheckFormatterProps<Row, TKey>): (props: FormatterProps<Row>) => import("react/jsx-runtime").JSX.Element;
9
+ export declare function ColumnSetCheckFormatter<Row, TKey extends RowKey = RowKey>(parameters: ColumnSetCheckFormatterProps<Row, TKey>): (props: RenderCellProps<Row>) => import("react/jsx-runtime").JSX.Element;
@@ -23,7 +23,7 @@ function ColumnSetCheckFormatter(parameters) {
23
23
  {
24
24
  value: checkedRows.has(rowKeyGetter(row)) || false,
25
25
  disabled,
26
- isCellSelected: props.isCellSelected,
26
+ tabIndex: props.tabIndex,
27
27
  onChange,
28
28
  "aria-label": "Select"
29
29
  }
@@ -5,7 +5,7 @@ import { ColumnSetCheckFormatterProps } from './types';
5
5
  * Returns formatter, customFilter and customSort.
6
6
  */
7
7
  export declare const useColumnSetCheck: <TRow, TKey extends RowKey = RowKey>(props: ColumnSetCheckFormatterProps<TRow, TKey>) => {
8
- formatter: (props: import('react-data-grid').FormatterProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
8
+ formatter: (props: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
9
9
  customFilter: (row: TRow, value: TKey) => boolean;
10
10
  customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
11
11
  };
@@ -1,5 +1,6 @@
1
1
  import { ColumnUncertaintyFormatterProps } from './types';
2
+ import { RenderCellProps } from 'react-data-grid';
2
3
  /**
3
4
  * Formatter for column uncertainty in DataGrid
4
5
  */
5
- export declare function ColumnUncertaintyFormatter<TRow>(props: ColumnUncertaintyFormatterProps<TRow>): (obProps: any) => import("react/jsx-runtime").JSX.Element;
6
+ export declare function ColumnUncertaintyFormatter<TRow>(props: ColumnUncertaintyFormatterProps<TRow>): (formatterProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,23 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import React from "react";
3
- import { g as getFieldValueWithRow } from "../../../../helpers/getFieldValueWithRow.js";
4
3
  import { U as UncertaintyFormatter } from "../../../formatters/UncertaintyFormatter/UncertaintyFormatter.js";
5
4
  function ColumnUncertaintyFormatter(props) {
6
5
  const { Component = React.Fragment } = props;
7
- const fieldValue = getFieldValueWithRow(props.fieldValue);
8
- const fieldSymbol = getFieldValueWithRow(props.fieldSymbol);
9
- const fieldUnit = getFieldValueWithRow(props.fieldUnit);
10
- return (obProps) => {
11
- return /* @__PURE__ */ jsx(UncertaintyFormatter, { obProps, ...props, fieldValue, fieldSymbol, fieldUnit, Component });
6
+ const fieldValue = props.fieldValue;
7
+ const fieldSymbol = props.fieldSymbol;
8
+ const fieldUnit = props.fieldUnit;
9
+ return (formatterProps) => {
10
+ return /* @__PURE__ */ jsx(
11
+ UncertaintyFormatter,
12
+ {
13
+ obProps: formatterProps.row,
14
+ ...props,
15
+ fieldValue,
16
+ fieldSymbol,
17
+ fieldUnit,
18
+ Component
19
+ }
20
+ );
12
21
  };
13
22
  }
14
23
  export {
@@ -4,7 +4,7 @@ import { ColumnUncertaintyFormatterProps } from './types';
4
4
  * the filter and the customSort of the uncertainty column.
5
5
  */
6
6
  export declare const useColumnUncertanity: <TRow>(props: ColumnUncertaintyFormatterProps<TRow>) => {
7
- formatter: (obProps: any) => import("react/jsx-runtime").JSX.Element;
7
+ formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
8
8
  customFilter: (row: TRow, value: string) => boolean;
9
9
  customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
10
10
  };
@@ -1,6 +1,6 @@
1
1
  export { DataGrid } from './DataGrid';
2
2
  export * from './formatters';
3
- export type { Column, EditorProps, FormatterProps } from 'react-data-grid';
3
+ export type { Column, RenderEditCellProps, RenderCellProps } from 'react-data-grid';
4
4
  export type { RowKey, ChangeUserColumn } from './types';
5
5
  export { getDataGridComponentsDictionary } from './dictionary';
6
6
  export { TextEditor, NumberEditor } from './subcomponents/editors/TextEditor';
@@ -62,7 +62,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
62
62
  name: getLabel(DICTIONARY.SETTINGS_COLUMN_VISIBLE),
63
63
  width: 80,
64
64
  type: "boolean",
65
- formatter: ColumnInteractiveCheckFormatter,
65
+ renderCell: ColumnInteractiveCheckFormatter,
66
66
  ...getAlignClass("center")
67
67
  },
68
68
  {
@@ -70,7 +70,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
70
70
  name: getLabel(DICTIONARY.SETTINGS_COLUMNS_FROZEN),
71
71
  width: 80,
72
72
  type: "boolean",
73
- formatter: ColumnInteractiveCheckFormatter,
73
+ renderCell: ColumnInteractiveCheckFormatter,
74
74
  ...getAlignClass("center")
75
75
  }
76
76
  ],
@@ -176,7 +176,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
176
176
  const onInternalRowsChange = (newRows) => {
177
177
  setRows(newRows);
178
178
  };
179
- const onRowClick = (row) => {
179
+ const onCellClick = ({ row }) => {
180
180
  if (selRows.has(row.key)) {
181
181
  return;
182
182
  }
@@ -196,9 +196,8 @@ const ColumnsConfig = forwardRef((props, ref) => {
196
196
  onRowsChange: onInternalRowsChange,
197
197
  selectedRows: selRows,
198
198
  onSelectedRowsChange: onInternalSelectedRowsChange,
199
- onRowClick,
199
+ onCellClick,
200
200
  rowKeyGetter: (row) => row.key,
201
- cellNavigationMode: "CHANGE_ROW",
202
201
  defaultColumnOptions: { resizable: true, sortable: true }
203
202
  }
204
203
  ) })
@@ -1,9 +1,9 @@
1
1
  import { FunctionComponent } from 'react';
2
- import { HeaderRendererProps } from 'react-data-grid';
2
+ import { RenderHeaderCellProps } from 'react-data-grid';
3
3
  /**
4
4
  * Función encargada de retornar el componente de renderizado de cabecera con la capacidad de arrastrar columnas
5
5
  * @param handleColumnsReorder - Función que se ejecuta al reordenar columnas
6
6
  */
7
7
  export declare const getDragHeaderRenderer: <TRow, TSummaryRow>(handleColumnsReorder: (sourceKey: string, targetKey: string) => void, options?: {
8
8
  openPopover?: (anchorEl: HTMLElement, columnKey: string) => void;
9
- }) => FunctionComponent<HeaderRendererProps<TRow, TSummaryRow>>;
9
+ }) => FunctionComponent<RenderHeaderCellProps<TRow, TSummaryRow>>;
@@ -1,6 +1,6 @@
1
- import { Column } from 'react-data-grid';
1
+ import { Column, SortColumn } from 'react-data-grid';
2
2
  import { MenuAction } from '../subcomponents/HeaderRenderClick/types';
3
3
  /**
4
4
  * Función que retorna las acciones del menu del header de la columna
5
5
  */
6
- export declare function useHeaderMenuActions<Trow, TSummaryRow>(columnKey: string | null, finalColumns: readonly Column<Trow, TSummaryRow>[], defaultSortable: boolean): MenuAction[];
6
+ export declare function useHeaderMenuActions<Trow, TSummaryRow>(columnKey: string | null, finalColumns: readonly Column<Trow, TSummaryRow>[], defaultSortable: boolean, handleSortFromPopover?: (newSortColumns: SortColumn[]) => void): MenuAction[];
@@ -3,7 +3,7 @@ import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
3
3
  import { useEnvironment, useModuleDictionary } from "@m4l/core";
4
4
  import { D as DICTIONARY } from "../../../dictionary.js";
5
5
  import { p as pathIcons } from "../../../icons.js";
6
- function useHeaderMenuActions(columnKey, finalColumns, defaultSortable) {
6
+ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable, handleSortFromPopover) {
7
7
  const {
8
8
  columnsConfig,
9
9
  onChangeColumnsConfig,
@@ -14,6 +14,13 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable) {
14
14
  } = useDataGrid();
15
15
  const { host_static_assets, environment_assets } = useEnvironment();
16
16
  const { getLabel } = useModuleDictionary();
17
+ const executeSortChange = (newSortColumns) => {
18
+ if (handleSortFromPopover) {
19
+ handleSortFromPopover(newSortColumns);
20
+ } else {
21
+ setSortColumns(newSortColumns);
22
+ }
23
+ };
17
24
  const column = useMemo(() => {
18
25
  return finalColumns.find((c) => c.key === columnKey);
19
26
  }, [columnKey, finalColumns]);
@@ -66,8 +73,9 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable) {
66
73
  if (!columnKey) {
67
74
  return;
68
75
  }
69
- setSortColumns((prev) => prev.filter((s) => s.columnKey !== columnKey));
70
- }, [columnKey, setSortColumns]);
76
+ const newSortColumns = sortColumns.filter((s) => s.columnKey !== columnKey);
77
+ executeSortChange(newSortColumns);
78
+ }, [columnKey, sortColumns, executeSortChange]);
71
79
  const hasAnySortApplied = useMemo(() => {
72
80
  return Boolean(currentSort);
73
81
  }, [currentSort]);
@@ -153,7 +161,7 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable) {
153
161
  if (externalSortSettings) {
154
162
  addExternalSort("asc");
155
163
  } else {
156
- setSortColumns([
164
+ executeSortChange([
157
165
  {
158
166
  columnKey,
159
167
  direction: "ASC"
@@ -175,7 +183,7 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable) {
175
183
  if (externalSortSettings) {
176
184
  addExternalSort("desc");
177
185
  } else {
178
- setSortColumns([
186
+ executeSortChange([
179
187
  {
180
188
  columnKey,
181
189
  direction: "DESC"
@@ -255,7 +263,8 @@ function useHeaderMenuActions(columnKey, finalColumns, defaultSortable) {
255
263
  host_static_assets,
256
264
  environment_assets,
257
265
  getLabel,
258
- isAddFilterDisabled
266
+ isAddFilterDisabled,
267
+ executeSortChange
259
268
  ]);
260
269
  }
261
270
  export {
@@ -137,16 +137,20 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
137
137
  return newColumn;
138
138
  }
139
139
  if (isSkeleton) {
140
- newColumn.headerRenderer = SkeletonFormatter;
141
- newColumn.formatter = SkeletonFormatter;
140
+ newColumn.renderHeaderCell = SkeletonFormatter;
141
+ newColumn.renderCell = SkeletonFormatter;
142
+ } else {
143
+ if (newColumn.formatter && !newColumn.renderCell) {
144
+ newColumn.renderCell = newColumn.formatter;
145
+ }
142
146
  }
143
- if (newColumn.headerRenderer) {
144
- newColumn.withinHeaderRenderer = newColumn.headerRenderer;
147
+ if (newColumn.renderHeaderCell) {
148
+ newColumn.withinHeaderRenderer = newColumn.renderHeaderCell;
145
149
  }
146
150
  if ((newColumn?.withFilter === void 0 || newColumn.withFilter === true) && activeFilters) {
147
151
  newColumn.headerCellClass = `${newColumn.headerCellClass} ${filterColumnClassName}`.trim();
148
152
  }
149
- newColumn.headerRenderer = DragAndDropHeaderRenderer;
153
+ newColumn.renderHeaderCell = DragAndDropHeaderRenderer;
150
154
  return newColumn;
151
155
  });
152
156
  }, [
@@ -1,5 +1,7 @@
1
+ import { DataGridProps } from 'react-data-grid';
1
2
  import { GridProps, RowKey } from '../../types';
2
3
  /**
3
4
  * Componente que renderiza la tabla con las filas y columnas
5
+ * Acepta todos los props de DataGrid y prioriza las configuraciones personalizadas
4
6
  */
5
- export declare function Table<TRow, TSummaryRow, TKey extends RowKey = RowKey>(props: GridProps<TRow, TSummaryRow, TKey>): import("react/jsx-runtime").JSX.Element;
7
+ export declare function Table<TRow, TSummaryRow, TKey extends RowKey = RowKey>(props: GridProps<TRow, TSummaryRow, TKey> & Omit<DataGridProps<TRow, TSummaryRow>, keyof GridProps<TRow, TSummaryRow, TKey>>): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useMemo, useState, useRef, useEffect } from "react";
3
3
  import DataGrid from "react-data-grid";
4
+ import "react-data-grid/lib/styles.css";
4
5
  import { DndProvider } from "react-dnd";
5
6
  import { HTML5Backend } from "react-dnd-html5-backend";
6
7
  import { C as CheckboxFormatter } from "./subcomponents/CheckboxFormatter.js";
@@ -18,8 +19,19 @@ function Table(props) {
18
19
  onRowsChange,
19
20
  rowKeyGetter,
20
21
  selectedRows,
21
- onSelectedRowsChange
22
+ onSelectedRowsChange,
23
+ defaultColumnOptions: defaultColumnOptionsProp,
24
+ ...restProps
22
25
  } = props;
26
+ const renderCheckbox = (formatterProps) => {
27
+ return /* @__PURE__ */ jsx(
28
+ CheckboxFormatter,
29
+ {
30
+ ...formatterProps,
31
+ tabIndex: formatterProps.tabIndex
32
+ }
33
+ );
34
+ };
23
35
  const { finalColumns, finalRows } = useSortColumnsRows(
24
36
  columns,
25
37
  rows,
@@ -55,7 +67,18 @@ function Table(props) {
55
67
  anchorEl: null,
56
68
  columnKey: null
57
69
  });
58
- const onRowClick = (row) => {
70
+ const [allowSortChange, setAllowSortChange] = useState(false);
71
+ const handleSortColumnsChange = (newSortColumns) => {
72
+ if (allowSortChange) {
73
+ setSortColumns(newSortColumns);
74
+ setAllowSortChange(false);
75
+ }
76
+ };
77
+ const handleSortFromPopover = (newSortColumns) => {
78
+ setAllowSortChange(true);
79
+ setSortColumns(newSortColumns);
80
+ };
81
+ const onCellClick = ({ row }) => {
59
82
  if (selectedRows && onSelectedRowsChange) {
60
83
  if (selectedRows.entries().next().value) {
61
84
  if (selectedRows.entries().next().value?.[1] === rowKeyGetter(row)) {
@@ -90,11 +113,16 @@ function Table(props) {
90
113
  const onColumnResize = (idx, width) => {
91
114
  onChangeColumnWidth(finalColumns[idx].key, width);
92
115
  };
93
- const defaultColumnOptions = { resizable: true, sortable: true };
116
+ const defaultColumnOptions = {
117
+ resizable: true,
118
+ sortable: true,
119
+ ...defaultColumnOptionsProp || {}
120
+ };
94
121
  const menuActions = useHeaderMenuActions(
95
122
  popoverState.columnKey,
96
123
  finalColumns,
97
- defaultColumnOptions.sortable
124
+ Boolean(defaultColumnOptions.sortable),
125
+ handleSortFromPopover
98
126
  );
99
127
  return /* @__PURE__ */ jsx(TableContainerStyled, { id: "WrapperTable", children: /* @__PURE__ */ jsxs(TableWrapperDataGridStyled, { ownerState: { size }, children: [
100
128
  /* @__PURE__ */ jsx(DndProvider, { backend: HTML5Backend, context: window, children: /* @__PURE__ */ jsx(
@@ -105,18 +133,20 @@ function Table(props) {
105
133
  headerRowHeight: activeFilters ? currentRowHeaderHeight + filterHeight : currentRowHeaderHeight,
106
134
  columns: finalColumns,
107
135
  sortColumns,
108
- onSortColumnsChange: setSortColumns,
136
+ onSortColumnsChange: handleSortColumnsChange,
109
137
  onColumnResize,
110
138
  rows: finalRows,
111
139
  onRowsChange,
112
140
  selectedRows,
113
141
  onSelectedRowsChange,
114
- onRowClick,
142
+ onCellClick,
115
143
  rowHeight: currentRowHeight,
116
144
  rowKeyGetter,
117
- cellNavigationMode: "LOOP_OVER_ROW",
118
- components: { checkboxFormatter: CheckboxFormatter },
119
- defaultColumnOptions
145
+ renderers: {
146
+ renderCheckbox
147
+ },
148
+ defaultColumnOptions,
149
+ ...restProps
120
150
  }
121
151
  ) }),
122
152
  popoverState.columnKey && popoverState.anchorEl instanceof HTMLDivElement && /* @__PURE__ */ jsx(
@@ -35,7 +35,7 @@ const ActionsColumn = {
35
35
  sortable: false,
36
36
  frozen: true,
37
37
  type: "custom",
38
- formatter: ActionsFormatter
38
+ renderCell: ActionsFormatter
39
39
  };
40
40
  function getActionLabel() {
41
41
  return "";
@@ -1,2 +1,2 @@
1
- import { CheckboxFormatterProps } from 'react-data-grid';
2
- export declare const CheckboxFormatter: import('react').ForwardRefExoticComponent<CheckboxFormatterProps & import('react').RefAttributes<HTMLInputElement>>;
1
+ import { RenderCheckboxProps } from 'react-data-grid';
2
+ export declare const CheckboxFormatter: import('react').ForwardRefExoticComponent<RenderCheckboxProps & import('react').RefAttributes<HTMLInputElement>>;
@@ -1,5 +1,5 @@
1
- import { HeaderRendererProps } from 'react-data-grid';
2
- interface DraggableHeaderRendererProps<TRow> extends HeaderRendererProps<TRow> {
1
+ import { RenderHeaderCellProps } from 'react-data-grid';
2
+ interface DraggableHeaderRendererProps<TRow> extends RenderHeaderCellProps<TRow> {
3
3
  onColumnsReorder: (sourceKey: string, targetKey: string) => void;
4
4
  openPopover?: (anchorEl: HTMLElement, columnKey: string) => void;
5
5
  }
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
3
  import { useModuleDictionary, useEnvironment } from "@m4l/core";
4
4
  import { useDrag, useDrop } from "react-dnd";
5
- import { HeaderRenderer } from "react-data-grid";
5
+ import { renderHeaderCell } from "react-data-grid";
6
6
  import { u as useFocusRef } from "../hooks/useFocusRef.js";
7
7
  import { u as useFilters } from "../../../hooks/useFilters.js";
8
8
  import { N as NameColumnIconStyled, n as NameColumnStyled, I as IconColumnStyled, o as DraggableHeaderRootStyled, B as ButtonHeaderActionsStyled, p as DraggableWrapperInputBaseStyled, q as IconSearchStyled, H as HeaderInputBaseStyled } from "../../../slots/DataGridSlot.js";
@@ -13,12 +13,13 @@ function DraggableHeaderRenderer(props) {
13
13
  const {
14
14
  onColumnsReorder,
15
15
  column,
16
- isCellSelected,
16
+ tabIndex: headerTabIndex,
17
17
  openPopover,
18
- onSort,
19
18
  ...others
20
19
  } = props;
21
- const { ref, tabIndex } = useFocusRef(isCellSelected);
20
+ const { ref, tabIndex } = useFocusRef(
21
+ headerTabIndex !== void 0 && headerTabIndex >= 0
22
+ );
22
23
  const { getLabel } = useModuleDictionary();
23
24
  const { size, classes, externalSortSettings, externalFilterSettings } = useDataGrid();
24
25
  const { host_static_assets, environment_assets } = useEnvironment();
@@ -133,6 +134,9 @@ function DraggableHeaderRenderer(props) {
133
134
  opacity: isDragging ? 0.5 : 1,
134
135
  backgroundColor: isOver ? "#ececec" : void 0
135
136
  },
137
+ onClick: (e) => {
138
+ e.stopPropagation();
139
+ },
136
140
  children: [
137
141
  /* @__PURE__ */ jsx(
138
142
  ButtonHeaderActionsStyled,
@@ -143,12 +147,10 @@ function DraggableHeaderRenderer(props) {
143
147
  openPopover?.(e.currentTarget, column.key);
144
148
  },
145
149
  children: /* @__PURE__ */ jsx(
146
- HeaderRenderer,
150
+ renderHeaderCell,
147
151
  {
148
152
  column: newColumn,
149
- isCellSelected,
150
- onSort: () => {
151
- },
153
+ tabIndex: headerTabIndex,
152
154
  ...others
153
155
  }
154
156
  )
@@ -128,7 +128,7 @@ function HeaderRenderClick(props) {
128
128
  paper: {
129
129
  ...paperProps,
130
130
  sx: {
131
- mt: !activeFilters ? 0.3 : 6.5,
131
+ mt: !activeFilters ? 0.3 : 5.6,
132
132
  ...paperProps?.sx
133
133
  }
134
134
  }
@@ -5,13 +5,13 @@ import { d as DATAGRID_SELECT_COLUMN_KEY } from "../../../constants.js";
5
5
  const filterColumnClassName = "filter-cell";
6
6
  const filterHeight = 35;
7
7
  function SelectGroupFormatter(props) {
8
- const [isRowSelected, onRowSelectionChange] = useRowSelection();
8
+ const { isRowSelected, onRowSelectionChange } = useRowSelection();
9
9
  const onChange = (checked) => {
10
10
  onRowSelectionChange({ row: props.row, checked, isShiftClick: false });
11
11
  };
12
12
  const cellFormater = SelectCellFormatter({
13
13
  value: isRowSelected,
14
- isCellSelected: props.isCellSelected,
14
+ tabIndex: props.tabIndex,
15
15
  onChange,
16
16
  "aria-label": "Select Group"
17
17
  });
@@ -32,7 +32,7 @@ function SelectFormatter(props) {
32
32
  SelectCellFormatter,
33
33
  {
34
34
  value: checkedRows?.has(rowKeyGetter(props.row)) || false,
35
- isCellSelected: props.isCellSelected,
35
+ tabIndex: props.tabIndex,
36
36
  onChange,
37
37
  "aria-label": "Select"
38
38
  }
@@ -53,7 +53,7 @@ const SelectColumnHeaderRenderer = (props) => {
53
53
  const allRowsChecked = rows.length === checkedRows?.size;
54
54
  return SelectCellFormatter({
55
55
  "aria-label": "Select All",
56
- isCellSelected: props.isCellSelected,
56
+ tabIndex: props.tabIndex,
57
57
  value: allRowsChecked,
58
58
  onChange: onAllRowsCheckedChange
59
59
  });
@@ -68,9 +68,9 @@ const SelectColumn = {
68
68
  sortable: false,
69
69
  frozen: true,
70
70
  type: "boolean",
71
- headerRenderer: SelectColumnHeaderRenderer,
72
- formatter: SelectFormatter,
73
- groupFormatter: SelectGroupFormatter
71
+ renderHeaderCell: SelectColumnHeaderRenderer,
72
+ renderCell: SelectFormatter,
73
+ renderGroupCell: SelectGroupFormatter
74
74
  };
75
75
  export {
76
76
  SelectColumn as S,
@@ -1,10 +1,10 @@
1
- import { EditorProps } from 'react-data-grid';
1
+ import { RenderEditCellProps } from 'react-data-grid';
2
2
  /**
3
3
  * TODO: Documentar
4
4
  */
5
- export declare function TextEditor<TRow, TSummaryRow>({ row, column, onRowChange, onClose, }: EditorProps<TRow, TSummaryRow>): import("react/jsx-runtime").JSX.Element;
5
+ export declare function TextEditor<TRow, TSummaryRow>({ row, column, onRowChange, onClose, }: RenderEditCellProps<TRow, TSummaryRow>): import("react/jsx-runtime").JSX.Element;
6
6
  /**
7
7
  * TODO: Documentar
8
8
  */
9
- export declare function NumberEditor<TRow, TSummaryRow>({ row, column, onRowChange, onClose, }: EditorProps<TRow, TSummaryRow>): import("react/jsx-runtime").JSX.Element;
9
+ export declare function NumberEditor<TRow, TSummaryRow>({ row, column, onRowChange, onClose, }: RenderEditCellProps<TRow, TSummaryRow>): import("react/jsx-runtime").JSX.Element;
10
10
  export default TextEditor;
@@ -1,6 +1,6 @@
1
1
  import { Maybe } from '@m4l/core';
2
2
  import { Theme } from '@mui/material/styles';
3
- import { Column, RowsChangeData, FormatterProps } from 'react-data-grid';
3
+ import { Column, RowsChangeData, RenderCellProps, DataGridProps as NativeDataGridProps } from 'react-data-grid';
4
4
  import { MenuAction } from '../MenuActions/types';
5
5
  import { ActionsSlots, ColumnIconFormatterSlots, ColumnsConfigSlots, ControlNavigateSlots, DataGridSlots, RowsCountSlots, TableSlots, TextEditorSlots } from './slots/DataGridEnum';
6
6
  import { OverridesStyleRules } from '@mui/material/styles/overrides';
@@ -9,7 +9,7 @@ import { IGridConfig } from './contexts/DataGridContext/types';
9
9
  import { Sizes } from '@m4l/styles';
10
10
  import { PagerProps } from '../Pager';
11
11
  import { SettingsProps } from './subcomponents/HeaderActions/subcomponents/Settings/types';
12
- export type GridFormatterPropss<T, SR> = FormatterProps<T, SR>;
12
+ export type GridFormatterPropss<T, SR> = RenderCellProps<T, SR>;
13
13
  export type { ColumnUncertaintyFormatter, ColumnPointsFormatter, ColumnNestedValueFormatter, } from './formatters';
14
14
  export declare type ColumnType = 'string' | 'date' | 'number' | 'boolean' | 'custom';
15
15
  export declare type ColumnAlign = 'left' | 'center' | 'right';
@@ -31,9 +31,10 @@ declare module 'react-data-grid' {
31
31
  align?: ColumnAlign;
32
32
  isDraggable?: boolean;
33
33
  withFilter?: boolean;
34
- withinHeaderRenderer?: React.FunctionComponent<HeaderRendererProps<TRow, TSummaryRow>>;
34
+ withinHeaderRenderer?: React.FunctionComponent<RenderHeaderCellProps<TRow, TSummaryRow>>;
35
35
  customFilter?: (row: TRow, value: string) => boolean;
36
36
  customSort?: (a: TRow, b: TRow) => number;
37
+ formatter?: (props: any) => JSX.Element;
37
38
  }
38
39
  }
39
40
  export declare type RowKey = string | number;
@@ -107,7 +108,7 @@ export interface FilterSettings {
107
108
  onChange: (event: FilterChangeEvent) => void;
108
109
  }
109
110
  /**--------------------Termina tipado de filtros-------------------------------------------- */
110
- export interface GridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> {
111
+ export interface GridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Omit<NativeDataGridProps<TRow, TSummaryRow>, 'rowKeyGetter' | 'rows' | 'columns' | 'onRowsChange' | 'selectedRows' | 'onSelectedRowsChange' | 'renderers'> {
111
112
  id: string;
112
113
  withActions?: boolean;
113
114
  columns: readonly Column<TRow, TSummaryRow>[];
@@ -20,6 +20,7 @@ const MenuItem = (props) => {
20
20
  checked = false,
21
21
  checkable = false,
22
22
  className,
23
+ dataTestId,
23
24
  ...other
24
25
  } = props;
25
26
  const { currentSize } = useComponentSize(size);
@@ -83,7 +84,7 @@ const MenuItem = (props) => {
83
84
  disableRipple: true,
84
85
  size: adjustedSize,
85
86
  className: clsx(className, MENUITEM_CLASSES.root),
86
- "data-testid": "MenuItemRoot",
87
+ "data-testid": dataTestId || "MenuItemRoot",
87
88
  children: [
88
89
  checkable && /* @__PURE__ */ jsx(
89
90
  MenuItemIconCheckedStyled,
@@ -53,6 +53,10 @@ export interface MenuItemProps extends Omit<MUIMenuItemProps, 'size' | 'color'>
53
53
  * indica si debe aparecer el icono de check
54
54
  */
55
55
  checkable?: boolean;
56
+ /**
57
+ * ID para pruebas que se pasará como data-testid
58
+ */
59
+ dataTestId?: string;
56
60
  }
57
61
  /**
58
62
  * Estado del propietario del `MenuItem` utilizado para definir propiedades internas de estilo y comportamiento.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.2.62-JT09072025.beta.2",
3
+ "version": "9.2.63-JT14072025.beta.1",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {
@@ -34,7 +34,7 @@
34
34
  "react": "18.3.1",
35
35
  "react-chartjs-2": "^5.2.0",
36
36
  "react-color": "^2.19.3",
37
- "react-data-grid": "7.0.0-beta.13",
37
+ "react-data-grid": "7.0.0-beta.47",
38
38
  "react-dnd": "^16.0.1",
39
39
  "react-dnd-html5-backend": "^16.0.1",
40
40
  "react-dom": "18.3.1",
@@ -1,4 +1,4 @@
1
- import { HeaderRendererProps } from 'react-data-grid';
1
+ import { RenderHeaderCellProps } from 'react-data-grid';
2
2
  import { ChipStatusFormatterProps } from '../../../../src/components/formatters/ChipStatusFormatter/types';
3
3
  import { DeepKeyOf } from '../../../../src/utils/types';
4
4
  import { ColumnAlign } from '../../../../src/components/DataGrid/types';
@@ -74,7 +74,7 @@ export interface Column<TRow, TSummaryRow> {
74
74
  type: ColumnType;
75
75
  formatter?: (props: any) => JSX.Element;
76
76
  width?: number;
77
- withinHeaderRenderer?: React.FunctionComponent<HeaderRendererProps<TRow, TSummaryRow>>;
77
+ withinHeaderRenderer?: React.FunctionComponent<RenderHeaderCellProps<TRow, TSummaryRow>>;
78
78
  customFilter?: (row: TRow, value: string) => boolean;
79
79
  customSort?: (a: TRow, b: TRow) => number;
80
80
  }
@@ -1,10 +0,0 @@
1
- const getFieldValueWithRow = (fieldValue) => {
2
- const row = "row";
3
- if (fieldValue.includes(row)) {
4
- return fieldValue;
5
- }
6
- return `${row}.${fieldValue}`;
7
- };
8
- export {
9
- getFieldValueWithRow as g
10
- };