Skip to content

Commit

Permalink
feat(facade): add component api (#4125)
Browse files Browse the repository at this point in the history
  • Loading branch information
weird94 authored Nov 22, 2024
1 parent 19808d0 commit e0025ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/ui/src/common/component-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ import { cloneElement, createElement, useEffect, useRef } from 'react';

type ComponentFramework = 'vue3' | 'react';

interface IComponentOptions {
export interface IComponentOptions {
framework?: ComponentFramework;
}

Expand Down
12 changes: 11 additions & 1 deletion packages/ui/src/facade/f-univer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import type { IDisposable } from '@univerjs/core';
import type { IDialogPartMethodOptions, ISidebarMethodOptions } from '@univerjs/ui';
import { FUniver } from '@univerjs/core';
import { CopyCommand, IDialogService, ISidebarService, PasteCommand } from '@univerjs/ui';
import { ComponentManager, CopyCommand, IDialogService, ISidebarService, PasteCommand } from '@univerjs/ui';

interface IFUniverUIMixin {
copy(): Promise<boolean>;
Expand All @@ -37,6 +37,12 @@ interface IFUniverUIMixin {
* @returns the disposable object
*/
openDialog(dialog: IDialogPartMethodOptions): IDisposable;

/**
* Get the component manager
* @returns The component manager
*/
getComponentManager(): ComponentManager;
}

class FUniverUIMixin extends FUniver implements IFUniverUIMixin {
Expand All @@ -63,6 +69,10 @@ class FUniverUIMixin extends FUniver implements IFUniverUIMixin {
});
return disposable;
}

override getComponentManager(): ComponentManager {
return this._injector.get(ComponentManager);
}
}

FUniver.extend(FUniverUIMixin);
Expand Down

0 comments on commit e0025ab

Please sign in to comment.