@ceed/ads 1.32.1 → 1.32.2-next.2

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
@@ -3598,12 +3598,13 @@ var BodyCell = (props) => {
3598
3598
  [props.editMode, isCellEditable, params]
3599
3599
  );
3600
3600
  const propsComponentProps = "componentProps" in props ? props.componentProps : null;
3601
+ const hasComponentProps = "componentProps" in props;
3601
3602
  const componentProps = (0, import_react24.useMemo)(
3602
3603
  () => ({
3603
- ..."componentProps" in props && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
3604
+ ...hasComponentProps && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
3604
3605
  size: "sm"
3605
3606
  }),
3606
- [props, propsComponentProps, params]
3607
+ [hasComponentProps, propsComponentProps, params]
3607
3608
  );
3608
3609
  const editModeComponentProps = (0, import_react24.useMemo)(
3609
3610
  () => ({
@@ -3667,9 +3668,11 @@ var BodyCell = (props) => {
3667
3668
  }),
3668
3669
  [params, row, field, value, componentProps, type, onCellEditStop, onCellEditStart]
3669
3670
  );
3671
+ const MemoizedRenderEditCell = (0, import_react24.useMemo)(() => renderEditCell ? (0, import_react24.memo)(renderEditCell) : null, [renderEditCell]);
3672
+ const MemoizedRenderCell = (0, import_react24.useMemo)(() => renderCell ? (0, import_react24.memo)(renderCell) : null, [renderCell]);
3670
3673
  const EditModeComponent = (0, import_react24.useMemo)(() => {
3671
- if (renderEditCell) {
3672
- return (0, import_react24.createElement)((0, import_react24.memo)(renderEditCell), params);
3674
+ if (MemoizedRenderEditCell) {
3675
+ return (0, import_react24.createElement)(MemoizedRenderEditCell, params);
3673
3676
  }
3674
3677
  return {
3675
3678
  date: /* @__PURE__ */ import_react24.default.createElement(DatePicker_default, { value, ...editModeComponentProps }),
@@ -3700,11 +3703,11 @@ var BodyCell = (props) => {
3700
3703
  }
3701
3704
  )
3702
3705
  }[type || "text"];
3703
- }, [value, editModeComponentProps, type, renderEditCell, params]);
3706
+ }, [value, editModeComponentProps, type, MemoizedRenderEditCell, params]);
3704
3707
  const linkComponentFromProps = props.component;
3705
3708
  const ReadModeComponent = (0, import_react24.useMemo)(() => {
3706
- if (renderCell) {
3707
- return (0, import_react24.createElement)((0, import_react24.memo)(renderCell), params);
3709
+ if (MemoizedRenderCell) {
3710
+ return (0, import_react24.createElement)(MemoizedRenderCell, params);
3708
3711
  }
3709
3712
  const innerText = value;
3710
3713
  const typedComponent = {
@@ -3714,7 +3717,7 @@ var BodyCell = (props) => {
3714
3717
  })
3715
3718
  }[type || "text"];
3716
3719
  return typedComponent || innerText;
3717
- }, [value, renderCell, params, type, componentProps, linkComponentFromProps]);
3720
+ }, [value, MemoizedRenderCell, params, type, componentProps, linkComponentFromProps]);
3718
3721
  const getActions = props.getActions;
3719
3722
  const CellComponent = (0, import_react24.useMemo)(() => {
3720
3723
  if (type === "actions") {
@@ -3793,8 +3796,9 @@ var StyledTableRow2 = (0, import_joy32.styled)("tr", {
3793
3796
  var VirtualizedTableRow = (0, import_react24.memo)(StyledTableRow2, (prevProps, nextProps) => {
3794
3797
  return prevProps.striped === nextProps.striped && prevProps.style?.height === nextProps.style?.height && prevProps.style?.transform === nextProps.style?.transform && // @ts-ignore
3795
3798
  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;
3799
+ 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)
3800
+ // @ts-ignore
3801
+ prevProps["data-columns-key"] === nextProps["data-columns-key"];
3798
3802
  });
3799
3803
 
3800
3804
  // src/components/DataTable/hooks.ts
@@ -4501,6 +4505,15 @@ Pagination.displayName = "Pagination";
4501
4505
  var Pagination_default = Pagination;
4502
4506
 
4503
4507
  // src/components/DataTable/DataTable.tsx
4508
+ var _columnsVersionCache = /* @__PURE__ */ new WeakMap();
4509
+ var _columnsVersionCounter = 0;
4510
+ function getColumnsVersion(columns) {
4511
+ if (!_columnsVersionCache.has(columns)) {
4512
+ _columnsVersionCache.set(columns, ++_columnsVersionCounter);
4513
+ }
4514
+ return _columnsVersionCache.get(columns);
4515
+ }
4516
+ var EMPTY_CHECKBOX_PROPS = {};
4504
4517
  function Component(props, apiRef) {
4505
4518
  const {
4506
4519
  rows,
@@ -4548,7 +4561,7 @@ function Component(props, apiRef) {
4548
4561
  noRowsOverlay: NoRowsOverlay = DefaultNoRowsOverlay
4549
4562
  } = {},
4550
4563
  slotProps: {
4551
- checkbox: checkboxProps = {},
4564
+ checkbox: checkboxProps = EMPTY_CHECKBOX_PROPS,
4552
4565
  toolbar: toolbarProps,
4553
4566
  background: backgroundProps = {},
4554
4567
  noRowsOverlay: noRowsOverlayProps = {}
@@ -4596,6 +4609,28 @@ function Component(props, apiRef) {
4596
4609
  overscan: 10
4597
4610
  });
4598
4611
  const paginationModel = (0, import_react28.useMemo)(() => ({ page, pageSize }), [page, pageSize]);
4612
+ const columnsKey = getColumnsVersion(columns);
4613
+ const headerCheckboxElement = (0, import_react28.useMemo)(
4614
+ () => /* @__PURE__ */ import_react28.default.createElement(
4615
+ RenderCheckbox,
4616
+ {
4617
+ onChange: onAllCheckboxChange,
4618
+ checked: isAllSelected,
4619
+ indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4620
+ disabled: dataInPage.length > 0 && !selectableRowCount,
4621
+ ...checkboxProps
4622
+ }
4623
+ ),
4624
+ [
4625
+ RenderCheckbox,
4626
+ onAllCheckboxChange,
4627
+ isAllSelected,
4628
+ selectionModel,
4629
+ selectableRowCount,
4630
+ dataInPage.length,
4631
+ checkboxProps
4632
+ ]
4633
+ );
4599
4634
  const totalSize = virtualizer.getTotalSize();
4600
4635
  const virtualizedItems = virtualizer.getVirtualItems();
4601
4636
  const showNoRowsOverlay = !loading && rowCount === 0;
@@ -4800,16 +4835,7 @@ function Component(props, apiRef) {
4800
4835
  verticalAlign: "middle"
4801
4836
  }
4802
4837
  },
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
- )
4838
+ headerCheckboxElement
4813
4839
  ), 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
4840
  const nextGroup = levelGroups[groupIndex + 1];
4815
4841
  const emptyCells = nextGroup ? nextGroup.startIndex - (group.startIndex + group.colspan) : columns.length - (group.startIndex + group.colspan);
@@ -4836,16 +4862,7 @@ function Component(props, apiRef) {
4836
4862
  textAlign: "center"
4837
4863
  }
4838
4864
  },
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
- )
4865
+ headerCheckboxElement
4849
4866
  ), columns.map((c, i) => (
4850
4867
  // @ts-ignore
4851
4868
  /* @__PURE__ */ import_react28.default.createElement(
@@ -4916,6 +4933,7 @@ function Component(props, apiRef) {
4916
4933
  key: virtualizedRow.key,
4917
4934
  "data-row-id": rowId,
4918
4935
  "data-index": rowIndex,
4936
+ "data-columns-key": columnsKey,
4919
4937
  "aria-rowindex": rowIndex + 1,
4920
4938
  role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,
4921
4939
  tabIndex: focusedRowId === rowId ? 0 : -1,
package/dist/index.js CHANGED
@@ -3473,12 +3473,13 @@ var BodyCell = (props) => {
3473
3473
  [props.editMode, isCellEditable, params]
3474
3474
  );
3475
3475
  const propsComponentProps = "componentProps" in props ? props.componentProps : null;
3476
+ const hasComponentProps = "componentProps" in props;
3476
3477
  const componentProps = useMemo8(
3477
3478
  () => ({
3478
- ..."componentProps" in props && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
3479
+ ...hasComponentProps && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
3479
3480
  size: "sm"
3480
3481
  }),
3481
- [props, propsComponentProps, params]
3482
+ [hasComponentProps, propsComponentProps, params]
3482
3483
  );
3483
3484
  const editModeComponentProps = useMemo8(
3484
3485
  () => ({
@@ -3542,9 +3543,11 @@ var BodyCell = (props) => {
3542
3543
  }),
3543
3544
  [params, row, field, value, componentProps, type, onCellEditStop, onCellEditStart]
3544
3545
  );
3546
+ const MemoizedRenderEditCell = useMemo8(() => renderEditCell ? memo(renderEditCell) : null, [renderEditCell]);
3547
+ const MemoizedRenderCell = useMemo8(() => renderCell ? memo(renderCell) : null, [renderCell]);
3545
3548
  const EditModeComponent = useMemo8(() => {
3546
- if (renderEditCell) {
3547
- return createElement(memo(renderEditCell), params);
3549
+ if (MemoizedRenderEditCell) {
3550
+ return createElement(MemoizedRenderEditCell, params);
3548
3551
  }
3549
3552
  return {
3550
3553
  date: /* @__PURE__ */ React22.createElement(DatePicker_default, { value, ...editModeComponentProps }),
@@ -3575,11 +3578,11 @@ var BodyCell = (props) => {
3575
3578
  }
3576
3579
  )
3577
3580
  }[type || "text"];
3578
- }, [value, editModeComponentProps, type, renderEditCell, params]);
3581
+ }, [value, editModeComponentProps, type, MemoizedRenderEditCell, params]);
3579
3582
  const linkComponentFromProps = props.component;
3580
3583
  const ReadModeComponent = useMemo8(() => {
3581
- if (renderCell) {
3582
- return createElement(memo(renderCell), params);
3584
+ if (MemoizedRenderCell) {
3585
+ return createElement(MemoizedRenderCell, params);
3583
3586
  }
3584
3587
  const innerText = value;
3585
3588
  const typedComponent = {
@@ -3589,7 +3592,7 @@ var BodyCell = (props) => {
3589
3592
  })
3590
3593
  }[type || "text"];
3591
3594
  return typedComponent || innerText;
3592
- }, [value, renderCell, params, type, componentProps, linkComponentFromProps]);
3595
+ }, [value, MemoizedRenderCell, params, type, componentProps, linkComponentFromProps]);
3593
3596
  const getActions = props.getActions;
3594
3597
  const CellComponent = useMemo8(() => {
3595
3598
  if (type === "actions") {
@@ -3668,8 +3671,9 @@ var StyledTableRow2 = styled12("tr", {
3668
3671
  var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
3669
3672
  return prevProps.striped === nextProps.striped && prevProps.style?.height === nextProps.style?.height && prevProps.style?.transform === nextProps.style?.transform && // @ts-ignore
3670
3673
  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;
3674
+ 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)
3675
+ // @ts-ignore
3676
+ prevProps["data-columns-key"] === nextProps["data-columns-key"];
3673
3677
  });
3674
3678
 
3675
3679
  // src/components/DataTable/hooks.ts
@@ -4376,6 +4380,15 @@ Pagination.displayName = "Pagination";
4376
4380
  var Pagination_default = Pagination;
4377
4381
 
4378
4382
  // src/components/DataTable/DataTable.tsx
4383
+ var _columnsVersionCache = /* @__PURE__ */ new WeakMap();
4384
+ var _columnsVersionCounter = 0;
4385
+ function getColumnsVersion(columns) {
4386
+ if (!_columnsVersionCache.has(columns)) {
4387
+ _columnsVersionCache.set(columns, ++_columnsVersionCounter);
4388
+ }
4389
+ return _columnsVersionCache.get(columns);
4390
+ }
4391
+ var EMPTY_CHECKBOX_PROPS = {};
4379
4392
  function Component(props, apiRef) {
4380
4393
  const {
4381
4394
  rows,
@@ -4423,7 +4436,7 @@ function Component(props, apiRef) {
4423
4436
  noRowsOverlay: NoRowsOverlay = DefaultNoRowsOverlay
4424
4437
  } = {},
4425
4438
  slotProps: {
4426
- checkbox: checkboxProps = {},
4439
+ checkbox: checkboxProps = EMPTY_CHECKBOX_PROPS,
4427
4440
  toolbar: toolbarProps,
4428
4441
  background: backgroundProps = {},
4429
4442
  noRowsOverlay: noRowsOverlayProps = {}
@@ -4471,6 +4484,28 @@ function Component(props, apiRef) {
4471
4484
  overscan: 10
4472
4485
  });
4473
4486
  const paginationModel = useMemo10(() => ({ page, pageSize }), [page, pageSize]);
4487
+ const columnsKey = getColumnsVersion(columns);
4488
+ const headerCheckboxElement = useMemo10(
4489
+ () => /* @__PURE__ */ React25.createElement(
4490
+ RenderCheckbox,
4491
+ {
4492
+ onChange: onAllCheckboxChange,
4493
+ checked: isAllSelected,
4494
+ indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
4495
+ disabled: dataInPage.length > 0 && !selectableRowCount,
4496
+ ...checkboxProps
4497
+ }
4498
+ ),
4499
+ [
4500
+ RenderCheckbox,
4501
+ onAllCheckboxChange,
4502
+ isAllSelected,
4503
+ selectionModel,
4504
+ selectableRowCount,
4505
+ dataInPage.length,
4506
+ checkboxProps
4507
+ ]
4508
+ );
4474
4509
  const totalSize = virtualizer.getTotalSize();
4475
4510
  const virtualizedItems = virtualizer.getVirtualItems();
4476
4511
  const showNoRowsOverlay = !loading && rowCount === 0;
@@ -4675,16 +4710,7 @@ function Component(props, apiRef) {
4675
4710
  verticalAlign: "middle"
4676
4711
  }
4677
4712
  },
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
- )
4713
+ headerCheckboxElement
4688
4714
  ), 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
4715
  const nextGroup = levelGroups[groupIndex + 1];
4690
4716
  const emptyCells = nextGroup ? nextGroup.startIndex - (group.startIndex + group.colspan) : columns.length - (group.startIndex + group.colspan);
@@ -4711,16 +4737,7 @@ function Component(props, apiRef) {
4711
4737
  textAlign: "center"
4712
4738
  }
4713
4739
  },
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
- )
4740
+ headerCheckboxElement
4724
4741
  ), columns.map((c, i) => (
4725
4742
  // @ts-ignore
4726
4743
  /* @__PURE__ */ React25.createElement(
@@ -4791,6 +4808,7 @@ function Component(props, apiRef) {
4791
4808
  key: virtualizedRow.key,
4792
4809
  "data-row-id": rowId,
4793
4810
  "data-index": rowIndex,
4811
+ "data-columns-key": columnsKey,
4794
4812
  "aria-rowindex": rowIndex + 1,
4795
4813
  role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,
4796
4814
  tabIndex: focusedRowId === rowId ? 0 : -1,