mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-03 07:47:18 +00:00
fix: remove @deprecated apis
This commit is contained in:
parent
1ec54e0a5f
commit
0831277dc0
@ -94,12 +94,6 @@ setResourceList(resourceList: IPublicResourceList) {}
|
||||
打开视图窗口
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* 打开视图窗口
|
||||
* @deprecated
|
||||
*/
|
||||
openEditorWindow(resourceName: string, id: string, extra: Object, viewName?: string, sleep?: boolean): Promise<void>;
|
||||
|
||||
/** 打开视图窗口 */
|
||||
openEditorWindow(resource: Resource, sleep?: boolean): Promise<void>;
|
||||
```
|
||||
@ -117,12 +111,6 @@ openEditorWindowById(id: string): void;
|
||||
移除视图窗口
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* 移除视图窗口
|
||||
* @deprecated
|
||||
*/
|
||||
removeEditorWindow(resourceName: string, id: string): void;
|
||||
|
||||
/**
|
||||
* 移除视图窗口
|
||||
*/
|
||||
|
||||
@ -1151,12 +1151,6 @@ export interface Snippet {
|
||||
* snippet 截图
|
||||
*/
|
||||
screenshot?: string;
|
||||
/**
|
||||
* snippet 打标
|
||||
*
|
||||
* @deprecated 暂未使用
|
||||
*/
|
||||
label?: string;
|
||||
/**
|
||||
* 待插入的 schema
|
||||
*/
|
||||
|
||||
@ -56,7 +56,6 @@ export default {
|
||||
},
|
||||
plugins: {
|
||||
common: {
|
||||
|
||||
/**
|
||||
* 处理 ES Module
|
||||
* @deprecated please use esModule
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import {
|
||||
obx,
|
||||
observable,
|
||||
autorun,
|
||||
reaction,
|
||||
computed,
|
||||
@ -12,6 +12,7 @@ import {
|
||||
makeObservable,
|
||||
createModuleEventBus,
|
||||
IEventBus,
|
||||
action,
|
||||
} from '@alilc/lowcode-editor-core';
|
||||
|
||||
import { ISimulatorHost, Component, DropContainer } from '../simulator';
|
||||
@ -228,17 +229,17 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
return this.get('deviceStyle');
|
||||
}
|
||||
|
||||
@obx.ref _props: BuiltinSimulatorProps = {};
|
||||
@observable.ref _props: BuiltinSimulatorProps = {};
|
||||
|
||||
@obx.ref private _contentWindow?: Window;
|
||||
@observable.ref private _contentWindow?: Window;
|
||||
|
||||
get 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() {
|
||||
return this._contentDocument;
|
||||
@ -262,7 +263,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
|
||||
readonly liveEditing = new LiveEditing();
|
||||
|
||||
@obx private instancesMap: {
|
||||
@observable private instancesMap: {
|
||||
[docId: string]: Map<string, IPublicTypeComponentInstance[]>;
|
||||
} = {};
|
||||
|
||||
@ -322,10 +323,12 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
/**
|
||||
* @see ISimulator
|
||||
*/
|
||||
@action
|
||||
setProps(props: BuiltinSimulatorProps) {
|
||||
this._props = props;
|
||||
}
|
||||
|
||||
@action
|
||||
set(key: string, value: any) {
|
||||
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 { INode, Prop } from '../../document';
|
||||
|
||||
@ -45,7 +45,7 @@ export class LiveEditing {
|
||||
static addLiveEditingSaveHandler = addLiveEditingSaveHandler;
|
||||
static clearLiveEditingSaveHandler = clearLiveEditingSaveHandler;
|
||||
|
||||
@obx.ref private _editing: Prop | null = null;
|
||||
@observable.ref private _editing: Prop | null = null;
|
||||
|
||||
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 { BuiltinSimulatorRenderer, isSimulatorRenderer } from './renderer';
|
||||
|
||||
@ -21,7 +21,7 @@ export type RendererConsumer<T> = (renderer: BuiltinSimulatorRenderer, data: T)
|
||||
export default class ResourceConsumer<T = any> {
|
||||
private emitter: IEventBus = createModuleEventBus('ResourceConsumer');
|
||||
|
||||
@obx.ref private _data: T | typeof UNSET = UNSET;
|
||||
@observable.ref private _data: T | typeof UNSET = UNSET;
|
||||
|
||||
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 { AutoFit, IViewport } from '../simulator';
|
||||
|
||||
export default class Viewport implements IViewport {
|
||||
@obx.ref private rect?: DOMRect;
|
||||
@observable.ref private rect?: 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;
|
||||
}
|
||||
|
||||
@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 {
|
||||
return this._contentHeight;
|
||||
@ -112,9 +112,9 @@ export default class Viewport implements IViewport {
|
||||
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() {
|
||||
return this._scrollX;
|
||||
@ -133,12 +133,13 @@ export default class Viewport implements IViewport {
|
||||
return this._scrollTarget;
|
||||
}
|
||||
|
||||
@obx private _scrolling = false;
|
||||
@observable private _scrolling = false;
|
||||
|
||||
get scrolling(): boolean {
|
||||
return this._scrolling;
|
||||
}
|
||||
|
||||
@action
|
||||
setScrollTarget(target: Window) {
|
||||
const scrollTarget = new ScrollTarget(target);
|
||||
this._scrollX = scrollTarget.left;
|
||||
|
||||
@ -174,12 +174,6 @@ export class ComponentMeta implements IComponentMeta {
|
||||
return this.getMetadata().configure.advanced || {};
|
||||
}
|
||||
|
||||
/**
|
||||
* @legacy compatiable for vision
|
||||
* @deprecated
|
||||
*/
|
||||
prototype?: any;
|
||||
|
||||
constructor(
|
||||
readonly designer: Designer,
|
||||
metadata: IPublicTypeComponentMetadata,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
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 { isNode } from '@alilc/lowcode-utils';
|
||||
|
||||
@ -17,7 +17,7 @@ export interface ActiveTarget extends Omit<IPublicTypeActiveTarget, 'node'> {
|
||||
|
||||
// @ts-ignore
|
||||
export class ActiveTracker implements IActiveTracker {
|
||||
@obx.ref private _target?: ActiveTarget | INode;
|
||||
@observable.ref private _target?: ActiveTarget | INode;
|
||||
|
||||
private emitter: IEventBus = createModuleEventBus('ActiveTracker');
|
||||
|
||||
@ -38,14 +38,6 @@ export class ActiveTracker implements IActiveTracker {
|
||||
return (this._target as ActiveTarget)?.detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
/* istanbul ignore next */
|
||||
get intance() {
|
||||
return this.instance;
|
||||
}
|
||||
|
||||
get instance() {
|
||||
return (this._target as ActiveTarget)?.instance;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
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 {
|
||||
IPublicTypeProjectSchema,
|
||||
IPublicTypeComponentMetadata,
|
||||
@ -93,13 +93,13 @@ export class Designer {
|
||||
|
||||
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() {
|
||||
return this.project.currentDocument;
|
||||
@ -309,48 +309,6 @@ export class Designer {
|
||||
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) {
|
||||
const props = this.props ? { ...this.props, ...nextProps } : nextProps;
|
||||
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 type { IDocumentModel } from '../document/document-model';
|
||||
import type { INode } from '../document/node/node';
|
||||
@ -19,7 +19,7 @@ export interface IDetecting extends Omit<IPublicModelDetecting<INode>,
|
||||
}
|
||||
|
||||
export class Detecting implements IDetecting {
|
||||
@obx.ref private _enable = true;
|
||||
@observable.ref private _enable = true;
|
||||
|
||||
/**
|
||||
* 控制大纲树 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');
|
||||
|
||||
@ -50,6 +50,7 @@ export class Detecting implements IDetecting {
|
||||
return this._current;
|
||||
}
|
||||
|
||||
@action
|
||||
capture(node: INode | null) {
|
||||
if (this._current !== node) {
|
||||
this._current = node;
|
||||
@ -57,6 +58,7 @@ export class Detecting implements IDetecting {
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
release(node: INode | null) {
|
||||
if (this._current === node) {
|
||||
this._current = null;
|
||||
@ -64,6 +66,7 @@ export class Detecting implements IDetecting {
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
leave(document: IDocumentModel | undefined) {
|
||||
if (this.current && this.current.document === document) {
|
||||
this._current = null;
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
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 { isDragNodeObject } from '../dragon';
|
||||
import { isSimulatorHost } from '../../simulator';
|
||||
import './ghost.less';
|
||||
import {
|
||||
@ -9,6 +8,7 @@ import {
|
||||
IPublicTypeNodeSchema,
|
||||
IPublicModelDragObject,
|
||||
} from '@alilc/lowcode-types';
|
||||
import { isDragNodeObject } from '@alilc/lowcode-utils';
|
||||
|
||||
type offBinding = () => any;
|
||||
|
||||
@ -16,13 +16,13 @@ type offBinding = () => any;
|
||||
export default class DragGhost extends Component<{ designer: Designer }> {
|
||||
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;
|
||||
|
||||
|
||||
@ -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 {
|
||||
IPublicTypeDragNodeObject,
|
||||
IPublicTypeDragAnyObject,
|
||||
IPublicEnumDragObjectType,
|
||||
IPublicTypeDragNodeDataObject,
|
||||
IPublicModelDragObject,
|
||||
IPublicModelNode,
|
||||
IPublicModelDragon,
|
||||
IPublicModelLocateEvent,
|
||||
IPublicModelSensor,
|
||||
} 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 { ISimulatorHost, isSimulatorHost } from '../simulator';
|
||||
import { IDesigner } from './designer';
|
||||
@ -25,31 +21,6 @@ export interface ILocateEvent extends IPublicModelLocateEvent {
|
||||
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 {
|
||||
return e && e.type === 'LocateEvent';
|
||||
}
|
||||
@ -112,15 +83,15 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
||||
/**
|
||||
* current active sensor, 可用于感应区高亮
|
||||
*/
|
||||
@obx.ref private _activeSensor: IPublicModelSensor | undefined;
|
||||
@observable.ref private _activeSensor: IPublicModelSensor | undefined;
|
||||
|
||||
get activeSensor(): IPublicModelSensor | undefined {
|
||||
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 {
|
||||
return this._dragging;
|
||||
@ -140,7 +111,6 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
||||
* @param shell container element
|
||||
* @param boost boost got a drag object
|
||||
*/
|
||||
// @ts-ignore
|
||||
from(shell: Element, boost: (e: MouseEvent) => IPublicModelDragObject | null) {
|
||||
const mousedown = (e: MouseEvent) => {
|
||||
// ESC or RightClick
|
||||
@ -168,6 +138,7 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
||||
* @param dragObject 拖拽对象
|
||||
* @param boostEvent 拖拽初始时事件
|
||||
*/
|
||||
@action
|
||||
boost(
|
||||
dragObject: IPublicModelDragObject,
|
||||
boostEvent: MouseEvent | DragEvent,
|
||||
@ -196,7 +167,7 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
||||
};
|
||||
|
||||
const checkesc = (e: KeyboardEvent) => {
|
||||
if (e.keyCode === 27) {
|
||||
if (e.code === 'Escape') {
|
||||
designer.clearLocation();
|
||||
over();
|
||||
}
|
||||
@ -204,7 +175,6 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
||||
|
||||
let copy = false;
|
||||
const checkcopy = (e: MouseEvent | DragEvent | KeyboardEvent) => {
|
||||
/* istanbul ignore next */
|
||||
if (isDragEvent(e) && e.dataTransfer) {
|
||||
if (newBie || forceCopyState) {
|
||||
e.dataTransfer.dropEffect = 'copy';
|
||||
@ -251,7 +221,6 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
||||
const locateEvent = createLocateEvent(e);
|
||||
const sensor = chooseSensor(locateEvent);
|
||||
|
||||
/* istanbul ignore next */
|
||||
if (isRGL) {
|
||||
// 禁止被拖拽元素的阻断
|
||||
const nodeInst = dragObject?.nodes?.[0]?.getDOMNode();
|
||||
@ -294,7 +263,7 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
||||
this.emitter.emit('drag', locateEvent);
|
||||
};
|
||||
|
||||
const dragstart = () => {
|
||||
const dragstart = autorun(() => {
|
||||
this._dragging = true;
|
||||
setShaken(boostEvent);
|
||||
const locateEvent = createLocateEvent(boostEvent);
|
||||
@ -312,7 +281,7 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
||||
}
|
||||
|
||||
this.emitter.emit('dragstart', locateEvent);
|
||||
};
|
||||
});
|
||||
|
||||
// route: drag-move
|
||||
const move = (e: MouseEvent | DragEvent) => {
|
||||
@ -335,7 +304,6 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
||||
};
|
||||
|
||||
let didDrop = true;
|
||||
/* istanbul ignore next */
|
||||
const drop = (e: DragEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@ -374,14 +342,12 @@ export class Dragon implements IPublicModelDragon<INode, ILocateEvent> {
|
||||
// 移除磁帖占位消息
|
||||
this.emitter.emit('rgl.remove.placeholder');
|
||||
|
||||
/* istanbul ignore next */
|
||||
if (e && isDragEvent(e)) {
|
||||
e.preventDefault();
|
||||
}
|
||||
if (lastSensor) {
|
||||
lastSensor.deactiveSensor();
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
if (isBoostFromDragAPI) {
|
||||
if (!didDrop) {
|
||||
designer.clearLocation();
|
||||
|
||||
@ -23,20 +23,6 @@ export type Rects = DOMRect[] & {
|
||||
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) {
|
||||
if (isText(container)) {
|
||||
return true;
|
||||
@ -139,29 +125,4 @@ export class DropLocation implements IDropLocation {
|
||||
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 { 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 { INodeSelector, IViewport } from '../simulator';
|
||||
import { INode } from '../document';
|
||||
@ -15,17 +15,17 @@ export class OffsetObserver {
|
||||
|
||||
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() {
|
||||
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;
|
||||
}
|
||||
|
||||
@obx hasOffset = false;
|
||||
@observable hasOffset = false;
|
||||
|
||||
@computed get offsetLeft() {
|
||||
if (this.isRoot) {
|
||||
@ -102,14 +102,17 @@ export class OffsetObserver {
|
||||
readonly compute: () => void;
|
||||
|
||||
constructor(readonly nodeInstance: INodeSelector) {
|
||||
makeObservable(this);
|
||||
|
||||
const { node, instance } = nodeInstance;
|
||||
this.node = node;
|
||||
|
||||
const doc = node.document;
|
||||
const host = doc?.simulator;
|
||||
const focusNode = doc?.focusNode;
|
||||
this.isRoot = node.contains(focusNode!);
|
||||
this.viewport = host?.viewport;
|
||||
makeObservable(this);
|
||||
|
||||
if (this.isRoot) {
|
||||
this.hasOffset = true;
|
||||
return;
|
||||
@ -119,7 +122,7 @@ export class OffsetObserver {
|
||||
}
|
||||
|
||||
let pid: number | undefined;
|
||||
const compute = () => {
|
||||
const compute = action(() => {
|
||||
if (pid !== this.pid) {
|
||||
return;
|
||||
}
|
||||
@ -139,7 +142,7 @@ export class OffsetObserver {
|
||||
}
|
||||
this.pid = requestIdleCallback(compute);
|
||||
pid = this.pid;
|
||||
};
|
||||
});
|
||||
|
||||
this.compute = compute;
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ import {
|
||||
import type { IPublicTypeSetValueOptions } from '@alilc/lowcode-types';
|
||||
import { Transducer } from './utils';
|
||||
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 { ISettingTopEntry } from './setting-top-entry';
|
||||
import { IComponentMeta } from '../../component-meta';
|
||||
@ -34,7 +34,6 @@ function getSettingFieldCollectorKey(
|
||||
return path.join('.');
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
export interface ISettingField
|
||||
extends ISettingPropEntry,
|
||||
Omit<
|
||||
@ -107,7 +106,7 @@ export class SettingField extends SettingPropEntry implements ISettingField {
|
||||
|
||||
private _setter?: IPublicTypeSetterType | IPublicTypeDynamicSetter;
|
||||
|
||||
@obx.ref private _expanded = true;
|
||||
@observable.ref private _expanded = true;
|
||||
|
||||
private _items: Array<ISettingField | IPublicTypeCustomView> = [];
|
||||
|
||||
@ -317,10 +316,3 @@ export class SettingField extends SettingPropEntry implements ISettingField {
|
||||
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 {
|
||||
obx,
|
||||
observable,
|
||||
computed,
|
||||
makeObservable,
|
||||
runInAction,
|
||||
@ -14,13 +14,13 @@ import {
|
||||
IPublicTypeFieldExtraProps,
|
||||
IPublicTypeSetValueOptions,
|
||||
} 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 { INode } from '../../document';
|
||||
import type { IComponentMeta } from '../../component-meta';
|
||||
import { IDesigner } from '../designer';
|
||||
import { ISettingTopEntry } from './setting-top-entry';
|
||||
import { ISettingField, isSettingField } from './setting-field';
|
||||
import { ISettingField } from './setting-field';
|
||||
|
||||
export interface ISettingPropEntry extends ISettingEntry {
|
||||
readonly isGroup: boolean;
|
||||
@ -86,7 +86,7 @@ export class SettingPropEntry implements ISettingPropEntry {
|
||||
readonly emitter: IEventBus = createModuleEventBus('SettingPropEntry');
|
||||
|
||||
// ==== dynamic properties ====
|
||||
@obx.ref private _name: string | number | undefined;
|
||||
@observable.ref private _name: string | number | undefined;
|
||||
|
||||
get 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) {
|
||||
this.editor.eventBus.emit(GlobalEvent.Node.Prop.InnerChange, {
|
||||
node: this.getNode(),
|
||||
|
||||
@ -281,13 +281,6 @@ export class SettingTopEntry implements ISettingTopEntry {
|
||||
return this.first.document;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
get node() {
|
||||
return this.getNode();
|
||||
}
|
||||
|
||||
getNode() {
|
||||
return this.nodes[0];
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import {
|
||||
makeObservable,
|
||||
obx,
|
||||
observable,
|
||||
engineConfig,
|
||||
action,
|
||||
runWithGlobalEventOff,
|
||||
@ -111,7 +111,7 @@ implements
|
||||
|
||||
readonly designer: IDesigner;
|
||||
|
||||
@obx.shallow private nodes = new Set<INode>();
|
||||
@observable.shallow private nodes = new Set<INode>();
|
||||
|
||||
private seqId = 0;
|
||||
|
||||
@ -119,11 +119,6 @@ implements
|
||||
|
||||
private rootNodeVisitorMap: { [visitorName: string]: any } = {};
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
private _addons: Array<{ name: string; exportData: any }> = [];
|
||||
|
||||
/**
|
||||
* 模拟器
|
||||
*/
|
||||
@ -154,7 +149,7 @@ implements
|
||||
return this.rootNode;
|
||||
}
|
||||
|
||||
@obx.ref private _drillDownNode: INode | null = null;
|
||||
@observable.ref private _drillDownNode: INode | null = null;
|
||||
|
||||
private _modalNode?: INode;
|
||||
|
||||
@ -162,7 +157,7 @@ implements
|
||||
|
||||
private inited = false;
|
||||
|
||||
@obx.shallow private willPurgeSpace: INode[] = [];
|
||||
@observable.shallow private willPurgeSpace: INode[] = [];
|
||||
|
||||
get modalNode() {
|
||||
return this._modalNode;
|
||||
@ -172,9 +167,9 @@ implements
|
||||
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) {
|
||||
this._dropLocation = loc;
|
||||
@ -199,9 +194,9 @@ implements
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
@ -700,54 +668,6 @@ implements
|
||||
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 */
|
||||
acceptRootNodeVisitor(visitorName = 'default', visitorFn: (node: IRootNode) => any) {
|
||||
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) {
|
||||
this.designer.editor.eventBus.on('document-open', fn);
|
||||
return () => {
|
||||
|
||||
@ -221,16 +221,6 @@ export class History<T = IPublicTypeNodeSchema> implements IHistory {
|
||||
this.emitter.removeAllListeners();
|
||||
this.records = [];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @returns
|
||||
* @memberof History
|
||||
*/
|
||||
isModified() {
|
||||
return this.isSavePoint();
|
||||
}
|
||||
}
|
||||
|
||||
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 { IPublicTypeTitleContent, IPublicModelExclusiveGroup } from '@alilc/lowcode-types';
|
||||
import type { INode } from './node';
|
||||
@ -30,9 +30,9 @@ export class ExclusiveGroup implements IExclusiveGroup {
|
||||
|
||||
readonly title: IPublicTypeTitleContent;
|
||||
|
||||
@obx.shallow readonly children: INode[] = [];
|
||||
@observable.shallow readonly children: INode[] = [];
|
||||
|
||||
@obx private visibleIndex = 0;
|
||||
@observable private visibleIndex = 0;
|
||||
|
||||
@computed get 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 { IPublicTypeNodeData, IPublicModelNodeChildren, IPublicEnumTransformStage, IPublicTypeDisposable } from '@alilc/lowcode-types';
|
||||
import { shallowEqual, compatStage, isNodeSchema } from '@alilc/lowcode-utils';
|
||||
@ -16,7 +16,7 @@ export class NodeChildren implements Omit<IPublicModelNodeChildren<INode>,
|
||||
'isEmpty' |
|
||||
'notEmpty'
|
||||
> {
|
||||
@obx.shallow children: INode[];
|
||||
@observable.shallow children: INode[];
|
||||
|
||||
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 {
|
||||
obx,
|
||||
observable,
|
||||
computed,
|
||||
autorun,
|
||||
makeObservable,
|
||||
@ -159,12 +159,7 @@ implements
|
||||
|
||||
protected _children?: INodeChildren;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
private _addons: { [key: string]: { exportData: () => any; isProp: boolean } } = {};
|
||||
|
||||
@obx.ref private _parent: INode | null = null;
|
||||
@observable.ref private _parent: INode | null = null;
|
||||
|
||||
/**
|
||||
* 父级节点
|
||||
@ -245,14 +240,14 @@ implements
|
||||
|
||||
private _slotFor?: IProp | null | undefined = null;
|
||||
|
||||
@obx.shallow _slots: INode[] = [];
|
||||
@observable.shallow _slots: INode[] = [];
|
||||
|
||||
get slots(): INode[] {
|
||||
return this._slots;
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
@obx.ref private _conditionGroup: IExclusiveGroup | null = null;
|
||||
@observable.ref private _conditionGroup: IExclusiveGroup | null = null;
|
||||
|
||||
/* istanbul ignore next */
|
||||
get conditionGroup(): IExclusiveGroup | null {
|
||||
@ -277,7 +272,7 @@ implements
|
||||
return this.purging;
|
||||
}
|
||||
|
||||
@obx.shallow status: NodeStatus = {
|
||||
@observable.shallow status: NodeStatus = {
|
||||
inPlaceEditing: false,
|
||||
locking: false,
|
||||
pseudo: false,
|
||||
@ -1105,49 +1100,6 @@ implements
|
||||
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 };
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 {
|
||||
if (this.isRoot()) {
|
||||
return this.document.simulator?.viewport.contentBounds || null;
|
||||
@ -1266,20 +1127,6 @@ implements
|
||||
return this.document.simulator?.computeRect(this) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
getPrototype() {
|
||||
return this.componentMeta.prototype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
setPrototype(proto: any) {
|
||||
this.componentMeta.prototype = proto;
|
||||
}
|
||||
|
||||
getIcon() {
|
||||
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 type { IPublicTypeCompositeValue, IPublicTypeJSSlot, IPublicTypeSlotSchema, IPublicModelProp, IPublicTypeNodeData } from '@alilc/lowcode-types';
|
||||
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;
|
||||
|
||||
@ -76,7 +76,7 @@ export class Prop implements IProp, IPropParent {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@obx private _value: any = UNSET;
|
||||
@observable private _value: any = UNSET;
|
||||
|
||||
/**
|
||||
* 属性值
|
||||
@ -146,7 +146,7 @@ export class Prop implements IProp, IPropParent {
|
||||
return this._slotNode || null;
|
||||
}
|
||||
|
||||
@obx.shallow private _items: IProp[] | null = null;
|
||||
@observable.shallow private _items: IProp[] | null = null;
|
||||
|
||||
/**
|
||||
* 作为一层缓存机制,主要是复用部分已存在的 Prop,保持响应式关系,比如:
|
||||
@ -154,7 +154,7 @@ export class Prop implements IProp, IPropParent {
|
||||
* 导致假如外部有 mobx reaction(常见于 observer),此时响应式链路会被打断,
|
||||
* 因为 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 属性
|
||||
|
||||
@ -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 type { IPublicTypePropsMap } from '@alilc/lowcode-types';
|
||||
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 {
|
||||
readonly id = uniqueId('props');
|
||||
|
||||
@obx.shallow private items: IProp[] = [];
|
||||
@observable.shallow private items: IProp[] = [];
|
||||
|
||||
@computed private get maps(): Map<string, Prop> {
|
||||
const maps = new Map();
|
||||
@ -71,7 +71,7 @@ export class Props implements Omit<IBaseModelProps<IProp>, | 'getExtraProp' | 'g
|
||||
return this.items.length;
|
||||
}
|
||||
|
||||
@obx type: 'map' | 'list' = 'map';
|
||||
@observable type: 'map' | 'list' = 'map';
|
||||
|
||||
private purged = false;
|
||||
|
||||
@ -182,27 +182,6 @@ export class Props implements Omit<IBaseModelProps<IProp>, | 'getExtraProp' | 'g
|
||||
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 路径查询属性
|
||||
*
|
||||
@ -384,13 +363,4 @@ export class Props implements Omit<IBaseModelProps<IProp>, | 'getExtraProp' | 'g
|
||||
getNode() {
|
||||
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 { DocumentModel } from './document-model';
|
||||
import { IPublicModelSelection } from '@alilc/lowcode-types';
|
||||
@ -10,7 +10,7 @@ export interface ISelection extends Omit<IPublicModelSelection<INode>, 'node'> {
|
||||
export class Selection implements ISelection {
|
||||
private emitter: IEventBus = createModuleEventBus('Selection');
|
||||
|
||||
@obx.shallow private _selected: string[] = [];
|
||||
@observable.shallow private _selected: string[] = [];
|
||||
|
||||
constructor(readonly doc: DocumentModel) {
|
||||
makeObservable(this);
|
||||
@ -26,6 +26,7 @@ export class Selection implements ISelection {
|
||||
/**
|
||||
* 选中
|
||||
*/
|
||||
@action
|
||||
select(id: string) {
|
||||
if (this._selected.length === 1 && this._selected.indexOf(id) > -1) {
|
||||
// avoid cause reaction
|
||||
@ -45,6 +46,7 @@ export class Selection implements ISelection {
|
||||
/**
|
||||
* 批量选中
|
||||
*/
|
||||
@action
|
||||
selectAll(ids: string[]) {
|
||||
const selectIds: string[] = [];
|
||||
|
||||
@ -64,6 +66,7 @@ export class Selection implements ISelection {
|
||||
/**
|
||||
* 清除选中
|
||||
*/
|
||||
@action
|
||||
clear() {
|
||||
if (this._selected.length < 1) {
|
||||
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 { DocumentModel, isDocumentModel } from '../document';
|
||||
import type { IDocumentModel } from '../document';
|
||||
@ -93,7 +93,7 @@ export interface IProject extends Omit<IBaseApiProject<
|
||||
export class Project implements IProject {
|
||||
private emitter: IEventBus = createModuleEventBus('Project');
|
||||
|
||||
@obx.shallow readonly documents: IDocumentModel[] = [];
|
||||
@observable.shallow readonly documents: IDocumentModel[] = [];
|
||||
|
||||
private data: IPublicTypeProjectSchema = {
|
||||
version: '1.0.0',
|
||||
@ -117,7 +117,7 @@ export class Project implements IProject {
|
||||
return this.documents.find((doc) => doc.active);
|
||||
}
|
||||
|
||||
@obx private _config: any = {};
|
||||
@observable private _config: any = {};
|
||||
@computed get config(): any {
|
||||
// TODO: parse layout Component
|
||||
return this._config;
|
||||
@ -126,7 +126,7 @@ export class Project implements IProject {
|
||||
this._config = value;
|
||||
}
|
||||
|
||||
@obx.ref private _i18n: any = {};
|
||||
@observable.ref private _i18n: any = {};
|
||||
@computed get i18n(): any {
|
||||
return this._i18n;
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ import {
|
||||
} from '@alilc/lowcode-types';
|
||||
import { engineConfig } from './config';
|
||||
import { globalLocale } from './intl';
|
||||
import { obx } from './utils';
|
||||
import { observable } from './utils';
|
||||
import { IPublicTypeAssetsJson, AssetLoader } from '@alilc/lowcode-utils';
|
||||
import { assetsTransform } from './utils/assets-transform';
|
||||
|
||||
@ -49,7 +49,7 @@ export class Editor extends EventEmitter implements IEditor {
|
||||
/**
|
||||
* Ioc Container
|
||||
*/
|
||||
@obx.shallow private context = new Map<IPublicTypeEditorValueKey, any>();
|
||||
@observable.shallow private context = new Map<IPublicTypeEditorValueKey, any>();
|
||||
|
||||
get locale() {
|
||||
return globalLocale.getLocale();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { IEventBus, createModuleEventBus } from '../event-bus';
|
||||
import { obx, computed } from '../utils/obx';
|
||||
import { observable, computed } from '../utils/obx';
|
||||
import { Logger } from '@alilc/lowcode-utils';
|
||||
|
||||
const logger = new Logger({ level: 'warn', bizName: 'globalLocale' });
|
||||
@ -35,7 +35,7 @@ const LowcodeConfigKey = 'ali-lowcode-config';
|
||||
class GlobalLocale {
|
||||
private emitter: IEventBus = createModuleEventBus('GlobalLocale');
|
||||
|
||||
@obx.ref private _locale?: string;
|
||||
@observable.ref private _locale?: string;
|
||||
|
||||
@computed get locale() {
|
||||
if (this._locale != null) {
|
||||
|
||||
@ -4,7 +4,6 @@ import { configure } from 'mobx';
|
||||
configure({ enforceActions: 'never' });
|
||||
|
||||
export {
|
||||
observable as obx,
|
||||
observable,
|
||||
observe,
|
||||
autorun,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* 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 { IPublicTypeWidgetBaseConfig } from '@alilc/lowcode-types';
|
||||
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> {
|
||||
@obx private _visible = true;
|
||||
@observable private _visible = true;
|
||||
|
||||
@computed get visible() {
|
||||
if (this.exclusive) {
|
||||
@ -80,12 +80,4 @@ export class Area<C extends IPublicTypeWidgetBaseConfig = any, T extends IWidget
|
||||
show() {
|
||||
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 {
|
||||
Editor,
|
||||
obx,
|
||||
observable,
|
||||
computed,
|
||||
makeObservable,
|
||||
action,
|
||||
@ -21,7 +21,7 @@ export class SettingsMain {
|
||||
|
||||
private _sessionId = '';
|
||||
|
||||
@obx.ref private _settings?: SettingTopEntry;
|
||||
@observable.ref private _settings?: SettingTopEntry;
|
||||
|
||||
@computed get length(): number | undefined {
|
||||
return this._settings?.nodes.length;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
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 {
|
||||
createContent,
|
||||
isJSSlot,
|
||||
@ -410,7 +410,7 @@ export type SettingsPaneProps = {
|
||||
export class SettingsPane extends Component<SettingsPaneProps> {
|
||||
static contextType = SkeletonContext;
|
||||
|
||||
@obx private currentStage?: Stage;
|
||||
@observable private currentStage?: Stage;
|
||||
|
||||
private popupPipe = new PopupPipe();
|
||||
|
||||
|
||||
@ -4,19 +4,19 @@ import {
|
||||
Title,
|
||||
observer,
|
||||
Editor,
|
||||
obx,
|
||||
observable,
|
||||
globalContext,
|
||||
engineConfig,
|
||||
makeObservable,
|
||||
} 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 { SettingsMain } from './main';
|
||||
import { SettingsPane } from './settings-pane';
|
||||
import { StageBox } from '../stage-box';
|
||||
import { SkeletonContext } from '../../context';
|
||||
import { intl } from '../../locale';
|
||||
import { createIcon } from '@alilc/lowcode-utils';
|
||||
import { createIcon, isSettingField } from '@alilc/lowcode-utils';
|
||||
|
||||
interface ISettingsPrimaryPaneProps {
|
||||
engineEditor: Editor;
|
||||
@ -33,7 +33,7 @@ export class SettingsPrimaryPane extends Component<
|
||||
};
|
||||
private main = new SettingsMain(this.props.engineEditor);
|
||||
|
||||
@obx.ref private _activeKey?: any;
|
||||
@observable.ref private _activeKey?: any;
|
||||
|
||||
constructor(props: ISettingsPrimaryPaneProps) {
|
||||
super(props);
|
||||
@ -235,7 +235,6 @@ export class SettingsPrimaryPane extends Component<
|
||||
{(skeleton) => {
|
||||
if (skeleton) {
|
||||
return (
|
||||
// @ts-ignore
|
||||
<StageBox skeleton={skeleton} target={field} key={field.id}>
|
||||
<SettingsPane target={field} key={field.id} usePopup={false} />
|
||||
</StageBox>
|
||||
|
||||
@ -73,22 +73,3 @@
|
||||
|
||||
--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 {
|
||||
DockConfig,
|
||||
WidgetConfig,
|
||||
@ -85,7 +85,7 @@ export class Skeleton implements Omit<IPublicApiSkeleton,
|
||||
|
||||
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>;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
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 { getEvent } from '../event';
|
||||
import { DockConfig } from '../types';
|
||||
@ -19,13 +19,13 @@ export class Dock implements IWidget {
|
||||
|
||||
readonly align?: string;
|
||||
|
||||
@obx.ref private _visible = true;
|
||||
@observable.ref private _visible = true;
|
||||
|
||||
get visible(): boolean {
|
||||
return this._visible;
|
||||
}
|
||||
|
||||
@obx.ref private _disabled = false;
|
||||
@observable.ref private _disabled = false;
|
||||
|
||||
get content(): ReactNode {
|
||||
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 { createElement, ReactNode, ReactInstance } from 'react';
|
||||
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() {
|
||||
return this._visible;
|
||||
@ -65,7 +65,7 @@ export class PanelDock implements IWidget {
|
||||
|
||||
private _panel?: Panel;
|
||||
|
||||
@obx.ref private _disabled = false;
|
||||
@observable.ref private _disabled = false;
|
||||
|
||||
@computed get panel() {
|
||||
return this._panel || this.skeleton.getPanel(this.panelName);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { createElement, ReactNode } from 'react';
|
||||
import {
|
||||
obx,
|
||||
observable,
|
||||
computed,
|
||||
makeObservable,
|
||||
IEventBus,
|
||||
@ -27,9 +27,9 @@ export class Panel implements IWidget {
|
||||
|
||||
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');
|
||||
|
||||
@ -88,7 +88,7 @@ export class Panel implements IWidget {
|
||||
|
||||
private container?: WidgetContainer<Panel, IPublicTypePanelConfig>;
|
||||
|
||||
@obx.ref public parent?: WidgetContainer;
|
||||
@observable.ref public parent?: WidgetContainer;
|
||||
|
||||
constructor(
|
||||
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 { 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> {
|
||||
@obx.shallow items: T[] = [];
|
||||
@observable.shallow items: T[] = [];
|
||||
|
||||
private maps: { [name: string]: T } = {};
|
||||
|
||||
@obx.ref private _current: T & Activeable | null = null;
|
||||
@observable.ref private _current: T & Activeable | null = null;
|
||||
|
||||
get current() {
|
||||
return this._current;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
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 { getEvent } from '../event';
|
||||
import { WidgetConfig } from '../types';
|
||||
@ -36,15 +36,15 @@ export class Widget implements IWidget {
|
||||
|
||||
readonly align?: string;
|
||||
|
||||
@obx.ref private _visible = true;
|
||||
@observable.ref private _visible = true;
|
||||
|
||||
get visible(): boolean {
|
||||
return this._visible;
|
||||
}
|
||||
|
||||
@obx.ref inited = false;
|
||||
@observable.ref inited = false;
|
||||
|
||||
@obx.ref private _disabled = false;
|
||||
@observable.ref private _disabled = false;
|
||||
|
||||
private _body: ReactNode;
|
||||
|
||||
|
||||
@ -68,6 +68,7 @@ import { version } from '../package.json';
|
||||
import '@alilc/lowcode-plugin-outline-pane/dist/style.css';
|
||||
import '@alilc/lowcode-editor-skeleton/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/designer-types';
|
||||
@ -219,8 +220,8 @@ export {
|
||||
command,
|
||||
};
|
||||
|
||||
// declare this is open-source version
|
||||
/**
|
||||
* declare this is open-source version
|
||||
* @deprecated
|
||||
*/
|
||||
export const isOpenSource = true;
|
||||
|
||||
@ -72,11 +72,4 @@ export class Canvas implements IPublicApiCanvas {
|
||||
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]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use .simulatorHost instead.
|
||||
*/
|
||||
get simulator() {
|
||||
return this.simulatorHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开一个 document
|
||||
* @param doc
|
||||
|
||||
@ -65,11 +65,4 @@ export class Setters implements IPublicApiSetters {
|
||||
) => {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
get prototype() {
|
||||
return (this[componentMetaSymbol] as any).prototype;
|
||||
}
|
||||
|
||||
get availableActions(): any {
|
||||
return this[componentMetaSymbol].availableActions;
|
||||
}
|
||||
|
||||
@ -44,19 +44,12 @@ export class DocumentModel implements IPublicModelDocumentModel {
|
||||
detecting: IPublicModelDetecting;
|
||||
history: IPublicModelHistory;
|
||||
|
||||
/**
|
||||
* @deprecated use canvas API instead
|
||||
*/
|
||||
canvas: IPublicApiCanvas;
|
||||
|
||||
constructor(document: InnerDocumentModel) {
|
||||
this[documentSymbol] = document;
|
||||
this[editorSymbol] = document.designer?.editor as IPublicModelEditor;
|
||||
this.selection = new ShellSelection(document);
|
||||
this.detecting = new ShellDetecting(document);
|
||||
this.history = new ShellHistory(document);
|
||||
this.canvas = new ShellCanvas(this[editorSymbol]);
|
||||
|
||||
this._focusNode = ShellNode.create(this[documentSymbol].focusNode);
|
||||
}
|
||||
|
||||
|
||||
@ -31,15 +31,6 @@ export class NodeChildren implements IPublicModelNodeChildren {
|
||||
return this[nodeChildrenSymbol].size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* 是否为空
|
||||
* @returns
|
||||
*/
|
||||
get isEmpty(): boolean {
|
||||
return this[nodeChildrenSymbol].isEmptyNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为空
|
||||
* @returns
|
||||
@ -48,14 +39,6 @@ export class NodeChildren implements IPublicModelNodeChildren {
|
||||
return this[nodeChildrenSymbol].isEmptyNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* judge if it is not empty
|
||||
*/
|
||||
get notEmpty(): boolean {
|
||||
return this[nodeChildrenSymbol].notEmptyNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* judge if it is not empty
|
||||
*/
|
||||
|
||||
@ -62,14 +62,6 @@ export class Node implements IPublicModelNode {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* 是否为根节点
|
||||
*/
|
||||
get isRoot(): boolean {
|
||||
return this[nodeSymbol].isRootNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为根节点
|
||||
*/
|
||||
@ -92,14 +76,6 @@ export class Node implements IPublicModelNode {
|
||||
return this[nodeSymbol].isRootNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* 是否为空节点(无 children 或者 children 为空)
|
||||
*/
|
||||
get isEmpty(): boolean {
|
||||
return this[nodeSymbol].isEmptyNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为空节点(无 children 或者 children 为空)
|
||||
*/
|
||||
@ -107,14 +83,6 @@ export class Node implements IPublicModelNode {
|
||||
return this[nodeSymbol].isEmptyNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* 是否为 Page 节点
|
||||
*/
|
||||
get isPage(): boolean {
|
||||
return this[nodeSymbol].isPageNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为 Page 节点
|
||||
*/
|
||||
@ -122,14 +90,6 @@ export class Node implements IPublicModelNode {
|
||||
return this[nodeSymbol].isPageNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* 是否为 Component 节点
|
||||
*/
|
||||
get isComponent(): boolean {
|
||||
return this[nodeSymbol].isComponentNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为 Component 节点
|
||||
*/
|
||||
@ -137,14 +97,6 @@ export class Node implements IPublicModelNode {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* 是否为插槽节点
|
||||
*/
|
||||
get isSlot(): boolean {
|
||||
return this[nodeSymbol].isSlotNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为插槽节点
|
||||
*/
|
||||
@ -167,14 +111,6 @@ export class Node implements IPublicModelNode {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* 是否为叶子节点
|
||||
*/
|
||||
get isLeaf(): boolean {
|
||||
return this[nodeSymbol].isLeafNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为叶子节点
|
||||
*/
|
||||
@ -334,24 +262,16 @@ export class Node implements IPublicModelNode {
|
||||
if (!node) {
|
||||
return null;
|
||||
}
|
||||
// @ts-ignore 直接返回已挂载的 shell node 实例
|
||||
// 直接返回已挂载的 shell node 实例
|
||||
if (isShellNode(node)) {
|
||||
return (node as any)[shellNodeSymbol];
|
||||
}
|
||||
const shellNode = new Node(node);
|
||||
// @ts-ignore 挂载 shell node 实例
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
// @ts-expect-error: 挂载 shell node 实例
|
||||
node[shellNodeSymbol] = shellNode;
|
||||
return shellNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use .children instead
|
||||
*/
|
||||
getChildren() {
|
||||
return this.children;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点实例对应的 dom 节点
|
||||
*/
|
||||
@ -433,13 +353,6 @@ export class Node implements IPublicModelNode {
|
||||
this[nodeSymbol].lock(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use .props instead
|
||||
*/
|
||||
getProps() {
|
||||
return this.props;
|
||||
}
|
||||
|
||||
contains(node: IPublicModelNode): boolean {
|
||||
return this[nodeSymbol].contains((node as any)[nodeSymbol]);
|
||||
}
|
||||
@ -600,23 +513,6 @@ export class Node implements IPublicModelNode {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use .node instead
|
||||
*/
|
||||
getNode() {
|
||||
return this.node;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use .parent instead
|
||||
*/
|
||||
getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置值
|
||||
* @param val 值
|
||||
|
||||
@ -31,13 +31,6 @@ export class SettingTopEntry implements IPublicModelSettingTopEntry {
|
||||
return SettingField.create(this[settingTopEntrySymbol].get(propName)!);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use .node instead
|
||||
*/
|
||||
getNode() {
|
||||
return this.node;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定 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 {
|
||||
IPublicEditorViewConfig,
|
||||
IPublicEnumPluginRegisterLevel,
|
||||
@ -24,9 +24,9 @@ export class Context extends BasicContext implements IViewContext {
|
||||
|
||||
viewType: 'editor' | 'webview';
|
||||
|
||||
@obx _activate = false;
|
||||
@observable _activate = false;
|
||||
|
||||
@obx isInit: boolean = false;
|
||||
@observable isInit: boolean = false;
|
||||
|
||||
init: any = flow(function* (this: Context) {
|
||||
if (this.viewType === 'webview') {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
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 { IWorkspace } from './workspace';
|
||||
import { IResource } from './resource';
|
||||
@ -38,11 +38,11 @@ export class EditorWindow implements Omit<IPublicModelWindow<IResource>, 'change
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
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 { BasicContext } from './context/base-context';
|
||||
import { EditorWindow, WINDOW_STATE } from './window';
|
||||
@ -57,11 +57,11 @@ export class Workspace implements Omit<IPublicApiWorkspace<
|
||||
return null;
|
||||
}
|
||||
|
||||
@obx.ref windows: IEditorWindow[] = [];
|
||||
@observable.ref windows: IEditorWindow[] = [];
|
||||
|
||||
editorWindowMap: Map<string, IEditorWindow> = new Map<string, IEditorWindow>();
|
||||
|
||||
@obx.ref window: IEditorWindow;
|
||||
@observable.ref window: IEditorWindow;
|
||||
|
||||
windowQueue: ({
|
||||
name: string;
|
||||
|
||||
@ -2,7 +2,7 @@ import React, { createElement, ReactInstance } from 'react';
|
||||
import { render as reactRender } from 'react-dom';
|
||||
import { host } from './host';
|
||||
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 { reactFindDOMNodes, getReactInternalFiber } from './utils/react-find-dom-nodes';
|
||||
import {
|
||||
@ -39,7 +39,7 @@ export class DocumentInstance {
|
||||
|
||||
private disposeFunctions: Array<() => void> = [];
|
||||
|
||||
@obx.ref private _components: any = {};
|
||||
@observable.ref private _components: any = {};
|
||||
|
||||
@computed get components(): object {
|
||||
// 根据 device 选择不同组件,进行响应式
|
||||
@ -48,31 +48,31 @@ export class DocumentInstance {
|
||||
}
|
||||
|
||||
// context from: utils、constants、history、location、match
|
||||
@obx.ref private _appContext = {};
|
||||
@observable.ref private _appContext = {};
|
||||
|
||||
@computed get context(): any {
|
||||
return this._appContext;
|
||||
}
|
||||
|
||||
@obx.ref private _designMode = 'design';
|
||||
@observable.ref private _designMode = 'design';
|
||||
|
||||
@computed get designMode(): any {
|
||||
return this._designMode;
|
||||
}
|
||||
|
||||
@obx.ref private _requestHandlersMap = null;
|
||||
@observable.ref private _requestHandlersMap = null;
|
||||
|
||||
@computed get requestHandlersMap(): any {
|
||||
return this._requestHandlersMap;
|
||||
}
|
||||
|
||||
@obx.ref private _device = 'default';
|
||||
@observable.ref private _device = 'default';
|
||||
|
||||
@computed get device() {
|
||||
return this._device;
|
||||
}
|
||||
|
||||
@obx.ref private _componentsMap = {};
|
||||
@observable.ref private _componentsMap = {};
|
||||
|
||||
@computed get componentsMap(): any {
|
||||
return this._componentsMap;
|
||||
@ -188,13 +188,13 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
||||
private disposeFunctions: Array<() => void> = [];
|
||||
readonly history: MemoryHistory;
|
||||
|
||||
@obx.ref private _documentInstances: DocumentInstance[] = [];
|
||||
@observable.ref private _documentInstances: DocumentInstance[] = [];
|
||||
private _requestHandlersMap: any;
|
||||
get documentInstances() {
|
||||
return this._documentInstances;
|
||||
}
|
||||
|
||||
@obx private _layout: any = null;
|
||||
@observable private _layout: any = null;
|
||||
|
||||
@computed get layout(): any {
|
||||
// TODO: parse layout Component
|
||||
@ -215,23 +215,23 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
||||
return this._components || {};
|
||||
}
|
||||
// context from: utils、constants、history、location、match
|
||||
@obx.ref private _appContext: any = {};
|
||||
@observable.ref private _appContext: any = {};
|
||||
@computed get context(): any {
|
||||
return this._appContext;
|
||||
}
|
||||
@obx.ref private _designMode: string = 'design';
|
||||
@observable.ref private _designMode: string = 'design';
|
||||
@computed get designMode(): any {
|
||||
return this._designMode;
|
||||
}
|
||||
@obx.ref private _device: string = 'default';
|
||||
@observable.ref private _device: string = 'default';
|
||||
@computed get device() {
|
||||
return this._device;
|
||||
}
|
||||
@obx.ref private _locale: string | undefined = undefined;
|
||||
@observable.ref private _locale: string | undefined = undefined;
|
||||
@computed get locale() {
|
||||
return this._locale;
|
||||
}
|
||||
@obx.ref private _componentsMap = {};
|
||||
@observable.ref private _componentsMap = {};
|
||||
@computed get componentsMap(): any {
|
||||
return this._componentsMap;
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { IPublicTypeNodeSchema } from './shell';
|
||||
|
||||
export enum ActivityType {
|
||||
'ADDED' = 'added',
|
||||
'DELETED' = 'deleted',
|
||||
'MODIFIED' = 'modified',
|
||||
'COMPOSITE' = 'composite',
|
||||
ADDED = 'added',
|
||||
DELETED = 'deleted',
|
||||
MODIFIED = 'modified',
|
||||
COMPOSITE = 'composite',
|
||||
}
|
||||
|
||||
interface IActivityPayload {
|
||||
@ -19,12 +19,3 @@ interface IActivityPayload {
|
||||
oldValue: 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 },
|
||||
setter?: IPublicTypeCustomView | IPublicTypeRegisteredSetter | undefined
|
||||
): void;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
createSetterContent (setter: any, props: Record<string, any>): ReactNode;
|
||||
}
|
||||
|
||||
@ -39,30 +39,12 @@ export interface IPublicApiWorkspace<
|
||||
/** 注册资源 */
|
||||
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>;
|
||||
|
||||
/** 通过视图 id 打开窗口 */
|
||||
openEditorWindowById(id: string): void;
|
||||
|
||||
/**
|
||||
* 移除视图窗口
|
||||
* @deprecated
|
||||
*/
|
||||
removeEditorWindow(resourceName: string, id: string): void;
|
||||
|
||||
/**
|
||||
* 移除视图窗口
|
||||
*/
|
||||
|
||||
@ -1,14 +1,4 @@
|
||||
// eslint-disable-next-line no-shadow
|
||||
export enum IPublicEnumDragObjectType {
|
||||
// eslint-disable-next-line no-shadow
|
||||
Node = 'node',
|
||||
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 {
|
||||
/**
|
||||
* normal set value
|
||||
@ -9,17 +8,3 @@ export enum IPublicEnumPropValueChangedType {
|
||||
*/
|
||||
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',
|
||||
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 {
|
||||
/** 节点更新后重绘处理 */
|
||||
REPAINT,
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use IPublicEnumTransitionType instead
|
||||
*/
|
||||
export const enum TransitionType {
|
||||
/** 节点更新后重绘处理 */
|
||||
REPAINT,
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@ export * from './node';
|
||||
export * from './prop';
|
||||
export * from './props';
|
||||
export * from './selection';
|
||||
export * from './setting-prop-entry';
|
||||
export * from './setting-top-entry';
|
||||
export * from '../type/plugin';
|
||||
export * from './window';
|
||||
@ -21,7 +20,6 @@ export * from './scroller';
|
||||
export * from './active-tracker';
|
||||
export * from './exclusive-group';
|
||||
export * from './plugin-context';
|
||||
export * from './setting-target';
|
||||
export * from './engine-config';
|
||||
export * from './editor';
|
||||
export * from './preference';
|
||||
|
||||
@ -18,13 +18,6 @@ export interface IPublicModelNodeChildren<
|
||||
*/
|
||||
get size(): number;
|
||||
|
||||
/**
|
||||
* @deprecated please use isEmptyNode
|
||||
* 是否为空
|
||||
* @returns
|
||||
*/
|
||||
get isEmpty(): boolean;
|
||||
|
||||
/**
|
||||
* 是否为空
|
||||
*
|
||||
@ -32,12 +25,6 @@ export interface IPublicModelNodeChildren<
|
||||
*/
|
||||
get isEmptyNode(): boolean;
|
||||
|
||||
/**
|
||||
* @deprecated please use notEmptyNode
|
||||
* judge if it is not empty
|
||||
*/
|
||||
get notEmpty(): boolean;
|
||||
|
||||
/**
|
||||
* judge if it is not empty
|
||||
*/
|
||||
|
||||
@ -26,11 +26,6 @@ export interface IBaseModelNode<
|
||||
*/
|
||||
get title(): string | IPublicTypeI18nData | ReactElement;
|
||||
|
||||
/**
|
||||
* @deprecated please use isContainerNode
|
||||
*/
|
||||
get isContainer(): boolean;
|
||||
|
||||
/**
|
||||
* 是否为「容器型」节点
|
||||
* check if node is a container type node
|
||||
@ -38,11 +33,6 @@ export interface IBaseModelNode<
|
||||
*/
|
||||
get isContainerNode(): boolean;
|
||||
|
||||
/**
|
||||
* @deprecated please use isRootNode
|
||||
*/
|
||||
get isRoot(): boolean;
|
||||
|
||||
/**
|
||||
* 是否为根节点
|
||||
* check if node is root in the tree
|
||||
@ -50,11 +40,6 @@ export interface IBaseModelNode<
|
||||
*/
|
||||
get isRootNode(): boolean;
|
||||
|
||||
/**
|
||||
* @deprecated please use isEmptyNode
|
||||
*/
|
||||
get isEmpty(): boolean;
|
||||
|
||||
/**
|
||||
* 是否为空节点(无 children 或者 children 为空)
|
||||
* check if current node is empty, which means no children or children is empty
|
||||
@ -62,12 +47,6 @@ export interface IBaseModelNode<
|
||||
*/
|
||||
get isEmptyNode(): boolean;
|
||||
|
||||
/**
|
||||
* @deprecated please use isPageNode
|
||||
* 是否为 Page 节点
|
||||
*/
|
||||
get isPage(): boolean;
|
||||
|
||||
/**
|
||||
* 是否为 Page 节点
|
||||
* check if node is Page
|
||||
@ -75,11 +54,6 @@ export interface IBaseModelNode<
|
||||
*/
|
||||
get isPageNode(): boolean;
|
||||
|
||||
/**
|
||||
* @deprecated please use isComponentNode
|
||||
*/
|
||||
get isComponent(): boolean;
|
||||
|
||||
/**
|
||||
* 是否为 Component 节点
|
||||
* check if node is Component
|
||||
@ -87,11 +61,6 @@ export interface IBaseModelNode<
|
||||
*/
|
||||
get isComponentNode(): boolean;
|
||||
|
||||
/**
|
||||
* @deprecated please use isModalNode
|
||||
*/
|
||||
get isModal(): boolean;
|
||||
|
||||
/**
|
||||
* 是否为「模态框」节点
|
||||
* check if node is Modal
|
||||
@ -99,11 +68,6 @@ export interface IBaseModelNode<
|
||||
*/
|
||||
get isModalNode(): boolean;
|
||||
|
||||
/**
|
||||
* @deprecated please use isSlotNode
|
||||
*/
|
||||
get isSlot(): boolean;
|
||||
|
||||
/**
|
||||
* 是否为插槽节点
|
||||
* check if node is a Slot
|
||||
@ -111,11 +75,6 @@ export interface IBaseModelNode<
|
||||
*/
|
||||
get isSlotNode(): boolean;
|
||||
|
||||
/**
|
||||
* @deprecated please use isParentalNode
|
||||
*/
|
||||
get isParental(): boolean;
|
||||
|
||||
/**
|
||||
* 是否为父类/分支节点
|
||||
* check if node a parental node
|
||||
@ -123,11 +82,6 @@ export interface IBaseModelNode<
|
||||
*/
|
||||
get isParentalNode(): boolean;
|
||||
|
||||
/**
|
||||
* @deprecated please use isLeafNode
|
||||
*/
|
||||
get isLeaf(): boolean;
|
||||
|
||||
/**
|
||||
* 是否为叶子节点
|
||||
* check if node is a leaf node in tree
|
||||
@ -142,17 +96,6 @@ export interface IBaseModelNode<
|
||||
*/
|
||||
get isLocked(): boolean;
|
||||
|
||||
/**
|
||||
* @deprecated please use isRGLContainerNode
|
||||
*/
|
||||
set isRGLContainer(flag: boolean);
|
||||
|
||||
/**
|
||||
* @deprecated please use isRGLContainerNode
|
||||
* @returns Boolean
|
||||
*/
|
||||
get isRGLContainer();
|
||||
|
||||
/**
|
||||
* 设置为磁贴布局节点
|
||||
* @since v1.1.0
|
||||
|
||||
@ -122,10 +122,3 @@ export interface IPublicModelPluginContext {
|
||||
|
||||
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 { IPublicTypeNodeData, IPublicTypeSnippet, IPublicTypeInitialItem, IPublicTypeFilterItem, IPublicTypeAutorunItem, IPublicTypeCallbacks, IPublicTypeLiveTextEditingConfig } from './';
|
||||
import { IPublicModelNode, IPublicModelSettingField } from '../model';
|
||||
import { IPublicTypeNodeData, IPublicTypeSnippet, IPublicTypeInitialItem, IPublicTypeCallbacks, IPublicTypeLiveTextEditingConfig } from './';
|
||||
import { IPublicModelNode } from '../model';
|
||||
|
||||
/**
|
||||
* 高级特性配置
|
||||
@ -39,16 +39,6 @@ export interface IPublicTypeAdvanced {
|
||||
}> |
|
||||
ReactElement[]);
|
||||
|
||||
/**
|
||||
* @deprecated 用于动态初始化拖拽到设计器里的组件的 prop 的值
|
||||
*/
|
||||
initials?: IPublicTypeInitialItem[];
|
||||
|
||||
/**
|
||||
* @deprecated 使用组件 metadata 上的 snippets 字段即可
|
||||
*/
|
||||
snippets?: IPublicTypeSnippet[];
|
||||
|
||||
/**
|
||||
* 是否绝对布局容器,还未进入协议
|
||||
* @experimental not in spec yet
|
||||
@ -72,34 +62,4 @@ export interface IPublicTypeAdvanced {
|
||||
* @experimental not in spec yet
|
||||
*/
|
||||
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>;
|
||||
/**
|
||||
* 组件分类列表,用来描述物料面板
|
||||
* @deprecated 最新版物料面板已不需要此描述
|
||||
*/
|
||||
componentList?: any[];
|
||||
/**
|
||||
* 业务组件分类列表,用来描述物料面板
|
||||
* @deprecated 最新版物料面板已不需要此描述
|
||||
*/
|
||||
bizComponentList?: any[];
|
||||
/**
|
||||
* 用于描述组件面板中的 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 配置
|
||||
@ -69,11 +69,6 @@ export interface IPublicTypeComponentMetadata {
|
||||
*/
|
||||
configure?: IPublicTypeFieldConfig[] | IPublicTypeConfigure;
|
||||
|
||||
/**
|
||||
* @deprecated, use advanced instead
|
||||
*/
|
||||
experimental?: IPublicTypeAdvanced;
|
||||
|
||||
/**
|
||||
* @todo 待补充文档
|
||||
*/
|
||||
|
||||
@ -122,17 +122,6 @@ export interface IPublicTypeEngineOptions {
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@ -190,10 +179,3 @@ export interface IPublicTypeEngineOptions {
|
||||
*/
|
||||
hideComponentAction?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use IPublicTypeEngineOptions instead
|
||||
*/
|
||||
export interface EngineOptions {
|
||||
|
||||
}
|
||||
|
||||
@ -38,14 +38,4 @@ export interface IPublicTypeFieldConfig extends IPublicTypeFieldExtraProps {
|
||||
* 其他配置属性(不做流通要求)
|
||||
*/
|
||||
extraProps?: IPublicTypeFieldExtraProps;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
description?: IPublicTypeTitleContent;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
isExtends?: boolean;
|
||||
}
|
||||
|
||||
@ -1,19 +1,10 @@
|
||||
import { IPublicModelNode, IPublicModelLocateEvent } from '../model';
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
export enum IPublicTypeLocationDetailType {
|
||||
Children = 'Children',
|
||||
Prop = 'Prop',
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated please use IPublicTypeLocationDetailType
|
||||
*/
|
||||
export enum LocationDetailType {
|
||||
Children = 'Children',
|
||||
Prop = 'Prop',
|
||||
}
|
||||
|
||||
export type IPublicTypeRect = DOMRect & {
|
||||
elements?: Array<Element | Text>;
|
||||
computed?: boolean;
|
||||
|
||||
@ -20,8 +20,4 @@ export interface IPublicTypePropConfig {
|
||||
* 属性默认值
|
||||
*/
|
||||
defaultValue?: any;
|
||||
/**
|
||||
* @deprecated 已被弃用
|
||||
*/
|
||||
setter?: any;
|
||||
}
|
||||
|
||||
@ -9,12 +9,6 @@ export interface IPublicResourceTypeConfig {
|
||||
/** 资源 icon 标识 */
|
||||
icon?: React.ReactElement | React.FunctionComponent | React.ComponentClass;
|
||||
|
||||
/**
|
||||
* 默认视图类型
|
||||
* @deprecated
|
||||
*/
|
||||
defaultViewType?: string;
|
||||
|
||||
/** 默认视图类型 */
|
||||
defaultViewName: string;
|
||||
|
||||
|
||||
@ -19,11 +19,6 @@ export interface IPublicTypeSetterConfig {
|
||||
*/
|
||||
props?: Record<string, unknown> | IPublicTypeDynamicProps;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
children?: any;
|
||||
|
||||
/**
|
||||
* 是否必填?
|
||||
*
|
||||
|
||||
@ -14,12 +14,6 @@ export interface IPublicTypeSnippet {
|
||||
* snippet 截图
|
||||
*/
|
||||
screenshot?: string;
|
||||
/**
|
||||
* snippet 打标
|
||||
*
|
||||
* @deprecated 暂未使用
|
||||
*/
|
||||
label?: string;
|
||||
/**
|
||||
* 待插入的 schema
|
||||
*/
|
||||
|
||||
@ -104,16 +104,6 @@ export interface IPublicTypeJSSlot {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* @todo 待文档描述
|
||||
*/
|
||||
export interface IPublicTypeJSBlock {
|
||||
type: 'JSBlock';
|
||||
value: IPublicTypeNodeSchema;
|
||||
}
|
||||
|
||||
/**
|
||||
* JSON 基本类型
|
||||
*/
|
||||
|
||||
@ -11,6 +11,10 @@
|
||||
"import": "./dist/low-code-utils.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./dist/style.css": {
|
||||
"import": "./dist/style.css",
|
||||
"require": "./dist/style.css"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"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 {
|
||||
compatibleLegaoSchema,
|
||||
getNodeSchemaById,
|
||||
applyActivities,
|
||||
} from '../../src/schema';
|
||||
import { ActivityType } from '@alilc/lowcode-types';
|
||||
|
||||
describe('compatibleLegaoSchema', () => {
|
||||
it('should handle null input', () => {
|
||||
@ -66,67 +64,6 @@ describe('getNodeSchemaById', () => {
|
||||
// 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', () => {
|
||||
it('props', () => {
|
||||
const schema = {
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-types": "workspace:*",
|
||||
"@alilc/lowcode-engine": "workspace:*",
|
||||
"@alilc/lowcode-react-simulator-renderer": "workspace:*",
|
||||
"@alilc/lowcode-react-renderer": "workspace:*",
|
||||
"@alifd/next": "^1.27.10",
|
||||
"react": "^18.2.0",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user