feat(dep,schema): 添加组件没用数据源或者代码块的配置key

This commit is contained in:
roymondchen 2025-07-02 16:42:55 +08:00
parent ee06c26ca5
commit 3f7d03959c
2 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import { NODE_NO_CODE_BLOCK_KEY, NODE_NO_DATA_SOURCE_KEY } from '@tmagic/schema';
import { isObject } from '@tmagic/utils';
import type Target from './Target';
@ -189,6 +190,19 @@ export default class Watcher {
}
public collectItem(node: TargetNode, target: Target, depExtendedData: DepExtendedData = {}, deep = false) {
const dataSourceTargetTypes: string[] = [
DepTargetType.DATA_SOURCE,
DepTargetType.DATA_SOURCE_COND,
DepTargetType.DATA_SOURCE_METHOD,
];
if (node[NODE_NO_DATA_SOURCE_KEY] && dataSourceTargetTypes.includes(target.type)) {
return;
}
if (node[NODE_NO_CODE_BLOCK_KEY] && target.type === DepTargetType.CODE_BLOCK) {
return;
}
const collectTarget = (config: Record<string | number, any>, prop = '') => {
const doCollect = (key: string, value: any) => {
const keyIsItems = key === this.childrenProp;

View File

@ -47,6 +47,8 @@ export enum NodeType {
}
export const NODE_CONDS_KEY = 'displayConds';
export const NODE_NO_DATA_SOURCE_KEY = '__tmagic_node_no_data_source';
export const NODE_NO_CODE_BLOCK_KEY = '__tmagic_node_no_code_block';
export type Id = string | number;