@ceed/ads 1.4.1 → 1.4.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
@@ -2975,7 +2975,7 @@ var VirtualizedTableBody = (0, import_joy33.styled)("tbody", {
2975
2975
  height: "0.01em"
2976
2976
  }
2977
2977
  });
2978
- var VirtualizedTableRow = (0, import_joy33.styled)("tr", {
2978
+ var StyledTableRow = (0, import_joy33.styled)("tr", {
2979
2979
  name: "DataTable",
2980
2980
  slot: "tableRow",
2981
2981
  shouldForwardProp: (prop) => prop !== "striped"
@@ -2994,6 +2994,12 @@ var VirtualizedTableRow = (0, import_joy33.styled)("tr", {
2994
2994
  }
2995
2995
  }
2996
2996
  }));
2997
+ var VirtualizedTableRow = (0, import_react25.memo)(StyledTableRow, (prevProps, nextProps) => {
2998
+ return prevProps.striped === nextProps.striped && prevProps.style?.height === nextProps.style?.height && prevProps.style?.transform === nextProps.style?.transform && // @ts-ignore
2999
+ prevProps["data-row-id"] === nextProps["data-row-id"] && // @ts-ignore
3000
+ prevProps["data-index"] === nextProps["data-index"] && prevProps.tabIndex === nextProps.tabIndex && prevProps["aria-checked"] === nextProps["aria-checked"] && // Include children check to handle isCellEditable changes
3001
+ prevProps.children === nextProps.children;
3002
+ });
2997
3003
  var Asterisk = (0, import_joy33.styled)("span", {
2998
3004
  name: "DataTable",
2999
3005
  slot: "headCellAsterisk"
@@ -3727,6 +3733,31 @@ function Component(props, apiRef) {
3727
3733
  const paginationModel = (0, import_react25.useMemo)(() => ({ page, pageSize }), [page, pageSize]);
3728
3734
  const totalSize = virtualizer.getTotalSize();
3729
3735
  const virtualizedItems = virtualizer.getVirtualItems();
3736
+ const getRowClickHandler = (0, import_react25.useCallback)(
3737
+ (row, rowId) => (e) => {
3738
+ onRowClick?.({ row, rowId }, e);
3739
+ checkboxSelection && !disableSelectionOnClick && onCheckboxChange(e, rowId);
3740
+ },
3741
+ [onRowClick, checkboxSelection, disableSelectionOnClick, onCheckboxChange]
3742
+ );
3743
+ const getRowFocusHandler = (0, import_react25.useCallback)(
3744
+ (rowId) => () => {
3745
+ onRowFocus(rowId);
3746
+ },
3747
+ [onRowFocus]
3748
+ );
3749
+ const getCheckboxClickHandler = (0, import_react25.useCallback)(
3750
+ () => (e) => {
3751
+ e.stopPropagation();
3752
+ },
3753
+ []
3754
+ );
3755
+ const getCheckboxChangeHandler = (0, import_react25.useCallback)(
3756
+ (rowId) => (e) => {
3757
+ onCheckboxChange(e, rowId);
3758
+ },
3759
+ [onCheckboxChange]
3760
+ );
3730
3761
  (0, import_react25.useImperativeHandle)(apiRef, () => ({
3731
3762
  getRowIndexRelativeToVisibleRows(rowId) {
3732
3763
  return dataInPage.findIndex((row) => String(getId(row)) === rowId);
@@ -3865,12 +3896,9 @@ function Component(props, apiRef) {
3865
3896
  "data-index": rowIndex,
3866
3897
  role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,
3867
3898
  tabIndex: focusedRowId === rowId ? 0 : -1,
3868
- onClick: (e) => {
3869
- onRowClick?.({ row, rowId }, e);
3870
- checkboxSelection && !disableSelectionOnClick && onCheckboxChange(e, rowId);
3871
- },
3872
- onFocus: () => onRowFocus(rowId),
3873
- "aria-checked": checkboxSelection && !disableSelectionOnClick ? isSelectedRow(rowId) : void 0,
3899
+ onClick: getRowClickHandler(row, rowId),
3900
+ onFocus: getRowFocusHandler(rowId),
3901
+ "aria-checked": checkboxSelection ? isSelectedRow(rowId) : void 0,
3874
3902
  striped,
3875
3903
  style: {
3876
3904
  height: `${virtualizedRow.size}px`,
@@ -3888,8 +3916,8 @@ function Component(props, apiRef) {
3888
3916
  /* @__PURE__ */ import_react25.default.createElement(
3889
3917
  RenderCheckbox,
3890
3918
  {
3891
- onClick: (e) => e.stopPropagation(),
3892
- onChange: (e) => onCheckboxChange(e, rowId),
3919
+ onClick: getCheckboxClickHandler(),
3920
+ onChange: getCheckboxChangeHandler(rowId),
3893
3921
  checked: isSelectedRow(rowId),
3894
3922
  ...checkboxProps
3895
3923
  }
package/dist/index.js CHANGED
@@ -2925,7 +2925,7 @@ var VirtualizedTableBody = styled12("tbody", {
2925
2925
  height: "0.01em"
2926
2926
  }
2927
2927
  });
2928
- var VirtualizedTableRow = styled12("tr", {
2928
+ var StyledTableRow = styled12("tr", {
2929
2929
  name: "DataTable",
2930
2930
  slot: "tableRow",
2931
2931
  shouldForwardProp: (prop) => prop !== "striped"
@@ -2944,6 +2944,12 @@ var VirtualizedTableRow = styled12("tr", {
2944
2944
  }
2945
2945
  }
2946
2946
  }));
2947
+ var VirtualizedTableRow = memo(StyledTableRow, (prevProps, nextProps) => {
2948
+ return prevProps.striped === nextProps.striped && prevProps.style?.height === nextProps.style?.height && prevProps.style?.transform === nextProps.style?.transform && // @ts-ignore
2949
+ prevProps["data-row-id"] === nextProps["data-row-id"] && // @ts-ignore
2950
+ prevProps["data-index"] === nextProps["data-index"] && prevProps.tabIndex === nextProps.tabIndex && prevProps["aria-checked"] === nextProps["aria-checked"] && // Include children check to handle isCellEditable changes
2951
+ prevProps.children === nextProps.children;
2952
+ });
2947
2953
  var Asterisk = styled12("span", {
2948
2954
  name: "DataTable",
2949
2955
  slot: "headCellAsterisk"
@@ -3677,6 +3683,31 @@ function Component(props, apiRef) {
3677
3683
  const paginationModel = useMemo8(() => ({ page, pageSize }), [page, pageSize]);
3678
3684
  const totalSize = virtualizer.getTotalSize();
3679
3685
  const virtualizedItems = virtualizer.getVirtualItems();
3686
+ const getRowClickHandler = useCallback9(
3687
+ (row, rowId) => (e) => {
3688
+ onRowClick?.({ row, rowId }, e);
3689
+ checkboxSelection && !disableSelectionOnClick && onCheckboxChange(e, rowId);
3690
+ },
3691
+ [onRowClick, checkboxSelection, disableSelectionOnClick, onCheckboxChange]
3692
+ );
3693
+ const getRowFocusHandler = useCallback9(
3694
+ (rowId) => () => {
3695
+ onRowFocus(rowId);
3696
+ },
3697
+ [onRowFocus]
3698
+ );
3699
+ const getCheckboxClickHandler = useCallback9(
3700
+ () => (e) => {
3701
+ e.stopPropagation();
3702
+ },
3703
+ []
3704
+ );
3705
+ const getCheckboxChangeHandler = useCallback9(
3706
+ (rowId) => (e) => {
3707
+ onCheckboxChange(e, rowId);
3708
+ },
3709
+ [onCheckboxChange]
3710
+ );
3680
3711
  useImperativeHandle2(apiRef, () => ({
3681
3712
  getRowIndexRelativeToVisibleRows(rowId) {
3682
3713
  return dataInPage.findIndex((row) => String(getId(row)) === rowId);
@@ -3815,12 +3846,9 @@ function Component(props, apiRef) {
3815
3846
  "data-index": rowIndex,
3816
3847
  role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,
3817
3848
  tabIndex: focusedRowId === rowId ? 0 : -1,
3818
- onClick: (e) => {
3819
- onRowClick?.({ row, rowId }, e);
3820
- checkboxSelection && !disableSelectionOnClick && onCheckboxChange(e, rowId);
3821
- },
3822
- onFocus: () => onRowFocus(rowId),
3823
- "aria-checked": checkboxSelection && !disableSelectionOnClick ? isSelectedRow(rowId) : void 0,
3849
+ onClick: getRowClickHandler(row, rowId),
3850
+ onFocus: getRowFocusHandler(rowId),
3851
+ "aria-checked": checkboxSelection ? isSelectedRow(rowId) : void 0,
3824
3852
  striped,
3825
3853
  style: {
3826
3854
  height: `${virtualizedRow.size}px`,
@@ -3838,8 +3866,8 @@ function Component(props, apiRef) {
3838
3866
  /* @__PURE__ */ React23.createElement(
3839
3867
  RenderCheckbox,
3840
3868
  {
3841
- onClick: (e) => e.stopPropagation(),
3842
- onChange: (e) => onCheckboxChange(e, rowId),
3869
+ onClick: getCheckboxClickHandler(),
3870
+ onChange: getCheckboxChangeHandler(rowId),
3843
3871
  checked: isSelectedRow(rowId),
3844
3872
  ...checkboxProps
3845
3873
  }