mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-19 04:04:15 +00:00
fix: remove @deprecated apis
This commit is contained in:
parent
1ec54e0a5f
commit
0831277dc0
@ -94,12 +94,6 @@ setResourceList(resourceList: IPublicResourceList) {}
|
|||||||
打开视图窗口
|
打开视图窗口
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
/**
|
|
||||||
* 打开视图窗口
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
openEditorWindow(resourceName: string, id: string, extra: Object, viewName?: string, sleep?: boolean): Promise<void>;
|
|
||||||
|
|
||||||
/** 打开视图窗口 */
|
/** 打开视图窗口 */
|
||||||
openEditorWindow(resource: Resource, sleep?: boolean): Promise<void>;
|
openEditorWindow(resource: Resource, sleep?: boolean): Promise<void>;
|
||||||
```
|
```
|
||||||
@ -117,12 +111,6 @@ openEditorWindowById(id: string): void;
|
|||||||
移除视图窗口
|
移除视图窗口
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
/**
|
|
||||||
* 移除视图窗口
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
removeEditorWindow(resourceName: string, id: string): void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除视图窗口
|
* 移除视图窗口
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1151,12 +1151,6 @@ export interface Snippet {
|
|||||||
* snippet 截图
|
* snippet 截图
|
||||||
*/
|
*/
|
||||||
screenshot?: string;
|
screenshot?: string;
|
||||||
/**
|
|
||||||
* snippet 打标
|
|
||||||
*
|
|
||||||
* @deprecated 暂未使用
|
|
||||||
*/
|
|
||||||
label?: string;
|
|
||||||
/**
|
/**
|
||||||
* 待插入的 schema
|
* 待插入的 schema
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -56,7 +56,6 @@ export default {
|
|||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
common: {
|
common: {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理 ES Module
|
* 处理 ES Module
|
||||||
* @deprecated please use esModule
|
* @deprecated please use esModule
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
obx,
|
observable,
|
||||||
autorun,
|
autorun,
|
||||||
reaction,
|
reaction,
|
||||||
computed,
|
computed,
|
||||||
@ -12,6 +12,7 @@ import {
|
|||||||
makeObservable,
|
makeObservable,
|
||||||
createModuleEventBus,
|
createModuleEventBus,
|
||||||
IEventBus,
|
IEventBus,
|
||||||
|
action,
|
||||||
} from '@alilc/lowcode-editor-core';
|
} from '@alilc/lowcode-editor-core';
|
||||||
|
|
||||||
import { ISimulatorHost, Component, DropContainer } from '../simulator';
|
import { ISimulatorHost, Component, DropContainer } from '../simulator';
|
||||||
@ -228,17 +229,17 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
return this.get('deviceStyle');
|
return this.get('deviceStyle');
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref _props: BuiltinSimulatorProps = {};
|
@observable.ref _props: BuiltinSimulatorProps = {};
|
||||||
|
|
||||||
@obx.ref private _contentWindow?: Window;
|
@observable.ref private _contentWindow?: Window;
|
||||||
|
|
||||||
get contentWindow() {
|
get contentWindow() {
|
||||||
return this._contentWindow;
|
return this._contentWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _contentDocument?: Document;
|
@observable.ref private _contentDocument?: Document;
|
||||||
|
|
||||||
@obx.ref private _appHelper?: any;
|
@observable.ref private _appHelper?: any;
|
||||||
|
|
||||||
get contentDocument() {
|
get contentDocument() {
|
||||||
return this._contentDocument;
|
return this._contentDocument;
|
||||||
@ -262,7 +263,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
|
|
||||||
readonly liveEditing = new LiveEditing();
|
readonly liveEditing = new LiveEditing();
|
||||||
|
|
||||||
@obx private instancesMap: {
|
@observable private instancesMap: {
|
||||||
[docId: string]: Map<string, IPublicTypeComponentInstance[]>;
|
[docId: string]: Map<string, IPublicTypeComponentInstance[]>;
|
||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
@ -322,10 +323,12 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
/**
|
/**
|
||||||
* @see ISimulator
|
* @see ISimulator
|
||||||
*/
|
*/
|
||||||
|
@action
|
||||||
setProps(props: BuiltinSimulatorProps) {
|
setProps(props: BuiltinSimulatorProps) {
|
||||||
this._props = props;
|
this._props = props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
set(key: string, value: any) {
|
set(key: string, value: any) {
|
||||||
this._props = {
|
this._props = {
|
||||||
...this._props,
|
...this._props,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { obx } from '@alilc/lowcode-editor-core';
|
import { observable } from '@alilc/lowcode-editor-core';
|
||||||
import { IPublicTypePluginConfig, IPublicTypeLiveTextEditingConfig } from '@alilc/lowcode-types';
|
import { IPublicTypePluginConfig, IPublicTypeLiveTextEditingConfig } from '@alilc/lowcode-types';
|
||||||
import { INode, Prop } from '../../document';
|
import { INode, Prop } from '../../document';
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ export class LiveEditing {
|
|||||||
static addLiveEditingSaveHandler = addLiveEditingSaveHandler;
|
static addLiveEditingSaveHandler = addLiveEditingSaveHandler;
|
||||||
static clearLiveEditingSaveHandler = clearLiveEditingSaveHandler;
|
static clearLiveEditingSaveHandler = clearLiveEditingSaveHandler;
|
||||||
|
|
||||||
@obx.ref private _editing: Prop | null = null;
|
@observable.ref private _editing: Prop | null = null;
|
||||||
|
|
||||||
private _dispose?: () => void;
|
private _dispose?: () => void;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { autorun, makeObservable, obx, createModuleEventBus, IEventBus } from '@alilc/lowcode-editor-core';
|
import { autorun, makeObservable, observable, createModuleEventBus, IEventBus } from '@alilc/lowcode-editor-core';
|
||||||
import { BuiltinSimulatorHost } from './host';
|
import { BuiltinSimulatorHost } from './host';
|
||||||
import { BuiltinSimulatorRenderer, isSimulatorRenderer } from './renderer';
|
import { BuiltinSimulatorRenderer, isSimulatorRenderer } from './renderer';
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ export type RendererConsumer<T> = (renderer: BuiltinSimulatorRenderer, data: T)
|
|||||||
export default class ResourceConsumer<T = any> {
|
export default class ResourceConsumer<T = any> {
|
||||||
private emitter: IEventBus = createModuleEventBus('ResourceConsumer');
|
private emitter: IEventBus = createModuleEventBus('ResourceConsumer');
|
||||||
|
|
||||||
@obx.ref private _data: T | typeof UNSET = UNSET;
|
@observable.ref private _data: T | typeof UNSET = UNSET;
|
||||||
|
|
||||||
private _providing?: () => void;
|
private _providing?: () => void;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core';
|
import { observable, computed, makeObservable, action } from '@alilc/lowcode-editor-core';
|
||||||
import { Point, ScrollTarget } from '../designer';
|
import { Point, ScrollTarget } from '../designer';
|
||||||
import { AutoFit, IViewport } from '../simulator';
|
import { AutoFit, IViewport } from '../simulator';
|
||||||
|
|
||||||
export default class Viewport implements IViewport {
|
export default class Viewport implements IViewport {
|
||||||
@obx.ref private rect?: DOMRect;
|
@observable.ref private rect?: DOMRect;
|
||||||
|
|
||||||
private _bounds?: DOMRect;
|
private _bounds?: DOMRect;
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ export default class Viewport implements IViewport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _scale = 1;
|
@observable.ref private _scale = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缩放比例
|
* 缩放比例
|
||||||
@ -92,9 +92,9 @@ export default class Viewport implements IViewport {
|
|||||||
this._contentHeight = this.height / this.scale;
|
this._contentHeight = this.height / this.scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _contentWidth: number | AutoFit = AutoFit;
|
@observable.ref private _contentWidth: number | AutoFit = AutoFit;
|
||||||
|
|
||||||
@obx.ref private _contentHeight: number | AutoFit = AutoFit;
|
@observable.ref private _contentHeight: number | AutoFit = AutoFit;
|
||||||
|
|
||||||
@computed get contentHeight(): number | AutoFit {
|
@computed get contentHeight(): number | AutoFit {
|
||||||
return this._contentHeight;
|
return this._contentHeight;
|
||||||
@ -112,9 +112,9 @@ export default class Viewport implements IViewport {
|
|||||||
this._contentWidth = val;
|
this._contentWidth = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _scrollX = 0;
|
@observable.ref private _scrollX = 0;
|
||||||
|
|
||||||
@obx.ref private _scrollY = 0;
|
@observable.ref private _scrollY = 0;
|
||||||
|
|
||||||
get scrollX() {
|
get scrollX() {
|
||||||
return this._scrollX;
|
return this._scrollX;
|
||||||
@ -133,12 +133,13 @@ export default class Viewport implements IViewport {
|
|||||||
return this._scrollTarget;
|
return this._scrollTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx private _scrolling = false;
|
@observable private _scrolling = false;
|
||||||
|
|
||||||
get scrolling(): boolean {
|
get scrolling(): boolean {
|
||||||
return this._scrolling;
|
return this._scrolling;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
setScrollTarget(target: Window) {
|
setScrollTarget(target: Window) {
|
||||||
const scrollTarget = new ScrollTarget(target);
|
const scrollTarget = new ScrollTarget(target);
|
||||||
this._scrollX = scrollTarget.left;
|
this._scrollX = scrollTarget.left;
|
||||||
|
|||||||
@ -174,12 +174,6 @@ export class ComponentMeta implements IComponentMeta {
|
|||||||
return this.getMetadata().configure.advanced || {};
|
return this.getMetadata().configure.advanced || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @legacy compatiable for vision
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
prototype?: any;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly designer: Designer,
|
readonly designer: Designer,
|
||||||
metadata: IPublicTypeComponentMetadata,
|
metadata: IPublicTypeComponentMetadata,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { INode } from '../document/node/node';
|
import { INode } from '../document/node/node';
|
||||||
import { obx, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
|
import { observable, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
|
||||||
import { IPublicTypeActiveTarget, IPublicModelActiveTracker } from '@alilc/lowcode-types';
|
import { IPublicTypeActiveTarget, IPublicModelActiveTracker } from '@alilc/lowcode-types';
|
||||||
import { isNode } from '@alilc/lowcode-utils';
|
import { isNode } from '@alilc/lowcode-utils';
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ export interface ActiveTarget extends Omit<IPublicTypeActiveTarget, 'node'> {
|
|||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export class ActiveTracker implements IActiveTracker {
|
export class ActiveTracker implements IActiveTracker {
|
||||||
@obx.ref private _target?: ActiveTarget | INode;
|
@observable.ref private _target?: ActiveTarget | INode;
|
||||||
|
|
||||||
private emitter: IEventBus = createModuleEventBus('ActiveTracker');
|
private emitter: IEventBus = createModuleEventBus('ActiveTracker');
|
||||||
|
|
||||||
@ -38,14 +38,6 @@ export class ActiveTracker implements IActiveTracker {
|
|||||||
return (this._target as ActiveTarget)?.detail;
|
return (this._target as ActiveTarget)?.detail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
/* istanbul ignore next */
|
|
||||||
get intance() {
|
|
||||||
return this.instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
get instance() {
|
get instance() {
|
||||||
return (this._target as ActiveTarget)?.instance;
|
return (this._target as ActiveTarget)?.instance;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ComponentType } from 'react';
|
import { ComponentType } from 'react';
|
||||||
import { obx, computed, autorun, makeObservable, IReactionPublic, IReactionOptions, IReactionDisposer } from '@alilc/lowcode-editor-core';
|
import { observable, computed, autorun, makeObservable, IReactionPublic, IReactionOptions, IReactionDisposer } from '@alilc/lowcode-editor-core';
|
||||||
import {
|
import {
|
||||||
IPublicTypeProjectSchema,
|
IPublicTypeProjectSchema,
|
||||||
IPublicTypeComponentMetadata,
|
IPublicTypeComponentMetadata,
|
||||||
@ -93,13 +93,13 @@ export class Designer {
|
|||||||
|
|
||||||
private selectionDispose: undefined | (() => void);
|
private selectionDispose: undefined | (() => void);
|
||||||
|
|
||||||
@obx.ref private _componentMetasMap = new Map<string, IComponentMeta>();
|
@observable.ref private _componentMetasMap = new Map<string, IComponentMeta>();
|
||||||
|
|
||||||
@obx.ref private _simulatorComponent?: ComponentType<any>;
|
@observable.ref private _simulatorComponent?: ComponentType<any>;
|
||||||
|
|
||||||
@obx.ref private _simulatorProps?: Record<string, any> | ((project: IProject) => object);
|
@observable.ref private _simulatorProps?: Record<string, any> | ((project: IProject) => object);
|
||||||
|
|
||||||
@obx.ref private _suspensed = false;
|
@observable.ref private _suspensed = false;
|
||||||
|
|
||||||
get currentDocument() {
|
get currentDocument() {
|
||||||
return this.project.currentDocument;
|
return this.project.currentDocument;
|
||||||
@ -309,48 +309,6 @@ export class Designer {
|
|||||||
return new SettingTopEntry(this.editor, nodes);
|
return new SettingTopEntry(this.editor, nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得合适的插入位置
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
getSuitableInsertion(
|
|
||||||
insertNode?: INode | IPublicTypeNodeSchema | IPublicTypeNodeSchema[],
|
|
||||||
): { target: INode; index?: number } | null {
|
|
||||||
const activeDoc = this.project.currentDocument;
|
|
||||||
if (!activeDoc) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
Array.isArray(insertNode) &&
|
|
||||||
isNodeSchema(insertNode[0]) &&
|
|
||||||
this.getComponentMeta(insertNode[0].componentName).isModal
|
|
||||||
) {
|
|
||||||
return {
|
|
||||||
target: activeDoc.rootNode as INode,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const focusNode = activeDoc.focusNode!;
|
|
||||||
const nodes = activeDoc.selection.getNodes();
|
|
||||||
const refNode = nodes.find((item) => focusNode.contains(item));
|
|
||||||
let target;
|
|
||||||
let index: number | undefined;
|
|
||||||
if (!refNode || refNode === focusNode) {
|
|
||||||
target = focusNode;
|
|
||||||
} else if (refNode.componentMeta.isContainer) {
|
|
||||||
target = refNode;
|
|
||||||
} else {
|
|
||||||
// FIXME!!, parent maybe null
|
|
||||||
target = refNode.parent!;
|
|
||||||
index = (refNode.index || 0) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target && insertNode && !target.componentMeta.checkNestingDown(target, insertNode)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return { target, index };
|
|
||||||
}
|
|
||||||
|
|
||||||
setProps(nextProps: DesignerProps) {
|
setProps(nextProps: DesignerProps) {
|
||||||
const props = this.props ? { ...this.props, ...nextProps } : nextProps;
|
const props = this.props ? { ...this.props, ...nextProps } : nextProps;
|
||||||
if (this.props) {
|
if (this.props) {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { makeObservable, obx, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
|
import { makeObservable, observable, IEventBus, createModuleEventBus, action } from '@alilc/lowcode-editor-core';
|
||||||
import { IPublicModelDetecting } from '@alilc/lowcode-types';
|
import { IPublicModelDetecting } from '@alilc/lowcode-types';
|
||||||
import type { IDocumentModel } from '../document/document-model';
|
import type { IDocumentModel } from '../document/document-model';
|
||||||
import type { INode } from '../document/node/node';
|
import type { INode } from '../document/node/node';
|
||||||
@ -19,7 +19,7 @@ export interface IDetecting extends Omit<IPublicModelDetecting<INode>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Detecting implements IDetecting {
|
export class Detecting implements IDetecting {
|
||||||
@obx.ref private _enable = true;
|
@observable.ref private _enable = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 控制大纲树 hover 时是否出现悬停效果
|
* 控制大纲树 hover 时是否出现悬停效果
|
||||||
@ -36,9 +36,9 @@ export class Detecting implements IDetecting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref xRayMode = false;
|
@observable.ref xRayMode = false;
|
||||||
|
|
||||||
@obx.ref private _current: INode | null = null;
|
@observable.ref private _current: INode | null = null;
|
||||||
|
|
||||||
private emitter: IEventBus = createModuleEventBus('Detecting');
|
private emitter: IEventBus = createModuleEventBus('Detecting');
|
||||||
|
|
||||||
@ -50,6 +50,7 @@ export class Detecting implements IDetecting {
|
|||||||
return this._current;
|
return this._current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
capture(node: INode | null) {
|
capture(node: INode | null) {
|
||||||
if (this._current !== node) {
|
if (this._current !== node) {
|
||||||
this._current = node;
|
this._current = node;
|
||||||
@ -57,6 +58,7 @@ export class Detecting implements IDetecting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
release(node: INode | null) {
|
release(node: INode | null) {
|
||||||
if (this._current === node) {
|
if (this._current === node) {
|
||||||
this._current = null;
|
this._current = null;
|
||||||
@ -64,6 +66,7 @@ export class Detecting implements IDetecting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
leave(document: IDocumentModel | undefined) {
|
leave(document: IDocumentModel | undefined) {
|
||||||
if (this.current && this.current.document === document) {
|
if (this.current && this.current.document === document) {
|
||||||
this._current = null;
|
this._current = null;
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { Component, ReactElement } from 'react';
|
import { Component, ReactElement } from 'react';
|
||||||
import { observer, obx, Title, makeObservable } from '@alilc/lowcode-editor-core';
|
import { observer, observable, Title, makeObservable } from '@alilc/lowcode-editor-core';
|
||||||
import { Designer } from '../designer';
|
import { Designer } from '../designer';
|
||||||
import { isDragNodeObject } from '../dragon';
|
|
||||||
import { isSimulatorHost } from '../../simulator';
|
import { isSimulatorHost } from '../../simulator';
|
||||||
import './ghost.less';
|
import './ghost.less';
|
||||||
import {
|
import {
|
||||||
@ -9,6 +8,7 @@ import {
|
|||||||
IPublicTypeNodeSchema,
|
IPublicTypeNodeSchema,
|
||||||
IPublicModelDragObject,
|
IPublicModelDragObject,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
|
import { isDragNodeObject } from '@alilc/lowcode-utils';
|
||||||
|
|
||||||
type offBinding = () => any;
|
type offBinding = () => any;
|
||||||
|
|
||||||
@ -16,13 +16,13 @@ type offBinding = () => any;
|
|||||||
export default class DragGhost extends Component<{ designer: Designer }> {
|
export default class DragGhost extends Component<{ designer: Designer }> {
|
||||||
private dispose: offBinding[] = [];
|
private dispose: offBinding[] = [];
|
||||||
|
|
||||||
@obx.ref private titles: (string | IPublicTypeI18nData | ReactElement)[] | null = null;
|
@observable.ref private titles: (string | IPublicTypeI18nData | ReactElement)[] | null = null;
|
||||||
|
|
||||||
@obx.ref private x = 0;
|
@observable.ref private x = 0;
|
||||||
|
|
||||||
@obx.ref private y = 0;
|
@observable.ref private y = 0;
|
||||||
|
|
||||||
@obx private isAbsoluteLayoutContainer = false;
|
@observable private isAbsoluteLayoutContainer = false;
|
||||||
|
|
||||||
private dragon = this.props.designer.dragon;
|
private dragon = this.props.designer.dragon;
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,12 @@
|
|||||||
import { obx, makeObservable, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
|
import { observable, makeObservable, IEventBus, createModuleEventBus, action, autorun } from '@alilc/lowcode-editor-core';
|
||||||
import {
|
import {
|
||||||
IPublicTypeDragNodeObject,
|
|
||||||
IPublicTypeDragAnyObject,
|
|
||||||
IPublicEnumDragObjectType,
|
|
||||||
IPublicTypeDragNodeDataObject,
|
|
||||||
IPublicModelDragObject,
|
IPublicModelDragObject,
|
||||||
IPublicModelNode,
|
IPublicModelNode,
|
||||||
IPublicModelDragon,
|
IPublicModelDragon,
|
||||||
IPublicModelLocateEvent,
|
IPublicModelLocateEvent,
|
||||||
IPublicModelSensor,
|
IPublicModelSensor,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import { setNativeSelection, cursor } from '@alilc/lowcode-utils';
|
import { setNativeSelection, cursor, isDragNodeObject } from '@alilc/lowcode-utils';
|
||||||
import { INode, Node } from '../document';
|
import { INode, Node } from '../document';
|
||||||
import { ISimulatorHost, isSimulatorHost } from '../simulator';
|
import { ISimulatorHost, isSimulatorHost } from '../simulator';
|
||||||
import { IDesigner } from './designer';
|
import { IDesigner } from './designer';
|
||||||
@ -25,31 +21,6 @@ export interface ILocateEvent extends IPublicModelLocateEvent {
|
|||||||
sensor?: IPublicModelSensor;
|
sensor?: IPublicModelSensor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use same function in @alilc/lowcode-utils
|
|
||||||
*/
|
|
||||||
export function isDragNodeObject(obj: any): obj is IPublicTypeDragNodeObject {
|
|
||||||
return obj && obj.type === IPublicEnumDragObjectType.Node;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use same function in @alilc/lowcode-utils
|
|
||||||
*/
|
|
||||||
export function isDragNodeDataObject(obj: any): obj is IPublicTypeDragNodeDataObject {
|
|
||||||
return obj && obj.type === IPublicEnumDragObjectType.NodeData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use same function in @alilc/lowcode-utils
|
|
||||||
*/
|
|
||||||
export function isDragAnyObject(obj: any): obj is IPublicTypeDragAnyObject {
|
|
||||||
return (
|
|
||||||
obj &&
|
|
||||||
obj.type !== IPublicEnumDragObjectType.NodeData &&
|
|
||||||
obj.type !== IPublicEnumDragObjectType.Node
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isLocateEvent(e: any): e is ILocateEvent {
|
export function isLocateEvent(e: any): e is ILocateEvent {
|
||||||
return e && e.type === 'LocateEvent';
|
return e && e.type === 'LocateEvent';
|
||||||
}
|
}
|
||||||
@ -112,15 +83,15 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
|||||||
/**
|
/**
|
||||||
* current active sensor, 可用于感应区高亮
|
* current active sensor, 可用于感应区高亮
|
||||||
*/
|
*/
|
||||||
@obx.ref private _activeSensor: IPublicModelSensor | undefined;
|
@observable.ref private _activeSensor: IPublicModelSensor | undefined;
|
||||||
|
|
||||||
get activeSensor(): IPublicModelSensor | undefined {
|
get activeSensor(): IPublicModelSensor | undefined {
|
||||||
return this._activeSensor;
|
return this._activeSensor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _dragging = false;
|
@observable.ref private _dragging = false;
|
||||||
|
|
||||||
@obx.ref private _canDrop = false;
|
@observable.ref private _canDrop = false;
|
||||||
|
|
||||||
get dragging(): boolean {
|
get dragging(): boolean {
|
||||||
return this._dragging;
|
return this._dragging;
|
||||||
@ -140,7 +111,6 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
|||||||
* @param shell container element
|
* @param shell container element
|
||||||
* @param boost boost got a drag object
|
* @param boost boost got a drag object
|
||||||
*/
|
*/
|
||||||
// @ts-ignore
|
|
||||||
from(shell: Element, boost: (e: MouseEvent) => IPublicModelDragObject | null) {
|
from(shell: Element, boost: (e: MouseEvent) => IPublicModelDragObject | null) {
|
||||||
const mousedown = (e: MouseEvent) => {
|
const mousedown = (e: MouseEvent) => {
|
||||||
// ESC or RightClick
|
// ESC or RightClick
|
||||||
@ -168,6 +138,7 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
|||||||
* @param dragObject 拖拽对象
|
* @param dragObject 拖拽对象
|
||||||
* @param boostEvent 拖拽初始时事件
|
* @param boostEvent 拖拽初始时事件
|
||||||
*/
|
*/
|
||||||
|
@action
|
||||||
boost(
|
boost(
|
||||||
dragObject: IPublicModelDragObject,
|
dragObject: IPublicModelDragObject,
|
||||||
boostEvent: MouseEvent | DragEvent,
|
boostEvent: MouseEvent | DragEvent,
|
||||||
@ -196,7 +167,7 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const checkesc = (e: KeyboardEvent) => {
|
const checkesc = (e: KeyboardEvent) => {
|
||||||
if (e.keyCode === 27) {
|
if (e.code === 'Escape') {
|
||||||
designer.clearLocation();
|
designer.clearLocation();
|
||||||
over();
|
over();
|
||||||
}
|
}
|
||||||
@ -204,7 +175,6 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
|||||||
|
|
||||||
let copy = false;
|
let copy = false;
|
||||||
const checkcopy = (e: MouseEvent | DragEvent | KeyboardEvent) => {
|
const checkcopy = (e: MouseEvent | DragEvent | KeyboardEvent) => {
|
||||||
/* istanbul ignore next */
|
|
||||||
if (isDragEvent(e) && e.dataTransfer) {
|
if (isDragEvent(e) && e.dataTransfer) {
|
||||||
if (newBie || forceCopyState) {
|
if (newBie || forceCopyState) {
|
||||||
e.dataTransfer.dropEffect = 'copy';
|
e.dataTransfer.dropEffect = 'copy';
|
||||||
@ -251,7 +221,6 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
|||||||
const locateEvent = createLocateEvent(e);
|
const locateEvent = createLocateEvent(e);
|
||||||
const sensor = chooseSensor(locateEvent);
|
const sensor = chooseSensor(locateEvent);
|
||||||
|
|
||||||
/* istanbul ignore next */
|
|
||||||
if (isRGL) {
|
if (isRGL) {
|
||||||
// 禁止被拖拽元素的阻断
|
// 禁止被拖拽元素的阻断
|
||||||
const nodeInst = dragObject?.nodes?.[0]?.getDOMNode();
|
const nodeInst = dragObject?.nodes?.[0]?.getDOMNode();
|
||||||
@ -294,7 +263,7 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
|||||||
this.emitter.emit('drag', locateEvent);
|
this.emitter.emit('drag', locateEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
const dragstart = () => {
|
const dragstart = autorun(() => {
|
||||||
this._dragging = true;
|
this._dragging = true;
|
||||||
setShaken(boostEvent);
|
setShaken(boostEvent);
|
||||||
const locateEvent = createLocateEvent(boostEvent);
|
const locateEvent = createLocateEvent(boostEvent);
|
||||||
@ -312,7 +281,7 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.emitter.emit('dragstart', locateEvent);
|
this.emitter.emit('dragstart', locateEvent);
|
||||||
};
|
});
|
||||||
|
|
||||||
// route: drag-move
|
// route: drag-move
|
||||||
const move = (e: MouseEvent | DragEvent) => {
|
const move = (e: MouseEvent | DragEvent) => {
|
||||||
@ -335,7 +304,6 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let didDrop = true;
|
let didDrop = true;
|
||||||
/* istanbul ignore next */
|
|
||||||
const drop = (e: DragEvent) => {
|
const drop = (e: DragEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@ -374,14 +342,12 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
|||||||
// 移除磁帖占位消息
|
// 移除磁帖占位消息
|
||||||
this.emitter.emit('rgl.remove.placeholder');
|
this.emitter.emit('rgl.remove.placeholder');
|
||||||
|
|
||||||
/* istanbul ignore next */
|
|
||||||
if (e && isDragEvent(e)) {
|
if (e && isDragEvent(e)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
if (lastSensor) {
|
if (lastSensor) {
|
||||||
lastSensor.deactiveSensor();
|
lastSensor.deactiveSensor();
|
||||||
}
|
}
|
||||||
/* istanbul ignore next */
|
|
||||||
if (isBoostFromDragAPI) {
|
if (isBoostFromDragAPI) {
|
||||||
if (!didDrop) {
|
if (!didDrop) {
|
||||||
designer.clearLocation();
|
designer.clearLocation();
|
||||||
|
|||||||
@ -23,20 +23,6 @@ export type Rects = DOMRect[] & {
|
|||||||
elements: Array<Element | Text>;
|
elements: Array<Element | Text>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use same function in @alilc/lowcode-utils
|
|
||||||
*/
|
|
||||||
export function isLocationData(obj: any): boolean {
|
|
||||||
return obj && obj.target && obj.detail;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use same function in @alilc/lowcode-utils
|
|
||||||
*/
|
|
||||||
export function isLocationChildrenDetail(obj: any): boolean {
|
|
||||||
return obj && obj.type === IPublicTypeLocationDetailType.Children;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isRowContainer(container: Element | Text, win?: Window) {
|
export function isRowContainer(container: Element | Text, win?: Window) {
|
||||||
if (isText(container)) {
|
if (isText(container)) {
|
||||||
return true;
|
return true;
|
||||||
@ -139,29 +125,4 @@ export class DropLocation implements IDropLocation {
|
|||||||
event,
|
event,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 兼容 vision
|
|
||||||
*/
|
|
||||||
getContainer() {
|
|
||||||
return this.target;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 兼容 vision
|
|
||||||
*/
|
|
||||||
getInsertion() {
|
|
||||||
if (!this.detail) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (this.detail.type === 'Children') {
|
|
||||||
if (this.detail.index <= 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return this.target.children?.get(this.detail.index - 1);
|
|
||||||
}
|
|
||||||
return (this.detail as any)?.near?.node;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import requestIdleCallback, { cancelIdleCallback } from 'ric-shim';
|
import requestIdleCallback, { cancelIdleCallback } from 'ric-shim';
|
||||||
import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core';
|
import { observable, computed, action, makeObservable } from '@alilc/lowcode-editor-core';
|
||||||
import { uniqueId } from '@alilc/lowcode-utils';
|
import { uniqueId } from '@alilc/lowcode-utils';
|
||||||
import { INodeSelector, IViewport } from '../simulator';
|
import { INodeSelector, IViewport } from '../simulator';
|
||||||
import { INode } from '../document';
|
import { INode } from '../document';
|
||||||
@ -15,17 +15,17 @@ export class OffsetObserver {
|
|||||||
|
|
||||||
private lastOffsetWidth?: number;
|
private lastOffsetWidth?: number;
|
||||||
|
|
||||||
@obx private _height = 0;
|
@observable private _height = 0;
|
||||||
|
|
||||||
@obx private _width = 0;
|
@observable private _width = 0;
|
||||||
|
|
||||||
@obx private _left = 0;
|
@observable private _left = 0;
|
||||||
|
|
||||||
@obx private _top = 0;
|
@observable private _top = 0;
|
||||||
|
|
||||||
@obx private _right = 0;
|
@observable private _right = 0;
|
||||||
|
|
||||||
@obx private _bottom = 0;
|
@observable private _bottom = 0;
|
||||||
|
|
||||||
@computed get height() {
|
@computed get height() {
|
||||||
return this.isRoot ? this.viewport?.height : this._height * this.scale;
|
return this.isRoot ? this.viewport?.height : this._height * this.scale;
|
||||||
@ -51,7 +51,7 @@ export class OffsetObserver {
|
|||||||
return this.isRoot ? this.viewport?.width : this._right * this.scale;
|
return this.isRoot ? this.viewport?.width : this._right * this.scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx hasOffset = false;
|
@observable hasOffset = false;
|
||||||
|
|
||||||
@computed get offsetLeft() {
|
@computed get offsetLeft() {
|
||||||
if (this.isRoot) {
|
if (this.isRoot) {
|
||||||
@ -102,14 +102,17 @@ export class OffsetObserver {
|
|||||||
readonly compute: () => void;
|
readonly compute: () => void;
|
||||||
|
|
||||||
constructor(readonly nodeInstance: INodeSelector) {
|
constructor(readonly nodeInstance: INodeSelector) {
|
||||||
|
makeObservable(this);
|
||||||
|
|
||||||
const { node, instance } = nodeInstance;
|
const { node, instance } = nodeInstance;
|
||||||
this.node = node;
|
this.node = node;
|
||||||
|
|
||||||
const doc = node.document;
|
const doc = node.document;
|
||||||
const host = doc?.simulator;
|
const host = doc?.simulator;
|
||||||
const focusNode = doc?.focusNode;
|
const focusNode = doc?.focusNode;
|
||||||
this.isRoot = node.contains(focusNode!);
|
this.isRoot = node.contains(focusNode!);
|
||||||
this.viewport = host?.viewport;
|
this.viewport = host?.viewport;
|
||||||
makeObservable(this);
|
|
||||||
if (this.isRoot) {
|
if (this.isRoot) {
|
||||||
this.hasOffset = true;
|
this.hasOffset = true;
|
||||||
return;
|
return;
|
||||||
@ -119,7 +122,7 @@ export class OffsetObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let pid: number | undefined;
|
let pid: number | undefined;
|
||||||
const compute = () => {
|
const compute = action(() => {
|
||||||
if (pid !== this.pid) {
|
if (pid !== this.pid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -139,7 +142,7 @@ export class OffsetObserver {
|
|||||||
}
|
}
|
||||||
this.pid = requestIdleCallback(compute);
|
this.pid = requestIdleCallback(compute);
|
||||||
pid = this.pid;
|
pid = this.pid;
|
||||||
};
|
});
|
||||||
|
|
||||||
this.compute = compute;
|
this.compute = compute;
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import {
|
|||||||
import type { IPublicTypeSetValueOptions } from '@alilc/lowcode-types';
|
import type { IPublicTypeSetValueOptions } from '@alilc/lowcode-types';
|
||||||
import { Transducer } from './utils';
|
import { Transducer } from './utils';
|
||||||
import { ISettingPropEntry, SettingPropEntry } from './setting-prop-entry';
|
import { ISettingPropEntry, SettingPropEntry } from './setting-prop-entry';
|
||||||
import { computed, obx, makeObservable, action, untracked, intl } from '@alilc/lowcode-editor-core';
|
import { computed, observable, makeObservable, action, untracked, intl } from '@alilc/lowcode-editor-core';
|
||||||
import { cloneDeep, isCustomView, isDynamicSetter, isJSExpression } from '@alilc/lowcode-utils';
|
import { cloneDeep, isCustomView, isDynamicSetter, isJSExpression } from '@alilc/lowcode-utils';
|
||||||
import { ISettingTopEntry } from './setting-top-entry';
|
import { ISettingTopEntry } from './setting-top-entry';
|
||||||
import { IComponentMeta } from '../../component-meta';
|
import { IComponentMeta } from '../../component-meta';
|
||||||
@ -34,7 +34,6 @@ function getSettingFieldCollectorKey(
|
|||||||
return path.join('.');
|
return path.join('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
export interface ISettingField
|
export interface ISettingField
|
||||||
extends ISettingPropEntry,
|
extends ISettingPropEntry,
|
||||||
Omit<
|
Omit<
|
||||||
@ -107,7 +106,7 @@ export class SettingField extends SettingPropEntry implements ISettingField {
|
|||||||
|
|
||||||
private _setter?: IPublicTypeSetterType | IPublicTypeDynamicSetter;
|
private _setter?: IPublicTypeSetterType | IPublicTypeDynamicSetter;
|
||||||
|
|
||||||
@obx.ref private _expanded = true;
|
@observable.ref private _expanded = true;
|
||||||
|
|
||||||
private _items: Array<ISettingField | IPublicTypeCustomView> = [];
|
private _items: Array<ISettingField | IPublicTypeCustomView> = [];
|
||||||
|
|
||||||
@ -317,10 +316,3 @@ export class SettingField extends SettingPropEntry implements ISettingField {
|
|||||||
return this.designer!.shellModelFactory.createSettingField(this);
|
return this.designer!.shellModelFactory.createSettingField(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use same function from '@alilc/lowcode-utils' instead
|
|
||||||
*/
|
|
||||||
export function isSettingField(obj: any): obj is ISettingField {
|
|
||||||
return obj && obj.isSettingField;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
obx,
|
observable,
|
||||||
computed,
|
computed,
|
||||||
makeObservable,
|
makeObservable,
|
||||||
runInAction,
|
runInAction,
|
||||||
@ -14,13 +14,13 @@ import {
|
|||||||
IPublicTypeFieldExtraProps,
|
IPublicTypeFieldExtraProps,
|
||||||
IPublicTypeSetValueOptions,
|
IPublicTypeSetValueOptions,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import { uniqueId, isJSExpression } from '@alilc/lowcode-utils';
|
import { uniqueId, isJSExpression, isSettingField } from '@alilc/lowcode-utils';
|
||||||
import { ISettingEntry } from './setting-entry-type';
|
import { ISettingEntry } from './setting-entry-type';
|
||||||
import { INode } from '../../document';
|
import { INode } from '../../document';
|
||||||
import type { IComponentMeta } from '../../component-meta';
|
import type { IComponentMeta } from '../../component-meta';
|
||||||
import { IDesigner } from '../designer';
|
import { IDesigner } from '../designer';
|
||||||
import { ISettingTopEntry } from './setting-top-entry';
|
import { ISettingTopEntry } from './setting-top-entry';
|
||||||
import { ISettingField, isSettingField } from './setting-field';
|
import { ISettingField } from './setting-field';
|
||||||
|
|
||||||
export interface ISettingPropEntry extends ISettingEntry {
|
export interface ISettingPropEntry extends ISettingEntry {
|
||||||
readonly isGroup: boolean;
|
readonly isGroup: boolean;
|
||||||
@ -86,7 +86,7 @@ export class SettingPropEntry implements ISettingPropEntry {
|
|||||||
readonly emitter: IEventBus = createModuleEventBus('SettingPropEntry');
|
readonly emitter: IEventBus = createModuleEventBus('SettingPropEntry');
|
||||||
|
|
||||||
// ==== dynamic properties ====
|
// ==== dynamic properties ====
|
||||||
@obx.ref private _name: string | number | undefined;
|
@observable.ref private _name: string | number | undefined;
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
return this._name;
|
return this._name;
|
||||||
@ -345,17 +345,6 @@ export class SettingPropEntry implements ISettingPropEntry {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
valueChange(options: IPublicTypeSetValueOptions = {}) {
|
|
||||||
this.emitter.emit('valuechange', options);
|
|
||||||
|
|
||||||
if (this.parent && isSettingField(this.parent)) {
|
|
||||||
this.parent.valueChange(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
notifyValueChange(oldValue: any, newValue: any) {
|
notifyValueChange(oldValue: any, newValue: any) {
|
||||||
this.editor.eventBus.emit(GlobalEvent.Node.Prop.InnerChange, {
|
this.editor.eventBus.emit(GlobalEvent.Node.Prop.InnerChange, {
|
||||||
node: this.getNode(),
|
node: this.getNode(),
|
||||||
|
|||||||
@ -281,13 +281,6 @@ export class SettingTopEntry implements ISettingTopEntry {
|
|||||||
return this.first.document;
|
return this.first.document;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get node() {
|
|
||||||
return this.getNode();
|
|
||||||
}
|
|
||||||
|
|
||||||
getNode() {
|
getNode() {
|
||||||
return this.nodes[0];
|
return this.nodes[0];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
makeObservable,
|
makeObservable,
|
||||||
obx,
|
observable,
|
||||||
engineConfig,
|
engineConfig,
|
||||||
action,
|
action,
|
||||||
runWithGlobalEventOff,
|
runWithGlobalEventOff,
|
||||||
@ -111,7 +111,7 @@ implements
|
|||||||
|
|
||||||
readonly designer: IDesigner;
|
readonly designer: IDesigner;
|
||||||
|
|
||||||
@obx.shallow private nodes = new Set<INode>();
|
@observable.shallow private nodes = new Set<INode>();
|
||||||
|
|
||||||
private seqId = 0;
|
private seqId = 0;
|
||||||
|
|
||||||
@ -119,11 +119,6 @@ implements
|
|||||||
|
|
||||||
private rootNodeVisitorMap: { [visitorName: string]: any } = {};
|
private rootNodeVisitorMap: { [visitorName: string]: any } = {};
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
private _addons: Array<{ name: string; exportData: any }> = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模拟器
|
* 模拟器
|
||||||
*/
|
*/
|
||||||
@ -154,7 +149,7 @@ implements
|
|||||||
return this.rootNode;
|
return this.rootNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _drillDownNode: INode | null = null;
|
@observable.ref private _drillDownNode: INode | null = null;
|
||||||
|
|
||||||
private _modalNode?: INode;
|
private _modalNode?: INode;
|
||||||
|
|
||||||
@ -162,7 +157,7 @@ implements
|
|||||||
|
|
||||||
private inited = false;
|
private inited = false;
|
||||||
|
|
||||||
@obx.shallow private willPurgeSpace: INode[] = [];
|
@observable.shallow private willPurgeSpace: INode[] = [];
|
||||||
|
|
||||||
get modalNode() {
|
get modalNode() {
|
||||||
return this._modalNode;
|
return this._modalNode;
|
||||||
@ -172,9 +167,9 @@ implements
|
|||||||
return this.modalNode || this.focusNode;
|
return this.modalNode || this.focusNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.shallow private activeNodes?: INode[];
|
@observable.shallow private activeNodes?: INode[];
|
||||||
|
|
||||||
@obx.ref private _dropLocation: IDropLocation | null = null;
|
@observable.ref private _dropLocation: IDropLocation | null = null;
|
||||||
|
|
||||||
set dropLocation(loc: IDropLocation | null) {
|
set dropLocation(loc: IDropLocation | null) {
|
||||||
this._dropLocation = loc;
|
this._dropLocation = loc;
|
||||||
@ -199,9 +194,9 @@ implements
|
|||||||
return this.rootNode?.schema as any;
|
return this.rootNode?.schema as any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _opened = false;
|
@observable.ref private _opened = false;
|
||||||
|
|
||||||
@obx.ref private _suspensed = false;
|
@observable.ref private _suspensed = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为非激活状态
|
* 是否为非激活状态
|
||||||
@ -217,13 +212,6 @@ implements
|
|||||||
return !this._suspensed;
|
return !this._suspensed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated 兼容
|
|
||||||
*/
|
|
||||||
get actived(): boolean {
|
|
||||||
return this.active;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否打开
|
* 是否打开
|
||||||
*/
|
*/
|
||||||
@ -638,26 +626,6 @@ implements
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated since version 1.0.16.
|
|
||||||
* Will be deleted in version 2.0.0.
|
|
||||||
* Use checkNesting method instead.
|
|
||||||
*/
|
|
||||||
checkDropTarget(
|
|
||||||
dropTarget: INode,
|
|
||||||
dragObject: IPublicTypeDragNodeObject | IPublicTypeDragNodeDataObject,
|
|
||||||
): boolean {
|
|
||||||
let items: Array<INode | IPublicTypeNodeSchema>;
|
|
||||||
if (isDragNodeDataObject(dragObject)) {
|
|
||||||
items = Array.isArray(dragObject.data) ? dragObject.data : [dragObject.data];
|
|
||||||
} else if (isDragNodeObject<INode>(dragObject)) {
|
|
||||||
items = dragObject.nodes;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return items.every((item) => this.checkNestingUp(dropTarget, item));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查对象对父级的要求,涉及配置 parentWhitelist
|
* 检查对象对父级的要求,涉及配置 parentWhitelist
|
||||||
*/
|
*/
|
||||||
@ -700,54 +668,6 @@ implements
|
|||||||
return this.history;
|
return this.history;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
/* istanbul ignore next */
|
|
||||||
getAddonData(name: string) {
|
|
||||||
const addon = this._addons.find((item) => item.name === name);
|
|
||||||
if (addon) {
|
|
||||||
return addon.exportData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
/* istanbul ignore next */
|
|
||||||
exportAddonData() {
|
|
||||||
const addons: {
|
|
||||||
[key: string]: any;
|
|
||||||
} = {};
|
|
||||||
this._addons.forEach((addon) => {
|
|
||||||
const data = addon.exportData();
|
|
||||||
if (data === null) {
|
|
||||||
delete addons[addon.name];
|
|
||||||
} else {
|
|
||||||
addons[addon.name] = data;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return addons;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
/* istanbul ignore next */
|
|
||||||
registerAddon(name: string, exportData: any) {
|
|
||||||
if (['id', 'params', 'layout'].indexOf(name) > -1) {
|
|
||||||
throw new Error('addon name cannot be id, params, layout');
|
|
||||||
}
|
|
||||||
const i = this._addons.findIndex((item) => item.name === name);
|
|
||||||
if (i > -1) {
|
|
||||||
this._addons.splice(i, 1);
|
|
||||||
}
|
|
||||||
this._addons.push({
|
|
||||||
exportData,
|
|
||||||
name,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
acceptRootNodeVisitor(visitorName = 'default', visitorFn: (node: IRootNode) => any) {
|
acceptRootNodeVisitor(visitorName = 'default', visitorFn: (node: IRootNode) => any) {
|
||||||
let visitorResult = {};
|
let visitorResult = {};
|
||||||
@ -845,20 +765,6 @@ implements
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
refresh() {
|
|
||||||
console.warn('refresh method is deprecated');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
onRefresh(/* func: () => void */) {
|
|
||||||
console.warn('onRefresh method is deprecated');
|
|
||||||
}
|
|
||||||
|
|
||||||
onReady(fn: (...args: any[]) => void) {
|
onReady(fn: (...args: any[]) => void) {
|
||||||
this.designer.editor.eventBus.on('document-open', fn);
|
this.designer.editor.eventBus.on('document-open', fn);
|
||||||
return () => {
|
return () => {
|
||||||
|
|||||||
@ -221,16 +221,6 @@ export class History<T = IPublicTypeNodeSchema> implements IHistory {
|
|||||||
this.emitter.removeAllListeners();
|
this.emitter.removeAllListeners();
|
||||||
this.records = [];
|
this.records = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
* @returns
|
|
||||||
* @memberof History
|
|
||||||
*/
|
|
||||||
isModified() {
|
|
||||||
return this.isSavePoint();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Session {
|
export class Session {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core';
|
import { observable, computed, makeObservable } from '@alilc/lowcode-editor-core';
|
||||||
import { uniqueId } from '@alilc/lowcode-utils';
|
import { uniqueId } from '@alilc/lowcode-utils';
|
||||||
import { IPublicTypeTitleContent, IPublicModelExclusiveGroup } from '@alilc/lowcode-types';
|
import { IPublicTypeTitleContent, IPublicModelExclusiveGroup } from '@alilc/lowcode-types';
|
||||||
import type { INode } from './node';
|
import type { INode } from './node';
|
||||||
@ -30,9 +30,9 @@ export class ExclusiveGroup implements IExclusiveGroup {
|
|||||||
|
|
||||||
readonly title: IPublicTypeTitleContent;
|
readonly title: IPublicTypeTitleContent;
|
||||||
|
|
||||||
@obx.shallow readonly children: INode[] = [];
|
@observable.shallow readonly children: INode[] = [];
|
||||||
|
|
||||||
@obx private visibleIndex = 0;
|
@observable private visibleIndex = 0;
|
||||||
|
|
||||||
@computed get document() {
|
@computed get document() {
|
||||||
return this.visibleNode.document;
|
return this.visibleNode.document;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { obx, computed, makeObservable, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
|
import { observable, computed, makeObservable, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
|
||||||
import { Node, INode } from './node';
|
import { Node, INode } from './node';
|
||||||
import { IPublicTypeNodeData, IPublicModelNodeChildren, IPublicEnumTransformStage, IPublicTypeDisposable } from '@alilc/lowcode-types';
|
import { IPublicTypeNodeData, IPublicModelNodeChildren, IPublicEnumTransformStage, IPublicTypeDisposable } from '@alilc/lowcode-types';
|
||||||
import { shallowEqual, compatStage, isNodeSchema } from '@alilc/lowcode-utils';
|
import { shallowEqual, compatStage, isNodeSchema } from '@alilc/lowcode-utils';
|
||||||
@ -16,7 +16,7 @@ export class NodeChildren implements Omit<IPublicModelNodeChildren<INode>,
|
|||||||
'isEmpty' |
|
'isEmpty' |
|
||||||
'notEmpty'
|
'notEmpty'
|
||||||
> {
|
> {
|
||||||
@obx.shallow children: INode[];
|
@observable.shallow children: INode[];
|
||||||
|
|
||||||
private emitter: IEventBus = createModuleEventBus('NodeChildren');
|
private emitter: IEventBus = createModuleEventBus('NodeChildren');
|
||||||
|
|
||||||
@ -105,14 +105,6 @@ export class NodeChildren implements Omit<IPublicModelNodeChildren<INode>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* @param nodes
|
|
||||||
*/
|
|
||||||
concat(nodes: INode[]) {
|
|
||||||
return this.children.concat(nodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { ReactElement } from 'react';
|
import { ReactElement } from 'react';
|
||||||
import {
|
import {
|
||||||
obx,
|
observable,
|
||||||
computed,
|
computed,
|
||||||
autorun,
|
autorun,
|
||||||
makeObservable,
|
makeObservable,
|
||||||
@ -159,12 +159,7 @@ implements
|
|||||||
|
|
||||||
protected _children?: INodeChildren;
|
protected _children?: INodeChildren;
|
||||||
|
|
||||||
/**
|
@observable.ref private _parent: INode | null = null;
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
private _addons: { [key: string]: { exportData: () => any; isProp: boolean } } = {};
|
|
||||||
|
|
||||||
@obx.ref private _parent: INode | null = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父级节点
|
* 父级节点
|
||||||
@ -245,14 +240,14 @@ implements
|
|||||||
|
|
||||||
private _slotFor?: IProp | null | undefined = null;
|
private _slotFor?: IProp | null | undefined = null;
|
||||||
|
|
||||||
@obx.shallow _slots: INode[] = [];
|
@observable.shallow _slots: INode[] = [];
|
||||||
|
|
||||||
get slots(): INode[] {
|
get slots(): INode[] {
|
||||||
return this._slots;
|
return this._slots;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
@obx.ref private _conditionGroup: IExclusiveGroup | null = null;
|
@observable.ref private _conditionGroup: IExclusiveGroup | null = null;
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
get conditionGroup(): IExclusiveGroup | null {
|
get conditionGroup(): IExclusiveGroup | null {
|
||||||
@ -277,7 +272,7 @@ implements
|
|||||||
return this.purging;
|
return this.purging;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.shallow status: NodeStatus = {
|
@observable.shallow status: NodeStatus = {
|
||||||
inPlaceEditing: false,
|
inPlaceEditing: false,
|
||||||
locking: false,
|
locking: false,
|
||||||
pseudo: false,
|
pseudo: false,
|
||||||
@ -1105,49 +1100,6 @@ implements
|
|||||||
this.children?.mergeChildren(remover, adder, sorter);
|
this.children?.mergeChildren(remover, adder, sorter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
getStatus(field?: keyof NodeStatus) {
|
|
||||||
if (field && this.status[field] != null) {
|
|
||||||
return this.status[field];
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
setStatus(field: keyof NodeStatus, flag: boolean) {
|
|
||||||
if (!this.status.hasOwnProperty(field)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag !== this.status[field]) {
|
|
||||||
this.status[field] = flag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
getDOMNode(): any {
|
|
||||||
const instance = this.document.simulator?.getComponentInstances(this)?.[0];
|
|
||||||
if (!instance) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return this.document.simulator?.findDOMNodes(instance)?.[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
getPage() {
|
|
||||||
console.warn('getPage is deprecated, use document instead');
|
|
||||||
return this.document;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取磁贴相关信息
|
* 获取磁贴相关信息
|
||||||
*/
|
*/
|
||||||
@ -1168,97 +1120,6 @@ implements
|
|||||||
return { isContainerNode, isEmptyNode, isRGLContainerNode, isRGLNode, isRGL, rglNode };
|
return { isContainerNode, isEmptyNode, isRGLContainerNode, isRGLNode, isRGL, rglNode };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated no one is using this, will be removed in a future release
|
|
||||||
*/
|
|
||||||
getSuitablePlace(node: INode, ref: any): any {
|
|
||||||
const focusNode = this.document?.focusNode;
|
|
||||||
// 如果节点是模态框,插入到根节点下
|
|
||||||
if (node?.componentMeta?.isModal) {
|
|
||||||
return { container: focusNode, ref };
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ref && focusNode && this.contains(focusNode)) {
|
|
||||||
const rootCanDropIn = focusNode.componentMeta?.prototype?.options?.canDropIn;
|
|
||||||
if (
|
|
||||||
rootCanDropIn === undefined ||
|
|
||||||
rootCanDropIn === true ||
|
|
||||||
(typeof rootCanDropIn === 'function' && rootCanDropIn(node))
|
|
||||||
) {
|
|
||||||
return { container: focusNode };
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isRoot() && this.children) {
|
|
||||||
const dropElement = this.children.filter((c) => {
|
|
||||||
if (!c.isContainerNode) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const canDropIn = c.componentMeta?.prototype?.options?.canDropIn;
|
|
||||||
if (
|
|
||||||
canDropIn === undefined ||
|
|
||||||
canDropIn === true ||
|
|
||||||
(typeof canDropIn === 'function' && canDropIn(node))
|
|
||||||
) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
})[0];
|
|
||||||
|
|
||||||
if (dropElement) {
|
|
||||||
return { container: dropElement, ref };
|
|
||||||
}
|
|
||||||
|
|
||||||
const rootCanDropIn = this.componentMeta?.prototype?.options?.canDropIn;
|
|
||||||
if (
|
|
||||||
rootCanDropIn === undefined ||
|
|
||||||
rootCanDropIn === true ||
|
|
||||||
(typeof rootCanDropIn === 'function' && rootCanDropIn(node))
|
|
||||||
) {
|
|
||||||
return { container: this, ref };
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const canDropIn = this.componentMeta?.prototype?.options?.canDropIn;
|
|
||||||
if (this.isContainer()) {
|
|
||||||
if (
|
|
||||||
canDropIn === undefined ||
|
|
||||||
(typeof canDropIn === 'boolean' && canDropIn) ||
|
|
||||||
(typeof canDropIn === 'function' && canDropIn(node))
|
|
||||||
) {
|
|
||||||
return { container: this, ref };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.parent) {
|
|
||||||
return this.parent.getSuitablePlace(node, { index: this.index });
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
getAddonData(key: string) {
|
|
||||||
const addon = this._addons[key];
|
|
||||||
if (addon) {
|
|
||||||
return addon.exportData();
|
|
||||||
}
|
|
||||||
return this.getExtraProp(key)?.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
registerAddon(key: string, exportData: () => any, isProp = false) {
|
|
||||||
this._addons[key] = { exportData, isProp };
|
|
||||||
}
|
|
||||||
|
|
||||||
getRect(): DOMRect | null {
|
getRect(): DOMRect | null {
|
||||||
if (this.isRoot()) {
|
if (this.isRoot()) {
|
||||||
return this.document.simulator?.viewport.contentBounds || null;
|
return this.document.simulator?.viewport.contentBounds || null;
|
||||||
@ -1266,20 +1127,6 @@ implements
|
|||||||
return this.document.simulator?.computeRect(this) || null;
|
return this.document.simulator?.computeRect(this) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
getPrototype() {
|
|
||||||
return this.componentMeta.prototype;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
setPrototype(proto: any) {
|
|
||||||
this.componentMeta.prototype = proto;
|
|
||||||
}
|
|
||||||
|
|
||||||
getIcon() {
|
getIcon() {
|
||||||
return this.icon;
|
return this.icon;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { untracked, computed, obx, engineConfig, action, makeObservable, mobx, runInAction } from '@alilc/lowcode-editor-core';
|
import { untracked, computed, observable, engineConfig, action, makeObservable, mobx, runInAction } from '@alilc/lowcode-editor-core';
|
||||||
import { GlobalEvent, IPublicEnumTransformStage } from '@alilc/lowcode-types';
|
import { GlobalEvent, IPublicEnumTransformStage } from '@alilc/lowcode-types';
|
||||||
import type { IPublicTypeCompositeValue, IPublicTypeJSSlot, IPublicTypeSlotSchema, IPublicModelProp, IPublicTypeNodeData } from '@alilc/lowcode-types';
|
import type { IPublicTypeCompositeValue, IPublicTypeJSSlot, IPublicTypeSlotSchema, IPublicModelProp, IPublicTypeNodeData } from '@alilc/lowcode-types';
|
||||||
import { uniqueId, isPlainObject, hasOwnProperty, compatStage, isJSExpression, isJSSlot, isNodeSchema } from '@alilc/lowcode-utils';
|
import { uniqueId, isPlainObject, hasOwnProperty, compatStage, isJSExpression, isJSSlot, isNodeSchema } from '@alilc/lowcode-utils';
|
||||||
@ -63,12 +63,12 @@ export class Prop implements IProp, IPropParent {
|
|||||||
/**
|
/**
|
||||||
* 键值
|
* 键值
|
||||||
*/
|
*/
|
||||||
@obx key: string | number | undefined;
|
@observable key: string | number | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扩展值
|
* 扩展值
|
||||||
*/
|
*/
|
||||||
@obx spread: boolean;
|
@observable spread: boolean;
|
||||||
|
|
||||||
readonly props: IProps;
|
readonly props: IProps;
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ export class Prop implements IProp, IPropParent {
|
|||||||
|
|
||||||
readonly id = uniqueId('prop$');
|
readonly id = uniqueId('prop$');
|
||||||
|
|
||||||
@obx.ref private _type: ValueTypes = 'unset';
|
@observable.ref private _type: ValueTypes = 'unset';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 属性类型
|
* 属性类型
|
||||||
@ -85,7 +85,7 @@ export class Prop implements IProp, IPropParent {
|
|||||||
return this._type;
|
return this._type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx private _value: any = UNSET;
|
@observable private _value: any = UNSET;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 属性值
|
* 属性值
|
||||||
@ -146,7 +146,7 @@ export class Prop implements IProp, IPropParent {
|
|||||||
return this._slotNode || null;
|
return this._slotNode || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.shallow private _items: IProp[] | null = null;
|
@observable.shallow private _items: IProp[] | null = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 作为一层缓存机制,主要是复用部分已存在的 Prop,保持响应式关系,比如:
|
* 作为一层缓存机制,主要是复用部分已存在的 Prop,保持响应式关系,比如:
|
||||||
@ -154,7 +154,7 @@ export class Prop implements IProp, IPropParent {
|
|||||||
* 导致假如外部有 mobx reaction(常见于 observer),此时响应式链路会被打断,
|
* 导致假如外部有 mobx reaction(常见于 observer),此时响应式链路会被打断,
|
||||||
* 因为 reaction 监听的是原 Prop(a) 的 _value,而不是新 Prop(a) 的 _value。
|
* 因为 reaction 监听的是原 Prop(a) 的 _value,而不是新 Prop(a) 的 _value。
|
||||||
*/
|
*/
|
||||||
@obx.shallow private _maps: Map<string | number, IProp> | null = null;
|
@observable.shallow private _maps: Map<string | number, IProp> | null = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造 items 属性,同时构造 maps 属性
|
* 构造 items 属性,同时构造 maps 属性
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { computed, makeObservable, obx, action } from '@alilc/lowcode-editor-core';
|
import { computed, makeObservable, observable, action } from '@alilc/lowcode-editor-core';
|
||||||
import { IPublicTypePropsList, IPublicTypeCompositeValue, IPublicEnumTransformStage, IBaseModelProps } from '@alilc/lowcode-types';
|
import { IPublicTypePropsList, IPublicTypeCompositeValue, IPublicEnumTransformStage, IBaseModelProps } from '@alilc/lowcode-types';
|
||||||
import type { IPublicTypePropsMap } from '@alilc/lowcode-types';
|
import type { IPublicTypePropsMap } from '@alilc/lowcode-types';
|
||||||
import { uniqueId, compatStage } from '@alilc/lowcode-utils';
|
import { uniqueId, compatStage } from '@alilc/lowcode-utils';
|
||||||
@ -42,7 +42,7 @@ export interface IProps extends Props {}
|
|||||||
export class Props implements Omit<IBaseModelProps<IProp>, | 'getExtraProp' | 'getExtraPropValue' | 'setExtraPropValue' | 'node'>, IPropParent {
|
export class Props implements Omit<IBaseModelProps<IProp>, | 'getExtraProp' | 'getExtraPropValue' | 'setExtraPropValue' | 'node'>, IPropParent {
|
||||||
readonly id = uniqueId('props');
|
readonly id = uniqueId('props');
|
||||||
|
|
||||||
@obx.shallow private items: IProp[] = [];
|
@observable.shallow private items: IProp[] = [];
|
||||||
|
|
||||||
@computed private get maps(): Map<string, Prop> {
|
@computed private get maps(): Map<string, Prop> {
|
||||||
const maps = new Map();
|
const maps = new Map();
|
||||||
@ -71,7 +71,7 @@ export class Props implements Omit<IBaseModelProps<IProp>, | 'getExtraProp' | 'g
|
|||||||
return this.items.length;
|
return this.items.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx type: 'map' | 'list' = 'map';
|
@observable type: 'map' | 'list' = 'map';
|
||||||
|
|
||||||
private purged = false;
|
private purged = false;
|
||||||
|
|
||||||
@ -182,27 +182,6 @@ export class Props implements Omit<IBaseModelProps<IProp>, | 'getExtraProp' | 'g
|
|||||||
return { props, extras };
|
return { props, extras };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
/* istanbul ignore next */
|
|
||||||
private transformToStatic(props: any) {
|
|
||||||
let transducers = this.owner.componentMeta?.prototype?.options?.transducers;
|
|
||||||
if (!transducers) {
|
|
||||||
return props;
|
|
||||||
}
|
|
||||||
if (!Array.isArray(transducers)) {
|
|
||||||
transducers = [transducers];
|
|
||||||
}
|
|
||||||
props = transducers.reduce((xprops: any, transducer: any) => {
|
|
||||||
if (transducer && typeof transducer.toStatic === 'function') {
|
|
||||||
return transducer.toStatic(xprops);
|
|
||||||
}
|
|
||||||
return xprops;
|
|
||||||
}, props);
|
|
||||||
return props;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据 path 路径查询属性
|
* 根据 path 路径查询属性
|
||||||
*
|
*
|
||||||
@ -384,13 +363,4 @@ export class Props implements Omit<IBaseModelProps<IProp>, | 'getExtraProp' | 'g
|
|||||||
getNode() {
|
getNode() {
|
||||||
return this.owner;
|
return this.owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 获取 props 对应的 node
|
|
||||||
*/
|
|
||||||
@action
|
|
||||||
toData() {
|
|
||||||
return this.export()?.props;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { obx, makeObservable, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
|
import { observable, makeObservable, IEventBus, createModuleEventBus, action } from '@alilc/lowcode-editor-core';
|
||||||
import { INode, comparePosition, PositionNO } from './node/node';
|
import { INode, comparePosition, PositionNO } from './node/node';
|
||||||
import { DocumentModel } from './document-model';
|
import { DocumentModel } from './document-model';
|
||||||
import { IPublicModelSelection } from '@alilc/lowcode-types';
|
import { IPublicModelSelection } from '@alilc/lowcode-types';
|
||||||
@ -10,7 +10,7 @@ export interface ISelection extends Omit<IPublicModelSelection<INode>, 'node'> {
|
|||||||
export class Selection implements ISelection {
|
export class Selection implements ISelection {
|
||||||
private emitter: IEventBus = createModuleEventBus('Selection');
|
private emitter: IEventBus = createModuleEventBus('Selection');
|
||||||
|
|
||||||
@obx.shallow private _selected: string[] = [];
|
@observable.shallow private _selected: string[] = [];
|
||||||
|
|
||||||
constructor(readonly doc: DocumentModel) {
|
constructor(readonly doc: DocumentModel) {
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
@ -26,6 +26,7 @@ export class Selection implements ISelection {
|
|||||||
/**
|
/**
|
||||||
* 选中
|
* 选中
|
||||||
*/
|
*/
|
||||||
|
@action
|
||||||
select(id: string) {
|
select(id: string) {
|
||||||
if (this._selected.length === 1 && this._selected.indexOf(id) > -1) {
|
if (this._selected.length === 1 && this._selected.indexOf(id) > -1) {
|
||||||
// avoid cause reaction
|
// avoid cause reaction
|
||||||
@ -45,6 +46,7 @@ export class Selection implements ISelection {
|
|||||||
/**
|
/**
|
||||||
* 批量选中
|
* 批量选中
|
||||||
*/
|
*/
|
||||||
|
@action
|
||||||
selectAll(ids: string[]) {
|
selectAll(ids: string[]) {
|
||||||
const selectIds: string[] = [];
|
const selectIds: string[] = [];
|
||||||
|
|
||||||
@ -64,6 +66,7 @@ export class Selection implements ISelection {
|
|||||||
/**
|
/**
|
||||||
* 清除选中
|
* 清除选中
|
||||||
*/
|
*/
|
||||||
|
@action
|
||||||
clear() {
|
clear() {
|
||||||
if (this._selected.length < 1) {
|
if (this._selected.length < 1) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { obx, computed, makeObservable, action, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
|
import { observable, computed, makeObservable, action, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
|
||||||
import { IDesigner } from '../designer';
|
import { IDesigner } from '../designer';
|
||||||
import { DocumentModel, isDocumentModel } from '../document';
|
import { DocumentModel, isDocumentModel } from '../document';
|
||||||
import type { IDocumentModel } from '../document';
|
import type { IDocumentModel } from '../document';
|
||||||
@ -93,7 +93,7 @@ export interface IProject extends Omit<IBaseApiProject<
|
|||||||
export class Project implements IProject {
|
export class Project implements IProject {
|
||||||
private emitter: IEventBus = createModuleEventBus('Project');
|
private emitter: IEventBus = createModuleEventBus('Project');
|
||||||
|
|
||||||
@obx.shallow readonly documents: IDocumentModel[] = [];
|
@observable.shallow readonly documents: IDocumentModel[] = [];
|
||||||
|
|
||||||
private data: IPublicTypeProjectSchema = {
|
private data: IPublicTypeProjectSchema = {
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
@ -117,7 +117,7 @@ export class Project implements IProject {
|
|||||||
return this.documents.find((doc) => doc.active);
|
return this.documents.find((doc) => doc.active);
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx private _config: any = {};
|
@observable private _config: any = {};
|
||||||
@computed get config(): any {
|
@computed get config(): any {
|
||||||
// TODO: parse layout Component
|
// TODO: parse layout Component
|
||||||
return this._config;
|
return this._config;
|
||||||
@ -126,7 +126,7 @@ export class Project implements IProject {
|
|||||||
this._config = value;
|
this._config = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _i18n: any = {};
|
@observable.ref private _i18n: any = {};
|
||||||
@computed get i18n(): any {
|
@computed get i18n(): any {
|
||||||
return this._i18n;
|
return this._i18n;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import { engineConfig } from './config';
|
import { engineConfig } from './config';
|
||||||
import { globalLocale } from './intl';
|
import { globalLocale } from './intl';
|
||||||
import { obx } from './utils';
|
import { observable } from './utils';
|
||||||
import { IPublicTypeAssetsJson, AssetLoader } from '@alilc/lowcode-utils';
|
import { IPublicTypeAssetsJson, AssetLoader } from '@alilc/lowcode-utils';
|
||||||
import { assetsTransform } from './utils/assets-transform';
|
import { assetsTransform } from './utils/assets-transform';
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ export class Editor extends EventEmitter implements IEditor {
|
|||||||
/**
|
/**
|
||||||
* Ioc Container
|
* Ioc Container
|
||||||
*/
|
*/
|
||||||
@obx.shallow private context = new Map<IPublicTypeEditorValueKey, any>();
|
@observable.shallow private context = new Map<IPublicTypeEditorValueKey, any>();
|
||||||
|
|
||||||
get locale() {
|
get locale() {
|
||||||
return globalLocale.getLocale();
|
return globalLocale.getLocale();
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { IEventBus, createModuleEventBus } from '../event-bus';
|
import { IEventBus, createModuleEventBus } from '../event-bus';
|
||||||
import { obx, computed } from '../utils/obx';
|
import { observable, computed } from '../utils/obx';
|
||||||
import { Logger } from '@alilc/lowcode-utils';
|
import { Logger } from '@alilc/lowcode-utils';
|
||||||
|
|
||||||
const logger = new Logger({ level: 'warn', bizName: 'globalLocale' });
|
const logger = new Logger({ level: 'warn', bizName: 'globalLocale' });
|
||||||
@ -35,7 +35,7 @@ const LowcodeConfigKey = 'ali-lowcode-config';
|
|||||||
class GlobalLocale {
|
class GlobalLocale {
|
||||||
private emitter: IEventBus = createModuleEventBus('GlobalLocale');
|
private emitter: IEventBus = createModuleEventBus('GlobalLocale');
|
||||||
|
|
||||||
@obx.ref private _locale?: string;
|
@observable.ref private _locale?: string;
|
||||||
|
|
||||||
@computed get locale() {
|
@computed get locale() {
|
||||||
if (this._locale != null) {
|
if (this._locale != null) {
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import { configure } from 'mobx';
|
|||||||
configure({ enforceActions: 'never' });
|
configure({ enforceActions: 'never' });
|
||||||
|
|
||||||
export {
|
export {
|
||||||
observable as obx,
|
|
||||||
observable,
|
observable,
|
||||||
observe,
|
observe,
|
||||||
autorun,
|
autorun,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core';
|
import { observable, computed, makeObservable } from '@alilc/lowcode-editor-core';
|
||||||
import { Logger } from '@alilc/lowcode-utils';
|
import { Logger } from '@alilc/lowcode-utils';
|
||||||
import { IPublicTypeWidgetBaseConfig } from '@alilc/lowcode-types';
|
import { IPublicTypeWidgetBaseConfig } from '@alilc/lowcode-types';
|
||||||
import { WidgetContainer } from './widget/widget-container';
|
import { WidgetContainer } from './widget/widget-container';
|
||||||
@ -17,7 +17,7 @@ export interface IArea<C, T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Area<C extends IPublicTypeWidgetBaseConfig = any, T extends IWidget = IWidget> implements IArea<C, T> {
|
export class Area<C extends IPublicTypeWidgetBaseConfig = any, T extends IWidget = IWidget> implements IArea<C, T> {
|
||||||
@obx private _visible = true;
|
@observable private _visible = true;
|
||||||
|
|
||||||
@computed get visible() {
|
@computed get visible() {
|
||||||
if (this.exclusive) {
|
if (this.exclusive) {
|
||||||
@ -80,12 +80,4 @@ export class Area<C extends IPublicTypeWidgetBaseConfig = any, T extends IWidget
|
|||||||
show() {
|
show() {
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== compatible for vision ========
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
removeAction(config: string): number {
|
|
||||||
return this.remove(config);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Node, Designer, Selection, SettingTopEntry } from '@alilc/lowcode-designer';
|
import { Node, Designer, Selection, SettingTopEntry } from '@alilc/lowcode-designer';
|
||||||
import {
|
import {
|
||||||
Editor,
|
Editor,
|
||||||
obx,
|
observable,
|
||||||
computed,
|
computed,
|
||||||
makeObservable,
|
makeObservable,
|
||||||
action,
|
action,
|
||||||
@ -21,7 +21,7 @@ export class SettingsMain {
|
|||||||
|
|
||||||
private _sessionId = '';
|
private _sessionId = '';
|
||||||
|
|
||||||
@obx.ref private _settings?: SettingTopEntry;
|
@observable.ref private _settings?: SettingTopEntry;
|
||||||
|
|
||||||
@computed get length(): number | undefined {
|
@computed get length(): number | undefined {
|
||||||
return this._settings?.nodes.length;
|
return this._settings?.nodes.length;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Component, MouseEvent, Fragment, ReactNode } from 'react';
|
import { Component, MouseEvent, Fragment, ReactNode } from 'react';
|
||||||
import { shallowIntl, observer, obx, engineConfig, runInAction } from '@alilc/lowcode-editor-core';
|
import { shallowIntl, observer, observable, engineConfig, runInAction } from '@alilc/lowcode-editor-core';
|
||||||
import {
|
import {
|
||||||
createContent,
|
createContent,
|
||||||
isJSSlot,
|
isJSSlot,
|
||||||
@ -410,7 +410,7 @@ export type SettingsPaneProps = {
|
|||||||
export class SettingsPane extends Component<SettingsPaneProps> {
|
export class SettingsPane extends Component<SettingsPaneProps> {
|
||||||
static contextType = SkeletonContext;
|
static contextType = SkeletonContext;
|
||||||
|
|
||||||
@obx private currentStage?: Stage;
|
@observable private currentStage?: Stage;
|
||||||
|
|
||||||
private popupPipe = new PopupPipe();
|
private popupPipe = new PopupPipe();
|
||||||
|
|
||||||
|
|||||||
@ -4,19 +4,19 @@ import {
|
|||||||
Title,
|
Title,
|
||||||
observer,
|
observer,
|
||||||
Editor,
|
Editor,
|
||||||
obx,
|
observable,
|
||||||
globalContext,
|
globalContext,
|
||||||
engineConfig,
|
engineConfig,
|
||||||
makeObservable,
|
makeObservable,
|
||||||
} from '@alilc/lowcode-editor-core';
|
} from '@alilc/lowcode-editor-core';
|
||||||
import { Node, SettingField, isSettingField, INode } from '@alilc/lowcode-designer';
|
import { Node, SettingField, INode } from '@alilc/lowcode-designer';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { SettingsMain } from './main';
|
import { SettingsMain } from './main';
|
||||||
import { SettingsPane } from './settings-pane';
|
import { SettingsPane } from './settings-pane';
|
||||||
import { StageBox } from '../stage-box';
|
import { StageBox } from '../stage-box';
|
||||||
import { SkeletonContext } from '../../context';
|
import { SkeletonContext } from '../../context';
|
||||||
import { intl } from '../../locale';
|
import { intl } from '../../locale';
|
||||||
import { createIcon } from '@alilc/lowcode-utils';
|
import { createIcon, isSettingField } from '@alilc/lowcode-utils';
|
||||||
|
|
||||||
interface ISettingsPrimaryPaneProps {
|
interface ISettingsPrimaryPaneProps {
|
||||||
engineEditor: Editor;
|
engineEditor: Editor;
|
||||||
@ -33,7 +33,7 @@ export class SettingsPrimaryPane extends Component<
|
|||||||
};
|
};
|
||||||
private main = new SettingsMain(this.props.engineEditor);
|
private main = new SettingsMain(this.props.engineEditor);
|
||||||
|
|
||||||
@obx.ref private _activeKey?: any;
|
@observable.ref private _activeKey?: any;
|
||||||
|
|
||||||
constructor(props: ISettingsPrimaryPaneProps) {
|
constructor(props: ISettingsPrimaryPaneProps) {
|
||||||
super(props);
|
super(props);
|
||||||
@ -235,7 +235,6 @@ export class SettingsPrimaryPane extends Component<
|
|||||||
{(skeleton) => {
|
{(skeleton) => {
|
||||||
if (skeleton) {
|
if (skeleton) {
|
||||||
return (
|
return (
|
||||||
// @ts-ignore
|
|
||||||
<StageBox skeleton={skeleton} target={field} key={field.id}>
|
<StageBox skeleton={skeleton} target={field} key={field.id}>
|
||||||
<SettingsPane target={field} key={field.id} usePopup={false} />
|
<SettingsPane target={field} key={field.id} usePopup={false} />
|
||||||
</StageBox>
|
</StageBox>
|
||||||
|
|||||||
@ -73,22 +73,3 @@
|
|||||||
|
|
||||||
--pane-title-bg-color: rgba(31,56,88,.04);
|
--pane-title-bg-color: rgba(31,56,88,.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @deprecated 变量
|
|
||||||
:root {
|
|
||||||
--color-function-success: @brand-success;
|
|
||||||
--color-function-success-dark: darken(@brand-success, 10%);
|
|
||||||
--color-function-success-light: lighten(@brand-success, 10%);
|
|
||||||
--color-function-warning: @brand-warning;
|
|
||||||
--color-function-warning-dark: darken(@brand-warning, 10%);
|
|
||||||
--color-function-warning-light: lighten(@brand-warning, 10%);
|
|
||||||
--color-function-information: @brand-link-hover;
|
|
||||||
--color-function-information-dark: darken(@brand-link-hover, 10%);
|
|
||||||
--color-function-information-light: lighten(@brand-link-hover, 10%);
|
|
||||||
--color-function-error: @brand-danger;
|
|
||||||
--color-function-error-dark: darken(@brand-danger, 10%);
|
|
||||||
--color-function-error-light: lighten(@brand-danger, 10%);
|
|
||||||
--color-function-purple: rgb(144, 94, 190);
|
|
||||||
--color-function-brown: #7b605b;
|
|
||||||
--color-text-regular: @normal-alpha-2;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { action, makeObservable, obx, engineConfig, IEditor, FocusTracker } from '@alilc/lowcode-editor-core';
|
import { action, makeObservable, observable, engineConfig, IEditor, FocusTracker } from '@alilc/lowcode-editor-core';
|
||||||
import {
|
import {
|
||||||
DockConfig,
|
DockConfig,
|
||||||
WidgetConfig,
|
WidgetConfig,
|
||||||
@ -85,7 +85,7 @@ export class Skeleton implements Omit<IPublicApiSkeleton,
|
|||||||
|
|
||||||
readonly rightArea: Area<IPublicTypePanelConfig, Panel>;
|
readonly rightArea: Area<IPublicTypePanelConfig, Panel>;
|
||||||
|
|
||||||
@obx readonly mainArea: Area<WidgetConfig | IPublicTypePanelConfig, Widget | Panel>;
|
@observable readonly mainArea: Area<WidgetConfig | IPublicTypePanelConfig, Widget | Panel>;
|
||||||
|
|
||||||
readonly bottomArea: Area<IPublicTypePanelConfig, Panel>;
|
readonly bottomArea: Area<IPublicTypePanelConfig, Panel>;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ReactNode, createElement } from 'react';
|
import { ReactNode, createElement } from 'react';
|
||||||
import { makeObservable, obx } from '@alilc/lowcode-editor-core';
|
import { makeObservable, observable } from '@alilc/lowcode-editor-core';
|
||||||
import { uniqueId, createContent } from '@alilc/lowcode-utils';
|
import { uniqueId, createContent } from '@alilc/lowcode-utils';
|
||||||
import { getEvent } from '../event';
|
import { getEvent } from '../event';
|
||||||
import { DockConfig } from '../types';
|
import { DockConfig } from '../types';
|
||||||
@ -19,13 +19,13 @@ export class Dock implements IWidget {
|
|||||||
|
|
||||||
readonly align?: string;
|
readonly align?: string;
|
||||||
|
|
||||||
@obx.ref private _visible = true;
|
@observable.ref private _visible = true;
|
||||||
|
|
||||||
get visible(): boolean {
|
get visible(): boolean {
|
||||||
return this._visible;
|
return this._visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _disabled = false;
|
@observable.ref private _disabled = false;
|
||||||
|
|
||||||
get content(): ReactNode {
|
get content(): ReactNode {
|
||||||
return createElement(WidgetView, {
|
return createElement(WidgetView, {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core';
|
import { observable, computed, makeObservable } from '@alilc/lowcode-editor-core';
|
||||||
import { uniqueId } from '@alilc/lowcode-utils';
|
import { uniqueId } from '@alilc/lowcode-utils';
|
||||||
import { createElement, ReactNode, ReactInstance } from 'react';
|
import { createElement, ReactNode, ReactInstance } from 'react';
|
||||||
import { ISkeleton } from '../skeleton';
|
import { ISkeleton } from '../skeleton';
|
||||||
@ -51,7 +51,7 @@ export class PanelDock implements IWidget {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _visible = true;
|
@observable.ref private _visible = true;
|
||||||
|
|
||||||
get visible() {
|
get visible() {
|
||||||
return this._visible;
|
return this._visible;
|
||||||
@ -65,7 +65,7 @@ export class PanelDock implements IWidget {
|
|||||||
|
|
||||||
private _panel?: Panel;
|
private _panel?: Panel;
|
||||||
|
|
||||||
@obx.ref private _disabled = false;
|
@observable.ref private _disabled = false;
|
||||||
|
|
||||||
@computed get panel() {
|
@computed get panel() {
|
||||||
return this._panel || this.skeleton.getPanel(this.panelName);
|
return this._panel || this.skeleton.getPanel(this.panelName);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { createElement, ReactNode } from 'react';
|
import { createElement, ReactNode } from 'react';
|
||||||
import {
|
import {
|
||||||
obx,
|
observable,
|
||||||
computed,
|
computed,
|
||||||
makeObservable,
|
makeObservable,
|
||||||
IEventBus,
|
IEventBus,
|
||||||
@ -27,9 +27,9 @@ export class Panel implements IWidget {
|
|||||||
|
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
|
|
||||||
@obx.ref inited = false;
|
@observable.ref inited = false;
|
||||||
|
|
||||||
@obx.ref private _actived = false;
|
@observable.ref private _actived = false;
|
||||||
|
|
||||||
private emitter: IEventBus = createModuleEventBus('Panel');
|
private emitter: IEventBus = createModuleEventBus('Panel');
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ export class Panel implements IWidget {
|
|||||||
|
|
||||||
private container?: WidgetContainer<Panel, IPublicTypePanelConfig>;
|
private container?: WidgetContainer<Panel, IPublicTypePanelConfig>;
|
||||||
|
|
||||||
@obx.ref public parent?: WidgetContainer;
|
@observable.ref public parent?: WidgetContainer;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly skeleton: ISkeleton,
|
readonly skeleton: ISkeleton,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core';
|
import { observable, computed, makeObservable } from '@alilc/lowcode-editor-core';
|
||||||
import { hasOwnProperty } from '@alilc/lowcode-utils';
|
import { hasOwnProperty } from '@alilc/lowcode-utils';
|
||||||
import { isPanel } from './panel';
|
import { isPanel } from './panel';
|
||||||
|
|
||||||
@ -15,11 +15,11 @@ function isActiveable(obj: any): obj is Activeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class WidgetContainer<T extends WidgetItem = any, G extends WidgetItem = any> {
|
export class WidgetContainer<T extends WidgetItem = any, G extends WidgetItem = any> {
|
||||||
@obx.shallow items: T[] = [];
|
@observable.shallow items: T[] = [];
|
||||||
|
|
||||||
private maps: { [name: string]: T } = {};
|
private maps: { [name: string]: T } = {};
|
||||||
|
|
||||||
@obx.ref private _current: T & Activeable | null = null;
|
@observable.ref private _current: T & Activeable | null = null;
|
||||||
|
|
||||||
get current() {
|
get current() {
|
||||||
return this._current;
|
return this._current;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ReactNode, createElement } from 'react';
|
import { ReactNode, createElement } from 'react';
|
||||||
import { makeObservable, obx } from '@alilc/lowcode-editor-core';
|
import { makeObservable, observable } from '@alilc/lowcode-editor-core';
|
||||||
import { createContent, uniqueId } from '@alilc/lowcode-utils';
|
import { createContent, uniqueId } from '@alilc/lowcode-utils';
|
||||||
import { getEvent } from '../event';
|
import { getEvent } from '../event';
|
||||||
import { WidgetConfig } from '../types';
|
import { WidgetConfig } from '../types';
|
||||||
@ -36,15 +36,15 @@ export class Widget implements IWidget {
|
|||||||
|
|
||||||
readonly align?: string;
|
readonly align?: string;
|
||||||
|
|
||||||
@obx.ref private _visible = true;
|
@observable.ref private _visible = true;
|
||||||
|
|
||||||
get visible(): boolean {
|
get visible(): boolean {
|
||||||
return this._visible;
|
return this._visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref inited = false;
|
@observable.ref inited = false;
|
||||||
|
|
||||||
@obx.ref private _disabled = false;
|
@observable.ref private _disabled = false;
|
||||||
|
|
||||||
private _body: ReactNode;
|
private _body: ReactNode;
|
||||||
|
|
||||||
|
|||||||
@ -68,6 +68,7 @@ import { version } from '../package.json';
|
|||||||
import '@alilc/lowcode-plugin-outline-pane/dist/style.css';
|
import '@alilc/lowcode-plugin-outline-pane/dist/style.css';
|
||||||
import '@alilc/lowcode-editor-skeleton/dist/style.css';
|
import '@alilc/lowcode-editor-skeleton/dist/style.css';
|
||||||
import '@alilc/lowcode-designer/dist/style.css';
|
import '@alilc/lowcode-designer/dist/style.css';
|
||||||
|
import '@alilc/lowcode-utils/dist/style.css';
|
||||||
|
|
||||||
export * from './modules/skeleton-types';
|
export * from './modules/skeleton-types';
|
||||||
export * from './modules/designer-types';
|
export * from './modules/designer-types';
|
||||||
@ -219,8 +220,8 @@ export {
|
|||||||
command,
|
command,
|
||||||
};
|
};
|
||||||
|
|
||||||
// declare this is open-source version
|
|
||||||
/**
|
/**
|
||||||
|
* declare this is open-source version
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
export const isOpenSource = true;
|
export const isOpenSource = true;
|
||||||
|
|||||||
@ -72,11 +72,4 @@ export class Canvas implements IPublicApiCanvas {
|
|||||||
target: (locationData.target as any)[nodeSymbol],
|
target: (locationData.target as any)[nodeSymbol],
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get dropLocation() {
|
|
||||||
return ShellDropLocation.create((this[designerSymbol] as any).dropLocation || null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,13 +77,6 @@ export class Project implements IPublicApiProject {
|
|||||||
return SimulatorHost.create(this[projectSymbol].simulator as any || this[simulatorHostSymbol]);
|
return SimulatorHost.create(this[projectSymbol].simulator as any || this[simulatorHostSymbol]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use .simulatorHost instead.
|
|
||||||
*/
|
|
||||||
get simulator() {
|
|
||||||
return this.simulatorHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打开一个 document
|
* 打开一个 document
|
||||||
* @param doc
|
* @param doc
|
||||||
|
|||||||
@ -65,11 +65,4 @@ export class Setters implements IPublicApiSetters {
|
|||||||
) => {
|
) => {
|
||||||
return this[settersSymbol].registerSetter(typeOrMaps, setter);
|
return this[settersSymbol].registerSetter(typeOrMaps, setter);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
createSetterContent = (setter: any, props: Record<string, any>): ReactNode => {
|
|
||||||
return this[settersSymbol].createSetterContent(setter, props);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,13 +81,6 @@ export class ComponentMeta implements IPublicModelComponentMeta {
|
|||||||
return this[componentMetaSymbol].npm;
|
return this[componentMetaSymbol].npm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
get prototype() {
|
|
||||||
return (this[componentMetaSymbol] as any).prototype;
|
|
||||||
}
|
|
||||||
|
|
||||||
get availableActions(): any {
|
get availableActions(): any {
|
||||||
return this[componentMetaSymbol].availableActions;
|
return this[componentMetaSymbol].availableActions;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,19 +44,12 @@ export class DocumentModel implements IPublicModelDocumentModel {
|
|||||||
detecting: IPublicModelDetecting;
|
detecting: IPublicModelDetecting;
|
||||||
history: IPublicModelHistory;
|
history: IPublicModelHistory;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use canvas API instead
|
|
||||||
*/
|
|
||||||
canvas: IPublicApiCanvas;
|
|
||||||
|
|
||||||
constructor(document: InnerDocumentModel) {
|
constructor(document: InnerDocumentModel) {
|
||||||
this[documentSymbol] = document;
|
this[documentSymbol] = document;
|
||||||
this[editorSymbol] = document.designer?.editor as IPublicModelEditor;
|
this[editorSymbol] = document.designer?.editor as IPublicModelEditor;
|
||||||
this.selection = new ShellSelection(document);
|
this.selection = new ShellSelection(document);
|
||||||
this.detecting = new ShellDetecting(document);
|
this.detecting = new ShellDetecting(document);
|
||||||
this.history = new ShellHistory(document);
|
this.history = new ShellHistory(document);
|
||||||
this.canvas = new ShellCanvas(this[editorSymbol]);
|
|
||||||
|
|
||||||
this._focusNode = ShellNode.create(this[documentSymbol].focusNode);
|
this._focusNode = ShellNode.create(this[documentSymbol].focusNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,15 +31,6 @@ export class NodeChildren implements IPublicModelNodeChildren {
|
|||||||
return this[nodeChildrenSymbol].size;
|
return this[nodeChildrenSymbol].size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 是否为空
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
get isEmpty(): boolean {
|
|
||||||
return this[nodeChildrenSymbol].isEmptyNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为空
|
* 是否为空
|
||||||
* @returns
|
* @returns
|
||||||
@ -48,14 +39,6 @@ export class NodeChildren implements IPublicModelNodeChildren {
|
|||||||
return this[nodeChildrenSymbol].isEmptyNode;
|
return this[nodeChildrenSymbol].isEmptyNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* judge if it is not empty
|
|
||||||
*/
|
|
||||||
get notEmpty(): boolean {
|
|
||||||
return this[nodeChildrenSymbol].notEmptyNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* judge if it is not empty
|
* judge if it is not empty
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -62,14 +62,6 @@ export class Node implements IPublicModelNode {
|
|||||||
return this[nodeSymbol].title;
|
return this[nodeSymbol].title;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 是否为「容器型」节点
|
|
||||||
*/
|
|
||||||
get isContainer(): boolean {
|
|
||||||
return this[nodeSymbol].isContainerNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为「容器型」节点
|
* 是否为「容器型」节点
|
||||||
*/
|
*/
|
||||||
@ -77,14 +69,6 @@ export class Node implements IPublicModelNode {
|
|||||||
return this[nodeSymbol].isContainerNode;
|
return this[nodeSymbol].isContainerNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 是否为根节点
|
|
||||||
*/
|
|
||||||
get isRoot(): boolean {
|
|
||||||
return this[nodeSymbol].isRootNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为根节点
|
* 是否为根节点
|
||||||
*/
|
*/
|
||||||
@ -92,14 +76,6 @@ export class Node implements IPublicModelNode {
|
|||||||
return this[nodeSymbol].isRootNode;
|
return this[nodeSymbol].isRootNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 是否为空节点(无 children 或者 children 为空)
|
|
||||||
*/
|
|
||||||
get isEmpty(): boolean {
|
|
||||||
return this[nodeSymbol].isEmptyNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为空节点(无 children 或者 children 为空)
|
* 是否为空节点(无 children 或者 children 为空)
|
||||||
*/
|
*/
|
||||||
@ -107,14 +83,6 @@ export class Node implements IPublicModelNode {
|
|||||||
return this[nodeSymbol].isEmptyNode;
|
return this[nodeSymbol].isEmptyNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 是否为 Page 节点
|
|
||||||
*/
|
|
||||||
get isPage(): boolean {
|
|
||||||
return this[nodeSymbol].isPageNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为 Page 节点
|
* 是否为 Page 节点
|
||||||
*/
|
*/
|
||||||
@ -122,14 +90,6 @@ export class Node implements IPublicModelNode {
|
|||||||
return this[nodeSymbol].isPageNode;
|
return this[nodeSymbol].isPageNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 是否为 Component 节点
|
|
||||||
*/
|
|
||||||
get isComponent(): boolean {
|
|
||||||
return this[nodeSymbol].isComponentNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为 Component 节点
|
* 是否为 Component 节点
|
||||||
*/
|
*/
|
||||||
@ -137,14 +97,6 @@ export class Node implements IPublicModelNode {
|
|||||||
return this[nodeSymbol].isComponentNode;
|
return this[nodeSymbol].isComponentNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 是否为「模态框」节点
|
|
||||||
*/
|
|
||||||
get isModal(): boolean {
|
|
||||||
return this[nodeSymbol].isModalNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为「模态框」节点
|
* 是否为「模态框」节点
|
||||||
*/
|
*/
|
||||||
@ -152,14 +104,6 @@ export class Node implements IPublicModelNode {
|
|||||||
return this[nodeSymbol].isModalNode;
|
return this[nodeSymbol].isModalNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 是否为插槽节点
|
|
||||||
*/
|
|
||||||
get isSlot(): boolean {
|
|
||||||
return this[nodeSymbol].isSlotNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为插槽节点
|
* 是否为插槽节点
|
||||||
*/
|
*/
|
||||||
@ -167,14 +111,6 @@ export class Node implements IPublicModelNode {
|
|||||||
return this[nodeSymbol].isSlotNode;
|
return this[nodeSymbol].isSlotNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 是否为父类/分支节点
|
|
||||||
*/
|
|
||||||
get isParental(): boolean {
|
|
||||||
return this[nodeSymbol].isParentalNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为父类/分支节点
|
* 是否为父类/分支节点
|
||||||
*/
|
*/
|
||||||
@ -182,14 +118,6 @@ export class Node implements IPublicModelNode {
|
|||||||
return this[nodeSymbol].isParentalNode;
|
return this[nodeSymbol].isParentalNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 是否为叶子节点
|
|
||||||
*/
|
|
||||||
get isLeaf(): boolean {
|
|
||||||
return this[nodeSymbol].isLeafNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为叶子节点
|
* 是否为叶子节点
|
||||||
*/
|
*/
|
||||||
@ -334,24 +262,16 @@ export class Node implements IPublicModelNode {
|
|||||||
if (!node) {
|
if (!node) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// @ts-ignore 直接返回已挂载的 shell node 实例
|
// 直接返回已挂载的 shell node 实例
|
||||||
if (isShellNode(node)) {
|
if (isShellNode(node)) {
|
||||||
return (node as any)[shellNodeSymbol];
|
return (node as any)[shellNodeSymbol];
|
||||||
}
|
}
|
||||||
const shellNode = new Node(node);
|
const shellNode = new Node(node);
|
||||||
// @ts-ignore 挂载 shell node 实例
|
// @ts-expect-error: 挂载 shell node 实例
|
||||||
// eslint-disable-next-line no-param-reassign
|
|
||||||
node[shellNodeSymbol] = shellNode;
|
node[shellNodeSymbol] = shellNode;
|
||||||
return shellNode;
|
return shellNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use .children instead
|
|
||||||
*/
|
|
||||||
getChildren() {
|
|
||||||
return this.children;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取节点实例对应的 dom 节点
|
* 获取节点实例对应的 dom 节点
|
||||||
*/
|
*/
|
||||||
@ -433,13 +353,6 @@ export class Node implements IPublicModelNode {
|
|||||||
this[nodeSymbol].lock(flag);
|
this[nodeSymbol].lock(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use .props instead
|
|
||||||
*/
|
|
||||||
getProps() {
|
|
||||||
return this.props;
|
|
||||||
}
|
|
||||||
|
|
||||||
contains(node: IPublicModelNode): boolean {
|
contains(node: IPublicModelNode): boolean {
|
||||||
return this[nodeSymbol].contains((node as any)[nodeSymbol]);
|
return this[nodeSymbol].contains((node as any)[nodeSymbol]);
|
||||||
}
|
}
|
||||||
@ -600,23 +513,6 @@ export class Node implements IPublicModelNode {
|
|||||||
this[nodeSymbol].remove();
|
this[nodeSymbol].remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 设置为磁贴布局节点
|
|
||||||
*/
|
|
||||||
set isRGLContainer(flag: boolean) {
|
|
||||||
this[nodeSymbol].isRGLContainerNode = flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 获取磁贴布局节点设置状态
|
|
||||||
* @returns Boolean
|
|
||||||
*/
|
|
||||||
get isRGLContainer() {
|
|
||||||
return this[nodeSymbol].isRGLContainerNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置为磁贴布局节点
|
* 设置为磁贴布局节点
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -155,20 +155,6 @@ export class SettingField implements IPublicModelSettingField {
|
|||||||
this[settingFieldSymbol].setKey(key);
|
this[settingFieldSymbol].setKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use .node instead
|
|
||||||
*/
|
|
||||||
getNode() {
|
|
||||||
return this.node;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use .parent instead
|
|
||||||
*/
|
|
||||||
getParent() {
|
|
||||||
return this.parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置值
|
* 设置值
|
||||||
* @param val 值
|
* @param val 值
|
||||||
|
|||||||
@ -31,13 +31,6 @@ export class SettingTopEntry implements IPublicModelSettingTopEntry {
|
|||||||
return SettingField.create(this[settingTopEntrySymbol].get(propName)!);
|
return SettingField.create(this[settingTopEntrySymbol].get(propName)!);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use .node instead
|
|
||||||
*/
|
|
||||||
getNode() {
|
|
||||||
return this.node;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定 propName 的值
|
* 获取指定 propName 的值
|
||||||
* @param propName
|
* @param propName
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { computed, makeObservable, obx, flow } from '@alilc/lowcode-editor-core';
|
import { computed, makeObservable, observable, flow } from '@alilc/lowcode-editor-core';
|
||||||
import {
|
import {
|
||||||
IPublicEditorViewConfig,
|
IPublicEditorViewConfig,
|
||||||
IPublicEnumPluginRegisterLevel,
|
IPublicEnumPluginRegisterLevel,
|
||||||
@ -24,9 +24,9 @@ export class Context extends BasicContext implements IViewContext {
|
|||||||
|
|
||||||
viewType: 'editor' | 'webview';
|
viewType: 'editor' | 'webview';
|
||||||
|
|
||||||
@obx _activate = false;
|
@observable _activate = false;
|
||||||
|
|
||||||
@obx isInit: boolean = false;
|
@observable isInit: boolean = false;
|
||||||
|
|
||||||
init: any = flow(function* (this: Context) {
|
init: any = flow(function* (this: Context) {
|
||||||
if (this.viewType === 'webview') {
|
if (this.viewType === 'webview') {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { uniqueId } from '@alilc/lowcode-utils';
|
import { uniqueId } from '@alilc/lowcode-utils';
|
||||||
import { createModuleEventBus, IEventBus, makeObservable, obx } from '@alilc/lowcode-editor-core';
|
import { createModuleEventBus, IEventBus, makeObservable, observable } from '@alilc/lowcode-editor-core';
|
||||||
import { Context } from './context/view-context';
|
import { Context } from './context/view-context';
|
||||||
import { IWorkspace } from './workspace';
|
import { IWorkspace } from './workspace';
|
||||||
import { IResource } from './resource';
|
import { IResource } from './resource';
|
||||||
@ -38,11 +38,11 @@ export class EditorWindow implements Omit<IPublicModelWindow<IResource>, 'change
|
|||||||
|
|
||||||
url: string | undefined;
|
url: string | undefined;
|
||||||
|
|
||||||
@obx.ref _editorView: Context;
|
@observable.ref _editorView: Context;
|
||||||
|
|
||||||
@obx editorViews: Map<string, Context> = new Map<string, Context>();
|
@observable editorViews: Map<string, Context> = new Map<string, Context>();
|
||||||
|
|
||||||
@obx initReady = false;
|
@observable initReady = false;
|
||||||
|
|
||||||
sleep: boolean | undefined;
|
sleep: boolean | undefined;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { IDesigner, LowCodePluginManager } from '@alilc/lowcode-designer';
|
import { IDesigner, LowCodePluginManager } from '@alilc/lowcode-designer';
|
||||||
import { createModuleEventBus, IEditor, IEventBus, makeObservable, obx } from '@alilc/lowcode-editor-core';
|
import { createModuleEventBus, IEditor, IEventBus, makeObservable, observable } from '@alilc/lowcode-editor-core';
|
||||||
import { IPublicApiPlugins, IPublicApiWorkspace, IPublicEnumPluginRegisterLevel, IPublicResourceList, IPublicTypeDisposable, IPublicTypeResourceType } from '@alilc/lowcode-types';
|
import { IPublicApiPlugins, IPublicApiWorkspace, IPublicEnumPluginRegisterLevel, IPublicResourceList, IPublicTypeDisposable, IPublicTypeResourceType } from '@alilc/lowcode-types';
|
||||||
import { BasicContext } from './context/base-context';
|
import { BasicContext } from './context/base-context';
|
||||||
import { EditorWindow, WINDOW_STATE } from './window';
|
import { EditorWindow, WINDOW_STATE } from './window';
|
||||||
@ -57,11 +57,11 @@ export class Workspace implements Omit<IPublicApiWorkspace<
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref windows: IEditorWindow[] = [];
|
@observable.ref windows: IEditorWindow[] = [];
|
||||||
|
|
||||||
editorWindowMap: Map<string, IEditorWindow> = new Map<string, IEditorWindow>();
|
editorWindowMap: Map<string, IEditorWindow> = new Map<string, IEditorWindow>();
|
||||||
|
|
||||||
@obx.ref window: IEditorWindow;
|
@observable.ref window: IEditorWindow;
|
||||||
|
|
||||||
windowQueue: ({
|
windowQueue: ({
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import React, { createElement, ReactInstance } from 'react';
|
|||||||
import { render as reactRender } from 'react-dom';
|
import { render as reactRender } from 'react-dom';
|
||||||
import { host } from './host';
|
import { host } from './host';
|
||||||
import SimulatorRendererView from './renderer-view';
|
import SimulatorRendererView from './renderer-view';
|
||||||
import { computed, observable as obx, untracked, makeObservable, configure } from 'mobx';
|
import { computed, observable as observable, untracked, makeObservable, configure } from 'mobx';
|
||||||
import { getClientRects } from './utils/get-client-rects';
|
import { getClientRects } from './utils/get-client-rects';
|
||||||
import { reactFindDOMNodes, getReactInternalFiber } from './utils/react-find-dom-nodes';
|
import { reactFindDOMNodes, getReactInternalFiber } from './utils/react-find-dom-nodes';
|
||||||
import {
|
import {
|
||||||
@ -39,7 +39,7 @@ export class DocumentInstance {
|
|||||||
|
|
||||||
private disposeFunctions: Array<() => void> = [];
|
private disposeFunctions: Array<() => void> = [];
|
||||||
|
|
||||||
@obx.ref private _components: any = {};
|
@observable.ref private _components: any = {};
|
||||||
|
|
||||||
@computed get components(): object {
|
@computed get components(): object {
|
||||||
// 根据 device 选择不同组件,进行响应式
|
// 根据 device 选择不同组件,进行响应式
|
||||||
@ -48,31 +48,31 @@ export class DocumentInstance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// context from: utils、constants、history、location、match
|
// context from: utils、constants、history、location、match
|
||||||
@obx.ref private _appContext = {};
|
@observable.ref private _appContext = {};
|
||||||
|
|
||||||
@computed get context(): any {
|
@computed get context(): any {
|
||||||
return this._appContext;
|
return this._appContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _designMode = 'design';
|
@observable.ref private _designMode = 'design';
|
||||||
|
|
||||||
@computed get designMode(): any {
|
@computed get designMode(): any {
|
||||||
return this._designMode;
|
return this._designMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _requestHandlersMap = null;
|
@observable.ref private _requestHandlersMap = null;
|
||||||
|
|
||||||
@computed get requestHandlersMap(): any {
|
@computed get requestHandlersMap(): any {
|
||||||
return this._requestHandlersMap;
|
return this._requestHandlersMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _device = 'default';
|
@observable.ref private _device = 'default';
|
||||||
|
|
||||||
@computed get device() {
|
@computed get device() {
|
||||||
return this._device;
|
return this._device;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.ref private _componentsMap = {};
|
@observable.ref private _componentsMap = {};
|
||||||
|
|
||||||
@computed get componentsMap(): any {
|
@computed get componentsMap(): any {
|
||||||
return this._componentsMap;
|
return this._componentsMap;
|
||||||
@ -188,13 +188,13 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
private disposeFunctions: Array<() => void> = [];
|
private disposeFunctions: Array<() => void> = [];
|
||||||
readonly history: MemoryHistory;
|
readonly history: MemoryHistory;
|
||||||
|
|
||||||
@obx.ref private _documentInstances: DocumentInstance[] = [];
|
@observable.ref private _documentInstances: DocumentInstance[] = [];
|
||||||
private _requestHandlersMap: any;
|
private _requestHandlersMap: any;
|
||||||
get documentInstances() {
|
get documentInstances() {
|
||||||
return this._documentInstances;
|
return this._documentInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx private _layout: any = null;
|
@observable private _layout: any = null;
|
||||||
|
|
||||||
@computed get layout(): any {
|
@computed get layout(): any {
|
||||||
// TODO: parse layout Component
|
// TODO: parse layout Component
|
||||||
@ -215,23 +215,23 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
return this._components || {};
|
return this._components || {};
|
||||||
}
|
}
|
||||||
// context from: utils、constants、history、location、match
|
// context from: utils、constants、history、location、match
|
||||||
@obx.ref private _appContext: any = {};
|
@observable.ref private _appContext: any = {};
|
||||||
@computed get context(): any {
|
@computed get context(): any {
|
||||||
return this._appContext;
|
return this._appContext;
|
||||||
}
|
}
|
||||||
@obx.ref private _designMode: string = 'design';
|
@observable.ref private _designMode: string = 'design';
|
||||||
@computed get designMode(): any {
|
@computed get designMode(): any {
|
||||||
return this._designMode;
|
return this._designMode;
|
||||||
}
|
}
|
||||||
@obx.ref private _device: string = 'default';
|
@observable.ref private _device: string = 'default';
|
||||||
@computed get device() {
|
@computed get device() {
|
||||||
return this._device;
|
return this._device;
|
||||||
}
|
}
|
||||||
@obx.ref private _locale: string | undefined = undefined;
|
@observable.ref private _locale: string | undefined = undefined;
|
||||||
@computed get locale() {
|
@computed get locale() {
|
||||||
return this._locale;
|
return this._locale;
|
||||||
}
|
}
|
||||||
@obx.ref private _componentsMap = {};
|
@observable.ref private _componentsMap = {};
|
||||||
@computed get componentsMap(): any {
|
@computed get componentsMap(): any {
|
||||||
return this._componentsMap;
|
return this._componentsMap;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import { IPublicTypeNodeSchema } from './shell';
|
import { IPublicTypeNodeSchema } from './shell';
|
||||||
|
|
||||||
export enum ActivityType {
|
export enum ActivityType {
|
||||||
'ADDED' = 'added',
|
ADDED = 'added',
|
||||||
'DELETED' = 'deleted',
|
DELETED = 'deleted',
|
||||||
'MODIFIED' = 'modified',
|
MODIFIED = 'modified',
|
||||||
'COMPOSITE' = 'composite',
|
COMPOSITE = 'composite',
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IActivityPayload {
|
interface IActivityPayload {
|
||||||
@ -19,12 +19,3 @@ interface IActivityPayload {
|
|||||||
oldValue: any;
|
oldValue: any;
|
||||||
newValue: any;
|
newValue: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: not sure if this is used anywhere
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
export type ActivityData = {
|
|
||||||
type: ActivityType;
|
|
||||||
payload: IActivityPayload;
|
|
||||||
};
|
|
||||||
|
|||||||
@ -31,9 +31,4 @@ export interface IPublicApiSetters {
|
|||||||
typeOrMaps: string | { [key: string]: IPublicTypeCustomView | IPublicTypeRegisteredSetter },
|
typeOrMaps: string | { [key: string]: IPublicTypeCustomView | IPublicTypeRegisteredSetter },
|
||||||
setter?: IPublicTypeCustomView | IPublicTypeRegisteredSetter | undefined
|
setter?: IPublicTypeCustomView | IPublicTypeRegisteredSetter | undefined
|
||||||
): void;
|
): void;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
createSetterContent (setter: any, props: Record<string, any>): ReactNode;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,30 +39,12 @@ export interface IPublicApiWorkspace<
|
|||||||
/** 注册资源 */
|
/** 注册资源 */
|
||||||
registerResourceType(resourceTypeModel: IPublicTypeResourceType): void;
|
registerResourceType(resourceTypeModel: IPublicTypeResourceType): void;
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开视图窗口
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
openEditorWindow(
|
|
||||||
resourceName: string,
|
|
||||||
id: string,
|
|
||||||
extra: Object,
|
|
||||||
viewName?: string,
|
|
||||||
sleep?: boolean,
|
|
||||||
): Promise<void>;
|
|
||||||
|
|
||||||
/** 打开视图窗口 */
|
/** 打开视图窗口 */
|
||||||
openEditorWindow(resource: Resource, sleep?: boolean): Promise<void>;
|
openEditorWindow(resource: Resource, sleep?: boolean): Promise<void>;
|
||||||
|
|
||||||
/** 通过视图 id 打开窗口 */
|
/** 通过视图 id 打开窗口 */
|
||||||
openEditorWindowById(id: string): void;
|
openEditorWindowById(id: string): void;
|
||||||
|
|
||||||
/**
|
|
||||||
* 移除视图窗口
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
removeEditorWindow(resourceName: string, id: string): void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除视图窗口
|
* 移除视图窗口
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,14 +1,4 @@
|
|||||||
// eslint-disable-next-line no-shadow
|
|
||||||
export enum IPublicEnumDragObjectType {
|
export enum IPublicEnumDragObjectType {
|
||||||
// eslint-disable-next-line no-shadow
|
|
||||||
Node = 'node',
|
Node = 'node',
|
||||||
NodeData = 'nodedata',
|
NodeData = 'nodedata',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use IPublicEnumDragObjectType instead
|
|
||||||
*/
|
|
||||||
export enum DragObjectType {
|
|
||||||
Node = IPublicEnumDragObjectType.Node,
|
|
||||||
NodeData = IPublicEnumDragObjectType.NodeData,
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// eslint-disable-next-line no-shadow
|
|
||||||
export enum IPublicEnumPropValueChangedType {
|
export enum IPublicEnumPropValueChangedType {
|
||||||
/**
|
/**
|
||||||
* normal set value
|
* normal set value
|
||||||
@ -9,17 +8,3 @@ export enum IPublicEnumPropValueChangedType {
|
|||||||
*/
|
*/
|
||||||
SUB_VALUE_CHANGE = 'SUB_VALUE_CHANGE'
|
SUB_VALUE_CHANGE = 'SUB_VALUE_CHANGE'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use IPublicEnumPropValueChangedType
|
|
||||||
*/
|
|
||||||
export enum PROP_VALUE_CHANGED_TYPE {
|
|
||||||
/**
|
|
||||||
* normal set value
|
|
||||||
*/
|
|
||||||
SET_VALUE = 'SET_VALUE',
|
|
||||||
/**
|
|
||||||
* value changed caused by sub-prop value change
|
|
||||||
*/
|
|
||||||
SUB_VALUE_CHANGE = 'SUB_VALUE_CHANGE'
|
|
||||||
}
|
|
||||||
|
|||||||
@ -6,14 +6,3 @@ export enum IPublicEnumTransformStage {
|
|||||||
Init = 'init',
|
Init = 'init',
|
||||||
Upgrade = 'upgrade',
|
Upgrade = 'upgrade',
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @deprecated use IPublicEnumTransformStage instead
|
|
||||||
*/
|
|
||||||
export enum TransformStage {
|
|
||||||
Render = 'render',
|
|
||||||
Serilize = 'serilize',
|
|
||||||
Save = 'save',
|
|
||||||
Clone = 'clone',
|
|
||||||
Init = 'init',
|
|
||||||
Upgrade = 'upgrade',
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,13 +1,4 @@
|
|||||||
// eslint-disable-next-line no-shadow
|
|
||||||
export const enum IPublicEnumTransitionType {
|
export const enum IPublicEnumTransitionType {
|
||||||
/** 节点更新后重绘处理 */
|
/** 节点更新后重绘处理 */
|
||||||
REPAINT,
|
REPAINT,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use IPublicEnumTransitionType instead
|
|
||||||
*/
|
|
||||||
export const enum TransitionType {
|
|
||||||
/** 节点更新后重绘处理 */
|
|
||||||
REPAINT,
|
|
||||||
}
|
|
||||||
|
|||||||
@ -12,7 +12,6 @@ export * from './node';
|
|||||||
export * from './prop';
|
export * from './prop';
|
||||||
export * from './props';
|
export * from './props';
|
||||||
export * from './selection';
|
export * from './selection';
|
||||||
export * from './setting-prop-entry';
|
|
||||||
export * from './setting-top-entry';
|
export * from './setting-top-entry';
|
||||||
export * from '../type/plugin';
|
export * from '../type/plugin';
|
||||||
export * from './window';
|
export * from './window';
|
||||||
@ -21,7 +20,6 @@ export * from './scroller';
|
|||||||
export * from './active-tracker';
|
export * from './active-tracker';
|
||||||
export * from './exclusive-group';
|
export * from './exclusive-group';
|
||||||
export * from './plugin-context';
|
export * from './plugin-context';
|
||||||
export * from './setting-target';
|
|
||||||
export * from './engine-config';
|
export * from './engine-config';
|
||||||
export * from './editor';
|
export * from './editor';
|
||||||
export * from './preference';
|
export * from './preference';
|
||||||
|
|||||||
@ -18,13 +18,6 @@ export interface IPublicModelNodeChildren<
|
|||||||
*/
|
*/
|
||||||
get size(): number;
|
get size(): number;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use isEmptyNode
|
|
||||||
* 是否为空
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
get isEmpty(): boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为空
|
* 是否为空
|
||||||
*
|
*
|
||||||
@ -32,12 +25,6 @@ export interface IPublicModelNodeChildren<
|
|||||||
*/
|
*/
|
||||||
get isEmptyNode(): boolean;
|
get isEmptyNode(): boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use notEmptyNode
|
|
||||||
* judge if it is not empty
|
|
||||||
*/
|
|
||||||
get notEmpty(): boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* judge if it is not empty
|
* judge if it is not empty
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -26,11 +26,6 @@ export interface IBaseModelNode<
|
|||||||
*/
|
*/
|
||||||
get title(): string | IPublicTypeI18nData | ReactElement;
|
get title(): string | IPublicTypeI18nData | ReactElement;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use isContainerNode
|
|
||||||
*/
|
|
||||||
get isContainer(): boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为「容器型」节点
|
* 是否为「容器型」节点
|
||||||
* check if node is a container type node
|
* check if node is a container type node
|
||||||
@ -38,11 +33,6 @@ export interface IBaseModelNode<
|
|||||||
*/
|
*/
|
||||||
get isContainerNode(): boolean;
|
get isContainerNode(): boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use isRootNode
|
|
||||||
*/
|
|
||||||
get isRoot(): boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为根节点
|
* 是否为根节点
|
||||||
* check if node is root in the tree
|
* check if node is root in the tree
|
||||||
@ -50,11 +40,6 @@ export interface IBaseModelNode<
|
|||||||
*/
|
*/
|
||||||
get isRootNode(): boolean;
|
get isRootNode(): boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use isEmptyNode
|
|
||||||
*/
|
|
||||||
get isEmpty(): boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为空节点(无 children 或者 children 为空)
|
* 是否为空节点(无 children 或者 children 为空)
|
||||||
* check if current node is empty, which means no children or children is empty
|
* check if current node is empty, which means no children or children is empty
|
||||||
@ -62,12 +47,6 @@ export interface IBaseModelNode<
|
|||||||
*/
|
*/
|
||||||
get isEmptyNode(): boolean;
|
get isEmptyNode(): boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use isPageNode
|
|
||||||
* 是否为 Page 节点
|
|
||||||
*/
|
|
||||||
get isPage(): boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为 Page 节点
|
* 是否为 Page 节点
|
||||||
* check if node is Page
|
* check if node is Page
|
||||||
@ -75,11 +54,6 @@ export interface IBaseModelNode<
|
|||||||
*/
|
*/
|
||||||
get isPageNode(): boolean;
|
get isPageNode(): boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use isComponentNode
|
|
||||||
*/
|
|
||||||
get isComponent(): boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为 Component 节点
|
* 是否为 Component 节点
|
||||||
* check if node is Component
|
* check if node is Component
|
||||||
@ -87,11 +61,6 @@ export interface IBaseModelNode<
|
|||||||
*/
|
*/
|
||||||
get isComponentNode(): boolean;
|
get isComponentNode(): boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use isModalNode
|
|
||||||
*/
|
|
||||||
get isModal(): boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为「模态框」节点
|
* 是否为「模态框」节点
|
||||||
* check if node is Modal
|
* check if node is Modal
|
||||||
@ -99,11 +68,6 @@ export interface IBaseModelNode<
|
|||||||
*/
|
*/
|
||||||
get isModalNode(): boolean;
|
get isModalNode(): boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use isSlotNode
|
|
||||||
*/
|
|
||||||
get isSlot(): boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为插槽节点
|
* 是否为插槽节点
|
||||||
* check if node is a Slot
|
* check if node is a Slot
|
||||||
@ -111,11 +75,6 @@ export interface IBaseModelNode<
|
|||||||
*/
|
*/
|
||||||
get isSlotNode(): boolean;
|
get isSlotNode(): boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use isParentalNode
|
|
||||||
*/
|
|
||||||
get isParental(): boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为父类/分支节点
|
* 是否为父类/分支节点
|
||||||
* check if node a parental node
|
* check if node a parental node
|
||||||
@ -123,11 +82,6 @@ export interface IBaseModelNode<
|
|||||||
*/
|
*/
|
||||||
get isParentalNode(): boolean;
|
get isParentalNode(): boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use isLeafNode
|
|
||||||
*/
|
|
||||||
get isLeaf(): boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为叶子节点
|
* 是否为叶子节点
|
||||||
* check if node is a leaf node in tree
|
* check if node is a leaf node in tree
|
||||||
@ -142,17 +96,6 @@ export interface IBaseModelNode<
|
|||||||
*/
|
*/
|
||||||
get isLocked(): boolean;
|
get isLocked(): boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use isRGLContainerNode
|
|
||||||
*/
|
|
||||||
set isRGLContainer(flag: boolean);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use isRGLContainerNode
|
|
||||||
* @returns Boolean
|
|
||||||
*/
|
|
||||||
get isRGLContainer();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置为磁贴布局节点
|
* 设置为磁贴布局节点
|
||||||
* @since v1.1.0
|
* @since v1.1.0
|
||||||
|
|||||||
@ -122,10 +122,3 @@ export interface IPublicModelPluginContext {
|
|||||||
|
|
||||||
get editorWindow(): IPublicModelWindow;
|
get editorWindow(): IPublicModelWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use IPublicModelPluginContext instead
|
|
||||||
*/
|
|
||||||
export interface ILowCodePluginContext extends IPublicModelPluginContext {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
import { IPublicModelSettingField } from './';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use IPublicModelSettingField
|
|
||||||
*/
|
|
||||||
export type IPublicModelSettingPropEntry = IPublicModelSettingField;
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
import { IPublicModelSettingField } from './';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use IPublicModelSettingField
|
|
||||||
*/
|
|
||||||
export type IPublicModelSettingTarget = IPublicModelSettingField;
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { ComponentType, ReactElement } from 'react';
|
import { ComponentType, ReactElement } from 'react';
|
||||||
import { IPublicTypeNodeData, IPublicTypeSnippet, IPublicTypeInitialItem, IPublicTypeFilterItem, IPublicTypeAutorunItem, IPublicTypeCallbacks, IPublicTypeLiveTextEditingConfig } from './';
|
import { IPublicTypeNodeData, IPublicTypeSnippet, IPublicTypeInitialItem, IPublicTypeCallbacks, IPublicTypeLiveTextEditingConfig } from './';
|
||||||
import { IPublicModelNode, IPublicModelSettingField } from '../model';
|
import { IPublicModelNode } from '../model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 高级特性配置
|
* 高级特性配置
|
||||||
@ -39,16 +39,6 @@ export interface IPublicTypeAdvanced {
|
|||||||
}> |
|
}> |
|
||||||
ReactElement[]);
|
ReactElement[]);
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated 用于动态初始化拖拽到设计器里的组件的 prop 的值
|
|
||||||
*/
|
|
||||||
initials?: IPublicTypeInitialItem[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated 使用组件 metadata 上的 snippets 字段即可
|
|
||||||
*/
|
|
||||||
snippets?: IPublicTypeSnippet[];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否绝对布局容器,还未进入协议
|
* 是否绝对布局容器,还未进入协议
|
||||||
* @experimental not in spec yet
|
* @experimental not in spec yet
|
||||||
@ -72,34 +62,4 @@ export interface IPublicTypeAdvanced {
|
|||||||
* @experimental not in spec yet
|
* @experimental not in spec yet
|
||||||
*/
|
*/
|
||||||
view?: ComponentType<any>;
|
view?: ComponentType<any>;
|
||||||
|
|
||||||
/**
|
|
||||||
* @legacy capability for vision
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
isTopFixed?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: 补充文档 或 删除
|
|
||||||
* @deprecated not used anywhere, dont know what is it for
|
|
||||||
*/
|
|
||||||
context?: { [contextInfoName: string]: any };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @legacy capability for vision
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
filters?: IPublicTypeFilterItem[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @legacy capability for vision
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
autoruns?: IPublicTypeAutorunItem[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @legacy capability for vision
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
transducers?: any;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,16 +17,6 @@ export interface IPublicTypeAssetsJson {
|
|||||||
* 所有组件的描述协议列表所有组件的列表
|
* 所有组件的描述协议列表所有组件的列表
|
||||||
*/
|
*/
|
||||||
components: Array<IPublicTypeComponentDescription | IPublicTypeRemoteComponentDescription>;
|
components: Array<IPublicTypeComponentDescription | IPublicTypeRemoteComponentDescription>;
|
||||||
/**
|
|
||||||
* 组件分类列表,用来描述物料面板
|
|
||||||
* @deprecated 最新版物料面板已不需要此描述
|
|
||||||
*/
|
|
||||||
componentList?: any[];
|
|
||||||
/**
|
|
||||||
* 业务组件分类列表,用来描述物料面板
|
|
||||||
* @deprecated 最新版物料面板已不需要此描述
|
|
||||||
*/
|
|
||||||
bizComponentList?: any[];
|
|
||||||
/**
|
/**
|
||||||
* 用于描述组件面板中的 tab 和 category
|
* 用于描述组件面板中的 tab 和 category
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { IPublicTypeIconType, IPublicTypeNpmInfo, IPublicTypeFieldConfig, IPublicTypeI18nData, IPublicTypeComponentSchema, IPublicTypeTitleContent, IPublicTypePropConfig, IPublicTypeConfigure, IPublicTypeAdvanced, IPublicTypeSnippet } from './';
|
import { IPublicTypeIconType, IPublicTypeNpmInfo, IPublicTypeFieldConfig, IPublicTypeI18nData, IPublicTypeComponentSchema, IPublicTypeTitleContent, IPublicTypePropConfig, IPublicTypeConfigure, IPublicTypeSnippet } from './';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组件 meta 配置
|
* 组件 meta 配置
|
||||||
@ -69,11 +69,6 @@ export interface IPublicTypeComponentMetadata {
|
|||||||
*/
|
*/
|
||||||
configure?: IPublicTypeFieldConfig[] | IPublicTypeConfigure;
|
configure?: IPublicTypeFieldConfig[] | IPublicTypeConfigure;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated, use advanced instead
|
|
||||||
*/
|
|
||||||
experimental?: IPublicTypeAdvanced;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo 待补充文档
|
* @todo 待补充文档
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -122,17 +122,6 @@ export interface IPublicTypeEngineOptions {
|
|||||||
*/
|
*/
|
||||||
simulatorUrl?: string[];
|
simulatorUrl?: string[];
|
||||||
|
|
||||||
/**
|
|
||||||
* Vision-polyfill settings
|
|
||||||
* @deprecated this exists for some legacy reasons
|
|
||||||
*/
|
|
||||||
visionSettings?: {
|
|
||||||
// 是否禁用降级 reducer,默认值:false
|
|
||||||
disableCompatibleReducer?: boolean;
|
|
||||||
// 是否开启在 render 阶段开启 filter reducer,默认值:false
|
|
||||||
enableFilterReducerInRenderStage?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 与 react-renderer 的 appHelper 一致,https://lowcode-engine.cn/site/docs/guide/expand/runtime/renderer#apphelper
|
* 与 react-renderer 的 appHelper 一致,https://lowcode-engine.cn/site/docs/guide/expand/runtime/renderer#apphelper
|
||||||
*/
|
*/
|
||||||
@ -190,10 +179,3 @@ export interface IPublicTypeEngineOptions {
|
|||||||
*/
|
*/
|
||||||
hideComponentAction?: boolean;
|
hideComponentAction?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use IPublicTypeEngineOptions instead
|
|
||||||
*/
|
|
||||||
export interface EngineOptions {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@ -38,14 +38,4 @@ export interface IPublicTypeFieldConfig extends IPublicTypeFieldExtraProps {
|
|||||||
* 其他配置属性(不做流通要求)
|
* 其他配置属性(不做流通要求)
|
||||||
*/
|
*/
|
||||||
extraProps?: IPublicTypeFieldExtraProps;
|
extraProps?: IPublicTypeFieldExtraProps;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
description?: IPublicTypeTitleContent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
isExtends?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,19 +1,10 @@
|
|||||||
import { IPublicModelNode, IPublicModelLocateEvent } from '../model';
|
import { IPublicModelNode, IPublicModelLocateEvent } from '../model';
|
||||||
|
|
||||||
// eslint-disable-next-line no-shadow
|
|
||||||
export enum IPublicTypeLocationDetailType {
|
export enum IPublicTypeLocationDetailType {
|
||||||
Children = 'Children',
|
Children = 'Children',
|
||||||
Prop = 'Prop',
|
Prop = 'Prop',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated please use IPublicTypeLocationDetailType
|
|
||||||
*/
|
|
||||||
export enum LocationDetailType {
|
|
||||||
Children = 'Children',
|
|
||||||
Prop = 'Prop',
|
|
||||||
}
|
|
||||||
|
|
||||||
export type IPublicTypeRect = DOMRect & {
|
export type IPublicTypeRect = DOMRect & {
|
||||||
elements?: Array<Element | Text>;
|
elements?: Array<Element | Text>;
|
||||||
computed?: boolean;
|
computed?: boolean;
|
||||||
|
|||||||
@ -20,8 +20,4 @@ export interface IPublicTypePropConfig {
|
|||||||
* 属性默认值
|
* 属性默认值
|
||||||
*/
|
*/
|
||||||
defaultValue?: any;
|
defaultValue?: any;
|
||||||
/**
|
|
||||||
* @deprecated 已被弃用
|
|
||||||
*/
|
|
||||||
setter?: any;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,12 +9,6 @@ export interface IPublicResourceTypeConfig {
|
|||||||
/** 资源 icon 标识 */
|
/** 资源 icon 标识 */
|
||||||
icon?: React.ReactElement | React.FunctionComponent | React.ComponentClass;
|
icon?: React.ReactElement | React.FunctionComponent | React.ComponentClass;
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认视图类型
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
defaultViewType?: string;
|
|
||||||
|
|
||||||
/** 默认视图类型 */
|
/** 默认视图类型 */
|
||||||
defaultViewName: string;
|
defaultViewName: string;
|
||||||
|
|
||||||
|
|||||||
@ -19,11 +19,6 @@ export interface IPublicTypeSetterConfig {
|
|||||||
*/
|
*/
|
||||||
props?: Record<string, unknown> | IPublicTypeDynamicProps;
|
props?: Record<string, unknown> | IPublicTypeDynamicProps;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
children?: any;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否必填?
|
* 是否必填?
|
||||||
*
|
*
|
||||||
|
|||||||
@ -14,12 +14,6 @@ export interface IPublicTypeSnippet {
|
|||||||
* snippet 截图
|
* snippet 截图
|
||||||
*/
|
*/
|
||||||
screenshot?: string;
|
screenshot?: string;
|
||||||
/**
|
|
||||||
* snippet 打标
|
|
||||||
*
|
|
||||||
* @deprecated 暂未使用
|
|
||||||
*/
|
|
||||||
label?: string;
|
|
||||||
/**
|
/**
|
||||||
* 待插入的 schema
|
* 待插入的 schema
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -104,16 +104,6 @@ export interface IPublicTypeJSSlot {
|
|||||||
name?: string;
|
name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*
|
|
||||||
* @todo 待文档描述
|
|
||||||
*/
|
|
||||||
export interface IPublicTypeJSBlock {
|
|
||||||
type: 'JSBlock';
|
|
||||||
value: IPublicTypeNodeSchema;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSON 基本类型
|
* JSON 基本类型
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -11,6 +11,10 @@
|
|||||||
"import": "./dist/low-code-utils.js",
|
"import": "./dist/low-code-utils.js",
|
||||||
"types": "./dist/index.d.ts"
|
"types": "./dist/index.d.ts"
|
||||||
},
|
},
|
||||||
|
"./dist/style.css": {
|
||||||
|
"import": "./dist/style.css",
|
||||||
|
"require": "./dist/style.css"
|
||||||
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
},
|
},
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
|
|||||||
@ -121,46 +121,3 @@ function getNodeSchemaFromPropsById(props: any, nodeId: string): IPublicTypeNode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: not sure if this is used anywhere
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
export function applyActivities(
|
|
||||||
pivotSchema: IPublicTypeRootSchema,
|
|
||||||
activities: any,
|
|
||||||
): IPublicTypeRootSchema {
|
|
||||||
const schema = { ...pivotSchema };
|
|
||||||
if (!Array.isArray(activities)) {
|
|
||||||
activities = [activities];
|
|
||||||
}
|
|
||||||
return activities.reduce((accSchema: IPublicTypeRootSchema, activity: any) => {
|
|
||||||
if (activity.type === ActivityType.MODIFIED) {
|
|
||||||
const found = getNodeSchemaById(accSchema, activity.payload.schema.id);
|
|
||||||
if (!found) return accSchema;
|
|
||||||
Object.assign(found, activity.payload.schema);
|
|
||||||
} else if (activity.type === ActivityType.ADDED) {
|
|
||||||
const { payload } = activity;
|
|
||||||
const { location, schema } = payload;
|
|
||||||
const { parent } = location;
|
|
||||||
const found = getNodeSchemaById(accSchema, parent.nodeId);
|
|
||||||
if (found) {
|
|
||||||
if (Array.isArray(found.children)) {
|
|
||||||
found.children.splice(parent.index, 0, schema);
|
|
||||||
} else if (!found.children) {
|
|
||||||
found.children = [schema];
|
|
||||||
}
|
|
||||||
// TODO: 是 JSExpression / DOMText
|
|
||||||
}
|
|
||||||
} else if (activity.type === ActivityType.DELETED) {
|
|
||||||
const { payload } = activity;
|
|
||||||
const { location } = payload;
|
|
||||||
const { parent } = location;
|
|
||||||
const found = getNodeSchemaById(accSchema, parent.nodeId);
|
|
||||||
if (found && Array.isArray(found.children)) {
|
|
||||||
found.children.splice(parent.index, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return accSchema;
|
|
||||||
}, schema);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
compatibleLegaoSchema,
|
compatibleLegaoSchema,
|
||||||
getNodeSchemaById,
|
getNodeSchemaById,
|
||||||
applyActivities,
|
|
||||||
} from '../../src/schema';
|
} from '../../src/schema';
|
||||||
import { ActivityType } from '@alilc/lowcode-types';
|
|
||||||
|
|
||||||
describe('compatibleLegaoSchema', () => {
|
describe('compatibleLegaoSchema', () => {
|
||||||
it('should handle null input', () => {
|
it('should handle null input', () => {
|
||||||
@ -66,67 +64,6 @@ describe('getNodeSchemaById', () => {
|
|||||||
// Add more test cases for other scenarios
|
// Add more test cases for other scenarios
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('applyActivities', () => {
|
|
||||||
it('should apply ADD activity', () => {
|
|
||||||
// Create your test schema and activities
|
|
||||||
const testSchema = {
|
|
||||||
id: 'root',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
id: 'child1',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
id: 'child1.1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const activities = [
|
|
||||||
{
|
|
||||||
type: ActivityType.ADDED,
|
|
||||||
payload: {
|
|
||||||
location: {
|
|
||||||
parent: {
|
|
||||||
nodeId: 'child1',
|
|
||||||
index: 0,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
schema: {
|
|
||||||
id: 'newChild',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const result = applyActivities(testSchema, activities);
|
|
||||||
|
|
||||||
// Define the expected output
|
|
||||||
const expectedOutput = {
|
|
||||||
id: 'root',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
id: 'child1',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
id: 'newChild',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'child1.1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
// Assert that the result matches the expected output
|
|
||||||
expect(result).toEqual(expectedOutput);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add more test cases for other activity types and scenarios
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
describe('Schema Ut', () => {
|
describe('Schema Ut', () => {
|
||||||
it('props', () => {
|
it('props', () => {
|
||||||
const schema = {
|
const schema = {
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-types": "workspace:*",
|
"@alilc/lowcode-types": "workspace:*",
|
||||||
"@alilc/lowcode-engine": "workspace:*",
|
"@alilc/lowcode-engine": "workspace:*",
|
||||||
|
"@alilc/lowcode-react-simulator-renderer": "workspace:*",
|
||||||
"@alilc/lowcode-react-renderer": "workspace:*",
|
"@alilc/lowcode-react-renderer": "workspace:*",
|
||||||
"@alifd/next": "^1.27.10",
|
"@alifd/next": "^1.27.10",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user