mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 17:08:14 +00:00
Merge remote-tracking branch 'origin/trunk-vision' into release/0.9.16
This commit is contained in:
commit
218101deda
@ -87,7 +87,7 @@ const defaultRaxSimulatorUrl = (() => {
|
||||
|
||||
const defaultEnvironment = [
|
||||
// https://g.alicdn.com/mylib/??react/16.11.0/umd/react.production.min.js,react-dom/16.8.6/umd/react-dom.production.min.js,prop-types/15.7.2/prop-types.min.js
|
||||
assetItem(AssetType.JSText, 'window.React=parent.React;window.ReactDOM=parent.ReactDOM;', undefined, 'react'),
|
||||
assetItem(AssetType.JSText, 'window.React=parent.React;window.ReactDOM=parent.ReactDOM;window.__is_simulator_env__=true;', undefined, 'react'),
|
||||
assetItem(
|
||||
AssetType.JSText,
|
||||
'window.PropTypes=parent.PropTypes;React.PropTypes=parent.PropTypes; window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;',
|
||||
@ -877,7 +877,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
if (nodes && (!operationalNodes || operationalNodes.length === 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.sensing = true;
|
||||
this.scroller.scrolling(e);
|
||||
const dropContainer = this.getDropContainer(e);
|
||||
|
||||
@ -13,6 +13,7 @@ export class NodeChildren {
|
||||
this.children = (Array.isArray(data) ? data : [data]).map(child => {
|
||||
return this.owner.document.createNode(child);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
interalInitParent() {
|
||||
@ -63,7 +64,7 @@ export class NodeChildren {
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param nodes
|
||||
* @param nodes
|
||||
*/
|
||||
concat(nodes: Node[]) {
|
||||
return this.children.concat(nodes);
|
||||
@ -235,7 +236,6 @@ export class NodeChildren {
|
||||
return fn(child, index);
|
||||
});
|
||||
}
|
||||
|
||||
every(fn: (item: Node, index: number) => any): boolean {
|
||||
return this.children.every((child, index) => fn(child, index));
|
||||
}
|
||||
@ -248,6 +248,10 @@ export class NodeChildren {
|
||||
return this.children.filter(fn);
|
||||
}
|
||||
|
||||
find(fn: (item: Node, index: number) => Node) {
|
||||
return this.children.find(fn);
|
||||
}
|
||||
|
||||
mergeChildren(remover: () => any, adder: (children: Node[]) => NodeData[] | null, sorter: () => any) {
|
||||
let changed = false;
|
||||
if (remover) {
|
||||
|
||||
@ -126,8 +126,8 @@ export default class Bundle {
|
||||
*/
|
||||
if (bundles.length >= 2) {
|
||||
const prototype = bundles[0];
|
||||
// const metadata = upgradeMetadata(prototype.options);
|
||||
// prototype.meta = designer.createComponentMeta(metadata);
|
||||
const metadata = upgradeMetadata(prototype.options);
|
||||
prototype.meta = designer.createComponentMeta(metadata);
|
||||
const prototypeView = bundles[1];
|
||||
prototype.setView(prototypeView);
|
||||
this.registerPrototype(prototype);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ComponentType, ReactElement, Component, FunctionComponent } from 'react';
|
||||
import { ComponentMetadata, FieldConfig, InitialItem, FilterItem, AutorunItem, isI18nData } from '@ali/lowcode-types';
|
||||
import { ComponentMetadata, FieldConfig, InitialItem, FilterItem, AutorunItem } from '@ali/lowcode-types';
|
||||
import {
|
||||
ComponentMeta,
|
||||
addBuiltinComponentAction,
|
||||
@ -7,6 +7,8 @@ import {
|
||||
registerMetadataTransducer,
|
||||
TransformStage,
|
||||
} from '@ali/lowcode-designer';
|
||||
import { intl } from '@ali/lowcode-editor-core';
|
||||
import { isInSimulator } from '@ali/lowcode-utils';
|
||||
import {
|
||||
OldPropConfig,
|
||||
OldPrototypeConfig,
|
||||
@ -15,7 +17,7 @@ import {
|
||||
upgradePropConfig,
|
||||
upgradeConfigure,
|
||||
} from './upgrade-metadata';
|
||||
import { intl } from '@ali/lowcode-editor-core';
|
||||
|
||||
import { designer } from '../editor';
|
||||
|
||||
const GlobalPropsConfigure: Array<{
|
||||
@ -213,6 +215,10 @@ class Prototype {
|
||||
static removeGlobalPropsConfigure = removeGlobalPropsConfigure;
|
||||
static overridePropsConfigure = overridePropsConfigure;
|
||||
static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, extraConfigs: any = null, lookup: boolean = false) {
|
||||
// 目前 vc-xxx 会在设计器和渲染 simulator iframe 中执行两遍,在 simulator 中不需要重新创建,直接复用外层的
|
||||
if (isInSimulator()) {
|
||||
lookup = true;
|
||||
}
|
||||
return new Prototype(config, extraConfigs, lookup);
|
||||
}
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ designer.addPropsReducer((props, node) => {
|
||||
}
|
||||
});
|
||||
// 全局的关闭 uniqueIdChecker 信号,在 ve-utils 中实现
|
||||
if (fieldIds.indexOf(props.fieldId) >= 0 && !window.__disable_unique_id_checker__) {
|
||||
if (fieldIds.indexOf(props.fieldId) >= 0 && !(window as any).__disable_unique_id_checker__) {
|
||||
newProps.fieldId = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
3
packages/utils/src/env.ts
Normal file
3
packages/utils/src/env.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export function isInSimulator() {
|
||||
return Boolean((window as any).__is_simulator_env__);
|
||||
}
|
||||
@ -18,3 +18,4 @@ export * from './set-prototype-of';
|
||||
export * from './shallow-equal';
|
||||
export * from './svg-icon';
|
||||
export * from './unique-id';
|
||||
export * from './env';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user