Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

chore: update source facade (#4536)

ybzky920b6d3a6a96
diff --git a/packages-experimental/sheets-source-binding/src/controllers/binding-manager.ts b/packages-experimental/sheets-source-binding/src/controllers/binding-manager.ts
index ec536cbe9d..84a71e0226 100644
--- a/packages-experimental/sheets-source-binding/src/controllers/binding-manager.ts
+++ b/packages-experimental/sheets-source-binding/src/controllers/binding-manager.ts
@@ -23,7 +23,7 @@ import { Subject } from 'rxjs';
import { SheetBindingModel } from '../model/binding-model';
import { BindingSourceChangeTypeEnum, DataBindingNodeTypeEnum } from '../types';
-interface IBindingNodeInfo {
+export interface IBindingNodeInfo {
unitId: string;
subunitId: string;
sourceId: string;
diff --git a/packages-experimental/sheets-source-binding/src/facade/f-workbook.ts b/packages-experimental/sheets-source-binding/src/facade/f-workbook.ts
index 08cbac761c..5ca719203b 100644
--- a/packages-experimental/sheets-source-binding/src/facade/f-workbook.ts
+++ b/packages-experimental/sheets-source-binding/src/facade/f-workbook.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import type { DataBindingNodeTypeEnum, ISourceBindingInfo, SourceModelBase } from '@univerjs/sheets-source-binding';
+import type { DataBindingNodeTypeEnum, IBindingNodeInfo, ISourceBindingInfo, SourceModelBase } from '@univerjs/sheets-source-binding';
import { SheetsSourceBindService, SheetsSourceManager } from '@univerjs/sheets-source-binding';
import { FWorkbook } from '@univerjs/sheets/facade';
@@ -64,6 +64,8 @@ export interface IFWorkbookSourceBindingMixin {
loadSourceBindingPathInfo(obj: ISourceBindingInfo): void;
saveSourceBindingPathInfo(): ISourceBindingInfo;
+
+ getBindingModelBySourceId(sourceId: string): IBindingNodeInfo[];
}
export class FWorkbookSourceBinding extends FWorkbook implements IFWorkbookSourceBindingMixin {
@@ -108,6 +110,12 @@ export class FWorkbookSourceBinding extends FWorkbook implements IFWorkbookSourc
const sheetsSourceBindService = injector.get(SheetsSourceBindService);
return sheetsSourceBindService.getSourceBindingPathInfo(this.getId());
}
+
+ override getBindingModelBySourceId(sourceId: string): IBindingNodeInfo[] {
+ const injector = this._injector;
+ const sheetsSourceBindService = injector.get(SheetsSourceBindService);
+ return sheetsSourceBindService.getBindingModelBySourceId(sourceId);
+ }
}
FWorkbook.extend(FWorkbookSourceBinding);
diff --git a/packages-experimental/sheets-source-binding/src/index.ts b/packages-experimental/sheets-source-binding/src/index.ts
index ab8d30244b..29aafb945b 100644
--- a/packages-experimental/sheets-source-binding/src/index.ts
+++ b/packages-experimental/sheets-source-binding/src/index.ts
@@ -21,3 +21,4 @@ export { BindModeEnum, DataBindingNodeTypeEnum } from './types';
export { SheetsSourceBindService } from './services/source-binding-service';
export { SheetsSourceManager } from './controllers/source-manager';
export type { ICellBindingNode, ICellBindingNodeParam, ISourceBindingInfo } from './types';
+export type { IBindingNodeInfo } from './controllers/binding-manager';
diff --git a/packages/sheets/src/facade/f-workbook.ts b/packages/sheets/src/facade/f-workbook.ts
index 5081e2f453..be1a8ce0e4 100644
--- a/packages/sheets/src/facade/f-workbook.ts
+++ b/packages/sheets/src/facade/f-workbook.ts
@@ -16,11 +16,11 @@
import type { CommandListener, CustomData, ICommandInfo, IDisposable, IRange, IWorkbookData, LocaleType, Workbook } from '@univerjs/core';
import type { ISetDefinedNameMutationParam } from '@univerjs/engine-formula';
-import type { ISetSelectionsOperationParams, ISheetCommandSharedParams, RangeThemeStyle } from '@univerjs/sheets';
+import type { IRangeThemeStyleJSON, ISetSelectionsOperationParams, ISheetCommandSharedParams } from '@univerjs/sheets';
import type { FontLine as _FontLine } from './f-range';
import { FBaseInitialable, ICommandService, ILogService, Inject, Injector, IPermissionService, IResourceLoaderService, IUniverInstanceService, LocaleService, mergeWorksheetSnapshotWithDefault, RedoCommand, toDisposable, UndoCommand, UniverInstanceType } from '@univerjs/core';
import { IDefinedNamesService } from '@univerjs/engine-formula';
-import { CopySheetCommand, getPrimaryForRange, InsertSheetCommand, RegisterWorksheetRangeThemeStyleCommand, RemoveSheetCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SetDefinedNameCommand, SetSelectionsOperation, SetWorksheetActiveOperation, SetWorksheetOrderCommand, SheetRangeThemeService, SheetsSelectionsService, UnregisterWorksheetRangeThemeStyleCommand, WorkbookEditablePermission } from '@univerjs/sheets';
+import { CopySheetCommand, getPrimaryForRange, InsertSheetCommand, RangeThemeStyle, RegisterWorksheetRangeThemeStyleCommand, RemoveSheetCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SetDefinedNameCommand, SetSelectionsOperation, SetWorksheetActiveOperation, SetWorksheetOrderCommand, SheetRangeThemeService, SheetsSelectionsService, UnregisterWorksheetRangeThemeStyleCommand, WorkbookEditablePermission } from '@univerjs/sheets';
import { FDefinedName, FDefinedNameBuilder } from './f-defined-name';
import { FPermission } from './f-permission';
import { FRange } from './f-range';
@@ -847,6 +847,10 @@ export class FWorkbook extends FBaseInitialable {
});
}
+ createRangeThemeStyle(themeName: string, themeStyleJson?: Omit<IRangeThemeStyleJSON, 'name'>): RangeThemeStyle {
+ return new RangeThemeStyle(themeName, themeStyleJson);
+ }
+
/**
* Set custom metadata of workbook
* @param {CustomData | undefined} custom custom metadata
diff --git a/packages/sheets/src/index.ts b/packages/sheets/src/index.ts
index 7312d3df96..2d6bcab7b1 100644
--- a/packages/sheets/src/index.ts
+++ b/packages/sheets/src/index.ts
@@ -56,6 +56,7 @@ export { type IUniverSheetsConfig } from './controllers/config.schema';
export { MAX_CELL_PER_SHEET_KEY } from './controllers/config/config';
export { BorderStyleManagerService, type IBorderInfo } from './services/border-style-manager.service';
export { SheetRangeThemeService } from './services/range-theme-service';
+export type { IRangeThemeStyleJSON } from './model/range-theme-util';
export * from './services/permission/permission-point';
export { WorksheetPermissionService } from './services/permission/worksheet-permission/worksheet-permission.service';
export { WorkbookPermissionService } from './services/permission/workbook-permission/workbook-permission.service';