@natoora-libs/core 0.1.14 → 0.1.16-dev-doug-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/components/index.cjs +1045 -771
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +52 -30
- package/dist/components/index.d.ts +52 -30
- package/dist/components/index.js +1222 -950
- package/dist/components/index.js.map +1 -1
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -2781,7 +2781,7 @@ var RoundButton = ({
|
|
|
2781
2781
|
onClick(e);
|
|
2782
2782
|
}
|
|
2783
2783
|
};
|
|
2784
|
-
const
|
|
2784
|
+
const Button16 = /* @__PURE__ */ jsx63(
|
|
2785
2785
|
Fab,
|
|
2786
2786
|
{
|
|
2787
2787
|
className: cx(
|
|
@@ -2805,7 +2805,7 @@ var RoundButton = ({
|
|
|
2805
2805
|
children: icon ? iconComponentMap[icon] : children || ""
|
|
2806
2806
|
}
|
|
2807
2807
|
);
|
|
2808
|
-
return tooltip ? /* @__PURE__ */ jsx63(Tooltip2, { title: tooltip, children:
|
|
2808
|
+
return tooltip ? /* @__PURE__ */ jsx63(Tooltip2, { title: tooltip, children: Button16 }) : Button16;
|
|
2809
2809
|
};
|
|
2810
2810
|
var RoundButton_default = RoundButton;
|
|
2811
2811
|
|
|
@@ -6382,6 +6382,7 @@ var SmartSelect = forwardRef2(
|
|
|
6382
6382
|
onChange,
|
|
6383
6383
|
inputLabel,
|
|
6384
6384
|
variant = "standard",
|
|
6385
|
+
size,
|
|
6385
6386
|
error,
|
|
6386
6387
|
helperText,
|
|
6387
6388
|
disabled,
|
|
@@ -6436,6 +6437,7 @@ var SmartSelect = forwardRef2(
|
|
|
6436
6437
|
FormControl4,
|
|
6437
6438
|
{
|
|
6438
6439
|
fullWidth: true,
|
|
6440
|
+
size,
|
|
6439
6441
|
className: classes.container,
|
|
6440
6442
|
error,
|
|
6441
6443
|
variant,
|
|
@@ -6454,6 +6456,7 @@ var SmartSelect = forwardRef2(
|
|
|
6454
6456
|
Select3,
|
|
6455
6457
|
{
|
|
6456
6458
|
ref,
|
|
6459
|
+
size,
|
|
6457
6460
|
disabled,
|
|
6458
6461
|
labelId: "smart-select-label",
|
|
6459
6462
|
value: value ?? "",
|
|
@@ -6587,52 +6590,265 @@ var LabelledSwitch = withStyles6(LSwitch, (theme) => ({
|
|
|
6587
6590
|
var Switch_default = memo19(LabelledSwitch);
|
|
6588
6591
|
|
|
6589
6592
|
// src/components/SmartTableHeaderFilterMenu/SmartTableHeaderFilterMenu.tsx
|
|
6590
|
-
import { useMemo as
|
|
6593
|
+
import { useMemo as useMemo2, useState as useState15, useEffect as useEffect10, memo as memo20 } from "react";
|
|
6591
6594
|
import CheckIcon from "@mui/icons-material/Check";
|
|
6592
6595
|
import {
|
|
6593
|
-
Box as
|
|
6594
|
-
Checkbox as
|
|
6596
|
+
Box as Box28,
|
|
6597
|
+
Checkbox as Checkbox4,
|
|
6595
6598
|
Divider as Divider9,
|
|
6596
6599
|
FormControlLabel as FormControlLabel3,
|
|
6597
6600
|
Menu as Menu4,
|
|
6598
|
-
Skeleton as
|
|
6601
|
+
Skeleton as Skeleton2,
|
|
6599
6602
|
Tooltip as Tooltip6
|
|
6600
6603
|
} from "@mui/material";
|
|
6601
6604
|
import classNames3 from "classnames";
|
|
6602
|
-
import { makeStyles as
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6605
|
+
import { makeStyles as makeStyles45 } from "tss-react/mui";
|
|
6606
|
+
import { Fragment as Fragment11, jsx as jsx108, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
6607
|
+
var useStyles45 = makeStyles45()((theme) => ({
|
|
6608
|
+
filterMenu: {
|
|
6609
|
+
display: "flex",
|
|
6610
|
+
flexDirection: "column"
|
|
6611
|
+
},
|
|
6612
|
+
filterOptions: {
|
|
6613
|
+
maxHeight: theme.spacing(62),
|
|
6614
|
+
overflowY: "auto",
|
|
6615
|
+
"&::-webkit-scrollbar": {
|
|
6616
|
+
width: "8px",
|
|
6617
|
+
height: "8px"
|
|
6618
|
+
},
|
|
6619
|
+
"&::-webkit-scrollbar-track": {
|
|
6620
|
+
backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[800] : theme.palette.grey[100]
|
|
6621
|
+
},
|
|
6622
|
+
"&::-webkit-scrollbar-thumb": {
|
|
6623
|
+
backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[900] : theme.palette.grey[400],
|
|
6624
|
+
borderRadius: "10px"
|
|
6625
|
+
},
|
|
6626
|
+
"&::-webkit-scrollbar-thumb:hover": {
|
|
6627
|
+
backgroundColor: theme.palette.mode === "dark" ? theme.palette.common.black : theme.palette.grey[500]
|
|
6628
|
+
}
|
|
6629
|
+
},
|
|
6630
|
+
filter: {
|
|
6631
|
+
display: "flex",
|
|
6632
|
+
alignItems: "center",
|
|
6633
|
+
justifyContent: "space-between",
|
|
6634
|
+
padding: theme.spacing(0, 3)
|
|
6635
|
+
},
|
|
6636
|
+
applyFilterButtonsContainer: {
|
|
6637
|
+
display: "flex",
|
|
6638
|
+
padding: theme.spacing(0, 1),
|
|
6639
|
+
justifyContent: "space-between"
|
|
6640
|
+
},
|
|
6641
|
+
saveAsDefaultButton: {
|
|
6642
|
+
color: theme.palette.primary.main
|
|
6643
|
+
},
|
|
6644
|
+
skeleton: {
|
|
6645
|
+
height: theme.spacing(3),
|
|
6646
|
+
margin: theme.spacing(1)
|
|
6647
|
+
}
|
|
6648
|
+
}));
|
|
6649
|
+
var resolveOptionType = (option, fieldName) => {
|
|
6650
|
+
if (!option || typeof option !== "object") {
|
|
6651
|
+
return option;
|
|
6652
|
+
}
|
|
6653
|
+
return option[fieldName] || "";
|
|
6654
|
+
};
|
|
6655
|
+
var findFilterIndex = (filters, filterOption) => filters.findIndex((item) => {
|
|
6656
|
+
if (typeof item === "string" && typeof filterOption === "string") {
|
|
6657
|
+
return item === filterOption;
|
|
6658
|
+
}
|
|
6659
|
+
if (typeof item === "object" && typeof filterOption === "object") {
|
|
6660
|
+
return item.id === filterOption.id;
|
|
6661
|
+
}
|
|
6662
|
+
return false;
|
|
6663
|
+
});
|
|
6664
|
+
var SmartTableHeaderFilterMenu = ({
|
|
6665
|
+
headCell,
|
|
6666
|
+
numActiveFilters,
|
|
6667
|
+
headerFilters,
|
|
6668
|
+
shouldShowCheckOnFilter,
|
|
6669
|
+
onApplyFilters
|
|
6670
|
+
}) => {
|
|
6671
|
+
const { classes } = useStyles45();
|
|
6672
|
+
const [anchorEl, setAnchorEl] = useState15(null);
|
|
6673
|
+
const [filterOptionsData, setFilterOptionsData] = useState15();
|
|
6674
|
+
const [selectedFilters, setSelectedFilters] = useState15(
|
|
6675
|
+
headerFilters[headCell.id] ?? []
|
|
6676
|
+
);
|
|
6677
|
+
useEffect10(() => {
|
|
6678
|
+
if (headCell.filterOptions) {
|
|
6679
|
+
setFilterOptionsData(headCell.filterOptions);
|
|
6680
|
+
}
|
|
6681
|
+
}, [headCell.filterOptions]);
|
|
6682
|
+
const numFilterOptions = useMemo2(() => filterOptionsData?.length ?? 0, [filterOptionsData?.length]);
|
|
6683
|
+
const numCurrentSelectedFilters = selectedFilters.length;
|
|
6684
|
+
const handleFilterMenuOpen = (event) => {
|
|
6685
|
+
if (!numFilterOptions) {
|
|
6686
|
+
headCell.refetchFilterOptions?.();
|
|
6687
|
+
}
|
|
6688
|
+
setAnchorEl(event.currentTarget);
|
|
6689
|
+
};
|
|
6690
|
+
const handleFilterMenuClose = () => {
|
|
6691
|
+
setSelectedFilters(headerFilters[headCell.id]);
|
|
6692
|
+
setAnchorEl(null);
|
|
6693
|
+
};
|
|
6694
|
+
const handleFilterOptionClick = (option) => {
|
|
6695
|
+
const selectedIndex = findFilterIndex(selectedFilters, option);
|
|
6696
|
+
let newSelected;
|
|
6697
|
+
if (selectedIndex === -1) {
|
|
6698
|
+
if (typeof option === "string") {
|
|
6699
|
+
newSelected = [...selectedFilters, option];
|
|
6700
|
+
} else {
|
|
6701
|
+
newSelected = [...selectedFilters, option];
|
|
6702
|
+
}
|
|
6703
|
+
} else {
|
|
6704
|
+
newSelected = selectedFilters.filter(
|
|
6705
|
+
(_, index) => index !== selectedIndex
|
|
6706
|
+
);
|
|
6707
|
+
}
|
|
6708
|
+
setSelectedFilters(newSelected);
|
|
6709
|
+
};
|
|
6710
|
+
const handleApplyFilters = (shouldSave) => {
|
|
6711
|
+
const updatedFilters = {
|
|
6712
|
+
...headerFilters,
|
|
6713
|
+
[headCell.id]: [...selectedFilters]
|
|
6714
|
+
};
|
|
6715
|
+
onApplyFilters?.(updatedFilters, shouldSave);
|
|
6716
|
+
setAnchorEl(null);
|
|
6717
|
+
};
|
|
6718
|
+
useEffect10(() => {
|
|
6719
|
+
setSelectedFilters(headerFilters[headCell.id] ?? []);
|
|
6720
|
+
}, [headerFilters, headCell.id]);
|
|
6721
|
+
const isOptionChecked = useMemo2(() => (resolvedOption) => !!selectedFilters?.some(
|
|
6722
|
+
(value) => resolveOptionType(value, headCell.fieldName ?? "") === resolvedOption
|
|
6723
|
+
), [selectedFilters]);
|
|
6724
|
+
const loadingSkeletons = /* @__PURE__ */ jsxs73(Box28, { "data-testid": "loading-skeletons", width: 272, children: [
|
|
6725
|
+
/* @__PURE__ */ jsx108(Skeleton2, { variant: "rounded", className: classes.skeleton }),
|
|
6726
|
+
/* @__PURE__ */ jsx108(Divider9, {}),
|
|
6727
|
+
/* @__PURE__ */ jsx108(Skeleton2, { variant: "rounded", className: classes.skeleton }),
|
|
6728
|
+
/* @__PURE__ */ jsx108(Skeleton2, { variant: "rounded", className: classes.skeleton }),
|
|
6729
|
+
/* @__PURE__ */ jsx108(Skeleton2, { variant: "rounded", className: classes.skeleton }),
|
|
6730
|
+
/* @__PURE__ */ jsx108(Skeleton2, { variant: "rounded", className: classes.skeleton }),
|
|
6731
|
+
/* @__PURE__ */ jsx108(Divider9, {}),
|
|
6732
|
+
/* @__PURE__ */ jsx108(Skeleton2, { variant: "rounded", className: classes.skeleton })
|
|
6733
|
+
] });
|
|
6734
|
+
return /* @__PURE__ */ jsxs73(Fragment11, { children: [
|
|
6735
|
+
/* @__PURE__ */ jsx108(
|
|
6736
|
+
ActiveFiltersIconButton_default,
|
|
6737
|
+
{
|
|
6738
|
+
numActiveFilters,
|
|
6739
|
+
handleClick: handleFilterMenuOpen,
|
|
6740
|
+
className: classNames3("filter-menu-trigger", {
|
|
6741
|
+
"has-active-filters": !!numActiveFilters || !!anchorEl
|
|
6742
|
+
})
|
|
6743
|
+
}
|
|
6744
|
+
),
|
|
6745
|
+
/* @__PURE__ */ jsx108(
|
|
6746
|
+
Menu4,
|
|
6747
|
+
{
|
|
6748
|
+
open: !!anchorEl,
|
|
6749
|
+
onClose: handleFilterMenuClose,
|
|
6750
|
+
anchorEl,
|
|
6751
|
+
"data-testid": "filter-menu",
|
|
6752
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
6753
|
+
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
6754
|
+
children: headCell.isFetchingFilterOptions ? loadingSkeletons : /* @__PURE__ */ jsxs73(Box28, { className: classes.filterMenu, children: [
|
|
6755
|
+
/* @__PURE__ */ jsx108(Box28, { px: 3, mb: 0.5, children: /* @__PURE__ */ jsx108(
|
|
6756
|
+
FormControlLabel3,
|
|
6757
|
+
{
|
|
6758
|
+
label: "Select All",
|
|
6759
|
+
control: /* @__PURE__ */ jsx108(
|
|
6760
|
+
Checkbox4,
|
|
6761
|
+
{
|
|
6762
|
+
disableRipple: true,
|
|
6763
|
+
checked: numCurrentSelectedFilters === numFilterOptions,
|
|
6764
|
+
indeterminate: numCurrentSelectedFilters > 0 && numCurrentSelectedFilters < numFilterOptions,
|
|
6765
|
+
onChange: ({ target: { checked } }) => {
|
|
6766
|
+
if (checked) {
|
|
6767
|
+
setSelectedFilters([...filterOptionsData]);
|
|
6768
|
+
} else {
|
|
6769
|
+
setSelectedFilters([]);
|
|
6770
|
+
}
|
|
6771
|
+
}
|
|
6772
|
+
}
|
|
6773
|
+
)
|
|
6774
|
+
}
|
|
6775
|
+
) }),
|
|
6776
|
+
/* @__PURE__ */ jsx108(Divider9, { sx: { mb: 0.5 } }),
|
|
6777
|
+
/* @__PURE__ */ jsx108(Box28, { className: classes.filterOptions, children: filterOptionsData?.map(
|
|
6778
|
+
(option) => {
|
|
6779
|
+
const resolvedOption = resolveOptionType(option, headCell.fieldName ?? "");
|
|
6780
|
+
return /* @__PURE__ */ jsxs73(
|
|
6781
|
+
Box28,
|
|
6782
|
+
{
|
|
6783
|
+
className: classes.filter,
|
|
6784
|
+
children: [
|
|
6785
|
+
/* @__PURE__ */ jsx108(
|
|
6786
|
+
FormControlLabel3,
|
|
6787
|
+
{
|
|
6788
|
+
label: resolvedOption,
|
|
6789
|
+
control: /* @__PURE__ */ jsx108(
|
|
6790
|
+
Checkbox4,
|
|
6791
|
+
{
|
|
6792
|
+
disableRipple: true,
|
|
6793
|
+
onChange: () => handleFilterOptionClick(option),
|
|
6794
|
+
checked: isOptionChecked(resolvedOption)
|
|
6795
|
+
}
|
|
6796
|
+
)
|
|
6797
|
+
},
|
|
6798
|
+
resolvedOption
|
|
6799
|
+
),
|
|
6800
|
+
shouldShowCheckOnFilter?.(headCell.id, option) ? /* @__PURE__ */ jsx108(Tooltip6, { title: "This filter is saved as default", children: /* @__PURE__ */ jsx108(CheckIcon, { fontSize: "small", color: "action" }) }) : null
|
|
6801
|
+
]
|
|
6802
|
+
},
|
|
6803
|
+
resolvedOption
|
|
6804
|
+
);
|
|
6805
|
+
}
|
|
6806
|
+
) }),
|
|
6807
|
+
/* @__PURE__ */ jsx108(Divider9, { sx: { mb: 0.5 } }),
|
|
6808
|
+
/* @__PURE__ */ jsxs73(Box28, { className: classes.applyFilterButtonsContainer, children: [
|
|
6809
|
+
/* @__PURE__ */ jsx108(
|
|
6810
|
+
ExtendedButton_default,
|
|
6811
|
+
{
|
|
6812
|
+
copy: "Save as Default",
|
|
6813
|
+
buttonType: "button",
|
|
6814
|
+
variant: "text",
|
|
6815
|
+
tooltip: "Persists those filters for future visits",
|
|
6816
|
+
className: classes.saveAsDefaultButton,
|
|
6817
|
+
onClick: () => handleApplyFilters(true)
|
|
6818
|
+
}
|
|
6819
|
+
),
|
|
6820
|
+
/* @__PURE__ */ jsx108(
|
|
6821
|
+
ExtendedButton_default,
|
|
6822
|
+
{
|
|
6823
|
+
copy: "Apply",
|
|
6824
|
+
color: "primary",
|
|
6825
|
+
buttonType: "submit",
|
|
6826
|
+
onClick: () => handleApplyFilters(false)
|
|
6827
|
+
}
|
|
6828
|
+
)
|
|
6829
|
+
] })
|
|
6830
|
+
] })
|
|
6831
|
+
}
|
|
6832
|
+
)
|
|
6833
|
+
] });
|
|
6834
|
+
};
|
|
6835
|
+
var SmartTableHeaderFilterMenu_default = memo20(SmartTableHeaderFilterMenu);
|
|
6621
6836
|
|
|
6622
6837
|
// src/components/SmartTableHeader/SmartTableHeader.tsx
|
|
6623
|
-
import { memo as
|
|
6838
|
+
import { memo as memo21 } from "react";
|
|
6624
6839
|
import {
|
|
6625
|
-
Box as
|
|
6626
|
-
Checkbox as
|
|
6840
|
+
Box as Box29,
|
|
6841
|
+
Checkbox as Checkbox5,
|
|
6627
6842
|
TableCell,
|
|
6628
6843
|
TableHead,
|
|
6629
6844
|
TableRow,
|
|
6630
6845
|
TableSortLabel,
|
|
6846
|
+
Tooltip as Tooltip7,
|
|
6631
6847
|
Typography as Typography25
|
|
6632
6848
|
} from "@mui/material";
|
|
6633
|
-
import { makeStyles as
|
|
6634
|
-
import { jsx as
|
|
6635
|
-
var
|
|
6849
|
+
import { makeStyles as makeStyles46 } from "tss-react/mui";
|
|
6850
|
+
import { jsx as jsx109, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
6851
|
+
var useStyles46 = makeStyles46()((theme) => ({
|
|
6636
6852
|
root: {
|
|
6637
6853
|
backgroundColor: colors.neutral100,
|
|
6638
6854
|
height: theme.spacing(6),
|
|
@@ -6699,14 +6915,14 @@ var SmartTableHeader = ({
|
|
|
6699
6915
|
onApplyFilters,
|
|
6700
6916
|
shouldShowCheckOnFilter
|
|
6701
6917
|
}) => {
|
|
6702
|
-
const { classes } =
|
|
6918
|
+
const { classes } = useStyles46();
|
|
6703
6919
|
const createSortHandler = (property) => (event) => {
|
|
6704
6920
|
onRequestSort(event, property);
|
|
6705
6921
|
};
|
|
6706
6922
|
const isSortActive = (headCellId) => orderBy === headCellId;
|
|
6707
|
-
return /* @__PURE__ */
|
|
6708
|
-
enableCheckboxSelection ? /* @__PURE__ */
|
|
6709
|
-
|
|
6923
|
+
return /* @__PURE__ */ jsx109(TableHead, { className: classes.root, children: /* @__PURE__ */ jsxs74(TableRow, { children: [
|
|
6924
|
+
enableCheckboxSelection ? /* @__PURE__ */ jsx109(TableCell, { padding: "checkbox", children: /* @__PURE__ */ jsx109(
|
|
6925
|
+
Checkbox5,
|
|
6710
6926
|
{
|
|
6711
6927
|
color: "primary",
|
|
6712
6928
|
disableRipple: true,
|
|
@@ -6715,21 +6931,21 @@ var SmartTableHeader = ({
|
|
|
6715
6931
|
onChange: onSelectAllClick
|
|
6716
6932
|
}
|
|
6717
6933
|
) }) : null,
|
|
6718
|
-
headCells.map((headCell) => /* @__PURE__ */
|
|
6934
|
+
headCells.map((headCell) => /* @__PURE__ */ jsx109(
|
|
6719
6935
|
TableCell,
|
|
6720
6936
|
{
|
|
6721
6937
|
className: classes.tableHeaderContent,
|
|
6722
6938
|
align: "left",
|
|
6723
6939
|
width: headCell.width ?? "auto",
|
|
6724
6940
|
sortDirection: orderBy === headCell.id ? order : false,
|
|
6725
|
-
children: /* @__PURE__ */
|
|
6726
|
-
|
|
6941
|
+
children: /* @__PURE__ */ jsxs74(
|
|
6942
|
+
Box29,
|
|
6727
6943
|
{
|
|
6728
6944
|
display: "flex",
|
|
6729
6945
|
flexDirection: "row",
|
|
6730
6946
|
gap: headCell.disableSort ? 1 : 0,
|
|
6731
6947
|
children: [
|
|
6732
|
-
headCell.disableSort ? /* @__PURE__ */
|
|
6948
|
+
headCell.disableSort ? headCell.RenderHeader ?? /* @__PURE__ */ jsx109(Tooltip7, { title: headCell.labelTooltip ?? "", arrow: true, children: /* @__PURE__ */ jsx109(Typography25, { variant: "subtitle2", mt: 0.25, fontWeight: 600, children: headCell.label }) }) : /* @__PURE__ */ jsx109(Tooltip7, { title: headCell.labelTooltip ?? "", arrow: true, children: /* @__PURE__ */ jsxs74(
|
|
6733
6949
|
TableSortLabel,
|
|
6734
6950
|
{
|
|
6735
6951
|
"data-testid": "table-sort-label",
|
|
@@ -6738,11 +6954,11 @@ var SmartTableHeader = ({
|
|
|
6738
6954
|
onClick: createSortHandler(headCell.id),
|
|
6739
6955
|
children: [
|
|
6740
6956
|
headCell.RenderHeader ?? headCell.label,
|
|
6741
|
-
orderBy === headCell.id ? /* @__PURE__ */
|
|
6957
|
+
orderBy === headCell.id ? /* @__PURE__ */ jsx109("span", { className: classes.visuallyHidden, children: order === "desc" ? "sorted descending" : "sorted ascending" }) : null
|
|
6742
6958
|
]
|
|
6743
6959
|
}
|
|
6744
|
-
),
|
|
6745
|
-
headCell.refetchFilterOptions ? /* @__PURE__ */
|
|
6960
|
+
) }),
|
|
6961
|
+
headCell.refetchFilterOptions ? /* @__PURE__ */ jsx109(
|
|
6746
6962
|
SmartTableHeaderFilterMenu_default,
|
|
6747
6963
|
{
|
|
6748
6964
|
headCell,
|
|
@@ -6760,93 +6976,85 @@ var SmartTableHeader = ({
|
|
|
6760
6976
|
))
|
|
6761
6977
|
] }) });
|
|
6762
6978
|
};
|
|
6763
|
-
var SmartTableHeader_default =
|
|
6979
|
+
var SmartTableHeader_default = memo21(SmartTableHeader);
|
|
6764
6980
|
|
|
6765
|
-
// src/components/
|
|
6766
|
-
|
|
6767
|
-
import
|
|
6768
|
-
import
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
alignItems: "center"
|
|
6782
|
-
},
|
|
6783
|
-
children: [
|
|
6784
|
-
/* @__PURE__ */ jsx109(Typography26, { variant: "subtitle2", fontSize: 16, children: "Customise your view" }),
|
|
6785
|
-
/* @__PURE__ */ jsxs74(Typography26, { variant: "subtitle1", align: "center", color: "textSecondary", children: [
|
|
6786
|
-
"Use the column selector on the right to choose which fields",
|
|
6787
|
-
/* @__PURE__ */ jsx109("br", {}),
|
|
6788
|
-
"you want to display in the table"
|
|
6789
|
-
] })
|
|
6790
|
-
]
|
|
6791
|
-
}
|
|
6792
|
-
) }) });
|
|
6981
|
+
// src/components/Table/Table.tsx
|
|
6982
|
+
var import_debounce = __toESM(require_debounce(), 1);
|
|
6983
|
+
import { useLayoutEffect, useState as useState16 } from "react";
|
|
6984
|
+
import {
|
|
6985
|
+
Box as Box31,
|
|
6986
|
+
Paper as Paper10,
|
|
6987
|
+
Table as MUITable,
|
|
6988
|
+
TableBody,
|
|
6989
|
+
TableCell as TableCell2,
|
|
6990
|
+
TableContainer,
|
|
6991
|
+
TableHead as TableHead2,
|
|
6992
|
+
TableRow as TableRow2,
|
|
6993
|
+
TableSortLabel as TableSortLabel2
|
|
6994
|
+
} from "@mui/material";
|
|
6995
|
+
import { makeStyles as makeStyles47 } from "tss-react/mui";
|
|
6996
|
+
import { v4 as uuidv4 } from "uuid";
|
|
6793
6997
|
|
|
6794
|
-
// src/components/
|
|
6795
|
-
import {
|
|
6796
|
-
import {
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
FilledButton_default,
|
|
6821
|
-
{
|
|
6822
|
-
copy: "Search",
|
|
6823
|
-
variant: "contained",
|
|
6824
|
-
color: "primary",
|
|
6825
|
-
onClick: handleClickOnClearFiltersButton
|
|
6826
|
-
}
|
|
6827
|
-
)
|
|
6828
|
-
]
|
|
6829
|
-
}
|
|
6830
|
-
) }) : /* @__PURE__ */ jsx110(TableRow3, { children: /* @__PURE__ */ jsx110(
|
|
6831
|
-
TableCell3,
|
|
6832
|
-
{
|
|
6833
|
-
className: classes.tableCellDefault,
|
|
6834
|
-
colSpan,
|
|
6835
|
-
align: "center",
|
|
6836
|
-
children: "Nothing to display"
|
|
6998
|
+
// src/components/TableLoading/TableLoading.tsx
|
|
6999
|
+
import { Box as Box30, Skeleton as Skeleton3 } from "@mui/material";
|
|
7000
|
+
import { jsx as jsx110 } from "react/jsx-runtime";
|
|
7001
|
+
var TableLoading = ({
|
|
7002
|
+
rowsPerPage,
|
|
7003
|
+
rowHeight
|
|
7004
|
+
}) => /* @__PURE__ */ jsx110(Box30, { children: Array.from({ length: rowsPerPage ?? 0 }).map((_, index) => /* @__PURE__ */ jsx110(
|
|
7005
|
+
Skeleton3,
|
|
7006
|
+
{
|
|
7007
|
+
animation: "pulse",
|
|
7008
|
+
"data-testid": "table-loading-skeleton",
|
|
7009
|
+
style: { margin: "8px", opacity: 0.4 },
|
|
7010
|
+
variant: "rectangular",
|
|
7011
|
+
height: rowHeight
|
|
7012
|
+
},
|
|
7013
|
+
index
|
|
7014
|
+
)) });
|
|
7015
|
+
var TableLoading_default = TableLoading;
|
|
7016
|
+
|
|
7017
|
+
// src/components/Table/helpers.tsx
|
|
7018
|
+
function stableSort(array, cmp) {
|
|
7019
|
+
const stabilizedThis = array.map((el, index) => [el, index]);
|
|
7020
|
+
stabilizedThis.sort((a, b) => {
|
|
7021
|
+
const order = cmp(a[0], b[0]);
|
|
7022
|
+
if (order !== 0) {
|
|
7023
|
+
return order;
|
|
6837
7024
|
}
|
|
6838
|
-
|
|
6839
|
-
};
|
|
6840
|
-
|
|
7025
|
+
return a[1] - b[1];
|
|
7026
|
+
});
|
|
7027
|
+
return stabilizedThis.map((el) => el[0]);
|
|
7028
|
+
}
|
|
7029
|
+
function descendingComparator(a, b, orderBy) {
|
|
7030
|
+
if (b[orderBy] < a[orderBy]) {
|
|
7031
|
+
return -1;
|
|
7032
|
+
}
|
|
7033
|
+
if (b[orderBy] > a[orderBy]) {
|
|
7034
|
+
return 1;
|
|
7035
|
+
}
|
|
7036
|
+
return 0;
|
|
7037
|
+
}
|
|
7038
|
+
function getSorting(order, orderBy) {
|
|
7039
|
+
return order === "desc" ? (a, b) => descendingComparator(a, b, orderBy) : (a, b) => -descendingComparator(a, b, orderBy);
|
|
7040
|
+
}
|
|
7041
|
+
function calculateRowsPerPage(rowHeight) {
|
|
7042
|
+
const appContainerDom = document.getElementById("mainContainer");
|
|
7043
|
+
const headerDom = document.getElementById("aboveTableHeader");
|
|
7044
|
+
if (appContainerDom && headerDom) {
|
|
7045
|
+
return Math.floor(
|
|
7046
|
+
(appContainerDom.clientHeight - headerDom.clientHeight - 24) / rowHeight - 2
|
|
7047
|
+
);
|
|
7048
|
+
}
|
|
7049
|
+
return 1;
|
|
7050
|
+
}
|
|
6841
7051
|
|
|
6842
|
-
// src/components/
|
|
6843
|
-
import {
|
|
6844
|
-
var
|
|
6845
|
-
var useStyles47 = makeStyles47()((theme) => ({
|
|
7052
|
+
// src/components/Table/Table.tsx
|
|
7053
|
+
import { jsx as jsx111, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
7054
|
+
var useStyles47 = makeStyles47()(() => ({
|
|
6846
7055
|
root: {
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
justifyItems: "stretch"
|
|
7056
|
+
height: "calc(100vh - 262px)",
|
|
7057
|
+
overflow: "scroll"
|
|
6850
7058
|
},
|
|
6851
7059
|
paper: {
|
|
6852
7060
|
width: "100%",
|
|
@@ -6854,105 +7062,37 @@ var useStyles47 = makeStyles47()((theme) => ({
|
|
|
6854
7062
|
flexDirection: "column",
|
|
6855
7063
|
justifyContent: "space-between"
|
|
6856
7064
|
},
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
height: "8px"
|
|
6862
|
-
},
|
|
6863
|
-
"&::-webkit-scrollbar-track": {
|
|
6864
|
-
backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[800] : theme.palette.grey[100]
|
|
6865
|
-
},
|
|
6866
|
-
"&::-webkit-scrollbar-thumb": {
|
|
6867
|
-
backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[900] : theme.palette.grey[400],
|
|
6868
|
-
borderRadius: "10px"
|
|
6869
|
-
},
|
|
6870
|
-
"&::-webkit-scrollbar-thumb:hover": {
|
|
6871
|
-
backgroundColor: theme.palette.mode === "dark" ? theme.palette.common.black : theme.palette.grey[500]
|
|
7065
|
+
header: {
|
|
7066
|
+
"& .MuiTableSortLabel-root": {
|
|
7067
|
+
fontWeight: 600,
|
|
7068
|
+
fontSize: ".875rem"
|
|
6872
7069
|
}
|
|
7070
|
+
},
|
|
7071
|
+
container: {
|
|
7072
|
+
maxHeight: "calc(100% - 0)"
|
|
6873
7073
|
}
|
|
6874
7074
|
}));
|
|
6875
|
-
var
|
|
6876
|
-
|
|
6877
|
-
const objB = b[orderBy];
|
|
6878
|
-
const valA = typeof objA === "object" ? objA?.name : objA;
|
|
6879
|
-
const valB = typeof objB === "object" ? objB?.name : objB;
|
|
6880
|
-
if (!valA && !valB) {
|
|
6881
|
-
return 0;
|
|
6882
|
-
}
|
|
6883
|
-
if (valA && !valB) {
|
|
6884
|
-
return -1;
|
|
6885
|
-
}
|
|
6886
|
-
if (!valA && valB) {
|
|
6887
|
-
return 1;
|
|
6888
|
-
}
|
|
6889
|
-
if (valA > valB) {
|
|
6890
|
-
return -1;
|
|
6891
|
-
}
|
|
6892
|
-
if (valA < valB) {
|
|
6893
|
-
return 1;
|
|
6894
|
-
}
|
|
6895
|
-
return 0;
|
|
6896
|
-
};
|
|
6897
|
-
var stableSort = (array, cmp) => array.map((el, index) => ({ el, index })).sort((a, b) => {
|
|
6898
|
-
const order = cmp(a.el, b.el);
|
|
6899
|
-
return order !== 0 ? order : a.index - b.index;
|
|
6900
|
-
}).map((el) => el.el);
|
|
6901
|
-
var getComparator = (order, orderBy) => order === "desc" ? (a, b) => descendingComparator(a, b, orderBy) : (a, b) => -descendingComparator(a, b, orderBy);
|
|
6902
|
-
var resolveOptionType = (option, fieldName) => {
|
|
6903
|
-
if (!option || typeof option !== "object") {
|
|
6904
|
-
return option;
|
|
6905
|
-
}
|
|
6906
|
-
return option[fieldName] || "";
|
|
6907
|
-
};
|
|
6908
|
-
var TableDesktop = ({
|
|
7075
|
+
var Table = ({
|
|
7076
|
+
appliedFilters,
|
|
6909
7077
|
data,
|
|
7078
|
+
doNotCalculateRows,
|
|
6910
7079
|
headCells,
|
|
6911
|
-
RenderItem,
|
|
6912
|
-
appliedFilters,
|
|
6913
|
-
headerFilters,
|
|
6914
|
-
children,
|
|
6915
|
-
height,
|
|
6916
7080
|
isLoading,
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
deleteItem,
|
|
6924
|
-
keyField = "id",
|
|
6925
|
-
tableLayout = "auto",
|
|
6926
|
-
onApplyFilters,
|
|
6927
|
-
shouldShowCheckOnFilter
|
|
7081
|
+
onRowClick,
|
|
7082
|
+
page = 0,
|
|
7083
|
+
RenderItem = null,
|
|
7084
|
+
rowsPerPage: defaultRowsPerPage = 10,
|
|
7085
|
+
serverRendered,
|
|
7086
|
+
updateSort
|
|
6928
7087
|
}) => {
|
|
6929
|
-
const
|
|
6930
|
-
const [
|
|
6931
|
-
const [orderBy, setOrderBy] = useState15(
|
|
7088
|
+
const [order, setOrder] = useState16(appliedFilters?.sortDir || "desc");
|
|
7089
|
+
const [orderBy, setOrderBy] = useState16(
|
|
6932
7090
|
appliedFilters?.sortField || "delivery_date"
|
|
6933
7091
|
);
|
|
6934
|
-
const [
|
|
6935
|
-
const
|
|
6936
|
-
const
|
|
6937
|
-
const emptyRows =
|
|
6938
|
-
() => rowsPerPage - data.length,
|
|
6939
|
-
[rowsPerPage, data]
|
|
6940
|
-
);
|
|
6941
|
-
const visibleHeadCells = useMemo2(
|
|
6942
|
-
() => headCells.filter((headCell) => headCell?.enabled ?? true),
|
|
6943
|
-
[headCells]
|
|
6944
|
-
);
|
|
6945
|
-
const handleSelectAllClick = useCallback2(
|
|
6946
|
-
(event) => {
|
|
6947
|
-
if (event.target.checked) {
|
|
6948
|
-
const allItems = new Set(data.map((n) => n[keyField]));
|
|
6949
|
-
setSelected(allItems);
|
|
6950
|
-
} else {
|
|
6951
|
-
setSelected(/* @__PURE__ */ new Set());
|
|
6952
|
-
}
|
|
6953
|
-
},
|
|
6954
|
-
[data, keyField]
|
|
6955
|
-
);
|
|
7092
|
+
const [rowsPerPage, setRowsPerPage] = useState16(defaultRowsPerPage);
|
|
7093
|
+
const { classes } = useStyles47();
|
|
7094
|
+
const rowHeight = 56;
|
|
7095
|
+
const emptyRows = rowsPerPage - Math.min(rowsPerPage, data.length - page * rowsPerPage);
|
|
6956
7096
|
const handleRequestSort = (event, property) => {
|
|
6957
7097
|
const isAsc = orderBy === property && order === "asc";
|
|
6958
7098
|
const orderDir = isAsc ? "desc" : "asc";
|
|
@@ -6962,459 +7102,424 @@ var TableDesktop = ({
|
|
|
6962
7102
|
updateSort(property, orderDir);
|
|
6963
7103
|
}
|
|
6964
7104
|
};
|
|
6965
|
-
|
|
6966
|
-
(
|
|
6967
|
-
|
|
6968
|
-
setSelected((prev) => {
|
|
6969
|
-
const newSelected = new Set(prev);
|
|
6970
|
-
if (newSelected.has(keyFieldValue)) {
|
|
6971
|
-
newSelected.delete(keyFieldValue);
|
|
6972
|
-
} else {
|
|
6973
|
-
newSelected.add(keyFieldValue);
|
|
6974
|
-
}
|
|
6975
|
-
return newSelected;
|
|
6976
|
-
});
|
|
6977
|
-
},
|
|
6978
|
-
[]
|
|
6979
|
-
);
|
|
6980
|
-
const renderTableRows = useMemo2(() => {
|
|
6981
|
-
if (isLoading) {
|
|
6982
|
-
return [...Array(Math.min(numRows, rowsPerPage))].map((_, rowIndex) => /* @__PURE__ */ jsx111(TableRow4, { children: [...Array(visibleHeadCells.length)].map((_2, cellIndex) => /* @__PURE__ */ jsx111(TableCell4, { children: /* @__PURE__ */ jsx111(
|
|
6983
|
-
Skeleton2,
|
|
6984
|
-
{
|
|
6985
|
-
animation: "pulse",
|
|
6986
|
-
variant: "rounded",
|
|
6987
|
-
height: ROW_HEIGHT - 33,
|
|
6988
|
-
sx: { bgcolor: colors.neutral100 },
|
|
6989
|
-
"data-testid": "loading-skeleton"
|
|
6990
|
-
}
|
|
6991
|
-
) }, cellIndex)) }, rowIndex));
|
|
7105
|
+
useLayoutEffect(() => {
|
|
7106
|
+
if (!doNotCalculateRows) {
|
|
7107
|
+
return;
|
|
6992
7108
|
}
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7109
|
+
function updateRowsPerPage() {
|
|
7110
|
+
const newRowsPerPage = calculateRowsPerPage(rowHeight);
|
|
7111
|
+
setRowsPerPage(newRowsPerPage);
|
|
7112
|
+
}
|
|
7113
|
+
updateRowsPerPage();
|
|
7114
|
+
const debounced = (0, import_debounce.default)(updateRowsPerPage, 150);
|
|
7115
|
+
window.addEventListener("resize", debounced);
|
|
7116
|
+
return () => {
|
|
7117
|
+
window.removeEventListener("resize", debounced);
|
|
7118
|
+
};
|
|
7119
|
+
}, [doNotCalculateRows]);
|
|
7120
|
+
const createSortHandler = (property) => (event) => {
|
|
7121
|
+
handleRequestSort(event, property);
|
|
7122
|
+
};
|
|
7123
|
+
const getTableRows = () => {
|
|
7124
|
+
const index = page;
|
|
7125
|
+
const rows = serverRendered ? data : stableSort(data, getSorting(order, orderBy)).slice(
|
|
7126
|
+
index * rowsPerPage,
|
|
7127
|
+
index * rowsPerPage + rowsPerPage
|
|
7128
|
+
);
|
|
7129
|
+
const rowsComponents = rows.map((row) => {
|
|
7130
|
+
if (RenderItem) {
|
|
7131
|
+
return /* @__PURE__ */ jsx111(RenderItem, { ...row }, row.id);
|
|
7132
|
+
}
|
|
7133
|
+
return /* @__PURE__ */ jsx111(TableRow2, { hover: true, onClick: () => onRowClick?.(row), children: headCells?.map((column) => /* @__PURE__ */ jsx111(TableCell2, { children: row[column.id] }, column.id)) }, row.id);
|
|
7013
7134
|
});
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
page,
|
|
7019
|
-
rowsPerPage,
|
|
7020
|
-
selected,
|
|
7021
|
-
isLoading,
|
|
7022
|
-
numRows,
|
|
7023
|
-
enableCheckboxSelection,
|
|
7024
|
-
disableInternalSort,
|
|
7025
|
-
deleteItem,
|
|
7026
|
-
keyField,
|
|
7027
|
-
handleRowCheckboxChange,
|
|
7028
|
-
visibleHeadCells,
|
|
7029
|
-
RenderItem
|
|
7030
|
-
]);
|
|
7031
|
-
useEffect10(() => {
|
|
7032
|
-
if (!enableCheckboxSelection) {
|
|
7033
|
-
setSelected(/* @__PURE__ */ new Set());
|
|
7135
|
+
if (emptyRows > 0 && rowsPerPage > emptyRows) {
|
|
7136
|
+
rowsComponents.push(
|
|
7137
|
+
/* @__PURE__ */ jsx111(TableRow2, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx111(TableCell2, { colSpan: 8 }) }, uuidv4())
|
|
7138
|
+
);
|
|
7034
7139
|
}
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7140
|
+
return rowsComponents;
|
|
7141
|
+
};
|
|
7142
|
+
return /* @__PURE__ */ jsx111(Paper10, { className: classes.root, children: /* @__PURE__ */ jsx111(Box31, { className: classes.paper, children: isLoading ? /* @__PURE__ */ jsx111(TableLoading_default, { rowHeight, rowsPerPage }) : /* @__PURE__ */ jsx111(TableContainer, { className: classes.container, children: /* @__PURE__ */ jsxs75(MUITable, { size: "medium", stickyHeader: true, children: [
|
|
7143
|
+
/* @__PURE__ */ jsx111(TableHead2, { className: classes.header, children: /* @__PURE__ */ jsx111(TableRow2, { children: headCells?.map((headCell) => /* @__PURE__ */ jsx111(
|
|
7144
|
+
TableCell2,
|
|
7039
7145
|
{
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
}
|
|
7060
|
-
),
|
|
7061
|
-
/* @__PURE__ */ jsx111(TableBody2, { children: rowsPerPage !== emptyRows ? renderTableRows : /* @__PURE__ */ jsx111(
|
|
7062
|
-
TableEmptyResult_default,
|
|
7063
|
-
{
|
|
7064
|
-
colSpan: enableCheckboxSelection ? visibleHeadCells.length + 1 : visibleHeadCells.length,
|
|
7065
|
-
showClearFilterButton,
|
|
7066
|
-
handleClickOnClearFiltersButton
|
|
7067
|
-
}
|
|
7068
|
-
) })
|
|
7069
|
-
] })
|
|
7070
|
-
}
|
|
7071
|
-
) }),
|
|
7072
|
-
children
|
|
7073
|
-
] }) });
|
|
7146
|
+
align: "left",
|
|
7147
|
+
sortDirection: orderBy === headCell.id ? order : void 0,
|
|
7148
|
+
children: /* @__PURE__ */ jsx111(
|
|
7149
|
+
TableSortLabel2,
|
|
7150
|
+
{
|
|
7151
|
+
active: orderBy === headCell.id,
|
|
7152
|
+
direction: orderBy === headCell.id ? order : "asc",
|
|
7153
|
+
onClick: createSortHandler(headCell.id),
|
|
7154
|
+
children: headCell.label
|
|
7155
|
+
}
|
|
7156
|
+
)
|
|
7157
|
+
},
|
|
7158
|
+
headCell.id
|
|
7159
|
+
)) }) }),
|
|
7160
|
+
/* @__PURE__ */ jsxs75(TableBody, { children: [
|
|
7161
|
+
getTableRows(),
|
|
7162
|
+
rowsPerPage === emptyRows && /* @__PURE__ */ jsx111(TableRow2, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx111(TableCell2, { colSpan: 8, align: "center", children: "Nothing to display" }) })
|
|
7163
|
+
] })
|
|
7164
|
+
] }) }) }) });
|
|
7074
7165
|
};
|
|
7075
|
-
var
|
|
7166
|
+
var Table_default = Table;
|
|
7076
7167
|
|
|
7077
|
-
// src/components/
|
|
7078
|
-
import {
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
alignItems: "center",
|
|
7105
|
-
justifyContent: "space-between",
|
|
7106
|
-
padding: theme.spacing(0, 3)
|
|
7107
|
-
},
|
|
7108
|
-
applyFilterButtonsContainer: {
|
|
7109
|
-
display: "flex",
|
|
7110
|
-
padding: theme.spacing(0, 1),
|
|
7111
|
-
justifyContent: "space-between"
|
|
7112
|
-
},
|
|
7113
|
-
saveAsDefaultButton: {
|
|
7114
|
-
color: theme.palette.primary.main
|
|
7115
|
-
},
|
|
7116
|
-
skeleton: {
|
|
7117
|
-
height: theme.spacing(3),
|
|
7118
|
-
margin: theme.spacing(1)
|
|
7119
|
-
}
|
|
7120
|
-
}));
|
|
7121
|
-
var findFilterIndex = (filters, filterOption) => filters.findIndex((item) => {
|
|
7122
|
-
if (typeof item === "string" && typeof filterOption === "string") {
|
|
7123
|
-
return item === filterOption;
|
|
7124
|
-
}
|
|
7125
|
-
if (typeof item === "object" && typeof filterOption === "object") {
|
|
7126
|
-
return item.id === filterOption.id;
|
|
7127
|
-
}
|
|
7128
|
-
return false;
|
|
7129
|
-
});
|
|
7130
|
-
var SmartTableHeaderFilterMenu = ({
|
|
7131
|
-
headCell,
|
|
7132
|
-
numActiveFilters,
|
|
7133
|
-
headerFilters,
|
|
7134
|
-
shouldShowCheckOnFilter,
|
|
7135
|
-
onApplyFilters
|
|
7168
|
+
// src/components/TableDesktop/TableDesktop.tsx
|
|
7169
|
+
import {
|
|
7170
|
+
useMemo as useMemo3,
|
|
7171
|
+
useState as useState17,
|
|
7172
|
+
useEffect as useEffect11
|
|
7173
|
+
} from "react";
|
|
7174
|
+
import {
|
|
7175
|
+
Paper as Paper11,
|
|
7176
|
+
Table as Table2,
|
|
7177
|
+
TableBody as TableBody3,
|
|
7178
|
+
TableContainer as TableContainer2,
|
|
7179
|
+
Box as Box34
|
|
7180
|
+
} from "@mui/material";
|
|
7181
|
+
|
|
7182
|
+
// src/components/TableDesktopFooter/TableDesktopFooter.tsx
|
|
7183
|
+
import Refresh3 from "@mui/icons-material/Refresh";
|
|
7184
|
+
import { Box as Box32, Button as Button13, MenuItem as MenuItem4, Pagination as Pagination2, Select as Select4, Stack, Typography as Typography26 } from "@mui/material";
|
|
7185
|
+
import { jsx as jsx112, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
7186
|
+
var TableDesktopFooter = ({
|
|
7187
|
+
numPages,
|
|
7188
|
+
page,
|
|
7189
|
+
pageSize,
|
|
7190
|
+
pageSizeOptions,
|
|
7191
|
+
onPageChange,
|
|
7192
|
+
onPageSizeChange,
|
|
7193
|
+
refetch,
|
|
7194
|
+
isFetching
|
|
7136
7195
|
}) => {
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
newSelected = [...selectedFilters, option];
|
|
7166
|
-
} else {
|
|
7167
|
-
newSelected = [...selectedFilters, option];
|
|
7168
|
-
}
|
|
7169
|
-
} else {
|
|
7170
|
-
newSelected = selectedFilters.filter(
|
|
7171
|
-
(_, index) => index !== selectedIndex
|
|
7172
|
-
);
|
|
7173
|
-
}
|
|
7174
|
-
setSelectedFilters(newSelected);
|
|
7175
|
-
};
|
|
7176
|
-
const handleApplyFilters = (shouldSave) => {
|
|
7177
|
-
const updatedFilters = {
|
|
7178
|
-
...headerFilters,
|
|
7179
|
-
[headCell.id]: [...selectedFilters]
|
|
7180
|
-
};
|
|
7181
|
-
onApplyFilters?.(updatedFilters, shouldSave);
|
|
7182
|
-
setAnchorEl(null);
|
|
7183
|
-
};
|
|
7184
|
-
useEffect11(() => {
|
|
7185
|
-
setSelectedFilters(headerFilters[headCell.id] ?? []);
|
|
7186
|
-
}, [headerFilters, headCell.id]);
|
|
7187
|
-
const isOptionChecked = useMemo3(() => (resolvedOption) => !!selectedFilters?.some(
|
|
7188
|
-
(value) => resolveOptionType(value, headCell.fieldName ?? "") === resolvedOption
|
|
7189
|
-
), [selectedFilters]);
|
|
7190
|
-
const loadingSkeletons = /* @__PURE__ */ jsxs77(Box29, { "data-testid": "loading-skeletons", width: 272, children: [
|
|
7191
|
-
/* @__PURE__ */ jsx112(Skeleton3, { variant: "rounded", className: classes.skeleton }),
|
|
7192
|
-
/* @__PURE__ */ jsx112(Divider9, {}),
|
|
7193
|
-
/* @__PURE__ */ jsx112(Skeleton3, { variant: "rounded", className: classes.skeleton }),
|
|
7194
|
-
/* @__PURE__ */ jsx112(Skeleton3, { variant: "rounded", className: classes.skeleton }),
|
|
7195
|
-
/* @__PURE__ */ jsx112(Skeleton3, { variant: "rounded", className: classes.skeleton }),
|
|
7196
|
-
/* @__PURE__ */ jsx112(Skeleton3, { variant: "rounded", className: classes.skeleton }),
|
|
7197
|
-
/* @__PURE__ */ jsx112(Divider9, {}),
|
|
7198
|
-
/* @__PURE__ */ jsx112(Skeleton3, { variant: "rounded", className: classes.skeleton })
|
|
7199
|
-
] });
|
|
7200
|
-
return /* @__PURE__ */ jsxs77(Fragment12, { children: [
|
|
7201
|
-
/* @__PURE__ */ jsx112(
|
|
7202
|
-
ActiveFiltersIconButton_default,
|
|
7203
|
-
{
|
|
7204
|
-
numActiveFilters,
|
|
7205
|
-
handleClick: handleFilterMenuOpen,
|
|
7206
|
-
className: classNames3("filter-menu-trigger", {
|
|
7207
|
-
"has-active-filters": !!numActiveFilters || !!anchorEl
|
|
7208
|
-
})
|
|
7209
|
-
}
|
|
7210
|
-
),
|
|
7211
|
-
/* @__PURE__ */ jsx112(
|
|
7212
|
-
Menu4,
|
|
7213
|
-
{
|
|
7214
|
-
open: !!anchorEl,
|
|
7215
|
-
onClose: handleFilterMenuClose,
|
|
7216
|
-
anchorEl,
|
|
7217
|
-
"data-testid": "filter-menu",
|
|
7218
|
-
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
7219
|
-
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
7220
|
-
children: headCell.isFetchingFilterOptions ? loadingSkeletons : /* @__PURE__ */ jsxs77(Box29, { className: classes.filterMenu, children: [
|
|
7221
|
-
/* @__PURE__ */ jsx112(Box29, { px: 3, mb: 0.5, children: /* @__PURE__ */ jsx112(
|
|
7222
|
-
FormControlLabel3,
|
|
7223
|
-
{
|
|
7224
|
-
label: "Select All",
|
|
7225
|
-
control: /* @__PURE__ */ jsx112(
|
|
7226
|
-
Checkbox5,
|
|
7196
|
+
return /* @__PURE__ */ jsxs76(
|
|
7197
|
+
Box32,
|
|
7198
|
+
{
|
|
7199
|
+
py: 1,
|
|
7200
|
+
gap: 2,
|
|
7201
|
+
display: "flex",
|
|
7202
|
+
justifyContent: "space-between",
|
|
7203
|
+
alignItems: "center",
|
|
7204
|
+
borderTop: `1px solid ${colors.neutral300}`,
|
|
7205
|
+
bgcolor: (theme) => theme.palette.background.default,
|
|
7206
|
+
children: [
|
|
7207
|
+
/* @__PURE__ */ jsxs76(
|
|
7208
|
+
Button13,
|
|
7209
|
+
{
|
|
7210
|
+
disableRipple: true,
|
|
7211
|
+
variant: "outlined",
|
|
7212
|
+
onClick: () => refetch(),
|
|
7213
|
+
disabled: isFetching,
|
|
7214
|
+
sx: {
|
|
7215
|
+
ml: 1,
|
|
7216
|
+
gap: 1,
|
|
7217
|
+
borderRadius: 25,
|
|
7218
|
+
color: colors.neutral800,
|
|
7219
|
+
borderColor: colors.neutral600
|
|
7220
|
+
},
|
|
7221
|
+
children: [
|
|
7222
|
+
/* @__PURE__ */ jsx112(
|
|
7223
|
+
Refresh3,
|
|
7227
7224
|
{
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
indeterminate: numCurrentSelectedFilters > 0 && numCurrentSelectedFilters < numFilterOptions,
|
|
7231
|
-
onChange: ({ target: { checked } }) => {
|
|
7232
|
-
if (checked) {
|
|
7233
|
-
setSelectedFilters([...filterOptionsData]);
|
|
7234
|
-
} else {
|
|
7235
|
-
setSelectedFilters([]);
|
|
7236
|
-
}
|
|
7237
|
-
}
|
|
7225
|
+
fontSize: "small",
|
|
7226
|
+
color: isFetching ? "disabled" : "primary"
|
|
7238
7227
|
}
|
|
7239
|
-
)
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
Box29,
|
|
7248
|
-
{
|
|
7249
|
-
className: classes.filter,
|
|
7250
|
-
children: [
|
|
7251
|
-
/* @__PURE__ */ jsx112(
|
|
7252
|
-
FormControlLabel3,
|
|
7253
|
-
{
|
|
7254
|
-
label: resolvedOption,
|
|
7255
|
-
control: /* @__PURE__ */ jsx112(
|
|
7256
|
-
Checkbox5,
|
|
7257
|
-
{
|
|
7258
|
-
disableRipple: true,
|
|
7259
|
-
onChange: () => handleFilterOptionClick(option),
|
|
7260
|
-
checked: isOptionChecked(resolvedOption)
|
|
7261
|
-
}
|
|
7262
|
-
)
|
|
7263
|
-
},
|
|
7264
|
-
resolvedOption
|
|
7265
|
-
),
|
|
7266
|
-
shouldShowCheckOnFilter?.(headCell.id, option) ? /* @__PURE__ */ jsx112(Tooltip6, { title: "This filter is saved as default", children: /* @__PURE__ */ jsx112(CheckIcon, { fontSize: "small", color: "action" }) }) : null
|
|
7267
|
-
]
|
|
7268
|
-
},
|
|
7269
|
-
resolvedOption
|
|
7270
|
-
);
|
|
7271
|
-
}
|
|
7272
|
-
) }),
|
|
7273
|
-
/* @__PURE__ */ jsx112(Divider9, { sx: { mb: 0.5 } }),
|
|
7274
|
-
/* @__PURE__ */ jsxs77(Box29, { className: classes.applyFilterButtonsContainer, children: [
|
|
7275
|
-
/* @__PURE__ */ jsx112(
|
|
7276
|
-
ExtendedButton_default,
|
|
7277
|
-
{
|
|
7278
|
-
copy: "Save as Default",
|
|
7279
|
-
buttonType: "button",
|
|
7280
|
-
variant: "text",
|
|
7281
|
-
tooltip: "Persists those filters for future visits",
|
|
7282
|
-
className: classes.saveAsDefaultButton,
|
|
7283
|
-
onClick: () => handleApplyFilters(true)
|
|
7284
|
-
}
|
|
7285
|
-
),
|
|
7228
|
+
),
|
|
7229
|
+
"REFRESH"
|
|
7230
|
+
]
|
|
7231
|
+
}
|
|
7232
|
+
),
|
|
7233
|
+
/* @__PURE__ */ jsxs76(Box32, { display: "flex", children: [
|
|
7234
|
+
/* @__PURE__ */ jsxs76(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [
|
|
7235
|
+
/* @__PURE__ */ jsx112(Typography26, { children: "Rows per page:" }),
|
|
7286
7236
|
/* @__PURE__ */ jsx112(
|
|
7287
|
-
|
|
7237
|
+
Select4,
|
|
7288
7238
|
{
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7239
|
+
value: pageSize,
|
|
7240
|
+
onChange: onPageSizeChange,
|
|
7241
|
+
size: "small",
|
|
7242
|
+
variant: "standard",
|
|
7243
|
+
children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx112(MenuItem4, { value: size, children: size }, size))
|
|
7293
7244
|
}
|
|
7294
7245
|
)
|
|
7295
|
-
] })
|
|
7246
|
+
] }),
|
|
7247
|
+
/* @__PURE__ */ jsx112(
|
|
7248
|
+
Pagination2,
|
|
7249
|
+
{
|
|
7250
|
+
color: "standard",
|
|
7251
|
+
count: numPages,
|
|
7252
|
+
page,
|
|
7253
|
+
onChange: onPageChange
|
|
7254
|
+
}
|
|
7255
|
+
)
|
|
7296
7256
|
] })
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7257
|
+
]
|
|
7258
|
+
}
|
|
7259
|
+
);
|
|
7300
7260
|
};
|
|
7301
|
-
var SmartTableHeaderFilterMenu_default = memo21(SmartTableHeaderFilterMenu);
|
|
7302
7261
|
|
|
7303
|
-
// src/components/
|
|
7304
|
-
|
|
7305
|
-
import
|
|
7306
|
-
import
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7262
|
+
// src/components/TableDesktopNoColumnsMessage/TableDesktopNoColumnsMessage.tsx
|
|
7263
|
+
import TableBody2 from "@mui/material/TableBody";
|
|
7264
|
+
import TableCell3 from "@mui/material/TableCell";
|
|
7265
|
+
import TableRow3 from "@mui/material/TableRow";
|
|
7266
|
+
import Typography27 from "@mui/material/Typography";
|
|
7267
|
+
import { jsx as jsx113, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
7268
|
+
var TableDesktopNoColumnsMessage = () => /* @__PURE__ */ jsx113(TableBody2, { children: /* @__PURE__ */ jsx113(TableRow3, { children: /* @__PURE__ */ jsxs77(
|
|
7269
|
+
TableCell3,
|
|
7270
|
+
{
|
|
7271
|
+
sx: {
|
|
7272
|
+
py: 8,
|
|
7273
|
+
gap: 2,
|
|
7274
|
+
borderBottom: "none",
|
|
7275
|
+
display: "flex",
|
|
7276
|
+
flexDirection: "column",
|
|
7277
|
+
justifyContent: "center",
|
|
7278
|
+
alignItems: "center"
|
|
7279
|
+
},
|
|
7280
|
+
children: [
|
|
7281
|
+
/* @__PURE__ */ jsx113(Typography27, { variant: "subtitle2", fontSize: 16, children: "Customise your view" }),
|
|
7282
|
+
/* @__PURE__ */ jsxs77(Typography27, { variant: "subtitle1", align: "center", color: "textSecondary", children: [
|
|
7283
|
+
"Use the column selector on the right to choose which fields",
|
|
7284
|
+
/* @__PURE__ */ jsx113("br", {}),
|
|
7285
|
+
"you want to display in the table"
|
|
7286
|
+
] })
|
|
7287
|
+
]
|
|
7288
|
+
}
|
|
7289
|
+
) }) });
|
|
7319
7290
|
|
|
7320
|
-
// src/components/
|
|
7321
|
-
import {
|
|
7322
|
-
import { jsx as
|
|
7323
|
-
var
|
|
7291
|
+
// src/components/TableDesktopLoadingState/TableDesktopLoadingState.tsx
|
|
7292
|
+
import { Skeleton as Skeleton4, TableCell as TableCell4, TableRow as TableRow4 } from "@mui/material";
|
|
7293
|
+
import { jsx as jsx114 } from "react/jsx-runtime";
|
|
7294
|
+
var getRange = (n) => Array.from({ length: n }, (_, i) => i + 1);
|
|
7295
|
+
var TableDesktopLoadingState = ({
|
|
7296
|
+
numRows,
|
|
7324
7297
|
rowsPerPage,
|
|
7298
|
+
numColumns,
|
|
7325
7299
|
rowHeight
|
|
7326
|
-
}) =>
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
index
|
|
7336
|
-
)) });
|
|
7337
|
-
var TableLoading_default = TableLoading;
|
|
7338
|
-
|
|
7339
|
-
// src/components/Table/helpers.tsx
|
|
7340
|
-
function stableSort2(array, cmp) {
|
|
7341
|
-
const stabilizedThis = array.map((el, index) => [el, index]);
|
|
7342
|
-
stabilizedThis.sort((a, b) => {
|
|
7343
|
-
const order = cmp(a[0], b[0]);
|
|
7344
|
-
if (order !== 0) {
|
|
7345
|
-
return order;
|
|
7300
|
+
}) => {
|
|
7301
|
+
return getRange(Math.min(numRows, rowsPerPage)).map((rowNum) => /* @__PURE__ */ jsx114(TableRow4, { children: getRange(numColumns).map((colNum) => /* @__PURE__ */ jsx114(TableCell4, { children: /* @__PURE__ */ jsx114(
|
|
7302
|
+
Skeleton4,
|
|
7303
|
+
{
|
|
7304
|
+
animation: "pulse",
|
|
7305
|
+
variant: "rounded",
|
|
7306
|
+
height: rowHeight - 33,
|
|
7307
|
+
sx: { bgcolor: colors.neutral100 },
|
|
7308
|
+
"data-testid": "loading-skeleton"
|
|
7346
7309
|
}
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7310
|
+
) }, colNum)) }, rowNum));
|
|
7311
|
+
};
|
|
7312
|
+
|
|
7313
|
+
// src/components/TableDesktopRows/TableDesktopRows.tsx
|
|
7314
|
+
import { jsx as jsx115 } from "react/jsx-runtime";
|
|
7315
|
+
var descendingComparator2 = (a, b, orderBy) => {
|
|
7316
|
+
const objA = a[orderBy];
|
|
7317
|
+
const objB = b[orderBy];
|
|
7318
|
+
const valA = typeof objA === "object" ? objA?.name : objA;
|
|
7319
|
+
const valB = typeof objB === "object" ? objB?.name : objB;
|
|
7320
|
+
if (!valA && !valB) {
|
|
7321
|
+
return 0;
|
|
7322
|
+
}
|
|
7323
|
+
if (valA && !valB) {
|
|
7353
7324
|
return -1;
|
|
7354
7325
|
}
|
|
7355
|
-
if (
|
|
7326
|
+
if (!valA && valB) {
|
|
7327
|
+
return 1;
|
|
7328
|
+
}
|
|
7329
|
+
if (valA > valB) {
|
|
7330
|
+
return -1;
|
|
7331
|
+
}
|
|
7332
|
+
if (valA < valB) {
|
|
7356
7333
|
return 1;
|
|
7357
7334
|
}
|
|
7358
7335
|
return 0;
|
|
7359
|
-
}
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7336
|
+
};
|
|
7337
|
+
var stableSort2 = (array, cmp) => array.map((el, index) => ({ el, index })).sort((a, b) => {
|
|
7338
|
+
const order = cmp(a.el, b.el);
|
|
7339
|
+
return order !== 0 ? order : a.index - b.index;
|
|
7340
|
+
}).map((el) => el.el);
|
|
7341
|
+
var getComparator = (order, orderBy) => order === "desc" ? (a, b) => descendingComparator2(a, b, orderBy) : (a, b) => -descendingComparator2(a, b, orderBy);
|
|
7342
|
+
var TableDesktopRows = ({
|
|
7343
|
+
data,
|
|
7344
|
+
RenderItem,
|
|
7345
|
+
visibleHeadCells,
|
|
7346
|
+
keyField,
|
|
7347
|
+
order,
|
|
7348
|
+
orderBy,
|
|
7349
|
+
rowsPerPage,
|
|
7350
|
+
isLoading,
|
|
7351
|
+
disableInternalSort,
|
|
7352
|
+
enableCheckboxSelection,
|
|
7353
|
+
enableEditMode,
|
|
7354
|
+
selectedRows,
|
|
7355
|
+
handleRowCheckboxChange,
|
|
7356
|
+
rowHeight,
|
|
7357
|
+
deleteItem
|
|
7358
|
+
}) => {
|
|
7359
|
+
const sortedData = disableInternalSort ? data : stableSort2(data, getComparator(order, orderBy));
|
|
7360
|
+
if (isLoading) {
|
|
7361
|
+
return /* @__PURE__ */ jsx115(
|
|
7362
|
+
TableDesktopLoadingState,
|
|
7363
|
+
{
|
|
7364
|
+
numRows: data.length,
|
|
7365
|
+
rowsPerPage,
|
|
7366
|
+
numColumns: visibleHeadCells.length + (enableCheckboxSelection ? 1 : 0),
|
|
7367
|
+
rowHeight
|
|
7368
|
+
}
|
|
7369
7369
|
);
|
|
7370
7370
|
}
|
|
7371
|
-
return
|
|
7372
|
-
|
|
7371
|
+
return sortedData.map((row, index) => {
|
|
7372
|
+
const isItemSelected = selectedRows.has(row[keyField]);
|
|
7373
|
+
return /* @__PURE__ */ jsx115(
|
|
7374
|
+
RenderItem,
|
|
7375
|
+
{
|
|
7376
|
+
...{
|
|
7377
|
+
...row,
|
|
7378
|
+
index,
|
|
7379
|
+
deleteItem,
|
|
7380
|
+
isItemSelected,
|
|
7381
|
+
enableEditMode,
|
|
7382
|
+
enableCheckboxSelection,
|
|
7383
|
+
rowHeight,
|
|
7384
|
+
rowId: row[keyField],
|
|
7385
|
+
handleRowCheckboxChange,
|
|
7386
|
+
visibleHeadCells
|
|
7387
|
+
}
|
|
7388
|
+
},
|
|
7389
|
+
row[keyField] ?? index
|
|
7390
|
+
);
|
|
7391
|
+
});
|
|
7392
|
+
};
|
|
7373
7393
|
|
|
7374
|
-
// src/components/
|
|
7375
|
-
import {
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7394
|
+
// src/components/TableDesktopRowSelectionBar/TableDesktopRowSelectionBar.tsx
|
|
7395
|
+
import { Box as Box33, Button as Button14, Typography as Typography28 } from "@mui/material";
|
|
7396
|
+
import { jsx as jsx116, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
7397
|
+
var TableDesktopRowSelectionBar = ({
|
|
7398
|
+
isEveryRowInPageSelected,
|
|
7399
|
+
isRowsInAllPagesSelected,
|
|
7400
|
+
numSelectedRows,
|
|
7401
|
+
totalRowCount,
|
|
7402
|
+
handleRowSelectionBarClick
|
|
7403
|
+
}) => {
|
|
7404
|
+
return isEveryRowInPageSelected ? /* @__PURE__ */ jsxs78(
|
|
7405
|
+
Box33,
|
|
7406
|
+
{
|
|
7407
|
+
sx: {
|
|
7408
|
+
p: 1,
|
|
7409
|
+
gap: 2,
|
|
7410
|
+
display: "flex",
|
|
7411
|
+
justifyContent: "center",
|
|
7412
|
+
alignItems: "center",
|
|
7413
|
+
backgroundColor: colors.neutral150
|
|
7414
|
+
},
|
|
7415
|
+
children: [
|
|
7416
|
+
/* @__PURE__ */ jsx116(Typography28, { children: isRowsInAllPagesSelected ? `All ${totalRowCount} rows are selected based on your filters.` : `All ${numSelectedRows} rows on this page are selected.` }),
|
|
7417
|
+
/* @__PURE__ */ jsx116(Button14, { onClick: handleRowSelectionBarClick, children: isRowsInAllPagesSelected ? "Clear Selection" : `Select all ${totalRowCount} rows from all pages based on your filters.` })
|
|
7418
|
+
]
|
|
7391
7419
|
}
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7420
|
+
) : null;
|
|
7421
|
+
};
|
|
7422
|
+
|
|
7423
|
+
// src/components/TableEmptyResult/TableEmptyResult.tsx
|
|
7424
|
+
import { TableCell as TableCell5, TableRow as TableRow5, Typography as Typography29 } from "@mui/material";
|
|
7425
|
+
import { makeStyles as makeStyles48 } from "tss-react/mui";
|
|
7426
|
+
import { jsx as jsx117, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
7427
|
+
var useStyles48 = makeStyles48()(() => ({
|
|
7428
|
+
tableCellIcon: { padding: 24, height: "calc(100vh - 320px)" },
|
|
7429
|
+
tableCellDefault: { padding: 24 }
|
|
7396
7430
|
}));
|
|
7397
|
-
var
|
|
7398
|
-
|
|
7431
|
+
var TableEmptyResult = ({
|
|
7432
|
+
colSpan,
|
|
7433
|
+
showClearFilterButton = false,
|
|
7434
|
+
handleClickOnClearFiltersButton = () => {
|
|
7435
|
+
}
|
|
7436
|
+
}) => {
|
|
7437
|
+
const { classes } = useStyles48();
|
|
7438
|
+
return showClearFilterButton ? /* @__PURE__ */ jsx117(TableRow5, { children: /* @__PURE__ */ jsxs79(
|
|
7439
|
+
TableCell5,
|
|
7440
|
+
{
|
|
7441
|
+
className: classes.tableCellIcon,
|
|
7442
|
+
colSpan,
|
|
7443
|
+
align: "center",
|
|
7444
|
+
children: [
|
|
7445
|
+
/* @__PURE__ */ jsx117(EmptyGlassIcon_default, {}),
|
|
7446
|
+
/* @__PURE__ */ jsx117(Typography29, { variant: "h6", children: "No results found." }),
|
|
7447
|
+
/* @__PURE__ */ jsx117(Typography29, { variant: "subtitle1", children: "Search without applied filters?" }),
|
|
7448
|
+
/* @__PURE__ */ jsx117(
|
|
7449
|
+
FilledButton_default,
|
|
7450
|
+
{
|
|
7451
|
+
copy: "Search",
|
|
7452
|
+
variant: "contained",
|
|
7453
|
+
color: "primary",
|
|
7454
|
+
onClick: handleClickOnClearFiltersButton
|
|
7455
|
+
}
|
|
7456
|
+
)
|
|
7457
|
+
]
|
|
7458
|
+
}
|
|
7459
|
+
) }) : /* @__PURE__ */ jsx117(TableRow5, { children: /* @__PURE__ */ jsx117(
|
|
7460
|
+
TableCell5,
|
|
7461
|
+
{
|
|
7462
|
+
className: classes.tableCellDefault,
|
|
7463
|
+
colSpan,
|
|
7464
|
+
align: "center",
|
|
7465
|
+
children: "Nothing to display"
|
|
7466
|
+
}
|
|
7467
|
+
) });
|
|
7468
|
+
};
|
|
7469
|
+
var TableEmptyResult_default = TableEmptyResult;
|
|
7470
|
+
|
|
7471
|
+
// src/components/TableDesktop/TableDesktop.tsx
|
|
7472
|
+
import { Fragment as Fragment12, jsx as jsx118, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
7473
|
+
var TableDesktop = ({
|
|
7399
7474
|
data,
|
|
7400
|
-
doNotCalculateRows,
|
|
7401
7475
|
headCells,
|
|
7476
|
+
RenderItem,
|
|
7477
|
+
appliedFilters,
|
|
7478
|
+
headerFilters,
|
|
7479
|
+
children,
|
|
7480
|
+
height,
|
|
7481
|
+
rowHeight = 56,
|
|
7482
|
+
totalDataCount,
|
|
7402
7483
|
isLoading,
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7484
|
+
rowsPerPage = 50,
|
|
7485
|
+
enableEditMode = false,
|
|
7486
|
+
enableCheckboxSelection = false,
|
|
7487
|
+
disableInternalSort = false,
|
|
7488
|
+
updateSort,
|
|
7489
|
+
showClearFilterButton,
|
|
7490
|
+
handleClickOnClearFiltersButton,
|
|
7491
|
+
deleteItem,
|
|
7492
|
+
keyField = "id",
|
|
7493
|
+
tableLayout = "auto",
|
|
7494
|
+
onApplyFilters,
|
|
7495
|
+
shouldShowCheckOnFilter,
|
|
7496
|
+
components,
|
|
7497
|
+
componentsProps
|
|
7409
7498
|
}) => {
|
|
7410
7499
|
const [order, setOrder] = useState17(appliedFilters?.sortDir || "desc");
|
|
7411
7500
|
const [orderBy, setOrderBy] = useState17(
|
|
7412
7501
|
appliedFilters?.sortField || "delivery_date"
|
|
7413
7502
|
);
|
|
7414
|
-
const [
|
|
7415
|
-
const
|
|
7416
|
-
const
|
|
7417
|
-
const
|
|
7503
|
+
const [selectedRows, setSelectedRows] = useState17(/* @__PURE__ */ new Set());
|
|
7504
|
+
const [isRowsInAllPagesSelected, setIsRowsInAllPagesSelected] = useState17(false);
|
|
7505
|
+
const { toolbar: Toolbar2 } = components ?? {};
|
|
7506
|
+
const { toolbarProps, footerProps } = componentsProps ?? {};
|
|
7507
|
+
const numRows = useMemo3(
|
|
7508
|
+
() => data.length,
|
|
7509
|
+
[data.length]
|
|
7510
|
+
);
|
|
7511
|
+
const emptyRows = useMemo3(
|
|
7512
|
+
() => rowsPerPage - numRows,
|
|
7513
|
+
[rowsPerPage, numRows]
|
|
7514
|
+
);
|
|
7515
|
+
const isEveryRowInPageSelected = useMemo3(
|
|
7516
|
+
() => numRows > 0 && selectedRows.size === numRows,
|
|
7517
|
+
[selectedRows, numRows]
|
|
7518
|
+
);
|
|
7519
|
+
const visibleHeadCells = useMemo3(
|
|
7520
|
+
() => headCells.filter((headCell) => headCell?.enabled ?? true),
|
|
7521
|
+
[headCells]
|
|
7522
|
+
);
|
|
7418
7523
|
const handleRequestSort = (event, property) => {
|
|
7419
7524
|
const isAsc = orderBy === property && order === "asc";
|
|
7420
7525
|
const orderDir = isAsc ? "desc" : "asc";
|
|
@@ -7424,156 +7529,243 @@ var Table2 = ({
|
|
|
7424
7529
|
updateSort(property, orderDir);
|
|
7425
7530
|
}
|
|
7426
7531
|
};
|
|
7427
|
-
|
|
7428
|
-
|
|
7532
|
+
const resetSelectedRows = () => {
|
|
7533
|
+
setSelectedRows(/* @__PURE__ */ new Set());
|
|
7534
|
+
setIsRowsInAllPagesSelected(false);
|
|
7535
|
+
};
|
|
7536
|
+
const handleSelectAllClick = (event) => {
|
|
7537
|
+
if (event.target.checked) {
|
|
7538
|
+
const allRowsIds = new Set(data.map((n) => n[keyField]));
|
|
7539
|
+
;
|
|
7540
|
+
setSelectedRows(allRowsIds);
|
|
7429
7541
|
return;
|
|
7430
7542
|
}
|
|
7431
|
-
|
|
7432
|
-
const newRowsPerPage = calculateRowsPerPage(rowHeight);
|
|
7433
|
-
setRowsPerPage(newRowsPerPage);
|
|
7434
|
-
}
|
|
7435
|
-
updateRowsPerPage();
|
|
7436
|
-
const debounced = (0, import_debounce.default)(updateRowsPerPage, 150);
|
|
7437
|
-
window.addEventListener("resize", debounced);
|
|
7438
|
-
return () => {
|
|
7439
|
-
window.removeEventListener("resize", debounced);
|
|
7440
|
-
};
|
|
7441
|
-
}, [doNotCalculateRows]);
|
|
7442
|
-
const createSortHandler = (property) => (event) => {
|
|
7443
|
-
handleRequestSort(event, property);
|
|
7543
|
+
resetSelectedRows();
|
|
7444
7544
|
};
|
|
7445
|
-
const
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
return /* @__PURE__ */ jsx114(RenderItem, { ...row }, row.id);
|
|
7545
|
+
const handleRowCheckboxChange = (event, rowId) => {
|
|
7546
|
+
event.stopPropagation();
|
|
7547
|
+
setSelectedRows((prev) => {
|
|
7548
|
+
const newSelected = new Set(prev);
|
|
7549
|
+
if (newSelected.has(rowId)) {
|
|
7550
|
+
newSelected.delete(rowId);
|
|
7551
|
+
} else {
|
|
7552
|
+
newSelected.add(rowId);
|
|
7454
7553
|
}
|
|
7455
|
-
return
|
|
7554
|
+
return newSelected;
|
|
7456
7555
|
});
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
);
|
|
7556
|
+
};
|
|
7557
|
+
const handleRowSelectionBarClick = () => {
|
|
7558
|
+
if (isRowsInAllPagesSelected) {
|
|
7559
|
+
resetSelectedRows();
|
|
7560
|
+
return;
|
|
7461
7561
|
}
|
|
7462
|
-
|
|
7562
|
+
setIsRowsInAllPagesSelected(true);
|
|
7463
7563
|
};
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7564
|
+
const handlePageChange = (event, page) => {
|
|
7565
|
+
resetSelectedRows();
|
|
7566
|
+
footerProps?.onPageChange?.(event, page);
|
|
7567
|
+
};
|
|
7568
|
+
useEffect11(() => {
|
|
7569
|
+
if (!enableCheckboxSelection) {
|
|
7570
|
+
resetSelectedRows();
|
|
7571
|
+
}
|
|
7572
|
+
}, [enableCheckboxSelection]);
|
|
7573
|
+
useEffect11(() => {
|
|
7574
|
+
if (isEveryRowInPageSelected || isRowsInAllPagesSelected) {
|
|
7575
|
+
const rowsIdsSet = new Set(data.map((obj) => obj[keyField]));
|
|
7576
|
+
setSelectedRows(
|
|
7577
|
+
(prev) => new Set([...prev].filter((value) => rowsIdsSet.has(value)))
|
|
7578
|
+
);
|
|
7579
|
+
}
|
|
7580
|
+
}, [data, setSelectedRows, isEveryRowInPageSelected, isRowsInAllPagesSelected]);
|
|
7581
|
+
return /* @__PURE__ */ jsx118(
|
|
7582
|
+
Box34,
|
|
7583
|
+
{
|
|
7584
|
+
sx: {
|
|
7585
|
+
height,
|
|
7586
|
+
display: "flex",
|
|
7587
|
+
justifyContent: "space-between",
|
|
7588
|
+
justifyItems: "stretch"
|
|
7479
7589
|
},
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7590
|
+
children: /* @__PURE__ */ jsxs80(
|
|
7591
|
+
Paper11,
|
|
7592
|
+
{
|
|
7593
|
+
sx: {
|
|
7594
|
+
width: "100%",
|
|
7595
|
+
display: "flex",
|
|
7596
|
+
flexDirection: "column",
|
|
7597
|
+
justifyContent: "space-between"
|
|
7598
|
+
},
|
|
7599
|
+
children: [
|
|
7600
|
+
Toolbar2 ? /* @__PURE__ */ jsx118(
|
|
7601
|
+
Toolbar2,
|
|
7602
|
+
{
|
|
7603
|
+
selectedRows: [...selectedRows],
|
|
7604
|
+
isRowsInAllPagesSelected,
|
|
7605
|
+
...toolbarProps
|
|
7606
|
+
}
|
|
7607
|
+
) : null,
|
|
7608
|
+
/* @__PURE__ */ jsx118(
|
|
7609
|
+
TableDesktopRowSelectionBar,
|
|
7610
|
+
{
|
|
7611
|
+
isEveryRowInPageSelected,
|
|
7612
|
+
isRowsInAllPagesSelected,
|
|
7613
|
+
numSelectedRows: selectedRows.size,
|
|
7614
|
+
totalRowCount: totalDataCount ?? 0,
|
|
7615
|
+
handleRowSelectionBarClick
|
|
7616
|
+
}
|
|
7617
|
+
),
|
|
7618
|
+
/* @__PURE__ */ jsx118(
|
|
7619
|
+
TableContainer2,
|
|
7620
|
+
{
|
|
7621
|
+
sx: {
|
|
7622
|
+
flexGrow: 1,
|
|
7623
|
+
minHeight: 0,
|
|
7624
|
+
maxHeight: "100%",
|
|
7625
|
+
"&::-webkit-scrollbar": {
|
|
7626
|
+
width: "8px",
|
|
7627
|
+
height: "8px"
|
|
7628
|
+
},
|
|
7629
|
+
"&::-webkit-scrollbar-track": {
|
|
7630
|
+
backgroundColor: (theme) => theme.palette.grey[100]
|
|
7631
|
+
},
|
|
7632
|
+
"&::-webkit-scrollbar-thumb": {
|
|
7633
|
+
backgroundColor: (theme) => theme.palette.grey[400],
|
|
7634
|
+
borderRadius: "10px"
|
|
7635
|
+
},
|
|
7636
|
+
"&::-webkit-scrollbar-thumb:hover": {
|
|
7637
|
+
backgroundColor: (theme) => theme.palette.grey[500]
|
|
7638
|
+
}
|
|
7639
|
+
},
|
|
7640
|
+
children: /* @__PURE__ */ jsx118(
|
|
7641
|
+
Table2,
|
|
7642
|
+
{
|
|
7643
|
+
stickyHeader: true,
|
|
7644
|
+
"aria-label": "sticky-table",
|
|
7645
|
+
sx: { tableLayout },
|
|
7646
|
+
children: visibleHeadCells.length === 0 ? /* @__PURE__ */ jsx118(TableDesktopNoColumnsMessage, {}) : /* @__PURE__ */ jsxs80(Fragment12, { children: [
|
|
7647
|
+
/* @__PURE__ */ jsx118(
|
|
7648
|
+
SmartTableHeader_default,
|
|
7649
|
+
{
|
|
7650
|
+
headCells: visibleHeadCells,
|
|
7651
|
+
order,
|
|
7652
|
+
orderBy,
|
|
7653
|
+
numSelected: selectedRows.size,
|
|
7654
|
+
numRows,
|
|
7655
|
+
enableCheckboxSelection,
|
|
7656
|
+
headerFilters: headerFilters ?? {},
|
|
7657
|
+
onRequestSort: handleRequestSort,
|
|
7658
|
+
onSelectAllClick: handleSelectAllClick,
|
|
7659
|
+
onApplyFilters,
|
|
7660
|
+
shouldShowCheckOnFilter
|
|
7661
|
+
}
|
|
7662
|
+
),
|
|
7663
|
+
/* @__PURE__ */ jsx118(TableBody3, { children: rowsPerPage !== emptyRows ? /* @__PURE__ */ jsx118(
|
|
7664
|
+
TableDesktopRows,
|
|
7665
|
+
{
|
|
7666
|
+
data,
|
|
7667
|
+
RenderItem,
|
|
7668
|
+
visibleHeadCells,
|
|
7669
|
+
keyField,
|
|
7670
|
+
order,
|
|
7671
|
+
orderBy,
|
|
7672
|
+
rowsPerPage,
|
|
7673
|
+
isLoading,
|
|
7674
|
+
disableInternalSort,
|
|
7675
|
+
enableCheckboxSelection,
|
|
7676
|
+
enableEditMode,
|
|
7677
|
+
selectedRows,
|
|
7678
|
+
handleRowCheckboxChange,
|
|
7679
|
+
rowHeight,
|
|
7680
|
+
deleteItem
|
|
7681
|
+
}
|
|
7682
|
+
) : /* @__PURE__ */ jsx118(
|
|
7683
|
+
TableEmptyResult_default,
|
|
7684
|
+
{
|
|
7685
|
+
colSpan: enableCheckboxSelection ? visibleHeadCells.length + 1 : visibleHeadCells.length,
|
|
7686
|
+
showClearFilterButton,
|
|
7687
|
+
handleClickOnClearFiltersButton
|
|
7688
|
+
}
|
|
7689
|
+
) })
|
|
7690
|
+
] })
|
|
7691
|
+
}
|
|
7692
|
+
)
|
|
7693
|
+
}
|
|
7694
|
+
),
|
|
7695
|
+
children,
|
|
7696
|
+
footerProps ? /* @__PURE__ */ jsx118(TableDesktopFooter, { ...footerProps, onPageChange: handlePageChange }) : null
|
|
7697
|
+
]
|
|
7698
|
+
}
|
|
7699
|
+
)
|
|
7700
|
+
}
|
|
7701
|
+
);
|
|
7487
7702
|
};
|
|
7488
|
-
var Table_default = Table2;
|
|
7489
7703
|
|
|
7490
|
-
// src/components/
|
|
7491
|
-
import
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7704
|
+
// src/components/TableDesktopEditableComponent/TableDesktopEditableComponent.tsx
|
|
7705
|
+
import { Checkbox as Checkbox6, FormControlLabel as FormControlLabel4 } from "@mui/material";
|
|
7706
|
+
|
|
7707
|
+
// src/components/TableDesktopEditableComponent/TableDesktopNumericField.tsx
|
|
7708
|
+
import { useState as useState18 } from "react";
|
|
7709
|
+
import { TextField as TextField8 } from "@mui/material";
|
|
7710
|
+
import { jsx as jsx119 } from "react/jsx-runtime";
|
|
7711
|
+
var TableDesktopNumericField = ({
|
|
7712
|
+
rowId,
|
|
7713
|
+
initialValue,
|
|
7714
|
+
inputLabel,
|
|
7715
|
+
disabled,
|
|
7716
|
+
field,
|
|
7717
|
+
variant = "standard",
|
|
7718
|
+
size,
|
|
7719
|
+
onUpdateEditableCell
|
|
7503
7720
|
}) => {
|
|
7504
|
-
|
|
7505
|
-
|
|
7721
|
+
const [input, setInput] = useState18(initialValue);
|
|
7722
|
+
const commitValue = (value) => {
|
|
7723
|
+
if (!onUpdateEditableCell) {
|
|
7724
|
+
return;
|
|
7725
|
+
}
|
|
7726
|
+
onUpdateEditableCell(rowId ?? 0, field, value, value);
|
|
7727
|
+
};
|
|
7728
|
+
const handleKeyDown = (e) => {
|
|
7729
|
+
if (e.key === "Enter") {
|
|
7730
|
+
e.preventDefault();
|
|
7731
|
+
commitValue(input);
|
|
7732
|
+
}
|
|
7733
|
+
};
|
|
7734
|
+
return /* @__PURE__ */ jsx119(
|
|
7735
|
+
TextField8,
|
|
7506
7736
|
{
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
color: colors.neutral800,
|
|
7527
|
-
borderColor: colors.neutral600
|
|
7528
|
-
},
|
|
7529
|
-
children: [
|
|
7530
|
-
/* @__PURE__ */ jsx115(
|
|
7531
|
-
Refresh3,
|
|
7532
|
-
{
|
|
7533
|
-
fontSize: "small",
|
|
7534
|
-
color: isFetching ? "disabled" : "primary"
|
|
7535
|
-
}
|
|
7536
|
-
),
|
|
7537
|
-
"REFRESH"
|
|
7538
|
-
]
|
|
7539
|
-
}
|
|
7540
|
-
),
|
|
7541
|
-
/* @__PURE__ */ jsxs79(Box32, { display: "flex", children: [
|
|
7542
|
-
/* @__PURE__ */ jsxs79(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [
|
|
7543
|
-
/* @__PURE__ */ jsx115(Typography28, { children: "Rows per page:" }),
|
|
7544
|
-
/* @__PURE__ */ jsx115(
|
|
7545
|
-
Select4,
|
|
7546
|
-
{
|
|
7547
|
-
value: pageSize,
|
|
7548
|
-
onChange: handlePageSizeChange,
|
|
7549
|
-
size: "small",
|
|
7550
|
-
variant: "standard",
|
|
7551
|
-
children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx115(MenuItem4, { value: size, children: size }, size))
|
|
7552
|
-
}
|
|
7553
|
-
)
|
|
7554
|
-
] }),
|
|
7555
|
-
/* @__PURE__ */ jsx115(
|
|
7556
|
-
Pagination2,
|
|
7557
|
-
{
|
|
7558
|
-
color: "standard",
|
|
7559
|
-
count: numPages,
|
|
7560
|
-
page,
|
|
7561
|
-
onChange: handlePageChange
|
|
7562
|
-
}
|
|
7563
|
-
)
|
|
7564
|
-
] })
|
|
7565
|
-
]
|
|
7737
|
+
fullWidth: true,
|
|
7738
|
+
variant,
|
|
7739
|
+
size,
|
|
7740
|
+
value: input,
|
|
7741
|
+
disabled,
|
|
7742
|
+
label: inputLabel,
|
|
7743
|
+
onKeyDown: handleKeyDown,
|
|
7744
|
+
onChange: (e) => {
|
|
7745
|
+
e.target.value = e.target.value.replace(/\D/g, "");
|
|
7746
|
+
setInput(e.target.value);
|
|
7747
|
+
},
|
|
7748
|
+
onBlur: ({ target: { value } }) => {
|
|
7749
|
+
commitValue(value);
|
|
7750
|
+
},
|
|
7751
|
+
slotProps: {
|
|
7752
|
+
input: {
|
|
7753
|
+
inputMode: "numeric"
|
|
7754
|
+
}
|
|
7755
|
+
}
|
|
7566
7756
|
}
|
|
7567
7757
|
);
|
|
7568
7758
|
};
|
|
7569
7759
|
|
|
7570
|
-
// src/components/
|
|
7571
|
-
import {
|
|
7572
|
-
import {
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7760
|
+
// src/components/TableDesktopEditableComponent/TableDesktopSmartSelect.tsx
|
|
7761
|
+
import { useState as useState19, memo as memo22, useEffect as useEffect12 } from "react";
|
|
7762
|
+
import { jsx as jsx120 } from "react/jsx-runtime";
|
|
7763
|
+
var resolveOptionType2 = (option, fieldName) => {
|
|
7764
|
+
if (!option || typeof option !== "object") {
|
|
7765
|
+
return option;
|
|
7766
|
+
}
|
|
7767
|
+
return option[fieldName] || "";
|
|
7768
|
+
};
|
|
7577
7769
|
var resolveValue = (value) => {
|
|
7578
7770
|
if (typeof value === "string") {
|
|
7579
7771
|
return value;
|
|
@@ -7584,28 +7776,31 @@ var TableDesktopSmartSelect = memo22(({
|
|
|
7584
7776
|
ref,
|
|
7585
7777
|
initialValue,
|
|
7586
7778
|
inputLabel,
|
|
7779
|
+
field,
|
|
7587
7780
|
fieldName,
|
|
7588
7781
|
rowId,
|
|
7589
7782
|
disabled,
|
|
7783
|
+
variant = "standard",
|
|
7784
|
+
size,
|
|
7590
7785
|
filterOptions,
|
|
7591
7786
|
refetchFilterOptions,
|
|
7592
7787
|
isFetchingFilterOptions,
|
|
7593
7788
|
onUpdateEditableCell
|
|
7594
7789
|
}) => {
|
|
7595
|
-
const [value, setValue] =
|
|
7596
|
-
const [options, setOptions] =
|
|
7790
|
+
const [value, setValue] = useState19(initialValue);
|
|
7791
|
+
const [options, setOptions] = useState19();
|
|
7597
7792
|
const valueId = resolveValue(value);
|
|
7598
|
-
const valueLabel =
|
|
7793
|
+
const valueLabel = resolveOptionType2(value, fieldName);
|
|
7599
7794
|
useEffect12(() => {
|
|
7600
7795
|
if (filterOptions) {
|
|
7601
7796
|
const parsedOptions = filterOptions?.map((option) => ({
|
|
7602
7797
|
value: resolveValue(option),
|
|
7603
|
-
label: String(
|
|
7798
|
+
label: String(resolveOptionType2(option, fieldName))
|
|
7604
7799
|
}));
|
|
7605
7800
|
setOptions(parsedOptions);
|
|
7606
7801
|
}
|
|
7607
7802
|
}, [filterOptions]);
|
|
7608
|
-
return /* @__PURE__ */
|
|
7803
|
+
return /* @__PURE__ */ jsx120(
|
|
7609
7804
|
SmartSelect_default,
|
|
7610
7805
|
{
|
|
7611
7806
|
ref,
|
|
@@ -7613,191 +7808,252 @@ var TableDesktopSmartSelect = memo22(({
|
|
|
7613
7808
|
inputLabel,
|
|
7614
7809
|
options,
|
|
7615
7810
|
disabled,
|
|
7811
|
+
variant,
|
|
7812
|
+
size,
|
|
7616
7813
|
refetch: refetchFilterOptions,
|
|
7617
7814
|
isFetching: isFetchingFilterOptions,
|
|
7618
7815
|
defaultOption: {
|
|
7619
7816
|
value: valueId ?? "",
|
|
7620
7817
|
label: String(valueLabel ?? "")
|
|
7621
7818
|
},
|
|
7622
|
-
onChange: ({ value:
|
|
7623
|
-
|
|
7624
|
-
|
|
7819
|
+
onChange: ({ value: id, label: name }) => {
|
|
7820
|
+
if (!id || !name) {
|
|
7821
|
+
return;
|
|
7822
|
+
}
|
|
7823
|
+
setValue({ id, name });
|
|
7824
|
+
if (!onUpdateEditableCell) {
|
|
7825
|
+
return;
|
|
7826
|
+
}
|
|
7827
|
+
onUpdateEditableCell(rowId ?? 0, field, id, name);
|
|
7625
7828
|
}
|
|
7626
7829
|
}
|
|
7627
7830
|
);
|
|
7628
7831
|
});
|
|
7629
7832
|
|
|
7630
|
-
// src/components/
|
|
7631
|
-
import
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
import TextField8 from "@mui/material/TextField";
|
|
7635
|
-
import { useMemo as useMemo4, useState as useState19 } from "react";
|
|
7636
|
-
import { jsx as jsx117 } from "react/jsx-runtime";
|
|
7833
|
+
// src/components/TableDesktopEditableComponent/TableDesktopTextField.tsx
|
|
7834
|
+
import { useMemo as useMemo4, useState as useState20 } from "react";
|
|
7835
|
+
import { TextField as TextField9 } from "@mui/material";
|
|
7836
|
+
import { jsx as jsx121 } from "react/jsx-runtime";
|
|
7637
7837
|
var TableDesktopTextField = ({
|
|
7638
7838
|
rowId,
|
|
7639
|
-
|
|
7839
|
+
initialValue,
|
|
7640
7840
|
inputLabel,
|
|
7641
7841
|
disabled,
|
|
7842
|
+
field,
|
|
7843
|
+
variant = "standard",
|
|
7844
|
+
size,
|
|
7642
7845
|
validateInput,
|
|
7643
7846
|
onUpdateEditableCell
|
|
7644
7847
|
}) => {
|
|
7645
|
-
const [
|
|
7646
|
-
const
|
|
7647
|
-
|
|
7648
|
-
|
|
7848
|
+
const [input, setInput] = useState20(initialValue);
|
|
7849
|
+
const hasValidationError = useMemo4(() => !validateInput?.(input), [input, validateInput]);
|
|
7850
|
+
const commitValue = (value) => {
|
|
7851
|
+
if (hasValidationError || !onUpdateEditableCell) {
|
|
7852
|
+
return;
|
|
7853
|
+
}
|
|
7854
|
+
onUpdateEditableCell(rowId ?? 0, field, value, value);
|
|
7855
|
+
};
|
|
7856
|
+
const handleKeyDown = (e) => {
|
|
7857
|
+
if (e.key === "Enter") {
|
|
7858
|
+
e.preventDefault();
|
|
7859
|
+
commitValue(input);
|
|
7860
|
+
}
|
|
7861
|
+
};
|
|
7862
|
+
return /* @__PURE__ */ jsx121(
|
|
7863
|
+
TextField9,
|
|
7649
7864
|
{
|
|
7650
7865
|
fullWidth: true,
|
|
7651
|
-
variant
|
|
7652
|
-
|
|
7866
|
+
variant,
|
|
7867
|
+
size,
|
|
7868
|
+
value: input,
|
|
7653
7869
|
label: inputLabel,
|
|
7654
|
-
error:
|
|
7870
|
+
error: hasValidationError,
|
|
7655
7871
|
disabled,
|
|
7656
|
-
|
|
7657
|
-
|
|
7872
|
+
onKeyDown: handleKeyDown,
|
|
7873
|
+
onChange: ({ target: { value } }) => {
|
|
7874
|
+
setInput(value);
|
|
7658
7875
|
},
|
|
7659
|
-
onBlur: ({ target: { value
|
|
7660
|
-
|
|
7661
|
-
return;
|
|
7662
|
-
}
|
|
7663
|
-
onUpdateEditableCell?.(rowId, value2);
|
|
7876
|
+
onBlur: ({ target: { value } }) => {
|
|
7877
|
+
commitValue(value);
|
|
7664
7878
|
}
|
|
7665
7879
|
}
|
|
7666
7880
|
);
|
|
7667
7881
|
};
|
|
7668
7882
|
|
|
7669
|
-
// src/components/
|
|
7670
|
-
import
|
|
7671
|
-
|
|
7672
|
-
import { jsx as jsx118, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
7673
|
-
var TableDesktopRowCell = ({
|
|
7674
|
-
inputLabel,
|
|
7883
|
+
// src/components/TableDesktopEditableComponent/TableDesktopEditableComponent.tsx
|
|
7884
|
+
import { jsx as jsx122 } from "react/jsx-runtime";
|
|
7885
|
+
var TableDesktopEditableComponent = ({
|
|
7675
7886
|
editInitialValue,
|
|
7676
7887
|
rowId,
|
|
7888
|
+
field,
|
|
7677
7889
|
fieldName,
|
|
7678
|
-
width,
|
|
7679
7890
|
disabled,
|
|
7680
|
-
|
|
7891
|
+
showCheckboxLabel = false,
|
|
7892
|
+
variant = "standard",
|
|
7893
|
+
size,
|
|
7894
|
+
inputLabel,
|
|
7681
7895
|
editableCellType,
|
|
7682
7896
|
filterOptions,
|
|
7683
7897
|
refetchFilterOptions,
|
|
7684
7898
|
isFetchingFilterOptions,
|
|
7685
7899
|
validateInput,
|
|
7686
|
-
onUpdateEditableCell
|
|
7687
|
-
onCellClick
|
|
7900
|
+
onUpdateEditableCell
|
|
7688
7901
|
}) => {
|
|
7689
|
-
const cellRef = useRef5(null);
|
|
7690
|
-
const [isOverflowed, setIsOverflowed] = useState20(false);
|
|
7691
|
-
const [isCellHovered, setIsCellHovered] = useState20(false);
|
|
7692
|
-
const [isEditMode, setIsEditMode] = useState20(false);
|
|
7693
|
-
useEffect13(() => {
|
|
7694
|
-
const ref = cellRef.current;
|
|
7695
|
-
if (ref) {
|
|
7696
|
-
setIsOverflowed(ref.scrollWidth > ref.clientWidth);
|
|
7697
|
-
}
|
|
7698
|
-
}, [readOnlyValue, width]);
|
|
7699
|
-
useEffect13(() => {
|
|
7700
|
-
const handleKeyDown = (e) => {
|
|
7701
|
-
if (e.key === "Escape") {
|
|
7702
|
-
setIsEditMode(false);
|
|
7703
|
-
}
|
|
7704
|
-
};
|
|
7705
|
-
if (isEditMode) {
|
|
7706
|
-
window.addEventListener("keydown", handleKeyDown);
|
|
7707
|
-
}
|
|
7708
|
-
return () => {
|
|
7709
|
-
window.removeEventListener("keydown", handleKeyDown);
|
|
7710
|
-
};
|
|
7711
|
-
}, [isEditMode]);
|
|
7712
7902
|
const editableComponents = {
|
|
7713
|
-
"select": /* @__PURE__ */
|
|
7903
|
+
"select": /* @__PURE__ */ jsx122(
|
|
7714
7904
|
TableDesktopSmartSelect,
|
|
7715
7905
|
{
|
|
7716
7906
|
rowId,
|
|
7907
|
+
field,
|
|
7717
7908
|
fieldName,
|
|
7718
7909
|
disabled,
|
|
7910
|
+
variant,
|
|
7911
|
+
size,
|
|
7719
7912
|
initialValue: editInitialValue,
|
|
7720
|
-
inputLabel
|
|
7913
|
+
inputLabel,
|
|
7721
7914
|
filterOptions,
|
|
7722
7915
|
refetchFilterOptions,
|
|
7723
7916
|
isFetchingFilterOptions,
|
|
7724
7917
|
onUpdateEditableCell
|
|
7725
7918
|
}
|
|
7726
7919
|
),
|
|
7727
|
-
"checkbox": /* @__PURE__ */
|
|
7728
|
-
|
|
7920
|
+
"checkbox": /* @__PURE__ */ jsx122(
|
|
7921
|
+
FormControlLabel4,
|
|
7729
7922
|
{
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7923
|
+
label: showCheckboxLabel ? inputLabel : "",
|
|
7924
|
+
control: /* @__PURE__ */ jsx122(
|
|
7925
|
+
Checkbox6,
|
|
7926
|
+
{
|
|
7927
|
+
disableRipple: true,
|
|
7928
|
+
disabled,
|
|
7929
|
+
defaultChecked: editInitialValue,
|
|
7930
|
+
onChange: ({ target: { checked } }) => {
|
|
7931
|
+
if (!onUpdateEditableCell) {
|
|
7932
|
+
return;
|
|
7933
|
+
}
|
|
7934
|
+
onUpdateEditableCell(rowId ?? 0, field, checked, checked);
|
|
7935
|
+
}
|
|
7936
|
+
}
|
|
7937
|
+
)
|
|
7736
7938
|
}
|
|
7737
7939
|
),
|
|
7738
|
-
"text": /* @__PURE__ */
|
|
7940
|
+
"text": /* @__PURE__ */ jsx122(
|
|
7739
7941
|
TableDesktopTextField,
|
|
7740
7942
|
{
|
|
7741
7943
|
rowId,
|
|
7742
7944
|
disabled,
|
|
7743
|
-
|
|
7945
|
+
variant,
|
|
7946
|
+
size,
|
|
7947
|
+
field,
|
|
7948
|
+
initialValue: editInitialValue,
|
|
7744
7949
|
inputLabel: inputLabel ?? "",
|
|
7745
7950
|
validateInput,
|
|
7746
7951
|
onUpdateEditableCell
|
|
7747
7952
|
}
|
|
7748
7953
|
),
|
|
7749
|
-
"numeric": /* @__PURE__ */
|
|
7750
|
-
|
|
7954
|
+
"numeric": /* @__PURE__ */ jsx122(
|
|
7955
|
+
TableDesktopNumericField,
|
|
7751
7956
|
{
|
|
7752
|
-
|
|
7753
|
-
variant: "standard",
|
|
7957
|
+
rowId,
|
|
7754
7958
|
disabled,
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
onUpdateEditableCell?.(rowId, value);
|
|
7762
|
-
},
|
|
7763
|
-
slotProps: {
|
|
7764
|
-
input: {
|
|
7765
|
-
inputMode: "numeric"
|
|
7766
|
-
}
|
|
7767
|
-
}
|
|
7959
|
+
variant,
|
|
7960
|
+
size,
|
|
7961
|
+
field,
|
|
7962
|
+
initialValue: editInitialValue,
|
|
7963
|
+
inputLabel: inputLabel ?? "",
|
|
7964
|
+
onUpdateEditableCell
|
|
7768
7965
|
}
|
|
7769
7966
|
)
|
|
7770
7967
|
};
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7968
|
+
return editableComponents[editableCellType];
|
|
7969
|
+
};
|
|
7970
|
+
|
|
7971
|
+
// src/components/TableDesktopCell/TableDesktopCell.tsx
|
|
7972
|
+
import { useEffect as useEffect13, useRef as useRef5, useState as useState21 } from "react";
|
|
7973
|
+
import CheckIcon2 from "@mui/icons-material/Check";
|
|
7974
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
7975
|
+
import EditIcon from "@mui/icons-material/Edit";
|
|
7976
|
+
import { Box as Box35, IconButton as IconButton4, TableCell as TableCell6, Tooltip as Tooltip8 } from "@mui/material";
|
|
7977
|
+
import { jsx as jsx123, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
7978
|
+
var getReadOnlyBooleanIcon = (value) => {
|
|
7979
|
+
if (value) {
|
|
7980
|
+
return /* @__PURE__ */ jsx123(CheckIcon2, { sx: { fontSize: 16 } });
|
|
7981
|
+
}
|
|
7982
|
+
return "-";
|
|
7983
|
+
};
|
|
7984
|
+
var renderReadOnlyValue = (value) => {
|
|
7985
|
+
if (typeof value === "boolean") {
|
|
7986
|
+
return getReadOnlyBooleanIcon(value);
|
|
7987
|
+
}
|
|
7988
|
+
return value;
|
|
7989
|
+
};
|
|
7990
|
+
var getCellBackgroundColor = (isCellInEditMode) => ({
|
|
7991
|
+
background: isCellInEditMode ? colors.lightBlueBackground : colors.neutral100
|
|
7992
|
+
});
|
|
7993
|
+
var TableDesktopCell = ({
|
|
7994
|
+
inputLabel,
|
|
7995
|
+
editInitialValue,
|
|
7996
|
+
rowId,
|
|
7997
|
+
field,
|
|
7998
|
+
fieldName,
|
|
7999
|
+
width,
|
|
8000
|
+
enableEditMode,
|
|
8001
|
+
disabled,
|
|
8002
|
+
readOnlyValue,
|
|
8003
|
+
editableCellType,
|
|
8004
|
+
filterOptions,
|
|
8005
|
+
refetchFilterOptions,
|
|
8006
|
+
isFetchingFilterOptions,
|
|
8007
|
+
validateInput,
|
|
8008
|
+
onUpdateEditableCell,
|
|
8009
|
+
onCellClick
|
|
8010
|
+
}) => {
|
|
8011
|
+
const cellRef = useRef5(null);
|
|
8012
|
+
const [isOverflowed, setIsOverflowed] = useState21(false);
|
|
8013
|
+
const [isCellHovered, setIsCellHovered] = useState21(false);
|
|
8014
|
+
const [isCellInEditMode, setIsCellInEditMode] = useState21(false);
|
|
8015
|
+
useEffect13(() => {
|
|
8016
|
+
const ref = cellRef.current;
|
|
8017
|
+
if (ref) {
|
|
8018
|
+
setIsOverflowed(ref.scrollWidth > ref.clientWidth);
|
|
7774
8019
|
}
|
|
7775
|
-
|
|
7776
|
-
|
|
8020
|
+
}, [readOnlyValue, width]);
|
|
8021
|
+
useEffect13(() => {
|
|
8022
|
+
const handleKeyDown = (e) => {
|
|
8023
|
+
if (e.key === "Escape") {
|
|
8024
|
+
setIsCellInEditMode(false);
|
|
8025
|
+
}
|
|
8026
|
+
};
|
|
8027
|
+
if (isCellInEditMode) {
|
|
8028
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
8029
|
+
}
|
|
8030
|
+
return () => {
|
|
8031
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
8032
|
+
};
|
|
8033
|
+
}, [isCellInEditMode]);
|
|
7777
8034
|
const handleEditClick = (e) => {
|
|
7778
8035
|
e.stopPropagation();
|
|
7779
|
-
|
|
8036
|
+
setIsCellInEditMode((prev) => !prev);
|
|
7780
8037
|
};
|
|
7781
|
-
|
|
8038
|
+
const isCellEditable = !!enableEditMode && !!editableCellType && !disabled;
|
|
8039
|
+
return /* @__PURE__ */ jsx123(Tooltip8, { title: isOverflowed ? String(readOnlyValue) : "", arrow: true, children: /* @__PURE__ */ jsx123(
|
|
7782
8040
|
TableCell6,
|
|
7783
8041
|
{
|
|
7784
8042
|
align: "left",
|
|
7785
|
-
onMouseEnter: () =>
|
|
7786
|
-
onMouseLeave: () =>
|
|
7787
|
-
onClick: (event) => !disabled && onCellClick?.(event,
|
|
8043
|
+
onMouseEnter: () => isCellEditable && setIsCellHovered(true),
|
|
8044
|
+
onMouseLeave: () => isCellEditable && setIsCellHovered(false),
|
|
8045
|
+
onClick: (event) => !disabled && onCellClick?.(event, isCellInEditMode),
|
|
7788
8046
|
sx: {
|
|
7789
8047
|
padding: 1,
|
|
7790
8048
|
width: width ?? "auto",
|
|
7791
8049
|
position: "relative",
|
|
7792
|
-
cursor: disabled ? "default" : "pointer",
|
|
8050
|
+
cursor: disabled || !enableEditMode ? "default" : "pointer",
|
|
7793
8051
|
opacity: disabled ? 0.2 : 1,
|
|
7794
|
-
":hover":
|
|
7795
|
-
|
|
7796
|
-
},
|
|
7797
|
-
background: isEditMode ? colors.lightBlueBackground : (theme) => theme.palette.background.default
|
|
8052
|
+
":hover": isCellEditable ? getCellBackgroundColor(isCellInEditMode) : void 0,
|
|
8053
|
+
background: enableEditMode && isCellInEditMode ? colors.lightBlueBackground : void 0
|
|
7798
8054
|
},
|
|
7799
|
-
children: /* @__PURE__ */
|
|
7800
|
-
|
|
8055
|
+
children: /* @__PURE__ */ jsxs81(
|
|
8056
|
+
Box35,
|
|
7801
8057
|
{
|
|
7802
8058
|
p: 1,
|
|
7803
8059
|
ref: cellRef,
|
|
@@ -7805,7 +8061,7 @@ var TableDesktopRowCell = ({
|
|
|
7805
8061
|
textOverflow: "ellipsis",
|
|
7806
8062
|
whiteSpace: "nowrap",
|
|
7807
8063
|
children: [
|
|
7808
|
-
isCellHovered ? /* @__PURE__ */
|
|
8064
|
+
enableEditMode && isCellHovered ? /* @__PURE__ */ jsx123(Tooltip8, { title: isCellInEditMode ? "" : "Toggle Edit Mode", children: /* @__PURE__ */ jsx123(
|
|
7809
8065
|
IconButton4,
|
|
7810
8066
|
{
|
|
7811
8067
|
onClick: handleEditClick,
|
|
@@ -7815,15 +8071,31 @@ var TableDesktopRowCell = ({
|
|
|
7815
8071
|
zIndex: 1,
|
|
7816
8072
|
borderRadius: 0,
|
|
7817
8073
|
position: "absolute",
|
|
7818
|
-
background:
|
|
8074
|
+
background: isCellInEditMode ? colors.lightBlueBackground : colors.neutral100,
|
|
7819
8075
|
"&:hover": {
|
|
7820
|
-
backgroundColor:
|
|
8076
|
+
backgroundColor: isCellInEditMode ? colors.lightBlueBackground : colors.neutral150
|
|
7821
8077
|
}
|
|
7822
8078
|
},
|
|
7823
|
-
children:
|
|
8079
|
+
children: isCellInEditMode ? /* @__PURE__ */ jsx123(CloseIcon, { fontSize: "small", color: "error" }) : /* @__PURE__ */ jsx123(EditIcon, { fontSize: "small" })
|
|
7824
8080
|
}
|
|
7825
8081
|
) }) : null,
|
|
7826
|
-
|
|
8082
|
+
enableEditMode && isCellInEditMode && editableCellType ? /* @__PURE__ */ jsx123(
|
|
8083
|
+
TableDesktopEditableComponent,
|
|
8084
|
+
{
|
|
8085
|
+
editInitialValue,
|
|
8086
|
+
rowId,
|
|
8087
|
+
field,
|
|
8088
|
+
fieldName,
|
|
8089
|
+
disabled,
|
|
8090
|
+
inputLabel: inputLabel ?? "",
|
|
8091
|
+
editableCellType,
|
|
8092
|
+
filterOptions,
|
|
8093
|
+
refetchFilterOptions,
|
|
8094
|
+
isFetchingFilterOptions,
|
|
8095
|
+
validateInput,
|
|
8096
|
+
onUpdateEditableCell
|
|
8097
|
+
}
|
|
8098
|
+
) : renderReadOnlyValue(readOnlyValue)
|
|
7827
8099
|
]
|
|
7828
8100
|
}
|
|
7829
8101
|
)
|
|
@@ -7832,12 +8104,12 @@ var TableDesktopRowCell = ({
|
|
|
7832
8104
|
};
|
|
7833
8105
|
|
|
7834
8106
|
// src/components/TableHeader/TableHeader.tsx
|
|
7835
|
-
import { memo as memo23, useEffect as useEffect14, useState as
|
|
8107
|
+
import { memo as memo23, useEffect as useEffect14, useState as useState22 } from "react";
|
|
7836
8108
|
import { ImportExport as ImportExportIcon } from "@mui/icons-material";
|
|
7837
8109
|
import { TableCell as TableCell7, TableHead as TableHead3, TableRow as TableRow6, TableSortLabel as TableSortLabel3 } from "@mui/material";
|
|
7838
|
-
import { makeStyles as
|
|
7839
|
-
import { jsx as
|
|
7840
|
-
var
|
|
8110
|
+
import { makeStyles as makeStyles49 } from "tss-react/mui";
|
|
8111
|
+
import { jsx as jsx124 } from "react/jsx-runtime";
|
|
8112
|
+
var useStyles49 = makeStyles49()(() => ({
|
|
7841
8113
|
sortLabel: {
|
|
7842
8114
|
"& .MuiTableSortLabel-icon": {
|
|
7843
8115
|
opacity: 1
|
|
@@ -7845,8 +8117,8 @@ var useStyles50 = makeStyles50()(() => ({
|
|
|
7845
8117
|
}
|
|
7846
8118
|
}));
|
|
7847
8119
|
var TableHeader = ({ cells, onSort = null }) => {
|
|
7848
|
-
const [sortableCells, setSortableCells] =
|
|
7849
|
-
const { classes } =
|
|
8120
|
+
const [sortableCells, setSortableCells] = useState22([]);
|
|
8121
|
+
const { classes } = useStyles49();
|
|
7850
8122
|
useEffect14(() => {
|
|
7851
8123
|
setSortableCells(cells);
|
|
7852
8124
|
}, []);
|
|
@@ -7881,7 +8153,7 @@ var TableHeader = ({ cells, onSort = null }) => {
|
|
|
7881
8153
|
});
|
|
7882
8154
|
setSortableCells(sortedCells);
|
|
7883
8155
|
};
|
|
7884
|
-
return /* @__PURE__ */
|
|
8156
|
+
return /* @__PURE__ */ jsx124(TableHead3, { children: /* @__PURE__ */ jsx124(TableRow6, { children: sortableCells.map((cell, key) => /* @__PURE__ */ jsx124(TableCell7, { children: cell.isSortable ? /* @__PURE__ */ jsx124(
|
|
7885
8157
|
TableSortLabel3,
|
|
7886
8158
|
{
|
|
7887
8159
|
className: classes.sortLabel,
|
|
@@ -7895,10 +8167,10 @@ var TableHeader = ({ cells, onSort = null }) => {
|
|
|
7895
8167
|
var TableHeader_default = memo23(TableHeader);
|
|
7896
8168
|
|
|
7897
8169
|
// src/components/TextDivider/TextDivider.tsx
|
|
7898
|
-
import { Box as
|
|
7899
|
-
import { makeStyles as
|
|
7900
|
-
import { jsx as
|
|
7901
|
-
var
|
|
8170
|
+
import { Box as Box36, Typography as Typography30, Divider as Divider10, Button as Button15 } from "@mui/material";
|
|
8171
|
+
import { makeStyles as makeStyles50 } from "tss-react/mui";
|
|
8172
|
+
import { jsx as jsx125, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
8173
|
+
var useStyles50 = makeStyles50()(() => ({
|
|
7902
8174
|
icon: {
|
|
7903
8175
|
fontSize: 20
|
|
7904
8176
|
},
|
|
@@ -7932,21 +8204,21 @@ var TextDivider = ({
|
|
|
7932
8204
|
iconPosition = "left",
|
|
7933
8205
|
titleWeight = "400"
|
|
7934
8206
|
}) => {
|
|
7935
|
-
const { classes } =
|
|
8207
|
+
const { classes } = useStyles50();
|
|
7936
8208
|
const iconColor = color ?? colors.neutral900;
|
|
7937
|
-
return /* @__PURE__ */
|
|
7938
|
-
|
|
8209
|
+
return /* @__PURE__ */ jsxs82(
|
|
8210
|
+
Box36,
|
|
7939
8211
|
{
|
|
7940
8212
|
display: "flex",
|
|
7941
8213
|
alignItems: "center",
|
|
7942
8214
|
justifyContent: "space-between",
|
|
7943
8215
|
className: classes.container,
|
|
7944
8216
|
children: [
|
|
7945
|
-
/* @__PURE__ */
|
|
7946
|
-
/* @__PURE__ */
|
|
7947
|
-
Icon2 && iconPosition === "left" && /* @__PURE__ */
|
|
7948
|
-
/* @__PURE__ */
|
|
7949
|
-
|
|
8217
|
+
/* @__PURE__ */ jsx125(Divider10, { className: classes.leftDivider }),
|
|
8218
|
+
/* @__PURE__ */ jsx125(Button15, { onClick, disabled: !onClick, className: classes.button, children: /* @__PURE__ */ jsxs82(Box36, { className: classes.center, children: [
|
|
8219
|
+
Icon2 && iconPosition === "left" && /* @__PURE__ */ jsx125(Icon2, { className: classes.icon, style: { color: iconColor } }),
|
|
8220
|
+
/* @__PURE__ */ jsx125(
|
|
8221
|
+
Typography30,
|
|
7950
8222
|
{
|
|
7951
8223
|
color: "textSecondary",
|
|
7952
8224
|
className: classes.title,
|
|
@@ -7954,9 +8226,9 @@ var TextDivider = ({
|
|
|
7954
8226
|
children: title
|
|
7955
8227
|
}
|
|
7956
8228
|
),
|
|
7957
|
-
Icon2 && iconPosition === "right" && /* @__PURE__ */
|
|
8229
|
+
Icon2 && iconPosition === "right" && /* @__PURE__ */ jsx125(Icon2, { className: classes.icon, style: { color: iconColor } })
|
|
7958
8230
|
] }) }),
|
|
7959
|
-
/* @__PURE__ */
|
|
8231
|
+
/* @__PURE__ */ jsx125(Divider10, { className: classes.rightDivider })
|
|
7960
8232
|
]
|
|
7961
8233
|
}
|
|
7962
8234
|
);
|
|
@@ -7965,11 +8237,11 @@ var TextDivider_default = TextDivider;
|
|
|
7965
8237
|
|
|
7966
8238
|
// src/components/ThemedDateRangePicker/ThemedDateRangePicker.tsx
|
|
7967
8239
|
import { DateRangePicker } from "react-dates";
|
|
7968
|
-
import { makeStyles as
|
|
8240
|
+
import { makeStyles as makeStyles51 } from "tss-react/mui";
|
|
7969
8241
|
import "react-dates/initialize";
|
|
7970
8242
|
import "react-dates/lib/css/_datepicker.css";
|
|
7971
|
-
import { jsx as
|
|
7972
|
-
var
|
|
8243
|
+
import { jsx as jsx126 } from "react/jsx-runtime";
|
|
8244
|
+
var useStyles51 = makeStyles51()((theme) => ({
|
|
7973
8245
|
wrapper: {
|
|
7974
8246
|
"& .DateRangePicker": {
|
|
7975
8247
|
backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[900] : colors.neutral100,
|
|
@@ -8063,17 +8335,17 @@ var ThemedDateRangePicker = ({
|
|
|
8063
8335
|
className,
|
|
8064
8336
|
...props
|
|
8065
8337
|
}) => {
|
|
8066
|
-
const { classes, cx } =
|
|
8067
|
-
return /* @__PURE__ */
|
|
8338
|
+
const { classes, cx } = useStyles51();
|
|
8339
|
+
return /* @__PURE__ */ jsx126("div", { className: cx(classes.wrapper, className), children: /* @__PURE__ */ jsx126(DateRangePicker, { ...props }) });
|
|
8068
8340
|
};
|
|
8069
8341
|
var ThemedDateRangePicker_default = ThemedDateRangePicker;
|
|
8070
8342
|
|
|
8071
8343
|
// src/components/TheToolbar/TheToolbar.tsx
|
|
8072
8344
|
import { memo as memo24 } from "react";
|
|
8073
|
-
import { AppBar, Box as
|
|
8074
|
-
import { makeStyles as
|
|
8075
|
-
import { jsx as
|
|
8076
|
-
var
|
|
8345
|
+
import { AppBar, Box as Box37, Toolbar } from "@mui/material";
|
|
8346
|
+
import { makeStyles as makeStyles52 } from "tss-react/mui";
|
|
8347
|
+
import { jsx as jsx127, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
8348
|
+
var useStyles52 = makeStyles52()((theme) => ({
|
|
8077
8349
|
menuButton: {
|
|
8078
8350
|
color: theme.palette.primary.contrastText
|
|
8079
8351
|
},
|
|
@@ -8091,10 +8363,10 @@ var TheToolbar = ({
|
|
|
8091
8363
|
leftSection,
|
|
8092
8364
|
rightSection
|
|
8093
8365
|
}) => {
|
|
8094
|
-
const { classes } =
|
|
8095
|
-
return /* @__PURE__ */
|
|
8096
|
-
/* @__PURE__ */
|
|
8097
|
-
/* @__PURE__ */
|
|
8366
|
+
const { classes } = useStyles52();
|
|
8367
|
+
return /* @__PURE__ */ jsxs83(Box37, { children: [
|
|
8368
|
+
/* @__PURE__ */ jsx127(AppBar, { children: /* @__PURE__ */ jsxs83(Toolbar, { className: classes.topBar, children: [
|
|
8369
|
+
/* @__PURE__ */ jsx127(
|
|
8098
8370
|
RoundButton_default,
|
|
8099
8371
|
{
|
|
8100
8372
|
className: classes.menuButton,
|
|
@@ -8103,7 +8375,7 @@ var TheToolbar = ({
|
|
|
8103
8375
|
onClick: handleOpen
|
|
8104
8376
|
}
|
|
8105
8377
|
),
|
|
8106
|
-
/* @__PURE__ */
|
|
8378
|
+
/* @__PURE__ */ jsx127(
|
|
8107
8379
|
CompanyLogo_default,
|
|
8108
8380
|
{
|
|
8109
8381
|
size: "small",
|
|
@@ -8112,8 +8384,8 @@ var TheToolbar = ({
|
|
|
8112
8384
|
imageLogoLightSmall
|
|
8113
8385
|
}
|
|
8114
8386
|
),
|
|
8115
|
-
/* @__PURE__ */
|
|
8116
|
-
/* @__PURE__ */
|
|
8387
|
+
/* @__PURE__ */ jsx127(Box37, { ml: 2, children: leftSection }),
|
|
8388
|
+
/* @__PURE__ */ jsx127(Box37, { ml: "auto", children: rightSection })
|
|
8117
8389
|
] }) }),
|
|
8118
8390
|
LeftDrawer
|
|
8119
8391
|
] });
|
|
@@ -8122,20 +8394,20 @@ var TheToolbar_default = memo24(TheToolbar);
|
|
|
8122
8394
|
|
|
8123
8395
|
// src/components/ToastMessage/ToastMessage.tsx
|
|
8124
8396
|
import { Alert as MuiAlert, Snackbar } from "@mui/material";
|
|
8125
|
-
import { jsx as
|
|
8397
|
+
import { jsx as jsx128 } from "react/jsx-runtime";
|
|
8126
8398
|
var ToastMessage = ({
|
|
8127
8399
|
toastType,
|
|
8128
8400
|
toastMessage,
|
|
8129
8401
|
open,
|
|
8130
8402
|
onClose
|
|
8131
|
-
}) => /* @__PURE__ */
|
|
8403
|
+
}) => /* @__PURE__ */ jsx128(
|
|
8132
8404
|
Snackbar,
|
|
8133
8405
|
{
|
|
8134
8406
|
open,
|
|
8135
8407
|
autoHideDuration: 1500,
|
|
8136
8408
|
onClose,
|
|
8137
8409
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
8138
|
-
children: /* @__PURE__ */
|
|
8410
|
+
children: /* @__PURE__ */ jsx128(
|
|
8139
8411
|
MuiAlert,
|
|
8140
8412
|
{
|
|
8141
8413
|
elevation: 6,
|
|
@@ -8163,17 +8435,17 @@ var ToastMessage_default = ToastMessage;
|
|
|
8163
8435
|
|
|
8164
8436
|
// src/components/TwoButtonDialog/TwoButtonDialog.tsx
|
|
8165
8437
|
import {
|
|
8166
|
-
Typography as
|
|
8438
|
+
Typography as Typography31,
|
|
8167
8439
|
Dialog as Dialog5,
|
|
8168
8440
|
Backdrop,
|
|
8169
|
-
Box as
|
|
8441
|
+
Box as Box38,
|
|
8170
8442
|
Divider as Divider11,
|
|
8171
8443
|
Paper as Paper12,
|
|
8172
8444
|
Fade as Fade2
|
|
8173
8445
|
} from "@mui/material";
|
|
8174
|
-
import { makeStyles as
|
|
8175
|
-
import { jsx as
|
|
8176
|
-
var
|
|
8446
|
+
import { makeStyles as makeStyles53 } from "tss-react/mui";
|
|
8447
|
+
import { jsx as jsx129, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
8448
|
+
var useStyles53 = makeStyles53()((theme) => ({
|
|
8177
8449
|
paper: {
|
|
8178
8450
|
padding: theme.spacing(2)
|
|
8179
8451
|
},
|
|
@@ -8201,8 +8473,8 @@ var TwoButtonDialog = ({
|
|
|
8201
8473
|
cancelLabel = "CANCEL",
|
|
8202
8474
|
cancelButton
|
|
8203
8475
|
}) => {
|
|
8204
|
-
const { classes } =
|
|
8205
|
-
return /* @__PURE__ */
|
|
8476
|
+
const { classes } = useStyles53();
|
|
8477
|
+
return /* @__PURE__ */ jsx129(
|
|
8206
8478
|
Dialog5,
|
|
8207
8479
|
{
|
|
8208
8480
|
open,
|
|
@@ -8212,10 +8484,10 @@ var TwoButtonDialog = ({
|
|
|
8212
8484
|
closeAfterTransition: true,
|
|
8213
8485
|
BackdropComponent: Backdrop,
|
|
8214
8486
|
BackdropProps: { timeout: 500 },
|
|
8215
|
-
children: /* @__PURE__ */
|
|
8216
|
-
/* @__PURE__ */
|
|
8217
|
-
/* @__PURE__ */
|
|
8218
|
-
|
|
8487
|
+
children: /* @__PURE__ */ jsx129(Fade2, { in: open, children: /* @__PURE__ */ jsxs84(Paper12, { className: classes.paper, children: [
|
|
8488
|
+
/* @__PURE__ */ jsxs84(Box38, { className: classes.mb, children: [
|
|
8489
|
+
/* @__PURE__ */ jsx129(Typography31, { variant: "h5", component: "div", children: /* @__PURE__ */ jsx129(
|
|
8490
|
+
Box38,
|
|
8219
8491
|
{
|
|
8220
8492
|
sx: {
|
|
8221
8493
|
fontWeight: 600
|
|
@@ -8223,23 +8495,23 @@ var TwoButtonDialog = ({
|
|
|
8223
8495
|
children: title
|
|
8224
8496
|
}
|
|
8225
8497
|
) }),
|
|
8226
|
-
/* @__PURE__ */
|
|
8227
|
-
|
|
8498
|
+
/* @__PURE__ */ jsxs84(
|
|
8499
|
+
Box38,
|
|
8228
8500
|
{
|
|
8229
8501
|
className: classes.mt,
|
|
8230
8502
|
sx: {
|
|
8231
8503
|
fontWeight: 600
|
|
8232
8504
|
},
|
|
8233
8505
|
children: [
|
|
8234
|
-
subtitle1 && /* @__PURE__ */
|
|
8235
|
-
subtitle2 && /* @__PURE__ */
|
|
8506
|
+
subtitle1 && /* @__PURE__ */ jsx129(Typography31, { variant: "subtitle1", children: subtitle1 }),
|
|
8507
|
+
subtitle2 && /* @__PURE__ */ jsx129(Typography31, { variant: "subtitle1", children: subtitle2 })
|
|
8236
8508
|
]
|
|
8237
8509
|
}
|
|
8238
8510
|
)
|
|
8239
8511
|
] }),
|
|
8240
|
-
/* @__PURE__ */
|
|
8241
|
-
/* @__PURE__ */
|
|
8242
|
-
/* @__PURE__ */
|
|
8512
|
+
/* @__PURE__ */ jsx129(Divider11, {}),
|
|
8513
|
+
/* @__PURE__ */ jsxs84(Box38, { className: classes.buttonContainer, children: [
|
|
8514
|
+
/* @__PURE__ */ jsx129(
|
|
8243
8515
|
FilledButton_default,
|
|
8244
8516
|
{
|
|
8245
8517
|
copy: cancelLabel,
|
|
@@ -8252,7 +8524,7 @@ var TwoButtonDialog = ({
|
|
|
8252
8524
|
}
|
|
8253
8525
|
}
|
|
8254
8526
|
),
|
|
8255
|
-
/* @__PURE__ */
|
|
8527
|
+
/* @__PURE__ */ jsx129(
|
|
8256
8528
|
FilledButton_default,
|
|
8257
8529
|
{
|
|
8258
8530
|
color: "primary",
|
|
@@ -8261,7 +8533,7 @@ var TwoButtonDialog = ({
|
|
|
8261
8533
|
}
|
|
8262
8534
|
)
|
|
8263
8535
|
] }),
|
|
8264
|
-
/* @__PURE__ */
|
|
8536
|
+
/* @__PURE__ */ jsx129(Loading_default, { isLoading: dialogLoading })
|
|
8265
8537
|
] }) })
|
|
8266
8538
|
}
|
|
8267
8539
|
);
|
|
@@ -8270,10 +8542,10 @@ var TwoButtonDialog_default = TwoButtonDialog;
|
|
|
8270
8542
|
|
|
8271
8543
|
// src/components/UserBust/UserBust.tsx
|
|
8272
8544
|
import { memo as memo25 } from "react";
|
|
8273
|
-
import { Avatar as Avatar2, Typography as
|
|
8274
|
-
import { jsx as
|
|
8275
|
-
var UserBust = ({ user, avatarProps, typographyProps }) => /* @__PURE__ */
|
|
8276
|
-
/* @__PURE__ */
|
|
8545
|
+
import { Avatar as Avatar2, Typography as Typography32 } from "@mui/material";
|
|
8546
|
+
import { jsx as jsx130, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
8547
|
+
var UserBust = ({ user, avatarProps, typographyProps }) => /* @__PURE__ */ jsxs85("div", { children: [
|
|
8548
|
+
/* @__PURE__ */ jsx130(
|
|
8277
8549
|
Avatar2,
|
|
8278
8550
|
{
|
|
8279
8551
|
src: user.profile_picture,
|
|
@@ -8281,18 +8553,18 @@ var UserBust = ({ user, avatarProps, typographyProps }) => /* @__PURE__ */ jsxs8
|
|
|
8281
8553
|
style: { width: avatarProps.width, height: avatarProps.height }
|
|
8282
8554
|
}
|
|
8283
8555
|
),
|
|
8284
|
-
/* @__PURE__ */
|
|
8285
|
-
/* @__PURE__ */
|
|
8286
|
-
/* @__PURE__ */
|
|
8556
|
+
/* @__PURE__ */ jsxs85("div", { style: { paddingTop: 16 }, children: [
|
|
8557
|
+
/* @__PURE__ */ jsx130(Typography32, { ...typographyProps.name, children: `${user.first_name} ${user.last_name}` }),
|
|
8558
|
+
/* @__PURE__ */ jsx130(Typography32, { ...typographyProps.username, children: user.username })
|
|
8287
8559
|
] })
|
|
8288
8560
|
] });
|
|
8289
8561
|
var UserBust_default = memo25(UserBust);
|
|
8290
8562
|
|
|
8291
8563
|
// src/components/icons/IconChart.tsx
|
|
8292
|
-
import { jsx as
|
|
8564
|
+
import { jsx as jsx131 } from "react/jsx-runtime";
|
|
8293
8565
|
var SvgIconChart = (props) => {
|
|
8294
8566
|
const { fill } = props;
|
|
8295
|
-
return /* @__PURE__ */
|
|
8567
|
+
return /* @__PURE__ */ jsx131(
|
|
8296
8568
|
"svg",
|
|
8297
8569
|
{
|
|
8298
8570
|
width: "20",
|
|
@@ -8301,7 +8573,7 @@ var SvgIconChart = (props) => {
|
|
|
8301
8573
|
fill: "none",
|
|
8302
8574
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8303
8575
|
...props,
|
|
8304
|
-
children: /* @__PURE__ */
|
|
8576
|
+
children: /* @__PURE__ */ jsx131(
|
|
8305
8577
|
"path",
|
|
8306
8578
|
{
|
|
8307
8579
|
d: "M2.49967 11.6667L2.91634 11.725L6.72467 7.91667C6.57467 7.375 6.71634 6.75833 7.15801 6.325C7.80801 5.66667 8.85801 5.66667 9.50801 6.325C9.94967 6.75833 10.0913 7.375 9.94134 7.91667L12.083 10.0583L12.4997 10C12.6497 10 12.7913 10 12.9163 10.0583L15.8913 7.08333C15.833 6.95833 15.833 6.81667 15.833 6.66667C15.833 6.22464 16.0086 5.80072 16.3212 5.48816C16.6337 5.17559 17.0576 5 17.4997 5C17.9417 5 18.3656 5.17559 18.6782 5.48816C18.9907 5.80072 19.1663 6.22464 19.1663 6.66667C19.1663 7.10869 18.9907 7.53262 18.6782 7.84518C18.3656 8.15774 17.9417 8.33333 17.4997 8.33333C17.3497 8.33333 17.208 8.33333 17.083 8.275L14.108 11.25C14.1663 11.375 14.1663 11.5167 14.1663 11.6667C14.1663 12.1087 13.9907 12.5326 13.6782 12.8452C13.3656 13.1577 12.9417 13.3333 12.4997 13.3333C12.0576 13.3333 11.6337 13.1577 11.3212 12.8452C11.0086 12.5326 10.833 12.1087 10.833 11.6667L10.8913 11.25L8.74967 9.10833C8.48301 9.16667 8.18301 9.16667 7.91634 9.10833L4.10801 12.9167L4.16634 13.3333C4.16634 13.7754 3.99075 14.1993 3.67819 14.5118C3.36563 14.8244 2.9417 15 2.49967 15C2.05765 15 1.63372 14.8244 1.32116 14.5118C1.0086 14.1993 0.833008 13.7754 0.833008 13.3333C0.833008 12.8913 1.0086 12.4674 1.32116 12.1548C1.63372 11.8423 2.05765 11.6667 2.49967 11.6667Z",
|
|
@@ -8378,10 +8650,10 @@ export {
|
|
|
8378
8650
|
SquareLabel_default as SquareLabel,
|
|
8379
8651
|
Switch_default as Switch,
|
|
8380
8652
|
Table_default as Table,
|
|
8381
|
-
|
|
8653
|
+
TableDesktop,
|
|
8654
|
+
TableDesktopCell,
|
|
8655
|
+
TableDesktopEditableComponent,
|
|
8382
8656
|
TableDesktopFooter,
|
|
8383
|
-
TableDesktopRowCell,
|
|
8384
|
-
TableDesktopSmartSelect,
|
|
8385
8657
|
TableEmptyResult_default as TableEmptyResult,
|
|
8386
8658
|
TableHeader_default as TableHeader,
|
|
8387
8659
|
TableLoading_default as TableLoading,
|