mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
chore: 保存成功弹框位置适配新引擎
feat: 支持属性变更事件
This commit is contained in:
parent
e07fd69141
commit
447ed9b8f9
@ -6,7 +6,8 @@ module.exports = {
|
||||
// // '^.+\\.(ts|tsx)$': 'ts-jest',
|
||||
// // '^.+\\.(js|jsx)$': 'babel-jest',
|
||||
// },
|
||||
// testMatch: ['(/tests?/.*(test))\\.[jt]s$'],
|
||||
// testMatch: ['**/project.test.ts'],
|
||||
testMatch: ['(/tests?/.*(test))\\.[jt]s$'],
|
||||
transformIgnorePatterns: [
|
||||
`/node_modules/(?!${esModules})/`,
|
||||
],
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
"react-dom": "^16.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ali/lowcode-test-mate": "^1.0.1",
|
||||
"@alib/build-scripts": "^0.1.18",
|
||||
"@types/classnames": "^2.2.7",
|
||||
"@types/medium-editor": "^5.0.3",
|
||||
@ -34,7 +35,6 @@
|
||||
"build-scripts-config": "^0.1.8",
|
||||
"jest": "^26.5.2",
|
||||
"lodash": "^4.17.20",
|
||||
"ts-jest": "^26.4.1",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Fragment } from 'react';
|
||||
import React, { Component, Fragment } from 'react';
|
||||
import DragResizeEngine from './drag-resize-engine';
|
||||
import { observer, computed, globalContext, Editor } from '@ali/lowcode-editor-core';
|
||||
import classNames from 'classnames';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component } from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import { observer } from '@ali/lowcode-editor-core';
|
||||
import { BorderDetecting } from './border-detecting';
|
||||
import { BuiltinSimulatorHost } from '../host';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component } from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import { observer } from '@ali/lowcode-editor-core';
|
||||
import { BuiltinSimulatorHost, BuiltinSimulatorProps } from './host';
|
||||
import { BemTools } from './bem-tools';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { untracked, computed, obx } from '@ali/lowcode-editor-core';
|
||||
import { untracked, computed, obx, globalContext, Editor } from '@ali/lowcode-editor-core';
|
||||
import { CompositeValue, isJSExpression, isJSSlot, JSSlot, SlotSchema } from '@ali/lowcode-types';
|
||||
import { uniqueId, isPlainObject, hasOwnProperty } from '@ali/lowcode-utils';
|
||||
import { PropStash } from './prop-stash';
|
||||
@ -247,6 +247,8 @@ export class Prop implements IPropParent {
|
||||
value: valueToSource(val),
|
||||
};
|
||||
}
|
||||
const editor = globalContext.get(Editor);
|
||||
editor.emit('node.prop.change', { prop: this, node: this.owner });
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
|
||||
34
packages/designer/tests/builtin-simulator/host-view.test.tsx
Normal file
34
packages/designer/tests/builtin-simulator/host-view.test.tsx
Normal file
@ -0,0 +1,34 @@
|
||||
import React from 'react';
|
||||
import set from 'lodash/set';
|
||||
import cloneDeep from 'lodash/clonedeep';
|
||||
import '../fixtures/window';
|
||||
import { Editor } from '@ali/lowcode-editor-core';
|
||||
import { Project } from '../../src/project/project';
|
||||
import { Node } from '../../src/document/node/node';
|
||||
import TestRenderer from 'react-test-renderer';
|
||||
import { configure, render } from 'enzyme';
|
||||
import Adapter from 'enzyme-adapter-react-16';
|
||||
import { Designer } from '../../src/designer/designer';
|
||||
import formSchema from '../fixtures/schema/form';
|
||||
import { getIdsFromSchema, getNodeFromSchemaById } from '../utils';
|
||||
import { BuiltinSimulatorHostView } from '../../src/builtin-simulator/host-view';
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
const editor = new Editor();
|
||||
|
||||
describe('setting-prop-entry 测试', () => {
|
||||
let designer: Designer;
|
||||
beforeEach(() => {
|
||||
designer = new Designer({ editor });
|
||||
});
|
||||
afterEach(() => {
|
||||
designer._componentMetasMap.clear();
|
||||
designer = null;
|
||||
});
|
||||
|
||||
it('xxx', () => {
|
||||
// console.log(JSON.stringify(TestRenderer.create(<BuiltinSimulatorHostView project={designer.project} />).toJSON()));
|
||||
|
||||
console.log(render(<BuiltinSimulatorHostView project={designer.project} ref={(xxx) => { console.log('xxx', xxx)}}/>))
|
||||
})
|
||||
});
|
||||
29
packages/designer/tests/builtin-simulator/host.test.tsx
Normal file
29
packages/designer/tests/builtin-simulator/host.test.tsx
Normal file
@ -0,0 +1,29 @@
|
||||
import React from 'react';
|
||||
import set from 'lodash/set';
|
||||
import cloneDeep from 'lodash/clonedeep';
|
||||
import '../fixtures/window';
|
||||
import { Editor } from '@ali/lowcode-editor-core';
|
||||
import { Project } from '../../src/project/project';
|
||||
import { Node } from '../../src/document/node/node';
|
||||
import { Designer } from '../../src/designer/designer';
|
||||
import formSchema from '../fixtures/schema/form';
|
||||
import { getIdsFromSchema, getNodeFromSchemaById } from '../utils';
|
||||
import { BuiltinSimulatorHost } from '../../src/builtin-simulator/host';
|
||||
|
||||
|
||||
const editor = new Editor();
|
||||
|
||||
describe('setting-prop-entry 测试', () => {
|
||||
let designer: Designer;
|
||||
beforeEach(() => {
|
||||
designer = new Designer({ editor });
|
||||
});
|
||||
afterEach(() => {
|
||||
designer._componentMetasMap.clear();
|
||||
designer = null;
|
||||
});
|
||||
|
||||
it('dummy test', () => {
|
||||
console.log(new BuiltinSimulatorHost(designer.project));
|
||||
})
|
||||
});
|
||||
@ -23,7 +23,7 @@ describe('setting-prop-entry 测试', () => {
|
||||
});
|
||||
|
||||
describe('node 构造函数生成 settingEntry', () => {
|
||||
it.only('常规方法测试', () => {
|
||||
it('常规方法测试', () => {
|
||||
designer.createComponentMeta(divMeta);
|
||||
designer.project.open(settingSchema);
|
||||
const { currentDocument } = designer.project;
|
||||
|
||||
@ -76,4 +76,8 @@ editor?.on('history.forward', (data) => {
|
||||
bus.emit('ve.history.forward', data);
|
||||
});
|
||||
|
||||
editor?.on('node.prop.change', (data) => {
|
||||
bus.emit('node.prop.change', data);
|
||||
});
|
||||
|
||||
export default bus;
|
||||
|
||||
@ -114,7 +114,7 @@ html.engine-preview-mode {
|
||||
}
|
||||
|
||||
.ve-popups .ve-message {
|
||||
right: 290px;
|
||||
right: calc(var(--right-area-width, 300px) + 10px);
|
||||
|
||||
.ve-message-content {
|
||||
display: flex;
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
"scripts": {
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"start": "build-scripts start",
|
||||
"build": "build-scripts build",
|
||||
"build": "build-scripts build --skip-demo",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"repository": {
|
||||
@ -54,5 +54,5 @@
|
||||
"publishConfig": {
|
||||
"registry": "http://registry.npm.alibaba-inc.com"
|
||||
},
|
||||
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-react-renderer@0.13.1-11/build/index.html"
|
||||
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-react-renderer@0.13.1-13/build/index.html"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user