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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
refactor(sheets-hyper-link)!: rename ICellHyperLink to ISheetHyperLink (#4462)
#FF00005b12f3623f04
diff --git a/packages/sheets-hyper-link-ui/src/services/side-panel.service.ts b/packages/sheets-hyper-link-ui/src/services/side-panel.service.tsindex 316352e79b..e22958a7d2 100644--- a/packages/sheets-hyper-link-ui/src/services/side-panel.service.ts+++ b/packages/sheets-hyper-link-ui/src/services/side-panel.service.ts@@ -14,10 +14,10 @@* limitations under the License.*/+import type { ISheetHyperLink } from '@univerjs/sheets-hyper-link';+import type React from 'react';import { Disposable } from '@univerjs/core';-import type { ICellHyperLink } from '@univerjs/sheets-hyper-link';import { SheetHyperLinkType } from '@univerjs/sheets-hyper-link';-import type React from 'react';export interface ICustomHyperLinkFormProps {linkId: string;@@ -36,8 +36,8 @@ export interface ICustomHyperLinkView {value: string;};Form: React.FC<ICustomHyperLinkFormProps>;- convert: (link: ICellHyperLink) => { display: string; payload: string; type: string };- match: (link: ICellHyperLink) => boolean;+ convert: (link: ISheetHyperLink) => { display: string; payload: string; type: string };+ match: (link: ISheetHyperLink) => boolean;}export class SheetsHyperLinkSidePanelService extends Disposable {@@ -51,7 +51,7 @@ export class SheetsHyperLinkSidePanelService extends Disposable {return Array.from(this._customHyperLinks.values()).map(({ option }) => option);}- findCustomHyperLink(link: ICellHyperLink) {+ findCustomHyperLink(link: ISheetHyperLink) {const customLink = Array.from(this._customHyperLinks.values()).find((item) => item.match(link));return customLink;diff --git a/packages/sheets-hyper-link/src/commands/commands/add-hyper-link.command.ts b/packages/sheets-hyper-link/src/commands/commands/add-hyper-link.command.tsindex 45a954605c..b38d6eabd5 100644--- a/packages/sheets-hyper-link/src/commands/commands/add-hyper-link.command.ts+++ b/packages/sheets-hyper-link/src/commands/commands/add-hyper-link.command.ts@@ -16,7 +16,7 @@import type { ICellData, ICommand, IDocumentData, IMutationInfo } from '@univerjs/core';import type { ISetRangeValuesMutationParams } from '@univerjs/sheets';-import type { ICellHyperLink } from '../../types/interfaces/i-hyper-link';+import type { ISheetHyperLink } from '../../types/interfaces/i-hyper-link';import { BuildTextUtils, CellValueType, CommandType, CustomRangeType, generateRandomId, ICommandService, IUndoRedoService, IUniverInstanceService, sequenceExecuteAsync, TextX, Tools } from '@univerjs/core';import { addCustomRangeBySelectionFactory } from '@univerjs/docs';import { getSheetCommandTarget, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SheetInterceptorService } from '@univerjs/sheets';@@ -27,7 +27,7 @@ import { RemoveHyperLinkMutation } from '../mutations/remove-hyper-link.mutationexport interface IAddHyperLinkCommandParams {unitId: string;subUnitId: string;- link: ICellHyperLink;+ link: ISheetHyperLink;}/*** Command for add hyperlink@@ -170,7 +170,7 @@ export interface IAddRichHyperLinkCommandParams {* url of link*/documentId: string;- link: ICellHyperLink;+ link: ISheetHyperLink;}export const AddRichHyperLinkCommand: ICommand<IAddRichHyperLinkCommandParams> = {diff --git a/packages/sheets-hyper-link/src/commands/mutations/add-hyper-link.mutation.ts b/packages/sheets-hyper-link/src/commands/mutations/add-hyper-link.mutation.tsindex 7258ebcf80..996afaa81d 100644--- a/packages/sheets-hyper-link/src/commands/mutations/add-hyper-link.mutation.ts+++ b/packages/sheets-hyper-link/src/commands/mutations/add-hyper-link.mutation.ts@@ -15,14 +15,14 @@*/import type { ICommand } from '@univerjs/core';+import type { ISheetHyperLink } from '../../types/interfaces/i-hyper-link';import { CommandType } from '@univerjs/core';import { HyperLinkModel } from '../../models/hyper-link.model';-import type { ICellHyperLink } from '../../types/interfaces/i-hyper-link';export interface IAddHyperLinkMutationParams {unitId: string;subUnitId: string;- link: ICellHyperLink;+ link: ISheetHyperLink;}export const AddHyperLinkMutation: ICommand<IAddHyperLinkMutationParams> = {diff --git a/packages/sheets-hyper-link/src/controllers/ref-range.controller.ts b/packages/sheets-hyper-link/src/controllers/ref-range.controller.tsindex a5bcd7bba8..a2216bfe86 100644--- a/packages/sheets-hyper-link/src/controllers/ref-range.controller.ts+++ b/packages/sheets-hyper-link/src/controllers/ref-range.controller.ts@@ -19,7 +19,7 @@ import type { EffectRefRangeParams } from '@univerjs/sheets';import type { IAddHyperLinkMutationParams } from '../commands/mutations/add-hyper-link.mutation';import type { IRemoveHyperLinkMutationParams } from '../commands/mutations/remove-hyper-link.mutation';import type { IUpdateHyperLinkMutationParams, IUpdateHyperLinkRefMutationParams } from '../commands/mutations/update-hyper-link.mutation';-import type { ICellHyperLink } from '../types/interfaces/i-hyper-link';+import type { ISheetHyperLink } from '../types/interfaces/i-hyper-link';import { Disposable, ICommandService, Inject, isValidRange, sequenceExecuteAsync, toDisposable } from '@univerjs/core';import { deserializeRangeWithSheet, serializeRange } from '@univerjs/engine-formula';import { handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests, RefRangeService, SheetsSelectionsService } from '@univerjs/sheets';@@ -46,7 +46,7 @@ export class SheetsHyperLinkRefRangeController extends Disposable {this._initRefRange();}- private _handlePositionChange = (unitId: string, subUnitId: string, link: ICellHyperLink, resultRange: Nullable<IRange>, silent: boolean) => {+ private _handlePositionChange = (unitId: string, subUnitId: string, link: ISheetHyperLink, resultRange: Nullable<IRange>, silent: boolean) => {const oldRange: IRange = {startColumn: link.column,endColumn: link.column,@@ -100,7 +100,7 @@ export class SheetsHyperLinkRefRangeController extends Disposable {};};- private _registerPosition(unitId: string, subUnitId: string, link: ICellHyperLink) {+ private _registerPosition(unitId: string, subUnitId: string, link: ISheetHyperLink) {const id = link.id;const oldRange: IRange = {startColumn: link.column,@@ -125,7 +125,7 @@ export class SheetsHyperLinkRefRangeController extends Disposable {this._disposableMap.set(id, this._refRangeService.registerRefRange(oldRange, handleRefRangeChange, unitId, subUnitId));}- private _watchPosition(unitId: string, subUnitId: string, link: ICellHyperLink) {+ private _watchPosition(unitId: string, subUnitId: string, link: ISheetHyperLink) {const id = link.id;const oldRange: IRange = {startColumn: link.column,diff --git a/packages/sheets-hyper-link/src/controllers/sheet-hyper-link-resource.controller.ts b/packages/sheets-hyper-link/src/controllers/sheet-hyper-link-resource.controller.tsindex 54499c6e87..c53da04657 100644--- a/packages/sheets-hyper-link/src/controllers/sheet-hyper-link-resource.controller.ts+++ b/packages/sheets-hyper-link/src/controllers/sheet-hyper-link-resource.controller.ts@@ -14,13 +14,13 @@* limitations under the License.*/-import type { ICellHyperLink } from '../types/interfaces/i-hyper-link';+import type { ISheetHyperLink } from '../types/interfaces/i-hyper-link';import { Disposable, Inject, IResourceManagerService } from '@univerjs/core';import { UniverType } from '@univerjs/protocol';import { HyperLinkModel } from '../models/hyper-link.model';import { SHEET_HYPER_LINK_PLUGIN } from '../types/const';-type UnitHyperLinkJSON = Record<string, ICellHyperLink[]>;+type UnitHyperLinkJSON = Record<string, ISheetHyperLink[]>;export class SheetsHyperLinkResourceController extends Disposable {constructor(diff --git a/packages/sheets-hyper-link/src/index.ts b/packages/sheets-hyper-link/src/index.tsindex 72b48f4901..ca1ba4e1bf 100644--- a/packages/sheets-hyper-link/src/index.ts+++ b/packages/sheets-hyper-link/src/index.ts@@ -17,7 +17,7 @@export { HyperLinkModel } from './models/hyper-link.model';export { SheetHyperLinkType } from './types/enums/hyper-link-type';export { UniverSheetsHyperLinkPlugin } from './plugin';-export type { ICellHyperLink, ICellLinkContent } from './types/interfaces/i-hyper-link';+export type { ICellLinkContent, ISheetHyperLink } from './types/interfaces/i-hyper-link';export { type ISheetHyperLinkInfo, type ISheetUrlParams, SheetsHyperLinkParserService } from './services/parser.service';export { ERROR_RANGE } from './types/const';diff --git a/packages/sheets-hyper-link/src/models/hyper-link.model.ts b/packages/sheets-hyper-link/src/models/hyper-link.model.tsindex b4ad12b365..9a3d6cc13c 100644--- a/packages/sheets-hyper-link/src/models/hyper-link.model.ts+++ b/packages/sheets-hyper-link/src/models/hyper-link.model.ts@@ -14,20 +14,20 @@* limitations under the License.*/+import type { Workbook } from '@univerjs/core';+import type { ICellLinkContent, ISheetHyperLink } from '../types/interfaces/i-hyper-link';import { Disposable, IUniverInstanceService, ObjectMatrix, UniverInstanceType } from '@univerjs/core';import { Subject } from 'rxjs';-import type { Workbook } from '@univerjs/core';-import type { ICellHyperLink, ICellLinkContent } from '../types/interfaces/i-hyper-link';type LinkUpdate = {type: 'add';- payload: ICellHyperLink;+ payload: ISheetHyperLink;unitId: string;subUnitId: string;silent?: boolean;} | {type: 'remove';- payload: ICellHyperLink;+ payload: ISheetHyperLink;unitId: string;subUnitId: string;silent?: boolean;@@ -51,7 +51,7 @@ type LinkUpdate = {unitLinks: {unitId: string;subUnitId: string;- links: ICellHyperLink[];+ links: ISheetHyperLink[];}[];silent?: boolean;};@@ -60,8 +60,8 @@ export class HyperLinkModel extends Disposable {private _linkUpdate$ = new Subject<LinkUpdate>();linkUpdate$ = this._linkUpdate$.asObservable();- private _linkMap: Map<string, Map<string, ObjectMatrix<ICellHyperLink>>> = new Map();- private _linkPositionMap: Map<string, Map<string, Map<string, { row: number; column: number; link: ICellHyperLink }>>> = new Map();+ private _linkMap: Map<string, Map<string, ObjectMatrix<ISheetHyperLink>>> = new Map();+ private _linkPositionMap: Map<string, Map<string, Map<string, { row: number; column: number; link: ISheetHyperLink }>>> = new Map();constructor(@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService@@ -104,7 +104,7 @@ export class HyperLinkModel extends Disposable {};}- addHyperLink(unitId: string, subUnitId: string, link: ICellHyperLink) {+ addHyperLink(unitId: string, subUnitId: string, link: ISheetHyperLink) {const { matrix, positionMap } = this._ensureMap(unitId, subUnitId);matrix.setValue(link.row, link.column, link);positionMap.set(link.id, { row: link.row, column: link.column, link });@@ -208,7 +208,7 @@ export class HyperLinkModel extends Disposable {return matrix.getValue(position.row, position.column);}- getHyperLinkByLocation(unitId: string, subUnitId: string, row: number, column: number): ICellHyperLink | undefined {+ getHyperLinkByLocation(unitId: string, subUnitId: string, row: number, column: number): ISheetHyperLink | undefined {const { matrix } = this._ensureMap(unitId, subUnitId);return matrix.getValue(row, column)!;}@@ -232,7 +232,7 @@ export class HyperLinkModel extends Disposable {getSubUnit(unitId: string, subUnitId: string) {const { matrix } = this._ensureMap(unitId, subUnitId);- const links: ICellHyperLink[] = [];+ const links: ISheetHyperLink[] = [];matrix.forValue((row, col, value) => {if (value) {links.push(value);diff --git a/packages/sheets-hyper-link/src/types/interfaces/i-hyper-link.ts b/packages/sheets-hyper-link/src/types/interfaces/i-hyper-link.tsindex 2673229114..9943555761 100644--- a/packages/sheets-hyper-link/src/types/interfaces/i-hyper-link.ts+++ b/packages/sheets-hyper-link/src/types/interfaces/i-hyper-link.ts@@ -29,7 +29,7 @@ export interface ICellLinkContent {display?: string;}-export interface ICellHyperLink extends ICellLinkContent {+export interface ISheetHyperLink extends ICellLinkContent {/*** unique id*/diff --git a/packages/sheets/src/facade/f-workbook.ts b/packages/sheets/src/facade/f-workbook.tsindex 4ce04d79c4..70ef6ab3bd 100644--- a/packages/sheets/src/facade/f-workbook.ts+++ b/packages/sheets/src/facade/f-workbook.ts@@ -17,6 +17,7 @@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 { 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';@@ -852,3 +853,10 @@ export class FWorkbook extends FBaseInitialable {return this._workbook.getCustomMetadata();}}++// eslint-disable-next-line ts/no-namespace+export namespace FWorkbook {+ export type FontLine = _FontLine;+ export type FontStyle = _FontLine;+ export type FontWeight = _FontLine;+}diff --git a/packages/sheets/src/facade/index.ts b/packages/sheets/src/facade/index.tsindex a71f0d4834..38be3d0bb1 100644--- a/packages/sheets/src/facade/index.ts+++ b/packages/sheets/src/facade/index.ts@@ -19,7 +19,6 @@ import './f-univer';export * from './f-event';export { FPermission } from './f-permission';export { FRange } from './f-range';-export type { FontLine, FontStyle, FontWeight } from './f-range';export { FSelection } from './f-selection';export { FSheetHooks } from './f-sheet-hooks';