@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/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, Teleport, Transition, TransitionGroup, computed, createTextVNode, createVNode, defineComponent, inject, isVNode, mergeProps, nextTick, onBeforeUnmount, onMounted, provide, ref, render, shallowRef, toRefs, unref, useAttrs, useSlots, vShow, watch, withDirectives } from "vue";
|
|
1
|
+
import { Comment, Fragment, Teleport, Transition, TransitionGroup, computed, createTextVNode, createVNode, defineComponent, inject, isVNode, mergeProps, nextTick, onBeforeUnmount, onMounted, provide, ref, render, shallowRef, toRefs, unref, useAttrs, useSlots, vShow, watch, withDirectives } from "vue";
|
|
2
2
|
import { useConfig } from "antdv-next/dist/config-provider/context";
|
|
3
3
|
import { Button, Carousel, Cascader, ConfigProvider, Divider, Dropdown, Flex, Image as Image$1, Input, Popover, Progress, Segmented, Skeleton, Spin, TextArea, Tooltip, Typography, Upload, theme } from "antdv-next";
|
|
4
4
|
import Icon, { ArrowUpOutlined, AudioMutedOutlined, AudioOutlined, CheckCircleOutlined, CheckOutlined, ClearOutlined, CloseCircleFilled, CloseCircleOutlined, CloseOutlined, CopyOutlined, DislikeFilled, DislikeOutlined, DownloadOutlined, EllipsisOutlined, FileExcelFilled, FileImageFilled, FileMarkdownFilled, FilePdfFilled, FilePptFilled, FileTextFilled, FileWordFilled, FileZipFilled, JavaOutlined, JavaScriptOutlined, LeftOutlined, LikeFilled, LikeOutlined, LoadingOutlined, MinusCircleOutlined, MoonOutlined, MutedOutlined, PlusOutlined, PythonOutlined, RightOutlined, SoundOutlined, SunOutlined, ZoomInOutlined, ZoomOutOutlined } from "@antdv-next/icons";
|
|
@@ -13,7 +13,7 @@ import lightTheme from "shiki/dist/themes/vitesse-light.mjs";
|
|
|
13
13
|
import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
|
|
14
14
|
import { KeyCode, classNames } from "@v-c/util";
|
|
15
15
|
//#region package.json
|
|
16
|
-
var version = "0.
|
|
16
|
+
var version = "0.2.0";
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region components/x-provider/context.ts
|
|
19
19
|
var XProviderContextKey = Symbol("antdv-next-x-provider-context");
|
|
@@ -39,6 +39,20 @@ function useXComponentConfig(component) {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
|
+
//#region components/_utils/vue.ts
|
|
43
|
+
function isEmptyNode(node) {
|
|
44
|
+
if (node === null || node === void 0 || typeof node === "boolean") return true;
|
|
45
|
+
if (Array.isArray(node)) return node.every(isEmptyNode);
|
|
46
|
+
if (isVNode(node)) {
|
|
47
|
+
if (node.type === Comment) return true;
|
|
48
|
+
if (node.type === Fragment && Array.isArray(node.children)) return node.children.every((child) => isEmptyNode(child));
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
function hasRenderableNode(node) {
|
|
53
|
+
return !isEmptyNode(node);
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
42
56
|
//#region components/actions/ActionsMenu.tsx
|
|
43
57
|
var keySeed$1 = 0;
|
|
44
58
|
function findItem(keyPath, items) {
|
|
@@ -618,8 +632,8 @@ var XActions = /* @__PURE__ */ defineComponent({
|
|
|
618
632
|
});
|
|
619
633
|
const mergedItem = {
|
|
620
634
|
...item,
|
|
621
|
-
icon: slottedIcon
|
|
622
|
-
actionRender: slotActionNode !== void 0 ? slotActionNode : item.actionRender
|
|
635
|
+
icon: slottedIcon !== void 0 && !isEmptyNode(slottedIcon) ? slottedIcon : item.icon,
|
|
636
|
+
actionRender: slotActionNode !== void 0 && !isEmptyNode(slotActionNode) ? slotActionNode : item.actionRender
|
|
623
637
|
};
|
|
624
638
|
return createVNode(Item, {
|
|
625
639
|
"key": item.key ?? idx,
|
|
@@ -909,14 +923,14 @@ var XActionsCopy = /* @__PURE__ */ defineComponent({
|
|
|
909
923
|
const { class: _class, style: _style, ...rest } = attrs;
|
|
910
924
|
return rest;
|
|
911
925
|
});
|
|
912
|
-
const
|
|
926
|
+
const iconSlot = computed(() => slots.icon);
|
|
913
927
|
const mergedCopyIcons = computed(() => {
|
|
914
928
|
const [defaultOriginNode, copiedOriginNode] = normalizeCopyIcons(props.icon);
|
|
915
|
-
if (!
|
|
916
|
-
return [
|
|
929
|
+
if (!iconSlot.value) return props.icon;
|
|
930
|
+
return [iconSlot.value({
|
|
917
931
|
originNode: defaultOriginNode,
|
|
918
932
|
status: "default"
|
|
919
|
-
}),
|
|
933
|
+
}), iconSlot.value({
|
|
920
934
|
originNode: copiedOriginNode,
|
|
921
935
|
status: "copied"
|
|
922
936
|
})];
|
|
@@ -1271,7 +1285,7 @@ var File = /* @__PURE__ */ defineComponent({
|
|
|
1271
1285
|
type: Function,
|
|
1272
1286
|
default: void 0
|
|
1273
1287
|
},
|
|
1274
|
-
|
|
1288
|
+
iconSlot: {
|
|
1275
1289
|
type: Function,
|
|
1276
1290
|
default: void 0
|
|
1277
1291
|
}
|
|
@@ -1332,7 +1346,7 @@ var File = /* @__PURE__ */ defineComponent({
|
|
|
1332
1346
|
color: props.iconColor,
|
|
1333
1347
|
...props.styles.icon
|
|
1334
1348
|
}
|
|
1335
|
-
}, [renderWithSlot(props.
|
|
1349
|
+
}, [renderWithSlot(props.iconSlot, iconNode.value)]),
|
|
1336
1350
|
createVNode("div", { "class": `${compCls.value}-content` }, [createVNode("div", {
|
|
1337
1351
|
"class": [`${compCls.value}-name`, props.classes.name],
|
|
1338
1352
|
"style": props.styles.name
|
|
@@ -2139,7 +2153,7 @@ var XFileCard = /* @__PURE__ */ defineComponent({
|
|
|
2139
2153
|
"mask": props.mask,
|
|
2140
2154
|
"descriptionRenderSlot": slots.description,
|
|
2141
2155
|
"maskRenderSlot": slots.mask,
|
|
2142
|
-
"
|
|
2156
|
+
"iconSlot": slots.icon,
|
|
2143
2157
|
"classes": mergedClasses.value,
|
|
2144
2158
|
"styles": mergedStyles.value
|
|
2145
2159
|
}, null);
|
|
@@ -2349,7 +2363,7 @@ var XFileCardList = /* @__PURE__ */ defineComponent({
|
|
|
2349
2363
|
item: fileItem,
|
|
2350
2364
|
index: itemIndex
|
|
2351
2365
|
}) : void 0,
|
|
2352
|
-
|
|
2366
|
+
icon: slots.iconRender ? (slotInfo) => slots.iconRender?.({
|
|
2353
2367
|
...slotInfo,
|
|
2354
2368
|
item: fileItem,
|
|
2355
2369
|
index: itemIndex
|
|
@@ -2674,6 +2688,10 @@ var PlaceholderUploader = /* @__PURE__ */ defineComponent({
|
|
|
2674
2688
|
type: String,
|
|
2675
2689
|
required: true
|
|
2676
2690
|
},
|
|
2691
|
+
type: {
|
|
2692
|
+
type: String,
|
|
2693
|
+
required: true
|
|
2694
|
+
},
|
|
2677
2695
|
placeholder: {
|
|
2678
2696
|
type: [
|
|
2679
2697
|
String,
|
|
@@ -2721,6 +2739,28 @@ var PlaceholderUploader = /* @__PURE__ */ defineComponent({
|
|
|
2721
2739
|
if (!isConfig.value) return {};
|
|
2722
2740
|
return props.placeholder;
|
|
2723
2741
|
});
|
|
2742
|
+
const renderConfigNode = () => {
|
|
2743
|
+
const iconOriginNode = placeholderConfig.value.icon;
|
|
2744
|
+
const titleOriginNode = placeholderConfig.value.title;
|
|
2745
|
+
const descriptionOriginNode = placeholderConfig.value.description;
|
|
2746
|
+
const iconNode = slots.placeholderIcon?.({
|
|
2747
|
+
type: props.type,
|
|
2748
|
+
originNode: iconOriginNode
|
|
2749
|
+
}) ?? iconOriginNode;
|
|
2750
|
+
const titleNode = slots.placeholderTitle?.({
|
|
2751
|
+
type: props.type,
|
|
2752
|
+
originNode: titleOriginNode
|
|
2753
|
+
}) ?? titleOriginNode;
|
|
2754
|
+
const descriptionNode = slots.placeholderDescription?.({
|
|
2755
|
+
type: props.type,
|
|
2756
|
+
originNode: descriptionOriginNode
|
|
2757
|
+
}) ?? descriptionOriginNode;
|
|
2758
|
+
return createVNode("div", { "class": `${placeholderCls.value}-inner` }, [
|
|
2759
|
+
createVNode("span", { "class": `${placeholderCls.value}-icon` }, [iconNode]),
|
|
2760
|
+
createVNode("span", { "class": `${placeholderCls.value}-title` }, [titleNode]),
|
|
2761
|
+
createVNode("span", { "class": `${placeholderCls.value}-description` }, [descriptionNode])
|
|
2762
|
+
]);
|
|
2763
|
+
};
|
|
2724
2764
|
const onDragEnter = () => {
|
|
2725
2765
|
dragIn.value = true;
|
|
2726
2766
|
};
|
|
@@ -2731,11 +2771,11 @@ var PlaceholderUploader = /* @__PURE__ */ defineComponent({
|
|
|
2731
2771
|
dragIn.value = false;
|
|
2732
2772
|
};
|
|
2733
2773
|
return () => {
|
|
2734
|
-
const
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2774
|
+
const originNode = isConfig.value ? renderConfigNode() : slots.default?.() || props.placeholder;
|
|
2775
|
+
const node = slots.placeholder?.({
|
|
2776
|
+
type: props.type,
|
|
2777
|
+
originNode
|
|
2778
|
+
}) ?? originNode;
|
|
2739
2779
|
return createVNode("div", {
|
|
2740
2780
|
"class": [
|
|
2741
2781
|
placeholderCls.value,
|
|
@@ -3078,12 +3118,18 @@ var XAttachments = /* @__PURE__ */ defineComponent({
|
|
|
3078
3118
|
const getPlaceholderNode = (type, options) => {
|
|
3079
3119
|
const placeholderContent = typeof props.placeholder === "function" ? props.placeholder(type) : props.placeholder;
|
|
3080
3120
|
return createVNode(PlaceholderUploader, {
|
|
3121
|
+
"type": type,
|
|
3081
3122
|
"placeholder": placeholderContent,
|
|
3082
3123
|
"upload": uploadProps.value,
|
|
3083
3124
|
"prefixCls": props.prefixCls,
|
|
3084
3125
|
"class": mergedClasses.value.placeholder,
|
|
3085
3126
|
"style": [mergedStyles.value.placeholder, options?.style]
|
|
3086
|
-
},
|
|
3127
|
+
}, {
|
|
3128
|
+
placeholder: slots.placeholder,
|
|
3129
|
+
placeholderIcon: slots.placeholderIcon,
|
|
3130
|
+
placeholderTitle: slots.placeholderTitle,
|
|
3131
|
+
placeholderDescription: slots.placeholderDescription
|
|
3132
|
+
});
|
|
3087
3133
|
};
|
|
3088
3134
|
const renderWithChildren = () => {
|
|
3089
3135
|
let _slot;
|
|
@@ -3818,10 +3864,6 @@ function renderBubbleSlot(slot, content, info) {
|
|
|
3818
3864
|
if (!slot) return null;
|
|
3819
3865
|
return typeof slot === "function" ? slot(content, info) : slot;
|
|
3820
3866
|
}
|
|
3821
|
-
function hasRenderableNode$7(node) {
|
|
3822
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
3823
|
-
return node !== null && node !== void 0 && node !== false;
|
|
3824
|
-
}
|
|
3825
3867
|
var XBubble = /* @__PURE__ */ defineComponent({
|
|
3826
3868
|
name: "AxBubble",
|
|
3827
3869
|
inheritAttrs: false,
|
|
@@ -3985,12 +4027,12 @@ var XBubble = /* @__PURE__ */ defineComponent({
|
|
|
3985
4027
|
return rest;
|
|
3986
4028
|
});
|
|
3987
4029
|
const memoedContent = computed(() => {
|
|
3988
|
-
if (slots.
|
|
3989
|
-
const slotNode = slots.
|
|
4030
|
+
if (slots.content) {
|
|
4031
|
+
const slotNode = slots.content({
|
|
3990
4032
|
content: props.content,
|
|
3991
4033
|
info: props.info
|
|
3992
4034
|
});
|
|
3993
|
-
if (hasRenderableNode
|
|
4035
|
+
if (hasRenderableNode(slotNode)) return slotNode;
|
|
3994
4036
|
}
|
|
3995
4037
|
return props.contentRender ? props.contentRender(props.content, props.info) : props.content;
|
|
3996
4038
|
});
|
|
@@ -4081,12 +4123,12 @@ var XBubble = /* @__PURE__ */ defineComponent({
|
|
|
4081
4123
|
};
|
|
4082
4124
|
const renderContent = () => {
|
|
4083
4125
|
if (props.loading) {
|
|
4084
|
-
if (slots.
|
|
4085
|
-
const slotNode = slots.
|
|
4126
|
+
if (slots.loading) {
|
|
4127
|
+
const slotNode = slots.loading({
|
|
4086
4128
|
content: props.content,
|
|
4087
4129
|
info: props.info
|
|
4088
4130
|
});
|
|
4089
|
-
if (hasRenderableNode
|
|
4131
|
+
if (hasRenderableNode(slotNode)) return slotNode;
|
|
4090
4132
|
}
|
|
4091
4133
|
if (props.loadingRender) return props.loadingRender(props.content, props.info);
|
|
4092
4134
|
return createVNode(loading_default, { "prefixCls": props.prefixCls }, null);
|
|
@@ -4226,7 +4268,7 @@ var XBubbleDivider = /* @__PURE__ */ defineComponent({
|
|
|
4226
4268
|
"class": [`${props.prefixCls}-divider`, props.class],
|
|
4227
4269
|
"styles": props.styles,
|
|
4228
4270
|
"classes": props.classes
|
|
4229
|
-
}), {
|
|
4271
|
+
}), { content: ({ content }) => createVNode(Divider, props.dividerProps, _isSlot$3(content) ? content : { default: () => [content] }) });
|
|
4230
4272
|
}
|
|
4231
4273
|
});
|
|
4232
4274
|
//#endregion
|
|
@@ -4661,10 +4703,10 @@ var XBubbleList = /* @__PURE__ */ defineComponent({
|
|
|
4661
4703
|
role
|
|
4662
4704
|
});
|
|
4663
4705
|
};
|
|
4664
|
-
if (slots.contentRender) bubbleSlots.
|
|
4665
|
-
else if (contentRender) bubbleSlots.
|
|
4666
|
-
if (slots.loadingRender) bubbleSlots.
|
|
4667
|
-
else if (loadingRender) bubbleSlots.
|
|
4706
|
+
if (slots.contentRender) bubbleSlots.content = bindListSlot("contentRender");
|
|
4707
|
+
else if (contentRender) bubbleSlots.content = ({ content, info: bubbleInfo }) => contentRender(content, bubbleInfo);
|
|
4708
|
+
if (slots.loadingRender) bubbleSlots.loading = bindListSlot("loadingRender");
|
|
4709
|
+
else if (loadingRender) bubbleSlots.loading = ({ content, info: bubbleInfo }) => loadingRender(content, bubbleInfo);
|
|
4668
4710
|
for (const name of bubbleSlotNames) {
|
|
4669
4711
|
if (name === "contentRender" || name === "loadingRender") continue;
|
|
4670
4712
|
const slot = bindListSlot(name);
|
|
@@ -4732,7 +4774,8 @@ async function getHighlighter() {
|
|
|
4732
4774
|
}
|
|
4733
4775
|
async function loadLang(lang) {
|
|
4734
4776
|
const loader = LANG_LOADERS[lang];
|
|
4735
|
-
if (!loader
|
|
4777
|
+
if (!loader) return false;
|
|
4778
|
+
if (loadedLangs.has(lang)) return true;
|
|
4736
4779
|
const instance = await getHighlighter();
|
|
4737
4780
|
const mod = await loader();
|
|
4738
4781
|
await instance.loadLanguage(mod.default);
|
|
@@ -5479,6 +5522,20 @@ var GroupTitle = /* @__PURE__ */ defineComponent({
|
|
|
5479
5522
|
type: Object,
|
|
5480
5523
|
required: true
|
|
5481
5524
|
},
|
|
5525
|
+
groupLabelRender: {
|
|
5526
|
+
type: [
|
|
5527
|
+
String,
|
|
5528
|
+
Number,
|
|
5529
|
+
Object,
|
|
5530
|
+
Array,
|
|
5531
|
+
Function
|
|
5532
|
+
],
|
|
5533
|
+
default: void 0
|
|
5534
|
+
},
|
|
5535
|
+
groupLabelRenderSlot: {
|
|
5536
|
+
type: Function,
|
|
5537
|
+
default: void 0
|
|
5538
|
+
},
|
|
5482
5539
|
classes: {
|
|
5483
5540
|
type: [
|
|
5484
5541
|
String,
|
|
@@ -5514,15 +5571,22 @@ var GroupTitle = /* @__PURE__ */ defineComponent({
|
|
|
5514
5571
|
});
|
|
5515
5572
|
const labelNode = computed(() => {
|
|
5516
5573
|
const { label, name } = props.groupInfo;
|
|
5517
|
-
|
|
5518
|
-
|
|
5574
|
+
const originNode = typeof label === "function" ? label(name, { groupInfo: props.groupInfo }) : label || name;
|
|
5575
|
+
const renderInfo = {
|
|
5576
|
+
group: name,
|
|
5577
|
+
groupInfo: props.groupInfo,
|
|
5578
|
+
originNode
|
|
5579
|
+
};
|
|
5580
|
+
if (props.groupLabelRenderSlot) return props.groupLabelRenderSlot(renderInfo);
|
|
5581
|
+
if (props.groupLabelRender !== void 0) return typeof props.groupLabelRender === "function" ? props.groupLabelRender(name, renderInfo) : props.groupLabelRender;
|
|
5582
|
+
return originNode;
|
|
5519
5583
|
});
|
|
5520
5584
|
return () => createVNode("li", { "class": props.classes }, [createVNode("div", {
|
|
5521
5585
|
"class": [`${props.prefixCls}-group-title`, { [`${props.prefixCls}-group-title-collapsible`]: mergeCollapsible.value }],
|
|
5522
5586
|
"onClick": () => {
|
|
5523
5587
|
if (mergeCollapsible.value) props.onItemExpand?.(props.groupInfo.name);
|
|
5524
5588
|
}
|
|
5525
|
-
}, [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?.()])] })]);
|
|
5589
|
+
}, [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?.()])] })]);
|
|
5526
5590
|
}
|
|
5527
5591
|
});
|
|
5528
5592
|
//#endregion
|
|
@@ -5607,10 +5671,6 @@ function _isSlot$2(s) {
|
|
|
5607
5671
|
var stopPropagation = (event) => {
|
|
5608
5672
|
event.stopPropagation();
|
|
5609
5673
|
};
|
|
5610
|
-
var hasRenderableNode$6 = (node) => {
|
|
5611
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
5612
|
-
return node !== null && node !== void 0 && node !== false;
|
|
5613
|
-
};
|
|
5614
5674
|
var renderWithPriority = (render, slotRender, info) => {
|
|
5615
5675
|
if (slotRender) return slotRender(info);
|
|
5616
5676
|
if (render !== void 0) return typeof render === "function" ? render(info.item, info) : render;
|
|
@@ -5741,7 +5801,7 @@ var ConversationsItem = /* @__PURE__ */ defineComponent({
|
|
|
5741
5801
|
if (!disabled) props.onClick?.(props.info.key, props.info);
|
|
5742
5802
|
}
|
|
5743
5803
|
}, [
|
|
5744
|
-
hasRenderableNode
|
|
5804
|
+
hasRenderableNode(iconNode) && createVNode("div", { "class": `${props.prefixCls}-icon` }, [iconNode]),
|
|
5745
5805
|
createVNode(Typography.Text, { "class": `${props.prefixCls}-label` }, _isSlot$2(labelNode) ? labelNode : { default: () => [labelNode] }),
|
|
5746
5806
|
!disabled && props.menu && createVNode("div", { "onClick": stopPropagation }, [createVNode(Dropdown, {
|
|
5747
5807
|
"menu": menuProps.value,
|
|
@@ -5962,6 +6022,16 @@ var ConversationsWithSub = /* @__PURE__ */ defineComponent({
|
|
|
5962
6022
|
],
|
|
5963
6023
|
default: void 0
|
|
5964
6024
|
},
|
|
6025
|
+
groupLabelRender: {
|
|
6026
|
+
type: [
|
|
6027
|
+
String,
|
|
6028
|
+
Number,
|
|
6029
|
+
Object,
|
|
6030
|
+
Array,
|
|
6031
|
+
Function
|
|
6032
|
+
],
|
|
6033
|
+
default: void 0
|
|
6034
|
+
},
|
|
5965
6035
|
menu: {
|
|
5966
6036
|
type: [Object, Function],
|
|
5967
6037
|
default: void 0
|
|
@@ -6133,6 +6203,8 @@ var ConversationsWithSub = /* @__PURE__ */ defineComponent({
|
|
|
6133
6203
|
"key": groupInfo.name || `key-${groupIndex}`,
|
|
6134
6204
|
"prefixCls": props.prefixCls,
|
|
6135
6205
|
"groupInfo": groupInfo,
|
|
6206
|
+
"groupLabelRender": props.groupLabelRender,
|
|
6207
|
+
"groupLabelRenderSlot": slots.groupLabelRender,
|
|
6136
6208
|
"classes": [contextConfig.value.classes?.group, props.classes?.group],
|
|
6137
6209
|
"enableCollapse": enableCollapse.value,
|
|
6138
6210
|
"expandedKeys": mergedExpandedKeys.value,
|
|
@@ -6411,6 +6483,26 @@ var mermaid_default = /* @__PURE__ */ defineComponent({
|
|
|
6411
6483
|
const { class: _class, style: _style, ...rest } = attrs;
|
|
6412
6484
|
return rest;
|
|
6413
6485
|
});
|
|
6486
|
+
const getNamedSlot = (name) => slots[name] ?? slots[name.replace(/[A-Z]/g, (s) => `-${s.toLowerCase()}`)];
|
|
6487
|
+
const resolvedCustomActions = computed(() => mergedActions.value.customActions.map((item, index) => {
|
|
6488
|
+
const iconSlotInfo = {
|
|
6489
|
+
item,
|
|
6490
|
+
index,
|
|
6491
|
+
originNode: item.icon
|
|
6492
|
+
};
|
|
6493
|
+
const iconFromSlot = getNamedSlot("customActionIconRender")?.(iconSlotInfo);
|
|
6494
|
+
const actionSlotInfo = {
|
|
6495
|
+
item,
|
|
6496
|
+
index,
|
|
6497
|
+
originNode: item.actionRender !== void 0 ? typeof item.actionRender === "function" ? item.actionRender(item) : item.actionRender : void 0
|
|
6498
|
+
};
|
|
6499
|
+
const actionFromSlot = getNamedSlot("customActionRender")?.(actionSlotInfo);
|
|
6500
|
+
return {
|
|
6501
|
+
...item,
|
|
6502
|
+
icon: iconFromSlot !== void 0 && !isEmptyNode(iconFromSlot) ? iconFromSlot : item.icon,
|
|
6503
|
+
actionRender: actionFromSlot !== void 0 && !isEmptyNode(actionFromSlot) ? actionFromSlot : item.actionRender
|
|
6504
|
+
};
|
|
6505
|
+
}));
|
|
6414
6506
|
function applySvgTransform() {
|
|
6415
6507
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
6416
6508
|
const svgEl = graphRef.value?.querySelector("svg");
|
|
@@ -6538,7 +6630,7 @@ var mermaid_default = /* @__PURE__ */ defineComponent({
|
|
|
6538
6630
|
key: "copy",
|
|
6539
6631
|
actionRender: () => createVNode(ActionsWithSub.Copy, { "text": props.content }, null)
|
|
6540
6632
|
});
|
|
6541
|
-
return [...items, ...
|
|
6633
|
+
return [...items, ...resolvedCustomActions.value];
|
|
6542
6634
|
});
|
|
6543
6635
|
function renderHeader() {
|
|
6544
6636
|
if (props.header === null) return null;
|
|
@@ -6878,10 +6970,6 @@ function getItemDomAttrs(item) {
|
|
|
6878
6970
|
delete domAttrs.children;
|
|
6879
6971
|
return domAttrs;
|
|
6880
6972
|
}
|
|
6881
|
-
function hasRenderableNode$5(node) {
|
|
6882
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
6883
|
-
return node !== null && node !== void 0 && node !== false;
|
|
6884
|
-
}
|
|
6885
6973
|
//#endregion
|
|
6886
6974
|
//#region components/prompts/index.tsx
|
|
6887
6975
|
var prompts_default = /* @__PURE__ */ defineComponent({
|
|
@@ -7054,12 +7142,12 @@ var prompts_default = /* @__PURE__ */ defineComponent({
|
|
|
7054
7142
|
],
|
|
7055
7143
|
"style": [nested ? mergedStyles.value.subItem : mergedStyles.value.item, item.style],
|
|
7056
7144
|
"onClick": () => triggerItemClick(item, nested)
|
|
7057
|
-
}), [hasRenderableNode
|
|
7145
|
+
}), [hasRenderableNode(iconNode) && createVNode("div", { "class": `${props.prefixCls}-icon` }, [iconNode]), createVNode("div", {
|
|
7058
7146
|
"class": [`${props.prefixCls}-content`, mergedClasses.value.itemContent],
|
|
7059
7147
|
"style": mergedStyles.value.itemContent
|
|
7060
7148
|
}, [
|
|
7061
|
-
hasRenderableNode
|
|
7062
|
-
hasRenderableNode
|
|
7149
|
+
hasRenderableNode(labelNode) && createVNode("div", { "class": `${props.prefixCls}-label` }, [labelNode]),
|
|
7150
|
+
hasRenderableNode(descriptionNode) && createVNode("div", { "class": `${props.prefixCls}-desc` }, [descriptionNode]),
|
|
7063
7151
|
itemHasChildren && createVNode("div", { "class": `${props.prefixCls}-nested` }, [renderItems(item.children, true)])
|
|
7064
7152
|
])]);
|
|
7065
7153
|
})]);
|
|
@@ -7084,7 +7172,7 @@ var prompts_default = /* @__PURE__ */ defineComponent({
|
|
|
7084
7172
|
attrs.style,
|
|
7085
7173
|
props.style
|
|
7086
7174
|
]
|
|
7087
|
-
}), [hasRenderableNode
|
|
7175
|
+
}), [hasRenderableNode(renderTitle()) && createVNode("div", {
|
|
7088
7176
|
"class": [`${props.prefixCls}-title`, mergedClasses.value.title],
|
|
7089
7177
|
"style": mergedStyles.value.title
|
|
7090
7178
|
}, [renderTitle()]), renderItems(props.items)]);
|
|
@@ -9282,10 +9370,6 @@ Sender.Header = SenderHeader_default;
|
|
|
9282
9370
|
Sender.Switch = SenderSwitch_default;
|
|
9283
9371
|
//#endregion
|
|
9284
9372
|
//#region components/sources/components/CarouselCard.tsx
|
|
9285
|
-
var hasRenderableNode$4 = (node) => {
|
|
9286
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
9287
|
-
return node !== null && node !== void 0 && node !== false;
|
|
9288
|
-
};
|
|
9289
9373
|
var CarouselCard = /* @__PURE__ */ defineComponent({
|
|
9290
9374
|
name: "XSourcesCarouselCard",
|
|
9291
9375
|
props: {
|
|
@@ -9396,7 +9480,7 @@ var CarouselCard = /* @__PURE__ */ defineComponent({
|
|
|
9396
9480
|
"key": item.key ?? index,
|
|
9397
9481
|
"class": `${compCls}-item`,
|
|
9398
9482
|
"onClick": () => handleClick(item)
|
|
9399
|
-
}, [createVNode("div", { "class": `${compCls}-item-title-wrapper` }, [hasRenderableNode
|
|
9483
|
+
}, [createVNode("div", { "class": `${compCls}-item-title-wrapper` }, [hasRenderableNode(iconNode) && createVNode("span", { "class": `${compCls}-item-icon` }, [iconNode]), createVNode("span", { "class": `${compCls}-item-title` }, [titleNode])]), hasRenderableNode(descriptionNode) && createVNode("div", { "class": `${compCls}-item-description` }, [descriptionNode])]);
|
|
9400
9484
|
})())] })]);
|
|
9401
9485
|
}
|
|
9402
9486
|
});
|
|
@@ -9501,12 +9585,6 @@ var style_default$4 = genStyleHooks("Sources", (token) => {
|
|
|
9501
9585
|
return [genSourcesStyle(compToken), genCollapseMotion(compToken)];
|
|
9502
9586
|
}, prepareComponentToken$4);
|
|
9503
9587
|
//#endregion
|
|
9504
|
-
//#region components/sources/Sources.tsx
|
|
9505
|
-
var hasRenderableNode$3 = (node) => {
|
|
9506
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
9507
|
-
return node !== null && node !== void 0 && node !== false;
|
|
9508
|
-
};
|
|
9509
|
-
//#endregion
|
|
9510
9588
|
//#region components/sources/index.tsx
|
|
9511
9589
|
var sources_default = /* @__PURE__ */ defineComponent({
|
|
9512
9590
|
name: "AxSources",
|
|
@@ -9659,9 +9737,9 @@ var sources_default = /* @__PURE__ */ defineComponent({
|
|
|
9659
9737
|
"target": "_blank",
|
|
9660
9738
|
"rel": "noopener noreferrer"
|
|
9661
9739
|
}, [
|
|
9662
|
-
hasRenderableNode
|
|
9740
|
+
hasRenderableNode(iconNode) && createVNode("span", { "class": `${props.prefixCls}-link-icon` }, [iconNode]),
|
|
9663
9741
|
createVNode("span", { "class": `${props.prefixCls}-link-title` }, [titleNode]),
|
|
9664
|
-
hasRenderableNode
|
|
9742
|
+
hasRenderableNode(descriptionNode) && createVNode("span", { "class": `${props.prefixCls}-link-description` }, [descriptionNode])
|
|
9665
9743
|
])]);
|
|
9666
9744
|
})]) : slots.default?.();
|
|
9667
9745
|
return createVNode("div", mergeProps({ "ref": rootRef }, domAttrs.value, {
|
|
@@ -9809,12 +9887,6 @@ function useActive(items, open, rtl, onCancel) {
|
|
|
9809
9887
|
return [activePaths, onKeyDown];
|
|
9810
9888
|
}
|
|
9811
9889
|
//#endregion
|
|
9812
|
-
//#region components/suggestion/Suggestion.tsx
|
|
9813
|
-
var hasRenderableNode$2 = (node) => {
|
|
9814
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
9815
|
-
return node !== null && node !== void 0 && node !== false;
|
|
9816
|
-
};
|
|
9817
|
-
//#endregion
|
|
9818
9890
|
//#region components/suggestion/index.tsx
|
|
9819
9891
|
var suggestion_default = /* @__PURE__ */ defineComponent({
|
|
9820
9892
|
name: "AxSuggestion",
|
|
@@ -9971,9 +10043,9 @@ var suggestion_default = /* @__PURE__ */ defineComponent({
|
|
|
9971
10043
|
originNode: item.extra
|
|
9972
10044
|
});
|
|
9973
10045
|
return createVNode(Flex, { "class": `${prefixCls.value}-item` }, { default: () => [
|
|
9974
|
-
hasRenderableNode
|
|
10046
|
+
hasRenderableNode(iconNode) && createVNode("div", { "class": `${prefixCls.value}-item-icon` }, [iconNode]),
|
|
9975
10047
|
labelNode,
|
|
9976
|
-
hasRenderableNode
|
|
10048
|
+
hasRenderableNode(extraNode) && createVNode("div", { "class": `${prefixCls.value}-item-extra` }, [extraNode])
|
|
9977
10049
|
] });
|
|
9978
10050
|
},
|
|
9979
10051
|
"classes": { popup: { root: popupRootClass.value } },
|
|
@@ -10500,10 +10572,6 @@ var style_default$1 = genStyleHooks("ThoughtChain", (token) => {
|
|
|
10500
10572
|
}, prepareComponentToken$1);
|
|
10501
10573
|
//#endregion
|
|
10502
10574
|
//#region components/thought-chain/Item.tsx
|
|
10503
|
-
function hasRenderableNode$1(node) {
|
|
10504
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
10505
|
-
return node !== null && node !== void 0 && node !== false;
|
|
10506
|
-
}
|
|
10507
10575
|
var XThoughtChainItem = /* @__PURE__ */ defineComponent({
|
|
10508
10576
|
name: "AxThoughtChainItem",
|
|
10509
10577
|
props: {
|
|
@@ -10583,16 +10651,16 @@ var XThoughtChainItem = /* @__PURE__ */ defineComponent({
|
|
|
10583
10651
|
return () => {
|
|
10584
10652
|
const cls = itemPrefixCls.value;
|
|
10585
10653
|
const statusCls = `${props.prefixCls}-status`;
|
|
10586
|
-
const
|
|
10654
|
+
const iconSlot = slots.icon;
|
|
10587
10655
|
const originIconNode = props.status ? STATUS_ICON_MAP[props.status] : props.icon;
|
|
10588
|
-
const iconNode =
|
|
10656
|
+
const iconNode = iconSlot ? iconSlot({
|
|
10589
10657
|
originNode: originIconNode,
|
|
10590
10658
|
status: props.status
|
|
10591
10659
|
}) : originIconNode;
|
|
10592
10660
|
const titleNode = slots.title ? slots.title({ originNode: props.title }) : props.title;
|
|
10593
10661
|
const descriptionNode = slots.description ? slots.description({ originNode: props.description }) : props.description;
|
|
10594
|
-
const hasTitle = hasRenderableNode
|
|
10595
|
-
const hasDescription = hasRenderableNode
|
|
10662
|
+
const hasTitle = hasRenderableNode(titleNode);
|
|
10663
|
+
const hasDescription = hasRenderableNode(descriptionNode);
|
|
10596
10664
|
return createVNode("div", {
|
|
10597
10665
|
"ref": rootRef,
|
|
10598
10666
|
"class": [
|
|
@@ -10612,7 +10680,7 @@ var XThoughtChainItem = /* @__PURE__ */ defineComponent({
|
|
|
10612
10680
|
],
|
|
10613
10681
|
"style": props.styles?.root,
|
|
10614
10682
|
"onClick": handleClick
|
|
10615
|
-
}, [hasRenderableNode
|
|
10683
|
+
}, [hasRenderableNode(iconNode) && createVNode("div", {
|
|
10616
10684
|
"style": props.styles?.icon,
|
|
10617
10685
|
"class": [
|
|
10618
10686
|
statusCls,
|
|
@@ -10635,10 +10703,6 @@ var XThoughtChainItem = /* @__PURE__ */ defineComponent({
|
|
|
10635
10703
|
});
|
|
10636
10704
|
//#endregion
|
|
10637
10705
|
//#region components/thought-chain/Node.tsx
|
|
10638
|
-
function hasRenderableNode(node) {
|
|
10639
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
10640
|
-
return node !== null && node !== void 0 && node !== false;
|
|
10641
|
-
}
|
|
10642
10706
|
var Node_default = /* @__PURE__ */ defineComponent({
|
|
10643
10707
|
name: "ThoughtChainNode",
|
|
10644
10708
|
props: {
|