@antdv-next/x 0.1.0 → 0.3.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 -5
- package/dist/attachments/index.js +7 -6
- 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 +151 -116
- package/dist/index.umd.js +150 -115
- 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.d.ts +1 -10
- package/dist/prompts/Prompts.js +2 -11
- package/dist/prompts/interface.d.ts +0 -1
- package/dist/sources/Sources.d.ts +0 -9
- package/dist/sources/Sources.js +1 -9
- package/dist/sources/components/CarouselCard.js +1 -4
- package/dist/sources/interface.d.ts +0 -1
- package/dist/suggestion/Suggestion.d.ts +0 -18
- package/dist/suggestion/Suggestion.js +2 -18
- package/dist/suggestion/interface.d.ts +0 -2
- package/dist/thought-chain/Item.js +3 -6
- package/dist/thought-chain/Node.js +1 -4
- package/package.json +2 -1
package/dist/index.umd.js
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
shiki_dist_themes_vitesse_dark_mjs = __toESM(shiki_dist_themes_vitesse_dark_mjs);
|
|
49
49
|
shiki_dist_themes_vitesse_light_mjs = __toESM(shiki_dist_themes_vitesse_light_mjs);
|
|
50
50
|
//#region package.json
|
|
51
|
-
var version = "0.
|
|
51
|
+
var version = "0.3.0";
|
|
52
52
|
//#endregion
|
|
53
53
|
//#region components/x-provider/context.ts
|
|
54
54
|
var XProviderContextKey = Symbol("antdv-next-x-provider-context");
|
|
@@ -74,6 +74,20 @@
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
//#endregion
|
|
77
|
+
//#region components/_utils/vue.ts
|
|
78
|
+
function isEmptyNode(node) {
|
|
79
|
+
if (node === null || node === void 0 || typeof node === "boolean") return true;
|
|
80
|
+
if (Array.isArray(node)) return node.every(isEmptyNode);
|
|
81
|
+
if ((0, vue.isVNode)(node)) {
|
|
82
|
+
if (node.type === vue.Comment) return true;
|
|
83
|
+
if (node.type === vue.Fragment && Array.isArray(node.children)) return node.children.every((child) => isEmptyNode(child));
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
function hasRenderableNode(node) {
|
|
88
|
+
return !isEmptyNode(node);
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
77
91
|
//#region components/actions/ActionsMenu.tsx
|
|
78
92
|
var keySeed$1 = 0;
|
|
79
93
|
function findItem(keyPath, items) {
|
|
@@ -653,8 +667,8 @@
|
|
|
653
667
|
});
|
|
654
668
|
const mergedItem = {
|
|
655
669
|
...item,
|
|
656
|
-
icon: slottedIcon
|
|
657
|
-
actionRender: slotActionNode !== void 0 ? slotActionNode : item.actionRender
|
|
670
|
+
icon: slottedIcon !== void 0 && !isEmptyNode(slottedIcon) ? slottedIcon : item.icon,
|
|
671
|
+
actionRender: slotActionNode !== void 0 && !isEmptyNode(slotActionNode) ? slotActionNode : item.actionRender
|
|
658
672
|
};
|
|
659
673
|
return (0, vue.createVNode)(Item, {
|
|
660
674
|
"key": item.key ?? idx,
|
|
@@ -944,14 +958,14 @@
|
|
|
944
958
|
const { class: _class, style: _style, ...rest } = attrs;
|
|
945
959
|
return rest;
|
|
946
960
|
});
|
|
947
|
-
const
|
|
961
|
+
const iconSlot = (0, vue.computed)(() => slots.icon);
|
|
948
962
|
const mergedCopyIcons = (0, vue.computed)(() => {
|
|
949
963
|
const [defaultOriginNode, copiedOriginNode] = normalizeCopyIcons(props.icon);
|
|
950
|
-
if (!
|
|
951
|
-
return [
|
|
964
|
+
if (!iconSlot.value) return props.icon;
|
|
965
|
+
return [iconSlot.value({
|
|
952
966
|
originNode: defaultOriginNode,
|
|
953
967
|
status: "default"
|
|
954
|
-
}),
|
|
968
|
+
}), iconSlot.value({
|
|
955
969
|
originNode: copiedOriginNode,
|
|
956
970
|
status: "copied"
|
|
957
971
|
})];
|
|
@@ -1306,7 +1320,7 @@
|
|
|
1306
1320
|
type: Function,
|
|
1307
1321
|
default: void 0
|
|
1308
1322
|
},
|
|
1309
|
-
|
|
1323
|
+
iconSlot: {
|
|
1310
1324
|
type: Function,
|
|
1311
1325
|
default: void 0
|
|
1312
1326
|
}
|
|
@@ -1367,7 +1381,7 @@
|
|
|
1367
1381
|
color: props.iconColor,
|
|
1368
1382
|
...props.styles.icon
|
|
1369
1383
|
}
|
|
1370
|
-
}, [renderWithSlot(props.
|
|
1384
|
+
}, [renderWithSlot(props.iconSlot, iconNode.value)]),
|
|
1371
1385
|
(0, vue.createVNode)("div", { "class": `${compCls.value}-content` }, [(0, vue.createVNode)("div", {
|
|
1372
1386
|
"class": [`${compCls.value}-name`, props.classes.name],
|
|
1373
1387
|
"style": props.styles.name
|
|
@@ -2174,7 +2188,7 @@
|
|
|
2174
2188
|
"mask": props.mask,
|
|
2175
2189
|
"descriptionRenderSlot": slots.description,
|
|
2176
2190
|
"maskRenderSlot": slots.mask,
|
|
2177
|
-
"
|
|
2191
|
+
"iconSlot": slots.icon,
|
|
2178
2192
|
"classes": mergedClasses.value,
|
|
2179
2193
|
"styles": mergedStyles.value
|
|
2180
2194
|
}, null);
|
|
@@ -2384,7 +2398,7 @@
|
|
|
2384
2398
|
item: fileItem,
|
|
2385
2399
|
index: itemIndex
|
|
2386
2400
|
}) : void 0,
|
|
2387
|
-
|
|
2401
|
+
icon: slots.iconRender ? (slotInfo) => slots.iconRender?.({
|
|
2388
2402
|
...slotInfo,
|
|
2389
2403
|
item: fileItem,
|
|
2390
2404
|
index: itemIndex
|
|
@@ -2709,6 +2723,10 @@
|
|
|
2709
2723
|
type: String,
|
|
2710
2724
|
required: true
|
|
2711
2725
|
},
|
|
2726
|
+
type: {
|
|
2727
|
+
type: String,
|
|
2728
|
+
required: true
|
|
2729
|
+
},
|
|
2712
2730
|
placeholder: {
|
|
2713
2731
|
type: [
|
|
2714
2732
|
String,
|
|
@@ -2756,6 +2774,28 @@
|
|
|
2756
2774
|
if (!isConfig.value) return {};
|
|
2757
2775
|
return props.placeholder;
|
|
2758
2776
|
});
|
|
2777
|
+
const renderConfigNode = () => {
|
|
2778
|
+
const iconOriginNode = placeholderConfig.value.icon;
|
|
2779
|
+
const titleOriginNode = placeholderConfig.value.title;
|
|
2780
|
+
const descriptionOriginNode = placeholderConfig.value.description;
|
|
2781
|
+
const iconNode = slots.placeholderIcon?.({
|
|
2782
|
+
type: props.type,
|
|
2783
|
+
originNode: iconOriginNode
|
|
2784
|
+
}) ?? iconOriginNode;
|
|
2785
|
+
const titleNode = slots.placeholderTitle?.({
|
|
2786
|
+
type: props.type,
|
|
2787
|
+
originNode: titleOriginNode
|
|
2788
|
+
}) ?? titleOriginNode;
|
|
2789
|
+
const descriptionNode = slots.placeholderDescription?.({
|
|
2790
|
+
type: props.type,
|
|
2791
|
+
originNode: descriptionOriginNode
|
|
2792
|
+
}) ?? descriptionOriginNode;
|
|
2793
|
+
return (0, vue.createVNode)("div", { "class": `${placeholderCls.value}-inner` }, [
|
|
2794
|
+
(0, vue.createVNode)("span", { "class": `${placeholderCls.value}-icon` }, [iconNode]),
|
|
2795
|
+
(0, vue.createVNode)("span", { "class": `${placeholderCls.value}-title` }, [titleNode]),
|
|
2796
|
+
(0, vue.createVNode)("span", { "class": `${placeholderCls.value}-description` }, [descriptionNode])
|
|
2797
|
+
]);
|
|
2798
|
+
};
|
|
2759
2799
|
const onDragEnter = () => {
|
|
2760
2800
|
dragIn.value = true;
|
|
2761
2801
|
};
|
|
@@ -2766,11 +2806,11 @@
|
|
|
2766
2806
|
dragIn.value = false;
|
|
2767
2807
|
};
|
|
2768
2808
|
return () => {
|
|
2769
|
-
const
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2809
|
+
const originNode = isConfig.value ? renderConfigNode() : slots.default?.() || props.placeholder;
|
|
2810
|
+
const node = slots.placeholder?.({
|
|
2811
|
+
type: props.type,
|
|
2812
|
+
originNode
|
|
2813
|
+
}) ?? originNode;
|
|
2774
2814
|
return (0, vue.createVNode)("div", {
|
|
2775
2815
|
"class": [
|
|
2776
2816
|
placeholderCls.value,
|
|
@@ -3003,10 +3043,6 @@
|
|
|
3003
3043
|
type: Function,
|
|
3004
3044
|
default: void 0
|
|
3005
3045
|
},
|
|
3006
|
-
onChange: {
|
|
3007
|
-
type: Function,
|
|
3008
|
-
default: void 0
|
|
3009
|
-
},
|
|
3010
3046
|
onRemove: {
|
|
3011
3047
|
type: Function,
|
|
3012
3048
|
default: void 0
|
|
@@ -3048,7 +3084,6 @@
|
|
|
3048
3084
|
});
|
|
3049
3085
|
const triggerChange = (info) => {
|
|
3050
3086
|
fileList.value = info.fileList;
|
|
3051
|
-
props.onChange?.(info);
|
|
3052
3087
|
emit("change", info);
|
|
3053
3088
|
};
|
|
3054
3089
|
const onUploadChange = (info) => {
|
|
@@ -3113,12 +3148,18 @@
|
|
|
3113
3148
|
const getPlaceholderNode = (type, options) => {
|
|
3114
3149
|
const placeholderContent = typeof props.placeholder === "function" ? props.placeholder(type) : props.placeholder;
|
|
3115
3150
|
return (0, vue.createVNode)(PlaceholderUploader, {
|
|
3151
|
+
"type": type,
|
|
3116
3152
|
"placeholder": placeholderContent,
|
|
3117
3153
|
"upload": uploadProps.value,
|
|
3118
3154
|
"prefixCls": props.prefixCls,
|
|
3119
3155
|
"class": mergedClasses.value.placeholder,
|
|
3120
3156
|
"style": [mergedStyles.value.placeholder, options?.style]
|
|
3121
|
-
},
|
|
3157
|
+
}, {
|
|
3158
|
+
placeholder: slots.placeholder,
|
|
3159
|
+
placeholderIcon: slots.placeholderIcon,
|
|
3160
|
+
placeholderTitle: slots.placeholderTitle,
|
|
3161
|
+
placeholderDescription: slots.placeholderDescription
|
|
3162
|
+
});
|
|
3122
3163
|
};
|
|
3123
3164
|
const renderWithChildren = () => {
|
|
3124
3165
|
let _slot;
|
|
@@ -3853,10 +3894,6 @@
|
|
|
3853
3894
|
if (!slot) return null;
|
|
3854
3895
|
return typeof slot === "function" ? slot(content, info) : slot;
|
|
3855
3896
|
}
|
|
3856
|
-
function hasRenderableNode$7(node) {
|
|
3857
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
3858
|
-
return node !== null && node !== void 0 && node !== false;
|
|
3859
|
-
}
|
|
3860
3897
|
var XBubble = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
3861
3898
|
name: "AxBubble",
|
|
3862
3899
|
inheritAttrs: false,
|
|
@@ -4020,12 +4057,12 @@
|
|
|
4020
4057
|
return rest;
|
|
4021
4058
|
});
|
|
4022
4059
|
const memoedContent = (0, vue.computed)(() => {
|
|
4023
|
-
if (slots.
|
|
4024
|
-
const slotNode = slots.
|
|
4060
|
+
if (slots.content) {
|
|
4061
|
+
const slotNode = slots.content({
|
|
4025
4062
|
content: props.content,
|
|
4026
4063
|
info: props.info
|
|
4027
4064
|
});
|
|
4028
|
-
if (hasRenderableNode
|
|
4065
|
+
if (hasRenderableNode(slotNode)) return slotNode;
|
|
4029
4066
|
}
|
|
4030
4067
|
return props.contentRender ? props.contentRender(props.content, props.info) : props.content;
|
|
4031
4068
|
});
|
|
@@ -4116,12 +4153,12 @@
|
|
|
4116
4153
|
};
|
|
4117
4154
|
const renderContent = () => {
|
|
4118
4155
|
if (props.loading) {
|
|
4119
|
-
if (slots.
|
|
4120
|
-
const slotNode = slots.
|
|
4156
|
+
if (slots.loading) {
|
|
4157
|
+
const slotNode = slots.loading({
|
|
4121
4158
|
content: props.content,
|
|
4122
4159
|
info: props.info
|
|
4123
4160
|
});
|
|
4124
|
-
if (hasRenderableNode
|
|
4161
|
+
if (hasRenderableNode(slotNode)) return slotNode;
|
|
4125
4162
|
}
|
|
4126
4163
|
if (props.loadingRender) return props.loadingRender(props.content, props.info);
|
|
4127
4164
|
return (0, vue.createVNode)(loading_default, { "prefixCls": props.prefixCls }, null);
|
|
@@ -4261,7 +4298,7 @@
|
|
|
4261
4298
|
"class": [`${props.prefixCls}-divider`, props.class],
|
|
4262
4299
|
"styles": props.styles,
|
|
4263
4300
|
"classes": props.classes
|
|
4264
|
-
}), {
|
|
4301
|
+
}), { content: ({ content }) => (0, vue.createVNode)(antdv_next.Divider, props.dividerProps, _isSlot$3(content) ? content : { default: () => [content] }) });
|
|
4265
4302
|
}
|
|
4266
4303
|
});
|
|
4267
4304
|
//#endregion
|
|
@@ -4696,10 +4733,10 @@
|
|
|
4696
4733
|
role
|
|
4697
4734
|
});
|
|
4698
4735
|
};
|
|
4699
|
-
if (slots.contentRender) bubbleSlots.
|
|
4700
|
-
else if (contentRender) bubbleSlots.
|
|
4701
|
-
if (slots.loadingRender) bubbleSlots.
|
|
4702
|
-
else if (loadingRender) bubbleSlots.
|
|
4736
|
+
if (slots.contentRender) bubbleSlots.content = bindListSlot("contentRender");
|
|
4737
|
+
else if (contentRender) bubbleSlots.content = ({ content, info: bubbleInfo }) => contentRender(content, bubbleInfo);
|
|
4738
|
+
if (slots.loadingRender) bubbleSlots.loading = bindListSlot("loadingRender");
|
|
4739
|
+
else if (loadingRender) bubbleSlots.loading = ({ content, info: bubbleInfo }) => loadingRender(content, bubbleInfo);
|
|
4703
4740
|
for (const name of bubbleSlotNames) {
|
|
4704
4741
|
if (name === "contentRender" || name === "loadingRender") continue;
|
|
4705
4742
|
const slot = bindListSlot(name);
|
|
@@ -4767,7 +4804,8 @@
|
|
|
4767
4804
|
}
|
|
4768
4805
|
async function loadLang(lang) {
|
|
4769
4806
|
const loader = LANG_LOADERS[lang];
|
|
4770
|
-
if (!loader
|
|
4807
|
+
if (!loader) return false;
|
|
4808
|
+
if (loadedLangs.has(lang)) return true;
|
|
4771
4809
|
const instance = await getHighlighter();
|
|
4772
4810
|
const mod = await loader();
|
|
4773
4811
|
await instance.loadLanguage(mod.default);
|
|
@@ -5514,6 +5552,20 @@
|
|
|
5514
5552
|
type: Object,
|
|
5515
5553
|
required: true
|
|
5516
5554
|
},
|
|
5555
|
+
groupLabelRender: {
|
|
5556
|
+
type: [
|
|
5557
|
+
String,
|
|
5558
|
+
Number,
|
|
5559
|
+
Object,
|
|
5560
|
+
Array,
|
|
5561
|
+
Function
|
|
5562
|
+
],
|
|
5563
|
+
default: void 0
|
|
5564
|
+
},
|
|
5565
|
+
groupLabelRenderSlot: {
|
|
5566
|
+
type: Function,
|
|
5567
|
+
default: void 0
|
|
5568
|
+
},
|
|
5517
5569
|
classes: {
|
|
5518
5570
|
type: [
|
|
5519
5571
|
String,
|
|
@@ -5549,15 +5601,22 @@
|
|
|
5549
5601
|
});
|
|
5550
5602
|
const labelNode = (0, vue.computed)(() => {
|
|
5551
5603
|
const { label, name } = props.groupInfo;
|
|
5552
|
-
|
|
5553
|
-
|
|
5604
|
+
const originNode = typeof label === "function" ? label(name, { groupInfo: props.groupInfo }) : label || name;
|
|
5605
|
+
const renderInfo = {
|
|
5606
|
+
group: name,
|
|
5607
|
+
groupInfo: props.groupInfo,
|
|
5608
|
+
originNode
|
|
5609
|
+
};
|
|
5610
|
+
if (props.groupLabelRenderSlot) return props.groupLabelRenderSlot(renderInfo);
|
|
5611
|
+
if (props.groupLabelRender !== void 0) return typeof props.groupLabelRender === "function" ? props.groupLabelRender(name, renderInfo) : props.groupLabelRender;
|
|
5612
|
+
return originNode;
|
|
5554
5613
|
});
|
|
5555
5614
|
return () => (0, vue.createVNode)("li", { "class": props.classes }, [(0, vue.createVNode)("div", {
|
|
5556
5615
|
"class": [`${props.prefixCls}-group-title`, { [`${props.prefixCls}-group-title-collapsible`]: mergeCollapsible.value }],
|
|
5557
5616
|
"onClick": () => {
|
|
5558
5617
|
if (mergeCollapsible.value) props.onItemExpand?.(props.groupInfo.name);
|
|
5559
5618
|
}
|
|
5560
|
-
}, [labelNode.value && (0, vue.createVNode)("div", { "class": `${props.prefixCls}-group-label` }, [labelNode.value]), mergeCollapsible.value && (0, vue.createVNode)("div", { "class": [`${props.prefixCls}-group-collapse-trigger`, `${props.prefixCls}-group-collapse-trigger-${groupOpen.value ? "open" : "close"}`] }, [(0, vue.createVNode)(_antdv_next_icons.RightOutlined, null, null)])]), (0, vue.createVNode)(vue.Transition, props.collapseTransition ?? {}, { default: () => [mergeCollapsible.value ? groupOpen.value ? (0, vue.createVNode)("div", null, [slots.default?.()]) : null : (0, vue.createVNode)("div", null, [slots.default?.()])] })]);
|
|
5619
|
+
}, [hasRenderableNode(labelNode.value) && (0, vue.createVNode)("div", { "class": `${props.prefixCls}-group-label` }, [labelNode.value]), mergeCollapsible.value && (0, vue.createVNode)("div", { "class": [`${props.prefixCls}-group-collapse-trigger`, `${props.prefixCls}-group-collapse-trigger-${groupOpen.value ? "open" : "close"}`] }, [(0, vue.createVNode)(_antdv_next_icons.RightOutlined, null, null)])]), (0, vue.createVNode)(vue.Transition, props.collapseTransition ?? {}, { default: () => [mergeCollapsible.value ? groupOpen.value ? (0, vue.createVNode)("div", null, [slots.default?.()]) : null : (0, vue.createVNode)("div", null, [slots.default?.()])] })]);
|
|
5561
5620
|
}
|
|
5562
5621
|
});
|
|
5563
5622
|
//#endregion
|
|
@@ -5642,10 +5701,6 @@
|
|
|
5642
5701
|
var stopPropagation = (event) => {
|
|
5643
5702
|
event.stopPropagation();
|
|
5644
5703
|
};
|
|
5645
|
-
var hasRenderableNode$6 = (node) => {
|
|
5646
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
5647
|
-
return node !== null && node !== void 0 && node !== false;
|
|
5648
|
-
};
|
|
5649
5704
|
var renderWithPriority = (render, slotRender, info) => {
|
|
5650
5705
|
if (slotRender) return slotRender(info);
|
|
5651
5706
|
if (render !== void 0) return typeof render === "function" ? render(info.item, info) : render;
|
|
@@ -5776,7 +5831,7 @@
|
|
|
5776
5831
|
if (!disabled) props.onClick?.(props.info.key, props.info);
|
|
5777
5832
|
}
|
|
5778
5833
|
}, [
|
|
5779
|
-
hasRenderableNode
|
|
5834
|
+
hasRenderableNode(iconNode) && (0, vue.createVNode)("div", { "class": `${props.prefixCls}-icon` }, [iconNode]),
|
|
5780
5835
|
(0, vue.createVNode)(antdv_next.Typography.Text, { "class": `${props.prefixCls}-label` }, _isSlot$2(labelNode) ? labelNode : { default: () => [labelNode] }),
|
|
5781
5836
|
!disabled && props.menu && (0, vue.createVNode)("div", { "onClick": stopPropagation }, [(0, vue.createVNode)(antdv_next.Dropdown, {
|
|
5782
5837
|
"menu": menuProps.value,
|
|
@@ -5997,6 +6052,16 @@
|
|
|
5997
6052
|
],
|
|
5998
6053
|
default: void 0
|
|
5999
6054
|
},
|
|
6055
|
+
groupLabelRender: {
|
|
6056
|
+
type: [
|
|
6057
|
+
String,
|
|
6058
|
+
Number,
|
|
6059
|
+
Object,
|
|
6060
|
+
Array,
|
|
6061
|
+
Function
|
|
6062
|
+
],
|
|
6063
|
+
default: void 0
|
|
6064
|
+
},
|
|
6000
6065
|
menu: {
|
|
6001
6066
|
type: [Object, Function],
|
|
6002
6067
|
default: void 0
|
|
@@ -6168,6 +6233,8 @@
|
|
|
6168
6233
|
"key": groupInfo.name || `key-${groupIndex}`,
|
|
6169
6234
|
"prefixCls": props.prefixCls,
|
|
6170
6235
|
"groupInfo": groupInfo,
|
|
6236
|
+
"groupLabelRender": props.groupLabelRender,
|
|
6237
|
+
"groupLabelRenderSlot": slots.groupLabelRender,
|
|
6171
6238
|
"classes": [contextConfig.value.classes?.group, props.classes?.group],
|
|
6172
6239
|
"enableCollapse": enableCollapse.value,
|
|
6173
6240
|
"expandedKeys": mergedExpandedKeys.value,
|
|
@@ -6446,6 +6513,26 @@
|
|
|
6446
6513
|
const { class: _class, style: _style, ...rest } = attrs;
|
|
6447
6514
|
return rest;
|
|
6448
6515
|
});
|
|
6516
|
+
const getNamedSlot = (name) => slots[name] ?? slots[name.replace(/[A-Z]/g, (s) => `-${s.toLowerCase()}`)];
|
|
6517
|
+
const resolvedCustomActions = (0, vue.computed)(() => mergedActions.value.customActions.map((item, index) => {
|
|
6518
|
+
const iconSlotInfo = {
|
|
6519
|
+
item,
|
|
6520
|
+
index,
|
|
6521
|
+
originNode: item.icon
|
|
6522
|
+
};
|
|
6523
|
+
const iconFromSlot = getNamedSlot("customActionIconRender")?.(iconSlotInfo);
|
|
6524
|
+
const actionSlotInfo = {
|
|
6525
|
+
item,
|
|
6526
|
+
index,
|
|
6527
|
+
originNode: item.actionRender !== void 0 ? typeof item.actionRender === "function" ? item.actionRender(item) : item.actionRender : void 0
|
|
6528
|
+
};
|
|
6529
|
+
const actionFromSlot = getNamedSlot("customActionRender")?.(actionSlotInfo);
|
|
6530
|
+
return {
|
|
6531
|
+
...item,
|
|
6532
|
+
icon: iconFromSlot !== void 0 && !isEmptyNode(iconFromSlot) ? iconFromSlot : item.icon,
|
|
6533
|
+
actionRender: actionFromSlot !== void 0 && !isEmptyNode(actionFromSlot) ? actionFromSlot : item.actionRender
|
|
6534
|
+
};
|
|
6535
|
+
}));
|
|
6449
6536
|
function applySvgTransform() {
|
|
6450
6537
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
6451
6538
|
const svgEl = graphRef.value?.querySelector("svg");
|
|
@@ -6573,7 +6660,7 @@
|
|
|
6573
6660
|
key: "copy",
|
|
6574
6661
|
actionRender: () => (0, vue.createVNode)(ActionsWithSub.Copy, { "text": props.content }, null)
|
|
6575
6662
|
});
|
|
6576
|
-
return [...items, ...
|
|
6663
|
+
return [...items, ...resolvedCustomActions.value];
|
|
6577
6664
|
});
|
|
6578
6665
|
function renderHeader() {
|
|
6579
6666
|
if (props.header === null) return null;
|
|
@@ -6913,10 +7000,6 @@
|
|
|
6913
7000
|
delete domAttrs.children;
|
|
6914
7001
|
return domAttrs;
|
|
6915
7002
|
}
|
|
6916
|
-
function hasRenderableNode$5(node) {
|
|
6917
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
6918
|
-
return node !== null && node !== void 0 && node !== false;
|
|
6919
|
-
}
|
|
6920
7003
|
//#endregion
|
|
6921
7004
|
//#region components/prompts/index.tsx
|
|
6922
7005
|
var prompts_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -6936,10 +7019,6 @@
|
|
|
6936
7019
|
],
|
|
6937
7020
|
default: void 0
|
|
6938
7021
|
},
|
|
6939
|
-
onItemClick: {
|
|
6940
|
-
type: Function,
|
|
6941
|
-
default: void 0
|
|
6942
|
-
},
|
|
6943
7022
|
vertical: {
|
|
6944
7023
|
type: Boolean,
|
|
6945
7024
|
default: false
|
|
@@ -7041,9 +7120,7 @@
|
|
|
7041
7120
|
});
|
|
7042
7121
|
const triggerItemClick = (item, nested) => {
|
|
7043
7122
|
if (item.disabled || !nested && hasChildren(item)) return;
|
|
7044
|
-
|
|
7045
|
-
props.onItemClick?.(info);
|
|
7046
|
-
emit("itemClick", info);
|
|
7123
|
+
emit("itemClick", { data: item });
|
|
7047
7124
|
};
|
|
7048
7125
|
const renderTitle = () => {
|
|
7049
7126
|
if (slots.title) return slots.title({ originNode: props.title });
|
|
@@ -7089,12 +7166,12 @@
|
|
|
7089
7166
|
],
|
|
7090
7167
|
"style": [nested ? mergedStyles.value.subItem : mergedStyles.value.item, item.style],
|
|
7091
7168
|
"onClick": () => triggerItemClick(item, nested)
|
|
7092
|
-
}), [hasRenderableNode
|
|
7169
|
+
}), [hasRenderableNode(iconNode) && (0, vue.createVNode)("div", { "class": `${props.prefixCls}-icon` }, [iconNode]), (0, vue.createVNode)("div", {
|
|
7093
7170
|
"class": [`${props.prefixCls}-content`, mergedClasses.value.itemContent],
|
|
7094
7171
|
"style": mergedStyles.value.itemContent
|
|
7095
7172
|
}, [
|
|
7096
|
-
hasRenderableNode
|
|
7097
|
-
hasRenderableNode
|
|
7173
|
+
hasRenderableNode(labelNode) && (0, vue.createVNode)("div", { "class": `${props.prefixCls}-label` }, [labelNode]),
|
|
7174
|
+
hasRenderableNode(descriptionNode) && (0, vue.createVNode)("div", { "class": `${props.prefixCls}-desc` }, [descriptionNode]),
|
|
7098
7175
|
itemHasChildren && (0, vue.createVNode)("div", { "class": `${props.prefixCls}-nested` }, [renderItems(item.children, true)])
|
|
7099
7176
|
])]);
|
|
7100
7177
|
})]);
|
|
@@ -7119,7 +7196,7 @@
|
|
|
7119
7196
|
attrs.style,
|
|
7120
7197
|
props.style
|
|
7121
7198
|
]
|
|
7122
|
-
}), [hasRenderableNode
|
|
7199
|
+
}), [hasRenderableNode(renderTitle()) && (0, vue.createVNode)("div", {
|
|
7123
7200
|
"class": [`${props.prefixCls}-title`, mergedClasses.value.title],
|
|
7124
7201
|
"style": mergedStyles.value.title
|
|
7125
7202
|
}, [renderTitle()]), renderItems(props.items)]);
|
|
@@ -9317,10 +9394,6 @@
|
|
|
9317
9394
|
Sender.Switch = SenderSwitch_default;
|
|
9318
9395
|
//#endregion
|
|
9319
9396
|
//#region components/sources/components/CarouselCard.tsx
|
|
9320
|
-
var hasRenderableNode$4 = (node) => {
|
|
9321
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
9322
|
-
return node !== null && node !== void 0 && node !== false;
|
|
9323
|
-
};
|
|
9324
9397
|
var CarouselCard = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
9325
9398
|
name: "XSourcesCarouselCard",
|
|
9326
9399
|
props: {
|
|
@@ -9431,7 +9504,7 @@
|
|
|
9431
9504
|
"key": item.key ?? index,
|
|
9432
9505
|
"class": `${compCls}-item`,
|
|
9433
9506
|
"onClick": () => handleClick(item)
|
|
9434
|
-
}, [(0, vue.createVNode)("div", { "class": `${compCls}-item-title-wrapper` }, [hasRenderableNode
|
|
9507
|
+
}, [(0, vue.createVNode)("div", { "class": `${compCls}-item-title-wrapper` }, [hasRenderableNode(iconNode) && (0, vue.createVNode)("span", { "class": `${compCls}-item-icon` }, [iconNode]), (0, vue.createVNode)("span", { "class": `${compCls}-item-title` }, [titleNode])]), hasRenderableNode(descriptionNode) && (0, vue.createVNode)("div", { "class": `${compCls}-item-description` }, [descriptionNode])]);
|
|
9435
9508
|
})())] })]);
|
|
9436
9509
|
}
|
|
9437
9510
|
});
|
|
@@ -9536,12 +9609,6 @@
|
|
|
9536
9609
|
return [genSourcesStyle(compToken), genCollapseMotion(compToken)];
|
|
9537
9610
|
}, prepareComponentToken$4);
|
|
9538
9611
|
//#endregion
|
|
9539
|
-
//#region components/sources/Sources.tsx
|
|
9540
|
-
var hasRenderableNode$3 = (node) => {
|
|
9541
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
9542
|
-
return node !== null && node !== void 0 && node !== false;
|
|
9543
|
-
};
|
|
9544
|
-
//#endregion
|
|
9545
9612
|
//#region components/sources/index.tsx
|
|
9546
9613
|
var sources_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
9547
9614
|
name: "AxSources",
|
|
@@ -9618,10 +9685,6 @@
|
|
|
9618
9685
|
defaultExpanded: {
|
|
9619
9686
|
type: Boolean,
|
|
9620
9687
|
default: void 0
|
|
9621
|
-
},
|
|
9622
|
-
onExpand: {
|
|
9623
|
-
type: Function,
|
|
9624
|
-
default: void 0
|
|
9625
9688
|
}
|
|
9626
9689
|
},
|
|
9627
9690
|
emits: ["expand"],
|
|
@@ -9644,7 +9707,6 @@
|
|
|
9644
9707
|
const toggleExpand = () => {
|
|
9645
9708
|
const newExpand = !isExpand.value;
|
|
9646
9709
|
if (props.expanded === void 0) innerExpanded.value = newExpand;
|
|
9647
|
-
props.onExpand?.(newExpand);
|
|
9648
9710
|
emit("expand", newExpand);
|
|
9649
9711
|
};
|
|
9650
9712
|
const domAttrs = (0, vue.computed)(() => {
|
|
@@ -9694,9 +9756,9 @@
|
|
|
9694
9756
|
"target": "_blank",
|
|
9695
9757
|
"rel": "noopener noreferrer"
|
|
9696
9758
|
}, [
|
|
9697
|
-
hasRenderableNode
|
|
9759
|
+
hasRenderableNode(iconNode) && (0, vue.createVNode)("span", { "class": `${props.prefixCls}-link-icon` }, [iconNode]),
|
|
9698
9760
|
(0, vue.createVNode)("span", { "class": `${props.prefixCls}-link-title` }, [titleNode]),
|
|
9699
|
-
hasRenderableNode
|
|
9761
|
+
hasRenderableNode(descriptionNode) && (0, vue.createVNode)("span", { "class": `${props.prefixCls}-link-description` }, [descriptionNode])
|
|
9700
9762
|
])]);
|
|
9701
9763
|
})]) : slots.default?.();
|
|
9702
9764
|
return (0, vue.createVNode)("div", (0, vue.mergeProps)({ "ref": rootRef }, domAttrs.value, {
|
|
@@ -9844,12 +9906,6 @@
|
|
|
9844
9906
|
return [activePaths, onKeyDown];
|
|
9845
9907
|
}
|
|
9846
9908
|
//#endregion
|
|
9847
|
-
//#region components/suggestion/Suggestion.tsx
|
|
9848
|
-
var hasRenderableNode$2 = (node) => {
|
|
9849
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
9850
|
-
return node !== null && node !== void 0 && node !== false;
|
|
9851
|
-
};
|
|
9852
|
-
//#endregion
|
|
9853
9909
|
//#region components/suggestion/index.tsx
|
|
9854
9910
|
var suggestion_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
9855
9911
|
name: "AxSuggestion",
|
|
@@ -9891,14 +9947,6 @@
|
|
|
9891
9947
|
type: Boolean,
|
|
9892
9948
|
default: void 0
|
|
9893
9949
|
},
|
|
9894
|
-
onOpenChange: {
|
|
9895
|
-
type: Function,
|
|
9896
|
-
default: void 0
|
|
9897
|
-
},
|
|
9898
|
-
onSelect: {
|
|
9899
|
-
type: Function,
|
|
9900
|
-
default: void 0
|
|
9901
|
-
},
|
|
9902
9950
|
items: {
|
|
9903
9951
|
type: [Array, Function],
|
|
9904
9952
|
default: () => []
|
|
@@ -9941,7 +9989,6 @@
|
|
|
9941
9989
|
}, { immediate: true });
|
|
9942
9990
|
const triggerOpen = (nextOpen) => {
|
|
9943
9991
|
if (props.open === void 0) innerOpen.value = nextOpen;
|
|
9944
|
-
props.onOpenChange?.(nextOpen);
|
|
9945
9992
|
emit("openChange", nextOpen);
|
|
9946
9993
|
};
|
|
9947
9994
|
const onClose = () => {
|
|
@@ -9959,11 +10006,7 @@
|
|
|
9959
10006
|
const path = Array.isArray(valuePath) ? valuePath : [];
|
|
9960
10007
|
const lastValue = path[path.length - 1];
|
|
9961
10008
|
const selected = selectedOptions ?? [];
|
|
9962
|
-
if (lastValue !== void 0)
|
|
9963
|
-
const selectedValue = String(lastValue);
|
|
9964
|
-
props.onSelect?.(selectedValue, selected);
|
|
9965
|
-
emit("select", selectedValue, selected);
|
|
9966
|
-
}
|
|
10009
|
+
if (lastValue !== void 0) emit("select", String(lastValue), selected);
|
|
9967
10010
|
triggerOpen(false);
|
|
9968
10011
|
};
|
|
9969
10012
|
const [activePath, onKeyDown] = useActive(itemList, mergedOpen, isRtl, onClose);
|
|
@@ -10006,9 +10049,9 @@
|
|
|
10006
10049
|
originNode: item.extra
|
|
10007
10050
|
});
|
|
10008
10051
|
return (0, vue.createVNode)(antdv_next.Flex, { "class": `${prefixCls.value}-item` }, { default: () => [
|
|
10009
|
-
hasRenderableNode
|
|
10052
|
+
hasRenderableNode(iconNode) && (0, vue.createVNode)("div", { "class": `${prefixCls.value}-item-icon` }, [iconNode]),
|
|
10010
10053
|
labelNode,
|
|
10011
|
-
hasRenderableNode
|
|
10054
|
+
hasRenderableNode(extraNode) && (0, vue.createVNode)("div", { "class": `${prefixCls.value}-item-extra` }, [extraNode])
|
|
10012
10055
|
] });
|
|
10013
10056
|
},
|
|
10014
10057
|
"classes": { popup: { root: popupRootClass.value } },
|
|
@@ -10535,10 +10578,6 @@
|
|
|
10535
10578
|
}, prepareComponentToken$1);
|
|
10536
10579
|
//#endregion
|
|
10537
10580
|
//#region components/thought-chain/Item.tsx
|
|
10538
|
-
function hasRenderableNode$1(node) {
|
|
10539
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
10540
|
-
return node !== null && node !== void 0 && node !== false;
|
|
10541
|
-
}
|
|
10542
10581
|
var XThoughtChainItem = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
10543
10582
|
name: "AxThoughtChainItem",
|
|
10544
10583
|
props: {
|
|
@@ -10618,16 +10657,16 @@
|
|
|
10618
10657
|
return () => {
|
|
10619
10658
|
const cls = itemPrefixCls.value;
|
|
10620
10659
|
const statusCls = `${props.prefixCls}-status`;
|
|
10621
|
-
const
|
|
10660
|
+
const iconSlot = slots.icon;
|
|
10622
10661
|
const originIconNode = props.status ? STATUS_ICON_MAP[props.status] : props.icon;
|
|
10623
|
-
const iconNode =
|
|
10662
|
+
const iconNode = iconSlot ? iconSlot({
|
|
10624
10663
|
originNode: originIconNode,
|
|
10625
10664
|
status: props.status
|
|
10626
10665
|
}) : originIconNode;
|
|
10627
10666
|
const titleNode = slots.title ? slots.title({ originNode: props.title }) : props.title;
|
|
10628
10667
|
const descriptionNode = slots.description ? slots.description({ originNode: props.description }) : props.description;
|
|
10629
|
-
const hasTitle = hasRenderableNode
|
|
10630
|
-
const hasDescription = hasRenderableNode
|
|
10668
|
+
const hasTitle = hasRenderableNode(titleNode);
|
|
10669
|
+
const hasDescription = hasRenderableNode(descriptionNode);
|
|
10631
10670
|
return (0, vue.createVNode)("div", {
|
|
10632
10671
|
"ref": rootRef,
|
|
10633
10672
|
"class": [
|
|
@@ -10647,7 +10686,7 @@
|
|
|
10647
10686
|
],
|
|
10648
10687
|
"style": props.styles?.root,
|
|
10649
10688
|
"onClick": handleClick
|
|
10650
|
-
}, [hasRenderableNode
|
|
10689
|
+
}, [hasRenderableNode(iconNode) && (0, vue.createVNode)("div", {
|
|
10651
10690
|
"style": props.styles?.icon,
|
|
10652
10691
|
"class": [
|
|
10653
10692
|
statusCls,
|
|
@@ -10670,10 +10709,6 @@
|
|
|
10670
10709
|
});
|
|
10671
10710
|
//#endregion
|
|
10672
10711
|
//#region components/thought-chain/Node.tsx
|
|
10673
|
-
function hasRenderableNode(node) {
|
|
10674
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
10675
|
-
return node !== null && node !== void 0 && node !== false;
|
|
10676
|
-
}
|
|
10677
10712
|
var Node_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
10678
10713
|
name: "ThoughtChainNode",
|
|
10679
10714
|
props: {
|
|
@@ -28,6 +28,11 @@ export interface MermaidProps extends Omit<HTMLAttributes, "content" | "class" |
|
|
|
28
28
|
export interface MermaidRef {
|
|
29
29
|
nativeElement: HTMLDivElement;
|
|
30
30
|
}
|
|
31
|
+
export interface MermaidCustomActionSlotInfo {
|
|
32
|
+
item: ItemType;
|
|
33
|
+
index: number;
|
|
34
|
+
originNode: VNodeChild;
|
|
35
|
+
}
|
|
31
36
|
declare enum RenderType {
|
|
32
37
|
Code = "code",
|
|
33
38
|
Image = "image"
|
package/dist/mermaid/Mermaid.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 warning from "../_utils/warning.js";
|
|
3
4
|
import ActionsWithSub from "../actions/index.js";
|
|
4
5
|
import localeValues from "../locale/en_US.js";
|
|
@@ -168,6 +169,26 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
168
169
|
const { class: _class, style: _style, ...rest } = attrs;
|
|
169
170
|
return rest;
|
|
170
171
|
});
|
|
172
|
+
const getNamedSlot = (name) => slots[name] ?? slots[name.replace(/[A-Z]/g, (s) => `-${s.toLowerCase()}`)];
|
|
173
|
+
const resolvedCustomActions = computed(() => mergedActions.value.customActions.map((item, index) => {
|
|
174
|
+
const iconSlotInfo = {
|
|
175
|
+
item,
|
|
176
|
+
index,
|
|
177
|
+
originNode: item.icon
|
|
178
|
+
};
|
|
179
|
+
const iconFromSlot = getNamedSlot("customActionIconRender")?.(iconSlotInfo);
|
|
180
|
+
const actionSlotInfo = {
|
|
181
|
+
item,
|
|
182
|
+
index,
|
|
183
|
+
originNode: item.actionRender !== void 0 ? typeof item.actionRender === "function" ? item.actionRender(item) : item.actionRender : void 0
|
|
184
|
+
};
|
|
185
|
+
const actionFromSlot = getNamedSlot("customActionRender")?.(actionSlotInfo);
|
|
186
|
+
return {
|
|
187
|
+
...item,
|
|
188
|
+
icon: iconFromSlot !== void 0 && !isEmptyNode(iconFromSlot) ? iconFromSlot : item.icon,
|
|
189
|
+
actionRender: actionFromSlot !== void 0 && !isEmptyNode(actionFromSlot) ? actionFromSlot : item.actionRender
|
|
190
|
+
};
|
|
191
|
+
}));
|
|
171
192
|
function applySvgTransform() {
|
|
172
193
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
173
194
|
const svgEl = graphRef.value?.querySelector("svg");
|
|
@@ -295,7 +316,7 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
295
316
|
key: "copy",
|
|
296
317
|
actionRender: () => createVNode(ActionsWithSub.Copy, { "text": props.content }, null)
|
|
297
318
|
});
|
|
298
|
-
return [...items, ...
|
|
319
|
+
return [...items, ...resolvedCustomActions.value];
|
|
299
320
|
});
|
|
300
321
|
function renderHeader() {
|
|
301
322
|
if (props.header === null) return null;
|
package/dist/mermaid/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { default as Mermaid } from './Mermaid';
|
|
2
|
-
export type { MermaidActions, MermaidProps, MermaidRef, MermaidRenderType, MermaidSemanticType, } from './Mermaid';
|
|
2
|
+
export type { MermaidActions, MermaidCustomActionSlotInfo, MermaidProps, MermaidRef, MermaidRenderType, MermaidSemanticType, } from './Mermaid';
|
|
3
3
|
export default Mermaid;
|