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.
@@ -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, D = p.getHeaderGroups(), b = { ...g };
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: b,
12
+ style: D,
13
13
  ref: y,
14
- children: D.map((f) => {
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[data-index="0"]');
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 u, makeStateUpdater as i } from "@tanstack/react-table";
2
- var a = {
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: i("focusedRow", e) }),
15
+ getDefaultOptions: (e) => ({ onChangeFocusedRow: u("focusedRow", e) }),
8
16
  createTable: (e) => {
9
- e.setFocusedRow = (o) => {
10
- const t = (n) => u(o, n);
11
- return e.options.onChangeFocusedRow?.(t);
17
+ e.setFocusedRow = (t) => {
18
+ const n = (o) => r(t, o);
19
+ return e.options.onChangeFocusedRow?.(n);
12
20
  };
13
- const s = async (o) => {
14
- if (e.getRowModel().rows.findIndex((n) => n.id === o) === -1 && e.getState().pagination) {
15
- const n = e.getState().pagination.pageSize, c = e.getCoreRowModel().rows.findIndex((d) => d.id === o);
16
- if (c !== -1) {
17
- const d = Math.floor(c / n);
18
- e.setPageIndex?.(d);
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((n) => n.id === o)) return;
22
- e.setFocusedRow(() => o);
23
- const t = document.getElementById(o);
24
- t && (t.focus({ preventScroll: !1 }), t.scrollIntoView({
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 = (o) => {
30
- s(o);
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 = (o, t) => {
35
- const n = t ?? e.id;
36
- if (s.setFocusedRow(() => o ? n : null), o) {
37
- const c = document.getElementById(n);
38
- c && c.focus({ preventScroll: !0 });
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 o = s.getRowModel().rows, t = o[o.findIndex((n) => n.id === s.getState().focusedRow) + 1];
42
- return t ? (t.onChangeFocused(!0, t.id), !0) : !1;
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 o = s.getRowModel().rows, t = o[o.findIndex((n) => n.id === s.getState().focusedRow) - 1];
45
- return t ? (t.onChangeFocused(!0, t.id), !0) : !1;
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
- a as FocusedRowsFeature
58
+ g as FocusedRowsFeature
51
59
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.121.4",
6
+ "version": "3.121.6",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",