@opentiny/tiny-robot 0.2.0-alpha.3 → 0.2.0-alpha.4
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 +20 -20
- package/dist/container/index.js +7 -7
- package/dist/feedback/index.js +38 -38
- package/dist/history/index.js +23 -23
- package/dist/index.d.ts +10 -0
- package/dist/question/index.js +297 -243
- package/dist/sender/index.js +504 -415
- package/dist/style.css +1 -1
- package/dist/suggestion/index.js +70 -70
- package/dist/tiny-robot-svgs.js +46 -46
- package/package.json +3 -3
package/dist/question/index.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { Y,
|
|
3
|
-
import { i as
|
|
4
|
-
import { B as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
8
|
-
return
|
|
9
|
-
const
|
|
10
|
-
return
|
|
11
|
-
}),
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
23
|
-
|
|
1
|
+
import { ref as m, computed as A, watch as H, defineComponent as j, onMounted as Z, onBeforeUnmount as ne, createElementBlock as d, openBlock as i, normalizeClass as V, createElementVNode as t, withDirectives as le, Fragment as R, renderList as z, createVNode as M, unref as q, toDisplayString as S, vShow as ie, nextTick as ae, createCommentVNode as U, withModifiers as ce, normalizeStyle as ue, renderSlot as B, createTextVNode as ee, createBlock as K, withCtx as I } from "vue";
|
|
2
|
+
import { Y as X, q as te, _ as se, T as de, N as re } from "../tiny-robot-svgs.js";
|
|
3
|
+
import { i as me } from "../close.js";
|
|
4
|
+
import { B as ve } from "../index3.js";
|
|
5
|
+
function he(v = m([])) {
|
|
6
|
+
const w = m(""), y = m(!1), a = m(!1), r = m("light"), k = A(() => {
|
|
7
|
+
if (!w.value && v.value.length > 0)
|
|
8
|
+
return v.value[0].questions;
|
|
9
|
+
const s = v.value.find((l) => l.id === w.value);
|
|
10
|
+
return s ? s.questions : [];
|
|
11
|
+
}), b = (s) => {
|
|
12
|
+
w.value = s;
|
|
13
|
+
}, p = () => {
|
|
14
|
+
a.value = !0;
|
|
15
|
+
}, _ = () => {
|
|
16
|
+
a.value = !1;
|
|
17
|
+
}, c = () => {
|
|
18
|
+
y.value = !y.value;
|
|
19
|
+
}, x = (s) => {
|
|
20
|
+
const l = document.body;
|
|
21
|
+
if (s) {
|
|
22
|
+
const Q = window.scrollY || document.documentElement.scrollTop;
|
|
23
|
+
l.style.position = "fixed", l.style.width = "100%", l.style.top = `-${Q}px`, l.style.overflowY = "scroll", l.classList.add("tr-modal-open");
|
|
24
24
|
} else
|
|
25
|
-
|
|
25
|
+
l.style.position = "", l.style.width = "", l.style.top = "", l.style.overflowY = "", l.classList.remove("tr-modal-open");
|
|
26
26
|
};
|
|
27
|
-
return
|
|
28
|
-
|
|
27
|
+
return H(a, (s) => {
|
|
28
|
+
x(s);
|
|
29
29
|
}), {
|
|
30
|
-
activeCategory:
|
|
31
|
-
isFloatingExpanded:
|
|
32
|
-
modalVisible:
|
|
33
|
-
currentTheme:
|
|
34
|
-
activeQuestions:
|
|
35
|
-
setActiveCategory:
|
|
36
|
-
openModal:
|
|
37
|
-
closeModal:
|
|
38
|
-
toggleFloating:
|
|
30
|
+
activeCategory: w,
|
|
31
|
+
isFloatingExpanded: y,
|
|
32
|
+
modalVisible: a,
|
|
33
|
+
currentTheme: r,
|
|
34
|
+
activeQuestions: k,
|
|
35
|
+
setActiveCategory: b,
|
|
36
|
+
openModal: p,
|
|
37
|
+
closeModal: _,
|
|
38
|
+
toggleFloating: c,
|
|
39
39
|
toggleTheme: () => {
|
|
40
|
-
|
|
40
|
+
r.value = r.value === "light" ? "dark" : "light", document.documentElement.setAttribute("data-theme", r.value);
|
|
41
41
|
},
|
|
42
|
-
setTheme: (
|
|
43
|
-
|
|
42
|
+
setTheme: (s) => {
|
|
43
|
+
r.value = s, document.documentElement.setAttribute("data-theme", s);
|
|
44
44
|
},
|
|
45
45
|
refreshData: async () => Promise.resolve(),
|
|
46
|
-
toggleBodyScroll:
|
|
46
|
+
toggleBodyScroll: x
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
const
|
|
49
|
+
const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-questions_expanded-wrapper" }, ge = { class: "tr-common-questions_expanded-area" }, ye = ["onClick"], ke = { class: "tr-common-questions_item_icon" }, _e = { class: "tr-common-questions_item_text" }, Ce = { class: "tr-common-questions_container" }, qe = ["onClick"], $e = { class: "tr-common-questions_item_icon" }, we = { class: "tr-common-questions_item_text" }, be = /* @__PURE__ */ j({
|
|
50
50
|
__name: "CommonQuestions",
|
|
51
51
|
props: {
|
|
52
52
|
questions: {
|
|
@@ -58,87 +58,139 @@ const te = ["onClick"], se = { style: { display: "flex", "align-items": "center"
|
|
|
58
58
|
default: !1
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
|
-
emits: ["question-click", "
|
|
62
|
-
setup(
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(
|
|
67
|
-
|
|
61
|
+
emits: ["question-click", "toggle-expand", "hover-change"],
|
|
62
|
+
setup(v, { emit: w }) {
|
|
63
|
+
const y = v, a = w, r = m(null), k = m(!1), b = m(!1), p = m(!1), _ = m([]), c = m([]), x = m(0), f = m(null), o = A(() => c.value.length > 0), u = A(() => {
|
|
64
|
+
if (x.value <= 0 || c.value.length === 0) return [];
|
|
65
|
+
const e = [], h = [...c.value];
|
|
66
|
+
for (; h.length > 0; )
|
|
67
|
+
e.push(h.splice(0, x.value));
|
|
68
|
+
return e.reverse();
|
|
69
|
+
}), s = (e, h, $ = 40) => {
|
|
70
|
+
if (h.length === 0) return 0;
|
|
71
|
+
const E = e.clientWidth, T = 8, g = document.createElement("div");
|
|
72
|
+
g.className = "tr-common-questions_item", g.style.visibility = "hidden", g.style.position = "absolute", e.appendChild(g);
|
|
73
|
+
let O = 0;
|
|
74
|
+
const N = Math.min(3, h.length);
|
|
75
|
+
for (let L = 0; L < N; L++) {
|
|
76
|
+
g.innerHTML = `<span class="icon-placeholder"></span>${h[L].text}`;
|
|
77
|
+
const G = g.offsetWidth + T + 24;
|
|
78
|
+
O += G;
|
|
79
|
+
}
|
|
80
|
+
const W = O / N;
|
|
81
|
+
return e.removeChild(g), {
|
|
82
|
+
maxItemsCount: Math.max(1, Math.floor((E - $) / W))
|
|
83
|
+
};
|
|
84
|
+
}, l = (e, h, $, E = 40) => {
|
|
85
|
+
const g = [], O = [];
|
|
86
|
+
let N = 0;
|
|
87
|
+
if (h.length === 0)
|
|
88
|
+
return { visible: g, hidden: O };
|
|
89
|
+
const W = document.createElement("div");
|
|
90
|
+
W.className = "tr-common-questions_item", W.style.visibility = "hidden", W.style.position = "absolute", e.appendChild(W);
|
|
91
|
+
for (let L = 0; L < h.length; L++) {
|
|
92
|
+
const D = h[L];
|
|
93
|
+
W.innerHTML = `<span class="icon-placeholder"></span>${D.text}`;
|
|
94
|
+
const J = W.offsetWidth + 8 + 24, oe = $ - E;
|
|
95
|
+
N + J <= oe ? (N += J, g.push(D)) : O.push(D);
|
|
96
|
+
}
|
|
97
|
+
return e.removeChild(W), { visible: g, hidden: O };
|
|
98
|
+
};
|
|
99
|
+
H(
|
|
100
|
+
() => y.isExpanded,
|
|
101
|
+
(e) => {
|
|
102
|
+
p.value = e, e ? _.value.pop() : _.value.push(c.value[0]);
|
|
68
103
|
}
|
|
69
104
|
);
|
|
70
|
-
const
|
|
71
|
-
if (await
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
|
|
105
|
+
const Q = async () => {
|
|
106
|
+
if (await ae(), r.value) {
|
|
107
|
+
const e = r.value, h = e.clientWidth, $ = 40;
|
|
108
|
+
if (_.value = [], c.value = [], y.questions.length === 0) {
|
|
109
|
+
b.value = !1;
|
|
75
110
|
return;
|
|
76
111
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const _ = p.questions[B];
|
|
82
|
-
m.textContent = _.text;
|
|
83
|
-
const o = m.offsetWidth + s;
|
|
84
|
-
e + o <= a ? (e += o, f.value.push(_)) : y.value.push(_);
|
|
85
|
-
}
|
|
86
|
-
t.removeChild(m), r.value = y.value.length > 0, g.value = !1, i("show-expand-button", r.value);
|
|
112
|
+
const { maxItemsCount: E } = s(e, y.questions, $);
|
|
113
|
+
x.value = E;
|
|
114
|
+
const { visible: T, hidden: g } = l(e, y.questions, h, $);
|
|
115
|
+
_.value = T, c.value = g, c.value.length > 0 && _.value.push(c.value[0]), b.value = c.value.length > 0, y.isExpanded || (p.value = !1);
|
|
87
116
|
}
|
|
88
|
-
},
|
|
89
|
-
|
|
117
|
+
}, F = () => {
|
|
118
|
+
f.value && (clearTimeout(f.value), f.value = null), k.value = !0, a("hover-change", !0);
|
|
119
|
+
}, P = () => {
|
|
120
|
+
f.value = setTimeout(() => {
|
|
121
|
+
k.value = !1, a("hover-change", !1), f.value = null;
|
|
122
|
+
}, 500);
|
|
123
|
+
}, n = (e) => {
|
|
124
|
+
a("question-click", e);
|
|
90
125
|
};
|
|
91
|
-
|
|
92
|
-
() =>
|
|
126
|
+
H(
|
|
127
|
+
() => y.questions,
|
|
93
128
|
() => {
|
|
94
|
-
|
|
129
|
+
Q();
|
|
95
130
|
},
|
|
96
131
|
{ deep: !0 }
|
|
97
132
|
);
|
|
98
|
-
const
|
|
99
|
-
|
|
133
|
+
const C = () => {
|
|
134
|
+
Q();
|
|
100
135
|
};
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
}),
|
|
104
|
-
window.removeEventListener("resize",
|
|
105
|
-
}), (
|
|
106
|
-
class: V(["tr-common-questions", { expanded:
|
|
136
|
+
return Z(() => {
|
|
137
|
+
Q(), window.addEventListener("resize", C);
|
|
138
|
+
}), ne(() => {
|
|
139
|
+
window.removeEventListener("resize", C), f.value && (window.clearTimeout(f.value), f.value = null);
|
|
140
|
+
}), (e, h) => (i(), d("div", {
|
|
141
|
+
class: V(["tr-common-questions", { expanded: p.value }]),
|
|
107
142
|
ref_key: "commonQuestionsRef",
|
|
108
|
-
ref:
|
|
143
|
+
ref: r,
|
|
144
|
+
onMouseenter: F,
|
|
145
|
+
onMouseleave: P
|
|
109
146
|
}, [
|
|
110
|
-
(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
147
|
+
t("div", pe, [
|
|
148
|
+
t("div", fe, [
|
|
149
|
+
le(t("div", ge, [
|
|
150
|
+
(i(!0), d(R, null, z(u.value, ($, E) => (i(), d("div", {
|
|
151
|
+
key: `row-${E}`,
|
|
152
|
+
class: "tr-common-questions_row"
|
|
153
|
+
}, [
|
|
154
|
+
(i(!0), d(R, null, z($, (T, g) => (i(), d("div", {
|
|
155
|
+
key: `hidden-${T.id}-${g}`,
|
|
156
|
+
class: "tr-common-questions_item",
|
|
157
|
+
onClick: (O) => n(T)
|
|
158
|
+
}, [
|
|
159
|
+
t("div", ke, [
|
|
160
|
+
M(q(X))
|
|
161
|
+
]),
|
|
162
|
+
t("div", _e, S(T.text), 1)
|
|
163
|
+
], 8, ye))), 128))
|
|
164
|
+
]))), 128))
|
|
165
|
+
], 512), [
|
|
166
|
+
[ie, p.value && c.value.length > 0]
|
|
167
|
+
])
|
|
117
168
|
]),
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
169
|
+
t("div", Ce, [
|
|
170
|
+
(i(!0), d(R, null, z(_.value, ($, E) => (i(), d("div", {
|
|
171
|
+
key: `visible-${$.id}-${E}`,
|
|
172
|
+
class: V(["tr-common-questions_item", { "last-item": !p.value && E === _.value.length - 1 && o.value }]),
|
|
173
|
+
onClick: (T) => n($)
|
|
174
|
+
}, [
|
|
175
|
+
t("div", $e, [
|
|
176
|
+
M(q(X))
|
|
177
|
+
]),
|
|
178
|
+
t("div", we, S($.text), 1)
|
|
179
|
+
], 10, qe))), 128))
|
|
180
|
+
])
|
|
181
|
+
])
|
|
182
|
+
], 34));
|
|
131
183
|
}
|
|
132
|
-
}),
|
|
184
|
+
}), xe = { class: "tr-question-header" }, Ee = { style: { display: "flex", "align-items": "center", gap: "12px", "font-size": "36px" } }, Qe = {
|
|
133
185
|
key: 0,
|
|
134
186
|
class: "tr-question-categories"
|
|
135
|
-
},
|
|
187
|
+
}, Te = ["onClick"], We = { class: "category-icon" }, Me = { class: "tr-question-content" }, Be = {
|
|
136
188
|
key: 0,
|
|
137
189
|
class: "tr-question-loading"
|
|
138
|
-
},
|
|
190
|
+
}, Se = { key: 1 }, Oe = ["onClick"], Le = {
|
|
139
191
|
key: 2,
|
|
140
192
|
class: "tr-question-empty"
|
|
141
|
-
},
|
|
193
|
+
}, Ne = /* @__PURE__ */ j({
|
|
142
194
|
__name: "HotQuestions",
|
|
143
195
|
props: {
|
|
144
196
|
visible: {
|
|
@@ -163,105 +215,105 @@ const te = ["onClick"], se = { style: { display: "flex", "align-items": "center"
|
|
|
163
215
|
}
|
|
164
216
|
},
|
|
165
217
|
emits: ["update:visible", "close", "select-category", "question-click"],
|
|
166
|
-
setup(
|
|
167
|
-
const
|
|
168
|
-
if (!
|
|
169
|
-
return
|
|
170
|
-
const
|
|
171
|
-
return
|
|
218
|
+
setup(v, { emit: w }) {
|
|
219
|
+
const y = me(), a = v, r = w, k = m(""), b = A(() => {
|
|
220
|
+
if (!k.value && a.categories.length > 0)
|
|
221
|
+
return a.categories[0].questions || [];
|
|
222
|
+
const o = a.categories.find((u) => u.id === k.value);
|
|
223
|
+
return o ? o.questions : [];
|
|
172
224
|
});
|
|
173
|
-
|
|
174
|
-
() =>
|
|
175
|
-
(
|
|
176
|
-
|
|
225
|
+
H(
|
|
226
|
+
() => a.categories,
|
|
227
|
+
(o) => {
|
|
228
|
+
o.length > 0 && !k.value && (k.value = o[0].id);
|
|
177
229
|
},
|
|
178
230
|
{ immediate: !0 }
|
|
179
231
|
);
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
},
|
|
183
|
-
|
|
232
|
+
const p = () => {
|
|
233
|
+
r("update:visible", !1), r("close");
|
|
234
|
+
}, _ = (o) => {
|
|
235
|
+
k.value = o, r(
|
|
184
236
|
"select-category",
|
|
185
|
-
|
|
237
|
+
a.categories.find((u) => u.id === o)
|
|
186
238
|
);
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
},
|
|
192
|
-
return (
|
|
239
|
+
}, c = (o) => {
|
|
240
|
+
r("question-click", o);
|
|
241
|
+
}, x = (o) => {
|
|
242
|
+
a.closeOnClickOutside && !o.composedPath().includes(f.value) && p();
|
|
243
|
+
}, f = m(null);
|
|
244
|
+
return (o, u) => v.visible ? (i(), d("div", {
|
|
193
245
|
key: 0,
|
|
194
246
|
class: "tr-question-modal-backdrop",
|
|
195
|
-
onMousedown:
|
|
247
|
+
onMousedown: x
|
|
196
248
|
}, [
|
|
197
|
-
|
|
249
|
+
t("div", {
|
|
198
250
|
ref_key: "modalRef",
|
|
199
|
-
ref:
|
|
251
|
+
ref: f,
|
|
200
252
|
class: "tr-question-panel",
|
|
201
|
-
style:
|
|
202
|
-
onMousedown:
|
|
253
|
+
style: ue({ width: v.modalWidth }),
|
|
254
|
+
onMousedown: u[0] || (u[0] = ce(() => {
|
|
203
255
|
}, ["stop"]))
|
|
204
256
|
}, [
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
257
|
+
t("div", xe, [
|
|
258
|
+
t("div", Ee, [
|
|
259
|
+
t("div", null, [
|
|
260
|
+
M(q(te))
|
|
209
261
|
]),
|
|
210
|
-
|
|
262
|
+
u[1] || (u[1] = t("div", { class: "tr-question-header-title" }, "热门问题", -1))
|
|
211
263
|
]),
|
|
212
|
-
|
|
264
|
+
t("span", {
|
|
213
265
|
class: "tr-question-close-btn",
|
|
214
|
-
onClick:
|
|
266
|
+
onClick: p
|
|
215
267
|
}, [
|
|
216
|
-
|
|
217
|
-
icon:
|
|
268
|
+
M(q(ve), {
|
|
269
|
+
icon: q(y),
|
|
218
270
|
type: "text"
|
|
219
271
|
}, null, 8, ["icon"])
|
|
220
272
|
])
|
|
221
273
|
]),
|
|
222
|
-
|
|
223
|
-
(
|
|
224
|
-
key:
|
|
225
|
-
class: V(["tr-question-categories-item", { active:
|
|
226
|
-
onClick: (
|
|
274
|
+
v.categories.length > 0 ? (i(), d("div", Qe, [
|
|
275
|
+
(i(!0), d(R, null, z(v.categories, (s) => (i(), d("div", {
|
|
276
|
+
key: s.id,
|
|
277
|
+
class: V(["tr-question-categories-item", { active: k.value === s.id }]),
|
|
278
|
+
onClick: (l) => _(s.id)
|
|
227
279
|
}, [
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
280
|
+
B(o.$slots, "category-label", { category: s }, () => [
|
|
281
|
+
t("div", We, [
|
|
282
|
+
M(q(se))
|
|
231
283
|
]),
|
|
232
|
-
|
|
284
|
+
t("span", null, S(s.label), 1)
|
|
233
285
|
])
|
|
234
|
-
], 10,
|
|
235
|
-
])) :
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
286
|
+
], 10, Te))), 128))
|
|
287
|
+
])) : U("", !0),
|
|
288
|
+
t("div", Me, [
|
|
289
|
+
v.loading ? (i(), d("div", Be, [
|
|
290
|
+
B(o.$slots, "loading-indicator", {}, () => [
|
|
291
|
+
u[2] || (u[2] = t("div", { class: "tr-question-loading-spinner" }, null, -1))
|
|
240
292
|
])
|
|
241
|
-
])) :
|
|
242
|
-
(
|
|
243
|
-
key:
|
|
293
|
+
])) : b.value.length > 0 ? (i(), d("ul", Se, [
|
|
294
|
+
(i(!0), d(R, null, z(b.value, (s, l) => (i(), d("li", {
|
|
295
|
+
key: s.id,
|
|
244
296
|
class: "tr-question-list-item",
|
|
245
|
-
onClick: (
|
|
297
|
+
onClick: (Q) => c(s)
|
|
246
298
|
}, [
|
|
247
|
-
|
|
248
|
-
question:
|
|
249
|
-
index:
|
|
299
|
+
B(o.$slots, "question-item", {
|
|
300
|
+
question: s,
|
|
301
|
+
index: l
|
|
250
302
|
}, () => [
|
|
251
|
-
|
|
252
|
-
|
|
303
|
+
t("span", null, S(l + 1) + ".", 1),
|
|
304
|
+
ee(" " + S(s.text), 1)
|
|
253
305
|
])
|
|
254
|
-
], 8,
|
|
255
|
-
])) : (
|
|
256
|
-
|
|
257
|
-
|
|
306
|
+
], 8, Oe))), 128))
|
|
307
|
+
])) : (i(), d("div", Le, [
|
|
308
|
+
B(o.$slots, "empty-state", {}, () => [
|
|
309
|
+
u[3] || (u[3] = t("p", null, "暂无相关问题", -1))
|
|
258
310
|
])
|
|
259
311
|
]))
|
|
260
312
|
])
|
|
261
313
|
], 36)
|
|
262
|
-
], 32)) :
|
|
314
|
+
], 32)) : U("", !0);
|
|
263
315
|
}
|
|
264
|
-
}),
|
|
316
|
+
}), Re = ["data-theme"], ze = { class: "tr-question__header" }, Ae = { class: "category-icon" }, Y = /* @__PURE__ */ j({
|
|
265
317
|
__name: "index",
|
|
266
318
|
props: {
|
|
267
319
|
categories: { default: () => [] },
|
|
@@ -273,103 +325,105 @@ const te = ["onClick"], se = { style: { display: "flex", "align-items": "center"
|
|
|
273
325
|
loading: { type: Boolean, default: !1 }
|
|
274
326
|
},
|
|
275
327
|
emits: ["question-click", "select-category"],
|
|
276
|
-
setup(
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
},
|
|
280
|
-
|
|
281
|
-
() =>
|
|
282
|
-
(
|
|
283
|
-
|
|
328
|
+
setup(v, { expose: w, emit: y }) {
|
|
329
|
+
const a = v, r = () => {
|
|
330
|
+
p.value = !p.value;
|
|
331
|
+
}, k = y, b = A(() => a.categories), p = m(a.initialExpanded), _ = m(!1), { modalVisible: c, currentTheme: x, setActiveCategory: f, openModal: o, closeModal: u, setTheme: s, refreshData: l } = he(b);
|
|
332
|
+
H(
|
|
333
|
+
() => a.theme,
|
|
334
|
+
(n) => {
|
|
335
|
+
s(n);
|
|
284
336
|
}
|
|
285
337
|
);
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
},
|
|
289
|
-
|
|
290
|
-
},
|
|
291
|
-
|
|
338
|
+
const Q = (n) => {
|
|
339
|
+
u(), k("question-click", n);
|
|
340
|
+
}, F = (n) => {
|
|
341
|
+
_.value = n;
|
|
342
|
+
}, P = (n) => {
|
|
343
|
+
n && (f(n.id), k("select-category", n));
|
|
292
344
|
};
|
|
293
|
-
return
|
|
294
|
-
document.documentElement.setAttribute("data-theme",
|
|
295
|
-
}),
|
|
296
|
-
openModal:
|
|
297
|
-
closeModal:
|
|
298
|
-
toggleFloating:
|
|
299
|
-
setActiveCategory:
|
|
300
|
-
refreshData:
|
|
301
|
-
}), (
|
|
302
|
-
class: V(["tr-question-container", [`theme-${
|
|
303
|
-
"data-theme":
|
|
345
|
+
return Z(() => {
|
|
346
|
+
document.documentElement.setAttribute("data-theme", x.value);
|
|
347
|
+
}), w({
|
|
348
|
+
openModal: o,
|
|
349
|
+
closeModal: u,
|
|
350
|
+
toggleFloating: r,
|
|
351
|
+
setActiveCategory: f,
|
|
352
|
+
refreshData: l
|
|
353
|
+
}), (n, C) => (i(), d("div", {
|
|
354
|
+
class: V(["tr-question-container", [`theme-${n.theme}`]]),
|
|
355
|
+
"data-theme": n.theme
|
|
304
356
|
}, [
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
357
|
+
t("div", ze, [
|
|
358
|
+
t("div", {
|
|
359
|
+
class: "tr-question__trigger",
|
|
360
|
+
onClick: C[0] || (C[0] = //@ts-ignore
|
|
361
|
+
(...e) => q(o) && q(o)(...e))
|
|
362
|
+
}, [
|
|
363
|
+
M(q(te))
|
|
364
|
+
]),
|
|
365
|
+
M(be, {
|
|
366
|
+
questions: n.commonQuestions,
|
|
367
|
+
isExpanded: p.value,
|
|
368
|
+
onQuestionClick: Q,
|
|
369
|
+
onHoverChange: F
|
|
370
|
+
}, null, 8, ["questions", "isExpanded"]),
|
|
371
|
+
_.value ? (i(), d("div", {
|
|
372
|
+
key: 0,
|
|
373
|
+
class: "tr-question__expand-button",
|
|
374
|
+
onClick: r
|
|
375
|
+
}, [
|
|
376
|
+
p.value ? (i(), K(q(re), { key: 1 })) : (i(), K(q(de), { key: 0 }))
|
|
377
|
+
])) : U("", !0)
|
|
311
378
|
]),
|
|
312
|
-
|
|
313
|
-
visible:
|
|
314
|
-
categories:
|
|
315
|
-
"modal-width":
|
|
316
|
-
loading:
|
|
317
|
-
"close-on-click-outside":
|
|
318
|
-
"onUpdate:visible":
|
|
319
|
-
onClose:
|
|
320
|
-
onQuestionClick:
|
|
321
|
-
onSelectCategory:
|
|
379
|
+
M(Ne, {
|
|
380
|
+
visible: q(c),
|
|
381
|
+
categories: b.value,
|
|
382
|
+
"modal-width": n.modalWidth,
|
|
383
|
+
loading: n.loading,
|
|
384
|
+
"close-on-click-outside": n.closeOnClickOutside,
|
|
385
|
+
"onUpdate:visible": C[1] || (C[1] = (e) => c.value = e),
|
|
386
|
+
onClose: C[2] || (C[2] = (e) => c.value = !1),
|
|
387
|
+
onQuestionClick: Q,
|
|
388
|
+
onSelectCategory: P
|
|
322
389
|
}, {
|
|
323
|
-
"category-label":
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
390
|
+
"category-label": I(({ category: e }) => [
|
|
391
|
+
B(n.$slots, "category-label", { category: e }, () => [
|
|
392
|
+
t("div", Ae, [
|
|
393
|
+
M(q(se))
|
|
327
394
|
]),
|
|
328
|
-
|
|
395
|
+
t("span", null, S(e.label), 1)
|
|
329
396
|
])
|
|
330
397
|
]),
|
|
331
|
-
"question-item":
|
|
332
|
-
|
|
333
|
-
question:
|
|
334
|
-
index:
|
|
398
|
+
"question-item": I(({ question: e, index: h }) => [
|
|
399
|
+
B(n.$slots, "question-item", {
|
|
400
|
+
question: e,
|
|
401
|
+
index: h
|
|
335
402
|
}, () => [
|
|
336
|
-
|
|
337
|
-
|
|
403
|
+
t("span", null, S(h + 1) + ".", 1),
|
|
404
|
+
ee(" " + S(e.text), 1)
|
|
338
405
|
])
|
|
339
406
|
]),
|
|
340
|
-
"loading-indicator":
|
|
341
|
-
|
|
342
|
-
|
|
407
|
+
"loading-indicator": I(() => [
|
|
408
|
+
B(n.$slots, "loading-indicator", {}, () => [
|
|
409
|
+
C[3] || (C[3] = t("div", { class: "tr-question-loading-spinner" }, null, -1))
|
|
343
410
|
])
|
|
344
411
|
]),
|
|
345
|
-
"empty-state":
|
|
346
|
-
|
|
347
|
-
|
|
412
|
+
"empty-state": I(() => [
|
|
413
|
+
B(n.$slots, "empty-state", {}, () => [
|
|
414
|
+
C[4] || (C[4] = t("p", null, "暂无相关问题", -1))
|
|
348
415
|
])
|
|
349
416
|
]),
|
|
350
417
|
_: 3
|
|
351
|
-
}, 8, ["visible", "categories", "modal-width", "loading", "close-on-click-outside"])
|
|
352
|
-
|
|
353
|
-
isExpanded: f.value,
|
|
354
|
-
questions: o.commonQuestions,
|
|
355
|
-
onShowExpandButton: _,
|
|
356
|
-
onQuestionClick: s
|
|
357
|
-
}, null, 8, ["isExpanded", "questions"]),
|
|
358
|
-
B.value ? (l(), u("div", {
|
|
359
|
-
key: 0,
|
|
360
|
-
class: "tr-question-wrap-trigger",
|
|
361
|
-
onClick: d
|
|
362
|
-
}, [
|
|
363
|
-
f.value ? (l(), N(h(K), { key: 1 })) : (l(), N(h(J), { key: 0 }))
|
|
364
|
-
])) : S("", !0)
|
|
365
|
-
], 10, ge));
|
|
418
|
+
}, 8, ["visible", "categories", "modal-width", "loading", "close-on-click-outside"])
|
|
419
|
+
], 10, Re));
|
|
366
420
|
}
|
|
367
421
|
});
|
|
368
|
-
|
|
369
|
-
const
|
|
370
|
-
|
|
422
|
+
Y.name = "TrQuestion";
|
|
423
|
+
const He = function(v) {
|
|
424
|
+
v.component(Y.name, Y);
|
|
371
425
|
};
|
|
372
|
-
|
|
426
|
+
Y.install = He;
|
|
373
427
|
export {
|
|
374
|
-
|
|
428
|
+
Y as default
|
|
375
429
|
};
|