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.
@@ -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,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 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.1",
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 {};