Merge remote-tracking branch 'yudao/dev' into dev

This commit is contained in:
jason
2025-06-27 23:20:20 +08:00
185 changed files with 6101 additions and 1366 deletions

View File

@@ -121,7 +121,7 @@ const apiSelectRule = [
field: 'data',
title: '请求参数 JSON 格式',
props: {
autosize: true,
autoSize: true,
type: 'textarea',
placeholder: '{"type": 1}',
},
@@ -155,7 +155,7 @@ const apiSelectRule = [
info: `data 为接口返回值,需要写一个匿名函数解析返回值为选择器 options 列表
(data: any)=>{ label: string; value: any }[]`,
props: {
autosize: true,
autoSize: true,
rows: { minRows: 2, maxRows: 6 },
type: 'textarea',
placeholder: `

View File

@@ -63,6 +63,7 @@ const [Modal, modalApi] = useVbenModal({
});
// TODO xingyu 暴露 modalApi 给父组件是否合适? trigger-node-config.vue 会有多个 conditionDialog 实例
// 不用暴露啊,用 useVbenModal 就可以了
defineExpose({ modalApi });
</script>
<template>

View File

@@ -41,13 +41,13 @@ const props = defineProps({
const { hasAccessByCodes } = useAccess();
/** 缓存处理后的actions */
/** 缓存处理后的 actions */
const processedActions = ref<any[]>([]);
const processedDropdownActions = ref<any[]>([]);
/** 用于比较的字符串化版本 */
const actionsStringified = ref('');
const dropdownActionsStringified = ref('');
const actionsStringField = ref('');
const dropdownActionsStringField = ref('');
function isIfShow(action: ActionItem): boolean {
const ifShow = action.ifShow;
@@ -65,7 +65,7 @@ function isIfShow(action: ActionItem): boolean {
return isIfShow;
}
/** 处理actions的纯函数 */
/** 处理 actions 的纯函数 */
function processActions(actions: ActionItem[]): any[] {
return actions
.filter((action: ActionItem) => {
@@ -84,7 +84,7 @@ function processActions(actions: ActionItem[]): any[] {
});
}
/** 处理下拉菜单actions的纯函数 */
/** 处理下拉菜单 actions 的纯函数 */
function processDropdownActions(
dropDownActions: ActionItem[],
divider: boolean,
@@ -108,10 +108,10 @@ function processDropdownActions(
});
}
/** 监听actions变化并更新缓存 */
/** 监听 actions 变化并更新缓存 */
watchEffect(() => {
const rawActions = toRaw(props.actions) || [];
const currentStringified = JSON.stringify(
const currentStringField = JSON.stringify(
rawActions.map((a) => ({
...a,
onClick: undefined, // 排除函数以便比较
@@ -121,16 +121,16 @@ watchEffect(() => {
})),
);
if (currentStringified !== actionsStringified.value) {
actionsStringified.value = currentStringified;
if (currentStringField !== actionsStringField.value) {
actionsStringField.value = currentStringField;
processedActions.value = processActions(rawActions);
}
});
/** 监听dropDownActions变化并更新缓存 */
/** 监听 dropDownActions 变化并更新缓存 */
watchEffect(() => {
const rawDropDownActions = toRaw(props.dropDownActions) || [];
const currentStringified = JSON.stringify({
const currentStringField = JSON.stringify({
actions: rawDropDownActions.map((a) => ({
...a,
onClick: undefined, // 排除函数以便比较
@@ -141,8 +141,8 @@ watchEffect(() => {
divider: props.divider,
});
if (currentStringified !== dropdownActionsStringified.value) {
dropdownActionsStringified.value = currentStringified;
if (currentStringField !== dropdownActionsStringField.value) {
dropdownActionsStringField.value = currentStringField;
processedDropdownActions.value = processDropdownActions(
rawDropDownActions,
props.divider,
@@ -154,14 +154,14 @@ const getActions = computed(() => processedActions.value);
const getDropdownList = computed(() => processedDropdownActions.value);
/** 缓存Space组件的size计算结果 */
/** 缓存 Space 组件的 size 计算结果 */
const spaceSize = computed(() => {
return unref(getActions)?.some((item: ActionItem) => item.type === 'link')
? 0
: 8;
});
/** 缓存PopConfirm属性 */
/** 缓存 PopConfirm 属性 */
const popConfirmPropsMap = new Map<string, any>();
function getPopConfirmProps(attrs: PopConfirm) {
@@ -191,12 +191,13 @@ function getPopConfirmProps(attrs: PopConfirm) {
return originAttrs;
}
/** 缓存Button属性 */
/** 缓存 Button 属性 */
const buttonPropsMap = new Map<string, any>();
function getButtonProps(action: ActionItem) {
const key = JSON.stringify({
type: action.type,
danger: action.danger || false,
disabled: action.disabled,
loading: action.loading,
size: action.size,
@@ -207,7 +208,8 @@ function getButtonProps(action: ActionItem) {
}
const res = {
type: action.type || 'primary',
type: action.type || 'link',
danger: action.danger || false,
disabled: action.disabled,
loading: action.loading,
size: action.size,
@@ -217,7 +219,7 @@ function getButtonProps(action: ActionItem) {
return res;
}
/** 缓存Tooltip属性 */
/** 缓存 Tooltip 属性 */
const tooltipPropsMap = new Map<string, any>();
function getTooltipProps(tooltip: any | string) {
@@ -243,7 +245,7 @@ function handleMenuClick(e: any) {
}
}
/** 生成稳定的key */
/** 生成稳定的 key */
function getActionKey(action: ActionItem, index: number) {
return `${action.label || ''}-${action.type || ''}-${index}`;
}