@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
Parameter | Type |
---|---|
_context | IRenderContext <Workbook > |
injector | Injector |
themeService | ThemeService |
shortcutService | IShortcutService |
sheetSkeletonManagerService | SheetSkeletonManagerService |
_contextService | IContextService |
_refSelectionsService | SheetsSelectionsService |
Returns
Overrides
BaseSelectionRenderService
.constructor
Properties
Property | Modifier | Type | Default value | Description | Inherited from | Defined in |
---|---|---|---|---|---|---|
_activeControlIndex | protected | number | -1 | - | BaseSelectionRenderService ._activeControlIndex | sheets-ui/src/services/selection/base-selection-render.service.ts:118 |
_activeViewport | protected | Nullable <Viewport > | undefined | - | BaseSelectionRenderService ._activeViewport | sheets-ui/src/services/selection/base-selection-render.service.ts:184 |
_contextService | readonly | IContextService | undefined | - | - | sheets-formula-ui/src/services/render-services/ref-selections.render-service.ts:47 |
_disposed | protected | boolean | false | - | BaseSelectionRenderService ._disposed | core/src/shared/lifecycle.ts:96 |
_escapeShortcutDisposable | protected | Nullable <IDisposable > | null | - | BaseSelectionRenderService ._escapeShortcutDisposable | sheets-ui/src/services/selection/base-selection-render.service.ts:188 |
_highlightHeader | protected | boolean | true | - | BaseSelectionRenderService ._highlightHeader | sheets-ui/src/services/selection/base-selection-render.service.ts:143 |
_injector | readonly | Injector | undefined | - | BaseSelectionRenderService ._injector | sheets-ui/src/services/selection/base-selection-render.service.ts:191 |
_rangeType | protected | RANGE_TYPE | RANGE_TYPE.NORMAL | - | BaseSelectionRenderService ._rangeType | sheets-ui/src/services/selection/base-selection-render.service.ts:146 |
_remainLastEnabled | protected | boolean | false | - | BaseSelectionRenderService ._remainLastEnabled | sheets-ui/src/services/selection/base-selection-render.service.ts:154 |
_scene | protected | Scene | undefined | From renderContext. | BaseSelectionRenderService ._scene | sheets-ui/src/services/selection/base-selection-render.service.ts:140 |
_scenePointerMoveSub | protected | Nullable <Subscription > | undefined | - | BaseSelectionRenderService ._scenePointerMoveSub | sheets-ui/src/services/selection/base-selection-render.service.ts:97 |
_scenePointerUpSub | protected | Nullable <Subscription > | undefined | - | BaseSelectionRenderService ._scenePointerUpSub | sheets-ui/src/services/selection/base-selection-render.service.ts:98 |
_scrollTimer | protected | ScrollTimer | undefined | - | BaseSelectionRenderService ._scrollTimer | sheets-ui/src/services/selection/base-selection-render.service.ts:130 |
_selectionControls | protected | SelectionControl [] | [] | - | BaseSelectionRenderService ._selectionControls | sheets-ui/src/services/selection/base-selection-render.service.ts:105 |
_selectionMoveEnd$ | readonly | BehaviorSubject <ISelectionWithCoord []> | undefined | Mainly emit by pointerup in spreadsheet. (pointerup is handled in _onPointerdown) | BaseSelectionRenderService ._selectionMoveEnd$ | sheets-ui/src/services/selection/base-selection-render.service.ts:162 |
_selectionMoveStart$ | readonly | Subject <ISelectionWithCoord []> | undefined | - | BaseSelectionRenderService ._selectionMoveStart$ | sheets-ui/src/services/selection/base-selection-render.service.ts:175 |
_selectionMoving$ | readonly | Subject <ISelectionWithCoord []> | undefined | Mainly emit by pointermove in spreadsheet | BaseSelectionRenderService ._selectionMoving$ | sheets-ui/src/services/selection/base-selection-render.service.ts:170 |
_selectionStyle | protected | ISelectionStyle | undefined | - | BaseSelectionRenderService ._selectionStyle | sheets-ui/src/services/selection/base-selection-render.service.ts:149 |
_selectionTheme | protected | ThemeService | undefined | - | BaseSelectionRenderService ._selectionTheme | sheets-ui/src/services/selection/base-selection-render.service.ts:179 |
_sheetSkeletonManagerService | readonly | SheetSkeletonManagerService | undefined | - | BaseSelectionRenderService ._sheetSkeletonManagerService | sheets-ui/src/services/selection/base-selection-render.service.ts:195 |
_shortcutService | readonly | IShortcutService | undefined | - | BaseSelectionRenderService ._shortcutService | sheets-ui/src/services/selection/base-selection-render.service.ts:194 |
_singleSelectionEnabled | protected | boolean | false | - | BaseSelectionRenderService ._singleSelectionEnabled | sheets-ui/src/services/selection/base-selection-render.service.ts:156 |
_skeleton | protected | SpreadsheetSkeleton | undefined | - | BaseSelectionRenderService ._skeleton | sheets-ui/src/services/selection/base-selection-render.service.ts:135 |
_skipLastEnabled | protected | boolean | false | - | BaseSelectionRenderService ._skipLastEnabled | sheets-ui/src/services/selection/base-selection-render.service.ts:155 |
_startRangeWhenPointerDown | protected | IRangeWithCoord | undefined | - | BaseSelectionRenderService ._startRangeWhenPointerDown | sheets-ui/src/services/selection/base-selection-render.service.ts:107 |
_startViewportPosX | protected | number | 0 | the posX of viewport when the pointer down | BaseSelectionRenderService ._startViewportPosX | sheets-ui/src/services/selection/base-selection-render.service.ts:123 |
_startViewportPosY | protected | number | 0 | the posY of viewport when the pointer down | BaseSelectionRenderService ._startViewportPosY | sheets-ui/src/services/selection/base-selection-render.service.ts:128 |
_themeService | readonly | ThemeService | undefined | - | BaseSelectionRenderService ._themeService | sheets-ui/src/services/selection/base-selection-render.service.ts:192 |
contextService | readonly | IContextService | undefined | - | BaseSelectionRenderService .contextService | sheets-ui/src/services/selection/base-selection-render.service.ts:196 |
controlFillConfig$ | readonly | Observable <null | IControlFillConfig > | undefined | - | BaseSelectionRenderService .controlFillConfig$ | sheets-ui/src/services/selection/base-selection-render.service.ts:103 |
interceptor | readonly | InterceptorManager <{ RANGE_FILL_PERMISSION_CHECK : IInterceptor <boolean , { scene : Scene ; skeleton : SpreadsheetSkeleton ; x : number ; y : number ; }>; RANGE_MOVE_PERMISSION_CHECK : IInterceptor <boolean , null >; }> | undefined | - | BaseSelectionRenderService .interceptor | sheets-ui/src/services/selection/base-selection-render.service.ts:186 |
selectionMoveEnd$ | readonly | Observable <ISelectionWithCoord []> | undefined | Pointerup in spreadsheet | BaseSelectionRenderService .selectionMoveEnd$ | sheets-ui/src/services/selection/base-selection-render.service.ts:166 |
selectionMoveStart$ | readonly | Observable <ISelectionWithCoord []> | undefined | - | BaseSelectionRenderService .selectionMoveStart$ | sheets-ui/src/services/selection/base-selection-render.service.ts:176 |
selectionMoving$ | readonly | Observable <ISelectionWithCoord []> | undefined | Pointermove in spreadsheet | BaseSelectionRenderService .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
Parameter | Type |
---|---|
selectionWithStyle | ISelectionWithStyle |
Returns
Overrides
BaseSelectionRenderService
._addSelectionControlByModelData
_changeRuntime()
protected _changeRuntime(
skeleton,
scene,
viewport?): void
Defined in: sheets-ui/src/services/selection/base-selection-render.service.ts:318
Parameters
Parameter | Type |
---|---|
skeleton | SpreadsheetSkeleton |
scene | Scene |
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
Parameter | Type |
---|---|
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
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
Parameter | Type | Description |
---|---|---|
offsetX | number | position X in viewport. |
offsetY | number | - |
scaleX | number | - |
scaleY | number | - |
scrollXY | { x : number ; y : number ; } | - |
scrollXY.x | number | - |
scrollXY.y | number | - |
Returns
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
Parameter | Type |
---|---|
row ? | number |
column ? | number |
Returns
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
Parameter | Type |
---|---|
currentCell | ICellWithCoord |
startSelectionRange | IRangeWithCoord |
skeleton | SpreadsheetSkeleton |
rangeType | RANGE_TYPE |
activeControl | SelectionControl |
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
Parameter | Type |
---|---|
offsetX | number |
offsetY | number |
activeSelectionControl | Nullable <SelectionControl > |
rangeType | RANGE_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
Parameter | Type | Default value |
---|---|---|
evt | | IMouseEvent | IPointerEvent | undefined |
_zIndex | number | 0 |
rangeType | RANGE_TYPE | RANGE_TYPE.NORMAL |
viewport | Nullable <Viewport > | undefined |
scrollTimerType | ScrollTimerType | ScrollTimerType.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
Parameter | Type |
---|---|
style | ISelectionStyle |
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
Parameter | Type | Default value |
---|---|---|
viewportMain | Nullable <Viewport > | undefined |
activeSelectionControl | SelectionControl | undefined |
rangeType | RANGE_TYPE | undefined |
scrollTimerType | ScrollTimerType | ScrollTimerType.ALL |
moveStartPosX | number | undefined |
moveStartPosY | number | undefined |
Returns
void
Inherited from
BaseSelectionRenderService
._setupPointerMoveListener
attachPrimaryWithCoord()
attachPrimaryWithCoord(primary): ICellWithCoord
Defined in: sheets-ui/src/services/selection/base-selection-render.service.ts:651
Parameters
Parameter | Type |
---|---|
primary | ICellInfo |
Returns
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
Parameter | Type |
---|---|
selectionWithStyle | ISelectionWithStyle |
Returns
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
Inherited from
BaseSelectionRenderService
.dispose
disposeWithMe()
disposeWithMe(disposable): IDisposable
Defined in: core/src/shared/lifecycle.ts:99
Parameters
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
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
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
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 Parameter | Default type |
---|---|
T extends SelectionControl | SelectionControl |
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
Parameter | Type |
---|---|
x | number |
y | number |
skeletonParam ? | SpreadsheetSkeleton |
Returns
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
Parameter | Type |
---|---|
x | number |
y | number |
Returns
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
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
{range, primary, style}[]
Inherited from
BaseSelectionRenderService
.getSelectionDataWithStyle
getSkeleton()
getSkeleton(): SpreadsheetSkeleton
Defined in: sheets-ui/src/services/selection/base-selection-render.service.ts:328
Returns
Inherited from
BaseSelectionRenderService
.getSkeleton
getViewPort()
getViewPort(): Viewport
Defined in: sheets-ui/src/services/selection/base-selection-render.service.ts:234
Returns
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
Parameter | Type |
---|---|
scene | Scene |
skeleton | SpreadsheetSkeleton |
selection | ISelectionWithStyle |
Returns
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
Parameter | Type | Description |
---|---|---|
selectionsWithStyleList | readonly 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
Parameter | Type |
---|---|
index | number |
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
Parameter | Type |
---|---|
enabled | boolean |
Returns
void
setSelectionTheme()
setSelectionTheme(prop): void
Defined in: sheets-ui/src/services/selection/base-selection-render.service.ts:314
Parameters
Parameter | Type |
---|---|
prop | IStyleSheet |
Returns
void
Inherited from
BaseSelectionRenderService
.setSelectionTheme
setSingleSelectionEnabled()
setSingleSelectionEnabled(enabled): void
Defined in: sheets-ui/src/services/selection/base-selection-render.service.ts:238
Parameters
Parameter | Type | Default value |
---|---|---|
enabled | boolean | false |
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
Parameter | Type |
---|---|
enabled | boolean |
Returns
void
Memberof
RefSelectionsRenderService