@opentiny/tiny-robot 0.5.2-alpha.10 → 0.5.2-alpha.14
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/dropdown-menu/index.js +1 -1
- package/dist/extension-manager/index.js +473 -0
- package/dist/floating-ui.dom.js +970 -0
- package/dist/index.d.ts +554 -141
- package/dist/index.js +104 -93
- package/dist/index4.js +2 -2
- package/dist/index6.js +1 -1
- package/dist/index8.js +87 -102
- package/dist/layout/index.js +1 -1
- package/dist/model-selector/index.js +989 -0
- package/dist/sender/index.js +1127 -2060
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +1 -1
- package/dist/suggestion-popover/index.js +37 -36
- package/dist/useSlotRefs.js +1 -1
- package/dist/useTeleportTarget.js +25 -0
- package/dist/utils.js +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref as k, onUnmounted as T, watch as C, defineComponent as E, useModel as H, computed as p, openBlock as w, createBlock as I, unref as X, withCtx as y, createElementVNode as j, createElementBlock as _, Fragment as D, renderList as L, toDisplayString as Y, renderSlot as O, mergeModels as M } from "vue";
|
|
2
|
-
import { w as S,
|
|
2
|
+
import { w as S, u as b, o as $ } from "../index4.js";
|
|
3
3
|
import { B as A } from "../index8.js";
|
|
4
4
|
import { u as F } from "../utils.js";
|
|
5
5
|
import { _ as G } from "../_plugin-vue_export-helper.js";
|
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
import * as G from "vue";
|
|
2
|
+
import { cloneVNode as U, Comment as q, Text as J, Fragment as $, isVNode as Q, Teleport as X, Suspense as Y, ref as E, watch as Z, nextTick as ee, defineComponent as S, onMounted as te, toRef as ne, computed as _, useSlots as V, openBlock as i, createElementBlock as p, createBlock as k, resolveDynamicComponent as P, renderSlot as A, withDirectives as oe, createElementVNode as h, normalizeStyle as W, vShow as ae, createVNode as H, withCtx as R, renderList as z, normalizeClass as x, createCommentVNode as g, toDisplayString as C, unref as j, withModifiers as D, createSlots as se, normalizeProps as ie, guardReactiveProps as re, createTextVNode as le, mergeProps as ce } from "vue";
|
|
3
|
+
import { IconMore as de } from "@opentiny/tiny-robot-svgs";
|
|
4
|
+
import { g as L } from "../index4.js";
|
|
5
|
+
import { _ as T } from "../_plugin-vue_export-helper.js";
|
|
6
|
+
const K = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function ue() {
|
|
8
|
+
const t = G.useId;
|
|
9
|
+
if (t)
|
|
10
|
+
return t();
|
|
11
|
+
const u = G.getCurrentInstance();
|
|
12
|
+
if (!u)
|
|
13
|
+
return "";
|
|
14
|
+
const o = u.appContext, m = K.get(o) ?? 0;
|
|
15
|
+
return K.set(o, m + 1), `tr-${m}`;
|
|
16
|
+
}
|
|
17
|
+
const F = (t) => t.flatMap((u) => u.type === q ? [] : u.type === J && typeof u.children == "string" && u.children.trim() === "" ? [] : u.type !== $ || !Array.isArray(u.children) ? [u] : F(u.children.filter(Q))), pe = (t) => t.type === X || t.type === Y ? !1 : typeof t.type == "string" || typeof t.type == "object" || typeof t.type == "function";
|
|
18
|
+
function me({ getSlot: t, componentName: u }) {
|
|
19
|
+
return {
|
|
20
|
+
renderAsChild: (m, d = {}) => {
|
|
21
|
+
var a;
|
|
22
|
+
const l = F(((a = t()) == null ? void 0 : a(m)) ?? []);
|
|
23
|
+
return l.length !== 1 || !pe(l[0]) ? null : U(l[0], d, !0);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const ve = ({
|
|
28
|
+
triggerRef: t,
|
|
29
|
+
popoverRef: u,
|
|
30
|
+
open: o,
|
|
31
|
+
placement: m
|
|
32
|
+
}) => {
|
|
33
|
+
const d = E(), l = () => {
|
|
34
|
+
if (!o.value || !t.value || !u.value) return;
|
|
35
|
+
const a = t.value.getBoundingClientRect(), s = u.value.getBoundingClientRect(), n = 8, e = 8, c = Math.max(
|
|
36
|
+
n,
|
|
37
|
+
document.documentElement.clientWidth - s.width - n
|
|
38
|
+
), b = Math.max(
|
|
39
|
+
n,
|
|
40
|
+
document.documentElement.clientHeight - s.height - n
|
|
41
|
+
), y = Math.min(c, Math.max(n, a.right - s.width)), w = a.bottom + e, M = a.top - s.height - e, f = w + s.height <= document.documentElement.clientHeight - n, r = M >= n;
|
|
42
|
+
let v = m.value;
|
|
43
|
+
v === "bottom-end" && !f && r ? v = "top-end" : v === "top-end" && !r && f && (v = "bottom-end");
|
|
44
|
+
const O = Math.min(b, Math.max(n, v === "bottom-end" ? w : M));
|
|
45
|
+
d.value = {
|
|
46
|
+
x: y,
|
|
47
|
+
y: O,
|
|
48
|
+
placement: v
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
return Z(
|
|
52
|
+
[o, m],
|
|
53
|
+
async ([a]) => {
|
|
54
|
+
a && (await ee(), l());
|
|
55
|
+
},
|
|
56
|
+
{ flush: "post" }
|
|
57
|
+
), L("resize", l, { passive: !0 }), L("scroll", l, {
|
|
58
|
+
capture: !0,
|
|
59
|
+
passive: !0
|
|
60
|
+
}), {
|
|
61
|
+
position: d
|
|
62
|
+
};
|
|
63
|
+
}, fe = ["aria-expanded"], he = ["popover"], ye = /* @__PURE__ */ S({
|
|
64
|
+
inheritAttrs: !1,
|
|
65
|
+
__name: "ExtensionCardPopover",
|
|
66
|
+
props: {
|
|
67
|
+
asChild: { type: Boolean, default: !1 },
|
|
68
|
+
placement: { default: "bottom-end" }
|
|
69
|
+
},
|
|
70
|
+
setup(t) {
|
|
71
|
+
const u = t, o = `tr-extension-card-popover-${ue()}`, m = E(null), d = E(null), l = E(!1), a = E(!1);
|
|
72
|
+
te(() => {
|
|
73
|
+
a.value = typeof HTMLElement.prototype.showPopover == "function" && typeof HTMLElement.prototype.hidePopover == "function";
|
|
74
|
+
});
|
|
75
|
+
const { position: s } = ve({
|
|
76
|
+
triggerRef: m,
|
|
77
|
+
popoverRef: d,
|
|
78
|
+
open: l,
|
|
79
|
+
placement: ne(u, "placement")
|
|
80
|
+
}), n = _(() => {
|
|
81
|
+
if (s.value)
|
|
82
|
+
return {
|
|
83
|
+
left: `${s.value.x}px`,
|
|
84
|
+
top: `${s.value.y}px`
|
|
85
|
+
};
|
|
86
|
+
}), e = V(), c = (r) => {
|
|
87
|
+
const v = r instanceof Element ? r : r == null ? void 0 : r.$el;
|
|
88
|
+
m.value = v instanceof HTMLElement ? v : null;
|
|
89
|
+
}, b = () => {
|
|
90
|
+
var r;
|
|
91
|
+
if (!a.value) {
|
|
92
|
+
l.value = !1;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
(r = d.value) != null && r.matches(":popover-open") && d.value.hidePopover();
|
|
96
|
+
}, y = () => {
|
|
97
|
+
if (!a.value) {
|
|
98
|
+
l.value = !l.value;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
d.value && (d.value.matches(":popover-open") ? d.value.hidePopover() : d.value.showPopover());
|
|
102
|
+
};
|
|
103
|
+
L("click", (r) => {
|
|
104
|
+
var v, N;
|
|
105
|
+
a.value || !l.value || !(r.target instanceof Node) || (v = m.value) != null && v.contains(r.target) || (N = d.value) != null && N.contains(r.target) || b();
|
|
106
|
+
}), L("keydown", (r) => {
|
|
107
|
+
var v;
|
|
108
|
+
a.value || !l.value || r.key !== "Escape" || (b(), (v = m.value) == null || v.focus());
|
|
109
|
+
});
|
|
110
|
+
const { renderAsChild: w } = me({
|
|
111
|
+
getSlot: () => e.trigger,
|
|
112
|
+
componentName: "ExtensionCardPopover"
|
|
113
|
+
}), M = () => w(
|
|
114
|
+
{
|
|
115
|
+
popoverId: o,
|
|
116
|
+
open: l.value
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
ref: c,
|
|
120
|
+
...a.value ? {
|
|
121
|
+
popovertarget: o,
|
|
122
|
+
popovertargetaction: "toggle"
|
|
123
|
+
} : { onClick: y }
|
|
124
|
+
}
|
|
125
|
+
), f = (r) => {
|
|
126
|
+
l.value = r.newState === "open";
|
|
127
|
+
};
|
|
128
|
+
return (r, v) => (i(), p($, null, [
|
|
129
|
+
t.asChild ? (i(), k(P(M()), { key: 0 })) : (i(), p("button", {
|
|
130
|
+
key: 1,
|
|
131
|
+
ref_key: "triggerRef",
|
|
132
|
+
ref: m,
|
|
133
|
+
type: "button",
|
|
134
|
+
class: "tr-extension-card-popover__trigger",
|
|
135
|
+
"aria-controls": o,
|
|
136
|
+
"aria-expanded": l.value,
|
|
137
|
+
onClick: y
|
|
138
|
+
}, [
|
|
139
|
+
A(r.$slots, "trigger", {
|
|
140
|
+
popoverId: o,
|
|
141
|
+
open: l.value
|
|
142
|
+
}, void 0, !0)
|
|
143
|
+
], 8, fe)),
|
|
144
|
+
oe(h("div", {
|
|
145
|
+
id: o,
|
|
146
|
+
ref_key: "popoverRef",
|
|
147
|
+
ref: d,
|
|
148
|
+
popover: a.value ? "auto" : void 0,
|
|
149
|
+
class: "tr-extension-card-popover__content",
|
|
150
|
+
style: W(n.value),
|
|
151
|
+
onToggle: f
|
|
152
|
+
}, [
|
|
153
|
+
A(r.$slots, "content", { close: b }, void 0, !0)
|
|
154
|
+
], 44, he), [
|
|
155
|
+
[ae, a.value || l.value]
|
|
156
|
+
])
|
|
157
|
+
], 64));
|
|
158
|
+
}
|
|
159
|
+
}), be = /* @__PURE__ */ T(ye, [["__scopeId", "data-v-6dbac593"]]), _e = {
|
|
160
|
+
key: 0,
|
|
161
|
+
class: "tr-extension-card__more-action"
|
|
162
|
+
}, ge = ["title", "aria-label", "aria-expanded"], ke = { class: "tr-extension-card__more-menu" }, xe = ["disabled", "aria-pressed", "onClick"], Ce = {
|
|
163
|
+
key: 0,
|
|
164
|
+
class: "tr-extension-card__more-menu-item-icon-slot"
|
|
165
|
+
}, we = {
|
|
166
|
+
key: 1,
|
|
167
|
+
class: "tr-extension-card__more-menu-item-icon-placeholder",
|
|
168
|
+
"aria-hidden": "true"
|
|
169
|
+
}, Me = /* @__PURE__ */ S({
|
|
170
|
+
__name: "ExtensionCardMoreMenu",
|
|
171
|
+
props: {
|
|
172
|
+
actions: { default: () => [] },
|
|
173
|
+
label: { default: "更多操作" },
|
|
174
|
+
placement: { default: "bottom-end" },
|
|
175
|
+
showIcons: { type: Boolean, default: !0 }
|
|
176
|
+
},
|
|
177
|
+
emits: ["action"],
|
|
178
|
+
setup(t, { emit: u }) {
|
|
179
|
+
const o = t, m = u, d = _(() => o.showIcons && o.actions.some((a) => !!a.icon)), l = (a, s) => {
|
|
180
|
+
a.disabled || (s(), m("action", {
|
|
181
|
+
id: a.id,
|
|
182
|
+
type: a.type,
|
|
183
|
+
...a.type === "switch" ? { checked: !a.checked } : {}
|
|
184
|
+
}));
|
|
185
|
+
};
|
|
186
|
+
return (a, s) => o.actions.length ? (i(), p("div", _e, [
|
|
187
|
+
H(be, {
|
|
188
|
+
"as-child": "",
|
|
189
|
+
placement: o.placement
|
|
190
|
+
}, {
|
|
191
|
+
trigger: R(({ open: n }) => [
|
|
192
|
+
h("button", {
|
|
193
|
+
class: "tr-extension-card__icon-button",
|
|
194
|
+
type: "button",
|
|
195
|
+
title: o.label,
|
|
196
|
+
"aria-label": o.label,
|
|
197
|
+
"aria-expanded": n
|
|
198
|
+
}, [
|
|
199
|
+
H(j(de), { class: "tr-extension-card__action-icon" })
|
|
200
|
+
], 8, ge)
|
|
201
|
+
]),
|
|
202
|
+
content: R(({ close: n }) => [
|
|
203
|
+
h("ul", ke, [
|
|
204
|
+
(i(!0), p($, null, z(o.actions, (e) => (i(), p("li", {
|
|
205
|
+
key: e.id
|
|
206
|
+
}, [
|
|
207
|
+
h("button", {
|
|
208
|
+
class: x(["tr-extension-card__more-menu-item", { "is-danger": e.danger }]),
|
|
209
|
+
type: "button",
|
|
210
|
+
disabled: e.disabled,
|
|
211
|
+
"aria-pressed": e.type === "switch" ? e.checked : void 0,
|
|
212
|
+
onClick: (c) => l(e, n)
|
|
213
|
+
}, [
|
|
214
|
+
d.value ? (i(), p("span", Ce, [
|
|
215
|
+
e.icon ? (i(), k(P(e.icon), {
|
|
216
|
+
key: 0,
|
|
217
|
+
class: "tr-extension-card__more-menu-item-icon"
|
|
218
|
+
})) : (i(), p("span", we))
|
|
219
|
+
])) : g("", !0),
|
|
220
|
+
h("span", null, C(e.label), 1)
|
|
221
|
+
], 10, xe)
|
|
222
|
+
]))), 128))
|
|
223
|
+
])
|
|
224
|
+
]),
|
|
225
|
+
_: 1
|
|
226
|
+
}, 8, ["placement"])
|
|
227
|
+
])) : g("", !0);
|
|
228
|
+
}
|
|
229
|
+
}), $e = /* @__PURE__ */ T(Me, [["__scopeId", "data-v-8d00263e"]]), Ae = { class: "tr-extension-card-primary-actions" }, Ee = ["checked", "disabled", "aria-label", "onChange"], Pe = ["aria-label", "disabled", "onClick"], Ie = ["aria-label", "disabled", "onClick"], Se = /* @__PURE__ */ S({
|
|
230
|
+
__name: "ExtensionCardActions",
|
|
231
|
+
props: {
|
|
232
|
+
actions: { default: () => [] }
|
|
233
|
+
},
|
|
234
|
+
emits: ["action"],
|
|
235
|
+
setup(t, { emit: u }) {
|
|
236
|
+
const o = t, m = u, d = (s, n) => {
|
|
237
|
+
if (s.disabled) return;
|
|
238
|
+
const e = n.currentTarget, c = e.checked;
|
|
239
|
+
e.checked = !!s.checked, m("action", {
|
|
240
|
+
id: s.id,
|
|
241
|
+
type: s.type,
|
|
242
|
+
checked: c
|
|
243
|
+
});
|
|
244
|
+
}, l = (s) => {
|
|
245
|
+
s.disabled || m("action", { id: s.id, type: s.type });
|
|
246
|
+
}, a = (s, n) => {
|
|
247
|
+
if (s.disabled) return;
|
|
248
|
+
const e = { id: s.id, type: s.type };
|
|
249
|
+
n !== void 0 && (e.payload = n), m("action", e);
|
|
250
|
+
};
|
|
251
|
+
return (s, n) => (i(), p("div", Ae, [
|
|
252
|
+
(i(!0), p($, null, z(o.actions, (e) => (i(), p($, {
|
|
253
|
+
key: e.id
|
|
254
|
+
}, [
|
|
255
|
+
e.type === "switch" ? (i(), p("label", {
|
|
256
|
+
key: 0,
|
|
257
|
+
class: x(["tr-extension-card-primary-actions__switch", { "is-disabled": e.disabled, "is-danger": e.danger }])
|
|
258
|
+
}, [
|
|
259
|
+
h("input", {
|
|
260
|
+
type: "checkbox",
|
|
261
|
+
role: "switch",
|
|
262
|
+
checked: e.checked,
|
|
263
|
+
disabled: e.disabled,
|
|
264
|
+
"aria-label": e.label,
|
|
265
|
+
onChange: (c) => d(e, c)
|
|
266
|
+
}, null, 40, Ee),
|
|
267
|
+
n[0] || (n[0] = h("span", { class: "tr-extension-card-primary-actions__switch-track" }, null, -1))
|
|
268
|
+
], 2)) : e.type === "button" ? (i(), p("button", {
|
|
269
|
+
key: 1,
|
|
270
|
+
class: x(["tr-extension-card-primary-actions__button", { "is-danger": e.danger }]),
|
|
271
|
+
type: "button",
|
|
272
|
+
"aria-label": e.label,
|
|
273
|
+
disabled: e.disabled,
|
|
274
|
+
onClick: (c) => l(e)
|
|
275
|
+
}, [
|
|
276
|
+
e.icon ? (i(), k(P(e.icon), {
|
|
277
|
+
key: 0,
|
|
278
|
+
class: "tr-extension-card-primary-actions__button-icon"
|
|
279
|
+
})) : g("", !0),
|
|
280
|
+
h("span", null, C(e.label), 1)
|
|
281
|
+
], 10, Pe)) : s.$slots["primary-action"] ? (i(), p("span", {
|
|
282
|
+
key: 2,
|
|
283
|
+
class: x(["tr-extension-card-primary-actions__custom-action", { "is-disabled": e.disabled, "is-danger": e.danger }])
|
|
284
|
+
}, [
|
|
285
|
+
A(s.$slots, "primary-action", {
|
|
286
|
+
action: e,
|
|
287
|
+
trigger: (c) => a(e, c)
|
|
288
|
+
}, void 0, !0)
|
|
289
|
+
], 2)) : (i(), p("button", {
|
|
290
|
+
key: 3,
|
|
291
|
+
class: x(["tr-extension-card-primary-actions__button", { "is-danger": e.danger }]),
|
|
292
|
+
type: "button",
|
|
293
|
+
"aria-label": e.label,
|
|
294
|
+
disabled: e.disabled,
|
|
295
|
+
onClick: (c) => a(e)
|
|
296
|
+
}, [
|
|
297
|
+
e.icon ? (i(), k(P(e.icon), {
|
|
298
|
+
key: 0,
|
|
299
|
+
class: "tr-extension-card-primary-actions__button-icon"
|
|
300
|
+
})) : g("", !0),
|
|
301
|
+
h("span", null, C(e.label), 1)
|
|
302
|
+
], 10, Ie))
|
|
303
|
+
], 64))), 128))
|
|
304
|
+
]));
|
|
305
|
+
}
|
|
306
|
+
}), Te = /* @__PURE__ */ T(Se, [["__scopeId", "data-v-7f997e75"]]), Le = { class: "tr-extension-card" }, Be = { class: "tr-extension-card__icon-region" }, Ne = ["src", "alt"], Re = {
|
|
307
|
+
key: 2,
|
|
308
|
+
class: "tr-extension-card__icon tr-extension-card__icon--placeholder"
|
|
309
|
+
}, Ve = { class: "tr-extension-card__content" }, ze = ["role", "tabindex", "title"], Ge = ["title"], He = ["aria-label", "aria-valuenow"], De = /* @__PURE__ */ S({
|
|
310
|
+
__name: "ExtensionCard",
|
|
311
|
+
props: {
|
|
312
|
+
name: {},
|
|
313
|
+
description: {},
|
|
314
|
+
icon: {},
|
|
315
|
+
actions: { default: () => [] },
|
|
316
|
+
primaryActionsLimit: { default: 1 },
|
|
317
|
+
progress: {},
|
|
318
|
+
nameClickable: { type: Boolean, default: !0 },
|
|
319
|
+
overflowMenuLabel: { default: "更多操作" },
|
|
320
|
+
overflowMenuPlacement: { default: "bottom-end" },
|
|
321
|
+
overflowMenuShowIcons: { type: Boolean, default: !0 }
|
|
322
|
+
},
|
|
323
|
+
emits: ["name-click", "action"],
|
|
324
|
+
setup(t, { emit: u }) {
|
|
325
|
+
const o = t, m = V(), d = u, l = _(() => o.actions.filter((f) => !f.hidden)), a = _(() => Math.max(0, Math.floor(o.primaryActionsLimit))), s = _(() => l.value.slice(0, a.value)), n = _(() => l.value.slice(a.value)), e = _(() => s.value.length > 0 || n.value.length > 0), c = _(() => o.progress === "indeterminate" || o.progress === void 0 ? o.progress : Math.min(100, Math.max(0, o.progress))), b = _(() => !!m["primary-action"]), y = (f) => {
|
|
326
|
+
d("action", f);
|
|
327
|
+
}, w = (f) => {
|
|
328
|
+
o.nameClickable && d("name-click", f);
|
|
329
|
+
}, M = (f) => {
|
|
330
|
+
!o.nameClickable || f.key !== "Enter" && f.key !== " " || (f.preventDefault(), d("name-click", f));
|
|
331
|
+
};
|
|
332
|
+
return (f, r) => (i(), p("div", Le, [
|
|
333
|
+
h("div", Be, [
|
|
334
|
+
typeof t.icon == "string" && t.icon ? (i(), p("img", {
|
|
335
|
+
key: 0,
|
|
336
|
+
src: t.icon,
|
|
337
|
+
alt: t.name,
|
|
338
|
+
class: "tr-extension-card__icon"
|
|
339
|
+
}, null, 8, Ne)) : t.icon ? (i(), k(P(t.icon), {
|
|
340
|
+
key: 1,
|
|
341
|
+
class: "tr-extension-card__icon"
|
|
342
|
+
})) : (i(), p("div", Re, C(t.name.slice(0, 1)), 1))
|
|
343
|
+
]),
|
|
344
|
+
h("div", Ve, [
|
|
345
|
+
h("div", {
|
|
346
|
+
class: x(["tr-extension-card__name", { "is-clickable": t.nameClickable }]),
|
|
347
|
+
role: t.nameClickable ? "button" : void 0,
|
|
348
|
+
tabindex: t.nameClickable ? 0 : void 0,
|
|
349
|
+
title: t.name,
|
|
350
|
+
onClick: w,
|
|
351
|
+
onKeydown: M
|
|
352
|
+
}, C(t.name), 43, ze),
|
|
353
|
+
t.description ? (i(), p("div", {
|
|
354
|
+
key: 0,
|
|
355
|
+
class: "tr-extension-card__description",
|
|
356
|
+
title: t.description
|
|
357
|
+
}, C(t.description), 9, Ge)) : g("", !0)
|
|
358
|
+
]),
|
|
359
|
+
e.value ? (i(), p("div", {
|
|
360
|
+
key: 0,
|
|
361
|
+
class: "tr-extension-card__actions",
|
|
362
|
+
onClick: r[1] || (r[1] = D(() => {
|
|
363
|
+
}, ["stop"])),
|
|
364
|
+
onKeydown: r[2] || (r[2] = D(() => {
|
|
365
|
+
}, ["stop"]))
|
|
366
|
+
}, [
|
|
367
|
+
s.value.length ? (i(), k(Te, {
|
|
368
|
+
key: 0,
|
|
369
|
+
actions: s.value,
|
|
370
|
+
onAction: r[0] || (r[0] = (v) => d("action", v))
|
|
371
|
+
}, se({ _: 2 }, [
|
|
372
|
+
b.value ? {
|
|
373
|
+
name: "primary-action",
|
|
374
|
+
fn: R((v) => [
|
|
375
|
+
A(f.$slots, "primary-action", ie(re(v)), void 0, !0)
|
|
376
|
+
]),
|
|
377
|
+
key: "0"
|
|
378
|
+
} : void 0
|
|
379
|
+
]), 1032, ["actions"])) : g("", !0),
|
|
380
|
+
n.value.length ? (i(), k($e, {
|
|
381
|
+
key: 1,
|
|
382
|
+
actions: n.value,
|
|
383
|
+
label: t.overflowMenuLabel,
|
|
384
|
+
placement: t.overflowMenuPlacement,
|
|
385
|
+
"show-icons": t.overflowMenuShowIcons,
|
|
386
|
+
onAction: y
|
|
387
|
+
}, null, 8, ["actions", "label", "placement", "show-icons"])) : g("", !0)
|
|
388
|
+
], 32)) : g("", !0),
|
|
389
|
+
c.value !== void 0 ? (i(), p("div", {
|
|
390
|
+
key: 1,
|
|
391
|
+
class: "tr-extension-card__progress",
|
|
392
|
+
role: "progressbar",
|
|
393
|
+
"aria-label": t.name,
|
|
394
|
+
"aria-valuemin": "0",
|
|
395
|
+
"aria-valuemax": "100",
|
|
396
|
+
"aria-valuenow": c.value === "indeterminate" ? void 0 : c.value
|
|
397
|
+
}, [
|
|
398
|
+
h("span", {
|
|
399
|
+
class: x(["tr-extension-card__progress-bar", { "is-indeterminate": c.value === "indeterminate" }]),
|
|
400
|
+
style: W(c.value === "indeterminate" ? void 0 : { width: `${c.value}%` })
|
|
401
|
+
}, null, 6)
|
|
402
|
+
], 8, He)) : g("", !0)
|
|
403
|
+
]));
|
|
404
|
+
}
|
|
405
|
+
}), I = /* @__PURE__ */ T(De, [["__scopeId", "data-v-adf5e9c0"]]), Ke = { class: "tr-extension-card-grid" }, We = {
|
|
406
|
+
key: 0,
|
|
407
|
+
class: "tr-extension-card-grid__empty"
|
|
408
|
+
}, je = ["data-card-id"], Fe = /* @__PURE__ */ S({
|
|
409
|
+
__name: "ExtensionCardGrid",
|
|
410
|
+
props: {
|
|
411
|
+
items: {},
|
|
412
|
+
emptyText: { default: "暂无内容" },
|
|
413
|
+
primaryActionsLimit: {},
|
|
414
|
+
nameClickable: { type: Boolean, default: void 0 },
|
|
415
|
+
overflowMenuLabel: {},
|
|
416
|
+
overflowMenuPlacement: {},
|
|
417
|
+
overflowMenuShowIcons: { type: Boolean, default: void 0 }
|
|
418
|
+
},
|
|
419
|
+
emits: ["action", "name-click"],
|
|
420
|
+
setup(t, { emit: u }) {
|
|
421
|
+
const o = t, m = V(), d = u, l = (n) => {
|
|
422
|
+
const { id: e, ...c } = n;
|
|
423
|
+
return {
|
|
424
|
+
...c,
|
|
425
|
+
primaryActionsLimit: n.primaryActionsLimit ?? o.primaryActionsLimit,
|
|
426
|
+
nameClickable: n.nameClickable ?? o.nameClickable,
|
|
427
|
+
overflowMenuLabel: n.overflowMenuLabel ?? o.overflowMenuLabel,
|
|
428
|
+
overflowMenuPlacement: n.overflowMenuPlacement ?? o.overflowMenuPlacement,
|
|
429
|
+
overflowMenuShowIcons: n.overflowMenuShowIcons ?? o.overflowMenuShowIcons
|
|
430
|
+
};
|
|
431
|
+
}, a = (n, e) => {
|
|
432
|
+
d("action", { itemId: n, action: e });
|
|
433
|
+
}, s = (n, e) => {
|
|
434
|
+
d("name-click", { itemId: n, event: e });
|
|
435
|
+
};
|
|
436
|
+
return (n, e) => (i(), p("ul", Ke, [
|
|
437
|
+
t.items.length === 0 ? (i(), p("li", We, [
|
|
438
|
+
A(n.$slots, "empty", {}, () => [
|
|
439
|
+
le(C(t.emptyText), 1)
|
|
440
|
+
], !0)
|
|
441
|
+
])) : (i(!0), p($, { key: 1 }, z(t.items, (c, b) => (i(), p("li", {
|
|
442
|
+
key: c.id,
|
|
443
|
+
class: "tr-extension-card-grid__item",
|
|
444
|
+
"data-card-id": c.id
|
|
445
|
+
}, [
|
|
446
|
+
j(m).item ? A(n.$slots, "item", {
|
|
447
|
+
item: c,
|
|
448
|
+
index: b
|
|
449
|
+
}, void 0, !0, 0) : (i(), k(I, ce({
|
|
450
|
+
key: 1,
|
|
451
|
+
ref_for: !0
|
|
452
|
+
}, l(c), {
|
|
453
|
+
onAction: (y) => a(c.id, y),
|
|
454
|
+
onNameClick: (y) => s(c.id, y)
|
|
455
|
+
}), null, 16, ["onAction", "onNameClick"]))
|
|
456
|
+
], 8, je))), 128))
|
|
457
|
+
]));
|
|
458
|
+
}
|
|
459
|
+
}), B = /* @__PURE__ */ T(Fe, [["__scopeId", "data-v-b736eba6"]]);
|
|
460
|
+
I.name = "TrExtensionCard";
|
|
461
|
+
const Oe = function(t) {
|
|
462
|
+
t.component(I.name, I);
|
|
463
|
+
}, Ue = I;
|
|
464
|
+
Ue.install = Oe;
|
|
465
|
+
B.name = "TrExtensionCardGrid";
|
|
466
|
+
const qe = function(t) {
|
|
467
|
+
t.component(B.name, B);
|
|
468
|
+
}, Je = B;
|
|
469
|
+
Je.install = qe;
|
|
470
|
+
export {
|
|
471
|
+
Ue as ExtensionCard,
|
|
472
|
+
Je as ExtensionCardGrid
|
|
473
|
+
};
|