@adapttable/mui 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.md +3 -1
- package/dist/index.cjs +106 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +106 -98
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1610,12 +1610,18 @@ function _temp2(__0, c) {
|
|
|
1610
1610
|
}, c);
|
|
1611
1611
|
}
|
|
1612
1612
|
function FilterDrawer(t0) {
|
|
1613
|
-
const $ = c(
|
|
1613
|
+
const $ = c(29);
|
|
1614
1614
|
const { open, onClose, filters, activeFilterCount, onClearFilters, labels, dir: t1 } = t0;
|
|
1615
1615
|
const t2 = (t1 === void 0 ? "ltr" : t1) === "rtl" ? "left" : "right";
|
|
1616
1616
|
let t3;
|
|
1617
|
-
if ($[0]
|
|
1618
|
-
t3 = {
|
|
1617
|
+
if ($[0] !== labels.filters) {
|
|
1618
|
+
t3 = { paper: { "aria-label": labels.filters } };
|
|
1619
|
+
$[0] = labels.filters;
|
|
1620
|
+
$[1] = t3;
|
|
1621
|
+
} else t3 = $[1];
|
|
1622
|
+
let t4;
|
|
1623
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1624
|
+
t4 = {
|
|
1619
1625
|
width: 360,
|
|
1620
1626
|
p: 2,
|
|
1621
1627
|
display: "flex",
|
|
@@ -1623,106 +1629,108 @@ function FilterDrawer(t0) {
|
|
|
1623
1629
|
gap: 2,
|
|
1624
1630
|
height: "100%"
|
|
1625
1631
|
};
|
|
1626
|
-
$[0] = t3;
|
|
1627
|
-
} else t3 = $[0];
|
|
1628
|
-
let t4;
|
|
1629
|
-
if ($[1] !== labels.filters) {
|
|
1630
|
-
t4 = /* @__PURE__ */ jsx(Typography, {
|
|
1631
|
-
variant: "h6",
|
|
1632
|
-
children: labels.filters
|
|
1633
|
-
});
|
|
1634
|
-
$[1] = labels.filters;
|
|
1635
1632
|
$[2] = t4;
|
|
1636
1633
|
} else t4 = $[2];
|
|
1637
1634
|
let t5;
|
|
1638
|
-
if ($[3]
|
|
1639
|
-
t5 = {
|
|
1635
|
+
if ($[3] !== labels.filters) {
|
|
1636
|
+
t5 = /* @__PURE__ */ jsx(Typography, {
|
|
1637
|
+
variant: "h6",
|
|
1638
|
+
children: labels.filters
|
|
1639
|
+
});
|
|
1640
|
+
$[3] = labels.filters;
|
|
1641
|
+
$[4] = t5;
|
|
1642
|
+
} else t5 = $[4];
|
|
1643
|
+
let t6;
|
|
1644
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1645
|
+
t6 = {
|
|
1640
1646
|
flex: 1,
|
|
1641
1647
|
display: "flex",
|
|
1642
1648
|
flexDirection: "column",
|
|
1643
1649
|
gap: 2
|
|
1644
1650
|
};
|
|
1645
|
-
$[3] = t5;
|
|
1646
|
-
} else t5 = $[3];
|
|
1647
|
-
let t6;
|
|
1648
|
-
if ($[4] !== filters) {
|
|
1649
|
-
t6 = /* @__PURE__ */ jsx(Box, {
|
|
1650
|
-
sx: t5,
|
|
1651
|
-
children: filters
|
|
1652
|
-
});
|
|
1653
|
-
$[4] = filters;
|
|
1654
1651
|
$[5] = t6;
|
|
1655
1652
|
} else t6 = $[5];
|
|
1656
1653
|
let t7;
|
|
1657
|
-
if ($[6]
|
|
1658
|
-
t7 =
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
const t8 = activeFilterCount === 0;
|
|
1662
|
-
let t9;
|
|
1663
|
-
if ($[7] !== labels.clearAll || $[8] !== onClearFilters || $[9] !== t8) {
|
|
1664
|
-
t9 = /* @__PURE__ */ jsx(Button, {
|
|
1665
|
-
onClick: onClearFilters,
|
|
1666
|
-
disabled: t8,
|
|
1667
|
-
children: labels.clearAll
|
|
1654
|
+
if ($[6] !== filters) {
|
|
1655
|
+
t7 = /* @__PURE__ */ jsx(Box, {
|
|
1656
|
+
sx: t6,
|
|
1657
|
+
children: filters
|
|
1668
1658
|
});
|
|
1669
|
-
$[
|
|
1670
|
-
$[
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1659
|
+
$[6] = filters;
|
|
1660
|
+
$[7] = t7;
|
|
1661
|
+
} else t7 = $[7];
|
|
1662
|
+
let t8;
|
|
1663
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1664
|
+
t8 = { justifyContent: "space-between" };
|
|
1665
|
+
$[8] = t8;
|
|
1666
|
+
} else t8 = $[8];
|
|
1667
|
+
const t9 = activeFilterCount === 0;
|
|
1674
1668
|
let t10;
|
|
1675
|
-
if ($[
|
|
1669
|
+
if ($[9] !== labels.clearAll || $[10] !== onClearFilters || $[11] !== t9) {
|
|
1676
1670
|
t10 = /* @__PURE__ */ jsx(Button, {
|
|
1671
|
+
onClick: onClearFilters,
|
|
1672
|
+
disabled: t9,
|
|
1673
|
+
children: labels.clearAll
|
|
1674
|
+
});
|
|
1675
|
+
$[9] = labels.clearAll;
|
|
1676
|
+
$[10] = onClearFilters;
|
|
1677
|
+
$[11] = t9;
|
|
1678
|
+
$[12] = t10;
|
|
1679
|
+
} else t10 = $[12];
|
|
1680
|
+
let t11;
|
|
1681
|
+
if ($[13] !== labels.applyFilters || $[14] !== onClose) {
|
|
1682
|
+
t11 = /* @__PURE__ */ jsx(Button, {
|
|
1677
1683
|
variant: "contained",
|
|
1678
1684
|
onClick: onClose,
|
|
1679
1685
|
children: labels.applyFilters
|
|
1680
1686
|
});
|
|
1681
|
-
$[
|
|
1682
|
-
$[
|
|
1683
|
-
$[
|
|
1684
|
-
} else
|
|
1685
|
-
let
|
|
1686
|
-
if ($[
|
|
1687
|
-
|
|
1687
|
+
$[13] = labels.applyFilters;
|
|
1688
|
+
$[14] = onClose;
|
|
1689
|
+
$[15] = t11;
|
|
1690
|
+
} else t11 = $[15];
|
|
1691
|
+
let t12;
|
|
1692
|
+
if ($[16] !== t10 || $[17] !== t11) {
|
|
1693
|
+
t12 = /* @__PURE__ */ jsxs(Stack, {
|
|
1688
1694
|
direction: "row",
|
|
1689
|
-
sx:
|
|
1690
|
-
children: [
|
|
1695
|
+
sx: t8,
|
|
1696
|
+
children: [t10, t11]
|
|
1691
1697
|
});
|
|
1692
|
-
$[
|
|
1693
|
-
$[
|
|
1694
|
-
$[
|
|
1695
|
-
} else
|
|
1696
|
-
let
|
|
1697
|
-
if ($[
|
|
1698
|
-
|
|
1699
|
-
sx:
|
|
1698
|
+
$[16] = t10;
|
|
1699
|
+
$[17] = t11;
|
|
1700
|
+
$[18] = t12;
|
|
1701
|
+
} else t12 = $[18];
|
|
1702
|
+
let t13;
|
|
1703
|
+
if ($[19] !== t12 || $[20] !== t5 || $[21] !== t7) {
|
|
1704
|
+
t13 = /* @__PURE__ */ jsxs(Box, {
|
|
1705
|
+
sx: t4,
|
|
1700
1706
|
children: [
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1707
|
+
t5,
|
|
1708
|
+
t7,
|
|
1709
|
+
t12
|
|
1704
1710
|
]
|
|
1705
1711
|
});
|
|
1706
|
-
$[
|
|
1707
|
-
$[
|
|
1708
|
-
$[
|
|
1709
|
-
$[
|
|
1710
|
-
} else
|
|
1711
|
-
let
|
|
1712
|
-
if ($[
|
|
1713
|
-
|
|
1712
|
+
$[19] = t12;
|
|
1713
|
+
$[20] = t5;
|
|
1714
|
+
$[21] = t7;
|
|
1715
|
+
$[22] = t13;
|
|
1716
|
+
} else t13 = $[22];
|
|
1717
|
+
let t14;
|
|
1718
|
+
if ($[23] !== onClose || $[24] !== open || $[25] !== t13 || $[26] !== t2 || $[27] !== t3) {
|
|
1719
|
+
t14 = /* @__PURE__ */ jsx(Drawer, {
|
|
1714
1720
|
anchor: t2,
|
|
1715
1721
|
open,
|
|
1716
1722
|
onClose,
|
|
1717
|
-
|
|
1723
|
+
slotProps: t3,
|
|
1724
|
+
children: t13
|
|
1718
1725
|
});
|
|
1719
|
-
$[
|
|
1720
|
-
$[
|
|
1721
|
-
$[23] = t12;
|
|
1722
|
-
$[24] = t2;
|
|
1726
|
+
$[23] = onClose;
|
|
1727
|
+
$[24] = open;
|
|
1723
1728
|
$[25] = t13;
|
|
1724
|
-
|
|
1725
|
-
|
|
1729
|
+
$[26] = t2;
|
|
1730
|
+
$[27] = t3;
|
|
1731
|
+
$[28] = t14;
|
|
1732
|
+
} else t14 = $[28];
|
|
1733
|
+
return t14;
|
|
1726
1734
|
}
|
|
1727
1735
|
//#endregion
|
|
1728
1736
|
//#region src/components/ColumnMenu.tsx
|
|
@@ -1833,7 +1841,7 @@ function ActionsRow(t0) {
|
|
|
1833
1841
|
$[1] = t1;
|
|
1834
1842
|
} else t1 = $[1];
|
|
1835
1843
|
const hidden = t1;
|
|
1836
|
-
const pinned = layout.state.pinned[ACTIONS_COLUMN_KEY] === "
|
|
1844
|
+
const pinned = layout.state.pinned[ACTIONS_COLUMN_KEY] === "end";
|
|
1837
1845
|
let t2;
|
|
1838
1846
|
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1839
1847
|
t2 = /* @__PURE__ */ jsx(Divider, { sx: { my: .5 } });
|
|
@@ -1885,10 +1893,10 @@ function ActionsRow(t0) {
|
|
|
1885
1893
|
$[12] = labels.actions;
|
|
1886
1894
|
$[13] = t7;
|
|
1887
1895
|
} else t7 = $[13];
|
|
1888
|
-
const t8 = `${pinned ? labels.unpin : labels.
|
|
1896
|
+
const t8 = `${pinned ? labels.unpin : labels.pinEnd}: ${labels.actions}`;
|
|
1889
1897
|
let t9;
|
|
1890
1898
|
if ($[14] !== layout || $[15] !== pinned) {
|
|
1891
|
-
t9 = () => layout.setPinned(ACTIONS_COLUMN_KEY, pinned ? void 0 : "
|
|
1899
|
+
t9 = () => layout.setPinned(ACTIONS_COLUMN_KEY, pinned ? void 0 : "end");
|
|
1892
1900
|
$[14] = layout;
|
|
1893
1901
|
$[15] = pinned;
|
|
1894
1902
|
$[16] = t9;
|
|
@@ -2031,7 +2039,7 @@ function ColumnMenu(t0) {
|
|
|
2031
2039
|
cursor: "grab",
|
|
2032
2040
|
color: "text.disabled"
|
|
2033
2041
|
},
|
|
2034
|
-
...columnReorderKeyProps(r.key, r.index, layout.move, `${labels.
|
|
2042
|
+
...columnReorderKeyProps(r.key, r.index, layout.move, `${labels.moveStart} / ${labels.moveEnd}: ${r.name}`),
|
|
2035
2043
|
children: /* @__PURE__ */ jsx(GripIcon, {})
|
|
2036
2044
|
}),
|
|
2037
2045
|
/* @__PURE__ */ jsx(VisibilityToggle, {
|
|
@@ -2552,15 +2560,15 @@ function DesktopTable({ table, rows, rowActions, confirm, getRowId, size, dir, p
|
|
|
2552
2560
|
} : void 0;
|
|
2553
2561
|
const selectionWidth = 48;
|
|
2554
2562
|
const actionsWidth = 120;
|
|
2555
|
-
const
|
|
2556
|
-
const
|
|
2563
|
+
const leadStart = (expandActive ? EXPAND_WIDTH : 0) + (selection ? selectionWidth : 0);
|
|
2564
|
+
const leadEnd = showActions ? actionsWidth : 0;
|
|
2557
2565
|
const leads = {
|
|
2558
|
-
|
|
2559
|
-
|
|
2566
|
+
start: leadStart,
|
|
2567
|
+
end: leadEnd
|
|
2560
2568
|
};
|
|
2561
2569
|
const selectionLead = expandActive ? EXPAND_WIDTH : 0;
|
|
2562
|
-
const
|
|
2563
|
-
const stickActions = table.columns.some((c_1) => pinOffset?.(c_1.key)?.side === "
|
|
2570
|
+
const hasStartPin = table.columns.some((c_0) => pinOffset?.(c_0.key)?.side === "start");
|
|
2571
|
+
const stickActions = table.columns.some((c_1) => pinOffset?.(c_1.key)?.side === "end") || actionsPinned;
|
|
2564
2572
|
const headCellSx = (column) => {
|
|
2565
2573
|
const pin = pinnedCellStyle(pinOffset?.(column.key), PIN_Z.headerPinned, leads);
|
|
2566
2574
|
const width = pin ? pinnedColumnWidth(column, columnWidths) : columnWidths?.[column.key] ?? column.width;
|
|
@@ -2600,8 +2608,8 @@ function DesktopTable({ table, rows, rowActions, confirm, getRowId, size, dir, p
|
|
|
2600
2608
|
const cells = {};
|
|
2601
2609
|
for (const column_0 of columns) {
|
|
2602
2610
|
const pin_2 = pinnedCellStyle(pinOffset?.(column_0.key), PIN_Z.body, {
|
|
2603
|
-
|
|
2604
|
-
|
|
2611
|
+
start: leadStart,
|
|
2612
|
+
end: leadEnd
|
|
2605
2613
|
});
|
|
2606
2614
|
cells[column_0.key] = {
|
|
2607
2615
|
...pin_2 && {
|
|
@@ -2613,19 +2621,19 @@ function DesktopTable({ table, rows, rowActions, confirm, getRowId, size, dir, p
|
|
|
2613
2621
|
}
|
|
2614
2622
|
return {
|
|
2615
2623
|
cells,
|
|
2616
|
-
expand: edge("
|
|
2617
|
-
selection: edge("
|
|
2624
|
+
expand: edge("start", hasStartPin),
|
|
2625
|
+
selection: edge("start", hasStartPin, selectionLead),
|
|
2618
2626
|
actions: {
|
|
2619
|
-
...edge("
|
|
2627
|
+
...edge("end", stickActions),
|
|
2620
2628
|
textAlign: "end"
|
|
2621
2629
|
}
|
|
2622
2630
|
};
|
|
2623
2631
|
}, [
|
|
2624
2632
|
columns,
|
|
2625
2633
|
pinOffset,
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2634
|
+
leadStart,
|
|
2635
|
+
leadEnd,
|
|
2636
|
+
hasStartPin,
|
|
2629
2637
|
stickActions,
|
|
2630
2638
|
selectionLead
|
|
2631
2639
|
]);
|
|
@@ -2637,7 +2645,7 @@ function DesktopTable({ table, rows, rowActions, confirm, getRowId, size, dir, p
|
|
|
2637
2645
|
else if (hasPinned || overflow.overflowing) boxSx = { overflowX: "auto" };
|
|
2638
2646
|
const minWidth = tableMinWidth(columns, {
|
|
2639
2647
|
widths: columnWidths,
|
|
2640
|
-
extra:
|
|
2648
|
+
extra: leadStart + leadEnd
|
|
2641
2649
|
});
|
|
2642
2650
|
return /* @__PURE__ */ jsx(Box, {
|
|
2643
2651
|
ref: (node) => {
|
|
@@ -2665,11 +2673,11 @@ function DesktopTable({ table, rows, rowActions, confirm, getRowId, size, dir, p
|
|
|
2665
2673
|
] }), /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
2666
2674
|
expandActive && /* @__PURE__ */ jsx(TableCell, {
|
|
2667
2675
|
padding: "checkbox",
|
|
2668
|
-
sx: edgeHeadSx("
|
|
2676
|
+
sx: edgeHeadSx("start", hasStartPin)
|
|
2669
2677
|
}),
|
|
2670
2678
|
selection && /* @__PURE__ */ jsx(TableCell, {
|
|
2671
2679
|
padding: "checkbox",
|
|
2672
|
-
sx: edgeHeadSx("
|
|
2680
|
+
sx: edgeHeadSx("start", hasStartPin, selectionLead),
|
|
2673
2681
|
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
2674
2682
|
slotProps: { input: { "aria-label": labels.selectAll } },
|
|
2675
2683
|
checked: selection.headerState === "all",
|
|
@@ -2707,7 +2715,7 @@ function DesktopTable({ table, rows, rowActions, confirm, getRowId, size, dir, p
|
|
|
2707
2715
|
}),
|
|
2708
2716
|
showActions && /* @__PURE__ */ jsx(TableCell, {
|
|
2709
2717
|
sx: {
|
|
2710
|
-
...edgeHeadSx("
|
|
2718
|
+
...edgeHeadSx("end", stickActions),
|
|
2711
2719
|
textAlign: "end"
|
|
2712
2720
|
},
|
|
2713
2721
|
children: labels.actions
|
|
@@ -3018,7 +3026,7 @@ function resolveActionsColumn(declared, layout) {
|
|
|
3018
3026
|
return {
|
|
3019
3027
|
hasRowActions,
|
|
3020
3028
|
rowActions,
|
|
3021
|
-
actionsPinned: rowActions !== void 0 && layout.state.pinned[ACTIONS_COLUMN_KEY] === "
|
|
3029
|
+
actionsPinned: rowActions !== void 0 && layout.state.pinned[ACTIONS_COLUMN_KEY] === "end"
|
|
3022
3030
|
};
|
|
3023
3031
|
}
|
|
3024
3032
|
/**
|