material-react-table 0.5.7 → 0.6.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/dist/MaterialReactTable.d.ts +8 -2
- package/dist/body/MRT_TableBodyCell.d.ts +1 -1
- package/dist/body/MRT_TableBodyRow.d.ts +1 -1
- package/dist/body/MRT_TableDetailPanel.d.ts +1 -1
- package/dist/buttons/MRT_EditActionButtons.d.ts +1 -1
- package/dist/buttons/MRT_ExpandButton.d.ts +1 -1
- package/dist/buttons/MRT_ToggleColumnActionMenuButton.d.ts +1 -1
- package/dist/buttons/MRT_ToggleRowActionMenuButton.d.ts +1 -1
- package/dist/enums.d.ts +12 -0
- package/dist/filtersFNs.d.ts +20 -0
- package/dist/footer/MRT_TableFooterCell.d.ts +1 -1
- package/dist/footer/MRT_TableFooterRow.d.ts +1 -1
- package/dist/head/MRT_TableHeadCell.d.ts +1 -1
- package/dist/head/MRT_TableHeadRow.d.ts +1 -1
- package/dist/inputs/MRT_EditCellTextField.d.ts +1 -1
- package/dist/inputs/MRT_FilterTextField.d.ts +1 -1
- package/dist/inputs/MRT_SelectCheckbox.d.ts +1 -1
- package/dist/localization.d.ts +44 -44
- package/dist/material-react-table.cjs.development.js +569 -360
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +570 -361
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/menus/MRT_ColumnActionMenu.d.ts +9 -2
- package/dist/menus/MRT_FilterTypeMenu.d.ts +1 -1
- package/dist/menus/MRT_RowActionMenu.d.ts +1 -1
- package/dist/menus/MRT_ShowHideColumnsMenu.d.ts +3 -2
- package/dist/menus/MRT_ShowHideColumnsMenuItems.d.ts +8 -0
- package/dist/useMRT.d.ts +1 -1
- package/package.json +2 -2
- package/src/MaterialReactTable.tsx +5 -9
- package/src/body/MRT_TableBody.tsx +1 -1
- package/src/body/MRT_TableBodyCell.tsx +1 -1
- package/src/body/MRT_TableBodyRow.tsx +1 -1
- package/src/body/MRT_TableDetailPanel.tsx +1 -1
- package/src/buttons/MRT_EditActionButtons.tsx +5 -8
- package/src/buttons/MRT_ExpandAllButton.tsx +2 -2
- package/src/buttons/MRT_ExpandButton.tsx +3 -3
- package/src/buttons/MRT_FullScreenToggleButton.tsx +2 -2
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +4 -55
- package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +4 -3
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +2 -2
- package/src/buttons/MRT_ToggleFiltersButton.tsx +2 -2
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +4 -8
- package/src/buttons/MRT_ToggleSearchButton.tsx +1 -1
- package/src/enums.ts +12 -0
- package/src/filtersFNs.ts +42 -0
- package/src/footer/MRT_TableFooter.tsx +1 -1
- package/src/footer/MRT_TableFooterCell.tsx +1 -1
- package/src/footer/MRT_TableFooterRow.tsx +1 -1
- package/src/head/MRT_TableHead.tsx +1 -1
- package/src/head/MRT_TableHeadCell.tsx +22 -18
- package/src/head/MRT_TableHeadCellActions.tsx +1 -1
- package/src/head/MRT_TableHeadRow.tsx +1 -1
- package/src/inputs/MRT_EditCellTextField.tsx +1 -1
- package/src/inputs/MRT_FilterTextField.tsx +99 -21
- package/src/inputs/MRT_SearchTextField.tsx +3 -3
- package/src/inputs/MRT_SelectCheckbox.tsx +5 -5
- package/src/localization.ts +89 -88
- package/src/menus/MRT_ColumnActionMenu.tsx +109 -56
- package/src/menus/MRT_FilterTypeMenu.tsx +63 -26
- package/src/menus/MRT_RowActionMenu.tsx +4 -10
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +54 -33
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +57 -0
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +3 -3
- package/src/useMRT.tsx +36 -14
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useMemo, useContext, createContext, Fragment, useRef, useEffect } from 'react';
|
|
2
2
|
import { useTable, useFilters, useGlobalFilter, useGroupBy, useSortBy, useExpanded, usePagination, useRowSelect, useResizeColumns, useFlexLayout, useAsyncDebounce } from 'react-table';
|
|
3
3
|
import { matchSorter } from 'match-sorter';
|
|
4
|
-
import { Menu, MenuItem,
|
|
4
|
+
import { Menu, MenuItem, TextField, InputAdornment, Tooltip, IconButton, Chip, FormControlLabel, Switch, Box, Button, Divider, TableCell, TableSortLabel, Collapse, Skeleton, Checkbox, TableRow, TableHead, alpha, TableBody, TableFooter, Table, TablePagination, useMediaQuery, Alert, Toolbar, TableContainer, Paper, LinearProgress } from '@mui/material';
|
|
5
5
|
import ArrowRightIcon from '@mui/icons-material/ArrowRight';
|
|
6
6
|
import CancelIcon from '@mui/icons-material/Cancel';
|
|
7
7
|
import ClearAllIcon from '@mui/icons-material/ClearAll';
|
|
@@ -160,6 +160,26 @@ notEqualsFilterFN.autoRemove = function (val) {
|
|
|
160
160
|
return !val;
|
|
161
161
|
};
|
|
162
162
|
|
|
163
|
+
var greaterThanFilterFN = function greaterThanFilterFN(rows, id, filterValue) {
|
|
164
|
+
return rows.filter(function (row) {
|
|
165
|
+
return !isNaN(+filterValue) && !isNaN(+row.values[id]) ? +row.values[id] > +filterValue : row.values[id].toString().toLowerCase().trim() > filterValue.toString().toLowerCase().trim();
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
greaterThanFilterFN.autoRemove = function (val) {
|
|
170
|
+
return !val;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
var lessThanFilterFN = function lessThanFilterFN(rows, id, filterValue) {
|
|
174
|
+
return rows.filter(function (row) {
|
|
175
|
+
return !isNaN(+filterValue) && !isNaN(+row.values[id]) ? +row.values[id] < +filterValue : row.values[id].toString().toLowerCase().trim() < filterValue.toString().toLowerCase().trim();
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
lessThanFilterFN.autoRemove = function (val) {
|
|
180
|
+
return !val;
|
|
181
|
+
};
|
|
182
|
+
|
|
163
183
|
var emptyFilterFN = function emptyFilterFN(rows, id, _filterValue) {
|
|
164
184
|
return rows.filter(function (row) {
|
|
165
185
|
return !row.values[id].toString().toLowerCase().trim();
|
|
@@ -184,6 +204,8 @@ var defaultFilterFNs = {
|
|
|
184
204
|
contains: containsFilterFN,
|
|
185
205
|
empty: emptyFilterFN,
|
|
186
206
|
endsWith: endsWithFilterFN,
|
|
207
|
+
greaterThan: greaterThanFilterFN,
|
|
208
|
+
lessThan: lessThanFilterFN,
|
|
187
209
|
equals: equalsFilterFN,
|
|
188
210
|
fuzzy: fuzzyFilterFN,
|
|
189
211
|
notEmpty: notEmptyFilterFN,
|
|
@@ -225,16 +247,40 @@ var MaterialReactTableProvider = function MaterialReactTableProvider(props) {
|
|
|
225
247
|
return _extends({}, defaultFilterFNs, props.filterTypes);
|
|
226
248
|
}, [props.filterTypes]);
|
|
227
249
|
|
|
228
|
-
var
|
|
229
|
-
|
|
230
|
-
|
|
250
|
+
var getInitialFilterTypeState = function getInitialFilterTypeState() {
|
|
251
|
+
var lowestLevelColumns = props.columns;
|
|
252
|
+
var currentCols = props.columns;
|
|
253
|
+
|
|
254
|
+
while (!!currentCols.length && currentCols.some(function (col) {
|
|
255
|
+
return col.columns;
|
|
256
|
+
})) {
|
|
257
|
+
var nextCols = currentCols.filter(function (col) {
|
|
258
|
+
return !!col.columns;
|
|
259
|
+
}).map(function (col) {
|
|
260
|
+
return col.columns;
|
|
261
|
+
}).flat();
|
|
262
|
+
|
|
263
|
+
if (nextCols.every(function (col) {
|
|
264
|
+
return !col.columns;
|
|
265
|
+
})) {
|
|
266
|
+
lowestLevelColumns = [].concat(lowestLevelColumns, nextCols);
|
|
267
|
+
}
|
|
231
268
|
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
var _props$initialState$f2, _props$initialState5, _props$initialState5$, _ref;
|
|
269
|
+
currentCols = nextCols;
|
|
270
|
+
}
|
|
235
271
|
|
|
236
|
-
|
|
272
|
+
lowestLevelColumns = lowestLevelColumns.filter(function (col) {
|
|
273
|
+
return !col.columns;
|
|
274
|
+
});
|
|
275
|
+
return Object.assign.apply(Object, [{}].concat(lowestLevelColumns.map(function (c) {
|
|
276
|
+
var _ref, _c$filter, _props$initialState5, _props$initialState5$, _ref2;
|
|
277
|
+
|
|
278
|
+
return _ref2 = {}, _ref2[c.accessor] = (_ref = (_c$filter = c.filter) != null ? _c$filter : props == null ? void 0 : (_props$initialState5 = props.initialState) == null ? void 0 : (_props$initialState5$ = _props$initialState5.filters) == null ? void 0 : _props$initialState5$[c.accessor]) != null ? _ref : !!c.filterSelectOptions ? 'equals' : 'fuzzy', _ref2;
|
|
237
279
|
})));
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
var _useState6 = useState(function () {
|
|
283
|
+
return getInitialFilterTypeState();
|
|
238
284
|
}),
|
|
239
285
|
currentFilterTypes = _useState6[0],
|
|
240
286
|
setCurrentFilterTypes = _useState6[1];
|
|
@@ -249,6 +295,7 @@ var MaterialReactTableProvider = function MaterialReactTableProvider(props) {
|
|
|
249
295
|
columns: columns,
|
|
250
296
|
// @ts-ignore
|
|
251
297
|
filterTypes: filterTypes,
|
|
298
|
+
globalFilterValue: 'fuzzy',
|
|
252
299
|
useControlledState: function useControlledState(state) {
|
|
253
300
|
return useMemo(function () {
|
|
254
301
|
return _extends({}, state, {
|
|
@@ -298,151 +345,26 @@ var useMRT = function useMRT() {
|
|
|
298
345
|
return useContext(MaterialReactTableContext);
|
|
299
346
|
};
|
|
300
347
|
|
|
301
|
-
var
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
disableSortBy = _useMRT.disableSortBy,
|
|
316
|
-
enableColumnGrouping = _useMRT.enableColumnGrouping,
|
|
317
|
-
_useMRT$icons = _useMRT.icons,
|
|
318
|
-
ArrowRightIcon = _useMRT$icons.ArrowRightIcon,
|
|
319
|
-
ClearAllIcon = _useMRT$icons.ClearAllIcon,
|
|
320
|
-
DynamicFeedIcon = _useMRT$icons.DynamicFeedIcon,
|
|
321
|
-
FilterListIcon = _useMRT$icons.FilterListIcon,
|
|
322
|
-
SortIcon = _useMRT$icons.SortIcon,
|
|
323
|
-
VisibilityOffIcon = _useMRT$icons.VisibilityOffIcon,
|
|
324
|
-
idPrefix = _useMRT.idPrefix,
|
|
325
|
-
localization = _useMRT.localization,
|
|
326
|
-
setShowFilters = _useMRT.setShowFilters,
|
|
327
|
-
tableInstance = _useMRT.tableInstance;
|
|
348
|
+
var MRT_FILTER_TYPE;
|
|
349
|
+
|
|
350
|
+
(function (MRT_FILTER_TYPE) {
|
|
351
|
+
MRT_FILTER_TYPE["CONTAINS"] = "contains";
|
|
352
|
+
MRT_FILTER_TYPE["EMPTY"] = "empty";
|
|
353
|
+
MRT_FILTER_TYPE["ENDS_WITH"] = "endsWith";
|
|
354
|
+
MRT_FILTER_TYPE["EQUALS"] = "equals";
|
|
355
|
+
MRT_FILTER_TYPE["FUZZY"] = "fuzzy";
|
|
356
|
+
MRT_FILTER_TYPE["GREATER_THAN"] = "greaterThan";
|
|
357
|
+
MRT_FILTER_TYPE["LESS_THAN"] = "lessThan";
|
|
358
|
+
MRT_FILTER_TYPE["NOT_EMPTY"] = "notEmpty";
|
|
359
|
+
MRT_FILTER_TYPE["NOT_EQUALS"] = "notEquals";
|
|
360
|
+
MRT_FILTER_TYPE["STARTS_WITH"] = "startsWith";
|
|
361
|
+
})(MRT_FILTER_TYPE || (MRT_FILTER_TYPE = {}));
|
|
328
362
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
var handleClearSort = function handleClearSort() {
|
|
334
|
-
column.clearSortBy();
|
|
335
|
-
setAnchorEl(null);
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
var handleSortAsc = function handleSortAsc() {
|
|
339
|
-
column.toggleSortBy(false);
|
|
340
|
-
setAnchorEl(null);
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
var handleSortDesc = function handleSortDesc() {
|
|
344
|
-
column.toggleSortBy(true);
|
|
345
|
-
setAnchorEl(null);
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
var handleHideColumn = function handleHideColumn() {
|
|
349
|
-
column.toggleHidden();
|
|
350
|
-
setAnchorEl(null);
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
var handleGroupByColumn = function handleGroupByColumn() {
|
|
354
|
-
column.toggleGroupBy();
|
|
355
|
-
setAnchorEl(null);
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
var handleFilterByColumn = function handleFilterByColumn() {
|
|
359
|
-
setShowFilters(true);
|
|
360
|
-
setTimeout(function () {
|
|
361
|
-
var _document$getElementB, _column$muiTableHeadC, _column$muiTableHeadC2;
|
|
362
|
-
|
|
363
|
-
return (_document$getElementB = document.getElementById( // @ts-ignore
|
|
364
|
-
(_column$muiTableHeadC = (_column$muiTableHeadC2 = column.muiTableHeadCellFilterTextFieldProps) == null ? void 0 : _column$muiTableHeadC2.id) != null ? _column$muiTableHeadC : "mrt-" + idPrefix + "-" + column.id + "-filter-text-field")) == null ? void 0 : _document$getElementB.focus();
|
|
365
|
-
}, 200);
|
|
366
|
-
setAnchorEl(null);
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
var handleOpenFilterModeMenu = function handleOpenFilterModeMenu(event) {
|
|
370
|
-
event.stopPropagation();
|
|
371
|
-
setFilterMenuAnchorEl(event.currentTarget);
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
return React.createElement(Menu, {
|
|
375
|
-
anchorEl: anchorEl,
|
|
376
|
-
open: !!anchorEl,
|
|
377
|
-
onClose: function onClose() {
|
|
378
|
-
return setAnchorEl(null);
|
|
379
|
-
},
|
|
380
|
-
MenuListProps: {
|
|
381
|
-
dense: tableInstance.state.densePadding,
|
|
382
|
-
disablePadding: true
|
|
383
|
-
}
|
|
384
|
-
}, !disableSortBy && column.canSort && [React.createElement(MenuItem, {
|
|
385
|
-
key: 1,
|
|
386
|
-
disabled: !column.isSorted,
|
|
387
|
-
onClick: handleClearSort,
|
|
388
|
-
sx: commonMenuItemStyles
|
|
389
|
-
}, React.createElement(ListItemIcon, null, React.createElement(ClearAllIcon, null)), React.createElement(ListItemText, {
|
|
390
|
-
sx: commonMenuItemStyles
|
|
391
|
-
}, localization.columnActionMenuItemClearSort)), React.createElement(MenuItem, {
|
|
392
|
-
disabled: column.isSorted && !column.isSortedDesc,
|
|
393
|
-
key: 2,
|
|
394
|
-
onClick: handleSortAsc,
|
|
395
|
-
sx: commonMenuItemStyles
|
|
396
|
-
}, React.createElement(ListItemIcon, null, React.createElement(SortIcon, null)), React.createElement(ListItemText, {
|
|
397
|
-
sx: commonMenuItemStyles
|
|
398
|
-
}, (_localization$columnA = localization.columnActionMenuItemSortAsc) == null ? void 0 : _localization$columnA.replace('{column}', String(column.Header)))), React.createElement(MenuItem, {
|
|
399
|
-
divider: !disableFilters || enableColumnGrouping || !disableColumnHiding,
|
|
400
|
-
key: 3,
|
|
401
|
-
disabled: column.isSorted && column.isSortedDesc,
|
|
402
|
-
onClick: handleSortDesc,
|
|
403
|
-
sx: commonMenuItemStyles
|
|
404
|
-
}, React.createElement(ListItemIcon, null, React.createElement(SortIcon, {
|
|
405
|
-
style: {
|
|
406
|
-
transform: 'rotate(180deg) scaleX(-1)'
|
|
407
|
-
}
|
|
408
|
-
})), React.createElement(ListItemText, {
|
|
409
|
-
sx: commonMenuItemStyles
|
|
410
|
-
}, (_localization$columnA2 = localization.columnActionMenuItemSortDesc) == null ? void 0 : _localization$columnA2.replace('{column}', String(column.Header))))], !disableFilters && column.canFilter && [React.createElement(MenuItem, {
|
|
411
|
-
divider: enableColumnGrouping || !disableColumnHiding,
|
|
412
|
-
key: 1,
|
|
413
|
-
onClick: handleFilterByColumn,
|
|
414
|
-
sx: commonMenuItemStyles
|
|
415
|
-
}, React.createElement(ListItemIcon, null, React.createElement(FilterListIcon, null)), React.createElement(ListItemText, {
|
|
416
|
-
sx: commonMenuItemStyles
|
|
417
|
-
}, (_localization$filterT = localization.filterTextFieldPlaceholder) == null ? void 0 : _localization$filterT.replace('{column}', String(column.Header))), React.createElement(IconButton, {
|
|
418
|
-
onClick: handleOpenFilterModeMenu,
|
|
419
|
-
onMouseEnter: handleOpenFilterModeMenu,
|
|
420
|
-
size: "small",
|
|
421
|
-
sx: {
|
|
422
|
-
p: 0
|
|
423
|
-
}
|
|
424
|
-
}, React.createElement(ArrowRightIcon, null))), React.createElement(MRT_FilterTypeMenu, {
|
|
425
|
-
anchorEl: filterMenuAnchorEl,
|
|
426
|
-
column: column,
|
|
427
|
-
key: 2,
|
|
428
|
-
setAnchorEl: setFilterMenuAnchorEl,
|
|
429
|
-
onSelect: handleFilterByColumn
|
|
430
|
-
})], enableColumnGrouping && column.canGroupBy && [React.createElement(MenuItem, {
|
|
431
|
-
divider: !disableColumnHiding,
|
|
432
|
-
key: 2,
|
|
433
|
-
onClick: handleGroupByColumn,
|
|
434
|
-
sx: commonMenuItemStyles
|
|
435
|
-
}, React.createElement(ListItemIcon, null, React.createElement(DynamicFeedIcon, null)), React.createElement(ListItemText, {
|
|
436
|
-
sx: commonMenuItemStyles
|
|
437
|
-
}, (_localization = localization[column.isGrouped ? 'columnActionMenuItemUnGroupBy' : 'columnActionMenuItemGroupBy']) == null ? void 0 : _localization.replace('{column}', String(column.Header))))], !disableColumnHiding && [React.createElement(MenuItem, {
|
|
438
|
-
key: 1,
|
|
439
|
-
onClick: handleHideColumn,
|
|
440
|
-
sx: commonMenuItemStyles
|
|
441
|
-
}, React.createElement(ListItemIcon, null, React.createElement(VisibilityOffIcon, null)), React.createElement(ListItemText, {
|
|
442
|
-
sx: commonMenuItemStyles
|
|
443
|
-
}, (_localization$columnA3 = localization.columnActionMenuItemHideColumn) == null ? void 0 : _localization$columnA3.replace('{column}', String(column.Header))))]);
|
|
363
|
+
var commonMenuItemStyles = {
|
|
364
|
+
py: '6px',
|
|
365
|
+
my: 0,
|
|
366
|
+
alignItems: 'center'
|
|
444
367
|
};
|
|
445
|
-
|
|
446
368
|
var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
|
|
447
369
|
var anchorEl = _ref.anchorEl,
|
|
448
370
|
column = _ref.column,
|
|
@@ -456,37 +378,55 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
|
|
|
456
378
|
|
|
457
379
|
var filterTypes = useMemo(function () {
|
|
458
380
|
return [{
|
|
459
|
-
type:
|
|
460
|
-
label: localization.
|
|
461
|
-
divider: false
|
|
381
|
+
type: MRT_FILTER_TYPE.FUZZY,
|
|
382
|
+
label: localization.filterFuzzy,
|
|
383
|
+
divider: false,
|
|
384
|
+
fn: fuzzyFilterFN
|
|
385
|
+
}, {
|
|
386
|
+
type: MRT_FILTER_TYPE.CONTAINS,
|
|
387
|
+
label: localization.filterContains,
|
|
388
|
+
divider: true,
|
|
389
|
+
fn: containsFilterFN
|
|
462
390
|
}, {
|
|
463
|
-
type:
|
|
464
|
-
label: localization.
|
|
465
|
-
divider:
|
|
391
|
+
type: MRT_FILTER_TYPE.STARTS_WITH,
|
|
392
|
+
label: localization.filterStartsWith,
|
|
393
|
+
divider: false,
|
|
394
|
+
fn: startsWithFilterFN
|
|
466
395
|
}, {
|
|
467
|
-
type:
|
|
468
|
-
label: localization.
|
|
469
|
-
divider:
|
|
396
|
+
type: MRT_FILTER_TYPE.ENDS_WITH,
|
|
397
|
+
label: localization.filterEndsWith,
|
|
398
|
+
divider: true,
|
|
399
|
+
fn: endsWithFilterFN
|
|
470
400
|
}, {
|
|
471
|
-
type:
|
|
472
|
-
label: localization.
|
|
473
|
-
divider:
|
|
401
|
+
type: MRT_FILTER_TYPE.EQUALS,
|
|
402
|
+
label: localization.filterEquals,
|
|
403
|
+
divider: false,
|
|
404
|
+
fn: equalsFilterFN
|
|
474
405
|
}, {
|
|
475
|
-
type:
|
|
476
|
-
label: localization.
|
|
477
|
-
divider:
|
|
406
|
+
type: MRT_FILTER_TYPE.NOT_EQUALS,
|
|
407
|
+
label: localization.filterNotEquals,
|
|
408
|
+
divider: true,
|
|
409
|
+
fn: notEqualsFilterFN
|
|
478
410
|
}, {
|
|
479
|
-
type:
|
|
480
|
-
label: localization.
|
|
481
|
-
divider:
|
|
411
|
+
type: MRT_FILTER_TYPE.GREATER_THAN,
|
|
412
|
+
label: localization.filterGreaterThan,
|
|
413
|
+
divider: false,
|
|
414
|
+
fn: greaterThanFilterFN
|
|
482
415
|
}, {
|
|
483
|
-
type:
|
|
484
|
-
label: localization.
|
|
485
|
-
divider:
|
|
416
|
+
type: MRT_FILTER_TYPE.LESS_THAN,
|
|
417
|
+
label: localization.filterLessThan,
|
|
418
|
+
divider: true,
|
|
419
|
+
fn: lessThanFilterFN
|
|
486
420
|
}, {
|
|
487
|
-
type:
|
|
488
|
-
label: localization.
|
|
489
|
-
divider: false
|
|
421
|
+
type: MRT_FILTER_TYPE.EMPTY,
|
|
422
|
+
label: localization.filterEmpty,
|
|
423
|
+
divider: false,
|
|
424
|
+
fn: emptyFilterFN
|
|
425
|
+
}, {
|
|
426
|
+
type: MRT_FILTER_TYPE.NOT_EMPTY,
|
|
427
|
+
label: localization.filterNotEmpty,
|
|
428
|
+
divider: false,
|
|
429
|
+
fn: notEmptyFilterFN
|
|
490
430
|
}];
|
|
491
431
|
}, []);
|
|
492
432
|
|
|
@@ -498,7 +438,7 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
|
|
|
498
438
|
return _extends({}, prev, (_extends2 = {}, _extends2[column.id] = value, _extends2));
|
|
499
439
|
});
|
|
500
440
|
|
|
501
|
-
if ([
|
|
441
|
+
if ([MRT_FILTER_TYPE.EMPTY, MRT_FILTER_TYPE.NOT_EMPTY].includes(value)) {
|
|
502
442
|
column.setFilter(' ');
|
|
503
443
|
}
|
|
504
444
|
|
|
@@ -517,28 +457,28 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
|
|
|
517
457
|
},
|
|
518
458
|
open: !!anchorEl,
|
|
519
459
|
MenuListProps: {
|
|
520
|
-
dense: tableInstance.state.densePadding
|
|
521
|
-
disablePadding: true
|
|
460
|
+
dense: tableInstance.state.densePadding
|
|
522
461
|
}
|
|
523
|
-
}, filterTypes.map(function (_ref2) {
|
|
462
|
+
}, filterTypes.map(function (_ref2, index) {
|
|
524
463
|
var type = _ref2.type,
|
|
525
464
|
label = _ref2.label,
|
|
526
|
-
divider = _ref2.divider
|
|
465
|
+
divider = _ref2.divider,
|
|
466
|
+
fn = _ref2.fn;
|
|
527
467
|
return React.createElement(MenuItem, {
|
|
528
468
|
divider: divider,
|
|
529
|
-
key:
|
|
469
|
+
key: index,
|
|
530
470
|
onClick: function onClick() {
|
|
531
471
|
return handleSelectFilterType(type);
|
|
532
472
|
},
|
|
533
|
-
selected: type === filterType,
|
|
534
|
-
|
|
535
|
-
|
|
473
|
+
selected: type === filterType || fn === filterType,
|
|
474
|
+
sx: commonMenuItemStyles,
|
|
475
|
+
value: type
|
|
536
476
|
}, label);
|
|
537
477
|
}));
|
|
538
478
|
};
|
|
539
479
|
|
|
540
480
|
var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
541
|
-
var _localization$
|
|
481
|
+
var _localization$filterB, _localization$clearFi, _column$filterSelectO;
|
|
542
482
|
|
|
543
483
|
var column = _ref.column;
|
|
544
484
|
|
|
@@ -586,7 +526,7 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
586
526
|
setCurrentFilterTypes(function (prev) {
|
|
587
527
|
var _extends2;
|
|
588
528
|
|
|
589
|
-
return _extends({}, prev, (_extends2 = {}, _extends2[column.id] =
|
|
529
|
+
return _extends({}, prev, (_extends2 = {}, _extends2[column.id] = MRT_FILTER_TYPE.FUZZY, _extends2));
|
|
590
530
|
});
|
|
591
531
|
};
|
|
592
532
|
|
|
@@ -597,8 +537,10 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
597
537
|
}
|
|
598
538
|
|
|
599
539
|
var filterType = tableInstance.state.currentFilterTypes[column.id];
|
|
600
|
-
var
|
|
601
|
-
var
|
|
540
|
+
var isSelectFilter = !!column.filterSelectOptions;
|
|
541
|
+
var filterChipLabel = !(filterType instanceof Function) && [MRT_FILTER_TYPE.EMPTY, MRT_FILTER_TYPE.NOT_EMPTY].includes(filterType) ? //@ts-ignore
|
|
542
|
+
localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))] : '';
|
|
543
|
+
var filterPlaceholder = (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(column.Header));
|
|
602
544
|
return React.createElement(React.Fragment, null, React.createElement(TextField, Object.assign({
|
|
603
545
|
fullWidth: true,
|
|
604
546
|
id: "mrt-" + idPrefix + "-" + column.id + "-filter-text-field",
|
|
@@ -610,8 +552,24 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
610
552
|
},
|
|
611
553
|
title: filterPlaceholder
|
|
612
554
|
},
|
|
555
|
+
helperText: filterType instanceof Function ? '' : localization.filterMode.replace('{filterType}', // @ts-ignore
|
|
556
|
+
localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))]),
|
|
557
|
+
FormHelperTextProps: {
|
|
558
|
+
sx: {
|
|
559
|
+
fontSize: '0.6rem',
|
|
560
|
+
lineHeight: '0.8rem'
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
label: isSelectFilter && !filterValue ? filterPlaceholder : undefined,
|
|
564
|
+
InputLabelProps: {
|
|
565
|
+
shrink: false,
|
|
566
|
+
sx: {
|
|
567
|
+
maxWidth: 'calc(100% - 2.5rem)'
|
|
568
|
+
},
|
|
569
|
+
title: filterPlaceholder
|
|
570
|
+
},
|
|
613
571
|
margin: "none",
|
|
614
|
-
placeholder: filterChipLabel ?
|
|
572
|
+
placeholder: filterChipLabel || isSelectFilter ? undefined : filterPlaceholder,
|
|
615
573
|
onChange: function onChange(e) {
|
|
616
574
|
setFilterValue(e.target.value);
|
|
617
575
|
handleChange(e.target.value);
|
|
@@ -619,34 +577,36 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
619
577
|
onClick: function onClick(e) {
|
|
620
578
|
return e.stopPropagation();
|
|
621
579
|
},
|
|
580
|
+
select: isSelectFilter,
|
|
622
581
|
value: filterValue != null ? filterValue : '',
|
|
623
582
|
variant: "standard",
|
|
624
583
|
InputProps: {
|
|
625
|
-
startAdornment: React.createElement(InputAdornment, {
|
|
584
|
+
startAdornment: !isSelectFilter && React.createElement(InputAdornment, {
|
|
626
585
|
position: "start"
|
|
627
586
|
}, React.createElement(Tooltip, {
|
|
628
587
|
arrow: true,
|
|
629
|
-
title:
|
|
630
|
-
}, React.createElement(IconButton, {
|
|
588
|
+
title: localization.changeFilterMode
|
|
589
|
+
}, React.createElement("span", null, React.createElement(IconButton, {
|
|
631
590
|
onClick: handleFilterMenuOpen,
|
|
632
591
|
size: "small",
|
|
633
592
|
sx: {
|
|
634
593
|
height: '1.75rem',
|
|
635
594
|
width: '1.75rem'
|
|
636
595
|
}
|
|
637
|
-
}, React.createElement(FilterListIcon, null))), filterChipLabel && React.createElement(Chip, {
|
|
596
|
+
}, React.createElement(FilterListIcon, null)))), filterChipLabel && React.createElement(Chip, {
|
|
638
597
|
onDelete: handleClearFilterChip,
|
|
639
|
-
label:
|
|
598
|
+
label: filterChipLabel
|
|
640
599
|
})),
|
|
641
600
|
endAdornment: !filterChipLabel && React.createElement(InputAdornment, {
|
|
642
601
|
position: "end"
|
|
643
602
|
}, React.createElement(Tooltip, {
|
|
644
603
|
arrow: true,
|
|
604
|
+
disableHoverListener: isSelectFilter,
|
|
645
605
|
placement: "right",
|
|
646
|
-
title: (_localization$
|
|
606
|
+
title: (_localization$clearFi = localization.clearFilter) != null ? _localization$clearFi : ''
|
|
647
607
|
}, React.createElement("span", null, React.createElement(IconButton, {
|
|
648
|
-
"aria-label": localization.
|
|
649
|
-
disabled: (filterValue
|
|
608
|
+
"aria-label": localization.clearFilter,
|
|
609
|
+
disabled: !(filterValue != null && filterValue.length),
|
|
650
610
|
onClick: handleClear,
|
|
651
611
|
size: "small",
|
|
652
612
|
sx: {
|
|
@@ -659,10 +619,35 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
659
619
|
}
|
|
660
620
|
}, textFieldProps, {
|
|
661
621
|
sx: _extends({
|
|
662
|
-
m: '
|
|
622
|
+
m: '-0.25rem',
|
|
623
|
+
p: 0,
|
|
663
624
|
minWidth: !filterChipLabel ? '5rem' : 'auto',
|
|
664
|
-
width: 'calc(100% + 0.5rem)'
|
|
625
|
+
width: 'calc(100% + 0.5rem)',
|
|
626
|
+
mt: isSelectFilter && !filterValue ? '-1rem' : undefined,
|
|
627
|
+
'& .MuiSelect-icon': {
|
|
628
|
+
mr: '1.5rem'
|
|
629
|
+
}
|
|
665
630
|
}, textFieldProps == null ? void 0 : textFieldProps.sx)
|
|
631
|
+
}), isSelectFilter && React.createElement(MenuItem, {
|
|
632
|
+
divider: true,
|
|
633
|
+
disabled: !filterValue,
|
|
634
|
+
value: ""
|
|
635
|
+
}, localization.clearFilter), column == null ? void 0 : (_column$filterSelectO = column.filterSelectOptions) == null ? void 0 : _column$filterSelectO.map(function (option) {
|
|
636
|
+
var value;
|
|
637
|
+
var text;
|
|
638
|
+
|
|
639
|
+
if (typeof option === 'string') {
|
|
640
|
+
value = option;
|
|
641
|
+
text = option;
|
|
642
|
+
} else if (typeof option === 'object') {
|
|
643
|
+
value = option.value;
|
|
644
|
+
text = option.text;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
return React.createElement(MenuItem, {
|
|
648
|
+
key: value,
|
|
649
|
+
value: value
|
|
650
|
+
}, text);
|
|
666
651
|
})), React.createElement(MRT_FilterTypeMenu, {
|
|
667
652
|
anchorEl: anchorEl,
|
|
668
653
|
column: column,
|
|
@@ -670,6 +655,298 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
670
655
|
}));
|
|
671
656
|
};
|
|
672
657
|
|
|
658
|
+
var MRT_ShowHideColumnsMenuItems = function MRT_ShowHideColumnsMenuItems(_ref) {
|
|
659
|
+
var _column$columns, _column$columns2, _column$isVisible, _column$columns4;
|
|
660
|
+
|
|
661
|
+
var column = _ref.column,
|
|
662
|
+
isSubMenu = _ref.isSubMenu;
|
|
663
|
+
var isParentHeader = !!(column != null && (_column$columns = column.columns) != null && _column$columns.length);
|
|
664
|
+
var allChildColumnsVisible = isParentHeader && !!((_column$columns2 = column.columns) != null && _column$columns2.every(function (childColumn) {
|
|
665
|
+
return childColumn.isVisible;
|
|
666
|
+
}));
|
|
667
|
+
var switchChecked = (_column$isVisible = column.isVisible) != null ? _column$isVisible : allChildColumnsVisible;
|
|
668
|
+
|
|
669
|
+
var handleToggleColumnHidden = function handleToggleColumnHidden(column) {
|
|
670
|
+
if (isParentHeader) {
|
|
671
|
+
var _column$columns3;
|
|
672
|
+
|
|
673
|
+
column == null ? void 0 : (_column$columns3 = column.columns) == null ? void 0 : _column$columns3.forEach == null ? void 0 : _column$columns3.forEach(function (childColumn) {
|
|
674
|
+
childColumn.toggleHidden(switchChecked);
|
|
675
|
+
});
|
|
676
|
+
} else {
|
|
677
|
+
column.toggleHidden();
|
|
678
|
+
}
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
return React.createElement(React.Fragment, null, React.createElement(MenuItem, {
|
|
682
|
+
sx: _extends({}, commonMenuItemStyles$1, {
|
|
683
|
+
pl: (column.depth + 0.5) * 2 + "rem"
|
|
684
|
+
})
|
|
685
|
+
}, React.createElement(FormControlLabel, {
|
|
686
|
+
componentsProps: {
|
|
687
|
+
typography: {
|
|
688
|
+
sx: {
|
|
689
|
+
marginBottom: 0
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
},
|
|
693
|
+
checked: switchChecked,
|
|
694
|
+
control: React.createElement(Switch, null),
|
|
695
|
+
disabled: isSubMenu && switchChecked,
|
|
696
|
+
label: column.Header,
|
|
697
|
+
onChange: function onChange() {
|
|
698
|
+
return handleToggleColumnHidden(column);
|
|
699
|
+
}
|
|
700
|
+
})), (_column$columns4 = column.columns) == null ? void 0 : _column$columns4.map(function (c, i) {
|
|
701
|
+
return React.createElement(MRT_ShowHideColumnsMenuItems, {
|
|
702
|
+
key: i + "-" + c.id,
|
|
703
|
+
column: c,
|
|
704
|
+
isSubMenu: isSubMenu
|
|
705
|
+
});
|
|
706
|
+
}));
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
var MRT_ShowHideColumnsMenu = function MRT_ShowHideColumnsMenu(_ref) {
|
|
710
|
+
var anchorEl = _ref.anchorEl,
|
|
711
|
+
isSubMenu = _ref.isSubMenu,
|
|
712
|
+
setAnchorEl = _ref.setAnchorEl;
|
|
713
|
+
|
|
714
|
+
var _useMRT = useMRT(),
|
|
715
|
+
localization = _useMRT.localization,
|
|
716
|
+
tableInstance = _useMRT.tableInstance;
|
|
717
|
+
|
|
718
|
+
return React.createElement(Menu, {
|
|
719
|
+
anchorEl: anchorEl,
|
|
720
|
+
open: !!anchorEl,
|
|
721
|
+
onClose: function onClose() {
|
|
722
|
+
return setAnchorEl(null);
|
|
723
|
+
},
|
|
724
|
+
MenuListProps: {
|
|
725
|
+
dense: tableInstance.state.densePadding
|
|
726
|
+
}
|
|
727
|
+
}, React.createElement(Box, {
|
|
728
|
+
sx: {
|
|
729
|
+
display: 'flex',
|
|
730
|
+
justifyContent: isSubMenu ? 'center' : 'space-between',
|
|
731
|
+
p: '0.5rem',
|
|
732
|
+
pt: 0
|
|
733
|
+
}
|
|
734
|
+
}, !isSubMenu && React.createElement(Button, {
|
|
735
|
+
disabled: !tableInstance.getToggleHideAllColumnsProps().checked && !tableInstance.getToggleHideAllColumnsProps().indeterminate,
|
|
736
|
+
onClick: function onClick() {
|
|
737
|
+
return tableInstance.toggleHideAllColumns(true);
|
|
738
|
+
}
|
|
739
|
+
}, localization.hideAll), React.createElement(Button, {
|
|
740
|
+
disabled: tableInstance.getToggleHideAllColumnsProps().checked,
|
|
741
|
+
onClick: function onClick() {
|
|
742
|
+
return tableInstance.toggleHideAllColumns(false);
|
|
743
|
+
}
|
|
744
|
+
}, localization.showAll)), React.createElement(Divider, null), tableInstance.columns.map(function (column, index) {
|
|
745
|
+
return React.createElement(MRT_ShowHideColumnsMenuItems, {
|
|
746
|
+
column: column,
|
|
747
|
+
isSubMenu: isSubMenu,
|
|
748
|
+
key: index + "-" + column.id
|
|
749
|
+
});
|
|
750
|
+
}));
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
var commonMenuItemStyles$1 = {
|
|
754
|
+
py: '6px',
|
|
755
|
+
my: 0,
|
|
756
|
+
justifyContent: 'space-between',
|
|
757
|
+
alignItems: 'center'
|
|
758
|
+
};
|
|
759
|
+
var commonListItemStyles = {
|
|
760
|
+
display: 'flex',
|
|
761
|
+
gap: '0.75rem',
|
|
762
|
+
alignItems: 'center'
|
|
763
|
+
};
|
|
764
|
+
var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
765
|
+
var _localization$sortByC, _localization$sortByC2, _localization$filterB, _localization, _localization$hideCol, _tableInstance$state$, _localization$showAll;
|
|
766
|
+
|
|
767
|
+
var anchorEl = _ref.anchorEl,
|
|
768
|
+
column = _ref.column,
|
|
769
|
+
setAnchorEl = _ref.setAnchorEl;
|
|
770
|
+
|
|
771
|
+
var _useMRT = useMRT(),
|
|
772
|
+
disableColumnHiding = _useMRT.disableColumnHiding,
|
|
773
|
+
disableFilters = _useMRT.disableFilters,
|
|
774
|
+
disableSortBy = _useMRT.disableSortBy,
|
|
775
|
+
enableColumnGrouping = _useMRT.enableColumnGrouping,
|
|
776
|
+
_useMRT$icons = _useMRT.icons,
|
|
777
|
+
ArrowRightIcon = _useMRT$icons.ArrowRightIcon,
|
|
778
|
+
ClearAllIcon = _useMRT$icons.ClearAllIcon,
|
|
779
|
+
ViewColumnIcon = _useMRT$icons.ViewColumnIcon,
|
|
780
|
+
DynamicFeedIcon = _useMRT$icons.DynamicFeedIcon,
|
|
781
|
+
FilterListIcon = _useMRT$icons.FilterListIcon,
|
|
782
|
+
FilterListOffIcon = _useMRT$icons.FilterListOffIcon,
|
|
783
|
+
SortIcon = _useMRT$icons.SortIcon,
|
|
784
|
+
VisibilityOffIcon = _useMRT$icons.VisibilityOffIcon,
|
|
785
|
+
idPrefix = _useMRT.idPrefix,
|
|
786
|
+
localization = _useMRT.localization,
|
|
787
|
+
setShowFilters = _useMRT.setShowFilters,
|
|
788
|
+
tableInstance = _useMRT.tableInstance;
|
|
789
|
+
|
|
790
|
+
var _useState = useState(null),
|
|
791
|
+
filterMenuAnchorEl = _useState[0],
|
|
792
|
+
setFilterMenuAnchorEl = _useState[1];
|
|
793
|
+
|
|
794
|
+
var _useState2 = useState(null),
|
|
795
|
+
showHideColumnsMenuAnchorEl = _useState2[0],
|
|
796
|
+
setShowHideColumnsMenuAnchorEl = _useState2[1];
|
|
797
|
+
|
|
798
|
+
var handleClearSort = function handleClearSort() {
|
|
799
|
+
column.clearSortBy();
|
|
800
|
+
setAnchorEl(null);
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
var handleSortAsc = function handleSortAsc() {
|
|
804
|
+
column.toggleSortBy(false);
|
|
805
|
+
setAnchorEl(null);
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
var handleSortDesc = function handleSortDesc() {
|
|
809
|
+
column.toggleSortBy(true);
|
|
810
|
+
setAnchorEl(null);
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
var handleHideColumn = function handleHideColumn() {
|
|
814
|
+
column.toggleHidden();
|
|
815
|
+
setAnchorEl(null);
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
var handleGroupByColumn = function handleGroupByColumn() {
|
|
819
|
+
column.toggleGroupBy();
|
|
820
|
+
setAnchorEl(null);
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
var handleClearFilter = function handleClearFilter() {
|
|
824
|
+
column.setFilter('');
|
|
825
|
+
setAnchorEl(null);
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
var handleFilterByColumn = function handleFilterByColumn() {
|
|
829
|
+
setShowFilters(true);
|
|
830
|
+
setTimeout(function () {
|
|
831
|
+
var _document$getElementB, _column$muiTableHeadC, _column$muiTableHeadC2;
|
|
832
|
+
|
|
833
|
+
return (_document$getElementB = document.getElementById( // @ts-ignore
|
|
834
|
+
(_column$muiTableHeadC = (_column$muiTableHeadC2 = column.muiTableHeadCellFilterTextFieldProps) == null ? void 0 : _column$muiTableHeadC2.id) != null ? _column$muiTableHeadC : "mrt-" + idPrefix + "-" + column.id + "-filter-text-field")) == null ? void 0 : _document$getElementB.focus();
|
|
835
|
+
}, 200);
|
|
836
|
+
setAnchorEl(null);
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
var handleOpenFilterModeMenu = function handleOpenFilterModeMenu(event) {
|
|
840
|
+
event.stopPropagation();
|
|
841
|
+
setFilterMenuAnchorEl(event.currentTarget);
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
var handleShowAllColumns = function handleShowAllColumns() {
|
|
845
|
+
tableInstance.toggleHideAllColumns(false);
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
var handleOpenShowHideColumnsMenu = function handleOpenShowHideColumnsMenu(event) {
|
|
849
|
+
event.stopPropagation();
|
|
850
|
+
setShowHideColumnsMenuAnchorEl(event.currentTarget);
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
return React.createElement(Menu, {
|
|
854
|
+
anchorEl: anchorEl,
|
|
855
|
+
open: !!anchorEl,
|
|
856
|
+
onClose: function onClose() {
|
|
857
|
+
return setAnchorEl(null);
|
|
858
|
+
},
|
|
859
|
+
MenuListProps: {
|
|
860
|
+
dense: tableInstance.state.densePadding
|
|
861
|
+
}
|
|
862
|
+
}, !disableSortBy && column.canSort && [React.createElement(MenuItem, {
|
|
863
|
+
disabled: !column.isSorted,
|
|
864
|
+
key: 0,
|
|
865
|
+
onClick: handleClearSort,
|
|
866
|
+
sx: commonMenuItemStyles$1
|
|
867
|
+
}, React.createElement(Box, {
|
|
868
|
+
sx: commonListItemStyles
|
|
869
|
+
}, React.createElement(ClearAllIcon, null), localization.clearSort)), React.createElement(MenuItem, {
|
|
870
|
+
disabled: column.isSorted && !column.isSortedDesc,
|
|
871
|
+
key: 1,
|
|
872
|
+
onClick: handleSortAsc,
|
|
873
|
+
sx: commonMenuItemStyles$1
|
|
874
|
+
}, React.createElement(Box, {
|
|
875
|
+
sx: commonListItemStyles
|
|
876
|
+
}, React.createElement(SortIcon, null), (_localization$sortByC = localization.sortByColumnAsc) == null ? void 0 : _localization$sortByC.replace('{column}', String(column.Header)))), React.createElement(MenuItem, {
|
|
877
|
+
divider: !disableFilters || enableColumnGrouping || !disableColumnHiding,
|
|
878
|
+
key: 2,
|
|
879
|
+
disabled: column.isSorted && column.isSortedDesc,
|
|
880
|
+
onClick: handleSortDesc,
|
|
881
|
+
sx: commonMenuItemStyles$1
|
|
882
|
+
}, React.createElement(Box, {
|
|
883
|
+
sx: commonListItemStyles
|
|
884
|
+
}, React.createElement(SortIcon, {
|
|
885
|
+
style: {
|
|
886
|
+
transform: 'rotate(180deg) scaleX(-1)'
|
|
887
|
+
}
|
|
888
|
+
}), (_localization$sortByC2 = localization.sortByColumnDesc) == null ? void 0 : _localization$sortByC2.replace('{column}', String(column.Header))))], !disableFilters && column.canFilter && [React.createElement(MenuItem, {
|
|
889
|
+
disabled: !column.filterValue,
|
|
890
|
+
key: 0,
|
|
891
|
+
onClick: handleClearFilter,
|
|
892
|
+
sx: commonMenuItemStyles$1
|
|
893
|
+
}, React.createElement(Box, {
|
|
894
|
+
sx: commonListItemStyles
|
|
895
|
+
}, React.createElement(FilterListOffIcon, null), localization.clearFilter)), React.createElement(MenuItem, {
|
|
896
|
+
divider: enableColumnGrouping || !disableColumnHiding,
|
|
897
|
+
key: 1,
|
|
898
|
+
onClick: handleFilterByColumn,
|
|
899
|
+
sx: commonMenuItemStyles$1
|
|
900
|
+
}, React.createElement(Box, {
|
|
901
|
+
sx: commonListItemStyles
|
|
902
|
+
}, React.createElement(FilterListIcon, null), (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(column.Header))), !column.filterSelectOptions && React.createElement(IconButton, {
|
|
903
|
+
onClick: handleOpenFilterModeMenu,
|
|
904
|
+
onMouseEnter: handleOpenFilterModeMenu,
|
|
905
|
+
size: "small",
|
|
906
|
+
sx: {
|
|
907
|
+
p: 0
|
|
908
|
+
}
|
|
909
|
+
}, React.createElement(ArrowRightIcon, null))), React.createElement(MRT_FilterTypeMenu, {
|
|
910
|
+
anchorEl: filterMenuAnchorEl,
|
|
911
|
+
column: column,
|
|
912
|
+
key: 2,
|
|
913
|
+
setAnchorEl: setFilterMenuAnchorEl,
|
|
914
|
+
onSelect: handleFilterByColumn
|
|
915
|
+
})], enableColumnGrouping && column.canGroupBy && [React.createElement(MenuItem, {
|
|
916
|
+
divider: !disableColumnHiding,
|
|
917
|
+
key: 0,
|
|
918
|
+
onClick: handleGroupByColumn,
|
|
919
|
+
sx: commonMenuItemStyles$1
|
|
920
|
+
}, React.createElement(Box, {
|
|
921
|
+
sx: commonListItemStyles
|
|
922
|
+
}, React.createElement(DynamicFeedIcon, null), (_localization = localization[column.isGrouped ? 'ungroupByColumn' : 'groupByColumn']) == null ? void 0 : _localization.replace('{column}', String(column.Header))))], !disableColumnHiding && [React.createElement(MenuItem, {
|
|
923
|
+
key: 0,
|
|
924
|
+
onClick: handleHideColumn,
|
|
925
|
+
sx: commonMenuItemStyles$1
|
|
926
|
+
}, React.createElement(Box, {
|
|
927
|
+
sx: commonListItemStyles
|
|
928
|
+
}, React.createElement(VisibilityOffIcon, null), (_localization$hideCol = localization.hideColumn) == null ? void 0 : _localization$hideCol.replace('{column}', String(column.Header)))), React.createElement(MenuItem, {
|
|
929
|
+
disabled: !((_tableInstance$state$ = tableInstance.state.hiddenColumns) != null && _tableInstance$state$.length),
|
|
930
|
+
key: 1,
|
|
931
|
+
onClick: handleShowAllColumns,
|
|
932
|
+
sx: commonMenuItemStyles$1
|
|
933
|
+
}, React.createElement(Box, {
|
|
934
|
+
sx: commonListItemStyles
|
|
935
|
+
}, React.createElement(ViewColumnIcon, null), (_localization$showAll = localization.showAllColumns) == null ? void 0 : _localization$showAll.replace('{column}', String(column.Header))), !column.filterSelectOptions && React.createElement(IconButton, {
|
|
936
|
+
onClick: handleOpenShowHideColumnsMenu,
|
|
937
|
+
onMouseEnter: handleOpenShowHideColumnsMenu,
|
|
938
|
+
size: "small",
|
|
939
|
+
sx: {
|
|
940
|
+
p: 0
|
|
941
|
+
}
|
|
942
|
+
}, React.createElement(ArrowRightIcon, null))), React.createElement(MRT_ShowHideColumnsMenu, {
|
|
943
|
+
anchorEl: showHideColumnsMenuAnchorEl,
|
|
944
|
+
isSubMenu: true,
|
|
945
|
+
key: 2,
|
|
946
|
+
setAnchorEl: setShowHideColumnsMenuAnchorEl
|
|
947
|
+
})]);
|
|
948
|
+
};
|
|
949
|
+
|
|
673
950
|
var MRT_ToggleColumnActionMenuButton = function MRT_ToggleColumnActionMenuButton(_ref) {
|
|
674
951
|
var column = _ref.column;
|
|
675
952
|
|
|
@@ -691,9 +968,10 @@ var MRT_ToggleColumnActionMenuButton = function MRT_ToggleColumnActionMenuButton
|
|
|
691
968
|
arrow: true,
|
|
692
969
|
enterDelay: 1000,
|
|
693
970
|
enterNextDelay: 1000,
|
|
694
|
-
|
|
971
|
+
placement: "top",
|
|
972
|
+
title: localization.columnActions
|
|
695
973
|
}, React.createElement(IconButton, {
|
|
696
|
-
"aria-label": localization.
|
|
974
|
+
"aria-label": localization.columnActions,
|
|
697
975
|
onClick: handleClick,
|
|
698
976
|
size: "small",
|
|
699
977
|
sx: {
|
|
@@ -725,7 +1003,7 @@ var commonTableHeadCellStyles = function commonTableHeadCellStyles(densePadding,
|
|
|
725
1003
|
};
|
|
726
1004
|
};
|
|
727
1005
|
var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
728
|
-
var _column$columns, _localization$
|
|
1006
|
+
var _column$columns, _localization$sortByC, _localization$sortByC2;
|
|
729
1007
|
|
|
730
1008
|
var column = _ref.column;
|
|
731
1009
|
|
|
@@ -749,9 +1027,10 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
749
1027
|
style: _extends({}, column.getHeaderProps().style, mTableHeadCellProps == null ? void 0 : mTableHeadCellProps.style, mcTableHeadCellProps == null ? void 0 : mcTableHeadCellProps.style)
|
|
750
1028
|
});
|
|
751
1029
|
|
|
752
|
-
var sortTooltip = column.isSorted ? column.isSortedDesc ? localization.
|
|
753
|
-
var
|
|
754
|
-
|
|
1030
|
+
var sortTooltip = column.isSorted ? column.isSortedDesc ? localization.clearSort : (_localization$sortByC = localization.sortByColumnDesc) == null ? void 0 : _localization$sortByC.replace('{column}', column.Header) : (_localization$sortByC2 = localization.sortByColumnAsc) == null ? void 0 : _localization$sortByC2.replace('{column}', column.Header);
|
|
1031
|
+
var filterType = tableInstance.state.currentFilterTypes[column.id];
|
|
1032
|
+
var filterTooltip = !!column.filterValue ? localization.filteringByColumn.replace('{column}', String(column.Header)).replace('{filterType}', filterType instanceof Function ? '' : // @ts-ignore
|
|
1033
|
+
localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))]).replace('{filterValue}', column.filterValue) : localization.showHideFilters;
|
|
755
1034
|
var columnHeader = column.render('Header');
|
|
756
1035
|
return React.createElement(TableCell, Object.assign({
|
|
757
1036
|
align: isParentHeader ? 'center' : 'left'
|
|
@@ -774,6 +1053,7 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
774
1053
|
title: undefined
|
|
775
1054
|
}), column.render('Header'), !isParentHeader && column.canSort && React.createElement(Tooltip, {
|
|
776
1055
|
arrow: true,
|
|
1056
|
+
placement: "top",
|
|
777
1057
|
title: sortTooltip
|
|
778
1058
|
}, React.createElement(TableSortLabel, {
|
|
779
1059
|
"aria-label": sortTooltip,
|
|
@@ -781,19 +1061,22 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
781
1061
|
direction: column.isSortedDesc ? 'desc' : 'asc'
|
|
782
1062
|
})), !isParentHeader && !!column.canFilter && React.createElement(Tooltip, {
|
|
783
1063
|
arrow: true,
|
|
1064
|
+
placement: "top",
|
|
784
1065
|
title: filterTooltip
|
|
785
1066
|
}, React.createElement(IconButton, {
|
|
1067
|
+
disableRipple: true,
|
|
786
1068
|
onClick: function onClick(event) {
|
|
787
1069
|
event.stopPropagation();
|
|
788
1070
|
setShowFilters(!tableInstance.state.showFilters);
|
|
789
1071
|
},
|
|
790
1072
|
size: "small",
|
|
791
1073
|
sx: {
|
|
1074
|
+
m: 0,
|
|
792
1075
|
opacity: !!column.filterValue ? 0.8 : 0,
|
|
793
1076
|
p: '2px',
|
|
794
|
-
m: 0,
|
|
795
1077
|
transition: 'all 0.2s ease-in-out',
|
|
796
1078
|
'&:hover': {
|
|
1079
|
+
backgroundColor: 'transparent',
|
|
797
1080
|
opacity: 0.8
|
|
798
1081
|
}
|
|
799
1082
|
}
|
|
@@ -951,10 +1234,10 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
|
951
1234
|
arrow: true,
|
|
952
1235
|
enterDelay: 1000,
|
|
953
1236
|
enterNextDelay: 1000,
|
|
954
|
-
title: selectAll ? localization.
|
|
1237
|
+
title: selectAll ? localization.toggleSelectAll : localization.toggleSelectRow
|
|
955
1238
|
}, React.createElement(Checkbox, Object.assign({
|
|
956
1239
|
inputProps: {
|
|
957
|
-
'aria-label': selectAll ? localization.
|
|
1240
|
+
'aria-label': selectAll ? localization.toggleSelectAll : localization.toggleSelectRow
|
|
958
1241
|
},
|
|
959
1242
|
onChange: onSelectChange
|
|
960
1243
|
}, checkboxProps, {
|
|
@@ -974,8 +1257,8 @@ var MRT_ExpandAllButton = function MRT_ExpandAllButton() {
|
|
|
974
1257
|
}, tableInstance.getToggleAllRowsExpandedProps(), {
|
|
975
1258
|
sx: commonTableBodyButtonCellStyles(tableInstance.state.densePadding)
|
|
976
1259
|
}), React.createElement(IconButton, {
|
|
977
|
-
"aria-label": localization.
|
|
978
|
-
title: localization.
|
|
1260
|
+
"aria-label": localization.expandAll,
|
|
1261
|
+
title: localization.expandAll
|
|
979
1262
|
}, React.createElement(DoubleArrowDownIcon, {
|
|
980
1263
|
style: {
|
|
981
1264
|
transform: "rotate(" + (tableInstance.isAllRowsExpanded ? -180 : anyRowsExpanded ? -90 : 0) + "deg)",
|
|
@@ -1015,7 +1298,7 @@ var MRT_TableHeadCellActions = function MRT_TableHeadCellActions() {
|
|
|
1015
1298
|
sx: _extends({}, commonTableHeadCellStyles(densePadding), {
|
|
1016
1299
|
textAlign: 'center'
|
|
1017
1300
|
})
|
|
1018
|
-
}, localization.
|
|
1301
|
+
}, localization.actions);
|
|
1019
1302
|
};
|
|
1020
1303
|
|
|
1021
1304
|
var MRT_TableHeadRow = function MRT_TableHeadRow(_ref) {
|
|
@@ -1121,9 +1404,9 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
|
|
|
1121
1404
|
textAlign: 'left'
|
|
1122
1405
|
})
|
|
1123
1406
|
}, React.createElement(IconButton, Object.assign({
|
|
1124
|
-
"aria-label": localization.
|
|
1407
|
+
"aria-label": localization.expand,
|
|
1125
1408
|
disabled: !row.canExpand && !renderDetailPanel,
|
|
1126
|
-
title: localization.
|
|
1409
|
+
title: localization.expand
|
|
1127
1410
|
}, row.getToggleRowExpandedProps()), React.createElement(ExpandMoreIcon, {
|
|
1128
1411
|
style: {
|
|
1129
1412
|
transform: "rotate(" + (!row.canExpand && !renderDetailPanel ? -90 : row.isExpanded ? -180 : 0) + "deg)",
|
|
@@ -1154,15 +1437,12 @@ var MRT_RowActionMenu = function MRT_RowActionMenu(_ref) {
|
|
|
1154
1437
|
return setAnchorEl(null);
|
|
1155
1438
|
},
|
|
1156
1439
|
MenuListProps: {
|
|
1157
|
-
dense: tableInstance.state.densePadding
|
|
1158
|
-
disablePadding: true
|
|
1440
|
+
dense: tableInstance.state.densePadding
|
|
1159
1441
|
}
|
|
1160
1442
|
}, enableRowEditing && React.createElement(MenuItem, {
|
|
1161
1443
|
onClick: handleEdit,
|
|
1162
|
-
sx: commonMenuItemStyles
|
|
1163
|
-
}, React.createElement(
|
|
1164
|
-
sx: commonMenuItemStyles
|
|
1165
|
-
}, localization.rowActionMenuItemEdit)), (_renderRowActionMenuI = renderRowActionMenuItems == null ? void 0 : renderRowActionMenuItems(row, tableInstance, function () {
|
|
1444
|
+
sx: commonMenuItemStyles$1
|
|
1445
|
+
}, React.createElement(EditIcon, null), localization.edit), (_renderRowActionMenuI = renderRowActionMenuItems == null ? void 0 : renderRowActionMenuItems(row, tableInstance, function () {
|
|
1166
1446
|
return setAnchorEl(null);
|
|
1167
1447
|
})) != null ? _renderRowActionMenuI : null);
|
|
1168
1448
|
};
|
|
@@ -1976,15 +2256,15 @@ var MRT_EditActionButtons = function MRT_EditActionButtons(_ref) {
|
|
|
1976
2256
|
}
|
|
1977
2257
|
}, React.createElement(Tooltip, {
|
|
1978
2258
|
arrow: true,
|
|
1979
|
-
title: localization.
|
|
2259
|
+
title: localization.cancel
|
|
1980
2260
|
}, React.createElement(IconButton, {
|
|
1981
|
-
"aria-label": localization.
|
|
2261
|
+
"aria-label": localization.cancel,
|
|
1982
2262
|
onClick: handleCancel
|
|
1983
2263
|
}, React.createElement(CancelIcon, null))), React.createElement(Tooltip, {
|
|
1984
2264
|
arrow: true,
|
|
1985
|
-
title: localization.
|
|
2265
|
+
title: localization.save
|
|
1986
2266
|
}, React.createElement(IconButton, {
|
|
1987
|
-
"aria-label": localization.
|
|
2267
|
+
"aria-label": localization.save,
|
|
1988
2268
|
color: "info",
|
|
1989
2269
|
onClick: handleSave
|
|
1990
2270
|
}, React.createElement(SaveIcon, null))));
|
|
@@ -2038,7 +2318,7 @@ var MRT_ToggleRowActionMenuButton = function MRT_ToggleRowActionMenuButton(_ref)
|
|
|
2038
2318
|
}) : !renderRowActionMenuItems && enableRowEditing ? React.createElement(Tooltip, {
|
|
2039
2319
|
placement: "right",
|
|
2040
2320
|
arrow: true,
|
|
2041
|
-
title: localization.
|
|
2321
|
+
title: localization.edit
|
|
2042
2322
|
}, React.createElement(IconButton, {
|
|
2043
2323
|
sx: commonIconButtonStyles,
|
|
2044
2324
|
onClick: handleEdit
|
|
@@ -2046,9 +2326,9 @@ var MRT_ToggleRowActionMenuButton = function MRT_ToggleRowActionMenuButton(_ref)
|
|
|
2046
2326
|
arrow: true,
|
|
2047
2327
|
enterDelay: 1000,
|
|
2048
2328
|
enterNextDelay: 1000,
|
|
2049
|
-
title: localization.
|
|
2329
|
+
title: localization.rowActions
|
|
2050
2330
|
}, React.createElement(IconButton, {
|
|
2051
|
-
"aria-label": localization.
|
|
2331
|
+
"aria-label": localization.rowActions,
|
|
2052
2332
|
onClick: handleOpenRowActionMenu,
|
|
2053
2333
|
size: "small",
|
|
2054
2334
|
sx: commonIconButtonStyles
|
|
@@ -2268,7 +2548,7 @@ var MRT_SearchTextField = function MRT_SearchTextField() {
|
|
|
2268
2548
|
orientation: "horizontal"
|
|
2269
2549
|
}, React.createElement(TextField, Object.assign({
|
|
2270
2550
|
id: "mrt-" + idPrefix + "-search-text-field",
|
|
2271
|
-
placeholder: localization.
|
|
2551
|
+
placeholder: localization.search,
|
|
2272
2552
|
onChange: function onChange(event) {
|
|
2273
2553
|
setSearchValue(event.target.value);
|
|
2274
2554
|
handleChange(event);
|
|
@@ -2284,11 +2564,11 @@ var MRT_SearchTextField = function MRT_SearchTextField() {
|
|
|
2284
2564
|
endAdornment: React.createElement(InputAdornment, {
|
|
2285
2565
|
position: "end"
|
|
2286
2566
|
}, React.createElement(IconButton, {
|
|
2287
|
-
"aria-label": localization.
|
|
2567
|
+
"aria-label": localization.clearSearch,
|
|
2288
2568
|
disabled: (searchValue == null ? void 0 : searchValue.length) === 0,
|
|
2289
2569
|
onClick: handleClear,
|
|
2290
2570
|
size: "small",
|
|
2291
|
-
title: localization.
|
|
2571
|
+
title: localization.clearSearch
|
|
2292
2572
|
}, React.createElement(CloseIcon, {
|
|
2293
2573
|
fontSize: "small"
|
|
2294
2574
|
})))
|
|
@@ -2313,9 +2593,9 @@ var MRT_FullScreenToggleButton = function MRT_FullScreenToggleButton(_ref) {
|
|
|
2313
2593
|
|
|
2314
2594
|
return React.createElement(Tooltip, {
|
|
2315
2595
|
arrow: true,
|
|
2316
|
-
title: localization.
|
|
2596
|
+
title: localization.toggleFullScreen
|
|
2317
2597
|
}, React.createElement(IconButton, Object.assign({
|
|
2318
|
-
"aria-label": localization.
|
|
2598
|
+
"aria-label": localization.showHideFilters,
|
|
2319
2599
|
onClick: function onClick() {
|
|
2320
2600
|
return setFullScreen(!fullScreen);
|
|
2321
2601
|
},
|
|
@@ -2323,54 +2603,12 @@ var MRT_FullScreenToggleButton = function MRT_FullScreenToggleButton(_ref) {
|
|
|
2323
2603
|
}, rest), fullScreen ? React.createElement(FullscreenExitIcon, null) : React.createElement(FullscreenIcon, null)));
|
|
2324
2604
|
};
|
|
2325
2605
|
|
|
2326
|
-
var MRT_ShowHideColumnsMenu = function MRT_ShowHideColumnsMenu(_ref) {
|
|
2327
|
-
var _column$columns, _column$columns2, _column$isVisible, _column$columns4;
|
|
2328
|
-
|
|
2329
|
-
var column = _ref.column;
|
|
2330
|
-
var isParentHeader = !!(column != null && (_column$columns = column.columns) != null && _column$columns.length);
|
|
2331
|
-
var allChildColumnsVisible = isParentHeader && !!((_column$columns2 = column.columns) != null && _column$columns2.every(function (childColumn) {
|
|
2332
|
-
return childColumn.isVisible;
|
|
2333
|
-
}));
|
|
2334
|
-
var switchChecked = (_column$isVisible = column.isVisible) != null ? _column$isVisible : allChildColumnsVisible;
|
|
2335
|
-
|
|
2336
|
-
var handleToggleColumnHidden = function handleToggleColumnHidden(column) {
|
|
2337
|
-
if (isParentHeader) {
|
|
2338
|
-
var _column$columns3;
|
|
2339
|
-
|
|
2340
|
-
column == null ? void 0 : (_column$columns3 = column.columns) == null ? void 0 : _column$columns3.forEach == null ? void 0 : _column$columns3.forEach(function (childColumn) {
|
|
2341
|
-
childColumn.toggleHidden(switchChecked);
|
|
2342
|
-
});
|
|
2343
|
-
} else {
|
|
2344
|
-
column.toggleHidden();
|
|
2345
|
-
}
|
|
2346
|
-
};
|
|
2347
|
-
|
|
2348
|
-
return React.createElement(React.Fragment, null, React.createElement(MenuItem, {
|
|
2349
|
-
sx: {
|
|
2350
|
-
pl: (column.depth + 0.5) * 2 + "rem"
|
|
2351
|
-
}
|
|
2352
|
-
}, React.createElement(FormControlLabel, {
|
|
2353
|
-
checked: switchChecked,
|
|
2354
|
-
control: React.createElement(Switch, null),
|
|
2355
|
-
label: column.Header,
|
|
2356
|
-
onChange: function onChange() {
|
|
2357
|
-
return handleToggleColumnHidden(column);
|
|
2358
|
-
}
|
|
2359
|
-
})), (_column$columns4 = column.columns) == null ? void 0 : _column$columns4.map(function (c, i) {
|
|
2360
|
-
return React.createElement(MRT_ShowHideColumnsMenu, {
|
|
2361
|
-
key: i + "-" + c.id,
|
|
2362
|
-
column: c
|
|
2363
|
-
});
|
|
2364
|
-
}));
|
|
2365
|
-
};
|
|
2366
|
-
|
|
2367
2606
|
var MRT_ShowHideColumnsButton = function MRT_ShowHideColumnsButton(_ref) {
|
|
2368
2607
|
var rest = _extends({}, _ref);
|
|
2369
2608
|
|
|
2370
2609
|
var _useMRT = useMRT(),
|
|
2371
2610
|
ViewColumnIcon = _useMRT.icons.ViewColumnIcon,
|
|
2372
|
-
localization = _useMRT.localization
|
|
2373
|
-
tableInstance = _useMRT.tableInstance;
|
|
2611
|
+
localization = _useMRT.localization;
|
|
2374
2612
|
|
|
2375
2613
|
var _useState = useState(null),
|
|
2376
2614
|
anchorEl = _useState[0],
|
|
@@ -2382,44 +2620,15 @@ var MRT_ShowHideColumnsButton = function MRT_ShowHideColumnsButton(_ref) {
|
|
|
2382
2620
|
|
|
2383
2621
|
return React.createElement(React.Fragment, null, React.createElement(Tooltip, {
|
|
2384
2622
|
arrow: true,
|
|
2385
|
-
title: localization.
|
|
2623
|
+
title: localization.showHideColumns
|
|
2386
2624
|
}, React.createElement(IconButton, Object.assign({
|
|
2387
|
-
"aria-label": localization.
|
|
2625
|
+
"aria-label": localization.showHideColumns,
|
|
2388
2626
|
onClick: handleClick,
|
|
2389
2627
|
size: "small"
|
|
2390
|
-
}, rest), React.createElement(ViewColumnIcon, null))), React.createElement(
|
|
2628
|
+
}, rest), React.createElement(ViewColumnIcon, null))), React.createElement(MRT_ShowHideColumnsMenu, {
|
|
2391
2629
|
anchorEl: anchorEl,
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
return setAnchorEl(null);
|
|
2395
|
-
},
|
|
2396
|
-
MenuListProps: {
|
|
2397
|
-
dense: tableInstance.state.densePadding,
|
|
2398
|
-
disablePadding: true
|
|
2399
|
-
},
|
|
2400
|
-
sx: commonMenuItemStyles
|
|
2401
|
-
}, React.createElement(Box, {
|
|
2402
|
-
sx: {
|
|
2403
|
-
display: 'flex',
|
|
2404
|
-
justifyContent: 'space-between',
|
|
2405
|
-
p: '0.5rem'
|
|
2406
|
-
}
|
|
2407
|
-
}, React.createElement(Button, {
|
|
2408
|
-
disabled: !tableInstance.getToggleHideAllColumnsProps().checked && !tableInstance.getToggleHideAllColumnsProps().indeterminate,
|
|
2409
|
-
onClick: function onClick() {
|
|
2410
|
-
return tableInstance.toggleHideAllColumns(true);
|
|
2411
|
-
}
|
|
2412
|
-
}, localization.columnShowHideMenuHideAll), React.createElement(Button, {
|
|
2413
|
-
disabled: tableInstance.getToggleHideAllColumnsProps().checked,
|
|
2414
|
-
onClick: function onClick() {
|
|
2415
|
-
return tableInstance.toggleHideAllColumns(false);
|
|
2416
|
-
}
|
|
2417
|
-
}, localization.columnShowHideMenuShowAll)), React.createElement(Divider, null), tableInstance.columns.map(function (column, index) {
|
|
2418
|
-
return React.createElement(MRT_ShowHideColumnsMenu, {
|
|
2419
|
-
key: index + "-" + column.id,
|
|
2420
|
-
column: column
|
|
2421
|
-
});
|
|
2422
|
-
})));
|
|
2630
|
+
setAnchorEl: setAnchorEl
|
|
2631
|
+
}));
|
|
2423
2632
|
};
|
|
2424
2633
|
|
|
2425
2634
|
var MRT_ToggleDensePaddingButton = function MRT_ToggleDensePaddingButton(_ref) {
|
|
@@ -2435,9 +2644,9 @@ var MRT_ToggleDensePaddingButton = function MRT_ToggleDensePaddingButton(_ref) {
|
|
|
2435
2644
|
|
|
2436
2645
|
return React.createElement(Tooltip, {
|
|
2437
2646
|
arrow: true,
|
|
2438
|
-
title: localization.
|
|
2647
|
+
title: localization.toggleDensePadding
|
|
2439
2648
|
}, React.createElement(IconButton, Object.assign({
|
|
2440
|
-
"aria-label": localization.
|
|
2649
|
+
"aria-label": localization.toggleDensePadding,
|
|
2441
2650
|
onClick: function onClick() {
|
|
2442
2651
|
return setDensePadding(!densePadding);
|
|
2443
2652
|
},
|
|
@@ -2458,9 +2667,9 @@ var MRT_ToggleFiltersButton = function MRT_ToggleFiltersButton(_ref) {
|
|
|
2458
2667
|
|
|
2459
2668
|
return React.createElement(Tooltip, {
|
|
2460
2669
|
arrow: true,
|
|
2461
|
-
title: localization.
|
|
2670
|
+
title: localization.showHideFilters
|
|
2462
2671
|
}, React.createElement(IconButton, Object.assign({
|
|
2463
|
-
"aria-label": localization.
|
|
2672
|
+
"aria-label": localization.showHideFilters,
|
|
2464
2673
|
onClick: function onClick() {
|
|
2465
2674
|
return setShowFilters(!showFilters);
|
|
2466
2675
|
},
|
|
@@ -2492,7 +2701,7 @@ var MRT_ToggleSearchButton = function MRT_ToggleSearchButton(_ref) {
|
|
|
2492
2701
|
|
|
2493
2702
|
return React.createElement(Tooltip, {
|
|
2494
2703
|
arrow: true,
|
|
2495
|
-
title: localization.
|
|
2704
|
+
title: localization.showHideSearch
|
|
2496
2705
|
}, React.createElement(IconButton, Object.assign({
|
|
2497
2706
|
size: "small",
|
|
2498
2707
|
onClick: handleToggleSearch
|
|
@@ -2567,7 +2776,7 @@ var MRT_TablePagination = function MRT_TablePagination() {
|
|
|
2567
2776
|
};
|
|
2568
2777
|
|
|
2569
2778
|
var MRT_ToolbarAlertBanner = function MRT_ToolbarAlertBanner() {
|
|
2570
|
-
var _localization$
|
|
2779
|
+
var _localization$selecte, _localization$selecte2;
|
|
2571
2780
|
|
|
2572
2781
|
var _useMRT = useMRT(),
|
|
2573
2782
|
muiTableToolbarAlertBannerProps = _useMRT.muiTableToolbarAlertBannerProps,
|
|
@@ -2579,13 +2788,13 @@ var MRT_ToolbarAlertBanner = function MRT_ToolbarAlertBanner() {
|
|
|
2579
2788
|
|
|
2580
2789
|
var isMobile = useMediaQuery('(max-width:720px)');
|
|
2581
2790
|
var alertProps = muiTableToolbarAlertBannerProps instanceof Function ? muiTableToolbarAlertBannerProps(tableInstance) : muiTableToolbarAlertBannerProps;
|
|
2582
|
-
var selectMessage = tableInstance.selectedFlatRows.length > 0 ? (_localization$
|
|
2583
|
-
var groupedByMessage = tableInstance.state.groupBy.length > 0 ? React.createElement("span", null, localization.
|
|
2791
|
+
var selectMessage = tableInstance.selectedFlatRows.length > 0 ? (_localization$selecte = localization.selectedCountOfRowCountRowsSelected) == null ? void 0 : (_localization$selecte2 = _localization$selecte.replace('{selectedCount}', tableInstance.selectedFlatRows.length.toString())) == null ? void 0 : _localization$selecte2.replace('{rowCount}', tableInstance.flatRows.length.toString()) : null;
|
|
2792
|
+
var groupedByMessage = tableInstance.state.groupBy.length > 0 ? React.createElement("span", null, localization.groupedBy, ' ', tableInstance.state.groupBy.map(function (columnId, index) {
|
|
2584
2793
|
var _tableInstance$allCol;
|
|
2585
2794
|
|
|
2586
2795
|
return React.createElement(Fragment, {
|
|
2587
2796
|
key: index + "-" + columnId
|
|
2588
|
-
}, index > 0 ? localization.
|
|
2797
|
+
}, index > 0 ? localization.thenBy : '', React.createElement(Chip, {
|
|
2589
2798
|
color: "secondary",
|
|
2590
2799
|
label: (_tableInstance$allCol = tableInstance.allColumns.find(function (column) {
|
|
2591
2800
|
return column.id === columnId;
|
|
@@ -2757,50 +2966,50 @@ var MRT_TableContainer = function MRT_TableContainer() {
|
|
|
2757
2966
|
};
|
|
2758
2967
|
|
|
2759
2968
|
var MRT_DefaultLocalization_EN = {
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2969
|
+
actions: 'Actions',
|
|
2970
|
+
cancel: 'Cancel',
|
|
2971
|
+
changeFilterMode: 'Change filter mode',
|
|
2972
|
+
clearFilter: 'Clear filter',
|
|
2973
|
+
clearSearch: 'Clear search',
|
|
2974
|
+
clearSort: 'Clear sort',
|
|
2975
|
+
columnActions: 'Column Actions',
|
|
2976
|
+
edit: 'Edit',
|
|
2977
|
+
expand: 'Expand',
|
|
2978
|
+
expandAll: 'Expand all',
|
|
2979
|
+
filterByColumn: 'Filter by {column}',
|
|
2980
|
+
filterContains: 'Contains Exact',
|
|
2981
|
+
filterEmpty: 'Empty',
|
|
2982
|
+
filterEndsWith: 'Ends With',
|
|
2983
|
+
filterEquals: 'Equals',
|
|
2984
|
+
filterFuzzy: 'Fuzzy Match',
|
|
2985
|
+
filterGreaterThan: 'Greater Than',
|
|
2986
|
+
filterLessThan: 'Less Than',
|
|
2987
|
+
filterMode: 'Filter Mode: {filterType}',
|
|
2988
|
+
filterNotEmpty: 'Not Empty',
|
|
2989
|
+
filterNotEquals: 'Not Equals',
|
|
2990
|
+
filterStartsWith: 'Starts With',
|
|
2991
|
+
filteringByColumn: 'Filtering by {column} - {filterType} "{filterValue}"',
|
|
2992
|
+
groupByColumn: 'Group by {column}',
|
|
2993
|
+
groupedBy: 'Grouped by ',
|
|
2994
|
+
hideAll: 'Hide all',
|
|
2995
|
+
hideColumn: 'Hide {column} column',
|
|
2996
|
+
rowActions: 'Row Actions',
|
|
2997
|
+
save: 'Save',
|
|
2998
|
+
search: 'Search',
|
|
2999
|
+
selectedCountOfRowCountRowsSelected: '{selectedCount} of {rowCount} row(s) selected',
|
|
3000
|
+
showAll: 'Show all',
|
|
3001
|
+
showAllColumns: 'Show all columns',
|
|
3002
|
+
showHideColumns: 'Show/Hide columns',
|
|
3003
|
+
showHideFilters: 'Show/Hide filters',
|
|
3004
|
+
showHideSearch: 'Show/Hide search',
|
|
3005
|
+
sortByColumnAsc: 'Sort by {column} ascending',
|
|
3006
|
+
sortByColumnDesc: 'Sort by {column} descending',
|
|
3007
|
+
thenBy: ', then by ',
|
|
3008
|
+
toggleDensePadding: 'Toggle dense padding',
|
|
3009
|
+
toggleFullScreen: 'Toggle full screen',
|
|
3010
|
+
toggleSelectAll: 'Toggle select all',
|
|
3011
|
+
toggleSelectRow: 'Toggle select row',
|
|
3012
|
+
ungroupByColumn: 'Ungroup by {column}'
|
|
2804
3013
|
};
|
|
2805
3014
|
|
|
2806
3015
|
var MRT_Default_Icons = {
|