mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
fix(data-source): 按需加载数据源时需要分享数据源方法依赖
This commit is contained in:
parent
5d6de7c405
commit
1e93e9bacc
@ -242,11 +242,14 @@ export const compliedIteratorItems = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按需加载数据源
|
||||||
|
*/
|
||||||
export const registerDataSourceOnDemand = async (
|
export const registerDataSourceOnDemand = async (
|
||||||
dsl: MApp,
|
dsl: MApp,
|
||||||
dataSourceModules: Record<string, () => Promise<AsyncDataSourceResolveResult>>,
|
dataSourceModules: Record<string, () => Promise<AsyncDataSourceResolveResult>>,
|
||||||
) => {
|
) => {
|
||||||
const { dataSourceCondDeps = {}, dataSourceDeps = {}, dataSources = [] } = dsl;
|
const { dataSourceMethodsDeps = {}, dataSourceCondDeps = {}, dataSourceDeps = {}, dataSources = [] } = dsl;
|
||||||
|
|
||||||
const dsModuleMap: Record<string, () => Promise<AsyncDataSourceResolveResult>> = {};
|
const dsModuleMap: Record<string, () => Promise<AsyncDataSourceResolveResult>> = {};
|
||||||
|
|
||||||
@ -257,6 +260,10 @@ export const registerDataSourceOnDemand = async (
|
|||||||
dep = dataSourceDeps[ds.id] || {};
|
dep = dataSourceDeps[ds.id] || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Object.keys(dep).length) {
|
||||||
|
dep = dataSourceMethodsDeps[ds.id] || {};
|
||||||
|
}
|
||||||
|
|
||||||
if (Object.keys(dep).length && dataSourceModules[ds.type]) {
|
if (Object.keys(dep).length && dataSourceModules[ds.type]) {
|
||||||
dsModuleMap[ds.type] = dataSourceModules[ds.type];
|
dsModuleMap[ds.type] = dataSourceModules[ds.type];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user