asma-ui-core 3.57.0 → 3.58.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/src/table/components/columns/action-column/actionColumn.d.ts +3 -1
- package/dist/table/components/columns/action-column/actionColumn.js +26 -17
- package/dist/table/components/columns/action-column/components/HeaderActionMenu.js +18 -17
- package/dist/table/components/columns/action-column/components/RowActionMenu.js +6 -6
- package/dist/table/components/table-footer/TableRowCountSelect.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CellContext, Row } from '@tanstack/react-table';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { ColumnDef, IAction, ICustomAction, RowActionsState } from '../../../types';
|
|
4
|
+
type TableLocale = 'en' | 'no';
|
|
4
5
|
export declare function generateActionsColumn<TData>(options: {
|
|
5
6
|
headerPin: boolean;
|
|
6
7
|
actions?: (row: Row<TData>) => (IAction<TData> | ICustomAction<TData>)[];
|
|
@@ -8,5 +9,6 @@ export declare function generateActionsColumn<TData>(options: {
|
|
|
8
9
|
rowHeight?: number;
|
|
9
10
|
customActionsColumnProps?: Partial<ColumnDef<TData, unknown>>;
|
|
10
11
|
rowActionsState?: (row: Row<TData>) => RowActionsState | undefined;
|
|
11
|
-
locale?:
|
|
12
|
+
locale?: TableLocale;
|
|
12
13
|
}): ColumnDef<TData, unknown>;
|
|
14
|
+
export {};
|
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
import { ACTIONS_COLUMN_ID as m } from "../../../types.js";
|
|
2
|
-
import { RowActionMenu as d } from "./components/RowActionMenu.js";
|
|
3
2
|
import { HeaderActionMenu as u } from "./components/HeaderActionMenu.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { RowActionMenu as d } from "./components/RowActionMenu.js";
|
|
4
|
+
import { jsx as t, jsxs as f } from "react/jsx-runtime";
|
|
5
|
+
function r(e) {
|
|
6
|
+
return e.table.options.meta?.locale;
|
|
7
|
+
}
|
|
8
|
+
function p(e) {
|
|
9
|
+
return /* @__PURE__ */ t(u, {
|
|
10
|
+
headerData: e,
|
|
11
|
+
locale: r(e)
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function A(e) {
|
|
15
|
+
return /* @__PURE__ */ t("span", {
|
|
16
|
+
className: "sr-only",
|
|
17
|
+
children: r(e) === "no" ? "Handlinger" : "Actions"
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function b(e) {
|
|
21
|
+
const { headerPin: a, actions: o, customActionsNode: i, rowHeight: s, customActionsColumnProps: c, rowActionsState: l } = e;
|
|
7
22
|
return {
|
|
8
23
|
id: m,
|
|
9
24
|
enableHiding: !1,
|
|
10
25
|
enableSorting: !1,
|
|
11
|
-
accessorFn: (
|
|
12
|
-
header:
|
|
13
|
-
|
|
14
|
-
locale: i
|
|
15
|
-
}) : /* @__PURE__ */ n("span", {
|
|
16
|
-
className: "sr-only",
|
|
17
|
-
children: i === "no" ? "Handlinger" : "Actions"
|
|
18
|
-
}),
|
|
19
|
-
cell: (e) => o || t ? /* @__PURE__ */ f("div", {
|
|
26
|
+
accessorFn: (n) => n,
|
|
27
|
+
header: a ? p : A,
|
|
28
|
+
cell: (n) => o || i ? /* @__PURE__ */ f("div", {
|
|
20
29
|
className: "flex items-center justify-end gap-x-1",
|
|
21
|
-
style: { height:
|
|
22
|
-
children: [
|
|
23
|
-
tableData:
|
|
30
|
+
style: { height: s ?? "auto" },
|
|
31
|
+
children: [i && /* @__PURE__ */ t("div", { children: i?.(n) }), o && /* @__PURE__ */ t(d, {
|
|
32
|
+
tableData: n,
|
|
24
33
|
actions: o,
|
|
25
34
|
rowActionsState: l
|
|
26
35
|
})]
|
|
@@ -31,5 +40,5 @@ function x(r) {
|
|
|
31
40
|
};
|
|
32
41
|
}
|
|
33
42
|
export {
|
|
34
|
-
|
|
43
|
+
b as generateActionsColumn
|
|
35
44
|
};
|
|
@@ -4,12 +4,12 @@ import { cn as N } from "../../../../helpers/cn.js";
|
|
|
4
4
|
import { StyledCheckbox as T } from "../../../../shared-components/StyledCheckbox.js";
|
|
5
5
|
import { StyledTooltip as A } from "../../../../shared-components/tooltip/index.js";
|
|
6
6
|
import { useToggleMenuVisibility as L } from "../../../../hooks/useToggleMenuVisibility.hook.js";
|
|
7
|
-
import {
|
|
8
|
-
import { PinIcon as k } from "../../../../shared-components/PinIcon.js";
|
|
7
|
+
import { PinIcon as _ } from "../../../../shared-components/PinIcon.js";
|
|
9
8
|
import m from "./TableActions.module.js";
|
|
10
9
|
import f from "./HeaderActionMenu.module.js";
|
|
11
|
-
import { DotsHorizontalIcon as
|
|
12
|
-
import { useTranslations as
|
|
10
|
+
import { DotsHorizontalIcon as k } from "../../../../shared-components/DotsHorizontalIcon.js";
|
|
11
|
+
import { useTranslations as H } from "../../../../hooks/useTranslations.js";
|
|
12
|
+
import { StyledButton as I } from "../../../../shared-components/button/StyledButton.js";
|
|
13
13
|
import { compact as O } from "../../../../../helpers/arrays.js";
|
|
14
14
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
15
15
|
import { DndContext as R, PointerSensor as V, closestCenter as E, useSensor as M, useSensors as P } from "@dnd-kit/core";
|
|
@@ -17,7 +17,7 @@ import { restrictToParentElement as w, restrictToVerticalAxis as z } from "@dnd-
|
|
|
17
17
|
import { SortableContext as W, arrayMove as j, useSortable as U, verticalListSortingStrategy as B } from "@dnd-kit/sortable";
|
|
18
18
|
import { CSS as Y } from "@dnd-kit/utilities";
|
|
19
19
|
function $({ id: n, disabled: p, children: u }) {
|
|
20
|
-
const { attributes: d, listeners: h, setNodeRef: b, transform: g, transition:
|
|
20
|
+
const { attributes: d, listeners: h, setNodeRef: b, transform: g, transition: s } = U({
|
|
21
21
|
id: n,
|
|
22
22
|
disabled: p
|
|
23
23
|
});
|
|
@@ -25,7 +25,7 @@ function $({ id: n, disabled: p, children: u }) {
|
|
|
25
25
|
ref: b,
|
|
26
26
|
style: {
|
|
27
27
|
transform: Y.Transform.toString(g),
|
|
28
|
-
transition:
|
|
28
|
+
transition: s
|
|
29
29
|
},
|
|
30
30
|
children: u({
|
|
31
31
|
attributes: d,
|
|
@@ -34,13 +34,13 @@ function $({ id: n, disabled: p, children: u }) {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
function ce({ headerData: n, locale: p }) {
|
|
37
|
-
const { anchorEl: u, open: d, handleClose: h, handleOpen: b } = L(), g = n.table.getAllLeafColumns().some((e) => e.getCanHide() && !e.getIsVisible() && !S.includes(e.id)),
|
|
37
|
+
const { anchorEl: u, open: d, handleClose: h, handleOpen: b } = L(), g = n.table.getAllLeafColumns().some((e) => e.getCanHide() && !e.getIsVisible() && !S.includes(e.id)), s = n.table.getAllLeafColumns(), y = (e) => {
|
|
38
38
|
const { active: o, over: t } = e;
|
|
39
|
-
!o || !t || o.id === t.id ||
|
|
40
|
-
const
|
|
41
|
-
return j(
|
|
39
|
+
!o || !t || o.id === t.id || s.find((r) => r.id === t.id)?.columnDef.fixedLeft || s.find((r) => r.id === t.id)?.columnDef.fixedRight || n.table.setColumnOrder((r) => {
|
|
40
|
+
const l = O(r ?? []).length ? r : n.table.getAllLeafColumns().map((C) => C.id);
|
|
41
|
+
return j(l, l.indexOf(o.id), l.indexOf(t.id));
|
|
42
42
|
});
|
|
43
|
-
}, v = P(M(V, { activationConstraint: { distance: 8 } })), c =
|
|
43
|
+
}, v = P(M(V, { activationConstraint: { distance: 8 } })), c = H(p), x = s.filter((e) => !S.includes(e.id) && !!e.columnDef.header);
|
|
44
44
|
return /* @__PURE__ */ a("div", {
|
|
45
45
|
className: m["actions-header-wrapper"],
|
|
46
46
|
children: [/* @__PURE__ */ a("button", {
|
|
@@ -50,7 +50,7 @@ function ce({ headerData: n, locale: p }) {
|
|
|
50
50
|
"aria-expanded": d,
|
|
51
51
|
className: m["actions-header"],
|
|
52
52
|
onClick: b,
|
|
53
|
-
children: [/* @__PURE__ */ i(
|
|
53
|
+
children: [/* @__PURE__ */ i(_, { className: m["pin-icon"] }), g && /* @__PURE__ */ i("div", { className: m["pin-indicator"] })]
|
|
54
54
|
}), /* @__PURE__ */ a(D, {
|
|
55
55
|
anchorEl: u,
|
|
56
56
|
anchorOrigin: {
|
|
@@ -80,7 +80,7 @@ function ce({ headerData: n, locale: p }) {
|
|
|
80
80
|
return /* @__PURE__ */ i($, {
|
|
81
81
|
id: e.id,
|
|
82
82
|
disabled: o,
|
|
83
|
-
children: ({ listeners:
|
|
83
|
+
children: ({ listeners: l, attributes: C }) => /* @__PURE__ */ i(A, {
|
|
84
84
|
title: r,
|
|
85
85
|
arrow: !0,
|
|
86
86
|
children: /* @__PURE__ */ a("button", {
|
|
@@ -90,11 +90,11 @@ function ce({ headerData: n, locale: p }) {
|
|
|
90
90
|
},
|
|
91
91
|
className: f["table-action-item"],
|
|
92
92
|
children: [
|
|
93
|
-
/* @__PURE__ */ i(
|
|
93
|
+
/* @__PURE__ */ i(k, {
|
|
94
94
|
width: 20,
|
|
95
95
|
height: 20,
|
|
96
96
|
...C,
|
|
97
|
-
...
|
|
97
|
+
...l,
|
|
98
98
|
style: {
|
|
99
99
|
touchAction: "none",
|
|
100
100
|
WebkitUserSelect: "none",
|
|
@@ -111,7 +111,8 @@ function ce({ headerData: n, locale: p }) {
|
|
|
111
111
|
size: "small",
|
|
112
112
|
disableRipple: !0,
|
|
113
113
|
checked: e.getIsVisible(),
|
|
114
|
-
hideWrapper: !0
|
|
114
|
+
hideWrapper: !0,
|
|
115
|
+
className: "pointer-events-none"
|
|
115
116
|
})
|
|
116
117
|
}),
|
|
117
118
|
/* @__PURE__ */ i("span", {
|
|
@@ -126,7 +127,7 @@ function ce({ headerData: n, locale: p }) {
|
|
|
126
127
|
})
|
|
127
128
|
}), /* @__PURE__ */ i("div", {
|
|
128
129
|
className: "pb-2 pl-2",
|
|
129
|
-
children: /* @__PURE__ */ i(
|
|
130
|
+
children: /* @__PURE__ */ i(I, {
|
|
130
131
|
dataTest: "reset-order-button",
|
|
131
132
|
variant: "text",
|
|
132
133
|
size: "small",
|
|
@@ -3,9 +3,9 @@ import { StyledMenuList as A } from "../../../../../components/navigation/menu/S
|
|
|
3
3
|
import { isCustomAction as O } from "../../../../types.js";
|
|
4
4
|
import { StyledTooltip as g } from "../../../../shared-components/tooltip/index.js";
|
|
5
5
|
import { useToggleMenuVisibility as j } from "../../../../hooks/useToggleMenuVisibility.hook.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { StyledButton as k } from "../../../../shared-components/button/StyledButton.js";
|
|
7
|
+
import { DotsVerticalIcon as D } from "../../../../shared-components/DotsVerticalIcon.js";
|
|
8
|
+
import { StyledMenuItem as F } from "../../../../shared-components/StyledMenuItem.js";
|
|
9
9
|
import { CircleWarningOutlineIcon as I } from "../../../../shared-components/CircleWarningOutlineIcon.js";
|
|
10
10
|
import w, { useEffect as R, useMemo as V, useState as z } from "react";
|
|
11
11
|
import { jsx as t, jsxs as b } from "react/jsx-runtime";
|
|
@@ -16,7 +16,7 @@ function X({ tableData: o, actions: v, rowActionsState: C }) {
|
|
|
16
16
|
const e = window.setTimeout(() => l(!1), 1600);
|
|
17
17
|
return () => window.clearTimeout(e);
|
|
18
18
|
}, [a]), !M) return /* @__PURE__ */ t("div", { className: "flex w-[40px] items-center justify-center" });
|
|
19
|
-
const c = n.state === "disabled", f = /* @__PURE__ */ t(
|
|
19
|
+
const c = n.state === "disabled", f = /* @__PURE__ */ t(k, {
|
|
20
20
|
dataTest: "row-actions-button",
|
|
21
21
|
"aria-label": N,
|
|
22
22
|
"aria-haspopup": "true",
|
|
@@ -33,7 +33,7 @@ function X({ tableData: o, actions: v, rowActionsState: C }) {
|
|
|
33
33
|
onMouseUp: (e) => {
|
|
34
34
|
e.stopPropagation(), e.preventDefault();
|
|
35
35
|
},
|
|
36
|
-
children: /* @__PURE__ */ t(
|
|
36
|
+
children: /* @__PURE__ */ t(D, {
|
|
37
37
|
className: c ? "text-delta-300" : "text-delta-700",
|
|
38
38
|
width: 20,
|
|
39
39
|
height: 20
|
|
@@ -94,7 +94,7 @@ function X({ tableData: o, actions: v, rowActionsState: C }) {
|
|
|
94
94
|
title: e?.tooltipTitle,
|
|
95
95
|
arrow: !0,
|
|
96
96
|
placement: e?.tooltipPlacement ?? "left",
|
|
97
|
-
children: /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(
|
|
97
|
+
children: /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(F, {
|
|
98
98
|
className: e.className,
|
|
99
99
|
disabled: e.disabled,
|
|
100
100
|
onClick: () => {
|
|
@@ -64,7 +64,7 @@ function D({ table: n, locale: p }) {
|
|
|
64
64
|
},
|
|
65
65
|
selected: t === o,
|
|
66
66
|
children: /* @__PURE__ */ s("span", {
|
|
67
|
-
className: "text-base font-normal text-delta-700",
|
|
67
|
+
className: "whitespace-nowrap text-base font-normal text-delta-700",
|
|
68
68
|
children: [
|
|
69
69
|
o,
|
|
70
70
|
" ",
|