mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-04 17:27:09 +00:00
chore: build
This commit is contained in:
commit
14fe25fc7f
@ -15,9 +15,7 @@
|
|||||||
<link rel="stylesheet" href="https://alifd.alicdn.com/npm/@alifd/next/1.11.6/next.min.css" />
|
<link rel="stylesheet" href="https://alifd.alicdn.com/npm/@alifd/next/1.11.6/next.min.css" />
|
||||||
<script src="https://unpkg.alibaba-inc.com/@alifd/next@1.18.17/dist/next.min.js"></script>
|
<script src="https://unpkg.alibaba-inc.com/@alifd/next@1.18.17/dist/next.min.js"></script>
|
||||||
<!-- lowcode engine globals -->
|
<!-- lowcode engine globals -->
|
||||||
<link rel="stylesheet" href="./core.css" />
|
<link rel="stylesheet" href="./editor-preset-vision.css" />
|
||||||
<!-- lowcode engine globals -->
|
|
||||||
<link rel="stylesheet" href="./vision-preset.css" />
|
|
||||||
<!-- lowcode engine app -->
|
<!-- lowcode engine app -->
|
||||||
<link rel="stylesheet" href="./lowcode-editor.css" />
|
<link rel="stylesheet" href="./lowcode-editor.css" />
|
||||||
<script>
|
<script>
|
||||||
@ -72,9 +70,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="lce-container"></div>
|
<div id="lce-container"></div>
|
||||||
<!-- lowcode engine globals -->
|
<!-- lowcode engine globals -->
|
||||||
<script src="./core.js"></script>
|
<script src="./editor-preset-vision.js"></script>
|
||||||
<!-- lowcode engine globals -->
|
|
||||||
<script src="./vision-preset.js"></script>
|
|
||||||
<script src="https://dev.g.alicdn.com/vision/visualengine-utils/5.0.0/engine-utils.js"></script>
|
<script src="https://dev.g.alicdn.com/vision/visualengine-utils/5.0.0/engine-utils.js"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="//g.alicdn.com/??platform/common/s/1.1/global/global.css,uxcore/uxcore-kuma/2.2.1/orange.min.css">
|
<link rel="stylesheet" type="text/css" href="//g.alicdn.com/??platform/common/s/1.1/global/global.css,uxcore/uxcore-kuma/2.2.1/orange.min.css">
|
||||||
<!-- lowcode engine app -->
|
<!-- lowcode engine app -->
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-editor-preset-vision",
|
"name": "@ali/lowcode-editor-preset-vision",
|
||||||
"private": true,
|
|
||||||
"version": "0.8.15",
|
"version": "0.8.15",
|
||||||
"description": "Vision Polyfill for Ali lowCode engine",
|
"description": "Vision Polyfill for Ali lowCode engine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
|||||||
@ -20,13 +20,11 @@
|
|||||||
],
|
],
|
||||||
"author": "xiayang.xy",
|
"author": "xiayang.xy",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/iceluna-addon-component-list": "^1.0.11",
|
"@ali/lowcode-designer": "^0.9.11",
|
||||||
"@ali/iceluna-comp-material-show": "^1.0.10",
|
"@ali/lowcode-editor-core": "^0.8.12",
|
||||||
"@ali/iceluna-sdk": "^1.0.6-beta.6",
|
"@ali/lowcode-types": "^0.8.3",
|
||||||
"@ali/lowcode-designer": "^0.9.16",
|
|
||||||
"@ali/lowcode-editor-core": "^0.8.14",
|
|
||||||
"@ali/lowcode-types": "^0.8.5",
|
|
||||||
"@alifd/next": "^1.19.19",
|
"@alifd/next": "^1.19.19",
|
||||||
|
"@ali/ve-component-list": "^1.1.1",
|
||||||
"react": "^16.8.1"
|
"react": "^16.8.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@ -1,40 +1,23 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import { Component, ReactNode } from 'react';
|
||||||
import { Icon, Search, Select } from '@alifd/next';
|
import ComponentList, { AdditiveType } from "@ali/ve-component-list";
|
||||||
import MaterialShow from '@ali/iceluna-comp-material-show';
|
|
||||||
import { PluginProps } from '@ali/lowcode-types';
|
import { PluginProps } from '@ali/lowcode-types';
|
||||||
import { Designer } from '@ali/lowcode-designer';
|
import { Designer } from '@ali/lowcode-designer';
|
||||||
|
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
|
||||||
export interface LibrayInfo {
|
|
||||||
label: string;
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IState {
|
export interface IState {
|
||||||
loading: boolean;
|
metaData: object[];
|
||||||
libs: LibrayInfo[];
|
|
||||||
searchKey: string;
|
|
||||||
currentLib: string;
|
|
||||||
componentList: object[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class ComponentListPlugin extends PureComponent<PluginProps, IState> {
|
export default class ComponentListPlugin extends Component<PluginProps, IState> {
|
||||||
static displayName = 'LowcodeComponentListPlugin';
|
static displayName = 'LowcodeComponentListPlugin';
|
||||||
|
|
||||||
|
snippetsMap = new Map();
|
||||||
|
|
||||||
constructor(props: any) {
|
constructor(props: any) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
loading: false,
|
metaData: [],
|
||||||
libs: [
|
|
||||||
{
|
|
||||||
label: '全部',
|
|
||||||
value: 'all',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
searchKey: '',
|
|
||||||
currentLib: 'all',
|
|
||||||
componentList: [],
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,141 +30,110 @@ export default class ComponentListPlugin extends PureComponent<PluginProps, ISta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
transformMaterial = (componentList: any): any => {
|
transformMetaData(componentList: any): any {
|
||||||
return componentList.map((category: any) => {
|
const metaData: object[] = [];
|
||||||
return {
|
componentList.forEach((category: any, categoryId: number) => {
|
||||||
name: category.title,
|
if (Array.isArray(category?.children)) {
|
||||||
items: category.children.map((comp: any) => {
|
category.children.forEach((comp: any, compId: number) => {
|
||||||
return {
|
metaData.push({
|
||||||
...comp,
|
id: `${categoryId}-${compId}`,
|
||||||
name: comp.componentName,
|
componentName: comp.componentName,
|
||||||
snippets: comp.snippets.map((snippet: any) => {
|
title: comp.title,
|
||||||
return {
|
category: category.title,
|
||||||
name: snippet.title,
|
snippets: comp.snippets.map((snippet: any, snippetId: number) => {
|
||||||
screenshot: snippet.screenshot,
|
const item = {
|
||||||
code: JSON.stringify(snippet.schema),
|
id: `${categoryId}-${compId}-${snippetId}`,
|
||||||
|
description: snippet.title,
|
||||||
|
thumbnail: snippet.screenshot,
|
||||||
|
schema: snippet.schema,
|
||||||
};
|
};
|
||||||
|
this.snippetsMap.set(item.id, item.schema);
|
||||||
|
return item;
|
||||||
}),
|
}),
|
||||||
};
|
});
|
||||||
}),
|
});
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
};
|
return metaData;
|
||||||
|
}
|
||||||
|
|
||||||
initComponentList = (): void => {
|
initComponentList = (): void => {
|
||||||
debugger;
|
|
||||||
const { editor } = this.props;
|
const { editor } = this.props;
|
||||||
const assets = editor.get('assets') || {};
|
const assets = editor.get('assets') || {};
|
||||||
const list: string[] = [];
|
const metaData = this.transformMetaData(assets.componentList);
|
||||||
const libs: LibrayInfo[] = [];
|
|
||||||
assets.packages.forEach((item: any): void => {
|
|
||||||
list.push(item.library);
|
|
||||||
libs.push({
|
|
||||||
label: item.title,
|
|
||||||
value: item.library,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
if (list.length > 1) {
|
this.setState({
|
||||||
libs.unshift({
|
metaData,
|
||||||
label: '全部',
|
});
|
||||||
value: list.join(','),
|
};
|
||||||
});
|
|
||||||
|
registerAdditive(shell: Element | null) {
|
||||||
|
if (!shell) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const componentList = this.transformMaterial(assets.componentList);
|
function getSnippetId(elem: any, operation = AdditiveType.All) {
|
||||||
|
if (!elem || !operation) {
|
||||||
this.setState({
|
return null;
|
||||||
libs,
|
}
|
||||||
componentList,
|
while (shell !== elem) {
|
||||||
currentLib: libs[0] && libs[0].value,
|
if (elem.classList.contains(operation) || elem.classList.contains(AdditiveType.All)) {
|
||||||
});
|
return elem.dataset.id;
|
||||||
|
|
||||||
(window as any).__ctx = {
|
|
||||||
appHelper: editor,
|
|
||||||
};
|
|
||||||
(editor as any).dndHelper = {
|
|
||||||
handleResourceDragStart: function(ev: any, tagName: any, schema: any) {
|
|
||||||
debugger
|
|
||||||
const designer = editor.get(Designer);
|
|
||||||
if (designer) {
|
|
||||||
designer.dragon.boost(
|
|
||||||
{
|
|
||||||
type: 'nodedata',
|
|
||||||
data: schema,
|
|
||||||
},
|
|
||||||
ev.nativeEvent,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
// tslint:disable-next-line
|
||||||
|
elem = elem.parentNode;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { editor } = this.props;
|
||||||
|
const designer = editor.get(Designer);
|
||||||
|
if (!designer) {
|
||||||
|
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)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
searchAction = (value: string): void => {
|
shell.addEventListener('click', click);
|
||||||
this.setState({
|
|
||||||
searchKey: value,
|
designer.dragon.from(shell, (e: Event) => {
|
||||||
|
const doc = designer.currentDocument;
|
||||||
|
const id = getSnippetId(e.target, AdditiveType.Draggable);
|
||||||
|
|
||||||
|
if (!doc || !id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dragTarget = {
|
||||||
|
type: 'nodedata',
|
||||||
|
data: this.snippetsMap.get(id),
|
||||||
|
};
|
||||||
|
return dragTarget;
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
filterMaterial = (): any => {
|
render(): ReactNode {
|
||||||
const { searchKey, currentLib, componentList } = this.state;
|
const { metaData } = this.state;
|
||||||
const libs = currentLib.split(',');
|
|
||||||
return (componentList || [])
|
|
||||||
.map((cate: any) => {
|
|
||||||
return {
|
|
||||||
...cate,
|
|
||||||
items: (cate.items || []).filter((item: any) => {
|
|
||||||
let libFlag = libs.some((lib) => lib == item.library);
|
|
||||||
|
|
||||||
let keyFlag = true;
|
|
||||||
if (searchKey) {
|
|
||||||
keyFlag =
|
|
||||||
`${item.name || ''} ${item.title || ''}`.toLowerCase().indexOf(searchKey.trim().toLowerCase()) >= 0;
|
|
||||||
} else {
|
|
||||||
keyFlag = item.is_show === undefined || !!(item.is_show == 1);
|
|
||||||
}
|
|
||||||
return libFlag && keyFlag;
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.filter((cate) => {
|
|
||||||
return cate.items && cate.items.length > 0;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
render(): React.ReactNode {
|
|
||||||
const { libs, loading, currentLib } = this.state;
|
|
||||||
return (
|
return (
|
||||||
<div className="lowcode-component-list">
|
<div className="lowcode-component-list">
|
||||||
<div className="title">
|
<ComponentList
|
||||||
<Icon type="jihe" size="small" />
|
key="component-pane"
|
||||||
<span>组件库</span>
|
metaData={metaData}
|
||||||
</div>
|
registerAdditive={(shell: Element | null) => this.registerAdditive(shell)}
|
||||||
<Search
|
enableSearch
|
||||||
shape="simple"
|
|
||||||
size="medium"
|
|
||||||
className="search"
|
|
||||||
placeholder="请输入关键词"
|
|
||||||
onChange={this.searchAction as any}
|
|
||||||
onSearch={this.searchAction}
|
|
||||||
hasClear
|
|
||||||
/>
|
|
||||||
<Select
|
|
||||||
size="small"
|
|
||||||
className="select"
|
|
||||||
dataSource={libs}
|
|
||||||
value={currentLib}
|
|
||||||
onChange={(value): void => {
|
|
||||||
this.setState({
|
|
||||||
currentLib: value,
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<MaterialShow
|
|
||||||
className="components-show"
|
|
||||||
loading={loading}
|
|
||||||
type="component"
|
|
||||||
dataSource={this.filterMaterial()}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
declare module "@ali/iceluna-comp-material-show";
|
declare module '@ali/ve-component-list';
|
||||||
|
|||||||
@ -21,18 +21,18 @@ echo ""
|
|||||||
|
|
||||||
# work
|
# work
|
||||||
mkdir packages
|
mkdir packages
|
||||||
# cp -r $WORK_DIR/packages/demo packages/demo
|
cp -r $WORK_DIR/packages/demo packages/demo
|
||||||
cp -r $WORK_DIR/packages/react-simulator-renderer packages/react-simulator-renderer
|
cp -r $WORK_DIR/packages/react-simulator-renderer packages/react-simulator-renderer
|
||||||
# cp -r $WORK_DIR/packages/editor-core packages/editor-core
|
cp -r $WORK_DIR/packages/editor-preset-vision packages/editor-preset-vision
|
||||||
cp -r $WORK_DIR/packages/vision-preset packages/vision-preset
|
cp -r $WORK_DIR/packages/editor-preset-general packages/editor-preset-general
|
||||||
lerna bootstrap
|
lerna bootstrap
|
||||||
lerna run cloud-build --stream
|
lerna run cloud-build --stream
|
||||||
|
|
||||||
cd $WORK_DIR
|
cd $WORK_DIR
|
||||||
# mv deploy-space/packages/demo/build $BUILD_DEST
|
mv deploy-space/packages/demo/build $BUILD_DEST
|
||||||
mv deploy-space/packages/react-simulator-renderer/dist $BUILD_DEST
|
mv deploy-space/packages/react-simulator-renderer/dist/* $BUILD_DEST
|
||||||
# mv deploy-space/packages/editor-core/dist/* $BUILD_DEST
|
mv deploy-space/packages/editor-preset-vision/dist/* $BUILD_DEST
|
||||||
mv deploy-space/packages/vision-preset/dist/* $BUILD_DEST
|
mv deploy-space/packages/editor-preset-general/dist/* $BUILD_DEST
|
||||||
cp deploy-space/static/* $BUILD_DEST
|
cp deploy-space/static/* $BUILD_DEST
|
||||||
|
|
||||||
echo "complete"
|
echo "complete"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user