asma-ui-core 3.43.1 → 3.43.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.
|
@@ -1,121 +1,129 @@
|
|
|
1
|
-
import { resolveToolbarActionWidth as
|
|
2
|
-
var
|
|
3
|
-
function
|
|
1
|
+
import { resolveToolbarActionWidth as G } from "./planToolbarActions.js";
|
|
2
|
+
var r = 8, O = 12, H = 160, Y = 44, D = 92, V = 44, J = 148, K = 44, j = 168, q = 9, z = 56, N = 360, Q = 12;
|
|
3
|
+
function T(t) {
|
|
4
4
|
return {
|
|
5
|
-
leading: t?.leadingUtilityWidthPx ??
|
|
6
|
-
search: t?.searchWidthPx ??
|
|
7
|
-
selectionIndicator: t?.selectionIndicatorWidthPx ??
|
|
8
|
-
filter: (i) => i ? t?.filterIconWidthPx ??
|
|
9
|
-
trailing: (i) => i ? t?.trailingIconWidthPx ??
|
|
5
|
+
leading: t?.leadingUtilityWidthPx ?? Y,
|
|
6
|
+
search: t?.searchWidthPx ?? H,
|
|
7
|
+
selectionIndicator: t?.selectionIndicatorWidthPx ?? j,
|
|
8
|
+
filter: (i) => i ? t?.filterIconWidthPx ?? V : t?.filterLabelWidthPx ?? D,
|
|
9
|
+
trailing: (i) => i ? t?.trailingIconWidthPx ?? K : t?.trailingLabelWidthPx ?? J
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return t ? typeof t == "string" ? t.length :
|
|
12
|
+
function Z(t) {
|
|
13
|
+
return t ? typeof t == "string" ? t.length : Q : 0;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const i =
|
|
15
|
+
function B(t) {
|
|
16
|
+
const i = Z(t);
|
|
17
17
|
if (i === 0) return 0;
|
|
18
|
-
const e = i > 0 ? i *
|
|
19
|
-
return Math.min(
|
|
18
|
+
const e = i > 0 ? i * q + 24 : 0;
|
|
19
|
+
return Math.min(N, Math.max(z, e));
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return typeof t == "string" ?
|
|
21
|
+
function $(t, i) {
|
|
22
|
+
return typeof t == "string" ? B(t) : i != null && i > 0 ? Math.min(N, i) : B(t);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
const n = t.filter((
|
|
26
|
-
return n.length ? n.reduce((
|
|
24
|
+
function S(t, i, e) {
|
|
25
|
+
const n = t.filter((o) => !o.hidden);
|
|
26
|
+
return n.length ? n.reduce((o, a) => o + G(a, i, e) + r, 0) - r : 0;
|
|
27
27
|
}
|
|
28
28
|
function F(t, i, e) {
|
|
29
|
-
const n = t.filter((s) => !s.hidden).sort((s,
|
|
29
|
+
const n = t.filter((s) => !s.hidden).sort((s, I) => (I.priority ?? 0) - (s.priority ?? 0));
|
|
30
30
|
if (!n.length) return 0;
|
|
31
|
-
const
|
|
32
|
-
return n.length ===
|
|
31
|
+
const o = n.slice(0, i), a = S(o, !0, e);
|
|
32
|
+
return n.length === o.length ? a : a + (o.length ? r : 0) + 40;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function nt(t, i, e, n = 3) {
|
|
35
35
|
return t > 0 ? t : F(i, n, e);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const { hasLeadingUtility: i, hasFilter: e, hasSearch: n, hasTrailingUtility:
|
|
39
|
-
let
|
|
40
|
-
|
|
41
|
-
const f = e ? d.filter(
|
|
42
|
-
return
|
|
37
|
+
function M(t) {
|
|
38
|
+
const { hasLeadingUtility: i, hasFilter: e, hasSearch: n, hasTrailingUtility: o, showPageActions: a, showBulkActions: s, filterIconOnly: I, trailingIconOnly: h, pageActionsWidthPx: u, bulkActionsWidthPx: P, searchBeforeFilter: A = !1, measured: W } = t, d = T(W);
|
|
39
|
+
let c = 0;
|
|
40
|
+
a && i && (c += d.leading + r);
|
|
41
|
+
const f = e ? d.filter(I) + r : 0, p = n ? d.search + r : 0;
|
|
42
|
+
return A ? c += p + f : c += f + p, a && (u > 0 && (c += u + r), o && (c += d.trailing(h) + r)), s && P > 0 && (c += P + r), Math.max(0, c - r);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
const { containerWidth: i, isMobile: e, isSelectionMode: n, compactBreakpointPx:
|
|
46
|
-
hasLeadingUtility:
|
|
44
|
+
function et(t) {
|
|
45
|
+
const { containerWidth: i, isMobile: e, isSelectionMode: n, compactBreakpointPx: o, reserveBulkActionsWidthPx: a, title: s, hasLeadingUtility: I, hasFilter: h, hasSearch: u, hasTrailingUtility: P, pageActions: A, bulkActions: W, maxVisibleBulkActions: d = 2, measured: c } = t, f = i > 0 ? i : Number.POSITIVE_INFINITY, p = !n, X = n, R = n ? 0 : a, b = T(c), x = $(s, c?.titleWidthPx), g = S(A, !0, c?.actionWidthPx), k = S(A, !1, c?.actionWidthPx), E = F(W, d, c?.actionWidthPx), _ = (l) => M({
|
|
46
|
+
hasLeadingUtility: I,
|
|
47
47
|
hasFilter: h,
|
|
48
|
-
hasSearch:
|
|
49
|
-
hasTrailingUtility:
|
|
48
|
+
hasSearch: u,
|
|
49
|
+
hasTrailingUtility: P,
|
|
50
50
|
showPageActions: p,
|
|
51
|
-
showBulkActions:
|
|
51
|
+
showBulkActions: X,
|
|
52
52
|
bulkActionsWidthPx: 0,
|
|
53
|
-
measured:
|
|
54
|
-
...
|
|
53
|
+
measured: c,
|
|
54
|
+
...l
|
|
55
55
|
});
|
|
56
|
-
if (e || f <
|
|
57
|
-
const
|
|
58
|
-
...
|
|
56
|
+
if (e || f < o) {
|
|
57
|
+
const l = (y) => f >= _({
|
|
58
|
+
...y,
|
|
59
59
|
searchBeforeFilter: !0
|
|
60
|
-
}), m = (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
60
|
+
}), m = (y) => n ? !0 : y, v = [
|
|
61
|
+
{
|
|
62
|
+
filterIconOnly: !1,
|
|
63
|
+
trailingIconOnly: !1,
|
|
64
|
+
pageActionsWidthPx: g
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
filterIconOnly: !0,
|
|
68
|
+
trailingIconOnly: !1,
|
|
69
|
+
pageActionsWidthPx: g
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
filterIconOnly: !0,
|
|
73
|
+
trailingIconOnly: !0,
|
|
74
|
+
pageActionsWidthPx: g
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
filterIconOnly: !0,
|
|
78
|
+
trailingIconOnly: !0,
|
|
79
|
+
pageActionsWidthPx: k
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
for (const y of v) {
|
|
83
|
+
const L = m(y.trailingIconOnly);
|
|
84
|
+
if (l({
|
|
85
|
+
...y,
|
|
86
|
+
trailingIconOnly: L
|
|
87
|
+
})) return {
|
|
88
|
+
mode: "compact",
|
|
89
|
+
filterIconOnly: y.filterIconOnly,
|
|
90
|
+
trailingIconOnly: L
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
86
94
|
mode: "compact",
|
|
87
95
|
filterIconOnly: !0,
|
|
88
96
|
trailingIconOnly: !0
|
|
89
97
|
};
|
|
90
98
|
}
|
|
91
99
|
if (n) {
|
|
92
|
-
const
|
|
100
|
+
const l = (L) => M({
|
|
93
101
|
hasLeadingUtility: !1,
|
|
94
102
|
hasFilter: h,
|
|
95
|
-
hasSearch:
|
|
103
|
+
hasSearch: u,
|
|
96
104
|
hasTrailingUtility: !1,
|
|
97
105
|
showPageActions: !1,
|
|
98
106
|
showBulkActions: !1,
|
|
99
|
-
filterIconOnly:
|
|
107
|
+
filterIconOnly: L,
|
|
100
108
|
trailingIconOnly: !0,
|
|
101
109
|
pageActionsWidthPx: 0,
|
|
102
110
|
bulkActionsWidthPx: 0,
|
|
103
|
-
measured:
|
|
104
|
-
}), m = s ?
|
|
105
|
-
if (f >=
|
|
111
|
+
measured: c
|
|
112
|
+
}), m = s ? O : 0;
|
|
113
|
+
if (f >= x + b.selectionIndicator + m + _({
|
|
106
114
|
filterIconOnly: !1,
|
|
107
115
|
trailingIconOnly: !0,
|
|
108
116
|
pageActionsWidthPx: 0,
|
|
109
|
-
bulkActionsWidthPx:
|
|
110
|
-
}) +
|
|
117
|
+
bulkActionsWidthPx: E
|
|
118
|
+
}) + O) return {
|
|
111
119
|
mode: "inline",
|
|
112
120
|
filterIconOnly: !1,
|
|
113
121
|
trailingIconOnly: !0
|
|
114
122
|
};
|
|
115
|
-
const
|
|
116
|
-
return f >= Math.max(
|
|
123
|
+
const v = x + l(!1) + O, y = b.selectionIndicator + E + O;
|
|
124
|
+
return f >= Math.max(v, y) ? {
|
|
117
125
|
mode: "selection-split",
|
|
118
|
-
filterIconOnly: f <
|
|
126
|
+
filterIconOnly: f < x + l(!0) + O,
|
|
119
127
|
trailingIconOnly: !0
|
|
120
128
|
} : {
|
|
121
129
|
mode: "compact",
|
|
@@ -123,64 +131,76 @@ function nt(t) {
|
|
|
123
131
|
trailingIconOnly: !0
|
|
124
132
|
};
|
|
125
133
|
}
|
|
126
|
-
const
|
|
134
|
+
const U = (l) => f >= x + _(l) + R + O, w = [
|
|
127
135
|
{
|
|
128
136
|
filterIconOnly: !1,
|
|
129
137
|
trailingIconOnly: !1,
|
|
130
|
-
pageActionsWidthPx:
|
|
138
|
+
pageActionsWidthPx: g
|
|
131
139
|
},
|
|
132
140
|
{
|
|
133
|
-
filterIconOnly: !
|
|
134
|
-
trailingIconOnly: !
|
|
135
|
-
pageActionsWidthPx:
|
|
141
|
+
filterIconOnly: !0,
|
|
142
|
+
trailingIconOnly: !1,
|
|
143
|
+
pageActionsWidthPx: g
|
|
136
144
|
},
|
|
137
145
|
{
|
|
138
146
|
filterIconOnly: !0,
|
|
139
147
|
trailingIconOnly: !0,
|
|
140
|
-
pageActionsWidthPx:
|
|
148
|
+
pageActionsWidthPx: g
|
|
141
149
|
}
|
|
142
150
|
];
|
|
143
|
-
for (const
|
|
151
|
+
for (const l of w) if (U(l)) return {
|
|
144
152
|
mode: "inline",
|
|
145
|
-
filterIconOnly:
|
|
146
|
-
trailingIconOnly:
|
|
153
|
+
filterIconOnly: l.filterIconOnly,
|
|
154
|
+
trailingIconOnly: l.trailingIconOnly
|
|
147
155
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
const C = [
|
|
157
|
+
{
|
|
158
|
+
filterIconOnly: !1,
|
|
159
|
+
trailingIconOnly: !1,
|
|
160
|
+
pageActionsWidthPx: g
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
filterIconOnly: !0,
|
|
164
|
+
trailingIconOnly: !1,
|
|
165
|
+
pageActionsWidthPx: g
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
filterIconOnly: !0,
|
|
169
|
+
trailingIconOnly: !0,
|
|
170
|
+
pageActionsWidthPx: g
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
filterIconOnly: !0,
|
|
174
|
+
trailingIconOnly: !0,
|
|
175
|
+
pageActionsWidthPx: k
|
|
176
|
+
}
|
|
177
|
+
];
|
|
178
|
+
for (const l of C) if (f >= _({
|
|
179
|
+
...l,
|
|
161
180
|
searchBeforeFilter: !0
|
|
162
|
-
})
|
|
181
|
+
})) return {
|
|
163
182
|
mode: "stacked",
|
|
164
|
-
filterIconOnly:
|
|
165
|
-
trailingIconOnly:
|
|
166
|
-
}
|
|
183
|
+
filterIconOnly: l.filterIconOnly,
|
|
184
|
+
trailingIconOnly: l.trailingIconOnly
|
|
185
|
+
};
|
|
186
|
+
return {
|
|
167
187
|
mode: "compact",
|
|
168
188
|
filterIconOnly: !0,
|
|
169
189
|
trailingIconOnly: !0
|
|
170
190
|
};
|
|
171
191
|
}
|
|
172
|
-
function et(t) {
|
|
173
|
-
const { layoutMode: i, containerWidth: e, titleWidth: n, filterIconOnly: r, trailingIconOnly: c, hasFilter: s, hasSearch: u, hasLeadingUtility: h, hasTrailingUtility: I, reserveBulkActionsWidthPx: O, measured: W } = t, y = L(W), d = (h ? y.leading + l : 0) + (s ? y.filter(r) + l : 0) + (u ? y.search + l : 0) + (I ? y.trailing(c) + l : 0);
|
|
174
|
-
return i === "stacked" || i === "compact" ? Math.max(80, e - d) : Math.max(80, e - n - d - g - O);
|
|
175
|
-
}
|
|
176
192
|
function lt(t) {
|
|
177
|
-
const { layoutMode: i, containerWidth: e, titleWidth: n, filterIconOnly:
|
|
178
|
-
return i === "
|
|
193
|
+
const { layoutMode: i, containerWidth: e, titleWidth: n, filterIconOnly: o, trailingIconOnly: a, hasFilter: s, hasSearch: I, hasLeadingUtility: h, hasTrailingUtility: u, reserveBulkActionsWidthPx: P, measured: A } = t, W = T(A), d = (h ? W.leading + r : 0) + (s ? W.filter(o) + r : 0) + (I ? W.search + r : 0) + (u ? W.trailing(a) + r : 0);
|
|
194
|
+
return i === "stacked" || i === "compact" ? Math.max(80, e - d) : Math.max(80, e - n - d - O - P);
|
|
195
|
+
}
|
|
196
|
+
function rt(t) {
|
|
197
|
+
const { layoutMode: i, containerWidth: e, titleWidth: n, filterIconOnly: o, hasFilter: a, hasSearch: s, measured: I } = t, h = T(I), u = (a ? h.filter(o) + r : 0) + (s ? h.search + r : 0);
|
|
198
|
+
return i === "inline" ? Math.max(120, e - n - h.selectionIndicator - u - O * 2) : Math.max(120, e - h.selectionIndicator - O);
|
|
179
199
|
}
|
|
180
200
|
export {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
201
|
+
rt as resolveBulkActionsAvailableWidth,
|
|
202
|
+
lt as resolvePageActionsAvailableWidth,
|
|
203
|
+
nt as resolveReserveBulkActionsWidthPx,
|
|
204
|
+
$ as resolveTitleAreaWidth,
|
|
205
|
+
et as resolveToolbarLayout
|
|
186
206
|
};
|
|
@@ -10,19 +10,19 @@ function A(t, e, n) {
|
|
|
10
10
|
function p(t) {
|
|
11
11
|
return t.length ? t.reduce((e, n) => e + n.width, 0) + (t.length - 1) * 8 : 0;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function x(t, e, n) {
|
|
14
14
|
const i = p(t);
|
|
15
15
|
return e ? i + (t.length ? 8 : 0) + n : i;
|
|
16
16
|
}
|
|
17
17
|
function w(t) {
|
|
18
18
|
return t.filter((e) => !e.hidden).sort((e, n) => (n.priority ?? 0) - (e.priority ?? 0));
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function g(t) {
|
|
21
21
|
return [...t].sort((e, n) => (n.priority ?? 0) - (e.priority ?? 0));
|
|
22
22
|
}
|
|
23
23
|
function N(t, e, n) {
|
|
24
24
|
const i = [...t];
|
|
25
|
-
for (let s =
|
|
25
|
+
for (let s = 0; s < i.length && p(i) > e; s += 1) {
|
|
26
26
|
const r = i[s];
|
|
27
27
|
!r || !r.showLabel || r.action.canHideLabel === !1 || (i[s] = {
|
|
28
28
|
...r,
|
|
@@ -34,24 +34,24 @@ function N(t, e, n) {
|
|
|
34
34
|
}
|
|
35
35
|
function O(t) {
|
|
36
36
|
const { planned: e, availableWidth: n, preOverflow: i, moreButtonWidthPx: s, ignoreKeepVisible: r = !1 } = t, o = [...e], l = [], h = () => {
|
|
37
|
-
let
|
|
37
|
+
let f = -1, c = Number.POSITIVE_INFINITY;
|
|
38
38
|
for (let u = o.length - 1; u >= 0; u -= 1) {
|
|
39
39
|
const v = o[u];
|
|
40
40
|
if (!v || !r && (v.action.keepVisible || v.action.canOverflow === !1)) continue;
|
|
41
|
-
const
|
|
42
|
-
|
|
41
|
+
const d = v.action.priority ?? 0;
|
|
42
|
+
d < c && (c = d, f = u);
|
|
43
43
|
}
|
|
44
|
-
return
|
|
44
|
+
return f;
|
|
45
45
|
}, a = () => i.length > 0 || l.length > 0;
|
|
46
|
-
for (; o.length &&
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
const [c] = o.splice(
|
|
46
|
+
for (; o.length && x(o, a(), s) > n; ) {
|
|
47
|
+
const f = h();
|
|
48
|
+
if (f < 0) break;
|
|
49
|
+
const [c] = o.splice(f, 1);
|
|
50
50
|
c && l.unshift(c.action);
|
|
51
51
|
}
|
|
52
52
|
return {
|
|
53
53
|
inlineActions: o,
|
|
54
|
-
overflowActions:
|
|
54
|
+
overflowActions: g([...i, ...l])
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
function M(t) {
|
|
@@ -76,11 +76,11 @@ function M(t) {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
function B(t) {
|
|
79
|
-
const { actions: e, availableWidth: n, maxInlineActions: i, collapseLabels: s = !0, resolveActionWidth: r, moreButtonWidthPx: o = 40 } = t, l = w(e), h = i ? l.slice(0, i) : l, a = i ? l.slice(i) : [],
|
|
80
|
-
let c = e.filter((
|
|
81
|
-
action:
|
|
79
|
+
const { actions: e, availableWidth: n, maxInlineActions: i, collapseLabels: s = !0, resolveActionWidth: r, moreButtonWidthPx: o = 40 } = t, l = w(e), h = i ? l.slice(0, i) : l, a = i ? l.slice(i) : [], f = new Set(h.map((d) => d.id));
|
|
80
|
+
let c = e.filter((d) => !d.hidden && f.has(d.id)).map((d) => ({
|
|
81
|
+
action: d,
|
|
82
82
|
showLabel: !0,
|
|
83
|
-
width: A(
|
|
83
|
+
width: A(d, !0, r)
|
|
84
84
|
}));
|
|
85
85
|
s && (c = N(c, n, r));
|
|
86
86
|
const { inlineActions: u, overflowActions: v } = O({
|
|
@@ -96,14 +96,14 @@ function B(t) {
|
|
|
96
96
|
resolveActionWidth: r
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function L(t) {
|
|
100
100
|
const { actions: e, availableWidth: n, maxVisibleBulkActions: i = 3, resolveActionWidth: s, moreButtonWidthPx: r = 40 } = t, o = w(e);
|
|
101
101
|
if (o.length === 0) return {
|
|
102
102
|
inlineActions: [],
|
|
103
103
|
overflowActions: [],
|
|
104
104
|
showMoreMenu: !1
|
|
105
105
|
};
|
|
106
|
-
const l = o.slice(0, i), h = o.slice(i), { inlineActions: a, overflowActions:
|
|
106
|
+
const l = o.slice(0, i), h = o.slice(i), { inlineActions: a, overflowActions: f } = O({
|
|
107
107
|
planned: l.map((c) => ({
|
|
108
108
|
action: c,
|
|
109
109
|
showLabel: !0,
|
|
@@ -116,15 +116,15 @@ function X(t) {
|
|
|
116
116
|
});
|
|
117
117
|
return {
|
|
118
118
|
inlineActions: a,
|
|
119
|
-
overflowActions:
|
|
120
|
-
showMoreMenu:
|
|
119
|
+
overflowActions: f,
|
|
120
|
+
showMoreMenu: f.length >= 1
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
export {
|
|
124
124
|
y as ACTION_GAP_PX,
|
|
125
125
|
C as MORE_BUTTON_PX,
|
|
126
126
|
T as estimateToolbarActionWidth,
|
|
127
|
-
|
|
127
|
+
L as planBulkToolbarActions,
|
|
128
128
|
B as planToolbarActions,
|
|
129
129
|
A as resolveToolbarActionWidth
|
|
130
130
|
};
|