@dmsi/wedgekit-react 0.0.179 → 0.0.180

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.
@@ -3,41 +3,38 @@ import {
3
3
  } from "../chunk-3WNXMCZV.js";
4
4
  import {
5
5
  Select
6
- } from "../chunk-KADNOKNW.js";
6
+ } from "../chunk-XH65MD2C.js";
7
+ import {
8
+ Checkbox
9
+ } from "../chunk-WFQEE2OO.js";
7
10
  import {
8
11
  DataCellHeader,
9
12
  DataGridCell,
10
13
  DragAlongCell,
11
14
  DraggableCellHeader
12
- } from "../chunk-ZZMVPZMF.js";
15
+ } from "../chunk-Z2KZO4J3.js";
13
16
  import {
14
17
  Menu
15
- } from "../chunk-UZZLQASG.js";
18
+ } from "../chunk-UBU6IJML.js";
16
19
  import "../chunk-5GUW4DUY.js";
17
20
  import {
18
21
  MenuOption
19
- } from "../chunk-AEDEFN7A.js";
20
- import "../chunk-WVUIIBRR.js";
22
+ } from "../chunk-FFU6FB3K.js";
23
+ import {
24
+ useInfiniteScroll
25
+ } from "../chunk-WNQ53SVY.js";
21
26
  import "../chunk-6LN6QT6M.js";
22
27
  import {
23
28
  Search
24
- } from "../chunk-IDSFWKOR.js";
29
+ } from "../chunk-PMBEIP24.js";
25
30
  import {
26
31
  Input
27
- } from "../chunk-MVGOAMTP.js";
32
+ } from "../chunk-4T3DRGLF.js";
33
+ import "../chunk-5UH6QUFB.js";
28
34
  import {
29
35
  Label
30
36
  } from "../chunk-JWCT72WR.js";
31
- import {
32
- Checkbox
33
- } from "../chunk-WFQEE2OO.js";
34
- import {
35
- Button
36
- } from "../chunk-FKMKHLQH.js";
37
- import {
38
- useInfiniteScroll
39
- } from "../chunk-WNQ53SVY.js";
40
- import "../chunk-5UH6QUFB.js";
37
+ import "../chunk-WVUIIBRR.js";
41
38
  import {
42
39
  Subheader
43
40
  } from "../chunk-CYZL57LH.js";
@@ -51,6 +48,9 @@ import {
51
48
  import {
52
49
  Paragraph
53
50
  } from "../chunk-HVI3CL7Y.js";
51
+ import {
52
+ Button
53
+ } from "../chunk-FKMKHLQH.js";
54
54
  import {
55
55
  Icon
56
56
  } from "../chunk-NKUETCDA.js";
@@ -379,130 +379,12 @@ function TableBody({
379
379
  );
380
380
  }
381
381
 
382
- // src/components/DataGrid/PinnedColumns.tsx
383
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
384
- function PinnedColumns(_a) {
385
- var _b = _a, {
386
- pinDirection = "left",
387
- table,
388
- centerHeader,
389
- allSelectedAcrossPages,
390
- someSelectedAcrossPages,
391
- toggleSelectAllAcrossPages,
392
- testid
393
- } = _b, props = __objRest(_b, [
394
- "pinDirection",
395
- "table",
396
- "centerHeader",
397
- "allSelectedAcrossPages",
398
- "someSelectedAcrossPages",
399
- "toggleSelectAllAcrossPages",
400
- "testid"
401
- ]);
402
- var _a2;
403
- const headerGroups = pinDirection === "left" ? table.getLeftHeaderGroups() : table.getRightHeaderGroups();
404
- const pinnedTestId = testid ? `${pinDirection}-pinned-${testid}` : void 0;
405
- return ((_a2 = headerGroups[0]) == null ? void 0 : _a2.headers.length) > 0 && /* @__PURE__ */ jsxs3(
406
- "table",
407
- {
408
- className: clsx4(
409
- "flex flex-col min-h-min sticky z-20",
410
- pinDirection === "left" ? "left-0" : "right-0"
411
- ),
412
- "data-testid": pinnedTestId,
413
- children: [
414
- /* @__PURE__ */ jsx5("thead", { className: "sticky top-0 z-20 grid", children: headerGroups.map((headerGroup) => {
415
- return /* @__PURE__ */ jsx5(
416
- "tr",
417
- {
418
- "data-testid": pinnedTestId ? `${pinnedTestId}-header-row-${headerGroup.id}` : void 0,
419
- className: "flex w-full",
420
- children: headerGroup.headers.map((header) => {
421
- var _a3, _b2, _c, _d;
422
- if (!header) {
423
- return;
424
- }
425
- if (typeof header.column.columnDef.header === "string") {
426
- return /* @__PURE__ */ jsxs3(
427
- DataCellHeader,
428
- {
429
- locked: true,
430
- testid: pinnedTestId ? `${pinnedTestId}-header-${header.id}` : void 0,
431
- header,
432
- center: centerHeader,
433
- width: (_b2 = (_a3 = header.column.columnDef.meta) == null ? void 0 : _a3.headerWidth) != null ? _b2 : `${header.column.getSize()}px`,
434
- className: clsx4(
435
- header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
436
- "group"
437
- ),
438
- children: [
439
- /* @__PURE__ */ jsx5(Subheader, { tall: true, children: header.column.columnDef.header }),
440
- getSortIcon(header.column.getIsSorted()),
441
- !header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(
442
- header.column.getNextSortingOrder(),
443
- true
444
- ),
445
- header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ jsx5(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
446
- !((_c = header.column.columnDef.meta) == null ? void 0 : _c.locked) && /* @__PURE__ */ jsx5(
447
- "div",
448
- {
449
- onDoubleClick: (e) => {
450
- e.stopPropagation();
451
- header.column.resetSize();
452
- },
453
- onMouseDown: (e) => {
454
- e.stopPropagation();
455
- header.getResizeHandler()(e);
456
- },
457
- onTouchStart: (e) => {
458
- e.stopPropagation();
459
- header.getResizeHandler()(e);
460
- },
461
- className: "absolute right-0 inset-y-0 w-px bg-black cursor-col-resize"
462
- }
463
- )
464
- ]
465
- },
466
- header.id
467
- );
468
- }
469
- return /* @__PURE__ */ jsx5(React2.Fragment, { children: ((_d = header.column.columnDef.meta) == null ? void 0 : _d.checkbox) ? /* @__PURE__ */ jsx5(DataGridCell, { type: "header", component: "checkbox", locked: true, children: /* @__PURE__ */ jsx5(
470
- Checkbox,
471
- {
472
- checked: allSelectedAcrossPages,
473
- indeterminate: someSelectedAcrossPages,
474
- onChange: toggleSelectAllAcrossPages
475
- }
476
- ) }) : flexRender2(
477
- header.column.columnDef.header,
478
- header.getContext()
479
- ) }, header.id);
480
- })
481
- },
482
- headerGroup.id
483
- );
484
- }) }),
485
- /* @__PURE__ */ jsx5(
486
- TableBody,
487
- __spreadProps(__spreadValues({
488
- testid: pinnedTestId
489
- }, props), {
490
- table,
491
- locked: true,
492
- pinDirection
493
- })
494
- )
495
- ]
496
- }
497
- );
498
- }
499
-
500
382
  // src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx
501
383
  import { useRef, useState as useState2 } from "react";
502
384
 
503
385
  // src/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.tsx
504
386
  import { useState } from "react";
505
- import { jsx as jsx6 } from "react/jsx-runtime";
387
+ import { jsx as jsx5 } from "react/jsx-runtime";
506
388
  function ColumnSelectorMenuOption({
507
389
  id,
508
390
  testid,
@@ -511,7 +393,7 @@ function ColumnSelectorMenuOption({
511
393
  }) {
512
394
  const [isVisible, setIsVisible] = useState(column.getIsVisible());
513
395
  const label = typeof column.columnDef.header === "string" ? column.columnDef.header : null;
514
- return /* @__PURE__ */ jsx6(MenuOption, { id, testid, selected: isVisible, defaultChecked: isVisible, children: /* @__PURE__ */ jsx6(
396
+ return /* @__PURE__ */ jsx5(MenuOption, { id, testid, selected: isVisible, defaultChecked: isVisible, children: /* @__PURE__ */ jsx5(
515
397
  Checkbox,
516
398
  {
517
399
  id: id ? `${id}-checkbox` : void 0,
@@ -527,7 +409,7 @@ function ColumnSelectorMenuOption({
527
409
  }
528
410
 
529
411
  // src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx
530
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
412
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
531
413
  function ColumnSelectorHeaderCell({
532
414
  id,
533
415
  testid,
@@ -537,7 +419,7 @@ function ColumnSelectorHeaderCell({
537
419
  }) {
538
420
  const ref = useRef(null);
539
421
  const [show, setShow] = useState2(false);
540
- return /* @__PURE__ */ jsxs4(
422
+ return /* @__PURE__ */ jsxs3(
541
423
  DataGridCell,
542
424
  {
543
425
  id,
@@ -547,7 +429,7 @@ function ColumnSelectorHeaderCell({
547
429
  color: "text-secondary-normal",
548
430
  ref,
549
431
  children: [
550
- /* @__PURE__ */ jsx7(
432
+ /* @__PURE__ */ jsx6(
551
433
  Button,
552
434
  {
553
435
  id: id ? `${id}-button` : void 0,
@@ -555,10 +437,10 @@ function ColumnSelectorHeaderCell({
555
437
  onClick: () => setShow((prev) => !prev),
556
438
  variant: "navigation",
557
439
  iconOnly: true,
558
- leftIcon: /* @__PURE__ */ jsx7(Icon, { name: "tune" })
440
+ leftIcon: /* @__PURE__ */ jsx6(Icon, { name: "tune" })
559
441
  }
560
442
  ),
561
- /* @__PURE__ */ jsxs4(
443
+ /* @__PURE__ */ jsxs3(
562
444
  Menu,
563
445
  {
564
446
  id: id ? `${id}-menu` : void 0,
@@ -569,7 +451,7 @@ function ColumnSelectorHeaderCell({
569
451
  setShow,
570
452
  calculateMinMaxHeight: true,
571
453
  children: [
572
- /* @__PURE__ */ jsx7(
454
+ /* @__PURE__ */ jsx6(
573
455
  Button,
574
456
  {
575
457
  id: id ? `${id}-reset-button` : void 0,
@@ -585,7 +467,7 @@ function ColumnSelectorHeaderCell({
585
467
  table.getAllColumns().filter((x) => {
586
468
  var _a;
587
469
  return (_a = x.columnDef.meta) == null ? void 0 : _a.inVisibilityMenu;
588
- }).map((column) => /* @__PURE__ */ jsx7(
470
+ }).map((column) => /* @__PURE__ */ jsx6(
589
471
  ColumnSelectorMenuOption,
590
472
  {
591
473
  id: id ? `${id}-option-${column.id}` : void 0,
@@ -603,6 +485,146 @@ function ColumnSelectorHeaderCell({
603
485
  );
604
486
  }
605
487
 
488
+ // src/components/DataGrid/PinnedColumns.tsx
489
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
490
+ function PinnedColumns(_a) {
491
+ var _b = _a, {
492
+ id,
493
+ pinDirection = "left",
494
+ table,
495
+ centerHeader,
496
+ allSelectedAcrossPages,
497
+ someSelectedAcrossPages,
498
+ toggleSelectAllAcrossPages,
499
+ testid,
500
+ enableColumnSelector,
501
+ toggleColumnVisibility,
502
+ resetColumnVisibility
503
+ } = _b, props = __objRest(_b, [
504
+ "id",
505
+ "pinDirection",
506
+ "table",
507
+ "centerHeader",
508
+ "allSelectedAcrossPages",
509
+ "someSelectedAcrossPages",
510
+ "toggleSelectAllAcrossPages",
511
+ "testid",
512
+ "enableColumnSelector",
513
+ "toggleColumnVisibility",
514
+ "resetColumnVisibility"
515
+ ]);
516
+ var _a2;
517
+ const headerGroups = pinDirection === "left" ? table.getLeftHeaderGroups() : table.getRightHeaderGroups();
518
+ const pinnedTestId = testid ? `${pinDirection}-pinned-${testid}` : void 0;
519
+ const hasAnyHeaders = ((_a2 = headerGroups[0]) == null ? void 0 : _a2.headers.length) > 0;
520
+ if (!hasAnyHeaders && !enableColumnSelector) return;
521
+ return /* @__PURE__ */ jsxs4(
522
+ "table",
523
+ {
524
+ className: clsx4(
525
+ "flex flex-col min-h-min sticky z-20",
526
+ pinDirection === "left" ? "left-0" : "right-0"
527
+ ),
528
+ "data-testid": pinnedTestId,
529
+ children: [
530
+ /* @__PURE__ */ jsx7("thead", { className: "sticky top-0 z-20 grid", children: headerGroups.map((headerGroup) => {
531
+ return /* @__PURE__ */ jsxs4(
532
+ "tr",
533
+ {
534
+ "data-testid": pinnedTestId ? `${pinnedTestId}-header-row-${headerGroup.id}` : void 0,
535
+ className: "flex w-full",
536
+ children: [
537
+ headerGroup.headers.map((header) => {
538
+ var _a3, _b2, _c;
539
+ if (!header) {
540
+ return;
541
+ }
542
+ if (typeof header.column.columnDef.header === "string") {
543
+ const customHeaderWidth = (_a3 = header.column.columnDef.meta) == null ? void 0 : _a3.headerWidth;
544
+ return /* @__PURE__ */ jsxs4(
545
+ DataCellHeader,
546
+ {
547
+ locked: true,
548
+ testid: pinnedTestId ? `${pinnedTestId}-header-${header.id}` : void 0,
549
+ header,
550
+ center: centerHeader,
551
+ width: customHeaderWidth,
552
+ className: clsx4(
553
+ header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
554
+ "group"
555
+ ),
556
+ children: [
557
+ /* @__PURE__ */ jsx7(Subheader, { tall: true, children: header.column.columnDef.header }),
558
+ getSortIcon(header.column.getIsSorted()),
559
+ !header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(header.column.getNextSortingOrder(), true),
560
+ header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ jsx7(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
561
+ !((_b2 = header.column.columnDef.meta) == null ? void 0 : _b2.locked) && /* @__PURE__ */ jsx7(
562
+ "div",
563
+ {
564
+ onDoubleClick: (e) => {
565
+ e.stopPropagation();
566
+ header.column.resetSize();
567
+ },
568
+ onMouseDown: (e) => {
569
+ e.stopPropagation();
570
+ header.getResizeHandler()(e);
571
+ },
572
+ onTouchStart: (e) => {
573
+ e.stopPropagation();
574
+ header.getResizeHandler()(e);
575
+ },
576
+ className: "absolute right-0 inset-y-0 w-px bg-black cursor-col-resize"
577
+ }
578
+ )
579
+ ]
580
+ },
581
+ header.id
582
+ );
583
+ }
584
+ return /* @__PURE__ */ jsx7(React2.Fragment, { children: ((_c = header.column.columnDef.meta) == null ? void 0 : _c.checkbox) ? /* @__PURE__ */ jsx7(DataGridCell, { type: "header", component: "checkbox", locked: true, children: /* @__PURE__ */ jsx7(
585
+ Checkbox,
586
+ {
587
+ checked: allSelectedAcrossPages,
588
+ indeterminate: someSelectedAcrossPages,
589
+ onChange: toggleSelectAllAcrossPages
590
+ }
591
+ ) }) : flexRender2(
592
+ header.column.columnDef.header,
593
+ header.getContext()
594
+ ) }, header.id);
595
+ }),
596
+ enableColumnSelector && /* @__PURE__ */ jsx7(
597
+ ColumnSelectorHeaderCell,
598
+ {
599
+ id: id ? `${id}-column-selector` : void 0,
600
+ testid: testid ? `${testid}-column-selector` : void 0,
601
+ table,
602
+ toggleColumnVisibility: toggleColumnVisibility != null ? toggleColumnVisibility : () => {
603
+ },
604
+ resetColumnVisibility: resetColumnVisibility != null ? resetColumnVisibility : () => {
605
+ }
606
+ }
607
+ )
608
+ ]
609
+ },
610
+ headerGroup.id
611
+ );
612
+ }) }),
613
+ /* @__PURE__ */ jsx7(
614
+ TableBody,
615
+ __spreadProps(__spreadValues({
616
+ testid: pinnedTestId
617
+ }, props), {
618
+ table,
619
+ locked: true,
620
+ pinDirection
621
+ })
622
+ )
623
+ ]
624
+ }
625
+ );
626
+ }
627
+
606
628
  // src/components/DataGrid/index.tsx
607
629
  import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
608
630
  var PAGE_SIZE_OPTIONS = [5, 10, 15, 20, 25, 30, 35];
@@ -838,8 +860,7 @@ function DataGrid({
838
860
  pagination,
839
861
  isLoadingMore,
840
862
  hasMore,
841
- showFilterRow,
842
- enableColumnSelector
863
+ showFilterRow
843
864
  }
844
865
  ),
845
866
  /* @__PURE__ */ jsxs5("table", { className: "flex-1 flex flex-col min-h-min", children: [
@@ -948,17 +969,7 @@ function DataGrid({
948
969
  style: { display: "flex", width: virtualPaddingRight }
949
970
  }
950
971
  )
951
- ) : null,
952
- enableColumnSelector && /* @__PURE__ */ jsx8(
953
- ColumnSelectorHeaderCell,
954
- {
955
- id: id ? `${id}-column-selector` : void 0,
956
- testid: testid ? `${testid}-column-selector` : void 0,
957
- table,
958
- toggleColumnVisibility,
959
- resetColumnVisibility
960
- }
961
- )
972
+ ) : null
962
973
  ]
963
974
  },
964
975
  headerGroup.id
@@ -984,6 +995,10 @@ function DataGrid({
984
995
  /* @__PURE__ */ jsx8(
985
996
  PinnedColumns,
986
997
  {
998
+ id,
999
+ enableColumnSelector,
1000
+ toggleColumnVisibility,
1001
+ resetColumnVisibility,
987
1002
  testid,
988
1003
  pinDirection: "right",
989
1004
  table,
@@ -991,8 +1006,7 @@ function DataGrid({
991
1006
  pagination,
992
1007
  isLoadingMore,
993
1008
  hasMore,
994
- showFilterRow,
995
- enableColumnSelector
1009
+ showFilterRow
996
1010
  }
997
1011
  )
998
1012
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmsi/wedgekit-react",
3
3
  "private": false,
4
- "version": "0.0.179",
4
+ "version": "0.0.180",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup",