asma-ui-core 3.126.3 → 3.127.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,64 +1,71 @@
1
- import { ACTIONS_COLUMN_ID as C, INTERNAL_COLUMN_IDS as R } from "../../types.js";
2
- import { useRootContext as A } from "../../context/RootContext.js";
3
- import n from "../StyledTable.module.js";
4
- import { SortIndicator as F } from "./SortIndicator.js";
5
- import { getTableHeaderStyle as L } from "../../helpers/getTableHeaderStyle.js";
1
+ import { ACTIONS_COLUMN_ID as D, INTERNAL_COLUMN_IDS as R } from "../../types.js";
2
+ import { useRootContext as L } from "../../context/RootContext.js";
3
+ import e from "../StyledTable.module.js";
4
+ import { SortIndicator as A } from "./SortIndicator.js";
5
+ import { getTableHeaderStyle as O } from "../../helpers/getTableHeaderStyle.js";
6
+ import { getSortPreview as E } from "../../helpers/sortPreview.js";
6
7
  import _ from "clsx";
7
8
  import { useMemo as c } from "react";
8
- import { jsx as l, jsxs as w } from "react/jsx-runtime";
9
- import { flexRender as M } from "@tanstack/react-table";
10
- function J({ styledTableProps: z, header: o, tableCanResize: D = !1, left: b, right: N, tableWidth: h }) {
11
- const { hideHeader: r = !1, enableResizing: a = !1, actions: H, customActionsNode: I } = z, { isResizing: m, enableResizingFlag: u, disableResizingFlag: d } = A(), g = o.column.columnDef.fixedLeft, f = !!o.column.columnDef.fixedRight, p = o.column.id === C, T = !!H || !!I, x = c(() => o.headerGroup.headers.some((e) => e.id === C), [o.headerGroup.headers]), v = c(() => o.headerGroup.headers.some((e) => !!e.column.columnDef.fixedRight), [o.headerGroup.headers]), y = c(() => o.headerGroup.headers[o.headerGroup.headers.length - (x ? 2 : 1)], [o.headerGroup.headers, x]), t = o.column.getCanSort(), s = o.column.getIsSorted(), G = t ? s === "asc" ? "ascending" : s === "desc" ? "descending" : "none" : void 0, S = D && (a ? !0 : o.id !== y?.id) && o.column.getCanResize() && !R.includes(o.column.id);
9
+ import { jsx as l, jsxs as M } from "react/jsx-runtime";
10
+ import { flexRender as k } from "@tanstack/react-table";
11
+ function X({ styledTableProps: z, header: o, tableCanResize: b = !1, left: N, right: v, tableWidth: H }) {
12
+ const { hideHeader: r = !1, enableResizing: m = !1, actions: I, customActionsNode: T } = z, { isResizing: a, enableResizingFlag: u, disableResizingFlag: d } = L(), g = o.column.columnDef.fixedLeft, f = !!o.column.columnDef.fixedRight, p = o.column.id === D, w = !!I || !!T, S = c(() => o.headerGroup.headers.some((t) => t.id === D), [o.headerGroup.headers]), y = c(() => o.headerGroup.headers.some((t) => !!t.column.columnDef.fixedRight), [o.headerGroup.headers]), h = c(() => o.headerGroup.headers[o.headerGroup.headers.length - (S ? 2 : 1)], [o.headerGroup.headers, S]), n = o.column.getCanSort(), s = o.column.getIsSorted(), x = o.getContext().table.getState().sorting, F = E({
13
+ sorted: s,
14
+ firstDirection: o.column.getFirstSortDir(),
15
+ nextOrder: o.column.getNextSortingOrder(),
16
+ isLastSortEntry: x[x.length - 1]?.id === o.column.id
17
+ }), G = n ? s === "asc" ? "ascending" : s === "desc" ? "descending" : "none" : void 0, C = b && (m ? !0 : o.id !== h?.id) && o.column.getCanResize() && !R.includes(o.column.id);
12
18
  return /* @__PURE__ */ l("th", {
13
19
  colSpan: o.colSpan,
14
20
  "aria-sort": G,
15
- className: _(n["t-cell"], !R.includes(o.column.id) && o.column.getSize() > 64 && n["data-cell"], o.column.id === "select" && n["select-cell"], r && n["hide-header"], p && n["t-cell__actions"], p && (!T || v) && n["t-cell__actions--no-shadow"], g && n["t-cell__fixed"], f && n["t-cell__fixed-right"]),
21
+ className: _(e["t-cell"], !R.includes(o.column.id) && o.column.getSize() > 64 && e["data-cell"], o.column.id === "select" && e["select-cell"], r && e["hide-header"], p && e["t-cell__actions"], p && (!w || y) && e["t-cell__actions--no-shadow"], g && e["t-cell__fixed"], f && e["t-cell__fixed-right"]),
16
22
  style: {
17
- ...L({
18
- enableResizing: a,
23
+ ...O({
24
+ enableResizing: m,
19
25
  header: o,
20
- tableWidth: h
26
+ tableWidth: H
21
27
  }),
22
- ...g && { left: b },
23
- ...f && { right: N }
28
+ ...g && { left: N },
29
+ ...f && { right: v }
24
30
  },
25
- children: /* @__PURE__ */ w("div", {
26
- className: _("flex items-center justify-start", r ? n["hide-table-header"] : n["show-table-header"], t && n["sortable-column"], S && n["has-resize-zone"], o.column.columnDef.className),
27
- role: t ? "button" : void 0,
28
- tabIndex: t ? 0 : void 0,
29
- onClick: (e) => {
31
+ children: /* @__PURE__ */ M("div", {
32
+ className: _("flex items-center justify-start", r ? e["hide-table-header"] : e["show-table-header"], n && e["sortable-column"], C && e["has-resize-zone"], o.column.columnDef.className),
33
+ role: n ? "button" : void 0,
34
+ tabIndex: n ? 0 : void 0,
35
+ onClick: (t) => {
30
36
  const i = o.column.getToggleSortingHandler();
31
- !m && i && i(e), d();
37
+ !a && i && i(t), d();
32
38
  },
33
- onKeyDown: t ? (e) => {
34
- if (e.key !== "Enter" && e.key !== " ") return;
35
- e.preventDefault();
39
+ onKeyDown: n ? (t) => {
40
+ if (t.key !== "Enter" && t.key !== " ") return;
41
+ t.preventDefault();
36
42
  const i = o.column.getToggleSortingHandler();
37
- !m && i && i(e), d();
43
+ !a && i && i(t), d();
38
44
  } : void 0,
39
45
  children: [
40
46
  /* @__PURE__ */ l("div", {
41
- className: n["header-content"],
42
- children: M(o.column.columnDef.header, o.getContext())
47
+ className: e["header-content"],
48
+ children: k(o.column.columnDef.header, o.getContext())
43
49
  }),
44
- t && /* @__PURE__ */ l(F, {
50
+ n && /* @__PURE__ */ l(A, {
45
51
  sorted: s,
46
- nextDirection: s || o.column.getFirstSortDir()
52
+ firstDirection: o.column.getFirstSortDir(),
53
+ preview: F
47
54
  }),
48
- S && /* @__PURE__ */ l("div", {
55
+ C && /* @__PURE__ */ l("div", {
49
56
  onDoubleClick: () => o.column.resetSize(),
50
- onMouseDown: (e) => {
51
- e.stopPropagation(), u(), o.getResizeHandler()(e);
57
+ onMouseDown: (t) => {
58
+ t.stopPropagation(), u(), o.getResizeHandler()(t);
52
59
  },
53
- onTouchStart: (e) => {
54
- e.stopPropagation(), u(), o.getResizeHandler()(e);
60
+ onTouchStart: (t) => {
61
+ t.stopPropagation(), u(), o.getResizeHandler()(t);
55
62
  },
56
- className: `${n.resizer} ${o.column.getIsResizing() ? n.isResizing : ""}`
63
+ className: `${e.resizer} ${o.column.getIsResizing() ? e.isResizing : ""}`
57
64
  })
58
65
  ]
59
66
  })
60
67
  }, o.id);
61
68
  }
62
69
  export {
63
- J as TableHeaderCell
70
+ X as TableHeaderCell
64
71
  };
@@ -0,0 +1,18 @@
1
+ function a({ sorted: e, firstDirection: i, nextOrder: r, isLastSortEntry: t }) {
2
+ return e ? t ? r ? {
3
+ direction: r,
4
+ primary: !0
5
+ } : {
6
+ direction: i,
7
+ primary: !1
8
+ } : {
9
+ direction: r === "desc" ? "desc" : "asc",
10
+ primary: !0
11
+ } : {
12
+ direction: i,
13
+ primary: !1
14
+ };
15
+ }
16
+ export {
17
+ a as getSortPreview
18
+ };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.126.3",
6
+ "version": "3.127.1",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",