@rotki/ui-library 2.5.2 → 2.6.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/components/forms/auto-complete/RuiAutoComplete.vue.d.ts +52 -19
- package/dist/components/index.es.js +3596 -3622
- package/dist/composables/forms/auto-complete/focus.d.ts +28 -0
- package/dist/composables/forms/auto-complete/index.d.ts +4 -0
- package/dist/composables/forms/auto-complete/keyboard-navigation.d.ts +27 -0
- package/dist/composables/forms/auto-complete/search.d.ts +19 -0
- package/dist/composables/forms/auto-complete/value.d.ts +19 -0
- package/dist/composables/index-DRJor0yQ.js +727 -0
- package/dist/composables/index.es.js +1 -1
- package/dist/consts/forms/auto-complete/index-l0sNRNKZ.js +1 -0
- package/dist/icons/icons_1.d.ts +1 -1
- package/dist/icons/icons_1.es.js +2 -2
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.es.js +3 -3
- package/dist/{index-CIcI4wps.js → index-BpodgU9n.js} +5 -5
- package/dist/index.es.js +6 -6
- package/dist/style.css +1 -1
- package/dist/utils/{index-Cb8kepjw.js → index-lIBwzXNM.js} +1 -1
- package/dist/{vendor-DQixCxRS.js → vendor-Dt9dVBgA.js} +1 -1
- package/dist/web-types.json +13 -2
- package/package.json +1 -1
- package/dist/composables/index-CroB5xEQ.js +0 -487
|
@@ -0,0 +1,727 @@
|
|
|
1
|
+
import { useWindowSize as re, breakpointsTailwind as se, useBreakpoints as ie, createSharedComposable as ce, useColorMode as le, unrefElement as ee, useResizeObserver as te, useVirtualList as ae, useArrayMap as ue, watchOnce as fe, watchDebounced as he, refDebounced as de, useEventListener as G, useMutationObserver as pe } from "@vueuse/core";
|
|
2
|
+
import { c as J, p as me, d as ge, a as ye, o as be, f as ve, b as we, e as Se, g as Ae } from "../vendor-Dt9dVBgA.js";
|
|
3
|
+
import { computed as k, inject as Y, ref as O, watch as B, onMounted as ne, watchEffect as Ce, nextTick as z, onUnmounted as Oe } from "vue";
|
|
4
|
+
import { get as e, set as d } from "@vueuse/shared";
|
|
5
|
+
import { LuChevronsUpDown as xe, LuArrowUp as Ie, LuArrowDown as Le, LuArrowLeft as Te, LuArrowRight as Ve, LuChevronUp as ke, LuChevronDown as Ee, LuChevronLeft as De, LuChevronRight as Pe, LuChevronsLeft as je, LuChevronsRight as Me, LuCircleAlert as Fe, LuCheck as $e, LuCircleX as Be, LuCircleCheck as Re, LuCheckboxBlank as He, LuCheckboxFill as _e, LuCheckboxIndeterminateFill as qe, LuCheckboxBlankCircle as ze, LuCheckboxBlankCircleFill as Ue, LuRadioButtonFill as We, LuClock as Ne } from "../icons/icons_1.es.js";
|
|
6
|
+
import { LuEllipsis as Ke, LuInfo as Xe, LuEye as Ge, LuEyeOff as Je } from "../icons/icons_2.es.js";
|
|
7
|
+
import { LuTriangleAlert as Ye, LuX as Qe } from "../icons/icons_4.es.js";
|
|
8
|
+
import { c as Ze, b as et } from "../utils/index-lIBwzXNM.js";
|
|
9
|
+
import { d as oe, T as j } from "../types/index-CN6Ip1GL.js";
|
|
10
|
+
function yt() {
|
|
11
|
+
const { width: s } = re(), t = {
|
|
12
|
+
xs: 0,
|
|
13
|
+
...se
|
|
14
|
+
}, c = ie(t), a = Object.keys, h = a(t), S = h.map(
|
|
15
|
+
(r, o) => [
|
|
16
|
+
r,
|
|
17
|
+
o < h.length - 1 ? c.between(r, h[o + 1]) : c[r]
|
|
18
|
+
]
|
|
19
|
+
), m = S.map(([r, o]) => [
|
|
20
|
+
J(`is_${r}`),
|
|
21
|
+
o
|
|
22
|
+
]), C = h.map((r) => [
|
|
23
|
+
J(`is_${r}_and_up`),
|
|
24
|
+
c.greaterOrEqual(r)
|
|
25
|
+
]), w = h.map((r) => [
|
|
26
|
+
J(`is_${r}_and_down`),
|
|
27
|
+
c.smaller(r)
|
|
28
|
+
]), u = k(() => {
|
|
29
|
+
var r;
|
|
30
|
+
return ((r = S.find((o) => e(o[1]))) == null ? void 0 : r[0]) || "";
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
...Object.fromEntries(m),
|
|
34
|
+
...Object.fromEntries(C),
|
|
35
|
+
...Object.fromEntries(w),
|
|
36
|
+
name: u,
|
|
37
|
+
width: s
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const tt = [
|
|
41
|
+
xe,
|
|
42
|
+
Ke,
|
|
43
|
+
Ye,
|
|
44
|
+
Qe,
|
|
45
|
+
Xe,
|
|
46
|
+
Ie,
|
|
47
|
+
Le,
|
|
48
|
+
Te,
|
|
49
|
+
Ve,
|
|
50
|
+
ke,
|
|
51
|
+
Ee,
|
|
52
|
+
De,
|
|
53
|
+
Pe,
|
|
54
|
+
je,
|
|
55
|
+
Me,
|
|
56
|
+
Fe,
|
|
57
|
+
Ge,
|
|
58
|
+
Je,
|
|
59
|
+
$e,
|
|
60
|
+
Be,
|
|
61
|
+
Re,
|
|
62
|
+
He,
|
|
63
|
+
_e,
|
|
64
|
+
qe,
|
|
65
|
+
ze,
|
|
66
|
+
Ue,
|
|
67
|
+
We,
|
|
68
|
+
Ne
|
|
69
|
+
], nt = Symbol.for("rui:icons");
|
|
70
|
+
function bt(s) {
|
|
71
|
+
const t = (s == null ? void 0 : s.registeredIcons) || [];
|
|
72
|
+
return {
|
|
73
|
+
registeredIcons: {
|
|
74
|
+
...Object.fromEntries(
|
|
75
|
+
[
|
|
76
|
+
...tt,
|
|
77
|
+
...t
|
|
78
|
+
].map(({ components: c, name: a }) => [a, c])
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function vt() {
|
|
84
|
+
const s = Y(nt);
|
|
85
|
+
return Ze(s, "Could not find icons injection"), s;
|
|
86
|
+
}
|
|
87
|
+
const N = O({ ...oe }), wt = ce(() => {
|
|
88
|
+
const { state: s, store: t } = le(), c = k(() => e(t) === j.auto), a = k(() => e(s) === j.light), h = k(() => e(s) === j.dark), S = k(() => e(a) ? e(N).light : e(N).dark), m = (r) => {
|
|
89
|
+
d(t, r || j.auto);
|
|
90
|
+
}, C = () => {
|
|
91
|
+
e(c) ? m(j.light) : e(a) ? m(j.dark) : e(h) && m(j.auto);
|
|
92
|
+
}, w = (r) => {
|
|
93
|
+
d(N, r);
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
config: N,
|
|
97
|
+
init: (r) => {
|
|
98
|
+
m(r.mode ?? j.auto), w(r.config ?? { ...oe }), typeof window < "u" && B([a, S], ([o, f]) => {
|
|
99
|
+
const l = /* @__PURE__ */ new Map();
|
|
100
|
+
Object.entries(f).forEach(([g, y]) => {
|
|
101
|
+
l.set(`--rui-${g}-darker`, y.darker), l.set(`--rui-${g}-lighter`, y.lighter), l.set(`--rui-${g}-main`, y.DEFAULT);
|
|
102
|
+
});
|
|
103
|
+
const n = o ? j.light : j.dark;
|
|
104
|
+
l.set("--rui-text-disabled", `var(--rui-${n}-text-disabled)`), l.set("--rui-text-primary", `var(--rui-${n}-text-primary)`), l.set("--rui-text-secondary", `var(--rui-${n}-text-secondary)`);
|
|
105
|
+
const b = document.documentElement.style;
|
|
106
|
+
l.forEach((g, y) => {
|
|
107
|
+
b.setProperty(y, g);
|
|
108
|
+
});
|
|
109
|
+
}, { immediate: !0 });
|
|
110
|
+
},
|
|
111
|
+
isAutoControlled: c,
|
|
112
|
+
isDark: h,
|
|
113
|
+
isLight: a,
|
|
114
|
+
setThemeConfig: w,
|
|
115
|
+
state: s,
|
|
116
|
+
store: t,
|
|
117
|
+
switchThemeScheme: m,
|
|
118
|
+
theme: S,
|
|
119
|
+
toggleThemeMode: C
|
|
120
|
+
};
|
|
121
|
+
}), M = {
|
|
122
|
+
adaptive: !0,
|
|
123
|
+
gpuAcceleration: !0,
|
|
124
|
+
locked: !1,
|
|
125
|
+
offsetDistance: 8,
|
|
126
|
+
offsetSkid: 0,
|
|
127
|
+
overflowPadding: 8,
|
|
128
|
+
placement: "bottom",
|
|
129
|
+
resize: !0,
|
|
130
|
+
scroll: !0,
|
|
131
|
+
strategy: "absolute"
|
|
132
|
+
}, ot = me({
|
|
133
|
+
defaultModifiers: [
|
|
134
|
+
...ge,
|
|
135
|
+
ye,
|
|
136
|
+
be,
|
|
137
|
+
ve,
|
|
138
|
+
we,
|
|
139
|
+
Se,
|
|
140
|
+
Ae
|
|
141
|
+
]
|
|
142
|
+
});
|
|
143
|
+
function St(s, t = O(!1), c = O(0), a = O(0), h) {
|
|
144
|
+
const S = O(null), m = O(null), C = O(null), w = O(!1), u = O(), r = O(), o = O(!1), f = O(!1), l = () => {
|
|
145
|
+
d(o, !1);
|
|
146
|
+
}, n = () => {
|
|
147
|
+
var i;
|
|
148
|
+
(i = e(C)) == null || i.update();
|
|
149
|
+
}, b = (i = !1) => {
|
|
150
|
+
if (!e(t) && (e(r) && (clearTimeout(e(r)), d(r, void 0)), d(f, !1), !e(u))) {
|
|
151
|
+
d(o, !0);
|
|
152
|
+
const v = setTimeout(() => {
|
|
153
|
+
d(w, !0), d(u, void 0);
|
|
154
|
+
}, i ? 0 : e(c));
|
|
155
|
+
d(u, v);
|
|
156
|
+
}
|
|
157
|
+
}, g = (i = !1) => {
|
|
158
|
+
if (!e(t) && (e(u) && (clearTimeout(e(u)), d(u, void 0)), !e(r))) {
|
|
159
|
+
const v = setTimeout(() => {
|
|
160
|
+
e(w) || l(), d(w, !1), d(r, void 0);
|
|
161
|
+
}, i ? 0 : e(a));
|
|
162
|
+
d(r, v);
|
|
163
|
+
}
|
|
164
|
+
}, y = () => {
|
|
165
|
+
d(f, !0);
|
|
166
|
+
};
|
|
167
|
+
return ne(() => {
|
|
168
|
+
Ce((i) => {
|
|
169
|
+
if (!e(m) || !e(S) && !e(h))
|
|
170
|
+
return;
|
|
171
|
+
const v = ee(m), x = e(h) || ee(S);
|
|
172
|
+
if (!(v instanceof HTMLElement) || !x)
|
|
173
|
+
return;
|
|
174
|
+
const {
|
|
175
|
+
adaptive: L = M.adaptive,
|
|
176
|
+
gpuAcceleration: T = M.gpuAcceleration,
|
|
177
|
+
locked: V = M.locked,
|
|
178
|
+
offsetDistance: I = M.offsetDistance,
|
|
179
|
+
offsetSkid: R = M.offsetSkid,
|
|
180
|
+
overflowPadding: U = M.overflowPadding,
|
|
181
|
+
placement: W = M.placement,
|
|
182
|
+
resize: H = M.resize,
|
|
183
|
+
scroll: _ = M.scroll,
|
|
184
|
+
strategy: K = M.strategy
|
|
185
|
+
} = e(s), X = ot(x, v, {
|
|
186
|
+
modifiers: [
|
|
187
|
+
{
|
|
188
|
+
enabled: !V,
|
|
189
|
+
name: "flip"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: "preventOverflow",
|
|
193
|
+
options: {
|
|
194
|
+
padding: U
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: "offset",
|
|
199
|
+
options: {
|
|
200
|
+
offset: [R, I]
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "computeStyles",
|
|
205
|
+
options: {
|
|
206
|
+
adaptive: L,
|
|
207
|
+
gpuAcceleration: T
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: "eventListeners",
|
|
212
|
+
options: {
|
|
213
|
+
resize: H,
|
|
214
|
+
scroll: _
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: "arrow",
|
|
219
|
+
options: {
|
|
220
|
+
padding: 4
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
placement: W,
|
|
225
|
+
strategy: K
|
|
226
|
+
});
|
|
227
|
+
d(C, X), i(X.destroy);
|
|
228
|
+
});
|
|
229
|
+
}), te([S, m], async () => {
|
|
230
|
+
const i = e(C);
|
|
231
|
+
e(w) && i && await i.update();
|
|
232
|
+
}), {
|
|
233
|
+
instance: C,
|
|
234
|
+
leavePending: f,
|
|
235
|
+
onClose: g,
|
|
236
|
+
onLeavePending: y,
|
|
237
|
+
onOpen: b,
|
|
238
|
+
onPopperLeave: l,
|
|
239
|
+
open: w,
|
|
240
|
+
popper: m,
|
|
241
|
+
popperEnter: o,
|
|
242
|
+
reference: S,
|
|
243
|
+
updatePopper: n
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function rt({
|
|
247
|
+
keyAttr: s,
|
|
248
|
+
textAttr: t
|
|
249
|
+
}) {
|
|
250
|
+
function c(h) {
|
|
251
|
+
var S;
|
|
252
|
+
return t ? typeof t == "function" ? t(h) : (S = h[t]) == null ? void 0 : S.toString() : h == null ? void 0 : h.toString();
|
|
253
|
+
}
|
|
254
|
+
function a(h) {
|
|
255
|
+
return s ? h[s] : h;
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
getIdentifier: a,
|
|
259
|
+
getText: c
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function At({
|
|
263
|
+
appendWidth: s,
|
|
264
|
+
autoFocus: t,
|
|
265
|
+
autoSelectFirst: c,
|
|
266
|
+
dense: a,
|
|
267
|
+
hideSelected: h,
|
|
268
|
+
itemHeight: S = 48,
|
|
269
|
+
keyAttr: m,
|
|
270
|
+
menuRef: C,
|
|
271
|
+
options: w,
|
|
272
|
+
overscan: u = 5,
|
|
273
|
+
prependWidth: r,
|
|
274
|
+
setValue: o,
|
|
275
|
+
textAttr: f,
|
|
276
|
+
value: l
|
|
277
|
+
}) {
|
|
278
|
+
const n = k(() => {
|
|
279
|
+
const p = e(w);
|
|
280
|
+
return h ? p.filter((A) => !H(A)) : p;
|
|
281
|
+
}), { getIdentifier: b, getText: g } = rt({
|
|
282
|
+
keyAttr: m,
|
|
283
|
+
textAttr: f
|
|
284
|
+
}), { containerProps: y, list: i, scrollTo: v, wrapperProps: x } = ae(
|
|
285
|
+
n,
|
|
286
|
+
{
|
|
287
|
+
itemHeight: S,
|
|
288
|
+
overscan: u
|
|
289
|
+
}
|
|
290
|
+
), L = ue(i, ({ data: p, index: A }) => ({ _index: A, item: p })), T = O(!1), V = k(() => {
|
|
291
|
+
const p = e(l);
|
|
292
|
+
return !m || !p ? p : Array.isArray(p) ? p.map((A) => A[m]) : p[m];
|
|
293
|
+
}), I = O(e(c) ? 0 : -1), R = k(() => {
|
|
294
|
+
const p = { max: 0, min: 0 }, A = 30, P = 1.5, E = e(a) ? 12 : 13;
|
|
295
|
+
e(n).forEach((F) => {
|
|
296
|
+
var Q, Z;
|
|
297
|
+
const $ = ((Z = (Q = g(F)) == null ? void 0 : Q.toString()) == null ? void 0 : Z.length) ?? 0;
|
|
298
|
+
p.min === 0 && p.max === 0 ? (p.min = $, p.max = $) : $ < p.min ? p.min = $ : $ > p.max && (p.max = $);
|
|
299
|
+
});
|
|
300
|
+
const q = p.max - p.min;
|
|
301
|
+
function D(F) {
|
|
302
|
+
const $ = (r ? r + 0.5 : 0) + (s ? s + 0.5 : 0);
|
|
303
|
+
return `${Math.min(F * E / 16 + P + $, A)}rem`;
|
|
304
|
+
}
|
|
305
|
+
return q <= 5 ? D(p.max) : D(p.min + q / 2);
|
|
306
|
+
});
|
|
307
|
+
function U(p = !1) {
|
|
308
|
+
d(T, p);
|
|
309
|
+
}
|
|
310
|
+
function W(p) {
|
|
311
|
+
const A = e(l), P = Array.isArray(A) ? A : A ? [A] : [];
|
|
312
|
+
return P.length === 0 ? -1 : P.findIndex((E) => m ? E[m] === p[m] : E === p);
|
|
313
|
+
}
|
|
314
|
+
function H(p) {
|
|
315
|
+
return W(p) !== -1;
|
|
316
|
+
}
|
|
317
|
+
async function _(p = !1) {
|
|
318
|
+
const A = e(I);
|
|
319
|
+
A > -1 && await z(() => {
|
|
320
|
+
var E, q;
|
|
321
|
+
if ((E = e(C)) == null ? void 0 : E.parentElement) {
|
|
322
|
+
const D = e(C).getElementsByClassName("highlighted")[0];
|
|
323
|
+
if (D)
|
|
324
|
+
(q = D.scrollIntoView) == null || q.call(D, { behavior: p ? "smooth" : "auto", block: "nearest" }), e(t) && "focus" in D && typeof D.focus == "function" && (D == null || D.focus());
|
|
325
|
+
else if (v(A), e(t)) {
|
|
326
|
+
const F = e(C).getElementsByClassName("highlighted")[0];
|
|
327
|
+
F && "focus" in F && typeof F.focus == "function" && F.focus();
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
async function K(p) {
|
|
333
|
+
await z(() => {
|
|
334
|
+
if (p) {
|
|
335
|
+
const A = e(l);
|
|
336
|
+
if (Array.isArray(A) && A.length > 0 || A) {
|
|
337
|
+
const P = e(n).findIndex(H);
|
|
338
|
+
P > -1 && d(I, P);
|
|
339
|
+
}
|
|
340
|
+
fe(i, async () => {
|
|
341
|
+
await _();
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
return B(T, K), B(I, async (p, A) => {
|
|
347
|
+
p !== A && await _(!0);
|
|
348
|
+
}), B(n, async () => {
|
|
349
|
+
e(I) !== -1 ? e(c) ? (d(I, 0), await _()) : (d(I, -1), v(0)) : v(0);
|
|
350
|
+
}), {
|
|
351
|
+
applyHighlighted: () => {
|
|
352
|
+
if (!o || !e(T))
|
|
353
|
+
return;
|
|
354
|
+
const p = e(I);
|
|
355
|
+
if (p === -1)
|
|
356
|
+
return;
|
|
357
|
+
const A = e(n).find((P, E) => p === E);
|
|
358
|
+
A && o(A);
|
|
359
|
+
},
|
|
360
|
+
containerProps: y,
|
|
361
|
+
getIdentifier: b,
|
|
362
|
+
getText: g,
|
|
363
|
+
highlightedIndex: I,
|
|
364
|
+
isActiveItem: H,
|
|
365
|
+
isOpen: T,
|
|
366
|
+
itemIndexInValue: W,
|
|
367
|
+
menuWidth: R,
|
|
368
|
+
moveHighlight: (p) => {
|
|
369
|
+
if (!e(T)) {
|
|
370
|
+
U(!0);
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
let A = e(I);
|
|
374
|
+
A += p ? -1 : 1;
|
|
375
|
+
const E = e(n).length;
|
|
376
|
+
A >= E ? d(I, 0) : A < 0 ? d(I, E - 1) : d(I, A);
|
|
377
|
+
},
|
|
378
|
+
optionsWithSelectedHidden: n,
|
|
379
|
+
renderedData: L,
|
|
380
|
+
toggle: U,
|
|
381
|
+
valueKey: V,
|
|
382
|
+
wrapperProps: x
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
function Ct(s, t) {
|
|
386
|
+
const c = k(
|
|
387
|
+
() => e(t.activatorFocusedWithin) || e(t.menuWrapperFocusedWithin)
|
|
388
|
+
), a = k(() => {
|
|
389
|
+
const C = e(c), w = e(s.disabled), u = e(s.shouldApplyValueAsSearch), r = e(t.internalSearch);
|
|
390
|
+
return (!C || w) && !u ? "w-0 h-0" : r ? "flex-1 min-w-[4rem]" : "flex-1 min-w-0";
|
|
391
|
+
});
|
|
392
|
+
async function h() {
|
|
393
|
+
await z(() => {
|
|
394
|
+
d(t.searchInputFocused, !0);
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
async function S() {
|
|
398
|
+
await z(() => {
|
|
399
|
+
e(t.activatorFocused) || d(t.searchInputFocused, !0);
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
function m() {
|
|
403
|
+
if (d(t.focusedValueIndex, -1), e(s.shouldApplyValueAsSearch)) {
|
|
404
|
+
const w = e(t.textInput);
|
|
405
|
+
w == null || w.select();
|
|
406
|
+
}
|
|
407
|
+
e(t.isOpen) || d(t.justOpened, !0);
|
|
408
|
+
}
|
|
409
|
+
return he(c, (C) => {
|
|
410
|
+
if (!C) {
|
|
411
|
+
d(t.isOpen, !1);
|
|
412
|
+
const w = e(s.customValue), u = e(t.filteredOptions), r = e(t.internalSearch);
|
|
413
|
+
w && u.length === 0 && r && t.setSearchAsValue(), e(s.shouldApplyValueAsSearch) || t.updateInternalSearch();
|
|
414
|
+
}
|
|
415
|
+
}, {
|
|
416
|
+
debounce: 200,
|
|
417
|
+
maxWait: 400
|
|
418
|
+
}), {
|
|
419
|
+
anyFocused: c,
|
|
420
|
+
inputClass: a,
|
|
421
|
+
onActivatorFocused: S,
|
|
422
|
+
onInputFocused: m,
|
|
423
|
+
setInputFocus: h
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
function Ot(s, t) {
|
|
427
|
+
const c = O(-1), a = O(/* @__PURE__ */ new Map());
|
|
428
|
+
function h(u) {
|
|
429
|
+
d(c, u);
|
|
430
|
+
}
|
|
431
|
+
function S(u, r) {
|
|
432
|
+
const o = e(s.multiple), f = e(t.internalSearch);
|
|
433
|
+
if (!o || f.length > 0)
|
|
434
|
+
return;
|
|
435
|
+
u.preventDefault();
|
|
436
|
+
const l = e(t.value).length;
|
|
437
|
+
let n = e(c);
|
|
438
|
+
if (n === -1) {
|
|
439
|
+
d(c, r ? 0 : l - 1);
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
n += r ? 1 : -1, n < 0 || n >= l ? (d(c, -1), d(t.searchInputFocused, !0)) : d(c, n);
|
|
443
|
+
}
|
|
444
|
+
function m(u) {
|
|
445
|
+
const r = e(t.filteredOptions), o = e(t.highlightedIndex), f = e(t.isOpen), l = e(s.customValue), n = e(s.multiple), b = e(t.value), g = e(t.internalSearch);
|
|
446
|
+
if (l && g && f) {
|
|
447
|
+
let y = !1;
|
|
448
|
+
if (o > -1 && o < r.length) {
|
|
449
|
+
const i = r[o];
|
|
450
|
+
typeof i == "string" ? y = i === g : i && typeof i == "object" && (y = (i.label || i.value || "") === g);
|
|
451
|
+
}
|
|
452
|
+
if (!y) {
|
|
453
|
+
t.setSearchAsValue(), n || d(t.isOpen, !1), u.preventDefault();
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
if (r.length > 0 && o > -1 && f)
|
|
458
|
+
t.applyHighlighted(), u.preventDefault();
|
|
459
|
+
else if (r.length === 0 && l && g)
|
|
460
|
+
t.setSearchAsValue(), n || d(t.isOpen, !1), u.preventDefault();
|
|
461
|
+
else if (!f && b.length === 0)
|
|
462
|
+
d(t.isOpen, !0), u.preventDefault();
|
|
463
|
+
else {
|
|
464
|
+
const y = e(t.activator), i = y == null ? void 0 : y.closest("form");
|
|
465
|
+
i && i.dispatchEvent(new Event("submit"));
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
function C(u) {
|
|
469
|
+
const r = e(t.isOpen), o = e(t.filteredOptions), f = e(t.highlightedIndex), l = e(s.multiple);
|
|
470
|
+
r && o.length > 0 && f > -1 && !l && (t.applyHighlighted(), u.preventDefault());
|
|
471
|
+
}
|
|
472
|
+
function w() {
|
|
473
|
+
const u = e(t.internalSearch), o = e(t.value).length, f = e(s.multiple);
|
|
474
|
+
!u && o > 0 && (f ? d(c, o - 1) : t.clear());
|
|
475
|
+
}
|
|
476
|
+
return B(t.value, () => {
|
|
477
|
+
h(-1), e(a).clear();
|
|
478
|
+
}), B(c, async (u) => {
|
|
479
|
+
const r = e(s.multiple);
|
|
480
|
+
u === -1 || !r || await z(() => {
|
|
481
|
+
const o = e(a);
|
|
482
|
+
let f = o.get(u);
|
|
483
|
+
if (!f) {
|
|
484
|
+
const l = e(t.activator), n = l == null ? void 0 : l.querySelector(`[data-index="${u}"]`);
|
|
485
|
+
n && (f = n, o.set(u, n));
|
|
486
|
+
}
|
|
487
|
+
f && "focus" in f && typeof f.focus == "function" && f.focus();
|
|
488
|
+
});
|
|
489
|
+
}), {
|
|
490
|
+
focusedValueIndex: c,
|
|
491
|
+
moveSelectedValueHighlight: S,
|
|
492
|
+
onEnter: m,
|
|
493
|
+
onInputDeletePressed: w,
|
|
494
|
+
onTab: C,
|
|
495
|
+
setValueFocus: h
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
function xt(s, t, c) {
|
|
499
|
+
const a = O(""), h = de(a, 50), S = O(!1), m = /* @__PURE__ */ new Map(), C = (o) => {
|
|
500
|
+
if (m.has(o))
|
|
501
|
+
return m.get(o);
|
|
502
|
+
const f = et(o);
|
|
503
|
+
return m.set(o, f), f;
|
|
504
|
+
}, w = k(() => {
|
|
505
|
+
const o = e(h), f = e(s);
|
|
506
|
+
if (e(c.noFilter) || !o || e(S))
|
|
507
|
+
return f;
|
|
508
|
+
const n = e(c.keyAttr), b = e(c.textAttr), g = e(c.filter), y = C(o), i = g || ((V) => {
|
|
509
|
+
if (!V)
|
|
510
|
+
return !1;
|
|
511
|
+
const I = [n ? C(V[n]) : V.toString()];
|
|
512
|
+
return b && typeof V == "object" && I.push(C(V[b])), I.some((R) => C(R).includes(y));
|
|
513
|
+
}), v = f.filter((V) => i(V, o)), x = e(c.customValue), L = e(c.hideCustomValue);
|
|
514
|
+
return !x || L || !o || v.some((V) => V ? (b ? V[b] : V.toString()) === o : !1) ? v : [u(o, {
|
|
515
|
+
keyAttr: n,
|
|
516
|
+
returnObject: e(c.returnObject),
|
|
517
|
+
textAttr: b
|
|
518
|
+
}), ...v];
|
|
519
|
+
});
|
|
520
|
+
function u(o, f) {
|
|
521
|
+
const { keyAttr: l, returnObject: n, textAttr: b } = f;
|
|
522
|
+
return !l || n ? o : {
|
|
523
|
+
[l]: o,
|
|
524
|
+
...b ? { [b]: o } : {}
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
function r(o = "") {
|
|
528
|
+
d(t, o), d(a, o);
|
|
529
|
+
}
|
|
530
|
+
return B(t, (o) => {
|
|
531
|
+
d(a, o);
|
|
532
|
+
}, { immediate: !0 }), Oe(() => {
|
|
533
|
+
m.clear();
|
|
534
|
+
}), {
|
|
535
|
+
debouncedInternalSearch: h,
|
|
536
|
+
filteredOptions: w,
|
|
537
|
+
internalSearch: a,
|
|
538
|
+
justOpened: S,
|
|
539
|
+
textValueToProperValue: (o, f = !1) => u(o, {
|
|
540
|
+
keyAttr: e(c.keyAttr),
|
|
541
|
+
returnObject: f || e(c.returnObject),
|
|
542
|
+
textAttr: e(c.textAttr)
|
|
543
|
+
}),
|
|
544
|
+
updateInternalSearch: r
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
function It(s, t, c, a) {
|
|
548
|
+
const h = k(() => Array.isArray(e(s))), S = k(() => {
|
|
549
|
+
const n = /* @__PURE__ */ new Map(), b = e(t);
|
|
550
|
+
for (const g of b)
|
|
551
|
+
n.set(a.getIdentifier(g), g);
|
|
552
|
+
return n;
|
|
553
|
+
});
|
|
554
|
+
function m(n) {
|
|
555
|
+
return n ? Array.isArray(n) ? n : [n] : [];
|
|
556
|
+
}
|
|
557
|
+
function C(n, b, g, y) {
|
|
558
|
+
const i = [];
|
|
559
|
+
i.length = n.length;
|
|
560
|
+
let v = 0;
|
|
561
|
+
for (const x of n) {
|
|
562
|
+
const L = a.getIdentifier(x), T = b.get(L);
|
|
563
|
+
T ? i[v++] = T : g && (i[v++] = a.textValueToProperValue(x, y));
|
|
564
|
+
}
|
|
565
|
+
return i.length = v, i;
|
|
566
|
+
}
|
|
567
|
+
function w(n, b, g, y) {
|
|
568
|
+
const i = [];
|
|
569
|
+
i.length = n.length;
|
|
570
|
+
let v = 0;
|
|
571
|
+
for (const x of n) {
|
|
572
|
+
const L = b.get(x);
|
|
573
|
+
L ? i[v++] = L : g && (i[v++] = a.textValueToProperValue(x, y));
|
|
574
|
+
}
|
|
575
|
+
return i.length = v, i;
|
|
576
|
+
}
|
|
577
|
+
function u(n, b, g, y, i) {
|
|
578
|
+
const v = Array.isArray(n), x = m(n), L = C(x, b, y, g);
|
|
579
|
+
if (v || L.length === 0)
|
|
580
|
+
return i && a.updateInternalSearch(), L;
|
|
581
|
+
const T = L[0];
|
|
582
|
+
return i && a.updateInternalSearch(a.getText(T)), [T];
|
|
583
|
+
}
|
|
584
|
+
function r(n, b, g, y, i) {
|
|
585
|
+
const v = m(n), x = w(v, b, y, g);
|
|
586
|
+
return i && (x.length > 0 ? a.updateInternalSearch(a.getText(x[0])) : a.updateInternalSearch()), x;
|
|
587
|
+
}
|
|
588
|
+
function o(n) {
|
|
589
|
+
d(s, n);
|
|
590
|
+
}
|
|
591
|
+
function f(n) {
|
|
592
|
+
const b = e(c.keyAttr), g = e(c.returnObject), y = b && !g ? n.map((i) => i[b]) : n;
|
|
593
|
+
return e(h) ? o(y) : y.length === 0 ? o(void 0) : o(y[0]);
|
|
594
|
+
}
|
|
595
|
+
const l = k({
|
|
596
|
+
get: () => {
|
|
597
|
+
const n = e(s), b = e(c.keyAttr), g = e(c.returnObject) ?? !1, y = e(c.customValue) ?? !1, i = e(S), v = e(a.shouldApplyValueAsSearch) && !e(a.isOpen);
|
|
598
|
+
return b && g ? u(
|
|
599
|
+
n,
|
|
600
|
+
i,
|
|
601
|
+
g,
|
|
602
|
+
y,
|
|
603
|
+
v
|
|
604
|
+
) : r(
|
|
605
|
+
n,
|
|
606
|
+
i,
|
|
607
|
+
g,
|
|
608
|
+
y,
|
|
609
|
+
v
|
|
610
|
+
);
|
|
611
|
+
},
|
|
612
|
+
set: (n) => {
|
|
613
|
+
f(n);
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
return {
|
|
617
|
+
setSelected: f,
|
|
618
|
+
value: l
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
const st = Symbol("rui:i18n");
|
|
622
|
+
function Lt() {
|
|
623
|
+
const s = Y(st, void 0), t = (a, h) => {
|
|
624
|
+
if (s != null && s.te(a))
|
|
625
|
+
return s == null ? void 0 : s.t(a, h);
|
|
626
|
+
};
|
|
627
|
+
return { t: (a, h, S) => typeof h == "string" ? t(a) ?? h ?? a : t(a, h) ?? S ?? a };
|
|
628
|
+
}
|
|
629
|
+
const it = Symbol.for("rui:table");
|
|
630
|
+
function Tt(s) {
|
|
631
|
+
return {
|
|
632
|
+
globalItemsPerPage: !1,
|
|
633
|
+
itemsPerPage: O(10),
|
|
634
|
+
limits: [10, 25, 50, 100],
|
|
635
|
+
stickyOffset: O(0),
|
|
636
|
+
...s
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
function Vt() {
|
|
640
|
+
const s = Y(it);
|
|
641
|
+
if (!s)
|
|
642
|
+
throw new Error("Could not find rui table options injection");
|
|
643
|
+
return s;
|
|
644
|
+
}
|
|
645
|
+
function kt(s = O(!1), t) {
|
|
646
|
+
const c = O(null), a = O(null), h = O(!1), S = -0.5, m = {
|
|
647
|
+
head: ":scope > thead[data-id=head-main]",
|
|
648
|
+
headClone: ":scope > thead[data-id=head-clone]",
|
|
649
|
+
row: ":scope > tbody > tr:not([hidden])",
|
|
650
|
+
th: ":scope > th"
|
|
651
|
+
}, C = () => {
|
|
652
|
+
const u = e(c);
|
|
653
|
+
if (!e(s) || !u)
|
|
654
|
+
return;
|
|
655
|
+
const r = u.querySelector(
|
|
656
|
+
`${m.headClone} > tr`
|
|
657
|
+
), o = u.querySelector(`${m.head} > tr`) ?? null, f = () => {
|
|
658
|
+
const l = o == null ? void 0 : o.querySelectorAll(
|
|
659
|
+
m.th
|
|
660
|
+
), n = r == null ? void 0 : r.querySelectorAll(m.th);
|
|
661
|
+
n == null || n.forEach((b, g) => {
|
|
662
|
+
te(b, (y) => {
|
|
663
|
+
const i = y[0].target.getBoundingClientRect(), v = l == null ? void 0 : l.item(g);
|
|
664
|
+
v && (v.style.width = `${i.width}px`);
|
|
665
|
+
});
|
|
666
|
+
});
|
|
667
|
+
};
|
|
668
|
+
pe(r, (l) => {
|
|
669
|
+
for (const n of l)
|
|
670
|
+
(n.type === "childList" || n.type === "attributes") && f();
|
|
671
|
+
}, {
|
|
672
|
+
attributes: !0,
|
|
673
|
+
childList: !0,
|
|
674
|
+
subtree: !0
|
|
675
|
+
}), f();
|
|
676
|
+
}, w = () => {
|
|
677
|
+
var V;
|
|
678
|
+
const u = e(c);
|
|
679
|
+
if (!e(s) || !u)
|
|
680
|
+
return;
|
|
681
|
+
const r = u.getBoundingClientRect(), o = u.querySelector(
|
|
682
|
+
m.headClone
|
|
683
|
+
), f = o == null ? void 0 : o.getBoundingClientRect(), l = u.querySelector(m.head) ?? null, n = l == null ? void 0 : l.getBoundingClientRect();
|
|
684
|
+
if (!r || !f || !l || !o || !n)
|
|
685
|
+
return;
|
|
686
|
+
const {
|
|
687
|
+
height: b,
|
|
688
|
+
left: g,
|
|
689
|
+
width: y
|
|
690
|
+
} = f, { bottom: i, top: v } = r, x = e(t) ?? 0;
|
|
691
|
+
l.style.width = `${y}px`;
|
|
692
|
+
const L = u.querySelectorAll(m.row), T = (V = L.item(L.length - 1)) == null ? void 0 : V.getBoundingClientRect();
|
|
693
|
+
if (v <= x && i > x && L.length > 1) {
|
|
694
|
+
d(h, !0), l.style.left = `${g + S}px`;
|
|
695
|
+
const I = (T == null ? void 0 : T.height) ?? 0;
|
|
696
|
+
i <= I + b + x ? l.style.top = `${i - I - b}px` : l.style.top = `${x}px`;
|
|
697
|
+
} else
|
|
698
|
+
d(h, !1), l.style.left = `${S}px`, l.style.top = "0";
|
|
699
|
+
};
|
|
700
|
+
return ne(() => {
|
|
701
|
+
w(), G(a, "scroll", w), G(document.body, "scroll", w), G(window, "resize", w), C();
|
|
702
|
+
}), {
|
|
703
|
+
stick: h,
|
|
704
|
+
table: c,
|
|
705
|
+
tableScroller: a
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
export {
|
|
709
|
+
nt as I,
|
|
710
|
+
st as R,
|
|
711
|
+
it as T,
|
|
712
|
+
St as a,
|
|
713
|
+
wt as b,
|
|
714
|
+
rt as c,
|
|
715
|
+
xt as d,
|
|
716
|
+
It as e,
|
|
717
|
+
At as f,
|
|
718
|
+
Ot as g,
|
|
719
|
+
Ct as h,
|
|
720
|
+
Lt as i,
|
|
721
|
+
Vt as j,
|
|
722
|
+
kt as k,
|
|
723
|
+
Tt as l,
|
|
724
|
+
bt as m,
|
|
725
|
+
yt as n,
|
|
726
|
+
vt as u
|
|
727
|
+
};
|