mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-05 09:47:20 +00:00
feat: add common.utils.startTransaction API to change multi nodes
This commit is contained in:
parent
2d40d0bd07
commit
3653f6a970
@ -36,7 +36,7 @@ import {
|
||||
hasOwnProperty,
|
||||
UtilsMetadata,
|
||||
getClosestNode,
|
||||
startTransaction,
|
||||
transactionManage,
|
||||
} from '@alilc/lowcode-utils';
|
||||
import {
|
||||
DragObjectType,
|
||||
@ -202,8 +202,8 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
i18n: this.project.i18n,
|
||||
};
|
||||
});
|
||||
startTransaction.onStartTransaction(this.stopAutoRepaintNode, TransitionType.repaint);
|
||||
startTransaction.onEndTransaction(() => {
|
||||
transactionManage.onStartTransaction(this.stopAutoRepaintNode, TransitionType.repaint);
|
||||
transactionManage.onEndTransaction(() => {
|
||||
this.rerender();
|
||||
this.enableAutoRepaintNode();
|
||||
}, TransitionType.repaint);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { isFormEvent, compatibleLegaoSchema, getNodeSchemaById, startTransaction } from '@alilc/lowcode-utils';
|
||||
import { isFormEvent, compatibleLegaoSchema, getNodeSchemaById, transactionManage } from '@alilc/lowcode-utils';
|
||||
import { isNodeSchema } from '@alilc/lowcode-types';
|
||||
import { getConvertedExtraKey, getOriginalExtraKey } from '@alilc/lowcode-designer';
|
||||
|
||||
@ -9,7 +9,7 @@ const utils = {
|
||||
getNodeSchemaById,
|
||||
getConvertedExtraKey,
|
||||
getOriginalExtraKey,
|
||||
startTransaction: startTransaction.startTransaction,
|
||||
startTransaction: transactionManage.startTransaction,
|
||||
};
|
||||
|
||||
export default utils;
|
||||
@ -1,4 +1,4 @@
|
||||
export enum TransitionType {
|
||||
/** 节点更新后重绘处理 */
|
||||
repaint = 'repaint'
|
||||
repaint
|
||||
}
|
||||
@ -26,4 +26,4 @@ export * from './node-helper';
|
||||
export * from './clone-enumerable-property';
|
||||
export * from './logger';
|
||||
export * as css from './css-helper';
|
||||
export { startTransaction } from './start-transaction';
|
||||
export { transactionManage } from './start-transaction';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { TransitionType } from '@alilc/lowcode-types';
|
||||
import EventEmitter from 'events';
|
||||
|
||||
class StartTransaction {
|
||||
class TransactionManage {
|
||||
emitter = new EventEmitter();
|
||||
|
||||
startTransaction(fn: () => void, type: TransitionType = TransitionType.repaint): void {
|
||||
@ -25,6 +25,6 @@ class StartTransaction {
|
||||
}
|
||||
}
|
||||
|
||||
export const startTransaction = new StartTransaction();
|
||||
export const transactionManage = new TransactionManage();
|
||||
|
||||
export default startTransaction;
|
||||
export default transactionManage;
|
||||
Loading…
x
Reference in New Issue
Block a user