asma-ui-core 3.137.0 → 3.137.2
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/dynamic-select/components/DynamicInteractiveChipGroup.js +14 -14
- package/dist/src/table/hooks/useTranslations.d.ts +2 -2
- package/dist/table/components/columns/action-column/components/HeaderActionMenu.js +113 -96
- package/dist/table/components/columns/action-column/components/HeaderActionMenu.module.js +7 -5
- package/dist/table/hooks/useTranslations.js +2 -2
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ import { Skeleton as N } from "../../../mui-compat/Skeleton.js";
|
|
|
13
13
|
import { forwardRef as ae, useEffect as ie, useId as ne } from "react";
|
|
14
14
|
import { jsx as t, jsxs as S } from "react/jsx-runtime";
|
|
15
15
|
var ve = ae((V, D) => {
|
|
16
|
-
const { options: d, dataTest: z, value: r, readOnly:
|
|
16
|
+
const { options: d, dataTest: z, value: r, readOnly: a, multiple: n, title: A, titleSize: L, width: T = "full", disabled: x, onChange: p, required: R, error: b, helperText: C, disableHelperText: $, valueKey: B = "value", labelKey: E = "label", renderLabel: o, getOptionTooltip: I, loading: H, size: w, locale: q = "en", clearSelectionLabel: G } = V, K = ne(), { show: W, role: F } = ee("DynamicInteractiveChipGroup", b, C, !$, a), { containerRef: f, wrapDisabled: y } = le({ dependencyList: [d, d.length] });
|
|
17
17
|
ie(() => {
|
|
18
18
|
f.current && (f.current.inert = !0);
|
|
19
19
|
}, [f]);
|
|
@@ -22,14 +22,14 @@ var ve = ae((V, D) => {
|
|
|
22
22
|
return l == null ? "" : typeof l == "string" || typeof l == "number" || typeof l == "boolean" ? String(l) : e == null ? "" : m(e);
|
|
23
23
|
}, s = (e, l) => g(e) === g(l), J = n ? Array.isArray(r) && r.length > 0 : r != null, M = (e) => {
|
|
24
24
|
if (!n) {
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
p(
|
|
25
|
+
const i = s(e, r) ? null : e;
|
|
26
|
+
if (i === null) return;
|
|
27
|
+
p(i);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
const l = r ?? [];
|
|
31
|
-
p(l.find((
|
|
32
|
-
}, u =
|
|
31
|
+
p(l.find((i) => s(i, e)) ? l.filter((i) => !s(i, e)) : [...l, e]);
|
|
32
|
+
}, u = a ? d.filter((e) => !!(n ? r?.find((l) => s(l, e)) : s(r, e))) : d, P = u.findIndex((e) => !(typeof e == "object" && e?.disabled) && !a);
|
|
33
33
|
return /* @__PURE__ */ S("div", {
|
|
34
34
|
"data-testid": `${z}-dynamic-radio-group`,
|
|
35
35
|
className: "relative flex flex-col gap-y-1",
|
|
@@ -47,7 +47,7 @@ var ve = ae((V, D) => {
|
|
|
47
47
|
style: { width: "100%" },
|
|
48
48
|
children: u.map((e) => /* @__PURE__ */ t(O, {
|
|
49
49
|
className: "w-fit",
|
|
50
|
-
readOnly:
|
|
50
|
+
readOnly: a,
|
|
51
51
|
type: n ? "checkbox" : "radio",
|
|
52
52
|
dataTest: `ic-${c(e)}-hidden`,
|
|
53
53
|
label: o ? o(e) : m(e)
|
|
@@ -63,15 +63,15 @@ var ve = ae((V, D) => {
|
|
|
63
63
|
/* @__PURE__ */ t(N, { className: "h-[32px] w-[60px]" })
|
|
64
64
|
]
|
|
65
65
|
}) : u?.length ? u.map((e, l) => {
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
const h = typeof e == "object" ? !!e?.disabled : !1, k = !h && !
|
|
66
|
+
const i = !!(n ? r?.find((U) => s(U, e)) : s(r, e)), Q = I ? I(e) : null;
|
|
67
|
+
if (a && !i) return null;
|
|
68
|
+
const h = typeof e == "object" ? !!e?.disabled : !1, k = !h && !a && l === P ? D : void 0;
|
|
69
69
|
return /* @__PURE__ */ t(X, {
|
|
70
70
|
title: Q,
|
|
71
71
|
arrow: !0,
|
|
72
72
|
children: /* @__PURE__ */ t("span", {
|
|
73
73
|
className: v(h && "cursor-not-allowed"),
|
|
74
|
-
children:
|
|
74
|
+
children: a && !y ? /* @__PURE__ */ t(_, {
|
|
75
75
|
ref: k,
|
|
76
76
|
disabled: !!x || h,
|
|
77
77
|
classes: { root: "min-h-[32px] h-full" },
|
|
@@ -86,10 +86,10 @@ var ve = ae((V, D) => {
|
|
|
86
86
|
label: "block whitespace-normal break-words overflow-visible"
|
|
87
87
|
} : { root: "min-h-[32px] h-full" },
|
|
88
88
|
className: "w-fit",
|
|
89
|
-
readOnly:
|
|
89
|
+
readOnly: a,
|
|
90
90
|
type: n ? "checkbox" : "radio",
|
|
91
91
|
dataTest: `ic-${c(e)}`,
|
|
92
|
-
checked:
|
|
92
|
+
checked: i,
|
|
93
93
|
size: w,
|
|
94
94
|
onClick: () => M(e),
|
|
95
95
|
label: o ? o(e) : m(e)
|
|
@@ -98,7 +98,7 @@ var ve = ae((V, D) => {
|
|
|
98
98
|
}, c(e));
|
|
99
99
|
}) : /* @__PURE__ */ t("span", { children: "-" })
|
|
100
100
|
}),
|
|
101
|
-
!R && J && !
|
|
101
|
+
!R && J && !a && !x && /* @__PURE__ */ t(Z, {
|
|
102
102
|
dataTest: "clear-selection-btn",
|
|
103
103
|
variant: "text",
|
|
104
104
|
startIcon: w === "medium" ? /* @__PURE__ */ t(j, {
|
|
@@ -2,7 +2,7 @@ declare const translations: {
|
|
|
2
2
|
en: {
|
|
3
3
|
column_reorder: string;
|
|
4
4
|
column_hidden: string;
|
|
5
|
-
|
|
5
|
+
column_unhideable: string;
|
|
6
6
|
reset_columns: string;
|
|
7
7
|
columns_reset: string;
|
|
8
8
|
column_settings: string;
|
|
@@ -11,7 +11,7 @@ declare const translations: {
|
|
|
11
11
|
no: {
|
|
12
12
|
column_reorder: string;
|
|
13
13
|
column_hidden: string;
|
|
14
|
-
|
|
14
|
+
column_unhideable: string;
|
|
15
15
|
reset_columns: string;
|
|
16
16
|
columns_reset: string;
|
|
17
17
|
column_settings: string;
|
|
@@ -1,157 +1,174 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { StyledBadge as
|
|
3
|
-
import { PinIcon as
|
|
4
|
-
import { StyledPopover as
|
|
5
|
-
import { message as
|
|
6
|
-
import { INTERNAL_COLUMN_IDS as
|
|
7
|
-
import { hasChangedColumnLayout as
|
|
8
|
-
import { StyledCheckbox as
|
|
9
|
-
import { StyledTooltip as
|
|
10
|
-
import { useToggleMenuVisibility as
|
|
1
|
+
import { cn as k } from "../../../../../helpers/cn.js";
|
|
2
|
+
import { StyledBadge as R } from "../../../../../components/data-display/badge/StyledBadge.js";
|
|
3
|
+
import { PinIcon as w } from "../../../../../components/icons/pin-icon/PinIcon.js";
|
|
4
|
+
import { StyledPopover as A } from "../../../../../components/utils/popover/StyledPopover.js";
|
|
5
|
+
import { message as O } from "../../../../../components/feedback/snack-bar/message.js";
|
|
6
|
+
import { INTERNAL_COLUMN_IDS as H } from "../../../../types.js";
|
|
7
|
+
import { hasChangedColumnLayout as M } from "../../../../custom-features/order-columns/columnLayout.js";
|
|
8
|
+
import { StyledCheckbox as P } from "../../../../shared-components/StyledCheckbox.js";
|
|
9
|
+
import { StyledTooltip as y } from "../../../../shared-components/tooltip/index.js";
|
|
10
|
+
import { useToggleMenuVisibility as E } from "../../../../hooks/useToggleMenuVisibility.hook.js";
|
|
11
11
|
import f from "./TableActions.module.js";
|
|
12
|
-
import
|
|
13
|
-
import { DotsHorizontalIcon as
|
|
14
|
-
import { headerLabelText as
|
|
15
|
-
import { useTranslations as
|
|
16
|
-
import { StyledButton as
|
|
17
|
-
import { compact as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
import s from "./HeaderActionMenu.module.js";
|
|
13
|
+
import { DotsHorizontalIcon as V } from "../../../../shared-components/DotsHorizontalIcon.js";
|
|
14
|
+
import { headerLabelText as W } from "../../../../helpers/headerLabel.js";
|
|
15
|
+
import { useTranslations as z } from "../../../../hooks/useTranslations.js";
|
|
16
|
+
import { StyledButton as B } from "../../../../shared-components/button/StyledButton.js";
|
|
17
|
+
import { compact as $ } from "../../../../../helpers/arrays.js";
|
|
18
|
+
import { useId as j } from "react";
|
|
19
|
+
import { jsx as t, jsxs as u } from "react/jsx-runtime";
|
|
20
|
+
import { DndContext as U, PointerSensor as F, closestCenter as Y, useSensor as q, useSensors as G } from "@dnd-kit/core";
|
|
21
|
+
import { restrictToParentElement as J, restrictToVerticalAxis as K } from "@dnd-kit/modifiers";
|
|
22
|
+
import { SortableContext as Q, arrayMove as X, useSortable as Z, verticalListSortingStrategy as ee } from "@dnd-kit/sortable";
|
|
23
|
+
import { CSS as te } from "@dnd-kit/utilities";
|
|
24
|
+
function oe({ id: r, disabled: p, children: h }) {
|
|
25
|
+
const { attributes: d, listeners: b, setNodeRef: g, transform: x, transition: c } = Z({
|
|
26
|
+
id: r,
|
|
26
27
|
disabled: p
|
|
27
28
|
});
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ t("div", {
|
|
29
30
|
ref: g,
|
|
30
31
|
style: {
|
|
31
|
-
transform:
|
|
32
|
-
transition:
|
|
32
|
+
transform: te.Transform.toString(x),
|
|
33
|
+
transition: c
|
|
33
34
|
},
|
|
34
|
-
className:
|
|
35
|
+
className: s["drag-item"],
|
|
35
36
|
children: h({
|
|
36
|
-
attributes:
|
|
37
|
+
attributes: d,
|
|
37
38
|
listeners: b
|
|
38
39
|
})
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
var ie = (r) => {
|
|
43
|
+
r.target.closest('label, [role="button"]') || r.preventDefault();
|
|
44
|
+
};
|
|
45
|
+
function Ie({ headerData: r, locale: p }) {
|
|
46
|
+
const { anchorEl: h, open: d, handleClose: b, handleOpen: g } = E(), x = j(), c = M(r.table), C = r.table.getAllLeafColumns(), N = (e) => {
|
|
47
|
+
const { active: l, over: o } = e;
|
|
48
|
+
!l || !o || l.id === o.id || C.find((i) => i.id === o.id)?.columnDef.fixedLeft || C.find((i) => i.id === o.id)?.columnDef.fixedRight || r.table.setColumnOrder((i) => {
|
|
49
|
+
const a = $(i ?? []).length ? i : r.table.getAllLeafColumns().map((m) => m.id);
|
|
50
|
+
return X(a, a.indexOf(l.id), a.indexOf(o.id));
|
|
47
51
|
});
|
|
48
|
-
},
|
|
52
|
+
}, _ = G(q(F, { activationConstraint: { distance: 8 } })), n = z(p), S = C.filter((e) => !H.includes(e.id) && !!e.columnDef.header);
|
|
49
53
|
return /* @__PURE__ */ u("div", {
|
|
50
54
|
className: f["actions-header-wrapper"],
|
|
51
55
|
children: [/* @__PURE__ */ u("button", {
|
|
52
56
|
type: "button",
|
|
53
|
-
"aria-label":
|
|
57
|
+
"aria-label": c ? n.column_settings_changed : n.column_settings,
|
|
54
58
|
"aria-haspopup": "true",
|
|
55
|
-
"aria-expanded":
|
|
56
|
-
tabIndex:
|
|
59
|
+
"aria-expanded": d,
|
|
60
|
+
tabIndex: r.table.options.meta?.hideHeader ? -1 : void 0,
|
|
57
61
|
className: f["actions-header"],
|
|
58
62
|
onClick: g,
|
|
59
|
-
children: [/* @__PURE__ */
|
|
63
|
+
children: [/* @__PURE__ */ t(w, { className: f["pin-icon"] }), c && /* @__PURE__ */ t(R, {
|
|
60
64
|
dataTest: "column-settings-dot",
|
|
61
65
|
variant: "dot",
|
|
62
66
|
purpose: "filter",
|
|
63
67
|
className: f["pin-dot"]
|
|
64
68
|
})]
|
|
65
|
-
}), /* @__PURE__ */ u(
|
|
69
|
+
}), /* @__PURE__ */ u(A, {
|
|
66
70
|
anchorEl: h,
|
|
67
71
|
anchorOrigin: {
|
|
68
72
|
horizontal: "left",
|
|
69
73
|
vertical: "bottom"
|
|
70
74
|
},
|
|
71
|
-
open:
|
|
75
|
+
open: d,
|
|
72
76
|
onClose: b,
|
|
73
77
|
slotProps: { paper: { sx: {
|
|
74
78
|
maxHeight: "calc(7 * 40px)",
|
|
75
79
|
overflowY: "auto",
|
|
76
80
|
scrollbarWidth: "thin"
|
|
77
81
|
} } },
|
|
78
|
-
children: [/* @__PURE__ */
|
|
79
|
-
modifiers: [
|
|
80
|
-
onDragEnd:
|
|
81
|
-
collisionDetection: (e) =>
|
|
82
|
-
const
|
|
83
|
-
return !
|
|
82
|
+
children: [/* @__PURE__ */ t(U, {
|
|
83
|
+
modifiers: [K, J],
|
|
84
|
+
onDragEnd: N,
|
|
85
|
+
collisionDetection: (e) => Y(e).filter((l) => {
|
|
86
|
+
const o = S.find((i) => i.id === l.id);
|
|
87
|
+
return !o?.columnDef.fixedLeft && !o?.columnDef.fixedRight;
|
|
84
88
|
}),
|
|
85
|
-
sensors:
|
|
86
|
-
children: /* @__PURE__ */
|
|
87
|
-
items:
|
|
88
|
-
strategy:
|
|
89
|
-
children:
|
|
90
|
-
const
|
|
91
|
-
let
|
|
92
|
-
|
|
89
|
+
sensors: _,
|
|
90
|
+
children: /* @__PURE__ */ t(Q, {
|
|
91
|
+
items: S.map((e) => e.id),
|
|
92
|
+
strategy: ee,
|
|
93
|
+
children: S.map((e, l) => {
|
|
94
|
+
const o = !!e.columnDef.fixedLeft || !!e.columnDef.fixedRight, i = e.columnDef.enableHiding === !1, a = o ? n.column_reorder : null;
|
|
95
|
+
let m = null;
|
|
96
|
+
i && (m = o ? n.column_hidden : n.column_unhideable);
|
|
97
|
+
const D = W(e.columnDef) ?? e.id, v = `${x}-column-${l}-name`;
|
|
98
|
+
return /* @__PURE__ */ t(oe, {
|
|
93
99
|
id: e.id,
|
|
94
|
-
disabled:
|
|
95
|
-
children: ({ listeners:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
height: 20,
|
|
108
|
-
...C,
|
|
109
|
-
...a,
|
|
110
|
-
style: {
|
|
111
|
-
touchAction: "none",
|
|
112
|
-
WebkitUserSelect: "none",
|
|
113
|
-
userSelect: "none",
|
|
114
|
-
WebkitTouchCallout: "none"
|
|
115
|
-
},
|
|
116
|
-
className: v(d["drag-icon"], r ? d["drag-icon--disabled"] : d["drag-icon--enabled"])
|
|
117
|
-
}),
|
|
118
|
-
/* @__PURE__ */ i("span", {
|
|
119
|
-
className: "px-2",
|
|
120
|
-
children: /* @__PURE__ */ i(A, {
|
|
121
|
-
readOnly: t,
|
|
100
|
+
disabled: o,
|
|
101
|
+
children: ({ listeners: L, attributes: T }) => /* @__PURE__ */ u("div", {
|
|
102
|
+
role: "presentation",
|
|
103
|
+
className: s["table-action-item"],
|
|
104
|
+
onMouseDown: ie,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ t(y, {
|
|
107
|
+
title: m,
|
|
108
|
+
arrow: !0,
|
|
109
|
+
children: /* @__PURE__ */ t("span", {
|
|
110
|
+
className: "px-1",
|
|
111
|
+
children: /* @__PURE__ */ t(P, {
|
|
112
|
+
readOnly: i,
|
|
122
113
|
dataTest: `${e.id}-column-visibility-checkbox`,
|
|
123
114
|
size: "small",
|
|
124
115
|
disableRipple: !0,
|
|
125
116
|
checked: e.getIsVisible(),
|
|
126
117
|
hideWrapper: !0,
|
|
127
|
-
className: "
|
|
118
|
+
className: s["column-checkbox"],
|
|
119
|
+
"aria-labelledby": v,
|
|
120
|
+
"aria-readonly": i || void 0,
|
|
121
|
+
onChange: (re, I) => {
|
|
122
|
+
i || e.toggleVisibility(I);
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
}),
|
|
127
|
+
/* @__PURE__ */ t(y, {
|
|
128
|
+
title: a,
|
|
129
|
+
arrow: !0,
|
|
130
|
+
children: /* @__PURE__ */ t("span", {
|
|
131
|
+
className: s["drag-slot"],
|
|
132
|
+
children: /* @__PURE__ */ t(V, {
|
|
133
|
+
width: 20,
|
|
134
|
+
height: 20,
|
|
135
|
+
...T,
|
|
136
|
+
...L,
|
|
137
|
+
style: {
|
|
138
|
+
touchAction: "none",
|
|
139
|
+
WebkitUserSelect: "none",
|
|
140
|
+
userSelect: "none",
|
|
141
|
+
WebkitTouchCallout: "none"
|
|
142
|
+
},
|
|
143
|
+
className: k(s["drag-icon"], o ? s["drag-icon--disabled"] : s["drag-icon--enabled"])
|
|
128
144
|
})
|
|
129
|
-
}),
|
|
130
|
-
/* @__PURE__ */ i("span", {
|
|
131
|
-
className: "font-roboto text-base text-delta-700",
|
|
132
|
-
children: R(e.columnDef) ?? e.id
|
|
133
145
|
})
|
|
134
|
-
|
|
135
|
-
|
|
146
|
+
}),
|
|
147
|
+
/* @__PURE__ */ t("span", {
|
|
148
|
+
id: v,
|
|
149
|
+
className: "font-roboto text-base text-delta-700",
|
|
150
|
+
children: D
|
|
151
|
+
})
|
|
152
|
+
]
|
|
136
153
|
})
|
|
137
154
|
}, e.id);
|
|
138
155
|
})
|
|
139
156
|
})
|
|
140
|
-
}), /* @__PURE__ */
|
|
157
|
+
}), /* @__PURE__ */ t("div", {
|
|
141
158
|
className: "pb-2 pl-2",
|
|
142
|
-
children: /* @__PURE__ */
|
|
159
|
+
children: /* @__PURE__ */ t(B, {
|
|
143
160
|
dataTest: "reset-order-button",
|
|
144
161
|
variant: "text",
|
|
145
162
|
className: "h-10",
|
|
146
163
|
onClick: () => {
|
|
147
|
-
|
|
164
|
+
r.table.resetColumnSettings(), O.info(n.columns_reset, { closeButton: !0 });
|
|
148
165
|
},
|
|
149
|
-
children:
|
|
166
|
+
children: n.reset_columns
|
|
150
167
|
})
|
|
151
168
|
})]
|
|
152
169
|
})]
|
|
153
170
|
});
|
|
154
171
|
}
|
|
155
172
|
export {
|
|
156
|
-
|
|
173
|
+
Ie as HeaderActionMenu
|
|
157
174
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
var a = {
|
|
2
|
-
"table-action-item": "_table-action-
|
|
3
|
-
"drag-item": "_drag-
|
|
4
|
-
"
|
|
5
|
-
"drag-
|
|
6
|
-
"drag-icon
|
|
2
|
+
"table-action-item": "_table-action-item_1u7jy_1",
|
|
3
|
+
"drag-item": "_drag-item_1u7jy_19",
|
|
4
|
+
"column-checkbox": "_column-checkbox_1u7jy_23",
|
|
5
|
+
"drag-slot": "_drag-slot_1u7jy_28",
|
|
6
|
+
"drag-icon": "_drag-icon_1u7jy_33",
|
|
7
|
+
"drag-icon--disabled": "_drag-icon--disabled_1u7jy_38",
|
|
8
|
+
"drag-icon--enabled": "_drag-icon--enabled_1u7jy_43"
|
|
7
9
|
};
|
|
8
10
|
export {
|
|
9
11
|
a as default
|
|
@@ -3,7 +3,7 @@ var e = {
|
|
|
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
|
-
|
|
6
|
+
column_unhideable: "This column can’t be hidden.",
|
|
7
7
|
reset_columns: "Reset columns",
|
|
8
8
|
columns_reset: "Columns reset",
|
|
9
9
|
column_settings: "Column settings",
|
|
@@ -12,7 +12,7 @@ var e = {
|
|
|
12
12
|
no: {
|
|
13
13
|
column_reorder: "Denne kolonnen er fast og kan ikke flyttes.",
|
|
14
14
|
column_hidden: "Denne kolonnen er fast og kan ikke skjules.",
|
|
15
|
-
|
|
15
|
+
column_unhideable: "Denne kolonnen kan ikke skjules.",
|
|
16
16
|
reset_columns: "Tilbakestill kolonner",
|
|
17
17
|
columns_reset: "Kolonnene er tilbakestilt",
|
|
18
18
|
column_settings: "Kolonneinnstillinger",
|