@opentiny/tiny-robot 0.5.2-beta.0 → 0.5.2-rc.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/anchor/index.js +32 -32
- package/dist/container/index.js +15 -16
- package/dist/dropdown-menu/index.js +97 -141
- package/dist/index.d.ts +122 -695
- package/dist/index.js +89 -103
- package/dist/index4.js +2 -2
- package/dist/index6.js +399 -408
- package/dist/index7.js +180 -271
- package/dist/index8.js +102 -87
- package/dist/layout/index.js +1 -1
- package/dist/sender/index.js +2138 -1219
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +1 -1
- package/dist/suggestion-popover/index.js +36 -37
- package/dist/useSlotRefs.js +1 -1
- package/dist/utils.js +1 -1
- package/package.json +4 -4
- package/dist/extension-manager/index.js +0 -1006
- package/dist/floating-ui.dom.js +0 -970
- package/dist/model-selector/index.js +0 -1003
- package/dist/useTeleportTarget.js +0 -25
package/dist/anchor/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as G, ref as _, computed as g, watch as F, openBlock as M, createElementBlock as R, normalizeClass as pe, createElementVNode as D, renderSlot as L, Fragment as W, renderList as ye, toDisplayString as te, createTextVNode as Te, createCommentVNode as re, createBlock as xe, createSlots as ne, withCtx as P, mergeProps as ae, useSlots as Ae, normalizeStyle as
|
|
1
|
+
import { defineComponent as G, ref as _, computed as g, watch as F, openBlock as M, createElementBlock as R, normalizeClass as pe, createElementVNode as D, renderSlot as L, Fragment as W, renderList as ye, toDisplayString as te, createTextVNode as Te, createCommentVNode as re, createBlock as xe, createSlots as ne, withCtx as P, mergeProps as ae, useSlots as Ae, normalizeStyle as be, onBeforeUnmount as oe, nextTick as ke, useAttrs as Ce, toRefs as Me, unref as E, createVNode as se, normalizeProps as ue, guardReactiveProps as de } from "vue";
|
|
2
2
|
import { h as Ee, i as _e, g as V, j as he } from "../index4.js";
|
|
3
3
|
import { _ as Y } from "../_plugin-vue_export-helper.js";
|
|
4
4
|
const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"], we = { class: "tr-anchor__marker-slot" }, Re = { class: "tr-anchor__item-content" }, Le = {
|
|
@@ -38,24 +38,24 @@ const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"],
|
|
|
38
38
|
function y(p) {
|
|
39
39
|
return !!(p && p.scrollWidth > p.clientWidth);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function b() {
|
|
42
42
|
var p;
|
|
43
43
|
return ((p = h.value) == null ? void 0 : p.querySelector(".tr-anchor__item-label")) ?? null;
|
|
44
44
|
}
|
|
45
45
|
function S() {
|
|
46
|
-
n.value = l.expanded && r.value && y(
|
|
46
|
+
n.value = l.expanded && r.value && y(b());
|
|
47
47
|
}
|
|
48
48
|
function I() {
|
|
49
49
|
s(), n.value = !1, !(!l.expanded || !r.value) && c();
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function k() {
|
|
52
52
|
s(), n.value = !1;
|
|
53
53
|
}
|
|
54
54
|
function $() {
|
|
55
55
|
r.value = !0, I();
|
|
56
56
|
}
|
|
57
57
|
function H() {
|
|
58
|
-
r.value = !1,
|
|
58
|
+
r.value = !1, k();
|
|
59
59
|
}
|
|
60
60
|
function A(p) {
|
|
61
61
|
p.propertyName === "max-width" && r.value && S();
|
|
@@ -64,7 +64,7 @@ const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"],
|
|
|
64
64
|
() => l.expanded,
|
|
65
65
|
(p) => {
|
|
66
66
|
if (!p) {
|
|
67
|
-
|
|
67
|
+
k();
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
r.value && I();
|
|
@@ -118,7 +118,7 @@ const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"],
|
|
|
118
118
|
], 40, He)
|
|
119
119
|
], 10, Oe));
|
|
120
120
|
}
|
|
121
|
-
}), Be = /* @__PURE__ */ Y($e, [["__scopeId", "data-v-
|
|
121
|
+
}), Be = /* @__PURE__ */ Y($e, [["__scopeId", "data-v-f39ebac0"]]), Ne = {
|
|
122
122
|
class: "tr-anchor__list",
|
|
123
123
|
role: "list"
|
|
124
124
|
}, De = {
|
|
@@ -173,7 +173,7 @@ const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"],
|
|
|
173
173
|
]), 1032, ["entry", "active-id", "expanded", "highlighted", "placement", "tooltip-delay"]))), 128))
|
|
174
174
|
]));
|
|
175
175
|
}
|
|
176
|
-
}), Qe = /* @__PURE__ */ Y(Fe, [["__scopeId", "data-v-
|
|
176
|
+
}), Qe = /* @__PURE__ */ Y(Fe, [["__scopeId", "data-v-ff2e0912"]]), Pe = {
|
|
177
177
|
key: 0,
|
|
178
178
|
class: "tr-anchor__search-cap"
|
|
179
179
|
}, Ue = { class: "tr-anchor__surface" }, Ke = /* @__PURE__ */ G({
|
|
@@ -203,7 +203,7 @@ const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"],
|
|
|
203
203
|
ref_key: "hostEl",
|
|
204
204
|
ref: i,
|
|
205
205
|
class: pe(c.value),
|
|
206
|
-
style:
|
|
206
|
+
style: be(s.value)
|
|
207
207
|
}, [
|
|
208
208
|
D("div", {
|
|
209
209
|
ref_key: "overlayEl",
|
|
@@ -227,7 +227,7 @@ const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"],
|
|
|
227
227
|
], 512)
|
|
228
228
|
], 6));
|
|
229
229
|
}
|
|
230
|
-
}), qe = /* @__PURE__ */ Y(Ke, [["__scopeId", "data-v-
|
|
230
|
+
}), qe = /* @__PURE__ */ Y(Ke, [["__scopeId", "data-v-276fbba1"]]), ze = ["value", "placeholder", "aria-label"], Ve = /* @__PURE__ */ G({
|
|
231
231
|
name: "AnchorSearch",
|
|
232
232
|
__name: "AnchorSearch",
|
|
233
233
|
props: {
|
|
@@ -307,16 +307,16 @@ function Ze(e) {
|
|
|
307
307
|
var t;
|
|
308
308
|
return (t = f.value.find((u) => u.item.id === e.activeId.value)) == null ? void 0 : t.item.id;
|
|
309
309
|
}
|
|
310
|
-
),
|
|
310
|
+
), b = g(() => {
|
|
311
311
|
var t;
|
|
312
312
|
return h.value && i.value && f.value.some((u) => u.item.id === i.value) ? i.value : y.value ?? ((t = f.value[0]) == null ? void 0 : t.item.id);
|
|
313
313
|
}), S = g(() => {
|
|
314
314
|
if (!f.value.length)
|
|
315
315
|
return 0;
|
|
316
|
-
const t = f.value.findIndex((u) => u.item.id ===
|
|
316
|
+
const t = f.value.findIndex((u) => u.item.id === b.value);
|
|
317
317
|
return t === -1 ? 0 : t;
|
|
318
|
-
}), I = g(() =>
|
|
319
|
-
function
|
|
318
|
+
}), I = g(() => b.value);
|
|
319
|
+
function k() {
|
|
320
320
|
h.value = !1, i.value = void 0;
|
|
321
321
|
}
|
|
322
322
|
function $(t) {
|
|
@@ -330,7 +330,7 @@ function Ze(e) {
|
|
|
330
330
|
function A(t) {
|
|
331
331
|
var v;
|
|
332
332
|
if (!f.value.length) {
|
|
333
|
-
|
|
333
|
+
k();
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
336
336
|
const u = Math.max(0, Math.min(t, f.value.length - 1));
|
|
@@ -347,20 +347,20 @@ function Ze(e) {
|
|
|
347
347
|
f,
|
|
348
348
|
(t) => {
|
|
349
349
|
if (!t.length) {
|
|
350
|
-
|
|
350
|
+
k();
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
353
|
if (y.value) {
|
|
354
|
-
|
|
354
|
+
k();
|
|
355
355
|
return;
|
|
356
356
|
}
|
|
357
|
-
h.value && i.value && t.some((u) => u.item.id === i.value) ||
|
|
357
|
+
h.value && i.value && t.some((u) => u.item.id === i.value) || k();
|
|
358
358
|
},
|
|
359
359
|
{ immediate: !0, flush: "sync" }
|
|
360
360
|
), F(
|
|
361
361
|
() => e.activeId.value,
|
|
362
362
|
(t) => {
|
|
363
|
-
t &&
|
|
363
|
+
t && k();
|
|
364
364
|
},
|
|
365
365
|
{ immediate: !0, flush: "sync" }
|
|
366
366
|
), {
|
|
@@ -433,7 +433,7 @@ function Xe(e) {
|
|
|
433
433
|
function y() {
|
|
434
434
|
d(), f();
|
|
435
435
|
}
|
|
436
|
-
function
|
|
436
|
+
function b(o) {
|
|
437
437
|
return o instanceof HTMLElement ? o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement || o.isContentEditable : !1;
|
|
438
438
|
}
|
|
439
439
|
function S(o) {
|
|
@@ -448,7 +448,7 @@ function Xe(e) {
|
|
|
448
448
|
const t = Number.parseFloat(window.getComputedStyle(o).scrollMarginTop || "0");
|
|
449
449
|
return Number.isFinite(t) ? t : 0;
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function k() {
|
|
452
452
|
var Q, K;
|
|
453
453
|
const o = le(e.container.value);
|
|
454
454
|
if (!o)
|
|
@@ -506,7 +506,7 @@ function Xe(e) {
|
|
|
506
506
|
if (o.defaultPrevented || o.altKey || o.ctrlKey || o.metaKey)
|
|
507
507
|
return;
|
|
508
508
|
const t = (u = e.host) == null ? void 0 : u.value;
|
|
509
|
-
t && o.target instanceof Node && t.contains(o.target) ||
|
|
509
|
+
t && o.target instanceof Node && t.contains(o.target) || b(o.target) || ["ArrowDown", "ArrowUp", "PageDown", "PageUp", "Home", "End", " "].includes(o.key) && y();
|
|
510
510
|
}
|
|
511
511
|
return F(
|
|
512
512
|
() => {
|
|
@@ -521,7 +521,7 @@ function Xe(e) {
|
|
|
521
521
|
}), {
|
|
522
522
|
activeId: n,
|
|
523
523
|
scrollTo: $,
|
|
524
|
-
sync:
|
|
524
|
+
sync: k,
|
|
525
525
|
clearPendingScroll: d,
|
|
526
526
|
releaseSelectionLock: y,
|
|
527
527
|
handleUserScrollIntent: H,
|
|
@@ -555,12 +555,12 @@ function et(e) {
|
|
|
555
555
|
a.value = 0;
|
|
556
556
|
return;
|
|
557
557
|
}
|
|
558
|
-
const f = d.getBoundingClientRect(), y = s.getBoundingClientRect(),
|
|
559
|
-
if (!y.height || !
|
|
558
|
+
const f = d.getBoundingClientRect(), y = s.getBoundingClientRect(), b = c.getBoundingClientRect().height || 0;
|
|
559
|
+
if (!y.height || !b) {
|
|
560
560
|
a.value = 0;
|
|
561
561
|
return;
|
|
562
562
|
}
|
|
563
|
-
const S = y.top - f.top, I = y.bottom - f.top, $ = S + y.height / 2 -
|
|
563
|
+
const S = y.top - f.top, I = y.bottom - f.top, $ = S + y.height / 2 - b / 2, H = S + 24, A = Math.max(H, I - b - 24);
|
|
564
564
|
a.value = Math.max(H, Math.min($, A));
|
|
565
565
|
}
|
|
566
566
|
return {
|
|
@@ -584,7 +584,7 @@ function ot(e) {
|
|
|
584
584
|
return n instanceof HTMLElement ? n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement || n.isContentEditable : !1;
|
|
585
585
|
}
|
|
586
586
|
function l() {
|
|
587
|
-
|
|
587
|
+
ke(() => {
|
|
588
588
|
var s, d;
|
|
589
589
|
const n = e.highlightedId.value, c = (s = e.overlay.value) == null ? void 0 : s.navEl;
|
|
590
590
|
!n || !c || (d = rt(c, n)) == null || d.focus();
|
|
@@ -689,16 +689,16 @@ const j = /* @__PURE__ */ G({
|
|
|
689
689
|
expanded: d,
|
|
690
690
|
items: f,
|
|
691
691
|
placement: y,
|
|
692
|
-
searchOptions:
|
|
692
|
+
searchOptions: b,
|
|
693
693
|
searchQuery: S,
|
|
694
694
|
scrollContainer: I,
|
|
695
|
-
targetFeedbackClass:
|
|
695
|
+
targetFeedbackClass: k,
|
|
696
696
|
targetFeedbackDuration: $,
|
|
697
697
|
tooltipDelay: H
|
|
698
698
|
} = Me(l), A = _(null), p = g(() => {
|
|
699
699
|
var m;
|
|
700
700
|
return ((m = A.value) == null ? void 0 : m.hostEl) ?? null;
|
|
701
|
-
}), o = g(() =>
|
|
701
|
+
}), o = g(() => b.value), t = g(() => o.value ?? {});
|
|
702
702
|
function u(m) {
|
|
703
703
|
const O = I.value;
|
|
704
704
|
return O ? ge(O, m) ?? null : ge(document, m) ?? null;
|
|
@@ -717,7 +717,7 @@ const j = /* @__PURE__ */ G({
|
|
|
717
717
|
expanded: d,
|
|
718
718
|
expandTrigger: s,
|
|
719
719
|
searchQuery: S,
|
|
720
|
-
searchOptions:
|
|
720
|
+
searchOptions: b,
|
|
721
721
|
onUpdateExpanded: (m) => i("update:expanded", m),
|
|
722
722
|
onUpdateSearchQuery: (m) => i("update:searchQuery", m)
|
|
723
723
|
}), U = g(() => v.value.length > 0), Q = g(() => !!o.value && x.expanded.value), K = g(() => s.value === "hover"), C = g(() => le(I.value)), w = et({
|
|
@@ -725,7 +725,7 @@ const j = /* @__PURE__ */ G({
|
|
|
725
725
|
host: p
|
|
726
726
|
}), J = ct({
|
|
727
727
|
resolveTarget: u,
|
|
728
|
-
feedbackClass:
|
|
728
|
+
feedbackClass: k,
|
|
729
729
|
feedbackDuration: $
|
|
730
730
|
});
|
|
731
731
|
function z(m) {
|
package/dist/container/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as g, useModel as c, computed as
|
|
1
|
+
import { defineComponent as g, useModel as c, computed as w, withDirectives as C, openBlock as B, createElementBlock as y, normalizeClass as I, createElementVNode as e, renderSlot as l, toDisplayString as z, createVNode as u, unref as i, vShow as E, mergeModels as d } from "vue";
|
|
2
2
|
import { IconExitFullScreen as S, IconEnterFullScreen as $, IconClose as k } from "@opentiny/tiny-robot-svgs";
|
|
3
3
|
import f from "../icon-button/index.js";
|
|
4
4
|
import { _ as M } from "../_plugin-vue_export-helper.js";
|
|
@@ -16,26 +16,26 @@ const T = { class: "tr-container__header" }, b = { class: "tr-container__title"
|
|
|
16
16
|
}),
|
|
17
17
|
emits: /* @__PURE__ */ d(["close"], ["update:show", "update:fullscreen"]),
|
|
18
18
|
setup(o, { emit: p }) {
|
|
19
|
-
const m = o, a = c(o, "show"),
|
|
19
|
+
const m = o, a = c(o, "show"), t = c(o, "fullscreen"), v = w(() => t.value ? S : $), _ = p, h = () => {
|
|
20
20
|
a.value = !1, _("close");
|
|
21
21
|
};
|
|
22
|
-
return (
|
|
23
|
-
class: I(["tr-container", { fullscreen:
|
|
22
|
+
return (n, s) => C((B(), y("div", {
|
|
23
|
+
class: I(["tr-container", { fullscreen: t.value }])
|
|
24
24
|
}, [
|
|
25
|
-
|
|
25
|
+
s[1] || (s[1] = e("div", { class: "tr-container__dragging-bar-wrapper" }, [
|
|
26
26
|
e("div", { class: "tr-container__dragging-bar" })
|
|
27
27
|
], -1)),
|
|
28
28
|
e("div", T, [
|
|
29
|
-
|
|
29
|
+
l(n.$slots, "title", {}, () => [
|
|
30
30
|
e("h3", b, z(m.title), 1)
|
|
31
31
|
], !0),
|
|
32
32
|
e("div", N, [
|
|
33
|
-
|
|
33
|
+
l(n.$slots, "operations", {}, void 0, !0),
|
|
34
34
|
u(i(f), {
|
|
35
35
|
size: "28",
|
|
36
36
|
"svg-size": "20",
|
|
37
37
|
icon: v.value,
|
|
38
|
-
onClick:
|
|
38
|
+
onClick: s[0] || (s[0] = (q) => t.value = !t.value)
|
|
39
39
|
}, null, 8, ["icon"]),
|
|
40
40
|
u(i(f), {
|
|
41
41
|
size: "28",
|
|
@@ -45,21 +45,20 @@ const T = { class: "tr-container__header" }, b = { class: "tr-container__title"
|
|
|
45
45
|
}, null, 8, ["icon"])
|
|
46
46
|
])
|
|
47
47
|
]),
|
|
48
|
-
|
|
48
|
+
l(n.$slots, "default", {}, void 0, !0),
|
|
49
49
|
e("div", D, [
|
|
50
|
-
|
|
50
|
+
l(n.$slots, "footer", {}, void 0, !0)
|
|
51
51
|
])
|
|
52
52
|
], 2)), [
|
|
53
53
|
[E, a.value]
|
|
54
54
|
]);
|
|
55
55
|
}
|
|
56
|
-
}),
|
|
57
|
-
|
|
56
|
+
}), r = /* @__PURE__ */ M(F, [["__scopeId", "data-v-8bd84c90"]]);
|
|
57
|
+
r.name = "TrContainer";
|
|
58
58
|
const V = function(o) {
|
|
59
|
-
o.component(
|
|
59
|
+
o.component(r.name, r);
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
const A = t;
|
|
61
|
+
r.install = V;
|
|
63
62
|
export {
|
|
64
|
-
|
|
63
|
+
r as default
|
|
65
64
|
};
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { w as
|
|
3
|
-
import { B as
|
|
4
|
-
import { u as
|
|
5
|
-
import { _ as
|
|
6
|
-
const
|
|
1
|
+
import { ref as k, onUnmounted as T, watch as C, defineComponent as E, useModel as H, computed as p, openBlock as w, createBlock as I, unref as X, withCtx as y, createElementVNode as j, createElementBlock as _, Fragment as D, renderList as L, toDisplayString as Y, renderSlot as O, mergeModels as M } from "vue";
|
|
2
|
+
import { w as S, a as b, o as $ } from "../index4.js";
|
|
3
|
+
import { B as A } from "../index8.js";
|
|
4
|
+
import { u as F } from "../utils.js";
|
|
5
|
+
import { _ as G } from "../_plugin-vue_export-helper.js";
|
|
6
|
+
const P = (o, t) => o.x >= t.left && o.x <= t.right && o.y >= t.top && o.y <= t.bottom, N = (o, t, g = !1) => {
|
|
7
7
|
if (t.length < 3) return !1;
|
|
8
|
-
const
|
|
9
|
-
let
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
if (Math.abs(
|
|
13
|
-
const
|
|
14
|
-
return
|
|
8
|
+
const l = o.x, f = o.y;
|
|
9
|
+
let d = !1;
|
|
10
|
+
const r = (s, c, a, n, i, e) => {
|
|
11
|
+
const m = (i - a) * (c - n) - (e - n) * (s - a);
|
|
12
|
+
if (Math.abs(m) > 1e-10) return !1;
|
|
13
|
+
const u = Math.min(a, i), h = Math.max(a, i), x = Math.min(n, e), B = Math.max(n, e);
|
|
14
|
+
return s >= u && s <= h && c >= x && c <= B;
|
|
15
15
|
};
|
|
16
|
-
for (let
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
16
|
+
for (let s = 0, c = t.length - 1; s < t.length; c = s++) {
|
|
17
|
+
const a = t[s].x, n = t[s].y, i = t[c].x, e = t[c].y;
|
|
18
|
+
if (g && r(l, f, a, n, i, e))
|
|
19
19
|
return !0;
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
|
|
20
|
+
if (n > f && e <= f || e > f && n <= f) {
|
|
21
|
+
const u = (i - a) * (f - n) / (e - n) + a;
|
|
22
|
+
l < u && (d = !d);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
return
|
|
26
|
-
},
|
|
27
|
-
{ x:
|
|
28
|
-
{ x:
|
|
25
|
+
return d;
|
|
26
|
+
}, U = (o, t) => t.bottom < o.top ? [
|
|
27
|
+
{ x: o.left, y: o.top },
|
|
28
|
+
{ x: o.right, y: o.top },
|
|
29
29
|
{ x: t.right, y: t.bottom },
|
|
30
30
|
{ x: t.left, y: t.bottom }
|
|
31
|
-
] : t.top >
|
|
32
|
-
{ x:
|
|
33
|
-
{ x:
|
|
31
|
+
] : t.top > o.bottom ? [
|
|
32
|
+
{ x: o.left, y: o.bottom },
|
|
33
|
+
{ x: o.right, y: o.bottom },
|
|
34
34
|
{ x: t.right, y: t.top },
|
|
35
35
|
{ x: t.left, y: t.top }
|
|
36
|
-
] : [], { x:
|
|
37
|
-
const { delayEnter:
|
|
38
|
-
let
|
|
39
|
-
const
|
|
40
|
-
|
|
36
|
+
] : [], { x: V, y: q } = F(), z = (o, t, g) => {
|
|
37
|
+
const { delayEnter: l = 0, delayLeave: f = 0 } = g || {}, d = k(!1), r = k("outside");
|
|
38
|
+
let s = null;
|
|
39
|
+
const c = () => {
|
|
40
|
+
s && (clearTimeout(s), s = null);
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
T(() => {
|
|
43
|
+
c();
|
|
44
44
|
});
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
45
|
+
const a = (n) => {
|
|
46
|
+
const i = n ? l : f;
|
|
47
|
+
c(), i ? s = setTimeout(() => d.value = n, i) : d.value = n;
|
|
48
48
|
};
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
(
|
|
52
|
-
["trigger", "popper", "polygon"].includes(
|
|
49
|
+
return C(
|
|
50
|
+
r,
|
|
51
|
+
(n) => {
|
|
52
|
+
["trigger", "popper", "polygon"].includes(n) ? a(!0) : a(!1);
|
|
53
53
|
},
|
|
54
54
|
{ immediate: !0 }
|
|
55
|
-
),
|
|
56
|
-
[
|
|
57
|
-
([
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
|
|
55
|
+
), S(
|
|
56
|
+
[V, q],
|
|
57
|
+
([n, i]) => {
|
|
58
|
+
const e = b(o), m = b(t), u = e == null ? void 0 : e.getBoundingClientRect(), h = m == null ? void 0 : m.getBoundingClientRect();
|
|
59
|
+
if (u && P({ x: n, y: i }, u)) {
|
|
60
|
+
r.value = "trigger";
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
|
-
if (
|
|
64
|
-
|
|
63
|
+
if (h && P({ x: n, y: i }, h)) {
|
|
64
|
+
r.value = "popper";
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
if (!
|
|
68
|
-
|
|
67
|
+
if (!u || !h || u.width === 0 || u.height === 0 || h.width === 0 || h.height === 0) {
|
|
68
|
+
r.value = "outside";
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
N({ x: n, y: i }, U(u, h), !0) ? r.value = "polygon" : r.value = "outside";
|
|
72
72
|
},
|
|
73
73
|
{ throttle: 10 }
|
|
74
|
-
),
|
|
75
|
-
},
|
|
74
|
+
), d;
|
|
75
|
+
}, J = { class: "tr-dropdown-menu__list" }, K = ["onClick"], Q = /* @__PURE__ */ E({
|
|
76
76
|
__name: "index",
|
|
77
|
-
props: /* @__PURE__ */
|
|
77
|
+
props: /* @__PURE__ */ M({
|
|
78
78
|
appendTo: {},
|
|
79
79
|
items: {},
|
|
80
80
|
show: { type: Boolean },
|
|
@@ -83,121 +83,77 @@ const I = (n, t) => n.x >= t.left && n.x <= t.right && n.y >= t.top && n.y <= t.
|
|
|
83
83
|
show: { type: Boolean, default: !1 },
|
|
84
84
|
showModifiers: {}
|
|
85
85
|
}),
|
|
86
|
-
emits: /* @__PURE__ */
|
|
87
|
-
setup(
|
|
88
|
-
const
|
|
89
|
-
get: () =>
|
|
86
|
+
emits: /* @__PURE__ */ M(["item-click", "click-outside"], ["update:show"]),
|
|
87
|
+
setup(o, { expose: t, emit: g }) {
|
|
88
|
+
const l = o, f = g, d = H(o, "show"), r = p({
|
|
89
|
+
get: () => l.trigger === "manual" ? l.show : d.value,
|
|
90
90
|
set: (e) => {
|
|
91
|
-
|
|
91
|
+
l.trigger !== "manual" && (d.value = e);
|
|
92
92
|
}
|
|
93
|
-
}),
|
|
93
|
+
}), s = k(null), c = p(() => {
|
|
94
94
|
var e;
|
|
95
|
-
return (e =
|
|
96
|
-
}),
|
|
95
|
+
return (e = s.value) == null ? void 0 : e.triggerRef;
|
|
96
|
+
}), a = p(() => {
|
|
97
97
|
var e;
|
|
98
|
-
return (e =
|
|
98
|
+
return (e = s.value) == null ? void 0 : e.popperRef;
|
|
99
99
|
});
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}), s.trigger === "click" || s.trigger === "manual")
|
|
104
|
-
N(
|
|
105
|
-
u,
|
|
100
|
+
if (l.trigger === "click" || l.trigger === "manual")
|
|
101
|
+
$(
|
|
102
|
+
a,
|
|
106
103
|
(e) => {
|
|
107
|
-
|
|
104
|
+
f("click-outside", e), r.value = !1;
|
|
108
105
|
},
|
|
109
|
-
{ ignore: [
|
|
106
|
+
{ ignore: [c] }
|
|
110
107
|
);
|
|
111
|
-
else if (
|
|
112
|
-
const e =
|
|
113
|
-
|
|
114
|
-
|
|
108
|
+
else if (l.trigger === "hover") {
|
|
109
|
+
const e = z(c, a, { delayEnter: 100, delayLeave: 100 });
|
|
110
|
+
C(e, (m) => {
|
|
111
|
+
r.value = m;
|
|
115
112
|
});
|
|
116
113
|
}
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
await B(), o.value || (e = a.value) == null || e.focus();
|
|
122
|
-
}, c = () => {
|
|
123
|
-
var e;
|
|
124
|
-
return Array.from(((e = u.value) == null ? void 0 : e.querySelectorAll('[role="menuitem"]')) || []);
|
|
125
|
-
}, w = async (e) => {
|
|
126
|
-
var m;
|
|
127
|
-
await B();
|
|
128
|
-
const f = c();
|
|
129
|
-
(m = f[e === "first" ? 0 : f.length - 1]) == null || m.focus();
|
|
130
|
-
}, d = (e) => {
|
|
131
|
-
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
132
|
-
if (s.trigger === "manual" && !o.value) return;
|
|
133
|
-
e.preventDefault(), s.trigger !== "manual" && (o.value = !0), w(e.key === "ArrowDown" ? "first" : "last");
|
|
134
|
-
} else (e.key === "Enter" || e.key === " ") && s.trigger !== "manual" ? (e.preventDefault(), o.value = !0, w("first")) : e.key === "Escape" && o.value && (e.preventDefault(), o.value = !1);
|
|
135
|
-
}, p = (e) => {
|
|
136
|
-
var E, D;
|
|
137
|
-
const f = c(), m = f.indexOf(document.activeElement);
|
|
138
|
-
if (e.key === "Tab") {
|
|
139
|
-
s.trigger !== "manual" && (o.value = !1);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
if (e.key === "Escape") {
|
|
143
|
-
e.preventDefault(), o.value = !1, l();
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
147
|
-
e.preventDefault(), (E = f[m]) == null || E.click();
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key) || f.length === 0) return;
|
|
151
|
-
e.preventDefault();
|
|
152
|
-
let y = m;
|
|
153
|
-
e.key === "Home" && (y = 0), e.key === "End" && (y = f.length - 1), e.key === "ArrowDown" && (y = m < f.length - 1 ? m + 1 : 0), e.key === "ArrowUp" && (y = m > 0 ? m - 1 : f.length - 1), (D = f[y]) == null || D.focus();
|
|
154
|
-
}, v = (e) => {
|
|
155
|
-
o.value = !1, g("item-click", e), l();
|
|
114
|
+
const n = () => {
|
|
115
|
+
l.trigger === "click" && (r.value = !r.value);
|
|
116
|
+
}, i = (e) => {
|
|
117
|
+
r.value = !1, f("item-click", e);
|
|
156
118
|
};
|
|
157
119
|
return t({
|
|
158
120
|
update: () => {
|
|
159
121
|
var e;
|
|
160
|
-
(e =
|
|
122
|
+
(e = s.value) == null || e.update();
|
|
161
123
|
}
|
|
162
|
-
}), (e,
|
|
163
|
-
show:
|
|
124
|
+
}), (e, m) => (w(), I(X(A), {
|
|
125
|
+
show: r.value,
|
|
164
126
|
class: "tr-dropdown-menu",
|
|
165
127
|
ref_key: "basePopperRef",
|
|
166
|
-
ref:
|
|
128
|
+
ref: s,
|
|
167
129
|
placement: "top-left",
|
|
168
|
-
"append-to":
|
|
130
|
+
"append-to": l.appendTo,
|
|
169
131
|
offset: 8,
|
|
170
132
|
"transition-props": { name: "tr-dropdown-menu" },
|
|
171
133
|
"prevent-overflow": !0,
|
|
172
|
-
"trigger-events": { onClick:
|
|
134
|
+
"trigger-events": { onClick: n }
|
|
173
135
|
}, {
|
|
174
|
-
trigger:
|
|
175
|
-
|
|
136
|
+
trigger: y(() => [
|
|
137
|
+
O(e.$slots, "trigger", {}, void 0, !0)
|
|
176
138
|
]),
|
|
177
|
-
content:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
role: "menu",
|
|
181
|
-
onKeydown: p
|
|
182
|
-
}, [
|
|
183
|
-
(b(!0), T(Y, null, $(s.items, (m) => (b(), T("li", {
|
|
139
|
+
content: y(() => [
|
|
140
|
+
j("ul", J, [
|
|
141
|
+
(w(!0), _(D, null, L(l.items, (u) => (w(), _("li", {
|
|
184
142
|
class: "tr-dropdown-menu__list-item",
|
|
185
|
-
key:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}, q(m.text), 9, te))), 128))
|
|
190
|
-
], 32)
|
|
143
|
+
key: u.id,
|
|
144
|
+
onClick: (h) => i(u)
|
|
145
|
+
}, Y(u.text), 9, K))), 128))
|
|
146
|
+
])
|
|
191
147
|
]),
|
|
192
148
|
_: 3
|
|
193
149
|
}, 8, ["show", "append-to", "trigger-events"]));
|
|
194
150
|
}
|
|
195
|
-
}),
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
|
|
151
|
+
}), v = /* @__PURE__ */ G(Q, [["__scopeId", "data-v-6fc07009"]]);
|
|
152
|
+
v.name = "TrDropdownMenu";
|
|
153
|
+
const W = function(o) {
|
|
154
|
+
o.component(v.name, v);
|
|
199
155
|
};
|
|
200
|
-
|
|
156
|
+
v.install = W;
|
|
201
157
|
export {
|
|
202
|
-
|
|
158
|
+
v as default
|
|
203
159
|
};
|