asma-ui-core 3.69.0 → 3.70.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.
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
import { ChevronDownIcon as b } from "../../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
2
|
-
import
|
|
2
|
+
import e from "./StyledAccordion.module.js";
|
|
3
3
|
import { useAccordionContext as A } from "./AccordionContext.js";
|
|
4
|
-
import
|
|
4
|
+
import o from "clsx";
|
|
5
5
|
import "react";
|
|
6
|
-
import { Fragment as c, jsx as
|
|
7
|
-
var _ = ({ size:
|
|
8
|
-
const { open: a, toggle: u, disabled:
|
|
9
|
-
"--trigger-height":
|
|
10
|
-
"--trigger-padding-x":
|
|
11
|
-
"--trigger-font-size":
|
|
12
|
-
"--chevron-size":
|
|
6
|
+
import { Fragment as c, jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
var _ = ({ size: d = "large", expandChevronRight: i, className: g, headerClassName: m, sx: p, children: n, onClick: x, ...h }) => {
|
|
8
|
+
const { open: a, toggle: u, disabled: f, triggerId: y, panelId: I } = A(), r = d === "small", v = {
|
|
9
|
+
"--trigger-height": r ? "48px" : "72px",
|
|
10
|
+
"--trigger-padding-x": r ? "8px" : "16px",
|
|
11
|
+
"--trigger-font-size": r ? "14px" : "18px",
|
|
12
|
+
"--chevron-size": r ? "20px" : "24px",
|
|
13
13
|
...p
|
|
14
|
-
},
|
|
15
|
-
className:
|
|
14
|
+
}, s = /* @__PURE__ */ t(b, {
|
|
15
|
+
className: o(e.TriggerIcon, i && e.TriggerIconRight),
|
|
16
16
|
"data-state-icon": !0
|
|
17
|
-
}), s = /* @__PURE__ */ o("span", {
|
|
18
|
-
className: "m-0 flex flex-grow items-center",
|
|
19
|
-
children: x
|
|
20
17
|
});
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
className:
|
|
23
|
-
children: /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ t("h3", {
|
|
19
|
+
className: o(e.Header, m),
|
|
20
|
+
children: /* @__PURE__ */ t("button", {
|
|
24
21
|
...h,
|
|
25
22
|
type: "button",
|
|
26
|
-
id:
|
|
23
|
+
id: y,
|
|
27
24
|
"aria-expanded": a,
|
|
28
|
-
"aria-controls":
|
|
29
|
-
disabled:
|
|
25
|
+
"aria-controls": I,
|
|
26
|
+
disabled: f,
|
|
30
27
|
onClick: (S) => {
|
|
31
|
-
|
|
28
|
+
x?.(S), u();
|
|
32
29
|
},
|
|
33
|
-
className:
|
|
34
|
-
style:
|
|
30
|
+
className: o(e.Trigger, g),
|
|
31
|
+
style: v,
|
|
35
32
|
"data-panel-open": a ? "" : void 0,
|
|
36
|
-
children:
|
|
33
|
+
children: i ? /* @__PURE__ */ l(c, { children: [n, s] }) : /* @__PURE__ */ l(c, { children: [s, n] })
|
|
37
34
|
})
|
|
38
35
|
});
|
|
39
36
|
};
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { ACTIONS_COLUMN_ID as
|
|
2
|
-
import { useRootContext as
|
|
1
|
+
import { ACTIONS_COLUMN_ID as O } from "../types.js";
|
|
2
|
+
import { useRootContext as ue } 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
|
-
function Me({ styledTableProps:
|
|
12
|
-
const { loading:
|
|
4
|
+
import { compact as fe } from "../../helpers/arrays.js";
|
|
5
|
+
import $ from "clsx";
|
|
6
|
+
import { Fragment as he, useCallback as j, useEffect as pe, useLayoutEffect as xe, useMemo as g, useRef as Ce, useState as Re } from "react";
|
|
7
|
+
import { Fragment as Se, jsx as s, jsxs as x } from "react/jsx-runtime";
|
|
8
|
+
import { useSortable as be } from "@dnd-kit/sortable";
|
|
9
|
+
import { flexRender as De } from "@tanstack/react-table";
|
|
10
|
+
import { CSS as ke } from "@dnd-kit/utilities";
|
|
11
|
+
function Me({ styledTableProps: P, row: t, index: K, columnWindow: { paddingLeft: u, paddingRight: f, indexes: v } }) {
|
|
12
|
+
const { loading: V, getRowClassName: l, rowHeight: h, onRowClick: C, expandArrow: Y, enableDnd: N, disableDndForRow: q, tdClassName: I, customSubRowData: w, renderSubRows: G, defaultExpanded: J, actions: R, customActionsNode: Q, textExpandArrow: B, enableMultiRowSelection: X, enableRowSelection: Z, singleSelectionRow: ee } = P, S = q?.(t), { transform: te, transition: ne, setNodeRef: A, isDragging: H } = be({
|
|
13
13
|
id: t.original.id,
|
|
14
|
-
disabled: !
|
|
15
|
-
}),
|
|
16
|
-
transform:
|
|
17
|
-
transition:
|
|
18
|
-
opacity:
|
|
19
|
-
zIndex:
|
|
14
|
+
disabled: !N || S
|
|
15
|
+
}), ie = {
|
|
16
|
+
transform: ke.Transform.toString(te),
|
|
17
|
+
transition: ne,
|
|
18
|
+
opacity: H ? 0.8 : 1,
|
|
19
|
+
zIndex: H ? 1 : 0,
|
|
20
20
|
position: "relative"
|
|
21
|
-
}, { isResizing:
|
|
22
|
-
|
|
23
|
-
!
|
|
24
|
-
}, [
|
|
25
|
-
const
|
|
26
|
-
p.current = e,
|
|
27
|
-
}, [
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
}, { isResizing: oe, disableResizingFlag: se } = ue(), b = t.isExpanded(), p = Ce(null), [le, ae] = Re(void 0);
|
|
22
|
+
xe(() => {
|
|
23
|
+
!b && p.current && ae(p.current.cells[0]?.clientHeight ?? p.current.offsetHeight);
|
|
24
|
+
}, [b]);
|
|
25
|
+
const de = j((e) => {
|
|
26
|
+
p.current = e, S || A(e);
|
|
27
|
+
}, [S, A]), L = b ? le ?? h : h;
|
|
28
|
+
pe(() => {
|
|
29
|
+
J && t.getCanExpand() && !t.getIsExpanded() && t.toggleExpand();
|
|
30
30
|
}, []);
|
|
31
|
-
const
|
|
32
|
-
t.getCanExpand() && !
|
|
33
|
-
const i = window.getSelection()?.type !== "Range" && !
|
|
34
|
-
!o &&
|
|
35
|
-
},
|
|
36
|
-
e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") ||
|
|
31
|
+
const M = (e) => {
|
|
32
|
+
t.getCanExpand() && !Y && t.getToggleExpandedHandler()(), document.getElementById(t.id)?.focus();
|
|
33
|
+
const i = window.getSelection()?.type !== "Range" && !oe, o = C instanceof Function;
|
|
34
|
+
!o && B && i ? t.toggleExpand() : o && i && C(e, t), se();
|
|
35
|
+
}, ce = (e) => {
|
|
36
|
+
e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") || M(e);
|
|
37
37
|
}, r = t.getVisibleCells().map((e, i, o) => ({
|
|
38
38
|
...e,
|
|
39
39
|
left: o.slice(0, i).reduce((d, c) => d + (c.column.getSize() ?? 0), 0)
|
|
40
|
-
})),
|
|
40
|
+
})), T = g(() => r.filter((e) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), [r]), a = g(() => r.filter((e) => !!e.column.columnDef.fixedRight || e.column.id === "actions").map((e, i, o) => ({
|
|
41
41
|
...e,
|
|
42
42
|
right: o.slice(i + 1).reduce((d, c) => d + (c.column.getSize() ?? 0), 0)
|
|
43
|
-
})), [r]), z = g(() => a.some((e) => e.column.id ===
|
|
44
|
-
const o = e.column.id ===
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
className:
|
|
43
|
+
})), [r]), z = g(() => a.some((e) => e.column.id === O), [a]), U = !!R || !!Q, W = g(() => a.some((e) => !!e.column.columnDef.fixedRight), [a]), m = g(() => r.filter((e) => e.column.columnDef.fixedLeft), [r]), D = !X && !Z && ee, k = t.getIsSelected() && D, y = C instanceof Function, _ = v.length > 0 ? fe(v.map((e) => T[e])) : T, F = j((e, i) => {
|
|
44
|
+
const o = e.column.id === O, d = e.column.columnDef.fixedLeft, c = !!e.column.columnDef.fixedRight, re = e.id === m.at(-1)?.id, me = e.id === a.at(0)?.id && !o, ge = t.isExpanded(), E = i === 0;
|
|
45
|
+
return /* @__PURE__ */ s("td", {
|
|
46
|
+
className: $(n["t-cell"], y && "cursor-pointer", I, o && n["action-cell"], o && (!U || W) && n["action-cell--no-shadow"], o && !!R && m.length && n.shadowed, o && (l?.(t) ? l?.(t) : n["action-cell-default-background"]), d && n["fixed-cell"], c && n["fixed-right-cell"], re && n.shadowed, me && n["shadowed-right"], t.getIsSelected() && n.selected, d && (l?.(t) ? l?.(t) : n["fixed-cell-default-background"]), c && (l?.(t) ? l?.(t) : n["fixed-right-cell-default-background"]), ge && n.expanded_row, (!!k || t.isFocused()) && n["single-selection"]),
|
|
47
47
|
style: {
|
|
48
48
|
left: d ? e.left : void 0,
|
|
49
49
|
right: c ? e.right + (z ? -1 : 0) : void 0
|
|
@@ -52,11 +52,11 @@ function Me({ styledTableProps: j, row: t, index: P, columnWindow: { paddingLeft
|
|
|
52
52
|
style: {
|
|
53
53
|
display: "flex",
|
|
54
54
|
alignItems: "center",
|
|
55
|
-
minWidth:
|
|
56
|
-
minHeight:
|
|
55
|
+
minWidth: E ? 32 : void 0,
|
|
56
|
+
minHeight: L,
|
|
57
57
|
position: "relative"
|
|
58
58
|
},
|
|
59
|
-
children: [
|
|
59
|
+
children: [E && k && /* @__PURE__ */ s("span", {
|
|
60
60
|
style: {
|
|
61
61
|
display: "inline-flex",
|
|
62
62
|
alignItems: "center",
|
|
@@ -65,45 +65,46 @@ function Me({ styledTableProps: j, row: t, index: P, columnWindow: { paddingLeft
|
|
|
65
65
|
top: "50%",
|
|
66
66
|
transform: "translateY(-50%)"
|
|
67
67
|
},
|
|
68
|
-
children: /* @__PURE__ */
|
|
69
|
-
}), /* @__PURE__ */
|
|
68
|
+
children: /* @__PURE__ */ s(ye, {})
|
|
69
|
+
}), /* @__PURE__ */ s("span", {
|
|
70
70
|
style: {
|
|
71
|
-
marginLeft:
|
|
71
|
+
marginLeft: E && D ? 30 : 0,
|
|
72
72
|
width: "100%"
|
|
73
73
|
},
|
|
74
|
-
children:
|
|
74
|
+
children: De(e.column.columnDef.cell, e.getContext())
|
|
75
75
|
})]
|
|
76
76
|
})
|
|
77
77
|
}, e.id);
|
|
78
78
|
}, [
|
|
79
|
-
D,
|
|
80
|
-
w,
|
|
81
|
-
T,
|
|
82
|
-
s,
|
|
83
79
|
k,
|
|
80
|
+
R,
|
|
81
|
+
L,
|
|
82
|
+
l,
|
|
83
|
+
y,
|
|
84
84
|
z,
|
|
85
|
-
|
|
85
|
+
W,
|
|
86
86
|
m,
|
|
87
87
|
a,
|
|
88
88
|
t,
|
|
89
|
-
|
|
89
|
+
U,
|
|
90
|
+
D,
|
|
90
91
|
I
|
|
91
92
|
]);
|
|
92
|
-
return /* @__PURE__ */ x(
|
|
93
|
+
return /* @__PURE__ */ x(he, { children: [/* @__PURE__ */ x("tr", {
|
|
93
94
|
"aria-selected": t.getIsSelected() || t.isFocused() ? "true" : "false",
|
|
94
95
|
tabIndex: t.isFocused() ? 0 : -1,
|
|
95
|
-
"data-index":
|
|
96
|
+
"data-index": K,
|
|
96
97
|
"data-test": t.id,
|
|
97
98
|
id: t.id,
|
|
98
|
-
className:
|
|
99
|
+
className: $(n["t-row"], V && n["is-loading"], l?.(t)),
|
|
99
100
|
style: {
|
|
100
101
|
height: h ? `${h}px` : "inherit",
|
|
101
|
-
...
|
|
102
|
+
...N && ie
|
|
102
103
|
},
|
|
103
|
-
ref:
|
|
104
|
-
onMouseUp:
|
|
104
|
+
ref: de,
|
|
105
|
+
onMouseUp: ce,
|
|
105
106
|
onMouseDown: (e) => {
|
|
106
|
-
e.detail > 1 && !
|
|
107
|
+
e.detail > 1 && !y && B && e.preventDefault();
|
|
107
108
|
},
|
|
108
109
|
onKeyDown: (e) => {
|
|
109
110
|
switch (e.key) {
|
|
@@ -115,49 +116,49 @@ function Me({ styledTableProps: j, row: t, index: P, columnWindow: { paddingLeft
|
|
|
115
116
|
t.focusPrevRow(), e.preventDefault();
|
|
116
117
|
break;
|
|
117
118
|
case "Enter":
|
|
118
|
-
|
|
119
|
+
M(e);
|
|
119
120
|
break;
|
|
120
121
|
}
|
|
121
122
|
},
|
|
122
123
|
children: [
|
|
123
|
-
m.map((e, i) =>
|
|
124
|
-
|
|
124
|
+
m.map((e, i) => F(e, i)),
|
|
125
|
+
u > 0 && /* @__PURE__ */ s("td", {
|
|
125
126
|
"aria-hidden": !0,
|
|
126
127
|
className: n["t-cell"],
|
|
127
128
|
style: {
|
|
128
|
-
width: String(
|
|
129
|
-
minWidth: String(
|
|
130
|
-
maxWidth: String(
|
|
129
|
+
width: String(u) + "px",
|
|
130
|
+
minWidth: String(u) + "px",
|
|
131
|
+
maxWidth: String(u) + "px",
|
|
131
132
|
padding: 0,
|
|
132
133
|
border: "none"
|
|
133
134
|
}
|
|
134
135
|
}),
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
_.map((e, i) => F(e, m.length + i)),
|
|
137
|
+
f > 0 && /* @__PURE__ */ s("td", {
|
|
137
138
|
"aria-hidden": !0,
|
|
138
139
|
className: n["t-cell"],
|
|
139
140
|
style: {
|
|
140
|
-
width: String(
|
|
141
|
-
minWidth: String(
|
|
142
|
-
maxWidth: String(
|
|
141
|
+
width: String(f) + "px",
|
|
142
|
+
minWidth: String(f) + "px",
|
|
143
|
+
maxWidth: String(f) + "px",
|
|
143
144
|
padding: 0,
|
|
144
145
|
border: "none"
|
|
145
146
|
}
|
|
146
147
|
}),
|
|
147
|
-
a.map((e, i) =>
|
|
148
|
+
a.map((e, i) => F(e, m.length + _.length + i))
|
|
148
149
|
]
|
|
149
|
-
}), t.getIsExpanded() && /* @__PURE__ */
|
|
150
|
-
rows:
|
|
150
|
+
}), t.getIsExpanded() && /* @__PURE__ */ s(Se, { children: w && G?.({
|
|
151
|
+
rows: w.get(t.original.id.toString()) ?? [],
|
|
151
152
|
row: t.original
|
|
152
153
|
}) })] }, t.id);
|
|
153
154
|
}
|
|
154
|
-
var
|
|
155
|
+
var ye = () => /* @__PURE__ */ x("svg", {
|
|
155
156
|
xmlns: "http://www.w3.org/2000/svg",
|
|
156
157
|
width: "20",
|
|
157
158
|
height: "20",
|
|
158
159
|
viewBox: "0 2 22 22",
|
|
159
160
|
style: { color: "var(--colors-gama-500)" },
|
|
160
|
-
children: [/* @__PURE__ */
|
|
161
|
+
children: [/* @__PURE__ */ s("title", { children: "Checkmark" }), /* @__PURE__ */ s("path", {
|
|
161
162
|
fill: "currentColor",
|
|
162
163
|
d: "M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z"
|
|
163
164
|
})]
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { ACTIONS_COLUMN_ID as R, INTERNAL_COLUMN_IDS as
|
|
2
|
-
import { useRootContext as
|
|
1
|
+
import { ACTIONS_COLUMN_ID as R, INTERNAL_COLUMN_IDS as y } from "../../types.js";
|
|
2
|
+
import { useRootContext as G } from "../../context/RootContext.js";
|
|
3
3
|
import n from "../StyledTable.module.js";
|
|
4
|
-
import { DropUpIcon as
|
|
5
|
-
import { DropDownIcon as
|
|
6
|
-
import { getTableHeaderStyle as
|
|
7
|
-
import
|
|
4
|
+
import { DropUpIcon as A } from "../../shared-components/DropUpIcon.js";
|
|
5
|
+
import { DropDownIcon as w } from "../../shared-components/DropDownIcon.js";
|
|
6
|
+
import { getTableHeaderStyle as F } from "../../helpers/getTableHeaderStyle.js";
|
|
7
|
+
import C from "clsx";
|
|
8
8
|
import { useMemo as l } from "react";
|
|
9
|
-
import { jsx as i, jsxs as
|
|
10
|
-
import { flexRender as
|
|
11
|
-
function
|
|
12
|
-
const { hideHeader: c = !1, enableResizing: r = !1 } =
|
|
9
|
+
import { jsx as i, jsxs as k } from "react/jsx-runtime";
|
|
10
|
+
import { flexRender as B } from "@tanstack/react-table";
|
|
11
|
+
function J({ styledTableProps: D, header: o, tableCanResize: S = !1, left: _, right: N, tableWidth: b }) {
|
|
12
|
+
const { hideHeader: c = !1, enableResizing: r = !1, actions: h, customActionsNode: z } = D, { isResizing: a, enableResizingFlag: m, disableResizingFlag: u } = G(), d = o.column.columnDef.fixedLeft, g = !!o.column.columnDef.fixedRight, f = o.column.id === R, I = !!h || !!z, p = l(() => o.headerGroup.headers.some((e) => e.id === R), [o.headerGroup.headers]), H = l(() => o.headerGroup.headers.some((e) => !!e.column.columnDef.fixedRight), [o.headerGroup.headers]), v = l(() => o.headerGroup.headers[o.headerGroup.headers.length - (p ? 2 : 1)], [o.headerGroup.headers, p]), t = o.column.getCanSort(), x = o.column.getIsSorted(), T = t ? x === "asc" ? "ascending" : x === "desc" ? "descending" : "none" : void 0;
|
|
13
13
|
return /* @__PURE__ */ i("th", {
|
|
14
14
|
colSpan: o.colSpan,
|
|
15
|
-
"aria-sort":
|
|
16
|
-
className:
|
|
15
|
+
"aria-sort": T,
|
|
16
|
+
className: C(n["t-cell"], c && n["hide-header"], f && n["t-cell__actions"], f && (!I || H) && n["t-cell__actions--no-shadow"], d && n["t-cell__fixed"], g && n["t-cell__fixed-right"]),
|
|
17
17
|
style: {
|
|
18
|
-
...
|
|
18
|
+
...F({
|
|
19
19
|
enableResizing: r,
|
|
20
20
|
header: o,
|
|
21
|
-
tableWidth:
|
|
21
|
+
tableWidth: b
|
|
22
22
|
}),
|
|
23
23
|
...d && { left: _ },
|
|
24
|
-
...g && { right:
|
|
24
|
+
...g && { right: N }
|
|
25
25
|
},
|
|
26
|
-
children: /* @__PURE__ */
|
|
27
|
-
className:
|
|
26
|
+
children: /* @__PURE__ */ k("div", {
|
|
27
|
+
className: C("flex items-center justify-start", c ? n["hide-table-header"] : n["show-table-header"], t && n["sortable-column"], o.column.columnDef.className),
|
|
28
28
|
role: t ? "button" : void 0,
|
|
29
29
|
tabIndex: t ? 0 : void 0,
|
|
30
30
|
onClick: (e) => {
|
|
@@ -40,13 +40,13 @@ function P({ styledTableProps: S, header: o, tableCanResize: C = !1, left: _, ri
|
|
|
40
40
|
children: [
|
|
41
41
|
/* @__PURE__ */ i("div", {
|
|
42
42
|
className: n["header-content"],
|
|
43
|
-
children:
|
|
43
|
+
children: B(o.column.columnDef.header, o.getContext())
|
|
44
44
|
}),
|
|
45
45
|
{
|
|
46
|
-
asc: /* @__PURE__ */ i(
|
|
47
|
-
desc: /* @__PURE__ */ i(
|
|
46
|
+
asc: /* @__PURE__ */ i(A, { className: n["sort-icon"] }),
|
|
47
|
+
desc: /* @__PURE__ */ i(w, { className: n["sort-icon"] })
|
|
48
48
|
}[o.column.getIsSorted()] ?? null,
|
|
49
|
-
|
|
49
|
+
S && (r ? !0 : o.id !== v?.id) && o.column.getCanResize() && !y.includes(o.column.id) && /* @__PURE__ */ i("div", {
|
|
50
50
|
onDoubleClick: () => o.column.resetSize(),
|
|
51
51
|
onMouseDown: (e) => {
|
|
52
52
|
e.stopPropagation(), m(), o.getResizeHandler()(e);
|
|
@@ -61,5 +61,5 @@ function P({ styledTableProps: S, header: o, tableCanResize: C = !1, left: _, ri
|
|
|
61
61
|
}, o.id);
|
|
62
62
|
}
|
|
63
63
|
export {
|
|
64
|
-
|
|
64
|
+
J as TableHeaderCell
|
|
65
65
|
};
|