@prt-ts/fluent-react-table-v2 9.46.8-build.3.0 → 9.46.8-build.5.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 +353 -191
- package/index.esm.js +354 -193
- package/package.json +8 -4
- package/src/lib/components/GridContainer.d.ts +3 -2
- package/src/lib/components/filters/Filter.d.ts +1 -1
- package/src/lib/components/filters/FilterDate.d.ts +3 -3
- package/src/lib/components/filters/FilterDateRange.d.ts +3 -3
- package/src/lib/components/filters/FilterDrawer.d.ts +3 -3
- package/src/lib/components/filters/FilterMultiSelectCheckbox.d.ts +1 -1
- package/src/lib/components/filters/FilterNumberRange.d.ts +3 -3
- package/src/lib/components/filters/FilterSelectRadio.d.ts +1 -1
- package/src/lib/components/grid-header/GridHeader.d.ts +3 -3
- package/src/lib/components/grid-header/useGridHeaderStyles.d.ts +1 -1
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/components/pagination/Pagination.d.ts +3 -4
- package/src/lib/components/table/Table.d.ts +3 -4
- package/src/lib/components/tbody/TableBody.d.ts +6 -9
- package/src/lib/components/tbody/TableCell.d.ts +3 -3
- package/src/lib/components/tbody/TableRow.d.ts +7 -3
- package/src/lib/components/tbody/useTableBodyStyles.d.ts +1 -1
- package/src/lib/components/thead/HeaderCell.d.ts +3 -3
- package/src/lib/components/thead/HeaderRow.d.ts +3 -3
- package/src/lib/components/thead/TableHeader.d.ts +3 -3
- package/src/lib/components/thead/useTableHeaderStyles.d.ts +1 -1
- package/src/lib/components/useGridContainer.d.ts +2 -3
- package/src/lib/components/useSkipper.d.ts +1 -0
- package/src/lib/components/views/ViewSaveForm.d.ts +3 -3
- package/src/lib/components/views/ViewsDrawer.d.ts +4 -6
- package/src/lib/helpers/Helpers.d.ts +1 -1
- package/src/lib/helpers/StylesHelper.d.ts +4 -0
- package/src/lib/index.d.ts +13 -2
- package/src/lib/types/TableProps.d.ts +18 -2
- package/src/lib/types/TableRef.d.ts +2 -2
package/index.cjs.js
CHANGED
|
@@ -4,12 +4,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var reactDnd = require('react-dnd');
|
|
8
|
-
var reactDndHtml5Backend = require('react-dnd-html5-backend');
|
|
9
7
|
var reactComponents = require('@fluentui/react-components');
|
|
8
|
+
var reactControlFlow = require('@prt-ts/react-control-flow');
|
|
10
9
|
var reactTable = require('@tanstack/react-table');
|
|
11
|
-
var reactVirtual = require('react-virtual');
|
|
10
|
+
var reactVirtual = require('@tanstack/react-virtual');
|
|
12
11
|
var reactDatepickerCompat = require('@fluentui/react-datepicker-compat');
|
|
12
|
+
var sortable = require('@dnd-kit/sortable');
|
|
13
|
+
var utilities = require('@dnd-kit/utilities');
|
|
14
|
+
var reactVirtual$1 = require('react-virtual');
|
|
15
|
+
var core = require('@dnd-kit/core');
|
|
16
|
+
var modifiers = require('@dnd-kit/modifiers');
|
|
13
17
|
|
|
14
18
|
function _interopNamespace(e) {
|
|
15
19
|
if (e && e.__esModule) return e;
|
|
@@ -37,7 +41,9 @@ const useStaticStyles = reactComponents.makeStaticStyles({
|
|
|
37
41
|
},
|
|
38
42
|
});
|
|
39
43
|
const useTableStaticStyles = reactComponents.makeStyles({
|
|
40
|
-
tableContainer: Object.assign(Object.assign({
|
|
44
|
+
tableContainer: Object.assign(Object.assign({
|
|
45
|
+
// height: "650px",
|
|
46
|
+
width: "100%" }, reactComponents.shorthands.overflow("hidden", "auto")), {
|
|
41
47
|
/* width */
|
|
42
48
|
":hover": Object.assign({}, reactComponents.shorthands.overflow("auto", "auto")), "::-webkit-scrollbar": Object.assign({ width: "6px", height: "4px" }, reactComponents.shorthands.borderRadius("50%")),
|
|
43
49
|
/* Track */
|
|
@@ -1023,6 +1029,7 @@ const GroupDismissFilled = /*#__PURE__*/createFluentIcon('GroupDismissFilled', "
|
|
|
1023
1029
|
const GroupListRegular = /*#__PURE__*/createFluentIcon('GroupListRegular', "1em", ["M2.5 3a.5.5 0 0 0-.5.5v5c0 .28.22.5.5.5h2a.5.5 0 0 0 0-1H3V4h1.5a.5.5 0 0 0 0-1h-2Zm0 8a.5.5 0 0 0-.5.5v5c0 .28.22.5.5.5h2a.5.5 0 0 0 0-1H3v-4h1.5a.5.5 0 0 0 0-1h-2ZM6 4.5c0-.28.22-.5.5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5Zm.5 7.5a.5.5 0 0 0 0 1h11a.5.5 0 0 0 0-1h-11ZM6 7.5c0-.28.22-.5.5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5Zm.5 7.5a.5.5 0 0 0 0 1h11a.5.5 0 0 0 0-1h-11Z"]);
|
|
1024
1030
|
const NextRegular = /*#__PURE__*/createFluentIcon('NextRegular', "1em", ["M17 3.5a.5.5 0 0 0-1 0v13a.5.5 0 1 0 1 0v-13ZM3 4.25c0-1 1.12-1.6 1.95-1.04l8.5 5.71c.73.5.73 1.57 0 2.07l-8.5 5.8A1.25 1.25 0 0 1 3 15.75V4.25Zm1.39-.2a.25.25 0 0 0-.39.2v11.5c0 .2.23.32.4.2l8.49-5.78a.25.25 0 0 0 0-.42l-8.5-5.7Z"]);
|
|
1025
1031
|
|
|
1032
|
+
const PinFilled = /*#__PURE__*/createFluentIcon('PinFilled', "1em", ["M13.33 2.62a2 2 0 0 0-3.2.52L8.38 6.6a1.5 1.5 0 0 1-.78.72L4 8.75a1 1 0 0 0-.33 1.64l2.61 2.6L3 16.3v.7h.7L7 13.72l2.61 2.6a1 1 0 0 0 1.64-.33l1.43-3.59c.14-.34.4-.62.72-.78l3.46-1.73a2 2 0 0 0 .52-3.2l-4.05-4.06Z"]);
|
|
1026
1033
|
const PinRegular = /*#__PURE__*/createFluentIcon('PinRegular', "1em", ["M10.12 3.14a2 2 0 0 1 3.2-.52l4.06 4.05a2 2 0 0 1-.52 3.2l-3.46 1.74a1.5 1.5 0 0 0-.72.78L11.25 16a1 1 0 0 1-1.64.33L7 13.7 3.7 17H3v-.7L6.3 13l-2.62-2.61a1 1 0 0 1 .34-1.64L7.6 7.32c.34-.14.62-.4.78-.72l1.73-3.46Zm2.5.18a1 1 0 0 0-1.6.26L9.29 7.04a2.5 2.5 0 0 1-1.31 1.2L4.39 9.69l5.93 5.93 1.43-3.59a2.5 2.5 0 0 1 1.2-1.3l3.46-1.74a1 1 0 0 0 .26-1.6l-4.05-4.06Z"]);
|
|
1027
1034
|
const PinOffRegular = /*#__PURE__*/createFluentIcon('PinOffRegular', "1em", ["M2.85 2.15a.5.5 0 1 0-.7.7L6.9 7.6 4.02 8.75a1 1 0 0 0-.34 1.64L6.3 13 3 16.3v.7h.7L7 13.7l2.61 2.62a1 1 0 0 0 1.64-.34l1.15-2.88 4.75 4.75a.5.5 0 0 0 .7-.7l-15-15Zm8.78 10.18-1.31 3.28-5.93-5.93 3.28-1.3 3.96 3.95Zm1.33-1.62-.08.04.74.75 3.24-1.62a2 2 0 0 0 .52-3.2l-4.05-4.06a2 2 0 0 0-3.2.52L8.5 6.38l.75.74.04-.08 1.73-3.45a1 1 0 0 1 1.6-.26l4.05 4.05a1 1 0 0 1-.26 1.6l-3.45 1.73Z"]);
|
|
1028
1035
|
const PreviousRegular = /*#__PURE__*/createFluentIcon('PreviousRegular', "1em", ["M3 3.5a.5.5 0 0 1 1 0v13a.5.5 0 0 1-1 0v-13Zm14 .75c0-1-1.12-1.6-1.95-1.04l-8.5 5.71c-.73.5-.73 1.57 0 2.07l8.5 5.8c.83.56 1.95-.03 1.95-1.04V4.25Zm-1.39-.2c.17-.12.39 0 .39.2v11.5c0 .2-.22.32-.4.2l-8.49-5.78a.25.25 0 0 1 0-.42l8.5-5.7Z"]);
|
|
@@ -1095,7 +1102,8 @@ const range = (from, to, step = 1) => {
|
|
|
1095
1102
|
};
|
|
1096
1103
|
const DEFAULT_NUMBER_OF_PAGE_BTN = 5;
|
|
1097
1104
|
const Pagination = (props) => {
|
|
1098
|
-
const { table
|
|
1105
|
+
const { table } = props;
|
|
1106
|
+
const { pageSizeOptions } = table.options.meta || {};
|
|
1099
1107
|
const pageSizeSelectionId = reactComponents.useId("page-size-selector");
|
|
1100
1108
|
const styles = usePaginationStyle();
|
|
1101
1109
|
const totalNumberOfPage = table.getPageCount();
|
|
@@ -1118,12 +1126,12 @@ const Pagination = (props) => {
|
|
|
1118
1126
|
const currentPageOptions = end - start >= 0 ? range(start, end) : [];
|
|
1119
1127
|
return (currentPageOptions === null || currentPageOptions === void 0 ? void 0 : currentPageOptions.length) ? [...currentPageOptions] : [1];
|
|
1120
1128
|
}, [totalNumberOfPage, currentPage]);
|
|
1121
|
-
return (jsxRuntime.jsx("div", { className: styles.paginationContainer, children: jsxRuntime.jsxs("div", { className: styles.wrapper, children: [jsxRuntime.jsx("div", { className: styles.pageSelectionWrapper, children: jsxRuntime.jsx(reactComponents.Dropdown, { id: pageSizeSelectionId, size: "small", selectedOptions: [`${pageSize}`], placeholder: "Select Page Size", value: table.getState().pagination.pageSize.toString(), onOptionSelect: (_, data) => { var _a; return table.setPageSize(Number(+((_a = data.selectedOptions) === null || _a === void 0 ? void 0 : _a[0]))); }, className: styles.pageSelectionDropdown, "aria-label": "Select Page Size", children:
|
|
1129
|
+
return (jsxRuntime.jsx("div", { className: styles.paginationContainer, children: jsxRuntime.jsxs("div", { className: styles.wrapper, children: [jsxRuntime.jsx("div", { className: styles.pageSelectionWrapper, children: jsxRuntime.jsx(reactComponents.Dropdown, { id: pageSizeSelectionId, size: "small", selectedOptions: [`${pageSize}`], placeholder: "Select Page Size", value: table.getState().pagination.pageSize.toString(), onOptionSelect: (_, data) => { var _a; return table.setPageSize(Number(+((_a = data.selectedOptions) === null || _a === void 0 ? void 0 : _a[0]))); }, className: styles.pageSelectionDropdown, "aria-label": "Select Page Size", children: jsxRuntime.jsx(reactControlFlow.Show, { when: (pageSelectionOptions === null || pageSelectionOptions === void 0 ? void 0 : pageSelectionOptions.length) > 0, children: jsxRuntime.jsx(reactControlFlow.For, { each: pageSizeOptions, children: (option) => (jsxRuntime.jsx(reactComponents.Option, { value: `${option}`, children: `${option}` }, option)) }) }) }) }), jsxRuntime.jsxs("div", { className: styles.pageBtnContainer, children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("span", { children: ["Page", " ", jsxRuntime.jsxs("strong", { children: [table.getState().pagination.pageIndex + 1, " of", " ", table.getPageCount()] })] }), jsxRuntime.jsxs("span", { children: [" ", "| Go to page:", " ", jsxRuntime.jsx(reactComponents.Input, { type: "number", size: "small", value: `${table.getState().pagination.pageIndex + 1}`, onChange: (e, data) => {
|
|
1122
1130
|
const page = data.value ? Number(e.target.value) - 1 : 0;
|
|
1123
1131
|
if (page >= 0 && page < table.getPageCount()) {
|
|
1124
1132
|
table.setPageIndex(page);
|
|
1125
1133
|
}
|
|
1126
|
-
}, className: styles.pageSizeInput, "aria-label": "Page Number", autoComplete: "off", autoCorrect: "off" })] })] }), jsxRuntime.jsx(reactComponents.Button, { size: "small", className: styles.pageBtn, shape: "circular", onClick: () => table.setPageIndex(0), disabled: !table.getCanPreviousPage(), icon: jsxRuntime.jsx(PreviousRegular, {}), "aria-label": "Go to first page" }), jsxRuntime.jsx(reactComponents.Button, { size: "small", className: styles.pageBtn, shape: "circular", onClick: () => table.previousPage(), disabled: !table.getCanPreviousPage(), icon: jsxRuntime.jsx(ArrowPreviousFilled, {}), "aria-label": "Go to previous page" }),
|
|
1134
|
+
}, className: styles.pageSizeInput, "aria-label": "Page Number", autoComplete: "off", autoCorrect: "off" })] })] }), jsxRuntime.jsx(reactComponents.Button, { size: "small", className: styles.pageBtn, shape: "circular", onClick: () => table.setPageIndex(0), disabled: !table.getCanPreviousPage(), icon: jsxRuntime.jsx(PreviousRegular, {}), "aria-label": "Go to first page" }), jsxRuntime.jsx(reactComponents.Button, { size: "small", className: styles.pageBtn, shape: "circular", onClick: () => table.previousPage(), disabled: !table.getCanPreviousPage(), icon: jsxRuntime.jsx(ArrowPreviousFilled, {}), "aria-label": "Go to previous page" }), jsxRuntime.jsx(reactControlFlow.For, { each: pageSelectionOptions, children: (option, index) => (jsxRuntime.jsx(reactComponents.Button, { shape: "circular", appearance: option - 1 === currentPage ? "primary" : undefined, onClick: () => table.setPageIndex(option - 1), "aria-label": `Show Page ${option}`, size: "small", className: styles.pageBtn, children: option }, index)) }), jsxRuntime.jsx(reactComponents.Button, { size: "small", className: styles.pageBtn, shape: "circular", onClick: () => table.nextPage(), disabled: !table.getCanNextPage(), icon: jsxRuntime.jsx(ArrowNextFilled, {}), "aria-label": "Go to next page" }), jsxRuntime.jsx(reactComponents.Button, { size: "small", shape: "circular", className: styles.pageBtn, onClick: () => table.setPageIndex(table.getPageCount() - 1), disabled: !table.getCanNextPage(), icon: jsxRuntime.jsx(NextRegular, {}), "aria-label": "Go to last page" })] })] }) }));
|
|
1127
1135
|
};
|
|
1128
1136
|
|
|
1129
1137
|
bundleIcon$1(SaveFilled, SaveRegular);
|
|
@@ -1152,21 +1160,24 @@ const useGridHeaderStyles = reactComponents.makeStyles({
|
|
|
1152
1160
|
width: "100%",
|
|
1153
1161
|
height: "100%",
|
|
1154
1162
|
},
|
|
1163
|
+
popoverSurface: {
|
|
1164
|
+
minWidth: "300px"
|
|
1165
|
+
}
|
|
1155
1166
|
});
|
|
1156
1167
|
|
|
1157
1168
|
const GridHeader = (props) => {
|
|
1158
1169
|
const { table, gridTitle, globalFilter, setGlobalFilter, dispatch, drawerState } = props;
|
|
1159
1170
|
const styles = useGridHeaderStyles();
|
|
1160
|
-
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, { children: jsxRuntime.jsxs("div", { className: styles.tableTopHeaderColumnTogglePopover, children: [jsxRuntime.jsx(reactComponents.MenuGroupHeader, { children: "Group Columns" }), table.getAllLeafColumns().map((column) => {
|
|
1171
|
+
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) => {
|
|
1161
1172
|
if (column.id === 'select')
|
|
1162
1173
|
return null;
|
|
1163
1174
|
if (column.id === 'id')
|
|
1164
1175
|
return null;
|
|
1165
|
-
return (jsxRuntime.jsx(reactComponents.
|
|
1166
|
-
})] }) })] }), jsxRuntime.jsxs(reactComponents.Popover, { withArrow: true, children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { disableButtonEnhancement: true, children: jsxRuntime.jsx(reactComponents.Tooltip, { content: 'Toggle Column Visibility', relationship: "label", children: jsxRuntime.jsx(reactComponents.Button, { icon: jsxRuntime.jsx(ToggleSelectColumnIcon, {}), "aria-label": "Toggle Column Visibility" }) }) }), jsxRuntime.jsx(reactComponents.PopoverSurface, { children: jsxRuntime.jsxs("div", { className: styles.tableTopHeaderColumnTogglePopover, children: [jsxRuntime.jsx(reactComponents.MenuGroupHeader, { children: "Toggle Columns" }), jsxRuntime.jsx(reactComponents.
|
|
1176
|
+
return (jsxRuntime.jsx(reactComponents.Switch, { checked: column.getIsGrouped(), onChange: column.getToggleGroupingHandler(), disabled: !column.getCanGroup() || !column.getIsVisible(), label: jsxRuntime.jsx("span", { children: column.columnDef.id }) }, column.id));
|
|
1177
|
+
})] }) })] }), jsxRuntime.jsxs(reactComponents.Popover, { withArrow: true, children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { disableButtonEnhancement: true, children: jsxRuntime.jsx(reactComponents.Tooltip, { content: 'Toggle Column Visibility', relationship: "label", children: jsxRuntime.jsx(reactComponents.Button, { icon: jsxRuntime.jsx(ToggleSelectColumnIcon, {}), "aria-label": "Toggle Column Visibility" }) }) }), jsxRuntime.jsx(reactComponents.PopoverSurface, { className: styles.popoverSurface, children: jsxRuntime.jsxs("div", { className: styles.tableTopHeaderColumnTogglePopover, children: [jsxRuntime.jsx(reactComponents.MenuGroupHeader, { children: "Toggle Columns" }), jsxRuntime.jsx(reactComponents.Switch, { checked: table.getIsAllColumnsVisible(), onChange: table.getToggleAllColumnsVisibilityHandler(), label: 'Toggle All' }), jsxRuntime.jsx(reactComponents.Divider, {}), table.getAllLeafColumns().map((column) => {
|
|
1167
1178
|
if (column.id === 'select')
|
|
1168
1179
|
return null;
|
|
1169
|
-
return (jsxRuntime.jsx(reactComponents.
|
|
1180
|
+
return (jsxRuntime.jsx(reactComponents.Switch, { checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler(), label: column.id, disabled: !column.getCanHide() }, column.id));
|
|
1170
1181
|
})] }) })] }), jsxRuntime.jsx(reactComponents.Tooltip, { content: 'Table Views Management', relationship: "label", children: jsxRuntime.jsx(reactComponents.Button, { onClick: () => {
|
|
1171
1182
|
dispatch({ type: "TOGGLE_VIEW_DRAWER" });
|
|
1172
1183
|
}, icon: jsxRuntime.jsx(Album24Regular, {}), "aria-label": "View Menu" }) }), jsxRuntime.jsx(DebouncedInput, { value: globalFilter !== null && globalFilter !== void 0 ? globalFilter : '', onChange: (value) => setGlobalFilter(String(value)), className: "p-2 font-lg shadow border border-block", placeholder: "Search all columns...", drawerState: drawerState, dispatch: dispatch })] })] }));
|
|
@@ -1192,7 +1203,7 @@ const arrIncludesSome = (row, columnId, value) => {
|
|
|
1192
1203
|
var _a;
|
|
1193
1204
|
// Rank the item
|
|
1194
1205
|
const rowValue = row.getValue(columnId);
|
|
1195
|
-
const lowerCaseValues = value.map((v) => `${v || ''}`.toLowerCase());
|
|
1206
|
+
const lowerCaseValues = (value || []).map((v) => `${v || ''}`.toLowerCase());
|
|
1196
1207
|
const passed = Array.isArray(value) &&
|
|
1197
1208
|
((value === null || value === void 0 ? void 0 : value.length) === 0 || lowerCaseValues.includes((_a = `${rowValue}`) === null || _a === void 0 ? void 0 : _a.toLowerCase()));
|
|
1198
1209
|
return passed;
|
|
@@ -1247,8 +1258,8 @@ const getLeafColumns = (columns) => {
|
|
|
1247
1258
|
};
|
|
1248
1259
|
|
|
1249
1260
|
const useGridContainer = (props, ref) => {
|
|
1250
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1251
|
-
const { columns, data, rowSelectionMode } = props;
|
|
1261
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1262
|
+
const { defaultColumn, columns, data, rowSelectionMode, autoResetPageIndex, onUpdateData } = props;
|
|
1252
1263
|
const [pagination, setPagination] = React__namespace.useState({
|
|
1253
1264
|
pageSize: props.pageSize || 10,
|
|
1254
1265
|
pageIndex: 0,
|
|
@@ -1269,7 +1280,12 @@ const useGridContainer = (props, ref) => {
|
|
|
1269
1280
|
const [expanded, setExpanded] = React__namespace.useState((_g = props.expandedState) !== null && _g !== void 0 ? _g : {});
|
|
1270
1281
|
const [columnPinning, setColumnPinning] = React__namespace.useState((_h = props.columnPinningState) !== null && _h !== void 0 ? _h : {});
|
|
1271
1282
|
const [columnSizing, setColumnSizing] = React__namespace.useState({});
|
|
1283
|
+
const [rowPinning, setRowPinning] = React__namespace.useState((_j = props.rowPinningState) !== null && _j !== void 0 ? _j : {
|
|
1284
|
+
top: [],
|
|
1285
|
+
bottom: [],
|
|
1286
|
+
});
|
|
1272
1287
|
const table = reactTable.useReactTable({
|
|
1288
|
+
defaultColumn,
|
|
1273
1289
|
columns: columns,
|
|
1274
1290
|
data,
|
|
1275
1291
|
filterFns: {
|
|
@@ -1292,6 +1308,11 @@ const useGridContainer = (props, ref) => {
|
|
|
1292
1308
|
columnVisibility,
|
|
1293
1309
|
columnPinning,
|
|
1294
1310
|
columnSizing,
|
|
1311
|
+
rowPinning
|
|
1312
|
+
},
|
|
1313
|
+
getRowId(originalRow, index, parent) {
|
|
1314
|
+
const keyProps = props.dataPrimaryKye || 'id';
|
|
1315
|
+
return originalRow[keyProps] || `${index}`;
|
|
1295
1316
|
},
|
|
1296
1317
|
columnResizeMode: 'onChange',
|
|
1297
1318
|
enableRowSelection: rowSelectionMode !== undefined,
|
|
@@ -1301,6 +1322,8 @@ const useGridContainer = (props, ref) => {
|
|
|
1301
1322
|
enableColumnFilters: true,
|
|
1302
1323
|
filterFromLeafRows: true,
|
|
1303
1324
|
autoResetExpanded: false,
|
|
1325
|
+
autoResetPageIndex: autoResetPageIndex,
|
|
1326
|
+
keepPinnedRows: true,
|
|
1304
1327
|
onRowSelectionChange: setRowSelection,
|
|
1305
1328
|
onPaginationChange: setPagination,
|
|
1306
1329
|
onSortingChange: setSorting,
|
|
@@ -1312,6 +1335,7 @@ const useGridContainer = (props, ref) => {
|
|
|
1312
1335
|
onColumnVisibilityChange: setColumnVisibility,
|
|
1313
1336
|
onColumnPinningChange: setColumnPinning,
|
|
1314
1337
|
onColumnSizingChange: setColumnSizing,
|
|
1338
|
+
onRowPinningChange: setRowPinning,
|
|
1315
1339
|
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
1316
1340
|
getPaginationRowModel: reactTable.getPaginationRowModel(),
|
|
1317
1341
|
getSortedRowModel: reactTable.getSortedRowModel(),
|
|
@@ -1320,10 +1344,18 @@ const useGridContainer = (props, ref) => {
|
|
|
1320
1344
|
getExpandedRowModel: reactTable.getExpandedRowModel(),
|
|
1321
1345
|
getFacetedUniqueValues: reactTable.getFacetedUniqueValues(),
|
|
1322
1346
|
getFacetedMinMaxValues: reactTable.getFacetedMinMaxValues(),
|
|
1347
|
+
meta: {
|
|
1348
|
+
pageSizeOptions: props.pageSizeOptions || [10, 20, 50, 100, 1000],
|
|
1349
|
+
rowSelectionMode: props.rowSelectionMode,
|
|
1350
|
+
tableHeight: props.tableHeight || "650px",
|
|
1351
|
+
updateData: onUpdateData,
|
|
1352
|
+
onTableViewDelete: props.onTableViewDelete,
|
|
1353
|
+
onTableViewSave: props.onTableViewSave
|
|
1354
|
+
}
|
|
1323
1355
|
});
|
|
1324
1356
|
const tableViews = React__namespace.useMemo(() => { var _a; return (_a = props.views) !== null && _a !== void 0 ? _a : []; }, [props.views]);
|
|
1325
1357
|
const resetToDefaultView = () => {
|
|
1326
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1358
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1327
1359
|
const defaultTableState = {
|
|
1328
1360
|
pagination: {
|
|
1329
1361
|
pageSize: props.pageSize || 10,
|
|
@@ -1345,7 +1377,7 @@ const useGridContainer = (props, ref) => {
|
|
|
1345
1377
|
columnVisibility: (_g = props.columnVisibility) !== null && _g !== void 0 ? _g : {},
|
|
1346
1378
|
columnPinning: (_h = props.columnPinningState) !== null && _h !== void 0 ? _h : {},
|
|
1347
1379
|
columnSizing: {},
|
|
1348
|
-
rowPinning: {},
|
|
1380
|
+
rowPinning: (_j = props.rowPinningState) !== null && _j !== void 0 ? _j : {},
|
|
1349
1381
|
columnSizingInfo: {
|
|
1350
1382
|
"startOffset": null,
|
|
1351
1383
|
"startSize": null,
|
|
@@ -1378,6 +1410,7 @@ const useGridContainer = (props, ref) => {
|
|
|
1378
1410
|
pageSize: props.pageSize || 10,
|
|
1379
1411
|
pageIndex: 0,
|
|
1380
1412
|
});
|
|
1413
|
+
setRowPinning(tableState.rowPinning);
|
|
1381
1414
|
}, 10);
|
|
1382
1415
|
return true;
|
|
1383
1416
|
}
|
|
@@ -1443,10 +1476,11 @@ const useTableHeaderStyles = reactComponents.makeStyles({
|
|
|
1443
1476
|
boxShadow: reactComponents.tokens.shadow2,
|
|
1444
1477
|
},
|
|
1445
1478
|
tHeadRow: {
|
|
1446
|
-
backgroundColor: reactComponents.tokens.
|
|
1479
|
+
backgroundColor: reactComponents.tokens.colorNeutralCardBackgroundSelected,
|
|
1447
1480
|
},
|
|
1448
1481
|
tHeadCell: Object.assign({ zIndex: 99, position: 'relative', fontSize: reactComponents.tokens.fontSizeBase300, fontWeight: reactComponents.tokens.fontWeightBold, minWidth: '1rem' }, reactComponents.shorthands.padding('2px', '4px')),
|
|
1449
|
-
tHeadNonLeafCell: Object.assign({}, reactComponents.shorthands.borderBottom(
|
|
1482
|
+
tHeadNonLeafCell: Object.assign({}, reactComponents.shorthands.borderBottom(0)),
|
|
1483
|
+
tHeadNonLeafCellFakeBorder: Object.assign({ width: '100%', height: '1px', position: "sticky", bottom: 0 }, reactComponents.shorthands.borderBottom('1px', 'solid', reactComponents.tokens.colorBrandBackgroundInverted)),
|
|
1450
1484
|
tHeadCellDraggable: {
|
|
1451
1485
|
height: '100%',
|
|
1452
1486
|
cursor: 'grab',
|
|
@@ -1455,18 +1489,18 @@ const useTableHeaderStyles = reactComponents.makeStyles({
|
|
|
1455
1489
|
opacity: 0.5,
|
|
1456
1490
|
cursor: 'grabbing',
|
|
1457
1491
|
},
|
|
1458
|
-
tHeadCellOver: Object.assign({ backgroundColor: reactComponents.tokens.colorNeutralStroke1 }, reactComponents.shorthands.border(reactComponents.tokens.strokeWidthThin, 'dashed', reactComponents.tokens.
|
|
1492
|
+
tHeadCellOver: Object.assign({ backgroundColor: reactComponents.tokens.colorNeutralStroke1 }, reactComponents.shorthands.border(reactComponents.tokens.strokeWidthThin, 'dashed', reactComponents.tokens.colorNeutralBackground2Pressed)),
|
|
1459
1493
|
tLeafHeadCellContent: Object.assign({ display: 'flex', alignContent: 'space-between', alignItems: 'center', justifyContent: 'space-between', cursor: 'pointer', width: '100%', height: '100%', minWidth: '1rem' }, reactComponents.shorthands.padding('3px', '4px')),
|
|
1460
1494
|
tNonLeafHeadCellContent: Object.assign({ display: 'flex', alignContent: 'center', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', width: '100%', minWidth: '1rem' }, reactComponents.shorthands.padding('3px', '4px')),
|
|
1461
1495
|
tHeadContentBtn: Object.assign(Object.assign(Object.assign(Object.assign({}, reactComponents.shorthands.padding('0px', '0px', '0px', '0px')), { display: 'flex' }), reactComponents.shorthands.gap('5px')), { alignContent: 'space-between', alignItems: 'center', justifyContent: 'space-between', cursor: 'pointer', width: '100%', height: '100%', minWidth: '1rem' }),
|
|
1462
1496
|
tHeadMenuPopover: Object.assign(Object.assign({}, reactComponents.shorthands.padding('0px', '0px', '0px', '0px')), { width: '300px' }),
|
|
1463
|
-
resizer: Object.assign(Object.assign({}, reactComponents.shorthands.borderRight('1px', 'solid', reactComponents.tokens.
|
|
1464
|
-
borderRightWidth: '
|
|
1465
|
-
borderRightColor: reactComponents.tokens.
|
|
1497
|
+
resizer: Object.assign(Object.assign({}, reactComponents.shorthands.borderRight('1px', 'solid', reactComponents.tokens.colorBrandBackgroundInverted)), { width: '8px', position: 'absolute', top: 0, right: 0, bottom: 0, cursor: 'col-resize', resize: 'horizontal', ':hover': {
|
|
1498
|
+
borderRightWidth: '2px',
|
|
1499
|
+
borderRightColor: reactComponents.tokens.colorBrandBackgroundInvertedHover,
|
|
1466
1500
|
} }),
|
|
1467
1501
|
resizerActive: {
|
|
1468
|
-
borderRightWidth: '
|
|
1469
|
-
borderRightColor: reactComponents.tokens.
|
|
1502
|
+
borderRightWidth: '2px',
|
|
1503
|
+
borderRightColor: reactComponents.tokens.colorBrandBackgroundInvertedPressed,
|
|
1470
1504
|
},
|
|
1471
1505
|
});
|
|
1472
1506
|
|
|
@@ -1477,7 +1511,7 @@ const useCheckboxFilterStyles = reactComponents.makeStyles({
|
|
|
1477
1511
|
marginLeft: '10px',
|
|
1478
1512
|
marginRight: '10px',
|
|
1479
1513
|
},
|
|
1480
|
-
searchContainer: Object.assign(Object.assign(Object.assign({
|
|
1514
|
+
searchContainer: Object.assign(Object.assign(Object.assign({ maxHeight: '300px', width: '100%' }, reactComponents.shorthands.overflow('auto', 'auto')), reactComponents.shorthands.padding('0px', "0px", "2px", '0px')), { '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, reactComponents.shorthands.borderRadius('50%')),
|
|
1481
1515
|
/* Track */
|
|
1482
1516
|
'::-webkit-scrollbar-track': {
|
|
1483
1517
|
'background-color': '#f1f1f1',
|
|
@@ -1492,7 +1526,7 @@ const useCheckboxFilterStyles = reactComponents.makeStyles({
|
|
|
1492
1526
|
} }),
|
|
1493
1527
|
});
|
|
1494
1528
|
const FilterMultiSelectCheckbox = ({ column, table, }) => {
|
|
1495
|
-
var _a
|
|
1529
|
+
var _a;
|
|
1496
1530
|
const firstValue = (_a = table
|
|
1497
1531
|
.getPreFilteredRowModel()
|
|
1498
1532
|
.flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
|
|
@@ -1515,45 +1549,45 @@ const FilterMultiSelectCheckbox = ({ column, table, }) => {
|
|
|
1515
1549
|
return (_b = (_a = `${option}`) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes((_c = `${localColumnFilterValue}`) === null || _c === void 0 ? void 0 : _c.toLowerCase());
|
|
1516
1550
|
});
|
|
1517
1551
|
}, [localColumnFilterValue, filterOptions]);
|
|
1518
|
-
const
|
|
1519
|
-
const
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1552
|
+
const parentRef = React__namespace.useRef(null);
|
|
1553
|
+
const virtualizer = reactVirtual.useVirtualizer({
|
|
1554
|
+
count: (filterOptionsFiltered === null || filterOptionsFiltered === void 0 ? void 0 : filterOptionsFiltered.length) || 0,
|
|
1555
|
+
getScrollElement: () => parentRef.current,
|
|
1556
|
+
estimateSize: () => 30,
|
|
1557
|
+
overscan: 5,
|
|
1523
1558
|
});
|
|
1524
|
-
const
|
|
1525
|
-
const paddingTop = virtualRows.length > 0 ? ((_b = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[0]) === null || _b === void 0 ? void 0 : _b.start) || 0 : 0;
|
|
1526
|
-
const paddingBottom = virtualRows.length > 0
|
|
1527
|
-
? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
|
|
1528
|
-
: 0;
|
|
1559
|
+
const virtualItems = virtualizer.getVirtualItems();
|
|
1529
1560
|
const allOptionChecked = (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) > 0 &&
|
|
1530
1561
|
(columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) !== (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length)
|
|
1531
1562
|
? 'mixed'
|
|
1532
1563
|
: (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) === (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) &&
|
|
1533
1564
|
(filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) > 0;
|
|
1534
1565
|
const styles = useCheckboxFilterStyles();
|
|
1535
|
-
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(reactComponents.Input, { type: 'search', value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsxRuntime.
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
return;
|
|
1539
|
-
}
|
|
1540
|
-
column.setFilterValue([
|
|
1541
|
-
...((filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.map((x) => `${x}`)) || []),
|
|
1542
|
-
]);
|
|
1543
|
-
}, label: '(Toggle All)' }, `toggle-all-${column.id}`), virtualRows.map((row) => {
|
|
1544
|
-
var _a;
|
|
1545
|
-
const value = `${filterOptionsFiltered[row.index]}`;
|
|
1546
|
-
return (jsxRuntime.jsx(reactComponents.Checkbox, { checked: (_a = columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) !== null && _a !== void 0 ? _a : false, onChange: () => {
|
|
1547
|
-
if (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) {
|
|
1548
|
-
column.setFilterValue((old) => old === null || old === void 0 ? void 0 : old.filter((v) => v !== value));
|
|
1566
|
+
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(reactComponents.Input, { type: 'search', value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsxRuntime.jsx("div", { ref: parentRef, className: styles.searchContainer, children: jsxRuntime.jsxs("div", { style: { height: `${virtualizer.getTotalSize()}px` }, children: [jsxRuntime.jsx(reactComponents.Checkbox, { checked: allOptionChecked, onChange: () => {
|
|
1567
|
+
if ((columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) > 0) {
|
|
1568
|
+
column.setFilterValue(undefined);
|
|
1549
1569
|
return;
|
|
1550
1570
|
}
|
|
1551
|
-
column.setFilterValue(
|
|
1552
|
-
...(
|
|
1553
|
-
value,
|
|
1571
|
+
column.setFilterValue([
|
|
1572
|
+
...((filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.map((x) => `${x}`)) || []),
|
|
1554
1573
|
]);
|
|
1555
|
-
}, label:
|
|
1556
|
-
|
|
1574
|
+
}, label: '(Toggle All)' }, `toggle-all-${column.id}`), (virtualItems || []).map((row, index) => {
|
|
1575
|
+
var _a;
|
|
1576
|
+
const value = `${filterOptionsFiltered[row.index]}`;
|
|
1577
|
+
return (jsxRuntime.jsx("div", { style: {
|
|
1578
|
+
height: `${row.size}px`,
|
|
1579
|
+
transform: `translateY(${row.start - index * row.size}px)`,
|
|
1580
|
+
}, children: jsxRuntime.jsx(reactComponents.Checkbox, { checked: (_a = columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) !== null && _a !== void 0 ? _a : false, onChange: () => {
|
|
1581
|
+
if (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.includes(value)) {
|
|
1582
|
+
column.setFilterValue((old) => old === null || old === void 0 ? void 0 : old.filter((v) => v !== value));
|
|
1583
|
+
return;
|
|
1584
|
+
}
|
|
1585
|
+
column.setFilterValue((old) => [
|
|
1586
|
+
...(old || []),
|
|
1587
|
+
value,
|
|
1588
|
+
]);
|
|
1589
|
+
}, label: value }) }, `${column.id}-${row.index}`));
|
|
1590
|
+
})] }) })] }));
|
|
1557
1591
|
};
|
|
1558
1592
|
|
|
1559
1593
|
const useRadioFilterStyles = reactComponents.makeStyles({
|
|
@@ -1563,7 +1597,7 @@ const useRadioFilterStyles = reactComponents.makeStyles({
|
|
|
1563
1597
|
marginLeft: '10px',
|
|
1564
1598
|
marginRight: '10px',
|
|
1565
1599
|
},
|
|
1566
|
-
searchContainer: Object.assign(Object.assign({
|
|
1600
|
+
searchContainer: Object.assign(Object.assign({ maxHeight: '300px', width: '100%' }, reactComponents.shorthands.overflow('auto', 'auto')), { '::-webkit-scrollbar': Object.assign({ width: '6px', height: '4px' }, reactComponents.shorthands.borderRadius('50%')),
|
|
1567
1601
|
/* Track */
|
|
1568
1602
|
'::-webkit-scrollbar-track': {
|
|
1569
1603
|
'background-color': '#f1f1f1',
|
|
@@ -1578,7 +1612,7 @@ const useRadioFilterStyles = reactComponents.makeStyles({
|
|
|
1578
1612
|
} }),
|
|
1579
1613
|
});
|
|
1580
1614
|
const FilterSelectRadio = ({ column, table, }) => {
|
|
1581
|
-
var _a
|
|
1615
|
+
var _a;
|
|
1582
1616
|
const firstValue = (_a = table
|
|
1583
1617
|
.getPreFilteredRowModel()
|
|
1584
1618
|
.flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
|
|
@@ -1601,28 +1635,28 @@ const FilterSelectRadio = ({ column, table, }) => {
|
|
|
1601
1635
|
return (_b = (_a = `${option}`) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes((_c = `${localColumnFilterValue}`) === null || _c === void 0 ? void 0 : _c.toLowerCase());
|
|
1602
1636
|
});
|
|
1603
1637
|
}, [localColumnFilterValue, filterOptions]);
|
|
1604
|
-
const
|
|
1605
|
-
const
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1638
|
+
const parentRef = React__namespace.useRef(null);
|
|
1639
|
+
const virtualizer = reactVirtual.useVirtualizer({
|
|
1640
|
+
count: (filterOptionsFiltered === null || filterOptionsFiltered === void 0 ? void 0 : filterOptionsFiltered.length) || 0,
|
|
1641
|
+
getScrollElement: () => parentRef.current,
|
|
1642
|
+
estimateSize: () => 30,
|
|
1643
|
+
overscan: 5,
|
|
1609
1644
|
});
|
|
1610
|
-
const
|
|
1611
|
-
const paddingTop = virtualRows.length > 0 ? ((_b = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[0]) === null || _b === void 0 ? void 0 : _b.start) || 0 : 0;
|
|
1612
|
-
const paddingBottom = virtualRows.length > 0
|
|
1613
|
-
? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
|
|
1614
|
-
: 0;
|
|
1645
|
+
const virtualItems = virtualizer.getVirtualItems();
|
|
1615
1646
|
const styles = useRadioFilterStyles();
|
|
1616
|
-
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(reactComponents.Input, { value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsxRuntime.
|
|
1647
|
+
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(reactComponents.Input, { value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsxRuntime.jsx("div", { ref: parentRef, className: styles.searchContainer, children: jsxRuntime.jsx("div", { style: { height: `${virtualizer.getTotalSize()}px` }, children: jsxRuntime.jsxs(reactComponents.RadioGroup, { layout: "vertical", value: (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[0]) || '', onChange: (_, data) => {
|
|
1617
1648
|
if (data.value === '') {
|
|
1618
1649
|
column.setFilterValue([]);
|
|
1619
1650
|
return;
|
|
1620
1651
|
}
|
|
1621
1652
|
column.setFilterValue([data.value]);
|
|
1622
|
-
}, children: [jsxRuntime.jsx(reactComponents.Radio, { value: '', label: 'None' }),
|
|
1653
|
+
}, children: [jsxRuntime.jsx(reactComponents.Radio, { value: '', label: 'None' }), (virtualItems || []).map((row, index) => {
|
|
1623
1654
|
const value = filterOptionsFiltered[row.index];
|
|
1624
|
-
return jsxRuntime.jsx(
|
|
1625
|
-
|
|
1655
|
+
return (jsxRuntime.jsx("div", { style: {
|
|
1656
|
+
height: `${row.size}px`,
|
|
1657
|
+
transform: `translateY(${row.start - index * row.size}px)`,
|
|
1658
|
+
}, children: jsxRuntime.jsx(reactComponents.Radio, { value: value, label: value }, value) }, `${column.id}-${row.index}`));
|
|
1659
|
+
})] }) }) })] }));
|
|
1626
1660
|
};
|
|
1627
1661
|
|
|
1628
1662
|
const useNumberRangeFilterStyles$2 = reactComponents.makeStyles({
|
|
@@ -1810,75 +1844,102 @@ const FilterDrawer = ({ drawerState, dispatch, table }) => {
|
|
|
1810
1844
|
table.setGlobalFilter('');
|
|
1811
1845
|
table.resetColumnFilters();
|
|
1812
1846
|
}, [table]);
|
|
1813
|
-
return (jsxRuntime.jsxs(reactComponents.InlineDrawer, { position: "end", open: drawerState.isFilterDrawerOpen, separator: true, children: [jsxRuntime.jsx(reactComponents.DrawerHeader, { children: jsxRuntime.jsx(reactComponents.DrawerHeaderTitle, { action: jsxRuntime.jsx(reactComponents.Button, { appearance: "subtle", "aria-label": "Close", icon: jsxRuntime.jsx(Dismiss24Regular, {}), onClick: () => dispatch({ type: "CLOSE_FILTER_DRAWER" }) }), children: "Advanced Filters" }) }), jsxRuntime.jsx(reactComponents.DrawerBody, { className: styles.drawerBody, children: headerGroups.map((headerGroup) => {
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
return null;
|
|
1817
|
-
return headerGroup.headers.map((header) => {
|
|
1818
|
-
const canFilter = header.column.getCanFilter();
|
|
1819
|
-
if (!canFilter)
|
|
1847
|
+
return (jsxRuntime.jsxs(reactComponents.InlineDrawer, { position: "end", open: drawerState.isFilterDrawerOpen, separator: true, children: [jsxRuntime.jsx(reactComponents.DrawerHeader, { children: jsxRuntime.jsx(reactComponents.DrawerHeaderTitle, { action: jsxRuntime.jsx(reactComponents.Button, { appearance: "subtle", "aria-label": "Close", icon: jsxRuntime.jsx(Dismiss24Regular, {}), onClick: () => dispatch({ type: "CLOSE_FILTER_DRAWER" }) }), children: "Advanced Filters" }) }), jsxRuntime.jsx(reactComponents.DrawerBody, { className: styles.drawerBody, children: jsxRuntime.jsx(reactComponents.Accordion, { multiple: true, collapsible: true, children: headerGroups.map((headerGroup) => {
|
|
1848
|
+
const canApplyFilter = headerGroup.depth === (headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.length) - 1;
|
|
1849
|
+
if (!canApplyFilter)
|
|
1820
1850
|
return null;
|
|
1821
|
-
return
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1851
|
+
return headerGroup.headers.map((header) => {
|
|
1852
|
+
const canFilter = header.column.getCanFilter();
|
|
1853
|
+
if (!canFilter)
|
|
1854
|
+
return null;
|
|
1855
|
+
return (jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getCanFilter(), children: jsxRuntime.jsxs(reactComponents.AccordionItem, { value: header.column.id, children: [jsxRuntime.jsx(reactComponents.AccordionHeader, { expandIconPosition: 'end', children: jsxRuntime.jsxs(reactComponents.Caption1Stronger, { children: ["Filter by", ' ', reactTable.flexRender(header.column.columnDef.header, header.getContext())] }) }), jsxRuntime.jsx(reactComponents.AccordionPanel, { children: jsxRuntime.jsx(Filter, { column: header.column, table: table }) })] }, header.column.id) }, header.column.id));
|
|
1856
|
+
});
|
|
1857
|
+
}) }) }), jsxRuntime.jsx(reactComponents.DrawerFooter, { children: jsxRuntime.jsx(reactComponents.Button, { icon: jsxRuntime.jsx(ClearFilterIcon, {}), onClick: resetAllFilters, style: { width: "100%" }, children: "Clear All Filters" }) })] }));
|
|
1858
|
+
};
|
|
1859
|
+
|
|
1860
|
+
const getHeaderCellPinningStyles = (column) => {
|
|
1861
|
+
const isPinned = column.getIsPinned();
|
|
1862
|
+
const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
|
|
1863
|
+
const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
|
|
1864
|
+
const styles = {
|
|
1865
|
+
boxShadow: isLastLeftPinnedColumn
|
|
1866
|
+
? '-4px 0 4px -4px gray inset'
|
|
1867
|
+
: isFirstRightPinnedColumn
|
|
1868
|
+
? '4px 0 4px -4px gray inset'
|
|
1869
|
+
: undefined,
|
|
1870
|
+
left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined,
|
|
1871
|
+
right: isPinned === 'right' ? `${column.getAfter('right')}px` : undefined,
|
|
1872
|
+
opacity: isPinned ? 0.95 : 1,
|
|
1873
|
+
position: isPinned ? 'sticky' : 'relative',
|
|
1874
|
+
width: column.getSize(),
|
|
1875
|
+
zIndex: isPinned ? 99 : 1,
|
|
1876
|
+
backgroundColor: reactComponents.tokens.colorNeutralCardBackgroundSelected,
|
|
1877
|
+
};
|
|
1878
|
+
return styles;
|
|
1879
|
+
};
|
|
1880
|
+
const getBodyCellPinningStyles = (column) => {
|
|
1881
|
+
const isPinned = column.getIsPinned();
|
|
1882
|
+
const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
|
|
1883
|
+
const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
|
|
1884
|
+
const styles = {
|
|
1885
|
+
boxShadow: isLastLeftPinnedColumn
|
|
1886
|
+
? '-4px 0 4px -4px gray inset'
|
|
1887
|
+
: isFirstRightPinnedColumn
|
|
1888
|
+
? '4px 0 4px -4px gray inset'
|
|
1889
|
+
: undefined,
|
|
1890
|
+
left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined,
|
|
1891
|
+
right: isPinned === 'right' ? `${column.getAfter('right')}px` : undefined,
|
|
1892
|
+
opacity: isPinned ? 0.95 : 1,
|
|
1893
|
+
position: isPinned ? 'sticky' : 'relative',
|
|
1894
|
+
width: column.getSize(),
|
|
1895
|
+
zIndex: isPinned ? 1 : 0,
|
|
1896
|
+
};
|
|
1897
|
+
return styles;
|
|
1826
1898
|
};
|
|
1827
1899
|
|
|
1828
1900
|
const SortAscIcon = bundleIcon$1(ArrowSortDown20Filled, ArrowSortDown20Regular);
|
|
1829
1901
|
const SortDescIcon = bundleIcon$1(ArrowSortUp20Filled, ArrowSortUp20Regular);
|
|
1830
|
-
const
|
|
1831
|
-
columnOrder.splice(columnOrder.indexOf(targetColumnId), 0, columnOrder.splice(columnOrder.indexOf(draggedColumnId), 1)[0]);
|
|
1832
|
-
return [...columnOrder];
|
|
1833
|
-
};
|
|
1902
|
+
const PinIcon = bundleIcon$1(PinFilled, PinRegular);
|
|
1834
1903
|
function HeaderCell({ header, table, hideMenu, headerDepth, totalNumberOfHeaderDepth, }) {
|
|
1835
1904
|
var _a;
|
|
1836
|
-
const { getState, setColumnOrder } = table;
|
|
1837
|
-
const { columnOrder } = getState();
|
|
1838
1905
|
const { column } = header;
|
|
1839
|
-
const
|
|
1840
|
-
|
|
1841
|
-
drop: (draggedColumn) => {
|
|
1842
|
-
const newColumnOrder = reorderColumn(draggedColumn.id, column.id, columnOrder);
|
|
1843
|
-
setColumnOrder(newColumnOrder);
|
|
1844
|
-
},
|
|
1845
|
-
collect: (monitor) => ({
|
|
1846
|
-
isOver: monitor.isOver(),
|
|
1847
|
-
}),
|
|
1848
|
-
});
|
|
1849
|
-
const [{ isDragging }, dragRef, previewRef] = reactDnd.useDrag({
|
|
1850
|
-
collect: (monitor) => ({
|
|
1851
|
-
isDragging: monitor.isDragging(),
|
|
1852
|
-
}),
|
|
1853
|
-
item: () => column,
|
|
1854
|
-
type: "column",
|
|
1906
|
+
const { isDragging, attributes, listeners, setNodeRef, transform, transition, } = sortable.useSortable({
|
|
1907
|
+
id: column.id
|
|
1855
1908
|
});
|
|
1909
|
+
const dndStyle = {
|
|
1910
|
+
width: header.column.getSize(),
|
|
1911
|
+
opacity: isDragging ? 0.8 : 1,
|
|
1912
|
+
// position: isDragging ? 'relative' : "sticky",
|
|
1913
|
+
transform: utilities.CSS.Translate.toString(transform), // translate instead of transform to avoid squishing
|
|
1914
|
+
// transition: 'width transform 0.2s ease-in-out',
|
|
1915
|
+
whiteSpace: 'wrap',
|
|
1916
|
+
zIndex: isDragging ? 100 : 99,
|
|
1917
|
+
transition
|
|
1918
|
+
};
|
|
1856
1919
|
const styles = useTableHeaderStyles();
|
|
1857
|
-
const canDragDrop = headerDepth === totalNumberOfHeaderDepth && !header.isPlaceholder;
|
|
1858
1920
|
const isLeafHeaders = headerDepth === totalNumberOfHeaderDepth;
|
|
1859
1921
|
if (header.isPlaceholder) {
|
|
1860
|
-
return (jsxRuntime.jsx("th", { colSpan: header.colSpan, className: styles.tHeadCell, children: header.column.getCanResize()
|
|
1922
|
+
return (jsxRuntime.jsx("th", { colSpan: header.colSpan, className: styles.tHeadCell, style: Object.assign(Object.assign({}, dndStyle), getHeaderCellPinningStyles(column)), 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) }) }) }));
|
|
1861
1923
|
}
|
|
1862
|
-
return (jsxRuntime.jsxs("th", { colSpan: header.colSpan, className: reactComponents.mergeClasses(styles.tHeadCell, isLeafHeaders
|
|
1863
|
-
: styles.tHeadNonLeafCell, isDragging && styles.tHeadCellDragging, isOver && isLeafHeaders && styles.tHeadCellOver), children: [jsxRuntime.jsx("div", { className: styles.tHeadCellDraggable, ref: canDragDrop ? dropRef : undefined, children: jsxRuntime.jsxs("div", { className: isLeafHeaders
|
|
1924
|
+
return (jsxRuntime.jsxs("th", { colSpan: header.colSpan, className: reactComponents.mergeClasses(styles.tHeadCell, isLeafHeaders && styles.tHeadNonLeafCell, isDragging && styles.tHeadCellDragging), style: Object.assign(Object.assign({}, dndStyle), getHeaderCellPinningStyles(column)), ref: setNodeRef, children: [jsxRuntime.jsx("div", Object.assign({ className: styles.tHeadCellDraggable }, attributes, listeners, { children: jsxRuntime.jsxs("div", { className: isLeafHeaders
|
|
1864
1925
|
? styles.tLeafHeadCellContent
|
|
1865
|
-
: styles.tNonLeafHeadCellContent,
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1926
|
+
: styles.tNonLeafHeadCellContent, children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx(reactControlFlow.Show, { when: !header.isPlaceholder, children: jsxRuntime.jsxs(reactComponents.Button, { style: {
|
|
1927
|
+
display: 'flex',
|
|
1928
|
+
alignItems: 'center',
|
|
1929
|
+
justifyContent: 'left',
|
|
1930
|
+
flex: 1,
|
|
1931
|
+
}, onClick: (e) => {
|
|
1932
|
+
if (!header.column.getCanSort())
|
|
1933
|
+
return;
|
|
1934
|
+
header.column.toggleSorting(header.column.getIsSorted() === 'asc', e.ctrlKey);
|
|
1935
|
+
}, onDoubleClick: () => {
|
|
1936
|
+
if (!header.column.getCanGroup())
|
|
1937
|
+
return;
|
|
1938
|
+
header.column.getToggleGroupingHandler()();
|
|
1939
|
+
}, appearance: "transparent", className: styles.tHeadContentBtn, icon: (_a = {
|
|
1940
|
+
asc: (jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(SortAscIcon, {}) })),
|
|
1941
|
+
desc: (jsxRuntime.jsx("strong", { children: jsxRuntime.jsx(SortDescIcon, {}) })),
|
|
1942
|
+
}[header.column.getIsSorted()]) !== null && _a !== void 0 ? _a : undefined, iconPosition: "after", children: [jsxRuntime.jsx("strong", { children: reactTable.flexRender(header.column.columnDef.header, header.getContext()) }), 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: hideMenu })] }) })), 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 }) })] }));
|
|
1882
1943
|
}
|
|
1883
1944
|
function HeaderMenu(props) {
|
|
1884
1945
|
const { header, table, hideMenu } = props;
|
|
@@ -1890,24 +1951,24 @@ function HeaderMenu(props) {
|
|
|
1890
1951
|
header.column.getCanFilter();
|
|
1891
1952
|
if (!canHavePopOver)
|
|
1892
1953
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: " " }));
|
|
1893
|
-
return (jsxRuntime.jsxs(reactComponents.Menu, { children: [jsxRuntime.jsx(reactComponents.MenuTrigger, { disableButtonEnhancement: true, children: jsxRuntime.jsx(reactComponents.MenuButton, { appearance: "transparent", "aria-label": "View Column Actions" }) }), jsxRuntime.jsx(reactComponents.MenuPopover, { className: styles.tHeadMenuPopover, children: jsxRuntime.jsxs(reactComponents.MenuList, { children: [header.column.getCanSort()
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1954
|
+
return (jsxRuntime.jsxs(reactComponents.Menu, { children: [jsxRuntime.jsx(reactComponents.MenuTrigger, { disableButtonEnhancement: true, children: jsxRuntime.jsx(reactComponents.MenuButton, { appearance: "transparent", "aria-label": "View Column Actions" }) }), jsxRuntime.jsx(reactComponents.MenuPopover, { className: styles.tHeadMenuPopover, children: jsxRuntime.jsxs(reactComponents.MenuList, { children: [jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getCanSort(), children: jsxRuntime.jsxs(reactComponents.MenuGroup, { children: [jsxRuntime.jsx(reactComponents.MenuItem, { onClick: (e) => {
|
|
1955
|
+
var _a;
|
|
1956
|
+
const isControlKeySelected = e.ctrlKey;
|
|
1957
|
+
(_a = header.column) === null || _a === void 0 ? void 0 : _a.toggleSorting(false, isControlKeySelected);
|
|
1958
|
+
}, icon: jsxRuntime.jsx(TextSortAscendingFilled, {}), disabled: header.column.getIsSorted() === 'asc', children: "Sort A to Z" }), jsxRuntime.jsx(reactComponents.MenuItem, { onClick: (e) => {
|
|
1959
|
+
var _a;
|
|
1960
|
+
const isControlKeySelected = e.ctrlKey;
|
|
1961
|
+
(_a = header.column) === null || _a === void 0 ? void 0 : _a.toggleSorting(true, isControlKeySelected);
|
|
1962
|
+
}, 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: () => header.column.getToggleGroupingHandler()(), icon: jsxRuntime.jsx(GroupFilled, {}), children: ["Group by", ' ', reactTable.flexRender(header.column.columnDef.header, header.getContext())] })), header.column.getIsGrouped() && (jsxRuntime.jsxs(reactComponents.MenuItem, { onClick: () => header.column.getToggleGroupingHandler()(), icon: jsxRuntime.jsx(GroupDismissFilled, {}), children: ["Remove Grouping on", ' ', reactTable.flexRender(header.column.columnDef.header, header.getContext())] })), jsxRuntime.jsx(reactComponents.MenuDivider, {})] }, 'grouping-group') }), jsxRuntime.jsxs(reactControlFlow.Show, { when: header.column.getCanPin(), children: [jsxRuntime.jsxs(reactComponents.Menu, { children: [jsxRuntime.jsx(reactComponents.MenuTrigger, { disableButtonEnhancement: true, children: jsxRuntime.jsx(reactComponents.MenuItem, { icon: jsxRuntime.jsx(PinIcon, {}), children: "Pin Column" }) }), jsxRuntime.jsx(reactComponents.MenuPopover, { children: jsxRuntime.jsxs(reactComponents.MenuList, { children: [jsxRuntime.jsx(reactControlFlow.Show, { when: ['left', 'right'].includes(header.column.getIsPinned()), children: jsxRuntime.jsx(reactComponents.MenuItem, { onClick: () => {
|
|
1963
|
+
var _a;
|
|
1964
|
+
(_a = header.column) === null || _a === void 0 ? void 0 : _a.pin(false);
|
|
1965
|
+
}, icon: jsxRuntime.jsx(PinOffRegular, {}), children: "No Pin" }) }), jsxRuntime.jsx(reactComponents.MenuItem, { onClick: () => {
|
|
1966
|
+
var _a;
|
|
1967
|
+
(_a = header.column) === null || _a === void 0 ? void 0 : _a.pin('left');
|
|
1968
|
+
}, icon: jsxRuntime.jsx(ArrowStepInLeftRegular, {}), disabled: header.column.getIsPinned() === 'left', children: "Pin Left" }), jsxRuntime.jsx(reactComponents.MenuItem, { onClick: () => {
|
|
1969
|
+
var _a;
|
|
1970
|
+
(_a = header.column) === null || _a === void 0 ? void 0 : _a.pin('right');
|
|
1971
|
+
}, icon: jsxRuntime.jsx(ArrowStepInRightRegular, {}), disabled: header.column.getIsPinned() === 'right', children: "Pin Right" })] }) })] }), jsxRuntime.jsx(reactComponents.MenuDivider, {})] }), jsxRuntime.jsx(reactControlFlow.Show, { when: header.column.getCanFilter(), children: jsxRuntime.jsxs(reactComponents.MenuGroup, { children: [jsxRuntime.jsxs(reactComponents.MenuGroupHeader, { children: ["Filter by", ' ', reactTable.flexRender(header.column.columnDef.header, header.getContext())] }), jsxRuntime.jsx(Filter, { column: header.column, table: table })] }, 'filter-group') })] }) })] }));
|
|
1911
1972
|
}
|
|
1912
1973
|
|
|
1913
1974
|
function HeaderRow(props) {
|
|
@@ -1923,7 +1984,7 @@ function HeaderRow(props) {
|
|
|
1923
1984
|
function TableHeader(props) {
|
|
1924
1985
|
const styles = useTableHeaderStyles();
|
|
1925
1986
|
const { table, headerGroups, rowSelectionMode } = props;
|
|
1926
|
-
return (jsxRuntime.jsx("thead", { className: styles.tHead, 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))) }));
|
|
1987
|
+
return (jsxRuntime.jsx("thead", { className: styles.tHead, style: { zIndex: 99 }, 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))) }));
|
|
1927
1988
|
}
|
|
1928
1989
|
|
|
1929
1990
|
const useLoadingStyles = reactComponents.makeStyles({
|
|
@@ -1996,75 +2057,149 @@ const useTableBodyStyles = reactComponents.makeStyles({
|
|
|
1996
2057
|
backgroundColor: reactComponents.tokens.colorBrandBackground2Hover,
|
|
1997
2058
|
} }),
|
|
1998
2059
|
tBodyCell: Object.assign(Object.assign({ backgroundColor: "transparent" }, reactComponents.shorthands.padding("2px", "4px")), { minHeight: "35px", height: "35px" }),
|
|
2060
|
+
tBodyRowPinnedCell: {
|
|
2061
|
+
backgroundColor: reactComponents.tokens.colorPaletteYellowBackground2,
|
|
2062
|
+
":hover": {
|
|
2063
|
+
backgroundColor: reactComponents.tokens.colorPaletteMarigoldBackground2,
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
2066
|
+
tBodyPinnedCell: {
|
|
2067
|
+
backgroundColor: reactComponents.tokens.colorNeutralBackground3,
|
|
2068
|
+
":hover": {
|
|
2069
|
+
backgroundColor: reactComponents.tokens.colorNeutralBackground3Hover,
|
|
2070
|
+
}
|
|
2071
|
+
},
|
|
2072
|
+
tBodySelectedCell: {
|
|
2073
|
+
backgroundColor: reactComponents.tokens.colorBrandBackground2,
|
|
2074
|
+
":hover": {
|
|
2075
|
+
backgroundColor: reactComponents.tokens.colorBrandBackground2Hover,
|
|
2076
|
+
}
|
|
2077
|
+
},
|
|
1999
2078
|
});
|
|
2000
2079
|
|
|
2001
2080
|
function TableCell({ cell, row }) {
|
|
2002
2081
|
var _a;
|
|
2003
2082
|
const styles = useTableBodyStyles();
|
|
2083
|
+
const isSelected = row.getIsSelected();
|
|
2084
|
+
const isRowPinned = row.getIsPinned();
|
|
2085
|
+
const isCellPinned = cell.column.getIsPinned();
|
|
2086
|
+
const { isDragging, transition, setNodeRef, transform } = sortable.useSortable({
|
|
2087
|
+
id: cell.column.id,
|
|
2088
|
+
});
|
|
2004
2089
|
const tdStyle = {
|
|
2005
2090
|
width: cell.column.getSize(),
|
|
2091
|
+
opacity: isDragging ? "0.8" : "1",
|
|
2092
|
+
transform: utilities.CSS.Translate.toString(transform),
|
|
2093
|
+
// transition: 'width transform 0.2s ease-in-out',
|
|
2094
|
+
zIndex: isDragging ? 1 : 0,
|
|
2095
|
+
transition
|
|
2006
2096
|
};
|
|
2097
|
+
const cellClassNames = reactComponents.mergeClasses(styles.tBodyCell, isCellPinned && styles.tBodyPinnedCell, isSelected && styles.tBodySelectedCell, isRowPinned && styles.tBodyRowPinnedCell);
|
|
2098
|
+
const styleStyles = Object.assign(Object.assign({}, tdStyle), getBodyCellPinningStyles(cell.column));
|
|
2007
2099
|
if (cell.getIsPlaceholder()) {
|
|
2008
|
-
return jsxRuntime.jsx("td", { style:
|
|
2100
|
+
return jsxRuntime.jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef }, cell.id);
|
|
2009
2101
|
}
|
|
2010
2102
|
if (cell.getIsGrouped()) {
|
|
2011
|
-
return (jsxRuntime.jsx("td", { style:
|
|
2103
|
+
return (jsxRuntime.jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: jsxRuntime.jsx(reactComponents.Button, { onClick: row.getToggleExpandedHandler(), style: {
|
|
2012
2104
|
cursor: row.getCanExpand() ? 'pointer' : 'normal',
|
|
2013
2105
|
textAlign: 'left',
|
|
2014
2106
|
}, appearance: "transparent", icon: row.getIsExpanded() ? jsxRuntime.jsx(GroupExpandedIcon, {}) : jsxRuntime.jsx(GroupCollapsedIcon, {}), children: jsxRuntime.jsxs("strong", { children: [reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()), " (", row.subRows.length, ")"] }) }) }, cell.id));
|
|
2015
2107
|
}
|
|
2016
2108
|
if (cell.getIsAggregated()) {
|
|
2017
|
-
return (jsxRuntime.jsx("td", { style:
|
|
2109
|
+
return (jsxRuntime.jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: jsxRuntime.jsx("strong", { children: reactTable.flexRender((_a = cell.column.columnDef.aggregatedCell) !== null && _a !== void 0 ? _a : cell.column.columnDef.cell, cell.getContext()) }) }, cell.id));
|
|
2018
2110
|
}
|
|
2019
|
-
return (jsxRuntime.jsx("td", { style:
|
|
2111
|
+
return (jsxRuntime.jsx("td", { style: styleStyles, className: cellClassNames, ref: setNodeRef, children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
|
|
2020
2112
|
}
|
|
2021
2113
|
|
|
2022
|
-
function TableRow({ row, rowSelectionMode }) {
|
|
2114
|
+
function TableRow({ row, rowSelectionMode, style }) {
|
|
2023
2115
|
const styles = useTableBodyStyles();
|
|
2024
2116
|
return (jsxRuntime.jsxs("tr", { className: row.getIsSelected() || row.getIsAllSubRowsSelected()
|
|
2025
2117
|
? styles.tBodySelectedRow
|
|
2026
|
-
: styles.tBodyRow, children: [rowSelectionMode
|
|
2027
|
-
|
|
2028
|
-
|
|
2118
|
+
: 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 Column", children: jsxRuntime.jsx(reactComponents.Checkbox, { checked: row.getIsSomeSelected()
|
|
2119
|
+
? 'mixed'
|
|
2120
|
+
: 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));
|
|
2121
|
+
}
|
|
2122
|
+
function PinnedRow({ row, rowSelectionMode, style, bottomRowLength }) {
|
|
2123
|
+
const styles = useTableBodyStyles();
|
|
2124
|
+
return (jsxRuntime.jsxs("tr", { className: row.getIsSelected() || row.getIsAllSubRowsSelected()
|
|
2125
|
+
? styles.tBodySelectedRow
|
|
2126
|
+
: styles.tBodyRow, style: {
|
|
2127
|
+
backgroundColor: 'goldenrod',
|
|
2128
|
+
position: 'sticky',
|
|
2129
|
+
top: row.getIsPinned() === 'top'
|
|
2130
|
+
? `${row.getPinnedIndex() * 35 + 48}px`
|
|
2131
|
+
: undefined,
|
|
2132
|
+
bottom: row.getIsPinned() === 'bottom'
|
|
2133
|
+
? `${((bottomRowLength || 0) - 1 - row.getPinnedIndex()) * 35}px`
|
|
2134
|
+
: undefined
|
|
2135
|
+
}, 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(reactComponents.Checkbox, { checked: row.getIsSomeSelected()
|
|
2136
|
+
? 'mixed'
|
|
2137
|
+
: 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 => {
|
|
2138
|
+
return (jsxRuntime.jsx(TableCell, { cell: cell, row: row }, cell.id));
|
|
2139
|
+
})] }, row.id));
|
|
2029
2140
|
}
|
|
2030
2141
|
|
|
2031
2142
|
function TableBody(props) {
|
|
2032
|
-
var _a, _b;
|
|
2143
|
+
var _a, _b, _c;
|
|
2033
2144
|
const styles = useTableBodyStyles();
|
|
2034
|
-
const {
|
|
2035
|
-
const
|
|
2145
|
+
const { table, tableContainerRef } = props;
|
|
2146
|
+
const rowSelectionMode = (_a = table.options.meta) === null || _a === void 0 ? void 0 : _a.rowSelectionMode;
|
|
2147
|
+
let rows = [];
|
|
2148
|
+
let topRows = [];
|
|
2149
|
+
let bottomRows = [];
|
|
2150
|
+
try {
|
|
2151
|
+
rows = table.getCenterRows();
|
|
2152
|
+
topRows = table.getTopRows();
|
|
2153
|
+
bottomRows = table.getBottomRows();
|
|
2154
|
+
}
|
|
2155
|
+
catch (error) {
|
|
2156
|
+
rows = [];
|
|
2157
|
+
topRows = [];
|
|
2158
|
+
bottomRows = [];
|
|
2159
|
+
}
|
|
2160
|
+
const rowVirtualizer = reactVirtual$1.useVirtual({
|
|
2161
|
+
parentRef: tableContainerRef,
|
|
2162
|
+
size: rows.length,
|
|
2163
|
+
overscan: 10,
|
|
2164
|
+
});
|
|
2165
|
+
const { virtualItems: virtualRows, totalSize } = rowVirtualizer;
|
|
2166
|
+
const paddingTop = virtualRows.length > 0 ? ((_b = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[0]) === null || _b === void 0 ? void 0 : _b.start) || 0 : 0;
|
|
2036
2167
|
const paddingBottom = virtualRows.length > 0
|
|
2037
|
-
? totalSize - (((
|
|
2168
|
+
? totalSize - (((_c = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _c === void 0 ? void 0 : _c.end) || 0)
|
|
2038
2169
|
: 0;
|
|
2039
|
-
return (jsxRuntime.jsxs(
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2170
|
+
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: {
|
|
2171
|
+
position: "sticky",
|
|
2172
|
+
top: 0,
|
|
2173
|
+
zIndex: 99
|
|
2174
|
+
}, children: jsxRuntime.jsx(reactControlFlow.For, { each: topRows, children: (row, index) => (jsxRuntime.jsx(PinnedRow, { row: row, rowSelectionMode: rowSelectionMode, bottomRowLength: bottomRows === null || bottomRows === void 0 ? void 0 : bottomRows.length }, row.id)) }) }) }), 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) => {
|
|
2175
|
+
const row = rows[virtualRow.index];
|
|
2176
|
+
return (jsxRuntime.jsx(TableRow, { row: row, rowSelectionMode: rowSelectionMode }, row.id));
|
|
2177
|
+
} }), 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: {
|
|
2178
|
+
position: "sticky",
|
|
2179
|
+
bottom: 0,
|
|
2180
|
+
zIndex: 99
|
|
2181
|
+
}, children: jsxRuntime.jsxs("tr", { style: { backgroundColor: "white" }, children: [jsxRuntime.jsx("td", { className: "p-1", children: jsxRuntime.jsx(reactComponents.Checkbox, { checked: table.getIsSomePageRowsSelected()
|
|
2182
|
+
? 'mixed'
|
|
2183
|
+
: table.getIsAllPageRowsSelected(), onChange: table.getToggleAllPageRowsSelectedHandler(), "aria-label": "Select All Current Page Rows", title: 'Select All Current Page Rows' }) }), jsxRuntime.jsxs("td", { colSpan: 20, children: [table.getIsAllPageRowsSelected() ? 'Unselect' : 'Select', " All Current Page Rows (", table.getRowModel().rows.length, ")"] })] }) }) }), jsxRuntime.jsx(reactControlFlow.Show, { when: (bottomRows === null || bottomRows === void 0 ? void 0 : bottomRows.length) > 0, children: jsxRuntime.jsx("tfoot", { style: {
|
|
2184
|
+
position: "sticky",
|
|
2185
|
+
bottom: 0,
|
|
2186
|
+
zIndex: 99
|
|
2187
|
+
}, children: jsxRuntime.jsx(reactControlFlow.For, { each: bottomRows, children: (row) => (jsxRuntime.jsx(PinnedRow, { row: row, rowSelectionMode: rowSelectionMode, bottomRowLength: bottomRows === null || bottomRows === void 0 ? void 0 : bottomRows.length }, row.id)) }) }) })] }));
|
|
2043
2188
|
}
|
|
2044
2189
|
|
|
2045
2190
|
const TableContainer = (props) => {
|
|
2046
2191
|
var _a, _b;
|
|
2047
2192
|
const styles = useTableStaticStyles();
|
|
2048
|
-
const { table
|
|
2193
|
+
const { table } = props;
|
|
2194
|
+
const { tableHeight, rowSelectionMode } = table.options.meta || {};
|
|
2049
2195
|
const tableContainerRef = React__namespace.useRef(null);
|
|
2050
|
-
const { rows } = table.getRowModel();
|
|
2051
|
-
const rowVirtualizer = reactVirtual.useVirtual({
|
|
2052
|
-
parentRef: tableContainerRef,
|
|
2053
|
-
size: rows.length,
|
|
2054
|
-
overscan: 5,
|
|
2055
|
-
});
|
|
2056
|
-
const { virtualItems: virtualRows, totalSize } = rowVirtualizer;
|
|
2196
|
+
const { rows: { length: itemLength } } = table.getRowModel();
|
|
2057
2197
|
const headerGroups = table.getHeaderGroups();
|
|
2058
2198
|
// utilities
|
|
2059
|
-
const isLoading = props.isLoading &&
|
|
2199
|
+
const isLoading = props.isLoading && itemLength === 0;
|
|
2060
2200
|
const noItems = !isLoading && ((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) === 0;
|
|
2061
|
-
const noSearchResult = !isLoading && ((_b = props === null || props === void 0 ? void 0 : props.data) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
|
2062
|
-
return (jsxRuntime.jsxs("div", { ref: tableContainerRef, className: styles.tableContainer, children: [jsxRuntime.jsxs("table", { className: styles.table, "aria-label": "Data Grid", children: [jsxRuntime.jsx(TableHeader, { table: table, rowSelectionMode: rowSelectionMode, headerGroups: headerGroups }), jsxRuntime.jsx(TableBody, {
|
|
2063
|
-
!isLoading &&
|
|
2064
|
-
!noItems &&
|
|
2065
|
-
!noSearchResult && (jsxRuntime.jsx("tfoot", { className: styles.tFoot, children: jsxRuntime.jsxs("tr", { children: [jsxRuntime.jsx("td", { className: "p-1", children: jsxRuntime.jsx(reactComponents.Checkbox, { checked: table.getIsSomePageRowsSelected()
|
|
2066
|
-
? 'mixed'
|
|
2067
|
-
: table.getIsAllPageRowsSelected(), onChange: table.getToggleAllPageRowsSelectedHandler(), "aria-label": "Select All Current Page Rows", title: 'Select All Current Page Rows' }) }), jsxRuntime.jsxs("td", { colSpan: 20, children: [table.getIsAllPageRowsSelected() ? 'Unselect' : 'Select', " All Current Page Rows (", table.getRowModel().rows.length, ")"] })] }) }))] }), isLoading && jsxRuntime.jsx(Loading, {}), noItems && jsxRuntime.jsx(NoItemGrid, { message: props.noItemPage }), noSearchResult && jsxRuntime.jsx(NoSearchResult, { message: props.noFilterMatchPage })] }));
|
|
2201
|
+
const noSearchResult = !isLoading && ((_b = props === null || props === void 0 ? void 0 : props.data) === null || _b === void 0 ? void 0 : _b.length) > 0 && itemLength === 0;
|
|
2202
|
+
return (jsxRuntime.jsxs("div", { ref: tableContainerRef, className: styles.tableContainer, style: { height: tableHeight }, children: [jsxRuntime.jsxs("table", { className: styles.table, "aria-label": "Data Grid", style: { width: table.getTotalSize(), minWidth: "100%" }, children: [jsxRuntime.jsx(TableHeader, { table: table, rowSelectionMode: rowSelectionMode, headerGroups: headerGroups }), jsxRuntime.jsx(TableBody, { table: table, tableContainerRef: tableContainerRef })] }), jsxRuntime.jsxs(reactControlFlow.Switch, { when: true, children: [jsxRuntime.jsx(reactControlFlow.Case, { value: isLoading, children: jsxRuntime.jsx(Loading, {}) }), jsxRuntime.jsx(reactControlFlow.Case, { value: noItems, children: jsxRuntime.jsx(NoItemGrid, { message: props.noItemPage }) }), jsxRuntime.jsx(reactControlFlow.Case, { value: noSearchResult, children: jsxRuntime.jsx(NoSearchResult, { message: props.noFilterMatchPage }) })] })] }));
|
|
2068
2203
|
};
|
|
2069
2204
|
|
|
2070
2205
|
const ViewSaveForm = (props) => {
|
|
@@ -2126,29 +2261,20 @@ const useFilterDrawerStyles = reactComponents.makeStyles({
|
|
|
2126
2261
|
} }),
|
|
2127
2262
|
});
|
|
2128
2263
|
const ViewsDrawer = (props) => {
|
|
2129
|
-
const { table, drawerState, dispatch, tableViews, applyTableState, resetToGridDefaultView
|
|
2130
|
-
const
|
|
2264
|
+
const { table, drawerState, dispatch, tableViews, applyTableState, resetToGridDefaultView } = props;
|
|
2265
|
+
const { onTableViewDelete, onTableViewSave } = table.options.meta || {};
|
|
2131
2266
|
const [checkedValues, setCheckedValues] = React__namespace.useState({ font: ["calibri"] });
|
|
2132
2267
|
const onChange = (e, { name, checkedItems }) => {
|
|
2133
2268
|
setCheckedValues((s) => (Object.assign(Object.assign({}, s), { [name]: checkedItems })));
|
|
2134
2269
|
};
|
|
2135
|
-
|
|
2136
|
-
// table.setGlobalFilter('');
|
|
2137
|
-
// table.resetColumnFilters();
|
|
2138
|
-
// }, [table]);
|
|
2139
|
-
// const resetAllGrouping = React.useCallback(() => {
|
|
2140
|
-
// table.resetGrouping();
|
|
2141
|
-
// }, [table]);
|
|
2142
|
-
// const clearAllSelection = React.useCallback(() => {
|
|
2143
|
-
// table.toggleAllRowsSelected(false);
|
|
2144
|
-
// }, [table]);
|
|
2270
|
+
const styles = useFilterDrawerStyles();
|
|
2145
2271
|
return (jsxRuntime.jsxs(reactComponents.InlineDrawer, { position: "end", open: drawerState.isViewsDrawerOpen, separator: true, children: [jsxRuntime.jsx(reactComponents.DrawerHeader, { children: jsxRuntime.jsx(reactComponents.DrawerHeaderTitle, { action: jsxRuntime.jsx(reactComponents.Button, { appearance: "subtle", "aria-label": "Close", icon: jsxRuntime.jsx(Dismiss24Regular, {}), onClick: () => dispatch({ type: "CLOSE_VIEW_DRAWER" }) }), children: "Table Views" }) }), jsxRuntime.jsxs(reactComponents.DrawerBody, { className: styles.drawerBody, children: [onTableViewSave && jsxRuntime.jsx(ViewSaveForm, { mode: 'create', getTableState: table.getState, onSave: onTableViewSave }), jsxRuntime.jsxs(reactComponents.MenuList, { checkedValues: checkedValues, onCheckedValueChange: onChange, children: [jsxRuntime.jsx(reactComponents.MenuItemRadio, { name: 'table-views', value: 'Default View', icon: jsxRuntime.jsx(ViewDesktop20Filled, {}), onClick: resetToGridDefaultView, children: "Default View" }), tableViews.length > 0 && jsxRuntime.jsx(reactComponents.MenuDivider, { children: "Additional Views" }), tableViews.map((view) => {
|
|
2146
2272
|
return (jsxRuntime.jsxs("div", { style: {
|
|
2147
2273
|
display: 'flex',
|
|
2148
2274
|
justifyContent: 'space-between',
|
|
2149
2275
|
alignItems: 'center',
|
|
2150
2276
|
width: '100%',
|
|
2151
|
-
}, children: [jsxRuntime.jsx(reactComponents.MenuItemRadio, { name: "table-views", value: view.viewName, onClick: () => applyTableState(view.tableState), icon: jsxRuntime.jsx(ViewDesktop20Regular, {}), children: view.viewName }),
|
|
2277
|
+
}, children: [jsxRuntime.jsx(reactComponents.MenuItemRadio, { name: "table-views", value: view.viewName, onClick: () => applyTableState(view.tableState), icon: jsxRuntime.jsx(ViewDesktop20Regular, {}), children: view.viewName }), onTableViewDelete && (view === null || view === void 0 ? void 0 : view.isViewOwner) && (jsxRuntime.jsx(reactComponents.Button, { appearance: "subtle", "aria-label": "Close", icon: jsxRuntime.jsx(Dismiss24Regular, {}), onClick: () => onTableViewDelete === null || onTableViewDelete === void 0 ? void 0 : onTableViewDelete(view) }))] }, view.id + view.viewName));
|
|
2152
2278
|
})] })] }), jsxRuntime.jsx(reactComponents.DrawerFooter, { children: jsxRuntime.jsxs(reactComponents.MenuList, { children: [jsxRuntime.jsx(reactComponents.MenuDivider, {}), jsxRuntime.jsx(reactComponents.MenuItem, { icon: jsxRuntime.jsx(ClearFilterIcon, {}), onClick: resetToGridDefaultView, children: "Reset to Default View" })] }) })] }));
|
|
2153
2279
|
};
|
|
2154
2280
|
|
|
@@ -2187,12 +2313,48 @@ function AdvancedTable(props, ref) {
|
|
|
2187
2313
|
isFilterDrawerOpen: false,
|
|
2188
2314
|
isViewsDrawerOpen: false
|
|
2189
2315
|
});
|
|
2190
|
-
|
|
2316
|
+
const { getState, setColumnOrder } = table;
|
|
2317
|
+
const { columnOrder } = getState();
|
|
2318
|
+
function handleDragEnd(event) {
|
|
2319
|
+
const { active, over } = event;
|
|
2320
|
+
if (active && over && (active === null || active === void 0 ? void 0 : active.id) !== (over === null || over === void 0 ? void 0 : over.id)) {
|
|
2321
|
+
setColumnOrder((items) => {
|
|
2322
|
+
const oldIndex = items.indexOf(active === null || active === void 0 ? void 0 : active.id);
|
|
2323
|
+
const newIndex = items.indexOf(over === null || over === void 0 ? void 0 : over.id);
|
|
2324
|
+
return sortable.arrayMove(items, oldIndex, newIndex);
|
|
2325
|
+
});
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
const pointerSensor = core.useSensor(core.PointerSensor, {
|
|
2329
|
+
activationConstraint: {
|
|
2330
|
+
distance: 0.01
|
|
2331
|
+
}
|
|
2332
|
+
});
|
|
2333
|
+
const mouseSensor = core.useSensor(core.MouseSensor);
|
|
2334
|
+
const touchSensor = core.useSensor(core.TouchSensor);
|
|
2335
|
+
const keyboardSensor = core.useSensor(core.KeyboardSensor);
|
|
2336
|
+
const sensors = core.useSensors(mouseSensor, touchSensor, keyboardSensor, pointerSensor);
|
|
2337
|
+
return (jsxRuntime.jsx(core.DndContext, { collisionDetection: core.closestCenter, modifiers: [modifiers.restrictToHorizontalAxis], onDragEnd: handleDragEnd, sensors: sensors, children: jsxRuntime.jsxs(sortable.SortableContext, { items: columnOrder, strategy: sortable.horizontalListSortingStrategy, children: [jsxRuntime.jsx(reactControlFlow.Show, { when: !props.disableTableHeader, children: jsxRuntime.jsx(GridHeader, { table: table, gridTitle: props.gridTitle, headerMenu: headerMenu, globalFilter: globalFilter, setGlobalFilter: setGlobalFilter, applyTableState: applyTableState, drawerState: drawerState, dispatch: dispatch }) }), jsxRuntime.jsxs("div", { style: { display: 'flex' }, children: [jsxRuntime.jsx(TableContainer, { table: table, data: props.data, isLoading: props.isLoading || false, noFilterMatchPage: props.noFilterMatchPage, noItemPage: props.noItemPage }), jsxRuntime.jsx(FilterDrawer, { drawerState: drawerState, dispatch: dispatch, table: table }), jsxRuntime.jsx(ViewsDrawer, { table: table, drawerState: drawerState, dispatch: dispatch, tableViews: tableViews, applyTableState: applyTableState, resetToGridDefaultView: resetToDefaultView })] }), jsxRuntime.jsx(Pagination, { table: table })] }) }));
|
|
2191
2338
|
}
|
|
2192
2339
|
const ForwardedAdvancedTable = React__namespace.forwardRef(AdvancedTable);
|
|
2193
2340
|
|
|
2341
|
+
/* eslint-disable */
|
|
2342
|
+
function useSkipper() {
|
|
2343
|
+
const shouldSkipRef = React__namespace.useRef(true);
|
|
2344
|
+
const shouldSkip = shouldSkipRef.current;
|
|
2345
|
+
// Wrap a function with this to skip a pagination reset temporarily
|
|
2346
|
+
const skip = React__namespace.useCallback(() => {
|
|
2347
|
+
shouldSkipRef.current = false;
|
|
2348
|
+
}, []);
|
|
2349
|
+
React__namespace.useEffect(() => {
|
|
2350
|
+
shouldSkipRef.current = true;
|
|
2351
|
+
});
|
|
2352
|
+
return [shouldSkip, skip];
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2194
2355
|
Object.defineProperty(exports, 'createColumnHelper', {
|
|
2195
2356
|
enumerable: true,
|
|
2196
2357
|
get: function () { return reactTable.createColumnHelper; }
|
|
2197
2358
|
});
|
|
2198
2359
|
exports.Table = ForwardedAdvancedTable;
|
|
2360
|
+
exports.useSkipper = useSkipper;
|