asma-ui-core 3.96.0 → 3.98.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/dist/asma-ui-core.css +1 -1
- package/dist/components/inputs/input-field/StyledInputField.js +89 -84
- package/dist/components/inputs/input-field/StyledInputField.module.js +3 -3
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.module.js +3 -3
- package/dist/components/utils/popover/PopoverSheet.js +40 -40
- package/dist/src/table/types.d.ts +7 -0
- package/dist/table/components/StyledTable.module.js +53 -53
- package/dist/table/components/TableRow.js +66 -65
- package/package.json +1 -1
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { ACTIONS_COLUMN_ID as
|
|
2
|
-
import { useRootContext as
|
|
1
|
+
import { ACTIONS_COLUMN_ID as q } from "../types.js";
|
|
2
|
+
import { useRootContext as pe } from "../context/RootContext.js";
|
|
3
3
|
import n from "./StyledTable.module.js";
|
|
4
|
-
import { compact as
|
|
5
|
-
import
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { useSortable as
|
|
9
|
-
import { flexRender as
|
|
10
|
-
import { CSS as
|
|
11
|
-
var
|
|
4
|
+
import { compact as xe } from "../../helpers/arrays.js";
|
|
5
|
+
import K from "clsx";
|
|
6
|
+
import { Fragment as be, useCallback as G, useEffect as Ce, useLayoutEffect as Re, useMemo as m, useRef as Se, useState as De } 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 Ne } from "@tanstack/react-table";
|
|
10
|
+
import { CSS as Fe } from "@dnd-kit/utilities";
|
|
11
|
+
var ke = (R) => {
|
|
12
12
|
const t = R.closest("table");
|
|
13
13
|
if (!t) return !1;
|
|
14
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
15
|
return r ? (r.focus(), document.activeElement === r) : !1;
|
|
16
16
|
};
|
|
17
|
-
function
|
|
18
|
-
const { loading:
|
|
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: w, rowHeight: x, onRowClick: S, expandArrow: Y, enableDnd: A, disableDndForRow: J, tdClassName: B, customSubRowData: L, renderSubRows: Q, defaultExpanded: X, actions: D, customActionsNode: Z, textExpandArrow: M, enableMultiRowSelection: ee, enableRowSelection: te, singleSelectionRow: ne } = R, v = J?.(t), { transform: ie, transition: oe, setNodeRef: H, isDragging: O } = ye({
|
|
19
19
|
id: t.original.id,
|
|
20
|
-
disabled: !
|
|
21
|
-
}),
|
|
22
|
-
transform:
|
|
20
|
+
disabled: !A || v
|
|
21
|
+
}), se = {
|
|
22
|
+
transform: Fe.Transform.toString(ie),
|
|
23
23
|
transition: oe,
|
|
24
|
-
opacity:
|
|
25
|
-
zIndex:
|
|
24
|
+
opacity: O ? 0.8 : 1,
|
|
25
|
+
zIndex: O ? 1 : 0,
|
|
26
26
|
position: "relative"
|
|
27
|
-
}, { isResizing:
|
|
28
|
-
|
|
29
|
-
!y && b.current &&
|
|
27
|
+
}, { isResizing: le, disableResizingFlag: ae } = pe(), y = t.isExpanded(), b = Se(null), [ce, de] = De(void 0);
|
|
28
|
+
Re(() => {
|
|
29
|
+
!y && b.current && de(b.current.cells[0]?.clientHeight ?? b.current.offsetHeight);
|
|
30
30
|
}, [y]);
|
|
31
|
-
const
|
|
32
|
-
b.current = e, v ||
|
|
33
|
-
}, [v,
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
const re = G((e) => {
|
|
32
|
+
b.current = e, v || H(e);
|
|
33
|
+
}, [v, H]), U = y ? ce ?? x : x;
|
|
34
|
+
Ce(() => {
|
|
35
|
+
X && t.getCanExpand() && !t.getIsExpanded() && t.toggleExpand();
|
|
36
36
|
}, []);
|
|
37
|
-
const
|
|
38
|
-
t.getCanExpand() && !
|
|
39
|
-
const
|
|
40
|
-
!
|
|
41
|
-
}, re = (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);
|
|
37
|
+
const W = (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 && M && i ? t.toggleExpand() : o && i && S(e, t), ae();
|
|
43
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") || W(e);
|
|
43
|
+
}, fe = (e) => {
|
|
44
44
|
if (e.target === e.currentTarget)
|
|
45
45
|
switch (e.key) {
|
|
46
46
|
case "Tab":
|
|
@@ -49,9 +49,9 @@ function Ue({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
49
49
|
e.preventDefault();
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
} else (t.focusNextRow() ||
|
|
52
|
+
const i = e.currentTarget.closest("table")?.querySelector('thead tr[tabindex="0"]');
|
|
53
|
+
i && (e.preventDefault(), i.focus());
|
|
54
|
+
} else (t.focusNextRow() || ke(e.currentTarget)) && e.preventDefault();
|
|
55
55
|
break;
|
|
56
56
|
case "ArrowDown":
|
|
57
57
|
t.focusNextRow() && e.preventDefault();
|
|
@@ -60,29 +60,29 @@ function Ue({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
60
60
|
t.focusPrevRow() && e.preventDefault();
|
|
61
61
|
break;
|
|
62
62
|
case "Enter":
|
|
63
|
-
e.preventDefault(),
|
|
63
|
+
e.preventDefault(), W(e);
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
|
-
}, u = t.getVisibleCells().map((e,
|
|
66
|
+
}, u = t.getVisibleCells().map((e, i, o) => ({
|
|
67
67
|
...e,
|
|
68
|
-
left:
|
|
69
|
-
})),
|
|
68
|
+
left: o.slice(0, i).reduce((c, d) => c + (d.column.getSize() ?? 0), 0)
|
|
69
|
+
})), _ = 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) => ({
|
|
70
70
|
...e,
|
|
71
|
-
right:
|
|
72
|
-
})), [u]),
|
|
73
|
-
const
|
|
71
|
+
right: o.slice(i + 1).reduce((c, d) => c + (d.column.getSize() ?? 0), 0)
|
|
72
|
+
})), [u]), z = 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]), N = !ee && !te && ne, F = t.getIsSelected() && N, k = S instanceof Function, j = T.length > 0 ? xe(T.map((e) => _[e])) : _, E = 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(), I = i === 0;
|
|
74
74
|
return /* @__PURE__ */ s("td", {
|
|
75
|
-
className:
|
|
75
|
+
className: K(n["t-cell"], k && "cursor-pointer", B, 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, !!F && n["single-selection"]),
|
|
76
76
|
style: {
|
|
77
77
|
left: c ? e.left : void 0,
|
|
78
|
-
right: d ? e.right + (
|
|
78
|
+
right: d ? e.right + (z ? -1 : 0) : void 0
|
|
79
79
|
},
|
|
80
80
|
children: /* @__PURE__ */ C("div", {
|
|
81
81
|
style: {
|
|
82
82
|
display: "flex",
|
|
83
83
|
alignItems: "center",
|
|
84
84
|
minWidth: I ? 32 : void 0,
|
|
85
|
-
minHeight:
|
|
85
|
+
minHeight: U,
|
|
86
86
|
position: "relative"
|
|
87
87
|
},
|
|
88
88
|
children: [I && F && /* @__PURE__ */ s("span", {
|
|
@@ -94,53 +94,54 @@ function Ue({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
94
94
|
top: "50%",
|
|
95
95
|
transform: "translateY(-50%)"
|
|
96
96
|
},
|
|
97
|
-
children: /* @__PURE__ */ s(
|
|
97
|
+
children: /* @__PURE__ */ s(Ee, {})
|
|
98
98
|
}), /* @__PURE__ */ s("span", {
|
|
99
99
|
style: {
|
|
100
100
|
marginLeft: I && N ? 30 : 0,
|
|
101
101
|
width: "100%"
|
|
102
102
|
},
|
|
103
|
-
children:
|
|
103
|
+
children: Ne(e.column.columnDef.cell, e.getContext())
|
|
104
104
|
})]
|
|
105
105
|
})
|
|
106
106
|
}, e.id);
|
|
107
107
|
}, [
|
|
108
108
|
F,
|
|
109
109
|
D,
|
|
110
|
-
|
|
110
|
+
U,
|
|
111
111
|
l,
|
|
112
112
|
k,
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
z,
|
|
114
|
+
$,
|
|
115
115
|
f,
|
|
116
116
|
a,
|
|
117
117
|
t,
|
|
118
|
-
|
|
118
|
+
P,
|
|
119
119
|
N,
|
|
120
|
-
|
|
120
|
+
B
|
|
121
121
|
]);
|
|
122
|
-
return /* @__PURE__ */ C(
|
|
122
|
+
return /* @__PURE__ */ C(be, { children: [/* @__PURE__ */ C("tr", {
|
|
123
123
|
"aria-selected": t.getIsSelected() || t.isFocused() ? "true" : "false",
|
|
124
124
|
tabIndex: t.isFocused() || r === 0 && !g ? 0 : -1,
|
|
125
125
|
"data-index": r,
|
|
126
126
|
"data-test": t.id,
|
|
127
|
+
"data-active": w != null && t.id === w ? "true" : void 0,
|
|
127
128
|
id: t.id,
|
|
128
|
-
className:
|
|
129
|
+
className: K(n["t-row"], V && n["is-loading"], l?.(t)),
|
|
129
130
|
style: {
|
|
130
131
|
height: x ? `${x}px` : "inherit",
|
|
131
|
-
...
|
|
132
|
+
...A && se
|
|
132
133
|
},
|
|
133
|
-
ref:
|
|
134
|
+
ref: re,
|
|
134
135
|
onFocus: (e) => {
|
|
135
136
|
e.target === e.currentTarget && !t.isFocused() && t.onChangeFocused(!0);
|
|
136
137
|
},
|
|
137
|
-
onMouseUp:
|
|
138
|
+
onMouseUp: ue,
|
|
138
139
|
onMouseDown: (e) => {
|
|
139
|
-
e.detail > 1 && !k &&
|
|
140
|
+
e.detail > 1 && !k && M && e.preventDefault();
|
|
140
141
|
},
|
|
141
|
-
onKeyDownCapture:
|
|
142
|
+
onKeyDownCapture: fe,
|
|
142
143
|
children: [
|
|
143
|
-
f.map((e,
|
|
144
|
+
f.map((e, i) => E(e, i)),
|
|
144
145
|
h > 0 && /* @__PURE__ */ s("td", {
|
|
145
146
|
"aria-hidden": !0,
|
|
146
147
|
className: n["t-cell"],
|
|
@@ -152,7 +153,7 @@ function Ue({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
152
153
|
border: "none"
|
|
153
154
|
}
|
|
154
155
|
}),
|
|
155
|
-
|
|
156
|
+
j.map((e, i) => E(e, f.length + i)),
|
|
156
157
|
p > 0 && /* @__PURE__ */ s("td", {
|
|
157
158
|
"aria-hidden": !0,
|
|
158
159
|
className: n["t-cell"],
|
|
@@ -164,14 +165,14 @@ function Ue({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
164
165
|
border: "none"
|
|
165
166
|
}
|
|
166
167
|
}),
|
|
167
|
-
a.map((e,
|
|
168
|
+
a.map((e, i) => E(e, f.length + j.length + i))
|
|
168
169
|
]
|
|
169
|
-
}), t.getIsExpanded() && /* @__PURE__ */ s(
|
|
170
|
-
rows:
|
|
170
|
+
}), t.getIsExpanded() && /* @__PURE__ */ s(ve, { children: L && Q?.({
|
|
171
|
+
rows: L.get(t.original.id.toString()) ?? [],
|
|
171
172
|
row: t.original
|
|
172
173
|
}) })] }, t.id);
|
|
173
174
|
}
|
|
174
|
-
var
|
|
175
|
+
var Ee = () => /* @__PURE__ */ C("svg", {
|
|
175
176
|
xmlns: "http://www.w3.org/2000/svg",
|
|
176
177
|
width: "20",
|
|
177
178
|
height: "20",
|
|
@@ -183,5 +184,5 @@ var ke = () => /* @__PURE__ */ C("svg", {
|
|
|
183
184
|
})]
|
|
184
185
|
});
|
|
185
186
|
export {
|
|
186
|
-
|
|
187
|
+
We as TableRow
|
|
187
188
|
};
|