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,22 @@
1
+ import type { ActionsProps, ActionItem } from './interface';
2
+ declare const _default: import("vue").DefineComponent<ActionsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ click: (menuInfo: {
4
+ item: ActionItem;
5
+ key: string;
6
+ keyPath: string[];
7
+ domEvent: MouseEvent | KeyboardEvent;
8
+ }) => any;
9
+ }, string, import("vue").PublicProps, Readonly<ActionsProps> & Readonly<{
10
+ onClick?: (menuInfo: {
11
+ item: ActionItem;
12
+ key: string;
13
+ keyPath: string[];
14
+ domEvent: MouseEvent | KeyboardEvent;
15
+ }) => any;
16
+ }>, {
17
+ items: ActionItem[];
18
+ rootClassName: string;
19
+ block: boolean;
20
+ variant: "borderless" | "border";
21
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import Actions from './Actions.vue';
2
+ export type { ActionsProps, ActionItem, ItemType, SubItemType } from './interface';
3
+ export default Actions;
4
+ export { Actions, };
@@ -0,0 +1,105 @@
1
+ import type { MenuItemProps, MenuProps } from 'ant-design-vue';
2
+ import type { CSSProperties, HTMLAttributes, VNode } from 'vue';
3
+ type DataAttributes = {
4
+ [Key in `data-${string}`]: string | number;
5
+ };
6
+ export interface SubItemType extends Pick<MenuItemProps, 'danger'>, DataAttributes {
7
+ /**
8
+ * @desc 自定义操作的显示标签
9
+ * @descEN Display label for the custom action.
10
+ */
11
+ label?: string;
12
+ /**
13
+ * @desc 自定义操作的唯一标识
14
+ * @descEN Unique identifier for the custom action.
15
+ */
16
+ key: string;
17
+ /**
18
+ * @desc 自定义操作的图标
19
+ * @descEN Icon for the custom action.
20
+ */
21
+ icon?: VNode;
22
+ /**
23
+ * @desc 点击自定义操作按钮时的回调函数
24
+ * @descEN Callback function when the custom action button is clicked.
25
+ */
26
+ onItemClick?: (info?: ActionItem) => void;
27
+ }
28
+ export interface ItemType extends DataAttributes {
29
+ /**
30
+ * @desc 自定义操作的唯一标识
31
+ * @descEN Unique identifier for the custom action.
32
+ */
33
+ key: string;
34
+ /**
35
+ * @desc 自定义操作的显示标签
36
+ * @descEN Display label for the custom action.
37
+ */
38
+ label?: string;
39
+ /**
40
+ * @desc 自定义操作的图标
41
+ * @descEN Icon for the custom action.
42
+ */
43
+ icon?: VNode;
44
+ /**
45
+ * @desc 子操作项
46
+ * @descEN Child action items.
47
+ */
48
+ children?: ActionItem[];
49
+ /**
50
+ * @desc 触发子菜单的操作方式
51
+ * @descEN Action to trigger the sub-menu.
52
+ */
53
+ triggerSubMenuAction?: MenuProps['triggerSubMenuAction'];
54
+ /**
55
+ * @desc 点击自定义操作按钮时的回调函数
56
+ * @descEN Callback function when the custom action button is clicked.
57
+ */
58
+ onItemClick?: (info?: ActionItem) => void;
59
+ }
60
+ export type ActionItem = SubItemType | ItemType;
61
+ export interface ActionsProps extends Omit<HTMLAttributes, 'onClick'> {
62
+ /**
63
+ * @desc 包含多个操作项的列表
64
+ * @descEN A list containing multiple action items.
65
+ */
66
+ items: ActionItem[];
67
+ /**
68
+ * @desc 根节点样式类
69
+ * @descEN Root node style class.
70
+ */
71
+ rootClassName?: string;
72
+ /**
73
+ * @desc 子操作项是否占据一行
74
+ * @descEN Whether the child action items occupy a line.
75
+ * @default false
76
+ */
77
+ block?: boolean;
78
+ /**
79
+ * @desc Item 操作项被点击时的回调函数。
80
+ * @descEN Callback function when an action item is clicked.
81
+ */
82
+ onClick?: (menuInfo: {
83
+ item: ActionItem;
84
+ key: string;
85
+ keyPath: string[];
86
+ domEvent: MouseEvent | KeyboardEvent;
87
+ }) => void;
88
+ /**
89
+ * @desc 根节点样式
90
+ * @descEN Style for the root node.
91
+ */
92
+ style?: CSSProperties;
93
+ /**
94
+ * @desc 变体
95
+ * @descEN Variant.
96
+ * @default 'borderless'
97
+ */
98
+ variant?: 'borderless' | 'border';
99
+ /**
100
+ * @desc 样式类名的前缀。
101
+ * @descEN Prefix for style class names.
102
+ */
103
+ prefixCls?: string;
104
+ }
105
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { FullToken, GetDefaultToken } from '../../theme/cssinjs-utils';
2
+ export interface ComponentToken {
3
+ }
4
+ export interface ActionsToken extends FullToken<'Actions'> {
5
+ }
6
+ export declare const prepareComponentToken: GetDefaultToken<'Actions'>;
7
+ declare const _default: (prefixCls: import("vue").MaybeRefOrGetter<string>, rootCls?: string) => readonly [(node: import("vue").VNode) => import("vue").VNode, import("vue").Ref<string, string>, string];
8
+ export default _default;
@@ -0,0 +1,9 @@
1
+ export declare const IMG_EXTS: Set<string>;
2
+ export declare const AUDIO_EXTS: Set<string>;
3
+ export declare const VIDEO_EXTS: Set<string>;
4
+ export declare const MARKDOWN_EXTS: Set<string>;
5
+ export declare const ZIP_EXTS: Set<string>;
6
+ export declare const EXCEL_EXTS: Set<string>;
7
+ export declare const PPT_EXTS: Set<string>;
8
+ export declare const WORD_EXTS: Set<string>;
9
+ export declare const PDF_EXTS: Set<string>;
@@ -1,2 +1,3 @@
1
1
  export declare const isImageFileType: (type: string) => boolean;
2
2
  export declare function previewImage(file: File | Blob): Promise<string>;
3
+ export declare function matchExt(suffix: string, ext: Set<string>): boolean;
@@ -1,6 +1,7 @@
1
1
  import BubbleList from './BubbleList.vue';
2
2
  export type { BubbleProps, BubbleListProps } from './interface';
3
3
  declare const Bubble: (<T extends import("./interface").BubbleContentType = string>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
4
+ attrs: any;
4
5
  slots: Readonly<{
5
6
  avatar?(): import("vue").VNode;
6
7
  header?(props: {
@@ -30,7 +31,6 @@ declare const Bubble: (<T extends import("./interface").BubbleContentType = stri
30
31
  content: T;
31
32
  }): import("vue").VNode | string;
32
33
  };
33
- attrs: any;
34
34
  emit: {};
35
35
  }, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
36
36
  props: {
@@ -55,7 +55,9 @@ declare const Bubble: (<T extends import("./interface").BubbleContentType = stri
55
55
  footer?: string | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
56
56
  [key: string]: any;
57
57
  }> | ((content: T, info: import("./interface").SlotInfoType) => import("vue").VNode | string);
58
+ role?: string;
58
59
  style?: import("vue").StyleValue;
60
+ onClick?: (payload: MouseEvent) => void;
59
61
  onCopy?: (payload: ClipboardEvent) => void;
60
62
  onCut?: (payload: ClipboardEvent) => void;
61
63
  onPaste?: (payload: ClipboardEvent) => void;
@@ -86,7 +88,6 @@ declare const Bubble: (<T extends import("./interface").BubbleContentType = stri
86
88
  onKeypress?: (payload: KeyboardEvent) => void;
87
89
  onKeyup?: (payload: KeyboardEvent) => void;
88
90
  onAuxclick?: (payload: MouseEvent) => void;
89
- onClick?: (payload: MouseEvent) => void;
90
91
  onContextmenu?: (payload: MouseEvent) => void;
91
92
  onDblclick?: (payload: MouseEvent) => void;
92
93
  onMousedown?: (payload: MouseEvent) => void;
@@ -142,21 +143,20 @@ declare const Bubble: (<T extends import("./interface").BubbleContentType = stri
142
143
  innerHTML?: string;
143
144
  class?: any;
144
145
  accesskey?: string;
145
- contenteditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only";
146
+ contenteditable?: (boolean | "false" | "true") | "inherit" | "plaintext-only";
146
147
  contextmenu?: string;
147
148
  dir?: string;
148
- draggable?: boolean | "true" | "false";
149
- hidden?: (boolean | "true" | "false") | "" | "hidden" | "until-found";
149
+ draggable?: boolean | "false" | "true";
150
+ hidden?: (boolean | "false" | "true") | "" | "hidden" | "until-found";
150
151
  id?: string;
151
- inert?: boolean | "true" | "false";
152
+ inert?: boolean | "false" | "true";
152
153
  lang?: string;
153
154
  placeholder?: string;
154
- spellcheck?: boolean | "true" | "false";
155
+ spellcheck?: boolean | "false" | "true";
155
156
  tabindex?: string | number;
156
157
  title?: string;
157
158
  translate?: "yes" | "no";
158
159
  radiogroup?: string;
159
- role?: string;
160
160
  about?: string;
161
161
  datatype?: string;
162
162
  inlist?: any;
@@ -170,7 +170,7 @@ declare const Bubble: (<T extends import("./interface").BubbleContentType = stri
170
170
  autosave?: string;
171
171
  color?: string;
172
172
  itemprop?: string;
173
- itemscope?: boolean | "true" | "false";
173
+ itemscope?: boolean | "false" | "true";
174
174
  itemtype?: string;
175
175
  itemid?: string;
176
176
  itemref?: string;
@@ -180,47 +180,47 @@ declare const Bubble: (<T extends import("./interface").BubbleContentType = stri
180
180
  inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search";
181
181
  is?: string;
182
182
  'aria-activedescendant'?: string;
183
- 'aria-atomic'?: boolean | "true" | "false";
183
+ 'aria-atomic'?: boolean | "false" | "true";
184
184
  'aria-autocomplete'?: "none" | "inline" | "list" | "both";
185
- 'aria-busy'?: boolean | "true" | "false";
186
- 'aria-checked'?: (boolean | "true" | "false") | "mixed";
185
+ 'aria-busy'?: boolean | "false" | "true";
186
+ 'aria-checked'?: (boolean | "false" | "true") | "mixed";
187
187
  'aria-colcount'?: string | number;
188
188
  'aria-colindex'?: string | number;
189
189
  'aria-colspan'?: string | number;
190
190
  'aria-controls'?: string;
191
- 'aria-current'?: (boolean | "true" | "false") | "page" | "step" | "location" | "date" | "time";
191
+ 'aria-current'?: (boolean | "false" | "true") | "page" | "step" | "location" | "date" | "time";
192
192
  'aria-describedby'?: string;
193
193
  'aria-details'?: string;
194
- 'aria-disabled'?: boolean | "true" | "false";
194
+ 'aria-disabled'?: boolean | "false" | "true";
195
195
  'aria-dropeffect'?: "none" | "copy" | "execute" | "link" | "move" | "popup";
196
196
  'aria-errormessage'?: string;
197
- 'aria-expanded'?: boolean | "true" | "false";
197
+ 'aria-expanded'?: boolean | "false" | "true";
198
198
  'aria-flowto'?: string;
199
- 'aria-grabbed'?: boolean | "true" | "false";
200
- 'aria-haspopup'?: (boolean | "true" | "false") | "menu" | "listbox" | "tree" | "grid" | "dialog";
201
- 'aria-hidden'?: boolean | "true" | "false";
202
- 'aria-invalid'?: (boolean | "true" | "false") | "grammar" | "spelling";
199
+ 'aria-grabbed'?: boolean | "false" | "true";
200
+ 'aria-haspopup'?: (boolean | "false" | "true") | "menu" | "listbox" | "tree" | "grid" | "dialog";
201
+ 'aria-hidden'?: boolean | "false" | "true";
202
+ 'aria-invalid'?: (boolean | "false" | "true") | "grammar" | "spelling";
203
203
  'aria-keyshortcuts'?: string;
204
204
  'aria-label'?: string;
205
205
  'aria-labelledby'?: string;
206
206
  'aria-level'?: string | number;
207
207
  'aria-live'?: "off" | "assertive" | "polite";
208
- 'aria-modal'?: boolean | "true" | "false";
209
- 'aria-multiline'?: boolean | "true" | "false";
210
- 'aria-multiselectable'?: boolean | "true" | "false";
208
+ 'aria-modal'?: boolean | "false" | "true";
209
+ 'aria-multiline'?: boolean | "false" | "true";
210
+ 'aria-multiselectable'?: boolean | "false" | "true";
211
211
  'aria-orientation'?: "horizontal" | "vertical";
212
212
  'aria-owns'?: string;
213
213
  'aria-placeholder'?: string;
214
214
  'aria-posinset'?: string | number;
215
- 'aria-pressed'?: (boolean | "true" | "false") | "mixed";
216
- 'aria-readonly'?: boolean | "true" | "false";
215
+ 'aria-pressed'?: (boolean | "false" | "true") | "mixed";
216
+ 'aria-readonly'?: boolean | "false" | "true";
217
217
  'aria-relevant'?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals";
218
- 'aria-required'?: boolean | "true" | "false";
218
+ 'aria-required'?: boolean | "false" | "true";
219
219
  'aria-roledescription'?: string;
220
220
  'aria-rowcount'?: string | number;
221
221
  'aria-rowindex'?: string | number;
222
222
  'aria-rowspan'?: string | number;
223
- 'aria-selected'?: boolean | "true" | "false";
223
+ 'aria-selected'?: boolean | "false" | "true";
224
224
  'aria-setsize'?: string | number;
225
225
  'aria-sort'?: "none" | "ascending" | "descending" | "other";
226
226
  'aria-valuemax'?: string | number;
@@ -7,3 +7,4 @@ export * from './suggestion';
7
7
  export * from './sender';
8
8
  export * from './attachments';
9
9
  export * from './thought-chain';
10
+ export * from './actions';
@@ -1,4 +1,5 @@
1
1
  import type { CSSProperties, HTMLAttributes, VNode } from "vue";
2
+ import { AvoidValidation } from '../type-utility';
2
3
  export interface BasePromptItem {
3
4
  /**
4
5
  * @desc 唯一标识用于区分每个提示项。
@@ -40,7 +41,7 @@ export interface PromptsProps extends Omit<HTMLAttributes, 'onClick' | 'title'>
40
41
  * @desc 显示在提示列表顶部的标题。
41
42
  * @descEN Title displayed at the top of the prompt list.
42
43
  */
43
- title?: VNode | string | (() => VNode | string);
44
+ title?: AvoidValidation<VNode | string | (() => VNode | string)>;
44
45
  /**
45
46
  * @desc Item 提示项被点击时的回调函数。
46
47
  * @descEN Callback function when a prompt item is clicked.
@@ -1,3 +1,4 @@
1
+ import type { ComponentToken as ActionsComponentToken } from '../actions/style';
1
2
  import type { ComponentToken as AttachmentsToken } from '../attachments/style';
2
3
  import type { ComponentToken as BubbleComponentToken } from '../bubble/style';
3
4
  import type { ComponentToken as ConversationsComponentToken } from '../conversations/style';
@@ -8,6 +9,7 @@ import type { ComponentToken as ThoughtChainComponentToken } from '../thought-ch
8
9
  import type { ComponentToken as TransitionCollapseComponentToken } from '../transition-collapse/style';
9
10
  import type { ComponentToken as WelcomeComponentToken } from '../welcome/style';
10
11
  export interface ComponentTokenMap {
12
+ Actions?: ActionsComponentToken;
11
13
  TransitionCollapse?: TransitionCollapseComponentToken;
12
14
  Attachments?: AttachmentsToken;
13
15
  Bubble?: BubbleComponentToken;
@@ -1,4 +1,5 @@
1
1
  import { type AnyObject } from '../_util/type';
2
+ import type { ActionsProps } from 'ant-design-x-vue/actions';
2
3
  import { AttachmentsProps } from 'ant-design-x-vue/attachments';
3
4
  import type { BubbleProps } from 'ant-design-x-vue/bubble';
4
5
  import { ComputedRef, CSSProperties } from 'vue';
@@ -43,6 +44,7 @@ export interface XComponentStyleConfig {
43
44
  export type DefaultPickType = keyof XComponentStyleConfig;
44
45
  export type ComponentStyleConfig<CompProps extends AnyObject, PickType extends keyof CompProps = DefaultPickType> = Pick<CompProps, PickType | DefaultPickType>;
45
46
  export interface XComponentsConfig {
47
+ actions?: ComponentStyleConfig<ActionsProps>;
46
48
  bubble?: ComponentStyleConfig<BubbleProps>;
47
49
  conversations?: ComponentStyleConfig<ConversationsProps>;
48
50
  prompts?: ComponentStyleConfig<PromptsProps>;