mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-19 04:04:15 +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,
|
hasOwnProperty,
|
||||||
UtilsMetadata,
|
UtilsMetadata,
|
||||||
getClosestNode,
|
getClosestNode,
|
||||||
startTransaction,
|
transactionManage,
|
||||||
} from '@alilc/lowcode-utils';
|
} from '@alilc/lowcode-utils';
|
||||||
import {
|
import {
|
||||||
DragObjectType,
|
DragObjectType,
|
||||||
@ -202,8 +202,8 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
i18n: this.project.i18n,
|
i18n: this.project.i18n,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
startTransaction.onStartTransaction(this.stopAutoRepaintNode, TransitionType.repaint);
|
transactionManage.onStartTransaction(this.stopAutoRepaintNode, TransitionType.repaint);
|
||||||
startTransaction.onEndTransaction(() => {
|
transactionManage.onEndTransaction(() => {
|
||||||
this.rerender();
|
this.rerender();
|
||||||
this.enableAutoRepaintNode();
|
this.enableAutoRepaintNode();
|
||||||
}, TransitionType.repaint);
|
}, 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 { isNodeSchema } from '@alilc/lowcode-types';
|
||||||
import { getConvertedExtraKey, getOriginalExtraKey } from '@alilc/lowcode-designer';
|
import { getConvertedExtraKey, getOriginalExtraKey } from '@alilc/lowcode-designer';
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ const utils = {
|
|||||||
getNodeSchemaById,
|
getNodeSchemaById,
|
||||||
getConvertedExtraKey,
|
getConvertedExtraKey,
|
||||||
getOriginalExtraKey,
|
getOriginalExtraKey,
|
||||||
startTransaction: startTransaction.startTransaction,
|
startTransaction: transactionManage.startTransaction,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default utils;
|
export default utils;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
export enum TransitionType {
|
export enum TransitionType {
|
||||||
/** 节点更新后重绘处理 */
|
/** 节点更新后重绘处理 */
|
||||||
repaint = 'repaint'
|
repaint
|
||||||
}
|
}
|
||||||
@ -26,4 +26,4 @@ export * from './node-helper';
|
|||||||
export * from './clone-enumerable-property';
|
export * from './clone-enumerable-property';
|
||||||
export * from './logger';
|
export * from './logger';
|
||||||
export * as css from './css-helper';
|
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 { TransitionType } from '@alilc/lowcode-types';
|
||||||
import EventEmitter from 'events';
|
import EventEmitter from 'events';
|
||||||
|
|
||||||
class StartTransaction {
|
class TransactionManage {
|
||||||
emitter = new EventEmitter();
|
emitter = new EventEmitter();
|
||||||
|
|
||||||
startTransaction(fn: () => void, type: TransitionType = TransitionType.repaint): void {
|
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