From 8bc4b4ca8c3ba766cb59ba5d721e7fbd14365e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8B=E7=BE=8A?= Date: Mon, 30 Mar 2020 21:58:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=94=9F=E6=88=90config=E6=96=87=E4=BB=B6=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/demo/build.json | 10 +- packages/demo/package.json | 32 ++- packages/demo/skeleton.config.js | 155 +++++++++++ packages/demo/src/editor/config/components.js | 30 ++- packages/demo/src/editor/config/constants.js | 4 +- .../demo/src/editor/config/locale/en-US.js | 1 + .../demo/src/editor/config/locale/index.js | 10 + .../demo/src/editor/config/locale/ja-JP.js | 1 + .../demo/src/editor/config/locale/zh-CN.js | 1 + .../demo/src/editor/config/locale/zh-TW.js | 1 + packages/demo/src/editor/config/skeleton.js | 246 +++++++++--------- packages/demo/src/editor/config/utils.js | 4 +- packages/demo/src/editor/index.tsx | 3 +- 13 files changed, 334 insertions(+), 164 deletions(-) create mode 100644 packages/demo/skeleton.config.js create mode 100644 packages/demo/src/editor/config/locale/en-US.js create mode 100644 packages/demo/src/editor/config/locale/index.js create mode 100644 packages/demo/src/editor/config/locale/ja-JP.js create mode 100644 packages/demo/src/editor/config/locale/zh-CN.js create mode 100644 packages/demo/src/editor/config/locale/zh-TW.js diff --git a/packages/demo/build.json b/packages/demo/build.json index 452a15dca..d09fc5a56 100644 --- a/packages/demo/build.json +++ b/packages/demo/build.json @@ -16,7 +16,9 @@ "@alifd/next": "window.Next" }, "plugins": [ - ["build-plugin-react-app"], + [ + "build-plugin-react-app" + ], [ "build-plugin-fusion", { @@ -26,9 +28,11 @@ [ "build-plugin-moment-locales", { - "locales": ["zh-cn"] + "locales": [ + "zh-cn" + ] } ], "./build.plugin.js" ] -} +} \ No newline at end of file diff --git a/packages/demo/package.json b/packages/demo/package.json index 38d0fcd75..2e54d6239 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -1,34 +1,38 @@ { "name": "@ali/lowcode-demo", - "private": true, "version": "0.8.1", + "private": true, "description": "低代码引擎 DEMO", "scripts": { - "start": "build-scripts start", - "cloud-build": "build-scripts build --config cloud-build.json" + "cloud-build": "build-scripts build --config cloud-build.json", + "gen": "npm run genSkeleton && tyarn", + "genSkeleton": "iceluna gen lowcode -c ./skeleton.config.js -t ./src/editor/config", + "start": "build-scripts start" }, + "config": {}, "dependencies": { "@ali/lowcode-editor-core": "^0.8.1", - "@ali/lowcode-editor-skeleton": "^0.8.1", - "@ali/lowcode-plugin-components-pane": "^0.8.1", - "@ali/lowcode-plugin-designer": "^0.8.1", - "@ali/lowcode-plugin-event-bind-dialog": "^0.8.2", - "@ali/lowcode-plugin-outline-pane": "^0.8.2", - "@ali/lowcode-plugin-sample-logo": "^0.8.1", - "@ali/lowcode-plugin-sample-preview": "^0.8.1", - "@ali/lowcode-plugin-settings-pane": "^0.8.3", - "@ali/lowcode-plugin-undo-redo": "^0.8.1", - "@ali/lowcode-plugin-zh-en": "^0.8.1", + "@ali/lowcode-editor-skeleton": "^0.8.0", + "@ali/lowcode-plugin-components-pane": "^0.8.0", + "@ali/lowcode-plugin-designer": "^0.8.0", + "@ali/lowcode-plugin-event-bind-dialog": "^0.8.0", + "@ali/lowcode-plugin-outline-pane": "^0.8.0", + "@ali/lowcode-plugin-sample-logo": "^0.8.0", + "@ali/lowcode-plugin-sample-preview": "^0.8.0", + "@ali/lowcode-plugin-settings-pane": "^0.8.0", + "@ali/lowcode-plugin-undo-redo": "^0.8.0", + "@ali/lowcode-plugin-zh-en": "^0.8.0", "@ali/lowcode-react-renderer": "^0.8.2", "@ali/lowcode-runtime": "^0.0.3", "@ali/lowcode-setters": "^0.8.1", - "@alifd/next": "^1.19.21", + "@alifd/next": "^1.19.12", "@alife/theme-lowcode-dark": "^0.1.0", "@alife/theme-lowcode-light": "^0.1.0", "react": "^16.8.1", "react-dom": "^16.8.1" }, "devDependencies": { + "@ali/iceluna-cli": "^0.0.16", "@alib/build-scripts": "^0.1.18", "@types/events": "^3.0.0", "@types/react": "^16.8.3", diff --git a/packages/demo/skeleton.config.js b/packages/demo/skeleton.config.js new file mode 100644 index 000000000..6c992791c --- /dev/null +++ b/packages/demo/skeleton.config.js @@ -0,0 +1,155 @@ +module.exports = { + skeleton: { + config: { + package: '@ali/lowcode-editor-skeleton', + version: '^0.8.0' + } + }, + theme: { + fusion: { + package: '@alife/theme-lowcode-light', + version: '^0.1.0' + }, + scss: '' + }, + constants: { + namespace: 'page' + }, + utils: [], + plugins: { + topArea: [ + { + pluginKey: 'logo', + type: 'Custom', + props: { + align: 'left', + width: 100 + }, + config: { + package: '@ali/lowcode-plugin-sample-logo', + version: '^0.8.0' + }, + pluginProps: { + logo: 'https://img.alicdn.com/tfs/TB1hoI9x1H2gK0jSZFEXXcqMpXa-146-40.png', + href: '/' + } + }, + { + pluginKey: 'undoRedo', + type: 'Custom', + props: { + align: 'right', + width: 88 + }, + config: { + package: '@ali/lowcode-plugin-undo-redo', + version: '^0.8.0' + } + }, + { + pluginKey: 'divider', + type: 'Divider', + props: { + align: 'right' + } + }, + { + pluginKey: 'samplePreview', + type: 'Custom', + props: { + align: 'right', + width: 64 + }, + config: { + package: '@ali/lowcode-plugin-sample-preview', + version: '^0.8.0' + } + } + ], + leftArea: [ + { + pluginKey: 'componentsPane', + type: 'PanelIcon', + props: { + align: 'top', + icon: 'zujianku', + title: '组件库', + floatable: true, + }, + config: { + package: '@ali/lowcode-plugin-components-pane', + version: '^0.8.0' + }, + pluginProps: { + } + }, + { + pluginKey: 'outlinePane', + type: 'PanelIcon', + props: { + align: 'top', + icon: 'dengpao', + title: '大纲树' + }, + config: { + package: '@ali/lowcode-plugin-outline-pane', + version: '^0.8.0' + }, + pluginProps: {} + }, + { + pluginKey: 'zhEn', + type: 'Custom', + props: { + align: 'bottom', + }, + config: { + package: '@ali/lowcode-plugin-zh-en', + version: '^0.8.0' + }, + pluginProps: {} + } + ], + rightArea: [ + { + pluginKey: 'settingsPane', + type: 'Panel', + props: {}, + config: { + package: '@ali/lowcode-plugin-settings-pane', + version: '^0.8.0' + }, + pluginProps: {} + } + ], + centerArea: [ + { + pluginKey: 'designer', + config: { + package: '@ali/lowcode-plugin-designer', + version: '^0.8.0' + } + }, + { + pluginKey: 'eventBindDialog', + config: { + package: '@ali/lowcode-plugin-event-bind-dialog', + version: '^0.8.0' + } + } + ] + }, + hooks: [], + shortCuts: [], + lifeCycles: { + init: async function init(editor) { + const assets = await editor.utils.get('./assets.json'); + editor.set('assets', assets); + editor.emit('assets.loaded', assets); + + const schema = await editor.utils.get('./schema.json'); + editor.set('schema', schema); + editor.emit('schema.loaded', schema); + } + } +}; diff --git a/packages/demo/src/editor/config/components.js b/packages/demo/src/editor/config/components.js index 87abd9c01..9648a7faf 100644 --- a/packages/demo/src/editor/config/components.js +++ b/packages/demo/src/editor/config/components.js @@ -1,20 +1,22 @@ -import undoRedo from '@ali/lowcode-plugin-undo-redo'; -import zhEn from '@ali/lowcode-plugin-zh-en'; +import LowcodeSkeleton from '@ali/lowcode-editor-skeleton'; import logo from '@ali/lowcode-plugin-sample-logo'; +import undoRedo from '@ali/lowcode-plugin-undo-redo'; import samplePreview from '@ali/lowcode-plugin-sample-preview'; -import designer from '@ali/lowcode-plugin-designer'; -import settingsPane from '@ali/lowcode-plugin-settings-pane'; import componentsPane from '@ali/lowcode-plugin-components-pane'; import outlinePane from '@ali/lowcode-plugin-outline-pane'; -import eventBindDialog from '@ali/lowcode-plugin-event-bind-dialog' +import zhEn from '@ali/lowcode-plugin-zh-en'; +import settingsPane from '@ali/lowcode-plugin-settings-pane'; +import designer from '@ali/lowcode-plugin-designer'; +import eventBindDialog from '@ali/lowcode-plugin-event-bind-dialog'; export default { - undoRedo, - zhEn, - designer, - componentsPane, - settingsPane, - outlinePane, - eventBindDialog, + LowcodeSkeleton, logo, - samplePreview -}; + undoRedo, + samplePreview, + componentsPane, + outlinePane, + zhEn, + settingsPane, + designer, + eventBindDialog +}; \ No newline at end of file diff --git a/packages/demo/src/editor/config/constants.js b/packages/demo/src/editor/config/constants.js index d7e16fed3..1c713fc4e 100644 --- a/packages/demo/src/editor/config/constants.js +++ b/packages/demo/src/editor/config/constants.js @@ -1,3 +1,3 @@ export default { - namespace: 'page' -}; + "namespace": "page" +} \ No newline at end of file diff --git a/packages/demo/src/editor/config/locale/en-US.js b/packages/demo/src/editor/config/locale/en-US.js new file mode 100644 index 000000000..7c645e42f --- /dev/null +++ b/packages/demo/src/editor/config/locale/en-US.js @@ -0,0 +1 @@ +export default {}; \ No newline at end of file diff --git a/packages/demo/src/editor/config/locale/index.js b/packages/demo/src/editor/config/locale/index.js new file mode 100644 index 000000000..eaa4da099 --- /dev/null +++ b/packages/demo/src/editor/config/locale/index.js @@ -0,0 +1,10 @@ +import en_us from './en-US'; +import zh_cn from './zh-CN'; +import zh_tw from './zh-TW'; +import ja_jp from './ja-JP'; +export default { + 'en-US': en_us, + 'zh-CN': zh_cn, + 'zh-TW': zh_tw, + 'ja-JP': ja_jp +}; \ No newline at end of file diff --git a/packages/demo/src/editor/config/locale/ja-JP.js b/packages/demo/src/editor/config/locale/ja-JP.js new file mode 100644 index 000000000..7c645e42f --- /dev/null +++ b/packages/demo/src/editor/config/locale/ja-JP.js @@ -0,0 +1 @@ +export default {}; \ No newline at end of file diff --git a/packages/demo/src/editor/config/locale/zh-CN.js b/packages/demo/src/editor/config/locale/zh-CN.js new file mode 100644 index 000000000..7c645e42f --- /dev/null +++ b/packages/demo/src/editor/config/locale/zh-CN.js @@ -0,0 +1 @@ +export default {}; \ No newline at end of file diff --git a/packages/demo/src/editor/config/locale/zh-TW.js b/packages/demo/src/editor/config/locale/zh-TW.js new file mode 100644 index 000000000..7c645e42f --- /dev/null +++ b/packages/demo/src/editor/config/locale/zh-TW.js @@ -0,0 +1 @@ +export default {}; \ No newline at end of file diff --git a/packages/demo/src/editor/config/skeleton.js b/packages/demo/src/editor/config/skeleton.js index 78f7a0a61..b818944bc 100644 --- a/packages/demo/src/editor/config/skeleton.js +++ b/packages/demo/src/editor/config/skeleton.js @@ -1,143 +1,133 @@ export default { - version: '^1.0.2', - theme: { - fusion: { - package: '@alife/theme-lowcode-light', - version: '^0.1.0' + "skeleton": { + "config": { + "package": "@ali/lowcode-editor-skeleton", + "version": "^0.8.0" + } + }, + "theme": { + "fusion": { + "package": "@alife/theme-lowcode-light", + "version": "^0.1.0" }, - scss: '' + "scss": "" }, - constants: { - namespace: 'page' + "constants": { + "namespace": "page" }, - utils: [], - plugins: { - topArea: [ - { - pluginKey: 'logo', - type: 'Custom', - props: { - align: 'left', - width: 100 - }, - config: { - package: '@ali/lowcode-plugin-sample-logo', - version: '1.0.0' - }, - pluginProps: { - logo: 'https://img.alicdn.com/tfs/TB1hoI9x1H2gK0jSZFEXXcqMpXa-146-40.png', - href: '/' - } + "utils": [], + "plugins": { + "topArea": [{ + "pluginKey": "logo", + "type": "Custom", + "props": { + "align": "left", + "width": 100 }, - { - pluginKey: 'undoRedo', - type: 'Custom', - props: { - align: 'right', - width: 88 - }, - config: { - package: '@ali/lowcode-plugin-undo-redo', - version: '1.0.0' - } + "config": { + "package": "@ali/lowcode-plugin-sample-logo", + "version": "^0.8.0" }, - { - pluginKey: 'divider', - type: 'Divider', - props: { - align: 'right' - } - }, - { - pluginKey: 'samplePreview', - type: 'Custom', - props: { - align: 'right', - width: 64 - }, - config: { - package: '@ali/lowcode-plugin-sample-preview', - version: '1.0.0' - } + "pluginProps": { + "logo": "https://img.alicdn.com/tfs/TB1hoI9x1H2gK0jSZFEXXcqMpXa-146-40.png", + "href": "/" } - ], - leftArea: [ - { - pluginKey: 'componentsPane', - type: 'PanelIcon', - props: { - align: 'top', - icon: 'zujianku', - title: '组件库' - }, - config: { - package: '@ali/iceluna-plugin-components-pane', - version: '0.0.1' - }, - pluginProps: { - disableAppComponent: true - } + }, { + "pluginKey": "undoRedo", + "type": "Custom", + "props": { + "align": "right", + "width": 88 }, - { - pluginKey: 'outlinePane', - type: 'PanelIcon', - props: { - align: 'top', - icon: 'dengpao', - title: '大纲树' - }, - config: { - package: '@ali/lowcode-plugin-outline-pane', - version: '^1.0.0' - }, - pluginProps: {} + "config": { + "package": "@ali/lowcode-plugin-undo-redo", + "version": "^0.8.0" + } + }, { + "pluginKey": "divider", + "type": "Divider", + "props": { + "align": "right" + } + }, { + "pluginKey": "samplePreview", + "type": "Custom", + "props": { + "align": "right", + "width": 64 }, - { - pluginKey: 'zhEn', - type: 'Custom', - props: { - align: 'bottom', - }, - config: { - package: '@ali/lowcode-plugin-zh-en', - version: '^1.0.0' - }, - pluginProps: {} + "config": { + "package": "@ali/lowcode-plugin-sample-preview", + "version": "^0.8.0" } - ], - rightArea: [ - { - pluginKey: 'settingsPane', - type: 'Panel', - props: {}, - config: { - package: '@ali/lowcode-plugin-settings-pane', - version: '^1.0.0' - }, - pluginProps: {} - } - ], - centerArea: [ - { - pluginKey: 'designer', - config: { - package: '@ali/lowcode-plugin-designer', - version: '1.0.0' - } + }], + "leftArea": [{ + "pluginKey": "componentsPane", + "type": "PanelIcon", + "props": { + "align": "top", + "icon": "zujianku", + "title": "组件库", + "floatable": true }, - { - pluginKey: 'eventBindDialog', - config: { - package: '@ali/lowcode-plugin-event-bind-dialog', - version: '1.0.0' - } + "config": { + "package": "@ali/lowcode-plugin-components-pane", + "version": "^0.8.0" + }, + "pluginProps": {} + }, { + "pluginKey": "outlinePane", + "type": "PanelIcon", + "props": { + "align": "top", + "icon": "dengpao", + "title": "大纲树" + }, + "config": { + "package": "@ali/lowcode-plugin-outline-pane", + "version": "^0.8.0" + }, + "pluginProps": {} + }, { + "pluginKey": "zhEn", + "type": "Custom", + "props": { + "align": "bottom" + }, + "config": { + "package": "@ali/lowcode-plugin-zh-en", + "version": "^0.8.0" + }, + "pluginProps": {} + }], + "rightArea": [{ + "pluginKey": "settingsPane", + "type": "Panel", + "props": {}, + "config": { + "package": "@ali/lowcode-plugin-settings-pane", + "version": "^0.8.0" + }, + "pluginProps": {} + }], + "centerArea": [{ + "pluginKey": "designer", + "config": { + "package": "@ali/lowcode-plugin-designer", + "version": "^0.8.0" } - ] + }, { + "pluginKey": "eventBindDialog", + "config": { + "package": "@ali/lowcode-plugin-event-bind-dialog", + "version": "^0.8.0" + } + }] }, - hooks: [], - shortCuts: [], - lifeCycles: { - init: async function init(editor) { + "hooks": [], + "shortCuts": [], + "lifeCycles": { + "init": async function init(editor) { const assets = await editor.utils.get('./assets.json'); editor.set('assets', assets); editor.emit('assets.loaded', assets); @@ -147,4 +137,4 @@ export default { editor.emit('schema.loaded', schema); } } -}; +}; \ No newline at end of file diff --git a/packages/demo/src/editor/config/utils.js b/packages/demo/src/editor/config/utils.js index ff8b4c563..dd651ca49 100644 --- a/packages/demo/src/editor/config/utils.js +++ b/packages/demo/src/editor/config/utils.js @@ -1 +1,3 @@ -export default {}; +export default { + +}; \ No newline at end of file diff --git a/packages/demo/src/editor/index.tsx b/packages/demo/src/editor/index.tsx index b229bec9b..c30cfa380 100644 --- a/packages/demo/src/editor/index.tsx +++ b/packages/demo/src/editor/index.tsx @@ -1,6 +1,5 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import Skeleton from '@ali/lowcode-editor-skeleton'; import { registerSetters } from '@ali/lowcode-setters'; import config from './config/skeleton'; import components from './config/components'; @@ -10,7 +9,7 @@ import './global.scss'; import './config/theme.scss'; registerSetters(); - +const Skeleton = components.LowcodeSkeleton; const LCE_CONTAINER = document.getElementById('lce-container'); console.info('aeafeawef')