@opentiny/tiny-robot 0.2.11 → 0.2.13
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/base-popper/index.js +3 -2
- package/dist/dropdown-menu/index.js +15 -13
- package/dist/index.d.ts +55 -138
- package/dist/sender/index.js +926 -1125
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +34 -34
- package/dist/utils.js +4 -15
- package/package.json +3 -3
|
@@ -10,26 +10,26 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
|
|
|
10
10
|
item: {}
|
|
11
11
|
},
|
|
12
12
|
setup(p) {
|
|
13
|
-
const y = p,
|
|
14
|
-
var
|
|
15
|
-
return !!(
|
|
13
|
+
const y = p, n = Z(), t = w(() => {
|
|
14
|
+
var o;
|
|
15
|
+
return !!(n.icon || (o = y.item) != null && o.icon);
|
|
16
16
|
}), l = w(() => {
|
|
17
|
-
var
|
|
18
|
-
return !!(
|
|
17
|
+
var o;
|
|
18
|
+
return !!(n.default || (o = y.item) != null && o.text);
|
|
19
19
|
}), v = w(() => t.value && !l.value);
|
|
20
|
-
return (
|
|
20
|
+
return (o, C) => (a(), k("button", {
|
|
21
21
|
class: P(["tr-suggestion-pills__item", { "only-icon": v.value }])
|
|
22
22
|
}, [
|
|
23
|
-
b(
|
|
23
|
+
b(o.$slots, "icon", {}, () => {
|
|
24
24
|
var c;
|
|
25
25
|
return [
|
|
26
|
-
(a(), h(j((c =
|
|
26
|
+
(a(), h(j((c = o.item) == null ? void 0 : c.icon), { class: "tr-suggestion-pills__item_icon" }))
|
|
27
27
|
];
|
|
28
28
|
}, !0),
|
|
29
|
-
b(
|
|
29
|
+
b(o.$slots, "default", {}, () => {
|
|
30
30
|
var c;
|
|
31
31
|
return [
|
|
32
|
-
(c =
|
|
32
|
+
(c = o.item) != null && c.text ? (a(), k("span", ce, x(o.item.text), 1)) : R("", !0)
|
|
33
33
|
];
|
|
34
34
|
}, !0)
|
|
35
35
|
], 2));
|
|
@@ -42,14 +42,14 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
|
|
|
42
42
|
},
|
|
43
43
|
emits: ["click", "mouseenter"],
|
|
44
44
|
setup(p, { emit: y }) {
|
|
45
|
-
const
|
|
45
|
+
const n = y;
|
|
46
46
|
return (t, l) => {
|
|
47
|
-
var v,
|
|
47
|
+
var v, o, C, c, B, g, d, M, I;
|
|
48
48
|
return ((v = t.item.action) == null ? void 0 : v.type) === "popover" ? (a(), h(_(ue), E({
|
|
49
49
|
key: 0,
|
|
50
50
|
style: t.style
|
|
51
51
|
}, t.item.action.props, {
|
|
52
|
-
onItemClick: (
|
|
52
|
+
onItemClick: (o = t.item.action.events) == null ? void 0 : o.itemClick,
|
|
53
53
|
onGroupClick: (C = t.item.action.events) == null ? void 0 : C.groupClick,
|
|
54
54
|
onOpen: (c = t.item.action.events) == null ? void 0 : c.open,
|
|
55
55
|
onClose: (B = t.item.action.events) == null ? void 0 : B.close,
|
|
@@ -58,8 +58,8 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
|
|
|
58
58
|
default: A(() => [
|
|
59
59
|
W(f, {
|
|
60
60
|
item: t.item,
|
|
61
|
-
onClick: l[0] || (l[0] = (r) =>
|
|
62
|
-
onMouseenter: l[1] || (l[1] = (r) =>
|
|
61
|
+
onClick: l[0] || (l[0] = (r) => n("click", r)),
|
|
62
|
+
onMouseenter: l[1] || (l[1] = (r) => n("mouseenter", r))
|
|
63
63
|
}, null, 8, ["item"])
|
|
64
64
|
]),
|
|
65
65
|
_: 2
|
|
@@ -80,8 +80,8 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
|
|
|
80
80
|
trigger: A(() => [
|
|
81
81
|
W(f, {
|
|
82
82
|
item: t.item,
|
|
83
|
-
onClick: l[2] || (l[2] = (r) =>
|
|
84
|
-
onMouseenter: l[3] || (l[3] = (r) =>
|
|
83
|
+
onClick: l[2] || (l[2] = (r) => n("click", r)),
|
|
84
|
+
onMouseenter: l[3] || (l[3] = (r) => n("mouseenter", r))
|
|
85
85
|
}, null, 8, ["item"])
|
|
86
86
|
]),
|
|
87
87
|
_: 1
|
|
@@ -89,8 +89,8 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
|
|
|
89
89
|
key: 2,
|
|
90
90
|
item: t.item,
|
|
91
91
|
style: te(t.style),
|
|
92
|
-
onClick: l[4] || (l[4] = (r) =>
|
|
93
|
-
onMouseenter: l[5] || (l[5] = (r) =>
|
|
92
|
+
onClick: l[4] || (l[4] = (r) => n("click", r)),
|
|
93
|
+
onMouseenter: l[5] || (l[5] = (r) => n("mouseenter", r))
|
|
94
94
|
}, null, 8, ["item", "style"]));
|
|
95
95
|
};
|
|
96
96
|
}
|
|
@@ -108,18 +108,18 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
|
|
|
108
108
|
}),
|
|
109
109
|
emits: /* @__PURE__ */ F(["item-click", "click-outside"], ["update:showAll"]),
|
|
110
110
|
setup(p, { emit: y }) {
|
|
111
|
-
const
|
|
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
112
|
var e;
|
|
113
|
-
return g.value && l.value ? ((e =
|
|
113
|
+
return g.value && l.value ? ((e = n.items) == null ? void 0 : e.slice(0, d.value)) || [] : n.items || [];
|
|
114
114
|
}), I = w(() => {
|
|
115
115
|
var e;
|
|
116
|
-
return g.value && l.value ? ((e =
|
|
116
|
+
return g.value && l.value ? ((e = n.items) == null ? void 0 : e.slice(d.value)) || [] : [];
|
|
117
117
|
}), r = () => {
|
|
118
|
-
const e =
|
|
118
|
+
const e = o.value, s = C.value;
|
|
119
119
|
return Array.from((e == null ? void 0 : e.children) || []).concat(Array.from((s == null ? void 0 : s.children) || []));
|
|
120
120
|
}, O = () => {
|
|
121
121
|
V(() => {
|
|
122
|
-
const e =
|
|
122
|
+
const e = o.value;
|
|
123
123
|
if (!e)
|
|
124
124
|
return;
|
|
125
125
|
const s = r(), i = parseFloat(getComputedStyle(e).rowGap) || 0;
|
|
@@ -136,20 +136,20 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
|
|
|
136
136
|
G(
|
|
137
137
|
() => {
|
|
138
138
|
var e;
|
|
139
|
-
return [
|
|
139
|
+
return [n.items, (e = n.items) == null ? void 0 : e.length];
|
|
140
140
|
},
|
|
141
141
|
() => {
|
|
142
142
|
V(() => {
|
|
143
|
-
if (!
|
|
143
|
+
if (!o.value)
|
|
144
144
|
return;
|
|
145
|
-
const e = r(), s = parseFloat(getComputedStyle(
|
|
145
|
+
const e = r(), s = parseFloat(getComputedStyle(o.value).rowGap) || 0;
|
|
146
146
|
B.value = e.map((i) => i.offsetWidth).reduce((i, m) => i + m + s);
|
|
147
147
|
});
|
|
148
148
|
},
|
|
149
149
|
{ immediate: !0 }
|
|
150
150
|
), G(() => {
|
|
151
151
|
var e;
|
|
152
|
-
return [
|
|
152
|
+
return [n.items, (e = n.items) == null ? void 0 : e.length];
|
|
153
153
|
}, O), ie(
|
|
154
154
|
c,
|
|
155
155
|
(e) => {
|
|
@@ -170,7 +170,7 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
|
|
|
170
170
|
l.value && t("click-outside", e);
|
|
171
171
|
});
|
|
172
172
|
const Q = (e) => {
|
|
173
|
-
const s =
|
|
173
|
+
const s = o.value;
|
|
174
174
|
if (!s)
|
|
175
175
|
return;
|
|
176
176
|
const i = e.offsetLeft, m = i + e.offsetWidth, u = s.scrollLeft, D = s.clientWidth, X = i < u, Y = m > u + D;
|
|
@@ -182,7 +182,7 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
|
|
|
182
182
|
behavior: "smooth"
|
|
183
183
|
});
|
|
184
184
|
}, U = (e) => {
|
|
185
|
-
|
|
185
|
+
n.autoScrollOnHover && e.currentTarget && Q(e.currentTarget);
|
|
186
186
|
};
|
|
187
187
|
return (e, s) => (a(), k("div", {
|
|
188
188
|
class: "tr-suggestion-pills__wrapper",
|
|
@@ -190,9 +190,9 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
|
|
|
190
190
|
ref: v
|
|
191
191
|
}, [
|
|
192
192
|
z("div", {
|
|
193
|
-
class: P(["tr-suggestion-pills__container", { "overflow-scroll":
|
|
193
|
+
class: P(["tr-suggestion-pills__container", { "overflow-scroll": n.overflowMode === "scroll" }]),
|
|
194
194
|
ref_key: "containerRef",
|
|
195
|
-
ref:
|
|
195
|
+
ref: o
|
|
196
196
|
}, [
|
|
197
197
|
b(e.$slots, "default", {}, () => [
|
|
198
198
|
(a(!0), k(N, null, $(M.value, (i, m) => (a(), h(_(K), {
|
|
@@ -224,7 +224,7 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
|
|
|
224
224
|
]),
|
|
225
225
|
g.value ? (a(), k("button", {
|
|
226
226
|
key: 0,
|
|
227
|
-
class: P(["tr-suggestion-pills__expand", { "show-on-hover":
|
|
227
|
+
class: P(["tr-suggestion-pills__expand", { "show-on-hover": n.showAllButtonOn === "hover" }]),
|
|
228
228
|
onClick: L
|
|
229
229
|
}, [
|
|
230
230
|
W(_(le), {
|
|
@@ -233,7 +233,7 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
|
|
|
233
233
|
], 2)) : R("", !0)
|
|
234
234
|
], 512));
|
|
235
235
|
}
|
|
236
|
-
}), T = /* @__PURE__ */ q(de, [["__scopeId", "data-v-
|
|
236
|
+
}), T = /* @__PURE__ */ q(de, [["__scopeId", "data-v-68ee26f5"]]);
|
|
237
237
|
T.name = "TrSuggestionPills";
|
|
238
238
|
const fe = function(p) {
|
|
239
239
|
p.component(T.name, T);
|
package/dist/utils.js
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
function
|
|
1
|
+
function n(t) {
|
|
2
2
|
if (typeof t == "number") return `${t}px`;
|
|
3
|
-
const
|
|
4
|
-
return
|
|
5
|
-
}
|
|
6
|
-
function i(t) {
|
|
7
|
-
var n;
|
|
8
|
-
if (!t) return window.getSelection();
|
|
9
|
-
const o = t.getRootNode();
|
|
10
|
-
return o instanceof ShadowRoot && ((n = o.getSelection) == null ? void 0 : n.call(o)) || window.getSelection();
|
|
11
|
-
}
|
|
12
|
-
function r(t) {
|
|
13
|
-
return t.getRootNode() instanceof ShadowRoot;
|
|
3
|
+
const r = t == null ? void 0 : t.trim();
|
|
4
|
+
return r ? /^-?\d+(\.\d+)?$/.test(r) ? `${r}px` : r : "0px";
|
|
14
5
|
}
|
|
15
6
|
export {
|
|
16
|
-
|
|
17
|
-
r as i,
|
|
18
|
-
e as t
|
|
7
|
+
n as t
|
|
19
8
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/tiny-robot",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"vue": "^3.3.11"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@opentiny/tiny-robot-svgs": "0.2.
|
|
23
|
+
"@opentiny/tiny-robot-svgs": "0.2.13",
|
|
24
24
|
"@opentiny/vue": "^3.21.0",
|
|
25
25
|
"@opentiny/vue-button": "^3.21.0",
|
|
26
26
|
"@opentiny/vue-icon": "^3.22.0",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"vue": "^3.3.11",
|
|
45
45
|
"vue-tsc": "^2.2.8"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "1f75b6d935673a6d02b79dd29901a29843030da6"
|
|
48
48
|
}
|