@opentiny/tiny-robot 0.2.0-alpha.3 → 0.2.0-alpha.5
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 +26 -26
- package/dist/bubble/index.js +1 -1
- package/dist/close.js +1 -1
- package/dist/container/index.js +11 -11
- package/dist/dropdown-menu/index.js +70 -0
- package/dist/feedback/index.js +28 -28
- package/dist/flow-layout-buttons/index.js +120 -0
- package/dist/history/index.js +42 -42
- package/dist/icon-button/index.js +17 -16
- package/dist/index.d.ts +387 -65
- package/dist/index.js +55 -40
- package/dist/index2.js +4588 -341
- package/dist/index3.js +457 -3847
- package/dist/index4.js +1 -1
- package/dist/index5.js +3727 -3069
- package/dist/index6.js +3107 -4493
- package/dist/question/index.js +297 -243
- package/dist/sender/index.js +938 -519
- package/dist/shared/index.js +8 -0
- package/dist/style.css +1 -1
- package/dist/suggestion/index.js +90 -90
- package/dist/suggestion-pills/index.js +119 -0
- package/dist/suggestion-popover/index.js +176 -0
- package/dist/tiny-robot-svgs.js +300 -145
- package/package.json +3 -3
package/dist/suggestion/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
1
|
+
import { defineComponent as H, ref as p, computed as P, watch as W, watchEffect as ne, onMounted as Y, onBeforeUnmount as Z, createElementBlock as v, openBlock as g, normalizeClass as j, createElementVNode as u, withDirectives as oe, Fragment as z, renderList as M, createVNode as E, unref as w, toDisplayString as T, vShow as le, nextTick as ie, renderSlot as $, createCommentVNode as N, createBlock as L, normalizeStyle as ae, resolveComponent as ce, withCtx as O } from "vue";
|
|
2
|
+
import { A as Q, a as G, t as re, K as ue, U as ge } from "../tiny-robot-svgs.js";
|
|
3
3
|
function de(l, c = "") {
|
|
4
4
|
const s = document.createElement("div");
|
|
5
5
|
c && (s.className = c), s.style.visibility = "hidden", s.style.position = "absolute", s.style.whiteSpace = "nowrap", s.textContent = l, document.body.appendChild(s);
|
|
6
6
|
const o = s.offsetWidth;
|
|
7
7
|
return document.body.removeChild(s), o;
|
|
8
8
|
}
|
|
9
|
-
const
|
|
10
|
-
function
|
|
9
|
+
const F = /* @__PURE__ */ new Map();
|
|
10
|
+
function X(l, c = "") {
|
|
11
11
|
const s = `${l}::${c}`;
|
|
12
|
-
if (
|
|
13
|
-
return
|
|
12
|
+
if (F.has(s))
|
|
13
|
+
return F.get(s);
|
|
14
14
|
const o = de(l, c);
|
|
15
|
-
return
|
|
15
|
+
return F.set(s, o), o;
|
|
16
16
|
}
|
|
17
|
-
const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-suggestions_expanded-wrapper" }, pe = { class: "tr-common-suggestions_expanded-area" }, he = ["onClick"], fe = { class: "tr-common-suggestions_item_icon" }, ye = { class: "tr-common-suggestions_item_text" }, _e = { class: "tr-common-suggestions_container" }, ke = ["onClick"], Ce = { class: "tr-common-suggestions_item_icon" },
|
|
17
|
+
const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-suggestions_expanded-wrapper" }, pe = { class: "tr-common-suggestions_expanded-area" }, he = ["onClick"], fe = { class: "tr-common-suggestions_item_icon" }, ye = { class: "tr-common-suggestions_item_text" }, _e = { class: "tr-common-suggestions_container" }, ke = ["onClick"], Ce = { class: "tr-common-suggestions_item_icon" }, $e = { class: "tr-common-suggestions_item_text" }, xe = /* @__PURE__ */ H({
|
|
18
18
|
__name: "SuggestionCapsule",
|
|
19
19
|
props: {
|
|
20
20
|
suggestions: {
|
|
@@ -46,51 +46,51 @@ const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-
|
|
|
46
46
|
let k = 0;
|
|
47
47
|
const B = Math.min(3, s.suggestions.length);
|
|
48
48
|
for (let C = 0; C < B; C++) {
|
|
49
|
-
const I =
|
|
49
|
+
const I = X(s.suggestions[C].text, "tr-common-suggestions_item") + _;
|
|
50
50
|
k += I;
|
|
51
51
|
}
|
|
52
52
|
const q = k / B;
|
|
53
53
|
h.value = Math.max(1, Math.floor(d / q));
|
|
54
54
|
for (let C = 0; C < s.suggestions.length; C++) {
|
|
55
|
-
const I = s.suggestions[C],
|
|
56
|
-
r +
|
|
55
|
+
const I = s.suggestions[C], A = X(I.text, "tr-common-suggestions_item") + _;
|
|
56
|
+
r + A <= d ? (r += A, m.value.push(I)) : a.value.push(I);
|
|
57
57
|
}
|
|
58
58
|
f.value = a.value.length > 0, o("show-expand-button", f.value);
|
|
59
59
|
}, y = (i) => {
|
|
60
60
|
o("suggestion-click", i);
|
|
61
61
|
};
|
|
62
|
-
return
|
|
62
|
+
return W(
|
|
63
63
|
() => s.isExpanded,
|
|
64
64
|
(i) => {
|
|
65
65
|
t.value = i;
|
|
66
66
|
}
|
|
67
67
|
), ne(() => {
|
|
68
68
|
n.value && s.suggestions.length && b();
|
|
69
|
-
}),
|
|
69
|
+
}), Y(() => {
|
|
70
70
|
n.value && (S.value = new ResizeObserver(() => {
|
|
71
71
|
b();
|
|
72
72
|
}), S.value.observe(n.value));
|
|
73
73
|
}), Z(() => {
|
|
74
74
|
S.value && S.value.disconnect();
|
|
75
75
|
}), (i, d) => (g(), v("div", {
|
|
76
|
-
class:
|
|
76
|
+
class: j(["tr-common-suggestions", { expanded: t.value }]),
|
|
77
77
|
ref_key: "capsuleRef",
|
|
78
78
|
ref: n
|
|
79
79
|
}, [
|
|
80
80
|
u("div", ve, [
|
|
81
81
|
u("div", me, [
|
|
82
82
|
oe(u("div", pe, [
|
|
83
|
-
(g(!0), v(
|
|
83
|
+
(g(!0), v(z, null, M(R.value, (r, _) => (g(), v("div", {
|
|
84
84
|
key: `row-${_}`,
|
|
85
85
|
class: "tr-common-suggestions_row"
|
|
86
86
|
}, [
|
|
87
|
-
(g(!0), v(
|
|
87
|
+
(g(!0), v(z, null, M(r, (k, B) => (g(), v("div", {
|
|
88
88
|
key: `hidden-${k.id}-${B}`,
|
|
89
89
|
class: "tr-common-suggestions_item",
|
|
90
90
|
onClick: (q) => y(k)
|
|
91
91
|
}, [
|
|
92
92
|
u("div", fe, [
|
|
93
|
-
E(w(
|
|
93
|
+
E(w(Q))
|
|
94
94
|
]),
|
|
95
95
|
u("div", ye, T(k.text), 1)
|
|
96
96
|
], 8, he))), 128))
|
|
@@ -100,15 +100,15 @@ const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-
|
|
|
100
100
|
])
|
|
101
101
|
]),
|
|
102
102
|
u("div", _e, [
|
|
103
|
-
(g(!0), v(
|
|
103
|
+
(g(!0), v(z, null, M(m.value, (r, _) => (g(), v("div", {
|
|
104
104
|
key: `visible-${r.id}-${_}`,
|
|
105
105
|
class: "tr-common-suggestions_item",
|
|
106
106
|
onClick: (k) => y(r)
|
|
107
107
|
}, [
|
|
108
108
|
u("div", Ce, [
|
|
109
|
-
E(w(
|
|
109
|
+
E(w(Q))
|
|
110
110
|
]),
|
|
111
|
-
u("div",
|
|
111
|
+
u("div", $e, T(r.text), 1)
|
|
112
112
|
], 8, ke))), 128))
|
|
113
113
|
])
|
|
114
114
|
])
|
|
@@ -117,7 +117,7 @@ const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-
|
|
|
117
117
|
}), be = { class: "tr-suggestion-categories" }, we = ["onClick"], Se = {
|
|
118
118
|
key: 0,
|
|
119
119
|
class: "category-icon"
|
|
120
|
-
}, Ie = /* @__PURE__ */
|
|
120
|
+
}, Ie = /* @__PURE__ */ H({
|
|
121
121
|
__name: "CategoryNav",
|
|
122
122
|
props: {
|
|
123
123
|
categories: {
|
|
@@ -135,13 +135,13 @@ const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-
|
|
|
135
135
|
s("category-select", n);
|
|
136
136
|
};
|
|
137
137
|
return (n, f) => (g(), v("div", be, [
|
|
138
|
-
(g(!0), v(
|
|
138
|
+
(g(!0), v(z, null, M(l.categories, (t) => (g(), v("div", {
|
|
139
139
|
key: t.id,
|
|
140
|
-
class:
|
|
140
|
+
class: j(["tr-suggestion-categories-item", { active: l.activeCategory === t.id }]),
|
|
141
141
|
onClick: (m) => o(t.id)
|
|
142
142
|
}, [
|
|
143
|
-
|
|
144
|
-
t.icon ? (g(), v("div", Se, T(t.icon), 1)) :
|
|
143
|
+
$(n.$slots, "category-label", { category: t }, () => [
|
|
144
|
+
t.icon ? (g(), v("div", Se, T(t.icon), 1)) : N("", !0),
|
|
145
145
|
u("span", null, T(t.label), 1)
|
|
146
146
|
])
|
|
147
147
|
], 10, we))), 128))
|
|
@@ -150,7 +150,7 @@ const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-
|
|
|
150
150
|
});
|
|
151
151
|
function Ee(l, c = {}) {
|
|
152
152
|
const s = p(c.initialIndex || -1);
|
|
153
|
-
|
|
153
|
+
W(l, (t) => {
|
|
154
154
|
t.length > 0 && s.value === -1 ? s.value = 0 : t.length === 0 ? s.value = -1 : s.value >= t.length && (s.value = t.length - 1);
|
|
155
155
|
});
|
|
156
156
|
const o = (t) => {
|
|
@@ -189,16 +189,16 @@ function Ee(l, c = {}) {
|
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header" }, De = { class: "tr-suggestion-header-left" }, Oe = { class: "tr-suggestion-header-icon" }, Re = { class: "tr-suggestion-header-title" },
|
|
192
|
+
const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header" }, De = { class: "tr-suggestion-header-left" }, Oe = { class: "tr-suggestion-header-icon" }, Re = { class: "tr-suggestion-header-title" }, Ae = { class: "close-icon" }, Ke = {
|
|
193
193
|
key: 0,
|
|
194
194
|
class: "tr-suggestion-loading"
|
|
195
|
-
},
|
|
195
|
+
}, Ve = { key: 1 }, We = ["onClick", "onMouseenter"], ze = { class: "item-content" }, Me = { class: "item-label" }, Ne = {
|
|
196
196
|
key: 0,
|
|
197
197
|
class: "item-description"
|
|
198
198
|
}, qe = {
|
|
199
199
|
key: 2,
|
|
200
200
|
class: "tr-suggestion-empty"
|
|
201
|
-
}, Le = /* @__PURE__ */
|
|
201
|
+
}, Le = /* @__PURE__ */ H({
|
|
202
202
|
__name: "SuggestionPanel",
|
|
203
203
|
props: {
|
|
204
204
|
items: {
|
|
@@ -250,8 +250,8 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
250
250
|
u("div", Be, [
|
|
251
251
|
u("div", De, [
|
|
252
252
|
u("div", Oe, [
|
|
253
|
-
|
|
254
|
-
E(w(
|
|
253
|
+
$(i.$slots, "title-icon", {}, () => [
|
|
254
|
+
E(w(G), { style: { color: "#1476ff", "font-size": "24px" } })
|
|
255
255
|
])
|
|
256
256
|
]),
|
|
257
257
|
u("div", Re, T(l.title), 1)
|
|
@@ -260,7 +260,7 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
260
260
|
class: "tr-suggestion-close-btn",
|
|
261
261
|
onClick: b
|
|
262
262
|
}, [
|
|
263
|
-
u("span",
|
|
263
|
+
u("span", Ae, [
|
|
264
264
|
E(w(re))
|
|
265
265
|
])
|
|
266
266
|
])
|
|
@@ -270,34 +270,34 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
270
270
|
categories: l.categories,
|
|
271
271
|
"active-category": a.value,
|
|
272
272
|
onCategorySelect: S
|
|
273
|
-
}, null, 8, ["categories", "active-category"])) :
|
|
273
|
+
}, null, 8, ["categories", "active-category"])) : N("", !0),
|
|
274
274
|
u("div", {
|
|
275
275
|
class: "tr-suggestion-content",
|
|
276
276
|
style: ae({ "max-height": h.value.length > l.maxVisibleItems ? `${l.maxVisibleItems * 56}px` : "auto" })
|
|
277
277
|
}, [
|
|
278
|
-
l.loading ? (g(), v("div",
|
|
279
|
-
|
|
278
|
+
l.loading ? (g(), v("div", Ke, [
|
|
279
|
+
$(i.$slots, "loading-indicator", {}, () => [
|
|
280
280
|
d[0] || (d[0] = u("div", { class: "tr-suggestion-loading-spinner" }, null, -1))
|
|
281
281
|
])
|
|
282
|
-
])) : h.value.length > 0 ? (g(), v("ul",
|
|
283
|
-
(g(!0), v(
|
|
282
|
+
])) : h.value.length > 0 ? (g(), v("ul", Ve, [
|
|
283
|
+
(g(!0), v(z, null, M(h.value, (r, _) => (g(), v("li", {
|
|
284
284
|
key: r.id,
|
|
285
|
-
class:
|
|
285
|
+
class: j(["tr-suggestion-list-item", { "tr-suggestion-item-active": _ === w(m) }]),
|
|
286
286
|
onClick: (k) => R(r),
|
|
287
287
|
onMouseenter: (k) => y(_)
|
|
288
288
|
}, [
|
|
289
|
-
|
|
289
|
+
$(i.$slots, "item", {
|
|
290
290
|
item: r,
|
|
291
291
|
active: _ === w(m)
|
|
292
292
|
}, () => [
|
|
293
|
-
u("div",
|
|
294
|
-
u("div",
|
|
295
|
-
r.description ? (g(), v("div",
|
|
293
|
+
u("div", ze, [
|
|
294
|
+
u("div", Me, T(r.text), 1),
|
|
295
|
+
r.description ? (g(), v("div", Ne, T(r.description), 1)) : N("", !0)
|
|
296
296
|
])
|
|
297
297
|
])
|
|
298
|
-
], 42,
|
|
298
|
+
], 42, We))), 128))
|
|
299
299
|
])) : (g(), v("div", qe, [
|
|
300
|
-
|
|
300
|
+
$(i.$slots, "empty", {}, () => [
|
|
301
301
|
d[1] || (d[1] = u("p", null, "无匹配结果", -1))
|
|
302
302
|
])
|
|
303
303
|
]))
|
|
@@ -317,7 +317,7 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
317
317
|
} : null;
|
|
318
318
|
}
|
|
319
319
|
};
|
|
320
|
-
},
|
|
320
|
+
}, Ue = { class: "tr-suggestion__header" }, U = /* @__PURE__ */ H({
|
|
321
321
|
__name: "index",
|
|
322
322
|
props: {
|
|
323
323
|
triggerKeys: { default: () => ["/"] },
|
|
@@ -344,14 +344,14 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
344
344
|
}, b = p(""), y = p(-1), i = p(null), d = p(null), r = P(() => o.open !== void 0 ? o.open : f.value), _ = P(() => {
|
|
345
345
|
if (o.categories.length === 0 || !b.value)
|
|
346
346
|
return t.value;
|
|
347
|
-
const e = o.categories.find((
|
|
347
|
+
const e = o.categories.find((x) => x.id === b.value);
|
|
348
348
|
return e ? e.items : [];
|
|
349
349
|
});
|
|
350
|
-
|
|
350
|
+
W(r, (e) => {
|
|
351
351
|
e ? y.value = _.value.length > 0 ? 0 : -1 : y.value = -1;
|
|
352
|
-
}),
|
|
352
|
+
}), W(_, (e) => {
|
|
353
353
|
e.length > 0 && y.value === -1 ? y.value = 0 : e.length === 0 ? y.value = -1 : y.value >= e.length && (y.value = e.length - 1);
|
|
354
|
-
}),
|
|
354
|
+
}), W(
|
|
355
355
|
() => o.categories,
|
|
356
356
|
(e) => {
|
|
357
357
|
e.length > 0 && !b.value && (b.value = e[0].id);
|
|
@@ -366,63 +366,63 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
366
366
|
position: 0
|
|
367
367
|
}), e.template && n("fill-template", e.template);
|
|
368
368
|
}, C = (e) => {
|
|
369
|
-
e === !1 ?
|
|
369
|
+
e === !1 ? K() : (typeof e == "object" && e !== null && (m.value = {
|
|
370
370
|
text: e.text || "",
|
|
371
371
|
position: e.position || 0
|
|
372
372
|
}), k(), f.value = !0, n("update:open", !0));
|
|
373
|
-
}, I = (e,
|
|
374
|
-
const
|
|
375
|
-
return
|
|
376
|
-
},
|
|
373
|
+
}, I = (e, x) => {
|
|
374
|
+
const V = B(e, x);
|
|
375
|
+
return V ? (m.value = V, C(V), !0) : r.value && x === "" ? (C(!1), !0) : !1;
|
|
376
|
+
}, A = (e) => {
|
|
377
377
|
if (r.value && d.value) {
|
|
378
378
|
d.value.handleKeyDown(e);
|
|
379
379
|
return;
|
|
380
380
|
}
|
|
381
|
-
},
|
|
381
|
+
}, K = () => {
|
|
382
382
|
o.open === void 0 && (f.value = !1), n("update:open", !1), n("close");
|
|
383
383
|
}, ee = (e) => {
|
|
384
384
|
b.value = e.id, y.value = 0, n("category-select", e);
|
|
385
|
-
}, te = (e,
|
|
386
|
-
n("select", e.text,
|
|
387
|
-
},
|
|
388
|
-
o.closeOnOutsideClick && r.value && i.value && !i.value.contains(e.target) &&
|
|
385
|
+
}, te = (e, x) => {
|
|
386
|
+
n("select", e.text, x), e.template && n("fill-template", e.template), K();
|
|
387
|
+
}, J = (e) => {
|
|
388
|
+
o.closeOnOutsideClick && r.value && i.value && !i.value.contains(e.target) && K();
|
|
389
389
|
}, se = () => {
|
|
390
|
-
r.value ?
|
|
390
|
+
r.value ? K() : (k(), f.value = !0, n("update:open", !0));
|
|
391
391
|
};
|
|
392
|
-
return
|
|
393
|
-
o.closeOnOutsideClick && document.addEventListener("click",
|
|
392
|
+
return Y(() => {
|
|
393
|
+
o.closeOnOutsideClick && document.addEventListener("click", J);
|
|
394
394
|
}), Z(() => {
|
|
395
|
-
o.closeOnOutsideClick && document.removeEventListener("click",
|
|
395
|
+
o.closeOnOutsideClick && document.removeEventListener("click", J);
|
|
396
396
|
}), c({
|
|
397
397
|
trigger: C,
|
|
398
|
-
keyDown:
|
|
398
|
+
keyDown: A,
|
|
399
399
|
input: I,
|
|
400
400
|
toggleExpand: S
|
|
401
|
-
}), (e,
|
|
402
|
-
const
|
|
401
|
+
}), (e, x) => {
|
|
402
|
+
const V = ce("IconEdit");
|
|
403
403
|
return g(), v("div", {
|
|
404
404
|
ref_key: "rootRef",
|
|
405
405
|
ref: i,
|
|
406
|
-
class:
|
|
406
|
+
class: j(["tr-suggestion", e.className, { "tr-suggestion--dark": e.theme === "dark" }])
|
|
407
407
|
}, [
|
|
408
|
-
u("div",
|
|
408
|
+
u("div", Ue, [
|
|
409
409
|
u("div", {
|
|
410
410
|
class: "tr-suggestion__trigger",
|
|
411
411
|
onClick: se
|
|
412
412
|
}, [
|
|
413
|
-
E(w(
|
|
413
|
+
E(w(G), { style: { color: "#1476ff" } })
|
|
414
414
|
]),
|
|
415
|
-
E(
|
|
415
|
+
E(xe, {
|
|
416
416
|
suggestions: e.items,
|
|
417
417
|
isExpanded: a.value,
|
|
418
418
|
onSuggestionClick: q,
|
|
419
419
|
onShowExpandButton: R
|
|
420
420
|
}, {
|
|
421
421
|
"suggestion-icon": O((D) => [
|
|
422
|
-
|
|
422
|
+
$(e.$slots, "capsule-icon", {
|
|
423
423
|
suggestion: D.suggestion
|
|
424
424
|
}, () => [
|
|
425
|
-
E(
|
|
425
|
+
E(V)
|
|
426
426
|
])
|
|
427
427
|
]),
|
|
428
428
|
_: 3
|
|
@@ -433,11 +433,11 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
433
433
|
onClick: S
|
|
434
434
|
}, [
|
|
435
435
|
a.value ? (g(), L(w(ge), { key: 1 })) : (g(), L(w(ue), { key: 0 }))
|
|
436
|
-
])) :
|
|
436
|
+
])) : N("", !0)
|
|
437
437
|
]),
|
|
438
|
-
|
|
438
|
+
$(e.$slots, "trigger", {
|
|
439
439
|
onTrigger: C,
|
|
440
|
-
onKeyDown:
|
|
440
|
+
onKeyDown: A,
|
|
441
441
|
onInput: I
|
|
442
442
|
}),
|
|
443
443
|
r.value ? (g(), L(Le, {
|
|
@@ -451,47 +451,47 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
451
451
|
title: e.title,
|
|
452
452
|
maxVisibleItems: e.maxVisibleItems,
|
|
453
453
|
triggerContext: m.value,
|
|
454
|
-
onClose:
|
|
454
|
+
onClose: K,
|
|
455
455
|
onSelect: te,
|
|
456
456
|
onCategorySelect: ee
|
|
457
457
|
}, {
|
|
458
458
|
"title-icon": O(() => [
|
|
459
|
-
|
|
460
|
-
E(w(
|
|
459
|
+
$(e.$slots, "title-icon", {}, () => [
|
|
460
|
+
E(w(G), { style: { "font-size": "24px", color: "#1476ff" } })
|
|
461
461
|
])
|
|
462
462
|
]),
|
|
463
463
|
"category-label": O((D) => [
|
|
464
|
-
|
|
464
|
+
$(e.$slots, "category-label", {
|
|
465
465
|
category: D.category
|
|
466
466
|
})
|
|
467
467
|
]),
|
|
468
468
|
item: O((D) => [
|
|
469
|
-
|
|
469
|
+
$(e.$slots, "item", {
|
|
470
470
|
item: D.item,
|
|
471
471
|
active: D.active
|
|
472
472
|
})
|
|
473
473
|
]),
|
|
474
474
|
"loading-indicator": O(() => [
|
|
475
|
-
|
|
476
|
-
|
|
475
|
+
$(e.$slots, "loading-indicator", {}, () => [
|
|
476
|
+
x[0] || (x[0] = u("div", { class: "tr-suggestion__loading-spinner" }, null, -1))
|
|
477
477
|
])
|
|
478
478
|
]),
|
|
479
479
|
empty: O(() => [
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
$(e.$slots, "empty", {}, () => [
|
|
481
|
+
x[1] || (x[1] = u("p", null, "无匹配结果", -1))
|
|
482
482
|
])
|
|
483
483
|
]),
|
|
484
484
|
_: 3
|
|
485
|
-
}, 8, ["items", "categories", "loading", "title", "maxVisibleItems", "triggerContext"])) :
|
|
485
|
+
}, 8, ["items", "categories", "loading", "title", "maxVisibleItems", "triggerContext"])) : N("", !0)
|
|
486
486
|
], 2);
|
|
487
487
|
};
|
|
488
488
|
}
|
|
489
489
|
});
|
|
490
|
-
|
|
491
|
-
const
|
|
492
|
-
l.component(
|
|
490
|
+
U.name = "TrSuggestion";
|
|
491
|
+
const He = function(l) {
|
|
492
|
+
l.component(U.name, U);
|
|
493
493
|
};
|
|
494
|
-
|
|
494
|
+
U.install = He;
|
|
495
495
|
export {
|
|
496
|
-
|
|
496
|
+
U as default
|
|
497
497
|
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { defineComponent as D, useSlots as N, computed as f, createElementBlock as a, openBlock as n, normalizeClass as R, renderSlot as v, createBlock as c, resolveDynamicComponent as V, createCommentVNode as z, toDisplayString as E, useCssVars as F, useTemplateRef as L, Fragment as $, renderList as b, unref as r, mergeProps as x, createSlots as M, withCtx as C, createVNode as T } from "vue";
|
|
2
|
+
import { d as j } from "../index3.js";
|
|
3
|
+
import q from "../dropdown-menu/index.js";
|
|
4
|
+
import A from "../suggestion-popover/index.js";
|
|
5
|
+
import { _ as w } from "../_plugin-vue_export-helper.js";
|
|
6
|
+
const H = { key: 0 }, J = /* @__PURE__ */ D({
|
|
7
|
+
__name: "PillButton",
|
|
8
|
+
props: {
|
|
9
|
+
item: {}
|
|
10
|
+
},
|
|
11
|
+
setup(s) {
|
|
12
|
+
const u = s, p = N(), i = f(() => {
|
|
13
|
+
var e;
|
|
14
|
+
return !!(p.icon || (e = u.item) != null && e.icon);
|
|
15
|
+
}), _ = f(() => {
|
|
16
|
+
var e;
|
|
17
|
+
return !!(p.default || (e = u.item) != null && e.text);
|
|
18
|
+
}), m = f(() => i.value && !_.value);
|
|
19
|
+
return (e, g) => (n(), a("button", {
|
|
20
|
+
class: R(["tr-suggestion-pills__item", { "only-icon": m.value }])
|
|
21
|
+
}, [
|
|
22
|
+
v(e.$slots, "icon", {}, () => {
|
|
23
|
+
var l;
|
|
24
|
+
return [
|
|
25
|
+
(n(), c(V((l = e.item) == null ? void 0 : l.icon), { class: "tr-suggestion-pills__item_icon" }))
|
|
26
|
+
];
|
|
27
|
+
}, !0),
|
|
28
|
+
v(e.$slots, "default", {}, () => {
|
|
29
|
+
var l;
|
|
30
|
+
return [
|
|
31
|
+
(l = e.item) != null && l.text ? (n(), a("span", H, E(e.item.text), 1)) : z("", !0)
|
|
32
|
+
];
|
|
33
|
+
}, !0)
|
|
34
|
+
], 2));
|
|
35
|
+
}
|
|
36
|
+
}), o = /* @__PURE__ */ w(J, [["__scopeId", "data-v-8df2df8c"]]), K = {
|
|
37
|
+
class: "tr-suggestion-pills__container",
|
|
38
|
+
ref: "container"
|
|
39
|
+
}, O = /* @__PURE__ */ D({
|
|
40
|
+
__name: "index",
|
|
41
|
+
props: {
|
|
42
|
+
items: {}
|
|
43
|
+
},
|
|
44
|
+
emits: ["item-click"],
|
|
45
|
+
setup(s, { emit: u }) {
|
|
46
|
+
F((g) => ({
|
|
47
|
+
50209574: e.value
|
|
48
|
+
}));
|
|
49
|
+
const p = s, i = u, _ = L("container"), { arrivedState: m } = j(_), e = f(() => m.left ? "linear-gradient(to right, black 95%, transparent)" : m.right ? "linear-gradient(to left, black 95%, transparent)" : "linear-gradient(to right, transparent, black 5%, black 95%, transparent)");
|
|
50
|
+
return (g, l) => (n(), a("div", K, [
|
|
51
|
+
v(g.$slots, "default", {}, () => [
|
|
52
|
+
(n(!0), a($, null, b(p.items, (t) => {
|
|
53
|
+
var h, y, S, B, I, P;
|
|
54
|
+
return n(), a($, {
|
|
55
|
+
key: t.id
|
|
56
|
+
}, [
|
|
57
|
+
((h = t.action) == null ? void 0 : h.type) === "popover" ? (n(), c(r(A), x({
|
|
58
|
+
key: 0,
|
|
59
|
+
class: "shrink",
|
|
60
|
+
ref_for: !0
|
|
61
|
+
}, t.action.props, {
|
|
62
|
+
onItemClick: (y = t.action.events) == null ? void 0 : y.itemClick,
|
|
63
|
+
onGroupClick: (S = t.action.events) == null ? void 0 : S.groupClick,
|
|
64
|
+
onClose: (B = t.action.events) == null ? void 0 : B.close
|
|
65
|
+
}), M({
|
|
66
|
+
default: C(() => [
|
|
67
|
+
T(r(o), {
|
|
68
|
+
item: t,
|
|
69
|
+
onClick: (k) => i("item-click", t)
|
|
70
|
+
}, null, 8, ["item", "onClick"])
|
|
71
|
+
]),
|
|
72
|
+
_: 2
|
|
73
|
+
}, [
|
|
74
|
+
b(t.action.slots, (k, G) => ({
|
|
75
|
+
name: G,
|
|
76
|
+
fn: C(() => [
|
|
77
|
+
(n(), c(V(k)))
|
|
78
|
+
])
|
|
79
|
+
}))
|
|
80
|
+
]), 1040, ["onItemClick", "onGroupClick", "onClose"])) : ((I = t.action) == null ? void 0 : I.type) === "menu" ? (n(), c(r(q), x({
|
|
81
|
+
key: 1,
|
|
82
|
+
class: "shrink",
|
|
83
|
+
ref_for: !0
|
|
84
|
+
}, t.action.props, {
|
|
85
|
+
onItemClick: (P = t.action.events) == null ? void 0 : P.itemClick
|
|
86
|
+
}), {
|
|
87
|
+
default: C(() => [
|
|
88
|
+
T(r(o), {
|
|
89
|
+
item: t,
|
|
90
|
+
onClick: (k) => i("item-click", t)
|
|
91
|
+
}, null, 8, ["item", "onClick"])
|
|
92
|
+
]),
|
|
93
|
+
_: 2
|
|
94
|
+
}, 1040, ["onItemClick"])) : (n(), c(r(o), {
|
|
95
|
+
key: 2,
|
|
96
|
+
item: t,
|
|
97
|
+
onClick: (k) => i("item-click", t)
|
|
98
|
+
}, null, 8, ["item", "onClick"]))
|
|
99
|
+
], 64);
|
|
100
|
+
}), 128))
|
|
101
|
+
], !0)
|
|
102
|
+
], 512));
|
|
103
|
+
}
|
|
104
|
+
}), d = /* @__PURE__ */ w(O, [["__scopeId", "data-v-81c8f508"]]);
|
|
105
|
+
d.name = "TrSuggestionPills";
|
|
106
|
+
const Q = function(s) {
|
|
107
|
+
s.component(d.name, d);
|
|
108
|
+
};
|
|
109
|
+
d.install = Q;
|
|
110
|
+
o.name = "TrSuggestionPillButton";
|
|
111
|
+
const U = function(s) {
|
|
112
|
+
s.component(o.name, o);
|
|
113
|
+
};
|
|
114
|
+
o.install = U;
|
|
115
|
+
const et = o;
|
|
116
|
+
export {
|
|
117
|
+
et as SuggestionPillButton,
|
|
118
|
+
d as default
|
|
119
|
+
};
|