@opentiny/tiny-robot 0.2.10 → 0.2.11
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/action-group/index.js +38 -35
- package/dist/base-popper/index.js +107 -0
- package/dist/dropdown-menu/index.js +71 -65
- package/dist/flow-layout-buttons/index.js +24 -21
- package/dist/index.d.ts +270 -23
- package/dist/index2.js +386 -319
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +181 -131
- package/dist/suggestion-popover/index.js +117 -112
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as $, useSlots as H, computed as i, ref as f, watch as N, nextTick as W, createElementBlock as _, openBlock as
|
|
1
|
+
import { defineComponent as $, useSlots as H, computed as i, ref as f, watch as N, nextTick as W, createElementBlock as _, openBlock as o, createBlock as v, createCommentVNode as R, Fragment as G, renderList as I, unref as h, withCtx as S, createElementVNode as w, resolveDynamicComponent as x, renderSlot as L, createVNode as E, Transition as j, withDirectives as q, normalizeClass as J, withModifiers as K, toDisplayString as Q, vShow as U } from "vue";
|
|
2
2
|
import { c as Y } from "../tiny-robot-svgs.js";
|
|
3
3
|
import { T as M } from "../index4.js";
|
|
4
4
|
import { o as Z, a as ee } from "../index2.js";
|
|
@@ -12,45 +12,48 @@ const ne = { class: "tr-action-group" }, re = ["onClick"], le = ["onClick"], ae
|
|
|
12
12
|
dropDownShowLabelOnly: { type: Boolean }
|
|
13
13
|
},
|
|
14
14
|
emits: ["item-click"],
|
|
15
|
-
setup(
|
|
16
|
-
const
|
|
17
|
-
var
|
|
15
|
+
setup(r, { emit: k }) {
|
|
16
|
+
const l = r, F = H(), O = k, p = i(() => {
|
|
17
|
+
var a, t;
|
|
18
18
|
const e = F.default();
|
|
19
|
-
return Array.isArray(e) ? e.length === 1 && ((
|
|
19
|
+
return Array.isArray(e) ? e.length === 1 && ((a = e[0].type) == null ? void 0 : a.toString()) === "Symbol(v-fgt)" ? e[0].children : e : ((t = e.type) == null ? void 0 : t.toString()) === "Symbol(v-fgt)" ? e.children : [e];
|
|
20
20
|
}), y = i(() => {
|
|
21
|
-
const e =
|
|
21
|
+
const e = l.maxNum ?? Number.MAX_SAFE_INTEGER;
|
|
22
22
|
return e > 0 ? e : Number.MAX_SAFE_INTEGER;
|
|
23
|
-
}), b = i(() => p.value.length > y.value), V = i(() => b.value ? p.value.slice(0, y.value) : p.value), z = i(() => b.value ? p.value.slice(y.value) : []), m = f(null), d = f(null),
|
|
24
|
-
|
|
23
|
+
}), b = i(() => p.value.length > y.value), V = i(() => b.value ? p.value.slice(0, y.value) : p.value), z = i(() => b.value ? p.value.slice(y.value) : []), m = f(null), d = f(null), n = f(!1), P = () => {
|
|
24
|
+
n.value = !n.value;
|
|
25
25
|
};
|
|
26
|
-
Z(
|
|
27
|
-
|
|
28
|
-
(
|
|
29
|
-
|
|
26
|
+
Z(
|
|
27
|
+
d,
|
|
28
|
+
() => {
|
|
29
|
+
n.value = !1;
|
|
30
|
+
},
|
|
31
|
+
{ ignore: [m] }
|
|
32
|
+
);
|
|
30
33
|
const A = (e) => {
|
|
31
|
-
O("item-click", e),
|
|
34
|
+
O("item-click", e), n.value = !1;
|
|
32
35
|
}, B = f("placement-bottom"), { height: D } = ee(), T = () => {
|
|
33
36
|
if (!d.value || !m.value)
|
|
34
37
|
return "placement-bottom";
|
|
35
|
-
const e = d.value.getBoundingClientRect(),
|
|
36
|
-
B.value =
|
|
38
|
+
const e = d.value.getBoundingClientRect(), a = m.value.getBoundingClientRect();
|
|
39
|
+
B.value = a.bottom + e.height + 16 > D.value ? "placement-top" : "placement-bottom";
|
|
37
40
|
};
|
|
38
|
-
return N(
|
|
41
|
+
return N(n, (e) => {
|
|
39
42
|
e && W(() => {
|
|
40
43
|
T();
|
|
41
44
|
});
|
|
42
45
|
}), N(D, () => {
|
|
43
|
-
|
|
44
|
-
}), (e,
|
|
45
|
-
(
|
|
46
|
+
n.value && T();
|
|
47
|
+
}), (e, a) => (o(), _("div", ne, [
|
|
48
|
+
(o(!0), _(G, null, I(V.value, (t, C) => {
|
|
46
49
|
var c;
|
|
47
|
-
return
|
|
50
|
+
return o(), v(h(M), {
|
|
48
51
|
key: C,
|
|
49
52
|
content: (c = t.props) == null ? void 0 : c.label,
|
|
50
53
|
effect: "dark",
|
|
51
54
|
placement: "top",
|
|
52
55
|
"open-delay": 500,
|
|
53
|
-
disabled: !
|
|
56
|
+
disabled: !l.showTooltip
|
|
54
57
|
}, {
|
|
55
58
|
default: S(() => [
|
|
56
59
|
w("span", {
|
|
@@ -60,19 +63,19 @@ const ne = { class: "tr-action-group" }, re = ["onClick"], le = ["onClick"], ae
|
|
|
60
63
|
return A((s = t.props) == null ? void 0 : s.name);
|
|
61
64
|
}
|
|
62
65
|
}, [
|
|
63
|
-
(
|
|
66
|
+
(o(), v(x(t)))
|
|
64
67
|
], 8, re)
|
|
65
68
|
]),
|
|
66
69
|
_: 2
|
|
67
70
|
}, 1032, ["content", "disabled"]);
|
|
68
71
|
}), 128)),
|
|
69
|
-
b.value ? (
|
|
72
|
+
b.value ? (o(), v(h(M), {
|
|
70
73
|
key: 0,
|
|
71
74
|
content: "更多",
|
|
72
75
|
effect: "dark",
|
|
73
76
|
placement: "top",
|
|
74
77
|
"open-delay": 500,
|
|
75
|
-
disabled: !
|
|
78
|
+
disabled: !l.showTooltip
|
|
76
79
|
}, {
|
|
77
80
|
default: S(() => [
|
|
78
81
|
w("span", {
|
|
@@ -91,9 +94,9 @@ const ne = { class: "tr-action-group" }, re = ["onClick"], le = ["onClick"], ae
|
|
|
91
94
|
ref: d,
|
|
92
95
|
class: J(["tr-action-group__dropdown", B.value])
|
|
93
96
|
}, [
|
|
94
|
-
(
|
|
97
|
+
(o(!0), _(G, null, I(z.value, (t, C) => {
|
|
95
98
|
var c;
|
|
96
|
-
return
|
|
99
|
+
return o(), _("li", {
|
|
97
100
|
class: "tr-action-group__dropdown-item",
|
|
98
101
|
key: C,
|
|
99
102
|
onClick: K((X) => {
|
|
@@ -101,12 +104,12 @@ const ne = { class: "tr-action-group" }, re = ["onClick"], le = ["onClick"], ae
|
|
|
101
104
|
return A((s = t.props) == null ? void 0 : s.name);
|
|
102
105
|
}, ["stop"])
|
|
103
106
|
}, [
|
|
104
|
-
|
|
107
|
+
l.dropDownShowLabelOnly ? R("", !0) : (o(), v(x(t), { key: 0 })),
|
|
105
108
|
w("span", ae, Q((c = t.props) == null ? void 0 : c.label), 1)
|
|
106
109
|
], 8, le);
|
|
107
110
|
}), 128))
|
|
108
111
|
], 2), [
|
|
109
|
-
[U,
|
|
112
|
+
[U, n.value]
|
|
110
113
|
])
|
|
111
114
|
]),
|
|
112
115
|
_: 1
|
|
@@ -117,24 +120,24 @@ const ne = { class: "tr-action-group" }, re = ["onClick"], le = ["onClick"], ae
|
|
|
117
120
|
}, 8, ["disabled"])) : R("", !0)
|
|
118
121
|
]));
|
|
119
122
|
}
|
|
120
|
-
}), g = /* @__PURE__ */ oe(ce, [["__scopeId", "data-v-
|
|
123
|
+
}), g = /* @__PURE__ */ oe(ce, [["__scopeId", "data-v-f8531261"]]), u = /* @__PURE__ */ $({
|
|
121
124
|
__name: "ActionGroupItem",
|
|
122
125
|
props: {
|
|
123
126
|
name: {},
|
|
124
127
|
label: {}
|
|
125
128
|
},
|
|
126
|
-
setup(
|
|
127
|
-
return (k,
|
|
129
|
+
setup(r) {
|
|
130
|
+
return (k, l) => L(k.$slots, "default");
|
|
128
131
|
}
|
|
129
132
|
});
|
|
130
133
|
g.name = "TrActionGroup";
|
|
131
|
-
const se = function(
|
|
132
|
-
|
|
134
|
+
const se = function(r) {
|
|
135
|
+
r.component(g.name, g);
|
|
133
136
|
};
|
|
134
137
|
g.install = se;
|
|
135
138
|
u.name = "TrActionGroupItem";
|
|
136
|
-
const ie = function(
|
|
137
|
-
|
|
139
|
+
const ie = function(r) {
|
|
140
|
+
r.component(u.name, u);
|
|
138
141
|
};
|
|
139
142
|
u.install = ie;
|
|
140
143
|
const ve = u;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { computed as a, defineComponent as j, useSlots as F, Fragment as x, ref as R, watch as E, nextTick as U, createElementBlock as S, openBlock as d, createVNode as W, renderList as Z, createBlock as V, resolveDynamicComponent as q, mergeProps as k, Transition as J, normalizeProps as K, guardReactiveProps as Q, withCtx as X, createCommentVNode as Y, Teleport as ee, unref as te, createElementVNode as oe, renderSlot as re } from "vue";
|
|
2
|
+
import { d as ne, e as se, b as ae } from "../index2.js";
|
|
3
|
+
import { t as l } from "../utils.js";
|
|
4
|
+
import { _ as ie } from "../_plugin-vue_export-helper.js";
|
|
5
|
+
function le(m, w) {
|
|
6
|
+
return a(() => {
|
|
7
|
+
var c;
|
|
8
|
+
const o = ne(m), i = (c = o == null ? void 0 : o.getRootNode) == null ? void 0 : c.call(o);
|
|
9
|
+
return i instanceof ShadowRoot ? i : document.body;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
const ce = /* @__PURE__ */ j({
|
|
13
|
+
inheritAttrs: !1,
|
|
14
|
+
__name: "index",
|
|
15
|
+
props: {
|
|
16
|
+
offset: {},
|
|
17
|
+
placement: { default: "top-center" },
|
|
18
|
+
preventOverflow: { type: Boolean },
|
|
19
|
+
renderAllTriggers: { type: Boolean },
|
|
20
|
+
show: { type: Boolean },
|
|
21
|
+
transitionProps: {},
|
|
22
|
+
triggerEvents: {}
|
|
23
|
+
},
|
|
24
|
+
setup(m, { expose: w }) {
|
|
25
|
+
const o = m, i = F(), v = a(() => {
|
|
26
|
+
var r;
|
|
27
|
+
const e = (r = i.trigger) == null ? void 0 : r.call(i), t = e ? Array.isArray(e) ? e : [e] : [];
|
|
28
|
+
return t[0].type === x && Array.isArray(t[0].children) ? t[0].children : t;
|
|
29
|
+
}), g = a(() => o.renderAllTriggers ? v.value.length : 1), c = a(() => v.value.slice(0, g.value)), p = R([]), h = a(() => p.value.at(0)), B = (e) => e != null && e.$el || e instanceof HTMLElement || e instanceof SVGElement ? e : (console.warn("trigger must be an HTMLElement or SVGElement or Vue component instance"), null), $ = (e, t) => {
|
|
30
|
+
p.value[t] = B(e);
|
|
31
|
+
};
|
|
32
|
+
E(
|
|
33
|
+
g,
|
|
34
|
+
(e) => {
|
|
35
|
+
p.value.length = e;
|
|
36
|
+
},
|
|
37
|
+
{ flush: "post" }
|
|
38
|
+
);
|
|
39
|
+
function N(e = {}, t) {
|
|
40
|
+
const r = {};
|
|
41
|
+
for (const [n, s] of Object.entries(e))
|
|
42
|
+
/^on[A-Z]/.test(n) && typeof s == "function" && (r[n] = (...f) => s(...f, t));
|
|
43
|
+
return r;
|
|
44
|
+
}
|
|
45
|
+
const P = a(
|
|
46
|
+
() => c.value.map((e, t) => N(o.triggerEvents, t))
|
|
47
|
+
), y = R(null), u = a(() => {
|
|
48
|
+
var e, t;
|
|
49
|
+
return typeof o.offset == "number" ? { mainAxis: o.offset, crossAxis: 0 } : {
|
|
50
|
+
mainAxis: ((e = o.offset) == null ? void 0 : e.mainAxis) ?? 0,
|
|
51
|
+
crossAxis: ((t = o.offset) == null ? void 0 : t.crossAxis) ?? 0
|
|
52
|
+
};
|
|
53
|
+
}), { top: O, bottom: C, left: b, right: H, width: L, update: M } = se(h), { width: T, height: A } = ae(y, void 0, { box: "border-box" }), z = a(() => {
|
|
54
|
+
const { placement: e, preventOverflow: t } = o, r = {}, n = (s, f) => {
|
|
55
|
+
if (!t) {
|
|
56
|
+
r[s] = f;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const _ = s === "top" || s === "bottom", G = _ ? "100dvh" : "100dvw", I = l(_ ? A.value : T.value);
|
|
60
|
+
r[s] = `clamp(0px, ${f}, calc(${G} - ${I}))`;
|
|
61
|
+
};
|
|
62
|
+
return e.includes("top") && n("top", l(O.value - A.value - u.value.mainAxis)), e.includes("bottom") && n("bottom", `calc(100% - ${l(C.value + A.value + u.value.mainAxis)})`), e.includes("left") && n("left", l(b.value + u.value.crossAxis)), e.includes("right") && n("right", `calc(100% - ${l(H.value + u.value.crossAxis)})`), e.includes("center") && n("left", l(b.value + L.value / 2 - T.value / 2 + u.value.crossAxis)), r;
|
|
63
|
+
});
|
|
64
|
+
E(
|
|
65
|
+
() => o.show,
|
|
66
|
+
(e) => {
|
|
67
|
+
e && U(() => {
|
|
68
|
+
M();
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
const D = le(h);
|
|
73
|
+
return w({
|
|
74
|
+
triggerRef: h,
|
|
75
|
+
triggerRefs: p,
|
|
76
|
+
popperRef: y
|
|
77
|
+
}), (e, t) => (d(), S(x, null, [
|
|
78
|
+
(d(!0), S(x, null, Z(c.value, (r, n) => (d(), V(q(r), k({
|
|
79
|
+
key: r.key ?? n,
|
|
80
|
+
ref_for: !0,
|
|
81
|
+
ref: (s) => $(s, n)
|
|
82
|
+
}, { ref_for: !0 }, P.value[n]), null, 16))), 128)),
|
|
83
|
+
W(J, K(Q(e.transitionProps)), {
|
|
84
|
+
default: X(() => [
|
|
85
|
+
e.show ? (d(), V(ee, {
|
|
86
|
+
key: 0,
|
|
87
|
+
to: te(D)
|
|
88
|
+
}, [
|
|
89
|
+
oe("div", k({
|
|
90
|
+
class: "tr-base-popper",
|
|
91
|
+
ref_key: "popperRef",
|
|
92
|
+
ref: y,
|
|
93
|
+
style: z.value
|
|
94
|
+
}, e.$attrs), [
|
|
95
|
+
re(e.$slots, "content", {}, void 0, !0)
|
|
96
|
+
], 16)
|
|
97
|
+
], 8, ["to"])) : Y("", !0)
|
|
98
|
+
]),
|
|
99
|
+
_: 3
|
|
100
|
+
}, 16)
|
|
101
|
+
], 64));
|
|
102
|
+
}
|
|
103
|
+
}), ue = /* @__PURE__ */ ie(ce, [["__scopeId", "data-v-21605fe2"]]);
|
|
104
|
+
ue.name = "TrBasePopper";
|
|
105
|
+
export {
|
|
106
|
+
ue as default
|
|
107
|
+
};
|
|
@@ -1,79 +1,85 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { c as
|
|
3
|
-
import
|
|
4
|
-
import { _ as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as C, ref as g, computed as n, watch as R, createBlock as E, openBlock as a, unref as b, withCtx as v, createElementVNode as x, createElementBlock as _, Fragment as B, renderList as D, toDisplayString as M, renderSlot as H } from "vue";
|
|
2
|
+
import { o as L, c as k, d as P } from "../index2.js";
|
|
3
|
+
import T from "../base-popper/index.js";
|
|
4
|
+
import { _ as I } from "../_plugin-vue_export-helper.js";
|
|
5
|
+
const S = { class: "tr-dropdown-menu__list" }, $ = ["onClick"], F = /* @__PURE__ */ C({
|
|
6
6
|
__name: "index",
|
|
7
7
|
props: {
|
|
8
8
|
items: {},
|
|
9
9
|
show: { type: Boolean },
|
|
10
|
-
trigger: { default: "click" }
|
|
11
|
-
minWidth: { default: 160 },
|
|
12
|
-
topOffset: { default: 0 }
|
|
10
|
+
trigger: { default: "click" }
|
|
13
11
|
},
|
|
14
12
|
emits: ["item-click", "click-outside"],
|
|
15
|
-
setup(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}));
|
|
19
|
-
const t = a, f = O(), C = m(() => f.style), _ = p(!1), o = m({
|
|
20
|
-
get: () => t.trigger === "manual" ? t.show : _.value,
|
|
13
|
+
setup(l, { emit: w }) {
|
|
14
|
+
const t = l, c = w, u = g(!1), r = n({
|
|
15
|
+
get: () => t.trigger === "manual" ? t.show : u.value,
|
|
21
16
|
set: (e) => {
|
|
22
|
-
t.trigger !== "manual" && (
|
|
17
|
+
t.trigger !== "manual" && (u.value = e);
|
|
23
18
|
}
|
|
24
|
-
}),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}))
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
g("click-outside", e), t.trigger === "click" && ((c = i.value) != null && c.contains(e.target) && e.stopPropagation(), o.value = !1);
|
|
31
|
-
}), W(o, (e) => {
|
|
32
|
-
e && D();
|
|
19
|
+
}), i = g(null), p = n(() => {
|
|
20
|
+
var e;
|
|
21
|
+
return (e = i.value) == null ? void 0 : e.triggerRef;
|
|
22
|
+
}), d = n(() => {
|
|
23
|
+
var e;
|
|
24
|
+
return (e = i.value) == null ? void 0 : e.popperRef;
|
|
33
25
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
if (t.trigger === "click" || t.trigger === "manual")
|
|
27
|
+
L(
|
|
28
|
+
d,
|
|
29
|
+
(e) => {
|
|
30
|
+
c("click-outside", e), r.value = !1;
|
|
31
|
+
},
|
|
32
|
+
{ ignore: [p] }
|
|
33
|
+
);
|
|
34
|
+
else if (t.trigger === "hover") {
|
|
35
|
+
const e = k(
|
|
36
|
+
n(() => P(p.value)),
|
|
37
|
+
{ delayEnter: 100, delayLeave: 300 }
|
|
38
|
+
), m = k(d, { delayEnter: 100, delayLeave: 300 });
|
|
39
|
+
R(
|
|
40
|
+
() => [e.value, m.value],
|
|
41
|
+
([o, f]) => {
|
|
42
|
+
r.value = o || f;
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
const h = () => {
|
|
47
|
+
t.trigger === "click" && (r.value = !r.value);
|
|
48
|
+
}, y = (e) => {
|
|
49
|
+
r.value = !1, c("item-click", e);
|
|
38
50
|
};
|
|
39
|
-
return (e,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
])
|
|
65
|
-
], 4)) : H("", !0)
|
|
66
|
-
]),
|
|
67
|
-
_: 1
|
|
68
|
-
})
|
|
69
|
-
], 64));
|
|
51
|
+
return (e, m) => (a(), E(b(T), {
|
|
52
|
+
show: r.value,
|
|
53
|
+
class: "tr-dropdown-menu",
|
|
54
|
+
ref_key: "basePopperRef",
|
|
55
|
+
ref: i,
|
|
56
|
+
placement: "top-left",
|
|
57
|
+
offset: 8,
|
|
58
|
+
"transition-props": { name: "tr-dropdown-menu" },
|
|
59
|
+
"prevent-overflow": !0,
|
|
60
|
+
"trigger-events": { onClick: h }
|
|
61
|
+
}, {
|
|
62
|
+
trigger: v(() => [
|
|
63
|
+
H(e.$slots, "trigger", {}, void 0, !0)
|
|
64
|
+
]),
|
|
65
|
+
content: v(() => [
|
|
66
|
+
x("ul", S, [
|
|
67
|
+
(a(!0), _(B, null, D(t.items, (o) => (a(), _("li", {
|
|
68
|
+
class: "tr-dropdown-menu__list-item",
|
|
69
|
+
key: o.id,
|
|
70
|
+
onClick: (f) => y(o)
|
|
71
|
+
}, M(o.text), 9, $))), 128))
|
|
72
|
+
])
|
|
73
|
+
]),
|
|
74
|
+
_: 3
|
|
75
|
+
}, 8, ["show", "trigger-events"]));
|
|
70
76
|
}
|
|
71
|
-
}),
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
77
|
+
}), s = /* @__PURE__ */ I(F, [["__scopeId", "data-v-b5b6a7b9"]]);
|
|
78
|
+
s.name = "TrDropdownMenu";
|
|
79
|
+
const N = function(l) {
|
|
80
|
+
l.component(s.name, s);
|
|
75
81
|
};
|
|
76
|
-
|
|
82
|
+
s.install = N;
|
|
77
83
|
export {
|
|
78
|
-
|
|
84
|
+
s as default
|
|
79
85
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as V, mergeModels as E, useModel as
|
|
2
|
-
import { U as
|
|
3
|
-
import { b as
|
|
1
|
+
import { defineComponent as V, mergeModels as E, useModel as q, watch as g, ref as i, computed as $, createElementBlock as a, openBlock as l, createElementVNode as b, Fragment as C, renderList as S, createCommentVNode as _, normalizeClass as I, createBlock as x, resolveDynamicComponent as B, toDisplayString as D, nextTick as G } from "vue";
|
|
2
|
+
import { U as H } from "../tiny-robot-svgs.js";
|
|
3
|
+
import { b as X, o as j } from "../index2.js";
|
|
4
4
|
import { _ as J } from "../_plugin-vue_export-helper.js";
|
|
5
5
|
const K = ["onClick"], P = {
|
|
6
6
|
key: 0,
|
|
@@ -11,15 +11,15 @@ const K = ["onClick"], P = {
|
|
|
11
11
|
items: {},
|
|
12
12
|
selected: {},
|
|
13
13
|
linesLimit: { default: Number.MAX_SAFE_INTEGER },
|
|
14
|
-
moreIcon: {
|
|
14
|
+
moreIcon: { default: H },
|
|
15
15
|
showMoreTrigger: { default: "click" }
|
|
16
16
|
}, {
|
|
17
17
|
selected: {},
|
|
18
18
|
selectedModifiers: {}
|
|
19
19
|
}),
|
|
20
20
|
emits: /* @__PURE__ */ E(["item-click"], ["update:selected"]),
|
|
21
|
-
setup(d, { emit:
|
|
22
|
-
const n = d, u =
|
|
21
|
+
setup(d, { emit: F }) {
|
|
22
|
+
const n = d, u = q(d, "selected");
|
|
23
23
|
g(
|
|
24
24
|
() => n.items,
|
|
25
25
|
(t) => {
|
|
@@ -27,10 +27,10 @@ const K = ["onClick"], P = {
|
|
|
27
27
|
},
|
|
28
28
|
{ immediate: !0 }
|
|
29
29
|
);
|
|
30
|
-
const N =
|
|
30
|
+
const N = F, y = i(null), w = i(null), k = i(null), M = i([]), s = i(null), m = i(!1), c = i(!1), A = (t, o) => {
|
|
31
31
|
t && (M.value[o] = t);
|
|
32
32
|
}, L = () => {
|
|
33
|
-
s.value = null, m.value = !1,
|
|
33
|
+
s.value = null, m.value = !1, G(() => {
|
|
34
34
|
const t = y.value, o = w.value;
|
|
35
35
|
if (!t || !o)
|
|
36
36
|
return;
|
|
@@ -43,26 +43,29 @@ const K = ["onClick"], P = {
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
g(() => n.items, L);
|
|
46
|
-
const { width:
|
|
47
|
-
g(
|
|
46
|
+
const { width: W } = X(y);
|
|
47
|
+
g(W, (t) => {
|
|
48
48
|
t > 0 && L();
|
|
49
49
|
});
|
|
50
|
-
const
|
|
50
|
+
const z = $(() => s.value !== null ? n.items.slice(s.value) : []), O = $(() => s.value === null ? !1 : n.items.findIndex((o) => o.id === u.value) >= s.value), R = (t) => {
|
|
51
51
|
u.value = t, c.value = !1, N("item-click", t);
|
|
52
52
|
}, U = () => {
|
|
53
53
|
n.showMoreTrigger === "click" && (c.value = !c.value);
|
|
54
54
|
}, v = (t) => {
|
|
55
55
|
n.showMoreTrigger === "hover" && (c.value = t);
|
|
56
56
|
};
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
(
|
|
60
|
-
|
|
57
|
+
return j(
|
|
58
|
+
k,
|
|
59
|
+
() => {
|
|
60
|
+
c.value = !1;
|
|
61
|
+
},
|
|
62
|
+
{ ignore: [k, w] }
|
|
63
|
+
), (t, o) => (l(), a("div", {
|
|
61
64
|
class: "tr-flow-layout",
|
|
62
65
|
ref_key: "containerRef",
|
|
63
66
|
ref: y
|
|
64
67
|
}, [
|
|
65
|
-
(l(!0), a(C, null,
|
|
68
|
+
(l(!0), a(C, null, S(n.items, (e, f) => (l(), a(C, {
|
|
66
69
|
key: e.id
|
|
67
70
|
}, [
|
|
68
71
|
s.value === null || f < s.value ? (l(), a("button", {
|
|
@@ -73,13 +76,13 @@ const K = ["onClick"], P = {
|
|
|
73
76
|
onClick: (r) => R(e.id)
|
|
74
77
|
}, [
|
|
75
78
|
(l(), x(B(e.icon), { class: "tr-flow-layout__item-icon" })),
|
|
76
|
-
e.label ? (l(), a("span", P,
|
|
79
|
+
e.label ? (l(), a("span", P, D(e.label), 1)) : _("", !0)
|
|
77
80
|
], 10, K)) : _("", !0)
|
|
78
81
|
], 64))), 128)),
|
|
79
82
|
b("div", Q, [
|
|
80
83
|
m.value ? _("", !0) : (l(), a("button", {
|
|
81
84
|
key: 0,
|
|
82
|
-
class: I(["tr-flow-layout__item", "icon-only", { selected:
|
|
85
|
+
class: I(["tr-flow-layout__item", "icon-only", { selected: O.value }]),
|
|
83
86
|
ref_key: "moreButtonRef",
|
|
84
87
|
ref: w,
|
|
85
88
|
onClick: U,
|
|
@@ -99,20 +102,20 @@ const K = ["onClick"], P = {
|
|
|
99
102
|
ref_key: "dropDownRef",
|
|
100
103
|
ref: k
|
|
101
104
|
}, [
|
|
102
|
-
(l(!0), a(C, null,
|
|
105
|
+
(l(!0), a(C, null, S(z.value, (e) => (l(), a("button", {
|
|
103
106
|
class: I(["tr-flow-layout__dropdown_item", { selected: e.id === u.value }]),
|
|
104
107
|
key: e.id,
|
|
105
108
|
onClick: (f) => R(e.id)
|
|
106
109
|
}, [
|
|
107
110
|
(l(), x(B(e.icon), { class: "tr-flow-layout__item-icon" })),
|
|
108
|
-
b("span", Z,
|
|
111
|
+
b("span", Z, D(e.label), 1)
|
|
109
112
|
], 10, Y))), 128))
|
|
110
113
|
], 512)) : _("", !0)
|
|
111
114
|
], 32)
|
|
112
115
|
])
|
|
113
116
|
], 512));
|
|
114
117
|
}
|
|
115
|
-
}), p = /* @__PURE__ */ J(ee, [["__scopeId", "data-v-
|
|
118
|
+
}), p = /* @__PURE__ */ J(ee, [["__scopeId", "data-v-3b70ef9f"]]);
|
|
116
119
|
p.name = "TrFlowLayout";
|
|
117
120
|
const te = function(d) {
|
|
118
121
|
d.component(p.name, p);
|