@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.
@@ -2206,7 +2206,7 @@ function getSortIcon(sort, nextSort = false) {
2206
2206
  }
2207
2207
 
2208
2208
  // src/components/DataGrid/PinnedColumns.tsx
2209
- var import_react12 = __toESM(require("react"), 1);
2209
+ var import_react14 = __toESM(require("react"), 1);
2210
2210
 
2211
2211
  // src/components/DataGrid/TableBody/index.tsx
2212
2212
  var import_react_virtual = require("@tanstack/react-virtual");
@@ -2474,139 +2474,21 @@ function TableBody({
2474
2474
  );
2475
2475
  }
2476
2476
 
2477
- // src/components/DataGrid/PinnedColumns.tsx
2478
- var import_jsx_runtime13 = require("react/jsx-runtime");
2479
- function PinnedColumns(_a) {
2480
- var _b = _a, {
2481
- pinDirection = "left",
2482
- table,
2483
- centerHeader,
2484
- allSelectedAcrossPages,
2485
- someSelectedAcrossPages,
2486
- toggleSelectAllAcrossPages,
2487
- testid
2488
- } = _b, props = __objRest(_b, [
2489
- "pinDirection",
2490
- "table",
2491
- "centerHeader",
2492
- "allSelectedAcrossPages",
2493
- "someSelectedAcrossPages",
2494
- "toggleSelectAllAcrossPages",
2495
- "testid"
2496
- ]);
2497
- var _a2;
2498
- const headerGroups = pinDirection === "left" ? table.getLeftHeaderGroups() : table.getRightHeaderGroups();
2499
- const pinnedTestId = testid ? `${pinDirection}-pinned-${testid}` : void 0;
2500
- return ((_a2 = headerGroups[0]) == null ? void 0 : _a2.headers.length) > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2501
- "table",
2502
- {
2503
- className: (0, import_clsx12.default)(
2504
- "flex flex-col min-h-min sticky z-20",
2505
- pinDirection === "left" ? "left-0" : "right-0"
2506
- ),
2507
- "data-testid": pinnedTestId,
2508
- children: [
2509
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { className: "sticky top-0 z-20 grid", children: headerGroups.map((headerGroup) => {
2510
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2511
- "tr",
2512
- {
2513
- "data-testid": pinnedTestId ? `${pinnedTestId}-header-row-${headerGroup.id}` : void 0,
2514
- className: "flex w-full",
2515
- children: headerGroup.headers.map((header) => {
2516
- var _a3, _b2, _c, _d;
2517
- if (!header) {
2518
- return;
2519
- }
2520
- if (typeof header.column.columnDef.header === "string") {
2521
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2522
- DataCellHeader,
2523
- {
2524
- locked: true,
2525
- testid: pinnedTestId ? `${pinnedTestId}-header-${header.id}` : void 0,
2526
- header,
2527
- center: centerHeader,
2528
- width: (_b2 = (_a3 = header.column.columnDef.meta) == null ? void 0 : _a3.headerWidth) != null ? _b2 : `${header.column.getSize()}px`,
2529
- className: (0, import_clsx12.default)(
2530
- header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
2531
- "group"
2532
- ),
2533
- children: [
2534
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Subheader, { tall: true, children: header.column.columnDef.header }),
2535
- getSortIcon(header.column.getIsSorted()),
2536
- !header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(
2537
- header.column.getNextSortingOrder(),
2538
- true
2539
- ),
2540
- header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
2541
- !((_c = header.column.columnDef.meta) == null ? void 0 : _c.locked) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2542
- "div",
2543
- {
2544
- onDoubleClick: (e) => {
2545
- e.stopPropagation();
2546
- header.column.resetSize();
2547
- },
2548
- onMouseDown: (e) => {
2549
- e.stopPropagation();
2550
- header.getResizeHandler()(e);
2551
- },
2552
- onTouchStart: (e) => {
2553
- e.stopPropagation();
2554
- header.getResizeHandler()(e);
2555
- },
2556
- className: "absolute right-0 inset-y-0 w-px bg-black cursor-col-resize"
2557
- }
2558
- )
2559
- ]
2560
- },
2561
- header.id
2562
- );
2563
- }
2564
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react12.default.Fragment, { children: ((_d = header.column.columnDef.meta) == null ? void 0 : _d.checkbox) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DataGridCell, { type: "header", component: "checkbox", locked: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2565
- Checkbox,
2566
- {
2567
- checked: allSelectedAcrossPages,
2568
- indeterminate: someSelectedAcrossPages,
2569
- onChange: toggleSelectAllAcrossPages
2570
- }
2571
- ) }) : (0, import_react_table2.flexRender)(
2572
- header.column.columnDef.header,
2573
- header.getContext()
2574
- ) }, header.id);
2575
- })
2576
- },
2577
- headerGroup.id
2578
- );
2579
- }) }),
2580
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2581
- TableBody,
2582
- __spreadProps(__spreadValues({
2583
- testid: pinnedTestId
2584
- }, props), {
2585
- table,
2586
- locked: true,
2587
- pinDirection
2588
- })
2589
- )
2590
- ]
2591
- }
2592
- );
2593
- }
2594
-
2595
2477
  // src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx
2596
- var import_react14 = require("react");
2478
+ var import_react13 = require("react");
2597
2479
 
2598
2480
  // src/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.tsx
2599
- var import_react13 = require("react");
2600
- var import_jsx_runtime14 = require("react/jsx-runtime");
2481
+ var import_react12 = require("react");
2482
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2601
2483
  function ColumnSelectorMenuOption({
2602
2484
  id,
2603
2485
  testid,
2604
2486
  column,
2605
2487
  toggleColumnVisibility
2606
2488
  }) {
2607
- const [isVisible, setIsVisible] = (0, import_react13.useState)(column.getIsVisible());
2489
+ const [isVisible, setIsVisible] = (0, import_react12.useState)(column.getIsVisible());
2608
2490
  const label = typeof column.columnDef.header === "string" ? column.columnDef.header : null;
2609
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuOption, { id, testid, selected: isVisible, defaultChecked: isVisible, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2491
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuOption, { id, testid, selected: isVisible, defaultChecked: isVisible, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2610
2492
  Checkbox,
2611
2493
  {
2612
2494
  id: id ? `${id}-checkbox` : void 0,
@@ -2622,7 +2504,7 @@ function ColumnSelectorMenuOption({
2622
2504
  }
2623
2505
 
2624
2506
  // src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx
2625
- var import_jsx_runtime15 = require("react/jsx-runtime");
2507
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2626
2508
  function ColumnSelectorHeaderCell({
2627
2509
  id,
2628
2510
  testid,
@@ -2630,9 +2512,9 @@ function ColumnSelectorHeaderCell({
2630
2512
  toggleColumnVisibility,
2631
2513
  resetColumnVisibility
2632
2514
  }) {
2633
- const ref = (0, import_react14.useRef)(null);
2634
- const [show, setShow] = (0, import_react14.useState)(false);
2635
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2515
+ const ref = (0, import_react13.useRef)(null);
2516
+ const [show, setShow] = (0, import_react13.useState)(false);
2517
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2636
2518
  DataGridCell,
2637
2519
  {
2638
2520
  id,
@@ -2642,7 +2524,7 @@ function ColumnSelectorHeaderCell({
2642
2524
  color: "text-secondary-normal",
2643
2525
  ref,
2644
2526
  children: [
2645
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2527
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2646
2528
  Button,
2647
2529
  {
2648
2530
  id: id ? `${id}-button` : void 0,
@@ -2650,10 +2532,10 @@ function ColumnSelectorHeaderCell({
2650
2532
  onClick: () => setShow((prev) => !prev),
2651
2533
  variant: "navigation",
2652
2534
  iconOnly: true,
2653
- leftIcon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { name: "tune" })
2535
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: "tune" })
2654
2536
  }
2655
2537
  ),
2656
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2538
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2657
2539
  Menu,
2658
2540
  {
2659
2541
  id: id ? `${id}-menu` : void 0,
@@ -2664,7 +2546,7 @@ function ColumnSelectorHeaderCell({
2664
2546
  setShow,
2665
2547
  calculateMinMaxHeight: true,
2666
2548
  children: [
2667
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2549
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2668
2550
  Button,
2669
2551
  {
2670
2552
  id: id ? `${id}-reset-button` : void 0,
@@ -2680,7 +2562,7 @@ function ColumnSelectorHeaderCell({
2680
2562
  table.getAllColumns().filter((x) => {
2681
2563
  var _a;
2682
2564
  return (_a = x.columnDef.meta) == null ? void 0 : _a.inVisibilityMenu;
2683
- }).map((column) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2565
+ }).map((column) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2684
2566
  ColumnSelectorMenuOption,
2685
2567
  {
2686
2568
  id: id ? `${id}-option-${column.id}` : void 0,
@@ -2698,6 +2580,146 @@ function ColumnSelectorHeaderCell({
2698
2580
  );
2699
2581
  }
2700
2582
 
2583
+ // src/components/DataGrid/PinnedColumns.tsx
2584
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2585
+ function PinnedColumns(_a) {
2586
+ var _b = _a, {
2587
+ id,
2588
+ pinDirection = "left",
2589
+ table,
2590
+ centerHeader,
2591
+ allSelectedAcrossPages,
2592
+ someSelectedAcrossPages,
2593
+ toggleSelectAllAcrossPages,
2594
+ testid,
2595
+ enableColumnSelector,
2596
+ toggleColumnVisibility,
2597
+ resetColumnVisibility
2598
+ } = _b, props = __objRest(_b, [
2599
+ "id",
2600
+ "pinDirection",
2601
+ "table",
2602
+ "centerHeader",
2603
+ "allSelectedAcrossPages",
2604
+ "someSelectedAcrossPages",
2605
+ "toggleSelectAllAcrossPages",
2606
+ "testid",
2607
+ "enableColumnSelector",
2608
+ "toggleColumnVisibility",
2609
+ "resetColumnVisibility"
2610
+ ]);
2611
+ var _a2;
2612
+ const headerGroups = pinDirection === "left" ? table.getLeftHeaderGroups() : table.getRightHeaderGroups();
2613
+ const pinnedTestId = testid ? `${pinDirection}-pinned-${testid}` : void 0;
2614
+ const hasAnyHeaders = ((_a2 = headerGroups[0]) == null ? void 0 : _a2.headers.length) > 0;
2615
+ if (!hasAnyHeaders && !enableColumnSelector) return;
2616
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2617
+ "table",
2618
+ {
2619
+ className: (0, import_clsx12.default)(
2620
+ "flex flex-col min-h-min sticky z-20",
2621
+ pinDirection === "left" ? "left-0" : "right-0"
2622
+ ),
2623
+ "data-testid": pinnedTestId,
2624
+ children: [
2625
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { className: "sticky top-0 z-20 grid", children: headerGroups.map((headerGroup) => {
2626
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2627
+ "tr",
2628
+ {
2629
+ "data-testid": pinnedTestId ? `${pinnedTestId}-header-row-${headerGroup.id}` : void 0,
2630
+ className: "flex w-full",
2631
+ children: [
2632
+ headerGroup.headers.map((header) => {
2633
+ var _a3, _b2, _c;
2634
+ if (!header) {
2635
+ return;
2636
+ }
2637
+ if (typeof header.column.columnDef.header === "string") {
2638
+ const customHeaderWidth = (_a3 = header.column.columnDef.meta) == null ? void 0 : _a3.headerWidth;
2639
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2640
+ DataCellHeader,
2641
+ {
2642
+ locked: true,
2643
+ testid: pinnedTestId ? `${pinnedTestId}-header-${header.id}` : void 0,
2644
+ header,
2645
+ center: centerHeader,
2646
+ width: customHeaderWidth,
2647
+ className: (0, import_clsx12.default)(
2648
+ header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
2649
+ "group"
2650
+ ),
2651
+ children: [
2652
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Subheader, { tall: true, children: header.column.columnDef.header }),
2653
+ getSortIcon(header.column.getIsSorted()),
2654
+ !header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(header.column.getNextSortingOrder(), true),
2655
+ header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
2656
+ !((_b2 = header.column.columnDef.meta) == null ? void 0 : _b2.locked) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2657
+ "div",
2658
+ {
2659
+ onDoubleClick: (e) => {
2660
+ e.stopPropagation();
2661
+ header.column.resetSize();
2662
+ },
2663
+ onMouseDown: (e) => {
2664
+ e.stopPropagation();
2665
+ header.getResizeHandler()(e);
2666
+ },
2667
+ onTouchStart: (e) => {
2668
+ e.stopPropagation();
2669
+ header.getResizeHandler()(e);
2670
+ },
2671
+ className: "absolute right-0 inset-y-0 w-px bg-black cursor-col-resize"
2672
+ }
2673
+ )
2674
+ ]
2675
+ },
2676
+ header.id
2677
+ );
2678
+ }
2679
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react14.default.Fragment, { children: ((_c = header.column.columnDef.meta) == null ? void 0 : _c.checkbox) ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DataGridCell, { type: "header", component: "checkbox", locked: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2680
+ Checkbox,
2681
+ {
2682
+ checked: allSelectedAcrossPages,
2683
+ indeterminate: someSelectedAcrossPages,
2684
+ onChange: toggleSelectAllAcrossPages
2685
+ }
2686
+ ) }) : (0, import_react_table2.flexRender)(
2687
+ header.column.columnDef.header,
2688
+ header.getContext()
2689
+ ) }, header.id);
2690
+ }),
2691
+ enableColumnSelector && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2692
+ ColumnSelectorHeaderCell,
2693
+ {
2694
+ id: id ? `${id}-column-selector` : void 0,
2695
+ testid: testid ? `${testid}-column-selector` : void 0,
2696
+ table,
2697
+ toggleColumnVisibility: toggleColumnVisibility != null ? toggleColumnVisibility : () => {
2698
+ },
2699
+ resetColumnVisibility: resetColumnVisibility != null ? resetColumnVisibility : () => {
2700
+ }
2701
+ }
2702
+ )
2703
+ ]
2704
+ },
2705
+ headerGroup.id
2706
+ );
2707
+ }) }),
2708
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2709
+ TableBody,
2710
+ __spreadProps(__spreadValues({
2711
+ testid: pinnedTestId
2712
+ }, props), {
2713
+ table,
2714
+ locked: true,
2715
+ pinDirection
2716
+ })
2717
+ )
2718
+ ]
2719
+ }
2720
+ );
2721
+ }
2722
+
2701
2723
  // src/components/DataGrid/index.tsx
2702
2724
  var import_jsx_runtime16 = require("react/jsx-runtime");
2703
2725
  var PAGE_SIZE_OPTIONS = [5, 10, 15, 20, 25, 30, 35];
@@ -2933,8 +2955,7 @@ function DataGrid({
2933
2955
  pagination,
2934
2956
  isLoadingMore,
2935
2957
  hasMore,
2936
- showFilterRow,
2937
- enableColumnSelector
2958
+ showFilterRow
2938
2959
  }
2939
2960
  ),
2940
2961
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("table", { className: "flex-1 flex flex-col min-h-min", children: [
@@ -3043,17 +3064,7 @@ function DataGrid({
3043
3064
  style: { display: "flex", width: virtualPaddingRight }
3044
3065
  }
3045
3066
  )
3046
- ) : null,
3047
- enableColumnSelector && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3048
- ColumnSelectorHeaderCell,
3049
- {
3050
- id: id ? `${id}-column-selector` : void 0,
3051
- testid: testid ? `${testid}-column-selector` : void 0,
3052
- table,
3053
- toggleColumnVisibility,
3054
- resetColumnVisibility
3055
- }
3056
- )
3067
+ ) : null
3057
3068
  ]
3058
3069
  },
3059
3070
  headerGroup.id
@@ -3079,6 +3090,10 @@ function DataGrid({
3079
3090
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3080
3091
  PinnedColumns,
3081
3092
  {
3093
+ id,
3094
+ enableColumnSelector,
3095
+ toggleColumnVisibility,
3096
+ resetColumnVisibility,
3082
3097
  testid,
3083
3098
  pinDirection: "right",
3084
3099
  table,
@@ -3086,8 +3101,7 @@ function DataGrid({
3086
3101
  pagination,
3087
3102
  isLoadingMore,
3088
3103
  hasMore,
3089
- showFilterRow,
3090
- enableColumnSelector
3104
+ showFilterRow
3091
3105
  }
3092
3106
  )
3093
3107
  ]