feat: 完善迭代器嵌套使用问题,重构事件配置处理代码
* feat(editor,core,data-source,dep,schema,ui,utils,vue-runtime-help): 完善迭代器 * test: 完善测试用例 * chore: 构建 * feat: 迭代器嵌套事件传递数据 --------- Co-authored-by: roymondchen <roymondchen@tencent.com>
This commit is contained in:
@@ -32,11 +32,11 @@
|
||||
"vue-demi": "^0.14.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tmagic/core": ">=1.4.16",
|
||||
"@tmagic/data-source": ">=1.4.16",
|
||||
"@tmagic/schema": ">=1.4.16",
|
||||
"@tmagic/stage": ">=1.4.16",
|
||||
"@tmagic/utils": ">=1.4.16",
|
||||
"@tmagic/core": "workspace:*",
|
||||
"@tmagic/data-source": "workspace:*",
|
||||
"@tmagic/schema": "workspace:*",
|
||||
"@tmagic/stage": "workspace:*",
|
||||
"@tmagic/utils": "workspace:*",
|
||||
"@vue/composition-api": ">=1.7.2",
|
||||
"typescript": "*",
|
||||
"vue": ">=2.0.0 || >=3.0.0"
|
||||
|
||||
@@ -82,7 +82,7 @@ export const useEditorDsl = (app: Core | undefined, win = window) => {
|
||||
const newNode = app.dataSourceManager?.compiledNode(config, undefined, true) || config;
|
||||
replaceChildNode(reactive(newNode), [root.value], parentId);
|
||||
|
||||
const nodeInstance = app.page?.getNode(config.id);
|
||||
const nodeInstance = app.getNode(config.id);
|
||||
if (nodeInstance) {
|
||||
nodeInstance.setData(newNode);
|
||||
}
|
||||
|
||||
@@ -18,12 +18,14 @@
|
||||
|
||||
import { inject, onBeforeUnmount, onMounted } from 'vue-demi';
|
||||
|
||||
import type Core from '@tmagic/core';
|
||||
import type { MNode } from '@tmagic/schema';
|
||||
import type TMagicApp from '@tmagic/core';
|
||||
import type { Id, MNode } from '@tmagic/schema';
|
||||
import { IS_DSL_NODE_KEY } from '@tmagic/utils';
|
||||
|
||||
interface UseAppOptions<T extends MNode = MNode> {
|
||||
config: T;
|
||||
iteratorContainerId?: Id[];
|
||||
iteratorIndex?: number[];
|
||||
methods?: {
|
||||
[key: string]: Function;
|
||||
};
|
||||
@@ -31,8 +33,8 @@ interface UseAppOptions<T extends MNode = MNode> {
|
||||
|
||||
const isDslNode = (config: MNode) => typeof config[IS_DSL_NODE_KEY] === 'undefined' || config[IS_DSL_NODE_KEY] === true;
|
||||
|
||||
export default ({ methods, config }: UseAppOptions) => {
|
||||
const app: Core | undefined = inject('app');
|
||||
export default ({ methods, config, iteratorContainerId, iteratorIndex }: UseAppOptions) => {
|
||||
const app: TMagicApp | undefined = inject('app');
|
||||
|
||||
const emitData = {
|
||||
config,
|
||||
@@ -52,7 +54,7 @@ export default ({ methods, config }: UseAppOptions) => {
|
||||
return displayCfg !== false;
|
||||
};
|
||||
|
||||
const node = isDslNode(config) ? app?.page?.getNode(config.id || '') : undefined;
|
||||
const node = isDslNode(config) ? app?.getNode(config.id || '', iteratorContainerId, iteratorIndex) : undefined;
|
||||
|
||||
if (node) {
|
||||
node.emit('created', emitData);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
import Core from '@tmagic/core';
|
||||
import { DataSourceManager, DeepObservedData, registerDataSourceOnDemand } from '@tmagic/data-source';
|
||||
import { DataSourceManager, DeepObservedData, registerDataSourceOnDemand } from '@tmagic/data-source';
|
||||
import { getUrlParam } from '@tmagic/utils';
|
||||
|
||||
import asyncDataSources from '../.tmagic/async-datasource-entry';
|
||||
|
||||
Reference in New Issue
Block a user