@sustaina/shared-ui 1.70.0 → 1.70.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.js CHANGED
@@ -9796,23 +9796,33 @@ var TableHeaderRows = ({
9796
9796
  leafRunning += centerHeaders[gi].colSpan;
9797
9797
  }
9798
9798
  const virtualCols = columnVirtual.virtualColumns;
9799
- const useColumnSizing = columnResizing?.enabled ?? virtual?.enabled ?? false;
9799
+ const groupedVirtualCols = [];
9800
+ for (const vc of virtualCols) {
9801
+ const gi = leafToGroupIdx[vc.index];
9802
+ if (gi === void 0) continue;
9803
+ const last = groupedVirtualCols[groupedVirtualCols.length - 1];
9804
+ if (last && last.gi === gi) {
9805
+ last.vcs.push(vc);
9806
+ } else {
9807
+ groupedVirtualCols.push({ gi, vcs: [vc] });
9808
+ }
9809
+ }
9800
9810
  return /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { children: [
9801
9811
  leftHeaders.map((header) => resolveHeaderCell(header, headerGroup, groupIndex)),
9802
9812
  columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsxRuntime.jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
9803
- virtualCols.map((vc, vcIdx) => {
9804
- const gi = leafToGroupIdx[vc.index];
9805
- if (gi === void 0) return null;
9813
+ groupedVirtualCols.map(({ gi, vcs }) => {
9806
9814
  const groupHeader = centerHeaders[gi];
9807
- const leafCol = centerLeafCols[vc.index];
9808
- const isFirst = vcIdx === 0 || leafToGroupIdx[virtualCols[vcIdx - 1].index] !== gi;
9809
- const isLast = vcIdx === virtualCols.length - 1 || leafToGroupIdx[virtualCols[vcIdx + 1].index] !== gi;
9810
9815
  const { classes, style } = getColumnPinningStyles(groupHeader.column);
9811
9816
  const tableHeadCellProps = typeof components?.tableHeadCellProps === "function" ? components.tableHeadCellProps({ header: groupHeader, table }) : components?.tableHeadCellProps;
9817
+ const useColumnSizing = groupHeader.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
9818
+ const widthCalc = useColumnSizing ? `calc((${vcs.map((vc) => `var(--col-${toCSSId(centerLeafCols[vc.index].id)}-size, ${centerLeafCols[vc.index].getSize()})`).join(" + ")}) * 1px)` : void 0;
9819
+ const nextCenterHeader = centerHeaders[gi + 1];
9820
+ const showSeparator = groupHeader.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? (gi !== centerHeaders.length - 1 && (!groupHeader.isPlaceholder || !nextCenterHeader?.isPlaceholder));
9812
9821
  return /* @__PURE__ */ jsxRuntime.jsxs(
9813
9822
  TableHead,
9814
9823
  {
9815
- colSpan: 1,
9824
+ "data-testid": `table-head-${groupHeader.id}`,
9825
+ colSpan: vcs.length,
9816
9826
  ...tableHeadCellProps,
9817
9827
  ...groupHeader.column.columnDef?.meta?.headerProps,
9818
9828
  className: cn(
@@ -9822,16 +9832,26 @@ var TableHeaderRows = ({
9822
9832
  ),
9823
9833
  style: {
9824
9834
  ...style,
9825
- width: useColumnSizing ? `calc(var(--col-${toCSSId(leafCol.id)}-size, ${leafCol.getSize()}) * 1px)` : void 0,
9835
+ width: widthCalc,
9836
+ minWidth: useColumnSizing ? groupHeader.column.columnDef.minSize : void 0,
9837
+ maxWidth: useColumnSizing ? groupHeader.column.columnDef.maxSize : void 0,
9826
9838
  ...tableHeadCellProps?.style,
9827
9839
  ...groupHeader.column.columnDef?.meta?.headerProps?.style
9828
9840
  },
9829
9841
  children: [
9830
- isFirst && !groupHeader.isPlaceholder ? reactTable.flexRender(groupHeader.column.columnDef.header, groupHeader.getContext()) : null,
9831
- /* @__PURE__ */ jsxRuntime.jsx(ColumnSeparator_default, { ...components?.columnSeparatorProps?.headerCell, show: isLast })
9842
+ !groupHeader.isPlaceholder ? reactTable.flexRender(groupHeader.column.columnDef.header, groupHeader.getContext()) : null,
9843
+ /* @__PURE__ */ jsxRuntime.jsx(
9844
+ ColumnSeparator_default,
9845
+ {
9846
+ ...components?.columnSeparatorProps?.headerCell,
9847
+ ...groupHeader.column.columnDef?.meta?.columnSeparatorProps,
9848
+ show: showSeparator
9849
+ }
9850
+ ),
9851
+ /* @__PURE__ */ jsxRuntime.jsx(ColumnResizer_default, { header: groupHeader, ...components?.columnResizerProps })
9832
9852
  ]
9833
9853
  },
9834
- `${groupHeader.id}-${leafCol.id}`
9854
+ `${groupHeader.id}-${vcs[0].index}`
9835
9855
  );
9836
9856
  }),
9837
9857
  columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsxRuntime.jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),