@opentiny/tiny-robot 0.2.4 → 0.2.6
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/index.d.ts +38 -25
- package/dist/index6.js +414 -411
- package/dist/sender/index.js +947 -895
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +101 -98
- package/dist/suggestion-popover/index.js +106 -116
- package/dist/utils.js +15 -4
- package/package.json +3 -3
|
@@ -1,198 +1,201 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { K as X
|
|
3
|
-
import { b as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { defineComponent as T, useSlots as F, computed as k, createElementBlock as f, openBlock as n, normalizeClass as A, renderSlot as $, createBlock as v, resolveDynamicComponent as N, createCommentVNode as b, toDisplayString as H, unref as h, mergeProps as D, createSlots as j, withCtx as B, createVNode as I, renderList as M, normalizeStyle as O, mergeModels as E, ref as P, useModel as q, watch as J, createElementVNode as R, Fragment as z, Transition as Q, nextTick as U } from "vue";
|
|
2
|
+
import { K as X } from "../tiny-robot-svgs.js";
|
|
3
|
+
import { b as Y, w as Z, o as x } from "../index2.js";
|
|
4
|
+
import ee from "../dropdown-menu/index.js";
|
|
5
|
+
import te from "../suggestion-popover/index.js";
|
|
6
6
|
import { _ as V } from "../_plugin-vue_export-helper.js";
|
|
7
|
-
const oe = { key: 0 },
|
|
7
|
+
const oe = { key: 0 }, ne = /* @__PURE__ */ T({
|
|
8
8
|
__name: "PillButton",
|
|
9
9
|
props: {
|
|
10
10
|
item: {}
|
|
11
11
|
},
|
|
12
12
|
setup(u) {
|
|
13
|
-
const
|
|
14
|
-
var
|
|
15
|
-
return !!(
|
|
16
|
-
}), r =
|
|
17
|
-
var
|
|
18
|
-
return !!(
|
|
19
|
-
}),
|
|
20
|
-
return (
|
|
21
|
-
class:
|
|
13
|
+
const g = u, l = F(), e = k(() => {
|
|
14
|
+
var o;
|
|
15
|
+
return !!(l.icon || (o = g.item) != null && o.icon);
|
|
16
|
+
}), r = k(() => {
|
|
17
|
+
var o;
|
|
18
|
+
return !!(l.default || (o = g.item) != null && o.text);
|
|
19
|
+
}), m = k(() => e.value && !r.value);
|
|
20
|
+
return (o, c) => (n(), f("button", {
|
|
21
|
+
class: A(["tr-suggestion-pills__item", { "only-icon": m.value }])
|
|
22
22
|
}, [
|
|
23
|
-
|
|
24
|
-
var
|
|
23
|
+
$(o.$slots, "icon", {}, () => {
|
|
24
|
+
var i;
|
|
25
25
|
return [
|
|
26
|
-
(n(),
|
|
26
|
+
(n(), v(N((i = o.item) == null ? void 0 : i.icon), { class: "tr-suggestion-pills__item_icon" }))
|
|
27
27
|
];
|
|
28
28
|
}, !0),
|
|
29
|
-
|
|
30
|
-
var
|
|
29
|
+
$(o.$slots, "default", {}, () => {
|
|
30
|
+
var i;
|
|
31
31
|
return [
|
|
32
|
-
(
|
|
32
|
+
(i = o.item) != null && i.text ? (n(), f("span", oe, H(o.item.text), 1)) : b("", !0)
|
|
33
33
|
];
|
|
34
34
|
}, !0)
|
|
35
35
|
], 2));
|
|
36
36
|
}
|
|
37
|
-
}),
|
|
37
|
+
}), d = /* @__PURE__ */ V(ne, [["__scopeId", "data-v-5c113fe1"]]), L = /* @__PURE__ */ T({
|
|
38
38
|
__name: "PillButtonWrapper",
|
|
39
39
|
props: {
|
|
40
40
|
item: {},
|
|
41
41
|
style: {}
|
|
42
42
|
},
|
|
43
43
|
emits: ["click"],
|
|
44
|
-
setup(u, { emit:
|
|
45
|
-
const
|
|
44
|
+
setup(u, { emit: g }) {
|
|
45
|
+
const l = g;
|
|
46
46
|
return (e, r) => {
|
|
47
|
-
var
|
|
48
|
-
return ((
|
|
47
|
+
var m, o, c, i, p, y;
|
|
48
|
+
return ((m = e.item.action) == null ? void 0 : m.type) === "popover" ? (n(), v(h(te), D({
|
|
49
49
|
key: 0,
|
|
50
50
|
style: e.style
|
|
51
51
|
}, e.item.action.props, {
|
|
52
|
-
onItemClick: (
|
|
52
|
+
onItemClick: (o = e.item.action.events) == null ? void 0 : o.itemClick,
|
|
53
53
|
onGroupClick: (c = e.item.action.events) == null ? void 0 : c.groupClick,
|
|
54
|
-
onClose: (
|
|
55
|
-
}),
|
|
54
|
+
onClose: (i = e.item.action.events) == null ? void 0 : i.close
|
|
55
|
+
}), j({
|
|
56
56
|
default: B(() => [
|
|
57
|
-
|
|
57
|
+
I(d, {
|
|
58
58
|
item: e.item,
|
|
59
|
-
onClick: r[0] || (r[0] = (a) =>
|
|
59
|
+
onClick: r[0] || (r[0] = (a) => l("click", a, e.item))
|
|
60
60
|
}, null, 8, ["item"])
|
|
61
61
|
]),
|
|
62
62
|
_: 2
|
|
63
63
|
}, [
|
|
64
|
-
|
|
64
|
+
M(e.item.action.slots, (a, C) => ({
|
|
65
65
|
name: C,
|
|
66
66
|
fn: B(() => [
|
|
67
|
-
(n(),
|
|
67
|
+
(n(), v(N(a)))
|
|
68
68
|
])
|
|
69
69
|
}))
|
|
70
|
-
]), 1040, ["style", "onItemClick", "onGroupClick", "onClose"])) : ((
|
|
70
|
+
]), 1040, ["style", "onItemClick", "onGroupClick", "onClose"])) : ((p = e.item.action) == null ? void 0 : p.type) === "menu" ? (n(), v(h(ee), D({
|
|
71
71
|
key: 1,
|
|
72
72
|
style: e.style
|
|
73
73
|
}, e.item.action.props, {
|
|
74
|
-
onItemClick: (
|
|
74
|
+
onItemClick: (y = e.item.action.events) == null ? void 0 : y.itemClick
|
|
75
75
|
}), {
|
|
76
76
|
default: B(() => [
|
|
77
|
-
|
|
77
|
+
I(d, {
|
|
78
78
|
item: e.item,
|
|
79
|
-
onClick: r[1] || (r[1] = (a) =>
|
|
79
|
+
onClick: r[1] || (r[1] = (a) => l("click", a, e.item))
|
|
80
80
|
}, null, 8, ["item"])
|
|
81
81
|
]),
|
|
82
82
|
_: 1
|
|
83
|
-
}, 16, ["style", "onItemClick"])) : (n(),
|
|
83
|
+
}, 16, ["style", "onItemClick"])) : (n(), v(d, {
|
|
84
84
|
key: 2,
|
|
85
85
|
item: e.item,
|
|
86
|
-
style:
|
|
87
|
-
onClick: r[2] || (r[2] = (a) =>
|
|
86
|
+
style: O(e.style),
|
|
87
|
+
onClick: r[2] || (r[2] = (a) => l("click", a, e.item))
|
|
88
88
|
}, null, 8, ["item", "style"]));
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
}),
|
|
91
|
+
}), le = { class: "tr-suggestion-pills__more-wrapper" }, ie = {
|
|
92
92
|
key: 0,
|
|
93
93
|
class: "tr-suggestion-pills__more"
|
|
94
|
-
},
|
|
94
|
+
}, se = /* @__PURE__ */ T({
|
|
95
95
|
__name: "index",
|
|
96
|
-
props: /* @__PURE__ */
|
|
96
|
+
props: /* @__PURE__ */ E({
|
|
97
97
|
items: {},
|
|
98
|
-
showAll: { type: Boolean }
|
|
98
|
+
showAll: { type: Boolean },
|
|
99
|
+
showAllButtonOn: { default: "hover" }
|
|
99
100
|
}, {
|
|
100
101
|
showAll: { type: Boolean, default: !1 },
|
|
101
102
|
showAllModifiers: {}
|
|
102
103
|
}),
|
|
103
|
-
emits: /* @__PURE__ */
|
|
104
|
-
setup(u, { emit:
|
|
105
|
-
const
|
|
106
|
-
var
|
|
107
|
-
return !
|
|
108
|
-
}), a =
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
if (!
|
|
104
|
+
emits: /* @__PURE__ */ E(["item-click", "click-outside"], ["update:showAll"]),
|
|
105
|
+
setup(u, { emit: g }) {
|
|
106
|
+
const l = u, e = g, r = P(null), m = P(null), { width: o } = Y(m), c = P(-1), i = k(() => c.value !== -1), p = q(u, "showAll"), y = k(() => {
|
|
107
|
+
var t;
|
|
108
|
+
return !i.value || !p.value ? ((t = l.items) == null ? void 0 : t.length) || 0 : c.value;
|
|
109
|
+
}), a = k(() => !i.value || !p.value ? [] : (l.items || []).slice(c.value)), C = () => {
|
|
110
|
+
U(() => {
|
|
111
|
+
const t = m.value;
|
|
112
|
+
if (!t)
|
|
112
113
|
return;
|
|
113
|
-
const _ = Array.from(
|
|
114
|
-
c.value = _.findIndex((s) => s.offsetLeft + s.offsetWidth >
|
|
114
|
+
const _ = Array.from(t.children);
|
|
115
|
+
c.value = _.findIndex((s) => s.offsetLeft + s.offsetWidth > t.clientWidth);
|
|
115
116
|
});
|
|
116
117
|
};
|
|
117
|
-
|
|
118
|
-
var
|
|
119
|
-
return [
|
|
120
|
-
}, C),
|
|
121
|
-
|
|
122
|
-
(
|
|
123
|
-
|
|
118
|
+
J(() => {
|
|
119
|
+
var t;
|
|
120
|
+
return [l.items, (t = l.items) == null ? void 0 : t.length];
|
|
121
|
+
}, C), Z(
|
|
122
|
+
o,
|
|
123
|
+
(t) => {
|
|
124
|
+
t > 0 && C();
|
|
124
125
|
},
|
|
125
126
|
{ debounce: 100 }
|
|
126
127
|
);
|
|
127
|
-
const G = (
|
|
128
|
-
if (
|
|
129
|
-
|
|
128
|
+
const G = (t, _, s) => {
|
|
129
|
+
if (i.value && s >= c.value) {
|
|
130
|
+
t.stopPropagation(), W();
|
|
130
131
|
return;
|
|
131
132
|
}
|
|
132
133
|
e("item-click", _);
|
|
133
|
-
},
|
|
134
|
-
|
|
134
|
+
}, W = () => {
|
|
135
|
+
p.value = !p.value;
|
|
135
136
|
};
|
|
136
|
-
return
|
|
137
|
-
|
|
138
|
-
}), (
|
|
137
|
+
return x(r, (t) => {
|
|
138
|
+
e("click-outside", t);
|
|
139
|
+
}), (t, _) => (n(), f("div", {
|
|
139
140
|
class: "tr-suggestion-pills__wrapper",
|
|
140
141
|
ref_key: "containerWrapperRef",
|
|
141
142
|
ref: r
|
|
142
143
|
}, [
|
|
143
|
-
|
|
144
|
+
R("div", {
|
|
144
145
|
class: "tr-suggestion-pills__container",
|
|
145
146
|
ref_key: "containerRef",
|
|
146
|
-
ref:
|
|
147
|
+
ref: m
|
|
147
148
|
}, [
|
|
148
|
-
|
|
149
|
-
(n(!0),
|
|
149
|
+
$(t.$slots, "default", {}, () => [
|
|
150
|
+
(n(!0), f(z, null, M(l.items, (s, w) => (n(), v(h(L), {
|
|
150
151
|
key: s.id,
|
|
151
152
|
item: s,
|
|
152
|
-
style:
|
|
153
|
-
visibility: w <
|
|
154
|
-
pointerEvents: w <
|
|
153
|
+
style: O({
|
|
154
|
+
visibility: w < y.value ? void 0 : "hidden",
|
|
155
|
+
pointerEvents: w < y.value ? void 0 : "none"
|
|
155
156
|
}),
|
|
156
157
|
onClick: (K) => G(K, s, w)
|
|
157
158
|
}, null, 8, ["item", "style", "onClick"]))), 128))
|
|
158
159
|
], !0)
|
|
159
160
|
], 512),
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
R("div", le, [
|
|
162
|
+
I(Q, { name: "tr-suggestion-pills__more" }, {
|
|
162
163
|
default: B(() => [
|
|
163
|
-
a.value.length ? (n(),
|
|
164
|
-
(n(!0),
|
|
164
|
+
a.value.length ? (n(), f("div", ie, [
|
|
165
|
+
(n(!0), f(z, null, M(a.value, (s) => (n(), v(h(L), {
|
|
165
166
|
key: s.id,
|
|
166
167
|
item: s,
|
|
167
168
|
onClick: (w) => e("item-click", s)
|
|
168
169
|
}, null, 8, ["item", "onClick"]))), 128))
|
|
169
|
-
])) :
|
|
170
|
+
])) : b("", !0)
|
|
170
171
|
]),
|
|
171
172
|
_: 1
|
|
172
173
|
})
|
|
173
174
|
]),
|
|
174
|
-
|
|
175
|
+
i.value ? (n(), f("button", {
|
|
175
176
|
key: 0,
|
|
176
|
-
class: "tr-suggestion-pills__expand",
|
|
177
|
-
onClick:
|
|
177
|
+
class: A(["tr-suggestion-pills__expand", { "show-on-hover": l.showAllButtonOn === "hover" }]),
|
|
178
|
+
onClick: W
|
|
178
179
|
}, [
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
I(h(X), {
|
|
181
|
+
class: A(["tr-suggestion-pills__expand-icon", { rotate: p.value }])
|
|
182
|
+
}, null, 8, ["class"])
|
|
183
|
+
], 2)) : b("", !0)
|
|
181
184
|
], 512));
|
|
182
185
|
}
|
|
183
|
-
}),
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
u.component(
|
|
186
|
+
}), S = /* @__PURE__ */ V(se, [["__scopeId", "data-v-43d06a90"]]);
|
|
187
|
+
S.name = "TrSuggestionPills";
|
|
188
|
+
const re = function(u) {
|
|
189
|
+
u.component(S.name, S);
|
|
187
190
|
};
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
const
|
|
191
|
-
u.component(
|
|
191
|
+
S.install = re;
|
|
192
|
+
d.name = "TrSuggestionPillButton";
|
|
193
|
+
const ae = function(u) {
|
|
194
|
+
u.component(d.name, d);
|
|
192
195
|
};
|
|
193
|
-
|
|
194
|
-
const ve =
|
|
196
|
+
d.install = ae;
|
|
197
|
+
const ve = d;
|
|
195
198
|
export {
|
|
196
199
|
ve as SuggestionPillButton,
|
|
197
|
-
|
|
200
|
+
S as default
|
|
198
201
|
};
|