ant-design-x-vue 1.2.0 → 1.2.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.
Files changed (35) hide show
  1. package/README.en.md +6 -0
  2. package/README.md +11 -0
  3. package/dist/index.umd.js +9 -43
  4. package/es/attachments/Attachments2.mjs +50 -51
  5. package/es/attachments/FileList/FileList2.mjs +712 -932
  6. package/es/attachments/PlaceholderUploader.mjs +30 -27
  7. package/es/attachments/SilentUploader.mjs +12 -9
  8. package/es/bubble/Bubble.mjs +36 -36
  9. package/es/sender/components/LoadingButton.mjs +5 -5
  10. package/es/theme/useToken.mjs +54 -310
  11. package/es/thought-chain/hooks/useCollapsible.mjs +25 -17
  12. package/es/use-x-agent/use-x-agent.mjs +41 -34
  13. package/es/use-x-chat/use-x-chat.mjs +98 -69
  14. package/es/x-provider/hooks/use-x-provider-context.mjs +11 -16
  15. package/es/x-request/x-request.mjs +55 -53
  16. package/lib/attachments/Attachments2.js +2 -2
  17. package/lib/attachments/FileList/FileList2.js +4 -4
  18. package/lib/attachments/PlaceholderUploader.js +1 -1
  19. package/lib/attachments/SilentUploader.js +1 -1
  20. package/lib/bubble/Bubble.js +1 -1
  21. package/lib/sender/components/LoadingButton.js +1 -1
  22. package/lib/theme/useToken.js +1 -35
  23. package/lib/thought-chain/hooks/useCollapsible.js +1 -1
  24. package/lib/use-x-agent/use-x-agent.js +1 -1
  25. package/lib/use-x-chat/use-x-chat.js +1 -1
  26. package/lib/x-provider/hooks/use-x-provider-context.js +1 -1
  27. package/lib/x-request/x-request.js +1 -1
  28. package/package.json +1 -1
  29. package/typings/attachments/PlaceholderUploader.vue.d.ts +1 -446
  30. package/typings/attachments/SilentUploader.vue.d.ts +1 -446
  31. package/typings/bubble/Bubble.vue.d.ts +2 -2
  32. package/typings/bubble/index.d.ts +4 -4
  33. package/typings/use-x-agent/use-x-agent.d.ts +3 -1
  34. package/typings/use-x-chat/use-x-chat.d.ts +15 -1
  35. package/typings/x-request/x-request.d.ts +4 -0
@@ -1,97 +1,126 @@
1
- import { ref as k, computed as b } from "vue";
2
- import A from "./useSyncState.mjs";
3
- import { useEventCallback as P } from "../_util/hooks/use-event-callback.mjs";
4
- function $(l) {
5
- return Array.isArray(l) ? l : [l];
1
+ import { ref as F, computed as $ } from "vue";
2
+ import I from "./useSyncState.mjs";
3
+ import { useEventCallback as T } from "../_util/hooks/use-event-callback.mjs";
4
+ function W(i) {
5
+ return Array.isArray(i) ? i : [i];
6
6
  }
7
- function F(l) {
8
- const { defaultMessages: v, agent: p, requestFallback: d, requestPlaceholder: c, parser: h } = l, M = k(0), w = b(() => (v || []).map((r, e) => ({
9
- id: `default_${e}`,
7
+ function U(i) {
8
+ const {
9
+ defaultMessages: q,
10
+ agent: b,
11
+ requestFallback: d,
12
+ requestPlaceholder: f,
13
+ parser: v,
14
+ transformMessage: R,
15
+ transformStream: A,
16
+ resolveAbortController: h
17
+ } = i, w = F(0), _ = $(() => (q || []).map((s, t) => ({
18
+ id: `default_${t}`,
10
19
  status: "local",
11
- ...r
12
- }))), [g, u] = A(w.value, () => {
13
- }), f = (r, e) => {
20
+ ...s
21
+ }))), [m, g] = I(_.value, () => {
22
+ }), M = (s, t) => {
14
23
  const o = {
15
- id: `msg_${M.value}`,
16
- message: r,
17
- status: e
24
+ id: `msg_${w.value}`,
25
+ message: s,
26
+ status: t
18
27
  };
19
- return M.value += 1, o;
20
- }, E = b(() => {
21
- const r = [];
22
- return g.value.forEach((e) => {
23
- const o = h ? h(e.message) : e.message, i = $(o);
24
- i.forEach((a, t) => {
25
- let s = e.id;
26
- i.length > 1 && (s = `${s}_${t}`), r.push({
27
- id: s,
28
- message: a,
29
- status: e.status
28
+ return w.value += 1, o;
29
+ }, x = $(() => {
30
+ const s = [];
31
+ return m.value.forEach((t) => {
32
+ const o = v ? v(t.message) : t.message, u = W(o);
33
+ u.forEach((l, p) => {
34
+ let e = t.id;
35
+ u.length > 1 && (e = `${e}_${p}`), s.push({
36
+ id: e,
37
+ message: l,
38
+ status: t.status
30
39
  });
31
40
  });
32
- }), r;
33
- }), y = (r) => r.filter((e) => e.status !== "loading" && e.status !== "error").map((e) => e.message), q = () => y(g.value);
41
+ }), s;
42
+ }), E = (s) => s.filter((t) => t.status !== "loading" && t.status !== "error").map((t) => t.message), S = () => E(m.value), k = (s) => typeof R == "function" ? R(s) : s.currentMessage;
34
43
  return {
35
- onRequest: P((r) => {
36
- if (!p)
44
+ onRequest: T((s) => {
45
+ if (!b)
37
46
  throw new Error(
38
47
  "The agent parameter is required when using the onRequest method in an agent generated by useXAgent."
39
48
  );
40
- let e = null;
41
- u((a) => {
42
- let t = [...a, f(r, "local")];
43
- if (c) {
44
- let s;
45
- typeof c == "function" ? s = c(r, {
46
- messages: y(t)
47
- }) : s = c;
48
- const n = f(s, "loading");
49
- e = n.id, t = [...t, n];
49
+ let t = null, o, u = {};
50
+ if (typeof s == "object" && (s != null && s.message)) {
51
+ const { message: e, ...r } = s;
52
+ o = e, u = r;
53
+ } else
54
+ o = s;
55
+ g((e) => {
56
+ let r = [...e, M(o, "local")];
57
+ if (f) {
58
+ let a;
59
+ typeof f == "function" ? a = f(o, {
60
+ messages: E(r)
61
+ }) : a = f;
62
+ const n = M(a, "loading");
63
+ t = n.id, r = [...r, n];
50
64
  }
51
- return t;
65
+ return r;
52
66
  });
53
- let o = null;
54
- const i = (a, t) => {
55
- let s = g.value.find((n) => n.id === o);
56
- return s ? u((n) => n.map((m) => m.id === o ? {
57
- ...m,
58
- message: a,
59
- status: t
60
- } : m)) : (s = f(a, t), u((n) => [...n.filter((R) => R.id !== e), s]), o = s.id), s;
67
+ let l = null;
68
+ const p = (e, r) => {
69
+ let a = m.value.find((n) => n.id === l);
70
+ return a ? g((n) => n.map((c) => {
71
+ if (c.id === l) {
72
+ const y = k({
73
+ originMessage: c.message,
74
+ currentMessage: e,
75
+ status: r
76
+ });
77
+ return {
78
+ ...c,
79
+ message: y,
80
+ status: r
81
+ };
82
+ }
83
+ return c;
84
+ })) : (k({ currentMessage: e, status: r }), a = M(e, r), g((n) => [...n.filter((y) => y.id !== t), a]), l = a.id), a;
61
85
  };
62
- p.request(
86
+ b.request(
63
87
  {
64
- message: r,
65
- messages: q()
88
+ message: o,
89
+ messages: S(),
90
+ ...u
66
91
  },
67
92
  {
68
- onUpdate: (a) => {
69
- i(a, "loading");
93
+ onUpdate: (e) => {
94
+ p(e, "loading");
70
95
  },
71
- onSuccess: (a) => {
72
- i(a, "success");
96
+ onSuccess: (e) => {
97
+ p(e, "success");
73
98
  },
74
- onError: async (a) => {
99
+ onError: async (e) => {
75
100
  if (d) {
76
- let t;
77
- typeof d == "function" ? t = await d(r, {
78
- error: a,
79
- messages: q()
80
- }) : t = d, u((s) => [
81
- ...s.filter((n) => n.id !== e && n.id !== o),
82
- f(t, "error")
101
+ let r;
102
+ typeof d == "function" ? r = await d(o, {
103
+ error: e,
104
+ messages: S()
105
+ }) : r = d, g((a) => [
106
+ ...a.filter((n) => n.id !== t && n.id !== l),
107
+ M(r, "error")
83
108
  ]);
84
109
  } else
85
- u((t) => t.filter((s) => s.id !== e && s.id !== o));
110
+ g((r) => r.filter((a) => a.id !== t && a.id !== l));
111
+ },
112
+ onStream: (e) => {
113
+ h == null || h(e);
86
114
  }
87
- }
115
+ },
116
+ A
88
117
  );
89
118
  }),
90
- messages: g,
91
- parsedMessages: E,
92
- setMessages: u
119
+ messages: m,
120
+ parsedMessages: x,
121
+ setMessages: g
93
122
  };
94
123
  }
95
124
  export {
96
- F as default
125
+ U as default
97
126
  };
@@ -1,21 +1,16 @@
1
- import { inject as c, computed as n } from "vue";
2
- const f = "anticon", d = Symbol("configProvider"), s = {
3
- getPrefixCls: (t, e) => e || (t ? `ant-${t}` : "ant"),
4
- iconPrefixCls: n(() => f),
5
- getPopupContainer: n(() => () => document.body),
6
- direction: n(() => "ltr")
7
- }, u = () => c(d, s), l = "ant";
8
- function P() {
9
- const { getPrefixCls: t, direction: e, csp: o, iconPrefixCls: r, theme: i } = u();
1
+ import { useConfigContextInject as i } from "ant-design-vue/es/config-provider/context";
2
+ const f = "ant";
3
+ function c() {
4
+ const { getPrefixCls: e, direction: t, csp: n, iconPrefixCls: o, theme: r } = i();
10
5
  return {
11
- theme: i,
12
- getPrefixCls: t,
13
- direction: e,
14
- csp: o,
15
- iconPrefixCls: r
6
+ theme: r,
7
+ getPrefixCls: e,
8
+ direction: t,
9
+ csp: n,
10
+ iconPrefixCls: o
16
11
  };
17
12
  }
18
13
  export {
19
- P as default,
20
- l as defaultPrefixCls
14
+ c as default,
15
+ f as defaultPrefixCls
21
16
  };
@@ -1,83 +1,85 @@
1
- import f from "../x-stream/x-stream.mjs";
2
- import y from "./x-fetch.mjs";
3
- const d = class d {
4
- constructor(n) {
5
- this.create = async (s, e, r) => {
6
- var o;
7
- const i = {
1
+ import y from "../x-stream/x-stream.mjs";
2
+ import R from "./x-fetch.mjs";
3
+ const s = class s {
4
+ constructor(t) {
5
+ this.create = async (h, e, o) => {
6
+ var i, u;
7
+ const n = new AbortController(), r = {
8
8
  method: "POST",
9
9
  body: JSON.stringify({
10
10
  model: this.model,
11
- ...s
11
+ ...h
12
12
  }),
13
- headers: this.defaultHeaders
13
+ headers: this.defaultHeaders,
14
+ signal: n.signal
14
15
  };
16
+ (i = e == null ? void 0 : e.onStream) == null || i.call(e, n);
15
17
  try {
16
- const t = await y(this.baseURL, {
18
+ const d = await R(this.baseURL, {
17
19
  fetch: this.customOptions.fetch,
18
- ...i
20
+ ...r
19
21
  });
20
- if (r) {
21
- await this.customResponseHandler(t, e, r);
22
+ if (o) {
23
+ await this.customResponseHandler(d, e, o);
22
24
  return;
23
25
  }
24
- const h = t.headers.get("content-type") || "";
25
- switch (h.split(";")[0].trim()) {
26
+ const p = d.headers.get("content-type") || "";
27
+ switch (p.split(";")[0].trim()) {
26
28
  /** SSE */
27
29
  case "text/event-stream":
28
- await this.sseResponseHandler(t, e);
30
+ await this.sseResponseHandler(d, e);
29
31
  break;
30
32
  /** JSON */
31
33
  case "application/json":
32
- await this.jsonResponseHandler(t, e);
34
+ await this.jsonResponseHandler(d, e);
33
35
  break;
34
36
  default:
35
- throw new Error(`The response content-type: ${h} is not support!`);
37
+ throw new Error(`The response content-type: ${p} is not support!`);
36
38
  }
37
- } catch (t) {
38
- const h = t instanceof Error ? t : new Error("Unknown error!");
39
- throw (o = e == null ? void 0 : e.onError) == null || o.call(e, h), h;
39
+ } catch (d) {
40
+ const p = d instanceof Error ? d : new Error("Unknown error!");
41
+ throw (u = e == null ? void 0 : e.onError) == null || u.call(e, p), p;
40
42
  }
41
- }, this.customResponseHandler = async (s, e, r) => {
42
- var o, t;
43
- const i = [];
44
- for await (const h of f({
45
- readableStream: s.body,
46
- transformStream: r
43
+ }, this.customResponseHandler = async (h, e, o) => {
44
+ var r, i;
45
+ const n = [];
46
+ for await (const u of y({
47
+ readableStream: h.body,
48
+ transformStream: o
47
49
  }))
48
- i.push(h), (o = e == null ? void 0 : e.onUpdate) == null || o.call(e, h);
49
- (t = e == null ? void 0 : e.onSuccess) == null || t.call(e, i);
50
- }, this.sseResponseHandler = async (s, e) => {
51
- var i, o;
52
- const r = [];
53
- for await (const t of f({
54
- readableStream: s.body
50
+ n.push(u), (r = e == null ? void 0 : e.onUpdate) == null || r.call(e, u);
51
+ (i = e == null ? void 0 : e.onSuccess) == null || i.call(e, n);
52
+ }, this.sseResponseHandler = async (h, e) => {
53
+ var n, r;
54
+ const o = [];
55
+ for await (const i of y({
56
+ readableStream: h.body
55
57
  }))
56
- r.push(t), (i = e == null ? void 0 : e.onUpdate) == null || i.call(e, t);
57
- (o = e == null ? void 0 : e.onSuccess) == null || o.call(e, r);
58
- }, this.jsonResponseHandler = async (s, e) => {
59
- var i, o;
60
- const r = await s.json();
61
- (i = e == null ? void 0 : e.onUpdate) == null || i.call(e, r), (o = e == null ? void 0 : e.onSuccess) == null || o.call(e, [r]);
58
+ o.push(i), (n = e == null ? void 0 : e.onUpdate) == null || n.call(e, i);
59
+ (r = e == null ? void 0 : e.onSuccess) == null || r.call(e, o);
60
+ }, this.jsonResponseHandler = async (h, e) => {
61
+ var n, r;
62
+ const o = await h.json();
63
+ (n = e == null ? void 0 : e.onUpdate) == null || n.call(e, o), (r = e == null ? void 0 : e.onSuccess) == null || r.call(e, [o]);
62
64
  };
63
- const { baseURL: u, model: w, dangerouslyApiKey: R, ...m } = n;
64
- this.baseURL = n.baseURL, this.model = n.model, this.defaultHeaders = {
65
+ const { baseURL: f, model: U, dangerouslyApiKey: g, ...w } = t;
66
+ this.baseURL = t.baseURL, this.model = t.model, this.defaultHeaders = {
65
67
  "Content-Type": "application/json",
66
- ...n.dangerouslyApiKey && {
67
- Authorization: n.dangerouslyApiKey
68
+ ...t.dangerouslyApiKey && {
69
+ Authorization: t.dangerouslyApiKey
68
70
  }
69
- }, this.customOptions = m;
71
+ }, this.customOptions = w;
70
72
  }
71
- static init(n) {
72
- if (!n.baseURL || typeof n.baseURL != "string")
73
+ static init(t) {
74
+ if (!t.baseURL || typeof t.baseURL != "string")
73
75
  throw new Error("The baseURL is not valid!");
74
- const u = n.fetch || n.baseURL;
75
- return d.instanceBuffer.has(u) || d.instanceBuffer.set(u, new d(n)), d.instanceBuffer.get(u);
76
+ const f = t.fetch || t.baseURL;
77
+ return s.instanceBuffer.has(f) || s.instanceBuffer.set(f, new s(t)), s.instanceBuffer.get(f);
76
78
  }
77
79
  };
78
- d.instanceBuffer = /* @__PURE__ */ new Map();
79
- let p = d;
80
- const g = p.init;
80
+ s.instanceBuffer = /* @__PURE__ */ new Map();
81
+ let m = s;
82
+ const T = m.init;
81
83
  export {
82
- g as default
84
+ T as default
83
85
  };
@@ -1,5 +1,5 @@
1
- "use strict";const l=require("vue"),A=require("../_util/hooks/use-x-component-config.js"),I=require("../x-provider/hooks/use-x-provider-context.js");require("../x-provider/context.js");require("ant-design-vue");const U=require("./PlaceholderUploader.js"),b=require("./DropArea.js"),E=require("./SilentUploader.js"),T=require("./FileList/FileList2.js"),k=require("./context.js"),X=require("./style/index.js"),$=require("../_util/hooks/use-state.js");function D(e,d){const o=Object.create(null);for(const u in e)d.includes(u)||Object.defineProperty(o,u,{enumerable:!0,get:()=>e[u]});return o}function B(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var g={exports:{}};/*!
1
+ "use strict";const t=require("vue"),A=require("../_util/hooks/use-x-component-config.js"),I=require("../x-provider/hooks/use-x-provider-context.js");require("../x-provider/context.js");require("ant-design-vue");const E=require("./PlaceholderUploader.js"),b=require("./DropArea.js"),T=require("./SilentUploader.js"),k=require("./FileList/FileList2.js"),X=require("./context.js"),$=require("./style/index.js"),B=require("../_util/hooks/use-state.js");function D(e,m){const o=Object.create(null);for(const u in e)m.includes(u)||Object.defineProperty(o,u,{enumerable:!0,get:()=>e[u]});return o}function M(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var g={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
5
- */var F;function M(){return F||(F=1,function(e){(function(){var d={}.hasOwnProperty;function o(){for(var t="",n=0;n<arguments.length;n++){var r=arguments[n];r&&(t=f(t,u(r)))}return t}function u(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t!="object")return"";if(Array.isArray(t))return o.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var n="";for(var r in t)d.call(t,r)&&t[r]&&(n=f(n,r));return n}function f(t,n){return n?t?t+" "+n:t+n:t}e.exports?(o.default=o,e.exports=o):window.classNames=o})()}(g)),g.exports}var z=M();const i=B(z),G=l.defineComponent({name:"AXAttachments",__name:"Attachments",props:l.mergeDefaults({capture:null,type:null,name:null,defaultFileList:null,action:null,directory:null,data:null,method:null,headers:null,showUploadList:null,multiple:null,accept:null,beforeUpload:null,onChange:{type:Function},"onUpdate:fileList":null,onDrop:null,listType:null,onPreview:null,onDownload:null,onReject:null,onRemove:null,remove:null,supportServerRender:null,disabled:{type:Boolean},prefixCls:null,customRequest:null,withCredentials:null,openFileDialogOnClick:null,locale:null,id:null,previewFile:null,transformFile:null,iconRender:null,isImageUrl:null,progress:null,itemRender:null,maxCount:null,height:null,removeIcon:null,downloadIcon:null,previewIcon:null,rootClassName:null,rootStyle:null,style:null,className:null,classNames:null,styles:null,children:null,placeholder:{type:Function},getDropContainer:{type:Function},items:null,overflow:null,imageProps:null},{items:()=>[],classNames:()=>({}),styles:()=>({})}),setup(e,{expose:d}){const o=D(e,["prefixCls","rootClassName","rootStyle","className","style","items","children","getDropContainer","placeholder","onChange","onRemove","overflow","imageProps","disabled","classNames","styles"]);l.toRef(e,"prefixCls");const u=l.useSlots(),{getPrefixCls:f,direction:t}=I.default(),n=f("attachment",e.prefixCls),r=A.default("attachments"),v=l.computed(()=>r.value.classNames),y=l.computed(()=>r.value.styles),x=l.useTemplateRef("attachments-container"),P=l.useTemplateRef("attachments-upload"),[L,V,j]=X.default(n),C=l.computed(()=>i(V.value,j)),[h,R]=$.default(e.items);l.watch(()=>e.items,()=>{R(e.items)});const w=s=>{var a;R(s.fileList),(a=e.onChange)==null||a.call(e,s)},N=l.computed(()=>({...o,fileList:h.value,onChange:w})),O=s=>Promise.resolve(typeof e.onRemove=="function"?e.onRemove(s):e.onRemove).then(a=>{if(a===!1)return;const m=h.value.filter(c=>c.uid!==s.uid);w({file:{...s,status:"removed"},fileList:m})}),p=(s,a,m)=>{const c=u.placeholder?u.placeholder({type:s}):typeof e.placeholder=="function"?e.placeholder(s):e.placeholder;return l.createVNode(U.default,{placeholder:c,upload:N.value,prefixCls:n,className:i(v.value.placeholder,e.classNames.placeholder),style:{...y.value.placeholder,...e.styles.placeholder,...a==null?void 0:a.style}},null)},S=l.computed(()=>h.value.length>0);return d({nativeElement:x.value,upload:s=>{var m,c;const a=(c=(m=P.value)==null?void 0:m.nativeElement)==null?void 0:c.querySelector('input[type="file"]');if(a){const q=new DataTransfer;q.items.add(s),a.files=q.files,a.dispatchEvent(new Event("change",{bubbles:!0}))}}}),()=>L(l.createVNode(k.AttachmentContextProvider,{value:{disabled:e.disabled}},{default:()=>[e.children?l.createVNode(l.Fragment,null,[l.createVNode(E.default,{upload:N.value,rootClassName:e.rootClassName,ref:"attachments-upload",children:e.children},null),l.createVNode(b.default,{getDropContainer:e.getDropContainer,prefixCls:n,className:i(C.value,e.rootClassName),children:p("drop")},null)]):l.createVNode("div",{class:i(n,C.value,{[`${n}-rtl`]:t.value==="rtl"},e.className,e.rootClassName),style:{...e.rootStyle,...e.style},dir:t.value||"ltr",ref:"attachments-container"},[l.createVNode(T._sfc_main,{prefixCls:n,items:h.value,onRemove:O,overflow:e.overflow,upload:N.value,listClassName:i(v.value.list,e.classNames.list),listStyle:{...y.value.list,...e.styles.list,...!S.value&&{display:"none"}},itemClassName:i(v.value.item,e.classNames.item),itemStyle:{...y.value.item,...e.styles.item},imageProps:e.imageProps},null),p("inline",S.value?{style:{display:"none"}}:{},P.value),l.createVNode(b.default,{getDropContainer:e.getDropContainer||(()=>x.value),prefixCls:n,className:C.value,children:p("drop")},null)])]}))}});exports._sfc_main=G;exports.classnames=i;exports.createPropsRestProxy=D;
5
+ */var F;function z(){return F||(F=1,function(e){(function(){var m={}.hasOwnProperty;function o(){for(var l="",n=0;n<arguments.length;n++){var r=arguments[n];r&&(l=f(l,u(r)))}return l}function u(l){if(typeof l=="string"||typeof l=="number")return l;if(typeof l!="object")return"";if(Array.isArray(l))return o.apply(null,l);if(l.toString!==Object.prototype.toString&&!l.toString.toString().includes("[native code]"))return l.toString();var n="";for(var r in l)m.call(l,r)&&l[r]&&(n=f(n,r));return n}function f(l,n){return n?l?l+" "+n:l+n:l}e.exports?(o.default=o,e.exports=o):window.classNames=o})()}(g)),g.exports}var G=z();const c=M(G),H=t.defineComponent({name:"AXAttachments",__name:"Attachments",props:t.mergeDefaults({capture:null,type:null,name:null,defaultFileList:null,action:null,directory:null,data:null,method:null,headers:null,showUploadList:null,multiple:null,accept:null,beforeUpload:null,onChange:{type:Function},"onUpdate:fileList":null,onDrop:null,listType:null,onPreview:null,onDownload:null,onReject:null,onRemove:null,remove:null,supportServerRender:null,disabled:{type:Boolean},prefixCls:null,customRequest:null,withCredentials:null,openFileDialogOnClick:null,locale:null,id:null,previewFile:null,transformFile:null,iconRender:null,isImageUrl:null,progress:null,itemRender:null,maxCount:null,height:null,removeIcon:null,downloadIcon:null,previewIcon:null,rootClassName:null,rootStyle:null,style:null,className:null,classNames:null,styles:null,children:null,placeholder:{type:Function},getDropContainer:{type:Function},items:null,overflow:null,imageProps:null},{items:()=>[],classNames:()=>({}),styles:()=>({})}),setup(e,{expose:m}){const o=D(e,["prefixCls","rootClassName","rootStyle","className","style","items","children","getDropContainer","placeholder","onChange","onRemove","overflow","imageProps","disabled","classNames","styles"]);t.toRef(e,"prefixCls");const u=t.useSlots(),{getPrefixCls:f,direction:l}=I.default(),n=f("attachment",e.prefixCls),r=A.default("attachments"),v=t.computed(()=>r.value.classNames),y=t.computed(()=>r.value.styles),x=t.useTemplateRef("attachments-container"),P=t.ref(null),L=t.useTemplateRef("placeholder-uploader"),[V,j,O]=$.default(n),C=t.computed(()=>c(j.value,O)),[h,R]=B.default(e.items);t.watch(()=>e.items,()=>{R(e.items)});const w=s=>{var a;R(s.fileList),(a=e.onChange)==null||a.call(e,s)},p=t.computed(()=>({...o,fileList:h.value,onChange:w})),U=s=>Promise.resolve(typeof e.onRemove=="function"?e.onRemove(s):e.onRemove).then(a=>{if(a===!1)return;const i=h.value.filter(d=>d.uid!==s.uid);w({file:{...s,status:"removed"},fileList:i})}),N=(s,a,i)=>{i&&(i.value=L.value);const d=u.placeholder?u.placeholder({type:s}):typeof e.placeholder=="function"?e.placeholder(s):e.placeholder;return t.createVNode(E.default,{placeholder:d,upload:p.value,prefixCls:n,className:c(v.value.placeholder,e.classNames.placeholder),style:{...y.value.placeholder,...e.styles.placeholder,...a==null?void 0:a.style},ref:"placeholder-uploader"},null)},S=t.computed(()=>h.value.length>0);return m({nativeElement:x.value,upload:s=>{var i,d;const a=(d=(i=P.value.nativeElement).querySelector)==null?void 0:d.call(i,'input[type="file"]');if(a){const q=new DataTransfer;q.items.add(s),a.files=q.files,a.dispatchEvent(new Event("change",{bubbles:!0}))}}}),()=>V(t.createVNode(X.AttachmentContextProvider,{value:{disabled:e.disabled}},{default:()=>[e.children?t.createVNode(t.Fragment,null,[t.createVNode(T.default,{upload:p.value,rootClassName:e.rootClassName,ref:"attachments-upload",children:e.children},null),t.createVNode(b.default,{getDropContainer:e.getDropContainer,prefixCls:n,className:c(C.value,e.rootClassName),children:N("drop")},null)]):t.createVNode("div",{class:c(n,C.value,{[`${n}-rtl`]:l.value==="rtl"},e.className,e.rootClassName),style:{...e.rootStyle,...e.style},dir:l.value||"ltr",ref:"attachments-container"},[t.createVNode(k._sfc_main,{prefixCls:n,items:h.value,onRemove:U,overflow:e.overflow,upload:p.value,listClassName:c(v.value.list,e.classNames.list),listStyle:{...y.value.list,...e.styles.list,...!S.value&&{display:"none"}},itemClassName:c(v.value.item,e.classNames.item),itemStyle:{...y.value.item,...e.styles.item},imageProps:e.imageProps},null),N("inline",S.value?{style:{display:"none"}}:{},P),t.createVNode(b.default,{getDropContainer:e.getDropContainer||(()=>x.value),prefixCls:n,className:C.value,children:N("drop")},null)])]}))}});exports._sfc_main=H;exports.classnames=c;exports.createPropsRestProxy=D;