mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-05 01:37:17 +00:00
chore: merge from develop
This commit is contained in:
parent
46789ac581
commit
0f38cc8e3d
@ -26,7 +26,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@alib/build-scripts": "^0.1.29",
|
||||
"@alilc/lowcode-shell": "1.1.0-beta.7",
|
||||
"@testing-library/react": "^11.2.2",
|
||||
"@types/classnames": "^2.2.7",
|
||||
"@types/enzyme": "^3.10.12",
|
||||
|
||||
@ -29,6 +29,7 @@ export class LowCodePluginManager implements ILowCodePluginManager {
|
||||
private plugins: ILowCodePluginRuntime[] = [];
|
||||
|
||||
pluginsMap: Map<string, ILowCodePluginRuntime> = new Map();
|
||||
pluginContextMap: Map<string, LowCodePluginContext> = new Map();
|
||||
|
||||
private pluginPreference?: PluginPreference = new Map();
|
||||
|
||||
@ -39,7 +40,13 @@ export class LowCodePluginManager implements ILowCodePluginManager {
|
||||
}
|
||||
|
||||
_getLowCodePluginContext = (options: IPluginContextOptions) => {
|
||||
return new LowCodePluginContext(options, this.contextApiAssembler);
|
||||
const { pluginName } = options;
|
||||
let context = this.pluginContextMap.get(pluginName);
|
||||
if (!context) {
|
||||
context = new LowCodePluginContext(options, this.contextApiAssembler);
|
||||
this.pluginContextMap.set(pluginName, context);
|
||||
}
|
||||
return context;
|
||||
};
|
||||
|
||||
isEngineVersionMatched(versionExp: string): boolean {
|
||||
|
||||
@ -13,7 +13,7 @@ export class SettingsMain {
|
||||
|
||||
private _sessionId = '';
|
||||
|
||||
@obx.ref private _settings?: SettingTopEntry;
|
||||
@obx.ref private _settings?: SettingTopEntry | null = null;
|
||||
|
||||
@computed get length(): number | undefined {
|
||||
return this._settings?.nodes.length;
|
||||
@ -23,7 +23,7 @@ export class SettingsMain {
|
||||
return this._settings?.componentMeta;
|
||||
}
|
||||
|
||||
get settings() {
|
||||
@computed get settings() {
|
||||
return this._settings;
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ export class SettingsMain {
|
||||
this.disposeListener = () => {
|
||||
this.editor.removeListener('designer.selection.change', setupSelection);
|
||||
};
|
||||
const designer = await this.editor.onceGot(Designer);
|
||||
const designer = await this.editor.onceGot('designer');
|
||||
this.designer = designer;
|
||||
setupSelection(designer.currentSelection);
|
||||
}
|
||||
|
||||
@ -10,11 +10,11 @@ import { SkeletonContext } from '../../context';
|
||||
import { createIcon, isSettingField } from '@alilc/lowcode-utils';
|
||||
|
||||
@observer
|
||||
export class SettingsPrimaryPane extends Component<{ editor: Editor; config: any }, { shouldIgnoreRoot: boolean }> {
|
||||
export class SettingsPrimaryPane extends Component<{ engineEditor: Editor; config: any }, { shouldIgnoreRoot: boolean }> {
|
||||
state = {
|
||||
shouldIgnoreRoot: false,
|
||||
};
|
||||
private main;
|
||||
private main = new SettingsMain(this.props.engineEditor);
|
||||
|
||||
@obx.ref private _activeKey?: any;
|
||||
|
||||
@ -29,8 +29,7 @@ export class SettingsPrimaryPane extends Component<{ editor: Editor; config: any
|
||||
componentDidMount() {
|
||||
this.setShouldIgnoreRoot();
|
||||
|
||||
const workspace = globalContext.get('workspace');
|
||||
const editor = workspace.isActive ? workspace.window.editor : globalContext.get('editor');
|
||||
const editor = this.props.engineEditor;
|
||||
|
||||
editor.eventBus.on('designer.selection.change', () => {
|
||||
if (!engineConfig.get('stayOnTheSameSettingTab', false)) {
|
||||
@ -135,8 +134,7 @@ export class SettingsPrimaryPane extends Component<{ editor: Editor; config: any
|
||||
|
||||
render() {
|
||||
const { settings } = this.main;
|
||||
const workspace = globalContext.get('workspace');
|
||||
const editor = workspace.isActive ? workspace.window.editor : globalContext.get('editor');
|
||||
const editor = this.props.engineEditor;
|
||||
if (!settings) {
|
||||
// 未选中节点,提示选中 或者 显示根节点设置
|
||||
return (
|
||||
|
||||
@ -77,7 +77,7 @@ const { project: innerProject } = designer;
|
||||
const innerHotkey = new InnerHotkey();
|
||||
const hotkey = new Hotkey(innerHotkey);
|
||||
const project = new Project(innerProject);
|
||||
const skeleton = new Skeleton(innerSkeleton);
|
||||
const skeleton = new Skeleton(innerSkeleton, 'any', false);
|
||||
const innerSetters = new InnerSetters();
|
||||
const setters = new Setters(innerSetters);
|
||||
|
||||
@ -98,7 +98,7 @@ const pluginContextApiAssembler: ILowCodePluginContextApiAssembler = {
|
||||
assembleApis: (context: ILowCodePluginContextPrivate, pluginName: string, meta: IPublicTypePluginMeta) => {
|
||||
context.hotkey = hotkey;
|
||||
context.project = project;
|
||||
context.skeleton = skeleton;
|
||||
context.skeleton = new Skeleton(innerSkeleton, pluginName, false);
|
||||
context.setters = setters;
|
||||
context.material = material;
|
||||
const eventPrefix = meta?.eventPrefix || 'common';
|
||||
|
||||
@ -22,7 +22,9 @@ export const defaultPanelRegistry = (editor: any, designer: any) => {
|
||||
area: 'rightArea',
|
||||
name: 'settingsPane',
|
||||
type: 'Panel',
|
||||
content: SettingsPrimaryPane,
|
||||
content: <SettingsPrimaryPane
|
||||
engineEditor={editor}
|
||||
/>,
|
||||
props: {
|
||||
ignoreRoot: true,
|
||||
},
|
||||
|
||||
@ -9,6 +9,7 @@ import { IPublicApiSkeleton, IPublicTypeWidgetBaseConfig, IPublicTypeWidgetConfi
|
||||
const innerSkeletonSymbol = Symbol('skeleton');
|
||||
export class Skeleton implements IPublicApiSkeleton {
|
||||
private readonly [innerSkeletonSymbol]: InnerSkeleton;
|
||||
private readonly pluginName: string;
|
||||
|
||||
get [skeletonSymbol]() {
|
||||
if (this.workspaceMode) {
|
||||
@ -22,8 +23,9 @@ export class Skeleton implements IPublicApiSkeleton {
|
||||
return this[innerSkeletonSymbol];
|
||||
}
|
||||
|
||||
constructor(skeleton: InnerSkeleton, readonly workspaceMode: boolean = false) {
|
||||
constructor(skeleton: InnerSkeleton, pluginName: string, readonly workspaceMode: boolean = false) {
|
||||
this[innerSkeletonSymbol] = skeleton;
|
||||
this.pluginName = pluginName;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -33,7 +35,11 @@ export class Skeleton implements IPublicApiSkeleton {
|
||||
* @returns
|
||||
*/
|
||||
add(config: IPublicTypeWidgetBaseConfig, extraConfig?: Record<string, any>) {
|
||||
return this[skeletonSymbol].add(config, extraConfig);
|
||||
const configWithName = {
|
||||
...config,
|
||||
pluginName: this.pluginName,
|
||||
};
|
||||
return this[skeletonSymbol].add(configWithName, extraConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -82,7 +82,7 @@ export class BasicContext {
|
||||
const config = engineConfig;
|
||||
const event = new Event(editor, { prefix: 'common' });
|
||||
const logger = getLogger({ level: 'warn', bizName: 'common' });
|
||||
const skeleton = new Skeleton(innerSkeleton, true);
|
||||
const skeleton = new Skeleton(innerSkeleton, 'any', true);
|
||||
editor.set('setters', setters);
|
||||
editor.set('project', project);
|
||||
editor.set('material', material);
|
||||
@ -110,7 +110,7 @@ export class BasicContext {
|
||||
context.workspace = workspace;
|
||||
context.hotkey = hotkey;
|
||||
context.project = project;
|
||||
context.skeleton = skeleton;
|
||||
context.skeleton = new Skeleton(innerSkeleton, pluginName, true);
|
||||
context.setters = setters;
|
||||
context.material = material;
|
||||
const eventPrefix = meta?.eventPrefix || 'common';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user