1
0
mirror of synced 2026-04-18 01:59:36 +08:00

fix(editor): 数据源方法选择器展示所有数据源并支持字段非叶子节点选择

移除 methodsOptions 中过滤无自定义方法数据源的逻辑,因为所有数据源都有内置"设置数据"方法;字段选择增加 checkStrictly 支持选择非叶子节点

Made-with: Cursor
This commit is contained in:
roymondchen
2026-04-09 15:32:35 +08:00
parent b2888962df
commit 31f4d2b4e2

View File

@@ -101,6 +101,7 @@ const getParamItemsConfig = ([dataSourceId, methodName]: [Id, string] = ['', '']
text: '字段',
type: 'data-source-field-select',
dataSourceId,
checkStrictly: true,
},
{
name: 'data',
@@ -146,23 +147,21 @@ const paramsConfig = ref<CodeParamStatement[]>(getParamItemsConfig(props.model[p
const methodsOptions = computed(
() =>
dataSources.value
?.filter((ds) => ds.methods?.length || dataSourceService.getFormMethod(ds.type).length)
?.map((ds) => ({
label: ds.title || ds.id,
value: ds.id,
children: [
{
label: '设置数据',
value: DATA_SOURCE_SET_DATA_METHOD_NAME,
},
...(dataSourceService?.getFormMethod(ds.type) || []),
...(ds.methods || []).map((method) => ({
label: method.name,
value: method.name,
})),
],
})) || [],
dataSources.value?.map((ds) => ({
label: ds.title || ds.id,
value: ds.id,
children: [
{
label: '设置数据',
value: DATA_SOURCE_SET_DATA_METHOD_NAME,
},
...(dataSourceService?.getFormMethod(ds.type) || []),
...(ds.methods || []).map((method) => ({
label: method.name,
value: method.name,
})),
],
})) || [],
);
const cascaderConfig = computed<CascaderConfig>(() => ({