Skip to content

Commit

Permalink
fix: rename API
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhudev committed Feb 5, 2025
1 parent f8431b3 commit a8ddb49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion packages/sheets/src/facade/f-univer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,19 @@ export interface IFUniverSheetsMixin {
/**
* Create a new spreadsheet and get the API handler of that spreadsheet.
* @param {Partial<IWorkbookData>} data The snapshot of the spreadsheet.
* @param {ICreateUnitOptions} options The options of creating the spreadsheet.
* @returns {FWorkbook} FWorkbook API instance.
* @example
* ```ts
* univerAPI.createWorkbook({ id: 'Sheet1', name: 'Sheet1' });
* ```
*
* Add you can make the workbook not as the active workbook by setting options:
* ```ts
* univerAPI.createWorkbook({ id: 'Sheet1', name: 'Sheet1' }, { makeCurrent: false });
* ```
*/
createWorkbook(data: Partial<IWorkbookData>): FWorkbook;
createWorkbook(data: Partial<IWorkbookData>, options?: ICreateUnitOptions): FWorkbook;

/**
* Get the currently focused Univer spreadsheet.
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/src/facade/f-univer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export interface IFUniverUIMixin {
registerComponent(name: string, component: ComponentType, options?: IComponentOptions): IDisposable;

/**
* Render a unit in the workbench's main area. If you have multi units in Univer,
* Set a unit as the current unit and render a unit in the workbench's main area. If you have multiple units in Univer,
* you should call this method to render the unit.
* @param unitId Unit to be rendered.
*
Expand All @@ -165,12 +165,12 @@ export interface IFUniverUIMixin {
* render `unit2`.
*
* ```ts
* univerAPI.renderUnit('unit2');
* univerAPI.setCurrent('unit2');
* ```
*
* This will render `unit2` in the workbench's main area.
*/
renderUnit(unitId: string): void;
setCurrent(unitId: string): void;
}

/**
Expand Down Expand Up @@ -252,7 +252,7 @@ export class FUniverUIMixin extends FUniver implements IFUniverUIMixin {
return this.disposeWithMe(componentManager.register(name, component, options));
}

override renderUnit(unitId: string): void {
override setCurrent(unitId: string): void {
const rendererManagerService = this._injector.get(IRenderManagerService);
const renderUnit = rendererManagerService.getRenderById(unitId);
if (!renderUnit) {
Expand Down

0 comments on commit a8ddb49

Please sign in to comment.