mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
Merge branch 'polyfill/vision' of gitlab.alibaba-inc.com:ali-lowcode/ali-lowcode-engine into polyfill/vision
This commit is contained in:
commit
2b46604bd7
@ -48,11 +48,7 @@ async function loadAssets() {
|
||||
|
||||
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) {
|
||||
if (item.package && externals.indexOf(item.package) > -1) {
|
||||
item.urls = null;
|
||||
}
|
||||
});
|
||||
@ -425,7 +421,7 @@ function initHistoryPane() {
|
||||
historyManager: {
|
||||
historyManager,
|
||||
app: {
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
index: -940,
|
||||
|
||||
@ -39,27 +39,25 @@ export class BorderHoveringInstance extends PureComponent<{
|
||||
}
|
||||
|
||||
@observer
|
||||
export class BorderHovering extends Component {
|
||||
static contextType = SimulatorContext;
|
||||
|
||||
export class BorderHovering extends Component<{ host: BuiltinSimulatorHost }> {
|
||||
shouldComponentUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@computed get scale() {
|
||||
return (this.context as BuiltinSimulatorHost).viewport.scale;
|
||||
return this.props.host.viewport.scale;
|
||||
}
|
||||
|
||||
@computed get scrollX() {
|
||||
return (this.context as BuiltinSimulatorHost).viewport.scrollX;
|
||||
return this.props.host.viewport.scrollX;
|
||||
}
|
||||
|
||||
@computed get scrollY() {
|
||||
return (this.context as BuiltinSimulatorHost).viewport.scrollY;
|
||||
return this.props.host.viewport.scrollY;
|
||||
}
|
||||
|
||||
@computed get current() {
|
||||
const host = this.context as BuiltinSimulatorHost;
|
||||
const host = this.props.host;
|
||||
const doc = host.document;
|
||||
const selection = doc.selection;
|
||||
const current = host.designer.hovering.current;
|
||||
@ -70,7 +68,7 @@ export class BorderHovering extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const host = this.context as BuiltinSimulatorHost;
|
||||
const host = this.props.host;
|
||||
const current = this.current;
|
||||
if (!current || host.viewport.scrolling) {
|
||||
return <Fragment />;
|
||||
|
||||
@ -132,11 +132,9 @@ function createAction(content: ReactNode | ComponentType<any> | ActionContentObj
|
||||
}
|
||||
|
||||
@observer
|
||||
export class BorderSelectingForNode extends Component<{ node: Node }> {
|
||||
static contextType = SimulatorContext;
|
||||
|
||||
export class BorderSelectingForNode extends Component<{ host: BuiltinSimulatorHost; node: Node }> {
|
||||
get host(): BuiltinSimulatorHost {
|
||||
return this.context;
|
||||
return this.props.host;
|
||||
}
|
||||
|
||||
get dragging(): boolean {
|
||||
@ -177,11 +175,9 @@ export class BorderSelectingForNode extends Component<{ node: Node }> {
|
||||
}
|
||||
|
||||
@observer
|
||||
export class BorderSelecting extends Component {
|
||||
static contextType = SimulatorContext;
|
||||
|
||||
export class BorderSelecting extends Component<{ host: BuiltinSimulatorHost }> {
|
||||
get host(): BuiltinSimulatorHost {
|
||||
return this.context;
|
||||
return this.props.host;
|
||||
}
|
||||
|
||||
get dragging(): boolean {
|
||||
@ -211,7 +207,7 @@ export class BorderSelecting extends Component {
|
||||
return (
|
||||
<Fragment>
|
||||
{selecting.map((node) => (
|
||||
<BorderSelectingForNode key={node.id} node={node} />
|
||||
<BorderSelectingForNode key={node.id} host={this.props.host} node={node} />
|
||||
))}
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { Component } from 'react';
|
||||
import { observer } from '@ali/lowcode-editor-core';
|
||||
import { BorderHovering } from './border-hovering';
|
||||
import { SimulatorContext } from '../context';
|
||||
import { BuiltinSimulatorHost } from '../host';
|
||||
import { BorderSelecting } from './border-selecting';
|
||||
import { InsertionView } from './insertion';
|
||||
@ -9,21 +8,19 @@ import './bem-tools.less';
|
||||
import './borders.less';
|
||||
|
||||
@observer
|
||||
export class BemTools extends Component {
|
||||
static contextType = SimulatorContext;
|
||||
|
||||
export class BemTools extends Component<{ host: BuiltinSimulatorHost }> {
|
||||
shouldComponentUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
render() {
|
||||
const host = this.context as BuiltinSimulatorHost;
|
||||
const host = this.props.host;
|
||||
const { scrollX, scrollY, scale } = host.viewport;
|
||||
return (
|
||||
<div className="lc-bem-tools" style={{ transform: `translate(${-scrollX * scale}px,${-scrollY * scale}px)` }}>
|
||||
<BorderHovering key="hovering" />
|
||||
<BorderSelecting key="selecting" />
|
||||
<InsertionView key="insertion" />
|
||||
<BorderHovering key="hovering" host={host} />
|
||||
<BorderSelecting key="selecting" host={host} />
|
||||
<InsertionView key="insertion" host={host} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -112,24 +112,19 @@ function processDetail({ target, detail, document }: DropLocation): InsertionDat
|
||||
}
|
||||
|
||||
@observer
|
||||
export class InsertionView extends Component {
|
||||
static contextType = SimulatorContext;
|
||||
|
||||
@computed get host(): BuiltinSimulatorHost {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
export class InsertionView extends Component<{ host: BuiltinSimulatorHost }> {
|
||||
shouldComponentUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
render() {
|
||||
const loc = this.host.document.dropLocation;
|
||||
const { host } = this.props;
|
||||
const loc = host.document.dropLocation;
|
||||
if (!loc) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { scale, scrollX, scrollY } = this.host.viewport;
|
||||
const { scale, scrollX, scrollY } = host.viewport;
|
||||
const { edge, insertType, coverRect, nearRect, vertical } = processDetail(loc);
|
||||
|
||||
if (!edge) {
|
||||
|
||||
@ -41,20 +41,17 @@ export class BuiltinSimulatorHostView extends Component<SimulatorHostProps> {
|
||||
const { Provider } = SimulatorContext;
|
||||
return (
|
||||
<div className="lc-simulator">
|
||||
<Provider value={this.host}>
|
||||
{/*progressing.visible ? <PreLoaderView /> : null*/}
|
||||
<Canvas />
|
||||
</Provider>
|
||||
{/*progressing.visible ? <PreLoaderView /> : null*/}
|
||||
<Canvas host={this.host} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@observer
|
||||
class Canvas extends Component {
|
||||
static contextType = SimulatorContext;
|
||||
class Canvas extends Component<{ host: BuiltinSimulatorHost }> {
|
||||
render() {
|
||||
const sim = this.context as BuiltinSimulatorHost;
|
||||
const sim = this.props.host;
|
||||
let className = 'lc-simulator-canvas';
|
||||
if (sim.deviceClassName) {
|
||||
className += ` ${sim.deviceClassName}`;
|
||||
@ -65,8 +62,8 @@ class Canvas extends Component {
|
||||
return (
|
||||
<div className={className}>
|
||||
<div ref={elmt => sim.mountViewport(elmt)} className="lc-simulator-canvas-viewport">
|
||||
<BemTools />
|
||||
<Content />
|
||||
<BemTools host={sim} />
|
||||
<Content host={sim} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@ -74,10 +71,9 @@ class Canvas extends Component {
|
||||
}
|
||||
|
||||
@observer
|
||||
class Content extends Component {
|
||||
static contextType = SimulatorContext;
|
||||
class Content extends Component<{ host: BuiltinSimulatorHost }> {
|
||||
render() {
|
||||
const sim = this.context as BuiltinSimulatorHost;
|
||||
const sim = this.props.host;
|
||||
const viewport = sim.viewport;
|
||||
let frameStyle = {};
|
||||
if (viewport.scale < 1) {
|
||||
|
||||
@ -309,4 +309,11 @@ export class Props implements IPropParent {
|
||||
getPropValue(path: string): any {
|
||||
return this.getProp(path, false)?.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置单个属性值
|
||||
*/
|
||||
setPropValue(path: string, value: any) {
|
||||
this.getProp(path, true)!.setValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,11 @@ export interface OldPageData {
|
||||
|
||||
const pages = Object.assign(project, {
|
||||
setPages(pages: OldPageData[]) {
|
||||
// FIXME: upgrade schema
|
||||
pages[0].componentsTree.forEach((item: any) => {
|
||||
item.lifeCycles = {};
|
||||
item.methods = {};
|
||||
});
|
||||
project.load({
|
||||
version: '1.0.0',
|
||||
componentsMap: [],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user