ant-design-x-vue 1.3.2 → 1.4.0

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 (52) hide show
  1. package/dist/index.esm.js +7971 -7704
  2. package/dist/index.esm.min.js +2 -2
  3. package/dist/index.umd.js +63 -63
  4. package/es/actions/ActionMenu.mjs +67 -0
  5. package/es/actions/Actions.mjs +100 -0
  6. package/es/actions/index.mjs +8 -0
  7. package/es/actions/interface.mjs +1 -0
  8. package/es/actions/style/index.mjs +76 -0
  9. package/es/attachments/FileList/FileList.mjs +121 -69
  10. package/es/attachments/FileList/FileListCard.mjs +64 -66
  11. package/es/attachments/PlaceholderUploader.mjs +2 -3
  12. package/es/attachments/constants.mjs +12 -0
  13. package/es/attachments/util.mjs +24 -20
  14. package/es/bubble/BubbleList.mjs +36 -35
  15. package/es/components.mjs +22 -19
  16. package/es/components.ts-chunk.mjs +5 -2
  17. package/es/index.mjs +42 -40
  18. package/es/prompts/Prompts.mjs +1 -3
  19. package/es/sender/useSpeech.mjs +25 -24
  20. package/es/x-provider/index-chunk.mjs +1 -0
  21. package/lib/actions/ActionMenu.js +1 -0
  22. package/lib/actions/Actions.js +1 -0
  23. package/lib/actions/index.js +1 -0
  24. package/lib/actions/interface.js +1 -0
  25. package/lib/actions/style/index.js +1 -0
  26. package/lib/attachments/FileList/FileList.js +1 -1
  27. package/lib/attachments/FileList/FileListCard.js +1 -1
  28. package/lib/attachments/PlaceholderUploader.js +1 -1
  29. package/lib/attachments/constants.js +1 -0
  30. package/lib/attachments/util.js +1 -1
  31. package/lib/bubble/BubbleList.js +1 -1
  32. package/lib/components.js +1 -1
  33. package/lib/components.ts-chunk.js +1 -1
  34. package/lib/index.js +1 -1
  35. package/lib/prompts/Prompts.js +1 -1
  36. package/lib/sender/useSpeech.js +1 -1
  37. package/lib/x-provider/index-chunk.js +1 -1
  38. package/package.json +2 -1
  39. package/typings/_util/cssinjs/StyleContext.d.ts +6 -6
  40. package/typings/_util/cssinjs/index.d.ts +3 -3
  41. package/typings/actions/ActionMenu.vue.d.ts +21 -0
  42. package/typings/actions/Actions.vue.d.ts +22 -0
  43. package/typings/actions/index.d.ts +4 -0
  44. package/typings/actions/interface.d.ts +105 -0
  45. package/typings/actions/style/index.d.ts +8 -0
  46. package/typings/attachments/constants.d.ts +9 -0
  47. package/typings/attachments/util.d.ts +1 -0
  48. package/typings/bubble/index.d.ts +26 -26
  49. package/typings/components.d.ts +1 -0
  50. package/typings/prompts/interface.d.ts +2 -1
  51. package/typings/theme/components.d.ts +2 -0
  52. package/typings/x-provider/context.d.ts +2 -0
@@ -0,0 +1,67 @@
1
+ import { defineComponent as g, computed as o, createVNode as r } from "vue";
2
+ import { Dropdown as k } from "ant-design-vue";
3
+ import "../x-provider/index.mjs";
4
+ import x from "../x-provider/hooks/use-x-provider-context.mjs";
5
+ import { E as h } from "../chunks/module-chunk.mjs";
6
+ const E = /* @__PURE__ */ g({
7
+ name: "AXActionMenu",
8
+ __name: "ActionMenu",
9
+ props: {
10
+ item: null,
11
+ prefixCls: null
12
+ },
13
+ emits: ["click"],
14
+ setup(u, {
15
+ emit: p
16
+ }) {
17
+ const t = u, a = p, c = (i, n) => {
18
+ const s = i[0];
19
+ for (const e of n)
20
+ if (e.key === s) {
21
+ if (i.length === 1) return e;
22
+ if ("children" in e && e.children)
23
+ return c(i.slice(1), e.children);
24
+ }
25
+ return null;
26
+ }, {
27
+ getPrefixCls: f
28
+ } = x(), l = f("actions", t.prefixCls), d = o(() => {
29
+ var i;
30
+ return ((i = t.item) == null ? void 0 : i.icon) ?? r(h, null, null);
31
+ }), m = o(() => t.item.children || []), v = o(() => t.item.triggerSubMenuAction || "hover"), C = o(() => ({
32
+ items: m.value,
33
+ onClick: ({
34
+ key: i,
35
+ keyPath: n,
36
+ domEvent: s
37
+ }) => {
38
+ const e = c(n, m.value);
39
+ if (e != null && e.onItemClick) {
40
+ e.onItemClick(e);
41
+ return;
42
+ }
43
+ a("click", {
44
+ key: i,
45
+ keyPath: [...n, t.item.key],
46
+ domEvent: s,
47
+ item: e
48
+ });
49
+ }
50
+ }));
51
+ return () => r(k, {
52
+ menu: C.value,
53
+ overlayClassName: `${l}-sub-item`,
54
+ arrow: !0,
55
+ trigger: [v.value]
56
+ }, {
57
+ default: () => [r("div", {
58
+ class: `${l}-list-item`
59
+ }, [r("div", {
60
+ class: `${l}-list-item-icon`
61
+ }, [d.value])])]
62
+ });
63
+ }
64
+ });
65
+ export {
66
+ E as default
67
+ };
@@ -0,0 +1,100 @@
1
+ import { defineComponent as P, computed as i, createVNode as r, mergeProps as p, isVNode as $ } from "vue";
2
+ import { Tooltip as j } from "ant-design-vue";
3
+ import { b as c } from "../chunks/module-chunk.mjs";
4
+ import A from "../_util/pick-attrs.mjs";
5
+ import V from "../_util/hooks/use-x-component-config.mjs";
6
+ import "../x-provider/index.mjs";
7
+ import X from "./ActionMenu.mjs";
8
+ import O from "./style/index.mjs";
9
+ import T from "../x-provider/hooks/use-x-provider-context.mjs";
10
+ function w(s) {
11
+ return typeof s == "function" || Object.prototype.toString.call(s) === "[object Object]" && !$(s);
12
+ }
13
+ const J = /* @__PURE__ */ P({
14
+ name: "AXActions",
15
+ __name: "Actions",
16
+ props: {
17
+ items: {
18
+ default: () => []
19
+ },
20
+ rootClassName: {
21
+ default: ""
22
+ },
23
+ block: {
24
+ type: Boolean,
25
+ default: !1
26
+ },
27
+ onClick: {
28
+ type: Function
29
+ },
30
+ style: null,
31
+ variant: {
32
+ default: "borderless"
33
+ },
34
+ prefixCls: null
35
+ },
36
+ emits: ["click"],
37
+ setup(s, {
38
+ emit: f
39
+ }) {
40
+ const o = s, a = f, {
41
+ getPrefixCls: d,
42
+ direction: C
43
+ } = T(), l = d("actions", o.prefixCls), m = V("actions"), [k, y, v] = O(l), b = i(() => c(l, m.value.className, o.rootClassName, v, y.value, {
44
+ [`${l}-rtl`]: C.value === "rtl"
45
+ })), g = i(() => ({
46
+ ...m.value.style,
47
+ ...typeof o.style == "object" ? o.style : {}
48
+ })), x = (t, e, n) => e ? r(j, p(n, {
49
+ title: e
50
+ }), w(t) ? t : {
51
+ default: () => [t]
52
+ }) : t, h = (t, e, n) => {
53
+ if (e.onItemClick) {
54
+ e.onItemClick(e);
55
+ return;
56
+ }
57
+ a("click", {
58
+ key: t,
59
+ item: e,
60
+ keyPath: [t],
61
+ domEvent: n
62
+ });
63
+ }, S = (t) => {
64
+ a("click", t);
65
+ }, _ = (t) => {
66
+ const {
67
+ icon: e,
68
+ label: n,
69
+ key: u
70
+ } = t;
71
+ return r("div", {
72
+ class: c(`${l}-list-item`),
73
+ onClick: (I) => h(u, t, I),
74
+ key: u
75
+ }, [x(r("div", {
76
+ class: `${l}-list-item-icon`
77
+ }, [e]), n)]);
78
+ }, N = i(() => A(o, {
79
+ aria: !0,
80
+ data: !0
81
+ }));
82
+ return () => k(r("div", p({
83
+ class: b.value
84
+ }, N.value, {
85
+ style: g.value
86
+ }), [r("div", {
87
+ class: c(`${l}-list`, o.variant, {
88
+ block: o.block
89
+ })
90
+ }, [o.items.map((t) => "children" in t && t.children ? r(X, {
91
+ key: t.key,
92
+ item: t,
93
+ prefixCls: l,
94
+ onClick: S
95
+ }, null) : _(t))])]));
96
+ }
97
+ });
98
+ export {
99
+ J as default
100
+ };
@@ -0,0 +1,8 @@
1
+ import n from "./Actions.mjs";
2
+ n.install = function(t) {
3
+ return t.component(n.name, n), t;
4
+ };
5
+ export {
6
+ n as Actions,
7
+ n as default
8
+ };
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,76 @@
1
+ import "vue";
2
+ import "../../_util/cssinjs/StyleContext.mjs";
3
+ import "../../_util/cssinjs/theme/ThemeCache.mjs";
4
+ import "../../_util/warning.mjs";
5
+ import "../../_util/cssinjs/transformers/legacyLogicalProperties.mjs";
6
+ import { merge as e } from "../../_util/cssinjs-utils/util/statistic.mjs";
7
+ import { genStyleHooks as t } from "../../theme/genStyleUtils.mjs";
8
+ const n = (i) => {
9
+ const { componentCls: o, calc: r } = i;
10
+ return {
11
+ [o]: {
12
+ [`&${o}-rtl`]: {
13
+ direction: "rtl"
14
+ },
15
+ [`${o}-list`]: {
16
+ display: "inline-flex",
17
+ flexDirection: "row",
18
+ gap: i.paddingXS,
19
+ color: i.colorTextDescription,
20
+ "&-item, &-sub-item": {
21
+ cursor: "pointer",
22
+ padding: i.paddingXXS,
23
+ borderRadius: i.borderRadius,
24
+ height: i.controlHeightSM,
25
+ width: i.controlHeightSM,
26
+ boxSizing: "border-box",
27
+ display: "inline-flex",
28
+ alignItems: "center",
29
+ justifyContent: "center",
30
+ "&-icon": {
31
+ display: "inline-flex",
32
+ alignItems: "center",
33
+ justifyContent: "center",
34
+ fontSize: i.fontSize,
35
+ width: "100%",
36
+ height: "100%"
37
+ },
38
+ "&:hover": {
39
+ background: i.colorBgTextHover
40
+ }
41
+ }
42
+ },
43
+ "& .border": {
44
+ padding: `${i.paddingXS}px ${i.paddingSM}px`,
45
+ gap: i.paddingSM,
46
+ borderRadius: r(i.borderRadiusLG).mul(1.5).equal(),
47
+ backgroundColor: i.colorBorderSecondary,
48
+ color: i.colorTextSecondary,
49
+ [`${o}-list-item, ${o}-list-sub-item`]: {
50
+ padding: 0,
51
+ lineHeight: i.lineHeight,
52
+ "&-icon": {
53
+ fontSize: i.fontSizeLG
54
+ },
55
+ "&:hover": {
56
+ opacity: 0.8
57
+ }
58
+ }
59
+ },
60
+ "& .block": {
61
+ display: "flex"
62
+ }
63
+ }
64
+ };
65
+ }, d = () => ({}), u = t(
66
+ "Actions",
67
+ (i) => {
68
+ const o = e(i, {});
69
+ return [n(o)];
70
+ },
71
+ d
72
+ );
73
+ export {
74
+ u as default,
75
+ d as prepareComponentToken
76
+ };
@@ -1,11 +1,14 @@
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";
1
+ import { defineComponent as b, computed as $, useTemplateRef as E, watchEffect as N, onWatcherCleanup as P, watch as k, nextTick as O, createVNode as i, TransitionGroup as T, Fragment as I, isVNode as j } from "vue";
2
+ import { b as g, P as A, L as F, R as M } from "../../chunks/module-chunk.mjs";
3
3
  import { Button as s } from "ant-design-vue";
4
- import a from "../../_util/hooks/use-state.mjs";
5
- import { useAttachmentContextInject as k } from "../context.mjs";
6
- import O from "../SilentUploader.mjs";
7
- import A from "./FileListCard.mjs";
8
- const d = 1, I = /* @__PURE__ */ $({
4
+ import c from "../../_util/hooks/use-state.mjs";
5
+ import { useAttachmentContextInject as W } from "../context.mjs";
6
+ import X from "../SilentUploader.mjs";
7
+ import z from "./FileListCard.mjs";
8
+ function H(t) {
9
+ return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !j(t);
10
+ }
11
+ const p = 1, Q = /* @__PURE__ */ b({
9
12
  name: "AXAttachmentsFileList",
10
13
  __name: "FileList",
11
14
  props: {
@@ -20,79 +23,128 @@ const d = 1, I = /* @__PURE__ */ $({
20
23
  itemClassName: {},
21
24
  itemStyle: {}
22
25
  },
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(() => {
27
- c(!1);
26
+ setup(t) {
27
+ const n = $(() => `${t.prefixCls}-list`), r = E("file-list-container"), [V, m] = c(!1), v = W();
28
+ N(() => {
29
+ m(!0), P(() => {
30
+ m(!1);
28
31
  });
29
32
  });
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)));
33
+ const [w, f] = c(!1), [x, u] = c(!1), d = () => {
34
+ const e = r.value;
35
+ e && (t.overflow === "scrollX" ? (f(Math.abs(e.scrollLeft) >= p), u(e.scrollWidth - e.clientWidth - Math.abs(e.scrollLeft) >= p)) : t.overflow === "scrollY" && (f(e.scrollTop !== 0), u(e.scrollHeight - e.clientHeight !== e.scrollTop)));
33
36
  };
34
- y([() => e.overflow, () => e.items.length], () => {
35
- P(() => {
36
- m();
37
+ k([() => t.overflow, () => t.items.length], () => {
38
+ O(() => {
39
+ d();
37
40
  });
38
41
  }, {
39
42
  immediate: !0
40
43
  });
41
- const u = (l) => {
42
- const o = i.value;
43
- o && o.scrollTo({
44
- left: o.scrollLeft + l * o.clientWidth,
44
+ const h = (e) => {
45
+ const l = r.value;
46
+ l && l.scrollTo({
47
+ left: l.scrollLeft + e * l.clientWidth,
45
48
  behavior: "smooth"
46
49
  });
47
- }, w = () => {
48
- u(-1);
49
- }, S = () => {
50
- u(1);
51
- };
52
- return () => t("div", {
53
- class: v(n.value, {
54
- [`${n.value}-overflow-${e.overflow}`]: e.overflow,
55
- [`${n.value}-overflow-ping-start`]: g.value,
56
- [`${n.value}-overflow-ping-end`]: C.value
57
- }, e.listClassName),
58
- ref: "file-list-container",
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,
68
- style: {
69
- ...e.itemStyle
70
- }
71
- }, null)), !h.value.disabled && t(O, {
72
- upload: e.upload,
73
- children: t(s, {
74
- class: `${n.value}-upload-btn`,
75
- type: "dashed"
50
+ }, y = () => {
51
+ h(-1);
52
+ }, C = () => {
53
+ h(1);
54
+ }, L = (e, l) => {
55
+ const a = e.classList.contains("ant-attachment-list-card-type-preview") ? [{
56
+ width: "0px"
57
+ }, {
58
+ width: "64px"
59
+ }] : [{
60
+ width: "0px"
61
+ }, {
62
+ width: "236px"
63
+ }], o = e.animate(a, {
64
+ duration: 300,
65
+ easing: "ease",
66
+ fill: "forwards"
67
+ });
68
+ o.onfinish = () => l();
69
+ }, R = (e, l) => {
70
+ const a = e.classList.contains("ant-attachment-list-card-type-preview") ? [{
71
+ opacity: 1,
72
+ width: "64px",
73
+ marginRight: "0px"
76
74
  }, {
77
- default: () => [t(N, {
78
- class: `${n.value}-upload-btn-icon`
79
- }, null)]
80
- })
81
- }, null), e.overflow === "scrollX" && t(E, null, [t(s, {
82
- size: "small",
83
- shape: "circle",
84
- class: `${n.value}-prev-btn`,
85
- icon: t(p, null, null),
86
- onClick: w
87
- }, null), t(s, {
88
- size: "small",
89
- shape: "circle",
90
- class: `${n.value}-next-btn`,
91
- icon: t(T, null, null),
92
- onClick: S
93
- }, null)])]);
75
+ opacity: 0,
76
+ width: "0px",
77
+ marginRight: "-10px"
78
+ }] : [{
79
+ opacity: 1,
80
+ width: "236px",
81
+ marginRight: "0px"
82
+ }, {
83
+ opacity: 0,
84
+ width: "0px",
85
+ marginRight: "-10px",
86
+ paddingRight: "0px",
87
+ paddingLeft: "0px"
88
+ }], o = e.animate(a, {
89
+ duration: 300,
90
+ easing: "ease",
91
+ fill: "forwards"
92
+ });
93
+ o.onfinish = () => l();
94
+ };
95
+ return () => {
96
+ let e;
97
+ return i("div", {
98
+ class: g(n.value, {
99
+ [`${n.value}-overflow-${t.overflow}`]: t.overflow,
100
+ [`${n.value}-overflow-ping-start`]: w.value,
101
+ [`${n.value}-overflow-ping-end`]: x.value
102
+ }, t.listClassName),
103
+ ref: "file-list-container",
104
+ onScroll: d,
105
+ style: t.listStyle
106
+ }, [i(T, {
107
+ onEnter: L,
108
+ onLeave: R,
109
+ css: !1
110
+ }, H(e = t.items.map((l) => i(z, {
111
+ key: l.uid,
112
+ prefixCls: t.prefixCls,
113
+ item: l,
114
+ onRemove: t.onRemove,
115
+ className: g(t.itemClassName),
116
+ imageProps: t.imageProps,
117
+ style: {
118
+ ...t.itemStyle
119
+ }
120
+ }, null))) ? e : {
121
+ default: () => [e]
122
+ }), !v.value.disabled && i(X, {
123
+ upload: t.upload,
124
+ children: i(s, {
125
+ class: `${n.value}-upload-btn`,
126
+ type: "dashed"
127
+ }, {
128
+ default: () => [i(A, {
129
+ class: `${n.value}-upload-btn-icon`
130
+ }, null)]
131
+ })
132
+ }, null), t.overflow === "scrollX" && i(I, null, [i(s, {
133
+ size: "small",
134
+ shape: "circle",
135
+ class: `${n.value}-prev-btn`,
136
+ icon: i(F, null, null),
137
+ onClick: y
138
+ }, null), i(s, {
139
+ size: "small",
140
+ shape: "circle",
141
+ class: `${n.value}-next-btn`,
142
+ icon: i(M, null, null),
143
+ onClick: C
144
+ }, null)])]);
145
+ };
94
146
  }
95
147
  });
96
148
  export {
97
- I as default
149
+ Q as default
98
150
  };