mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-21 08:28:16 +00:00
merge
This commit is contained in:
commit
b18e3c14b3
@ -27,7 +27,7 @@
|
|||||||
pageType: 'single',
|
pageType: 'single',
|
||||||
deviceType: 'web',
|
deviceType: 'web',
|
||||||
appName: '基础包管理后台',
|
appName: '基础包管理后台',
|
||||||
appType: 'legao_base_packages',
|
appType: '',
|
||||||
templateType: '',
|
templateType: '',
|
||||||
pageId: 'FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V',
|
pageId: 'FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V',
|
||||||
slug: 'test',
|
slug: 'test',
|
||||||
@ -38,10 +38,10 @@
|
|||||||
formType: 'display',
|
formType: 'display',
|
||||||
title: { en_US: '测试', type: 'i18n', zh_CN: '测试' },
|
title: { en_US: '测试', type: 'i18n', zh_CN: '测试' },
|
||||||
urlPrefix: 'https://go.alibaba-inc.com',
|
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
|
devVersion: '0.1.0', // 这个是子应用的变更 id
|
||||||
subAppType: '0.1.0',
|
subAppType: '0.1.0',
|
||||||
appKey: 'legao_base_packages',
|
appKey: '',
|
||||||
RE_VERSION: '7.1.1',
|
RE_VERSION: '7.1.1',
|
||||||
appSource: '',
|
appSource: '',
|
||||||
isDomainDefault: 'n',
|
isDomainDefault: 'n',
|
||||||
|
|||||||
@ -29,6 +29,12 @@
|
|||||||
"@ali/lowcode-setters": "^0.8.11",
|
"@ali/lowcode-setters": "^0.8.11",
|
||||||
"@ali/lowcode-utils": "^0.8.2",
|
"@ali/lowcode-utils": "^0.8.2",
|
||||||
"@ali/vs-variable-setter": "^3.1.0",
|
"@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",
|
"@alifd/next": "^1.19.12",
|
||||||
"@alife/theme-lowcode-dark": "^0.1.0",
|
"@alife/theme-lowcode-dark": "^0.1.0",
|
||||||
"@alife/theme-lowcode-light": "^0.1.0",
|
"@alife/theme-lowcode-light": "^0.1.0",
|
||||||
|
|||||||
@ -1,7 +1,13 @@
|
|||||||
|
/* eslint-disable */
|
||||||
import { createElement } from 'react';
|
import { createElement } from 'react';
|
||||||
import { Button } from '@alifd/next';
|
import { Button } from '@alifd/next';
|
||||||
import Engine, { Panes } from '@ali/visualengine';
|
import Engine, { Panes } from '@ali/visualengine';
|
||||||
import getTrunkPane from '@ali/ve-trunk-pane';
|
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 EventBindDialog from '@ali/lowcode-plugin-event-bind-dialog';
|
||||||
import loadUrls from './loader';
|
import loadUrls from './loader';
|
||||||
import { upgradeAssetsBundle } from './upgrade-assets';
|
import { upgradeAssetsBundle } from './upgrade-assets';
|
||||||
@ -26,7 +32,61 @@ Trunk.registerSetter('I18nSetter', {
|
|||||||
});
|
});
|
||||||
context.use(HOOKS.VE_SETTING_FIELD_VARIABLE_SETTER, VariableSetter);
|
context.use(HOOKS.VE_SETTING_FIELD_VARIABLE_SETTER, VariableSetter);
|
||||||
|
|
||||||
|
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');
|
||||||
|
|
||||||
|
const assets = upgradeAssetsBundle(legaoAssets);
|
||||||
|
|
||||||
|
if (assets.packages) {
|
||||||
|
assets.packages.forEach((item: any) => {
|
||||||
|
if (item.package.indexOf('@ali/vc-') === 0 && item.urls) {
|
||||||
|
item.urls = item.urls.filter((url: string) => {
|
||||||
|
return url.indexOf('view.mobile') < 0;
|
||||||
|
});
|
||||||
|
} else if (item.package && externals.indexOf(item.package) > -1) {
|
||||||
|
item.urls = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (assets['x-prototypes']) {
|
||||||
|
const tasks: Array<Promise<any>> = [];
|
||||||
|
const prototypeStyles: string[] = [];
|
||||||
|
assets['x-prototypes'].forEach((pkg: any) => {
|
||||||
|
if (pkg?.urls) {
|
||||||
|
const urls = Array.isArray(pkg.urls) ? pkg.urls : [pkg.urls];
|
||||||
|
urls.forEach((url: string) => {
|
||||||
|
if (isCSSUrl(url)) {
|
||||||
|
prototypeStyles.push(url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tasks.push(loadUrls(urls));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (prototypeStyles.length > 0) {
|
||||||
|
assets.packages.push({
|
||||||
|
library: '_prototypesStyle',
|
||||||
|
package: '_prototypes-style',
|
||||||
|
urls: prototypeStyles,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await Promise.all(tasks);
|
||||||
|
// proccess snippets
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.set('legao-assets', legaoAssets);
|
||||||
|
editor.set('assets', assets);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadSchema() {
|
||||||
|
const schema = await editor.utils.get('./schema.json');
|
||||||
|
editor.set('schema', schema);
|
||||||
|
}
|
||||||
|
|
||||||
// demo
|
// demo
|
||||||
|
function initDemoPanes() {
|
||||||
skeleton.add({
|
skeleton.add({
|
||||||
name: 'eventBindDialog',
|
name: 'eventBindDialog',
|
||||||
type: 'Widget',
|
type: 'Widget',
|
||||||
@ -107,79 +167,6 @@ skeleton.add({
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
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');
|
|
||||||
|
|
||||||
const assets = upgradeAssetsBundle(legaoAssets);
|
|
||||||
|
|
||||||
if (assets.packages) {
|
|
||||||
assets.packages.forEach((item: any) => {
|
|
||||||
if (item.package.indexOf('@ali/vc-') === 0 && item.urls) {
|
|
||||||
item.urls = item.urls.filter((url: string) => {
|
|
||||||
return url.indexOf('view.mobile') < 0;
|
|
||||||
});
|
|
||||||
} else if (item.package && externals.indexOf(item.package) > -1) {
|
|
||||||
item.urls = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (assets['x-prototypes']) {
|
|
||||||
const tasks: Array<Promise<any>> = [];
|
|
||||||
const prototypeStyles: string[] = [];
|
|
||||||
assets['x-prototypes'].forEach((pkg: any) => {
|
|
||||||
if (pkg?.urls) {
|
|
||||||
const urls = Array.isArray(pkg.urls) ? pkg.urls : [pkg.urls];
|
|
||||||
urls.forEach((url: string) => {
|
|
||||||
if (isCSSUrl(url)) {
|
|
||||||
prototypeStyles.push(url);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tasks.push(loadUrls(urls));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (prototypeStyles.length > 0) {
|
|
||||||
assets.packages.push({
|
|
||||||
library: '_prototypesStyle',
|
|
||||||
package: '_prototypes-style',
|
|
||||||
urls: prototypeStyles,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
await Promise.all(tasks);
|
|
||||||
// proccess snippets
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.set('legao-assets', legaoAssets);
|
|
||||||
editor.set('assets', assets);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadSchema() {
|
|
||||||
const schema = await editor.utils.get('./schema.json');
|
|
||||||
editor.set('schema', schema);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function initTrunkPane() {
|
async function initTrunkPane() {
|
||||||
@ -197,3 +184,119 @@ async function initTrunkPane() {
|
|||||||
const TrunkPane = getTrunkPane(config);
|
const TrunkPane = getTrunkPane(config);
|
||||||
Panes.add(TrunkPane);
|
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();
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable */
|
||||||
function getStylePoint(id, level) {
|
function getStylePoint(id, level) {
|
||||||
if (stylePointTable[id]) {
|
if (stylePointTable[id]) {
|
||||||
return stylePointTable[id];
|
return stylePointTable[id];
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable */
|
||||||
export function upgradeAssetsBundle(assets) {
|
export function upgradeAssetsBundle(assets) {
|
||||||
const components = [];
|
const components = [];
|
||||||
const xPrototypes = [];
|
const xPrototypes = [];
|
||||||
|
|||||||
@ -94,6 +94,10 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
|||||||
*/
|
*/
|
||||||
readonly props: Props;
|
readonly props: Props;
|
||||||
protected _children?: NodeChildren;
|
protected _children?: NodeChildren;
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
private _addons: { [key: string]: any } = {};
|
||||||
@obx.ref private _parent: ParentalNode | null = null;
|
@obx.ref private _parent: ParentalNode | null = null;
|
||||||
/**
|
/**
|
||||||
* 父级节点
|
* 父级节点
|
||||||
@ -479,11 +483,22 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { props = {}, extras } = this.props.export(stage) || {};
|
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 = {
|
const schema: any = {
|
||||||
...baseSchema,
|
...baseSchema,
|
||||||
props: this.document.designer.transformProps(props, this, stage),
|
props: this.document.designer.transformProps(props, this, stage),
|
||||||
...extras,
|
..._extras_,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.isParental() && this.children.size > 0) {
|
if (this.isParental() && this.children.size > 0) {
|
||||||
@ -618,10 +633,27 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
|||||||
}
|
}
|
||||||
return { container: this.parent, ref: this };
|
return { container: this.parent, ref: this };
|
||||||
}
|
}
|
||||||
getAddonData() {
|
/**
|
||||||
// TODO:
|
* @deprecated
|
||||||
return { online: [] };
|
*/
|
||||||
|
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() {
|
toString() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,7 +108,7 @@ body {
|
|||||||
.lc-panel {
|
.lc-panel {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: auto;
|
// overflow: auto;
|
||||||
&.hidden {
|
&.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ body {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: var(--dock-pane-width);
|
// width: var(--dock-pane-width);
|
||||||
left: calc(var(--left-area-width) + 1px);
|
left: calc(var(--left-area-width) + 1px);
|
||||||
background-color: var(--color-pane-background);
|
background-color: var(--color-pane-background);
|
||||||
box-shadow: 4px 0 16px 0 rgba(31,50,88,0.08);
|
box-shadow: 4px 0 16px 0 rgba(31,50,88,0.08);
|
||||||
|
|||||||
@ -25,7 +25,6 @@
|
|||||||
"@ali/ve-icons": "^4.1.9",
|
"@ali/ve-icons": "^4.1.9",
|
||||||
"@ali/ve-less-variables": "2.0.3",
|
"@ali/ve-less-variables": "2.0.3",
|
||||||
"@ali/ve-popups": "^4.2.5",
|
"@ali/ve-popups": "^4.2.5",
|
||||||
"@ali/ve-trunk-pane": "^5.1.0-beta.14",
|
|
||||||
"@ali/ve-utils": "^1.1.0",
|
"@ali/ve-utils": "^1.1.0",
|
||||||
"@ali/vu-css-style": "^1.1.3",
|
"@ali/vu-css-style": "^1.1.3",
|
||||||
"@ali/vu-logger": "^1.0.7",
|
"@ali/vu-logger": "^1.0.7",
|
||||||
|
|||||||
@ -100,17 +100,17 @@ skeleton.add({
|
|||||||
content: Preview,
|
content: Preview,
|
||||||
});
|
});
|
||||||
|
|
||||||
skeleton.add({
|
// skeleton.add({
|
||||||
name: 'sourceEditor',
|
// name: 'sourceEditor',
|
||||||
type: 'PanelDock',
|
// type: 'PanelDock',
|
||||||
props: {
|
// props: {
|
||||||
align: 'top',
|
// align: 'top',
|
||||||
icon: 'code',
|
// icon: 'code',
|
||||||
description: '组件库',
|
// description: '组件库',
|
||||||
},
|
// },
|
||||||
panelProps: {
|
// panelProps: {
|
||||||
width: 500
|
// width: 500
|
||||||
// area: 'leftFixedArea'
|
// // area: 'leftFixedArea'
|
||||||
},
|
// },
|
||||||
content: SourceEditor,
|
// content: SourceEditor,
|
||||||
});
|
// });
|
||||||
|
|||||||
@ -68,7 +68,18 @@ function upgradeConfig(config: OldPaneConfig): IWidgetBaseConfig & { area: strin
|
|||||||
if (type === 'dock') {
|
if (type === 'dock') {
|
||||||
newConfig.type = 'PanelDock';
|
newConfig.type = 'PanelDock';
|
||||||
newConfig.area = 'left';
|
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) {
|
if (menu) {
|
||||||
newConfig.props.title = menu;
|
newConfig.props.title = menu;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user