ant-design-x-vue 1.3.1 → 1.3.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/index.esm.js +283 -281
- package/dist/index.esm.min.js +2 -2
- package/dist/index.umd.js +2 -2
- package/es/attachments/FileList/FileList.mjs +46 -48
- package/es/suggestion/Suggestion.mjs +42 -38
- package/lib/attachments/FileList/FileList.js +1 -1
- package/lib/suggestion/Suggestion.js +1 -1
- package/package.json +2 -1
- package/typings/use-x-agent/use-x-agent.d.ts +1 -1
|
@@ -1,90 +1,88 @@
|
|
|
1
|
-
import { defineComponent as $, computed as b, useTemplateRef as x, watchEffect as
|
|
2
|
-
import { b as v, P as
|
|
1
|
+
import { defineComponent as $, computed as b, useTemplateRef as x, watchEffect as L, onWatcherCleanup as R, watch as y, nextTick as P, createVNode as t, Fragment as E } from "vue";
|
|
2
|
+
import { b as v, P as N, L as p, R as T } from "../../chunks/module-chunk.mjs";
|
|
3
3
|
import { Button as s } from "ant-design-vue";
|
|
4
|
-
import
|
|
4
|
+
import a from "../../_util/hooks/use-state.mjs";
|
|
5
5
|
import { useAttachmentContextInject as k } from "../context.mjs";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import O from "../SilentUploader.mjs";
|
|
7
|
+
import A from "./FileListCard.mjs";
|
|
8
8
|
const d = 1, I = /* @__PURE__ */ $({
|
|
9
9
|
name: "AXAttachmentsFileList",
|
|
10
10
|
__name: "FileList",
|
|
11
11
|
props: {
|
|
12
|
-
prefixCls:
|
|
13
|
-
items:
|
|
14
|
-
onRemove: {
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
itemClassName: null,
|
|
23
|
-
itemStyle: null
|
|
12
|
+
prefixCls: {},
|
|
13
|
+
items: {},
|
|
14
|
+
onRemove: {},
|
|
15
|
+
overflow: {},
|
|
16
|
+
upload: {},
|
|
17
|
+
imageProps: {},
|
|
18
|
+
listClassName: {},
|
|
19
|
+
listStyle: {},
|
|
20
|
+
itemClassName: {},
|
|
21
|
+
itemStyle: {}
|
|
24
22
|
},
|
|
25
|
-
setup(
|
|
26
|
-
const n = b(() => `${
|
|
27
|
-
|
|
28
|
-
c(!0),
|
|
23
|
+
setup(e) {
|
|
24
|
+
const n = b(() => `${e.prefixCls}-list`), i = x("file-list-container"), [F, c] = a(!1), h = k();
|
|
25
|
+
L(() => {
|
|
26
|
+
c(!0), R(() => {
|
|
29
27
|
c(!1);
|
|
30
28
|
});
|
|
31
29
|
});
|
|
32
|
-
const [g, r] =
|
|
33
|
-
const
|
|
34
|
-
|
|
30
|
+
const [g, r] = a(!1), [C, f] = a(!1), m = () => {
|
|
31
|
+
const l = i.value;
|
|
32
|
+
l && (e.overflow === "scrollX" ? (r(Math.abs(l.scrollLeft) >= d), f(l.scrollWidth - l.clientWidth - Math.abs(l.scrollLeft) >= d)) : e.overflow === "scrollY" && (r(l.scrollTop !== 0), f(l.scrollHeight - l.clientHeight !== l.scrollTop)));
|
|
35
33
|
};
|
|
36
|
-
|
|
34
|
+
y([() => e.overflow, () => e.items.length], () => {
|
|
37
35
|
P(() => {
|
|
38
|
-
|
|
36
|
+
m();
|
|
39
37
|
});
|
|
40
38
|
}, {
|
|
41
39
|
immediate: !0
|
|
42
40
|
});
|
|
43
|
-
const
|
|
44
|
-
const o =
|
|
41
|
+
const u = (l) => {
|
|
42
|
+
const o = i.value;
|
|
45
43
|
o && o.scrollTo({
|
|
46
|
-
left: o.scrollLeft +
|
|
44
|
+
left: o.scrollLeft + l * o.clientWidth,
|
|
47
45
|
behavior: "smooth"
|
|
48
46
|
});
|
|
49
47
|
}, w = () => {
|
|
50
|
-
|
|
48
|
+
u(-1);
|
|
51
49
|
}, S = () => {
|
|
52
|
-
|
|
50
|
+
u(1);
|
|
53
51
|
};
|
|
54
52
|
return () => t("div", {
|
|
55
53
|
class: v(n.value, {
|
|
56
|
-
[`${n.value}-overflow-${
|
|
54
|
+
[`${n.value}-overflow-${e.overflow}`]: e.overflow,
|
|
57
55
|
[`${n.value}-overflow-ping-start`]: g.value,
|
|
58
56
|
[`${n.value}-overflow-ping-end`]: C.value
|
|
59
|
-
},
|
|
57
|
+
}, e.listClassName),
|
|
60
58
|
ref: "file-list-container",
|
|
61
|
-
onScroll:
|
|
62
|
-
style:
|
|
63
|
-
}, [
|
|
64
|
-
key:
|
|
65
|
-
prefixCls:
|
|
66
|
-
item:
|
|
67
|
-
onRemove:
|
|
68
|
-
className: v(
|
|
69
|
-
imageProps:
|
|
59
|
+
onScroll: m,
|
|
60
|
+
style: e.listStyle
|
|
61
|
+
}, [e.items.map((l) => t(A, {
|
|
62
|
+
key: l.uid,
|
|
63
|
+
prefixCls: e.prefixCls,
|
|
64
|
+
item: l,
|
|
65
|
+
onRemove: e.onRemove,
|
|
66
|
+
className: v(e.itemClassName),
|
|
67
|
+
imageProps: e.imageProps,
|
|
70
68
|
style: {
|
|
71
|
-
...
|
|
69
|
+
...e.itemStyle
|
|
72
70
|
}
|
|
73
|
-
}, null)), !h.value.disabled && t(
|
|
74
|
-
upload:
|
|
71
|
+
}, null)), !h.value.disabled && t(O, {
|
|
72
|
+
upload: e.upload,
|
|
75
73
|
children: t(s, {
|
|
76
74
|
class: `${n.value}-upload-btn`,
|
|
77
75
|
type: "dashed"
|
|
78
76
|
}, {
|
|
79
|
-
default: () => [t(
|
|
77
|
+
default: () => [t(N, {
|
|
80
78
|
class: `${n.value}-upload-btn-icon`
|
|
81
79
|
}, null)]
|
|
82
80
|
})
|
|
83
|
-
}, null),
|
|
81
|
+
}, null), e.overflow === "scrollX" && t(E, null, [t(s, {
|
|
84
82
|
size: "small",
|
|
85
83
|
shape: "circle",
|
|
86
84
|
class: `${n.value}-prev-btn`,
|
|
87
|
-
icon: t(
|
|
85
|
+
icon: t(p, null, null),
|
|
88
86
|
onClick: w
|
|
89
87
|
}, null), t(s, {
|
|
90
88
|
size: "small",
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { q as
|
|
1
|
+
import { defineComponent as D, mergeDefaults as L, toRef as X, useSlots as p, computed as l, ref as B, watch as I, createVNode as N } from "vue";
|
|
2
|
+
import { q as P, b as w } from "../chunks/module-chunk.mjs";
|
|
3
3
|
import "../x-provider/index.mjs";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { Cascader as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
const
|
|
4
|
+
import T from "../_util/hooks/use-x-component-config.mjs";
|
|
5
|
+
import q from "./style/index.mjs";
|
|
6
|
+
import x from "../_util/hooks/use-state.mjs";
|
|
7
|
+
import { Cascader as z } from "ant-design-vue";
|
|
8
|
+
import E from "./useActive.mjs";
|
|
9
|
+
import K from "../x-provider/hooks/use-x-provider-context.mjs";
|
|
10
|
+
const Z = /* @__PURE__ */ D({
|
|
11
11
|
name: "AXSuggestion",
|
|
12
12
|
__name: "Suggestion",
|
|
13
|
-
props:
|
|
13
|
+
props: L({
|
|
14
14
|
prefixCls: null,
|
|
15
15
|
className: null,
|
|
16
16
|
rootClassName: null,
|
|
@@ -39,63 +39,67 @@ const Y = /* @__PURE__ */ A({
|
|
|
39
39
|
open: !1
|
|
40
40
|
}),
|
|
41
41
|
setup(e) {
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
direction:
|
|
45
|
-
getPrefixCls:
|
|
46
|
-
} =
|
|
42
|
+
X(e, "prefixCls");
|
|
43
|
+
const a = p(), {
|
|
44
|
+
direction: b,
|
|
45
|
+
getPrefixCls: k
|
|
46
|
+
} = K(), n = l(() => k("suggestion", e.prefixCls));
|
|
47
47
|
`${n.value}`;
|
|
48
|
-
const
|
|
48
|
+
const s = l(() => b.value === "rtl"), i = T("suggestion"), u = B(), [F, c, r] = q(n), {
|
|
49
49
|
width: f
|
|
50
|
-
} =
|
|
50
|
+
} = P(u), O = l(() => {
|
|
51
51
|
if (e.block && f.value)
|
|
52
52
|
return {
|
|
53
53
|
width: `${f.value}px`
|
|
54
54
|
};
|
|
55
|
-
}), [m,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
55
|
+
}), [m, d] = x(e.open);
|
|
56
|
+
I(() => e.open, (t) => {
|
|
57
|
+
d(t);
|
|
58
|
+
});
|
|
59
|
+
const [R, V] = x(), o = (t) => {
|
|
60
|
+
var S;
|
|
61
|
+
d(t), (S = e.onOpenChange) == null || S.call(e, t);
|
|
62
|
+
}, g = (t) => {
|
|
59
63
|
t === !1 ? o(!1) : (V(t), o(!0));
|
|
60
|
-
},
|
|
64
|
+
}, v = () => {
|
|
61
65
|
o(!1);
|
|
62
|
-
},
|
|
66
|
+
}, C = l(() => typeof e.items == "function" ? e.items(R.value) : e.items), h = (t) => {
|
|
63
67
|
e.onSelect && e.onSelect(t[t.length - 1]), o(!1);
|
|
64
|
-
}, [$, y] =
|
|
68
|
+
}, [$, y] = E(C, m, s, h, v), A = l(() => {
|
|
65
69
|
var t;
|
|
66
|
-
return
|
|
67
|
-
onTrigger:
|
|
70
|
+
return a.default ? a.default({
|
|
71
|
+
onTrigger: g,
|
|
68
72
|
onKeyDown: y
|
|
69
73
|
}) : (t = e.children) == null ? void 0 : t.call(e, {
|
|
70
|
-
onTrigger:
|
|
74
|
+
onTrigger: g,
|
|
71
75
|
onKeyDown: y
|
|
72
76
|
});
|
|
73
77
|
});
|
|
74
|
-
return () =>
|
|
75
|
-
options:
|
|
78
|
+
return () => F(N(z, {
|
|
79
|
+
options: C.value,
|
|
76
80
|
open: m.value,
|
|
77
81
|
value: $.value,
|
|
78
|
-
placement:
|
|
82
|
+
placement: s.value ? "topRight" : "topLeft",
|
|
79
83
|
onDropdownVisibleChange: (t) => {
|
|
80
|
-
t ||
|
|
84
|
+
t || v();
|
|
81
85
|
},
|
|
82
|
-
popupClassName:
|
|
86
|
+
popupClassName: w(e.rootClassName, n.value, c.value, r, {
|
|
83
87
|
[`${n.value}-block`]: e.block
|
|
84
88
|
}),
|
|
85
|
-
onChange:
|
|
86
|
-
dropdownStyle:
|
|
89
|
+
onChange: h,
|
|
90
|
+
dropdownStyle: O.value
|
|
87
91
|
}, {
|
|
88
|
-
default: () =>
|
|
92
|
+
default: () => N("div", {
|
|
89
93
|
ref: u,
|
|
90
|
-
class:
|
|
94
|
+
class: w(n.value, i.value.className, e.rootClassName, e.className, `${n.value}-wrapper`, c.value, r),
|
|
91
95
|
style: {
|
|
92
96
|
...i.value.style,
|
|
93
97
|
...e.style
|
|
94
98
|
}
|
|
95
|
-
}, [
|
|
99
|
+
}, [A.value])
|
|
96
100
|
}));
|
|
97
101
|
}
|
|
98
102
|
});
|
|
99
103
|
export {
|
|
100
|
-
|
|
104
|
+
Z as default
|
|
101
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),s=require("../../chunks/module-chunk.js"),o=require("ant-design-vue"),i=require("../../_util/hooks/use-state.js"),w=require("../context.js"),V=require("../SilentUploader.js"),b=require("./FileListCard.js"),v=1,
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),s=require("../../chunks/module-chunk.js"),o=require("ant-design-vue"),i=require("../../_util/hooks/use-state.js"),w=require("../context.js"),V=require("../SilentUploader.js"),b=require("./FileListCard.js"),v=1,L=e.defineComponent({name:"AXAttachmentsFileList",__name:"FileList",props:{prefixCls:{},items:{},onRemove:{},overflow:{},upload:{},imageProps:{},listClassName:{},listStyle:{},itemClassName:{},itemStyle:{}},setup(t){const n=e.computed(()=>`${t.prefixCls}-list`),c=e.useTemplateRef("file-list-container"),[x,r]=i.default(!1),h=w.useAttachmentContextInject();e.watchEffect(()=>{r(!0),e.onWatcherCleanup(()=>{r(!1)})});const[g,u]=i.default(!1),[C,f]=i.default(!1),d=()=>{const l=c.value;l&&(t.overflow==="scrollX"?(u(Math.abs(l.scrollLeft)>=v),f(l.scrollWidth-l.clientWidth-Math.abs(l.scrollLeft)>=v)):t.overflow==="scrollY"&&(u(l.scrollTop!==0),f(l.scrollHeight-l.clientHeight!==l.scrollTop)))};e.watch([()=>t.overflow,()=>t.items.length],()=>{e.nextTick(()=>{d()})},{immediate:!0});const m=l=>{const a=c.value;a&&a.scrollTo({left:a.scrollLeft+l*a.clientWidth,behavior:"smooth"})},N=()=>{m(-1)},S=()=>{m(1)};return()=>e.createVNode("div",{class:s.classnames(n.value,{[`${n.value}-overflow-${t.overflow}`]:t.overflow,[`${n.value}-overflow-ping-start`]:g.value,[`${n.value}-overflow-ping-end`]:C.value},t.listClassName),ref:"file-list-container",onScroll:d,style:t.listStyle},[t.items.map(l=>e.createVNode(b.default,{key:l.uid,prefixCls:t.prefixCls,item:l,onRemove:t.onRemove,className:s.classnames(t.itemClassName),imageProps:t.imageProps,style:{...t.itemStyle}},null)),!h.value.disabled&&e.createVNode(V.default,{upload:t.upload,children:e.createVNode(o.Button,{class:`${n.value}-upload-btn`,type:"dashed"},{default:()=>[e.createVNode(s.PlusOutlined,{class:`${n.value}-upload-btn-icon`},null)]})},null),t.overflow==="scrollX"&&e.createVNode(e.Fragment,null,[e.createVNode(o.Button,{size:"small",shape:"circle",class:`${n.value}-prev-btn`,icon:e.createVNode(s.LeftOutlined,null,null),onClick:N},null),e.createVNode(o.Button,{size:"small",shape:"circle",class:`${n.value}-next-btn`,icon:e.createVNode(s.RightOutlined,null,null),onClick:S},null)])])}});exports.default=L;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),o=require("../chunks/module-chunk.js");require("../x-provider/index.js");const P=require("../_util/hooks/use-x-component-config.js"),R=require("./style/index.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),o=require("../chunks/module-chunk.js");require("../x-provider/index.js");const P=require("../_util/hooks/use-x-component-config.js"),R=require("./style/index.js"),q=require("../_util/hooks/use-state.js"),$=require("ant-design-vue"),A=require("./useActive.js"),L=require("../x-provider/hooks/use-x-provider-context.js"),T=n.defineComponent({name:"AXSuggestion",__name:"Suggestion",props:n.mergeDefaults({prefixCls:null,className:null,rootClassName:null,style:null,children:{type:Function},open:{type:Boolean},onOpenChange:{type:Function},items:{type:Function},onSelect:{type:Function},block:{type:Boolean},styles:null,classNames:null},{open:!1}),setup(e){n.toRef(e,"prefixCls");const u=n.useSlots(),{direction:w,getPrefixCls:k}=L.default(),l=n.computed(()=>k("suggestion",e.prefixCls));`${l.value}`;const a=n.computed(()=>w.value==="rtl"),i=P.default("suggestion"),c=n.ref(),[x,r,d]=R.default(l),{width:f}=o.useElementSize(c),b=n.computed(()=>{if(e.block&&f.value)return{width:`${f.value}px`}}),[m,g]=q.default(e.open);n.watch(()=>e.open,t=>{g(t)});const[V,O]=q.default(),s=t=>{var N;g(t),(N=e.onOpenChange)==null||N.call(e,t)},v=t=>{t===!1?s(!1):(O(t),s(!0))},C=()=>{s(!1)},h=n.computed(()=>typeof e.items=="function"?e.items(V.value):e.items),y=t=>{e.onSelect&&e.onSelect(t[t.length-1]),s(!1)},[D,S]=A.default(h,m,a,y,C),F=n.computed(()=>{var t;return u.default?u.default({onTrigger:v,onKeyDown:S}):(t=e.children)==null?void 0:t.call(e,{onTrigger:v,onKeyDown:S})});return()=>x(n.createVNode($.Cascader,{options:h.value,open:m.value,value:D.value,placement:a.value?"topRight":"topLeft",onDropdownVisibleChange:t=>{t||C()},popupClassName:o.classnames(e.rootClassName,l.value,r.value,d,{[`${l.value}-block`]:e.block}),onChange:y,dropdownStyle:b.value},{default:()=>n.createVNode("div",{ref:c,class:o.classnames(l.value,i.value.className,e.rootClassName,e.className,`${l.value}-wrapper`,r.value,d),style:{...i.value.style,...e.style}},[F.value])}))}});exports.default=T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ant-design-x-vue",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Craft AI-driven interfaces effortlessly",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"AI",
|
|
@@ -112,6 +112,7 @@
|
|
|
112
112
|
"@vue/test-utils": "^2.4.6",
|
|
113
113
|
"ant-design-vue": "^4.2.6",
|
|
114
114
|
"changelogen": "^0.5.7",
|
|
115
|
+
"dayjs": "^1.11.13",
|
|
115
116
|
"eslint": "^8.57.1",
|
|
116
117
|
"eslint-plugin-vue": "^9.17.0",
|
|
117
118
|
"fast-glob": "^3.3.2",
|
|
@@ -30,5 +30,5 @@ export declare class XAgent<Message = string, Input = RequestFnInfo<Message>, Ou
|
|
|
30
30
|
request: RequestFn<Message, Input, Output>;
|
|
31
31
|
isRequesting(): boolean;
|
|
32
32
|
}
|
|
33
|
-
export default function useXAgent<Message = string, Input = RequestFnInfo<Message>, Output = SSEOutput>(config: MaybeRefOrGetter<XAgentConfig<Message, Input, Output>>): import("vue").ComputedRef<XAgent<Message,
|
|
33
|
+
export default function useXAgent<Message = string, Input = RequestFnInfo<Message>, Output = SSEOutput>(config: MaybeRefOrGetter<XAgentConfig<Message, Input, Output>>): import("vue").ComputedRef<XAgent<Message, Input, Output>>[];
|
|
34
34
|
export {};
|