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