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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/components/DataGrid/Datagrid.styles.js +142 -62
  2. package/components/DataGrid/contexts/DataGridContext/index.js +3 -0
  3. package/components/DataGrid/dictionary.d.ts +1 -0
  4. package/components/DataGrid/dictionary.js +2 -1
  5. package/components/DataGrid/formatters/ColumnColorFormatter/tests/ColumnColorFormatter.test.d.ts +1 -0
  6. package/components/DataGrid/formatters/ColumnColorFormatter/tests/useColumnColor.test.d.ts +1 -0
  7. package/components/DataGrid/formatters/ColumnTagsFormatter/tests/ColumnTagsFormatter.test.d.ts +1 -0
  8. package/components/DataGrid/formatters/ColumnTagsFormatter/tests/useColumnTags.test.d.ts +1 -0
  9. package/components/DataGrid/hooks/useModalCardDetail.d.ts +1 -1
  10. package/components/DataGrid/hooks/useModalCardDetail.js +6 -1
  11. package/components/DataGrid/icons.d.ts +1 -0
  12. package/components/DataGrid/icons.js +2 -1
  13. package/components/DataGrid/slots/DataGridEnum.d.ts +4 -1
  14. package/components/DataGrid/slots/DataGridEnum.js +3 -0
  15. package/components/DataGrid/slots/DataGridSlot.d.ts +3 -0
  16. package/components/DataGrid/slots/DataGridSlot.js +48 -33
  17. package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +1 -1
  18. package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +47 -5
  19. package/components/DataGrid/subcomponents/Cards/index.js +6 -3
  20. package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.d.ts +1 -1
  21. package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +57 -15
  22. package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +1 -1
  23. package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +2 -2
  24. package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +5 -1
  25. package/components/DataGrid/subcomponents/Cards/types.d.ts +16 -0
  26. package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +1 -1
  27. package/components/DataGrid/subcomponents/ControlNavigate/ControlNavigate.js +1 -1
  28. package/components/DataGrid/subcomponents/HeaderActions/index.js +2 -2
  29. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/RowsCount/index.js +1 -1
  30. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
  31. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.js +1 -1
  32. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.js +1 -1
  33. package/components/DataGrid/subcomponents/Table/index.js +1 -1
  34. package/components/DataGrid/subcomponents/Table/subcomponents/CheckboxFormatter.js +1 -0
  35. package/components/DataGrid/subcomponents/Table/subcomponents/CustomIcons.js +39 -14
  36. package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +1 -1
  37. package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
  38. package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
  39. package/components/DataGrid/types.d.ts +12 -0
  40. package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.d.ts +21 -1
  41. package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +22 -2
  42. package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.d.ts +21 -1
  43. package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +26 -2
  44. package/components/formatters/ImageFormatter/ImageFormatter.styles.js +1 -0
  45. package/hooks/useDataGridPersistence/useDataGridPersistence.test.d.ts +1 -0
  46. package/package.json +1 -1
  47. package/components/DataGrid/formatters/ColumnIconFormatter/constants.d.ts +0 -4
@@ -5,4 +5,4 @@ import { CardDetailsProps } from '../../types';
5
5
  *
6
6
  * A diferencia del componente Cards, este muestra TODAS las columnas
7
7
  */
8
- export declare function CardDetails<TRow>({ row, columns, viewColumnsConfig, onRowsChange, size, }: CardDetailsProps<TRow>): import("react/jsx-runtime").JSX.Element;
8
+ export declare function CardDetails<TRow>({ row, columns, viewColumnsConfig, onRowsChange, size, rows, rowIndex, }: CardDetailsProps<TRow>): import("react/jsx-runtime").JSX.Element;
@@ -1,15 +1,25 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useState, useCallback } from "react";
3
- import { e as CardDetailContainerStyled, b as ContainerLabelValueColumnStyled, c as ContentWrapperColumnStyled, L as LabelHeaderColumnStyled, E as EditorCellWrapperStyled, V as ValueColumnStyled } from "../../../../slots/DataGridSlot.js";
3
+ import { f as CardDetailContainerStyled, 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";
4
+ import { D as DICTIONARY } from "../../../../dictionary.js";
5
+ import { useModuleDictionary, useEnvironment } from "@m4l/core";
6
+ import { p as pathIcons } from "../../../../icons.js";
7
+ import { u as useComponentSize } from "../../../../../../hooks/useComponentSize/useComponentSize.js";
4
8
  function CardDetails({
5
9
  row,
6
10
  columns,
7
11
  viewColumnsConfig,
8
12
  onRowsChange,
9
- size = "medium"
13
+ size = "medium",
14
+ rows,
15
+ rowIndex
10
16
  }) {
11
17
  const [editingColumnKey, setEditingColumnKey] = useState(null);
12
18
  const [refreshCounter, setRefreshCounter] = useState(0);
19
+ const { getLabel } = useModuleDictionary();
20
+ const { host_static_assets, environment_assets } = useEnvironment();
21
+ const { currentSize } = useComponentSize(size);
22
+ const currentRow = rows[rowIndex] || row;
13
23
  const handleForceRefresh = useCallback(() => {
14
24
  setRefreshCounter((prev) => prev + 1);
15
25
  }, []);
@@ -17,10 +27,8 @@ function CardDetails({
17
27
  if (column.renderCell) {
18
28
  return {
19
29
  ...column,
20
- // Agregar onAfterChange al objeto de la columna si no existe
21
- ...!column.onAfterChange && {
22
- onAfterChange: handleForceRefresh
23
- }
30
+ // Agregar onAfterChange al objeto de la columna
31
+ onAfterChange: handleForceRefresh
24
32
  };
25
33
  }
26
34
  return column;
@@ -30,7 +38,8 @@ function CardDetails({
30
38
  (config) => config.key === modifiedColumn.key
31
39
  );
32
40
  const originalColumn = columns[index];
33
- const columnKey = `${originalColumn.key}-${refreshCounter}`;
41
+ const hasInteractiveFormatter = !!modifiedColumn.onAfterChange;
42
+ const columnKey = hasInteractiveFormatter ? `${originalColumn.key}-${refreshCounter}` : `${originalColumn.key}`;
34
43
  const shouldShowTitle = configColumn?.showTitle !== false;
35
44
  return /* @__PURE__ */ jsx(ContainerLabelValueColumnStyled, { children: /* @__PURE__ */ jsxs(
36
45
  ContentWrapperColumnStyled,
@@ -48,15 +57,18 @@ function CardDetails({
48
57
  if (modifiedColumn.renderEditCell && editingColumnKey === modifiedColumn.key) {
49
58
  return /* @__PURE__ */ jsx(EditorCellWrapperStyled, { ownerState: { size }, children: modifiedColumn.renderEditCell({
50
59
  column: originalColumn,
51
- row,
60
+ row: currentRow,
52
61
  rowIdx: index,
53
62
  /**
54
63
  * onRowChange es una función que se ejecuta cuando el usuario edita una celda.
55
64
  */
56
65
  onRowChange: (updatedRow) => {
57
66
  if (onRowsChange) {
58
- onRowsChange([updatedRow], {
59
- indexes: [index],
67
+ const updatedRows = rows.map(
68
+ (r, i) => i === rowIndex ? updatedRow : r
69
+ );
70
+ onRowsChange(updatedRows, {
71
+ indexes: [rowIndex],
60
72
  column: originalColumn
61
73
  });
62
74
  }
@@ -66,8 +78,8 @@ function CardDetails({
66
78
  }
67
79
  if (modifiedColumn.renderCell) {
68
80
  const cellContent = modifiedColumn.renderCell({
69
- column: originalColumn,
70
- row,
81
+ column: modifiedColumn,
82
+ row: currentRow,
71
83
  rowIdx: index,
72
84
  isCellSelected: false,
73
85
  tabIndex: -1,
@@ -76,8 +88,11 @@ function CardDetails({
76
88
  */
77
89
  onRowChange: (updatedRow) => {
78
90
  if (onRowsChange) {
79
- onRowsChange([updatedRow], {
80
- indexes: [index],
91
+ const updatedRows = rows.map(
92
+ (r, i) => i === rowIndex ? updatedRow : r
93
+ );
94
+ onRowsChange(updatedRows, {
95
+ indexes: [rowIndex],
81
96
  column: originalColumn
82
97
  });
83
98
  }
@@ -85,7 +100,34 @@ function CardDetails({
85
100
  });
86
101
  return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: cellContent });
87
102
  }
88
- return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: row[modifiedColumn.key] ?? "-" });
103
+ const rawValue = currentRow[modifiedColumn.key];
104
+ const isEmpty = rawValue === null || rawValue === void 0 || rawValue === "";
105
+ const isEditable = !!modifiedColumn.renderEditCell;
106
+ if (isEditable) {
107
+ return /* @__PURE__ */ jsxs(EditablePlaceholderStyled, { children: [
108
+ /* @__PURE__ */ jsx(
109
+ ValueColumnStyled,
110
+ {
111
+ variant: "body",
112
+ color: isEmpty ? "text.secondary" : "text.primary",
113
+ children: isEmpty ? getLabel(DICTIONARY.EDIT_PLACEHOLDER) : rawValue
114
+ }
115
+ ),
116
+ /* @__PURE__ */ jsx(
117
+ IconButtonEditStyled,
118
+ {
119
+ src: `${host_static_assets}/${environment_assets}/${pathIcons.edit}`,
120
+ onClick: () => {
121
+ setEditingColumnKey(modifiedColumn.key);
122
+ },
123
+ size: currentSize,
124
+ role: "button",
125
+ "aria-label": "Editar texto"
126
+ }
127
+ )
128
+ ] });
129
+ }
130
+ return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: rawValue ?? "-" });
89
131
  })()
90
132
  ]
91
133
  }
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useMemo, useCallback } from "react";
3
3
  import { useEnvironment } from "@m4l/core";
4
4
  import { u as useDataGrid } from "../../../../hooks/useDataGrid.js";
5
- import { f as CardHeaderStyled, g as CardHeaderLeftStyled, h as CardHeaderRightStyled } from "../../../../slots/DataGridSlot.js";
5
+ import { g as CardHeaderStyled, h as CardHeaderLeftStyled, i as CardHeaderRightStyled } from "../../../../slots/DataGridSlot.js";
6
6
  import { p as pathIcons } from "../../../../icons.js";
7
7
  import { C as CheckboxCellAdapter } from "../../../CheckboxCellAdapter/index.js";
8
8
  import { I as IconButton } from "../../../../../mui_extended/IconButton/IconButton.js";
@@ -3,9 +3,9 @@ import { CardRowProps } from '../../types';
3
3
  /**
4
4
  * Componente que muestra una fila de tarjetas.
5
5
  */
6
- declare function CardRowComponent<TRow, TKey extends RowKey = RowKey>({ row, columns, originalColumns, rowKeyGetter, selectedRows, onSelectedRowsChange, onRowsChange, customRender, minHeight, isChecked, checkedRows, showCheckbox, onCheckedRowsChange, onOpenDetail, }: CardRowProps<TRow, TKey>): import("react/jsx-runtime").JSX.Element;
6
+ declare function CardRowComponent<TRow, TKey extends RowKey = RowKey>({ row, rows, rowIndex, columns, originalColumns, rowKeyGetter, selectedRows, onSelectedRowsChange, onRowsChange, customRender, minHeight, isChecked, checkedRows, showCheckbox, onCheckedRowsChange, onOpenDetail, }: CardRowProps<TRow, TKey>): import("react/jsx-runtime").JSX.Element;
7
7
  /**
8
- *
8
+ * Componente que muestra CardRow
9
9
  */
10
10
  export declare const CardRow: typeof CardRowComponent;
11
11
  export {};
@@ -1,12 +1,14 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import React, { useMemo } from "react";
3
- import { i as CardContentWrapperStyled, j as CardContentStyled, k as CardStyled } from "../../../../slots/DataGridSlot.js";
3
+ import { j as CardContentWrapperStyled, k as CardContentStyled, l as CardStyled } from "../../../../slots/DataGridSlot.js";
4
4
  import { L as LazyLoadCard } from "../LazyLoadCard/index.js";
5
5
  import { u as useCardContent } from "../../hooks/useCardContent.js";
6
6
  import { C as CardHeader } from "../CardHeader/index.js";
7
7
  import { deepEqual } from "fast-equals";
8
8
  function CardRowComponent({
9
9
  row,
10
+ rows,
11
+ rowIndex,
10
12
  columns,
11
13
  originalColumns,
12
14
  rowKeyGetter,
@@ -24,6 +26,8 @@ function CardRowComponent({
24
26
  const hasCustomRender = customRender !== void 0;
25
27
  const { cardContent } = useCardContent({
26
28
  row,
29
+ rows,
30
+ rowIndex,
27
31
  columns,
28
32
  onRowsChange
29
33
  });
@@ -78,6 +78,14 @@ export interface CardRowProps<TRow, TKey extends RowKey = RowKey> {
78
78
  * Fila que se mostrará en la tarjeta
79
79
  */
80
80
  row: TRow;
81
+ /**
82
+ * Array completo de todas las filas (necesario para reconstruir el array al editar)
83
+ */
84
+ rows: readonly TRow[];
85
+ /**
86
+ * Índice de la fila actual en el array de filas
87
+ */
88
+ rowIndex: number;
81
89
  /**
82
90
  * Columnas que se mostrarán en la tarjeta (procesadas, filtradas por visibilidad)
83
91
  */
@@ -140,6 +148,14 @@ export interface CardDetailsProps<TRow> {
140
148
  viewColumnsConfig: IViewConfig<any, any>[];
141
149
  onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
142
150
  size?: Extract<Sizes, 'small' | 'medium'>;
151
+ /**
152
+ * Array completo de todas las filas (necesario para reconstruir el array al editar)
153
+ */
154
+ rows: readonly TRow[];
155
+ /**
156
+ * Índice de la fila actual en el array de filas
157
+ */
158
+ rowIndex: number;
143
159
  }
144
160
  /**
145
161
  * Props para el componente CardHeader
@@ -4,7 +4,7 @@ import { SelectCellFormatter } from "react-data-grid";
4
4
  import { C as CheckboxFormatter } from "../Table/subcomponents/CheckboxFormatter.js";
5
5
  import { R as RadioFormatter } from "../Table/subcomponents/RadioFormatter.js";
6
6
  import { a as DataGridContext } from "../../contexts/DataGridContext/index.js";
7
- import { l as CheckboxCellWrapperStyled } from "../../slots/DataGridSlot.js";
7
+ import { m as CheckboxCellWrapperStyled } from "../../slots/DataGridSlot.js";
8
8
  const CheckboxCellAdapter = forwardRef(function CheckboxCellAdapter2(props, ref) {
9
9
  const {
10
10
  value,
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useIsMobile } from "@m4l/graphics";
3
- import { m as ControlNavigateStyled } from "../../slots/DataGridSlot.js";
3
+ import { n as ControlNavigateStyled } from "../../slots/DataGridSlot.js";
4
4
  import { R as RowsCount } from "../HeaderActions/subcomponents/RowsCount/index.js";
5
5
  import { u as useComponentSize } from "../../../../hooks/useComponentSize/useComponentSize.js";
6
6
  import { P as Pager } from "../../../Pager/Pager.js";
@@ -6,7 +6,7 @@ import { V as ViewMode } from "./subcomponents/ViewMode/index.js";
6
6
  import { u as useDataGrid } from "../../hooks/useDataGrid.js";
7
7
  import { useIsMobile } from "@m4l/graphics";
8
8
  import { M as MobileMenuActions } from "./subcomponents/MobileMenuActions/index.js";
9
- import { A as ActionsRootStyled, n as ActionsConfigContainerStyled, o as ContainerLeftActionsStyled, p as ContainerRightActionsStyled } from "../../slots/DataGridSlot.js";
9
+ import { A as ActionsRootStyled, o as ActionsConfigContainerStyled, p as ContainerLeftActionsStyled, q as ContainerRightActionsStyled } from "../../slots/DataGridSlot.js";
10
10
  import { u as useComponentSize } from "../../../../hooks/useComponentSize/useComponentSize.js";
11
11
  function HeaderActions(props) {
12
12
  const {
@@ -29,7 +29,7 @@ function HeaderActions(props) {
29
29
  ] }) : /* @__PURE__ */ jsxs(ActionsConfigContainerStyled, { ownerState: { withPager }, children: [
30
30
  /* @__PURE__ */ jsxs(ContainerLeftActionsStyled, { children: [
31
31
  leftActions,
32
- typeof rowHeights !== "number" && /* @__PURE__ */ jsx(Density, {}),
32
+ typeof rowHeights !== "number" && viewMode !== "cards" && /* @__PURE__ */ jsx(Density, {}),
33
33
  withLocalFilters && /* @__PURE__ */ jsx(Filter, {}),
34
34
  withSettings && !(viewMode === "cards" && cardsViewConfig?.customRender) && /* @__PURE__ */ jsx(Settings, { ...settingsProps, columns }),
35
35
  cardsViewConfig !== void 0 && /* @__PURE__ */ jsx(ViewMode, {})
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useModuleDictionary, useModuleSkeleton } from "@m4l/core";
3
3
  import { Skeleton } from "@mui/material";
4
4
  import { u as useDataGrid } from "../../../../hooks/useDataGrid.js";
5
- import { R as RowsCountRootStyled, q as RowsCountLabelStyled, r as RowsCountValueStyled } from "../../../../slots/DataGridSlot.js";
5
+ import { R as RowsCountRootStyled, r as RowsCountLabelStyled, s as RowsCountValueStyled } from "../../../../slots/DataGridSlot.js";
6
6
  function RowsCount() {
7
7
  const { rowsCount, size } = useDataGrid();
8
8
  const { getLabel } = useModuleDictionary();
@@ -4,7 +4,7 @@ import { useModuleDictionary, useEnvironment } from "@m4l/core";
4
4
  import DataGrid from "react-data-grid";
5
5
  import { I as IconButton } from "../../../../../../../mui_extended/IconButton/IconButton.js";
6
6
  import { p as pathIcons } from "../../../../../../icons.js";
7
- import { s as ColumnsConfigWrapperStyled, t as ColumnsConfigDataGridStyled, u as ColumnsConfigSelColumnsStyled, T as TableWrapperDataGridStyled, v as ColumnsConfigActiosStyled } from "../../../../../../slots/DataGridSlot.js";
7
+ import { t as ColumnsConfigWrapperStyled, u as ColumnsConfigDataGridStyled, v as ColumnsConfigSelColumnsStyled, T as TableWrapperDataGridStyled, w as ColumnsConfigActiosStyled } from "../../../../../../slots/DataGridSlot.js";
8
8
  import { D as DICTIONARY } from "../../../../../../dictionary.js";
9
9
  import { C as ColumnInteractiveCheckFormatter } from "../../../../../../formatters/ColumnInteractiveCheckFormatter/formatter.js";
10
10
  function getRowsFromColumnsConfig(columnsConfig, columns) {
@@ -4,7 +4,7 @@ import { useModuleDictionary, useEnvironment } from "@m4l/core";
4
4
  import DataGrid from "react-data-grid";
5
5
  import { I as IconButton } from "../../../../../../../mui_extended/IconButton/IconButton.js";
6
6
  import { p as pathIcons } from "../../../../../../icons.js";
7
- import { s as ColumnsConfigWrapperStyled, t as ColumnsConfigDataGridStyled, u as ColumnsConfigSelColumnsStyled, T as TableWrapperDataGridStyled, v as ColumnsConfigActiosStyled } from "../../../../../../slots/DataGridSlot.js";
7
+ import { t as ColumnsConfigWrapperStyled, u as ColumnsConfigDataGridStyled, v as ColumnsConfigSelColumnsStyled, T as TableWrapperDataGridStyled, w as ColumnsConfigActiosStyled } from "../../../../../../slots/DataGridSlot.js";
8
8
  import { D as DICTIONARY } from "../../../../../../dictionary.js";
9
9
  import { C as ColumnInteractiveCheckFormatter } from "../../../../../../formatters/ColumnInteractiveCheckFormatter/formatter.js";
10
10
  function getRowsFromColumnsConfigCards(columnsConfigCards, columns) {
@@ -6,7 +6,7 @@ import { I as IconButton } from "../../../../../mui_extended/IconButton/IconButt
6
6
  import { P as Popover } from "../../../../../mui_extended/Popover/Popover.js";
7
7
  import { p as pathIcons } from "../../../../icons.js";
8
8
  import { D as DICTIONARY } from "../../../../dictionary.js";
9
- import { w as ContainerToggleCardsStyled, x as CardToggleButtonStyled, y as TextToggleCardButtonStyled } from "../../../../slots/DataGridSlot.js";
9
+ import { x as ContainerToggleCardsStyled, y as CardToggleButtonStyled, z as TextToggleCardButtonStyled } from "../../../../slots/DataGridSlot.js";
10
10
  import { I as Icon } from "../../../../../Icon/Icon.js";
11
11
  function ViewMode() {
12
12
  const { host_static_assets, environment_assets } = useEnvironment();
@@ -8,7 +8,7 @@ import { a as filterHeight } from "./subcomponents/SelectColumn.js";
8
8
  import { u as useSortColumnsRows } from "./hooks/useSortColumnsRows.js";
9
9
  import { u as useFilters } from "../../hooks/useFilters.js";
10
10
  import { u as useDataGrid } from "../../hooks/useDataGrid.js";
11
- import { z as TableContainerStyled, T as TableWrapperDataGridStyled } from "../../slots/DataGridSlot.js";
11
+ import { B as TableContainerStyled, T as TableWrapperDataGridStyled } from "../../slots/DataGridSlot.js";
12
12
  import { u as useHeaderMenuActions } from "./hooks/useHeaderMenuActions.js";
13
13
  import { H as HeaderRenderClick } from "./subcomponents/HeaderRenderClick/HeaderRenderClick.js";
14
14
  function Table(props) {
@@ -12,6 +12,7 @@ const CheckboxFormatter = forwardRef(function CheckboxFormatter2({ onChange, che
12
12
  checked,
13
13
  size: "small",
14
14
  icon: /* @__PURE__ */ jsx(CheckboxIcon, {}),
15
+ disableRipple: true,
15
16
  checkedIcon: /* @__PURE__ */ jsx(CheckboxCheckedIcon, {}),
16
17
  indeterminateIcon: /* @__PURE__ */ jsx(CheckboxIndeterminateIcon, {}),
17
18
  onChange: handleChange,
@@ -1,22 +1,47 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { SvgIcon } from "@mui/material";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useEnvironment } from "@m4l/core";
3
+ import "@mui/material";
4
+ import { I as Icon } from "../../../../Icon/Icon.js";
3
5
  function CheckboxIcon(props) {
4
- return /* @__PURE__ */ jsx(SvgIcon, { ...props, viewBox: "0 0 16 17", className: "checkbox-unChecked", children: /* @__PURE__ */ jsxs("svg", { width: "16", height: "17", viewBox: "0 0 16 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
5
- /* @__PURE__ */ jsx("g", { "clip-path": "url(#clip0_13395_49048)", children: /* @__PURE__ */ jsx("path", { d: "M13.0156 2.5H3.01562C2.75041 2.5 2.49605 2.60536 2.30852 2.79289C2.12098 2.98043 2.01563 3.23478 2.01562 3.5V13.5C2.01563 13.7652 2.12098 14.0196 2.30852 14.2071C2.49605 14.3946 2.75041 14.5 3.01562 14.5H13.0156C13.2808 14.5 13.5352 14.3946 13.7227 14.2071C13.9103 14.0196 14.0156 13.7652 14.0156 13.5V3.5C14.0156 3.23478 13.9103 2.98043 13.7227 2.79289C13.5352 2.60536 13.2808 2.5 13.0156 2.5ZM3.01562 13.5V3.5H13.0156V13.5H3.01562Z", fill: "#323B3B" }) }),
6
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_13395_49048", children: /* @__PURE__ */ jsx("rect", { width: "16", height: "16", fill: "white", transform: "translate(0 0.5)" }) }) })
7
- ] }) });
6
+ const { host_static_assets, environment_assets } = useEnvironment();
7
+ const uncheckedIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/check_box/assets/icons/unchecked.svg`;
8
+ return /* @__PURE__ */ jsx(
9
+ Icon,
10
+ {
11
+ src: uncheckedIconUrl,
12
+ size: "small",
13
+ color: "text.primary",
14
+ className: "checkbox-unChecked",
15
+ ...props
16
+ }
17
+ );
8
18
  }
9
19
  function CheckboxCheckedIcon(props) {
10
- return /* @__PURE__ */ jsxs(SvgIcon, { ...props, viewBox: "0 0 16 17", className: "checkbox-checked", children: [
11
- /* @__PURE__ */ jsxs("g", { "clip-path": "url(#clip0_13395_49057)", children: [
12
- /* @__PURE__ */ jsx("path", { d: "M13.4323 2H2.59896C2.31164 2 2.03609 2.11414 1.83293 2.3173C1.62976 2.52047 1.51563 2.79602 1.51562 3.08333V13.9167C1.51563 14.204 1.62976 14.4795 1.83293 14.6827C2.03609 14.8859 2.31164 15 2.59896 15H13.4323C13.7196 15 13.9952 14.8859 14.1983 14.6827C14.4015 14.4795 14.5156 14.204 14.5156 13.9167V3.08333C14.5156 2.79602 14.4015 2.52047 14.1983 2.3173C13.9952 2.11414 13.7196 2 13.4323 2Z", fill: "#323B3B" }),
13
- /* @__PURE__ */ jsx("path", { d: "M6.92119 11.6245L4.10001 8.8274L4.99759 7.95696L6.92119 9.84467L11.1014 5.70001L11.9996 6.58993L6.92119 11.6245Z", fill: "#F3F5F7" })
14
- ] }),
15
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_13395_49057", children: /* @__PURE__ */ jsx("rect", { width: "16", height: "16", fill: "white", transform: "translate(0 0.5)" }) }) })
16
- ] });
20
+ const { host_static_assets, environment_assets } = useEnvironment();
21
+ const checkedIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/check_box/assets/icons/checked.svg`;
22
+ return /* @__PURE__ */ jsx(
23
+ Icon,
24
+ {
25
+ src: checkedIconUrl,
26
+ size: "small",
27
+ color: "primary.enabled",
28
+ className: "checkbox-checked",
29
+ ...props
30
+ }
31
+ );
17
32
  }
18
33
  function CheckboxIndeterminateIcon(props) {
19
- return /* @__PURE__ */ jsx(SvgIcon, { ...props, children: /* @__PURE__ */ jsx("path", { d: "M17 3a4 4 0 014 4v10a4 4 0 01-4 4H7a4 4 0 01-4-4V7a4 4 0 014-4h10zm-1.75 8h-6.5a.75.75 0 00-.75.75v.5c0 .414.336.75.75.75h6.5a.75.75 0 00.75-.75v-.5a.75.75 0 00-.75-.75z" }) });
34
+ const { host_static_assets, environment_assets } = useEnvironment();
35
+ const indeterminateIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/check_box/assets/icons/indeterminate.svg`;
36
+ return /* @__PURE__ */ jsx(
37
+ Icon,
38
+ {
39
+ src: indeterminateIconUrl,
40
+ size: "small",
41
+ color: "primary.enabled",
42
+ ...props
43
+ }
44
+ );
20
45
  }
21
46
  export {
22
47
  CheckboxIndeterminateIcon as C,
@@ -5,7 +5,7 @@ import { useDrag, useDrop } from "react-dnd";
5
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
- import { N as NameColumnIconStyled, B as NameColumnStyled, I as IconColumnStyled, F as DraggableHeaderRootStyled, G as ButtonHeaderActionsStyled, H as DraggableWrapperInputBaseStyled, J as IconSearchStyled, K as HeaderInputBaseStyled } from "../../../slots/DataGridSlot.js";
8
+ import { N as NameColumnIconStyled, F as NameColumnStyled, G as IconColumnStyled, H as DraggableHeaderRootStyled, J as ButtonHeaderActionsStyled, K as DraggableWrapperInputBaseStyled, M as IconSearchStyled, O as HeaderInputBaseStyled } from "../../../slots/DataGridSlot.js";
9
9
  import { p as pathIcons } from "../../../icons.js";
10
10
  import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
11
11
  import { I as Icon } from "../../../../Icon/Icon.js";
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { useState, useMemo, useEffect, useCallback } from "react";
3
3
  import { useModuleDictionary } from "@m4l/core";
4
4
  import { M as MenuItem } from "../../../../../mui_extended/MenuItem/MenuItem.js";
5
- import { M as MenuListStyled, O as HeaderRenderClickStyled } from "../../../../slots/DataGridSlot.js";
5
+ import { P as MenuListStyled, Q as HeaderRenderClickStyled } from "../../../../slots/DataGridSlot.js";
6
6
  import { M as MenuDivider } from "../../../../../mui_extended/MenuDivider/MenuDivider.js";
7
7
  import { P as Popover } from "../../../../../mui_extended/Popover/Popover.js";
8
8
  import { D as DICTIONARY } from "../../../../dictionary.js";
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { P as InputTextEditorStyled } from "../../../slots/DataGridSlot.js";
2
+ import { S as InputTextEditorStyled } from "../../../slots/DataGridSlot.js";
3
3
  function autoFocusAndSelect(input) {
4
4
  input?.focus();
5
5
  input?.select();
@@ -228,6 +228,10 @@ export interface UseModalDetailProps<TRow> {
228
228
  columns: readonly Column<TRow, any>[];
229
229
  viewMode: ViewMode;
230
230
  onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
231
+ /**
232
+ * Array completo de todas las filas (necesario para reconstruir el array al editar en el modal)
233
+ */
234
+ rows: readonly TRow[];
231
235
  }
232
236
  /**
233
237
  * Configuración de una columna específica en vista "cards"
@@ -287,6 +291,14 @@ export interface CardContentProps<TRow> {
287
291
  columns: readonly Column<TRow, any>[];
288
292
  originalColumns: readonly Column<TRow, any>[];
289
293
  onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
294
+ /**
295
+ * Array completo de todas las filas (necesario para reconstruir el array al editar)
296
+ */
297
+ rows: readonly TRow[];
298
+ /**
299
+ * Índice de la fila actual en el array de filas
300
+ */
301
+ rowIndex: number;
290
302
  }
291
303
  /**
292
304
  * Configuración de densidad para el DataGrid.
@@ -1,5 +1,25 @@
1
1
  /**
2
- * PopoverFilter: Componente que renderiza el popover de filtros
2
+ * PopoverFilter: Componente que renderiza el popover de filtros.
3
+ * Este componente implementa un formulario de filtros dentro de un popover. Para garantizar
4
+ * que funcione correctamente en todos los contextos, utiliza un botón con submit programático
5
+ * en lugar de un botón tipo `submit` nativo.
6
+ *
7
+ * **Diseño resiliente:**
8
+ * El componente está diseñado para ser resiliente a casos donde sea contenido por un
9
+ * `RHFormProvider` ancestro. Aunque HTML no permite formularios anidados, este componente
10
+ * puede funcionar dentro de un formulario padre sin afectar su comportamiento, ya que:
11
+ *
12
+ * 1. Utiliza un botón tipo `button` que ejecuta el submit programáticamente mediante
13
+ * `handleSubmit` de react-hook-form, evitando el submit nativo del navegador.
14
+ * 2. No depende de la propagación de eventos del DOM para el submit, lo que elimina
15
+ * la posibilidad de que el formulario ancestro se ejecute accidentalmente.
16
+ * 3. Mantiene el mismo comportamiento y funcionalidad independientemente de si está
17
+ * contenido por un formulario padre o está aislado.
18
+ *
19
+ * Esta implementación permite que el funcionamiento sea idéntico a como si el componente
20
+ * estuviera por fuera de cualquier formulario ancestro, garantizando consistencia y
21
+ * previsibilidad en todos los escenarios de uso.
22
+ * @returns Componente de popover con formulario de filtros
3
23
  */
4
24
  declare function PopoverFilter(): import("react/jsx-runtime").JSX.Element | null;
5
25
  export default PopoverFilter;
@@ -1,11 +1,31 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useModuleDictionary } from "@m4l/core";
3
+ import { useFormContext } from "react-hook-form";
2
4
  import { D as DataTypeComponent } from "../FieldTypes/DataTypeComponent.js";
3
5
  import { u as usePopoverFilter } from "./usePopoverFilter.js";
4
6
  import { P as PopoverStyled, h as PopoverContainerFieldsStyled, i as PopoverHeaderActionsStyled } from "../../slots/dynamicFilterSlots.js";
5
7
  import { R as RHFormProvider } from "../../../hook-form/RHFormProvider/RHFormProvider.js";
6
8
  import { W as WindowBase } from "../../../WindowBase/WindowBase.js";
7
9
  import { A as ActionCancel } from "../../../CommonActions/components/ActionCancel/ActionCancel.js";
8
- import { A as ActionIntro } from "../../../CommonActions/components/ActionIntro/ActionIntro.js";
10
+ import { B as Button } from "../../../mui_extended/Button/Button.js";
11
+ function SubmitButton({ onSubmit }) {
12
+ const { getLabel } = useModuleDictionary();
13
+ const { handleSubmit } = useFormContext();
14
+ const handleClick = () => {
15
+ handleSubmit(onSubmit)();
16
+ };
17
+ return /* @__PURE__ */ jsx(
18
+ Button,
19
+ {
20
+ label: getLabel("common_actions.intro"),
21
+ variant: "contained",
22
+ color: "primary",
23
+ skeletonWidth: "64px",
24
+ "aria-label": "applyFilter",
25
+ onClick: handleClick
26
+ }
27
+ );
28
+ }
9
29
  function PopoverFilter() {
10
30
  const {
11
31
  field,
@@ -59,7 +79,7 @@ function PopoverFilter() {
59
79
  /* @__PURE__ */ jsx(PopoverContainerFieldsStyled, { children: /* @__PURE__ */ jsx(DataTypeComponent, { formFilter, statusLoad }) }),
60
80
  /* @__PURE__ */ jsxs(PopoverHeaderActionsStyled, { children: [
61
81
  /* @__PURE__ */ jsx(ActionCancel, { onClick: onClose, skeletonWidth: "68px" }),
62
- /* @__PURE__ */ jsx(ActionIntro, { skeletonWidth: "64px", "aria-label": "applyFilter" })
82
+ /* @__PURE__ */ jsx(SubmitButton, { onSubmit })
63
83
  ] })
64
84
  ]
65
85
  }
@@ -1,5 +1,25 @@
1
1
  /**
2
- * PopoverSort es un componente que permite mostrar un menú desplegable con los campos disponibles para ordenar.
2
+ * PopoverSort: Componente que renderiza el popover de ordenamiento.
3
+ * Este componente implementa un formulario de ordenamiento dentro de un popover. Para garantizar
4
+ * que funcione correctamente en todos los contextos, utiliza un botón con submit programático
5
+ * en lugar de un botón tipo `submit` nativo.
6
+ *
7
+ * **Diseño resiliente:**
8
+ * El componente está diseñado para ser resiliente a casos donde sea contenido por un
9
+ * `RHFormProvider` ancestro. Aunque HTML no permite formularios anidados, este componente
10
+ * puede funcionar dentro de un formulario padre sin afectar su comportamiento, ya que:
11
+ *
12
+ * 1. Utiliza un botón tipo `button` que ejecuta el submit programáticamente mediante
13
+ * `handleSubmit` de react-hook-form, evitando el submit nativo del navegador.
14
+ * 2. No depende de la propagación de eventos del DOM para el submit, lo que elimina
15
+ * la posibilidad de que el formulario ancestro se ejecute accidentalmente.
16
+ * 3. Mantiene el mismo comportamiento y funcionalidad independientemente de si está
17
+ * contenido por un formulario padre o está aislado.
18
+ *
19
+ * Esta implementación permite que el funcionamiento sea idéntico a como si el componente
20
+ * estuviera por fuera de cualquier formulario ancestro, garantizando consistencia y
21
+ * previsibilidad en todos los escenarios de uso.
22
+ * @returns Componente de popover con formulario de ordenamiento
3
23
  */
4
24
  declare function PopoverSort(): import("react/jsx-runtime").JSX.Element | null;
5
25
  export default PopoverSort;
@@ -1,4 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useModuleDictionary } from "@m4l/core";
3
+ import { useFormContext } from "react-hook-form";
2
4
  import { u as useDynamicSortBase } from "../DynamicSortBase/useDynamicSortBase.js";
3
5
  import { D as DataTypeComponent } from "../FieldTypes/DataTypeComponent.js";
4
6
  import { u as usePopoverSort } from "./usePopoverSort.js";
@@ -6,7 +8,29 @@ import { e as PopoverStyled, f as PopoverContainerFieldsStyled, g as PopoverHead
6
8
  import { R as RHFormProvider } from "../../../hook-form/RHFormProvider/RHFormProvider.js";
7
9
  import { W as WindowBase } from "../../../WindowBase/WindowBase.js";
8
10
  import { A as ActionCancel } from "../../../CommonActions/components/ActionCancel/ActionCancel.js";
9
- import { A as ActionIntro } from "../../../CommonActions/components/ActionIntro/ActionIntro.js";
11
+ import { B as Button } from "../../../mui_extended/Button/Button.js";
12
+ function SubmitButton({
13
+ onSubmit,
14
+ size
15
+ }) {
16
+ const { getLabel } = useModuleDictionary();
17
+ const { handleSubmit } = useFormContext();
18
+ const handleClick = () => {
19
+ handleSubmit(onSubmit)();
20
+ };
21
+ return /* @__PURE__ */ jsx(
22
+ Button,
23
+ {
24
+ label: getLabel("common_actions.intro"),
25
+ variant: "contained",
26
+ color: "primary",
27
+ size,
28
+ skeletonWidth: size === "small" ? "80px" : "100px",
29
+ "aria-label": "applySort",
30
+ onClick: handleClick
31
+ }
32
+ );
33
+ }
10
34
  function PopoverSort() {
11
35
  const {
12
36
  field,
@@ -61,7 +85,7 @@ function PopoverSort() {
61
85
  /* @__PURE__ */ jsx(PopoverContainerFieldsStyled, { children: /* @__PURE__ */ jsx(DataTypeComponent, { formSort, statusLoad }) }),
62
86
  /* @__PURE__ */ jsxs(PopoverHeaderActionsStyled, { children: [
63
87
  /* @__PURE__ */ jsx(ActionCancel, { size, onClick: onClose }),
64
- /* @__PURE__ */ jsx(ActionIntro, { size, "aria-label": "applySort" })
88
+ /* @__PURE__ */ jsx(SubmitButton, { onSubmit, size })
65
89
  ] })
66
90
  ]
67
91
  }
@@ -20,6 +20,7 @@ const imageFormatterStyles = {
20
20
  border: `1px solid ${theme.vars.palette.border.disabled}`,
21
21
  ...!ownerState?.hasDefinedSize && {
22
22
  height: "90%",
23
+ width: "auto",
23
24
  aspectRatio: "1 / 1"
24
25
  },
25
26
  objectFit: ownerState?.cover ? "cover" : "contain"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.4.4",
3
+ "version": "9.4.6-BE20251226-beta.1",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {
@@ -1,4 +0,0 @@
1
- /**
2
- * Clave única para identificar el componente IconAction en el sistema
3
- */
4
- export declare const COLUMN_ICON_KEY_COMPONENT = "M4LColumnIconFormatter";