@ceed/cds 1.31.1-next.2 → 1.31.2-next.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.
package/dist/index.cjs CHANGED
@@ -3795,8 +3795,9 @@ var StyledTableRow2 = (0, import_joy32.styled)("tr", {
3795
3795
  var VirtualizedTableRow = (0, import_react24.memo)(StyledTableRow2, (prevProps, nextProps) => {
3796
3796
  return prevProps.striped === nextProps.striped && prevProps.style?.height === nextProps.style?.height && prevProps.style?.transform === nextProps.style?.transform && // @ts-ignore
3797
3797
  prevProps["data-row-id"] === nextProps["data-row-id"] && // @ts-ignore
3798
- prevProps["data-index"] === nextProps["data-index"] && prevProps.tabIndex === nextProps.tabIndex && prevProps["aria-checked"] === nextProps["aria-checked"] && // Include children check to handle isCellEditable changes
3799
- prevProps.children === nextProps.children;
3798
+ 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
+ // @ts-ignore
3800
+ prevProps["data-columns-key"] === nextProps["data-columns-key"];
3800
3801
  });
3801
3802
 
3802
3803
  // src/components/DataTable/hooks.ts
@@ -4503,6 +4504,15 @@ Pagination.displayName = "Pagination";
4503
4504
  var Pagination_default = Pagination;
4504
4505
 
4505
4506
  // 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
+ }
4513
+ return _columnsVersionCache.get(columns);
4514
+ }
4515
+ var EMPTY_CHECKBOX_PROPS = {};
4506
4516
  function Component(props, apiRef) {
4507
4517
  const {
4508
4518
  rows,
@@ -4550,7 +4560,7 @@ function Component(props, apiRef) {
4550
4560
  noRowsOverlay: NoRowsOverlay = DefaultNoRowsOverlay
4551
4561
  } = {},
4552
4562
  slotProps: {
4553
- checkbox: checkboxProps = {},
4563
+ checkbox: checkboxProps = EMPTY_CHECKBOX_PROPS,
4554
4564
  toolbar: toolbarProps,
4555
4565
  background: backgroundProps = {},
4556
4566
  noRowsOverlay: noRowsOverlayProps = {}
@@ -4598,6 +4608,28 @@ function Component(props, apiRef) {
4598
4608
  overscan: 10
4599
4609
  });
4600
4610
  const paginationModel = (0, import_react28.useMemo)(() => ({ page, pageSize }), [page, pageSize]);
4611
+ const columnsKey = getColumnsVersion(columns);
4612
+ const headerCheckboxElement = (0, import_react28.useMemo)(
4613
+ () => /* @__PURE__ */ import_react28.default.createElement(
4614
+ RenderCheckbox,
4615
+ {
4616
+ onChange: onAllCheckboxChange,
4617
+ checked: isAllSelected,
4618
+ indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4619
+ disabled: dataInPage.length > 0 && !selectableRowCount,
4620
+ ...checkboxProps
4621
+ }
4622
+ ),
4623
+ [
4624
+ RenderCheckbox,
4625
+ onAllCheckboxChange,
4626
+ isAllSelected,
4627
+ selectionModel,
4628
+ selectableRowCount,
4629
+ dataInPage.length,
4630
+ checkboxProps
4631
+ ]
4632
+ );
4601
4633
  const totalSize = virtualizer.getTotalSize();
4602
4634
  const virtualizedItems = virtualizer.getVirtualItems();
4603
4635
  const showNoRowsOverlay = !loading && rowCount === 0;
@@ -4802,16 +4834,7 @@ function Component(props, apiRef) {
4802
4834
  verticalAlign: "middle"
4803
4835
  }
4804
4836
  },
4805
- /* @__PURE__ */ import_react28.default.createElement(
4806
- RenderCheckbox,
4807
- {
4808
- onChange: onAllCheckboxChange,
4809
- checked: isAllSelected,
4810
- indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4811
- disabled: dataInPage.length > 0 && !selectableRowCount,
4812
- ...checkboxProps
4813
- }
4814
- )
4837
+ headerCheckboxElement
4815
4838
  ), level > 0 && Array.from({ length: levelGroups[0]?.startIndex || 0 }).map((_2, i) => /* @__PURE__ */ import_react28.default.createElement("th", { key: `empty-${level}-${i}` })), levelGroups.filter((g) => g.colspan > 0).map((group, groupIndex) => {
4816
4839
  const nextGroup = levelGroups[groupIndex + 1];
4817
4840
  const emptyCells = nextGroup ? nextGroup.startIndex - (group.startIndex + group.colspan) : columns.length - (group.startIndex + group.colspan);
@@ -4838,16 +4861,7 @@ function Component(props, apiRef) {
4838
4861
  textAlign: "center"
4839
4862
  }
4840
4863
  },
4841
- /* @__PURE__ */ import_react28.default.createElement(
4842
- RenderCheckbox,
4843
- {
4844
- onChange: onAllCheckboxChange,
4845
- checked: isAllSelected,
4846
- indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4847
- disabled: dataInPage.length > 0 && !selectableRowCount,
4848
- ...checkboxProps
4849
- }
4850
- )
4864
+ headerCheckboxElement
4851
4865
  ), columns.map((c, i) => (
4852
4866
  // @ts-ignore
4853
4867
  /* @__PURE__ */ import_react28.default.createElement(
@@ -4918,6 +4932,7 @@ function Component(props, apiRef) {
4918
4932
  key: virtualizedRow.key,
4919
4933
  "data-row-id": rowId,
4920
4934
  "data-index": rowIndex,
4935
+ "data-columns-key": columnsKey,
4921
4936
  "aria-rowindex": rowIndex + 1,
4922
4937
  role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,
4923
4938
  tabIndex: focusedRowId === rowId ? 0 : -1,
package/dist/index.js CHANGED
@@ -3678,8 +3678,9 @@ var StyledTableRow2 = styled12("tr", {
3678
3678
  var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
3679
3679
  return prevProps.striped === nextProps.striped && prevProps.style?.height === nextProps.style?.height && prevProps.style?.transform === nextProps.style?.transform && // @ts-ignore
3680
3680
  prevProps["data-row-id"] === nextProps["data-row-id"] && // @ts-ignore
3681
- prevProps["data-index"] === nextProps["data-index"] && prevProps.tabIndex === nextProps.tabIndex && prevProps["aria-checked"] === nextProps["aria-checked"] && // Include children check to handle isCellEditable changes
3682
- prevProps.children === nextProps.children;
3681
+ 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
+ // @ts-ignore
3683
+ prevProps["data-columns-key"] === nextProps["data-columns-key"];
3683
3684
  });
3684
3685
 
3685
3686
  // src/components/DataTable/hooks.ts
@@ -4386,6 +4387,15 @@ Pagination.displayName = "Pagination";
4386
4387
  var Pagination_default = Pagination;
4387
4388
 
4388
4389
  // 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
+ }
4396
+ return _columnsVersionCache.get(columns);
4397
+ }
4398
+ var EMPTY_CHECKBOX_PROPS = {};
4389
4399
  function Component(props, apiRef) {
4390
4400
  const {
4391
4401
  rows,
@@ -4433,7 +4443,7 @@ function Component(props, apiRef) {
4433
4443
  noRowsOverlay: NoRowsOverlay = DefaultNoRowsOverlay
4434
4444
  } = {},
4435
4445
  slotProps: {
4436
- checkbox: checkboxProps = {},
4446
+ checkbox: checkboxProps = EMPTY_CHECKBOX_PROPS,
4437
4447
  toolbar: toolbarProps,
4438
4448
  background: backgroundProps = {},
4439
4449
  noRowsOverlay: noRowsOverlayProps = {}
@@ -4481,6 +4491,28 @@ function Component(props, apiRef) {
4481
4491
  overscan: 10
4482
4492
  });
4483
4493
  const paginationModel = useMemo10(() => ({ page, pageSize }), [page, pageSize]);
4494
+ const columnsKey = getColumnsVersion(columns);
4495
+ const headerCheckboxElement = useMemo10(
4496
+ () => /* @__PURE__ */ React25.createElement(
4497
+ RenderCheckbox,
4498
+ {
4499
+ onChange: onAllCheckboxChange,
4500
+ checked: isAllSelected,
4501
+ indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4502
+ disabled: dataInPage.length > 0 && !selectableRowCount,
4503
+ ...checkboxProps
4504
+ }
4505
+ ),
4506
+ [
4507
+ RenderCheckbox,
4508
+ onAllCheckboxChange,
4509
+ isAllSelected,
4510
+ selectionModel,
4511
+ selectableRowCount,
4512
+ dataInPage.length,
4513
+ checkboxProps
4514
+ ]
4515
+ );
4484
4516
  const totalSize = virtualizer.getTotalSize();
4485
4517
  const virtualizedItems = virtualizer.getVirtualItems();
4486
4518
  const showNoRowsOverlay = !loading && rowCount === 0;
@@ -4685,16 +4717,7 @@ function Component(props, apiRef) {
4685
4717
  verticalAlign: "middle"
4686
4718
  }
4687
4719
  },
4688
- /* @__PURE__ */ React25.createElement(
4689
- RenderCheckbox,
4690
- {
4691
- onChange: onAllCheckboxChange,
4692
- checked: isAllSelected,
4693
- indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4694
- disabled: dataInPage.length > 0 && !selectableRowCount,
4695
- ...checkboxProps
4696
- }
4697
- )
4720
+ headerCheckboxElement
4698
4721
  ), level > 0 && Array.from({ length: levelGroups[0]?.startIndex || 0 }).map((_2, i) => /* @__PURE__ */ React25.createElement("th", { key: `empty-${level}-${i}` })), levelGroups.filter((g) => g.colspan > 0).map((group, groupIndex) => {
4699
4722
  const nextGroup = levelGroups[groupIndex + 1];
4700
4723
  const emptyCells = nextGroup ? nextGroup.startIndex - (group.startIndex + group.colspan) : columns.length - (group.startIndex + group.colspan);
@@ -4721,16 +4744,7 @@ function Component(props, apiRef) {
4721
4744
  textAlign: "center"
4722
4745
  }
4723
4746
  },
4724
- /* @__PURE__ */ React25.createElement(
4725
- RenderCheckbox,
4726
- {
4727
- onChange: onAllCheckboxChange,
4728
- checked: isAllSelected,
4729
- indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4730
- disabled: dataInPage.length > 0 && !selectableRowCount,
4731
- ...checkboxProps
4732
- }
4733
- )
4747
+ headerCheckboxElement
4734
4748
  ), columns.map((c, i) => (
4735
4749
  // @ts-ignore
4736
4750
  /* @__PURE__ */ React25.createElement(
@@ -4801,6 +4815,7 @@ function Component(props, apiRef) {
4801
4815
  key: virtualizedRow.key,
4802
4816
  "data-row-id": rowId,
4803
4817
  "data-index": rowIndex,
4818
+ "data-columns-key": columnsKey,
4804
4819
  "aria-rowindex": rowIndex + 1,
4805
4820
  role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,
4806
4821
  tabIndex: focusedRowId === rowId ? 0 : -1,