@dmsi/wedgekit-react 0.0.28 → 0.0.30

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.
Files changed (43) hide show
  1. package/dist/{chunk-57WRM337.js → chunk-5POWRPIO.js} +3 -2
  2. package/dist/{chunk-S5KPS4IQ.js → chunk-HXEPUO5W.js} +189 -95
  3. package/dist/chunk-KHQX42T7.js +127 -0
  4. package/dist/{chunk-OUSNH76S.js → chunk-PCCJ7L3N.js} +29 -6
  5. package/dist/{chunk-PDDZ5PMY.js → chunk-S46RZBT4.js} +3 -2
  6. package/dist/components/CalendarRange.cjs +28 -5
  7. package/dist/components/CalendarRange.js +1 -1
  8. package/dist/components/DataGrid.cjs +490 -217
  9. package/dist/components/DataGrid.js +303 -122
  10. package/dist/components/DataGridCell.cjs +192 -96
  11. package/dist/components/DataGridCell.js +4 -2
  12. package/dist/components/DateInput.cjs +231 -30
  13. package/dist/components/DateInput.js +101 -27
  14. package/dist/components/DateRangeInput.cjs +550 -37
  15. package/dist/components/DateRangeInput.js +413 -34
  16. package/dist/components/MenuOption.cjs +3 -2
  17. package/dist/components/MenuOption.js +1 -1
  18. package/dist/components/MobileDataGrid.cjs +3 -2
  19. package/dist/components/MobileDataGrid.js +1 -1
  20. package/dist/components/NestedMenu.cjs +3 -2
  21. package/dist/components/NestedMenu.js +1 -1
  22. package/dist/components/Notification.cjs +3 -2
  23. package/dist/components/Notification.js +1 -1
  24. package/dist/components/SideMenuGroup.cjs +3 -2
  25. package/dist/components/SideMenuGroup.js +1 -1
  26. package/dist/components/SideMenuItem.cjs +3 -2
  27. package/dist/components/SideMenuItem.js +1 -1
  28. package/dist/components/Stack.cjs +3 -2
  29. package/dist/components/Stack.js +1 -1
  30. package/dist/components/Swatch.cjs +3 -2
  31. package/dist/components/Swatch.js +1 -1
  32. package/dist/components/Time.cjs +3 -2
  33. package/dist/components/Time.js +1 -1
  34. package/dist/index.css +9 -0
  35. package/package.json +1 -1
  36. package/src/components/CalendarRange.tsx +37 -6
  37. package/src/components/DataGrid.tsx +284 -48
  38. package/src/components/DataGridCell.tsx +122 -35
  39. package/src/components/DateInput.tsx +118 -25
  40. package/src/components/DateRangeInput.tsx +544 -30
  41. package/src/components/MenuOption.tsx +18 -14
  42. package/src/components/Stack.tsx +4 -2
  43. package/src/utils/date.ts +206 -0
@@ -12,17 +12,18 @@ import {
12
12
  Select
13
13
  } from "../chunk-2S2Z3L56.js";
14
14
  import {
15
+ DataCellHeader,
15
16
  DataGridCell,
16
17
  DragAlongCell,
17
18
  DraggableCellHeader
18
- } from "../chunk-S5KPS4IQ.js";
19
+ } from "../chunk-HXEPUO5W.js";
19
20
  import {
20
21
  Menu
21
22
  } from "../chunk-VC3R5EUH.js";
22
23
  import "../chunk-Z4UCFUF7.js";
23
24
  import {
24
25
  MenuOption
25
- } from "../chunk-PDDZ5PMY.js";
26
+ } from "../chunk-S46RZBT4.js";
26
27
  import "../chunk-SEKKGFM6.js";
27
28
  import {
28
29
  Search
@@ -52,6 +53,7 @@ import {
52
53
  componentPadding
53
54
  } from "../chunk-RDLEIAQU.js";
54
55
  import {
56
+ __objRest,
55
57
  __spreadProps,
56
58
  __spreadValues
57
59
  } from "../chunk-ORMEWXMH.js";
@@ -114,7 +116,9 @@ function DataGrid({
114
116
  totalRowCount,
115
117
  hideStatusBar,
116
118
  centerHeader,
117
- enableColumnSelector
119
+ enableColumnSelector,
120
+ predeterminedLeftPins = [],
121
+ predeterminedRightPins = []
118
122
  }) {
119
123
  var _a, _b, _c, _d, _e;
120
124
  const [columnOrder, setColumnOrder] = useState(
@@ -188,18 +192,30 @@ function DataGrid({
188
192
  rowSelection,
189
193
  columnVisibility
190
194
  },
195
+ initialState: {
196
+ columnPinning: {
197
+ left: predeterminedLeftPins,
198
+ right: predeterminedRightPins
199
+ }
200
+ },
191
201
  onColumnOrderChange: setColumnOrder,
192
202
  onSortingChange: adaptTableStateSetter(setSortingState),
193
203
  onColumnFiltersChange: adaptTableStateSetter(setColumnFilterState),
194
204
  onRowSelectionChange: adaptTableStateSetter(setRowSelection),
195
205
  filterFns: {
196
206
  startsWith: (row, columnId, filterValue) => {
197
- var _a2;
198
- return (_a2 = row.getValue(columnId)) == null ? void 0 : _a2.toLowerCase().startsWith(filterValue.toLowerCase());
207
+ const cellValue = row == null ? void 0 : row.getValue(columnId);
208
+ if (!cellValue || !filterValue) {
209
+ return true;
210
+ }
211
+ return String(cellValue).toLowerCase().startsWith(String(filterValue).toLowerCase());
199
212
  },
200
213
  endsWith: (row, columnId, filterValue) => {
201
- var _a2;
202
- return (_a2 = row.getValue(columnId)) == null ? void 0 : _a2.toLowerCase().endsWith(filterValue.toLowerCase());
214
+ const cellValue = row == null ? void 0 : row.getValue(columnId);
215
+ if (!cellValue || !filterValue) {
216
+ return true;
217
+ }
218
+ return String(cellValue).toLowerCase().endsWith(String(filterValue).toLowerCase());
203
219
  }
204
220
  }
205
221
  });
@@ -268,6 +284,7 @@ function DataGrid({
268
284
  virtualPaddingLeft = (_c = (_b = virtualColumns[0]) == null ? void 0 : _b.start) != null ? _c : 0;
269
285
  virtualPaddingRight = columnVirtualizer.getTotalSize() - ((_e = (_d = virtualColumns[virtualColumns.length - 1]) == null ? void 0 : _d.end) != null ? _e : 0);
270
286
  }
287
+ const empty = table.getRowModel().rows.length === 0;
271
288
  return /* @__PURE__ */ jsx(
272
289
  DndContext,
273
290
  {
@@ -287,120 +304,154 @@ function DataGrid({
287
304
  id,
288
305
  className: "flex flex-col flex-1 h-full w-full rounded border border-border-primary-normal overflow-hidden text-text-primary-normal",
289
306
  children: [
290
- /* @__PURE__ */ jsx(
307
+ /* @__PURE__ */ jsxs(
291
308
  "div",
292
309
  {
293
- className: "overflow-auto scrollbar-thin relative contain-paint will-change-transform",
310
+ className: clsx(
311
+ "flex overflow-auto scrollbar-thin relative contain-paint will-change-transform",
312
+ empty ? "overflow-y-hidden" : "h-full"
313
+ ),
294
314
  ref: containerRef,
295
- children: /* @__PURE__ */ jsxs("table", { className: "min-w-full grid", children: [
296
- /* @__PURE__ */ jsx("thead", { className: "sticky top-0 z-10 grid", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxs("tr", { className: "flex w-full", children: [
297
- virtualPaddingLeft ? (
298
- // fake empty column to the left for virtualization scroll padding
299
- /* @__PURE__ */ jsx(
300
- "th",
301
- {
302
- style: { display: "flex", width: virtualPaddingLeft }
303
- }
304
- )
305
- ) : null,
306
- virtualColumns.map((virtualColumn) => {
307
- var _a2, _b2, _c2, _d2, _e2;
308
- const header = headerGroup.headers[virtualColumn.index];
309
- if (typeof header.column.columnDef.header === "string") {
310
- const customHeaderWidth = (_a2 = header.column.columnDef.meta) == null ? void 0 : _a2.headerWidth;
311
- return /* @__PURE__ */ jsxs(
312
- DraggableCellHeader,
315
+ children: [
316
+ /* @__PURE__ */ jsx(
317
+ PinnedColumns,
318
+ {
319
+ pinDirection: "left",
320
+ table,
321
+ tableContainerRef: containerRef,
322
+ pagination,
323
+ isLoadingMore,
324
+ hasMore,
325
+ showFilterRow,
326
+ enableColumnSelector
327
+ }
328
+ ),
329
+ /* @__PURE__ */ jsxs("table", { className: "flex-1 grid min-h-min", children: [
330
+ /* @__PURE__ */ jsx("thead", { className: "sticky top-0 z-10 grid", children: table.getCenterHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxs("tr", { className: "flex w-full", children: [
331
+ virtualPaddingLeft ? (
332
+ // fake empty column to the left for virtualization scroll padding
333
+ /* @__PURE__ */ jsx(
334
+ "th",
313
335
  {
314
- id: id ? `${id}-header-${header.id}` : void 0,
315
- header,
316
- locked: (_b2 = header.column.columnDef.meta) == null ? void 0 : _b2.locked,
317
- center: centerHeader,
318
- width: customHeaderWidth,
319
- className: clsx(
320
- header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
321
- "group"
322
- ),
323
- children: [
324
- /* @__PURE__ */ jsx(Subheader, { tall: true, children: header.column.columnDef.header }),
325
- getSortIcon(header.column.getIsSorted()),
326
- !header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(
327
- header.column.getNextSortingOrder(),
328
- true
329
- ),
330
- header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ jsx(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
331
- !((_c2 = header.column.columnDef.meta) == null ? void 0 : _c2.locked) && /* @__PURE__ */ jsx(
332
- "div",
333
- {
334
- onDoubleClick: (e) => {
335
- e.stopPropagation();
336
- header.column.resetSize();
337
- },
338
- onMouseDown: (e) => {
339
- e.stopPropagation();
340
- header.getResizeHandler()(e);
341
- },
342
- onTouchStart: (e) => {
343
- e.stopPropagation();
344
- header.getResizeHandler()(e);
345
- },
346
- className: "absolute right-0 inset-y-0 w-px bg-black cursor-col-resize"
347
- }
348
- )
349
- ]
350
- },
351
- header.id
352
- );
353
- }
354
- return /* @__PURE__ */ jsx(React.Fragment, { children: ((_d2 = header.column.columnDef.meta) == null ? void 0 : _d2.checkbox) ? /* @__PURE__ */ jsx(
355
- DataGridCell,
356
- {
357
- id: id ? `${id}-header-${header.id}` : void 0,
358
- type: "header",
359
- component: "checkbox",
360
- locked: (_e2 = header.column.columnDef.meta) == null ? void 0 : _e2.locked,
361
- children: /* @__PURE__ */ jsx(
362
- Checkbox,
336
+ style: { display: "flex", width: virtualPaddingLeft }
337
+ }
338
+ )
339
+ ) : null,
340
+ virtualColumns.map((virtualColumn) => {
341
+ var _a2, _b2, _c2, _d2;
342
+ const header = headerGroup.headers[virtualColumn.index];
343
+ if (!header) {
344
+ return;
345
+ }
346
+ if (typeof header.column.columnDef.header === "string") {
347
+ const customHeaderWidth = (_a2 = header.column.columnDef.meta) == null ? void 0 : _a2.headerWidth;
348
+ return /* @__PURE__ */ jsxs(
349
+ DraggableCellHeader,
363
350
  {
364
- id: id ? `${id}-select-all-checkbox` : void 0,
365
- checked: allSelectedAcrossPages,
366
- indeterminate: someSelectedAcrossPages,
367
- onChange: toggleSelectAllAcrossPages
368
- }
369
- )
351
+ id: id ? `${id}-header-${header.id}` : void 0,
352
+ header,
353
+ locked: (_b2 = header.column.columnDef.meta) == null ? void 0 : _b2.locked,
354
+ center: centerHeader,
355
+ width: customHeaderWidth,
356
+ className: clsx(
357
+ header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
358
+ "group"
359
+ ),
360
+ children: [
361
+ /* @__PURE__ */ jsx(Subheader, { tall: true, children: header.column.columnDef.header }),
362
+ getSortIcon(header.column.getIsSorted()),
363
+ !header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(
364
+ header.column.getNextSortingOrder(),
365
+ true
366
+ ),
367
+ header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ jsx(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
368
+ /* @__PURE__ */ jsx(
369
+ "div",
370
+ {
371
+ onDoubleClick: (e) => {
372
+ e.stopPropagation();
373
+ header.column.resetSize();
374
+ },
375
+ onMouseDown: (e) => {
376
+ e.stopPropagation();
377
+ header.getResizeHandler()(e);
378
+ },
379
+ onTouchStart: (e) => {
380
+ e.stopPropagation();
381
+ header.getResizeHandler()(e);
382
+ },
383
+ className: "absolute right-0 inset-y-0 w-px bg-black cursor-col-resize"
384
+ }
385
+ )
386
+ ]
387
+ },
388
+ header.id
389
+ );
370
390
  }
371
- ) : flexRender(
372
- header.column.columnDef.header,
373
- header.getContext()
374
- ) }, header.id);
375
- }),
376
- virtualPaddingRight ? (
377
- //fake empty column to the right for virtualization scroll padding
378
- /* @__PURE__ */ jsx(
379
- "th",
391
+ return /* @__PURE__ */ jsx(React.Fragment, { children: ((_c2 = header.column.columnDef.meta) == null ? void 0 : _c2.checkbox) ? /* @__PURE__ */ jsx(
392
+ DataGridCell,
393
+ {
394
+ id: id ? `${id}-header-${header.id}` : void 0,
395
+ type: "header",
396
+ component: "checkbox",
397
+ locked: (_d2 = header.column.columnDef.meta) == null ? void 0 : _d2.locked,
398
+ children: /* @__PURE__ */ jsx(
399
+ Checkbox,
400
+ {
401
+ id: id ? `${id}-select-all-checkbox` : void 0,
402
+ checked: allSelectedAcrossPages,
403
+ indeterminate: someSelectedAcrossPages,
404
+ onChange: toggleSelectAllAcrossPages
405
+ }
406
+ )
407
+ }
408
+ ) : flexRender(
409
+ header.column.columnDef.header,
410
+ header.getContext()
411
+ ) }, header.id);
412
+ }),
413
+ virtualPaddingRight ? (
414
+ //fake empty column to the right for virtualization scroll padding
415
+ /* @__PURE__ */ jsx(
416
+ "th",
417
+ {
418
+ style: { display: "flex", width: virtualPaddingRight }
419
+ }
420
+ )
421
+ ) : null,
422
+ enableColumnSelector && /* @__PURE__ */ jsx(
423
+ ColumnSelectorHeaderCell,
380
424
  {
381
- style: { display: "flex", width: virtualPaddingRight }
425
+ id: id ? `${id}-column-selector` : void 0,
426
+ table,
427
+ toggleColumnVisibility,
428
+ resetColumnVisibility
382
429
  }
383
430
  )
384
- ) : null,
385
- enableColumnSelector && /* @__PURE__ */ jsx(
386
- ColumnSelectorHeaderCell,
431
+ ] }, headerGroup.id)) }),
432
+ /* @__PURE__ */ jsx(
433
+ TableBody,
387
434
  {
388
- id: id ? `${id}-column-selector` : void 0,
435
+ id,
436
+ columnVirtualizer,
389
437
  table,
390
- toggleColumnVisibility,
391
- resetColumnVisibility
438
+ tableContainerRef: containerRef,
439
+ virtualPaddingLeft,
440
+ virtualPaddingRight,
441
+ pagination,
442
+ isLoadingMore,
443
+ hasMore,
444
+ showFilterRow,
445
+ enableColumnSelector
392
446
  }
393
447
  )
394
- ] }, headerGroup.id)) }),
448
+ ] }),
395
449
  /* @__PURE__ */ jsx(
396
- TableBody,
450
+ PinnedColumns,
397
451
  {
398
- id,
399
- columnVirtualizer,
452
+ pinDirection: "right",
400
453
  table,
401
454
  tableContainerRef: containerRef,
402
- virtualPaddingLeft,
403
- virtualPaddingRight,
404
455
  pagination,
405
456
  isLoadingMore,
406
457
  hasMore,
@@ -408,10 +459,10 @@ function DataGrid({
408
459
  enableColumnSelector
409
460
  }
410
461
  )
411
- ] })
462
+ ]
412
463
  }
413
464
  ),
414
- table.getRowModel().rows.length === 0 && /* @__PURE__ */ jsxs(
465
+ empty && /* @__PURE__ */ jsxs(
415
466
  "div",
416
467
  {
417
468
  className: clsx(
@@ -521,7 +572,9 @@ function TableBody({
521
572
  isLoadingMore,
522
573
  hasMore,
523
574
  showFilterRow,
524
- enableColumnSelector = false
575
+ enableColumnSelector = false,
576
+ locked,
577
+ pinDirection
525
578
  }) {
526
579
  const { rows } = table.getRowModel();
527
580
  const rowVirtualizer = useVirtualizer({
@@ -531,9 +584,19 @@ function TableBody({
531
584
  overscan: 8
532
585
  });
533
586
  const virtualRows = rowVirtualizer.getVirtualItems();
587
+ const CellElement = locked ? DataGridCell : DragAlongCell;
588
+ let headerGroups;
589
+ if (pinDirection === "left") {
590
+ headerGroups = table.getLeftHeaderGroups();
591
+ } else if (pinDirection === "right") {
592
+ headerGroups = table.getRightHeaderGroups();
593
+ } else {
594
+ headerGroups = table.getCenterHeaderGroups();
595
+ }
534
596
  return /* @__PURE__ */ jsxs(
535
597
  "tbody",
536
598
  {
599
+ className: clsx(locked ? "shadow-16" : ""),
537
600
  style: {
538
601
  display: "grid",
539
602
  height: `${showFilterRow ? rowVirtualizer.getTotalSize() + 40 : rowVirtualizer.getTotalSize()}px`,
@@ -554,16 +617,16 @@ function TableBody({
554
617
  zIndex: 10
555
618
  },
556
619
  className: "even:bg-background-grouped-primary-normal odd:bg-background-grouped-secondary-normal",
557
- children: table.getHeaderGroups().flatMap(
620
+ children: headerGroups.flatMap(
558
621
  (x) => x.headers.map((header) => {
559
622
  var _a, _b, _c, _d, _e;
560
623
  return /* @__PURE__ */ jsx(
561
- DragAlongCell,
624
+ CellElement,
562
625
  {
563
626
  id: id ? `${id}-filter-cell-${header.id}` : void 0,
564
627
  noPadding: true,
565
628
  cell: header,
566
- width: (_a = header.column.columnDef.meta) == null ? void 0 : _a.headerWidth,
629
+ width: ((_a = header.column.columnDef.meta) == null ? void 0 : _a.headerWidth) || (locked ? `${header.column.getSize()}px` : ""),
567
630
  children: header.column.getCanFilter() && ((_e = (_c = (_b = header.column.columnDef.meta) == null ? void 0 : _b.filterRowCell) == null ? void 0 : _c.call(_b, {
568
631
  header,
569
632
  table
@@ -598,7 +661,9 @@ function TableBody({
598
661
  virtualPaddingRight,
599
662
  virtualRow,
600
663
  showFilterRow,
601
- enableColumnSelector
664
+ enableColumnSelector,
665
+ locked,
666
+ pinDirection
602
667
  },
603
668
  row.id
604
669
  );
@@ -629,11 +694,21 @@ function TableBodyRow({
629
694
  virtualPaddingRight,
630
695
  virtualRow,
631
696
  showFilterRow,
632
- enableColumnSelector = false
697
+ enableColumnSelector = false,
698
+ locked,
699
+ pinDirection
633
700
  }) {
634
- const visibleCells = row.getVisibleCells();
635
- const virtualColumns = columnVirtualizer.getVirtualItems();
701
+ var _a;
702
+ let visibleCells;
703
+ if (locked) {
704
+ visibleCells = pinDirection === "left" ? row.getLeftVisibleCells() : row.getRightVisibleCells();
705
+ } else {
706
+ visibleCells = row.getCenterVisibleCells();
707
+ }
708
+ const virtualColumns = (_a = columnVirtualizer == null ? void 0 : columnVirtualizer.getVirtualItems()) != null ? _a : [];
709
+ const columns = locked ? visibleCells : virtualColumns;
636
710
  const isError = typeof row.original === "object" && row.original !== null && "rowState" in row.original && row.original.rowState === "error";
711
+ const CellElement = locked ? DataGridCell : DragAlongCell;
637
712
  return /* @__PURE__ */ jsxs(
638
713
  "tr",
639
714
  {
@@ -650,15 +725,18 @@ function TableBodyRow({
650
725
  width: "100%"
651
726
  },
652
727
  children: [
653
- virtualPaddingLeft ? (
728
+ !locked && virtualPaddingLeft ? (
654
729
  // fake empty column to the left for virtualization scroll padding
655
730
  /* @__PURE__ */ jsx("td", { style: { display: "flex", width: virtualPaddingLeft } })
656
731
  ) : null,
657
- virtualColumns.map((virtualColumn) => {
658
- var _a;
659
- const cell = visibleCells[virtualColumn.index];
660
- return ((_a = cell.column.columnDef.meta) == null ? void 0 : _a.useCustomRenderer) ? /* @__PURE__ */ jsx(React.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id) : /* @__PURE__ */ jsx(
661
- DragAlongCell,
732
+ columns.map((column) => {
733
+ var _a2;
734
+ const cell = locked ? column : visibleCells[column.index];
735
+ if (!cell) {
736
+ return;
737
+ }
738
+ return ((_a2 = cell.column.columnDef.meta) == null ? void 0 : _a2.useCustomRenderer) ? /* @__PURE__ */ jsx(React.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id) : /* @__PURE__ */ jsx(
739
+ CellElement,
662
740
  {
663
741
  id: id ? `${id}-cell-${cell.id}` : void 0,
664
742
  cell,
@@ -676,16 +754,119 @@ function TableBodyRow({
676
754
  cell.id
677
755
  );
678
756
  }),
679
- virtualPaddingRight ? (
757
+ !locked && virtualPaddingRight ? (
680
758
  // fake empty column to the right for virtualization scroll padding
681
759
  /* @__PURE__ */ jsx("td", { style: { display: "flex", width: virtualPaddingRight } })
682
760
  ) : null,
683
- enableColumnSelector && /* @__PURE__ */ jsx("td", {})
761
+ enableColumnSelector && !locked && /* @__PURE__ */ jsx("td", { className: "p-2", style: { width: "48.8px" } })
684
762
  ]
685
763
  },
686
764
  row.id
687
765
  );
688
766
  }
767
+ function PinnedColumns(_a) {
768
+ var _b = _a, {
769
+ pinDirection = "left",
770
+ table,
771
+ centerHeader,
772
+ allSelectedAcrossPages,
773
+ someSelectedAcrossPages,
774
+ toggleSelectAllAcrossPages
775
+ } = _b, props = __objRest(_b, [
776
+ "pinDirection",
777
+ "table",
778
+ "centerHeader",
779
+ "allSelectedAcrossPages",
780
+ "someSelectedAcrossPages",
781
+ "toggleSelectAllAcrossPages"
782
+ ]);
783
+ var _a2;
784
+ const headerGroups = pinDirection === "left" ? table.getLeftHeaderGroups() : table.getRightHeaderGroups();
785
+ return ((_a2 = headerGroups[0]) == null ? void 0 : _a2.headers.length) > 0 && /* @__PURE__ */ jsxs("table", { className: clsx(
786
+ "grid min-h-min sticky z-20 bg-background-grouped-primary-normal",
787
+ pinDirection === "left" ? "left-0" : "right-0"
788
+ ), children: [
789
+ /* @__PURE__ */ jsx("thead", { className: "sticky top-0 z-20 grid", children: headerGroups.map((headerGroup) => {
790
+ return /* @__PURE__ */ jsx("tr", { className: "flex w-full", children: headerGroup.headers.map((header) => {
791
+ var _a3, _b2, _c;
792
+ if (!header) {
793
+ return;
794
+ }
795
+ if (typeof header.column.columnDef.header === "string") {
796
+ const customHeaderWidth = (_a3 = header.column.columnDef.meta) == null ? void 0 : _a3.headerWidth;
797
+ return /* @__PURE__ */ jsxs(
798
+ DataCellHeader,
799
+ {
800
+ locked: true,
801
+ header,
802
+ center: centerHeader,
803
+ width: customHeaderWidth,
804
+ className: clsx(
805
+ header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
806
+ "group"
807
+ ),
808
+ children: [
809
+ /* @__PURE__ */ jsx(Subheader, { tall: true, children: header.column.columnDef.header }),
810
+ getSortIcon(header.column.getIsSorted()),
811
+ !header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(
812
+ header.column.getNextSortingOrder(),
813
+ true
814
+ ),
815
+ header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ jsx(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
816
+ !((_b2 = header.column.columnDef.meta) == null ? void 0 : _b2.locked) && /* @__PURE__ */ jsx(
817
+ "div",
818
+ {
819
+ onDoubleClick: (e) => {
820
+ e.stopPropagation();
821
+ header.column.resetSize();
822
+ },
823
+ onMouseDown: (e) => {
824
+ e.stopPropagation();
825
+ header.getResizeHandler()(e);
826
+ },
827
+ onTouchStart: (e) => {
828
+ e.stopPropagation();
829
+ header.getResizeHandler()(e);
830
+ },
831
+ className: "absolute right-0 inset-y-0 w-px bg-black cursor-col-resize"
832
+ }
833
+ )
834
+ ]
835
+ },
836
+ header.id
837
+ );
838
+ }
839
+ return /* @__PURE__ */ jsx(React.Fragment, { children: ((_c = header.column.columnDef.meta) == null ? void 0 : _c.checkbox) ? /* @__PURE__ */ jsx(
840
+ DataGridCell,
841
+ {
842
+ type: "header",
843
+ component: "checkbox",
844
+ locked: true,
845
+ children: /* @__PURE__ */ jsx(
846
+ Checkbox,
847
+ {
848
+ checked: allSelectedAcrossPages,
849
+ indeterminate: someSelectedAcrossPages,
850
+ onChange: toggleSelectAllAcrossPages
851
+ }
852
+ )
853
+ }
854
+ ) : flexRender(
855
+ header.column.columnDef.header,
856
+ header.getContext()
857
+ ) }, header.id);
858
+ }) }, headerGroup.id);
859
+ }) }),
860
+ /* @__PURE__ */ jsx(
861
+ TableBody,
862
+ __spreadProps(__spreadValues({}, props), {
863
+ table,
864
+ locked: true,
865
+ pinDirection
866
+ })
867
+ )
868
+ ] });
869
+ }
689
870
  var LoadingCell = ({
690
871
  id,
691
872
  column