@prt-ts/fluent-react-table-v2 9.41.0-build.2.0 → 9.41.0-build.3.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.
Files changed (2) hide show
  1. package/index.js +25 -16
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { useMemo } from 'react';
4
4
  import { useDrop, useDrag, DndProvider } from 'react-dnd';
5
5
  import { HTML5Backend } from 'react-dnd-html5-backend';
6
- import { makeStaticStyles, makeStyles, shorthands, tokens, useId, Dropdown, Option, Input, Button, Divider, Popover, PopoverTrigger, Tooltip, PopoverSurface, MenuGroupHeader, Checkbox, RadioGroup, Radio, Field, InlineDrawer, DrawerHeader, DrawerHeaderTitle, DrawerBody, Caption1Stronger, Menu, MenuTrigger, MenuButton, MenuPopover, MenuList, MenuGroup, MenuItem, MenuDivider, mergeClasses, Skeleton, SkeletonItem, Subtitle2Stronger, MenuItemRadio, DrawerFooter } from '@fluentui/react-components';
6
+ import { makeStaticStyles, makeStyles, shorthands, tokens, useId, Dropdown, Option, Input, Button, Divider, Popover, PopoverTrigger, Tooltip, PopoverSurface, MenuGroupHeader, Checkbox, RadioGroup, Radio, Field, InlineDrawer, DrawerHeader, DrawerHeaderTitle, DrawerBody, Caption1Stronger, mergeClasses, Menu, MenuTrigger, MenuButton, MenuPopover, MenuList, MenuGroup, MenuItem, MenuDivider, Skeleton, SkeletonItem, Subtitle2Stronger, MenuItemRadio, DrawerFooter } from '@fluentui/react-components';
7
7
  import { PreviousRegular, ArrowPreviousFilled, ArrowNextFilled, NextRegular, bundleIcon, SaveFilled, SaveRegular, TableSimpleCheckmarkFilled, TableSimpleCheckmarkRegular, SearchFilled, SearchRegular, FilterFilled, FilterRegular, CodeTextOff16Filled, CodeTextOff16Regular, ColumnEditFilled, ColumnEditRegular, GroupFilled, GroupRegular, ChevronRightFilled, ChevronRightRegular, ChevronDownRegular, ChevronDownFilled, DragFilled, DragRegular, Album24Regular, Search24Regular, FilterDismissFilled, Dismiss24Regular, ArrowSortDown20Filled, ArrowSortDown20Regular, ArrowSortUp20Filled, ArrowSortUp20Regular, GroupListRegular, PinRegular, TextSortAscendingFilled, TextSortDescendingFilled, GroupDismissFilled, ArrowStepInLeftRegular, ArrowStepInRightRegular, PinOffRegular, DocumentSearch24Regular, Save20Filled, ViewDesktop20Filled, ViewDesktop20Regular } from '@fluentui/react-icons';
8
8
  import { useReactTable, getCoreRowModel, getPaginationRowModel, getSortedRowModel, getFilteredRowModel, getGroupedRowModel, getExpandedRowModel, getFacetedUniqueValues, getFacetedMinMaxValues, flexRender } from '@tanstack/react-table';
9
9
  export { createColumnHelper } from '@tanstack/react-table';
@@ -811,16 +811,26 @@ const reorderColumn = (draggedColumnId, targetColumnId, columnOrder) => {
811
811
  return [...columnOrder];
812
812
  };
813
813
  const useTableHeaderCellStyles = makeStyles({
814
- tHeadCell: Object.assign(Object.assign(Object.assign(Object.assign({ position: "relative", fontSize: tokens.fontSizeBase300, fontWeight: tokens.fontWeightBold, minWidth: "1rem" }, shorthands.padding("2px", "4px")), shorthands.borderLeft("1px", "solid", tokens.colorNeutralStroke1)), shorthands.borderRight("1px", "solid", tokens.colorNeutralStroke1)), shorthands.borderBottom("1px", "solid", tokens.colorNeutralStroke1)),
815
- tHeadCellContent: Object.assign({ display: "flex", alignContent: "space-between", alignItems: "center", justifyContent: "space-between", cursor: "pointer", width: "100%", minWidth: "1rem" }, shorthands.padding("3px", "4px")),
816
- tHeadContentBtn: Object.assign(Object.assign(Object.assign(Object.assign({}, shorthands.padding("0px", "0px", "0px", "0px")), { display: "flex" }), shorthands.gap("5px")), { alignContent: "space-between", alignItems: "center", justifyContent: "space-between", cursor: "pointer", width: "100%", height: "100%", minWidth: "1rem" }),
817
- tHeadMenuPopover: Object.assign(Object.assign({}, shorthands.padding("0px", "0px", "0px", "0px")), { width: "300px" }),
818
- resizer: Object.assign(Object.assign({}, shorthands.borderRight("1px", "solid", tokens.colorNeutralBackground5)), { width: "8px", position: "absolute", top: 0, right: 0, bottom: 0, cursor: "col-resize", resize: "horizontal", ":hover": {
819
- borderRightWidth: "4px",
814
+ tHeadCell: Object.assign({ zIndex: 99, position: 'relative', fontSize: tokens.fontSizeBase300, fontWeight: tokens.fontWeightBold, minWidth: '1rem' }, shorthands.padding('2px', '4px')),
815
+ tHeadNonLeafCell: Object.assign({}, shorthands.borderBottom('1px', 'solid', tokens.colorNeutralBackground5)),
816
+ tHeadCellDraggable: {
817
+ height: '100%',
818
+ },
819
+ tHeadCellDragging: {
820
+ opacity: 0.5,
821
+ cursor: 'grab',
822
+ },
823
+ tHeadCellOver: Object.assign({ backgroundColor: tokens.colorNeutralStroke1 }, shorthands.border(tokens.strokeWidthThin, 'dashed', tokens.colorNeutralBackground5)),
824
+ tLeafHeadCellContent: Object.assign({ display: 'flex', alignContent: 'space-between', alignItems: 'center', justifyContent: 'space-between', cursor: 'pointer', width: '100%', height: '100%', minWidth: '1rem' }, shorthands.padding('3px', '4px')),
825
+ tNonLeafHeadCellContent: Object.assign({ display: 'flex', alignContent: 'center', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', width: '100%', minWidth: '1rem' }, shorthands.padding('3px', '4px')),
826
+ tHeadContentBtn: Object.assign(Object.assign(Object.assign(Object.assign({}, shorthands.padding('0px', '0px', '0px', '0px')), { display: 'flex' }), shorthands.gap('5px')), { alignContent: 'space-between', alignItems: 'center', justifyContent: 'space-between', cursor: 'pointer', width: '100%', height: '100%', minWidth: '1rem' }),
827
+ tHeadMenuPopover: Object.assign(Object.assign({}, shorthands.padding('0px', '0px', '0px', '0px')), { width: '300px' }),
828
+ resizer: Object.assign(Object.assign({}, shorthands.borderRight('1px', 'solid', tokens.colorNeutralBackground5)), { width: '8px', position: 'absolute', top: 0, right: 0, bottom: 0, cursor: 'col-resize', resize: 'horizontal', ':hover': {
829
+ borderRightWidth: '4px',
820
830
  borderRightColor: tokens.colorNeutralBackground2Pressed,
821
831
  } }),
822
832
  resizerActive: {
823
- borderRightWidth: "4px",
833
+ borderRightWidth: '4px',
824
834
  borderRightColor: tokens.colorNeutralBackground2Pressed,
825
835
  },
826
836
  });
@@ -847,14 +857,13 @@ const HeaderCell = ({ header, table, hideMenu, headerDepth, totalNumberOfHeaderD
847
857
  type: "column",
848
858
  });
849
859
  const styles = useTableHeaderCellStyles();
850
- return (jsxs("th", Object.assign({ colSpan: header.colSpan, style: {
851
- opacity: isDragging ? 0.5 : 1,
852
- cursor: isDragging ? 'grabbing' : 'pointer',
853
- alignItems: headerDepth === totalNumberOfHeaderDepth ? 'left' : 'center',
854
- zIndex: 99,
855
- backgroundColor: isOver ? '#0000000d' : 'transparent',
856
- border: isOver ? '1px dashed #0000000d' : 'none',
857
- }, className: styles.tHeadCell }, { children: [jsx("div", Object.assign({ ref: header.isPlaceholder ? undefined : dragRef }, { children: jsxs("div", Object.assign({ className: styles.tHeadCellContent, ref: header.isPlaceholder ? undefined : dropRef }, { children: [jsx("div", Object.assign({ ref: header.isPlaceholder ? undefined : previewRef }, { children: header.isPlaceholder ? null : (jsxs(Button, Object.assign({ style: {
860
+ const canDragDrop = headerDepth === totalNumberOfHeaderDepth && !header.isPlaceholder;
861
+ const isLeafHeaders = headerDepth === totalNumberOfHeaderDepth;
862
+ return (jsxs("th", Object.assign({ colSpan: header.colSpan, className: mergeClasses(styles.tHeadCell, isLeafHeaders || header.isPlaceholder
863
+ ? undefined
864
+ : styles.tHeadNonLeafCell, isDragging && styles.tHeadCellDragging, isOver && isLeafHeaders && styles.tHeadCellOver) }, { children: [jsx("div", Object.assign({ className: styles.tHeadCellDraggable, ref: canDragDrop ? dragRef : undefined }, { children: jsxs("div", Object.assign({ className: isLeafHeaders
865
+ ? styles.tLeafHeadCellContent
866
+ : styles.tNonLeafHeadCellContent, ref: canDragDrop ? dropRef : undefined }, { children: [jsx("div", Object.assign({ ref: canDragDrop ? previewRef : undefined }, { children: header.isPlaceholder ? null : (jsxs(Button, Object.assign({ style: {
858
867
  display: 'flex',
859
868
  alignItems: 'center',
860
869
  justifyContent: 'left',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prt-ts/fluent-react-table-v2",
3
- "version": "9.41.0-build.2.0",
3
+ "version": "9.41.0-build.3.0",
4
4
  "main": "./index.js",
5
5
  "types": "./src\\index.d.ts",
6
6
  "peerDependencies": {