mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-06-12 02:12:28 +00:00
Compare commits
15 Commits
main
...
v1.0.16-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74ac483d42 | ||
|
|
fe5b848044 | ||
|
|
3653f6a970 | ||
|
|
2d40d0bd07 | ||
|
|
e1af5a2644 | ||
|
|
d98b90e365 | ||
|
|
1833160038 | ||
|
|
b537b92f44 | ||
|
|
64d3de701b | ||
|
|
42b40d244a | ||
|
|
f9b33adc8b | ||
|
|
b0014ecdb9 | ||
|
|
49194b41f2 | ||
|
|
298cef6f96 | ||
|
|
67ec788f03 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"lerna": "4.0.0",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"packages": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-designer",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "Designer for Ali LowCode Engine",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -15,10 +15,10 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-editor-core": "1.0.15",
|
||||
"@alilc/lowcode-shell": "1.0.15",
|
||||
"@alilc/lowcode-types": "1.0.15",
|
||||
"@alilc/lowcode-utils": "1.0.15",
|
||||
"@alilc/lowcode-editor-core": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-shell": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-types": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-utils": "1.0.16-beta.5",
|
||||
"classnames": "^2.2.6",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.5",
|
||||
|
||||
@ -36,6 +36,7 @@ import {
|
||||
hasOwnProperty,
|
||||
UtilsMetadata,
|
||||
getClosestNode,
|
||||
transactionManage,
|
||||
} from '@alilc/lowcode-utils';
|
||||
import {
|
||||
DragObjectType,
|
||||
@ -59,9 +60,8 @@ import { getClosestClickableNode } from './utils/clickable';
|
||||
import {
|
||||
ComponentMetadata,
|
||||
ComponentSchema,
|
||||
TransformStage,
|
||||
ActivityData,
|
||||
Package,
|
||||
TransitionType,
|
||||
} from '@alilc/lowcode-types';
|
||||
import { BuiltinSimulatorRenderer } from './renderer';
|
||||
import clipboard from '../designer/clipboard';
|
||||
@ -181,6 +181,14 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
*/
|
||||
autoRender = true;
|
||||
|
||||
stopAutoRepaintNode() {
|
||||
this.renderer?.stopAutoRepaintNode();
|
||||
}
|
||||
|
||||
enableAutoRepaintNode() {
|
||||
this.renderer?.enableAutoRepaintNode();
|
||||
}
|
||||
|
||||
constructor(project: Project) {
|
||||
makeObservable(this);
|
||||
this.project = project;
|
||||
@ -194,6 +202,11 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
i18n: this.project.i18n,
|
||||
};
|
||||
});
|
||||
transactionManage.onStartTransaction(this.stopAutoRepaintNode, TransitionType.repaint);
|
||||
transactionManage.onEndTransaction(() => {
|
||||
this.rerender();
|
||||
this.enableAutoRepaintNode();
|
||||
}, TransitionType.repaint);
|
||||
}
|
||||
|
||||
get currentDocument() {
|
||||
|
||||
@ -13,6 +13,8 @@ export interface BuiltinSimulatorRenderer {
|
||||
setCopyState(state: boolean): void;
|
||||
loadAsyncLibrary(asyncMap: { [index: string]: any }): void;
|
||||
clearState(): void;
|
||||
stopAutoRepaintNode(): void;
|
||||
enableAutoRepaintNode(): void;
|
||||
run(): void;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-editor-core",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "Core Api for Ali lowCode engine",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
@ -14,8 +14,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@alifd/next": "^1.19.16",
|
||||
"@alilc/lowcode-types": "1.0.15",
|
||||
"@alilc/lowcode-utils": "1.0.15",
|
||||
"@alilc/lowcode-types": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-utils": "1.0.16-beta.5",
|
||||
"classnames": "^2.2.6",
|
||||
"debug": "^4.1.1",
|
||||
"intl-messageformat": "^9.3.1",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-editor-skeleton",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "alibaba lowcode editor skeleton",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -18,10 +18,10 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@alifd/next": "^1.20.12",
|
||||
"@alilc/lowcode-designer": "1.0.15",
|
||||
"@alilc/lowcode-editor-core": "1.0.15",
|
||||
"@alilc/lowcode-types": "1.0.15",
|
||||
"@alilc/lowcode-utils": "1.0.15",
|
||||
"@alilc/lowcode-designer": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-editor-core": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-types": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-utils": "1.0.16-beta.5",
|
||||
"classnames": "^2.2.6",
|
||||
"react": "^16.8.1",
|
||||
"react-dom": "^16.8.1"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-engine",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
|
||||
"main": "lib/engine-core.js",
|
||||
"module": "es/engine-core.js",
|
||||
@ -19,14 +19,14 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@alifd/next": "^1.19.12",
|
||||
"@alilc/lowcode-designer": "1.0.15",
|
||||
"@alilc/lowcode-editor-core": "1.0.15",
|
||||
"@alilc/lowcode-editor-skeleton": "1.0.15",
|
||||
"@alilc/lowcode-designer": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-editor-core": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-editor-skeleton": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-engine-ext": "^1.0.0",
|
||||
"@alilc/lowcode-plugin-designer": "1.0.15",
|
||||
"@alilc/lowcode-plugin-outline-pane": "1.0.15",
|
||||
"@alilc/lowcode-shell": "1.0.15",
|
||||
"@alilc/lowcode-utils": "1.0.15",
|
||||
"@alilc/lowcode-plugin-designer": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-plugin-outline-pane": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-shell": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-utils": "1.0.16-beta.5",
|
||||
"react": "^16.8.1",
|
||||
"react-dom": "^16.8.1"
|
||||
},
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { isFormEvent, compatibleLegaoSchema, getNodeSchemaById } from '@alilc/lowcode-utils';
|
||||
import { isFormEvent, compatibleLegaoSchema, getNodeSchemaById, transactionManage } from '@alilc/lowcode-utils';
|
||||
import { isNodeSchema } from '@alilc/lowcode-types';
|
||||
import { getConvertedExtraKey, getOriginalExtraKey, isNode, isSettingField } from '@alilc/lowcode-designer';
|
||||
import { getConvertedExtraKey, getOriginalExtraKey } from '@alilc/lowcode-designer';
|
||||
|
||||
const utils = {
|
||||
isNodeSchema,
|
||||
@ -9,6 +9,7 @@ const utils = {
|
||||
getNodeSchemaById,
|
||||
getConvertedExtraKey,
|
||||
getOriginalExtraKey,
|
||||
startTransaction: transactionManage.startTransaction,
|
||||
};
|
||||
|
||||
export default utils;
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-ignitor",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "点火器,bootstrap lce project",
|
||||
"main": "lib/index.js",
|
||||
"private": true,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-plugin-designer",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "alibaba lowcode editor designer plugin",
|
||||
"files": [
|
||||
"es",
|
||||
@ -18,9 +18,9 @@
|
||||
],
|
||||
"author": "xiayang.xy",
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-designer": "1.0.15",
|
||||
"@alilc/lowcode-editor-core": "1.0.15",
|
||||
"@alilc/lowcode-utils": "1.0.15",
|
||||
"@alilc/lowcode-designer": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-editor-core": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-utils": "1.0.16-beta.5",
|
||||
"react": "^16.8.1",
|
||||
"react-dom": "^16.8.1"
|
||||
},
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-plugin-outline-pane",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "Outline pane for Ali lowCode engine",
|
||||
"files": [
|
||||
"es",
|
||||
@ -13,10 +13,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@alifd/next": "^1.19.16",
|
||||
"@alilc/lowcode-designer": "1.0.15",
|
||||
"@alilc/lowcode-editor-core": "1.0.15",
|
||||
"@alilc/lowcode-types": "1.0.15",
|
||||
"@alilc/lowcode-utils": "1.0.15",
|
||||
"@alilc/lowcode-designer": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-editor-core": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-types": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-utils": "1.0.16-beta.5",
|
||||
"classnames": "^2.2.6",
|
||||
"react": "^16",
|
||||
"react-dom": "^16.7.0"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-rax-renderer",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "Rax renderer for Ali lowCode engine",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -30,8 +30,8 @@
|
||||
"build": "build-scripts build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-renderer-core": "1.0.15",
|
||||
"@alilc/lowcode-utils": "1.0.15",
|
||||
"@alilc/lowcode-renderer-core": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-utils": "1.0.16-beta.5",
|
||||
"rax-find-dom-node": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-rax-simulator-renderer",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "rax simulator renderer for alibaba lowcode designer",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -13,10 +13,10 @@
|
||||
"build:umd": "build-scripts build --config build.umd.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-designer": "1.0.15",
|
||||
"@alilc/lowcode-rax-renderer": "1.0.15",
|
||||
"@alilc/lowcode-types": "1.0.15",
|
||||
"@alilc/lowcode-utils": "1.0.15",
|
||||
"@alilc/lowcode-designer": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-rax-renderer": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-types": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-utils": "1.0.16-beta.5",
|
||||
"classnames": "^2.2.6",
|
||||
"driver-universal": "^3.1.3",
|
||||
"history": "^5.0.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-react-renderer",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "react renderer for ali lowcode engine",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -22,7 +22,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@alifd/next": "^1.21.16",
|
||||
"@alilc/lowcode-renderer-core": "1.0.15"
|
||||
"@alilc/lowcode-renderer-core": "1.0.16-beta.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@alib/build-scripts": "^0.1.18",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-react-simulator-renderer",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "react simulator renderer for alibaba lowcode designer",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -17,10 +17,10 @@
|
||||
"test:cov": "build-scripts test --config build.test.json --jest-coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-designer": "1.0.15",
|
||||
"@alilc/lowcode-react-renderer": "1.0.15",
|
||||
"@alilc/lowcode-types": "1.0.15",
|
||||
"@alilc/lowcode-utils": "1.0.15",
|
||||
"@alilc/lowcode-designer": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-react-renderer": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-types": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-utils": "1.0.16-beta.5",
|
||||
"classnames": "^2.2.6",
|
||||
"mobx": "^6.3.0",
|
||||
"mobx-react": "^7.2.0",
|
||||
|
||||
@ -349,6 +349,11 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
||||
* 是否为画布自动渲染
|
||||
*/
|
||||
autoRender = true;
|
||||
|
||||
/**
|
||||
* 画布是否自动监听事件来重绘节点
|
||||
*/
|
||||
autoRepaintNode = true;
|
||||
/**
|
||||
* 加载资源
|
||||
*/
|
||||
@ -491,6 +496,14 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
||||
this._appContext = { ...this._appContext };
|
||||
}
|
||||
|
||||
stopAutoRepaintNode() {
|
||||
this.autoRepaintNode = false;
|
||||
}
|
||||
|
||||
enableAutoRepaintNode() {
|
||||
this.autoRepaintNode = true;
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this.disposeFunctions.forEach(fn => fn());
|
||||
this.documentInstances.forEach(docInst => docInst.dispose());
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-renderer-core",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "renderer core",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
@ -16,8 +16,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-datasource-engine": "^1.0.0",
|
||||
"@alilc/lowcode-types": "1.0.15",
|
||||
"@alilc/lowcode-utils": "1.0.15",
|
||||
"@alilc/lowcode-types": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-utils": "1.0.16-beta.5",
|
||||
"classnames": "^2.2.6",
|
||||
"debug": "^4.1.1",
|
||||
"fetch-jsonp": "^1.1.3",
|
||||
@ -33,7 +33,7 @@
|
||||
"devDependencies": {
|
||||
"@alib/build-scripts": "^0.1.18",
|
||||
"@alifd/next": "^1.26.0",
|
||||
"@alilc/lowcode-designer": "1.0.15",
|
||||
"@alilc/lowcode-designer": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-test-mate": "^1.0.1",
|
||||
"@babel/plugin-transform-typescript": "^7.16.8",
|
||||
"@testing-library/react": "^11.2.2",
|
||||
|
||||
@ -102,14 +102,23 @@ function initRerenderEvent({
|
||||
leaf,
|
||||
dispose: [
|
||||
leaf?.onPropChange?.(() => {
|
||||
if (!container.autoRepaintNode) {
|
||||
return;
|
||||
}
|
||||
__debug(`${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onPropsChange make rerender`);
|
||||
container.rerender();
|
||||
}),
|
||||
leaf?.onChildrenChange?.(() => {
|
||||
if (!container.autoRepaintNode) {
|
||||
return;
|
||||
}
|
||||
__debug(`${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onChildrenChange make rerender`);
|
||||
container.rerender();
|
||||
}) as Function,
|
||||
leaf?.onVisibleChange?.(() => {
|
||||
if (!container.autoRepaintNode) {
|
||||
return;
|
||||
}
|
||||
__debug(`${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onVisibleChange make rerender`);
|
||||
container.rerender();
|
||||
}),
|
||||
@ -279,6 +288,10 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
|
||||
singleRender?: boolean;
|
||||
};
|
||||
|
||||
get autoRepaintNode() {
|
||||
return container.autoRepaintNode;
|
||||
}
|
||||
|
||||
judgeMiniUnitRender() {
|
||||
if (!this.renderUnitInfo) {
|
||||
this.getRenderUnitInfo();
|
||||
@ -387,6 +400,9 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
|
||||
/** 监听参数变化 */
|
||||
initOnPropsChangeEvent(leaf = this.leaf): void {
|
||||
const dispose = leaf?.onPropChange?.(debounce((propChangeInfo: PropChangeOptions) => {
|
||||
if (!this.autoRepaintNode) {
|
||||
return;
|
||||
}
|
||||
const {
|
||||
key,
|
||||
newValue = null,
|
||||
@ -443,6 +459,9 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
|
||||
*/
|
||||
initOnVisibleChangeEvent(leaf = this.leaf) {
|
||||
const dispose = leaf?.onVisibleChange?.((flag: boolean) => {
|
||||
if (!this.autoRepaintNode) {
|
||||
return;
|
||||
}
|
||||
if (this.state.visible === flag) {
|
||||
return;
|
||||
}
|
||||
@ -463,6 +482,9 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
|
||||
*/
|
||||
initOnChildrenChangeEvent(leaf = this.leaf) {
|
||||
const dispose = leaf?.onChildrenChange?.((param): void => {
|
||||
if (!this.autoRepaintNode) {
|
||||
return;
|
||||
}
|
||||
const {
|
||||
type,
|
||||
node,
|
||||
|
||||
@ -35,7 +35,8 @@ const baseRenderer: any = {
|
||||
__container: {
|
||||
rerender: () => {
|
||||
rerenderCount = 1 + rerenderCount;
|
||||
}
|
||||
},
|
||||
autoRepaintNode: true,
|
||||
},
|
||||
documentId: '01'
|
||||
},
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-shell",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "Shell Layer for AliLowCodeEngine",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -15,11 +15,11 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-designer": "1.0.15",
|
||||
"@alilc/lowcode-editor-core": "1.0.15",
|
||||
"@alilc/lowcode-editor-skeleton": "1.0.15",
|
||||
"@alilc/lowcode-types": "1.0.15",
|
||||
"@alilc/lowcode-utils": "1.0.15",
|
||||
"@alilc/lowcode-designer": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-editor-core": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-editor-skeleton": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-types": "1.0.16-beta.5",
|
||||
"@alilc/lowcode-utils": "1.0.16-beta.5",
|
||||
"classnames": "^2.2.6",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.5",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-types",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "Types for Ali lowCode engine",
|
||||
"files": [
|
||||
"es",
|
||||
|
||||
@ -21,3 +21,4 @@ export * from './code-result';
|
||||
export * from './assets';
|
||||
export * as GlobalEvent from './event';
|
||||
export * from './disposable';
|
||||
export * from './start-transaction';
|
||||
|
||||
4
packages/types/src/start-transaction.ts
Normal file
4
packages/types/src/start-transaction.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export enum TransitionType {
|
||||
/** 节点更新后重绘处理 */
|
||||
repaint
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-utils",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16-beta.5",
|
||||
"description": "Utils for Ali lowCode engine",
|
||||
"files": [
|
||||
"lib",
|
||||
@ -14,7 +14,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@alifd/next": "^1.19.16",
|
||||
"@alilc/lowcode-types": "1.0.15",
|
||||
"@alilc/lowcode-types": "1.0.16-beta.5",
|
||||
"lodash": "^4.17.21",
|
||||
"react": "^16",
|
||||
"zen-logger": "^1.1.0"
|
||||
|
||||
@ -26,3 +26,4 @@ export * from './node-helper';
|
||||
export * from './clone-enumerable-property';
|
||||
export * from './logger';
|
||||
export * as css from './css-helper';
|
||||
export { transactionManage } from './start-transaction';
|
||||
|
||||
30
packages/utils/src/start-transaction.ts
Normal file
30
packages/utils/src/start-transaction.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { TransitionType } from '@alilc/lowcode-types';
|
||||
import EventEmitter from 'events';
|
||||
|
||||
class TransactionManage {
|
||||
emitter = new EventEmitter();
|
||||
|
||||
startTransaction(fn: () => void, type: TransitionType = TransitionType.repaint): void {
|
||||
this.emitter.emit(`[${type}]startTransaction`);
|
||||
fn();
|
||||
this.emitter.emit(`[${type}]endTransaction`);
|
||||
}
|
||||
|
||||
onStartTransaction(fn: () => void, type: TransitionType = TransitionType.repaint): () => void {
|
||||
this.emitter.on(`[${type}]startTransaction`, fn);
|
||||
return () => {
|
||||
this.emitter.off(`[${type}]startTransaction`, fn);
|
||||
};
|
||||
}
|
||||
|
||||
onEndTransaction(fn: () => void, type: TransitionType = TransitionType.repaint): () => void {
|
||||
this.emitter.on(`[${type}]endTransaction`, fn);
|
||||
return () => {
|
||||
this.emitter.off(`[${type}]endTransaction`, fn);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export const transactionManage = new TransactionManage();
|
||||
|
||||
export default transactionManage;
|
||||
Loading…
x
Reference in New Issue
Block a user