@univerjs/sheets-ui 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -4
- package/lib/cjs/index.js +12 -12
- package/lib/es/index.js +10669 -11574
- package/lib/locale/vi-VN.json +613 -0
- package/lib/locale/zh-TW.json +613 -0
- package/lib/types/controllers/auto-fill.controller.d.ts +3 -5
- package/lib/types/controllers/auto-height.controller.d.ts +2 -2
- package/lib/types/controllers/defined-name/defined-name.controller.d.ts +15 -0
- package/lib/types/controllers/editor/editing.render-controller.d.ts +2 -2
- package/lib/types/controllers/format-painter/format-painter.controller.d.ts +4 -4
- package/lib/types/controllers/move-range.controller.d.ts +7 -5
- package/lib/types/controllers/permission/sheet-permission-init.controller.d.ts +1 -1
- package/lib/types/controllers/permission/sheet-permission-interceptor-base.controller.d.ts +2 -2
- package/lib/types/controllers/permission/sheet-permission-interceptor-canvas-render.controller.d.ts +3 -3
- package/lib/types/controllers/permission/sheet-permission-interceptor-clipboard.controller.d.ts +2 -2
- package/lib/types/controllers/render-controllers/contextmenu.render-controller.d.ts +3 -3
- package/lib/types/controllers/render-controllers/editor-bridge.render-controller.d.ts +2 -2
- package/lib/types/controllers/render-controllers/freeze.render-controller.d.ts +2 -2
- package/lib/types/controllers/render-controllers/header-menu.render-controller.d.ts +2 -2
- package/lib/types/controllers/render-controllers/header-move.render-controller.d.ts +5 -8
- package/lib/types/controllers/render-controllers/mobile/mobile-contextmenu.render-controller.d.ts +3 -3
- package/lib/types/controllers/render-controllers/mobile/mobile-scroll.render-controller.d.ts +2 -2
- package/lib/types/controllers/render-controllers/scroll.render-controller.d.ts +5 -5
- package/lib/types/controllers/status-bar.controller.d.ts +2 -2
- package/lib/types/controllers/utils/component-tools.d.ts +1 -5
- package/lib/types/controllers/utils/selections-tools.d.ts +3 -0
- package/lib/types/index.d.ts +6 -3
- package/lib/types/locale/vi-VN.d.ts +4 -0
- package/lib/types/locale/zh-TW.d.ts +4 -0
- package/lib/types/services/auto-fill/auto-fill.service.d.ts +2 -2
- package/lib/types/services/clipboard/clipboard.service.d.ts +4 -3
- package/lib/types/services/editor-bridge.service.d.ts +1 -3
- package/lib/types/services/format-painter/format-painter.service.d.ts +4 -4
- package/lib/types/services/mark-selection/mark-selection.service.d.ts +1 -3
- package/lib/types/services/selection/base-selection-render.service.d.ts +173 -0
- package/lib/types/services/selection/const.d.ts +9 -0
- package/lib/types/services/selection/mobile-selection-render.service.d.ts +44 -150
- package/lib/types/services/selection/selection-render-model.d.ts +1 -1
- package/lib/types/services/selection/selection-render.service.d.ts +27 -210
- package/lib/types/services/selection/selection-shape-extension.d.ts +4 -1
- package/lib/types/services/selection/selection-shape.d.ts +3 -5
- package/lib/types/services/selection/util.d.ts +6 -0
- package/lib/types/services/sheet-skeleton-manager.service.d.ts +5 -2
- package/lib/types/services/shortcut-experience.service.d.ts +2 -0
- package/lib/types/services/utils/selection-util.d.ts +4 -0
- package/lib/umd/index.js +14 -14
- package/package.json +20 -20
- package/lib/types/controllers/render-controllers/mobile/mobile-selection.render-controller.d.ts +0 -40
- package/lib/types/controllers/render-controllers/selection.render-controller.d.ts +0 -37
- package/lib/types/services/selection/__test__/create-service-test-bed.d.ts +0 -9
- package/lib/types/services/selection/__test__/selection-render.test.d.ts +0 -16
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { IInterceptor, IRange, IRangeWithCoord, ISelectionCell, ISelectionCellWithMergeInfo, ISelectionWithCoord, Nullable, ThemeService, Disposable, InterceptorManager, RANGE_TYPE } from '@univerjs/core';
|
|
2
|
+
import { IMouseEvent, IPointerEvent, IRenderManagerService, IRenderModule, Scene, SpreadsheetSkeleton, Viewport, ScrollTimer, ScrollTimerType } from '@univerjs/engine-render';
|
|
3
|
+
import { ISelectionStyle, ISelectionWithCoordAndStyle, ISelectionWithStyle } from '@univerjs/sheets';
|
|
4
|
+
import { IShortcutService } from '@univerjs/ui';
|
|
5
|
+
import { Injector } from '@wendellhu/redi';
|
|
6
|
+
import { Observable, Subscription, BehaviorSubject, Subject } from 'rxjs';
|
|
7
|
+
import { SelectionControl } from './selection-shape';
|
|
8
|
+
|
|
9
|
+
export interface IControlFillConfig {
|
|
10
|
+
oldRange: IRange;
|
|
11
|
+
newRange: IRange;
|
|
12
|
+
}
|
|
13
|
+
export interface ISheetSelectionRenderService {
|
|
14
|
+
readonly selectionMoveEnd$: Observable<ISelectionWithCoordAndStyle[]>;
|
|
15
|
+
readonly controlFillConfig$: Observable<IControlFillConfig | null>;
|
|
16
|
+
readonly selectionMoving$: Observable<ISelectionWithCoordAndStyle[]>;
|
|
17
|
+
readonly selectionMoveStart$: Observable<ISelectionWithCoordAndStyle[]>;
|
|
18
|
+
interceptor: InterceptorManager<{
|
|
19
|
+
RANGE_MOVE_PERMISSION_CHECK: IInterceptor<boolean, null>;
|
|
20
|
+
RANGE_FILL_PERMISSION_CHECK: IInterceptor<boolean, {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
skeleton: SpreadsheetSkeleton;
|
|
24
|
+
scene: Scene;
|
|
25
|
+
}>;
|
|
26
|
+
}>;
|
|
27
|
+
/** @deprecated This should not be provided by the selection render service. */
|
|
28
|
+
getViewPort(): Viewport;
|
|
29
|
+
getSkeleton(): SpreadsheetSkeleton;
|
|
30
|
+
getSelectionControls(): SelectionControl[];
|
|
31
|
+
/** @deprecated Use the function `attachSelectionWithCoord` instead. */
|
|
32
|
+
attachSelectionWithCoord(selectionWithStyle: ISelectionWithStyle): ISelectionWithCoordAndStyle;
|
|
33
|
+
/** @deprecated Use the function `attachPrimaryWithCoord` instead`. */
|
|
34
|
+
attachPrimaryWithCoord(primary: Nullable<Partial<ISelectionCell>>): Nullable<ISelectionCellWithMergeInfo>;
|
|
35
|
+
getSelectionCellByPosition(x: number, y: number): Nullable<ISelectionCellWithMergeInfo>;
|
|
36
|
+
}
|
|
37
|
+
export declare const ISheetSelectionRenderService: import('@wendellhu/redi').IdentifierDecorator<ISheetSelectionRenderService>;
|
|
38
|
+
/**
|
|
39
|
+
* The basic implementation of selection rendering logics. It is designed to be reused for different purposes.
|
|
40
|
+
*/
|
|
41
|
+
export declare class BaseSelectionRenderService extends Disposable implements ISheetSelectionRenderService, IRenderModule {
|
|
42
|
+
protected readonly _injector: Injector;
|
|
43
|
+
protected readonly _themeService: ThemeService;
|
|
44
|
+
protected readonly _shortcutService: IShortcutService;
|
|
45
|
+
protected readonly _renderManagerService: IRenderManagerService;
|
|
46
|
+
private _downObserver;
|
|
47
|
+
protected _scenePointerMoveSub: Nullable<Subscription>;
|
|
48
|
+
protected _scenePointerUpSub: Nullable<Subscription>;
|
|
49
|
+
private _controlFillConfig$;
|
|
50
|
+
readonly controlFillConfig$: Observable<IControlFillConfig | null>;
|
|
51
|
+
protected _selectionControls: SelectionControl[];
|
|
52
|
+
protected _startRangeWhenPointerDown: IRangeWithCoord;
|
|
53
|
+
/**
|
|
54
|
+
* the posX of viewport when the pointer down
|
|
55
|
+
*/
|
|
56
|
+
protected _startViewportPosX: number;
|
|
57
|
+
/**
|
|
58
|
+
* the posY of viewport when the pointer down
|
|
59
|
+
*/
|
|
60
|
+
protected _startViewportPosY: number;
|
|
61
|
+
protected _scrollTimer: ScrollTimer;
|
|
62
|
+
private _cancelDownSubscription;
|
|
63
|
+
private _cancelUpSubscription;
|
|
64
|
+
protected _skeleton: SpreadsheetSkeleton;
|
|
65
|
+
protected _scene: Scene;
|
|
66
|
+
protected _isHeaderHighlight: boolean;
|
|
67
|
+
protected _shouldDetectMergedCells: boolean;
|
|
68
|
+
protected _selectionStyle: ISelectionStyle;
|
|
69
|
+
protected _remainLastEnabled: boolean;
|
|
70
|
+
protected _skipLastEnabled: boolean;
|
|
71
|
+
protected _singleSelectionEnabled: boolean;
|
|
72
|
+
protected readonly _selectionMoveEnd$: BehaviorSubject<ISelectionWithCoordAndStyle[]>;
|
|
73
|
+
readonly selectionMoveEnd$: Observable<ISelectionWithCoordAndStyle[]>;
|
|
74
|
+
protected readonly _selectionMoving$: Subject<ISelectionWithCoordAndStyle[]>;
|
|
75
|
+
readonly selectionMoving$: Observable<ISelectionWithCoordAndStyle[]>;
|
|
76
|
+
protected readonly _selectionMoveStart$: Subject<ISelectionWithCoordAndStyle[]>;
|
|
77
|
+
readonly selectionMoveStart$: Observable<ISelectionWithCoordAndStyle[]>;
|
|
78
|
+
protected _activeViewport: Nullable<Viewport>;
|
|
79
|
+
readonly interceptor: InterceptorManager<{
|
|
80
|
+
RANGE_MOVE_PERMISSION_CHECK: IInterceptor<boolean, null>;
|
|
81
|
+
RANGE_FILL_PERMISSION_CHECK: IInterceptor<boolean, {
|
|
82
|
+
x: number;
|
|
83
|
+
y: number;
|
|
84
|
+
skeleton: SpreadsheetSkeleton;
|
|
85
|
+
scene: Scene;
|
|
86
|
+
}>;
|
|
87
|
+
}>;
|
|
88
|
+
constructor(_injector: Injector, _themeService: ThemeService, _shortcutService: IShortcutService, _renderManagerService: IRenderManagerService);
|
|
89
|
+
protected _setStyle(style: ISelectionStyle): void;
|
|
90
|
+
protected _resetStyle(): void;
|
|
91
|
+
/** @deprecated This should not be provided by the selection render service. */
|
|
92
|
+
getViewPort(): Viewport;
|
|
93
|
+
/**
|
|
94
|
+
* add a selection
|
|
95
|
+
*
|
|
96
|
+
* in PC:init & pointerup would call this function.
|
|
97
|
+
*
|
|
98
|
+
* init
|
|
99
|
+
* selectionController@_initSkeletonChangeListener --> selectionManagerService.add --> selectionManagerService._selectionMoveEnd$ --> this.addControlToCurrentByRangeData
|
|
100
|
+
*
|
|
101
|
+
* selectionMoveEnd$ --> this.addSelectionControlBySelectionData
|
|
102
|
+
*
|
|
103
|
+
*
|
|
104
|
+
*
|
|
105
|
+
* pointer
|
|
106
|
+
* engine@_pointerDownEvent --> spreadsheet?.onPointerDownObserve --> eventTrigger --> scene@disableEvent() --> then scene.input-manager currentObject is always scene until scene@enableEvent.
|
|
107
|
+
* engine@_pointerUpEvent --> scene.input-manager@_onPointerUp --> this._selectionMoveEnd$ --> _selectionManagerService.selectionMoveEnd$ --> this.addControlToCurrentByRangeData
|
|
108
|
+
*
|
|
109
|
+
* but in mobile, we do not call disableEvent() in eventTrigger,
|
|
110
|
+
* so pointerup --> scene.input-manager currentObject is spreadsheet --> this.eventTrigger
|
|
111
|
+
*
|
|
112
|
+
*
|
|
113
|
+
* columnHeader pointerup$ --> selectionMoveEnd$ --> selectionManagerService@setSelections -->
|
|
114
|
+
* selectionManagerService@_emitOnEnd -->
|
|
115
|
+
* _workbookSelections.selectionMoveEnd$ --> _addSelectionControlBySelectionData
|
|
116
|
+
*
|
|
117
|
+
*
|
|
118
|
+
* @param selectionData
|
|
119
|
+
*/
|
|
120
|
+
protected _addSelectionControlBySelectionData(selection: ISelectionWithCoordAndStyle): void;
|
|
121
|
+
newSelectionControl(scene: Scene, _rangeType: RANGE_TYPE): SelectionControl;
|
|
122
|
+
updateControlForCurrentByRangeData(selections: ISelectionWithCoordAndStyle[]): void;
|
|
123
|
+
refreshSelectionMoveStart(): void;
|
|
124
|
+
protected _changeRuntime(skeleton: SpreadsheetSkeleton, scene: Scene, viewport?: Viewport): void;
|
|
125
|
+
getSkeleton(): SpreadsheetSkeleton;
|
|
126
|
+
getSelectionDataWithStyle(): ISelectionWithCoordAndStyle[];
|
|
127
|
+
getSelectionControls(): SelectionControl[];
|
|
128
|
+
protected _clearSelectionControls(): void;
|
|
129
|
+
protected _getFreeze(): import('@univerjs/core').IFreeze | undefined;
|
|
130
|
+
protected _getViewportByCell(row?: number, column?: number): Viewport | null | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* 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.
|
|
133
|
+
*/
|
|
134
|
+
getActiveRange(): Nullable<IRange>;
|
|
135
|
+
/**
|
|
136
|
+
* get active selection control
|
|
137
|
+
* @returns T extends SelectionControl
|
|
138
|
+
*/
|
|
139
|
+
getActiveSelectionControl<T extends SelectionControl = SelectionControl>(): Nullable<T>;
|
|
140
|
+
endSelection(): void;
|
|
141
|
+
protected _reset(): void;
|
|
142
|
+
resetAndEndSelection(): void;
|
|
143
|
+
/**
|
|
144
|
+
*
|
|
145
|
+
* @param evt component point event
|
|
146
|
+
* @param style selection style, Styles for user-customized selectors
|
|
147
|
+
* @param _zIndex Stacking order of the selection object
|
|
148
|
+
* @param rangeType Determines whether the selection is made normally according to the range or by rows and columns
|
|
149
|
+
*/
|
|
150
|
+
protected _onPointerDown(evt: IPointerEvent | IMouseEvent, _zIndex?: number, rangeType?: RANGE_TYPE, viewport?: Viewport, scrollTimerType?: ScrollTimerType): false | undefined;
|
|
151
|
+
protected _setupPointerMoveListener(viewportMain: Nullable<Viewport>, activeSelectionControl: SelectionControl, rangeType: RANGE_TYPE, scrollTimerType: ScrollTimerType | undefined, moveStartPosX: number, moveStartPosY: number): void;
|
|
152
|
+
/** @deprecated Use the function `attachSelectionWithCoord` instead`. */
|
|
153
|
+
attachSelectionWithCoord(selectionWithStyle: ISelectionWithStyle): ISelectionWithCoordAndStyle;
|
|
154
|
+
/** @deprecated Use the function `attachPrimaryWithCoord` instead`. */
|
|
155
|
+
attachPrimaryWithCoord(primary: ISelectionCell): ISelectionCellWithMergeInfo;
|
|
156
|
+
getSelectionCellByPosition(x: number, y: number): Nullable<ISelectionCellWithMergeInfo>;
|
|
157
|
+
/**
|
|
158
|
+
* 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
|
|
159
|
+
*/
|
|
160
|
+
protected _moving(offsetX: number, offsetY: number, activeSelectionControl: Nullable<SelectionControl>, rangeType: RANGE_TYPE): false | undefined;
|
|
161
|
+
protected _updateSelectionControlRange(control: SelectionControl, newSelectionRange: IRangeWithCoord, highlight: Nullable<ISelectionCellWithMergeInfo>): void;
|
|
162
|
+
private _clearMove;
|
|
163
|
+
protected _clearEndingListeners(): void;
|
|
164
|
+
protected _addEndingListeners(): void;
|
|
165
|
+
protected _getCellRangeByCursorPosition(offsetX: number, offsetY: number, scaleX: number, scaleY: number, scrollXY: {
|
|
166
|
+
x: number;
|
|
167
|
+
y: number;
|
|
168
|
+
}): Nullable<ISelectionWithCoord>;
|
|
169
|
+
protected _checkClearPreviousControls(evt: IPointerEvent | IMouseEvent): void;
|
|
170
|
+
private _performSelectionByTwoCells;
|
|
171
|
+
}
|
|
172
|
+
export declare function getAllSelection(skeleton: SpreadsheetSkeleton): ISelectionWithStyle;
|
|
173
|
+
export declare function getTopLeftSelection(skeleton: SpreadsheetSkeleton): ISelectionWithStyle;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Scene, SpreadsheetSkeleton } from '@univerjs/engine-render';
|
|
2
|
+
|
|
3
|
+
export declare const RANGE_MOVE_PERMISSION_CHECK: import('@univerjs/core').IInterceptor<boolean, null>;
|
|
4
|
+
export declare const RANGE_FILL_PERMISSION_CHECK: import('@univerjs/core').IInterceptor<boolean, {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
skeleton: SpreadsheetSkeleton;
|
|
8
|
+
scene: Scene;
|
|
9
|
+
}>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IMouseEvent, IPointerEvent,
|
|
3
|
-
import {
|
|
1
|
+
import { Workbook, ICommandService, IContextService, ILogService, RANGE_TYPE, ThemeService } from '@univerjs/core';
|
|
2
|
+
import { IMouseEvent, IPointerEvent, IRenderContext, IRenderModule, Scene, Viewport, IRenderManagerService } from '@univerjs/engine-render';
|
|
3
|
+
import { SheetsSelectionsService } from '@univerjs/sheets';
|
|
4
4
|
import { IShortcutService } from '@univerjs/ui';
|
|
5
5
|
import { Injector } from '@wendellhu/redi';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { ScrollManagerService } from '../scroll-manager.service';
|
|
7
|
+
import { SheetSkeletonManagerService } from '../sheet-skeleton-manager.service';
|
|
8
|
+
import { BaseSelectionRenderService } from './base-selection-render.service';
|
|
8
9
|
import { MobileSelectionControl } from './mobile-selection-shape';
|
|
9
10
|
|
|
10
11
|
declare enum ExpandingControl {
|
|
@@ -15,130 +16,26 @@ declare enum ExpandingControl {
|
|
|
15
16
|
TOP = "top",
|
|
16
17
|
BOTTOM = "bottom"
|
|
17
18
|
}
|
|
18
|
-
export declare class
|
|
19
|
-
private readonly
|
|
20
|
-
private readonly
|
|
21
|
-
private readonly
|
|
22
|
-
private readonly
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
private
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
readonly controlFillConfig$: import('rxjs').Observable<IControlFillConfig | null>;
|
|
30
|
-
private _selectionControls;
|
|
31
|
-
private _activeCellRangeOfCurrSelection;
|
|
32
|
-
private _startOffsetX;
|
|
33
|
-
private _startOffsetY;
|
|
34
|
-
private _scrollTimer;
|
|
35
|
-
private _skeleton;
|
|
36
|
-
private _scene;
|
|
37
|
-
private _isHeaderHighlight;
|
|
38
|
-
private _isDetectMergedCell;
|
|
39
|
-
private _selectionStyle;
|
|
40
|
-
private _isSelectionEnabled;
|
|
41
|
-
private _isShowPreviousEnable;
|
|
42
|
-
private _isRemainLastEnable;
|
|
43
|
-
private _isSkipRemainLastEnable;
|
|
44
|
-
private _isSingleSelection;
|
|
45
|
-
private readonly _selectionMoveEnd$;
|
|
46
|
-
readonly selectionMoveEnd$: import('rxjs').Observable<ISelectionWithCoordAndStyle[]>;
|
|
47
|
-
private readonly _selectionMoving$;
|
|
48
|
-
/**
|
|
49
|
-
* Triggered during the drawing of the selection area.
|
|
50
|
-
*/
|
|
51
|
-
readonly selectionMoving$: import('rxjs').Observable<ISelectionWithCoordAndStyle[]>;
|
|
52
|
-
private readonly _selectionMoveStart$;
|
|
53
|
-
/**
|
|
54
|
-
* Triggered during the start draw the selection area.
|
|
55
|
-
*/
|
|
56
|
-
readonly selectionMoveStart$: import('rxjs').Observable<ISelectionWithCoordAndStyle[]>;
|
|
57
|
-
private _activeViewport;
|
|
58
|
-
/**
|
|
59
|
-
* This service relies on the scene and skeleton to work
|
|
60
|
-
* Use usable$ to check if this service works
|
|
61
|
-
*/
|
|
62
|
-
private readonly _usable$;
|
|
63
|
-
readonly usable$: import('rxjs').Observable<boolean>;
|
|
64
|
-
interceptor: InterceptorManager<{
|
|
65
|
-
RANGE_MOVE_PERMISSION_CHECK: import('@univerjs/core').IInterceptor<boolean, null>;
|
|
66
|
-
RANGE_FILL_PERMISSION_CHECK: import('@univerjs/core').IInterceptor<boolean, {
|
|
67
|
-
x: number;
|
|
68
|
-
y: number;
|
|
69
|
-
skeleton: SpreadsheetSkeleton;
|
|
70
|
-
scene: Scene;
|
|
71
|
-
}>;
|
|
72
|
-
}>;
|
|
19
|
+
export declare class MobileSheetsSelectionRenderService extends BaseSelectionRenderService implements IRenderModule {
|
|
20
|
+
private readonly _context;
|
|
21
|
+
private readonly _logService;
|
|
22
|
+
private readonly _commandService;
|
|
23
|
+
private readonly _contextService;
|
|
24
|
+
private readonly _sheetSkeletonManagerService;
|
|
25
|
+
private readonly _scrollManagerService;
|
|
26
|
+
private readonly _workbookSelections;
|
|
27
|
+
private _renderDisposable;
|
|
28
|
+
_expandingSelection: boolean;
|
|
29
|
+
protected _selectionControls: MobileSelectionControl[];
|
|
73
30
|
expandingControlMode: ExpandingControl;
|
|
74
|
-
constructor(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
disableSelection(): void;
|
|
83
|
-
enableShowPrevious(): void;
|
|
84
|
-
disableShowPrevious(): void;
|
|
85
|
-
enableRemainLast(): void;
|
|
86
|
-
disableRemainLast(): void;
|
|
87
|
-
enableSkipRemainLast(): void;
|
|
88
|
-
disableSkipRemainLast(): void;
|
|
89
|
-
enableSingleSelection(): void;
|
|
90
|
-
disableSingleSelection(): void;
|
|
91
|
-
getViewPort(): Viewport;
|
|
92
|
-
/**
|
|
93
|
-
* add a selection
|
|
94
|
-
*
|
|
95
|
-
* in PC:init & pointerup would call this function.
|
|
96
|
-
*
|
|
97
|
-
* init
|
|
98
|
-
* selectionController@_initSkeletonChangeListener --> selectionManagerService.add --> selectionManagerService._selectionMoveEnd$ --> this.addControlToCurrentByRangeData
|
|
99
|
-
*
|
|
100
|
-
* selectionMoveEnd$ --> this.addSelectionControlBySelectionData
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* pointer
|
|
105
|
-
* engine@_pointerDownEvent --> spreadsheet?.onPointerDownObserve --> eventTrigger --> scene@disableEvent() --> then scene.input-manager currentObject is always scene until scene@enableEvent.
|
|
106
|
-
* engine@_pointerUpEvent --> scene.input-manager@_onPointerUp --> this._selectionMoveEnd$ --> _selectionManagerService.selectionMoveEnd$ --> this.addControlToCurrentByRangeData
|
|
107
|
-
*
|
|
108
|
-
* but in mobile, we do not call disableEvent() in eventTrigger,
|
|
109
|
-
* so pointerup --> scene.input-manager currentObject is spreadsheet --> this.eventTrigger
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* @param selectionData
|
|
114
|
-
*/
|
|
115
|
-
addSelectionControlBySelectionData(selectionData: ISelectionWithCoordAndStyle): void;
|
|
116
|
-
newSelectionControl(scene: Scene, rangeType: RANGE_TYPE): MobileSelectionControl;
|
|
117
|
-
updateControlForCurrentByRangeData(selections: ISelectionWithCoordAndStyle[]): void;
|
|
118
|
-
refreshSelectionMoveStart(): void;
|
|
119
|
-
changeRuntime(skeleton: Nullable<SpreadsheetSkeleton>, scene: Nullable<Scene>, viewport?: Viewport): void;
|
|
120
|
-
getSelectionDataWithStyle(): ISelectionWithCoordAndStyle[];
|
|
121
|
-
getSelectionControls(): SelectionControl[];
|
|
122
|
-
private _clearSelectionControls;
|
|
123
|
-
private _getFreeze;
|
|
124
|
-
private _getViewportByCell;
|
|
125
|
-
/**
|
|
126
|
-
* Returns the list of active ranges in the active sheet or null if there are no active ranges.
|
|
127
|
-
* If there is a single range selected, this method behaves like a getActiveRange() call.
|
|
128
|
-
*/
|
|
129
|
-
getActiveSelections(): Nullable<ISelection[]>;
|
|
130
|
-
/**
|
|
131
|
-
* 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.
|
|
132
|
-
*/
|
|
133
|
-
getActiveRange(): Nullable<IRange>;
|
|
134
|
-
/**
|
|
135
|
-
* get last selection control
|
|
136
|
-
*/
|
|
137
|
-
getActiveSelectionControl(): Nullable<SelectionControl>;
|
|
138
|
-
endSelection(): void;
|
|
139
|
-
reset(): void;
|
|
140
|
-
resetAndEndSelection(): void;
|
|
141
|
-
expandingSelection: boolean;
|
|
31
|
+
constructor(_context: IRenderContext<Workbook>, injector: Injector, themeService: ThemeService, shortcutService: IShortcutService, renderManagerService: IRenderManagerService, selectionManagerService: SheetsSelectionsService, _logService: ILogService, _commandService: ICommandService, _contextService: IContextService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _scrollManagerService: ScrollManagerService);
|
|
32
|
+
private _init;
|
|
33
|
+
private _initSkeletonChangeListener;
|
|
34
|
+
private _initSelectionChangeListener;
|
|
35
|
+
private _initEventListeners;
|
|
36
|
+
private _initSpreadsheetEvent;
|
|
37
|
+
private _initUserActionSyncListener;
|
|
38
|
+
private _updateSelections;
|
|
142
39
|
/**
|
|
143
40
|
* invoked when pointerup or longpress on spreadsheet, or pointerdown on row&col
|
|
144
41
|
* then move curr selection to cell at cursor
|
|
@@ -148,32 +45,29 @@ export declare class MobileSelectionRenderService implements ISelectionRenderSer
|
|
|
148
45
|
* @param rangeType
|
|
149
46
|
* @param viewport
|
|
150
47
|
*/
|
|
151
|
-
|
|
48
|
+
createNewSelection(evt: IPointerEvent | IMouseEvent, _zIndex?: number, rangeType?: RANGE_TYPE, viewport?: Viewport): false | undefined;
|
|
152
49
|
/**
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* @param
|
|
156
|
-
* @param
|
|
157
|
-
* @
|
|
158
|
-
*
|
|
159
|
-
* invoked by selection.render-controller@pointerDownObserver
|
|
160
|
-
*
|
|
161
|
-
* derived from eventTrigger
|
|
50
|
+
* Not same as PC version,
|
|
51
|
+
* new selection control for mobile do one more thing: bind event for two control points.
|
|
52
|
+
* @param scene
|
|
53
|
+
* @param rangeType
|
|
54
|
+
* @returns
|
|
162
55
|
*/
|
|
56
|
+
newSelectionControl(scene: Scene, rangeType: RANGE_TYPE): MobileSelectionControl;
|
|
57
|
+
private _getActiveViewport;
|
|
58
|
+
private _getSheetObject;
|
|
59
|
+
private _normalSelectionDisabled;
|
|
60
|
+
getSelectionControls(): MobileSelectionControl[];
|
|
163
61
|
private _fillControlPointerDownHandler;
|
|
164
|
-
|
|
165
|
-
attachRangeWithCoord(range: IRange): Nullable<IRangeWithCoord>;
|
|
166
|
-
attachPrimaryWithCoord(primary: Nullable<ISelectionCell>): Nullable<ISelectionCellWithMergeInfo>;
|
|
167
|
-
getSelectionCellByPosition(x: number, y: number): Nullable<ISelectionCellWithMergeInfo>;
|
|
168
|
-
/**
|
|
169
|
-
* 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
|
|
170
|
-
*/
|
|
171
|
-
private _movingHandler;
|
|
62
|
+
private _changeCurrCellWhenControlPointerDown;
|
|
172
63
|
/**
|
|
173
|
-
*
|
|
64
|
+
* Not same as _moving in base selection render service
|
|
65
|
+
* The diff is
|
|
66
|
+
* In base version, new selection is determined by the cursor cell and _startRangeWhenPointerDown
|
|
67
|
+
*
|
|
68
|
+
* In Mobile version, new selection is determined by cursor cell and current of activeSelectionControl.model
|
|
174
69
|
*/
|
|
175
|
-
|
|
176
|
-
private
|
|
177
|
-
private _getCellRangeByCursorPosition;
|
|
70
|
+
protected _moving(offsetX: number, offsetY: number, activeSelectionControl: MobileSelectionControl, rangeType: RANGE_TYPE): false | undefined;
|
|
71
|
+
private _updateControlPointWhenScrolling;
|
|
178
72
|
}
|
|
179
73
|
export {};
|
|
@@ -46,7 +46,7 @@ export declare class SelectionRenderModel implements IRangeWithCoord {
|
|
|
46
46
|
get rangeType(): RANGE_TYPE;
|
|
47
47
|
isEqual(rangeWithCoord: IRangeWithCoord): boolean;
|
|
48
48
|
isInclude(rangeWithCoord: IRangeWithCoord): boolean;
|
|
49
|
-
highlightToSelection():
|
|
49
|
+
highlightToSelection(): IRangeWithCoord | undefined;
|
|
50
50
|
getRange(): {
|
|
51
51
|
startColumn: number;
|
|
52
52
|
startRow: number;
|
|
@@ -1,216 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Workbook, ICommandService, IContextService, ILogService, ThemeService } from '@univerjs/core';
|
|
2
|
+
import { IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
|
|
3
|
+
import { SheetsSelectionsService } from '@univerjs/sheets';
|
|
4
4
|
import { IShortcutService } from '@univerjs/ui';
|
|
5
5
|
import { Injector } from '@wendellhu/redi';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { SheetSkeletonManagerService } from '../sheet-skeleton-manager.service';
|
|
7
|
+
import { BaseSelectionRenderService } from './base-selection-render.service';
|
|
8
8
|
|
|
9
|
-
export interface IControlFillConfig {
|
|
10
|
-
oldRange: IRange;
|
|
11
|
-
newRange: IRange;
|
|
12
|
-
}
|
|
13
|
-
export interface ISelectionRenderService {
|
|
14
|
-
readonly selectionMoveEnd$: Observable<ISelectionWithCoordAndStyle[]>;
|
|
15
|
-
readonly controlFillConfig$: Observable<IControlFillConfig | null>;
|
|
16
|
-
readonly selectionMoving$: Observable<ISelectionWithCoordAndStyle[]>;
|
|
17
|
-
readonly selectionMoveStart$: Observable<ISelectionWithCoordAndStyle[]>;
|
|
18
|
-
readonly usable$: Observable<boolean>;
|
|
19
|
-
interceptor: InterceptorManager<{
|
|
20
|
-
RANGE_MOVE_PERMISSION_CHECK: IInterceptor<boolean, null>;
|
|
21
|
-
RANGE_FILL_PERMISSION_CHECK: IInterceptor<boolean, {
|
|
22
|
-
x: number;
|
|
23
|
-
y: number;
|
|
24
|
-
skeleton: SpreadsheetSkeleton;
|
|
25
|
-
scene: Scene;
|
|
26
|
-
}>;
|
|
27
|
-
}>;
|
|
28
|
-
enableHeaderHighlight(): void;
|
|
29
|
-
disableHeaderHighlight(): void;
|
|
30
|
-
enableDetectMergedCell(): void;
|
|
31
|
-
disableDetectMergedCell(): void;
|
|
32
|
-
setStyle(style: ISelectionStyle): void;
|
|
33
|
-
resetStyle(): void;
|
|
34
|
-
enableSelection(): void;
|
|
35
|
-
disableSelection(): void;
|
|
36
|
-
enableShowPrevious(): void;
|
|
37
|
-
disableShowPrevious(): void;
|
|
38
|
-
enableRemainLast(): void;
|
|
39
|
-
disableRemainLast(): void;
|
|
40
|
-
enableSkipRemainLast(): void;
|
|
41
|
-
disableSkipRemainLast(): void;
|
|
42
|
-
addSelectionControlBySelectionData(data: ISelectionWithCoordAndStyle): void;
|
|
43
|
-
updateControlForCurrentByRangeData(selections: ISelectionWithCoordAndStyle[]): void;
|
|
44
|
-
changeRuntime(skeleton: Nullable<SpreadsheetSkeleton>, scene: Nullable<Scene>, viewport?: Viewport): void;
|
|
45
|
-
/** @deprecated This should not be provided by the selection render service. */
|
|
46
|
-
getViewPort(): Viewport;
|
|
47
|
-
getSelectionControls(): SelectionShape[];
|
|
48
|
-
getActiveSelections(): Nullable<ISelection[]>;
|
|
49
|
-
getActiveRange(): Nullable<IRange>;
|
|
50
|
-
getActiveSelectionControl(): Nullable<SelectionShape>;
|
|
51
|
-
getSelectionDataWithStyle(): ISelectionWithCoordAndStyle[];
|
|
52
|
-
attachSelectionWithCoord(selectionWithStyle: ISelectionWithStyle): ISelectionWithCoordAndStyle;
|
|
53
|
-
attachRangeWithCoord(range: IRange): Nullable<IRangeWithCoord>;
|
|
54
|
-
attachPrimaryWithCoord(primary: Nullable<ISelectionCell>): Nullable<ISelectionCellWithMergeInfo>;
|
|
55
|
-
getSelectionCellByPosition(x: number, y: number): Nullable<ISelectionCellWithMergeInfo>;
|
|
56
|
-
eventTrigger(evt: IPointerEvent | IMouseEvent, zIndex: number, rangeType: RANGE_TYPE, viewport?: Viewport, scrollTimerType?: ScrollTimerType): void;
|
|
57
|
-
reset(): void;
|
|
58
|
-
refreshSelectionMoveStart(): void;
|
|
59
|
-
enableSingleSelection(): void;
|
|
60
|
-
disableSingleSelection(): void;
|
|
61
|
-
}
|
|
62
9
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* SelectionRenderService 维护 viewModel 数据 list,action 也是修改这一层数据,obs 监听到数据变动后,自动刷新(control 仍然可以持有数据)
|
|
66
|
-
*
|
|
67
|
-
* This service is related to the drawing of the selection.
|
|
68
|
-
* By modifying the properties of the service,
|
|
69
|
-
* you can adjust the style and performance of each selection area.
|
|
70
|
-
* This service is used in conjunction with the SelectionManagerService
|
|
71
|
-
* to implement functions related to the selection area in univer.
|
|
72
|
-
*
|
|
73
|
-
* @todo Refactor it to RenderController.
|
|
10
|
+
* This services controls rendering of normal selections in a render unit.
|
|
11
|
+
* The normal selections would also be used by Auto Fill and Copy features.
|
|
74
12
|
*/
|
|
75
|
-
export declare
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
private
|
|
85
|
-
private
|
|
86
|
-
private
|
|
87
|
-
|
|
88
|
-
private
|
|
89
|
-
private
|
|
90
|
-
private
|
|
91
|
-
private
|
|
92
|
-
private
|
|
93
|
-
|
|
94
|
-
private
|
|
95
|
-
private _startSelectionRange;
|
|
96
|
-
private _startOffsetX;
|
|
97
|
-
private _startOffsetY;
|
|
98
|
-
private _scrollTimer;
|
|
99
|
-
private _skeleton;
|
|
100
|
-
private _scene;
|
|
101
|
-
private _isHeaderHighlight;
|
|
102
|
-
private _isDetectMergedCell;
|
|
103
|
-
private _selectionStyle;
|
|
104
|
-
private _isSelectionEnabled;
|
|
105
|
-
private _isShowPreviousEnable;
|
|
106
|
-
private _isRemainLastEnable;
|
|
107
|
-
private _isSkipRemainLastEnable;
|
|
108
|
-
private _isSingleSelection;
|
|
109
|
-
private readonly _selectionMoveEnd$;
|
|
110
|
-
readonly selectionMoveEnd$: Observable<ISelectionWithCoordAndStyle[]>;
|
|
111
|
-
private readonly _selectionMoving$;
|
|
112
|
-
/**
|
|
113
|
-
* Triggered during the drawing of the selection area.
|
|
114
|
-
*/
|
|
115
|
-
readonly selectionMoving$: Observable<ISelectionWithCoordAndStyle[]>;
|
|
116
|
-
private readonly _selectionMoveStart$;
|
|
117
|
-
/**
|
|
118
|
-
* Triggered during the start draw the selection area.
|
|
119
|
-
*/
|
|
120
|
-
readonly selectionMoveStart$: Observable<ISelectionWithCoordAndStyle[]>;
|
|
121
|
-
private _activeViewport;
|
|
122
|
-
/**
|
|
123
|
-
* This service relies on the scene and skeleton to work
|
|
124
|
-
* Use usable$ to check if this service works
|
|
125
|
-
*/
|
|
126
|
-
private readonly _usable$;
|
|
127
|
-
readonly usable$: Observable<boolean>;
|
|
128
|
-
interceptor: InterceptorManager<{
|
|
129
|
-
RANGE_MOVE_PERMISSION_CHECK: IInterceptor<boolean, null>;
|
|
130
|
-
RANGE_FILL_PERMISSION_CHECK: IInterceptor<boolean, {
|
|
131
|
-
x: number;
|
|
132
|
-
y: number;
|
|
133
|
-
skeleton: SpreadsheetSkeleton;
|
|
134
|
-
scene: Scene;
|
|
135
|
-
}>;
|
|
136
|
-
}>;
|
|
137
|
-
constructor(_themeService: ThemeService, _shortcutService: IShortcutService, _renderManagerService: IRenderManagerService, _injector: Injector);
|
|
138
|
-
enableHeaderHighlight(): void;
|
|
139
|
-
disableHeaderHighlight(): void;
|
|
140
|
-
enableDetectMergedCell(): void;
|
|
141
|
-
disableDetectMergedCell(): void;
|
|
142
|
-
setStyle(style: ISelectionStyle): void;
|
|
143
|
-
resetStyle(): void;
|
|
144
|
-
enableSelection(): void;
|
|
145
|
-
disableSelection(): void;
|
|
146
|
-
enableShowPrevious(): void;
|
|
147
|
-
disableShowPrevious(): void;
|
|
148
|
-
enableRemainLast(): void;
|
|
149
|
-
disableRemainLast(): void;
|
|
150
|
-
enableSkipRemainLast(): void;
|
|
151
|
-
disableSkipRemainLast(): void;
|
|
152
|
-
enableSingleSelection(): void;
|
|
153
|
-
disableSingleSelection(): void;
|
|
154
|
-
getViewPort(): Viewport;
|
|
155
|
-
/**
|
|
156
|
-
* add a selection
|
|
157
|
-
* @param data
|
|
158
|
-
*/
|
|
159
|
-
addSelectionControlBySelectionData(data: ISelectionWithCoordAndStyle): void;
|
|
160
|
-
updateControlForCurrentByRangeData(selections: ISelectionWithCoordAndStyle[]): void;
|
|
161
|
-
refreshSelectionMoveStart(): void;
|
|
162
|
-
changeRuntime(skeleton: Nullable<SpreadsheetSkeleton>, scene: Nullable<Scene>, viewport?: Viewport): void;
|
|
163
|
-
getSelectionDataWithStyle(): ISelectionWithCoordAndStyle[];
|
|
164
|
-
getSelectionControls(): SelectionShape[];
|
|
165
|
-
private _clearSelectionControls;
|
|
166
|
-
private _getFreeze;
|
|
167
|
-
private _getViewportByCell;
|
|
168
|
-
/**
|
|
169
|
-
* Returns the list of active ranges in the active sheet or null if there are no active ranges.
|
|
170
|
-
* If there is a single range selected, this behaves as a getActiveRange() call.
|
|
171
|
-
*
|
|
172
|
-
* @returns
|
|
173
|
-
*/
|
|
174
|
-
getActiveSelections(): Nullable<ISelection[]>;
|
|
175
|
-
/**
|
|
176
|
-
* 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.
|
|
177
|
-
* TODO: 默认最后一个选区为当前激活选区,或者当前激活单元格所在选区为激活选区
|
|
178
|
-
* @returns
|
|
179
|
-
*/
|
|
180
|
-
getActiveRange(): Nullable<IRange>;
|
|
181
|
-
/**
|
|
182
|
-
* get active selection control
|
|
183
|
-
* @returns
|
|
184
|
-
*/
|
|
185
|
-
getActiveSelectionControl(): Nullable<SelectionShape>;
|
|
186
|
-
endSelection(): void;
|
|
187
|
-
/**
|
|
188
|
-
* first, clear All selection controls
|
|
189
|
-
* then unsubscribe all events
|
|
190
|
-
*/
|
|
191
|
-
reset(): void;
|
|
192
|
-
resetAndEndSelection(): void;
|
|
193
|
-
/**
|
|
194
|
-
*
|
|
195
|
-
* @param evt component point event
|
|
196
|
-
* @param style selection style, Styles for user-customized selectors
|
|
197
|
-
* @param zIndex Stacking order of the selection object
|
|
198
|
-
* @param rangeType Determines whether the selection is made normally according to the range or by rows and columns
|
|
199
|
-
*/
|
|
200
|
-
eventTrigger(evt: IPointerEvent | IMouseEvent, zIndex?: number, rangeType?: RANGE_TYPE, viewport?: Viewport, scrollTimerType?: ScrollTimerType): false | undefined;
|
|
201
|
-
attachSelectionWithCoord(selectionWithStyle: ISelectionWithStyle): ISelectionWithCoordAndStyle;
|
|
202
|
-
attachRangeWithCoord(range: IRange): Nullable<IRangeWithCoord>;
|
|
203
|
-
attachPrimaryWithCoord(primary: Nullable<ISelectionCell>): Nullable<ISelectionCellWithMergeInfo>;
|
|
204
|
-
getSelectionCellByPosition(x: number, y: number): Nullable<ISelectionCellWithMergeInfo>;
|
|
205
|
-
/**
|
|
206
|
-
* 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
|
|
207
|
-
*/
|
|
208
|
-
private _moving;
|
|
209
|
-
private _endSelection;
|
|
210
|
-
private _addCancelObserver;
|
|
211
|
-
private _getSelectedRangeWithMerge;
|
|
13
|
+
export declare class SheetSelectionRenderService extends BaseSelectionRenderService implements IRenderModule {
|
|
14
|
+
private readonly _context;
|
|
15
|
+
private readonly _logService;
|
|
16
|
+
private readonly _commandService;
|
|
17
|
+
private readonly _contextService;
|
|
18
|
+
private readonly _sheetSkeletonManagerService;
|
|
19
|
+
private readonly _workbookSelections;
|
|
20
|
+
private _renderDisposable;
|
|
21
|
+
constructor(_context: IRenderContext<Workbook>, injector: Injector, themeService: ThemeService, shortcutService: IShortcutService, renderManagerService: IRenderManagerService, selectionManagerService: SheetsSelectionsService, _logService: ILogService, _commandService: ICommandService, _contextService: IContextService, _sheetSkeletonManagerService: SheetSkeletonManagerService);
|
|
22
|
+
private _init;
|
|
23
|
+
private _initEventListeners;
|
|
24
|
+
private _initThemeChangeListener;
|
|
25
|
+
private _refreshSelection;
|
|
26
|
+
private _normalSelectionDisabled;
|
|
27
|
+
private _initSelectionChangeListener;
|
|
28
|
+
private _initUserActionSyncListener;
|
|
29
|
+
private _updateSelections;
|
|
30
|
+
private _initSkeletonChangeListener;
|
|
31
|
+
private _getActiveViewport;
|
|
32
|
+
private _getSheetObject;
|
|
212
33
|
}
|
|
213
|
-
/**
|
|
214
|
-
* @deprecated Should be refactored to RenderUnit.
|
|
215
|
-
*/
|
|
216
|
-
export declare const ISelectionRenderService: import('@wendellhu/redi').IdentifierDecorator<SelectionRenderService>;
|