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