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) { init: async function init(editor) {
const assets = await editor.utils.get('./assets.json'); const assets = await editor.utils.get('./assets.json');
editor.set('assets', assets); 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'); const schema = await editor.utils.get('./schema.json');
editor.set('schema', schema); editor.set('schema', schema);

View File

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

View File

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

View File

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

View File

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

View File

@ -55,5 +55,5 @@
"publishConfig": { "publishConfig": {
"registry": "https://registry.npm.alibaba-inc.com" "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"
} }