@opentiny/tiny-robot 0.3.0-alpha.1 → 0.3.0-alpha.10
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 +43 -40
- package/dist/attachments/index.js +526 -0
- package/dist/base-popper/index.js +4 -0
- package/dist/bubble/index.js +1229 -2003
- package/dist/close.js +1 -1
- package/dist/container/index.js +4 -4
- package/dist/drag-overlay/index.js +57 -0
- package/dist/dropdown-menu/index.js +84 -64
- package/dist/feedback/index.js +39 -39
- package/dist/flow-layout-buttons/index.js +23 -20
- package/dist/history/index.js +37 -37
- package/dist/icon-button/index.js +18 -19
- package/dist/index.d.ts +952 -910
- package/dist/index.js +196 -77
- package/dist/index2.js +609 -524
- package/dist/index3.js +671 -290
- package/dist/index4.js +136 -622
- package/dist/index5.js +226 -2068
- package/dist/index6.js +2069 -4665
- package/dist/index7.js +4749 -0
- package/dist/question/index.js +84 -84
- package/dist/sender/index.js +1091 -1186
- package/dist/style.css +1 -1
- package/dist/suggestion/index.js +92 -92
- package/dist/suggestion-pills/index.js +131 -155
- package/dist/suggestion-popover/index.js +255 -225
- package/dist/tiny-robot-svgs.js +559 -234
- package/dist/useSlotRefs.js +36 -0
- package/dist/utils.js +4 -15
- package/package.json +3 -4
- package/dist/loading.js +0 -4
package/dist/sender/index.js
CHANGED
|
@@ -1,438 +1,286 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { I as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
() =>
|
|
12
|
-
(
|
|
13
|
-
|
|
1
|
+
import { ref as H, watch as ee, reactive as at, computed as L, nextTick as J, defineComponent as me, createElementBlock as R, openBlock as S, createCommentVNode as M, normalizeStyle as Pe, createBlock as Q, unref as C, withCtx as re, createElementVNode as U, createVNode as X, normalizeClass as te, toDisplayString as ae, useAttrs as lt, resolveComponent as rt, mergeProps as ve, Fragment as ie, renderList as ye, mergeModels as it, useModel as ut, Transition as He, withModifiers as ct, useSlots as dt, renderSlot as oe, isRef as ft, createTextVNode as Ge } from "vue";
|
|
2
|
+
import { I as pt } from "../index6.js";
|
|
3
|
+
import { d as ht } from "../index3.js";
|
|
4
|
+
import { T as Ee } from "../index2.js";
|
|
5
|
+
import { B as gt, Z as vt, a as yt, U as mt, O as St, b as wt, S as bt } from "../tiny-robot-svgs.js";
|
|
6
|
+
import { _ as Oe } from "../_plugin-vue_export-helper.js";
|
|
7
|
+
import { t as _t } from "../utils.js";
|
|
8
|
+
function Ct(i, c) {
|
|
9
|
+
const a = H(i.modelValue || i.defaultValue || ""), u = H(null);
|
|
10
|
+
ee(
|
|
11
|
+
() => i.modelValue,
|
|
12
|
+
(h) => {
|
|
13
|
+
h !== void 0 && h !== a.value && (a.value = h);
|
|
14
14
|
}
|
|
15
|
-
),
|
|
16
|
-
() =>
|
|
17
|
-
(
|
|
18
|
-
|
|
15
|
+
), ee(
|
|
16
|
+
() => a.value,
|
|
17
|
+
(h) => {
|
|
18
|
+
c("update:modelValue", h);
|
|
19
19
|
}
|
|
20
20
|
);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
!
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
21
|
+
const v = (h) => {
|
|
22
|
+
a.value = h, c("update:modelValue", h);
|
|
23
|
+
}, w = (h) => {
|
|
24
|
+
h == null || h.preventDefault();
|
|
25
|
+
const k = a.value;
|
|
26
|
+
!i.disabled && !i.loading && k.trim() && c("submit", k);
|
|
27
|
+
}, o = () => {
|
|
28
|
+
a.value = "", c("update:modelValue", ""), c("clear");
|
|
29
|
+
}, p = H(!1);
|
|
30
30
|
return {
|
|
31
|
-
inputValue:
|
|
32
|
-
inputWrapper:
|
|
33
|
-
isComposing:
|
|
34
|
-
handleChange:
|
|
35
|
-
handleSubmit:
|
|
36
|
-
handleClear:
|
|
31
|
+
inputValue: a,
|
|
32
|
+
inputWrapper: u,
|
|
33
|
+
isComposing: p,
|
|
34
|
+
handleChange: v,
|
|
35
|
+
handleSubmit: w,
|
|
36
|
+
handleClear: o,
|
|
37
37
|
clearInput: () => {
|
|
38
|
-
|
|
38
|
+
o();
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return;
|
|
49
|
-
const m = ye();
|
|
50
|
-
t.parentNode && t.parentNode.insertBefore(m, t.nextSibling);
|
|
51
|
-
}, _t = (t) => {
|
|
52
|
-
Array.from(t.childNodes).forEach((m) => {
|
|
53
|
-
if (m.nodeType === Node.TEXT_NODE && ee(m.textContent || "")) {
|
|
54
|
-
const o = m.previousSibling;
|
|
55
|
-
o && o.nodeType === Node.ELEMENT_NODE && o.classList.contains("template-field") || m.parentNode && m.parentNode.removeChild(m);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
function Tt(t, y, m, o, x, u, i, r, c, f, p, a, b, L) {
|
|
60
|
-
const _ = (h) => !(t.disabled || t.loading || h.trim().length === 0 || a.value), v = () => {
|
|
61
|
-
_(m.value) && y("submit", m.value.trim());
|
|
62
|
-
}, R = (h, $) => {
|
|
63
|
-
if (!(h.key === "Enter")) return !1;
|
|
64
|
-
switch ($) {
|
|
42
|
+
function kt(i, c, a, u, v, w, o, p, _, h, k, g, I, m, P, B) {
|
|
43
|
+
const A = () => {
|
|
44
|
+
g.value && (P != null && P.value && (B == null || B()), c("submit", a.value.trim()));
|
|
45
|
+
}, f = (y, W) => {
|
|
46
|
+
if (!(y.key === "Enter")) return !1;
|
|
47
|
+
switch (W) {
|
|
65
48
|
case "enter":
|
|
66
|
-
return !
|
|
49
|
+
return !y.shiftKey && !y.ctrlKey && !y.metaKey;
|
|
67
50
|
case "ctrlEnter":
|
|
68
|
-
return (
|
|
51
|
+
return (y.ctrlKey || y.metaKey) && !y.shiftKey;
|
|
69
52
|
case "shiftEnter":
|
|
70
|
-
return
|
|
53
|
+
return y.shiftKey && !y.ctrlKey && !y.metaKey;
|
|
71
54
|
default:
|
|
72
55
|
return !1;
|
|
73
56
|
}
|
|
74
57
|
};
|
|
75
58
|
return {
|
|
76
|
-
handleKeyPress: (
|
|
77
|
-
if (
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
` +
|
|
83
|
-
|
|
59
|
+
handleKeyPress: (y) => {
|
|
60
|
+
if (u.value) return;
|
|
61
|
+
if (y.key === "Enter" && y.shiftKey && (I == null ? void 0 : I.value) === "single" && m) {
|
|
62
|
+
y.preventDefault(), m();
|
|
63
|
+
const K = y.target, q = K.selectionStart, Z = a.value;
|
|
64
|
+
a.value = Z.substring(0, q) + `
|
|
65
|
+
` + Z.substring(q), setTimeout(() => {
|
|
66
|
+
K.selectionStart = K.selectionEnd = q + 1;
|
|
84
67
|
}, 0);
|
|
85
68
|
return;
|
|
86
69
|
}
|
|
87
|
-
if (
|
|
88
|
-
|
|
70
|
+
if (y.key === "Tab" && w.value && o.value) {
|
|
71
|
+
y.preventDefault(), p();
|
|
89
72
|
return;
|
|
90
73
|
}
|
|
91
|
-
if (
|
|
92
|
-
if (
|
|
93
|
-
|
|
74
|
+
if (w.value) {
|
|
75
|
+
if (y.key === "ArrowDown") {
|
|
76
|
+
y.preventDefault(), h("down");
|
|
94
77
|
return;
|
|
95
78
|
}
|
|
96
|
-
if (
|
|
97
|
-
|
|
79
|
+
if (y.key === "ArrowUp") {
|
|
80
|
+
y.preventDefault(), h("up");
|
|
98
81
|
return;
|
|
99
82
|
}
|
|
100
|
-
if (
|
|
101
|
-
|
|
83
|
+
if (y.key === "Enter" && o.value) {
|
|
84
|
+
y.preventDefault(), p();
|
|
102
85
|
return;
|
|
103
86
|
}
|
|
104
87
|
}
|
|
105
|
-
if (
|
|
106
|
-
|
|
88
|
+
if (y.key === "Escape") {
|
|
89
|
+
w.value ? (_(), y.preventDefault()) : v.isRecording && (k(), y.preventDefault()), c("escape-press");
|
|
107
90
|
return;
|
|
108
91
|
}
|
|
109
|
-
|
|
92
|
+
f(y, i.submitType) && (y.preventDefault(), g.value && A());
|
|
110
93
|
},
|
|
111
|
-
triggerSubmit:
|
|
94
|
+
triggerSubmit: A
|
|
112
95
|
};
|
|
113
96
|
}
|
|
114
|
-
function
|
|
115
|
-
const
|
|
116
|
-
var L, _;
|
|
117
|
-
const { startOffset: c, collapsed: f } = i;
|
|
118
|
-
let p = i.startContainer;
|
|
119
|
-
if ((L = p.parentElement) != null && L.classList.contains("template-field") && (p = p.parentElement), !f) return !1;
|
|
120
|
-
const a = p.nodeType === Node.TEXT_NODE && c === 0 && u.key === "ArrowLeft", b = p.nodeType === Node.TEXT_NODE && c === (((_ = p.textContent) == null ? void 0 : _.length) || 0) && u.key === "ArrowRight";
|
|
121
|
-
if (a || b) {
|
|
122
|
-
let v = null, R = "inside";
|
|
123
|
-
if (a)
|
|
124
|
-
if (p.parentNode && p.parentNode.classList.contains("template-field"))
|
|
125
|
-
v = p.parentNode, R = "before";
|
|
126
|
-
else {
|
|
127
|
-
let w = p.previousSibling;
|
|
128
|
-
!w && p.parentNode && p.parentNode !== r && (w = p.parentNode.previousSibling), w && w.nodeType === Node.ELEMENT_NODE && w.classList.contains("template-field") && (v = w, R = "inside");
|
|
129
|
-
}
|
|
130
|
-
else if (b)
|
|
131
|
-
if (p.parentNode && p.parentNode.classList.contains("template-field"))
|
|
132
|
-
v = p.parentNode, R = "after";
|
|
133
|
-
else {
|
|
134
|
-
let w = p.nextSibling;
|
|
135
|
-
!w && p.parentNode && p.parentNode !== r && (w = p.parentNode.nextSibling), w && w.nodeType === Node.ELEMENT_NODE && w.classList.contains("template-field") && (v = w, R = "inside");
|
|
136
|
-
}
|
|
137
|
-
if (v) {
|
|
138
|
-
u.preventDefault();
|
|
139
|
-
const w = document.createRange(), h = z(r);
|
|
140
|
-
return h && (R === "before" ? w.setStartBefore(v) : R === "after" ? w.setStartAfter(v) : (w.selectNodeContents(v), w.collapse(u.key === "ArrowLeft")), h.removeAllRanges(), h.addRange(w)), !0;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (p.nodeType === Node.ELEMENT_NODE && p.classList.contains("template-field")) {
|
|
144
|
-
const R = p.textContent || "", w = J(R);
|
|
145
|
-
if (!w || w.trim() === "") {
|
|
146
|
-
u.preventDefault();
|
|
147
|
-
const h = document.createRange(), $ = z(r);
|
|
148
|
-
if (!$) return !0;
|
|
149
|
-
if (u.key === "ArrowLeft")
|
|
150
|
-
h.setStartBefore(p);
|
|
151
|
-
else {
|
|
152
|
-
const V = p.nextSibling;
|
|
153
|
-
V && V.nodeType === Node.TEXT_NODE && ee(V.textContent || "") ? (h.setStart(V, 0), h.setEnd(V, 0)) : h.setStartAfter(p);
|
|
154
|
-
}
|
|
155
|
-
return h.collapse(!0), $.removeAllRanges(), $.addRange(h), !0;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
if (p.nodeType === Node.TEXT_NODE && ee(p.textContent || "")) {
|
|
159
|
-
const v = p.previousSibling, R = p.nextSibling;
|
|
160
|
-
u.preventDefault();
|
|
161
|
-
const w = document.createRange(), h = z(r);
|
|
162
|
-
return h && (u.key === "ArrowLeft" ? v && v.nodeType === Node.ELEMENT_NODE && v.classList.contains("template-field") ? (w.selectNodeContents(v), w.collapse(!1)) : w.setStartBefore(p) : R ? R.nodeType === Node.ELEMENT_NODE && R.classList.contains("template-field") ? (w.selectNodeContents(R), w.collapse(!0)) : pt(r) ? (w.setStart(R, 1), w.collapse(!0)) : w.setStartAfter(p) : w.setStartAfter(p), h.removeAllRanges(), h.addRange(w)), !0;
|
|
163
|
-
}
|
|
164
|
-
return !1;
|
|
165
|
-
}, m = (u, i, r) => {
|
|
166
|
-
if (!i.collapsed) return !1;
|
|
167
|
-
const { startContainer: c, startOffset: f } = i;
|
|
168
|
-
if (c.nodeType === Node.TEXT_NODE && ee(c.textContent || "")) {
|
|
169
|
-
const a = c.previousSibling;
|
|
170
|
-
if (a && a.nodeType === Node.ELEMENT_NODE && a.classList.contains("template-field")) {
|
|
171
|
-
const b = a, L = b.textContent || "", _ = J(L);
|
|
172
|
-
if (!_ || _.trim() === "") {
|
|
173
|
-
u.preventDefault();
|
|
174
|
-
const v = b.previousSibling, R = c.nextSibling;
|
|
175
|
-
b.parentNode && b.parentNode.removeChild(b), c.parentNode && c.parentNode.removeChild(c);
|
|
176
|
-
const w = z(r);
|
|
177
|
-
if (w) {
|
|
178
|
-
const h = document.createRange();
|
|
179
|
-
v ? v.nodeType === Node.ELEMENT_NODE && v.classList.contains("template-field") ? (h.selectNodeContents(v), h.collapse(!1)) : v.nodeType === Node.TEXT_NODE && ee(v.textContent || "") ? (h.setStart(v, 0), h.setEnd(v, 0)) : h.setStartAfter(v) : R ? h.setStartBefore(R) : h.setStart(r, 0), h.collapse(!0), w.removeAllRanges(), w.addRange(h);
|
|
180
|
-
}
|
|
181
|
-
return t.handleInput(), !0;
|
|
182
|
-
} else {
|
|
183
|
-
u.preventDefault();
|
|
184
|
-
const v = z(r);
|
|
185
|
-
if (v) {
|
|
186
|
-
const R = document.createRange();
|
|
187
|
-
R.selectNodeContents(b), R.collapse(!1), v.removeAllRanges(), v.addRange(R);
|
|
188
|
-
}
|
|
189
|
-
return !0;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
if (c.nodeType === Node.TEXT_NODE && c.parentNode && c.parentNode.classList.contains("template-field") && c.textContent) {
|
|
194
|
-
const a = c.textContent;
|
|
195
|
-
if (J(a).length === 1 && f === a.length) {
|
|
196
|
-
u.preventDefault(), c.textContent = "";
|
|
197
|
-
const L = c.parentNode, _ = z(r);
|
|
198
|
-
if (_) {
|
|
199
|
-
const v = document.createRange();
|
|
200
|
-
v.selectNodeContents(L), v.collapse(!0), _.removeAllRanges(), _.addRange(v);
|
|
201
|
-
}
|
|
202
|
-
return t.handleInput(), !0;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
if (f === 0) {
|
|
206
|
-
let a = null;
|
|
207
|
-
if (c.nodeType === Node.ELEMENT_NODE && c.classList.contains("template-field") ? a = c : c.nodeType === Node.TEXT_NODE && c.parentNode && c.parentNode.classList.contains("template-field") && (a = c.parentNode), a) {
|
|
208
|
-
u.preventDefault();
|
|
209
|
-
const b = z(r);
|
|
210
|
-
return b && (i.setStartBefore(a), i.collapse(!0), b.removeAllRanges(), b.addRange(i)), !0;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return !1;
|
|
214
|
-
}, o = (u, i, r) => {
|
|
215
|
-
if (!i.collapsed) return !1;
|
|
216
|
-
const { startContainer: c, startOffset: f } = i;
|
|
217
|
-
if (c.nodeType === Node.TEXT_NODE && c.parentNode && c.parentNode.classList.contains("template-field") && c.textContent) {
|
|
218
|
-
const a = c.textContent, b = J(a);
|
|
219
|
-
if (f === a.length && b.length === 1) {
|
|
220
|
-
u.preventDefault(), c.textContent = "";
|
|
221
|
-
const L = c.parentNode, _ = z(r);
|
|
222
|
-
if (_) {
|
|
223
|
-
const v = document.createRange();
|
|
224
|
-
v.selectNodeContents(L), v.collapse(!0), _.removeAllRanges(), _.addRange(v);
|
|
225
|
-
}
|
|
226
|
-
return t.handleInput(), !0;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
return !1;
|
|
230
|
-
};
|
|
231
|
-
return {
|
|
232
|
-
handleTemplateKeyDown: (u) => {
|
|
233
|
-
if (t.isComposing.value) return;
|
|
234
|
-
const i = t.editor.value;
|
|
235
|
-
if (!i) return;
|
|
236
|
-
const r = z(i);
|
|
237
|
-
if (!r || r.rangeCount === 0) return;
|
|
238
|
-
const c = r.getRangeAt(0);
|
|
239
|
-
if (u.key === "Enter") {
|
|
240
|
-
u.preventDefault(), t.onSubmit(t.getValueFromDOM());
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
(u.key === "ArrowLeft" || u.key === "ArrowRight") && !u.shiftKey && y(u, c, i) || u.key === "Backspace" && m(u, c, i) || u.key === "Delete" && o(u, c, i);
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
function xt(t) {
|
|
248
|
-
const y = $e({
|
|
97
|
+
function xt(i) {
|
|
98
|
+
const c = at({
|
|
249
99
|
isRecording: !1,
|
|
250
100
|
isSupported: typeof window < "u" && "webkitSpeechRecognition" in window || "SpeechRecognition" in window,
|
|
251
101
|
error: void 0
|
|
252
|
-
}),
|
|
253
|
-
|
|
254
|
-
var
|
|
255
|
-
|
|
256
|
-
},
|
|
257
|
-
var
|
|
258
|
-
|
|
259
|
-
},
|
|
260
|
-
var
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
},
|
|
264
|
-
var
|
|
265
|
-
|
|
102
|
+
}), a = c.isSupported ? new (window.webkitSpeechRecognition || window.SpeechRecognition)() : void 0;
|
|
103
|
+
a !== void 0 && (a.continuous = i.continuous ?? !1, a.interimResults = i.interimResults ?? !0, a.lang = i.lang ?? navigator.language, a.onstart = () => {
|
|
104
|
+
var o;
|
|
105
|
+
c.isRecording = !0, c.error = void 0, (o = i.onStart) == null || o.call(i);
|
|
106
|
+
}, a.onend = () => {
|
|
107
|
+
var o;
|
|
108
|
+
c.isRecording = !1, (o = i.onEnd) == null || o.call(i);
|
|
109
|
+
}, a.onresult = (o) => {
|
|
110
|
+
var _, h;
|
|
111
|
+
const p = Array.from(o.results).map((k) => k[0].transcript).join("");
|
|
112
|
+
o.results[0].isFinal ? (_ = i.onFinal) == null || _.call(i, p) : (h = i.onInterim) == null || h.call(i, p);
|
|
113
|
+
}, a.onerror = (o) => {
|
|
114
|
+
var p;
|
|
115
|
+
c.error = new Error(o.error), c.isRecording = !1, (p = i.onError) == null || p.call(i, c.error);
|
|
266
116
|
});
|
|
267
|
-
const
|
|
268
|
-
var
|
|
269
|
-
if (!
|
|
270
|
-
const
|
|
271
|
-
|
|
117
|
+
const u = () => {
|
|
118
|
+
var o;
|
|
119
|
+
if (!a) {
|
|
120
|
+
const p = new Error("浏览器不支持语音识别");
|
|
121
|
+
c.error = p, (o = i.onError) == null || o.call(i, p);
|
|
272
122
|
return;
|
|
273
123
|
}
|
|
274
|
-
if (
|
|
124
|
+
if (c.isRecording) {
|
|
275
125
|
try {
|
|
276
|
-
|
|
126
|
+
a.stop(), setTimeout(() => {
|
|
277
127
|
try {
|
|
278
|
-
|
|
279
|
-
} catch (
|
|
280
|
-
|
|
128
|
+
a.start();
|
|
129
|
+
} catch (p) {
|
|
130
|
+
w(p);
|
|
281
131
|
}
|
|
282
132
|
}, 100);
|
|
283
|
-
} catch (
|
|
284
|
-
|
|
133
|
+
} catch (p) {
|
|
134
|
+
w(p);
|
|
285
135
|
}
|
|
286
136
|
return;
|
|
287
137
|
}
|
|
288
138
|
try {
|
|
289
|
-
|
|
290
|
-
} catch (
|
|
291
|
-
|
|
139
|
+
a.start();
|
|
140
|
+
} catch (p) {
|
|
141
|
+
w(p);
|
|
292
142
|
}
|
|
293
|
-
},
|
|
294
|
-
if (
|
|
143
|
+
}, v = () => {
|
|
144
|
+
if (a && c.isRecording)
|
|
295
145
|
try {
|
|
296
|
-
|
|
297
|
-
} catch (
|
|
298
|
-
|
|
146
|
+
a.stop();
|
|
147
|
+
} catch (o) {
|
|
148
|
+
w(o);
|
|
299
149
|
}
|
|
300
|
-
},
|
|
301
|
-
var
|
|
302
|
-
|
|
150
|
+
}, w = (o) => {
|
|
151
|
+
var p;
|
|
152
|
+
c.error = o instanceof Error ? o : new Error("语音识别操作失败"), c.isRecording = !1, (p = i.onError) == null || p.call(i, c.error);
|
|
303
153
|
};
|
|
304
154
|
return {
|
|
305
|
-
speechState:
|
|
306
|
-
start:
|
|
307
|
-
stop:
|
|
155
|
+
speechState: c,
|
|
156
|
+
start: u,
|
|
157
|
+
stop: v
|
|
308
158
|
};
|
|
309
159
|
}
|
|
310
|
-
const
|
|
311
|
-
if (!
|
|
312
|
-
return [{ text:
|
|
313
|
-
const
|
|
314
|
-
let
|
|
315
|
-
for (;
|
|
316
|
-
const
|
|
317
|
-
if (
|
|
318
|
-
|
|
319
|
-
start:
|
|
320
|
-
end:
|
|
321
|
-
}),
|
|
160
|
+
const It = (i, c) => {
|
|
161
|
+
if (!c || !i)
|
|
162
|
+
return [{ text: i, isMatch: !1 }];
|
|
163
|
+
const a = i.toLowerCase(), u = c.toLowerCase(), v = [];
|
|
164
|
+
let w = 0;
|
|
165
|
+
for (; w < a.length; ) {
|
|
166
|
+
const h = a.indexOf(u, w);
|
|
167
|
+
if (h === -1) break;
|
|
168
|
+
v.push({
|
|
169
|
+
start: h,
|
|
170
|
+
end: h + c.length
|
|
171
|
+
}), w = h + 1;
|
|
322
172
|
}
|
|
323
|
-
if (
|
|
324
|
-
return [{ text:
|
|
325
|
-
const
|
|
326
|
-
for (const
|
|
327
|
-
if (
|
|
328
|
-
|
|
173
|
+
if (v.length === 0)
|
|
174
|
+
return [{ text: i, isMatch: !1 }];
|
|
175
|
+
const o = [];
|
|
176
|
+
for (const h of v)
|
|
177
|
+
if (o.length === 0)
|
|
178
|
+
o.push(h);
|
|
329
179
|
else {
|
|
330
|
-
const
|
|
331
|
-
|
|
180
|
+
const k = o[o.length - 1];
|
|
181
|
+
h.start <= k.end ? k.end = Math.max(k.end, h.end) : o.push(h);
|
|
332
182
|
}
|
|
333
|
-
const
|
|
334
|
-
let
|
|
335
|
-
for (const
|
|
336
|
-
|
|
337
|
-
text:
|
|
183
|
+
const p = [];
|
|
184
|
+
let _ = 0;
|
|
185
|
+
for (const h of o)
|
|
186
|
+
_ < h.start && p.push({
|
|
187
|
+
text: i.substring(_, h.start),
|
|
338
188
|
isMatch: !1
|
|
339
|
-
}),
|
|
340
|
-
text:
|
|
189
|
+
}), p.push({
|
|
190
|
+
text: i.substring(h.start, h.end),
|
|
341
191
|
isMatch: !0
|
|
342
|
-
}),
|
|
343
|
-
return
|
|
344
|
-
text:
|
|
192
|
+
}), _ = h.end;
|
|
193
|
+
return _ < i.length && p.push({
|
|
194
|
+
text: i.substring(_),
|
|
345
195
|
isMatch: !1
|
|
346
|
-
}),
|
|
196
|
+
}), p;
|
|
347
197
|
};
|
|
348
|
-
function Rt(
|
|
349
|
-
const
|
|
350
|
-
if (!
|
|
351
|
-
const
|
|
352
|
-
return
|
|
353
|
-
}),
|
|
354
|
-
let
|
|
355
|
-
return
|
|
356
|
-
}),
|
|
357
|
-
if (
|
|
358
|
-
|
|
198
|
+
function Rt(i, c, a, u, v) {
|
|
199
|
+
const w = H(!1), o = H(-1), p = H(-1), _ = H(""), h = H(!1), k = H(null), g = H(!1), I = H(null), m = L(() => {
|
|
200
|
+
if (!i.suggestions || !a.value || v.value) return [];
|
|
201
|
+
const O = a.value.toLowerCase();
|
|
202
|
+
return i.suggestions.filter((V) => V.toLowerCase().includes(O));
|
|
203
|
+
}), P = L(() => {
|
|
204
|
+
let O = -1;
|
|
205
|
+
return I.value === "mouse" && p.value !== -1 ? O = p.value : I.value === "keyboard" && o.value !== -1 && (O = o.value), m.value[O] || null;
|
|
206
|
+
}), B = (O) => O === o.value || O === p.value, A = (O) => {
|
|
207
|
+
if (I.value === null) {
|
|
208
|
+
_.value = "", h.value = !1;
|
|
359
209
|
return;
|
|
360
210
|
}
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
},
|
|
364
|
-
|
|
365
|
-
},
|
|
366
|
-
|
|
367
|
-
},
|
|
368
|
-
|
|
369
|
-
|
|
211
|
+
const V = O || P.value;
|
|
212
|
+
V && a.value && V.toLowerCase().startsWith(a.value.toLowerCase()) ? (_.value = V.substring(a.value.length), h.value = !0) : (_.value = "", h.value = !1);
|
|
213
|
+
}, f = () => {
|
|
214
|
+
w.value = !1, o.value = -1, p.value = -1, I.value = null, _.value = "", h.value = !1;
|
|
215
|
+
}, E = () => {
|
|
216
|
+
w.value = !0, o.value = -1, p.value = -1, I.value = null, A();
|
|
217
|
+
}, y = () => {
|
|
218
|
+
u.value || g.value || J(() => {
|
|
219
|
+
a.value && i.suggestions && i.suggestions.length > 0 && !v.value && m.value.length > 0 ? E() : f();
|
|
370
220
|
});
|
|
371
221
|
};
|
|
372
|
-
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
|
|
222
|
+
ee(a, y), ee(() => i.suggestions, y);
|
|
223
|
+
const W = (O) => {
|
|
224
|
+
g.value = !0, a.value = O, c("update:modelValue", O), c("suggestion-select", O), q(), J(() => {
|
|
225
|
+
g.value = !1;
|
|
376
226
|
});
|
|
377
|
-
}, V = () => {
|
|
378
|
-
L.value && $(L.value);
|
|
379
227
|
}, K = () => {
|
|
380
|
-
|
|
228
|
+
P.value && W(P.value);
|
|
229
|
+
}, q = () => {
|
|
230
|
+
f();
|
|
381
231
|
};
|
|
382
232
|
return {
|
|
383
|
-
showSuggestionsPopup:
|
|
384
|
-
completionPlaceholder:
|
|
385
|
-
showTabHint:
|
|
386
|
-
suggestionsListRef:
|
|
387
|
-
filteredSuggestions:
|
|
388
|
-
activeSuggestion:
|
|
389
|
-
isItemHighlighted:
|
|
390
|
-
updateCompletionPlaceholder:
|
|
391
|
-
updateSuggestionsState:
|
|
392
|
-
selectSuggestion:
|
|
393
|
-
acceptCurrentSuggestion:
|
|
394
|
-
closeSuggestionsPopup:
|
|
395
|
-
navigateSuggestions: (
|
|
396
|
-
if (!
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
const
|
|
401
|
-
if (
|
|
402
|
-
const
|
|
403
|
-
|
|
233
|
+
showSuggestionsPopup: w,
|
|
234
|
+
completionPlaceholder: _,
|
|
235
|
+
showTabHint: h,
|
|
236
|
+
suggestionsListRef: k,
|
|
237
|
+
filteredSuggestions: m,
|
|
238
|
+
activeSuggestion: P,
|
|
239
|
+
isItemHighlighted: B,
|
|
240
|
+
updateCompletionPlaceholder: A,
|
|
241
|
+
updateSuggestionsState: y,
|
|
242
|
+
selectSuggestion: W,
|
|
243
|
+
acceptCurrentSuggestion: K,
|
|
244
|
+
closeSuggestionsPopup: q,
|
|
245
|
+
navigateSuggestions: (O) => {
|
|
246
|
+
if (!w.value || m.value.length === 0) return;
|
|
247
|
+
I.value = "keyboard", o.value === -1 ? o.value = O === "down" ? 0 : m.value.length - 1 : O === "down" ? o.value = (o.value + 1) % m.value.length : o.value = (o.value - 1 + m.value.length) % m.value.length;
|
|
248
|
+
const V = m.value[o.value];
|
|
249
|
+
V && A(V);
|
|
250
|
+
const le = k.value;
|
|
251
|
+
if (le) {
|
|
252
|
+
const j = le.children[o.value];
|
|
253
|
+
j && j.scrollIntoView({ block: "nearest" });
|
|
404
254
|
}
|
|
405
255
|
},
|
|
406
|
-
handleSuggestionItemHover: (
|
|
407
|
-
|
|
256
|
+
handleSuggestionItemHover: (O) => {
|
|
257
|
+
I.value = "mouse", p.value = O, A(m.value[O]);
|
|
408
258
|
},
|
|
409
259
|
handleSuggestionItemLeave: () => {
|
|
410
|
-
if (
|
|
411
|
-
|
|
412
|
-
const
|
|
413
|
-
|
|
260
|
+
if (p.value = -1, o.value !== -1) {
|
|
261
|
+
I.value = "keyboard";
|
|
262
|
+
const O = m.value[o.value];
|
|
263
|
+
O && A(O);
|
|
414
264
|
} else
|
|
415
|
-
|
|
265
|
+
I.value = null, A();
|
|
416
266
|
},
|
|
417
267
|
handleClickOutside: () => {
|
|
418
|
-
|
|
268
|
+
q();
|
|
419
269
|
},
|
|
420
|
-
highlightSuggestionText:
|
|
270
|
+
highlightSuggestionText: It
|
|
421
271
|
};
|
|
422
272
|
}
|
|
423
|
-
const
|
|
273
|
+
const Ot = { class: "action-buttons" }, Tt = { class: "action-buttons__submit-content" }, $t = {
|
|
424
274
|
key: 0,
|
|
425
|
-
class: "action-
|
|
426
|
-
},
|
|
427
|
-
key: 1,
|
|
428
|
-
class: "action-buttons__cancel"
|
|
429
|
-
}, We = /* @__PURE__ */ be({
|
|
275
|
+
class: "action-buttons__cancel-text"
|
|
276
|
+
}, Bt = /* @__PURE__ */ me({
|
|
430
277
|
__name: "ActionButtons",
|
|
431
278
|
props: {
|
|
432
279
|
loading: { type: Boolean, default: !1 },
|
|
433
280
|
disabled: { type: Boolean, default: !1 },
|
|
434
281
|
showClear: { type: Boolean, default: !0 },
|
|
435
282
|
hasContent: { type: Boolean, default: !1 },
|
|
283
|
+
buttonGroup: {},
|
|
436
284
|
allowSpeech: { type: Boolean, default: !1 },
|
|
437
285
|
speechStatus: { default: () => ({
|
|
438
286
|
isRecording: !1,
|
|
@@ -441,617 +289,672 @@ const Dt = { class: "action-buttons" }, Ft = {
|
|
|
441
289
|
allowFiles: { type: Boolean, default: !1 },
|
|
442
290
|
submitType: { default: "enter" },
|
|
443
291
|
showShortcuts: { type: Boolean },
|
|
444
|
-
isOverLimit: { type: Boolean, default: !1 }
|
|
292
|
+
isOverLimit: { type: Boolean, default: !1 },
|
|
293
|
+
stopText: { default: void 0 }
|
|
445
294
|
},
|
|
446
|
-
emits: ["clear", "toggle-speech", "submit", "cancel"],
|
|
447
|
-
setup(
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
if (
|
|
452
|
-
|
|
453
|
-
|
|
295
|
+
emits: ["clear", "toggle-speech", "submit", "cancel", "trigger-select"],
|
|
296
|
+
setup(i, { emit: c }) {
|
|
297
|
+
const a = i, u = c, v = L(() => {
|
|
298
|
+
var E, y;
|
|
299
|
+
const f = (y = (E = a.buttonGroup) == null ? void 0 : E.file) == null ? void 0 : y.tooltips;
|
|
300
|
+
if (typeof f == "string" && f)
|
|
301
|
+
return () => f;
|
|
302
|
+
if (typeof f == "function")
|
|
303
|
+
return f;
|
|
304
|
+
}), w = L(() => {
|
|
305
|
+
var E, y;
|
|
306
|
+
const f = (y = (E = a.buttonGroup) == null ? void 0 : E.submit) == null ? void 0 : y.tooltips;
|
|
307
|
+
if (typeof f == "string" && f)
|
|
308
|
+
return () => f;
|
|
309
|
+
if (typeof f == "function")
|
|
310
|
+
return f;
|
|
311
|
+
}), o = L(() => a.allowSpeech), p = L(() => a.speechStatus.isRecording), _ = L(() => a.disabled), h = L(() => {
|
|
312
|
+
var f, E;
|
|
313
|
+
return _.value || a.isOverLimit || ((E = (f = a.buttonGroup) == null ? void 0 : f.submit) == null ? void 0 : E.disabled);
|
|
314
|
+
}), k = L(() => a.allowFiles || a.allowSpeech || a.showClear), g = () => {
|
|
315
|
+
_.value || u("clear");
|
|
316
|
+
}, I = () => {
|
|
317
|
+
if (!_.value) {
|
|
318
|
+
const f = !a.speechStatus.isRecording;
|
|
319
|
+
u("toggle-speech", f);
|
|
454
320
|
}
|
|
455
|
-
},
|
|
456
|
-
|
|
457
|
-
},
|
|
458
|
-
|
|
321
|
+
}, m = () => {
|
|
322
|
+
h.value || u("submit");
|
|
323
|
+
}, P = () => {
|
|
324
|
+
_.value || u("cancel");
|
|
325
|
+
}, B = L(() => {
|
|
326
|
+
var f, E;
|
|
327
|
+
return _.value || ((E = (f = a.buttonGroup) == null ? void 0 : f.file) == null ? void 0 : E.disabled);
|
|
328
|
+
}), A = () => {
|
|
329
|
+
B.value || u("trigger-select");
|
|
459
330
|
};
|
|
460
|
-
return (
|
|
461
|
-
|
|
462
|
-
|
|
331
|
+
return (f, E) => (S(), R("div", Ot, [
|
|
332
|
+
k.value ? (S(), R("div", {
|
|
333
|
+
key: 0,
|
|
334
|
+
class: "action-buttons__utility",
|
|
335
|
+
style: Pe({ "padding-right": f.hasContent || f.loading ? "0" : "6px" })
|
|
336
|
+
}, [
|
|
337
|
+
f.allowFiles && !f.loading ? (S(), Q(C(Ee), {
|
|
463
338
|
key: 0,
|
|
464
|
-
|
|
465
|
-
placement: "top"
|
|
339
|
+
effect: "light",
|
|
340
|
+
placement: "top",
|
|
341
|
+
"render-content": v.value,
|
|
342
|
+
"visible-arrow": !1
|
|
466
343
|
}, {
|
|
467
|
-
default:
|
|
468
|
-
|
|
469
|
-
class: "action-buttons__button
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
})
|
|
478
|
-
]),
|
|
479
|
-
_: 1
|
|
480
|
-
}, 8, ["disabled"])
|
|
344
|
+
default: re(() => [
|
|
345
|
+
U("div", {
|
|
346
|
+
class: "action-buttons__button",
|
|
347
|
+
onClick: A
|
|
348
|
+
}, [
|
|
349
|
+
X(C(gt), {
|
|
350
|
+
class: te(["action-buttons__icon", "action-buttons__icon--upload", { "is-disabled": B.value }]),
|
|
351
|
+
alt: "上传文件"
|
|
352
|
+
}, null, 8, ["class"])
|
|
353
|
+
])
|
|
481
354
|
]),
|
|
482
355
|
_: 1
|
|
483
|
-
})) :
|
|
484
|
-
|
|
356
|
+
}, 8, ["render-content"])) : M("", !0),
|
|
357
|
+
o.value && !f.loading ? (S(), R("div", {
|
|
485
358
|
key: 1,
|
|
486
|
-
class:
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
}))
|
|
501
|
-
]),
|
|
502
|
-
_: 1
|
|
503
|
-
}, 8, ["disabled", "class"])) : H("", !0),
|
|
504
|
-
_.showClear ? (D(), Q(E(Ve), {
|
|
359
|
+
class: te(["action-buttons__button", { "is-recording": p.value }]),
|
|
360
|
+
onClick: I
|
|
361
|
+
}, [
|
|
362
|
+
p.value ? (S(), Q(C(yt), {
|
|
363
|
+
key: 1,
|
|
364
|
+
class: "action-buttons__icon action-buttons__icon--recording",
|
|
365
|
+
alt: "语音中"
|
|
366
|
+
})) : (S(), Q(C(vt), {
|
|
367
|
+
key: 0,
|
|
368
|
+
class: "action-buttons__icon",
|
|
369
|
+
alt: "录音"
|
|
370
|
+
}))
|
|
371
|
+
], 2)) : M("", !0),
|
|
372
|
+
f.showClear ? (S(), Q(C(Ee), {
|
|
505
373
|
key: 2,
|
|
506
374
|
content: "清空内容",
|
|
507
375
|
placement: "top"
|
|
508
376
|
}, {
|
|
509
|
-
default:
|
|
510
|
-
|
|
511
|
-
class: "action-buttons__button
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
default: Y(() => [
|
|
517
|
-
(D(), Q(it(E(m)), { class: "action-buttons__icon action-buttons__icon--close" }))
|
|
518
|
-
]),
|
|
519
|
-
_: 1
|
|
520
|
-
}, 8, ["disabled"])
|
|
377
|
+
default: re(() => [
|
|
378
|
+
U("div", {
|
|
379
|
+
class: "action-buttons__button",
|
|
380
|
+
onClick: g
|
|
381
|
+
}, [
|
|
382
|
+
X(C(mt), { class: "action-buttons__icon action-buttons__icon--clear" })
|
|
383
|
+
])
|
|
521
384
|
]),
|
|
522
385
|
_: 1
|
|
523
|
-
})) :
|
|
524
|
-
])) :
|
|
525
|
-
|
|
386
|
+
})) : M("", !0)
|
|
387
|
+
], 4)) : M("", !0),
|
|
388
|
+
f.hasContent || f.loading ? (S(), R("div", {
|
|
526
389
|
key: 1,
|
|
527
|
-
type: "text",
|
|
528
390
|
class: "action-buttons__button action-buttons__submit",
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
391
|
+
onClick: E[0] || (E[0] = (y) => f.loading ? P() : m())
|
|
392
|
+
}, [
|
|
393
|
+
U("div", Tt, [
|
|
394
|
+
f.loading ? (S(), R("div", {
|
|
395
|
+
key: 1,
|
|
396
|
+
class: te(["action-buttons__cancel", { "action-buttons__cancel--icon-only": !f.stopText }])
|
|
397
|
+
}, [
|
|
398
|
+
X(C(wt), {
|
|
399
|
+
class: "action-buttons__icon action-buttons__icon--cancel",
|
|
400
|
+
alt: "停止"
|
|
401
|
+
}),
|
|
402
|
+
f.stopText ? (S(), R("span", $t, ae(f.stopText), 1)) : M("", !0)
|
|
403
|
+
], 2)) : (S(), Q(C(Ee), {
|
|
404
|
+
key: 0,
|
|
405
|
+
effect: "light",
|
|
406
|
+
placement: "top",
|
|
407
|
+
"render-content": w.value,
|
|
408
|
+
"visible-arrow": !1
|
|
409
|
+
}, {
|
|
410
|
+
default: re(() => [
|
|
411
|
+
X(C(St), {
|
|
412
|
+
class: te(["action-buttons__icon", "action-buttons__icon--send", { "is-disabled": h.value }]),
|
|
413
|
+
alt: "发送"
|
|
414
|
+
}, null, 8, ["class"])
|
|
415
|
+
]),
|
|
416
|
+
_: 1
|
|
417
|
+
}, 8, ["render-content"]))
|
|
418
|
+
])
|
|
419
|
+
])) : M("", !0)
|
|
549
420
|
]));
|
|
550
421
|
}
|
|
551
|
-
})
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
else
|
|
583
|
-
for (const T of Array.from(g.childNodes))
|
|
584
|
-
s += l(T);
|
|
585
|
-
}
|
|
586
|
-
return s;
|
|
422
|
+
}), Xe = /* @__PURE__ */ Oe(Bt, [["__scopeId", "data-v-a9e0fa92"]]), Lt = ["data-id", "data-type"], Et = ["data-id", "data-type"], Dt = /* @__PURE__ */ me({
|
|
423
|
+
inheritAttrs: !1,
|
|
424
|
+
__name: "Block",
|
|
425
|
+
props: {
|
|
426
|
+
id: {},
|
|
427
|
+
type: {},
|
|
428
|
+
content: {},
|
|
429
|
+
readonly: { type: Boolean },
|
|
430
|
+
asChild: { type: Boolean }
|
|
431
|
+
},
|
|
432
|
+
setup(i) {
|
|
433
|
+
const c = i, a = lt();
|
|
434
|
+
return (u, v) => {
|
|
435
|
+
const w = rt("Block", !0);
|
|
436
|
+
return c.type !== "block" ? (S(), R("span", ve({
|
|
437
|
+
key: 0,
|
|
438
|
+
"data-id": c.id,
|
|
439
|
+
"data-type": c.type
|
|
440
|
+
}, C(a)), ae(c.content), 17, Lt)) : (S(), R(ie, { key: 1 }, [
|
|
441
|
+
c.asChild ? (S(!0), R(ie, { key: 0 }, ye(c.content, (o) => (S(), Q(w, ve({
|
|
442
|
+
key: `${o.id}-${o.type}`
|
|
443
|
+
}, { ref_for: !0 }, o), null, 16))), 128)) : (S(), R("span", ve({
|
|
444
|
+
key: 1,
|
|
445
|
+
"data-id": c.id,
|
|
446
|
+
"data-type": c.type
|
|
447
|
+
}, C(a)), [
|
|
448
|
+
(S(!0), R(ie, null, ye(c.content, (o) => (S(), Q(w, ve({
|
|
449
|
+
key: `${o.id}-${o.type}`
|
|
450
|
+
}, { ref_for: !0 }, o), null, 16))), 128))
|
|
451
|
+
], 16, Et))
|
|
452
|
+
], 64));
|
|
587
453
|
};
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
g.
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
454
|
+
}
|
|
455
|
+
}), Ft = /* @__PURE__ */ Oe(Dt, [["__scopeId", "data-v-13862606"]]);
|
|
456
|
+
function Ht(i, c = {}) {
|
|
457
|
+
let a = [], u = [], v = i;
|
|
458
|
+
return { commit: (k) => {
|
|
459
|
+
var g;
|
|
460
|
+
a.push(v), v = k, u.length && ((g = c.onRemoveHistory) == null || g.call(c, u)), u = [];
|
|
461
|
+
}, undo: () => a.length ? (u.push(v), v = a.pop(), v) : null, redo: () => u.length ? (a.push(v), v = u.pop(), v) : null, clear: () => {
|
|
462
|
+
var k, g;
|
|
463
|
+
a.length && ((k = c.onRemoveHistory) == null || k.call(c, a)), u.length && ((g = c.onRemoveHistory) == null || g.call(c, u)), a = [], u = [];
|
|
464
|
+
}, get: () => v };
|
|
465
|
+
}
|
|
466
|
+
const Pt = { class: "editor-container" }, De = "", Fe = "", Wt = /* @__PURE__ */ me({
|
|
467
|
+
__name: "TemplateEditor",
|
|
468
|
+
props: {
|
|
469
|
+
modelValue: { default: () => [] },
|
|
470
|
+
modelModifiers: {}
|
|
471
|
+
},
|
|
472
|
+
emits: /* @__PURE__ */ it(["submit"], ["update:modelValue"]),
|
|
473
|
+
setup(i, { expose: c, emit: a }) {
|
|
474
|
+
const u = typeof window.ShadowRoot.prototype.getSelection == "function", v = typeof window.Selection.prototype.getComposedRanges == "function";
|
|
475
|
+
function w() {
|
|
476
|
+
const e = navigator.userAgent;
|
|
477
|
+
return e.includes("Safari") && !e.includes("Chrome") && !e.includes("Chromium") && !e.includes("CriOS");
|
|
478
|
+
}
|
|
479
|
+
const o = w(), p = () => Math.random().toString(36).substring(2, 15), _ = ut(i, "modelValue"), h = a, k = H(0), g = (e) => e.map((t, s) => ({
|
|
480
|
+
id: `id-${s}`,
|
|
481
|
+
...t.type === "template" ? { ...t, prefix: De, suffix: Fe } : t
|
|
482
|
+
})), I = (e) => e.map((t) => ({ type: t.type, content: t.content })), m = H(g(_.value || [])), P = (e) => {
|
|
483
|
+
const t = { type: "text", content: "", id: p() };
|
|
484
|
+
if (e.length > 0)
|
|
485
|
+
if (o && e[e.length - 1].type === "template")
|
|
486
|
+
m.value = e.concat([t]);
|
|
487
|
+
else if (!o && e[0].type === "template")
|
|
488
|
+
m.value = [t].concat(e);
|
|
489
|
+
else {
|
|
490
|
+
m.value = e;
|
|
491
|
+
const s = e[0], r = e[e.length - 1];
|
|
492
|
+
o ? r.content !== "" && (r.content = r.content.replace(/\u200B/g, "")) : s.content !== "" && (s.content = s.content.replace(/\u200B/g, ""));
|
|
493
|
+
}
|
|
494
|
+
else
|
|
495
|
+
m.value = e;
|
|
496
|
+
}, B = L(() => m.value.map((e) => e.type === "template" ? [
|
|
497
|
+
{ id: e.id, type: "prefix", content: e.prefix },
|
|
498
|
+
{ id: e.id, type: "template", content: e.content },
|
|
499
|
+
{ id: e.id, type: "suffix", content: e.suffix }
|
|
500
|
+
] : [e]).flat()), A = L(() => m.value.map((e) => e.type === "text" ? e : o ? {
|
|
501
|
+
id: e.id,
|
|
502
|
+
type: "block",
|
|
503
|
+
asChild: !0,
|
|
504
|
+
content: [
|
|
505
|
+
{ id: e.id, type: "prefix", content: e.prefix },
|
|
506
|
+
{
|
|
507
|
+
id: e.id,
|
|
508
|
+
type: "block",
|
|
509
|
+
content: [
|
|
510
|
+
{ id: e.id, type: "template", content: e.content },
|
|
511
|
+
{ id: e.id, type: "suffix", content: e.suffix }
|
|
512
|
+
]
|
|
513
|
+
}
|
|
514
|
+
]
|
|
515
|
+
} : {
|
|
516
|
+
id: e.id,
|
|
517
|
+
type: "block",
|
|
518
|
+
asChild: !0,
|
|
519
|
+
content: [
|
|
520
|
+
{
|
|
521
|
+
id: e.id,
|
|
522
|
+
type: "block",
|
|
523
|
+
content: [
|
|
524
|
+
{ id: e.id, type: "prefix", content: e.prefix },
|
|
525
|
+
{ id: e.id, type: "template", content: e.content }
|
|
526
|
+
]
|
|
527
|
+
},
|
|
528
|
+
{ id: e.id, type: "suffix", content: e.suffix }
|
|
529
|
+
]
|
|
530
|
+
})), f = H(null), E = (e) => {
|
|
531
|
+
const t = Date.now(), s = JSON.stringify(e);
|
|
532
|
+
return `${t}:${s}`;
|
|
533
|
+
}, y = (e) => {
|
|
534
|
+
const t = parseInt(e.slice(0, 13)), s = JSON.parse(e.slice(14));
|
|
535
|
+
return {
|
|
536
|
+
timestamp: t,
|
|
537
|
+
data: s
|
|
538
|
+
};
|
|
539
|
+
}, W = /* @__PURE__ */ new Map(), K = Ht(E(m.value), {
|
|
540
|
+
onRemoveHistory: (e) => {
|
|
541
|
+
for (const t of e)
|
|
542
|
+
W.delete(t);
|
|
632
543
|
}
|
|
633
|
-
s.removeAllRanges(), s.addRange(g), e.focus && e.focus();
|
|
634
544
|
});
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
545
|
+
ee(
|
|
546
|
+
() => _.value,
|
|
547
|
+
(e) => {
|
|
548
|
+
P(g(e || [])), K.commit(E(m.value));
|
|
549
|
+
},
|
|
550
|
+
{ deep: !0 }
|
|
551
|
+
);
|
|
552
|
+
const q = (e, t = document.body) => t.contains(e) ? e instanceof HTMLElement && e.dataset.id ? e : e.parentElement ? q(e.parentElement, t) : null : null, Z = (e) => e === f.value, ue = (e) => {
|
|
553
|
+
const t = window.getSelection();
|
|
554
|
+
if (!t)
|
|
555
|
+
return null;
|
|
556
|
+
const s = t.rangeCount > 0 ? t.getRangeAt(0) : null, r = e.getRootNode();
|
|
557
|
+
if (!(r instanceof ShadowRoot))
|
|
558
|
+
return s;
|
|
559
|
+
if (v) {
|
|
560
|
+
const l = t.getComposedRanges(o ? r : { shadowRoots: [r] });
|
|
561
|
+
return (l == null ? void 0 : l[0]) ?? null;
|
|
641
562
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
if (!n) return null;
|
|
646
|
-
n.innerHTML = "";
|
|
647
|
-
let s = null;
|
|
648
|
-
if (!l || l === o.template)
|
|
649
|
-
e.forEach((g) => {
|
|
650
|
-
if (g.type === "field") {
|
|
651
|
-
const T = r(g.content), I = c(g.content, T);
|
|
652
|
-
n.appendChild(I);
|
|
653
|
-
const M = ye();
|
|
654
|
-
n.appendChild(M), s || (s = I);
|
|
655
|
-
} else
|
|
656
|
-
n.appendChild(document.createTextNode(g.content));
|
|
657
|
-
}), o.initialValues && Object.keys(o.initialValues).length > 0 && W(() => {
|
|
658
|
-
const g = i();
|
|
659
|
-
g !== o.value && (o.onValueChange(g), o.onInput(g));
|
|
660
|
-
});
|
|
661
|
-
else {
|
|
662
|
-
const g = v(e, l);
|
|
663
|
-
g.success ? g.elements.forEach((T) => {
|
|
664
|
-
if (n.appendChild(T.node), T.isField) {
|
|
665
|
-
const I = ye();
|
|
666
|
-
n.appendChild(I);
|
|
667
|
-
}
|
|
668
|
-
T.isField && !s && (s = T.node);
|
|
669
|
-
}) : (n.appendChild(document.createTextNode(l)), s = null);
|
|
670
|
-
}
|
|
671
|
-
return s;
|
|
672
|
-
}, v = (e, l) => {
|
|
673
|
-
const n = [];
|
|
674
|
-
let s = 0, g = 0, T = !0;
|
|
675
|
-
for (; g < e.length && s <= l.length && T; ) {
|
|
676
|
-
const I = e[g];
|
|
677
|
-
if (I.type === "text")
|
|
678
|
-
l.substring(s).startsWith(I.content) ? (n.push({
|
|
679
|
-
node: document.createTextNode(I.content),
|
|
680
|
-
isField: !1
|
|
681
|
-
}), s += I.content.length, g++) : T = !1;
|
|
682
|
-
else {
|
|
683
|
-
let M = "";
|
|
684
|
-
const j = e.find((B, X) => X > g && B.type === "text");
|
|
685
|
-
if (j) {
|
|
686
|
-
const B = l.substring(s), X = B.indexOf(j.content);
|
|
687
|
-
X !== -1 ? (M = B.substring(0, X), s += M.length) : T = !1;
|
|
688
|
-
} else
|
|
689
|
-
M = l.substring(s), s = l.length;
|
|
690
|
-
if (T) {
|
|
691
|
-
const B = c(I.content, M);
|
|
692
|
-
n.push({ node: B, isField: !0 }), g++;
|
|
693
|
-
}
|
|
563
|
+
if (u) {
|
|
564
|
+
const l = r.getSelection();
|
|
565
|
+
return l.rangeCount > 0 ? l.getRangeAt(0) : null;
|
|
694
566
|
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
567
|
+
return s;
|
|
568
|
+
}, ce = (e, t) => {
|
|
569
|
+
var r;
|
|
570
|
+
if (!e.firstChild || e.firstChild.nodeType !== Node.TEXT_NODE)
|
|
571
|
+
return console.warn("el.firstChild is not a text node. set anchor and focus to the element with offset 0", e), { node: e, offset: 0 };
|
|
572
|
+
const s = ((r = e.firstChild.textContent) == null ? void 0 : r.length) ?? 0;
|
|
573
|
+
return t > s && console.warn("offset is too large", { offset: t, el: e }), { node: e.firstChild, offset: Math.min(t, s) };
|
|
574
|
+
}, G = (e, t, s, r) => {
|
|
575
|
+
const l = window.getSelection();
|
|
576
|
+
if (!l)
|
|
577
|
+
return;
|
|
578
|
+
const { node: d, offset: b } = ce(e, t);
|
|
579
|
+
if (!s) {
|
|
580
|
+
l.setBaseAndExtent(d, b, d, b);
|
|
581
|
+
return;
|
|
707
582
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
583
|
+
const { node: D, offset: T } = ce(s, r ?? 0);
|
|
584
|
+
l.setBaseAndExtent(d, b, D, T);
|
|
585
|
+
}, O = (e, t) => {
|
|
586
|
+
const s = p(), r = { id: s, type: "text", content: e };
|
|
587
|
+
if (t) {
|
|
588
|
+
const l = m.value.findIndex((d) => d.id === t);
|
|
589
|
+
l !== -1 ? P(
|
|
590
|
+
m.value.slice(0, l + 1).concat(r).concat(m.value.slice(l + 1))
|
|
591
|
+
) : console.warn(`can not find item with id: ${t}`);
|
|
717
592
|
} else
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
t.value.childNodes.forEach((l) => {
|
|
735
|
-
if (l.nodeType === Node.TEXT_NODE) {
|
|
736
|
-
const n = l.textContent || "";
|
|
737
|
-
if (ee(n)) {
|
|
738
|
-
const s = l.previousSibling;
|
|
739
|
-
if (s && s.nodeType === Node.ELEMENT_NODE && s.classList.contains("template-field"))
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
(n.trim() === "" || ee(n)) && e.push(l);
|
|
743
|
-
} else l.nodeType === Node.ELEMENT_NODE && l.tagName.toLowerCase() === "br" && e.push(l);
|
|
744
|
-
}), e.forEach((l) => {
|
|
745
|
-
l.parentNode && l.parentNode.removeChild(l);
|
|
746
|
-
});
|
|
747
|
-
}, V = (e) => {
|
|
748
|
-
if (!o.template || !o.initialValues)
|
|
749
|
-
return "字段";
|
|
750
|
-
for (const [l, n] of Object.entries(o.initialValues))
|
|
751
|
-
if (n === e)
|
|
752
|
-
return l;
|
|
753
|
-
return e.length <= 2 || /^[[\]{}()]+$/.test(e) || e.includes("[") && e.includes("]") ? e : "字段";
|
|
754
|
-
}, K = (e) => {
|
|
755
|
-
const l = e.getAttribute("data-placeholder");
|
|
756
|
-
if (l)
|
|
757
|
-
return l;
|
|
758
|
-
const n = e.getAttribute("title") || e.getAttribute("data-field") || e.getAttribute("data-key") || e.getAttribute("placeholder") || "";
|
|
759
|
-
if (n)
|
|
760
|
-
return n;
|
|
761
|
-
const s = e.textContent || "";
|
|
762
|
-
return V(s);
|
|
763
|
-
}, C = () => {
|
|
764
|
-
if (!t.value) return;
|
|
765
|
-
t.value.querySelectorAll("span").forEach((l) => {
|
|
766
|
-
const n = l, s = n.style, g = n.classList.contains("template-field"), T = n.hasAttribute("data-placeholder");
|
|
767
|
-
if (g && T)
|
|
593
|
+
P([r].concat(m.value));
|
|
594
|
+
J(() => {
|
|
595
|
+
var d;
|
|
596
|
+
const l = (d = f.value) == null ? void 0 : d.querySelector(`[data-id="${s}"][data-type="text"]`);
|
|
597
|
+
l && G(l, e.length);
|
|
598
|
+
}), _.value = I(m.value);
|
|
599
|
+
}, V = H({
|
|
600
|
+
hasStarted: !1,
|
|
601
|
+
range: null
|
|
602
|
+
}), le = (e) => {
|
|
603
|
+
var D;
|
|
604
|
+
const t = e;
|
|
605
|
+
e.preventDefault();
|
|
606
|
+
const { inputType: s } = t, r = (t.data || ((D = t.dataTransfer) == null ? void 0 : D.getData("text/plain")) || "").replace(De, "").replace(Fe, ""), l = t.getTargetRanges()[0];
|
|
607
|
+
if (!l) {
|
|
608
|
+
console.warn("range is null", l);
|
|
768
609
|
return;
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
610
|
+
}
|
|
611
|
+
const d = [
|
|
612
|
+
"insertText",
|
|
613
|
+
"insertFromPaste",
|
|
614
|
+
"insertReplacementText",
|
|
615
|
+
"deleteContentBackward",
|
|
616
|
+
"deleteContentForward",
|
|
617
|
+
"deleteWordBackward",
|
|
618
|
+
"deleteWordForward",
|
|
619
|
+
"deleteSoftLineBackward",
|
|
620
|
+
"deleteSoftLineForward",
|
|
621
|
+
"deleteByCut"
|
|
622
|
+
], b = ue(f.value);
|
|
623
|
+
if (d.includes(s)) {
|
|
624
|
+
if (r && Z(l.startContainer) && Z(l.endContainer)) {
|
|
625
|
+
O(r), b && W.set(K.get(), j(b));
|
|
626
|
+
return;
|
|
777
627
|
}
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
628
|
+
const T = j(l);
|
|
629
|
+
T.startId && T.endId ? (Se(T, s, r), b && W.set(K.get(), j(b))) : console.warn("range is not valid, range:", T);
|
|
630
|
+
} else s === "insertCompositionText" && V.value.hasStarted && (V.value = { hasStarted: !1, range: j(l) });
|
|
631
|
+
}, j = (e) => {
|
|
632
|
+
const t = q(e.startContainer, f.value), s = q(e.endContainer, f.value);
|
|
633
|
+
return {
|
|
634
|
+
collapsed: e.collapsed,
|
|
635
|
+
endContainer: e.endContainer,
|
|
636
|
+
endId: s == null ? void 0 : s.dataset.id,
|
|
637
|
+
endOffset: e.endOffset,
|
|
638
|
+
endType: s == null ? void 0 : s.dataset.type,
|
|
639
|
+
startContainer: e.startContainer,
|
|
640
|
+
startId: t == null ? void 0 : t.dataset.id,
|
|
641
|
+
startOffset: e.startOffset,
|
|
642
|
+
startType: t == null ? void 0 : t.dataset.type
|
|
643
|
+
};
|
|
644
|
+
}, N = (e, t, s, r) => e.slice(0, s) + t + e.slice(r), ne = (e, t, s) => {
|
|
645
|
+
if (s !== "deleteContentForward" || e.length !== 1)
|
|
646
|
+
return e;
|
|
647
|
+
const r = e[0], l = m.value.find((D) => D.id === r.id);
|
|
648
|
+
if (!l || l.type !== "text" || l.content !== "" || t.collapsed)
|
|
649
|
+
return e;
|
|
650
|
+
const d = B.value.findIndex((D) => D.id === r.id);
|
|
651
|
+
if (d < 0 || d >= B.value.length - 1)
|
|
652
|
+
return [{ ...r, startOffset: 0, endOffset: 0 }];
|
|
653
|
+
const b = B.value[d + 1];
|
|
654
|
+
return [
|
|
655
|
+
{
|
|
656
|
+
id: b.id,
|
|
657
|
+
type: b.type,
|
|
658
|
+
startOffset: 0,
|
|
659
|
+
endOffset: 0
|
|
660
|
+
}
|
|
661
|
+
];
|
|
662
|
+
}, Se = (e, t, s) => {
|
|
663
|
+
const r = we(e);
|
|
664
|
+
if (!Array.isArray(r) || r.length === 0)
|
|
665
|
+
return;
|
|
666
|
+
const l = ne(r, e, t), d = be(l, e, t, s);
|
|
667
|
+
if (d.some((T) => T.tag === "new")) {
|
|
668
|
+
const { afterId: T, content: $ } = d[0];
|
|
669
|
+
O($, T);
|
|
670
|
+
return;
|
|
781
671
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
const e = t.value;
|
|
816
|
-
e.innerHTML = "";
|
|
817
|
-
const l = u(o.template);
|
|
818
|
-
let n = "";
|
|
819
|
-
l.forEach((s) => {
|
|
820
|
-
if (s.type === "field") {
|
|
821
|
-
const g = r(s.content), T = c(s.content, g);
|
|
822
|
-
g && (n += g), e.appendChild(T);
|
|
823
|
-
} else
|
|
824
|
-
e.appendChild(document.createTextNode(s.content)), n += s.content;
|
|
825
|
-
}), o.onValueChange(n), L(), a(n), W(() => {
|
|
826
|
-
o.isInternalUpdate = !1;
|
|
672
|
+
const b = d, D = [];
|
|
673
|
+
for (const [T, $] of b.entries()) {
|
|
674
|
+
const z = m.value.find((Be) => Be.id === $.id), ge = T === 0 ? s : "";
|
|
675
|
+
z ? z.type === "text" ? z.content = N(z.content, ge, $.startOffset, $.endOffset) : z.type === "template" ? $.type === "prefix" || $.type === "suffix" ? $.startOffset === 0 && $.endOffset === 1 && ge.length === 0 ? z[$.type] = "" : console.warn(`${$.type} can not be inserted text. it only can be deleted`, $) : $.startOffset < 0 || $.endOffset > z.content.length ? D.push(z.id) : z.content = N(z.content, ge, $.startOffset, $.endOffset) : console.warn("dataItem.type is not text or template", z) : console.warn("can not find dataItem", $);
|
|
676
|
+
}
|
|
677
|
+
P(m.value.filter((T) => !D.includes(T.id))), P(
|
|
678
|
+
m.value.filter((T) => {
|
|
679
|
+
if (T.type === "text")
|
|
680
|
+
return T.content.length > 0;
|
|
681
|
+
const $ = T;
|
|
682
|
+
return [$.prefix, $.suffix, $.content].join("").length > 0;
|
|
683
|
+
})
|
|
684
|
+
);
|
|
685
|
+
for (const T of m.value.filter(($) => $.type === "template"))
|
|
686
|
+
T.prefix.length === 0 && (T.prefix = De), T.suffix.length === 0 && (T.suffix = Fe);
|
|
687
|
+
b.length > 0 && Te(b, s), _.value = I(m.value);
|
|
688
|
+
}, Te = (e, t) => {
|
|
689
|
+
const s = e[0], r = `[data-id="${s.id}"][data-type="${s.type}"]`, l = e.slice(1).map((d) => `[data-id="${d.id}"][data-type="${d.type}"]`);
|
|
690
|
+
J(() => {
|
|
691
|
+
var b, D;
|
|
692
|
+
const d = (b = f.value) == null ? void 0 : b.querySelector(r);
|
|
693
|
+
if (d)
|
|
694
|
+
G(d, s.startOffset + t.length);
|
|
695
|
+
else if (t.length === 0)
|
|
696
|
+
for (const T of l) {
|
|
697
|
+
const $ = (D = f.value) == null ? void 0 : D.querySelector(T);
|
|
698
|
+
if ($) {
|
|
699
|
+
G($, 0);
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
else
|
|
704
|
+
console.warn(`can not find el with selector: ${r}`);
|
|
827
705
|
});
|
|
828
|
-
},
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
setup(t, { expose: y, emit: m }) {
|
|
849
|
-
const o = rt(t, "value"), x = t, u = m, i = O(null), r = O(""), c = O({}), f = O(!1), p = O(!1), a = It(i, {
|
|
850
|
-
template: r.value,
|
|
851
|
-
value: o.value,
|
|
852
|
-
initialValues: c.value,
|
|
853
|
-
isInternalUpdate: f,
|
|
854
|
-
isComposing: p,
|
|
855
|
-
onValueChange: (C) => {
|
|
856
|
-
if (o.value !== C) {
|
|
857
|
-
const S = f.value;
|
|
858
|
-
f.value = !0, o.value = C, W(() => {
|
|
859
|
-
f.value = S;
|
|
860
|
-
});
|
|
706
|
+
}, we = (e) => {
|
|
707
|
+
const t = B.value.findIndex((b) => b.id === e.startId && b.type === e.startType), s = B.value.findIndex((b) => b.id === e.endId && b.type === e.endType);
|
|
708
|
+
if (t === -1 || s === -1 || t > s)
|
|
709
|
+
return console.warn("startIndex or endIndex is -1, or startIndex > endIndex. ", { range: e }), null;
|
|
710
|
+
const r = B.value[t], l = B.value[s];
|
|
711
|
+
if (t === s)
|
|
712
|
+
return [
|
|
713
|
+
{
|
|
714
|
+
id: r.id,
|
|
715
|
+
type: r.type,
|
|
716
|
+
startOffset: e.startOffset,
|
|
717
|
+
endOffset: e.endOffset
|
|
718
|
+
}
|
|
719
|
+
];
|
|
720
|
+
const d = [
|
|
721
|
+
{
|
|
722
|
+
id: r.id,
|
|
723
|
+
type: r.type,
|
|
724
|
+
startOffset: e.startOffset,
|
|
725
|
+
endOffset: r.content.length
|
|
861
726
|
}
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
getValueFromDOM: a.getValueFromDOM,
|
|
872
|
-
handleInput: a.handleInput,
|
|
873
|
-
onSubmit: (C) => u("submit", C)
|
|
874
|
-
}), L = (C, S) => {
|
|
875
|
-
let N = C;
|
|
876
|
-
return Object.entries(S).forEach(([q, e]) => {
|
|
877
|
-
const l = `[${q}]`;
|
|
878
|
-
N = N.replace(new RegExp(l.replace(/[[\]]/g, "\\$&"), "g"), e);
|
|
879
|
-
}), N;
|
|
880
|
-
}, _ = (C) => {
|
|
881
|
-
f.value = !0, r.value = C.template, c.value = C.initialValues || {};
|
|
882
|
-
const S = L(r.value, c.value);
|
|
883
|
-
a.updateOptions({
|
|
884
|
-
template: r.value,
|
|
885
|
-
value: S,
|
|
886
|
-
// 使用新生成的内容而不是旧的inputValue
|
|
887
|
-
initialValues: c.value
|
|
888
|
-
}), a.updateEditorDOM(), o.value = S, W(() => {
|
|
889
|
-
f.value = !1;
|
|
890
|
-
});
|
|
891
|
-
}, v = () => {
|
|
892
|
-
p.value = !0;
|
|
893
|
-
}, R = () => {
|
|
894
|
-
p.value = !1, a.handleInput();
|
|
895
|
-
}, w = (C) => {
|
|
896
|
-
var q;
|
|
897
|
-
if (!i.value) return;
|
|
898
|
-
const S = C.target;
|
|
899
|
-
let N = null;
|
|
900
|
-
if (S.classList.contains("template-field") ? N = S : (q = S.parentElement) != null && q.classList.contains("template-field") && (N = S.parentElement), N && (!N.textContent || N.textContent.trim() === "")) {
|
|
901
|
-
const e = z(i.value), l = document.createRange();
|
|
902
|
-
e && (l.selectNodeContents(N), l.collapse(!0), e.removeAllRanges(), e.addRange(l), N.focus(), C.preventDefault(), C.stopPropagation());
|
|
727
|
+
];
|
|
728
|
+
for (let b = t + 1; b < s; b++) {
|
|
729
|
+
const D = B.value[b];
|
|
730
|
+
d.push({
|
|
731
|
+
id: D.id,
|
|
732
|
+
type: D.type,
|
|
733
|
+
startOffset: 0,
|
|
734
|
+
endOffset: D.content.length
|
|
735
|
+
});
|
|
903
736
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
e
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
737
|
+
return d.push({
|
|
738
|
+
id: l.id,
|
|
739
|
+
type: l.type,
|
|
740
|
+
startOffset: 0,
|
|
741
|
+
endOffset: e.endOffset
|
|
742
|
+
}), d;
|
|
743
|
+
}, be = (e, t, s, r) => {
|
|
744
|
+
const l = e[0];
|
|
745
|
+
if (l.type !== "prefix" && l.type !== "suffix")
|
|
746
|
+
return e;
|
|
747
|
+
if (e.length === 1) {
|
|
748
|
+
if (t.collapsed)
|
|
749
|
+
if (t.startOffset === 0) {
|
|
750
|
+
const d = de(l, r);
|
|
751
|
+
return d ? [d] : [];
|
|
752
|
+
} else {
|
|
753
|
+
const d = se(l, r);
|
|
754
|
+
return d ? [d] : [];
|
|
755
|
+
}
|
|
756
|
+
if (s.startsWith("insert"))
|
|
757
|
+
if (o) {
|
|
758
|
+
const d = de(l, r);
|
|
759
|
+
return d ? [d] : [];
|
|
760
|
+
} else {
|
|
761
|
+
const d = se(l, r);
|
|
762
|
+
return d ? [d] : [];
|
|
763
|
+
}
|
|
764
|
+
if (s.startsWith("delete")) {
|
|
765
|
+
if (s.includes("Backward")) {
|
|
766
|
+
const d = de(l, r, 1);
|
|
767
|
+
return d ? [d] : [];
|
|
768
|
+
} else if (s.includes("Forward")) {
|
|
769
|
+
const d = se(l, r, 1);
|
|
770
|
+
return d ? [d] : [];
|
|
927
771
|
}
|
|
928
|
-
}), n) {
|
|
929
|
-
$(e);
|
|
930
|
-
return;
|
|
931
772
|
}
|
|
932
773
|
}
|
|
933
|
-
|
|
934
|
-
},
|
|
935
|
-
const
|
|
936
|
-
if (
|
|
937
|
-
const
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
774
|
+
return r.length > 0 ? e.slice(1) : e;
|
|
775
|
+
}, de = (e, t, s = 0) => {
|
|
776
|
+
const r = B.value.findIndex((l) => l.id === e.id && l.type === e.type);
|
|
777
|
+
if (r > 0) {
|
|
778
|
+
const l = B.value[r - 1], { id: d, type: b, content: D } = l;
|
|
779
|
+
if (b === "text" || b === "template")
|
|
780
|
+
return {
|
|
781
|
+
id: d,
|
|
782
|
+
type: b,
|
|
783
|
+
startOffset: D.length - s,
|
|
784
|
+
endOffset: D.length
|
|
785
|
+
};
|
|
786
|
+
if (t.length > 0)
|
|
787
|
+
return { tag: "new", afterId: d, type: "text", content: t };
|
|
788
|
+
if (console.warn("the previous item is not text or template", { current: e, previous: l }), s === 1)
|
|
789
|
+
return { ...e, endOffset: e.startOffset };
|
|
790
|
+
} else return t.length > 0 ? { tag: "new", type: "text", content: t } : (console.warn("the previous item of current is not found", { current: e }), null);
|
|
791
|
+
return e;
|
|
792
|
+
}, se = (e, t, s = 0) => {
|
|
793
|
+
const r = B.value.findIndex((l) => l.id === e.id && l.type === e.type);
|
|
794
|
+
if (r < B.value.length - 1) {
|
|
795
|
+
const l = B.value[r + 1], { id: d, type: b } = l;
|
|
796
|
+
if (b === "text" || b === "template")
|
|
797
|
+
return {
|
|
798
|
+
id: d,
|
|
799
|
+
type: b,
|
|
800
|
+
startOffset: 0,
|
|
801
|
+
endOffset: 0 + s
|
|
802
|
+
};
|
|
803
|
+
if (t.length > 0)
|
|
804
|
+
return { tag: "new", afterId: e.id, type: "text", content: t };
|
|
805
|
+
if (console.warn("the next item is not text or template", { current: e, next: l }), s === 1)
|
|
806
|
+
return { ...e, startOffset: e.endOffset };
|
|
807
|
+
} else return t.length > 0 ? { tag: "new", afterId: e.id, type: "text", content: t } : (console.warn("the next item of current is not found", { current: e }), null);
|
|
808
|
+
return e;
|
|
809
|
+
}, fe = () => {
|
|
810
|
+
V.value = { hasStarted: !0, range: null };
|
|
811
|
+
}, $e = (e) => {
|
|
812
|
+
const t = V.value.range;
|
|
813
|
+
t ? (e.data && Z(t.startContainer) && Z(t.endContainer) ? (O(e.data), W.set(K.get(), j(t))) : t.startId && t.endId ? (Se(t, "insertCompositionText", e.data), W.set(K.get(), j(t))) : console.warn("range is not valid, range:", t), k.value++) : console.warn("range is null, compositionEnd:", e), V.value = { hasStarted: !1, range: null };
|
|
814
|
+
}, Y = (() => {
|
|
815
|
+
const e = navigator.userAgent.toLowerCase();
|
|
816
|
+
return /macintosh|mac os x|iphone|ipad|ipod/.test(e);
|
|
817
|
+
})(), _e = (e) => {
|
|
818
|
+
const t = Y && e.metaKey && !e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Z
|
|
819
|
+
!Y && e.ctrlKey && !e.shiftKey && e.key.toLowerCase() === "z", s = Y && e.metaKey && e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Shift+z
|
|
820
|
+
!Y && e.ctrlKey && (e.key.toLowerCase() === "y" || e.shiftKey && e.key.toLowerCase() === "z"), r = e.key.toLowerCase() === "enter";
|
|
821
|
+
if (t) {
|
|
822
|
+
e.preventDefault();
|
|
823
|
+
const l = ue(f.value);
|
|
824
|
+
l && W.set(K.get(), j(l));
|
|
825
|
+
const d = K.undo();
|
|
826
|
+
d && pe(d);
|
|
943
827
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
N.deleteContents(), N.insertNode(document.createTextNode(C)), N.collapse(!1), S.removeAllRanges(), S.addRange(N), K();
|
|
828
|
+
if (s) {
|
|
829
|
+
e.preventDefault();
|
|
830
|
+
const l = K.redo();
|
|
831
|
+
l && pe(l);
|
|
949
832
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
}
|
|
960
|
-
setTimeout(() => {
|
|
961
|
-
const S = a.getValueFromDOM();
|
|
962
|
-
S !== o.value && (f.value = !0, o.value = S, u("input", S), W(() => {
|
|
963
|
-
f.value = !1;
|
|
964
|
-
}));
|
|
965
|
-
}, 50);
|
|
966
|
-
});
|
|
967
|
-
};
|
|
968
|
-
return ut(() => {
|
|
969
|
-
r.value && a.updateEditorDOM(), x.autofocus && i.value && a.setCursorToEnd();
|
|
970
|
-
}), te(
|
|
971
|
-
() => r.value,
|
|
972
|
-
() => {
|
|
973
|
-
f.value || (a.updateOptions({
|
|
974
|
-
template: r.value,
|
|
975
|
-
value: o.value,
|
|
976
|
-
initialValues: c.value
|
|
977
|
-
}), a.updateEditorDOM());
|
|
833
|
+
r && (e.preventDefault(), h("submit"));
|
|
834
|
+
}, pe = (e) => {
|
|
835
|
+
const { data: t } = y(e);
|
|
836
|
+
if (P(t), W.has(e)) {
|
|
837
|
+
const s = W.get(e);
|
|
838
|
+
J(() => {
|
|
839
|
+
const r = f.value.querySelector(`[data-id="${s.startId}"][data-type="${s.startType}"]`), l = f.value.querySelector(`[data-id="${s.endId}"][data-type="${s.endType}"]`);
|
|
840
|
+
r && G(r, s.startOffset, l, s.endOffset);
|
|
841
|
+
});
|
|
978
842
|
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
() => {
|
|
982
|
-
|
|
983
|
-
template: r.value,
|
|
984
|
-
value: o.value,
|
|
985
|
-
initialValues: c.value
|
|
986
|
-
}), a.updateEditorDOM());
|
|
843
|
+
};
|
|
844
|
+
return c({
|
|
845
|
+
clearHistory: () => {
|
|
846
|
+
K.clear(), W.clear();
|
|
987
847
|
},
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
value:
|
|
995
|
-
|
|
996
|
-
|
|
848
|
+
activateFirstField: () => {
|
|
849
|
+
if (!f.value)
|
|
850
|
+
return;
|
|
851
|
+
const e = m.value.find((t) => t.type === "template");
|
|
852
|
+
e && J(() => {
|
|
853
|
+
var s, r;
|
|
854
|
+
const t = (s = f.value) == null ? void 0 : s.querySelector(`[data-id="${e.id}"][data-type="template"]`);
|
|
855
|
+
if (t) {
|
|
856
|
+
const l = ((r = t.textContent) == null ? void 0 : r.length) || 0;
|
|
857
|
+
G(t, l);
|
|
858
|
+
}
|
|
859
|
+
});
|
|
997
860
|
}
|
|
998
|
-
),
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
},
|
|
861
|
+
}), (e, t) => (S(), R("div", Pt, [
|
|
862
|
+
(S(), R("div", {
|
|
863
|
+
contenteditable: "true",
|
|
864
|
+
ref_key: "editorRef",
|
|
865
|
+
ref: f,
|
|
866
|
+
key: k.value,
|
|
867
|
+
class: "editor",
|
|
868
|
+
onBeforeinput: le,
|
|
869
|
+
onCompositionstart: fe,
|
|
870
|
+
onCompositionend: $e,
|
|
871
|
+
onKeydown: _e
|
|
872
|
+
}, [
|
|
873
|
+
(S(!0), R(ie, null, ye(A.value, (s) => (S(), Q(Ft, ve({
|
|
874
|
+
key: `${s.id}-${s.type}`
|
|
875
|
+
}, { ref_for: !0 }, s), null, 16))), 128))
|
|
876
|
+
], 32))
|
|
877
|
+
]));
|
|
878
|
+
}
|
|
879
|
+
}), Kt = /* @__PURE__ */ Oe(Wt, [["__scopeId", "data-v-3ae7b00d"]]), At = ["onMouseenter", "onMousedown"], Nt = { class: "suggestion-list__text" }, Vt = /* @__PURE__ */ me({
|
|
880
|
+
__name: "SuggestionList",
|
|
881
|
+
props: {
|
|
882
|
+
show: { type: Boolean },
|
|
883
|
+
suggestions: {},
|
|
884
|
+
popupStyle: {},
|
|
885
|
+
isItemHighlighted: { type: Function },
|
|
886
|
+
highlightSuggestionText: { type: Function },
|
|
887
|
+
inputValue: {}
|
|
888
|
+
},
|
|
889
|
+
emits: ["item-hover", "item-leave", "select"],
|
|
890
|
+
setup(i, { emit: c }) {
|
|
891
|
+
const a = i, u = c, v = H(null), w = (_) => {
|
|
892
|
+
u("item-hover", _);
|
|
893
|
+
}, o = () => {
|
|
894
|
+
u("item-leave");
|
|
895
|
+
}, p = (_) => {
|
|
896
|
+
u("select", _);
|
|
897
|
+
};
|
|
898
|
+
return (_, h) => (S(), Q(He, { name: "tiny-sender-slide-up" }, {
|
|
899
|
+
default: re(() => [
|
|
900
|
+
a.show && a.suggestions.length ? (S(), R("div", {
|
|
901
|
+
key: 0,
|
|
902
|
+
ref_key: "suggestionsListRef",
|
|
903
|
+
ref: v,
|
|
904
|
+
class: "suggestion-list",
|
|
905
|
+
style: Pe(a.popupStyle)
|
|
906
|
+
}, [
|
|
907
|
+
(S(!0), R(ie, null, ye(a.suggestions, (k, g) => (S(), R("div", {
|
|
908
|
+
key: g,
|
|
909
|
+
class: te(["suggestion-list__item", { highlighted: a.isItemHighlighted(g) }]),
|
|
910
|
+
onMouseenter: (I) => w(g),
|
|
911
|
+
onMouseleave: o,
|
|
912
|
+
onMousedown: ct((I) => p(k), ["prevent"])
|
|
913
|
+
}, [
|
|
914
|
+
X(C(bt), { class: "suggestion-list__icon" }),
|
|
915
|
+
U("span", Nt, [
|
|
916
|
+
(S(!0), R(ie, null, ye(a.highlightSuggestionText(k, a.inputValue), (I, m) => (S(), R("span", {
|
|
917
|
+
key: m,
|
|
918
|
+
class: te({
|
|
919
|
+
"suggestion-list__text--match": I.isMatch,
|
|
920
|
+
"suggestion-list__text--normal": !I.isMatch
|
|
921
|
+
})
|
|
922
|
+
}, ae(I.text), 3))), 128))
|
|
923
|
+
])
|
|
924
|
+
], 42, At))), 128))
|
|
925
|
+
], 4)) : M("", !0)
|
|
926
|
+
]),
|
|
927
|
+
_: 1
|
|
928
|
+
}));
|
|
1023
929
|
}
|
|
1024
|
-
}), Mt = ["data-theme"],
|
|
930
|
+
}), Mt = /* @__PURE__ */ Oe(Vt, [["__scopeId", "data-v-238fcdfd"]]), Ut = ["data-theme"], qt = { class: "tiny-sender__container" }, zt = {
|
|
1025
931
|
key: 0,
|
|
1026
932
|
class: "tiny-sender__header-slot"
|
|
1027
|
-
},
|
|
933
|
+
}, jt = {
|
|
1028
934
|
key: 0,
|
|
1029
935
|
class: "tiny-sender__prefix-slot"
|
|
1030
|
-
},
|
|
936
|
+
}, Gt = { class: "tiny-sender__content-area" }, Xt = {
|
|
1031
937
|
key: 0,
|
|
1032
938
|
class: "tiny-sender__decorative-content"
|
|
1033
|
-
},
|
|
939
|
+
}, Jt = {
|
|
1034
940
|
key: 2,
|
|
1035
941
|
class: "tiny-sender__input-field-wrapper"
|
|
1036
|
-
},
|
|
942
|
+
}, Zt = {
|
|
1037
943
|
key: 0,
|
|
1038
944
|
class: "tiny-sender__completion-placeholder"
|
|
1039
|
-
},
|
|
945
|
+
}, Qt = { class: "user-input-mirror" }, Yt = {
|
|
1040
946
|
key: 0,
|
|
1041
947
|
class: "tiny-sender__tab-hint"
|
|
1042
|
-
},
|
|
948
|
+
}, en = {
|
|
1043
949
|
key: 1,
|
|
1044
950
|
class: "tiny-sender__actions-slot"
|
|
1045
|
-
},
|
|
951
|
+
}, tn = { class: "tiny-sender__footer-left" }, nn = { class: "tiny-sender__footer-right" }, sn = { class: "real-word-length" }, on = {
|
|
1046
952
|
key: 1,
|
|
1047
953
|
class: "tiny-sender__toolbar"
|
|
1048
|
-
},
|
|
954
|
+
}, an = { class: "tiny-sender__buttons-container" }, ln = {
|
|
1049
955
|
key: 1,
|
|
1050
956
|
class: "tiny-sender__footer-slot"
|
|
1051
|
-
},
|
|
1052
|
-
key: 0,
|
|
1053
|
-
class: "tiny-sender__error"
|
|
1054
|
-
}, pe = /* @__PURE__ */ be({
|
|
957
|
+
}, Re = /* @__PURE__ */ me({
|
|
1055
958
|
__name: "index",
|
|
1056
959
|
props: {
|
|
1057
960
|
autofocus: { type: Boolean, default: !1 },
|
|
@@ -1065,6 +968,7 @@ const At = /* @__PURE__ */ be({
|
|
|
1065
968
|
modelValue: { default: "" },
|
|
1066
969
|
mode: { default: "single" },
|
|
1067
970
|
maxLength: { default: 1 / 0 },
|
|
971
|
+
buttonGroup: {},
|
|
1068
972
|
submitType: { default: "enter" },
|
|
1069
973
|
speech: { type: [Boolean, Object] },
|
|
1070
974
|
placeholder: { default: "请输入内容..." },
|
|
@@ -1072,360 +976,361 @@ const At = /* @__PURE__ */ be({
|
|
|
1072
976
|
suggestions: { default: () => [] },
|
|
1073
977
|
suggestionPopupWidth: { default: 400 },
|
|
1074
978
|
theme: { default: "light" },
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
templateInitialValues: { default: () => ({}) }
|
|
979
|
+
templateData: { default: () => [] },
|
|
980
|
+
stopText: { default: "" }
|
|
1078
981
|
},
|
|
1079
|
-
emits: ["update:modelValue", "submit", "clear", "speech-start", "speech-end", "speech-interim", "speech-error", "suggestion-select", "focus", "blur", "escape-press", "cancel", "reset-template"],
|
|
1080
|
-
setup(
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
982
|
+
emits: ["update:modelValue", "update:templateData", "submit", "clear", "speech-start", "speech-end", "speech-interim", "speech-error", "suggestion-select", "focus", "blur", "escape-press", "cancel", "reset-template", "files-selected"],
|
|
983
|
+
setup(i, { expose: c, emit: a }) {
|
|
984
|
+
var Ne;
|
|
985
|
+
const u = i, v = a, w = H(null), o = H(null), p = H(null), _ = H(null), h = H(null), k = L(() => u.templateData && u.templateData.length > 0), { inputValue: g, isComposing: I, clearInput: m } = Ct(u, v), P = L(() => !!g.value.trim()), B = L(() => {
|
|
986
|
+
var n, x;
|
|
987
|
+
return !(u.disabled || u.loading || !P.value || he.value || (x = (n = u.buttonGroup) == null ? void 0 : n.submit) != null && x.disabled);
|
|
988
|
+
}), {
|
|
989
|
+
showSuggestionsPopup: A,
|
|
990
|
+
completionPlaceholder: f,
|
|
991
|
+
showTabHint: E,
|
|
992
|
+
suggestionsListRef: y,
|
|
993
|
+
filteredSuggestions: W,
|
|
994
|
+
activeSuggestion: K,
|
|
995
|
+
isItemHighlighted: q,
|
|
996
|
+
updateSuggestionsState: Z,
|
|
997
|
+
selectSuggestion: ue,
|
|
998
|
+
acceptCurrentSuggestion: ce,
|
|
999
|
+
closeSuggestionsPopup: G,
|
|
1000
|
+
navigateSuggestions: O,
|
|
1001
|
+
handleSuggestionItemHover: V,
|
|
1002
|
+
handleSuggestionItemLeave: le,
|
|
1003
|
+
highlightSuggestionText: j
|
|
1004
|
+
} = Rt(u, v, g, I, k), N = H(u.mode), ne = H(!1), Se = () => {
|
|
1005
|
+
N.value === "single" && (N.value = "multiple", J(() => {
|
|
1099
1006
|
setTimeout(() => {
|
|
1100
|
-
const
|
|
1101
|
-
if (
|
|
1102
|
-
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1007
|
+
const n = document.querySelector(".tiny-textarea__inner");
|
|
1008
|
+
if (n) {
|
|
1009
|
+
n.style.whiteSpace = "pre-wrap";
|
|
1010
|
+
const x = g.value.length;
|
|
1011
|
+
n.focus(), n.setSelectionRange(x, x);
|
|
1105
1012
|
}
|
|
1106
1013
|
}, 50);
|
|
1107
1014
|
}));
|
|
1108
|
-
},
|
|
1015
|
+
}, Te = (n, x) => {
|
|
1109
1016
|
const F = document.createElement("span");
|
|
1110
|
-
F.style.visibility = "hidden", F.style.position = "absolute", F.style.whiteSpace = "nowrap", F.style.font =
|
|
1111
|
-
const
|
|
1112
|
-
return document.body.removeChild(F),
|
|
1113
|
-
},
|
|
1114
|
-
var
|
|
1115
|
-
if (
|
|
1116
|
-
const
|
|
1117
|
-
if (!
|
|
1118
|
-
const
|
|
1119
|
-
if (!
|
|
1017
|
+
F.style.visibility = "hidden", F.style.position = "absolute", F.style.whiteSpace = "nowrap", F.style.font = x, F.textContent = n, document.body.appendChild(F);
|
|
1018
|
+
const ke = F.offsetWidth;
|
|
1019
|
+
return document.body.removeChild(F), ke;
|
|
1020
|
+
}, we = () => {
|
|
1021
|
+
var xe, Ue, qe;
|
|
1022
|
+
if (u.mode !== "single" || !w.value || ne.value || !o.value || !_.value) return;
|
|
1023
|
+
const n = o.value.querySelector(".tiny-sender__content-area");
|
|
1024
|
+
if (!n) return;
|
|
1025
|
+
const x = ((Ue = (xe = w.value) == null ? void 0 : xe.querySelector) == null ? void 0 : Ue.call(xe, ".tiny-input__inner")) || n.querySelector(".tiny-input__inner"), F = h.value || o.value.querySelector(".tiny-sender__buttons-container");
|
|
1026
|
+
if (!x) {
|
|
1120
1027
|
console.warn("Cannot find input element for overflow check");
|
|
1121
1028
|
return;
|
|
1122
1029
|
}
|
|
1123
|
-
const
|
|
1124
|
-
if (
|
|
1125
|
-
setTimeout(() =>
|
|
1030
|
+
const ke = x.getBoundingClientRect(), Le = F == null ? void 0 : F.getBoundingClientRect();
|
|
1031
|
+
if (ke.width === 0) {
|
|
1032
|
+
setTimeout(() => we(), 50);
|
|
1126
1033
|
return;
|
|
1127
1034
|
}
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
var
|
|
1132
|
-
const
|
|
1133
|
-
if (
|
|
1134
|
-
|
|
1135
|
-
const
|
|
1136
|
-
|
|
1035
|
+
const Ye = window.getComputedStyle(x).font, et = Te(g.value, Ye), Ve = (qe = o.value) == null ? void 0 : qe.classList.contains("tr-sender-compact"), tt = Ve ? 12 : 20, nt = ke.width, st = (Le == null ? void 0 : Le.width) || 0, Me = nt - st - tt, ot = Ve ? 50 : 80;
|
|
1036
|
+
et > Me && Me > ot && N.value === "single" && (ne.value = !0, N.value = "multiple", J(() => {
|
|
1037
|
+
w.value ? setTimeout(() => {
|
|
1038
|
+
var ze;
|
|
1039
|
+
const Ie = (ze = o.value) == null ? void 0 : ze.querySelector(".tiny-textarea__inner");
|
|
1040
|
+
if (Ie) {
|
|
1041
|
+
Ie.style.whiteSpace = "pre-wrap";
|
|
1042
|
+
const je = g.value.length;
|
|
1043
|
+
Ie.focus(), Ie.setSelectionRange(je, je);
|
|
1137
1044
|
}
|
|
1138
|
-
|
|
1139
|
-
}, 300) :
|
|
1045
|
+
ne.value = !1;
|
|
1046
|
+
}, 300) : ne.value = !1;
|
|
1140
1047
|
}));
|
|
1141
|
-
},
|
|
1142
|
-
if (
|
|
1143
|
-
|
|
1144
|
-
else if (
|
|
1145
|
-
|
|
1048
|
+
}, be = () => {
|
|
1049
|
+
if (k.value && p.value)
|
|
1050
|
+
Ke();
|
|
1051
|
+
else if (w.value)
|
|
1052
|
+
w.value.focus();
|
|
1053
|
+
else {
|
|
1054
|
+
const n = document.querySelector(".tiny-input__inner");
|
|
1055
|
+
n == null || n.focus();
|
|
1056
|
+
}
|
|
1057
|
+
}, de = () => {
|
|
1058
|
+
if (w.value)
|
|
1059
|
+
w.value.blur();
|
|
1146
1060
|
else {
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1061
|
+
const n = document.querySelector(".tiny-input__inner");
|
|
1062
|
+
n == null || n.blur();
|
|
1149
1063
|
}
|
|
1150
|
-
},
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1064
|
+
}, se = () => {
|
|
1065
|
+
var n;
|
|
1066
|
+
v("update:templateData", []), (n = p.value) == null || n.clearHistory(), J(() => {
|
|
1067
|
+
g.value === "" && (N.value = u.mode || "single"), setTimeout(() => {
|
|
1068
|
+
be();
|
|
1154
1069
|
}, 50);
|
|
1155
|
-
});
|
|
1156
|
-
},
|
|
1157
|
-
var
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
}),
|
|
1161
|
-
},
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1070
|
+
}), G();
|
|
1071
|
+
}, fe = () => {
|
|
1072
|
+
var n;
|
|
1073
|
+
m(), k.value ? se() : (n = o.value) == null || n.focus(), J(() => {
|
|
1074
|
+
g.value === "" && (N.value = u.mode || "single");
|
|
1075
|
+
}), G();
|
|
1076
|
+
}, $e = (n) => {
|
|
1077
|
+
if (n.length === 0 || n.length === 1 && n[0].type === "text" && n[0].content === "") {
|
|
1078
|
+
se();
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
v("update:templateData", n);
|
|
1082
|
+
};
|
|
1083
|
+
ee(
|
|
1084
|
+
() => u.templateData,
|
|
1085
|
+
() => {
|
|
1086
|
+
g.value = u.templateData.map((n) => n.content).join("");
|
|
1087
|
+
},
|
|
1088
|
+
{ deep: !0 }
|
|
1089
|
+
);
|
|
1090
|
+
const We = L(() => {
|
|
1091
|
+
const n = typeof u.speech == "object" ? u.speech : {};
|
|
1171
1092
|
return {
|
|
1172
|
-
...
|
|
1173
|
-
onStart: () =>
|
|
1174
|
-
onEnd: (
|
|
1175
|
-
onInterim: (
|
|
1176
|
-
onFinal: (
|
|
1177
|
-
if (
|
|
1178
|
-
|
|
1093
|
+
...n,
|
|
1094
|
+
onStart: () => v("speech-start"),
|
|
1095
|
+
onEnd: (x) => v("speech-end", x),
|
|
1096
|
+
onInterim: (x) => v("speech-interim", x),
|
|
1097
|
+
onFinal: (x) => {
|
|
1098
|
+
if (n.autoReplace)
|
|
1099
|
+
g.value = x;
|
|
1179
1100
|
else {
|
|
1180
|
-
const F =
|
|
1181
|
-
F &&
|
|
1101
|
+
const F = g.value;
|
|
1102
|
+
F && x && !F.endsWith(" ") && !x.startsWith(" ") && F.length > 0 ? g.value = F + " " + x : g.value = F + x;
|
|
1182
1103
|
}
|
|
1183
|
-
|
|
1104
|
+
v("speech-end", x);
|
|
1184
1105
|
},
|
|
1185
|
-
onError: (
|
|
1186
|
-
|
|
1106
|
+
onError: (x) => {
|
|
1107
|
+
v("speech-error", x);
|
|
1187
1108
|
}
|
|
1188
1109
|
};
|
|
1189
|
-
}), { speechState:
|
|
1190
|
-
|
|
1191
|
-
},
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1110
|
+
}), { speechState: Y, start: _e, stop: pe } = xt(We.value), Ce = () => {
|
|
1111
|
+
Y.isRecording ? pe() : _e();
|
|
1112
|
+
}, he = L(() => u.maxLength !== 1 / 0 && g.value.length > u.maxLength), { handleKeyPress: e, triggerSubmit: t } = kt(
|
|
1113
|
+
u,
|
|
1114
|
+
v,
|
|
1115
|
+
g,
|
|
1116
|
+
I,
|
|
1117
|
+
Y,
|
|
1118
|
+
A,
|
|
1119
|
+
K,
|
|
1120
|
+
ce,
|
|
1121
|
+
G,
|
|
1122
|
+
O,
|
|
1123
|
+
Ce,
|
|
1124
|
+
B,
|
|
1200
1125
|
N,
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
},
|
|
1209
|
-
x("blur", d), N();
|
|
1210
|
-
}, Ue = P(() => s.value === "multiple" ? "textarea" : "text"), Ze = P(
|
|
1126
|
+
Se,
|
|
1127
|
+
k,
|
|
1128
|
+
se
|
|
1129
|
+
), s = (n) => {
|
|
1130
|
+
v("focus", n), g.value && W.value.length > 0 && !k.value && (A.value = !0, E.value = !0);
|
|
1131
|
+
}, r = (n) => {
|
|
1132
|
+
v("blur", n), G();
|
|
1133
|
+
}, l = L(() => N.value === "multiple" ? "textarea" : "text"), d = L(
|
|
1211
1134
|
() => ({
|
|
1212
1135
|
display: "flex",
|
|
1213
|
-
justifyContent:
|
|
1136
|
+
justifyContent: u.showWordLimit && u.maxLength !== 1 / 0 ? "space-between" : "flex-end",
|
|
1214
1137
|
alignItems: "center"
|
|
1215
1138
|
})
|
|
1216
|
-
),
|
|
1217
|
-
"is-disabled":
|
|
1218
|
-
"is-loading":
|
|
1219
|
-
"
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
width: ht(o.suggestionPopupWidth),
|
|
1139
|
+
), b = dt(), D = L(() => !!b.decorativeContent), T = L(() => u.disabled || D.value), $ = L(() => u.loading), z = L(() => ({
|
|
1140
|
+
"is-disabled": T.value,
|
|
1141
|
+
"is-loading": $.value,
|
|
1142
|
+
"is-auto-switching": ne.value
|
|
1143
|
+
})), ge = L(() => ({
|
|
1144
|
+
width: _t(u.suggestionPopupWidth),
|
|
1223
1145
|
maxWidth: "100%"
|
|
1224
1146
|
// 确保不超出父容器宽度
|
|
1225
|
-
})),
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
b.value = !1, setTimeout(() => {
|
|
1229
|
-
b.value = !1, K();
|
|
1147
|
+
})), Be = () => {
|
|
1148
|
+
I.value = !1, setTimeout(() => {
|
|
1149
|
+
I.value = !1, Z();
|
|
1230
1150
|
}, 50);
|
|
1231
1151
|
};
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
}),
|
|
1235
|
-
() =>
|
|
1236
|
-
(
|
|
1237
|
-
|
|
1152
|
+
ee(g, () => {
|
|
1153
|
+
J(we), g.value === "" && u.mode === "single" && (N.value = "single");
|
|
1154
|
+
}), ee(
|
|
1155
|
+
() => k.value,
|
|
1156
|
+
(n) => {
|
|
1157
|
+
n && (N.value = "multiple");
|
|
1238
1158
|
}
|
|
1239
|
-
)
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
setTemplate: Ke
|
|
1255
|
-
}), (d, k) => (D(), A("div", {
|
|
1159
|
+
);
|
|
1160
|
+
const Ke = () => {
|
|
1161
|
+
p.value && p.value.activateFirstField();
|
|
1162
|
+
}, { accept: Je = "*", multiple: Ze = !0 } = ((Ne = u.buttonGroup) == null ? void 0 : Ne.file) || {}, { open: Ae, files: Qe } = ht({ accept: Je, multiple: Ze });
|
|
1163
|
+
return ee(Qe, (n) => {
|
|
1164
|
+
n && n.length > 0 && v("files-selected", Array.from(n));
|
|
1165
|
+
}), c({
|
|
1166
|
+
focus: be,
|
|
1167
|
+
blur: de,
|
|
1168
|
+
clear: fe,
|
|
1169
|
+
submit: t,
|
|
1170
|
+
startSpeech: _e,
|
|
1171
|
+
stopSpeech: pe,
|
|
1172
|
+
activateTemplateFirstField: Ke
|
|
1173
|
+
}), (n, x) => (S(), R("div", {
|
|
1256
1174
|
ref_key: "senderRef",
|
|
1257
|
-
ref:
|
|
1258
|
-
class:
|
|
1259
|
-
"data-theme":
|
|
1175
|
+
ref: o,
|
|
1176
|
+
class: te(["tiny-sender", [z.value, `theme-${n.theme}`, `mode-${N.value}`]]),
|
|
1177
|
+
"data-theme": n.theme
|
|
1260
1178
|
}, [
|
|
1261
|
-
U("div",
|
|
1179
|
+
U("div", qt, [
|
|
1262
1180
|
U("div", {
|
|
1263
1181
|
class: "tiny-sender__input-wrapper",
|
|
1264
1182
|
ref_key: "inputWrapperRef",
|
|
1265
|
-
ref:
|
|
1183
|
+
ref: _
|
|
1266
1184
|
}, [
|
|
1267
|
-
|
|
1268
|
-
default:
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
])) :
|
|
1185
|
+
X(He, { name: "tiny-sender-slide-down" }, {
|
|
1186
|
+
default: re(() => [
|
|
1187
|
+
n.$slots.header ? (S(), R("div", zt, [
|
|
1188
|
+
oe(n.$slots, "header")
|
|
1189
|
+
])) : M("", !0)
|
|
1272
1190
|
]),
|
|
1273
1191
|
_: 3
|
|
1274
1192
|
}),
|
|
1275
1193
|
U("div", {
|
|
1276
|
-
class:
|
|
1194
|
+
class: te(["tiny-sender__input-row", { "has-prefix": n.$slots.prefix, "has-header": n.$slots.header }])
|
|
1277
1195
|
}, [
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
])) :
|
|
1281
|
-
U("div",
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
])) :
|
|
1285
|
-
|
|
1196
|
+
n.$slots.prefix ? (S(), R("div", jt, [
|
|
1197
|
+
oe(n.$slots, "prefix")
|
|
1198
|
+
])) : M("", !0),
|
|
1199
|
+
U("div", Gt, [
|
|
1200
|
+
n.$slots.decorativeContent ? (S(), R("div", Xt, [
|
|
1201
|
+
oe(n.$slots, "decorativeContent")
|
|
1202
|
+
])) : M("", !0),
|
|
1203
|
+
k.value ? (S(), Q(Kt, {
|
|
1286
1204
|
key: 1,
|
|
1287
1205
|
ref_key: "templateEditorRef",
|
|
1288
|
-
ref:
|
|
1289
|
-
value:
|
|
1290
|
-
"onUpdate:
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
G(E(ft), {
|
|
1206
|
+
ref: p,
|
|
1207
|
+
"model-value": u.templateData,
|
|
1208
|
+
"onUpdate:modelValue": $e,
|
|
1209
|
+
onSubmit: C(t)
|
|
1210
|
+
}, null, 8, ["model-value", "onSubmit"])) : (S(), R("div", Jt, [
|
|
1211
|
+
X(C(pt), {
|
|
1295
1212
|
ref_key: "inputRef",
|
|
1296
|
-
ref:
|
|
1297
|
-
autosize:
|
|
1298
|
-
type:
|
|
1299
|
-
readonly: Ee.value,
|
|
1213
|
+
ref: w,
|
|
1214
|
+
autosize: n.autoSize,
|
|
1215
|
+
type: l.value,
|
|
1300
1216
|
resize: "none",
|
|
1301
|
-
modelValue:
|
|
1302
|
-
"onUpdate:modelValue":
|
|
1303
|
-
disabled:
|
|
1304
|
-
placeholder:
|
|
1305
|
-
autofocus:
|
|
1306
|
-
onKeydown:
|
|
1307
|
-
onCompositionstart:
|
|
1308
|
-
onCompositionend:
|
|
1309
|
-
onFocus:
|
|
1310
|
-
onBlur:
|
|
1311
|
-
}, null, 8, ["autosize", "type", "
|
|
1312
|
-
|
|
1313
|
-
U("span",
|
|
1314
|
-
|
|
1315
|
-
E
|
|
1316
|
-
])) :
|
|
1217
|
+
modelValue: C(g),
|
|
1218
|
+
"onUpdate:modelValue": x[0] || (x[0] = (F) => ft(g) ? g.value = F : null),
|
|
1219
|
+
disabled: T.value,
|
|
1220
|
+
placeholder: n.placeholder,
|
|
1221
|
+
autofocus: n.autofocus,
|
|
1222
|
+
onKeydown: C(e),
|
|
1223
|
+
onCompositionstart: x[1] || (x[1] = (F) => I.value = !0),
|
|
1224
|
+
onCompositionend: Be,
|
|
1225
|
+
onFocus: s,
|
|
1226
|
+
onBlur: r
|
|
1227
|
+
}, null, 8, ["autosize", "type", "modelValue", "disabled", "placeholder", "autofocus", "onKeydown"]),
|
|
1228
|
+
C(f) && !C(I) ? (S(), R("div", Zt, [
|
|
1229
|
+
U("span", Qt, ae(C(g)), 1),
|
|
1230
|
+
Ge(ae(C(f)) + " ", 1),
|
|
1231
|
+
C(E) ? (S(), R("div", Yt, "TAB")) : M("", !0)
|
|
1232
|
+
])) : M("", !0)
|
|
1317
1233
|
]))
|
|
1318
1234
|
]),
|
|
1319
|
-
|
|
1235
|
+
N.value === "single" ? (S(), R("div", en, [
|
|
1320
1236
|
U("div", {
|
|
1321
1237
|
class: "tiny-sender__buttons-container",
|
|
1322
1238
|
ref_key: "buttonsContainerRef",
|
|
1323
|
-
ref:
|
|
1239
|
+
ref: h
|
|
1324
1240
|
}, [
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
"allow-speech":
|
|
1328
|
-
"allow-files":
|
|
1329
|
-
loading:
|
|
1330
|
-
disabled:
|
|
1331
|
-
"show-clear":
|
|
1332
|
-
"has-content":
|
|
1333
|
-
"speech-status":
|
|
1334
|
-
"
|
|
1335
|
-
"
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1241
|
+
oe(n.$slots, "actions"),
|
|
1242
|
+
X(Xe, {
|
|
1243
|
+
"allow-speech": n.allowSpeech,
|
|
1244
|
+
"allow-files": n.allowFiles,
|
|
1245
|
+
loading: n.loading,
|
|
1246
|
+
disabled: T.value,
|
|
1247
|
+
"show-clear": n.clearable,
|
|
1248
|
+
"has-content": P.value,
|
|
1249
|
+
"speech-status": C(Y),
|
|
1250
|
+
"button-group": n.buttonGroup,
|
|
1251
|
+
"submit-type": n.submitType,
|
|
1252
|
+
"is-over-limit": he.value,
|
|
1253
|
+
"stop-text": n.stopText,
|
|
1254
|
+
onClear: fe,
|
|
1255
|
+
onToggleSpeech: Ce,
|
|
1256
|
+
onSubmit: C(t),
|
|
1257
|
+
onCancel: x[2] || (x[2] = (F) => n.$emit("cancel")),
|
|
1258
|
+
onTriggerSelect: C(Ae)
|
|
1259
|
+
}, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "button-group", "submit-type", "is-over-limit", "stop-text", "onSubmit", "onTriggerSelect"])
|
|
1341
1260
|
], 512)
|
|
1342
|
-
])) :
|
|
1261
|
+
])) : M("", !0)
|
|
1343
1262
|
], 2),
|
|
1344
|
-
|
|
1345
|
-
default:
|
|
1346
|
-
|
|
1263
|
+
X(He, { name: "tiny-sender-slide-up" }, {
|
|
1264
|
+
default: re(() => [
|
|
1265
|
+
N.value === "multiple" ? (S(), R("div", {
|
|
1347
1266
|
key: 0,
|
|
1348
|
-
style:
|
|
1267
|
+
style: Pe(d.value),
|
|
1349
1268
|
class: "tiny-sender__footer-slot tiny-sender__bottom-row"
|
|
1350
1269
|
}, [
|
|
1351
|
-
U("div",
|
|
1352
|
-
|
|
1270
|
+
U("div", tn, [
|
|
1271
|
+
oe(n.$slots, "footer-left")
|
|
1353
1272
|
]),
|
|
1354
|
-
U("div",
|
|
1355
|
-
|
|
1356
|
-
|
|
1273
|
+
U("div", nn, [
|
|
1274
|
+
oe(n.$slots, "footer-right"),
|
|
1275
|
+
n.showWordLimit && n.maxLength !== 1 / 0 ? (S(), R("div", {
|
|
1357
1276
|
key: 0,
|
|
1358
|
-
class:
|
|
1277
|
+
class: te(["tiny-sender__word-limit", { "is-over-limit": he.value }])
|
|
1359
1278
|
}, [
|
|
1360
|
-
U("span",
|
|
1361
|
-
|
|
1362
|
-
], 2)) :
|
|
1363
|
-
|
|
1364
|
-
U("div",
|
|
1365
|
-
|
|
1366
|
-
"allow-speech":
|
|
1367
|
-
"allow-files":
|
|
1368
|
-
loading:
|
|
1369
|
-
disabled:
|
|
1370
|
-
"show-clear":
|
|
1371
|
-
"has-content":
|
|
1372
|
-
"speech-status":
|
|
1373
|
-
"
|
|
1374
|
-
"
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1279
|
+
U("span", sn, ae(C(g).length), 1),
|
|
1280
|
+
Ge("/" + ae(n.maxLength), 1)
|
|
1281
|
+
], 2)) : M("", !0),
|
|
1282
|
+
N.value === "multiple" ? (S(), R("div", on, [
|
|
1283
|
+
U("div", an, [
|
|
1284
|
+
X(Xe, {
|
|
1285
|
+
"allow-speech": n.allowSpeech,
|
|
1286
|
+
"allow-files": n.allowFiles,
|
|
1287
|
+
loading: n.loading,
|
|
1288
|
+
disabled: T.value,
|
|
1289
|
+
"show-clear": n.clearable,
|
|
1290
|
+
"has-content": P.value,
|
|
1291
|
+
"speech-status": C(Y),
|
|
1292
|
+
"button-group": n.buttonGroup,
|
|
1293
|
+
"submit-type": n.submitType,
|
|
1294
|
+
"is-over-limit": he.value,
|
|
1295
|
+
"stop-text": n.stopText,
|
|
1296
|
+
onClear: fe,
|
|
1297
|
+
onToggleSpeech: Ce,
|
|
1298
|
+
onSubmit: C(t),
|
|
1299
|
+
onCancel: x[3] || (x[3] = (F) => n.$emit("cancel")),
|
|
1300
|
+
onTriggerSelect: C(Ae)
|
|
1301
|
+
}, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "button-group", "submit-type", "is-over-limit", "stop-text", "onSubmit", "onTriggerSelect"])
|
|
1380
1302
|
])
|
|
1381
|
-
])) :
|
|
1303
|
+
])) : M("", !0)
|
|
1382
1304
|
])
|
|
1383
|
-
], 4)) :
|
|
1384
|
-
|
|
1385
|
-
])) :
|
|
1305
|
+
], 4)) : n.$slots.footer ? (S(), R("div", ln, [
|
|
1306
|
+
oe(n.$slots, "footer")
|
|
1307
|
+
])) : M("", !0)
|
|
1386
1308
|
]),
|
|
1387
1309
|
_: 3
|
|
1388
1310
|
})
|
|
1389
1311
|
], 512)
|
|
1390
1312
|
]),
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
(...Z) => E(l) && E(l)(...Z)),
|
|
1406
|
-
onMousedown: dt((Z) => E(C)(F), ["prevent"])
|
|
1407
|
-
}, [
|
|
1408
|
-
G(E(St), { class: "suggestion-item__icon" }),
|
|
1409
|
-
U("span", en, [
|
|
1410
|
-
(D(!0), A(Ae, null, Me(E(n)(F, E(a)), (Z, ge) => (D(), A("span", {
|
|
1411
|
-
key: ge,
|
|
1412
|
-
class: ae({ "suggestion-item__text--match": Z.isMatch, "suggestion-item__text--normal": !Z.isMatch })
|
|
1413
|
-
}, le(Z.text), 3))), 128))
|
|
1414
|
-
])
|
|
1415
|
-
], 42, Yt))), 128))
|
|
1416
|
-
], 4)) : H("", !0)
|
|
1417
|
-
]),
|
|
1418
|
-
_: 1
|
|
1419
|
-
}),
|
|
1420
|
-
oe.value ? (D(), A("div", tn, le(oe.value), 1)) : H("", !0)
|
|
1421
|
-
], 10, Mt));
|
|
1313
|
+
X(Mt, {
|
|
1314
|
+
ref_key: "suggestionsListRef",
|
|
1315
|
+
ref: y,
|
|
1316
|
+
show: C(A),
|
|
1317
|
+
suggestions: C(W),
|
|
1318
|
+
"popup-style": ge.value,
|
|
1319
|
+
"is-item-highlighted": C(q),
|
|
1320
|
+
"highlight-suggestion-text": C(j),
|
|
1321
|
+
"input-value": C(g),
|
|
1322
|
+
onItemHover: C(V),
|
|
1323
|
+
onItemLeave: C(le),
|
|
1324
|
+
onSelect: C(ue)
|
|
1325
|
+
}, null, 8, ["show", "suggestions", "popup-style", "is-item-highlighted", "highlight-suggestion-text", "input-value", "onItemHover", "onItemLeave", "onSelect"])
|
|
1326
|
+
], 10, Ut));
|
|
1422
1327
|
}
|
|
1423
1328
|
});
|
|
1424
|
-
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1329
|
+
Re.name = "TrSender";
|
|
1330
|
+
const rn = function(i) {
|
|
1331
|
+
i.component(Re.name, Re);
|
|
1427
1332
|
};
|
|
1428
|
-
|
|
1333
|
+
Re.install = rn;
|
|
1429
1334
|
export {
|
|
1430
|
-
|
|
1335
|
+
Re as default
|
|
1431
1336
|
};
|