@prt-ts/fluent-react-table-v2 9.46.8-build.8.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 +117 -52
- package/index.esm.js +99 -38
- 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 +7 -3
- package/src/lib/types/TableProps.d.ts +12 -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,10 +1052,17 @@ 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"]);
|
|
1047
1061
|
const TextClearFormattingFilled = /*#__PURE__*/createFluentIcon('TextClearFormattingFilled', "1em", ["M6 2c.2 0 .4.13.47.32l3.5 8.95a.5.5 0 0 1-.94.37L8.01 9H4l-1.04 2.68a.5.5 0 1 1-.94-.36l3.5-9A.5.5 0 0 1 6 2Zm0 1.88L4.4 8H7.6l-1.6-4.12ZM11.5 2c.28 0 .5.22.5.5v3.52a2.48 2.48 0 0 1 2.26-1.3c.89 0 1.6.34 2.15 1 .55.66.82 1.54.82 2.64l-.01.42-.05-.05a2.49 2.49 0 0 0-1.15-.65 2.86 2.86 0 0 0-.53-1.62c-.36-.47-.86-.7-1.48-.7-.6 0-1.09.24-1.47.72-.3.37-.47.83-.54 1.37v1.03c.05.43.18.8.37 1.12L11 11.37V2.5c0-.28.22-.5.5-.5Zm4.97 7.44 2.1 2.1a1.5 1.5 0 0 1-.01 2.12l-3.6 3.6-4.21-4.22 3.6-3.6a1.5 1.5 0 0 1 2.12 0Zm-2.22 8.52-4.21-4.21-.6.6a1.5 1.5 0 0 0 0 2.12l2.1 2.1c.3.3.71.45 1.12.43h4.09a.5.5 0 1 0 0-1h-2.53l.03-.04Z"]);
|
|
1062
|
+
const TextCollapseFilled = /*#__PURE__*/createFluentIcon('TextCollapseFilled', "1em", ["M5 3.5c0-.41.34-.75.75-.75h11.5a.75.75 0 0 1 0 1.5H5.75A.75.75 0 0 1 5 3.5Zm0 12c0-.41.34-.75.75-.75h11.5a.75.75 0 0 1 0 1.5H5.75A.75.75 0 0 1 5 15.5Zm6.75-8.75a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5h-5.5ZM11 11.5c0-.41.34-.75.75-.75h5.5a.75.75 0 0 1 0 1.5h-5.5a.75.75 0 0 1-.75-.75Zm-2-2a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Zm-6 0c0 .28.22.5.5.5h4a.5.5 0 0 0 0-1h-4a.5.5 0 0 0-.5.5Z"]);
|
|
1063
|
+
const TextCollapseRegular = /*#__PURE__*/createFluentIcon('TextCollapseRegular', "1em", ["M5 3.5c0-.28.22-.5.5-.5h12a.5.5 0 0 1 0 1h-12a.5.5 0 0 1-.5-.5Zm0 12c0-.28.22-.5.5-.5h12a.5.5 0 0 1 0 1h-12a.5.5 0 0 1-.5-.5Zm6-8c0-.28.22-.5.5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5Zm0 4c0-.28.22-.5.5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5Zm-2-2a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0ZM3.5 9a.5.5 0 0 0 0 1h4a.5.5 0 0 0 0-1h-4Z"]);
|
|
1064
|
+
const TextExpandFilled = /*#__PURE__*/createFluentIcon('TextExpandFilled', "1em", ["M4.75 3.5a.75.75 0 0 0 0 1.5h12.5a.75.75 0 0 0 0-1.5H4.75ZM4 16.25c0-.41.34-.75.75-.75h12.5a.75.75 0 0 1 0 1.5H4.75a.75.75 0 0 1-.75-.75Zm7-4c0-.41.34-.75.75-.75h5.5a.75.75 0 0 1 0 1.5h-5.5a.75.75 0 0 1-.75-.75Zm0-4c0-.41.34-.75.75-.75h5.5a.75.75 0 0 1 0 1.5h-5.5a.75.75 0 0 1-.75-.75ZM5.5 14a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7ZM6 8.5V10h1.5a.5.5 0 0 1 0 1H6v1.5a.5.5 0 0 1-1 0V11H3.5a.5.5 0 0 1 0-1H5V8.5a.5.5 0 0 1 1 0Z"]);
|
|
1065
|
+
const TextExpandRegular = /*#__PURE__*/createFluentIcon('TextExpandRegular', "1em", ["M4 4.5c0-.28.22-.5.5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5Zm0 12c0-.28.22-.5.5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5Zm6-4c0-.28.22-.5.5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm0-4c0-.28.22-.5.5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5ZM5.5 14a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7ZM6 8.5a.5.5 0 0 0-1 0V10H3.5a.5.5 0 0 0 0 1H5v1.5a.5.5 0 0 0 1 0V11h1.5a.5.5 0 0 0 0-1H6V8.5Z"]);
|
|
1048
1066
|
const TextSortAscendingFilled = /*#__PURE__*/createFluentIcon('TextSortAscendingFilled', "1em", ["M6.7 2.5a.75.75 0 0 0-1.4 0L3.03 9a.75.75 0 0 0 1.42.5l.34-1h2.4l.34 1A.75.75 0 0 0 8.96 9L6.7 2.5ZM6 5.04 6.68 7H5.32L6 5.04ZM4 11a.75.75 0 0 0 0 1.5h2.53l-3.14 4.3A.75.75 0 0 0 4 18h4a.75.75 0 0 0 0-1.5H5.47l3.14-4.3A.75.75 0 0 0 8 11H4Zm10.25-9c.41 0 .75.34.75.75v12.57l1.45-1.58a.75.75 0 0 1 1.1 1.02l-2.75 3a.75.75 0 0 1-1.1 0l-2.75-3a.75.75 0 0 1 1.1-1.02l1.45 1.58V2.75c0-.41.34-.75.75-.75Z"]);
|
|
1049
1067
|
const TextSortDescendingFilled = /*#__PURE__*/createFluentIcon('TextSortDescendingFilled', "1em", ["M4 2a.75.75 0 1 0 0 1.5h2.53L3.39 7.8A.75.75 0 0 0 4 9h4a.75.75 0 0 0 0-1.5H5.47l3.14-4.3A.75.75 0 0 0 8 2H4Zm2.7 8.5a.75.75 0 0 0-1.4 0L3.03 17a.75.75 0 1 0 1.42.5l.34-1h2.4l.34 1a.75.75 0 1 0 1.42-.5L6.7 10.5ZM6 13.04 6.68 15H5.32L6 13.04ZM14.25 2c.41 0 .75.34.75.75v12.57l1.45-1.58a.75.75 0 0 1 1.1 1.02l-2.75 3a.75.75 0 0 1-1.1 0l-2.75-3a.75.75 0 0 1 1.1-1.02l1.45 1.58V2.75c0-.41.34-.75.75-.75Z"]);
|
|
1050
1068
|
|
|
@@ -1172,10 +1190,11 @@ const useGridHeaderStyles = reactComponents.makeStyles({
|
|
|
1172
1190
|
|
|
1173
1191
|
const GridHeader = (props) => {
|
|
1174
1192
|
const { table, gridTitle, globalFilter, setGlobalFilter } = props;
|
|
1193
|
+
const focusAttribute = reactComponents.useArrowNavigationGroup({ axis: "horizontal", circular: true });
|
|
1175
1194
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
1176
1195
|
const { dispatchDrawerAction, drawerState } = table.options.meta;
|
|
1177
1196
|
const styles = useGridHeaderStyles();
|
|
1178
|
-
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) => {
|
|
1179
1198
|
if (column.id === 'select')
|
|
1180
1199
|
return null;
|
|
1181
1200
|
if (column.id === 'id')
|
|
@@ -1187,7 +1206,7 @@ const GridHeader = (props) => {
|
|
|
1187
1206
|
return (jsxRuntime.jsx(reactComponents.Checkbox, { checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler(), label: column.id, disabled: !column.getCanHide() }, column.id));
|
|
1188
1207
|
})] }) })] }), jsxRuntime.jsx(reactComponents.Tooltip, { content: 'Table Views Management', relationship: "label", children: jsxRuntime.jsx(reactComponents.Button, { onClick: () => {
|
|
1189
1208
|
dispatchDrawerAction === null || dispatchDrawerAction === void 0 ? void 0 : dispatchDrawerAction({ type: "TOGGLE_VIEW_DRAWER" });
|
|
1190
|
-
}, 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 })] }))] }));
|
|
1191
1210
|
};
|
|
1192
1211
|
// A debounced input react component
|
|
1193
1212
|
function DebouncedInput({ value: initialValue, onChange, debounce = 500, drawerState, dispatch, }) {
|
|
@@ -1293,7 +1312,7 @@ function tableReducer(state, action) {
|
|
|
1293
1312
|
}
|
|
1294
1313
|
|
|
1295
1314
|
const useGridContainer = (props, ref) => {
|
|
1296
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1315
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1297
1316
|
const { defaultColumn, columns, data, rowSelectionMode, autoResetPageIndex, onUpdateData } = props;
|
|
1298
1317
|
const [drawerState, dispatch] = React__namespace.useReducer(tableReducer, {
|
|
1299
1318
|
isFilterDrawerOpen: false,
|
|
@@ -1350,7 +1369,7 @@ const useGridContainer = (props, ref) => {
|
|
|
1350
1369
|
rowPinning
|
|
1351
1370
|
},
|
|
1352
1371
|
getRowId(originalRow, index, parent) {
|
|
1353
|
-
const keyProps = props.dataPrimaryKye
|
|
1372
|
+
const keyProps = props.dataPrimaryKye;
|
|
1354
1373
|
return originalRow[keyProps] || `${index}`;
|
|
1355
1374
|
},
|
|
1356
1375
|
columnResizeMode: 'onChange',
|
|
@@ -1386,6 +1405,7 @@ const useGridContainer = (props, ref) => {
|
|
|
1386
1405
|
meta: {
|
|
1387
1406
|
pageSizeOptions: props.pageSizeOptions || [10, 20, 50, 100, 1000],
|
|
1388
1407
|
rowSelectionMode: props.rowSelectionMode,
|
|
1408
|
+
isAutoExpandOnGroup: (_k = props.isAutoExpandOnGroup) !== null && _k !== void 0 ? _k : false,
|
|
1389
1409
|
tableHeight: props.tableHeight || "650px",
|
|
1390
1410
|
updateData: onUpdateData,
|
|
1391
1411
|
onTableViewDelete: props.onTableViewDelete,
|
|
@@ -1404,7 +1424,8 @@ const useGridContainer = (props, ref) => {
|
|
|
1404
1424
|
setExpanded,
|
|
1405
1425
|
setColumnPinning,
|
|
1406
1426
|
setColumnSizing,
|
|
1407
|
-
setRowPinning
|
|
1427
|
+
setRowPinning,
|
|
1428
|
+
tableSettings: (_l = props.tableSettings) !== null && _l !== void 0 ? _l : {},
|
|
1408
1429
|
}
|
|
1409
1430
|
});
|
|
1410
1431
|
const tableViews = React__namespace.useMemo(() => { var _a; return (_a = props.views) !== null && _a !== void 0 ? _a : []; }, [props.views]);
|
|
@@ -1580,15 +1601,21 @@ const getBodyCellPinningStyles = (column, isDragging, additionalStyles) => {
|
|
|
1580
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);
|
|
1581
1602
|
return styles;
|
|
1582
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
|
+
};
|
|
1583
1608
|
|
|
1584
1609
|
const MoreIcon = bundleIcon$1(MoreVerticalFilled, MoreVerticalRegular);
|
|
1585
1610
|
const SortAscIcon = bundleIcon$1(ArrowSortDown20Filled, ArrowSortDown20Regular);
|
|
1586
1611
|
const SortDescIcon = bundleIcon$1(ArrowSortUp20Filled, ArrowSortUp20Regular);
|
|
1587
1612
|
const PinIcon = bundleIcon$1(PinFilled, PinRegular);
|
|
1588
1613
|
const HideColumnIcon = bundleIcon$1(EyeTrackingOffFilled, EyeTrackingOffRegular);
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1614
|
+
const GroupExpandIcon = bundleIcon$1(TextExpandFilled, TextExpandRegular);
|
|
1615
|
+
const GroupCollapseIcon = bundleIcon$1(TextCollapseFilled, TextCollapseRegular);
|
|
1616
|
+
function HeaderCell({ header, table, tabAttributes }) {
|
|
1617
|
+
var _a, _b, _c;
|
|
1618
|
+
const { column, id } = header;
|
|
1592
1619
|
const { isDragging, attributes, listeners, setNodeRef, transform, transition, } = sortable.useSortable({
|
|
1593
1620
|
id: column.id
|
|
1594
1621
|
});
|
|
@@ -1597,13 +1624,13 @@ function HeaderCell({ header, table, hideMenu, headerDepth, totalNumberOfHeaderD
|
|
|
1597
1624
|
transition
|
|
1598
1625
|
};
|
|
1599
1626
|
const styles = useTableHeaderStyles();
|
|
1600
|
-
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;
|
|
1601
1628
|
const headerCellCombinedStyles = getHeaderCellPinningStyles(column, isDragging, dndStyle);
|
|
1602
1629
|
if (header.isPlaceholder) {
|
|
1603
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) }) }) }));
|
|
1604
1631
|
}
|
|
1605
1632
|
const columnName = reactTable.flexRender(header.column.columnDef.header, header.getContext());
|
|
1606
|
-
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
|
|
1607
1634
|
? styles.tLeafHeadCellContent
|
|
1608
1635
|
: styles.tNonLeafHeadCellContent, children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx(reactControlFlow.Show, { when: !header.isPlaceholder, children: jsxRuntime.jsxs(reactComponents.Button, { style: {
|
|
1609
1636
|
display: 'flex',
|
|
@@ -1618,10 +1645,10 @@ function HeaderCell({ header, table, hideMenu, headerDepth, totalNumberOfHeaderD
|
|
|
1618
1645
|
if (!header.column.getCanGroup())
|
|
1619
1646
|
return;
|
|
1620
1647
|
header.column.getToggleGroupingHandler()();
|
|
1621
|
-
}, appearance: "transparent", className: styles.tHeadContentBtn, icon: (
|
|
1648
|
+
}, appearance: "transparent", className: styles.tHeadContentBtn, icon: (_c = {
|
|
1622
1649
|
asc: (jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(SortAscIcon, {}) })),
|
|
1623
1650
|
desc: (jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(SortDescIcon, {}) })),
|
|
1624
|
-
}[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 }) })] })));
|
|
1625
1652
|
}
|
|
1626
1653
|
function HeaderMenu(props) {
|
|
1627
1654
|
const { header, table, hideMenu } = props;
|
|
@@ -1647,7 +1674,15 @@ function HeaderMenu(props) {
|
|
|
1647
1674
|
var _a;
|
|
1648
1675
|
const isControlKeySelected = e.ctrlKey;
|
|
1649
1676
|
(_a = header.column) === null || _a === void 0 ? void 0 : _a.toggleSorting(true, isControlKeySelected);
|
|
1650
|
-
}, icon: jsxRuntime.jsx(TextSortDescendingFilled, {}), disabled: header.column.getIsSorted() === 'desc', children: "Sort Z to A" }), jsxRuntime.jsx(reactComponents.MenuDivider, {})] }, 'sort-group') }), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getCanGroup(), children: jsxRuntime.jsxs(reactComponents.MenuGroup, { children: [!header.column.getIsGrouped() && (jsxRuntime.jsxs(reactComponents.MenuItem, { onClick: () =>
|
|
1677
|
+
}, icon: jsxRuntime.jsx(TextSortDescendingFilled, {}), disabled: header.column.getIsSorted() === 'desc', children: "Sort Z to A" }), jsxRuntime.jsx(reactComponents.MenuDivider, {})] }, 'sort-group') }), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getCanGroup(), children: jsxRuntime.jsxs(reactComponents.MenuGroup, { children: [!header.column.getIsGrouped() && (jsxRuntime.jsxs(reactComponents.MenuItem, { onClick: () => {
|
|
1678
|
+
header.column.getToggleGroupingHandler()();
|
|
1679
|
+
const { isAutoExpandOnGroup } = table.options.meta;
|
|
1680
|
+
if (isAutoExpandOnGroup) {
|
|
1681
|
+
table.toggleAllRowsExpanded(true);
|
|
1682
|
+
}
|
|
1683
|
+
}, icon: jsxRuntime.jsx(GroupFilled, {}), children: ["Group Column (by ", columnName, ")"] })), jsxRuntime.jsxs(reactControlFlow.Show, { when: header.column.getIsGrouped(), children: [jsxRuntime.jsxs(reactComponents.MenuItem, { onClick: () => {
|
|
1684
|
+
header.column.getToggleGroupingHandler()();
|
|
1685
|
+
}, icon: jsxRuntime.jsx(GroupDismissFilled, {}), children: ["Remove Grouping (on ", columnName, ")"] }), jsxRuntime.jsx(reactComponents.MenuItem, { onClick: () => table.toggleAllRowsExpanded(), icon: table.getIsAllRowsExpanded() ? jsxRuntime.jsx(GroupCollapseIcon, {}) : jsxRuntime.jsx(GroupExpandIcon, {}), children: jsxRuntime.jsx(reactControlFlow.Show, { when: table.getIsAllRowsExpanded(), fallback: jsxRuntime.jsx(jsxRuntime.Fragment, { children: "Expand All Groups" }), children: "Collapse All Groups" }) })] }), jsxRuntime.jsx(reactComponents.MenuDivider, {})] }, 'grouping-group') }), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getCanPin(), children: jsxRuntime.jsxs(reactComponents.Menu, { children: [jsxRuntime.jsx(reactComponents.MenuTrigger, { disableButtonEnhancement: true, children: jsxRuntime.jsxs(reactComponents.MenuItem, { icon: jsxRuntime.jsx(PinIcon, {}), children: ["Pin Column (", columnName, ")"] }) }), jsxRuntime.jsx(reactComponents.MenuPopover, { children: jsxRuntime.jsxs(reactComponents.MenuList, { children: [jsxRuntime.jsx(reactComponents.MenuItem, { onClick: () => {
|
|
1651
1686
|
var _a;
|
|
1652
1687
|
(_a = header.column) === null || _a === void 0 ? void 0 : _a.pin(false);
|
|
1653
1688
|
}, icon: jsxRuntime.jsx(PinOffRegular, {}), disabled: !(['left', 'right'].includes(header.column.getIsPinned())), children: "No Pin" }), jsxRuntime.jsx(reactComponents.MenuItem, { onClick: () => {
|
|
@@ -1671,19 +1706,24 @@ function HeaderMenu(props) {
|
|
|
1671
1706
|
}
|
|
1672
1707
|
|
|
1673
1708
|
function HeaderRow(props) {
|
|
1709
|
+
var _a;
|
|
1674
1710
|
const styles = useTableHeaderStyles();
|
|
1675
|
-
const { table, headerGroup,
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
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));
|
|
1681
1720
|
}
|
|
1682
1721
|
|
|
1683
1722
|
function TableHeader(props) {
|
|
1684
1723
|
const styles = useTableHeaderStyles();
|
|
1685
1724
|
const { table, headerGroups, rowSelectionMode } = props;
|
|
1686
|
-
|
|
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))) })));
|
|
1687
1727
|
}
|
|
1688
1728
|
|
|
1689
1729
|
const useLoadingStyles = reactComponents.makeStyles({
|
|
@@ -1806,31 +1846,51 @@ function TableCell({ cell, row }) {
|
|
|
1806
1846
|
return (jsxRuntime.jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
|
|
1807
1847
|
}
|
|
1808
1848
|
|
|
1809
|
-
|
|
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;
|
|
1810
1868
|
const styles = useTableBodyStyles();
|
|
1811
|
-
|
|
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()
|
|
1812
1871
|
? styles.tBodySelectedRow
|
|
1813
|
-
: 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
|
|
1814
|
-
? 'mixed'
|
|
1815
|
-
: 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));
|
|
1816
1873
|
}
|
|
1817
|
-
function
|
|
1874
|
+
function PinnedRowRaw({ row, table, style, bottomRowLength, tabAttributes }) {
|
|
1875
|
+
var _a;
|
|
1818
1876
|
const styles = useTableBodyStyles();
|
|
1819
|
-
const
|
|
1820
|
-
|
|
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()
|
|
1821
1881
|
? styles.tBodySelectedRow
|
|
1822
|
-
: 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(
|
|
1823
|
-
? 'mixed'
|
|
1824
|
-
: 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 => {
|
|
1825
1883
|
return (jsxRuntime.jsx(TableCell, { cell: cell, row: row }, cell.id));
|
|
1826
|
-
})] }, row.id));
|
|
1884
|
+
})] }), row.id));
|
|
1827
1885
|
}
|
|
1886
|
+
const TableRow = TableRowRaw;
|
|
1887
|
+
const PinnedRow = PinnedRowRaw;
|
|
1828
1888
|
|
|
1829
1889
|
function TableBody(props) {
|
|
1830
1890
|
var _a, _b, _c;
|
|
1831
1891
|
const styles = useTableBodyStyles();
|
|
1832
1892
|
const { table, tableContainerRef } = props;
|
|
1833
|
-
const rowSelectionMode = (_a = table.options.meta)
|
|
1893
|
+
const { rowSelectionMode } = (_a = table.options.meta) !== null && _a !== void 0 ? _a : {};
|
|
1834
1894
|
let rows = [];
|
|
1835
1895
|
let topRows = [];
|
|
1836
1896
|
let bottomRows = [];
|
|
@@ -1854,13 +1914,14 @@ function TableBody(props) {
|
|
|
1854
1914
|
const paddingBottom = virtualRows.length > 0
|
|
1855
1915
|
? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
|
|
1856
1916
|
: 0;
|
|
1917
|
+
const tabAttributes = reactComponents.useFocusableGroup({ tabBehavior: "limited" });
|
|
1857
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: {
|
|
1858
1919
|
position: "sticky",
|
|
1859
1920
|
top: 0,
|
|
1860
1921
|
zIndex: 9
|
|
1861
|
-
}, 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) => {
|
|
1862
1923
|
const row = rows[virtualRow.index];
|
|
1863
|
-
return (jsxRuntime.jsx(TableRow, { row: row,
|
|
1924
|
+
return (jsxRuntime.jsx(TableRow, { row: row, table: table, tabAttributes: tabAttributes }, row.id));
|
|
1864
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: {
|
|
1865
1926
|
position: "sticky",
|
|
1866
1927
|
bottom: 0,
|
|
@@ -1871,7 +1932,7 @@ function TableBody(props) {
|
|
|
1871
1932
|
position: "sticky",
|
|
1872
1933
|
bottom: 0,
|
|
1873
1934
|
zIndex: 9
|
|
1874
|
-
}, 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)) }) }) })] }));
|
|
1875
1936
|
}
|
|
1876
1937
|
|
|
1877
1938
|
const TableContainer = (props) => {
|
|
@@ -2365,8 +2426,12 @@ function useSkipper() {
|
|
|
2365
2426
|
}
|
|
2366
2427
|
|
|
2367
2428
|
Object.defineProperty(exports, 'createColumnHelper', {
|
|
2368
|
-
|
|
2369
|
-
|
|
2429
|
+
enumerable: true,
|
|
2430
|
+
get: function () { return reactTable.createColumnHelper; }
|
|
2370
2431
|
});
|
|
2432
|
+
exports.PinRowAction = PinRowAction;
|
|
2433
|
+
exports.SelectRowCheckbox = SelectRowCheckbox;
|
|
2434
|
+
exports.SelectRowRadio = SelectRowRadio;
|
|
2371
2435
|
exports.Table = ForwardedAdvancedTable;
|
|
2436
|
+
exports.disableAllShorthand = disableAllShorthand;
|
|
2372
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,10 +1030,17 @@ 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"]);
|
|
1025
1039
|
const TextClearFormattingFilled = /*#__PURE__*/createFluentIcon('TextClearFormattingFilled', "1em", ["M6 2c.2 0 .4.13.47.32l3.5 8.95a.5.5 0 0 1-.94.37L8.01 9H4l-1.04 2.68a.5.5 0 1 1-.94-.36l3.5-9A.5.5 0 0 1 6 2Zm0 1.88L4.4 8H7.6l-1.6-4.12ZM11.5 2c.28 0 .5.22.5.5v3.52a2.48 2.48 0 0 1 2.26-1.3c.89 0 1.6.34 2.15 1 .55.66.82 1.54.82 2.64l-.01.42-.05-.05a2.49 2.49 0 0 0-1.15-.65 2.86 2.86 0 0 0-.53-1.62c-.36-.47-.86-.7-1.48-.7-.6 0-1.09.24-1.47.72-.3.37-.47.83-.54 1.37v1.03c.05.43.18.8.37 1.12L11 11.37V2.5c0-.28.22-.5.5-.5Zm4.97 7.44 2.1 2.1a1.5 1.5 0 0 1-.01 2.12l-3.6 3.6-4.21-4.22 3.6-3.6a1.5 1.5 0 0 1 2.12 0Zm-2.22 8.52-4.21-4.21-.6.6a1.5 1.5 0 0 0 0 2.12l2.1 2.1c.3.3.71.45 1.12.43h4.09a.5.5 0 1 0 0-1h-2.53l.03-.04Z"]);
|
|
1040
|
+
const TextCollapseFilled = /*#__PURE__*/createFluentIcon('TextCollapseFilled', "1em", ["M5 3.5c0-.41.34-.75.75-.75h11.5a.75.75 0 0 1 0 1.5H5.75A.75.75 0 0 1 5 3.5Zm0 12c0-.41.34-.75.75-.75h11.5a.75.75 0 0 1 0 1.5H5.75A.75.75 0 0 1 5 15.5Zm6.75-8.75a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5h-5.5ZM11 11.5c0-.41.34-.75.75-.75h5.5a.75.75 0 0 1 0 1.5h-5.5a.75.75 0 0 1-.75-.75Zm-2-2a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Zm-6 0c0 .28.22.5.5.5h4a.5.5 0 0 0 0-1h-4a.5.5 0 0 0-.5.5Z"]);
|
|
1041
|
+
const TextCollapseRegular = /*#__PURE__*/createFluentIcon('TextCollapseRegular', "1em", ["M5 3.5c0-.28.22-.5.5-.5h12a.5.5 0 0 1 0 1h-12a.5.5 0 0 1-.5-.5Zm0 12c0-.28.22-.5.5-.5h12a.5.5 0 0 1 0 1h-12a.5.5 0 0 1-.5-.5Zm6-8c0-.28.22-.5.5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5Zm0 4c0-.28.22-.5.5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5Zm-2-2a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0ZM3.5 9a.5.5 0 0 0 0 1h4a.5.5 0 0 0 0-1h-4Z"]);
|
|
1042
|
+
const TextExpandFilled = /*#__PURE__*/createFluentIcon('TextExpandFilled', "1em", ["M4.75 3.5a.75.75 0 0 0 0 1.5h12.5a.75.75 0 0 0 0-1.5H4.75ZM4 16.25c0-.41.34-.75.75-.75h12.5a.75.75 0 0 1 0 1.5H4.75a.75.75 0 0 1-.75-.75Zm7-4c0-.41.34-.75.75-.75h5.5a.75.75 0 0 1 0 1.5h-5.5a.75.75 0 0 1-.75-.75Zm0-4c0-.41.34-.75.75-.75h5.5a.75.75 0 0 1 0 1.5h-5.5a.75.75 0 0 1-.75-.75ZM5.5 14a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7ZM6 8.5V10h1.5a.5.5 0 0 1 0 1H6v1.5a.5.5 0 0 1-1 0V11H3.5a.5.5 0 0 1 0-1H5V8.5a.5.5 0 0 1 1 0Z"]);
|
|
1043
|
+
const TextExpandRegular = /*#__PURE__*/createFluentIcon('TextExpandRegular', "1em", ["M4 4.5c0-.28.22-.5.5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5Zm0 12c0-.28.22-.5.5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5Zm6-4c0-.28.22-.5.5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm0-4c0-.28.22-.5.5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5ZM5.5 14a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7ZM6 8.5a.5.5 0 0 0-1 0V10H3.5a.5.5 0 0 0 0 1H5v1.5a.5.5 0 0 0 1 0V11h1.5a.5.5 0 0 0 0-1H6V8.5Z"]);
|
|
1026
1044
|
const TextSortAscendingFilled = /*#__PURE__*/createFluentIcon('TextSortAscendingFilled', "1em", ["M6.7 2.5a.75.75 0 0 0-1.4 0L3.03 9a.75.75 0 0 0 1.42.5l.34-1h2.4l.34 1A.75.75 0 0 0 8.96 9L6.7 2.5ZM6 5.04 6.68 7H5.32L6 5.04ZM4 11a.75.75 0 0 0 0 1.5h2.53l-3.14 4.3A.75.75 0 0 0 4 18h4a.75.75 0 0 0 0-1.5H5.47l3.14-4.3A.75.75 0 0 0 8 11H4Zm10.25-9c.41 0 .75.34.75.75v12.57l1.45-1.58a.75.75 0 0 1 1.1 1.02l-2.75 3a.75.75 0 0 1-1.1 0l-2.75-3a.75.75 0 0 1 1.1-1.02l1.45 1.58V2.75c0-.41.34-.75.75-.75Z"]);
|
|
1027
1045
|
const TextSortDescendingFilled = /*#__PURE__*/createFluentIcon('TextSortDescendingFilled', "1em", ["M4 2a.75.75 0 1 0 0 1.5h2.53L3.39 7.8A.75.75 0 0 0 4 9h4a.75.75 0 0 0 0-1.5H5.47l3.14-4.3A.75.75 0 0 0 8 2H4Zm2.7 8.5a.75.75 0 0 0-1.4 0L3.03 17a.75.75 0 1 0 1.42.5l.34-1h2.4l.34 1a.75.75 0 1 0 1.42-.5L6.7 10.5ZM6 13.04 6.68 15H5.32L6 13.04ZM14.25 2c.41 0 .75.34.75.75v12.57l1.45-1.58a.75.75 0 0 1 1.1 1.02l-2.75 3a.75.75 0 0 1-1.1 0l-2.75-3a.75.75 0 0 1 1.1-1.02l1.45 1.58V2.75c0-.41.34-.75.75-.75Z"]);
|
|
1028
1046
|
|
|
@@ -1150,10 +1168,11 @@ const useGridHeaderStyles = makeStyles({
|
|
|
1150
1168
|
|
|
1151
1169
|
const GridHeader = (props) => {
|
|
1152
1170
|
const { table, gridTitle, globalFilter, setGlobalFilter } = props;
|
|
1171
|
+
const focusAttribute = useArrowNavigationGroup({ axis: "horizontal", circular: true });
|
|
1153
1172
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
1154
1173
|
const { dispatchDrawerAction, drawerState } = table.options.meta;
|
|
1155
1174
|
const styles = useGridHeaderStyles();
|
|
1156
|
-
return (jsxs("div", { className: styles.tableTopHeaderContainer, children: [jsx("div", { className: styles.tableTopHeaderLeft, children: gridTitle }), jsxs("div", { className: styles.tableTopHeaderRight, children: [props.headerMenu, props.headerMenu && jsx(Divider, { vertical: true }), jsxs(Popover, { withArrow: true, children: [jsx(PopoverTrigger, { disableButtonEnhancement: true, children: jsx(Tooltip, { content: 'Toggle Group Column', relationship: "label", children: jsx(Button, { icon: jsx(ToggleGroupColumnIcon, {}), "aria-label": "Toggle Group Column" }) }) }), jsx(PopoverSurface, { className: styles.popoverSurface, children: jsxs("div", { className: styles.tableTopHeaderColumnTogglePopover, children: [jsx(MenuGroupHeader, { children: "Group Columns" }), table.getAllLeafColumns().map((column) => {
|
|
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) => {
|
|
1157
1176
|
if (column.id === 'select')
|
|
1158
1177
|
return null;
|
|
1159
1178
|
if (column.id === 'id')
|
|
@@ -1165,7 +1184,7 @@ const GridHeader = (props) => {
|
|
|
1165
1184
|
return (jsx(Checkbox, { checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler(), label: column.id, disabled: !column.getCanHide() }, column.id));
|
|
1166
1185
|
})] }) })] }), jsx(Tooltip, { content: 'Table Views Management', relationship: "label", children: jsx(Button, { onClick: () => {
|
|
1167
1186
|
dispatchDrawerAction === null || dispatchDrawerAction === void 0 ? void 0 : dispatchDrawerAction({ type: "TOGGLE_VIEW_DRAWER" });
|
|
1168
|
-
}, icon: jsx(Album24Regular, {}), "aria-label": "View Menu" }) }), jsx(DebouncedInput, { value: globalFilter !== null && globalFilter !== void 0 ? globalFilter : '', onChange: (value) => setGlobalFilter(String(value)), className: "p-2 font-lg shadow border border-block", placeholder: "Search all columns...", dispatch: dispatchDrawerAction, drawerState: drawerState })] })] }));
|
|
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 })] }))] }));
|
|
1169
1188
|
};
|
|
1170
1189
|
// A debounced input react component
|
|
1171
1190
|
function DebouncedInput({ value: initialValue, onChange, debounce = 500, drawerState, dispatch, }) {
|
|
@@ -1271,7 +1290,7 @@ function tableReducer(state, action) {
|
|
|
1271
1290
|
}
|
|
1272
1291
|
|
|
1273
1292
|
const useGridContainer = (props, ref) => {
|
|
1274
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1293
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1275
1294
|
const { defaultColumn, columns, data, rowSelectionMode, autoResetPageIndex, onUpdateData } = props;
|
|
1276
1295
|
const [drawerState, dispatch] = React.useReducer(tableReducer, {
|
|
1277
1296
|
isFilterDrawerOpen: false,
|
|
@@ -1328,7 +1347,7 @@ const useGridContainer = (props, ref) => {
|
|
|
1328
1347
|
rowPinning
|
|
1329
1348
|
},
|
|
1330
1349
|
getRowId(originalRow, index, parent) {
|
|
1331
|
-
const keyProps = props.dataPrimaryKye
|
|
1350
|
+
const keyProps = props.dataPrimaryKye;
|
|
1332
1351
|
return originalRow[keyProps] || `${index}`;
|
|
1333
1352
|
},
|
|
1334
1353
|
columnResizeMode: 'onChange',
|
|
@@ -1364,6 +1383,7 @@ const useGridContainer = (props, ref) => {
|
|
|
1364
1383
|
meta: {
|
|
1365
1384
|
pageSizeOptions: props.pageSizeOptions || [10, 20, 50, 100, 1000],
|
|
1366
1385
|
rowSelectionMode: props.rowSelectionMode,
|
|
1386
|
+
isAutoExpandOnGroup: (_k = props.isAutoExpandOnGroup) !== null && _k !== void 0 ? _k : false,
|
|
1367
1387
|
tableHeight: props.tableHeight || "650px",
|
|
1368
1388
|
updateData: onUpdateData,
|
|
1369
1389
|
onTableViewDelete: props.onTableViewDelete,
|
|
@@ -1382,7 +1402,8 @@ const useGridContainer = (props, ref) => {
|
|
|
1382
1402
|
setExpanded,
|
|
1383
1403
|
setColumnPinning,
|
|
1384
1404
|
setColumnSizing,
|
|
1385
|
-
setRowPinning
|
|
1405
|
+
setRowPinning,
|
|
1406
|
+
tableSettings: (_l = props.tableSettings) !== null && _l !== void 0 ? _l : {},
|
|
1386
1407
|
}
|
|
1387
1408
|
});
|
|
1388
1409
|
const tableViews = React.useMemo(() => { var _a; return (_a = props.views) !== null && _a !== void 0 ? _a : []; }, [props.views]);
|
|
@@ -1558,15 +1579,21 @@ const getBodyCellPinningStyles = (column, isDragging, additionalStyles) => {
|
|
|
1558
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);
|
|
1559
1580
|
return styles;
|
|
1560
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
|
+
};
|
|
1561
1586
|
|
|
1562
1587
|
const MoreIcon = bundleIcon$1(MoreVerticalFilled, MoreVerticalRegular);
|
|
1563
1588
|
const SortAscIcon = bundleIcon$1(ArrowSortDown20Filled, ArrowSortDown20Regular);
|
|
1564
1589
|
const SortDescIcon = bundleIcon$1(ArrowSortUp20Filled, ArrowSortUp20Regular);
|
|
1565
1590
|
const PinIcon = bundleIcon$1(PinFilled, PinRegular);
|
|
1566
1591
|
const HideColumnIcon = bundleIcon$1(EyeTrackingOffFilled, EyeTrackingOffRegular);
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1592
|
+
const GroupExpandIcon = bundleIcon$1(TextExpandFilled, TextExpandRegular);
|
|
1593
|
+
const GroupCollapseIcon = bundleIcon$1(TextCollapseFilled, TextCollapseRegular);
|
|
1594
|
+
function HeaderCell({ header, table, tabAttributes }) {
|
|
1595
|
+
var _a, _b, _c;
|
|
1596
|
+
const { column, id } = header;
|
|
1570
1597
|
const { isDragging, attributes, listeners, setNodeRef, transform, transition, } = useSortable({
|
|
1571
1598
|
id: column.id
|
|
1572
1599
|
});
|
|
@@ -1575,13 +1602,13 @@ function HeaderCell({ header, table, hideMenu, headerDepth, totalNumberOfHeaderD
|
|
|
1575
1602
|
transition
|
|
1576
1603
|
};
|
|
1577
1604
|
const styles = useTableHeaderStyles();
|
|
1578
|
-
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;
|
|
1579
1606
|
const headerCellCombinedStyles = getHeaderCellPinningStyles(column, isDragging, dndStyle);
|
|
1580
1607
|
if (header.isPlaceholder) {
|
|
1581
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) }) }) }));
|
|
1582
1609
|
}
|
|
1583
1610
|
const columnName = flexRender(header.column.columnDef.header, header.getContext());
|
|
1584
|
-
return (jsxs("th", { colSpan: header.colSpan, className: mergeClasses$1(styles.tHeadCell, isLeafHeaders && styles.tHeadNonLeafCell, isDragging && styles.tHeadCellDragging), style: headerCellCombinedStyles, ref: setNodeRef, children: [jsx("div", Object.assign({ className: styles.tHeadCellDraggable }, attributes, listeners, { children: jsxs("div", { className: isLeafHeaders
|
|
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
|
|
1585
1612
|
? styles.tLeafHeadCellContent
|
|
1586
1613
|
: styles.tNonLeafHeadCellContent, children: [jsx("div", { children: jsx(Show, { when: !header.isPlaceholder, children: jsxs(Button, { style: {
|
|
1587
1614
|
display: 'flex',
|
|
@@ -1596,10 +1623,10 @@ function HeaderCell({ header, table, hideMenu, headerDepth, totalNumberOfHeaderD
|
|
|
1596
1623
|
if (!header.column.getCanGroup())
|
|
1597
1624
|
return;
|
|
1598
1625
|
header.column.getToggleGroupingHandler()();
|
|
1599
|
-
}, appearance: "transparent", className: styles.tHeadContentBtn, icon: (
|
|
1626
|
+
}, appearance: "transparent", className: styles.tHeadContentBtn, icon: (_c = {
|
|
1600
1627
|
asc: (jsx("strong", { children: jsx(SortAscIcon, {}) })),
|
|
1601
1628
|
desc: (jsx("strong", { children: jsx(SortDescIcon, {}) })),
|
|
1602
|
-
}[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 }) })] })));
|
|
1603
1630
|
}
|
|
1604
1631
|
function HeaderMenu(props) {
|
|
1605
1632
|
const { header, table, hideMenu } = props;
|
|
@@ -1625,7 +1652,15 @@ function HeaderMenu(props) {
|
|
|
1625
1652
|
var _a;
|
|
1626
1653
|
const isControlKeySelected = e.ctrlKey;
|
|
1627
1654
|
(_a = header.column) === null || _a === void 0 ? void 0 : _a.toggleSorting(true, isControlKeySelected);
|
|
1628
|
-
}, icon: jsx(TextSortDescendingFilled, {}), disabled: header.column.getIsSorted() === 'desc', children: "Sort Z to A" }), jsx(MenuDivider, {})] }, 'sort-group') }), jsx(Show, { when: header.column.getCanGroup(), children: jsxs(MenuGroup, { children: [!header.column.getIsGrouped() && (jsxs(MenuItem, { onClick: () =>
|
|
1655
|
+
}, icon: jsx(TextSortDescendingFilled, {}), disabled: header.column.getIsSorted() === 'desc', children: "Sort Z to A" }), jsx(MenuDivider, {})] }, 'sort-group') }), jsx(Show, { when: header.column.getCanGroup(), children: jsxs(MenuGroup, { children: [!header.column.getIsGrouped() && (jsxs(MenuItem, { onClick: () => {
|
|
1656
|
+
header.column.getToggleGroupingHandler()();
|
|
1657
|
+
const { isAutoExpandOnGroup } = table.options.meta;
|
|
1658
|
+
if (isAutoExpandOnGroup) {
|
|
1659
|
+
table.toggleAllRowsExpanded(true);
|
|
1660
|
+
}
|
|
1661
|
+
}, icon: jsx(GroupFilled, {}), children: ["Group Column (by ", columnName, ")"] })), jsxs(Show, { when: header.column.getIsGrouped(), children: [jsxs(MenuItem, { onClick: () => {
|
|
1662
|
+
header.column.getToggleGroupingHandler()();
|
|
1663
|
+
}, icon: jsx(GroupDismissFilled, {}), children: ["Remove Grouping (on ", columnName, ")"] }), jsx(MenuItem, { onClick: () => table.toggleAllRowsExpanded(), icon: table.getIsAllRowsExpanded() ? jsx(GroupCollapseIcon, {}) : jsx(GroupExpandIcon, {}), children: jsx(Show, { when: table.getIsAllRowsExpanded(), fallback: jsx(Fragment, { children: "Expand All Groups" }), children: "Collapse All Groups" }) })] }), jsx(MenuDivider, {})] }, 'grouping-group') }), jsx(Show, { when: header.column.getCanPin(), children: jsxs(Menu, { children: [jsx(MenuTrigger, { disableButtonEnhancement: true, children: jsxs(MenuItem, { icon: jsx(PinIcon, {}), children: ["Pin Column (", columnName, ")"] }) }), jsx(MenuPopover, { children: jsxs(MenuList, { children: [jsx(MenuItem, { onClick: () => {
|
|
1629
1664
|
var _a;
|
|
1630
1665
|
(_a = header.column) === null || _a === void 0 ? void 0 : _a.pin(false);
|
|
1631
1666
|
}, icon: jsx(PinOffRegular, {}), disabled: !(['left', 'right'].includes(header.column.getIsPinned())), children: "No Pin" }), jsx(MenuItem, { onClick: () => {
|
|
@@ -1649,19 +1684,24 @@ function HeaderMenu(props) {
|
|
|
1649
1684
|
}
|
|
1650
1685
|
|
|
1651
1686
|
function HeaderRow(props) {
|
|
1687
|
+
var _a;
|
|
1652
1688
|
const styles = useTableHeaderStyles();
|
|
1653
|
-
const { table, headerGroup,
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
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));
|
|
1659
1698
|
}
|
|
1660
1699
|
|
|
1661
1700
|
function TableHeader(props) {
|
|
1662
1701
|
const styles = useTableHeaderStyles();
|
|
1663
1702
|
const { table, headerGroups, rowSelectionMode } = props;
|
|
1664
|
-
|
|
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))) })));
|
|
1665
1705
|
}
|
|
1666
1706
|
|
|
1667
1707
|
const useLoadingStyles = makeStyles({
|
|
@@ -1784,31 +1824,51 @@ function TableCell({ cell, row }) {
|
|
|
1784
1824
|
return (jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
|
|
1785
1825
|
}
|
|
1786
1826
|
|
|
1787
|
-
|
|
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;
|
|
1788
1846
|
const styles = useTableBodyStyles();
|
|
1789
|
-
|
|
1847
|
+
const { rowSelectionMode, tableSettings } = (_a = table.options.meta) !== null && _a !== void 0 ? _a : {};
|
|
1848
|
+
return (jsxs("tr", Object.assign({ className: row.getIsSelected() || row.getIsAllSubRowsSelected()
|
|
1790
1849
|
? styles.tBodySelectedRow
|
|
1791
|
-
: styles.tBodyRow, style: style, children: [jsxs(Switch, { when: rowSelectionMode, children: [jsx(Case, { value: 'multiple', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row
|
|
1792
|
-
? 'mixed'
|
|
1793
|
-
: row.getIsSelected() || row.getIsAllSubRowsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) }), jsx(Case, { value: 'single', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsx(Radio, { checked: row.getIsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) })] }), row.getVisibleCells().map((cell) => (jsx(TableCell, { cell: cell, row: row }, cell.id)))] }, row.id));
|
|
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));
|
|
1794
1851
|
}
|
|
1795
|
-
function
|
|
1852
|
+
function PinnedRowRaw({ row, table, style, bottomRowLength, tabAttributes }) {
|
|
1853
|
+
var _a;
|
|
1796
1854
|
const styles = useTableBodyStyles();
|
|
1797
|
-
const
|
|
1798
|
-
|
|
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()
|
|
1799
1859
|
? styles.tBodySelectedRow
|
|
1800
|
-
: styles.tBodyRow, style: pinnedRowRawStyle, children: [jsxs(Switch, { when: rowSelectionMode, children: [jsx(Case, { value: 'multiple', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsx(
|
|
1801
|
-
? 'mixed'
|
|
1802
|
-
: row.getIsSelected() || row.getIsAllSubRowsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) }), jsx(Case, { value: 'single', children: jsx("td", { className: styles.tBodyCell, "aria-label": "Select Row Column", children: jsx(Radio, { checked: row.getIsSelected(), disabled: !row.getCanSelect(), onChange: row.getToggleSelectedHandler(), "aria-label": "Select Row" }) }) })] }), row.getVisibleCells().map(cell => {
|
|
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 => {
|
|
1803
1861
|
return (jsx(TableCell, { cell: cell, row: row }, cell.id));
|
|
1804
|
-
})] }, row.id));
|
|
1862
|
+
})] }), row.id));
|
|
1805
1863
|
}
|
|
1864
|
+
const TableRow = TableRowRaw;
|
|
1865
|
+
const PinnedRow = PinnedRowRaw;
|
|
1806
1866
|
|
|
1807
1867
|
function TableBody(props) {
|
|
1808
1868
|
var _a, _b, _c;
|
|
1809
1869
|
const styles = useTableBodyStyles();
|
|
1810
1870
|
const { table, tableContainerRef } = props;
|
|
1811
|
-
const rowSelectionMode = (_a = table.options.meta)
|
|
1871
|
+
const { rowSelectionMode } = (_a = table.options.meta) !== null && _a !== void 0 ? _a : {};
|
|
1812
1872
|
let rows = [];
|
|
1813
1873
|
let topRows = [];
|
|
1814
1874
|
let bottomRows = [];
|
|
@@ -1832,13 +1892,14 @@ function TableBody(props) {
|
|
|
1832
1892
|
const paddingBottom = virtualRows.length > 0
|
|
1833
1893
|
? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
|
|
1834
1894
|
: 0;
|
|
1895
|
+
const tabAttributes = useFocusableGroup({ tabBehavior: "limited" });
|
|
1835
1896
|
return (jsxs(Fragment, { children: [jsx(Show, { when: (topRows === null || topRows === void 0 ? void 0 : topRows.length) > 0, children: jsx("thead", { style: {
|
|
1836
1897
|
position: "sticky",
|
|
1837
1898
|
top: 0,
|
|
1838
1899
|
zIndex: 9
|
|
1839
|
-
}, 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) => {
|
|
1840
1901
|
const row = rows[virtualRow.index];
|
|
1841
|
-
return (jsx(TableRow, { row: row,
|
|
1902
|
+
return (jsx(TableRow, { row: row, table: table, tabAttributes: tabAttributes }, row.id));
|
|
1842
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: {
|
|
1843
1904
|
position: "sticky",
|
|
1844
1905
|
bottom: 0,
|
|
@@ -1849,7 +1910,7 @@ function TableBody(props) {
|
|
|
1849
1910
|
position: "sticky",
|
|
1850
1911
|
bottom: 0,
|
|
1851
1912
|
zIndex: 9
|
|
1852
|
-
}, 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)) }) }) })] }));
|
|
1853
1914
|
}
|
|
1854
1915
|
|
|
1855
1916
|
const TableContainer = (props) => {
|
|
@@ -2342,4 +2403,4 @@ function useSkipper() {
|
|
|
2342
2403
|
return [shouldSkip, skip];
|
|
2343
2404
|
}
|
|
2344
2405
|
|
|
2345
|
-
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>;
|
|
@@ -18,6 +21,7 @@ declare module '@tanstack/react-table' {
|
|
|
18
21
|
interface TableMeta<TData extends RowData> {
|
|
19
22
|
rowSelectionMode: TableProps<TData>["rowSelectionMode"];
|
|
20
23
|
pageSizeOptions: TableProps<TData>["pageSizeOptions"];
|
|
24
|
+
isAutoExpandOnGroup: TableProps<TData>["isAutoExpandOnGroup"];
|
|
21
25
|
tableHeight: string;
|
|
22
26
|
updateData?: (rowIndex: number, columnId: string, value: unknown) => void;
|
|
23
27
|
onTableViewSave?: TableProps<TData>["onTableViewSave"];
|
|
@@ -36,9 +40,9 @@ declare module '@tanstack/react-table' {
|
|
|
36
40
|
setColumnPinning: React.Dispatch<React.SetStateAction<ColumnPinningState>>;
|
|
37
41
|
setColumnSizing: React.Dispatch<React.SetStateAction<ColumnSizingState>>;
|
|
38
42
|
setRowPinning: React.Dispatch<React.SetStateAction<RowPinningState>>;
|
|
43
|
+
tableSettings: TableSettings;
|
|
39
44
|
}
|
|
40
45
|
}
|
|
41
|
-
export { Table, useSkipper } from "./components";
|
|
42
46
|
export type { TableProps, TableRef, TableView } from "./types";
|
|
43
|
-
export type { TableState, ColumnDef } from '@tanstack/react-table';
|
|
47
|
+
export type { TableState, ColumnDef, Column as ColumnType, Row as RowType, RowData as RowDataType, Table as TableType } from '@tanstack/react-table';
|
|
44
48
|
export { createColumnHelper } from "@tanstack/react-table";
|
|
@@ -16,6 +16,11 @@ export type TableProps<TItem extends RowData> = {
|
|
|
16
16
|
* Table loading state.
|
|
17
17
|
*/
|
|
18
18
|
isLoading?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* While grouping isExpanded will use to make default expand state.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
isAutoExpandOnGroup?: boolean;
|
|
19
24
|
/**
|
|
20
25
|
* Grid title
|
|
21
26
|
*/
|
|
@@ -108,4 +113,11 @@ export type TableProps<TItem extends RowData> = {
|
|
|
108
113
|
* disable table header
|
|
109
114
|
*/
|
|
110
115
|
disableTableHeader?: boolean;
|
|
116
|
+
tableSettings?: TableSettings;
|
|
117
|
+
};
|
|
118
|
+
export type TableSettings = {
|
|
119
|
+
/**
|
|
120
|
+
* Enable manual selection of table view
|
|
121
|
+
*/
|
|
122
|
+
enableManualSelection?: boolean;
|
|
111
123
|
};
|