@univerjs/sheets-ui v0.5.0-beta.1 • Docs
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
Parameter | Type |
---|---|
_context | IRenderContext <Workbook > |
injector | Injector |
themeService | ThemeService |
shortcutService | IShortcutService |
selectionManagerService | SheetsSelectionsService |
sheetSkeletonManagerService | SheetSkeletonManagerService |
_logService | ILogService |
_commandService | ICommandService |
_contextService | IContextService |
Returns
Overrides
BaseSelectionRenderService
.constructor
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/selection-render.service.ts:43
Properties
Property | Modifier | Type | Default value | Description | Inherited from | Defined in |
---|---|---|---|---|---|---|
_activeViewport | protected | Nullable <Viewport > | undefined | - | BaseSelectionRenderService ._activeViewport | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:175 |
_disposed | protected | boolean | false | - | BaseSelectionRenderService ._disposed | submodules/univer/packages/core/src/shared/lifecycle.ts:93 |
_escapeShortcutDisposable | protected | Nullable <IDisposable > | null | - | BaseSelectionRenderService ._escapeShortcutDisposable | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:179 |
_highlightHeader | protected | boolean | true | - | BaseSelectionRenderService ._highlightHeader | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:140 |
_injector | readonly | Injector | undefined | - | BaseSelectionRenderService ._injector | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:182 |
_rangeType | protected | RANGE_TYPE | RANGE_TYPE.NORMAL | - | BaseSelectionRenderService ._rangeType | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:143 |
_remainLastEnabled | protected | boolean | false | - | BaseSelectionRenderService ._remainLastEnabled | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:151 |
_scene | protected | Scene | undefined | From renderContext. | BaseSelectionRenderService ._scene | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:137 |
_scenePointerMoveSub | protected | Nullable <Subscription > | undefined | - | BaseSelectionRenderService ._scenePointerMoveSub | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:96 |
_scenePointerUpSub | protected | Nullable <Subscription > | undefined | - | BaseSelectionRenderService ._scenePointerUpSub | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:97 |
_scrollTimer | protected | ScrollTimer | undefined | - | BaseSelectionRenderService ._scrollTimer | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:127 |
_selectionControls | protected | SelectionShape [] | [] | - | BaseSelectionRenderService ._selectionControls | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:104 |
_selectionMoveEnd$ | readonly | BehaviorSubject <ISelectionWithCoord []> | undefined | Mainly emit by pointerup (pointerup is handled in _onPointerdown) | BaseSelectionRenderService ._selectionMoveEnd$ | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:159 |
_selectionMoveStart$ | readonly | Subject <ISelectionWithCoord []> | undefined | Mainly emit by pointerdown | BaseSelectionRenderService ._selectionMoveStart$ | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:167 |
_selectionMoving$ | readonly | Subject <ISelectionWithCoord []> | undefined | - | BaseSelectionRenderService ._selectionMoving$ | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:161 |
_selectionStyle | protected | ISelectionStyle | undefined | - | BaseSelectionRenderService ._selectionStyle | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:146 |
_sheetSkeletonManagerService | readonly | SheetSkeletonManagerService | undefined | - | BaseSelectionRenderService ._sheetSkeletonManagerService | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:186 |
_shortcutService | readonly | IShortcutService | undefined | - | BaseSelectionRenderService ._shortcutService | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:185 |
_singleSelectionEnabled | protected | boolean | false | - | BaseSelectionRenderService ._singleSelectionEnabled | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:153 |
_skeleton | protected | SpreadsheetSkeleton | undefined | - | BaseSelectionRenderService ._skeleton | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:132 |
_skipLastEnabled | protected | boolean | false | - | BaseSelectionRenderService ._skipLastEnabled | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:152 |
_startRangeWhenPointerDown | protected | IRangeWithCoord | undefined | - | BaseSelectionRenderService ._startRangeWhenPointerDown | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:106 |
_startViewportPosX | protected | number | 0 | the posX of viewport when the pointer down | BaseSelectionRenderService ._startViewportPosX | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:120 |
_startViewportPosY | protected | number | 0 | the posY of viewport when the pointer down | BaseSelectionRenderService ._startViewportPosY | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:125 |
_themeService | readonly | ThemeService | undefined | - | BaseSelectionRenderService ._themeService | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:183 |
controlFillConfig$ | readonly | Observable <null | IControlFillConfig > | undefined | - | BaseSelectionRenderService .controlFillConfig$ | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:102 |
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 | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:177 |
selectionMoveEnd$ | readonly | Observable <ISelectionWithCoord []> | undefined | - | BaseSelectionRenderService .selectionMoveEnd$ | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:160 |
selectionMoveStart$ | readonly | Observable <ISelectionWithCoord []> | undefined | - | BaseSelectionRenderService .selectionMoveStart$ | submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:168 |
selectionMoving$ | readonly | Observable <ISelectionWithCoord []> | undefined | - | BaseSelectionRenderService .selectionMoving$ | submodules/univer/packages/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
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:171
Methods
_addEndingListeners()
protected _addEndingListeners(): void
Returns
void
Inherited from
BaseSelectionRenderService
._addEndingListeners
Defined in
submodules/univer/packages/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.
Parameters
Parameter | Type |
---|---|
selectionWithStyle | ISelectionWithStyle |
Returns
Inherited from
BaseSelectionRenderService
._addSelectionControlByModelData
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:333
_changeRuntime()
protected _changeRuntime(
skeleton,
scene,
viewport?): void
Parameters
Parameter | Type |
---|---|
skeleton | SpreadsheetSkeleton |
scene | Scene |
viewport ? | Viewport |
Returns
void
Inherited from
BaseSelectionRenderService
._changeRuntime
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:293
_checkClearPreviousControls()
protected _checkClearPreviousControls(evt): void
Parameters
Parameter | Type |
---|---|
evt | IMouseEvent | IPointerEvent |
Returns
void
Inherited from
BaseSelectionRenderService
._checkClearPreviousControls
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:831
_clearAllSelectionControls()
protected _clearAllSelectionControls(): void
Returns
void
Inherited from
BaseSelectionRenderService
._clearAllSelectionControls
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:343
_clearUpdatingListeners()
protected _clearUpdatingListeners(): void
Returns
void
Inherited from
BaseSelectionRenderService
._clearUpdatingListeners
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:720
_getFreeze()
protected _getFreeze(): Nullable<IFreeze>
Returns
Inherited from
BaseSelectionRenderService
._getFreeze
Defined in
submodules/univer/packages/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
Parameter | Type | Description |
---|---|---|
offsetX | number | position X in viewport. |
offsetY | number | - |
scaleX | number | - |
scaleY | number | - |
scrollXY | object | - |
scrollXY.x | number | - |
scrollXY.y | number | - |
Returns
selection range with coord.
Inherited from
BaseSelectionRenderService
._getSelectionWithCoordByOffset
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:765
_getViewportByCell()
protected _getViewportByCell(row?, column?): Nullable<Viewport>
Parameters
Parameter | Type |
---|---|
row ? | number |
column ? | number |
Returns
Inherited from
BaseSelectionRenderService
._getViewportByCell
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:357
_makeSelectionByTwoCells()
protected _makeSelectionByTwoCells(
currentCell,
startSelectionRange,
skeleton,
rangeType,
activeControl): void
Parameters
Parameter | Type |
---|---|
currentCell | ICellWithCoord |
startSelectionRange | IRangeWithCoord |
skeleton | SpreadsheetSkeleton |
rangeType | RANGE_TYPE |
activeControl | SelectionShape |
Returns
void
Inherited from
BaseSelectionRenderService
._makeSelectionByTwoCells
Defined in
submodules/univer/packages/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
Parameter | Type |
---|---|
offsetX | number |
offsetY | number |
activeSelectionControl | Nullable <SelectionShape > |
rangeType | RANGE_TYPE |
Returns
void
Inherited from
BaseSelectionRenderService
._movingHandler
Defined in
submodules/univer/packages/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
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
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/selection-render.service.ts:257
_reset()
protected _reset(): void
Clear existed selections by workbookSelections.selectionMoveEnd$
Returns
void
Inherited from
BaseSelectionRenderService
._reset
Defined in
submodules/univer/packages/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
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:217
_setSelectionStyle()
protected _setSelectionStyle(style): void
Parameters
Parameter | Type |
---|---|
style | ISelectionStyle |
Returns
void
Inherited from
BaseSelectionRenderService
._setSelectionStyle
Defined in
submodules/univer/packages/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
Parameter | Type | Default value |
---|---|---|
viewportMain | Nullable <Viewport > | undefined |
activeSelectionControl | SelectionShape | undefined |
rangeType | RANGE_TYPE | undefined |
scrollTimerType | ScrollTimerType | ScrollTimerType.ALL |
moveStartPosX | number | undefined |
moveStartPosY | number | undefined |
Returns
void
Inherited from
BaseSelectionRenderService
._setupPointerMoveListener
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:446
attachPrimaryWithCoord()
attachPrimaryWithCoord(primary): ICellWithCoord
Parameters
Parameter | Type |
---|---|
primary | ICellInfo |
Returns
Deprecated
Use the function attachPrimaryWithCoord
instead`.
Inherited from
BaseSelectionRenderService
.attachPrimaryWithCoord
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:622
attachSelectionWithCoord()
attachSelectionWithCoord(selectionWithStyle): ISelectionWithCoord
Parameters
Parameter | Type |
---|---|
selectionWithStyle | ISelectionWithStyle |
Returns
Deprecated
Use the function attachSelectionWithCoord
instead`.
Inherited from
BaseSelectionRenderService
.attachSelectionWithCoord
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:617
dispose()
dispose(): void
Returns
void
Implementation of
Inherited from
BaseSelectionRenderService
.dispose
Defined in
submodules/univer/packages/core/src/shared/lifecycle.ts:106
disposeWithMe()
disposeWithMe(disposable): IDisposable
Parameters
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
Inherited from
BaseSelectionRenderService
.disposeWithMe
Defined in
submodules/univer/packages/core/src/shared/lifecycle.ts:96
endSelection()
endSelection(): void
Returns
void
Inherited from
BaseSelectionRenderService
.endSelection
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:410
ensureNotDisposed()
protected ensureNotDisposed(): void
Returns
void
Inherited from
BaseSelectionRenderService
.ensureNotDisposed
Defined in
submodules/univer/packages/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
Inherited from
BaseSelectionRenderService
.getActiveRange
Defined in
submodules/univer/packages/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 Parameter | Default type |
---|---|
T extends SelectionShape | SelectionShape |
Returns
Nullable
<T
>
T extends SelectionControl
Inherited from
BaseSelectionRenderService
.getActiveSelectionControl
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:403
getCellWithCoordByOffset()
getCellWithCoordByOffset(x, y): ICellWithCoord
Parameters
Parameter | Type |
---|---|
x | number |
y | number |
Returns
Inherited from
BaseSelectionRenderService
.getCellWithCoordByOffset
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:633
getSelectionCellByPosition()
getSelectionCellByPosition(x, y): ICellWithCoord
Parameters
Parameter | Type |
---|---|
x | number |
y | number |
Returns
Deprecated
Please use getCellWithCoordByOffset
instead.
Inherited from
BaseSelectionRenderService
.getSelectionCellByPosition
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:629
getSelectionControls()
getSelectionControls(): SelectionShape[]
Returns
TODO
lumixraku DO NOT expose private props.
Inherited from
BaseSelectionRenderService
.getSelectionControls
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:325
getSelectionDataWithStyle()
getSelectionDataWithStyle(): ISelectionWithCoord[]
Generate selectionData from this._selectionControls.model .
Returns
{range, primary, style}[]
Inherited from
BaseSelectionRenderService
.getSelectionDataWithStyle
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:311
getSkeleton()
getSkeleton(): SpreadsheetSkeleton
Returns
Inherited from
BaseSelectionRenderService
.getSkeleton
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:303
getViewPort()
getViewPort(): Viewport
Returns
Deprecated
This should not be provided by the selection render service.
Inherited from
BaseSelectionRenderService
.getViewPort
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:222
newSelectionControl()
newSelectionControl(
scene,
skeleton,
selection): SelectionShape
Parameters
Parameter | Type |
---|---|
scene | Scene |
skeleton | SpreadsheetSkeleton |
selection | ISelectionWithStyle |
Returns
Inherited from
BaseSelectionRenderService
.newSelectionControl
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:230
refreshSelectionMoveEnd()
refreshSelectionMoveEnd(): void
Returns
void
Inherited from
BaseSelectionRenderService
.refreshSelectionMoveEnd
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:289
refreshSelectionMoveStart()
refreshSelectionMoveStart(): void
Returns
void
Inherited from
BaseSelectionRenderService
.refreshSelectionMoveStart
Defined in
submodules/univer/packages/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
Parameter | Type |
---|---|
selectionsWithStyleList | readonly ISelectionWithStyle [] |
Returns
void
Inherited from
BaseSelectionRenderService
.resetSelectionsByModelData
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:262
setSingleSelectionEnabled()
setSingleSelectionEnabled(enabled): void
Parameters
Parameter | Type | Default value |
---|---|---|
enabled | boolean | false |
Returns
void
Inherited from
BaseSelectionRenderService
.setSingleSelectionEnabled
Defined in
submodules/univer/packages/sheets-ui/src/services/selection/base-selection-render.service.ts:226