@ceed/cds 1.31.2-next.1 → 1.31.2-next.3

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.
package/dist/index.cjs CHANGED
@@ -3600,12 +3600,13 @@ var BodyCell = (props) => {
3600
3600
  [props.editMode, isCellEditable, params]
3601
3601
  );
3602
3602
  const propsComponentProps = "componentProps" in props ? props.componentProps : null;
3603
+ const hasComponentProps = "componentProps" in props;
3603
3604
  const componentProps = (0, import_react24.useMemo)(
3604
3605
  () => ({
3605
- ..."componentProps" in props && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
3606
+ ...hasComponentProps && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
3606
3607
  size: "sm"
3607
3608
  }),
3608
- [props, propsComponentProps, params]
3609
+ [hasComponentProps, propsComponentProps, params]
3609
3610
  );
3610
3611
  const editModeComponentProps = (0, import_react24.useMemo)(
3611
3612
  () => ({
@@ -3669,9 +3670,11 @@ var BodyCell = (props) => {
3669
3670
  }),
3670
3671
  [params, row, field, value, componentProps, type, onCellEditStop, onCellEditStart]
3671
3672
  );
3673
+ const MemoizedRenderEditCell = (0, import_react24.useMemo)(() => renderEditCell ? (0, import_react24.memo)(renderEditCell) : null, [renderEditCell]);
3674
+ const MemoizedRenderCell = (0, import_react24.useMemo)(() => renderCell ? (0, import_react24.memo)(renderCell) : null, [renderCell]);
3672
3675
  const EditModeComponent = (0, import_react24.useMemo)(() => {
3673
- if (renderEditCell) {
3674
- return (0, import_react24.createElement)((0, import_react24.memo)(renderEditCell), params);
3676
+ if (MemoizedRenderEditCell) {
3677
+ return (0, import_react24.createElement)(MemoizedRenderEditCell, params);
3675
3678
  }
3676
3679
  return {
3677
3680
  date: /* @__PURE__ */ import_react24.default.createElement(DatePicker_default, { value, ...editModeComponentProps }),
@@ -3702,11 +3705,11 @@ var BodyCell = (props) => {
3702
3705
  }
3703
3706
  )
3704
3707
  }[type || "text"];
3705
- }, [value, editModeComponentProps, type, renderEditCell, params]);
3708
+ }, [value, editModeComponentProps, type, MemoizedRenderEditCell, params]);
3706
3709
  const linkComponentFromProps = props.component;
3707
3710
  const ReadModeComponent = (0, import_react24.useMemo)(() => {
3708
- if (renderCell) {
3709
- return (0, import_react24.createElement)((0, import_react24.memo)(renderCell), params);
3711
+ if (MemoizedRenderCell) {
3712
+ return (0, import_react24.createElement)(MemoizedRenderCell, params);
3710
3713
  }
3711
3714
  const innerText = value;
3712
3715
  const typedComponent = {
@@ -3716,7 +3719,7 @@ var BodyCell = (props) => {
3716
3719
  })
3717
3720
  }[type || "text"];
3718
3721
  return typedComponent || innerText;
3719
- }, [value, renderCell, params, type, componentProps, linkComponentFromProps]);
3722
+ }, [value, MemoizedRenderCell, params, type, componentProps, linkComponentFromProps]);
3720
3723
  const getActions = props.getActions;
3721
3724
  const CellComponent = (0, import_react24.useMemo)(() => {
3722
3725
  if (type === "actions") {
@@ -3797,7 +3800,9 @@ var VirtualizedTableRow = (0, import_react24.memo)(StyledTableRow2, (prevProps,
3797
3800
  prevProps["data-row-id"] === nextProps["data-row-id"] && // @ts-ignore
3798
3801
  prevProps["data-index"] === nextProps["data-index"] && prevProps.tabIndex === nextProps.tabIndex && prevProps["aria-checked"] === nextProps["aria-checked"] && // Track column structure changes (e.g. isCellEditable toggled, columns added/removed)
3799
3802
  // @ts-ignore
3800
- prevProps["data-columns-key"] === nextProps["data-columns-key"];
3803
+ prevProps["data-columns-key"] === nextProps["data-columns-key"] && // Track row data changes — ensures re-render when row object reference changes (e.g. after refetch)
3804
+ // @ts-ignore
3805
+ prevProps["data-row-key"] === nextProps["data-row-key"];
3801
3806
  });
3802
3807
 
3803
3808
  // src/components/DataTable/hooks.ts
@@ -4504,13 +4509,13 @@ Pagination.displayName = "Pagination";
4504
4509
  var Pagination_default = Pagination;
4505
4510
 
4506
4511
  // src/components/DataTable/DataTable.tsx
4507
- var _columnsVersionCache = /* @__PURE__ */ new WeakMap();
4508
- var _columnsVersionCounter = 0;
4509
- function getColumnsVersion(columns) {
4510
- if (!_columnsVersionCache.has(columns)) {
4511
- _columnsVersionCache.set(columns, ++_columnsVersionCounter);
4512
+ var _objectVersionCache = /* @__PURE__ */ new WeakMap();
4513
+ var _objectVersionCounter = 0;
4514
+ function getObjectVersion(obj) {
4515
+ if (!_objectVersionCache.has(obj)) {
4516
+ _objectVersionCache.set(obj, ++_objectVersionCounter);
4512
4517
  }
4513
- return _columnsVersionCache.get(columns);
4518
+ return _objectVersionCache.get(obj);
4514
4519
  }
4515
4520
  var EMPTY_CHECKBOX_PROPS = {};
4516
4521
  function Component(props, apiRef) {
@@ -4608,7 +4613,7 @@ function Component(props, apiRef) {
4608
4613
  overscan: 10
4609
4614
  });
4610
4615
  const paginationModel = (0, import_react28.useMemo)(() => ({ page, pageSize }), [page, pageSize]);
4611
- const columnsKey = getColumnsVersion(columns);
4616
+ const columnsKey = getObjectVersion(columns);
4612
4617
  const headerCheckboxElement = (0, import_react28.useMemo)(
4613
4618
  () => /* @__PURE__ */ import_react28.default.createElement(
4614
4619
  RenderCheckbox,
@@ -4932,6 +4937,7 @@ function Component(props, apiRef) {
4932
4937
  key: virtualizedRow.key,
4933
4938
  "data-row-id": rowId,
4934
4939
  "data-index": rowIndex,
4940
+ "data-row-key": getObjectVersion(row),
4935
4941
  "data-columns-key": columnsKey,
4936
4942
  "aria-rowindex": rowIndex + 1,
4937
4943
  role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,
package/dist/index.js CHANGED
@@ -3483,12 +3483,13 @@ var BodyCell = (props) => {
3483
3483
  [props.editMode, isCellEditable, params]
3484
3484
  );
3485
3485
  const propsComponentProps = "componentProps" in props ? props.componentProps : null;
3486
+ const hasComponentProps = "componentProps" in props;
3486
3487
  const componentProps = useMemo8(
3487
3488
  () => ({
3488
- ..."componentProps" in props && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
3489
+ ...hasComponentProps && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
3489
3490
  size: "sm"
3490
3491
  }),
3491
- [props, propsComponentProps, params]
3492
+ [hasComponentProps, propsComponentProps, params]
3492
3493
  );
3493
3494
  const editModeComponentProps = useMemo8(
3494
3495
  () => ({
@@ -3552,9 +3553,11 @@ var BodyCell = (props) => {
3552
3553
  }),
3553
3554
  [params, row, field, value, componentProps, type, onCellEditStop, onCellEditStart]
3554
3555
  );
3556
+ const MemoizedRenderEditCell = useMemo8(() => renderEditCell ? memo(renderEditCell) : null, [renderEditCell]);
3557
+ const MemoizedRenderCell = useMemo8(() => renderCell ? memo(renderCell) : null, [renderCell]);
3555
3558
  const EditModeComponent = useMemo8(() => {
3556
- if (renderEditCell) {
3557
- return createElement(memo(renderEditCell), params);
3559
+ if (MemoizedRenderEditCell) {
3560
+ return createElement(MemoizedRenderEditCell, params);
3558
3561
  }
3559
3562
  return {
3560
3563
  date: /* @__PURE__ */ React22.createElement(DatePicker_default, { value, ...editModeComponentProps }),
@@ -3585,11 +3588,11 @@ var BodyCell = (props) => {
3585
3588
  }
3586
3589
  )
3587
3590
  }[type || "text"];
3588
- }, [value, editModeComponentProps, type, renderEditCell, params]);
3591
+ }, [value, editModeComponentProps, type, MemoizedRenderEditCell, params]);
3589
3592
  const linkComponentFromProps = props.component;
3590
3593
  const ReadModeComponent = useMemo8(() => {
3591
- if (renderCell) {
3592
- return createElement(memo(renderCell), params);
3594
+ if (MemoizedRenderCell) {
3595
+ return createElement(MemoizedRenderCell, params);
3593
3596
  }
3594
3597
  const innerText = value;
3595
3598
  const typedComponent = {
@@ -3599,7 +3602,7 @@ var BodyCell = (props) => {
3599
3602
  })
3600
3603
  }[type || "text"];
3601
3604
  return typedComponent || innerText;
3602
- }, [value, renderCell, params, type, componentProps, linkComponentFromProps]);
3605
+ }, [value, MemoizedRenderCell, params, type, componentProps, linkComponentFromProps]);
3603
3606
  const getActions = props.getActions;
3604
3607
  const CellComponent = useMemo8(() => {
3605
3608
  if (type === "actions") {
@@ -3680,7 +3683,9 @@ var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
3680
3683
  prevProps["data-row-id"] === nextProps["data-row-id"] && // @ts-ignore
3681
3684
  prevProps["data-index"] === nextProps["data-index"] && prevProps.tabIndex === nextProps.tabIndex && prevProps["aria-checked"] === nextProps["aria-checked"] && // Track column structure changes (e.g. isCellEditable toggled, columns added/removed)
3682
3685
  // @ts-ignore
3683
- prevProps["data-columns-key"] === nextProps["data-columns-key"];
3686
+ prevProps["data-columns-key"] === nextProps["data-columns-key"] && // Track row data changes — ensures re-render when row object reference changes (e.g. after refetch)
3687
+ // @ts-ignore
3688
+ prevProps["data-row-key"] === nextProps["data-row-key"];
3684
3689
  });
3685
3690
 
3686
3691
  // src/components/DataTable/hooks.ts
@@ -4387,13 +4392,13 @@ Pagination.displayName = "Pagination";
4387
4392
  var Pagination_default = Pagination;
4388
4393
 
4389
4394
  // src/components/DataTable/DataTable.tsx
4390
- var _columnsVersionCache = /* @__PURE__ */ new WeakMap();
4391
- var _columnsVersionCounter = 0;
4392
- function getColumnsVersion(columns) {
4393
- if (!_columnsVersionCache.has(columns)) {
4394
- _columnsVersionCache.set(columns, ++_columnsVersionCounter);
4395
+ var _objectVersionCache = /* @__PURE__ */ new WeakMap();
4396
+ var _objectVersionCounter = 0;
4397
+ function getObjectVersion(obj) {
4398
+ if (!_objectVersionCache.has(obj)) {
4399
+ _objectVersionCache.set(obj, ++_objectVersionCounter);
4395
4400
  }
4396
- return _columnsVersionCache.get(columns);
4401
+ return _objectVersionCache.get(obj);
4397
4402
  }
4398
4403
  var EMPTY_CHECKBOX_PROPS = {};
4399
4404
  function Component(props, apiRef) {
@@ -4491,7 +4496,7 @@ function Component(props, apiRef) {
4491
4496
  overscan: 10
4492
4497
  });
4493
4498
  const paginationModel = useMemo10(() => ({ page, pageSize }), [page, pageSize]);
4494
- const columnsKey = getColumnsVersion(columns);
4499
+ const columnsKey = getObjectVersion(columns);
4495
4500
  const headerCheckboxElement = useMemo10(
4496
4501
  () => /* @__PURE__ */ React25.createElement(
4497
4502
  RenderCheckbox,
@@ -4815,6 +4820,7 @@ function Component(props, apiRef) {
4815
4820
  key: virtualizedRow.key,
4816
4821
  "data-row-id": rowId,
4817
4822
  "data-index": rowIndex,
4823
+ "data-row-key": getObjectVersion(row),
4818
4824
  "data-columns-key": columnsKey,
4819
4825
  "aria-rowindex": rowIndex + 1,
4820
4826
  role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,