@univerjssheets-formula-uiclassesRefselectionsrenderservice

@univerjs/sheets-formula-ui v0.5.0-beta.1 • Docs


Class: RefSelectionsRenderService

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, 
   _refSelectionsService): RefSelectionsRenderService

Parameters

ParameterType
_contextIRenderContext<Workbook>
injectorInjector
themeServiceThemeService
shortcutServiceIShortcutService
sheetSkeletonManagerServiceSheetSkeletonManagerService
_refSelectionsServiceSheetsSelectionsService

Returns

RefSelectionsRenderService

Overrides

BaseSelectionRenderService.constructor

Defined in

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

Properties

PropertyModifierTypeDefault valueDescriptionInherited fromDefined in
_activeViewportprotectedNullable<Viewport>undefined-BaseSelectionRenderService._activeViewportsheets-ui/src/services/selection/base-selection-render.service.ts:175
_disposedprotectedbooleanfalse-BaseSelectionRenderService._disposedcore/src/shared/lifecycle.ts:93
_escapeShortcutDisposableprotectedNullable<IDisposable>null-BaseSelectionRenderService._escapeShortcutDisposablesheets-ui/src/services/selection/base-selection-render.service.ts:179
_highlightHeaderprotectedbooleantrue-BaseSelectionRenderService._highlightHeadersheets-ui/src/services/selection/base-selection-render.service.ts:140
_injectorreadonlyInjectorundefined-BaseSelectionRenderService._injectorsheets-ui/src/services/selection/base-selection-render.service.ts:182
_rangeTypeprotectedRANGE_TYPERANGE_TYPE.NORMAL-BaseSelectionRenderService._rangeTypesheets-ui/src/services/selection/base-selection-render.service.ts:143
_remainLastEnabledprotectedbooleanfalse-BaseSelectionRenderService._remainLastEnabledsheets-ui/src/services/selection/base-selection-render.service.ts:151
_sceneprotectedSceneundefinedFrom renderContext.BaseSelectionRenderService._scenesheets-ui/src/services/selection/base-selection-render.service.ts:137
_scenePointerMoveSubprotectedNullable<Subscription>undefined-BaseSelectionRenderService._scenePointerMoveSubsheets-ui/src/services/selection/base-selection-render.service.ts:96
_scenePointerUpSubprotectedNullable<Subscription>undefined-BaseSelectionRenderService._scenePointerUpSubsheets-ui/src/services/selection/base-selection-render.service.ts:97
_scrollTimerprotectedScrollTimerundefined-BaseSelectionRenderService._scrollTimersheets-ui/src/services/selection/base-selection-render.service.ts:127
_selectionControlsprotectedSelectionShape[][]-BaseSelectionRenderService._selectionControlssheets-ui/src/services/selection/base-selection-render.service.ts:104
_selectionMoveEnd$readonlyBehaviorSubject<ISelectionWithCoord[]>undefinedMainly emit by pointerup (pointerup is handled in _onPointerdown)BaseSelectionRenderService._selectionMoveEnd$sheets-ui/src/services/selection/base-selection-render.service.ts:159
_selectionMoveStart$readonlySubject<ISelectionWithCoord[]>undefinedMainly emit by pointerdownBaseSelectionRenderService._selectionMoveStart$sheets-ui/src/services/selection/base-selection-render.service.ts:167
_selectionMoving$readonlySubject<ISelectionWithCoord[]>undefined-BaseSelectionRenderService._selectionMoving$sheets-ui/src/services/selection/base-selection-render.service.ts:161
_selectionStyleprotectedISelectionStyleundefined-BaseSelectionRenderService._selectionStylesheets-ui/src/services/selection/base-selection-render.service.ts:146
_sheetSkeletonManagerServicereadonlySheetSkeletonManagerServiceundefined-BaseSelectionRenderService._sheetSkeletonManagerServicesheets-ui/src/services/selection/base-selection-render.service.ts:186
_shortcutServicereadonlyIShortcutServiceundefined-BaseSelectionRenderService._shortcutServicesheets-ui/src/services/selection/base-selection-render.service.ts:185
_singleSelectionEnabledprotectedbooleanfalse-BaseSelectionRenderService._singleSelectionEnabledsheets-ui/src/services/selection/base-selection-render.service.ts:153
_skeletonprotectedSpreadsheetSkeletonundefined-BaseSelectionRenderService._skeletonsheets-ui/src/services/selection/base-selection-render.service.ts:132
_skipLastEnabledprotectedbooleanfalse-BaseSelectionRenderService._skipLastEnabledsheets-ui/src/services/selection/base-selection-render.service.ts:152
_startRangeWhenPointerDownprotectedIRangeWithCoordundefined-BaseSelectionRenderService._startRangeWhenPointerDownsheets-ui/src/services/selection/base-selection-render.service.ts:106
_startViewportPosXprotectednumber0the posX of viewport when the pointer downBaseSelectionRenderService._startViewportPosXsheets-ui/src/services/selection/base-selection-render.service.ts:120
_startViewportPosYprotectednumber0the posY of viewport when the pointer downBaseSelectionRenderService._startViewportPosYsheets-ui/src/services/selection/base-selection-render.service.ts:125
_themeServicereadonlyThemeServiceundefined-BaseSelectionRenderService._themeServicesheets-ui/src/services/selection/base-selection-render.service.ts:183
controlFillConfig$readonlyObservable<null | IControlFillConfig>undefined-BaseSelectionRenderService.controlFillConfig$sheets-ui/src/services/selection/base-selection-render.service.ts:102
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:177
selectionMoveEnd$readonlyObservable<ISelectionWithCoord[]>undefined-BaseSelectionRenderService.selectionMoveEnd$sheets-ui/src/services/selection/base-selection-render.service.ts:160
selectionMoveStart$readonlyObservable<ISelectionWithCoord[]>undefined-BaseSelectionRenderService.selectionMoveStart$sheets-ui/src/services/selection/base-selection-render.service.ts:168
selectionMoving$readonlyObservable<ISelectionWithCoord[]>undefined-BaseSelectionRenderService.selectionMoving$sheets-ui/src/services/selection/base-selection-render.service.ts:162

Accessors

selectionMoving

Get Signature

get selectionMoving(): boolean
Returns

boolean

Inherited from

BaseSelectionRenderService.selectionMoving

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:171

Methods

_addEndingListeners()

protected _addEndingListeners(): void

Returns

void

Inherited from

BaseSelectionRenderService._addEndingListeners

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:735


_addSelectionControlByModelData()

protected _addSelectionControlByModelData(selectionWithStyle): SelectionShape

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

SelectionShape

Overrides

BaseSelectionRenderService._addSelectionControlByModelData

Defined in

sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:171


_changeRuntime()

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

Parameters

ParameterType
skeletonSpreadsheetSkeleton
sceneScene
viewport?Viewport

Returns

void

Inherited from

BaseSelectionRenderService._changeRuntime

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:293


_checkClearPreviousControls()

protected _checkClearPreviousControls(evt): void

Parameters

ParameterType
evtIMouseEvent | IPointerEvent

Returns

void

Inherited from

BaseSelectionRenderService._checkClearPreviousControls

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:831


_clearAllSelectionControls()

protected _clearAllSelectionControls(): void

Returns

void

Inherited from

BaseSelectionRenderService._clearAllSelectionControls

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:343


_clearUpdatingListeners()

protected _clearUpdatingListeners(): void

Returns

void

Inherited from

BaseSelectionRenderService._clearUpdatingListeners

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:720


_getFreeze()

protected _getFreeze(): Nullable<IFreeze>

Returns

Nullable<IFreeze>

Inherited from

BaseSelectionRenderService._getFreeze

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:352


_getSelectionWithCoordByOffset()

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

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-
scrollXYobject-
scrollXY.xnumber-
scrollXY.ynumber-

Returns

Nullable<ISelectionWithCoord>

selection range with coord.

Inherited from

BaseSelectionRenderService._getSelectionWithCoordByOffset

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:765


_getViewportByCell()

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

Parameters

ParameterType
row?number
column?number

Returns

Nullable<Viewport>

Inherited from

BaseSelectionRenderService._getViewportByCell

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:357


_makeSelectionByTwoCells()

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

Parameters

ParameterType
currentCellICellWithCoord
startSelectionRangeIRangeWithCoord
skeletonSpreadsheetSkeleton
rangeTypeRANGE_TYPE
activeControlSelectionShape

Returns

void

Inherited from

BaseSelectionRenderService._makeSelectionByTwoCells

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:844


_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

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


_onPointerDown()

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

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

Parameters

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

Returns

void

Defined in

sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:270


_reset()

protected _reset(): void

Clear existed selections by workbookSelections.selectionMoveEnd$

Returns

void

Inherited from

BaseSelectionRenderService._reset

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:422


_resetSelectionStyle()

protected _resetSelectionStyle(): void

Reset this._selectionStyle to default normal selection style

Returns

void

Inherited from

BaseSelectionRenderService._resetSelectionStyle

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:217


_setSelectionStyle()

protected _setSelectionStyle(style): void

Parameters

ParameterType
styleISelectionStyle

Returns

void

Inherited from

BaseSelectionRenderService._setSelectionStyle

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:210


_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

sheets-ui/src/services/selection/base-selection-render.service.ts:446


attachPrimaryWithCoord()

attachPrimaryWithCoord(primary): ICellWithCoord

Parameters

ParameterType
primaryICellInfo

Returns

ICellWithCoord

Deprecated

Use the function attachPrimaryWithCoord instead`.

Inherited from

BaseSelectionRenderService.attachPrimaryWithCoord

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:622


attachSelectionWithCoord()

attachSelectionWithCoord(selectionWithStyle): ISelectionWithCoord

Parameters

ParameterType
selectionWithStyleISelectionWithStyle

Returns

ISelectionWithCoord

Deprecated

Use the function attachSelectionWithCoord instead`.

Inherited from

BaseSelectionRenderService.attachSelectionWithCoord

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:617


clearLastSelection()

clearLastSelection(): void

Returns

void

Defined in

sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:84


dispose()

dispose(): void

Returns

void

Implementation of

IRenderModule.dispose

Inherited from

BaseSelectionRenderService.dispose

Defined in

core/src/shared/lifecycle.ts:106


disposeWithMe()

disposeWithMe(disposable): IDisposable

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

BaseSelectionRenderService.disposeWithMe

Defined in

core/src/shared/lifecycle.ts:96


enableSelectionChanging()

enableSelectionChanging(): IDisposable

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

Returns

IDisposable

Defined in

sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:95


endSelection()

endSelection(): void

Returns

void

Inherited from

BaseSelectionRenderService.endSelection

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:410


ensureNotDisposed()

protected ensureNotDisposed(): void

Returns

void

Inherited from

BaseSelectionRenderService.ensureNotDisposed

Defined in

core/src/shared/lifecycle.ts:100


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

sheets-ui/src/services/selection/base-selection-render.service.ts:386


getActiveSelectionControl()

getActiveSelectionControl<T>(): Nullable<T>

get active(actually last) selection control

Type Parameters

Type ParameterDefault type
T extends SelectionShapeSelectionShape

Returns

Nullable<T>

T extends SelectionControl

Inherited from

BaseSelectionRenderService.getActiveSelectionControl

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:403


getCellWithCoordByOffset()

getCellWithCoordByOffset(x, y): ICellWithCoord

Parameters

ParameterType
xnumber
ynumber

Returns

ICellWithCoord

Inherited from

BaseSelectionRenderService.getCellWithCoordByOffset

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:633


getLocation()

getLocation(): [string, string]

Returns

[string, string]

Defined in

sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:67


getSelectionCellByPosition()

getSelectionCellByPosition(x, y): ICellWithCoord

Parameters

ParameterType
xnumber
ynumber

Returns

ICellWithCoord

Deprecated

Please use getCellWithCoordByOffset instead.

Inherited from

BaseSelectionRenderService.getSelectionCellByPosition

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:629


getSelectionControls()

getSelectionControls(): SelectionShape[]

Returns

SelectionShape[]

TODO

lumixraku DO NOT expose private props.

Inherited from

BaseSelectionRenderService.getSelectionControls

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:325


getSelectionDataWithStyle()

getSelectionDataWithStyle(): ISelectionWithCoord[]

Generate selectionData from this._selectionControls.model .

Returns

ISelectionWithCoord[]

{range, primary, style}[]

Inherited from

BaseSelectionRenderService.getSelectionDataWithStyle

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:311


getSkeleton()

getSkeleton(): SpreadsheetSkeleton

Returns

SpreadsheetSkeleton

Inherited from

BaseSelectionRenderService.getSkeleton

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:303


getViewPort()

getViewPort(): Viewport

Returns

Viewport

Deprecated

This should not be provided by the selection render service.

Inherited from

BaseSelectionRenderService.getViewPort

Defined in

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


newSelectionControl()

newSelectionControl(
   scene, 
   skeleton, 
   selection): SelectionShape

Diff between normal selection, no highlightHeader for ref selections.

Parameters

ParameterType
sceneScene
skeletonSpreadsheetSkeleton
selectionISelectionWithStyle

Returns

SelectionShape

selectionControl just created

Overrides

BaseSelectionRenderService.newSelectionControl

Defined in

sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:421


refreshSelectionMoveEnd()

refreshSelectionMoveEnd(): void

Returns

void

Inherited from

BaseSelectionRenderService.refreshSelectionMoveEnd

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:289


refreshSelectionMoveStart()

refreshSelectionMoveStart(): void

Returns

void

Inherited from

BaseSelectionRenderService.refreshSelectionMoveStart

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:285


resetSelectionsByModelData()

resetSelectionsByModelData(selectionsWithStyleList): void

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

Parameters

ParameterType
selectionsWithStyleListreadonly ISelectionWithStyle[]

Returns

void

Inherited from

BaseSelectionRenderService.resetSelectionsByModelData

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:262


setRemainLastEnabled()

setRemainLastEnabled(enabled): void

Parameters

ParameterType
enabledboolean

Returns

void

Defined in

sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:71


setSingleSelectionEnabled()

setSingleSelectionEnabled(enabled): void

Parameters

ParameterTypeDefault value
enabledbooleanfalse

Returns

void

Inherited from

BaseSelectionRenderService.setSingleSelectionEnabled

Defined in

sheets-ui/src/services/selection/base-selection-render.service.ts:226


setSkipLastEnabled()

setSkipLastEnabled(enabled): void

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

Parameters

ParameterType
enabledboolean

Returns

void

Memberof

RefSelectionsRenderService

Defined in

sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:80