@univerjs/sheets-ui 0.6.1-nightly.202502231605 → 0.6.1-nightly.202502241606
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 +33 -38
- package/lib/es/facade.js +312 -322
- package/lib/es/index.js +4835 -4860
- package/lib/index.css +1 -1
- package/lib/types/controllers/utils/range-tools.d.ts +1 -2
- package/lib/types/facade/f-event.d.ts +177 -74
- package/lib/types/facade/f-permission.d.ts +4 -2
- package/lib/types/facade/f-range.d.ts +106 -61
- package/lib/types/facade/f-sheet-hooks.d.ts +6 -0
- package/lib/types/facade/f-workbook.d.ts +97 -25
- package/lib/types/facade/f-worksheet.d.ts +57 -20
- package/lib/types/index.d.ts +1 -1
- package/lib/types/views/{operate-container → auto-fill-popup-menu}/AutoFillPopupMenu.d.ts +1 -1
- package/lib/types/views/sheet-bar/sheet-bar-menu/SheetBarMenu.d.ts +1 -5
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +27 -32
- package/package.json +11 -11
- package/lib/types/views/operate-container/OperateContainer.d.ts +0 -2
- package/lib/types/views/operate-container/index.d.ts +0 -16
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ICellWithCoord, IDisposable, ISelectionCell, Nullable, DisposableCollection } from '@univerjs/core';
|
|
2
2
|
import { ISelectionStyle } from '@univerjs/sheets';
|
|
3
|
-
import { ComponentType, ComponentManager } from '@univerjs/ui';
|
|
4
3
|
import { ICanvasPopup, ICellAlert } from '@univerjs/sheets-ui';
|
|
4
|
+
import { ComponentType, ComponentManager } from '@univerjs/ui';
|
|
5
5
|
import { FRange } from '@univerjs/sheets/facade';
|
|
6
6
|
export interface IFComponentKey {
|
|
7
7
|
/**
|
|
@@ -25,28 +25,39 @@ interface IFRangeSheetsUIMixin {
|
|
|
25
25
|
* Return this cell information, including whether it is merged and cell coordinates
|
|
26
26
|
* @returns {ICellWithCoord} cell location and coordinate.
|
|
27
27
|
* @example
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* ```ts
|
|
29
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
30
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
31
|
+
* const fRange = fWorksheet.getRange('H6');
|
|
32
|
+
* console.log(fRange.getCell());
|
|
31
33
|
* ```
|
|
32
34
|
*/
|
|
33
35
|
getCell(this: FRange): ICellWithCoord;
|
|
34
36
|
/**
|
|
35
37
|
* Returns the coordinates of this cell,does not include units
|
|
36
|
-
* @returns coordinates of the cell, top, right, bottom, left
|
|
38
|
+
* @returns {DOMRect} coordinates of the cell, top, right, bottom, left
|
|
37
39
|
* @example
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
*
|
|
40
|
+
* ```ts
|
|
41
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
42
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
43
|
+
* const fRange = fWorksheet.getRange('H6');
|
|
44
|
+
* console.log(fRange.getCellRect());
|
|
41
45
|
* ```
|
|
42
46
|
*/
|
|
43
47
|
getCellRect(this: FRange): DOMRect;
|
|
44
48
|
/**
|
|
45
49
|
* Generate HTML content for the range.
|
|
50
|
+
* @returns {string} HTML content of the range.
|
|
46
51
|
* @example
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
*
|
|
52
|
+
* ```ts
|
|
53
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
54
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
55
|
+
* const fRange = fWorksheet.getRange('A1:B2');
|
|
56
|
+
* fRange.setValues([
|
|
57
|
+
* [1, 2],
|
|
58
|
+
* [3, 4]
|
|
59
|
+
* ]);
|
|
60
|
+
* console.log(fRange.generateHTML());
|
|
50
61
|
* ```
|
|
51
62
|
*/
|
|
52
63
|
generateHTML(this: FRange): string;
|
|
@@ -54,76 +65,110 @@ interface IFRangeSheetsUIMixin {
|
|
|
54
65
|
* Attach a popup to the start cell of current range.
|
|
55
66
|
* If current worksheet is not active, the popup will not be shown.
|
|
56
67
|
* Be careful to manager the detach disposable object, if not dispose correctly, it might memory leaks.
|
|
57
|
-
* @param popup The popup to attach
|
|
58
|
-
* @returns The disposable object to detach the popup, if the popup is not attached, return `null`.
|
|
68
|
+
* @param {IFCanvasPopup} popup The popup to attach
|
|
69
|
+
* @returns {Nullable<IDisposable>} The disposable object to detach the popup, if the popup is not attached, return `null`.
|
|
59
70
|
* @example
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
* ```ts
|
|
72
|
+
* // Register a custom popup component
|
|
73
|
+
* univerAPI.registerComponent(
|
|
74
|
+
* 'myPopup',
|
|
75
|
+
* () => React.createElement('div', {
|
|
76
|
+
* style: {
|
|
77
|
+
* color: 'red',
|
|
78
|
+
* fontSize: '14px'
|
|
79
|
+
* }
|
|
80
|
+
* }, 'Custom Popup')
|
|
81
|
+
* );
|
|
82
|
+
*
|
|
83
|
+
* // Attach the popup to the start cell of range C3:E5
|
|
84
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
85
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
86
|
+
* const fRange = fWorksheet.getRange('C3:E5');
|
|
87
|
+
* const disposable = fRange.attachPopup({
|
|
88
|
+
* componentKey: 'myPopup'
|
|
89
|
+
* });
|
|
90
|
+
*
|
|
91
|
+
* // Detach the popup after 5 seconds
|
|
92
|
+
* setTimeout(() => {
|
|
93
|
+
* disposable.dispose();
|
|
94
|
+
* }, 5000);
|
|
95
|
+
* ```
|
|
78
96
|
*/
|
|
79
97
|
attachPopup(popup: IFCanvasPopup): Nullable<IDisposable>;
|
|
80
98
|
/**
|
|
81
99
|
* Attach an alert popup to the start cell of current range.
|
|
82
|
-
* @param alert The alert to attach
|
|
83
|
-
* @returns The disposable object to detach the alert.
|
|
100
|
+
* @param {Omit<ICellAlert, 'location'>} alert The alert to attach
|
|
101
|
+
* @returns {IDisposable} The disposable object to detach the alert.
|
|
84
102
|
* @example
|
|
85
103
|
* ```ts
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
104
|
+
* // Attach an alert popup to the start cell of range C3:E5
|
|
105
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
106
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
107
|
+
* const fRange = fWorksheet.getRange('C3:E5');
|
|
108
|
+
*
|
|
109
|
+
* const disposable = fRange.attachAlertPopup({
|
|
110
|
+
* title: 'Warning',
|
|
111
|
+
* message: 'This is an warning message',
|
|
112
|
+
* type: 1
|
|
113
|
+
* });
|
|
114
|
+
*
|
|
115
|
+
* // Detach the alert after 5 seconds
|
|
116
|
+
* setTimeout(() => {
|
|
117
|
+
* disposable.dispose();
|
|
118
|
+
* }, 5000);
|
|
89
119
|
* ```
|
|
90
120
|
*/
|
|
91
121
|
attachAlertPopup(alert: Omit<ICellAlert, 'location'>): IDisposable;
|
|
92
122
|
/**
|
|
93
123
|
* Attach a DOM popup to the current range.
|
|
94
|
-
* @param alert The alert to attach
|
|
95
|
-
* @returns The disposable object to detach the alert.
|
|
124
|
+
* @param {IFCanvasPopup} alert The alert to attach
|
|
125
|
+
* @returns {Nullable<IDisposable>} The disposable object to detach the alert.
|
|
96
126
|
* @example
|
|
97
127
|
* ```ts
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
128
|
+
* // Register a custom popup component
|
|
129
|
+
* univerAPI.registerComponent(
|
|
130
|
+
* 'myPopup',
|
|
131
|
+
* () => React.createElement('div', {
|
|
132
|
+
* style: {
|
|
133
|
+
* background: 'red',
|
|
134
|
+
* fontSize: '14px'
|
|
135
|
+
* }
|
|
136
|
+
* }, 'Custom Popup')
|
|
137
|
+
* );
|
|
138
|
+
*
|
|
139
|
+
* // Attach the popup to the range C3:E5
|
|
140
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
141
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
142
|
+
* const fRange = fWorksheet.getRange('C3:E5');
|
|
143
|
+
* const disposable = fRange.attachRangePopup({
|
|
144
|
+
* componentKey: 'myPopup',
|
|
145
|
+
* direction: 'top' // 'vertical' | 'horizontal' | 'top' | 'right' | 'left' | 'bottom' | 'bottom-center' | 'top-center'
|
|
146
|
+
* });
|
|
115
147
|
* ```
|
|
116
148
|
*/
|
|
117
149
|
attachRangePopup(popup: IFCanvasPopup): Nullable<IDisposable>;
|
|
118
150
|
/**
|
|
119
|
-
*
|
|
120
|
-
* @param style - style for highlight range.
|
|
121
|
-
* @param primary - primary cell for highlight range.
|
|
151
|
+
* Highlight the range with the specified style and primary cell.
|
|
152
|
+
* @param {Nullable<Partial<ISelectionStyle>>} style - style for highlight range.
|
|
153
|
+
* @param {Nullable<ISelectionCell>} primary - primary cell for highlight range.
|
|
154
|
+
* @returns {IDisposable} The disposable object to remove the highlight.
|
|
122
155
|
* @example
|
|
123
156
|
* ```ts
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
157
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
158
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
159
|
+
*
|
|
160
|
+
* // Highlight the range C3:E5 with default style
|
|
161
|
+
* const fRange = fWorksheet.getRange('C3:E5');
|
|
162
|
+
* fRange.highlight();
|
|
163
|
+
*
|
|
164
|
+
* // Highlight the range C7:E9 with custom style
|
|
165
|
+
* const fRange2 = fWorksheet.getRange('C7:E9');
|
|
166
|
+
* const disposable = fRange2.highlight({ stroke: 'red', fill: 'yellow' });
|
|
167
|
+
*
|
|
168
|
+
* // Remove the range C7:E9 highlight after 5 seconds
|
|
169
|
+
* setTimeout(() => {
|
|
170
|
+
* disposable.dispose();
|
|
171
|
+
* }, 5000);
|
|
127
172
|
* ```
|
|
128
173
|
*/
|
|
129
174
|
highlight(style?: Nullable<Partial<ISelectionStyle>>, primary?: Nullable<ISelectionCell>): IDisposable;
|
|
@@ -7,6 +7,7 @@ import { FSheetHooks } from '@univerjs/sheets/facade';
|
|
|
7
7
|
export interface IFSheetHooksUIMixin {
|
|
8
8
|
/**
|
|
9
9
|
* The onCellPointerMove event is fired when a pointer changes coordinates.
|
|
10
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.CellPointerMove, (params) => {})` instead
|
|
10
11
|
* @param {function(Nullable<IHoverCellPosition>): void} callback - function that will be called when the event is fired
|
|
11
12
|
* @returns {IDisposable} A disposable object that can be used to unsubscribe from the event
|
|
12
13
|
* @example
|
|
@@ -17,6 +18,7 @@ export interface IFSheetHooksUIMixin {
|
|
|
17
18
|
onCellPointerMove(callback: (cellPos: Nullable<IHoverCellPosition>) => void): IDisposable;
|
|
18
19
|
/**
|
|
19
20
|
* The onCellPointerOver event is fired when a pointer is moved into a cell's hit test boundaries.
|
|
21
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.CellHover, (params) => {})` instead
|
|
20
22
|
* @param {function(Nullable<IHoverCellPosition>): void} callback - function that will be called when the event is fired
|
|
21
23
|
* @returns {IDisposable} A disposable object that can be used to unsubscribe from the event
|
|
22
24
|
* @example
|
|
@@ -27,6 +29,7 @@ export interface IFSheetHooksUIMixin {
|
|
|
27
29
|
onCellPointerOver(callback: (cellPos: Nullable<IHoverCellPosition>) => void): IDisposable;
|
|
28
30
|
/**
|
|
29
31
|
* The onCellDragOver event is fired when an element or text selection is being dragged into a cell's hit test boundaries.
|
|
32
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.DragOver, (params) => {})` instead
|
|
30
33
|
* @param {function (Nullable<IDragCellPosition>): void} callback Callback function that will be called when the event is fired
|
|
31
34
|
* @returns {IDisposable} A disposable object that can be used to unsubscribe from the event
|
|
32
35
|
* @example
|
|
@@ -37,6 +40,7 @@ export interface IFSheetHooksUIMixin {
|
|
|
37
40
|
onCellDragOver(callback: (cellPos: Nullable<IDragCellPosition>) => void): IDisposable;
|
|
38
41
|
/**
|
|
39
42
|
* The onCellDrop event is fired when an element or text selection is being dropped on the cell.
|
|
43
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Drop, (params) => {})` instead
|
|
40
44
|
* @param {function(Nullable<IDragCellPosition>): void} callback Callback function that will be called when the event is fired
|
|
41
45
|
* @returns {IDisposable} A disposable object that can be used to unsubscribe from the event
|
|
42
46
|
* @example
|
|
@@ -69,6 +73,7 @@ export interface IFSheetHooksUIMixin {
|
|
|
69
73
|
onCellRender(customRender: Nullable<ICellCustomRender[]>, effect?: InterceptorEffectEnum, priority?: number): IDisposable;
|
|
70
74
|
/**
|
|
71
75
|
* The onBeforeCellEdit event is fired before a cell is edited.
|
|
76
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeSheetEditStart, (params) => {})` instead
|
|
72
77
|
* @param callback Callback function that will be called when the event is fired
|
|
73
78
|
* @returns A disposable object that can be used to unsubscribe from the event
|
|
74
79
|
* @example
|
|
@@ -79,6 +84,7 @@ export interface IFSheetHooksUIMixin {
|
|
|
79
84
|
onBeforeCellEdit(callback: (params: IEditorBridgeServiceVisibleParam) => void): IDisposable;
|
|
80
85
|
/**
|
|
81
86
|
* The onAfterCellEdit event is fired after a cell is edited.
|
|
87
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetEditEnded, (params) => {})` instead
|
|
82
88
|
* @param callback Callback function that will be called when the event is fired
|
|
83
89
|
* @returns A disposable object that can be used to unsubscribe from the event
|
|
84
90
|
* @example
|
|
@@ -1,61 +1,107 @@
|
|
|
1
1
|
import { IDisposable, Nullable } from '@univerjs/core';
|
|
2
2
|
import { IMouseEvent, IPointerEvent } from '@univerjs/engine-render';
|
|
3
3
|
import { ICellPosWithEvent, IDragCellPosition, IHoverRichTextInfo, IHoverRichTextPosition, IScrollState } from '@univerjs/sheets-ui';
|
|
4
|
+
import { IDialogPartMethodOptions, ISidebarMethodOptions } from '@univerjs/ui';
|
|
4
5
|
import { ICellEventParam } from './f-event';
|
|
5
6
|
import { FWorkbook } from '@univerjs/sheets/facade';
|
|
6
|
-
import { IDialogPartMethodOptions, ISidebarMethodOptions } from '@univerjs/ui';
|
|
7
7
|
/**
|
|
8
8
|
* @ignore
|
|
9
9
|
*/
|
|
10
10
|
export interface IFWorkbookSheetsUIMixin {
|
|
11
11
|
/**
|
|
12
12
|
* Open a sidebar.
|
|
13
|
-
* @deprecated
|
|
14
|
-
* @param params the sidebar options
|
|
15
|
-
* @returns the disposable object
|
|
13
|
+
* @deprecated use `univerAPI.openSidebar` instead
|
|
14
|
+
* @param {ISidebarMethodOptions} params the sidebar options
|
|
15
|
+
* @returns {IDisposable} the disposable object
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* univerAPI.openSidebar({
|
|
19
|
+
* id: 'mock-sidebar-id',
|
|
20
|
+
* width: 300,
|
|
21
|
+
* header: {
|
|
22
|
+
* label: 'Sidebar Header',
|
|
23
|
+
* },
|
|
24
|
+
* children: {
|
|
25
|
+
* label: 'Sidebar Content',
|
|
26
|
+
* },
|
|
27
|
+
* footer: {
|
|
28
|
+
* label: 'Sidebar Footer',
|
|
29
|
+
* },
|
|
30
|
+
* onClose: () => {
|
|
31
|
+
* console.log('Sidebar closed')
|
|
32
|
+
* },
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
16
35
|
*/
|
|
17
36
|
openSiderbar(params: ISidebarMethodOptions): IDisposable;
|
|
18
37
|
/**
|
|
19
38
|
* Open a dialog.
|
|
20
|
-
* @deprecated
|
|
21
|
-
* @param dialog the dialog options
|
|
22
|
-
* @returns the disposable object
|
|
39
|
+
* @deprecated use `univerAPI.openDialog` instead
|
|
40
|
+
* @param {IDialogPartMethodOptions} dialog the dialog options
|
|
41
|
+
* @returns {IDisposable} the disposable object
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { Button } from '@univerjs/design';
|
|
45
|
+
*
|
|
46
|
+
* univerAPI.openDialog({
|
|
47
|
+
* id: 'mock-dialog-id',
|
|
48
|
+
* width: 500,
|
|
49
|
+
* title: {
|
|
50
|
+
* label: 'Dialog Title',
|
|
51
|
+
* },
|
|
52
|
+
* children: {
|
|
53
|
+
* label: 'Dialog Content',
|
|
54
|
+
* },
|
|
55
|
+
* footer: {
|
|
56
|
+
* title: (
|
|
57
|
+
* <>
|
|
58
|
+
* <Button onClick={() => { console.log('Cancel clicked') }}>Cancel</Button>
|
|
59
|
+
* <Button type="primary" onClick={() => { console.log('Confirm clicked') }} style={{marginLeft: '10px'}}>Confirm</Button>
|
|
60
|
+
* </>
|
|
61
|
+
* )
|
|
62
|
+
* },
|
|
63
|
+
* draggable: true,
|
|
64
|
+
* mask: true,
|
|
65
|
+
* maskClosable: true,
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
23
68
|
*/
|
|
24
69
|
openDialog(dialog: IDialogPartMethodOptions): IDisposable;
|
|
25
70
|
/**
|
|
26
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.
|
|
71
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.CellClicked, (params) => {})` instead
|
|
27
72
|
*/
|
|
28
73
|
onCellClick(callback: (cell: IHoverRichTextInfo) => void): IDisposable;
|
|
29
74
|
/**
|
|
30
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.CellHover, () => {})` instead
|
|
75
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.CellHover, (params) => {})` instead
|
|
31
76
|
*/
|
|
32
77
|
onCellHover(callback: (cell: IHoverRichTextPosition) => void): IDisposable;
|
|
33
78
|
/**
|
|
34
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.CellPointerMove, () => {})` instead
|
|
79
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.CellPointerMove, (params) => {})` instead
|
|
35
80
|
*/
|
|
36
81
|
onCellPointerMove(callback: (cell: ICellPosWithEvent, event: IPointerEvent | IMouseEvent) => void): IDisposable;
|
|
37
82
|
/**
|
|
38
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.CellPointerDown, () => {})` instead
|
|
83
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.CellPointerDown, (params) => {})` instead
|
|
39
84
|
*/
|
|
40
85
|
onCellPointerDown(callback: (cell: ICellPosWithEvent) => void): IDisposable;
|
|
41
86
|
/**
|
|
42
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.CellPointerUp, () => {})` instead
|
|
87
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.CellPointerUp, (params) => {})` instead
|
|
43
88
|
*/
|
|
44
89
|
onCellPointerUp(callback: (cell: ICellPosWithEvent) => void): IDisposable;
|
|
45
90
|
/**
|
|
46
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.DragOver, () => {})` instead
|
|
91
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.DragOver, (params) => {})` instead
|
|
47
92
|
*/
|
|
48
93
|
onDragOver(callback: (cell: IDragCellPosition) => void): IDisposable;
|
|
49
94
|
/**
|
|
50
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Drop, () => {})` instead
|
|
95
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Drop, (params) => {})` instead
|
|
51
96
|
*/
|
|
52
97
|
onDrop(callback: (cell: IDragCellPosition) => void): IDisposable;
|
|
53
98
|
/**
|
|
54
|
-
* Start the editing process
|
|
55
|
-
* @returns
|
|
99
|
+
* Start the editing process of the current active cell
|
|
100
|
+
* @returns {boolean} Whether the editing process is started successfully
|
|
56
101
|
* @example
|
|
57
102
|
* ```ts
|
|
58
|
-
* univerAPI.getActiveWorkbook()
|
|
103
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
104
|
+
* fWorkbook.startEditing();
|
|
59
105
|
* ```
|
|
60
106
|
*/
|
|
61
107
|
startEditing(): boolean;
|
|
@@ -65,46 +111,72 @@ export interface IFWorkbookSheetsUIMixin {
|
|
|
65
111
|
endEditing(save?: boolean): Promise<boolean>;
|
|
66
112
|
/**
|
|
67
113
|
* @async
|
|
68
|
-
* End the editing process
|
|
114
|
+
* End the editing process of the current active cell
|
|
69
115
|
* @param {boolean} save - Whether to save the changes, default is true
|
|
70
|
-
* @returns {Promise<boolean>}
|
|
116
|
+
* @returns {Promise<boolean>} Whether the editing process is ended successfully
|
|
71
117
|
* @example
|
|
72
118
|
* ```ts
|
|
73
|
-
*
|
|
119
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
120
|
+
* await fWorkbook.endEditingAsync(false);
|
|
74
121
|
* ```
|
|
75
122
|
*/
|
|
76
123
|
endEditingAsync(save?: boolean): Promise<boolean>;
|
|
124
|
+
/**
|
|
125
|
+
* Get scroll state of specified sheet.
|
|
126
|
+
* @param {string} sheetId - sheet id
|
|
127
|
+
* @returns {IScrollState} scroll state
|
|
128
|
+
* @example
|
|
129
|
+
* ``` ts
|
|
130
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
131
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
132
|
+
*
|
|
133
|
+
* // scroll to cell D10
|
|
134
|
+
* fWorksheet.scrollToCell(9, 3);
|
|
135
|
+
*
|
|
136
|
+
* // get scroll state
|
|
137
|
+
* const scrollState = fWorkbook.getScrollStateBySheetId(fWorksheet.getSheetId());
|
|
138
|
+
* const { offsetX, offsetY, sheetViewStartRow, sheetViewStartColumn } = scrollState;
|
|
139
|
+
* console.log(scrollState); // sheetViewStartRow: 9, sheetViewStartColumn: 3, offsetX: 0, offsetY: 0
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
77
142
|
getScrollStateBySheetId(sheetId: string): Nullable<IScrollState>;
|
|
78
143
|
/**
|
|
79
144
|
* Disable selection. After disabled, there would be no response for selection.
|
|
80
|
-
* @returns {FWorkbook} FWorkbook instance
|
|
145
|
+
* @returns {FWorkbook} FWorkbook instance for chaining
|
|
81
146
|
* @example
|
|
82
147
|
* ```ts
|
|
83
|
-
* univerAPI.getActiveWorkbook()
|
|
148
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
149
|
+
* fWorkbook.disableSelection();
|
|
84
150
|
* ```
|
|
85
151
|
*/
|
|
86
152
|
disableSelection(): FWorkbook;
|
|
87
153
|
/**
|
|
88
154
|
* Enable selection. After this you can select range.
|
|
155
|
+
* @returns {FWorkbook} FWorkbook instance for chaining
|
|
89
156
|
* @example
|
|
90
157
|
* ```ts
|
|
91
|
-
* univerAPI.getActiveWorkbook()
|
|
158
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
159
|
+
* fWorkbook.enableSelection();
|
|
92
160
|
* ```
|
|
93
161
|
*/
|
|
94
162
|
enableSelection(): FWorkbook;
|
|
95
163
|
/**
|
|
96
164
|
* Set selection invisible, Unlike disableSelection, selection still works, you just can not see them.
|
|
165
|
+
* @returns {FWorkbook} FWorkbook instance for chaining
|
|
97
166
|
* @example
|
|
98
167
|
* ```ts
|
|
99
|
-
* univerAPI.getActiveWorkbook()
|
|
168
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
169
|
+
* fWorkbook.transparentSelection();
|
|
100
170
|
* ```
|
|
101
171
|
*/
|
|
102
172
|
transparentSelection(): FWorkbook;
|
|
103
173
|
/**
|
|
104
174
|
* Set selection visible.
|
|
175
|
+
* @returns {FWorkbook} FWorkbook instance for chaining
|
|
105
176
|
* @example
|
|
106
177
|
* ```ts
|
|
107
|
-
* univerAPI.getActiveWorkbook()
|
|
178
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
179
|
+
* fWorkbook.showSelection();
|
|
108
180
|
* ```
|
|
109
181
|
*/
|
|
110
182
|
showSelection(): FWorkbook;
|
|
@@ -8,25 +8,34 @@ import { FWorksheet } from '@univerjs/sheets/facade';
|
|
|
8
8
|
export interface IFWorksheetSkeletonMixin {
|
|
9
9
|
/**
|
|
10
10
|
* Refresh the canvas.
|
|
11
|
+
* @returns {FWorksheet} The FWorksheet instance for chaining.
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
15
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
16
|
+
* fWorksheet.refreshCanvas();
|
|
17
|
+
* ```
|
|
11
18
|
*/
|
|
12
19
|
refreshCanvas(): FWorksheet;
|
|
13
20
|
/**
|
|
14
21
|
* Set zoom ratio of the worksheet.
|
|
15
|
-
* @param {number} zoomRatio The zoom ratio to set.It should be in the range of
|
|
16
|
-
* @returns
|
|
22
|
+
* @param {number} zoomRatio The zoom ratio to set.It should be in the range of 0.1 to 4.0.
|
|
23
|
+
* @returns {FWorksheet} The FWorksheet instance for chaining.
|
|
17
24
|
* @example
|
|
18
25
|
* ```ts
|
|
19
26
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
20
27
|
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
21
|
-
*
|
|
28
|
+
*
|
|
29
|
+
* // Set zoom ratio to 200%
|
|
30
|
+
* fWorksheet.zoom(2);
|
|
22
31
|
* const zoomRatio = fWorksheet.getZoom();
|
|
23
|
-
* console.log(zoomRatio); //
|
|
32
|
+
* console.log(zoomRatio); // 2
|
|
24
33
|
* ```
|
|
25
34
|
*/
|
|
26
35
|
zoom(zoomRatio: number): FWorksheet;
|
|
27
36
|
/**
|
|
28
37
|
* Get the zoom ratio of the worksheet.
|
|
29
|
-
* @returns The zoom ratio of the worksheet.
|
|
38
|
+
* @returns {number} The zoom ratio of the worksheet.
|
|
30
39
|
* @example
|
|
31
40
|
* ```ts
|
|
32
41
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -40,10 +49,12 @@ export interface IFWorksheetSkeletonMixin {
|
|
|
40
49
|
* Return visible range, sum view range of 4 viewports.
|
|
41
50
|
* @returns {IRange} - visible range
|
|
42
51
|
* @example
|
|
43
|
-
* ```
|
|
52
|
+
* ```ts
|
|
44
53
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
45
54
|
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
46
55
|
* const visibleRange = fWorksheet.getVisibleRange();
|
|
56
|
+
* console.log(visibleRange);
|
|
57
|
+
* console.log(fWorksheet.getRange(visibleRange).getA1Notation());
|
|
47
58
|
* ```
|
|
48
59
|
*/
|
|
49
60
|
getVisibleRange(): IRange;
|
|
@@ -52,10 +63,17 @@ export interface IFWorksheetSkeletonMixin {
|
|
|
52
63
|
* Based on the limitations of viewport and the number of rows and columns, you can only scroll to the maximum scrollable range.
|
|
53
64
|
* @param {number} row - Cell row index
|
|
54
65
|
* @param {number} column - Cell column index
|
|
55
|
-
* @returns {FWorksheet} -
|
|
66
|
+
* @returns {FWorksheet} - The FWorksheet instance for chaining.
|
|
56
67
|
* @example
|
|
57
|
-
* ```
|
|
58
|
-
* univerAPI.getActiveWorkbook()
|
|
68
|
+
* ```ts
|
|
69
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
70
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
71
|
+
*
|
|
72
|
+
* // Scroll to cell D10
|
|
73
|
+
* const fRange = fWorksheet.getRange('D10');
|
|
74
|
+
* const row = fRange.getRow();
|
|
75
|
+
* const column = fRange.getColumn();
|
|
76
|
+
* fWorksheet.scrollToCell(row, column);
|
|
59
77
|
* ```
|
|
60
78
|
*/
|
|
61
79
|
scrollToCell(row: number, column: number): FWorksheet;
|
|
@@ -63,8 +81,20 @@ export interface IFWorksheetSkeletonMixin {
|
|
|
63
81
|
* Get scroll state of current sheet.
|
|
64
82
|
* @returns {IScrollState} curr scroll state
|
|
65
83
|
* @example
|
|
66
|
-
* ```
|
|
67
|
-
* univerAPI.getActiveWorkbook()
|
|
84
|
+
* ```ts
|
|
85
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
86
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
87
|
+
*
|
|
88
|
+
* // Scroll to cell D10
|
|
89
|
+
* const fRange = fWorksheet.getRange('D10');
|
|
90
|
+
* const row = fRange.getRow();
|
|
91
|
+
* const column = fRange.getColumn();
|
|
92
|
+
* fWorksheet.scrollToCell(row, column);
|
|
93
|
+
*
|
|
94
|
+
* // Get scroll state
|
|
95
|
+
* const scrollState = fWorksheet.getScrollState();
|
|
96
|
+
* const { offsetX, offsetY, sheetViewStartColumn, sheetViewStartRow } = scrollState;
|
|
97
|
+
* console.log(scrollState); // sheetViewStartRow: 9, sheetViewStartColumn: 3, offsetX: 0, offsetY: 0
|
|
68
98
|
* ```
|
|
69
99
|
*/
|
|
70
100
|
getScrollState(): IScrollState;
|
|
@@ -81,13 +111,16 @@ export interface IFWorksheetSkeletonMixin {
|
|
|
81
111
|
*/
|
|
82
112
|
getSkeleton(): Nullable<SpreadsheetSkeleton>;
|
|
83
113
|
/**
|
|
84
|
-
* Set the
|
|
85
|
-
* @param {number} columnPosition - Column position
|
|
114
|
+
* Set the column width to auto width.
|
|
115
|
+
* @param {number} columnPosition - Column position index
|
|
86
116
|
* @param {number} numColumn - Number of columns
|
|
117
|
+
* @returns {FWorksheet} - The FWorksheet instance for chaining.
|
|
87
118
|
* @example
|
|
88
119
|
* ```ts
|
|
89
120
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
90
121
|
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
122
|
+
*
|
|
123
|
+
* // Set A:C columns to auto width
|
|
91
124
|
* fWorksheet.setColumnAutoWidth(0, 3);
|
|
92
125
|
* ```
|
|
93
126
|
*/
|
|
@@ -144,26 +177,30 @@ export interface IFWorksheetSkeletonMixin {
|
|
|
144
177
|
customizeRowHeader(cfg: IRowsHeaderCfgParam): void;
|
|
145
178
|
/**
|
|
146
179
|
* Set column height for column header.
|
|
147
|
-
* @param height
|
|
180
|
+
* @param {number} height - The height to set.
|
|
181
|
+
* @returns {FWorksheet} - The FWorksheet instance for chaining.
|
|
148
182
|
* @example
|
|
149
183
|
* ```ts
|
|
150
|
-
|
|
151
|
-
|
|
184
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
185
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
186
|
+
* fWorksheet.setColumnHeaderHeight(100);
|
|
152
187
|
* ```
|
|
153
188
|
*/
|
|
154
189
|
setColumnHeaderHeight(height: number): FWorksheet;
|
|
155
190
|
/**
|
|
156
191
|
* Set column height for column header.
|
|
157
|
-
* @param width
|
|
192
|
+
* @param {number} width - The width to set.
|
|
193
|
+
* @returns {FWorksheet} - The FWorksheet instance for chaining.
|
|
158
194
|
* @example
|
|
159
195
|
* ```ts
|
|
160
|
-
|
|
161
|
-
|
|
196
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
197
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
198
|
+
* fWorksheet.setRowHeaderWidth(100);
|
|
162
199
|
* ```
|
|
163
200
|
*/
|
|
164
201
|
setRowHeaderWidth(width: number): FWorksheet;
|
|
165
202
|
/**
|
|
166
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Scroll, () => {})` instead
|
|
203
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Scroll, (params) => {})` instead
|
|
167
204
|
*/
|
|
168
205
|
onScroll(callback: (params: Nullable<IViewportScrollState>) => void): IDisposable;
|
|
169
206
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export { HoverRenderController } from './controllers/hover-render.controller';
|
|
|
57
57
|
export { DragRenderController } from './controllers/drag-render.controller';
|
|
58
58
|
export { EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY, RANGE_SELECTOR_COMPONENT_KEY, SHEET_VIEW_KEY } from './common/keys';
|
|
59
59
|
export type { IDiscreteRange } from './controllers/utils/range-tools';
|
|
60
|
-
export { discreteRangeToRange,
|
|
60
|
+
export { discreteRangeToRange, virtualizeDiscreteRanges } from './controllers/utils/range-tools';
|
|
61
61
|
export { AFFECT_LAYOUT_STYLES, AutoHeightController } from './controllers/auto-height.controller';
|
|
62
62
|
export { AutoWidthController } from './controllers/auto-width.controller';
|
|
63
63
|
export { FormulaEditorController } from './controllers/editor/formula-editor.controller';
|
|
@@ -6,8 +6,4 @@ export interface ISheetBarMenuItem {
|
|
|
6
6
|
index?: string;
|
|
7
7
|
sheetId?: string;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
10
|
-
style?: React.CSSProperties;
|
|
11
|
-
onClick?: (e?: MouseEvent) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare function SheetBarMenu(props: ISheetBarMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function SheetBarMenu(): import("react/jsx-runtime").JSX.Element;
|