Skip to content

Commit

Permalink
feat: add editorCabinSymbol and skeletonCabinSymbol
Browse files Browse the repository at this point in the history
  • Loading branch information
liujuping authored and JackLian committed Aug 25, 2023
1 parent bf980c9 commit e3842b0
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/engine/src/modules/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
propSymbol,
simulatorHostSymbol,
skeletonItemSymbol,
editorCabinSymbol,
skeletonCabinSymbol,
} from '@alilc/lowcode-shell';

export default {
Expand All @@ -25,6 +27,8 @@ export default {
settingPropEntrySymbol: settingFieldSymbol,
settingTopEntrySymbol,
designerCabinSymbol,
editorCabinSymbol,
skeletonCabinSymbol,
propSymbol,
simulatorHostSymbol,
skeletonItemSymbol,
Expand Down
49 changes: 48 additions & 1 deletion packages/shell/src/api/common.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -36,13 +36,19 @@ 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,
createSettingFieldView as innerCreateSettingFieldView,
PopupContext as InnerPopupContext,
PopupPipe as InnerPopupPipe,
Workbench as InnerWorkbench,
SettingsPrimaryPane as InnerSettingsPrimaryPane,
registerDefaults as InnerRegisterDefaults,
} from '@alilc/lowcode-editor-skeleton';
import {
Editor,
Expand All @@ -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';
Expand Down Expand Up @@ -94,6 +101,10 @@ class DesignerCabin implements IPublicApiCommonDesignerCabin {
DragObjectType: InnerDragObjectType,
isDragNodeDataObject: innerIsDragNodeDataObject,
isNode: innerIsNode,
DropLocation: InnerDropLocation,
Designer: InnerDesigner,
Node: InnerNode,
LowCodePluginManager: InnerLowCodePluginManager,
};
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
};
}

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/shell/src/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit e3842b0

Please sign in to comment.