asma-ui-core 3.74.4 → 3.76.0
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/navigation/title-chevron/StyledTitleChevron.js +30 -0
- package/dist/index.js +81 -79
- package/dist/src/components/navigation/title-chevron/StyledTitleChevron.d.ts +25 -0
- package/dist/src/components/navigation/title-chevron/index.d.ts +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/table/hooks/useTranslations.d.ts +4 -0
- package/dist/table/components/columns/action-column/components/HeaderActionMenu.js +64 -59
- package/dist/table/components/columns/action-column/components/HeaderActionMenu.module.js +7 -6
- package/dist/table/hooks/useTranslations.js +6 -2
- package/package.json +1 -1
|
@@ -1,111 +1,114 @@
|
|
|
1
|
+
import { message as v } from "../../../../../components/feedback/snack-bar/message.js";
|
|
1
2
|
import { StyledPopover as D } from "../../../../../components/utils/popover/StyledPopover.js";
|
|
2
3
|
import { INTERNAL_COLUMN_IDS as S } from "../../../../types.js";
|
|
3
|
-
import { cn as
|
|
4
|
+
import { cn as _ } from "../../../../helpers/cn.js";
|
|
4
5
|
import { StyledCheckbox as T } from "../../../../shared-components/StyledCheckbox.js";
|
|
5
6
|
import { StyledTooltip as A } from "../../../../shared-components/tooltip/index.js";
|
|
6
7
|
import { useToggleMenuVisibility as L } from "../../../../hooks/useToggleMenuVisibility.hook.js";
|
|
7
|
-
import { PinIcon as
|
|
8
|
+
import { PinIcon as k } from "../../../../shared-components/PinIcon.js";
|
|
8
9
|
import m from "./TableActions.module.js";
|
|
9
|
-
import
|
|
10
|
-
import { DotsHorizontalIcon as
|
|
11
|
-
import { useTranslations as
|
|
12
|
-
import { StyledButton as
|
|
13
|
-
import { compact as
|
|
14
|
-
import { jsx as
|
|
15
|
-
import { DndContext as
|
|
16
|
-
import { restrictToParentElement as
|
|
17
|
-
import { SortableContext as
|
|
18
|
-
import { CSS as
|
|
19
|
-
function
|
|
20
|
-
const { attributes:
|
|
10
|
+
import d from "./HeaderActionMenu.module.js";
|
|
11
|
+
import { DotsHorizontalIcon as H } from "../../../../shared-components/DotsHorizontalIcon.js";
|
|
12
|
+
import { useTranslations as I } from "../../../../hooks/useTranslations.js";
|
|
13
|
+
import { StyledButton as O } from "../../../../shared-components/button/StyledButton.js";
|
|
14
|
+
import { compact as R } from "../../../../../helpers/arrays.js";
|
|
15
|
+
import { jsx as o, jsxs as f } from "react/jsx-runtime";
|
|
16
|
+
import { DndContext as V, PointerSensor as E, closestCenter as M, useSensor as P, useSensors as w } from "@dnd-kit/core";
|
|
17
|
+
import { restrictToParentElement as W, restrictToVerticalAxis as z } from "@dnd-kit/modifiers";
|
|
18
|
+
import { SortableContext as j, arrayMove as U, useSortable as B, verticalListSortingStrategy as Y } from "@dnd-kit/sortable";
|
|
19
|
+
import { CSS as $ } from "@dnd-kit/utilities";
|
|
20
|
+
function q({ id: n, disabled: p, children: u }) {
|
|
21
|
+
const { attributes: c, listeners: h, setNodeRef: b, transform: g, transition: l } = B({
|
|
21
22
|
id: n,
|
|
22
23
|
disabled: p
|
|
23
24
|
});
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ o("div", {
|
|
25
26
|
ref: b,
|
|
26
27
|
style: {
|
|
27
|
-
transform:
|
|
28
|
-
transition:
|
|
28
|
+
transform: $.Transform.toString(g),
|
|
29
|
+
transition: l
|
|
29
30
|
},
|
|
31
|
+
className: d["drag-item"],
|
|
30
32
|
children: u({
|
|
31
|
-
attributes:
|
|
33
|
+
attributes: c,
|
|
32
34
|
listeners: h
|
|
33
35
|
})
|
|
34
36
|
});
|
|
35
37
|
}
|
|
36
|
-
function
|
|
37
|
-
const { anchorEl: u, open:
|
|
38
|
-
const { active:
|
|
39
|
-
!
|
|
40
|
-
const
|
|
41
|
-
return
|
|
38
|
+
function fe({ headerData: n, locale: p }) {
|
|
39
|
+
const { anchorEl: u, open: c, handleClose: h, handleOpen: b } = L(), g = n.table.getAllLeafColumns().some((e) => e.getCanHide() && !e.getIsVisible() && !S.includes(e.id)), l = n.table.getAllLeafColumns(), y = (e) => {
|
|
40
|
+
const { active: r, over: t } = e;
|
|
41
|
+
!r || !t || r.id === t.id || l.find((i) => i.id === t.id)?.columnDef.fixedLeft || l.find((i) => i.id === t.id)?.columnDef.fixedRight || n.table.setColumnOrder((i) => {
|
|
42
|
+
const a = R(i ?? []).length ? i : n.table.getAllLeafColumns().map((C) => C.id);
|
|
43
|
+
return U(a, a.indexOf(r.id), a.indexOf(t.id));
|
|
42
44
|
});
|
|
43
|
-
},
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
+
}, N = w(P(E, { activationConstraint: { distance: 8 } })), s = I(p), x = l.filter((e) => !S.includes(e.id) && !!e.columnDef.header);
|
|
46
|
+
return /* @__PURE__ */ f("div", {
|
|
45
47
|
className: m["actions-header-wrapper"],
|
|
46
|
-
children: [/* @__PURE__ */
|
|
48
|
+
children: [/* @__PURE__ */ f("button", {
|
|
47
49
|
type: "button",
|
|
48
|
-
"aria-label":
|
|
50
|
+
"aria-label": s.column_settings,
|
|
49
51
|
"aria-haspopup": "true",
|
|
50
|
-
"aria-expanded":
|
|
52
|
+
"aria-expanded": c,
|
|
51
53
|
className: m["actions-header"],
|
|
52
54
|
onClick: b,
|
|
53
|
-
children: [/* @__PURE__ */
|
|
54
|
-
}), /* @__PURE__ */
|
|
55
|
+
children: [/* @__PURE__ */ o(k, { className: m["pin-icon"] }), g && /* @__PURE__ */ o("div", { className: m["pin-indicator"] })]
|
|
56
|
+
}), /* @__PURE__ */ f(D, {
|
|
55
57
|
anchorEl: u,
|
|
56
58
|
anchorOrigin: {
|
|
57
59
|
horizontal: "left",
|
|
58
60
|
vertical: "bottom"
|
|
59
61
|
},
|
|
60
|
-
open:
|
|
62
|
+
open: c,
|
|
61
63
|
onClose: h,
|
|
62
64
|
slotProps: { paper: { sx: {
|
|
63
|
-
maxHeight: "calc(7 *
|
|
65
|
+
maxHeight: "calc(7 * 40px)",
|
|
64
66
|
overflowY: "auto",
|
|
65
67
|
scrollbarWidth: "thin"
|
|
66
68
|
} } },
|
|
67
|
-
children: [/* @__PURE__ */
|
|
68
|
-
modifiers: [z,
|
|
69
|
+
children: [/* @__PURE__ */ o(V, {
|
|
70
|
+
modifiers: [z, W],
|
|
69
71
|
onDragEnd: y,
|
|
70
|
-
collisionDetection: (e) =>
|
|
71
|
-
const t = x.find((
|
|
72
|
+
collisionDetection: (e) => M(e).filter((r) => {
|
|
73
|
+
const t = x.find((i) => i.id === r.id);
|
|
72
74
|
return !t?.columnDef.fixedLeft && !t?.columnDef.fixedRight;
|
|
73
75
|
}),
|
|
74
|
-
sensors:
|
|
75
|
-
children: /* @__PURE__ */
|
|
76
|
+
sensors: N,
|
|
77
|
+
children: /* @__PURE__ */ o(j, {
|
|
76
78
|
items: x.map((e) => e.id),
|
|
77
|
-
strategy:
|
|
79
|
+
strategy: Y,
|
|
78
80
|
children: x.map((e) => {
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
+
const r = !!e.columnDef.fixedLeft || !!e.columnDef.fixedRight, t = e.columnDef.enableHiding === !1;
|
|
82
|
+
let i = null;
|
|
83
|
+
return r && t ? i = s.column_reorder_and_hidden : r ? i = s.column_reorder : t && (i = s.column_hidden), /* @__PURE__ */ o(q, {
|
|
81
84
|
id: e.id,
|
|
82
|
-
disabled:
|
|
83
|
-
children: ({ listeners:
|
|
84
|
-
title:
|
|
85
|
+
disabled: r,
|
|
86
|
+
children: ({ listeners: a, attributes: C }) => /* @__PURE__ */ o(A, {
|
|
87
|
+
title: i,
|
|
85
88
|
arrow: !0,
|
|
86
|
-
children: /* @__PURE__ */
|
|
89
|
+
children: /* @__PURE__ */ f("button", {
|
|
87
90
|
type: "button",
|
|
88
91
|
onClick: () => {
|
|
89
92
|
t || e.toggleVisibility(!e.getIsVisible());
|
|
90
93
|
},
|
|
91
|
-
className:
|
|
94
|
+
className: d["table-action-item"],
|
|
92
95
|
children: [
|
|
93
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ o(H, {
|
|
94
97
|
width: 20,
|
|
95
98
|
height: 20,
|
|
96
99
|
...C,
|
|
97
|
-
...
|
|
100
|
+
...a,
|
|
98
101
|
style: {
|
|
99
102
|
touchAction: "none",
|
|
100
103
|
WebkitUserSelect: "none",
|
|
101
104
|
userSelect: "none",
|
|
102
105
|
WebkitTouchCallout: "none"
|
|
103
106
|
},
|
|
104
|
-
className:
|
|
107
|
+
className: _(d["drag-icon"], r ? d["drag-icon--disabled"] : d["drag-icon--enabled"])
|
|
105
108
|
}),
|
|
106
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ o("span", {
|
|
107
110
|
className: "px-2",
|
|
108
|
-
children: /* @__PURE__ */
|
|
111
|
+
children: /* @__PURE__ */ o(T, {
|
|
109
112
|
readOnly: t,
|
|
110
113
|
dataTest: `${e.id}-column-visibility-checkbox`,
|
|
111
114
|
size: "small",
|
|
@@ -115,7 +118,7 @@ function ce({ headerData: n, locale: p }) {
|
|
|
115
118
|
className: "pointer-events-none"
|
|
116
119
|
})
|
|
117
120
|
}),
|
|
118
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ o("span", {
|
|
119
122
|
className: "font-roboto text-base text-delta-700",
|
|
120
123
|
children: e.columnDef.pinnedHeaderText ?? (typeof e.columnDef.header == "string" ? e.columnDef.header : e.id)
|
|
121
124
|
})
|
|
@@ -125,19 +128,21 @@ function ce({ headerData: n, locale: p }) {
|
|
|
125
128
|
}, e.id);
|
|
126
129
|
})
|
|
127
130
|
})
|
|
128
|
-
}), /* @__PURE__ */
|
|
131
|
+
}), /* @__PURE__ */ o("div", {
|
|
129
132
|
className: "pb-2 pl-2",
|
|
130
|
-
children: /* @__PURE__ */
|
|
133
|
+
children: /* @__PURE__ */ o(O, {
|
|
131
134
|
dataTest: "reset-order-button",
|
|
132
135
|
variant: "text",
|
|
133
|
-
|
|
134
|
-
onClick: () =>
|
|
135
|
-
|
|
136
|
+
className: "h-10",
|
|
137
|
+
onClick: () => {
|
|
138
|
+
n.table.resetColumnOrder(), v.info(s.column_order_reset);
|
|
139
|
+
},
|
|
140
|
+
children: s.reset_order
|
|
136
141
|
})
|
|
137
142
|
})]
|
|
138
143
|
})]
|
|
139
144
|
});
|
|
140
145
|
}
|
|
141
146
|
export {
|
|
142
|
-
|
|
147
|
+
fe as HeaderActionMenu
|
|
143
148
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
"table-action-item": "_table-action-
|
|
3
|
-
"drag-
|
|
4
|
-
"drag-icon
|
|
5
|
-
"drag-icon--
|
|
1
|
+
var a = {
|
|
2
|
+
"table-action-item": "_table-action-item_r3frh_1",
|
|
3
|
+
"drag-item": "_drag-item_r3frh_18",
|
|
4
|
+
"drag-icon": "_drag-icon_r3frh_22",
|
|
5
|
+
"drag-icon--disabled": "_drag-icon--disabled_r3frh_27",
|
|
6
|
+
"drag-icon--enabled": "_drag-icon--enabled_r3frh_32"
|
|
6
7
|
};
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
+
a as default
|
|
9
10
|
};
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import { useMemo as
|
|
1
|
+
import { useMemo as r } from "react";
|
|
2
2
|
var n = {
|
|
3
3
|
en: {
|
|
4
4
|
column_reorder: "This column is fixed and can’t be reordered.",
|
|
5
5
|
column_hidden: "This column is fixed and can’t be hidden.",
|
|
6
|
+
column_reorder_and_hidden: "This column is fixed and can’t be reordered or hidden.",
|
|
6
7
|
reset_order: "Reset order",
|
|
8
|
+
column_order_reset: "Column order reset",
|
|
7
9
|
column_settings: "Column settings"
|
|
8
10
|
},
|
|
9
11
|
no: {
|
|
10
12
|
column_reorder: "Denne kolonnen er fast og kan ikke flyttes.",
|
|
11
13
|
column_hidden: "Denne kolonnen er fast og kan ikke skjules.",
|
|
14
|
+
column_reorder_and_hidden: "Denne kolonnen er fast og kan ikke flyttes eller skjules.",
|
|
12
15
|
reset_order: "Tilbakestill rekkefølge",
|
|
16
|
+
column_order_reset: "Kolonnerekkefølgen er tilbakestilt",
|
|
13
17
|
column_settings: "Kolonneinnstillinger"
|
|
14
18
|
}
|
|
15
19
|
};
|
|
16
20
|
function s(e = "en") {
|
|
17
|
-
return
|
|
21
|
+
return r(() => n[e] ?? n.en, [e]);
|
|
18
22
|
}
|
|
19
23
|
export {
|
|
20
24
|
s as useTranslations
|