feat: add editorCabinSymbol and skeletonCabinSymbol

This commit is contained in:
liujuping 2023-08-25 16:43:16 +08:00 committed by 林熠
parent bf980c98ea
commit e3842b0531
3 changed files with 54 additions and 1 deletions

View File

@ -12,6 +12,8 @@ import {
propSymbol,
simulatorHostSymbol,
skeletonItemSymbol,
editorCabinSymbol,
skeletonCabinSymbol,
} from '@alilc/lowcode-shell';
export default {
@ -25,6 +27,8 @@ export default {
settingPropEntrySymbol: settingFieldSymbol,
settingTopEntrySymbol,
designerCabinSymbol,
editorCabinSymbol,
skeletonCabinSymbol,
propSymbol,
simulatorHostSymbol,
skeletonItemSymbol,

View File

@ -1,4 +1,4 @@
import { editorSymbol, skeletonSymbol, designerCabinSymbol, designerSymbol, settingFieldSymbol } from '../symbols';
import { editorSymbol, skeletonSymbol, designerCabinSymbol, designerSymbol, settingFieldSymbol, editorCabinSymbol, skeletonCabinSymbol } from '../symbols';
import {
isFormEvent as innerIsFormEvent,
compatibleLegaoSchema as innerCompatibleLegaoSchema,
@ -36,6 +36,10 @@ import {
getConvertedExtraKey as innerGetConvertedExtraKey,
getOriginalExtraKey as innerGetOriginalExtraKey,
IDesigner,
DropLocation as InnerDropLocation,
Designer as InnerDesigner,
Node as InnerNode,
LowCodePluginManager as InnerLowCodePluginManager,
} from '@alilc/lowcode-designer';
import {
Skeleton as InnerSkeleton,
@ -43,6 +47,8 @@ import {
PopupContext as InnerPopupContext,
PopupPipe as InnerPopupPipe,
Workbench as InnerWorkbench,
SettingsPrimaryPane as InnerSettingsPrimaryPane,
registerDefaults as InnerRegisterDefaults,
} from '@alilc/lowcode-editor-skeleton';
import {
Editor,
@ -61,6 +67,7 @@ import {
action as innerAction,
runInAction as innerRunInAction,
engineConfig as innerEngineConfig,
globalContext,
} from '@alilc/lowcode-editor-core';
import { Dragon as ShellDragon } from '../model';
import { ReactNode } from 'react';
@ -94,6 +101,10 @@ class DesignerCabin implements IPublicApiCommonDesignerCabin {
DragObjectType: InnerDragObjectType,
isDragNodeDataObject: innerIsDragNodeDataObject,
isNode: innerIsNode,
DropLocation: InnerDropLocation,
Designer: InnerDesigner,
Node: InnerNode,
LowCodePluginManager: InnerLowCodePluginManager,
};
}
@ -160,8 +171,19 @@ class DesignerCabin implements IPublicApiCommonDesignerCabin {
class SkeletonCabin implements IPublicApiCommonSkeletonCabin {
private readonly [skeletonSymbol]: InnerSkeleton;
readonly [skeletonCabinSymbol]: any;
constructor(skeleton: InnerSkeleton) {
this[skeletonSymbol] = skeleton;
this[skeletonCabinSymbol] = {
Workbench: this.Workbench,
createSettingFieldView: this.createSettingFieldView,
PopupContext: InnerPopupContext,
PopupPipe: InnerPopupPipe,
SettingsPrimaryPane: InnerSettingsPrimaryPane,
registerDefaults: InnerRegisterDefaults,
Skeleton: InnerSkeleton,
};
}
get Workbench(): any {
@ -242,8 +264,33 @@ class Utils implements IPublicApiCommonUtils {
class EditorCabin implements IPublicApiCommonEditorCabin {
private readonly [editorSymbol]: Editor;
/**
* @deprecated
*/
readonly [editorCabinSymbol]: any;
constructor(editor: Editor) {
this[editorSymbol] = editor;
this[editorCabinSymbol] = {
Editor,
globalContext,
runInAction: innerRunInAction,
Title: InnerTitle,
Tip: InnerTip,
shallowIntl: innerShallowIntl,
createIntl: innerCreateIntl,
intl: innerIntl,
createSetterContent: this.createSetterContent.bind(this),
globalLocale: innerGlobalLocale,
obx: innerObx,
action: innerAction,
engineConfig: innerEngineConfig,
observable: innerObservable,
makeObservable: innerMakeObservable,
untracked: innerUntracked,
computed: innerComputed,
observer: innerObserver,
};
}
/**

View File

@ -24,6 +24,8 @@ export const simulatorHostSymbol = Symbol('simulatorHost');
export const dragObjectSymbol = Symbol('dragObject');
export const locateEventSymbol = Symbol('locateEvent');
export const designerCabinSymbol = Symbol('designerCabin');
export const editorCabinSymbol = Symbol('editorCabin');
export const skeletonCabinSymbol = Symbol('skeletonCabin');
export const hotkeySymbol = Symbol('hotkey');
export const pluginsSymbol = Symbol('plugins');
export const workspaceSymbol = Symbol('workspace');