@univerjssheets-uiindexclassesBaseselectionrenderservice

@univerjs/sheets-ui v0.5.4


Class: BaseSelectionRenderService

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:95

The basic implementation of selection rendering logics. It is designed to be reused for different purposes.

Extends

Extended by

Implements

Constructors

new BaseSelectionRenderService()

new BaseSelectionRenderService(
   _injector, 
   _themeService, 
   _shortcutService, 
   _sheetSkeletonManagerService, 
   contextService): BaseSelectionRenderService

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:190

Parameters

ParameterType
_injectorInjector
_themeServiceThemeService
_shortcutServiceIShortcutService
_sheetSkeletonManagerServiceSheetSkeletonManagerService
contextServiceIContextService

Returns

BaseSelectionRenderService

Overrides

Disposable.constructor

Properties

PropertyModifierTypeDefault valueDescriptionInherited fromDefined in
_activeControlIndexprotectednumber-1--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:118
_activeViewportprotectedNullable<Viewport>undefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:184
_disposedprotectedbooleanfalse-Disposable._disposedsubmodules/univer/packages/core/src/shared/lifecycle.ts:96
_escapeShortcutDisposableprotectedNullable<IDisposable>null--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:188
_highlightHeaderprotectedbooleantrue--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:143
_injectorreadonlyInjectorundefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:191
_rangeTypeprotectedRANGE_TYPERANGE_TYPE.NORMAL--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:146
_remainLastEnabledprotectedbooleanfalse--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:154
_sceneprotectedSceneundefinedFrom renderContext.-submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:140
_scenePointerMoveSubprotectedNullable<Subscription>undefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:97
_scenePointerUpSubprotectedNullable<Subscription>undefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:98
_scrollTimerprotectedScrollTimerundefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:130
_selectionControlsprotectedSelectionControl[][]--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:105
_selectionMoveEnd$readonlyBehaviorSubject<ISelectionWithCoord[]>undefinedMainly emit by pointerup in spreadsheet. (pointerup is handled in _onPointerdown)-submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:162
_selectionMoveStart$readonlySubject<ISelectionWithCoord[]>undefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:175
_selectionMoving$readonlySubject<ISelectionWithCoord[]>undefinedMainly emit by pointermove in spreadsheet-submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:170
_selectionStyleprotectedISelectionStyleundefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:149
_selectionThemeprotectedThemeServiceundefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:179
_sheetSkeletonManagerServicereadonlySheetSkeletonManagerServiceundefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:195
_shortcutServicereadonlyIShortcutServiceundefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:194
_singleSelectionEnabledprotectedbooleanfalse--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:156
_skeletonprotectedSpreadsheetSkeletonundefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:135
_skipLastEnabledprotectedbooleanfalse--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:155
_startRangeWhenPointerDownprotectedIRangeWithCoordundefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:107
_startViewportPosXprotectednumber0the posX of viewport when the pointer down-submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:123
_startViewportPosYprotectednumber0the posY of viewport when the pointer down-submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:128
_themeServicereadonlyThemeServiceundefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:192
contextServicereadonlyIContextServiceundefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:196
controlFillConfig$readonlyObservable<null | IControlFillConfig>undefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:103
interceptorreadonlyInterceptorManager<{ RANGE_FILL_PERMISSION_CHECK: IInterceptor<boolean, { scene: Scene; skeleton: SpreadsheetSkeleton; x: number; y: number; }>; RANGE_MOVE_PERMISSION_CHECK: IInterceptor<boolean, null>; }>undefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:186
selectionMoveEnd$readonlyObservable<ISelectionWithCoord[]>undefinedPointerup in spreadsheet-submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:166
selectionMoveStart$readonlyObservable<ISelectionWithCoord[]>undefined--submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:176
selectionMoving$readonlyObservable<ISelectionWithCoord[]>undefinedPointermove in spreadsheet-submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:174

Accessors

selectionMoving

Get Signature

get selectionMoving(): boolean

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:180

Returns

boolean

Implementation of

ISheetSelectionRenderService.selectionMoving

Methods

_addEndingListeners()

protected _addEndingListeners(): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:762

Returns

void


_addSelectionControlByModelData()

protected _addSelectionControlByModelData(selectionWithStyle): SelectionControl

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:358

Add a selection in spreadsheet, create a new SelectionControl and then update this control by range derives from selection.

Parameters

ParameterType
selectionWithStyleISelectionWithStyle

Returns

SelectionControl


_changeRuntime()

protected _changeRuntime(
   skeleton, 
   scene, 
   viewport?): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:318

Parameters

ParameterType
skeletonSpreadsheetSkeleton
sceneScene
viewport?Viewport

Returns

void


_checkClearPreviousControls()

protected _checkClearPreviousControls(evt): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:858

Parameters

ParameterType
evt| IMouseEvent | IPointerEvent

Returns

void


_clearAllSelectionControls()

protected _clearAllSelectionControls(): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:368

Returns

void


_clearUpdatingListeners()

protected _clearUpdatingListeners(): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:747

Returns

void


_getFreeze()

protected _getFreeze(): Nullable<IFreeze>

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:377

Returns

Nullable<IFreeze>


_getSelectionWithCoordByOffset()

protected _getSelectionWithCoordByOffset(
   offsetX, 
   offsetY, 
   scaleX, 
   scaleY, 
scrollXY): Nullable<ISelectionWithCoord>

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:792

Get visible selection range & coord by offset on viewport. Nearly same as skeleton.getCellWithCoordByOffset Returning selection is only one cell. primary and range are same cell.

visible selection range means getCellWithCoordByOffset needs first matched row/col in rowHeightAccumulation & colWidthAccumulation. Original name: _getCellRangeByCursorPosition

Parameters

ParameterTypeDescription
offsetXnumberposition X in viewport.
offsetYnumber-
scaleXnumber-
scaleYnumber-
scrollXY{ x: number; y: number; }-
scrollXY.xnumber-
scrollXY.ynumber-

Returns

Nullable<ISelectionWithCoord>

selection range with coord.


_getViewportByCell()

protected _getViewportByCell(row?, column?): Nullable<Viewport>

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:382

Parameters

ParameterType
row?number
column?number

Returns

Nullable<Viewport>


_initSelectionThemeFromThemeService()

_initSelectionThemeFromThemeService(): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:308

Returns

void


_makeSelectionByTwoCells()

protected _makeSelectionByTwoCells(
   currentCell, 
   startSelectionRange, 
   skeleton, 
   rangeType, 
   activeControl): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:871

Parameters

ParameterType
currentCellICellWithCoord
startSelectionRangeIRangeWithCoord
skeletonSpreadsheetSkeleton
rangeTypeRANGE_TYPE
activeControlSelectionControl

Returns

void


_movingHandler()

protected _movingHandler(
   offsetX, 
   offsetY, 
   activeSelectionControl, 
   rangeType): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:675

When mousedown and mouseup need to go to the coordination and undo stack, when mousemove does not need to go to the coordination and undo stack

Parameters

ParameterType
offsetXnumber
offsetYnumber
activeSelectionControlNullable<SelectionControl>
rangeTypeRANGE_TYPE

Returns

void


_reset()

protected _reset(): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:459

Clear existed selections by workbookSelections.selectionMoveEnd$

Returns

void


_setSelectionStyle()

protected _setSelectionStyle(style): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:222

Parameters

ParameterType
styleISelectionStyle

Returns

void


_setupPointerMoveListener()

protected _setupPointerMoveListener(
   viewportMain, 
   activeSelectionControl, 
   rangeType, 
   scrollTimerType, 
   moveStartPosX, 
   moveStartPosY): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:475

Init pointer move listener in each pointer down, unbind in each pointer up. Both cell selections and row-column selections are supported by this method.

Parameters

ParameterTypeDefault value
viewportMainNullable<Viewport>undefined
activeSelectionControlSelectionControlundefined
rangeTypeRANGE_TYPEundefined
scrollTimerTypeScrollTimerTypeScrollTimerType.ALL
moveStartPosXnumberundefined
moveStartPosYnumberundefined

Returns

void


attachPrimaryWithCoord()

attachPrimaryWithCoord(primary): ICellWithCoord

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:651

Parameters

ParameterType
primaryICellInfo

Returns

ICellWithCoord

Deprecated

Use the function attachPrimaryWithCoord instead`.

Implementation of

ISheetSelectionRenderService.attachPrimaryWithCoord


attachSelectionWithCoord()

attachSelectionWithCoord(selectionWithStyle): ISelectionWithCoord

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:646

Parameters

ParameterType
selectionWithStyleISelectionWithStyle

Returns

ISelectionWithCoord

Deprecated

Use the function attachSelectionWithCoord instead`.

Implementation of

ISheetSelectionRenderService.attachSelectionWithCoord


dispose()

dispose(): void

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:109

Returns

void

Implementation of

IRenderModule.dispose

Inherited from

Disposable.dispose


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

Disposable.disposeWithMe


endSelection()

endSelection(): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:447

Returns

void


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

Disposable.ensureNotDisposed


getActiveRange()

getActiveRange(): Nullable<IRange>

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:411

Returns the selected range in the active sheet, or null if there is no active range. If multiple ranges are selected this method returns only the last selected range.

Returns

Nullable<IRange>


getActiveSelectionControl()

getActiveSelectionControl<T>(): Nullable<T>

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:436

get active(actually last) selection control

Type Parameters

Type ParameterDefault type
T extends SelectionControlSelectionControl

Returns

Nullable<T>

T extends SelectionControl


getCellWithCoordByOffset()

getCellWithCoordByOffset(
   x, 
   y, 
   skeletonParam?): ICellWithCoord

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:662

Parameters

ParameterType
xnumber
ynumber
skeletonParam?SpreadsheetSkeleton

Returns

ICellWithCoord

Implementation of

ISheetSelectionRenderService.getCellWithCoordByOffset


getSelectionCellByPosition()

getSelectionCellByPosition(x, y): ICellWithCoord

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:658

Parameters

ParameterType
xnumber
ynumber

Returns

ICellWithCoord

Deprecated

Please use getCellWithCoordByOffset instead.

Implementation of

ISheetSelectionRenderService.getSelectionCellByPosition


getSelectionControls()

getSelectionControls(): SelectionControl[]

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:350

Returns

SelectionControl[]

TODO

lumixraku DO NOT expose private props.

Implementation of

ISheetSelectionRenderService.getSelectionControls


getSelectionDataWithStyle()

getSelectionDataWithStyle(): ISelectionWithCoord[]

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:336

Generate selectionData from this._selectionControls.model .

Returns

ISelectionWithCoord[]

{range, primary, style}[]


getSkeleton()

getSkeleton(): SpreadsheetSkeleton

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:328

Returns

SpreadsheetSkeleton

Implementation of

ISheetSelectionRenderService.getSkeleton


getViewPort()

getViewPort(): Viewport

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:234

Returns

Viewport

Deprecated

This should not be provided by the selection render service.

Implementation of

ISheetSelectionRenderService.getViewPort


inRefSelectionMode()

inRefSelectionMode(): boolean

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:937

Returns

boolean


isSelectionDisabled()

isSelectionDisabled(): boolean

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:933

Returns

boolean


isSelectionEnabled()

isSelectionEnabled(): boolean

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:929

Returns

boolean


newSelectionControl()

newSelectionControl(
   scene, 
   skeleton, 
   selection): SelectionControl

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:242

Parameters

ParameterType
sceneScene
skeletonSpreadsheetSkeleton
selectionISelectionWithStyle

Returns

SelectionControl


refreshSelectionMoveEnd()

refreshSelectionMoveEnd(): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:304

Returns

void

Implementation of

ISheetSelectionRenderService.refreshSelectionMoveEnd


refreshSelectionMoveStart()

refreshSelectionMoveStart(): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:300

Returns

void


resetActiveSelectionIndex()

resetActiveSelectionIndex(): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:428

Returns

void


resetSelectionsByModelData()

resetSelectionsByModelData(selectionsWithStyleList): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:274

Update the corresponding selectionControl based on selectionsData from WorkbookSelectionModel selectionData[i] —> selectionControls[i]

Parameters

ParameterTypeDescription
selectionsWithStyleListreadonly ISelectionWithStyle[]{ISelectionWithStyle[]} selectionsData from WorkbookSelectionModel

Returns

void


setActiveSelectionIndex()

setActiveSelectionIndex(index): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:424

Parameters

ParameterType
indexnumber

Returns

void


setSelectionTheme()

setSelectionTheme(prop): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:314

Parameters

ParameterType
propIStyleSheet

Returns

void


setSingleSelectionEnabled()

setSingleSelectionEnabled(enabled): void

Defined in: submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:238

Parameters

ParameterTypeDefault value
enabledbooleanfalse

Returns

void

Implementation of

ISheetSelectionRenderService.setSingleSelectionEnabled