@opentiny/tiny-robot 0.2.0-alpha.1 → 0.2.0-alpha.2
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.type.d.ts +1 -0
- package/dist/bubble/index.d.ts +2 -2
- package/dist/bubble/index.type.d.ts +16 -18
- package/dist/feedback/index.vue.d.ts +2 -2
- package/dist/icon-button/index.type.d.ts +2 -3
- package/dist/icon-button/index.vue.d.ts +3 -3
- package/dist/node_modules/.pnpm/@vueuse_core@13.1.0_vue@3.5.13/node_modules/@vueuse/core/index.js +262 -142
- package/dist/node_modules/.pnpm/@vueuse_shared@13.1.0_vue@3.5.13/node_modules/@vueuse/shared/index.js +96 -39
- package/dist/packages/components/src/action-group/ActionGroup.vue.js +2 -2
- package/dist/packages/components/src/action-group/ActionGroup.vue2.js +96 -72
- package/dist/packages/components/src/bubble/Bubble.vue.js +7 -0
- package/dist/packages/components/src/bubble/Bubble.vue2.js +76 -0
- package/dist/packages/components/src/bubble/BubbleList.vue.js +7 -0
- package/dist/packages/components/src/bubble/BubbleList.vue2.js +50 -0
- package/dist/packages/components/src/bubble/index.js +2 -2
- package/dist/packages/components/src/container/index.vue.js +2 -2
- package/dist/packages/components/src/container/index.vue2.js +36 -36
- package/dist/packages/components/src/feedback/index.vue.js +2 -2
- package/dist/packages/components/src/feedback/index.vue2.js +72 -71
- package/dist/packages/components/src/icon-button/index.vue.js +2 -2
- package/dist/packages/components/src/icon-button/index.vue2.js +9 -27
- package/dist/packages/components/src/sender/components/TemplateEditor.vue.js +2 -2
- package/dist/packages/components/src/sender/components/TemplateEditor.vue2.js +137 -83
- package/dist/sender/index.vue.d.ts +2 -2
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/src/action-group/ActionGroup.vue +38 -23
- package/src/action-group/index.type.ts +1 -0
- package/src/bubble/{bubble.vue → Bubble.vue} +13 -97
- package/src/bubble/BubbleList.vue +55 -0
- package/src/bubble/index.ts +2 -2
- package/src/bubble/index.type.ts +7 -21
- package/src/container/index.vue +10 -35
- package/src/feedback/index.vue +14 -14
- package/src/icon-button/index.type.ts +2 -3
- package/src/icon-button/index.vue +16 -10
- package/src/sender/components/TemplateEditor.vue +301 -110
- package/dist/bubble/components/actions/copy.vue.d.ts +0 -10
- package/dist/bubble/components/actions/index.d.ts +0 -2
- package/dist/bubble/components/actions/refresh.vue.d.ts +0 -2
- package/dist/bubble/useScroll.d.ts +0 -4
- package/dist/packages/components/src/bubble/bubble-list.vue.js +0 -7
- package/dist/packages/components/src/bubble/bubble-list.vue2.js +0 -37
- package/dist/packages/components/src/bubble/bubble.vue.js +0 -7
- package/dist/packages/components/src/bubble/bubble.vue2.js +0 -118
- package/dist/packages/components/src/bubble/components/actions/copy.vue.js +0 -7
- package/dist/packages/components/src/bubble/components/actions/copy.vue2.js +0 -35
- package/dist/packages/components/src/bubble/components/actions/refresh.vue.js +0 -7
- package/dist/packages/components/src/bubble/components/actions/refresh.vue2.js +0 -16
- package/dist/packages/components/src/bubble/useScroll.js +0 -13
- package/src/bubble/bubble-list.vue +0 -42
- package/src/bubble/components/actions/copy.vue +0 -54
- package/src/bubble/components/actions/index.ts +0 -2
- package/src/bubble/components/actions/refresh.vue +0 -31
- package/src/bubble/useScroll.ts +0 -14
- /package/dist/bubble/{bubble-list.vue.d.ts → BubbleList.vue.d.ts} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { IconArrowDown as
|
|
3
|
-
import
|
|
4
|
-
import { ActionGroupItem as
|
|
1
|
+
import { defineComponent as R, ref as T, createElementBlock as p, openBlock as o, createElementVNode as a, createCommentVNode as _, createBlock as l, unref as t, withCtx as c, Fragment as C, renderList as x, createVNode as f, createTextVNode as X, toDisplayString as k, resolveDynamicComponent as h } from "vue";
|
|
2
|
+
import { IconArrowDown as b, IconArrowUp as N, IconDislike as z, IconLike as O, IconRefresh as U, IconCopy as Z } from "../../../svgs/dist/tiny-robot-svgs.js";
|
|
3
|
+
import w from "../../../../node_modules/.pnpm/@opentiny_vue-button@3.21.0/node_modules/@opentiny/vue-button/lib/index.js";
|
|
4
|
+
import { ActionGroupItem as S } from "../action-group/index.js";
|
|
5
5
|
import "../icon-button/index.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
const
|
|
6
|
+
import j from "./components/SourceList.vue.js";
|
|
7
|
+
import B from "../action-group/ActionGroup.vue.js";
|
|
8
|
+
import q from "../icon-button/index.vue.js";
|
|
9
|
+
const H = { class: "tr-feedback" }, J = { class: "tr-feedback__operations" }, K = { class: "tr-feedback__operations-left" }, P = { key: 1 }, Q = { class: "tr-feedback__operations-right" }, W = {
|
|
10
10
|
key: 0,
|
|
11
|
-
class: "tr-
|
|
12
|
-
},
|
|
11
|
+
class: "tr-feedback__footer"
|
|
12
|
+
}, Y = { key: 0 }, ae = /* @__PURE__ */ R({
|
|
13
13
|
__name: "index",
|
|
14
14
|
props: {
|
|
15
15
|
operations: {},
|
|
@@ -20,60 +20,61 @@ const j = { class: "tr-feedback" }, q = { class: "tr-feedback__operations" }, H
|
|
|
20
20
|
sourcesLinesLimit: { default: Number.MAX_SAFE_INTEGER }
|
|
21
21
|
},
|
|
22
22
|
emits: ["operation", "action"],
|
|
23
|
-
setup(
|
|
24
|
-
const e =
|
|
25
|
-
copy:
|
|
26
|
-
refresh:
|
|
27
|
-
like:
|
|
28
|
-
dislike:
|
|
29
|
-
}, y =
|
|
30
|
-
var
|
|
31
|
-
(
|
|
32
|
-
},
|
|
33
|
-
var
|
|
34
|
-
(
|
|
35
|
-
},
|
|
36
|
-
|
|
23
|
+
setup(D, { emit: G }) {
|
|
24
|
+
const e = D, V = {
|
|
25
|
+
copy: Z,
|
|
26
|
+
refresh: U,
|
|
27
|
+
like: O,
|
|
28
|
+
dislike: z
|
|
29
|
+
}, y = G, F = (m) => {
|
|
30
|
+
var r, n, i;
|
|
31
|
+
(i = (n = (r = e.operations) == null ? void 0 : r.find((d) => d.name === m)) == null ? void 0 : n.onClick) == null || i.call(n), y("operation", m);
|
|
32
|
+
}, M = (m) => {
|
|
33
|
+
var r, n, i;
|
|
34
|
+
(i = (n = (r = e.actions) == null ? void 0 : r.find((d) => d.name === m)) == null ? void 0 : n.onClick) == null || i.call(n), y("action", m);
|
|
35
|
+
}, u = T(!1), v = () => {
|
|
36
|
+
u.value = !u.value;
|
|
37
37
|
};
|
|
38
|
-
return (m,
|
|
39
|
-
var n,
|
|
40
|
-
return o(),
|
|
41
|
-
a("div",
|
|
42
|
-
(
|
|
43
|
-
|
|
38
|
+
return (m, r) => {
|
|
39
|
+
var n, i, d, g, I, L, E, A;
|
|
40
|
+
return o(), p("div", H, [
|
|
41
|
+
a("div", J, [
|
|
42
|
+
a("div", K, [
|
|
43
|
+
(n = e.operations) != null && n.length ? (o(), l(t(B), {
|
|
44
|
+
key: 0,
|
|
44
45
|
"max-num": e.operationsLimit,
|
|
45
46
|
"drop-down-show-label-only": !0,
|
|
46
|
-
onItemClick:
|
|
47
|
+
onItemClick: F,
|
|
47
48
|
class: "tr-feedback__operations-left-action-group"
|
|
48
49
|
}, {
|
|
49
|
-
moreBtn:
|
|
50
|
-
|
|
50
|
+
moreBtn: c(() => [
|
|
51
|
+
f(t(w), {
|
|
51
52
|
round: "",
|
|
52
53
|
size: "mini",
|
|
53
54
|
"reset-time": 0,
|
|
54
55
|
class: "tr-feedback__operations-more-btn"
|
|
55
56
|
}, {
|
|
56
|
-
default:
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
default: c(() => [
|
|
58
|
+
r[0] || (r[0] = a("span", null, "更多", -1)),
|
|
59
|
+
f(t(b))
|
|
59
60
|
]),
|
|
60
61
|
_: 1
|
|
61
62
|
})
|
|
62
63
|
]),
|
|
63
|
-
default:
|
|
64
|
-
(o(!0),
|
|
64
|
+
default: c(() => [
|
|
65
|
+
(o(!0), p(C, null, x(e.operations, (s) => (o(), l(t(S), {
|
|
65
66
|
key: s.name,
|
|
66
67
|
name: s.name,
|
|
67
68
|
label: s.label
|
|
68
69
|
}, {
|
|
69
|
-
default:
|
|
70
|
-
|
|
70
|
+
default: c(() => [
|
|
71
|
+
f(t(w), {
|
|
71
72
|
round: "",
|
|
72
73
|
"reset-time": 0,
|
|
73
74
|
size: "mini"
|
|
74
75
|
}, {
|
|
75
|
-
default:
|
|
76
|
-
|
|
76
|
+
default: c(() => [
|
|
77
|
+
X(k(s.label), 1)
|
|
77
78
|
]),
|
|
78
79
|
_: 2
|
|
79
80
|
}, 1024)
|
|
@@ -82,33 +83,33 @@ const j = { class: "tr-feedback" }, q = { class: "tr-feedback__operations" }, H
|
|
|
82
83
|
}, 1032, ["name", "label"]))), 128))
|
|
83
84
|
]),
|
|
84
85
|
_: 1
|
|
85
|
-
}, 8, ["max-num"])
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
])
|
|
94
|
-
])
|
|
95
|
-
a("div",
|
|
96
|
-
|
|
86
|
+
}, 8, ["max-num"])) : (i = e.sources) != null && i.length ? (o(), p("div", P, [
|
|
87
|
+
a("span", {
|
|
88
|
+
class: "tr-feedback__source",
|
|
89
|
+
onClick: v
|
|
90
|
+
}, [
|
|
91
|
+
a("span", null, k((d = e.sources) == null ? void 0 : d.length) + "条来源", 1),
|
|
92
|
+
(o(), l(h(u.value ? t(N) : t(b))))
|
|
93
|
+
])
|
|
94
|
+
])) : _("", !0)
|
|
95
|
+
]),
|
|
96
|
+
a("div", Q, [
|
|
97
|
+
f(t(B), {
|
|
97
98
|
"max-num": e.actionsLimit,
|
|
98
|
-
|
|
99
|
+
"show-tooltip": !0,
|
|
100
|
+
onItemClick: M
|
|
99
101
|
}, {
|
|
100
|
-
default:
|
|
101
|
-
(o(!0),
|
|
102
|
+
default: c(() => [
|
|
103
|
+
(o(!0), p(C, null, x(e.actions, (s) => (o(), l(t(S), {
|
|
102
104
|
key: s.name,
|
|
103
105
|
name: s.name,
|
|
104
106
|
label: s.label
|
|
105
107
|
}, {
|
|
106
|
-
default:
|
|
107
|
-
typeof s.icon == "string" ? (o(),
|
|
108
|
+
default: c(() => [
|
|
109
|
+
typeof s.icon == "string" ? (o(), l(t(q), {
|
|
108
110
|
key: 0,
|
|
109
|
-
icon:
|
|
110
|
-
|
|
111
|
-
}, null, 8, ["icon", "tooltip"])) : (o(), c(b(s.icon), { key: 1 }))
|
|
111
|
+
icon: V[s.icon]
|
|
112
|
+
}, null, 8, ["icon"])) : (o(), l(h(s.icon), { key: 1 }))
|
|
112
113
|
]),
|
|
113
114
|
_: 2
|
|
114
115
|
}, 1032, ["name", "label"]))), 128))
|
|
@@ -117,26 +118,26 @@ const j = { class: "tr-feedback" }, q = { class: "tr-feedback__operations" }, H
|
|
|
117
118
|
}, 8, ["max-num"])
|
|
118
119
|
])
|
|
119
120
|
]),
|
|
120
|
-
|
|
121
|
-
(
|
|
121
|
+
(g = e.operations) != null && g.length && ((I = e.sources) != null && I.length) || u.value && e.sources ? (o(), p("div", W, [
|
|
122
|
+
(L = e.operations) != null && L.length && ((E = e.sources) != null && E.length) ? (o(), p("div", Y, [
|
|
122
123
|
a("span", {
|
|
123
124
|
class: "tr-feedback__source",
|
|
124
125
|
onClick: v
|
|
125
126
|
}, [
|
|
126
|
-
a("span", null, k((
|
|
127
|
-
(o(),
|
|
127
|
+
a("span", null, k((A = e.sources) == null ? void 0 : A.length) + "条来源", 1),
|
|
128
|
+
(o(), l(h(u.value ? t(N) : t(b))))
|
|
128
129
|
])
|
|
129
|
-
])) :
|
|
130
|
-
|
|
130
|
+
])) : _("", !0),
|
|
131
|
+
u.value && e.sources ? (o(), l(t(j), {
|
|
131
132
|
key: 1,
|
|
132
133
|
sources: e.sources,
|
|
133
134
|
"lines-limit": e.sourcesLinesLimit
|
|
134
|
-
}, null, 8, ["sources", "lines-limit"])) :
|
|
135
|
-
])
|
|
135
|
+
}, null, 8, ["sources", "lines-limit"])) : _("", !0)
|
|
136
|
+
])) : _("", !0)
|
|
136
137
|
]);
|
|
137
138
|
};
|
|
138
139
|
}
|
|
139
140
|
});
|
|
140
141
|
export {
|
|
141
|
-
|
|
142
|
+
ae as default
|
|
142
143
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./index.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-f6ea2c1a"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
f as default
|
|
7
7
|
};
|
|
@@ -1,37 +1,19 @@
|
|
|
1
|
-
import { defineComponent as i, useCssVars as
|
|
2
|
-
|
|
3
|
-
const m = { class: "tr-icon-button" }, d = {
|
|
4
|
-
key: 1,
|
|
5
|
-
class: "tr-icon-button"
|
|
6
|
-
}, x = /* @__PURE__ */ i({
|
|
1
|
+
import { defineComponent as i, useCssVars as u, computed as n, createElementBlock as p, openBlock as c, createBlock as l, resolveDynamicComponent as m } from "vue";
|
|
2
|
+
const f = { class: "tr-icon-button" }, x = /* @__PURE__ */ i({
|
|
7
3
|
__name: "index",
|
|
8
4
|
props: {
|
|
9
5
|
icon: {},
|
|
10
6
|
size: { default: "24px" },
|
|
11
|
-
svgSize: { default: "16px" }
|
|
12
|
-
tooltip: {}
|
|
7
|
+
svgSize: { default: "16px" }
|
|
13
8
|
},
|
|
14
9
|
setup(s) {
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
10
|
+
u((e) => ({
|
|
11
|
+
"2d9cffb8": r.value,
|
|
12
|
+
"0c8b8982": a.value
|
|
18
13
|
}));
|
|
19
|
-
const t = s;
|
|
20
|
-
return (
|
|
21
|
-
|
|
22
|
-
content: o.tooltip,
|
|
23
|
-
effect: "dark",
|
|
24
|
-
placement: "top",
|
|
25
|
-
"open-delay": 500
|
|
26
|
-
}, {
|
|
27
|
-
default: l(() => [
|
|
28
|
-
f("button", m, [
|
|
29
|
-
(e(), n(c(t.icon)))
|
|
30
|
-
])
|
|
31
|
-
]),
|
|
32
|
-
_: 1
|
|
33
|
-
}, 8, ["content"])) : (e(), r("button", d, [
|
|
34
|
-
(e(), n(c(t.icon)))
|
|
14
|
+
const t = s, o = (e) => isNaN(Number(e)) ? e : `${e}px`, r = n(() => o(t.size)), a = n(() => o(t.svgSize));
|
|
15
|
+
return (e, _) => (c(), p("button", f, [
|
|
16
|
+
(c(), l(m(t.icon)))
|
|
35
17
|
]));
|
|
36
18
|
}
|
|
37
19
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./TemplateEditor.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-09e9c7ed"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -1,121 +1,175 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as U, ref as c, watch as T, nextTick as D, onMounted as j, createElementBlock as r, openBlock as f, createElementVNode as W, Fragment as P, renderList as q, toDisplayString as S, normalizeClass as G, withModifiers as J } from "vue";
|
|
2
|
+
const Q = { class: "template-editor" }, X = { key: 0 }, Y = ["onClick"], Z = ["onInput"], ee = {
|
|
3
3
|
key: 1,
|
|
4
4
|
class: "template-placeholder"
|
|
5
|
-
},
|
|
5
|
+
}, le = /* @__PURE__ */ U({
|
|
6
6
|
__name: "TemplateEditor",
|
|
7
7
|
props: {
|
|
8
8
|
template: {},
|
|
9
9
|
value: {}
|
|
10
10
|
},
|
|
11
11
|
emits: ["update:value", "input", "content-status", "field-active"],
|
|
12
|
-
setup(
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
n.index > l && e.push({
|
|
22
|
-
content: u.template.substring(l, n.index),
|
|
12
|
+
setup(B, { expose: L, emit: M }) {
|
|
13
|
+
const d = B, p = M, $ = c(null), m = c({}), u = c(-1), _ = c(!1), v = c(!1), g = c(!1), s = c([]), k = (e) => {
|
|
14
|
+
const t = [];
|
|
15
|
+
let n = 0, a = 0;
|
|
16
|
+
const l = /\[(.*?)\]/g;
|
|
17
|
+
let o;
|
|
18
|
+
for (; (o = l.exec(e)) !== null; )
|
|
19
|
+
o.index > n && t.push({
|
|
20
|
+
content: e.substring(n, o.index),
|
|
23
21
|
isField: !1
|
|
24
|
-
}),
|
|
25
|
-
content:
|
|
26
|
-
|
|
22
|
+
}), t.push({
|
|
23
|
+
content: o[1],
|
|
24
|
+
// 使用占位符作为默认内容
|
|
25
|
+
placeholder: o[1],
|
|
27
26
|
isField: !0,
|
|
28
|
-
fieldIndex:
|
|
29
|
-
}),
|
|
30
|
-
return
|
|
31
|
-
content:
|
|
27
|
+
fieldIndex: a++
|
|
28
|
+
}), n = o.index + o[0].length;
|
|
29
|
+
return n < e.length && t.push({
|
|
30
|
+
content: e.substring(n),
|
|
32
31
|
isField: !1
|
|
33
|
-
}),
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
}), t;
|
|
33
|
+
}, z = () => {
|
|
34
|
+
s.value = k(d.template), d.value && I(d.value);
|
|
35
|
+
}, I = (e) => {
|
|
36
|
+
if (!e || g.value || F() === e) return;
|
|
37
|
+
const n = k(d.template), a = [];
|
|
38
|
+
n.forEach((i) => {
|
|
39
|
+
i.isField ? a.push(`__FIELD_${i.fieldIndex}__`) : a.push(i.content);
|
|
41
40
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (i.value[t].isField)
|
|
54
|
-
return t;
|
|
55
|
-
for (let t = i.value.length - 1; t > e; t--)
|
|
56
|
-
if (i.value[t].isField)
|
|
57
|
-
return t;
|
|
58
|
-
} else {
|
|
59
|
-
for (let t = e + 1; t < i.value.length; t++)
|
|
60
|
-
if (i.value[t].isField)
|
|
61
|
-
return t;
|
|
62
|
-
for (let t = 0; t < e; t++)
|
|
63
|
-
if (i.value[t].isField)
|
|
64
|
-
return t;
|
|
41
|
+
let l = e, o = 0;
|
|
42
|
+
for (let i = 0; i < s.value.length; i++) {
|
|
43
|
+
if (!s.value[i].isField) continue;
|
|
44
|
+
const b = a[o];
|
|
45
|
+
o++;
|
|
46
|
+
const x = a[o] || "";
|
|
47
|
+
if (b && l.startsWith(b))
|
|
48
|
+
if (l = l.substring(b.length), x && l.includes(x)) {
|
|
49
|
+
const w = l.indexOf(x), R = l.substring(0, w);
|
|
50
|
+
R && (s.value[i].content = R, u.value === i && m.value[i] && (v.value = !0)), l = l.substring(w);
|
|
51
|
+
} else !x && l && (s.value[i].content = l, l = "");
|
|
65
52
|
}
|
|
66
|
-
|
|
53
|
+
C(e);
|
|
54
|
+
}, F = () => s.value.map((e) => e.content).join(""), h = () => {
|
|
55
|
+
g.value = !0;
|
|
56
|
+
const e = F();
|
|
57
|
+
p("update:value", e), p("input", e), C(e), setTimeout(() => {
|
|
58
|
+
g.value = !1;
|
|
59
|
+
}, 0);
|
|
60
|
+
}, C = (e) => {
|
|
61
|
+
const n = (e || F()).trim().length > 0;
|
|
62
|
+
_.value !== n && (_.value = n, p("content-status", n));
|
|
63
|
+
}, A = (e, t) => {
|
|
64
|
+
e && (m.value[t] = e, e.textContent || (e.textContent = s.value[t].content), new MutationObserver(() => {
|
|
65
|
+
u.value === t && !v.value && (v.value = !0, setTimeout(() => {
|
|
66
|
+
s.value[t].content = e.textContent !== null ? e.textContent : "", v.value = !1;
|
|
67
|
+
}, 0));
|
|
68
|
+
}).observe(e, {
|
|
69
|
+
characterData: !0,
|
|
70
|
+
childList: !0,
|
|
71
|
+
subtree: !0
|
|
72
|
+
}));
|
|
73
|
+
}, H = (e, t) => {
|
|
74
|
+
v.value = !0;
|
|
75
|
+
const n = e.target, a = n.textContent !== null ? n.textContent : "";
|
|
76
|
+
s.value[t].content !== a && (s.value[t].content = a, h()), setTimeout(() => {
|
|
77
|
+
v.value = !1;
|
|
78
|
+
}, 10);
|
|
79
|
+
}, K = (e) => {
|
|
80
|
+
if (document.createRange) {
|
|
81
|
+
const t = document.createRange();
|
|
82
|
+
t.selectNodeContents(e), t.collapse(!1);
|
|
83
|
+
const n = window.getSelection();
|
|
84
|
+
n && (n.removeAllRanges(), n.addRange(t));
|
|
85
|
+
}
|
|
86
|
+
}, E = (e) => {
|
|
87
|
+
if (u.value !== e) {
|
|
88
|
+
if (u.value !== -1) {
|
|
89
|
+
const t = u.value, n = m.value[t];
|
|
90
|
+
n && (s.value[t].content = n.textContent !== null ? n.textContent : "", h());
|
|
91
|
+
}
|
|
92
|
+
u.value = e, p("field-active", !0, e), D(() => {
|
|
93
|
+
const t = m.value[e];
|
|
94
|
+
t && (t.focus(), !t.textContent && s.value[e].content && (t.textContent = s.value[e].content), K(t));
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}, y = () => {
|
|
98
|
+
const e = u.value;
|
|
99
|
+
if (e >= 0) {
|
|
100
|
+
const t = m.value[e];
|
|
101
|
+
if (t) {
|
|
102
|
+
const n = t.textContent !== null ? t.textContent : "";
|
|
103
|
+
s.value[e].content = n;
|
|
104
|
+
}
|
|
105
|
+
p("field-active", !1, e);
|
|
106
|
+
}
|
|
107
|
+
h(), u.value = -1;
|
|
108
|
+
}, N = (e) => {
|
|
109
|
+
e.key === "Enter" && (e.preventDefault(), y());
|
|
67
110
|
};
|
|
68
111
|
T(
|
|
69
|
-
() =>
|
|
112
|
+
() => d.value,
|
|
70
113
|
(e) => {
|
|
71
|
-
e === "" &&
|
|
114
|
+
e === "" ? V() : e && !g.value && I(e);
|
|
72
115
|
}
|
|
116
|
+
), T(
|
|
117
|
+
() => d.template,
|
|
118
|
+
() => {
|
|
119
|
+
z(), D(() => {
|
|
120
|
+
C();
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
{ immediate: !0 }
|
|
73
124
|
);
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
e.isField && (e.content = "");
|
|
77
|
-
}),
|
|
125
|
+
const V = () => {
|
|
126
|
+
s.value.forEach((e) => {
|
|
127
|
+
e.isField && (e.content = e.placeholder || "");
|
|
128
|
+
}), h();
|
|
129
|
+
}, O = () => {
|
|
130
|
+
V();
|
|
78
131
|
};
|
|
79
|
-
return
|
|
132
|
+
return j(() => {
|
|
133
|
+
C();
|
|
134
|
+
}), L({
|
|
80
135
|
activateFirstField: () => {
|
|
81
|
-
for (let e = 0; e <
|
|
82
|
-
if (
|
|
83
|
-
|
|
136
|
+
for (let e = 0; e < s.value.length; e++)
|
|
137
|
+
if (s.value[e].isField) {
|
|
138
|
+
E(e);
|
|
84
139
|
break;
|
|
85
140
|
}
|
|
86
141
|
},
|
|
87
|
-
resetFields:
|
|
88
|
-
}), (e,
|
|
89
|
-
|
|
142
|
+
resetFields: O
|
|
143
|
+
}), (e, t) => (f(), r("div", Q, [
|
|
144
|
+
W("div", {
|
|
90
145
|
class: "template-content",
|
|
91
146
|
ref_key: "editorRef",
|
|
92
|
-
ref:
|
|
147
|
+
ref: $
|
|
93
148
|
}, [
|
|
94
|
-
(
|
|
95
|
-
|
|
149
|
+
(f(!0), r(P, null, q(s.value, (n, a) => (f(), r(P, { key: a }, [
|
|
150
|
+
n.isField ? (f(), r("span", {
|
|
96
151
|
key: 1,
|
|
97
|
-
class:
|
|
98
|
-
onClick: (
|
|
152
|
+
class: G(["template-field", { "template-field-active": u.value === a }]),
|
|
153
|
+
onClick: (l) => E(a)
|
|
99
154
|
}, [
|
|
100
|
-
|
|
155
|
+
u.value === a ? (f(), r("span", {
|
|
101
156
|
key: 0,
|
|
102
157
|
ref_for: !0,
|
|
103
|
-
ref: (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
158
|
+
ref: (l) => A(l, a),
|
|
159
|
+
class: "template-editable",
|
|
160
|
+
contenteditable: "true",
|
|
161
|
+
onInput: (l) => H(l, a),
|
|
162
|
+
onBlur: t[0] || (t[0] = (l) => y()),
|
|
163
|
+
onKeydown: t[1] || (t[1] = (l) => N(l)),
|
|
164
|
+
onClick: t[2] || (t[2] = J(() => {
|
|
109
165
|
}, ["stop"]))
|
|
110
|
-
}, null, 40,
|
|
111
|
-
|
|
112
|
-
]) : (a(), o("span", P, k(t.content || t.placeholder), 1))
|
|
113
|
-
], 10, z)) : (a(), o("span", j, k(t.content), 1))
|
|
166
|
+
}, null, 40, Z)) : (f(), r("span", ee, S(n.content), 1))
|
|
167
|
+
], 10, Y)) : (f(), r("span", X, S(n.content), 1))
|
|
114
168
|
], 64))), 128))
|
|
115
169
|
], 512)
|
|
116
170
|
]));
|
|
117
171
|
}
|
|
118
172
|
});
|
|
119
173
|
export {
|
|
120
|
-
|
|
174
|
+
le as default
|
|
121
175
|
};
|
|
@@ -508,9 +508,9 @@ declare const __VLS_component: import('vue').DefineComponent<SenderProps, {
|
|
|
508
508
|
}>, {
|
|
509
509
|
loading: boolean;
|
|
510
510
|
template: string;
|
|
511
|
-
mode: import('./index.type').InputMode;
|
|
512
511
|
disabled: boolean;
|
|
513
512
|
modelValue: string;
|
|
513
|
+
mode: import('./index.type').InputMode;
|
|
514
514
|
autofocus: boolean;
|
|
515
515
|
clearable: boolean;
|
|
516
516
|
showWordLimit: boolean;
|
|
@@ -519,9 +519,9 @@ declare const __VLS_component: import('vue').DefineComponent<SenderProps, {
|
|
|
519
519
|
allowSpeech: boolean;
|
|
520
520
|
allowFiles: boolean;
|
|
521
521
|
submitType: import('./index.type').SubmitTrigger;
|
|
522
|
+
placeholder: string;
|
|
522
523
|
autoSize: import('./index.type').AutoSize;
|
|
523
524
|
maxLength: number;
|
|
524
|
-
placeholder: string;
|
|
525
525
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
526
526
|
templateEditorRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./index.type').TemplateEditorProps> & Readonly<{
|
|
527
527
|
onInput?: ((value: string) => any) | undefined;
|