API Reference
@univerjs
@univerjs/sheets-ui
classes
Sheetselectionrenderservice

@univerjs/sheets-ui v0.4.2Docs


Class: SheetSelectionRenderService

This services controls rendering of normal selections in a render unit. The normal selections would also be used by Auto Fill and Copy features.

Extends

Implements

Constructors

new SheetSelectionRenderService()

new SheetSelectionRenderService(
   _context, 
   injector, 
   themeService, 
   shortcutService, 
   selectionManagerService, 
   sheetSkeletonManagerService, 
   _logService, 
   _commandService, 
   _contextService): SheetSelectionRenderService

Parameters

ParameterType
_contextIRenderContext<Workbook>
injectorInjector
themeServiceThemeService
shortcutServiceIShortcutService
selectionManagerServiceSheetsSelectionsService
sheetSkeletonManagerServiceSheetSkeletonManagerService
_logServiceILogService
_commandServiceICommandService
_contextServiceIContextService

Returns

SheetSelectionRenderService

Overrides

BaseSelectionRenderService.constructor

Defined in

packages/sheets-ui/src/services/selection/selection-render.service.ts:42 (opens in a new tab)

Properties

PropertyModifierTypeDefault valueDescriptionInherited fromDefined in
_activeViewportprotectedNullable<Viewport>undefined-BaseSelectionRenderService._activeViewportpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:169 (opens in a new tab)
_disposedprotectedbooleanfalse-BaseSelectionRenderService._disposedpackages/core/src/shared/lifecycle.ts:93 (opens in a new tab)
_injectorreadonlyInjectorundefined-BaseSelectionRenderService._injectorpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:176 (opens in a new tab)
_isHeaderHighlightprotectedbooleantrue-BaseSelectionRenderService._isHeaderHighlightpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:134 (opens in a new tab)
_remainLastEnabledprotectedbooleanfalse-BaseSelectionRenderService._remainLastEnabledpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:145 (opens in a new tab)
_sceneprotectedSceneundefined-BaseSelectionRenderService._scenepackages/sheets-ui/src/services/selection/base-selection-render.service.ts:131 (opens in a new tab)
_scenePointerMoveSubprotectedNullable<Subscription>undefined-BaseSelectionRenderService._scenePointerMoveSubpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:94 (opens in a new tab)
_scenePointerUpSubprotectedNullable<Subscription>undefined-BaseSelectionRenderService._scenePointerUpSubpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:95 (opens in a new tab)
_scrollTimerprotectedScrollTimerundefined-BaseSelectionRenderService._scrollTimerpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:125 (opens in a new tab)
_selectionControlsprotectedSelectionShape[][]-BaseSelectionRenderService._selectionControlspackages/sheets-ui/src/services/selection/base-selection-render.service.ts:102 (opens in a new tab)
_selectionMoveEnd$readonlyBehaviorSubject<ISelectionWithCoordAndStyle[]>undefinedMainly emit by pointerup (pointerup is handled in _onPointerdown)BaseSelectionRenderService._selectionMoveEnd$packages/sheets-ui/src/services/selection/base-selection-render.service.ts:153 (opens in a new tab)
_selectionMoveStart$readonlySubject<ISelectionWithCoordAndStyle[]>undefinedMainly emit by pointerdownBaseSelectionRenderService._selectionMoveStart$packages/sheets-ui/src/services/selection/base-selection-render.service.ts:161 (opens in a new tab)
_selectionMoving$readonlySubject<ISelectionWithCoordAndStyle[]>undefined-BaseSelectionRenderService._selectionMoving$packages/sheets-ui/src/services/selection/base-selection-render.service.ts:155 (opens in a new tab)
_selectionStyleprotectedISelectionStyleundefined-BaseSelectionRenderService._selectionStylepackages/sheets-ui/src/services/selection/base-selection-render.service.ts:140 (opens in a new tab)
_sheetSkeletonManagerServicereadonlySheetSkeletonManagerServiceundefined-BaseSelectionRenderService._sheetSkeletonManagerServicepackages/sheets-ui/src/services/selection/base-selection-render.service.ts:180 (opens in a new tab)
_shortcutServicereadonlyIShortcutServiceundefined-BaseSelectionRenderService._shortcutServicepackages/sheets-ui/src/services/selection/base-selection-render.service.ts:179 (opens in a new tab)
_shouldDetectMergedCellsprotectedbooleantrue-BaseSelectionRenderService._shouldDetectMergedCellspackages/sheets-ui/src/services/selection/base-selection-render.service.ts:137 (opens in a new tab)
_singleSelectionEnabledprotectedbooleanfalse-BaseSelectionRenderService._singleSelectionEnabledpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:147 (opens in a new tab)
_skeletonprotectedSpreadsheetSkeletonundefined-BaseSelectionRenderService._skeletonpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:130 (opens in a new tab)
_skipLastEnabledprotectedbooleanfalse-BaseSelectionRenderService._skipLastEnabledpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:146 (opens in a new tab)
_startRangeWhenPointerDownprotectedIRangeWithCoordundefined-BaseSelectionRenderService._startRangeWhenPointerDownpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:104 (opens in a new tab)
_startViewportPosXprotectednumber0the posX of viewport when the pointer downBaseSelectionRenderService._startViewportPosXpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:118 (opens in a new tab)
_startViewportPosYprotectednumber0the posY of viewport when the pointer downBaseSelectionRenderService._startViewportPosYpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:123 (opens in a new tab)
_themeServicereadonlyThemeServiceundefined-BaseSelectionRenderService._themeServicepackages/sheets-ui/src/services/selection/base-selection-render.service.ts:177 (opens in a new tab)
controlFillConfig$readonlyObservable<null | IControlFillConfig>undefined-BaseSelectionRenderService.controlFillConfig$packages/sheets-ui/src/services/selection/base-selection-render.service.ts:100 (opens in a new tab)
interceptorreadonlyInterceptorManager<{ RANGE_FILL_PERMISSION_CHECK: IInterceptor<boolean, { scene: Scene; skeleton: SpreadsheetSkeleton; x: number; y: number; }>; RANGE_MOVE_PERMISSION_CHECK: IInterceptor<boolean, null>; }>undefined-BaseSelectionRenderService.interceptorpackages/sheets-ui/src/services/selection/base-selection-render.service.ts:171 (opens in a new tab)
selectionMoveEnd$readonlyObservable<ISelectionWithCoordAndStyle[]>undefined-BaseSelectionRenderService.selectionMoveEnd$packages/sheets-ui/src/services/selection/base-selection-render.service.ts:154 (opens in a new tab)
selectionMoveStart$readonlyObservable<ISelectionWithCoordAndStyle[]>undefined-BaseSelectionRenderService.selectionMoveStart$packages/sheets-ui/src/services/selection/base-selection-render.service.ts:162 (opens in a new tab)
selectionMoving$readonlyObservable<ISelectionWithCoordAndStyle[]>undefined-BaseSelectionRenderService.selectionMoving$packages/sheets-ui/src/services/selection/base-selection-render.service.ts:156 (opens in a new tab)

Accessors

selectionMoving

get selectionMoving(): boolean

Returns

boolean

Inherited from

BaseSelectionRenderService.selectionMoving

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:165 (opens in a new tab)

Methods

_addEndingListeners()

protected _addEndingListeners(): void

Returns

void

Inherited from

BaseSelectionRenderService._addEndingListeners

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:888 (opens in a new tab)


_addSelectionControlBySelectionData()

protected _addSelectionControlBySelectionData(selection): void

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

Parameters

ParameterType
selectionISelectionWithCoordAndStyle

Returns

void

Inherited from

BaseSelectionRenderService._addSelectionControlBySelectionData

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:221 (opens in a new tab)


_changeRuntime()

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

Parameters

ParameterType
skeletonSpreadsheetSkeleton
sceneScene
viewport?Viewport

Returns

void

Inherited from

BaseSelectionRenderService._changeRuntime

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:299 (opens in a new tab)


_checkClearPreviousControls()

protected _checkClearPreviousControls(evt): void

Parameters

ParameterType
evtIMouseEvent | IPointerEvent

Returns

void

Inherited from

BaseSelectionRenderService._checkClearPreviousControls

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:976 (opens in a new tab)


_clearSelectionControls()

protected _clearSelectionControls(): void

Returns

void

Inherited from

BaseSelectionRenderService._clearSelectionControls

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:332 (opens in a new tab)


_clearUpdatingListeners()

protected _clearUpdatingListeners(): void

Returns

void

Inherited from

BaseSelectionRenderService._clearUpdatingListeners

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:873 (opens in a new tab)


_getCellRangeByCursorPosition()

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

Parameters

ParameterType
offsetXnumber
offsetYnumber
scaleXnumber
scaleYnumber
scrollXYobject
scrollXY.xnumber
scrollXY.ynumber

Returns

Nullable<ISelectionWithCoord>

Inherited from

BaseSelectionRenderService._getCellRangeByCursorPosition

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:904 (opens in a new tab)


_getFreeze()

protected _getFreeze(): Nullable<IFreeze>

Returns

Nullable<IFreeze>

Inherited from

BaseSelectionRenderService._getFreeze

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:341 (opens in a new tab)


_getViewportByCell()

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

Parameters

ParameterType
row?number
column?number

Returns

Nullable<Viewport>

Inherited from

BaseSelectionRenderService._getViewportByCell

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:346 (opens in a new tab)


_movingHandler()

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

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<SelectionShape>
rangeTypeRANGE_TYPE

Returns

void

Inherited from

BaseSelectionRenderService._movingHandler

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:768 (opens in a new tab)


_onPointerDown()

protected _onPointerDown(
   evt, 
   _zIndex, 
   rangeType, 
   viewport, 
   scrollTimerType): void

Handle pointer down event, then trigger selectionMoveStart$.

Parameters

ParameterTypeDefault value
evtIMouseEvent | IPointerEventundefined
_zIndexnumber0
rangeTypeRANGE_TYPERANGE_TYPE.NORMAL
viewportNullable<Viewport>undefined
scrollTimerTypeScrollTimerTypeScrollTimerType.ALL

Returns

void

Inherited from

BaseSelectionRenderService._onPointerDown

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:433 (opens in a new tab)


_refreshSelectionControl()

protected _refreshSelectionControl(selectionsData): void

Reset all this.selectionControls by selectionsData.

Parameters

ParameterType
selectionsDatareadonly ISelectionWithStyle[]

Returns

void

Inherited from

BaseSelectionRenderService._refreshSelectionControl

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:1052 (opens in a new tab)


_reset()

protected _reset(): void

Clear existed selections.

Returns

void

Inherited from

BaseSelectionRenderService._reset

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:411 (opens in a new tab)


_resetSelectionStyle()

protected _resetSelectionStyle(): void

Reset this._selectionStyle to default normal selection style

Returns

void

Inherited from

BaseSelectionRenderService._resetSelectionStyle

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:204 (opens in a new tab)


_setSelectionStyle()

protected _setSelectionStyle(style): void

Parameters

ParameterType
styleISelectionStyle

Returns

void

Inherited from

BaseSelectionRenderService._setSelectionStyle

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:197 (opens in a new tab)


_setupPointerMoveListener()

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

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
activeSelectionControlSelectionShapeundefined
rangeTypeRANGE_TYPEundefined
scrollTimerTypeScrollTimerTypeScrollTimerType.ALL
moveStartPosXnumberundefined
moveStartPosYnumberundefined

Returns

void

Inherited from

BaseSelectionRenderService._setupPointerMoveListener

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:570 (opens in a new tab)


_updateSelectionControlByRange()

protected _updateSelectionControlByRange(
   control, 
   newSelectionRange, 
   highlight): void

Update the selection control by range.

Parameters

ParameterType
controlSelectionShape
newSelectionRangeIRangeWithCoord
highlightNullable<ISelectionCellWithMergeInfo>

Returns

void

Inherited from

BaseSelectionRenderService._updateSelectionControlByRange

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:863 (opens in a new tab)


attachPrimaryWithCoord()

attachPrimaryWithCoord(primary): ISelectionCellWithMergeInfo

Parameters

ParameterType
primaryISelectionCell

Returns

ISelectionCellWithMergeInfo

Deprecated

Use the function attachPrimaryWithCoord instead`.

Inherited from

BaseSelectionRenderService.attachPrimaryWithCoord

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:745 (opens in a new tab)


attachSelectionWithCoord()

attachSelectionWithCoord(selectionWithStyle): ISelectionWithCoordAndStyle

Parameters

ParameterType
selectionWithStyleISelectionWithStyle

Returns

ISelectionWithCoordAndStyle

Deprecated

Use the function attachSelectionWithCoord instead`.

Inherited from

BaseSelectionRenderService.attachSelectionWithCoord

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:740 (opens in a new tab)


dispose()

dispose(): void

Returns

void

Implementation of

IRenderModule.dispose

Inherited from

BaseSelectionRenderService.dispose

Defined in

packages/core/src/shared/lifecycle.ts:106 (opens in a new tab)


disposeWithMe()

disposeWithMe(disposable): IDisposable

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

BaseSelectionRenderService.disposeWithMe

Defined in

packages/core/src/shared/lifecycle.ts:96 (opens in a new tab)


endSelection()

endSelection(): void

Returns

void

Inherited from

BaseSelectionRenderService.endSelection

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:399 (opens in a new tab)


ensureNotDisposed()

protected ensureNotDisposed(): void

Returns

void

Inherited from

BaseSelectionRenderService.ensureNotDisposed

Defined in

packages/core/src/shared/lifecycle.ts:100 (opens in a new tab)


getActiveRange()

getActiveRange(): Nullable<IRange>

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>

Inherited from

BaseSelectionRenderService.getActiveRange

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:375 (opens in a new tab)


getActiveSelectionControl()

getActiveSelectionControl<T>(): Nullable<T>

get active selection control

Type Parameters

Type ParameterDefault type
T extends SelectionShapeSelectionShape

Returns

Nullable<T>

T extends SelectionControl

Inherited from

BaseSelectionRenderService.getActiveSelectionControl

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:392 (opens in a new tab)


getSelectionCellByPosition()

getSelectionCellByPosition(x, y): Nullable<ISelectionCellWithMergeInfo>

Parameters

ParameterType
xnumber
ynumber

Returns

Nullable<ISelectionCellWithMergeInfo>

Inherited from

BaseSelectionRenderService.getSelectionCellByPosition

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:749 (opens in a new tab)


getSelectionControls()

getSelectionControls(): SelectionShape[]

Returns

SelectionShape[]

Inherited from

BaseSelectionRenderService.getSelectionControls

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:328 (opens in a new tab)


getSelectionDataWithStyle()

getSelectionDataWithStyle(): ISelectionWithCoordAndStyle[]

Generate selectionData from this._selectionControls.model .

Returns

ISelectionWithCoordAndStyle[]

{range, primary, style}[]

Inherited from

BaseSelectionRenderService.getSelectionDataWithStyle

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:317 (opens in a new tab)


getSkeleton()

getSkeleton(): SpreadsheetSkeleton

Returns

SpreadsheetSkeleton

Inherited from

BaseSelectionRenderService.getSkeleton

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:309 (opens in a new tab)


getViewPort()

getViewPort(): Viewport

Returns

Viewport

Deprecated

This should not be provided by the selection render service.

Inherited from

BaseSelectionRenderService.getViewPort

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:209 (opens in a new tab)


newSelectionControl()

newSelectionControl(
   scene, 
   _rangeType, 
   skeleton): SelectionShape

Parameters

ParameterType
sceneScene
_rangeTypeRANGE_TYPE
skeletonSpreadsheetSkeleton

Returns

SelectionShape

Inherited from

BaseSelectionRenderService.newSelectionControl

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:245 (opens in a new tab)


refreshSelectionMoveEnd()

refreshSelectionMoveEnd(): void

Returns

void

Inherited from

BaseSelectionRenderService.refreshSelectionMoveEnd

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:295 (opens in a new tab)


refreshSelectionMoveStart()

refreshSelectionMoveStart(): void

Returns

void

Inherited from

BaseSelectionRenderService.refreshSelectionMoveStart

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:291 (opens in a new tab)


resetAndEndSelection()

resetAndEndSelection(): void

Returns

void

Inherited from

BaseSelectionRenderService.resetAndEndSelection

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:417 (opens in a new tab)


setSingleSelectionEnabled()

setSingleSelectionEnabled(enabled): void

Parameters

ParameterTypeDefault value
enabledbooleanfalse

Returns

void

Inherited from

BaseSelectionRenderService.setSingleSelectionEnabled

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:213 (opens in a new tab)


updateControlForCurrentByRangeData()

updateControlForCurrentByRangeData(selections): void

Update the corresponding selectionControl based on selectionsData. selectionData[i] syncs selectionControls[i]

Parameters

ParameterType
selectionsISelectionWithCoordAndStyle[]

Returns

void

Inherited from

BaseSelectionRenderService.updateControlForCurrentByRangeData

Defined in

packages/sheets-ui/src/services/selection/base-selection-render.service.ts:263 (opens in a new tab)


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.