@ceed/ads 1.32.1 → 1.32.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
@@ -3793,8 +3793,9 @@ var StyledTableRow2 = (0, import_joy32.styled)("tr", {
3793
3793
  var VirtualizedTableRow = (0, import_react24.memo)(StyledTableRow2, (prevProps, nextProps) => {
3794
3794
  return prevProps.striped === nextProps.striped && prevProps.style?.height === nextProps.style?.height && prevProps.style?.transform === nextProps.style?.transform && // @ts-ignore
3795
3795
  prevProps["data-row-id"] === nextProps["data-row-id"] && // @ts-ignore
3796
- prevProps["data-index"] === nextProps["data-index"] && prevProps.tabIndex === nextProps.tabIndex && prevProps["aria-checked"] === nextProps["aria-checked"] && // Include children check to handle isCellEditable changes
3797
- prevProps.children === nextProps.children;
3796
+ 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)
3797
+ // @ts-ignore
3798
+ prevProps["data-columns-key"] === nextProps["data-columns-key"];
3798
3799
  });
3799
3800
 
3800
3801
  // src/components/DataTable/hooks.ts
@@ -4501,6 +4502,15 @@ Pagination.displayName = "Pagination";
4501
4502
  var Pagination_default = Pagination;
4502
4503
 
4503
4504
  // src/components/DataTable/DataTable.tsx
4505
+ var _columnsVersionCache = /* @__PURE__ */ new WeakMap();
4506
+ var _columnsVersionCounter = 0;
4507
+ function getColumnsVersion(columns) {
4508
+ if (!_columnsVersionCache.has(columns)) {
4509
+ _columnsVersionCache.set(columns, ++_columnsVersionCounter);
4510
+ }
4511
+ return _columnsVersionCache.get(columns);
4512
+ }
4513
+ var EMPTY_CHECKBOX_PROPS = {};
4504
4514
  function Component(props, apiRef) {
4505
4515
  const {
4506
4516
  rows,
@@ -4548,7 +4558,7 @@ function Component(props, apiRef) {
4548
4558
  noRowsOverlay: NoRowsOverlay = DefaultNoRowsOverlay
4549
4559
  } = {},
4550
4560
  slotProps: {
4551
- checkbox: checkboxProps = {},
4561
+ checkbox: checkboxProps = EMPTY_CHECKBOX_PROPS,
4552
4562
  toolbar: toolbarProps,
4553
4563
  background: backgroundProps = {},
4554
4564
  noRowsOverlay: noRowsOverlayProps = {}
@@ -4596,6 +4606,28 @@ function Component(props, apiRef) {
4596
4606
  overscan: 10
4597
4607
  });
4598
4608
  const paginationModel = (0, import_react28.useMemo)(() => ({ page, pageSize }), [page, pageSize]);
4609
+ const columnsKey = getColumnsVersion(columns);
4610
+ const headerCheckboxElement = (0, import_react28.useMemo)(
4611
+ () => /* @__PURE__ */ import_react28.default.createElement(
4612
+ RenderCheckbox,
4613
+ {
4614
+ onChange: onAllCheckboxChange,
4615
+ checked: isAllSelected,
4616
+ indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4617
+ disabled: dataInPage.length > 0 && !selectableRowCount,
4618
+ ...checkboxProps
4619
+ }
4620
+ ),
4621
+ [
4622
+ RenderCheckbox,
4623
+ onAllCheckboxChange,
4624
+ isAllSelected,
4625
+ selectionModel,
4626
+ selectableRowCount,
4627
+ dataInPage.length,
4628
+ checkboxProps
4629
+ ]
4630
+ );
4599
4631
  const totalSize = virtualizer.getTotalSize();
4600
4632
  const virtualizedItems = virtualizer.getVirtualItems();
4601
4633
  const showNoRowsOverlay = !loading && rowCount === 0;
@@ -4800,16 +4832,7 @@ function Component(props, apiRef) {
4800
4832
  verticalAlign: "middle"
4801
4833
  }
4802
4834
  },
4803
- /* @__PURE__ */ import_react28.default.createElement(
4804
- RenderCheckbox,
4805
- {
4806
- onChange: onAllCheckboxChange,
4807
- checked: isAllSelected,
4808
- indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4809
- disabled: dataInPage.length > 0 && !selectableRowCount,
4810
- ...checkboxProps
4811
- }
4812
- )
4835
+ headerCheckboxElement
4813
4836
  ), 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) => {
4814
4837
  const nextGroup = levelGroups[groupIndex + 1];
4815
4838
  const emptyCells = nextGroup ? nextGroup.startIndex - (group.startIndex + group.colspan) : columns.length - (group.startIndex + group.colspan);
@@ -4836,16 +4859,7 @@ function Component(props, apiRef) {
4836
4859
  textAlign: "center"
4837
4860
  }
4838
4861
  },
4839
- /* @__PURE__ */ import_react28.default.createElement(
4840
- RenderCheckbox,
4841
- {
4842
- onChange: onAllCheckboxChange,
4843
- checked: isAllSelected,
4844
- indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4845
- disabled: dataInPage.length > 0 && !selectableRowCount,
4846
- ...checkboxProps
4847
- }
4848
- )
4862
+ headerCheckboxElement
4849
4863
  ), columns.map((c, i) => (
4850
4864
  // @ts-ignore
4851
4865
  /* @__PURE__ */ import_react28.default.createElement(
@@ -4916,6 +4930,7 @@ function Component(props, apiRef) {
4916
4930
  key: virtualizedRow.key,
4917
4931
  "data-row-id": rowId,
4918
4932
  "data-index": rowIndex,
4933
+ "data-columns-key": columnsKey,
4919
4934
  "aria-rowindex": rowIndex + 1,
4920
4935
  role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,
4921
4936
  tabIndex: focusedRowId === rowId ? 0 : -1,
package/dist/index.js CHANGED
@@ -3668,8 +3668,9 @@ var StyledTableRow2 = styled12("tr", {
3668
3668
  var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
3669
3669
  return prevProps.striped === nextProps.striped && prevProps.style?.height === nextProps.style?.height && prevProps.style?.transform === nextProps.style?.transform && // @ts-ignore
3670
3670
  prevProps["data-row-id"] === nextProps["data-row-id"] && // @ts-ignore
3671
- prevProps["data-index"] === nextProps["data-index"] && prevProps.tabIndex === nextProps.tabIndex && prevProps["aria-checked"] === nextProps["aria-checked"] && // Include children check to handle isCellEditable changes
3672
- prevProps.children === nextProps.children;
3671
+ 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)
3672
+ // @ts-ignore
3673
+ prevProps["data-columns-key"] === nextProps["data-columns-key"];
3673
3674
  });
3674
3675
 
3675
3676
  // src/components/DataTable/hooks.ts
@@ -4376,6 +4377,15 @@ Pagination.displayName = "Pagination";
4376
4377
  var Pagination_default = Pagination;
4377
4378
 
4378
4379
  // src/components/DataTable/DataTable.tsx
4380
+ var _columnsVersionCache = /* @__PURE__ */ new WeakMap();
4381
+ var _columnsVersionCounter = 0;
4382
+ function getColumnsVersion(columns) {
4383
+ if (!_columnsVersionCache.has(columns)) {
4384
+ _columnsVersionCache.set(columns, ++_columnsVersionCounter);
4385
+ }
4386
+ return _columnsVersionCache.get(columns);
4387
+ }
4388
+ var EMPTY_CHECKBOX_PROPS = {};
4379
4389
  function Component(props, apiRef) {
4380
4390
  const {
4381
4391
  rows,
@@ -4423,7 +4433,7 @@ function Component(props, apiRef) {
4423
4433
  noRowsOverlay: NoRowsOverlay = DefaultNoRowsOverlay
4424
4434
  } = {},
4425
4435
  slotProps: {
4426
- checkbox: checkboxProps = {},
4436
+ checkbox: checkboxProps = EMPTY_CHECKBOX_PROPS,
4427
4437
  toolbar: toolbarProps,
4428
4438
  background: backgroundProps = {},
4429
4439
  noRowsOverlay: noRowsOverlayProps = {}
@@ -4471,6 +4481,28 @@ function Component(props, apiRef) {
4471
4481
  overscan: 10
4472
4482
  });
4473
4483
  const paginationModel = useMemo10(() => ({ page, pageSize }), [page, pageSize]);
4484
+ const columnsKey = getColumnsVersion(columns);
4485
+ const headerCheckboxElement = useMemo10(
4486
+ () => /* @__PURE__ */ React25.createElement(
4487
+ RenderCheckbox,
4488
+ {
4489
+ onChange: onAllCheckboxChange,
4490
+ checked: isAllSelected,
4491
+ indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4492
+ disabled: dataInPage.length > 0 && !selectableRowCount,
4493
+ ...checkboxProps
4494
+ }
4495
+ ),
4496
+ [
4497
+ RenderCheckbox,
4498
+ onAllCheckboxChange,
4499
+ isAllSelected,
4500
+ selectionModel,
4501
+ selectableRowCount,
4502
+ dataInPage.length,
4503
+ checkboxProps
4504
+ ]
4505
+ );
4474
4506
  const totalSize = virtualizer.getTotalSize();
4475
4507
  const virtualizedItems = virtualizer.getVirtualItems();
4476
4508
  const showNoRowsOverlay = !loading && rowCount === 0;
@@ -4675,16 +4707,7 @@ function Component(props, apiRef) {
4675
4707
  verticalAlign: "middle"
4676
4708
  }
4677
4709
  },
4678
- /* @__PURE__ */ React25.createElement(
4679
- RenderCheckbox,
4680
- {
4681
- onChange: onAllCheckboxChange,
4682
- checked: isAllSelected,
4683
- indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4684
- disabled: dataInPage.length > 0 && !selectableRowCount,
4685
- ...checkboxProps
4686
- }
4687
- )
4710
+ headerCheckboxElement
4688
4711
  ), 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) => {
4689
4712
  const nextGroup = levelGroups[groupIndex + 1];
4690
4713
  const emptyCells = nextGroup ? nextGroup.startIndex - (group.startIndex + group.colspan) : columns.length - (group.startIndex + group.colspan);
@@ -4711,16 +4734,7 @@ function Component(props, apiRef) {
4711
4734
  textAlign: "center"
4712
4735
  }
4713
4736
  },
4714
- /* @__PURE__ */ React25.createElement(
4715
- RenderCheckbox,
4716
- {
4717
- onChange: onAllCheckboxChange,
4718
- checked: isAllSelected,
4719
- indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4720
- disabled: dataInPage.length > 0 && !selectableRowCount,
4721
- ...checkboxProps
4722
- }
4723
- )
4737
+ headerCheckboxElement
4724
4738
  ), columns.map((c, i) => (
4725
4739
  // @ts-ignore
4726
4740
  /* @__PURE__ */ React25.createElement(
@@ -4791,6 +4805,7 @@ function Component(props, apiRef) {
4791
4805
  key: virtualizedRow.key,
4792
4806
  "data-row-id": rowId,
4793
4807
  "data-index": rowIndex,
4808
+ "data-columns-key": columnsKey,
4794
4809
  "aria-rowindex": rowIndex + 1,
4795
4810
  role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,
4796
4811
  tabIndex: focusedRowId === rowId ? 0 : -1,