@adapttable/mui 0.2.2 → 0.3.0

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 CHANGED
@@ -1,5 +1,37 @@
1
1
  # @adapttable/mui
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a90a2c2: Logical column pinning, so pinning stays correct under RTL.
8
+
9
+ **Breaking.** Pinned-side values are now `"start"` / `"end"` (were `"left"` /
10
+ `"right"`) — this is the public `pinned` layout value and the `colPin` URL token
11
+ (e.g. `colPin=name:start`); pre-existing `left`/`right` URLs no longer parse. The
12
+ label keys `pinLeft` / `pinRight` / `moveLeft` / `moveRight` are renamed to
13
+ `pinStart` / `pinEnd` / `moveStart` / `moveEnd`, with logical display strings
14
+ shipped for every locale. Pinning a data column is now a start-only toggle; the
15
+ injected actions column keeps its one-click end-pin.
16
+
17
+ To migrate: update any `defaultColumnLayout={{ pinned: { x: "left" } }}` to
18
+ `"start"` (and `"right"` → `"end"`), any persisted `colPin` URLs, and any custom
19
+ `labels` overriding the renamed keys.
20
+
21
+ - a90a2c2: Numbered page buttons in every adapter's pagination (with first/last and
22
+ ellipsis truncation), replacing the prev/next-only control — driven by a shared
23
+ `paginationItems` builder in `@adapttable/core`.
24
+
25
+ ### Patch Changes
26
+
27
+ - 07db665: Accessibility: give the filter overlay an accessible name — the Chakra and
28
+ Radix filter popovers and the MUI filter drawer now set `aria-label` on their
29
+ `role="dialog"` wrapper, fixing an `aria-dialog-name` violation. Locked in with
30
+ axe assertions across every adapter's filter overlay (popover + drawer).
31
+ - Updated dependencies [a90a2c2]
32
+ - Updated dependencies [a90a2c2]
33
+ - @adapttable/core@0.3.0
34
+
3
35
  ## 0.2.2
4
36
 
5
37
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @adapttable/mui
2
2
 
3
- ![@adapttable/mui — a Material UI data table built on AdaptTable](https://raw.githubusercontent.com/orwa-mahmoud/adapttable/main/assets/hero-mui.png)
3
+ ![@adapttable/mui — a Material UI data table built on AdaptTable](https://orwa-mahmoud.github.io/adapttable/media/demo-mui.gif)
4
4
 
5
5
  **[📖 Documentation](https://orwa-mahmoud.github.io/adapttable/)** · **[🚀 Live demo](https://orwa-mahmoud.github.io/adapttable/demo/)** · **[Get started](https://orwa-mahmoud.github.io/adapttable/getting-started/)**
6
6
 
package/dist/index.cjs CHANGED
@@ -1611,12 +1611,18 @@ function _temp2(__0, c) {
1611
1611
  }, c);
1612
1612
  }
1613
1613
  function FilterDrawer(t0) {
1614
- const $ = (0, react_compiler_runtime.c)(26);
1614
+ const $ = (0, react_compiler_runtime.c)(29);
1615
1615
  const { open, onClose, filters, activeFilterCount, onClearFilters, labels, dir: t1 } = t0;
1616
1616
  const t2 = (t1 === void 0 ? "ltr" : t1) === "rtl" ? "left" : "right";
1617
1617
  let t3;
1618
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1619
- t3 = {
1618
+ if ($[0] !== labels.filters) {
1619
+ t3 = { paper: { "aria-label": labels.filters } };
1620
+ $[0] = labels.filters;
1621
+ $[1] = t3;
1622
+ } else t3 = $[1];
1623
+ let t4;
1624
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1625
+ t4 = {
1620
1626
  width: 360,
1621
1627
  p: 2,
1622
1628
  display: "flex",
@@ -1624,106 +1630,108 @@ function FilterDrawer(t0) {
1624
1630
  gap: 2,
1625
1631
  height: "100%"
1626
1632
  };
1627
- $[0] = t3;
1628
- } else t3 = $[0];
1629
- let t4;
1630
- if ($[1] !== labels.filters) {
1631
- t4 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.Typography, {
1632
- variant: "h6",
1633
- children: labels.filters
1634
- });
1635
- $[1] = labels.filters;
1636
1633
  $[2] = t4;
1637
1634
  } else t4 = $[2];
1638
1635
  let t5;
1639
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
1640
- t5 = {
1636
+ if ($[3] !== labels.filters) {
1637
+ t5 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.Typography, {
1638
+ variant: "h6",
1639
+ children: labels.filters
1640
+ });
1641
+ $[3] = labels.filters;
1642
+ $[4] = t5;
1643
+ } else t5 = $[4];
1644
+ let t6;
1645
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
1646
+ t6 = {
1641
1647
  flex: 1,
1642
1648
  display: "flex",
1643
1649
  flexDirection: "column",
1644
1650
  gap: 2
1645
1651
  };
1646
- $[3] = t5;
1647
- } else t5 = $[3];
1648
- let t6;
1649
- if ($[4] !== filters) {
1650
- t6 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.Box, {
1651
- sx: t5,
1652
- children: filters
1653
- });
1654
- $[4] = filters;
1655
1652
  $[5] = t6;
1656
1653
  } else t6 = $[5];
1657
1654
  let t7;
1658
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1659
- t7 = { justifyContent: "space-between" };
1660
- $[6] = t7;
1661
- } else t7 = $[6];
1662
- const t8 = activeFilterCount === 0;
1663
- let t9;
1664
- if ($[7] !== labels.clearAll || $[8] !== onClearFilters || $[9] !== t8) {
1665
- t9 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.Button, {
1666
- onClick: onClearFilters,
1667
- disabled: t8,
1668
- children: labels.clearAll
1655
+ if ($[6] !== filters) {
1656
+ t7 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.Box, {
1657
+ sx: t6,
1658
+ children: filters
1669
1659
  });
1670
- $[7] = labels.clearAll;
1671
- $[8] = onClearFilters;
1672
- $[9] = t8;
1673
- $[10] = t9;
1674
- } else t9 = $[10];
1660
+ $[6] = filters;
1661
+ $[7] = t7;
1662
+ } else t7 = $[7];
1663
+ let t8;
1664
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1665
+ t8 = { justifyContent: "space-between" };
1666
+ $[8] = t8;
1667
+ } else t8 = $[8];
1668
+ const t9 = activeFilterCount === 0;
1675
1669
  let t10;
1676
- if ($[11] !== labels.applyFilters || $[12] !== onClose) {
1670
+ if ($[9] !== labels.clearAll || $[10] !== onClearFilters || $[11] !== t9) {
1677
1671
  t10 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.Button, {
1672
+ onClick: onClearFilters,
1673
+ disabled: t9,
1674
+ children: labels.clearAll
1675
+ });
1676
+ $[9] = labels.clearAll;
1677
+ $[10] = onClearFilters;
1678
+ $[11] = t9;
1679
+ $[12] = t10;
1680
+ } else t10 = $[12];
1681
+ let t11;
1682
+ if ($[13] !== labels.applyFilters || $[14] !== onClose) {
1683
+ t11 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.Button, {
1678
1684
  variant: "contained",
1679
1685
  onClick: onClose,
1680
1686
  children: labels.applyFilters
1681
1687
  });
1682
- $[11] = labels.applyFilters;
1683
- $[12] = onClose;
1684
- $[13] = t10;
1685
- } else t10 = $[13];
1686
- let t11;
1687
- if ($[14] !== t10 || $[15] !== t9) {
1688
- t11 = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mui_material.Stack, {
1688
+ $[13] = labels.applyFilters;
1689
+ $[14] = onClose;
1690
+ $[15] = t11;
1691
+ } else t11 = $[15];
1692
+ let t12;
1693
+ if ($[16] !== t10 || $[17] !== t11) {
1694
+ t12 = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mui_material.Stack, {
1689
1695
  direction: "row",
1690
- sx: t7,
1691
- children: [t9, t10]
1696
+ sx: t8,
1697
+ children: [t10, t11]
1692
1698
  });
1693
- $[14] = t10;
1694
- $[15] = t9;
1695
- $[16] = t11;
1696
- } else t11 = $[16];
1697
- let t12;
1698
- if ($[17] !== t11 || $[18] !== t4 || $[19] !== t6) {
1699
- t12 = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mui_material.Box, {
1700
- sx: t3,
1699
+ $[16] = t10;
1700
+ $[17] = t11;
1701
+ $[18] = t12;
1702
+ } else t12 = $[18];
1703
+ let t13;
1704
+ if ($[19] !== t12 || $[20] !== t5 || $[21] !== t7) {
1705
+ t13 = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mui_material.Box, {
1706
+ sx: t4,
1701
1707
  children: [
1702
- t4,
1703
- t6,
1704
- t11
1708
+ t5,
1709
+ t7,
1710
+ t12
1705
1711
  ]
1706
1712
  });
1707
- $[17] = t11;
1708
- $[18] = t4;
1709
- $[19] = t6;
1710
- $[20] = t12;
1711
- } else t12 = $[20];
1712
- let t13;
1713
- if ($[21] !== onClose || $[22] !== open || $[23] !== t12 || $[24] !== t2) {
1714
- t13 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.Drawer, {
1713
+ $[19] = t12;
1714
+ $[20] = t5;
1715
+ $[21] = t7;
1716
+ $[22] = t13;
1717
+ } else t13 = $[22];
1718
+ let t14;
1719
+ if ($[23] !== onClose || $[24] !== open || $[25] !== t13 || $[26] !== t2 || $[27] !== t3) {
1720
+ t14 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.Drawer, {
1715
1721
  anchor: t2,
1716
1722
  open,
1717
1723
  onClose,
1718
- children: t12
1724
+ slotProps: t3,
1725
+ children: t13
1719
1726
  });
1720
- $[21] = onClose;
1721
- $[22] = open;
1722
- $[23] = t12;
1723
- $[24] = t2;
1727
+ $[23] = onClose;
1728
+ $[24] = open;
1724
1729
  $[25] = t13;
1725
- } else t13 = $[25];
1726
- return t13;
1730
+ $[26] = t2;
1731
+ $[27] = t3;
1732
+ $[28] = t14;
1733
+ } else t14 = $[28];
1734
+ return t14;
1727
1735
  }
1728
1736
  //#endregion
1729
1737
  //#region src/components/ColumnMenu.tsx
@@ -1834,7 +1842,7 @@ function ActionsRow(t0) {
1834
1842
  $[1] = t1;
1835
1843
  } else t1 = $[1];
1836
1844
  const hidden = t1;
1837
- const pinned = layout.state.pinned[_adapttable_core.ACTIONS_COLUMN_KEY] === "right";
1845
+ const pinned = layout.state.pinned[_adapttable_core.ACTIONS_COLUMN_KEY] === "end";
1838
1846
  let t2;
1839
1847
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1840
1848
  t2 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.Divider, { sx: { my: .5 } });
@@ -1886,10 +1894,10 @@ function ActionsRow(t0) {
1886
1894
  $[12] = labels.actions;
1887
1895
  $[13] = t7;
1888
1896
  } else t7 = $[13];
1889
- const t8 = `${pinned ? labels.unpin : labels.pinRight}: ${labels.actions}`;
1897
+ const t8 = `${pinned ? labels.unpin : labels.pinEnd}: ${labels.actions}`;
1890
1898
  let t9;
1891
1899
  if ($[14] !== layout || $[15] !== pinned) {
1892
- t9 = () => layout.setPinned(_adapttable_core.ACTIONS_COLUMN_KEY, pinned ? void 0 : "right");
1900
+ t9 = () => layout.setPinned(_adapttable_core.ACTIONS_COLUMN_KEY, pinned ? void 0 : "end");
1893
1901
  $[14] = layout;
1894
1902
  $[15] = pinned;
1895
1903
  $[16] = t9;
@@ -2032,7 +2040,7 @@ function ColumnMenu(t0) {
2032
2040
  cursor: "grab",
2033
2041
  color: "text.disabled"
2034
2042
  },
2035
- ...(0, _adapttable_core.columnReorderKeyProps)(r.key, r.index, layout.move, `${labels.moveLeft} / ${labels.moveRight}: ${r.name}`),
2043
+ ...(0, _adapttable_core.columnReorderKeyProps)(r.key, r.index, layout.move, `${labels.moveStart} / ${labels.moveEnd}: ${r.name}`),
2036
2044
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_adapttable_core.GripIcon, {})
2037
2045
  }),
2038
2046
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VisibilityToggle, {
@@ -2553,15 +2561,15 @@ function DesktopTable({ table, rows, rowActions, confirm, getRowId, size, dir, p
2553
2561
  } : void 0;
2554
2562
  const selectionWidth = 48;
2555
2563
  const actionsWidth = 120;
2556
- const leadLeft = (expandActive ? EXPAND_WIDTH : 0) + (selection ? selectionWidth : 0);
2557
- const leadRight = showActions ? actionsWidth : 0;
2564
+ const leadStart = (expandActive ? EXPAND_WIDTH : 0) + (selection ? selectionWidth : 0);
2565
+ const leadEnd = showActions ? actionsWidth : 0;
2558
2566
  const leads = {
2559
- left: leadLeft,
2560
- right: leadRight
2567
+ start: leadStart,
2568
+ end: leadEnd
2561
2569
  };
2562
2570
  const selectionLead = expandActive ? EXPAND_WIDTH : 0;
2563
- const hasLeftPin = table.columns.some((c_0) => pinOffset?.(c_0.key)?.side === "left");
2564
- const stickActions = table.columns.some((c_1) => pinOffset?.(c_1.key)?.side === "right") || actionsPinned;
2571
+ const hasStartPin = table.columns.some((c_0) => pinOffset?.(c_0.key)?.side === "start");
2572
+ const stickActions = table.columns.some((c_1) => pinOffset?.(c_1.key)?.side === "end") || actionsPinned;
2565
2573
  const headCellSx = (column) => {
2566
2574
  const pin = (0, _adapttable_core.pinnedCellStyle)(pinOffset?.(column.key), _adapttable_core.PIN_Z.headerPinned, leads);
2567
2575
  const width = pin ? (0, _adapttable_core.pinnedColumnWidth)(column, columnWidths) : columnWidths?.[column.key] ?? column.width;
@@ -2601,8 +2609,8 @@ function DesktopTable({ table, rows, rowActions, confirm, getRowId, size, dir, p
2601
2609
  const cells = {};
2602
2610
  for (const column_0 of columns) {
2603
2611
  const pin_2 = (0, _adapttable_core.pinnedCellStyle)(pinOffset?.(column_0.key), _adapttable_core.PIN_Z.body, {
2604
- left: leadLeft,
2605
- right: leadRight
2612
+ start: leadStart,
2613
+ end: leadEnd
2606
2614
  });
2607
2615
  cells[column_0.key] = {
2608
2616
  ...pin_2 && {
@@ -2614,19 +2622,19 @@ function DesktopTable({ table, rows, rowActions, confirm, getRowId, size, dir, p
2614
2622
  }
2615
2623
  return {
2616
2624
  cells,
2617
- expand: edge("left", hasLeftPin),
2618
- selection: edge("left", hasLeftPin, selectionLead),
2625
+ expand: edge("start", hasStartPin),
2626
+ selection: edge("start", hasStartPin, selectionLead),
2619
2627
  actions: {
2620
- ...edge("right", stickActions),
2628
+ ...edge("end", stickActions),
2621
2629
  textAlign: "end"
2622
2630
  }
2623
2631
  };
2624
2632
  }, [
2625
2633
  columns,
2626
2634
  pinOffset,
2627
- leadLeft,
2628
- leadRight,
2629
- hasLeftPin,
2635
+ leadStart,
2636
+ leadEnd,
2637
+ hasStartPin,
2630
2638
  stickActions,
2631
2639
  selectionLead
2632
2640
  ]);
@@ -2638,7 +2646,7 @@ function DesktopTable({ table, rows, rowActions, confirm, getRowId, size, dir, p
2638
2646
  else if (hasPinned || overflow.overflowing) boxSx = { overflowX: "auto" };
2639
2647
  const minWidth = (0, _adapttable_core.tableMinWidth)(columns, {
2640
2648
  widths: columnWidths,
2641
- extra: leadLeft + leadRight
2649
+ extra: leadStart + leadEnd
2642
2650
  });
2643
2651
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.Box, {
2644
2652
  ref: (node) => {
@@ -2666,11 +2674,11 @@ function DesktopTable({ table, rows, rowActions, confirm, getRowId, size, dir, p
2666
2674
  ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mui_material.TableRow, { children: [
2667
2675
  expandActive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.TableCell, {
2668
2676
  padding: "checkbox",
2669
- sx: edgeHeadSx("left", hasLeftPin)
2677
+ sx: edgeHeadSx("start", hasStartPin)
2670
2678
  }),
2671
2679
  selection && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.TableCell, {
2672
2680
  padding: "checkbox",
2673
- sx: edgeHeadSx("left", hasLeftPin, selectionLead),
2681
+ sx: edgeHeadSx("start", hasStartPin, selectionLead),
2674
2682
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.Checkbox, {
2675
2683
  slotProps: { input: { "aria-label": labels.selectAll } },
2676
2684
  checked: selection.headerState === "all",
@@ -2708,7 +2716,7 @@ function DesktopTable({ table, rows, rowActions, confirm, getRowId, size, dir, p
2708
2716
  }),
2709
2717
  showActions && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material.TableCell, {
2710
2718
  sx: {
2711
- ...edgeHeadSx("right", stickActions),
2719
+ ...edgeHeadSx("end", stickActions),
2712
2720
  textAlign: "end"
2713
2721
  },
2714
2722
  children: labels.actions
@@ -3019,7 +3027,7 @@ function resolveActionsColumn(declared, layout) {
3019
3027
  return {
3020
3028
  hasRowActions,
3021
3029
  rowActions,
3022
- actionsPinned: rowActions !== void 0 && layout.state.pinned[_adapttable_core.ACTIONS_COLUMN_KEY] === "right"
3030
+ actionsPinned: rowActions !== void 0 && layout.state.pinned[_adapttable_core.ACTIONS_COLUMN_KEY] === "end"
3023
3031
  };
3024
3032
  }
3025
3033
  /**