@prt-ts/fluent-react-table-v2 9.46.8-build.9.0 → 9.47.1-build-1.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 +101 -51
- package/index.esm.js +83 -37
- package/package.json +2 -2
- package/src/lib/components/extensions/PinRowAction.d.ts +6 -0
- package/src/lib/components/extensions/SelectRowCheckbox.d.ts +6 -0
- package/src/lib/components/extensions/SelectRowRadio.d.ts +6 -0
- package/src/lib/components/extensions/index.d.ts +3 -0
- package/src/lib/components/filters/Filter.d.ts +1 -1
- package/src/lib/components/filters/FilterMultiSelectCheckbox.d.ts +1 -1
- package/src/lib/components/filters/FilterSelectRadio.d.ts +1 -1
- package/src/lib/components/tbody/TableRow.d.ts +7 -5
- package/src/lib/components/thead/HeaderCell.d.ts +2 -4
- package/src/lib/components/thead/HeaderRow.d.ts +0 -2
- package/src/lib/helpers/Shorthands.d.ts +10 -0
- package/src/lib/helpers/StylesHelper.d.ts +2 -1
- package/src/lib/index.d.ts +5 -2
- package/src/lib/types/TableProps.d.ts +7 -0
package/index.cjs.js
CHANGED
|
@@ -15,25 +15,36 @@ var core = require('@dnd-kit/core');
|
|
|
15
15
|
var modifiers = require('@dnd-kit/modifiers');
|
|
16
16
|
|
|
17
17
|
function _interopNamespace(e) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
if (e && e.__esModule) return e;
|
|
19
|
+
var n = Object.create(null);
|
|
20
|
+
if (e) {
|
|
21
|
+
Object.keys(e).forEach(function (k) {
|
|
22
|
+
if (k !== 'default') {
|
|
23
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
24
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return e[k]; }
|
|
27
|
+
});
|
|
28
|
+
}
|
|
27
29
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
n["default"] = e;
|
|
32
|
-
return Object.freeze(n);
|
|
30
|
+
}
|
|
31
|
+
n["default"] = e;
|
|
32
|
+
return Object.freeze(n);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
36
36
|
|
|
37
|
+
const disableAllShorthand = {
|
|
38
|
+
enableGrouping: false,
|
|
39
|
+
enableHiding: false,
|
|
40
|
+
enablePinning: false,
|
|
41
|
+
enableSorting: false,
|
|
42
|
+
enableColumnFilter: false,
|
|
43
|
+
enableGlobalFilter: false,
|
|
44
|
+
enableMultiSort: false,
|
|
45
|
+
enableResizing: false,
|
|
46
|
+
};
|
|
47
|
+
|
|
37
48
|
const useStaticStyles = reactComponents.makeStaticStyles({
|
|
38
49
|
"*": {
|
|
39
50
|
boxSizing: "border-box",
|
|
@@ -1041,6 +1052,9 @@ const SaveFilled = /*#__PURE__*/createFluentIcon('SaveFilled', "1em", ["M3 5c0-1
|
|
|
1041
1052
|
const SaveRegular = /*#__PURE__*/createFluentIcon('SaveRegular', "1em", ["M3 5c0-1.1.9-2 2-2h8.38a2 2 0 0 1 1.41.59l1.62 1.62A2 2 0 0 1 17 6.62V15a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm2-1a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1v-4.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V16a1 1 0 0 0 1-1V6.62a1 1 0 0 0-.3-.7L14.1 4.28a1 1 0 0 0-.71-.29H13v2.5c0 .83-.67 1.5-1.5 1.5h-4A1.5 1.5 0 0 1 6 6.5V4H5Zm2 0v2.5c0 .28.22.5.5.5h4a.5.5 0 0 0 .5-.5V4H7Zm7 12v-4.5a.5.5 0 0 0-.5-.5h-7a.5.5 0 0 0-.5.5V16h8Z"]);
|
|
1042
1053
|
const SearchFilled = /*#__PURE__*/createFluentIcon('SearchFilled', "1em", ["M8.5 3a5.5 5.5 0 0 1 4.38 8.82l4.15 4.15a.75.75 0 0 1-.98 1.13l-.08-.07-4.15-4.15A5.5 5.5 0 1 1 8.5 3Zm0 1.5a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z"]);
|
|
1043
1054
|
const SearchRegular = /*#__PURE__*/createFluentIcon('SearchRegular', "1em", ["M8.5 3a5.5 5.5 0 0 1 4.23 9.02l4.12 4.13a.5.5 0 0 1-.63.76l-.07-.06-4.13-4.12A5.5 5.5 0 1 1 8.5 3Zm0 1a4.5 4.5 0 1 0 0 9 4.5 4.5 0 0 0 0-9Z"]);
|
|
1055
|
+
const StarRegular = /*#__PURE__*/createFluentIcon('StarRegular', "1em", ["M9.1 2.9a1 1 0 0 1 1.8 0l1.93 3.91 4.31.63a1 1 0 0 1 .56 1.7l-3.12 3.05.73 4.3a1 1 0 0 1-1.45 1.05L10 15.51l-3.86 2.03a1 1 0 0 1-1.45-1.05l.74-4.3L2.3 9.14a1 1 0 0 1 .56-1.7l4.31-.63L9.1 2.9Zm.9.44L8.07 7.25a1 1 0 0 1-.75.55L3 8.43l3.12 3.04a1 1 0 0 1 .3.89l-.75 4.3 3.87-2.03a1 1 0 0 1 .93 0l3.86 2.03-.74-4.3a1 1 0 0 1 .29-.89L17 8.43l-4.32-.63a1 1 0 0 1-.75-.55L10 3.35Z"]);
|
|
1056
|
+
const SwipeDownFilled = /*#__PURE__*/createFluentIcon('SwipeDownFilled', "1em", ["M14 6a4 4 0 0 1-2.25 3.6V8.44a3 3 0 1 0-3.5 0V9.6A4 4 0 1 1 14 6ZM9.47 17.78c.3.3.77.3 1.06 0l2.5-2.5a.75.75 0 1 0-1.06-1.06l-1.22 1.22V5.75a.75.75 0 0 0-1.5 0v9.69l-1.22-1.22a.75.75 0 0 0-1.06 1.06l2.5 2.5Z"]);
|
|
1057
|
+
const SwipeUpFilled = /*#__PURE__*/createFluentIcon('SwipeUpFilled', "1em", ["M10.53 2.22a.75.75 0 0 0-1.06 0l-2.5 2.5a.75.75 0 0 0 1.06 1.06l1.22-1.22v9.69a.75.75 0 0 0 1.5 0V4.56l1.22 1.22a.75.75 0 1 0 1.06-1.06l-2.5-2.5ZM6 14a4 4 0 0 1 2.25-3.6v1.16a3 3 0 1 0 3.5 0V10.4A4 4 0 1 1 6 14Z"]);
|
|
1044
1058
|
|
|
1045
1059
|
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"]);
|
|
1046
1060
|
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"]);
|
|
@@ -1176,10 +1190,11 @@ const useGridHeaderStyles = reactComponents.makeStyles({
|
|
|
1176
1190
|
|
|
1177
1191
|
const GridHeader = (props) => {
|
|
1178
1192
|
const { table, gridTitle, globalFilter, setGlobalFilter } = props;
|
|
1193
|
+
const focusAttribute = reactComponents.useArrowNavigationGroup({ axis: "horizontal", circular: true });
|
|
1179
1194
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
1180
1195
|
const { dispatchDrawerAction, drawerState } = table.options.meta;
|
|
1181
1196
|
const styles = useGridHeaderStyles();
|
|
1182
|
-
return (jsxRuntime.jsxs("div", { className: styles.tableTopHeaderContainer, children: [jsxRuntime.jsx("div", { className: styles.tableTopHeaderLeft, children: gridTitle }), jsxRuntime.jsxs("div", { className: styles.tableTopHeaderRight, children: [props.headerMenu, props.headerMenu && jsxRuntime.jsx(reactComponents.Divider, { vertical: true }), jsxRuntime.jsxs(reactComponents.Popover, { withArrow: true, children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { disableButtonEnhancement: true, children: jsxRuntime.jsx(reactComponents.Tooltip, { content: 'Toggle Group Column', relationship: "label", children: jsxRuntime.jsx(reactComponents.Button, { icon: jsxRuntime.jsx(ToggleGroupColumnIcon, {}), "aria-label": "Toggle Group Column" }) }) }), jsxRuntime.jsx(reactComponents.PopoverSurface, { className: styles.popoverSurface, children: jsxRuntime.jsxs("div", { className: styles.tableTopHeaderColumnTogglePopover, children: [jsxRuntime.jsx(reactComponents.MenuGroupHeader, { children: "Group Columns" }), table.getAllLeafColumns().map((column) => {
|
|
1197
|
+
return (jsxRuntime.jsxs("div", { className: styles.tableTopHeaderContainer, children: [jsxRuntime.jsx("div", { className: styles.tableTopHeaderLeft, children: gridTitle }), jsxRuntime.jsxs("div", Object.assign({ className: styles.tableTopHeaderRight }, focusAttribute, { children: [props.headerMenu, props.headerMenu && jsxRuntime.jsx(reactComponents.Divider, { vertical: true }), jsxRuntime.jsxs(reactComponents.Popover, { withArrow: true, children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { disableButtonEnhancement: true, children: jsxRuntime.jsx(reactComponents.Tooltip, { content: 'Toggle Group Column', relationship: "label", children: jsxRuntime.jsx(reactComponents.Button, { icon: jsxRuntime.jsx(ToggleGroupColumnIcon, {}), "aria-label": "Toggle Group Column" }) }) }), jsxRuntime.jsx(reactComponents.PopoverSurface, { className: styles.popoverSurface, children: jsxRuntime.jsxs("div", { className: styles.tableTopHeaderColumnTogglePopover, children: [jsxRuntime.jsx(reactComponents.MenuGroupHeader, { children: "Group Columns" }), table.getAllLeafColumns().map((column) => {
|
|
1183
1198
|
if (column.id === 'select')
|
|
1184
1199
|
return null;
|
|
1185
1200
|
if (column.id === 'id')
|
|
@@ -1191,7 +1206,7 @@ const GridHeader = (props) => {
|
|
|
1191
1206
|
return (jsxRuntime.jsx(reactComponents.Checkbox, { checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler(), label: column.id, disabled: !column.getCanHide() }, column.id));
|
|
1192
1207
|
})] }) })] }), jsxRuntime.jsx(reactComponents.Tooltip, { content: 'Table Views Management', relationship: "label", children: jsxRuntime.jsx(reactComponents.Button, { onClick: () => {
|
|
1193
1208
|
dispatchDrawerAction === null || dispatchDrawerAction === void 0 ? void 0 : dispatchDrawerAction({ type: "TOGGLE_VIEW_DRAWER" });
|
|
1194
|
-
}, 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...", dispatch: dispatchDrawerAction, drawerState: drawerState })] })] }));
|
|
1209
|
+
}, 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...", dispatch: dispatchDrawerAction, drawerState: drawerState })] }))] }));
|
|
1195
1210
|
};
|
|
1196
1211
|
// A debounced input react component
|
|
1197
1212
|
function DebouncedInput({ value: initialValue, onChange, debounce = 500, drawerState, dispatch, }) {
|
|
@@ -1297,7 +1312,7 @@ function tableReducer(state, action) {
|
|
|
1297
1312
|
}
|
|
1298
1313
|
|
|
1299
1314
|
const useGridContainer = (props, ref) => {
|
|
1300
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1315
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1301
1316
|
const { defaultColumn, columns, data, rowSelectionMode, autoResetPageIndex, onUpdateData } = props;
|
|
1302
1317
|
const [drawerState, dispatch] = React__namespace.useReducer(tableReducer, {
|
|
1303
1318
|
isFilterDrawerOpen: false,
|
|
@@ -1354,7 +1369,7 @@ const useGridContainer = (props, ref) => {
|
|
|
1354
1369
|
rowPinning
|
|
1355
1370
|
},
|
|
1356
1371
|
getRowId(originalRow, index, parent) {
|
|
1357
|
-
const keyProps = props.dataPrimaryKye
|
|
1372
|
+
const keyProps = props.dataPrimaryKye;
|
|
1358
1373
|
return originalRow[keyProps] || `${index}`;
|
|
1359
1374
|
},
|
|
1360
1375
|
columnResizeMode: 'onChange',
|
|
@@ -1409,7 +1424,8 @@ const useGridContainer = (props, ref) => {
|
|
|
1409
1424
|
setExpanded,
|
|
1410
1425
|
setColumnPinning,
|
|
1411
1426
|
setColumnSizing,
|
|
1412
|
-
setRowPinning
|
|
1427
|
+
setRowPinning,
|
|
1428
|
+
tableSettings: (_l = props.tableSettings) !== null && _l !== void 0 ? _l : {},
|
|
1413
1429
|
}
|
|
1414
1430
|
});
|
|
1415
1431
|
const tableViews = React__namespace.useMemo(() => { var _a; return (_a = props.views) !== null && _a !== void 0 ? _a : []; }, [props.views]);
|
|
@@ -1585,6 +1601,10 @@ const getBodyCellPinningStyles = (column, isDragging, additionalStyles) => {
|
|
|
1585
1601
|
: 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 ? 2 : (isPinned ? 1 : 0) }, additionalStyles);
|
|
1586
1602
|
return styles;
|
|
1587
1603
|
};
|
|
1604
|
+
const getRowPinningStyles = (row, bottomRowLength, headerGroupLength, additionalStyles) => {
|
|
1605
|
+
const styles = Object.assign({ backgroundColor: reactComponents.tokens.colorPaletteYellowBackground2, position: 'sticky', top: row.getIsPinned() === 'top' ? `${row.getPinnedIndex() * 35 + (39 * headerGroupLength)}px` : undefined, bottom: row.getIsPinned() === 'bottom' ? `${((bottomRowLength || 0) - 1 - row.getPinnedIndex()) * 35}px` : undefined }, additionalStyles);
|
|
1606
|
+
return styles;
|
|
1607
|
+
};
|
|
1588
1608
|
|
|
1589
1609
|
const MoreIcon = bundleIcon$1(MoreVerticalFilled, MoreVerticalRegular);
|
|
1590
1610
|
const SortAscIcon = bundleIcon$1(ArrowSortDown20Filled, ArrowSortDown20Regular);
|
|
@@ -1593,9 +1613,9 @@ const PinIcon = bundleIcon$1(PinFilled, PinRegular);
|
|
|
1593
1613
|
const HideColumnIcon = bundleIcon$1(EyeTrackingOffFilled, EyeTrackingOffRegular);
|
|
1594
1614
|
const GroupExpandIcon = bundleIcon$1(TextExpandFilled, TextExpandRegular);
|
|
1595
1615
|
const GroupCollapseIcon = bundleIcon$1(TextCollapseFilled, TextCollapseRegular);
|
|
1596
|
-
function HeaderCell({ header, table,
|
|
1597
|
-
var _a;
|
|
1598
|
-
const { column } = header;
|
|
1616
|
+
function HeaderCell({ header, table, tabAttributes }) {
|
|
1617
|
+
var _a, _b, _c;
|
|
1618
|
+
const { column, id } = header;
|
|
1599
1619
|
const { isDragging, attributes, listeners, setNodeRef, transform, transition, } = sortable.useSortable({
|
|
1600
1620
|
id: column.id
|
|
1601
1621
|
});
|
|
@@ -1604,13 +1624,13 @@ function HeaderCell({ header, table, hideMenu, headerDepth, totalNumberOfHeaderD
|
|
|
1604
1624
|
transition
|
|
1605
1625
|
};
|
|
1606
1626
|
const styles = useTableHeaderStyles();
|
|
1607
|
-
const isLeafHeaders =
|
|
1627
|
+
const isLeafHeaders = ((_b = (_a = `${id}`) === null || _a === void 0 ? void 0 : _a.split('_')) === null || _b === void 0 ? void 0 : _b.length) === 1;
|
|
1608
1628
|
const headerCellCombinedStyles = getHeaderCellPinningStyles(column, isDragging, dndStyle);
|
|
1609
1629
|
if (header.isPlaceholder) {
|
|
1610
1630
|
return (jsxRuntime.jsx("th", { colSpan: header.colSpan, className: styles.tHeadCell, style: headerCellCombinedStyles, ref: setNodeRef, children: jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getCanResize(), children: jsxRuntime.jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: reactComponents.mergeClasses(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }) }));
|
|
1611
1631
|
}
|
|
1612
1632
|
const columnName = reactTable.flexRender(header.column.columnDef.header, header.getContext());
|
|
1613
|
-
return (jsxRuntime.jsxs("th", { colSpan: header.colSpan, className: reactComponents.mergeClasses(styles.tHeadCell, isLeafHeaders && styles.tHeadNonLeafCell, isDragging && styles.tHeadCellDragging), style: headerCellCombinedStyles, ref: setNodeRef, children: [jsxRuntime.jsx("div", Object.assign({ className: styles.tHeadCellDraggable }, attributes, listeners, { children: jsxRuntime.jsxs("div", { className: isLeafHeaders
|
|
1633
|
+
return (jsxRuntime.jsxs("th", Object.assign({ colSpan: header.colSpan, className: reactComponents.mergeClasses(styles.tHeadCell, isLeafHeaders && styles.tHeadNonLeafCell, isDragging && styles.tHeadCellDragging), style: headerCellCombinedStyles, ref: setNodeRef }, tabAttributes, { tabIndex: 0, children: [jsxRuntime.jsx("div", Object.assign({ className: styles.tHeadCellDraggable }, attributes, listeners, { children: jsxRuntime.jsxs("div", { className: isLeafHeaders
|
|
1614
1634
|
? styles.tLeafHeadCellContent
|
|
1615
1635
|
: styles.tNonLeafHeadCellContent, children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx(reactControlFlow.Show, { when: !header.isPlaceholder, children: jsxRuntime.jsxs(reactComponents.Button, { style: {
|
|
1616
1636
|
display: 'flex',
|
|
@@ -1625,10 +1645,10 @@ function HeaderCell({ header, table, hideMenu, headerDepth, totalNumberOfHeaderD
|
|
|
1625
1645
|
if (!header.column.getCanGroup())
|
|
1626
1646
|
return;
|
|
1627
1647
|
header.column.getToggleGroupingHandler()();
|
|
1628
|
-
}, appearance: "transparent", className: styles.tHeadContentBtn, icon: (
|
|
1648
|
+
}, appearance: "transparent", className: styles.tHeadContentBtn, icon: (_c = {
|
|
1629
1649
|
asc: (jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(SortAscIcon, {}) })),
|
|
1630
1650
|
desc: (jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(SortDescIcon, {}) })),
|
|
1631
|
-
}[header.column.getIsSorted()]) !== null &&
|
|
1651
|
+
}[header.column.getIsSorted()]) !== null && _c !== void 0 ? _c : undefined, iconPosition: "after", children: [jsxRuntime.jsx("strong", { children: columnName }), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getIsGrouped(), children: jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(GroupListRegular, {}) }) }), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getIsFiltered(), children: jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(FilterFilled, {}) }) }), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getIsPinned(), children: jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(PinRegular, {}) }) })] }) }) }), jsxRuntime.jsx(HeaderMenu, { header: header, table: table, hideMenu: !isLeafHeaders })] }) })), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getCanResize(), children: jsxRuntime.jsx("div", { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), className: reactComponents.mergeClasses(styles.resizer, column.getIsResizing() && styles.resizerActive) }) }), jsxRuntime.jsx(reactControlFlow.Show, { when: !isLeafHeaders, children: jsxRuntime.jsx("div", { className: styles.tHeadNonLeafCellFakeBorder }) })] })));
|
|
1632
1652
|
}
|
|
1633
1653
|
function HeaderMenu(props) {
|
|
1634
1654
|
const { header, table, hideMenu } = props;
|
|
@@ -1686,19 +1706,24 @@ function HeaderMenu(props) {
|
|
|
1686
1706
|
}
|
|
1687
1707
|
|
|
1688
1708
|
function HeaderRow(props) {
|
|
1709
|
+
var _a;
|
|
1689
1710
|
const styles = useTableHeaderStyles();
|
|
1690
|
-
const { table, headerGroup,
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1711
|
+
const { table, headerGroup, headerGroupsLength } = props;
|
|
1712
|
+
const { rowSelectionMode, tableSettings } = (_a = table.options.meta) !== null && _a !== void 0 ? _a : {};
|
|
1713
|
+
const headerCellTabAttributes = reactComponents.useFocusableGroup({ tabBehavior: "limited" });
|
|
1714
|
+
const isLeafHeaders = headerGroup.depth === headerGroupsLength - 1;
|
|
1715
|
+
return (jsxRuntime.jsxs("tr", { className: styles.tHeadRow, children: [jsxRuntime.jsx(reactControlFlow.Show, { when: !(tableSettings === null || tableSettings === void 0 ? void 0 : tableSettings.enableManualSelection), children: jsxRuntime.jsxs(reactControlFlow.Switch, { when: rowSelectionMode, children: [jsxRuntime.jsx(reactControlFlow.Case, { value: "multiple", children: jsxRuntime.jsx("th", { style: { width: '1rem' }, "aria-label": "Select All Row", children: jsxRuntime.jsx(reactControlFlow.Show, { when: isLeafHeaders, children: jsxRuntime.jsx(reactComponents.Checkbox, { checked: table.getIsSomeRowsSelected()
|
|
1716
|
+
? 'mixed'
|
|
1717
|
+
: table.getIsAllRowsSelected(), onChange: table.getToggleAllRowsSelectedHandler(), "aria-label": "Select All Rows", title: 'Select All Rows' }) }) }) }), jsxRuntime.jsx(reactControlFlow.Case, { value: "single", children: jsxRuntime.jsx("th", { style: { width: '1rem' }, "aria-label": "Select All Row Column", children: ' ' }) })] }) }), jsxRuntime.jsx(reactControlFlow.For, { each: headerGroup.headers, children: (header, index) => {
|
|
1718
|
+
return (jsxRuntime.jsx(HeaderCell, { header: header, table: table, tabAttributes: headerCellTabAttributes }, `${header.id}_${index}`));
|
|
1719
|
+
} })] }, headerGroup.id));
|
|
1696
1720
|
}
|
|
1697
1721
|
|
|
1698
1722
|
function TableHeader(props) {
|
|
1699
1723
|
const styles = useTableHeaderStyles();
|
|
1700
1724
|
const { table, headerGroups, rowSelectionMode } = props;
|
|
1701
|
-
|
|
1725
|
+
const focusAttribute = reactComponents.useFocusableGroup({ tabBehavior: "limited-trap-focus" });
|
|
1726
|
+
return (jsxRuntime.jsx("thead", Object.assign({ className: styles.tHead, style: { zIndex: 99 } }, focusAttribute, { tabIndex: 0, children: headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map((headerGroup) => (jsxRuntime.jsx(HeaderRow, { table: table, rowSelectionMode: rowSelectionMode, headerGroup: headerGroup, headerGroupsLength: headerGroups.length }, headerGroup.id))) })));
|
|
1702
1727
|
}
|
|
1703
1728
|
|
|
1704
1729
|
const useLoadingStyles = reactComponents.makeStyles({
|
|
@@ -1821,31 +1846,51 @@ function TableCell({ cell, row }) {
|
|
|
1821
1846
|
return (jsxRuntime.jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
|
|
1822
1847
|
}
|
|
1823
1848
|
|
|
1824
|
-
|
|
1849
|
+
const PinRowAction = ({ row }) => {
|
|
1850
|
+
const isPinned = row.getIsPinned();
|
|
1851
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(reactControlFlow.Show, { when: isPinned, children: jsxRuntime.jsx(reactComponents.Button, { size: "small", shape: "circular", onClick: () => row.pin(false, true, false), icon: jsxRuntime.jsx(PinOffRegular, {}) }) }), jsxRuntime.jsx(reactControlFlow.Show, { when: !isPinned, children: jsxRuntime.jsx("div", { children: jsxRuntime.jsxs(reactComponents.Menu, { children: [jsxRuntime.jsx(reactComponents.MenuTrigger, { disableButtonEnhancement: true, children: jsxRuntime.jsx(reactComponents.Button, { icon: jsxRuntime.jsx(StarRegular, {}), shape: "circular", size: "small" }) }), jsxRuntime.jsx(reactComponents.MenuPopover, { children: jsxRuntime.jsxs(reactComponents.MenuList, { children: [jsxRuntime.jsx(reactComponents.MenuItem, { icon: jsxRuntime.jsx(SwipeUpFilled, {}), onClick: () => row.pin('top', true, false), children: "Top" }), jsxRuntime.jsx(reactComponents.MenuItem, { icon: jsxRuntime.jsx(SwipeDownFilled, {}), onClick: () => row.pin('bottom', true, true), children: "Bottom" })] }) })] }) }) })] }));
|
|
1852
|
+
};
|
|
1853
|
+
|
|
1854
|
+
const SelectRowCheckbox = ({ row }) => {
|
|
1855
|
+
const canCheck = row.getCanSelect();
|
|
1856
|
+
const isChecked = row.getIsSomeSelected() ? 'mixed' : (row.getIsSelected() || row.getIsAllSubRowsSelected());
|
|
1857
|
+
return (jsxRuntime.jsx(reactComponents.Checkbox, { checked: isChecked, disabled: !canCheck, onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }));
|
|
1858
|
+
};
|
|
1859
|
+
|
|
1860
|
+
const SelectRowRadio = ({ row }) => {
|
|
1861
|
+
const canCheck = row.getCanSelect();
|
|
1862
|
+
const isChecked = row.getIsSelected();
|
|
1863
|
+
return (jsxRuntime.jsx(reactComponents.Radio, { checked: isChecked, disabled: !canCheck, onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }));
|
|
1864
|
+
};
|
|
1865
|
+
|
|
1866
|
+
function TableRowRaw({ row, table, style, tabAttributes }) {
|
|
1867
|
+
var _a;
|
|
1825
1868
|
const styles = useTableBodyStyles();
|
|
1826
|
-
|
|
1869
|
+
const { rowSelectionMode, tableSettings } = (_a = table.options.meta) !== null && _a !== void 0 ? _a : {};
|
|
1870
|
+
return (jsxRuntime.jsxs("tr", Object.assign({ className: row.getIsSelected() || row.getIsAllSubRowsSelected()
|
|
1827
1871
|
? styles.tBodySelectedRow
|
|
1828
|
-
: styles.tBodyRow, style: style, children: [jsxRuntime.jsxs(reactControlFlow.Switch, { when: rowSelectionMode, children: [jsxRuntime.jsx(reactControlFlow.Case, { value: 'multiple', children: jsxRuntime.jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row
|
|
1829
|
-
? 'mixed'
|
|
1830
|
-
: row.getIsSelected() || row.getIsAllSubRowsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) }), jsxRuntime.jsx(reactControlFlow.Case, { value: 'single', children: jsxRuntime.jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsxRuntime.jsx(reactComponents.Radio, { checked: row.getIsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) })] }), row.getVisibleCells().map((cell) => (jsxRuntime.jsx(TableCell, { cell: cell, row: row }, cell.id)))] }, row.id));
|
|
1872
|
+
: styles.tBodyRow, style: style }, tabAttributes, { tabIndex: 0, children: [jsxRuntime.jsx(reactControlFlow.Show, { when: !(tableSettings === null || tableSettings === void 0 ? void 0 : tableSettings.enableManualSelection), children: jsxRuntime.jsxs(reactControlFlow.Switch, { when: rowSelectionMode, children: [jsxRuntime.jsx(reactControlFlow.Case, { value: 'multiple', children: jsxRuntime.jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row", children: jsxRuntime.jsx(SelectRowCheckbox, { row: row }) }) }), jsxRuntime.jsx(reactControlFlow.Case, { value: 'single', children: jsxRuntime.jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row", children: jsxRuntime.jsx(SelectRowRadio, { row: row }) }) })] }) }), row.getVisibleCells().map((cell) => (jsxRuntime.jsx(TableCell, { cell: cell, row: row }, cell.id)))] }), row.id));
|
|
1831
1873
|
}
|
|
1832
|
-
function
|
|
1874
|
+
function PinnedRowRaw({ row, table, style, bottomRowLength, tabAttributes }) {
|
|
1875
|
+
var _a;
|
|
1833
1876
|
const styles = useTableBodyStyles();
|
|
1834
|
-
const
|
|
1835
|
-
|
|
1877
|
+
const headerGroupLength = table.getHeaderGroups().length;
|
|
1878
|
+
const pinnedRowRawStyle = getRowPinningStyles(row, bottomRowLength || 0, headerGroupLength, style || {});
|
|
1879
|
+
const { rowSelectionMode, tableSettings } = (_a = table.options.meta) !== null && _a !== void 0 ? _a : {};
|
|
1880
|
+
return (jsxRuntime.jsxs("tr", Object.assign({ className: row.getIsSelected() || row.getIsAllSubRowsSelected()
|
|
1836
1881
|
? styles.tBodySelectedRow
|
|
1837
|
-
: styles.tBodyRow, style: pinnedRowRawStyle, children: [jsxRuntime.jsxs(reactControlFlow.Switch, { when: rowSelectionMode, children: [jsxRuntime.jsx(reactControlFlow.Case, { value: 'multiple', children: jsxRuntime.jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsxRuntime.jsx(
|
|
1838
|
-
? 'mixed'
|
|
1839
|
-
: row.getIsSelected() || row.getIsAllSubRowsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) }), jsxRuntime.jsx(reactControlFlow.Case, { value: 'single', children: jsxRuntime.jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsxRuntime.jsx(reactComponents.Radio, { checked: row.getIsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) })] }), row.getVisibleCells().map(cell => {
|
|
1882
|
+
: styles.tBodyRow, style: pinnedRowRawStyle }, tabAttributes, { tabIndex: 0, children: [jsxRuntime.jsx(reactControlFlow.Show, { when: !(tableSettings === null || tableSettings === void 0 ? void 0 : tableSettings.enableManualSelection), children: jsxRuntime.jsxs(reactControlFlow.Switch, { when: rowSelectionMode, children: [jsxRuntime.jsx(reactControlFlow.Case, { value: 'multiple', children: jsxRuntime.jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsxRuntime.jsx(SelectRowCheckbox, { row: row }) }) }), jsxRuntime.jsx(reactControlFlow.Case, { value: 'single', children: jsxRuntime.jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsxRuntime.jsx(SelectRowRadio, { row: row }) }) })] }) }), row.getVisibleCells().map(cell => {
|
|
1840
1883
|
return (jsxRuntime.jsx(TableCell, { cell: cell, row: row }, cell.id));
|
|
1841
|
-
})] }, row.id));
|
|
1884
|
+
})] }), row.id));
|
|
1842
1885
|
}
|
|
1886
|
+
const TableRow = TableRowRaw;
|
|
1887
|
+
const PinnedRow = PinnedRowRaw;
|
|
1843
1888
|
|
|
1844
1889
|
function TableBody(props) {
|
|
1845
1890
|
var _a, _b, _c;
|
|
1846
1891
|
const styles = useTableBodyStyles();
|
|
1847
1892
|
const { table, tableContainerRef } = props;
|
|
1848
|
-
const rowSelectionMode = (_a = table.options.meta)
|
|
1893
|
+
const { rowSelectionMode } = (_a = table.options.meta) !== null && _a !== void 0 ? _a : {};
|
|
1849
1894
|
let rows = [];
|
|
1850
1895
|
let topRows = [];
|
|
1851
1896
|
let bottomRows = [];
|
|
@@ -1869,13 +1914,14 @@ function TableBody(props) {
|
|
|
1869
1914
|
const paddingBottom = virtualRows.length > 0
|
|
1870
1915
|
? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
|
|
1871
1916
|
: 0;
|
|
1917
|
+
const tabAttributes = reactComponents.useFocusableGroup({ tabBehavior: "limited" });
|
|
1872
1918
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(reactControlFlow.Show, { when: (topRows === null || topRows === void 0 ? void 0 : topRows.length) > 0, children: jsxRuntime.jsx("thead", { style: {
|
|
1873
1919
|
position: "sticky",
|
|
1874
1920
|
top: 0,
|
|
1875
1921
|
zIndex: 9
|
|
1876
|
-
}, children: jsxRuntime.jsx(reactControlFlow.For, { each: topRows, children: (row, index) => (jsxRuntime.jsx(PinnedRow, { row: row,
|
|
1922
|
+
}, children: jsxRuntime.jsx(reactControlFlow.For, { each: topRows, children: (row, index) => (jsxRuntime.jsx(PinnedRow, { row: row, table: table, bottomRowLength: bottomRows === null || bottomRows === void 0 ? void 0 : bottomRows.length, tabAttributes: tabAttributes }, `${row.id}_${index}`)) }) }) }), jsxRuntime.jsxs("tbody", { className: styles.tBody, children: [paddingTop > 0 && (jsxRuntime.jsx("tr", { className: styles.tBodyRow, "aria-hidden": true, children: jsxRuntime.jsx("td", { style: { height: `${paddingTop}px` } }) })), jsxRuntime.jsx(reactControlFlow.For, { each: virtualRows || [], children: (virtualRow) => {
|
|
1877
1923
|
const row = rows[virtualRow.index];
|
|
1878
|
-
return (jsxRuntime.jsx(TableRow, { row: row,
|
|
1924
|
+
return (jsxRuntime.jsx(TableRow, { row: row, table: table, tabAttributes: tabAttributes }, row.id));
|
|
1879
1925
|
} }), paddingBottom > 0 && (jsxRuntime.jsx("tr", { className: styles.tBodyRow, "aria-hidden": true, children: jsxRuntime.jsx("td", { style: { height: `${paddingBottom}px` } }) }))] }), jsxRuntime.jsx(reactControlFlow.Show, { when: rowSelectionMode === 'multiple' && (rows === null || rows === void 0 ? void 0 : rows.length) > 0, children: jsxRuntime.jsx("tfoot", { style: {
|
|
1880
1926
|
position: "sticky",
|
|
1881
1927
|
bottom: 0,
|
|
@@ -1886,7 +1932,7 @@ function TableBody(props) {
|
|
|
1886
1932
|
position: "sticky",
|
|
1887
1933
|
bottom: 0,
|
|
1888
1934
|
zIndex: 9
|
|
1889
|
-
}, children: jsxRuntime.jsx(reactControlFlow.For, { each: bottomRows, children: (row) => (jsxRuntime.jsx(PinnedRow, { row: row,
|
|
1935
|
+
}, children: jsxRuntime.jsx(reactControlFlow.For, { each: bottomRows, children: (row) => (jsxRuntime.jsx(PinnedRow, { row: row, table: table, bottomRowLength: bottomRows === null || bottomRows === void 0 ? void 0 : bottomRows.length, tabAttributes: tabAttributes }, row.id)) }) }) })] }));
|
|
1890
1936
|
}
|
|
1891
1937
|
|
|
1892
1938
|
const TableContainer = (props) => {
|
|
@@ -2380,8 +2426,12 @@ function useSkipper() {
|
|
|
2380
2426
|
}
|
|
2381
2427
|
|
|
2382
2428
|
Object.defineProperty(exports, 'createColumnHelper', {
|
|
2383
|
-
|
|
2384
|
-
|
|
2429
|
+
enumerable: true,
|
|
2430
|
+
get: function () { return reactTable.createColumnHelper; }
|
|
2385
2431
|
});
|
|
2432
|
+
exports.PinRowAction = PinRowAction;
|
|
2433
|
+
exports.SelectRowCheckbox = SelectRowCheckbox;
|
|
2434
|
+
exports.SelectRowRadio = SelectRowRadio;
|
|
2386
2435
|
exports.Table = ForwardedAdvancedTable;
|
|
2436
|
+
exports.disableAllShorthand = disableAllShorthand;
|
|
2387
2437
|
exports.useSkipper = useSkipper;
|
package/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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, 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';
|
|
4
|
+
import { makeStaticStyles, makeStyles, shorthands, tokens, useId, Dropdown, Option, Input, Button, useArrowNavigationGroup, Divider, Popover, PopoverTrigger, Tooltip, PopoverSurface, MenuGroupHeader, Checkbox, mergeClasses as mergeClasses$1, Menu, MenuTrigger, MenuButton, MenuPopover, MenuList, MenuGroup, MenuItem, MenuDivider, useFocusableGroup, 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';
|
|
@@ -12,6 +12,17 @@ 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
|
|
|
15
|
+
const disableAllShorthand = {
|
|
16
|
+
enableGrouping: false,
|
|
17
|
+
enableHiding: false,
|
|
18
|
+
enablePinning: false,
|
|
19
|
+
enableSorting: false,
|
|
20
|
+
enableColumnFilter: false,
|
|
21
|
+
enableGlobalFilter: false,
|
|
22
|
+
enableMultiSort: false,
|
|
23
|
+
enableResizing: false,
|
|
24
|
+
};
|
|
25
|
+
|
|
15
26
|
const useStaticStyles = makeStaticStyles({
|
|
16
27
|
"*": {
|
|
17
28
|
boxSizing: "border-box",
|
|
@@ -1019,6 +1030,9 @@ const SaveFilled = /*#__PURE__*/createFluentIcon('SaveFilled', "1em", ["M3 5c0-1
|
|
|
1019
1030
|
const SaveRegular = /*#__PURE__*/createFluentIcon('SaveRegular', "1em", ["M3 5c0-1.1.9-2 2-2h8.38a2 2 0 0 1 1.41.59l1.62 1.62A2 2 0 0 1 17 6.62V15a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm2-1a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1v-4.5c0-.83.67-1.5 1.5-1.5h7c.83 0 1.5.67 1.5 1.5V16a1 1 0 0 0 1-1V6.62a1 1 0 0 0-.3-.7L14.1 4.28a1 1 0 0 0-.71-.29H13v2.5c0 .83-.67 1.5-1.5 1.5h-4A1.5 1.5 0 0 1 6 6.5V4H5Zm2 0v2.5c0 .28.22.5.5.5h4a.5.5 0 0 0 .5-.5V4H7Zm7 12v-4.5a.5.5 0 0 0-.5-.5h-7a.5.5 0 0 0-.5.5V16h8Z"]);
|
|
1020
1031
|
const SearchFilled = /*#__PURE__*/createFluentIcon('SearchFilled', "1em", ["M8.5 3a5.5 5.5 0 0 1 4.38 8.82l4.15 4.15a.75.75 0 0 1-.98 1.13l-.08-.07-4.15-4.15A5.5 5.5 0 1 1 8.5 3Zm0 1.5a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z"]);
|
|
1021
1032
|
const SearchRegular = /*#__PURE__*/createFluentIcon('SearchRegular', "1em", ["M8.5 3a5.5 5.5 0 0 1 4.23 9.02l4.12 4.13a.5.5 0 0 1-.63.76l-.07-.06-4.13-4.12A5.5 5.5 0 1 1 8.5 3Zm0 1a4.5 4.5 0 1 0 0 9 4.5 4.5 0 0 0 0-9Z"]);
|
|
1033
|
+
const StarRegular = /*#__PURE__*/createFluentIcon('StarRegular', "1em", ["M9.1 2.9a1 1 0 0 1 1.8 0l1.93 3.91 4.31.63a1 1 0 0 1 .56 1.7l-3.12 3.05.73 4.3a1 1 0 0 1-1.45 1.05L10 15.51l-3.86 2.03a1 1 0 0 1-1.45-1.05l.74-4.3L2.3 9.14a1 1 0 0 1 .56-1.7l4.31-.63L9.1 2.9Zm.9.44L8.07 7.25a1 1 0 0 1-.75.55L3 8.43l3.12 3.04a1 1 0 0 1 .3.89l-.75 4.3 3.87-2.03a1 1 0 0 1 .93 0l3.86 2.03-.74-4.3a1 1 0 0 1 .29-.89L17 8.43l-4.32-.63a1 1 0 0 1-.75-.55L10 3.35Z"]);
|
|
1034
|
+
const SwipeDownFilled = /*#__PURE__*/createFluentIcon('SwipeDownFilled', "1em", ["M14 6a4 4 0 0 1-2.25 3.6V8.44a3 3 0 1 0-3.5 0V9.6A4 4 0 1 1 14 6ZM9.47 17.78c.3.3.77.3 1.06 0l2.5-2.5a.75.75 0 1 0-1.06-1.06l-1.22 1.22V5.75a.75.75 0 0 0-1.5 0v9.69l-1.22-1.22a.75.75 0 0 0-1.06 1.06l2.5 2.5Z"]);
|
|
1035
|
+
const SwipeUpFilled = /*#__PURE__*/createFluentIcon('SwipeUpFilled', "1em", ["M10.53 2.22a.75.75 0 0 0-1.06 0l-2.5 2.5a.75.75 0 0 0 1.06 1.06l1.22-1.22v9.69a.75.75 0 0 0 1.5 0V4.56l1.22 1.22a.75.75 0 1 0 1.06-1.06l-2.5-2.5ZM6 14a4 4 0 0 1 2.25-3.6v1.16a3 3 0 1 0 3.5 0V10.4A4 4 0 1 1 6 14Z"]);
|
|
1022
1036
|
|
|
1023
1037
|
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"]);
|
|
1024
1038
|
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"]);
|
|
@@ -1154,10 +1168,11 @@ const useGridHeaderStyles = makeStyles({
|
|
|
1154
1168
|
|
|
1155
1169
|
const GridHeader = (props) => {
|
|
1156
1170
|
const { table, gridTitle, globalFilter, setGlobalFilter } = props;
|
|
1171
|
+
const focusAttribute = useArrowNavigationGroup({ axis: "horizontal", circular: true });
|
|
1157
1172
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
1158
1173
|
const { dispatchDrawerAction, drawerState } = table.options.meta;
|
|
1159
1174
|
const styles = useGridHeaderStyles();
|
|
1160
|
-
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) => {
|
|
1175
|
+
return (jsxs("div", { className: styles.tableTopHeaderContainer, children: [jsx("div", { className: styles.tableTopHeaderLeft, children: gridTitle }), jsxs("div", Object.assign({ className: styles.tableTopHeaderRight }, focusAttribute, { 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) => {
|
|
1161
1176
|
if (column.id === 'select')
|
|
1162
1177
|
return null;
|
|
1163
1178
|
if (column.id === 'id')
|
|
@@ -1169,7 +1184,7 @@ const GridHeader = (props) => {
|
|
|
1169
1184
|
return (jsx(Checkbox, { checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler(), label: column.id, disabled: !column.getCanHide() }, column.id));
|
|
1170
1185
|
})] }) })] }), jsx(Tooltip, { content: 'Table Views Management', relationship: "label", children: jsx(Button, { onClick: () => {
|
|
1171
1186
|
dispatchDrawerAction === null || dispatchDrawerAction === void 0 ? void 0 : dispatchDrawerAction({ type: "TOGGLE_VIEW_DRAWER" });
|
|
1172
|
-
}, 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 })] })] }));
|
|
1187
|
+
}, 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 })] }))] }));
|
|
1173
1188
|
};
|
|
1174
1189
|
// A debounced input react component
|
|
1175
1190
|
function DebouncedInput({ value: initialValue, onChange, debounce = 500, drawerState, dispatch, }) {
|
|
@@ -1275,7 +1290,7 @@ function tableReducer(state, action) {
|
|
|
1275
1290
|
}
|
|
1276
1291
|
|
|
1277
1292
|
const useGridContainer = (props, ref) => {
|
|
1278
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1293
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1279
1294
|
const { defaultColumn, columns, data, rowSelectionMode, autoResetPageIndex, onUpdateData } = props;
|
|
1280
1295
|
const [drawerState, dispatch] = React.useReducer(tableReducer, {
|
|
1281
1296
|
isFilterDrawerOpen: false,
|
|
@@ -1332,7 +1347,7 @@ const useGridContainer = (props, ref) => {
|
|
|
1332
1347
|
rowPinning
|
|
1333
1348
|
},
|
|
1334
1349
|
getRowId(originalRow, index, parent) {
|
|
1335
|
-
const keyProps = props.dataPrimaryKye
|
|
1350
|
+
const keyProps = props.dataPrimaryKye;
|
|
1336
1351
|
return originalRow[keyProps] || `${index}`;
|
|
1337
1352
|
},
|
|
1338
1353
|
columnResizeMode: 'onChange',
|
|
@@ -1387,7 +1402,8 @@ const useGridContainer = (props, ref) => {
|
|
|
1387
1402
|
setExpanded,
|
|
1388
1403
|
setColumnPinning,
|
|
1389
1404
|
setColumnSizing,
|
|
1390
|
-
setRowPinning
|
|
1405
|
+
setRowPinning,
|
|
1406
|
+
tableSettings: (_l = props.tableSettings) !== null && _l !== void 0 ? _l : {},
|
|
1391
1407
|
}
|
|
1392
1408
|
});
|
|
1393
1409
|
const tableViews = React.useMemo(() => { var _a; return (_a = props.views) !== null && _a !== void 0 ? _a : []; }, [props.views]);
|
|
@@ -1563,6 +1579,10 @@ const getBodyCellPinningStyles = (column, isDragging, additionalStyles) => {
|
|
|
1563
1579
|
: 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 ? 2 : (isPinned ? 1 : 0) }, additionalStyles);
|
|
1564
1580
|
return styles;
|
|
1565
1581
|
};
|
|
1582
|
+
const getRowPinningStyles = (row, bottomRowLength, headerGroupLength, additionalStyles) => {
|
|
1583
|
+
const styles = Object.assign({ backgroundColor: tokens.colorPaletteYellowBackground2, position: 'sticky', top: row.getIsPinned() === 'top' ? `${row.getPinnedIndex() * 35 + (39 * headerGroupLength)}px` : undefined, bottom: row.getIsPinned() === 'bottom' ? `${((bottomRowLength || 0) - 1 - row.getPinnedIndex()) * 35}px` : undefined }, additionalStyles);
|
|
1584
|
+
return styles;
|
|
1585
|
+
};
|
|
1566
1586
|
|
|
1567
1587
|
const MoreIcon = bundleIcon$1(MoreVerticalFilled, MoreVerticalRegular);
|
|
1568
1588
|
const SortAscIcon = bundleIcon$1(ArrowSortDown20Filled, ArrowSortDown20Regular);
|
|
@@ -1571,9 +1591,9 @@ const PinIcon = bundleIcon$1(PinFilled, PinRegular);
|
|
|
1571
1591
|
const HideColumnIcon = bundleIcon$1(EyeTrackingOffFilled, EyeTrackingOffRegular);
|
|
1572
1592
|
const GroupExpandIcon = bundleIcon$1(TextExpandFilled, TextExpandRegular);
|
|
1573
1593
|
const GroupCollapseIcon = bundleIcon$1(TextCollapseFilled, TextCollapseRegular);
|
|
1574
|
-
function HeaderCell({ header, table,
|
|
1575
|
-
var _a;
|
|
1576
|
-
const { column } = header;
|
|
1594
|
+
function HeaderCell({ header, table, tabAttributes }) {
|
|
1595
|
+
var _a, _b, _c;
|
|
1596
|
+
const { column, id } = header;
|
|
1577
1597
|
const { isDragging, attributes, listeners, setNodeRef, transform, transition, } = useSortable({
|
|
1578
1598
|
id: column.id
|
|
1579
1599
|
});
|
|
@@ -1582,13 +1602,13 @@ function HeaderCell({ header, table, hideMenu, headerDepth, totalNumberOfHeaderD
|
|
|
1582
1602
|
transition
|
|
1583
1603
|
};
|
|
1584
1604
|
const styles = useTableHeaderStyles();
|
|
1585
|
-
const isLeafHeaders =
|
|
1605
|
+
const isLeafHeaders = ((_b = (_a = `${id}`) === null || _a === void 0 ? void 0 : _a.split('_')) === null || _b === void 0 ? void 0 : _b.length) === 1;
|
|
1586
1606
|
const headerCellCombinedStyles = getHeaderCellPinningStyles(column, isDragging, dndStyle);
|
|
1587
1607
|
if (header.isPlaceholder) {
|
|
1588
1608
|
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) }) }) }));
|
|
1589
1609
|
}
|
|
1590
1610
|
const columnName = flexRender(header.column.columnDef.header, header.getContext());
|
|
1591
|
-
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
|
|
1611
|
+
return (jsxs("th", Object.assign({ colSpan: header.colSpan, className: mergeClasses$1(styles.tHeadCell, isLeafHeaders && styles.tHeadNonLeafCell, isDragging && styles.tHeadCellDragging), style: headerCellCombinedStyles, ref: setNodeRef }, tabAttributes, { tabIndex: 0, children: [jsx("div", Object.assign({ className: styles.tHeadCellDraggable }, attributes, listeners, { children: jsxs("div", { className: isLeafHeaders
|
|
1592
1612
|
? styles.tLeafHeadCellContent
|
|
1593
1613
|
: styles.tNonLeafHeadCellContent, children: [jsx("div", { children: jsx(Show, { when: !header.isPlaceholder, children: jsxs(Button, { style: {
|
|
1594
1614
|
display: 'flex',
|
|
@@ -1603,10 +1623,10 @@ function HeaderCell({ header, table, hideMenu, headerDepth, totalNumberOfHeaderD
|
|
|
1603
1623
|
if (!header.column.getCanGroup())
|
|
1604
1624
|
return;
|
|
1605
1625
|
header.column.getToggleGroupingHandler()();
|
|
1606
|
-
}, appearance: "transparent", className: styles.tHeadContentBtn, icon: (
|
|
1626
|
+
}, appearance: "transparent", className: styles.tHeadContentBtn, icon: (_c = {
|
|
1607
1627
|
asc: (jsx("strong", { children: jsx(SortAscIcon, {}) })),
|
|
1608
1628
|
desc: (jsx("strong", { children: jsx(SortDescIcon, {}) })),
|
|
1609
|
-
}[header.column.getIsSorted()]) !== null &&
|
|
1629
|
+
}[header.column.getIsSorted()]) !== null && _c !== void 0 ? _c : 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: !isLeafHeaders })] }) })), 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 }) })] })));
|
|
1610
1630
|
}
|
|
1611
1631
|
function HeaderMenu(props) {
|
|
1612
1632
|
const { header, table, hideMenu } = props;
|
|
@@ -1664,19 +1684,24 @@ function HeaderMenu(props) {
|
|
|
1664
1684
|
}
|
|
1665
1685
|
|
|
1666
1686
|
function HeaderRow(props) {
|
|
1687
|
+
var _a;
|
|
1667
1688
|
const styles = useTableHeaderStyles();
|
|
1668
|
-
const { table, headerGroup,
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1689
|
+
const { table, headerGroup, headerGroupsLength } = props;
|
|
1690
|
+
const { rowSelectionMode, tableSettings } = (_a = table.options.meta) !== null && _a !== void 0 ? _a : {};
|
|
1691
|
+
const headerCellTabAttributes = useFocusableGroup({ tabBehavior: "limited" });
|
|
1692
|
+
const isLeafHeaders = headerGroup.depth === headerGroupsLength - 1;
|
|
1693
|
+
return (jsxs("tr", { className: styles.tHeadRow, children: [jsx(Show, { when: !(tableSettings === null || tableSettings === void 0 ? void 0 : tableSettings.enableManualSelection), children: jsxs(Switch, { when: rowSelectionMode, children: [jsx(Case, { value: "multiple", children: jsx("th", { style: { width: '1rem' }, "aria-label": "Select All Row", children: jsx(Show, { when: isLeafHeaders, children: jsx(Checkbox, { checked: table.getIsSomeRowsSelected()
|
|
1694
|
+
? 'mixed'
|
|
1695
|
+
: table.getIsAllRowsSelected(), onChange: table.getToggleAllRowsSelectedHandler(), "aria-label": "Select All Rows", title: 'Select All Rows' }) }) }) }), jsx(Case, { value: "single", children: jsx("th", { style: { width: '1rem' }, "aria-label": "Select All Row Column", children: ' ' }) })] }) }), jsx(For, { each: headerGroup.headers, children: (header, index) => {
|
|
1696
|
+
return (jsx(HeaderCell, { header: header, table: table, tabAttributes: headerCellTabAttributes }, `${header.id}_${index}`));
|
|
1697
|
+
} })] }, headerGroup.id));
|
|
1674
1698
|
}
|
|
1675
1699
|
|
|
1676
1700
|
function TableHeader(props) {
|
|
1677
1701
|
const styles = useTableHeaderStyles();
|
|
1678
1702
|
const { table, headerGroups, rowSelectionMode } = props;
|
|
1679
|
-
|
|
1703
|
+
const focusAttribute = useFocusableGroup({ tabBehavior: "limited-trap-focus" });
|
|
1704
|
+
return (jsx("thead", Object.assign({ className: styles.tHead, style: { zIndex: 99 } }, focusAttribute, { tabIndex: 0, children: headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map((headerGroup) => (jsx(HeaderRow, { table: table, rowSelectionMode: rowSelectionMode, headerGroup: headerGroup, headerGroupsLength: headerGroups.length }, headerGroup.id))) })));
|
|
1680
1705
|
}
|
|
1681
1706
|
|
|
1682
1707
|
const useLoadingStyles = makeStyles({
|
|
@@ -1799,31 +1824,51 @@ function TableCell({ cell, row }) {
|
|
|
1799
1824
|
return (jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
|
|
1800
1825
|
}
|
|
1801
1826
|
|
|
1802
|
-
|
|
1827
|
+
const PinRowAction = ({ row }) => {
|
|
1828
|
+
const isPinned = row.getIsPinned();
|
|
1829
|
+
return (jsxs(Fragment, { children: [jsx(Show, { when: isPinned, children: jsx(Button, { size: "small", shape: "circular", onClick: () => row.pin(false, true, false), icon: jsx(PinOffRegular, {}) }) }), jsx(Show, { when: !isPinned, children: jsx("div", { children: jsxs(Menu, { children: [jsx(MenuTrigger, { disableButtonEnhancement: true, children: jsx(Button, { icon: jsx(StarRegular, {}), shape: "circular", size: "small" }) }), jsx(MenuPopover, { children: jsxs(MenuList, { children: [jsx(MenuItem, { icon: jsx(SwipeUpFilled, {}), onClick: () => row.pin('top', true, false), children: "Top" }), jsx(MenuItem, { icon: jsx(SwipeDownFilled, {}), onClick: () => row.pin('bottom', true, true), children: "Bottom" })] }) })] }) }) })] }));
|
|
1830
|
+
};
|
|
1831
|
+
|
|
1832
|
+
const SelectRowCheckbox = ({ row }) => {
|
|
1833
|
+
const canCheck = row.getCanSelect();
|
|
1834
|
+
const isChecked = row.getIsSomeSelected() ? 'mixed' : (row.getIsSelected() || row.getIsAllSubRowsSelected());
|
|
1835
|
+
return (jsx(Checkbox, { checked: isChecked, disabled: !canCheck, onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }));
|
|
1836
|
+
};
|
|
1837
|
+
|
|
1838
|
+
const SelectRowRadio = ({ row }) => {
|
|
1839
|
+
const canCheck = row.getCanSelect();
|
|
1840
|
+
const isChecked = row.getIsSelected();
|
|
1841
|
+
return (jsx(Radio, { checked: isChecked, disabled: !canCheck, onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }));
|
|
1842
|
+
};
|
|
1843
|
+
|
|
1844
|
+
function TableRowRaw({ row, table, style, tabAttributes }) {
|
|
1845
|
+
var _a;
|
|
1803
1846
|
const styles = useTableBodyStyles();
|
|
1804
|
-
|
|
1847
|
+
const { rowSelectionMode, tableSettings } = (_a = table.options.meta) !== null && _a !== void 0 ? _a : {};
|
|
1848
|
+
return (jsxs("tr", Object.assign({ className: row.getIsSelected() || row.getIsAllSubRowsSelected()
|
|
1805
1849
|
? styles.tBodySelectedRow
|
|
1806
|
-
: styles.tBodyRow, style: style, children: [jsxs(Switch, { when: rowSelectionMode, children: [jsx(Case, { value: 'multiple', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row
|
|
1807
|
-
? 'mixed'
|
|
1808
|
-
: 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));
|
|
1850
|
+
: styles.tBodyRow, style: style }, tabAttributes, { tabIndex: 0, children: [jsx(Show, { when: !(tableSettings === null || tableSettings === void 0 ? void 0 : tableSettings.enableManualSelection), children: jsxs(Switch, { when: rowSelectionMode, children: [jsx(Case, { value: 'multiple', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row", children: jsx(SelectRowCheckbox, { row: row }) }) }), jsx(Case, { value: 'single', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row", children: jsx(SelectRowRadio, { row: row }) }) })] }) }), row.getVisibleCells().map((cell) => (jsx(TableCell, { cell: cell, row: row }, cell.id)))] }), row.id));
|
|
1809
1851
|
}
|
|
1810
|
-
function
|
|
1852
|
+
function PinnedRowRaw({ row, table, style, bottomRowLength, tabAttributes }) {
|
|
1853
|
+
var _a;
|
|
1811
1854
|
const styles = useTableBodyStyles();
|
|
1812
|
-
const
|
|
1813
|
-
|
|
1855
|
+
const headerGroupLength = table.getHeaderGroups().length;
|
|
1856
|
+
const pinnedRowRawStyle = getRowPinningStyles(row, bottomRowLength || 0, headerGroupLength, style || {});
|
|
1857
|
+
const { rowSelectionMode, tableSettings } = (_a = table.options.meta) !== null && _a !== void 0 ? _a : {};
|
|
1858
|
+
return (jsxs("tr", Object.assign({ className: row.getIsSelected() || row.getIsAllSubRowsSelected()
|
|
1814
1859
|
? styles.tBodySelectedRow
|
|
1815
|
-
: 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(
|
|
1816
|
-
? 'mixed'
|
|
1817
|
-
: 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 => {
|
|
1860
|
+
: styles.tBodyRow, style: pinnedRowRawStyle }, tabAttributes, { tabIndex: 0, children: [jsx(Show, { when: !(tableSettings === null || tableSettings === void 0 ? void 0 : tableSettings.enableManualSelection), children: jsxs(Switch, { when: rowSelectionMode, children: [jsx(Case, { value: 'multiple', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsx(SelectRowCheckbox, { row: row }) }) }), jsx(Case, { value: 'single', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsx(SelectRowRadio, { row: row }) }) })] }) }), row.getVisibleCells().map(cell => {
|
|
1818
1861
|
return (jsx(TableCell, { cell: cell, row: row }, cell.id));
|
|
1819
|
-
})] }, row.id));
|
|
1862
|
+
})] }), row.id));
|
|
1820
1863
|
}
|
|
1864
|
+
const TableRow = TableRowRaw;
|
|
1865
|
+
const PinnedRow = PinnedRowRaw;
|
|
1821
1866
|
|
|
1822
1867
|
function TableBody(props) {
|
|
1823
1868
|
var _a, _b, _c;
|
|
1824
1869
|
const styles = useTableBodyStyles();
|
|
1825
1870
|
const { table, tableContainerRef } = props;
|
|
1826
|
-
const rowSelectionMode = (_a = table.options.meta)
|
|
1871
|
+
const { rowSelectionMode } = (_a = table.options.meta) !== null && _a !== void 0 ? _a : {};
|
|
1827
1872
|
let rows = [];
|
|
1828
1873
|
let topRows = [];
|
|
1829
1874
|
let bottomRows = [];
|
|
@@ -1847,13 +1892,14 @@ function TableBody(props) {
|
|
|
1847
1892
|
const paddingBottom = virtualRows.length > 0
|
|
1848
1893
|
? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
|
|
1849
1894
|
: 0;
|
|
1895
|
+
const tabAttributes = useFocusableGroup({ tabBehavior: "limited" });
|
|
1850
1896
|
return (jsxs(Fragment, { children: [jsx(Show, { when: (topRows === null || topRows === void 0 ? void 0 : topRows.length) > 0, children: jsx("thead", { style: {
|
|
1851
1897
|
position: "sticky",
|
|
1852
1898
|
top: 0,
|
|
1853
1899
|
zIndex: 9
|
|
1854
|
-
}, children: jsx(For, { each: topRows, children: (row, index) => (jsx(PinnedRow, { row: row,
|
|
1900
|
+
}, children: jsx(For, { each: topRows, children: (row, index) => (jsx(PinnedRow, { row: row, table: table, bottomRowLength: bottomRows === null || bottomRows === void 0 ? void 0 : bottomRows.length, tabAttributes: tabAttributes }, `${row.id}_${index}`)) }) }) }), 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) => {
|
|
1855
1901
|
const row = rows[virtualRow.index];
|
|
1856
|
-
return (jsx(TableRow, { row: row,
|
|
1902
|
+
return (jsx(TableRow, { row: row, table: table, tabAttributes: tabAttributes }, row.id));
|
|
1857
1903
|
} }), 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: {
|
|
1858
1904
|
position: "sticky",
|
|
1859
1905
|
bottom: 0,
|
|
@@ -1864,7 +1910,7 @@ function TableBody(props) {
|
|
|
1864
1910
|
position: "sticky",
|
|
1865
1911
|
bottom: 0,
|
|
1866
1912
|
zIndex: 9
|
|
1867
|
-
}, children: jsx(For, { each: bottomRows, children: (row) => (jsx(PinnedRow, { row: row,
|
|
1913
|
+
}, children: jsx(For, { each: bottomRows, children: (row) => (jsx(PinnedRow, { row: row, table: table, bottomRowLength: bottomRows === null || bottomRows === void 0 ? void 0 : bottomRows.length, tabAttributes: tabAttributes }, row.id)) }) }) })] }));
|
|
1868
1914
|
}
|
|
1869
1915
|
|
|
1870
1916
|
const TableContainer = (props) => {
|
|
@@ -2357,4 +2403,4 @@ function useSkipper() {
|
|
|
2357
2403
|
return [shouldSkip, skip];
|
|
2358
2404
|
}
|
|
2359
2405
|
|
|
2360
|
-
export { ForwardedAdvancedTable as Table, useSkipper };
|
|
2406
|
+
export { PinRowAction, SelectRowCheckbox, SelectRowRadio, ForwardedAdvancedTable as Table, disableAllShorthand, useSkipper };
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prt-ts/fluent-react-table-v2",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.47.1-build-1.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": ">=17.0.0",
|
|
6
6
|
"react-dom": ">=17.0.0",
|
|
7
|
-
"@fluentui/react-components": ">=9.
|
|
7
|
+
"@fluentui/react-components": ">=9.47.1",
|
|
8
8
|
"@fluentui/react-datepicker-compat": ">=0.4.5"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Row, RowData } from "@tanstack/react-table";
|
|
2
|
+
type PinRowActionProps<TData extends RowData> = {
|
|
3
|
+
row: Row<TData>;
|
|
4
|
+
};
|
|
5
|
+
export declare const PinRowAction: <TData extends unknown>({ row }: PinRowActionProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Row, RowData } from "@tanstack/react-table";
|
|
2
|
+
type SelectRowCheckboxProps<TData extends RowData> = {
|
|
3
|
+
row: Row<TData>;
|
|
4
|
+
};
|
|
5
|
+
export declare const SelectRowCheckbox: <TData extends unknown>({ row }: SelectRowCheckboxProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Row, RowData } from "@tanstack/react-table";
|
|
2
|
+
type SelectRowRadioProps<TData extends RowData> = {
|
|
3
|
+
row: Row<TData>;
|
|
4
|
+
};
|
|
5
|
+
export declare const SelectRowRadio: <TData extends unknown>({ row }: SelectRowRadioProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -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 unknown>({ 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 unknown>({ column, table, }: {
|
|
3
3
|
column: Column<TItem, unknown>;
|
|
4
4
|
table: Table<TItem>;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Row, RowData } from '@tanstack/react-table';
|
|
3
|
-
import { TableProps } from '../../types';
|
|
2
|
+
import { Row, RowData, Table } from '@tanstack/react-table';
|
|
4
3
|
type TableRowProps<TItem extends RowData> = {
|
|
4
|
+
table: Table<TItem>;
|
|
5
5
|
row: Row<TItem>;
|
|
6
|
-
rowSelectionMode?: TableProps<TItem>['rowSelectionMode'];
|
|
7
6
|
bottomRowLength?: number;
|
|
8
7
|
style?: React.CSSProperties;
|
|
8
|
+
tabAttributes: any;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
declare function TableRowRaw<TItem extends RowData>({ row, table, style, tabAttributes }: TableRowProps<TItem>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function PinnedRowRaw<TItem extends RowData>({ row, table, style, bottomRowLength, tabAttributes }: TableRowProps<TItem>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const TableRow: typeof TableRowRaw;
|
|
13
|
+
export declare const PinnedRow: typeof PinnedRowRaw;
|
|
12
14
|
export {};
|
|
@@ -2,9 +2,7 @@ import { Header, RowData, Table } from "@tanstack/react-table";
|
|
|
2
2
|
type HeaderCellProps<TItem extends RowData> = {
|
|
3
3
|
header: Header<TItem, unknown>;
|
|
4
4
|
table: Table<TItem>;
|
|
5
|
-
|
|
6
|
-
headerDepth: number;
|
|
7
|
-
totalNumberOfHeaderDepth: number;
|
|
5
|
+
tabAttributes: any;
|
|
8
6
|
};
|
|
9
|
-
export declare function HeaderCell<TItem extends RowData>({ header, table,
|
|
7
|
+
export declare function HeaderCell<TItem extends RowData>({ header, table, tabAttributes }: HeaderCellProps<TItem>): import("react/jsx-runtime").JSX.Element;
|
|
10
8
|
export {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { HeaderGroup, RowData, Table } from '@tanstack/react-table';
|
|
2
|
-
import { TableProps } from '../../types';
|
|
3
2
|
type HeaderRowProps<TItem extends RowData> = {
|
|
4
3
|
table: Table<TItem>;
|
|
5
|
-
rowSelectionMode?: TableProps<TItem>['rowSelectionMode'];
|
|
6
4
|
headerGroup: HeaderGroup<TItem>;
|
|
7
5
|
headerGroupsLength: number;
|
|
8
6
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const disableAllShorthand: {
|
|
2
|
+
enableGrouping: boolean;
|
|
3
|
+
enableHiding: boolean;
|
|
4
|
+
enablePinning: boolean;
|
|
5
|
+
enableSorting: boolean;
|
|
6
|
+
enableColumnFilter: boolean;
|
|
7
|
+
enableGlobalFilter: boolean;
|
|
8
|
+
enableMultiSort: boolean;
|
|
9
|
+
enableResizing: boolean;
|
|
10
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Column } from "@tanstack/react-table";
|
|
1
|
+
import { Column, Row } from "@tanstack/react-table";
|
|
2
2
|
import { CSSProperties } from "react";
|
|
3
3
|
export declare const getHeaderCellPinningStyles: <TItem extends unknown>(column: Column<TItem, unknown>, isDragging: boolean, additionalStyles: CSSProperties) => CSSProperties;
|
|
4
4
|
export declare const getBodyCellPinningStyles: <TItem extends unknown>(column: Column<TItem, unknown>, isDragging: boolean, additionalStyles: CSSProperties) => CSSProperties;
|
|
5
|
+
export declare const getRowPinningStyles: <TItem extends unknown>(row: Row<TItem>, bottomRowLength: number, headerGroupLength: number, additionalStyles: CSSProperties) => CSSProperties;
|
package/src/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ColumnFiltersState, ColumnOrderState, ColumnPinningState, ColumnSizingState, ExpandedState, FilterFn, GroupingState, PaginationState, RowData, RowPinningState, RowSelectionState, SortingState, VisibilityState } from "@tanstack/react-table";
|
|
3
|
-
import { TableProps } from "./types";
|
|
3
|
+
import { TableProps, TableSettings } from "./types";
|
|
4
4
|
import { ActionType, DrawerTableState } from "./components/reducer";
|
|
5
|
+
export { disableAllShorthand } from "./helpers/Shorthands";
|
|
6
|
+
export { Table, useSkipper } from "./components";
|
|
7
|
+
export * from "./components/extensions";
|
|
5
8
|
declare module '@tanstack/table-core' {
|
|
6
9
|
interface FilterFns {
|
|
7
10
|
arrIncludesSome: FilterFn<unknown>;
|
|
@@ -37,9 +40,9 @@ declare module '@tanstack/react-table' {
|
|
|
37
40
|
setColumnPinning: React.Dispatch<React.SetStateAction<ColumnPinningState>>;
|
|
38
41
|
setColumnSizing: React.Dispatch<React.SetStateAction<ColumnSizingState>>;
|
|
39
42
|
setRowPinning: React.Dispatch<React.SetStateAction<RowPinningState>>;
|
|
43
|
+
tableSettings: TableSettings;
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
|
-
export { Table, useSkipper } from "./components";
|
|
43
46
|
export type { TableProps, TableRef, TableView } from "./types";
|
|
44
47
|
export type { TableState, ColumnDef, Column as ColumnType, Row as RowType, RowData as RowDataType, Table as TableType } from '@tanstack/react-table';
|
|
45
48
|
export { createColumnHelper } from "@tanstack/react-table";
|
|
@@ -113,4 +113,11 @@ export type TableProps<TItem extends RowData> = {
|
|
|
113
113
|
* disable table header
|
|
114
114
|
*/
|
|
115
115
|
disableTableHeader?: boolean;
|
|
116
|
+
tableSettings?: TableSettings;
|
|
117
|
+
};
|
|
118
|
+
export type TableSettings = {
|
|
119
|
+
/**
|
|
120
|
+
* Enable manual selection of table view
|
|
121
|
+
*/
|
|
122
|
+
enableManualSelection?: boolean;
|
|
116
123
|
};
|