@m4l/components 9.3.29-JT19112025.beta.3 → 9.3.29-JT19112025.beta.5

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.
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useModuleDictionary, useEnvironment } from "@m4l/core";
3
3
  import { useIsMobile } from "@m4l/graphics";
4
- import { useCallback } from "react";
4
+ import { useRef, useEffect, useCallback } from "react";
5
5
  import { u as useModal } from "../../../hooks/useModal/index.js";
6
6
  import { a as ContentModalSettingStyled, D as DataGridRootStyled } from "../slots/DataGridSlot.js";
7
7
  import { p as pathIcons } from "../icons.js";
@@ -22,10 +22,14 @@ const useModalDetail = ({
22
22
  const { getLabel } = useModuleDictionary();
23
23
  const { host_static_assets, environment_assets } = useEnvironment();
24
24
  const isMobile = useIsMobile();
25
+ const rowsRef = useRef(rows);
26
+ useEffect(() => {
27
+ rowsRef.current = rows;
28
+ }, [rows]);
25
29
  const handleOpenDetail = useCallback(
26
30
  (row) => {
27
31
  const viewColumnsConfig = getConfigColumns(viewMode);
28
- const rowIndex = rows.findIndex((r) => r === row);
32
+ const rowIndex = rowsRef.current.findIndex((r) => r === row);
29
33
  openModal({
30
34
  initialWidth: 500,
31
35
  initialHeight: 680,
@@ -44,7 +48,7 @@ const useModalDetail = ({
44
48
  CardDetails,
45
49
  {
46
50
  row,
47
- rows,
51
+ rows: rowsRef.current,
48
52
  rowIndex,
49
53
  columns,
50
54
  viewColumnsConfig,
@@ -60,7 +64,6 @@ const useModalDetail = ({
60
64
  },
61
65
  [
62
66
  columns,
63
- rows,
64
67
  onRowsChange,
65
68
  size,
66
69
  getConfigColumns,
@@ -19,6 +19,7 @@ function CardDetails({
19
19
  const { getLabel } = useModuleDictionary();
20
20
  const { host_static_assets, environment_assets } = useEnvironment();
21
21
  const { currentSize } = useComponentSize(size);
22
+ const currentRow = rows[rowIndex] || row;
22
23
  const handleForceRefresh = useCallback(() => {
23
24
  setRefreshCounter((prev) => prev + 1);
24
25
  }, []);
@@ -56,7 +57,7 @@ function CardDetails({
56
57
  if (modifiedColumn.renderEditCell && editingColumnKey === modifiedColumn.key) {
57
58
  return /* @__PURE__ */ jsx(EditorCellWrapperStyled, { ownerState: { size }, children: modifiedColumn.renderEditCell({
58
59
  column: originalColumn,
59
- row,
60
+ row: currentRow,
60
61
  rowIdx: index,
61
62
  /**
62
63
  * onRowChange es una función que se ejecuta cuando el usuario edita una celda.
@@ -78,7 +79,7 @@ function CardDetails({
78
79
  if (modifiedColumn.renderCell) {
79
80
  const cellContent = modifiedColumn.renderCell({
80
81
  column: modifiedColumn,
81
- row,
82
+ row: currentRow,
82
83
  rowIdx: index,
83
84
  isCellSelected: false,
84
85
  tabIndex: -1,
@@ -99,7 +100,7 @@ function CardDetails({
99
100
  });
100
101
  return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: cellContent });
101
102
  }
102
- const rawValue = row[modifiedColumn.key];
103
+ const rawValue = currentRow[modifiedColumn.key];
103
104
  const isEmpty = rawValue === null || rawValue === void 0 || rawValue === "";
104
105
  const isEditable = !!modifiedColumn.renderEditCell;
105
106
  if (isEditable) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.3.29-JT19112025.beta.3",
3
+ "version": "9.3.29-JT19112025.beta.5",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {