mui-universal-table 2.1.20 → 2.1.21
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/index.cjs +134 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +134 -134
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var React = require('react');
|
|
|
6
6
|
var PropTypes = require('prop-types');
|
|
7
7
|
var Paper = require('@mui/material/Paper');
|
|
8
8
|
var material = require('@mui/material');
|
|
9
|
-
var
|
|
9
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
var styles = require('@mui/material/styles');
|
|
11
11
|
var iconsMaterial = require('@mui/icons-material');
|
|
12
12
|
var RefreshIcon = require('@mui/icons-material/Refresh');
|
|
@@ -16,28 +16,28 @@ const LazyLoadingIndicator = ({
|
|
|
16
16
|
currentPage,
|
|
17
17
|
totalPages
|
|
18
18
|
}) => {
|
|
19
|
-
return /*#__PURE__*/
|
|
19
|
+
return /*#__PURE__*/jsxRuntime.jsx(material.Collapse, {
|
|
20
20
|
in: show,
|
|
21
21
|
timeout: "auto",
|
|
22
22
|
unmountOnExit: true,
|
|
23
|
-
children: /*#__PURE__*/
|
|
23
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
24
24
|
sx: {
|
|
25
25
|
width: "100%",
|
|
26
26
|
p: 2
|
|
27
27
|
},
|
|
28
|
-
children: [/*#__PURE__*/
|
|
28
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(material.Typography, {
|
|
29
29
|
variant: "body2",
|
|
30
30
|
color: "text.secondary",
|
|
31
31
|
sx: {
|
|
32
32
|
mb: 1
|
|
33
33
|
},
|
|
34
34
|
children: ["Loading page ", currentPage, " of ", totalPages, "..."]
|
|
35
|
-
}
|
|
35
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.LinearProgress, {
|
|
36
36
|
variant: "determinate",
|
|
37
37
|
value: currentPage / totalPages * 100
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
38
|
+
})]
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
41
|
};
|
|
42
42
|
LazyLoadingIndicator.propTypes = {
|
|
43
43
|
show: PropTypes.bool.isRequired,
|
|
@@ -223,10 +223,10 @@ function TableSelectionBanner({
|
|
|
223
223
|
onSelection,
|
|
224
224
|
selectIcon
|
|
225
225
|
}) {
|
|
226
|
-
return /*#__PURE__*/
|
|
226
|
+
return /*#__PURE__*/jsxRuntime.jsx(material.Collapse, {
|
|
227
227
|
in: selected.length > 0,
|
|
228
228
|
unmountOnExit: true,
|
|
229
|
-
children: /*#__PURE__*/
|
|
229
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
230
230
|
sx: {
|
|
231
231
|
p: 2,
|
|
232
232
|
display: "flex",
|
|
@@ -236,17 +236,17 @@ function TableSelectionBanner({
|
|
|
236
236
|
borderBottomLeftRadius: 0,
|
|
237
237
|
borderBottomRightRadius: 0
|
|
238
238
|
},
|
|
239
|
-
children: [/*#__PURE__*/
|
|
239
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(material.Typography, {
|
|
240
240
|
variant: "h6",
|
|
241
241
|
id: "tableTitle",
|
|
242
242
|
component: "div",
|
|
243
243
|
children: [selected.length, " selected"]
|
|
244
|
-
}
|
|
244
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.IconButton, {
|
|
245
245
|
onClick: () => onSelection(selected),
|
|
246
|
-
children: selectIcon || /*#__PURE__*/
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
246
|
+
children: selectIcon || /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.Task, {})
|
|
247
|
+
})]
|
|
248
|
+
})
|
|
249
|
+
});
|
|
250
250
|
}
|
|
251
251
|
TableSelectionBanner.propTypes = {
|
|
252
252
|
selected: PropTypes.array.isRequired,
|
|
@@ -258,14 +258,14 @@ function TableTitle({
|
|
|
258
258
|
name,
|
|
259
259
|
subTable
|
|
260
260
|
}) {
|
|
261
|
-
return /*#__PURE__*/
|
|
261
|
+
return /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
262
262
|
variant: subTable ? "h6" : "h5",
|
|
263
263
|
color: subTable ? "secondary" : "primary",
|
|
264
264
|
sx: {
|
|
265
265
|
p: 2
|
|
266
266
|
},
|
|
267
267
|
children: name
|
|
268
|
-
}
|
|
268
|
+
});
|
|
269
269
|
}
|
|
270
270
|
TableTitle.propTypes = {
|
|
271
271
|
name: PropTypes.string,
|
|
@@ -285,16 +285,16 @@ function ReloadBtn({
|
|
|
285
285
|
onReload();
|
|
286
286
|
}
|
|
287
287
|
};
|
|
288
|
-
return /*#__PURE__*/
|
|
288
|
+
return /*#__PURE__*/jsxRuntime.jsx(material.Tooltip, {
|
|
289
289
|
title: "Reload",
|
|
290
|
-
children: /*#__PURE__*/
|
|
290
|
+
children: /*#__PURE__*/jsxRuntime.jsx(material.Button, {
|
|
291
291
|
variant: "contained",
|
|
292
292
|
color: "primary",
|
|
293
293
|
onClick: handleClick,
|
|
294
294
|
disabled: loading,
|
|
295
|
-
children: /*#__PURE__*/
|
|
296
|
-
}
|
|
297
|
-
}
|
|
295
|
+
children: /*#__PURE__*/jsxRuntime.jsx(RefreshIcon, {})
|
|
296
|
+
})
|
|
297
|
+
});
|
|
298
298
|
}
|
|
299
299
|
ReloadBtn.propTypes = {
|
|
300
300
|
loading: PropTypes.bool,
|
|
@@ -320,9 +320,9 @@ function FancySearch({
|
|
|
320
320
|
// A ref tracks whether this sync came from the user typing or from a parent
|
|
321
321
|
// update, so the debounce only fires for genuine user input.
|
|
322
322
|
const isUserTypingRef = React.useRef(false);
|
|
323
|
-
return /*#__PURE__*/
|
|
323
|
+
return /*#__PURE__*/jsxRuntime.jsx("form", {
|
|
324
324
|
onSubmit: handleSubmit,
|
|
325
|
-
children: /*#__PURE__*/
|
|
325
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(material.Paper, {
|
|
326
326
|
elevation: 0,
|
|
327
327
|
sx: {
|
|
328
328
|
borderRadius: expanded ? "24px" : "50px",
|
|
@@ -337,7 +337,7 @@ function FancySearch({
|
|
|
337
337
|
onMouseEnter: () => setHover(true),
|
|
338
338
|
onMouseLeave: handleEndHover,
|
|
339
339
|
onKeyDown: e => e.key === "Enter" && handleSubmit(e),
|
|
340
|
-
children: [/*#__PURE__*/
|
|
340
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(material.InputBase, {
|
|
341
341
|
placeholder: "Search",
|
|
342
342
|
value: value,
|
|
343
343
|
onChange: e => {
|
|
@@ -353,36 +353,36 @@ function FancySearch({
|
|
|
353
353
|
})
|
|
354
354
|
},
|
|
355
355
|
onBlur: handleEndHover
|
|
356
|
-
}
|
|
356
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Collapse, {
|
|
357
357
|
in: Boolean(value),
|
|
358
358
|
orientation: "horizontal",
|
|
359
359
|
unmountOnExit: true,
|
|
360
|
-
children: /*#__PURE__*/
|
|
360
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(material.Stack, {
|
|
361
361
|
direction: "row",
|
|
362
362
|
spacing: 0,
|
|
363
363
|
sx: {
|
|
364
364
|
mr: 3,
|
|
365
365
|
alignItems: "center"
|
|
366
366
|
},
|
|
367
|
-
children: [/*#__PURE__*/
|
|
367
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(material.IconButton, {
|
|
368
368
|
onClick: () => {
|
|
369
369
|
isUserTypingRef.current = false;
|
|
370
370
|
// Immediately clear instead of waiting for the debounce
|
|
371
371
|
onSubmit("");
|
|
372
372
|
},
|
|
373
|
-
children: /*#__PURE__*/
|
|
374
|
-
}
|
|
373
|
+
children: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.Clear, {})
|
|
374
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Divider, {
|
|
375
375
|
orientation: "vertical",
|
|
376
376
|
flexItem: true
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
377
|
+
})]
|
|
378
|
+
})
|
|
379
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.IconButton, {
|
|
380
380
|
onClick: handleSubmit,
|
|
381
381
|
type: "submit",
|
|
382
|
-
children: /*#__PURE__*/
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
382
|
+
children: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.Search, {})
|
|
383
|
+
})]
|
|
384
|
+
})
|
|
385
|
+
});
|
|
386
386
|
}
|
|
387
387
|
FancySearch.propTypes = {
|
|
388
388
|
value: PropTypes.string,
|
|
@@ -403,12 +403,12 @@ function SearchArea(props) {
|
|
|
403
403
|
}
|
|
404
404
|
return "";
|
|
405
405
|
}, [current, persistSearch, searchName]);
|
|
406
|
-
return /*#__PURE__*/
|
|
407
|
-
children: /*#__PURE__*/
|
|
406
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
407
|
+
children: /*#__PURE__*/jsxRuntime.jsx(FancySearch, {
|
|
408
408
|
value: searchVal,
|
|
409
409
|
onSubmit: setFinalVal
|
|
410
|
-
}
|
|
411
|
-
}, "SearchArea"
|
|
410
|
+
})
|
|
411
|
+
}, "SearchArea");
|
|
412
412
|
}
|
|
413
413
|
SearchArea.propTypes = {
|
|
414
414
|
current: PropTypes.string,
|
|
@@ -426,7 +426,7 @@ function TableToolbarContent({
|
|
|
426
426
|
name,
|
|
427
427
|
persistSearch
|
|
428
428
|
}) {
|
|
429
|
-
return /*#__PURE__*/
|
|
429
|
+
return /*#__PURE__*/jsxRuntime.jsx(material.Toolbar, {
|
|
430
430
|
sx: {
|
|
431
431
|
pl: {
|
|
432
432
|
sm: 2
|
|
@@ -437,7 +437,7 @@ function TableToolbarContent({
|
|
|
437
437
|
},
|
|
438
438
|
pt: 2
|
|
439
439
|
},
|
|
440
|
-
children: /*#__PURE__*/
|
|
440
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(material.Stack, {
|
|
441
441
|
spacing: 2,
|
|
442
442
|
direction: {
|
|
443
443
|
xs: "column",
|
|
@@ -450,23 +450,23 @@ function TableToolbarContent({
|
|
|
450
450
|
md: "center"
|
|
451
451
|
}
|
|
452
452
|
},
|
|
453
|
-
children: [/*#__PURE__*/
|
|
453
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
454
454
|
sx: {
|
|
455
455
|
flex: "1 1 100%"
|
|
456
456
|
},
|
|
457
457
|
id: "tableTitle",
|
|
458
|
-
children: /*#__PURE__*/
|
|
458
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ReloadBtn, {
|
|
459
459
|
onReload: onReload,
|
|
460
460
|
loading: reloadBtnLoading
|
|
461
|
-
}
|
|
462
|
-
}
|
|
461
|
+
})
|
|
462
|
+
}), /*#__PURE__*/jsxRuntime.jsx(SearchArea, {
|
|
463
463
|
current: searchTerm,
|
|
464
464
|
setFinalVal: onSearchChange,
|
|
465
465
|
searchName: name,
|
|
466
466
|
persistSearch: persistSearch
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
467
|
+
})]
|
|
468
|
+
})
|
|
469
|
+
});
|
|
470
470
|
}
|
|
471
471
|
TableToolbarContent.propTypes = {
|
|
472
472
|
onReload: PropTypes.func,
|
|
@@ -582,34 +582,34 @@ function EnhancedTableHead(props) {
|
|
|
582
582
|
onSelectAllClick,
|
|
583
583
|
async
|
|
584
584
|
} = props;
|
|
585
|
-
return /*#__PURE__*/
|
|
586
|
-
children: /*#__PURE__*/
|
|
587
|
-
children: [selectRows && /*#__PURE__*/
|
|
585
|
+
return /*#__PURE__*/jsxRuntime.jsx(material.TableHead, {
|
|
586
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(material.TableRow, {
|
|
587
|
+
children: [selectRows && /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
|
|
588
588
|
padding: "checkbox",
|
|
589
|
-
children: /*#__PURE__*/
|
|
589
|
+
children: /*#__PURE__*/jsxRuntime.jsx(material.Checkbox, {
|
|
590
590
|
color: "primary",
|
|
591
591
|
indeterminate: numSelected > 0 && numSelected < rowCount,
|
|
592
592
|
checked: rowCount > 0 && numSelected === rowCount,
|
|
593
593
|
onChange: onSelectAllClick
|
|
594
|
-
}
|
|
595
|
-
}
|
|
594
|
+
})
|
|
595
|
+
}), props.headings.map(headCell => /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
|
|
596
596
|
align: headCell.numeric ? "right" : "left",
|
|
597
597
|
padding: "normal",
|
|
598
598
|
sortDirection: orderBy === headCell.id ? order : false,
|
|
599
|
-
children: /*#__PURE__*/
|
|
599
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(material.TableSortLabel, {
|
|
600
600
|
active: orderBy === headCell.id,
|
|
601
601
|
direction: orderBy === headCell.id ? order : "asc",
|
|
602
602
|
onClick: () => onRequestSort(headCell.id, headCell.sortable && async),
|
|
603
603
|
disabled: headCell.subRow,
|
|
604
|
-
children: [headCell.label, orderBy === headCell.id ? /*#__PURE__*/
|
|
604
|
+
children: [headCell.label, orderBy === headCell.id ? /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
605
605
|
component: "span",
|
|
606
606
|
sx: visuallyHidden,
|
|
607
607
|
children: order === "desc" ? "sorted descending" : "sorted ascending"
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
}, headCell.id
|
|
611
|
-
}
|
|
612
|
-
}
|
|
608
|
+
}) : undefined]
|
|
609
|
+
})
|
|
610
|
+
}, headCell.id))]
|
|
611
|
+
})
|
|
612
|
+
});
|
|
613
613
|
}
|
|
614
614
|
EnhancedTableHead.propTypes = {
|
|
615
615
|
onRequestSort: PropTypes.func.isRequired,
|
|
@@ -636,18 +636,18 @@ function SubRowToggleCell({
|
|
|
636
636
|
rowValues,
|
|
637
637
|
hideBadge
|
|
638
638
|
}) {
|
|
639
|
-
return /*#__PURE__*/
|
|
640
|
-
children: /*#__PURE__*/
|
|
639
|
+
return /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
|
|
640
|
+
children: /*#__PURE__*/jsxRuntime.jsx(material.Tooltip, {
|
|
641
641
|
title: isOpen ? `Hide ${header.id}` : `Show ${header.id}`,
|
|
642
|
-
children: /*#__PURE__*/
|
|
643
|
-
children: /*#__PURE__*/
|
|
642
|
+
children: /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
643
|
+
children: /*#__PURE__*/jsxRuntime.jsx(material.IconButton, {
|
|
644
644
|
onClick: event => {
|
|
645
645
|
event.stopPropagation();
|
|
646
646
|
onToggle();
|
|
647
647
|
},
|
|
648
648
|
disabled: rowValues[header.id].length === 0,
|
|
649
649
|
color: header.iconColor || "secondary",
|
|
650
|
-
children: /*#__PURE__*/
|
|
650
|
+
children: /*#__PURE__*/jsxRuntime.jsx(material.Badge, {
|
|
651
651
|
badgeContent: rowValues[header.id].length,
|
|
652
652
|
invisible: hideBadge,
|
|
653
653
|
anchorOrigin: {
|
|
@@ -659,12 +659,12 @@ function SubRowToggleCell({
|
|
|
659
659
|
color: theme => theme.palette.text.primary
|
|
660
660
|
}
|
|
661
661
|
},
|
|
662
|
-
children: isOpen ? header?.closeIcon || /*#__PURE__*/
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
}
|
|
662
|
+
children: isOpen ? header?.closeIcon || /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.RemoveCircle, {}) : header?.openIcon || /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.AddCircle, {})
|
|
663
|
+
})
|
|
664
|
+
})
|
|
665
|
+
})
|
|
666
|
+
})
|
|
667
|
+
});
|
|
668
668
|
}
|
|
669
669
|
SubRowToggleCell.propTypes = {
|
|
670
670
|
header: PropTypes.object.isRequired,
|
|
@@ -684,20 +684,20 @@ function SubTableRow({
|
|
|
684
684
|
rowValues,
|
|
685
685
|
colSpan
|
|
686
686
|
}) {
|
|
687
|
-
return /*#__PURE__*/
|
|
688
|
-
children: /*#__PURE__*/
|
|
687
|
+
return /*#__PURE__*/jsxRuntime.jsx(material.TableRow, {
|
|
688
|
+
children: /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
|
|
689
689
|
colSpan: colSpan,
|
|
690
690
|
style: {
|
|
691
691
|
paddingBottom: 0,
|
|
692
692
|
paddingTop: 0
|
|
693
693
|
},
|
|
694
|
-
children: /*#__PURE__*/
|
|
694
|
+
children: /*#__PURE__*/jsxRuntime.jsx(material.Collapse, {
|
|
695
695
|
in: isOpen,
|
|
696
696
|
timeout: "auto",
|
|
697
697
|
unmountOnExit: true,
|
|
698
|
-
children: /*#__PURE__*/
|
|
698
|
+
children: /*#__PURE__*/jsxRuntime.jsx(React.Suspense, {
|
|
699
699
|
fallback: null,
|
|
700
|
-
children: /*#__PURE__*/
|
|
700
|
+
children: /*#__PURE__*/jsxRuntime.jsx(UniversalTable$2, {
|
|
701
701
|
loading: table.loading,
|
|
702
702
|
setLoading: table.setLoading,
|
|
703
703
|
onReload: table.onReload,
|
|
@@ -705,11 +705,11 @@ function SubTableRow({
|
|
|
705
705
|
headers: table.headers,
|
|
706
706
|
name: table.subTitle,
|
|
707
707
|
subTable: true
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
}
|
|
708
|
+
})
|
|
709
|
+
})
|
|
710
|
+
})
|
|
711
|
+
})
|
|
712
|
+
});
|
|
713
713
|
}
|
|
714
714
|
SubTableRow.propTypes = {
|
|
715
715
|
table: PropTypes.object.isRequired,
|
|
@@ -719,10 +719,10 @@ SubTableRow.propTypes = {
|
|
|
719
719
|
};
|
|
720
720
|
|
|
721
721
|
function renderDataCells(headers, rowValues) {
|
|
722
|
-
return headers.map(header => /*#__PURE__*/
|
|
722
|
+
return headers.map(header => /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
|
|
723
723
|
...header.cellProps,
|
|
724
724
|
children: header.component ? header.component(rowValues) : formatCellValue(header, rowValues)
|
|
725
|
-
}, header.id ?? header.label
|
|
725
|
+
}, header.id ?? header.label));
|
|
726
726
|
}
|
|
727
727
|
const DataRow = /*#__PURE__*/React.memo(function DataRow(props) {
|
|
728
728
|
const {
|
|
@@ -754,35 +754,35 @@ const DataRow = /*#__PURE__*/React.memo(function DataRow(props) {
|
|
|
754
754
|
handleClick(event, props.rowID);
|
|
755
755
|
}
|
|
756
756
|
}, [selectRows, handleClick, props.rowID]);
|
|
757
|
-
return /*#__PURE__*/
|
|
758
|
-
children: [/*#__PURE__*/
|
|
757
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
758
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(material.TableRow, {
|
|
759
759
|
tabIndex: selectRows ? 0 : -1,
|
|
760
760
|
hover: selectRows,
|
|
761
761
|
role: selectRows ? "checkbox" : "row",
|
|
762
762
|
selected: isItemSelected,
|
|
763
763
|
"aria-checked": isItemSelected,
|
|
764
764
|
onKeyDown: handleRowKeyDown,
|
|
765
|
-
children: [selectRows && /*#__PURE__*/
|
|
765
|
+
children: [selectRows && /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
|
|
766
766
|
padding: "checkbox",
|
|
767
|
-
children: /*#__PURE__*/
|
|
767
|
+
children: /*#__PURE__*/jsxRuntime.jsx(material.Checkbox, {
|
|
768
768
|
color: "primary",
|
|
769
769
|
checked: isItemSelected,
|
|
770
770
|
onClick: event => handleClick(event, props.rowID)
|
|
771
|
-
}
|
|
772
|
-
}
|
|
771
|
+
})
|
|
772
|
+
}), subTables.map((header, index) => /*#__PURE__*/jsxRuntime.jsx(SubRowToggleCell, {
|
|
773
773
|
header: header,
|
|
774
774
|
isOpen: reveal[index],
|
|
775
775
|
onToggle: () => toggleSubRow(index),
|
|
776
776
|
rowValues: rowValues,
|
|
777
777
|
hideBadge: hideBadge
|
|
778
|
-
}, header.id ?? header.label
|
|
779
|
-
}
|
|
778
|
+
}, header.id ?? header.label)), renderDataCells(columns, rowValues)]
|
|
779
|
+
}), subTables.map((table, index) => /*#__PURE__*/jsxRuntime.jsx(SubTableRow, {
|
|
780
780
|
table: table,
|
|
781
781
|
isOpen: reveal[index],
|
|
782
782
|
rowValues: rowValues,
|
|
783
783
|
colSpan: props.headers.length + 1
|
|
784
|
-
}, table.id ?? table.label
|
|
785
|
-
}
|
|
784
|
+
}, table.id ?? table.label))]
|
|
785
|
+
});
|
|
786
786
|
});
|
|
787
787
|
DataRow.propTypes = {
|
|
788
788
|
rowValues: PropTypes.object.isRequired,
|
|
@@ -797,17 +797,17 @@ DataRow.propTypes = {
|
|
|
797
797
|
const skeletonRows = ["row-1", "row-2", "row-3", "row-4", "row-5"];
|
|
798
798
|
const skeletonCells = ["cell-1", "cell-2", "cell-3", "cell-4"];
|
|
799
799
|
const TableLoader = () => {
|
|
800
|
-
return /*#__PURE__*/
|
|
801
|
-
children: [/*#__PURE__*/
|
|
802
|
-
children: skeletonRows.map(rowKey => /*#__PURE__*/
|
|
803
|
-
children: skeletonCells.map(cellKey => /*#__PURE__*/
|
|
804
|
-
children: /*#__PURE__*/
|
|
800
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
801
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(material.TableHead, {}), /*#__PURE__*/jsxRuntime.jsx(material.TableBody, {
|
|
802
|
+
children: skeletonRows.map(rowKey => /*#__PURE__*/jsxRuntime.jsx(material.TableRow, {
|
|
803
|
+
children: skeletonCells.map(cellKey => /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
|
|
804
|
+
children: /*#__PURE__*/jsxRuntime.jsx(material.Skeleton, {
|
|
805
805
|
height: 30
|
|
806
|
-
}
|
|
807
|
-
}, cellKey
|
|
808
|
-
}, rowKey
|
|
809
|
-
}
|
|
810
|
-
}
|
|
806
|
+
})
|
|
807
|
+
}, cellKey))
|
|
808
|
+
}, rowKey))
|
|
809
|
+
})]
|
|
810
|
+
});
|
|
811
811
|
};
|
|
812
812
|
|
|
813
813
|
function EnhancedTable(props) {
|
|
@@ -851,15 +851,15 @@ function EnhancedTable(props) {
|
|
|
851
851
|
const visibleRows = React.useMemo(() => {
|
|
852
852
|
return stableSort(rows, getComparator(order, orderBy), headers, orderBy).slice(page * effectiveRowsPerPage, page * effectiveRowsPerPage + effectiveRowsPerPage);
|
|
853
853
|
}, [effectiveRowsPerPage, headers, order, orderBy, page, rows]);
|
|
854
|
-
return /*#__PURE__*/
|
|
855
|
-
children: [/*#__PURE__*/
|
|
854
|
+
return /*#__PURE__*/jsxRuntime.jsxs(material.TableContainer, {
|
|
855
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(material.Table, {
|
|
856
856
|
sx: {
|
|
857
857
|
minWidth: 750
|
|
858
858
|
},
|
|
859
859
|
size: "small" ,
|
|
860
860
|
"aria-label": props.name || "data table",
|
|
861
|
-
children: props.loading ? /*#__PURE__*/
|
|
862
|
-
children: [/*#__PURE__*/
|
|
861
|
+
children: props.loading ? /*#__PURE__*/jsxRuntime.jsx(TableLoader, {}) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
862
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(EnhancedTableHead, {
|
|
863
863
|
order: order,
|
|
864
864
|
orderBy: orderBy,
|
|
865
865
|
onRequestSort: handleSort,
|
|
@@ -869,11 +869,11 @@ function EnhancedTable(props) {
|
|
|
869
869
|
rowCount: rows.length,
|
|
870
870
|
onSelectAllClick: props.handleSelectAllClick,
|
|
871
871
|
async: async
|
|
872
|
-
}
|
|
872
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(material.TableBody, {
|
|
873
873
|
children: [visibleRows.map((row, index) => {
|
|
874
874
|
const rowKey = selectID ? row[selectID] : `row-${page * effectiveRowsPerPage + index}`;
|
|
875
875
|
const rowID = getSelectableRowId(row, index, selectID);
|
|
876
|
-
return /*#__PURE__*/
|
|
876
|
+
return /*#__PURE__*/jsxRuntime.jsx(DataRow, {
|
|
877
877
|
rowID: rowID,
|
|
878
878
|
headers: headers,
|
|
879
879
|
rowValues: row,
|
|
@@ -881,22 +881,22 @@ function EnhancedTable(props) {
|
|
|
881
881
|
selectRows: props.selectRows,
|
|
882
882
|
handleClick: props.handleClick,
|
|
883
883
|
isSelected: isSelected
|
|
884
|
-
}, rowKey
|
|
885
|
-
}), !subTable && emptyRows > 0 && /*#__PURE__*/
|
|
884
|
+
}, rowKey);
|
|
885
|
+
}), !subTable && emptyRows > 0 && /*#__PURE__*/jsxRuntime.jsx(material.TableRow, {
|
|
886
886
|
style: {
|
|
887
887
|
height: (33 ) * emptyRows
|
|
888
888
|
},
|
|
889
|
-
children: /*#__PURE__*/
|
|
889
|
+
children: /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
|
|
890
890
|
colSpan: headers.length
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
}
|
|
891
|
+
})
|
|
892
|
+
})]
|
|
893
|
+
})]
|
|
894
|
+
})
|
|
895
|
+
}), subTable ? /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
896
896
|
sx: {
|
|
897
897
|
mb: 3
|
|
898
898
|
}
|
|
899
|
-
}
|
|
899
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(material.TablePagination, {
|
|
900
900
|
rowsPerPageOptions: props.pageSizeOptions || getPageOptions(rows.length),
|
|
901
901
|
component: "div",
|
|
902
902
|
count: rows.length,
|
|
@@ -909,8 +909,8 @@ function EnhancedTable(props) {
|
|
|
909
909
|
},
|
|
910
910
|
showFirstButton: true,
|
|
911
911
|
showLastButton: true
|
|
912
|
-
}
|
|
913
|
-
}
|
|
912
|
+
})]
|
|
913
|
+
});
|
|
914
914
|
}
|
|
915
915
|
EnhancedTable.propTypes = {
|
|
916
916
|
headers: PropTypes.array.isRequired,
|
|
@@ -1038,32 +1038,32 @@ function UniversalTable({
|
|
|
1038
1038
|
} : true);
|
|
1039
1039
|
}
|
|
1040
1040
|
}, [async, onReload, setLoading, searchTerm, order, orderBy, asyncPages]);
|
|
1041
|
-
return /*#__PURE__*/
|
|
1042
|
-
children: [/*#__PURE__*/
|
|
1041
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1042
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(LazyLoadingIndicator, {
|
|
1043
1043
|
show: lazyloading,
|
|
1044
1044
|
currentPage: currentPage,
|
|
1045
1045
|
totalPages: totalPages
|
|
1046
|
-
}
|
|
1046
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(Paper, {
|
|
1047
1047
|
sx: {
|
|
1048
1048
|
...(subTable && {
|
|
1049
1049
|
boxShadow: "none"
|
|
1050
1050
|
})
|
|
1051
1051
|
},
|
|
1052
|
-
children: [/*#__PURE__*/
|
|
1052
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(TableSelectionBanner, {
|
|
1053
1053
|
selected: selected,
|
|
1054
1054
|
onSelection: handleSelection,
|
|
1055
1055
|
selectIcon: selectIcon
|
|
1056
|
-
}
|
|
1056
|
+
}), /*#__PURE__*/jsxRuntime.jsx(TableTitle, {
|
|
1057
1057
|
name: name,
|
|
1058
1058
|
subTable: subTable
|
|
1059
|
-
}
|
|
1059
|
+
}), !subTable && /*#__PURE__*/jsxRuntime.jsx(TableToolbarContent, {
|
|
1060
1060
|
onReload: typeof onReload === "function" || typeof setLoading === "function" ? handleReload : undefined,
|
|
1061
1061
|
reloadBtnLoading: reloadBtnLoading,
|
|
1062
1062
|
searchTerm: searchTerm,
|
|
1063
1063
|
onSearchChange: handleSearch,
|
|
1064
1064
|
name: name,
|
|
1065
1065
|
persistSearch: persistSearch
|
|
1066
|
-
}
|
|
1066
|
+
}), /*#__PURE__*/jsxRuntime.jsx(EnhancedTable, {
|
|
1067
1067
|
headers: head,
|
|
1068
1068
|
rows: rows,
|
|
1069
1069
|
resetFlag: searchTerm,
|
|
@@ -1085,9 +1085,9 @@ function UniversalTable({
|
|
|
1085
1085
|
setOrderBy: setOrderBy,
|
|
1086
1086
|
asyncPages: asyncPages,
|
|
1087
1087
|
async: async
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1088
|
+
})]
|
|
1089
|
+
})]
|
|
1090
|
+
});
|
|
1091
1091
|
}
|
|
1092
1092
|
UniversalTable.propTypes = {
|
|
1093
1093
|
loading: PropTypes.bool,
|