@univerjs/sheets-ui 0.5.0-alpha.0 → 0.5.0-beta.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.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +13 -13
- package/lib/es/facade.js +6 -6
- package/lib/es/index.js +5119 -5034
- package/lib/types/consts/permission.d.ts +1 -0
- package/lib/types/controllers/config.schema.d.ts +1 -0
- package/lib/types/controllers/permission/sheet-permission-render.controller.d.ts +5 -3
- package/lib/types/controllers/render-controllers/header-move.render-controller.d.ts +2 -2
- package/lib/types/facade/f-range.d.ts +2 -2
- package/lib/types/index.d.ts +8 -4
- package/lib/types/services/mark-selection/mark-selection.service.d.ts +3 -1
- package/lib/types/services/scroll-manager.service.d.ts +1 -1
- package/lib/types/services/selection/base-selection-render.service.d.ts +72 -59
- package/lib/types/services/selection/const.d.ts +3 -0
- package/lib/types/services/selection/mobile-selection-render.service.d.ts +7 -7
- package/lib/types/services/selection/mobile-selection-shape.d.ts +9 -4
- package/lib/types/services/selection/selection-control.d.ts +44 -22
- package/lib/types/services/selection/selection-render-model.d.ts +14 -7
- package/lib/types/services/selection/selection-render.service.d.ts +14 -3
- package/lib/types/services/selection/selection-shape-extension.d.ts +35 -13
- package/lib/types/services/selection/util.d.ts +18 -4
- package/lib/types/services/sheet-skeleton-manager.service.d.ts +0 -1
- package/lib/types/services/utils/doc-skeleton-util.d.ts +2 -2
- package/lib/types/services/utils/selection-util.d.ts +1 -1
- package/lib/types/views/permission/extensions/range-protection.render.d.ts +1 -1
- package/lib/types/views/permission/extensions/worksheet-permission.render.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +13 -13
- package/package.json +16 -17
|
@@ -2,6 +2,7 @@ import { UnitAction } from '@univerjs/protocol';
|
|
|
2
2
|
export declare const UNIVER_SHEET_PERMISSION_PLUGIN_NAME = "UNIVER_SHEET_PERMISSION_PLUGIN";
|
|
3
3
|
export declare const UNIVER_SHEET_PERMISSION_PANEL = "UNIVER_SHEET_PERMISSION_PANEL";
|
|
4
4
|
export declare const UNIVER_SHEET_PERMISSION_USER_PART = "UNIVER_SHEET_PERMISSION_USER_PART";
|
|
5
|
+
export declare const UNIVER_SHEET_PERMISSION_BACKGROUND = "UNIVER_SHEET_PERMISSION_BACKGROUND";
|
|
5
6
|
export declare const UNIVER_SHEET_PERMISSION_PANEL_FOOTER = "UNIVER_SHEET_PERMISSION_PANEL_FOOTER";
|
|
6
7
|
export declare const UNIVER_SHEET_PERMISSION_USER_DIALOG = "UNIVER_SHEET_PERMISSION_USER_DIALOG";
|
|
7
8
|
export declare const UNIVER_SHEET_PERMISSION_DIALOG = "UNIVER_SHEET_PERMISSION_DIALOG";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
|
|
2
2
|
import { MenuConfig, ComponentManager, IUIPartsService } from '@univerjs/ui';
|
|
3
|
-
import { Disposable, Injector, IPermissionService, IUniverInstanceService } from '@univerjs/core';
|
|
3
|
+
import { Disposable, IConfigService, Injector, IPermissionService, IUniverInstanceService } from '@univerjs/core';
|
|
4
4
|
import { RangeProtectionRuleModel, WorksheetProtectionRuleModel } from '@univerjs/sheets';
|
|
5
5
|
import { SheetSkeletonManagerService } from '../../services/sheet-skeleton-manager.service';
|
|
6
6
|
export interface IUniverSheetsPermissionMenuConfig {
|
|
@@ -20,9 +20,10 @@ export declare class SheetPermissionRenderController extends Disposable implemen
|
|
|
20
20
|
private _rangeProtectionRuleModel;
|
|
21
21
|
private _sheetSkeletonManagerService;
|
|
22
22
|
private _permissionService;
|
|
23
|
+
private _configService;
|
|
23
24
|
private _rangeProtectionCanViewRenderExtension;
|
|
24
25
|
private _rangeProtectionCanNotViewRenderExtension;
|
|
25
|
-
constructor(_context: IRenderContext, _rangeProtectionRuleModel: RangeProtectionRuleModel, _sheetSkeletonManagerService: SheetSkeletonManagerService, _permissionService: IPermissionService);
|
|
26
|
+
constructor(_context: IRenderContext, _rangeProtectionRuleModel: RangeProtectionRuleModel, _sheetSkeletonManagerService: SheetSkeletonManagerService, _permissionService: IPermissionService, _configService: IConfigService);
|
|
26
27
|
private _initRender;
|
|
27
28
|
private _initSkeleton;
|
|
28
29
|
}
|
|
@@ -32,8 +33,9 @@ export declare class WorksheetProtectionRenderController extends Disposable impl
|
|
|
32
33
|
private _univerInstanceService;
|
|
33
34
|
private _sheetSkeletonManagerService;
|
|
34
35
|
private _worksheetProtectionRuleModel;
|
|
36
|
+
private _configService;
|
|
35
37
|
private _worksheetProtectionRenderExtension;
|
|
36
|
-
constructor(_context: IRenderContext, _renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _worksheetProtectionRuleModel: WorksheetProtectionRuleModel);
|
|
38
|
+
constructor(_context: IRenderContext, _renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _worksheetProtectionRuleModel: WorksheetProtectionRuleModel, _configService: IConfigService);
|
|
37
39
|
private _initRender;
|
|
38
40
|
private _initSkeleton;
|
|
39
41
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SheetsSelectionsService } from '@univerjs/sheets';
|
|
1
|
+
import { IRange, Workbook, Disposable, ICommandService, InterceptorManager } from '@univerjs/core';
|
|
3
2
|
import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
3
|
+
import { SheetsSelectionsService } from '@univerjs/sheets';
|
|
4
4
|
import { SheetSkeletonManagerService } from '../../services/sheet-skeleton-manager.service';
|
|
5
5
|
export declare const HEADER_MOVE_PERMISSION_CHECK: import('@univerjs/core').IInterceptor<boolean, IRange>;
|
|
6
6
|
export declare class HeaderMoveRenderController extends Disposable implements IRenderModule {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ICellWithCoord, IDisposable, Nullable, DisposableCollection } from '@univerjs/core';
|
|
1
2
|
import { ComponentType, ComponentManager } from '@univerjs/ui';
|
|
2
|
-
import { DisposableCollection, IDisposable, ISelectionCellWithMergeInfo, Nullable } from '@univerjs/core';
|
|
3
3
|
import { FRange } from '@univerjs/sheets/facade';
|
|
4
4
|
import { ICanvasPopup, ICellAlert } from '@univerjs/sheets-ui';
|
|
5
5
|
export interface IFComponentKey {
|
|
@@ -21,7 +21,7 @@ interface IFRangeSheetsUIMixin {
|
|
|
21
21
|
* Return this cell information, including whether it is merged and cell coordinates
|
|
22
22
|
* @returns The cell information
|
|
23
23
|
*/
|
|
24
|
-
getCell():
|
|
24
|
+
getCell(): ICellWithCoord;
|
|
25
25
|
/**
|
|
26
26
|
* Returns the coordinates of this cell,does not include units
|
|
27
27
|
* @returns coordinates of the cell, top, right, bottom, left
|
package/lib/types/index.d.ts
CHANGED
|
@@ -47,11 +47,14 @@ export { EditorBridgeService, IEditorBridgeService, type IEditorBridgeServiceVis
|
|
|
47
47
|
export { MarkSelectionService } from './services/mark-selection/mark-selection.service';
|
|
48
48
|
export { IMarkSelectionService } from './services/mark-selection/mark-selection.service';
|
|
49
49
|
export { SheetSelectionRenderService } from './services/selection/selection-render.service';
|
|
50
|
-
export {
|
|
50
|
+
export { genSelectionByRange, getTopLeftSelectionOfCurrSheet, selectionDataForSelectAll as getAllSelection } from './services/selection/base-selection-render.service';
|
|
51
51
|
export { BaseSelectionRenderService, ISheetSelectionRenderService } from './services/selection/base-selection-render.service';
|
|
52
|
-
export { SelectionControl as SelectionShape } from './services/selection/selection-control';
|
|
52
|
+
export { SelectionControl as SelectionShape, SelectionControl } from './services/selection/selection-control';
|
|
53
|
+
export { SelectionShapeExtension } from './services/selection/selection-shape-extension';
|
|
54
|
+
export { genNormalSelectionStyle } from './services/selection/const';
|
|
53
55
|
export type { ISheetSkeletonManagerParam } from './services/sheet-skeleton-manager.service';
|
|
54
|
-
export {
|
|
56
|
+
export { SheetSkeletonManagerService } from './services/sheet-skeleton-manager.service';
|
|
57
|
+
export { attachPrimaryWithCoord, attachRangeWithCoord, attachSelectionWithCoord } from './services/selection/util';
|
|
55
58
|
export { UniverSheetsUIPlugin } from './plugin';
|
|
56
59
|
export { SheetRenderController } from './controllers/render-controllers/sheet.render-controller';
|
|
57
60
|
export { HoverManagerService } from './services/hover-manager.service';
|
|
@@ -90,10 +93,10 @@ export type { IFormatPainterBeforeApplyHookParams, IFormatPainterHook } from './
|
|
|
90
93
|
export { type IBaseSheetBarProps } from './views/sheet-bar/sheet-bar-tabs/SheetBarItem';
|
|
91
94
|
export { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT } from './components/font-family/interface';
|
|
92
95
|
export { FONT_SIZE_COMPONENT } from './components/font-size/interface';
|
|
93
|
-
export { attachPrimaryWithCoord, attachSelectionWithCoord } from './services/selection/util';
|
|
94
96
|
export { SELECTION_SHAPE_DEPTH } from './services/selection/const';
|
|
95
97
|
export { isRangeSelector, RANGE_SELECTOR_SYMBOLS } from './controllers/editor/utils/isRangeSelector';
|
|
96
98
|
export { EMBEDDING_FORMULA_EDITOR, isEmbeddingFormulaEditor } from './controllers/editor/utils/isEmbeddingFormulaEditor';
|
|
99
|
+
export { SheetCellEditorResizeService } from './services/editor/cell-editor-resize.service';
|
|
97
100
|
export { menuSchema } from './controllers/menu.schema';
|
|
98
101
|
export { getCellRealRange } from './common/utils';
|
|
99
102
|
export { AddWorksheetMergeAllCommand, AddWorksheetMergeCommand, AddWorksheetMergeHorizontalCommand, AddWorksheetMergeVerticalCommand } from './commands/commands/add-worksheet-merge.command';
|
|
@@ -126,3 +129,4 @@ export { SetZoomRatioOperation } from './commands/operations/set-zoom-ratio.oper
|
|
|
126
129
|
export { SheetPermissionOpenDialogOperation } from './commands/operations/sheet-permission-open-dialog.operation';
|
|
127
130
|
export { SheetPermissionOpenPanelOperation } from './commands/operations/sheet-permission-open-panel.operation';
|
|
128
131
|
export { SidebarDefinedNameOperation } from './commands/operations/sidebar-defined-name.operation';
|
|
132
|
+
export { UNIVER_SHEET_PERMISSION_BACKGROUND, UNIVER_SHEET_PERMISSION_USER_PART } from './consts/permission';
|
|
@@ -19,7 +19,9 @@ interface IMarkSelectionInfo {
|
|
|
19
19
|
}
|
|
20
20
|
export declare const IMarkSelectionService: import('@wendellhu/redi').IdentifierDecorator<IMarkSelectionService>;
|
|
21
21
|
/**
|
|
22
|
-
* For
|
|
22
|
+
* For copy and cut selection.
|
|
23
|
+
* also for selection when hover on conditional format items in the cf panel on the right.
|
|
24
|
+
* but hover on panel if data validation, uses another method to draw selection.
|
|
23
25
|
*/
|
|
24
26
|
export declare class MarkSelectionService extends Disposable implements IMarkSelectionService {
|
|
25
27
|
private readonly _currentService;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BehaviorSubject } from 'rxjs';
|
|
2
1
|
import { Nullable, Workbook } from '@univerjs/core';
|
|
3
2
|
import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
3
|
+
import { BehaviorSubject } from 'rxjs';
|
|
4
4
|
import { SheetSkeletonManagerService } from './sheet-skeleton-manager.service';
|
|
5
5
|
export interface IScrollState {
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ICellInfo, ICellWithCoord, IDisposable, IFreeze, IInterceptor, Injector, IRange, IRangeWithCoord, Nullable, ThemeService, Disposable, InterceptorManager, RANGE_TYPE } from '@univerjs/core';
|
|
2
2
|
import { IMouseEvent, IPointerEvent, IRenderModule, Scene, SpreadsheetSkeleton, Viewport, ScrollTimer, ScrollTimerType } from '@univerjs/engine-render';
|
|
3
|
-
import { ISelectionStyle,
|
|
3
|
+
import { ISelectionStyle, ISelectionWithCoord, ISelectionWithStyle } from '@univerjs/sheets';
|
|
4
4
|
import { IShortcutService } from '@univerjs/ui';
|
|
5
5
|
import { Observable, Subscription, BehaviorSubject, Subject } from 'rxjs';
|
|
6
6
|
import { SheetSkeletonManagerService } from '../sheet-skeleton-manager.service';
|
|
@@ -10,10 +10,10 @@ export interface IControlFillConfig {
|
|
|
10
10
|
newRange: IRange;
|
|
11
11
|
}
|
|
12
12
|
export interface ISheetSelectionRenderService {
|
|
13
|
-
readonly selectionMoveEnd$: Observable<
|
|
13
|
+
readonly selectionMoveEnd$: Observable<ISelectionWithCoord[]>;
|
|
14
14
|
readonly controlFillConfig$: Observable<IControlFillConfig | null>;
|
|
15
|
-
readonly selectionMoving$: Observable<
|
|
16
|
-
readonly selectionMoveStart$: Observable<
|
|
15
|
+
readonly selectionMoving$: Observable<ISelectionWithCoord[]>;
|
|
16
|
+
readonly selectionMoveStart$: Observable<ISelectionWithCoord[]>;
|
|
17
17
|
get selectionMoving(): boolean;
|
|
18
18
|
interceptor: InterceptorManager<{
|
|
19
19
|
RANGE_MOVE_PERMISSION_CHECK: IInterceptor<boolean, null>;
|
|
@@ -29,10 +29,14 @@ export interface ISheetSelectionRenderService {
|
|
|
29
29
|
getSkeleton(): SpreadsheetSkeleton;
|
|
30
30
|
getSelectionControls(): SelectionControl[];
|
|
31
31
|
/** @deprecated Use the function `attachSelectionWithCoord` instead. */
|
|
32
|
-
attachSelectionWithCoord(selectionWithStyle: ISelectionWithStyle):
|
|
32
|
+
attachSelectionWithCoord(selectionWithStyle: ISelectionWithStyle): ISelectionWithCoord;
|
|
33
33
|
/** @deprecated Use the function `attachPrimaryWithCoord` instead`. */
|
|
34
|
-
attachPrimaryWithCoord(primary: Nullable<Partial<
|
|
35
|
-
|
|
34
|
+
attachPrimaryWithCoord(primary: Nullable<Partial<ICellInfo>>): Nullable<ICellWithCoord>;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Please use `getCellWithCoordByOffset` instead.
|
|
37
|
+
*/
|
|
38
|
+
getSelectionCellByPosition(x: number, y: number): ICellWithCoord;
|
|
39
|
+
getCellWithCoordByOffset(x: number, y: number): Nullable<ICellWithCoord>;
|
|
36
40
|
setSingleSelectionEnabled(enabled: boolean): void;
|
|
37
41
|
refreshSelectionMoveEnd(): void;
|
|
38
42
|
}
|
|
@@ -65,8 +69,8 @@ export declare class BaseSelectionRenderService extends Disposable implements IS
|
|
|
65
69
|
private _cancelUpSubscription;
|
|
66
70
|
protected _skeleton: SpreadsheetSkeleton;
|
|
67
71
|
protected _scene: Scene;
|
|
68
|
-
protected
|
|
69
|
-
protected
|
|
72
|
+
protected _highlightHeader: boolean;
|
|
73
|
+
protected _rangeType: RANGE_TYPE;
|
|
70
74
|
protected _selectionStyle: ISelectionStyle;
|
|
71
75
|
protected _remainLastEnabled: boolean;
|
|
72
76
|
protected _skipLastEnabled: boolean;
|
|
@@ -74,15 +78,15 @@ export declare class BaseSelectionRenderService extends Disposable implements IS
|
|
|
74
78
|
/**
|
|
75
79
|
* Mainly emit by pointerup (pointerup is handled in _onPointerdown)
|
|
76
80
|
*/
|
|
77
|
-
protected readonly _selectionMoveEnd$: BehaviorSubject<
|
|
78
|
-
readonly selectionMoveEnd$: Observable<
|
|
79
|
-
protected readonly _selectionMoving$: Subject<
|
|
80
|
-
readonly selectionMoving$: Observable<
|
|
81
|
+
protected readonly _selectionMoveEnd$: BehaviorSubject<ISelectionWithCoord[]>;
|
|
82
|
+
readonly selectionMoveEnd$: Observable<ISelectionWithCoord[]>;
|
|
83
|
+
protected readonly _selectionMoving$: Subject<ISelectionWithCoord[]>;
|
|
84
|
+
readonly selectionMoving$: Observable<ISelectionWithCoord[]>;
|
|
81
85
|
/**
|
|
82
86
|
* Mainly emit by pointerdown
|
|
83
87
|
*/
|
|
84
|
-
protected readonly _selectionMoveStart$: Subject<
|
|
85
|
-
readonly selectionMoveStart$: Observable<
|
|
88
|
+
protected readonly _selectionMoveStart$: Subject<ISelectionWithCoord[]>;
|
|
89
|
+
readonly selectionMoveStart$: Observable<ISelectionWithCoord[]>;
|
|
86
90
|
private _selectionMoving;
|
|
87
91
|
get selectionMoving(): boolean;
|
|
88
92
|
protected _activeViewport: Nullable<Viewport>;
|
|
@@ -95,8 +99,12 @@ export declare class BaseSelectionRenderService extends Disposable implements IS
|
|
|
95
99
|
scene: Scene;
|
|
96
100
|
}>;
|
|
97
101
|
}>;
|
|
98
|
-
|
|
102
|
+
protected _escapeShortcutDisposable: Nullable<IDisposable>;
|
|
99
103
|
constructor(_injector: Injector, _themeService: ThemeService, _shortcutService: IShortcutService, _sheetSkeletonManagerService: SheetSkeletonManagerService);
|
|
104
|
+
/**
|
|
105
|
+
* If true, the selector will respond to the range of merged cells and automatically extend the selected range. If false, it will ignore the merged cells.
|
|
106
|
+
*/
|
|
107
|
+
private get _shouldDetectMergedCells();
|
|
100
108
|
private _initMoving;
|
|
101
109
|
protected _setSelectionStyle(style: ISelectionStyle): void;
|
|
102
110
|
/**
|
|
@@ -106,29 +114,32 @@ export declare class BaseSelectionRenderService extends Disposable implements IS
|
|
|
106
114
|
/** @deprecated This should not be provided by the selection render service. */
|
|
107
115
|
getViewPort(): Viewport;
|
|
108
116
|
setSingleSelectionEnabled(enabled?: boolean): void;
|
|
109
|
-
|
|
110
|
-
* Add a selection in spreadsheet, create a new SelectionControl and then update this control by range derives from selection.
|
|
111
|
-
* @param {ISelectionWithCoordAndStyle} selection
|
|
112
|
-
*/
|
|
113
|
-
protected _addSelectionControlBySelectionData(selection: ISelectionWithCoordAndStyle): void;
|
|
114
|
-
newSelectionControl(scene: Scene, _rangeType: RANGE_TYPE, skeleton: SpreadsheetSkeleton): SelectionControl;
|
|
117
|
+
newSelectionControl(scene: Scene, skeleton: SpreadsheetSkeleton, selection: ISelectionWithStyle): SelectionControl;
|
|
115
118
|
/**
|
|
116
119
|
* Update the corresponding selectionControl based on selectionsData.
|
|
117
120
|
* selectionData[i] syncs selectionControls[i]
|
|
118
|
-
* @param
|
|
121
|
+
* @param selectionsWithCoord
|
|
119
122
|
*/
|
|
120
|
-
|
|
123
|
+
resetSelectionsByModelData(selectionsWithStyleList: readonly ISelectionWithStyle[]): void;
|
|
121
124
|
refreshSelectionMoveStart(): void;
|
|
122
125
|
refreshSelectionMoveEnd(): void;
|
|
123
126
|
protected _changeRuntime(skeleton: SpreadsheetSkeleton, scene: Scene, viewport?: Viewport): void;
|
|
124
127
|
getSkeleton(): SpreadsheetSkeleton;
|
|
125
128
|
/**
|
|
126
129
|
* Generate selectionData from this._selectionControls.model .
|
|
127
|
-
* @returns {
|
|
130
|
+
* @returns {ISelectionWithCoord[]} {range, primary, style}[]
|
|
131
|
+
*/
|
|
132
|
+
getSelectionDataWithStyle(): ISelectionWithCoord[];
|
|
133
|
+
/**
|
|
134
|
+
* @TODO lumixraku DO NOT expose private props.
|
|
128
135
|
*/
|
|
129
|
-
getSelectionDataWithStyle(): ISelectionWithCoordAndStyle[];
|
|
130
136
|
getSelectionControls(): SelectionControl[];
|
|
131
|
-
|
|
137
|
+
/**
|
|
138
|
+
* Add a selection in spreadsheet, create a new SelectionControl and then update this control by range derives from selection.
|
|
139
|
+
* @param {ISelectionWithCoord} selectionWithStyle
|
|
140
|
+
*/
|
|
141
|
+
protected _addSelectionControlByModelData(selectionWithStyle: ISelectionWithStyle): SelectionControl;
|
|
142
|
+
protected _clearAllSelectionControls(): void;
|
|
132
143
|
protected _getFreeze(): Nullable<IFreeze>;
|
|
133
144
|
protected _getViewportByCell(row?: number, column?: number): Nullable<Viewport>;
|
|
134
145
|
/**
|
|
@@ -136,25 +147,15 @@ export declare class BaseSelectionRenderService extends Disposable implements IS
|
|
|
136
147
|
*/
|
|
137
148
|
getActiveRange(): Nullable<IRange>;
|
|
138
149
|
/**
|
|
139
|
-
* get active selection control
|
|
150
|
+
* get active(actually last) selection control
|
|
140
151
|
* @returns T extends SelectionControl
|
|
141
152
|
*/
|
|
142
153
|
getActiveSelectionControl<T extends SelectionControl = SelectionControl>(): Nullable<T>;
|
|
143
154
|
endSelection(): void;
|
|
144
155
|
/**
|
|
145
|
-
* Clear existed selections.
|
|
156
|
+
* Clear existed selections by workbookSelections.selectionMoveEnd$
|
|
146
157
|
*/
|
|
147
158
|
protected _reset(): void;
|
|
148
|
-
resetAndEndSelection(): void;
|
|
149
|
-
/**
|
|
150
|
-
* Handle pointer down event, then trigger selectionMoveStart$.
|
|
151
|
-
* @param evt
|
|
152
|
-
* @param _zIndex
|
|
153
|
-
* @param rangeType
|
|
154
|
-
* @param viewport
|
|
155
|
-
* @param scrollTimerType
|
|
156
|
-
*/
|
|
157
|
-
protected _onPointerDown(evt: IPointerEvent | IMouseEvent, _zIndex: number | undefined, rangeType: RANGE_TYPE | undefined, viewport: Nullable<Viewport>, scrollTimerType?: ScrollTimerType): void;
|
|
158
159
|
/**
|
|
159
160
|
* Init pointer move listener in each pointer down, unbind in each pointer up.
|
|
160
161
|
* Both cell selections and row-column selections are supported by this method.
|
|
@@ -167,34 +168,46 @@ export declare class BaseSelectionRenderService extends Disposable implements IS
|
|
|
167
168
|
*/
|
|
168
169
|
protected _setupPointerMoveListener(viewportMain: Nullable<Viewport>, activeSelectionControl: SelectionControl, rangeType: RANGE_TYPE, scrollTimerType: ScrollTimerType | undefined, moveStartPosX: number, moveStartPosY: number): void;
|
|
169
170
|
/** @deprecated Use the function `attachSelectionWithCoord` instead`. */
|
|
170
|
-
attachSelectionWithCoord(selectionWithStyle: ISelectionWithStyle):
|
|
171
|
+
attachSelectionWithCoord(selectionWithStyle: ISelectionWithStyle): ISelectionWithCoord;
|
|
171
172
|
/** @deprecated Use the function `attachPrimaryWithCoord` instead`. */
|
|
172
|
-
attachPrimaryWithCoord(primary:
|
|
173
|
-
getSelectionCellByPosition(x: number, y: number): Nullable<ISelectionCellWithMergeInfo>;
|
|
173
|
+
attachPrimaryWithCoord(primary: ICellInfo): ICellWithCoord;
|
|
174
174
|
/**
|
|
175
|
-
*
|
|
175
|
+
* @deprecated Please use `getCellWithCoordByOffset` instead.
|
|
176
176
|
*/
|
|
177
|
-
|
|
177
|
+
getSelectionCellByPosition(x: number, y: number): ICellWithCoord;
|
|
178
|
+
getCellWithCoordByOffset(x: number, y: number): ICellWithCoord;
|
|
178
179
|
/**
|
|
179
|
-
*
|
|
180
|
-
* @param control
|
|
181
|
-
* @param newSelectionRange
|
|
182
|
-
* @param highlight
|
|
180
|
+
* 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
|
|
183
181
|
*/
|
|
184
|
-
protected
|
|
182
|
+
protected _movingHandler(offsetX: number, offsetY: number, activeSelectionControl: Nullable<SelectionControl>, rangeType: RANGE_TYPE): void;
|
|
185
183
|
protected _clearUpdatingListeners(): void;
|
|
186
184
|
protected _addEndingListeners(): void;
|
|
187
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Get visible selection range & coord by offset on viewport. Nearly same as skeleton.getCellWithCoordByOffset
|
|
187
|
+
* Returning selection is only one cell. primary and range are same cell.
|
|
188
|
+
*
|
|
189
|
+
* visible selection range means getCellWithCoordByOffset needs first matched row/col in rowHeightAccumulation & colWidthAccumulation.
|
|
190
|
+
* Original name: _getCellRangeByCursorPosition
|
|
191
|
+
*
|
|
192
|
+
* @param offsetX position X in viewport.
|
|
193
|
+
* @param offsetY
|
|
194
|
+
* @param scaleX
|
|
195
|
+
* @param scaleY
|
|
196
|
+
* @param scrollXY
|
|
197
|
+
* @returns {Nullable<ISelectionWithCoord>} selection range with coord.
|
|
198
|
+
*/
|
|
199
|
+
protected _getSelectionWithCoordByOffset(offsetX: number, offsetY: number, scaleX: number, scaleY: number, scrollXY: {
|
|
188
200
|
x: number;
|
|
189
201
|
y: number;
|
|
190
202
|
}): Nullable<ISelectionWithCoord>;
|
|
191
203
|
protected _checkClearPreviousControls(evt: IPointerEvent | IMouseEvent): void;
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Reset all this.selectionControls by selectionsData.
|
|
195
|
-
* @param selectionsData
|
|
196
|
-
*/
|
|
197
|
-
protected _refreshSelectionControl(selectionsData: readonly ISelectionWithStyle[]): void;
|
|
204
|
+
protected _makeSelectionByTwoCells(currentCell: ICellWithCoord, startSelectionRange: IRangeWithCoord, skeleton: SpreadsheetSkeleton, rangeType: RANGE_TYPE, activeControl: SelectionControl): void;
|
|
198
205
|
}
|
|
199
|
-
export declare function
|
|
200
|
-
export declare function
|
|
206
|
+
export declare function selectionDataForSelectAll(skeleton: SpreadsheetSkeleton): ISelectionWithStyle;
|
|
207
|
+
export declare function getTopLeftSelectionOfCurrSheet(skeleton: SpreadsheetSkeleton): ISelectionWithStyle;
|
|
208
|
+
/**
|
|
209
|
+
* @deprecated use `getTopLeftSelectionOfCurrSheet` instead
|
|
210
|
+
*/
|
|
211
|
+
declare const getTopLeftSelection: typeof getTopLeftSelectionOfCurrSheet;
|
|
212
|
+
export { getTopLeftSelection };
|
|
213
|
+
export declare function genSelectionByRange(skeleton: SpreadsheetSkeleton, range: IRange): ISelectionWithStyle;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ThemeService } from '@univerjs/core';
|
|
1
2
|
import { Scene, SpreadsheetSkeleton } from '@univerjs/engine-render';
|
|
3
|
+
import { ISelectionStyle } from '@univerjs/sheets';
|
|
2
4
|
export declare const RANGE_MOVE_PERMISSION_CHECK: import('@univerjs/core').IInterceptor<boolean, null>;
|
|
3
5
|
export declare const RANGE_FILL_PERMISSION_CHECK: import('@univerjs/core').IInterceptor<boolean, {
|
|
4
6
|
x: number;
|
|
@@ -10,3 +12,4 @@ export declare enum SELECTION_SHAPE_DEPTH {
|
|
|
10
12
|
FORMULA_EDITOR_SHOW = 100,// see packages/sheets-formula/src/controllers/formula-editor-show.controller.ts
|
|
11
13
|
MARK_SELECTION = 10000
|
|
12
14
|
}
|
|
15
|
+
export declare function genNormalSelectionStyle(themeService: ThemeService): ISelectionStyle;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Workbook, ICommandService, IContextService, ILogService, Injector, RANGE_TYPE, ThemeService } from '@univerjs/core';
|
|
2
|
-
import { IMouseEvent, IPointerEvent, IRenderContext, IRenderModule, Scene, Viewport } from '@univerjs/engine-render';
|
|
3
|
-
import { SheetsSelectionsService } from '@univerjs/sheets';
|
|
2
|
+
import { IMouseEvent, IPointerEvent, IRenderContext, IRenderModule, Scene, SpreadsheetSkeleton, Viewport } from '@univerjs/engine-render';
|
|
3
|
+
import { ISelectionWithStyle, SheetsSelectionsService } from '@univerjs/sheets';
|
|
4
4
|
import { IShortcutService } from '@univerjs/ui';
|
|
5
5
|
import { SheetScrollManagerService } from '../scroll-manager.service';
|
|
6
6
|
import { SheetSkeletonManagerService } from '../sheet-skeleton-manager.service';
|
|
@@ -34,22 +34,22 @@ export declare class MobileSheetsSelectionRenderService extends BaseSelectionRen
|
|
|
34
34
|
private _initUserActionSyncListener;
|
|
35
35
|
private _updateSelections;
|
|
36
36
|
/**
|
|
37
|
-
* invoked when pointerup or
|
|
37
|
+
* invoked when pointerup or long press on spreadsheet, or pointerdown on row&col
|
|
38
38
|
* then move curr selection to cell at cursor
|
|
39
|
-
* Main
|
|
39
|
+
* Main purpose to create a new selection, or update curr selection to a new range.
|
|
40
40
|
* @param evt
|
|
41
41
|
* @param _zIndex
|
|
42
42
|
* @param rangeType
|
|
43
43
|
* @param viewport
|
|
44
44
|
*/
|
|
45
|
-
createNewSelection(evt: IPointerEvent | IMouseEvent, _zIndex?: number, rangeType?: RANGE_TYPE, viewport?: Viewport):
|
|
45
|
+
createNewSelection(evt: IPointerEvent | IMouseEvent, _zIndex?: number, rangeType?: RANGE_TYPE, viewport?: Viewport): void;
|
|
46
46
|
/**
|
|
47
47
|
* Not same as PC version,
|
|
48
48
|
* new selection control for mobile do one more thing: bind event for two control points.
|
|
49
49
|
* @param scene
|
|
50
50
|
* @param rangeType
|
|
51
51
|
*/
|
|
52
|
-
newSelectionControl(scene: Scene,
|
|
52
|
+
newSelectionControl(scene: Scene, skeleton: SpreadsheetSkeleton, selection: ISelectionWithStyle): MobileSelectionControl;
|
|
53
53
|
private _getActiveViewport;
|
|
54
54
|
private _getSheetObject;
|
|
55
55
|
private _normalSelectionDisabled;
|
|
@@ -57,7 +57,7 @@ export declare class MobileSheetsSelectionRenderService extends BaseSelectionRen
|
|
|
57
57
|
private _fillControlPointerDownHandler;
|
|
58
58
|
private _changeCurrCellWhenControlPointerDown;
|
|
59
59
|
/**
|
|
60
|
-
* Not same as _moving in base selection render service
|
|
60
|
+
* Not same as _moving in PC (base selection render service)
|
|
61
61
|
* The diff is
|
|
62
62
|
* In base version, new selection is determined by the cursor cell and _startRangeWhenPointerDown
|
|
63
63
|
*
|
|
@@ -5,9 +5,7 @@ import { SelectionControl } from './selection-control';
|
|
|
5
5
|
export declare class MobileSelectionControl extends SelectionControl {
|
|
6
6
|
protected _scene: Scene;
|
|
7
7
|
protected _zIndex: number;
|
|
8
|
-
protected _highlightHeader: boolean;
|
|
9
8
|
protected readonly _themeService: ThemeService;
|
|
10
|
-
protected _rangeType: RANGE_TYPE;
|
|
11
9
|
/**
|
|
12
10
|
* topLeft controlPointer, it is not visible, just transparent, for handling event.
|
|
13
11
|
*/
|
|
@@ -16,7 +14,14 @@ export declare class MobileSelectionControl extends SelectionControl {
|
|
|
16
14
|
* bottomRight controlPointer, it is not visible, just transparent, for handling event.
|
|
17
15
|
*/
|
|
18
16
|
private _fillControlBottomRight;
|
|
19
|
-
|
|
17
|
+
protected _rangeType: RANGE_TYPE;
|
|
18
|
+
constructor(_scene: Scene, _zIndex: number, _themeService: ThemeService, options?: {
|
|
19
|
+
highlightHeader?: boolean;
|
|
20
|
+
enableAutoFill?: boolean;
|
|
21
|
+
rowHeaderWidth: number;
|
|
22
|
+
columnHeaderHeight: number;
|
|
23
|
+
rangeType?: RANGE_TYPE;
|
|
24
|
+
});
|
|
20
25
|
initControlPoints(): void;
|
|
21
26
|
get fillControlTopLeft(): Rect<IRectProps> | null;
|
|
22
27
|
set fillControlTopLeft(value: Rect);
|
|
@@ -25,7 +30,7 @@ export declare class MobileSelectionControl extends SelectionControl {
|
|
|
25
30
|
get rangeType(): RANGE_TYPE;
|
|
26
31
|
set rangeType(value: RANGE_TYPE);
|
|
27
32
|
dispose(): void;
|
|
28
|
-
protected
|
|
33
|
+
protected _updateLayoutOfSelectionControl(style: ISelectionStyle): void;
|
|
29
34
|
getViewportMainScrollInfo(): {
|
|
30
35
|
viewportScrollX: number;
|
|
31
36
|
viewportScrollY: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ICellWithCoord, IRangeWithCoord, Nullable, ThemeService, Disposable, RANGE_TYPE } from '@univerjs/core';
|
|
2
2
|
import { Scene, Group, Rect } from '@univerjs/engine-render';
|
|
3
|
-
import { ISelectionStyle, ISelectionWidgetConfig,
|
|
3
|
+
import { ISelectionStyle, ISelectionWidgetConfig, ISelectionWithCoord } from '@univerjs/sheets';
|
|
4
|
+
import { ISelectionShapeExtensionOption, SelectionShapeExtension } from './selection-shape-extension';
|
|
4
5
|
import { Subject } from 'rxjs';
|
|
5
6
|
import { SelectionRenderModel } from './selection-render-model';
|
|
6
7
|
export declare enum SELECTION_MANAGER_KEY {
|
|
@@ -44,7 +45,21 @@ export declare class SelectionControl extends Disposable {
|
|
|
44
45
|
protected _scene: Scene;
|
|
45
46
|
protected _zIndex: number;
|
|
46
47
|
protected readonly _themeService: ThemeService;
|
|
48
|
+
private _isHelperSelection;
|
|
49
|
+
/**
|
|
50
|
+
* For ref selections, there is no auto fill.
|
|
51
|
+
*/
|
|
52
|
+
protected _enableAutoFill: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Only normal selections with primary cell has auto fill.
|
|
55
|
+
* This works for multiple normal selections. Only last selection has primary cell and auto fill.
|
|
56
|
+
*/
|
|
57
|
+
private _showAutoFill;
|
|
58
|
+
/**
|
|
59
|
+
* If rowHeader & col Header would be highlighted with selection.
|
|
60
|
+
*/
|
|
47
61
|
protected _highlightHeader: boolean;
|
|
62
|
+
protected _selectionRenderModel: SelectionRenderModel;
|
|
48
63
|
private _leftBorder;
|
|
49
64
|
private _rightBorder;
|
|
50
65
|
private _topBorder;
|
|
@@ -53,7 +68,7 @@ export declare class SelectionControl extends Disposable {
|
|
|
53
68
|
private _backgroundControlBottom;
|
|
54
69
|
private _backgroundControlMiddleLeft;
|
|
55
70
|
private _backgroundControlMiddleRight;
|
|
56
|
-
private
|
|
71
|
+
private _autoFillControl;
|
|
57
72
|
private _selectionShapeGroup;
|
|
58
73
|
private _rowHeaderBackground;
|
|
59
74
|
private _rowHeaderBorder;
|
|
@@ -61,6 +76,7 @@ export declare class SelectionControl extends Disposable {
|
|
|
61
76
|
private _columnHeaderBackground;
|
|
62
77
|
private _columnHeaderBorder;
|
|
63
78
|
private _columnHeaderGroup;
|
|
79
|
+
private _dashedRect;
|
|
64
80
|
private _topLeftWidget;
|
|
65
81
|
private _topCenterWidget;
|
|
66
82
|
private _topRightWidget;
|
|
@@ -69,13 +85,12 @@ export declare class SelectionControl extends Disposable {
|
|
|
69
85
|
private _bottomLeftWidget;
|
|
70
86
|
private _bottomCenterWidget;
|
|
71
87
|
private _bottomRightWidget;
|
|
72
|
-
private _dashedRect;
|
|
73
|
-
protected _selectionModel: SelectionRenderModel;
|
|
74
88
|
private _defaultStyle;
|
|
75
89
|
private _currentStyle;
|
|
76
90
|
protected _rowHeaderWidth: number;
|
|
77
91
|
protected _columnHeaderHeight: number;
|
|
78
92
|
protected _widgetRects: Rect[];
|
|
93
|
+
protected _controlExtension: Nullable<SelectionShapeExtension>;
|
|
79
94
|
private _dispose$;
|
|
80
95
|
readonly dispose$: import('rxjs').Observable<SelectionControl>;
|
|
81
96
|
/**
|
|
@@ -89,11 +104,16 @@ export declare class SelectionControl extends Disposable {
|
|
|
89
104
|
readonly selectionFilling$: Subject<Nullable<IRangeWithCoord>>;
|
|
90
105
|
private readonly _selectionFilled$;
|
|
91
106
|
readonly selectionFilled$: import('rxjs').Observable<Nullable<IRangeWithCoord>>;
|
|
92
|
-
|
|
93
|
-
|
|
107
|
+
constructor(_scene: Scene, _zIndex: number, _themeService: ThemeService, options?: {
|
|
108
|
+
highlightHeader?: boolean;
|
|
109
|
+
enableAutoFill?: boolean;
|
|
94
110
|
rowHeaderWidth: number;
|
|
95
111
|
columnHeaderHeight: number;
|
|
112
|
+
rangeType?: RANGE_TYPE;
|
|
96
113
|
});
|
|
114
|
+
private _initializeSheetBody;
|
|
115
|
+
private _initialHeader;
|
|
116
|
+
private _initialWidget;
|
|
97
117
|
get zIndex(): number;
|
|
98
118
|
get leftControl(): Rect;
|
|
99
119
|
get rightControl(): Rect;
|
|
@@ -120,29 +140,34 @@ export declare class SelectionControl extends Disposable {
|
|
|
120
140
|
get themeService(): ThemeService;
|
|
121
141
|
get selectionModel(): SelectionRenderModel;
|
|
122
142
|
set selectionModel(model: SelectionRenderModel);
|
|
123
|
-
get
|
|
124
|
-
set
|
|
143
|
+
get currentStyle(): ISelectionStyle;
|
|
144
|
+
set currentStyle(style: ISelectionStyle);
|
|
125
145
|
get dashedRect(): Rect;
|
|
126
|
-
get currentStyle(): Nullable<ISelectionStyle>;
|
|
127
|
-
set currentStyle(style: Nullable<ISelectionStyle>);
|
|
128
146
|
get isHelperSelection(): boolean;
|
|
129
147
|
get rowHeaderWidth(): number;
|
|
130
148
|
set rowHeaderWidth(width: number);
|
|
131
149
|
get columnHeaderHeight(): number;
|
|
132
150
|
set columnHeaderHeight(height: number);
|
|
151
|
+
setControlExtension(options: ISelectionShapeExtensionOption): void;
|
|
133
152
|
setEvent(state: boolean): void;
|
|
134
153
|
refreshSelectionFilled(val: IRangeWithCoord): void;
|
|
135
154
|
/**
|
|
136
155
|
* Update Control Style And Position of SelectionControl
|
|
137
156
|
* @param selectionStyle
|
|
138
157
|
*/
|
|
139
|
-
protected
|
|
158
|
+
protected _updateLayoutOfSelectionControl(selectionStyle?: Nullable<Partial<ISelectionStyle>>): void;
|
|
140
159
|
/**
|
|
141
|
-
* update selection control
|
|
160
|
+
* update selection control coordination by curr selection model
|
|
142
161
|
*/
|
|
143
|
-
protected
|
|
144
|
-
updateStyle(style: ISelectionStyle): void;
|
|
145
|
-
|
|
162
|
+
protected _updateControlCoord(): void;
|
|
163
|
+
updateStyle(style: Partial<ISelectionStyle>): void;
|
|
164
|
+
/**
|
|
165
|
+
* Update range, primary may be null, especially for moving handler.
|
|
166
|
+
* @param range
|
|
167
|
+
* @param primaryCell
|
|
168
|
+
*/
|
|
169
|
+
updateRange(range: IRangeWithCoord, primaryCell: Nullable<ICellWithCoord>): void;
|
|
170
|
+
updateRangeBySelectionWithCoord(selectionWthCoord: ISelectionWithCoord): void;
|
|
146
171
|
/**
|
|
147
172
|
* Update selection model with new range & primary cell(aka: highlight/current), also update row/col selection size & style.
|
|
148
173
|
*
|
|
@@ -152,12 +177,12 @@ export declare class SelectionControl extends Disposable {
|
|
|
152
177
|
* @param style
|
|
153
178
|
* @param primaryCell primary cell
|
|
154
179
|
*/
|
|
155
|
-
update(newSelectionRange: IRangeWithCoord, rowHeaderWidth?: number, columnHeaderHeight?: number, style?: Nullable<ISelectionStyle>, primaryCell?: Nullable<
|
|
180
|
+
update(newSelectionRange: IRangeWithCoord, rowHeaderWidth?: number, columnHeaderHeight?: number, style?: Nullable<ISelectionStyle>, primaryCell?: Nullable<ICellWithCoord>): void;
|
|
156
181
|
/**
|
|
157
182
|
* update primary range
|
|
158
183
|
* @param primaryCell model.current (aka: highlight)
|
|
159
184
|
*/
|
|
160
|
-
updateCurrCell(primaryCell
|
|
185
|
+
updateCurrCell(primaryCell: Nullable<ICellWithCoord>): void;
|
|
161
186
|
clearHighlight(): void;
|
|
162
187
|
getScene(): Scene;
|
|
163
188
|
dispose(): void;
|
|
@@ -165,13 +190,10 @@ export declare class SelectionControl extends Disposable {
|
|
|
165
190
|
* Get the cell information of the current selection, considering the case of merging cells
|
|
166
191
|
*/
|
|
167
192
|
getCurrentCellInfo(): Nullable<IRangeWithCoord>;
|
|
168
|
-
getValue():
|
|
193
|
+
getValue(): ISelectionWithCoord;
|
|
169
194
|
getRange(): IRangeWithCoord;
|
|
170
195
|
enableHelperSelection(): void;
|
|
171
196
|
disableHelperSelection(): void;
|
|
172
|
-
private _initialize;
|
|
173
|
-
private _initialHeader;
|
|
174
|
-
private _initialWidget;
|
|
175
197
|
private _updateHeaderBackground;
|
|
176
198
|
private _updateBackgroundControl;
|
|
177
199
|
private _updateWidgets;
|