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