Merge branch 'release/1.0.0' of gitlab.alibaba-inc.com:ali-lowcode/ali-lowcode-engine into release/1.0.0

This commit is contained in:
zude.hzd 2020-09-01 15:46:14 +08:00
commit adf492779d
6 changed files with 19 additions and 12 deletions

View File

@ -120,6 +120,12 @@ export default {
init: async function init(editor) {
const assets = await editor.utils.get('./assets.json');
editor.set('assets', assets);
const simulatorUrl = [
'https://dev.g.alicdn.com/ali-lowcode/ali-lowcode-engine/0.9.50/react-simulator-renderer.css',
'https://dev.g.alicdn.com/ali-lowcode/ali-lowcode-engine/0.9.50/react-simulator-renderer.js',
];
editor.set('simulatorUrl', simulatorUrl);
// editor.set('renderEnv', 'rax');
const schema = await editor.utils.get('./schema.json');
editor.set('schema', schema);

View File

@ -225,7 +225,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
const vendors = [
// required & use once
assetBundle(
this.get('environment') || this.renderEnv === 'rax' ? defaultRaxEnvironment : defaultEnvironment,
this.get('environment') || (this.renderEnv === 'rax' ? defaultRaxEnvironment : defaultEnvironment),
AssetLevel.Environment,
),
// required & use once
@ -236,7 +236,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
assetBundle(this.theme, AssetLevel.Theme),
// required & use once
assetBundle(
this.get('simulatorUrl') || this.renderEnv === 'rax' ? defaultRaxSimulatorUrl : defaultSimulatorUrl,
this.get('simulatorUrl') || (this.renderEnv === 'rax' ? defaultRaxSimulatorUrl : defaultSimulatorUrl),
AssetLevel.Runtime,
),
];

View File

@ -1,6 +1,7 @@
import React, { PureComponent } from 'react';
import { Editor } from '@ali/lowcode-editor-core';
import { DesignerView, Designer } from '@ali/lowcode-designer';
import { Asset } from '@ali/lowcode-utils';
import './index.scss';
export interface PluginProps {
@ -13,6 +14,7 @@ interface DesignerPluginState {
extraEnvironment?: any[] | null;
renderEnv?: string;
device?: string;
simulatorUrl: Asset | null;
}
export default class DesignerPlugin extends PureComponent<PluginProps, DesignerPluginState> {
@ -24,6 +26,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
extraEnvironment: null,
renderEnv: 'default',
device: 'default',
simulatorUrl: null,
};
private _mounted = true;
@ -39,6 +42,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
const assets = await editor.onceGot('assets');
const renderEnv = await editor.get('renderEnv');
const device = await editor.get('device');
const simulatorUrl = await editor.get('simulatorUrl');
if (!this._mounted) {
return;
}
@ -49,6 +53,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
extraEnvironment,
renderEnv,
device,
simulatorUrl,
};
this.setState(state);
} catch (e) {
@ -71,8 +76,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
render(): React.ReactNode {
const { editor } = this.props;
const { componentMetadatas, library, extraEnvironment, renderEnv, device } = this.state;
const { componentMetadatas, library, extraEnvironment, renderEnv, device, simulatorUrl } = this.state;
if (!library || !componentMetadatas) {
// TODO: use a Loading
return null;
@ -90,6 +94,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
extraEnvironment,
renderEnv,
device,
simulatorUrl,
}}
/>
);

View File

@ -24,7 +24,6 @@
"@ali/lowcode-editor-skeleton": "^1.0.5-0",
"@ali/lowcode-types": "^1.0.5-0",
"@ali/lowcode-utils": "^1.0.5-0",
"@ali/ve-icons": "^4.1.14",
"react": "^16.8.1",
"react-dom": "^16.8.1"
},

View File

@ -1,7 +1,6 @@
import React, { PureComponent } from 'react';
import { Editor } from '@ali/lowcode-editor-core';
import Icon from '@ali/ve-icons';
import { Button } from '@alifd/next';
import { Button, Icon } from '@alifd/next';
import { Designer } from '@ali/lowcode-designer';
import { PluginProps } from '@ali/lowcode-types';
@ -84,23 +83,21 @@ export default class UndoRedo extends PureComponent<IProps, IState> {
size="medium"
data-tip="撤销"
data-dir="bottom"
className="ve-local-history-item"
onClick={this.handleUndoClick}
ghost
disabled={!undoEnable}
>
<Icon name="amindUndo" size="18px" />
<Icon type="houtui" />
</Button>
<Button
size="medium"
data-tip="恢复"
data-dir="bottom"
className="ve-local-history-item"
onClick={this.handleRedoClick}
ghost
disabled={!redoEnable}
>
<Icon name="forward" size="18px" />
<Icon type="qianjin" />
</Button>
</div>
);

View File

@ -55,5 +55,5 @@
"publishConfig": {
"registry": "https://registry.npm.alibaba-inc.com"
},
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-rax-simulator-renderer@1.0.4-0/build/index.html"
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-rax-simulator-renderer@1.0.5-0/build/index.html"
}