asma-ui-core 3.121.4 → 3.121.6

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.
@@ -1,16 +1,17 @@
1
- var e = "_root_wse1z_1", _ = "_shell_wse1z_5", a = "_shellCompact_wse1z_9", s = "_shellExpanded_wse1z_13", r = "_content_wse1z_17", t = "_compactItems_wse1z_21", o = "_compactItemsStacked_wse1z_25", m = "_expandedItems_wse1z_29", c = "_measureRow_wse1z_33", l = "_measureLayer_wse1z_37", d = "_chevron_wse1z_41", v = {
2
- root: e,
3
- shell: _,
4
- shellCompact: a,
5
- shellExpanded: s,
6
- content: r,
7
- compactItems: t,
8
- compactItemsStacked: o,
9
- expandedItems: m,
10
- measureRow: c,
11
- measureLayer: l,
12
- chevron: d
1
+ var t = "_root_6jgtc_2", e = "_shell_6jgtc_6", _ = "_shellCompact_6jgtc_10", a = "_shellExpanded_6jgtc_14", c = "_content_6jgtc_18", r = "_contentCompact_6jgtc_26", o = "_compactItems_6jgtc_30", m = "_compactItemsStacked_6jgtc_34", s = "_expandedItems_6jgtc_38", l = "_measureRow_6jgtc_42", n = "_measureLayer_6jgtc_46", v = "_chevron_6jgtc_50", d = {
2
+ root: t,
3
+ shell: e,
4
+ shellCompact: _,
5
+ shellExpanded: a,
6
+ content: c,
7
+ contentCompact: r,
8
+ compactItems: o,
9
+ compactItemsStacked: m,
10
+ expandedItems: s,
11
+ measureRow: l,
12
+ measureLayer: n,
13
+ chevron: v
13
14
  };
14
15
  export {
15
- v as default
16
+ d as default
16
17
  };
@@ -1,25 +1,25 @@
1
- import { cn as b } from "../../../helpers/cn.js";
1
+ import { cn as g } from "../../../helpers/cn.js";
2
2
  import { ChevronDownIcon as j } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
3
3
  import { ChevronUpIcon as z } from "../../icons/chevron-up-icon/ChevronUpIcon.js";
4
- import h from "./Pathfinder.module.js";
5
- import { useCallback as R, useEffect as M, useLayoutEffect as O, useMemo as y, useRef as k, useState as x, useSyncExternalStore as P } from "react";
6
- import { Fragment as D, jsx as e, jsxs as I } from "react/jsx-runtime";
4
+ import o from "./Pathfinder.module.js";
5
+ import { useCallback as C, useEffect as M, useLayoutEffect as O, useMemo as y, useRef as I, useState as x, useSyncExternalStore as P } from "react";
6
+ import { Fragment as D, jsx as e, jsxs as R } from "react/jsx-runtime";
7
7
  var _ = typeof window < "u" ? O : M;
8
8
  function q() {
9
- const [i, n] = x(null), a = R((t) => {
9
+ const [i, n] = x(null), a = C((t) => {
10
10
  n(t);
11
- }, []), s = R(() => i ? Math.floor(i.getBoundingClientRect().width) : 0, [i]);
11
+ }, []), s = C(() => i ? Math.floor(i.getBoundingClientRect().width) : 0, [i]);
12
12
  return {
13
13
  ref: a,
14
- width: P(R((t) => {
14
+ width: P(C((t) => {
15
15
  if (!i || typeof ResizeObserver > "u") return () => {
16
16
  };
17
17
  let d = 0;
18
- const o = new ResizeObserver(() => {
18
+ const l = new ResizeObserver(() => {
19
19
  cancelAnimationFrame(d), d = requestAnimationFrame(t);
20
20
  });
21
- return o.observe(i), () => {
22
- cancelAnimationFrame(d), o.disconnect();
21
+ return l.observe(i), () => {
22
+ cancelAnimationFrame(d), l.disconnect();
23
23
  };
24
24
  }, [i]), s, () => 0)
25
25
  };
@@ -31,80 +31,80 @@ function A(i) {
31
31
  });
32
32
  }
33
33
  function K(i) {
34
- const { items: n, leadSlot: a, actionSlot: s } = i, t = k({}), d = k(null), o = k(null), [l, v] = x({
34
+ const { items: n, leadSlot: a, actionSlot: s } = i, t = I({}), d = I(null), l = I(null), [m, v] = x({
35
35
  itemWidths: {},
36
36
  leadWidth: 0,
37
37
  actionWidth: 0
38
- }), f = k(l);
38
+ }), p = I(m);
39
39
  M(() => {
40
- f.current = l;
41
- }, [l]);
42
- const p = R((r) => (m) => {
43
- t.current[r] = m;
40
+ p.current = m;
41
+ }, [m]);
42
+ const h = C((r) => (u) => {
43
+ t.current[r] = u;
44
44
  }, []);
45
45
  return _(() => {
46
46
  const r = {};
47
- for (const u of n) {
48
- const w = t.current[u.id], N = Math.ceil(w?.getBoundingClientRect().width ?? u.estimatedWidth ?? 0);
49
- r[u.id] = N;
47
+ for (const f of n) {
48
+ const k = t.current[f.id], w = Math.ceil(k?.getBoundingClientRect().width ?? f.estimatedWidth ?? 0);
49
+ r[f.id] = w;
50
50
  }
51
- const m = a ? Math.ceil(d.current?.getBoundingClientRect().width ?? 0) : 0, g = s ? Math.ceil(o.current?.getBoundingClientRect().width ?? 0) : 0, W = f.current;
52
- (!(Object.keys(W.itemWidths).length === Object.keys(r).length && n.every((u) => W.itemWidths[u.id] === r[u.id])) || W.leadWidth !== m || W.actionWidth !== g) && v({
51
+ const u = a ? Math.ceil(d.current?.getBoundingClientRect().width ?? 0) : 0, N = s ? Math.ceil(l.current?.getBoundingClientRect().width ?? 0) : 0, W = p.current;
52
+ (!(Object.keys(W.itemWidths).length === Object.keys(r).length && n.every((f) => W.itemWidths[f.id] === r[f.id])) || W.leadWidth !== u || W.actionWidth !== N) && v({
53
53
  itemWidths: r,
54
- leadWidth: m,
55
- actionWidth: g
54
+ leadWidth: u,
55
+ actionWidth: N
56
56
  });
57
57
  }, [
58
58
  n,
59
59
  a,
60
60
  s
61
61
  ]), {
62
- measurements: l,
63
- registerItemRef: p,
62
+ measurements: m,
63
+ registerItemRef: h,
64
64
  leadRef: d,
65
- actionRef: o
65
+ actionRef: l
66
66
  };
67
67
  }
68
68
  function U(i) {
69
69
  const { items: n, availableWidth: a, gapPx: s, itemWidths: t } = i, d = [];
70
- let o = 0;
71
- for (const l of A(n)) {
72
- const v = Math.max(0, t[l.id] ?? l.estimatedWidth ?? 0), f = d.length === 0 ? v : o + s + v;
73
- if (f > a) break;
74
- d.push(l), o = f;
70
+ let l = 0;
71
+ for (const m of A(n)) {
72
+ const v = Math.max(0, t[m.id] ?? m.estimatedWidth ?? 0), p = d.length === 0 ? v : l + s + v;
73
+ if (p > a) break;
74
+ d.push(m), l = p;
75
75
  }
76
76
  return d;
77
77
  }
78
- function C({ item: i, compact: n }) {
78
+ function b({ item: i, compact: n }) {
79
79
  return /* @__PURE__ */ e(D, { children: i.render({ compact: n }) });
80
80
  }
81
- function Y({ items: i, expanded: n, onToggleExpanded: a, leadSlot: s, actionSlot: t, className: d, leadReservePx: o = 140, actionReservePx: l = 44 }) {
82
- const { ref: v, width: f } = q(), p = !n, r = y(() => A(i), [i]), { measurements: m, registerItemRef: g, leadRef: W, actionRef: u } = K({
81
+ function Y({ items: i, expanded: n, onToggleExpanded: a, leadSlot: s, actionSlot: t, className: d, leadReservePx: l = 140, actionReservePx: m = 44 }) {
82
+ const { ref: v, width: p } = q(), h = !n, r = y(() => A(i), [i]), { measurements: u, registerItemRef: N, leadRef: W, actionRef: f } = K({
83
83
  items: r,
84
84
  leadSlot: s,
85
85
  actionSlot: t
86
- }), w = y(() => {
86
+ }), k = y(() => {
87
87
  if (n) return r;
88
- const c = 24, L = 24, B = s ? Math.max(o, m.leadWidth + 12) : 0, F = t ? Math.max(l, m.actionWidth) : 0;
88
+ const c = 24, L = 48, B = s ? Math.max(l, u.leadWidth + 12) : 0, F = t ? Math.max(m, u.actionWidth) : 0;
89
89
  return U({
90
90
  items: r,
91
- availableWidth: Math.max(0, f - c - L - B - F - 24),
91
+ availableWidth: Math.max(0, p - c - L - B - F),
92
92
  gapPx: 12,
93
- itemWidths: m.itemWidths
93
+ itemWidths: u.itemWidths
94
94
  });
95
95
  }, [
96
96
  n,
97
97
  r,
98
- f,
98
+ p,
99
99
  s,
100
100
  t,
101
- o,
102
101
  l,
103
- m
104
- ]), N = p && w.length < Math.min(2, r.length), E = N ? r.slice(0, 2) : w;
105
- return /* @__PURE__ */ I("div", {
102
+ m,
103
+ u
104
+ ]), w = h && k.length < Math.min(2, r.length), E = w ? r.slice(0, 2) : k;
105
+ return /* @__PURE__ */ R("div", {
106
106
  ref: v,
107
- className: b(h.root, "asma-pressable", p ? "overflow-hidden" : "overflow-visible", d),
107
+ className: g(o.root, "asma-pressable", h ? "overflow-hidden" : "overflow-visible", d),
108
108
  "aria-expanded": n,
109
109
  role: "button",
110
110
  tabIndex: 0,
@@ -113,34 +113,34 @@ function Y({ items: i, expanded: n, onToggleExpanded: a, leadSlot: s, actionSlot
113
113
  (c.key === "Enter" || c.key === " ") && (c.preventDefault(), a());
114
114
  },
115
115
  children: [
116
- /* @__PURE__ */ I("div", {
117
- className: b(h.shell, p ? h.shellCompact : h.shellExpanded),
116
+ /* @__PURE__ */ R("div", {
117
+ className: g(o.shell, h ? o.shellCompact : o.shellExpanded),
118
118
  children: [s ? /* @__PURE__ */ e("div", {
119
119
  className: "shrink-0",
120
120
  children: s
121
121
  }) : null, /* @__PURE__ */ e("div", {
122
- className: h.content,
123
- children: p ? /* @__PURE__ */ e("div", {
124
- className: b(h.compactItems, N && h.compactItemsStacked),
122
+ className: g(o.content, h && o.contentCompact),
123
+ children: h ? /* @__PURE__ */ e("div", {
124
+ className: g(o.compactItems, w && o.compactItemsStacked),
125
125
  children: E.map((c) => /* @__PURE__ */ e("div", {
126
- className: "shrink-0 whitespace-nowrap",
127
- children: /* @__PURE__ */ e(C, {
126
+ className: g("min-w-0 whitespace-nowrap", w ? "w-full" : "shrink"),
127
+ children: /* @__PURE__ */ e(b, {
128
128
  item: c,
129
- compact: p
129
+ compact: h
130
130
  })
131
131
  }, c.id))
132
- }) : /* @__PURE__ */ I("div", {
133
- className: h.expandedItems,
132
+ }) : /* @__PURE__ */ R("div", {
133
+ className: o.expandedItems,
134
134
  children: [r.map((c) => /* @__PURE__ */ e("div", {
135
135
  className: "shrink-0 whitespace-nowrap",
136
- children: /* @__PURE__ */ e(C, {
136
+ children: /* @__PURE__ */ e(b, {
137
137
  item: c,
138
- compact: p
138
+ compact: h
139
139
  })
140
140
  }, c.id)), t ? /* @__PURE__ */ e("div", {
141
141
  className: "shrink-0",
142
142
  children: /* @__PURE__ */ e("div", {
143
- ref: u,
143
+ ref: f,
144
144
  children: t
145
145
  })
146
146
  }) : null]
@@ -148,15 +148,15 @@ function Y({ items: i, expanded: n, onToggleExpanded: a, leadSlot: s, actionSlot
148
148
  })]
149
149
  }),
150
150
  /* @__PURE__ */ e("div", {
151
- className: h.chevron,
151
+ className: o.chevron,
152
152
  children: n ? /* @__PURE__ */ e(z, { className: "size-6" }) : /* @__PURE__ */ e(j, { className: "size-6" })
153
153
  }),
154
154
  /* @__PURE__ */ e("div", {
155
155
  "aria-hidden": !0,
156
156
  inert: "true",
157
- className: h.measureLayer,
158
- children: /* @__PURE__ */ I("div", {
159
- className: h.measureRow,
157
+ className: o.measureLayer,
158
+ children: /* @__PURE__ */ R("div", {
159
+ className: o.measureRow,
160
160
  children: [
161
161
  s ? /* @__PURE__ */ e("div", {
162
162
  className: "shrink-0",
@@ -166,9 +166,9 @@ function Y({ items: i, expanded: n, onToggleExpanded: a, leadSlot: s, actionSlot
166
166
  })
167
167
  }) : null,
168
168
  r.map((c) => /* @__PURE__ */ e("div", {
169
- ref: g(c.id),
169
+ ref: N(c.id),
170
170
  className: "shrink-0 whitespace-nowrap",
171
- children: /* @__PURE__ */ e(C, {
171
+ children: /* @__PURE__ */ e(b, {
172
172
  item: c,
173
173
  compact: !0
174
174
  })
@@ -176,7 +176,7 @@ function Y({ items: i, expanded: n, onToggleExpanded: a, leadSlot: s, actionSlot
176
176
  t ? /* @__PURE__ */ e("div", {
177
177
  className: "shrink-0",
178
178
  children: /* @__PURE__ */ e("div", {
179
- ref: u,
179
+ ref: f,
180
180
  children: t
181
181
  })
182
182
  }) : null
@@ -9,33 +9,16 @@ var g = 40, j = "relative box-border flex flex-col overflow-hidden rounded-lg bg
9
9
  return /* @__PURE__ */ l(_, { children: [
10
10
  /* @__PURE__ */ l("div", {
11
11
  className: "relative flex min-h-0 flex-1 flex-col",
12
- children: [
13
- t && /* @__PURE__ */ e("div", {
14
- id: m,
15
- className: "shrink-0 truncate pb-1 pl-4 pr-10 pt-2 text-lg font-semibold leading-7 text-delta-800",
16
- children: t
17
- }),
18
- /* @__PURE__ */ e("div", {
19
- ref: n,
20
- className: d("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto py-2 pl-4 [scrollbar-gutter:stable]", !t && s.overflows && "mt-10"),
21
- style: { paddingRight: Math.max(0, g - s.width) },
22
- children: p
23
- }),
24
- /* @__PURE__ */ e("div", {
25
- className: "absolute right-0 top-0",
26
- children: /* @__PURE__ */ e(h, {
27
- dataTest: `${a}-close`,
28
- variant: "textGray",
29
- type: "button",
30
- "aria-label": f,
31
- onClick: x,
32
- startIcon: /* @__PURE__ */ e(c, {
33
- width: 24,
34
- height: 24
35
- })
36
- })
37
- })
38
- ]
12
+ children: [t && /* @__PURE__ */ e("div", {
13
+ id: m,
14
+ className: "shrink-0 truncate pb-1 pl-4 pr-10 pt-2 text-lg font-semibold leading-7 text-delta-800",
15
+ children: t
16
+ }), /* @__PURE__ */ e("div", {
17
+ ref: n,
18
+ className: d("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto py-2 pl-4 [scrollbar-gutter:stable]", !t && s.overflows && "mt-10"),
19
+ style: { paddingRight: Math.max(0, g - s.width) },
20
+ children: p
21
+ })]
39
22
  }),
40
23
  (r ?? o) && /* @__PURE__ */ l("div", {
41
24
  className: d("flex shrink-0 items-start p-1", r ? "justify-between" : "justify-end"),
@@ -45,6 +28,20 @@ var g = 40, j = "relative box-border flex flex-col overflow-hidden rounded-lg bg
45
28
  className: "flex shrink-0 flex-col items-end p-3",
46
29
  children: i
47
30
  }),
31
+ /* @__PURE__ */ e("div", {
32
+ className: "absolute right-0 top-0",
33
+ children: /* @__PURE__ */ e(h, {
34
+ dataTest: `${a}-close`,
35
+ variant: "textGray",
36
+ type: "button",
37
+ "aria-label": f,
38
+ onClick: x,
39
+ startIcon: /* @__PURE__ */ e(c, {
40
+ width: 24,
41
+ height: 24
42
+ })
43
+ })
44
+ }),
48
45
  /* @__PURE__ */ e("span", {
49
46
  "aria-hidden": !0,
50
47
  "data-test": `${a}-edge`,
@@ -77,6 +77,14 @@ export type StyledTableProps<TData, TCustomData> = {
77
77
  customActionsNode?: (row: CellContext<TData, unknown>) => ReactNode;
78
78
  customSubRowData?: Map<string, TCustomData[]>;
79
79
  headerPin?: boolean;
80
+ /**
81
+ * Pins the internal actions column's body cells to the right edge. By default they are pinned
82
+ * when the column renders actions (`actions` / `customActionsNode`) or the table has fixed-right
83
+ * columns; a column that only hosts the header pin menu scrolls with the data. The header cell
84
+ * with the pin menu stays pinned either way. Not supported as `false` together with fixed-right
85
+ * columns: their body and header offsets would no longer match.
86
+ */
87
+ stickyActions?: boolean;
80
88
  expandArrow?: boolean;
81
89
  defaultExpanded?: boolean;
82
90
  loading?: boolean;
@@ -1,57 +1,53 @@
1
- import { ACTIONS_COLUMN_ID as q, INTERNAL_COLUMN_IDS as pe } from "../types.js";
2
- import { useRootContext as xe } from "../context/RootContext.js";
1
+ import { ACTIONS_COLUMN_ID as w, INTERNAL_COLUMN_IDS as Re } from "../types.js";
2
+ import { useRootContext as Se } from "../context/RootContext.js";
3
3
  import n from "./StyledTable.module.js";
4
- import { compact as be } from "../../helpers/arrays.js";
5
- import K from "clsx";
6
- import { Fragment as Ce, useCallback as G, useEffect as Re, useLayoutEffect as Se, useMemo as m, useRef as De, useState as Ne } from "react";
7
- import { Fragment as ve, jsx as s, jsxs as C } from "react/jsx-runtime";
8
- import { useSortable as ye } from "@dnd-kit/sortable";
9
- import { flexRender as Ee } from "@tanstack/react-table";
10
- import { CSS as Ie } from "@dnd-kit/utilities";
11
- var Fe = (R) => {
12
- const t = R.closest("table");
13
- if (!t) return !1;
14
- const r = Array.from(document.querySelectorAll('a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])')).find((g) => !t.contains(g) && !!(t.compareDocumentPosition(g) & Node.DOCUMENT_POSITION_FOLLOWING));
15
- return r ? (r.focus(), document.activeElement === r) : !1;
4
+ import { compact as De } from "../../helpers/arrays.js";
5
+ import V from "clsx";
6
+ import { Fragment as Ne, useCallback as Y, useEffect as ve, useLayoutEffect as Ee, useMemo as R, useRef as Ie, useState as ye } from "react";
7
+ import { Fragment as Te, jsx as s, jsxs as S } from "react/jsx-runtime";
8
+ import { useSortable as ke } from "@dnd-kit/sortable";
9
+ import { flexRender as Fe } from "@tanstack/react-table";
10
+ import { CSS as Ae } from "@dnd-kit/utilities";
11
+ var J = (D, t) => {
12
+ const g = D.closest("table");
13
+ if (!g) return !1;
14
+ const N = t === "next" ? Node.DOCUMENT_POSITION_FOLLOWING : Node.DOCUMENT_POSITION_PRECEDING, r = Array.from(document.querySelectorAll('a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])')).filter((p) => !g.contains(p) && !!(g.compareDocumentPosition(p) & N)), l = t === "next" ? r[0] : r.at(-1);
15
+ return l ? (l.focus(), document.activeElement === l) : !1;
16
16
  };
17
- function We({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWindow: { paddingLeft: h, paddingRight: p, indexes: T } }) {
18
- const { loading: V, getRowClassName: l, activeRowId: L, rowHeight: x, onRowClick: S, expandArrow: Y, enableDnd: w, disableDndForRow: J, tdClassName: A, customSubRowData: M, renderSubRows: Q, defaultExpanded: X, actions: D, customActionsNode: Z, textExpandArrow: B, enableMultiRowSelection: ee, enableRowSelection: te, singleSelectionRow: ne } = R, N = J?.(t), { transform: ie, transition: oe, setNodeRef: O, isDragging: _ } = ye({
17
+ function je({ styledTableProps: D, row: t, index: g, hasFocusedRow: N, columnWindow: { paddingLeft: r, paddingRight: l, indexes: p } }) {
18
+ const { loading: Q, getRowClassName: a, activeRowId: _, rowHeight: x, onRowClick: v, expandArrow: X, enableDnd: B, disableDndForRow: Z, tdClassName: H, customSubRowData: U, renderSubRows: ee, defaultExpanded: te, actions: E, customActionsNode: ne, stickyActions: ie, textExpandArrow: z, enableMultiRowSelection: oe, enableRowSelection: se, singleSelectionRow: le } = D, I = Z?.(t), { transform: ae, transition: ce, setNodeRef: W, isDragging: P } = ke({
19
19
  id: t.original.id,
20
- disabled: !w || N
21
- }), se = {
22
- transform: Ie.Transform.toString(ie),
23
- transition: oe,
24
- opacity: _ ? 0.8 : 1,
25
- zIndex: _ ? 1 : 0,
20
+ disabled: !B || I
21
+ }), de = {
22
+ transform: Ae.Transform.toString(ae),
23
+ transition: ce,
24
+ opacity: P ? 0.8 : 1,
25
+ zIndex: P ? 1 : 0,
26
26
  position: "relative"
27
- }, { isResizing: le, disableResizingFlag: ae } = xe(), v = t.isExpanded(), b = De(null), [ce, de] = Ne(void 0);
28
- Se(() => {
29
- !v && b.current && de(b.current.cells[0]?.clientHeight ?? b.current.offsetHeight);
30
- }, [v]);
31
- const re = G((e) => {
32
- b.current = e, N || O(e);
33
- }, [N, O]), H = v ? ce ?? x : x;
34
- Re(() => {
35
- X && t.getCanExpand() && !t.getIsExpanded() && t.toggleExpand();
27
+ }, { isResizing: re, disableResizingFlag: ue } = Se(), y = t.isExpanded(), C = Ie(null), [fe, me] = ye(void 0);
28
+ Ee(() => {
29
+ !y && C.current && me(C.current.cells[0]?.clientHeight ?? C.current.offsetHeight);
30
+ }, [y]);
31
+ const ge = Y((e) => {
32
+ C.current = e, I || W(e);
33
+ }, [I, W]), $ = y ? fe ?? x : x;
34
+ ve(() => {
35
+ te && t.getCanExpand() && !t.getIsExpanded() && t.toggleExpand();
36
36
  }, []);
37
- const U = (e) => {
38
- t.getCanExpand() && !Y && t.getToggleExpandedHandler()(), document.getElementById(t.id)?.focus();
39
- const i = window.getSelection()?.type !== "Range" && !le, o = S instanceof Function;
40
- !o && B && i ? t.toggleExpand() : o && i && S(e, t), ae();
41
- }, ue = (e) => {
42
- e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") || U(e);
43
- }, fe = (e) => {
37
+ const j = (e) => {
38
+ t.getCanExpand() && !X && t.getToggleExpandedHandler()(), document.getElementById(t.id)?.focus();
39
+ const i = window.getSelection()?.type !== "Range" && !re, o = v instanceof Function;
40
+ !o && z && i ? t.toggleExpand() : o && i && v(e, t), ue();
41
+ }, he = (e) => {
42
+ e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") || j(e);
43
+ }, pe = (e) => {
44
44
  if (e.target === e.currentTarget)
45
45
  switch (e.key) {
46
46
  case "Tab":
47
47
  if (e.shiftKey) {
48
- if (t.focusPrevRow()) {
49
- e.preventDefault();
50
- break;
51
- }
52
48
  const i = e.currentTarget.closest("table")?.querySelector('thead tr[tabindex="0"]');
53
- i && (e.preventDefault(), i.focus());
54
- } else (t.focusNextRow() || Fe(e.currentTarget)) && e.preventDefault();
49
+ i ? (e.preventDefault(), i.focus()) : J(e.currentTarget, "prev") && e.preventDefault();
50
+ } else J(e.currentTarget, "next") && e.preventDefault();
55
51
  break;
56
52
  case "ArrowDown":
57
53
  t.focusNextRow() && e.preventDefault();
@@ -60,32 +56,32 @@ function We({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
60
56
  t.focusPrevRow() && e.preventDefault();
61
57
  break;
62
58
  case "Enter":
63
- e.preventDefault(), U(e);
59
+ e.preventDefault(), j(e);
64
60
  break;
65
61
  }
66
- }, u = t.getVisibleCells().map((e, i, o) => ({
62
+ }, c = t.getVisibleCells().map((e, i, o) => ({
67
63
  ...e,
68
- left: o.slice(0, i).reduce((c, d) => c + (d.column.getSize() ?? 0), 0)
69
- })), z = m(() => u.filter((e) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), [u]), a = m(() => u.filter((e) => !!e.column.columnDef.fixedRight || e.column.id === "actions").map((e, i, o) => ({
64
+ left: o.slice(0, i).reduce((f, m) => f + (m.column.getSize() ?? 0), 0)
65
+ })), T = !!E || !!ne, k = c.some((e) => !!e.column.columnDef.fixedRight), d = ie ?? (T || k), q = R(() => c.filter((e) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), [c]), h = R(() => c.filter((e) => !!e.column.columnDef.fixedRight || e.column.id === "actions" && d).map((e, i, o) => ({
70
66
  ...e,
71
- right: o.slice(i + 1).reduce((c, d) => c + (d.column.getSize() ?? 0), 0)
72
- })), [u]), W = m(() => a.some((e) => e.column.id === q), [a]), P = !!D || !!Z, $ = m(() => a.some((e) => !!e.column.columnDef.fixedRight), [a]), f = m(() => u.filter((e) => e.column.columnDef.fixedLeft), [u]), y = !ee && !te && ne, E = t.getIsSelected() && y, I = S instanceof Function, j = T.length > 0 ? be(T.map((e) => z[e])) : z, F = G((e, i) => {
73
- const o = e.column.id === q, c = e.column.columnDef.fixedLeft, d = !!e.column.columnDef.fixedRight, me = e.id === f.at(-1)?.id, ge = e.id === a.at(0)?.id && !o, he = t.isExpanded(), k = i === 0;
67
+ right: o.slice(i + 1).reduce((f, m) => f + (m.column.getSize() ?? 0), 0)
68
+ })), [c, d]), G = R(() => h.some((e) => e.column.id === w), [h]), K = d ? void 0 : c.find((e) => e.column.id === w), u = R(() => c.filter((e) => e.column.columnDef.fixedLeft), [c]), F = !oe && !se && le, A = t.getIsSelected() && F, L = v instanceof Function, M = p.length > 0 ? De(p.map((e) => q[e])) : q, b = Y((e, i) => {
69
+ const o = e.column.id === w, f = e.column.columnDef.fixedLeft, m = !!e.column.columnDef.fixedRight, xe = e.id === u.at(-1)?.id, Ce = e.id === h.at(0)?.id && !o, be = t.isExpanded(), O = i === 0;
74
70
  return /* @__PURE__ */ s("td", {
75
- className: K(n["t-cell"], !pe.includes(e.column.id) && e.column.getSize() > 64 && n["data-cell"], e.column.id === "select" && n["select-cell"], I && "cursor-pointer", A, o && n["action-cell"], o && (!P || $) && n["action-cell--no-shadow"], o && !!D && f.length && n.shadowed, o && (l?.(t) ? l?.(t) : n["action-cell-default-background"]), c && n["fixed-cell"], d && n["fixed-right-cell"], me && n.shadowed, ge && n["shadowed-right"], t.getIsSelected() && n.selected, c && (l?.(t) ? l?.(t) : n["fixed-cell-default-background"]), d && (l?.(t) ? l?.(t) : n["fixed-right-cell-default-background"]), he && n.expanded_row, !!E && n["single-selection"]),
71
+ className: V(n["t-cell"], !Re.includes(e.column.id) && e.column.getSize() > 64 && n["data-cell"], e.column.id === "select" && n["select-cell"], L && "cursor-pointer", H, o && d && n["action-cell"], o && d && (!T || k) && n["action-cell--no-shadow"], o && d && !!E && u.length && n.shadowed, o && d && (a?.(t) ? a?.(t) : n["action-cell-default-background"]), f && n["fixed-cell"], m && n["fixed-right-cell"], xe && n.shadowed, Ce && n["shadowed-right"], t.getIsSelected() && n.selected, f && (a?.(t) ? a?.(t) : n["fixed-cell-default-background"]), m && (a?.(t) ? a?.(t) : n["fixed-right-cell-default-background"]), be && n.expanded_row, !!A && n["single-selection"]),
76
72
  style: {
77
- left: c ? e.left : void 0,
78
- right: d ? e.right + (W ? -1 : 0) : void 0
73
+ left: f ? e.left : void 0,
74
+ right: m ? e.right + (G ? -1 : 0) : void 0
79
75
  },
80
- children: /* @__PURE__ */ C("div", {
76
+ children: /* @__PURE__ */ S("div", {
81
77
  style: {
82
78
  display: "flex",
83
79
  alignItems: "center",
84
- minWidth: k ? 32 : void 0,
85
- minHeight: H,
80
+ minWidth: O ? 32 : void 0,
81
+ minHeight: $,
86
82
  position: "relative"
87
83
  },
88
- children: [k && E && /* @__PURE__ */ s("span", {
84
+ children: [O && A && /* @__PURE__ */ s("span", {
89
85
  style: {
90
86
  display: "inline-flex",
91
87
  alignItems: "center",
@@ -94,85 +90,87 @@ function We({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
94
90
  top: "50%",
95
91
  transform: "translateY(-50%)"
96
92
  },
97
- children: /* @__PURE__ */ s(ke, {})
93
+ children: /* @__PURE__ */ s(Le, {})
98
94
  }), /* @__PURE__ */ s("span", {
99
95
  style: {
100
- marginLeft: k && y ? 30 : 0,
96
+ marginLeft: O && F ? 30 : 0,
101
97
  width: "100%"
102
98
  },
103
- children: Ee(e.column.columnDef.cell, e.getContext())
99
+ children: Fe(e.column.columnDef.cell, e.getContext())
104
100
  })]
105
101
  })
106
102
  }, e.id);
107
103
  }, [
104
+ A,
108
105
  E,
109
- D,
110
- H,
111
- l,
112
- I,
113
- W,
114
106
  $,
115
- f,
116
107
  a,
108
+ L,
109
+ G,
110
+ k,
111
+ u,
112
+ h,
117
113
  t,
118
- P,
119
- y,
120
- A
114
+ T,
115
+ d,
116
+ F,
117
+ H
121
118
  ]);
122
- return /* @__PURE__ */ C(Ce, { children: [/* @__PURE__ */ C("tr", {
119
+ return /* @__PURE__ */ S(Ne, { children: [/* @__PURE__ */ S("tr", {
123
120
  "aria-selected": t.getIsSelected() || t.isFocused() ? "true" : "false",
124
- tabIndex: t.isFocused() || r === 0 && !g ? 0 : -1,
125
- "data-index": r,
121
+ tabIndex: t.isFocused() || g === 0 && !N ? 0 : -1,
122
+ "data-index": g,
126
123
  "data-test": t.id,
127
- "data-active": L != null && t.id === L ? "true" : void 0,
124
+ "data-active": _ != null && t.id === _ ? "true" : void 0,
128
125
  id: t.id,
129
- className: K(n["t-row"], V && n["is-loading"], l?.(t)),
126
+ className: V(n["t-row"], Q && n["is-loading"], a?.(t)),
130
127
  style: {
131
128
  height: x ? `${x}px` : "inherit",
132
- ...w && se
129
+ ...B && de
133
130
  },
134
- ref: re,
131
+ ref: ge,
135
132
  onFocus: (e) => {
136
133
  e.target === e.currentTarget && !t.isFocused() && t.onChangeFocused(!0);
137
134
  },
138
- onMouseUp: ue,
135
+ onMouseUp: he,
139
136
  onMouseDown: (e) => {
140
- e.detail > 1 && !I && B && e.preventDefault();
137
+ e.detail > 1 && !L && z && e.preventDefault();
141
138
  },
142
- onKeyDownCapture: fe,
139
+ onKeyDownCapture: pe,
143
140
  children: [
144
- f.map((e, i) => F(e, i)),
145
- h > 0 && /* @__PURE__ */ s("td", {
141
+ u.map((e, i) => b(e, i)),
142
+ r > 0 && /* @__PURE__ */ s("td", {
146
143
  "aria-hidden": !0,
147
144
  className: n["t-cell"],
148
145
  style: {
149
- width: String(h) + "px",
150
- minWidth: String(h) + "px",
151
- maxWidth: String(h) + "px",
146
+ width: String(r) + "px",
147
+ minWidth: String(r) + "px",
148
+ maxWidth: String(r) + "px",
152
149
  padding: 0,
153
150
  border: "none"
154
151
  }
155
152
  }),
156
- j.map((e, i) => F(e, f.length + i)),
157
- p > 0 && /* @__PURE__ */ s("td", {
153
+ M.map((e, i) => b(e, u.length + i)),
154
+ l > 0 && /* @__PURE__ */ s("td", {
158
155
  "aria-hidden": !0,
159
156
  className: n["t-cell"],
160
157
  style: {
161
- width: String(p) + "px",
162
- minWidth: String(p) + "px",
163
- maxWidth: String(p) + "px",
158
+ width: String(l) + "px",
159
+ minWidth: String(l) + "px",
160
+ maxWidth: String(l) + "px",
164
161
  padding: 0,
165
162
  border: "none"
166
163
  }
167
164
  }),
168
- a.map((e, i) => F(e, f.length + j.length + i))
165
+ h.map((e, i) => b(e, u.length + M.length + i)),
166
+ K && b(K, u.length + M.length + h.length)
169
167
  ]
170
- }), t.getIsExpanded() && /* @__PURE__ */ s(ve, { children: M && Q?.({
171
- rows: M.get(t.original.id.toString()) ?? [],
168
+ }), t.getIsExpanded() && /* @__PURE__ */ s(Te, { children: U && ee?.({
169
+ rows: U.get(t.original.id.toString()) ?? [],
172
170
  row: t.original
173
171
  }) })] }, t.id);
174
172
  }
175
- var ke = () => /* @__PURE__ */ C("svg", {
173
+ var Le = () => /* @__PURE__ */ S("svg", {
176
174
  xmlns: "http://www.w3.org/2000/svg",
177
175
  width: "20",
178
176
  height: "20",
@@ -184,5 +182,5 @@ var ke = () => /* @__PURE__ */ C("svg", {
184
182
  })]
185
183
  });
186
184
  export {
187
- We as TableRow
185
+ je as TableRow
188
186
  };