material-react-table 0.3.0 → 0.3.1
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 +46 -44
- package/dist/buttons/MRT_EditActionButtons.d.ts +7 -0
- package/dist/buttons/MRT_ToggleFiltersButton.d.ts +4 -0
- package/dist/buttons/MRT_ToggleRowActionMenuButton.d.ts +7 -0
- package/dist/head/MRT_TableHeadCell.d.ts +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/inputs/MRT_DensePaddingSwitch.d.ts +5 -0
- package/dist/material-react-table.cjs.development.js +1459 -412
- 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 +1474 -427
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/menus/MRT_RowActionMenu.d.ts +9 -0
- package/dist/{footer → toolbar}/MRT_TablePagination.d.ts +0 -0
- package/dist/toolbar/MRT_ToolbarBottom.d.ts +5 -0
- package/dist/toolbar/MRT_ToolbarButtons.d.ts +5 -0
- package/dist/toolbar/{MRT_Toolbar.d.ts → MRT_ToolbarTop.d.ts} +1 -1
- package/dist/useMaterialReactTable.d.ts +7 -1
- package/dist/utils/localization.d.ts +22 -14
- package/package.json +15 -13
- package/src/MaterialReactTable.tsx +117 -100
- package/src/body/MRT_TableBody.tsx +26 -27
- package/src/body/MRT_TableBodyCell.tsx +17 -6
- package/src/body/MRT_TableBodyRow.tsx +39 -23
- package/src/body/MRT_TableDetailPanel.tsx +38 -14
- package/src/buttons/MRT_EditActionButtons.tsx +51 -0
- package/src/buttons/MRT_ExpandAllButton.tsx +9 -4
- package/src/buttons/MRT_ExpandButton.tsx +12 -6
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +12 -12
- package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +1 -1
- package/src/buttons/MRT_ToggleFiltersButton.tsx +23 -0
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +65 -0
- package/src/footer/MRT_TableFooter.tsx +2 -17
- package/src/footer/MRT_TableFooterCell.tsx +18 -7
- package/src/footer/MRT_TableFooterRow.tsx +28 -14
- package/src/head/MRT_TableHead.tsx +6 -18
- package/src/head/MRT_TableHeadCell.tsx +37 -17
- package/src/head/MRT_TableHeadRow.tsx +42 -14
- package/src/index.tsx +2 -5
- package/src/inputs/MRT_DensePaddingSwitch.tsx +21 -0
- package/src/inputs/MRT_FilterTextField.tsx +5 -0
- package/src/inputs/MRT_SearchTextField.tsx +4 -4
- package/src/inputs/MRT_SelectAllCheckbox.tsx +11 -3
- package/src/inputs/MRT_SelectCheckbox.tsx +9 -2
- package/src/menus/MRT_ColumnActionMenu.tsx +29 -24
- package/src/menus/MRT_RowActionMenu.tsx +52 -0
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +2 -2
- package/src/table/MRT_Table.tsx +13 -4
- package/src/table/MRT_TableContainer.tsx +9 -5
- package/src/table/MRT_TableSpacerCell.tsx +17 -1
- package/src/toolbar/MRT_TablePagination.tsx +37 -0
- package/src/toolbar/MRT_ToolbarBottom.tsx +58 -0
- package/src/toolbar/MRT_ToolbarButtons.tsx +27 -0
- package/src/toolbar/MRT_ToolbarTop.tsx +81 -0
- package/src/useMaterialReactTable.tsx +36 -32
- package/src/utils/localization.ts +32 -16
- package/dist/utils/overrideWarnings.d.ts +0 -1
- package/src/footer/MRT_TablePagination.tsx +0 -42
- package/src/toolbar/MRT_Toolbar.tsx +0 -39
- package/src/utils/overrideWarnings.ts +0 -41
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useMemo, useContext, createContext
|
|
2
|
-
import { useTable,
|
|
3
|
-
import { TextField as TextField$1, InputAdornment, IconButton as IconButton$
|
|
1
|
+
import React, { useMemo, useState, useContext, createContext } from 'react';
|
|
2
|
+
import { useTable, useResizeColumns, useFilters, useGlobalFilter, useGroupBy, useSortBy, useExpanded, usePagination, useRowSelect, useFlexLayout, useAsyncDebounce } from 'react-table';
|
|
3
|
+
import { TextField as TextField$1, InputAdornment, IconButton as IconButton$2, Menu, Divider as Divider$1, styled, MenuItem as MenuItem$2, TableCell as TableCell$1, TableSortLabel, Collapse, Checkbox, TableRow, TableHead, Tooltip, useTheme, alpha, CircularProgress, TableBody as TableBody$1, TableFooter, Table, FormControlLabel, Switch, Typography, TablePagination, Toolbar as Toolbar$2, TableContainer, Paper, LinearProgress } from '@mui/material';
|
|
4
4
|
import CloseIcon from '@mui/icons-material/Close';
|
|
5
5
|
import FilterIcon from '@mui/icons-material/FilterList';
|
|
6
6
|
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
@@ -9,9 +9,50 @@ import SortIcon from '@mui/icons-material/Sort';
|
|
|
9
9
|
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
|
|
10
10
|
import DynamicFeedIcon from '@mui/icons-material/DynamicFeed';
|
|
11
11
|
import ArrowRightIcon from '@mui/icons-material/KeyboardDoubleArrowDown';
|
|
12
|
-
import ViewColumnIcon from '@mui/icons-material/ViewColumn';
|
|
13
12
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
13
|
+
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
|
|
14
|
+
import EditIcon from '@mui/icons-material/Edit';
|
|
15
|
+
import SaveIcon from '@mui/icons-material/Save';
|
|
16
|
+
import CancelIcon from '@mui/icons-material/Cancel';
|
|
14
17
|
import SearchIcon from '@mui/icons-material/Search';
|
|
18
|
+
import FilterListOffIcon from '@mui/icons-material/FilterListOff';
|
|
19
|
+
import ViewColumnIcon from '@mui/icons-material/ViewColumn';
|
|
20
|
+
|
|
21
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
22
|
+
try {
|
|
23
|
+
var info = gen[key](arg);
|
|
24
|
+
var value = info.value;
|
|
25
|
+
} catch (error) {
|
|
26
|
+
reject(error);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (info.done) {
|
|
31
|
+
resolve(value);
|
|
32
|
+
} else {
|
|
33
|
+
Promise.resolve(value).then(_next, _throw);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function _asyncToGenerator(fn) {
|
|
38
|
+
return function () {
|
|
39
|
+
var self = this,
|
|
40
|
+
args = arguments;
|
|
41
|
+
return new Promise(function (resolve, reject) {
|
|
42
|
+
var gen = fn.apply(self, args);
|
|
43
|
+
|
|
44
|
+
function _next(value) {
|
|
45
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _throw(err) {
|
|
49
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
_next(undefined);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
}
|
|
15
56
|
|
|
16
57
|
function _extends() {
|
|
17
58
|
_extends = Object.assign || function (target) {
|
|
@@ -76,97 +117,44 @@ var useMRTCalcs = function useMRTCalcs(_ref) {
|
|
|
76
117
|
};
|
|
77
118
|
};
|
|
78
119
|
|
|
79
|
-
var showoverrideWarnings = function showoverrideWarnings(props) {
|
|
80
|
-
if (props.overrideTableBodyCellComponent) {
|
|
81
|
-
showWarning('TableCell', 'props');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (props.overrideTableBodyComponent) {
|
|
85
|
-
showWarning('TableBody', 'tableBodyProps');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (props.overrideTableBodyRowComponent) {
|
|
89
|
-
showWarning('TableRow', 'props');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (props.overrideTableDetailPanelComponent) {
|
|
93
|
-
showWarning('Detail Panel', 'tableDetailPanelProps');
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (props.overrideTableFooterComponent) {
|
|
97
|
-
showWarning('TableFooter', 'tableFooterProps');
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (props.overrideTableFooterCellComponent) {
|
|
101
|
-
showWarning('TableCell', 'props');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (props.overrideTableFooterRowComponent) {
|
|
105
|
-
showWarning('TableRow', 'props');
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (props.overrideTableHeadComponent) {
|
|
109
|
-
showWarning('TableHead', 'tableHeadProps');
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (props.overrideTableHeadRowComponent) {
|
|
113
|
-
showWarning('TableRow', 'props');
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (props.overrideTablePaginationComponent) {
|
|
117
|
-
showWarning('', 'props');
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (props.overrideTableToolbarComponent) {
|
|
121
|
-
showWarning('TableBodyCell', 'props');
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
var showWarning = function showWarning(componentName, propsName) {
|
|
126
|
-
console.warn("Caution.\nYou are overriding the built-in Mui " + componentName + " Component in material-react-table.\n\nYou should only use this as a last resort!\n\nConsider customizing the Mui " + componentName + " Component instead with " + propsName + ".");
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
var _excluded = ["children", "columns", "data", "defaultColumn", "getRowId", "getSubRows", "initialState", "stateReducer", "surpressoverrideWarnings"];
|
|
130
|
-
|
|
131
120
|
var MaterialReactTableContext = /*#__PURE__*/function () {
|
|
132
121
|
return createContext({});
|
|
133
122
|
}();
|
|
134
123
|
|
|
135
|
-
var MaterialReactTableProvider = function MaterialReactTableProvider(
|
|
136
|
-
var
|
|
137
|
-
columns = _ref.columns,
|
|
138
|
-
data = _ref.data,
|
|
139
|
-
defaultColumn = _ref.defaultColumn,
|
|
140
|
-
getRowId = _ref.getRowId,
|
|
141
|
-
getSubRows = _ref.getSubRows,
|
|
142
|
-
initialState = _ref.initialState,
|
|
143
|
-
stateReducer = _ref.stateReducer,
|
|
144
|
-
surpressoverrideWarnings = _ref.surpressoverrideWarnings,
|
|
145
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
124
|
+
var MaterialReactTableProvider = function MaterialReactTableProvider(props) {
|
|
125
|
+
var _props$defaultShowFil, _props$defaultDensePa;
|
|
146
126
|
|
|
147
|
-
var
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
defaultColumn: defaultColumn,
|
|
151
|
-
getRowId: getRowId,
|
|
152
|
-
getSubRows: getSubRows,
|
|
153
|
-
initialState: initialState,
|
|
154
|
-
stateReducer: stateReducer
|
|
155
|
-
}, useFlexLayout, useResizeColumns, useFilters, useGlobalFilter, useGroupBy, useSortBy, useExpanded, usePagination, useRowSelect);
|
|
127
|
+
var hooks = [useResizeColumns, useFilters, useGlobalFilter, useGroupBy, useSortBy, useExpanded, usePagination, useRowSelect];
|
|
128
|
+
if (props.enableColumnResizing) hooks.unshift(useFlexLayout);
|
|
129
|
+
var tableInstance = useTable.apply(void 0, [props].concat(hooks));
|
|
156
130
|
var mrtCalcs = useMRTCalcs({
|
|
157
131
|
tableInstance: tableInstance
|
|
158
132
|
});
|
|
159
133
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
134
|
+
var _useState = useState((_props$defaultShowFil = props.defaultShowFilters) != null ? _props$defaultShowFil : false),
|
|
135
|
+
showFilters = _useState[0],
|
|
136
|
+
setShowFilters = _useState[1];
|
|
137
|
+
|
|
138
|
+
var _useState2 = useState((_props$defaultDensePa = props.defaultDensePadding) != null ? _props$defaultDensePa : false),
|
|
139
|
+
densePadding = _useState2[0],
|
|
140
|
+
setDensePadding = _useState2[1];
|
|
141
|
+
|
|
142
|
+
var _useState3 = useState(null),
|
|
143
|
+
currentEditingRowId = _useState3[0],
|
|
144
|
+
setCurrentEditingRowId = _useState3[1];
|
|
163
145
|
|
|
164
146
|
return React.createElement(MaterialReactTableContext.Provider, {
|
|
165
|
-
value: _extends({
|
|
166
|
-
|
|
147
|
+
value: _extends({}, mrtCalcs, props, {
|
|
148
|
+
densePadding: densePadding,
|
|
149
|
+
setDensePadding: setDensePadding,
|
|
150
|
+
setShowFilters: setShowFilters,
|
|
151
|
+
currentEditingRowId: currentEditingRowId,
|
|
152
|
+
setCurrentEditingRowId: setCurrentEditingRowId,
|
|
153
|
+
showFilters: showFilters,
|
|
154
|
+
// @ts-ignore
|
|
167
155
|
tableInstance: tableInstance
|
|
168
|
-
}
|
|
169
|
-
}, children);
|
|
156
|
+
})
|
|
157
|
+
}, props.children);
|
|
170
158
|
};
|
|
171
159
|
var useMaterialReactTable = function useMaterialReactTable() {
|
|
172
160
|
return (//@ts-ignore
|
|
@@ -193,6 +181,13 @@ var MRT_FilterTextfield = function MRT_FilterTextfield(_ref) {
|
|
|
193
181
|
column.setFilter(undefined);
|
|
194
182
|
};
|
|
195
183
|
|
|
184
|
+
if (column.Filter) {
|
|
185
|
+
//@ts-ignore
|
|
186
|
+
return React.createElement(React.Fragment, null, column.Filter({
|
|
187
|
+
column: column
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
|
|
196
191
|
return React.createElement(TextField$1, {
|
|
197
192
|
margin: "dense",
|
|
198
193
|
placeholder: localization == null ? void 0 : localization.filterTextFieldPlaceholder,
|
|
@@ -211,7 +206,7 @@ var MRT_FilterTextfield = function MRT_FilterTextfield(_ref) {
|
|
|
211
206
|
}, React.createElement(FilterIcon, null)),
|
|
212
207
|
endAdornment: React.createElement(InputAdornment, {
|
|
213
208
|
position: "end"
|
|
214
|
-
}, React.createElement(IconButton$
|
|
209
|
+
}, React.createElement(IconButton$2, {
|
|
215
210
|
"aria-label": localization == null ? void 0 : localization.filterTextFieldClearButtonTitle,
|
|
216
211
|
disabled: (filterValue == null ? void 0 : filterValue.length) === 0,
|
|
217
212
|
onClick: handleClear,
|
|
@@ -224,7 +219,7 @@ var MRT_FilterTextfield = function MRT_FilterTextfield(_ref) {
|
|
|
224
219
|
});
|
|
225
220
|
};
|
|
226
221
|
|
|
227
|
-
var MenuItem = /*#__PURE__*/styled(MenuItem$
|
|
222
|
+
var MenuItem = /*#__PURE__*/styled(MenuItem$2)({
|
|
228
223
|
display: 'flex',
|
|
229
224
|
gap: '0.75rem'
|
|
230
225
|
});
|
|
@@ -234,9 +229,9 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
|
234
229
|
setAnchorEl = _ref.setAnchorEl;
|
|
235
230
|
|
|
236
231
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
237
|
-
|
|
232
|
+
disableColumnHiding = _useMaterialReactTabl.disableColumnHiding,
|
|
238
233
|
enableColumnGrouping = _useMaterialReactTabl.enableColumnGrouping,
|
|
239
|
-
|
|
234
|
+
disableSortBy = _useMaterialReactTabl.disableSortBy,
|
|
240
235
|
localization = _useMaterialReactTabl.localization;
|
|
241
236
|
|
|
242
237
|
var handleClearSort = function handleClearSort() {
|
|
@@ -270,7 +265,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
|
270
265
|
onClose: function onClose() {
|
|
271
266
|
return setAnchorEl(null);
|
|
272
267
|
}
|
|
273
|
-
},
|
|
268
|
+
}, !disableSortBy && column.canSort && [React.createElement(MenuItem, {
|
|
274
269
|
key: 1,
|
|
275
270
|
disabled: !column.isSorted,
|
|
276
271
|
onClick: handleClearSort
|
|
@@ -288,7 +283,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
|
288
283
|
}
|
|
289
284
|
}), ' ', localization == null ? void 0 : localization.columnActionMenuItemSortDesc), React.createElement(Divider$1, {
|
|
290
285
|
key: 4
|
|
291
|
-
})],
|
|
286
|
+
})], !disableColumnHiding && React.createElement(MenuItem, {
|
|
292
287
|
onClick: handleHideColumn
|
|
293
288
|
}, React.createElement(VisibilityOffIcon, null), " ", localization == null ? void 0 : localization.columnActionMenuItemHideColumn), enableColumnGrouping && column.canGroupBy && React.createElement(MenuItem, {
|
|
294
289
|
disabled: column.isGrouped,
|
|
@@ -299,8 +294,8 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
|
299
294
|
}, React.createElement(DynamicFeedIcon, null), " ", localization == null ? void 0 : localization.columnActionMenuItemUnGroupBy));
|
|
300
295
|
};
|
|
301
296
|
|
|
302
|
-
var IconButton = /*#__PURE__*/styled(IconButton$
|
|
303
|
-
opacity: 0.
|
|
297
|
+
var IconButton = /*#__PURE__*/styled(IconButton$2)({
|
|
298
|
+
opacity: 0.5,
|
|
304
299
|
transition: 'opacity 0.2s',
|
|
305
300
|
marginRight: '2px',
|
|
306
301
|
height: '2rem',
|
|
@@ -337,8 +332,9 @@ var MRT_ToggleColumnActionMenuButton = function MRT_ToggleColumnActionMenuButton
|
|
|
337
332
|
}));
|
|
338
333
|
};
|
|
339
334
|
|
|
340
|
-
var
|
|
341
|
-
fontWeight: 'bold'
|
|
335
|
+
var StyledTableHeadCell = /*#__PURE__*/styled(TableCell$1)({
|
|
336
|
+
fontWeight: 'bold',
|
|
337
|
+
verticalAlign: 'text-top'
|
|
342
338
|
});
|
|
343
339
|
var TableCellContents = /*#__PURE__*/styled('div')({
|
|
344
340
|
display: 'grid'
|
|
@@ -350,7 +346,8 @@ var TableCellText = /*#__PURE__*/styled('div')({
|
|
|
350
346
|
});
|
|
351
347
|
var CellFlexItem = /*#__PURE__*/styled('span')({
|
|
352
348
|
display: 'flex',
|
|
353
|
-
flexWrap: 'nowrap'
|
|
349
|
+
flexWrap: 'nowrap',
|
|
350
|
+
alignItems: 'center'
|
|
354
351
|
});
|
|
355
352
|
var Divider = /*#__PURE__*/styled(Divider$1)({
|
|
356
353
|
borderRightWidth: '2px',
|
|
@@ -358,36 +355,44 @@ var Divider = /*#__PURE__*/styled(Divider$1)({
|
|
|
358
355
|
maxHeight: '2rem'
|
|
359
356
|
});
|
|
360
357
|
var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
361
|
-
var _column$columns$lengt, _column$columns
|
|
358
|
+
var _column$columns$lengt, _column$columns, _mTableHeadCellProps$;
|
|
362
359
|
|
|
363
360
|
var column = _ref.column;
|
|
364
361
|
|
|
365
362
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
366
|
-
|
|
367
|
-
|
|
363
|
+
densePadding = _useMaterialReactTabl.densePadding,
|
|
364
|
+
disableColumnActions = _useMaterialReactTabl.disableColumnActions,
|
|
365
|
+
disableFilters = _useMaterialReactTabl.disableFilters,
|
|
368
366
|
enableColumnResizing = _useMaterialReactTabl.enableColumnResizing,
|
|
369
|
-
|
|
370
|
-
|
|
367
|
+
localization = _useMaterialReactTabl.localization,
|
|
368
|
+
muiTableHeadCellProps = _useMaterialReactTabl.muiTableHeadCellProps,
|
|
369
|
+
showFilters = _useMaterialReactTabl.showFilters,
|
|
371
370
|
tableInstance = _useMaterialReactTabl.tableInstance;
|
|
372
371
|
|
|
373
|
-
if (overrideTableHeadCellComponent) {
|
|
374
|
-
return React.createElement(React.Fragment, null, overrideTableHeadCellComponent(column, tableInstance));
|
|
375
|
-
}
|
|
376
|
-
|
|
377
372
|
var isParentHeader = ((_column$columns$lengt = column == null ? void 0 : (_column$columns = column.columns) == null ? void 0 : _column$columns.length) != null ? _column$columns$lengt : 0) > 0;
|
|
378
|
-
|
|
373
|
+
var mTableHeadCellProps = muiTableHeadCellProps instanceof Function ? muiTableHeadCellProps(column) : muiTableHeadCellProps;
|
|
374
|
+
|
|
375
|
+
var tableCellProps = _extends({}, mTableHeadCellProps, column.getHeaderProps(), {
|
|
376
|
+
style: _extends({
|
|
377
|
+
padding: densePadding ? '0.5rem' : '1rem',
|
|
378
|
+
transition: "all " + (enableColumnResizing ? '10ms' : '0.2s') + " ease-in-out"
|
|
379
|
+
}, column.getHeaderProps().style, (_mTableHeadCellProps$ = mTableHeadCellProps == null ? void 0 : mTableHeadCellProps.style) != null ? _mTableHeadCellProps$ : {})
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
return React.createElement(StyledTableHeadCell, Object.assign({
|
|
379
383
|
align: isParentHeader ? 'center' : 'left'
|
|
380
|
-
},
|
|
384
|
+
}, tableCellProps), React.createElement(TableCellContents, null, React.createElement(TableCellText, {
|
|
381
385
|
style: {
|
|
382
386
|
justifyContent: isParentHeader ? 'center' : undefined
|
|
383
387
|
}
|
|
384
388
|
}, React.createElement(CellFlexItem, Object.assign({}, column.getSortByToggleProps()), column.render('Header'), !isParentHeader && column.canSort && React.createElement(TableSortLabel, {
|
|
389
|
+
"aria-label": column.isSorted ? column.sortDescFirst ? localization == null ? void 0 : localization.columnActionMenuItemClearSort : localization == null ? void 0 : localization.columnActionMenuItemSortDesc : localization == null ? void 0 : localization.columnActionMenuItemSortAsc,
|
|
385
390
|
active: column.isSorted,
|
|
386
391
|
direction: column.isSortedDesc ? 'desc' : 'asc',
|
|
387
392
|
style: {
|
|
388
393
|
margin: 0
|
|
389
394
|
}
|
|
390
|
-
})), React.createElement(CellFlexItem, null,
|
|
395
|
+
})), React.createElement(CellFlexItem, null, !disableColumnActions && !isParentHeader && React.createElement(MRT_ToggleColumnActionMenuButton, {
|
|
391
396
|
column: column
|
|
392
397
|
}), enableColumnResizing && !isParentHeader && React.createElement(Divider, Object.assign({
|
|
393
398
|
flexItem: true,
|
|
@@ -395,8 +400,8 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
395
400
|
onDoubleClick: function onDoubleClick() {
|
|
396
401
|
return tableInstance.resetResizing();
|
|
397
402
|
}
|
|
398
|
-
}, column.getResizerProps())))),
|
|
399
|
-
"in":
|
|
403
|
+
}, column.getResizerProps())))), !disableFilters && column.canFilter && React.createElement(Collapse, {
|
|
404
|
+
"in": showFilters
|
|
400
405
|
}, React.createElement(MRT_FilterTextfield, {
|
|
401
406
|
column: column
|
|
402
407
|
}))));
|
|
@@ -405,15 +410,17 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
405
410
|
var MRT_SelectAllCheckbox = function MRT_SelectAllCheckbox() {
|
|
406
411
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
407
412
|
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
408
|
-
|
|
413
|
+
disableSelectAll = _useMaterialReactTabl.disableSelectAll,
|
|
414
|
+
densePadding = _useMaterialReactTabl.densePadding;
|
|
409
415
|
|
|
410
|
-
return React.createElement(TableCell$
|
|
416
|
+
return React.createElement(TableCell$1, {
|
|
411
417
|
style: {
|
|
412
418
|
width: '2rem',
|
|
413
|
-
padding: '0.
|
|
419
|
+
padding: densePadding ? '0' : '0.6rem',
|
|
420
|
+
transition: 'all 0.2s ease-in-out'
|
|
414
421
|
},
|
|
415
422
|
variant: "head"
|
|
416
|
-
},
|
|
423
|
+
}, !disableSelectAll ? React.createElement(Checkbox, Object.assign({
|
|
417
424
|
"aria-label": ""
|
|
418
425
|
}, tableInstance.getToggleAllPageRowsSelectedProps())) : null);
|
|
419
426
|
};
|
|
@@ -423,17 +430,18 @@ var MRT_ExpandAllButton = function MRT_ExpandAllButton() {
|
|
|
423
430
|
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
424
431
|
localization = _useMaterialReactTabl.localization,
|
|
425
432
|
anyRowsExpanded = _useMaterialReactTabl.anyRowsExpanded,
|
|
433
|
+
densePadding = _useMaterialReactTabl.densePadding,
|
|
426
434
|
renderDetailPanel = _useMaterialReactTabl.renderDetailPanel;
|
|
427
435
|
|
|
428
|
-
return React.createElement(TableCell$
|
|
436
|
+
return React.createElement(TableCell$1, Object.assign({
|
|
429
437
|
size: "small"
|
|
430
438
|
}, tableInstance.getToggleAllRowsExpandedProps(), {
|
|
431
439
|
style: {
|
|
432
|
-
padding: '0.5rem',
|
|
433
|
-
|
|
440
|
+
padding: densePadding ? '0' : '0.5rem 0.5rem',
|
|
441
|
+
transition: 'all 0.2s ease-in-out',
|
|
434
442
|
width: (renderDetailPanel ? 2 : tableInstance.expandedDepth + 2) + "rem"
|
|
435
443
|
}
|
|
436
|
-
}), React.createElement(IconButton$
|
|
444
|
+
}), React.createElement(IconButton$2, {
|
|
437
445
|
"aria-label": localization == null ? void 0 : localization.expandAllButtonTitle,
|
|
438
446
|
title: localization == null ? void 0 : localization.expandAllButtonTitle
|
|
439
447
|
}, React.createElement(ArrowRightIcon, {
|
|
@@ -445,100 +453,41 @@ var MRT_ExpandAllButton = function MRT_ExpandAllButton() {
|
|
|
445
453
|
})));
|
|
446
454
|
};
|
|
447
455
|
|
|
448
|
-
var
|
|
449
|
-
var
|
|
450
|
-
|
|
451
|
-
var column = _ref.column;
|
|
452
|
-
|
|
453
|
-
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
454
|
-
maxColumnDepth = _useMaterialReactTabl.maxColumnDepth;
|
|
456
|
+
var MRT_TableSpacerCell = function MRT_TableSpacerCell(_ref) {
|
|
457
|
+
var _mTableBodyRowProps$s;
|
|
455
458
|
|
|
456
|
-
var
|
|
457
|
-
return React.createElement(React.Fragment, null, React.createElement(MenuItem$1, {
|
|
458
|
-
style: {
|
|
459
|
-
paddingLeft: column.depth + 1 + "rem"
|
|
460
|
-
}
|
|
461
|
-
}, isMaxDepth ? React.createElement(FormControlLabel, {
|
|
462
|
-
onChange: function onChange() {
|
|
463
|
-
return isMaxDepth && column.toggleHidden();
|
|
464
|
-
},
|
|
465
|
-
label: column.Header,
|
|
466
|
-
checked: column.isVisible,
|
|
467
|
-
control: React.createElement(Switch, null)
|
|
468
|
-
}) : React.createElement(Typography, null, column.Header)), (_column$columns = column.columns) == null ? void 0 : _column$columns.map(function (c, i) {
|
|
469
|
-
return React.createElement(MRT_ShowHideColumnsMenu, {
|
|
470
|
-
key: i + "-" + c.id,
|
|
471
|
-
column: c
|
|
472
|
-
});
|
|
473
|
-
}));
|
|
474
|
-
};
|
|
459
|
+
var width = _ref.width;
|
|
475
460
|
|
|
476
|
-
var MRT_ShowHideColumnsButton = function MRT_ShowHideColumnsButton() {
|
|
477
461
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
478
|
-
|
|
479
|
-
localization = _useMaterialReactTabl.localization;
|
|
480
|
-
|
|
481
|
-
var _useState = useState(null),
|
|
482
|
-
anchorEl = _useState[0],
|
|
483
|
-
setAnchorEl = _useState[1];
|
|
484
|
-
|
|
485
|
-
var handleClick = function handleClick(event) {
|
|
486
|
-
setAnchorEl(event.currentTarget);
|
|
487
|
-
};
|
|
462
|
+
muiTableBodyCellProps = _useMaterialReactTabl.muiTableBodyCellProps;
|
|
488
463
|
|
|
489
|
-
|
|
490
|
-
size: "small",
|
|
491
|
-
style: {
|
|
492
|
-
width: '2rem',
|
|
493
|
-
padding: '0.75rem 0'
|
|
494
|
-
}
|
|
495
|
-
}, React.createElement(IconButton$1, {
|
|
496
|
-
"aria-label": localization == null ? void 0 : localization.showHideColumnsButtonTitle,
|
|
497
|
-
title: localization == null ? void 0 : localization.showHideColumnsButtonTitle,
|
|
498
|
-
onClick: handleClick,
|
|
499
|
-
size: "small",
|
|
500
|
-
style: {
|
|
501
|
-
margin: '0 0 0 -0.75rem'
|
|
502
|
-
}
|
|
503
|
-
}, React.createElement(ViewColumnIcon, null)), React.createElement(Menu, {
|
|
504
|
-
anchorEl: anchorEl,
|
|
505
|
-
open: !!anchorEl,
|
|
506
|
-
onClose: function onClose() {
|
|
507
|
-
return setAnchorEl(null);
|
|
508
|
-
}
|
|
509
|
-
}, tableInstance.columns.map(function (column, index) {
|
|
510
|
-
return React.createElement(MRT_ShowHideColumnsMenu, {
|
|
511
|
-
key: index + "-" + column.id,
|
|
512
|
-
column: column
|
|
513
|
-
});
|
|
514
|
-
})));
|
|
515
|
-
};
|
|
464
|
+
var mTableBodyRowProps = muiTableBodyCellProps instanceof Function ? muiTableBodyCellProps() : muiTableBodyCellProps;
|
|
516
465
|
|
|
517
|
-
var
|
|
518
|
-
|
|
519
|
-
return React.createElement(TableCell$2, {
|
|
520
|
-
style: {
|
|
466
|
+
var tableCellProps = _extends({}, mTableBodyRowProps, {
|
|
467
|
+
style: _extends({
|
|
521
468
|
width: width
|
|
522
|
-
}
|
|
469
|
+
}, (_mTableBodyRowProps$s = mTableBodyRowProps == null ? void 0 : mTableBodyRowProps.style) != null ? _mTableBodyRowProps$s : {})
|
|
523
470
|
});
|
|
471
|
+
|
|
472
|
+
return React.createElement(TableCell$1, Object.assign({}, tableCellProps));
|
|
524
473
|
};
|
|
525
474
|
|
|
526
475
|
var MRT_TableHeadRow = function MRT_TableHeadRow(_ref) {
|
|
476
|
+
var _mTableHeadRowProps$s;
|
|
477
|
+
|
|
527
478
|
var headerGroup = _ref.headerGroup;
|
|
528
479
|
|
|
529
480
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
530
|
-
overrideTableHeadRowComponent = _useMaterialReactTabl.overrideTableHeadRowComponent,
|
|
531
481
|
anyRowsCanExpand = _useMaterialReactTabl.anyRowsCanExpand,
|
|
532
|
-
|
|
533
|
-
|
|
482
|
+
disableExpandAll = _useMaterialReactTabl.disableExpandAll,
|
|
483
|
+
enableRowActions = _useMaterialReactTabl.enableRowActions,
|
|
534
484
|
enableSelection = _useMaterialReactTabl.enableSelection,
|
|
485
|
+
localization = _useMaterialReactTabl.localization,
|
|
486
|
+
muiTableHeadRowProps = _useMaterialReactTabl.muiTableHeadRowProps,
|
|
487
|
+
positionActionsColumn = _useMaterialReactTabl.positionActionsColumn,
|
|
535
488
|
renderDetailPanel = _useMaterialReactTabl.renderDetailPanel,
|
|
536
489
|
tableInstance = _useMaterialReactTabl.tableInstance;
|
|
537
490
|
|
|
538
|
-
if (overrideTableHeadRowComponent) {
|
|
539
|
-
return React.createElement(React.Fragment, null, overrideTableHeadRowComponent(headerGroup, tableInstance));
|
|
540
|
-
}
|
|
541
|
-
|
|
542
491
|
var isParentHeader = useMemo(function () {
|
|
543
492
|
return headerGroup.headers.some(function (h) {
|
|
544
493
|
var _h$columns$length, _h$columns;
|
|
@@ -546,61 +495,31 @@ var MRT_TableHeadRow = function MRT_TableHeadRow(_ref) {
|
|
|
546
495
|
return ((_h$columns$length = (_h$columns = h.columns) == null ? void 0 : _h$columns.length) != null ? _h$columns$length : 0) > 0;
|
|
547
496
|
});
|
|
548
497
|
}, [headerGroup.headers]);
|
|
549
|
-
|
|
498
|
+
var mTableHeadRowProps = muiTableHeadRowProps instanceof Function ? muiTableHeadRowProps(headerGroup) : muiTableHeadRowProps;
|
|
499
|
+
|
|
500
|
+
var tableRowProps = _extends({}, mTableHeadRowProps, headerGroup.getHeaderGroupProps(), {
|
|
501
|
+
style: _extends({}, headerGroup.getHeaderGroupProps().style, (_mTableHeadRowProps$s = mTableHeadRowProps == null ? void 0 : mTableHeadRowProps.style) != null ? _mTableHeadRowProps$s : {})
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
return React.createElement(TableRow, Object.assign({}, tableRowProps), enableRowActions && positionActionsColumn === 'first' && (isParentHeader ? React.createElement(MRT_TableSpacerCell, null) : React.createElement(StyledTableHeadCell, null, localization == null ? void 0 : localization.actionsHeadColumnTitle)), anyRowsCanExpand || renderDetailPanel ? !disableExpandAll && !isParentHeader ? React.createElement(MRT_ExpandAllButton, null) : React.createElement(MRT_TableSpacerCell, {
|
|
550
505
|
width: (renderDetailPanel ? 2 : tableInstance.expandedDepth + 0.5) + "rem"
|
|
551
506
|
}) : null, enableSelection ? !isParentHeader ? React.createElement(MRT_SelectAllCheckbox, null) : React.createElement(MRT_TableSpacerCell, {
|
|
552
507
|
width: "1rem"
|
|
553
|
-
}) : null, headerGroup.headers.map(function (column
|
|
508
|
+
}) : null, headerGroup.headers.map(function (column) {
|
|
554
509
|
return React.createElement(MRT_TableHeadCell, {
|
|
555
|
-
key:
|
|
510
|
+
key: column.getHeaderProps().key,
|
|
556
511
|
column: column
|
|
557
512
|
});
|
|
558
|
-
}),
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
var MRT_TablePagination = function MRT_TablePagination() {
|
|
562
|
-
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
563
|
-
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
564
|
-
tablePaginationProps = _useMaterialReactTabl.tablePaginationProps,
|
|
565
|
-
overrideTablePaginationComponent = _useMaterialReactTabl.overrideTablePaginationComponent;
|
|
566
|
-
|
|
567
|
-
var handleChangeRowsPerPage = function handleChangeRowsPerPage(event) {
|
|
568
|
-
tableInstance.setPageSize(+event.target.value);
|
|
569
|
-
tableInstance.gotoPage(0);
|
|
570
|
-
};
|
|
571
|
-
|
|
572
|
-
if (overrideTablePaginationComponent) {
|
|
573
|
-
return React.createElement(React.Fragment, null, overrideTablePaginationComponent(tableInstance));
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
return React.createElement(TableRow, null, React.createElement(TablePagination, Object.assign({
|
|
577
|
-
colSpan: tableInstance.visibleColumns.length + 10,
|
|
578
|
-
count: tableInstance.rows.length,
|
|
579
|
-
onPageChange: function onPageChange(_, newPage) {
|
|
580
|
-
return tableInstance.gotoPage(newPage);
|
|
581
|
-
},
|
|
582
|
-
onRowsPerPageChange: handleChangeRowsPerPage,
|
|
583
|
-
page: tableInstance.state.pageIndex,
|
|
584
|
-
rowsPerPage: tableInstance.state.pageSize,
|
|
585
|
-
showFirstButton: tableInstance.rows.length / tableInstance.state.pageSize > 2,
|
|
586
|
-
showLastButton: tableInstance.rows.length / tableInstance.state.pageSize > 2
|
|
587
|
-
}, tablePaginationProps)));
|
|
513
|
+
}), enableRowActions && positionActionsColumn === 'last' && (isParentHeader ? React.createElement(MRT_TableSpacerCell, null) : React.createElement(StyledTableHeadCell, null, localization == null ? void 0 : localization.actionsHeadColumnTitle)));
|
|
588
514
|
};
|
|
589
515
|
|
|
590
516
|
var MRT_TableHead = function MRT_TableHead() {
|
|
591
517
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
592
|
-
overrideTableHeadComponent = _useMaterialReactTabl.overrideTableHeadComponent,
|
|
593
518
|
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
594
|
-
|
|
595
|
-
enablePagination = _useMaterialReactTabl.enablePagination,
|
|
596
|
-
isFetching = _useMaterialReactTabl.isFetching,
|
|
597
|
-
positionPagination = _useMaterialReactTabl.positionPagination;
|
|
598
|
-
|
|
599
|
-
if (overrideTableHeadComponent) {
|
|
600
|
-
return React.createElement(React.Fragment, null, overrideTableHeadComponent(tableInstance));
|
|
601
|
-
}
|
|
519
|
+
muiTableHeadProps = _useMaterialReactTabl.muiTableHeadProps;
|
|
602
520
|
|
|
603
|
-
|
|
521
|
+
var tableHeadProps = muiTableHeadProps instanceof Function ? muiTableHeadProps(tableInstance) : muiTableHeadProps;
|
|
522
|
+
return React.createElement(TableHead, Object.assign({}, tableHeadProps), tableInstance.headerGroups.map(function (headerGroup, index) {
|
|
604
523
|
return React.createElement(MRT_TableHeadRow, {
|
|
605
524
|
key: index + "-" + headerGroup.id,
|
|
606
525
|
headerGroup: headerGroup
|
|
@@ -609,47 +528,68 @@ var MRT_TableHead = function MRT_TableHead() {
|
|
|
609
528
|
};
|
|
610
529
|
|
|
611
530
|
var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
531
|
+
var _mTableCellBodyProps$;
|
|
532
|
+
|
|
612
533
|
var cell = _ref.cell;
|
|
613
534
|
|
|
614
535
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
536
|
+
onCellClick = _useMaterialReactTabl.onCellClick,
|
|
537
|
+
muiTableBodyCellProps = _useMaterialReactTabl.muiTableBodyCellProps,
|
|
538
|
+
densePadding = _useMaterialReactTabl.densePadding;
|
|
618
539
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
}
|
|
540
|
+
var mTableCellBodyProps = muiTableBodyCellProps instanceof Function ? muiTableBodyCellProps(cell) : muiTableBodyCellProps;
|
|
541
|
+
|
|
542
|
+
var tableCellProps = _extends({}, mTableCellBodyProps, cell.getCellProps(), {
|
|
543
|
+
style: _extends({
|
|
544
|
+
padding: densePadding ? '0.5rem' : '1rem',
|
|
545
|
+
transition: 'all 0.2s ease-in-out'
|
|
546
|
+
}, cell.getCellProps().style, (_mTableCellBodyProps$ = mTableCellBodyProps == null ? void 0 : mTableCellBodyProps.style) != null ? _mTableCellBodyProps$ : {})
|
|
547
|
+
});
|
|
622
548
|
|
|
623
|
-
return React.createElement(TableCell$
|
|
549
|
+
return React.createElement(TableCell$1, Object.assign({
|
|
624
550
|
onClick: function onClick(event) {
|
|
625
551
|
return onCellClick == null ? void 0 : onCellClick(event, cell);
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
}, cell.getCellProps()), cell.isPlaceholder ? null : cell.isAggregated ? cell.render('Aggregated') : cell.isGrouped ? React.createElement("span", null, cell.render('Cell'), " (", cell.row.subRows.length, ")") : cell.render('Cell'));
|
|
552
|
+
}
|
|
553
|
+
}, tableCellProps), cell.isPlaceholder ? null : cell.isAggregated ? cell.render('Aggregated') : cell.isGrouped ? React.createElement("span", null, cell.render('Cell'), " (", cell.row.subRows.length, ")") : cell.render('Cell'));
|
|
629
554
|
};
|
|
630
555
|
|
|
631
556
|
var MRT_TableDetailPanel = function MRT_TableDetailPanel(_ref) {
|
|
557
|
+
var _mTableBodyRowProps$s;
|
|
558
|
+
|
|
632
559
|
var row = _ref.row;
|
|
633
560
|
|
|
634
561
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
635
562
|
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
636
563
|
renderDetailPanel = _useMaterialReactTabl.renderDetailPanel,
|
|
637
|
-
|
|
638
|
-
|
|
564
|
+
muiTableDetailPanelProps = _useMaterialReactTabl.muiTableDetailPanelProps,
|
|
565
|
+
muiTableBodyRowProps = _useMaterialReactTabl.muiTableBodyRowProps,
|
|
566
|
+
onDetailPanelClick = _useMaterialReactTabl.onDetailPanelClick;
|
|
639
567
|
|
|
640
|
-
|
|
641
|
-
return React.createElement(React.Fragment, null, overrideTableDetailPanelComponent(row, tableInstance));
|
|
642
|
-
}
|
|
568
|
+
var mTableBodyRowProps = muiTableBodyRowProps instanceof Function ? muiTableBodyRowProps(row) : muiTableBodyRowProps;
|
|
643
569
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
570
|
+
var tableRowProps = _extends({}, mTableBodyRowProps, row.getToggleRowExpandedProps(), {
|
|
571
|
+
style: _extends({}, row.getToggleRowExpandedProps().style, (_mTableBodyRowProps$s = mTableBodyRowProps == null ? void 0 : mTableBodyRowProps.style) != null ? _mTableBodyRowProps$s : {})
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
var mTableDetailPanelProps = muiTableDetailPanelProps instanceof Function ? muiTableDetailPanelProps(row) : muiTableDetailPanelProps;
|
|
575
|
+
|
|
576
|
+
var tableCellProps = _extends({}, mTableDetailPanelProps, {
|
|
577
|
+
style: _extends({
|
|
647
578
|
borderBottom: !row.isExpanded ? 'none' : undefined,
|
|
648
579
|
paddingBottom: row.isExpanded ? '1rem' : 0,
|
|
649
580
|
paddingTop: row.isExpanded ? '1rem' : 0,
|
|
650
|
-
transition: 'all 0.2s'
|
|
581
|
+
transition: 'all 0.2s ease-in-out'
|
|
582
|
+
}, (mTableDetailPanelProps == null ? void 0 : mTableDetailPanelProps.style) || {})
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
return React.createElement(TableRow, Object.assign({
|
|
586
|
+
hover: true
|
|
587
|
+
}, tableRowProps), React.createElement(TableCell$1, Object.assign({
|
|
588
|
+
colSpan: tableInstance.visibleColumns.length + 10,
|
|
589
|
+
onClick: function onClick(event) {
|
|
590
|
+
return onDetailPanelClick == null ? void 0 : onDetailPanelClick(event, row);
|
|
651
591
|
}
|
|
652
|
-
},
|
|
592
|
+
}, tableCellProps), React.createElement(Collapse, {
|
|
653
593
|
"in": row.isExpanded
|
|
654
594
|
}, renderDetailPanel == null ? void 0 : renderDetailPanel(row))));
|
|
655
595
|
};
|
|
@@ -660,24 +600,25 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
|
|
|
660
600
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
661
601
|
localization = _useMaterialReactTabl.localization,
|
|
662
602
|
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
603
|
+
densePadding = _useMaterialReactTabl.densePadding,
|
|
663
604
|
renderDetailPanel = _useMaterialReactTabl.renderDetailPanel;
|
|
664
605
|
|
|
665
|
-
return React.createElement(TableCell$
|
|
666
|
-
size: "small"
|
|
667
|
-
}, row.getToggleRowExpandedProps(), {
|
|
606
|
+
return React.createElement(TableCell$1, {
|
|
607
|
+
size: "small",
|
|
668
608
|
style: {
|
|
669
|
-
padding: '0.
|
|
670
|
-
paddingRight: '0',
|
|
609
|
+
padding: densePadding ? '0' : '0.6rem 0',
|
|
671
610
|
paddingLeft: row.depth + 0.5 + "rem",
|
|
611
|
+
transition: 'all 0.2s ease-in-out',
|
|
672
612
|
width: (renderDetailPanel ? 2 : tableInstance.expandedDepth - row.depth + 2) + "rem"
|
|
673
613
|
}
|
|
674
|
-
}
|
|
614
|
+
}, React.createElement(IconButton$2, Object.assign({
|
|
615
|
+
disabled: !row.canExpand && !renderDetailPanel,
|
|
675
616
|
"aria-label": localization == null ? void 0 : localization.expandButtonTitle,
|
|
676
617
|
title: localization == null ? void 0 : localization.expandButtonTitle
|
|
677
|
-
}, React.createElement(ExpandMoreIcon, {
|
|
678
|
-
fontSize:
|
|
618
|
+
}, row.getToggleRowExpandedProps()), React.createElement(ExpandMoreIcon, {
|
|
619
|
+
fontSize: row.canExpand || renderDetailPanel ? 'medium' : 'small',
|
|
679
620
|
style: {
|
|
680
|
-
transform: row.isExpanded ? 'rotate(-180deg)' : 'rotate(0)',
|
|
621
|
+
transform: !row.canExpand && !renderDetailPanel ? 'rotate(-90deg)' : row.isExpanded ? 'rotate(-180deg)' : 'rotate(0)',
|
|
681
622
|
transition: 'transform 0.2s'
|
|
682
623
|
}
|
|
683
624
|
})));
|
|
@@ -688,7 +629,8 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
|
688
629
|
|
|
689
630
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
690
631
|
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
691
|
-
onRowSelectChange = _useMaterialReactTabl.onRowSelectChange
|
|
632
|
+
onRowSelectChange = _useMaterialReactTabl.onRowSelectChange,
|
|
633
|
+
densePadding = _useMaterialReactTabl.densePadding;
|
|
692
634
|
|
|
693
635
|
var onSelectChange = function onSelectChange(event) {
|
|
694
636
|
var _row$getToggleRowSele;
|
|
@@ -697,136 +639,1062 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
|
697
639
|
onRowSelectChange == null ? void 0 : onRowSelectChange(event, row, tableInstance.selectedFlatRows);
|
|
698
640
|
};
|
|
699
641
|
|
|
700
|
-
return React.createElement(TableCell$
|
|
642
|
+
return React.createElement(TableCell$1, {
|
|
701
643
|
style: {
|
|
702
644
|
width: '2rem',
|
|
703
|
-
padding: '0.
|
|
645
|
+
padding: densePadding ? '0' : '0.6rem',
|
|
646
|
+
transition: 'all 0.2s ease-in-out'
|
|
704
647
|
}
|
|
705
648
|
}, React.createElement(Checkbox, Object.assign({}, row.getToggleRowSelectedProps(), {
|
|
706
649
|
onChange: onSelectChange
|
|
707
650
|
})));
|
|
708
651
|
};
|
|
709
652
|
|
|
710
|
-
var
|
|
711
|
-
|
|
653
|
+
var MenuItem$1 = /*#__PURE__*/styled(MenuItem$2)({
|
|
654
|
+
display: 'flex',
|
|
655
|
+
gap: '0.75rem'
|
|
656
|
+
});
|
|
657
|
+
var MRT_RowActionMenu = function MRT_RowActionMenu(_ref) {
|
|
658
|
+
var _renderRowActionMenuI;
|
|
659
|
+
|
|
660
|
+
var anchorEl = _ref.anchorEl,
|
|
661
|
+
row = _ref.row,
|
|
662
|
+
setAnchorEl = _ref.setAnchorEl;
|
|
712
663
|
|
|
713
664
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
enableColumnHiding = _useMaterialReactTabl.enableColumnHiding,
|
|
719
|
-
onRowClick = _useMaterialReactTabl.onRowClick,
|
|
720
|
-
renderDetailPanel = _useMaterialReactTabl.renderDetailPanel,
|
|
665
|
+
enableRowEditing = _useMaterialReactTabl.enableRowEditing,
|
|
666
|
+
localization = _useMaterialReactTabl.localization,
|
|
667
|
+
renderRowActionMenuItems = _useMaterialReactTabl.renderRowActionMenuItems,
|
|
668
|
+
setCurrentEditingRowId = _useMaterialReactTabl.setCurrentEditingRowId,
|
|
721
669
|
tableInstance = _useMaterialReactTabl.tableInstance;
|
|
722
670
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
671
|
+
var handleEdit = function handleEdit() {
|
|
672
|
+
setCurrentEditingRowId(row.id);
|
|
673
|
+
setAnchorEl(null);
|
|
674
|
+
};
|
|
726
675
|
|
|
727
|
-
return React.createElement(
|
|
728
|
-
|
|
729
|
-
|
|
676
|
+
return React.createElement(Menu, {
|
|
677
|
+
anchorEl: anchorEl,
|
|
678
|
+
open: !!anchorEl,
|
|
679
|
+
onClose: function onClose() {
|
|
680
|
+
return setAnchorEl(null);
|
|
730
681
|
}
|
|
731
|
-
},
|
|
732
|
-
|
|
733
|
-
}) :
|
|
734
|
-
|
|
735
|
-
}))
|
|
736
|
-
row: row
|
|
737
|
-
}), row.cells.map(function (cell, index) {
|
|
738
|
-
return React.createElement(MRT_TableBodyCell, {
|
|
739
|
-
key: index + "-" + cell.value,
|
|
740
|
-
cell: cell
|
|
741
|
-
});
|
|
742
|
-
}), enableColumnHiding && React.createElement(MRT_TableSpacerCell, null)), renderDetailPanel && React.createElement(MRT_TableDetailPanel, {
|
|
743
|
-
row: row
|
|
744
|
-
}));
|
|
682
|
+
}, enableRowEditing && React.createElement(MenuItem$1, {
|
|
683
|
+
onClick: handleEdit
|
|
684
|
+
}, React.createElement(EditIcon, null), " ", localization == null ? void 0 : localization.rowActionMenuItemEdit), (_renderRowActionMenuI = renderRowActionMenuItems == null ? void 0 : renderRowActionMenuItems(row, tableInstance, function () {
|
|
685
|
+
return setAnchorEl(null);
|
|
686
|
+
})) != null ? _renderRowActionMenuI : null);
|
|
745
687
|
};
|
|
746
688
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
}
|
|
750
|
-
var CircularProgressWrapper = /*#__PURE__*/styled('div')({
|
|
751
|
-
backgroundColor: 'rgba(255, 255, 255, 0.5)',
|
|
752
|
-
display: 'grid',
|
|
753
|
-
height: '100%',
|
|
754
|
-
justifyContent: 'center',
|
|
755
|
-
margin: 'auto',
|
|
756
|
-
paddingTop: '5rem',
|
|
757
|
-
position: 'fixed',
|
|
758
|
-
width: 'calc(100% - 2rem)'
|
|
759
|
-
});
|
|
760
|
-
var MRT_TableBody = function MRT_TableBody() {
|
|
761
|
-
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
762
|
-
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
763
|
-
tableBodyProps = _useMaterialReactTabl.tableBodyProps,
|
|
764
|
-
isLoading = _useMaterialReactTabl.isLoading,
|
|
765
|
-
enablePagination = _useMaterialReactTabl.enablePagination,
|
|
766
|
-
overrideTableBodyComponent = _useMaterialReactTabl.overrideTableBodyComponent;
|
|
689
|
+
function createCommonjsModule(fn, module) {
|
|
690
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
691
|
+
}
|
|
767
692
|
|
|
768
|
-
|
|
769
|
-
|
|
693
|
+
var runtime_1 = createCommonjsModule(function (module) {
|
|
694
|
+
/**
|
|
695
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
696
|
+
*
|
|
697
|
+
* This source code is licensed under the MIT license found in the
|
|
698
|
+
* LICENSE file in the root directory of this source tree.
|
|
699
|
+
*/
|
|
700
|
+
|
|
701
|
+
var runtime = (function (exports) {
|
|
702
|
+
|
|
703
|
+
var Op = Object.prototype;
|
|
704
|
+
var hasOwn = Op.hasOwnProperty;
|
|
705
|
+
var undefined$1; // More compressible than void 0.
|
|
706
|
+
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
707
|
+
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
708
|
+
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
709
|
+
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
710
|
+
|
|
711
|
+
function define(obj, key, value) {
|
|
712
|
+
Object.defineProperty(obj, key, {
|
|
713
|
+
value: value,
|
|
714
|
+
enumerable: true,
|
|
715
|
+
configurable: true,
|
|
716
|
+
writable: true
|
|
717
|
+
});
|
|
718
|
+
return obj[key];
|
|
719
|
+
}
|
|
720
|
+
try {
|
|
721
|
+
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
722
|
+
define({}, "");
|
|
723
|
+
} catch (err) {
|
|
724
|
+
define = function(obj, key, value) {
|
|
725
|
+
return obj[key] = value;
|
|
726
|
+
};
|
|
770
727
|
}
|
|
771
728
|
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
row: row
|
|
778
|
-
});
|
|
779
|
-
})));
|
|
780
|
-
};
|
|
729
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
730
|
+
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
731
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
732
|
+
var generator = Object.create(protoGenerator.prototype);
|
|
733
|
+
var context = new Context(tryLocsList || []);
|
|
781
734
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
var MRT_TableFooterCell = function MRT_TableFooterCell(_ref) {
|
|
786
|
-
var _column$columns$lengt, _column$columns;
|
|
735
|
+
// The ._invoke method unifies the implementations of the .next,
|
|
736
|
+
// .throw, and .return methods.
|
|
737
|
+
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
787
738
|
|
|
788
|
-
|
|
739
|
+
return generator;
|
|
740
|
+
}
|
|
741
|
+
exports.wrap = wrap;
|
|
742
|
+
|
|
743
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
744
|
+
// record like context.tryEntries[i].completion. This interface could
|
|
745
|
+
// have been (and was previously) designed to take a closure to be
|
|
746
|
+
// invoked without arguments, but in all the cases we care about we
|
|
747
|
+
// already have an existing method we want to call, so there's no need
|
|
748
|
+
// to create a new function object. We can even get away with assuming
|
|
749
|
+
// the method takes exactly one argument, since that happens to be true
|
|
750
|
+
// in every case, so we don't have to touch the arguments object. The
|
|
751
|
+
// only additional allocation required is the completion record, which
|
|
752
|
+
// has a stable shape and so hopefully should be cheap to allocate.
|
|
753
|
+
function tryCatch(fn, obj, arg) {
|
|
754
|
+
try {
|
|
755
|
+
return { type: "normal", arg: fn.call(obj, arg) };
|
|
756
|
+
} catch (err) {
|
|
757
|
+
return { type: "throw", arg: err };
|
|
758
|
+
}
|
|
759
|
+
}
|
|
789
760
|
|
|
790
|
-
var
|
|
791
|
-
|
|
792
|
-
|
|
761
|
+
var GenStateSuspendedStart = "suspendedStart";
|
|
762
|
+
var GenStateSuspendedYield = "suspendedYield";
|
|
763
|
+
var GenStateExecuting = "executing";
|
|
764
|
+
var GenStateCompleted = "completed";
|
|
765
|
+
|
|
766
|
+
// Returning this object from the innerFn has the same effect as
|
|
767
|
+
// breaking out of the dispatch switch statement.
|
|
768
|
+
var ContinueSentinel = {};
|
|
769
|
+
|
|
770
|
+
// Dummy constructor functions that we use as the .constructor and
|
|
771
|
+
// .constructor.prototype properties for functions that return Generator
|
|
772
|
+
// objects. For full spec compliance, you may wish to configure your
|
|
773
|
+
// minifier not to mangle the names of these two functions.
|
|
774
|
+
function Generator() {}
|
|
775
|
+
function GeneratorFunction() {}
|
|
776
|
+
function GeneratorFunctionPrototype() {}
|
|
777
|
+
|
|
778
|
+
// This is a polyfill for %IteratorPrototype% for environments that
|
|
779
|
+
// don't natively support it.
|
|
780
|
+
var IteratorPrototype = {};
|
|
781
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
782
|
+
return this;
|
|
783
|
+
});
|
|
793
784
|
|
|
794
|
-
|
|
795
|
-
|
|
785
|
+
var getProto = Object.getPrototypeOf;
|
|
786
|
+
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
787
|
+
if (NativeIteratorPrototype &&
|
|
788
|
+
NativeIteratorPrototype !== Op &&
|
|
789
|
+
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
790
|
+
// This environment has a native %IteratorPrototype%; use it instead
|
|
791
|
+
// of the polyfill.
|
|
792
|
+
IteratorPrototype = NativeIteratorPrototype;
|
|
796
793
|
}
|
|
797
794
|
|
|
798
|
-
var
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
795
|
+
var Gp = GeneratorFunctionPrototype.prototype =
|
|
796
|
+
Generator.prototype = Object.create(IteratorPrototype);
|
|
797
|
+
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
798
|
+
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
799
|
+
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
800
|
+
GeneratorFunction.displayName = define(
|
|
801
|
+
GeneratorFunctionPrototype,
|
|
802
|
+
toStringTagSymbol,
|
|
803
|
+
"GeneratorFunction"
|
|
804
|
+
);
|
|
804
805
|
|
|
805
|
-
|
|
806
|
-
|
|
806
|
+
// Helper for defining the .next, .throw, and .return methods of the
|
|
807
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
808
|
+
function defineIteratorMethods(prototype) {
|
|
809
|
+
["next", "throw", "return"].forEach(function(method) {
|
|
810
|
+
define(prototype, method, function(arg) {
|
|
811
|
+
return this._invoke(method, arg);
|
|
812
|
+
});
|
|
813
|
+
});
|
|
814
|
+
}
|
|
807
815
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
+
exports.isGeneratorFunction = function(genFun) {
|
|
817
|
+
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
818
|
+
return ctor
|
|
819
|
+
? ctor === GeneratorFunction ||
|
|
820
|
+
// For the native GeneratorFunction constructor, the best we can
|
|
821
|
+
// do is to check its .name property.
|
|
822
|
+
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
|
823
|
+
: false;
|
|
824
|
+
};
|
|
816
825
|
|
|
826
|
+
exports.mark = function(genFun) {
|
|
827
|
+
if (Object.setPrototypeOf) {
|
|
828
|
+
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
829
|
+
} else {
|
|
830
|
+
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
831
|
+
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
832
|
+
}
|
|
833
|
+
genFun.prototype = Object.create(Gp);
|
|
834
|
+
return genFun;
|
|
835
|
+
};
|
|
817
836
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
837
|
+
// Within the body of any async function, `await x` is transformed to
|
|
838
|
+
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
839
|
+
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
840
|
+
// meant to be awaited.
|
|
841
|
+
exports.awrap = function(arg) {
|
|
842
|
+
return { __await: arg };
|
|
843
|
+
};
|
|
844
|
+
|
|
845
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
846
|
+
function invoke(method, arg, resolve, reject) {
|
|
847
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
848
|
+
if (record.type === "throw") {
|
|
849
|
+
reject(record.arg);
|
|
850
|
+
} else {
|
|
851
|
+
var result = record.arg;
|
|
852
|
+
var value = result.value;
|
|
853
|
+
if (value &&
|
|
854
|
+
typeof value === "object" &&
|
|
855
|
+
hasOwn.call(value, "__await")) {
|
|
856
|
+
return PromiseImpl.resolve(value.__await).then(function(value) {
|
|
857
|
+
invoke("next", value, resolve, reject);
|
|
858
|
+
}, function(err) {
|
|
859
|
+
invoke("throw", err, resolve, reject);
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
return PromiseImpl.resolve(value).then(function(unwrapped) {
|
|
864
|
+
// When a yielded Promise is resolved, its final value becomes
|
|
865
|
+
// the .value of the Promise<{value,done}> result for the
|
|
866
|
+
// current iteration.
|
|
867
|
+
result.value = unwrapped;
|
|
868
|
+
resolve(result);
|
|
869
|
+
}, function(error) {
|
|
870
|
+
// If a rejected Promise was yielded, throw the rejection back
|
|
871
|
+
// into the async generator function so it can be handled there.
|
|
872
|
+
return invoke("throw", error, resolve, reject);
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
var previousPromise;
|
|
878
|
+
|
|
879
|
+
function enqueue(method, arg) {
|
|
880
|
+
function callInvokeWithMethodAndArg() {
|
|
881
|
+
return new PromiseImpl(function(resolve, reject) {
|
|
882
|
+
invoke(method, arg, resolve, reject);
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
return previousPromise =
|
|
887
|
+
// If enqueue has been called before, then we want to wait until
|
|
888
|
+
// all previous Promises have been resolved before calling invoke,
|
|
889
|
+
// so that results are always delivered in the correct order. If
|
|
890
|
+
// enqueue has not been called before, then it is important to
|
|
891
|
+
// call invoke immediately, without waiting on a callback to fire,
|
|
892
|
+
// so that the async generator function has the opportunity to do
|
|
893
|
+
// any necessary setup in a predictable way. This predictability
|
|
894
|
+
// is why the Promise constructor synchronously invokes its
|
|
895
|
+
// executor callback, and why async functions synchronously
|
|
896
|
+
// execute code before the first await. Since we implement simple
|
|
897
|
+
// async functions in terms of async generators, it is especially
|
|
898
|
+
// important to get this right, even though it requires care.
|
|
899
|
+
previousPromise ? previousPromise.then(
|
|
900
|
+
callInvokeWithMethodAndArg,
|
|
901
|
+
// Avoid propagating failures to Promises returned by later
|
|
902
|
+
// invocations of the iterator.
|
|
903
|
+
callInvokeWithMethodAndArg
|
|
904
|
+
) : callInvokeWithMethodAndArg();
|
|
905
|
+
}
|
|
821
906
|
|
|
822
|
-
|
|
823
|
-
|
|
907
|
+
// Define the unified helper method that is used to implement .next,
|
|
908
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
909
|
+
this._invoke = enqueue;
|
|
824
910
|
}
|
|
825
911
|
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
912
|
+
defineIteratorMethods(AsyncIterator.prototype);
|
|
913
|
+
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
914
|
+
return this;
|
|
915
|
+
});
|
|
916
|
+
exports.AsyncIterator = AsyncIterator;
|
|
917
|
+
|
|
918
|
+
// Note that simple async functions are implemented on top of
|
|
919
|
+
// AsyncIterator objects; they just return a Promise for the value of
|
|
920
|
+
// the final result produced by the iterator.
|
|
921
|
+
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
922
|
+
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
923
|
+
|
|
924
|
+
var iter = new AsyncIterator(
|
|
925
|
+
wrap(innerFn, outerFn, self, tryLocsList),
|
|
926
|
+
PromiseImpl
|
|
927
|
+
);
|
|
928
|
+
|
|
929
|
+
return exports.isGeneratorFunction(outerFn)
|
|
930
|
+
? iter // If outerFn is a generator, return the full iterator.
|
|
931
|
+
: iter.next().then(function(result) {
|
|
932
|
+
return result.done ? result.value : iter.next();
|
|
933
|
+
});
|
|
934
|
+
};
|
|
935
|
+
|
|
936
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
937
|
+
var state = GenStateSuspendedStart;
|
|
938
|
+
|
|
939
|
+
return function invoke(method, arg) {
|
|
940
|
+
if (state === GenStateExecuting) {
|
|
941
|
+
throw new Error("Generator is already running");
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
if (state === GenStateCompleted) {
|
|
945
|
+
if (method === "throw") {
|
|
946
|
+
throw arg;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
950
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
951
|
+
return doneResult();
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
context.method = method;
|
|
955
|
+
context.arg = arg;
|
|
956
|
+
|
|
957
|
+
while (true) {
|
|
958
|
+
var delegate = context.delegate;
|
|
959
|
+
if (delegate) {
|
|
960
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
961
|
+
if (delegateResult) {
|
|
962
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
963
|
+
return delegateResult;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
if (context.method === "next") {
|
|
968
|
+
// Setting context._sent for legacy support of Babel's
|
|
969
|
+
// function.sent implementation.
|
|
970
|
+
context.sent = context._sent = context.arg;
|
|
971
|
+
|
|
972
|
+
} else if (context.method === "throw") {
|
|
973
|
+
if (state === GenStateSuspendedStart) {
|
|
974
|
+
state = GenStateCompleted;
|
|
975
|
+
throw context.arg;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
context.dispatchException(context.arg);
|
|
979
|
+
|
|
980
|
+
} else if (context.method === "return") {
|
|
981
|
+
context.abrupt("return", context.arg);
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
state = GenStateExecuting;
|
|
985
|
+
|
|
986
|
+
var record = tryCatch(innerFn, self, context);
|
|
987
|
+
if (record.type === "normal") {
|
|
988
|
+
// If an exception is thrown from innerFn, we leave state ===
|
|
989
|
+
// GenStateExecuting and loop back for another invocation.
|
|
990
|
+
state = context.done
|
|
991
|
+
? GenStateCompleted
|
|
992
|
+
: GenStateSuspendedYield;
|
|
993
|
+
|
|
994
|
+
if (record.arg === ContinueSentinel) {
|
|
995
|
+
continue;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
return {
|
|
999
|
+
value: record.arg,
|
|
1000
|
+
done: context.done
|
|
1001
|
+
};
|
|
1002
|
+
|
|
1003
|
+
} else if (record.type === "throw") {
|
|
1004
|
+
state = GenStateCompleted;
|
|
1005
|
+
// Dispatch the exception by looping back around to the
|
|
1006
|
+
// context.dispatchException(context.arg) call above.
|
|
1007
|
+
context.method = "throw";
|
|
1008
|
+
context.arg = record.arg;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
1015
|
+
// result, either by returning a { value, done } result from the
|
|
1016
|
+
// delegate iterator, or by modifying context.method and context.arg,
|
|
1017
|
+
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
1018
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
1019
|
+
var method = delegate.iterator[context.method];
|
|
1020
|
+
if (method === undefined$1) {
|
|
1021
|
+
// A .throw or .return when the delegate iterator has no .throw
|
|
1022
|
+
// method always terminates the yield* loop.
|
|
1023
|
+
context.delegate = null;
|
|
1024
|
+
|
|
1025
|
+
if (context.method === "throw") {
|
|
1026
|
+
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
1027
|
+
if (delegate.iterator["return"]) {
|
|
1028
|
+
// If the delegate iterator has a return method, give it a
|
|
1029
|
+
// chance to clean up.
|
|
1030
|
+
context.method = "return";
|
|
1031
|
+
context.arg = undefined$1;
|
|
1032
|
+
maybeInvokeDelegate(delegate, context);
|
|
1033
|
+
|
|
1034
|
+
if (context.method === "throw") {
|
|
1035
|
+
// If maybeInvokeDelegate(context) changed context.method from
|
|
1036
|
+
// "return" to "throw", let that override the TypeError below.
|
|
1037
|
+
return ContinueSentinel;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
context.method = "throw";
|
|
1042
|
+
context.arg = new TypeError(
|
|
1043
|
+
"The iterator does not provide a 'throw' method");
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
return ContinueSentinel;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
1050
|
+
|
|
1051
|
+
if (record.type === "throw") {
|
|
1052
|
+
context.method = "throw";
|
|
1053
|
+
context.arg = record.arg;
|
|
1054
|
+
context.delegate = null;
|
|
1055
|
+
return ContinueSentinel;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
var info = record.arg;
|
|
1059
|
+
|
|
1060
|
+
if (! info) {
|
|
1061
|
+
context.method = "throw";
|
|
1062
|
+
context.arg = new TypeError("iterator result is not an object");
|
|
1063
|
+
context.delegate = null;
|
|
1064
|
+
return ContinueSentinel;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
if (info.done) {
|
|
1068
|
+
// Assign the result of the finished delegate to the temporary
|
|
1069
|
+
// variable specified by delegate.resultName (see delegateYield).
|
|
1070
|
+
context[delegate.resultName] = info.value;
|
|
1071
|
+
|
|
1072
|
+
// Resume execution at the desired location (see delegateYield).
|
|
1073
|
+
context.next = delegate.nextLoc;
|
|
1074
|
+
|
|
1075
|
+
// If context.method was "throw" but the delegate handled the
|
|
1076
|
+
// exception, let the outer generator proceed normally. If
|
|
1077
|
+
// context.method was "next", forget context.arg since it has been
|
|
1078
|
+
// "consumed" by the delegate iterator. If context.method was
|
|
1079
|
+
// "return", allow the original .return call to continue in the
|
|
1080
|
+
// outer generator.
|
|
1081
|
+
if (context.method !== "return") {
|
|
1082
|
+
context.method = "next";
|
|
1083
|
+
context.arg = undefined$1;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
} else {
|
|
1087
|
+
// Re-yield the result returned by the delegate method.
|
|
1088
|
+
return info;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
// The delegate iterator is finished, so forget it and continue with
|
|
1092
|
+
// the outer generator.
|
|
1093
|
+
context.delegate = null;
|
|
1094
|
+
return ContinueSentinel;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
1098
|
+
// unified ._invoke helper method.
|
|
1099
|
+
defineIteratorMethods(Gp);
|
|
1100
|
+
|
|
1101
|
+
define(Gp, toStringTagSymbol, "Generator");
|
|
1102
|
+
|
|
1103
|
+
// A Generator should always return itself as the iterator object when the
|
|
1104
|
+
// @@iterator function is called on it. Some browsers' implementations of the
|
|
1105
|
+
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
1106
|
+
// object to not be returned from this call. This ensures that doesn't happen.
|
|
1107
|
+
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
1108
|
+
define(Gp, iteratorSymbol, function() {
|
|
1109
|
+
return this;
|
|
1110
|
+
});
|
|
1111
|
+
|
|
1112
|
+
define(Gp, "toString", function() {
|
|
1113
|
+
return "[object Generator]";
|
|
1114
|
+
});
|
|
1115
|
+
|
|
1116
|
+
function pushTryEntry(locs) {
|
|
1117
|
+
var entry = { tryLoc: locs[0] };
|
|
1118
|
+
|
|
1119
|
+
if (1 in locs) {
|
|
1120
|
+
entry.catchLoc = locs[1];
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
if (2 in locs) {
|
|
1124
|
+
entry.finallyLoc = locs[2];
|
|
1125
|
+
entry.afterLoc = locs[3];
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
this.tryEntries.push(entry);
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
function resetTryEntry(entry) {
|
|
1132
|
+
var record = entry.completion || {};
|
|
1133
|
+
record.type = "normal";
|
|
1134
|
+
delete record.arg;
|
|
1135
|
+
entry.completion = record;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
function Context(tryLocsList) {
|
|
1139
|
+
// The root entry object (effectively a try statement without a catch
|
|
1140
|
+
// or a finally block) gives us a place to store values thrown from
|
|
1141
|
+
// locations where there is no enclosing try statement.
|
|
1142
|
+
this.tryEntries = [{ tryLoc: "root" }];
|
|
1143
|
+
tryLocsList.forEach(pushTryEntry, this);
|
|
1144
|
+
this.reset(true);
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
exports.keys = function(object) {
|
|
1148
|
+
var keys = [];
|
|
1149
|
+
for (var key in object) {
|
|
1150
|
+
keys.push(key);
|
|
1151
|
+
}
|
|
1152
|
+
keys.reverse();
|
|
1153
|
+
|
|
1154
|
+
// Rather than returning an object with a next method, we keep
|
|
1155
|
+
// things simple and return the next function itself.
|
|
1156
|
+
return function next() {
|
|
1157
|
+
while (keys.length) {
|
|
1158
|
+
var key = keys.pop();
|
|
1159
|
+
if (key in object) {
|
|
1160
|
+
next.value = key;
|
|
1161
|
+
next.done = false;
|
|
1162
|
+
return next;
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
// To avoid creating an additional object, we just hang the .value
|
|
1167
|
+
// and .done properties off the next function object itself. This
|
|
1168
|
+
// also ensures that the minifier will not anonymize the function.
|
|
1169
|
+
next.done = true;
|
|
1170
|
+
return next;
|
|
1171
|
+
};
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
function values(iterable) {
|
|
1175
|
+
if (iterable) {
|
|
1176
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
1177
|
+
if (iteratorMethod) {
|
|
1178
|
+
return iteratorMethod.call(iterable);
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
if (typeof iterable.next === "function") {
|
|
1182
|
+
return iterable;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
if (!isNaN(iterable.length)) {
|
|
1186
|
+
var i = -1, next = function next() {
|
|
1187
|
+
while (++i < iterable.length) {
|
|
1188
|
+
if (hasOwn.call(iterable, i)) {
|
|
1189
|
+
next.value = iterable[i];
|
|
1190
|
+
next.done = false;
|
|
1191
|
+
return next;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
next.value = undefined$1;
|
|
1196
|
+
next.done = true;
|
|
1197
|
+
|
|
1198
|
+
return next;
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1201
|
+
return next.next = next;
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
// Return an iterator with no values.
|
|
1206
|
+
return { next: doneResult };
|
|
1207
|
+
}
|
|
1208
|
+
exports.values = values;
|
|
1209
|
+
|
|
1210
|
+
function doneResult() {
|
|
1211
|
+
return { value: undefined$1, done: true };
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
Context.prototype = {
|
|
1215
|
+
constructor: Context,
|
|
1216
|
+
|
|
1217
|
+
reset: function(skipTempReset) {
|
|
1218
|
+
this.prev = 0;
|
|
1219
|
+
this.next = 0;
|
|
1220
|
+
// Resetting context._sent for legacy support of Babel's
|
|
1221
|
+
// function.sent implementation.
|
|
1222
|
+
this.sent = this._sent = undefined$1;
|
|
1223
|
+
this.done = false;
|
|
1224
|
+
this.delegate = null;
|
|
1225
|
+
|
|
1226
|
+
this.method = "next";
|
|
1227
|
+
this.arg = undefined$1;
|
|
1228
|
+
|
|
1229
|
+
this.tryEntries.forEach(resetTryEntry);
|
|
1230
|
+
|
|
1231
|
+
if (!skipTempReset) {
|
|
1232
|
+
for (var name in this) {
|
|
1233
|
+
// Not sure about the optimal order of these conditions:
|
|
1234
|
+
if (name.charAt(0) === "t" &&
|
|
1235
|
+
hasOwn.call(this, name) &&
|
|
1236
|
+
!isNaN(+name.slice(1))) {
|
|
1237
|
+
this[name] = undefined$1;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
},
|
|
1242
|
+
|
|
1243
|
+
stop: function() {
|
|
1244
|
+
this.done = true;
|
|
1245
|
+
|
|
1246
|
+
var rootEntry = this.tryEntries[0];
|
|
1247
|
+
var rootRecord = rootEntry.completion;
|
|
1248
|
+
if (rootRecord.type === "throw") {
|
|
1249
|
+
throw rootRecord.arg;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
return this.rval;
|
|
1253
|
+
},
|
|
1254
|
+
|
|
1255
|
+
dispatchException: function(exception) {
|
|
1256
|
+
if (this.done) {
|
|
1257
|
+
throw exception;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
var context = this;
|
|
1261
|
+
function handle(loc, caught) {
|
|
1262
|
+
record.type = "throw";
|
|
1263
|
+
record.arg = exception;
|
|
1264
|
+
context.next = loc;
|
|
1265
|
+
|
|
1266
|
+
if (caught) {
|
|
1267
|
+
// If the dispatched exception was caught by a catch block,
|
|
1268
|
+
// then let that catch block handle the exception normally.
|
|
1269
|
+
context.method = "next";
|
|
1270
|
+
context.arg = undefined$1;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
return !! caught;
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1277
|
+
var entry = this.tryEntries[i];
|
|
1278
|
+
var record = entry.completion;
|
|
1279
|
+
|
|
1280
|
+
if (entry.tryLoc === "root") {
|
|
1281
|
+
// Exception thrown outside of any try block that could handle
|
|
1282
|
+
// it, so set the completion value of the entire function to
|
|
1283
|
+
// throw the exception.
|
|
1284
|
+
return handle("end");
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
if (entry.tryLoc <= this.prev) {
|
|
1288
|
+
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
1289
|
+
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
1290
|
+
|
|
1291
|
+
if (hasCatch && hasFinally) {
|
|
1292
|
+
if (this.prev < entry.catchLoc) {
|
|
1293
|
+
return handle(entry.catchLoc, true);
|
|
1294
|
+
} else if (this.prev < entry.finallyLoc) {
|
|
1295
|
+
return handle(entry.finallyLoc);
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
} else if (hasCatch) {
|
|
1299
|
+
if (this.prev < entry.catchLoc) {
|
|
1300
|
+
return handle(entry.catchLoc, true);
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
} else if (hasFinally) {
|
|
1304
|
+
if (this.prev < entry.finallyLoc) {
|
|
1305
|
+
return handle(entry.finallyLoc);
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
} else {
|
|
1309
|
+
throw new Error("try statement without catch or finally");
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
},
|
|
1314
|
+
|
|
1315
|
+
abrupt: function(type, arg) {
|
|
1316
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1317
|
+
var entry = this.tryEntries[i];
|
|
1318
|
+
if (entry.tryLoc <= this.prev &&
|
|
1319
|
+
hasOwn.call(entry, "finallyLoc") &&
|
|
1320
|
+
this.prev < entry.finallyLoc) {
|
|
1321
|
+
var finallyEntry = entry;
|
|
1322
|
+
break;
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
if (finallyEntry &&
|
|
1327
|
+
(type === "break" ||
|
|
1328
|
+
type === "continue") &&
|
|
1329
|
+
finallyEntry.tryLoc <= arg &&
|
|
1330
|
+
arg <= finallyEntry.finallyLoc) {
|
|
1331
|
+
// Ignore the finally entry if control is not jumping to a
|
|
1332
|
+
// location outside the try/catch block.
|
|
1333
|
+
finallyEntry = null;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
1337
|
+
record.type = type;
|
|
1338
|
+
record.arg = arg;
|
|
1339
|
+
|
|
1340
|
+
if (finallyEntry) {
|
|
1341
|
+
this.method = "next";
|
|
1342
|
+
this.next = finallyEntry.finallyLoc;
|
|
1343
|
+
return ContinueSentinel;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
return this.complete(record);
|
|
1347
|
+
},
|
|
1348
|
+
|
|
1349
|
+
complete: function(record, afterLoc) {
|
|
1350
|
+
if (record.type === "throw") {
|
|
1351
|
+
throw record.arg;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
if (record.type === "break" ||
|
|
1355
|
+
record.type === "continue") {
|
|
1356
|
+
this.next = record.arg;
|
|
1357
|
+
} else if (record.type === "return") {
|
|
1358
|
+
this.rval = this.arg = record.arg;
|
|
1359
|
+
this.method = "return";
|
|
1360
|
+
this.next = "end";
|
|
1361
|
+
} else if (record.type === "normal" && afterLoc) {
|
|
1362
|
+
this.next = afterLoc;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
return ContinueSentinel;
|
|
1366
|
+
},
|
|
1367
|
+
|
|
1368
|
+
finish: function(finallyLoc) {
|
|
1369
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1370
|
+
var entry = this.tryEntries[i];
|
|
1371
|
+
if (entry.finallyLoc === finallyLoc) {
|
|
1372
|
+
this.complete(entry.completion, entry.afterLoc);
|
|
1373
|
+
resetTryEntry(entry);
|
|
1374
|
+
return ContinueSentinel;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
},
|
|
1378
|
+
|
|
1379
|
+
"catch": function(tryLoc) {
|
|
1380
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1381
|
+
var entry = this.tryEntries[i];
|
|
1382
|
+
if (entry.tryLoc === tryLoc) {
|
|
1383
|
+
var record = entry.completion;
|
|
1384
|
+
if (record.type === "throw") {
|
|
1385
|
+
var thrown = record.arg;
|
|
1386
|
+
resetTryEntry(entry);
|
|
1387
|
+
}
|
|
1388
|
+
return thrown;
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
// The context.catch method must only be called with a location
|
|
1393
|
+
// argument that corresponds to a known catch block.
|
|
1394
|
+
throw new Error("illegal catch attempt");
|
|
1395
|
+
},
|
|
1396
|
+
|
|
1397
|
+
delegateYield: function(iterable, resultName, nextLoc) {
|
|
1398
|
+
this.delegate = {
|
|
1399
|
+
iterator: values(iterable),
|
|
1400
|
+
resultName: resultName,
|
|
1401
|
+
nextLoc: nextLoc
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1404
|
+
if (this.method === "next") {
|
|
1405
|
+
// Deliberately forget the last sent value so that we don't
|
|
1406
|
+
// accidentally pass it on to the delegate.
|
|
1407
|
+
this.arg = undefined$1;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
return ContinueSentinel;
|
|
1411
|
+
}
|
|
1412
|
+
};
|
|
1413
|
+
|
|
1414
|
+
// Regardless of whether this script is executing as a CommonJS module
|
|
1415
|
+
// or not, return the runtime object so that we can declare the variable
|
|
1416
|
+
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
1417
|
+
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
1418
|
+
return exports;
|
|
1419
|
+
|
|
1420
|
+
}(
|
|
1421
|
+
// If this script is executing as a CommonJS module, use module.exports
|
|
1422
|
+
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
1423
|
+
// object. Either way, the resulting object will be used to initialize
|
|
1424
|
+
// the regeneratorRuntime variable at the top of this file.
|
|
1425
|
+
module.exports
|
|
1426
|
+
));
|
|
1427
|
+
|
|
1428
|
+
try {
|
|
1429
|
+
regeneratorRuntime = runtime;
|
|
1430
|
+
} catch (accidentalStrictMode) {
|
|
1431
|
+
// This module should not be running in strict mode, so the above
|
|
1432
|
+
// assignment should always work unless something is misconfigured. Just
|
|
1433
|
+
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
1434
|
+
// we can explicitly access globalThis. In older engines we can escape
|
|
1435
|
+
// strict mode using a global Function call. This could conceivably fail
|
|
1436
|
+
// if a Content Security Policy forbids using Function, but in that case
|
|
1437
|
+
// the proper solution is to fix the accidental strict mode problem. If
|
|
1438
|
+
// you've misconfigured your bundler to force strict mode and applied a
|
|
1439
|
+
// CSP to forbid Function, and you're not willing to fix either of those
|
|
1440
|
+
// problems, please detail your unique predicament in a GitHub issue.
|
|
1441
|
+
if (typeof globalThis === "object") {
|
|
1442
|
+
globalThis.regeneratorRuntime = runtime;
|
|
1443
|
+
} else {
|
|
1444
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
});
|
|
1448
|
+
|
|
1449
|
+
var EditActionButtonWrappers = /*#__PURE__*/styled('div')({
|
|
1450
|
+
display: 'flex',
|
|
1451
|
+
gap: '0.75rem'
|
|
1452
|
+
});
|
|
1453
|
+
var MRT_EditActionButtons = function MRT_EditActionButtons(_ref) {
|
|
1454
|
+
var _localization$rowActi, _localization$rowActi2;
|
|
1455
|
+
|
|
1456
|
+
var row = _ref.row;
|
|
1457
|
+
|
|
1458
|
+
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
1459
|
+
localization = _useMaterialReactTabl.localization,
|
|
1460
|
+
setCurrentEditingRowId = _useMaterialReactTabl.setCurrentEditingRowId,
|
|
1461
|
+
onRowEditSubmit = _useMaterialReactTabl.onRowEditSubmit;
|
|
1462
|
+
|
|
1463
|
+
var handleCancel = function handleCancel() {
|
|
1464
|
+
setCurrentEditingRowId(null);
|
|
1465
|
+
};
|
|
1466
|
+
|
|
1467
|
+
var handleSave = /*#__PURE__*/function () {
|
|
1468
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1469
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
1470
|
+
while (1) {
|
|
1471
|
+
switch (_context.prev = _context.next) {
|
|
1472
|
+
case 0:
|
|
1473
|
+
setCurrentEditingRowId(null);
|
|
1474
|
+
_context.next = 3;
|
|
1475
|
+
return onRowEditSubmit == null ? void 0 : onRowEditSubmit(row);
|
|
1476
|
+
|
|
1477
|
+
case 3:
|
|
1478
|
+
case "end":
|
|
1479
|
+
return _context.stop();
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
}, _callee);
|
|
1483
|
+
}));
|
|
1484
|
+
|
|
1485
|
+
return function handleSave() {
|
|
1486
|
+
return _ref2.apply(this, arguments);
|
|
1487
|
+
};
|
|
1488
|
+
}();
|
|
1489
|
+
|
|
1490
|
+
return React.createElement(EditActionButtonWrappers, null, React.createElement(Tooltip, {
|
|
1491
|
+
arrow: true,
|
|
1492
|
+
title: (_localization$rowActi = localization == null ? void 0 : localization.rowActionButtonCancel) != null ? _localization$rowActi : ''
|
|
1493
|
+
}, React.createElement(IconButton$2, {
|
|
1494
|
+
"aria-label": localization == null ? void 0 : localization.rowActionButtonCancel,
|
|
1495
|
+
onClick: handleCancel
|
|
1496
|
+
}, React.createElement(CancelIcon, null))), React.createElement(Tooltip, {
|
|
1497
|
+
arrow: true,
|
|
1498
|
+
title: (_localization$rowActi2 = localization == null ? void 0 : localization.rowActionButtonSave) != null ? _localization$rowActi2 : ''
|
|
1499
|
+
}, React.createElement(IconButton$2, {
|
|
1500
|
+
"aria-label": localization == null ? void 0 : localization.rowActionButtonSave,
|
|
1501
|
+
color: "info",
|
|
1502
|
+
onClick: handleSave
|
|
1503
|
+
}, React.createElement(SaveIcon, null))));
|
|
1504
|
+
};
|
|
1505
|
+
|
|
1506
|
+
var IconButton$1 = /*#__PURE__*/styled(IconButton$2)({
|
|
1507
|
+
opacity: 0.5,
|
|
1508
|
+
transition: 'opacity 0.2s',
|
|
1509
|
+
marginRight: '2px',
|
|
1510
|
+
height: '2rem',
|
|
1511
|
+
width: '2rem',
|
|
1512
|
+
'&:hover': {
|
|
1513
|
+
opacity: 1
|
|
1514
|
+
}
|
|
1515
|
+
});
|
|
1516
|
+
var MRT_ToggleRowActionMenuButton = function MRT_ToggleRowActionMenuButton(_ref) {
|
|
1517
|
+
var row = _ref.row;
|
|
1518
|
+
|
|
1519
|
+
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
1520
|
+
localization = _useMaterialReactTabl.localization,
|
|
1521
|
+
currentEditingRowId = _useMaterialReactTabl.currentEditingRowId,
|
|
1522
|
+
renderRowActions = _useMaterialReactTabl.renderRowActions,
|
|
1523
|
+
tableInstance = _useMaterialReactTabl.tableInstance;
|
|
1524
|
+
|
|
1525
|
+
var _useState = useState(null),
|
|
1526
|
+
anchorEl = _useState[0],
|
|
1527
|
+
setAnchorEl = _useState[1];
|
|
1528
|
+
|
|
1529
|
+
var handleOpenRowActionMenu = function handleOpenRowActionMenu(event) {
|
|
1530
|
+
event.stopPropagation();
|
|
1531
|
+
event.preventDefault();
|
|
1532
|
+
setAnchorEl(event.currentTarget);
|
|
1533
|
+
};
|
|
1534
|
+
|
|
1535
|
+
if (renderRowActions) {
|
|
1536
|
+
return React.createElement(React.Fragment, null, renderRowActions(row, tableInstance));
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
if (row.id === currentEditingRowId) {
|
|
1540
|
+
return React.createElement(MRT_EditActionButtons, {
|
|
1541
|
+
row: row
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
return React.createElement(React.Fragment, null, React.createElement(IconButton$1, {
|
|
1546
|
+
"aria-label": localization == null ? void 0 : localization.rowActionMenuButtonTitle,
|
|
1547
|
+
title: localization == null ? void 0 : localization.rowActionMenuButtonTitle,
|
|
1548
|
+
onClick: handleOpenRowActionMenu,
|
|
1549
|
+
size: "small"
|
|
1550
|
+
}, React.createElement(MoreHorizIcon, null)), React.createElement(MRT_RowActionMenu, {
|
|
1551
|
+
anchorEl: anchorEl,
|
|
1552
|
+
row: row,
|
|
1553
|
+
setAnchorEl: setAnchorEl
|
|
1554
|
+
}));
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1557
|
+
var MRT_TableBodyRow = function MRT_TableBodyRow(_ref) {
|
|
1558
|
+
var _mTableBodyRowProps$s;
|
|
1559
|
+
|
|
1560
|
+
var row = _ref.row;
|
|
1561
|
+
|
|
1562
|
+
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
1563
|
+
anyRowsCanExpand = _useMaterialReactTabl.anyRowsCanExpand,
|
|
1564
|
+
enableRowActions = _useMaterialReactTabl.enableRowActions,
|
|
1565
|
+
enableSelection = _useMaterialReactTabl.enableSelection,
|
|
1566
|
+
muiTableBodyRowProps = _useMaterialReactTabl.muiTableBodyRowProps,
|
|
1567
|
+
onRowClick = _useMaterialReactTabl.onRowClick,
|
|
1568
|
+
positionActionsColumn = _useMaterialReactTabl.positionActionsColumn,
|
|
1569
|
+
renderDetailPanel = _useMaterialReactTabl.renderDetailPanel;
|
|
1570
|
+
|
|
1571
|
+
var theme = useTheme();
|
|
1572
|
+
var mTableBodyRowProps = muiTableBodyRowProps instanceof Function ? muiTableBodyRowProps(row) : muiTableBodyRowProps;
|
|
1573
|
+
|
|
1574
|
+
var tableRowProps = _extends({}, mTableBodyRowProps, row.getRowProps(), {
|
|
1575
|
+
style: _extends({
|
|
1576
|
+
backgroundColor: row.isSelected ? alpha(theme.palette.primary.light, 0.1) : 'transparent'
|
|
1577
|
+
}, row.getRowProps().style, (_mTableBodyRowProps$s = mTableBodyRowProps == null ? void 0 : mTableBodyRowProps.style) != null ? _mTableBodyRowProps$s : {})
|
|
1578
|
+
});
|
|
1579
|
+
|
|
1580
|
+
return React.createElement(React.Fragment, null, React.createElement(TableRow, Object.assign({
|
|
1581
|
+
hover: true,
|
|
1582
|
+
onClick: function onClick(event) {
|
|
1583
|
+
return onRowClick == null ? void 0 : onRowClick(event, row);
|
|
829
1584
|
}
|
|
1585
|
+
}, tableRowProps), enableRowActions && positionActionsColumn === 'first' && React.createElement(TableCell$1, null, React.createElement(MRT_ToggleRowActionMenuButton, {
|
|
1586
|
+
row: row
|
|
1587
|
+
})), (anyRowsCanExpand || renderDetailPanel) && React.createElement(MRT_ExpandButton, {
|
|
1588
|
+
row: row
|
|
1589
|
+
}), enableSelection && React.createElement(MRT_SelectCheckbox, {
|
|
1590
|
+
row: row
|
|
1591
|
+
}), row.cells.map(function (cell) {
|
|
1592
|
+
return React.createElement(MRT_TableBodyCell, {
|
|
1593
|
+
key: cell.getCellProps().key,
|
|
1594
|
+
cell: cell
|
|
1595
|
+
});
|
|
1596
|
+
}), enableRowActions && positionActionsColumn === 'last' && React.createElement(TableCell$1, null, React.createElement(MRT_ToggleRowActionMenuButton, {
|
|
1597
|
+
row: row
|
|
1598
|
+
}))), renderDetailPanel && React.createElement(MRT_TableDetailPanel, {
|
|
1599
|
+
row: row
|
|
1600
|
+
}));
|
|
1601
|
+
};
|
|
1602
|
+
|
|
1603
|
+
var TableBody = /*#__PURE__*/styled(TableBody$1)({
|
|
1604
|
+
overflowY: 'hidden'
|
|
1605
|
+
});
|
|
1606
|
+
var CircularProgressWrapper = /*#__PURE__*/styled('div')(function (_ref) {
|
|
1607
|
+
var theme = _ref.theme;
|
|
1608
|
+
return {
|
|
1609
|
+
backgroundColor: alpha(theme.palette.background.paper, 0.5),
|
|
1610
|
+
display: 'grid',
|
|
1611
|
+
height: '100%',
|
|
1612
|
+
justifyContent: 'center',
|
|
1613
|
+
margin: 'auto',
|
|
1614
|
+
paddingTop: '5rem',
|
|
1615
|
+
position: 'fixed',
|
|
1616
|
+
width: 'calc(100% - 2rem)'
|
|
1617
|
+
};
|
|
1618
|
+
});
|
|
1619
|
+
var MRT_TableBody = function MRT_TableBody() {
|
|
1620
|
+
var _muiTableBodyProps$st;
|
|
1621
|
+
|
|
1622
|
+
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
1623
|
+
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
1624
|
+
muiTableBodyProps = _useMaterialReactTabl.muiTableBodyProps,
|
|
1625
|
+
isLoading = _useMaterialReactTabl.isLoading,
|
|
1626
|
+
manualPagination = _useMaterialReactTabl.manualPagination;
|
|
1627
|
+
|
|
1628
|
+
var rows = manualPagination ? tableInstance.rows : tableInstance.page;
|
|
1629
|
+
|
|
1630
|
+
var tableBodyProps = _extends({}, muiTableBodyProps, tableInstance.getTableBodyProps(), {
|
|
1631
|
+
style: _extends({}, tableInstance.getTableBodyProps().style, (_muiTableBodyProps$st = muiTableBodyProps == null ? void 0 : muiTableBodyProps.style) != null ? _muiTableBodyProps$st : {})
|
|
1632
|
+
});
|
|
1633
|
+
|
|
1634
|
+
return React.createElement(TableBody, Object.assign({}, tableBodyProps), isLoading && React.createElement(CircularProgressWrapper, null, React.createElement(CircularProgress, null)), rows.map(function (row) {
|
|
1635
|
+
tableInstance.prepareRow(row);
|
|
1636
|
+
return React.createElement(MRT_TableBodyRow, {
|
|
1637
|
+
key: row.getRowProps().key,
|
|
1638
|
+
row: row
|
|
1639
|
+
});
|
|
1640
|
+
}));
|
|
1641
|
+
};
|
|
1642
|
+
|
|
1643
|
+
var TableCell = /*#__PURE__*/styled(TableCell$1)({
|
|
1644
|
+
fontWeight: 'bold'
|
|
1645
|
+
});
|
|
1646
|
+
var MRT_TableFooterCell = function MRT_TableFooterCell(_ref) {
|
|
1647
|
+
var _column$columns$lengt, _column$columns, _mTableFooterCellProp;
|
|
1648
|
+
|
|
1649
|
+
var column = _ref.column;
|
|
1650
|
+
|
|
1651
|
+
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
1652
|
+
muiTableFooterCellProps = _useMaterialReactTabl.muiTableFooterCellProps,
|
|
1653
|
+
densePadding = _useMaterialReactTabl.densePadding;
|
|
1654
|
+
|
|
1655
|
+
var isParentHeader = ((_column$columns$lengt = column == null ? void 0 : (_column$columns = column.columns) == null ? void 0 : _column$columns.length) != null ? _column$columns$lengt : 0) > 0;
|
|
1656
|
+
var mTableFooterCellProps = muiTableFooterCellProps instanceof Function ? muiTableFooterCellProps(column) : muiTableFooterCellProps;
|
|
1657
|
+
|
|
1658
|
+
var tableCellProps = _extends({}, mTableFooterCellProps, column.getFooterProps(), {
|
|
1659
|
+
style: _extends({
|
|
1660
|
+
padding: densePadding ? '0.5rem' : '1rem',
|
|
1661
|
+
transition: 'all 0.2s ease-in-out'
|
|
1662
|
+
}, column.getFooterProps().style, (_mTableFooterCellProp = mTableFooterCellProps == null ? void 0 : mTableFooterCellProps.style) != null ? _mTableFooterCellProp : {})
|
|
1663
|
+
});
|
|
1664
|
+
|
|
1665
|
+
return React.createElement(TableCell, Object.assign({
|
|
1666
|
+
align: isParentHeader ? 'center' : 'left',
|
|
1667
|
+
variant: "head"
|
|
1668
|
+
}, tableCellProps), column.render('Footer'));
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1671
|
+
var MRT_TableFooterRow = function MRT_TableFooterRow(_ref) {
|
|
1672
|
+
var _mTableFooterRowProps;
|
|
1673
|
+
|
|
1674
|
+
var footerGroup = _ref.footerGroup;
|
|
1675
|
+
|
|
1676
|
+
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
1677
|
+
renderDetailPanel = _useMaterialReactTabl.renderDetailPanel,
|
|
1678
|
+
columns = _useMaterialReactTabl.columns,
|
|
1679
|
+
anyRowsCanExpand = _useMaterialReactTabl.anyRowsCanExpand,
|
|
1680
|
+
enableSelection = _useMaterialReactTabl.enableSelection,
|
|
1681
|
+
enableRowActions = _useMaterialReactTabl.enableRowActions,
|
|
1682
|
+
positionActionsColumn = _useMaterialReactTabl.positionActionsColumn,
|
|
1683
|
+
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
1684
|
+
muiTableFooterRowProps = _useMaterialReactTabl.muiTableFooterRowProps; //if no content in row, skip row
|
|
1685
|
+
|
|
1686
|
+
|
|
1687
|
+
if (!(columns != null && columns.some(function (c) {
|
|
1688
|
+
return c.Footer;
|
|
1689
|
+
}))) return null;
|
|
1690
|
+
var mTableFooterRowProps = muiTableFooterRowProps instanceof Function ? muiTableFooterRowProps(footerGroup) : muiTableFooterRowProps;
|
|
1691
|
+
|
|
1692
|
+
var tableRowProps = _extends({}, mTableFooterRowProps, footerGroup.getFooterGroupProps(), {
|
|
1693
|
+
style: _extends({}, footerGroup.getFooterGroupProps().style, (_mTableFooterRowProps = mTableFooterRowProps == null ? void 0 : mTableFooterRowProps.style) != null ? _mTableFooterRowProps : {})
|
|
1694
|
+
});
|
|
1695
|
+
|
|
1696
|
+
return React.createElement(TableRow, Object.assign({}, tableRowProps), enableRowActions && positionActionsColumn === 'first' && React.createElement(MRT_TableSpacerCell, null), (anyRowsCanExpand || renderDetailPanel) && React.createElement(MRT_TableSpacerCell, {
|
|
1697
|
+
width: (renderDetailPanel ? 2 : tableInstance.expandedDepth + 0.5) + "rem"
|
|
830
1698
|
}), enableSelection && React.createElement(MRT_TableSpacerCell, {
|
|
831
1699
|
width: "1rem"
|
|
832
1700
|
}), footerGroup.headers.map(function (column, index) {
|
|
@@ -834,37 +1702,36 @@ var MRT_TableFooterRow = function MRT_TableFooterRow(_ref) {
|
|
|
834
1702
|
key: index + "-" + column.id,
|
|
835
1703
|
column: column
|
|
836
1704
|
});
|
|
837
|
-
}),
|
|
1705
|
+
}), enableRowActions && positionActionsColumn === 'last' && React.createElement(MRT_TableSpacerCell, null));
|
|
838
1706
|
};
|
|
839
1707
|
|
|
840
1708
|
var MRT_TableFooter = function MRT_TableFooter() {
|
|
841
1709
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
842
|
-
|
|
843
|
-
enablePagination = _useMaterialReactTabl.enablePagination,
|
|
844
|
-
positionPagination = _useMaterialReactTabl.positionPagination,
|
|
845
|
-
tableFooterProps = _useMaterialReactTabl.tableFooterProps,
|
|
1710
|
+
muiTableFooterProps = _useMaterialReactTabl.muiTableFooterProps,
|
|
846
1711
|
tableInstance = _useMaterialReactTabl.tableInstance;
|
|
847
1712
|
|
|
848
|
-
|
|
849
|
-
return React.createElement(React.Fragment, null, overrideTableFooterComponent(tableInstance));
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
return React.createElement(TableFooter, Object.assign({}, tableFooterProps), tableInstance.footerGroups.map(function (footerGroup, index) {
|
|
1713
|
+
return React.createElement(TableFooter, Object.assign({}, muiTableFooterProps), tableInstance.footerGroups.map(function (footerGroup, index) {
|
|
853
1714
|
return React.createElement(MRT_TableFooterRow, {
|
|
854
1715
|
key: index + "-" + footerGroup.id,
|
|
855
1716
|
footerGroup: footerGroup
|
|
856
1717
|
});
|
|
857
|
-
})
|
|
1718
|
+
}));
|
|
858
1719
|
};
|
|
859
1720
|
|
|
860
1721
|
var MRT_Table = function MRT_Table() {
|
|
1722
|
+
var _muiTableProps$style;
|
|
1723
|
+
|
|
861
1724
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
862
1725
|
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
1726
|
+
muiTableProps = _useMaterialReactTabl.muiTableProps,
|
|
1727
|
+
hideTableHead = _useMaterialReactTabl.hideTableHead,
|
|
1728
|
+
hideTableFooter = _useMaterialReactTabl.hideTableFooter;
|
|
866
1729
|
|
|
867
|
-
|
|
1730
|
+
var tableProps = _extends({}, muiTableProps, tableInstance.getTableProps(), {
|
|
1731
|
+
style: _extends({}, tableInstance.getTableProps().style, (_muiTableProps$style = muiTableProps == null ? void 0 : muiTableProps.style) != null ? _muiTableProps$style : {})
|
|
1732
|
+
});
|
|
1733
|
+
|
|
1734
|
+
return React.createElement(Table, Object.assign({}, tableProps), !hideTableHead && React.createElement(MRT_TableHead, null), React.createElement(MRT_TableBody, null), !hideTableFooter && React.createElement(MRT_TableFooter, null));
|
|
868
1735
|
};
|
|
869
1736
|
|
|
870
1737
|
var TextField = /*#__PURE__*/styled(TextField$1)({
|
|
@@ -873,9 +1740,9 @@ var TextField = /*#__PURE__*/styled(TextField$1)({
|
|
|
873
1740
|
var MRT_SearchTextField = function MRT_SearchTextField() {
|
|
874
1741
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
875
1742
|
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
876
|
-
|
|
1743
|
+
muiSearchTextFieldProps = _useMaterialReactTabl.muiSearchTextFieldProps,
|
|
877
1744
|
localization = _useMaterialReactTabl.localization,
|
|
878
|
-
|
|
1745
|
+
onGlobalFilterChange = _useMaterialReactTabl.onGlobalFilterChange;
|
|
879
1746
|
|
|
880
1747
|
var _useState = useState(''),
|
|
881
1748
|
searchValue = _useState[0],
|
|
@@ -885,7 +1752,7 @@ var MRT_SearchTextField = function MRT_SearchTextField() {
|
|
|
885
1752
|
var _event$target$value;
|
|
886
1753
|
|
|
887
1754
|
tableInstance.setGlobalFilter((_event$target$value = event.target.value) != null ? _event$target$value : undefined);
|
|
888
|
-
|
|
1755
|
+
onGlobalFilterChange == null ? void 0 : onGlobalFilterChange(event);
|
|
889
1756
|
}, 200);
|
|
890
1757
|
|
|
891
1758
|
var handleClear = function handleClear() {
|
|
@@ -909,7 +1776,7 @@ var MRT_SearchTextField = function MRT_SearchTextField() {
|
|
|
909
1776
|
})),
|
|
910
1777
|
endAdornment: React.createElement(InputAdornment, {
|
|
911
1778
|
position: "end"
|
|
912
|
-
}, React.createElement(IconButton$
|
|
1779
|
+
}, React.createElement(IconButton$2, {
|
|
913
1780
|
"aria-label": localization == null ? void 0 : localization.searchTextFieldClearButtonTitle,
|
|
914
1781
|
disabled: (searchValue == null ? void 0 : searchValue.length) === 0,
|
|
915
1782
|
onClick: handleClear,
|
|
@@ -919,104 +1786,284 @@ var MRT_SearchTextField = function MRT_SearchTextField() {
|
|
|
919
1786
|
fontSize: "small"
|
|
920
1787
|
})))
|
|
921
1788
|
}
|
|
922
|
-
},
|
|
1789
|
+
}, muiSearchTextFieldProps));
|
|
923
1790
|
};
|
|
924
1791
|
|
|
925
|
-
var
|
|
926
|
-
|
|
1792
|
+
var MRT_ToggleFiltersButton = function MRT_ToggleFiltersButton() {
|
|
1793
|
+
var _localization$toggleF;
|
|
1794
|
+
|
|
1795
|
+
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
1796
|
+
localization = _useMaterialReactTabl.localization,
|
|
1797
|
+
setShowFilters = _useMaterialReactTabl.setShowFilters,
|
|
1798
|
+
showFilters = _useMaterialReactTabl.showFilters;
|
|
1799
|
+
|
|
1800
|
+
return React.createElement(Tooltip, {
|
|
1801
|
+
arrow: true,
|
|
1802
|
+
title: (_localization$toggleF = localization == null ? void 0 : localization.toggleFilterButtonTitle) != null ? _localization$toggleF : ''
|
|
1803
|
+
}, React.createElement(IconButton$2, {
|
|
1804
|
+
"aria-label": localization == null ? void 0 : localization.toggleFilterButtonTitle,
|
|
1805
|
+
onClick: function onClick() {
|
|
1806
|
+
return setShowFilters(!showFilters);
|
|
1807
|
+
},
|
|
1808
|
+
size: "small"
|
|
1809
|
+
}, showFilters ? React.createElement(FilterListOffIcon, null) : React.createElement(FilterIcon, null)));
|
|
1810
|
+
};
|
|
1811
|
+
|
|
1812
|
+
var MRT_ShowHideColumnsMenu = function MRT_ShowHideColumnsMenu(_ref) {
|
|
1813
|
+
var _column$columns;
|
|
1814
|
+
|
|
1815
|
+
var column = _ref.column;
|
|
1816
|
+
|
|
1817
|
+
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
1818
|
+
maxColumnDepth = _useMaterialReactTabl.maxColumnDepth;
|
|
1819
|
+
|
|
1820
|
+
var isMaxDepth = column.depth === maxColumnDepth;
|
|
1821
|
+
return React.createElement(React.Fragment, null, React.createElement(MenuItem$2, {
|
|
1822
|
+
style: {
|
|
1823
|
+
paddingLeft: column.depth + 1 + "rem"
|
|
1824
|
+
}
|
|
1825
|
+
}, isMaxDepth ? React.createElement(FormControlLabel, {
|
|
1826
|
+
checked: column.isVisible,
|
|
1827
|
+
control: React.createElement(Switch, null),
|
|
1828
|
+
label: column.Header,
|
|
1829
|
+
onChange: function onChange() {
|
|
1830
|
+
return isMaxDepth && column.toggleHidden();
|
|
1831
|
+
}
|
|
1832
|
+
}) : React.createElement(Typography, null, column.Header)), (_column$columns = column.columns) == null ? void 0 : _column$columns.map(function (c, i) {
|
|
1833
|
+
return React.createElement(MRT_ShowHideColumnsMenu, {
|
|
1834
|
+
key: i + "-" + c.id,
|
|
1835
|
+
column: c
|
|
1836
|
+
});
|
|
1837
|
+
}));
|
|
1838
|
+
};
|
|
1839
|
+
|
|
1840
|
+
var MRT_ShowHideColumnsButton = function MRT_ShowHideColumnsButton() {
|
|
1841
|
+
var _localization$showHid;
|
|
1842
|
+
|
|
1843
|
+
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
1844
|
+
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
1845
|
+
localization = _useMaterialReactTabl.localization;
|
|
1846
|
+
|
|
1847
|
+
var _useState = useState(null),
|
|
1848
|
+
anchorEl = _useState[0],
|
|
1849
|
+
setAnchorEl = _useState[1];
|
|
1850
|
+
|
|
1851
|
+
var handleClick = function handleClick(event) {
|
|
1852
|
+
setAnchorEl(event.currentTarget);
|
|
1853
|
+
};
|
|
1854
|
+
|
|
1855
|
+
return React.createElement(React.Fragment, null, React.createElement(Tooltip, {
|
|
1856
|
+
arrow: true,
|
|
1857
|
+
title: (_localization$showHid = localization == null ? void 0 : localization.showHideColumnsButtonTitle) != null ? _localization$showHid : ''
|
|
1858
|
+
}, React.createElement(IconButton$2, {
|
|
1859
|
+
"aria-label": localization == null ? void 0 : localization.showHideColumnsButtonTitle,
|
|
1860
|
+
onClick: handleClick,
|
|
1861
|
+
size: "small"
|
|
1862
|
+
}, React.createElement(ViewColumnIcon, null))), React.createElement(Menu, {
|
|
1863
|
+
anchorEl: anchorEl,
|
|
1864
|
+
open: !!anchorEl,
|
|
1865
|
+
onClose: function onClose() {
|
|
1866
|
+
return setAnchorEl(null);
|
|
1867
|
+
}
|
|
1868
|
+
}, tableInstance.columns.map(function (column, index) {
|
|
1869
|
+
return React.createElement(MRT_ShowHideColumnsMenu, {
|
|
1870
|
+
key: index + "-" + column.id,
|
|
1871
|
+
column: column
|
|
1872
|
+
});
|
|
1873
|
+
})));
|
|
1874
|
+
};
|
|
1875
|
+
|
|
1876
|
+
var MRT_DensePaddingSwitch = function MRT_DensePaddingSwitch() {
|
|
1877
|
+
var _localization$toggleD;
|
|
1878
|
+
|
|
1879
|
+
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
1880
|
+
densePadding = _useMaterialReactTabl.densePadding,
|
|
1881
|
+
setDensePadding = _useMaterialReactTabl.setDensePadding,
|
|
1882
|
+
localization = _useMaterialReactTabl.localization;
|
|
1883
|
+
|
|
1884
|
+
return React.createElement(Tooltip, {
|
|
1885
|
+
arrow: true,
|
|
1886
|
+
title: (_localization$toggleD = localization == null ? void 0 : localization.toggleDensePaddingSwitchTitle) != null ? _localization$toggleD : ''
|
|
1887
|
+
}, React.createElement(Switch, {
|
|
1888
|
+
color: "default",
|
|
1889
|
+
checked: densePadding,
|
|
1890
|
+
size: "small",
|
|
1891
|
+
onChange: function onChange() {
|
|
1892
|
+
return setDensePadding(!densePadding);
|
|
1893
|
+
}
|
|
1894
|
+
}));
|
|
1895
|
+
};
|
|
1896
|
+
|
|
1897
|
+
var ToolbarButtonsContainer = /*#__PURE__*/styled('div')({
|
|
927
1898
|
display: 'flex',
|
|
928
|
-
|
|
1899
|
+
gap: '0.5rem',
|
|
1900
|
+
alignItems: 'center'
|
|
929
1901
|
});
|
|
930
|
-
var
|
|
1902
|
+
var MRT_ToolbarButtons = function MRT_ToolbarButtons() {
|
|
1903
|
+
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
1904
|
+
disableFilters = _useMaterialReactTabl.disableFilters,
|
|
1905
|
+
disableColumnHiding = _useMaterialReactTabl.disableColumnHiding,
|
|
1906
|
+
disableDensePaddingToggle = _useMaterialReactTabl.disableDensePaddingToggle;
|
|
1907
|
+
|
|
1908
|
+
return React.createElement(ToolbarButtonsContainer, null, !disableFilters && React.createElement(MRT_ToggleFiltersButton, null), !disableColumnHiding && React.createElement(MRT_ShowHideColumnsButton, null), !disableDensePaddingToggle && React.createElement(MRT_DensePaddingSwitch, null));
|
|
1909
|
+
};
|
|
1910
|
+
|
|
1911
|
+
var MRT_TablePagination = function MRT_TablePagination() {
|
|
931
1912
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
932
|
-
overrideTableToolbarComponent = _useMaterialReactTabl.overrideTableToolbarComponent,
|
|
933
|
-
enableSearch = _useMaterialReactTabl.enableSearch,
|
|
934
1913
|
tableInstance = _useMaterialReactTabl.tableInstance,
|
|
935
|
-
|
|
936
|
-
tableToolbarProps = _useMaterialReactTabl.tableToolbarProps,
|
|
937
|
-
title = _useMaterialReactTabl.title;
|
|
1914
|
+
muiTablePaginationProps = _useMaterialReactTabl.muiTablePaginationProps;
|
|
938
1915
|
|
|
939
|
-
|
|
940
|
-
return React.createElement(React.Fragment, null, overrideTableToolbarComponent(tableInstance));
|
|
941
|
-
} //if no features in the toolbar are enabled, don't render anything
|
|
1916
|
+
var tablePaginationProps = muiTablePaginationProps instanceof Function ? muiTablePaginationProps(tableInstance) : muiTablePaginationProps;
|
|
942
1917
|
|
|
1918
|
+
var handleChangeRowsPerPage = function handleChangeRowsPerPage(event) {
|
|
1919
|
+
tableInstance.setPageSize(+event.target.value);
|
|
1920
|
+
tableInstance.gotoPage(0);
|
|
1921
|
+
};
|
|
1922
|
+
|
|
1923
|
+
return React.createElement(TablePagination, Object.assign({
|
|
1924
|
+
component: 'div',
|
|
1925
|
+
count: tableInstance.rows.length,
|
|
1926
|
+
onPageChange: function onPageChange(_, newPage) {
|
|
1927
|
+
return tableInstance.gotoPage(newPage);
|
|
1928
|
+
},
|
|
1929
|
+
onRowsPerPageChange: handleChangeRowsPerPage,
|
|
1930
|
+
page: tableInstance.state.pageIndex,
|
|
1931
|
+
rowsPerPage: tableInstance.state.pageSize,
|
|
1932
|
+
showFirstButton: tableInstance.rows.length / tableInstance.state.pageSize > 2,
|
|
1933
|
+
showLastButton: tableInstance.rows.length / tableInstance.state.pageSize > 2
|
|
1934
|
+
}, tablePaginationProps));
|
|
1935
|
+
};
|
|
943
1936
|
|
|
944
|
-
|
|
1937
|
+
var Toolbar = /*#__PURE__*/styled(Toolbar$2)({
|
|
1938
|
+
display: 'grid'
|
|
1939
|
+
});
|
|
1940
|
+
var ToolbarTopRow = /*#__PURE__*/styled('div')({
|
|
1941
|
+
padding: '0.5rem',
|
|
1942
|
+
display: 'flex',
|
|
1943
|
+
justifyContent: 'space-between'
|
|
1944
|
+
});
|
|
1945
|
+
var ToolbarActionsContainer = /*#__PURE__*/styled('div')({
|
|
1946
|
+
display: 'flex',
|
|
1947
|
+
gap: '0.5rem'
|
|
1948
|
+
});
|
|
1949
|
+
var MRT_ToolbarTop = function MRT_ToolbarTop() {
|
|
1950
|
+
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
1951
|
+
disableGlobalFilter = _useMaterialReactTabl.disableGlobalFilter,
|
|
1952
|
+
disableColumnHiding = _useMaterialReactTabl.disableColumnHiding,
|
|
1953
|
+
muiTableTitleProps = _useMaterialReactTabl.muiTableTitleProps,
|
|
1954
|
+
disableFilters = _useMaterialReactTabl.disableFilters,
|
|
1955
|
+
manualPagination = _useMaterialReactTabl.manualPagination,
|
|
1956
|
+
positionPagination = _useMaterialReactTabl.positionPagination,
|
|
1957
|
+
muiTableToolbarTopProps = _useMaterialReactTabl.muiTableToolbarTopProps,
|
|
1958
|
+
hideToolbarActions = _useMaterialReactTabl.hideToolbarActions,
|
|
1959
|
+
positionToolbarActions = _useMaterialReactTabl.positionToolbarActions,
|
|
1960
|
+
title = _useMaterialReactTabl.title,
|
|
1961
|
+
tableInstance = _useMaterialReactTabl.tableInstance; // if no features in the toolbar are enabled, don't render anything
|
|
1962
|
+
|
|
1963
|
+
|
|
1964
|
+
if (!muiTableToolbarTopProps && !title && disableColumnHiding && disableFilters && disableGlobalFilter) {
|
|
945
1965
|
return null;
|
|
946
1966
|
}
|
|
947
1967
|
|
|
1968
|
+
var toolbarProps = muiTableToolbarTopProps instanceof Function ? muiTableToolbarTopProps(tableInstance) : muiTableToolbarTopProps;
|
|
948
1969
|
return React.createElement(Toolbar, Object.assign({
|
|
949
1970
|
variant: "dense"
|
|
950
|
-
},
|
|
1971
|
+
}, toolbarProps), React.createElement(ToolbarTopRow, null, title ? React.createElement(Typography, Object.assign({
|
|
1972
|
+
variant: "h5"
|
|
1973
|
+
}, muiTableTitleProps), title) : React.createElement("span", null), React.createElement(ToolbarActionsContainer, null, !disableGlobalFilter && React.createElement(MRT_SearchTextField, null), !hideToolbarActions && positionToolbarActions === 'top' && React.createElement(MRT_ToolbarButtons, null))), React.createElement("div", null, !manualPagination && ['top', 'both'].includes(positionPagination != null ? positionPagination : '') && React.createElement(MRT_TablePagination, null)));
|
|
1974
|
+
};
|
|
1975
|
+
|
|
1976
|
+
var Toolbar$1 = /*#__PURE__*/styled(Toolbar$2)({
|
|
1977
|
+
padding: 0,
|
|
1978
|
+
display: 'flex',
|
|
1979
|
+
justifyContent: 'space-between'
|
|
1980
|
+
});
|
|
1981
|
+
var MRT_ToolbarBottom = function MRT_ToolbarBottom() {
|
|
1982
|
+
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
1983
|
+
disableGlobalFilter = _useMaterialReactTabl.disableGlobalFilter,
|
|
1984
|
+
disableColumnHiding = _useMaterialReactTabl.disableColumnHiding,
|
|
1985
|
+
manualPagination = _useMaterialReactTabl.manualPagination,
|
|
1986
|
+
positionPagination = _useMaterialReactTabl.positionPagination,
|
|
1987
|
+
disableFilters = _useMaterialReactTabl.disableFilters,
|
|
1988
|
+
hideToolbarActions = _useMaterialReactTabl.hideToolbarActions,
|
|
1989
|
+
positionToolbarActions = _useMaterialReactTabl.positionToolbarActions,
|
|
1990
|
+
muiTableToolbarBottomProps = _useMaterialReactTabl.muiTableToolbarBottomProps,
|
|
1991
|
+
title = _useMaterialReactTabl.title,
|
|
1992
|
+
tableInstance = _useMaterialReactTabl.tableInstance; // if no features in the toolbar are enabled, don't render anything
|
|
1993
|
+
|
|
1994
|
+
|
|
1995
|
+
if (!muiTableToolbarBottomProps && !title && disableColumnHiding && disableFilters && disableGlobalFilter) {
|
|
1996
|
+
return null;
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
var toolbarProps = muiTableToolbarBottomProps instanceof Function ? muiTableToolbarBottomProps(tableInstance) : muiTableToolbarBottomProps;
|
|
2000
|
+
return React.createElement(Toolbar$1, Object.assign({
|
|
2001
|
+
variant: "dense"
|
|
2002
|
+
}, toolbarProps), !hideToolbarActions && positionToolbarActions === 'bottom' ? React.createElement(MRT_ToolbarButtons, null) : React.createElement("span", null), !manualPagination && ['bottom', 'both'].includes(positionPagination != null ? positionPagination : '') && React.createElement(MRT_TablePagination, null));
|
|
951
2003
|
};
|
|
952
2004
|
|
|
953
2005
|
var MRT_TableContainer = function MRT_TableContainer() {
|
|
954
2006
|
var _useMaterialReactTabl = useMaterialReactTable(),
|
|
955
|
-
|
|
956
|
-
|
|
2007
|
+
muiTableContainerProps = _useMaterialReactTabl.muiTableContainerProps,
|
|
2008
|
+
hideToolbarTop = _useMaterialReactTabl.hideToolbarTop,
|
|
2009
|
+
hideToolbarBottom = _useMaterialReactTabl.hideToolbarBottom,
|
|
2010
|
+
isFetching = _useMaterialReactTabl.isFetching;
|
|
957
2011
|
|
|
958
2012
|
return React.createElement(TableContainer, Object.assign({
|
|
959
2013
|
component: Paper
|
|
960
|
-
},
|
|
2014
|
+
}, muiTableContainerProps), !hideToolbarTop && React.createElement(MRT_ToolbarTop, null), isFetching && React.createElement(LinearProgress, null), React.createElement(MRT_Table, null), !hideToolbarBottom && React.createElement(MRT_ToolbarBottom, null));
|
|
961
2015
|
};
|
|
962
2016
|
|
|
963
2017
|
var defaultLocalization = {
|
|
2018
|
+
actionsHeadColumnTitle: 'Actions',
|
|
964
2019
|
columnActionMenuButtonTitle: 'Column Actions',
|
|
2020
|
+
columnActionMenuItemClearSort: 'Clear sorting',
|
|
2021
|
+
columnActionMenuItemGroupBy: 'Group by column',
|
|
965
2022
|
columnActionMenuItemHideColumn: 'Hide column',
|
|
966
2023
|
columnActionMenuItemSortAsc: 'Sort ascending',
|
|
967
|
-
columnActionMenuItemClearSort: 'Clear sorting',
|
|
968
2024
|
columnActionMenuItemSortDesc: 'Sort descending',
|
|
969
|
-
columnActionMenuItemGroupBy: 'Group by column',
|
|
970
2025
|
columnActionMenuItemUnGroupBy: 'Ungroup column',
|
|
971
2026
|
expandAllButtonTitle: 'Expand all',
|
|
972
2027
|
expandButtonTitle: 'Expand',
|
|
973
2028
|
filterTextFieldClearButtonTitle: 'Clear filter',
|
|
974
2029
|
filterTextFieldPlaceholder: 'Filter',
|
|
2030
|
+
rowActionMenuButtonTitle: 'Row Actions',
|
|
2031
|
+
rowActionsColumnTitle: 'Actions',
|
|
2032
|
+
rowActionMenuItemEdit: 'Edit',
|
|
2033
|
+
rowActionButtonSave: 'Save',
|
|
2034
|
+
rowActionButtonCancel: 'Cancel',
|
|
975
2035
|
searchTextFieldClearButtonTitle: 'Clear search',
|
|
976
2036
|
searchTextFieldPlaceholder: 'Search',
|
|
977
|
-
showHideColumnsButtonTitle: 'Show/Hide columns'
|
|
2037
|
+
showHideColumnsButtonTitle: 'Show/Hide columns',
|
|
2038
|
+
toggleDensePaddingSwitchTitle: 'Toggle dense padding',
|
|
2039
|
+
toggleFilterButtonTitle: 'Toggle filters'
|
|
978
2040
|
};
|
|
979
2041
|
|
|
980
|
-
var _excluded
|
|
981
|
-
var MaterialReactTable = function
|
|
2042
|
+
var _excluded = ["defaultColumn", "localization", "positionActionsColumn", "positionPagination", "positionToolbarActions"];
|
|
2043
|
+
var MaterialReactTable = (function (_ref) {
|
|
982
2044
|
var _ref$defaultColumn = _ref.defaultColumn,
|
|
983
2045
|
defaultColumn = _ref$defaultColumn === void 0 ? {
|
|
984
2046
|
minWidth: 50,
|
|
985
2047
|
maxWidth: 1000
|
|
986
2048
|
} : _ref$defaultColumn,
|
|
987
|
-
_ref$enablePagination = _ref.enablePagination,
|
|
988
|
-
enablePagination = _ref$enablePagination === void 0 ? true : _ref$enablePagination,
|
|
989
|
-
_ref$enableSorting = _ref.enableSorting,
|
|
990
|
-
enableSorting = _ref$enableSorting === void 0 ? true : _ref$enableSorting,
|
|
991
|
-
_ref$enableSubRowTree = _ref.enableSubRowTree,
|
|
992
|
-
enableSubRowTree = _ref$enableSubRowTree === void 0 ? true : _ref$enableSubRowTree,
|
|
993
2049
|
_ref$localization = _ref.localization,
|
|
994
2050
|
localization = _ref$localization === void 0 ? defaultLocalization : _ref$localization,
|
|
2051
|
+
_ref$positionActionsC = _ref.positionActionsColumn,
|
|
2052
|
+
positionActionsColumn = _ref$positionActionsC === void 0 ? 'first' : _ref$positionActionsC,
|
|
995
2053
|
_ref$positionPaginati = _ref.positionPagination,
|
|
996
2054
|
positionPagination = _ref$positionPaginati === void 0 ? 'bottom' : _ref$positionPaginati,
|
|
997
|
-
_ref$
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
showFooter = _ref$showFooter === void 0 ? true : _ref$showFooter,
|
|
1001
|
-
_ref$showHead = _ref.showHead,
|
|
1002
|
-
showHead = _ref$showHead === void 0 ? true : _ref$showHead,
|
|
1003
|
-
_ref$showToolbar = _ref.showToolbar,
|
|
1004
|
-
showToolbar = _ref$showToolbar === void 0 ? true : _ref$showToolbar,
|
|
1005
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
2055
|
+
_ref$positionToolbarA = _ref.positionToolbarActions,
|
|
2056
|
+
positionToolbarActions = _ref$positionToolbarA === void 0 ? 'top' : _ref$positionToolbarA,
|
|
2057
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1006
2058
|
|
|
1007
2059
|
return React.createElement(MaterialReactTableProvider, Object.assign({
|
|
1008
2060
|
defaultColumn: defaultColumn,
|
|
1009
|
-
enablePagination: enablePagination,
|
|
1010
|
-
enableSorting: enableSorting,
|
|
1011
|
-
enableSubRowTree: enableSubRowTree,
|
|
1012
2061
|
localization: _extends({}, defaultLocalization, localization),
|
|
1013
2062
|
positionPagination: positionPagination,
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
showHead: showHead,
|
|
1017
|
-
showToolbar: showToolbar
|
|
2063
|
+
positionActionsColumn: positionActionsColumn,
|
|
2064
|
+
positionToolbarActions: positionToolbarActions
|
|
1018
2065
|
}, rest), React.createElement(MRT_TableContainer, null));
|
|
1019
|
-
};
|
|
2066
|
+
});
|
|
1020
2067
|
|
|
1021
2068
|
export default MaterialReactTable;
|
|
1022
2069
|
//# sourceMappingURL=material-react-table.esm.js.map
|