mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
fix(dep): 数据源方法收集判断
This commit is contained in:
parent
0c207c7b83
commit
72108e0019
@ -263,20 +263,20 @@ export const createDataSourceCondTarget = (ds: Pick<DataSourceSchema, 'id' | 'fi
|
|||||||
isTarget: (key: string | number, value: any) => isDataSourceCondTarget(ds, key, value),
|
isTarget: (key: string | number, value: any) => isDataSourceCondTarget(ds, key, value),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const createDataSourceMethodTarget = (ds: Pick<DataSourceSchema, 'id' | 'fields'>, initialDeps: DepData = {}) =>
|
export const createDataSourceMethodTarget = (ds: Pick<DataSourceSchema, 'id' | 'methods'>, initialDeps: DepData = {}) =>
|
||||||
new Target({
|
new Target({
|
||||||
type: DepTargetType.DATA_SOURCE_METHOD,
|
type: DepTargetType.DATA_SOURCE_METHOD,
|
||||||
id: ds.id,
|
id: ds.id,
|
||||||
initialDeps,
|
initialDeps,
|
||||||
isTarget: (_key: string | number, value: any) => {
|
isTarget: (_key: string | number, value: any) => {
|
||||||
// 使用data-source-method-select 可以配置出来
|
// 使用data-source-method-select 可以配置出来
|
||||||
if (!Array.isArray(value) || !ds) {
|
if (!Array.isArray(value) || !ds?.methods) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const [dsId, ...keys] = value;
|
const [dsId, methodName] = value;
|
||||||
|
|
||||||
if (dsId !== ds.id || ds.fields?.find((field) => field.name === keys[0])) {
|
if (!methodName || dsId !== ds.id || !ds.methods.find((field) => field.name === methodName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user