@prt-ts/fluent-react-table-v2 9.54.4-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.
Files changed (31) hide show
  1. package/README.md +7 -7
  2. package/index.cjs.d.ts +1 -1
  3. package/index.cjs.js +29 -21
  4. package/index.esm.d.ts +1 -1
  5. package/index.esm.js +25 -14
  6. package/package.json +5 -5
  7. package/src/lib/components/GridContainer.d.ts +1 -1
  8. package/src/lib/components/extensions/PinRowAction.d.ts +1 -1
  9. package/src/lib/components/extensions/SelectRowCheckbox.d.ts +1 -1
  10. package/src/lib/components/extensions/SelectRowRadio.d.ts +1 -1
  11. package/src/lib/components/filters/Filter.d.ts +1 -1
  12. package/src/lib/components/filters/FilterDate.d.ts +1 -1
  13. package/src/lib/components/filters/FilterDateRange.d.ts +1 -1
  14. package/src/lib/components/filters/FilterDrawer.d.ts +1 -1
  15. package/src/lib/components/filters/FilterMultiSelectCheckbox.d.ts +2 -2
  16. package/src/lib/components/filters/FilterNumberRange.d.ts +1 -1
  17. package/src/lib/components/filters/FilterSelectRadio.d.ts +2 -2
  18. package/src/lib/components/grid-header/GridHeader.d.ts +1 -1
  19. package/src/lib/components/loading/Loading.d.ts +1 -1
  20. package/src/lib/components/pagination/Pagination.d.ts +1 -1
  21. package/src/lib/components/pagination/usePaginationStyles.d.ts +1 -1
  22. package/src/lib/components/table/Table.d.ts +1 -1
  23. package/src/lib/components/tbody/TableBody.d.ts +0 -1
  24. package/src/lib/components/tbody/TableRow.d.ts +0 -1
  25. package/src/lib/components/useGridContainer.d.ts +2 -2
  26. package/src/lib/components/views/ViewSaveForm.d.ts +1 -1
  27. package/src/lib/components/views/ViewsDrawer.d.ts +1 -1
  28. package/src/lib/helpers/Helpers.d.ts +2 -2
  29. package/src/lib/helpers/StylesHelper.d.ts +4 -4
  30. package/src/lib/helpers/TableExportDataHelper.d.ts +2 -2
  31. package/src/lib/index.d.ts +0 -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\\index";
1
+ export * from "./src/index";
package/index.cjs.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var jsxRuntime = require('react/jsx-runtime');
6
4
  var React = require('react');
7
5
  var reactComponents = require('@fluentui/react-components');
@@ -15,8 +13,7 @@ var reactDatepickerCompat = require('@fluentui/react-datepicker-compat');
15
13
  var core = require('@dnd-kit/core');
16
14
  var modifiers = require('@dnd-kit/modifiers');
17
15
 
18
- function _interopNamespace(e) {
19
- if (e && e.__esModule) return e;
16
+ function _interopNamespaceDefault(e) {
20
17
  var n = Object.create(null);
21
18
  if (e) {
22
19
  Object.keys(e).forEach(function (k) {
@@ -29,11 +26,11 @@ function _interopNamespace(e) {
29
26
  }
30
27
  });
31
28
  }
32
- n["default"] = e;
29
+ n.default = e;
33
30
  return Object.freeze(n);
34
31
  }
35
32
 
36
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
33
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
37
34
 
38
35
  const disableAllShorthand = {
39
36
  enableGrouping: false,
@@ -109,13 +106,21 @@ const usePaginationStyle = reactComponents.makeStyles({
109
106
  },
110
107
  pageSelectionWrapper: {
111
108
  minWidth: "1.5rem",
109
+ display: "flex",
110
+ alignItems: "center",
111
+ gap: "1rem",
112
112
  },
113
113
  pageSelectionDropdown: {
114
114
  minWidth: "100%",
115
115
  },
116
116
  pageSizeInput: {
117
117
  minWidth: "1.5rem",
118
- width: "4rem",
118
+ width: "3rem",
119
+ },
120
+ pageSizeText: {
121
+ flex: 1,
122
+ minWidth: "100%",
123
+ fontSize: "0.8rem"
119
124
  },
120
125
  });
121
126
 
@@ -132,6 +137,9 @@ const Pagination = (props) => {
132
137
  const totalNumberOfPage = table.getPageCount();
133
138
  const currentPage = table.getState().pagination.pageIndex;
134
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;
135
143
  const pageSelectionOptions = React.useMemo(() => {
136
144
  let start = currentPage - Math.floor(DEFAULT_NUMBER_OF_PAGE_BTN / 2);
137
145
  let end = currentPage + Math.floor(DEFAULT_NUMBER_OF_PAGE_BTN / 2);
@@ -149,7 +157,7 @@ const Pagination = (props) => {
149
157
  const currentPageOptions = end - start >= 0 ? range(start, end) : [];
150
158
  return (currentPageOptions === null || currentPageOptions === void 0 ? void 0 : currentPageOptions.length) ? [...currentPageOptions] : [1];
151
159
  }, [totalNumberOfPage, currentPage]);
152
- 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) => {
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) => {
153
161
  const page = data.value ? Number(e.target.value) - 1 : 0;
154
162
  if (page >= 0 && page < table.getPageCount()) {
155
163
  table.setPageIndex(page);
@@ -221,7 +229,7 @@ function DebouncedInput({ value: initialValue, onChange, debounce = 500, drawerS
221
229
  }, debounce);
222
230
  return () => clearTimeout(timeout);
223
231
  }, [value, onChange, debounce]);
224
- 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": "View Menu", onClick: () => {
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: () => {
225
233
  dispatch === null || dispatch === void 0 ? void 0 : dispatch({ type: "TOGGLE_FILTER_DRAWER" });
226
234
  } }) }) }));
227
235
  }
@@ -246,15 +254,15 @@ const dateRange = (row, columnId, value) => {
246
254
  return true;
247
255
  }
248
256
  else if (value.length === 2 && value[0] && !value[1]) {
249
- return typeof rowValue.getMonth === 'function' && rowValue >= value[0];
257
+ return typeof (rowValue === null || rowValue === void 0 ? void 0 : rowValue.getMonth) === 'function' && rowValue >= value[0];
250
258
  }
251
259
  else if (value.length === 2 && !value[0] && value[1]) {
252
- return typeof rowValue.getMonth === 'function' && rowValue <= value[1];
260
+ return typeof (rowValue === null || rowValue === void 0 ? void 0 : rowValue.getMonth) === 'function' && rowValue <= value[1];
253
261
  }
254
262
  else if (value.length === 2 && !value[0] && !value[1]) {
255
263
  return true;
256
264
  }
257
- 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];
258
266
  return passed;
259
267
  };
260
268
  const date = (row, columnId, value) => {
@@ -268,7 +276,7 @@ const date = (row, columnId, value) => {
268
276
  if (!value) {
269
277
  return true;
270
278
  }
271
- 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());
272
280
  return passed;
273
281
  };
274
282
 
@@ -1238,7 +1246,7 @@ const useFilterStyles = reactComponents.makeStyles({
1238
1246
  },
1239
1247
  });
1240
1248
  const Filter = ({ column, table, }) => {
1241
- var _a, _b;
1249
+ var _a, _b, _c;
1242
1250
  const filterFunctionName = column.columnDef.filterFn;
1243
1251
  const styles = useFilterStyles();
1244
1252
  switch (filterFunctionName) {
@@ -1250,18 +1258,18 @@ const Filter = ({ column, table, }) => {
1250
1258
  case 'inNumberRange':
1251
1259
  return jsxRuntime.jsx(FilterNumberRange, { column: column, table: table });
1252
1260
  case 'inDateRange': {
1253
- const firstValue = (_a = table
1261
+ const firstValue = (_b = (_a = table
1254
1262
  .getPreFilteredRowModel()
1255
- .flatRows[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
1256
- 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') {
1257
1265
  return jsxRuntime.jsx(FilterDateRange, { column: column, table: table });
1258
1266
  }
1259
1267
  break;
1260
1268
  }
1261
1269
  case 'matchDate': {
1262
- const firstValue = (_b = table
1270
+ const firstValue = (_c = table
1263
1271
  .getPreFilteredRowModel()
1264
- .flatRows[0]) === null || _b === void 0 ? void 0 : _b.getValue(column.id);
1272
+ .flatRows[0]) === null || _c === void 0 ? void 0 : _c.getValue(column.id);
1265
1273
  if (typeof firstValue.getMonth === 'function') {
1266
1274
  return jsxRuntime.jsx(FilterDate, { column: column, table: table });
1267
1275
  }
@@ -1299,7 +1307,7 @@ const FilterDrawer = ({ table }) => {
1299
1307
  }, [table]);
1300
1308
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
1301
1309
  const { dispatchDrawerAction, drawerState } = table.options.meta;
1302
- 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) => {
1303
1311
  const canApplyFilter = headerGroup.depth === (headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.length) - 1;
1304
1312
  if (!canApplyFilter)
1305
1313
  return null;
@@ -1449,7 +1457,7 @@ const getTableData = (table) => {
1449
1457
  return data;
1450
1458
  };
1451
1459
 
1452
- Object.defineProperty(exports, 'createColumnHelper', {
1460
+ Object.defineProperty(exports, "createColumnHelper", {
1453
1461
  enumerable: true,
1454
1462
  get: function () { return reactTable.createColumnHelper; }
1455
1463
  });
package/index.esm.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./src\\index";
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: "4rem",
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: [jsx("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)) }) }) }) }), 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) => {
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": "View Menu", onClick: () => {
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[0]) === null || _a === void 0 ? void 0 : _a.getValue(column.id);
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 = (_b = table
1251
+ const firstValue = (_c = table
1241
1252
  .getPreFilteredRowModel()
1242
- .flatRows[0]) === null || _b === void 0 ? void 0 : _b.getValue(column.id);
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.54.4-build-1.0",
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.54.4",
8
- "@fluentui/react-icons": ">=2.0.247",
7
+ "@fluentui/react-components": ">=9.66.2",
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.10.7",
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",
@@ -29,4 +29,4 @@
29
29
  "types": "./index.cjs.d.ts",
30
30
  "module": "./index.esm.js",
31
31
  "main": "./index.cjs.js"
32
- }
32
+ }
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { TableProps, TableRef } from "../types";
3
3
  import { RowData } from "@tanstack/react-table";
4
4
  export declare function AdvancedTable<TItem extends RowData>(props: TableProps<TItem>, ref: React.ForwardedRef<TableRef<TItem>>): import("react/jsx-runtime").JSX.Element;
5
- export declare const ForwardedAdvancedTable: <TItem extends unknown>(props: TableProps<TItem> & {
5
+ export declare const ForwardedAdvancedTable: <TItem extends RowData>(props: TableProps<TItem> & {
6
6
  ref?: React.ForwardedRef<TableRef<TItem>>;
7
7
  }) => React.ReactElement<TableProps<TItem> & {
8
8
  ref?: React.ForwardedRef<TableRef<TItem>>;
@@ -2,5 +2,5 @@ import { Row, RowData } from "@tanstack/react-table";
2
2
  type PinRowActionProps<TData extends RowData> = {
3
3
  row: Row<TData>;
4
4
  };
5
- export declare const PinRowAction: <TData extends unknown>({ row }: PinRowActionProps<TData>) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const PinRowAction: <TData extends RowData>({ row }: PinRowActionProps<TData>) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -2,5 +2,5 @@ import { Row, RowData } from "@tanstack/react-table";
2
2
  type SelectRowCheckboxProps<TData extends RowData> = {
3
3
  row: Row<TData>;
4
4
  };
5
- export declare const SelectRowCheckbox: <TData extends unknown>({ row }: SelectRowCheckboxProps<TData>) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const SelectRowCheckbox: <TData extends RowData>({ row }: SelectRowCheckboxProps<TData>) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -2,5 +2,5 @@ import { Row, RowData } from "@tanstack/react-table";
2
2
  type SelectRowRadioProps<TData extends RowData> = {
3
3
  row: Row<TData>;
4
4
  };
5
- export declare const SelectRowRadio: <TData extends unknown>({ row }: SelectRowRadioProps<TData>) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const SelectRowRadio: <TData extends RowData>({ row }: SelectRowRadioProps<TData>) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -1,5 +1,5 @@
1
1
  import { Column, RowData, Table } from '@tanstack/react-table';
2
- export declare const Filter: <TItem extends unknown>({ column, table, }: {
2
+ export declare const Filter: <TItem extends RowData>({ column, table, }: {
3
3
  column: Column<TItem, RowData>;
4
4
  table: Table<TItem>;
5
5
  }) => import("react/jsx-runtime").JSX.Element;
@@ -3,5 +3,5 @@ type FilterNumberRangeProps<TItem extends RowData> = {
3
3
  column: Column<TItem, unknown>;
4
4
  table: Table<TItem>;
5
5
  };
6
- export declare const FilterDate: <TItem extends unknown>(props: FilterNumberRangeProps<TItem>) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const FilterDate: <TItem extends RowData>(props: FilterNumberRangeProps<TItem>) => import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -3,5 +3,5 @@ type FilterNumberRangeProps<TItem extends RowData> = {
3
3
  column: Column<TItem, unknown>;
4
4
  table: Table<TItem>;
5
5
  };
6
- export declare const FilterDateRange: <TItem extends unknown>(props: FilterNumberRangeProps<TItem>) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const FilterDateRange: <TItem extends RowData>(props: FilterNumberRangeProps<TItem>) => import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -2,5 +2,5 @@ import { RowData, Table } from '@tanstack/react-table';
2
2
  type FilterDrawerProps<TItem extends RowData> = {
3
3
  table: Table<TItem>;
4
4
  };
5
- export declare const FilterDrawer: <TItem extends unknown>({ table }: FilterDrawerProps<TItem>) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const FilterDrawer: <TItem extends RowData>({ table }: FilterDrawerProps<TItem>) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -1,5 +1,5 @@
1
- import { Column, Table } from '@tanstack/react-table';
2
- export declare const FilterMultiSelectCheckbox: <TItem extends unknown>({ column, table, }: {
1
+ import { Column, RowData, Table } from '@tanstack/react-table';
2
+ export declare const FilterMultiSelectCheckbox: <TItem extends RowData>({ column, table, }: {
3
3
  column: Column<TItem, unknown>;
4
4
  table: Table<TItem>;
5
5
  }) => import("react/jsx-runtime").JSX.Element;
@@ -3,5 +3,5 @@ type FilterNumberRangeProps<TItem extends RowData> = {
3
3
  column: Column<TItem, unknown>;
4
4
  table: Table<TItem>;
5
5
  };
6
- export declare const FilterNumberRange: <TItem extends unknown>(props: FilterNumberRangeProps<TItem>) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const FilterNumberRange: <TItem extends RowData>(props: FilterNumberRangeProps<TItem>) => import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -1,5 +1,5 @@
1
- import { Column, Table } from "@tanstack/react-table";
2
- export declare const FilterSelectRadio: <TItem extends unknown>({ column, table, }: {
1
+ import { Column, RowData, Table } from "@tanstack/react-table";
2
+ export declare const FilterSelectRadio: <TItem extends RowData>({ column, table, }: {
3
3
  column: Column<TItem, unknown>;
4
4
  table: Table<TItem>;
5
5
  }) => import("react/jsx-runtime").JSX.Element;
@@ -8,5 +8,5 @@ type GridHeaderProps<TItem extends RowData> = {
8
8
  setGlobalFilter: (value: string) => void;
9
9
  applyTableState: (tableState: TableState) => boolean;
10
10
  };
11
- export declare const GridHeader: <TItem extends unknown>(props: GridHeaderProps<TItem>) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const GridHeader: <TItem extends RowData>(props: GridHeaderProps<TItem>) => import("react/jsx-runtime").JSX.Element;
12
12
  export {};
@@ -4,5 +4,5 @@ type LoadingProps<TItem extends RowData> = {
4
4
  visibleColumns: Column<TItem, unknown>[];
5
5
  table: Table<TItem>;
6
6
  };
7
- export declare const Loading: <TItem extends unknown>(props: LoadingProps<TItem>) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const Loading: <TItem extends RowData>(props: LoadingProps<TItem>) => import("react/jsx-runtime").JSX.Element;
8
8
  export {};
@@ -2,5 +2,5 @@ import { RowData, Table } from "@tanstack/react-table";
2
2
  type PaginationProps<TItem extends RowData> = {
3
3
  table: Table<TItem>;
4
4
  };
5
- export declare const Pagination: <TItem extends unknown>(props: PaginationProps<TItem>) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const Pagination: <TItem extends RowData>(props: PaginationProps<TItem>) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -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>;
@@ -7,5 +7,5 @@ type TableContainerProps<TItem extends RowData> = {
7
7
  isLoading: boolean;
8
8
  data: TItem[];
9
9
  };
10
- export declare const TableContainer: <TItem extends unknown>(props: TableContainerProps<TItem>) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const TableContainer: <TItem extends RowData>(props: TableContainerProps<TItem>) => import("react/jsx-runtime").JSX.Element;
11
11
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { RowData, Table } from '@tanstack/react-table';
3
2
  type TableBodyProps<TItem extends RowData> = {
4
3
  table: Table<TItem>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Row, RowData, Table } from '@tanstack/react-table';
3
2
  type TableRowProps<TItem extends RowData> = {
4
3
  table: Table<TItem>;
@@ -1,7 +1,7 @@
1
- import { TableState } from '@tanstack/react-table';
1
+ import { RowData, TableState } from '@tanstack/react-table';
2
2
  import { TableProps, TableRef, TableView } from '../types';
3
3
  import * as React from 'react';
4
- export declare const useGridContainer: <TItem extends unknown>(props: TableProps<TItem>, ref: React.ForwardedRef<TableRef<TItem>>) => {
4
+ export declare const useGridContainer: <TItem extends RowData>(props: TableProps<TItem>, ref: React.ForwardedRef<TableRef<TItem>>) => {
5
5
  table: import("@tanstack/react-table").Table<TItem>;
6
6
  globalFilter: string;
7
7
  tableViews: TableView[];
@@ -5,5 +5,5 @@ type ViewSaveFormProps<TItem extends RowData> = {
5
5
  onSave: TableProps<TItem>['onTableViewSave'];
6
6
  getTableState: () => TableState;
7
7
  };
8
- export declare const ViewSaveForm: <TItem extends unknown>(props: ViewSaveFormProps<TItem>) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const ViewSaveForm: <TItem extends RowData>(props: ViewSaveFormProps<TItem>) => import("react/jsx-runtime").JSX.Element;
9
9
  export {};
@@ -6,5 +6,5 @@ type ViewsDrawerProps<TItem extends RowData> = {
6
6
  applyTableState: (tableView: TableState) => boolean;
7
7
  resetToGridDefaultView: () => boolean;
8
8
  };
9
- export declare const ViewsDrawer: <TItem extends unknown>(props: ViewsDrawerProps<TItem>) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const ViewsDrawer: <TItem extends RowData>(props: ViewsDrawerProps<TItem>) => import("react/jsx-runtime").JSX.Element;
10
10
  export {};
@@ -1,2 +1,2 @@
1
- import { Column } from "@tanstack/react-table";
2
- export declare const getLeafColumns: <TItem extends unknown>(columns: Column<TItem>[]) => Column<TItem>[];
1
+ import { Column, RowData } from "@tanstack/react-table";
2
+ export declare const getLeafColumns: <TItem extends RowData>(columns: Column<TItem>[]) => Column<TItem>[];
@@ -1,5 +1,5 @@
1
- import { Column, Row } from "@tanstack/react-table";
1
+ import { Column, Row, RowData } from "@tanstack/react-table";
2
2
  import { CSSProperties } from "react";
3
- export declare const getHeaderCellPinningStyles: <TItem extends unknown>(column: Column<TItem, unknown>, isDragging: boolean, additionalStyles: CSSProperties) => CSSProperties;
4
- export declare const getBodyCellPinningStyles: <TItem extends unknown>(column: Column<TItem, unknown>, isDragging: boolean, additionalStyles: CSSProperties) => CSSProperties;
5
- export declare const getRowPinningStyles: <TItem extends unknown>(row: Row<TItem>, bottomRowLength: number, headerGroupLength: number, additionalStyles: CSSProperties) => CSSProperties;
3
+ export declare const getHeaderCellPinningStyles: <TItem extends RowData>(column: Column<TItem, unknown>, isDragging: boolean, additionalStyles: CSSProperties) => CSSProperties;
4
+ export declare const getBodyCellPinningStyles: <TItem extends RowData>(column: Column<TItem, unknown>, isDragging: boolean, additionalStyles: CSSProperties) => CSSProperties;
5
+ export declare const getRowPinningStyles: <TItem extends RowData>(row: Row<TItem>, bottomRowLength: number, headerGroupLength: number, additionalStyles: CSSProperties) => CSSProperties;
@@ -1,3 +1,3 @@
1
- import { Table } from "@tanstack/react-table";
1
+ import { RowData, Table } from "@tanstack/react-table";
2
2
  export type TableExportData = Record<string, unknown>[];
3
- export declare const getTableData: <TItem extends unknown>(table: Table<TItem>) => TableExportData;
3
+ export declare const getTableData: <TItem extends RowData>(table: Table<TItem>) => TableExportData;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ColumnFiltersState, ColumnOrderState, ColumnPinningState, ColumnSizingState, ExpandedState, FilterFn, GroupingState, PaginationState, RowData, RowPinningState, RowSelectionState, SortingState, VisibilityState } from "@tanstack/react-table";
3
2
  import { TableProps, TableSettings } from "./types";
4
3
  import { ActionType, DrawerTableState } from "./components/reducer";