mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 09:41:57 +00:00
Merge branch 'refactor/code-style' into fix/ducheng-source-style
This commit is contained in:
commit
e90ae8f0b8
@ -238,14 +238,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
### Features
|
||||
|
||||
<<<<<<< HEAD
|
||||
* code generator main process ([021d6e0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/021d6e0))
|
||||
* demo schema & complex children type ([a5ee6bd](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/a5ee6bd))
|
||||
* fix gaps ([32af3d3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/32af3d3))
|
||||
* project builder fix & publish demo to disk ([26983b3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/26983b3))
|
||||
=======
|
||||
* code generator main process ([021d6e0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/021d6e0fe9fb29a8b6c1c5d5f4d06ec71896faa5))
|
||||
* demo schema & complex children type ([a5ee6bd](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/a5ee6bd55806fc9aea695096ccd4c7f50b8e31c4))
|
||||
* fix gaps ([32af3d3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/32af3d3a3ca4d5aca15be25e05c840c8ea0cb6ae))
|
||||
* project builder fix & publish demo to disk ([26983b3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/26983b38c2b0f1d39d79964eb54d8ce60250dd82))
|
||||
>>>>>>> df955e1db90ff104cd11160def80113cfd6faccc
|
||||
|
||||
@ -7,6 +7,30 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@1.0.6-0...@ali/lowcode-demo@1.0.7-0) (2020-09-02)
|
||||
|
||||
|
||||
<a name="0.8.65"></a>
|
||||
## [0.8.65](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.64...@ali/lowcode-demo@0.8.65) (2020-09-08)
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-demo
|
||||
|
||||
<a name="0.8.64"></a>
|
||||
## [0.8.64](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.63...@ali/lowcode-demo@0.8.64) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-demo
|
||||
|
||||
<a name="0.8.63"></a>
|
||||
## [0.8.63](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.62...@ali/lowcode-demo@0.8.63) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-demo
|
||||
|
||||
<a name="0.8.62"></a>
|
||||
## [0.8.62](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-demo@0.8.61...@ali/lowcode-demo@0.8.62) (2020-08-27)
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-demo
|
||||
|
||||
@ -13107,30 +13107,6 @@
|
||||
}
|
||||
],
|
||||
"componentList": [
|
||||
{
|
||||
"title": "Util",
|
||||
"children": [
|
||||
{
|
||||
"componentName": "Dropdown",
|
||||
"title": "下拉菜单",
|
||||
"icon": "",
|
||||
"package": "@alifd/next",
|
||||
"library": "Next",
|
||||
"snippets": [
|
||||
{
|
||||
"title": "下拉菜单",
|
||||
"screenshot": "",
|
||||
"schema": {
|
||||
"componentName": "Dropdown",
|
||||
"props": { "trigger": [{ "componentName": "Button", "props": { "type": "primary" }, "children": "确定" }], "triggerType": "click"},
|
||||
"children": [{ "componentName": "Menu", "props": { "style": { "width": 200 } }, "children": [{ "componentName": "Menu.Item", "props": {}, "children": "Option 1" }, { "componentName": "Menu.Item", "props": { "disabled": false }, "children": "option 2" }, { "componentName": "Menu.Item", "props": { "disabled": false }, "children": "option 3" }]}]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"icon": ""
|
||||
},
|
||||
{
|
||||
"title": "DataDisplay",
|
||||
"children": [
|
||||
@ -15388,5 +15364,31 @@
|
||||
],
|
||||
"icon": ""
|
||||
}
|
||||
],
|
||||
"bizComponentList": [
|
||||
{
|
||||
"title": "Util",
|
||||
"children": [
|
||||
{
|
||||
"componentName": "Dropdown",
|
||||
"title": "下拉菜单",
|
||||
"icon": "",
|
||||
"package": "@alifd/next",
|
||||
"library": "Next",
|
||||
"snippets": [
|
||||
{
|
||||
"title": "下拉菜单",
|
||||
"screenshot": "",
|
||||
"schema": {
|
||||
"componentName": "Dropdown",
|
||||
"props": { "trigger": [{ "componentName": "Button", "props": { "type": "primary" }, "children": "确定" }], "triggerType": "click"},
|
||||
"children": [{ "componentName": "Menu", "props": { "style": { "width": 200 } }, "children": [{ "componentName": "Menu.Item", "props": {}, "children": "Option 1" }, { "componentName": "Menu.Item", "props": { "disabled": false }, "children": "option 2" }, { "componentName": "Menu.Item", "props": { "disabled": false }, "children": "option 3" }]}]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"icon": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -7,6 +7,26 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@1.0.6-0...@ali/lowcode-designer@1.0.7-0) (2020-09-02)
|
||||
|
||||
|
||||
<a name="0.9.55"></a>
|
||||
## [0.9.55](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@0.9.54...@ali/lowcode-designer@0.9.55) (2020-09-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 拖拽时要解除与原来节点的关系 ([7a6bf2c](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7a6bf2c))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="0.9.54"></a>
|
||||
## [0.9.54](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@0.9.53...@ali/lowcode-designer@0.9.54) (2020-09-03)
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-designer
|
||||
|
||||
<a name="0.9.53"></a>
|
||||
## [0.9.53](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@0.9.52...@ali/lowcode-designer@0.9.53) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-designer
|
||||
@ -29,6 +49,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-designer
|
||||
<a name="1.0.5-0"></a>
|
||||
## [1.0.5-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@1.0.4-0...@ali/lowcode-designer@1.0.5-0) (2020-08-20)
|
||||
|
||||
@ -80,7 +101,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
<a name="0.9.48"></a>
|
||||
## [0.9.48](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-designer@0.9.47...@ali/lowcode-designer@0.9.48) (2020-08-20)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
@ -105,7 +125,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
### Bug Fixes
|
||||
|
||||
* support dropObject is data ([809fda7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/809fda7))
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
@ -199,7 +218,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
<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)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@ -87,7 +87,7 @@ const defaultRaxSimulatorUrl = (() => {
|
||||
|
||||
const defaultEnvironment = [
|
||||
// https://g.alicdn.com/mylib/??react/16.11.0/umd/react.production.min.js,react-dom/16.8.6/umd/react-dom.production.min.js,prop-types/15.7.2/prop-types.min.js
|
||||
assetItem(AssetType.JSText, 'window.React=parent.React;window.ReactDOM=parent.ReactDOM;', undefined, 'react'),
|
||||
assetItem(AssetType.JSText, 'window.React=parent.React;window.ReactDOM=parent.ReactDOM;window.__is_simulator_env__=true;', undefined, 'react'),
|
||||
assetItem(
|
||||
AssetType.JSText,
|
||||
'window.PropTypes=parent.PropTypes;React.PropTypes=parent.PropTypes; window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;',
|
||||
|
||||
@ -11,7 +11,6 @@ import { History } from './history';
|
||||
import { TransformStage, ModalNodesManager } from './node';
|
||||
import { uniqueId } from '@ali/lowcode-utils';
|
||||
|
||||
|
||||
export type GetDataType<T, NodeType> = T extends undefined
|
||||
? NodeType extends {
|
||||
schema: infer R;
|
||||
@ -281,14 +280,16 @@ export class DocumentModel {
|
||||
/**
|
||||
* 内部方法,请勿调用
|
||||
*/
|
||||
internalRemoveAndPurgeNode(node: Node) {
|
||||
internalRemoveAndPurgeNode(node: Node, useMutator = false) {
|
||||
if (!this.nodes.has(node)) {
|
||||
return;
|
||||
}
|
||||
this._nodesMap.delete(node.id);
|
||||
node.remove(useMutator);
|
||||
}
|
||||
|
||||
unlinkNode(node: Node) {
|
||||
this.nodes.delete(node);
|
||||
this.selection.remove(node.id);
|
||||
node.remove();
|
||||
this._nodesMap.delete(node.id);
|
||||
}
|
||||
|
||||
@obx.ref private _dropLocation: DropLocation | null = null;
|
||||
@ -333,20 +334,23 @@ export class DocumentModel {
|
||||
* 导出 schema 数据
|
||||
*/
|
||||
get schema(): RootSchema {
|
||||
return this.rootNode.schema as any;
|
||||
return this.rootNode?.schema as any;
|
||||
}
|
||||
|
||||
import(schema: RootSchema, checkId = false) {
|
||||
// TODO: do purge
|
||||
// TODO: 暂时用饱和式删除,原因是 Slot 节点并不是树节点,无法正常递归删除
|
||||
this.nodes.forEach(node => {
|
||||
this.destroyNode(node);
|
||||
this.internalRemoveAndPurgeNode(node, true);
|
||||
});
|
||||
this.rootNode.import(schema as any, checkId);
|
||||
// foreachReverse(this.rootNode?.children, (node: Node) => {
|
||||
// this.internalRemoveAndPurgeNode(node, true);
|
||||
// });
|
||||
this.rootNode?.import(schema as any, checkId);
|
||||
// todo: select added and active track added
|
||||
}
|
||||
|
||||
export(stage: TransformStage = TransformStage.Serilize) {
|
||||
return this.rootNode.export(stage);
|
||||
return this.rootNode?.export(stage);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -4,6 +4,7 @@ import { TransformStage } from './transform-stage';
|
||||
import { NodeData, isNodeSchema } from '@ali/lowcode-types';
|
||||
import { shallowEqual } from '@ali/lowcode-utils';
|
||||
import { EventEmitter } from 'events';
|
||||
import { foreachReverse } from '../../utils/tree';
|
||||
|
||||
export class NodeChildren {
|
||||
@obx.val private children: Node[];
|
||||
@ -14,9 +15,10 @@ export class NodeChildren {
|
||||
this.children = (Array.isArray(data) ? data : [data]).map(child => {
|
||||
return this.owner.document.createNode(child);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
interalInitParent() {
|
||||
internalInitParent() {
|
||||
this.children.forEach(child => child.internalSetParent(this.owner));
|
||||
}
|
||||
|
||||
@ -56,7 +58,7 @@ export class NodeChildren {
|
||||
}
|
||||
|
||||
this.children = children;
|
||||
this.interalInitParent();
|
||||
this.internalInitParent();
|
||||
if (!shallowEqual(children, originChildren)) {
|
||||
this.emitter.emit('change');
|
||||
}
|
||||
@ -92,24 +94,58 @@ export class NodeChildren {
|
||||
return this.children.length;
|
||||
}
|
||||
|
||||
private purged = false;
|
||||
/**
|
||||
* 删除一个节点
|
||||
* 回收销毁
|
||||
*/
|
||||
delete(node: Node, purge = false, useMutator = true): boolean {
|
||||
purge(useMutator = true) {
|
||||
if (this.purged) {
|
||||
return;
|
||||
}
|
||||
this.purged = true;
|
||||
this.children.forEach((child) => {
|
||||
child.purge(useMutator);
|
||||
});
|
||||
}
|
||||
|
||||
unlinkChild(node: Node) {
|
||||
const i = this.children.indexOf(node);
|
||||
if (i < 0) {
|
||||
return false;
|
||||
}
|
||||
const deleted = this.children.splice(i, 1)[0];
|
||||
this.children.splice(i, 1);
|
||||
}
|
||||
/**
|
||||
* 删除一个节点
|
||||
*/
|
||||
delete(node: Node, purge = false, useMutator = true): boolean {
|
||||
if (node.isParental()) {
|
||||
foreachReverse(node.children, (subNode: Node) => {
|
||||
subNode.remove(useMutator, purge);
|
||||
});
|
||||
}
|
||||
if (purge) {
|
||||
// should set parent null
|
||||
deleted.internalSetParent(null, useMutator);
|
||||
deleted.purge(useMutator);
|
||||
node.internalSetParent(null, useMutator);
|
||||
try {
|
||||
node.purge(useMutator);
|
||||
} catch(err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
const document = node.document;
|
||||
document.unlinkNode(node);
|
||||
document.selection.remove(node.id);
|
||||
document.destroyNode(node);
|
||||
this.emitter.emit('change');
|
||||
const i = this.children.indexOf(node);
|
||||
if (useMutator) {
|
||||
this.reportModified(node, this.owner, { type: 'remove', removeIndex: i, removeNode: node });
|
||||
}
|
||||
if (i < 0) {
|
||||
return false;
|
||||
}
|
||||
this.children.splice(i, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -236,7 +272,6 @@ export class NodeChildren {
|
||||
return fn(child, index);
|
||||
});
|
||||
}
|
||||
|
||||
every(fn: (item: Node, index: number) => any): boolean {
|
||||
return this.children.every((child, index) => fn(child, index));
|
||||
}
|
||||
@ -249,6 +284,10 @@ export class NodeChildren {
|
||||
return this.children.filter(fn);
|
||||
}
|
||||
|
||||
find(fn: (item: Node, index: number) => Node) {
|
||||
return this.children.find(fn);
|
||||
}
|
||||
|
||||
mergeChildren(remover: () => any, adder: (children: Node[]) => NodeData[] | null, sorter: () => any) {
|
||||
let changed = false;
|
||||
if (remover) {
|
||||
@ -291,19 +330,6 @@ export class NodeChildren {
|
||||
};
|
||||
}
|
||||
|
||||
private purged = false;
|
||||
|
||||
/**
|
||||
* 回收销毁
|
||||
*/
|
||||
purge(useMutator = true) {
|
||||
if (this.purged) {
|
||||
return;
|
||||
}
|
||||
this.purged = true;
|
||||
this.children.forEach((child) => child.purge(useMutator));
|
||||
}
|
||||
|
||||
get [Symbol.toStringTag]() {
|
||||
// 保证向前兼容性
|
||||
return 'Array';
|
||||
@ -329,7 +355,7 @@ export class NodeChildren {
|
||||
try {
|
||||
callbacks?.onSubtreeModified.call(node, owner, options);
|
||||
} catch (e) {
|
||||
console.error('error when excute experimental.callbacks.onNodeAdd', e);
|
||||
console.error('error when excute experimental.callbacks.onSubtreeModified', e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -163,9 +163,12 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
children: isDOMText(children) || isJSExpression(children) ? children : '',
|
||||
});
|
||||
} else {
|
||||
// 这里 props 被初始化两次,一次 new,一次 import,new 的实例需要给 propsReducer 的钩子去使用,
|
||||
// import 是为了使用钩子返回的值,并非完全幂等的操作,部分行为执行两次会有 bug,
|
||||
// 所以在 props 里会对 new / import 做一些区别化的解析
|
||||
this.props = new Props(this, props, extras);
|
||||
this._children = new NodeChildren(this as ParentalNode, this.initialChildren(children));
|
||||
this._children.interalInitParent();
|
||||
this._children.internalInitParent();
|
||||
this.props.import(this.upgradeProps(this.initProps(props || {})), this.upgradeProps(extras || {}));
|
||||
this.setupAutoruns();
|
||||
}
|
||||
@ -268,14 +271,15 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._parent) {
|
||||
// 解除老的父子关系,但不需要真的删除节点
|
||||
if (this._parent && !parent) {
|
||||
if (this.isSlot()) {
|
||||
this._parent.removeSlot(this, false);
|
||||
this._parent.unlinkSlot(this);
|
||||
} else {
|
||||
this._parent.children.delete(this, false, useMutator);
|
||||
this._parent.children.unlinkChild(this);
|
||||
}
|
||||
}
|
||||
|
||||
// 建立新的父子关系
|
||||
this._parent = parent;
|
||||
if (parent) {
|
||||
this.document.removeWillPurge(this);
|
||||
@ -309,12 +313,12 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
/**
|
||||
* 移除当前节点
|
||||
*/
|
||||
remove(useMutator = true) {
|
||||
remove(useMutator = true, purge = true) {
|
||||
if (this.parent) {
|
||||
if (this.isSlot()) {
|
||||
this.parent.removeSlot(this, true);
|
||||
this.parent.removeSlot(this, purge);
|
||||
} else {
|
||||
this.parent.children.delete(this, true, useMutator);
|
||||
this.parent.children.delete(this, purge, useMutator);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -658,20 +662,30 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
return comparePosition(this, otherNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一个Slot节点
|
||||
*/
|
||||
removeSlot(slotNode: Node, purge = false): boolean {
|
||||
unlinkSlot(slotNode: Node) {
|
||||
const i = this._slots.indexOf(slotNode);
|
||||
if (i < 0) {
|
||||
return false;
|
||||
}
|
||||
const deleted = this._slots.splice(i, 1)[0];
|
||||
this._slots.splice(i, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一个Slot节点
|
||||
*/
|
||||
removeSlot(slotNode: Node, purge = false): boolean {
|
||||
if (purge) {
|
||||
// should set parent null
|
||||
deleted.internalSetParent(null);
|
||||
deleted.purge();
|
||||
slotNode?.internalSetParent(null, false);
|
||||
slotNode?.purge();
|
||||
}
|
||||
this.document.unlinkNode(slotNode);
|
||||
this.document.selection.remove(slotNode.id);
|
||||
const i = this._slots.indexOf(slotNode);
|
||||
if (i < 0) {
|
||||
return false;
|
||||
}
|
||||
this._slots.splice(i, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -715,20 +729,10 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
if (this.purged) {
|
||||
return;
|
||||
}
|
||||
// if (this._parent) {
|
||||
// // should remove thisNode before purge
|
||||
// this.remove(useMutator);
|
||||
// return;
|
||||
// }
|
||||
this.purged = true;
|
||||
if (this.isParental()) {
|
||||
this.children.purge(useMutator);
|
||||
}
|
||||
this.autoruns?.forEach((dispose) => dispose());
|
||||
this.props.purge();
|
||||
this.document.internalRemoveAndPurgeNode(this);
|
||||
this.document.destroyNode(this);
|
||||
this.remove(useMutator);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -23,6 +23,37 @@ export class Prop implements IPropParent {
|
||||
|
||||
readonly owner: Node;
|
||||
|
||||
private stash: PropStash | undefined;
|
||||
|
||||
/**
|
||||
* 键值
|
||||
*/
|
||||
@obx key: string | number | undefined;
|
||||
/**
|
||||
* 扩展值
|
||||
*/
|
||||
@obx spread: boolean;
|
||||
|
||||
readonly props: Props;
|
||||
readonly options: any;
|
||||
|
||||
constructor(
|
||||
public parent: IPropParent,
|
||||
value: CompositeValue | UNSET = UNSET,
|
||||
key?: string | number,
|
||||
spread = false,
|
||||
options = {},
|
||||
) {
|
||||
this.owner = parent.owner;
|
||||
this.props = parent.props;
|
||||
this.key = key;
|
||||
this.spread = spread;
|
||||
this.options = options;
|
||||
if (value !== UNSET) {
|
||||
this.setValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SettingTarget
|
||||
*/
|
||||
@ -200,7 +231,7 @@ export class Prop implements IPropParent {
|
||||
} else if (Array.isArray(val)) {
|
||||
this._type = 'list';
|
||||
} else if (isPlainObject(val)) {
|
||||
if (isJSSlot(val)) {
|
||||
if (isJSSlot(val) && this.options.propsMode !== 'init') {
|
||||
this.setAsSlot(val);
|
||||
return;
|
||||
}
|
||||
@ -355,35 +386,6 @@ export class Prop implements IPropParent {
|
||||
return this._maps;
|
||||
}
|
||||
|
||||
private stash: PropStash | undefined;
|
||||
|
||||
/**
|
||||
* 键值
|
||||
*/
|
||||
@obx key: string | number | undefined;
|
||||
|
||||
/**
|
||||
* 扩展值
|
||||
*/
|
||||
@obx spread: boolean;
|
||||
|
||||
readonly props: Props;
|
||||
|
||||
constructor(
|
||||
public parent: IPropParent,
|
||||
value: CompositeValue | UNSET = UNSET,
|
||||
key?: string | number,
|
||||
spread = false,
|
||||
) {
|
||||
this.owner = parent.owner;
|
||||
this.props = parent.props;
|
||||
if (value !== UNSET) {
|
||||
this.setValue(value);
|
||||
}
|
||||
this.key = key;
|
||||
this.spread = spread;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某个属性
|
||||
* @param stash 如果不存在,临时获取一个待写入
|
||||
|
||||
@ -59,9 +59,9 @@ export class Props implements IPropParent {
|
||||
constructor(readonly owner: Node, value?: PropsMap | PropsList | null, extras?: object) {
|
||||
if (Array.isArray(value)) {
|
||||
this.type = 'list';
|
||||
this.items = value.map(item => new Prop(this, item.value, item.name, item.spread));
|
||||
this.items = value.map(item => new Prop(this, item.value, item.name, item.spread, { propsMode: 'init' }));
|
||||
} else if (value != null) {
|
||||
this.items = Object.keys(value).map(key => new Prop(this, value[key], key));
|
||||
this.items = Object.keys(value).map(key => new Prop(this, value[key], key, false, { propsMode: 'init' }));
|
||||
}
|
||||
if (extras) {
|
||||
Object.keys(extras).forEach(key => {
|
||||
|
||||
7
packages/designer/src/utils/tree.ts
Normal file
7
packages/designer/src/utils/tree.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { NodeChildren } from '../document/node/node-children';
|
||||
|
||||
export function foreachReverse(arr: NodeChildren, fn: Function, context: any = {}) {
|
||||
for (let i = arr.length - 1; i >= 0; i--) {
|
||||
fn.call(context, arr.get(i));
|
||||
}
|
||||
}
|
||||
@ -6,13 +6,19 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-core@1.0.6-0...@ali/lowcode-editor-core@1.0.7-0) (2020-09-02)
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-core
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-core@0.8.34...@ali/lowcode-editor-core@1.0.6-0) (2020-09-02)
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-core
|
||||
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-core@0.8.34...@ali/lowcode-editor-core@1.0.6-0) (2020-09-02)
|
||||
<a name="0.8.36"></a>
|
||||
## [0.8.36](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-core@0.8.35...@ali/lowcode-editor-core@0.8.36) (2020-09-03)
|
||||
|
||||
<a name="0.8.35"></a>
|
||||
## [0.8.35](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-core@0.8.34...@ali/lowcode-editor-core@0.8.35) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@ -45,10 +51,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
|
||||
|
||||
>>>>>>> master
|
||||
<a name="0.8.32"></a>
|
||||
## [0.8.32](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-core@0.8.30...@ali/lowcode-editor-core@0.8.32) (2020-08-20)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
@ -91,7 +95,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
# [1.0.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-core@0.13.0...@ali/lowcode-editor-core@1.0.0) (2020-08-17)
|
||||
<a name="0.8.30"></a>
|
||||
## [0.8.30](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-core@0.8.29...@ali/lowcode-editor-core@0.8.30) (2020-08-19)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -7,12 +7,28 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@1.0.6-0...@ali/lowcode-editor-preset-general@1.0.7-0) (2020-09-02)
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-preset-general
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.37...@ali/lowcode-editor-preset-general@1.0.6-0) (2020-09-02)
|
||||
|
||||
|
||||
<a name="0.9.40"></a>
|
||||
## [0.9.40](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.39...@ali/lowcode-editor-preset-general@0.9.40) (2020-09-08)
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-preset-general
|
||||
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.37...@ali/lowcode-editor-preset-general@1.0.6-0) (2020-09-02)
|
||||
<a name="0.9.39"></a>
|
||||
## [0.9.39](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.38...@ali/lowcode-editor-preset-general@0.9.39) (2020-09-03)
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-preset-general
|
||||
|
||||
<a name="0.9.38"></a>
|
||||
## [0.9.38](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.37...@ali/lowcode-editor-preset-general@0.9.38) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@ -57,10 +73,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-preset-general
|
||||
|
||||
>>>>>>> master
|
||||
<a name="0.9.33"></a>
|
||||
## [0.9.33](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.32...@ali/lowcode-editor-preset-general@0.9.33) (2020-08-20)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
@ -136,10 +150,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-preset-general
|
||||
|
||||
>>>>>>> master
|
||||
<a name="0.9.28"></a>
|
||||
## [0.9.28](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.27...@ali/lowcode-editor-preset-general@0.9.28) (2020-08-14)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -6,14 +6,24 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@1.0.6-0...@ali/lowcode-editor-preset-vision@1.0.7-0) (2020-09-02)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-preset-vision
|
||||
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.54...@ali/lowcode-editor-preset-vision@1.0.6-0) (2020-09-02)
|
||||
|
||||
<a name="0.8.57"></a>
|
||||
## [0.8.57](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.56...@ali/lowcode-editor-preset-vision@0.8.57) (2020-09-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 移除 isInSimulator 函数 ([6370889](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/6370889))
|
||||
* 补全 packageName, 否则在组件面板会被隐藏 ([88e5008](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/88e5008))
|
||||
|
||||
|
||||
<a name="0.8.56"></a>
|
||||
## [0.8.56](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.55...@ali/lowcode-editor-preset-vision@0.8.56) (2020-09-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@ -23,6 +33,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
|
||||
|
||||
<a name="0.8.55"></a>
|
||||
## [0.8.55](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.54...@ali/lowcode-editor-preset-vision@0.8.55) (2020-09-03)
|
||||
<a name="1.0.5-0"></a>
|
||||
## [1.0.5-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@1.0.4-0...@ali/lowcode-editor-preset-vision@1.0.5-0) (2020-08-20)
|
||||
|
||||
@ -41,7 +53,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
<a name="1.0.3-0"></a>
|
||||
## [1.0.3-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@1.0.2-0...@ali/lowcode-editor-preset-vision@1.0.3-0) (2020-08-20)
|
||||
=======
|
||||
<a name="0.8.54"></a>
|
||||
## [0.8.54](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.53...@ali/lowcode-editor-preset-vision@0.8.54) (2020-08-27)
|
||||
|
||||
@ -104,7 +115,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
|
||||
|
||||
>>>>>>> master
|
||||
<a name="0.8.49"></a>
|
||||
## [0.8.49](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.48...@ali/lowcode-editor-preset-vision@0.8.49) (2020-08-19)
|
||||
|
||||
@ -170,7 +180,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
<a name="0.8.44"></a>
|
||||
## [0.8.44](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.43...@ali/lowcode-editor-preset-vision@0.8.44) (2020-08-14)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ export default class Bundle {
|
||||
*/
|
||||
if (bundles.length >= 2) {
|
||||
const prototype = bundles[0];
|
||||
const metadata = upgradeMetadata(prototype.options);
|
||||
const metadata = upgradeMetadata({ ...prototype.options, packageName: prototype.packageName });
|
||||
prototype.meta = designer.createComponentMeta(metadata);
|
||||
const prototypeView = bundles[1];
|
||||
prototype.setView(prototypeView);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ComponentType, ReactElement, Component, FunctionComponent } from 'react';
|
||||
import { ComponentMetadata, FieldConfig, InitialItem, FilterItem, AutorunItem, isI18nData } from '@ali/lowcode-types';
|
||||
import { ComponentMetadata, FieldConfig, InitialItem, FilterItem, AutorunItem } from '@ali/lowcode-types';
|
||||
import {
|
||||
ComponentMeta,
|
||||
addBuiltinComponentAction,
|
||||
@ -7,6 +7,7 @@ import {
|
||||
registerMetadataTransducer,
|
||||
TransformStage,
|
||||
} from '@ali/lowcode-designer';
|
||||
import { intl } from '@ali/lowcode-editor-core';
|
||||
import {
|
||||
OldPropConfig,
|
||||
OldPrototypeConfig,
|
||||
@ -15,7 +16,7 @@ import {
|
||||
upgradePropConfig,
|
||||
upgradeConfigure,
|
||||
} from './upgrade-metadata';
|
||||
import { intl } from '@ali/lowcode-editor-core';
|
||||
|
||||
import { designer } from '../editor';
|
||||
|
||||
const GlobalPropsConfigure: Array<{
|
||||
|
||||
@ -26,21 +26,10 @@ export const designer = new Designer({ editor });
|
||||
editor.set(Designer, designer);
|
||||
editor.set('designer', designer);
|
||||
|
||||
let nodeCache: any = {};
|
||||
designer.project.onCurrentDocumentChange((doc) => {
|
||||
nodeCache = {};
|
||||
doc.nodesMap.forEach((node) => {
|
||||
nodeCache[node.id] = node;
|
||||
});
|
||||
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 {
|
||||
@ -89,6 +78,18 @@ function upgradePropsReducer(props: any) {
|
||||
// 升级 Props
|
||||
designer.addPropsReducer(upgradePropsReducer, TransformStage.Upgrade);
|
||||
|
||||
function getCurrentFieldIds() {
|
||||
const fieldIds: any = [];
|
||||
const nodesMap = designer?.currentDocument?.nodesMap || new Map();
|
||||
nodesMap.forEach((curNode: any) => {
|
||||
const fieldId = nodesMap?.get(curNode.id)?.getPropValue('fieldId');
|
||||
if (fieldId) {
|
||||
fieldIds.push(fieldId);
|
||||
}
|
||||
});
|
||||
return fieldIds;
|
||||
}
|
||||
|
||||
// 节点 props 初始化
|
||||
designer.addPropsReducer((props, node) => {
|
||||
// run initials
|
||||
@ -96,18 +97,10 @@ designer.addPropsReducer((props, node) => {
|
||||
...props,
|
||||
};
|
||||
if (newProps.fieldId) {
|
||||
const fieldIds: any = [];
|
||||
Object.keys(nodeCache).forEach(nodeId => {
|
||||
if (nodeId === node.id) {
|
||||
return;
|
||||
}
|
||||
const fieldId = nodeCache[nodeId].getPropValue('fieldId');
|
||||
if (fieldId) {
|
||||
fieldIds.push(fieldId);
|
||||
}
|
||||
});
|
||||
const fieldIds = getCurrentFieldIds();
|
||||
|
||||
// 全局的关闭 uniqueIdChecker 信号,在 ve-utils 中实现
|
||||
if (fieldIds.indexOf(props.fieldId) >= 0 && !window.__disable_unique_id_checker__) {
|
||||
if (fieldIds.indexOf(props.fieldId) >= 0 && !(window as any).__disable_unique_id_checker__) {
|
||||
newProps.fieldId = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,16 +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="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@1.0.6-0...@ali/lowcode-editor-setters@1.0.7-0) (2020-09-02)
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-setters
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.19...@ali/lowcode-editor-setters@1.0.6-0) (2020-09-02)
|
||||
|
||||
|
||||
<a name="0.9.21"></a>
|
||||
## [0.9.21](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.20...@ali/lowcode-editor-setters@0.9.21) (2020-09-03)
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-setters
|
||||
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.19...@ali/lowcode-editor-setters@1.0.6-0) (2020-09-02)
|
||||
<a name="0.9.20"></a>
|
||||
## [0.9.20](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.19...@ali/lowcode-editor-setters@0.9.20) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@ -111,7 +117,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
# [1.0.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.14.0...@ali/lowcode-editor-setters@1.0.0) (2020-08-17)
|
||||
<a name="0.9.16"></a>
|
||||
## [0.9.16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.15...@ali/lowcode-editor-setters@0.9.16) (2020-08-19)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -6,13 +6,27 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@1.0.6-0...@ali/lowcode-editor-skeleton@1.0.7-0) (2020-09-02)
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-skeleton
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.58...@ali/lowcode-editor-skeleton@1.0.6-0) (2020-09-02)
|
||||
|
||||
|
||||
<a name="0.8.61"></a>
|
||||
## [0.8.61](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.60...@ali/lowcode-editor-skeleton@0.8.61) (2020-09-08)
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-skeleton
|
||||
|
||||
<a name="0.8.60"></a>
|
||||
## [0.8.60](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.59...@ali/lowcode-editor-skeleton@0.8.60) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-skeleton
|
||||
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.58...@ali/lowcode-editor-skeleton@1.0.6-0) (2020-09-02)
|
||||
<a name="0.8.59"></a>
|
||||
## [0.8.59](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.58...@ali/lowcode-editor-skeleton@0.8.59) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@ -75,10 +89,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-editor-skeleton
|
||||
|
||||
>>>>>>> master
|
||||
<a name="0.8.54"></a>
|
||||
## [0.8.54](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-skeleton@0.8.53...@ali/lowcode-editor-skeleton@0.8.54) (2020-08-20)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -202,41 +202,32 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
<<<<<<< HEAD
|
||||
* 🐛 fix bug of transforming type ([ebbe58d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ebbe58d))
|
||||
* 🐛 fix bug of validate schema ([3f97523](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/3f97523))
|
||||
=======
|
||||
* 🐛 fix bug of transforming type ([ebbe58d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ebbe58df70f047f4b5fe367ac4b4a08de8a65e5d))
|
||||
* 🐛 fix bug of validate schema ([3f97523](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/3f975232c7cd551bc9c74962095dcc9b127af489))
|
||||
>>>>>>> df955e1db90ff104cd11160def80113cfd6faccc
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
<<<<<<< HEAD
|
||||
* 💡 refactor with react-docgen ([64c9daa](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/64c9daa))
|
||||
=======
|
||||
* 💡 refactor with react-docgen ([64c9daa](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/64c9daa1f451fdfeab2777e4beefc5d5e1890ba1))
|
||||
>>>>>>> df955e1db90ff104cd11160def80113cfd6faccc
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
<<<<<<< HEAD
|
||||
* complete component protocol json schema & validate method ([3df360d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/3df360d))
|
||||
* immigrate aimake materialin ([44ac85f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/44ac85f))
|
||||
* import react-docgen to parse propTypes ([6e66168](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/6e66168))
|
||||
* remove -p tslint.json for test ([6d013e1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/6d013e1))
|
||||
* remove useless codes & modify generator ([dcd1b33](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/dcd1b33))
|
||||
* support multiple exported components ([db1b6de](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/db1b6de))
|
||||
=======
|
||||
* complete component protocol json schema & validate method ([3df360d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/3df360de85d425b2926ea50ff26a8df27ec36a78))
|
||||
* immigrate aimake materialin ([44ac85f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/44ac85f8a6a35bcd50f2e2b74a022e3cebe3cdef))
|
||||
* import react-docgen to parse propTypes ([6e66168](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/6e661686e4693e69279c496f3be1dd173703c55e))
|
||||
* remove -p tslint.json for test ([6d013e1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/6d013e18f93bad5647cb9ea0a497336f64e1459a))
|
||||
* remove useless codes & modify generator ([dcd1b33](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/dcd1b33d3bf8bdf5577dcc980608d9eac8d99372))
|
||||
* support multiple exported components ([db1b6de](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/db1b6deaca256b0d107fe607de6cd0fc90517a9c))
|
||||
>>>>>>> df955e1db90ff104cd11160def80113cfd6faccc
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
@ -6,13 +6,29 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@1.0.6-0...@ali/lowcode-plugin-components-pane@1.0.7-0) (2020-09-02)
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-components-pane
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.54...@ali/lowcode-plugin-components-pane@1.0.6-0) (2020-09-02)
|
||||
|
||||
<a name="0.8.57"></a>
|
||||
## [0.8.57](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.56...@ali/lowcode-plugin-components-pane@0.8.57) (2020-09-08)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-components-pane
|
||||
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.54...@ali/lowcode-plugin-components-pane@1.0.6-0) (2020-09-02)
|
||||
<a name="0.8.56"></a>
|
||||
## [0.8.56](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.55...@ali/lowcode-plugin-components-pane@0.8.56) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-components-pane
|
||||
|
||||
<a name="0.8.55"></a>
|
||||
## [0.8.55](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.54...@ali/lowcode-plugin-components-pane@0.8.55) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@ -57,10 +73,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-components-pane
|
||||
|
||||
>>>>>>> master
|
||||
<a name="0.8.50"></a>
|
||||
## [0.8.50](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.49...@ali/lowcode-plugin-components-pane@0.8.50) (2020-08-20)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
@ -133,10 +147,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-components-pane
|
||||
|
||||
>>>>>>> master
|
||||
<a name="0.8.45"></a>
|
||||
## [0.8.45](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-components-pane@0.8.44...@ali/lowcode-plugin-components-pane@0.8.45) (2020-08-14)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -20,10 +20,9 @@
|
||||
],
|
||||
"author": "xiayang.xy",
|
||||
"dependencies": {
|
||||
"@ali/lowcode-designer": "^1.0.7-0",
|
||||
"@ali/lowcode-editor-core": "^1.0.7-0",
|
||||
"@ali/lowcode-types": "^1.0.7-0",
|
||||
"@ali/ve-component-list": "^1.1.1",
|
||||
"@ali/lowcode-designer": "^1.0.8-0",
|
||||
"@ali/lowcode-editor-core": "^1.0.8-0",
|
||||
"@ali/lowcode-types": "^1.0.8-0",
|
||||
"@alifd/next": "^1.19.19",
|
||||
"react": "^16.8.1"
|
||||
},
|
||||
|
||||
116
packages/plugin-components-pane/src/components/base/index.less
Normal file
116
packages/plugin-components-pane/src/components/base/index.less
Normal file
@ -0,0 +1,116 @@
|
||||
@import "~@ali/ve-less-variables/index.less";
|
||||
|
||||
.ve-component-list {
|
||||
position: absolute;
|
||||
top: 45px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
.ve-component-list-head {
|
||||
height: 56px;
|
||||
padding: 12px;
|
||||
border-bottom: 1px solid var(--color-line-normal, rgba(31, 56, 88, 0.1));
|
||||
.ve-search-control {
|
||||
width: 256px;
|
||||
height: 32px;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
.ve-component-list-body {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
.ve-component-list-empty {
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
&.kuma-empty-data.normal .kuma-empty-data-icon {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
background-size: 100% 100%;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
.component-description-item-icon-group {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
.component-description-item-icon {
|
||||
margin-left: 4px;
|
||||
&.tag {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: rgba(249, 189, 15, 0.1);
|
||||
color: #ff6f00;
|
||||
font-size: 12px;
|
||||
width: 48px;
|
||||
height: 24px;
|
||||
}
|
||||
}
|
||||
icon {
|
||||
position: relative;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
color: rgba(31, 56, 88, 0.4);
|
||||
transition: color @transition-duration @transition-ease;
|
||||
&:hover {
|
||||
color: rgba(31, 56, 88, 0.6);
|
||||
}
|
||||
a {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
display: inline-block;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.small {
|
||||
height: calc(100% - 56px - 48px);
|
||||
}
|
||||
&.medium {
|
||||
height: calc(100% - 56px);
|
||||
}
|
||||
&.large {
|
||||
height: calc(100% - 48px);
|
||||
}
|
||||
}
|
||||
.ve-component-list-foot {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
.btn {
|
||||
margin-right: 8px;
|
||||
flex: 1;
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
.kuma-button-primary {
|
||||
background-color: var(--color-brand, @brand-color-1);
|
||||
border-color: var(--color-brand, @brand-color-1);
|
||||
border-radius: @global-border-radius;
|
||||
color: var(--color-text-reverse, @white-alpha-2);
|
||||
transition: background-color @transition-duration @transition-ease;
|
||||
&:hover {
|
||||
background-color: var(--color-brand-dark, @brand-color-3);
|
||||
border-color: var(--color-brand-dark, @brand-color-3);
|
||||
transition: background-color @transition-duration @transition-ease;
|
||||
}
|
||||
}
|
||||
&.exist {
|
||||
width: 100%;
|
||||
height: 48px;
|
||||
border-top: 1px solid var(--color-line-normal, rgba(31, 56, 88, 0.1));
|
||||
background: #fff;
|
||||
padding: 0 12px;
|
||||
}
|
||||
}
|
||||
::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
258
packages/plugin-components-pane/src/components/base/index.tsx
Normal file
258
packages/plugin-components-pane/src/components/base/index.tsx
Normal file
@ -0,0 +1,258 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Search, Box } from '@alifd/next';
|
||||
import Button from '../button';
|
||||
import Card from '../card';
|
||||
import $i18n from '../../i18n/index';
|
||||
import { searchComponent, builtinSearchMap } from '../../utils';
|
||||
import './index.less';
|
||||
|
||||
/**
|
||||
* 配置元素的操作类型
|
||||
* Draggable:可拖拽
|
||||
* Clickable:可点击
|
||||
* All:可拖拽也可点击
|
||||
*/
|
||||
export const AdditiveType = {
|
||||
Draggable: 'additive-drag',
|
||||
Clickable: 'additive-click',
|
||||
All: 'additive',
|
||||
};
|
||||
|
||||
class Base extends React.Component {
|
||||
static propTypes = {
|
||||
metaData: PropTypes.array,
|
||||
className: PropTypes.string,
|
||||
registerAdditive: PropTypes.func,
|
||||
actions: PropTypes.array,
|
||||
getComponentInfo: PropTypes.func,
|
||||
enableSearch: PropTypes.bool,
|
||||
placeholder: PropTypes.string,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
metaData: [],
|
||||
registerAdditive: () => {},
|
||||
className: '',
|
||||
renderCustomSnippet: null,
|
||||
actions: [],
|
||||
getComponentInfo: null,
|
||||
enableSearch: false,
|
||||
enableCard: true,
|
||||
enableReport: true,
|
||||
placeholder: '',
|
||||
};
|
||||
|
||||
state = {
|
||||
searchText: '',
|
||||
currentCard: null,
|
||||
target: null,
|
||||
currentCardImage: '',
|
||||
};
|
||||
|
||||
shell = null;
|
||||
isEmpty = false;
|
||||
mode = 'advance';
|
||||
searchMap = {};
|
||||
timer = null;
|
||||
isMouseEnterCard = false;
|
||||
|
||||
|
||||
UNSAFE_componentWillMount() {
|
||||
// TODO get remote search map
|
||||
this.searchMap = builtinSearchMap;
|
||||
}
|
||||
|
||||
hasActions() {
|
||||
const { actions } = this.props;
|
||||
if (!actions || !Array.isArray(actions) || !actions.length) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
onSearch(val) {
|
||||
this.setState({
|
||||
searchText: val,
|
||||
currentCard: null, // 清空卡片
|
||||
});
|
||||
}
|
||||
|
||||
normalizeBundle(mode) {
|
||||
const { metaData } = this.props;
|
||||
const { searchText = '' } = this.state;
|
||||
const groupList = metaData.filter((comp, index) => {
|
||||
const { title = '', componentName = '', id = '' } = comp;
|
||||
if (!id) {
|
||||
comp.id = `${comp.componentName}_${index}`;
|
||||
}
|
||||
const query = searchText.toLowerCase();
|
||||
return (
|
||||
!![title, componentName].find(
|
||||
(it) => it.toLowerCase().indexOf(query) > -1
|
||||
) || !!searchComponent(title, query, this.searchMap)
|
||||
);
|
||||
});
|
||||
|
||||
if (mode === 'simple') {
|
||||
return groupList;
|
||||
}
|
||||
|
||||
const bundle = {};
|
||||
// 按一定顺序排列
|
||||
groupList.forEach((m) => {
|
||||
const c = m.category || 'Others';
|
||||
if (!bundle[c]) {
|
||||
bundle[c] = [];
|
||||
}
|
||||
bundle[c].push(m);
|
||||
});
|
||||
return bundle;
|
||||
}
|
||||
|
||||
renderEmptyData() {
|
||||
this.isEmpty = true;
|
||||
return (
|
||||
<Box direction="column" justify="center" align="center" className="ve-component-list-empty">
|
||||
<img src="//g.alicdn.com/uxcore/pic/empty.png" style={{ height: 100, width: 100 }} />
|
||||
<div style={{ lineHeight: 2 }}>
|
||||
<div>暂无组件,请在物料站点添加</div>
|
||||
</div>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
renderHeader() {
|
||||
const { placeholder } = this.props;
|
||||
return (
|
||||
<Search
|
||||
placeholder={placeholder || $i18n.get({ id: 'trunkPaneSearchComponent', dm: '搜索组件' })}
|
||||
shape="simple"
|
||||
size="medium"
|
||||
hasClear
|
||||
defaultValue={this.state.searchText}
|
||||
onChange={this.onSearch.bind(this)}
|
||||
onSearch={this.onSearch.bind(this)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
renderActions() {
|
||||
const { actions = [] } = this.props;
|
||||
if (!this.hasActions()) {
|
||||
return null;
|
||||
}
|
||||
// const len = actions.length;
|
||||
// TODO:len = 1:只有一个主按钮;len = 2:一个主按钮、一个次按钮;len >=3:一个主按钮、一个次按钮、其余放在按钮组里;
|
||||
return actions.map((action, idx) => {
|
||||
return (
|
||||
<Button
|
||||
key={idx}
|
||||
action={action}
|
||||
className="btn"
|
||||
type={idx === 0 ? 'primary' : 'outline'}
|
||||
>
|
||||
{action.title}
|
||||
</Button>
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
renderBundle() {
|
||||
const { metaData } = this.props;
|
||||
if (!metaData || !Array.isArray(metaData) || !metaData.length) {
|
||||
return this.renderEmptyData();
|
||||
}
|
||||
const bundle = this.normalizeBundle(this.mode);
|
||||
if (!Object.keys(bundle).length || (Array.isArray(bundle) && bundle.length === 0)) {
|
||||
return this.renderEmptyData();
|
||||
}
|
||||
this.isEmpty = false;
|
||||
return this.getBundle ? this.getBundle(bundle) : this.renderEmptyData();
|
||||
}
|
||||
|
||||
renderCard() {
|
||||
const { currentCard, target, currentCardImage } = this.state;
|
||||
const { getComponentInfo } = this.props;
|
||||
|
||||
if (!currentCard || !getComponentInfo) return null;
|
||||
|
||||
return (
|
||||
<Card
|
||||
componentPrototype={currentCard}
|
||||
target={target}
|
||||
customImage={currentCardImage}
|
||||
subTitle={target ? target.innerText : ''}
|
||||
position="right top"
|
||||
visible={!!currentCard}
|
||||
showClose
|
||||
getComponentInfo={getComponentInfo}
|
||||
onHide={() => {
|
||||
this.setState({ currentCard: null });
|
||||
this.isMouseEnterCard = false;
|
||||
}}
|
||||
offset={{
|
||||
top: 10,
|
||||
left: 10,
|
||||
}}
|
||||
onMouseEnter={() => {
|
||||
this.isMouseEnterCard = true;
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
enableSearch,
|
||||
className,
|
||||
registerAdditive = () => {
|
||||
|
||||
},
|
||||
} = this.props;
|
||||
let bodyExtraClass = '';
|
||||
if (this.hasActions() && enableSearch) {
|
||||
bodyExtraClass = 'small';
|
||||
} else if (!this.hasActions() && enableSearch) {
|
||||
bodyExtraClass = 'medium';
|
||||
} else if (this.hasActions() && !enableSearch) {
|
||||
bodyExtraClass = 'large';
|
||||
} else {
|
||||
bodyExtraClass = '';
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`ve-component-list ${className}`}>
|
||||
{enableSearch ? (
|
||||
<div className="ve-component-list-head">
|
||||
{this.renderHeader()}
|
||||
</div>
|
||||
) : null}
|
||||
<div
|
||||
className={`ve-component-list-body ${bodyExtraClass}`}
|
||||
ref={(shell) => {
|
||||
if (this.shell || !shell || this.isEmpty) {
|
||||
return;
|
||||
}
|
||||
if (!this.shell) {
|
||||
this.shell = shell;
|
||||
}
|
||||
registerAdditive(shell);
|
||||
}}
|
||||
>
|
||||
{this.renderBundle()}
|
||||
</div>
|
||||
<div
|
||||
className={`ve-component-list-foot ${
|
||||
this.hasActions() ? 'exist' : ''
|
||||
}`}
|
||||
>
|
||||
{this.renderActions()}
|
||||
</div>
|
||||
{this.renderCard ? this.renderCard() : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Base;
|
||||
@ -0,0 +1,18 @@
|
||||
.ve-component-list {
|
||||
.kuma-button-outline {
|
||||
border-color: #0079f2;
|
||||
color: #0079f2;
|
||||
&:hover {
|
||||
border-color: #0079f2;
|
||||
color: #0079f2;
|
||||
background-color: #f0f7ff;
|
||||
}
|
||||
&.kuma-button-danger {
|
||||
border-color: #f04631;
|
||||
color: #f04631;
|
||||
&:hover {
|
||||
background-color: rgba(240, 70, 49, 0.06);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
import { Button } from '@ali/vu-uxcore-legao-design';
|
||||
import './index.less';
|
||||
|
||||
const MyButton = (props) => {
|
||||
const { action, componentPrototype, type, className } = props;
|
||||
return (
|
||||
<Button
|
||||
className={className}
|
||||
type={type || action.type || 'outline'}
|
||||
danger={action.danger || false}
|
||||
onClick={() => {
|
||||
if (action.fn && typeof action.fn === 'function') {
|
||||
action.fn(componentPrototype);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{action.title}
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
export default MyButton;
|
||||
130
packages/plugin-components-pane/src/components/card/index.less
Normal file
130
packages/plugin-components-pane/src/components/card/index.less
Normal file
@ -0,0 +1,130 @@
|
||||
@import "~@ali/ve-less-variables/index.less";
|
||||
|
||||
.ve-card-wrapper {
|
||||
width: 320px;
|
||||
max-height: 360px;
|
||||
overflow: auto;
|
||||
justify-content: center;
|
||||
|
||||
&.ve-card-wrapper-loading {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ve-card-top {
|
||||
height: 186px;
|
||||
background: rgba(31, 56, 88, 0.1);
|
||||
padding: 16px;
|
||||
|
||||
.ve-card-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-bottom: 12px;
|
||||
position: relative;
|
||||
height: 31px;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
|
||||
.title {
|
||||
line-height: 22px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.version {
|
||||
margin-left: 8px;
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
color: rgba(31, 56, 88, 0.4);
|
||||
}
|
||||
}
|
||||
|
||||
.ve-card-image-wrapper {
|
||||
background-color: #fff;
|
||||
.ve-card-image {
|
||||
max-width: 100%;
|
||||
height: 120px;
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ve-card-bottom {
|
||||
padding: 8px 16px 16px 16px;
|
||||
.ve-card-description {
|
||||
user-select: text;
|
||||
text-align: left;
|
||||
line-height: 18px;
|
||||
font-size: 12px;
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
letter-spacing: 0;
|
||||
line-height: 18px;
|
||||
width: 280px;
|
||||
|
||||
p {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.ve-operation-container {
|
||||
margin-top: 12px;
|
||||
position: relative;
|
||||
.actions {
|
||||
margin-top: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ve-operation-item {
|
||||
color: @brand-color-1;
|
||||
cursor: pointer;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.ve-operation-delete {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.ve-card-more-operation {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
> a {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.ve-loading-icon {
|
||||
animation: spining 0.9s infinite linear;
|
||||
}
|
||||
.ve-loading-content {
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ve-card-action {
|
||||
padding: 0 8px !important;
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.ve-component-list {
|
||||
.vu-layer {
|
||||
border-radius: 4px !important;
|
||||
.vu-layer-content {
|
||||
padding-top: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.vu-layer .vu-layer-close {
|
||||
right: 9px !important;
|
||||
top: 9px !important;
|
||||
}
|
||||
}
|
||||
141
packages/plugin-components-pane/src/components/card/index.tsx
Normal file
141
packages/plugin-components-pane/src/components/card/index.tsx
Normal file
@ -0,0 +1,141 @@
|
||||
import React from 'react';
|
||||
import Layer from '@ali/vu-layer';
|
||||
import { Icon } from '@alifd/next';
|
||||
import $i18n from '../../i18n/index';
|
||||
import Button from '../button';
|
||||
import './index.less';
|
||||
|
||||
export default class Card extends React.Component {
|
||||
static propTypes = {};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
isLoading: true,
|
||||
errorMsg: false,
|
||||
componentInfo: {},
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (!this.props.getComponentInfo) return;
|
||||
this.loadComponentInfo(this.props.componentPrototype);
|
||||
}
|
||||
|
||||
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.componentPrototype !== this.props.componentPrototype) {
|
||||
// 延迟执行数据加载和渲染,等 props 更新之后
|
||||
this.loadComponentInfo(nextProps.componentPrototype);
|
||||
}
|
||||
}
|
||||
|
||||
loadComponentInfo(componentPrototype) {
|
||||
if (!this.props.getComponentInfo) return;
|
||||
this.setState({ isLoading: true });
|
||||
this.props
|
||||
.getComponentInfo(componentPrototype)
|
||||
.then((componentInfo) => {
|
||||
this.setState({
|
||||
componentInfo,
|
||||
isLoading: false,
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
this.setState({ errorMsg: e.message });
|
||||
console.error(e);
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { componentPrototype, subTitle, customImage } = this.props;
|
||||
const { componentInfo } = this.state;
|
||||
|
||||
const loadingContent = this.state.errorMsg ? (
|
||||
<div>
|
||||
<div className="ve-loading-content">{this.state.errorMsg}</div>
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
<Icon type="loading" className="ve-loading-icon" size="large" />
|
||||
<div className="ve-loading-content">
|
||||
{$i18n.get({ id: 'trunkPaneLoading', dm: '加载中...' })}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
const {
|
||||
title,
|
||||
version,
|
||||
image = 'https://img.alicdn.com/tfs/TB1XHG6ehrI8KJjy0FpXXb5hVXa-740-608.png',
|
||||
desc,
|
||||
detailUrl,
|
||||
actions,
|
||||
} = componentInfo;
|
||||
|
||||
let layerContent = null;
|
||||
const cardTitle = subTitle && !subTitle.includes(title) ? `${title}(${subTitle})` : title;
|
||||
|
||||
if (this.state.isLoading) {
|
||||
layerContent = (
|
||||
<div className="ve-card-wrapper ve-card-wrapper-loading" onMouseEnter={this.props.onMouseEnter}>
|
||||
{loadingContent}
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
layerContent = (
|
||||
<div className="ve-card-wrapper" onMouseEnter={this.props.onMouseEnter}>
|
||||
<div className="ve-card-top">
|
||||
<div className="ve-card-title">
|
||||
<span className="title">{cardTitle}</span>
|
||||
<span className="version">{version}</span>
|
||||
</div>
|
||||
<div className="ve-card-image-wrapper">
|
||||
<img src={customImage && typeof customImage === 'string' ? customImage : image} alt={cardTitle} className="ve-card-image" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="ve-card-bottom">
|
||||
<div className="ve-card-description">
|
||||
<p>{desc}</p>
|
||||
</div>
|
||||
<div className="ve-operation-container">
|
||||
{detailUrl ? (
|
||||
<a
|
||||
href={detailUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="ve-operation-item"
|
||||
>
|
||||
{$i18n.get({
|
||||
id: 'trunkPaneDetailedDocumentation',
|
||||
dm: '详细文档',
|
||||
})}
|
||||
</a>
|
||||
) : null}
|
||||
<div className="actions">
|
||||
{
|
||||
actions ? actions.map((action, idx) => {
|
||||
return (
|
||||
<Button
|
||||
key={idx}
|
||||
className="ve-card-action"
|
||||
action={action}
|
||||
componentPrototype={componentPrototype}
|
||||
/>
|
||||
);
|
||||
}) : null
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Layer {...this.props} noLimitOnMaxHeight>
|
||||
{layerContent}
|
||||
</Layer>
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
@import "~@ali/ve-less-variables/index.less";
|
||||
|
||||
@text-color-active: #0079f2;
|
||||
|
||||
.ve-component-list {
|
||||
.ve-component-list-body {
|
||||
.ve-component-list-sidebar {
|
||||
flex: 0 0 110px;
|
||||
width: 110px;
|
||||
// height: 100%;
|
||||
padding-top: 11px;
|
||||
border-right: 1px solid var(--color-line-normal, rgba(31, 56, 88, 0.1));
|
||||
overflow: auto;
|
||||
.ve-component-list-navigator {
|
||||
.navigator-group {
|
||||
margin-bottom: 8px;
|
||||
& > div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
.navigator-group-head {
|
||||
padding: 0px 12px;
|
||||
color: @dark-alpha-2;
|
||||
.navigator-group-title {
|
||||
padding: 4px 0;
|
||||
width: 100%;
|
||||
line-height: 16px;
|
||||
font-size: @fontSize-5;
|
||||
font-weight: 700;
|
||||
border-bottom: 1px solid
|
||||
var(--color-line-normal, rgba(31, 56, 88, 0.1));
|
||||
}
|
||||
}
|
||||
.navigator-group-item {
|
||||
height: 32px;
|
||||
padding: 8px 12px;
|
||||
color: #666666;
|
||||
cursor: pointer;
|
||||
.navigator-group-item-title {
|
||||
font-size: @fontSize-5;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
text-align: left;
|
||||
}
|
||||
&:hover {
|
||||
color: @text-color-active;
|
||||
}
|
||||
&.active {
|
||||
background: rgba(0, 121, 242, 0.1);
|
||||
color: @text-color-active;
|
||||
border-right: 2px solid @text-color-active;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.ve-component-list-content {
|
||||
flex: 1;
|
||||
width: 250px;
|
||||
// height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
.component-description-list {
|
||||
padding: 10px 4px;
|
||||
.component-description-item {
|
||||
padding-bottom: 24px;
|
||||
.component-description-item-header {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
.component-description-item-title {
|
||||
font-family: @font-family;
|
||||
font-size: @fontSize-5;
|
||||
font-weight: 700;
|
||||
color: @text-color;
|
||||
line-height: 20px;
|
||||
padding-left: 8px;
|
||||
}
|
||||
.component-description-item-icon-group {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
.component-description-item-icon {
|
||||
margin-left: 4px;
|
||||
}
|
||||
icon {
|
||||
position: relative;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
color: rgba(31, 56, 88, 0.4);
|
||||
transition: color @transition-duration @transition-ease;
|
||||
&:hover {
|
||||
color: rgba(31, 56, 88, 0.6);
|
||||
}
|
||||
a {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
display: inline-block;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.component-description-item-snippets {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
flex-flow: row wrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,278 @@
|
||||
import Base, { AdditiveType } from '../base/index';
|
||||
import Snippet from '../snippet';
|
||||
import './index.less';
|
||||
|
||||
// 滚动事件触发灵敏度
|
||||
const OFFSET_ACCURCY = 25;
|
||||
|
||||
const categoryMap = {
|
||||
General: '常用',
|
||||
Navigation: '导航',
|
||||
DataEntry: '输入',
|
||||
DataDisplay: '展示',
|
||||
Feedback: '反馈',
|
||||
Util: '工具',
|
||||
Chart: '图表',
|
||||
Others: '其他',
|
||||
};
|
||||
|
||||
export default class ComponentList extends Base {
|
||||
static displayName = 'ComponentList';
|
||||
|
||||
descRefList = new Map();
|
||||
navRefList = new Map();
|
||||
descHeightList = new Map();
|
||||
snippetMap = new Map();
|
||||
currentScrollHeight = 0;
|
||||
scrollFlag = true;
|
||||
scroll;
|
||||
scrollTimer;
|
||||
state = {
|
||||
selected: '',
|
||||
searchText: '',
|
||||
currentCard: null,
|
||||
currentCardImage: '',
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
setTimeout(() => {
|
||||
this.calDescHeightList();
|
||||
|
||||
// mock 滚动结束事件
|
||||
if (this.scroll) {
|
||||
this.scroll.addEventListener('scroll', this.handleScrollEnd);
|
||||
}
|
||||
}, 20);
|
||||
const bundle = this.normalizeBundle();
|
||||
if (!bundle) {
|
||||
return;
|
||||
}
|
||||
const cats = Object.keys(bundle);
|
||||
if (cats.length > 0) {
|
||||
const k = cats[0];
|
||||
const comps = bundle[k];
|
||||
if (!comps || !Array.isArray(comps) || !comps.length) {
|
||||
return;
|
||||
}
|
||||
this.setState({ selected: comps[0].id });
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.scroll) {
|
||||
this.scroll.removeEventListener('scroll', this.handleScrollEnd);
|
||||
}
|
||||
}
|
||||
|
||||
handleScrollEnd = () => {
|
||||
clearTimeout(this.scrollTimer);
|
||||
this.scrollTimer = setTimeout(() => {
|
||||
// 滚动结束时归位
|
||||
this.scrollFlag = true;
|
||||
}, 100);
|
||||
};
|
||||
|
||||
toggleComponent(id) {
|
||||
const element = this.descRefList.get(id);
|
||||
// 切换组件时滚动事件回调不可用
|
||||
this.scrollFlag = false;
|
||||
element.scrollIntoView();
|
||||
this.setState({ selected: id });
|
||||
}
|
||||
|
||||
handleScroll(e) {
|
||||
// 清空卡片
|
||||
if (this.state.currentCard) {
|
||||
this.setState({ currentCard: null });
|
||||
}
|
||||
clearTimeout(this.timer);
|
||||
this.timer = null;
|
||||
|
||||
if (!this.scrollFlag) {
|
||||
return;
|
||||
}
|
||||
const element = e.target;
|
||||
const { scrollTop } = element;
|
||||
|
||||
// 延迟处理
|
||||
if (Math.abs(scrollTop - this.currentScrollHeight) < OFFSET_ACCURCY) {
|
||||
return;
|
||||
}
|
||||
this.currentScrollHeight = scrollTop;
|
||||
|
||||
// 处理导航块滚动高亮效果
|
||||
const heightList = [...this.descHeightList.entries()];
|
||||
let selected;
|
||||
// 当在顶部
|
||||
if (scrollTop >= 0 && scrollTop < heightList[0][1]) {
|
||||
selected = heightList[0][0];
|
||||
} else if (scrollTop >= heightList[heightList.length - 1][1]) {
|
||||
// 底部
|
||||
selected = heightList[heightList.length - 1][0];
|
||||
} else {
|
||||
// 当在中部
|
||||
for (let i = 0; i < heightList.length - 2; i++) {
|
||||
const height1 = heightList[i][1];
|
||||
const height2 = heightList[i + 1][1];
|
||||
if (scrollTop > height1 && scrollTop < height2) {
|
||||
selected = heightList[i + 1][0];
|
||||
}
|
||||
}
|
||||
}
|
||||
this.fixSideBarView(selected);
|
||||
this.setState({ selected });
|
||||
}
|
||||
|
||||
// 导航高亮块超出视口时滚动
|
||||
fixSideBarView(selected) {
|
||||
const nav = this.navRefList.get(selected);
|
||||
if (nav) {
|
||||
nav.scrollIntoView({ block: 'center' });
|
||||
}
|
||||
}
|
||||
|
||||
calDescHeightList() {
|
||||
let height = 0;
|
||||
this.descRefList.forEach((ele, key) => {
|
||||
if (!ele) {
|
||||
return;
|
||||
}
|
||||
height += ele.clientHeight;
|
||||
this.descHeightList.set(key, height);
|
||||
});
|
||||
}
|
||||
|
||||
renderNavigator(bundle) {
|
||||
return (
|
||||
<div className="ve-component-list-navigator">
|
||||
{Object.keys(bundle).map((c) => {
|
||||
const catTitle = categoryMap[c] || c;
|
||||
const catData = bundle[c];
|
||||
return this.renderNavigatorGroup(catTitle, catData);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
renderNavigatorGroup(title, metaData) {
|
||||
const { selected } = this.state;
|
||||
if (!metaData) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<div className="navigator-group" key={title}>
|
||||
<div className="navigator-group-head">
|
||||
<div className="navigator-group-title">{title}</div>
|
||||
</div>
|
||||
{metaData.map((comp) => (
|
||||
<div
|
||||
className={`navigator-group-item ${AdditiveType.Draggable} ${
|
||||
selected === comp.id ? 'active' : ''
|
||||
}`}
|
||||
key={comp.id}
|
||||
data-id={
|
||||
(comp.snippets && comp.snippets[0] && comp.snippets[0].id) || ''
|
||||
}
|
||||
ref={(item) => {
|
||||
this.navRefList.set(comp.id, item);
|
||||
}}
|
||||
onClick={() => this.toggleComponent(comp.id)}
|
||||
>
|
||||
<span className="navigator-group-item-title">{comp.title}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
renderComponentDescriptionList(bundle) {
|
||||
const { renderCustomSnippet = '', enableCard = true } = this.props;
|
||||
return (
|
||||
<div className="component-description-list">
|
||||
{Object.keys(bundle).map((cat) => {
|
||||
const catData = bundle[cat];
|
||||
if (!catData) {
|
||||
return null;
|
||||
}
|
||||
return catData.map((comp) => (
|
||||
<div
|
||||
className="component-description-item"
|
||||
key={comp.id}
|
||||
ref={(item) => {
|
||||
this.descRefList.set(comp.id, item);
|
||||
}}
|
||||
>
|
||||
<div className="component-description-item-header">
|
||||
{comp.title ? (
|
||||
<div className="component-description-item-title">
|
||||
{comp.title}
|
||||
</div>
|
||||
) : null}
|
||||
<div className="component-description-item-icon-group" />
|
||||
</div>
|
||||
<div className="component-description-item-snippets">
|
||||
{comp.snippets &&
|
||||
comp.snippets.map((snippet, idx) => (
|
||||
<div
|
||||
key={`${comp.id}-${idx}`}
|
||||
ref={(i) => {
|
||||
this.snippetMap.set(`${comp.id}-${idx}`, i);
|
||||
}}
|
||||
onMouseEnter={() => {
|
||||
if (!enableCard) {
|
||||
return;
|
||||
}
|
||||
this.timer = setTimeout(() => {
|
||||
this.setState({
|
||||
currentCard: comp,
|
||||
target: this.snippetMap.get(`${comp.id}-${idx}`),
|
||||
currentCardImage: snippet.thumbnail,
|
||||
});
|
||||
this.timer = null;
|
||||
}, 1000);
|
||||
}}
|
||||
onMouseLeave={() => {
|
||||
if (!enableCard) {
|
||||
return;
|
||||
}
|
||||
clearTimeout(this.timer);
|
||||
this.timer = null;
|
||||
setTimeout(() => {
|
||||
if (this.isMouseEnterCard) {
|
||||
return;
|
||||
}
|
||||
this.setState({ currentCard: null });
|
||||
}, 200);
|
||||
}}
|
||||
>
|
||||
<Snippet
|
||||
key={idx}
|
||||
snippet={snippet}
|
||||
renderCustomSnippet={renderCustomSnippet}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
));
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
getBundle(bundle) {
|
||||
return [
|
||||
<div className="ve-component-list-sidebar" key="sidebar">
|
||||
{this.renderNavigator(bundle)}
|
||||
</div>,
|
||||
<div
|
||||
key="content"
|
||||
className="ve-component-list-content"
|
||||
onScroll={(e) => this.handleScroll(e)}
|
||||
ref={(scroll) => { this.scroll = scroll; }}
|
||||
>
|
||||
{this.renderComponentDescriptionList(bundle)}
|
||||
</div>,
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,120 @@
|
||||
@import "~@ali/ve-less-variables/index.less";
|
||||
|
||||
@text-color-active: #0079f2;
|
||||
|
||||
.component-description-item-snippet {
|
||||
position: relative;
|
||||
&.small {
|
||||
width: 64px;
|
||||
height: 66px;
|
||||
.snippet-thumbnail {
|
||||
height: 40px;
|
||||
img,
|
||||
.icon {
|
||||
max-width: 56px;
|
||||
max-height: 32px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.large {
|
||||
width: 132px;
|
||||
height: 126px;
|
||||
.snippet-thumbnail {
|
||||
height: 100px;
|
||||
img,
|
||||
.icon {
|
||||
max-width: 116px;
|
||||
max-height: 83px;
|
||||
}
|
||||
}
|
||||
}
|
||||
margin: 12px 8px 0 8px;
|
||||
cursor: grab;
|
||||
.snippet-title {
|
||||
width: 100%;
|
||||
padding: 0 4px;
|
||||
font-size: @fontSize-5;
|
||||
color: #666666;
|
||||
text-align: center;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
.snippet-thumbnail {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
margin-bottom: 9px;
|
||||
border-radius: @global-border-radius;
|
||||
border: 1px dashed #cdd2d9;
|
||||
transition: border @transition-duration @transition-ease;
|
||||
img,
|
||||
.icon {
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
svg {
|
||||
font-size: 28px;
|
||||
}
|
||||
svg * {
|
||||
fill: rgba(31, 56, 88, 0.6) !important;
|
||||
}
|
||||
}
|
||||
.component-description-item-icon {
|
||||
&.tag {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: rgba(249, 189, 15, 0.1);
|
||||
color: #ff6f00;
|
||||
font-size: 12px;
|
||||
border-radius: 3px;
|
||||
width: 48px;
|
||||
height: 24px;
|
||||
}
|
||||
}
|
||||
.engine-additive-helper {
|
||||
&.left-top {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
&.right-top {
|
||||
display: none;
|
||||
}
|
||||
icon {
|
||||
position: relative;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
color: rgba(31, 56, 88, 0.4);
|
||||
transition: color @transition-duration @transition-ease;
|
||||
&:hover {
|
||||
color: rgba(31, 56, 88, 0.6);
|
||||
}
|
||||
a {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
display: inline-block;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
.snippet-thumbnail {
|
||||
border: 2px solid @text-color-active;
|
||||
transition: border @transition-duration @transition-ease;
|
||||
}
|
||||
.right-top {
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
import { Fragment } from 'react';
|
||||
import { Icon } from '@alifd/next';
|
||||
import { AdditiveType } from '../base';
|
||||
import './index.less';
|
||||
|
||||
const Snippet = (props) => {
|
||||
const {
|
||||
snippet,
|
||||
renderCustomSnippet = '',
|
||||
size = 'small',
|
||||
actionsInLT,
|
||||
actionsInRT,
|
||||
} = props;
|
||||
const {
|
||||
thumbnail = 'https://img.alicdn.com/tfs/TB1XHG6ehrI8KJjy0FpXXb5hVXa-740-608.png',
|
||||
description,
|
||||
title = '未知',
|
||||
} = snippet;
|
||||
const snippetClassName = `component-description-item-snippet ${AdditiveType.All} ${size}`;
|
||||
return (
|
||||
<div className={snippetClassName} key={snippet.id} data-id={snippet.id}>
|
||||
{typeof renderCustomSnippet === 'function' ? (
|
||||
renderCustomSnippet(snippet)
|
||||
) : (
|
||||
<Fragment>
|
||||
<div className="snippet-thumbnail">
|
||||
{typeof thumbnail === 'string' && thumbnail.startsWith('http') ? (
|
||||
<img alt="thumbnail" src={thumbnail} />
|
||||
) : (
|
||||
<Icon className="icon" type={thumbnail || 'help'} />
|
||||
)}
|
||||
</div>
|
||||
<div className="snippet-title">{description || title}</div>
|
||||
<div className="engine-additive-helper left-top">
|
||||
{actionsInLT || null}
|
||||
</div>
|
||||
<div className="engine-additive-helper right-top">
|
||||
{actionsInRT || null}
|
||||
</div>
|
||||
</Fragment>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Snippet;
|
||||
45
packages/plugin-components-pane/src/i18n/index.ts
Normal file
45
packages/plugin-components-pane/src/i18n/index.ts
Normal file
@ -0,0 +1,45 @@
|
||||
const { provideIntl, destroyIntl } = require('@ali/intl-universal');
|
||||
const strings = require('./strings');
|
||||
|
||||
let intl;
|
||||
const MEDUSA_APP_NAME = 'legao-designer';
|
||||
const PSEUDO_LANGUAGE_TAG = 'pd-KV';
|
||||
const CURRENT_LANGUAGE = (window.locale || '').replace(/_/, '-') || 'zh-CN';
|
||||
|
||||
function update(language) {
|
||||
destroyIntl();
|
||||
intl = provideIntl({
|
||||
locale: language,
|
||||
messagesAIO: strings,
|
||||
});
|
||||
}
|
||||
|
||||
function get(id, variable) {
|
||||
if (!intl) update();
|
||||
let string = '';
|
||||
let key = '';
|
||||
if (typeof id === 'string') {
|
||||
key = id;
|
||||
string = intl.formatMessage({ id }, variable);
|
||||
}
|
||||
if (typeof id === 'object' && id.dm) {
|
||||
id.defaultMessage = id.dm;
|
||||
}
|
||||
key = id.id;
|
||||
string = intl.formatMessage(id, variable);
|
||||
if (CURRENT_LANGUAGE === PSEUDO_LANGUAGE_TAG) {
|
||||
return `##@@@${key}##${MEDUSA_APP_NAME}@@@##${string}`;
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
if (PSEUDO_LANGUAGE_TAG === CURRENT_LANGUAGE) {
|
||||
update('en-US');
|
||||
} else {
|
||||
update(CURRENT_LANGUAGE);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
get,
|
||||
update,
|
||||
};
|
||||
27
packages/plugin-components-pane/src/i18n/strings/en-US.json
Normal file
27
packages/plugin-components-pane/src/i18n/strings/en-US.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"trunkPaneTheComponentPrototypeView": "The component prototype view does not exist and may be caused by the following reasons:",
|
||||
"trunkPaneDetailedComponentInformationIs": "Detailed component information is already printed in the Console",
|
||||
"trunkPaneIsTheComponentRemoved": "Is the component removed because the component cannot find the prototype view?",
|
||||
"trunkPaneLoading": "Loading...",
|
||||
"trunkPaneFoundComponentNameRComponentName": "Found component name: {rComponentName} has a problem",
|
||||
"trunkPaneDetailedDocumentation": "Detailed documentation",
|
||||
"trunkPaneComponentComponentInfoComponentNameDeletedSuccessfully": "Component {componentInfoComponentName} deleted successfully",
|
||||
"trunkPaneUpdateComponent": "Update component",
|
||||
"trunkPaneComponentLibrary": "Component library",
|
||||
"trunkPaneSearchComponent": "Search component",
|
||||
"trunkPaneCustomize": "customize",
|
||||
"trunkPaneTheComponentInQuestion": "The component in question:",
|
||||
"trunkPaneComponentMarket": "Component market",
|
||||
"trunkPaneUncategorized": "uncategorized",
|
||||
"trunkPaneNoSearchResultsYet": "No search results yet",
|
||||
"trunkPaneAll": "All",
|
||||
"trunkPaneClickToTheLEGO": "Click ? to the Component Center",
|
||||
"trunkPaneClickToTroubleshootThe": "Click to troubleshoot the issue",
|
||||
"trunkPaneComponent": "Component",
|
||||
"trunkPaneComponentCenter": "Component center",
|
||||
"trunkPaneClose": "╳ Close",
|
||||
"trunkPaneDetail": "Detail",
|
||||
"trunkPaneEdit": "Edit",
|
||||
"trunkPaneDev": "Dev",
|
||||
"trunkPaneHelp": "Help"
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
'en-US': require('./en-US.json'),
|
||||
'zh-CN': require('./zh-CN.json'),
|
||||
};
|
||||
26
packages/plugin-components-pane/src/i18n/strings/zh-CN.json
Normal file
26
packages/plugin-components-pane/src/i18n/strings/zh-CN.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"trunkPaneAll": "全部",
|
||||
"trunkPaneFoundComponentNameRComponentName": "发现组件名为:{rComponentName}存在问题",
|
||||
"trunkPaneNoResultsYet": "暂无结果",
|
||||
"trunkPaneUpdateComponent": "更新组件",
|
||||
"trunkPaneClickToTroubleshootThe": "点击排查问题",
|
||||
"trunkPaneClickToTheLEGO": "点击 ? 前往组件中心",
|
||||
"trunkPaneComponentLibrary": "组件库",
|
||||
"trunkPaneComponentCenter": "组件中心",
|
||||
"trunkPaneDetailedComponentInformationIs": "详细的组件信息已经打印在 Console 中",
|
||||
"trunkPaneTheComponentPrototypeView": "组件原型视图不存在,可能由以下原因导致:",
|
||||
"trunkPaneLoading": "加载中...",
|
||||
"trunkPaneTheComponentInQuestion": "存在问题的组件:",
|
||||
"trunkPaneIsTheComponentRemoved": "由于该组件找不到原型视图,是否移除组件?",
|
||||
"trunkPaneDetailedDocumentation": "详细文档",
|
||||
"trunkPaneUncategorized": "未分类",
|
||||
"trunkPaneComponentMarket": "组件市场",
|
||||
"trunkPaneCustomize": "自定义",
|
||||
"trunkPaneSearchComponent": "搜索组件",
|
||||
"trunkPaneComponent": "组件",
|
||||
"trunkPaneClose": "╳ 关闭",
|
||||
"trunkPaneDetail": "详情",
|
||||
"trunkPaneEdit": "编辑",
|
||||
"detrunkPaneDev": "开发版",
|
||||
"trunkPaneHelp": "帮助"
|
||||
}
|
||||
@ -1,12 +1,15 @@
|
||||
import { Component, ReactNode } from 'react';
|
||||
import ComponentList, { AdditiveType } from '@ali/ve-component-list';
|
||||
import { Tab } from '@alifd/next';
|
||||
import ComponentList from './components/component-list';
|
||||
import { AdditiveType } from './components/base';
|
||||
import { PluginProps } from '@ali/lowcode-types';
|
||||
import { Designer } from '@ali/lowcode-designer';
|
||||
|
||||
import './index.scss';
|
||||
|
||||
export interface IState {
|
||||
metaData: object[];
|
||||
metaData: Record<string, unknown>[];
|
||||
bizComponents: Record<string, unknown>[];
|
||||
}
|
||||
|
||||
export default class ComponentListPlugin extends Component<PluginProps, IState> {
|
||||
@ -18,6 +21,7 @@ export default class ComponentListPlugin extends Component<PluginProps, IState>
|
||||
super(props);
|
||||
this.state = {
|
||||
metaData: [],
|
||||
bizComponents: [],
|
||||
};
|
||||
}
|
||||
|
||||
@ -31,7 +35,7 @@ export default class ComponentListPlugin extends Component<PluginProps, IState>
|
||||
}
|
||||
|
||||
transformMetaData(componentList: any): any {
|
||||
const metaData: object[] = [];
|
||||
const metaData: Record<string, unknown>[] = [];
|
||||
componentList.forEach((category: any, categoryId: number) => {
|
||||
if (Array.isArray(category?.children)) {
|
||||
category.children.forEach((comp: any, compId: number) => {
|
||||
@ -61,9 +65,11 @@ export default class ComponentListPlugin extends Component<PluginProps, IState>
|
||||
const { editor } = this.props;
|
||||
const assets = editor.get('assets') || {};
|
||||
const metaData = this.transformMetaData(assets.componentList);
|
||||
const bizComponents = this.transformMetaData(assets.bizComponentList);
|
||||
|
||||
this.setState({
|
||||
metaData,
|
||||
bizComponents,
|
||||
});
|
||||
};
|
||||
|
||||
@ -92,20 +98,7 @@ export default class ComponentListPlugin extends Component<PluginProps, IState>
|
||||
return;
|
||||
}
|
||||
|
||||
const click = (e: Event) => {
|
||||
if (
|
||||
(e.target.tagName === 'ICON'
|
||||
&& e.target.parentNode
|
||||
&& e.target.parentNode.classList.contains('engine-additive-helper'))
|
||||
|| e.target.classList.contains('engine-additive-helper')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const snippetId = getSnippetId(e.target, AdditiveType.Clickable);
|
||||
if (!snippetId || !this.snippetsMap.get(snippetId)) {
|
||||
|
||||
}
|
||||
};
|
||||
const click = (e: Event) => { console.log(e); };
|
||||
|
||||
shell.addEventListener('click', click);
|
||||
|
||||
@ -126,15 +119,27 @@ export default class ComponentListPlugin extends Component<PluginProps, IState>
|
||||
}
|
||||
|
||||
render(): ReactNode {
|
||||
const { metaData } = this.state;
|
||||
const { metaData, bizComponents } = this.state;
|
||||
return (
|
||||
<div className="lowcode-component-list">
|
||||
<ComponentList
|
||||
key="component-pane"
|
||||
metaData={metaData}
|
||||
registerAdditive={(shell: Element | null) => this.registerAdditive(shell)}
|
||||
enableSearch
|
||||
/>
|
||||
<Tab>
|
||||
<Tab.Item title="基础组件" key="base-components">
|
||||
<ComponentList
|
||||
key="component-pane"
|
||||
metaData={metaData}
|
||||
registerAdditive={(shell: Element | null) => this.registerAdditive(shell)}
|
||||
enableSearch
|
||||
/>
|
||||
</Tab.Item>
|
||||
<Tab.Item title="业务组件" key="biz-components">
|
||||
<ComponentList
|
||||
key="component-pane"
|
||||
metaData={bizComponents}
|
||||
registerAdditive={(shell: Element | null) => this.registerAdditive(shell)}
|
||||
enableSearch
|
||||
/>
|
||||
</Tab.Item>
|
||||
</Tab>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
98
packages/plugin-components-pane/src/utils.ts
Normal file
98
packages/plugin-components-pane/src/utils.ts
Normal file
@ -0,0 +1,98 @@
|
||||
export const builtinSearchMap = {
|
||||
容器: '容器、rongqi、rq、分栏、ColumnsLayout、Columns、layout、grid',
|
||||
分栏: '分栏、ColumnsLayout、Columns、layout、grid、容器、rongqi、rq、fl、fenlan',
|
||||
卡片: '卡片、card、kapian、kp',
|
||||
选项卡: '选项卡、tab、tabs、页签、xuanxiangka、xxk、yeqian、yq',
|
||||
按钮: '按钮、button、anniu、an',
|
||||
图标: '图标、icon、tubiao、tb',
|
||||
标题: '标题、title、biaoti、bt',
|
||||
图片: '图片、image、pic、picture、tupian、tp',
|
||||
Dialog: '对话框、Dialog、弹框、弹出框、duihuakuang、dhk',
|
||||
Drawer: '抽屉、Drawer、chouti、ct、couti',
|
||||
文本: '文本、文字、text、wenzi、wz、wenben',
|
||||
链接: '链接、link、lianjie、lj',
|
||||
链接块: '链接块、链接、link、lianjie、lj、ljk',
|
||||
表单容器: '表单容器、表单、form、biaodan、bd',
|
||||
输入框: '输入框、文本框、密码框、input、shurukuang、srk、wenbenkuang、wbk',
|
||||
数字输入框: '数字输入框、数字、输入框、Number、NumberPicker、shuzi、sz、srk、shurukuang',
|
||||
单选: '单选、radio button、radio、danxuan、dx',
|
||||
多选: '复选、复选框、多选、Checkbox、check、fuxuan、fx、dx、duoxuan',
|
||||
下拉选择: '下拉选择、Select、选择器、下拉、xiala、xl、xialaxuanze、xlxz',
|
||||
开关: '开关、switch、kaiguan、kg',
|
||||
日期: '日期选择、date、DatePicker、riqi、riqixuanz、rq、rqxz',
|
||||
日期区间: '日期区间、Cascade、date、riqiqujian、rq',
|
||||
时间选择框: '时间选择、time、TimePicker、shijian、sj、shijianxuanze、sjxz、xuanzekuang',
|
||||
上传图片: '上传图片、upload、上传、shangchuan、sc、tupian',
|
||||
上传附件: '上传附件、upload、上传、shangchuan、sc、fujian',
|
||||
树形选择: '树形选择、树型选择、树选择、tree、TreeSelect、shu、sxz、shuxingxuanze',
|
||||
级联选择: '级联选择、Cascade、Cascadeselect、级联、jilian、jl、jilianxuanze、jlxz',
|
||||
地区选择: '地区选择、city、地址、address、地区、diqu、dq、diquxuanze、dqxz',
|
||||
国家选择: '国家选择、country、国家、guojia、gj、guojiaxuanze、gjxz',
|
||||
评分: '评分、Rate、Rating、星、pingfen、pf',
|
||||
明细: '明细、table、表格、表单、form、mingxi、mx',
|
||||
穿梭框: '穿梭框、transfer、chuansuokuang、csk',
|
||||
人员搜索框: '人员搜索框、employee、人员选择、选人、xuanren、xr、renyuansousuo、ryss',
|
||||
筛选: '筛选、pickable、shaixuan、sx',
|
||||
金额输入框: '金额输入框、输入框、shurukuang、srk、money、金额、jine、je',
|
||||
金额区间: '金额区间、money、金额、jine、je',
|
||||
查询: '查询、filter、chaxun、cx',
|
||||
表格: '表格、table、biaoge、bg',
|
||||
数据文本: '数据文本、Number Info、数据、shuju、sj、shujuwenben、sjwb',
|
||||
数据趋势: '数据趋势、Number Trend、数据、shuju、sj、shujuqushi、sjqs',
|
||||
勾选框: '勾选框、复选框、check box、gouxuankuang、gxk、fuxuankuang、fxk',
|
||||
图片浏览: '图片浏览、图片预览、image、pic、picture、图片、预览、tupianyulan、tupianliulan、tupian、tp、yulan、yl',
|
||||
搜索: '搜索、搜索框、查询框、查询、search、sousuo、ss',
|
||||
树形控件: '树形控件、树组件、tree、shuzujian、shuxingkongjian、shu、szj、sxkj',
|
||||
富文本框: '富文本框、RichText、fuwenben、fwb',
|
||||
步骤: '步骤、步骤条、step、steps、buzhoutiao、buzhou、bzt、bz',
|
||||
时间轴: '时间轴、时间线、timeline、shijianzhou、shijianxian、sjz、sjx',
|
||||
菜单: '菜单、menu、caidan、cd',
|
||||
气泡提示: '气泡提示、tip、tips、balloon、气泡、qipao、qp、qipaotishi、qpts',
|
||||
面包屑: '面包屑、breadcrumb、crumb、mianbaoxie、mbx',
|
||||
日历: '日历、calendar、rili、rl',
|
||||
折叠面板: '折叠面板、collapse、折叠、zhedie、zd、zhediemianban、zdmb',
|
||||
下拉菜单: '下拉菜单、dropdown、下拉、xiala、xl、xialacaidan、xlcd、菜单、caidan、cd',
|
||||
信息提示: '信息提示、message、alert、信息、提示、警示、xinxitishi、xxts、xinxi、xx、tishi、ts、消息、xiaoxi',
|
||||
进度指示器: '进度指示器、进度条、progress、jindutiao、jdt、进度、jindu、jd',
|
||||
翻页器: '翻页器、分页器、pagination、fanyeqi、fyq、分页、fenye、fy',
|
||||
轮播图: '轮播图、图片轮播、slider、轮播、lunbo、lb、lunbotu、lbt',
|
||||
底部通栏: '底部通栏、tool bar、通栏、dibutonglan、dbtl、浮动工具条、浮动、工具条、工具、fudong、gongju、toolbar、tool bar、fd、gj',
|
||||
HTML: 'html',
|
||||
JSX: 'jsx',
|
||||
浮动导航: '浮动导航、nav、floatNav、fudongdaohang、fddh',
|
||||
Iframe: 'Iframe',
|
||||
Markdown: 'Markdown',
|
||||
区段选择器: '区段选择、滑块选择、区段、滑块、选择、Range、quduan、huakuai、xuanze、qdxz、hkxz、xz',
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} title 组件名
|
||||
* @param {string} query 搜索词
|
||||
* @param {object} map 映射关系
|
||||
*/
|
||||
export function searchComponent(title, query, map = {}) {
|
||||
if (!title || !query || !map || !map[title]) {
|
||||
return false;
|
||||
}
|
||||
const keys = (map[title] || '').split('、');
|
||||
return !!keys.find(key => {
|
||||
if (!key) {
|
||||
return false;
|
||||
}
|
||||
return key.indexOf(query) > -1;
|
||||
});
|
||||
}
|
||||
|
||||
export function debounce(func, delay) {
|
||||
let timer;
|
||||
return function (...args) {
|
||||
if (timer) {
|
||||
return;
|
||||
}
|
||||
timer = setTimeout(() => {
|
||||
func.apply(this, args);
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}, delay);
|
||||
};
|
||||
}
|
||||
@ -3,6 +3,8 @@
|
||||
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.55"></a>
|
||||
## [0.9.55](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.54...@ali/lowcode-plugin-designer@0.9.55) (2020-09-08)
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@1.0.6-0...@ali/lowcode-plugin-designer@1.0.7-0) (2020-09-02)
|
||||
|
||||
@ -11,6 +13,21 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-designer
|
||||
|
||||
<a name="0.9.54"></a>
|
||||
## [0.9.54](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.53...@ali/lowcode-plugin-designer@0.9.54) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-designer
|
||||
|
||||
<a name="0.9.53"></a>
|
||||
## [0.9.53](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.52...@ali/lowcode-plugin-designer@0.9.53) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-designer
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.52...@ali/lowcode-plugin-designer@1.0.6-0) (2020-09-02)
|
||||
|
||||
@ -62,10 +79,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-designer
|
||||
|
||||
>>>>>>> master
|
||||
<a name="0.9.48"></a>
|
||||
## [0.9.48](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.47...@ali/lowcode-plugin-designer@0.9.48) (2020-08-20)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
@ -138,10 +153,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-designer
|
||||
|
||||
>>>>>>> master
|
||||
<a name="0.9.43"></a>
|
||||
## [0.9.43](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-designer@0.9.42...@ali/lowcode-plugin-designer@0.9.43) (2020-08-14)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -3,16 +3,23 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-event-bind-dialog@1.0.6-0...@ali/lowcode-plugin-event-bind-dialog@1.0.7-0) (2020-09-02)
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-event-bind-dialog
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-event-bind-dialog@0.8.32...@ali/lowcode-plugin-event-bind-dialog@1.0.6-0) (2020-09-02)
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-event-bind-dialog
|
||||
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-event-bind-dialog@0.8.32...@ali/lowcode-plugin-event-bind-dialog@1.0.6-0) (2020-09-02)
|
||||
<a name="0.8.34"></a>
|
||||
## [0.8.34](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-event-bind-dialog@0.8.33...@ali/lowcode-plugin-event-bind-dialog@0.8.34) (2020-09-03)
|
||||
|
||||
<a name="0.8.33"></a>
|
||||
## [0.8.33](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-event-bind-dialog@0.8.32...@ali/lowcode-plugin-event-bind-dialog@0.8.33) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@ -31,8 +38,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
<a name="1.0.5-0"></a>
|
||||
## [1.0.5-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-event-bind-dialog@1.0.4-0...@ali/lowcode-plugin-event-bind-dialog@1.0.5-0) (2020-08-20)
|
||||
=======
|
||||
=======
|
||||
<a name="0.8.32"></a>
|
||||
## [0.8.32](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-event-bind-dialog@0.8.31...@ali/lowcode-plugin-event-bind-dialog@0.8.32) (2020-08-27)
|
||||
|
||||
@ -96,7 +101,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
# [1.0.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-event-bind-dialog@0.13.0...@ali/lowcode-plugin-event-bind-dialog@1.0.0) (2020-08-17)
|
||||
<a name="0.8.29"></a>
|
||||
## [0.8.29](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-event-bind-dialog@0.8.28...@ali/lowcode-plugin-event-bind-dialog@0.8.29) (2020-08-19)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -7,6 +7,32 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@1.0.6-0...@ali/lowcode-plugin-outline-pane@1.0.7-0) (2020-09-02)
|
||||
|
||||
|
||||
<a name="0.8.61"></a>
|
||||
## [0.8.61](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.60...@ali/lowcode-plugin-outline-pane@0.8.61) (2020-09-08)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-outline-pane
|
||||
|
||||
<a name="0.8.60"></a>
|
||||
## [0.8.60](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.59...@ali/lowcode-plugin-outline-pane@0.8.60) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-outline-pane
|
||||
|
||||
<a name="0.8.59"></a>
|
||||
## [0.8.59](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.58...@ali/lowcode-plugin-outline-pane@0.8.59) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-outline-pane
|
||||
|
||||
<a name="0.8.58"></a>
|
||||
## [0.8.58](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.57...@ali/lowcode-plugin-outline-pane@0.8.58) (2020-08-27)
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-outline-pane
|
||||
@ -102,10 +128,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-outline-pane
|
||||
|
||||
>>>>>>> master
|
||||
<a name="0.8.49"></a>
|
||||
## [0.8.49](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-outline-pane@0.8.48...@ali/lowcode-plugin-outline-pane@0.8.49) (2020-08-14)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
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-plugin-sample-logo@0.8.32...@ali/lowcode-plugin-sample-logo@0.8.33) (2020-09-03)
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-logo@1.0.6-0...@ali/lowcode-plugin-sample-logo@1.0.7-0) (2020-09-02)
|
||||
|
||||
@ -11,6 +13,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-sample-logo
|
||||
|
||||
<a name="0.8.32"></a>
|
||||
## [0.8.32](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-logo@0.8.31...@ali/lowcode-plugin-sample-logo@0.8.32) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-sample-logo
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-logo@0.8.31...@ali/lowcode-plugin-sample-logo@1.0.6-0) (2020-09-02)
|
||||
|
||||
|
||||
@ -6,13 +6,27 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@1.0.6-0...@ali/lowcode-plugin-sample-preview@1.0.7-0) (2020-09-02)
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-sample-preview
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.56...@ali/lowcode-plugin-sample-preview@1.0.6-0) (2020-09-02)
|
||||
|
||||
<a name="0.8.59"></a>
|
||||
## [0.8.59](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.58...@ali/lowcode-plugin-sample-preview@0.8.59) (2020-09-08)
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-sample-preview
|
||||
|
||||
<a name="0.8.58"></a>
|
||||
## [0.8.58](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.57...@ali/lowcode-plugin-sample-preview@0.8.58) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-sample-preview
|
||||
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.56...@ali/lowcode-plugin-sample-preview@1.0.6-0) (2020-09-02)
|
||||
<a name="0.8.57"></a>
|
||||
## [0.8.57](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-sample-preview@0.8.56...@ali/lowcode-plugin-sample-preview@0.8.57) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
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.31"></a>
|
||||
## [0.8.31](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-source-editor@0.8.30...@ali/lowcode-plugin-source-editor@0.8.31) (2020-09-03)
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-source-editor@1.0.6-0...@ali/lowcode-plugin-source-editor@1.0.7-0) (2020-09-02)
|
||||
|
||||
@ -11,6 +13,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-source-editor
|
||||
|
||||
<a name="0.8.30"></a>
|
||||
## [0.8.30](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-source-editor@0.8.29...@ali/lowcode-plugin-source-editor@0.8.30) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-source-editor
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-source-editor@0.8.29...@ali/lowcode-plugin-source-editor@1.0.6-0) (2020-09-02)
|
||||
|
||||
|
||||
@ -78,6 +78,8 @@ export default class SourceEditor extends Component<{
|
||||
this.callEditorEvent('sourceEditor.focusByFunction', params);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// 插件面板关闭事件,监听规则同上
|
||||
editor.on('skeleton.panel-dock.unactive', (pluginName, dock) => {
|
||||
@ -86,8 +88,14 @@ export default class SourceEditor extends Component<{
|
||||
}
|
||||
});
|
||||
|
||||
const schema = editor.get('designer').project.getSchema();
|
||||
this.initCode(schema);
|
||||
// 插件面板打开事件,监听规则同上
|
||||
editor.on('skeleton.panel-dock.active',(pluginName,dock)=>{
|
||||
if (pluginName == 'sourceEditor'){
|
||||
this.initCode();
|
||||
}
|
||||
})
|
||||
|
||||
this.initCode();
|
||||
}
|
||||
|
||||
|
||||
@ -127,8 +135,10 @@ export default class SourceEditor extends Component<{
|
||||
}
|
||||
};
|
||||
|
||||
initCode = (schema) => {
|
||||
const jsCode = js_beautify(transfrom.schema2Code(schema), { indent_size: 2, indent_empty_lines: true });
|
||||
initCode = () => {
|
||||
const {editor} = this.props;
|
||||
let schema = editor.get('designer').project.getSchema();
|
||||
let jsCode = js_beautify(transfrom.schema2Code(schema), { indent_size: 2, indent_empty_lines: true });
|
||||
let css;
|
||||
|
||||
if (schema.componentsTree[0].css) {
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
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.59"></a>
|
||||
## [0.8.59](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.58...@ali/lowcode-plugin-undo-redo@0.8.59) (2020-09-08)
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@1.0.6-0...@ali/lowcode-plugin-undo-redo@1.0.7-0) (2020-09-02)
|
||||
|
||||
@ -11,6 +13,21 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-undo-redo
|
||||
|
||||
<a name="0.8.58"></a>
|
||||
## [0.8.58](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.57...@ali/lowcode-plugin-undo-redo@0.8.58) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-undo-redo
|
||||
|
||||
<a name="0.8.57"></a>
|
||||
## [0.8.57](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.56...@ali/lowcode-plugin-undo-redo@0.8.57) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-undo-redo
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.56...@ali/lowcode-plugin-undo-redo@1.0.6-0) (2020-09-02)
|
||||
|
||||
@ -136,7 +153,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-undo-redo
|
||||
|
||||
>>>>>>> master
|
||||
<a name="0.8.47"></a>
|
||||
## [0.8.47](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-undo-redo@0.8.46...@ali/lowcode-plugin-undo-redo@0.8.47) (2020-08-14)
|
||||
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
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.32"></a>
|
||||
## [0.8.32](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-variable-bind-dialog@0.8.31...@ali/lowcode-plugin-variable-bind-dialog@0.8.32) (2020-09-03)
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-variable-bind-dialog@1.0.6-0...@ali/lowcode-plugin-variable-bind-dialog@1.0.7-0) (2020-09-02)
|
||||
|
||||
@ -11,6 +13,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-variable-bind-dialog
|
||||
|
||||
<a name="0.8.31"></a>
|
||||
## [0.8.31](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-variable-bind-dialog@0.8.30...@ali/lowcode-plugin-variable-bind-dialog@0.8.31) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-variable-bind-dialog
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-variable-bind-dialog@0.8.30...@ali/lowcode-plugin-variable-bind-dialog@1.0.6-0) (2020-09-02)
|
||||
|
||||
@ -41,10 +50,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-variable-bind-dialog
|
||||
|
||||
>>>>>>> master
|
||||
<a name="0.8.28"></a>
|
||||
## [0.8.28](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-variable-bind-dialog@0.8.27...@ali/lowcode-plugin-variable-bind-dialog@0.8.28) (2020-08-20)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
@ -87,7 +94,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
# [1.0.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-variable-bind-dialog@0.13.0...@ali/lowcode-plugin-variable-bind-dialog@1.0.0) (2020-08-17)
|
||||
<a name="0.8.27"></a>
|
||||
## [0.8.27](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-variable-bind-dialog@0.8.26...@ali/lowcode-plugin-variable-bind-dialog@0.8.27) (2020-08-19)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
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.36"></a>
|
||||
## [0.8.36](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-zh-en@0.8.35...@ali/lowcode-plugin-zh-en@0.8.36) (2020-09-03)
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-zh-en@1.0.6-0...@ali/lowcode-plugin-zh-en@1.0.7-0) (2020-09-02)
|
||||
|
||||
@ -11,6 +13,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-zh-en
|
||||
|
||||
<a name="0.8.35"></a>
|
||||
## [0.8.35](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-zh-en@0.8.34...@ali/lowcode-plugin-zh-en@0.8.35) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-plugin-zh-en
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-zh-en@0.8.34...@ali/lowcode-plugin-zh-en@1.0.6-0) (2020-09-02)
|
||||
|
||||
@ -86,7 +95,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
# [1.0.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-zh-en@0.13.0...@ali/lowcode-plugin-zh-en@1.0.0) (2020-08-17)
|
||||
<a name="0.8.31"></a>
|
||||
## [0.8.31](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-plugin-zh-en@0.8.30...@ali/lowcode-plugin-zh-en@0.8.31) (2020-08-19)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -119,7 +119,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
|
||||
<a name="0.1.6"></a>
|
||||
>>>>>>> master
|
||||
## [0.1.6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-rax-renderer@0.1.5...@ali/lowcode-rax-renderer@0.1.6) (2020-07-22)
|
||||
|
||||
|
||||
@ -188,11 +187,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
### Features
|
||||
|
||||
* init rax-render ([7167767](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7167767))
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> master
|
||||
&&
|
||||
&&
|
||||
||
|
||||
|
||||
@ -3,6 +3,32 @@
|
||||
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.60"></a>
|
||||
## [0.8.60](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-rax-simulator-renderer@0.8.59...@ali/lowcode-rax-simulator-renderer@0.8.60) (2020-09-08)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-rax-simulator-renderer
|
||||
|
||||
<a name="0.8.59"></a>
|
||||
## [0.8.59](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-rax-simulator-renderer@0.8.58...@ali/lowcode-rax-simulator-renderer@0.8.59) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-rax-simulator-renderer
|
||||
|
||||
<a name="0.8.58"></a>
|
||||
## [0.8.58](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-rax-simulator-renderer@0.8.57...@ali/lowcode-rax-simulator-renderer@0.8.58) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-rax-simulator-renderer
|
||||
|
||||
<a name="0.8.57"></a>
|
||||
## [0.8.57](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-rax-simulator-renderer@0.8.56...@ali/lowcode-rax-simulator-renderer@0.8.57) (2020-08-27)
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-rax-simulator-renderer@1.0.6-0...@ali/lowcode-rax-simulator-renderer@1.0.7-0) (2020-09-02)
|
||||
|
||||
|
||||
@ -110,12 +110,10 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
### Bug Fixes
|
||||
|
||||
* 修复判断动态 setter 的逻辑 ([d195d7f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/d195d7f))
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
<<<<<<< HEAD
|
||||
**Note:** Version bump only for package @ali/lowcode-react-renderer
|
||||
|
||||
<a name="0.13.0"></a>
|
||||
@ -152,17 +150,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
<a name="0.9.0"></a>
|
||||
# [0.9.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-renderer@0.8.17...@ali/lowcode-react-renderer@0.9.0) (2020-08-14)
|
||||
=======
|
||||
=======
|
||||
>>>>>>> master
|
||||
<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)
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
<<<<<<< HEAD
|
||||
* dropdown and menu schema ([ae1d125](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ae1d125))
|
||||
* parse custom methods function ([87d8b86](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/87d8b86))
|
||||
|
||||
@ -170,11 +163,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
### Features
|
||||
|
||||
* 🎸 add demo-server ([df35c6a](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/df35c6a))
|
||||
=======
|
||||
* 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))
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
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.61"></a>
|
||||
## [0.8.61](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.60...@ali/lowcode-react-simulator-renderer@0.8.61) (2020-09-08)
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@1.0.6-0...@ali/lowcode-react-simulator-renderer@1.0.7-0) (2020-09-02)
|
||||
|
||||
@ -11,6 +13,21 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-react-simulator-renderer
|
||||
|
||||
<a name="0.8.60"></a>
|
||||
## [0.8.60](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.59...@ali/lowcode-react-simulator-renderer@0.8.60) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-react-simulator-renderer
|
||||
|
||||
<a name="0.8.59"></a>
|
||||
## [0.8.59](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.58...@ali/lowcode-react-simulator-renderer@0.8.59) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-react-simulator-renderer
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-react-simulator-renderer@0.8.58...@ali/lowcode-react-simulator-renderer@1.0.6-0) (2020-09-02)
|
||||
|
||||
|
||||
@ -3,6 +3,24 @@
|
||||
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-types@0.8.18...@ali/lowcode-types@0.8.19) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-types
|
||||
|
||||
<a name="0.8.18"></a>
|
||||
## [0.8.18](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.17...@ali/lowcode-types@0.8.18) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-types
|
||||
|
||||
<a name="0.8.17"></a>
|
||||
## [0.8.17](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.16...@ali/lowcode-types@0.8.17) (2020-08-24)
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.6-0...@ali/lowcode-types@1.0.7-0) (2020-09-02)
|
||||
|
||||
@ -99,7 +117,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
### Bug Fixes
|
||||
|
||||
* 修复判断动态 setter 的逻辑 ([d195d7f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/d195d7f))
|
||||
>>>>>>> master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -92,4 +92,4 @@ export function isNodeSchema(data: any): data is NodeSchema {
|
||||
|
||||
export function isProjectSchema(data: any): data is ProjectSchema {
|
||||
return data && data.componentsTree;
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,8 @@
|
||||
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.22"></a>
|
||||
## [0.8.22](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-utils@0.8.21...@ali/lowcode-utils@0.8.22) (2020-09-03)
|
||||
<a name="1.0.7-0"></a>
|
||||
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-utils@1.0.6-0...@ali/lowcode-utils@1.0.7-0) (2020-09-02)
|
||||
|
||||
@ -11,6 +13,16 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-utils
|
||||
|
||||
<a name="0.8.21"></a>
|
||||
## [0.8.21](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-utils@0.8.20...@ali/lowcode-utils@0.8.21) (2020-09-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ali/lowcode-utils
|
||||
|
||||
<a name="0.8.20"></a>
|
||||
## [0.8.20](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-utils@0.8.19...@ali/lowcode-utils@0.8.20) (2020-08-27)
|
||||
<a name="1.0.6-0"></a>
|
||||
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-utils@0.8.20...@ali/lowcode-utils@1.0.6-0) (2020-09-02)
|
||||
|
||||
|
||||
3
packages/utils/src/env.ts
Normal file
3
packages/utils/src/env.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export function isInSimulator() {
|
||||
return Boolean((window as any).__is_simulator_env__);
|
||||
}
|
||||
@ -11,8 +11,12 @@ export function acceptsRef(obj: any): boolean {
|
||||
return obj?.prototype?.isReactComponent || (obj.$$typeof && obj.$$typeof === REACT_FORWARD_REF_TYPE);
|
||||
}
|
||||
|
||||
function isForwardRefType(obj: any): boolean {
|
||||
return obj?.$$typeof && obj?.$$typeof === REACT_FORWARD_REF_TYPE;
|
||||
}
|
||||
|
||||
export function isReactComponent(obj: any): obj is ComponentType<any> {
|
||||
return obj && (isReactClass(obj) || typeof obj === 'function');
|
||||
return obj && (isReactClass(obj) || typeof obj === 'function' || isForwardRefType(obj));
|
||||
}
|
||||
|
||||
export function wrapReactClass(view: FunctionComponent) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user