ant-design-x-vue 1.3.0 → 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.
@@ -1,90 +1,88 @@
1
- import { defineComponent as $, computed as b, useTemplateRef as x, watchEffect as y, onWatcherCleanup as L, watch as R, nextTick as P, createVNode as t, Fragment as p } from "vue";
2
- import { b as v, P as E, L as N, R as T } from "../../chunks/module-chunk.mjs";
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 i from "../../_util/hooks/use-state.mjs";
4
+ import a from "../../_util/hooks/use-state.mjs";
5
5
  import { useAttachmentContextInject as k } from "../context.mjs";
6
- import F from "../SilentUploader.mjs";
7
- import O from "./FileListCard.mjs";
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: null,
13
- items: null,
14
- onRemove: {
15
- type: Function
16
- },
17
- overflow: null,
18
- upload: null,
19
- imageProps: null,
20
- listClassName: null,
21
- listStyle: null,
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(l) {
26
- const n = b(() => `${l.prefixCls}-list`), a = x("file-list-container"), [A, c] = i(!1), h = k();
27
- y(() => {
28
- c(!0), L(() => {
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] = i(!1), [C, u] = i(!1), f = () => {
33
- const e = a.value;
34
- e && (l.overflow === "scrollX" ? (r(Math.abs(e.scrollLeft) >= d), u(e.scrollWidth - e.clientWidth - Math.abs(e.scrollLeft) >= d)) : l.overflow === "scrollY" && (r(e.scrollTop !== 0), u(e.scrollHeight - e.clientHeight !== e.scrollTop)));
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
- R([() => l.overflow, () => l.items.length], () => {
34
+ y([() => e.overflow, () => e.items.length], () => {
37
35
  P(() => {
38
- f();
36
+ m();
39
37
  });
40
38
  }, {
41
39
  immediate: !0
42
40
  });
43
- const m = (e) => {
44
- const o = a.value;
41
+ const u = (l) => {
42
+ const o = i.value;
45
43
  o && o.scrollTo({
46
- left: o.scrollLeft + e * o.clientWidth,
44
+ left: o.scrollLeft + l * o.clientWidth,
47
45
  behavior: "smooth"
48
46
  });
49
47
  }, w = () => {
50
- m(-1);
48
+ u(-1);
51
49
  }, S = () => {
52
- m(1);
50
+ u(1);
53
51
  };
54
52
  return () => t("div", {
55
53
  class: v(n.value, {
56
- [`${n.value}-overflow-${l.overflow}`]: l.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
- }, l.listClassName),
57
+ }, e.listClassName),
60
58
  ref: "file-list-container",
61
- onScroll: f,
62
- style: l.listStyle
63
- }, [l.items.map((e) => t(O, {
64
- key: e.uid,
65
- prefixCls: l.prefixCls,
66
- item: e,
67
- onRemove: l.onRemove,
68
- className: v(l.itemClassName),
69
- imageProps: l.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
- ...l.itemStyle
69
+ ...e.itemStyle
72
70
  }
73
- }, null)), !h.value.disabled && t(F, {
74
- upload: l.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(E, {
77
+ default: () => [t(N, {
80
78
  class: `${n.value}-upload-btn-icon`
81
79
  }, null)]
82
80
  })
83
- }, null), l.overflow === "scrollX" && t(p, null, [t(s, {
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(N, null, null),
85
+ icon: t(p, null, null),
88
86
  onClick: w
89
87
  }, null), t(s, {
90
88
  size: "small",
@@ -1,21 +1,21 @@
1
- import { defineComponent as F, mergeDefaults as G, toRef as v, useAttrs as J, useSlots as Q, computed as L, mergeProps as x, ref as g, watch as C, watchPostEffect as Y, onWatcherCleanup as Z, unref as o, nextTick as k, createVNode as S, renderList as b, withMemo as _ } from "vue";
2
- import { c as tt } from "../chunks/helper-chunk.mjs";
3
- import { b as et } from "../chunks/module-chunk.mjs";
4
- import { useEventCallback as ot } from "../_util/hooks/use-event-callback.mjs";
5
- import st from "../_util/pick-attrs.mjs";
1
+ import { defineComponent as q, mergeDefaults as F, toRef as p, useAttrs as G, useSlots as J, computed as A, mergeProps as v, ref as d, watch as g, watchPostEffect as Q, onWatcherCleanup as Y, unref as o, nextTick as Z, createVNode as x, renderList as k } from "vue";
2
+ import { c as b } from "../chunks/helper-chunk.mjs";
3
+ import { b as _ } from "../chunks/module-chunk.mjs";
4
+ import { useEventCallback as tt } from "../_util/hooks/use-event-callback.mjs";
5
+ import et from "../_util/pick-attrs.mjs";
6
6
  import "../x-provider/index.mjs";
7
- import rt from "./Bubble.mjs";
8
- import at from "./hooks/useDisplayData.mjs";
9
- import nt from "./hooks/useListData.mjs";
10
- import lt from "./style/index.mjs";
11
- import R from "../_util/hooks/use-state.mjs";
12
- import { BubbleContextProvider as it } from "./context.mjs";
13
- import ct from "../x-provider/hooks/use-x-provider-context.mjs";
14
- const mt = 1, At = /* @__PURE__ */ F({
7
+ import ot from "./Bubble.mjs";
8
+ import st from "./hooks/useDisplayData.mjs";
9
+ import rt from "./hooks/useListData.mjs";
10
+ import at from "./style/index.mjs";
11
+ import S from "../_util/hooks/use-state.mjs";
12
+ import { BubbleContextProvider as lt } from "./context.mjs";
13
+ import nt from "../x-provider/hooks/use-x-provider-context.mjs";
14
+ const it = 1, It = /* @__PURE__ */ q({
15
15
  name: "AXBubbleList",
16
16
  inheritAttrs: !1,
17
17
  __name: "BubbleList",
18
- props: G({
18
+ props: F({
19
19
  prefixCls: null,
20
20
  rootClassName: null,
21
21
  items: null,
@@ -27,118 +27,116 @@ const mt = 1, At = /* @__PURE__ */ F({
27
27
  autoScroll: !0
28
28
  }),
29
29
  setup(s, {
30
- expose: N
30
+ expose: L
31
31
  }) {
32
- const B = tt(s, ["prefixCls", "rootClassName", "items", "autoScroll", "roles"]);
33
- v(s, "roles"), v(s, "items"), v(s, "prefixCls");
34
- const P = [];
35
- P[0] = [];
36
- const H = J(), r = Q(), M = L(() => st(x(B, H), {
32
+ const N = b(s, ["prefixCls", "rootClassName", "items", "autoScroll", "roles"]);
33
+ p(s, "roles"), p(s, "items"), p(s, "prefixCls");
34
+ const w = G(), r = J(), B = A(() => et(v(N, w), {
37
35
  attr: !0,
38
36
  aria: !0
39
- })), I = g(s.items), E = g(s.roles);
40
- C(() => s.items, () => {
41
- I.value = s.items;
42
- }), C(() => s.roles, () => {
43
- E.value = s.roles;
37
+ })), R = d(s.items), P = d(s.roles);
38
+ g(() => s.items, () => {
39
+ R.value = s.items;
40
+ }), g(() => s.roles, () => {
41
+ P.value = s.roles;
44
42
  });
45
- const n = g(null), d = g({}), {
46
- getPrefixCls: U
47
- } = ct(), A = U("bubble", s.prefixCls), D = `${A}-list`, [$, z, O] = lt(A), [X, T] = R(!1);
48
- Y(() => {
49
- T(!0), Z(() => {
50
- T(!1);
43
+ const i = d(null), u = d({}), {
44
+ getPrefixCls: H
45
+ } = nt(), I = H("bubble", s.prefixCls), E = `${I}-list`, [U, $, z] = at(I), [X, D] = S(!1);
46
+ Q(() => {
47
+ D(!0), Y(() => {
48
+ D(!1);
51
49
  });
52
50
  });
53
- const K = nt(I, E), [m, W] = at(K), [V, h] = R(!0), [p, w] = R(0), j = (t) => {
51
+ const y = rt(R, P), [m, K] = st(y), [T, C] = S(!0), [h, V] = S(0), M = (t) => {
54
52
  const a = t.target;
55
- h(a.scrollHeight - Math.abs(a.scrollTop) - a.clientHeight <= mt);
53
+ C(a.scrollHeight - Math.abs(a.scrollTop) - a.clientHeight <= it);
56
54
  };
57
- C(p, () => {
58
- s.autoScroll && o(n) && o(V) && k(() => {
59
- o(n).scrollTo({
60
- top: o(n).scrollHeight
55
+ g(h, () => {
56
+ s.autoScroll && o(i) && o(T) && Z(() => {
57
+ o(i).scrollTo({
58
+ top: o(i).scrollHeight
61
59
  });
62
60
  });
63
- }), C(() => o(m).length, () => {
61
+ }), g(() => o(m).length, () => {
64
62
  var t;
65
63
  if (s.autoScroll) {
66
- const a = (t = o(m)[o(m).length - 2]) == null ? void 0 : t.key, e = o(d)[a];
64
+ const a = (t = o(m)[o(m).length - 2]) == null ? void 0 : t.key, e = o(u)[a];
67
65
  if (e) {
68
66
  const {
69
- nativeElement: l
67
+ nativeElement: n
70
68
  } = e, {
71
- top: i = 0,
69
+ top: c = 0,
72
70
  bottom: f = 0
73
- } = (l == null ? void 0 : l.getBoundingClientRect()) ?? {}, {
74
- top: u,
75
- bottom: c
76
- } = o(n).getBoundingClientRect();
77
- i < c && f > u && (w(o(p) + 1), h(!0));
71
+ } = (n == null ? void 0 : n.getBoundingClientRect()) ?? {}, {
72
+ top: l,
73
+ bottom: j
74
+ } = o(i).getBoundingClientRect();
75
+ c < j && f > l && (V(o(h) + 1), C(!0));
78
76
  }
79
77
  }
80
78
  });
81
- const q = ot(() => {
82
- s.autoScroll && w(o(p) + 1);
83
- }), y = L(() => ({
84
- onUpdate: q
79
+ const O = tt(() => {
80
+ s.autoScroll && V(o(h) + 1);
81
+ }), W = A(() => ({
82
+ onUpdate: O
85
83
  }));
86
- return N({
87
- nativeElement: n,
84
+ return L({
85
+ nativeElement: i,
88
86
  scrollTo: ({
89
87
  key: t,
90
88
  offset: a,
91
89
  behavior: e = "smooth",
92
- block: l
90
+ block: n
93
91
  }) => {
94
92
  if (typeof a == "number")
95
- o(n).scrollTo({
93
+ o(i).scrollTo({
96
94
  top: a,
97
95
  behavior: e
98
96
  });
99
97
  else if (t !== void 0) {
100
- const i = o(d)[t];
101
- if (i) {
102
- const f = o(m).findIndex((u) => u.key === t);
103
- h(f === o(m).length - 1), i.nativeElement.scrollIntoView({
98
+ const c = o(u)[t];
99
+ if (c) {
100
+ const f = o(m).findIndex((l) => l.key === t);
101
+ C(f === o(m).length - 1), c.nativeElement.scrollIntoView({
104
102
  behavior: e,
105
- block: l
103
+ block: n
106
104
  });
107
105
  }
108
106
  }
109
107
  }
110
- }), () => $(S(it, {
111
- value: y.value
108
+ }), () => U(x(lt, {
109
+ value: W.value
112
110
  }, {
113
- default: () => [S("div", x(M.value, {
114
- class: et(D, s.rootClassName, z.value, O, {
115
- [`${D}-reach-end`]: V.value
111
+ default: () => [x("div", v(B.value, {
112
+ class: _(E, s.rootClassName, $.value, z, {
113
+ [`${E}-reach-end`]: T.value
116
114
  }),
117
- ref: n,
118
- onScroll: j
119
- }), [b(o(m), ({
115
+ ref: i,
116
+ onScroll: M
117
+ }), [k(o(m), ({
120
118
  key: t,
121
119
  onTypingComplete: a,
122
120
  ...e
123
- }, l) => _([t], () => {
124
- var i, f, u;
125
- return S(rt, x(e, {
121
+ }) => {
122
+ var n, c, f;
123
+ return x(ot, v(e, {
126
124
  avatar: r.avatar ? () => {
127
- var c;
128
- return (c = r.avatar) == null ? void 0 : c.call(r, {
125
+ var l;
126
+ return (l = r.avatar) == null ? void 0 : l.call(r, {
129
127
  item: {
130
128
  key: t,
131
129
  ...e
132
130
  }
133
131
  });
134
132
  } : e.avatar,
135
- header: ((i = r.header) == null ? void 0 : i.call(r, {
133
+ header: ((n = r.header) == null ? void 0 : n.call(r, {
136
134
  item: {
137
135
  key: t,
138
136
  ...e
139
137
  }
140
138
  })) ?? e.header,
141
- footer: ((f = r.footer) == null ? void 0 : f.call(r, {
139
+ footer: ((c = r.footer) == null ? void 0 : c.call(r, {
142
140
  item: {
143
141
  key: t,
144
142
  ...e
@@ -150,25 +148,25 @@ const mt = 1, At = /* @__PURE__ */ F({
150
148
  ...e
151
149
  }
152
150
  }) : e.loadingRender,
153
- content: ((u = r.message) == null ? void 0 : u.call(r, {
151
+ content: ((f = r.message) == null ? void 0 : f.call(r, {
154
152
  item: {
155
153
  key: t,
156
154
  ...e
157
155
  }
158
156
  })) ?? e.content,
159
157
  key: t,
160
- ref: (c) => {
161
- c ? d.value[t] = c : delete d.value[t];
158
+ ref: (l) => {
159
+ l ? u.value[t] = l : delete u.value[t];
162
160
  },
163
161
  typing: X.value ? e.typing : !1,
164
162
  onTypingComplete: () => {
165
- a == null || a(), W(t);
163
+ a == null || a(), K(t);
166
164
  }
167
165
  }), null);
168
- }, P[0], 0 + l + 1))])]
166
+ })])]
169
167
  }));
170
168
  }
171
169
  });
172
170
  export {
173
- At as default
171
+ It as default
174
172
  };
@@ -1,16 +1,16 @@
1
- import { defineComponent as A, mergeDefaults as D, toRef as L, useSlots as X, computed as l, ref as B, createVNode as S } from "vue";
2
- import { q as I, b as N } from "../chunks/module-chunk.mjs";
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 P from "../_util/hooks/use-x-component-config.mjs";
5
- import T from "./style/index.mjs";
6
- import w from "../_util/hooks/use-state.mjs";
7
- import { Cascader as q } from "ant-design-vue";
8
- import z from "./useActive.mjs";
9
- import E from "../x-provider/hooks/use-x-provider-context.mjs";
10
- const Y = /* @__PURE__ */ A({
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: D({
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
- L(e, "prefixCls");
43
- const s = X(), {
44
- direction: x,
45
- getPrefixCls: b
46
- } = E(), n = l(() => b("suggestion", e.prefixCls));
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 a = l(() => x.value === "rtl"), i = P("suggestion"), u = B(), [k, c, r] = T(n), {
48
+ const s = l(() => b.value === "rtl"), i = T("suggestion"), u = B(), [F, c, r] = q(n), {
49
49
  width: f
50
- } = I(u), F = l(() => {
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, O] = w(e.open), [R, V] = w(), o = (t) => {
56
- var h;
57
- O(t), (h = e.onOpenChange) == null || h.call(e, t);
58
- }, d = (t) => {
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
- }, g = () => {
64
+ }, v = () => {
61
65
  o(!1);
62
- }, v = l(() => typeof e.items == "function" ? e.items(R.value) : e.items), C = (t) => {
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] = z(v, m, a, C, g), p = l(() => {
68
+ }, [$, y] = E(C, m, s, h, v), A = l(() => {
65
69
  var t;
66
- return s.default ? s.default({
67
- onTrigger: d,
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: d,
74
+ onTrigger: g,
71
75
  onKeyDown: y
72
76
  });
73
77
  });
74
- return () => k(S(q, {
75
- options: v.value,
78
+ return () => F(N(z, {
79
+ options: C.value,
76
80
  open: m.value,
77
81
  value: $.value,
78
- placement: a.value ? "topRight" : "topLeft",
82
+ placement: s.value ? "topRight" : "topLeft",
79
83
  onDropdownVisibleChange: (t) => {
80
- t || g();
84
+ t || v();
81
85
  },
82
- popupClassName: N(e.rootClassName, n.value, c.value, r, {
86
+ popupClassName: w(e.rootClassName, n.value, c.value, r, {
83
87
  [`${n.value}-block`]: e.block
84
88
  }),
85
- onChange: C,
86
- dropdownStyle: F.value
89
+ onChange: h,
90
+ dropdownStyle: O.value
87
91
  }, {
88
- default: () => S("div", {
92
+ default: () => N("div", {
89
93
  ref: u,
90
- class: N(n.value, i.value.className, e.rootClassName, e.className, `${n.value}-wrapper`, c.value, r),
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
- }, [p.value])
99
+ }, [A.value])
96
100
  }));
97
101
  }
98
102
  });
99
103
  export {
100
- Y as default
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,y=e.defineComponent({name:"AXAttachmentsFileList",__name:"FileList",props:{prefixCls:null,items:null,onRemove:{type:Function},overflow:null,upload:null,imageProps:null,listClassName:null,listStyle:null,itemClassName:null,itemStyle:null},setup(l){const n=e.computed(()=>`${l.prefixCls}-list`),c=e.useTemplateRef("file-list-container"),[L,u]=i.default(!1),h=w.useAttachmentContextInject();e.watchEffect(()=>{u(!0),e.onWatcherCleanup(()=>{u(!1)})});const[g,r]=i.default(!1),[C,f]=i.default(!1),d=()=>{const t=c.value;t&&(l.overflow==="scrollX"?(r(Math.abs(t.scrollLeft)>=v),f(t.scrollWidth-t.clientWidth-Math.abs(t.scrollLeft)>=v)):l.overflow==="scrollY"&&(r(t.scrollTop!==0),f(t.scrollHeight-t.clientHeight!==t.scrollTop)))};e.watch([()=>l.overflow,()=>l.items.length],()=>{e.nextTick(()=>{d()})},{immediate:!0});const m=t=>{const a=c.value;a&&a.scrollTo({left:a.scrollLeft+t*a.clientWidth,behavior:"smooth"})},N=()=>{m(-1)},S=()=>{m(1)};return()=>e.createVNode("div",{class:s.classnames(n.value,{[`${n.value}-overflow-${l.overflow}`]:l.overflow,[`${n.value}-overflow-ping-start`]:g.value,[`${n.value}-overflow-ping-end`]:C.value},l.listClassName),ref:"file-list-container",onScroll:d,style:l.listStyle},[l.items.map(t=>e.createVNode(b.default,{key:t.uid,prefixCls:l.prefixCls,item:t,onRemove:l.onRemove,className:s.classnames(l.itemClassName),imageProps:l.imageProps,style:{...l.itemStyle}},null)),!h.value.disabled&&e.createVNode(V.default,{upload:l.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),l.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=y;
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 e=require("vue"),O=require("../chunks/helper-chunk.js"),U=require("../chunks/module-chunk.js"),z=require("../_util/hooks/use-event-callback.js"),X=require("../_util/pick-attrs.js");require("../x-provider/index.js");const $=require("./Bubble.js"),j=require("./hooks/useDisplayData.js"),y=require("./hooks/useListData.js"),K=require("./style/index.js"),v=require("../_util/hooks/use-state.js"),W=require("./context.js"),F=require("../x-provider/hooks/use-x-provider-context.js"),G=1,J=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:w}){const E=O.createPropsRestProxy(s,["prefixCls","rootClassName","items","autoScroll","roles"]);e.toRef(s,"roles"),e.toRef(s,"items"),e.toRef(s,"prefixCls");const C=[];C[0]=[];const I=e.useAttrs(),r=e.useSlots(),V=e.computed(()=>X.default(e.mergeProps(E,I),{attr:!0,aria:!0})),x=e.ref(s.items),S=e.ref(s.roles);e.watch(()=>s.items,()=>{x.value=s.items}),e.watch(()=>s.roles,()=>{S.value=s.roles});const l=e.ref(null),m=e.ref({}),{getPrefixCls:N}=F.default(),P=N("bubble",s.prefixCls),R=`${P}-list`,[T,A,D]=K.default(P),[b,q]=v.default(!1);e.watchPostEffect(()=>{q(!0),e.onWatcherCleanup(()=>{q(!1)})});const B=y.default(x,S),[c,L]=j.default(B),[p,h]=v.default(!0),[g,_]=v.default(0),M=t=>{const n=t.target;h(n.scrollHeight-Math.abs(n.scrollTop)-n.clientHeight<=G)};e.watch(g,()=>{s.autoScroll&&e.unref(l)&&e.unref(p)&&e.nextTick(()=>{e.unref(l).scrollTo({top:e.unref(l).scrollHeight})})}),e.watch(()=>e.unref(c).length,()=>{var t;if(s.autoScroll){const n=(t=e.unref(c)[e.unref(c).length-2])==null?void 0:t.key,o=e.unref(m)[n];if(o){const{nativeElement:a}=o,{top:i=0,bottom:f=0}=(a==null?void 0:a.getBoundingClientRect())??{},{top:d,bottom:u}=e.unref(l).getBoundingClientRect();i<u&&f>d&&(_(e.unref(g)+1),h(!0))}}});const k=z.useEventCallback(()=>{s.autoScroll&&_(e.unref(g)+1)}),H=e.computed(()=>({onUpdate:k}));return w({nativeElement:l,scrollTo:({key:t,offset:n,behavior:o="smooth",block:a})=>{if(typeof n=="number")e.unref(l).scrollTo({top:n,behavior:o});else if(t!==void 0){const i=e.unref(m)[t];if(i){const f=e.unref(c).findIndex(d=>d.key===t);h(f===e.unref(c).length-1),i.nativeElement.scrollIntoView({behavior:o,block:a})}}}}),()=>T(e.createVNode(W.BubbleContextProvider,{value:H.value},{default:()=>[e.createVNode("div",e.mergeProps(V.value,{class:U.classnames(R,s.rootClassName,A.value,D,{[`${R}-reach-end`]:p.value}),ref:l,onScroll:M}),[e.renderList(e.unref(c),({key:t,onTypingComplete:n,...o},a)=>e.withMemo([t],()=>{var i,f,d;return e.createVNode($.default,e.mergeProps(o,{avatar:r.avatar?()=>{var u;return(u=r.avatar)==null?void 0:u.call(r,{item:{key:t,...o}})}:o.avatar,header:((i=r.header)==null?void 0:i.call(r,{item:{key:t,...o}}))??o.header,footer:((f=r.footer)==null?void 0:f.call(r,{item:{key:t,...o}}))??o.footer,loadingRender:r.loading?()=>r.loading({item:{key:t,...o}}):o.loadingRender,content:((d=r.message)==null?void 0:d.call(r,{item:{key:t,...o}}))??o.content,key:t,ref:u=>{u?m.value[t]=u:delete m.value[t]},typing:b.value?o.typing:!1,onTypingComplete:()=>{n==null||n(),L(t)}}),null)},C[0],0+a+1))])]}))}});exports.default=J;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),M=require("../chunks/helper-chunk.js"),U=require("../chunks/module-chunk.js"),y=require("../_util/hooks/use-event-callback.js"),z=require("../_util/pick-attrs.js");require("../x-provider/index.js");const O=require("./Bubble.js"),X=require("./hooks/useDisplayData.js"),$=require("./hooks/useListData.js"),j=require("./style/index.js"),g=require("../_util/hooks/use-state.js"),K=require("./context.js"),W=require("../x-provider/hooks/use-x-provider-context.js"),F=1,G=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(r,{expose:p}){const E=M.createPropsRestProxy(r,["prefixCls","rootClassName","items","autoScroll","roles"]);e.toRef(r,"roles"),e.toRef(r,"items"),e.toRef(r,"prefixCls");const I=e.useAttrs(),s=e.useSlots(),V=e.computed(()=>z.default(e.mergeProps(E,I),{attr:!0,aria:!0})),v=e.ref(r.items),C=e.ref(r.roles);e.watch(()=>r.items,()=>{v.value=r.items}),e.watch(()=>r.roles,()=>{C.value=r.roles});const u=e.ref(null),d=e.ref({}),{getPrefixCls:w}=W.default(),x=w("bubble",r.prefixCls),S=`${x}-list`,[N,T,D]=j.default(x),[_,P]=g.default(!1);e.watchPostEffect(()=>{P(!0),e.onWatcherCleanup(()=>{P(!1)})});const b=$.default(v,C),[c,A]=X.default(b),[q,m]=g.default(!0),[h,R]=g.default(0),B=t=>{const n=t.target;m(n.scrollHeight-Math.abs(n.scrollTop)-n.clientHeight<=F)};e.watch(h,()=>{r.autoScroll&&e.unref(u)&&e.unref(q)&&e.nextTick(()=>{e.unref(u).scrollTo({top:e.unref(u).scrollHeight})})}),e.watch(()=>e.unref(c).length,()=>{var t;if(r.autoScroll){const n=(t=e.unref(c)[e.unref(c).length-2])==null?void 0:t.key,o=e.unref(d)[n];if(o){const{nativeElement:a}=o,{top:i=0,bottom:f=0}=(a==null?void 0:a.getBoundingClientRect())??{},{top:l,bottom:H}=e.unref(u).getBoundingClientRect();i<H&&f>l&&(R(e.unref(h)+1),m(!0))}}});const L=y.useEventCallback(()=>{r.autoScroll&&R(e.unref(h)+1)}),k=e.computed(()=>({onUpdate:L}));return p({nativeElement:u,scrollTo:({key:t,offset:n,behavior:o="smooth",block:a})=>{if(typeof n=="number")e.unref(u).scrollTo({top:n,behavior:o});else if(t!==void 0){const i=e.unref(d)[t];if(i){const f=e.unref(c).findIndex(l=>l.key===t);m(f===e.unref(c).length-1),i.nativeElement.scrollIntoView({behavior:o,block:a})}}}}),()=>N(e.createVNode(K.BubbleContextProvider,{value:k.value},{default:()=>[e.createVNode("div",e.mergeProps(V.value,{class:U.classnames(S,r.rootClassName,T.value,D,{[`${S}-reach-end`]:q.value}),ref:u,onScroll:B}),[e.renderList(e.unref(c),({key:t,onTypingComplete:n,...o})=>{var a,i,f;return e.createVNode(O.default,e.mergeProps(o,{avatar:s.avatar?()=>{var l;return(l=s.avatar)==null?void 0:l.call(s,{item:{key:t,...o}})}:o.avatar,header:((a=s.header)==null?void 0:a.call(s,{item:{key:t,...o}}))??o.header,footer:((i=s.footer)==null?void 0:i.call(s,{item:{key:t,...o}}))??o.footer,loadingRender:s.loading?()=>s.loading({item:{key:t,...o}}):o.loadingRender,content:((f=s.message)==null?void 0:f.call(s,{item:{key:t,...o}}))??o.content,key:t,ref:l=>{l?d.value[t]=l:delete d.value[t]},typing:_.value?o.typing:!1,onTypingComplete:()=>{n==null||n(),A(t)}}),null)})])]}))}});exports.default=G;
@@ -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"),N=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:q,getPrefixCls:k}=L.default(),l=n.computed(()=>k("suggestion",e.prefixCls));`${l.value}`;const a=n.computed(()=>q.value==="rtl"),i=P.default("suggestion"),c=n.ref(),[w,r,d]=R.default(l),{width:f}=o.useElementSize(c),x=n.computed(()=>{if(e.block&&f.value)return{width:`${f.value}px`}}),[m,b]=N.default(e.open),[V,O]=N.default(),s=t=>{var S;b(t),(S=e.onOpenChange)==null||S.call(e,t)},g=t=>{t===!1?s(!1):(O(t),s(!0))},v=()=>{s(!1)},C=n.computed(()=>typeof e.items=="function"?e.items(V.value):e.items),h=t=>{e.onSelect&&e.onSelect(t[t.length-1]),s(!1)},[D,y]=A.default(C,m,a,h,v),F=n.computed(()=>{var t;return u.default?u.default({onTrigger:g,onKeyDown:y}):(t=e.children)==null?void 0:t.call(e,{onTrigger:g,onKeyDown:y})});return()=>w(n.createVNode($.Cascader,{options:C.value,open:m.value,value:D.value,placement:a.value?"topRight":"topLeft",onDropdownVisibleChange:t=>{t||v()},popupClassName:o.classnames(e.rootClassName,l.value,r.value,d,{[`${l.value}-block`]:e.block}),onChange:h,dropdownStyle:x.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;
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.0",
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, RequestFnInfo<Message_1>, Partial<Record<import("../x-stream").SSEFields, any>>>>[];
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 {};