@opentiny/tiny-robot 0.2.0-alpha.3 → 0.2.0-alpha.5
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 +26 -26
- package/dist/bubble/index.js +1 -1
- package/dist/close.js +1 -1
- package/dist/container/index.js +11 -11
- package/dist/dropdown-menu/index.js +70 -0
- package/dist/feedback/index.js +28 -28
- package/dist/flow-layout-buttons/index.js +120 -0
- package/dist/history/index.js +42 -42
- package/dist/icon-button/index.js +17 -16
- package/dist/index.d.ts +387 -65
- package/dist/index.js +55 -40
- package/dist/index2.js +4588 -341
- package/dist/index3.js +457 -3847
- package/dist/index4.js +1 -1
- package/dist/index5.js +3727 -3069
- package/dist/index6.js +3107 -4493
- package/dist/question/index.js +297 -243
- package/dist/sender/index.js +938 -519
- package/dist/shared/index.js +8 -0
- package/dist/style.css +1 -1
- package/dist/suggestion/index.js +90 -90
- package/dist/suggestion-pills/index.js +119 -0
- package/dist/suggestion-popover/index.js +176 -0
- package/dist/tiny-robot-svgs.js +300 -145
- package/package.json +3 -3
package/dist/sender/index.js
CHANGED
|
@@ -1,148 +1,322 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { I as
|
|
3
|
-
import { B as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
(
|
|
11
|
-
|
|
1
|
+
import { ref as x, watch as G, reactive as Se, computed as L, nextTick as P, defineComponent as ce, createElementBlock as D, openBlock as N, createCommentVNode as B, createBlock as H, unref as _, withCtx as j, createVNode as K, normalizeClass as Q, resolveDynamicComponent as Me, createElementVNode as M, onMounted as $e, useSlots as Ae, Transition as re, renderSlot as X, isRef as We, createTextVNode as be, toDisplayString as J, normalizeStyle as Ke, Fragment as we, renderList as _e, withModifiers as Pe } from "vue";
|
|
2
|
+
import { I as He } from "../index6.js";
|
|
3
|
+
import { B as ne } from "../index5.js";
|
|
4
|
+
import { T as ue } from "../index4.js";
|
|
5
|
+
import { i as je } from "../close.js";
|
|
6
|
+
import { I as qe, L as ze, u as Ue, w as Xe, P as Ge, _ as Je } from "../tiny-robot-svgs.js";
|
|
7
|
+
function Qe(n, b) {
|
|
8
|
+
const d = x(n.modelValue || n.defaultValue || ""), t = x(null);
|
|
9
|
+
G(
|
|
10
|
+
() => n.modelValue,
|
|
11
|
+
(g) => {
|
|
12
|
+
g !== void 0 && g !== d.value && (d.value = g);
|
|
12
13
|
}
|
|
13
|
-
),
|
|
14
|
-
() =>
|
|
15
|
-
(
|
|
16
|
-
|
|
14
|
+
), G(
|
|
15
|
+
() => d.value,
|
|
16
|
+
(g) => {
|
|
17
|
+
b("update:modelValue", g);
|
|
17
18
|
}
|
|
18
19
|
);
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
!
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
},
|
|
20
|
+
const m = (g) => {
|
|
21
|
+
d.value = g, b("update:modelValue", g);
|
|
22
|
+
}, s = (g) => {
|
|
23
|
+
g == null || g.preventDefault();
|
|
24
|
+
const S = d.value;
|
|
25
|
+
!n.disabled && !n.loading && S.trim() && b("submit", S);
|
|
26
|
+
}, u = () => {
|
|
27
|
+
d.value = "", b("update:modelValue", ""), b("clear");
|
|
28
|
+
}, o = x(!1);
|
|
28
29
|
return {
|
|
29
|
-
inputValue:
|
|
30
|
-
inputWrapper:
|
|
31
|
-
isComposing:
|
|
32
|
-
handleChange:
|
|
33
|
-
handleSubmit:
|
|
34
|
-
handleClear:
|
|
30
|
+
inputValue: d,
|
|
31
|
+
inputWrapper: t,
|
|
32
|
+
isComposing: o,
|
|
33
|
+
handleChange: m,
|
|
34
|
+
handleSubmit: s,
|
|
35
|
+
handleClear: u,
|
|
35
36
|
clearInput: () => {
|
|
36
|
-
|
|
37
|
+
u();
|
|
37
38
|
}
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
if (!(
|
|
45
|
-
switch (
|
|
41
|
+
function Ye(n, b, d, t, m, s, u, o, e, g, S, a, C) {
|
|
42
|
+
const f = (v) => !n.disabled && !n.loading && v.trim().length > 0, r = () => {
|
|
43
|
+
f(d.value) && b("submit", d.value.trim());
|
|
44
|
+
}, p = (v, A) => {
|
|
45
|
+
if (!(v.key === "Enter")) return !1;
|
|
46
|
+
switch (A) {
|
|
46
47
|
case "enter":
|
|
47
|
-
return !
|
|
48
|
+
return !v.shiftKey && !v.ctrlKey && !v.metaKey;
|
|
48
49
|
case "ctrlEnter":
|
|
49
|
-
return (
|
|
50
|
+
return (v.ctrlKey || v.metaKey) && !v.shiftKey;
|
|
50
51
|
case "shiftEnter":
|
|
51
|
-
return
|
|
52
|
+
return v.shiftKey && !v.ctrlKey && !v.metaKey;
|
|
52
53
|
default:
|
|
53
54
|
return !1;
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
57
|
return {
|
|
57
|
-
handleKeyPress: (
|
|
58
|
-
if (
|
|
59
|
-
if (
|
|
60
|
-
v.
|
|
58
|
+
handleKeyPress: (v) => {
|
|
59
|
+
if (t.value) return;
|
|
60
|
+
if (v.key === "Enter" && v.shiftKey && (a == null ? void 0 : a.value) === "single" && C) {
|
|
61
|
+
v.preventDefault(), C();
|
|
62
|
+
const k = v.target, V = k.selectionStart, l = d.value;
|
|
63
|
+
d.value = l.substring(0, V) + `
|
|
64
|
+
` + l.substring(V), setTimeout(() => {
|
|
65
|
+
k.selectionStart = k.selectionEnd = V + 1;
|
|
66
|
+
}, 0);
|
|
61
67
|
return;
|
|
62
68
|
}
|
|
63
|
-
|
|
69
|
+
if (v.key === "Tab" && s.value && u.value) {
|
|
70
|
+
v.preventDefault(), o();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (s.value) {
|
|
74
|
+
if (v.key === "ArrowDown") {
|
|
75
|
+
v.preventDefault(), g("down");
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (v.key === "ArrowUp") {
|
|
79
|
+
v.preventDefault(), g("up");
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (v.key === "Enter" && u.value) {
|
|
83
|
+
v.preventDefault(), o();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (v.key === "Escape") {
|
|
88
|
+
s.value ? (e(), v.preventDefault()) : m.isRecording && (S(), v.preventDefault()), b("escape-press");
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
p(v, n.submitType) && f(d.value) && (v.preventDefault(), r());
|
|
64
92
|
},
|
|
65
|
-
triggerSubmit:
|
|
93
|
+
triggerSubmit: r
|
|
66
94
|
};
|
|
67
95
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
96
|
+
function Ze(n) {
|
|
97
|
+
const b = (s, u, o) => {
|
|
98
|
+
var f;
|
|
99
|
+
const { startContainer: e, startOffset: g, collapsed: S } = u;
|
|
100
|
+
if (!S) return !1;
|
|
101
|
+
const a = e.nodeType === Node.TEXT_NODE && g === 0 && s.key === "ArrowLeft", C = e.nodeType === Node.TEXT_NODE && g === (((f = e.textContent) == null ? void 0 : f.length) || 0) && s.key === "ArrowRight";
|
|
102
|
+
if (a || C) {
|
|
103
|
+
let r = null, p = "inside";
|
|
104
|
+
if (a)
|
|
105
|
+
if (e.parentNode && e.parentNode.classList.contains("template-field"))
|
|
106
|
+
r = e.parentNode, p = "before";
|
|
107
|
+
else {
|
|
108
|
+
let T = e.previousSibling;
|
|
109
|
+
!T && e.parentNode && e.parentNode !== o && (T = e.parentNode.previousSibling), T && T.nodeType === Node.ELEMENT_NODE && T.classList.contains("template-field") && (r = T, p = "inside");
|
|
110
|
+
}
|
|
111
|
+
else if (C)
|
|
112
|
+
if (e.parentNode && e.parentNode.classList.contains("template-field"))
|
|
113
|
+
r = e.parentNode, p = "after";
|
|
114
|
+
else {
|
|
115
|
+
let T = e.nextSibling;
|
|
116
|
+
!T && e.parentNode && e.parentNode !== o && (T = e.parentNode.nextSibling), T && T.nodeType === Node.ELEMENT_NODE && T.classList.contains("template-field") && (r = T, p = "inside");
|
|
117
|
+
}
|
|
118
|
+
if (r) {
|
|
119
|
+
s.preventDefault();
|
|
120
|
+
const T = document.createRange(), v = window.getSelection();
|
|
121
|
+
return v && (p === "before" ? T.setStartBefore(r) : p === "after" ? T.setStartAfter(r) : (T.selectNodeContents(r), T.collapse(s.key === "ArrowLeft")), v.removeAllRanges(), v.addRange(T)), !0;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (e.nodeType === Node.ELEMENT_NODE && e.classList.contains("template-field") && !e.textContent) {
|
|
125
|
+
s.preventDefault();
|
|
126
|
+
const r = document.createRange(), p = window.getSelection();
|
|
127
|
+
return p && (s.key === "ArrowLeft" ? r.setStartBefore(e) : r.setStartAfter(e), r.collapse(!0), p.removeAllRanges(), p.addRange(r)), !0;
|
|
128
|
+
}
|
|
129
|
+
return !1;
|
|
130
|
+
}, d = (s, u, o) => {
|
|
131
|
+
if (!u.collapsed) return !1;
|
|
132
|
+
const { startContainer: e, startOffset: g } = u;
|
|
133
|
+
if (e.nodeType === Node.TEXT_NODE && e.parentNode && e.parentNode.classList.contains("template-field") && e.textContent && e.textContent.length === 1 && g === 1) {
|
|
134
|
+
s.preventDefault(), e.textContent = "";
|
|
135
|
+
const C = e.parentNode, f = window.getSelection();
|
|
136
|
+
if (f) {
|
|
137
|
+
const r = document.createRange();
|
|
138
|
+
r.selectNodeContents(C), r.collapse(!0), f.removeAllRanges(), f.addRange(r);
|
|
139
|
+
}
|
|
140
|
+
return n.handleInput(), !0;
|
|
141
|
+
}
|
|
142
|
+
if (g === 0) {
|
|
143
|
+
let C = null;
|
|
144
|
+
if (e.nodeType === Node.ELEMENT_NODE && e.classList.contains("template-field") ? C = e : e.nodeType === Node.TEXT_NODE && e.parentNode && e.parentNode.classList.contains("template-field") && (C = e.parentNode), C) {
|
|
145
|
+
s.preventDefault();
|
|
146
|
+
const f = window.getSelection();
|
|
147
|
+
return f && (u.setStartBefore(C), u.collapse(!0), f.removeAllRanges(), f.addRange(u)), !0;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
let a = null;
|
|
151
|
+
return e === o && g > 0 ? a = o.childNodes[g - 1] : e.nodeType === Node.TEXT_NODE && g === 0 && (a = e.previousSibling), a && a.nodeType === Node.ELEMENT_NODE && a.classList.contains("template-field") && a.textContent === "" ? (s.preventDefault(), a.parentNode && a.parentNode.removeChild(a), n.handleInput(), !0) : !1;
|
|
152
|
+
}, t = (s, u, o) => {
|
|
153
|
+
var C;
|
|
154
|
+
if (!u.collapsed) return !1;
|
|
155
|
+
const { startContainer: e, startOffset: g } = u;
|
|
156
|
+
if (e.nodeType === Node.TEXT_NODE && e.parentNode && e.parentNode.classList.contains("template-field") && e.textContent && g === e.textContent.length && e.textContent.length === 1) {
|
|
157
|
+
s.preventDefault(), e.textContent = "";
|
|
158
|
+
const f = e.parentNode, r = window.getSelection();
|
|
159
|
+
if (r) {
|
|
160
|
+
const p = document.createRange();
|
|
161
|
+
p.selectNodeContents(f), p.collapse(!0), r.removeAllRanges(), r.addRange(p);
|
|
162
|
+
}
|
|
163
|
+
return n.handleInput(), !0;
|
|
164
|
+
}
|
|
165
|
+
let a = null;
|
|
166
|
+
return e === o && g < o.childNodes.length ? a = o.childNodes[g] : e.nodeType === Node.TEXT_NODE && g === (((C = e.textContent) == null ? void 0 : C.length) || 0) && (a = e.nextSibling), a && a.nodeType === Node.ELEMENT_NODE && a.classList.contains("template-field") && a.textContent === "" ? (s.preventDefault(), a.parentNode && a.parentNode.removeChild(a), n.handleInput(), !0) : !1;
|
|
167
|
+
};
|
|
168
|
+
return {
|
|
169
|
+
handleTemplateKeyDown: (s) => {
|
|
170
|
+
if (n.isComposing.value) return;
|
|
171
|
+
const u = n.editor.value;
|
|
172
|
+
if (!u) return;
|
|
173
|
+
const o = window.getSelection();
|
|
174
|
+
if (!o || o.rangeCount === 0) return;
|
|
175
|
+
const e = o.getRangeAt(0);
|
|
176
|
+
if (s.key === "Enter") {
|
|
177
|
+
s.preventDefault(), n.onSubmit(n.getValueFromDOM());
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
(s.key === "ArrowLeft" || s.key === "ArrowRight") && !s.shiftKey && b(s, e, u) || s.key === "Backspace" && d(s, e, u) || s.key === "Delete" && t(s, e, u);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function et(n) {
|
|
185
|
+
const b = Se({
|
|
70
186
|
isRecording: !1,
|
|
71
187
|
isSupported: typeof window < "u" && "webkitSpeechRecognition" in window || "SpeechRecognition" in window,
|
|
72
188
|
error: void 0
|
|
73
|
-
}),
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
var
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
var
|
|
86
|
-
|
|
189
|
+
}), d = b.isSupported ? new (window.webkitSpeechRecognition || window.SpeechRecognition)() : void 0;
|
|
190
|
+
d !== void 0 && (d.continuous = n.continuous ?? !1, d.interimResults = n.interimResults ?? !0, d.lang = n.lang ?? navigator.language, d.onstart = () => {
|
|
191
|
+
var u;
|
|
192
|
+
b.isRecording = !0, b.error = void 0, (u = n.onStart) == null || u.call(n);
|
|
193
|
+
}, d.onend = () => {
|
|
194
|
+
var u;
|
|
195
|
+
b.isRecording = !1, (u = n.onEnd) == null || u.call(n);
|
|
196
|
+
}, d.onresult = (u) => {
|
|
197
|
+
var e, g;
|
|
198
|
+
const o = Array.from(u.results).map((S) => S[0].transcript).join("");
|
|
199
|
+
u.results[0].isFinal ? (e = n.onFinal) == null || e.call(n, o) : (g = n.onInterim) == null || g.call(n, o);
|
|
200
|
+
}, d.onerror = (u) => {
|
|
201
|
+
var o;
|
|
202
|
+
b.error = new Error(u.error), b.isRecording = !1, (o = n.onError) == null || o.call(n, b.error);
|
|
87
203
|
});
|
|
88
|
-
const
|
|
89
|
-
var
|
|
90
|
-
if (!
|
|
91
|
-
const
|
|
92
|
-
|
|
204
|
+
const t = () => {
|
|
205
|
+
var u;
|
|
206
|
+
if (!d) {
|
|
207
|
+
const o = new Error("浏览器不支持语音识别");
|
|
208
|
+
b.error = o, (u = n.onError) == null || u.call(n, o);
|
|
93
209
|
return;
|
|
94
210
|
}
|
|
95
|
-
if (
|
|
211
|
+
if (b.isRecording) {
|
|
96
212
|
try {
|
|
97
|
-
|
|
213
|
+
d.stop(), setTimeout(() => {
|
|
98
214
|
try {
|
|
99
|
-
|
|
100
|
-
} catch (
|
|
101
|
-
|
|
215
|
+
d.start();
|
|
216
|
+
} catch (o) {
|
|
217
|
+
s(o);
|
|
102
218
|
}
|
|
103
219
|
}, 100);
|
|
104
|
-
} catch (
|
|
105
|
-
|
|
220
|
+
} catch (o) {
|
|
221
|
+
s(o);
|
|
106
222
|
}
|
|
107
223
|
return;
|
|
108
224
|
}
|
|
109
225
|
try {
|
|
110
|
-
|
|
111
|
-
} catch (
|
|
112
|
-
|
|
226
|
+
d.start();
|
|
227
|
+
} catch (o) {
|
|
228
|
+
s(o);
|
|
113
229
|
}
|
|
114
|
-
},
|
|
115
|
-
if (
|
|
230
|
+
}, m = () => {
|
|
231
|
+
if (d && b.isRecording)
|
|
116
232
|
try {
|
|
117
|
-
|
|
118
|
-
} catch (
|
|
119
|
-
|
|
233
|
+
d.stop();
|
|
234
|
+
} catch (u) {
|
|
235
|
+
s(u);
|
|
120
236
|
}
|
|
121
|
-
},
|
|
122
|
-
var
|
|
123
|
-
|
|
237
|
+
}, s = (u) => {
|
|
238
|
+
var o;
|
|
239
|
+
b.error = u instanceof Error ? u : new Error("语音识别操作失败"), b.isRecording = !1, (o = n.onError) == null || o.call(n, b.error);
|
|
124
240
|
};
|
|
125
241
|
return {
|
|
126
|
-
speechState:
|
|
127
|
-
start:
|
|
128
|
-
stop:
|
|
242
|
+
speechState: b,
|
|
243
|
+
start: t,
|
|
244
|
+
stop: m
|
|
129
245
|
};
|
|
130
246
|
}
|
|
131
|
-
const L0 = "data:image/svg+xml,%3csvg%20width='32.000000'%20height='32.000000'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdesc%3e%20Created%20with%20Pixso.%20%3c/desc%3e%3cdefs/%3e%3crect%20id='矩形'%20rx='8.000000'%20width='32.000000'%20height='32.000000'%20fill='%23000000'%20fill-opacity='0'/%3e%3crect%20id='矩形'%20x='0.500000'%20y='0.500000'%20rx='8.000000'%20width='31.000000'%20height='31.000000'%20stroke='%23979797'%20stroke-opacity='0'%20stroke-width='1.000000'/%3e%3crect%20id='矩形'%20x='4.000000'%20y='4.000000'%20width='24.000000'%20height='24.000000'%20fill='%23D8D8D8'%20fill-opacity='0'/%3e%3crect%20id='矩形'%20x='4.500000'%20y='4.500000'%20width='23.000000'%20height='23.000000'%20stroke='%23979797'%20stroke-opacity='0'%20stroke-width='1.000000'/%3e%3cpath%20id='路径%203'%20d='M13.37%2010.32L13.23%2010.26L15.44%2011.19L12.61%2018.98C12.2%2020.11%2012.81%2021.36%2013.95%2021.72C15.04%2022.07%2016.2%2021.5%2016.59%2020.43L19.35%2012.85L18.8%2012.65L18.79%2012.62C18.79%2012.61%2018.8%2012.61%2018.8%2012.6L15.44%2011.19L15.83%2010.14C16.49%208.31%2018.52%207.37%2020.35%208.03C22.18%208.7%2023.12%2010.72%2022.46%2012.55L19.15%2021.65C18.21%2024.21%2015.38%2025.54%2012.82%2024.6C10.25%2023.67%208.93%2020.83%209.86%2018.27L12.83%2010.12L12.28%209.92L12.27%209.9C12.39%209.58%2012.73%209.42%2013.04%209.54C13.36%209.65%2013.52%209.99%2013.4%2010.31L13.37%2010.32Z'%20fill='%23D8D8D8'%20fill-opacity='0'%20fill-rule='evenodd'/%3e%3cpath%20id='路径%203'%20d='M12.84%2010.1L9.86%2018.27C8.93%2020.83%2010.25%2023.67%2012.82%2024.6C15.38%2025.54%2018.21%2024.21%2019.15%2021.65L22.46%2012.55C23.12%2010.72%2022.18%208.7%2020.35%208.03C18.52%207.37%2016.49%208.31%2015.83%2010.14L12.61%2018.98C12.2%2020.11%2012.81%2021.36%2013.95%2021.72C15.04%2022.07%2016.2%2021.5%2016.59%2020.43L19.35%2012.83'%20stroke='%23595959'%20stroke-opacity='1.000000'%20stroke-width='1.200000'%20stroke-linecap='round'/%3e%3c/svg%3e", w0 = "data:image/svg+xml,%3csvg%20width='32.000000'%20height='32.000000'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdesc%3e%20Created%20with%20Pixso.%20%3c/desc%3e%3cdefs%3e%3clinearGradient%20x1='12.999998'%20y1='21.128080'%20x2='20.000002'%20y2='6.999999'%20id='paint_linear_447_301_0'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23E280FF'/%3e%3cstop%20offset='0.517615'%20stop-color='%236686FF'/%3e%3cstop%20offset='1.000000'%20stop-color='%234DDDFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3crect%20id='矩形'%20rx='8.000000'%20width='32.000000'%20height='32.000000'%20fill='%23000000'%20fill-opacity='0'/%3e%3crect%20id='矩形'%20x='0.500000'%20y='0.500000'%20rx='8.000000'%20width='31.000000'%20height='31.000000'%20stroke='%23979797'%20stroke-opacity='0'%20stroke-width='1.000000'/%3e%3crect%20id='矩形'%20x='4.000000'%20y='4.000000'%20width='24.000000'%20height='24.000000'%20fill='%23D8D8D8'%20fill-opacity='0'/%3e%3crect%20id='矩形'%20x='4.500000'%20y='4.500000'%20width='23.000000'%20height='23.000000'%20stroke='%23979797'%20stroke-opacity='0'%20stroke-width='1.000000'/%3e%3crect%20id='矩形'%20x='13.000000'%20y='7.000000'%20rx='3.500000'%20width='7.000000'%20height='11.000000'%20fill='url(%23paint_linear_447_301_0)'%20fill-opacity='0'/%3e%3crect%20id='矩形'%20x='13.000000'%20y='7.000000'%20rx='3.500000'%20width='7.000000'%20height='11.000000'%20stroke='%23595959'%20stroke-opacity='1.000000'%20stroke-width='1.200000'%20stroke-linejoin='round'/%3e%3cpath%20id='路径'%20d='M8.41%2014.02L8.39%2014C8.39%2013.66%208.66%2013.4%209%2013.4C9.33%2013.4%209.6%2013.66%209.6%2014L23.39%2014C23.39%2013.66%2023.66%2013.4%2024%2013.4C24.33%2013.4%2024.6%2013.66%2024.6%2014L24.58%2014.02L24%2014.02C23.98%2018.42%2020.63%2022%2016.5%2022C12.36%2022%209.01%2018.42%209%2014.02L8.41%2014.02Z'%20fill='%23D8D8D8'%20fill-opacity='0'%20fill-rule='evenodd'/%3e%3cpath%20id='路径'%20d='M9%2014C9%2018.41%2012.35%2022%2016.5%2022C20.64%2022%2024%2018.41%2024%2014'%20stroke='%23595959'%20stroke-opacity='1.000000'%20stroke-width='1.200000'%20stroke-linecap='round'/%3e%3cpath%20id='路径%202'%20d='M15.91%2022.6L15.89%2022.58C15.89%2022.24%2016.16%2021.98%2016.5%2021.98C16.83%2021.98%2017.1%2022.24%2017.1%2022.58L17.08%2022.6L15.91%2022.6ZM17.08%2025.34L17.1%2025.36C17.1%2025.7%2016.83%2025.96%2016.5%2025.96C16.16%2025.96%2015.89%2025.7%2015.89%2025.36L15.91%2025.34L17.08%2025.34Z'%20fill='%23D8D8D8'%20fill-opacity='0'%20fill-rule='nonzero'/%3e%3cpath%20id='路径%202'%20d='M16.5%2022.58L16.5%2025.36'%20stroke='%23595959'%20stroke-opacity='1.000000'%20stroke-width='1.200000'%20stroke-linecap='round'/%3e%3c/svg%3e", k0 = "data:image/svg+xml,%3csvg%20width='152.343506'%20height='18.000000'%20viewBox='0%200%20152.344%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdesc%3e%20Created%20with%20Pixso.%20%3c/desc%3e%3cdefs%3e%3clinearGradient%20x1='159.655945'%20y1='6.532532'%20x2='-2.217805'%20y2='3.665466'%20id='paint_linear_498_7491_0'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23E6FF7D'%20stop-opacity='0.200000'/%3e%3cstop%20offset='0.264015'%20stop-color='%23FFB22E'%20stop-opacity='0.200000'/%3e%3cstop%20offset='0.522782'%20stop-color='%2397A7FF'%20stop-opacity='0.258824'/%3e%3cstop%20offset='0.702223'%20stop-color='%2376ADFF'%20stop-opacity='0.400000'/%3e%3cstop%20offset='0.830214'%20stop-color='%2367D1FF'%20stop-opacity='0.301961'/%3e%3cstop%20offset='1.000000'%20stop-color='%23D27EFF'%20stop-opacity='0.090196'/%3e%3c/linearGradient%3e%3c/defs%3e%3cpath%20id='Fill%203'%20d='M9.52%209.61C12.69%209.9%2015.86%2010.31%2019.04%2010.74C20.63%2010.94%2022.21%2011.28%2023.8%2011.78C25.39%2012.26%2026.97%2012.84%2028.56%2013.26C30.15%2013.67%2031.73%2013.89%2033.32%2013.89C34.11%2013.88%2034.91%2013.69%2035.7%2013.33C36.49%2012.98%2037.29%2012.49%2038.08%2012.06C38.87%2011.63%2039.67%2011.29%2040.46%2011.19C40.86%2011.13%2041.25%2011.13%2041.65%2011.17C42.05%2011.22%2042.45%2011.31%2042.84%2011.39C44.43%2011.75%2046.02%2012.36%2047.6%2013.19C50.78%2014.81%2053.95%2016.29%2057.12%2017.28C60.3%2018.29%2063.47%2018.26%2066.65%2016.96C69.82%2015.68%2072.99%2014.04%2076.17%2012.73C79.34%2011.4%2082.51%2011.19%2085.69%2011.85C88.86%2012.53%2092.04%2014.04%2095.21%2014.41C96%2014.51%2096.8%2014.56%2097.59%2014.56C98.38%2014.55%2099.18%2014.5%2099.97%2014.46C101.56%2014.35%20103.14%2014.18%20104.73%2013.94C107.91%2013.45%20111.08%2012.64%20114.25%2011.93C117.43%2011.19%20120.6%2010.62%20123.77%2010.26C126.95%209.88%20130.12%209.49%20133.3%209.28C136.47%209.06%20139.64%209%20142.82%209L152.34%209L142.82%209C139.64%208.99%20136.47%208.93%20133.3%208.71C130.12%208.5%20126.95%208.11%20123.77%207.73C120.6%207.37%20117.43%206.8%20114.25%206.06C111.08%205.35%20107.91%204.54%20104.73%204.05C103.14%203.81%20101.56%203.64%2099.97%203.53C99.18%203.49%2098.38%203.44%2097.59%203.43C96.8%203.43%2096%203.48%2095.21%203.58C92.04%203.95%2088.86%205.46%2085.69%206.14C82.51%206.8%2079.34%206.59%2076.17%205.26C72.99%203.95%2069.82%202.31%2066.65%201.03C63.47%20-0.27%2060.3%20-0.31%2057.12%200.71C53.95%201.7%2050.78%203.18%2047.6%204.8C46.02%205.63%2044.43%206.24%2042.84%206.6C42.45%206.68%2042.05%206.77%2041.65%206.82C41.25%206.86%2040.86%206.86%2040.46%206.8C39.67%206.7%2038.87%206.36%2038.08%205.93C37.29%205.51%2036.49%205.01%2035.7%204.66C34.91%204.3%2034.11%204.11%2033.32%204.1C31.73%204.1%2030.15%204.32%2028.56%204.73C26.97%205.15%2025.39%205.73%2023.8%206.21C22.21%206.71%2020.63%207.05%2019.04%207.25C15.86%207.68%2012.69%208.09%209.52%208.38C6.34%208.69%203.17%208.94%200%209C3.17%209.05%206.34%209.3%209.52%209.61Z'%20fill='url(%23paint_linear_498_7491_0)'%20fill-opacity='1.000000'%20fill-rule='evenodd'/%3e%3c/svg%3e", _0 = "data:image/svg+xml,%3csvg%20width='36'%20height='36'%20viewBox='0%200%2036%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdesc%3e%20Created%20with%20Pixso.%20%3c/desc%3e%3cdefs%3e%3cfilter%20id='filter_447_4247_dd'%20x='0'%20y='0'%20width='36'%20height='36'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dx='0'%20dy='2'/%3e%3cfeGaussianBlur%20stdDeviation='1.66667'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='out'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.039%200'/%3e%3cfeBlend%20mode='normal'%20in2='BackgroundImageFix'%20result='effect_dropShadow_1'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='effect_dropShadow_1'%20result='shape'/%3e%3c/filter%3e%3c/defs%3e%3cg%20filter='url(%23filter_447_4247_dd)'%3e%3crect%20id='Rectangle'%20x='0'%20y='0'%20rx='18'%20width='36'%20height='36'%20fill='%231476FF'%20fill-opacity='1'/%3e%3c/g%3e%3cpath%20id='Fill%201'%20d='M26.38%208.7L7.99%2017.45C7.59%2017.64%207.58%2018.21%207.98%2018.4L12.56%2020.7C12.78%2020.81%2013.05%2020.77%2013.23%2020.62L23.54%2011.95C23.71%2011.81%2023.94%2012.05%2023.78%2012.21L14.9%2021.42C14.72%2021.61%2014.63%2021.87%2014.66%2022.14L15.21%2026.9C15.26%2027.36%2015.83%2027.54%2016.14%2027.19L18.36%2024.65C18.49%2024.5%2018.46%2024.25%2018.29%2024.13L16.45%2022.88C16.34%2022.81%2016.44%2022.64%2016.56%2022.7L19%2023.92L21.87%2025.35C22.17%2025.5%2022.52%2025.35%2022.62%2025.03L27.44%209.62C27.64%208.98%2026.98%208.41%2026.38%208.7Z'%20fill='%23FFFFFF'%20fill-opacity='1'%20fill-rule='evenodd'/%3e%3c/svg%3e", b0 = "data:image/svg+xml,%3csvg%20width='102.000000'%20height='36.000000'%20viewBox='0%200%20102%2036'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdesc%3e%20Created%20with%20Pixso.%20%3c/desc%3e%3cdefs/%3e%3crect%20id='沉浸式/输入框/停止生成按钮'%20rx='18.000000'%20width='102.000000'%20height='36.000000'%20fill='%231476FF'%20fill-opacity='0.060000'/%3e%3cpath%20id='停止回答'%20d='M79.96%2013.66L78.75%2013.66C78.4%2014.31%2078.01%2014.92%2077.56%2015.46L76.71%2014.92C77.59%2013.85%2078.23%2012.69%2078.63%2011.42L79.59%2011.63C79.47%2012.01%2079.33%2012.37%2079.19%2012.73L82.95%2012.73L82.95%2013.66L80.98%2013.66C81.25%2014.1%2081.47%2014.53%2081.64%2014.92L80.73%2015.25C80.5%2014.69%2080.24%2014.16%2079.96%2013.66ZM85.88%2013.66L84.54%2013.66C84.28%2014.09%2084%2014.5%2083.71%2014.89L82.87%2014.37C83.6%2013.49%2084.12%2012.51%2084.44%2011.43L85.4%2011.64C85.28%2012.03%2085.14%2012.4%2085%2012.73L89.2%2012.73L89.2%2013.66L86.93%2013.66C87.26%2014.19%2087.54%2014.69%2087.76%2015.14L86.84%2015.46Q86.42%2014.52%2085.88%2013.66ZM34.48%2017.26C35.8%2015.57%2036.77%2013.64%2037.37%2011.49L38.31%2011.92C37.98%2012.96%2037.59%2013.95%2037.13%2014.87L37.13%2024.4L36.11%2024.4L36.11%2016.62C35.72%2017.21%2035.28%2017.79%2034.82%2018.32L34.48%2017.26ZM41.56%2011.65L42.58%2011.49C42.72%2011.84%2042.84%2012.24%2042.98%2012.69L46.97%2012.69L46.97%2013.59L38.31%2013.59L38.31%2012.69L41.98%2012.69C41.85%2012.33%2041.71%2011.98%2041.56%2011.65ZM55.09%2022.81L55.09%2011.63L56.13%2011.63L56.13%2016.18L60.44%2016.18L60.44%2017.16L56.13%2017.16L56.13%2022.81L61.21%2022.81L61.21%2023.79L48.78%2023.79L48.78%2022.81L51.16%2022.81L51.16%2014.08L52.17%2014.08L52.17%2022.81L55.09%2022.81ZM63.38%2012.4L74.61%2012.4L74.61%2024.17L73.63%2024.17L73.63%2023.57L64.36%2023.57L64.36%2024.17L63.38%2024.17L63.38%2012.4ZM64.36%2013.29L64.36%2022.67L73.63%2022.67L73.63%2013.29L64.36%2013.29ZM39.23%2017.04L39.23%2014.4L45.9%2014.4L45.9%2017.04L39.23%2017.04ZM79.78%2018.65L79.78%2018.03C78.96%2018.46%2078.08%2018.87%2077.14%2019.24L76.67%2018.36C79.06%2017.46%2081.05%2016.34%2082.65%2015.01L83.32%2015.01C85.08%2016.44%2087.11%2017.56%2089.41%2018.39L88.92%2019.26C87.96%2018.89%2087.07%2018.47%2086.24%2018.03L86.24%2018.65L79.78%2018.65ZM40.21%2016.28L44.92%2016.28L44.92%2015.17L40.21%2015.17L40.21%2016.28ZM66.31%2020.45L66.31%2015.46L71.71%2015.46L71.71%2020.45L66.31%2020.45ZM80.32%2017.72L85.7%2017.72C84.7%2017.14%2083.79%2016.5%2082.98%2015.8C82.21%2016.48%2081.33%2017.13%2080.32%2017.72ZM67.25%2019.59L70.76%2019.59L70.76%2016.33L67.25%2016.33L67.25%2019.59ZM38.18%2017.86L47%2017.86L47%2020.25L46.25%2020.25L46.25%2020.88L43.22%2020.88L43.22%2023.15C43.22%2023.9%2042.8%2024.3%2041.99%2024.3L40.41%2024.3L40.2%2023.32C40.7%2023.34%2041.18%2023.37%2041.64%2023.37C42%2023.37%2042.18%2023.2%2042.18%2022.9L42.18%2020.88L39.12%2020.88L39.12%2020.25L38.18%2020.25L38.18%2017.86ZM39.16%2018.74L39.16%2020.01L46.04%2020.01L46.04%2018.74L39.16%2018.74ZM78.81%2019.96L87.18%2019.96L87.18%2024.38L86.21%2024.38L86.21%2023.75L79.78%2023.75L79.78%2024.38L78.81%2024.38L78.81%2019.96ZM79.78%2020.88L79.78%2022.83L86.21%2022.83L86.21%2020.88L79.78%2020.88Z'%20fill='%231476FF'%20fill-opacity='1.000000'%20fill-rule='evenodd'/%3e%3crect%20id='矩形'%20x='7.713867'%20y='7.714844'%20width='20.571428'%20height='20.571428'%20fill='%23D8D8D8'%20fill-opacity='0'/%3e%3crect%20id='矩形'%20x='8.213867'%20y='8.214844'%20width='19.571428'%20height='19.571428'%20stroke='%23979797'%20stroke-opacity='0'%20stroke-width='1.000000'/%3e%3crect%20id='矩形'%20x='6.000000'%20y='6.000000'%20width='24.000000'%20height='24.000000'%20fill='%23D8D8D8'%20fill-opacity='0'/%3e%3crect%20id='矩形'%20x='6.500000'%20y='6.500000'%20width='23.000000'%20height='23.000000'%20stroke='%23979797'%20stroke-opacity='0'%20stroke-width='1.000000'/%3e%3crect%20id='矩形'%20x='14.666992'%20y='14.666016'%20rx='1.500000'%20width='6.666667'%20height='6.666667'%20fill='%231476FF'%20fill-opacity='1.000000'/%3e%3ccircle%20id='椭圆形'%20cx='18.000000'%20cy='18.000000'%20r='8.250000'%20fill='%23D8D8D8'%20fill-opacity='0'/%3e%3ccircle%20id='椭圆形'%20cx='18.000000'%20cy='18.000000'%20r='8.250000'%20stroke='%231476FF'%20stroke-opacity='1.000000'%20stroke-width='1.500000'/%3e%3cpath%20id='路径'%20d='M17.8%2010.47C17.48%2010.39%2017.25%2010.1%2017.25%209.75C17.25%209.33%2017.58%209%2018%209L18.02%209.02L18.02%209.75C22.56%209.76%2026.25%2013.45%2026.25%2018C26.25%2022.55%2022.55%2026.25%2018%2026.25C16.52%2026.25%2015.13%2025.86%2013.93%2025.18L13.57%2025.81L13.54%2025.82C13.18%2025.61%2013.06%2025.16%2013.26%2024.8C13.44%2024.49%2013.78%2024.35%2014.11%2024.44L17.8%2010.47Z'%20fill='%23595959'%20fill-opacity='0'%20fill-rule='evenodd'/%3e%3cpath%20id='路径'%20d='M13.91%2025.17C15.12%2025.85%2016.51%2026.25%2018%2026.25C22.55%2026.25%2026.25%2022.55%2026.25%2018C26.25%2013.44%2022.55%209.75%2018%209.75'%20stroke='%231476FF'%20stroke-opacity='1.000000'%20stroke-width='1.500000'%20stroke-linecap='round'/%3e%3c/svg%3e", F0 = { class: "action-buttons" }, x0 = {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
},
|
|
247
|
+
const tt = (n, b) => {
|
|
248
|
+
if (!b || !n)
|
|
249
|
+
return [{ text: n, isMatch: !1 }];
|
|
250
|
+
const d = n.toLowerCase(), t = b.toLowerCase(), m = d.indexOf(t);
|
|
251
|
+
if (m === -1)
|
|
252
|
+
return [{ text: n, isMatch: !1 }];
|
|
253
|
+
const s = [];
|
|
254
|
+
return m > 0 && s.push({
|
|
255
|
+
text: n.substring(0, m),
|
|
256
|
+
isMatch: !1
|
|
257
|
+
}), s.push({
|
|
258
|
+
text: n.substring(m, m + b.length),
|
|
259
|
+
isMatch: !0
|
|
260
|
+
}), m + b.length < n.length && s.push({
|
|
261
|
+
text: n.substring(m + b.length),
|
|
262
|
+
isMatch: !1
|
|
263
|
+
}), s;
|
|
264
|
+
};
|
|
265
|
+
function nt(n, b, d, t) {
|
|
266
|
+
const m = x(!1), s = x(-1), u = x(""), o = x(!1), e = x(null), g = x(!1), S = L(() => {
|
|
267
|
+
if (!n.suggestions || !d.value || n.template) return [];
|
|
268
|
+
const k = d.value.toLowerCase();
|
|
269
|
+
return n.suggestions.filter((V) => V.toLowerCase().includes(k));
|
|
270
|
+
}), a = L(() => S.value[s.value] || null), C = (k) => {
|
|
271
|
+
const V = k || (S.value.length > 0 ? S.value[0] : null);
|
|
272
|
+
V && d.value && V.toLowerCase().startsWith(d.value.toLowerCase()) ? u.value = V.substring(d.value.length) : u.value = "";
|
|
273
|
+
};
|
|
274
|
+
G(d, (k) => {
|
|
275
|
+
t.value || g.value || (k && n.suggestions && n.suggestions.length > 0 && !n.template ? (m.value = S.value.length > 0, m.value ? (s.value = 0, C(), o.value = !0) : (s.value = -1, u.value = "", o.value = !1)) : (m.value = !1, s.value = -1, u.value = "", o.value = !1));
|
|
276
|
+
});
|
|
277
|
+
const f = (k) => {
|
|
278
|
+
g.value = !0, d.value = k, b("update:modelValue", k), b("suggestion-select", k), p(), P(() => {
|
|
279
|
+
g.value = !1;
|
|
280
|
+
});
|
|
281
|
+
}, r = () => {
|
|
282
|
+
a.value && f(a.value);
|
|
283
|
+
}, p = () => {
|
|
284
|
+
m.value = !1, o.value = !1, u.value = "", s.value = -1;
|
|
285
|
+
};
|
|
286
|
+
return {
|
|
287
|
+
showSuggestionsPopup: m,
|
|
288
|
+
highlightedIndex: s,
|
|
289
|
+
completionPlaceholder: u,
|
|
290
|
+
showTabHint: o,
|
|
291
|
+
suggestionsListRef: e,
|
|
292
|
+
filteredSuggestions: S,
|
|
293
|
+
activeSuggestion: a,
|
|
294
|
+
updateCompletionPlaceholder: C,
|
|
295
|
+
selectSuggestion: f,
|
|
296
|
+
acceptCurrentSuggestion: r,
|
|
297
|
+
closeSuggestionsPopup: p,
|
|
298
|
+
navigateSuggestions: (k) => {
|
|
299
|
+
if (!m.value || S.value.length === 0) return;
|
|
300
|
+
k === "down" ? s.value = (s.value + 1) % S.value.length : s.value = (s.value - 1 + S.value.length) % S.value.length, a.value && C(a.value);
|
|
301
|
+
const V = e.value;
|
|
302
|
+
if (V) {
|
|
303
|
+
const l = V.children[s.value];
|
|
304
|
+
l && l.scrollIntoView({ block: "nearest" });
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
handleSuggestionItemHover: (k) => {
|
|
308
|
+
s.value = k, C(S.value[k]);
|
|
309
|
+
},
|
|
310
|
+
handleClickOutside: () => {
|
|
311
|
+
p();
|
|
312
|
+
},
|
|
313
|
+
highlightSuggestionText: tt
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
const st = { class: "action-buttons" }, lt = {
|
|
142
317
|
key: 0,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}, o0 = /* @__PURE__ */ t0({
|
|
318
|
+
class: "action-buttons__utility"
|
|
319
|
+
}, ot = { class: "action-buttons__submit-content" }, at = { class: "action-buttons__cancel" }, Ce = /* @__PURE__ */ ce({
|
|
146
320
|
__name: "ActionButtons",
|
|
147
321
|
props: {
|
|
148
322
|
loading: { type: Boolean, default: !1 },
|
|
@@ -156,308 +330,434 @@ const L0 = "data:image/svg+xml,%3csvg%20width='32.000000'%20height='32.000000'%2
|
|
|
156
330
|
}) },
|
|
157
331
|
allowFiles: { type: Boolean, default: !1 },
|
|
158
332
|
submitType: { default: "enter" },
|
|
159
|
-
showShortcuts: { type: Boolean }
|
|
333
|
+
showShortcuts: { type: Boolean },
|
|
334
|
+
isOverLimit: { type: Boolean, default: !1 }
|
|
160
335
|
},
|
|
161
336
|
emits: ["clear", "toggle-speech", "submit", "cancel"],
|
|
162
|
-
setup(
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
if (!
|
|
167
|
-
const
|
|
168
|
-
|
|
337
|
+
setup(n, { emit: b }) {
|
|
338
|
+
const d = je(), t = n, m = b, s = L(() => t.allowSpeech), u = L(() => t.speechStatus.isRecording), o = L(() => t.disabled), e = L(() => o.value || t.isOverLimit), g = L(() => t.allowFiles || t.allowSpeech || t.showClear), S = () => {
|
|
339
|
+
o.value || m("clear");
|
|
340
|
+
}, a = () => {
|
|
341
|
+
if (!o.value) {
|
|
342
|
+
const r = !t.speechStatus.isRecording;
|
|
343
|
+
m("toggle-speech", r);
|
|
169
344
|
}
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
},
|
|
173
|
-
|
|
345
|
+
}, C = () => {
|
|
346
|
+
e.value || m("submit");
|
|
347
|
+
}, f = () => {
|
|
348
|
+
o.value || m("cancel");
|
|
174
349
|
};
|
|
175
|
-
return (
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
g.allowFiles && !g.loading ? (u(), M(I, {
|
|
350
|
+
return (r, p) => (N(), D("div", st, [
|
|
351
|
+
g.value ? (N(), D("div", lt, [
|
|
352
|
+
r.allowFiles && !r.loading ? (N(), H(_(ue), {
|
|
179
353
|
key: 0,
|
|
180
354
|
content: "上传文件",
|
|
181
355
|
placement: "top"
|
|
182
356
|
}, {
|
|
183
|
-
default:
|
|
184
|
-
|
|
357
|
+
default: j(() => [
|
|
358
|
+
K(_(ne), {
|
|
359
|
+
class: "action-buttons__button action-buttons__file-button",
|
|
185
360
|
type: "text",
|
|
186
|
-
disabled:
|
|
361
|
+
disabled: o.value
|
|
187
362
|
}, {
|
|
188
|
-
default:
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
class: "button-icon",
|
|
363
|
+
default: j(() => [
|
|
364
|
+
K(_(qe), {
|
|
365
|
+
class: "action-buttons__icon",
|
|
192
366
|
alt: "上传文件"
|
|
193
|
-
}
|
|
194
|
-
])
|
|
367
|
+
})
|
|
368
|
+
]),
|
|
195
369
|
_: 1
|
|
196
370
|
}, 8, ["disabled"])
|
|
197
371
|
]),
|
|
198
372
|
_: 1
|
|
199
|
-
})) :
|
|
200
|
-
|
|
373
|
+
})) : B("", !0),
|
|
374
|
+
s.value && !r.loading ? (N(), H(_(ne), {
|
|
201
375
|
key: 1,
|
|
376
|
+
class: Q(["action-buttons__button action-buttons__speech-button", { "is-recording": u.value }]),
|
|
202
377
|
type: "text",
|
|
203
|
-
disabled:
|
|
204
|
-
onClick:
|
|
205
|
-
class: O(["speech-button", { "is-recording": i.value }])
|
|
378
|
+
disabled: o.value,
|
|
379
|
+
onClick: a
|
|
206
380
|
}, {
|
|
207
|
-
default:
|
|
208
|
-
|
|
381
|
+
default: j(() => [
|
|
382
|
+
u.value ? (N(), H(_(Ue), {
|
|
383
|
+
key: 1,
|
|
384
|
+
class: "action-buttons__icon action-buttons__icon--recording",
|
|
385
|
+
alt: "语音中"
|
|
386
|
+
})) : (N(), H(_(ze), {
|
|
387
|
+
key: 0,
|
|
388
|
+
class: "action-buttons__icon",
|
|
389
|
+
alt: "录音"
|
|
390
|
+
}))
|
|
209
391
|
]),
|
|
210
392
|
_: 1
|
|
211
|
-
}, 8, ["disabled", "class"])) :
|
|
212
|
-
|
|
393
|
+
}, 8, ["disabled", "class"])) : B("", !0),
|
|
394
|
+
r.showClear ? (N(), H(_(ue), {
|
|
213
395
|
key: 2,
|
|
214
396
|
content: "清空内容",
|
|
215
397
|
placement: "top"
|
|
216
398
|
}, {
|
|
217
|
-
default:
|
|
218
|
-
|
|
399
|
+
default: j(() => [
|
|
400
|
+
K(_(ne), {
|
|
401
|
+
class: "action-buttons__button action-buttons__clear-button",
|
|
219
402
|
type: "text",
|
|
220
|
-
disabled:
|
|
221
|
-
onClick:
|
|
222
|
-
style: { "margin-left": "0" }
|
|
403
|
+
disabled: o.value || !r.hasContent,
|
|
404
|
+
onClick: S
|
|
223
405
|
}, {
|
|
224
|
-
default:
|
|
225
|
-
(
|
|
406
|
+
default: j(() => [
|
|
407
|
+
(N(), H(Me(_(d)), { class: "action-buttons__icon action-buttons__icon--close" }))
|
|
226
408
|
]),
|
|
227
409
|
_: 1
|
|
228
410
|
}, 8, ["disabled"])
|
|
229
411
|
]),
|
|
230
412
|
_: 1
|
|
231
|
-
})) :
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
class: "
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
413
|
+
})) : B("", !0)
|
|
414
|
+
])) : B("", !0),
|
|
415
|
+
r.hasContent || r.loading ? (N(), H(_(ne), {
|
|
416
|
+
key: 1,
|
|
417
|
+
type: "text",
|
|
418
|
+
class: "action-buttons__button action-buttons__submit",
|
|
419
|
+
disabled: r.loading ? o.value : e.value,
|
|
420
|
+
onClick: p[0] || (p[0] = (T) => r.loading ? f() : C())
|
|
421
|
+
}, {
|
|
422
|
+
default: j(() => [
|
|
423
|
+
M("div", ot, [
|
|
424
|
+
r.loading ? (N(), H(_(ue), {
|
|
425
|
+
key: 1,
|
|
426
|
+
content: "停止生成",
|
|
427
|
+
placement: "top"
|
|
428
|
+
}, {
|
|
429
|
+
default: j(() => [
|
|
430
|
+
M("div", at, [
|
|
431
|
+
K(_(Ge), {
|
|
432
|
+
class: "action-buttons__icon action-buttons__icon--stop",
|
|
433
|
+
alt: "加载中"
|
|
434
|
+
}),
|
|
435
|
+
p[1] || (p[1] = M("span", { class: "action-buttons__cancel-text" }, "停止回答", -1))
|
|
436
|
+
])
|
|
437
|
+
]),
|
|
438
|
+
_: 1
|
|
439
|
+
})) : (N(), H(_(Xe), {
|
|
440
|
+
key: 0,
|
|
441
|
+
class: "action-buttons__icon action-buttons__icon--send",
|
|
442
|
+
alt: "发送"
|
|
443
|
+
}))
|
|
444
|
+
])
|
|
445
|
+
]),
|
|
446
|
+
_: 1
|
|
447
|
+
}, 8, ["disabled"])) : B("", !0)
|
|
448
|
+
]));
|
|
261
449
|
}
|
|
262
|
-
})
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
return
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
450
|
+
});
|
|
451
|
+
function it(n, b) {
|
|
452
|
+
const d = x(!1), t = Se({ ...b }), m = (l) => {
|
|
453
|
+
Object.assign(t, l);
|
|
454
|
+
}, s = (l) => {
|
|
455
|
+
const c = [];
|
|
456
|
+
let h = 0;
|
|
457
|
+
const y = /\[(.*?)\]/g;
|
|
458
|
+
let w;
|
|
459
|
+
for (; (w = y.exec(l)) !== null; )
|
|
460
|
+
w.index > h && c.push({ type: "text", content: l.substring(h, w.index) }), c.push({ type: "field", content: w[1] }), h = w.index + w[0].length;
|
|
461
|
+
return h < l.length && c.push({ type: "text", content: l.substring(h) }), c;
|
|
462
|
+
}, u = () => {
|
|
463
|
+
if (!n.value) return "";
|
|
464
|
+
let l = "";
|
|
465
|
+
return n.value.childNodes.forEach((c) => {
|
|
466
|
+
(c.nodeType === Node.TEXT_NODE || c.nodeType === Node.ELEMENT_NODE && c.classList.contains("template-field")) && (l += c.textContent || "");
|
|
467
|
+
}), l;
|
|
468
|
+
}, o = (l) => t.initialValues && typeof t.initialValues[l] == "string" ? t.initialValues[l] : "", e = (l, c) => {
|
|
469
|
+
const h = document.createElement("span");
|
|
470
|
+
return h.className = "template-field", h.setAttribute("data-placeholder", l), c && (h.textContent = c), P(() => {
|
|
471
|
+
g(h, c || "");
|
|
472
|
+
}), h;
|
|
473
|
+
}, g = (l, c) => {
|
|
474
|
+
if (!c || c.trim() === "") {
|
|
475
|
+
const h = l.getAttribute("data-placeholder") || "";
|
|
476
|
+
h ? S(l, h, !0) : (l.style.minWidth = "", l.style.width = "");
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
S(l, c, !1);
|
|
480
|
+
}, S = (l, c, h) => {
|
|
481
|
+
const y = document.createElement("span");
|
|
482
|
+
y.className = "template-field", y.style.visibility = "hidden", y.style.position = "absolute", y.style.top = "-9999px", y.style.left = "-9999px", y.style.whiteSpace = "nowrap", y.style.padding = "3px 8px", y.style.margin = "0 2px", y.style.boxSizing = "border-box", y.textContent = c, document.body.appendChild(y);
|
|
483
|
+
const w = getComputedStyle(y), F = y.offsetWidth, O = parseFloat(w.fontSize);
|
|
484
|
+
document.body.removeChild(y);
|
|
485
|
+
const I = h ? 1.5 : 2, W = F / O, $ = Math.max(I, Math.ceil(W));
|
|
486
|
+
l.style.setProperty("min-width", `${$}em`, "important");
|
|
487
|
+
const q = 20;
|
|
488
|
+
$ > q ? (l.style.setProperty("max-width", `${q}em`, "important"), l.style.setProperty("white-space", "normal", "important"), l.style.setProperty("word-break", "break-word", "important")) : l.style.removeProperty("max-width");
|
|
489
|
+
}, a = (l) => {
|
|
490
|
+
const h = (l === void 0 ? u() : l).trim().length > 0;
|
|
491
|
+
d.value !== h && (d.value = h, t.onContentStatusChange(h));
|
|
492
|
+
}, C = (l, c = "inside", h = !1) => {
|
|
493
|
+
P(() => {
|
|
494
|
+
const y = window.getSelection();
|
|
495
|
+
if (!y) return;
|
|
496
|
+
const w = document.createRange();
|
|
497
|
+
switch (c) {
|
|
498
|
+
case "before":
|
|
499
|
+
w.setStartBefore(l);
|
|
500
|
+
break;
|
|
501
|
+
case "after":
|
|
502
|
+
w.setStartAfter(l);
|
|
503
|
+
break;
|
|
504
|
+
case "inside":
|
|
505
|
+
default:
|
|
506
|
+
w.selectNodeContents(l), w.collapse(h);
|
|
507
|
+
break;
|
|
312
508
|
}
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
const r = (t || $()).trim().length > 0;
|
|
322
|
-
h.value !== r && (h.value = r, p("content-status", r));
|
|
323
|
-
}, K = (t, n) => {
|
|
324
|
-
t && (i.value[n] = t, t.textContent || (t.textContent = s.value[n].content), new MutationObserver(() => {
|
|
325
|
-
l.value === n && !d.value && (d.value = !0, setTimeout(() => {
|
|
326
|
-
s.value[n].content = t.textContent !== null ? t.textContent : "", d.value = !1;
|
|
327
|
-
}, 0));
|
|
328
|
-
}).observe(t, {
|
|
329
|
-
characterData: !0,
|
|
330
|
-
childList: !0,
|
|
331
|
-
subtree: !0
|
|
332
|
-
}));
|
|
333
|
-
}, G = (t, n) => {
|
|
334
|
-
d.value = !0;
|
|
335
|
-
const r = t.target, C = r.textContent !== null ? r.textContent : "";
|
|
336
|
-
s.value[n].content !== C && (s.value[n].content = C, V()), setTimeout(() => {
|
|
337
|
-
d.value = !1;
|
|
338
|
-
}, 10);
|
|
339
|
-
}, W = (t) => {
|
|
340
|
-
if (document.createRange) {
|
|
341
|
-
const n = document.createRange();
|
|
342
|
-
n.selectNodeContents(t), n.collapse(!1);
|
|
343
|
-
const r = window.getSelection();
|
|
344
|
-
r && (r.removeAllRanges(), r.addRange(n));
|
|
509
|
+
y.removeAllRanges(), y.addRange(w), l.focus && l.focus();
|
|
510
|
+
});
|
|
511
|
+
}, f = () => {
|
|
512
|
+
P(() => {
|
|
513
|
+
const l = n.value;
|
|
514
|
+
if (l) {
|
|
515
|
+
const c = document.createRange(), h = window.getSelection();
|
|
516
|
+
c.selectNodeContents(l), c.collapse(!1), h && (h.removeAllRanges(), h.addRange(c)), l.focus();
|
|
345
517
|
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
518
|
+
});
|
|
519
|
+
}, r = (l, c) => {
|
|
520
|
+
const h = n.value;
|
|
521
|
+
if (!h) return null;
|
|
522
|
+
h.innerHTML = "";
|
|
523
|
+
let y = null;
|
|
524
|
+
if (!c || c === t.template)
|
|
525
|
+
l.forEach((w) => {
|
|
526
|
+
if (w.type === "field") {
|
|
527
|
+
const F = o(w.content), O = e(w.content, F);
|
|
528
|
+
h.appendChild(O), y || (y = O);
|
|
529
|
+
} else
|
|
530
|
+
h.appendChild(document.createTextNode(w.content));
|
|
531
|
+
}), t.initialValues && Object.keys(t.initialValues).length > 0 && P(() => {
|
|
532
|
+
const w = u();
|
|
533
|
+
w !== t.value && (t.onValueChange(w), t.onInput(w));
|
|
534
|
+
});
|
|
535
|
+
else {
|
|
536
|
+
const w = p(l, c);
|
|
537
|
+
w.success ? w.elements.forEach((F) => {
|
|
538
|
+
h.appendChild(F.node), F.isField && !y && (y = F.node);
|
|
539
|
+
}) : (h.appendChild(document.createTextNode(c)), y = null);
|
|
540
|
+
}
|
|
541
|
+
return y;
|
|
542
|
+
}, p = (l, c) => {
|
|
543
|
+
const h = [];
|
|
544
|
+
let y = 0, w = 0, F = !0;
|
|
545
|
+
for (; w < l.length && y <= c.length && F; ) {
|
|
546
|
+
const O = l[w];
|
|
547
|
+
if (O.type === "text")
|
|
548
|
+
c.substring(y).startsWith(O.content) ? (h.push({
|
|
549
|
+
node: document.createTextNode(O.content),
|
|
550
|
+
isField: !1
|
|
551
|
+
}), y += O.content.length, w++) : F = !1;
|
|
552
|
+
else {
|
|
553
|
+
let I = "";
|
|
554
|
+
const W = l.find(($, q) => q > w && $.type === "text");
|
|
555
|
+
if (W) {
|
|
556
|
+
const $ = c.substring(y), q = $.indexOf(W.content);
|
|
557
|
+
q !== -1 ? (I = $.substring(0, q), y += I.length) : F = !1;
|
|
558
|
+
} else
|
|
559
|
+
I = c.substring(y), y = c.length;
|
|
560
|
+
if (F) {
|
|
561
|
+
const $ = e(O.content, I);
|
|
562
|
+
h.push({ node: $, isField: !0 }), w++;
|
|
351
563
|
}
|
|
352
|
-
l.value = t, p("field-active", !0, t), s0(() => {
|
|
353
|
-
const n = i.value[t];
|
|
354
|
-
n && (n.focus(), !n.textContent && s.value[t].content && (n.textContent = s.value[t].content), W(n));
|
|
355
|
-
});
|
|
356
564
|
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
const
|
|
361
|
-
if (
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
|
|
565
|
+
}
|
|
566
|
+
if (F && w < l.length)
|
|
567
|
+
for (let O = w; O < l.length; O++) {
|
|
568
|
+
const I = l[O];
|
|
569
|
+
if (I.type === "field") {
|
|
570
|
+
const W = !t.value || t.value === "" ? o(I.content) : "", $ = e(I.content, W);
|
|
571
|
+
h.push({ node: $, isField: !0 });
|
|
572
|
+
} else
|
|
573
|
+
h.push({
|
|
574
|
+
node: document.createTextNode(I.content),
|
|
575
|
+
isField: !1
|
|
576
|
+
});
|
|
366
577
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
(
|
|
374
|
-
|
|
578
|
+
return { success: F, elements: h };
|
|
579
|
+
}, T = () => {
|
|
580
|
+
if (!n.value) return;
|
|
581
|
+
t.isInternalUpdate = !0;
|
|
582
|
+
const l = s(t.template), c = r(l, t.value);
|
|
583
|
+
a(), P(() => {
|
|
584
|
+
A(), c && c.textContent ? C(c, "inside", !1) : c ? C(c, "inside", !0) : f(), t.isInternalUpdate = !1;
|
|
585
|
+
});
|
|
586
|
+
}, v = () => {
|
|
587
|
+
if (t.isInternalUpdate || t.isComposing) return;
|
|
588
|
+
A();
|
|
589
|
+
const l = u();
|
|
590
|
+
l !== t.value && (t.onValueChange(l), t.onInput(l)), a(l);
|
|
591
|
+
}, A = () => {
|
|
592
|
+
if (!n.value) return;
|
|
593
|
+
n.value.querySelectorAll(".template-field").forEach((c) => {
|
|
594
|
+
const h = c.textContent || "";
|
|
595
|
+
g(c, h);
|
|
596
|
+
});
|
|
597
|
+
};
|
|
598
|
+
return {
|
|
599
|
+
// 状态
|
|
600
|
+
hasContent: d,
|
|
601
|
+
// 解析和DOM操作
|
|
602
|
+
parseTemplateToParts: s,
|
|
603
|
+
getValueFromDOM: u,
|
|
604
|
+
getInitialContentForField: o,
|
|
605
|
+
createFieldElement: e,
|
|
606
|
+
// 光标操作
|
|
607
|
+
setCursorTo: C,
|
|
608
|
+
setCursorToEnd: f,
|
|
609
|
+
// DOM更新
|
|
610
|
+
updateEditorDOM: T,
|
|
611
|
+
renderTemplateToDOM: r,
|
|
612
|
+
// 事件处理
|
|
613
|
+
handleInput: v,
|
|
614
|
+
checkHasContent: a,
|
|
615
|
+
// 方法
|
|
616
|
+
resetFields: () => {
|
|
617
|
+
if (!n.value) return;
|
|
618
|
+
t.isInternalUpdate = !0;
|
|
619
|
+
const l = n.value;
|
|
620
|
+
l.innerHTML = "";
|
|
621
|
+
const c = s(t.template);
|
|
622
|
+
let h = "";
|
|
623
|
+
c.forEach((y) => {
|
|
624
|
+
if (y.type === "field") {
|
|
625
|
+
const w = o(y.content), F = e(y.content, w);
|
|
626
|
+
w && (h += w), l.appendChild(F);
|
|
627
|
+
} else
|
|
628
|
+
l.appendChild(document.createTextNode(y.content)), h += y.content;
|
|
629
|
+
}), t.onValueChange(h), f(), a(h), P(() => {
|
|
630
|
+
t.isInternalUpdate = !1;
|
|
631
|
+
});
|
|
632
|
+
},
|
|
633
|
+
activateFirstField: () => {
|
|
634
|
+
var c;
|
|
635
|
+
const l = (c = n.value) == null ? void 0 : c.querySelector(".template-field");
|
|
636
|
+
l ? C(l, "inside", !1) : f();
|
|
637
|
+
},
|
|
638
|
+
// 选项更新
|
|
639
|
+
updateOptions: m
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
const rt = /* @__PURE__ */ ce({
|
|
643
|
+
__name: "TemplateEditor",
|
|
644
|
+
props: {
|
|
645
|
+
template: {},
|
|
646
|
+
value: {},
|
|
647
|
+
autofocus: { type: Boolean },
|
|
648
|
+
initialValues: {}
|
|
649
|
+
},
|
|
650
|
+
emits: ["update:value", "input", "content-status", "submit", "focus", "blur"],
|
|
651
|
+
setup(n, { expose: b, emit: d }) {
|
|
652
|
+
const t = n, m = d, s = x(null), u = x(!1), o = x(!1), e = it(s, {
|
|
653
|
+
template: t.template,
|
|
654
|
+
value: t.value,
|
|
655
|
+
initialValues: t.initialValues,
|
|
656
|
+
isInternalUpdate: u,
|
|
657
|
+
isComposing: o,
|
|
658
|
+
onValueChange: (f) => m("update:value", f),
|
|
659
|
+
onInput: (f) => m("input", f),
|
|
660
|
+
onContentStatusChange: (f) => m("content-status", f),
|
|
661
|
+
onSubmit: (f) => m("submit", f)
|
|
662
|
+
}), g = Ze({
|
|
663
|
+
editor: s,
|
|
664
|
+
isComposing: o,
|
|
665
|
+
getValueFromDOM: e.getValueFromDOM,
|
|
666
|
+
handleInput: e.handleInput,
|
|
667
|
+
onSubmit: (f) => m("submit", f)
|
|
668
|
+
}), S = () => {
|
|
669
|
+
o.value = !0;
|
|
670
|
+
}, a = () => {
|
|
671
|
+
o.value = !1, e.handleInput();
|
|
672
|
+
}, C = (f) => {
|
|
673
|
+
var T;
|
|
674
|
+
if (!s.value) return;
|
|
675
|
+
const r = f.target;
|
|
676
|
+
let p = null;
|
|
677
|
+
if (r.classList.contains("template-field") ? p = r : (T = r.parentElement) != null && T.classList.contains("template-field") && (p = r.parentElement), p && (!p.textContent || p.textContent.trim() === "")) {
|
|
678
|
+
const v = window.getSelection(), A = document.createRange();
|
|
679
|
+
v && (A.selectNodeContents(p), A.collapse(!0), v.removeAllRanges(), v.addRange(A), p.focus(), f.preventDefault(), f.stopPropagation());
|
|
375
680
|
}
|
|
376
|
-
|
|
377
|
-
|
|
681
|
+
};
|
|
682
|
+
return $e(() => {
|
|
683
|
+
e.updateEditorDOM(), t.autofocus && s.value && e.setCursorToEnd();
|
|
684
|
+
}), G(
|
|
685
|
+
() => t.template,
|
|
378
686
|
() => {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
687
|
+
u.value || (e.updateOptions({
|
|
688
|
+
template: t.template,
|
|
689
|
+
value: t.value,
|
|
690
|
+
initialValues: t.initialValues
|
|
691
|
+
}), e.updateEditorDOM());
|
|
692
|
+
}
|
|
693
|
+
), G(
|
|
694
|
+
() => t.value,
|
|
695
|
+
(f) => {
|
|
696
|
+
!u.value && f !== e.getValueFromDOM() && (e.updateOptions({
|
|
697
|
+
template: t.template,
|
|
698
|
+
value: f,
|
|
699
|
+
initialValues: t.initialValues
|
|
700
|
+
}), e.updateEditorDOM());
|
|
382
701
|
},
|
|
383
|
-
{
|
|
384
|
-
)
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}), V();
|
|
389
|
-
}, X = () => {
|
|
390
|
-
N();
|
|
391
|
-
};
|
|
392
|
-
return d0(() => {
|
|
393
|
-
Z();
|
|
394
|
-
}), f({
|
|
395
|
-
activateFirstField: () => {
|
|
396
|
-
for (let t = 0; t < s.value.length; t++)
|
|
397
|
-
if (s.value[t].isField) {
|
|
398
|
-
P(t);
|
|
399
|
-
break;
|
|
400
|
-
}
|
|
702
|
+
{ deep: !1 }
|
|
703
|
+
), b({
|
|
704
|
+
focus: () => {
|
|
705
|
+
var f;
|
|
706
|
+
(f = s.value) == null || f.focus(), e.setCursorToEnd();
|
|
401
707
|
},
|
|
402
|
-
resetFields:
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
class: "template-editable",
|
|
420
|
-
contenteditable: "true",
|
|
421
|
-
onInput: (m) => G(m, C),
|
|
422
|
-
onBlur: n[0] || (n[0] = (m) => H()),
|
|
423
|
-
onKeydown: n[1] || (n[1] = (m) => U(m)),
|
|
424
|
-
onClick: n[2] || (n[2] = u0(() => {
|
|
425
|
-
}, ["stop"]))
|
|
426
|
-
}, null, 40, M0)) : (u(), y("span", $0, j(r.content), 1))
|
|
427
|
-
], 10, I0)) : (u(), y("span", R0, j(r.content), 1))
|
|
428
|
-
], 64))), 128))
|
|
429
|
-
], 512)
|
|
430
|
-
]));
|
|
708
|
+
resetFields: e.resetFields,
|
|
709
|
+
activateFirstField: e.activateFirstField
|
|
710
|
+
}), (f, r) => (N(), D("div", {
|
|
711
|
+
class: "template-editor",
|
|
712
|
+
ref_key: "contentEditableRef",
|
|
713
|
+
ref: s,
|
|
714
|
+
contenteditable: "true",
|
|
715
|
+
onInput: r[0] || (r[0] = //@ts-ignore
|
|
716
|
+
(...p) => _(e).handleInput && _(e).handleInput(...p)),
|
|
717
|
+
onKeydown: r[1] || (r[1] = //@ts-ignore
|
|
718
|
+
(...p) => _(g).handleTemplateKeyDown && _(g).handleTemplateKeyDown(...p)),
|
|
719
|
+
onClick: C,
|
|
720
|
+
onCompositionstart: S,
|
|
721
|
+
onCompositionend: a,
|
|
722
|
+
onFocus: r[2] || (r[2] = (p) => f.$emit("focus", p)),
|
|
723
|
+
onBlur: r[3] || (r[3] = (p) => f.$emit("blur", p))
|
|
724
|
+
}, null, 544));
|
|
431
725
|
}
|
|
432
|
-
}),
|
|
726
|
+
}), ut = ["data-theme"], ct = { class: "tiny-sender__container" }, dt = {
|
|
433
727
|
key: 0,
|
|
434
728
|
class: "tiny-sender__header-slot"
|
|
435
|
-
},
|
|
729
|
+
}, ft = {
|
|
436
730
|
key: 0,
|
|
437
731
|
class: "tiny-sender__prefix-slot"
|
|
438
|
-
},
|
|
439
|
-
key: 1,
|
|
440
|
-
class: "tiny-sender__actions-slot"
|
|
441
|
-
}, O0 = { class: "tiny-sender__buttons-container" }, G0 = {
|
|
732
|
+
}, pt = { class: "tiny-sender__content-area" }, ht = {
|
|
442
733
|
key: 0,
|
|
443
|
-
class: "tiny-
|
|
444
|
-
},
|
|
734
|
+
class: "tiny-sender__decorative-content"
|
|
735
|
+
}, mt = {
|
|
736
|
+
key: 2,
|
|
737
|
+
class: "tiny-sender__input-field-wrapper"
|
|
738
|
+
}, gt = {
|
|
445
739
|
key: 0,
|
|
446
|
-
class: "tiny-
|
|
447
|
-
},
|
|
740
|
+
class: "tiny-sender__completion-placeholder"
|
|
741
|
+
}, vt = { class: "user-input-mirror" }, yt = {
|
|
742
|
+
key: 0,
|
|
743
|
+
class: "tiny-sender__tab-hint"
|
|
744
|
+
}, bt = {
|
|
745
|
+
key: 1,
|
|
746
|
+
class: "tiny-sender__actions-slot"
|
|
747
|
+
}, wt = { class: "tiny-sender__footer-left" }, _t = { class: "tiny-sender__footer-right" }, Ct = { class: "real-word-length" }, St = {
|
|
448
748
|
key: 1,
|
|
449
749
|
class: "tiny-sender__toolbar"
|
|
450
|
-
},
|
|
451
|
-
key:
|
|
452
|
-
class: "tiny-
|
|
453
|
-
},
|
|
750
|
+
}, Et = { class: "tiny-sender__buttons-container" }, Nt = {
|
|
751
|
+
key: 1,
|
|
752
|
+
class: "tiny-sender__footer-slot"
|
|
753
|
+
}, Tt = ["onMouseenter", "onMousedown"], kt = { class: "suggestion-item__icon" }, Rt = { class: "suggestion-item__text" }, It = {
|
|
454
754
|
key: 0,
|
|
455
755
|
class: "tiny-sender__error"
|
|
456
|
-
},
|
|
756
|
+
}, se = /* @__PURE__ */ ce({
|
|
457
757
|
__name: "index",
|
|
458
758
|
props: {
|
|
459
759
|
autofocus: { type: Boolean, default: !1 },
|
|
460
|
-
autoSize: { type: [Boolean, Object], default:
|
|
760
|
+
autoSize: { type: [Boolean, Object], default: () => ({ minRows: 1, maxRows: 3 }) },
|
|
461
761
|
allowSpeech: { type: Boolean, default: !0 },
|
|
462
762
|
allowFiles: { type: Boolean, default: !1 },
|
|
463
763
|
clearable: { type: Boolean, default: !1 },
|
|
@@ -471,213 +771,332 @@ const L0 = "data:image/svg+xml,%3csvg%20width='32.000000'%20height='32.000000'%2
|
|
|
471
771
|
speech: { type: [Boolean, Object] },
|
|
472
772
|
placeholder: { default: "请输入内容..." },
|
|
473
773
|
showWordLimit: { type: Boolean, default: !1 },
|
|
474
|
-
suggestions: {},
|
|
774
|
+
suggestions: { default: () => [] },
|
|
475
775
|
theme: { default: "light" },
|
|
476
776
|
template: { default: "" },
|
|
477
|
-
hasContent: { type: Boolean, default: void 0 }
|
|
777
|
+
hasContent: { type: Boolean, default: void 0 },
|
|
778
|
+
templateInitialValues: { default: () => ({}) }
|
|
478
779
|
},
|
|
479
780
|
emits: ["update:modelValue", "submit", "clear", "speech-start", "speech-end", "speech-interim", "speech-error", "suggestion-select", "focus", "blur", "escape-press", "cancel", "reset-template"],
|
|
480
|
-
setup(
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
781
|
+
setup(n, { expose: b, emit: d }) {
|
|
782
|
+
const t = n, m = d, s = x(null), u = x(null), o = x(null), e = x(null), g = x(null), S = L(() => !!t.template), { inputValue: a, isComposing: C, clearInput: f } = Qe(t, m), {
|
|
783
|
+
showSuggestionsPopup: r,
|
|
784
|
+
highlightedIndex: p,
|
|
785
|
+
completionPlaceholder: T,
|
|
786
|
+
showTabHint: v,
|
|
787
|
+
suggestionsListRef: A,
|
|
788
|
+
filteredSuggestions: k,
|
|
789
|
+
activeSuggestion: V,
|
|
790
|
+
updateCompletionPlaceholder: l,
|
|
791
|
+
selectSuggestion: c,
|
|
792
|
+
acceptCurrentSuggestion: h,
|
|
793
|
+
closeSuggestionsPopup: y,
|
|
794
|
+
navigateSuggestions: w,
|
|
795
|
+
handleSuggestionItemHover: F,
|
|
796
|
+
highlightSuggestionText: O
|
|
797
|
+
} = nt(t, m, a, C), I = x(t.mode), W = x(!1), $ = () => {
|
|
798
|
+
I.value === "single" && (I.value = "multiple", P(() => {
|
|
799
|
+
setTimeout(() => {
|
|
800
|
+
const i = document.querySelector(".tiny-textarea__inner");
|
|
801
|
+
if (i) {
|
|
802
|
+
i.style.whiteSpace = "pre-wrap";
|
|
803
|
+
const E = a.value.length;
|
|
804
|
+
i.focus(), i.setSelectionRange(E, E);
|
|
805
|
+
}
|
|
806
|
+
}, 50);
|
|
807
|
+
}));
|
|
808
|
+
}, q = (i, E) => {
|
|
809
|
+
const R = document.createElement("span");
|
|
810
|
+
R.style.visibility = "hidden", R.style.position = "absolute", R.style.whiteSpace = "nowrap", R.style.font = E, R.textContent = i, document.body.appendChild(R);
|
|
811
|
+
const z = R.offsetWidth;
|
|
812
|
+
return document.body.removeChild(R), z;
|
|
813
|
+
}, Ee = () => {
|
|
814
|
+
if (t.mode !== "single" || !s.value || W.value) return;
|
|
815
|
+
const E = document.querySelector(".tiny-sender__content-area").querySelector(".tiny-input__inner"), R = g.value || document.querySelector(".tiny-sender__buttons-container");
|
|
816
|
+
if (!E) return;
|
|
817
|
+
const z = window.getComputedStyle(E).font, U = q(a.value, z), Be = E.offsetWidth - ((R == null ? void 0 : R.offsetWidth) || 0) - 20;
|
|
818
|
+
U > Be && I.value === "single" && (W.value = !0, I.value = "multiple", P(() => {
|
|
819
|
+
s.value ? setTimeout(() => {
|
|
820
|
+
const te = document.querySelector(".tiny-textarea__inner");
|
|
821
|
+
if (te) {
|
|
822
|
+
te.style.whiteSpace = "pre-wrap";
|
|
823
|
+
const ye = a.value.length;
|
|
824
|
+
te.focus(), te.setSelectionRange(ye, ye);
|
|
825
|
+
}
|
|
826
|
+
W.value = !1;
|
|
827
|
+
}, 300) : W.value = !1;
|
|
828
|
+
}));
|
|
829
|
+
}, le = () => {
|
|
830
|
+
f(), t.template && m("reset-template"), P(() => {
|
|
831
|
+
a.value === "" && (I.value = t.mode || "single");
|
|
832
|
+
}), y();
|
|
833
|
+
}, de = (i) => {
|
|
834
|
+
a.value = i, m("update:modelValue", i);
|
|
835
|
+
}, fe = () => {
|
|
836
|
+
o.value && o.value.activateFirstField();
|
|
837
|
+
}, Ne = L(() => {
|
|
838
|
+
const i = typeof t.speech == "object" ? t.speech : {};
|
|
839
|
+
return {
|
|
840
|
+
...i,
|
|
841
|
+
onStart: () => m("speech-start"),
|
|
842
|
+
onEnd: (E) => m("speech-end", E),
|
|
843
|
+
onInterim: (E) => m("speech-interim", E),
|
|
844
|
+
onFinal: (E) => {
|
|
845
|
+
if (i.autoReplace)
|
|
846
|
+
a.value = E;
|
|
847
|
+
else {
|
|
848
|
+
const R = a.value;
|
|
849
|
+
R && E && !R.endsWith(" ") && !E.startsWith(" ") && R.length > 0 ? a.value = R + " " + E : a.value = R + E;
|
|
850
|
+
}
|
|
851
|
+
m("speech-end", E);
|
|
852
|
+
},
|
|
853
|
+
onError: (E) => {
|
|
854
|
+
Ve(E.message), m("speech-error", E);
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
}), { speechState: Z, start: pe, stop: he } = et(Ne.value), oe = () => {
|
|
858
|
+
Z.isRecording ? he() : pe();
|
|
859
|
+
}, { handleKeyPress: Te, triggerSubmit: ae } = Ye(
|
|
860
|
+
t,
|
|
861
|
+
m,
|
|
503
862
|
a,
|
|
504
|
-
|
|
863
|
+
C,
|
|
864
|
+
Z,
|
|
865
|
+
r,
|
|
866
|
+
V,
|
|
505
867
|
h,
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
868
|
+
y,
|
|
869
|
+
w,
|
|
870
|
+
oe,
|
|
871
|
+
I,
|
|
872
|
+
$
|
|
873
|
+
), ke = (i) => {
|
|
874
|
+
m("focus", i), a.value && k.value.length > 0 && !t.template && (r.value = !0, v.value = !0, p.value === -1 && (p.value = 0), l(V.value || k.value[0]));
|
|
875
|
+
}, Re = (i) => {
|
|
876
|
+
m("blur", i);
|
|
877
|
+
}, Ie = L(() => I.value === "multiple" ? "textarea" : "text"), De = L(
|
|
515
878
|
() => ({
|
|
516
879
|
display: "flex",
|
|
517
|
-
justifyContent:
|
|
880
|
+
justifyContent: t.showWordLimit && t.maxLength !== 1 / 0 ? "space-between" : "flex-end",
|
|
518
881
|
alignItems: "center"
|
|
519
882
|
})
|
|
520
|
-
),
|
|
521
|
-
"is-disabled":
|
|
522
|
-
"is-loading":
|
|
523
|
-
"has-error": !!
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
}
|
|
883
|
+
), xe = Ae(), Fe = L(() => !!xe.decorativeContent), ee = L(() => t.disabled || Fe.value), me = L(() => t.loading), ge = L(() => t.hasContent !== void 0 ? t.hasContent : !!a.value), Le = L(() => ({
|
|
884
|
+
"is-disabled": ee.value,
|
|
885
|
+
"is-loading": me.value,
|
|
886
|
+
"has-error": !!Y.value,
|
|
887
|
+
"is-auto-switching": W.value
|
|
888
|
+
})), Y = x(""), Ve = (i) => {
|
|
889
|
+
Y.value = i, setTimeout(() => Y.value = "", 5e3);
|
|
890
|
+
}, Oe = () => {
|
|
891
|
+
C.value = !1, setTimeout(() => {
|
|
892
|
+
C.value = !1, a.value && t.suggestions && t.suggestions.length > 0 && !t.template && (r.value = k.value.length > 0, r.value && (p.value = 0, l(), v.value = !0));
|
|
893
|
+
}, 50);
|
|
894
|
+
}, ie = L(() => t.maxLength !== 1 / 0 && a.value.length > t.maxLength);
|
|
895
|
+
return G(a, () => {
|
|
896
|
+
P(Ee), a.value === "" && t.mode === "single" && (I.value = "single");
|
|
897
|
+
}), G(
|
|
898
|
+
() => S.value,
|
|
899
|
+
(i) => {
|
|
900
|
+
i && (I.value = "multiple");
|
|
901
|
+
}
|
|
902
|
+
), b({
|
|
532
903
|
focus: () => {
|
|
533
|
-
if (
|
|
534
|
-
|
|
535
|
-
else if (
|
|
536
|
-
|
|
904
|
+
if (S.value && o.value)
|
|
905
|
+
fe();
|
|
906
|
+
else if (s.value)
|
|
907
|
+
s.value.focus();
|
|
537
908
|
else {
|
|
538
|
-
const
|
|
539
|
-
|
|
909
|
+
const i = document.querySelector(".tiny-input__inner");
|
|
910
|
+
i == null || i.focus();
|
|
540
911
|
}
|
|
541
912
|
},
|
|
542
913
|
blur: () => {
|
|
543
|
-
if (
|
|
544
|
-
|
|
914
|
+
if (s.value)
|
|
915
|
+
s.value.blur();
|
|
545
916
|
else {
|
|
546
|
-
const
|
|
547
|
-
|
|
917
|
+
const i = document.querySelector(".tiny-input__inner");
|
|
918
|
+
i == null || i.blur();
|
|
548
919
|
}
|
|
549
920
|
},
|
|
550
|
-
clear:
|
|
551
|
-
submit:
|
|
552
|
-
startSpeech:
|
|
553
|
-
stopSpeech:
|
|
554
|
-
activateTemplateFirstField:
|
|
555
|
-
}), (
|
|
556
|
-
|
|
557
|
-
|
|
921
|
+
clear: le,
|
|
922
|
+
submit: ae,
|
|
923
|
+
startSpeech: pe,
|
|
924
|
+
stopSpeech: he,
|
|
925
|
+
activateTemplateFirstField: fe
|
|
926
|
+
}), (i, E) => (N(), D("div", {
|
|
927
|
+
ref_key: "senderRef",
|
|
928
|
+
ref: u,
|
|
929
|
+
class: Q(["tiny-sender", [Le.value, `theme-${i.theme}`, `mode-${I.value}`]]),
|
|
930
|
+
"data-theme": i.theme
|
|
558
931
|
}, [
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
932
|
+
M("div", ct, [
|
|
933
|
+
M("div", {
|
|
934
|
+
class: "tiny-sender__input-wrapper",
|
|
935
|
+
ref_key: "inputWrapperRef",
|
|
936
|
+
ref: e
|
|
937
|
+
}, [
|
|
938
|
+
K(re, { name: "tiny-sender-slide-down" }, {
|
|
939
|
+
default: j(() => [
|
|
940
|
+
i.$slots.header ? (N(), D("div", dt, [
|
|
941
|
+
X(i.$slots, "header")
|
|
942
|
+
])) : B("", !0)
|
|
566
943
|
]),
|
|
567
944
|
_: 3
|
|
568
945
|
}),
|
|
569
|
-
|
|
570
|
-
class:
|
|
946
|
+
M("div", {
|
|
947
|
+
class: Q(["tiny-sender__input-row", { "has-prefix": i.$slots.prefix, "has-header": i.$slots.header }])
|
|
571
948
|
}, [
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
])) :
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
template: e.template,
|
|
581
|
-
value: k(h),
|
|
582
|
-
"onUpdate:value": $,
|
|
583
|
-
onInput: $
|
|
584
|
-
}, null, 8, ["template", "value"])) : (u(), M(k(h0), {
|
|
949
|
+
i.$slots.prefix ? (N(), D("div", ft, [
|
|
950
|
+
X(i.$slots, "prefix")
|
|
951
|
+
])) : B("", !0),
|
|
952
|
+
M("div", pt, [
|
|
953
|
+
i.$slots.decorativeContent ? (N(), D("div", ht, [
|
|
954
|
+
X(i.$slots, "decorativeContent")
|
|
955
|
+
])) : B("", !0),
|
|
956
|
+
S.value ? (N(), H(rt, {
|
|
585
957
|
key: 1,
|
|
586
|
-
ref_key: "
|
|
587
|
-
ref:
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
958
|
+
ref_key: "templateEditorRef",
|
|
959
|
+
ref: o,
|
|
960
|
+
template: i.template,
|
|
961
|
+
value: _(a),
|
|
962
|
+
initialValues: i.templateInitialValues,
|
|
963
|
+
"onUpdate:value": de,
|
|
964
|
+
onInput: de
|
|
965
|
+
}, null, 8, ["template", "value", "initialValues"])) : (N(), D("div", mt, [
|
|
966
|
+
K(_(He), {
|
|
967
|
+
ref_key: "inputRef",
|
|
968
|
+
ref: s,
|
|
969
|
+
autosize: i.autoSize,
|
|
970
|
+
type: Ie.value,
|
|
971
|
+
readonly: me.value,
|
|
972
|
+
resize: "none",
|
|
973
|
+
modelValue: _(a),
|
|
974
|
+
"onUpdate:modelValue": E[0] || (E[0] = (R) => We(a) ? a.value = R : null),
|
|
975
|
+
disabled: ee.value,
|
|
976
|
+
placeholder: i.placeholder,
|
|
977
|
+
autofocus: i.autofocus,
|
|
978
|
+
onKeydown: _(Te),
|
|
979
|
+
onCompositionstart: E[1] || (E[1] = (R) => C.value = !0),
|
|
980
|
+
onCompositionend: Oe,
|
|
981
|
+
onFocus: ke,
|
|
982
|
+
onBlur: Re
|
|
983
|
+
}, null, 8, ["autosize", "type", "readonly", "modelValue", "disabled", "placeholder", "autofocus", "onKeydown"]),
|
|
984
|
+
_(T) && !_(C) ? (N(), D("div", gt, [
|
|
985
|
+
M("span", vt, J(_(a)), 1),
|
|
986
|
+
be(J(_(T)) + " ", 1),
|
|
987
|
+
_(v) ? (N(), D("div", yt, "TAB")) : B("", !0)
|
|
988
|
+
])) : B("", !0)
|
|
989
|
+
]))
|
|
604
990
|
]),
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
"
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
"
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
991
|
+
I.value === "single" ? (N(), D("div", bt, [
|
|
992
|
+
M("div", {
|
|
993
|
+
class: "tiny-sender__buttons-container",
|
|
994
|
+
ref_key: "buttonsContainerRef",
|
|
995
|
+
ref: g
|
|
996
|
+
}, [
|
|
997
|
+
X(i.$slots, "actions"),
|
|
998
|
+
K(Ce, {
|
|
999
|
+
"allow-speech": i.allowSpeech,
|
|
1000
|
+
"allow-files": i.allowFiles,
|
|
1001
|
+
loading: i.loading,
|
|
1002
|
+
disabled: ee.value,
|
|
1003
|
+
"show-clear": i.clearable,
|
|
1004
|
+
"has-content": ge.value,
|
|
1005
|
+
"speech-status": _(Z),
|
|
1006
|
+
"submit-type": i.submitType,
|
|
1007
|
+
"is-over-limit": ie.value,
|
|
1008
|
+
onClear: le,
|
|
1009
|
+
onToggleSpeech: oe,
|
|
1010
|
+
onSubmit: _(ae),
|
|
1011
|
+
onCancel: E[2] || (E[2] = (R) => i.$emit("cancel"))
|
|
1012
|
+
}, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "submit-type", "is-over-limit", "onSubmit"])
|
|
1013
|
+
], 512)
|
|
1014
|
+
])) : B("", !0)
|
|
625
1015
|
], 2),
|
|
626
|
-
|
|
627
|
-
default:
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
key: 1,
|
|
632
|
-
style: p0(n.value),
|
|
1016
|
+
K(re, { name: "tiny-sender-slide-up" }, {
|
|
1017
|
+
default: j(() => [
|
|
1018
|
+
I.value === "multiple" ? (N(), D("div", {
|
|
1019
|
+
key: 0,
|
|
1020
|
+
style: Ke(De.value),
|
|
633
1021
|
class: "tiny-sender__footer-slot tiny-sender__bottom-row"
|
|
634
1022
|
}, [
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
1023
|
+
M("div", wt, [
|
|
1024
|
+
X(i.$slots, "footer-left")
|
|
1025
|
+
]),
|
|
1026
|
+
M("div", _t, [
|
|
1027
|
+
X(i.$slots, "footer-right"),
|
|
1028
|
+
i.showWordLimit && i.maxLength !== 1 / 0 ? (N(), D("div", {
|
|
1029
|
+
key: 0,
|
|
1030
|
+
class: Q(["tiny-sender__word-limit", { "is-over-limit": ie.value }])
|
|
1031
|
+
}, [
|
|
1032
|
+
M("span", Ct, J(_(a).length), 1),
|
|
1033
|
+
be("/" + J(i.maxLength), 1)
|
|
1034
|
+
], 2)) : B("", !0),
|
|
1035
|
+
I.value === "multiple" ? (N(), D("div", St, [
|
|
1036
|
+
M("div", Et, [
|
|
1037
|
+
K(Ce, {
|
|
1038
|
+
"allow-speech": i.allowSpeech,
|
|
1039
|
+
"allow-files": i.allowFiles,
|
|
1040
|
+
loading: i.loading,
|
|
1041
|
+
disabled: ee.value,
|
|
1042
|
+
"show-clear": i.clearable,
|
|
1043
|
+
"has-content": ge.value,
|
|
1044
|
+
"speech-status": _(Z),
|
|
1045
|
+
"submit-type": i.submitType,
|
|
1046
|
+
"is-over-limit": ie.value,
|
|
1047
|
+
onClear: le,
|
|
1048
|
+
onToggleSpeech: oe,
|
|
1049
|
+
onSubmit: _(ae),
|
|
1050
|
+
onCancel: E[3] || (E[3] = (R) => i.$emit("cancel"))
|
|
1051
|
+
}, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "submit-type", "is-over-limit", "onSubmit"])
|
|
1052
|
+
])
|
|
1053
|
+
])) : B("", !0)
|
|
1054
|
+
])
|
|
1055
|
+
], 4)) : i.$slots.footer ? (N(), D("div", Nt, [
|
|
1056
|
+
X(i.$slots, "footer")
|
|
1057
|
+
])) : B("", !0)
|
|
655
1058
|
]),
|
|
656
1059
|
_: 3
|
|
657
1060
|
})
|
|
658
|
-
])
|
|
1061
|
+
], 512)
|
|
659
1062
|
]),
|
|
660
|
-
|
|
661
|
-
default:
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
1063
|
+
K(re, { name: "tiny-sender-slide-up" }, {
|
|
1064
|
+
default: j(() => [
|
|
1065
|
+
_(r) && _(k).length ? (N(), D("div", {
|
|
1066
|
+
key: 0,
|
|
1067
|
+
ref_key: "suggestionsListRef",
|
|
1068
|
+
ref: A,
|
|
1069
|
+
class: "tiny-sender__suggestions"
|
|
1070
|
+
}, [
|
|
1071
|
+
(N(!0), D(we, null, _e(_(k), (R, z) => (N(), D("div", {
|
|
1072
|
+
key: z,
|
|
1073
|
+
class: Q(["suggestion-item", { highlighted: z === _(p) }]),
|
|
1074
|
+
onMouseenter: (U) => _(F)(z),
|
|
1075
|
+
onMousedown: Pe((U) => _(c)(R), ["prevent"])
|
|
1076
|
+
}, [
|
|
1077
|
+
M("span", kt, [
|
|
1078
|
+
K(_(Je))
|
|
1079
|
+
]),
|
|
1080
|
+
M("span", Rt, [
|
|
1081
|
+
(N(!0), D(we, null, _e(_(O)(R, _(a)), (U, ve) => (N(), D("span", {
|
|
1082
|
+
key: ve,
|
|
1083
|
+
class: Q({ "suggestion-item__text--match": U.isMatch, "suggestion-item__text--normal": !U.isMatch })
|
|
1084
|
+
}, J(U.text), 3))), 128))
|
|
1085
|
+
])
|
|
1086
|
+
], 42, Tt))), 128))
|
|
1087
|
+
], 512)) : B("", !0)
|
|
669
1088
|
]),
|
|
670
1089
|
_: 1
|
|
671
1090
|
}),
|
|
672
|
-
|
|
673
|
-
], 10,
|
|
1091
|
+
Y.value ? (N(), D("div", It, J(Y.value), 1)) : B("", !0)
|
|
1092
|
+
], 10, ut));
|
|
674
1093
|
}
|
|
675
1094
|
});
|
|
676
|
-
|
|
677
|
-
const
|
|
678
|
-
|
|
1095
|
+
se.name = "TrSender";
|
|
1096
|
+
const Dt = function(n) {
|
|
1097
|
+
n.component(se.name, se);
|
|
679
1098
|
};
|
|
680
|
-
|
|
1099
|
+
se.install = Dt;
|
|
681
1100
|
export {
|
|
682
|
-
|
|
1101
|
+
se as default
|
|
683
1102
|
};
|