Merge remote-tracking branch 'origin/release/0.9.0' into components-panel

This commit is contained in:
金禅 2020-06-29 16:02:39 +08:00
commit 055ccb3a08
83 changed files with 1177 additions and 205 deletions

View File

@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.6"></a>
## [0.8.6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-code-generator@0.8.5...@ali/lowcode-code-generator@0.8.6) (2020-06-23)
### Bug Fixes
* 更改生成 id 的规则, 否则命中 recore 解析 id 的一个限制 ([5adff44](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/5adff44))
<a name="0.8.5"></a>
## [0.8.5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-code-generator@0.8.4...@ali/lowcode-code-generator@0.8.5) (2020-04-15)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-code-generator",
"version": "0.8.5",
"version": "0.8.6",
"description": "出码引擎 for LowCode Engine",
"main": "lib/index.js",
"files": [

View File

@ -3,6 +3,33 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.33"></a>
## [0.8.33](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.32...@ali/lowcode-demo@0.8.33) (2020-06-24)
**Note:** Version bump only for package @ali/lowcode-demo
<a name="0.8.32"></a>
## [0.8.32](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.31...@ali/lowcode-demo@0.8.32) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-demo
<a name="0.8.31"></a>
## [0.8.31](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.30...@ali/lowcode-demo@0.8.31) (2020-06-23)
### Bug Fixes
* 更改生成 id 的规则, 否则命中 recore 解析 id 的一个限制 ([5adff44](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/5adff44))
<a name="0.8.30"></a>
## [0.8.30](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.29...@ali/lowcode-demo@0.8.30) (2020-06-16)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-demo",
"version": "0.8.30",
"version": "0.8.33",
"private": true,
"description": "低代码引擎 DEMO",
"scripts": {
@ -9,21 +9,21 @@
},
"config": {},
"dependencies": {
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-editor-skeleton": "^0.8.26",
"@ali/lowcode-plugin-components-pane": "^0.8.23",
"@ali/lowcode-plugin-designer": "^0.9.20",
"@ali/lowcode-plugin-event-bind-dialog": "^0.8.16",
"@ali/lowcode-plugin-outline-pane": "^0.8.26",
"@ali/lowcode-plugin-sample-logo": "^0.8.15",
"@ali/lowcode-plugin-sample-preview": "^0.8.25",
"@ali/lowcode-editor-core": "^0.8.19",
"@ali/lowcode-editor-skeleton": "^0.8.29",
"@ali/lowcode-plugin-components-pane": "^0.8.25",
"@ali/lowcode-plugin-designer": "^0.9.23",
"@ali/lowcode-plugin-event-bind-dialog": "^0.8.18",
"@ali/lowcode-plugin-outline-pane": "^0.8.29",
"@ali/lowcode-plugin-sample-logo": "^0.8.17",
"@ali/lowcode-plugin-sample-preview": "^0.8.27",
"@ali/lowcode-plugin-settings-pane": "^0.8.8",
"@ali/lowcode-plugin-undo-redo": "^0.8.25",
"@ali/lowcode-plugin-variable-bind-dialog": "^0.8.14",
"@ali/lowcode-plugin-zh-en": "^0.8.18",
"@ali/lowcode-react-renderer": "^0.8.0",
"@ali/lowcode-runtime": "^0.8.13",
"@ali/lowcode-utils": "^0.8.7",
"@ali/lowcode-plugin-undo-redo": "^0.8.27",
"@ali/lowcode-plugin-variable-bind-dialog": "^0.8.16",
"@ali/lowcode-plugin-zh-en": "^0.8.20",
"@ali/lowcode-react-renderer": "^0.8.12",
"@ali/lowcode-runtime": "^0.8.16",
"@ali/lowcode-utils": "^0.8.10",
"@ali/ve-action-pane": "^4.7.0-beta.0",
"@ali/ve-datapool-pane": "^6.4.3",
"@ali/ve-history-pane": "4.0.0",

View File

@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.9.23"></a>
## [0.9.23](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@0.9.21...@ali/lowcode-designer@0.9.23) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-designer
<a name="0.9.21"></a>
## [0.9.21](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@0.9.20...@ali/lowcode-designer@0.9.21) (2020-06-23)
### Bug Fixes
* 1. 修复dialog拖入不显示问题 2. dialog 只能在根节点下 3. 引入 modalNodeManager ([65977e7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/65977e7))
* add extraEnv ([9058ac8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/9058ac8))
* 修复低代码组件设计器、区块设计器根节点为 Page 的问题,修复 topArea 样式 ([e85b542](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/e85b542))
* 支持事件 VE_EVENTS.VE_PAGE_PAGE_READY ([935ffad](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/935ffad))
* 支持页面回滚 ([5d7dc2f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/5d7dc2f))
* 更改生成 id 的规则, 否则命中 recore 解析 id 的一个限制 ([5adff44](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/5adff44))
* 根据目标元素的canDropIn函数判断是否能放入其他元素 ([21d4f64](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/21d4f64))
* 简化 onPageReady 实现逻辑 ([a36e5f2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/a36e5f2))
### Features
* 增加 node replaceWith 方法 ([d44f95b](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/d44f95b))
* 引擎层埋点 ([69de533](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/69de533))
<a name="0.9.20"></a>
## [0.9.20](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@0.9.19...@ali/lowcode-designer@0.9.20) (2020-06-16)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-designer",
"version": "0.9.20",
"version": "0.9.23",
"description": "Designer for Ali LowCode Engine",
"main": "lib/index.js",
"module": "es/index.js",
@ -15,9 +15,9 @@
},
"license": "MIT",
"dependencies": {
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-types": "^0.8.6",
"@ali/lowcode-utils": "^0.8.7",
"@ali/lowcode-editor-core": "^0.8.19",
"@ali/lowcode-types": "^0.8.9",
"@ali/lowcode-utils": "^0.8.10",
"classnames": "^2.2.6",
"event": "^1.0.0",
"react": "^16",

View File

@ -38,7 +38,6 @@ export class BuiltinSimulatorHostView extends Component<SimulatorHostProps> {
}
}
render() {
const { Provider } = SimulatorContext;
return (
<div className="lc-simulator">
{/*progressing.visible ? <PreLoaderView /> : null*/}

View File

@ -40,6 +40,7 @@ export interface BuiltinSimulatorProps {
device?: 'mobile' | 'iphone' | string;
deviceClassName?: string;
environment?: Asset;
extraEnvironment?: Asset;
library?: LibraryItem[];
simulatorUrl?: Asset;
theme?: Asset;
@ -187,6 +188,8 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
// required & use once
assetBundle(this.get('environment') || defaultEnvironment, AssetLevel.Environment),
// required & use once
assetBundle(this.get('extraEnvironment'), AssetLevel.Environment),
// required & use once
assetBundle(libraryAsset, AssetLevel.Library),
// required & TODO: think of update
assetBundle(this.theme, AssetLevel.Theme),
@ -319,7 +322,9 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
'click',
(e) => {
// fix for popups close logic
document.dispatchEvent(new Event('click'));
const x = new Event('click');
x.initEvent('click', true);
this._iframe?.dispatchEvent(x);
const target = e.target as HTMLElement;
if (isFormEvent(e) || target?.closest('.next-input-group,.next-checkbox-group,.next-date-picker,.next-input,.next-month-picker,.next-number-picker,.next-radio-group,.next-range,.next-range-picker,.next-rating,.next-select,.next-switch,.next-time-picker,.next-upload,.next-year-picker,.next-breadcrumb-item,.next-calendar-header,.next-calendar-table')) {
e.preventDefault();
@ -788,6 +793,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
this.scroller.scrolling(e);
const dropContainer = this.getDropContainer(e);
if (!dropContainer ||
// too dirty
(typeof dropContainer.container?.componentMeta?.prototype?.options?.canDropIn === 'function' &&
!dropContainer.container?.componentMeta?.prototype?.options?.canDropIn(e.dragObject.nodes[0]))) {
return null;
@ -820,6 +826,15 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
event: e,
};
if (e.dragObject.nodes[0].getPrototype().isModal()) {
return this.designer.createLocation({
target: this.document.rootNode,
detail,
source: 'simulator' + this.document.id,
event: e,
});
}
if (!children || children.size < 1 || !edge) {
return this.designer.createLocation(locationData);
}

View File

@ -6,7 +6,17 @@ function getDataFromPasteEvent(event: ClipboardEvent) {
try {
// { componentsMap, componentsTree, ... }
return JSON.parse(clipboardData.getData('text/plain'));
const data = JSON.parse(clipboardData.getData('text/plain'));
if (!data) {
return {};
}
if (data.componentsTree) {
return data;
} else if (data.componentName) {
return {
componentsTree: [ data ]
};
}
} catch (error) {
/*
const html = clipboardData.getData('text/html');
@ -19,7 +29,7 @@ function getDataFromPasteEvent(event: ClipboardEvent) {
}
*/
// TODO: open the parser implement
return null;
return { };
/*
return {
code: clipboardData.getData('text/plain'),

View File

@ -266,8 +266,8 @@ export class Designer {
this.oobxList.forEach((item) => item.compute());
}
createSettingEntry(editor: IEditor, nodes: Node[]) {
return new SettingTopEntry(editor, nodes);
createSettingEntry(nodes: Node[]) {
return new SettingTopEntry(this.editor, nodes);
}
/**
@ -454,7 +454,15 @@ export class Designer {
return props;
}
return reducers.reduce((xprops, reducer) => reducer(xprops, node), props);
return reducers.reduce((xprops, reducer) => {
try {
return reducer(xprops, node)
} catch (e) {
// todo: add log
console.warn(e);
return xprops;
}
}, props);
}
addPropsReducer(reducer: PropsReducer, stage: TransformStage) {

View File

@ -152,6 +152,9 @@ function getSourceSensor(dragObject: DragObject): ISimulatorHost | null {
return dragObject.nodes[0]?.document.simulator || null;
}
/**
* make a handler that listen all sensors:document, avoid frame lost
*/
function makeEventsHandler(
boostEvent: MouseEvent | DragEvent,
sensors: ISimulatorHost[],
@ -178,6 +181,9 @@ function isDragEvent(e: any): e is DragEvent {
return e?.type?.substr(0, 4) === 'drag';
}
/**
* Drag-on
*/
export class Dragon {
private sensors: ISensor[] = [];
@ -195,12 +201,15 @@ export class Dragon {
}
private emitter = new EventEmitter();
// private emptyImage: HTMLImageElement = new Image();
constructor(readonly designer: Designer) {
// this.emptyImage.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
}
/**
* Quick listen a shell(container element) drag behavior
* @param shell container element
* @param boost boost got a drag object
*/
from(shell: Element, boost: (e: MouseEvent) => DragObject | null) {
const mousedown = (e: MouseEvent) => {
// ESC or RightClick
@ -222,6 +231,12 @@ export class Dragon {
};
}
/**
* boost your dragObject for dragging(flying)
*
* @param dragObject
* @param boostEvent
*/
boost(dragObject: DragObject, boostEvent: MouseEvent | DragEvent) {
const designer = this.designer;
const masterSensors = this.getMasterSensors();
@ -313,16 +328,20 @@ export class Dragon {
this.emitter.emit('dragstart', locateEvent);
};
// route: drag-move
const move = (e: MouseEvent | DragEvent) => {
if (isBoostFromDragAPI) {
e.preventDefault();
}
if (this._dragging) {
// process dragging
drag(e);
return;
}
// first move check is shaken
if (isShaken(boostEvent, e)) {
// is shaken dragstart
dragstart();
drag(e);
}
@ -335,6 +354,7 @@ export class Dragon {
didDrop = true;
};
// end-tail drag process
const over = (e?: any) => {
if (e && isDragEvent(e)) {
e.preventDefault();
@ -381,6 +401,7 @@ export class Dragon {
}
};
// create drag locate event
const createLocateEvent = (e: MouseEvent | DragEvent): LocateEvent => {
const evt: any = {
type: 'LocateEvent',
@ -391,12 +412,14 @@ export class Dragon {
const sourceDocument = e.view?.document;
// event from current document
if (!sourceDocument || sourceDocument === document) {
evt.globalX = e.clientX;
evt.globalY = e.clientY;
} else {
} else { // event from simulator sandbox
let srcSim: ISimulatorHost | undefined;
const lastSim = lastSensor && isSimulatorHost(lastSensor) ? lastSensor : null;
// check source simulator
if (lastSim && lastSim.contentDocument === sourceDocument) {
srcSim = lastSim;
} else {
@ -406,6 +429,7 @@ export class Dragon {
}
}
if (srcSim) {
// transform point by simulator
const g = srcSim.viewport.toGlobalPoint(e);
evt.globalX = g.clientX;
evt.globalY = g.clientY;
@ -454,9 +478,7 @@ export class Dragon {
const { dataTransfer } = boostEvent;
if (dataTransfer) {
// dataTransfer.setDragImage(this.emptyImage, 0, 0);
dataTransfer.effectAllowed = 'all';
// dataTransfer.dropEffect = newBie || forceCopyState ? 'copy' : 'move';
try {
dataTransfer.setData('application/json', '{}');

View File

@ -138,7 +138,13 @@ export class SettingPropEntry implements SettingEntry {
val = this.parent.getPropValue(this.name);
}
const { getValue } = this.extraProps;
return getValue ? getValue(this, val) : val;
try {
return getValue ? getValue(this, val) : val;
} catch (e) {
// todo: add log
console.warn(e);
return val;
}
}
/**
@ -153,7 +159,12 @@ export class SettingPropEntry implements SettingEntry {
}
const { setValue } = this.extraProps;
if (setValue && !extraOptions.disableMutator) {
setValue(this, val);
try {
setValue(this, val);
} catch (e) {
// todo: add log
console.warn(e);
}
}
}
@ -166,7 +177,12 @@ export class SettingPropEntry implements SettingEntry {
}
const { setValue } = this.extraProps;
if (setValue) {
setValue(this, undefined);
try {
setValue(this, undefined);
} catch (e) {
// todo: add log
console.warn(e);
}
}
}

View File

@ -1,5 +1,6 @@
import { computed, obx } from '@ali/lowcode-editor-core';
import { NodeData, isJSExpression, isDOMText, NodeSchema, isNodeSchema, RootSchema } from '@ali/lowcode-types';
import { EventEmitter } from 'events';
import { Project } from '../project';
import { ISimulatorHost } from '../simulator';
import { ComponentMeta } from '../component-meta';
@ -9,6 +10,7 @@ import { Selection } from './selection';
import { History } from './history';
import { TransformStage } from './node';
import { uniqueId } from '@ali/lowcode-utils';
import ModalNodesManager from './node/modalNodesManager';
export type GetDataType<T, NodeType> = T extends undefined
? NodeType extends {
@ -26,7 +28,7 @@ export class DocumentModel {
/**
*
*/
readonly id: string = uniqueId('doc');
id: string = uniqueId('doc');
/**
*
*/
@ -40,6 +42,9 @@ export class DocumentModel {
@obx.val private nodes = new Set<Node>();
private seqId = 0;
private _simulator?: ISimulatorHost;
private emitter: EventEmitter;
private rootNodeVisitorMap: { [visitorName: string]: any } = {};
private modalNodesManager: ModalNodesManager;
/**
*
@ -75,6 +80,7 @@ export class DocumentModel {
console.info(this.willPurgeSpace);
}, true);
*/
this.emitter = new EventEmitter();
if (!schema) {
this._blank = true;
@ -93,6 +99,7 @@ export class DocumentModel {
(schema) => this.import(schema as RootSchema, true),
);
this.setupListenActiveNodes();
this.modalNodesManager = new ModalNodesManager(this);
this.inited = true;
}
@ -194,9 +201,14 @@ export class DocumentModel {
this.nodesMap.set(node.id, node);
this.nodes.add(node);
this.emitter.emit('nodecreate', node);
return node as any;
}
public destroyNode(node: Node) {
this.emitter.emit('nodedestroy', node);
}
/**
*
*/
@ -406,7 +418,7 @@ export class DocumentModel {
/**
*
*/
open(): void {
open(): DocumentModel {
const originState = this._opened;
this._opened = true;
if (originState === false) {
@ -417,6 +429,7 @@ export class DocumentModel {
} else {
this.project.checkExclusive(this);
}
return this;
}
/**
@ -499,6 +512,52 @@ export class DocumentModel {
get root() {
return this.rootNode;
}
onRendererReady(fn: (args: any) => void): () => void {
this.emitter.on('lowcode_engine_renderer_ready', fn);
return () => {
this.emitter.removeListener('lowcode_engine_renderer_ready', fn);
};
}
setRendererReady(renderer) {
this.emitter.emit('lowcode_engine_renderer_ready', renderer);
}
acceptRootNodeVisitor(
visitorName: string = 'default',
visitorFn: (node: RootNode) => any ) {
let visitorResult = {};
if (!visitorName) {
/* tslint:disable no-console */
console.warn('Invalid or empty RootNodeVisitor name.');
}
try {
visitorResult = visitorFn.call(this, this.rootNode);
this.rootNodeVisitorMap[visitorName] = visitorResult;
} catch (e) {
console.error('RootNodeVisitor is not valid.');
}
return visitorResult;
}
getRootNodeVisitor(name: string) {
return this.rootNodeVisitorMap[name];
}
onNodeCreate(func: (node: Node) => void) {
this.emitter.on('nodecreate', func);
return () => {
this.emitter.removeListener('nodecreate', func);
};
}
onNodeDestroy(func: (node: Node) => void) {
this.emitter.on('nodedestroy', func);
return () => {
this.emitter.removeListener('nodedestroy', func);
};
}
}
export function isDocumentModel(obj: any): obj is DocumentModel {

View File

@ -0,0 +1,135 @@
import { EventEmitter } from 'events';
import { Node } from './node';
import { DocumentModel } from '../document-model';
function getModalNodes(node: Node) {
let nodes: any = [];
const prototype = node.getPrototype();
if (prototype && prototype.isModal()) {
nodes.push(node);
}
const children = node.getChildren();
if (children) {
children.forEach((child) => {
nodes = nodes.concat(getModalNodes(child));
});
}
return nodes;
}
export default class ModalNodesManager {
public willDestroy: any;
private page: DocumentModel;
private modalNodes: [Node];
private nodeRemoveEvents: any;
private emitter: EventEmitter;
constructor(page: DocumentModel) {
this.page = page;
this.emitter = new EventEmitter();
this.nodeRemoveEvents = {};
this.setNodes();
this.hideModalNodes();
this.willDestroy = [
page.onNodeCreate((node) => this.addNode(node)),
page.onNodeDestroy((node) => this.removeNode(node)),
];
}
public getModalNodes() {
return this.modalNodes;
}
public getVisibleModalNode() {
const visibleNode = this.modalNodes
? this.modalNodes.find((node: Node) => {
return !node.getExtraProp('hidden');
})
: null;
return visibleNode;
}
public hideModalNodes() {
if (this.modalNodes) {
this.modalNodes.forEach((node: Node) => {
node.getExtraProp('hidden')?.setValue(true);
});
}
}
public setVisible(node: Node) {
this.hideModalNodes();
node.getExtraProp('hidden')?.setValue(false);
}
public setInvisible(node: Node) {
node.getExtraProp('hidden')?.setValue(true);
}
public onVisibleChange(func: () => any) {
this.emitter.on('visibleChange', func);
return () => {
this.emitter.removeListener('visibleChange', func);
};
}
public onModalNodesChange(func: () => any) {
this.emitter.on('modalNodesChange', func);
return () => {
this.emitter.removeListener('modalNodesChange', func);
};
}
private addNode(node: Node) {
const prototype = node.getPrototype();
if (prototype && prototype.isModal()) {
this.hideModalNodes();
this.modalNodes.push(node);
this.addNodeEvent(node);
this.emitter.emit('modalNodesChange');
this.emitter.emit('visibleChange');
}
}
private removeNode(node: Node) {
const prototype = node.getPrototype();
if (prototype && prototype.isModal()) {
const index = this.modalNodes.indexOf(node);
if (index >= 0) {
this.modalNodes.splice(index, 1);
}
this.removeNodeEvent(node);
this.emitter.emit('modalNodesChange');
if (!node.getExtraProp('hidden')) {
this.emitter.emit('visibleChange');
}
}
}
private addNodeEvent(node: Node) {
// this.nodeRemoveEvents[node.getId()] =
// node.onStatusChange((status: any, field: any) => {
// if (field === 'visibility') {
// this.emitter.emit('visibleChange');
// }
// });
}
private removeNodeEvent(node: Node) {
// if (this.nodeRemoveEvents[node.getId()]) {
// this.nodeRemoveEvents[node.getId()]();
// delete this.nodeRemoveEvents[node.getId()];
// }
}
private setNodes() {
const nodes = getModalNodes(this.page.getRoot());
this.modalNodes = nodes;
this.modalNodes.forEach((node: Node) => {
this.addNodeEvent(node);
});
this.emitter.emit('modalNodesChange');
}
}

View File

@ -21,6 +21,7 @@ import { ComponentMeta } from '../../component-meta';
import { ExclusiveGroup, isExclusiveGroup } from './exclusive-group';
import { TransformStage } from './transform-stage';
import { ReactElement } from 'react';
import { SettingTopEntry } from 'designer/src/designer';
/**
*
@ -142,6 +143,8 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
return this.componentMeta.icon;
}
readonly settingEntry: SettingTopEntry;
constructor(readonly document: DocumentModel, nodeSchema: Schema) {
const { componentName, id, children, props, ...extras } = nodeSchema;
this.id = id || `node_${document.nextId()}`;
@ -158,9 +161,7 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
this.setupAutoruns();
}
if (this.componentMeta.isModal) {
this.getExtraProp('hidden', true)?.setValue(true);
}
this.settingEntry = this.document.designer.createSettingEntry([ this ]);
}
private transformProps(props: any): any {
@ -384,7 +385,7 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
// todo
}
replaceWith(schema: Schema, migrate = false) {
replaceWith(schema: Schema, migrate = false): any {
// reuse the same id? or replaceSelection
schema = Object.assign({}, migrate ? this.export() : {}, schema);
return this.parent?.replaceChild(this, schema);
@ -396,7 +397,7 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
* @param {Node} node
* @param {object} data
*/
replaceChild(node: Node, data: any) {
replaceChild(node: Node, data: any): Node {
if (this.children?.has(node)) {
const selected = this.document.selection.has(node.id);
@ -516,6 +517,10 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
}
}
toData() {
return this.export();
}
/**
* schema
*/
@ -633,6 +638,8 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
this.autoruns?.forEach((dispose) => dispose());
this.props.purge();
this.document.internalRemoveAndPurgeNode(this);
this.document.destroyNode(this);
}
// ======= compatible apis ====

View File

@ -109,11 +109,11 @@ export class Prop implements IPropParent {
}
return this.items!.map((prop) => {
const v = prop.export(stage);
return v === UNSET ? null : v;
return v === UNSET ? undefined : v;
});
}
return null;
return undefined;
}
private _code: string | null = null;
@ -176,7 +176,7 @@ export class Prop implements IPropParent {
this._code = null;
const t = typeof val;
if (val == null) {
this._value = null;
this._value = undefined;
this._type = 'literal';
} else if (t === 'string' || t === 'number' || t === 'boolean') {
this._type = 'literal';
@ -192,7 +192,6 @@ export class Prop implements IPropParent {
} else {
this._type = 'map';
}
this._type = 'map';
} else {
this._type = 'expression';
this._value = {
@ -206,7 +205,7 @@ export class Prop implements IPropParent {
@computed getValue(): CompositeValue {
const v = this.export(TransformStage.Serilize);
if (v === UNSET) {
return null;
return undefined;
}
return v;
}

View File

@ -106,7 +106,7 @@ export class Props implements IPropParent {
this.items.forEach(item => {
let value = item.export(stage);
if (value === UNSET) {
value = null;
value = undefined;
}
let name = item.key as string;
if (name && typeof name === 'string' && name.startsWith(EXTRA_KEY_PREFIX)) {
@ -129,7 +129,7 @@ export class Props implements IPropParent {
}
let value = item.export(stage);
if (value === UNSET) {
value = null;
value = undefined;
}
if (typeof name === 'string' && name.startsWith(EXTRA_KEY_PREFIX)) {
name = getOriginalExtraKey(name);

View File

@ -122,7 +122,7 @@ export class Project {
if (data) {
doc = new DocumentModel(this, data);
this.documents.push(doc);
doc.open();
return doc.open();
}
return;
@ -134,7 +134,7 @@ export class Project {
doc = new DocumentModel(this, doc);
this.documents.push(doc);
doc.open();
return doc.open();
}
checkExclusive(actived: DocumentModel) {

View File

@ -142,7 +142,7 @@ export interface ISimulatorHost<P = object> extends ISensor {
computeComponentInstanceRect(instance: ComponentInstance, selector?: string): DOMRect | null;
findDOMNodes(instance: ComponentInstance, selector?: string): Array<Element | Text> | null;
/**
*
*/

View File

@ -3,6 +3,26 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.19"></a>
## [0.8.19](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-core@0.8.17...@ali/lowcode-editor-core@0.8.19) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-editor-core
<a name="0.8.17"></a>
## [0.8.17](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-core@0.8.16...@ali/lowcode-editor-core@0.8.17) (2020-06-23)
### Features
* export Monitor ([51025f0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/51025f0))
* 引擎层埋点 ([69de533](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/69de533))
<a name="0.8.16"></a>
## [0.8.16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-core@0.8.15...@ali/lowcode-editor-core@0.8.16) (2020-06-15)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-editor-core",
"version": "0.8.16",
"version": "0.8.19",
"description": "Core Api for Ali lowCode engine",
"license": "MIT",
"main": "lib/index.js",
@ -15,8 +15,8 @@
"cloud-build": "build-scripts build --skip-demo"
},
"dependencies": {
"@ali/lowcode-types": "^0.8.6",
"@ali/lowcode-utils": "^0.8.7",
"@ali/lowcode-types": "^0.8.9",
"@ali/lowcode-utils": "^0.8.10",
"@alifd/next": "^1.19.16",
"@recore/obx": "^1.0.9",
"@recore/obx-react": "^1.0.8",

View File

@ -328,16 +328,16 @@ function getKeyInfo(combination: string, action?: string): KeyInfo {
* convention - prevent default and stop propogation on the event
*/
function fireCallback(callback: HotkeyCallback, e: KeyboardEvent, combo?: string, sequence?: string): void {
if (callback(e, combo) === false) {
e.preventDefault();
e.stopPropagation();
}
const editor = globalContext.get(Editor);
const designer = editor.get('designer');
const node = designer?.currentSelection?.getNodes()?.[0];
const npm = node?.componentMeta?.npm;
const selected =
[npm?.package, npm?.componentName].filter((item) => !!item).join('-') || node?.componentMeta?.componentName || '';
if (callback(e, combo) === false) {
e.preventDefault();
e.stopPropagation();
}
editor?.emit('hotkey.callback.call', {
callback,
e,

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.9.8"></a>
## [0.9.8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.7...@ali/lowcode-editor-preset-general@0.9.8) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-editor-preset-general
<a name="0.9.7"></a>
## [0.9.7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.6...@ali/lowcode-editor-preset-general@0.9.7) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-editor-preset-general
<a name="0.9.6"></a>
## [0.9.6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.5...@ali/lowcode-editor-preset-general@0.9.6) (2020-06-16)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-editor-preset-general",
"version": "0.9.6",
"version": "0.9.8",
"private": true,
"description": "Ali General Editor Preset",
"main": "lib/index.js",
@ -15,12 +15,12 @@
},
"license": "MIT",
"dependencies": {
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-editor-skeleton": "^0.8.26",
"@ali/lowcode-plugin-designer": "^0.9.20",
"@ali/lowcode-plugin-outline-pane": "^0.8.26",
"@ali/lowcode-types": "^0.8.6",
"@ali/lowcode-utils": "^0.8.7",
"@ali/lowcode-editor-core": "^0.8.19",
"@ali/lowcode-editor-skeleton": "^0.8.29",
"@ali/lowcode-plugin-designer": "^0.9.23",
"@ali/lowcode-plugin-outline-pane": "^0.8.29",
"@ali/lowcode-types": "^0.8.9",
"@ali/lowcode-utils": "^0.8.10",
"@alifd/next": "^1.19.12",
"@alife/theme-lowcode-dark": "^0.1.0",
"@alife/theme-lowcode-light": "^0.1.0",
@ -28,7 +28,7 @@
"react-dom": "^16.8.1"
},
"devDependencies": {
"@ali/lowcode-editor-setters": "^0.9.3",
"@ali/lowcode-editor-setters": "^0.9.5",
"@alib/build-scripts": "^0.1.18",
"@types/events": "^3.0.0",
"@types/react": "^16.8.3",

View File

@ -3,6 +3,49 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.24"></a>
## [0.8.24](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.23...@ali/lowcode-editor-preset-vision@0.8.24) (2020-06-24)
### Bug Fixes
* variable init bug ([6d55bd3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/6d55bd3))
<a name="0.8.23"></a>
## [0.8.23](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.22...@ali/lowcode-editor-preset-vision@0.8.23) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-editor-preset-vision
<a name="0.8.22"></a>
## [0.8.22](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.21...@ali/lowcode-editor-preset-vision@0.8.22) (2020-06-23)
### Bug Fixes
* add extraEnv ([9058ac8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/9058ac8))
* compatiable bug ([45574db](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/45574db))
* Trunk add getSetter ([b6d64c3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b6d64c3))
* Trunk.getSetter return ReactElement ([34bf71d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/34bf71d))
* 修复低代码组件设计器、区块设计器根节点为 Page 的问题,修复 topArea 样式 ([e85b542](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/e85b542))
* 右侧配置面板样式修复 ([05f62da](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/05f62da))
* 支持事件 VE_EVENTS.VE_PAGE_PAGE_READY ([935ffad](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/935ffad))
* 支持页面回滚 ([5d7dc2f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/5d7dc2f))
* 简化 onPageReady 实现逻辑 ([a36e5f2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/a36e5f2))
### Features
* export Monitor ([51025f0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/51025f0))
<a name="0.8.21"></a>
## [0.8.21](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.20...@ali/lowcode-editor-preset-vision@0.8.21) (2020-06-16)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-editor-preset-vision",
"version": "0.8.21",
"version": "0.8.24",
"private": true,
"description": "Vision Polyfill for Ali lowCode engine",
"main": "lib/index.js",
@ -15,11 +15,11 @@
},
"license": "MIT",
"dependencies": {
"@ali/lowcode-designer": "^0.9.20",
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-editor-skeleton": "^0.8.26",
"@ali/lowcode-plugin-designer": "^0.9.20",
"@ali/lowcode-plugin-outline-pane": "^0.8.26",
"@ali/lowcode-designer": "^0.9.23",
"@ali/lowcode-editor-core": "^0.8.19",
"@ali/lowcode-editor-skeleton": "^0.8.29",
"@ali/lowcode-plugin-designer": "^0.9.23",
"@ali/lowcode-plugin-outline-pane": "^0.8.29",
"@ali/ve-i18n-util": "^2.0.0",
"@ali/ve-icons": "^4.1.9",
"@ali/ve-less-variables": "2.0.3",

View File

@ -1,6 +1,6 @@
import lg from '@ali/vu-logger';
import { ComponentClass, ComponentType } from 'react';
import Prototype from './prototype';
import Prototype, { isPrototype } from './prototype';
import { designer } from '../editor';
function basename(name: string) {
@ -57,7 +57,7 @@ export default class Bundle {
this.revisePrototype(item, prototype);
const componentName = item.componentName || prototype.getComponentName()!;
const matchedView = this.viewsMap[componentName] || null;
if (!prototype.getView() && matchedView) {
if (matchedView) {
prototype.setView(matchedView);
}
this.registerPrototype(prototype);
@ -141,12 +141,12 @@ export default class Bundle {
private recursivelyRegisterPrototypes(list: any[], cp: ComponentProtoBundle) {
const propList: ComponentProtoBundle[] = list;
propList.forEach((proto: ComponentProtoBundle, index: number) => {
propList.forEach((proto: any, index: number) => {
if (Array.isArray(proto)) {
this.recursivelyRegisterPrototypes(proto, cp);
return;
}
if (proto instanceof Prototype) {
if (isPrototype(proto)) {
const componentName = proto.getComponentName()!;
if (!proto.getView() && this.viewsMap[componentName]) {
proto.setView(this.viewsMap[componentName]);

View File

@ -212,24 +212,30 @@ class Prototype {
static addGlobalExtraActions = addGlobalExtraActions;
static removeGlobalPropsConfigure = removeGlobalPropsConfigure;
static overridePropsConfigure = overridePropsConfigure;
static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta) {
return new Prototype(config);
static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) {
return new Prototype(config, lookup);
}
readonly isPrototype = true;
private meta: ComponentMeta;
readonly meta: ComponentMeta;
readonly options: OldPrototypeConfig | ComponentMetadata;
constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta) {
if (isComponentMeta(input)) {
this.meta = input;
this.options = input.getMetadata();
constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) {
if (lookup) {
this.meta = designer.getComponentMeta(input.componentName);
this.options = this.meta.getMetadata();
return this.meta.prototype || this;
} else {
this.options = input;
const metadata = isNewSpec(input) ? input : upgradeMetadata(input);
this.meta = designer.createComponentMeta(metadata);
if (isComponentMeta(input)) {
this.meta = input;
this.options = input.getMetadata();
} else {
this.options = input;
const metadata = isNewSpec(input) ? input : upgradeMetadata(input);
this.meta = designer.createComponentMeta(metadata);
}
(this.meta as any).prototype = this;
}
(this.meta as any).prototype = this;
}
getId() {

View File

@ -24,7 +24,8 @@ export class Trunk {
}
getList(): any[] {
return this.trunk.reduceRight((prev, cur) => prev.concat(cur.getList()), []);
const list = this.trunk.reduceRight((prev, cur) => prev.concat(cur.getList()), []);
return Array.from(new Set(list));
}
getPrototype(name: string) {
@ -35,7 +36,7 @@ export class Trunk {
bundle = this.trunk[i];
prototype = bundle.get(name);
if (prototype) {
return prototype;
return (prototype.meta as any).prototype;
}
}
return this.metaBundle.getFromMeta(name);
@ -85,7 +86,7 @@ export class Trunk {
}
registerSetter(type: string, setter: CustomView | RegisteredSetter) {
console.warn('Trunk.registerSetter is deprecated');
// console.warn('Trunk.registerSetter is deprecated');
registerSetter(type, setter);
}

View File

@ -711,8 +711,7 @@ export function upgradeMetadata(oldConfig: OldPrototypeConfig) {
experimental.initialChildren =
typeof initialChildren === 'function'
? (node: any) => {
const props = designer.createSettingEntry(editor, [ node ]);
return initialChildren.call(node, props);
return initialChildren.call(node, node.settingEntry);
}
: initialChildren;
}

View File

@ -5,6 +5,8 @@ import { Designer, LiveEditing, TransformStage, Node } from '@ali/lowcode-design
import Outline, { OutlineBackupPane, getTreeMaster } from '@ali/lowcode-plugin-outline-pane';
import { toCss } from '@ali/vu-css-style';
import logger from '@ali/vu-logger';
import bus from './bus';
import { VE_EVENTS } from './base/const';
import DesignerPlugin from '@ali/lowcode-plugin-designer';
import { Skeleton, SettingsPrimaryPane } from '@ali/lowcode-editor-skeleton';
@ -23,6 +25,57 @@ export const designer = new Designer({ editor: editor });
editor.set(Designer, designer);
editor.set('designer', designer);
designer.project.onCurrentDocumentChange((doc) => {
doc.onRendererReady(() => {
bus.emit(VE_EVENTS.VE_PAGE_PAGE_READY);
});
});
interface Variable {
type: 'variable';
variable: string;
value: any;
}
function isVariable(obj: any): obj is Variable {
return obj && obj.type === 'variable';
}
function upgradePropsReducer(props: any) {
if (!isPlainObject(props)) {
return props;
}
const newProps: any = {};
Object.entries<any>(props).forEach(([key, val]) => {
if (/^__slot__/.test(key) && val === true) {
return;
}
if (isJSBlock(val)) {
if (val.value.componentName === 'Slot') {
val = {
type: 'JSSlot',
title: (val.value.props as any)?.slotTitle,
value: val.value.children
};
} else {
val = val.value;
}
}
// todo: deep find
if (isVariable(val)) {
val = {
type: 'JSExpression',
value: val.variable,
mock: val.value,
};
}
newProps[key] = val;
});
return newProps;
}
// 升级 Props
designer.addPropsReducer(upgradePropsReducer, TransformStage.Init);
// 节点 props 初始化
designer.addPropsReducer((props, node) => {
// run initials
@ -33,9 +86,13 @@ designer.addPropsReducer((props, node) => {
// FIXME! this implements SettingTarget
try {
// FIXME! item.name could be 'xxx.xxx'
const v = item.initial(node as any, props[item.name]);
const ov = props[item.name];
const v = item.initial(node as any, isJSExpression(ov) ? ov.mock : ov);
if (v !== undefined) {
newProps[item.name] = v;
newProps[item.name] = isJSExpression(ov) ? {
...ov,
mock: v,
} : v;
}
} catch (e) {
if (hasOwnProperty(props, item.name)) {
@ -59,7 +116,7 @@ function filterReducer(props: any, node: Node): any {
return;
}
try {
if (item.filter(node.getProp(item.name) as any, props[item.name]) === false) {
if (item.filter(node.settingEntry.getProp(item.name), props[item.name]) === false) {
delete newProps[item.name];
}
} catch (e) {
@ -74,34 +131,6 @@ function filterReducer(props: any, node: Node): any {
designer.addPropsReducer(filterReducer, TransformStage.Save);
designer.addPropsReducer(filterReducer, TransformStage.Render);
function upgradePropsReducer(props: any) {
if (!isPlainObject(props)) {
return props;
}
const newProps: any = {};
Object.entries<any>(props).forEach(([key, val]) => {
if (/^__slot__/.test(key) && val === true) {
return;
}
if (isJSBlock(val)) {
if (val.value.componentName === 'Slot') {
val = {
type: 'JSSlot',
title: (val.value.props as any)?.slotTitle,
value: val.value.children
};
} else {
val = val.value;
}
}
// todo: type: variable
newProps[key] = val;
});
return newProps;
}
// 升级 Props
designer.addPropsReducer(upgradePropsReducer, TransformStage.Init);
function compatiableReducer(props: any) {
if (!isPlainObject(props)) {
return props;
@ -125,7 +154,7 @@ function compatiableReducer(props: any) {
});
return newProps;
}
// Dirty fix: will remove this reducer
// FIXME: Dirty fix, will remove this reducer
designer.addPropsReducer(compatiableReducer, TransformStage.Save);
// 设计器组件样式处理

View File

@ -1,6 +1,7 @@
import { designer } from './editor';
import { RootSchema } from '@ali/lowcode-types';
import { DocumentModel } from '@ali/lowcode-designer';
import NodeCacheVisitor from './rootNodeVisitor';
const { project } = designer;
@ -38,10 +39,13 @@ const pages = Object.assign(project, {
} else {
componentsTree = pages[0].componentsTree;
if (componentsTree[0]) {
componentsTree[0].componentName = 'Page';
componentsTree[0].componentName = componentsTree[0].componentName || 'Page';
// FIXME
componentsTree[0].lifeCycles = {};
componentsTree[0].methods = {};
if (componentsTree[0].componentName === 'Page' ||
componentsTree[0].componentName === 'Component') {
componentsTree[0].lifeCycles = {};
componentsTree[0].methods = {};
}
}
}
@ -96,4 +100,15 @@ Object.defineProperty(pages, 'currentPage', {
}
})
pages.onCurrentPageChange((page: DocumentModel) => {
if (!page) { return; }
page.acceptRootNodeVisitor('NodeCache', (rootNode) => {
const visitor: NodeCacheVisitor = page.getRootNodeVisitor('NodeCache');
if (visitor) {
visitor.destroy();
}
return new NodeCacheVisitor(page, rootNode);
});
});
export default pages;

View File

@ -0,0 +1,91 @@
import { findIndex } from 'lodash';
import { DocumentModel, Node, Root } from '@ali/lowcode-designer';
/**
* RootNodeVisitor for VisualEngine Page
*
* - store / cache node
* - quickly find / search or do operations on Node
*/
export default class RootNodeVisitor {
public nodeIdMap: {[id: string]: Node} = {};
public nodeFieldIdMap: {[fieldId: string]: Node} = {};
public nodeList: Node[] = [];
private page: DocumentModel;
private root: RootNode;
private cancelers: Function[] = [];
constructor(page: DocumentModel, rootNode: RootNode) {
this.page = page;
this.root = rootNode;
this._findNode(this.root);
this._init();
}
public getNodeList() {
return this.nodeList;
}
public getNodeIdMap() {
return this.nodeIdMap;
}
public getNodeFieldIdMap() {
return this.nodeFieldIdMap;
}
public getNodeById(id?: string) {
if (!id) { return this.nodeIdMap; }
return this.nodeIdMap[id];
}
public getNodeByFieldId(fieldId?: string) {
if (!fieldId) { return this.nodeFieldIdMap; }
return this.nodeFieldIdMap[fieldId];
}
public destroy() {
this.cancelers.forEach((canceler) => canceler());
}
private _init() {
this.cancelers.push(
this.page.onNodeCreate((node) => {
this.nodeList.push(node);
this.nodeIdMap[node.id] = node;
if (node.getPropValue('fieldId')) {
this.nodeFieldIdMap[node.getPropValue('fieldId')] = node;
}
}),
);
this.cancelers.push(
this.page.onNodeDestroy((node) => {
const idx = findIndex(this.nodeList, (n) => node.id === n.id);
this.nodeList.splice(idx, 1);
delete this.nodeIdMap[node.id];
if (node.getPropValue('fieldId')) {
delete this.nodeFieldIdMap[node.getPropValue('fieldId')];
}
}),
);
}
private _findNode(node: Node) {
const props = node.getProps();
const fieldId = props && props.getPropValue('fieldId');
this.nodeIdMap[node.getId()] = node;
this.nodeList.push(node);
if (fieldId) {
this.nodeFieldIdMap[fieldId] = node;
}
const children = node.getChildren();
if (children) {
children.forEach((child) => this._findNode(child));
}
}
}

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.9.5"></a>
## [0.9.5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.4...@ali/lowcode-editor-setters@0.9.5) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.4"></a>
## [0.9.4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.3...@ali/lowcode-editor-setters@0.9.4) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.3"></a>
## [0.9.3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.2...@ali/lowcode-editor-setters@0.9.3) (2020-06-15)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-editor-setters",
"version": "0.9.3",
"version": "0.9.5",
"description": "Builtin setters for Ali lowCode engine",
"files": [
"es",
@ -22,7 +22,7 @@
"@ali/iceluna-comp-react-node": "^1.0.5",
"@ali/iceluna-sdk": "^1.0.5-beta.24",
"@ali/lc-style-setter": "^0.0.1",
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-editor-core": "^0.8.19",
"@alifd/next": "^1.19.16",
"acorn": "^6.4.1",
"classnames": "^2.2.6",

View File

@ -3,6 +3,31 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.29"></a>
## [0.8.29](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.27...@ali/lowcode-editor-skeleton@0.8.29) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-editor-skeleton
<a name="0.8.27"></a>
## [0.8.27](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.26...@ali/lowcode-editor-skeleton@0.8.27) (2020-06-23)
### Bug Fixes
* 修复低代码组件设计器、区块设计器根节点为 Page 的问题,修复 topArea 样式 ([e85b542](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/e85b542))
* 右侧配置面板样式修复 ([05f62da](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/05f62da))
### Features
* 引擎层埋点 ([69de533](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/69de533))
<a name="0.8.26"></a>
## [0.8.26](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.25...@ali/lowcode-editor-skeleton@0.8.26) (2020-06-16)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-editor-skeleton",
"version": "0.8.26",
"version": "0.8.29",
"description": "alibaba lowcode editor skeleton",
"main": "lib/index.js",
"module": "es/index.js",
@ -19,10 +19,10 @@
"editor"
],
"dependencies": {
"@ali/lowcode-designer": "^0.9.20",
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-types": "^0.8.6",
"@ali/lowcode-utils": "^0.8.7",
"@ali/lowcode-designer": "^0.9.23",
"@ali/lowcode-editor-core": "^0.8.19",
"@ali/lowcode-types": "^0.8.9",
"@ali/lowcode-utils": "^0.8.10",
"@alifd/next": "^1.20.12",
"classnames": "^2.2.6",
"react": "^16.8.1",

View File

@ -162,6 +162,8 @@ export class Field extends Component<FieldProps> {
* TODO: turn number to enum
*/
function createValueState(valueState?: number, onClear?: (e: React.MouseEvent) => void) {
return null;
/*
let tip: any = null;
let className = 'lc-valuestate';
let icon: any = null;
@ -193,6 +195,7 @@ function createValueState(valueState?: number, onClear?: (e: React.MouseEvent) =
{tip && <Tip>{tip}</Tip>}
</i>
);
*/
}
export interface PopupFieldProps extends FieldProps {

View File

@ -123,7 +123,7 @@
// background: var(--color-block-background-shallow, rgba(31,56,88,.06));
// border-bottom: 1px solid var(--color-line-normal);
// color: var(--color-title);
padding: 0 16px 0 10px;
padding: 0 16px;
background-color: #F7F9FC;
color: #8F9BB3;
user-select: none;

View File

@ -67,7 +67,7 @@ export class SettingsMain {
this.designer = nodes[0].document.designer;
}
this._settings = this.designer.createSettingEntry(this.editor, nodes);
this._settings = this.designer.createSettingEntry(nodes);
}
purge() {

View File

@ -143,6 +143,11 @@ body {
margin-bottom: 2px;
padding: 8px 12px 8px 16px;
.lc-top-area-left {
display: flex;
align-items: center;
}
.lc-top-area-center{
flex: 1;
display: flex;

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.25"></a>
## [0.8.25](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.24...@ali/lowcode-plugin-components-pane@0.8.25) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-components-pane
<a name="0.8.24"></a>
## [0.8.24](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.23...@ali/lowcode-plugin-components-pane@0.8.24) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-components-pane
<a name="0.8.23"></a>
## [0.8.23](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.22...@ali/lowcode-plugin-components-pane@0.8.23) (2020-06-16)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-components-pane",
"version": "0.8.23",
"version": "0.8.25",
"description": "alibaba lowcode editor component-list plugin",
"files": [
"es/",
@ -20,9 +20,9 @@
],
"author": "xiayang.xy",
"dependencies": {
"@ali/lowcode-designer": "^0.9.20",
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-types": "^0.8.6",
"@ali/lowcode-designer": "^0.9.23",
"@ali/lowcode-editor-core": "^0.8.19",
"@ali/lowcode-types": "^0.8.9",
"@ali/ve-component-list": "^1.1.1",
"@alifd/next": "^1.19.19",
"react": "^16.8.1"

View File

@ -3,6 +3,25 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.9.23"></a>
## [0.9.23](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.21...@ali/lowcode-plugin-designer@0.9.23) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-designer
<a name="0.9.21"></a>
## [0.9.21](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.20...@ali/lowcode-plugin-designer@0.9.21) (2020-06-23)
### Bug Fixes
* add extraEnv ([9058ac8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/9058ac8))
<a name="0.9.20"></a>
## [0.9.20](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.19...@ali/lowcode-plugin-designer@0.9.20) (2020-06-16)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-designer",
"version": "0.9.20",
"version": "0.9.23",
"description": "alibaba lowcode editor designer plugin",
"files": [
"es",
@ -20,8 +20,8 @@
],
"author": "xiayang.xy",
"dependencies": {
"@ali/lowcode-designer": "^0.9.20",
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-designer": "^0.9.23",
"@ali/lowcode-editor-core": "^0.8.19",
"react": "^16.8.1",
"react-dom": "^16.8.1"
},

View File

@ -10,6 +10,7 @@ export interface PluginProps {
interface DesignerPluginState {
componentMetadatas?: any[] | null;
library?: any[] | null;
extraEnvironment?: any[] | null;
}
export default class DesignerPlugin extends PureComponent<PluginProps, DesignerPluginState> {
@ -18,6 +19,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
state: DesignerPluginState = {
componentMetadatas: null,
library: null,
extraEnvironment: null,
};
private _mounted = true;
@ -33,10 +35,11 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
if (!this._mounted) {
return;
}
const { components, packages } = assets;
const { components, packages, extraEnvironment } = assets;
const state = {
componentMetadatas: components || [],
library: packages || [],
extraEnvironment,
};
this.setState(state);
};
@ -56,7 +59,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
render(): React.ReactNode {
const { editor } = this.props;
const { componentMetadatas, library } = this.state;
const { componentMetadatas, library, extraEnvironment } = this.state;
if (!library || !componentMetadatas) {
// TODO: use a Loading
@ -72,6 +75,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
componentMetadatas={componentMetadatas}
simulatorProps={{
library,
extraEnvironment,
}}
/>
);

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.18"></a>
## [0.8.18](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-event-bind-dialog@0.8.17...@ali/lowcode-plugin-event-bind-dialog@0.8.18) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-event-bind-dialog
<a name="0.8.17"></a>
## [0.8.17](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-event-bind-dialog@0.8.16...@ali/lowcode-plugin-event-bind-dialog@0.8.17) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-event-bind-dialog
<a name="0.8.16"></a>
## [0.8.16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-event-bind-dialog@0.8.15...@ali/lowcode-plugin-event-bind-dialog@0.8.16) (2020-06-15)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-event-bind-dialog",
"version": "0.8.16",
"version": "0.8.18",
"description": "alibaba lowcode editor event bind dialog plugin",
"files": [
"es",
@ -19,8 +19,8 @@
],
"author": "zude.hzd",
"dependencies": {
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-types": "^0.8.6",
"@ali/lowcode-editor-core": "^0.8.19",
"@ali/lowcode-types": "^0.8.9",
"@alifd/next": "^1.19.16",
"react": "^16.8.1",
"react-dom": "^16.8.1"

View File

@ -3,6 +3,25 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.29"></a>
## [0.8.29](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.27...@ali/lowcode-plugin-outline-pane@0.8.29) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-outline-pane
<a name="0.8.27"></a>
## [0.8.27](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.26...@ali/lowcode-plugin-outline-pane@0.8.27) (2020-06-23)
### Features
* 大纲树埋点 ([fa24821](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/fa24821))
<a name="0.8.26"></a>
## [0.8.26](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.25...@ali/lowcode-plugin-outline-pane@0.8.26) (2020-06-16)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-outline-pane",
"version": "0.8.26",
"version": "0.8.29",
"description": "Outline pane for Ali lowCode engine",
"files": [
"es",
@ -14,10 +14,10 @@
"test:snapshot": "ava --update-snapshots"
},
"dependencies": {
"@ali/lowcode-designer": "^0.9.20",
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-types": "^0.8.6",
"@ali/lowcode-utils": "^0.8.7",
"@ali/lowcode-designer": "^0.9.23",
"@ali/lowcode-editor-core": "^0.8.19",
"@ali/lowcode-types": "^0.8.9",
"@ali/lowcode-utils": "^0.8.10",
"@alifd/next": "^1.19.16",
"classnames": "^2.2.6",
"react": "^16",

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.17"></a>
## [0.8.17](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-logo@0.8.16...@ali/lowcode-plugin-sample-logo@0.8.17) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-sample-logo
<a name="0.8.16"></a>
## [0.8.16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-logo@0.8.15...@ali/lowcode-plugin-sample-logo@0.8.16) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-sample-logo
<a name="0.8.15"></a>
## [0.8.15](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-logo@0.8.14...@ali/lowcode-plugin-sample-logo@0.8.15) (2020-06-15)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-sample-logo",
"version": "0.8.15",
"version": "0.8.17",
"description": "alibaba lowcode editor logo plugin",
"files": [
"es/",
@ -20,7 +20,7 @@
],
"author": "xiayang.xy",
"dependencies": {
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-editor-core": "^0.8.19",
"react": "^16.8.1"
},
"devDependencies": {

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.27"></a>
## [0.8.27](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.26...@ali/lowcode-plugin-sample-preview@0.8.27) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-sample-preview
<a name="0.8.26"></a>
## [0.8.26](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.25...@ali/lowcode-plugin-sample-preview@0.8.26) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-sample-preview
<a name="0.8.25"></a>
## [0.8.25](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.24...@ali/lowcode-plugin-sample-preview@0.8.25) (2020-06-16)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-sample-preview",
"version": "0.8.25",
"version": "0.8.27",
"description": "alibaba lowcode editor sample preview plugin",
"files": [
"es",
@ -18,8 +18,8 @@
"editor"
],
"dependencies": {
"@ali/lowcode-designer": "^0.9.20",
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-designer": "^0.9.23",
"@ali/lowcode-editor-core": "^0.8.19",
"@alifd/next": "^1.x",
"react": "^16.8.1"
},

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.15"></a>
## [0.8.15](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-source-editor@0.8.14...@ali/lowcode-plugin-source-editor@0.8.15) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-source-editor
<a name="0.8.14"></a>
## [0.8.14](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-source-editor@0.8.13...@ali/lowcode-plugin-source-editor@0.8.14) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-source-editor
<a name="0.8.13"></a>
## [0.8.13](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-source-editor@0.8.12...@ali/lowcode-plugin-source-editor@0.8.13) (2020-06-15)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-source-editor",
"version": "0.8.13",
"version": "0.8.15",
"description": "alibaba lowcode editor source-editor plugin",
"files": [
"es",
@ -19,7 +19,7 @@
],
"author": "zude.hzd",
"dependencies": {
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-editor-core": "^0.8.19",
"@alifd/next": "^1.19.16",
"js-beautify": "^1.10.1",
"prettier": "^1.18.2",

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.27"></a>
## [0.8.27](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.26...@ali/lowcode-plugin-undo-redo@0.8.27) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-undo-redo
<a name="0.8.26"></a>
## [0.8.26](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.25...@ali/lowcode-plugin-undo-redo@0.8.26) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-undo-redo
<a name="0.8.25"></a>
## [0.8.25](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.24...@ali/lowcode-plugin-undo-redo@0.8.25) (2020-06-16)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-undo-redo",
"version": "0.8.25",
"version": "0.8.27",
"description": "alibaba lowcode editor undo redo plugin",
"files": [
"es",
@ -19,11 +19,11 @@
],
"author": "xiayang.xy",
"dependencies": {
"@ali/lowcode-designer": "^0.9.20",
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-editor-skeleton": "^0.8.26",
"@ali/lowcode-types": "^0.8.6",
"@ali/lowcode-utils": "^0.8.7",
"@ali/lowcode-designer": "^0.9.23",
"@ali/lowcode-editor-core": "^0.8.19",
"@ali/lowcode-editor-skeleton": "^0.8.29",
"@ali/lowcode-types": "^0.8.9",
"@ali/lowcode-utils": "^0.8.10",
"react": "^16.8.1",
"react-dom": "^16.8.1"
},

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.16"></a>
## [0.8.16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-variable-bind-dialog@0.8.15...@ali/lowcode-plugin-variable-bind-dialog@0.8.16) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-variable-bind-dialog
<a name="0.8.15"></a>
## [0.8.15](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-variable-bind-dialog@0.8.14...@ali/lowcode-plugin-variable-bind-dialog@0.8.15) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-variable-bind-dialog
<a name="0.8.14"></a>
## [0.8.14](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-variable-bind-dialog@0.8.13...@ali/lowcode-plugin-variable-bind-dialog@0.8.14) (2020-06-15)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-variable-bind-dialog",
"version": "0.8.14",
"version": "0.8.16",
"description": "alibaba lowcode editor variable bind dialog plugin",
"files": [
"es",
@ -19,7 +19,7 @@
],
"author": "zude.hzd",
"dependencies": {
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-editor-core": "^0.8.19",
"@alifd/next": "^1.19.16",
"react": "^16.8.1",
"react-dom": "^16.8.1"

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.20"></a>
## [0.8.20](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-zh-en@0.8.19...@ali/lowcode-plugin-zh-en@0.8.20) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-zh-en
<a name="0.8.19"></a>
## [0.8.19](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-zh-en@0.8.18...@ali/lowcode-plugin-zh-en@0.8.19) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-plugin-zh-en
<a name="0.8.18"></a>
## [0.8.18](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-zh-en@0.8.17...@ali/lowcode-plugin-zh-en@0.8.18) (2020-06-15)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-zh-en",
"version": "0.8.18",
"version": "0.8.20",
"description": "alibaba lowcode editor zhong english plugin",
"files": [
"es",
@ -14,9 +14,9 @@
"test:snapshot": "ava --update-snapshots"
},
"dependencies": {
"@ali/lowcode-editor-core": "^0.8.16",
"@ali/lowcode-types": "^0.8.6",
"@ali/lowcode-utils": "^0.8.7",
"@ali/lowcode-editor-core": "^0.8.19",
"@ali/lowcode-types": "^0.8.9",
"@ali/lowcode-utils": "^0.8.10",
"react": "^16.8.1",
"react-dom": "^16.8.1"
},

View File

@ -1,4 +1,20 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.14"></a>
## 0.8.14 (2020-06-23)
### Features
* **rax-provider:** init ([cb0f382](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/cb0f382))
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

View File

@ -1,6 +1,7 @@
{
"name": "@ali/lowcode-rax-provider",
"version": "0.8.14-beta.0",
"version": "0.8.14",
"private": true,
"description": "Rax Provider for Runtime",
"files": [
"es",
@ -9,16 +10,15 @@
"main": "lib/index.js",
"module": "es/index.js",
"scripts": {
"start": "build-scripts start",
"build": "build-scripts build"
"start": "build-scripts start"
},
"license": "MIT",
"dependencies": {
"@ali/lowcode-runtime": "^0.8.14-beta.0",
"rax": "1.1.2",
"@ali/lowcode-runtime": "^0.8.16",
"driver-universal": "^3.1.3",
"rax-use-router": "^3.0.0",
"history": "^4.10.1"
"history": "^4.10.1",
"rax": "1.1.2",
"rax-use-router": "^3.0.0"
},
"devDependencies": {
"@alib/build-scripts": "^0.1.18",

View File

@ -0,0 +1,28 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.1.2"></a>
## [0.1.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-engine-rax-renderer@0.1.1...@ali/lowcode-engine-rax-renderer@0.1.2) (2020-06-24)
### Bug Fixes
* div 不显示问题 ([1b6533c](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/1b6533c))
<a name="0.1.1"></a>
## 0.1.1 (2020-06-23)
### Bug Fixes
* 修复低代码组件设计器、区块设计器根节点为 Page 的问题,修复 topArea 样式 ([e85b542](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/e85b542))
### Features
* init rax-render ([7167767](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7167767))

View File

@ -1,6 +1,7 @@
{
"name": "@ali/lowcode-engine-rax-renderer",
"version": "0.1.0",
"version": "0.1.2",
"private": true,
"description": "Rax renderer for Ali lowCode engine",
"main": "lib/index.js",
"module": "lib/index.js",
@ -24,12 +25,11 @@
"npm": ">=3.0.0"
},
"peerDependencies": {
"rax": "^1.1.0",
"prop-types": "^15.7.2"
"prop-types": "^15.7.2",
"rax": "^1.1.0"
},
"scripts": {
"start": "build-scripts start",
"build": "build-scripts build",
"prepublish": "npm run build"
},
"dependencies": {

View File

@ -1,3 +1,27 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.16"></a>
## [0.8.16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-provider@0.8.15...@ali/lowcode-react-provider@0.8.16) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-react-provider
<a name="0.8.15"></a>
## 0.8.15 (2020-06-23)
### Features
* ReactProvider ([0e50a20](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/0e50a20))
# Change Log
All notable changes to this project will be documented in this file.

View File

@ -1,6 +1,7 @@
{
"name": "@ali/lowcode-react-provider",
"version": "0.8.14",
"version": "0.8.16",
"private": true,
"description": "React Provider for Runtime",
"files": [
"es",
@ -25,17 +26,17 @@
},
"license": "MIT",
"dependencies": {
"@ali/lowcode-runtime": "^0.8.13",
"@ali/lowcode-runtime": "^0.8.16",
"@recore/router": "^1.0.11",
"react": "^16",
"react-dom": "^16",
"@recore/router": "^1.0.11"
"react-dom": "^16"
},
"devDependencies": {
"@alib/build-scripts": "^0.1.18",
"build-plugin-component": "^0.2.16",
"@types/node": "^13.7.1",
"@types/react": "^16",
"@types/react-dom": "^16"
"@types/react-dom": "^16",
"build-plugin-component": "^0.2.16"
},
"publishConfig": {
"registry": "https://registry.npm.alibaba-inc.com"

View File

@ -3,6 +3,36 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.12"></a>
## [0.8.12](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-renderer@0.8.11...@ali/lowcode-react-renderer@0.8.12) (2020-06-24)
### Bug Fixes
* div 不显示问题 ([1b6533c](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/1b6533c))
<a name="0.8.11"></a>
## [0.8.11](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-renderer@0.8.9...@ali/lowcode-react-renderer@0.8.11) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-react-renderer
<a name="0.8.9"></a>
## [0.8.9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-renderer@0.8.8...@ali/lowcode-react-renderer@0.8.9) (2020-06-23)
### Bug Fixes
* 修复低代码组件设计器、区块设计器根节点为 Page 的问题,修复 topArea 样式 ([e85b542](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/e85b542))
<a name="0.8.8"></a>
## [0.8.8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-renderer@0.8.7...@ali/lowcode-react-renderer@0.8.8) (2020-05-15)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-react-renderer",
"version": "0.8.8",
"version": "0.8.12",
"description": "react renderer for ali lowcode engine",
"main": "lib/index.js",
"module": "es/index.js",

View File

@ -61,7 +61,7 @@ export default class BlockEngine extends BaseEngine {
render() {
const { __schema } = this.props;
if (!isSchema(__schema, true) || __schema.componentName !== 'Block') {
if (!isSchema(__schema, true) || (__schema.componentName !== 'Block' && __schema.componentName !== 'Div')) {
return '区块schema结构异常';
}

View File

@ -23,6 +23,7 @@ const ENGINE_COMPS = {
BlockEngine,
AddonEngine,
TempEngine,
// DivEngine: BlockEngine,
};
class FaultComponent extends PureComponent {

View File

@ -3,6 +3,35 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.29"></a>
## [0.8.29](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.28...@ali/lowcode-react-simulator-renderer@0.8.29) (2020-06-24)
**Note:** Version bump only for package @ali/lowcode-react-simulator-renderer
<a name="0.8.28"></a>
## [0.8.28](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.27...@ali/lowcode-react-simulator-renderer@0.8.28) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-react-simulator-renderer
<a name="0.8.27"></a>
## [0.8.27](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.26...@ali/lowcode-react-simulator-renderer@0.8.27) (2020-06-23)
### Bug Fixes
* cloneElement bug ([d5c5614](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/d5c5614))
* 支持事件 VE_EVENTS.VE_PAGE_PAGE_READY ([935ffad](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/935ffad))
* 简化 onPageReady 实现逻辑 ([a36e5f2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/a36e5f2))
<a name="0.8.26"></a>
## [0.8.26](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.25...@ali/lowcode-react-simulator-renderer@0.8.26) (2020-06-16)

View File

@ -1,7 +1,7 @@
{
"private": true,
"name": "@ali/lowcode-react-simulator-renderer",
"version": "0.8.26",
"version": "0.8.29",
"description": "react simulator renderer for alibaba lowcode designer",
"main": "lib/index.js",
"module": "es/index.js",
@ -13,10 +13,10 @@
"test:snapshot": "ava --update-snapshots"
},
"dependencies": {
"@ali/lowcode-designer": "^0.9.20",
"@ali/lowcode-react-renderer": "^0.8.0",
"@ali/lowcode-types": "^0.8.6",
"@ali/lowcode-utils": "^0.8.7",
"@ali/lowcode-designer": "^0.9.23",
"@ali/lowcode-react-renderer": "^0.8.12",
"@ali/lowcode-types": "^0.8.9",
"@ali/lowcode-utils": "^0.8.10",
"@ali/vu-css-style": "^1.0.2",
"@recore/obx": "^1.0.8",
"@recore/obx-react": "^1.0.7",

View File

@ -8,7 +8,7 @@ import './renderer.less';
// patch cloneElement avoid lost keyProps
const originCloneElement = window.React.cloneElement;
(window as any).React.cloneElement = (child: any, { _leaf, ...props }: any = {}) => {
(window as any).React.cloneElement = (child: any, { _leaf, ...props }: any = {}, ...rest: any[]) => {
if (child.ref && props.ref) {
const dRef = props.ref;
const cRef = child.ref;
@ -33,7 +33,7 @@ const originCloneElement = window.React.cloneElement;
}
};
}
return originCloneElement(child, props);
return originCloneElement(child, props, ...rest);
};
export default class SimulatorRendererView extends Component<{ renderer: SimulatorRenderer }> {
@ -107,6 +107,27 @@ class Renderer extends Component<{ renderer: SimulatorRenderer }> {
viewProps.componentId = __id;
const leaf = host.document.getNode(__id);
viewProps._leaf = leaf;
viewProps._componentName = leaf?.componentName;
if (viewProps._componentName === 'Menu') {
Object.assign(viewProps, {
_componentName: 'Menu',
className: '_css_pesudo_menu_kbrzyh0f',
context: { VE: (window as any).VisualEngine },
direction: undefined,
events: { ignored: true },
fieldId: 'menu_kbrzyh0f',
footer: '',
header: '',
mode: 'inline',
onItemClick: { ignored: true },
onSelect: { ignored: true },
popupAlign: 'follow',
selectMode: false,
triggerType: 'click',
});
console.info('menuprops', viewProps);
}
return createElement(
getDeviceView(Component, device, designMode),

View File

@ -17,10 +17,12 @@ import Leaf from './builtin-components/leaf';
export class SimulatorRenderer implements BuiltinSimulatorRenderer {
readonly isSimulatorRenderer = true;
private dispose?: () => void;
constructor() {
if (!host) {
return;
}
this.dispose = host.connect(this, () => {
// sync layout config
@ -286,6 +288,7 @@ export class SimulatorRenderer implements BuiltinSimulatorRenderer {
document.body.classList.add('engine-document'); // important! Stylesheet.invoke depends
reactRender(createElement(SimulatorRendererView, { renderer: this }), container);
host.document.setRendererReady(this);
}
}

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.16"></a>
## [0.8.16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-runtime@0.8.13...@ali/lowcode-runtime@0.8.16) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-runtime
<a name="0.8.13"></a>
## [0.8.13](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-runtime@0.8.10...@ali/lowcode-runtime@0.8.13) (2020-04-27)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-runtime",
"version": "0.8.15",
"version": "0.8.16",
"description": "Runtime for Ali lowCode engine",
"files": [
"es",

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.9"></a>
## [0.8.9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.7...@ali/lowcode-types@0.8.9) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-types
<a name="0.8.7"></a>
## [0.8.7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.6...@ali/lowcode-types@0.8.7) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-types
<a name="0.8.6"></a>
## [0.8.6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.5...@ali/lowcode-types@0.8.6) (2020-06-15)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-types",
"version": "0.8.6",
"version": "0.8.9",
"description": "Types for Ali lowCode engine",
"files": [
"es",

View File

@ -27,7 +27,7 @@ export interface JSBlock {
}
// JSON 基本类型
export type JSONValue = boolean | string | number | null | JSONArray | JSONObject;
export type JSONValue = boolean | string | number | null | undefined | JSONArray | JSONObject;
export type JSONArray = JSONValue[];
export interface JSONObject {
[key: string]: JSONValue;

View File

@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.8.10"></a>
## [0.8.10](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-utils@0.8.8...@ali/lowcode-utils@0.8.10) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-utils
<a name="0.8.8"></a>
## [0.8.8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-utils@0.8.7...@ali/lowcode-utils@0.8.8) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-utils
<a name="0.8.7"></a>
## [0.8.7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-utils@0.8.6...@ali/lowcode-utils@0.8.7) (2020-06-15)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-utils",
"version": "0.8.7",
"version": "0.8.10",
"description": "Utils for Ali lowCode engine",
"files": [
"es",
@ -14,7 +14,7 @@
"test:snapshot": "ava --update-snapshots"
},
"dependencies": {
"@ali/lowcode-types": "^0.8.6",
"@ali/lowcode-types": "^0.8.9",
"@alifd/next": "^1.19.16",
"react": "^16"
},