@prt-ts/fluent-react-table-v2 9.46.8-build.5.0 → 9.46.8-build.6.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.cjs.js
CHANGED
|
@@ -7,11 +7,10 @@ var React = require('react');
|
|
|
7
7
|
var reactComponents = require('@fluentui/react-components');
|
|
8
8
|
var reactControlFlow = require('@prt-ts/react-control-flow');
|
|
9
9
|
var reactTable = require('@tanstack/react-table');
|
|
10
|
-
var reactVirtual = require('
|
|
10
|
+
var reactVirtual = require('react-virtual');
|
|
11
11
|
var reactDatepickerCompat = require('@fluentui/react-datepicker-compat');
|
|
12
12
|
var sortable = require('@dnd-kit/sortable');
|
|
13
13
|
var utilities = require('@dnd-kit/utilities');
|
|
14
|
-
var reactVirtual$1 = require('react-virtual');
|
|
15
14
|
var core = require('@dnd-kit/core');
|
|
16
15
|
var modifiers = require('@dnd-kit/modifiers');
|
|
17
16
|
|
|
@@ -45,7 +44,7 @@ const useTableStaticStyles = reactComponents.makeStyles({
|
|
|
45
44
|
// height: "650px",
|
|
46
45
|
width: "100%" }, reactComponents.shorthands.overflow("hidden", "auto")), {
|
|
47
46
|
/* width */
|
|
48
|
-
":hover": Object.assign({}, reactComponents.shorthands.overflow("auto", "auto")), "::-webkit-scrollbar": Object.assign({ width: "
|
|
47
|
+
":hover": Object.assign({}, reactComponents.shorthands.overflow("auto", "auto")), "::-webkit-scrollbar": Object.assign({ width: "8px", height: "4px" }, reactComponents.shorthands.borderRadius("50%")),
|
|
49
48
|
/* Track */
|
|
50
49
|
"::-webkit-scrollbar-track": {
|
|
51
50
|
"background-color": "#f1f1f1",
|
|
@@ -1173,11 +1172,11 @@ const GridHeader = (props) => {
|
|
|
1173
1172
|
return null;
|
|
1174
1173
|
if (column.id === 'id')
|
|
1175
1174
|
return null;
|
|
1176
|
-
return (jsxRuntime.jsx(reactComponents.
|
|
1177
|
-
})] }) })] }), jsxRuntime.jsxs(reactComponents.Popover, { withArrow: true, children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { disableButtonEnhancement: true, children: jsxRuntime.jsx(reactComponents.Tooltip, { content: 'Toggle Column Visibility', relationship: "label", children: jsxRuntime.jsx(reactComponents.Button, { icon: jsxRuntime.jsx(ToggleSelectColumnIcon, {}), "aria-label": "Toggle Column Visibility" }) }) }), jsxRuntime.jsx(reactComponents.PopoverSurface, { className: styles.popoverSurface, children: jsxRuntime.jsxs("div", { className: styles.tableTopHeaderColumnTogglePopover, children: [jsxRuntime.jsx(reactComponents.MenuGroupHeader, { children: "Toggle Columns" }), jsxRuntime.jsx(reactComponents.
|
|
1175
|
+
return (jsxRuntime.jsx(reactComponents.Checkbox, { checked: column.getIsGrouped(), onChange: column.getToggleGroupingHandler(), disabled: !column.getCanGroup() || !column.getIsVisible(), label: jsxRuntime.jsx("span", { children: column.columnDef.id }) }, column.id));
|
|
1176
|
+
})] }) })] }), jsxRuntime.jsxs(reactComponents.Popover, { withArrow: true, children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { disableButtonEnhancement: true, children: jsxRuntime.jsx(reactComponents.Tooltip, { content: 'Toggle Column Visibility', relationship: "label", children: jsxRuntime.jsx(reactComponents.Button, { icon: jsxRuntime.jsx(ToggleSelectColumnIcon, {}), "aria-label": "Toggle Column Visibility" }) }) }), jsxRuntime.jsx(reactComponents.PopoverSurface, { className: styles.popoverSurface, children: jsxRuntime.jsxs("div", { className: styles.tableTopHeaderColumnTogglePopover, children: [jsxRuntime.jsx(reactComponents.MenuGroupHeader, { children: "Toggle Columns" }), jsxRuntime.jsx(reactComponents.Checkbox, { checked: table.getIsAllColumnsVisible(), onChange: table.getToggleAllColumnsVisibilityHandler(), label: 'Toggle All' }), jsxRuntime.jsx(reactComponents.Divider, {}), table.getAllLeafColumns().map((column) => {
|
|
1178
1177
|
if (column.id === 'select')
|
|
1179
1178
|
return null;
|
|
1180
|
-
return (jsxRuntime.jsx(reactComponents.
|
|
1179
|
+
return (jsxRuntime.jsx(reactComponents.Checkbox, { checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler(), label: column.id, disabled: !column.getCanHide() }, column.id));
|
|
1181
1180
|
})] }) })] }), jsxRuntime.jsx(reactComponents.Tooltip, { content: 'Table Views Management', relationship: "label", children: jsxRuntime.jsx(reactComponents.Button, { onClick: () => {
|
|
1182
1181
|
dispatch({ type: "TOGGLE_VIEW_DRAWER" });
|
|
1183
1182
|
}, icon: jsxRuntime.jsx(Album24Regular, {}), "aria-label": "View Menu" }) }), jsxRuntime.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 })] })] }));
|
|
@@ -1511,7 +1510,7 @@ const useCheckboxFilterStyles = reactComponents.makeStyles({
|
|
|
1511
1510
|
marginLeft: '10px',
|
|
1512
1511
|
marginRight: '10px',
|
|
1513
1512
|
},
|
|
1514
|
-
searchContainer: Object.assign(Object.assign(Object.assign({ maxHeight: '300px', width: '100%' }, reactComponents.shorthands.overflow('auto', 'auto')), reactComponents.shorthands.padding('0px', "0px", "2px", '0px')), { '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, reactComponents.shorthands.borderRadius('50%')),
|
|
1513
|
+
searchContainer: Object.assign(Object.assign(Object.assign({ display: 'flex', flexDirection: 'column', maxHeight: '300px', width: '100%' }, reactComponents.shorthands.overflow('auto', 'auto')), reactComponents.shorthands.padding('0px', "0px", "2px", '0px')), { '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, reactComponents.shorthands.borderRadius('50%')),
|
|
1515
1514
|
/* Track */
|
|
1516
1515
|
'::-webkit-scrollbar-track': {
|
|
1517
1516
|
'background-color': '#f1f1f1',
|
|
@@ -1526,7 +1525,7 @@ const useCheckboxFilterStyles = reactComponents.makeStyles({
|
|
|
1526
1525
|
} }),
|
|
1527
1526
|
});
|
|
1528
1527
|
const FilterMultiSelectCheckbox = ({ column, table, }) => {
|
|
1529
|
-
var _a;
|
|
1528
|
+
var _a, _b, _c;
|
|
1530
1529
|
const firstValue = (_a = table
|
|
1531
1530
|
.getPreFilteredRowModel()
|
|
1532
1531
|
.flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
|
|
@@ -1549,45 +1548,45 @@ const FilterMultiSelectCheckbox = ({ column, table, }) => {
|
|
|
1549
1548
|
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());
|
|
1550
1549
|
});
|
|
1551
1550
|
}, [localColumnFilterValue, filterOptions]);
|
|
1552
|
-
const
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
overscan: 5,
|
|
1551
|
+
const filterContainer = React__namespace.useRef(null);
|
|
1552
|
+
const rowVirtualizer = reactVirtual.useVirtual({
|
|
1553
|
+
parentRef: filterContainer,
|
|
1554
|
+
size: filterOptionsFiltered.length,
|
|
1555
|
+
overscan: 15,
|
|
1558
1556
|
});
|
|
1559
|
-
const virtualItems =
|
|
1557
|
+
const { virtualItems: virtualRows, totalSize } = rowVirtualizer;
|
|
1558
|
+
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;
|
|
1559
|
+
const paddingBottom = virtualRows.length > 0
|
|
1560
|
+
? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
|
|
1561
|
+
: 0;
|
|
1560
1562
|
const allOptionChecked = (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) > 0 &&
|
|
1561
1563
|
(columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) !== (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length)
|
|
1562
1564
|
? 'mixed'
|
|
1563
1565
|
: (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) === (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) &&
|
|
1564
1566
|
(filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) > 0;
|
|
1565
1567
|
const styles = useCheckboxFilterStyles();
|
|
1566
|
-
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(reactComponents.Input, { type: 'search', value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsxRuntime.
|
|
1567
|
-
|
|
1568
|
-
|
|
1568
|
+
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(reactComponents.Input, { type: 'search', value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsxRuntime.jsxs("div", { ref: filterContainer, className: styles.searchContainer, children: [paddingTop > 0 && (jsxRuntime.jsx("span", { style: { paddingTop: `${paddingTop}px` } })), jsxRuntime.jsx(reactComponents.Checkbox, { checked: allOptionChecked, onChange: () => {
|
|
1569
|
+
if ((columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) > 0) {
|
|
1570
|
+
column.setFilterValue(undefined);
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1573
|
+
column.setFilterValue([
|
|
1574
|
+
...((filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.map((x) => `${x}`)) || []),
|
|
1575
|
+
]);
|
|
1576
|
+
}, label: '(Toggle All)' }, `toggle-all-${column.id}`), virtualRows.map((row) => {
|
|
1577
|
+
var _a;
|
|
1578
|
+
const value = `${filterOptionsFiltered[row.index]}`;
|
|
1579
|
+
return (jsxRuntime.jsx(reactComponents.Checkbox, { checked: (_a = columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) !== null && _a !== void 0 ? _a : false, onChange: () => {
|
|
1580
|
+
if (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) {
|
|
1581
|
+
column.setFilterValue((old) => old === null || old === void 0 ? void 0 : old.filter((v) => v !== value));
|
|
1569
1582
|
return;
|
|
1570
1583
|
}
|
|
1571
|
-
column.setFilterValue([
|
|
1572
|
-
...(
|
|
1584
|
+
column.setFilterValue((old) => [
|
|
1585
|
+
...(old || []),
|
|
1586
|
+
value,
|
|
1573
1587
|
]);
|
|
1574
|
-
}, label:
|
|
1575
|
-
|
|
1576
|
-
const value = `${filterOptionsFiltered[row.index]}`;
|
|
1577
|
-
return (jsxRuntime.jsx("div", { style: {
|
|
1578
|
-
height: `${row.size}px`,
|
|
1579
|
-
transform: `translateY(${row.start - index * row.size}px)`,
|
|
1580
|
-
}, children: jsxRuntime.jsx(reactComponents.Checkbox, { checked: (_a = columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) !== null && _a !== void 0 ? _a : false, onChange: () => {
|
|
1581
|
-
if (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) {
|
|
1582
|
-
column.setFilterValue((old) => old === null || old === void 0 ? void 0 : old.filter((v) => v !== value));
|
|
1583
|
-
return;
|
|
1584
|
-
}
|
|
1585
|
-
column.setFilterValue((old) => [
|
|
1586
|
-
...(old || []),
|
|
1587
|
-
value,
|
|
1588
|
-
]);
|
|
1589
|
-
}, label: value }) }, `${column.id}-${row.index}`));
|
|
1590
|
-
})] }) })] }));
|
|
1588
|
+
}, label: value }, `${column.id}-${row.index}`));
|
|
1589
|
+
}), paddingBottom > 0 && (jsxRuntime.jsx("span", { style: { paddingBottom: `${paddingBottom}px` } }))] }, 'filter-multi-select-checkbox')] }));
|
|
1591
1590
|
};
|
|
1592
1591
|
|
|
1593
1592
|
const useRadioFilterStyles = reactComponents.makeStyles({
|
|
@@ -1597,7 +1596,7 @@ const useRadioFilterStyles = reactComponents.makeStyles({
|
|
|
1597
1596
|
marginLeft: '10px',
|
|
1598
1597
|
marginRight: '10px',
|
|
1599
1598
|
},
|
|
1600
|
-
searchContainer: Object.assign(Object.assign({ maxHeight: '300px', width: '100%' }, reactComponents.shorthands.overflow('auto', 'auto')), { '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, reactComponents.shorthands.borderRadius('50%')),
|
|
1599
|
+
searchContainer: Object.assign(Object.assign({ display: 'flex', flexDirection: 'column', maxHeight: '300px', width: '100%' }, reactComponents.shorthands.overflow('auto', 'auto')), { '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, reactComponents.shorthands.borderRadius('50%')),
|
|
1601
1600
|
/* Track */
|
|
1602
1601
|
'::-webkit-scrollbar-track': {
|
|
1603
1602
|
'background-color': '#f1f1f1',
|
|
@@ -1612,7 +1611,7 @@ const useRadioFilterStyles = reactComponents.makeStyles({
|
|
|
1612
1611
|
} }),
|
|
1613
1612
|
});
|
|
1614
1613
|
const FilterSelectRadio = ({ column, table, }) => {
|
|
1615
|
-
var _a;
|
|
1614
|
+
var _a, _b, _c;
|
|
1616
1615
|
const firstValue = (_a = table
|
|
1617
1616
|
.getPreFilteredRowModel()
|
|
1618
1617
|
.flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
|
|
@@ -1635,28 +1634,28 @@ const FilterSelectRadio = ({ column, table, }) => {
|
|
|
1635
1634
|
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());
|
|
1636
1635
|
});
|
|
1637
1636
|
}, [localColumnFilterValue, filterOptions]);
|
|
1638
|
-
const
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
overscan: 5,
|
|
1637
|
+
const filterContainer = React__namespace.useRef(null);
|
|
1638
|
+
const rowVirtualizer = reactVirtual.useVirtual({
|
|
1639
|
+
parentRef: filterContainer,
|
|
1640
|
+
size: filterOptionsFiltered.length,
|
|
1641
|
+
overscan: 15,
|
|
1644
1642
|
});
|
|
1645
|
-
const virtualItems =
|
|
1643
|
+
const { virtualItems: virtualRows, totalSize } = rowVirtualizer;
|
|
1644
|
+
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;
|
|
1645
|
+
const paddingBottom = virtualRows.length > 0
|
|
1646
|
+
? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
|
|
1647
|
+
: 0;
|
|
1646
1648
|
const styles = useRadioFilterStyles();
|
|
1647
|
-
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(reactComponents.Input, { value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsxRuntime.
|
|
1649
|
+
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(reactComponents.Input, { value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsxRuntime.jsxs("div", { ref: filterContainer, className: styles.searchContainer, children: [paddingTop > 0 && jsxRuntime.jsx("div", { style: { paddingTop: `${paddingTop}px` } }), jsxRuntime.jsxs(reactComponents.RadioGroup, { layout: "vertical", value: (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[0]) || '', onChange: (_, data) => {
|
|
1648
1650
|
if (data.value === '') {
|
|
1649
1651
|
column.setFilterValue([]);
|
|
1650
1652
|
return;
|
|
1651
1653
|
}
|
|
1652
1654
|
column.setFilterValue([data.value]);
|
|
1653
|
-
}, children: [jsxRuntime.jsx(reactComponents.Radio, { value: '', label: 'None' }),
|
|
1655
|
+
}, children: [jsxRuntime.jsx(reactComponents.Radio, { value: '', label: 'None' }), virtualRows.map((row) => {
|
|
1654
1656
|
const value = filterOptionsFiltered[row.index];
|
|
1655
|
-
return
|
|
1656
|
-
|
|
1657
|
-
transform: `translateY(${row.start - index * row.size}px)`,
|
|
1658
|
-
}, children: jsxRuntime.jsx(reactComponents.Radio, { value: value, label: value }, value) }, `${column.id}-${row.index}`));
|
|
1659
|
-
})] }) }) })] }));
|
|
1657
|
+
return jsxRuntime.jsx(reactComponents.Radio, { value: value, label: value }, value);
|
|
1658
|
+
})] }), paddingBottom > 0 && (jsxRuntime.jsx("div", { style: { paddingBottom: `${paddingBottom}px` } }))] })] }));
|
|
1660
1659
|
};
|
|
1661
1660
|
|
|
1662
1661
|
const useNumberRangeFilterStyles$2 = reactComponents.makeStyles({
|
|
@@ -2157,7 +2156,7 @@ function TableBody(props) {
|
|
|
2157
2156
|
topRows = [];
|
|
2158
2157
|
bottomRows = [];
|
|
2159
2158
|
}
|
|
2160
|
-
const rowVirtualizer = reactVirtual
|
|
2159
|
+
const rowVirtualizer = reactVirtual.useVirtual({
|
|
2161
2160
|
parentRef: tableContainerRef,
|
|
2162
2161
|
size: rows.length,
|
|
2163
2162
|
overscan: 10,
|
package/index.esm.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import { makeStaticStyles, makeStyles, shorthands, tokens, useId, Dropdown, Option, Input, Button, Divider, Popover, PopoverTrigger, Tooltip, PopoverSurface, MenuGroupHeader,
|
|
5
|
-
import { Show, For, Switch
|
|
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';
|
|
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 {
|
|
8
|
+
import { useVirtual } from 'react-virtual';
|
|
9
9
|
import { DatePicker } from '@fluentui/react-datepicker-compat';
|
|
10
10
|
import { useSortable, SortableContext, horizontalListSortingStrategy, arrayMove } from '@dnd-kit/sortable';
|
|
11
11
|
import { CSS } from '@dnd-kit/utilities';
|
|
12
|
-
import { useVirtual } from 'react-virtual';
|
|
13
12
|
import { useSensor, PointerSensor, MouseSensor, TouchSensor, KeyboardSensor, useSensors, DndContext, closestCenter } from '@dnd-kit/core';
|
|
14
13
|
import { restrictToHorizontalAxis } from '@dnd-kit/modifiers';
|
|
15
14
|
|
|
@@ -23,7 +22,7 @@ const useTableStaticStyles = makeStyles({
|
|
|
23
22
|
// height: "650px",
|
|
24
23
|
width: "100%" }, shorthands.overflow("hidden", "auto")), {
|
|
25
24
|
/* width */
|
|
26
|
-
":hover": Object.assign({}, shorthands.overflow("auto", "auto")), "::-webkit-scrollbar": Object.assign({ width: "
|
|
25
|
+
":hover": Object.assign({}, shorthands.overflow("auto", "auto")), "::-webkit-scrollbar": Object.assign({ width: "8px", height: "4px" }, shorthands.borderRadius("50%")),
|
|
27
26
|
/* Track */
|
|
28
27
|
"::-webkit-scrollbar-track": {
|
|
29
28
|
"background-color": "#f1f1f1",
|
|
@@ -1151,11 +1150,11 @@ const GridHeader = (props) => {
|
|
|
1151
1150
|
return null;
|
|
1152
1151
|
if (column.id === 'id')
|
|
1153
1152
|
return null;
|
|
1154
|
-
return (jsx(
|
|
1155
|
-
})] }) })] }), jsxs(Popover, { withArrow: true, children: [jsx(PopoverTrigger, { disableButtonEnhancement: true, children: jsx(Tooltip, { content: 'Toggle Column Visibility', relationship: "label", children: jsx(Button, { icon: jsx(ToggleSelectColumnIcon, {}), "aria-label": "Toggle Column Visibility" }) }) }), jsx(PopoverSurface, { className: styles.popoverSurface, children: jsxs("div", { className: styles.tableTopHeaderColumnTogglePopover, children: [jsx(MenuGroupHeader, { children: "Toggle Columns" }), jsx(
|
|
1153
|
+
return (jsx(Checkbox, { checked: column.getIsGrouped(), onChange: column.getToggleGroupingHandler(), disabled: !column.getCanGroup() || !column.getIsVisible(), label: jsx("span", { children: column.columnDef.id }) }, column.id));
|
|
1154
|
+
})] }) })] }), jsxs(Popover, { withArrow: true, children: [jsx(PopoverTrigger, { disableButtonEnhancement: true, children: jsx(Tooltip, { content: 'Toggle Column Visibility', relationship: "label", children: jsx(Button, { icon: jsx(ToggleSelectColumnIcon, {}), "aria-label": "Toggle Column Visibility" }) }) }), jsx(PopoverSurface, { className: styles.popoverSurface, children: jsxs("div", { className: styles.tableTopHeaderColumnTogglePopover, children: [jsx(MenuGroupHeader, { children: "Toggle Columns" }), jsx(Checkbox, { checked: table.getIsAllColumnsVisible(), onChange: table.getToggleAllColumnsVisibilityHandler(), label: 'Toggle All' }), jsx(Divider, {}), table.getAllLeafColumns().map((column) => {
|
|
1156
1155
|
if (column.id === 'select')
|
|
1157
1156
|
return null;
|
|
1158
|
-
return (jsx(
|
|
1157
|
+
return (jsx(Checkbox, { checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler(), label: column.id, disabled: !column.getCanHide() }, column.id));
|
|
1159
1158
|
})] }) })] }), jsx(Tooltip, { content: 'Table Views Management', relationship: "label", children: jsx(Button, { onClick: () => {
|
|
1160
1159
|
dispatch({ type: "TOGGLE_VIEW_DRAWER" });
|
|
1161
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 })] })] }));
|
|
@@ -1489,7 +1488,7 @@ const useCheckboxFilterStyles = makeStyles({
|
|
|
1489
1488
|
marginLeft: '10px',
|
|
1490
1489
|
marginRight: '10px',
|
|
1491
1490
|
},
|
|
1492
|
-
searchContainer: Object.assign(Object.assign(Object.assign({ maxHeight: '300px', width: '100%' }, shorthands.overflow('auto', 'auto')), shorthands.padding('0px', "0px", "2px", '0px')), { '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, shorthands.borderRadius('50%')),
|
|
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%')),
|
|
1493
1492
|
/* Track */
|
|
1494
1493
|
'::-webkit-scrollbar-track': {
|
|
1495
1494
|
'background-color': '#f1f1f1',
|
|
@@ -1504,7 +1503,7 @@ const useCheckboxFilterStyles = makeStyles({
|
|
|
1504
1503
|
} }),
|
|
1505
1504
|
});
|
|
1506
1505
|
const FilterMultiSelectCheckbox = ({ column, table, }) => {
|
|
1507
|
-
var _a;
|
|
1506
|
+
var _a, _b, _c;
|
|
1508
1507
|
const firstValue = (_a = table
|
|
1509
1508
|
.getPreFilteredRowModel()
|
|
1510
1509
|
.flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
|
|
@@ -1527,45 +1526,45 @@ const FilterMultiSelectCheckbox = ({ column, table, }) => {
|
|
|
1527
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());
|
|
1528
1527
|
});
|
|
1529
1528
|
}, [localColumnFilterValue, filterOptions]);
|
|
1530
|
-
const
|
|
1531
|
-
const
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
overscan: 5,
|
|
1529
|
+
const filterContainer = React.useRef(null);
|
|
1530
|
+
const rowVirtualizer = useVirtual({
|
|
1531
|
+
parentRef: filterContainer,
|
|
1532
|
+
size: filterOptionsFiltered.length,
|
|
1533
|
+
overscan: 15,
|
|
1536
1534
|
});
|
|
1537
|
-
const virtualItems =
|
|
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;
|
|
1538
1540
|
const allOptionChecked = (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) > 0 &&
|
|
1539
1541
|
(columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) !== (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length)
|
|
1540
1542
|
? 'mixed'
|
|
1541
1543
|
: (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) === (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) &&
|
|
1542
1544
|
(filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) > 0;
|
|
1543
1545
|
const styles = useCheckboxFilterStyles();
|
|
1544
|
-
return (jsxs("div", { children: [jsx(Input, { type: 'search', value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }),
|
|
1545
|
-
|
|
1546
|
-
|
|
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));
|
|
1547
1560
|
return;
|
|
1548
1561
|
}
|
|
1549
|
-
column.setFilterValue([
|
|
1550
|
-
...(
|
|
1562
|
+
column.setFilterValue((old) => [
|
|
1563
|
+
...(old || []),
|
|
1564
|
+
value,
|
|
1551
1565
|
]);
|
|
1552
|
-
}, label:
|
|
1553
|
-
|
|
1554
|
-
const value = `${filterOptionsFiltered[row.index]}`;
|
|
1555
|
-
return (jsx("div", { style: {
|
|
1556
|
-
height: `${row.size}px`,
|
|
1557
|
-
transform: `translateY(${row.start - index * row.size}px)`,
|
|
1558
|
-
}, children: jsx(Checkbox, { checked: (_a = columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) !== null && _a !== void 0 ? _a : false, onChange: () => {
|
|
1559
|
-
if (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) {
|
|
1560
|
-
column.setFilterValue((old) => old === null || old === void 0 ? void 0 : old.filter((v) => v !== value));
|
|
1561
|
-
return;
|
|
1562
|
-
}
|
|
1563
|
-
column.setFilterValue((old) => [
|
|
1564
|
-
...(old || []),
|
|
1565
|
-
value,
|
|
1566
|
-
]);
|
|
1567
|
-
}, label: value }) }, `${column.id}-${row.index}`));
|
|
1568
|
-
})] }) })] }));
|
|
1566
|
+
}, label: value }, `${column.id}-${row.index}`));
|
|
1567
|
+
}), paddingBottom > 0 && (jsx("span", { style: { paddingBottom: `${paddingBottom}px` } }))] }, 'filter-multi-select-checkbox')] }));
|
|
1569
1568
|
};
|
|
1570
1569
|
|
|
1571
1570
|
const useRadioFilterStyles = makeStyles({
|
|
@@ -1575,7 +1574,7 @@ const useRadioFilterStyles = makeStyles({
|
|
|
1575
1574
|
marginLeft: '10px',
|
|
1576
1575
|
marginRight: '10px',
|
|
1577
1576
|
},
|
|
1578
|
-
searchContainer: Object.assign(Object.assign({ maxHeight: '300px', width: '100%' }, shorthands.overflow('auto', 'auto')), { '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, shorthands.borderRadius('50%')),
|
|
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%')),
|
|
1579
1578
|
/* Track */
|
|
1580
1579
|
'::-webkit-scrollbar-track': {
|
|
1581
1580
|
'background-color': '#f1f1f1',
|
|
@@ -1590,7 +1589,7 @@ const useRadioFilterStyles = makeStyles({
|
|
|
1590
1589
|
} }),
|
|
1591
1590
|
});
|
|
1592
1591
|
const FilterSelectRadio = ({ column, table, }) => {
|
|
1593
|
-
var _a;
|
|
1592
|
+
var _a, _b, _c;
|
|
1594
1593
|
const firstValue = (_a = table
|
|
1595
1594
|
.getPreFilteredRowModel()
|
|
1596
1595
|
.flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
|
|
@@ -1613,28 +1612,28 @@ const FilterSelectRadio = ({ column, table, }) => {
|
|
|
1613
1612
|
return (_b = (_a = `${option}`) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes((_c = `${localColumnFilterValue}`) === null || _c === void 0 ? void 0 : _c.toLowerCase());
|
|
1614
1613
|
});
|
|
1615
1614
|
}, [localColumnFilterValue, filterOptions]);
|
|
1616
|
-
const
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
overscan: 5,
|
|
1615
|
+
const filterContainer = React.useRef(null);
|
|
1616
|
+
const rowVirtualizer = useVirtual({
|
|
1617
|
+
parentRef: filterContainer,
|
|
1618
|
+
size: filterOptionsFiltered.length,
|
|
1619
|
+
overscan: 15,
|
|
1622
1620
|
});
|
|
1623
|
-
const virtualItems =
|
|
1621
|
+
const { virtualItems: virtualRows, totalSize } = rowVirtualizer;
|
|
1622
|
+
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;
|
|
1623
|
+
const paddingBottom = virtualRows.length > 0
|
|
1624
|
+
? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
|
|
1625
|
+
: 0;
|
|
1624
1626
|
const styles = useRadioFilterStyles();
|
|
1625
|
-
return (jsxs("div", { children: [jsx(Input, { value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }),
|
|
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) => {
|
|
1626
1628
|
if (data.value === '') {
|
|
1627
1629
|
column.setFilterValue([]);
|
|
1628
1630
|
return;
|
|
1629
1631
|
}
|
|
1630
1632
|
column.setFilterValue([data.value]);
|
|
1631
|
-
}, children: [jsx(Radio, { value: '', label: 'None' }),
|
|
1633
|
+
}, children: [jsx(Radio, { value: '', label: 'None' }), virtualRows.map((row) => {
|
|
1632
1634
|
const value = filterOptionsFiltered[row.index];
|
|
1633
|
-
return
|
|
1634
|
-
|
|
1635
|
-
transform: `translateY(${row.start - index * row.size}px)`,
|
|
1636
|
-
}, children: jsx(Radio, { value: value, label: value }, value) }, `${column.id}-${row.index}`));
|
|
1637
|
-
})] }) }) })] }));
|
|
1635
|
+
return jsx(Radio, { value: value, label: value }, value);
|
|
1636
|
+
})] }), paddingBottom > 0 && (jsx("div", { style: { paddingBottom: `${paddingBottom}px` } }))] })] }));
|
|
1638
1637
|
};
|
|
1639
1638
|
|
|
1640
1639
|
const useNumberRangeFilterStyles$2 = makeStyles({
|
|
@@ -2093,7 +2092,7 @@ function TableRow({ row, rowSelectionMode, style }) {
|
|
|
2093
2092
|
const styles = useTableBodyStyles();
|
|
2094
2093
|
return (jsxs("tr", { className: row.getIsSelected() || row.getIsAllSubRowsSelected()
|
|
2095
2094
|
? styles.tBodySelectedRow
|
|
2096
|
-
: styles.tBodyRow, style: style, children: [jsxs(Switch
|
|
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()
|
|
2097
2096
|
? 'mixed'
|
|
2098
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));
|
|
2099
2098
|
}
|
|
@@ -2110,7 +2109,7 @@ function PinnedRow({ row, rowSelectionMode, style, bottomRowLength }) {
|
|
|
2110
2109
|
bottom: row.getIsPinned() === 'bottom'
|
|
2111
2110
|
? `${((bottomRowLength || 0) - 1 - row.getPinnedIndex()) * 35}px`
|
|
2112
2111
|
: undefined
|
|
2113
|
-
}, children: [jsxs(Switch
|
|
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()
|
|
2114
2113
|
? 'mixed'
|
|
2115
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 => {
|
|
2116
2115
|
return (jsx(TableCell, { cell: cell, row: row }, cell.id));
|
|
@@ -2177,7 +2176,7 @@ const TableContainer = (props) => {
|
|
|
2177
2176
|
const isLoading = props.isLoading && itemLength === 0;
|
|
2178
2177
|
const noItems = !isLoading && ((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) === 0;
|
|
2179
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;
|
|
2180
|
-
return (jsxs("div", { ref: tableContainerRef, className: styles.tableContainer, style: { height: tableHeight }, children: [jsxs("table", { className: styles.table, "aria-label": "Data Grid", style: { width: table.getTotalSize(), minWidth: "100%" }, children: [jsx(TableHeader, { table: table, rowSelectionMode: rowSelectionMode, headerGroups: headerGroups }), jsx(TableBody, { table: table, tableContainerRef: tableContainerRef })] }), jsxs(Switch
|
|
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 }) })] })] }));
|
|
2181
2180
|
};
|
|
2182
2181
|
|
|
2183
2182
|
const ViewSaveForm = (props) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prt-ts/fluent-react-table-v2",
|
|
3
|
-
"version": "9.46.8-build.
|
|
3
|
+
"version": "9.46.8-build.6.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": ">=17.0.0",
|
|
6
6
|
"react-dom": ">=17.0.0",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@tanstack/react-table": ">=8.10.7",
|
|
12
|
-
"@tanstack/react-virtual": ">=3.0.0",
|
|
13
12
|
"@dnd-kit/core": ">6.0.0",
|
|
14
13
|
"@dnd-kit/modifiers": ">=7.0.0",
|
|
15
14
|
"@dnd-kit/sortable": ">=8.0.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Column, Table } from '@tanstack/react-table';
|
|
2
|
-
export declare const FilterMultiSelectCheckbox: <TItem extends
|
|
2
|
+
export declare const FilterMultiSelectCheckbox: <TItem extends object>({ column, table, }: {
|
|
3
3
|
column: Column<TItem, unknown>;
|
|
4
4
|
table: Table<TItem>;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Column, Table } from "@tanstack/react-table";
|
|
2
|
-
export declare const FilterSelectRadio: <TItem extends
|
|
2
|
+
export declare const FilterSelectRadio: <TItem extends object>({ column, table, }: {
|
|
3
3
|
column: Column<TItem, unknown>;
|
|
4
4
|
table: Table<TItem>;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|