1
0
mirror of synced 2026-03-25 04:28:34 +08:00

feat(data-source,utils,runtime): 数据源setData支持指定路径

This commit is contained in:
roymondchen
2024-01-02 20:57:37 +08:00
parent 6b4bfae30b
commit d3777b236d
18 changed files with 229 additions and 97 deletions

View File

@@ -21,7 +21,7 @@ import type { AppCore } from '@tmagic/schema';
import { getDepNodeIds, getNodes, replaceChildNode } from '@tmagic/utils';
import DataSourceManager from './DataSourceManager';
import { DataSourceManagerData } from './types';
import type { ChangeEvent, DataSourceManagerData } from './types';
/**
* 创建数据源管理器
@@ -52,7 +52,7 @@ export const createDataSourceManager = (app: AppCore, useMock?: boolean, initial
// ssr环境下数据应该是提前准备好的放到initialData中不应该发生变化无需监听
// 有initialData不一定是在ssr环境下
if (app.jsEngine !== 'nodejs') {
dataSourceManager.on('change', (sourceId: string) => {
dataSourceManager.on('change', (sourceId: string, changeEvent: ChangeEvent) => {
const dep = dsl.dataSourceDeps?.[sourceId] || {};
const condDep = dsl.dataSourceCondDeps?.[sourceId] || {};
@@ -66,6 +66,7 @@ export const createDataSourceManager = (app: AppCore, useMock?: boolean, initial
return dataSourceManager.compiledNode(newNode);
}),
sourceId,
changeEvent,
);
});
}