@natoora-libs/core 0.1.16-dev-doug-2 → 0.1.16-dev-doug-3
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.
|
@@ -7064,6 +7064,7 @@ var useStyles47 = (0, import_mui53.makeStyles)()((theme) => ({
|
|
|
7064
7064
|
tableHeaderContent: {
|
|
7065
7065
|
borderBottom: "1px solid",
|
|
7066
7066
|
borderBottomColor: colors.neutral300,
|
|
7067
|
+
backgroundColor: colors.neutral100,
|
|
7067
7068
|
whiteSpace: "nowrap",
|
|
7068
7069
|
"& .filter-menu-trigger": {
|
|
7069
7070
|
visibility: "hidden",
|
|
@@ -7114,7 +7115,7 @@ var SmartTableHeader = ({
|
|
|
7114
7115
|
};
|
|
7115
7116
|
const isSortActive = (headCellId) => orderBy === headCellId;
|
|
7116
7117
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(import_material59.TableHead, { className: classes.root, children: /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_material59.TableRow, { children: [
|
|
7117
|
-
enableCheckboxSelection ? /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(import_material59.TableCell, { padding: "checkbox", children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
7118
|
+
enableCheckboxSelection ? /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(import_material59.TableCell, { padding: "checkbox", sx: { backgroundColor: colors.neutral100 }, children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
7118
7119
|
import_material59.Checkbox,
|
|
7119
7120
|
{
|
|
7120
7121
|
color: "primary",
|
|
@@ -7569,16 +7570,28 @@ var import_material64 = require("@mui/material");
|
|
|
7569
7570
|
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
7570
7571
|
var TableDesktopRowSelectionBar = ({
|
|
7571
7572
|
isEveryRowInPageSelected,
|
|
7572
|
-
|
|
7573
|
+
isRowsFromAllPagesSelected,
|
|
7573
7574
|
numSelectedRows,
|
|
7574
7575
|
totalRowCount,
|
|
7575
|
-
|
|
7576
|
+
onSelectRowsFromAllPagesClick,
|
|
7577
|
+
onClearSelectionClick
|
|
7576
7578
|
}) => {
|
|
7577
|
-
|
|
7579
|
+
const isAnyRowSelected = numSelectedRows > 0;
|
|
7580
|
+
const getSelectedRowsText = () => {
|
|
7581
|
+
if (isRowsFromAllPagesSelected) {
|
|
7582
|
+
return `All ${totalRowCount} rows from all pages are selected based on your filters.`;
|
|
7583
|
+
}
|
|
7584
|
+
if (isEveryRowInPageSelected) {
|
|
7585
|
+
return `All ${numSelectedRows} rows on this page are selected.`;
|
|
7586
|
+
}
|
|
7587
|
+
return `${numSelectedRows} row${numSelectedRows > 1 ? "s" : ""} selected.`;
|
|
7588
|
+
};
|
|
7589
|
+
return isAnyRowSelected ? /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(
|
|
7578
7590
|
import_material64.Box,
|
|
7579
7591
|
{
|
|
7580
7592
|
sx: {
|
|
7581
7593
|
p: 1,
|
|
7594
|
+
height: 40,
|
|
7582
7595
|
gap: 2,
|
|
7583
7596
|
display: "flex",
|
|
7584
7597
|
justifyContent: "center",
|
|
@@ -7586,8 +7599,13 @@ var TableDesktopRowSelectionBar = ({
|
|
|
7586
7599
|
backgroundColor: colors.neutral150
|
|
7587
7600
|
},
|
|
7588
7601
|
children: [
|
|
7589
|
-
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_material64.Typography, { children:
|
|
7590
|
-
/* @__PURE__ */ (0, import_jsx_runtime117.
|
|
7602
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_material64.Typography, { children: getSelectedRowsText() }),
|
|
7603
|
+
!isRowsFromAllPagesSelected ? /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(import_material64.Button, { onClick: onSelectRowsFromAllPagesClick, children: [
|
|
7604
|
+
"Select all ",
|
|
7605
|
+
totalRowCount,
|
|
7606
|
+
" rows from all pages based on your filters"
|
|
7607
|
+
] }) : null,
|
|
7608
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_material64.Button, { onClick: onClearSelectionClick, children: "Clear Selection" })
|
|
7591
7609
|
]
|
|
7592
7610
|
}
|
|
7593
7611
|
) : null;
|
|
@@ -7674,7 +7692,7 @@ var TableDesktop = ({
|
|
|
7674
7692
|
appliedFilters?.sortField || "delivery_date"
|
|
7675
7693
|
);
|
|
7676
7694
|
const [selectedRows, setSelectedRows] = (0, import_react35.useState)(/* @__PURE__ */ new Set());
|
|
7677
|
-
const [
|
|
7695
|
+
const [isRowsFromAllPagesSelected, setIsRowsFromAllPagesSelected] = (0, import_react35.useState)(false);
|
|
7678
7696
|
const { toolbar: Toolbar2 } = components ?? {};
|
|
7679
7697
|
const { toolbarProps, footerProps } = componentsProps ?? {};
|
|
7680
7698
|
const numRows = (0, import_react35.useMemo)(
|
|
@@ -7702,15 +7720,18 @@ var TableDesktop = ({
|
|
|
7702
7720
|
updateSort(property, orderDir);
|
|
7703
7721
|
}
|
|
7704
7722
|
};
|
|
7723
|
+
const selectAllRowsInPage = () => {
|
|
7724
|
+
const allRowsIds = new Set(data.map((n) => n[keyField]));
|
|
7725
|
+
;
|
|
7726
|
+
setSelectedRows(allRowsIds);
|
|
7727
|
+
};
|
|
7705
7728
|
const resetSelectedRows = () => {
|
|
7706
7729
|
setSelectedRows(/* @__PURE__ */ new Set());
|
|
7707
|
-
|
|
7730
|
+
setIsRowsFromAllPagesSelected(false);
|
|
7708
7731
|
};
|
|
7709
7732
|
const handleSelectAllClick = (event) => {
|
|
7710
7733
|
if (event.target.checked) {
|
|
7711
|
-
|
|
7712
|
-
;
|
|
7713
|
-
setSelectedRows(allRowsIds);
|
|
7734
|
+
selectAllRowsInPage();
|
|
7714
7735
|
return;
|
|
7715
7736
|
}
|
|
7716
7737
|
resetSelectedRows();
|
|
@@ -7724,15 +7745,18 @@ var TableDesktop = ({
|
|
|
7724
7745
|
} else {
|
|
7725
7746
|
newSelected.add(rowId);
|
|
7726
7747
|
}
|
|
7748
|
+
if (newSelected.size < numRows) {
|
|
7749
|
+
setIsRowsFromAllPagesSelected(false);
|
|
7750
|
+
}
|
|
7727
7751
|
return newSelected;
|
|
7728
7752
|
});
|
|
7729
7753
|
};
|
|
7730
|
-
const
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7754
|
+
const handleSelectRowsFromAllPagesClick = () => {
|
|
7755
|
+
setIsRowsFromAllPagesSelected(true);
|
|
7756
|
+
selectAllRowsInPage();
|
|
7757
|
+
};
|
|
7758
|
+
const handleClearSelectionClick = () => {
|
|
7759
|
+
resetSelectedRows();
|
|
7736
7760
|
};
|
|
7737
7761
|
const handleApplyFilters = (updatedFilters, shouldSave) => {
|
|
7738
7762
|
resetSelectedRows();
|
|
@@ -7748,13 +7772,13 @@ var TableDesktop = ({
|
|
|
7748
7772
|
}
|
|
7749
7773
|
}, [enableCheckboxSelection]);
|
|
7750
7774
|
(0, import_react35.useEffect)(() => {
|
|
7751
|
-
if (isEveryRowInPageSelected ||
|
|
7775
|
+
if (isEveryRowInPageSelected || isRowsFromAllPagesSelected) {
|
|
7752
7776
|
const rowsIdsSet = new Set(data.map((obj) => obj[keyField]));
|
|
7753
7777
|
setSelectedRows(
|
|
7754
7778
|
(prev) => new Set([...prev].filter((value) => rowsIdsSet.has(value)))
|
|
7755
7779
|
);
|
|
7756
7780
|
}
|
|
7757
|
-
}, [data, setSelectedRows, isEveryRowInPageSelected,
|
|
7781
|
+
}, [data, setSelectedRows, isEveryRowInPageSelected, isRowsFromAllPagesSelected]);
|
|
7758
7782
|
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
7759
7783
|
import_material66.Box,
|
|
7760
7784
|
{
|
|
@@ -7778,7 +7802,7 @@ var TableDesktop = ({
|
|
|
7778
7802
|
Toolbar2,
|
|
7779
7803
|
{
|
|
7780
7804
|
selectedRows: [...selectedRows],
|
|
7781
|
-
isRowsInAllPagesSelected,
|
|
7805
|
+
isRowsInAllPagesSelected: isRowsFromAllPagesSelected,
|
|
7782
7806
|
...toolbarProps
|
|
7783
7807
|
}
|
|
7784
7808
|
) : null,
|
|
@@ -7786,10 +7810,11 @@ var TableDesktop = ({
|
|
|
7786
7810
|
TableDesktopRowSelectionBar,
|
|
7787
7811
|
{
|
|
7788
7812
|
isEveryRowInPageSelected,
|
|
7789
|
-
|
|
7813
|
+
isRowsFromAllPagesSelected,
|
|
7790
7814
|
numSelectedRows: selectedRows.size,
|
|
7791
7815
|
totalRowCount: totalDataCount ?? 0,
|
|
7792
|
-
|
|
7816
|
+
onSelectRowsFromAllPagesClick: handleSelectRowsFromAllPagesClick,
|
|
7817
|
+
onClearSelectionClick: handleClearSelectionClick
|
|
7793
7818
|
}
|
|
7794
7819
|
),
|
|
7795
7820
|
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|