@opentiny/tiny-robot 0.3.0-alpha.4 → 0.3.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 +5 -5
- package/dist/base-popper/index.js +121 -2
- package/dist/close.js +1 -1
- package/dist/dropdown-menu/index.js +43 -43
- package/dist/feedback/index.js +1 -1
- package/dist/flow-layout-buttons/index.js +8 -8
- package/dist/history/index.js +2 -2
- package/dist/index.d.ts +103 -49
- package/dist/index2.js +6 -7
- package/dist/index3.js +306 -137
- package/dist/index4.js +591 -269
- package/dist/index5.js +2047 -528
- package/dist/index6.js +4665 -2072
- package/dist/question/index.js +1 -1
- package/dist/sender/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +186 -103
- package/dist/suggestion-popover/index.js +192 -216
- package/package.json +3 -3
- package/dist/index7.js +0 -4749
- package/dist/useSlotRefs.js +0 -36
|
@@ -1,41 +1,103 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { K as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
import { defineComponent as H, useSlots as Z, computed as w, createElementBlock as k, openBlock as u, normalizeClass as P, renderSlot as b, createBlock as h, resolveDynamicComponent as j, createCommentVNode as R, toDisplayString as x, unref as _, mergeProps as E, createSlots as ee, withCtx as A, createVNode as W, renderList as $, normalizeStyle as te, mergeModels as F, useModel as oe, ref as S, watch as G, nextTick as V, createElementVNode as z, Fragment as N, Transition as ne } from "vue";
|
|
2
|
+
import { K as le } from "../tiny-robot-svgs.js";
|
|
3
|
+
import { b as se, w as ie, o as re } from "../index2.js";
|
|
4
|
+
import ae from "../dropdown-menu/index.js";
|
|
5
|
+
import ue from "../suggestion-popover/index.js";
|
|
6
|
+
import { _ as q } from "../_plugin-vue_export-helper.js";
|
|
7
|
+
const ce = { key: 0 }, me = /* @__PURE__ */ H({
|
|
7
8
|
__name: "PillButton",
|
|
8
9
|
props: {
|
|
9
10
|
item: {}
|
|
10
11
|
},
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
13
|
-
var
|
|
14
|
-
return !!(
|
|
15
|
-
}),
|
|
16
|
-
var
|
|
17
|
-
return !!(
|
|
18
|
-
}),
|
|
19
|
-
return (
|
|
20
|
-
class:
|
|
12
|
+
setup(p) {
|
|
13
|
+
const y = p, n = Z(), t = w(() => {
|
|
14
|
+
var o;
|
|
15
|
+
return !!(n.icon || (o = y.item) != null && o.icon);
|
|
16
|
+
}), l = w(() => {
|
|
17
|
+
var o;
|
|
18
|
+
return !!(n.default || (o = y.item) != null && o.text);
|
|
19
|
+
}), v = w(() => t.value && !l.value);
|
|
20
|
+
return (o, C) => (u(), k("button", {
|
|
21
|
+
class: P(["tr-suggestion-pills__item", { "only-icon": v.value }])
|
|
21
22
|
}, [
|
|
22
|
-
|
|
23
|
+
b(o.$slots, "icon", {}, () => {
|
|
23
24
|
var c;
|
|
24
25
|
return [
|
|
25
|
-
(
|
|
26
|
+
(u(), h(j((c = o.item) == null ? void 0 : c.icon), { class: "tr-suggestion-pills__item_icon" }))
|
|
26
27
|
];
|
|
27
28
|
}, !0),
|
|
28
|
-
|
|
29
|
+
b(o.$slots, "default", {}, () => {
|
|
29
30
|
var c;
|
|
30
31
|
return [
|
|
31
|
-
(c =
|
|
32
|
+
(c = o.item) != null && c.text ? (u(), k("span", ce, x(o.item.text), 1)) : R("", !0)
|
|
32
33
|
];
|
|
33
34
|
}, !0)
|
|
34
35
|
], 2));
|
|
35
36
|
}
|
|
36
|
-
}),
|
|
37
|
+
}), f = /* @__PURE__ */ q(me, [["__scopeId", "data-v-5c433c31"]]), K = /* @__PURE__ */ H({
|
|
38
|
+
__name: "PillButtonWrapper",
|
|
39
|
+
props: {
|
|
40
|
+
item: {},
|
|
41
|
+
style: {}
|
|
42
|
+
},
|
|
43
|
+
emits: ["click", "mouseenter"],
|
|
44
|
+
setup(p, { emit: y }) {
|
|
45
|
+
const n = y;
|
|
46
|
+
return (t, l) => {
|
|
47
|
+
var v, o, C, c, B, g, d, M, I;
|
|
48
|
+
return ((v = t.item.action) == null ? void 0 : v.type) === "popover" ? (u(), h(_(ue), E({
|
|
49
|
+
key: 0,
|
|
50
|
+
style: t.style
|
|
51
|
+
}, t.item.action.props, {
|
|
52
|
+
onItemClick: (o = t.item.action.events) == null ? void 0 : o.itemClick,
|
|
53
|
+
onGroupClick: (C = t.item.action.events) == null ? void 0 : C.groupClick,
|
|
54
|
+
onOpen: (c = t.item.action.events) == null ? void 0 : c.open,
|
|
55
|
+
onClose: (B = t.item.action.events) == null ? void 0 : B.close,
|
|
56
|
+
onClickOutside: (g = t.item.action.events) == null ? void 0 : g.clickOutside
|
|
57
|
+
}), ee({
|
|
58
|
+
default: A(() => [
|
|
59
|
+
W(f, {
|
|
60
|
+
item: t.item,
|
|
61
|
+
onClick: l[0] || (l[0] = (r) => n("click", r)),
|
|
62
|
+
onMouseenter: l[1] || (l[1] = (r) => n("mouseenter", r))
|
|
63
|
+
}, null, 8, ["item"])
|
|
64
|
+
]),
|
|
65
|
+
_: 2
|
|
66
|
+
}, [
|
|
67
|
+
$(t.item.action.slots, (r, O) => ({
|
|
68
|
+
name: O,
|
|
69
|
+
fn: A(() => [
|
|
70
|
+
(u(), h(j(r)))
|
|
71
|
+
])
|
|
72
|
+
}))
|
|
73
|
+
]), 1040, ["style", "onItemClick", "onGroupClick", "onOpen", "onClose", "onClickOutside"])) : ((d = t.item.action) == null ? void 0 : d.type) === "menu" ? (u(), h(_(ae), E({
|
|
74
|
+
key: 1,
|
|
75
|
+
style: t.style
|
|
76
|
+
}, t.item.action.props, {
|
|
77
|
+
onItemClick: (M = t.item.action.events) == null ? void 0 : M.itemClick,
|
|
78
|
+
onClickOutside: (I = t.item.action.events) == null ? void 0 : I.clickOutside
|
|
79
|
+
}), {
|
|
80
|
+
trigger: A(() => [
|
|
81
|
+
W(f, {
|
|
82
|
+
item: t.item,
|
|
83
|
+
onClick: l[2] || (l[2] = (r) => n("click", r)),
|
|
84
|
+
onMouseenter: l[3] || (l[3] = (r) => n("mouseenter", r))
|
|
85
|
+
}, null, 8, ["item"])
|
|
86
|
+
]),
|
|
87
|
+
_: 1
|
|
88
|
+
}, 16, ["style", "onItemClick", "onClickOutside"])) : (u(), h(f, {
|
|
89
|
+
key: 2,
|
|
90
|
+
item: t.item,
|
|
91
|
+
style: te(t.style),
|
|
92
|
+
onClick: l[4] || (l[4] = (r) => n("click", r)),
|
|
93
|
+
onMouseenter: l[5] || (l[5] = (r) => n("mouseenter", r))
|
|
94
|
+
}, null, 8, ["item", "style"]));
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}), pe = { class: "tr-suggestion-pills__more-wrapper" }, de = /* @__PURE__ */ H({
|
|
37
98
|
__name: "index",
|
|
38
|
-
props: /* @__PURE__ */
|
|
99
|
+
props: /* @__PURE__ */ F({
|
|
100
|
+
items: {},
|
|
39
101
|
showAll: { type: Boolean },
|
|
40
102
|
showAllButtonOn: { default: "hover" },
|
|
41
103
|
overflowMode: { default: "expand" },
|
|
@@ -44,125 +106,146 @@ const me = { key: 0 }, pe = /* @__PURE__ */ q({
|
|
|
44
106
|
showAll: { type: Boolean, default: !1 },
|
|
45
107
|
showAllModifiers: {}
|
|
46
108
|
}),
|
|
47
|
-
emits: /* @__PURE__ */
|
|
48
|
-
setup(
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
return
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
|
|
109
|
+
emits: /* @__PURE__ */ F(["item-click", "click-outside"], ["update:showAll"]),
|
|
110
|
+
setup(p, { emit: y }) {
|
|
111
|
+
const n = p, t = y, l = oe(p, "showAll"), v = S(null), o = S(null), C = S(null), { width: c } = se(o), B = S(0), g = w(() => n.overflowMode === "expand" && c.value < B.value), d = S(-1), M = w(() => {
|
|
112
|
+
var e;
|
|
113
|
+
return g.value && l.value ? ((e = n.items) == null ? void 0 : e.slice(0, d.value)) || [] : n.items || [];
|
|
114
|
+
}), I = w(() => {
|
|
115
|
+
var e;
|
|
116
|
+
return g.value && l.value ? ((e = n.items) == null ? void 0 : e.slice(d.value)) || [] : [];
|
|
117
|
+
}), r = () => {
|
|
118
|
+
const e = o.value, s = C.value;
|
|
119
|
+
return Array.from((e == null ? void 0 : e.children) || []).concat(Array.from((s == null ? void 0 : s.children) || []));
|
|
120
|
+
}, O = () => {
|
|
121
|
+
V(() => {
|
|
122
|
+
const e = o.value;
|
|
58
123
|
if (!e)
|
|
59
124
|
return;
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
let
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
v.value = s;
|
|
125
|
+
const s = r(), i = parseFloat(getComputedStyle(e).rowGap) || 0;
|
|
126
|
+
let m = 0;
|
|
127
|
+
for (let a = 0; a < s.length; a++) {
|
|
128
|
+
if (m += s[a].offsetWidth, a > 0 && (m += i), m > e.clientWidth) {
|
|
129
|
+
d.value = a;
|
|
66
130
|
break;
|
|
67
131
|
}
|
|
132
|
+
a === s.length - 1 && (d.value = -1);
|
|
133
|
+
}
|
|
68
134
|
});
|
|
69
135
|
};
|
|
70
|
-
|
|
71
|
-
|
|
136
|
+
G(
|
|
137
|
+
() => {
|
|
138
|
+
var e;
|
|
139
|
+
return [n.items, (e = n.items) == null ? void 0 : e.length];
|
|
140
|
+
},
|
|
72
141
|
() => {
|
|
73
|
-
|
|
74
|
-
if (!
|
|
142
|
+
V(() => {
|
|
143
|
+
if (!o.value)
|
|
75
144
|
return;
|
|
76
|
-
const e =
|
|
77
|
-
|
|
145
|
+
const e = r(), s = parseFloat(getComputedStyle(o.value).rowGap) || 0;
|
|
146
|
+
B.value = e.reduce((i, m, a) => i + m.offsetWidth + (a > 0 ? s : 0), 0);
|
|
78
147
|
});
|
|
79
148
|
},
|
|
80
149
|
{ immediate: !0 }
|
|
81
|
-
),
|
|
82
|
-
|
|
83
|
-
|
|
150
|
+
), G(() => {
|
|
151
|
+
var e;
|
|
152
|
+
return [n.items, (e = n.items) == null ? void 0 : e.length];
|
|
153
|
+
}, O), ie(
|
|
154
|
+
c,
|
|
155
|
+
(e) => {
|
|
156
|
+
e > 0 && O();
|
|
157
|
+
},
|
|
158
|
+
{ debounce: 100 }
|
|
159
|
+
);
|
|
160
|
+
const J = (e, s, i) => {
|
|
161
|
+
if (g.value && i >= d.value) {
|
|
162
|
+
e.stopPropagation(), L();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
t("item-click", s);
|
|
166
|
+
}, L = () => {
|
|
167
|
+
l.value = !l.value;
|
|
84
168
|
};
|
|
85
|
-
|
|
86
|
-
|
|
169
|
+
re(v, (e) => {
|
|
170
|
+
l.value && t("click-outside", e);
|
|
87
171
|
});
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
if (!
|
|
172
|
+
const Q = (e) => {
|
|
173
|
+
const s = o.value;
|
|
174
|
+
if (!s)
|
|
91
175
|
return;
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
left:
|
|
176
|
+
const i = e.offsetLeft, m = i + e.offsetWidth, a = s.scrollLeft, D = s.clientWidth, X = i < a, Y = m > a + D;
|
|
177
|
+
X ? s.scrollTo({
|
|
178
|
+
left: i,
|
|
95
179
|
behavior: "smooth"
|
|
96
|
-
}) :
|
|
97
|
-
left:
|
|
180
|
+
}) : Y && s.scrollTo({
|
|
181
|
+
left: m - D,
|
|
98
182
|
behavior: "smooth"
|
|
99
183
|
});
|
|
184
|
+
}, U = (e) => {
|
|
185
|
+
n.autoScrollOnHover && e.currentTarget && Q(e.currentTarget);
|
|
100
186
|
};
|
|
101
|
-
return
|
|
102
|
-
p.autoScrollOnHover && e.currentTarget && Z(e.currentTarget);
|
|
103
|
-
}), h({
|
|
104
|
-
children: a(() => E.value.concat(X.value))
|
|
105
|
-
}), (e, o) => (r(), m("div", {
|
|
187
|
+
return (e, s) => (u(), k("div", {
|
|
106
188
|
class: "tr-suggestion-pills__wrapper",
|
|
107
189
|
ref_key: "containerWrapperRef",
|
|
108
|
-
ref:
|
|
190
|
+
ref: v
|
|
109
191
|
}, [
|
|
110
|
-
|
|
111
|
-
class:
|
|
192
|
+
z("div", {
|
|
193
|
+
class: P(["tr-suggestion-pills__container", { "overflow-scroll": n.overflowMode === "scroll" }]),
|
|
112
194
|
ref_key: "containerRef",
|
|
113
|
-
ref:
|
|
195
|
+
ref: o
|
|
114
196
|
}, [
|
|
115
|
-
(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
197
|
+
b(e.$slots, "default", {}, () => [
|
|
198
|
+
(u(!0), k(N, null, $(M.value, (i, m) => (u(), h(_(K), {
|
|
199
|
+
key: i.id,
|
|
200
|
+
item: i,
|
|
201
|
+
onClick: (a) => J(a, i, m),
|
|
202
|
+
onMouseenter: s[0] || (s[0] = (a) => U(a))
|
|
203
|
+
}, null, 8, ["item", "onClick"]))), 128))
|
|
204
|
+
], !0)
|
|
121
205
|
], 2),
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
default:
|
|
125
|
-
|
|
206
|
+
z("div", pe, [
|
|
207
|
+
W(ne, { name: "tr-suggestion-pills__more" }, {
|
|
208
|
+
default: A(() => [
|
|
209
|
+
I.value.length ? (u(), k("div", {
|
|
126
210
|
key: 0,
|
|
127
211
|
class: "tr-suggestion-pills__more",
|
|
128
212
|
ref_key: "floatingItemsRef",
|
|
129
|
-
ref:
|
|
213
|
+
ref: C
|
|
130
214
|
}, [
|
|
131
|
-
(
|
|
132
|
-
key:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
], 512)) : S("", !0)
|
|
215
|
+
(u(!0), k(N, null, $(I.value, (i) => (u(), h(_(K), {
|
|
216
|
+
key: i.id,
|
|
217
|
+
item: i,
|
|
218
|
+
onClick: (m) => t("item-click", i)
|
|
219
|
+
}, null, 8, ["item", "onClick"]))), 128))
|
|
220
|
+
], 512)) : R("", !0)
|
|
138
221
|
]),
|
|
139
222
|
_: 1
|
|
140
223
|
})
|
|
141
224
|
]),
|
|
142
|
-
|
|
225
|
+
g.value ? (u(), k("button", {
|
|
143
226
|
key: 0,
|
|
144
|
-
class:
|
|
145
|
-
onClick:
|
|
227
|
+
class: P(["tr-suggestion-pills__expand", { "show-on-hover": n.showAllButtonOn === "hover" }]),
|
|
228
|
+
onClick: L
|
|
146
229
|
}, [
|
|
147
|
-
|
|
148
|
-
class:
|
|
230
|
+
W(_(le), {
|
|
231
|
+
class: P(["tr-suggestion-pills__expand-icon", { rotate: l.value }])
|
|
149
232
|
}, null, 8, ["class"])
|
|
150
|
-
], 2)) :
|
|
233
|
+
], 2)) : R("", !0)
|
|
151
234
|
], 512));
|
|
152
235
|
}
|
|
153
|
-
}),
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
|
|
236
|
+
}), T = /* @__PURE__ */ q(de, [["__scopeId", "data-v-5137af87"]]);
|
|
237
|
+
T.name = "TrSuggestionPills";
|
|
238
|
+
const fe = function(p) {
|
|
239
|
+
p.component(T.name, T);
|
|
157
240
|
};
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
|
|
241
|
+
T.install = fe;
|
|
242
|
+
f.name = "TrSuggestionPillButton";
|
|
243
|
+
const ve = function(p) {
|
|
244
|
+
p.component(f.name, f);
|
|
162
245
|
};
|
|
163
|
-
|
|
164
|
-
const
|
|
246
|
+
f.install = ve;
|
|
247
|
+
const Be = f;
|
|
165
248
|
export {
|
|
166
|
-
|
|
167
|
-
|
|
249
|
+
Be as SuggestionPillButton,
|
|
250
|
+
T as default
|
|
168
251
|
};
|