ant-design-x-vue 1.2.7 → 1.2.9
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/index.esm.js +8533 -8065
- package/dist/index.esm.min.js +6 -0
- package/dist/index.umd.js +66 -66
- package/es/_util/cssinjs/StyleContext.mjs +48 -42
- package/es/bubble/Bubble.mjs +40 -38
- package/es/bubble/BubbleList.mjs +123 -87
- package/es/bubble/style/list.mjs +18 -5
- package/es/index.mjs +79 -45
- package/es/sender/Sender.mjs +82 -78
- package/es/sender/components/ActionButton/index.mjs +15 -12
- package/es/sender/components/ClearButton.mjs +15 -12
- package/es/sender/components/LoadingButton.mjs +16 -13
- package/es/sender/components/SendButton.mjs +17 -14
- package/es/sender/components/SpeechButton/RecordingIcon.mjs +21 -18
- package/es/sender/components/SpeechButton/index.mjs +31 -25
- package/es/suggestion/Suggestion.mjs +153 -48
- package/es/welcome/Welcome.mjs +44 -36
- package/lib/_util/cssinjs/StyleContext.js +1 -1
- package/lib/bubble/Bubble.js +1 -1
- package/lib/bubble/BubbleList.js +1 -1
- package/lib/bubble/style/list.js +1 -1
- package/lib/index.js +1 -1
- package/lib/sender/Sender.js +1 -1
- package/lib/sender/components/ActionButton/index.js +1 -1
- package/lib/sender/components/ClearButton.js +1 -1
- package/lib/sender/components/LoadingButton.js +1 -1
- package/lib/sender/components/SendButton.js +1 -1
- package/lib/sender/components/SpeechButton/RecordingIcon.js +1 -1
- package/lib/sender/components/SpeechButton/index.js +1 -1
- package/lib/suggestion/Suggestion.js +1 -1
- package/lib/welcome/Welcome.js +1 -1
- package/package.json +3 -2
- package/typings/_util/cssinjs/StyleContext.d.ts +6 -6
- package/typings/_util/cssinjs/index.d.ts +3 -3
- package/typings/bubble/BubbleList.vue.d.ts +47 -1
- package/typings/bubble/hooks/useTypingConfig.d.ts +1 -1
- package/typings/bubble/index.d.ts +65 -3
- package/typings/bubble/interface.d.ts +2 -2
- package/typings/index.d.ts +1 -0
- package/typings/sender/interface.d.ts +6 -0
- package/typings/sender/useSpeech.d.ts +5 -1
- package/typings/welcome/interface.d.ts +4 -4
|
@@ -1,49 +1,52 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as p, createVNode as e, createTextVNode as I } from "vue";
|
|
2
|
+
const n = 1e3, t = 4, r = 140, s = 250, i = 500, c = 0.8, _ = /* @__PURE__ */ p({
|
|
3
3
|
name: "AXSenderRecordingIcon",
|
|
4
4
|
__name: "RecordingIcon",
|
|
5
5
|
props: {
|
|
6
|
-
className: null
|
|
6
|
+
className: null,
|
|
7
|
+
audioIcon: null,
|
|
8
|
+
audioDisabledIcon: null,
|
|
9
|
+
audioRecordingIcon: null
|
|
7
10
|
},
|
|
8
11
|
setup(u) {
|
|
9
|
-
const
|
|
12
|
+
const a = r / 2;
|
|
10
13
|
return () => e("svg", {
|
|
11
14
|
color: "currentColor",
|
|
12
|
-
viewBox: `0 0 ${
|
|
15
|
+
viewBox: `0 0 ${n} ${n}`,
|
|
13
16
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
17
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
15
18
|
class: u.className
|
|
16
|
-
}, [e("title", null, [
|
|
17
|
-
length:
|
|
18
|
-
}).map((
|
|
19
|
-
const m = (
|
|
19
|
+
}, [e("title", null, [I("Speech Recording")]), Array.from({
|
|
20
|
+
length: t
|
|
21
|
+
}).map((T, o) => {
|
|
22
|
+
const m = (n - r * t) / (t - 1), d = o * (m + r), l = n / 2 - s / 2, g = n / 2 - i / 2;
|
|
20
23
|
return e("rect", {
|
|
21
24
|
fill: "currentColor",
|
|
22
|
-
rx:
|
|
23
|
-
ry:
|
|
25
|
+
rx: a,
|
|
26
|
+
ry: a,
|
|
24
27
|
height: s,
|
|
25
28
|
width: r,
|
|
26
|
-
x:
|
|
27
|
-
y:
|
|
29
|
+
x: d,
|
|
30
|
+
y: l,
|
|
28
31
|
key: o
|
|
29
32
|
}, [e("animate", {
|
|
30
33
|
attributeName: "height",
|
|
31
|
-
values: `${s}; ${
|
|
34
|
+
values: `${s}; ${i}; ${s}`,
|
|
32
35
|
keyTimes: "0; 0.5; 1",
|
|
33
36
|
dur: `${c}s`,
|
|
34
|
-
begin: `${c /
|
|
37
|
+
begin: `${c / t * o}s`,
|
|
35
38
|
repeatCount: "indefinite"
|
|
36
39
|
}, null), e("animate", {
|
|
37
40
|
attributeName: "y",
|
|
38
|
-
values: `${
|
|
41
|
+
values: `${l}; ${g}; ${l}`,
|
|
39
42
|
keyTimes: "0; 0.5; 1",
|
|
40
43
|
dur: `${c}s`,
|
|
41
|
-
begin: `${c /
|
|
44
|
+
begin: `${c / t * o}s`,
|
|
42
45
|
repeatCount: "indefinite"
|
|
43
46
|
}, null)]);
|
|
44
47
|
})]);
|
|
45
48
|
}
|
|
46
49
|
});
|
|
47
50
|
export {
|
|
48
|
-
|
|
51
|
+
_ as default
|
|
49
52
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { a as
|
|
3
|
-
import { theme as
|
|
4
|
-
import
|
|
1
|
+
import { defineComponent as r, mergeDefaults as s, computed as i, createVNode as l, mergeProps as m } from "vue";
|
|
2
|
+
import { a as f } from "../../../attachments/Attachments2.mjs";
|
|
3
|
+
import { theme as p } from "ant-design-vue";
|
|
4
|
+
import I from "../ActionButton/index.mjs";
|
|
5
5
|
import { useActionButtonContextInject as g } from "../ActionButton/context.mjs";
|
|
6
|
-
import
|
|
7
|
-
import { j as
|
|
8
|
-
const
|
|
6
|
+
import y from "./RecordingIcon.mjs";
|
|
7
|
+
import { j as b, k as h } from "../../../attachments/FileList/FileList2.mjs";
|
|
8
|
+
const A = /* @__PURE__ */ r({
|
|
9
9
|
name: "AXSenderSpeechButton",
|
|
10
10
|
__name: "index",
|
|
11
|
-
props:
|
|
11
|
+
props: s({
|
|
12
12
|
prefixCls: null,
|
|
13
13
|
type: null,
|
|
14
14
|
htmlType: null,
|
|
@@ -24,36 +24,42 @@ const j = /* @__PURE__ */ c({
|
|
|
24
24
|
target: null,
|
|
25
25
|
title: null,
|
|
26
26
|
onClick: null,
|
|
27
|
-
onMousedown: null
|
|
27
|
+
onMousedown: null,
|
|
28
|
+
audioIcon: null,
|
|
29
|
+
audioDisabledIcon: null,
|
|
30
|
+
audioRecordingIcon: null
|
|
28
31
|
}, {
|
|
29
32
|
type: "text",
|
|
30
|
-
disabled: void 0
|
|
33
|
+
disabled: void 0,
|
|
34
|
+
audioIcon: () => l(h, null, null),
|
|
35
|
+
audioDisabledIcon: () => l(b, null, null),
|
|
36
|
+
audioRecordingIcon: void 0
|
|
31
37
|
}),
|
|
32
|
-
setup(
|
|
33
|
-
const
|
|
34
|
-
token:
|
|
35
|
-
} =
|
|
36
|
-
let
|
|
37
|
-
return
|
|
38
|
-
className: `${
|
|
39
|
-
}, null) :
|
|
38
|
+
setup(e) {
|
|
39
|
+
const t = f(e, ["type", "disabled", "audioIcon", "audioDisabledIcon", "audioRecordingIcon"]), o = g(), {
|
|
40
|
+
token: u
|
|
41
|
+
} = p.useToken(), d = i(() => o.value.speechRecording), a = i(() => o.value.prefixCls), c = i(() => {
|
|
42
|
+
let n;
|
|
43
|
+
return d.value ? n = e.audioRecordingIcon ? e.audioRecordingIcon : l(y, {
|
|
44
|
+
className: `${a.value}-recording-icon`
|
|
45
|
+
}, null) : o.value.onSpeechDisabled ? n = e.audioDisabledIcon : n = e.audioIcon, n;
|
|
40
46
|
});
|
|
41
|
-
return () => l(
|
|
42
|
-
type:
|
|
43
|
-
disabled:
|
|
44
|
-
},
|
|
47
|
+
return () => l(I, m({
|
|
48
|
+
type: e.type,
|
|
49
|
+
disabled: e.disabled
|
|
50
|
+
}, t, {
|
|
45
51
|
style: {
|
|
46
52
|
display: "flex",
|
|
47
53
|
justifyContent: "center",
|
|
48
54
|
alignItems: "center",
|
|
49
|
-
color:
|
|
55
|
+
color: u.value.colorPrimary
|
|
50
56
|
},
|
|
51
57
|
action: "onSpeech"
|
|
52
58
|
}), {
|
|
53
|
-
default: () => [
|
|
59
|
+
default: () => [c.value]
|
|
54
60
|
});
|
|
55
61
|
}
|
|
56
62
|
});
|
|
57
63
|
export {
|
|
58
|
-
|
|
64
|
+
A as default
|
|
59
65
|
};
|
|
@@ -1,16 +1,113 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as
|
|
1
|
+
import { onMounted as W, nextTick as I, getCurrentScope as L, onScopeDispose as G, getCurrentInstance as V, computed as v, shallowRef as y, watch as $, toValue as D, defineComponent as P, mergeDefaults as X, toRef as E, useSlots as H, ref as K, createVNode as A } from "vue";
|
|
2
|
+
import { c as B } from "../attachments/Attachments2.mjs";
|
|
3
3
|
import "../x-provider/index.mjs";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { Cascader as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
4
|
+
import U from "../_util/hooks/use-x-component-config.mjs";
|
|
5
|
+
import j from "./style/index.mjs";
|
|
6
|
+
import k from "../_util/hooks/use-state.mjs";
|
|
7
|
+
import { Cascader as q } from "ant-design-vue";
|
|
8
|
+
import J from "./useActive.mjs";
|
|
9
|
+
import Q from "../x-provider/hooks/use-x-provider-context.mjs";
|
|
10
|
+
function Y(e) {
|
|
11
|
+
return L() ? (G(e), !0) : !1;
|
|
12
|
+
}
|
|
13
|
+
const Z = typeof window < "u" && typeof document < "u";
|
|
14
|
+
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
15
|
+
function _(e) {
|
|
16
|
+
return Array.isArray(e) ? e : [e];
|
|
17
|
+
}
|
|
18
|
+
function ee(e) {
|
|
19
|
+
return V();
|
|
20
|
+
}
|
|
21
|
+
function te(e, n = !0, s) {
|
|
22
|
+
ee() ? W(e, s) : n ? e() : I(e);
|
|
23
|
+
}
|
|
24
|
+
const M = Z ? window : void 0;
|
|
25
|
+
function g(e) {
|
|
26
|
+
var n;
|
|
27
|
+
const s = D(e);
|
|
28
|
+
return (n = s == null ? void 0 : s.$el) != null ? n : s;
|
|
29
|
+
}
|
|
30
|
+
function ne() {
|
|
31
|
+
const e = y(!1), n = V();
|
|
32
|
+
return n && W(() => {
|
|
33
|
+
e.value = !0;
|
|
34
|
+
}, n), e;
|
|
35
|
+
}
|
|
36
|
+
function oe(e) {
|
|
37
|
+
const n = ne();
|
|
38
|
+
return v(() => (n.value, !!e()));
|
|
39
|
+
}
|
|
40
|
+
function se(e, n, s = {}) {
|
|
41
|
+
const { window: a = M, ...c } = s;
|
|
42
|
+
let r;
|
|
43
|
+
const i = oe(() => a && "ResizeObserver" in a), l = () => {
|
|
44
|
+
r && (r.disconnect(), r = void 0);
|
|
45
|
+
}, w = v(() => {
|
|
46
|
+
const t = D(e);
|
|
47
|
+
return Array.isArray(t) ? t.map((u) => g(u)) : [g(t)];
|
|
48
|
+
}), h = $(
|
|
49
|
+
w,
|
|
50
|
+
(t) => {
|
|
51
|
+
if (l(), i.value && a) {
|
|
52
|
+
r = new ResizeObserver(n);
|
|
53
|
+
for (const u of t)
|
|
54
|
+
u && r.observe(u, c);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{ immediate: !0, flush: "post" }
|
|
58
|
+
), m = () => {
|
|
59
|
+
l(), h();
|
|
60
|
+
};
|
|
61
|
+
return Y(m), {
|
|
62
|
+
isSupported: i,
|
|
63
|
+
stop: m
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function ie(e, n = { width: 0, height: 0 }, s = {}) {
|
|
67
|
+
const { window: a = M, box: c = "content-box" } = s, r = v(() => {
|
|
68
|
+
var t, u;
|
|
69
|
+
return (u = (t = g(e)) == null ? void 0 : t.namespaceURI) == null ? void 0 : u.includes("svg");
|
|
70
|
+
}), i = y(n.width), l = y(n.height), { stop: w } = se(
|
|
71
|
+
e,
|
|
72
|
+
([t]) => {
|
|
73
|
+
const u = c === "border-box" ? t.borderBoxSize : c === "content-box" ? t.contentBoxSize : t.devicePixelContentBoxSize;
|
|
74
|
+
if (a && r.value) {
|
|
75
|
+
const f = g(e);
|
|
76
|
+
if (f) {
|
|
77
|
+
const d = f.getBoundingClientRect();
|
|
78
|
+
i.value = d.width, l.value = d.height;
|
|
79
|
+
}
|
|
80
|
+
} else if (u) {
|
|
81
|
+
const f = _(u);
|
|
82
|
+
i.value = f.reduce((d, { inlineSize: C }) => d + C, 0), l.value = f.reduce((d, { blockSize: C }) => d + C, 0);
|
|
83
|
+
} else
|
|
84
|
+
i.value = t.contentRect.width, l.value = t.contentRect.height;
|
|
85
|
+
},
|
|
86
|
+
s
|
|
87
|
+
);
|
|
88
|
+
te(() => {
|
|
89
|
+
const t = g(e);
|
|
90
|
+
t && (i.value = "offsetWidth" in t ? t.offsetWidth : n.width, l.value = "offsetHeight" in t ? t.offsetHeight : n.height);
|
|
91
|
+
});
|
|
92
|
+
const h = $(
|
|
93
|
+
() => g(e),
|
|
94
|
+
(t) => {
|
|
95
|
+
i.value = t ? n.width : 0, l.value = t ? n.height : 0;
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
function m() {
|
|
99
|
+
w(), h();
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
width: i,
|
|
103
|
+
height: l,
|
|
104
|
+
stop: m
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const he = /* @__PURE__ */ P({
|
|
11
108
|
name: "AXSuggestion",
|
|
12
109
|
__name: "Suggestion",
|
|
13
|
-
props:
|
|
110
|
+
props: X({
|
|
14
111
|
prefixCls: null,
|
|
15
112
|
className: null,
|
|
16
113
|
rootClassName: null,
|
|
@@ -39,55 +136,63 @@ const H = /* @__PURE__ */ D({
|
|
|
39
136
|
open: !1
|
|
40
137
|
}),
|
|
41
138
|
setup(e) {
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
direction:
|
|
45
|
-
getPrefixCls:
|
|
46
|
-
} =
|
|
47
|
-
`${
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
139
|
+
E(e, "prefixCls");
|
|
140
|
+
const n = H(), {
|
|
141
|
+
direction: s,
|
|
142
|
+
getPrefixCls: a
|
|
143
|
+
} = Q(), c = v(() => a("suggestion", e.prefixCls));
|
|
144
|
+
`${c.value}`;
|
|
145
|
+
const r = v(() => s.value === "rtl"), i = U("suggestion"), l = K(), [w, h, m] = j(c), {
|
|
146
|
+
width: t
|
|
147
|
+
} = ie(l), u = v(() => {
|
|
148
|
+
if (e.block && t.value)
|
|
149
|
+
return {
|
|
150
|
+
width: `${t.value}px`
|
|
151
|
+
};
|
|
152
|
+
}), [f, d] = k(e.open), [C, T] = k(), p = (o) => {
|
|
153
|
+
var O;
|
|
154
|
+
d(o), (O = e.onOpenChange) == null || O.call(e, o);
|
|
155
|
+
}, b = (o) => {
|
|
156
|
+
o === !1 ? p(!1) : (T(o), p(!0));
|
|
157
|
+
}, S = () => {
|
|
158
|
+
p(!1);
|
|
159
|
+
}, x = v(() => typeof e.items == "function" ? e.items(C.value) : e.items), R = (o) => {
|
|
160
|
+
e.onSelect && e.onSelect(o[o.length - 1]), p(!1);
|
|
161
|
+
}, [z, N] = J(x, f, r, R, S), F = v(() => {
|
|
162
|
+
var o;
|
|
163
|
+
return n.default ? n.default({
|
|
164
|
+
onTrigger: b,
|
|
165
|
+
onKeyDown: N
|
|
166
|
+
}) : (o = e.children) == null ? void 0 : o.call(e, {
|
|
167
|
+
onTrigger: b,
|
|
168
|
+
onKeyDown: N
|
|
65
169
|
});
|
|
66
170
|
});
|
|
67
|
-
return () =>
|
|
68
|
-
options:
|
|
69
|
-
open:
|
|
70
|
-
value:
|
|
71
|
-
placement:
|
|
72
|
-
onDropdownVisibleChange: (
|
|
73
|
-
|
|
171
|
+
return () => w(A(q, {
|
|
172
|
+
options: x.value,
|
|
173
|
+
open: f.value,
|
|
174
|
+
value: z.value,
|
|
175
|
+
placement: r.value ? "topRight" : "topLeft",
|
|
176
|
+
onDropdownVisibleChange: (o) => {
|
|
177
|
+
o || S();
|
|
74
178
|
},
|
|
75
|
-
|
|
76
|
-
[`${
|
|
179
|
+
popupClassName: B(e.rootClassName, c.value, h.value, m, {
|
|
180
|
+
[`${c.value}-block`]: e.block
|
|
77
181
|
}),
|
|
78
|
-
onChange:
|
|
79
|
-
|
|
182
|
+
onChange: R,
|
|
183
|
+
dropdownStyle: u.value
|
|
80
184
|
}, {
|
|
81
|
-
default: () =>
|
|
82
|
-
|
|
185
|
+
default: () => A("div", {
|
|
186
|
+
ref: l,
|
|
187
|
+
class: B(c.value, i.value.className, e.rootClassName, e.className, `${c.value}-wrapper`, h.value, m),
|
|
83
188
|
style: {
|
|
84
189
|
...i.value.style,
|
|
85
190
|
...e.style
|
|
86
191
|
}
|
|
87
|
-
}, [
|
|
192
|
+
}, [F.value])
|
|
88
193
|
}));
|
|
89
194
|
}
|
|
90
195
|
});
|
|
91
196
|
export {
|
|
92
|
-
|
|
197
|
+
he as default
|
|
93
198
|
};
|
package/es/welcome/Welcome.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as $, mergeDefaults as S, toRef as h, useSlots as w, computed as c, createVNode as
|
|
1
|
+
import { defineComponent as $, mergeDefaults as S, toRef as h, useSlots as w, computed as c, createVNode as s, isVNode as F } from "vue";
|
|
2
2
|
import { c as i } from "../attachments/Attachments2.mjs";
|
|
3
3
|
import "../x-provider/index.mjs";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { Typography as
|
|
7
|
-
import
|
|
4
|
+
import V from "../_util/hooks/use-x-component-config.mjs";
|
|
5
|
+
import b from "./style/index.mjs";
|
|
6
|
+
import { Typography as m, Flex as o } from "ant-design-vue";
|
|
7
|
+
import j from "../x-provider/hooks/use-x-provider-context.mjs";
|
|
8
8
|
function T(e) {
|
|
9
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
9
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !F(e);
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const I = /* @__PURE__ */ $({
|
|
12
12
|
name: "AXWelcome",
|
|
13
13
|
__name: "Welcome",
|
|
14
14
|
props: S({
|
|
@@ -19,10 +19,18 @@ const F = /* @__PURE__ */ $({
|
|
|
19
19
|
variant: null,
|
|
20
20
|
classNames: null,
|
|
21
21
|
styles: null,
|
|
22
|
-
icon:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
icon: {
|
|
23
|
+
type: Function
|
|
24
|
+
},
|
|
25
|
+
title: {
|
|
26
|
+
type: Function
|
|
27
|
+
},
|
|
28
|
+
description: {
|
|
29
|
+
type: Function
|
|
30
|
+
},
|
|
31
|
+
extra: {
|
|
32
|
+
type: Function
|
|
33
|
+
}
|
|
26
34
|
}, {
|
|
27
35
|
variant: "filled",
|
|
28
36
|
classNames: () => ({}),
|
|
@@ -30,54 +38,54 @@ const F = /* @__PURE__ */ $({
|
|
|
30
38
|
}),
|
|
31
39
|
setup(e) {
|
|
32
40
|
h(e, "prefixCls");
|
|
33
|
-
const
|
|
41
|
+
const n = w(), {
|
|
34
42
|
direction: d,
|
|
35
|
-
getPrefixCls:
|
|
36
|
-
} =
|
|
37
|
-
const t =
|
|
43
|
+
getPrefixCls: y
|
|
44
|
+
} = j(), l = y("welcome", e.prefixCls), a = V("welcome"), [x, v, N] = b(l), C = c(() => {
|
|
45
|
+
const t = n.icon ? n.icon() : typeof e.icon == "function" ? e.icon() : e.icon;
|
|
38
46
|
if (!t)
|
|
39
47
|
return null;
|
|
40
|
-
let
|
|
41
|
-
return typeof t == "string" && t.startsWith("http") && (
|
|
48
|
+
let f = t;
|
|
49
|
+
return typeof t == "string" && t.startsWith("http") && (f = s("img", {
|
|
42
50
|
src: t,
|
|
43
51
|
alt: "icon"
|
|
44
|
-
}, null)),
|
|
45
|
-
class: i(`${l}-icon`,
|
|
52
|
+
}, null)), s("div", {
|
|
53
|
+
class: i(`${l}-icon`, a.value.classNames.icon, e.classNames.icon),
|
|
46
54
|
style: e.styles.icon
|
|
47
|
-
}, [
|
|
48
|
-
}),
|
|
49
|
-
const t =
|
|
50
|
-
return t ?
|
|
55
|
+
}, [f]);
|
|
56
|
+
}), r = c(() => {
|
|
57
|
+
const t = n.title ? n.title() : typeof e.title == "function" ? e.title() : e.title;
|
|
58
|
+
return t ? s(m.Title, {
|
|
51
59
|
level: 4,
|
|
52
|
-
class: i(`${l}-title`,
|
|
60
|
+
class: i(`${l}-title`, a.value.classNames.title, e.classNames.title),
|
|
53
61
|
style: e.styles.title
|
|
54
62
|
}, T(t) ? t : {
|
|
55
63
|
default: () => [t]
|
|
56
64
|
}) : null;
|
|
57
|
-
}), u = c(() =>
|
|
58
|
-
const t =
|
|
59
|
-
return t ?
|
|
60
|
-
class: i(`${l}-extra`,
|
|
65
|
+
}), u = c(() => n.description ? n.description() : typeof e.description == "function" ? e.description() : e.description), g = c(() => {
|
|
66
|
+
const t = n.extra ? n.extra() : typeof e.extra == "function" ? e.extra() : e.extra;
|
|
67
|
+
return t ? s("div", {
|
|
68
|
+
class: i(`${l}-extra`, a.value.classNames.extra, e.classNames.extra),
|
|
61
69
|
style: e.styles.extra
|
|
62
70
|
}, [t]) : null;
|
|
63
71
|
});
|
|
64
|
-
return () =>
|
|
65
|
-
class: i(l,
|
|
72
|
+
return () => x(s(o, {
|
|
73
|
+
class: i(l, a.value.className, e.className, e.rootClassName, v.value, N, `${l}-${e.variant}`, {
|
|
66
74
|
[`${l}-rtl`]: d.value === "rtl"
|
|
67
75
|
}),
|
|
68
76
|
style: e.style
|
|
69
77
|
}, {
|
|
70
|
-
default: () => [C.value,
|
|
78
|
+
default: () => [C.value, s(o, {
|
|
71
79
|
vertical: !0,
|
|
72
80
|
class: `${l}-content-wrapper`
|
|
73
81
|
}, {
|
|
74
|
-
default: () => [
|
|
82
|
+
default: () => [n.extra || e.extra ? s(o, {
|
|
75
83
|
align: "flex-start",
|
|
76
84
|
class: `${l}-title-wrapper`
|
|
77
85
|
}, {
|
|
78
|
-
default: () => [
|
|
79
|
-
}) :
|
|
80
|
-
class: i(`${l}-description`,
|
|
86
|
+
default: () => [r.value, g.value]
|
|
87
|
+
}) : r.value, u.value && s(m.Text, {
|
|
88
|
+
class: i(`${l}-description`, a.value.classNames.description, e.classNames.description),
|
|
81
89
|
style: e.styles.description
|
|
82
90
|
}, {
|
|
83
91
|
default: () => [u.value]
|
|
@@ -87,5 +95,5 @@ const F = /* @__PURE__ */ $({
|
|
|
87
95
|
}
|
|
88
96
|
});
|
|
89
97
|
export {
|
|
90
|
-
|
|
98
|
+
I as default
|
|
91
99
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),T=require("./Cache.js"),c=require("../type.js"),A="data-token-hash",d="data-css-hash",
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),T=require("./Cache.js"),c=require("../type.js"),A=require("ant-design-vue"),m="data-token-hash",d="data-css-hash",P="data-cache-path",u="__cssinjs_instance__";function l(){const e=Math.random().toString(12).slice(2);if(typeof document<"u"&&document.head&&document.body){const n=document.body.querySelectorAll(`style[${d}]`)||[],{firstChild:o}=document.head;Array.from(n).forEach(t=>{t[u]=t[u]||e,t[u]===e&&document.head.insertBefore(t,o)});const r={};Array.from(document.querySelectorAll(`style[${d}]`)).forEach(t=>{var i;const s=t.getAttribute(d);r[s]?t[u]===e&&((i=t.parentNode)==null||i.removeChild(t)):r[s]=!0})}return new T.default(e)}const f=Symbol("StyleContextKey"),g=()=>{var o,r,t;const e=a.getCurrentInstance();let n;if(e&&e.appContext){const s=(t=(r=(o=e.appContext)==null?void 0:o.config)==null?void 0:r.globalProperties)==null?void 0:t.__ANTDV_CSSINJS_CACHE__;s?n=s:(n=l(),e.appContext.config.globalProperties&&(e.appContext.config.globalProperties.__ANTDV_CSSINJS_CACHE__=n))}else n=l();return n},C={cache:l(),defaultCache:!0,hashPriority:"low"},h=()=>{const e=g();return a.inject(f,a.shallowRef({...C,cache:e}))},_=e=>{const n=h(),o=a.shallowRef({...C,cache:l()});return a.watch([()=>a.unref(e),n],()=>{const r={...n.value},t=a.unref(e);Object.keys(t).forEach(i=>{const p=t[i];t[i]!==void 0&&(r[i]=p)});const{cache:s}=t;r.cache=r.cache||l(),r.defaultCache=!s&&n.value.defaultCache,o.value=r},{immediate:!0}),a.provide(f,o),o},y=()=>({autoClear:c.booleanType(),mock:c.stringType(),cache:c.objectType(),defaultCache:c.booleanType(),hashPriority:c.stringType(),container:c.someType(),ssrInline:c.booleanType(),transformers:c.arrayType(),linters:c.arrayType()}),S=c.withInstall(a.defineComponent({name:"AXStyleProvider",inheritAttrs:!1,props:y(),setup(e,{slots:n}){return _(e),()=>a.h(A.StyleProvider,e,()=>{var o;return(o=n.default)==null?void 0:o.call(n)})}})),v={useStyleInject:h,useStyleProvider:_,StyleProvider:S};exports.ATTR_CACHE_PATH=P;exports.ATTR_MARK=d;exports.ATTR_TOKEN=m;exports.CSS_IN_JS_INSTANCE=u;exports.StyleProvider=S;exports.createCache=l;exports.default=v;exports.styleProviderProps=y;exports.useStyleInject=h;exports.useStyleProvider=_;
|
package/lib/bubble/Bubble.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),k=require("../attachments/Attachments2.js"),B=require("ant-design-vue"),E=require("../_util/hooks/use-x-component-config.js");require("../x-provider/index.js");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),k=require("../attachments/Attachments2.js"),B=require("ant-design-vue"),E=require("../_util/hooks/use-x-component-config.js");require("../x-provider/index.js");const F=require("./hooks/useTypedEffect.js"),I=require("./hooks/useTypingConfig.js"),X=require("./loading.js"),j=require("./style/index.js"),D=require("./context.js"),M=require("../x-provider/hooks/use-x-provider-context.js"),H=t.defineComponent({name:"AXBubble",__name:"Bubble",props:t.mergeDefaults({prefixCls:null,rootClassName:null,styles:null,classNames:null,avatar:{type:Function},placement:null,loading:{type:Boolean},typing:null,content:null,messageRender:{type:Function},loadingRender:{type:Function},variant:null,shape:null,onTypingComplete:null,header:null,footer:null},{classNames:()=>({}),styles:()=>({}),placement:"start",loading:!1,content:"",variant:"filled"}),setup(e,{expose:g}){const y=k.createPropsRestProxy(e,["prefixCls","rootClassName","classNames","styles","avatar","placement","loading","loadingRender","typing","content","messageRender","variant","shape","onTypingComplete","header","footer"]);t.toRef(e,"content"),t.toRef(e,"prefixCls");const n=t.useSlots(),f=t.ref(e.content);t.watch(()=>e.content,()=>{f.value=e.content});const{onUpdate:r}=t.unref(D.useBubbleContextInject()),v=t.ref(null),{direction:b,getPrefixCls:h}=M.default(),a=h("bubble",e.prefixCls),l=E.default("bubble"),[N,C,V,m]=I.default(()=>e.typing),[s,u]=F.default(f,N,C,V),c=t.ref(!1);t.watch(s,()=>{r==null||r()}),t.watchEffect(()=>{var o;!u.value&&!e.loading?c.value||(c.value=!0,(o=e.onTypingComplete)==null||o.call(e)):c.value=!1});const[x,R,$]=j.default(()=>a),q=t.computed(()=>[a,e.rootClassName,l.value.className,R.value,$,`${a}-${e.placement}`,{[`${a}-rtl`]:b.value==="rtl"},{[`${a}-typing`]:u.value&&!e.loading&&!e.messageRender&&!n.message&&!m.value}]),P=o=>Array.isArray(o)&&o.every(t.isVNode),T=t.computed(()=>n.avatar?n.avatar():typeof e.avatar=="function"?e.avatar():t.isVNode(e.avatar)||P(e.avatar)?e.avatar:t.createVNode(B.Avatar,e.avatar,null)),S=t.computed(()=>n.message?n.message({content:s.value}):e.messageRender?e.messageRender(s.value):s.value),A=t.computed(()=>e.loading?n.loading?n.loading():e.loadingRender?e.loadingRender():t.createVNode(X.default,{prefixCls:a},null):t.createVNode(t.Fragment,null,[S.value,u.value&&t.toValue(m)])),w=t.computed(()=>{const o=t.createVNode("div",{style:{...l.value.styles.content,...e.styles.content},class:[`${a}-content`,`${a}-content-${e.variant}`,{[`${a}-content-${e.shape}`]:e.shape},l.value.classNames.content,e.classNames.content]},[t.toValue(A)]),i=n.header?n.header({content:s.value}):typeof e.header=="function"?e.header(s.value):e.header,d=n.footer?n.footer({content:s.value}):typeof e.footer=="function"?e.footer(s.value):e.footer;return i||d?t.createVNode("div",{class:`${a}-content-wrapper`},[i&&t.createVNode("div",{class:[`${a}-header`,l.value.classNames.header,e.classNames.header],style:{...l.value.styles.header,...e.styles.header}},[i]),o,d&&t.createVNode("div",{class:[`${a}-footer`,l.value.classNames.footer,e.classNames.footer],style:{...l.value.styles.footer,...e.styles.footer}},[d])]):o});return g({nativeElement:v}),()=>x(t.createVNode("div",t.mergeProps({style:{...l.value.style},class:t.toValue(q)},y,{ref:v}),[(n.avatar||e.avatar)&&t.createVNode("div",{style:{...l.value.styles.avatar,...e.styles.avatar},class:[`${a}-avatar`,l.value.classNames.avatar,e.classNames.avatar]},[t.toValue(T)]),t.toValue(w)]))}});exports.default=H;
|
package/lib/bubble/BubbleList.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),p=require("../attachments/Attachments2.js"),k=require("../_util/hooks/use-event-callback.js"),y=require("../_util/pick-attrs.js");require("../x-provider/index.js");const z=require("./Bubble.js"),O=require("./hooks/useDisplayData.js"),X=require("./hooks/useListData.js"),$=require("./style/index.js"),g=require("../_util/hooks/use-state.js"),j=require("./context.js"),K=require("../x-provider/hooks/use-x-provider-context.js"),W=1,F=e.defineComponent({name:"AXBubbleList",inheritAttrs:!1,__name:"BubbleList",props:e.mergeDefaults({prefixCls:null,rootClassName:null,items:null,autoScroll:{type:Boolean},roles:null},{autoScroll:!0}),setup(s,{expose:E}){const I=p.createPropsRestProxy(s,["prefixCls","rootClassName","items","autoScroll","roles"]);e.toRef(s,"roles"),e.toRef(s,"items"),e.toRef(s,"prefixCls");const V=e.useAttrs(),n=e.useSlots(),w=e.computed(()=>y.default(e.mergeProps(I,V),{attr:!0,aria:!0})),v=e.ref(s.items),C=e.ref(s.roles);e.watch(()=>s.items,()=>{v.value=s.items}),e.watch(()=>s.roles,()=>{C.value=s.roles});const i=e.ref(null),d=e.ref({}),{getPrefixCls:N}=K.default(),x=N("bubble",s.prefixCls),S=`${x}-list`,[T,A,D]=$.default(x),[b,P]=g.default(!1);e.watchEffect(()=>{P(!0),e.onWatcherCleanup(()=>{P(!1)})});const B=X.default(v,C),[c,_]=O.default(B),[R,m]=g.default(!0),[h,q]=g.default(0),L=t=>{const r=t.target;m(r.scrollHeight-Math.abs(r.scrollTop)-r.clientHeight<=W)};e.watch(h,()=>{s.autoScroll&&e.unref(i)&&e.unref(R)&&e.nextTick(()=>{e.unref(i).scrollTo({top:e.unref(i).scrollHeight})})}),e.watch(()=>e.unref(c).length,()=>{var t;if(s.autoScroll){const r=(t=e.unref(c)[e.unref(c).length-2])==null?void 0:t.key,o=e.unref(d)[r];if(o){const{nativeElement:a}=o,{top:u=0,bottom:f=0}=(a==null?void 0:a.getBoundingClientRect())??{},{top:l,bottom:U}=e.unref(i).getBoundingClientRect();u<U&&f>l&&(q(e.unref(h)+1),m(!0))}}});const H=k.useEventCallback(()=>{s.autoScroll&&q(e.unref(h)+1)}),M=e.computed(()=>({onUpdate:H}));return E({nativeElement:i,scrollTo:({key:t,offset:r,behavior:o="smooth",block:a})=>{if(typeof r=="number")e.unref(i).scrollTo({top:r,behavior:o});else if(t!==void 0){const u=e.unref(d)[t];if(u){const f=e.unref(c).findIndex(l=>l.key===t);m(f===e.unref(c).length-1),u.nativeElement.scrollIntoView({behavior:o,block:a})}}}}),()=>T(e.createVNode(j.BubbleContextProvider,{value:M.value},{default:()=>[e.createVNode("div",e.mergeProps(w.value,{class:p.classnames(S,s.rootClassName,A.value,D,{[`${S}-reach-end`]:R.value}),ref:i,onScroll:L}),[e.unref(c).map(({key:t,onTypingComplete:r,...o})=>{var a,u,f;return e.createVNode(z.default,e.mergeProps(o,{avatar:n.avatar?()=>{var l;return(l=n.avatar)==null?void 0:l.call(n,{item:{key:t,...o}})}:o.avatar,header:((a=n.header)==null?void 0:a.call(n,{item:{key:t,...o}}))??o.header,footer:((u=n.footer)==null?void 0:u.call(n,{item:{key:t,...o}}))??o.footer,loadingRender:n.loading?()=>n.loading({item:{key:t,...o}}):o.loadingRender,content:((f=n.message)==null?void 0:f.call(n,{item:{key:t,...o}}))??o.content,key:t,ref:l=>{l?d.value[t]=l:delete d.value[t]},typing:b.value?o.typing:!1,onTypingComplete:()=>{r==null||r(),_(t)}}),null)})])]}))}});exports.default=F;
|
package/lib/bubble/style/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=r=>{const{componentCls:e,padding:o}=r;return{[`${e}-list`]:{display:"flex",flexDirection:"column",gap:o,overflowY:"auto","&::-webkit-scrollbar":{width:8,backgroundColor:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:r.colorTextTertiary,borderRadius:r.borderRadiusSM},"&":{scrollbarWidth:"thin",scrollbarColor:`${r.colorTextTertiary} transparent`}}}};exports.default=l;
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./components.ts2.js"),i=require("./_util/cssinjs/index.js"),a=require("./x-stream/x-stream.js"),d=require("./x-request/x-fetch.js"),f=require("./x-request/x-request.js"),n=require("./use-x-agent/use-x-agent.js"),m=require("./use-x-chat/use-x-chat.js"),q=require("ant-design-vue"),h=require("./x-provider/index2.js"),u=require("./x-provider/hooks/use-x-provider-context.js"),S=require("./bubble/BubbleList.js"),g=require("./conversations/Conversations.js"),x=require("./welcome/Welcome.js"),y=require("./prompts/Prompts.js"),C=require("./suggestion/Suggestion.js"),P=require("./thought-chain/ThoughtChain.js"),j=require("./_util/cssinjs/theme/Theme.js"),b=require("./_util/cssinjs/theme/createTheme.js"),o=require("./_util/cssinjs/hooks/useStyleRegister/index.tsx2.js"),p=require("./_util/cssinjs/hooks/useCacheToken.tsx2.js"),v=require("./_util/cssinjs/Keyframes.js"),X=require("./_util/cssinjs/transformers/legacyLogicalProperties.js"),T=require("./_util/cssinjs/transformers/px2rem.js"),k=require("./_util/cssinjs/linters/logicalPropertiesLinter.js"),L=require("./_util/cssinjs/linters/legacyNotSelectorLinter.js"),R=require("./_util/cssinjs/linters/parentSelectorLinter.js"),A=require("./_util/cssinjs/hooks/useCSSVarRegister.js"),V=require("./bubble/index.js"),B=require("./sender/index.js"),O=require("./attachments/index.js"),e=require("./_util/cssinjs/StyleContext.js"),_=require("./_util/cssinjs/util.js"),l=function(t){return Object.keys(r.components).forEach(c=>{const s=r.components[c];s.install&&t.use(s)}),t.use(i.default.StyleProvider),t},F={install:l};exports._experimental=i._experimental;exports.XStream=a.default;exports.XFetch=d.default;exports.XRequest=f.default;exports.XAgent=n.XAgent;exports.useXAgent=n.default;exports.useXChat=m.default;Object.defineProperty(exports,"theme",{enumerable:!0,get:()=>q.theme});exports.XProvider=h._sfc_main;exports.defaultPrefixCls=u.defaultPrefixCls;exports.useXProviderContext=u.default;exports.BubbleList=S.default;exports.Conversations=g.default;exports.Welcome=x.default;exports.Prompts=y.default;exports.Suggestion=C.default;exports.ThoughtChain=P.default;exports.Theme=j.default;exports.createTheme=b.default;exports.extractStyle=o.extractStyle;exports.useStyleRegister=o.useStyleRegister;exports.useCacheToken=p.useCacheToken;exports.Keyframes=v.default;exports.legacyLogicalPropertiesTransformer=X.default;exports.px2remTransformer=T.default;exports.logicalPropertiesLinter=k.default;exports.legacyNotSelectorLinter=L.default;exports.parentSelectorLinter=R.default;exports.useCSSVarRegister=A.default;exports.Bubble=V.default;exports.Sender=B.default;exports.Attachments=O.default;exports.StyleProvider=e.StyleProvider;exports.createCache=e.createCache;exports.useStyleInject=e.useStyleInject;exports.useStyleProvider=e.useStyleProvider;exports.token2CSSVar=_.token2CSSVar;exports.unit=_.unit;exports.default=F;exports.install=l;
|
package/lib/sender/Sender.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),i=require("../attachments/Attachments2.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),i=require("../attachments/Attachments2.js"),w=require("ant-design-vue"),_=require("../_util/pick-attrs.js"),ee=require("../_util/hooks/use-x-component-config.js");require("../x-provider/index.js");const te=require("./context.js"),ne=require("./components/ActionButton/context.js"),ae=require("./components/ClearButton.js"),B=require("./components/LoadingButton.js"),q=require("./components/SendButton.js"),D=require("./components/SpeechButton/index.js"),le=require("./style/index.js"),oe=require("./useSpeech.js"),se=require("../_util/getValue.js"),ue=require("../x-provider/hooks/use-x-provider-context.js"),ce=n.defineComponent({name:"AXSender",__name:"Sender",props:n.mergeDefaults({onKeyPress:{type:Function},onFocus:null,onBlur:null,prefixCls:null,defaultValue:null,value:null,loading:{type:Boolean},placeholder:null,readOnly:{type:Boolean},submitType:{type:[String,Boolean]},disabled:{type:Boolean},onSubmit:{type:Function},onChange:{type:Function},onCancel:null,onKeyDown:{type:Function},onPaste:{type:Function},onPasteFile:{type:Function},components:null,styles:null,rootClassName:null,classNames:null,style:null,className:null,actions:{type:[Function,Boolean]},allowSpeech:null,prefix:{type:Function},footer:{type:Function},header:{type:Function},autoSize:null},{styles:()=>({}),classNames:()=>({}),submitType:"enter",actions:void 0,disabled:void 0,autoSize:()=>({maxRows:8})}),emits:["update:value"],setup(e,{expose:F,emit:I}){const $=i.createPropsRestProxy(e,["prefixCls","styles","classNames","className","rootClassName","style","defaultValue","value","placeholder","readOnly","submitType","onSubmit","loading","components","onCancel","onChange","actions","onKeyPress","onKeyDown","disabled","allowSpeech","prefix","footer","header","onPaste","onPasteFile","autoSize"]);n.toRef(e,"prefixCls");function K(t,a,c){return se.default(t,a)||c}const d={SendButton:q.default,ClearButton:ae.default,LoadingButton:B.default,SpeechButton:D.default},R=I,s=n.useSlots(),{direction:A,getPrefixCls:T}=ue.default(),l=n.computed(()=>T("sender",e.prefixCls)),f=n.ref(null),r=n.ref(null),o=ee.default("sender"),C=n.computed(()=>`${l.value}-input`),[k,z,E]=le.default(l.value),O=n.computed(()=>i.classnames(l.value,o.value.className,e.className,e.rootClassName,z.value,E,{[`${l.value}-rtl`]:A.value==="rtl",[`${l.value}-disabled`]:e.disabled})),M=n.computed(()=>`${l.value}-actions-btn`),h=n.computed(()=>`${l.value}-actions-list`),u=n.ref(e.value??e.defaultValue??""),g=t=>{u.value=t};n.watch(()=>e.value,()=>{g(e.value)});const v=(t,a)=>{g(t),R("update:value",t),e.onChange&&e.onChange(t,a)},{speechPermission:L,triggerSpeech:S,recording:X}=oe.default(t=>{v(`${u.value} ${t}`)},()=>e.allowSpeech),j=K(e.components,["input"],w.Input.TextArea),p=n.computed(()=>_.default($,{attr:!0,aria:!0,data:!0})),H=n.computed(()=>({...p.value,ref:r})),m=()=>{u.value&&e.onSubmit&&!e.loading&&e.onSubmit(u.value)},G=()=>{v("")},y=n.ref(!1),J=()=>{y.value=!0},Q=()=>{y.value=!1},U=t=>{const a=t.key==="Enter"&&!y.value;switch(e.submitType){case"enter":a&&!t.shiftKey&&(t.preventDefault(),m());break;case"shiftEnter":a&&t.shiftKey&&(t.preventDefault(),m());break}e.onKeyPress&&e.onKeyPress(t)},W=t=>{var c,V;const a=(c=t.clipboardData)==null?void 0:c.files;a!=null&&a.length&&e.onPasteFile&&(e.onPasteFile(a[0],a),t.preventDefault()),(V=e.onPaste)==null||V.call(e,t)},Y=t=>{var a,c;t.target!==((a=f.value)==null?void 0:a.querySelector(`.${C.value}`))&&t.preventDefault(),(c=r.value)==null||c.focus()},x=n.computed(()=>{let t=n.createVNode(w.Flex,{class:`${h.value}-presets`},{default:()=>[e.allowSpeech&&n.createVNode(D.default,typeof e.allowSpeech=="object"?{audioIcon:e.allowSpeech.audioIcon,audioDisabledIcon:e.allowSpeech.audioDisabledIcon,audioRecordingIcon:e.allowSpeech.audioRecordingIcon}:{},null),e.loading?n.createVNode(B.default,null,null):n.createVNode(q.default,null,null)]});const a={components:d};return s.actions?t=s.actions({ori:t,info:a}):typeof e.actions=="function"?t=e.actions(t,a):(e.actions||e.actions===!1)&&(t=e.actions),t}),Z=n.computed(()=>({prefixCls:M.value,onSend:m,onSendDisabled:!u.value,onClear:G,onClearDisabled:!u.value,onCancel:e.onCancel,onCancelDisabled:!e.loading,onSpeech:()=>S(!1),onSpeechDisabled:!L.value,speechRecording:X.value,disabled:e.disabled})),b=n.computed(()=>{let t=null;const a={components:d};return s.footer?t=s.footer({info:a}):typeof e.footer=="function"?t=e.footer({components:d}):e.footer&&(t=e.footer),t}),N=n.computed(()=>s.header?s.header():typeof e.header=="function"?e.header():e.header),P=n.computed(()=>s.prefix?s.prefix():typeof e.prefix=="function"?e.prefix():e.prefix);return F({nativeElement:f.value,focus:t=>{var a;return(a=r.value)==null?void 0:a.focus(t)},blur:()=>{var t;return(t=r.value)==null?void 0:t.blur()}}),()=>k(n.createVNode("div",{ref:f,class:O.value,style:{...o.value.style,...e.style}},[N.value&&n.createVNode(te.SenderHeaderContextProvider,{value:{prefixCls:l.value}},{default:()=>[N.value]}),n.createVNode(ne.ActionButtonContextProvider,{value:Z.value},{default:()=>[n.createVNode("div",{class:`${l.value}-content`,onMousedown:Y},[P.value&&n.createVNode("div",{class:i.classnames(`${l.value}-prefix`,o.value.classNames.prefix,e.classNames.prefix),style:{...o.value.styles.prefix,...e.styles.prefix}},[P.value]),n.createVNode(j,n.mergeProps(H.value,{disabled:e.disabled,style:{...o.value.styles.input,...e.styles.input},class:i.classnames(C.value,o.value.classNames.input,e.classNames.input),autoSize:e.autoSize,value:u.value,onChange:t=>{v(t.target.value,t),S(!0)},onPressEnter:U,onCompositionstart:J,onCompositionend:Q,onKeydown:e.onKeyDown,placeholder:e.placeholder,onPaste:W,bordered:!1,readOnly:e.readOnly}),null),x.value&&n.createVNode("div",{class:i.classnames(h.value,o.value.classNames.actions,e.classNames.actions),style:{...o.value.styles.actions,...e.styles.actions}},[x.value])]),b.value&&n.createVNode("div",{class:i.classnames(`${l.value}-footer`,o.value.classNames.footer,e.classNames.footer),style:{...o.value.styles.footer,...e.styles.footer}},[b.value])]})]))}});exports.default=ce;
|