@univerjssheets-formula-uiclassesRefselectionsrenderservice

@univerjs/sheets-formula-ui v0.5.4


Class: RefSelectionsRenderService

Defined in: sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:36

This service extends the existing SelectionRenderService to provide the rendering of prompt selections when user is editing ref ranges in formulas.

Not that this service works with Uni-mode, which means it should be able to deal with multi render unit and handle selections on them, though each at a time.

Extends

Implements

Constructors

new RefSelectionsRenderService()

new RefSelectionsRenderService(
   _context, 
   injector, 
   themeService, 
   shortcutService, 
   sheetSkeletonManagerService, 
   _contextService, 
   _refSelectionsService): RefSelectionsRenderService

Defined in: sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:41

Parameters

ParameterType
_contextIRenderContext<Workbook>
injectorInjector
themeServiceThemeService
shortcutServiceIShortcutService
sheetSkeletonManagerServiceSheetSkeletonManagerService
_contextServiceIContextService
_refSelectionsServiceSheetsSelectionsService

Returns

RefSelectionsRenderService

Overrides

BaseSelectionRenderService.constructor

Properties

PropertyModifierTypeDefault valueDescriptionInherited fromDefined in
_activeControlIndexprotectednumber-1-BaseSelectionRenderService._activeControlIndexsheets-ui/src/services/selection/base-selection-render.service.ts:118
_activeViewportprotectedNullable<Viewport>undefined-BaseSelectionRenderService._activeViewportsheets-ui/src/services/selection/base-selection-render.service.ts:184
_contextServicereadonlyIContextServiceundefined--sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:47
_disposedprotectedbooleanfalse-BaseSelectionRenderService._disposedcore/src/shared/lifecycle.ts:96
_escapeShortcutDisposableprotectedNullable<IDisposable>null-BaseSelectionRenderService._escapeShortcutDisposablesheets-ui/src/services/selection/base-selection-render.service.ts:188
_highlightHeaderprotectedbooleantrue-BaseSelectionRenderService._highlightHeadersheets-ui/src/services/selection/base-selection-render.service.ts:143
_injectorreadonlyInjectorundefined-BaseSelectionRenderService._injectorsheets-ui/src/services/selection/base-selection-render.service.ts:191
_rangeTypeprotectedRANGE_TYPERANGE_TYPE.NORMAL-BaseSelectionRenderService._rangeTypesheets-ui/src/services/selection/base-selection-render.service.ts:146
_remainLastEnabledprotectedbooleanfalse-BaseSelectionRenderService._remainLastEnabledsheets-ui/src/services/selection/base-selection-render.service.ts:154
_sceneprotectedSceneundefinedFrom renderContext.BaseSelectionRenderService._scenesheets-ui/src/services/selection/base-selection-render.service.ts:140
_scenePointerMoveSubprotectedNullable<Subscription>undefined-BaseSelectionRenderService._scenePointerMoveSubsheets-ui/src/services/selection/base-selection-render.service.ts:97
_scenePointerUpSubprotectedNullable<Subscription>undefined-BaseSelectionRenderService._scenePointerUpSubsheets-ui/src/services/selection/base-selection-render.service.ts:98
_scrollTimerprotectedScrollTimerundefined-BaseSelectionRenderService._scrollTimersheets-ui/src/services/selection/base-selection-render.service.ts:130
_selectionControlsprotectedSelectionControl[][]-BaseSelectionRenderService._selectionControlssheets-ui/src/services/selection/base-selection-render.service.ts:105
_selectionMoveEnd$readonlyBehaviorSubject<ISelectionWithCoord[]>undefinedMainly emit by pointerup in spreadsheet. (pointerup is handled in _onPointerdown)BaseSelectionRenderService._selectionMoveEnd$sheets-ui/src/services/selection/base-selection-render.service.ts:162
_selectionMoveStart$readonlySubject<ISelectionWithCoord[]>undefined-BaseSelectionRenderService._selectionMoveStart$sheets-ui/src/services/selection/base-selection-render.service.ts:175
_selectionMoving$readonlySubject<ISelectionWithCoord[]>undefinedMainly emit by pointermove in spreadsheetBaseSelectionRenderService._selectionMoving$sheets-ui/src/services/selection/base-selection-render.service.ts:170
_selectionStyleprotectedISelectionStyleundefined-BaseSelectionRenderService._selectionStylesheets-ui/src/services/selection/base-selection-render.service.ts:149
_selectionThemeprotectedThemeServiceundefined-BaseSelectionRenderService._selectionThemesheets-ui/src/services/selection/base-selection-render.service.ts:179
_sheetSkeletonManagerServicereadonlySheetSkeletonManagerServiceundefined-BaseSelectionRenderService._sheetSkeletonManagerServicesheets-ui/src/services/selection/base-selection-render.service.ts:195
_shortcutServicereadonlyIShortcutServiceundefined-BaseSelectionRenderService._shortcutServicesheets-ui/src/services/selection/base-selection-render.service.ts:194
_singleSelectionEnabledprotectedbooleanfalse-BaseSelectionRenderService._singleSelectionEnabledsheets-ui/src/services/selection/base-selection-render.service.ts:156
_skeletonprotectedSpreadsheetSkeletonundefined-BaseSelectionRenderService._skeletonsheets-ui/src/services/selection/base-selection-render.service.ts:135
_skipLastEnabledprotectedbooleanfalse-BaseSelectionRenderService._skipLastEnabledsheets-ui/src/services/selection/base-selection-render.service.ts:155
_startRangeWhenPointerDownprotectedIRangeWithCoordundefined-BaseSelectionRenderService._startRangeWhenPointerDownsheets-ui/src/services/selection/base-selection-render.service.ts:107
_startViewportPosXprotectednumber0the posX of viewport when the pointer downBaseSelectionRenderService._startViewportPosXsheets-ui/src/services/selection/base-selection-render.service.ts:123
_startViewportPosYprotectednumber0the posY of viewport when the pointer downBaseSelectionRenderService._startViewportPosYsheets-ui/src/services/selection/base-selection-render.service.ts:128
_themeServicereadonlyThemeServiceundefined-BaseSelectionRenderService._themeServicesheets-ui/src/services/selection/base-selection-render.service.ts:192
contextServicereadonlyIContextServiceundefined-BaseSelectionRenderService.contextServicesheets-ui/src/services/selection/base-selection-render.service.ts:196
controlFillConfig$readonlyObservable<null | IControlFillConfig>undefined-BaseSelectionRenderService.controlFillConfig$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-BaseSelectionRenderService.interceptorsheets-ui/src/services/selection/base-selection-render.service.ts:186
selectionMoveEnd$readonlyObservable<ISelectionWithCoord[]>undefinedPointerup in spreadsheetBaseSelectionRenderService.selectionMoveEnd$sheets-ui/src/services/selection/base-selection-render.service.ts:166
selectionMoveStart$readonlyObservable<ISelectionWithCoord[]>undefined-BaseSelectionRenderService.selectionMoveStart$sheets-ui/src/services/selection/base-selection-render.service.ts:176
selectionMoving$readonlyObservable<ISelectionWithCoord[]>undefinedPointermove in spreadsheetBaseSelectionRenderService.selectionMoving$sheets-ui/src/services/selection/base-selection-render.service.ts:174

Accessors

selectionMoving

Get Signature

get selectionMoving(): boolean

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

Returns

boolean

Inherited from

BaseSelectionRenderService.selectionMoving

Methods

_addEndingListeners()

protected _addEndingListeners(): void

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

Returns

void

Inherited from

BaseSelectionRenderService._addEndingListeners


_addSelectionControlByModelData()

protected _addSelectionControlByModelData(selectionWithStyle): SelectionControl

Defined in: sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:181

Add a selection in spreadsheet, create a new SelectionControl and then update this control by range derives from selection. For ref selection, create selectionShapeExtension to handle user action.

Parameters

ParameterType
selectionWithStyleISelectionWithStyle

Returns

SelectionControl

Overrides

BaseSelectionRenderService._addSelectionControlByModelData


_changeRuntime()

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

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

Parameters

ParameterType
skeletonSpreadsheetSkeleton
sceneScene
viewport?Viewport

Returns

void

Inherited from

BaseSelectionRenderService._changeRuntime


_checkClearPreviousControls()

protected _checkClearPreviousControls(evt): void

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

Parameters

ParameterType
evt| IMouseEvent | IPointerEvent

Returns

void

Inherited from

BaseSelectionRenderService._checkClearPreviousControls


_clearAllSelectionControls()

protected _clearAllSelectionControls(): void

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

Returns

void

Inherited from

BaseSelectionRenderService._clearAllSelectionControls


_clearUpdatingListeners()

protected _clearUpdatingListeners(): void

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

Returns

void

Inherited from

BaseSelectionRenderService._clearUpdatingListeners


_getFreeze()

protected _getFreeze(): Nullable<IFreeze>

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

Returns

Nullable<IFreeze>

Inherited from

BaseSelectionRenderService._getFreeze


_getSelectionWithCoordByOffset()

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

Defined in: 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.

Inherited from

BaseSelectionRenderService._getSelectionWithCoordByOffset


_getViewportByCell()

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

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

Parameters

ParameterType
row?number
column?number

Returns

Nullable<Viewport>

Inherited from

BaseSelectionRenderService._getViewportByCell


_initSelectionThemeFromThemeService()

_initSelectionThemeFromThemeService(): void

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

Returns

void

Inherited from

BaseSelectionRenderService._initSelectionThemeFromThemeService


_makeSelectionByTwoCells()

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

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

Parameters

ParameterType
currentCellICellWithCoord
startSelectionRangeIRangeWithCoord
skeletonSpreadsheetSkeleton
rangeTypeRANGE_TYPE
activeControlSelectionControl

Returns

void

Inherited from

BaseSelectionRenderService._makeSelectionByTwoCells


_movingHandler()

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

Defined in: 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

Inherited from

BaseSelectionRenderService._movingHandler


_onPointerDown()

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

Defined in: sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:277

Handle pointer down event, bind pointermove & pointerup handler. then trigger selectionMoveStart$.

Parameters

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

Returns

void


_reset()

protected _reset(): void

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

Clear existed selections by workbookSelections.selectionMoveEnd$

Returns

void

Inherited from

BaseSelectionRenderService._reset


_setSelectionStyle()

protected _setSelectionStyle(style): void

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

Parameters

ParameterType
styleISelectionStyle

Returns

void

Inherited from

BaseSelectionRenderService._setSelectionStyle


_setupPointerMoveListener()

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

Defined in: 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

Inherited from

BaseSelectionRenderService._setupPointerMoveListener


attachPrimaryWithCoord()

attachPrimaryWithCoord(primary): ICellWithCoord

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

Parameters

ParameterType
primaryICellInfo

Returns

ICellWithCoord

Deprecated

Use the function attachPrimaryWithCoord instead`.

Inherited from

BaseSelectionRenderService.attachPrimaryWithCoord


attachSelectionWithCoord()

attachSelectionWithCoord(selectionWithStyle): ISelectionWithCoord

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

Parameters

ParameterType
selectionWithStyleISelectionWithStyle

Returns

ISelectionWithCoord

Deprecated

Use the function attachSelectionWithCoord instead`.

Inherited from

BaseSelectionRenderService.attachSelectionWithCoord


clearLastSelection()

clearLastSelection(): void

Defined in: sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:86

Returns

void


disableSelectionChanging()

disableSelectionChanging(): void

Defined in: sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:108

Returns

void


dispose()

dispose(): void

Defined in: core/src/shared/lifecycle.ts:109

Returns

void

Implementation of

IRenderModule.dispose

Inherited from

BaseSelectionRenderService.dispose


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

BaseSelectionRenderService.disposeWithMe


enableSelectionChanging()

enableSelectionChanging(): IDisposable

Defined in: sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:97

Call this method and user will be able to select on the canvas to update selections.

Returns

IDisposable


endSelection()

endSelection(): void

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

Returns

void

Inherited from

BaseSelectionRenderService.endSelection


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

BaseSelectionRenderService.ensureNotDisposed


getActiveRange()

getActiveRange(): Nullable<IRange>

Defined in: 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>

Inherited from

BaseSelectionRenderService.getActiveRange


getActiveSelectionControl()

getActiveSelectionControl<T>(): Nullable<T>

Defined in: 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

Inherited from

BaseSelectionRenderService.getActiveSelectionControl


getCellWithCoordByOffset()

getCellWithCoordByOffset(
   x, 
   y, 
   skeletonParam?): ICellWithCoord

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

Parameters

ParameterType
xnumber
ynumber
skeletonParam?SpreadsheetSkeleton

Returns

ICellWithCoord

Inherited from

BaseSelectionRenderService.getCellWithCoordByOffset


getLocation()

getLocation(): [string, string]

Defined in: sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:69

Returns

[string, string]


getSelectionCellByPosition()

getSelectionCellByPosition(x, y): ICellWithCoord

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

Parameters

ParameterType
xnumber
ynumber

Returns

ICellWithCoord

Deprecated

Please use getCellWithCoordByOffset instead.

Inherited from

BaseSelectionRenderService.getSelectionCellByPosition


getSelectionControls()

getSelectionControls(): SelectionControl[]

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

Returns

SelectionControl[]

TODO

lumixraku DO NOT expose private props.

Inherited from

BaseSelectionRenderService.getSelectionControls


getSelectionDataWithStyle()

getSelectionDataWithStyle(): ISelectionWithCoord[]

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

Generate selectionData from this._selectionControls.model .

Returns

ISelectionWithCoord[]

{range, primary, style}[]

Inherited from

BaseSelectionRenderService.getSelectionDataWithStyle


getSkeleton()

getSkeleton(): SpreadsheetSkeleton

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

Returns

SpreadsheetSkeleton

Inherited from

BaseSelectionRenderService.getSkeleton


getViewPort()

getViewPort(): Viewport

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

Returns

Viewport

Deprecated

This should not be provided by the selection render service.

Inherited from

BaseSelectionRenderService.getViewPort


inRefSelectionMode()

inRefSelectionMode(): boolean

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

Returns

boolean

Inherited from

BaseSelectionRenderService.inRefSelectionMode


isSelectionDisabled()

isSelectionDisabled(): boolean

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

Returns

boolean

Inherited from

BaseSelectionRenderService.isSelectionDisabled


isSelectionEnabled()

isSelectionEnabled(): boolean

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

Returns

boolean

Inherited from

BaseSelectionRenderService.isSelectionEnabled


newSelectionControl()

newSelectionControl(
   scene, 
   skeleton, 
   selection): SelectionControl

Defined in: sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:428

Diff between normal selection, no highlightHeader for ref selections.

Parameters

ParameterType
sceneScene
skeletonSpreadsheetSkeleton
selectionISelectionWithStyle

Returns

SelectionControl

selectionControl just created

Overrides

BaseSelectionRenderService.newSelectionControl


refreshSelectionMoveEnd()

refreshSelectionMoveEnd(): void

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

Returns

void

Inherited from

BaseSelectionRenderService.refreshSelectionMoveEnd


refreshSelectionMoveStart()

refreshSelectionMoveStart(): void

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

Returns

void

Inherited from

BaseSelectionRenderService.refreshSelectionMoveStart


resetActiveSelectionIndex()

resetActiveSelectionIndex(): void

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

Returns

void

Inherited from

BaseSelectionRenderService.resetActiveSelectionIndex


resetSelectionsByModelData()

resetSelectionsByModelData(selectionsWithStyleList): void

Defined in: 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

Inherited from

BaseSelectionRenderService.resetSelectionsByModelData


setActiveSelectionIndex()

setActiveSelectionIndex(index): void

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

Parameters

ParameterType
indexnumber

Returns

void

Inherited from

BaseSelectionRenderService.setActiveSelectionIndex


setRemainLastEnabled()

setRemainLastEnabled(enabled): void

Defined in: sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:73

Parameters

ParameterType
enabledboolean

Returns

void


setSelectionTheme()

setSelectionTheme(prop): void

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

Parameters

ParameterType
propIStyleSheet

Returns

void

Inherited from

BaseSelectionRenderService.setSelectionTheme


setSingleSelectionEnabled()

setSingleSelectionEnabled(enabled): void

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

Parameters

ParameterTypeDefault value
enabledbooleanfalse

Returns

void

Inherited from

BaseSelectionRenderService.setSingleSelectionEnabled


setSkipLastEnabled()

setSkipLastEnabled(enabled): void

Defined in: sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:82

This is set to true when you need to add a new selection.

Parameters

ParameterType
enabledboolean

Returns

void

Memberof

RefSelectionsRenderService