fix: remove @deprecated apis

This commit is contained in:
1ncounter 2024-04-12 14:37:59 +08:00
parent 1ec54e0a5f
commit 0831277dc0
83 changed files with 181 additions and 1234 deletions

View File

@ -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;
/**
* 移除视图窗口
*/

View File

@ -1151,12 +1151,6 @@ export interface Snippet {
* snippet 截图
*/
screenshot?: string;
/**
* snippet 打标
*
* @deprecated 暂未使用
*/
label?: string;
/**
* 待插入的 schema
*/

View File

@ -56,7 +56,6 @@ export default {
},
plugins: {
common: {
/**
* ES Module
* @deprecated please use esModule

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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;
}

View File

@ -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) {

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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(),

View File

@ -281,13 +281,6 @@ export class SettingTopEntry implements ISettingTopEntry {
return this.first.document;
}
/**
* @deprecated
*/
get node() {
return this.getNode();
}
getNode() {
return this.nodes[0];
}

View File

@ -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 () => {

View File

@ -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 {

View File

@ -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;

View File

@ -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);
}
/**
*
*/

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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();

View File

@ -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) {

View File

@ -4,7 +4,6 @@ import { configure } from 'mobx';
configure({ enforceActions: 'never' });
export {
observable as obx,
observable,
observe,
autorun,

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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();

View File

@ -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>

View File

@ -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;
}

View File

@ -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>;

View File

@ -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, {

View File

@ -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);

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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

View File

@ -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);
};
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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
*/

View File

@ -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;
}
/**
*
*/

View File

@ -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

View File

@ -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

View File

@ -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') {

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
};

View File

@ -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;
}

View File

@ -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;
/**
*
*/

View File

@ -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,
}

View File

@ -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'
}

View File

@ -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',
}

View File

@ -1,13 +1,4 @@
// eslint-disable-next-line no-shadow
export const enum IPublicEnumTransitionType {
/** 节点更新后重绘处理 */
REPAINT,
}
/**
* @deprecated use IPublicEnumTransitionType instead
*/
export const enum TransitionType {
/** 节点更新后重绘处理 */
REPAINT,
}

View File

@ -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';

View File

@ -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
*/

View File

@ -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

View File

@ -122,10 +122,3 @@ export interface IPublicModelPluginContext {
get editorWindow(): IPublicModelWindow;
}
/**
* @deprecated please use IPublicModelPluginContext instead
*/
export interface ILowCodePluginContext extends IPublicModelPluginContext {
}

View File

@ -1,6 +0,0 @@
import { IPublicModelSettingField } from './';
/**
* @deprecated please use IPublicModelSettingField
*/
export type IPublicModelSettingPropEntry = IPublicModelSettingField;

View File

@ -1,6 +0,0 @@
import { IPublicModelSettingField } from './';
/**
* @deprecated please use IPublicModelSettingField
*/
export type IPublicModelSettingTarget = IPublicModelSettingField;

View File

@ -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;
}

View File

@ -17,16 +17,6 @@ export interface IPublicTypeAssetsJson {
*
*/
components: Array<IPublicTypeComponentDescription | IPublicTypeRemoteComponentDescription>;
/**
*
* @deprecated
*/
componentList?: any[];
/**
*
* @deprecated
*/
bizComponentList?: any[];
/**
* tab category
*/

View File

@ -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
*/

View File

@ -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 {
}

View File

@ -38,14 +38,4 @@ export interface IPublicTypeFieldConfig extends IPublicTypeFieldExtraProps {
*
*/
extraProps?: IPublicTypeFieldExtraProps;
/**
* @deprecated
*/
description?: IPublicTypeTitleContent;
/**
* @deprecated
*/
isExtends?: boolean;
}

View File

@ -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;

View File

@ -20,8 +20,4 @@ export interface IPublicTypePropConfig {
*
*/
defaultValue?: any;
/**
* @deprecated
*/
setter?: any;
}

View File

@ -9,12 +9,6 @@ export interface IPublicResourceTypeConfig {
/** 资源 icon 标识 */
icon?: React.ReactElement | React.FunctionComponent | React.ComponentClass;
/**
*
* @deprecated
*/
defaultViewType?: string;
/** 默认视图类型 */
defaultViewName: string;

View File

@ -19,11 +19,6 @@ export interface IPublicTypeSetterConfig {
*/
props?: Record<string, unknown> | IPublicTypeDynamicProps;
/**
* @deprecated
*/
children?: any;
/**
*
*

View File

@ -14,12 +14,6 @@ export interface IPublicTypeSnippet {
* snippet
*/
screenshot?: string;
/**
* snippet
*
* @deprecated 使
*/
label?: string;
/**
* schema
*/

View File

@ -104,16 +104,6 @@ export interface IPublicTypeJSSlot {
name?: string;
}
/**
* @deprecated
*
* @todo
*/
export interface IPublicTypeJSBlock {
type: 'JSBlock';
value: IPublicTypeNodeSchema;
}
/**
* JSON
*/

View File

@ -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": [

View File

@ -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);
}

View File

@ -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 = {

View File

@ -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",