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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/inputs/select-autocomplete/SelectAutocompletePicker.js +111 -102
- package/dist/src/table/components/table-header/SortIndicator.d.ts +21 -9
- package/dist/src/table/helpers/sortPreview.d.ts +37 -0
- package/dist/src/table/helpers/sortPreview.test.d.ts +1 -0
- package/dist/table/components/StyledTable.module.js +63 -60
- package/dist/table/components/table-header/SortIndicator.js +22 -15
- package/dist/table/components/table-header/TableHeaderCell.js +43 -36
- package/dist/table/helpers/sortPreview.js +18 -0
- package/package.json +1 -1
|
@@ -1,64 +1,71 @@
|
|
|
1
|
-
import { ACTIONS_COLUMN_ID as
|
|
2
|
-
import { useRootContext as
|
|
3
|
-
import
|
|
4
|
-
import { SortIndicator as
|
|
5
|
-
import { getTableHeaderStyle as
|
|
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
|
|
9
|
-
import { flexRender as
|
|
10
|
-
function
|
|
11
|
-
const { hideHeader: r = !1, enableResizing:
|
|
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: _(
|
|
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
|
-
...
|
|
18
|
-
enableResizing:
|
|
23
|
+
...O({
|
|
24
|
+
enableResizing: m,
|
|
19
25
|
header: o,
|
|
20
|
-
tableWidth:
|
|
26
|
+
tableWidth: H
|
|
21
27
|
}),
|
|
22
|
-
...g && { left:
|
|
23
|
-
...f && { right:
|
|
28
|
+
...g && { left: N },
|
|
29
|
+
...f && { right: v }
|
|
24
30
|
},
|
|
25
|
-
children: /* @__PURE__ */
|
|
26
|
-
className: _("flex items-center justify-start", r ?
|
|
27
|
-
role:
|
|
28
|
-
tabIndex:
|
|
29
|
-
onClick: (
|
|
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
|
-
!
|
|
37
|
+
!a && i && i(t), d();
|
|
32
38
|
},
|
|
33
|
-
onKeyDown:
|
|
34
|
-
if (
|
|
35
|
-
|
|
39
|
+
onKeyDown: n ? (t) => {
|
|
40
|
+
if (t.key !== "Enter" && t.key !== " ") return;
|
|
41
|
+
t.preventDefault();
|
|
36
42
|
const i = o.column.getToggleSortingHandler();
|
|
37
|
-
!
|
|
43
|
+
!a && i && i(t), d();
|
|
38
44
|
} : void 0,
|
|
39
45
|
children: [
|
|
40
46
|
/* @__PURE__ */ l("div", {
|
|
41
|
-
className:
|
|
42
|
-
children:
|
|
47
|
+
className: e["header-content"],
|
|
48
|
+
children: k(o.column.columnDef.header, o.getContext())
|
|
43
49
|
}),
|
|
44
|
-
|
|
50
|
+
n && /* @__PURE__ */ l(A, {
|
|
45
51
|
sorted: s,
|
|
46
|
-
|
|
52
|
+
firstDirection: o.column.getFirstSortDir(),
|
|
53
|
+
preview: F
|
|
47
54
|
}),
|
|
48
|
-
|
|
55
|
+
C && /* @__PURE__ */ l("div", {
|
|
49
56
|
onDoubleClick: () => o.column.resetSize(),
|
|
50
|
-
onMouseDown: (
|
|
51
|
-
|
|
57
|
+
onMouseDown: (t) => {
|
|
58
|
+
t.stopPropagation(), u(), o.getResizeHandler()(t);
|
|
52
59
|
},
|
|
53
|
-
onTouchStart: (
|
|
54
|
-
|
|
60
|
+
onTouchStart: (t) => {
|
|
61
|
+
t.stopPropagation(), u(), o.getResizeHandler()(t);
|
|
55
62
|
},
|
|
56
|
-
className: `${
|
|
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
|
-
|
|
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
|
+
};
|