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 eee3d8461..0c1323ae3 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -1,35 +1,39 @@ { "name": "@ali/lowcode-demo", - "private": true, "version": "0.8.5", + "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.4", - "@ali/lowcode-editor-skeleton": "^0.8.5", - "@ali/lowcode-plugin-components-pane": "^0.8.3", - "@ali/lowcode-plugin-designer": "^0.8.4", - "@ali/lowcode-plugin-event-bind-dialog": "^0.8.4", - "@ali/lowcode-plugin-outline-pane": "^0.8.5", - "@ali/lowcode-plugin-sample-logo": "^0.8.3", - "@ali/lowcode-plugin-sample-preview": "^0.8.4", - "@ali/lowcode-plugin-settings-pane": "^0.8.6", - "@ali/lowcode-plugin-undo-redo": "^0.8.4", + "@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-variable-bind-dialog": "^0.8.0", - "@ali/lowcode-plugin-zh-en": "^0.8.4", + "@ali/lowcode-plugin-zh-en": "^0.8.0", "@ali/lowcode-react-renderer": "^0.8.4", "@ali/lowcode-runtime": "^0.8.0", "@ali/lowcode-setters": "^0.8.4", - "@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..4dd4cc1c0 --- /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: 'shuxingkongjian', + 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 9834f2861..9648a7faf 100644 --- a/packages/demo/src/editor/config/components.js +++ b/packages/demo/src/editor/config/components.js @@ -1,22 +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 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'; -import variableBindDialog from '@ali/lowcode-plugin-variable-bind-dialog' export default { - undoRedo, - zhEn, - designer, - componentsPane, - settingsPane, - outlinePane, - eventBindDialog, - variableBindDialog, + 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 785788481..a772f94ee 100644 --- a/packages/demo/src/editor/config/skeleton.js +++ b/packages/demo/src/editor/config/skeleton.js @@ -1,150 +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: 'shuxingkongjian', - title: '大纲树' - }, - config: { - package: '@ali/lowcode-plugin-outline-pane', - version: '^1.0.0' - }, - pluginProps: {} - }, - { - pluginKey: 'zhEn', - type: 'Custom', - props: { - align: 'bottom', - }, - config: { - package: '@ali/lowcode-plugin-zh-en', - version: '^1.0.0' - }, - pluginProps: {} + "config": { + "package": "@ali/lowcode-plugin-undo-redo", + "version": "^0.8.0" } - ], - rightArea: [ - { - pluginKey: 'settingsPane', - type: 'Panel', - props: {}, - config: { - package: '@ali/lowcode-plugin-settings-pane', - version: '^1.0.0' - }, - pluginProps: {} + }, { + "pluginKey": "divider", + "type": "Divider", + "props": { + "align": "right" } - ], - centerArea: [ - { - pluginKey: 'designer', - config: { - package: '@ali/lowcode-plugin-designer', - version: '1.0.0' - } + }, { + "pluginKey": "samplePreview", + "type": "Custom", + "props": { + "align": "right", + "width": 64 }, - { - pluginKey: 'eventBindDialog', - config: { - package: '@ali/lowcode-plugin-event-bind-dialog', - version: '1.0.0' - } - }, - { - pluginKey: 'variableBindDialog', - config: { - package: '@ali/lowcode-plugin-variable-bind-dialog', - version: '1.0.0' - } + "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": "shuxingkongjian", + "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); 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 f666fe2c5..ab2d9526f 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'); if (!LCE_CONTAINER) {