@prt-ts/fluent-react-table-v2 9.46.8-build.5.0 → 9.46.8-build.7.0

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/index.esm.js CHANGED
@@ -1,15 +1,14 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { useMemo } from 'react';
4
- import { makeStaticStyles, makeStyles, shorthands, tokens, useId, Dropdown, Option, Input, Button, Divider, Popover, PopoverTrigger, Tooltip, PopoverSurface, MenuGroupHeader, Switch, Checkbox, RadioGroup, Radio, Field, InlineDrawer, DrawerHeader, DrawerHeaderTitle, DrawerBody, Accordion, AccordionItem, AccordionHeader, Caption1Stronger, AccordionPanel, DrawerFooter, mergeClasses as mergeClasses$1, Menu, MenuTrigger, MenuButton, MenuPopover, MenuList, MenuGroup, MenuItem, MenuDivider, Skeleton, SkeletonItem, Subtitle2Stronger, MenuItemRadio } from '@fluentui/react-components';
5
- import { Show, For, Switch as Switch$1, Case } from '@prt-ts/react-control-flow';
4
+ import { makeStaticStyles, makeStyles, shorthands, tokens, useId, Dropdown, Option, Input, Button, Divider, Popover, PopoverTrigger, Tooltip, PopoverSurface, MenuGroupHeader, Checkbox, mergeClasses as mergeClasses$1, Menu, MenuTrigger, MenuButton, MenuPopover, MenuList, MenuGroup, MenuItem, MenuDivider, Skeleton, SkeletonItem, Subtitle2Stronger, Radio, RadioGroup, Field, InlineDrawer, DrawerHeader, DrawerHeaderTitle, DrawerBody, Accordion, AccordionItem, AccordionHeader, Caption1Stronger, AccordionPanel, DrawerFooter, MenuItemRadio } from '@fluentui/react-components';
5
+ import { Show, For, Switch, Case } from '@prt-ts/react-control-flow';
6
6
  import { useReactTable, getCoreRowModel, getPaginationRowModel, getSortedRowModel, getFilteredRowModel, getGroupedRowModel, getExpandedRowModel, getFacetedUniqueValues, getFacetedMinMaxValues, flexRender } from '@tanstack/react-table';
7
7
  export { createColumnHelper } from '@tanstack/react-table';
8
- import { useVirtualizer } from '@tanstack/react-virtual';
9
- import { DatePicker } from '@fluentui/react-datepicker-compat';
10
8
  import { useSortable, SortableContext, horizontalListSortingStrategy, arrayMove } from '@dnd-kit/sortable';
11
9
  import { CSS } from '@dnd-kit/utilities';
12
10
  import { useVirtual } from 'react-virtual';
11
+ import { DatePicker } from '@fluentui/react-datepicker-compat';
13
12
  import { useSensor, PointerSensor, MouseSensor, TouchSensor, KeyboardSensor, useSensors, DndContext, closestCenter } from '@dnd-kit/core';
14
13
  import { restrictToHorizontalAxis } from '@dnd-kit/modifiers';
15
14
 
@@ -23,7 +22,7 @@ const useTableStaticStyles = makeStyles({
23
22
  // height: "650px",
24
23
  width: "100%" }, shorthands.overflow("hidden", "auto")), {
25
24
  /* width */
26
- ":hover": Object.assign({}, shorthands.overflow("auto", "auto")), "::-webkit-scrollbar": Object.assign({ width: "6px", height: "4px" }, shorthands.borderRadius("50%")),
25
+ ":hover": Object.assign({}, shorthands.overflow("auto", "auto")), "::-webkit-scrollbar": Object.assign({ width: "8px", height: "4px" }, shorthands.borderRadius("50%")),
27
26
  /* Track */
28
27
  "::-webkit-scrollbar-track": {
29
28
  "background-color": "#f1f1f1",
@@ -986,6 +985,7 @@ const ArrowNextFilled = /*#__PURE__*/createFluentIcon('ArrowNextFilled', "1em",
986
985
  const ArrowPreviousFilled = /*#__PURE__*/createFluentIcon('ArrowPreviousFilled', "1em", ["M6 4.75c-.38 0-.7.28-.74.65l-.01.1v9a.75.75 0 0 0 1.5.1V5.5A.75.75 0 0 0 6 4.75Zm8.28.22a.75.75 0 0 0-.98-.07l-.08.07-4.5 4.5a.75.75 0 0 0-.07.98l.07.08 4.5 4.5a.75.75 0 0 0 1.13-.98l-.07-.08L10.31 10l3.97-3.97c.3-.3.3-.77 0-1.06Z"], {
987
986
  flipInRtl: true
988
987
  });
988
+ const ArrowSortFilled = /*#__PURE__*/createFluentIcon('ArrowSortFilled', "1em", ["M14.84 16.72a.76.76 0 0 1-.59.28.73.73 0 0 1-.53-.22l-3-3a.75.75 0 0 1 1.06-1.07l1.72 1.73V3.75a.75.75 0 0 1 1.5 0v10.68l1.72-1.71a.75.75 0 1 1 1.06 1.06l-2.94 2.94ZM6.34 3.28A.76.76 0 0 0 5.75 3c-.2 0-.38.07-.53.22l-3 3A.75.75 0 0 0 3.28 7.3L5 5.56v10.69a.75.75 0 0 0 1.5 0V5.57l1.72 1.71a.75.75 0 1 0 1.06-1.06L6.34 3.28Z"]);
989
989
  const ArrowStepInLeftRegular = /*#__PURE__*/createFluentIcon('ArrowStepInLeftRegular', "1em", ["M5 10a1 1 0 1 0-2 0 1 1 0 0 0 2 0ZM4 8a2 2 0 1 1 0 4 2 2 0 0 1 0-4Zm14 2a.5.5 0 0 1-.5.5H9.7l3.15 3.15a.5.5 0 0 1-.7.7l-4-4a.5.5 0 0 1 0-.7l4-4a.5.5 0 0 1 .7.7L9.71 9.5h7.79c.28 0 .5.22.5.5Z"]);
990
990
  const ArrowStepInRightRegular = /*#__PURE__*/createFluentIcon('ArrowStepInRightRegular', "1em", ["M15 10a1 1 0 1 0 2 0 1 1 0 0 0-2 0Zm1 2a2 2 0 1 1 0-4 2 2 0 0 1 0 4ZM2 10c0-.28.22-.5.5-.5h7.8L7.14 6.35a.5.5 0 1 1 .7-.7l4 4c.2.2.2.5 0 .7l-4 4a.5.5 0 0 1-.7-.7l3.14-3.15H2.5A.5.5 0 0 1 2 10Z"]);
991
991
 
@@ -997,6 +997,8 @@ const ColumnEditFilled = /*#__PURE__*/createFluentIcon('ColumnEditFilled', "1em"
997
997
  const ColumnEditRegular = /*#__PURE__*/createFluentIcon('ColumnEditRegular', "1em", ["M3 3.5c0-.28.22-.5.5-.5H4a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-.5a.5.5 0 0 1 0-1H4a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-.5a.5.5 0 0 1-.5-.5ZM9 4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h.47l-.04.16-.21.84H9a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v6.94l-1 1V5a1 1 0 0 0-1-1H9Zm6 1v4.94l-1 1V5c0-1.1.9-2 2-2h.5a.5.5 0 0 1 0 1H16a1 1 0 0 0-1 1Zm-4.02 10.38 4.83-4.83a1.87 1.87 0 1 1 2.64 2.64l-4.83 4.83a2.2 2.2 0 0 1-1.02.58l-1.5.37a.89.89 0 0 1-1.07-1.07l.37-1.5c.1-.39.3-.74.58-1.02Z"]);
998
998
  const DragFilled = /*#__PURE__*/createFluentIcon('DragFilled', "1em", ["M10 2c.2 0 .39.08.53.22l1.5 1.5a.75.75 0 0 1-1.06 1.06l-.22-.22v1.69a.75.75 0 0 1-1.5 0V4.56l-.22.22a.75.75 0 0 1-1.06-1.06l1.5-1.5A.75.75 0 0 1 10 2Zm2 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm-9.78-.53a.75.75 0 0 0 0 1.06l1.5 1.5a.75.75 0 0 0 1.06-1.06l-.22-.22h1.69a.75.75 0 0 0 0-1.5H4.56l.22-.22a.75.75 0 0 0-1.06-1.06l-1.5 1.5ZM10 18c.2 0 .39-.08.53-.22l1.5-1.5a.75.75 0 1 0-1.06-1.06l-.22.22v-1.69a.75.75 0 0 0-1.5 0v1.69l-.22-.22a.75.75 0 0 0-1.06 1.06l1.5 1.5c.14.14.33.22.53.22Zm7.78-8.53a.75.75 0 0 1 0 1.06l-1.5 1.5a.75.75 0 1 1-1.06-1.06l.22-.22h-1.69a.75.75 0 0 1 0-1.5h1.69l-.22-.22a.75.75 0 0 1 1.06-1.06l1.5 1.5Z"]);
999
999
  const DragRegular = /*#__PURE__*/createFluentIcon('DragRegular', "1em", ["M9.65 2.15c.2-.2.5-.2.7 0l2 2a.5.5 0 0 1-.7.7L10.5 3.71V6.5a.5.5 0 0 1-1 0V3.7L8.35 4.86a.5.5 0 1 1-.7-.7l2-2ZM10 12a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm0-1a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm5.85 1.35 2-2a.5.5 0 0 0 0-.7l-2-2a.5.5 0 0 0-.7.7l1.14 1.15H13.5a.5.5 0 0 0 0 1h2.8l-1.15 1.15a.5.5 0 0 0 .7.7Zm-5.5 5.5 2-2a.5.5 0 0 0-.7-.7l-1.15 1.14V13.5a.5.5 0 0 0-1 0v2.8l-1.15-1.15a.5.5 0 0 0-.7.7l2 2c.2.2.5.2.7 0Zm-8.2-7.5a.5.5 0 0 1 0-.7l2-2a.5.5 0 1 1 .7.7L3.71 9.5H6.5a.5.5 0 0 1 0 1H3.7l1.15 1.15a.5.5 0 0 1-.7.7l-2-2Z"]);
1000
+ const EyeTrackingOffFilled = /*#__PURE__*/createFluentIcon('EyeTrackingOffFilled', "1em", ["M2.41 3.12C2.15 3.52 2 4 2 4.5v3a.5.5 0 0 0 1 0v-3c0-.23.05-.45.15-.65L6.29 7a6.6 6.6 0 0 0-2.23 2.27v.01l.44.23-.45-.22a.5.5 0 0 0 .9.44v-.01a2.39 2.39 0 0 1 .25-.39 5.49 5.49 0 0 1 1.82-1.6l1.3 1.3a3 3 0 1 0 4.16 4.17l3.67 3.66c-.2.1-.42.15-.65.15h-3a.5.5 0 0 0 0 1h3c.5 0 .98-.15 1.38-.41l.27.26a.5.5 0 0 0 .7-.7l-.26-.27-.74-.73-3.93-3.94-3.63-3.63L8.01 7.3l-.78-.78-3.38-3.37-.73-.74-.27-.26a.5.5 0 1 0-.7.7l.26.27Zm15.57 12.73.02-.35v-3a.5.5 0 0 0-1 0v2.38l.98.97Zm-8.81-8.8A7 7 0 0 1 10 7a5.86 5.86 0 0 1 4.8 2.32 4.13 4.13 0 0 1 .24.39l.01.01a.5.5 0 0 0 .9-.44v-.01l-.01-.01a1.7 1.7 0 0 0-.08-.14l-.25-.38A6.85 6.85 0 0 0 10 6c-.63 0-1.2.07-1.7.18l.86.87Zm6.78 2.23-.06.03-.39.19.45-.22ZM5.12 3H7.5a.5.5 0 0 0 0-1h-3c-.12 0-.24 0-.35.02l.97.98ZM3 15.5c0 .83.67 1.5 1.5 1.5h3a.5.5 0 0 1 0 1h-3A2.5 2.5 0 0 1 2 15.5v-3a.5.5 0 0 1 1 0v3Zm14-11c0-.83-.67-1.5-1.5-1.5h-3a.5.5 0 0 1 0-1h3A2.5 2.5 0 0 1 18 4.5v3a.5.5 0 0 1-1 0v-3Z"]);
1001
+ const EyeTrackingOffRegular = /*#__PURE__*/createFluentIcon('EyeTrackingOffRegular', "1em", ["M2.41 3.12C2.15 3.52 2 4 2 4.5v3a.5.5 0 0 0 1 0v-3c0-.23.05-.45.15-.65L6.29 7a6.6 6.6 0 0 0-2.23 2.27v.01l.44.23-.45-.22a.5.5 0 0 0 .9.44v-.01a2.39 2.39 0 0 1 .25-.39 5.49 5.49 0 0 1 1.82-1.6l1.3 1.3a3 3 0 1 0 4.16 4.17l3.67 3.66c-.2.1-.42.15-.65.15h-3a.5.5 0 0 0 0 1h3c.5 0 .98-.15 1.38-.41l.27.26a.5.5 0 0 0 .7-.7l-.26-.27-.74-.73-3.93-3.94-3.63-3.63L8.01 7.3l-.78-.78-3.38-3.37-.73-.74-.27-.26a.5.5 0 1 0-.7.7l.26.27Zm9.34 9.34a2 2 0 1 1-2.71-2.71l2.71 2.71Zm6.23 3.4.02-.36v-3a.5.5 0 0 0-1 0v2.38l.98.97ZM9.17 7.04A7 7 0 0 1 10 7a5.86 5.86 0 0 1 4.8 2.32 4.13 4.13 0 0 1 .24.39l.01.01a.5.5 0 0 0 .9-.44v-.01l-.01-.01a1.7 1.7 0 0 0-.08-.14l-.25-.38A6.85 6.85 0 0 0 10 6c-.63 0-1.2.07-1.7.18l.86.87Zm6.78 2.23-.06.03-.39.19.45-.22ZM5.12 3H7.5a.5.5 0 0 0 0-1h-3c-.12 0-.24 0-.35.02l.97.98ZM4.5 17A1.5 1.5 0 0 1 3 15.5v-3a.5.5 0 0 0-1 0v3A2.5 2.5 0 0 0 4.5 18h3a.5.5 0 0 0 0-1h-3Zm11-14c.83 0 1.5.67 1.5 1.5v3a.5.5 0 0 0 1 0v-3A2.5 2.5 0 0 0 15.5 2h-3a.5.5 0 0 0 0 1h3Z"]);
1000
1002
  const FilterFilled = /*#__PURE__*/createFluentIcon('FilterFilled', "1em", ["M12.25 13.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5h4.5Zm2-4.25a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5h8.5Zm2-4.25a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1 0-1.5h12.5Z"]);
1001
1003
  const FilterRegular = /*#__PURE__*/createFluentIcon('FilterRegular', "1em", ["M7.5 13h5a.5.5 0 0 1 .09 1H7.5a.5.5 0 0 1-.09-1h5.09-5Zm-2-4h9a.5.5 0 0 1 .09 1H5.5a.5.5 0 0 1-.09-1h9.09-9Zm-2-4h13a.5.5 0 0 1 .09 1H3.5a.5.5 0 0 1-.09-1H16.5h-13Z"]);
1002
1004
  const FilterDismissFilled = /*#__PURE__*/createFluentIcon('FilterDismissFilled', "1em", ["M11.73 10.25A5.46 5.46 0 0 0 14 11c0 .41-.34.75-.75.75h-8.5a.75.75 0 0 1 0-1.5h6.98ZM9.03 6c.04.52.16 1.03.34 1.5H2.75a.75.75 0 0 1 0-1.5h6.27ZM12 15.25a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h4.5c.41 0 .75-.34.75-.75ZM14.5 10a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9Zm1.85-6.35c.2.2.2.5 0 .7L15.21 5.5l1.14 1.15a.5.5 0 0 1-.7.7L14.5 6.21l-1.15 1.14a.5.5 0 0 1-.7-.7l1.14-1.15-1.14-1.15a.5.5 0 0 1 .7-.7l1.15 1.14 1.15-1.14c.2-.2.5-.2.7 0Z"]);
@@ -1005,6 +1007,8 @@ const GroupFilled = /*#__PURE__*/createFluentIcon('GroupFilled', "1em", ["M7 4.5
1005
1007
  const GroupRegular = /*#__PURE__*/createFluentIcon('GroupRegular', "1em", ["M7 4.5c0 .17-.02.34-.05.5H10a1 1 0 0 1 1 1v2h-1a2 2 0 0 0-2 2v1H6a1 1 0 0 1-1-1V6.95a2.51 2.51 0 0 1-1 0V10c0 1.1.9 2 2 2h2v2c0 1.1.9 2 2 2h3.05a2.51 2.51 0 0 1 0-1H10a1 1 0 0 1-1-1v-2h1a2 2 0 0 0 2-2V9h2a1 1 0 0 1 1 1v3.05a2.51 2.51 0 0 1 1 0V10a2 2 0 0 0-2-2h-2V6a2 2 0 0 0-2-2H6.95c.03.16.05.33.05.5ZM11 9v1a1 1 0 0 1-1 1H9v-1a1 1 0 0 1 1-1h1ZM6 4.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm11 11a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0-11a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm-11 11a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z"]);
1006
1008
  const GroupDismissFilled = /*#__PURE__*/createFluentIcon('GroupDismissFilled', "1em", ["M7 4.5c0 .36-.07.7-.2 1H10c.28 0 .5.22.5.5v2H10a2 2 0 0 0-2 2v.5H6a.5.5 0 0 1-.5-.5V6.8a2.5 2.5 0 0 1-1.5.15V10c0 1.1.9 2 2 2h2v2a2 2 0 0 0 1.16 1.81 5.51 5.51 0 0 1 .34-3.6V10c0-.28.22-.5.5-.5h2.2a5.48 5.48 0 0 1 3.61-.34A2 2 0 0 0 14 8h-2V6a2 2 0 0 0-2-2H6.95c.03.16.05.33.05.5Zm-1 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm11 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm-11 11a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm13-1a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0Zm-2.65-1.15a.5.5 0 0 0-.7-.7l-1.15 1.14-1.15-1.14a.5.5 0 0 0-.7.7l1.14 1.15-1.14 1.15a.5.5 0 0 0 .7.7l1.15-1.14 1.15 1.14a.5.5 0 0 0 .7-.7l-1.14-1.15 1.14-1.15Z"]);
1007
1009
  const GroupListRegular = /*#__PURE__*/createFluentIcon('GroupListRegular', "1em", ["M2.5 3a.5.5 0 0 0-.5.5v5c0 .28.22.5.5.5h2a.5.5 0 0 0 0-1H3V4h1.5a.5.5 0 0 0 0-1h-2Zm0 8a.5.5 0 0 0-.5.5v5c0 .28.22.5.5.5h2a.5.5 0 0 0 0-1H3v-4h1.5a.5.5 0 0 0 0-1h-2ZM6 4.5c0-.28.22-.5.5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5Zm.5 7.5a.5.5 0 0 0 0 1h11a.5.5 0 0 0 0-1h-11ZM6 7.5c0-.28.22-.5.5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5Zm.5 7.5a.5.5 0 0 0 0 1h11a.5.5 0 0 0 0-1h-11Z"]);
1010
+ const MoreVerticalFilled = /*#__PURE__*/createFluentIcon('MoreVerticalFilled', "1em", ["M10 6.5A1.75 1.75 0 1 1 10 3a1.75 1.75 0 0 1 0 3.5ZM10 17a1.75 1.75 0 1 1 0-3.5 1.75 1.75 0 0 1 0 3.5Zm-1.75-7a1.75 1.75 0 1 0 3.5 0 1.75 1.75 0 0 0-3.5 0Z"]);
1011
+ const MoreVerticalRegular = /*#__PURE__*/createFluentIcon('MoreVerticalRegular', "1em", ["M10 6a1.25 1.25 0 1 1 0-2.5A1.25 1.25 0 0 1 10 6Zm0 5.25a1.25 1.25 0 1 1 0-2.5 1.25 1.25 0 0 1 0 2.5Zm-1.25 4a1.25 1.25 0 1 0 2.5 0 1.25 1.25 0 0 0-2.5 0Z"]);
1008
1012
  const NextRegular = /*#__PURE__*/createFluentIcon('NextRegular', "1em", ["M17 3.5a.5.5 0 0 0-1 0v13a.5.5 0 1 0 1 0v-13ZM3 4.25c0-1 1.12-1.6 1.95-1.04l8.5 5.71c.73.5.73 1.57 0 2.07l-8.5 5.8A1.25 1.25 0 0 1 3 15.75V4.25Zm1.39-.2a.25.25 0 0 0-.39.2v11.5c0 .2.23.32.4.2l8.49-5.78a.25.25 0 0 0 0-.42l-8.5-5.7Z"]);
1009
1013
 
1010
1014
  const PinFilled = /*#__PURE__*/createFluentIcon('PinFilled', "1em", ["M13.33 2.62a2 2 0 0 0-3.2.52L8.38 6.6a1.5 1.5 0 0 1-.78.72L4 8.75a1 1 0 0 0-.33 1.64l2.61 2.6L3 16.3v.7h.7L7 13.72l2.61 2.6a1 1 0 0 0 1.64-.33l1.43-3.59c.14-.34.4-.62.72-.78l3.46-1.73a2 2 0 0 0 .52-3.2l-4.05-4.06Z"]);
@@ -1018,6 +1022,7 @@ const SearchRegular = /*#__PURE__*/createFluentIcon('SearchRegular', "1em", ["M8
1018
1022
 
1019
1023
  const TableSimpleCheckmarkFilled = /*#__PURE__*/createFluentIcon('TableSimpleCheckmarkFilled', "1em", ["M14 17h-3.5v-6.5H17V14a3 3 0 0 1-3 3Zm3-7.5h-6.5V3H14a3 3 0 0 1 3 3v3.5Zm-7.5 0V3H6a3 3 0 0 0-3 3v3.5h6.5Zm0 7.5v-6.5H3V14a3 3 0 0 0 3 3h3.5Zm5.85-3.9a.5.5 0 0 0-.7-.7l-1.4 1.4-.4-.4a.5.5 0 0 0-.7.7l.75.75c.2.2.5.2.7 0l1.75-1.75Z"]);
1020
1024
  const TableSimpleCheckmarkRegular = /*#__PURE__*/createFluentIcon('TableSimpleCheckmarkRegular', "1em", ["M6 3a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V6a3 3 0 0 0-3-3H6ZM4 6c0-1.1.9-2 2-2h3.5v5.5H4V6Zm6.5 3.5V4H14a2 2 0 0 1 2 2v3.5h-5.5Zm-6.5 1h5.5V16H6a2 2 0 0 1-2-2v-3.5Zm10.86 1.4c.2.2.2.5 0 .7l-1.75 1.75a.5.5 0 0 1-.71 0l-.75-.75a.5.5 0 0 1 .7-.7l.4.4 1.4-1.4c.2-.2.51-.2.7 0Z"]);
1025
+ const TextClearFormattingFilled = /*#__PURE__*/createFluentIcon('TextClearFormattingFilled', "1em", ["M6 2c.2 0 .4.13.47.32l3.5 8.95a.5.5 0 0 1-.94.37L8.01 9H4l-1.04 2.68a.5.5 0 1 1-.94-.36l3.5-9A.5.5 0 0 1 6 2Zm0 1.88L4.4 8H7.6l-1.6-4.12ZM11.5 2c.28 0 .5.22.5.5v3.52a2.48 2.48 0 0 1 2.26-1.3c.89 0 1.6.34 2.15 1 .55.66.82 1.54.82 2.64l-.01.42-.05-.05a2.49 2.49 0 0 0-1.15-.65 2.86 2.86 0 0 0-.53-1.62c-.36-.47-.86-.7-1.48-.7-.6 0-1.09.24-1.47.72-.3.37-.47.83-.54 1.37v1.03c.05.43.18.8.37 1.12L11 11.37V2.5c0-.28.22-.5.5-.5Zm4.97 7.44 2.1 2.1a1.5 1.5 0 0 1-.01 2.12l-3.6 3.6-4.21-4.22 3.6-3.6a1.5 1.5 0 0 1 2.12 0Zm-2.22 8.52-4.21-4.21-.6.6a1.5 1.5 0 0 0 0 2.12l2.1 2.1c.3.3.71.45 1.12.43h4.09a.5.5 0 1 0 0-1h-2.53l.03-.04Z"]);
1021
1026
  const TextSortAscendingFilled = /*#__PURE__*/createFluentIcon('TextSortAscendingFilled', "1em", ["M6.7 2.5a.75.75 0 0 0-1.4 0L3.03 9a.75.75 0 0 0 1.42.5l.34-1h2.4l.34 1A.75.75 0 0 0 8.96 9L6.7 2.5ZM6 5.04 6.68 7H5.32L6 5.04ZM4 11a.75.75 0 0 0 0 1.5h2.53l-3.14 4.3A.75.75 0 0 0 4 18h4a.75.75 0 0 0 0-1.5H5.47l3.14-4.3A.75.75 0 0 0 8 11H4Zm10.25-9c.41 0 .75.34.75.75v12.57l1.45-1.58a.75.75 0 0 1 1.1 1.02l-2.75 3a.75.75 0 0 1-1.1 0l-2.75-3a.75.75 0 0 1 1.1-1.02l1.45 1.58V2.75c0-.41.34-.75.75-.75Z"]);
1022
1027
  const TextSortDescendingFilled = /*#__PURE__*/createFluentIcon('TextSortDescendingFilled', "1em", ["M4 2a.75.75 0 1 0 0 1.5h2.53L3.39 7.8A.75.75 0 0 0 4 9h4a.75.75 0 0 0 0-1.5H5.47l3.14-4.3A.75.75 0 0 0 8 2H4Zm2.7 8.5a.75.75 0 0 0-1.4 0L3.03 17a.75.75 0 1 0 1.42.5l.34-1h2.4l.34 1a.75.75 0 1 0 1.42-.5L6.7 10.5ZM6 13.04 6.68 15H5.32L6 13.04ZM14.25 2c.41 0 .75.34.75.75v12.57l1.45-1.58a.75.75 0 0 1 1.1 1.02l-2.75 3a.75.75 0 0 1-1.1 0l-2.75-3a.75.75 0 0 1 1.1-1.02l1.45 1.58V2.75c0-.41.34-.75.75-.75Z"]);
1023
1028
 
@@ -1144,21 +1149,23 @@ const useGridHeaderStyles = makeStyles({
1144
1149
  });
1145
1150
 
1146
1151
  const GridHeader = (props) => {
1147
- const { table, gridTitle, globalFilter, setGlobalFilter, dispatch, drawerState } = props;
1152
+ const { table, gridTitle, globalFilter, setGlobalFilter } = props;
1153
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
1154
+ const { dispatchDrawerAction, drawerState } = table.options.meta;
1148
1155
  const styles = useGridHeaderStyles();
1149
1156
  return (jsxs("div", { className: styles.tableTopHeaderContainer, children: [jsx("div", { className: styles.tableTopHeaderLeft, children: gridTitle }), jsxs("div", { className: styles.tableTopHeaderRight, children: [props.headerMenu, props.headerMenu && jsx(Divider, { vertical: true }), jsxs(Popover, { withArrow: true, children: [jsx(PopoverTrigger, { disableButtonEnhancement: true, children: jsx(Tooltip, { content: 'Toggle Group Column', relationship: "label", children: jsx(Button, { icon: jsx(ToggleGroupColumnIcon, {}), "aria-label": "Toggle Group Column" }) }) }), jsx(PopoverSurface, { className: styles.popoverSurface, children: jsxs("div", { className: styles.tableTopHeaderColumnTogglePopover, children: [jsx(MenuGroupHeader, { children: "Group Columns" }), table.getAllLeafColumns().map((column) => {
1150
1157
  if (column.id === 'select')
1151
1158
  return null;
1152
1159
  if (column.id === 'id')
1153
1160
  return null;
1154
- return (jsx(Switch, { checked: column.getIsGrouped(), onChange: column.getToggleGroupingHandler(), disabled: !column.getCanGroup() || !column.getIsVisible(), label: jsx("span", { children: column.columnDef.id }) }, column.id));
1155
- })] }) })] }), jsxs(Popover, { withArrow: true, children: [jsx(PopoverTrigger, { disableButtonEnhancement: true, children: jsx(Tooltip, { content: 'Toggle Column Visibility', relationship: "label", children: jsx(Button, { icon: jsx(ToggleSelectColumnIcon, {}), "aria-label": "Toggle Column Visibility" }) }) }), jsx(PopoverSurface, { className: styles.popoverSurface, children: jsxs("div", { className: styles.tableTopHeaderColumnTogglePopover, children: [jsx(MenuGroupHeader, { children: "Toggle Columns" }), jsx(Switch, { checked: table.getIsAllColumnsVisible(), onChange: table.getToggleAllColumnsVisibilityHandler(), label: 'Toggle All' }), jsx(Divider, {}), table.getAllLeafColumns().map((column) => {
1161
+ return (jsx(Checkbox, { checked: column.getIsGrouped(), onChange: column.getToggleGroupingHandler(), disabled: !column.getCanGroup() || !column.getIsVisible(), label: jsx("span", { children: column.columnDef.id }) }, column.id));
1162
+ })] }) })] }), jsxs(Popover, { withArrow: true, children: [jsx(PopoverTrigger, { disableButtonEnhancement: true, children: jsx(Tooltip, { content: 'Toggle Column Visibility', relationship: "label", children: jsx(Button, { icon: jsx(ToggleSelectColumnIcon, {}), "aria-label": "Toggle Column Visibility" }) }) }), jsx(PopoverSurface, { className: styles.popoverSurface, children: jsxs("div", { className: styles.tableTopHeaderColumnTogglePopover, children: [jsx(MenuGroupHeader, { children: "Toggle Columns" }), jsx(Checkbox, { checked: table.getIsAllColumnsVisible(), onChange: table.getToggleAllColumnsVisibilityHandler(), label: 'Toggle All' }), jsx(Divider, {}), table.getAllLeafColumns().map((column) => {
1156
1163
  if (column.id === 'select')
1157
1164
  return null;
1158
- return (jsx(Switch, { checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler(), label: column.id, disabled: !column.getCanHide() }, column.id));
1165
+ return (jsx(Checkbox, { checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler(), label: column.id, disabled: !column.getCanHide() }, column.id));
1159
1166
  })] }) })] }), jsx(Tooltip, { content: 'Table Views Management', relationship: "label", children: jsx(Button, { onClick: () => {
1160
- dispatch({ type: "TOGGLE_VIEW_DRAWER" });
1161
- }, icon: jsx(Album24Regular, {}), "aria-label": "View Menu" }) }), jsx(DebouncedInput, { value: globalFilter !== null && globalFilter !== void 0 ? globalFilter : '', onChange: (value) => setGlobalFilter(String(value)), className: "p-2 font-lg shadow border border-block", placeholder: "Search all columns...", drawerState: drawerState, dispatch: dispatch })] })] }));
1167
+ dispatchDrawerAction === null || dispatchDrawerAction === void 0 ? void 0 : dispatchDrawerAction({ type: "TOGGLE_VIEW_DRAWER" });
1168
+ }, icon: jsx(Album24Regular, {}), "aria-label": "View Menu" }) }), jsx(DebouncedInput, { value: globalFilter !== null && globalFilter !== void 0 ? globalFilter : '', onChange: (value) => setGlobalFilter(String(value)), className: "p-2 font-lg shadow border border-block", placeholder: "Search all columns...", dispatch: dispatchDrawerAction, drawerState: drawerState })] })] }));
1162
1169
  };
1163
1170
  // A debounced input react component
1164
1171
  function DebouncedInput({ value: initialValue, onChange, debounce = 500, drawerState, dispatch, }) {
@@ -1172,8 +1179,8 @@ function DebouncedInput({ value: initialValue, onChange, debounce = 500, drawerS
1172
1179
  }, debounce);
1173
1180
  return () => clearTimeout(timeout);
1174
1181
  }, [value, onChange, debounce]);
1175
- return (jsx(Input, { placeholder: "Search Keyword", value: value, onChange: (_, data) => setValue(data.value), type: "search", autoComplete: "off", contentBefore: jsx(Search24Regular, {}), style: { width: '300px' }, contentAfter: jsx(Tooltip, { content: drawerState.isFilterDrawerOpen ? 'Close Filter Window' : 'Open Advance Filter', relationship: "label", children: jsx(Button, { appearance: "subtle", icon: drawerState.isFilterDrawerOpen ? jsx(FilterDismissFilled, {}) : jsx(FilterFilled, {}), "aria-label": "View Menu", onClick: () => {
1176
- dispatch({ type: "TOGGLE_FILTER_DRAWER" });
1182
+ return (jsx(Input, { placeholder: "Search Keyword", value: value, onChange: (_, data) => setValue(data.value), type: "search", autoComplete: "off", contentBefore: jsx(Search24Regular, {}), style: { width: '300px' }, contentAfter: jsx(Tooltip, { content: (drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen) ? 'Close Filter Window' : 'Open Advance Filter', relationship: "label", children: jsx(Button, { appearance: "subtle", icon: (drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen) ? jsx(FilterDismissFilled, {}) : jsx(FilterFilled, {}), "aria-label": "View Menu", onClick: () => {
1183
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({ type: "TOGGLE_FILTER_DRAWER" });
1177
1184
  } }) }) }));
1178
1185
  }
1179
1186
 
@@ -1235,9 +1242,41 @@ const getLeafColumns = (columns) => {
1235
1242
  }, []);
1236
1243
  };
1237
1244
 
1245
+ const TableActions = {
1246
+ TOGGLE_FILTER_DRAWER: 'TOGGLE_FILTER_DRAWER',
1247
+ TOGGLE_VIEW_DRAWER: 'TOGGLE_VIEW_DRAWER',
1248
+ OPEN_FILTER_DRAWER: 'OPEN_FILTER_DRAWER',
1249
+ OPEN_VIEW_DRAWER: 'OPEN_VIEW_DRAWER',
1250
+ CLOSE_FILTER_DRAWER: 'CLOSE_FILTER_DRAWER',
1251
+ CLOSE_VIEW_DRAWER: 'CLOSE_VIEW_DRAWER',
1252
+ };
1253
+ // write a reducer function to handle the state of the table
1254
+ function tableReducer(state, action) {
1255
+ switch (action.type) {
1256
+ case TableActions.TOGGLE_FILTER_DRAWER:
1257
+ return Object.assign(Object.assign({}, state), { isFilterDrawerOpen: !state.isFilterDrawerOpen });
1258
+ case TableActions.TOGGLE_VIEW_DRAWER:
1259
+ return Object.assign(Object.assign({}, state), { isViewsDrawerOpen: !state.isViewsDrawerOpen });
1260
+ case TableActions.OPEN_FILTER_DRAWER:
1261
+ return Object.assign(Object.assign({}, state), { isFilterDrawerOpen: true });
1262
+ case TableActions.OPEN_VIEW_DRAWER:
1263
+ return Object.assign(Object.assign({}, state), { isViewsDrawerOpen: true });
1264
+ case TableActions.CLOSE_FILTER_DRAWER:
1265
+ return Object.assign(Object.assign({}, state), { isFilterDrawerOpen: false });
1266
+ case TableActions.CLOSE_VIEW_DRAWER:
1267
+ return Object.assign(Object.assign({}, state), { isViewsDrawerOpen: false });
1268
+ default:
1269
+ return state;
1270
+ }
1271
+ }
1272
+
1238
1273
  const useGridContainer = (props, ref) => {
1239
1274
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1240
1275
  const { defaultColumn, columns, data, rowSelectionMode, autoResetPageIndex, onUpdateData } = props;
1276
+ const [drawerState, dispatch] = React.useReducer(tableReducer, {
1277
+ isFilterDrawerOpen: false,
1278
+ isViewsDrawerOpen: false
1279
+ });
1241
1280
  const [pagination, setPagination] = React.useState({
1242
1281
  pageSize: props.pageSize || 10,
1243
1282
  pageIndex: 0,
@@ -1328,7 +1367,22 @@ const useGridContainer = (props, ref) => {
1328
1367
  tableHeight: props.tableHeight || "650px",
1329
1368
  updateData: onUpdateData,
1330
1369
  onTableViewDelete: props.onTableViewDelete,
1331
- onTableViewSave: props.onTableViewSave
1370
+ onTableViewSave: props.onTableViewSave,
1371
+ drawerState: drawerState,
1372
+ dispatchDrawerAction: dispatch,
1373
+ // all the table state modifiers
1374
+ setPagination,
1375
+ setSorting,
1376
+ setColumnFilters,
1377
+ setGlobalFilter,
1378
+ setGrouping,
1379
+ setRowSelection,
1380
+ setColumnVisibility,
1381
+ setColumnOrder,
1382
+ setExpanded,
1383
+ setColumnPinning,
1384
+ setColumnSizing,
1385
+ setRowPinning
1332
1386
  }
1333
1387
  });
1334
1388
  const tableViews = React.useMemo(() => { var _a; return (_a = props.views) !== null && _a !== void 0 ? _a : []; }, [props.views]);
@@ -1482,239 +1536,493 @@ const useTableHeaderStyles = makeStyles({
1482
1536
  },
1483
1537
  });
1484
1538
 
1485
- const useCheckboxFilterStyles = makeStyles({
1486
- searchInput: {
1487
- width: '90%',
1488
- marginBottom: '8px',
1489
- marginLeft: '10px',
1490
- marginRight: '10px',
1491
- },
1492
- searchContainer: Object.assign(Object.assign(Object.assign({ maxHeight: '300px', width: '100%' }, shorthands.overflow('auto', 'auto')), shorthands.padding('0px', "0px", "2px", '0px')), { '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, shorthands.borderRadius('50%')),
1493
- /* Track */
1494
- '::-webkit-scrollbar-track': {
1495
- 'background-color': '#f1f1f1',
1496
- },
1497
- /* Handle */
1498
- '::-webkit-scrollbar-thumb': {
1499
- 'background-color': '#888',
1500
- },
1501
- /* Handle on hover */
1502
- '::-webkit-scrollbar-thumb:hover': {
1503
- 'background-color': '#555',
1504
- } }),
1505
- });
1506
- const FilterMultiSelectCheckbox = ({ column, table, }) => {
1539
+ const getHeaderCellPinningStyles = (column, isDragging, additionalStyles) => {
1540
+ const isPinned = column.getIsPinned();
1541
+ const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
1542
+ const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
1543
+ const styles = Object.assign({ width: column.getSize(), boxShadow: isLastLeftPinnedColumn
1544
+ ? '-4px 0 4px -4px gray inset'
1545
+ : isFirstRightPinnedColumn
1546
+ ? '4px 0 4px -4px gray inset'
1547
+ : undefined, left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined, right: isPinned === 'right' ? `${column.getAfter('right')}px` : undefined, opacity: isDragging ? 0.8 : (isPinned ? 0.95 : 1), position: isPinned ? 'sticky' : 'relative', zIndex: isDragging ? 100 : (isPinned ? 99 : 1), backgroundColor: tokens.colorNeutralCardBackgroundSelected, whiteSpace: 'wrap' }, additionalStyles);
1548
+ return styles;
1549
+ };
1550
+ const getBodyCellPinningStyles = (column, isDragging, additionalStyles) => {
1551
+ const isPinned = column.getIsPinned();
1552
+ const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
1553
+ const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
1554
+ const styles = Object.assign({ width: column.getSize(), boxShadow: isLastLeftPinnedColumn
1555
+ ? '-4px 0 4px -4px gray inset'
1556
+ : isFirstRightPinnedColumn
1557
+ ? '4px 0 4px -4px gray inset'
1558
+ : undefined, left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined, right: isPinned === 'right' ? `${column.getAfter('right')}px` : undefined, position: isPinned ? 'sticky' : 'relative', opacity: isDragging ? 0.85 : (isPinned ? 0.95 : 1), zIndex: isDragging ? 100 : (isPinned ? 1 : 0) }, additionalStyles);
1559
+ return styles;
1560
+ };
1561
+
1562
+ const MoreIcon = bundleIcon$1(MoreVerticalFilled, MoreVerticalRegular);
1563
+ const SortAscIcon = bundleIcon$1(ArrowSortDown20Filled, ArrowSortDown20Regular);
1564
+ const SortDescIcon = bundleIcon$1(ArrowSortUp20Filled, ArrowSortUp20Regular);
1565
+ const PinIcon = bundleIcon$1(PinFilled, PinRegular);
1566
+ const HideColumnIcon = bundleIcon$1(EyeTrackingOffFilled, EyeTrackingOffRegular);
1567
+ function HeaderCell({ header, table, hideMenu, headerDepth, totalNumberOfHeaderDepth, }) {
1507
1568
  var _a;
1508
- const firstValue = (_a = table
1509
- .getPreFilteredRowModel()
1510
- .flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
1511
- const columnFilterValue = column.getFilterValue();
1512
- const [filterOptions, setFilterOptions] = React.useState([]);
1513
- React.useEffect(() => {
1514
- const uniqueSortedOptions = typeof firstValue === 'number' || !isNaN(firstValue)
1515
- ? Array.from(column.getFacetedUniqueValues().keys()).sort((a, b) => Number(a) - Number(b))
1516
- : Array.from(column.getFacetedUniqueValues().keys()).sort();
1517
- setFilterOptions(uniqueSortedOptions);
1518
- },
1519
- // eslint-disable-next-line react-hooks/exhaustive-deps
1520
- [column.getFacetedUniqueValues()]);
1521
- const [localColumnFilterValue, setLocalColumnFilterValue] = React.useState('');
1522
- const filterOptionsFiltered = React.useMemo(() => {
1523
- if (!localColumnFilterValue)
1524
- return filterOptions;
1525
- return filterOptions.filter((option) => {
1526
- var _a, _b, _c;
1527
- return (_b = (_a = `${option}`) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes((_c = `${localColumnFilterValue}`) === null || _c === void 0 ? void 0 : _c.toLowerCase());
1528
- });
1529
- }, [localColumnFilterValue, filterOptions]);
1530
- const parentRef = React.useRef(null);
1531
- const virtualizer = useVirtualizer({
1532
- count: (filterOptionsFiltered === null || filterOptionsFiltered === void 0 ? void 0 : filterOptionsFiltered.length) || 0,
1533
- getScrollElement: () => parentRef.current,
1534
- estimateSize: () => 30,
1535
- overscan: 5,
1569
+ const { column } = header;
1570
+ const { isDragging, attributes, listeners, setNodeRef, transform, transition, } = useSortable({
1571
+ id: column.id
1536
1572
  });
1537
- const virtualItems = virtualizer.getVirtualItems();
1538
- const allOptionChecked = (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) > 0 &&
1539
- (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) !== (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length)
1540
- ? 'mixed'
1541
- : (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) === (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) &&
1542
- (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) > 0;
1543
- const styles = useCheckboxFilterStyles();
1544
- return (jsxs("div", { children: [jsx(Input, { type: 'search', value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsx("div", { ref: parentRef, className: styles.searchContainer, children: jsxs("div", { style: { height: `${virtualizer.getTotalSize()}px` }, children: [jsx(Checkbox, { checked: allOptionChecked, onChange: () => {
1545
- if ((columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) > 0) {
1546
- column.setFilterValue(undefined);
1547
- return;
1548
- }
1549
- column.setFilterValue([
1550
- ...((filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.map((x) => `${x}`)) || []),
1551
- ]);
1552
- }, label: '(Toggle All)' }, `toggle-all-${column.id}`), (virtualItems || []).map((row, index) => {
1553
- var _a;
1554
- const value = `${filterOptionsFiltered[row.index]}`;
1555
- return (jsx("div", { style: {
1556
- height: `${row.size}px`,
1557
- transform: `translateY(${row.start - index * row.size}px)`,
1558
- }, children: jsx(Checkbox, { checked: (_a = columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) !== null && _a !== void 0 ? _a : false, onChange: () => {
1559
- if (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) {
1560
- column.setFilterValue((old) => old === null || old === void 0 ? void 0 : old.filter((v) => v !== value));
1573
+ const dndStyle = {
1574
+ transform: CSS.Translate.toString(transform),
1575
+ transition
1576
+ };
1577
+ const styles = useTableHeaderStyles();
1578
+ const isLeafHeaders = headerDepth === totalNumberOfHeaderDepth;
1579
+ const headerCellCombinedStyles = getHeaderCellPinningStyles(column, isDragging, dndStyle);
1580
+ if (header.isPlaceholder) {
1581
+ return (jsx("th", { colSpan: header.colSpan, className: styles.tHeadCell, style: headerCellCombinedStyles, ref: setNodeRef, children: jsx(Show, { when: header.column.getCanResize(), children: jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: mergeClasses$1(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }) }));
1582
+ }
1583
+ const columnName = flexRender(header.column.columnDef.header, header.getContext());
1584
+ return (jsxs("th", { colSpan: header.colSpan, className: mergeClasses$1(styles.tHeadCell, isLeafHeaders && styles.tHeadNonLeafCell, isDragging && styles.tHeadCellDragging), style: headerCellCombinedStyles, ref: setNodeRef, children: [jsx("div", Object.assign({ className: styles.tHeadCellDraggable }, attributes, listeners, { children: jsxs("div", { className: isLeafHeaders
1585
+ ? styles.tLeafHeadCellContent
1586
+ : styles.tNonLeafHeadCellContent, children: [jsx("div", { children: jsx(Show, { when: !header.isPlaceholder, children: jsxs(Button, { style: {
1587
+ display: 'flex',
1588
+ alignItems: 'center',
1589
+ justifyContent: 'left',
1590
+ flex: 1,
1591
+ }, onClick: (e) => {
1592
+ if (!header.column.getCanSort())
1561
1593
  return;
1562
- }
1563
- column.setFilterValue((old) => [
1564
- ...(old || []),
1565
- value,
1566
- ]);
1567
- }, label: value }) }, `${column.id}-${row.index}`));
1568
- })] }) })] }));
1569
- };
1594
+ header.column.toggleSorting(header.column.getIsSorted() === 'asc', e.ctrlKey);
1595
+ }, onDoubleClick: () => {
1596
+ if (!header.column.getCanGroup())
1597
+ return;
1598
+ header.column.getToggleGroupingHandler()();
1599
+ }, appearance: "transparent", className: styles.tHeadContentBtn, icon: (_a = {
1600
+ asc: (jsx("strong", { children: jsx(SortAscIcon, {}) })),
1601
+ desc: (jsx("strong", { children: jsx(SortDescIcon, {}) })),
1602
+ }[header.column.getIsSorted()]) !== null && _a !== void 0 ? _a : undefined, iconPosition: "after", children: [jsx("strong", { children: columnName }), jsx(Show, { when: header.column.getIsGrouped(), children: jsx("strong", { children: jsx(GroupListRegular, {}) }) }), jsx(Show, { when: header.column.getIsFiltered(), children: jsx("strong", { children: jsx(FilterFilled, {}) }) }), jsx(Show, { when: header.column.getIsPinned(), children: jsx("strong", { children: jsx(PinRegular, {}) }) })] }) }) }), jsx(HeaderMenu, { header: header, table: table, hideMenu: hideMenu })] }) })), jsx(Show, { when: header.column.getCanResize(), children: jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: mergeClasses$1(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }), jsx(Show, { when: !isLeafHeaders, children: jsx("div", { className: styles.tHeadNonLeafCellFakeBorder }) })] }));
1603
+ }
1604
+ function HeaderMenu(props) {
1605
+ const { header, table, hideMenu } = props;
1606
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
1607
+ const { dispatchDrawerAction, drawerState } = table.options.meta;
1608
+ const styles = useTableHeaderStyles();
1609
+ if (hideMenu || header.isPlaceholder)
1610
+ return (jsx(Fragment, { children: " " }));
1611
+ const canHavePopOver = header.column.getCanSort() ||
1612
+ header.column.getCanGroup() ||
1613
+ header.column.getCanFilter();
1614
+ if (!canHavePopOver)
1615
+ return (jsx(Fragment, { children: " " }));
1616
+ const columnName = flexRender(header.column.columnDef.header, header.getContext());
1617
+ return (jsxs(Menu, { positioning: { align: "end" }, children: [jsx(MenuTrigger, { disableButtonEnhancement: true, children: jsx(Tooltip, { relationship: "label", content: jsxs(Fragment, { children: ["More actions for ", columnName] }), children: jsx(MenuButton, { appearance: "subtle", "aria-label": "View Column Actions", icon: jsx(MoreIcon, {}) }) }) }), jsx(MenuPopover, { className: styles.tHeadMenuPopover, children: jsxs(MenuList, { children: [jsx(Show, { when: header.column.getCanSort(), children: jsxs(MenuGroup, { children: [jsx(MenuItem, { onClick: (e) => {
1618
+ var _a;
1619
+ (_a = header.column) === null || _a === void 0 ? void 0 : _a.clearSorting();
1620
+ }, icon: jsx(ArrowSortFilled, {}), disabled: !header.column.getIsSorted(), children: "Clear Sorting" }), jsx(MenuItem, { onClick: (e) => {
1621
+ var _a;
1622
+ const isControlKeySelected = e.ctrlKey;
1623
+ (_a = header.column) === null || _a === void 0 ? void 0 : _a.toggleSorting(false, isControlKeySelected);
1624
+ }, icon: jsx(TextSortAscendingFilled, {}), disabled: header.column.getIsSorted() === 'asc', children: "Sort A to Z" }), jsx(MenuItem, { onClick: (e) => {
1625
+ var _a;
1626
+ const isControlKeySelected = e.ctrlKey;
1627
+ (_a = header.column) === null || _a === void 0 ? void 0 : _a.toggleSorting(true, isControlKeySelected);
1628
+ }, icon: jsx(TextSortDescendingFilled, {}), disabled: header.column.getIsSorted() === 'desc', children: "Sort Z to A" }), jsx(MenuDivider, {})] }, 'sort-group') }), jsx(Show, { when: header.column.getCanGroup(), children: jsxs(MenuGroup, { children: [!header.column.getIsGrouped() && (jsxs(MenuItem, { onClick: () => header.column.getToggleGroupingHandler()(), icon: jsx(GroupFilled, {}), children: ["Group Column (by ", columnName, ")"] })), header.column.getIsGrouped() && (jsxs(MenuItem, { onClick: () => header.column.getToggleGroupingHandler()(), icon: jsx(GroupDismissFilled, {}), children: ["Remove Grouping (on ", columnName, ")"] })), jsx(MenuDivider, {})] }, 'grouping-group') }), jsx(Show, { when: header.column.getCanPin(), children: jsxs(Menu, { children: [jsx(MenuTrigger, { disableButtonEnhancement: true, children: jsxs(MenuItem, { icon: jsx(PinIcon, {}), children: ["Pin Column (", columnName, ")"] }) }), jsx(MenuPopover, { children: jsxs(MenuList, { children: [jsx(MenuItem, { onClick: () => {
1629
+ var _a;
1630
+ (_a = header.column) === null || _a === void 0 ? void 0 : _a.pin(false);
1631
+ }, icon: jsx(PinOffRegular, {}), disabled: !(['left', 'right'].includes(header.column.getIsPinned())), children: "No Pin" }), jsx(MenuItem, { onClick: () => {
1632
+ var _a;
1633
+ (_a = header.column) === null || _a === void 0 ? void 0 : _a.pin('left');
1634
+ }, icon: jsx(ArrowStepInLeftRegular, {}), disabled: header.column.getIsPinned() === 'left', children: "Pin Left" }), jsx(MenuItem, { onClick: () => {
1635
+ var _a;
1636
+ (_a = header.column) === null || _a === void 0 ? void 0 : _a.pin('right');
1637
+ }, icon: jsx(ArrowStepInRightRegular, {}), disabled: header.column.getIsPinned() === 'right', children: "Pin Right" })] }) })] }) }), jsx(Show, { when: header.column.getCanHide(), children: jsxs(Menu, { children: [jsx(MenuList, { children: jsxs(MenuItem, { onClick: header.column.getToggleVisibilityHandler(), disabled: !header.column.getCanHide(), icon: jsx(HideColumnIcon, {}), children: ["Hide Column (", columnName, ")"] }) }), jsx(MenuDivider, {})] }) }), jsxs(Show, { when: header.column.getCanFilter(), children: [jsx(MenuDivider, {}), jsx(MenuGroup, { children: jsxs(MenuList, { children: [jsxs(Menu, { children: [jsx(MenuTrigger, { disableButtonEnhancement: true, children: jsx(MenuItem, { icon: jsx(ClearFilterIcon, {}), children: "Clear Filters" }) }), jsx(MenuPopover, { children: jsxs(MenuList, { children: [jsxs(MenuItem, { onClick: () => {
1638
+ header.column.setFilterValue(undefined);
1639
+ }, icon: jsx(TextClearFormattingFilled, {}), disabled: !header.column.getIsFiltered(), children: ["Clear for ", columnName] }), jsx(MenuItem, { onClick: () => {
1640
+ table.resetColumnFilters();
1641
+ }, icon: jsx(ClearFilterIcon, {}), children: "Clear for All Columns" })] }) })] }), jsx(MenuItem, { icon: (drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen) ? jsx(FilterDismissFilled, {}) : jsx(FilterFilled, {}), onClick: () => {
1642
+ if (drawerState.isFilterDrawerOpen) {
1643
+ dispatchDrawerAction === null || dispatchDrawerAction === void 0 ? void 0 : dispatchDrawerAction({ type: "CLOSE_FILTER_DRAWER" });
1644
+ }
1645
+ else {
1646
+ dispatchDrawerAction === null || dispatchDrawerAction === void 0 ? void 0 : dispatchDrawerAction({ type: "OPEN_FILTER_DRAWER" });
1647
+ }
1648
+ }, children: jsx(Show, { when: drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen, fallback: jsx(Fragment, { children: "Open Column Filter" }), children: "Close Column Filter" }) })] }) }, 'filter-group')] })] }) })] }));
1649
+ }
1570
1650
 
1571
- const useRadioFilterStyles = makeStyles({
1572
- searchInput: {
1573
- width: '90%',
1574
- marginBottom: '8px',
1575
- marginLeft: '10px',
1576
- marginRight: '10px',
1651
+ function HeaderRow(props) {
1652
+ const styles = useTableHeaderStyles();
1653
+ const { table, headerGroup, rowSelectionMode, headerGroupsLength } = props;
1654
+ return (jsxs("tr", { className: styles.tHeadRow, children: [rowSelectionMode === 'multiple' && (jsx("th", { style: { width: '1rem' }, "aria-label": "Select All Row Column", children: headerGroup.depth === headerGroupsLength - 1 && (jsx(Checkbox, { checked: table.getIsSomeRowsSelected()
1655
+ ? 'mixed'
1656
+ : table.getIsAllRowsSelected(), onChange: table.getToggleAllRowsSelectedHandler(), "aria-label": "Select All Rows", title: 'Select All Rows' })) })), rowSelectionMode === 'single' && (jsx("th", { style: { width: '1rem' }, "aria-label": "Select All Row Column", children: ' ' })), headerGroup.headers.map((header) => {
1657
+ return (jsx(HeaderCell, { header: header, table: table, hideMenu: headerGroup.depth !== headerGroupsLength - 1, headerDepth: headerGroup.depth, totalNumberOfHeaderDepth: headerGroupsLength - 1 }, header.id));
1658
+ })] }, headerGroup.id));
1659
+ }
1660
+
1661
+ function TableHeader(props) {
1662
+ const styles = useTableHeaderStyles();
1663
+ const { table, headerGroups, rowSelectionMode } = props;
1664
+ return (jsx("thead", { className: styles.tHead, style: { zIndex: 99 }, children: headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map((headerGroup) => (jsx(HeaderRow, { table: table, rowSelectionMode: rowSelectionMode, headerGroup: headerGroup, headerGroupsLength: headerGroups.length }, headerGroup.id))) }));
1665
+ }
1666
+
1667
+ const useLoadingStyles = makeStyles({
1668
+ invertedWrapper: {
1669
+ backgroundColor: tokens.colorNeutralBackground1,
1577
1670
  },
1578
- searchContainer: Object.assign(Object.assign({ maxHeight: '300px', width: '100%' }, shorthands.overflow('auto', 'auto')), { '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, shorthands.borderRadius('50%')),
1579
- /* Track */
1580
- '::-webkit-scrollbar-track': {
1581
- 'background-color': '#f1f1f1',
1582
- },
1583
- /* Handle */
1584
- '::-webkit-scrollbar-thumb': {
1585
- 'background-color': '#888',
1586
- },
1587
- /* Handle on hover */
1588
- '::-webkit-scrollbar-thumb:hover': {
1589
- 'background-color': '#555',
1590
- } }),
1671
+ row: Object.assign(Object.assign({ alignItems: "center", display: "grid", paddingBottom: "10px", position: "relative" }, shorthands.gap("10px")), { gridTemplateColumns: "min-content 20% 15% 30% 29%" }),
1591
1672
  });
1592
- const FilterSelectRadio = ({ column, table, }) => {
1593
- var _a;
1594
- const firstValue = (_a = table
1595
- .getPreFilteredRowModel()
1596
- .flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
1597
- const columnFilterValue = column.getFilterValue();
1598
- const [filterOptions, setFilterOptions] = React.useState([]);
1599
- React.useEffect(() => {
1600
- const uniqueSortedOptions = typeof firstValue === 'number' || !isNaN(firstValue)
1601
- ? Array.from(column.getFacetedUniqueValues().keys()).sort((a, b) => Number(a) - Number(b))
1602
- : Array.from(column.getFacetedUniqueValues().keys()).sort();
1603
- setFilterOptions(uniqueSortedOptions);
1604
- },
1605
- // eslint-disable-next-line react-hooks/exhaustive-deps
1606
- [column.getFacetedUniqueValues()]);
1607
- const [localColumnFilterValue, setLocalColumnFilterValue] = React.useState('');
1608
- const filterOptionsFiltered = React.useMemo(() => {
1609
- if (!localColumnFilterValue)
1610
- return filterOptions;
1611
- return filterOptions.filter((option) => {
1612
- var _a, _b, _c;
1613
- return (_b = (_a = `${option}`) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes((_c = `${localColumnFilterValue}`) === null || _c === void 0 ? void 0 : _c.toLowerCase());
1614
- });
1615
- }, [localColumnFilterValue, filterOptions]);
1616
- const parentRef = React.useRef(null);
1617
- const virtualizer = useVirtualizer({
1618
- count: (filterOptionsFiltered === null || filterOptionsFiltered === void 0 ? void 0 : filterOptionsFiltered.length) || 0,
1619
- getScrollElement: () => parentRef.current,
1620
- estimateSize: () => 30,
1621
- overscan: 5,
1622
- });
1623
- const virtualItems = virtualizer.getVirtualItems();
1624
- const styles = useRadioFilterStyles();
1625
- return (jsxs("div", { children: [jsx(Input, { value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsx("div", { ref: parentRef, className: styles.searchContainer, children: jsx("div", { style: { height: `${virtualizer.getTotalSize()}px` }, children: jsxs(RadioGroup, { layout: "vertical", value: (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[0]) || '', onChange: (_, data) => {
1626
- if (data.value === '') {
1627
- column.setFilterValue([]);
1628
- return;
1629
- }
1630
- column.setFilterValue([data.value]);
1631
- }, children: [jsx(Radio, { value: '', label: 'None' }), (virtualItems || []).map((row, index) => {
1632
- const value = filterOptionsFiltered[row.index];
1633
- return (jsx("div", { style: {
1634
- height: `${row.size}px`,
1635
- transform: `translateY(${row.start - index * row.size}px)`,
1636
- }, children: jsx(Radio, { value: value, label: value }, value) }, `${column.id}-${row.index}`));
1637
- })] }) }) })] }));
1673
+
1674
+ const Loading = (props) => {
1675
+ const { numberOfItems = 16, numberOfColumns = 5 } = props;
1676
+ const styles = useLoadingStyles();
1677
+ return (jsx("div", { className: styles.invertedWrapper, children: jsx(Skeleton, { children: [...Array(numberOfItems)].map((_, i) => (jsx("div", { className: styles.row, children: [...Array(numberOfColumns)].map((_, i) => {
1678
+ if (i === 0) {
1679
+ return jsx(SkeletonItem, { shape: "circle", size: 24 }, i);
1680
+ }
1681
+ return jsx(SkeletonItem, { size: 16 }, i);
1682
+ }) }, i))) }) }));
1638
1683
  };
1639
1684
 
1640
- const useNumberRangeFilterStyles$2 = makeStyles({
1641
- searchInput: {
1642
- width: '100%',
1643
- },
1644
- searchInputField: {
1645
- width: '100%',
1646
- flexGrow: 1,
1647
- },
1648
- searchContainer: {
1649
- display: 'flex',
1650
- marginBottom: '8px',
1651
- marginLeft: '10px',
1652
- marginRight: '10px',
1685
+ const useNoItemGridStyles = makeStyles({
1686
+ wrapper: {
1687
+ backgroundColor: tokens.colorNeutralBackground1,
1688
+ display: "flex",
1689
+ flexWrap: "wrap",
1690
+ alignContent: "center",
1691
+ justifyContent: "center",
1692
+ minHeight: "300px",
1653
1693
  }
1654
1694
  });
1655
- const FilterNumberRange = (props) => {
1656
- var _a, _b, _c, _d, _e, _f, _g, _h;
1657
- const { column } = props;
1658
- const columnFilterValue = column.getFilterValue();
1659
- const min = Number((_b = (_a = column.getFacetedMinMaxValues()) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '');
1660
- const max = Number((_d = (_c = column.getFacetedMinMaxValues()) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : '');
1661
- const handleMinChange = (e, data) => {
1662
- const value = Number(data.value);
1663
- column.setFilterValue((old) => [value, old === null || old === void 0 ? void 0 : old[1]]);
1664
- };
1665
- const handleMaxChange = (e, data) => {
1666
- const value = Number(data.value);
1667
- column.setFilterValue((old) => [old === null || old === void 0 ? void 0 : old[0], value]);
1695
+
1696
+ const NoItemGrid = ({ message }) => {
1697
+ const styles = useNoItemGridStyles();
1698
+ return (jsx("div", { className: styles.wrapper, children: jsx("div", { children: message ? message : jsx(Subtitle2Stronger, { children: "No Data to Show." }) }) }));
1699
+ };
1700
+
1701
+ const useNoFilterMatchStyles = makeStyles({
1702
+ wrapper: {
1703
+ backgroundColor: tokens.colorNeutralBackground1,
1704
+ display: "flex",
1705
+ flexDirection: "column",
1706
+ flexWrap: "wrap",
1707
+ alignContent: "center",
1708
+ justifyContent: "center",
1709
+ minHeight: "300px",
1710
+ },
1711
+ iconWrapper: {
1712
+ display: "flex",
1713
+ flexWrap: "wrap",
1714
+ alignContent: "center",
1715
+ justifyContent: "center",
1716
+ }
1717
+ });
1718
+
1719
+ const NoSearchResult = ({ message }) => {
1720
+ const styles = useNoFilterMatchStyles();
1721
+ return (jsxs("div", { className: styles.wrapper, children: [jsx("div", { className: styles.iconWrapper, children: jsx(DocumentSearch24Regular, {}) }), jsx("div", { children: message ? message : jsx(Subtitle2Stronger, { children: "No item found that matches your search term." }) })] }));
1722
+ };
1723
+
1724
+ const useTableBodyStyles = makeStyles({
1725
+ tBody: Object.assign(Object.assign({}, shorthands.padding("0px", "0px", "0px", "0px")), { zIndex: 0 }),
1726
+ tBodyRow: Object.assign(Object.assign(Object.assign({}, shorthands.padding("0px", "0px", "0px", "0px")), shorthands.borderBottom(tokens.strokeWidthThin, "solid", tokens.colorNeutralStroke1)), {
1727
+ // ":nth-child(even)": {
1728
+ // backgroundColor: tokens.colorNeutralBackground2,
1729
+ // },
1730
+ ":hover": {
1731
+ backgroundColor: tokens.colorNeutralBackground2Hover,
1732
+ } }),
1733
+ tBodySelectedRow: Object.assign(Object.assign({ backgroundColor: tokens.colorBrandBackground2 }, shorthands.borderBottom(tokens.strokeWidthThin, "solid", tokens.colorNeutralStroke1)), { ":hover": {
1734
+ backgroundColor: tokens.colorBrandBackground2Hover,
1735
+ } }),
1736
+ tBodyCell: Object.assign(Object.assign({ backgroundColor: "transparent" }, shorthands.padding("2px", "4px")), { minHeight: "35px", height: "35px" }),
1737
+ tBodyRowPinnedCell: {
1738
+ backgroundColor: tokens.colorPaletteYellowBackground2,
1739
+ ":hover": {
1740
+ backgroundColor: tokens.colorPaletteMarigoldBackground2,
1741
+ }
1742
+ },
1743
+ tBodyPinnedCell: {
1744
+ backgroundColor: tokens.colorNeutralBackground3,
1745
+ ":hover": {
1746
+ backgroundColor: tokens.colorNeutralBackground3Hover,
1747
+ }
1748
+ },
1749
+ tBodySelectedCell: {
1750
+ backgroundColor: tokens.colorBrandBackground2,
1751
+ ":hover": {
1752
+ backgroundColor: tokens.colorBrandBackground2Hover,
1753
+ }
1754
+ },
1755
+ });
1756
+
1757
+ function TableCell({ cell, row }) {
1758
+ var _a;
1759
+ const styles = useTableBodyStyles();
1760
+ const isSelected = row.getIsSelected();
1761
+ const isRowPinned = row.getIsPinned();
1762
+ const isCellPinned = cell.column.getIsPinned();
1763
+ const cellClassNames = mergeClasses$1(styles.tBodyCell, isCellPinned && styles.tBodyPinnedCell, isSelected && styles.tBodySelectedCell, isRowPinned && styles.tBodyRowPinnedCell);
1764
+ const { isDragging, transition, setNodeRef, transform } = useSortable({
1765
+ id: cell.column.id,
1766
+ });
1767
+ const tdStyle = {
1768
+ transform: CSS.Translate.toString(transform),
1769
+ transition
1668
1770
  };
1669
- const styles = useNumberRangeFilterStyles$2();
1670
- return (jsxs("div", { className: styles.searchContainer, children: [jsx(Field, { label: 'Min:', size: "small", className: styles.searchInputField, children: jsx(Input, { type: "number", value: `${(columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[0]) || ''}`, min: min, max: max, onChange: handleMinChange, className: styles.searchInput, placeholder: `Min ${((_e = column.getFacetedMinMaxValues()) === null || _e === void 0 ? void 0 : _e[0])
1671
- ? `(${(_f = column.getFacetedMinMaxValues()) === null || _f === void 0 ? void 0 : _f[0]})`
1672
- : ''}` }) }), jsx(Field, { label: 'Max:', size: "small", className: styles.searchInputField, children: jsx(Input, { type: "number", value: `${(columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[1]) || ''}`, min: min, max: max, onChange: handleMaxChange, className: styles.searchInput, placeholder: `Max ${((_g = column.getFacetedMinMaxValues()) === null || _g === void 0 ? void 0 : _g[1])
1673
- ? `(${(_h = column.getFacetedMinMaxValues()) === null || _h === void 0 ? void 0 : _h[1]})`
1674
- : ''}` }) })] }));
1771
+ const styleStyles = getBodyCellPinningStyles(cell.column, isDragging, tdStyle);
1772
+ if (cell.getIsPlaceholder()) {
1773
+ return jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef }, cell.id);
1774
+ }
1775
+ if (cell.getIsGrouped()) {
1776
+ return (jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: jsx(Button, { onClick: row.getToggleExpandedHandler(), style: {
1777
+ cursor: row.getCanExpand() ? 'pointer' : 'normal',
1778
+ textAlign: 'left',
1779
+ }, appearance: "transparent", icon: row.getIsExpanded() ? jsx(GroupExpandedIcon, {}) : jsx(GroupCollapsedIcon, {}), children: jsxs("strong", { children: [flexRender(cell.column.columnDef.cell, cell.getContext()), " (", row.subRows.length, ")"] }) }) }, cell.id));
1780
+ }
1781
+ if (cell.getIsAggregated()) {
1782
+ return (jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: jsx("strong", { children: flexRender((_a = cell.column.columnDef.aggregatedCell) !== null && _a !== void 0 ? _a : cell.column.columnDef.cell, cell.getContext()) }) }, cell.id));
1783
+ }
1784
+ return (jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
1785
+ }
1786
+
1787
+ function TableRow({ row, rowSelectionMode, style }) {
1788
+ const styles = useTableBodyStyles();
1789
+ return (jsxs("tr", { className: row.getIsSelected() || row.getIsAllSubRowsSelected()
1790
+ ? styles.tBodySelectedRow
1791
+ : styles.tBodyRow, style: style, children: [jsxs(Switch, { when: rowSelectionMode, children: [jsx(Case, { value: 'multiple', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsx(Checkbox, { checked: row.getIsSomeSelected()
1792
+ ? 'mixed'
1793
+ : row.getIsSelected() || row.getIsAllSubRowsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) }), jsx(Case, { value: 'single', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsx(Radio, { checked: row.getIsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) })] }), row.getVisibleCells().map((cell) => (jsx(TableCell, { cell: cell, row: row }, cell.id)))] }, row.id));
1794
+ }
1795
+ function PinnedRow({ row, rowSelectionMode, style, bottomRowLength }) {
1796
+ const styles = useTableBodyStyles();
1797
+ const pinnedRowRawStyle = Object.assign({ backgroundColor: tokens.colorPaletteYellowBackground2, position: 'sticky', top: row.getIsPinned() === 'top' ? `${row.getPinnedIndex() * 35 + 48}px` : undefined, bottom: row.getIsPinned() === 'bottom' ? `${((bottomRowLength || 0) - 1 - row.getPinnedIndex()) * 35}px` : undefined }, style);
1798
+ return (jsxs("tr", { className: row.getIsSelected() || row.getIsAllSubRowsSelected()
1799
+ ? styles.tBodySelectedRow
1800
+ : styles.tBodyRow, style: pinnedRowRawStyle, children: [jsxs(Switch, { when: rowSelectionMode, children: [jsx(Case, { value: 'multiple', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsx(Checkbox, { checked: row.getIsSomeSelected()
1801
+ ? 'mixed'
1802
+ : row.getIsSelected() || row.getIsAllSubRowsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) }), jsx(Case, { value: 'single', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsx(Radio, { checked: row.getIsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) })] }), row.getVisibleCells().map(cell => {
1803
+ return (jsx(TableCell, { cell: cell, row: row }, cell.id));
1804
+ })] }, row.id));
1805
+ }
1806
+
1807
+ function TableBody(props) {
1808
+ var _a, _b, _c;
1809
+ const styles = useTableBodyStyles();
1810
+ const { table, tableContainerRef } = props;
1811
+ const rowSelectionMode = (_a = table.options.meta) === null || _a === void 0 ? void 0 : _a.rowSelectionMode;
1812
+ let rows = [];
1813
+ let topRows = [];
1814
+ let bottomRows = [];
1815
+ try {
1816
+ rows = table.getCenterRows();
1817
+ topRows = table.getTopRows();
1818
+ bottomRows = table.getBottomRows();
1819
+ }
1820
+ catch (error) {
1821
+ rows = [];
1822
+ topRows = [];
1823
+ bottomRows = [];
1824
+ }
1825
+ const rowVirtualizer = useVirtual({
1826
+ parentRef: tableContainerRef,
1827
+ size: rows.length,
1828
+ overscan: 10,
1829
+ });
1830
+ const { virtualItems: virtualRows, totalSize } = rowVirtualizer;
1831
+ const paddingTop = virtualRows.length > 0 ? ((_b = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[0]) === null || _b === void 0 ? void 0 : _b.start) || 0 : 0;
1832
+ const paddingBottom = virtualRows.length > 0
1833
+ ? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
1834
+ : 0;
1835
+ return (jsxs(Fragment, { children: [jsx(Show, { when: (topRows === null || topRows === void 0 ? void 0 : topRows.length) > 0, children: jsx("thead", { style: {
1836
+ position: "sticky",
1837
+ top: 0,
1838
+ zIndex: 99
1839
+ }, children: jsx(For, { each: topRows, children: (row, index) => (jsx(PinnedRow, { row: row, rowSelectionMode: rowSelectionMode, bottomRowLength: bottomRows === null || bottomRows === void 0 ? void 0 : bottomRows.length }, row.id)) }) }) }), jsxs("tbody", { className: styles.tBody, children: [paddingTop > 0 && (jsx("tr", { className: styles.tBodyRow, "aria-hidden": true, children: jsx("td", { style: { height: `${paddingTop}px` } }) })), jsx(For, { each: virtualRows || [], children: (virtualRow) => {
1840
+ const row = rows[virtualRow.index];
1841
+ return (jsx(TableRow, { row: row, rowSelectionMode: rowSelectionMode }, row.id));
1842
+ } }), paddingBottom > 0 && (jsx("tr", { className: styles.tBodyRow, "aria-hidden": true, children: jsx("td", { style: { height: `${paddingBottom}px` } }) }))] }), jsx(Show, { when: rowSelectionMode === 'multiple' && (rows === null || rows === void 0 ? void 0 : rows.length) > 0, children: jsx("tfoot", { style: {
1843
+ position: "sticky",
1844
+ bottom: 0,
1845
+ zIndex: 99
1846
+ }, children: jsxs("tr", { style: { backgroundColor: "white" }, children: [jsx("td", { className: "p-1", children: jsx(Checkbox, { checked: table.getIsSomePageRowsSelected()
1847
+ ? 'mixed'
1848
+ : table.getIsAllPageRowsSelected(), onChange: table.getToggleAllPageRowsSelectedHandler(), "aria-label": "Select All Current Page Rows", title: 'Select All Current Page Rows' }) }), jsxs("td", { colSpan: 20, children: [table.getIsAllPageRowsSelected() ? 'Unselect' : 'Select', " All Current Page Rows (", table.getRowModel().rows.length, ")"] })] }) }) }), jsx(Show, { when: (bottomRows === null || bottomRows === void 0 ? void 0 : bottomRows.length) > 0, children: jsx("tfoot", { style: {
1849
+ position: "sticky",
1850
+ bottom: 0,
1851
+ zIndex: 99
1852
+ }, children: jsx(For, { each: bottomRows, children: (row) => (jsx(PinnedRow, { row: row, rowSelectionMode: rowSelectionMode, bottomRowLength: bottomRows === null || bottomRows === void 0 ? void 0 : bottomRows.length }, row.id)) }) }) })] }));
1853
+ }
1854
+
1855
+ const TableContainer = (props) => {
1856
+ var _a, _b;
1857
+ const styles = useTableStaticStyles();
1858
+ const { table } = props;
1859
+ const { tableHeight, rowSelectionMode } = table.options.meta || {};
1860
+ const tableContainerRef = React.useRef(null);
1861
+ const { rows: { length: itemLength } } = table.getRowModel();
1862
+ const headerGroups = table.getHeaderGroups();
1863
+ // utilities
1864
+ const isLoading = props.isLoading && itemLength === 0;
1865
+ const noItems = !isLoading && ((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) === 0;
1866
+ const noSearchResult = !isLoading && ((_b = props === null || props === void 0 ? void 0 : props.data) === null || _b === void 0 ? void 0 : _b.length) > 0 && itemLength === 0;
1867
+ return (jsxs("div", { ref: tableContainerRef, className: styles.tableContainer, style: { height: tableHeight }, children: [jsxs("table", { className: styles.table, "aria-label": "Data Grid", style: { width: table.getTotalSize(), minWidth: "100%" }, children: [jsx(TableHeader, { table: table, rowSelectionMode: rowSelectionMode, headerGroups: headerGroups }), jsx(TableBody, { table: table, tableContainerRef: tableContainerRef })] }), jsxs(Switch, { when: true, children: [jsx(Case, { value: isLoading, children: jsx(Loading, {}) }), jsx(Case, { value: noItems, children: jsx(NoItemGrid, { message: props.noItemPage }) }), jsx(Case, { value: noSearchResult, children: jsx(NoSearchResult, { message: props.noFilterMatchPage }) })] })] }));
1675
1868
  };
1676
1869
 
1677
- const useNumberRangeFilterStyles$1 = makeStyles({
1870
+ const useCheckboxFilterStyles = makeStyles({
1678
1871
  searchInput: {
1679
- width: '100%',
1680
- },
1681
- searchInputField: {
1682
- width: '100%',
1683
- flexGrow: 1,
1872
+ width: '90%',
1873
+ marginBottom: '8px',
1874
+ marginLeft: '10px',
1875
+ marginRight: '10px',
1684
1876
  },
1685
- searchContainer: {
1686
- display: 'flex',
1687
- flexDirection: 'column',
1877
+ searchContainer: Object.assign(Object.assign(Object.assign({ display: 'flex', flexDirection: 'column', maxHeight: '300px', width: '100%' }, shorthands.overflow('auto', 'auto')), shorthands.padding('0px', "0px", "2px", '0px')), { '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, shorthands.borderRadius('50%')),
1878
+ /* Track */
1879
+ '::-webkit-scrollbar-track': {
1880
+ 'background-color': '#f1f1f1',
1881
+ },
1882
+ /* Handle */
1883
+ '::-webkit-scrollbar-thumb': {
1884
+ 'background-color': '#888',
1885
+ },
1886
+ /* Handle on hover */
1887
+ '::-webkit-scrollbar-thumb:hover': {
1888
+ 'background-color': '#555',
1889
+ } }),
1890
+ });
1891
+ const FilterMultiSelectCheckbox = ({ column, table, }) => {
1892
+ var _a, _b, _c;
1893
+ const firstValue = (_a = table
1894
+ .getPreFilteredRowModel()
1895
+ .flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
1896
+ const columnFilterValue = column.getFilterValue();
1897
+ const [filterOptions, setFilterOptions] = React.useState([]);
1898
+ React.useEffect(() => {
1899
+ const uniqueSortedOptions = typeof firstValue === 'number' || !isNaN(firstValue)
1900
+ ? Array.from(column.getFacetedUniqueValues().keys()).sort((a, b) => Number(a) - Number(b))
1901
+ : Array.from(column.getFacetedUniqueValues().keys()).sort();
1902
+ setFilterOptions(uniqueSortedOptions);
1903
+ },
1904
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1905
+ [column.getFacetedUniqueValues()]);
1906
+ const [localColumnFilterValue, setLocalColumnFilterValue] = React.useState('');
1907
+ const filterOptionsFiltered = React.useMemo(() => {
1908
+ if (!localColumnFilterValue)
1909
+ return filterOptions;
1910
+ return filterOptions.filter((option) => {
1911
+ var _a, _b, _c;
1912
+ return (_b = (_a = `${option}`) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes((_c = `${localColumnFilterValue}`) === null || _c === void 0 ? void 0 : _c.toLowerCase());
1913
+ });
1914
+ }, [localColumnFilterValue, filterOptions]);
1915
+ const filterContainer = React.useRef(null);
1916
+ const rowVirtualizer = useVirtual({
1917
+ parentRef: filterContainer,
1918
+ size: filterOptionsFiltered.length,
1919
+ overscan: 15,
1920
+ });
1921
+ const { virtualItems: virtualRows, totalSize } = rowVirtualizer;
1922
+ const paddingTop = virtualRows.length > 0 ? ((_b = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[0]) === null || _b === void 0 ? void 0 : _b.start) || 0 : 0;
1923
+ const paddingBottom = virtualRows.length > 0
1924
+ ? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
1925
+ : 0;
1926
+ const allOptionChecked = (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) > 0 &&
1927
+ (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) !== (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length)
1928
+ ? 'mixed'
1929
+ : (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) === (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) &&
1930
+ (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) > 0;
1931
+ const styles = useCheckboxFilterStyles();
1932
+ return (jsxs("div", { children: [jsx(Input, { type: 'search', value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsxs("div", { ref: filterContainer, className: styles.searchContainer, children: [paddingTop > 0 && (jsx("span", { style: { paddingTop: `${paddingTop}px` } })), jsx(Checkbox, { checked: allOptionChecked, onChange: () => {
1933
+ if ((columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) > 0) {
1934
+ column.setFilterValue(undefined);
1935
+ return;
1936
+ }
1937
+ column.setFilterValue([
1938
+ ...((filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.map((x) => `${x}`)) || []),
1939
+ ]);
1940
+ }, label: '(Toggle All)' }, `toggle-all-${column.id}`), virtualRows.map((row) => {
1941
+ var _a;
1942
+ const value = `${filterOptionsFiltered[row.index]}`;
1943
+ return (jsx(Checkbox, { checked: (_a = columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) !== null && _a !== void 0 ? _a : false, onChange: () => {
1944
+ if (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) {
1945
+ column.setFilterValue((old) => old === null || old === void 0 ? void 0 : old.filter((v) => v !== value));
1946
+ return;
1947
+ }
1948
+ column.setFilterValue((old) => [
1949
+ ...(old || []),
1950
+ value,
1951
+ ]);
1952
+ }, label: value }, `${column.id}-${row.index}`));
1953
+ }), paddingBottom > 0 && (jsx("span", { style: { paddingBottom: `${paddingBottom}px` } }))] }, 'filter-multi-select-checkbox')] }));
1954
+ };
1955
+
1956
+ const useRadioFilterStyles = makeStyles({
1957
+ searchInput: {
1958
+ width: '90%',
1688
1959
  marginBottom: '8px',
1689
1960
  marginLeft: '10px',
1690
1961
  marginRight: '10px',
1691
1962
  },
1963
+ searchContainer: Object.assign(Object.assign({ display: 'flex', flexDirection: 'column', maxHeight: '300px', width: '100%' }, shorthands.overflow('auto', 'auto')), { '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, shorthands.borderRadius('50%')),
1964
+ /* Track */
1965
+ '::-webkit-scrollbar-track': {
1966
+ 'background-color': '#f1f1f1',
1967
+ },
1968
+ /* Handle */
1969
+ '::-webkit-scrollbar-thumb': {
1970
+ 'background-color': '#888',
1971
+ },
1972
+ /* Handle on hover */
1973
+ '::-webkit-scrollbar-thumb:hover': {
1974
+ 'background-color': '#555',
1975
+ } }),
1692
1976
  });
1693
- const FilterDateRange = (props) => {
1694
- var _a, _b, _c, _d;
1695
- const { column } = props;
1977
+ const FilterSelectRadio = ({ column, table, }) => {
1978
+ var _a, _b, _c;
1979
+ const firstValue = (_a = table
1980
+ .getPreFilteredRowModel()
1981
+ .flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
1696
1982
  const columnFilterValue = column.getFilterValue();
1697
- const min = (_b = (_a = column.getFacetedMinMaxValues()) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : undefined;
1698
- const max = (_d = (_c = column.getFacetedMinMaxValues()) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : undefined;
1699
- const handleMinChange = (date) => {
1700
- if (!date) {
1701
- column.setFilterValue((old) => [undefined, old === null || old === void 0 ? void 0 : old[1]]);
1702
- return;
1703
- }
1704
- column.setFilterValue((old) => [date, old === null || old === void 0 ? void 0 : old[1]]);
1705
- };
1706
- const handleMaxChange = (date) => {
1707
- if (!date) {
1708
- column.setFilterValue((old) => [old === null || old === void 0 ? void 0 : old[0], undefined]);
1709
- return;
1710
- }
1711
- column.setFilterValue((old) => [old === null || old === void 0 ? void 0 : old[0], date]);
1712
- };
1713
- const styles = useNumberRangeFilterStyles$1();
1714
- return (jsxs("div", { className: styles.searchContainer, children: [jsx(Field, { label: 'From Date:', size: "small", className: styles.searchInputField, children: jsx(DatePicker, { value: (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[0]) || null, min: min, max: max, onSelectDate: handleMinChange, className: styles.searchInput, placeholder: `From Date`, size: 'small', allowTextInput: true }) }), jsx(Field, { label: 'To Date:', size: "small", className: styles.searchInputField, children: jsx(DatePicker, { value: (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[1]) || null, min: min, max: max, onSelectDate: handleMaxChange, className: styles.searchInput, placeholder: `To Date`, size: 'small', allowTextInput: true }) })] }));
1983
+ const [filterOptions, setFilterOptions] = React.useState([]);
1984
+ React.useEffect(() => {
1985
+ const uniqueSortedOptions = typeof firstValue === 'number' || !isNaN(firstValue)
1986
+ ? Array.from(column.getFacetedUniqueValues().keys()).sort((a, b) => Number(a) - Number(b))
1987
+ : Array.from(column.getFacetedUniqueValues().keys()).sort();
1988
+ setFilterOptions(uniqueSortedOptions);
1989
+ },
1990
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1991
+ [column.getFacetedUniqueValues()]);
1992
+ const [localColumnFilterValue, setLocalColumnFilterValue] = React.useState('');
1993
+ const filterOptionsFiltered = React.useMemo(() => {
1994
+ if (!localColumnFilterValue)
1995
+ return filterOptions;
1996
+ return filterOptions.filter((option) => {
1997
+ var _a, _b, _c;
1998
+ return (_b = (_a = `${option}`) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes((_c = `${localColumnFilterValue}`) === null || _c === void 0 ? void 0 : _c.toLowerCase());
1999
+ });
2000
+ }, [localColumnFilterValue, filterOptions]);
2001
+ const filterContainer = React.useRef(null);
2002
+ const rowVirtualizer = useVirtual({
2003
+ parentRef: filterContainer,
2004
+ size: filterOptionsFiltered.length,
2005
+ overscan: 15,
2006
+ });
2007
+ const { virtualItems: virtualRows, totalSize } = rowVirtualizer;
2008
+ const paddingTop = virtualRows.length > 0 ? ((_b = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[0]) === null || _b === void 0 ? void 0 : _b.start) || 0 : 0;
2009
+ const paddingBottom = virtualRows.length > 0
2010
+ ? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
2011
+ : 0;
2012
+ const styles = useRadioFilterStyles();
2013
+ return (jsxs("div", { children: [jsx(Input, { value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsxs("div", { ref: filterContainer, className: styles.searchContainer, children: [paddingTop > 0 && jsx("div", { style: { paddingTop: `${paddingTop}px` } }), jsxs(RadioGroup, { layout: "vertical", value: (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[0]) || '', onChange: (_, data) => {
2014
+ if (data.value === '') {
2015
+ column.setFilterValue([]);
2016
+ return;
2017
+ }
2018
+ column.setFilterValue([data.value]);
2019
+ }, children: [jsx(Radio, { value: '', label: 'None' }), virtualRows.map((row) => {
2020
+ const value = filterOptionsFiltered[row.index];
2021
+ return jsx(Radio, { value: value, label: value }, value);
2022
+ })] }), paddingBottom > 0 && (jsx("div", { style: { paddingBottom: `${paddingBottom}px` } }))] })] }));
1715
2023
  };
1716
2024
 
1717
- const useNumberRangeFilterStyles = makeStyles({
2025
+ const useNumberRangeFilterStyles$2 = makeStyles({
1718
2026
  searchInput: {
1719
2027
  width: '100%',
1720
2028
  },
@@ -1724,30 +2032,34 @@ const useNumberRangeFilterStyles = makeStyles({
1724
2032
  },
1725
2033
  searchContainer: {
1726
2034
  display: 'flex',
1727
- flexDirection: 'column',
1728
2035
  marginBottom: '8px',
1729
2036
  marginLeft: '10px',
1730
2037
  marginRight: '10px',
1731
- },
2038
+ }
1732
2039
  });
1733
- const FilterDate = (props) => {
1734
- var _a, _b, _c, _d;
2040
+ const FilterNumberRange = (props) => {
2041
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1735
2042
  const { column } = props;
1736
2043
  const columnFilterValue = column.getFilterValue();
1737
- const min = (_b = (_a = column.getFacetedMinMaxValues()) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : undefined;
1738
- const max = (_d = (_c = column.getFacetedMinMaxValues()) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : undefined;
1739
- const onDateSelect = (date) => {
1740
- if (!date) {
1741
- column.setFilterValue(undefined);
1742
- return;
1743
- }
1744
- column.setFilterValue(date);
2044
+ const min = Number((_b = (_a = column.getFacetedMinMaxValues()) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '');
2045
+ const max = Number((_d = (_c = column.getFacetedMinMaxValues()) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : '');
2046
+ const handleMinChange = (e, data) => {
2047
+ const value = Number(data.value);
2048
+ column.setFilterValue((old) => [value, old === null || old === void 0 ? void 0 : old[1]]);
1745
2049
  };
1746
- const styles = useNumberRangeFilterStyles();
1747
- return (jsx("div", { className: styles.searchContainer, children: jsx(DatePicker, { value: columnFilterValue || null, min: min, max: max, onSelectDate: onDateSelect, className: styles.searchInput, placeholder: `Select a date`, size: 'small', allowTextInput: true }) }));
2050
+ const handleMaxChange = (e, data) => {
2051
+ const value = Number(data.value);
2052
+ column.setFilterValue((old) => [old === null || old === void 0 ? void 0 : old[0], value]);
2053
+ };
2054
+ const styles = useNumberRangeFilterStyles$2();
2055
+ return (jsxs("div", { className: styles.searchContainer, children: [jsx(Field, { label: 'Min:', size: "small", className: styles.searchInputField, children: jsx(Input, { type: "number", value: `${(columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[0]) || ''}`, min: min, max: max, onChange: handleMinChange, className: styles.searchInput, placeholder: `Min ${((_e = column.getFacetedMinMaxValues()) === null || _e === void 0 ? void 0 : _e[0])
2056
+ ? `(${(_f = column.getFacetedMinMaxValues()) === null || _f === void 0 ? void 0 : _f[0]})`
2057
+ : ''}` }) }), jsx(Field, { label: 'Max:', size: "small", className: styles.searchInputField, children: jsx(Input, { type: "number", value: `${(columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[1]) || ''}`, min: min, max: max, onChange: handleMaxChange, className: styles.searchInput, placeholder: `Max ${((_g = column.getFacetedMinMaxValues()) === null || _g === void 0 ? void 0 : _g[1])
2058
+ ? `(${(_h = column.getFacetedMinMaxValues()) === null || _h === void 0 ? void 0 : _h[1]})`
2059
+ : ''}` }) })] }));
1748
2060
  };
1749
2061
 
1750
- const useFilterStyles = makeStyles({
2062
+ const useNumberRangeFilterStyles$1 = makeStyles({
1751
2063
  searchInput: {
1752
2064
  width: '100%',
1753
2065
  },
@@ -1757,427 +2069,157 @@ const useFilterStyles = makeStyles({
1757
2069
  },
1758
2070
  searchContainer: {
1759
2071
  display: 'flex',
2072
+ flexDirection: 'column',
1760
2073
  marginBottom: '8px',
1761
2074
  marginLeft: '10px',
1762
2075
  marginRight: '10px',
1763
2076
  },
1764
2077
  });
1765
- const Filter = ({ column, table, }) => {
1766
- var _a, _b;
1767
- const filterFunctionName = column.columnDef.filterFn;
1768
- const styles = useFilterStyles();
1769
- switch (filterFunctionName) {
1770
- case 'arrIncludesSome':
1771
- return jsx(FilterMultiSelectCheckbox, { column: column, table: table });
1772
- case 'arrIncludesAll':
1773
- case 'arrIncludes':
1774
- return jsx(FilterSelectRadio, { column: column, table: table });
1775
- case 'inNumberRange':
1776
- return jsx(FilterNumberRange, { column: column, table: table });
1777
- case 'inDateRange': {
1778
- const firstValue = (_a = table
1779
- .getPreFilteredRowModel()
1780
- .flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
1781
- if (typeof firstValue.getMonth === 'function') {
1782
- return jsx(FilterDateRange, { column: column, table: table });
1783
- }
1784
- break;
1785
- }
1786
- case 'matchDate': {
1787
- const firstValue = (_b = table
1788
- .getPreFilteredRowModel()
1789
- .flatRows[0]) === null || _b === void 0 ? void 0 : _b.getValue(column.id);
1790
- if (typeof firstValue.getMonth === 'function') {
1791
- return jsx(FilterDate, { column: column, table: table });
1792
- }
1793
- break;
2078
+ const FilterDateRange = (props) => {
2079
+ var _a, _b, _c, _d;
2080
+ const { column } = props;
2081
+ const columnFilterValue = column.getFilterValue();
2082
+ const min = (_b = (_a = column.getFacetedMinMaxValues()) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : undefined;
2083
+ const max = (_d = (_c = column.getFacetedMinMaxValues()) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : undefined;
2084
+ const handleMinChange = (date) => {
2085
+ if (!date) {
2086
+ column.setFilterValue((old) => [undefined, old === null || old === void 0 ? void 0 : old[1]]);
2087
+ return;
1794
2088
  }
1795
- }
1796
- return (jsx("div", { className: styles.searchContainer, children: jsx(Field, { size: 'small', className: styles.searchInputField, children: jsx(Input, { value: (column.getFilterValue() || ''), onChange: (_, data) => {
1797
- column.setFilterValue(data.value);
1798
- }, placeholder: "Search Keyword...", size: "small", className: styles.searchInput }) }) }));
1799
- };
1800
-
1801
- const useFilterDrawerStyles$1 = makeStyles({
1802
- drawerBody: Object.assign(Object.assign({}, shorthands.overflow('hidden', 'auto')), {
1803
- /* width */
1804
- ':hover': Object.assign({}, shorthands.overflow('auto', 'auto')), '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, shorthands.borderRadius('50%')),
1805
- /* Track */
1806
- '::-webkit-scrollbar-track': {
1807
- 'background-color': '#f1f1f1',
1808
- },
1809
- /* Handle */
1810
- '::-webkit-scrollbar-thumb': {
1811
- 'background-color': '#888',
1812
- },
1813
- /* Handle on hover */
1814
- '::-webkit-scrollbar-thumb:hover': {
1815
- 'background-color': '#555',
1816
- } }),
1817
- });
1818
- const FilterDrawer = ({ drawerState, dispatch, table }) => {
1819
- const headerGroups = table.getHeaderGroups();
1820
- const styles = useFilterDrawerStyles$1();
1821
- const resetAllFilters = React.useCallback(() => {
1822
- table.setGlobalFilter('');
1823
- table.resetColumnFilters();
1824
- }, [table]);
1825
- return (jsxs(InlineDrawer, { position: "end", open: drawerState.isFilterDrawerOpen, separator: true, children: [jsx(DrawerHeader, { children: jsx(DrawerHeaderTitle, { action: jsx(Button, { appearance: "subtle", "aria-label": "Close", icon: jsx(Dismiss24Regular, {}), onClick: () => dispatch({ type: "CLOSE_FILTER_DRAWER" }) }), children: "Advanced Filters" }) }), jsx(DrawerBody, { className: styles.drawerBody, children: jsx(Accordion, { multiple: true, collapsible: true, children: headerGroups.map((headerGroup) => {
1826
- const canApplyFilter = headerGroup.depth === (headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.length) - 1;
1827
- if (!canApplyFilter)
1828
- return null;
1829
- return headerGroup.headers.map((header) => {
1830
- const canFilter = header.column.getCanFilter();
1831
- if (!canFilter)
1832
- return null;
1833
- return (jsx(Show, { when: header.column.getCanFilter(), children: jsxs(AccordionItem, { value: header.column.id, children: [jsx(AccordionHeader, { expandIconPosition: 'end', children: jsxs(Caption1Stronger, { children: ["Filter by", ' ', flexRender(header.column.columnDef.header, header.getContext())] }) }), jsx(AccordionPanel, { children: jsx(Filter, { column: header.column, table: table }) })] }, header.column.id) }, header.column.id));
1834
- });
1835
- }) }) }), jsx(DrawerFooter, { children: jsx(Button, { icon: jsx(ClearFilterIcon, {}), onClick: resetAllFilters, style: { width: "100%" }, children: "Clear All Filters" }) })] }));
1836
- };
1837
-
1838
- const getHeaderCellPinningStyles = (column) => {
1839
- const isPinned = column.getIsPinned();
1840
- const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
1841
- const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
1842
- const styles = {
1843
- boxShadow: isLastLeftPinnedColumn
1844
- ? '-4px 0 4px -4px gray inset'
1845
- : isFirstRightPinnedColumn
1846
- ? '4px 0 4px -4px gray inset'
1847
- : undefined,
1848
- left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined,
1849
- right: isPinned === 'right' ? `${column.getAfter('right')}px` : undefined,
1850
- opacity: isPinned ? 0.95 : 1,
1851
- position: isPinned ? 'sticky' : 'relative',
1852
- width: column.getSize(),
1853
- zIndex: isPinned ? 99 : 1,
1854
- backgroundColor: tokens.colorNeutralCardBackgroundSelected,
1855
- };
1856
- return styles;
1857
- };
1858
- const getBodyCellPinningStyles = (column) => {
1859
- const isPinned = column.getIsPinned();
1860
- const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
1861
- const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
1862
- const styles = {
1863
- boxShadow: isLastLeftPinnedColumn
1864
- ? '-4px 0 4px -4px gray inset'
1865
- : isFirstRightPinnedColumn
1866
- ? '4px 0 4px -4px gray inset'
1867
- : undefined,
1868
- left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined,
1869
- right: isPinned === 'right' ? `${column.getAfter('right')}px` : undefined,
1870
- opacity: isPinned ? 0.95 : 1,
1871
- position: isPinned ? 'sticky' : 'relative',
1872
- width: column.getSize(),
1873
- zIndex: isPinned ? 1 : 0,
1874
- };
1875
- return styles;
1876
- };
1877
-
1878
- const SortAscIcon = bundleIcon$1(ArrowSortDown20Filled, ArrowSortDown20Regular);
1879
- const SortDescIcon = bundleIcon$1(ArrowSortUp20Filled, ArrowSortUp20Regular);
1880
- const PinIcon = bundleIcon$1(PinFilled, PinRegular);
1881
- function HeaderCell({ header, table, hideMenu, headerDepth, totalNumberOfHeaderDepth, }) {
1882
- var _a;
1883
- const { column } = header;
1884
- const { isDragging, attributes, listeners, setNodeRef, transform, transition, } = useSortable({
1885
- id: column.id
1886
- });
1887
- const dndStyle = {
1888
- width: header.column.getSize(),
1889
- opacity: isDragging ? 0.8 : 1,
1890
- // position: isDragging ? 'relative' : "sticky",
1891
- transform: CSS.Translate.toString(transform), // translate instead of transform to avoid squishing
1892
- // transition: 'width transform 0.2s ease-in-out',
1893
- whiteSpace: 'wrap',
1894
- zIndex: isDragging ? 100 : 99,
1895
- transition
2089
+ column.setFilterValue((old) => [date, old === null || old === void 0 ? void 0 : old[1]]);
1896
2090
  };
1897
- const styles = useTableHeaderStyles();
1898
- const isLeafHeaders = headerDepth === totalNumberOfHeaderDepth;
1899
- if (header.isPlaceholder) {
1900
- return (jsx("th", { colSpan: header.colSpan, className: styles.tHeadCell, style: Object.assign(Object.assign({}, dndStyle), getHeaderCellPinningStyles(column)), ref: setNodeRef, children: jsx(Show, { when: header.column.getCanResize(), children: jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: mergeClasses$1(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }) }));
1901
- }
1902
- return (jsxs("th", { colSpan: header.colSpan, className: mergeClasses$1(styles.tHeadCell, isLeafHeaders && styles.tHeadNonLeafCell, isDragging && styles.tHeadCellDragging), style: Object.assign(Object.assign({}, dndStyle), getHeaderCellPinningStyles(column)), ref: setNodeRef, children: [jsx("div", Object.assign({ className: styles.tHeadCellDraggable }, attributes, listeners, { children: jsxs("div", { className: isLeafHeaders
1903
- ? styles.tLeafHeadCellContent
1904
- : styles.tNonLeafHeadCellContent, children: [jsx("div", { children: jsx(Show, { when: !header.isPlaceholder, children: jsxs(Button, { style: {
1905
- display: 'flex',
1906
- alignItems: 'center',
1907
- justifyContent: 'left',
1908
- flex: 1,
1909
- }, onClick: (e) => {
1910
- if (!header.column.getCanSort())
1911
- return;
1912
- header.column.toggleSorting(header.column.getIsSorted() === 'asc', e.ctrlKey);
1913
- }, onDoubleClick: () => {
1914
- if (!header.column.getCanGroup())
1915
- return;
1916
- header.column.getToggleGroupingHandler()();
1917
- }, appearance: "transparent", className: styles.tHeadContentBtn, icon: (_a = {
1918
- asc: (jsx("strong", { children: jsx(SortAscIcon, {}) })),
1919
- desc: (jsx("strong", { children: jsx(SortDescIcon, {}) })),
1920
- }[header.column.getIsSorted()]) !== null && _a !== void 0 ? _a : undefined, iconPosition: "after", children: [jsx("strong", { children: flexRender(header.column.columnDef.header, header.getContext()) }), jsx(Show, { when: header.column.getIsGrouped(), children: jsx("strong", { children: jsx(GroupListRegular, {}) }) }), jsx(Show, { when: header.column.getIsFiltered(), children: jsx("strong", { children: jsx(FilterFilled, {}) }) }), jsx(Show, { when: header.column.getIsPinned(), children: jsx("strong", { children: jsx(PinRegular, {}) }) })] }) }) }), jsx(HeaderMenu, { header: header, table: table, hideMenu: hideMenu })] }) })), jsx(Show, { when: header.column.getCanResize(), children: jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: mergeClasses$1(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }), jsx(Show, { when: !isLeafHeaders, children: jsx("div", { className: styles.tHeadNonLeafCellFakeBorder }) })] }));
1921
- }
1922
- function HeaderMenu(props) {
1923
- const { header, table, hideMenu } = props;
1924
- const styles = useTableHeaderStyles();
1925
- if (hideMenu || header.isPlaceholder)
1926
- return (jsx(Fragment, { children: " " }));
1927
- const canHavePopOver = header.column.getCanSort() ||
1928
- header.column.getCanGroup() ||
1929
- header.column.getCanFilter();
1930
- if (!canHavePopOver)
1931
- return (jsx(Fragment, { children: " " }));
1932
- return (jsxs(Menu, { children: [jsx(MenuTrigger, { disableButtonEnhancement: true, children: jsx(MenuButton, { appearance: "transparent", "aria-label": "View Column Actions" }) }), jsx(MenuPopover, { className: styles.tHeadMenuPopover, children: jsxs(MenuList, { children: [jsx(Show, { when: header.column.getCanSort(), children: jsxs(MenuGroup, { children: [jsx(MenuItem, { onClick: (e) => {
1933
- var _a;
1934
- const isControlKeySelected = e.ctrlKey;
1935
- (_a = header.column) === null || _a === void 0 ? void 0 : _a.toggleSorting(false, isControlKeySelected);
1936
- }, icon: jsx(TextSortAscendingFilled, {}), disabled: header.column.getIsSorted() === 'asc', children: "Sort A to Z" }), jsx(MenuItem, { onClick: (e) => {
1937
- var _a;
1938
- const isControlKeySelected = e.ctrlKey;
1939
- (_a = header.column) === null || _a === void 0 ? void 0 : _a.toggleSorting(true, isControlKeySelected);
1940
- }, icon: jsx(TextSortDescendingFilled, {}), disabled: header.column.getIsSorted() === 'desc', children: "Sort Z to A" }), jsx(MenuDivider, {})] }, 'sort-group') }), jsx(Show, { when: header.column.getCanGroup(), children: jsxs(MenuGroup, { children: [!header.column.getIsGrouped() && (jsxs(MenuItem, { onClick: () => header.column.getToggleGroupingHandler()(), icon: jsx(GroupFilled, {}), children: ["Group by", ' ', flexRender(header.column.columnDef.header, header.getContext())] })), header.column.getIsGrouped() && (jsxs(MenuItem, { onClick: () => header.column.getToggleGroupingHandler()(), icon: jsx(GroupDismissFilled, {}), children: ["Remove Grouping on", ' ', flexRender(header.column.columnDef.header, header.getContext())] })), jsx(MenuDivider, {})] }, 'grouping-group') }), jsxs(Show, { when: header.column.getCanPin(), children: [jsxs(Menu, { children: [jsx(MenuTrigger, { disableButtonEnhancement: true, children: jsx(MenuItem, { icon: jsx(PinIcon, {}), children: "Pin Column" }) }), jsx(MenuPopover, { children: jsxs(MenuList, { children: [jsx(Show, { when: ['left', 'right'].includes(header.column.getIsPinned()), children: jsx(MenuItem, { onClick: () => {
1941
- var _a;
1942
- (_a = header.column) === null || _a === void 0 ? void 0 : _a.pin(false);
1943
- }, icon: jsx(PinOffRegular, {}), children: "No Pin" }) }), jsx(MenuItem, { onClick: () => {
1944
- var _a;
1945
- (_a = header.column) === null || _a === void 0 ? void 0 : _a.pin('left');
1946
- }, icon: jsx(ArrowStepInLeftRegular, {}), disabled: header.column.getIsPinned() === 'left', children: "Pin Left" }), jsx(MenuItem, { onClick: () => {
1947
- var _a;
1948
- (_a = header.column) === null || _a === void 0 ? void 0 : _a.pin('right');
1949
- }, icon: jsx(ArrowStepInRightRegular, {}), disabled: header.column.getIsPinned() === 'right', children: "Pin Right" })] }) })] }), jsx(MenuDivider, {})] }), jsx(Show, { when: header.column.getCanFilter(), children: jsxs(MenuGroup, { children: [jsxs(MenuGroupHeader, { children: ["Filter by", ' ', flexRender(header.column.columnDef.header, header.getContext())] }), jsx(Filter, { column: header.column, table: table })] }, 'filter-group') })] }) })] }));
1950
- }
1951
-
1952
- function HeaderRow(props) {
1953
- const styles = useTableHeaderStyles();
1954
- const { table, headerGroup, rowSelectionMode, headerGroupsLength } = props;
1955
- return (jsxs("tr", { className: styles.tHeadRow, children: [rowSelectionMode === 'multiple' && (jsx("th", { style: { width: '1rem' }, "aria-label": "Select All Row Column", children: headerGroup.depth === headerGroupsLength - 1 && (jsx(Checkbox, { checked: table.getIsSomeRowsSelected()
1956
- ? 'mixed'
1957
- : table.getIsAllRowsSelected(), onChange: table.getToggleAllRowsSelectedHandler(), "aria-label": "Select All Rows", title: 'Select All Rows' })) })), rowSelectionMode === 'single' && (jsx("th", { style: { width: '1rem' }, "aria-label": "Select All Row Column", children: ' ' })), headerGroup.headers.map((header) => {
1958
- return (jsx(HeaderCell, { header: header, table: table, hideMenu: headerGroup.depth !== headerGroupsLength - 1, headerDepth: headerGroup.depth, totalNumberOfHeaderDepth: headerGroupsLength - 1 }, header.id));
1959
- })] }, headerGroup.id));
1960
- }
1961
-
1962
- function TableHeader(props) {
1963
- const styles = useTableHeaderStyles();
1964
- const { table, headerGroups, rowSelectionMode } = props;
1965
- return (jsx("thead", { className: styles.tHead, style: { zIndex: 99 }, children: headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map((headerGroup) => (jsx(HeaderRow, { table: table, rowSelectionMode: rowSelectionMode, headerGroup: headerGroup, headerGroupsLength: headerGroups.length }, headerGroup.id))) }));
1966
- }
1967
-
1968
- const useLoadingStyles = makeStyles({
1969
- invertedWrapper: {
1970
- backgroundColor: tokens.colorNeutralBackground1,
1971
- },
1972
- row: Object.assign(Object.assign({ alignItems: "center", display: "grid", paddingBottom: "10px", position: "relative" }, shorthands.gap("10px")), { gridTemplateColumns: "min-content 20% 15% 30% 29%" }),
1973
- });
1974
-
1975
- const Loading = (props) => {
1976
- const { numberOfItems = 16, numberOfColumns = 5 } = props;
1977
- const styles = useLoadingStyles();
1978
- return (jsx("div", { className: styles.invertedWrapper, children: jsx(Skeleton, { children: [...Array(numberOfItems)].map((_, i) => (jsx("div", { className: styles.row, children: [...Array(numberOfColumns)].map((_, i) => {
1979
- if (i === 0) {
1980
- return jsx(SkeletonItem, { shape: "circle", size: 24 }, i);
1981
- }
1982
- return jsx(SkeletonItem, { size: 16 }, i);
1983
- }) }, i))) }) }));
1984
- };
1985
-
1986
- const useNoItemGridStyles = makeStyles({
1987
- wrapper: {
1988
- backgroundColor: tokens.colorNeutralBackground1,
1989
- display: "flex",
1990
- flexWrap: "wrap",
1991
- alignContent: "center",
1992
- justifyContent: "center",
1993
- minHeight: "300px",
1994
- }
1995
- });
1996
-
1997
- const NoItemGrid = ({ message }) => {
1998
- const styles = useNoItemGridStyles();
1999
- return (jsx("div", { className: styles.wrapper, children: jsx("div", { children: message ? message : jsx(Subtitle2Stronger, { children: "No Data to Show." }) }) }));
2000
- };
2001
-
2002
- const useNoFilterMatchStyles = makeStyles({
2003
- wrapper: {
2004
- backgroundColor: tokens.colorNeutralBackground1,
2005
- display: "flex",
2006
- flexDirection: "column",
2007
- flexWrap: "wrap",
2008
- alignContent: "center",
2009
- justifyContent: "center",
2010
- minHeight: "300px",
2011
- },
2012
- iconWrapper: {
2013
- display: "flex",
2014
- flexWrap: "wrap",
2015
- alignContent: "center",
2016
- justifyContent: "center",
2017
- }
2018
- });
2019
-
2020
- const NoSearchResult = ({ message }) => {
2021
- const styles = useNoFilterMatchStyles();
2022
- return (jsxs("div", { className: styles.wrapper, children: [jsx("div", { className: styles.iconWrapper, children: jsx(DocumentSearch24Regular, {}) }), jsx("div", { children: message ? message : jsx(Subtitle2Stronger, { children: "No item found that matches your search term." }) })] }));
2023
- };
2024
-
2025
- const useTableBodyStyles = makeStyles({
2026
- tBody: Object.assign(Object.assign({}, shorthands.padding("0px", "0px", "0px", "0px")), { zIndex: 0 }),
2027
- tBodyRow: Object.assign(Object.assign(Object.assign({}, shorthands.padding("0px", "0px", "0px", "0px")), shorthands.borderBottom(tokens.strokeWidthThin, "solid", tokens.colorNeutralStroke1)), {
2028
- // ":nth-child(even)": {
2029
- // backgroundColor: tokens.colorNeutralBackground2,
2030
- // },
2031
- ":hover": {
2032
- backgroundColor: tokens.colorNeutralBackground2Hover,
2033
- } }),
2034
- tBodySelectedRow: Object.assign(Object.assign({ backgroundColor: tokens.colorBrandBackground2 }, shorthands.borderBottom(tokens.strokeWidthThin, "solid", tokens.colorNeutralStroke1)), { ":hover": {
2035
- backgroundColor: tokens.colorBrandBackground2Hover,
2036
- } }),
2037
- tBodyCell: Object.assign(Object.assign({ backgroundColor: "transparent" }, shorthands.padding("2px", "4px")), { minHeight: "35px", height: "35px" }),
2038
- tBodyRowPinnedCell: {
2039
- backgroundColor: tokens.colorPaletteYellowBackground2,
2040
- ":hover": {
2041
- backgroundColor: tokens.colorPaletteMarigoldBackground2,
2042
- }
2043
- },
2044
- tBodyPinnedCell: {
2045
- backgroundColor: tokens.colorNeutralBackground3,
2046
- ":hover": {
2047
- backgroundColor: tokens.colorNeutralBackground3Hover,
2091
+ const handleMaxChange = (date) => {
2092
+ if (!date) {
2093
+ column.setFilterValue((old) => [old === null || old === void 0 ? void 0 : old[0], undefined]);
2094
+ return;
2048
2095
  }
2096
+ column.setFilterValue((old) => [old === null || old === void 0 ? void 0 : old[0], date]);
2097
+ };
2098
+ const styles = useNumberRangeFilterStyles$1();
2099
+ return (jsxs("div", { className: styles.searchContainer, children: [jsx(Field, { label: 'From Date:', size: "small", className: styles.searchInputField, children: jsx(DatePicker, { value: (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[0]) || null, min: min, max: max, onSelectDate: handleMinChange, className: styles.searchInput, placeholder: `From Date`, size: 'small', allowTextInput: true }) }), jsx(Field, { label: 'To Date:', size: "small", className: styles.searchInputField, children: jsx(DatePicker, { value: (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[1]) || null, min: min, max: max, onSelectDate: handleMaxChange, className: styles.searchInput, placeholder: `To Date`, size: 'small', allowTextInput: true }) })] }));
2100
+ };
2101
+
2102
+ const useNumberRangeFilterStyles = makeStyles({
2103
+ searchInput: {
2104
+ width: '100%',
2049
2105
  },
2050
- tBodySelectedCell: {
2051
- backgroundColor: tokens.colorBrandBackground2,
2052
- ":hover": {
2053
- backgroundColor: tokens.colorBrandBackground2Hover,
2054
- }
2106
+ searchInputField: {
2107
+ width: '100%',
2108
+ flexGrow: 1,
2109
+ },
2110
+ searchContainer: {
2111
+ display: 'flex',
2112
+ flexDirection: 'column',
2113
+ marginBottom: '8px',
2114
+ marginLeft: '10px',
2115
+ marginRight: '10px',
2055
2116
  },
2056
2117
  });
2057
-
2058
- function TableCell({ cell, row }) {
2059
- var _a;
2060
- const styles = useTableBodyStyles();
2061
- const isSelected = row.getIsSelected();
2062
- const isRowPinned = row.getIsPinned();
2063
- const isCellPinned = cell.column.getIsPinned();
2064
- const { isDragging, transition, setNodeRef, transform } = useSortable({
2065
- id: cell.column.id,
2066
- });
2067
- const tdStyle = {
2068
- width: cell.column.getSize(),
2069
- opacity: isDragging ? "0.8" : "1",
2070
- transform: CSS.Translate.toString(transform),
2071
- // transition: 'width transform 0.2s ease-in-out',
2072
- zIndex: isDragging ? 1 : 0,
2073
- transition
2118
+ const FilterDate = (props) => {
2119
+ var _a, _b, _c, _d;
2120
+ const { column } = props;
2121
+ const columnFilterValue = column.getFilterValue();
2122
+ const min = (_b = (_a = column.getFacetedMinMaxValues()) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : undefined;
2123
+ const max = (_d = (_c = column.getFacetedMinMaxValues()) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : undefined;
2124
+ const onDateSelect = (date) => {
2125
+ if (!date) {
2126
+ column.setFilterValue(undefined);
2127
+ return;
2128
+ }
2129
+ column.setFilterValue(date);
2074
2130
  };
2075
- const cellClassNames = mergeClasses$1(styles.tBodyCell, isCellPinned && styles.tBodyPinnedCell, isSelected && styles.tBodySelectedCell, isRowPinned && styles.tBodyRowPinnedCell);
2076
- const styleStyles = Object.assign(Object.assign({}, tdStyle), getBodyCellPinningStyles(cell.column));
2077
- if (cell.getIsPlaceholder()) {
2078
- return jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef }, cell.id);
2079
- }
2080
- if (cell.getIsGrouped()) {
2081
- return (jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: jsx(Button, { onClick: row.getToggleExpandedHandler(), style: {
2082
- cursor: row.getCanExpand() ? 'pointer' : 'normal',
2083
- textAlign: 'left',
2084
- }, appearance: "transparent", icon: row.getIsExpanded() ? jsx(GroupExpandedIcon, {}) : jsx(GroupCollapsedIcon, {}), children: jsxs("strong", { children: [flexRender(cell.column.columnDef.cell, cell.getContext()), " (", row.subRows.length, ")"] }) }) }, cell.id));
2085
- }
2086
- if (cell.getIsAggregated()) {
2087
- return (jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: jsx("strong", { children: flexRender((_a = cell.column.columnDef.aggregatedCell) !== null && _a !== void 0 ? _a : cell.column.columnDef.cell, cell.getContext()) }) }, cell.id));
2088
- }
2089
- return (jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
2090
- }
2091
-
2092
- function TableRow({ row, rowSelectionMode, style }) {
2093
- const styles = useTableBodyStyles();
2094
- return (jsxs("tr", { className: row.getIsSelected() || row.getIsAllSubRowsSelected()
2095
- ? styles.tBodySelectedRow
2096
- : styles.tBodyRow, style: style, children: [jsxs(Switch$1, { when: rowSelectionMode, children: [jsx(Case, { value: 'multiple', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsx(Checkbox, { checked: row.getIsSomeSelected()
2097
- ? 'mixed'
2098
- : row.getIsSelected() || row.getIsAllSubRowsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) }), jsx(Case, { value: 'single', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsx(Radio, { checked: row.getIsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) })] }), row.getVisibleCells().map((cell) => (jsx(TableCell, { cell: cell, row: row }, cell.id)))] }, row.id));
2099
- }
2100
- function PinnedRow({ row, rowSelectionMode, style, bottomRowLength }) {
2101
- const styles = useTableBodyStyles();
2102
- return (jsxs("tr", { className: row.getIsSelected() || row.getIsAllSubRowsSelected()
2103
- ? styles.tBodySelectedRow
2104
- : styles.tBodyRow, style: {
2105
- backgroundColor: 'goldenrod',
2106
- position: 'sticky',
2107
- top: row.getIsPinned() === 'top'
2108
- ? `${row.getPinnedIndex() * 35 + 48}px`
2109
- : undefined,
2110
- bottom: row.getIsPinned() === 'bottom'
2111
- ? `${((bottomRowLength || 0) - 1 - row.getPinnedIndex()) * 35}px`
2112
- : undefined
2113
- }, children: [jsxs(Switch$1, { when: rowSelectionMode, children: [jsx(Case, { value: 'multiple', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsx(Checkbox, { checked: row.getIsSomeSelected()
2114
- ? 'mixed'
2115
- : row.getIsSelected() || row.getIsAllSubRowsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) }), jsx(Case, { value: 'single', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsx(Radio, { checked: row.getIsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) })] }), row.getVisibleCells().map(cell => {
2116
- return (jsx(TableCell, { cell: cell, row: row }, cell.id));
2117
- })] }, row.id));
2118
- }
2131
+ const styles = useNumberRangeFilterStyles();
2132
+ return (jsx("div", { className: styles.searchContainer, children: jsx(DatePicker, { value: columnFilterValue || null, min: min, max: max, onSelectDate: onDateSelect, className: styles.searchInput, placeholder: `Select a date`, size: 'small', allowTextInput: true }) }));
2133
+ };
2119
2134
 
2120
- function TableBody(props) {
2121
- var _a, _b, _c;
2122
- const styles = useTableBodyStyles();
2123
- const { table, tableContainerRef } = props;
2124
- const rowSelectionMode = (_a = table.options.meta) === null || _a === void 0 ? void 0 : _a.rowSelectionMode;
2125
- let rows = [];
2126
- let topRows = [];
2127
- let bottomRows = [];
2128
- try {
2129
- rows = table.getCenterRows();
2130
- topRows = table.getTopRows();
2131
- bottomRows = table.getBottomRows();
2132
- }
2133
- catch (error) {
2134
- rows = [];
2135
- topRows = [];
2136
- bottomRows = [];
2135
+ const useFilterStyles = makeStyles({
2136
+ searchInput: {
2137
+ width: '100%',
2138
+ },
2139
+ searchInputField: {
2140
+ width: '100%',
2141
+ flexGrow: 1,
2142
+ },
2143
+ searchContainer: {
2144
+ display: 'flex',
2145
+ marginBottom: '8px',
2146
+ marginLeft: '10px',
2147
+ marginRight: '10px',
2148
+ },
2149
+ });
2150
+ const Filter = ({ column, table, }) => {
2151
+ var _a, _b;
2152
+ const filterFunctionName = column.columnDef.filterFn;
2153
+ const styles = useFilterStyles();
2154
+ switch (filterFunctionName) {
2155
+ case 'arrIncludesSome':
2156
+ return jsx(FilterMultiSelectCheckbox, { column: column, table: table });
2157
+ case 'arrIncludesAll':
2158
+ case 'arrIncludes':
2159
+ return jsx(FilterSelectRadio, { column: column, table: table });
2160
+ case 'inNumberRange':
2161
+ return jsx(FilterNumberRange, { column: column, table: table });
2162
+ case 'inDateRange': {
2163
+ const firstValue = (_a = table
2164
+ .getPreFilteredRowModel()
2165
+ .flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
2166
+ if (typeof firstValue.getMonth === 'function') {
2167
+ return jsx(FilterDateRange, { column: column, table: table });
2168
+ }
2169
+ break;
2170
+ }
2171
+ case 'matchDate': {
2172
+ const firstValue = (_b = table
2173
+ .getPreFilteredRowModel()
2174
+ .flatRows[0]) === null || _b === void 0 ? void 0 : _b.getValue(column.id);
2175
+ if (typeof firstValue.getMonth === 'function') {
2176
+ return jsx(FilterDate, { column: column, table: table });
2177
+ }
2178
+ break;
2179
+ }
2137
2180
  }
2138
- const rowVirtualizer = useVirtual({
2139
- parentRef: tableContainerRef,
2140
- size: rows.length,
2141
- overscan: 10,
2142
- });
2143
- const { virtualItems: virtualRows, totalSize } = rowVirtualizer;
2144
- const paddingTop = virtualRows.length > 0 ? ((_b = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[0]) === null || _b === void 0 ? void 0 : _b.start) || 0 : 0;
2145
- const paddingBottom = virtualRows.length > 0
2146
- ? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
2147
- : 0;
2148
- return (jsxs(Fragment, { children: [jsx(Show, { when: (topRows === null || topRows === void 0 ? void 0 : topRows.length) > 0, children: jsx("thead", { style: {
2149
- position: "sticky",
2150
- top: 0,
2151
- zIndex: 99
2152
- }, children: jsx(For, { each: topRows, children: (row, index) => (jsx(PinnedRow, { row: row, rowSelectionMode: rowSelectionMode, bottomRowLength: bottomRows === null || bottomRows === void 0 ? void 0 : bottomRows.length }, row.id)) }) }) }), jsxs("tbody", { className: styles.tBody, children: [paddingTop > 0 && (jsx("tr", { className: styles.tBodyRow, "aria-hidden": true, children: jsx("td", { style: { height: `${paddingTop}px` } }) })), jsx(For, { each: virtualRows || [], children: (virtualRow) => {
2153
- const row = rows[virtualRow.index];
2154
- return (jsx(TableRow, { row: row, rowSelectionMode: rowSelectionMode }, row.id));
2155
- } }), paddingBottom > 0 && (jsx("tr", { className: styles.tBodyRow, "aria-hidden": true, children: jsx("td", { style: { height: `${paddingBottom}px` } }) }))] }), jsx(Show, { when: rowSelectionMode === 'multiple' && (rows === null || rows === void 0 ? void 0 : rows.length) > 0, children: jsx("tfoot", { style: {
2156
- position: "sticky",
2157
- bottom: 0,
2158
- zIndex: 99
2159
- }, children: jsxs("tr", { style: { backgroundColor: "white" }, children: [jsx("td", { className: "p-1", children: jsx(Checkbox, { checked: table.getIsSomePageRowsSelected()
2160
- ? 'mixed'
2161
- : table.getIsAllPageRowsSelected(), onChange: table.getToggleAllPageRowsSelectedHandler(), "aria-label": "Select All Current Page Rows", title: 'Select All Current Page Rows' }) }), jsxs("td", { colSpan: 20, children: [table.getIsAllPageRowsSelected() ? 'Unselect' : 'Select', " All Current Page Rows (", table.getRowModel().rows.length, ")"] })] }) }) }), jsx(Show, { when: (bottomRows === null || bottomRows === void 0 ? void 0 : bottomRows.length) > 0, children: jsx("tfoot", { style: {
2162
- position: "sticky",
2163
- bottom: 0,
2164
- zIndex: 99
2165
- }, children: jsx(For, { each: bottomRows, children: (row) => (jsx(PinnedRow, { row: row, rowSelectionMode: rowSelectionMode, bottomRowLength: bottomRows === null || bottomRows === void 0 ? void 0 : bottomRows.length }, row.id)) }) }) })] }));
2166
- }
2181
+ return (jsx("div", { className: styles.searchContainer, children: jsx(Field, { size: 'small', className: styles.searchInputField, children: jsx(Input, { value: (column.getFilterValue() || ''), onChange: (_, data) => {
2182
+ column.setFilterValue(data.value);
2183
+ }, placeholder: "Search Keyword...", size: "small", className: styles.searchInput }) }) }));
2184
+ };
2167
2185
 
2168
- const TableContainer = (props) => {
2169
- var _a, _b;
2170
- const styles = useTableStaticStyles();
2171
- const { table } = props;
2172
- const { tableHeight, rowSelectionMode } = table.options.meta || {};
2173
- const tableContainerRef = React.useRef(null);
2174
- const { rows: { length: itemLength } } = table.getRowModel();
2186
+ const useFilterDrawerStyles$1 = makeStyles({
2187
+ drawerBody: Object.assign(Object.assign({}, shorthands.overflow('hidden', 'auto')), {
2188
+ /* width */
2189
+ ':hover': Object.assign({}, shorthands.overflow('auto', 'auto')), '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, shorthands.borderRadius('50%')),
2190
+ /* Track */
2191
+ '::-webkit-scrollbar-track': {
2192
+ 'background-color': '#f1f1f1',
2193
+ },
2194
+ /* Handle */
2195
+ '::-webkit-scrollbar-thumb': {
2196
+ 'background-color': '#888',
2197
+ },
2198
+ /* Handle on hover */
2199
+ '::-webkit-scrollbar-thumb:hover': {
2200
+ 'background-color': '#555',
2201
+ } }),
2202
+ });
2203
+ const FilterDrawer = ({ table }) => {
2175
2204
  const headerGroups = table.getHeaderGroups();
2176
- // utilities
2177
- const isLoading = props.isLoading && itemLength === 0;
2178
- const noItems = !isLoading && ((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) === 0;
2179
- const noSearchResult = !isLoading && ((_b = props === null || props === void 0 ? void 0 : props.data) === null || _b === void 0 ? void 0 : _b.length) > 0 && itemLength === 0;
2180
- return (jsxs("div", { ref: tableContainerRef, className: styles.tableContainer, style: { height: tableHeight }, children: [jsxs("table", { className: styles.table, "aria-label": "Data Grid", style: { width: table.getTotalSize(), minWidth: "100%" }, children: [jsx(TableHeader, { table: table, rowSelectionMode: rowSelectionMode, headerGroups: headerGroups }), jsx(TableBody, { table: table, tableContainerRef: tableContainerRef })] }), jsxs(Switch$1, { when: true, children: [jsx(Case, { value: isLoading, children: jsx(Loading, {}) }), jsx(Case, { value: noItems, children: jsx(NoItemGrid, { message: props.noItemPage }) }), jsx(Case, { value: noSearchResult, children: jsx(NoSearchResult, { message: props.noFilterMatchPage }) })] })] }));
2205
+ const styles = useFilterDrawerStyles$1();
2206
+ const resetAllFilters = React.useCallback(() => {
2207
+ table.setGlobalFilter('');
2208
+ table.resetColumnFilters();
2209
+ }, [table]);
2210
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
2211
+ const { dispatchDrawerAction, drawerState } = table.options.meta;
2212
+ return (jsxs(InlineDrawer, { position: "end", open: drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen, separator: true, children: [jsx(DrawerHeader, { children: jsx(DrawerHeaderTitle, { action: jsx(Button, { appearance: "subtle", "aria-label": "Close", icon: jsx(Dismiss24Regular, {}), onClick: () => dispatchDrawerAction === null || dispatchDrawerAction === void 0 ? void 0 : dispatchDrawerAction({ type: "CLOSE_FILTER_DRAWER" }) }), children: "Column Filters" }) }), jsx(DrawerBody, { className: styles.drawerBody, children: jsx(Accordion, { multiple: true, collapsible: true, children: headerGroups.map((headerGroup) => {
2213
+ const canApplyFilter = headerGroup.depth === (headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.length) - 1;
2214
+ if (!canApplyFilter)
2215
+ return null;
2216
+ return headerGroup.headers.map((header) => {
2217
+ const canFilter = header.column.getCanFilter();
2218
+ if (!canFilter)
2219
+ return null;
2220
+ return (jsx(Show, { when: header.column.getCanFilter(), children: jsxs(AccordionItem, { value: header.column.id, children: [jsx(AccordionHeader, { expandIconPosition: 'end', children: jsxs(Caption1Stronger, { children: ["Filter by", ' ', flexRender(header.column.columnDef.header, header.getContext())] }) }), jsx(AccordionPanel, { children: jsx(Filter, { column: header.column, table: table }) })] }, header.column.id) }, header.column.id));
2221
+ });
2222
+ }) }) }), jsx(DrawerFooter, { children: jsx(Button, { icon: jsx(ClearFilterIcon, {}), onClick: resetAllFilters, style: { width: "100%" }, children: "Clear All Filters" }) })] }));
2181
2223
  };
2182
2224
 
2183
2225
  const ViewSaveForm = (props) => {
@@ -2239,14 +2281,16 @@ const useFilterDrawerStyles = makeStyles({
2239
2281
  } }),
2240
2282
  });
2241
2283
  const ViewsDrawer = (props) => {
2242
- const { table, drawerState, dispatch, tableViews, applyTableState, resetToGridDefaultView } = props;
2284
+ const { table, tableViews, applyTableState, resetToGridDefaultView } = props;
2285
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
2286
+ const { dispatchDrawerAction, drawerState } = table.options.meta;
2243
2287
  const { onTableViewDelete, onTableViewSave } = table.options.meta || {};
2244
2288
  const [checkedValues, setCheckedValues] = React.useState({ font: ["calibri"] });
2245
2289
  const onChange = (e, { name, checkedItems }) => {
2246
2290
  setCheckedValues((s) => (Object.assign(Object.assign({}, s), { [name]: checkedItems })));
2247
2291
  };
2248
2292
  const styles = useFilterDrawerStyles();
2249
- return (jsxs(InlineDrawer, { position: "end", open: drawerState.isViewsDrawerOpen, separator: true, children: [jsx(DrawerHeader, { children: jsx(DrawerHeaderTitle, { action: jsx(Button, { appearance: "subtle", "aria-label": "Close", icon: jsx(Dismiss24Regular, {}), onClick: () => dispatch({ type: "CLOSE_VIEW_DRAWER" }) }), children: "Table Views" }) }), jsxs(DrawerBody, { className: styles.drawerBody, children: [onTableViewSave && jsx(ViewSaveForm, { mode: 'create', getTableState: table.getState, onSave: onTableViewSave }), jsxs(MenuList, { checkedValues: checkedValues, onCheckedValueChange: onChange, children: [jsx(MenuItemRadio, { name: 'table-views', value: 'Default View', icon: jsx(ViewDesktop20Filled, {}), onClick: resetToGridDefaultView, children: "Default View" }), tableViews.length > 0 && jsx(MenuDivider, { children: "Additional Views" }), tableViews.map((view) => {
2293
+ return (jsxs(InlineDrawer, { position: "end", open: drawerState.isViewsDrawerOpen, separator: true, children: [jsx(DrawerHeader, { children: jsx(DrawerHeaderTitle, { action: jsx(Button, { appearance: "subtle", "aria-label": "Close", icon: jsx(Dismiss24Regular, {}), onClick: () => dispatchDrawerAction === null || dispatchDrawerAction === void 0 ? void 0 : dispatchDrawerAction({ type: "CLOSE_VIEW_DRAWER" }) }), children: "Table Views" }) }), jsxs(DrawerBody, { className: styles.drawerBody, children: [onTableViewSave && jsx(ViewSaveForm, { mode: 'create', getTableState: table.getState, onSave: onTableViewSave }), jsxs(MenuList, { checkedValues: checkedValues, onCheckedValueChange: onChange, children: [jsx(MenuItemRadio, { name: 'table-views', value: 'Default View', icon: jsx(ViewDesktop20Filled, {}), onClick: resetToGridDefaultView, children: "Default View" }), tableViews.length > 0 && jsx(MenuDivider, { children: "Additional Views" }), tableViews.map((view) => {
2250
2294
  return (jsxs("div", { style: {
2251
2295
  display: 'flex',
2252
2296
  justifyContent: 'space-between',
@@ -2256,41 +2300,9 @@ const ViewsDrawer = (props) => {
2256
2300
  })] })] }), jsx(DrawerFooter, { children: jsxs(MenuList, { children: [jsx(MenuDivider, {}), jsx(MenuItem, { icon: jsx(ClearFilterIcon, {}), onClick: resetToGridDefaultView, children: "Reset to Default View" })] }) })] }));
2257
2301
  };
2258
2302
 
2259
- const TableActions = {
2260
- TOGGLE_FILTER_DRAWER: 'TOGGLE_FILTER_DRAWER',
2261
- TOGGLE_VIEW_DRAWER: 'TOGGLE_VIEW_DRAWER',
2262
- OPEN_FILTER_DRAWER: 'OPEN_FILTER_DRAWER',
2263
- OPEN_VIEW_DRAWER: 'OPEN_VIEW_DRAWER',
2264
- CLOSE_FILTER_DRAWER: 'CLOSE_FILTER_DRAWER',
2265
- CLOSE_VIEW_DRAWER: 'CLOSE_VIEW_DRAWER',
2266
- };
2267
- // write a reducer function to handle the state of the table
2268
- function tableReducer(state, action) {
2269
- switch (action.type) {
2270
- case TableActions.TOGGLE_FILTER_DRAWER:
2271
- return Object.assign(Object.assign({}, state), { isFilterDrawerOpen: !state.isFilterDrawerOpen });
2272
- case TableActions.TOGGLE_VIEW_DRAWER:
2273
- return Object.assign(Object.assign({}, state), { isViewsDrawerOpen: !state.isViewsDrawerOpen });
2274
- case TableActions.OPEN_FILTER_DRAWER:
2275
- return Object.assign(Object.assign({}, state), { isFilterDrawerOpen: true });
2276
- case TableActions.OPEN_VIEW_DRAWER:
2277
- return Object.assign(Object.assign({}, state), { isViewsDrawerOpen: true });
2278
- case TableActions.CLOSE_FILTER_DRAWER:
2279
- return Object.assign(Object.assign({}, state), { isFilterDrawerOpen: false });
2280
- case TableActions.CLOSE_VIEW_DRAWER:
2281
- return Object.assign(Object.assign({}, state), { isViewsDrawerOpen: false });
2282
- default:
2283
- return state;
2284
- }
2285
- }
2286
-
2287
2303
  function AdvancedTable(props, ref) {
2288
2304
  useStaticStyles();
2289
2305
  const { table, globalFilter, headerMenu, tableViews, setGlobalFilter, resetToDefaultView, applyTableState } = useGridContainer(props, ref);
2290
- const [drawerState, dispatch] = React.useReducer(tableReducer, {
2291
- isFilterDrawerOpen: false,
2292
- isViewsDrawerOpen: false
2293
- });
2294
2306
  const { getState, setColumnOrder } = table;
2295
2307
  const { columnOrder } = getState();
2296
2308
  function handleDragEnd(event) {
@@ -2305,14 +2317,14 @@ function AdvancedTable(props, ref) {
2305
2317
  }
2306
2318
  const pointerSensor = useSensor(PointerSensor, {
2307
2319
  activationConstraint: {
2308
- distance: 0.01
2320
+ distance: 0.0001
2309
2321
  }
2310
2322
  });
2311
2323
  const mouseSensor = useSensor(MouseSensor);
2312
2324
  const touchSensor = useSensor(TouchSensor);
2313
2325
  const keyboardSensor = useSensor(KeyboardSensor);
2314
2326
  const sensors = useSensors(mouseSensor, touchSensor, keyboardSensor, pointerSensor);
2315
- return (jsx(DndContext, { collisionDetection: closestCenter, modifiers: [restrictToHorizontalAxis], onDragEnd: handleDragEnd, sensors: sensors, children: jsxs(SortableContext, { items: columnOrder, strategy: horizontalListSortingStrategy, children: [jsx(Show, { when: !props.disableTableHeader, children: jsx(GridHeader, { table: table, gridTitle: props.gridTitle, headerMenu: headerMenu, globalFilter: globalFilter, setGlobalFilter: setGlobalFilter, applyTableState: applyTableState, drawerState: drawerState, dispatch: dispatch }) }), jsxs("div", { style: { display: 'flex' }, children: [jsx(TableContainer, { table: table, data: props.data, isLoading: props.isLoading || false, noFilterMatchPage: props.noFilterMatchPage, noItemPage: props.noItemPage }), jsx(FilterDrawer, { drawerState: drawerState, dispatch: dispatch, table: table }), jsx(ViewsDrawer, { table: table, drawerState: drawerState, dispatch: dispatch, tableViews: tableViews, applyTableState: applyTableState, resetToGridDefaultView: resetToDefaultView })] }), jsx(Pagination, { table: table })] }) }));
2327
+ return (jsx(DndContext, { collisionDetection: closestCenter, modifiers: [restrictToHorizontalAxis], onDragEnd: handleDragEnd, sensors: sensors, children: jsxs(SortableContext, { items: columnOrder, strategy: horizontalListSortingStrategy, children: [jsx(Show, { when: !props.disableTableHeader, children: jsx(GridHeader, { table: table, gridTitle: props.gridTitle, headerMenu: headerMenu, globalFilter: globalFilter, setGlobalFilter: setGlobalFilter, applyTableState: applyTableState }) }), jsxs("div", { style: { display: 'flex' }, children: [jsx(TableContainer, { table: table, data: props.data, isLoading: props.isLoading || false, noFilterMatchPage: props.noFilterMatchPage, noItemPage: props.noItemPage }), jsx(FilterDrawer, { table: table }), jsx(ViewsDrawer, { table: table, tableViews: tableViews, applyTableState: applyTableState, resetToGridDefaultView: resetToDefaultView })] }), jsx(Pagination, { table: table })] }) }));
2316
2328
  }
2317
2329
  const ForwardedAdvancedTable = React.forwardRef(AdvancedTable);
2318
2330