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