1
0
mirror of synced 2026-03-24 03:38:34 +08:00

fix(core,data-source): 事件参数中关联数据源字段无法自动更新

This commit is contained in:
roymondchen
2024-05-09 17:01:34 +08:00
parent 708d3db4bb
commit c665bf3ccc
5 changed files with 58 additions and 13 deletions

View File

@@ -18,7 +18,7 @@
import { union } from 'lodash-es';
import type { AppCore } from '@tmagic/schema';
import { getDepNodeIds, getNodes } from '@tmagic/utils';
import { getDepNodeIds, getNodes, isPage } from '@tmagic/utils';
import DataSourceManager from './DataSourceManager';
import type { ChangeEvent, DataSourceManagerData } from './types';
@@ -66,7 +66,18 @@ export const createDataSourceManager = (app: AppCore, useMock?: boolean, initial
node.condResult = dataSourceManager.compliedConds(node);
}
return dataSourceManager.compiledNode(node);
const newNode = dataSourceManager.compiledNode(node);
if (typeof app.page?.setData === 'function') {
if (isPage(newNode)) {
app.page.setData(newNode);
} else {
const n = app.page.getNode(node.id);
n?.setData(newNode);
}
}
return newNode;
}),
sourceId,
changeEvent,