@univerjs/sheets-ui 0.2.2 → 0.2.4-alpha.0

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.
Files changed (90) hide show
  1. package/README.md +11 -4
  2. package/lib/cjs/index.js +15 -15
  3. package/lib/es/index.js +11191 -12072
  4. package/lib/locale/vi-VN.json +613 -0
  5. package/lib/locale/zh-TW.json +613 -0
  6. package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +2 -3
  7. package/lib/types/commands/commands/__tests__/create-selection-command-test-bed.d.ts +12 -12
  8. package/lib/types/commands/operations/cell-edit.operation.d.ts +2 -0
  9. package/lib/types/common/utils.d.ts +1 -2
  10. package/lib/types/controllers/auto-fill.controller.d.ts +4 -7
  11. package/lib/types/controllers/auto-height.controller.d.ts +3 -4
  12. package/lib/types/controllers/clipboard/clipboard.controller.d.ts +1 -2
  13. package/lib/types/controllers/clipboard/utils.d.ts +1 -2
  14. package/lib/types/controllers/defined-name/defined-name.controller.d.ts +15 -0
  15. package/lib/types/controllers/editor/__tests__/create-test-bed.d.ts +1 -2
  16. package/lib/types/controllers/editor/editing.render-controller.d.ts +25 -10
  17. package/lib/types/controllers/format-painter/format-painter.controller.d.ts +5 -6
  18. package/lib/types/controllers/hover-render.controller.d.ts +2 -2
  19. package/lib/types/controllers/menu/__tests__/create-menu-test-bed.d.ts +6 -6
  20. package/lib/types/controllers/menu/border.menu.d.ts +1 -1
  21. package/lib/types/controllers/menu/clear.menu.d.ts +1 -1
  22. package/lib/types/controllers/menu/delete.menu.d.ts +1 -1
  23. package/lib/types/controllers/menu/insert.menu.d.ts +1 -1
  24. package/lib/types/controllers/menu/menu-util.d.ts +1 -2
  25. package/lib/types/controllers/menu/menu.d.ts +1 -2
  26. package/lib/types/controllers/menu/merge.menu.d.ts +1 -1
  27. package/lib/types/controllers/menu/permission-menu-util.d.ts +1 -1
  28. package/lib/types/controllers/menu/permission.menu.d.ts +1 -1
  29. package/lib/types/controllers/menu/sheet.menu.d.ts +1 -1
  30. package/lib/types/controllers/mobile/mobile-sheet-ui.controller.d.ts +1 -2
  31. package/lib/types/controllers/move-range.controller.d.ts +7 -5
  32. package/lib/types/controllers/permission/sheet-permission-init.controller.d.ts +1 -1
  33. package/lib/types/controllers/permission/sheet-permission-interceptor-base.controller.d.ts +4 -2
  34. package/lib/types/controllers/permission/sheet-permission-interceptor-canvas-render.controller.d.ts +3 -3
  35. package/lib/types/controllers/permission/sheet-permission-interceptor-clipboard.controller.d.ts +2 -2
  36. package/lib/types/controllers/permission/sheet-permission-interceptor-formula-render.controller.d.ts +1 -2
  37. package/lib/types/controllers/permission/sheet-permission-render.controller.d.ts +1 -2
  38. package/lib/types/controllers/render-controllers/contextmenu.render-controller.d.ts +3 -3
  39. package/lib/types/controllers/render-controllers/editor-bridge.render-controller.d.ts +8 -6
  40. package/lib/types/controllers/render-controllers/freeze.render-controller.d.ts +4 -5
  41. package/lib/types/controllers/render-controllers/header-menu.render-controller.d.ts +2 -2
  42. package/lib/types/controllers/render-controllers/header-move.render-controller.d.ts +5 -8
  43. package/lib/types/controllers/render-controllers/mobile/mobile-contextmenu.render-controller.d.ts +3 -3
  44. package/lib/types/controllers/render-controllers/mobile/mobile-scroll.render-controller.d.ts +3 -3
  45. package/lib/types/controllers/render-controllers/scroll.render-controller.d.ts +5 -6
  46. package/lib/types/controllers/sheet-ui.controller.d.ts +1 -2
  47. package/lib/types/controllers/status-bar.controller.d.ts +2 -2
  48. package/lib/types/controllers/utils/component-tools.d.ts +1 -5
  49. package/lib/types/controllers/utils/range-tools.d.ts +1 -2
  50. package/lib/types/controllers/utils/selections-tools.d.ts +3 -1
  51. package/lib/types/index.d.ts +6 -3
  52. package/lib/types/locale/vi-VN.d.ts +4 -0
  53. package/lib/types/locale/zh-TW.d.ts +4 -0
  54. package/lib/types/mobile-sheets-ui-plugin.d.ts +1 -2
  55. package/lib/types/services/auto-fill/auto-fill.service.d.ts +4 -5
  56. package/lib/types/services/auto-fill/type.d.ts +1 -2
  57. package/lib/types/services/canvas-pop-manager.service.d.ts +1 -2
  58. package/lib/types/services/cell-alert-manager.service.d.ts +1 -1
  59. package/lib/types/services/clipboard/__tests__/clipboard-test-bed.d.ts +7 -8
  60. package/lib/types/services/clipboard/clipboard.service.d.ts +5 -5
  61. package/lib/types/services/drag-manager.service.d.ts +1 -3
  62. package/lib/types/services/editor/cell-editor-manager.service.d.ts +2 -3
  63. package/lib/types/services/editor/formula-editor-manager.service.d.ts +2 -3
  64. package/lib/types/services/editor-bridge.service.d.ts +7 -7
  65. package/lib/types/services/format-painter/format-painter.service.d.ts +5 -5
  66. package/lib/types/services/hover-manager.service.d.ts +1 -3
  67. package/lib/types/services/mark-selection/mark-selection.service.d.ts +2 -4
  68. package/lib/types/services/permission/worksheet-permission-render.service.d.ts +1 -1
  69. package/lib/types/services/scroll-manager.service.d.ts +7 -6
  70. package/lib/types/services/selection/base-selection-render.service.d.ts +173 -0
  71. package/lib/types/services/selection/const.d.ts +9 -0
  72. package/lib/types/services/selection/mobile-selection-render.service.d.ts +44 -151
  73. package/lib/types/services/selection/selection-render-model.d.ts +9 -31
  74. package/lib/types/services/selection/selection-render.service.d.ts +27 -211
  75. package/lib/types/services/selection/selection-shape-extension.d.ts +5 -3
  76. package/lib/types/services/selection/selection-shape.d.ts +3 -5
  77. package/lib/types/services/selection/util.d.ts +6 -0
  78. package/lib/types/services/sheet-bar/sheet-bar.service.d.ts +2 -3
  79. package/lib/types/services/sheet-skeleton-manager.service.d.ts +6 -4
  80. package/lib/types/services/sheets-render.service.d.ts +1 -2
  81. package/lib/types/services/shortcut-experience.service.d.ts +3 -2
  82. package/lib/types/services/status-bar.service.d.ts +2 -3
  83. package/lib/types/services/utils/selection-util.d.ts +4 -0
  84. package/lib/types/sheets-ui-plugin.d.ts +1 -2
  85. package/lib/umd/index.js +15 -15
  86. package/package.json +23 -25
  87. package/lib/types/controllers/render-controllers/mobile/mobile-selection.render-controller.d.ts +0 -40
  88. package/lib/types/controllers/render-controllers/selection.render-controller.d.ts +0 -37
  89. package/lib/types/services/selection/__test__/create-service-test-bed.d.ts +0 -9
  90. package/lib/types/services/selection/__test__/selection-render.test.d.ts +0 -16
@@ -0,0 +1,173 @@
1
+ import { IInterceptor, Injector, 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 { Observable, Subscription, BehaviorSubject, Subject } from 'rxjs';
6
+ import { SelectionControl } from './selection-shape';
7
+
8
+ export interface IControlFillConfig {
9
+ oldRange: IRange;
10
+ newRange: IRange;
11
+ }
12
+ export interface ISheetSelectionRenderService {
13
+ readonly selectionMoveEnd$: Observable<ISelectionWithCoordAndStyle[]>;
14
+ readonly controlFillConfig$: Observable<IControlFillConfig | null>;
15
+ readonly selectionMoving$: Observable<ISelectionWithCoordAndStyle[]>;
16
+ readonly selectionMoveStart$: Observable<ISelectionWithCoordAndStyle[]>;
17
+ interceptor: InterceptorManager<{
18
+ RANGE_MOVE_PERMISSION_CHECK: IInterceptor<boolean, null>;
19
+ RANGE_FILL_PERMISSION_CHECK: IInterceptor<boolean, {
20
+ x: number;
21
+ y: number;
22
+ skeleton: SpreadsheetSkeleton;
23
+ scene: Scene;
24
+ }>;
25
+ }>;
26
+ /** @deprecated This should not be provided by the selection render service. */
27
+ getViewPort(): Viewport;
28
+ getSkeleton(): SpreadsheetSkeleton;
29
+ getSelectionControls(): SelectionControl[];
30
+ /** @deprecated Use the function `attachSelectionWithCoord` instead. */
31
+ attachSelectionWithCoord(selectionWithStyle: ISelectionWithStyle): ISelectionWithCoordAndStyle;
32
+ /** @deprecated Use the function `attachPrimaryWithCoord` instead`. */
33
+ attachPrimaryWithCoord(primary: Nullable<Partial<ISelectionCell>>): Nullable<ISelectionCellWithMergeInfo>;
34
+ getSelectionCellByPosition(x: number, y: number): Nullable<ISelectionCellWithMergeInfo>;
35
+ setSingleSelectionEnabled(enabled: boolean): void;
36
+ }
37
+ export declare const ISheetSelectionRenderService: import('@univerjs/core').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
+ setSingleSelectionEnabled(enabled?: boolean): void;
94
+ /**
95
+ * add a selection
96
+ *
97
+ * in PC:init & pointerup would call this function.
98
+ *
99
+ * init
100
+ * selectionController@_initSkeletonChangeListener --> selectionManagerService.add --> selectionManagerService._selectionMoveEnd$ --> this.addControlToCurrentByRangeData
101
+ *
102
+ * selectionMoveEnd$ --> this.addSelectionControlBySelectionData
103
+ *
104
+ *
105
+ *
106
+ * pointer
107
+ * engine@_pointerDownEvent --> spreadsheet?.onPointerDownObserve --> eventTrigger --> scene@disableEvent() --> then scene.input-manager currentObject is always scene until scene@enableEvent.
108
+ * engine@_pointerUpEvent --> scene.input-manager@_onPointerUp --> this._selectionMoveEnd$ --> _selectionManagerService.selectionMoveEnd$ --> this.addControlToCurrentByRangeData
109
+ *
110
+ * but in mobile, we do not call disableEvent() in eventTrigger,
111
+ * so pointerup --> scene.input-manager currentObject is spreadsheet --> this.eventTrigger
112
+ *
113
+ *
114
+ * columnHeader pointerup$ --> selectionMoveEnd$ --> selectionManagerService@setSelections -->
115
+ * selectionManagerService@_emitOnEnd -->
116
+ * _workbookSelections.selectionMoveEnd$ --> _addSelectionControlBySelectionData
117
+ *
118
+ *
119
+ * @param selectionData
120
+ */
121
+ protected _addSelectionControlBySelectionData(selection: ISelectionWithCoordAndStyle): void;
122
+ newSelectionControl(scene: Scene, _rangeType: RANGE_TYPE): SelectionControl;
123
+ updateControlForCurrentByRangeData(selections: ISelectionWithCoordAndStyle[]): void;
124
+ refreshSelectionMoveStart(): void;
125
+ protected _changeRuntime(skeleton: SpreadsheetSkeleton, scene: Scene, viewport?: Viewport): void;
126
+ getSkeleton(): SpreadsheetSkeleton;
127
+ getSelectionDataWithStyle(): ISelectionWithCoordAndStyle[];
128
+ getSelectionControls(): SelectionControl[];
129
+ protected _clearSelectionControls(): void;
130
+ protected _getFreeze(): import('@univerjs/core').IFreeze | undefined;
131
+ protected _getViewportByCell(row?: number, column?: number): Viewport | null | undefined;
132
+ /**
133
+ * 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.
134
+ */
135
+ getActiveRange(): Nullable<IRange>;
136
+ /**
137
+ * get active selection control
138
+ * @returns T extends SelectionControl
139
+ */
140
+ getActiveSelectionControl<T extends SelectionControl = SelectionControl>(): Nullable<T>;
141
+ endSelection(): void;
142
+ protected _reset(): void;
143
+ resetAndEndSelection(): void;
144
+ /**
145
+ *
146
+ * @param evt component point event
147
+ * @param style selection style, Styles for user-customized selectors
148
+ * @param _zIndex Stacking order of the selection object
149
+ * @param rangeType Determines whether the selection is made normally according to the range or by rows and columns
150
+ */
151
+ protected _onPointerDown(evt: IPointerEvent | IMouseEvent, _zIndex?: number, rangeType?: RANGE_TYPE, viewport?: Viewport, scrollTimerType?: ScrollTimerType): false | undefined;
152
+ protected _setupPointerMoveListener(viewportMain: Nullable<Viewport>, activeSelectionControl: SelectionControl, rangeType: RANGE_TYPE, scrollTimerType: ScrollTimerType | undefined, moveStartPosX: number, moveStartPosY: number): void;
153
+ /** @deprecated Use the function `attachSelectionWithCoord` instead`. */
154
+ attachSelectionWithCoord(selectionWithStyle: ISelectionWithStyle): ISelectionWithCoordAndStyle;
155
+ /** @deprecated Use the function `attachPrimaryWithCoord` instead`. */
156
+ attachPrimaryWithCoord(primary: ISelectionCell): ISelectionCellWithMergeInfo;
157
+ getSelectionCellByPosition(x: number, y: number): Nullable<ISelectionCellWithMergeInfo>;
158
+ /**
159
+ * 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
160
+ */
161
+ protected _moving(offsetX: number, offsetY: number, activeSelectionControl: Nullable<SelectionControl>, rangeType: RANGE_TYPE): false | undefined;
162
+ protected _updateSelectionControlRange(control: SelectionControl, newSelectionRange: IRangeWithCoord, highlight: Nullable<ISelectionCellWithMergeInfo>): void;
163
+ protected _clearUpdatingListeners(): 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,10 @@
1
- import { IRange, IRangeWithCoord, ISelection, ISelectionCell, ISelectionCellWithMergeInfo, Nullable, InterceptorManager, RANGE_TYPE, ThemeService } from '@univerjs/core';
2
- import { IMouseEvent, IPointerEvent, Scene, SpreadsheetSkeleton, Viewport, IRenderManagerService } from '@univerjs/engine-render';
3
- import { ISelectionStyle, ISelectionWithCoordAndStyle, ISelectionWithStyle } from '@univerjs/sheets';
1
+ import { Workbook, ICommandService, IContextService, ILogService, Injector, 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
- import { Injector } from '@wendellhu/redi';
6
- import { SelectionControl } from './selection-shape';
7
- import { IControlFillConfig, ISelectionRenderService } from './selection-render.service';
5
+ import { SheetScrollManagerService } from '../scroll-manager.service';
6
+ import { SheetSkeletonManagerService } from '../sheet-skeleton-manager.service';
7
+ import { BaseSelectionRenderService } from './base-selection-render.service';
8
8
  import { MobileSelectionControl } from './mobile-selection-shape';
9
9
 
10
10
  declare enum ExpandingControl {
@@ -15,130 +15,26 @@ declare enum ExpandingControl {
15
15
  TOP = "top",
16
16
  BOTTOM = "bottom"
17
17
  }
18
- export declare class MobileSelectionRenderService implements ISelectionRenderService {
19
- private readonly _themeService;
20
- private readonly _shortcutService;
21
- private readonly _renderManagerService;
22
- private readonly _injector;
23
- hasSelection: boolean;
24
- private _pointerdownSub;
25
- private _mainScenePointerUpSub;
26
- private _scenePointerMoveSub;
27
- private _scenePointerUpSub;
28
- private _controlFillConfig$;
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
- }>;
18
+ export declare class MobileSheetsSelectionRenderService extends BaseSelectionRenderService implements IRenderModule {
19
+ private readonly _context;
20
+ private readonly _logService;
21
+ private readonly _commandService;
22
+ private readonly _contextService;
23
+ private readonly _sheetSkeletonManagerService;
24
+ private readonly _scrollManagerService;
25
+ private readonly _workbookSelections;
26
+ private _renderDisposable;
27
+ _expandingSelection: boolean;
28
+ protected _selectionControls: MobileSelectionControl[];
73
29
  expandingControlMode: ExpandingControl;
74
- constructor(_themeService: ThemeService, _shortcutService: IShortcutService, _renderManagerService: IRenderManagerService, _injector: Injector);
75
- enableHeaderHighlight(): void;
76
- disableHeaderHighlight(): void;
77
- enableDetectMergedCell(): void;
78
- disableDetectMergedCell(): void;
79
- setStyle(style: ISelectionStyle): void;
80
- resetStyle(): void;
81
- enableSelection(): void;
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;
30
+ constructor(_context: IRenderContext<Workbook>, injector: Injector, themeService: ThemeService, shortcutService: IShortcutService, renderManagerService: IRenderManagerService, selectionManagerService: SheetsSelectionsService, _logService: ILogService, _commandService: ICommandService, _contextService: IContextService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _scrollManagerService: SheetScrollManagerService);
31
+ private _init;
32
+ private _initSkeletonChangeListener;
33
+ private _initSelectionChangeListener;
34
+ private _initEventListeners;
35
+ private _initSpreadsheetEvent;
36
+ private _initUserActionSyncListener;
37
+ private _updateSelections;
142
38
  /**
143
39
  * invoked when pointerup or longpress on spreadsheet, or pointerdown on row&col
144
40
  * then move curr selection to cell at cursor
@@ -148,32 +44,29 @@ export declare class MobileSelectionRenderService implements ISelectionRenderSer
148
44
  * @param rangeType
149
45
  * @param viewport
150
46
  */
151
- eventTrigger(evt: IPointerEvent | IMouseEvent, _zIndex?: number, rangeType?: RANGE_TYPE, viewport?: Viewport): false | undefined;
47
+ createNewSelection(evt: IPointerEvent | IMouseEvent, _zIndex?: number, rangeType?: RANGE_TYPE, viewport?: Viewport): false | undefined;
152
48
  /**
153
- *
154
- * @param evt component point event
155
- * @param style selection style, Styles for user-customized selectors
156
- * @param zIndex Stacking order of the selection object
157
- * @param rangeType Determines whether the selection is made normally according to the range or by rows and columns
158
- *
159
- * invoked by selection.render-controller@pointerDownObserver
160
- *
161
- * derived from eventTrigger
49
+ * Not same as PC version,
50
+ * new selection control for mobile do one more thing: bind event for two control points.
51
+ * @param scene
52
+ * @param rangeType
53
+ * @returns
162
54
  */
55
+ newSelectionControl(scene: Scene, rangeType: RANGE_TYPE): MobileSelectionControl;
56
+ private _getActiveViewport;
57
+ private _getSheetObject;
58
+ private _normalSelectionDisabled;
59
+ getSelectionControls(): MobileSelectionControl[];
163
60
  private _fillControlPointerDownHandler;
164
- attachSelectionWithCoord(selectionWithStyle: ISelectionWithStyle): ISelectionWithCoordAndStyle;
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;
61
+ private _changeCurrCellWhenControlPointerDown;
172
62
  /**
173
- * rm pointerUp & pointerMove Observer on scene
63
+ * Not same as _moving in base selection render service
64
+ * The diff is
65
+ * In base version, new selection is determined by the cursor cell and _startRangeWhenPointerDown
66
+ *
67
+ * In Mobile version, new selection is determined by cursor cell and current of activeSelectionControl.model
174
68
  */
175
- private _endSelection;
176
- private _addCancelObserver;
177
- private _getCellRangeByCursorPosition;
69
+ protected _moving(offsetX: number, offsetY: number, activeSelectionControl: MobileSelectionControl, rangeType: RANGE_TYPE): false | undefined;
70
+ private _updateControlPointWhenScrolling;
178
71
  }
179
72
  export {};
@@ -5,9 +5,6 @@ export declare class SelectionRenderModel implements IRangeWithCoord {
5
5
  private _startRow;
6
6
  private _endColumn;
7
7
  private _endRow;
8
- /**
9
- * value from { startY, endY, startX, endX } = getCellPositionByIndex in basics/tools
10
- */
11
8
  private _startX;
12
9
  private _startY;
13
10
  private _endX;
@@ -17,47 +14,28 @@ export declare class SelectionRenderModel implements IRangeWithCoord {
17
14
  * when there is no merge info
18
15
  * top left cell of current selection (or bottomLeft of current selection)
19
16
  */
20
- private _currentCell;
17
+ private _primary;
21
18
  private _rangeType;
22
19
  get startColumn(): number;
23
20
  get startRow(): number;
24
21
  get endColumn(): number;
25
22
  get endRow(): number;
26
- /**
27
- * value from { startY, endY, startX, endX } = getCellPositionByIndex in basics/tools
28
- */
29
23
  get startX(): number;
30
- /**
31
- * value from { startY, endY, startX, endX } = getCellPositionByIndex in basics/tools
32
- */
33
24
  get startY(): number;
34
- /**
35
- * value from { startY, endY, startX, endX } = getCellPositionByIndex in basics/tools
36
- */
37
25
  get endX(): number;
38
- /**
39
- * value from { startY, endY, startX, endX } = getCellPositionByIndex in basics/tools
40
- */
41
26
  get endY(): number;
42
- /**
43
- * highlight cell of selection
44
- */
45
27
  get currentCell(): Nullable<ISelectionCellWithMergeInfo>;
46
28
  get rangeType(): RANGE_TYPE;
29
+ /**
30
+ * @deprecated, Duplicate with `Rectangle`
31
+ */
47
32
  isEqual(rangeWithCoord: IRangeWithCoord): boolean;
33
+ /**
34
+ * @deprecated, Duplicate with `Rectangle`
35
+ */
48
36
  isInclude(rangeWithCoord: IRangeWithCoord): boolean;
49
- highlightToSelection(): Nullable<IRangeWithCoord>;
50
- getRange(): {
51
- startColumn: number;
52
- startRow: number;
53
- endColumn: number;
54
- endRow: number;
55
- startX: number;
56
- startY: number;
57
- endX: number;
58
- endY: number;
59
- rangeType: RANGE_TYPE;
60
- };
37
+ highlightToSelection(): IRangeWithCoord | undefined;
38
+ getRange(): IRangeWithCoord;
61
39
  getCell(): Nullable<ISelectionCellWithMergeInfo>;
62
40
  getRangeType(): RANGE_TYPE;
63
41
  setRangeType(rangeType: RANGE_TYPE): void;