@onesaz/ui 0.3.12 → 0.3.15

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
@@ -3474,6 +3474,27 @@ import { Fragment as Fragment4, jsx as jsx34, jsxs as jsxs19 } from "react/jsx-r
3474
3474
  function isMultipleProps(props) {
3475
3475
  return props.multiple === true;
3476
3476
  }
3477
+ function Adornment({
3478
+ children,
3479
+ onClick,
3480
+ className
3481
+ }) {
3482
+ if (onClick) {
3483
+ return /* @__PURE__ */ jsx34(
3484
+ "button",
3485
+ {
3486
+ type: "button",
3487
+ onClick: (e) => {
3488
+ e.stopPropagation();
3489
+ onClick(e);
3490
+ },
3491
+ className: cn("shrink-0 rounded p-0.5 hover:bg-muted", className),
3492
+ children
3493
+ }
3494
+ );
3495
+ }
3496
+ return /* @__PURE__ */ jsx34("span", { className: cn("shrink-0 pointer-events-none opacity-50", className), children });
3497
+ }
3477
3498
  var Combobox = React34.forwardRef(
3478
3499
  (props, ref) => {
3479
3500
  const {
@@ -3484,7 +3505,11 @@ var Combobox = React34.forwardRef(
3484
3505
  disabled = false,
3485
3506
  clearable = true,
3486
3507
  openOnFocus = true,
3487
- className
3508
+ className,
3509
+ startAdornment,
3510
+ onStartAdornmentClick,
3511
+ endAdornment,
3512
+ onEndAdornmentClick
3488
3513
  } = props;
3489
3514
  const labelKey = props.labelKey ?? "label";
3490
3515
  const valueKey = props.valueKey ?? "value";
@@ -3645,7 +3670,7 @@ var Combobox = React34.forwardRef(
3645
3670
  disabled,
3646
3671
  onClick: () => setOpen(!open),
3647
3672
  className: cn(
3648
- "flex min-h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm",
3673
+ "flex min-h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm text-left",
3649
3674
  "ring-offset-background",
3650
3675
  "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
3651
3676
  "disabled:cursor-not-allowed disabled:opacity-50",
@@ -3653,6 +3678,7 @@ var Combobox = React34.forwardRef(
3653
3678
  className
3654
3679
  ),
3655
3680
  children: [
3681
+ startAdornment && /* @__PURE__ */ jsx34(Adornment, { onClick: onStartAdornmentClick, className: "mr-1.5", children: startAdornment }),
3656
3682
  isMultiple ? /* @__PURE__ */ jsx34("div", { className: "flex flex-1 flex-wrap items-center gap-1", children: selectedOptions.length === 0 ? /* @__PURE__ */ jsx34("span", { className: "text-muted-foreground", children: placeholder }) : /* @__PURE__ */ jsxs19(Fragment4, { children: [
3657
3683
  displayedOptions.map((option) => /* @__PURE__ */ jsxs19(
3658
3684
  "span",
@@ -3692,7 +3718,7 @@ var Combobox = React34.forwardRef(
3692
3718
  remainingCount,
3693
3719
  " more"
3694
3720
  ] })
3695
- ] }) }) : /* @__PURE__ */ jsx34("span", { className: cn(!singleValue && "text-muted-foreground"), children: singleValue ? getOptionLabel(singleValue) : placeholder }),
3721
+ ] }) }) : /* @__PURE__ */ jsx34("span", { className: cn("flex-1", !singleValue && "text-muted-foreground"), children: singleValue ? getOptionLabel(singleValue) : placeholder }),
3696
3722
  /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-1", children: [
3697
3723
  isMultiple && selectedOptions.length > 0 && /* @__PURE__ */ jsx34(
3698
3724
  "button",
@@ -3743,6 +3769,7 @@ var Combobox = React34.forwardRef(
3743
3769
  )
3744
3770
  }
3745
3771
  ),
3772
+ endAdornment && /* @__PURE__ */ jsx34(Adornment, { onClick: onEndAdornmentClick, children: endAdornment }),
3746
3773
  /* @__PURE__ */ jsx34(
3747
3774
  "svg",
3748
3775
  {
@@ -4001,7 +4028,9 @@ function convertColumns(columns, checkboxSelection) {
4001
4028
  wrapText: col.wrapText,
4002
4029
  scrollable: col.scrollable,
4003
4030
  maxCellHeight: col.maxCellHeight,
4004
- cellClassName: col.cellClassName
4031
+ cellClassName: col.cellClassName,
4032
+ colSpan: col.colSpan,
4033
+ rowSpan: col.rowSpan
4005
4034
  }
4006
4035
  };
4007
4036
  tanstackColumns.push(tanstackCol);
@@ -4138,7 +4167,7 @@ var ColumnVisibilityDropdown = ({
4138
4167
  }
4139
4168
  ),
4140
4169
  open && /* @__PURE__ */ jsxs20("div", { className: "absolute right-0 top-full mt-1 z-50 min-w-[180px] rounded-md border border-border bg-popover p-2 shadow-md", children: [
4141
- /* @__PURE__ */ jsx35("div", { className: "text-sm font-medium text-foreground mb-2 px-2", children: "Show/Hide Columns" }),
4170
+ /* @__PURE__ */ jsx35("div", { className: "text-xs font-medium text-foreground mb-2 px-2", children: "Show/Hide Columns" }),
4142
4171
  /* @__PURE__ */ jsx35("div", { className: "max-h-[300px] overflow-auto", children: allColumns.map((column) => {
4143
4172
  const meta = column.columnDef.meta;
4144
4173
  const headerName = meta?.headerName || column.id;
@@ -4154,7 +4183,7 @@ var ColumnVisibilityDropdown = ({
4154
4183
  onChange: (e) => column.toggleVisibility(e.target.checked)
4155
4184
  }
4156
4185
  ),
4157
- /* @__PURE__ */ jsx35("span", { className: "text-sm", children: headerName })
4186
+ /* @__PURE__ */ jsx35("span", { className: "text-xs", children: headerName })
4158
4187
  ]
4159
4188
  },
4160
4189
  column.id
@@ -4222,19 +4251,19 @@ var DataGridPagination = ({
4222
4251
  const startRow = currentPage * pageSize + 1;
4223
4252
  const endRow = Math.min((currentPage + 1) * pageSize, totalRows);
4224
4253
  return /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-end gap-4 px-4 py-3 border-t border-border bg-background", children: [
4225
- /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2 text-sm text-muted-foreground whitespace-nowrap", children: [
4254
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2 text-xs text-muted-foreground whitespace-nowrap", children: [
4226
4255
  /* @__PURE__ */ jsx35("span", { children: "Rows per page:" }),
4227
4256
  /* @__PURE__ */ jsx35(
4228
4257
  "select",
4229
4258
  {
4230
4259
  value: pageSize,
4231
4260
  onChange: (e) => table.setPageSize(Number(e.target.value)),
4232
- className: "h-8 rounded-md border border-border bg-background px-2 text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-ring",
4261
+ className: "h-8 rounded-md border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-ring",
4233
4262
  children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx35("option", { value: size, children: size }, size))
4234
4263
  }
4235
4264
  )
4236
4265
  ] }),
4237
- /* @__PURE__ */ jsxs20("span", { className: "text-sm text-muted-foreground whitespace-nowrap", children: [
4266
+ /* @__PURE__ */ jsxs20("span", { className: "text-xs text-muted-foreground whitespace-nowrap", children: [
4238
4267
  startRow,
4239
4268
  "-",
4240
4269
  endRow,
@@ -4373,7 +4402,7 @@ var ExportDropdown = ({
4373
4402
  /* @__PURE__ */ jsxs20(
4374
4403
  "button",
4375
4404
  {
4376
- className: "flex w-full items-center gap-2 rounded px-3 py-2 text-sm hover:bg-muted",
4405
+ className: "flex w-full items-center gap-2 rounded px-3 py-2 text-xs hover:bg-muted",
4377
4406
  onClick: exportToCSV,
4378
4407
  children: [
4379
4408
  /* @__PURE__ */ jsxs20("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
@@ -4387,7 +4416,7 @@ var ExportDropdown = ({
4387
4416
  onExport && /* @__PURE__ */ jsxs20(
4388
4417
  "button",
4389
4418
  {
4390
- className: "flex w-full items-center gap-2 rounded px-3 py-2 text-sm hover:bg-muted",
4419
+ className: "flex w-full items-center gap-2 rounded px-3 py-2 text-xs hover:bg-muted",
4391
4420
  onClick: handleCustomExport,
4392
4421
  children: [
4393
4422
  /* @__PURE__ */ jsxs20("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
@@ -4434,7 +4463,7 @@ var MoreOptionsDropdown = ({
4434
4463
  open && /* @__PURE__ */ jsx35("div", { className: "absolute right-0 top-full mt-1 z-50 min-w-[160px] rounded-md border border-border bg-popover p-1 shadow-md", children: options.map((option, index) => /* @__PURE__ */ jsxs20(
4435
4464
  "button",
4436
4465
  {
4437
- className: "flex w-full items-center gap-2 rounded px-3 py-2 text-sm hover:bg-muted",
4466
+ className: "flex w-full items-center gap-2 rounded px-3 py-2 text-xs hover:bg-muted",
4438
4467
  onClick: () => {
4439
4468
  option.onClick();
4440
4469
  setOpen(false);
@@ -4490,6 +4519,59 @@ var DataGridToolbar = ({
4490
4519
  ] })
4491
4520
  ] });
4492
4521
  };
4522
+ function computeRowSpanMap(rows, columns) {
4523
+ const rowSpanColumns = columns.filter((col) => col.rowSpan);
4524
+ if (rowSpanColumns.length === 0) return void 0;
4525
+ const map = /* @__PURE__ */ new Map();
4526
+ rowSpanColumns.forEach((col) => {
4527
+ const colMap = /* @__PURE__ */ new Map();
4528
+ const field = col.field;
4529
+ if (typeof col.rowSpan === "function") {
4530
+ const rowSpanFn = col.rowSpan;
4531
+ let i = 0;
4532
+ while (i < rows.length) {
4533
+ const row = rows[i];
4534
+ const value = row.original ? row.original[field] : row[field];
4535
+ const span = rowSpanFn({ row: row.original || row, value, field, rowIndex: i });
4536
+ if (span && span > 1) {
4537
+ colMap.set(i, span);
4538
+ for (let j = 1; j < span && i + j < rows.length; j++) {
4539
+ colMap.set(i + j, 0);
4540
+ }
4541
+ i += span;
4542
+ } else {
4543
+ colMap.set(i, 1);
4544
+ i++;
4545
+ }
4546
+ }
4547
+ } else if (col.rowSpan === true) {
4548
+ let i = 0;
4549
+ while (i < rows.length) {
4550
+ const row = rows[i];
4551
+ const value = row.original ? row.original[field] : row[field];
4552
+ let span = 1;
4553
+ while (i + span < rows.length) {
4554
+ const nextRow = rows[i + span];
4555
+ const nextValue = nextRow.original ? nextRow.original[field] : nextRow[field];
4556
+ if (nextValue === value) {
4557
+ span++;
4558
+ } else {
4559
+ break;
4560
+ }
4561
+ }
4562
+ colMap.set(i, span);
4563
+ for (let j = 1; j < span; j++) {
4564
+ colMap.set(i + j, 0);
4565
+ }
4566
+ i += span;
4567
+ }
4568
+ }
4569
+ if (colMap.size > 0) {
4570
+ map.set(field, colMap);
4571
+ }
4572
+ });
4573
+ return map.size > 0 ? map : void 0;
4574
+ }
4493
4575
  var RowRenderer = ({
4494
4576
  row,
4495
4577
  rowIndex,
@@ -4502,9 +4584,36 @@ var RowRenderer = ({
4502
4584
  globalWrapText = false,
4503
4585
  columnWidths,
4504
4586
  pinnedColumnOffsets,
4505
- isPinnedRow = false
4587
+ isPinnedRow = false,
4588
+ rowSpanMap,
4589
+ gridColumns
4506
4590
  }) => {
4507
4591
  const customClassName = getRowClassName?.({ row: row.original, rowIndex });
4592
+ const visibleCells = row.getVisibleCells();
4593
+ const colSpanSkipSet = /* @__PURE__ */ new Set();
4594
+ const colSpanValues = /* @__PURE__ */ new Map();
4595
+ if (gridColumns) {
4596
+ visibleCells.forEach((cell, cellIndex) => {
4597
+ if (colSpanSkipSet.has(cellIndex)) return;
4598
+ const meta = cell.column.columnDef.meta;
4599
+ const colSpanDef = meta?.colSpan;
4600
+ if (colSpanDef) {
4601
+ const value = cell.getValue();
4602
+ let span;
4603
+ if (typeof colSpanDef === "function") {
4604
+ span = colSpanDef({ row: row.original, value, field: cell.column.id, rowIndex });
4605
+ } else if (typeof colSpanDef === "number") {
4606
+ span = colSpanDef;
4607
+ }
4608
+ if (span && span > 1) {
4609
+ colSpanValues.set(cellIndex, span);
4610
+ for (let j = 1; j < span && cellIndex + j < visibleCells.length; j++) {
4611
+ colSpanSkipSet.add(cellIndex + j);
4612
+ }
4613
+ }
4614
+ }
4615
+ });
4616
+ }
4508
4617
  return /* @__PURE__ */ jsx35(
4509
4618
  "tr",
4510
4619
  {
@@ -4521,7 +4630,16 @@ var RowRenderer = ({
4521
4630
  row.toggleSelected();
4522
4631
  }
4523
4632
  },
4524
- children: row.getVisibleCells().map((cell) => {
4633
+ children: visibleCells.map((cell, cellIndex) => {
4634
+ if (colSpanSkipSet.has(cellIndex)) return null;
4635
+ const colId = cell.column.id;
4636
+ if (rowSpanMap) {
4637
+ const colRowSpan = rowSpanMap.get(colId);
4638
+ if (colRowSpan) {
4639
+ const spanValue = colRowSpan.get(rowIndex);
4640
+ if (spanValue === 0) return null;
4641
+ }
4642
+ }
4525
4643
  const meta = cell.column.columnDef.meta;
4526
4644
  const align = meta?.align || "left";
4527
4645
  const wrapText = meta?.wrapText !== void 0 ? meta.wrapText : globalWrapText;
@@ -4531,23 +4649,46 @@ var RowRenderer = ({
4531
4649
  const colWidth = columnWidths.get(cell.column.id);
4532
4650
  const width = colWidth?.width || cell.column.getSize();
4533
4651
  const pinnedInfo = pinnedColumnOffsets?.get(cell.column.id);
4652
+ const htmlColSpan = colSpanValues.get(cellIndex);
4653
+ let htmlRowSpan;
4654
+ if (rowSpanMap) {
4655
+ const colRowSpan = rowSpanMap.get(colId);
4656
+ if (colRowSpan) {
4657
+ const spanValue = colRowSpan.get(rowIndex);
4658
+ if (spanValue && spanValue > 1) {
4659
+ htmlRowSpan = spanValue;
4660
+ }
4661
+ }
4662
+ }
4663
+ let totalWidth = width;
4664
+ if (htmlColSpan && htmlColSpan > 1) {
4665
+ for (let j = 1; j < htmlColSpan && cellIndex + j < visibleCells.length; j++) {
4666
+ const spannedCell = visibleCells[cellIndex + j];
4667
+ const spannedColWidth = columnWidths.get(spannedCell.column.id);
4668
+ totalWidth += spannedColWidth?.width || spannedCell.column.getSize();
4669
+ }
4670
+ }
4534
4671
  return /* @__PURE__ */ jsx35(
4535
4672
  "td",
4536
4673
  {
4674
+ colSpan: htmlColSpan,
4675
+ rowSpan: htmlRowSpan,
4537
4676
  className: cn(
4538
- "px-4 overflow-hidden",
4539
- showCellVerticalBorder && "border-r last:border-r-0 border-border",
4677
+ "px-4 overflow-hidden border-b border-border",
4678
+ showCellVerticalBorder && "border-r border-border",
4540
4679
  pinnedInfo && "sticky z-[1] bg-background",
4541
4680
  pinnedInfo?.side === "left" && "border-r border-border",
4542
- pinnedInfo?.side === "right" && "border-l border-border"
4681
+ pinnedInfo?.side === "right" && "border-l border-border",
4682
+ htmlRowSpan && htmlRowSpan > 1 && "align-middle"
4543
4683
  ),
4544
4684
  style: {
4545
- height: wrapText || scrollable ? "auto" : rowHeight,
4685
+ height: htmlRowSpan && htmlRowSpan > 1 ? rowHeight * htmlRowSpan : wrapText || scrollable ? void 0 : rowHeight,
4546
4686
  minHeight: rowHeight,
4547
4687
  textAlign: align,
4548
- width,
4549
- maxWidth: colWidth?.maxWidth || width,
4688
+ width: htmlColSpan && htmlColSpan > 1 ? totalWidth : width,
4689
+ maxWidth: htmlColSpan && htmlColSpan > 1 ? void 0 : colWidth?.maxWidth || width,
4550
4690
  minWidth: colWidth?.minWidth || cell.column.columnDef.minSize,
4691
+ verticalAlign: htmlRowSpan && htmlRowSpan > 1 ? "middle" : void 0,
4551
4692
  ...pinnedInfo ? {
4552
4693
  position: "sticky",
4553
4694
  [pinnedInfo.side]: pinnedInfo.offset,
@@ -4565,10 +4706,7 @@ var RowRenderer = ({
4565
4706
  style: {
4566
4707
  maxHeight: scrollable ? `${maxCellHeight}px` : void 0
4567
4708
  },
4568
- title: (
4569
- // Show tooltip for truncated simple text values (not for scrollable or wrapped content)
4570
- !wrapText && !scrollable && (typeof cell.getValue() === "string" || typeof cell.getValue() === "number") ? String(cell.getValue()) : void 0
4571
- ),
4709
+ title: !wrapText && !scrollable && (typeof cell.getValue() === "string" || typeof cell.getValue() === "number") ? String(cell.getValue()) : void 0,
4572
4710
  children: flexRender(cell.column.columnDef.cell, cell.getContext())
4573
4711
  }
4574
4712
  )
@@ -4591,7 +4729,9 @@ var VirtualizedTableBody = ({
4591
4729
  parentRef,
4592
4730
  globalWrapText = false,
4593
4731
  columnWidths,
4594
- pinnedColumnOffsets
4732
+ pinnedColumnOffsets,
4733
+ rowSpanMap,
4734
+ gridColumns
4595
4735
  }) => {
4596
4736
  const rows = table.getRowModel().rows;
4597
4737
  const virtualizer = useVirtualizer({
@@ -4635,7 +4775,9 @@ var VirtualizedTableBody = ({
4635
4775
  getRowClassName,
4636
4776
  globalWrapText,
4637
4777
  columnWidths,
4638
- pinnedColumnOffsets
4778
+ pinnedColumnOffsets,
4779
+ rowSpanMap,
4780
+ gridColumns
4639
4781
  },
4640
4782
  row.id
4641
4783
  );
@@ -4658,7 +4800,9 @@ var StandardTableBody = ({
4658
4800
  getRowClassName,
4659
4801
  globalWrapText = false,
4660
4802
  columnWidths,
4661
- pinnedColumnOffsets
4803
+ pinnedColumnOffsets,
4804
+ rowSpanMap,
4805
+ gridColumns
4662
4806
  }) => {
4663
4807
  const rows = table.getRowModel().rows;
4664
4808
  if (rows.length === 0) {
@@ -4683,7 +4827,9 @@ var StandardTableBody = ({
4683
4827
  getRowClassName,
4684
4828
  globalWrapText,
4685
4829
  columnWidths,
4686
- pinnedColumnOffsets
4830
+ pinnedColumnOffsets,
4831
+ rowSpanMap,
4832
+ gridColumns
4687
4833
  },
4688
4834
  row.id
4689
4835
  )) });
@@ -4699,91 +4845,83 @@ var PinnedRowsRenderer = ({
4699
4845
  globalWrapText = false,
4700
4846
  columnWidths,
4701
4847
  pinnedColumnOffsets,
4702
- position
4848
+ position,
4849
+ columnVisibility
4703
4850
  }) => {
4704
4851
  const pinnedTable = useReactTable({
4705
4852
  data: pinnedData,
4706
4853
  columns: tanstackColumns,
4707
4854
  getCoreRowModel: getCoreRowModel(),
4708
- getRowId: getRowIdFn ? (row) => String(getRowIdFn(row)) : void 0
4855
+ getRowId: getRowIdFn ? (row) => String(getRowIdFn(row)) : void 0,
4856
+ state: { columnVisibility }
4709
4857
  });
4710
4858
  const pinnedRows = pinnedTable.getRowModel().rows;
4711
4859
  if (pinnedRows.length === 0) return null;
4712
- return /* @__PURE__ */ jsx35(
4713
- "tbody",
4714
- {
4715
- className: cn(
4716
- "sticky z-[2]",
4717
- position === "top" && "top-0",
4718
- position === "bottom" && "bottom-0"
4719
- ),
4720
- children: pinnedRows.map((row, rowIndex) => {
4721
- const customClassName = getRowClassName?.({ row: row.original, rowIndex });
4722
- return /* @__PURE__ */ jsx35(
4723
- "tr",
4724
- {
4725
- className: cn(
4726
- "border-b border-border bg-muted/60 font-medium",
4727
- position === "top" && "border-b-2 border-b-border",
4728
- position === "bottom" && "border-t-2 border-t-border",
4729
- customClassName
4730
- ),
4731
- children: row.getVisibleCells().map((cell) => {
4732
- const meta = cell.column.columnDef.meta;
4733
- const align = meta?.align || "left";
4734
- const wrapText = meta?.wrapText !== void 0 ? meta.wrapText : globalWrapText;
4735
- const scrollable = meta?.scrollable || false;
4736
- const maxCellHeight = meta?.maxCellHeight || 100;
4737
- const cellClassName = meta?.cellClassName;
4738
- const colWidth = columnWidths.get(cell.column.id);
4739
- const width = colWidth?.width || cell.column.getSize();
4740
- const pinnedInfo = pinnedColumnOffsets?.get(cell.column.id);
4741
- return /* @__PURE__ */ jsx35(
4742
- "td",
4860
+ return /* @__PURE__ */ jsx35("tbody", { children: pinnedRows.map((row, rowIndex) => {
4861
+ const customClassName = getRowClassName?.({ row: row.original, rowIndex });
4862
+ return /* @__PURE__ */ jsx35(
4863
+ "tr",
4864
+ {
4865
+ className: cn(
4866
+ "sticky z-[2] border-b border-border bg-muted font-medium",
4867
+ position === "top" && "top-0 border-b-2 border-b-border",
4868
+ position === "bottom" && "bottom-0 border-t-2 border-t-border",
4869
+ customClassName
4870
+ ),
4871
+ children: row.getVisibleCells().map((cell) => {
4872
+ const meta = cell.column.columnDef.meta;
4873
+ const align = meta?.align || "left";
4874
+ const wrapText = meta?.wrapText !== void 0 ? meta.wrapText : globalWrapText;
4875
+ const scrollable = meta?.scrollable || false;
4876
+ const maxCellHeight = meta?.maxCellHeight || 100;
4877
+ const cellClassName = meta?.cellClassName;
4878
+ const colWidth = columnWidths.get(cell.column.id);
4879
+ const width = colWidth?.width || cell.column.getSize();
4880
+ const pinnedInfo = pinnedColumnOffsets?.get(cell.column.id);
4881
+ return /* @__PURE__ */ jsx35(
4882
+ "td",
4883
+ {
4884
+ className: cn(
4885
+ "px-4 overflow-hidden bg-muted border-b border-border",
4886
+ showCellVerticalBorder && "border-r border-border",
4887
+ pinnedInfo && "sticky z-[3]",
4888
+ pinnedInfo?.side === "left" && "border-r border-border",
4889
+ pinnedInfo?.side === "right" && "border-l border-border"
4890
+ ),
4891
+ style: {
4892
+ height: wrapText || scrollable ? "auto" : rowHeight,
4893
+ minHeight: rowHeight,
4894
+ textAlign: align,
4895
+ width,
4896
+ maxWidth: colWidth?.maxWidth || width,
4897
+ minWidth: colWidth?.minWidth || cell.column.columnDef.minSize,
4898
+ ...pinnedInfo ? {
4899
+ position: "sticky",
4900
+ [pinnedInfo.side]: pinnedInfo.offset
4901
+ } : {}
4902
+ },
4903
+ children: /* @__PURE__ */ jsx35(
4904
+ "div",
4743
4905
  {
4744
4906
  className: cn(
4745
- "px-4 overflow-hidden bg-muted/60",
4746
- showCellVerticalBorder && "border-r last:border-r-0 border-border",
4747
- pinnedInfo && "sticky z-[3]",
4748
- pinnedInfo?.side === "left" && "border-r border-border",
4749
- pinnedInfo?.side === "right" && "border-l border-border"
4907
+ wrapText ? "whitespace-normal break-words" : scrollable ? "overflow-auto" : "truncate",
4908
+ scrollable && "max-h-[100px]",
4909
+ cellClassName
4750
4910
  ),
4751
4911
  style: {
4752
- height: wrapText || scrollable ? "auto" : rowHeight,
4753
- minHeight: rowHeight,
4754
- textAlign: align,
4755
- width,
4756
- maxWidth: colWidth?.maxWidth || width,
4757
- minWidth: colWidth?.minWidth || cell.column.columnDef.minSize,
4758
- ...pinnedInfo ? {
4759
- position: "sticky",
4760
- [pinnedInfo.side]: pinnedInfo.offset
4761
- } : {}
4912
+ maxHeight: scrollable ? `${maxCellHeight}px` : void 0
4762
4913
  },
4763
- children: /* @__PURE__ */ jsx35(
4764
- "div",
4765
- {
4766
- className: cn(
4767
- wrapText ? "whitespace-normal break-words" : scrollable ? "overflow-auto" : "truncate",
4768
- scrollable && "max-h-[100px]",
4769
- cellClassName
4770
- ),
4771
- style: {
4772
- maxHeight: scrollable ? `${maxCellHeight}px` : void 0
4773
- },
4774
- children: flexRender(cell.column.columnDef.cell, cell.getContext())
4775
- }
4776
- )
4777
- },
4778
- cell.id
4779
- );
4780
- })
4781
- },
4782
- row.id
4783
- );
4784
- })
4785
- }
4786
- );
4914
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
4915
+ }
4916
+ )
4917
+ },
4918
+ cell.id
4919
+ );
4920
+ })
4921
+ },
4922
+ row.id
4923
+ );
4924
+ }) });
4787
4925
  };
4788
4926
  var ColumnGroupHeader = ({
4789
4927
  columnGroupingModel,
@@ -4839,12 +4977,12 @@ var ColumnGroupHeader = ({
4839
4977
  });
4840
4978
  return cells;
4841
4979
  }, [fieldToGroup, gridColumns, columnWidths, columnVisibility, checkboxSelection, pinnedColumnOffsets]);
4842
- return /* @__PURE__ */ jsx35("tr", { className: "bg-muted border-b border-border", children: groupCells.map((cell, idx) => /* @__PURE__ */ jsx35(
4980
+ return /* @__PURE__ */ jsx35("tr", { className: "bg-muted", children: groupCells.map((cell, idx) => /* @__PURE__ */ jsx35(
4843
4981
  "th",
4844
4982
  {
4845
4983
  colSpan: cell.colSpan,
4846
4984
  className: cn(
4847
- "px-4 text-center font-semibold text-muted-foreground border-b-2 border-border bg-muted overflow-hidden",
4985
+ "px-4 text-center font-semibold text-muted-foreground border-b border-border bg-muted overflow-hidden",
4848
4986
  showColumnVerticalBorder && "border-r last:border-r-0",
4849
4987
  cell.pinnedInfo && "sticky z-[2]"
4850
4988
  ),
@@ -4910,6 +5048,7 @@ function DataGrid({
4910
5048
  columnGroupingModel
4911
5049
  }) {
4912
5050
  const tableContainerRef = React35.useRef(null);
5051
+ const effectiveVirtualized = virtualized && !columns.some((col) => col.rowSpan);
4913
5052
  const computedInitialSort = React35.useMemo(() => {
4914
5053
  if (initialSortModel && initialSortModel.length > 0) {
4915
5054
  return initialSortModel.map((s) => ({ id: s.field, desc: s.sort === "desc" }));
@@ -5005,7 +5144,7 @@ function DataGrid({
5005
5144
  data: rows,
5006
5145
  columns: tanstackColumns,
5007
5146
  getCoreRowModel: getCoreRowModel(),
5008
- getPaginationRowModel: virtualized ? void 0 : paginationMode === "client" ? getPaginationRowModel() : void 0,
5147
+ getPaginationRowModel: effectiveVirtualized ? void 0 : paginationMode === "client" ? getPaginationRowModel() : void 0,
5009
5148
  getSortedRowModel: sortingMode === "client" ? getSortedRowModel() : void 0,
5010
5149
  getFilteredRowModel: filterMode === "client" ? getFilteredRowModel() : void 0,
5011
5150
  getRowId: getRowId ? (row) => String(getRowId(row)) : void 0,
@@ -5013,7 +5152,7 @@ function DataGrid({
5013
5152
  sorting,
5014
5153
  globalFilter,
5015
5154
  rowSelection,
5016
- pagination: virtualized ? void 0 : pagination,
5155
+ pagination: effectiveVirtualized ? void 0 : pagination,
5017
5156
  columnVisibility,
5018
5157
  columnSizing
5019
5158
  },
@@ -5024,7 +5163,7 @@ function DataGrid({
5024
5163
  setRowSelection(newValue);
5025
5164
  onRowSelectionModelChange?.(newValue);
5026
5165
  },
5027
- onPaginationChange: virtualized ? void 0 : (updater) => {
5166
+ onPaginationChange: effectiveVirtualized ? void 0 : (updater) => {
5028
5167
  const newValue = typeof updater === "function" ? updater(pagination) : updater;
5029
5168
  setPagination(newValue);
5030
5169
  onPaginationModelChange?.({ page: newValue.pageIndex, pageSize: newValue.pageSize });
@@ -5050,10 +5189,10 @@ function DataGrid({
5050
5189
  }
5051
5190
  },
5052
5191
  enableRowSelection: checkboxSelection,
5053
- manualPagination: virtualized ? true : paginationMode === "server",
5192
+ manualPagination: effectiveVirtualized ? true : paginationMode === "server",
5054
5193
  manualSorting: sortingMode === "server",
5055
5194
  manualFiltering: filterMode === "server",
5056
- pageCount: virtualized ? void 0 : paginationMode === "server" && rowCount ? Math.ceil(rowCount / pagination.pageSize) : void 0
5195
+ pageCount: effectiveVirtualized ? void 0 : paginationMode === "server" && rowCount ? Math.ceil(rowCount / pagination.pageSize) : void 0
5057
5196
  });
5058
5197
  const rowHeight = densityRowHeights[density];
5059
5198
  const showQuickFilter = slotProps?.toolbar?.showQuickFilter !== false;
@@ -5061,6 +5200,12 @@ function DataGrid({
5061
5200
  const showExport = slotProps?.toolbar?.showExport !== false;
5062
5201
  const customButtons = slotProps?.toolbar?.customButtons;
5063
5202
  const moreOptions = slotProps?.toolbar?.moreOptions || [];
5203
+ const rowSpanMap = React35.useMemo(() => {
5204
+ const hasRowSpan = columns.some((col) => col.rowSpan);
5205
+ if (!hasRowSpan) return void 0;
5206
+ return computeRowSpanMap(table.getRowModel().rows, columns);
5207
+ }, [table.getRowModel().rows, columns]);
5208
+ const hasColSpan = React35.useMemo(() => columns.some((col) => col.colSpan), [columns]);
5064
5209
  const containerStyle = {
5065
5210
  ...sx
5066
5211
  };
@@ -5073,7 +5218,7 @@ function DataGrid({
5073
5218
  "div",
5074
5219
  {
5075
5220
  className: cn(
5076
- "rounded-lg border border-border bg-background overflow-hidden flex flex-col",
5221
+ "rounded-lg border border-border bg-background overflow-hidden flex flex-col text-xs",
5077
5222
  className
5078
5223
  ),
5079
5224
  style: containerStyle,
@@ -5103,7 +5248,7 @@ function DataGrid({
5103
5248
  className: "relative flex-1 overflow-auto",
5104
5249
  children: [
5105
5250
  loading && /* @__PURE__ */ jsx35("div", { className: "absolute inset-0 bg-background/80 flex items-center justify-center z-10", children: /* @__PURE__ */ jsx35(Spinner, { size: "lg" }) }),
5106
- /* @__PURE__ */ jsxs20("table", { className: "w-full border-collapse table-fixed", children: [
5251
+ /* @__PURE__ */ jsxs20("table", { className: "w-full border-separate border-spacing-0 table-fixed", children: [
5107
5252
  /* @__PURE__ */ jsx35("colgroup", { children: table.getVisibleLeafColumns().map((column) => {
5108
5253
  const colWidth = columnWidths.get(column.id);
5109
5254
  return /* @__PURE__ */ jsx35(
@@ -5118,7 +5263,7 @@ function DataGrid({
5118
5263
  column.id
5119
5264
  );
5120
5265
  }) }),
5121
- /* @__PURE__ */ jsxs20("thead", { className: "sticky top-0 z-[1]", children: [
5266
+ /* @__PURE__ */ jsxs20("thead", { className: "sticky top-0 z-[3] bg-muted", children: [
5122
5267
  columnGroupingModel && columnGroupingModel.length > 0 && /* @__PURE__ */ jsx35(
5123
5268
  ColumnGroupHeader,
5124
5269
  {
@@ -5142,13 +5287,13 @@ function DataGrid({
5142
5287
  "th",
5143
5288
  {
5144
5289
  className: cn(
5145
- "px-4 text-left font-medium text-muted-foreground border-b border-border bg-muted overflow-hidden relative",
5290
+ "px-4 text-left text-xs font-medium text-muted-foreground border-b border-border bg-muted overflow-hidden relative",
5146
5291
  showColumnVerticalBorder && "border-r last:border-r-0",
5147
5292
  header.column.getCanSort() && "cursor-pointer select-none hover:bg-muted/80",
5148
5293
  // Add cursor class when resizing
5149
5294
  header.column.getIsResizing() && "cursor-col-resize",
5150
5295
  // Pinned column styling
5151
- pinnedInfo && "sticky z-[2]",
5296
+ pinnedInfo && "sticky z-[4]",
5152
5297
  pinnedInfo?.side === "left" && "border-r border-border",
5153
5298
  pinnedInfo?.side === "right" && "border-l border-border"
5154
5299
  ),
@@ -5199,10 +5344,11 @@ function DataGrid({
5199
5344
  globalWrapText: wrapText,
5200
5345
  columnWidths,
5201
5346
  pinnedColumnOffsets,
5347
+ columnVisibility,
5202
5348
  position: "top"
5203
5349
  }
5204
5350
  ),
5205
- virtualized ? /* @__PURE__ */ jsx35(
5351
+ effectiveVirtualized ? /* @__PURE__ */ jsx35(
5206
5352
  VirtualizedTableBody,
5207
5353
  {
5208
5354
  table,
@@ -5215,7 +5361,9 @@ function DataGrid({
5215
5361
  parentRef: tableContainerRef,
5216
5362
  globalWrapText: wrapText,
5217
5363
  columnWidths,
5218
- pinnedColumnOffsets
5364
+ pinnedColumnOffsets,
5365
+ rowSpanMap,
5366
+ gridColumns: hasColSpan ? columns : void 0
5219
5367
  }
5220
5368
  ) : /* @__PURE__ */ jsx35(
5221
5369
  StandardTableBody,
@@ -5228,7 +5376,9 @@ function DataGrid({
5228
5376
  getRowClassName,
5229
5377
  globalWrapText: wrapText,
5230
5378
  columnWidths,
5231
- pinnedColumnOffsets
5379
+ pinnedColumnOffsets,
5380
+ rowSpanMap,
5381
+ gridColumns: hasColSpan ? columns : void 0
5232
5382
  }
5233
5383
  ),
5234
5384
  pinnedBottomTable && pinnedBottomTable.length > 0 && /* @__PURE__ */ jsx35(
@@ -5244,6 +5394,7 @@ function DataGrid({
5244
5394
  globalWrapText: wrapText,
5245
5395
  columnWidths,
5246
5396
  pinnedColumnOffsets,
5397
+ columnVisibility,
5247
5398
  position: "bottom"
5248
5399
  }
5249
5400
  )
@@ -5251,7 +5402,7 @@ function DataGrid({
5251
5402
  ]
5252
5403
  }
5253
5404
  ),
5254
- !virtualized && !hideFooter && !hideFooterPagination && /* @__PURE__ */ jsx35(
5405
+ !effectiveVirtualized && !hideFooter && !hideFooterPagination && /* @__PURE__ */ jsx35(
5255
5406
  DataGridPagination,
5256
5407
  {
5257
5408
  table,
@@ -5260,7 +5411,7 @@ function DataGrid({
5260
5411
  paginationMode
5261
5412
  }
5262
5413
  ),
5263
- virtualized && !hideFooter && /* @__PURE__ */ jsx35("div", { className: "flex items-center justify-end gap-4 px-4 py-3 border-t border-border bg-background", children: /* @__PURE__ */ jsxs20("span", { className: "text-sm text-muted-foreground whitespace-nowrap", children: [
5414
+ effectiveVirtualized && !hideFooter && /* @__PURE__ */ jsx35("div", { className: "flex items-center justify-end gap-4 px-4 py-3 border-t border-border bg-background", children: /* @__PURE__ */ jsxs20("span", { className: "text-xs text-muted-foreground whitespace-nowrap", children: [
5264
5415
  table.getFilteredRowModel().rows.length,
5265
5416
  " total rows (virtualized)"
5266
5417
  ] }) })