@prt-ts/fluent-react-table-v2 9.55.0-build-1.0 → 9.66.2-build-2.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/README.md +7 -7
- package/index.cjs.d.ts +1 -1
- package/index.cjs.js +25 -14
- package/index.esm.d.ts +1 -1
- package/index.esm.js +25 -14
- package/package.json +3 -3
- package/src/lib/components/pagination/usePaginationStyles.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# fluent-react-table-v2
|
|
2
|
-
|
|
3
|
-
This library was generated with [Nx](https://nx.dev).
|
|
4
|
-
|
|
5
|
-
## Running unit tests
|
|
6
|
-
|
|
7
|
-
Run `nx test fluent-react-table-v2` to execute the unit tests via [Vitest](https://vitest.dev/).
|
|
1
|
+
# fluent-react-table-v2
|
|
2
|
+
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
4
|
+
|
|
5
|
+
## Running unit tests
|
|
6
|
+
|
|
7
|
+
Run `nx test fluent-react-table-v2` to execute the unit tests via [Vitest](https://vitest.dev/).
|
package/index.cjs.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./src
|
|
1
|
+
export * from "./src/index";
|
package/index.cjs.js
CHANGED
|
@@ -106,13 +106,21 @@ const usePaginationStyle = reactComponents.makeStyles({
|
|
|
106
106
|
},
|
|
107
107
|
pageSelectionWrapper: {
|
|
108
108
|
minWidth: "1.5rem",
|
|
109
|
+
display: "flex",
|
|
110
|
+
alignItems: "center",
|
|
111
|
+
gap: "1rem",
|
|
109
112
|
},
|
|
110
113
|
pageSelectionDropdown: {
|
|
111
114
|
minWidth: "100%",
|
|
112
115
|
},
|
|
113
116
|
pageSizeInput: {
|
|
114
117
|
minWidth: "1.5rem",
|
|
115
|
-
width: "
|
|
118
|
+
width: "3rem",
|
|
119
|
+
},
|
|
120
|
+
pageSizeText: {
|
|
121
|
+
flex: 1,
|
|
122
|
+
minWidth: "100%",
|
|
123
|
+
fontSize: "0.8rem"
|
|
116
124
|
},
|
|
117
125
|
});
|
|
118
126
|
|
|
@@ -129,6 +137,9 @@ const Pagination = (props) => {
|
|
|
129
137
|
const totalNumberOfPage = table.getPageCount();
|
|
130
138
|
const currentPage = table.getState().pagination.pageIndex;
|
|
131
139
|
const pageSize = table.getState().pagination.pageSize;
|
|
140
|
+
// get total item count and number of item in current page
|
|
141
|
+
const totalItemCount = table.getFilteredRowModel().rows.length;
|
|
142
|
+
const numberOfItemsInCurrentPage = table.getRowModel().rows.length;
|
|
132
143
|
const pageSelectionOptions = React.useMemo(() => {
|
|
133
144
|
let start = currentPage - Math.floor(DEFAULT_NUMBER_OF_PAGE_BTN / 2);
|
|
134
145
|
let end = currentPage + Math.floor(DEFAULT_NUMBER_OF_PAGE_BTN / 2);
|
|
@@ -146,7 +157,7 @@ const Pagination = (props) => {
|
|
|
146
157
|
const currentPageOptions = end - start >= 0 ? range(start, end) : [];
|
|
147
158
|
return (currentPageOptions === null || currentPageOptions === void 0 ? void 0 : currentPageOptions.length) ? [...currentPageOptions] : [1];
|
|
148
159
|
}, [totalNumberOfPage, currentPage]);
|
|
149
|
-
return (jsxRuntime.jsx("div", { className: styles.paginationContainer, children: jsxRuntime.jsxs("div", { className: styles.wrapper, children: [jsxRuntime.
|
|
160
|
+
return (jsxRuntime.jsx("div", { className: styles.paginationContainer, children: jsxRuntime.jsxs("div", { className: styles.wrapper, children: [jsxRuntime.jsxs("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.jsx(reactControlFlow.Show, { when: (pageSelectionOptions === null || pageSelectionOptions === void 0 ? void 0 : pageSelectionOptions.length) > 0 && totalItemCount > 0, children: jsxRuntime.jsxs("span", { className: styles.pageSizeText, children: ["Showing ", numberOfItemsInCurrentPage, " of ", totalItemCount, " items"] }) })] }), 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) => {
|
|
150
161
|
const page = data.value ? Number(e.target.value) - 1 : 0;
|
|
151
162
|
if (page >= 0 && page < table.getPageCount()) {
|
|
152
163
|
table.setPageIndex(page);
|
|
@@ -218,7 +229,7 @@ function DebouncedInput({ value: initialValue, onChange, debounce = 500, drawerS
|
|
|
218
229
|
}, debounce);
|
|
219
230
|
return () => clearTimeout(timeout);
|
|
220
231
|
}, [value, onChange, debounce]);
|
|
221
|
-
return (jsxRuntime.jsx(reactComponents.Input, { placeholder: "Search Keyword", value: value, onChange: (_, data) => setValue(data.value), type: "search", autoComplete: "off", contentBefore: jsxRuntime.jsx(reactIcons.Search24Regular, {}), style: { width: '300px' }, contentAfter: jsxRuntime.jsx(reactComponents.Tooltip, { content: (drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen) ? 'Close Filter Window' : 'Open Advance Filter', relationship: "label", children: jsxRuntime.jsx(reactComponents.Button, { appearance: "subtle", icon: (drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen) ? jsxRuntime.jsx(reactIcons.FilterDismissFilled, {}) : jsxRuntime.jsx(reactIcons.FilterFilled, {}), "aria-label":
|
|
232
|
+
return (jsxRuntime.jsx(reactComponents.Input, { "aria-label": "Search keyword", placeholder: "Search Keyword", value: value, onChange: (_, data) => setValue(data.value), type: "search", autoComplete: "off", contentBefore: jsxRuntime.jsx(reactIcons.Search24Regular, {}), style: { width: '300px' }, contentAfter: jsxRuntime.jsx(reactComponents.Tooltip, { content: (drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen) ? 'Close Filter Window' : 'Open Advance Filter', relationship: "label", children: jsxRuntime.jsx(reactComponents.Button, { appearance: "subtle", icon: (drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen) ? jsxRuntime.jsx(reactIcons.FilterDismissFilled, {}) : jsxRuntime.jsx(reactIcons.FilterFilled, {}), "aria-label": (drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen) ? 'Close filter panel' : 'Open advanced filter', onClick: () => {
|
|
222
233
|
dispatch === null || dispatch === void 0 ? void 0 : dispatch({ type: "TOGGLE_FILTER_DRAWER" });
|
|
223
234
|
} }) }) }));
|
|
224
235
|
}
|
|
@@ -243,15 +254,15 @@ const dateRange = (row, columnId, value) => {
|
|
|
243
254
|
return true;
|
|
244
255
|
}
|
|
245
256
|
else if (value.length === 2 && value[0] && !value[1]) {
|
|
246
|
-
return typeof rowValue.getMonth === 'function' && rowValue >= value[0];
|
|
257
|
+
return typeof (rowValue === null || rowValue === void 0 ? void 0 : rowValue.getMonth) === 'function' && rowValue >= value[0];
|
|
247
258
|
}
|
|
248
259
|
else if (value.length === 2 && !value[0] && value[1]) {
|
|
249
|
-
return typeof rowValue.getMonth === 'function' && rowValue <= value[1];
|
|
260
|
+
return typeof (rowValue === null || rowValue === void 0 ? void 0 : rowValue.getMonth) === 'function' && rowValue <= value[1];
|
|
250
261
|
}
|
|
251
262
|
else if (value.length === 2 && !value[0] && !value[1]) {
|
|
252
263
|
return true;
|
|
253
264
|
}
|
|
254
|
-
const passed = typeof rowValue.getMonth === 'function' && value[0] <= rowValue && rowValue <= value[1];
|
|
265
|
+
const passed = typeof (rowValue === null || rowValue === void 0 ? void 0 : rowValue.getMonth) === 'function' && value[0] <= rowValue && rowValue <= value[1];
|
|
255
266
|
return passed;
|
|
256
267
|
};
|
|
257
268
|
const date = (row, columnId, value) => {
|
|
@@ -265,7 +276,7 @@ const date = (row, columnId, value) => {
|
|
|
265
276
|
if (!value) {
|
|
266
277
|
return true;
|
|
267
278
|
}
|
|
268
|
-
const passed = typeof rowValue.getMonth === 'function' && ((_a = new Date(value)) === null || _a === void 0 ? void 0 : _a.toDateString()) === (rowValue === null || rowValue === void 0 ? void 0 : rowValue.toDateString());
|
|
279
|
+
const passed = typeof (rowValue === null || rowValue === void 0 ? void 0 : rowValue.getMonth) === 'function' && ((_a = new Date(value)) === null || _a === void 0 ? void 0 : _a.toDateString()) === (rowValue === null || rowValue === void 0 ? void 0 : rowValue.toDateString());
|
|
269
280
|
return passed;
|
|
270
281
|
};
|
|
271
282
|
|
|
@@ -1235,7 +1246,7 @@ const useFilterStyles = reactComponents.makeStyles({
|
|
|
1235
1246
|
},
|
|
1236
1247
|
});
|
|
1237
1248
|
const Filter = ({ column, table, }) => {
|
|
1238
|
-
var _a, _b;
|
|
1249
|
+
var _a, _b, _c;
|
|
1239
1250
|
const filterFunctionName = column.columnDef.filterFn;
|
|
1240
1251
|
const styles = useFilterStyles();
|
|
1241
1252
|
switch (filterFunctionName) {
|
|
@@ -1247,18 +1258,18 @@ const Filter = ({ column, table, }) => {
|
|
|
1247
1258
|
case 'inNumberRange':
|
|
1248
1259
|
return jsxRuntime.jsx(FilterNumberRange, { column: column, table: table });
|
|
1249
1260
|
case 'inDateRange': {
|
|
1250
|
-
const firstValue = (_a = table
|
|
1261
|
+
const firstValue = (_b = (_a = table
|
|
1251
1262
|
.getPreFilteredRowModel()
|
|
1252
|
-
.flatRows
|
|
1253
|
-
if (typeof firstValue.getMonth === 'function') {
|
|
1263
|
+
.flatRows) === null || _a === void 0 ? void 0 : _a.find(x => Boolean(x.getValue(column.id)))) === null || _b === void 0 ? void 0 : _b.getValue(column.id);
|
|
1264
|
+
if (typeof (firstValue === null || firstValue === void 0 ? void 0 : firstValue.getMonth) === 'function') {
|
|
1254
1265
|
return jsxRuntime.jsx(FilterDateRange, { column: column, table: table });
|
|
1255
1266
|
}
|
|
1256
1267
|
break;
|
|
1257
1268
|
}
|
|
1258
1269
|
case 'matchDate': {
|
|
1259
|
-
const firstValue = (
|
|
1270
|
+
const firstValue = (_c = table
|
|
1260
1271
|
.getPreFilteredRowModel()
|
|
1261
|
-
.flatRows[0]) === null ||
|
|
1272
|
+
.flatRows[0]) === null || _c === void 0 ? void 0 : _c.getValue(column.id);
|
|
1262
1273
|
if (typeof firstValue.getMonth === 'function') {
|
|
1263
1274
|
return jsxRuntime.jsx(FilterDate, { column: column, table: table });
|
|
1264
1275
|
}
|
|
@@ -1296,7 +1307,7 @@ const FilterDrawer = ({ table }) => {
|
|
|
1296
1307
|
}, [table]);
|
|
1297
1308
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
1298
1309
|
const { dispatchDrawerAction, drawerState } = table.options.meta;
|
|
1299
|
-
return (jsxRuntime.jsxs(reactComponents.InlineDrawer, { position: "end", open: drawerState === null || drawerState === void 0 ? void 0 : 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(reactIcons.Dismiss24Regular, {}), onClick: () => dispatchDrawerAction === null || dispatchDrawerAction === void 0 ? void 0 : dispatchDrawerAction({ type: "CLOSE_FILTER_DRAWER" }) }), children: "Column Filters" }) }), jsxRuntime.jsx(reactComponents.DrawerBody, { className: styles.drawerBody, children: jsxRuntime.jsx(reactComponents.Accordion, { multiple: true, collapsible: true, children: headerGroups.map((headerGroup) => {
|
|
1310
|
+
return (jsxRuntime.jsxs(reactComponents.InlineDrawer, { position: "end", open: drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen, separator: true, size: 'medium', children: [jsxRuntime.jsx(reactComponents.DrawerHeader, { children: jsxRuntime.jsx(reactComponents.DrawerHeaderTitle, { action: jsxRuntime.jsx(reactComponents.Button, { appearance: "subtle", "aria-label": "Close", icon: jsxRuntime.jsx(reactIcons.Dismiss24Regular, {}), onClick: () => dispatchDrawerAction === null || dispatchDrawerAction === void 0 ? void 0 : dispatchDrawerAction({ type: "CLOSE_FILTER_DRAWER" }) }), children: "Column Filters" }) }), jsxRuntime.jsx(reactComponents.DrawerBody, { className: styles.drawerBody, children: jsxRuntime.jsx(reactComponents.Accordion, { multiple: true, collapsible: true, children: headerGroups.map((headerGroup) => {
|
|
1300
1311
|
const canApplyFilter = headerGroup.depth === (headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.length) - 1;
|
|
1301
1312
|
if (!canApplyFilter)
|
|
1302
1313
|
return null;
|
package/index.esm.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./src
|
|
1
|
+
export * from "./src/index";
|
package/index.esm.js
CHANGED
|
@@ -87,13 +87,21 @@ const usePaginationStyle = makeStyles({
|
|
|
87
87
|
},
|
|
88
88
|
pageSelectionWrapper: {
|
|
89
89
|
minWidth: "1.5rem",
|
|
90
|
+
display: "flex",
|
|
91
|
+
alignItems: "center",
|
|
92
|
+
gap: "1rem",
|
|
90
93
|
},
|
|
91
94
|
pageSelectionDropdown: {
|
|
92
95
|
minWidth: "100%",
|
|
93
96
|
},
|
|
94
97
|
pageSizeInput: {
|
|
95
98
|
minWidth: "1.5rem",
|
|
96
|
-
width: "
|
|
99
|
+
width: "3rem",
|
|
100
|
+
},
|
|
101
|
+
pageSizeText: {
|
|
102
|
+
flex: 1,
|
|
103
|
+
minWidth: "100%",
|
|
104
|
+
fontSize: "0.8rem"
|
|
97
105
|
},
|
|
98
106
|
});
|
|
99
107
|
|
|
@@ -110,6 +118,9 @@ const Pagination = (props) => {
|
|
|
110
118
|
const totalNumberOfPage = table.getPageCount();
|
|
111
119
|
const currentPage = table.getState().pagination.pageIndex;
|
|
112
120
|
const pageSize = table.getState().pagination.pageSize;
|
|
121
|
+
// get total item count and number of item in current page
|
|
122
|
+
const totalItemCount = table.getFilteredRowModel().rows.length;
|
|
123
|
+
const numberOfItemsInCurrentPage = table.getRowModel().rows.length;
|
|
113
124
|
const pageSelectionOptions = useMemo(() => {
|
|
114
125
|
let start = currentPage - Math.floor(DEFAULT_NUMBER_OF_PAGE_BTN / 2);
|
|
115
126
|
let end = currentPage + Math.floor(DEFAULT_NUMBER_OF_PAGE_BTN / 2);
|
|
@@ -127,7 +138,7 @@ const Pagination = (props) => {
|
|
|
127
138
|
const currentPageOptions = end - start >= 0 ? range(start, end) : [];
|
|
128
139
|
return (currentPageOptions === null || currentPageOptions === void 0 ? void 0 : currentPageOptions.length) ? [...currentPageOptions] : [1];
|
|
129
140
|
}, [totalNumberOfPage, currentPage]);
|
|
130
|
-
return (jsx("div", { className: styles.paginationContainer, children: jsxs("div", { className: styles.wrapper, children: [
|
|
141
|
+
return (jsx("div", { className: styles.paginationContainer, children: jsxs("div", { className: styles.wrapper, children: [jsxs("div", { className: styles.pageSelectionWrapper, children: [jsx(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: jsx(Show, { when: (pageSelectionOptions === null || pageSelectionOptions === void 0 ? void 0 : pageSelectionOptions.length) > 0, children: jsx(For, { each: pageSizeOptions, children: (option) => (jsx(Option, { value: `${option}`, children: `${option}` }, option)) }) }) }), jsx(Show, { when: (pageSelectionOptions === null || pageSelectionOptions === void 0 ? void 0 : pageSelectionOptions.length) > 0 && totalItemCount > 0, children: jsxs("span", { className: styles.pageSizeText, children: ["Showing ", numberOfItemsInCurrentPage, " of ", totalItemCount, " items"] }) })] }), jsxs("div", { className: styles.pageBtnContainer, children: [jsxs("div", { children: [jsxs("span", { children: ["Page", " ", jsxs("strong", { children: [table.getState().pagination.pageIndex + 1, " of", " ", table.getPageCount()] })] }), jsxs("span", { children: [" ", "| Go to page:", " ", jsx(Input, { type: "number", size: "small", value: `${table.getState().pagination.pageIndex + 1}`, onChange: (e, data) => {
|
|
131
142
|
const page = data.value ? Number(e.target.value) - 1 : 0;
|
|
132
143
|
if (page >= 0 && page < table.getPageCount()) {
|
|
133
144
|
table.setPageIndex(page);
|
|
@@ -199,7 +210,7 @@ function DebouncedInput({ value: initialValue, onChange, debounce = 500, drawerS
|
|
|
199
210
|
}, debounce);
|
|
200
211
|
return () => clearTimeout(timeout);
|
|
201
212
|
}, [value, onChange, debounce]);
|
|
202
|
-
return (jsx(Input, { placeholder: "Search Keyword", value: value, onChange: (_, data) => setValue(data.value), type: "search", autoComplete: "off", contentBefore: jsx(Search24Regular, {}), style: { width: '300px' }, contentAfter: jsx(Tooltip, { content: (drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen) ? 'Close Filter Window' : 'Open Advance Filter', relationship: "label", children: jsx(Button, { appearance: "subtle", icon: (drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen) ? jsx(FilterDismissFilled, {}) : jsx(FilterFilled, {}), "aria-label":
|
|
213
|
+
return (jsx(Input, { "aria-label": "Search keyword", placeholder: "Search Keyword", value: value, onChange: (_, data) => setValue(data.value), type: "search", autoComplete: "off", contentBefore: jsx(Search24Regular, {}), style: { width: '300px' }, contentAfter: jsx(Tooltip, { content: (drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen) ? 'Close Filter Window' : 'Open Advance Filter', relationship: "label", children: jsx(Button, { appearance: "subtle", icon: (drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen) ? jsx(FilterDismissFilled, {}) : jsx(FilterFilled, {}), "aria-label": (drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen) ? 'Close filter panel' : 'Open advanced filter', onClick: () => {
|
|
203
214
|
dispatch === null || dispatch === void 0 ? void 0 : dispatch({ type: "TOGGLE_FILTER_DRAWER" });
|
|
204
215
|
} }) }) }));
|
|
205
216
|
}
|
|
@@ -224,15 +235,15 @@ const dateRange = (row, columnId, value) => {
|
|
|
224
235
|
return true;
|
|
225
236
|
}
|
|
226
237
|
else if (value.length === 2 && value[0] && !value[1]) {
|
|
227
|
-
return typeof rowValue.getMonth === 'function' && rowValue >= value[0];
|
|
238
|
+
return typeof (rowValue === null || rowValue === void 0 ? void 0 : rowValue.getMonth) === 'function' && rowValue >= value[0];
|
|
228
239
|
}
|
|
229
240
|
else if (value.length === 2 && !value[0] && value[1]) {
|
|
230
|
-
return typeof rowValue.getMonth === 'function' && rowValue <= value[1];
|
|
241
|
+
return typeof (rowValue === null || rowValue === void 0 ? void 0 : rowValue.getMonth) === 'function' && rowValue <= value[1];
|
|
231
242
|
}
|
|
232
243
|
else if (value.length === 2 && !value[0] && !value[1]) {
|
|
233
244
|
return true;
|
|
234
245
|
}
|
|
235
|
-
const passed = typeof rowValue.getMonth === 'function' && value[0] <= rowValue && rowValue <= value[1];
|
|
246
|
+
const passed = typeof (rowValue === null || rowValue === void 0 ? void 0 : rowValue.getMonth) === 'function' && value[0] <= rowValue && rowValue <= value[1];
|
|
236
247
|
return passed;
|
|
237
248
|
};
|
|
238
249
|
const date = (row, columnId, value) => {
|
|
@@ -246,7 +257,7 @@ const date = (row, columnId, value) => {
|
|
|
246
257
|
if (!value) {
|
|
247
258
|
return true;
|
|
248
259
|
}
|
|
249
|
-
const passed = typeof rowValue.getMonth === 'function' && ((_a = new Date(value)) === null || _a === void 0 ? void 0 : _a.toDateString()) === (rowValue === null || rowValue === void 0 ? void 0 : rowValue.toDateString());
|
|
260
|
+
const passed = typeof (rowValue === null || rowValue === void 0 ? void 0 : rowValue.getMonth) === 'function' && ((_a = new Date(value)) === null || _a === void 0 ? void 0 : _a.toDateString()) === (rowValue === null || rowValue === void 0 ? void 0 : rowValue.toDateString());
|
|
250
261
|
return passed;
|
|
251
262
|
};
|
|
252
263
|
|
|
@@ -1216,7 +1227,7 @@ const useFilterStyles = makeStyles({
|
|
|
1216
1227
|
},
|
|
1217
1228
|
});
|
|
1218
1229
|
const Filter = ({ column, table, }) => {
|
|
1219
|
-
var _a, _b;
|
|
1230
|
+
var _a, _b, _c;
|
|
1220
1231
|
const filterFunctionName = column.columnDef.filterFn;
|
|
1221
1232
|
const styles = useFilterStyles();
|
|
1222
1233
|
switch (filterFunctionName) {
|
|
@@ -1228,18 +1239,18 @@ const Filter = ({ column, table, }) => {
|
|
|
1228
1239
|
case 'inNumberRange':
|
|
1229
1240
|
return jsx(FilterNumberRange, { column: column, table: table });
|
|
1230
1241
|
case 'inDateRange': {
|
|
1231
|
-
const firstValue = (_a = table
|
|
1242
|
+
const firstValue = (_b = (_a = table
|
|
1232
1243
|
.getPreFilteredRowModel()
|
|
1233
|
-
.flatRows
|
|
1234
|
-
if (typeof firstValue.getMonth === 'function') {
|
|
1244
|
+
.flatRows) === null || _a === void 0 ? void 0 : _a.find(x => Boolean(x.getValue(column.id)))) === null || _b === void 0 ? void 0 : _b.getValue(column.id);
|
|
1245
|
+
if (typeof (firstValue === null || firstValue === void 0 ? void 0 : firstValue.getMonth) === 'function') {
|
|
1235
1246
|
return jsx(FilterDateRange, { column: column, table: table });
|
|
1236
1247
|
}
|
|
1237
1248
|
break;
|
|
1238
1249
|
}
|
|
1239
1250
|
case 'matchDate': {
|
|
1240
|
-
const firstValue = (
|
|
1251
|
+
const firstValue = (_c = table
|
|
1241
1252
|
.getPreFilteredRowModel()
|
|
1242
|
-
.flatRows[0]) === null ||
|
|
1253
|
+
.flatRows[0]) === null || _c === void 0 ? void 0 : _c.getValue(column.id);
|
|
1243
1254
|
if (typeof firstValue.getMonth === 'function') {
|
|
1244
1255
|
return jsx(FilterDate, { column: column, table: table });
|
|
1245
1256
|
}
|
|
@@ -1277,7 +1288,7 @@ const FilterDrawer = ({ table }) => {
|
|
|
1277
1288
|
}, [table]);
|
|
1278
1289
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
1279
1290
|
const { dispatchDrawerAction, drawerState } = table.options.meta;
|
|
1280
|
-
return (jsxs(InlineDrawer, { position: "end", open: drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen, separator: true, children: [jsx(DrawerHeader, { children: jsx(DrawerHeaderTitle, { action: jsx(Button, { appearance: "subtle", "aria-label": "Close", icon: jsx(Dismiss24Regular, {}), onClick: () => dispatchDrawerAction === null || dispatchDrawerAction === void 0 ? void 0 : dispatchDrawerAction({ type: "CLOSE_FILTER_DRAWER" }) }), children: "Column Filters" }) }), jsx(DrawerBody, { className: styles.drawerBody, children: jsx(Accordion, { multiple: true, collapsible: true, children: headerGroups.map((headerGroup) => {
|
|
1291
|
+
return (jsxs(InlineDrawer, { position: "end", open: drawerState === null || drawerState === void 0 ? void 0 : drawerState.isFilterDrawerOpen, separator: true, size: 'medium', children: [jsx(DrawerHeader, { children: jsx(DrawerHeaderTitle, { action: jsx(Button, { appearance: "subtle", "aria-label": "Close", icon: jsx(Dismiss24Regular, {}), onClick: () => dispatchDrawerAction === null || dispatchDrawerAction === void 0 ? void 0 : dispatchDrawerAction({ type: "CLOSE_FILTER_DRAWER" }) }), children: "Column Filters" }) }), jsx(DrawerBody, { className: styles.drawerBody, children: jsx(Accordion, { multiple: true, collapsible: true, children: headerGroups.map((headerGroup) => {
|
|
1281
1292
|
const canApplyFilter = headerGroup.depth === (headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.length) - 1;
|
|
1282
1293
|
if (!canApplyFilter)
|
|
1283
1294
|
return null;
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prt-ts/fluent-react-table-v2",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.66.2-build-2.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.66.2",
|
|
8
8
|
"@fluentui/react-icons": ">=2.0.260",
|
|
9
9
|
"@fluentui/react-datepicker-compat": ">=0.4.32"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@tanstack/react-table": ">=8.
|
|
12
|
+
"@tanstack/react-table": ">=8.21.3",
|
|
13
13
|
"@dnd-kit/core": "6.1.0",
|
|
14
14
|
"@dnd-kit/modifiers": "7.0.0",
|
|
15
15
|
"@dnd-kit/sortable": "8.0.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const usePaginationStyle: () => Record<"paginationContainer" | "wrapper" | "pageBtnContainer" | "pageBtn" | "pageSelectionWrapper" | "pageSelectionDropdown" | "pageSizeInput", string>;
|
|
1
|
+
export declare const usePaginationStyle: () => Record<"paginationContainer" | "wrapper" | "pageBtnContainer" | "pageBtn" | "pageSelectionWrapper" | "pageSelectionDropdown" | "pageSizeInput" | "pageSizeText", string>;
|