@prt-ts/fluent-react-table-v2 9.46.8-build.6.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,14 +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, 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';
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
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 { useVirtual } from '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';
10
+ import { useVirtual } from 'react-virtual';
11
+ import { DatePicker } from '@fluentui/react-datepicker-compat';
12
12
  import { useSensor, PointerSensor, MouseSensor, TouchSensor, KeyboardSensor, useSensors, DndContext, closestCenter } from '@dnd-kit/core';
13
13
  import { restrictToHorizontalAxis } from '@dnd-kit/modifiers';
14
14
 
@@ -985,6 +985,7 @@ const ArrowNextFilled = /*#__PURE__*/createFluentIcon('ArrowNextFilled', "1em",
985
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"], {
986
986
  flipInRtl: true
987
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"]);
988
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"]);
989
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"]);
990
991
 
@@ -996,6 +997,8 @@ const ColumnEditFilled = /*#__PURE__*/createFluentIcon('ColumnEditFilled', "1em"
996
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"]);
997
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"]);
998
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"]);
999
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"]);
1000
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"]);
1001
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"]);
@@ -1004,6 +1007,8 @@ const GroupFilled = /*#__PURE__*/createFluentIcon('GroupFilled', "1em", ["M7 4.5
1004
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"]);
1005
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"]);
1006
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"]);
1007
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"]);
1008
1013
 
1009
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"]);
@@ -1017,6 +1022,7 @@ const SearchRegular = /*#__PURE__*/createFluentIcon('SearchRegular', "1em", ["M8
1017
1022
 
1018
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"]);
1019
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"]);
1020
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"]);
1021
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"]);
1022
1028
 
@@ -1143,7 +1149,9 @@ const useGridHeaderStyles = makeStyles({
1143
1149
  });
1144
1150
 
1145
1151
  const GridHeader = (props) => {
1146
- 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;
1147
1155
  const styles = useGridHeaderStyles();
1148
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) => {
1149
1157
  if (column.id === 'select')
@@ -1156,8 +1164,8 @@ const GridHeader = (props) => {
1156
1164
  return null;
1157
1165
  return (jsx(Checkbox, { checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler(), label: column.id, disabled: !column.getCanHide() }, column.id));
1158
1166
  })] }) })] }), jsx(Tooltip, { content: 'Table Views Management', relationship: "label", children: jsx(Button, { onClick: () => {
1159
- dispatch({ type: "TOGGLE_VIEW_DRAWER" });
1160
- }, 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 })] })] }));
1161
1169
  };
1162
1170
  // A debounced input react component
1163
1171
  function DebouncedInput({ value: initialValue, onChange, debounce = 500, drawerState, dispatch, }) {
@@ -1171,8 +1179,8 @@ function DebouncedInput({ value: initialValue, onChange, debounce = 500, drawerS
1171
1179
  }, debounce);
1172
1180
  return () => clearTimeout(timeout);
1173
1181
  }, [value, onChange, debounce]);
1174
- 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: () => {
1175
- 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" });
1176
1184
  } }) }) }));
1177
1185
  }
1178
1186
 
@@ -1234,9 +1242,41 @@ const getLeafColumns = (columns) => {
1234
1242
  }, []);
1235
1243
  };
1236
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
+
1237
1273
  const useGridContainer = (props, ref) => {
1238
1274
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1239
1275
  const { defaultColumn, columns, data, rowSelectionMode, autoResetPageIndex, onUpdateData } = props;
1276
+ const [drawerState, dispatch] = React.useReducer(tableReducer, {
1277
+ isFilterDrawerOpen: false,
1278
+ isViewsDrawerOpen: false
1279
+ });
1240
1280
  const [pagination, setPagination] = React.useState({
1241
1281
  pageSize: props.pageSize || 10,
1242
1282
  pageIndex: 0,
@@ -1327,7 +1367,22 @@ const useGridContainer = (props, ref) => {
1327
1367
  tableHeight: props.tableHeight || "650px",
1328
1368
  updateData: onUpdateData,
1329
1369
  onTableViewDelete: props.onTableViewDelete,
1330
- 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
1331
1386
  }
1332
1387
  });
1333
1388
  const tableViews = React.useMemo(() => { var _a; return (_a = props.views) !== null && _a !== void 0 ? _a : []; }, [props.views]);
@@ -1481,120 +1536,365 @@ const useTableHeaderStyles = makeStyles({
1481
1536
  },
1482
1537
  });
1483
1538
 
1484
- const useCheckboxFilterStyles = makeStyles({
1485
- searchInput: {
1486
- width: '90%',
1487
- marginBottom: '8px',
1488
- marginLeft: '10px',
1489
- marginRight: '10px',
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, }) {
1568
+ var _a;
1569
+ const { column } = header;
1570
+ const { isDragging, attributes, listeners, setNodeRef, transform, transition, } = useSortable({
1571
+ id: column.id
1572
+ });
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())
1593
+ return;
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
+ }
1650
+
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,
1490
1670
  },
1491
- 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%')),
1492
- /* Track */
1493
- '::-webkit-scrollbar-track': {
1494
- 'background-color': '#f1f1f1',
1495
- },
1496
- /* Handle */
1497
- '::-webkit-scrollbar-thumb': {
1498
- 'background-color': '#888',
1499
- },
1500
- /* Handle on hover */
1501
- '::-webkit-scrollbar-thumb:hover': {
1502
- 'background-color': '#555',
1503
- } }),
1671
+ row: Object.assign(Object.assign({ alignItems: "center", display: "grid", paddingBottom: "10px", position: "relative" }, shorthands.gap("10px")), { gridTemplateColumns: "min-content 20% 15% 30% 29%" }),
1504
1672
  });
1505
- const FilterMultiSelectCheckbox = ({ column, table, }) => {
1506
- var _a, _b, _c;
1507
- const firstValue = (_a = table
1508
- .getPreFilteredRowModel()
1509
- .flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
1510
- const columnFilterValue = column.getFilterValue();
1511
- const [filterOptions, setFilterOptions] = React.useState([]);
1512
- React.useEffect(() => {
1513
- const uniqueSortedOptions = typeof firstValue === 'number' || !isNaN(firstValue)
1514
- ? Array.from(column.getFacetedUniqueValues().keys()).sort((a, b) => Number(a) - Number(b))
1515
- : Array.from(column.getFacetedUniqueValues().keys()).sort();
1516
- setFilterOptions(uniqueSortedOptions);
1517
- },
1518
- // eslint-disable-next-line react-hooks/exhaustive-deps
1519
- [column.getFacetedUniqueValues()]);
1520
- const [localColumnFilterValue, setLocalColumnFilterValue] = React.useState('');
1521
- const filterOptionsFiltered = React.useMemo(() => {
1522
- if (!localColumnFilterValue)
1523
- return filterOptions;
1524
- return filterOptions.filter((option) => {
1525
- var _a, _b, _c;
1526
- 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());
1527
- });
1528
- }, [localColumnFilterValue, filterOptions]);
1529
- const filterContainer = React.useRef(null);
1530
- const rowVirtualizer = useVirtual({
1531
- parentRef: filterContainer,
1532
- size: filterOptionsFiltered.length,
1533
- overscan: 15,
1534
- });
1535
- const { virtualItems: virtualRows, totalSize } = rowVirtualizer;
1536
- 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;
1537
- const paddingBottom = virtualRows.length > 0
1538
- ? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
1539
- : 0;
1540
- const allOptionChecked = (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) > 0 &&
1541
- (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) !== (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length)
1542
- ? 'mixed'
1543
- : (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) === (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) &&
1544
- (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) > 0;
1545
- const styles = useCheckboxFilterStyles();
1546
- 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: () => {
1547
- if ((columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) > 0) {
1548
- column.setFilterValue(undefined);
1549
- return;
1550
- }
1551
- column.setFilterValue([
1552
- ...((filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.map((x) => `${x}`)) || []),
1553
- ]);
1554
- }, label: '(Toggle All)' }, `toggle-all-${column.id}`), virtualRows.map((row) => {
1555
- var _a;
1556
- const value = `${filterOptionsFiltered[row.index]}`;
1557
- return (jsx(Checkbox, { checked: (_a = columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) !== null && _a !== void 0 ? _a : false, onChange: () => {
1558
- if (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) {
1559
- column.setFilterValue((old) => old === null || old === void 0 ? void 0 : old.filter((v) => v !== value));
1560
- return;
1561
- }
1562
- column.setFilterValue((old) => [
1563
- ...(old || []),
1564
- value,
1565
- ]);
1566
- }, label: value }, `${column.id}-${row.index}`));
1567
- }), paddingBottom > 0 && (jsx("span", { style: { paddingBottom: `${paddingBottom}px` } }))] }, 'filter-multi-select-checkbox')] }));
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))) }) }));
1568
1683
  };
1569
1684
 
1570
- const useRadioFilterStyles = makeStyles({
1571
- searchInput: {
1572
- width: '90%',
1573
- marginBottom: '8px',
1574
- marginLeft: '10px',
1575
- marginRight: '10px',
1576
- },
1577
- 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%')),
1578
- /* Track */
1579
- '::-webkit-scrollbar-track': {
1580
- 'background-color': '#f1f1f1',
1581
- },
1582
- /* Handle */
1583
- '::-webkit-scrollbar-thumb': {
1584
- 'background-color': '#888',
1585
- },
1586
- /* Handle on hover */
1587
- '::-webkit-scrollbar-thumb:hover': {
1588
- 'background-color': '#555',
1589
- } }),
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",
1693
+ }
1590
1694
  });
1591
- const FilterSelectRadio = ({ column, table, }) => {
1592
- var _a, _b, _c;
1593
- const firstValue = (_a = table
1594
- .getPreFilteredRowModel()
1595
- .flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
1596
- const columnFilterValue = column.getFilterValue();
1597
- const [filterOptions, setFilterOptions] = React.useState([]);
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
1770
+ };
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 }) })] })] }));
1868
+ };
1869
+
1870
+ const useCheckboxFilterStyles = makeStyles({
1871
+ searchInput: {
1872
+ width: '90%',
1873
+ marginBottom: '8px',
1874
+ marginLeft: '10px',
1875
+ marginRight: '10px',
1876
+ },
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([]);
1598
1898
  React.useEffect(() => {
1599
1899
  const uniqueSortedOptions = typeof firstValue === 'number' || !isNaN(firstValue)
1600
1900
  ? Array.from(column.getFacetedUniqueValues().keys()).sort((a, b) => Number(a) - Number(b))
@@ -1623,42 +1923,128 @@ const FilterSelectRadio = ({ column, table, }) => {
1623
1923
  const paddingBottom = virtualRows.length > 0
1624
1924
  ? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
1625
1925
  : 0;
1626
- const styles = useRadioFilterStyles();
1627
- 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) => {
1628
- if (data.value === '') {
1629
- column.setFilterValue([]);
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);
1630
1935
  return;
1631
1936
  }
1632
- column.setFilterValue([data.value]);
1633
- }, children: [jsx(Radio, { value: '', label: 'None' }), virtualRows.map((row) => {
1634
- const value = filterOptionsFiltered[row.index];
1635
- return jsx(Radio, { value: value, label: value }, value);
1636
- })] }), paddingBottom > 0 && (jsx("div", { style: { paddingBottom: `${paddingBottom}px` } }))] })] }));
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')] }));
1637
1954
  };
1638
1955
 
1639
- const useNumberRangeFilterStyles$2 = makeStyles({
1956
+ const useRadioFilterStyles = makeStyles({
1640
1957
  searchInput: {
1641
- width: '100%',
1642
- },
1643
- searchInputField: {
1644
- width: '100%',
1645
- flexGrow: 1,
1646
- },
1647
- searchContainer: {
1648
- display: 'flex',
1958
+ width: '90%',
1649
1959
  marginBottom: '8px',
1650
1960
  marginLeft: '10px',
1651
1961
  marginRight: '10px',
1652
- }
1653
- });
1654
- const FilterNumberRange = (props) => {
1655
- var _a, _b, _c, _d, _e, _f, _g, _h;
1656
- const { column } = props;
1657
- const columnFilterValue = column.getFilterValue();
1658
- const min = Number((_b = (_a = column.getFacetedMinMaxValues()) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '');
1659
- const max = Number((_d = (_c = column.getFacetedMinMaxValues()) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : '');
1660
- const handleMinChange = (e, data) => {
1661
- const value = Number(data.value);
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
+ } }),
1976
+ });
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);
1982
+ const columnFilterValue = column.getFilterValue();
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` } }))] })] }));
2023
+ };
2024
+
2025
+ const useNumberRangeFilterStyles$2 = makeStyles({
2026
+ searchInput: {
2027
+ width: '100%',
2028
+ },
2029
+ searchInputField: {
2030
+ width: '100%',
2031
+ flexGrow: 1,
2032
+ },
2033
+ searchContainer: {
2034
+ display: 'flex',
2035
+ marginBottom: '8px',
2036
+ marginLeft: '10px',
2037
+ marginRight: '10px',
2038
+ }
2039
+ });
2040
+ const FilterNumberRange = (props) => {
2041
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2042
+ const { column } = props;
2043
+ const columnFilterValue = column.getFilterValue();
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);
1662
2048
  column.setFilterValue((old) => [value, old === null || old === void 0 ? void 0 : old[1]]);
1663
2049
  };
1664
2050
  const handleMaxChange = (e, data) => {
@@ -1707,476 +2093,133 @@ const FilterDateRange = (props) => {
1707
2093
  column.setFilterValue((old) => [old === null || old === void 0 ? void 0 : old[0], undefined]);
1708
2094
  return;
1709
2095
  }
1710
- column.setFilterValue((old) => [old === null || old === void 0 ? void 0 : old[0], date]);
1711
- };
1712
- const styles = useNumberRangeFilterStyles$1();
1713
- 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 }) })] }));
1714
- };
1715
-
1716
- const useNumberRangeFilterStyles = makeStyles({
1717
- searchInput: {
1718
- width: '100%',
1719
- },
1720
- searchInputField: {
1721
- width: '100%',
1722
- flexGrow: 1,
1723
- },
1724
- searchContainer: {
1725
- display: 'flex',
1726
- flexDirection: 'column',
1727
- marginBottom: '8px',
1728
- marginLeft: '10px',
1729
- marginRight: '10px',
1730
- },
1731
- });
1732
- const FilterDate = (props) => {
1733
- var _a, _b, _c, _d;
1734
- const { column } = props;
1735
- const columnFilterValue = column.getFilterValue();
1736
- const min = (_b = (_a = column.getFacetedMinMaxValues()) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : undefined;
1737
- const max = (_d = (_c = column.getFacetedMinMaxValues()) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : undefined;
1738
- const onDateSelect = (date) => {
1739
- if (!date) {
1740
- column.setFilterValue(undefined);
1741
- return;
1742
- }
1743
- column.setFilterValue(date);
1744
- };
1745
- const styles = useNumberRangeFilterStyles();
1746
- 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 }) }));
1747
- };
1748
-
1749
- const useFilterStyles = makeStyles({
1750
- searchInput: {
1751
- width: '100%',
1752
- },
1753
- searchInputField: {
1754
- width: '100%',
1755
- flexGrow: 1,
1756
- },
1757
- searchContainer: {
1758
- display: 'flex',
1759
- marginBottom: '8px',
1760
- marginLeft: '10px',
1761
- marginRight: '10px',
1762
- },
1763
- });
1764
- const Filter = ({ column, table, }) => {
1765
- var _a, _b;
1766
- const filterFunctionName = column.columnDef.filterFn;
1767
- const styles = useFilterStyles();
1768
- switch (filterFunctionName) {
1769
- case 'arrIncludesSome':
1770
- return jsx(FilterMultiSelectCheckbox, { column: column, table: table });
1771
- case 'arrIncludesAll':
1772
- case 'arrIncludes':
1773
- return jsx(FilterSelectRadio, { column: column, table: table });
1774
- case 'inNumberRange':
1775
- return jsx(FilterNumberRange, { column: column, table: table });
1776
- case 'inDateRange': {
1777
- const firstValue = (_a = table
1778
- .getPreFilteredRowModel()
1779
- .flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
1780
- if (typeof firstValue.getMonth === 'function') {
1781
- return jsx(FilterDateRange, { column: column, table: table });
1782
- }
1783
- break;
1784
- }
1785
- case 'matchDate': {
1786
- const firstValue = (_b = table
1787
- .getPreFilteredRowModel()
1788
- .flatRows[0]) === null || _b === void 0 ? void 0 : _b.getValue(column.id);
1789
- if (typeof firstValue.getMonth === 'function') {
1790
- return jsx(FilterDate, { column: column, table: table });
1791
- }
1792
- break;
1793
- }
1794
- }
1795
- return (jsx("div", { className: styles.searchContainer, children: jsx(Field, { size: 'small', className: styles.searchInputField, children: jsx(Input, { value: (column.getFilterValue() || ''), onChange: (_, data) => {
1796
- column.setFilterValue(data.value);
1797
- }, placeholder: "Search Keyword...", size: "small", className: styles.searchInput }) }) }));
1798
- };
1799
-
1800
- const useFilterDrawerStyles$1 = makeStyles({
1801
- drawerBody: Object.assign(Object.assign({}, shorthands.overflow('hidden', 'auto')), {
1802
- /* width */
1803
- ':hover': Object.assign({}, shorthands.overflow('auto', 'auto')), '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, shorthands.borderRadius('50%')),
1804
- /* Track */
1805
- '::-webkit-scrollbar-track': {
1806
- 'background-color': '#f1f1f1',
1807
- },
1808
- /* Handle */
1809
- '::-webkit-scrollbar-thumb': {
1810
- 'background-color': '#888',
1811
- },
1812
- /* Handle on hover */
1813
- '::-webkit-scrollbar-thumb:hover': {
1814
- 'background-color': '#555',
1815
- } }),
1816
- });
1817
- const FilterDrawer = ({ drawerState, dispatch, table }) => {
1818
- const headerGroups = table.getHeaderGroups();
1819
- const styles = useFilterDrawerStyles$1();
1820
- const resetAllFilters = React.useCallback(() => {
1821
- table.setGlobalFilter('');
1822
- table.resetColumnFilters();
1823
- }, [table]);
1824
- 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) => {
1825
- const canApplyFilter = headerGroup.depth === (headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.length) - 1;
1826
- if (!canApplyFilter)
1827
- return null;
1828
- return headerGroup.headers.map((header) => {
1829
- const canFilter = header.column.getCanFilter();
1830
- if (!canFilter)
1831
- return null;
1832
- 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));
1833
- });
1834
- }) }) }), jsx(DrawerFooter, { children: jsx(Button, { icon: jsx(ClearFilterIcon, {}), onClick: resetAllFilters, style: { width: "100%" }, children: "Clear All Filters" }) })] }));
1835
- };
1836
-
1837
- const getHeaderCellPinningStyles = (column) => {
1838
- const isPinned = column.getIsPinned();
1839
- const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
1840
- const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
1841
- const styles = {
1842
- boxShadow: isLastLeftPinnedColumn
1843
- ? '-4px 0 4px -4px gray inset'
1844
- : isFirstRightPinnedColumn
1845
- ? '4px 0 4px -4px gray inset'
1846
- : undefined,
1847
- left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined,
1848
- right: isPinned === 'right' ? `${column.getAfter('right')}px` : undefined,
1849
- opacity: isPinned ? 0.95 : 1,
1850
- position: isPinned ? 'sticky' : 'relative',
1851
- width: column.getSize(),
1852
- zIndex: isPinned ? 99 : 1,
1853
- backgroundColor: tokens.colorNeutralCardBackgroundSelected,
1854
- };
1855
- return styles;
1856
- };
1857
- const getBodyCellPinningStyles = (column) => {
1858
- const isPinned = column.getIsPinned();
1859
- const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
1860
- const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
1861
- const styles = {
1862
- boxShadow: isLastLeftPinnedColumn
1863
- ? '-4px 0 4px -4px gray inset'
1864
- : isFirstRightPinnedColumn
1865
- ? '4px 0 4px -4px gray inset'
1866
- : undefined,
1867
- left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined,
1868
- right: isPinned === 'right' ? `${column.getAfter('right')}px` : undefined,
1869
- opacity: isPinned ? 0.95 : 1,
1870
- position: isPinned ? 'sticky' : 'relative',
1871
- width: column.getSize(),
1872
- zIndex: isPinned ? 1 : 0,
1873
- };
1874
- return styles;
1875
- };
1876
-
1877
- const SortAscIcon = bundleIcon$1(ArrowSortDown20Filled, ArrowSortDown20Regular);
1878
- const SortDescIcon = bundleIcon$1(ArrowSortUp20Filled, ArrowSortUp20Regular);
1879
- const PinIcon = bundleIcon$1(PinFilled, PinRegular);
1880
- function HeaderCell({ header, table, hideMenu, headerDepth, totalNumberOfHeaderDepth, }) {
1881
- var _a;
1882
- const { column } = header;
1883
- const { isDragging, attributes, listeners, setNodeRef, transform, transition, } = useSortable({
1884
- id: column.id
1885
- });
1886
- const dndStyle = {
1887
- width: header.column.getSize(),
1888
- opacity: isDragging ? 0.8 : 1,
1889
- // position: isDragging ? 'relative' : "sticky",
1890
- transform: CSS.Translate.toString(transform), // translate instead of transform to avoid squishing
1891
- // transition: 'width transform 0.2s ease-in-out',
1892
- whiteSpace: 'wrap',
1893
- zIndex: isDragging ? 100 : 99,
1894
- transition
1895
- };
1896
- const styles = useTableHeaderStyles();
1897
- const isLeafHeaders = headerDepth === totalNumberOfHeaderDepth;
1898
- if (header.isPlaceholder) {
1899
- 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) }) }) }));
1900
- }
1901
- 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
1902
- ? styles.tLeafHeadCellContent
1903
- : styles.tNonLeafHeadCellContent, children: [jsx("div", { children: jsx(Show, { when: !header.isPlaceholder, children: jsxs(Button, { style: {
1904
- display: 'flex',
1905
- alignItems: 'center',
1906
- justifyContent: 'left',
1907
- flex: 1,
1908
- }, onClick: (e) => {
1909
- if (!header.column.getCanSort())
1910
- return;
1911
- header.column.toggleSorting(header.column.getIsSorted() === 'asc', e.ctrlKey);
1912
- }, onDoubleClick: () => {
1913
- if (!header.column.getCanGroup())
1914
- return;
1915
- header.column.getToggleGroupingHandler()();
1916
- }, appearance: "transparent", className: styles.tHeadContentBtn, icon: (_a = {
1917
- asc: (jsx("strong", { children: jsx(SortAscIcon, {}) })),
1918
- desc: (jsx("strong", { children: jsx(SortDescIcon, {}) })),
1919
- }[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 }) })] }));
1920
- }
1921
- function HeaderMenu(props) {
1922
- const { header, table, hideMenu } = props;
1923
- const styles = useTableHeaderStyles();
1924
- if (hideMenu || header.isPlaceholder)
1925
- return (jsx(Fragment, { children: " " }));
1926
- const canHavePopOver = header.column.getCanSort() ||
1927
- header.column.getCanGroup() ||
1928
- header.column.getCanFilter();
1929
- if (!canHavePopOver)
1930
- return (jsx(Fragment, { children: " " }));
1931
- 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) => {
1932
- var _a;
1933
- const isControlKeySelected = e.ctrlKey;
1934
- (_a = header.column) === null || _a === void 0 ? void 0 : _a.toggleSorting(false, isControlKeySelected);
1935
- }, icon: jsx(TextSortAscendingFilled, {}), disabled: header.column.getIsSorted() === 'asc', children: "Sort A to Z" }), jsx(MenuItem, { onClick: (e) => {
1936
- var _a;
1937
- const isControlKeySelected = e.ctrlKey;
1938
- (_a = header.column) === null || _a === void 0 ? void 0 : _a.toggleSorting(true, isControlKeySelected);
1939
- }, 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: () => {
1940
- var _a;
1941
- (_a = header.column) === null || _a === void 0 ? void 0 : _a.pin(false);
1942
- }, icon: jsx(PinOffRegular, {}), children: "No Pin" }) }), jsx(MenuItem, { onClick: () => {
1943
- var _a;
1944
- (_a = header.column) === null || _a === void 0 ? void 0 : _a.pin('left');
1945
- }, icon: jsx(ArrowStepInLeftRegular, {}), disabled: header.column.getIsPinned() === 'left', children: "Pin Left" }), jsx(MenuItem, { onClick: () => {
1946
- var _a;
1947
- (_a = header.column) === null || _a === void 0 ? void 0 : _a.pin('right');
1948
- }, 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') })] }) })] }));
1949
- }
1950
-
1951
- function HeaderRow(props) {
1952
- const styles = useTableHeaderStyles();
1953
- const { table, headerGroup, rowSelectionMode, headerGroupsLength } = props;
1954
- 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()
1955
- ? 'mixed'
1956
- : 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) => {
1957
- return (jsx(HeaderCell, { header: header, table: table, hideMenu: headerGroup.depth !== headerGroupsLength - 1, headerDepth: headerGroup.depth, totalNumberOfHeaderDepth: headerGroupsLength - 1 }, header.id));
1958
- })] }, headerGroup.id));
1959
- }
1960
-
1961
- function TableHeader(props) {
1962
- const styles = useTableHeaderStyles();
1963
- const { table, headerGroups, rowSelectionMode } = props;
1964
- 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))) }));
1965
- }
1966
-
1967
- const useLoadingStyles = makeStyles({
1968
- invertedWrapper: {
1969
- backgroundColor: tokens.colorNeutralBackground1,
1970
- },
1971
- row: Object.assign(Object.assign({ alignItems: "center", display: "grid", paddingBottom: "10px", position: "relative" }, shorthands.gap("10px")), { gridTemplateColumns: "min-content 20% 15% 30% 29%" }),
1972
- });
1973
-
1974
- const Loading = (props) => {
1975
- const { numberOfItems = 16, numberOfColumns = 5 } = props;
1976
- const styles = useLoadingStyles();
1977
- return (jsx("div", { className: styles.invertedWrapper, children: jsx(Skeleton, { children: [...Array(numberOfItems)].map((_, i) => (jsx("div", { className: styles.row, children: [...Array(numberOfColumns)].map((_, i) => {
1978
- if (i === 0) {
1979
- return jsx(SkeletonItem, { shape: "circle", size: 24 }, i);
1980
- }
1981
- return jsx(SkeletonItem, { size: 16 }, i);
1982
- }) }, i))) }) }));
1983
- };
1984
-
1985
- const useNoItemGridStyles = makeStyles({
1986
- wrapper: {
1987
- backgroundColor: tokens.colorNeutralBackground1,
1988
- display: "flex",
1989
- flexWrap: "wrap",
1990
- alignContent: "center",
1991
- justifyContent: "center",
1992
- minHeight: "300px",
1993
- }
1994
- });
1995
-
1996
- const NoItemGrid = ({ message }) => {
1997
- const styles = useNoItemGridStyles();
1998
- return (jsx("div", { className: styles.wrapper, children: jsx("div", { children: message ? message : jsx(Subtitle2Stronger, { children: "No Data to Show." }) }) }));
1999
- };
2000
-
2001
- const useNoFilterMatchStyles = makeStyles({
2002
- wrapper: {
2003
- backgroundColor: tokens.colorNeutralBackground1,
2004
- display: "flex",
2005
- flexDirection: "column",
2006
- flexWrap: "wrap",
2007
- alignContent: "center",
2008
- justifyContent: "center",
2009
- minHeight: "300px",
2010
- },
2011
- iconWrapper: {
2012
- display: "flex",
2013
- flexWrap: "wrap",
2014
- alignContent: "center",
2015
- justifyContent: "center",
2016
- }
2017
- });
2018
-
2019
- const NoSearchResult = ({ message }) => {
2020
- const styles = useNoFilterMatchStyles();
2021
- 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." }) })] }));
2022
- };
2023
-
2024
- const useTableBodyStyles = makeStyles({
2025
- tBody: Object.assign(Object.assign({}, shorthands.padding("0px", "0px", "0px", "0px")), { zIndex: 0 }),
2026
- tBodyRow: Object.assign(Object.assign(Object.assign({}, shorthands.padding("0px", "0px", "0px", "0px")), shorthands.borderBottom(tokens.strokeWidthThin, "solid", tokens.colorNeutralStroke1)), {
2027
- // ":nth-child(even)": {
2028
- // backgroundColor: tokens.colorNeutralBackground2,
2029
- // },
2030
- ":hover": {
2031
- backgroundColor: tokens.colorNeutralBackground2Hover,
2032
- } }),
2033
- tBodySelectedRow: Object.assign(Object.assign({ backgroundColor: tokens.colorBrandBackground2 }, shorthands.borderBottom(tokens.strokeWidthThin, "solid", tokens.colorNeutralStroke1)), { ":hover": {
2034
- backgroundColor: tokens.colorBrandBackground2Hover,
2035
- } }),
2036
- tBodyCell: Object.assign(Object.assign({ backgroundColor: "transparent" }, shorthands.padding("2px", "4px")), { minHeight: "35px", height: "35px" }),
2037
- tBodyRowPinnedCell: {
2038
- backgroundColor: tokens.colorPaletteYellowBackground2,
2039
- ":hover": {
2040
- backgroundColor: tokens.colorPaletteMarigoldBackground2,
2041
- }
2042
- },
2043
- tBodyPinnedCell: {
2044
- backgroundColor: tokens.colorNeutralBackground3,
2045
- ":hover": {
2046
- backgroundColor: tokens.colorNeutralBackground3Hover,
2047
- }
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%',
2048
2105
  },
2049
- tBodySelectedCell: {
2050
- backgroundColor: tokens.colorBrandBackground2,
2051
- ":hover": {
2052
- backgroundColor: tokens.colorBrandBackground2Hover,
2053
- }
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',
2054
2116
  },
2055
2117
  });
2056
-
2057
- function TableCell({ cell, row }) {
2058
- var _a;
2059
- const styles = useTableBodyStyles();
2060
- const isSelected = row.getIsSelected();
2061
- const isRowPinned = row.getIsPinned();
2062
- const isCellPinned = cell.column.getIsPinned();
2063
- const { isDragging, transition, setNodeRef, transform } = useSortable({
2064
- id: cell.column.id,
2065
- });
2066
- const tdStyle = {
2067
- width: cell.column.getSize(),
2068
- opacity: isDragging ? "0.8" : "1",
2069
- transform: CSS.Translate.toString(transform),
2070
- // transition: 'width transform 0.2s ease-in-out',
2071
- zIndex: isDragging ? 1 : 0,
2072
- 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);
2073
2130
  };
2074
- const cellClassNames = mergeClasses$1(styles.tBodyCell, isCellPinned && styles.tBodyPinnedCell, isSelected && styles.tBodySelectedCell, isRowPinned && styles.tBodyRowPinnedCell);
2075
- const styleStyles = Object.assign(Object.assign({}, tdStyle), getBodyCellPinningStyles(cell.column));
2076
- if (cell.getIsPlaceholder()) {
2077
- return jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef }, cell.id);
2078
- }
2079
- if (cell.getIsGrouped()) {
2080
- return (jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: jsx(Button, { onClick: row.getToggleExpandedHandler(), style: {
2081
- cursor: row.getCanExpand() ? 'pointer' : 'normal',
2082
- textAlign: 'left',
2083
- }, 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));
2084
- }
2085
- if (cell.getIsAggregated()) {
2086
- 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));
2087
- }
2088
- return (jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
2089
- }
2090
-
2091
- function TableRow({ row, rowSelectionMode, style }) {
2092
- const styles = useTableBodyStyles();
2093
- return (jsxs("tr", { className: row.getIsSelected() || row.getIsAllSubRowsSelected()
2094
- ? styles.tBodySelectedRow
2095
- : 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()
2096
- ? 'mixed'
2097
- : 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));
2098
- }
2099
- function PinnedRow({ row, rowSelectionMode, style, bottomRowLength }) {
2100
- const styles = useTableBodyStyles();
2101
- return (jsxs("tr", { className: row.getIsSelected() || row.getIsAllSubRowsSelected()
2102
- ? styles.tBodySelectedRow
2103
- : styles.tBodyRow, style: {
2104
- backgroundColor: 'goldenrod',
2105
- position: 'sticky',
2106
- top: row.getIsPinned() === 'top'
2107
- ? `${row.getPinnedIndex() * 35 + 48}px`
2108
- : undefined,
2109
- bottom: row.getIsPinned() === 'bottom'
2110
- ? `${((bottomRowLength || 0) - 1 - row.getPinnedIndex()) * 35}px`
2111
- : undefined
2112
- }, 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()
2113
- ? 'mixed'
2114
- : 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 => {
2115
- return (jsx(TableCell, { cell: cell, row: row }, cell.id));
2116
- })] }, row.id));
2117
- }
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
+ };
2118
2134
 
2119
- function TableBody(props) {
2120
- var _a, _b, _c;
2121
- const styles = useTableBodyStyles();
2122
- const { table, tableContainerRef } = props;
2123
- const rowSelectionMode = (_a = table.options.meta) === null || _a === void 0 ? void 0 : _a.rowSelectionMode;
2124
- let rows = [];
2125
- let topRows = [];
2126
- let bottomRows = [];
2127
- try {
2128
- rows = table.getCenterRows();
2129
- topRows = table.getTopRows();
2130
- bottomRows = table.getBottomRows();
2131
- }
2132
- catch (error) {
2133
- rows = [];
2134
- topRows = [];
2135
- 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
+ }
2136
2180
  }
2137
- const rowVirtualizer = useVirtual({
2138
- parentRef: tableContainerRef,
2139
- size: rows.length,
2140
- overscan: 10,
2141
- });
2142
- const { virtualItems: virtualRows, totalSize } = rowVirtualizer;
2143
- 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;
2144
- const paddingBottom = virtualRows.length > 0
2145
- ? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
2146
- : 0;
2147
- return (jsxs(Fragment, { children: [jsx(Show, { when: (topRows === null || topRows === void 0 ? void 0 : topRows.length) > 0, children: jsx("thead", { style: {
2148
- position: "sticky",
2149
- top: 0,
2150
- zIndex: 99
2151
- }, 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) => {
2152
- const row = rows[virtualRow.index];
2153
- return (jsx(TableRow, { row: row, rowSelectionMode: rowSelectionMode }, row.id));
2154
- } }), 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: {
2155
- position: "sticky",
2156
- bottom: 0,
2157
- zIndex: 99
2158
- }, children: jsxs("tr", { style: { backgroundColor: "white" }, children: [jsx("td", { className: "p-1", children: jsx(Checkbox, { checked: table.getIsSomePageRowsSelected()
2159
- ? 'mixed'
2160
- : 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: {
2161
- position: "sticky",
2162
- bottom: 0,
2163
- zIndex: 99
2164
- }, 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)) }) }) })] }));
2165
- }
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
+ };
2166
2185
 
2167
- const TableContainer = (props) => {
2168
- var _a, _b;
2169
- const styles = useTableStaticStyles();
2170
- const { table } = props;
2171
- const { tableHeight, rowSelectionMode } = table.options.meta || {};
2172
- const tableContainerRef = React.useRef(null);
2173
- 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 }) => {
2174
2204
  const headerGroups = table.getHeaderGroups();
2175
- // utilities
2176
- const isLoading = props.isLoading && itemLength === 0;
2177
- const noItems = !isLoading && ((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) === 0;
2178
- const noSearchResult = !isLoading && ((_b = props === null || props === void 0 ? void 0 : props.data) === null || _b === void 0 ? void 0 : _b.length) > 0 && itemLength === 0;
2179
- 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 }) })] })] }));
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" }) })] }));
2180
2223
  };
2181
2224
 
2182
2225
  const ViewSaveForm = (props) => {
@@ -2238,14 +2281,16 @@ const useFilterDrawerStyles = makeStyles({
2238
2281
  } }),
2239
2282
  });
2240
2283
  const ViewsDrawer = (props) => {
2241
- 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;
2242
2287
  const { onTableViewDelete, onTableViewSave } = table.options.meta || {};
2243
2288
  const [checkedValues, setCheckedValues] = React.useState({ font: ["calibri"] });
2244
2289
  const onChange = (e, { name, checkedItems }) => {
2245
2290
  setCheckedValues((s) => (Object.assign(Object.assign({}, s), { [name]: checkedItems })));
2246
2291
  };
2247
2292
  const styles = useFilterDrawerStyles();
2248
- 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) => {
2249
2294
  return (jsxs("div", { style: {
2250
2295
  display: 'flex',
2251
2296
  justifyContent: 'space-between',
@@ -2255,41 +2300,9 @@ const ViewsDrawer = (props) => {
2255
2300
  })] })] }), jsx(DrawerFooter, { children: jsxs(MenuList, { children: [jsx(MenuDivider, {}), jsx(MenuItem, { icon: jsx(ClearFilterIcon, {}), onClick: resetToGridDefaultView, children: "Reset to Default View" })] }) })] }));
2256
2301
  };
2257
2302
 
2258
- const TableActions = {
2259
- TOGGLE_FILTER_DRAWER: 'TOGGLE_FILTER_DRAWER',
2260
- TOGGLE_VIEW_DRAWER: 'TOGGLE_VIEW_DRAWER',
2261
- OPEN_FILTER_DRAWER: 'OPEN_FILTER_DRAWER',
2262
- OPEN_VIEW_DRAWER: 'OPEN_VIEW_DRAWER',
2263
- CLOSE_FILTER_DRAWER: 'CLOSE_FILTER_DRAWER',
2264
- CLOSE_VIEW_DRAWER: 'CLOSE_VIEW_DRAWER',
2265
- };
2266
- // write a reducer function to handle the state of the table
2267
- function tableReducer(state, action) {
2268
- switch (action.type) {
2269
- case TableActions.TOGGLE_FILTER_DRAWER:
2270
- return Object.assign(Object.assign({}, state), { isFilterDrawerOpen: !state.isFilterDrawerOpen });
2271
- case TableActions.TOGGLE_VIEW_DRAWER:
2272
- return Object.assign(Object.assign({}, state), { isViewsDrawerOpen: !state.isViewsDrawerOpen });
2273
- case TableActions.OPEN_FILTER_DRAWER:
2274
- return Object.assign(Object.assign({}, state), { isFilterDrawerOpen: true });
2275
- case TableActions.OPEN_VIEW_DRAWER:
2276
- return Object.assign(Object.assign({}, state), { isViewsDrawerOpen: true });
2277
- case TableActions.CLOSE_FILTER_DRAWER:
2278
- return Object.assign(Object.assign({}, state), { isFilterDrawerOpen: false });
2279
- case TableActions.CLOSE_VIEW_DRAWER:
2280
- return Object.assign(Object.assign({}, state), { isViewsDrawerOpen: false });
2281
- default:
2282
- return state;
2283
- }
2284
- }
2285
-
2286
2303
  function AdvancedTable(props, ref) {
2287
2304
  useStaticStyles();
2288
2305
  const { table, globalFilter, headerMenu, tableViews, setGlobalFilter, resetToDefaultView, applyTableState } = useGridContainer(props, ref);
2289
- const [drawerState, dispatch] = React.useReducer(tableReducer, {
2290
- isFilterDrawerOpen: false,
2291
- isViewsDrawerOpen: false
2292
- });
2293
2306
  const { getState, setColumnOrder } = table;
2294
2307
  const { columnOrder } = getState();
2295
2308
  function handleDragEnd(event) {
@@ -2304,14 +2317,14 @@ function AdvancedTable(props, ref) {
2304
2317
  }
2305
2318
  const pointerSensor = useSensor(PointerSensor, {
2306
2319
  activationConstraint: {
2307
- distance: 0.01
2320
+ distance: 0.0001
2308
2321
  }
2309
2322
  });
2310
2323
  const mouseSensor = useSensor(MouseSensor);
2311
2324
  const touchSensor = useSensor(TouchSensor);
2312
2325
  const keyboardSensor = useSensor(KeyboardSensor);
2313
2326
  const sensors = useSensors(mouseSensor, touchSensor, keyboardSensor, pointerSensor);
2314
- 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 })] }) }));
2315
2328
  }
2316
2329
  const ForwardedAdvancedTable = React.forwardRef(AdvancedTable);
2317
2330