@ceed/ads 1.41.3-next.2 → 1.41.3-next.4

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
@@ -461,7 +461,7 @@ function useSlotRef(slotProp, ref) {
461
461
  return (0, import_react6.useMemo)(() => {
462
462
  if (isFunctionForm) {
463
463
  return ((ownerState) => {
464
- const resolved = slotProp(ownerState);
464
+ const resolved = slotProp(ownerState) ?? {};
465
465
  const merged = mergeRefs(resolved.ref, ref);
466
466
  return merged ? { ...resolved, ref: merged } : { ...resolved };
467
467
  });
@@ -3924,6 +3924,7 @@ function useColumnWidths(columnsById) {
3924
3924
  entries.forEach((entry) => {
3925
3925
  const columnId = entry.target.dataset.hdsColumnId;
3926
3926
  const w = Math.round(entry.target.getBoundingClientRect().width);
3927
+ if (w === 0) return;
3927
3928
  if (next[columnId] !== w) {
3928
3929
  next[columnId] = w;
3929
3930
  changed = true;
@@ -3938,7 +3939,8 @@ function useColumnWidths(columnsById) {
3938
3939
  if (el) {
3939
3940
  el.dataset.hdsColumnId = columnId;
3940
3941
  el.dataset.field = String(def.field);
3941
- measured[columnId] = Math.round(el.getBoundingClientRect().width);
3942
+ const w = Math.round(el.getBoundingClientRect().width);
3943
+ if (w > 0) measured[columnId] = w;
3942
3944
  roRef.current.observe(el);
3943
3945
  }
3944
3946
  });
@@ -4001,10 +4003,17 @@ function useDataTableRenderer({
4001
4003
  if (!columnGroupingModel) return columnsProp;
4002
4004
  return reorderColumnsByGroupingModel(columnsProp, columnGroupingModel);
4003
4005
  }, [columnsProp, columnGroupingModel]);
4004
- const visibleColumns = (0, import_react27.useMemo)(
4005
- () => reorderedColumns.filter((col) => visibilityModel[col.field] !== false),
4006
+ const visibleColumnIndexes = (0, import_react27.useMemo)(
4007
+ () => reorderedColumns.reduce((acc, col, index) => {
4008
+ if (visibilityModel[col.field] !== false) acc.push(index);
4009
+ return acc;
4010
+ }, []),
4006
4011
  [reorderedColumns, visibilityModel]
4007
4012
  );
4013
+ const visibleColumns = (0, import_react27.useMemo)(
4014
+ () => visibleColumnIndexes.map((index) => reorderedColumns[index]),
4015
+ [visibleColumnIndexes, reorderedColumns]
4016
+ );
4008
4017
  const visibleFieldSet = (0, import_react27.useMemo)(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
4009
4018
  const tableMinWidth = (0, import_react27.useMemo)(() => {
4010
4019
  const DEFAULT_MIN = 50;
@@ -4024,22 +4033,25 @@ function useDataTableRenderer({
4024
4033
  ),
4025
4034
  [reorderedColumns]
4026
4035
  );
4027
- const columnIds = (0, import_react27.useMemo)(() => {
4028
- const taken = new Set(visibleColumns.map((column) => String(column.field)));
4029
- const ids = [];
4030
- visibleColumns.forEach((column) => {
4036
+ const allColumnIds = (0, import_react27.useMemo)(() => {
4037
+ const taken = new Set(reorderedColumns.map((column) => String(column.field)));
4038
+ const assigned = /* @__PURE__ */ new Set();
4039
+ return reorderedColumns.map((column) => {
4031
4040
  const field = String(column.field);
4032
- if (!ids.includes(field)) {
4033
- ids.push(field);
4034
- return;
4041
+ if (!assigned.has(field)) {
4042
+ assigned.add(field);
4043
+ return field;
4035
4044
  }
4036
4045
  let n = 2;
4037
4046
  while (taken.has(`${field}__${n}`)) n += 1;
4038
4047
  taken.add(`${field}__${n}`);
4039
- ids.push(`${field}__${n}`);
4048
+ return `${field}__${n}`;
4040
4049
  });
4041
- return ids;
4042
- }, [visibleColumns]);
4050
+ }, [reorderedColumns]);
4051
+ const columnIds = (0, import_react27.useMemo)(
4052
+ () => visibleColumnIndexes.map((index) => allColumnIds[index]),
4053
+ [visibleColumnIndexes, allColumnIds]
4054
+ );
4043
4055
  const visibleColumnsById = (0, import_react27.useMemo)(
4044
4056
  () => Object.fromEntries(
4045
4057
  visibleColumns.map((column, index) => [
package/dist/index.js CHANGED
@@ -306,7 +306,7 @@ function useSlotRef(slotProp, ref) {
306
306
  return useMemo(() => {
307
307
  if (isFunctionForm) {
308
308
  return ((ownerState) => {
309
- const resolved = slotProp(ownerState);
309
+ const resolved = slotProp(ownerState) ?? {};
310
310
  const merged = mergeRefs(resolved.ref, ref);
311
311
  return merged ? { ...resolved, ref: merged } : { ...resolved };
312
312
  });
@@ -3801,6 +3801,7 @@ function useColumnWidths(columnsById) {
3801
3801
  entries.forEach((entry) => {
3802
3802
  const columnId = entry.target.dataset.hdsColumnId;
3803
3803
  const w = Math.round(entry.target.getBoundingClientRect().width);
3804
+ if (w === 0) return;
3804
3805
  if (next[columnId] !== w) {
3805
3806
  next[columnId] = w;
3806
3807
  changed = true;
@@ -3815,7 +3816,8 @@ function useColumnWidths(columnsById) {
3815
3816
  if (el) {
3816
3817
  el.dataset.hdsColumnId = columnId;
3817
3818
  el.dataset.field = String(def.field);
3818
- measured[columnId] = Math.round(el.getBoundingClientRect().width);
3819
+ const w = Math.round(el.getBoundingClientRect().width);
3820
+ if (w > 0) measured[columnId] = w;
3819
3821
  roRef.current.observe(el);
3820
3822
  }
3821
3823
  });
@@ -3878,10 +3880,17 @@ function useDataTableRenderer({
3878
3880
  if (!columnGroupingModel) return columnsProp;
3879
3881
  return reorderColumnsByGroupingModel(columnsProp, columnGroupingModel);
3880
3882
  }, [columnsProp, columnGroupingModel]);
3881
- const visibleColumns = useMemo11(
3882
- () => reorderedColumns.filter((col) => visibilityModel[col.field] !== false),
3883
+ const visibleColumnIndexes = useMemo11(
3884
+ () => reorderedColumns.reduce((acc, col, index) => {
3885
+ if (visibilityModel[col.field] !== false) acc.push(index);
3886
+ return acc;
3887
+ }, []),
3883
3888
  [reorderedColumns, visibilityModel]
3884
3889
  );
3890
+ const visibleColumns = useMemo11(
3891
+ () => visibleColumnIndexes.map((index) => reorderedColumns[index]),
3892
+ [visibleColumnIndexes, reorderedColumns]
3893
+ );
3885
3894
  const visibleFieldSet = useMemo11(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
3886
3895
  const tableMinWidth = useMemo11(() => {
3887
3896
  const DEFAULT_MIN = 50;
@@ -3901,22 +3910,25 @@ function useDataTableRenderer({
3901
3910
  ),
3902
3911
  [reorderedColumns]
3903
3912
  );
3904
- const columnIds = useMemo11(() => {
3905
- const taken = new Set(visibleColumns.map((column) => String(column.field)));
3906
- const ids = [];
3907
- visibleColumns.forEach((column) => {
3913
+ const allColumnIds = useMemo11(() => {
3914
+ const taken = new Set(reorderedColumns.map((column) => String(column.field)));
3915
+ const assigned = /* @__PURE__ */ new Set();
3916
+ return reorderedColumns.map((column) => {
3908
3917
  const field = String(column.field);
3909
- if (!ids.includes(field)) {
3910
- ids.push(field);
3911
- return;
3918
+ if (!assigned.has(field)) {
3919
+ assigned.add(field);
3920
+ return field;
3912
3921
  }
3913
3922
  let n = 2;
3914
3923
  while (taken.has(`${field}__${n}`)) n += 1;
3915
3924
  taken.add(`${field}__${n}`);
3916
- ids.push(`${field}__${n}`);
3925
+ return `${field}__${n}`;
3917
3926
  });
3918
- return ids;
3919
- }, [visibleColumns]);
3927
+ }, [reorderedColumns]);
3928
+ const columnIds = useMemo11(
3929
+ () => visibleColumnIndexes.map((index) => allColumnIds[index]),
3930
+ [visibleColumnIndexes, allColumnIds]
3931
+ );
3920
3932
  const visibleColumnsById = useMemo11(
3921
3933
  () => Object.fromEntries(
3922
3934
  visibleColumns.map((column, index) => [