diff --git a/deploy-space/static/index.html b/deploy-space/static/index.html index 64031e0b8..5b34a9a1c 100644 --- a/deploy-space/static/index.html +++ b/deploy-space/static/index.html @@ -27,7 +27,7 @@ pageType: 'single', deviceType: 'web', appName: '基础包管理后台', - appType: 'legao_base_packages', + appType: '', templateType: '', pageId: 'FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V', slug: 'test', @@ -38,10 +38,10 @@ formType: 'display', title: { en_US: '测试', type: 'i18n', zh_CN: '测试' }, urlPrefix: 'https://go.alibaba-inc.com', - APIUrlPrefix: 'https://go.alibaba-inc.com', + APIUrlPrefix: 'https://mocks.alibaba-inc.com/mock/lowCodeEngine', devVersion: '0.1.0', // 这个是子应用的变更 id subAppType: '0.1.0', - appKey: 'legao_base_packages', + appKey: '', RE_VERSION: '7.1.1', appSource: '', isDomainDefault: 'n', diff --git a/packages/demo/package.json b/packages/demo/package.json index 763fe5012..df84e721f 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -29,6 +29,12 @@ "@ali/lowcode-setters": "^0.8.11", "@ali/lowcode-utils": "^0.8.2", "@ali/vs-variable-setter": "^3.1.0", + "@ali/ve-action-pane": "^4.7.0-beta.0", + "@ali/ve-datapool-pane": "^6.4.3", + "@ali/ve-i18n-manage-pane": "^4.3.0", + "@ali/ve-i18n-pane": "^4.0.0-beta.0", + "@ali/ve-trunk-pane": "^5.1.0-beta.14", + "@ali/vu-legao-design-fetch-context": "^1.0.3", "@alifd/next": "^1.19.12", "@alife/theme-lowcode-dark": "^0.1.0", "@alife/theme-lowcode-light": "^0.1.0", diff --git a/packages/demo/src/vision/index.ts b/packages/demo/src/vision/index.ts index b216de07c..36e8e4267 100644 --- a/packages/demo/src/vision/index.ts +++ b/packages/demo/src/vision/index.ts @@ -1,7 +1,13 @@ +/* eslint-disable */ import { createElement } from 'react'; import { Button } from '@alifd/next'; import Engine, { Panes } from '@ali/visualengine'; import getTrunkPane from '@ali/ve-trunk-pane'; +import DatapoolPane from '@ali/ve-datapool-pane'; +// import I18nPane from '@ali/ve-i18n-pane'; +import I18nManagePane from '@ali/ve-i18n-manage-pane'; +import ActionPane from '@ali/ve-action-pane'; +import fetchContext from '@ali/vu-legao-design-fetch-context'; import EventBindDialog from '@ali/lowcode-plugin-event-bind-dialog'; import loadUrls from './loader'; import { upgradeAssetsBundle } from './upgrade-assets'; @@ -26,111 +32,8 @@ Trunk.registerSetter('I18nSetter', { }); context.use(HOOKS.VE_SETTING_FIELD_VARIABLE_SETTER, VariableSetter); -// demo -skeleton.add({ - name: 'eventBindDialog', - type: 'Widget', - content: EventBindDialog, -}); -skeleton.add({ - area: 'leftArea', - name: 'icon1', - type: 'Dock', - props: { - align: 'bottom', - icon: 'set', - description: '设置', - }, -}); -skeleton.add({ - area: 'leftArea', - name: 'icon2', - type: 'Dock', - props: { - align: 'bottom', - icon: 'help', - description: '帮助', - }, -}); - -skeleton.add({ - area: 'topArea', - type: 'Dock', - name: 'publish', - props: { - align: 'right', - }, - content: createElement(Button, { - size: 'small', - type: 'secondary', - children: '发布', - }), -}); -skeleton.add({ - area: 'topArea', - type: 'Dock', - name: 'save', - props: { - align: 'right', - }, - content: createElement(Button, { - size: 'small', - type: 'primary', - children: '保存', - }), -}); -skeleton.add({ - area: 'topArea', - type: 'Dock', - name: 'preview4', - props: { - align: 'center', - }, - content: createElement('img', { - src: 'https://img.alicdn.com/tfs/TB1WW.VC.z1gK0jSZLeXXb9kVXa-486-64.png', - style: { - height: 32, - }, - }), -}); -skeleton.add({ - area: 'topArea', - type: 'Dock', - name: 'preview1', - props: { - align: 'left', - }, - content: createElement('img', { - src: 'https://img.alicdn.com/tfs/TB1zqBfDlr0gK0jSZFnXXbRRXXa-440-64.png', - style: { - height: 32, - }, - }), -}); - -skeleton.add({ - area: 'toolbar', - type: 'Dock', - name: 'preview2', - props: { - align: 'left', - }, - content: 'aeawfeawe', -}); - -initTrunkPane(); -Engine.init(); - -load(); -Engine.Env.setEnv('RE_VERSION', '5.0.1'); - -async function load() { - await loadAssets(); - - loadSchema(); -} - const externals = ['react', 'react-dom', 'prop-types', 'react-router', 'react-router-dom', '@ali/recore']; + async function loadAssets() { const legaoAssets = await editor.utils.get('./legao-assets.json'); @@ -182,6 +85,90 @@ async function loadSchema() { editor.set('schema', schema); } +// demo +function initDemoPanes() { + skeleton.add({ + name: 'eventBindDialog', + type: 'Widget', + content: EventBindDialog, + }); + skeleton.add({ + area: 'leftArea', + name: 'icon1', + type: 'Dock', + props: { + align: 'bottom', + icon: 'set', + description: '设置', + }, + }); + skeleton.add({ + area: 'leftArea', + name: 'icon2', + type: 'Dock', + props: { + align: 'bottom', + icon: 'help', + description: '帮助', + }, + }); + + skeleton.add({ + area: 'topArea', + type: 'Dock', + name: 'publish', + props: { + align: 'right', + }, + content: createElement(Button, { + size: 'small', + type: 'secondary', + children: '发布', + }), + }); + skeleton.add({ + area: 'topArea', + type: 'Dock', + name: 'save', + props: { + align: 'right', + }, + content: createElement(Button, { + size: 'small', + type: 'primary', + children: '保存', + }), + }); + skeleton.add({ + area: 'topArea', + type: 'Dock', + name: 'preview4', + props: { + align: 'center', + }, + content: createElement('img', { + src: 'https://img.alicdn.com/tfs/TB1WW.VC.z1gK0jSZLeXXb9kVXa-486-64.png', + style: { + height: 32, + }, + }), + }); + skeleton.add({ + area: 'topArea', + type: 'Dock', + name: 'preview1', + props: { + align: 'left', + }, + content: createElement('img', { + src: 'https://img.alicdn.com/tfs/TB1zqBfDlr0gK0jSZFnXXbRRXXa-440-64.png', + style: { + height: 32, + }, + }), + }); +} + async function initTrunkPane() { const assets = await editor.onceGot('legao-assets'); const config = { @@ -197,3 +184,119 @@ async function initTrunkPane() { const TrunkPane = getTrunkPane(config); Panes.add(TrunkPane); } + +// 数据源面板 +function initDataPoolPane() { + const dpConfigs = {}; + + if (!dpConfigs) { + return; + } + + fetchContext.create('DataPoolPaneAPI', { + saveGlobalConfig: { + url: 'query/appConfig/saveGlobalConfig.json', + method: 'POST', + }, + saveOrUpdateAppDataPool: { + url: 'query/appDataPool/saveOrUpdateAppDataPool.json', + method: 'POST', + }, + batchSaveOrUpdateAppDataPool: { + url: 'query/appDataPool/batchSaveOrUpdateAppDataPool.json', + method: 'POST' + }, + listAppDataPool: { + url: 'query/appDataPool/listAppDataPool.json', + method: 'GET', + }, + getAppDataPool: { + url: 'query/appDataPool/getAppDataPool.json', + method: 'POST', + }, + getEpaasApiInApp: { + url: 'query/formdesign/getEpaasApiInApp.jsonp', + method: 'GET', + }, + getFormListOrder: { + url: 'query/formdesign/getFormListOrder.json', + method: 'GET', + }, + // 实时修改 effectForm + operateAppDpBind: { + url: 'query/appDataPool/operateAppDpBind.json', + method: 'POST', + }, + // 校验全局数据源是否被其他页面修改 + checkAppDataPoolModified: { + url: 'query/appDataPool/checkAppDataPoolModified.json', + method: 'POST', + }, + }); + + const props = { + enableGateService: true, + enableGlobalFitConfig: true, + enableOneAPIService: true, + formUuid: 'xxx', + api: fetchContext.api.DataPoolPaneAPI, + }; + + Panes.add(DatapoolPane, { + props, + }); +} + +// 国际化面板 +function initI18nPane() { + fetchContext.create('I18nManagePaneAPI', { + // 绑定美杜莎 + bindMedusa: { + url: 'query/app/createMedusa.json', + }, + + // 解除绑定 + unbindMedusa: { + url: 'query/app/removeMedusa.json', + }, + + // 同步美杜莎 + syncMedusa: { + url: 'query/formi18n/syncI18n.json', + }, + }); + + Panes.add(I18nManagePane, { + props: { + enableMedusa: true, + api: fetchContext.api.I18nManagePaneAPI, + }, + }); +} + +// 动作面板 +function initActionPane() { + const props = { + enableGlobalJS: false, + enableVsCodeEdit: false, + enableHeaderTip: true, + }; + + Panes.add(ActionPane, { + props, + }); +} + +async function init() { + Engine.Env.setEnv('RE_VERSION', '7.2.0'); + await loadAssets(); + await loadSchema(); + await initTrunkPane(); + initDataPoolPane(); + initI18nPane(); + initActionPane(); + initDemoPanes(); + + Engine.init(); +} +init(); diff --git a/packages/demo/src/vision/loader.js b/packages/demo/src/vision/loader.js index 0774ae32a..4f4bd1a24 100644 --- a/packages/demo/src/vision/loader.js +++ b/packages/demo/src/vision/loader.js @@ -1,3 +1,4 @@ +/* eslint-disable */ function getStylePoint(id, level) { if (stylePointTable[id]) { return stylePointTable[id]; diff --git a/packages/demo/src/vision/upgrade-assets.js b/packages/demo/src/vision/upgrade-assets.js index 770bdf796..3548aaac5 100644 --- a/packages/demo/src/vision/upgrade-assets.js +++ b/packages/demo/src/vision/upgrade-assets.js @@ -1,3 +1,4 @@ +/* eslint-disable */ export function upgradeAssetsBundle(assets) { const components = []; const xPrototypes = []; diff --git a/packages/designer/src/document/node/node.ts b/packages/designer/src/document/node/node.ts index 32e5205ac..cd4d1db5b 100644 --- a/packages/designer/src/document/node/node.ts +++ b/packages/designer/src/document/node/node.ts @@ -94,6 +94,10 @@ export class Node { */ readonly props: Props; protected _children?: NodeChildren; + /** + * @deprecated + */ + private _addons: { [key: string]: any } = {}; @obx.ref private _parent: ParentalNode | null = null; /** * 父级节点 @@ -479,11 +483,22 @@ export class Node { } const { props = {}, extras } = this.props.export(stage) || {}; + const _extras_: {[key: string]: any} = { + ...extras, + }; + if (_extras_) { + Object.keys(_extras_).forEach((key) => { + const addon = this._addons[key]; + if (addon) { + _extras_[key] = addon(); + } + }); + } const schema: any = { ...baseSchema, props: this.document.designer.transformProps(props, this, stage), - ...extras, + ..._extras_, }; if (this.isParental() && this.children.size > 0) { @@ -618,10 +633,27 @@ export class Node { } return { container: this.parent, ref: this }; } - getAddonData() { - // TODO: - return { online: [] }; + /** + * @deprecated + */ + getAddonData(key: string) { + const addon = this._addons[key]; + if (addon) { + return addon(); + } + return this.getExtraProp(key)?.value; } + /** + * @deprecated + */ + registerAddon(key: string, exportData: any) { + if (this._addons[key]) { + throw new Error(`node addon ${key} exist`); + } + + this._addons[key] = exportData; + } + toString() { return this.id; } diff --git a/packages/editor-skeleton/src/layouts/workbench.less b/packages/editor-skeleton/src/layouts/workbench.less index 92deeeacd..c4019db63 100644 --- a/packages/editor-skeleton/src/layouts/workbench.less +++ b/packages/editor-skeleton/src/layouts/workbench.less @@ -108,7 +108,7 @@ body { .lc-panel { height: 100%; width: 100%; - overflow: auto; + // overflow: auto; &.hidden { display: none; } @@ -211,7 +211,7 @@ body { position: absolute; top: 0; bottom: 0; - width: var(--dock-pane-width); + // width: var(--dock-pane-width); left: calc(var(--left-area-width) + 1px); background-color: var(--color-pane-background); box-shadow: 4px 0 16px 0 rgba(31,50,88,0.08); diff --git a/packages/vision-preset/package.json b/packages/vision-preset/package.json index 550154aef..a99baaeab 100644 --- a/packages/vision-preset/package.json +++ b/packages/vision-preset/package.json @@ -25,7 +25,6 @@ "@ali/ve-icons": "^4.1.9", "@ali/ve-less-variables": "2.0.3", "@ali/ve-popups": "^4.2.5", - "@ali/ve-trunk-pane": "^5.1.0-beta.14", "@ali/ve-utils": "^1.1.0", "@ali/vu-css-style": "^1.1.3", "@ali/vu-logger": "^1.0.7", diff --git a/packages/vision-preset/src/editor.ts b/packages/vision-preset/src/editor.ts index 9c98374a9..2c965991e 100644 --- a/packages/vision-preset/src/editor.ts +++ b/packages/vision-preset/src/editor.ts @@ -100,17 +100,17 @@ skeleton.add({ content: Preview, }); -skeleton.add({ - name: 'sourceEditor', - type: 'PanelDock', - props: { - align: 'top', - icon: 'code', - description: '组件库', - }, - panelProps: { - width: 500 - // area: 'leftFixedArea' - }, - content: SourceEditor, -}); +// skeleton.add({ +// name: 'sourceEditor', +// type: 'PanelDock', +// props: { +// align: 'top', +// icon: 'code', +// description: '组件库', +// }, +// panelProps: { +// width: 500 +// // area: 'leftFixedArea' +// }, +// content: SourceEditor, +// }); diff --git a/packages/vision-preset/src/panes.ts b/packages/vision-preset/src/panes.ts index 08c426edf..750307496 100644 --- a/packages/vision-preset/src/panes.ts +++ b/packages/vision-preset/src/panes.ts @@ -68,7 +68,18 @@ function upgradeConfig(config: OldPaneConfig): IWidgetBaseConfig & { area: strin if (type === 'dock') { newConfig.type = 'PanelDock'; newConfig.area = 'left'; - const { contents, hideTitleBar, tip, width, maxWidth, height, maxHeight, position, menu, isAction } = config; + newConfig.props.description = description || title; + const { + contents, + hideTitleBar, + tip, + width, + maxWidth, + height, + maxHeight, + menu, + isAction + } = config; if (menu) { newConfig.props.title = menu; }