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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/custom/pathfinder-card/Pathfinder.module.js +14 -13
- package/dist/components/custom/pathfinder-card/PathfinderCard.js +64 -64
- package/dist/components/utils/popover/PopoverAnatomy.js +24 -27
- package/dist/src/table/types.d.ts +8 -0
- package/dist/table/components/TableRow.js +93 -95
- package/dist/table/components/table-header/TableHeader.js +4 -4
- package/dist/table/custom-features/focus-rows/FocusRowsFeature.js +36 -28
- package/package.json +1 -1
|
@@ -6,12 +6,12 @@ import "react";
|
|
|
6
6
|
import { jsx as n, jsxs as O } from "react/jsx-runtime";
|
|
7
7
|
import "@tanstack/react-table";
|
|
8
8
|
function M({ table: p, styledTableProps: o, tableCanResize: s, tableWidth: l, columnWindow: { paddingLeft: i, paddingRight: c, indexes: H } }) {
|
|
9
|
-
const { stickyHeader: S = !1, tableHeaderRef: y, tableHeaderStyle: g = {} } = o,
|
|
9
|
+
const { stickyHeader: S = !1, tableHeaderRef: y, tableHeaderStyle: g = {} } = o, b = p.getHeaderGroups(), D = { ...g };
|
|
10
10
|
return /* @__PURE__ */ n("thead", {
|
|
11
11
|
className: C(x["table-header"], S && x["table-header--sticky"], o.tableHeaderClassName),
|
|
12
|
-
style:
|
|
12
|
+
style: D,
|
|
13
13
|
ref: y,
|
|
14
|
-
children:
|
|
14
|
+
children: b.map((f) => {
|
|
15
15
|
const m = f.headers.map((e, t, r) => ({
|
|
16
16
|
header: e,
|
|
17
17
|
left: r.slice(0, t).reduce((d, a) => d + (a.column.getSize() ?? 0), 0)
|
|
@@ -26,7 +26,7 @@ function M({ table: p, styledTableProps: o, tableCanResize: s, tableWidth: l, co
|
|
|
26
26
|
tabIndex: 0,
|
|
27
27
|
onKeyDown: (e) => {
|
|
28
28
|
if (e.key !== "Tab" || e.shiftKey) return;
|
|
29
|
-
const t = e.currentTarget.closest("table")?.querySelector('tbody tr[
|
|
29
|
+
const t = e.currentTarget.closest("table")?.querySelector('tbody tr[tabindex="0"]');
|
|
30
30
|
t && (e.preventDefault(), t.focus());
|
|
31
31
|
},
|
|
32
32
|
children: [
|
|
@@ -1,51 +1,59 @@
|
|
|
1
|
-
import { functionalUpdate as
|
|
2
|
-
var
|
|
1
|
+
import { functionalUpdate as r, makeStateUpdater as u } from "@tanstack/react-table";
|
|
2
|
+
var d = (e) => getComputedStyle(e).position === "sticky", l = (e) => {
|
|
3
|
+
const s = e.closest("table"), t = s?.tHead;
|
|
4
|
+
let n = 0;
|
|
5
|
+
for (let o = s?.parentElement?.nextElementSibling; o; o = o.nextElementSibling) d(o) && (n += o.getBoundingClientRect().height);
|
|
6
|
+
e.style.scrollMarginTop = `${t && d(t) ? t.getBoundingClientRect().height : 0}px`, e.style.scrollMarginBottom = `${n}px`, e.scrollIntoView({
|
|
7
|
+
block: "nearest",
|
|
8
|
+
inline: "nearest"
|
|
9
|
+
});
|
|
10
|
+
}, g = {
|
|
3
11
|
getInitialState: (e) => ({
|
|
4
12
|
focusedRow: null,
|
|
5
13
|
...e
|
|
6
14
|
}),
|
|
7
|
-
getDefaultOptions: (e) => ({ onChangeFocusedRow:
|
|
15
|
+
getDefaultOptions: (e) => ({ onChangeFocusedRow: u("focusedRow", e) }),
|
|
8
16
|
createTable: (e) => {
|
|
9
|
-
e.setFocusedRow = (
|
|
10
|
-
const
|
|
11
|
-
return e.options.onChangeFocusedRow?.(
|
|
17
|
+
e.setFocusedRow = (t) => {
|
|
18
|
+
const n = (o) => r(t, o);
|
|
19
|
+
return e.options.onChangeFocusedRow?.(n);
|
|
12
20
|
};
|
|
13
|
-
const s = async (
|
|
14
|
-
if (e.getRowModel().rows.findIndex((
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
const
|
|
18
|
-
e.setPageIndex?.(
|
|
21
|
+
const s = async (t) => {
|
|
22
|
+
if (e.getRowModel().rows.findIndex((o) => o.id === t) === -1 && e.getState().pagination) {
|
|
23
|
+
const o = e.getState().pagination.pageSize, i = e.getCoreRowModel().rows.findIndex((c) => c.id === t);
|
|
24
|
+
if (i !== -1) {
|
|
25
|
+
const c = Math.floor(i / o);
|
|
26
|
+
e.setPageIndex?.(c);
|
|
19
27
|
}
|
|
20
28
|
}
|
|
21
|
-
if (await new Promise(requestAnimationFrame), !e.getRowModel().rows.find((
|
|
22
|
-
e.setFocusedRow(() =>
|
|
23
|
-
const
|
|
24
|
-
|
|
29
|
+
if (await new Promise(requestAnimationFrame), !e.getRowModel().rows.find((o) => o.id === t)) return;
|
|
30
|
+
e.setFocusedRow(() => t);
|
|
31
|
+
const n = document.getElementById(t);
|
|
32
|
+
n && (n.focus({ preventScroll: !1 }), n.scrollIntoView({
|
|
25
33
|
behavior: "smooth",
|
|
26
34
|
block: "center"
|
|
27
35
|
}));
|
|
28
36
|
};
|
|
29
|
-
e.focusRowById = (
|
|
30
|
-
s(
|
|
37
|
+
e.focusRowById = (t) => {
|
|
38
|
+
s(t);
|
|
31
39
|
};
|
|
32
40
|
},
|
|
33
41
|
createRow: (e, s) => {
|
|
34
|
-
e.isFocused = () => s.getState().focusedRow === e.id, e.onChangeFocused = (
|
|
35
|
-
const
|
|
36
|
-
if (s.setFocusedRow(() =>
|
|
37
|
-
const
|
|
38
|
-
|
|
42
|
+
e.isFocused = () => s.getState().focusedRow === e.id, e.onChangeFocused = (t, n) => {
|
|
43
|
+
const o = n ?? e.id;
|
|
44
|
+
if (s.setFocusedRow(() => t ? o : null), t) {
|
|
45
|
+
const i = document.getElementById(o);
|
|
46
|
+
i && (i.focus({ preventScroll: !0 }), l(i));
|
|
39
47
|
}
|
|
40
48
|
}, e.toggleFocused = () => e.onChangeFocused(!e.isFocused()), e.focusNextRow = () => {
|
|
41
|
-
const
|
|
42
|
-
return
|
|
49
|
+
const t = s.getRowModel().rows, n = t[t.findIndex((o) => o.id === s.getState().focusedRow) + 1];
|
|
50
|
+
return n ? (n.onChangeFocused(!0, n.id), !0) : !1;
|
|
43
51
|
}, e.focusPrevRow = () => {
|
|
44
|
-
const
|
|
45
|
-
return
|
|
52
|
+
const t = s.getRowModel().rows, n = t[t.findIndex((o) => o.id === s.getState().focusedRow) - 1];
|
|
53
|
+
return n ? (n.onChangeFocused(!0, n.id), !0) : !1;
|
|
46
54
|
};
|
|
47
55
|
}
|
|
48
56
|
};
|
|
49
57
|
export {
|
|
50
|
-
|
|
58
|
+
g as FocusedRowsFeature
|
|
51
59
|
};
|