mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-05-08 19:49:24 +08:00
fix(editor): 修改未包含数据源的配置,画布中没有实时更新
This commit is contained in:
parent
945aaaddcb
commit
0d6420215c
@ -21,10 +21,10 @@ import {
|
|||||||
Target,
|
Target,
|
||||||
} from '@tmagic/core';
|
} from '@tmagic/core';
|
||||||
import { ChangeRecord } from '@tmagic/form';
|
import { ChangeRecord } from '@tmagic/form';
|
||||||
import { getNodes, isPage, traverseNode } from '@tmagic/utils';
|
import { getNodes, isPage, isValueIncludeDataSource, traverseNode } from '@tmagic/utils';
|
||||||
|
|
||||||
import PropsPanel from './layouts/PropsPanel.vue';
|
import PropsPanel from './layouts/PropsPanel.vue';
|
||||||
import { isIncludeDataSource, isValueIncludeDataSource } from './utils/editor';
|
import { isIncludeDataSource } from './utils/editor';
|
||||||
import { EditorProps } from './editorProps';
|
import { EditorProps } from './editorProps';
|
||||||
import { Services } from './type';
|
import { Services } from './type';
|
||||||
|
|
||||||
@ -418,7 +418,8 @@ export const initServiceEvents = (
|
|||||||
isValueIncludeDataSource(record.value)
|
isValueIncludeDataSource(record.value)
|
||||||
) {
|
) {
|
||||||
needRecollectNodes.push(newNode);
|
needRecollectNodes.push(newNode);
|
||||||
break;
|
} else {
|
||||||
|
normalNodes.push(newNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (isIncludeDataSource(newNode, oldNode)) {
|
} else if (isIncludeDataSource(newNode, oldNode)) {
|
||||||
|
@ -25,13 +25,13 @@ import { NODE_CONDS_KEY, NodeType } from '@tmagic/core';
|
|||||||
import type StageCore from '@tmagic/stage';
|
import type StageCore from '@tmagic/stage';
|
||||||
import {
|
import {
|
||||||
calcValueByFontsize,
|
calcValueByFontsize,
|
||||||
DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX,
|
|
||||||
getElById,
|
getElById,
|
||||||
getNodePath,
|
getNodePath,
|
||||||
isNumber,
|
isNumber,
|
||||||
isPage,
|
isPage,
|
||||||
isPageFragment,
|
isPageFragment,
|
||||||
isPop,
|
isPop,
|
||||||
|
isValueIncludeDataSource,
|
||||||
} from '@tmagic/utils';
|
} from '@tmagic/utils';
|
||||||
|
|
||||||
import { Layout } from '@editor/type';
|
import { Layout } from '@editor/type';
|
||||||
@ -302,22 +302,6 @@ export const moveItemsInContainer = (sourceIndices: number[], parent: MContainer
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const isValueIncludeDataSource = (value: any) => {
|
|
||||||
if (typeof value === 'string' && /\$\{([\s\S]+?)\}/.test(value)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (Array.isArray(value) && `${value[0]}`.startsWith(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (value?.isBindDataSource && value.dataSourceId) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (value?.isBindDataSourceField && value.dataSourceId) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const isIncludeDataSourceByDiffAddResult = (diffResult: any) => {
|
const isIncludeDataSourceByDiffAddResult = (diffResult: any) => {
|
||||||
for (const value of Object.values(diffResult)) {
|
for (const value of Object.values(diffResult)) {
|
||||||
const result = isValueIncludeDataSource(value);
|
const result = isValueIncludeDataSource(value);
|
||||||
|
@ -509,3 +509,19 @@ export const traverseNode = <T extends NodeItem = NodeItem>(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const isValueIncludeDataSource = (value: any) => {
|
||||||
|
if (typeof value === 'string' && /\$\{([\s\S]+?)\}/.test(value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (Array.isArray(value) && `${value[0]}`.startsWith(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (value?.isBindDataSource && value.dataSourceId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (value?.isBindDataSourceField && value.dataSourceId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user