@onesaz/ui 0.3.15 → 0.3.16

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
@@ -4859,6 +4859,29 @@ var PinnedRowsRenderer = ({
4859
4859
  if (pinnedRows.length === 0) return null;
4860
4860
  return /* @__PURE__ */ jsx35("tbody", { children: pinnedRows.map((row, rowIndex) => {
4861
4861
  const customClassName = getRowClassName?.({ row: row.original, rowIndex });
4862
+ const visibleCells = row.getVisibleCells();
4863
+ const colSpanSkipSet = /* @__PURE__ */ new Set();
4864
+ const colSpanValues = /* @__PURE__ */ new Map();
4865
+ visibleCells.forEach((cell, cellIndex) => {
4866
+ if (colSpanSkipSet.has(cellIndex)) return;
4867
+ const meta = cell.column.columnDef.meta;
4868
+ const colSpanDef = meta?.colSpan;
4869
+ if (colSpanDef) {
4870
+ const value = cell.getValue();
4871
+ let span;
4872
+ if (typeof colSpanDef === "function") {
4873
+ span = colSpanDef({ row: row.original, value, field: cell.column.id, rowIndex });
4874
+ } else if (typeof colSpanDef === "number") {
4875
+ span = colSpanDef;
4876
+ }
4877
+ if (span && span > 1) {
4878
+ colSpanValues.set(cellIndex, span);
4879
+ for (let j = 1; j < span && cellIndex + j < visibleCells.length; j++) {
4880
+ colSpanSkipSet.add(cellIndex + j);
4881
+ }
4882
+ }
4883
+ }
4884
+ });
4862
4885
  return /* @__PURE__ */ jsx35(
4863
4886
  "tr",
4864
4887
  {
@@ -4868,7 +4891,8 @@ var PinnedRowsRenderer = ({
4868
4891
  position === "bottom" && "bottom-0 border-t-2 border-t-border",
4869
4892
  customClassName
4870
4893
  ),
4871
- children: row.getVisibleCells().map((cell) => {
4894
+ children: visibleCells.map((cell, cellIndex) => {
4895
+ if (colSpanSkipSet.has(cellIndex)) return null;
4872
4896
  const meta = cell.column.columnDef.meta;
4873
4897
  const align = meta?.align || "left";
4874
4898
  const wrapText = meta?.wrapText !== void 0 ? meta.wrapText : globalWrapText;
@@ -4878,9 +4902,19 @@ var PinnedRowsRenderer = ({
4878
4902
  const colWidth = columnWidths.get(cell.column.id);
4879
4903
  const width = colWidth?.width || cell.column.getSize();
4880
4904
  const pinnedInfo = pinnedColumnOffsets?.get(cell.column.id);
4905
+ const htmlColSpan = colSpanValues.get(cellIndex);
4906
+ let totalWidth = width;
4907
+ if (htmlColSpan && htmlColSpan > 1) {
4908
+ for (let j = 1; j < htmlColSpan && cellIndex + j < visibleCells.length; j++) {
4909
+ const spannedCell = visibleCells[cellIndex + j];
4910
+ const spannedColWidth = columnWidths.get(spannedCell.column.id);
4911
+ totalWidth += spannedColWidth?.width || spannedCell.column.getSize();
4912
+ }
4913
+ }
4881
4914
  return /* @__PURE__ */ jsx35(
4882
4915
  "td",
4883
4916
  {
4917
+ colSpan: htmlColSpan,
4884
4918
  className: cn(
4885
4919
  "px-4 overflow-hidden bg-muted border-b border-border",
4886
4920
  showCellVerticalBorder && "border-r border-border",
@@ -4892,8 +4926,8 @@ var PinnedRowsRenderer = ({
4892
4926
  height: wrapText || scrollable ? "auto" : rowHeight,
4893
4927
  minHeight: rowHeight,
4894
4928
  textAlign: align,
4895
- width,
4896
- maxWidth: colWidth?.maxWidth || width,
4929
+ width: htmlColSpan && htmlColSpan > 1 ? totalWidth : width,
4930
+ maxWidth: htmlColSpan && htmlColSpan > 1 ? void 0 : colWidth?.maxWidth || width,
4897
4931
  minWidth: colWidth?.minWidth || cell.column.columnDef.minSize,
4898
4932
  ...pinnedInfo ? {
4899
4933
  position: "sticky",
@@ -5025,7 +5059,7 @@ function DataGrid({
5025
5059
  height = 400,
5026
5060
  minHeight,
5027
5061
  maxHeight,
5028
- density = "standard",
5062
+ density = "compact",
5029
5063
  showCellVerticalBorder = false,
5030
5064
  showColumnVerticalBorder = false,
5031
5065
  hideFooter = false,