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,22 +1,22 @@
1
- import { defineComponent as $, mergeDefaults as U, toRef as q, useSlots as T, computed as d, useTemplateRef as F, watch as V, createVNode as i, Fragment as X } from "vue";
2
- import B from "../_util/hooks/use-x-component-config.mjs";
3
- import M from "../x-provider/hooks/use-x-provider-context.mjs";
1
+ import { defineComponent as $, mergeDefaults as q, toRef as T, useSlots as V, computed as d, useTemplateRef as F, ref as X, watch as B, createVNode as i, Fragment as M } from "vue";
2
+ import k from "../_util/hooks/use-x-component-config.mjs";
3
+ import z from "../x-provider/hooks/use-x-provider-context.mjs";
4
4
  import "../x-provider/context.mjs";
5
5
  import "ant-design-vue";
6
- import k from "./PlaceholderUploader.mjs";
6
+ import G from "./PlaceholderUploader.mjs";
7
7
  import L from "./DropArea.mjs";
8
- import z from "./SilentUploader.mjs";
9
- import { _ as G } from "./FileList/FileList2.mjs";
10
- import { AttachmentContextProvider as H } from "./context.mjs";
11
- import J from "./style/index.mjs";
12
- import K from "../_util/hooks/use-state.mjs";
13
- function Q(e, m) {
8
+ import H from "./SilentUploader.mjs";
9
+ import { _ as J } from "./FileList/FileList2.mjs";
10
+ import { AttachmentContextProvider as K } from "./context.mjs";
11
+ import Q from "./style/index.mjs";
12
+ import W from "../_util/hooks/use-state.mjs";
13
+ function Y(e, f) {
14
14
  const s = /* @__PURE__ */ Object.create(null);
15
15
  for (const r in e)
16
- m.includes(r) || Object.defineProperty(s, r, { enumerable: !0, get: () => e[r] });
16
+ f.includes(r) || Object.defineProperty(s, r, { enumerable: !0, get: () => e[r] });
17
17
  return s;
18
18
  }
19
- function W(e) {
19
+ function Z(e) {
20
20
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
21
21
  }
22
22
  var x = { exports: {} };
@@ -26,10 +26,10 @@ var x = { exports: {} };
26
26
  http://jedwatson.github.io/classnames
27
27
  */
28
28
  var j;
29
- function Y() {
29
+ function _() {
30
30
  return j || (j = 1, function(e) {
31
31
  (function() {
32
- var m = {}.hasOwnProperty;
32
+ var f = {}.hasOwnProperty;
33
33
  function s() {
34
34
  for (var l = "", t = 0; t < arguments.length; t++) {
35
35
  var o = arguments[t];
@@ -48,7 +48,7 @@ function Y() {
48
48
  return l.toString();
49
49
  var t = "";
50
50
  for (var o in l)
51
- m.call(l, o) && l[o] && (t = v(t, o));
51
+ f.call(l, o) && l[o] && (t = v(t, o));
52
52
  return t;
53
53
  }
54
54
  function v(l, t) {
@@ -58,11 +58,11 @@ function Y() {
58
58
  })();
59
59
  }(x)), x.exports;
60
60
  }
61
- var Z = Y();
62
- const c = /* @__PURE__ */ W(Z), me = /* @__PURE__ */ $({
61
+ var ee = _();
62
+ const m = /* @__PURE__ */ Z(ee), de = /* @__PURE__ */ $({
63
63
  name: "AXAttachments",
64
64
  __name: "Attachments",
65
- props: U({
65
+ props: q({
66
66
  capture: null,
67
67
  type: null,
68
68
  name: null,
@@ -130,15 +130,15 @@ const c = /* @__PURE__ */ W(Z), me = /* @__PURE__ */ $({
130
130
  styles: () => ({})
131
131
  }),
132
132
  setup(e, {
133
- expose: m
133
+ expose: f
134
134
  }) {
135
- const s = Q(e, ["prefixCls", "rootClassName", "rootStyle", "className", "style", "items", "children", "getDropContainer", "placeholder", "onChange", "onRemove", "overflow", "imageProps", "disabled", "classNames", "styles"]);
136
- q(e, "prefixCls");
137
- const r = T(), {
135
+ const s = Y(e, ["prefixCls", "rootClassName", "rootStyle", "className", "style", "items", "children", "getDropContainer", "placeholder", "onChange", "onRemove", "overflow", "imageProps", "disabled", "classNames", "styles"]);
136
+ T(e, "prefixCls");
137
+ const r = V(), {
138
138
  getPrefixCls: v,
139
139
  direction: l
140
- } = M(), t = v("attachment", e.prefixCls), o = B("attachments"), C = d(() => o.value.classNames), y = d(() => o.value.styles), w = F("attachments-container"), R = F("attachments-upload"), [O, I, A] = J(t), p = d(() => c(I.value, A)), [h, S] = K(e.items);
141
- V(() => e.items, () => {
140
+ } = z(), t = v("attachment", e.prefixCls), o = k("attachments"), C = d(() => o.value.classNames), y = d(() => o.value.styles), w = F("attachments-container"), R = X(null), O = F("placeholder-uploader"), [I, A, E] = Q(t), p = d(() => m(A.value, E)), [h, S] = W(e.items);
141
+ B(() => e.items, () => {
142
142
  S(e.items);
143
143
  });
144
144
  const P = (a) => {
@@ -148,41 +148,40 @@ const c = /* @__PURE__ */ W(Z), me = /* @__PURE__ */ $({
148
148
  ...s,
149
149
  fileList: h.value,
150
150
  onChange: P
151
- })), E = (a) => Promise.resolve(typeof e.onRemove == "function" ? e.onRemove(a) : e.onRemove).then((n) => {
151
+ })), U = (a) => Promise.resolve(typeof e.onRemove == "function" ? e.onRemove(a) : e.onRemove).then((n) => {
152
152
  if (n === !1)
153
153
  return;
154
- const f = h.value.filter((u) => u.uid !== a.uid);
154
+ const u = h.value.filter((c) => c.uid !== a.uid);
155
155
  P({
156
156
  file: {
157
157
  ...a,
158
158
  status: "removed"
159
159
  },
160
- fileList: f
160
+ fileList: u
161
161
  });
162
- }), N = (a, n, f) => {
163
- const u = r.placeholder ? r.placeholder({
162
+ }), N = (a, n, u) => {
163
+ u && (u.value = O.value);
164
+ const c = r.placeholder ? r.placeholder({
164
165
  type: a
165
166
  }) : typeof e.placeholder == "function" ? e.placeholder(a) : e.placeholder;
166
- return i(k, {
167
- placeholder: u,
167
+ return i(G, {
168
+ placeholder: c,
168
169
  upload: g.value,
169
170
  prefixCls: t,
170
- className: c(C.value.placeholder, e.classNames.placeholder),
171
+ className: m(C.value.placeholder, e.classNames.placeholder),
171
172
  style: {
172
173
  ...y.value.placeholder,
173
174
  ...e.styles.placeholder,
174
175
  ...n == null ? void 0 : n.style
175
- }
176
+ },
177
+ ref: "placeholder-uploader"
176
178
  }, null);
177
179
  }, b = d(() => h.value.length > 0);
178
- return m({
180
+ return f({
179
181
  nativeElement: w.value,
180
182
  upload: (a) => {
181
- var f, u;
182
- const n = (
183
- // @ts-expect-error
184
- (u = (f = R.value) == null ? void 0 : f.nativeElement) == null ? void 0 : u.querySelector('input[type="file"]')
185
- );
183
+ var u, c;
184
+ const n = (c = (u = R.value.nativeElement).querySelector) == null ? void 0 : c.call(u, 'input[type="file"]');
186
185
  if (n) {
187
186
  const D = new DataTransfer();
188
187
  D.items.add(a), n.files = D.files, n.dispatchEvent(new Event("change", {
@@ -190,12 +189,12 @@ const c = /* @__PURE__ */ W(Z), me = /* @__PURE__ */ $({
190
189
  }));
191
190
  }
192
191
  }
193
- }), () => O(i(H, {
192
+ }), () => I(i(K, {
194
193
  value: {
195
194
  disabled: e.disabled
196
195
  }
197
196
  }, {
198
- default: () => [e.children ? i(X, null, [i(z, {
197
+ default: () => [e.children ? i(M, null, [i(H, {
199
198
  upload: g.value,
200
199
  rootClassName: e.rootClassName,
201
200
  ref: "attachments-upload",
@@ -203,10 +202,10 @@ const c = /* @__PURE__ */ W(Z), me = /* @__PURE__ */ $({
203
202
  }, null), i(L, {
204
203
  getDropContainer: e.getDropContainer,
205
204
  prefixCls: t,
206
- className: c(p.value, e.rootClassName),
205
+ className: m(p.value, e.rootClassName),
207
206
  children: N("drop")
208
207
  }, null)]) : i("div", {
209
- class: c(t, p.value, {
208
+ class: m(t, p.value, {
210
209
  [`${t}-rtl`]: l.value === "rtl"
211
210
  }, e.className, e.rootClassName),
212
211
  style: {
@@ -215,13 +214,13 @@ const c = /* @__PURE__ */ W(Z), me = /* @__PURE__ */ $({
215
214
  },
216
215
  dir: l.value || "ltr",
217
216
  ref: "attachments-container"
218
- }, [i(G, {
217
+ }, [i(J, {
219
218
  prefixCls: t,
220
219
  items: h.value,
221
- onRemove: E,
220
+ onRemove: U,
222
221
  overflow: e.overflow,
223
222
  upload: g.value,
224
- listClassName: c(C.value.list, e.classNames.list),
223
+ listClassName: m(C.value.list, e.classNames.list),
225
224
  listStyle: {
226
225
  ...y.value.list,
227
226
  ...e.styles.list,
@@ -229,7 +228,7 @@ const c = /* @__PURE__ */ W(Z), me = /* @__PURE__ */ $({
229
228
  display: "none"
230
229
  }
231
230
  },
232
- itemClassName: c(C.value.item, e.classNames.item),
231
+ itemClassName: m(C.value.item, e.classNames.item),
233
232
  itemStyle: {
234
233
  ...y.value.item,
235
234
  ...e.styles.item
@@ -239,7 +238,7 @@ const c = /* @__PURE__ */ W(Z), me = /* @__PURE__ */ $({
239
238
  style: {
240
239
  display: "none"
241
240
  }
242
- } : {}, R.value), i(L, {
241
+ } : {}, R), i(L, {
243
242
  getDropContainer: e.getDropContainer || (() => w.value),
244
243
  prefixCls: t,
245
244
  className: p.value,
@@ -249,7 +248,7 @@ const c = /* @__PURE__ */ W(Z), me = /* @__PURE__ */ $({
249
248
  }
250
249
  });
251
250
  export {
252
- me as _,
253
- Q as a,
254
- c
251
+ de as _,
252
+ Y as a,
253
+ m as c
255
254
  };