@adapttable/mantine 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,33 @@
1
1
  # @adapttable/mantine
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
+ - Updated dependencies [a90a2c2]
28
+ - Updated dependencies [a90a2c2]
29
+ - @adapttable/core@0.3.0
30
+
3
31
  ## 0.2.2
4
32
 
5
33
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @adapttable/mantine
2
2
 
3
- ![@adapttable/mantine — a Mantine data table built on AdaptTable](https://raw.githubusercontent.com/orwa-mahmoud/adapttable/main/assets/hero-mantine.png)
3
+ ![@adapttable/mantine — a Mantine data table built on AdaptTable](https://orwa-mahmoud.github.io/adapttable/media/demo-mantine.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
@@ -1010,7 +1010,7 @@ function ActionsRow(t0) {
1010
1010
  $[1] = t1;
1011
1011
  } else t1 = $[1];
1012
1012
  const hidden = t1;
1013
- const pinned = layout.state.pinned[_adapttable_core.ACTIONS_COLUMN_KEY] === "right";
1013
+ const pinned = layout.state.pinned[_adapttable_core.ACTIONS_COLUMN_KEY] === "end";
1014
1014
  let t2;
1015
1015
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1016
1016
  t2 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Box, { w: 22 });
@@ -1035,10 +1035,10 @@ function ActionsRow(t0) {
1035
1035
  $[7] = t3;
1036
1036
  $[8] = t4;
1037
1037
  } else t4 = $[8];
1038
- const t5 = `${pinned ? labels.unpin : labels.pinRight}: ${labels.actions}`;
1038
+ const t5 = `${pinned ? labels.unpin : labels.pinEnd}: ${labels.actions}`;
1039
1039
  let t6;
1040
1040
  if ($[9] !== layout || $[10] !== pinned) {
1041
- t6 = () => layout.setPinned(_adapttable_core.ACTIONS_COLUMN_KEY, pinned ? void 0 : "right");
1041
+ t6 = () => layout.setPinned(_adapttable_core.ACTIONS_COLUMN_KEY, pinned ? void 0 : "end");
1042
1042
  $[9] = layout;
1043
1043
  $[10] = pinned;
1044
1044
  $[11] = t6;
@@ -1136,7 +1136,7 @@ function ColumnMenu(t0) {
1136
1136
  color: "gray",
1137
1137
  size: "sm",
1138
1138
  style: { cursor: "grab" },
1139
- ...(0, _adapttable_core.columnReorderKeyProps)(r.key, r.index, layout.move, `${labels.moveLeft} / ${labels.moveRight}: ${r.name}`),
1139
+ ...(0, _adapttable_core.columnReorderKeyProps)(r.key, r.index, layout.move, `${labels.moveStart} / ${labels.moveEnd}: ${r.name}`),
1140
1140
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_adapttable_core.GripIcon, {})
1141
1141
  }),
1142
1142
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowVisibility, {
@@ -1844,7 +1844,7 @@ function desktopRowPropsEqual(prev, next) {
1844
1844
  function leadingPinStyle(active, inset, zIndex, background) {
1845
1845
  if (!active) return void 0;
1846
1846
  const style = (0, _adapttable_core.pinnedCellStyle)({
1847
- side: "left",
1847
+ side: "start",
1848
1848
  inset
1849
1849
  }, zIndex);
1850
1850
  return background ? {
@@ -1857,11 +1857,11 @@ function leadingPinStyle(active, inset, zIndex, background) {
1857
1857
  * columns). Memoized rows compare this one string instead of the per-render
1858
1858
  * style objects derived from it.
1859
1859
  */
1860
- function pinLayoutSignature(columns, pinOffset, hasLeftPin, actionsEdgePinned) {
1860
+ function pinLayoutSignature(columns, pinOffset, hasStartPin, actionsEdgePinned) {
1861
1861
  return `${columns.map((column) => {
1862
1862
  const pin = pinOffset?.(column.key);
1863
1863
  return pin ? `${column.key}:${pin.side}${pin.inset}` : column.key;
1864
- }).join("|")}|${String(hasLeftPin)}|${String(actionsEdgePinned)}`;
1864
+ }).join("|")}|${String(hasStartPin)}|${String(actionsEdgePinned)}`;
1865
1865
  }
1866
1866
  /**
1867
1867
  * One desktop row (plus its detail row when expanded), extracted so it can
@@ -2035,8 +2035,8 @@ function DesktopTable({ table, rows, rowActions, confirm, prefetch, onRowClick,
2035
2035
  const expandable = expansion !== void 0;
2036
2036
  const groupCells = (0, _adapttable_core.headerGroupRow)(columns);
2037
2037
  const summaryCells = summaryRow?.(rows);
2038
- const hasRightPin = table.columns.some((c) => pinOffset?.(c.key)?.side === "right");
2039
- const actionsEdgePinned = showActions && (hasRightPin || actionsPinned);
2038
+ const hasEndPin = table.columns.some((c) => pinOffset?.(c.key)?.side === "end");
2039
+ const actionsEdgePinned = showActions && (hasEndPin || actionsPinned);
2040
2040
  const hasPinned = table.columns.some((c_0) => pinOffset?.(c_0.key) != null) || actionsEdgePinned;
2041
2041
  const { ref: wrapperRef, overflowing } = (0, _adapttable_core.useHorizontalOverflow)();
2042
2042
  const headerCellStyle = stickyHeader ? {
@@ -2051,10 +2051,10 @@ function DesktopTable({ table, rows, rowActions, confirm, prefetch, onRowClick,
2051
2051
  const actionsWidth = 120;
2052
2052
  const expansionLead = expandable ? expansionWidth : 0;
2053
2053
  const leads = {
2054
- left: expansionLead + (selection ? selectionWidth : 0),
2055
- right: showActions ? actionsWidth : 0
2054
+ start: expansionLead + (selection ? selectionWidth : 0),
2055
+ end: showActions ? actionsWidth : 0
2056
2056
  };
2057
- const hasLeftPin = table.columns.some((c_1) => pinOffset?.(c_1.key)?.side === "left");
2057
+ const hasStartPin = table.columns.some((c_1) => pinOffset?.(c_1.key)?.side === "start");
2058
2058
  const pinBg = "var(--mantine-color-body)";
2059
2059
  const headerStyleFor = (column) => {
2060
2060
  const key = column.key;
@@ -2069,15 +2069,15 @@ function DesktopTable({ table, rows, rowActions, confirm, prefetch, onRowClick,
2069
2069
  };
2070
2070
  const expansionHeaderStyle = {
2071
2071
  ...headerCellStyle,
2072
- ...leadingPinStyle(hasLeftPin, 0, _adapttable_core.PIN_Z.headerPinned)
2072
+ ...leadingPinStyle(hasStartPin, 0, _adapttable_core.PIN_Z.headerPinned)
2073
2073
  };
2074
2074
  const selectionHeaderStyle = {
2075
2075
  ...headerCellStyle,
2076
- ...leadingPinStyle(hasLeftPin, expansionLead, _adapttable_core.PIN_Z.headerPinned)
2076
+ ...leadingPinStyle(hasStartPin, expansionLead, _adapttable_core.PIN_Z.headerPinned)
2077
2077
  };
2078
2078
  const actionsHeaderStyle = {
2079
2079
  ...headerCellStyle,
2080
- ...(0, _adapttable_core.edgePinStyle)("right", actionsEdgePinned, _adapttable_core.PIN_Z.headerPinned)
2080
+ ...(0, _adapttable_core.edgePinStyle)("end", actionsEdgePinned, _adapttable_core.PIN_Z.headerPinned)
2081
2081
  };
2082
2082
  const edgeBodyStyle = (side, active) => {
2083
2083
  const pin_0 = (0, _adapttable_core.edgePinStyle)(side, active, _adapttable_core.PIN_Z.body);
@@ -2086,9 +2086,9 @@ function DesktopTable({ table, rows, rowActions, confirm, prefetch, onRowClick,
2086
2086
  background: pinBg
2087
2087
  } : void 0;
2088
2088
  };
2089
- const expansionCellStyle = leadingPinStyle(hasLeftPin, 0, _adapttable_core.PIN_Z.body, pinBg);
2090
- const selectionCellStyle = leadingPinStyle(hasLeftPin, expansionLead, _adapttable_core.PIN_Z.body, pinBg);
2091
- const actionsCellStyle = edgeBodyStyle("right", actionsEdgePinned);
2089
+ const expansionCellStyle = leadingPinStyle(hasStartPin, 0, _adapttable_core.PIN_Z.body, pinBg);
2090
+ const selectionCellStyle = leadingPinStyle(hasStartPin, expansionLead, _adapttable_core.PIN_Z.body, pinBg);
2091
+ const actionsCellStyle = edgeBodyStyle("end", actionsEdgePinned);
2092
2092
  const columnName = (column_0) => typeof column_0.header === "string" ? column_0.header : column_0.key;
2093
2093
  const resizeHandleFor = (column_1) => setWidth ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2094
2094
  ...(0, _adapttable_core.columnResizeHandleProps)(column_1.key, setWidth, `${resizeLabel}: ${columnName(column_1)}`),
@@ -2110,7 +2110,7 @@ function DesktopTable({ table, rows, rowActions, confirm, prefetch, onRowClick,
2110
2110
  selectionRef.current = selection;
2111
2111
  const toggleSelect = (0, react.useCallback)((id) => selectionRef.current.toggle(id), []);
2112
2112
  const Row = (0, react.useMemo)(() => (0, react.memo)(DesktopRowBase, desktopRowPropsEqual), []);
2113
- const pinSignature = pinLayoutSignature(columns, pinOffset, hasLeftPin, actionsEdgePinned);
2113
+ const pinSignature = pinLayoutSignature(columns, pinOffset, hasStartPin, actionsEdgePinned);
2114
2114
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2115
2115
  ref: (node) => {
2116
2116
  wrapperRef(node);
@@ -3620,7 +3620,7 @@ function DataTable(props) {
3620
3620
  $[2] = t5;
3621
3621
  } else t5 = $[2];
3622
3622
  const visibleRowActions = t5;
3623
- const actionsPinned = chrome.columnLayout.state.pinned[_adapttable_core.ACTIONS_COLUMN_KEY] === "right";
3623
+ const actionsPinned = chrome.columnLayout.state.pinned[_adapttable_core.ACTIONS_COLUMN_KEY] === "end";
3624
3624
  const { virtualization, loadMoreRef, canLoadMore, virtualScrollRef } = (0, _adapttable_core.useChromeBodyData)(chrome, chromeProps);
3625
3625
  const [drawerOpened, setDrawerOpened] = (0, react.useState)(false);
3626
3626
  const filtersTrigger = (0, _adapttable_core.useFilterTriggerToggle)(drawerOpened, setDrawerOpened);