@natoora-libs/core 0.1.16-dev-doug-1 → 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.
package/dist/components/index.js
CHANGED
|
@@ -6871,6 +6871,7 @@ var useStyles46 = makeStyles46()((theme) => ({
|
|
|
6871
6871
|
tableHeaderContent: {
|
|
6872
6872
|
borderBottom: "1px solid",
|
|
6873
6873
|
borderBottomColor: colors.neutral300,
|
|
6874
|
+
backgroundColor: colors.neutral100,
|
|
6874
6875
|
whiteSpace: "nowrap",
|
|
6875
6876
|
"& .filter-menu-trigger": {
|
|
6876
6877
|
visibility: "hidden",
|
|
@@ -6921,7 +6922,7 @@ var SmartTableHeader = ({
|
|
|
6921
6922
|
};
|
|
6922
6923
|
const isSortActive = (headCellId) => orderBy === headCellId;
|
|
6923
6924
|
return /* @__PURE__ */ jsx109(TableHead, { className: classes.root, children: /* @__PURE__ */ jsxs74(TableRow, { children: [
|
|
6924
|
-
enableCheckboxSelection ? /* @__PURE__ */ jsx109(TableCell, { padding: "checkbox", children: /* @__PURE__ */ jsx109(
|
|
6925
|
+
enableCheckboxSelection ? /* @__PURE__ */ jsx109(TableCell, { padding: "checkbox", sx: { backgroundColor: colors.neutral100 }, children: /* @__PURE__ */ jsx109(
|
|
6925
6926
|
Checkbox5,
|
|
6926
6927
|
{
|
|
6927
6928
|
color: "primary",
|
|
@@ -7396,16 +7397,28 @@ import { Box as Box33, Button as Button14, Typography as Typography28 } from "@m
|
|
|
7396
7397
|
import { jsx as jsx116, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
7397
7398
|
var TableDesktopRowSelectionBar = ({
|
|
7398
7399
|
isEveryRowInPageSelected,
|
|
7399
|
-
|
|
7400
|
+
isRowsFromAllPagesSelected,
|
|
7400
7401
|
numSelectedRows,
|
|
7401
7402
|
totalRowCount,
|
|
7402
|
-
|
|
7403
|
+
onSelectRowsFromAllPagesClick,
|
|
7404
|
+
onClearSelectionClick
|
|
7403
7405
|
}) => {
|
|
7404
|
-
|
|
7406
|
+
const isAnyRowSelected = numSelectedRows > 0;
|
|
7407
|
+
const getSelectedRowsText = () => {
|
|
7408
|
+
if (isRowsFromAllPagesSelected) {
|
|
7409
|
+
return `All ${totalRowCount} rows from all pages are selected based on your filters.`;
|
|
7410
|
+
}
|
|
7411
|
+
if (isEveryRowInPageSelected) {
|
|
7412
|
+
return `All ${numSelectedRows} rows on this page are selected.`;
|
|
7413
|
+
}
|
|
7414
|
+
return `${numSelectedRows} row${numSelectedRows > 1 ? "s" : ""} selected.`;
|
|
7415
|
+
};
|
|
7416
|
+
return isAnyRowSelected ? /* @__PURE__ */ jsxs78(
|
|
7405
7417
|
Box33,
|
|
7406
7418
|
{
|
|
7407
7419
|
sx: {
|
|
7408
7420
|
p: 1,
|
|
7421
|
+
height: 40,
|
|
7409
7422
|
gap: 2,
|
|
7410
7423
|
display: "flex",
|
|
7411
7424
|
justifyContent: "center",
|
|
@@ -7413,8 +7426,13 @@ var TableDesktopRowSelectionBar = ({
|
|
|
7413
7426
|
backgroundColor: colors.neutral150
|
|
7414
7427
|
},
|
|
7415
7428
|
children: [
|
|
7416
|
-
/* @__PURE__ */ jsx116(Typography28, { children:
|
|
7417
|
-
/* @__PURE__ */
|
|
7429
|
+
/* @__PURE__ */ jsx116(Typography28, { children: getSelectedRowsText() }),
|
|
7430
|
+
!isRowsFromAllPagesSelected ? /* @__PURE__ */ jsxs78(Button14, { onClick: onSelectRowsFromAllPagesClick, children: [
|
|
7431
|
+
"Select all ",
|
|
7432
|
+
totalRowCount,
|
|
7433
|
+
" rows from all pages based on your filters"
|
|
7434
|
+
] }) : null,
|
|
7435
|
+
/* @__PURE__ */ jsx116(Button14, { onClick: onClearSelectionClick, children: "Clear Selection" })
|
|
7418
7436
|
]
|
|
7419
7437
|
}
|
|
7420
7438
|
) : null;
|
|
@@ -7501,7 +7519,7 @@ var TableDesktop = ({
|
|
|
7501
7519
|
appliedFilters?.sortField || "delivery_date"
|
|
7502
7520
|
);
|
|
7503
7521
|
const [selectedRows, setSelectedRows] = useState17(/* @__PURE__ */ new Set());
|
|
7504
|
-
const [
|
|
7522
|
+
const [isRowsFromAllPagesSelected, setIsRowsFromAllPagesSelected] = useState17(false);
|
|
7505
7523
|
const { toolbar: Toolbar2 } = components ?? {};
|
|
7506
7524
|
const { toolbarProps, footerProps } = componentsProps ?? {};
|
|
7507
7525
|
const numRows = useMemo3(
|
|
@@ -7529,15 +7547,18 @@ var TableDesktop = ({
|
|
|
7529
7547
|
updateSort(property, orderDir);
|
|
7530
7548
|
}
|
|
7531
7549
|
};
|
|
7550
|
+
const selectAllRowsInPage = () => {
|
|
7551
|
+
const allRowsIds = new Set(data.map((n) => n[keyField]));
|
|
7552
|
+
;
|
|
7553
|
+
setSelectedRows(allRowsIds);
|
|
7554
|
+
};
|
|
7532
7555
|
const resetSelectedRows = () => {
|
|
7533
7556
|
setSelectedRows(/* @__PURE__ */ new Set());
|
|
7534
|
-
|
|
7557
|
+
setIsRowsFromAllPagesSelected(false);
|
|
7535
7558
|
};
|
|
7536
7559
|
const handleSelectAllClick = (event) => {
|
|
7537
7560
|
if (event.target.checked) {
|
|
7538
|
-
|
|
7539
|
-
;
|
|
7540
|
-
setSelectedRows(allRowsIds);
|
|
7561
|
+
selectAllRowsInPage();
|
|
7541
7562
|
return;
|
|
7542
7563
|
}
|
|
7543
7564
|
resetSelectedRows();
|
|
@@ -7551,15 +7572,22 @@ var TableDesktop = ({
|
|
|
7551
7572
|
} else {
|
|
7552
7573
|
newSelected.add(rowId);
|
|
7553
7574
|
}
|
|
7575
|
+
if (newSelected.size < numRows) {
|
|
7576
|
+
setIsRowsFromAllPagesSelected(false);
|
|
7577
|
+
}
|
|
7554
7578
|
return newSelected;
|
|
7555
7579
|
});
|
|
7556
7580
|
};
|
|
7557
|
-
const
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7581
|
+
const handleSelectRowsFromAllPagesClick = () => {
|
|
7582
|
+
setIsRowsFromAllPagesSelected(true);
|
|
7583
|
+
selectAllRowsInPage();
|
|
7584
|
+
};
|
|
7585
|
+
const handleClearSelectionClick = () => {
|
|
7586
|
+
resetSelectedRows();
|
|
7587
|
+
};
|
|
7588
|
+
const handleApplyFilters = (updatedFilters, shouldSave) => {
|
|
7589
|
+
resetSelectedRows();
|
|
7590
|
+
onApplyFilters?.(updatedFilters, shouldSave);
|
|
7563
7591
|
};
|
|
7564
7592
|
const handlePageChange = (event, page) => {
|
|
7565
7593
|
resetSelectedRows();
|
|
@@ -7571,13 +7599,13 @@ var TableDesktop = ({
|
|
|
7571
7599
|
}
|
|
7572
7600
|
}, [enableCheckboxSelection]);
|
|
7573
7601
|
useEffect11(() => {
|
|
7574
|
-
if (isEveryRowInPageSelected ||
|
|
7602
|
+
if (isEveryRowInPageSelected || isRowsFromAllPagesSelected) {
|
|
7575
7603
|
const rowsIdsSet = new Set(data.map((obj) => obj[keyField]));
|
|
7576
7604
|
setSelectedRows(
|
|
7577
7605
|
(prev) => new Set([...prev].filter((value) => rowsIdsSet.has(value)))
|
|
7578
7606
|
);
|
|
7579
7607
|
}
|
|
7580
|
-
}, [data, setSelectedRows, isEveryRowInPageSelected,
|
|
7608
|
+
}, [data, setSelectedRows, isEveryRowInPageSelected, isRowsFromAllPagesSelected]);
|
|
7581
7609
|
return /* @__PURE__ */ jsx118(
|
|
7582
7610
|
Box34,
|
|
7583
7611
|
{
|
|
@@ -7601,7 +7629,7 @@ var TableDesktop = ({
|
|
|
7601
7629
|
Toolbar2,
|
|
7602
7630
|
{
|
|
7603
7631
|
selectedRows: [...selectedRows],
|
|
7604
|
-
isRowsInAllPagesSelected,
|
|
7632
|
+
isRowsInAllPagesSelected: isRowsFromAllPagesSelected,
|
|
7605
7633
|
...toolbarProps
|
|
7606
7634
|
}
|
|
7607
7635
|
) : null,
|
|
@@ -7609,10 +7637,11 @@ var TableDesktop = ({
|
|
|
7609
7637
|
TableDesktopRowSelectionBar,
|
|
7610
7638
|
{
|
|
7611
7639
|
isEveryRowInPageSelected,
|
|
7612
|
-
|
|
7640
|
+
isRowsFromAllPagesSelected,
|
|
7613
7641
|
numSelectedRows: selectedRows.size,
|
|
7614
7642
|
totalRowCount: totalDataCount ?? 0,
|
|
7615
|
-
|
|
7643
|
+
onSelectRowsFromAllPagesClick: handleSelectRowsFromAllPagesClick,
|
|
7644
|
+
onClearSelectionClick: handleClearSelectionClick
|
|
7616
7645
|
}
|
|
7617
7646
|
),
|
|
7618
7647
|
/* @__PURE__ */ jsx118(
|
|
@@ -7656,7 +7685,7 @@ var TableDesktop = ({
|
|
|
7656
7685
|
headerFilters: headerFilters ?? {},
|
|
7657
7686
|
onRequestSort: handleRequestSort,
|
|
7658
7687
|
onSelectAllClick: handleSelectAllClick,
|
|
7659
|
-
onApplyFilters,
|
|
7688
|
+
onApplyFilters: handleApplyFilters,
|
|
7660
7689
|
shouldShowCheckOnFilter
|
|
7661
7690
|
}
|
|
7662
7691
|
),
|