@opentiny/tiny-robot 0.2.0 → 0.3.0-alpha.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/action-group/index.js +5 -5
- package/dist/attachments/index.js +602 -0
- package/dist/bubble/index.js +1 -1
- package/dist/container/index.js +10 -10
- package/dist/dropdown-menu/index.js +8 -8
- package/dist/feedback/index.js +20 -20
- package/dist/flow-layout-buttons/index.js +27 -27
- package/dist/history/index.js +46 -46
- package/dist/index.d.ts +220 -85
- package/dist/index.js +50 -46
- package/dist/index2.js +397 -330
- package/dist/question/index.js +64 -64
- package/dist/sender/index.js +906 -844
- package/dist/style.css +1 -1
- package/dist/suggestion/index.js +62 -62
- package/dist/suggestion-pills/index.js +32 -32
- package/dist/suggestion-popover/index.js +2 -2
- package/dist/tiny-robot-svgs.js +500 -174
- 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 Q, ref as p, computed as L, watch as K, watchEffect as ne, onMounted as Y, onBeforeUnmount as Z, createElementBlock as v, openBlock as g, normalizeClass as U, 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 H, normalizeStyle as ae, resolveComponent as ce, withCtx as O } from "vue";
|
|
2
|
+
import { Q as J, o as F, T as re, H as ue, B 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
|
|
9
|
+
const j = /* @__PURE__ */ new Map();
|
|
10
10
|
function X(l, c = "") {
|
|
11
11
|
const s = `${l}::${c}`;
|
|
12
|
-
if (
|
|
13
|
-
return
|
|
12
|
+
if (j.has(s))
|
|
13
|
+
return j.get(s);
|
|
14
14
|
const o = de(l, c);
|
|
15
|
-
return
|
|
15
|
+
return j.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" }, $e = { class: "tr-common-suggestions_item_text" }, xe = /* @__PURE__ */
|
|
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__ */ Q({
|
|
18
18
|
__name: "SuggestionCapsule",
|
|
19
19
|
props: {
|
|
20
20
|
suggestions: {
|
|
@@ -28,7 +28,7 @@ const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-
|
|
|
28
28
|
},
|
|
29
29
|
emits: ["suggestion-click", "show-expand-button"],
|
|
30
30
|
setup(l, { emit: c }) {
|
|
31
|
-
const s = l, o = c, n = p(null), f = p(!1), t = p(!1), m = p([]), a = p([]), h = p(0), S = p(null), R =
|
|
31
|
+
const s = l, o = c, n = p(null), f = p(!1), t = p(!1), m = p([]), a = p([]), h = p(0), S = p(null), R = L(() => {
|
|
32
32
|
if (h.value <= 0 || a.value.length === 0) return [];
|
|
33
33
|
const i = [], d = [...a.value];
|
|
34
34
|
for (; d.length > 0; )
|
|
@@ -52,14 +52,14 @@ const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-
|
|
|
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], V = X(I.text, "tr-common-suggestions_item") + _;
|
|
56
|
+
r + V <= d ? (r += V, 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 K(
|
|
63
63
|
() => s.isExpanded,
|
|
64
64
|
(i) => {
|
|
65
65
|
t.value = i;
|
|
@@ -73,7 +73,7 @@ const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-
|
|
|
73
73
|
}), Z(() => {
|
|
74
74
|
S.value && S.value.disconnect();
|
|
75
75
|
}), (i, d) => (g(), v("div", {
|
|
76
|
-
class:
|
|
76
|
+
class: U(["tr-common-suggestions", { expanded: t.value }]),
|
|
77
77
|
ref_key: "capsuleRef",
|
|
78
78
|
ref: n
|
|
79
79
|
}, [
|
|
@@ -90,7 +90,7 @@ const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-
|
|
|
90
90
|
onClick: (q) => y(k)
|
|
91
91
|
}, [
|
|
92
92
|
u("div", fe, [
|
|
93
|
-
E(w(
|
|
93
|
+
E(w(J))
|
|
94
94
|
]),
|
|
95
95
|
u("div", ye, T(k.text), 1)
|
|
96
96
|
], 8, he))), 128))
|
|
@@ -106,7 +106,7 @@ const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-
|
|
|
106
106
|
onClick: (k) => y(r)
|
|
107
107
|
}, [
|
|
108
108
|
u("div", Ce, [
|
|
109
|
-
E(w(
|
|
109
|
+
E(w(J))
|
|
110
110
|
]),
|
|
111
111
|
u("div", $e, T(r.text), 1)
|
|
112
112
|
], 8, ke))), 128))
|
|
@@ -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__ */ Q({
|
|
121
121
|
__name: "CategoryNav",
|
|
122
122
|
props: {
|
|
123
123
|
categories: {
|
|
@@ -137,7 +137,7 @@ const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-
|
|
|
137
137
|
return (n, f) => (g(), v("div", be, [
|
|
138
138
|
(g(!0), v(z, null, M(l.categories, (t) => (g(), v("div", {
|
|
139
139
|
key: t.id,
|
|
140
|
-
class:
|
|
140
|
+
class: U(["tr-suggestion-categories-item", { active: l.activeCategory === t.id }]),
|
|
141
141
|
onClick: (m) => o(t.id)
|
|
142
142
|
}, [
|
|
143
143
|
$(n.$slots, "category-label", { category: t }, () => [
|
|
@@ -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
|
+
K(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" }, Ve = { class: "close-icon" }, We = {
|
|
193
193
|
key: 0,
|
|
194
194
|
class: "tr-suggestion-loading"
|
|
195
|
-
},
|
|
195
|
+
}, Ae = { key: 1 }, Ke = ["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
|
-
},
|
|
201
|
+
}, He = /* @__PURE__ */ Q({
|
|
202
202
|
__name: "SuggestionPanel",
|
|
203
203
|
props: {
|
|
204
204
|
items: {
|
|
@@ -228,7 +228,7 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
228
228
|
initialIndex: 0,
|
|
229
229
|
onClose: () => n("close"),
|
|
230
230
|
onSelect: (i) => n("select", i)
|
|
231
|
-
}), a = p(o.categories.length > 0 ? o.categories[0].id : ""), h =
|
|
231
|
+
}), a = p(o.categories.length > 0 ? o.categories[0].id : ""), h = L(() => {
|
|
232
232
|
if (o.categories.length === 0 || !a.value)
|
|
233
233
|
return o.items;
|
|
234
234
|
const i = o.categories.find((d) => d.id === a.value);
|
|
@@ -251,7 +251,7 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
251
251
|
u("div", De, [
|
|
252
252
|
u("div", Oe, [
|
|
253
253
|
$(i.$slots, "title-icon", {}, () => [
|
|
254
|
-
E(w(
|
|
254
|
+
E(w(F), { style: { color: "#1476ff", "font-size": "24px" } })
|
|
255
255
|
])
|
|
256
256
|
]),
|
|
257
257
|
u("div", Re, T(l.title), 1)
|
|
@@ -260,12 +260,12 @@ 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", Ve, [
|
|
264
264
|
E(w(re))
|
|
265
265
|
])
|
|
266
266
|
])
|
|
267
267
|
]),
|
|
268
|
-
l.categories.length > 0 ? (g(),
|
|
268
|
+
l.categories.length > 0 ? (g(), H(Ie, {
|
|
269
269
|
key: 0,
|
|
270
270
|
categories: l.categories,
|
|
271
271
|
"active-category": a.value,
|
|
@@ -275,14 +275,14 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
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",
|
|
278
|
+
l.loading ? (g(), v("div", We, [
|
|
279
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",
|
|
282
|
+
])) : h.value.length > 0 ? (g(), v("ul", Ae, [
|
|
283
283
|
(g(!0), v(z, null, M(h.value, (r, _) => (g(), v("li", {
|
|
284
284
|
key: r.id,
|
|
285
|
-
class:
|
|
285
|
+
class: U(["tr-suggestion-list-item", { "tr-suggestion-item-active": _ === w(m) }]),
|
|
286
286
|
onClick: (k) => R(r),
|
|
287
287
|
onMouseenter: (k) => y(_)
|
|
288
288
|
}, [
|
|
@@ -295,7 +295,7 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
295
295
|
r.description ? (g(), v("div", Ne, T(r.description), 1)) : N("", !0)
|
|
296
296
|
])
|
|
297
297
|
])
|
|
298
|
-
], 42,
|
|
298
|
+
], 42, Ke))), 128))
|
|
299
299
|
])) : (g(), v("div", qe, [
|
|
300
300
|
$(i.$slots, "empty", {}, () => [
|
|
301
301
|
d[1] || (d[1] = u("p", null, "无匹配结果", -1))
|
|
@@ -304,7 +304,7 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
304
304
|
], 4)
|
|
305
305
|
]));
|
|
306
306
|
}
|
|
307
|
-
}),
|
|
307
|
+
}), Le = (l) => {
|
|
308
308
|
const c = (o) => l.triggerKeys.includes(o);
|
|
309
309
|
return {
|
|
310
310
|
isTriggerKey: c,
|
|
@@ -317,7 +317,7 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
317
317
|
} : null;
|
|
318
318
|
}
|
|
319
319
|
};
|
|
320
|
-
},
|
|
320
|
+
}, Pe = { class: "tr-suggestion__header" }, P = /* @__PURE__ */ Q({
|
|
321
321
|
__name: "index",
|
|
322
322
|
props: {
|
|
323
323
|
triggerKeys: { default: () => ["/"] },
|
|
@@ -341,17 +341,17 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
341
341
|
a.value = !a.value, n("update:expanded", a.value);
|
|
342
342
|
}, R = (e) => {
|
|
343
343
|
h.value = e;
|
|
344
|
-
}, b = p(""), y = p(-1), i = p(null), d = p(null), r =
|
|
344
|
+
}, b = p(""), y = p(-1), i = p(null), d = p(null), r = L(() => o.open !== void 0 ? o.open : f.value), _ = L(() => {
|
|
345
345
|
if (o.categories.length === 0 || !b.value)
|
|
346
346
|
return t.value;
|
|
347
347
|
const e = o.categories.find((x) => x.id === b.value);
|
|
348
348
|
return e ? e.items : [];
|
|
349
349
|
});
|
|
350
|
-
|
|
350
|
+
K(r, (e) => {
|
|
351
351
|
e ? y.value = _.value.length > 0 ? 0 : -1 : y.value = -1;
|
|
352
|
-
}),
|
|
352
|
+
}), K(_, (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
|
+
}), K(
|
|
355
355
|
() => o.categories,
|
|
356
356
|
(e) => {
|
|
357
357
|
e.length > 0 && !b.value && (b.value = e[0].id);
|
|
@@ -360,57 +360,57 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
360
360
|
);
|
|
361
361
|
const k = () => {
|
|
362
362
|
t.value = [...o.items];
|
|
363
|
-
}, { detectTrigger: B } =
|
|
363
|
+
}, { detectTrigger: B } = Le(o), q = (e) => {
|
|
364
364
|
n("suggestion-select", e), n("select", e.value, {
|
|
365
365
|
text: "",
|
|
366
366
|
position: 0
|
|
367
367
|
}), e.template && n("fill-template", e.template);
|
|
368
368
|
}, C = (e) => {
|
|
369
|
-
e === !1 ?
|
|
369
|
+
e === !1 ? W() : (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
373
|
}, I = (e, x) => {
|
|
374
|
-
const
|
|
375
|
-
return
|
|
376
|
-
},
|
|
374
|
+
const A = B(e, x);
|
|
375
|
+
return A ? (m.value = A, C(A), !0) : r.value && x === "" ? (C(!1), !0) : !1;
|
|
376
|
+
}, V = (e) => {
|
|
377
377
|
if (r.value && d.value) {
|
|
378
378
|
d.value.handleKeyDown(e);
|
|
379
379
|
return;
|
|
380
380
|
}
|
|
381
|
-
},
|
|
381
|
+
}, W = () => {
|
|
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
385
|
}, te = (e, x) => {
|
|
386
|
-
n("select", e.text, x), e.template && n("fill-template", e.template),
|
|
387
|
-
},
|
|
388
|
-
o.closeOnOutsideClick && r.value && i.value && !i.value.contains(e.target) &&
|
|
386
|
+
n("select", e.text, x), e.template && n("fill-template", e.template), W();
|
|
387
|
+
}, G = (e) => {
|
|
388
|
+
o.closeOnOutsideClick && r.value && i.value && !i.value.contains(e.target) && W();
|
|
389
389
|
}, se = () => {
|
|
390
|
-
r.value ?
|
|
390
|
+
r.value ? W() : (k(), f.value = !0, n("update:open", !0));
|
|
391
391
|
};
|
|
392
392
|
return Y(() => {
|
|
393
|
-
o.closeOnOutsideClick && document.addEventListener("click",
|
|
393
|
+
o.closeOnOutsideClick && document.addEventListener("click", G);
|
|
394
394
|
}), Z(() => {
|
|
395
|
-
o.closeOnOutsideClick && document.removeEventListener("click",
|
|
395
|
+
o.closeOnOutsideClick && document.removeEventListener("click", G);
|
|
396
396
|
}), c({
|
|
397
397
|
trigger: C,
|
|
398
|
-
keyDown:
|
|
398
|
+
keyDown: V,
|
|
399
399
|
input: I,
|
|
400
400
|
toggleExpand: S
|
|
401
401
|
}), (e, x) => {
|
|
402
|
-
const
|
|
402
|
+
const A = ce("IconEdit");
|
|
403
403
|
return g(), v("div", {
|
|
404
404
|
ref_key: "rootRef",
|
|
405
405
|
ref: i,
|
|
406
|
-
class:
|
|
406
|
+
class: U(["tr-suggestion", e.className, { "tr-suggestion--dark": e.theme === "dark" }])
|
|
407
407
|
}, [
|
|
408
|
-
u("div",
|
|
408
|
+
u("div", Pe, [
|
|
409
409
|
u("div", {
|
|
410
410
|
class: "tr-suggestion__trigger",
|
|
411
411
|
onClick: se
|
|
412
412
|
}, [
|
|
413
|
-
E(w(
|
|
413
|
+
E(w(F), { style: { color: "#1476ff" } })
|
|
414
414
|
]),
|
|
415
415
|
E(xe, {
|
|
416
416
|
suggestions: e.items,
|
|
@@ -422,7 +422,7 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
422
422
|
$(e.$slots, "capsule-icon", {
|
|
423
423
|
suggestion: D.suggestion
|
|
424
424
|
}, () => [
|
|
425
|
-
E(
|
|
425
|
+
E(A)
|
|
426
426
|
])
|
|
427
427
|
]),
|
|
428
428
|
_: 3
|
|
@@ -432,15 +432,15 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
432
432
|
class: "tr-suggestion__expand-button",
|
|
433
433
|
onClick: S
|
|
434
434
|
}, [
|
|
435
|
-
a.value ? (g(),
|
|
435
|
+
a.value ? (g(), H(w(ge), { key: 1 })) : (g(), H(w(ue), { key: 0 }))
|
|
436
436
|
])) : N("", !0)
|
|
437
437
|
]),
|
|
438
438
|
$(e.$slots, "trigger", {
|
|
439
439
|
onTrigger: C,
|
|
440
|
-
onKeyDown:
|
|
440
|
+
onKeyDown: V,
|
|
441
441
|
onInput: I
|
|
442
442
|
}),
|
|
443
|
-
r.value ? (g(),
|
|
443
|
+
r.value ? (g(), H(He, {
|
|
444
444
|
key: 0,
|
|
445
445
|
ref_key: "panelRef",
|
|
446
446
|
ref: d,
|
|
@@ -451,13 +451,13 @@ 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: W,
|
|
455
455
|
onSelect: te,
|
|
456
456
|
onCategorySelect: ee
|
|
457
457
|
}, {
|
|
458
458
|
"title-icon": O(() => [
|
|
459
459
|
$(e.$slots, "title-icon", {}, () => [
|
|
460
|
-
E(w(
|
|
460
|
+
E(w(F), { style: { "font-size": "24px", color: "#1476ff" } })
|
|
461
461
|
])
|
|
462
462
|
]),
|
|
463
463
|
"category-label": O((D) => [
|
|
@@ -487,11 +487,11 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
|
|
|
487
487
|
};
|
|
488
488
|
}
|
|
489
489
|
});
|
|
490
|
-
|
|
491
|
-
const
|
|
492
|
-
l.component(
|
|
490
|
+
P.name = "TrSuggestion";
|
|
491
|
+
const Qe = function(l) {
|
|
492
|
+
l.component(P.name, P);
|
|
493
493
|
};
|
|
494
|
-
|
|
494
|
+
P.install = Qe;
|
|
495
495
|
export {
|
|
496
|
-
|
|
496
|
+
P as default
|
|
497
497
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { defineComponent as A, useSlots as L, computed as f, createElementBlock as d, openBlock as n, normalizeClass as R, renderSlot as I, createBlock as c, resolveDynamicComponent as N, createCommentVNode as S, toDisplayString as F, unref as g, mergeProps as T, createSlots as j, withCtx as w, createVNode as $, renderList as P, mergeModels as D, useCssVars as q, ref as V, useModel as J, watch as K, createElementVNode as W, Fragment as E, Transition as O, nextTick as Q } from "vue";
|
|
2
|
+
import { H as U, B as X } from "../tiny-robot-svgs.js";
|
|
3
|
+
import { c as Y, w as Z } from "../index2.js";
|
|
4
4
|
import x from "../dropdown-menu/index.js";
|
|
5
5
|
import ee from "../suggestion-popover/index.js";
|
|
6
|
-
import { _ as
|
|
7
|
-
const te = { key: 0 }, ne = /* @__PURE__ */
|
|
6
|
+
import { _ as z } from "../_plugin-vue_export-helper.js";
|
|
7
|
+
const te = { key: 0 }, ne = /* @__PURE__ */ A({
|
|
8
8
|
__name: "PillButton",
|
|
9
9
|
props: {
|
|
10
10
|
item: {}
|
|
@@ -20,21 +20,21 @@ const te = { key: 0 }, ne = /* @__PURE__ */ b({
|
|
|
20
20
|
return (t, u) => (n(), d("button", {
|
|
21
21
|
class: R(["tr-suggestion-pills__item", { "only-icon": p.value }])
|
|
22
22
|
}, [
|
|
23
|
-
|
|
23
|
+
I(t.$slots, "icon", {}, () => {
|
|
24
24
|
var o;
|
|
25
25
|
return [
|
|
26
|
-
(n(), c(
|
|
26
|
+
(n(), c(N((o = t.item) == null ? void 0 : o.icon), { class: "tr-suggestion-pills__item_icon" }))
|
|
27
27
|
];
|
|
28
28
|
}, !0),
|
|
29
|
-
|
|
29
|
+
I(t.$slots, "default", {}, () => {
|
|
30
30
|
var o;
|
|
31
31
|
return [
|
|
32
|
-
(o = t.item) != null && o.text ? (n(), d("span", te,
|
|
32
|
+
(o = t.item) != null && o.text ? (n(), d("span", te, F(t.item.text), 1)) : S("", !0)
|
|
33
33
|
];
|
|
34
34
|
}, !0)
|
|
35
35
|
], 2));
|
|
36
36
|
}
|
|
37
|
-
}), m = /* @__PURE__ */
|
|
37
|
+
}), m = /* @__PURE__ */ z(ne, [["__scopeId", "data-v-5c113fe1"]]), H = /* @__PURE__ */ A({
|
|
38
38
|
__name: "PillButtonWrapper",
|
|
39
39
|
props: {
|
|
40
40
|
item: {}
|
|
@@ -48,7 +48,7 @@ const te = { key: 0 }, ne = /* @__PURE__ */ b({
|
|
|
48
48
|
onItemClick: (t = e.item.action.events) == null ? void 0 : t.itemClick,
|
|
49
49
|
onGroupClick: (u = e.item.action.events) == null ? void 0 : u.groupClick,
|
|
50
50
|
onClose: (o = e.item.action.events) == null ? void 0 : o.close
|
|
51
|
-
}),
|
|
51
|
+
}), j({
|
|
52
52
|
default: w(() => [
|
|
53
53
|
$(m, {
|
|
54
54
|
item: e.item,
|
|
@@ -60,7 +60,7 @@ const te = { key: 0 }, ne = /* @__PURE__ */ b({
|
|
|
60
60
|
P(e.item.action.slots, (v, C) => ({
|
|
61
61
|
name: C,
|
|
62
62
|
fn: w(() => [
|
|
63
|
-
(n(), c(
|
|
63
|
+
(n(), c(N(v)))
|
|
64
64
|
])
|
|
65
65
|
}))
|
|
66
66
|
]), 1040, ["onItemClick", "onGroupClick", "onClose"])) : ((h = e.item.action) == null ? void 0 : h.type) === "menu" ? (n(), c(g(x), T({ key: 1 }, e.item.action.props, {
|
|
@@ -83,7 +83,7 @@ const te = { key: 0 }, ne = /* @__PURE__ */ b({
|
|
|
83
83
|
}), oe = { class: "tr-suggestion-pills__wrapper" }, ie = { class: "tr-suggestion-pills__more-wrapper" }, le = {
|
|
84
84
|
key: 0,
|
|
85
85
|
class: "tr-suggestion-pills__more"
|
|
86
|
-
}, se = /* @__PURE__ */
|
|
86
|
+
}, se = /* @__PURE__ */ A({
|
|
87
87
|
__name: "index",
|
|
88
88
|
props: /* @__PURE__ */ D({
|
|
89
89
|
items: {},
|
|
@@ -94,11 +94,11 @@ const te = { key: 0 }, ne = /* @__PURE__ */ b({
|
|
|
94
94
|
}),
|
|
95
95
|
emits: /* @__PURE__ */ D(["item-click"], ["update:showAll"]),
|
|
96
96
|
setup(a, { emit: k }) {
|
|
97
|
-
|
|
97
|
+
q((l) => ({
|
|
98
98
|
"8cd74b6e": v.value
|
|
99
99
|
}));
|
|
100
|
-
const s = a, e = k, i = V(null), { width: p } = Y(i), t = V(-1), u = f(() => t.value !== -1), o =
|
|
101
|
-
|
|
100
|
+
const s = a, e = k, i = V(null), { width: p } = Y(i), t = V(-1), u = f(() => t.value !== -1), o = J(a, "showAll"), h = f(() => !u.value || !o.value ? s.items || [] : (s.items || []).slice(0, t.value)), _ = f(() => !u.value || !o.value ? [] : (s.items || []).slice(t.value)), v = f(() => p.value < i.value.scrollWidth ? "linear-gradient(to right, black 90%, transparent)" : "unset"), C = () => {
|
|
101
|
+
Q(() => {
|
|
102
102
|
const l = i.value;
|
|
103
103
|
if (!l)
|
|
104
104
|
return;
|
|
@@ -106,7 +106,7 @@ const te = { key: 0 }, ne = /* @__PURE__ */ b({
|
|
|
106
106
|
t.value = y.findIndex((r) => r.offsetLeft + r.offsetWidth > l.clientWidth);
|
|
107
107
|
});
|
|
108
108
|
};
|
|
109
|
-
|
|
109
|
+
K(() => {
|
|
110
110
|
var l;
|
|
111
111
|
return [s.items, (l = s.items) == null ? void 0 : l.length];
|
|
112
112
|
}, C), Z(
|
|
@@ -116,13 +116,13 @@ const te = { key: 0 }, ne = /* @__PURE__ */ b({
|
|
|
116
116
|
},
|
|
117
117
|
{ debounce: 100 }
|
|
118
118
|
);
|
|
119
|
-
const
|
|
119
|
+
const G = (l, y) => {
|
|
120
120
|
if (u.value && y >= t.value) {
|
|
121
|
-
|
|
121
|
+
b();
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
124
|
e("item-click", l);
|
|
125
|
-
},
|
|
125
|
+
}, b = () => {
|
|
126
126
|
o.value = !o.value;
|
|
127
127
|
};
|
|
128
128
|
return (l, y) => (n(), d("div", oe, [
|
|
@@ -131,19 +131,19 @@ const te = { key: 0 }, ne = /* @__PURE__ */ b({
|
|
|
131
131
|
ref_key: "containerRef",
|
|
132
132
|
ref: i
|
|
133
133
|
}, [
|
|
134
|
-
|
|
135
|
-
(n(!0), d(E, null, P(h.value, (r, M) => (n(), c(g(
|
|
134
|
+
I(l.$slots, "default", {}, () => [
|
|
135
|
+
(n(!0), d(E, null, P(h.value, (r, M) => (n(), c(g(H), {
|
|
136
136
|
key: r.id,
|
|
137
137
|
item: r,
|
|
138
|
-
onClick: (ce) =>
|
|
138
|
+
onClick: (ce) => G(r, M)
|
|
139
139
|
}, null, 8, ["item", "onClick"]))), 128))
|
|
140
140
|
], !0)
|
|
141
141
|
], 512),
|
|
142
142
|
W("div", ie, [
|
|
143
|
-
$(
|
|
143
|
+
$(O, { name: "tr-suggestion-pills__more" }, {
|
|
144
144
|
default: w(() => [
|
|
145
145
|
_.value.length ? (n(), d("div", le, [
|
|
146
|
-
(n(!0), d(E, null, P(_.value, (r) => (n(), c(g(
|
|
146
|
+
(n(!0), d(E, null, P(_.value, (r) => (n(), c(g(H), {
|
|
147
147
|
key: r.id,
|
|
148
148
|
item: r,
|
|
149
149
|
onClick: (M) => e("item-click", r)
|
|
@@ -156,18 +156,18 @@ const te = { key: 0 }, ne = /* @__PURE__ */ b({
|
|
|
156
156
|
u.value ? (n(), d("button", {
|
|
157
157
|
key: 0,
|
|
158
158
|
class: "tr-suggestion-pills__expand",
|
|
159
|
-
onClick:
|
|
159
|
+
onClick: b
|
|
160
160
|
}, [
|
|
161
|
-
o.value ? (n(), c(g(X), { key: 1 })) : (n(), c(g(
|
|
161
|
+
o.value ? (n(), c(g(X), { key: 1 })) : (n(), c(g(U), { key: 0 }))
|
|
162
162
|
])) : S("", !0)
|
|
163
163
|
]));
|
|
164
164
|
}
|
|
165
|
-
}),
|
|
166
|
-
|
|
165
|
+
}), B = /* @__PURE__ */ z(se, [["__scopeId", "data-v-e03676ad"]]);
|
|
166
|
+
B.name = "TrSuggestionPills";
|
|
167
167
|
const re = function(a) {
|
|
168
|
-
a.component(
|
|
168
|
+
a.component(B.name, B);
|
|
169
169
|
};
|
|
170
|
-
|
|
170
|
+
B.install = re;
|
|
171
171
|
m.name = "TrSuggestionPillButton";
|
|
172
172
|
const ae = function(a) {
|
|
173
173
|
a.component(m.name, m);
|
|
@@ -176,5 +176,5 @@ m.install = ae;
|
|
|
176
176
|
const ve = m;
|
|
177
177
|
export {
|
|
178
178
|
ve as SuggestionPillButton,
|
|
179
|
-
|
|
179
|
+
B as default
|
|
180
180
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as m, mergeModels as a, useCssVars as b, unref as B, ref as E, computed as C, useModel as z, watch as V, createElementBlock as w, openBlock as D, Fragment as c, createElementVNode as o, createCommentVNode as k, createVNode as I, renderSlot as s, Transition as W, withCtx as x, normalizeStyle as M, createBlock as J, resolveDynamicComponent as S, toDisplayString as d, renderList as L, createTextVNode as Z } from "vue";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { o as K, T as N } from "../tiny-robot-svgs.js";
|
|
3
|
+
import { e as _, d as $, o as AA } from "../index2.js";
|
|
4
4
|
import gA from "../flow-layout-buttons/index.js";
|
|
5
5
|
import fA from "../icon-button/index.js";
|
|
6
6
|
import { t } from "../utils.js";
|