@antdv-next/x 0.1.0 → 0.2.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.
- package/LICENSE +21 -0
- package/dist/_utils/vue.d.ts +2 -0
- package/dist/_utils/vue.js +16 -0
- package/dist/actions/Actions.js +3 -2
- package/dist/actions/ActionsCopy.js +4 -4
- package/dist/attachments/PlaceholderUploader.d.ts +16 -0
- package/dist/attachments/PlaceholderUploader.js +31 -5
- package/dist/attachments/index.d.ts +8 -1
- package/dist/attachments/index.js +7 -1
- package/dist/bubble/Bubble.js +5 -8
- package/dist/bubble/BubbleList.js +4 -4
- package/dist/bubble/Divider.js +1 -1
- package/dist/code-highlighter/shiki.js +2 -1
- package/dist/conversations/GroupTitle.d.ts +22 -2
- package/dist/conversations/GroupTitle.js +25 -3
- package/dist/conversations/Item.d.ts +1 -1
- package/dist/conversations/Item.js +1 -4
- package/dist/conversations/index.d.ts +10 -1
- package/dist/conversations/index.js +12 -0
- package/dist/conversations/interface.d.ts +7 -0
- package/dist/file-card/FileCard.js +1 -1
- package/dist/file-card/List.js +1 -1
- package/dist/file-card/components/File.d.ts +6 -6
- package/dist/file-card/components/File.js +2 -2
- package/dist/index.esm.js +149 -85
- package/dist/index.umd.js +148 -84
- package/dist/mermaid/Mermaid.d.ts +5 -0
- package/dist/mermaid/Mermaid.js +22 -1
- package/dist/mermaid/index.d.ts +1 -1
- package/dist/package.js +1 -1
- package/dist/prompts/Prompts.js +1 -4
- package/dist/sources/Sources.js +1 -4
- package/dist/sources/components/CarouselCard.js +1 -4
- package/dist/suggestion/Suggestion.js +1 -4
- package/dist/thought-chain/Item.js +3 -6
- package/dist/thought-chain/Node.js +1 -4
- package/package.json +2 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Antdv Next
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Comment, Fragment, isVNode } from "vue";
|
|
2
|
+
//#region components/_utils/vue.ts
|
|
3
|
+
function isEmptyNode(node) {
|
|
4
|
+
if (node === null || node === void 0 || typeof node === "boolean") return true;
|
|
5
|
+
if (Array.isArray(node)) return node.every(isEmptyNode);
|
|
6
|
+
if (isVNode(node)) {
|
|
7
|
+
if (node.type === Comment) return true;
|
|
8
|
+
if (node.type === Fragment && Array.isArray(node.children)) return node.children.every((child) => isEmptyNode(child));
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
function hasRenderableNode(node) {
|
|
13
|
+
return !isEmptyNode(node);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { hasRenderableNode, isEmptyNode };
|
package/dist/actions/Actions.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import useXComponentConfig from "../_utils/hooks/use-x-component-config.js";
|
|
2
|
+
import { isEmptyNode } from "../_utils/vue.js";
|
|
2
3
|
import Item from "./Item.js";
|
|
3
4
|
import style_default from "./style/index.js";
|
|
4
5
|
import { Transition, computed, createVNode, defineComponent, isVNode, mergeProps, ref, useAttrs, useSlots } from "vue";
|
|
@@ -130,8 +131,8 @@ var XActions = /* @__PURE__ */ defineComponent({
|
|
|
130
131
|
});
|
|
131
132
|
const mergedItem = {
|
|
132
133
|
...item,
|
|
133
|
-
icon: slottedIcon
|
|
134
|
-
actionRender: slotActionNode !== void 0 ? slotActionNode : item.actionRender
|
|
134
|
+
icon: slottedIcon !== void 0 && !isEmptyNode(slottedIcon) ? slottedIcon : item.icon,
|
|
135
|
+
actionRender: slotActionNode !== void 0 && !isEmptyNode(slotActionNode) ? slotActionNode : item.actionRender
|
|
135
136
|
};
|
|
136
137
|
return createVNode(Item, {
|
|
137
138
|
"key": item.key ?? idx,
|
|
@@ -66,14 +66,14 @@ var XActionsCopy = /* @__PURE__ */ defineComponent({
|
|
|
66
66
|
const { class: _class, style: _style, ...rest } = attrs;
|
|
67
67
|
return rest;
|
|
68
68
|
});
|
|
69
|
-
const
|
|
69
|
+
const iconSlot = computed(() => slots.icon);
|
|
70
70
|
const mergedCopyIcons = computed(() => {
|
|
71
71
|
const [defaultOriginNode, copiedOriginNode] = normalizeCopyIcons(props.icon);
|
|
72
|
-
if (!
|
|
73
|
-
return [
|
|
72
|
+
if (!iconSlot.value) return props.icon;
|
|
73
|
+
return [iconSlot.value({
|
|
74
74
|
originNode: defaultOriginNode,
|
|
75
75
|
status: "default"
|
|
76
|
-
}),
|
|
76
|
+
}), iconSlot.value({
|
|
77
77
|
originNode: copiedOriginNode,
|
|
78
78
|
status: "copied"
|
|
79
79
|
})];
|
|
@@ -6,8 +6,16 @@ export interface PlaceholderConfig {
|
|
|
6
6
|
description?: VNodeChild;
|
|
7
7
|
}
|
|
8
8
|
export type PlaceholderType = PlaceholderConfig | VNodeChild;
|
|
9
|
+
export interface PlaceholderSlotInfo {
|
|
10
|
+
type: "inline" | "drop";
|
|
11
|
+
originNode?: VNodeChild;
|
|
12
|
+
}
|
|
13
|
+
export interface PlaceholderFieldSlotInfo extends PlaceholderSlotInfo {
|
|
14
|
+
originNode?: VNodeChild;
|
|
15
|
+
}
|
|
9
16
|
export interface PlaceholderProps {
|
|
10
17
|
prefixCls: string;
|
|
18
|
+
type: "inline" | "drop";
|
|
11
19
|
placeholder?: PlaceholderType;
|
|
12
20
|
upload?: UploadProps;
|
|
13
21
|
class?: ClassValue;
|
|
@@ -18,6 +26,10 @@ declare const PlaceholderUploader: import('vue').DefineComponent<import('vue').E
|
|
|
18
26
|
type: StringConstructor;
|
|
19
27
|
required: true;
|
|
20
28
|
};
|
|
29
|
+
type: {
|
|
30
|
+
type: PropType<PlaceholderProps["type"]>;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
21
33
|
placeholder: {
|
|
22
34
|
type: PropType<PlaceholderType>;
|
|
23
35
|
default: undefined;
|
|
@@ -39,6 +51,10 @@ declare const PlaceholderUploader: import('vue').DefineComponent<import('vue').E
|
|
|
39
51
|
type: StringConstructor;
|
|
40
52
|
required: true;
|
|
41
53
|
};
|
|
54
|
+
type: {
|
|
55
|
+
type: PropType<PlaceholderProps["type"]>;
|
|
56
|
+
required: true;
|
|
57
|
+
};
|
|
42
58
|
placeholder: {
|
|
43
59
|
type: PropType<PlaceholderType>;
|
|
44
60
|
default: undefined;
|
|
@@ -13,6 +13,10 @@ var PlaceholderUploader = /* @__PURE__ */ defineComponent({
|
|
|
13
13
|
type: String,
|
|
14
14
|
required: true
|
|
15
15
|
},
|
|
16
|
+
type: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
16
20
|
placeholder: {
|
|
17
21
|
type: [
|
|
18
22
|
String,
|
|
@@ -60,6 +64,28 @@ var PlaceholderUploader = /* @__PURE__ */ defineComponent({
|
|
|
60
64
|
if (!isConfig.value) return {};
|
|
61
65
|
return props.placeholder;
|
|
62
66
|
});
|
|
67
|
+
const renderConfigNode = () => {
|
|
68
|
+
const iconOriginNode = placeholderConfig.value.icon;
|
|
69
|
+
const titleOriginNode = placeholderConfig.value.title;
|
|
70
|
+
const descriptionOriginNode = placeholderConfig.value.description;
|
|
71
|
+
const iconNode = slots.placeholderIcon?.({
|
|
72
|
+
type: props.type,
|
|
73
|
+
originNode: iconOriginNode
|
|
74
|
+
}) ?? iconOriginNode;
|
|
75
|
+
const titleNode = slots.placeholderTitle?.({
|
|
76
|
+
type: props.type,
|
|
77
|
+
originNode: titleOriginNode
|
|
78
|
+
}) ?? titleOriginNode;
|
|
79
|
+
const descriptionNode = slots.placeholderDescription?.({
|
|
80
|
+
type: props.type,
|
|
81
|
+
originNode: descriptionOriginNode
|
|
82
|
+
}) ?? descriptionOriginNode;
|
|
83
|
+
return createVNode("div", { "class": `${placeholderCls.value}-inner` }, [
|
|
84
|
+
createVNode("span", { "class": `${placeholderCls.value}-icon` }, [iconNode]),
|
|
85
|
+
createVNode("span", { "class": `${placeholderCls.value}-title` }, [titleNode]),
|
|
86
|
+
createVNode("span", { "class": `${placeholderCls.value}-description` }, [descriptionNode])
|
|
87
|
+
]);
|
|
88
|
+
};
|
|
63
89
|
const onDragEnter = () => {
|
|
64
90
|
dragIn.value = true;
|
|
65
91
|
};
|
|
@@ -70,11 +96,11 @@ var PlaceholderUploader = /* @__PURE__ */ defineComponent({
|
|
|
70
96
|
dragIn.value = false;
|
|
71
97
|
};
|
|
72
98
|
return () => {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
99
|
+
const originNode = isConfig.value ? renderConfigNode() : slots.default?.() || props.placeholder;
|
|
100
|
+
const node = slots.placeholder?.({
|
|
101
|
+
type: props.type,
|
|
102
|
+
originNode
|
|
103
|
+
}) ?? originNode;
|
|
78
104
|
return createVNode("div", {
|
|
79
105
|
"class": [
|
|
80
106
|
placeholderCls.value,
|
|
@@ -3,7 +3,7 @@ import { ClassValue, CSSProperties, DefineComponent, StyleValue, VNodeChild } fr
|
|
|
3
3
|
import { FileCardProps } from '../file-card';
|
|
4
4
|
import { SemanticType as FileCardSemanticType } from '../file-card/FileCard';
|
|
5
5
|
import { SemanticType as FileCardListSemanticType } from '../file-card/List';
|
|
6
|
-
import { PlaceholderType } from './PlaceholderUploader';
|
|
6
|
+
import { PlaceholderFieldSlotInfo, PlaceholderSlotInfo, PlaceholderType } from './PlaceholderUploader';
|
|
7
7
|
export type SemanticType = "root" | "list" | "placeholder" | "upload";
|
|
8
8
|
export interface Attachment<T = any> extends UploadFile<T>, Omit<FileCardProps, "size" | "byte" | "type"> {
|
|
9
9
|
description?: VNodeChild;
|
|
@@ -38,6 +38,12 @@ export interface AttachmentsProps<T = any> {
|
|
|
38
38
|
withCredentials?: boolean;
|
|
39
39
|
openFileDialogOnClick?: boolean;
|
|
40
40
|
}
|
|
41
|
+
export interface AttachmentsSlots {
|
|
42
|
+
placeholder?: (info: PlaceholderSlotInfo) => VNodeChild;
|
|
43
|
+
placeholderIcon?: (info: PlaceholderFieldSlotInfo) => VNodeChild;
|
|
44
|
+
placeholderTitle?: (info: PlaceholderFieldSlotInfo) => VNodeChild;
|
|
45
|
+
placeholderDescription?: (info: PlaceholderFieldSlotInfo) => VNodeChild;
|
|
46
|
+
}
|
|
41
47
|
export interface AttachmentsRef {
|
|
42
48
|
nativeElement?: HTMLDivElement | null;
|
|
43
49
|
fileNativeElement?: HTMLInputElement | null;
|
|
@@ -49,3 +55,4 @@ export interface AttachmentsRef {
|
|
|
49
55
|
}
|
|
50
56
|
declare const _default: DefineComponent<AttachmentsProps>;
|
|
51
57
|
export default _default;
|
|
58
|
+
export type { PlaceholderConfig, PlaceholderFieldSlotInfo, PlaceholderSlotInfo, PlaceholderType, } from './PlaceholderUploader';
|
|
@@ -211,12 +211,18 @@ var XAttachments = /* @__PURE__ */ defineComponent({
|
|
|
211
211
|
const getPlaceholderNode = (type, options) => {
|
|
212
212
|
const placeholderContent = typeof props.placeholder === "function" ? props.placeholder(type) : props.placeholder;
|
|
213
213
|
return createVNode(PlaceholderUploader, {
|
|
214
|
+
"type": type,
|
|
214
215
|
"placeholder": placeholderContent,
|
|
215
216
|
"upload": uploadProps.value,
|
|
216
217
|
"prefixCls": props.prefixCls,
|
|
217
218
|
"class": mergedClasses.value.placeholder,
|
|
218
219
|
"style": [mergedStyles.value.placeholder, options?.style]
|
|
219
|
-
},
|
|
220
|
+
}, {
|
|
221
|
+
placeholder: slots.placeholder,
|
|
222
|
+
placeholderIcon: slots.placeholderIcon,
|
|
223
|
+
placeholderTitle: slots.placeholderTitle,
|
|
224
|
+
placeholderDescription: slots.placeholderDescription
|
|
225
|
+
});
|
|
220
226
|
};
|
|
221
227
|
const renderWithChildren = () => {
|
|
222
228
|
let _slot;
|
package/dist/bubble/Bubble.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import useXComponentConfig from "../_utils/hooks/use-x-component-config.js";
|
|
2
|
+
import { hasRenderableNode } from "../_utils/vue.js";
|
|
2
3
|
import { EditableContent } from "./EditableContent.js";
|
|
3
4
|
import loading_default from "./loading.js";
|
|
4
5
|
import style_default from "./style/index.js";
|
|
@@ -9,10 +10,6 @@ function renderBubbleSlot(slot, content, info) {
|
|
|
9
10
|
if (!slot) return null;
|
|
10
11
|
return typeof slot === "function" ? slot(content, info) : slot;
|
|
11
12
|
}
|
|
12
|
-
function hasRenderableNode(node) {
|
|
13
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
14
|
-
return node !== null && node !== void 0 && node !== false;
|
|
15
|
-
}
|
|
16
13
|
var XBubble = /* @__PURE__ */ defineComponent({
|
|
17
14
|
name: "AxBubble",
|
|
18
15
|
inheritAttrs: false,
|
|
@@ -176,8 +173,8 @@ var XBubble = /* @__PURE__ */ defineComponent({
|
|
|
176
173
|
return rest;
|
|
177
174
|
});
|
|
178
175
|
const memoedContent = computed(() => {
|
|
179
|
-
if (slots.
|
|
180
|
-
const slotNode = slots.
|
|
176
|
+
if (slots.content) {
|
|
177
|
+
const slotNode = slots.content({
|
|
181
178
|
content: props.content,
|
|
182
179
|
info: props.info
|
|
183
180
|
});
|
|
@@ -272,8 +269,8 @@ var XBubble = /* @__PURE__ */ defineComponent({
|
|
|
272
269
|
};
|
|
273
270
|
const renderContent = () => {
|
|
274
271
|
if (props.loading) {
|
|
275
|
-
if (slots.
|
|
276
|
-
const slotNode = slots.
|
|
272
|
+
if (slots.loading) {
|
|
273
|
+
const slotNode = slots.loading({
|
|
277
274
|
content: props.content,
|
|
278
275
|
info: props.info
|
|
279
276
|
});
|
|
@@ -240,10 +240,10 @@ var XBubbleList = /* @__PURE__ */ defineComponent({
|
|
|
240
240
|
role
|
|
241
241
|
});
|
|
242
242
|
};
|
|
243
|
-
if (slots.contentRender) bubbleSlots.
|
|
244
|
-
else if (contentRender) bubbleSlots.
|
|
245
|
-
if (slots.loadingRender) bubbleSlots.
|
|
246
|
-
else if (loadingRender) bubbleSlots.
|
|
243
|
+
if (slots.contentRender) bubbleSlots.content = bindListSlot("contentRender");
|
|
244
|
+
else if (contentRender) bubbleSlots.content = ({ content, info: bubbleInfo }) => contentRender(content, bubbleInfo);
|
|
245
|
+
if (slots.loadingRender) bubbleSlots.loading = bindListSlot("loadingRender");
|
|
246
|
+
else if (loadingRender) bubbleSlots.loading = ({ content, info: bubbleInfo }) => loadingRender(content, bubbleInfo);
|
|
247
247
|
for (const name of bubbleSlotNames) {
|
|
248
248
|
if (name === "contentRender" || name === "loadingRender") continue;
|
|
249
249
|
const slot = bindListSlot(name);
|
package/dist/bubble/Divider.js
CHANGED
|
@@ -68,7 +68,7 @@ var XBubbleDivider = /* @__PURE__ */ defineComponent({
|
|
|
68
68
|
"class": [`${props.prefixCls}-divider`, props.class],
|
|
69
69
|
"styles": props.styles,
|
|
70
70
|
"classes": props.classes
|
|
71
|
-
}), {
|
|
71
|
+
}), { content: ({ content }) => createVNode(Divider, props.dividerProps, _isSlot(content) ? content : { default: () => [content] }) });
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
//#endregion
|
|
@@ -53,7 +53,8 @@ async function getHighlighter() {
|
|
|
53
53
|
}
|
|
54
54
|
async function loadLang(lang) {
|
|
55
55
|
const loader = LANG_LOADERS[lang];
|
|
56
|
-
if (!loader
|
|
56
|
+
if (!loader) return false;
|
|
57
|
+
if (loadedLangs.has(lang)) return true;
|
|
57
58
|
const instance = await getHighlighter();
|
|
58
59
|
const mod = await loader();
|
|
59
60
|
await instance.loadLanguage(mod.default);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { PropType, TransitionProps } from 'vue';
|
|
2
|
-
import { GroupInfoType } from './interface';
|
|
1
|
+
import { PropType, TransitionProps, VNodeChild } from 'vue';
|
|
2
|
+
import { GroupInfoType, GroupLabelRenderInfo, GroupLabelRender } from './interface';
|
|
3
3
|
export interface GroupTitleProps {
|
|
4
4
|
prefixCls?: string;
|
|
5
5
|
groupInfo: GroupInfoType;
|
|
6
|
+
groupLabelRender?: GroupLabelRender;
|
|
7
|
+
groupLabelRenderSlot?: (info: GroupLabelRenderInfo) => VNodeChild;
|
|
6
8
|
classes?: any;
|
|
7
9
|
enableCollapse?: boolean;
|
|
8
10
|
expandedKeys?: string[];
|
|
@@ -18,6 +20,14 @@ declare const GroupTitle: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
18
20
|
type: PropType<GroupInfoType>;
|
|
19
21
|
required: true;
|
|
20
22
|
};
|
|
23
|
+
groupLabelRender: {
|
|
24
|
+
type: PropType<GroupTitleProps["groupLabelRender"]>;
|
|
25
|
+
default: undefined;
|
|
26
|
+
};
|
|
27
|
+
groupLabelRenderSlot: {
|
|
28
|
+
type: PropType<GroupTitleProps["groupLabelRenderSlot"]>;
|
|
29
|
+
default: undefined;
|
|
30
|
+
};
|
|
21
31
|
classes: {
|
|
22
32
|
type: PropType<GroupTitleProps["classes"]>;
|
|
23
33
|
default: undefined;
|
|
@@ -47,6 +57,14 @@ declare const GroupTitle: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
47
57
|
type: PropType<GroupInfoType>;
|
|
48
58
|
required: true;
|
|
49
59
|
};
|
|
60
|
+
groupLabelRender: {
|
|
61
|
+
type: PropType<GroupTitleProps["groupLabelRender"]>;
|
|
62
|
+
default: undefined;
|
|
63
|
+
};
|
|
64
|
+
groupLabelRenderSlot: {
|
|
65
|
+
type: PropType<GroupTitleProps["groupLabelRenderSlot"]>;
|
|
66
|
+
default: undefined;
|
|
67
|
+
};
|
|
50
68
|
classes: {
|
|
51
69
|
type: PropType<GroupTitleProps["classes"]>;
|
|
52
70
|
default: undefined;
|
|
@@ -71,6 +89,8 @@ declare const GroupTitle: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
71
89
|
prefixCls: string;
|
|
72
90
|
classes: any;
|
|
73
91
|
expandedKeys: string[];
|
|
92
|
+
groupLabelRender: GroupLabelRender;
|
|
93
|
+
groupLabelRenderSlot: ((info: GroupLabelRenderInfo) => VNodeChild) | undefined;
|
|
74
94
|
onItemExpand: ((curKey: string) => void) | undefined;
|
|
75
95
|
enableCollapse: boolean;
|
|
76
96
|
collapseTransition: TransitionProps;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { hasRenderableNode } from "../_utils/vue.js";
|
|
1
2
|
import { Transition, computed, createVNode, defineComponent } from "vue";
|
|
2
3
|
import { RightOutlined } from "@antdv-next/icons";
|
|
3
4
|
//#region components/conversations/GroupTitle.tsx
|
|
@@ -12,6 +13,20 @@ var GroupTitle = /* @__PURE__ */ defineComponent({
|
|
|
12
13
|
type: Object,
|
|
13
14
|
required: true
|
|
14
15
|
},
|
|
16
|
+
groupLabelRender: {
|
|
17
|
+
type: [
|
|
18
|
+
String,
|
|
19
|
+
Number,
|
|
20
|
+
Object,
|
|
21
|
+
Array,
|
|
22
|
+
Function
|
|
23
|
+
],
|
|
24
|
+
default: void 0
|
|
25
|
+
},
|
|
26
|
+
groupLabelRenderSlot: {
|
|
27
|
+
type: Function,
|
|
28
|
+
default: void 0
|
|
29
|
+
},
|
|
15
30
|
classes: {
|
|
16
31
|
type: [
|
|
17
32
|
String,
|
|
@@ -47,15 +62,22 @@ var GroupTitle = /* @__PURE__ */ defineComponent({
|
|
|
47
62
|
});
|
|
48
63
|
const labelNode = computed(() => {
|
|
49
64
|
const { label, name } = props.groupInfo;
|
|
50
|
-
|
|
51
|
-
|
|
65
|
+
const originNode = typeof label === "function" ? label(name, { groupInfo: props.groupInfo }) : label || name;
|
|
66
|
+
const renderInfo = {
|
|
67
|
+
group: name,
|
|
68
|
+
groupInfo: props.groupInfo,
|
|
69
|
+
originNode
|
|
70
|
+
};
|
|
71
|
+
if (props.groupLabelRenderSlot) return props.groupLabelRenderSlot(renderInfo);
|
|
72
|
+
if (props.groupLabelRender !== void 0) return typeof props.groupLabelRender === "function" ? props.groupLabelRender(name, renderInfo) : props.groupLabelRender;
|
|
73
|
+
return originNode;
|
|
52
74
|
});
|
|
53
75
|
return () => createVNode("li", { "class": props.classes }, [createVNode("div", {
|
|
54
76
|
"class": [`${props.prefixCls}-group-title`, { [`${props.prefixCls}-group-title-collapsible`]: mergeCollapsible.value }],
|
|
55
77
|
"onClick": () => {
|
|
56
78
|
if (mergeCollapsible.value) props.onItemExpand?.(props.groupInfo.name);
|
|
57
79
|
}
|
|
58
|
-
}, [labelNode.value && createVNode("div", { "class": `${props.prefixCls}-group-label` }, [labelNode.value]), mergeCollapsible.value && createVNode("div", { "class": [`${props.prefixCls}-group-collapse-trigger`, `${props.prefixCls}-group-collapse-trigger-${groupOpen.value ? "open" : "close"}`] }, [createVNode(RightOutlined, null, null)])]), createVNode(Transition, props.collapseTransition ?? {}, { default: () => [mergeCollapsible.value ? groupOpen.value ? createVNode("div", null, [slots.default?.()]) : null : createVNode("div", null, [slots.default?.()])] })]);
|
|
80
|
+
}, [hasRenderableNode(labelNode.value) && createVNode("div", { "class": `${props.prefixCls}-group-label` }, [labelNode.value]), mergeCollapsible.value && createVNode("div", { "class": [`${props.prefixCls}-group-collapse-trigger`, `${props.prefixCls}-group-collapse-trigger-${groupOpen.value ? "open" : "close"}`] }, [createVNode(RightOutlined, null, null)])]), createVNode(Transition, props.collapseTransition ?? {}, { default: () => [mergeCollapsible.value ? groupOpen.value ? createVNode("div", null, [slots.default?.()]) : null : createVNode("div", null, [slots.default?.()])] })]);
|
|
59
81
|
}
|
|
60
82
|
});
|
|
61
83
|
//#endregion
|
|
@@ -132,8 +132,8 @@ declare const ConversationsItem: import('vue').DefineComponent<import('vue').Ext
|
|
|
132
132
|
onClick: ((value: ConversationItemType["key"], item?: import('./interface').ItemType) => void) | undefined;
|
|
133
133
|
labelRender: import('./interface').ConversationItemRender;
|
|
134
134
|
iconRender: import('./interface').ConversationItemRender;
|
|
135
|
-
iconRenderSlot: ((info: ConversationItemRenderInfo) => VNodeChild) | undefined;
|
|
136
135
|
index: number;
|
|
137
136
|
labelRenderSlot: ((info: ConversationItemRenderInfo) => VNodeChild) | undefined;
|
|
137
|
+
iconRenderSlot: ((info: ConversationItemRenderInfo) => VNodeChild) | undefined;
|
|
138
138
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
139
139
|
export default ConversationsItem;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { hasRenderableNode } from "../_utils/vue.js";
|
|
1
2
|
import { computed, createVNode, defineComponent, isVNode } from "vue";
|
|
2
3
|
import { Dropdown, Typography } from "antdv-next";
|
|
3
4
|
import { EllipsisOutlined } from "@antdv-next/icons";
|
|
@@ -8,10 +9,6 @@ function _isSlot(s) {
|
|
|
8
9
|
var stopPropagation = (event) => {
|
|
9
10
|
event.stopPropagation();
|
|
10
11
|
};
|
|
11
|
-
var hasRenderableNode = (node) => {
|
|
12
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
13
|
-
return node !== null && node !== void 0 && node !== false;
|
|
14
|
-
};
|
|
15
12
|
var renderWithPriority = (render, slotRender, info) => {
|
|
16
13
|
if (slotRender) return slotRender(info);
|
|
17
14
|
if (render !== void 0) return typeof render === "function" ? render(info.item, info) : render;
|
|
@@ -26,6 +26,10 @@ declare const XConversations: import('vue').DefineComponent<import('vue').Extrac
|
|
|
26
26
|
type: PropType<ConversationsProps["iconRender"]>;
|
|
27
27
|
default: undefined;
|
|
28
28
|
};
|
|
29
|
+
groupLabelRender: {
|
|
30
|
+
type: PropType<ConversationsProps["groupLabelRender"]>;
|
|
31
|
+
default: undefined;
|
|
32
|
+
};
|
|
29
33
|
menu: {
|
|
30
34
|
type: PropType<ConversationsProps["menu"]>;
|
|
31
35
|
default: undefined;
|
|
@@ -91,6 +95,10 @@ declare const XConversations: import('vue').DefineComponent<import('vue').Extrac
|
|
|
91
95
|
type: PropType<ConversationsProps["iconRender"]>;
|
|
92
96
|
default: undefined;
|
|
93
97
|
};
|
|
98
|
+
groupLabelRender: {
|
|
99
|
+
type: PropType<ConversationsProps["groupLabelRender"]>;
|
|
100
|
+
default: undefined;
|
|
101
|
+
};
|
|
94
102
|
menu: {
|
|
95
103
|
type: PropType<ConversationsProps["menu"]>;
|
|
96
104
|
default: undefined;
|
|
@@ -153,12 +161,13 @@ declare const XConversations: import('vue').DefineComponent<import('vue').Extrac
|
|
|
153
161
|
creation: import('./interface').CreationProps | undefined;
|
|
154
162
|
defaultActiveKey: string | undefined;
|
|
155
163
|
onActiveChange: ((value: ConversationItemType["key"], item?: ItemType) => void) | undefined;
|
|
164
|
+
groupLabelRender: import('./interface').GroupLabelRender;
|
|
156
165
|
groupable: boolean | import('./interface').GroupableProps | undefined;
|
|
157
166
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
158
167
|
type ConversationsType = typeof XConversations & {
|
|
159
168
|
Creation: typeof Creation;
|
|
160
169
|
};
|
|
161
170
|
declare const ConversationsWithSub: ConversationsType;
|
|
162
|
-
export type { ConversationItemRender, ConversationItemRenderInfo, ConversationItemType, ConversationsProps, ConversationsRef, CreationProps, DividerItemType, GroupableProps, ItemType, } from './interface';
|
|
171
|
+
export type { ConversationItemRender, ConversationItemRenderInfo, ConversationItemType, ConversationsProps, ConversationsRef, CreationProps, DividerItemType, GroupableProps, GroupLabelRender, GroupLabelRenderInfo, ItemType, } from './interface';
|
|
163
172
|
export { Creation as ConversationsCreation };
|
|
164
173
|
export default ConversationsWithSub;
|
|
@@ -56,6 +56,16 @@ var ConversationsWithSub = /* @__PURE__ */ defineComponent({
|
|
|
56
56
|
],
|
|
57
57
|
default: void 0
|
|
58
58
|
},
|
|
59
|
+
groupLabelRender: {
|
|
60
|
+
type: [
|
|
61
|
+
String,
|
|
62
|
+
Number,
|
|
63
|
+
Object,
|
|
64
|
+
Array,
|
|
65
|
+
Function
|
|
66
|
+
],
|
|
67
|
+
default: void 0
|
|
68
|
+
},
|
|
59
69
|
menu: {
|
|
60
70
|
type: [Object, Function],
|
|
61
71
|
default: void 0
|
|
@@ -227,6 +237,8 @@ var ConversationsWithSub = /* @__PURE__ */ defineComponent({
|
|
|
227
237
|
"key": groupInfo.name || `key-${groupIndex}`,
|
|
228
238
|
"prefixCls": props.prefixCls,
|
|
229
239
|
"groupInfo": groupInfo,
|
|
240
|
+
"groupLabelRender": props.groupLabelRender,
|
|
241
|
+
"groupLabelRenderSlot": slots.groupLabelRender,
|
|
230
242
|
"classes": [contextConfig.value.classes?.group, props.classes?.group],
|
|
231
243
|
"enableCollapse": enableCollapse.value,
|
|
232
244
|
"expandedKeys": mergedExpandedKeys.value,
|
|
@@ -26,6 +26,12 @@ export interface ConversationItemRenderInfo {
|
|
|
26
26
|
originNode: VNodeChild;
|
|
27
27
|
}
|
|
28
28
|
export type ConversationItemRender = VNodeChild | ((item: ConversationItemType, info: ConversationItemRenderInfo) => VNodeChild);
|
|
29
|
+
export interface GroupLabelRenderInfo {
|
|
30
|
+
group: string;
|
|
31
|
+
groupInfo: GroupInfoType;
|
|
32
|
+
originNode: VNodeChild;
|
|
33
|
+
}
|
|
34
|
+
export type GroupLabelRender = VNodeChild | ((group: string, info: GroupLabelRenderInfo) => VNodeChild);
|
|
29
35
|
export interface DividerItemType {
|
|
30
36
|
type: "divider";
|
|
31
37
|
key?: string;
|
|
@@ -81,6 +87,7 @@ export interface ConversationsProps extends Omit<HTMLAttributes, "onClick" | "cl
|
|
|
81
87
|
onActiveChange?: (value: ConversationItemType["key"], item?: ItemType) => void;
|
|
82
88
|
labelRender?: ConversationItemRender;
|
|
83
89
|
iconRender?: ConversationItemRender;
|
|
90
|
+
groupLabelRender?: GroupLabelRender;
|
|
84
91
|
menu?: ConversationsItemMenu | ((value: ConversationItemType) => ConversationsItemMenu);
|
|
85
92
|
groupable?: boolean | GroupableProps;
|
|
86
93
|
styles?: Partial<Record<SemanticType, CSSProperties>>;
|
|
@@ -329,7 +329,7 @@ var XFileCard = /* @__PURE__ */ defineComponent({
|
|
|
329
329
|
"mask": props.mask,
|
|
330
330
|
"descriptionRenderSlot": slots.description,
|
|
331
331
|
"maskRenderSlot": slots.mask,
|
|
332
|
-
"
|
|
332
|
+
"iconSlot": slots.icon,
|
|
333
333
|
"classes": mergedClasses.value,
|
|
334
334
|
"styles": mergedStyles.value
|
|
335
335
|
}, null);
|
package/dist/file-card/List.js
CHANGED
|
@@ -187,7 +187,7 @@ var XFileCardList = /* @__PURE__ */ defineComponent({
|
|
|
187
187
|
item: fileItem,
|
|
188
188
|
index: itemIndex
|
|
189
189
|
}) : void 0,
|
|
190
|
-
|
|
190
|
+
icon: slots.iconRender ? (slotInfo) => slots.iconRender?.({
|
|
191
191
|
...slotInfo,
|
|
192
192
|
item: fileItem,
|
|
193
193
|
index: itemIndex
|
|
@@ -18,7 +18,7 @@ export interface FileProps {
|
|
|
18
18
|
mask?: ExtendNode;
|
|
19
19
|
descriptionRenderSlot?: (info: FileCardSlotInfo) => VNodeChild;
|
|
20
20
|
maskRenderSlot?: (info: FileCardSlotInfo) => VNodeChild;
|
|
21
|
-
|
|
21
|
+
iconSlot?: (info: FileCardSlotInfo) => VNodeChild;
|
|
22
22
|
}
|
|
23
23
|
declare const File: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
24
24
|
styles: {
|
|
@@ -89,8 +89,8 @@ declare const File: import('vue').DefineComponent<import('vue').ExtractPropTypes
|
|
|
89
89
|
type: PropType<FileProps["maskRenderSlot"]>;
|
|
90
90
|
default: undefined;
|
|
91
91
|
};
|
|
92
|
-
|
|
93
|
-
type: PropType<FileProps["
|
|
92
|
+
iconSlot: {
|
|
93
|
+
type: PropType<FileProps["iconSlot"]>;
|
|
94
94
|
default: undefined;
|
|
95
95
|
};
|
|
96
96
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
@@ -162,8 +162,8 @@ declare const File: import('vue').DefineComponent<import('vue').ExtractPropTypes
|
|
|
162
162
|
type: PropType<FileProps["maskRenderSlot"]>;
|
|
163
163
|
default: undefined;
|
|
164
164
|
};
|
|
165
|
-
|
|
166
|
-
type: PropType<FileProps["
|
|
165
|
+
iconSlot: {
|
|
166
|
+
type: PropType<FileProps["iconSlot"]>;
|
|
167
167
|
default: undefined;
|
|
168
168
|
};
|
|
169
169
|
}>> & Readonly<{}>, {
|
|
@@ -179,7 +179,7 @@ declare const File: import('vue').DefineComponent<import('vue').ExtractPropTypes
|
|
|
179
179
|
description: ExtendNode;
|
|
180
180
|
descriptionRenderSlot: ((info: FileCardSlotInfo) => VNodeChild) | undefined;
|
|
181
181
|
maskRenderSlot: ((info: FileCardSlotInfo) => VNodeChild) | undefined;
|
|
182
|
-
|
|
182
|
+
iconSlot: ((info: FileCardSlotInfo) => VNodeChild) | undefined;
|
|
183
183
|
namePrefix: string;
|
|
184
184
|
ext: string;
|
|
185
185
|
byte: number;
|
|
@@ -92,7 +92,7 @@ var File = /* @__PURE__ */ defineComponent({
|
|
|
92
92
|
type: Function,
|
|
93
93
|
default: void 0
|
|
94
94
|
},
|
|
95
|
-
|
|
95
|
+
iconSlot: {
|
|
96
96
|
type: Function,
|
|
97
97
|
default: void 0
|
|
98
98
|
}
|
|
@@ -153,7 +153,7 @@ var File = /* @__PURE__ */ defineComponent({
|
|
|
153
153
|
color: props.iconColor,
|
|
154
154
|
...props.styles.icon
|
|
155
155
|
}
|
|
156
|
-
}, [renderWithSlot(props.
|
|
156
|
+
}, [renderWithSlot(props.iconSlot, iconNode.value)]),
|
|
157
157
|
createVNode("div", { "class": `${compCls.value}-content` }, [createVNode("div", {
|
|
158
158
|
"class": [`${compCls.value}-name`, props.classes.name],
|
|
159
159
|
"style": props.styles.name
|