@univerjs/sheets-ui 0.6.1 → 0.6.2-nightly.202503031606

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 (57) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +65 -46
  3. package/lib/cjs/locale/en-US.js +1 -1
  4. package/lib/cjs/locale/fa-IR.js +1 -1
  5. package/lib/cjs/locale/fr-FR.js +1 -1
  6. package/lib/cjs/locale/ru-RU.js +1 -1
  7. package/lib/cjs/locale/vi-VN.js +1 -1
  8. package/lib/cjs/locale/zh-CN.js +1 -1
  9. package/lib/cjs/locale/zh-TW.js +1 -1
  10. package/lib/es/facade.js +580 -574
  11. package/lib/es/index.js +13667 -13513
  12. package/lib/es/locale/en-US.js +8 -156
  13. package/lib/es/locale/fa-IR.js +8 -156
  14. package/lib/es/locale/fr-FR.js +8 -156
  15. package/lib/es/locale/ru-RU.js +8 -156
  16. package/lib/es/locale/vi-VN.js +8 -156
  17. package/lib/es/locale/zh-CN.js +8 -156
  18. package/lib/es/locale/zh-TW.js +8 -156
  19. package/lib/index.css +1 -1
  20. package/lib/types/basics/editor/range.d.ts +18 -0
  21. package/lib/types/controllers/auto-height.controller.d.ts +4 -2
  22. package/lib/types/controllers/checkbox.controller.d.ts +3 -2
  23. package/lib/types/controllers/clipboard/clipboard.controller.d.ts +2 -2
  24. package/lib/types/controllers/config.schema.d.ts +6 -0
  25. package/lib/types/controllers/menu/insert.menu.d.ts +40 -0
  26. package/lib/types/controllers/render-controllers/header-menu.render-controller.d.ts +2 -2
  27. package/lib/types/controllers/shortcuts/editor.shortcut.d.ts +1 -1
  28. package/lib/types/controllers/shortcuts/value.shortcut.d.ts +1 -0
  29. package/lib/types/controllers/utils/range-tools.d.ts +1 -2
  30. package/lib/types/facade/f-event.d.ts +177 -74
  31. package/lib/types/facade/f-permission.d.ts +4 -2
  32. package/lib/types/facade/f-range.d.ts +106 -61
  33. package/lib/types/facade/f-sheet-hooks.d.ts +6 -0
  34. package/lib/types/facade/f-workbook.d.ts +97 -25
  35. package/lib/types/facade/f-worksheet.d.ts +103 -22
  36. package/lib/types/index.d.ts +1 -1
  37. package/lib/types/locale/zh-CN.d.ts +8 -176
  38. package/lib/types/services/clipboard/clipboard.service.d.ts +1 -1
  39. package/lib/types/services/selection/base-selection-render.service.d.ts +1 -1
  40. package/lib/types/services/selection/selection-render-model.d.ts +0 -4
  41. package/lib/types/views/{operate-container → auto-fill-popup-menu}/AutoFillPopupMenu.d.ts +1 -1
  42. package/lib/types/views/permission/panel-detail/PermissionDetailMainPart.d.ts +0 -4
  43. package/lib/types/views/sheet-bar/sheet-bar-menu/SheetBarMenu.d.ts +1 -5
  44. package/lib/types/views/sheet-container/SheetContainer.d.ts +1 -0
  45. package/lib/umd/facade.js +1 -1
  46. package/lib/umd/index.js +58 -39
  47. package/lib/umd/locale/en-US.js +1 -1
  48. package/lib/umd/locale/fa-IR.js +1 -1
  49. package/lib/umd/locale/fr-FR.js +1 -1
  50. package/lib/umd/locale/ru-RU.js +1 -1
  51. package/lib/umd/locale/vi-VN.js +1 -1
  52. package/lib/umd/locale/zh-CN.js +1 -1
  53. package/lib/umd/locale/zh-TW.js +1 -1
  54. package/package.json +15 -16
  55. package/LICENSE +0 -176
  56. package/lib/types/views/operate-container/OperateContainer.d.ts +0 -2
  57. 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
- * ``` ts
29
- * let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
30
- * sheet.getRange(5, 7).getCell();
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
- * ``` ts
39
- * let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
40
- * sheet.getRange(5, 7).getCellRect();
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
- * ``` ts
48
- * let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
49
- * sheet.getRange(5, 7).generateHTML();
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
- univerAPI.getComponentManager().register(
62
- 'myPopup',
63
- () => React.createElement('div', {
64
- style: {
65
- color: 'red',
66
- fontSize: '14px'
67
- }
68
- }, 'Custom Popup')
69
- );
70
-
71
- let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
72
- let range = sheet.getRange(2, 2, 3, 3);
73
- univerAPI.getActiveWorkbook().setActiveRange(range);
74
- let disposable = range.attachPopup({
75
- componentKey: 'myPopup'
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
- * let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
87
- * let range = sheet.getRange(2, 2, 3, 3);
88
- * range.attachAlertPopup({ message: 'This is an alert', type: 'warning' });
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
- let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
99
- let range = sheet.getRange(2, 2, 3, 3);
100
- univerAPI.getActiveWorkbook().setActiveRange(range);
101
-
102
- univerAPI.getComponentManager().register(
103
- 'myPopup',
104
- () => React.createElement('div', {
105
- style: {
106
- background: 'red',
107
- fontSize: '14px'
108
- }
109
- }, 'Custom Popup')
110
- );
111
- let disposable = range.attachRangePopup({
112
- componentKey: 'myPopup',
113
- direction: 'top' // 'vertical' | 'horizontal' | 'top' | 'right' | 'left' | 'bottom' | 'bottom-center' | 'top-center';
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
- * Highlight the range with the specified style and primary cell.
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
- * let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
125
- * let range = sheet.getRange(2, 2, 3, 3);
126
- * range.highlight({ stroke: 'red' }, { startRow: 2, startColumn: 2 });
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.CellClick, () => {})` instead
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 A boolean value
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().startEditing();
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>} A promise that resolves to a boolean value
116
+ * @returns {Promise<boolean>} Whether the editing process is ended successfully
71
117
  * @example
72
118
  * ```ts
73
- * await univerAPI.getActiveWorkbook().endEditingAsync(false);
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().disableSelection();
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().enableSelection();
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().transparentSelection();
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().showSelection();
178
+ * const fWorkbook = univerAPI.getActiveWorkbook();
179
+ * fWorkbook.showSelection();
108
180
  * ```
109
181
  */
110
182
  showSelection(): FWorkbook;