@prt-ts/fluent-react-table-v2 9.40.0-build.2.0 → 9.40.0-build.3.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.js +134 -43
- package/package.json +1 -1
- package/src/lib/components/filters/FilterNumberRange.d.ts +7 -0
- package/src/lib/components/filters/{FilterMultiSelectRadio.d.ts → FilterSelectRadio.d.ts} +1 -1
- package/src/lib/components/useGridContainer.d.ts +3 -3
- package/src/lib/types/TableRef.d.ts +1 -0
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import { useDrop, useDrag, DndProvider } from 'react-dnd';
|
|
5
5
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
6
|
-
import { makeStaticStyles, makeStyles, shorthands, tokens, useId, Dropdown, Option, Input, Button, Popover, PopoverTrigger, PopoverSurface, MenuGroupHeader, Checkbox, Divider,
|
|
6
|
+
import { makeStaticStyles, makeStyles, shorthands, tokens, useId, Dropdown, Option, Input, Button, Popover, PopoverTrigger, PopoverSurface, MenuGroupHeader, Checkbox, Divider, MenuList, MenuItem, RadioGroup, Radio, Field, InlineDrawer, DrawerHeader, DrawerHeaderTitle, DrawerBody, Caption1Stronger, Menu, MenuTrigger, MenuButton, MenuPopover, MenuGroup, MenuDivider, mergeClasses, Skeleton, SkeletonItem, Subtitle2Stronger } from '@fluentui/react-components';
|
|
7
7
|
import { PreviousRegular, ArrowPreviousFilled, ArrowNextFilled, NextRegular, bundleIcon, SaveFilled, SaveRegular, TableSimpleCheckmarkFilled, TableSimpleCheckmarkRegular, SearchFilled, SearchRegular, FilterFilled, FilterRegular, CodeTextOff16Filled, CodeTextOff16Regular, ColumnEditFilled, ColumnEditRegular, GroupFilled, GroupRegular, ChevronRightFilled, ChevronRightRegular, ChevronDownRegular, ChevronDownFilled, DragFilled, DragRegular, TextGrammarDismissRegular, Search24Regular, FilterDismissFilled, Dismiss24Regular, ArrowSortDown20Filled, ArrowSortDown20Regular, ArrowSortUp20Filled, ArrowSortUp20Regular, GroupListRegular, PinRegular, TextSortAscendingFilled, TextSortDescendingFilled, GroupDismissFilled, ArrowStepInLeftRegular, ArrowStepInRightRegular, PinOffRegular, DocumentSearch24Regular } from '@fluentui/react-icons';
|
|
8
8
|
import { useReactTable, getCoreRowModel, getPaginationRowModel, getSortedRowModel, getFilteredRowModel, getGroupedRowModel, getExpandedRowModel, getFacetedUniqueValues, getFacetedMinMaxValues, flexRender } from '@tanstack/react-table';
|
|
9
9
|
export { createColumnHelper } from '@tanstack/react-table';
|
|
@@ -177,18 +177,16 @@ const GridHeader = (props) => {
|
|
|
177
177
|
return null;
|
|
178
178
|
if (column.id === 'id')
|
|
179
179
|
return null;
|
|
180
|
-
return (jsx(Checkbox, { checked: column.getIsGrouped(), onChange: column.getToggleGroupingHandler(), disabled: !column.getCanGroup(), label: jsx("span", { children: column.id }) }, column.id));
|
|
180
|
+
return (jsx(Checkbox, { checked: column.getIsGrouped(), onChange: column.getToggleGroupingHandler(), disabled: !column.getCanGroup() || !column.getIsVisible(), label: jsx("span", { children: column.columnDef.id }) }, column.id));
|
|
181
181
|
})] })) })] })), jsxs(Popover, Object.assign({ withArrow: true }, { children: [jsx(PopoverTrigger, Object.assign({ disableButtonEnhancement: true }, { children: jsx(Button, { icon: jsx(ToggleSelectColumnIcon, {}), "aria-label": "Toggle Column Visibility" }) })), jsx(PopoverSurface, { children: jsxs("div", Object.assign({ className: styles.tableTopHeaderColumnTogglePopover }, { children: [jsx(MenuGroupHeader, { children: "Toggle Columns" }), jsx(Checkbox, { checked: table.getIsAllColumnsVisible(), onChange: table.getToggleAllColumnsVisibilityHandler(), label: 'Toggle All' }), jsx(Divider, {}), table.getAllLeafColumns().map((column) => {
|
|
182
182
|
if (column.id === 'select')
|
|
183
183
|
return null;
|
|
184
|
-
if (column.id === 'id')
|
|
185
|
-
return null;
|
|
186
184
|
return (jsx(Checkbox, { checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler(), label: column.id, disabled: !column.getCanHide() }, column.id));
|
|
187
|
-
})] })) })] })), jsxs(
|
|
185
|
+
})] })) })] })), jsxs(Popover, Object.assign({ withArrow: true }, { children: [jsx(PopoverTrigger, Object.assign({ disableButtonEnhancement: true }, { children: jsx(Button
|
|
188
186
|
// appearance="subtle"
|
|
189
187
|
, {
|
|
190
188
|
// appearance="subtle"
|
|
191
|
-
icon: jsx(TextGrammarDismissRegular, {}), "aria-label": "View Menu" }) })), jsx(
|
|
189
|
+
icon: jsx(TextGrammarDismissRegular, {}), "aria-label": "View Menu" }) })), jsx(PopoverSurface, { children: jsxs(MenuList, { children: [jsx(MenuItem, Object.assign({ icon: jsx(ClearFilterIcon, {}), onClick: resetAllFilters }, { children: "Clear All Filters" })), jsx(MenuItem, Object.assign({ icon: jsx(ClearFilterIcon, {}), onClick: resetAllGrouping }, { children: "Clear All Grouping" })), jsx(MenuItem, Object.assign({ icon: jsx(ClearFilterIcon, {}), onClick: clearAllSelection }, { children: "Clear All Selection" }))] }) })] })), 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...", openFilterDrawer: props.openFilterDrawer, setFilterDrawerOpen: props.setFilterDrawerOpen })] }))] })));
|
|
192
190
|
};
|
|
193
191
|
// A debounced input react component
|
|
194
192
|
function DebouncedInput({ value: initialValue, onChange, debounce = 500, openFilterDrawer, setFilterDrawerOpen, }) {
|
|
@@ -202,7 +200,7 @@ function DebouncedInput({ value: initialValue, onChange, debounce = 500, openFil
|
|
|
202
200
|
}, debounce);
|
|
203
201
|
return () => clearTimeout(timeout);
|
|
204
202
|
}, [value, onChange, debounce]);
|
|
205
|
-
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(Button, { appearance: "subtle", icon: openFilterDrawer ? jsx(FilterDismissFilled, {}) : jsx(FilterFilled, {}), "aria-label": "View Menu", onClick: () => {
|
|
203
|
+
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(Button, { appearance: "subtle", title: 'Ad', icon: openFilterDrawer ? jsx(FilterDismissFilled, {}) : jsx(FilterFilled, {}), "aria-label": "View Menu", onClick: () => {
|
|
206
204
|
setFilterDrawerOpen((open) => !open);
|
|
207
205
|
} }) }));
|
|
208
206
|
}
|
|
@@ -212,10 +210,19 @@ const arrIncludesSome = (row, columnId, value) => {
|
|
|
212
210
|
const rowValue = row.getValue(columnId);
|
|
213
211
|
const passed = Array.isArray(value) &&
|
|
214
212
|
((value === null || value === void 0 ? void 0 : value.length) === 0 || value.includes(`${rowValue}`));
|
|
215
|
-
// console.log("rowValue", rowValue, "value", value, "passed", passed, "columnId", columnId)
|
|
216
|
-
// Return if the item should be filtered in/out
|
|
217
213
|
return passed;
|
|
218
214
|
};
|
|
215
|
+
const getLeafColumns = (columns) => {
|
|
216
|
+
if (!columns || !columns.length) {
|
|
217
|
+
return [];
|
|
218
|
+
}
|
|
219
|
+
return columns.reduce((totalItems, col) => {
|
|
220
|
+
if (!col.columns) {
|
|
221
|
+
totalItems.push(col);
|
|
222
|
+
}
|
|
223
|
+
return totalItems.concat(getLeafColumns(col.columns));
|
|
224
|
+
}, []);
|
|
225
|
+
};
|
|
219
226
|
const useGridContainer = (props, ref) => {
|
|
220
227
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
221
228
|
const { columns, data, rowSelectionMode } = props;
|
|
@@ -225,11 +232,17 @@ const useGridContainer = (props, ref) => {
|
|
|
225
232
|
});
|
|
226
233
|
const [sorting, setSorting] = React.useState((_a = props.sortingState) !== null && _a !== void 0 ? _a : []);
|
|
227
234
|
const [columnFilters, setColumnFilters] = React.useState((_b = props.columnFilterState) !== null && _b !== void 0 ? _b : []);
|
|
228
|
-
const [globalFilter, setGlobalFilter] = React.useState((_c = props.defaultGlobalFilter) !== null && _c !== void 0 ? _c :
|
|
235
|
+
const [globalFilter, setGlobalFilter] = React.useState((_c = props.defaultGlobalFilter) !== null && _c !== void 0 ? _c : '');
|
|
229
236
|
const [grouping, setGrouping] = React.useState((_d = props.groupingState) !== null && _d !== void 0 ? _d : []);
|
|
230
237
|
const [rowSelection, setRowSelection] = React.useState((_e = props.rowSelectionState) !== null && _e !== void 0 ? _e : {});
|
|
231
238
|
const [columnVisibility, setColumnVisibility] = React.useState((_f = props.columnVisibility) !== null && _f !== void 0 ? _f : {});
|
|
232
|
-
const [columnOrder, setColumnOrder] = React.useState(() => {
|
|
239
|
+
const [columnOrder, setColumnOrder] = React.useState(() => {
|
|
240
|
+
if (props.columnOrderState) {
|
|
241
|
+
return props.columnOrderState;
|
|
242
|
+
}
|
|
243
|
+
const leafColumns = getLeafColumns(columns);
|
|
244
|
+
return leafColumns.map((col) => col.id);
|
|
245
|
+
});
|
|
233
246
|
const [expanded, setExpanded] = React.useState((_g = props.expandedState) !== null && _g !== void 0 ? _g : {});
|
|
234
247
|
const [columnPinning, setColumnPinning] = React.useState((_h = props.columnPinningState) !== null && _h !== void 0 ? _h : {});
|
|
235
248
|
const table = useReactTable({
|
|
@@ -305,6 +318,51 @@ const useGridContainer = (props, ref) => {
|
|
|
305
318
|
columnVisibility,
|
|
306
319
|
columnPinning,
|
|
307
320
|
]);
|
|
321
|
+
const resetToDefaultView = () => {
|
|
322
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
323
|
+
setSorting((_a = props.sortingState) !== null && _a !== void 0 ? _a : []);
|
|
324
|
+
setColumnFilters((_b = props.columnFilterState) !== null && _b !== void 0 ? _b : []);
|
|
325
|
+
setGlobalFilter((_c = props.defaultGlobalFilter) !== null && _c !== void 0 ? _c : '');
|
|
326
|
+
setGrouping((_d = props.groupingState) !== null && _d !== void 0 ? _d : []);
|
|
327
|
+
setExpanded((_e = props.expandedState) !== null && _e !== void 0 ? _e : {});
|
|
328
|
+
setRowSelection((_f = props.rowSelectionState) !== null && _f !== void 0 ? _f : {});
|
|
329
|
+
setColumnOrder(() => {
|
|
330
|
+
if (props.columnOrderState) {
|
|
331
|
+
return props.columnOrderState;
|
|
332
|
+
}
|
|
333
|
+
const leafColumns = getLeafColumns(columns);
|
|
334
|
+
return leafColumns.map((col) => col.id);
|
|
335
|
+
});
|
|
336
|
+
setColumnVisibility((_g = props.columnVisibility) !== null && _g !== void 0 ? _g : {});
|
|
337
|
+
setColumnPinning((_h = props.columnPinningState) !== null && _h !== void 0 ? _h : {});
|
|
338
|
+
setTimeout(() => {
|
|
339
|
+
setPagination({
|
|
340
|
+
pageSize: props.pageSize || 10,
|
|
341
|
+
pageIndex: 0,
|
|
342
|
+
});
|
|
343
|
+
}, 10);
|
|
344
|
+
return true;
|
|
345
|
+
};
|
|
346
|
+
const applySavedView = (viewName) => {
|
|
347
|
+
const tableStateString = localStorage.getItem(viewName);
|
|
348
|
+
if (tableStateString) {
|
|
349
|
+
const tableState = JSON.parse(tableStateString);
|
|
350
|
+
setSorting(tableState.sorting);
|
|
351
|
+
setColumnFilters(tableState.columnFilters);
|
|
352
|
+
setGlobalFilter(tableState.globalFilter);
|
|
353
|
+
setGrouping(tableState.grouping);
|
|
354
|
+
setExpanded(tableState.expanded);
|
|
355
|
+
setRowSelection(tableState.rowSelection);
|
|
356
|
+
setColumnOrder(tableState.columnOrder);
|
|
357
|
+
setColumnVisibility(tableState.columnVisibility);
|
|
358
|
+
setColumnPinning(tableState.columnPinning);
|
|
359
|
+
setTimeout(() => {
|
|
360
|
+
setPagination(tableState.pagination);
|
|
361
|
+
}, 10);
|
|
362
|
+
return true;
|
|
363
|
+
}
|
|
364
|
+
return false;
|
|
365
|
+
};
|
|
308
366
|
React.useImperativeHandle(ref, () => {
|
|
309
367
|
return {
|
|
310
368
|
table,
|
|
@@ -315,28 +373,12 @@ const useGridContainer = (props, ref) => {
|
|
|
315
373
|
localStorage.setItem(viewName, tableStateString);
|
|
316
374
|
return true;
|
|
317
375
|
},
|
|
318
|
-
applySavedView:
|
|
319
|
-
|
|
320
|
-
if (tableStateString) {
|
|
321
|
-
const tableState = JSON.parse(tableStateString);
|
|
322
|
-
setSorting(tableState.sorting);
|
|
323
|
-
setColumnFilters(tableState.columnFilters);
|
|
324
|
-
setGlobalFilter(tableState.globalFilter);
|
|
325
|
-
setGrouping(tableState.grouping);
|
|
326
|
-
setExpanded(tableState.expanded);
|
|
327
|
-
setRowSelection(tableState.rowSelection);
|
|
328
|
-
setColumnOrder(tableState.columnOrder);
|
|
329
|
-
setColumnVisibility(tableState.columnVisibility);
|
|
330
|
-
setColumnPinning(tableState.columnPinning);
|
|
331
|
-
setTimeout(() => {
|
|
332
|
-
setPagination(tableState.pagination);
|
|
333
|
-
}, 10);
|
|
334
|
-
return true;
|
|
335
|
-
}
|
|
336
|
-
return false;
|
|
337
|
-
},
|
|
376
|
+
applySavedView: applySavedView,
|
|
377
|
+
resetToDefaultView: resetToDefaultView,
|
|
338
378
|
};
|
|
339
|
-
},
|
|
379
|
+
},
|
|
380
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
381
|
+
[table, getTableState]);
|
|
340
382
|
return {
|
|
341
383
|
table,
|
|
342
384
|
globalFilter,
|
|
@@ -406,7 +448,7 @@ const FilterMultiSelectCheckbox = ({ column, table, }) => {
|
|
|
406
448
|
: (columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) === (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) &&
|
|
407
449
|
(filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.length) > 0;
|
|
408
450
|
const styles = useCheckboxFilterStyles();
|
|
409
|
-
return (jsxs("div", { children: [jsx(Input, { value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsxs("div", Object.assign({ ref: filterContainer, className: styles.searchContainer }, { children: [paddingTop > 0 && (jsx("span", { style: { paddingTop: `${paddingTop}px` } })), jsx(Checkbox, { checked: allOptionChecked, onChange: () => {
|
|
451
|
+
return (jsxs("div", { children: [jsx(Input, { type: 'search', value: localColumnFilterValue, onChange: (_, data) => setLocalColumnFilterValue(data.value), placeholder: "Search Options...", size: "small", className: styles.searchInput }), jsxs("div", Object.assign({ ref: filterContainer, className: styles.searchContainer }, { children: [paddingTop > 0 && (jsx("span", { style: { paddingTop: `${paddingTop}px` } })), jsx(Checkbox, { checked: allOptionChecked, onChange: () => {
|
|
410
452
|
if ((columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue.length) > 0) {
|
|
411
453
|
column.setFilterValue(undefined);
|
|
412
454
|
return;
|
|
@@ -451,7 +493,7 @@ const useRadioFilterStyles = makeStyles({
|
|
|
451
493
|
'background-color': '#555',
|
|
452
494
|
} }),
|
|
453
495
|
});
|
|
454
|
-
const
|
|
496
|
+
const FilterSelectRadio = ({ column, table, }) => {
|
|
455
497
|
var _a, _b, _c;
|
|
456
498
|
const firstValue = (_a = table
|
|
457
499
|
.getPreFilteredRowModel()
|
|
@@ -459,8 +501,8 @@ const FilterMultiSelectRadio = ({ column, table }) => {
|
|
|
459
501
|
const columnFilterValue = column.getFilterValue();
|
|
460
502
|
const [filterOptions, setFilterOptions] = React.useState([]);
|
|
461
503
|
React.useEffect(() => {
|
|
462
|
-
const uniqueSortedOptions = typeof firstValue ===
|
|
463
|
-
Array.from(column.getFacetedUniqueValues().keys()).sort((a, b) => Number(a) - Number(b))
|
|
504
|
+
const uniqueSortedOptions = typeof firstValue === 'number' || !isNaN(firstValue)
|
|
505
|
+
? Array.from(column.getFacetedUniqueValues().keys()).sort((a, b) => Number(a) - Number(b))
|
|
464
506
|
: Array.from(column.getFacetedUniqueValues().keys()).sort();
|
|
465
507
|
setFilterOptions(uniqueSortedOptions);
|
|
466
508
|
},
|
|
@@ -499,9 +541,57 @@ const FilterMultiSelectRadio = ({ column, table }) => {
|
|
|
499
541
|
})] })), paddingBottom > 0 && (jsx("div", { style: { paddingBottom: `${paddingBottom}px` } }))] }))] }));
|
|
500
542
|
};
|
|
501
543
|
|
|
544
|
+
const useNumberRangeFilterStyles = makeStyles({
|
|
545
|
+
searchInput: {
|
|
546
|
+
width: '100%',
|
|
547
|
+
},
|
|
548
|
+
searchInputField: {
|
|
549
|
+
width: '100%',
|
|
550
|
+
flexGrow: 1,
|
|
551
|
+
},
|
|
552
|
+
searchContainer: {
|
|
553
|
+
display: 'flex',
|
|
554
|
+
marginBottom: '8px',
|
|
555
|
+
marginLeft: '10px',
|
|
556
|
+
marginRight: '10px',
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
const FilterNumberRange = (props) => {
|
|
560
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
561
|
+
const { column } = props;
|
|
562
|
+
const columnFilterValue = column.getFilterValue();
|
|
563
|
+
const min = Number((_b = (_a = column.getFacetedMinMaxValues()) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '');
|
|
564
|
+
const max = Number((_d = (_c = column.getFacetedMinMaxValues()) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : '');
|
|
565
|
+
const handleMinChange = (e, data) => {
|
|
566
|
+
const value = Number(data.value);
|
|
567
|
+
column.setFilterValue((old) => [value, old === null || old === void 0 ? void 0 : old[1]]);
|
|
568
|
+
};
|
|
569
|
+
const handleMaxChange = (e, data) => {
|
|
570
|
+
const value = Number(data.value);
|
|
571
|
+
column.setFilterValue((old) => [old === null || old === void 0 ? void 0 : old[0], value]);
|
|
572
|
+
};
|
|
573
|
+
const styles = useNumberRangeFilterStyles();
|
|
574
|
+
return (jsxs("div", Object.assign({ className: styles.searchContainer }, { children: [jsx(Field, Object.assign({ label: 'Min:', size: "small", className: styles.searchInputField }, { children: jsx(Input, { type: "number", value: `${(columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[0]) || ''}`, min: min, max: max, onChange: handleMinChange, className: styles.searchInput, placeholder: `Min ${((_e = column.getFacetedMinMaxValues()) === null || _e === void 0 ? void 0 : _e[0])
|
|
575
|
+
? `(${(_f = column.getFacetedMinMaxValues()) === null || _f === void 0 ? void 0 : _f[0]})`
|
|
576
|
+
: ''}` }) })), jsx(Field, Object.assign({ label: 'Max:', size: "small", className: styles.searchInputField }, { children: jsx(Input, { type: "number", value: `${(columnFilterValue === null || columnFilterValue === void 0 ? void 0 : columnFilterValue[1]) || ''}`, min: min, max: max, onChange: handleMaxChange, className: styles.searchInput, placeholder: `Max ${((_g = column.getFacetedMinMaxValues()) === null || _g === void 0 ? void 0 : _g[1])
|
|
577
|
+
? `(${(_h = column.getFacetedMinMaxValues()) === null || _h === void 0 ? void 0 : _h[1]})`
|
|
578
|
+
: ''}` }) }))] })));
|
|
579
|
+
};
|
|
580
|
+
|
|
502
581
|
const useFilterStyles = makeStyles({
|
|
503
|
-
|
|
504
|
-
|
|
582
|
+
searchInput: {
|
|
583
|
+
width: '100%',
|
|
584
|
+
},
|
|
585
|
+
searchInputField: {
|
|
586
|
+
width: '100%',
|
|
587
|
+
flexGrow: 1,
|
|
588
|
+
},
|
|
589
|
+
searchContainer: {
|
|
590
|
+
display: 'flex',
|
|
591
|
+
marginBottom: '8px',
|
|
592
|
+
marginLeft: '10px',
|
|
593
|
+
marginRight: '10px',
|
|
594
|
+
},
|
|
505
595
|
});
|
|
506
596
|
const Filter = ({ column, table, }) => {
|
|
507
597
|
const filterFunctionName = column.columnDef.filterFn;
|
|
@@ -511,13 +601,14 @@ const Filter = ({ column, table, }) => {
|
|
|
511
601
|
case 'arrIncludesSome':
|
|
512
602
|
return jsx(FilterMultiSelectCheckbox, { column: column, table: table });
|
|
513
603
|
case 'arrIncludesAll':
|
|
514
|
-
return jsx(FilterMultiSelectRadio, { column: column, table: table });
|
|
515
604
|
case 'arrIncludes':
|
|
516
|
-
return jsx(
|
|
605
|
+
return jsx(FilterSelectRadio, { column: column, table: table });
|
|
606
|
+
case 'inNumberRange':
|
|
607
|
+
return jsx(FilterNumberRange, { column: column, table: table });
|
|
517
608
|
}
|
|
518
|
-
return (jsx("div", Object.assign({ className: styles.
|
|
519
|
-
|
|
520
|
-
|
|
609
|
+
return (jsx("div", Object.assign({ className: styles.searchContainer }, { children: jsx(Field, Object.assign({ size: 'small', className: styles.searchInputField }, { children: jsx(Input, { value: (column.getFilterValue() || ''), onChange: (_, data) => {
|
|
610
|
+
column.setFilterValue(data.value);
|
|
611
|
+
}, placeholder: "Search Keyword...", size: "small", className: styles.searchInput }) })) })));
|
|
521
612
|
};
|
|
522
613
|
|
|
523
614
|
const useFilterDrawerStyles = makeStyles({
|
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Column, Table } from '@tanstack/react-table';
|
|
2
|
+
type FilterNumberRangeProps<TItem extends object> = {
|
|
3
|
+
column: Column<TItem, unknown>;
|
|
4
|
+
table: Table<TItem>;
|
|
5
|
+
};
|
|
6
|
+
export declare const FilterNumberRange: <TItem extends object>(props: FilterNumberRangeProps<TItem>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Column, Table } from "@tanstack/react-table";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const FilterSelectRadio: <TItem extends object>({ column, table, }: {
|
|
3
3
|
column: Column<TItem, unknown>;
|
|
4
4
|
table: Table<TItem>;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TableProps } from
|
|
2
|
-
import { TableRef } from
|
|
3
|
-
import * as React from
|
|
1
|
+
import { TableProps } from '..';
|
|
2
|
+
import { TableRef } from '../types';
|
|
3
|
+
import * as React from 'react';
|
|
4
4
|
export declare const useGridContainer: <TItem extends object>(props: TableProps<TItem>, ref: React.ForwardedRef<TableRef<TItem>>) => {
|
|
5
5
|
table: import("@tanstack/react-table").Table<TItem>;
|
|
6
6
|
globalFilter: string;
|