@sustaina/shared-ui 1.70.0 → 1.70.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.mjs CHANGED
@@ -9753,23 +9753,33 @@ var TableHeaderRows = ({
9753
9753
  leafRunning += centerHeaders[gi].colSpan;
9754
9754
  }
9755
9755
  const virtualCols = columnVirtual.virtualColumns;
9756
- const useColumnSizing = columnResizing?.enabled ?? virtual?.enabled ?? false;
9756
+ const groupedVirtualCols = [];
9757
+ for (const vc of virtualCols) {
9758
+ const gi = leafToGroupIdx[vc.index];
9759
+ if (gi === void 0) continue;
9760
+ const last = groupedVirtualCols[groupedVirtualCols.length - 1];
9761
+ if (last && last.gi === gi) {
9762
+ last.vcs.push(vc);
9763
+ } else {
9764
+ groupedVirtualCols.push({ gi, vcs: [vc] });
9765
+ }
9766
+ }
9757
9767
  return /* @__PURE__ */ jsxs(TableRow, { children: [
9758
9768
  leftHeaders.map((header) => resolveHeaderCell(header, headerGroup, groupIndex)),
9759
9769
  columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
9760
- virtualCols.map((vc, vcIdx) => {
9761
- const gi = leafToGroupIdx[vc.index];
9762
- if (gi === void 0) return null;
9770
+ groupedVirtualCols.map(({ gi, vcs }) => {
9763
9771
  const groupHeader = centerHeaders[gi];
9764
- const leafCol = centerLeafCols[vc.index];
9765
- const isFirst = vcIdx === 0 || leafToGroupIdx[virtualCols[vcIdx - 1].index] !== gi;
9766
- const isLast = vcIdx === virtualCols.length - 1 || leafToGroupIdx[virtualCols[vcIdx + 1].index] !== gi;
9767
9772
  const { classes, style } = getColumnPinningStyles(groupHeader.column);
9768
9773
  const tableHeadCellProps = typeof components?.tableHeadCellProps === "function" ? components.tableHeadCellProps({ header: groupHeader, table }) : components?.tableHeadCellProps;
9774
+ const useColumnSizing = groupHeader.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
9775
+ const widthCalc = useColumnSizing ? `calc((${vcs.map((vc) => `var(--col-${toCSSId(centerLeafCols[vc.index].id)}-size, ${centerLeafCols[vc.index].getSize()})`).join(" + ")}) * 1px)` : void 0;
9776
+ const nextCenterHeader = centerHeaders[gi + 1];
9777
+ const showSeparator = groupHeader.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? (gi !== centerHeaders.length - 1 && (!groupHeader.isPlaceholder || !nextCenterHeader?.isPlaceholder));
9769
9778
  return /* @__PURE__ */ jsxs(
9770
9779
  TableHead,
9771
9780
  {
9772
- colSpan: 1,
9781
+ "data-testid": `table-head-${groupHeader.column.id}`,
9782
+ colSpan: vcs.length,
9773
9783
  ...tableHeadCellProps,
9774
9784
  ...groupHeader.column.columnDef?.meta?.headerProps,
9775
9785
  className: cn(
@@ -9779,16 +9789,26 @@ var TableHeaderRows = ({
9779
9789
  ),
9780
9790
  style: {
9781
9791
  ...style,
9782
- width: useColumnSizing ? `calc(var(--col-${toCSSId(leafCol.id)}-size, ${leafCol.getSize()}) * 1px)` : void 0,
9792
+ width: widthCalc,
9793
+ minWidth: useColumnSizing ? groupHeader.column.columnDef.minSize : void 0,
9794
+ maxWidth: useColumnSizing ? groupHeader.column.columnDef.maxSize : void 0,
9783
9795
  ...tableHeadCellProps?.style,
9784
9796
  ...groupHeader.column.columnDef?.meta?.headerProps?.style
9785
9797
  },
9786
9798
  children: [
9787
- isFirst && !groupHeader.isPlaceholder ? flexRender(groupHeader.column.columnDef.header, groupHeader.getContext()) : null,
9788
- /* @__PURE__ */ jsx(ColumnSeparator_default, { ...components?.columnSeparatorProps?.headerCell, show: isLast })
9799
+ !groupHeader.isPlaceholder ? flexRender(groupHeader.column.columnDef.header, groupHeader.getContext()) : null,
9800
+ /* @__PURE__ */ jsx(
9801
+ ColumnSeparator_default,
9802
+ {
9803
+ ...components?.columnSeparatorProps?.headerCell,
9804
+ ...groupHeader.column.columnDef?.meta?.columnSeparatorProps,
9805
+ show: showSeparator
9806
+ }
9807
+ ),
9808
+ /* @__PURE__ */ jsx(ColumnResizer_default, { header: groupHeader, ...components?.columnResizerProps })
9789
9809
  ]
9790
9810
  },
9791
- `${groupHeader.id}-${leafCol.id}`
9811
+ `${groupHeader.id}-${vcs[0].index}`
9792
9812
  );
9793
9813
  }),
9794
9814
  columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),