Merge branch 'feat/miniapp' into fix/rax

# Conflicts:
#	packages/code-generator/demo/demo.js
#	packages/code-generator/src/index.ts
#	packages/code-generator/src/utils/nodeToJSX.ts
#	packages/demo/src/editor/components.ts
#	packages/designer/src/builtin-simulator/host.ts
#	packages/designer/src/designer/setting/utils.js
#	packages/designer/src/document/document-model.ts
#	packages/designer/src/project/project.ts
#	packages/editor-setters/src/index.tsx
#	packages/editor-skeleton/src/transducers/addon-combine.ts
#	packages/plugin-sample-preview/package.json
#	packages/react-renderer/package.json
#	packages/react-renderer/src/engine/index.jsx
#	packages/react-renderer/src/renderer/page.jsx
#	packages/react-simulator-renderer/src/renderer-view.tsx
#	packages/react-simulator-renderer/src/renderer.ts
This commit is contained in:
rorya.lyj 2020-08-14 11:20:21 +08:00
commit 91e8d6956a
51 changed files with 945 additions and 138 deletions

View File

@ -3,6 +3,46 @@
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.52"></a>
## [0.8.52](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.51...@ali/lowcode-demo@0.8.52) (2020-08-14)
**Note:** Version bump only for package @ali/lowcode-demo
<a name="0.8.51"></a>
## [0.8.51](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.50...@ali/lowcode-demo@0.8.51) (2020-08-07)
**Note:** Version bump only for package @ali/lowcode-demo
<a name="0.8.50"></a>
## [0.8.50](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.49...@ali/lowcode-demo@0.8.50) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-demo
<a name="0.8.49"></a>
## [0.8.49](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.48...@ali/lowcode-demo@0.8.49) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-demo
<a name="0.8.48"></a>
## [0.8.48](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.47...@ali/lowcode-demo@0.8.48) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-demo
<a name="0.8.47"></a>
## [0.8.47](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.46...@ali/lowcode-demo@0.8.47) (2020-08-04)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-demo",
"version": "0.8.47",
"version": "0.8.52",
"private": true,
"description": "低代码引擎 DEMO",
"scripts": {
@ -10,18 +10,18 @@
"config": {},
"dependencies": {
"@ali/lowcode-editor-core": "^0.8.28",
"@ali/lowcode-editor-skeleton": "^0.8.43",
"@ali/lowcode-plugin-components-pane": "^0.8.39",
"@ali/lowcode-plugin-designer": "^0.9.37",
"@ali/lowcode-editor-skeleton": "^0.8.48",
"@ali/lowcode-plugin-components-pane": "^0.8.44",
"@ali/lowcode-plugin-designer": "^0.9.42",
"@ali/lowcode-plugin-event-bind-dialog": "^0.8.27",
"@ali/lowcode-plugin-outline-pane": "^0.8.43",
"@ali/lowcode-plugin-outline-pane": "^0.8.48",
"@ali/lowcode-plugin-sample-logo": "^0.8.26",
"@ali/lowcode-plugin-sample-preview": "^0.8.41",
"@ali/lowcode-plugin-sample-preview": "^0.8.46",
"@ali/lowcode-plugin-settings-pane": "^0.8.8",
"@ali/lowcode-plugin-undo-redo": "^0.8.41",
"@ali/lowcode-plugin-undo-redo": "^0.8.46",
"@ali/lowcode-plugin-variable-bind-dialog": "^0.8.25",
"@ali/lowcode-plugin-zh-en": "^0.8.29",
"@ali/lowcode-react-renderer": "^0.8.17",
"@ali/lowcode-react-renderer": "^0.8.18",
"@ali/lowcode-runtime": "^0.8.16",
"@ali/lowcode-utils": "^0.8.16",
"@ali/ve-action-pane": "^4.7.0-beta.0",

View File

@ -3,6 +3,73 @@
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.42"></a>
## [0.9.42](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@0.9.41...@ali/lowcode-designer@0.9.42) (2020-08-14)
### Bug Fixes
* createComponent 支持所有 schema ([7f946f5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7f946f5))
* 不对外暴露 Node ([05957ce](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/05957ce))
* 卡片内容不可用拖动 ([6a85c43](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/6a85c43))
* 处理选区的 toolkit 位置不对的 bug ([bfc63db](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/bfc63db))
* 快捷键增加判断 ([0f64829](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/0f64829))
* 快捷键增加判断 ([e18a231](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/e18a231))
* 组件缺失占位 ([aff2f34](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/aff2f34))
### Features
* 导出的schema增加componentsMap ([dbc958c](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/dbc958c))
<a name="0.9.41"></a>
## [0.9.41](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@0.9.40...@ali/lowcode-designer@0.9.41) (2020-08-07)
### Bug Fixes
* canDropIn 为 boolean 时失效 ([7508fb6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7508fb6))
<a name="0.9.40"></a>
## [0.9.40](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@0.9.39...@ali/lowcode-designer@0.9.40) (2020-08-06)
### Bug Fixes
* fieldId 重复问题 ([e761b1a](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/e761b1a))
<a name="0.9.39"></a>
## [0.9.39](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@0.9.38...@ali/lowcode-designer@0.9.39) (2020-08-06)
### Bug Fixes
* 增加兼容 API ([2960446](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/2960446))
* 复制之后 fieldId 重复 ([36621ea](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/36621ea))
<a name="0.9.38"></a>
## [0.9.38](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@0.9.37...@ali/lowcode-designer@0.9.38) (2020-08-06)
### Bug Fixes
* 修复 preset-vision 版本 lifeCycles 丢失以及 slot 初始化问题 ([7cf6d24](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7cf6d24))
<a name="0.9.37"></a>
## [0.9.37](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@0.9.36...@ali/lowcode-designer@0.9.37) (2020-08-04)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-designer",
"version": "0.9.37",
"version": "0.9.42",
"description": "Designer for Ali LowCode Engine",
"main": "lib/index.js",
"module": "es/index.js",

View File

@ -66,7 +66,9 @@ class Toolbar extends Component<{ observed: OffsetObserver }> {
const MARGIN = 1;
const BORDER = 2;
const SPACE_HEIGHT = BAR_HEIGHT + MARGIN + BORDER;
const SPACE_MINIMUM_WIDTH = 140; // magic number
let style: any;
// 计算 toolbar 的上/下位置
if (observed.top > SPACE_HEIGHT) {
style = {
top: -SPACE_HEIGHT,
@ -83,10 +85,12 @@ class Toolbar extends Component<{ observed: OffsetObserver }> {
top: Math.max(MARGIN, MARGIN - observed.top),
};
}
if (observed.width < 140) {
// 计算 toolbar 的左/右位置
if (SPACE_MINIMUM_WIDTH > observed.left + observed.width) {
style.left = Math.max(-BORDER, observed.left - width - BORDER);
} else {
style.right = Math.max(-BORDER, observed.right - width - BORDER);
style.justifyContent = 'flex-start';
}
const { node } = observed;
const actions: ReactNodeArray = [];

View File

@ -31,7 +31,7 @@ import {
CanvasPoint,
} from '../designer';
import { parseMetadata } from './utils/parse-metadata';
import { ComponentMetadata, ComponentSchema } from '@ali/lowcode-types';
import { ComponentMetadata, NodeSchema } from '@ali/lowcode-types';
import { BuiltinSimulatorRenderer } from './renderer';
import clipboard from '../designer/clipboard';
import { LiveEditing } from './live-editing/live-editing';
@ -302,6 +302,11 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
const nodeInst = this.getNodeInstanceFromElement(downEvent.target as Element);
const node = nodeInst?.node || this.document.rootNode;
if (!node?.isValidComponent()) {
// 对于未注册组件直接返回
return;
}
const isMulti = downEvent.metaKey || downEvent.ctrlKey;
const isLeftButton = downEvent.which === 1 || downEvent.button === 0;
const checkSelect = (e: MouseEvent) => {
@ -537,7 +542,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
return this.renderer?.getComponent(componentName) || null;
}
createComponent(schema: ComponentSchema): Component | null {
createComponent(schema: NodeSchema): Component | null {
return this.renderer?.createComponent(schema) || null;
}
@ -834,20 +839,35 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
this.scroller.cancel();
}
// ========= drag location logic: hepler for locate ==========
// ========= drag location logic: helper for locate ==========
/**
* @see ISensor
*/
locate(e: LocateEvent): any {
const { dragObject } = e;
const { nodes } = dragObject;
const operationalNodes = nodes?.filter((node: any) => {
const onMoveHook = node.componentMeta?.getMetadata()?.experimental?.callbacks?.onMoveHook;
const canMove = onMoveHook && typeof onMoveHook === 'function' ? onMoveHook() : true;
return canMove;
});
if (!operationalNodes || operationalNodes.length === 0) {
return;
}
this.sensing = true;
this.scroller.scrolling(e);
const dropContainer = this.getDropContainer(e);
const canDropIn = dropContainer?.container?.componentMeta?.prototype?.options?.canDropIn;
if (
!dropContainer ||
canDropIn === false ||
// too dirty
(typeof dropContainer.container?.componentMeta?.prototype?.options?.canDropIn === 'function' &&
!dropContainer.container?.componentMeta?.prototype?.options?.canDropIn(e.dragObject.nodes[0]))
(typeof canDropIn === 'function' && !canDropIn(operationalNodes[0]))
) {
return null;
}
@ -879,7 +899,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
event: e,
};
if (e.dragObject.type === 'node' && e.dragObject.nodes[0]?.getPrototype()?.isModal()) {
if (dragObject.type === 'node' && operationalNodes[0]?.getPrototype()?.isModal()) {
return this.designer.createLocation({
target: this.document.rootNode,
detail: {

View File

@ -1,9 +1,9 @@
import { ComponentInstance, NodeInstance, Component } from '../simulator';
import { ComponentSchema } from '@ali/lowcode-types';
import { NodeSchema } from '@ali/lowcode-types';
export interface BuiltinSimulatorRenderer {
readonly isSimulatorRenderer: true;
createComponent(schema: ComponentSchema): Component | null;
createComponent(schema: NodeSchema): Component | null;
getComponent(componentName: string): Component;
getComponentInstances(id: string): ComponentInstance[] | null;
getClosestNodeInstance(from: ComponentInstance, nodeId?: string): NodeInstance<ComponentInstance> | null;

View File

@ -137,13 +137,13 @@ export class ComponentMeta {
}
}
private parseMetadata(metadta: ComponentMetadata) {
const { componentName, npm } = metadta;
private parseMetadata(metadata: ComponentMetadata) {
const { componentName, npm } = metadata;
this._npm = npm;
this._componentName = componentName;
// 额外转换逻辑
this._transformedMetadata = this.transformMetadata(metadta);
this._transformedMetadata = this.transformMetadata(metadata);
const title = this._transformedMetadata.title;
if (title) {
@ -383,7 +383,10 @@ const builtinComponentActions: ComponentAction[] = [
action(node: Node) {
// node.remove();
const { document: doc, parent, index } = node;
parent && doc.insertNode(parent, node, index, true);
if (parent) {
const newNode = doc.insertNode(parent, node, index + 1, true);
newNode.select();
}
},
},
important: true,

View File

@ -77,7 +77,9 @@ hotkey.bind(['backspace', 'del'], (e: KeyboardEvent) => {
const topItems = sel.getTopNodes();
// TODO: check can remove
topItems.forEach((node) => {
doc.removeNode(node);
if (node.canPerformAction('remove')) {
doc.removeNode(node);
}
});
sel.clear();
});
@ -102,8 +104,13 @@ hotkey.bind(['command+c', 'ctrl+c', 'command+x', 'ctrl+x'], (e, action) => {
}
e.preventDefault();
const selected = doc.selection.getTopNodes(true);
if (!selected || selected.length < 1) return;
let selected = doc.selection.getTopNodes(true);
selected = selected.filter((node) => {
return node.canPerformAction('copy');
})
if (!selected || selected.length < 1) {
return;
}
const componentsMap = {};
const componentsTree = selected.map((item) => item.export(TransformStage.Clone));

View File

@ -20,6 +20,15 @@ export type GetDataType<T, NodeType> = T extends undefined
: any
: T;
export interface ComponentMap {
componentName: string;
package: string;
version?: string;
destructuring?: boolean;
exportName?: string;
subName?: string;
}
export class DocumentModel {
/**
* Page/Component/Block
@ -301,8 +310,11 @@ export class DocumentModel {
}
import(schema: RootSchema, checkId = false) {
// TODO: do purge
this.nodes.forEach(node => {
this.destroyNode(node);
});
this.rootNode.import(schema as any, checkId);
// todo: purge something
// todo: select added and active track added
}
@ -493,9 +505,13 @@ export class DocumentModel {
}
// add toData
toData() {
toData(extraComps?: string[]) {
const node = this.project?.currentDocument?.export(TransformStage.Save);
return { componentsTree: [node] };
const data = {
componentsMap: this.getComponentsMap(extraComps),
componentsTree: [node],
};
return data;
}
getHistory(): History {
@ -564,6 +580,37 @@ export class DocumentModel {
return this.rootNodeVisitorMap[name];
}
getComponentsMap(extraComps?: string[]) {
const componentsMap: ComponentMap[] = [];
// 组件去重
const map: any = {};
for (let node of this.nodesMap.values()) {
const { componentName } = node || {};
if (!map[componentName] && node?.componentMeta?.npm?.package) {
map[componentName] = true;
componentsMap.push({
componentName,
package: node?.componentMeta?.npm?.package,
});
}
}
// 合并外界传入的自定义渲染的组件
if (Array.isArray(extraComps)) {
extraComps.forEach(c => {
if (c && !map[c]) {
const m = this.getComponentMeta(c);
if (m && m.npm?.package) {
componentsMap.push({
componentName: c,
package: m.npm?.package,
});
}
}
});
}
return componentsMap;
}
onNodeCreate(func: (node: Node) => void) {
this.emitter.on('nodecreate', func);
return () => {
@ -584,6 +631,13 @@ export class DocumentModel {
refresh() {
console.warn('refresh method is deprecated');
}
/**
* @deprecated
*/
onRefresh(func: () => void) {
console.warn('onRefresh method is deprecated');
}
}
export function isDocumentModel(obj: any): obj is DocumentModel {

View File

@ -87,7 +87,7 @@ export class NodeChildren {
return this.size > 0;
}
@computed length() {
@computed get length(): number {
return this.children.length;
}

View File

@ -653,6 +653,16 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
slotNode.internalSetParent(this as ParentalNode, true);
this._slots.push(slotNode);
}
/**
* node对应组件是否已注册可用
*/
isValidComponent() {
const allComponents = this.document?.designer?.componentsMap;
if (allComponents && allComponents[this.componentName]) {
return true;
}
return false;
}
/**
*
@ -692,6 +702,14 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
this.document.destroyNode(this);
}
/**
* action
*/
canPerformAction(action: string): boolean {
const availableActions = this.componentMeta?.availableActions?.map((action) => action.name) || [];
return availableActions.indexOf(action) >= 0;
}
// ======= compatible apis ====
isEmpty(): boolean {
return this.children ? this.children.isEmpty() : true;
@ -702,6 +720,7 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
getComponentName() {
return this.componentName;
}
insertBefore(node: Node, ref?: Node, useMutator = true) {
this.children?.insert(node, ref ? ref.index : null, useMutator);
}
@ -855,10 +874,20 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
return this.document.simulator?.computeRect(this) || null;
}
/**
* @deprecated
*/
getPrototype() {
return this.componentMeta.prototype;
}
/**
* @deprecated
*/
setPrototype(proto: any) {
this.componentMeta.prototype = proto;
}
getIcon() {
return this.icon;
}

View File

@ -71,6 +71,10 @@ export class Prop implements IPropParent {
}
if (type === 'literal' || type === 'expression') {
// TODO 后端改造之后删除此逻辑
if (this._value === null && stage === TransformStage.Save) {
return '';
}
return this._value;
}
@ -181,7 +185,7 @@ export class Prop implements IPropParent {
this._code = null;
const t = typeof val;
if (val == null) {
this._value = undefined;
// this._value = undefined;
this._type = 'literal';
} else if (t === 'string' || t === 'number' || t === 'boolean') {
this._type = 'literal';

View File

@ -1,5 +1,5 @@
import { Component as ReactComponent, ComponentType } from 'react';
import { ComponentMetadata, ComponentSchema } from '@ali/lowcode-types';
import { ComponentMetadata, NodeSchema } from '@ali/lowcode-types';
import { ISensor, Point, ScrollTarget, IScrollable } from './designer';
import { Node } from './document';
@ -127,9 +127,9 @@ export interface ISimulatorHost<P = object> extends ISensor {
*/
getComponentInstances(node: Node): ComponentInstance[] | null;
/**
* schema
* schema
*/
createComponent(schema: ComponentSchema): Component | null;
createComponent(schema: NodeSchema): Component | null;
/**
*
*/

View File

@ -3,6 +3,46 @@
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.27"></a>
## [0.9.27](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.26...@ali/lowcode-editor-preset-general@0.9.27) (2020-08-14)
**Note:** Version bump only for package @ali/lowcode-editor-preset-general
<a name="0.9.26"></a>
## [0.9.26](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.25...@ali/lowcode-editor-preset-general@0.9.26) (2020-08-07)
**Note:** Version bump only for package @ali/lowcode-editor-preset-general
<a name="0.9.25"></a>
## [0.9.25](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.24...@ali/lowcode-editor-preset-general@0.9.25) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-editor-preset-general
<a name="0.9.24"></a>
## [0.9.24](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.23...@ali/lowcode-editor-preset-general@0.9.24) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-editor-preset-general
<a name="0.9.23"></a>
## [0.9.23](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.22...@ali/lowcode-editor-preset-general@0.9.23) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-editor-preset-general
<a name="0.9.22"></a>
## [0.9.22](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.21...@ali/lowcode-editor-preset-general@0.9.22) (2020-08-04)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-editor-preset-general",
"version": "0.9.22",
"version": "0.9.27",
"private": true,
"description": "Ali General Editor Preset",
"main": "lib/index.js",
@ -16,9 +16,9 @@
"license": "MIT",
"dependencies": {
"@ali/lowcode-editor-core": "^0.8.28",
"@ali/lowcode-editor-skeleton": "^0.8.43",
"@ali/lowcode-plugin-designer": "^0.9.37",
"@ali/lowcode-plugin-outline-pane": "^0.8.43",
"@ali/lowcode-editor-skeleton": "^0.8.48",
"@ali/lowcode-plugin-designer": "^0.9.42",
"@ali/lowcode-plugin-outline-pane": "^0.8.48",
"@ali/lowcode-types": "^0.8.14",
"@ali/lowcode-utils": "^0.8.16",
"@alifd/next": "^1.19.12",

View File

@ -3,6 +3,67 @@
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.43"></a>
## [0.8.43](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.42...@ali/lowcode-editor-preset-vision@0.8.43) (2020-08-14)
### Bug Fixes
* createComponent 支持所有 schema ([7f946f5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7f946f5))
* upgradePropsReducer ([e68977f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/e68977f))
* vision 大包 window 指向问题 ([aa1b526](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/aa1b526))
* 不对外暴露 Node ([05957ce](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/05957ce))
* 支持 AC 组件 ([c287bad](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/c287bad))
<a name="0.8.42"></a>
## [0.8.42](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.41...@ali/lowcode-editor-preset-vision@0.8.42) (2020-08-07)
### Bug Fixes
* vision API 兼容 DockPane.getDocks() ([f72fb66](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/f72fb66))
<a name="0.8.41"></a>
## [0.8.41](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.40...@ali/lowcode-editor-preset-vision@0.8.41) (2020-08-06)
### Bug Fixes
* fieldId 重复问题 ([e761b1a](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/e761b1a))
<a name="0.8.40"></a>
## [0.8.40](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.39...@ali/lowcode-editor-preset-vision@0.8.40) (2020-08-06)
### Bug Fixes
* 保存区块按钮渲染异常 ([33a7227](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/33a7227))
* 增加兼容 API ([2960446](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/2960446))
<a name="0.8.39"></a>
## [0.8.39](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.38...@ali/lowcode-editor-preset-vision@0.8.39) (2020-08-06)
### Bug Fixes
* 修复 preset-vision 版本 lifeCycles 丢失以及 slot 初始化问题 ([7cf6d24](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7cf6d24))
* 框架样式调整 ([58790c5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/58790c5))
<a name="0.8.38"></a>
## [0.8.38](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.37...@ali/lowcode-editor-preset-vision@0.8.38) (2020-08-04)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-editor-preset-vision",
"version": "0.8.38",
"version": "0.8.43",
"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.37",
"@ali/lowcode-designer": "^0.9.42",
"@ali/lowcode-editor-core": "^0.8.28",
"@ali/lowcode-editor-skeleton": "^0.8.43",
"@ali/lowcode-plugin-designer": "^0.9.37",
"@ali/lowcode-plugin-outline-pane": "^0.8.43",
"@ali/lowcode-editor-skeleton": "^0.8.48",
"@ali/lowcode-plugin-designer": "^0.9.42",
"@ali/lowcode-plugin-outline-pane": "^0.8.48",
"@ali/ve-i18n-util": "^2.0.0",
"@ali/ve-icons": "^4.1.9",
"@ali/ve-less-variables": "2.0.3",

View File

@ -2,6 +2,7 @@ import lg from '@ali/vu-logger';
import { ComponentClass, ComponentType } from 'react';
import Prototype, { isPrototype } from './prototype';
import { designer } from '../editor';
import trunk from './trunk';
function basename(name: string) {
return name ? (/[^\/]+$/.exec(name) || [''])[0] : '';
@ -65,6 +66,22 @@ export default class Bundle {
this.recursivelyRegisterPrototypes(prototype, item);
}
});
// invoke prototype mocker while the prototype does not exist
Object.keys(this.viewsMap).forEach((viewName) => {
const test = this;
// console.log(test, viewName);
if (!this.prototypeList.find((proto) => proto.getComponentName() === viewName)) {
const mockedPrototype = trunk.mockComponentPrototype(this.viewsMap[viewName]);
if (mockedPrototype) {
mockedPrototype.setView(this.viewsMap[viewName]);
this.registerPrototype(mockedPrototype);
if (!mockedPrototype.getPackageName()) {
mockedPrototype.setPackageName((this.viewsMap[viewName] as any)._packageName_);
}
}
}
});
}
getFromMeta(componentName: string): Prototype {
@ -148,7 +165,7 @@ export default class Bundle {
}
if (isPrototype(proto)) {
const componentName = proto.getComponentName()!;
if (!proto.getView() && this.viewsMap[componentName]) {
if (this.viewsMap[componentName]) {
proto.setView(this.viewsMap[componentName]);
}
if (cp.name && !proto.getPackageName()) {

View File

@ -213,8 +213,8 @@ class Prototype {
static addGlobalExtraActions = addGlobalExtraActions;
static removeGlobalPropsConfigure = removeGlobalPropsConfigure;
static overridePropsConfigure = overridePropsConfigure;
static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) {
return new Prototype(config, lookup);
static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, extraConfigs: any = null, lookup: boolean = false) {
return new Prototype(config, extraConfigs, lookup);
}
readonly isPrototype = true;
@ -224,7 +224,7 @@ class Prototype {
return this.meta.npm?.package;
}
constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) {
constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, extraConfigs: any = null, lookup: boolean = false) {
if (lookup) {
this.meta = designer.getComponentMeta(input.componentName);
this.options = this.meta.getMetadata();
@ -279,15 +279,15 @@ class Prototype {
private category?: string;
getCategory() {
if (this.category != null) {
return this.category;
if (this.options.category != null) {
return this.options.category;
}
return this.meta.getMetadata().tags?.[0] || '*';
}
setCategory(category: string) {
this.category = category;
this.options.category = category;
}
getIcon() {

View File

@ -3,11 +3,13 @@ import { EventEmitter } from 'events';
import { registerSetter, RegisteredSetter, getSetter } from '@ali/lowcode-editor-core';
import Bundle from './bundle';
import { CustomView } from '@ali/lowcode-types';
import Prototype from './prototype';
export class Trunk {
private trunk: any[] = [];
private emitter: EventEmitter = new EventEmitter();
private metaBundle = new Bundle();
private componentPrototypeMocker: any;
isReady() {
return this.getList().length > 0;
@ -25,7 +27,13 @@ export class Trunk {
getList(): any[] {
const list = this.trunk.reduceRight((prev, cur) => prev.concat(cur.getList()), []);
return Array.from(new Set(list));
const result: Prototype[] = [];
list.forEach((item: Prototype) => {
if (!result.find(r => r.options.componentName === item.options.componentName)) {
result.push(item);
}
});
return result;
}
getPrototype(name: string) {
@ -98,8 +106,16 @@ export class Trunk {
console.warn('Trunk.afterLoadBundle is deprecated');
}
registerComponentPrototypeMocker() {
console.warn('Trunk.registerComponentPrototypeMocker is deprecated');
registerComponentPrototypeMocker(mocker: any) {
this.componentPrototypeMocker = mocker;
}
mockComponentPrototype(bundle: any) {
if (!this.componentPrototypeMocker) {
lg.error('ERROR: no component prototypeMocker is set');
}
return this.componentPrototypeMocker
&& this.componentPrototypeMocker.mockPrototype(bundle);
}
setPackages() {
@ -113,6 +129,10 @@ export class Trunk {
}
return setter;
}
getRecents(limit: number) {
return this.getList().filter((prototype) => prototype.getCategory()).slice(0, limit);
}
}
export default new Trunk();

View File

@ -564,7 +564,7 @@ export function upgradeActions(actions?: Array<ComponentType<any> | ReactElement
if (typeof content === 'function') {
const fn = content as () => ReactElement;
content = (({ node }: any) => {
fn.call(node);
return fn.call(node);
}) as any;
}
return {

View File

@ -1,7 +1,7 @@
import { isJSBlock, isJSExpression, isJSSlot, isI18nData } from '@ali/lowcode-types';
import { isPlainObject, hasOwnProperty } from '@ali/lowcode-utils';
import { globalContext, Editor } from '@ali/lowcode-editor-core';
import { Designer, LiveEditing, TransformStage, Node } from '@ali/lowcode-designer';
import { Designer, LiveEditing, TransformStage, Node, getConvertedExtraKey } from '@ali/lowcode-designer';
import Outline, { OutlineBackupPane, getTreeMaster } from '@ali/lowcode-plugin-outline-pane';
import { toCss } from '@ali/vu-css-style';
import logger from '@ali/vu-logger';
@ -25,10 +25,17 @@ export const designer = new Designer({ editor: editor });
editor.set(Designer, designer);
editor.set('designer', designer);
const nodeCache: any = {};
designer.project.onCurrentDocumentChange((doc) => {
doc.onRendererReady(() => {
bus.emit(VE_EVENTS.VE_PAGE_PAGE_READY);
});
doc.onNodeCreate((node) => {
nodeCache[node.id] = node;
});
doc.onNodeDestroy((node) => {
delete nodeCache[node.id];
});
});
interface Variable {
@ -42,49 +49,61 @@ function isVariable(obj: any): obj is Variable {
}
function upgradePropsReducer(props: any) {
if (!isPlainObject(props)) {
if (!props || !isPlainObject(props)) {
return props;
}
if (isJSBlock(props)) {
if (props.value.componentName === 'Slot') {
return {
type: 'JSSlot',
title: (props.value.props as any)?.slotTitle,
name: (props.value.props as any)?.slotName,
value: props.value.children,
};
} else {
return props.value;
}
}
if (isVariable(props)) {
return {
type: 'JSExpression',
value: props.variable,
mock: props.value,
};
}
const newProps: any = {};
Object.entries<any>(props).forEach(([key, val]) => {
if (/^__slot__/.test(key) && val === true) {
Object.keys(props).forEach(key => {
if (/^__slot__/.test(key) && props[key] === true) {
return;
}
if (isJSBlock(val)) {
if (val.value.componentName === 'Slot') {
val = {
type: 'JSSlot',
title: (val.value.props as any)?.slotTitle,
name: (val.value.props as any)?.slotName,
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;
newProps[key] = upgradePropsReducer(props[key]);
});
return newProps;
}
// 升级 Props
designer.addPropsReducer(upgradePropsReducer, TransformStage.Upgrade);
// 节点 props 初始化
designer.addPropsReducer((props, node) => {
// run initials
const newProps: any = {
...props,
};
if (newProps.fieldId) {
const fieldIds: any = [];
Object.keys(nodeCache).forEach(nodeId => {
const fieldId = nodeCache[nodeId].getPropValue('fieldId');
if (fieldId) {
fieldIds.push(fieldId);
}
});
if (fieldIds.indexOf(props.fieldId) >= 0) {
newProps.fieldId = undefined;
}
}
const initials = node.componentMeta.getMetadata().experimental?.initials;
if (initials) {
const newProps: any = {
...props,
};
const getRealValue = (propValue: any) => {
if (isVariable(propValue)) {
return propValue.value;
@ -98,22 +117,10 @@ designer.addPropsReducer((props, node) => {
// FIXME! this implements SettingTarget
try {
// FIXME! item.name could be 'xxx.xxx'
const ov = props[item.name];
const ov = newProps[item.name];
const v = item.initial(node as any, getRealValue(ov));
if (!ov && v !== undefined) {
if (isVariable(ov)) {
newProps[item.name] = {
...ov,
value: v,
};
} else if (isJSExpression(ov)) {
newProps[item.name] = {
...ov,
mock: v,
};
} else {
newProps[item.name] = v;
}
if (ov === undefined && v !== undefined) {
newProps[item.name] = v;
}
} catch (e) {
if (hasOwnProperty(props, item.name)) {
@ -124,11 +131,19 @@ designer.addPropsReducer((props, node) => {
node.props.add(newProps[item.name], item.name);
}
});
}
return newProps;
}, TransformStage.Init);
return newProps;
designer.addPropsReducer((props: any, node: Node) => {
if (node.isRoot() && props && props.lifeCycles) {
return {
...props,
lifeCycles: {},
}
}
return props;
}, TransformStage.Init);
}, TransformStage.Render);
function filterReducer(props: any, node: Node): any {
const filters = node.componentMeta.getMetadata().experimental?.filters;
@ -188,6 +203,20 @@ function compatiableReducer(props: any) {
}
// FIXME: Dirty fix, will remove this reducer
designer.addPropsReducer(compatiableReducer, TransformStage.Save);
// 兼容历史版本的 Page 组件
designer.addPropsReducer((props: any, node: Node) => {
const lifeCycleNames = ['didMount', 'willUnmount'];
if (node.isRoot()) {
lifeCycleNames.forEach(key => {
if (props[key]) {
const lifeCycles = node.props.getPropValue(getConvertedExtraKey('lifeCycles')) || {};
lifeCycles[key] = props[key];
node.props.setPropValue(getConvertedExtraKey('lifeCycles'), lifeCycles);
}
});
}
return props;
}, TransformStage.Save);
// 设计器组件样式处理
function stylePropsReducer(props: any, node: any) {

View File

@ -163,7 +163,7 @@ export {
Symbols,
};
const version = '6.0.0(LowcodeEngine 0.9.0-beta)';
const version = '6.0.0(LowcodeEngine 0.9.3)';
console.log(
`%c VisionEngine %c v${version} `,

View File

@ -43,7 +43,6 @@ const pages = Object.assign(project, {
// FIXME
if (componentsTree[0].componentName === 'Page' ||
componentsTree[0].componentName === 'Component') {
componentsTree[0].lifeCycles = {};
componentsTree[0].methods = {};
}
}

View File

@ -161,6 +161,9 @@ const actionPane = Object.assign(skeleton.topArea, {
setActions() {
// empty
},
get actions() {
return skeleton.topArea.container.items;
},
});
const dockPane = Object.assign(skeleton.leftArea, {
/**
@ -210,6 +213,9 @@ const dockPane = Object.assign(skeleton.leftArea, {
setFixed(flag: boolean) {
// todo:
},
getDocks() {
return skeleton.leftFloatArea?.container.items;
},
});
const tabPane = Object.assign(skeleton.rightArea, {
setFloat(flag: boolean) {

View File

@ -49,7 +49,7 @@ html.engine-blur #engine {
.engine-main {
width: 100%;
height: 100%;
position: relative;
position: fixed;
.ve-icon-button {
> .ve-icon-contents {
@ -121,4 +121,4 @@ html.engine-preview-mode {
align-items: center;
line-height: 22px;
}
}
}

View File

@ -3,6 +3,52 @@
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.48"></a>
## [0.8.48](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.47...@ali/lowcode-editor-skeleton@0.8.48) (2020-08-14)
### Bug Fixes
* remove console ([6889123](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/6889123))
* setter 报错不影响页面渲染 ([c0a6022](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/c0a6022))
* vision 大包 window 指向问题 ([aa1b526](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/aa1b526))
* 钉住行为调整 ([91a390e](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/91a390e))
<a name="0.8.47"></a>
## [0.8.47](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.46...@ali/lowcode-editor-skeleton@0.8.47) (2020-08-07)
**Note:** Version bump only for package @ali/lowcode-editor-skeleton
<a name="0.8.46"></a>
## [0.8.46](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.45...@ali/lowcode-editor-skeleton@0.8.46) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-editor-skeleton
<a name="0.8.45"></a>
## [0.8.45](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.44...@ali/lowcode-editor-skeleton@0.8.45) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-editor-skeleton
<a name="0.8.44"></a>
## [0.8.44](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.43...@ali/lowcode-editor-skeleton@0.8.44) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-editor-skeleton
<a name="0.8.43"></a>
## [0.8.43](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.42...@ali/lowcode-editor-skeleton@0.8.43) (2020-08-04)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-editor-skeleton",
"version": "0.8.43",
"version": "0.8.48",
"description": "alibaba lowcode editor skeleton",
"main": "lib/index.js",
"module": "es/index.js",
@ -19,7 +19,7 @@
"editor"
],
"dependencies": {
"@ali/lowcode-designer": "^0.9.37",
"@ali/lowcode-designer": "^0.9.42",
"@ali/lowcode-editor-core": "^0.8.28",
"@ali/lowcode-types": "^0.8.14",
"@ali/lowcode-utils": "^0.8.16",

View File

@ -25,6 +25,7 @@ export class Field extends Component<FieldProps> {
state = {
collapsed: this.props.collapsed,
display: this.props.defaultDisplay || 'inline',
hasError: false,
};
constructor(props: any) {
@ -88,6 +89,10 @@ export class Field extends Component<FieldProps> {
}
}
static getDerivedStateFromError() {
return { hasError: true };
}
getTipContent(propName: string, tip?: any): any {
let tipContent = (
<div>
@ -114,6 +119,11 @@ export class Field extends Component<FieldProps> {
}
render() {
const { hasError } = this.state;
if (hasError) {
return null;
}
const { className, children, meta, title, valueState, onClear, name: propName, tip } = this.props;
const { display, collapsed } = this.state;
const isAccordion = display === 'accordion';

View File

@ -63,6 +63,13 @@ export default class LeftFloatPane extends Component<{ area: Area<any, Panel> }>
const { area } = this.props;
if (area.visible) {
this.focusing?.active();
// 关闭当前fixed区域的面板
// TODO: 看看有没有更合适的地方
const fixedContainer = area?.skeleton?.leftFixedArea?.container;
const currentFixed = fixedContainer?.current;
if (currentFixed) {
fixedContainer.unactive(currentFixed);
}
} else {
this.focusing?.suspense();
}

View File

@ -239,7 +239,7 @@ body {
top: 0;
bottom: 0;
width: var(--dock-pane-width);
min-width: var(--dock-fixed-pane-width);
// min-width: var(--dock-fixed-pane-width);
left: calc(var(--left-area-width) + 1px);
background-color: var(--color-pane-background);
box-shadow: 4px 6px 6px 0 rgba(31,50,88,0.08);

View File

@ -3,6 +3,46 @@
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.44"></a>
## [0.8.44](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.43...@ali/lowcode-plugin-components-pane@0.8.44) (2020-08-14)
**Note:** Version bump only for package @ali/lowcode-plugin-components-pane
<a name="0.8.43"></a>
## [0.8.43](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.42...@ali/lowcode-plugin-components-pane@0.8.43) (2020-08-07)
**Note:** Version bump only for package @ali/lowcode-plugin-components-pane
<a name="0.8.42"></a>
## [0.8.42](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.41...@ali/lowcode-plugin-components-pane@0.8.42) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-components-pane
<a name="0.8.41"></a>
## [0.8.41](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.40...@ali/lowcode-plugin-components-pane@0.8.41) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-components-pane
<a name="0.8.40"></a>
## [0.8.40](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.39...@ali/lowcode-plugin-components-pane@0.8.40) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-components-pane
<a name="0.8.39"></a>
## [0.8.39](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.38...@ali/lowcode-plugin-components-pane@0.8.39) (2020-08-04)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-components-pane",
"version": "0.8.39",
"version": "0.8.44",
"description": "alibaba lowcode editor component-list plugin",
"files": [
"es/",
@ -20,7 +20,7 @@
],
"author": "xiayang.xy",
"dependencies": {
"@ali/lowcode-designer": "^0.9.37",
"@ali/lowcode-designer": "^0.9.42",
"@ali/lowcode-editor-core": "^0.8.28",
"@ali/lowcode-types": "^0.8.14",
"@ali/ve-component-list": "^1.1.1",

View File

@ -3,6 +3,46 @@
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.42"></a>
## [0.9.42](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.41...@ali/lowcode-plugin-designer@0.9.42) (2020-08-14)
**Note:** Version bump only for package @ali/lowcode-plugin-designer
<a name="0.9.41"></a>
## [0.9.41](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.40...@ali/lowcode-plugin-designer@0.9.41) (2020-08-07)
**Note:** Version bump only for package @ali/lowcode-plugin-designer
<a name="0.9.40"></a>
## [0.9.40](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.39...@ali/lowcode-plugin-designer@0.9.40) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-designer
<a name="0.9.39"></a>
## [0.9.39](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.38...@ali/lowcode-plugin-designer@0.9.39) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-designer
<a name="0.9.38"></a>
## [0.9.38](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.37...@ali/lowcode-plugin-designer@0.9.38) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-designer
<a name="0.9.37"></a>
## [0.9.37](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.36...@ali/lowcode-plugin-designer@0.9.37) (2020-08-04)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-designer",
"version": "0.9.37",
"version": "0.9.42",
"description": "alibaba lowcode editor designer plugin",
"files": [
"es",
@ -20,7 +20,7 @@
],
"author": "xiayang.xy",
"dependencies": {
"@ali/lowcode-designer": "^0.9.37",
"@ali/lowcode-designer": "^0.9.42",
"@ali/lowcode-editor-core": "^0.8.28",
"react": "^16.8.1",
"react-dom": "^16.8.1"

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.48"></a>
## [0.8.48](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.47...@ali/lowcode-plugin-outline-pane@0.8.48) (2020-08-14)
### Bug Fixes
* 卡片内容不可用拖动 ([6a85c43](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/6a85c43))
<a name="0.8.47"></a>
## [0.8.47](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.46...@ali/lowcode-plugin-outline-pane@0.8.47) (2020-08-07)
**Note:** Version bump only for package @ali/lowcode-plugin-outline-pane
<a name="0.8.46"></a>
## [0.8.46](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.45...@ali/lowcode-plugin-outline-pane@0.8.46) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-outline-pane
<a name="0.8.45"></a>
## [0.8.45](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.44...@ali/lowcode-plugin-outline-pane@0.8.45) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-outline-pane
<a name="0.8.44"></a>
## [0.8.44](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.43...@ali/lowcode-plugin-outline-pane@0.8.44) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-outline-pane
<a name="0.8.43"></a>
## [0.8.43](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.42...@ali/lowcode-plugin-outline-pane@0.8.43) (2020-08-04)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-outline-pane",
"version": "0.8.43",
"version": "0.8.48",
"description": "Outline pane for Ali lowCode engine",
"files": [
"es",
@ -14,7 +14,7 @@
"test:snapshot": "ava --update-snapshots"
},
"dependencies": {
"@ali/lowcode-designer": "^0.9.37",
"@ali/lowcode-designer": "^0.9.42",
"@ali/lowcode-editor-core": "^0.8.28",
"@ali/lowcode-types": "^0.8.14",
"@ali/lowcode-utils": "^0.8.16",

View File

@ -122,20 +122,32 @@ export class OutlineMain implements ISensor, ITreeBoard, IScrollable {
locate(e: LocateEvent): DropLocation | undefined | null {
this.sensing = true;
this.scroller?.scrolling(e);
const { globalY, dragObject } = e;
const { nodes } = dragObject;
const tree = this._master?.currentTree;
if (!tree || !this._shell) {
return null;
}
const operationalNodes = nodes?.filter((node: any) => {
const onMoveHook = node.componentMeta?.getMetadata()?.experimental?.callbacks?.onMoveHook;
const canMove = onMoveHook && typeof onMoveHook === 'function' ? onMoveHook() : true;
return canMove;
});
if (!operationalNodes || operationalNodes.length === 0) {
return;
}
const document = tree.document;
const designer = document.designer;
const { globalY, dragObject } = e;
const pos = getPosFromEvent(e, this._shell);
const irect = this.getInsertionRect();
const originLoc = document.dropLocation;
if (e.dragObject.type === 'node' && e.dragObject.nodes[0].getPrototype().isModal()) {
if (dragObject.type === 'node' && operationalNodes[0].getPrototype().isModal()) {
return designer.createLocation({
target: document.rootNode,
detail: {
@ -195,7 +207,7 @@ export class OutlineMain implements ISensor, ITreeBoard, IScrollable {
let focusSlots = pos.focusSlots;
let { node } = treeNode;
if (isDragNodeObject(dragObject)) {
const nodes = dragObject.nodes;
const nodes = operationalNodes;
let i = nodes.length;
let p: any = node;
while (i-- > 0) {

View File

@ -3,6 +3,46 @@
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.46"></a>
## [0.8.46](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.45...@ali/lowcode-plugin-sample-preview@0.8.46) (2020-08-14)
**Note:** Version bump only for package @ali/lowcode-plugin-sample-preview
<a name="0.8.45"></a>
## [0.8.45](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.44...@ali/lowcode-plugin-sample-preview@0.8.45) (2020-08-07)
**Note:** Version bump only for package @ali/lowcode-plugin-sample-preview
<a name="0.8.44"></a>
## [0.8.44](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.43...@ali/lowcode-plugin-sample-preview@0.8.44) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-sample-preview
<a name="0.8.43"></a>
## [0.8.43](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.42...@ali/lowcode-plugin-sample-preview@0.8.43) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-sample-preview
<a name="0.8.42"></a>
## [0.8.42](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.41...@ali/lowcode-plugin-sample-preview@0.8.42) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-sample-preview
<a name="0.8.41"></a>
## [0.8.41](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.40...@ali/lowcode-plugin-sample-preview@0.8.41) (2020-08-04)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-sample-preview",
"version": "0.8.41",
"version": "0.8.46",
"description": "alibaba lowcode editor sample preview plugin",
"files": [
"es",
@ -18,7 +18,7 @@
"editor"
],
"dependencies": {
"@ali/lowcode-designer": "^0.9.37",
"@ali/lowcode-designer": "^0.9.42",
"@ali/lowcode-editor-core": "^0.8.28",
"@alifd/next": "^1.x",
"react": "^16.8.1"

View File

@ -3,6 +3,46 @@
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.46"></a>
## [0.8.46](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.45...@ali/lowcode-plugin-undo-redo@0.8.46) (2020-08-14)
**Note:** Version bump only for package @ali/lowcode-plugin-undo-redo
<a name="0.8.45"></a>
## [0.8.45](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.44...@ali/lowcode-plugin-undo-redo@0.8.45) (2020-08-07)
**Note:** Version bump only for package @ali/lowcode-plugin-undo-redo
<a name="0.8.44"></a>
## [0.8.44](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.43...@ali/lowcode-plugin-undo-redo@0.8.44) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-undo-redo
<a name="0.8.43"></a>
## [0.8.43](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.42...@ali/lowcode-plugin-undo-redo@0.8.43) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-undo-redo
<a name="0.8.42"></a>
## [0.8.42](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.41...@ali/lowcode-plugin-undo-redo@0.8.42) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-plugin-undo-redo
<a name="0.8.41"></a>
## [0.8.41](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.40...@ali/lowcode-plugin-undo-redo@0.8.41) (2020-08-04)

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-plugin-undo-redo",
"version": "0.8.41",
"version": "0.8.46",
"description": "alibaba lowcode editor undo redo plugin",
"files": [
"es",
@ -19,9 +19,9 @@
],
"author": "xiayang.xy",
"dependencies": {
"@ali/lowcode-designer": "^0.9.37",
"@ali/lowcode-designer": "^0.9.42",
"@ali/lowcode-editor-core": "^0.8.28",
"@ali/lowcode-editor-skeleton": "^0.8.43",
"@ali/lowcode-editor-skeleton": "^0.8.48",
"@ali/lowcode-types": "^0.8.14",
"@ali/lowcode-utils": "^0.8.16",
"react": "^16.8.1",

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.45"></a>
## [0.8.45](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-rax-simulator-renderer@0.8.44...@ali/lowcode-rax-simulator-renderer@0.8.45) (2020-08-14)
**Note:** Version bump only for package @ali/lowcode-rax-simulator-renderer
<a name="0.8.44"></a>
## [0.8.44](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-rax-simulator-renderer@0.8.43...@ali/lowcode-rax-simulator-renderer@0.8.44) (2020-08-07)
**Note:** Version bump only for package @ali/lowcode-rax-simulator-renderer
<a name="0.8.43"></a>
## [0.8.43](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-rax-simulator-renderer@0.8.42...@ali/lowcode-rax-simulator-renderer@0.8.43) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-rax-simulator-renderer
<a name="0.8.42"></a>
## [0.8.42](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-rax-simulator-renderer@0.8.41...@ali/lowcode-rax-simulator-renderer@0.8.42) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-rax-simulator-renderer
<a name="0.8.41"></a>
## [0.8.41](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-rax-simulator-renderer@0.8.40...@ali/lowcode-rax-simulator-renderer@0.8.41) (2020-08-06)
### Bug Fixes
* 修复 preset-vision 版本 lifeCycles 丢失以及 slot 初始化问题 ([7cf6d24](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7cf6d24))
<a name="0.8.40"></a>
## [0.8.40](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-rax-simulator-renderer@0.8.39...@ali/lowcode-rax-simulator-renderer@0.8.40) (2020-08-04)

View File

@ -1,7 +1,7 @@
{
"private": true,
"name": "@ali/lowcode-rax-simulator-renderer",
"version": "0.8.40",
"version": "0.8.45",
"description": "rax simulator renderer for alibaba lowcode designer",
"main": "lib/index.js",
"module": "es/index.js",
@ -14,7 +14,7 @@
"test:snapshot": "ava --update-snapshots"
},
"dependencies": {
"@ali/lowcode-designer": "^0.9.37",
"@ali/lowcode-designer": "^0.9.42",
"@ali/lowcode-rax-renderer": "^0.1.6",
"@ali/lowcode-types": "^0.8.14",
"@ali/lowcode-utils": "^0.8.16",
@ -53,5 +53,5 @@
"ts-node/register"
]
},
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-rax-simulator-renderer@0.8.39/build/index.html"
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-rax-simulator-renderer@0.8.44/build/index.html"
}

View File

@ -3,6 +3,19 @@
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-react-renderer@0.8.17...@ali/lowcode-react-renderer@0.8.18) (2020-08-14)
### Bug Fixes
* remove debugger ([a835dc6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/a835dc6))
* render error样式 ([d601d5e](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/d601d5e))
* 组件缺失占位 ([aff2f34](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/aff2f34))
<a name="0.8.17"></a>
## [0.8.17](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-renderer@0.8.16...@ali/lowcode-react-renderer@0.8.17) (2020-07-29)

View File

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

View File

@ -30,14 +30,33 @@ class FaultComponent extends PureComponent {
render() {
// FIXME: errorlog
console.error('render error', this.props);
return <Div>RenderError</Div>;
const { _componentName: componentName } = this.props;
return <Div
style={{
backgroundColor: '#DE2710',
padding: '15px',
fontSize: '18px',
textAlign: 'center',
color: 'white',
}}
>组件 {componentName} 渲染错误请打开控制台排查</Div>;;
}
}
class NotFoundComponent extends PureComponent {
render() {
console.error('component not found', this.props);
return <Div {...this.props} />;
console.error('component not found:', this.props);
const { _componentName: componentName } = this.props;
return <Div
{...this.props}
style={{
backgroundColor: '#3E91C9',
padding: '15px',
fontSize: '18px',
textAlign: 'center',
color: 'white',
}}
>组件 {componentName} 无视图请打开控制台排查</Div>;
}
}

View File

@ -3,6 +3,52 @@
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.47"></a>
## [0.8.47](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.46...@ali/lowcode-react-simulator-renderer@0.8.47) (2020-08-14)
### Bug Fixes
* createComponent 支持所有 schema ([7f946f5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7f946f5))
<a name="0.8.46"></a>
## [0.8.46](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.45...@ali/lowcode-react-simulator-renderer@0.8.46) (2020-08-07)
### Bug Fixes
* 部分低代码组件渲染报错 ([093015c](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/093015c))
<a name="0.8.45"></a>
## [0.8.45](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.44...@ali/lowcode-react-simulator-renderer@0.8.45) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-react-simulator-renderer
<a name="0.8.44"></a>
## [0.8.44](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.43...@ali/lowcode-react-simulator-renderer@0.8.44) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-react-simulator-renderer
<a name="0.8.43"></a>
## [0.8.43](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.42...@ali/lowcode-react-simulator-renderer@0.8.43) (2020-08-06)
**Note:** Version bump only for package @ali/lowcode-react-simulator-renderer
<a name="0.8.42"></a>
## [0.8.42](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.41...@ali/lowcode-react-simulator-renderer@0.8.42) (2020-08-04)

View File

@ -1,7 +1,7 @@
{
"private": true,
"name": "@ali/lowcode-react-simulator-renderer",
"version": "0.8.42",
"version": "0.8.47",
"description": "react simulator renderer for alibaba lowcode designer",
"main": "lib/index.js",
"module": "es/index.js",
@ -13,8 +13,8 @@
"test:snapshot": "ava --update-snapshots"
},
"dependencies": {
"@ali/lowcode-designer": "^0.9.37",
"@ali/lowcode-react-renderer": "^0.8.17",
"@ali/lowcode-designer": "^0.9.42",
"@ali/lowcode-react-renderer": "^0.8.18",
"@ali/lowcode-types": "^0.8.14",
"@ali/lowcode-utils": "^0.8.16",
"@ali/vu-css-style": "^1.0.2",

View File

@ -8,7 +8,7 @@ import { getClientRects } from './utils/get-client-rects';
import loader from './utils/loader';
import { reactFindDOMNodes, FIBER_KEY } from './utils/react-find-dom-nodes';
import { isESModule, isElement, cursor, setNativeSelection } from '@ali/lowcode-utils';
import { RootSchema, NpmInfo, ComponentSchema, TransformStage } from '@ali/lowcode-types';
import { RootSchema, NpmInfo, ComponentSchema, TransformStage, NodeSchema } from '@ali/lowcode-types';
// just use types
import { BuiltinSimulatorRenderer, NodeInstance, Component } from '@ali/lowcode-designer';
import Slot from './builtin-components/slot';
@ -212,7 +212,7 @@ export class SimulatorRenderer implements BuiltinSimulatorRenderer {
return this.instancesMap.get(id) || null;
}
createComponent(schema: ComponentSchema): Component | null {
createComponent(schema: NodeSchema): Component | null {
let _schema: any = {
...schema,
};
@ -230,14 +230,14 @@ export class SimulatorRenderer implements BuiltinSimulatorRenderer {
let result = { ...propsSchema };
const reg = /^(?:this\.props|props)\.(\S+)$/;
Object.keys(result).map((key: string) => {
if (result[key].type === 'JSExpression') {
if (result[key]?.type === 'JSExpression') {
const { value } = result[key];
const matched = reg.exec(value);
if (matched) {
const propName = matched[1];
result[key] = propsMap[propName];
}
} else if (result[key].type === 'JSSlot') {
} else if (result[key]?.type === 'JSSlot') {
const schema = result[key].value;
result[key] = createElement(Ele, {schema, propsMap: {}});
}
@ -267,6 +267,9 @@ export class SimulatorRenderer implements BuiltinSimulatorRenderer {
}
const { schema, propsMap } = this.props;
const Com = componentsMap[schema.componentName];
if (!Com) {
return null;
}
let children = null;
if (schema.children && schema.children.length > 0) {
children = schema.children.map((item: any) => createElement(Ele, {schema: item, propsMap}));
@ -280,12 +283,17 @@ export class SimulatorRenderer implements BuiltinSimulatorRenderer {
class Com extends React.Component {
render() {
let children = [];
const propsMap = this.props;
if (_schema.children && Array.isArray(_schema.children)) {
children = _schema.children.map((item: any) => createElement(Ele, {schema: item, propsMap}));
const componentName = _schema.componentName;
if (componentName === 'Component') {
let children = [];
const propsMap = this.props || {};
if (_schema.children && Array.isArray(_schema.children)) {
children = _schema.children.map((item: any) => createElement(Ele, {schema: item, propsMap}));
}
return createElement(React.Fragment, {}, children);
} else {
return createElement(Ele, {schema: _schema, propsMap: {}});
}
return createElement(React.Fragment, {}, children);
}
}