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

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
@@ -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
  });
@@ -4024,22 +4026,28 @@ function useDataTableRenderer({
4024
4026
  ),
4025
4027
  [reorderedColumns]
4026
4028
  );
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) => {
4029
+ const columnIdByColumn = (0, import_react27.useMemo)(() => {
4030
+ const taken = new Set(reorderedColumns.map((column) => String(column.field)));
4031
+ const assigned = /* @__PURE__ */ new Set();
4032
+ const ids = /* @__PURE__ */ new Map();
4033
+ reorderedColumns.forEach((column) => {
4031
4034
  const field = String(column.field);
4032
- if (!ids.includes(field)) {
4033
- ids.push(field);
4035
+ if (!assigned.has(field)) {
4036
+ assigned.add(field);
4037
+ ids.set(column, field);
4034
4038
  return;
4035
4039
  }
4036
4040
  let n = 2;
4037
4041
  while (taken.has(`${field}__${n}`)) n += 1;
4038
4042
  taken.add(`${field}__${n}`);
4039
- ids.push(`${field}__${n}`);
4043
+ ids.set(column, `${field}__${n}`);
4040
4044
  });
4041
4045
  return ids;
4042
- }, [visibleColumns]);
4046
+ }, [reorderedColumns]);
4047
+ const columnIds = (0, import_react27.useMemo)(
4048
+ () => visibleColumns.map((column) => columnIdByColumn.get(column) ?? String(column.field)),
4049
+ [visibleColumns, columnIdByColumn]
4050
+ );
4043
4051
  const visibleColumnsById = (0, import_react27.useMemo)(
4044
4052
  () => Object.fromEntries(
4045
4053
  visibleColumns.map((column, index) => [
package/dist/index.js CHANGED
@@ -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
  });
@@ -3901,22 +3903,28 @@ function useDataTableRenderer({
3901
3903
  ),
3902
3904
  [reorderedColumns]
3903
3905
  );
3904
- const columnIds = useMemo11(() => {
3905
- const taken = new Set(visibleColumns.map((column) => String(column.field)));
3906
- const ids = [];
3907
- visibleColumns.forEach((column) => {
3906
+ const columnIdByColumn = useMemo11(() => {
3907
+ const taken = new Set(reorderedColumns.map((column) => String(column.field)));
3908
+ const assigned = /* @__PURE__ */ new Set();
3909
+ const ids = /* @__PURE__ */ new Map();
3910
+ reorderedColumns.forEach((column) => {
3908
3911
  const field = String(column.field);
3909
- if (!ids.includes(field)) {
3910
- ids.push(field);
3912
+ if (!assigned.has(field)) {
3913
+ assigned.add(field);
3914
+ ids.set(column, field);
3911
3915
  return;
3912
3916
  }
3913
3917
  let n = 2;
3914
3918
  while (taken.has(`${field}__${n}`)) n += 1;
3915
3919
  taken.add(`${field}__${n}`);
3916
- ids.push(`${field}__${n}`);
3920
+ ids.set(column, `${field}__${n}`);
3917
3921
  });
3918
3922
  return ids;
3919
- }, [visibleColumns]);
3923
+ }, [reorderedColumns]);
3924
+ const columnIds = useMemo11(
3925
+ () => visibleColumns.map((column) => columnIdByColumn.get(column) ?? String(column.field)),
3926
+ [visibleColumns, columnIdByColumn]
3927
+ );
3920
3928
  const visibleColumnsById = useMemo11(
3921
3929
  () => Object.fromEntries(
3922
3930
  visibleColumns.map((column, index) => [