@univerjs/sheets-ui 1.4.0 → 1.5.1

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 (115) hide show
  1. package/README.md +9 -5
  2. package/lib/cjs/index.js +1293 -583
  3. package/lib/cjs/locale/ar-SA.js +8 -4
  4. package/lib/cjs/locale/ca-ES.js +8 -4
  5. package/lib/cjs/locale/de-DE.js +8 -4
  6. package/lib/cjs/locale/en-US.js +8 -4
  7. package/lib/cjs/locale/es-ES.js +8 -4
  8. package/lib/cjs/locale/fa-IR.js +8 -4
  9. package/lib/cjs/locale/fr-FR.js +8 -4
  10. package/lib/cjs/locale/id-ID.js +8 -4
  11. package/lib/cjs/locale/it-IT.js +8 -4
  12. package/lib/cjs/locale/ja-JP.js +8 -4
  13. package/lib/cjs/locale/ko-KR.js +8 -4
  14. package/lib/cjs/locale/pl-PL.js +8 -4
  15. package/lib/cjs/locale/pt-BR.js +8 -4
  16. package/lib/cjs/locale/ru-RU.js +8 -4
  17. package/lib/cjs/locale/sk-SK.js +8 -4
  18. package/lib/cjs/locale/vi-VN.js +8 -4
  19. package/lib/cjs/locale/zh-CN.js +8 -4
  20. package/lib/cjs/locale/zh-HK.js +8 -4
  21. package/lib/cjs/locale/zh-TW.js +8 -4
  22. package/lib/es/index.js +1298 -588
  23. package/lib/es/locale/ar-SA.js +8 -4
  24. package/lib/es/locale/ca-ES.js +8 -4
  25. package/lib/es/locale/de-DE.js +8 -4
  26. package/lib/es/locale/en-US.js +8 -4
  27. package/lib/es/locale/es-ES.js +8 -4
  28. package/lib/es/locale/fa-IR.js +8 -4
  29. package/lib/es/locale/fr-FR.js +8 -4
  30. package/lib/es/locale/id-ID.js +8 -4
  31. package/lib/es/locale/it-IT.js +8 -4
  32. package/lib/es/locale/ja-JP.js +8 -4
  33. package/lib/es/locale/ko-KR.js +8 -4
  34. package/lib/es/locale/pl-PL.js +8 -4
  35. package/lib/es/locale/pt-BR.js +8 -4
  36. package/lib/es/locale/ru-RU.js +8 -4
  37. package/lib/es/locale/sk-SK.js +8 -4
  38. package/lib/es/locale/vi-VN.js +8 -4
  39. package/lib/es/locale/zh-CN.js +8 -4
  40. package/lib/es/locale/zh-HK.js +8 -4
  41. package/lib/es/locale/zh-TW.js +8 -4
  42. package/lib/index.css +41 -28
  43. package/lib/index.js +1298 -588
  44. package/lib/locale/ar-SA.js +8 -4
  45. package/lib/locale/ca-ES.js +8 -4
  46. package/lib/locale/de-DE.js +8 -4
  47. package/lib/locale/en-US.js +8 -4
  48. package/lib/locale/es-ES.js +8 -4
  49. package/lib/locale/fa-IR.js +8 -4
  50. package/lib/locale/fr-FR.js +8 -4
  51. package/lib/locale/id-ID.js +8 -4
  52. package/lib/locale/it-IT.js +8 -4
  53. package/lib/locale/ja-JP.js +8 -4
  54. package/lib/locale/ko-KR.js +8 -4
  55. package/lib/locale/pl-PL.js +8 -4
  56. package/lib/locale/pt-BR.js +8 -4
  57. package/lib/locale/ru-RU.js +8 -4
  58. package/lib/locale/sk-SK.js +8 -4
  59. package/lib/locale/vi-VN.js +8 -4
  60. package/lib/locale/zh-CN.js +8 -4
  61. package/lib/locale/zh-HK.js +8 -4
  62. package/lib/locale/zh-TW.js +8 -4
  63. package/lib/types/commands/commands/set-zoom-ratio.command.d.ts +3 -1
  64. package/lib/types/commands/operations/set-zoom-ratio.operation.d.ts +3 -1
  65. package/lib/types/common/keys.d.ts +1 -0
  66. package/lib/types/config/config.d.ts +18 -0
  67. package/lib/types/controllers/editor/data-sync.controller.d.ts +10 -0
  68. package/lib/types/controllers/render-controllers/contextmenu.render-controller.d.ts +3 -2
  69. package/lib/types/controllers/render-controllers/editor-bridge.render-controller.d.ts +3 -0
  70. package/lib/types/controllers/render-controllers/freeze.render-controller.d.ts +1 -0
  71. package/lib/types/controllers/render-controllers/header-move.render-controller.d.ts +9 -2
  72. package/lib/types/controllers/render-controllers/scroll.render-controller.d.ts +9 -0
  73. package/lib/types/controllers/render-controllers/sheet.render-controller.d.ts +9 -1
  74. package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +3 -3
  75. package/lib/types/facade/f-worksheet.d.ts +8 -0
  76. package/lib/types/locale/en-US.d.ts +5 -1
  77. package/lib/types/menu/menu-util.d.ts +1 -1
  78. package/lib/types/services/canvas-pop-manager.service.d.ts +1 -0
  79. package/lib/types/services/clipboard/clipboard.service.d.ts +1 -1
  80. package/lib/types/services/clipboard/html-to-usm/converter.d.ts +1 -1
  81. package/lib/types/services/clipboard/type.d.ts +2 -1
  82. package/lib/types/services/editor-bridge.service.d.ts +5 -0
  83. package/lib/types/services/hover-manager.service.d.ts +1 -0
  84. package/lib/types/services/scroll-manager.service.d.ts +1 -1
  85. package/lib/types/services/selection/base-selection-render.service.d.ts +2 -1
  86. package/lib/types/services/selection/mobile-selection-render.service.d.ts +7 -2
  87. package/lib/types/services/selection/selection-render.service.d.ts +3 -0
  88. package/lib/types/services/sheet-skeleton-manager.service.d.ts +8 -0
  89. package/lib/types/services/sheets-render.service.d.ts +4 -0
  90. package/lib/types/views/permission/extensions/range-protection.render.d.ts +3 -0
  91. package/lib/types/views/permission/extensions/worksheet-permission.render.d.ts +2 -0
  92. package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-name-editor.d.ts +1 -0
  93. package/lib/umd/index.js +9 -9
  94. package/lib/umd/locale/ar-SA.js +1 -1
  95. package/lib/umd/locale/ca-ES.js +1 -1
  96. package/lib/umd/locale/de-DE.js +1 -1
  97. package/lib/umd/locale/en-US.js +1 -1
  98. package/lib/umd/locale/es-ES.js +1 -1
  99. package/lib/umd/locale/fa-IR.js +1 -1
  100. package/lib/umd/locale/fr-FR.js +1 -1
  101. package/lib/umd/locale/id-ID.js +1 -1
  102. package/lib/umd/locale/it-IT.js +1 -1
  103. package/lib/umd/locale/ja-JP.js +1 -1
  104. package/lib/umd/locale/ko-KR.js +1 -1
  105. package/lib/umd/locale/pl-PL.js +1 -1
  106. package/lib/umd/locale/pt-BR.js +1 -1
  107. package/lib/umd/locale/ru-RU.js +1 -1
  108. package/lib/umd/locale/sk-SK.js +1 -1
  109. package/lib/umd/locale/vi-VN.js +1 -1
  110. package/lib/umd/locale/zh-CN.js +1 -1
  111. package/lib/umd/locale/zh-HK.js +1 -1
  112. package/lib/umd/locale/zh-TW.js +1 -1
  113. package/package.json +15 -15
  114. package/lib/types/views/permission/panel-list/constant.d.ts +0 -16
  115. package/lib/types/views/permission/user-dialog/constant.d.ts +0 -16
@@ -13,9 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { ICommand } from '@univerjs/core';
16
+ import type { BooleanNumber, ICommand } from '@univerjs/core';
17
17
  export interface ISetZoomRatioCommandParams {
18
18
  zoomRatio: number;
19
+ /** Omission is a manual request, preserving historical callers; TRUE enters CHART continuous fit. */
20
+ zoomToFit?: BooleanNumber;
19
21
  unitId: string;
20
22
  subUnitId: string;
21
23
  }
@@ -13,9 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IOperation } from '@univerjs/core';
16
+ import type { BooleanNumber, IOperation } from '@univerjs/core';
17
17
  export interface ISetZoomRatioOperationParams {
18
18
  zoomRatio: number;
19
+ /** Historical omission remains manual; only CHART consumes this optional view policy. */
20
+ zoomToFit?: BooleanNumber;
19
21
  unitId: string;
20
22
  subUnitId: string;
21
23
  }
@@ -22,6 +22,7 @@ export declare const EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY = "EMBEDDING_FORMULA
22
22
  export declare const EMBEDDING_CELL_EDITOR_COMPONENT_KEY = "EMBEDDING_CELL_EDITOR_COMPONENT_KEY";
23
23
  export declare enum SHEET_VIEW_KEY {
24
24
  MAIN = "__SpreadsheetRender__",
25
+ CHART_PAGE = "__ChartSheetPage__",
25
26
  ROW = "__SpreadsheetRowHeader__",
26
27
  COLUMN = "__SpreadsheetColumnHeader__",
27
28
  LEFT_TOP = "__SpreadsheetLeftTopPlaceholder__"
@@ -29,11 +29,23 @@ export interface IUniverSheetsUIConfig {
29
29
  * @default true
30
30
  */
31
31
  allowArrowKeyWrapOnSheetBoundary?: boolean;
32
+ /**
33
+ * Whether to animate the selection outline when clicking between cells on desktop.
34
+ * The system preference for reduced motion takes precedence.
35
+ * @default true
36
+ */
37
+ selectionAnimation?: boolean;
32
38
  /**
33
39
  * The maximum count of rows triggering auto height. This is used to avoid performance issue.
34
40
  * @default 1000
35
41
  */
36
42
  maxAutoHeightCount?: number;
43
+ /**
44
+ * Whether to show the desktop fill handle for dragging and double-click filling.
45
+ * Does not affect fill commands or Facade APIs.
46
+ * @default true
47
+ */
48
+ enableFillHandle?: boolean;
37
49
  /**
38
50
  * Whether to show the formula bar.
39
51
  */
@@ -88,6 +100,12 @@ export interface IUniverSheetsUIConfig {
88
100
  clipboardConfig?: {
89
101
  hidePasteOptions?: boolean;
90
102
  };
103
+ /**
104
+ * Whether to ask for confirmation before a dragged range overwrites existing cell content.
105
+ * Disabling the warning does not bypass move validation or undo/redo.
106
+ * @default true
107
+ */
108
+ warnBeforeDragOverwrite?: boolean;
91
109
  /** The config of the scroll bar. */
92
110
  scrollConfig?: IScrollBarProps;
93
111
  /**
@@ -40,6 +40,16 @@ export declare class EditorDataSyncController extends Disposable {
40
40
  private _editorSyncHandler;
41
41
  private _commandExecutedListener;
42
42
  private _shouldRefreshCurrentEditCell;
43
+ /**
44
+ * Whether a matched mutation replaces the edited cell's content. Moving cells into or out of the edited
45
+ * cell does; a style-only write does not, because the editor does not own the cell style it renders with.
46
+ */
47
+ private _writesCellContent;
48
+ /**
49
+ * A row/column pair is only meaningful inside the workbook and worksheet it belongs to, so a mutation
50
+ * on another sheet or another workbook must not be treated as an update of the edit cell.
51
+ */
52
+ private _isEditedUnit;
43
53
  private _hasMatrixCell;
44
54
  private _syncActionsAndRender;
45
55
  private _syncContentAndRender;
@@ -15,11 +15,11 @@
15
15
  */
16
16
  import type { Workbook } from '@univerjs/core';
17
17
  import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
18
- import type { ISheetEmbedRuntimeDomScope } from '../../services/sheet-embed-integration.service';
19
- import type { ISheetHostChromeOverride } from '../../services/sheet-host-chrome-override.service';
20
18
  import { Disposable, IContextService, Injector } from '@univerjs/core';
21
19
  import { SheetsSelectionsService } from '@univerjs/sheets';
22
20
  import { IContextMenuService, IPlatformService } from '@univerjs/ui';
21
+ import type { ISheetEmbedRuntimeDomScope } from '../../services/sheet-embed-integration.service';
22
+ import type { ISheetHostChromeOverride } from '../../services/sheet-host-chrome-override.service';
23
23
  import { ISheetSelectionRenderService } from '../../services/selection/base-selection-render.service';
24
24
  /**
25
25
  * This controller subscribe to context menu events in sheet rendering views and invoke context menu at a correct
@@ -34,6 +34,7 @@ export declare class SheetContextMenuRenderController extends Disposable impleme
34
34
  private readonly _platformService;
35
35
  private readonly _contextService;
36
36
  constructor(_context: IRenderContext<Workbook>, _contextMenuService: IContextMenuService, _selectionManagerService: SheetsSelectionsService, _selectionRenderService: ISheetSelectionRenderService, _injector: Injector, _platformService: IPlatformService, _contextService: IContextService);
37
+ private _getSheetType;
37
38
  private _init;
38
39
  private _isContextMenuGesture;
39
40
  private _initEmbedRuntimeSessionListener;
@@ -30,12 +30,15 @@ export declare class EditorBridgeRenderController extends RxDisposable implement
30
30
  private readonly _embedRuntimeFocusCoordinator?;
31
31
  private _d;
32
32
  constructor(_context: IRenderContext<Workbook>, _instanceSrv: IUniverInstanceService, _commandService: ICommandService, _editorBridgeService: IEditorBridgeService, _selectionManagerService: SheetsSelectionsService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _embedRuntimeFocusCoordinator?: ISheetEmbedRuntimeFocusCoordinator | undefined);
33
+ private _getSheetType;
34
+ dispose(): void;
33
35
  private _init;
34
36
  private _disposeCurrent;
35
37
  private _initSelectionChangeListener;
36
38
  private _updateEditorPosition;
37
39
  refreshEditorPosition(): void;
38
40
  private _commandExecutedListener;
41
+ private _closeEditorForChart;
39
42
  private _tryHideEditor;
40
43
  private _isEmbeddedFormulaEditorActive;
41
44
  private _hideEditor;
@@ -56,6 +56,7 @@ export declare class HeaderFreezeRenderController extends Disposable implements
56
56
  FREEZE_PERMISSION_CHECK: import("@univerjs/core").IInterceptor<boolean, null>;
57
57
  }>;
58
58
  constructor(_context: IRenderContext<Workbook>, _sheetSkeletonManagerService: SheetSkeletonManagerService, _commandService: ICommandService, _selectionManagerService: SheetsSelectionsService, _scrollManagerService: SheetScrollManagerService, _themeService: ThemeService, _sheetInterceptorService: SheetInterceptorService, _injector: Injector);
59
+ private _getSheetType;
59
60
  dispose(): void;
60
61
  private _initialize;
61
62
  private _createFreeze;
@@ -15,14 +15,17 @@
15
15
  */
16
16
  import type { IRange, Workbook } from '@univerjs/core';
17
17
  import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
18
- import { Disposable, ICommandService, InterceptorManager } from '@univerjs/core';
18
+ import { Disposable, ICommandService, IContextService, InterceptorManager } from '@univerjs/core';
19
19
  import { SheetsSelectionsService } from '@univerjs/sheets';
20
+ import { IPlatformService } from '@univerjs/ui';
20
21
  import { SheetSkeletonManagerService } from '../../services/sheet-skeleton-manager.service';
21
22
  export declare const HEADER_MOVE_PERMISSION_CHECK: import("@univerjs/core").IInterceptor<boolean, IRange>;
22
23
  export declare class HeaderMoveRenderController extends Disposable implements IRenderModule {
23
24
  private readonly _context;
24
25
  private readonly _sheetSkeletonManagerService;
25
26
  private readonly _commandService;
27
+ private readonly _platformService;
28
+ private readonly _contextService;
26
29
  private _startOffsetX;
27
30
  private _startOffsetY;
28
31
  private _moveHelperBackgroundShape;
@@ -41,11 +44,15 @@ export declare class HeaderMoveRenderController extends Disposable implements IR
41
44
  HEADER_MOVE_PERMISSION_CHECK: import("@univerjs/core").IInterceptor<boolean, IRange>;
42
45
  }>;
43
46
  private readonly _workbookSelections;
44
- constructor(_context: IRenderContext<Workbook>, selectionManagerService: SheetsSelectionsService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _commandService: ICommandService);
47
+ constructor(_context: IRenderContext<Workbook>, selectionManagerService: SheetsSelectionsService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _commandService: ICommandService, _platformService: IPlatformService, _contextService: IContextService);
45
48
  dispose(): void;
46
49
  private _init;
47
50
  private _initialRowOrColumn;
51
+ private _onPointerDown;
52
+ private _startDragging;
53
+ private _onPointerUp;
48
54
  private _rowColumnMoving;
55
+ private _updateMoveHelperLine;
49
56
  private _clearObserverEvent;
50
57
  private _newBackgroundAndLine;
51
58
  private _disposeBackgroundAndLine;
@@ -33,12 +33,21 @@ export declare class SheetsScrollRenderController extends Disposable implements
33
33
  private _pendingWheelOffsetX;
34
34
  private _pendingWheelOffsetY;
35
35
  private _pendingWheelFrameId;
36
+ private _scrollGeneration;
37
+ private readonly _selectionScrollTimers;
38
+ private _pendingWheelFrameSubscription;
39
+ private _pendingWheelSheetId;
36
40
  constructor(_context: IRenderContext<Workbook>, _injector: Injector, _sheetSkeletonManagerService: SheetSkeletonManagerService, _contextService: IContextService, _commandService: ICommandService, _renderManagerService: IRenderManagerService, _scrollManagerService: SheetScrollManagerService);
41
+ private _getSheetType;
37
42
  private _wheelEventListener;
43
+ private _queueWheelScroll;
44
+ private _cancelPendingWheelScroll;
38
45
  private _flushPendingWheelScroll;
39
46
  private _canUseScrollFastPath;
40
47
  private _markSceneDirtyForScrolling;
41
48
  private _scrollBarEventListener;
49
+ private _cancelPendingScroll;
50
+ private _getActiveGridSkeleton;
42
51
  private _initSkeletonListener;
43
52
  _smoothScrollToViewportPos(params: {
44
53
  viewportMain: Viewport;
@@ -14,8 +14,10 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { Workbook } from '@univerjs/core';
17
+ import type { ISetArrayFormulaDataMutationParams } from '@univerjs/engine-formula';
17
18
  import type { IRenderContext, IRenderModule, ISummaryMetric } from '@univerjs/engine-render';
18
19
  import { ICommandService, IConfigService, RxDisposable } from '@univerjs/core';
20
+ import { FormulaDataModel } from '@univerjs/engine-formula';
19
21
  import { ITelemetryService } from '@univerjs/telemetry';
20
22
  import { SheetSkeletonManagerService } from '../../services/sheet-skeleton-manager.service';
21
23
  import { SheetsRenderService } from '../../services/sheets-render.service';
@@ -33,9 +35,13 @@ export declare class SheetRenderController extends RxDisposable implements IRend
33
35
  private readonly _sheetRenderService;
34
36
  private readonly _commandService;
35
37
  private readonly _telemetryService?;
38
+ private readonly _formulaDataModel?;
39
+ private _arrayFormulaSheets;
40
+ private _hadEmbeddedArrayData;
36
41
  private _renderMetric$;
37
42
  renderMetric$: import("rxjs").Observable<ITelemetryData>;
38
- constructor(_context: IRenderContext<Workbook>, _configService: IConfigService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _sheetRenderService: SheetsRenderService, _commandService: ICommandService, _telemetryService?: ITelemetryService | undefined);
43
+ constructor(_context: IRenderContext<Workbook>, _configService: IConfigService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _sheetRenderService: SheetsRenderService, _commandService: ICommandService, _telemetryService?: ITelemetryService | undefined, _formulaDataModel?: FormulaDataModel | undefined);
44
+ private _getSheetType;
39
45
  private _addNewRender;
40
46
  private _renderFrameTimeMetric;
41
47
  private _renderFrameTags;
@@ -60,6 +66,7 @@ export declare class SheetRenderController extends RxDisposable implements IRend
60
66
  * +-----------------+--------------------+-------------------+
61
67
  */
62
68
  private _addViewport;
69
+ private _initWorksheetVisibility;
63
70
  private _initRerenderScheduler;
64
71
  private _initCommandListener;
65
72
  private _markUnitDirty;
@@ -74,6 +81,7 @@ export declare class SheetRenderController extends RxDisposable implements IRend
74
81
  private _markViewportDirty;
75
82
  private _spreadsheetViewports;
76
83
  }
84
+ export declare function getArrayFormulaSheetIds(unitId: string, params: Pick<ISetArrayFormulaDataMutationParams, 'arrayFormulaCellData' | 'arrayFormulaRange'>): Set<string>;
77
85
  export declare function getLeftTopPlaceholderSize(skeleton: {
78
86
  rowHeaderWidth: number;
79
87
  columnHeaderHeight: number;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import type { Workbook } from '@univerjs/core';
17
17
  import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
18
- import { Disposable, ICommandService, IContextService } from '@univerjs/core';
18
+ import { BooleanNumber, Disposable, ICommandService, IContextService } from '@univerjs/core';
19
19
  import { IEditorBridgeService } from '../../services/editor-bridge.service';
20
20
  import { SheetSkeletonManagerService } from '../../services/sheet-skeleton-manager.service';
21
21
  /**
@@ -28,10 +28,10 @@ export declare class SheetsZoomRenderController extends Disposable implements IR
28
28
  private readonly _contextService;
29
29
  private readonly _editorBridgeService?;
30
30
  constructor(_context: IRenderContext<Workbook>, _sheetSkeletonManagerService: SheetSkeletonManagerService, _commandService: ICommandService, _contextService: IContextService, _editorBridgeService?: IEditorBridgeService | undefined);
31
- updateZoom(worksheetId: string, zoomRatio: number): boolean;
31
+ updateZoom(worksheetId: string, zoomRatio: number, zoomToFit?: BooleanNumber): boolean;
32
32
  private _initZoomEventListener;
33
33
  private _zoom;
34
- private _initSkeletonListener;
34
+ private _initWorksheetListener;
35
35
  /**
36
36
  * Triggered when zoom and switch sheet.
37
37
  * @param zoomRatio
@@ -176,6 +176,10 @@ export interface IFWorksheetUIMixin {
176
176
  getSkeleton(): Nullable<SpreadsheetSkeleton>;
177
177
  /**
178
178
  * Sets the width of all columns starting at the given column position to fit their contents.
179
+ *
180
+ * To resize multiple consecutive columns, pass the full `numColumns` in one call
181
+ * instead of repeatedly calling this method with the default count of one.
182
+ *
179
183
  * @param {number} startColumn - The position of the first column to resize. index starts at 0.
180
184
  * @param {number} [numColumns] - The number of columns to auto-resize. Default is 1.
181
185
  * @returns {FWorksheet} - The FWorksheet instance for chaining.
@@ -192,6 +196,10 @@ export interface IFWorksheetUIMixin {
192
196
  autoResizeColumns(startColumn: number, numColumns?: number): FWorksheet;
193
197
  /**
194
198
  * Sets the height of all rows starting at the given row position to fit their contents.
199
+ *
200
+ * To resize multiple consecutive rows, pass the full `numRows` in one call
201
+ * instead of repeatedly calling this method with the default count of one.
202
+ *
195
203
  * @param {number} startRow - The position of the first row to resize. index starts at 0.
196
204
  * @param {number} [numRows] - The number of rows to auto-resize. Default is 1.
197
205
  * @returns {FWorksheet} - The FWorksheet instance for chaining.
@@ -363,7 +363,6 @@ declare const locale: {
363
363
  EditExtraObject: string;
364
364
  };
365
365
  dialog: {
366
- emptyList: string;
367
366
  allowedPermissionType: string;
368
367
  alert: string;
369
368
  search: string;
@@ -372,6 +371,10 @@ declare const locale: {
372
371
  alertContent: string;
373
372
  userEmpty: string;
374
373
  listEmpty: string;
374
+ listEmptyDescription: string;
375
+ candidatesEmpty: string;
376
+ searchEmpty: string;
377
+ searchEmptyDescription: string;
375
378
  commonErr: string;
376
379
  editErr: string;
377
380
  pasteErr: string;
@@ -385,6 +388,7 @@ declare const locale: {
385
388
  confirm: string;
386
389
  cancel: string;
387
390
  addNewPermission: string;
391
+ clearSearch: string;
388
392
  };
389
393
  };
390
394
  };
@@ -36,7 +36,7 @@ export declare function getCurrentExclusiveRangeInterest$(accessor: IAccessor, d
36
36
  * @returns {Observable<boolean>} The observable combine with exclusive range
37
37
  */
38
38
  export declare function getObservableWithExclusiveRange$(accessor: IAccessor, observable$: Observable<boolean>, disableGroupSet?: Set<string>): Observable<boolean>;
39
- export declare function getCurrentRangeDisable$(accessor: IAccessor, permissionTypes?: IPermissionTypes, supportCellEdit?: boolean): Observable<boolean>;
39
+ export declare function getCurrentRangeDisable$(accessor: IAccessor, permissionTypes?: IPermissionTypes, supportCellEdit?: boolean, supportShapeText?: boolean): Observable<boolean>;
40
40
  export declare function getBaseRangeMenuHidden$(accessor: IAccessor): Observable<boolean>;
41
41
  export declare function getInsertAfterMenuHidden$(accessor: IAccessor, type: 'row' | 'col'): Observable<boolean>;
42
42
  export declare function getInsertBeforeMenuHidden$(accessor: IAccessor, type: 'row' | 'col'): Observable<boolean>;
@@ -30,6 +30,7 @@ export interface ICanvasPopup extends Omit<IPopup, 'anchorRect' | 'anchorRect$'
30
30
  }
31
31
  interface IPopupMenuItem {
32
32
  label: string;
33
+ icon?: string;
33
34
  index: number;
34
35
  commandId: string;
35
36
  commandParams: ICommandInfo['params'];
@@ -16,11 +16,11 @@
16
16
  import type { ICellDataWithSpanAndDisplay, IDisposable, IRange, Nullable } from '@univerjs/core';
17
17
  import type { IDiscreteRange, ISheetRangeLocation } from '@univerjs/sheets';
18
18
  import type { Observable } from 'rxjs';
19
- import type { ICopyOptions, IPasteHookKeyType, IPasteOptionCache, ISheetClipboardHook } from './type';
20
19
  import { Disposable, ErrorService, ICommandService, ILogService, Injector, IUndoRedoService, IUniverInstanceService, LocaleService, ObjectMatrix, ThemeService } from '@univerjs/core';
21
20
  import { IRenderManagerService } from '@univerjs/engine-render';
22
21
  import { SheetsSelectionsService } from '@univerjs/sheets';
23
22
  import { IClipboardInterfaceService, INotificationService, IPlatformService } from '@univerjs/ui';
23
+ import type { ICopyOptions, IPasteHookKeyType, IPasteOptionCache, ISheetClipboardHook } from './type';
24
24
  import { IMarkSelectionService } from '../mark-selection/mark-selection.service';
25
25
  import { CopyContentCache } from './copy-content-cache';
26
26
  export declare const PREDEFINED_HOOK_NAME_COPY: {
@@ -15,9 +15,9 @@
15
15
  */
16
16
  import type { ITextStyle, Nullable } from '@univerjs/core';
17
17
  import type { ISheetSkeletonManagerParam } from '@univerjs/sheets';
18
+ import { getNumfmtParseValueFilter } from '@univerjs/core';
18
19
  import type { IClipboardPropertyItem, IUniverSheetCopyDataModel } from '../type';
19
20
  import type { IPastePlugin } from './paste-plugins/type';
20
- import { getNumfmtParseValueFilter } from '@univerjs/core';
21
21
  export interface IStyleRule {
22
22
  filter: string | string[] | ((node: HTMLElement) => boolean);
23
23
  getStyle(node: HTMLElement): ITextStyle;
@@ -145,9 +145,10 @@ export interface ISheetClipboardHook {
145
145
  * Features could use this hook to build copying cache or any other pre-copy jobs.
146
146
  *
147
147
  * @param pasteTo
148
+ * @param payload Paste options and the internal copy ID, when available.
148
149
  * @returns if it block copying it should return false
149
150
  */
150
- onBeforePaste?(pasteTo: ISheetDiscreteRangeLocation): boolean;
151
+ onBeforePaste?(pasteTo: ISheetDiscreteRangeLocation, payload?: ICopyPastePayload): boolean;
151
152
  /**
152
153
  * Handles pasting cells, it needs to return Undo Mutations & Redo Mutations that handle the cell contents
153
154
  *
@@ -81,6 +81,10 @@ export interface IEditorBridgeService {
81
81
  * Do not use it directly. Use the `SetCellEditVisibleOperation` command instead.
82
82
  */
83
83
  changeVisible(param: IEditorBridgeServiceVisibleParam): void;
84
+ /**
85
+ * Mark the open editor content as pending submission. Besides user edits, an external write that
86
+ * replaces the edited cell's content is marked too, so the draft still wins when editing ends.
87
+ */
84
88
  changeEditorDirty(dirtyStatus: boolean): void;
85
89
  getEditorDirty(): boolean;
86
90
  isVisible(): IEditorBridgeServiceVisibleParam;
@@ -163,6 +167,7 @@ export declare class EditorBridgeService extends Disposable implements IEditorBr
163
167
  isInArrayFormulaRange: Nullable<boolean>;
164
168
  isPercentFormat: boolean | undefined;
165
169
  } | undefined;
170
+ private _getSheetType;
166
171
  private _getWorkbookForEditUnit;
167
172
  getCurrentEditorId(): string;
168
173
  changeVisible(params: IEditorBridgeServiceVisibleParam): void;
@@ -141,6 +141,7 @@ export declare class HoverManagerService extends Disposable {
141
141
  */
142
142
  triggerClick(unitId: string, offsetX: number, offsetY: number): void;
143
143
  triggerDbClick(unitId: string, event: IPointerEvent | IMouseEvent): void;
144
+ triggerMouseLeave(): void;
144
145
  triggerScroll(): void;
145
146
  triggerRowHeaderClick(unitId: string, offsetX: number, offsetY: number): void;
146
147
  triggerColHeaderClick(unitId: string, offsetX: number, offsetY: number): void;
@@ -141,7 +141,7 @@ export declare class SheetScrollManagerService implements IRenderModule {
141
141
  viewportScrollX: number;
142
142
  viewportScrollY: number;
143
143
  };
144
- setSearchParam(param: IScrollStateSearchParam): void;
144
+ setSearchParam(param: Nullable<IScrollStateSearchParam>): void;
145
145
  getScrollStateByParam(param: IScrollStateSearchParam): Readonly<Nullable<IScrollState>>;
146
146
  getCurrentScrollState(): Readonly<IScrollState>;
147
147
  setValidScrollState(param: IScrollStateWithSearchParam): void;
@@ -19,10 +19,10 @@ import type { ISelectionStyle, ISelectionWithCoord, ISelectionWithStyle } from '
19
19
  import type { Theme } from '@univerjs/themes';
20
20
  import type { IShortcutService } from '@univerjs/ui';
21
21
  import type { Observable, Subscription } from 'rxjs';
22
- import type { SheetSkeletonManagerService } from '../sheet-skeleton-manager.service';
23
22
  import { Disposable, InterceptorManager, RANGE_TYPE, ThemeService } from '@univerjs/core';
24
23
  import { ScrollTimer, ScrollTimerType } from '@univerjs/engine-render';
25
24
  import { BehaviorSubject, Subject } from 'rxjs';
25
+ import type { SheetSkeletonManagerService } from '../sheet-skeleton-manager.service';
26
26
  import { SelectionControl } from './selection-control';
27
27
  export interface IControlFillConfig {
28
28
  oldRange: IRange;
@@ -161,6 +161,7 @@ export declare class BaseSelectionRenderService extends Disposable implements IS
161
161
  * @param {ISelectionWithCoord} selectionWithStyle
162
162
  */
163
163
  protected _addSelectionControlByModelData(selectionWithStyle: ISelectionWithStyle): SelectionControl;
164
+ protected _clearRuntime(): void;
164
165
  protected _clearAllSelectionControls(): void;
165
166
  protected _getFreeze(): Nullable<IFreeze>;
166
167
  protected _getViewportByCell(row?: number, column?: number): Nullable<Viewport>;
@@ -16,7 +16,7 @@
16
16
  import type { Nullable, Workbook } from '@univerjs/core';
17
17
  import type { IMouseEvent, IPointerEvent, IRenderContext, IRenderModule, Scene, SpreadsheetSkeleton, Viewport } from '@univerjs/engine-render';
18
18
  import type { ISelectionWithStyle } from '@univerjs/sheets';
19
- import { ICommandService, IContextService, ILogService, Injector, RANGE_TYPE, ThemeService } from '@univerjs/core';
19
+ import { ICommandService, IContextService, ILogService, Injector, IUniverInstanceService, RANGE_TYPE, ThemeService } from '@univerjs/core';
20
20
  import { ScrollTimerType } from '@univerjs/engine-render';
21
21
  import { SheetsSelectionsService } from '@univerjs/sheets';
22
22
  import { IShortcutService } from '@univerjs/ui';
@@ -40,14 +40,19 @@ export declare class MobileSheetsSelectionRenderService extends BaseSelectionRen
40
40
  private readonly _commandService;
41
41
  protected readonly _contextService: IContextService;
42
42
  private readonly _scrollManagerService;
43
+ private readonly _univerInstanceService;
43
44
  private readonly _workbookSelections;
44
45
  private _renderDisposable;
45
46
  _expandingSelection: boolean;
46
47
  protected _selectionControls: MobileSelectionControl[];
47
48
  expandingControlMode: ExpandingControl;
48
49
  private _anchorCellForExpanding;
49
- constructor(_context: IRenderContext<Workbook>, injector: Injector, themeService: ThemeService, shortcutService: IShortcutService, selectionManagerService: SheetsSelectionsService, sheetSkeletonManagerService: SheetSkeletonManagerService, _logService: ILogService, _commandService: ICommandService, _contextService: IContextService, _scrollManagerService: SheetScrollManagerService);
50
+ constructor(_context: IRenderContext<Workbook>, injector: Injector, themeService: ThemeService, shortcutService: IShortcutService, selectionManagerService: SheetsSelectionsService, sheetSkeletonManagerService: SheetSkeletonManagerService, _logService: ILogService, _commandService: ICommandService, _contextService: IContextService, _scrollManagerService: SheetScrollManagerService, _univerInstanceService: IUniverInstanceService);
51
+ private _getSheetType;
50
52
  private _init;
53
+ endSelection(): void;
54
+ protected _clearRuntime(): void;
55
+ private _clearExpansionState;
51
56
  private _initSkeletonChangeListener;
52
57
  private _initSelectionChangeListener;
53
58
  private _initEventListeners;
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import type { Nullable, Workbook } from '@univerjs/core';
17
17
  import type { IMouseEvent, IPointerEvent, IRenderContext, IRenderModule, Viewport } from '@univerjs/engine-render';
18
+ import type { ISelectionWithStyle } from '@univerjs/sheets';
18
19
  import { ICommandService, IContextService, ILogService, Injector, RANGE_TYPE, ThemeService } from '@univerjs/core';
19
20
  import { ScrollTimerType } from '@univerjs/engine-render';
20
21
  import { SheetsSelectionsService } from '@univerjs/sheets';
@@ -34,6 +35,7 @@ export declare class SheetSelectionRenderService extends BaseSelectionRenderServ
34
35
  private _renderDisposable;
35
36
  private _selectionBeforeModifierClick;
36
37
  constructor(_context: IRenderContext<Workbook>, injector: Injector, themeService: ThemeService, shortcutService: IShortcutService, selectionManagerService: SheetsSelectionsService, sheetSkeletonManagerService: SheetSkeletonManagerService, _logService: ILogService, _commandService: ICommandService, _contextService: IContextService);
38
+ private _getSheetType;
37
39
  private _init;
38
40
  dispose(): void;
39
41
  private _initEventListeners;
@@ -63,6 +65,7 @@ export declare class SheetSelectionRenderService extends BaseSelectionRenderServ
63
65
  private _initSkeletonChangeListener;
64
66
  private _getActiveViewport;
65
67
  private _getSheetObject;
68
+ resetSelectionsByModelData(selections: readonly ISelectionWithStyle[]): void;
66
69
  /**
67
70
  * Handle pointer down event, bind pointermove & pointerup handler.
68
71
  * then trigger selectionMoveStart$.
@@ -38,6 +38,14 @@ export declare class SheetSkeletonManagerService extends Disposable implements I
38
38
  readonly currentSkeletonBefore$: import("rxjs").Observable<Nullable<ISheetSkeletonManagerParam>>;
39
39
  constructor(_context: IRenderContext<Workbook>, _sheetSkeletonService: SheetSkeletonService);
40
40
  private _initSkeletonsRegisterGetCellHeight;
41
+ /**
42
+ * Keep the tracked skeleton on the active worksheet once the tracked one is gone.
43
+ *
44
+ * Removing a worksheet disposes its skeleton and drops its param immediately, while `_sheetId` is only
45
+ * updated by the next skeleton-change command. That leaves the manager pointing at a dead sheet for the
46
+ * whole `RemoveSheetCommand` redo sequence, so consumers either read a disposed skeleton or nothing at all.
47
+ */
48
+ private _initActiveSheetSync;
41
49
  dispose(): void;
42
50
  getCurrentSkeleton(): Nullable<SpreadsheetSkeleton>;
43
51
  /**
@@ -25,6 +25,7 @@ export declare class SheetsRenderService extends RxDisposable {
25
25
  private readonly _renderManagerService;
26
26
  private readonly _themeService;
27
27
  private _skeletonChangeMutations;
28
+ private readonly _selfRenderingMutations;
28
29
  constructor(_contextService: IContextService, _instanceSrv: IUniverInstanceService, _renderManagerService: IRenderManagerService, _themeService: ThemeService);
29
30
  /**
30
31
  * Register a mutation id that will trigger the skeleton change.
@@ -37,6 +38,9 @@ export declare class SheetsRenderService extends RxDisposable {
37
38
  * Examine if a mutation would make the skeleton to change.
38
39
  */
39
40
  checkMutationShouldTriggerRerender(id: string): boolean;
41
+ /** The owning plugin must invalidate the affected sheets when its derived view changes. */
42
+ registerSelfRenderingMutations(mutationId: string): IDisposable;
43
+ shouldAutomaticallyRenderMutation(mutationId: string): boolean;
40
44
  private _init;
41
45
  private _initWorkbookListener;
42
46
  private _createRenderer;
@@ -32,6 +32,7 @@ export declare abstract class RangeProtectionRenderExtension extends SheetExtens
32
32
  protected _shadowStrategy: 'always' | 'non-editable' | 'non-viewable' | 'none';
33
33
  constructor(_themeService: ThemeService, shadowStrategy?: 'always' | 'non-editable' | 'non-viewable' | 'none');
34
34
  clearCache(): void;
35
+ dispose(): void;
35
36
  /**
36
37
  * Set the shadow strategy for this extension
37
38
  * @param strategy The shadow strategy
@@ -45,11 +46,13 @@ export declare abstract class RangeProtectionRenderExtension extends SheetExtens
45
46
  draw(ctx: UniverRenderingContext, _parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges?: IRange[]): void;
46
47
  }
47
48
  export declare class RangeProtectionCanViewRenderExtension extends RangeProtectionRenderExtension {
49
+ readonly viewportCacheReusable: boolean;
48
50
  uKey: string;
49
51
  Z_INDEX: number;
50
52
  protected shouldRender(config: ICellPermission): boolean;
51
53
  }
52
54
  export declare class RangeProtectionCanNotViewRenderExtension extends RangeProtectionRenderExtension {
55
+ readonly viewportCacheReusable: boolean;
53
56
  uKey: string;
54
57
  Z_INDEX: number;
55
58
  protected shouldRender(config: ICellPermission): boolean;
@@ -19,6 +19,7 @@ import { SheetExtension } from '@univerjs/engine-render';
19
19
  export declare const worksheetProtectionKey = "worksheet-protection";
20
20
  export declare class WorksheetProtectionRenderExtension extends SheetExtension {
21
21
  private readonly _themeService;
22
+ readonly viewportCacheReusable: boolean;
22
23
  uKey: string;
23
24
  Z_INDEX: number;
24
25
  private _pattern;
@@ -26,6 +27,7 @@ export declare class WorksheetProtectionRenderExtension extends SheetExtension {
26
27
  protected _shadowStrategy: 'always' | 'non-editable' | 'non-viewable' | 'none';
27
28
  constructor(_themeService: ThemeService, shadowStrategy?: 'always' | 'non-editable' | 'non-viewable' | 'none');
28
29
  draw(ctx: UniverRenderingContext, _parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton): false | undefined;
30
+ dispose(): void;
29
31
  /**
30
32
  * Set the shadow strategy for this extension
31
33
  * @param strategy The shadow strategy
@@ -20,6 +20,7 @@ export interface IStartSheetTabNameEditorParams {
20
20
  setEditMode: (editing: boolean) => void;
21
21
  beforeCommit: () => void;
22
22
  onCommit: (name: string, event: FocusEvent) => void;
23
+ onCancel: () => void;
23
24
  }
24
25
  export declare function keepLastTextIndex(inputHtml: HTMLElement): void;
25
26
  export declare function keepTextSelected(inputHtml: HTMLElement): void;