@univerjs/sheets-ui 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -489,11 +489,13 @@ var BaseSelectionRenderService = class extends Disposable {
489
489
  }
490
490
  newSelectionControl(scene, skeleton, selection) {
491
491
  const zIndex = this.getSelectionControls().length;
492
- const { rowHeaderWidth, columnHeaderHeight } = skeleton;
492
+ const { rowHeaderWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeight, columnHeaderHeightAndMarginTop } = skeleton;
493
493
  const control = new SelectionControl(scene, zIndex, this._selectionTheme, {
494
494
  highlightHeader: this._highlightHeader,
495
495
  rowHeaderWidth,
496
- columnHeaderHeight
496
+ columnHeaderHeight,
497
+ rowHeaderOffsetX: Math.max(0, rowHeaderWidthAndMarginLeft - rowHeaderWidth),
498
+ columnHeaderOffsetY: Math.max(0, columnHeaderHeightAndMarginTop - columnHeaderHeight)
497
499
  });
498
500
  this._selectionControls.push(control);
499
501
  const selectionWithCoord = attachSelectionWithCoord(selection, skeleton);
@@ -1779,7 +1781,7 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = .3;
1779
1781
  */
1780
1782
  var SelectionControl = class extends Disposable {
1781
1783
  constructor(_scene, _zIndex, _themeService, options) {
1782
- var _options$enableAutoFi, _options$highlightHea, _options$rowHeaderWid, _options$columnHeader;
1784
+ var _options$enableAutoFi, _options$highlightHea, _options$rowHeaderWid, _options$columnHeader, _options$rowHeaderOff, _options$columnHeader2;
1783
1785
  super();
1784
1786
  this._scene = _scene;
1785
1787
  this._zIndex = _zIndex;
@@ -1818,6 +1820,8 @@ var SelectionControl = class extends Disposable {
1818
1820
  _defineProperty(this, "_currentStyle", void 0);
1819
1821
  _defineProperty(this, "_rowHeaderWidth", 0);
1820
1822
  _defineProperty(this, "_columnHeaderHeight", 0);
1823
+ _defineProperty(this, "_rowHeaderOffsetX", 0);
1824
+ _defineProperty(this, "_columnHeaderOffsetY", 0);
1821
1825
  _defineProperty(this, "_widgetRects", []);
1822
1826
  _defineProperty(this, "_controlExtension", void 0);
1823
1827
  _defineProperty(this, "_dispose$", new BehaviorSubject(this));
@@ -1835,6 +1839,8 @@ var SelectionControl = class extends Disposable {
1835
1839
  this._highlightHeader = (_options$highlightHea = options === null || options === void 0 ? void 0 : options.highlightHeader) !== null && _options$highlightHea !== void 0 ? _options$highlightHea : true;
1836
1840
  this._rowHeaderWidth = (_options$rowHeaderWid = options === null || options === void 0 ? void 0 : options.rowHeaderWidth) !== null && _options$rowHeaderWid !== void 0 ? _options$rowHeaderWid : 0;
1837
1841
  this._columnHeaderHeight = (_options$columnHeader = options === null || options === void 0 ? void 0 : options.columnHeaderHeight) !== null && _options$columnHeader !== void 0 ? _options$columnHeader : 0;
1842
+ this._rowHeaderOffsetX = (_options$rowHeaderOff = options === null || options === void 0 ? void 0 : options.rowHeaderOffsetX) !== null && _options$rowHeaderOff !== void 0 ? _options$rowHeaderOff : 0;
1843
+ this._columnHeaderOffsetY = (_options$columnHeader2 = options === null || options === void 0 ? void 0 : options.columnHeaderOffsetY) !== null && _options$columnHeader2 !== void 0 ? _options$columnHeader2 : 0;
1838
1844
  this._initializeSheetBody();
1839
1845
  this._initialHeader();
1840
1846
  }
@@ -2199,6 +2205,8 @@ var SelectionControl = class extends Disposable {
2199
2205
  if (sk) {
2200
2206
  this._rowHeaderWidth = sk.rowHeaderWidth;
2201
2207
  this._columnHeaderHeight = sk.columnHeaderHeight;
2208
+ this._rowHeaderOffsetX = Math.max(0, sk.rowHeaderWidthAndMarginLeft - sk.rowHeaderWidth);
2209
+ this._columnHeaderOffsetY = Math.max(0, sk.columnHeaderHeightAndMarginTop - sk.columnHeaderHeight);
2202
2210
  }
2203
2211
  this._selectionRenderModel.setValue(selectionWthCoord.rangeWithCoord, selectionWthCoord.primaryWithCoord);
2204
2212
  this._showAutoFill = selectionWthCoord.primaryWithCoord !== null;
@@ -2219,6 +2227,8 @@ var SelectionControl = class extends Disposable {
2219
2227
  update(newSelectionRange, rowHeaderWidth = 0, columnHeaderHeight = 0, style, primaryCell) {
2220
2228
  this._rowHeaderWidth = rowHeaderWidth;
2221
2229
  this._columnHeaderHeight = columnHeaderHeight;
2230
+ this._rowHeaderOffsetX = 0;
2231
+ this._columnHeaderOffsetY = 0;
2222
2232
  this.updateRangeBySelectionWithCoord({
2223
2233
  rangeWithCoord: newSelectionRange,
2224
2234
  primaryWithCoord: primaryCell,
@@ -2338,6 +2348,8 @@ var SelectionControl = class extends Disposable {
2338
2348
  columnHeaderStrokeWidth /= scale;
2339
2349
  const rowHeaderWidth = this._rowHeaderWidth;
2340
2350
  const columnHeaderHeight = this._columnHeaderHeight;
2351
+ const rowHeaderOffsetX = this._rowHeaderOffsetX;
2352
+ const columnHeaderOffsetY = this._columnHeaderOffsetY;
2341
2353
  if (this._highlightHeader && columnHeaderHeight > 0) {
2342
2354
  let highlightTitleColor = columnHeaderFill;
2343
2355
  if (rangeType === RANGE_TYPE.COLUMN) highlightTitleColor = new ColorKit(stroke).setAlpha(SELECTION_TITLE_HIGHLIGHT_ALPHA).toString();
@@ -2350,7 +2362,7 @@ var SelectionControl = class extends Disposable {
2350
2362
  top: columnHeaderHeight - columnHeaderStrokeWidth + 1 / scale
2351
2363
  });
2352
2364
  this._columnHeaderGroup.show();
2353
- this._columnHeaderGroup.translate(startX, 0);
2365
+ this._columnHeaderGroup.translate(startX, columnHeaderOffsetY);
2354
2366
  } else this._columnHeaderGroup.hide();
2355
2367
  this._columnHeaderGroup.makeDirty(true);
2356
2368
  if (this._highlightHeader && rowHeaderWidth > 0) {
@@ -2365,7 +2377,7 @@ var SelectionControl = class extends Disposable {
2365
2377
  left: rowHeaderWidth - rowHeaderStrokeWidth + 1 / scale
2366
2378
  });
2367
2379
  this._rowHeaderGroup.show();
2368
- this._rowHeaderGroup.translate(0, startY);
2380
+ this._rowHeaderGroup.translate(rowHeaderOffsetX, startY);
2369
2381
  } else this._rowHeaderGroup.hide();
2370
2382
  this._rowHeaderGroup.makeDirty(true);
2371
2383
  }
@@ -2579,7 +2591,7 @@ let MarkSelectionService = class MarkSelectionService extends Disposable {
2579
2591
  }
2580
2592
  addShape(selection, exits = [], zIndex = DEFAULT_Z_INDEX) {
2581
2593
  var _workbook$getActiveSh;
2582
- const workbook = this._currentService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
2594
+ const workbook = this._currentService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
2583
2595
  const subUnitId = (_workbook$getActiveSh = workbook.getActiveSheet()) === null || _workbook$getActiveSh === void 0 ? void 0 : _workbook$getActiveSh.getSheetId();
2584
2596
  if (!subUnitId) return null;
2585
2597
  const id = generateRandomId();
@@ -2597,7 +2609,7 @@ let MarkSelectionService = class MarkSelectionService extends Disposable {
2597
2609
  }
2598
2610
  addShapeWithNoFresh(selection, exits = [], zIndex = DEFAULT_Z_INDEX) {
2599
2611
  var _workbook$getActiveSh2;
2600
- const workbook = this._currentService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
2612
+ const workbook = this._currentService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
2601
2613
  const subUnitId = (_workbook$getActiveSh2 = workbook.getActiveSheet()) === null || _workbook$getActiveSh2 === void 0 ? void 0 : _workbook$getActiveSh2.getSheetId();
2602
2614
  if (!subUnitId) return null;
2603
2615
  const id = generateRandomId();
@@ -2613,7 +2625,7 @@ let MarkSelectionService = class MarkSelectionService extends Disposable {
2613
2625
  }
2614
2626
  refreshShapes() {
2615
2627
  var _currentSheet$getActi;
2616
- const currentSheet = this._currentService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
2628
+ const currentSheet = this._currentService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
2617
2629
  if (!currentSheet) return;
2618
2630
  const currentUnitId = currentSheet.getUnitId();
2619
2631
  const currentSubUnitId = (_currentSheet$getActi = currentSheet.getActiveSheet()) === null || _currentSheet$getActi === void 0 ? void 0 : _currentSheet$getActi.getSheetId();
@@ -2705,10 +2717,6 @@ function cloneCellDataWithSpanInfo(cell) {
2705
2717
  //#endregion
2706
2718
  //#region src/services/clipboard/copy-content-cache.ts
2707
2719
  const COPY_CONTENT_CACHE_LIMIT = 10;
2708
- const ID_LENGTH = 6;
2709
- function genId() {
2710
- return generateRandomId(ID_LENGTH);
2711
- }
2712
2720
  function extractId(html) {
2713
2721
  const match = html.match(/data-copy-id="([^\s]+)"/);
2714
2722
  if (match && match[1]) return match[1];
@@ -4035,7 +4043,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
4035
4043
  async copy(options) {
4036
4044
  const selection = this._selectionManagerService.getCurrentLastSelection();
4037
4045
  if (!selection) return false;
4038
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
4046
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
4039
4047
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
4040
4048
  if (!workbook || !worksheet) return false;
4041
4049
  const workbookId = workbook.getUnitId();
@@ -4196,7 +4204,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
4196
4204
  rowIndex += 1;
4197
4205
  }
4198
4206
  for (let c = startColumn; c <= endColumn; c++) discreteRange.cols.push(c);
4199
- const copyId = genId();
4207
+ const copyId = generateRandomId(6);
4200
4208
  const html = this._usmToHtml.convert(matrix, discreteRange, hooks, copyId);
4201
4209
  return {
4202
4210
  copyId,
@@ -4248,7 +4256,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
4248
4256
  });
4249
4257
  const result = redoMutationsInfo.every((m) => this._commandService.executeCommand(m.id, m.params));
4250
4258
  if (result) this._undoRedoService.pushUndoRedo({
4251
- unitID: this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(),
4259
+ unitID: this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getUnitId(),
4252
4260
  undoMutations: undoMutationsInfo,
4253
4261
  redoMutations: redoMutationsInfo
4254
4262
  });
@@ -4595,7 +4603,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
4595
4603
  };
4596
4604
  }
4597
4605
  _getPastingTarget() {
4598
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
4606
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
4599
4607
  const worksheet = workbook.getActiveSheet();
4600
4608
  const selection = this._selectionManagerService.getCurrentLastSelection();
4601
4609
  return {
@@ -4657,7 +4665,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
4657
4665
  const { startRow, startColumn, endRow, endColumn } = vRange;
4658
4666
  const destinationRows = endRow - startRow + 1;
4659
4667
  const destinationColumns = endColumn - startColumn + 1;
4660
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
4668
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
4661
4669
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
4662
4670
  if (!worksheet) return null;
4663
4671
  const mergedCellsInRange = worksheet.getMergeData().filter((rect) => discreteRange.rows.includes(rect.startRow) && discreteRange.cols.includes(rect.startColumn));
@@ -4797,7 +4805,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
4797
4805
  * @param range
4798
4806
  */
4799
4807
  _topLeftCellsMatch(rowCount, colCount, range) {
4800
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
4808
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
4801
4809
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
4802
4810
  if (!worksheet) return false;
4803
4811
  const { topRow, leftCol } = range;
@@ -5998,7 +6006,7 @@ const DeleteRangeProtectionFromContextMenuCommand = {
5998
6006
  const undoRedoService = accessor.get(IUndoRedoService);
5999
6007
  const selectionManagerService = accessor.get(SheetsSelectionsService);
6000
6008
  const worksheetRuleModel = accessor.get(WorksheetProtectionRuleModel);
6001
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
6009
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
6002
6010
  const worksheet = workbook.getActiveSheet();
6003
6011
  const unitId = workbook.getUnitId();
6004
6012
  const subUnitId = worksheet.getSheetId();
@@ -6049,7 +6057,7 @@ const SetRangeProtectionFromContextMenuCommand = {
6049
6057
  const univerInstanceService = accessor.get(IUniverInstanceService);
6050
6058
  const selectionManagerService = accessor.get(SheetsSelectionsService);
6051
6059
  const worksheetRuleModel = accessor.get(WorksheetProtectionRuleModel);
6052
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
6060
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
6053
6061
  const worksheet = workbook.getActiveSheet();
6054
6062
  const unitId = workbook.getUnitId();
6055
6063
  const subUnitId = worksheet.getSheetId();
@@ -6970,7 +6978,7 @@ function isRenderManagerService(renderManagerService) {
6970
6978
  * Get render objects of a spreadsheet.
6971
6979
  */
6972
6980
  function getSheetObject(univerInstanceService, renderManagerService) {
6973
- const workbook = univerInstanceService instanceof Workbook ? univerInstanceService : univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
6981
+ const workbook = univerInstanceService instanceof Workbook ? univerInstanceService : univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
6974
6982
  if (!workbook) return null;
6975
6983
  const unitId = workbook.getUnitId();
6976
6984
  let components, mainComponent, scene, engine;
@@ -7522,7 +7530,7 @@ const ScrollToCellCommand = {
7522
7530
  type: CommandType.COMMAND,
7523
7531
  handler: (accessor, params) => {
7524
7532
  const instanceService = accessor.get(IUniverInstanceService);
7525
- return accessor.get(IRenderManagerService).getRenderById(instanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId()).with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
7533
+ return accessor.get(IRenderManagerService).getRenderById(instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getUnitId()).with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
7526
7534
  }
7527
7535
  };
7528
7536
  /**
@@ -8132,7 +8140,7 @@ const DeleteWorksheetProtectionFormSheetBarCommand = {
8132
8140
  const commandService = accessor.get(ICommandService);
8133
8141
  const undoRedoService = accessor.get(IUndoRedoService);
8134
8142
  const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);
8135
- const workbook = accessor.get(IUniverInstanceService).getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
8143
+ const workbook = accessor.get(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
8136
8144
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
8137
8145
  const unitId = workbook.getUnitId();
8138
8146
  if (!worksheet) return false;
@@ -8219,7 +8227,7 @@ const SetCellEditVisibleOperation = {
8219
8227
  if (!params) return false;
8220
8228
  if (((_configService$getCon = accessor.get(IConfigService).getConfig("sheets-ui.config")) === null || _configService$getCon === void 0 ? void 0 : _configService$getCon.disableEdit) && params.visible) return false;
8221
8229
  const { unitId } = params;
8222
- const workbook = accessor.get(IUniverInstanceService).getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
8230
+ const workbook = accessor.get(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
8223
8231
  if (!workbook) return false;
8224
8232
  accessor.get(IEditorBridgeService).changeVisible({
8225
8233
  ...params,
@@ -8233,7 +8241,7 @@ const SetCellEditVisibleWithF2Operation = {
8233
8241
  type: CommandType.OPERATION,
8234
8242
  handler: (accessor, params) => {
8235
8243
  const commandService = accessor.get(ICommandService);
8236
- const workbook = accessor.get(IUniverInstanceService).getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
8244
+ const workbook = accessor.get(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
8237
8245
  if (!workbook) return false;
8238
8246
  return commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
8239
8247
  ...params,
@@ -8273,7 +8281,7 @@ const ScrollToRangeOperation = {
8273
8281
  handler: (accessor, params) => {
8274
8282
  if (!params) return false;
8275
8283
  const instanceService = accessor.get(IUniverInstanceService);
8276
- return accessor.get(IRenderManagerService).getRenderById(instanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId()).with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
8284
+ return accessor.get(IRenderManagerService).getRenderById(instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getUnitId()).with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
8277
8285
  }
8278
8286
  };
8279
8287
 
@@ -8848,7 +8856,7 @@ let AutoHeightController = class AutoHeightController extends Disposable {
8848
8856
  }
8849
8857
  getUndoRedoParamsOfAutoHeight(ranges, subUnitIdParam, currentCellHeights) {
8850
8858
  const { _univerInstanceService: univerInstanceService } = this;
8851
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
8859
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
8852
8860
  const unitId = workbook.getUnitId();
8853
8861
  let worksheet = workbook.getActiveSheet();
8854
8862
  let subUnitId = worksheet.getSheetId();
@@ -10400,7 +10408,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
10400
10408
  _initialCursorSync(d) {
10401
10409
  d.add(this._cellEditorManagerService.focus$.pipe(filter((f) => !!f)).subscribe(() => {
10402
10410
  var _this$_renderManagerS2;
10403
- const currentDoc = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
10411
+ const currentDoc = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
10404
10412
  if (!currentDoc) return;
10405
10413
  const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.getRenderById(currentDoc === null || currentDoc === void 0 ? void 0 : currentDoc.getUnitId())) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSelectionRenderService);
10406
10414
  if (!docSelectionRenderManager) return;
@@ -11766,7 +11774,7 @@ let SheetClipboardController = class SheetClipboardController extends RxDisposab
11766
11774
  id: PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_BESIDES_BORDER,
11767
11775
  specialPasteInfo: { label: "specialPaste.besidesBorder" },
11768
11776
  onPasteCells: (pasteFrom, pasteTo, matrix, payload) => {
11769
- self._instanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
11777
+ self._instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
11770
11778
  const redoMutationsInfo = [];
11771
11779
  const undoMutationsInfo = [];
11772
11780
  const { range, unitId, subUnitId } = pasteTo;
@@ -11885,7 +11893,7 @@ let DragManagerService = class DragManagerService extends Disposable {
11885
11893
  }));
11886
11894
  }
11887
11895
  _calcActiveCell(offsetX, offsetY) {
11888
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
11896
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
11889
11897
  if (!workbook) return null;
11890
11898
  const worksheet = workbook.getActiveSheet();
11891
11899
  if (!worksheet) return;
@@ -14488,7 +14496,7 @@ let HeaderResizeRenderController = class HeaderResizeRenderController extends Di
14488
14496
  var _this$_sheetSkeletonM;
14489
14497
  const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
14490
14498
  if (skeleton == null || this._rowResizeRect == null || this._columnResizeRect == null) return;
14491
- const { rowHeaderWidth, columnHeaderHeight } = skeleton;
14499
+ const { rowBaseWidth, rowGutterWidth, columnBaseHeight, columnGutterHeight } = getHeaderBaseLayout$1(skeleton);
14492
14500
  const { startX, startY, endX, endY, row, column } = getCoordByOffset(evt.offsetX, evt.offsetY, scene, skeleton);
14493
14501
  const isLastRow = row === skeleton.worksheet.getRowCount() - 1;
14494
14502
  const isLastColumn = column === skeleton.worksheet.getColumnCount() - 1;
@@ -14508,9 +14516,9 @@ let HeaderResizeRenderController = class HeaderResizeRenderController extends Di
14508
14516
  }
14509
14517
  if (this._currentRow === -1) return;
14510
14518
  if (!this.interceptor.fetchThroughInterceptors(HEADER_RESIZE_PERMISSION_CHECK)(null, { row: this._currentRow })) return false;
14511
- const rowSize = Math.min(44, rowHeaderWidth / 3);
14519
+ const rowSize = Math.min(44, rowBaseWidth / 3);
14512
14520
  this._rowResizeRect.transformByState({
14513
- left: rowHeaderWidth / 2 - rowSize / 2,
14521
+ left: rowGutterWidth + rowBaseWidth / 2 - rowSize / 2,
14514
14522
  top
14515
14523
  });
14516
14524
  this._rowResizeRect.setShapeProps({ size: rowSize });
@@ -14528,10 +14536,10 @@ let HeaderResizeRenderController = class HeaderResizeRenderController extends Di
14528
14536
  }
14529
14537
  if (this._currentColumn === -1) return;
14530
14538
  if (!this.interceptor.fetchThroughInterceptors(HEADER_RESIZE_PERMISSION_CHECK)(null, { col: this._currentColumn })) return false;
14531
- const columnSize = columnHeaderHeight * .7;
14539
+ const columnSize = columnBaseHeight * .7;
14532
14540
  this._columnResizeRect.transformByState({
14533
14541
  left,
14534
- top: columnHeaderHeight / 2 - columnSize / 2
14542
+ top: columnGutterHeight + columnBaseHeight / 2 - columnSize / 2
14535
14543
  });
14536
14544
  this._columnResizeRect.setShapeProps({ size: columnSize });
14537
14545
  this._columnResizeRect.show();
@@ -14576,9 +14584,9 @@ let HeaderResizeRenderController = class HeaderResizeRenderController extends Di
14576
14584
  let isStartMove = false;
14577
14585
  let moveChangeX = 0;
14578
14586
  let moveChangeY = 0;
14579
- const { columnTotalWidth, rowHeaderWidth, rowTotalHeight, columnHeaderHeight } = skeleton;
14580
- const shapeWidth = canvasMaxWidth > columnTotalWidth + rowHeaderWidth ? canvasMaxWidth : columnTotalWidth + rowHeaderWidth;
14581
- const shapeHeight = canvasMaxHeight > rowTotalHeight + columnHeaderHeight ? canvasMaxHeight : rowTotalHeight + columnHeaderHeight;
14587
+ const { columnTotalWidth, rowHeaderWidthAndMarginLeft, rowTotalHeight, columnHeaderHeightAndMarginTop } = skeleton;
14588
+ const shapeWidth = canvasMaxWidth > columnTotalWidth + rowHeaderWidthAndMarginLeft ? canvasMaxWidth : columnTotalWidth + rowHeaderWidthAndMarginLeft;
14589
+ const shapeHeight = canvasMaxHeight > rowTotalHeight + columnHeaderHeightAndMarginTop ? canvasMaxHeight : rowTotalHeight + columnHeaderHeightAndMarginTop;
14582
14590
  const HEADER_MENU_SHAPE_THUMB_SIZE_SCALE = 4 / Math.max(scaleX, scaleY);
14583
14591
  if (initialType === 0) this._resizeHelperShape = new Rect(HEADER_RESIZE_CONTROLLER_SHAPE_HELPER, {
14584
14592
  width: shapeWidth,
@@ -14711,208 +14719,580 @@ HeaderResizeRenderController = __decorate([
14711
14719
  __decorateParam(2, Inject(SheetsSelectionsService)),
14712
14720
  __decorateParam(3, ICommandService)
14713
14721
  ], HeaderResizeRenderController);
14722
+ function getHeaderBaseLayout$1(skeleton) {
14723
+ var _skeleton$worksheet$g, _skeleton$worksheet, _config$rowHeader, _config$columnHeader;
14724
+ const config = (_skeleton$worksheet$g = (_skeleton$worksheet = skeleton.worksheet).getConfig) === null || _skeleton$worksheet$g === void 0 ? void 0 : _skeleton$worksheet$g.call(_skeleton$worksheet);
14725
+ const configuredRowWidth = config === null || config === void 0 || (_config$rowHeader = config.rowHeader) === null || _config$rowHeader === void 0 ? void 0 : _config$rowHeader.width;
14726
+ const configuredColumnHeight = config === null || config === void 0 || (_config$columnHeader = config.columnHeader) === null || _config$columnHeader === void 0 ? void 0 : _config$columnHeader.height;
14727
+ const rowBaseWidth = typeof configuredRowWidth === "number" && configuredRowWidth > 0 ? Math.min(configuredRowWidth, skeleton.rowHeaderWidth) : skeleton.rowHeaderWidth;
14728
+ const columnBaseHeight = typeof configuredColumnHeight === "number" && configuredColumnHeight > 0 ? Math.min(configuredColumnHeight, skeleton.columnHeaderHeight) : skeleton.columnHeaderHeight;
14729
+ return {
14730
+ rowBaseWidth,
14731
+ rowGutterWidth: Math.max(0, skeleton.rowHeaderWidthAndMarginLeft - rowBaseWidth),
14732
+ columnBaseHeight,
14733
+ columnGutterHeight: Math.max(0, skeleton.columnHeaderHeightAndMarginTop - columnBaseHeight)
14734
+ };
14735
+ }
14714
14736
 
14715
14737
  //#endregion
14716
- //#region src/controllers/render-controllers/sheet.render-controller.ts
14717
- const FRAME_STACK_THRESHOLD = 60;
14718
- let SheetRenderController = class SheetRenderController extends RxDisposable {
14719
- constructor(_context, _configService, _sheetSkeletonManagerService, _sheetRenderService, _commandService, _telemetryService) {
14720
- super();
14721
- this._context = _context;
14722
- this._configService = _configService;
14723
- this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
14724
- this._sheetRenderService = _sheetRenderService;
14725
- this._commandService = _commandService;
14726
- this._telemetryService = _telemetryService;
14727
- _defineProperty(this, "_renderMetric$", new Subject());
14728
- _defineProperty(this, "renderMetric$", this._renderMetric$.asObservable());
14729
- _defineProperty(this, "_renderFrameTimeMetric", null);
14730
- _defineProperty(this, "_renderFrameTags", {});
14731
- _defineProperty(this, "_afterRenderMetric$", new Subject());
14732
- this._addNewRender();
14733
- this._initRenderMetricSubscriber();
14738
+ //#region src/services/header-unhide-range.service.ts
14739
+ let HeaderUnhideRangeAxis = /* @__PURE__ */ function(HeaderUnhideRangeAxis) {
14740
+ HeaderUnhideRangeAxis["ROW"] = "row";
14741
+ HeaderUnhideRangeAxis["COLUMN"] = "column";
14742
+ return HeaderUnhideRangeAxis;
14743
+ }({});
14744
+ var HeaderUnhideRangeService = class {
14745
+ constructor() {
14746
+ _defineProperty(this, "_visibleHandlers", /* @__PURE__ */ new Set());
14734
14747
  }
14735
- _addNewRender() {
14736
- const { scene, engine, unit: workbook } = this._context;
14737
- this._addComponent(workbook);
14738
- this._initRerenderScheduler();
14739
- this._initCommandListener();
14740
- const worksheet = this._context.unit.getActiveSheet();
14741
- if (!worksheet) throw new Error("No active sheet found");
14742
- const sheetId = worksheet.getSheetId();
14743
- this._sheetSkeletonManagerService.setCurrent({ sheetId });
14744
- const frameFn = () => scene.render();
14745
- this.disposeWithMe(this._context.activated$.subscribe((activated) => {
14746
- if (activated) engine.runRenderLoop(frameFn);
14747
- else engine.stopRenderLoop(frameFn);
14748
- }));
14748
+ registerRangeVisibleHandler(handler) {
14749
+ this._visibleHandlers.add(handler);
14750
+ const dispose = () => this._visibleHandlers.delete(handler);
14751
+ return {
14752
+ dispose,
14753
+ unsubscribe: dispose
14754
+ };
14749
14755
  }
14750
- _initRenderMetricSubscriber() {
14751
- const { engine } = this._context;
14752
- this.disposeWithMe(engine.beginFrame$.subscribe(() => {
14753
- this._renderFrameTimeMetric = null;
14754
- this._renderFrameTags = {};
14755
- }));
14756
- this.disposeWithMe(engine.endFrame$.subscribe(() => {
14757
- if (this._renderFrameTimeMetric && Object.keys(this._renderFrameTimeMetric).filter((key) => key.startsWith(SHEET_EXTENSION_PREFIX)).length > 0) this._afterRenderMetric$.next({
14758
- frameTimeMetric: this._renderFrameTimeMetric,
14759
- tags: this._renderFrameTags
14760
- });
14761
- }));
14762
- this.disposeWithMe(engine.renderFrameTimeMetric$.subscribe(([key, value]) => {
14763
- if (!this._renderFrameTimeMetric) this._renderFrameTimeMetric = {};
14764
- if (!this._renderFrameTimeMetric[key]) this._renderFrameTimeMetric[key] = [];
14765
- this._renderFrameTimeMetric[key].push(Math.round(value * 100) / 100);
14766
- }));
14767
- this.disposeWithMe(engine.renderFrameTags$.subscribe(([key, value]) => {
14768
- this._renderFrameTags[key] = value;
14769
- }));
14770
- const frameInfoList = [];
14771
- this.disposeWithMe(this._afterRenderMetric$.pipe(withLatestFrom(engine.endFrame$)).subscribe(([sceneRenderDetail, basicFrameTimeInfo]) => {
14772
- frameInfoList.push({
14773
- FPS: basicFrameTimeInfo.FPS,
14774
- elapsedTime: basicFrameTimeInfo.elapsedTime,
14775
- frameTime: Math.round(basicFrameTimeInfo.frameTime * 100) / 100,
14776
- ...sceneRenderDetail.frameTimeMetric,
14777
- ...sceneRenderDetail.tags
14778
- });
14779
- if (frameInfoList.length > FRAME_STACK_THRESHOLD) {
14780
- this._captureRenderMetric(frameInfoList);
14781
- frameInfoList.length = 0;
14782
- }
14783
- }));
14756
+ shouldRenderRange(visible, payload) {
14757
+ let nextVisible = visible;
14758
+ for (const handler of this._visibleHandlers) nextVisible = handler(nextVisible, payload);
14759
+ return nextVisible;
14784
14760
  }
14785
- /**
14786
- * Send render metric to telemetry service
14787
- * @param frameInfoList
14788
- */
14789
- _captureRenderMetric(frameInfoList) {
14790
- var _this$_telemetryServi;
14791
- const filteredFrameInfo = frameInfoList;
14792
- if (filteredFrameInfo.length === 0) return;
14793
- const sumValueForNumListFields = (data) => {
14794
- let totalSum = 0;
14795
- const sums = Object.entries(data).filter(([_, value]) => Array.isArray(value)).map(([key]) => key).reduce((acc, key) => {
14796
- acc[key] = data[key].reduce((sum, num) => sum + num, 0);
14797
- return acc;
14798
- }, {});
14799
- Object.keys(data).filter((key) => key.startsWith(SHEET_EXTENSION_PREFIX)).forEach((key) => {
14800
- totalSum += sums[key];
14801
- });
14802
- return {
14803
- ...sums,
14804
- extensionTotal: totalSum
14805
- };
14806
- };
14807
- const frameTimeListAfterSum = frameInfoList.map((info) => {
14808
- return {
14809
- ...info,
14810
- ...sumValueForNumListFields(info)
14811
- };
14812
- });
14813
- const getSummaryStats = (list) => {
14814
- return Object.entries(list[0]).filter(([key, _]) => !["elapsedTime"].includes(key)).filter(([_, value]) => typeof value === "number").map(([key]) => key).reduce((acc, key) => {
14815
- const values = list.map((obj) => obj[key]);
14816
- const max = Math.max(...values);
14817
- const min = Math.min(...values);
14818
- const avg = values.reduce((sum, val) => sum + val, 0) / values.length;
14819
- acc[key] = {
14820
- max: Math.round(max * 100) / 100,
14821
- min: Math.round(min * 100) / 100,
14822
- avg: Math.round(avg * 100) / 100
14823
- };
14824
- return acc;
14825
- }, {});
14826
- };
14827
- const summaryFrameStats = getSummaryStats(frameTimeListAfterSum);
14828
- const elapsedTimeToStart = filteredFrameInfo[filteredFrameInfo.length - 1].elapsedTime;
14829
- const telemetryData = {
14830
- sheetId: this._context.unit.getActiveSheet().getSheetId(),
14831
- unitId: this._context.unit.getUnitId(),
14832
- elapsedTimeToStart,
14833
- ...summaryFrameStats
14834
- };
14835
- this._renderMetric$.next(telemetryData);
14836
- (_this$_telemetryServi = this._telemetryService) === null || _this$_telemetryServi === void 0 || _this$_telemetryServi.capture("sheet_render_cost", telemetryData);
14761
+ };
14762
+
14763
+ //#endregion
14764
+ //#region src/menu/header-menu-shape.ts
14765
+ const HEADER_MENU_SHAPE_CIRCLE_FILL = "rgba(0, 0, 0, 0.15)";
14766
+ const HEADER_MENU_SHAPE_TRIANGLE_FILL = "rgb(0, 0, 0)";
14767
+ const HEADER_MENU_BACKGROUND_COLOR = "rgb(255, 255, 255, 1)";
14768
+ var HeaderMenuShape = class extends Shape {
14769
+ constructor(key, props) {
14770
+ super(key, props);
14771
+ _defineProperty(this, "_size", 12);
14772
+ _defineProperty(this, "_iconRatio", .4);
14773
+ _defineProperty(this, "_mode", 0);
14774
+ this.setShapeProps(props);
14837
14775
  }
14838
- _addComponent(workbook) {
14839
- const { scene, components } = this._context;
14840
- const worksheet = workbook.getActiveSheet();
14841
- const spreadsheet = new Spreadsheet("__SpreadsheetRender__");
14842
- this._addViewport(worksheet);
14843
- const spreadsheetRowHeader = new SpreadsheetRowHeader("__SpreadsheetRowHeader__");
14844
- const spreadsheetColumnHeader = new SpreadsheetColumnHeader("__SpreadsheetColumnHeader__");
14845
- const SpreadsheetLeftTopPlaceholder = new Rect("__SpreadsheetLeftTopPlaceholder__", {
14846
- zIndex: 2,
14847
- left: -1,
14848
- top: -1,
14849
- fill: "rgb(248, 249, 250)",
14850
- stroke: "rgb(217, 217, 217)",
14851
- strokeWidth: 1
14776
+ setShapeProps(props) {
14777
+ if (props === null || props === void 0 ? void 0 : props.size) this._size = props.size;
14778
+ if (props === null || props === void 0 ? void 0 : props.mode) this._mode = props.mode;
14779
+ this.transformByState({
14780
+ width: this._size,
14781
+ height: this._size
14852
14782
  });
14853
- this._context.mainComponent = spreadsheet;
14854
- components.set("__SpreadsheetRender__", spreadsheet);
14855
- components.set("__SpreadsheetRowHeader__", spreadsheetRowHeader);
14856
- components.set("__SpreadsheetColumnHeader__", spreadsheetColumnHeader);
14857
- components.set("__SpreadsheetLeftTopPlaceholder__", SpreadsheetLeftTopPlaceholder);
14858
- scene.addObjects([spreadsheet], 0);
14859
- scene.addObjects([
14860
- spreadsheetRowHeader,
14861
- spreadsheetColumnHeader,
14862
- SpreadsheetLeftTopPlaceholder
14863
- ], 10);
14864
- scene.enableLayerCache(0, 10);
14865
14783
  }
14866
- _initViewports(scene, rowHeader, columnHeader) {
14867
- const rowHeaderWidth = rowHeader.hidden ? 0 : rowHeader.width;
14868
- const columnHeaderHeight = columnHeader.hidden ? 0 : columnHeader.height;
14869
- const bufferEdgeX = 100;
14870
- const bufferEdgeY = 100;
14871
- const viewMain = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN, scene, {
14872
- left: rowHeaderWidth,
14873
- top: columnHeaderHeight,
14874
- bottom: 0,
14875
- right: 0,
14876
- isWheelPreventDefaultX: true,
14877
- allowCache: true,
14878
- bufferEdgeX,
14879
- bufferEdgeY
14880
- });
14881
- const viewMainLeftTop = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP, scene, {
14882
- isWheelPreventDefaultX: true,
14883
- active: false,
14884
- allowCache: true,
14885
- bufferEdgeX: 0,
14886
- bufferEdgeY: 0
14887
- });
14888
- const viewMainLeft = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT, scene, {
14889
- isWheelPreventDefaultX: true,
14890
- active: false,
14891
- allowCache: true,
14892
- bufferEdgeX: 0,
14893
- bufferEdgeY
14894
- });
14895
- const viewMainTop = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP, scene, {
14896
- isWheelPreventDefaultX: true,
14897
- active: false,
14898
- allowCache: true,
14899
- bufferEdgeX,
14900
- bufferEdgeY: 0
14901
- });
14902
- const viewRowTop = new Viewport(SHEET_VIEWPORT_KEY.VIEW_ROW_TOP, scene, {
14903
- active: false,
14904
- isWheelPreventDefaultX: true
14784
+ _draw(ctx) {
14785
+ if (this._mode === 1) Rect.drawWith(ctx, {
14786
+ width: this._size,
14787
+ height: this._size,
14788
+ radius: this._size,
14789
+ fill: HEADER_MENU_SHAPE_CIRCLE_FILL
14905
14790
  });
14906
- const viewRowBottom = new Viewport(SHEET_VIEWPORT_KEY.VIEW_ROW_BOTTOM, scene, {
14907
- left: 0,
14908
- top: columnHeaderHeight,
14909
- bottom: 0,
14910
- width: rowHeaderWidth + 1,
14911
- isWheelPreventDefaultX: true
14791
+ const iconSize = this._size * .5 * this._iconRatio;
14792
+ const sixtyDegree = Math.PI / 180 * 60;
14793
+ const left = iconSize * Math.sin(sixtyDegree);
14794
+ const top = iconSize * Math.cos(sixtyDegree);
14795
+ RegularPolygon.drawWith(ctx, {
14796
+ pointsGroup: [[
14797
+ {
14798
+ x: -left + this._size / 2,
14799
+ y: -top + this._size / 2
14800
+ },
14801
+ {
14802
+ x: left + this._size / 2,
14803
+ y: -top + this._size / 2
14804
+ },
14805
+ {
14806
+ x: this._size / 2,
14807
+ y: iconSize + this._size / 2
14808
+ }
14809
+ ]],
14810
+ fill: HEADER_MENU_SHAPE_TRIANGLE_FILL
14912
14811
  });
14913
- const viewColumnLeft = new Viewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_LEFT, scene, {
14914
- active: false,
14915
- isWheelPreventDefaultX: true
14812
+ }
14813
+ };
14814
+
14815
+ //#endregion
14816
+ //#region src/views/header-unhide-shape.ts
14817
+ const UNHIDE_ICON_SIZE = 12;
14818
+ const UNHIDE_ARROW_RATIO = .4;
14819
+ var HeaderUnhideShape = class extends Shape {
14820
+ constructor(key, props, onClick) {
14821
+ super(key, props);
14822
+ _defineProperty(this, "_size", 12);
14823
+ _defineProperty(this, "_iconRatio", UNHIDE_ARROW_RATIO);
14824
+ _defineProperty(this, "_hovered", true);
14825
+ _defineProperty(this, "_hasPrevious", true);
14826
+ _defineProperty(this, "_hasNext", true);
14827
+ _defineProperty(this, "_unhideType", void 0);
14828
+ if (props) this.setShapeProps(props);
14829
+ this.onPointerEnter$.subscribeEvent(() => this.setShapeProps({ hovered: true }));
14830
+ this.onPointerLeave$.subscribeEvent(() => this.setShapeProps({ hovered: false }));
14831
+ this.onPointerDown$.subscribeEvent(() => onClick === null || onClick === void 0 ? void 0 : onClick());
14832
+ }
14833
+ setShapeProps(props) {
14834
+ if (props.type !== void 0) this._unhideType = props.type;
14835
+ if (props.hovered !== void 0) this._hovered = props.hovered;
14836
+ if (props.hasPrevious !== void 0) this._hasPrevious = props.hasPrevious;
14837
+ if (props.hasNext !== void 0) this._hasNext = props.hasNext;
14838
+ this.transformByState({
14839
+ width: this._size * (this._unhideType === 1 ? 2 : 1),
14840
+ height: this._size * (this._unhideType === 0 ? 2 : 1)
14841
+ });
14842
+ }
14843
+ _draw(ctx) {
14844
+ if (this._unhideType === 0) this._drawOnRow(ctx);
14845
+ else this._drawOnCol(ctx);
14846
+ }
14847
+ _drawOnRow(ctx) {
14848
+ if (this._hovered) if (!this._hasNext || !this._hasPrevious) Rect.drawWith(ctx, {
14849
+ width: this._size,
14850
+ height: this._size,
14851
+ stroke: HEADER_MENU_SHAPE_TRIANGLE_FILL,
14852
+ fill: HEADER_MENU_BACKGROUND_COLOR
14853
+ });
14854
+ else Rect.drawWith(ctx, {
14855
+ width: this._size,
14856
+ height: 2 * this._size,
14857
+ stroke: HEADER_MENU_SHAPE_TRIANGLE_FILL,
14858
+ fill: HEADER_MENU_BACKGROUND_COLOR
14859
+ });
14860
+ const iconSize = this._size * .5 * this._iconRatio;
14861
+ const sixtyDegree = Math.PI / 3;
14862
+ const top = iconSize * Math.cos(sixtyDegree);
14863
+ const left = iconSize * Math.sin(sixtyDegree);
14864
+ if (this._hasPrevious) RegularPolygon.drawWith(ctx, {
14865
+ pointsGroup: [[
14866
+ {
14867
+ x: this._size / 2,
14868
+ y: this._size / 2 - left
14869
+ },
14870
+ {
14871
+ x: this._size / 2 - left,
14872
+ y: this._size / 2 + top
14873
+ },
14874
+ {
14875
+ x: this._size / 2 + left,
14876
+ y: this._size / 2 + top
14877
+ }
14878
+ ]],
14879
+ fill: HEADER_MENU_SHAPE_TRIANGLE_FILL
14880
+ });
14881
+ if (this._hasNext) {
14882
+ const offset = this._hasPrevious ? 3 : 1;
14883
+ RegularPolygon.drawWith(ctx, {
14884
+ pointsGroup: [[
14885
+ {
14886
+ x: this._size / 2,
14887
+ y: this._size * offset / 2 + left
14888
+ },
14889
+ {
14890
+ x: this._size / 2 - left,
14891
+ y: this._size * offset / 2 - top
14892
+ },
14893
+ {
14894
+ x: this._size / 2 + left,
14895
+ y: this._size * offset / 2 - top
14896
+ }
14897
+ ]],
14898
+ fill: HEADER_MENU_SHAPE_TRIANGLE_FILL
14899
+ });
14900
+ }
14901
+ }
14902
+ /**
14903
+ *
14904
+ * @param ctx
14905
+ */
14906
+ _drawOnCol(ctx) {
14907
+ if (this._hovered) if (!this._hasNext || !this._hasPrevious) Rect.drawWith(ctx, {
14908
+ width: this._size,
14909
+ height: this._size,
14910
+ stroke: HEADER_MENU_SHAPE_TRIANGLE_FILL,
14911
+ fill: HEADER_MENU_BACKGROUND_COLOR
14912
+ });
14913
+ else Rect.drawWith(ctx, {
14914
+ width: 2 * this._size,
14915
+ height: this._size,
14916
+ stroke: HEADER_MENU_SHAPE_TRIANGLE_FILL,
14917
+ fill: HEADER_MENU_BACKGROUND_COLOR
14918
+ });
14919
+ const iconSize = this._size * .5 * this._iconRatio;
14920
+ const sixtyDegree = Math.PI / 3;
14921
+ const top = iconSize * Math.cos(sixtyDegree);
14922
+ const left = iconSize * Math.sin(sixtyDegree);
14923
+ if (this._hasPrevious) RegularPolygon.drawWith(ctx, {
14924
+ pointsGroup: [[
14925
+ {
14926
+ x: -top + this._size / 2,
14927
+ y: this._size / 2
14928
+ },
14929
+ {
14930
+ x: this._size / 2 + left,
14931
+ y: this._size / 2 - left
14932
+ },
14933
+ {
14934
+ x: this._size / 2 + left,
14935
+ y: this._size / 2 + left
14936
+ }
14937
+ ]],
14938
+ fill: HEADER_MENU_SHAPE_TRIANGLE_FILL
14939
+ });
14940
+ if (this._hasNext) {
14941
+ const offset = this._hasPrevious ? 3 : 1;
14942
+ RegularPolygon.drawWith(ctx, {
14943
+ pointsGroup: [[
14944
+ {
14945
+ x: top + this._size * offset / 2,
14946
+ y: this._size / 2
14947
+ },
14948
+ {
14949
+ x: -left + this._size * offset / 2,
14950
+ y: this._size / 2 - left
14951
+ },
14952
+ {
14953
+ x: -left + this._size * offset / 2,
14954
+ y: this._size / 2 + left
14955
+ }
14956
+ ]],
14957
+ fill: HEADER_MENU_SHAPE_TRIANGLE_FILL
14958
+ });
14959
+ }
14960
+ }
14961
+ };
14962
+
14963
+ //#endregion
14964
+ //#region src/controllers/render-controllers/header-unhide.render-controller.ts
14965
+ const HEADER_UNHIDE_CONTROLLER_SHAPE = "__SpreadsheetHeaderUnhideSHAPEControllerShape__";
14966
+ const HEADER_UNHIDE_RANGE_VISIBLE_CHECK = createInterceptorKey("headerUnhideRangeVisibleCheck");
14967
+ let HeaderUnhideRenderController = class HeaderUnhideRenderController extends RxDisposable {
14968
+ get _workbook() {
14969
+ return this._context.unit;
14970
+ }
14971
+ constructor(_context, _sheetSkeletonManagerService, _headerUnhideRangeService, _commandService) {
14972
+ super();
14973
+ this._context = _context;
14974
+ this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
14975
+ this._headerUnhideRangeService = _headerUnhideRangeService;
14976
+ this._commandService = _commandService;
14977
+ _defineProperty(this, "_shapes", {
14978
+ cols: [],
14979
+ rows: []
14980
+ });
14981
+ _defineProperty(this, "interceptor", new InterceptorManager({ HEADER_UNHIDE_RANGE_VISIBLE_CHECK }));
14982
+ this._init();
14983
+ }
14984
+ dispose() {
14985
+ super.dispose();
14986
+ this._clearShapes();
14987
+ }
14988
+ _init() {
14989
+ let activeSheetId = "";
14990
+ this._context.unit.activeSheet$.pipe(takeUntil(this.dispose$)).subscribe((worksheet) => {
14991
+ this._clearShapes();
14992
+ if (!worksheet) {
14993
+ activeSheetId = "";
14994
+ return;
14995
+ }
14996
+ activeSheetId = worksheet.getSheetId();
14997
+ this._update(this._workbook, worksheet);
14998
+ });
14999
+ this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((param) => {
15000
+ if (param) {
15001
+ const { unitId, sheetId } = param;
15002
+ if (unitId === this._workbook.getUnitId() && sheetId === activeSheetId) {
15003
+ const worksheet = this._workbook.getSheetBySheetId(sheetId);
15004
+ if (worksheet) this._update(this._workbook, worksheet);
15005
+ }
15006
+ }
15007
+ }));
15008
+ }
15009
+ _update(workbook, worksheet) {
15010
+ var _this$_sheetSkeletonM;
15011
+ const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getSkeletonParam(worksheet.getSheetId())) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
15012
+ if (!skeleton) return;
15013
+ const visibleCheck = this.interceptor.fetchThroughInterceptors(HEADER_UNHIDE_RANGE_VISIBLE_CHECK);
15014
+ const shouldRenderRange = (payload) => {
15015
+ var _visibleCheck;
15016
+ return this._headerUnhideRangeService.shouldRenderRange((_visibleCheck = visibleCheck(true, payload)) !== null && _visibleCheck !== void 0 ? _visibleCheck : true, payload);
15017
+ };
15018
+ const hiddenRowRanges = worksheet.getHiddenRows().filter((range) => shouldRenderRange({
15019
+ axis: "row",
15020
+ range,
15021
+ workbook,
15022
+ worksheet
15023
+ }));
15024
+ const hiddenColRanges = worksheet.getHiddenCols().filter((range) => shouldRenderRange({
15025
+ axis: "column",
15026
+ range,
15027
+ workbook,
15028
+ worksheet
15029
+ }));
15030
+ const { scene } = this._getSheetObject();
15031
+ const rowCount = worksheet.getRowCount();
15032
+ const rowShapes = hiddenRowRanges.map((range) => {
15033
+ const { startRow, endRow } = range;
15034
+ const position = getCoordByCell(startRow, 0, scene, skeleton);
15035
+ const hasPrevious = startRow !== 0;
15036
+ const hasNext = endRow !== rowCount - 1;
15037
+ return new HeaderUnhideShape(HEADER_UNHIDE_CONTROLLER_SHAPE, {
15038
+ type: 0,
15039
+ hovered: false,
15040
+ hasPrevious,
15041
+ hasNext,
15042
+ top: position.startY - (hasPrevious ? 12 : 0),
15043
+ left: position.startX - 12
15044
+ }, () => this._commandService.executeCommand(SetSpecificRowsVisibleCommand.id, {
15045
+ unitId: workbook.getUnitId(),
15046
+ subUnitId: worksheet.getSheetId(),
15047
+ ranges: [range]
15048
+ }));
15049
+ });
15050
+ const colCount = worksheet.getColumnCount();
15051
+ const colShapes = hiddenColRanges.map((range) => {
15052
+ const { startColumn, endColumn } = range;
15053
+ const position = getCoordByCell(0, startColumn, scene, skeleton);
15054
+ const hasPrevious = startColumn !== 0;
15055
+ const hasNext = endColumn !== colCount - 1;
15056
+ return new HeaderUnhideShape(HEADER_UNHIDE_CONTROLLER_SHAPE, {
15057
+ type: 1,
15058
+ hovered: false,
15059
+ hasPrevious,
15060
+ hasNext,
15061
+ top: Math.max(skeleton.columnHeaderHeight, skeleton.columnHeaderHeightAndMarginTop) - 12,
15062
+ left: position.startX - (hasPrevious ? 12 : 0)
15063
+ }, () => this._commandService.executeCommand(SetSpecificColsVisibleCommand.id, {
15064
+ unitId: workbook.getUnitId(),
15065
+ subUnitId: worksheet.getSheetId(),
15066
+ ranges: [range]
15067
+ }));
15068
+ });
15069
+ scene.addObjects(colShapes, 12);
15070
+ scene.addObjects(rowShapes, 12);
15071
+ this._clearShapes();
15072
+ this._shapes = {
15073
+ cols: colShapes,
15074
+ rows: rowShapes
15075
+ };
15076
+ }
15077
+ _clearShapes() {
15078
+ this._shapes.cols.forEach((shape) => shape.dispose());
15079
+ this._shapes.rows.forEach((shape) => shape.dispose());
15080
+ this._shapes = {
15081
+ cols: [],
15082
+ rows: []
15083
+ };
15084
+ }
15085
+ _getSheetObject() {
15086
+ return getSheetObject(this._workbook, this._context);
15087
+ }
15088
+ };
15089
+ HeaderUnhideRenderController = __decorate([
15090
+ __decorateParam(1, Inject(SheetSkeletonManagerService)),
15091
+ __decorateParam(2, Inject(HeaderUnhideRangeService)),
15092
+ __decorateParam(3, ICommandService)
15093
+ ], HeaderUnhideRenderController);
15094
+
15095
+ //#endregion
15096
+ //#region src/controllers/render-controllers/sheet.render-controller.ts
15097
+ const FRAME_STACK_THRESHOLD = 60;
15098
+ let SheetRenderController = class SheetRenderController extends RxDisposable {
15099
+ constructor(_context, _configService, _sheetSkeletonManagerService, _sheetRenderService, _commandService, _telemetryService) {
15100
+ super();
15101
+ this._context = _context;
15102
+ this._configService = _configService;
15103
+ this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
15104
+ this._sheetRenderService = _sheetRenderService;
15105
+ this._commandService = _commandService;
15106
+ this._telemetryService = _telemetryService;
15107
+ _defineProperty(this, "_renderMetric$", new Subject());
15108
+ _defineProperty(this, "renderMetric$", this._renderMetric$.asObservable());
15109
+ _defineProperty(this, "_renderFrameTimeMetric", null);
15110
+ _defineProperty(this, "_renderFrameTags", {});
15111
+ _defineProperty(this, "_afterRenderMetric$", new Subject());
15112
+ this._addNewRender();
15113
+ this._initRenderMetricSubscriber();
15114
+ }
15115
+ _addNewRender() {
15116
+ const { scene, engine, unit: workbook } = this._context;
15117
+ this._addComponent(workbook);
15118
+ this._initRerenderScheduler();
15119
+ this._initCommandListener();
15120
+ const worksheet = this._context.unit.getActiveSheet();
15121
+ if (!worksheet) throw new Error("No active sheet found");
15122
+ const sheetId = worksheet.getSheetId();
15123
+ this._sheetSkeletonManagerService.setCurrent({ sheetId });
15124
+ const frameFn = () => scene.render();
15125
+ this.disposeWithMe(this._context.activated$.subscribe((activated) => {
15126
+ if (activated) engine.runRenderLoop(frameFn);
15127
+ else engine.stopRenderLoop(frameFn);
15128
+ }));
15129
+ }
15130
+ _initRenderMetricSubscriber() {
15131
+ const { engine } = this._context;
15132
+ this.disposeWithMe(engine.beginFrame$.subscribe(() => {
15133
+ this._renderFrameTimeMetric = null;
15134
+ this._renderFrameTags = {};
15135
+ }));
15136
+ this.disposeWithMe(engine.endFrame$.subscribe(() => {
15137
+ if (this._renderFrameTimeMetric && Object.keys(this._renderFrameTimeMetric).filter((key) => key.startsWith(SHEET_EXTENSION_PREFIX)).length > 0) this._afterRenderMetric$.next({
15138
+ frameTimeMetric: this._renderFrameTimeMetric,
15139
+ tags: this._renderFrameTags
15140
+ });
15141
+ }));
15142
+ this.disposeWithMe(engine.renderFrameTimeMetric$.subscribe(([key, value]) => {
15143
+ if (!this._renderFrameTimeMetric) this._renderFrameTimeMetric = {};
15144
+ if (!this._renderFrameTimeMetric[key]) this._renderFrameTimeMetric[key] = [];
15145
+ this._renderFrameTimeMetric[key].push(Math.round(value * 100) / 100);
15146
+ }));
15147
+ this.disposeWithMe(engine.renderFrameTags$.subscribe(([key, value]) => {
15148
+ this._renderFrameTags[key] = value;
15149
+ }));
15150
+ const frameInfoList = [];
15151
+ this.disposeWithMe(this._afterRenderMetric$.pipe(withLatestFrom(engine.endFrame$)).subscribe(([sceneRenderDetail, basicFrameTimeInfo]) => {
15152
+ frameInfoList.push({
15153
+ FPS: basicFrameTimeInfo.FPS,
15154
+ elapsedTime: basicFrameTimeInfo.elapsedTime,
15155
+ frameTime: Math.round(basicFrameTimeInfo.frameTime * 100) / 100,
15156
+ ...sceneRenderDetail.frameTimeMetric,
15157
+ ...sceneRenderDetail.tags
15158
+ });
15159
+ if (frameInfoList.length > FRAME_STACK_THRESHOLD) {
15160
+ this._captureRenderMetric(frameInfoList);
15161
+ frameInfoList.length = 0;
15162
+ }
15163
+ }));
15164
+ }
15165
+ /**
15166
+ * Send render metric to telemetry service
15167
+ * @param frameInfoList
15168
+ */
15169
+ _captureRenderMetric(frameInfoList) {
15170
+ var _this$_telemetryServi;
15171
+ const filteredFrameInfo = frameInfoList;
15172
+ if (filteredFrameInfo.length === 0) return;
15173
+ const sumValueForNumListFields = (data) => {
15174
+ let totalSum = 0;
15175
+ const sums = Object.entries(data).filter(([_, value]) => Array.isArray(value)).map(([key]) => key).reduce((acc, key) => {
15176
+ acc[key] = data[key].reduce((sum, num) => sum + num, 0);
15177
+ return acc;
15178
+ }, {});
15179
+ Object.keys(data).filter((key) => key.startsWith(SHEET_EXTENSION_PREFIX)).forEach((key) => {
15180
+ totalSum += sums[key];
15181
+ });
15182
+ return {
15183
+ ...sums,
15184
+ extensionTotal: totalSum
15185
+ };
15186
+ };
15187
+ const frameTimeListAfterSum = frameInfoList.map((info) => {
15188
+ return {
15189
+ ...info,
15190
+ ...sumValueForNumListFields(info)
15191
+ };
15192
+ });
15193
+ const getSummaryStats = (list) => {
15194
+ return Object.entries(list[0]).filter(([key, _]) => !["elapsedTime"].includes(key)).filter(([_, value]) => typeof value === "number").map(([key]) => key).reduce((acc, key) => {
15195
+ const values = list.map((obj) => obj[key]);
15196
+ const max = Math.max(...values);
15197
+ const min = Math.min(...values);
15198
+ const avg = values.reduce((sum, val) => sum + val, 0) / values.length;
15199
+ acc[key] = {
15200
+ max: Math.round(max * 100) / 100,
15201
+ min: Math.round(min * 100) / 100,
15202
+ avg: Math.round(avg * 100) / 100
15203
+ };
15204
+ return acc;
15205
+ }, {});
15206
+ };
15207
+ const summaryFrameStats = getSummaryStats(frameTimeListAfterSum);
15208
+ const elapsedTimeToStart = filteredFrameInfo[filteredFrameInfo.length - 1].elapsedTime;
15209
+ const telemetryData = {
15210
+ sheetId: this._context.unit.getActiveSheet().getSheetId(),
15211
+ unitId: this._context.unit.getUnitId(),
15212
+ elapsedTimeToStart,
15213
+ ...summaryFrameStats
15214
+ };
15215
+ this._renderMetric$.next(telemetryData);
15216
+ (_this$_telemetryServi = this._telemetryService) === null || _this$_telemetryServi === void 0 || _this$_telemetryServi.capture("sheet_render_cost", telemetryData);
15217
+ }
15218
+ _addComponent(workbook) {
15219
+ const { scene, components } = this._context;
15220
+ const worksheet = workbook.getActiveSheet();
15221
+ const spreadsheet = new Spreadsheet("__SpreadsheetRender__");
15222
+ this._addViewport(worksheet);
15223
+ const spreadsheetRowHeader = new SpreadsheetRowHeader("__SpreadsheetRowHeader__");
15224
+ const spreadsheetColumnHeader = new SpreadsheetColumnHeader("__SpreadsheetColumnHeader__");
15225
+ const SpreadsheetLeftTopPlaceholder = new Rect("__SpreadsheetLeftTopPlaceholder__", {
15226
+ zIndex: 2,
15227
+ left: -1,
15228
+ top: -1,
15229
+ fill: "rgb(248, 249, 250)",
15230
+ stroke: "rgb(217, 217, 217)",
15231
+ strokeWidth: 1
15232
+ });
15233
+ this._context.mainComponent = spreadsheet;
15234
+ components.set("__SpreadsheetRender__", spreadsheet);
15235
+ components.set("__SpreadsheetRowHeader__", spreadsheetRowHeader);
15236
+ components.set("__SpreadsheetColumnHeader__", spreadsheetColumnHeader);
15237
+ components.set("__SpreadsheetLeftTopPlaceholder__", SpreadsheetLeftTopPlaceholder);
15238
+ scene.addObjects([spreadsheet], 0);
15239
+ scene.addObjects([
15240
+ spreadsheetRowHeader,
15241
+ spreadsheetColumnHeader,
15242
+ SpreadsheetLeftTopPlaceholder
15243
+ ], 10);
15244
+ scene.enableLayerCache(0, 10);
15245
+ }
15246
+ _initViewports(scene, rowHeader, columnHeader) {
15247
+ const rowHeaderWidth = rowHeader.hidden ? 0 : rowHeader.width;
15248
+ const columnHeaderHeight = columnHeader.hidden ? 0 : columnHeader.height;
15249
+ const bufferEdgeX = 100;
15250
+ const bufferEdgeY = 100;
15251
+ const viewMain = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN, scene, {
15252
+ left: rowHeaderWidth,
15253
+ top: columnHeaderHeight,
15254
+ bottom: 0,
15255
+ right: 0,
15256
+ isWheelPreventDefaultX: true,
15257
+ allowCache: true,
15258
+ bufferEdgeX,
15259
+ bufferEdgeY
15260
+ });
15261
+ const viewMainLeftTop = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP, scene, {
15262
+ isWheelPreventDefaultX: true,
15263
+ active: false,
15264
+ allowCache: true,
15265
+ bufferEdgeX: 0,
15266
+ bufferEdgeY: 0
15267
+ });
15268
+ const viewMainLeft = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT, scene, {
15269
+ isWheelPreventDefaultX: true,
15270
+ active: false,
15271
+ allowCache: true,
15272
+ bufferEdgeX: 0,
15273
+ bufferEdgeY
15274
+ });
15275
+ const viewMainTop = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP, scene, {
15276
+ isWheelPreventDefaultX: true,
15277
+ active: false,
15278
+ allowCache: true,
15279
+ bufferEdgeX,
15280
+ bufferEdgeY: 0
15281
+ });
15282
+ const viewRowTop = new Viewport(SHEET_VIEWPORT_KEY.VIEW_ROW_TOP, scene, {
15283
+ active: false,
15284
+ isWheelPreventDefaultX: true
15285
+ });
15286
+ const viewRowBottom = new Viewport(SHEET_VIEWPORT_KEY.VIEW_ROW_BOTTOM, scene, {
15287
+ left: 0,
15288
+ top: columnHeaderHeight,
15289
+ bottom: 0,
15290
+ width: rowHeaderWidth + 1,
15291
+ isWheelPreventDefaultX: true
15292
+ });
15293
+ const viewColumnLeft = new Viewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_LEFT, scene, {
15294
+ active: false,
15295
+ isWheelPreventDefaultX: true
14916
15296
  });
14917
15297
  const viewColumnRight = new Viewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_RIGHT, scene, {
14918
15298
  left: rowHeaderWidth,
@@ -14971,13 +15351,13 @@ let SheetRenderController = class SheetRenderController extends RxDisposable {
14971
15351
  const spreadsheetRowHeader = components.get("__SpreadsheetRowHeader__");
14972
15352
  const spreadsheetColumnHeader = components.get("__SpreadsheetColumnHeader__");
14973
15353
  const spreadsheetLeftTopPlaceholder = components.get("__SpreadsheetLeftTopPlaceholder__");
14974
- const { rowHeaderWidth, columnHeaderHeight } = spreadsheetSkeleton;
15354
+ const leftTopPlaceholderSize = getLeftTopPlaceholderSize(spreadsheetSkeleton);
14975
15355
  spreadsheet === null || spreadsheet === void 0 || spreadsheet.updateSkeleton(spreadsheetSkeleton);
14976
15356
  spreadsheetRowHeader === null || spreadsheetRowHeader === void 0 || spreadsheetRowHeader.updateSkeleton(spreadsheetSkeleton);
14977
15357
  spreadsheetColumnHeader === null || spreadsheetColumnHeader === void 0 || spreadsheetColumnHeader.updateSkeleton(spreadsheetSkeleton);
14978
15358
  spreadsheetLeftTopPlaceholder === null || spreadsheetLeftTopPlaceholder === void 0 || spreadsheetLeftTopPlaceholder.transformByState({
14979
- width: rowHeaderWidth,
14980
- height: columnHeaderHeight
15359
+ width: leftTopPlaceholderSize.width,
15360
+ height: leftTopPlaceholderSize.height
14981
15361
  });
14982
15362
  }));
14983
15363
  }
@@ -15097,6 +15477,13 @@ SheetRenderController = __decorate([
15097
15477
  __decorateParam(4, ICommandService),
15098
15478
  __decorateParam(5, Optional(ITelemetryService))
15099
15479
  ], SheetRenderController);
15480
+ function getLeftTopPlaceholderSize(skeleton) {
15481
+ var _skeleton$rowHeaderWi, _skeleton$columnHeade;
15482
+ return {
15483
+ width: (_skeleton$rowHeaderWi = skeleton.rowHeaderWidthAndMarginLeft) !== null && _skeleton$rowHeaderWi !== void 0 ? _skeleton$rowHeaderWi : skeleton.rowHeaderWidth,
15484
+ height: (_skeleton$columnHeade = skeleton.columnHeaderHeightAndMarginTop) !== null && _skeleton$columnHeade !== void 0 ? _skeleton$columnHeade : skeleton.columnHeaderHeight
15485
+ };
15486
+ }
15100
15487
 
15101
15488
  //#endregion
15102
15489
  //#region src/components/border-panel/border-line/icons/BorderDashDot.tsx
@@ -16110,7 +16497,7 @@ function getBaseRangeMenuHidden$(accessor) {
16110
16497
  var _selectionManagerServ;
16111
16498
  const range = (_selectionManagerServ = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.range;
16112
16499
  if (!range) return true;
16113
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
16500
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
16114
16501
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
16115
16502
  if (!workbook || !worksheet) return true;
16116
16503
  const unitId = workbook.getUnitId();
@@ -16133,7 +16520,7 @@ function getInsertBeforeMenuHidden$(accessor, type) {
16133
16520
  var _selectionManagerServ3;
16134
16521
  const range = (_selectionManagerServ3 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ3 === void 0 ? void 0 : _selectionManagerServ3.range;
16135
16522
  if (!range) return true;
16136
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
16523
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
16137
16524
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
16138
16525
  if (!workbook || !worksheet) return true;
16139
16526
  const unitId = workbook.getUnitId();
@@ -16161,7 +16548,7 @@ function getDeleteMenuHidden$(accessor, type) {
16161
16548
  var _selectionManagerServ4;
16162
16549
  const range = (_selectionManagerServ4 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ4 === void 0 ? void 0 : _selectionManagerServ4.range;
16163
16550
  if (!range) return true;
16164
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
16551
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
16165
16552
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
16166
16553
  if (!workbook || !worksheet) return true;
16167
16554
  const unitId = workbook.getUnitId();
@@ -16192,7 +16579,7 @@ function getCellMenuHidden$(accessor, type) {
16192
16579
  var _selectionManagerServ5;
16193
16580
  const range = (_selectionManagerServ5 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ5 === void 0 ? void 0 : _selectionManagerServ5.range;
16194
16581
  if (!range) return true;
16195
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
16582
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
16196
16583
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
16197
16584
  if (!workbook || !worksheet) return true;
16198
16585
  const unitId = workbook.getUnitId();
@@ -16292,7 +16679,6 @@ function ClearSelectionContentMenuItemFactory(accessor) {
16292
16679
  return {
16293
16680
  id: ClearSelectionContentCommand.id,
16294
16681
  type: MenuItemType.BUTTON,
16295
- icon: "ClearFormatDoubleIcon",
16296
16682
  title: "rightClick.clearContent",
16297
16683
  disabled$: getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, {
16298
16684
  workbookTypes: [WorkbookEditablePermission],
@@ -16306,7 +16692,6 @@ function ClearSelectionFormatMenuItemFactory(accessor) {
16306
16692
  return {
16307
16693
  id: ClearSelectionFormatCommand.id,
16308
16694
  type: MenuItemType.BUTTON,
16309
- icon: "ClearFormatDoubleIcon",
16310
16695
  title: "rightClick.clearFormat",
16311
16696
  disabled$: getCurrentRangeDisable$(accessor, {
16312
16697
  workbookTypes: [WorkbookEditablePermission],
@@ -16316,11 +16701,28 @@ function ClearSelectionFormatMenuItemFactory(accessor) {
16316
16701
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET)
16317
16702
  };
16318
16703
  }
16319
- function ClearSelectionAllMenuItemFactory(accessor) {
16704
+ function ClearSelectionAllToolbarMenuItemFactory(accessor) {
16320
16705
  return {
16321
16706
  id: ClearSelectionAllCommand.id,
16322
16707
  type: MenuItemType.BUTTON,
16323
16708
  icon: "ClearFormatDoubleIcon",
16709
+ tooltip: "rightClick.clearAll",
16710
+ disabled$: getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, {
16711
+ workbookTypes: [WorkbookEditablePermission],
16712
+ worksheetTypes: [
16713
+ WorksheetEditPermission,
16714
+ WorksheetSetCellValuePermission,
16715
+ WorksheetSetCellStylePermission
16716
+ ],
16717
+ rangeTypes: [RangeProtectionPermissionEditPoint]
16718
+ })),
16719
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET)
16720
+ };
16721
+ }
16722
+ function ClearSelectionAllMenuItemFactory(accessor) {
16723
+ return {
16724
+ id: ClearSelectionAllCommand.id,
16725
+ type: MenuItemType.BUTTON,
16324
16726
  title: "rightClick.clearAll",
16325
16727
  tooltip: "rightClick.clearAll",
16326
16728
  disabled$: getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, {
@@ -16627,7 +17029,7 @@ function ToggleGridlinesMenuFactory(accessor) {
16627
17029
  icon: "HideGridlinesDoubleIcon",
16628
17030
  activated$: new Observable((observer) => {
16629
17031
  const getValue = () => {
16630
- const workbook = instanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
17032
+ const workbook = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
16631
17033
  if (workbook) return workbook.getActiveSheet().getConfig().showGridlines === BooleanNumber.TRUE;
16632
17034
  return false;
16633
17035
  };
@@ -18526,7 +18928,7 @@ function ShowMenuItemFactory(accessor) {
18526
18928
  title: "sheetConfig.unhide",
18527
18929
  disabled$: new Observable((subscriber) => {
18528
18930
  function disableFunction() {
18529
- const worksheets = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getWorksheets();
18931
+ const worksheets = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getWorksheets();
18530
18932
  const visibleSheets = Array.from(worksheets.values());
18531
18933
  subscriber.next(visibleSheets.length === 1);
18532
18934
  }
@@ -18541,7 +18943,7 @@ function ShowMenuItemFactory(accessor) {
18541
18943
  };
18542
18944
  }
18543
18945
  function disableFunction(univerInstanceService, subscriber) {
18544
- const worksheets = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getWorksheets();
18946
+ const worksheets = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getWorksheets();
18545
18947
  const visibleSheets = Array.from(worksheets.values()).filter((sheet) => sheet.getConfig().hidden === BooleanNumber.FALSE);
18546
18948
  subscriber.next(visibleSheets.length === 1);
18547
18949
  }
@@ -18617,7 +19019,7 @@ const menuSchema = {
18617
19019
  },
18618
19020
  [ClearSelectionAllCommand.id]: {
18619
19021
  order: 3,
18620
- menuItemFactory: ClearSelectionAllMenuItemFactory
19022
+ menuItemFactory: ClearSelectionAllToolbarMenuItemFactory
18621
19023
  }
18622
19024
  },
18623
19025
  [RibbonStartGroup.FORMAT]: {
@@ -19370,7 +19772,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
19370
19772
  */
19371
19773
  attachPopupToObject(targetObject, popup) {
19372
19774
  var _this$_renderManagerS;
19373
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
19775
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
19374
19776
  const worksheet = workbook.getActiveSheet();
19375
19777
  if (!worksheet || this._isSelectionMoving && !popup.showOnSelectionMoving) return {
19376
19778
  dispose: () => {},
@@ -19420,7 +19822,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
19420
19822
  }
19421
19823
  attachPopupByPosition(bound, popup, location) {
19422
19824
  var _this$_renderManagerS2;
19423
- let workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
19825
+ let workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
19424
19826
  let worksheet = workbook.getActiveSheet();
19425
19827
  if (!worksheet) return null;
19426
19828
  const unitId = workbook.getUnitId();
@@ -19461,7 +19863,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
19461
19863
  }
19462
19864
  attachPopupToAbsolutePosition(bound, popup, _unitId, _subUnitId) {
19463
19865
  var _this$_renderManagerS3;
19464
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
19866
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
19465
19867
  const worksheet = workbook.getActiveSheet();
19466
19868
  if (!worksheet) return null;
19467
19869
  const unitId = workbook.getUnitId();
@@ -19566,7 +19968,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
19566
19968
  * @param showOnSelectionMoving
19567
19969
  */
19568
19970
  attachRangePopup(range, popup, _unitId, _subUnitId, viewport, showOnSelectionMoving = false) {
19569
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
19971
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
19570
19972
  const worksheet = workbook.getActiveSheet();
19571
19973
  if (!worksheet) return null;
19572
19974
  const unitId = workbook.getUnitId();
@@ -19913,7 +20315,7 @@ const CellPopup = (props) => {
19913
20315
  const DefinedNameInput = (props) => {
19914
20316
  const { inputId, state = false, type = "range", confirm, cancel, name, formulaOrRefString, comment = "", localSheetId = SCOPE_WORKBOOK_VALUE_DEFINED_NAME, hidden = false, id } = props;
19915
20317
  const univerInstanceService = useDependency(IUniverInstanceService);
19916
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
20318
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
19917
20319
  const localeService = useDependency(LocaleService);
19918
20320
  const definedNamesService = useDependency(IDefinedNamesService);
19919
20321
  const superTableService = useDependency(ISuperTableService);
@@ -20707,7 +21109,7 @@ function DefinedNameOverlay({ search, isInputEvent }) {
20707
21109
  const definedNamesService = useDependency(IDefinedNamesService);
20708
21110
  const univerInstanceService = useDependency(IUniverInstanceService);
20709
21111
  const sidebarService = useDependency(ISidebarService);
20710
- const unitId = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId();
21112
+ const unitId = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getUnitId();
20711
21113
  const getDefinedNameMap = () => {
20712
21114
  const definedNameMap = definedNamesService.getDefinedNameMap(unitId);
20713
21115
  if (definedNameMap) return Array.from(Object.values(definedNameMap));
@@ -22805,7 +23207,7 @@ function ZoomSlider() {
22805
23207
  }, [commandService, getCurrentZoom]);
22806
23208
  function handleChange(value) {
22807
23209
  setZoom(value);
22808
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
23210
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
22809
23211
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
22810
23212
  if (worksheet == null) return;
22811
23213
  const zoomRatio = value / 100;
@@ -23858,14 +24260,14 @@ let StatusBarController = class StatusBarController extends Disposable {
23858
24260
  return rawCell;
23859
24261
  }
23860
24262
  _calculateSelection(selections, primary) {
23861
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
24263
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
23862
24264
  if (!workbook) return this._clearResult();
23863
24265
  const unitId = workbook.getUnitId();
23864
24266
  const sheet = workbook.getActiveSheet();
23865
24267
  const sheetId = sheet === null || sheet === void 0 ? void 0 : sheet.getSheetId();
23866
24268
  if (!sheetId) return this._clearResult();
23867
24269
  const sheetData = {};
23868
- this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getSheets().forEach((sheet) => {
24270
+ this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getSheets().forEach((sheet) => {
23869
24271
  const sheetConfig = sheet.getConfig();
23870
24272
  sheetData[sheet.getSheetId()] = {
23871
24273
  cellData: new ObjectMatrix(sheetConfig.cellData),
@@ -23961,7 +24363,7 @@ const useHighlightRange = (ranges = []) => {
23961
24363
  //#endregion
23962
24364
  //#region package.json
23963
24365
  var name = "@univerjs/sheets-ui";
23964
- var version = "0.23.0";
24366
+ var version = "0.24.0";
23965
24367
 
23966
24368
  //#endregion
23967
24369
  //#region src/services/cell-alert-manager.service.ts
@@ -24209,7 +24611,7 @@ let SheetsDefinedNameController = class SheetsDefinedNameController extends Disp
24209
24611
  _syncDefinedNameRange(params) {
24210
24612
  if (params.length === 0) return;
24211
24613
  const lastSelection = params[params.length - 1];
24212
- const workbook = this._instanceSrv.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
24614
+ const workbook = this._instanceSrv.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
24213
24615
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
24214
24616
  if (!worksheet) return;
24215
24617
  this._definedNamesService.setCurrentRange({
@@ -24631,7 +25033,7 @@ let FormatPainterController = class FormatPainterController extends Disposable {
24631
25033
  const range = selection === null || selection === void 0 ? void 0 : selection.range;
24632
25034
  if (!range) return null;
24633
25035
  const { startRow, endRow, startColumn, endColumn } = range;
24634
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
25036
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
24635
25037
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
24636
25038
  if (!worksheet) return null;
24637
25039
  const cellData = worksheet.getCellMatrix();
@@ -25389,7 +25791,7 @@ let SheetPermissionInterceptorCanvasRenderController = class SheetPermissionInte
25389
25791
  _initFreezePermissionInterceptor() {
25390
25792
  this.disposeWithMe(this._headerFreezeRenderController.interceptor.intercept(this._headerFreezeRenderController.interceptor.getInterceptPoints().FREEZE_PERMISSION_CHECK, { handler: (_, __) => {
25391
25793
  var _this$_permissionServ5, _this$_permissionServ6;
25392
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
25794
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
25393
25795
  if (!(workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet()) || !workbook) return false;
25394
25796
  return (_this$_permissionServ5 = (_this$_permissionServ6 = this._permissionService.getPermissionPoint(new WorkbookEditablePermission(workbook.getUnitId()).id)) === null || _this$_permissionServ6 === void 0 ? void 0 : _this$_permissionServ6.value) !== null && _this$_permissionServ5 !== void 0 ? _this$_permissionServ5 : false;
25395
25797
  } }));
@@ -25435,7 +25837,7 @@ let SheetPermissionInterceptorClipboardController = class SheetPermissionInterce
25435
25837
  startColumn: startRange.startColumn + ranges.startColumn,
25436
25838
  endColumn: startRange.startColumn + ranges.endColumn
25437
25839
  };
25438
- const worksheet = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet();
25840
+ const worksheet = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getActiveSheet();
25439
25841
  if (!worksheet) return false;
25440
25842
  const { startRow, endRow, startColumn, endColumn } = targetRange;
25441
25843
  let hasPermission = true;
@@ -25564,7 +25966,7 @@ const generateDefaultRule = (injector, fromSheetBar) => {
25564
25966
  var _selectionManagerServ, _selectionManagerServ2;
25565
25967
  const univerInstanceService = injector.get(IUniverInstanceService);
25566
25968
  const selectionManagerService = injector.get(SheetsSelectionsService);
25567
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
25969
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
25568
25970
  const worksheet = workbook.getActiveSheet();
25569
25971
  let unitType = UnitObject.SelectRange;
25570
25972
  let ranges = (_selectionManagerServ = (_selectionManagerServ2 = selectionManagerService.getCurrentSelections()) === null || _selectionManagerServ2 === void 0 ? void 0 : _selectionManagerServ2.map((s) => s.range)) !== null && _selectionManagerServ !== void 0 ? _selectionManagerServ : [];
@@ -25591,7 +25993,7 @@ const generateDefaultRule = (injector, fromSheetBar) => {
25591
25993
  };
25592
25994
  };
25593
25995
  const generateRuleByUnitType = (injector, rule) => {
25594
- const worksheet = injector.get(IUniverInstanceService).getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet();
25996
+ const worksheet = injector.get(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getActiveSheet();
25595
25997
  const { unitType } = rule;
25596
25998
  if (unitType === UnitObject.Worksheet) return {
25597
25999
  ...rule,
@@ -25616,7 +26018,7 @@ const PermissionDetailFooterPart = (props) => {
25616
26018
  const localeService = useDependency(LocaleService);
25617
26019
  const commandService = useDependency(ICommandService);
25618
26020
  const sheetPermissionUserManagerService = useDependency(SheetPermissionUserManagerService);
25619
- const workbook = useDependency(IUniverInstanceService).getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
26021
+ const workbook = useDependency(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
25620
26022
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
25621
26023
  if (!workbook || !worksheet) return null;
25622
26024
  const unitId = workbook.getUnitId();
@@ -25777,7 +26179,7 @@ const PermissionDetailMainPart = (props) => {
25777
26179
  const univerInstanceService = useDependency(IUniverInstanceService);
25778
26180
  const localeService = useDependency(LocaleService);
25779
26181
  const injector = useDependency(Injector);
25780
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
26182
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
25781
26183
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
25782
26184
  if (!workbook || !worksheet) return null;
25783
26185
  const unitId = workbook.getUnitId();
@@ -25785,7 +26187,7 @@ const PermissionDetailMainPart = (props) => {
25785
26187
  const handleRangeChange = (rangeText) => {
25786
26188
  const newRange = rangeText.split(",").map(deserializeRangeWithSheet).map((item) => item.range);
25787
26189
  if (newRange.some((i) => !isValidRange(i) || i.endColumn < i.startColumn || i.endRow < i.startRow)) return;
25788
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
26190
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
25789
26191
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
25790
26192
  if (!workbook || !worksheet) return;
25791
26193
  const unitId = workbook.getUnitId();
@@ -25847,7 +26249,7 @@ const PermissionDetailUserPart = (props) => {
25847
26249
  const userManagerService = useDependency(UserManagerService);
25848
26250
  const univerInstanceService = useDependency(IUniverInstanceService);
25849
26251
  const selectUserList = useObservable(sheetPermissionUserManagerService.selectUserList$, sheetPermissionUserManagerService.selectUserList);
25850
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
26252
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
25851
26253
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
25852
26254
  if (!workbook || !worksheet) return null;
25853
26255
  const unitId = workbook.getUnitId();
@@ -26420,7 +26822,7 @@ const SheetPermissionDialog = () => {
26420
26822
  const worksheetProtectionPointRuleModel = useDependency(WorksheetProtectionPointModel);
26421
26823
  const dialogService = useDependency(IDialogService);
26422
26824
  const permissionService = useDependency(IPermissionService);
26423
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
26825
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
26424
26826
  const worksheet = workbook.getActiveSheet();
26425
26827
  if (!worksheet) throw new Error("No active sheet found");
26426
26828
  const [collaborators, setCollaborators] = useState([]);
@@ -26471,7 +26873,7 @@ const SheetPermissionDialog = () => {
26471
26873
  getPermissionPoints();
26472
26874
  }, []);
26473
26875
  const handleChangeActionPermission = async () => {
26474
- const workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
26876
+ const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
26475
26877
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
26476
26878
  if (!worksheet) throw new Error("No active sheet found");
26477
26879
  const unitId = workbook.getUnitId();
@@ -26860,694 +27262,398 @@ var WorksheetProtectionRenderExtension = class extends SheetExtension {
26860
27262
  }
26861
27263
  /**
26862
27264
  * Get the current shadow strategy
26863
- */
26864
- getShadowStrategy() {
26865
- return this._shadowStrategy;
26866
- }
26867
- setZIndex(zIndex) {
26868
- this.Z_INDEX = zIndex;
26869
- }
26870
- };
26871
-
26872
- //#endregion
26873
- //#region src/controllers/permission/sheet-permission-render.controller.ts
26874
- let SheetPermissionRenderManagerController = class SheetPermissionRenderManagerController extends Disposable {
26875
- constructor(_injector, _componentManager) {
26876
- super();
26877
- this._injector = _injector;
26878
- this._componentManager = _componentManager;
26879
- this._init();
26880
- }
26881
- _init() {
26882
- this._initComponents();
26883
- this._initUiPartComponents();
26884
- }
26885
- _initComponents() {
26886
- [
26887
- [permissionMenuIconKey, ProtectIcon],
26888
- [permissionDeleteIconKey, DeleteIcon],
26889
- [permissionEditIconKey, WriteIcon],
26890
- [permissionCheckIconKey, CheckMarkIcon],
26891
- [permissionLockIconKey, LockIcon],
26892
- [UNIVER_SHEET_PERMISSION_PANEL, SheetPermissionPanel],
26893
- [UNIVER_SHEET_PERMISSION_USER_DIALOG, SheetPermissionUserDialog],
26894
- [UNIVER_SHEET_PERMISSION_DIALOG, SheetPermissionDialog],
26895
- [UNIVER_SHEET_PERMISSION_ALERT_DIALOG, AlertDialog]
26896
- ].forEach(([key, comp]) => {
26897
- this.disposeWithMe(this._componentManager.register(key, comp));
26898
- });
26899
- }
26900
- _initUiPartComponents() {
26901
- const config = this._injector.get(IConfigService).getConfig(SHEETS_UI_PLUGIN_CONFIG_KEY);
26902
- if (config === null || config === void 0 ? void 0 : config.protectedRangeUserSelector) {
26903
- const { component, framework } = config.protectedRangeUserSelector;
26904
- this.disposeWithMe(this._componentManager.register(UNIVER_SHEET_PERMISSION_USER_PART, component, { framework }));
26905
- }
26906
- }
26907
- };
26908
- SheetPermissionRenderManagerController = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, Inject(ComponentManager))], SheetPermissionRenderManagerController);
26909
- let SheetPermissionRenderController = class SheetPermissionRenderController extends Disposable {
26910
- constructor(_context, _rangeProtectionRuleModel, _sheetSkeletonManagerService, _permissionService, _configService) {
26911
- super();
26912
- this._context = _context;
26913
- this._rangeProtectionRuleModel = _rangeProtectionRuleModel;
26914
- this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
26915
- this._permissionService = _permissionService;
26916
- this._configService = _configService;
26917
- _defineProperty(this, "_rangeProtectionCanViewRenderExtension", void 0);
26918
- _defineProperty(this, "_rangeProtectionCanNotViewRenderExtension", void 0);
26919
- const config = this._configService.getConfig(SHEETS_UI_PLUGIN_CONFIG_KEY);
26920
- const shadowStrategy = convertToShadowStrategy(config === null || config === void 0 ? void 0 : config.protectedRangeShadow);
26921
- this._rangeProtectionCanViewRenderExtension = new RangeProtectionCanViewRenderExtension(shadowStrategy);
26922
- this._rangeProtectionCanNotViewRenderExtension = new RangeProtectionCanNotViewRenderExtension(shadowStrategy);
26923
- this._initSkeleton();
26924
- this._initRender();
26925
- this.disposeWithMe(this._rangeProtectionRuleModel.ruleChange$.subscribe((info) => {
26926
- var _info$oldRule, _info$oldRule2;
26927
- if (((_info$oldRule = info.oldRule) === null || _info$oldRule === void 0 ? void 0 : _info$oldRule.id) && this._rangeProtectionCanViewRenderExtension.renderCache.has(info.oldRule.id) || this._rangeProtectionCanViewRenderExtension.renderCache.has(info.rule.id)) this._rangeProtectionCanViewRenderExtension.clearCache();
26928
- if (((_info$oldRule2 = info.oldRule) === null || _info$oldRule2 === void 0 ? void 0 : _info$oldRule2.id) && this._rangeProtectionCanNotViewRenderExtension.renderCache.has(info.oldRule.id) || this._rangeProtectionCanNotViewRenderExtension.renderCache.has(info.rule.id)) this._rangeProtectionCanNotViewRenderExtension.clearCache();
26929
- }));
26930
- }
26931
- _initRender() {
26932
- const spreadsheetRender = this._context.mainComponent;
26933
- if (spreadsheetRender) {
26934
- if (!spreadsheetRender.getExtensionByKey("RANGE_PROTECTION_CAN_VIEW_RENDER_EXTENSION_KEY")) spreadsheetRender.register(this._rangeProtectionCanViewRenderExtension);
26935
- if (!spreadsheetRender.getExtensionByKey("RANGE_PROTECTION_CAN_NOT_VIEW_RENDER_EXTENSION_KEY")) spreadsheetRender.register(this._rangeProtectionCanNotViewRenderExtension);
26936
- }
26937
- }
26938
- _initSkeleton() {
26939
- const markDirtySkeleton = () => {
26940
- var _this$_context$mainCo;
26941
- this._sheetSkeletonManagerService.reCalculate();
26942
- (_this$_context$mainCo = this._context.mainComponent) === null || _this$_context$mainCo === void 0 || _this$_context$mainCo.makeDirty();
26943
- };
26944
- this.disposeWithMe(merge$1(this._permissionService.permissionPointUpdate$.pipe(throttleTime(300, void 0, { trailing: true })), this._rangeProtectionRuleModel.rangeRuleInitStateChange$, this._rangeProtectionRuleModel.ruleChange$).pipe().subscribe(markDirtySkeleton));
26945
- }
26946
- };
26947
- SheetPermissionRenderController = __decorate([
26948
- __decorateParam(1, Inject(RangeProtectionRuleModel)),
26949
- __decorateParam(2, Inject(SheetSkeletonManagerService)),
26950
- __decorateParam(3, IPermissionService),
26951
- __decorateParam(4, IConfigService)
26952
- ], SheetPermissionRenderController);
26953
- let WorksheetProtectionRenderController = class WorksheetProtectionRenderController extends Disposable {
26954
- constructor(_context, _renderManagerService, _sheetSkeletonManagerService, _worksheetProtectionRuleModel, _configService) {
26955
- super();
26956
- this._context = _context;
26957
- this._renderManagerService = _renderManagerService;
26958
- this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
26959
- this._worksheetProtectionRuleModel = _worksheetProtectionRuleModel;
26960
- this._configService = _configService;
26961
- _defineProperty(this, "_worksheetProtectionRenderExtension", void 0);
26962
- const config = this._configService.getConfig(SHEETS_UI_PLUGIN_CONFIG_KEY);
26963
- const shadowStrategy = convertToShadowStrategy(config === null || config === void 0 ? void 0 : config.protectedRangeShadow);
26964
- this._worksheetProtectionRenderExtension = new WorksheetProtectionRenderExtension(shadowStrategy);
26965
- this._initSkeleton();
26966
- if (shadowStrategy === "none") return;
26967
- this._initRender();
26968
- }
26969
- _initRender() {
26970
- const renderId = this._context.unitId;
26971
- const render = renderId && this._renderManagerService.getRenderById(renderId);
26972
- const spreadsheetRender = render && render.mainComponent;
26973
- if (spreadsheetRender) {
26974
- if (!spreadsheetRender.getExtensionByKey("worksheet-protection")) spreadsheetRender.register(this._worksheetProtectionRenderExtension);
26975
- }
26976
- }
26977
- _initSkeleton() {
26978
- const markDirtySkeleton = () => {
26979
- var _this$_context$mainCo2;
26980
- this._sheetSkeletonManagerService.reCalculate();
26981
- (_this$_context$mainCo2 = this._context.mainComponent) === null || _this$_context$mainCo2 === void 0 || _this$_context$mainCo2.makeDirty();
26982
- };
26983
- this.disposeWithMe(merge$1(this._worksheetProtectionRuleModel.worksheetRuleInitStateChange$).pipe().subscribe(markDirtySkeleton));
26984
- }
26985
- };
26986
- WorksheetProtectionRenderController = __decorate([
26987
- __decorateParam(1, Inject(IRenderManagerService)),
26988
- __decorateParam(2, Inject(SheetSkeletonManagerService)),
26989
- __decorateParam(3, Inject(WorksheetProtectionRuleModel)),
26990
- __decorateParam(4, Inject(IConfigService))
26991
- ], WorksheetProtectionRenderController);
26992
-
26993
- //#endregion
26994
- //#region src/controllers/render-controllers/clipboard.render-controller.ts
26995
- let ClipboardRenderController = class ClipboardRenderController extends Disposable {
26996
- constructor(_context, _sheetSkeletonManagerService, _sheetClipboardService, _sheetClipboardController) {
26997
- super();
26998
- this._context = _context;
26999
- this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
27000
- this._sheetClipboardService = _sheetClipboardService;
27001
- this._sheetClipboardController = _sheetClipboardController;
27002
- this._initialize();
27003
- }
27004
- _initialize() {
27005
- this.disposeWithMe(toDisposable(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((skeleton) => {
27006
- if (!(skeleton === null || skeleton === void 0 ? void 0 : skeleton.unitId)) return;
27007
- if (!this._sheetClipboardService.getPasteMenuVisible()) return;
27008
- const pasteOptionsCache = this._sheetClipboardService.getPasteOptionsCache();
27009
- const menuUnitId = pasteOptionsCache === null || pasteOptionsCache === void 0 ? void 0 : pasteOptionsCache.target.unitId;
27010
- if (skeleton.unitId === menuUnitId) this._sheetClipboardController.refreshOptionalPaste();
27011
- })));
27012
- }
27013
- };
27014
- ClipboardRenderController = __decorate([
27015
- __decorateParam(1, Inject(SheetSkeletonManagerService)),
27016
- __decorateParam(2, ISheetClipboardService),
27017
- __decorateParam(3, Inject(SheetClipboardController))
27018
- ], ClipboardRenderController);
27019
-
27020
- //#endregion
27021
- //#region src/controllers/render-controllers/format-painter.render-controller.ts
27022
- let FormatPainterRenderController = class FormatPainterRenderController extends Disposable {
27023
- constructor(_context, _formatPainterService, _selectionRenderService, _commandService) {
27024
- super();
27025
- this._context = _context;
27026
- this._formatPainterService = _formatPainterService;
27027
- this._selectionRenderService = _selectionRenderService;
27028
- this._commandService = _commandService;
27029
- this._initialize();
27030
- }
27031
- _initialize() {
27032
- this._bindFormatPainterStatus();
27033
- this._commandExecutedListener();
27034
- }
27035
- _commandExecutedListener() {
27036
- this.disposeWithMe(this._selectionRenderService.selectionMoveEnd$.subscribe((selections) => {
27037
- if (this._formatPainterService.getStatus() !== 0) {
27038
- var _this$_context$unit$g;
27039
- const { rangeWithCoord } = selections[selections.length - 1];
27040
- this._commandService.executeCommand(ApplyFormatPainterCommand.id, {
27041
- unitId: this._context.unitId,
27042
- subUnitId: ((_this$_context$unit$g = this._context.unit.getActiveSheet()) === null || _this$_context$unit$g === void 0 ? void 0 : _this$_context$unit$g.getSheetId()) || "",
27043
- range: {
27044
- startRow: rangeWithCoord.startRow,
27045
- startColumn: rangeWithCoord.startColumn,
27046
- endRow: rangeWithCoord.endRow,
27047
- endColumn: rangeWithCoord.endColumn
27048
- }
27049
- });
27050
- if (this._formatPainterService.getStatus() === 1) this._commandService.executeCommand(SetOnceFormatPainterCommand.id);
27051
- }
27052
- }));
27053
- }
27054
- _bindFormatPainterStatus() {
27055
- this.disposeWithMe(toDisposable(this._formatPainterService.status$.subscribe((status) => {
27056
- const scene = this._context.scene;
27057
- if (!scene) return;
27058
- if (status !== 0) scene.setDefaultCursor(CURSOR_TYPE.CELL);
27059
- else scene.setDefaultCursor(CURSOR_TYPE.DEFAULT);
27060
- })));
27265
+ */
27266
+ getShadowStrategy() {
27267
+ return this._shadowStrategy;
27268
+ }
27269
+ setZIndex(zIndex) {
27270
+ this.Z_INDEX = zIndex;
27061
27271
  }
27062
27272
  };
27063
- FormatPainterRenderController = __decorate([
27064
- __decorateParam(1, IFormatPainterService),
27065
- __decorateParam(2, ISheetSelectionRenderService),
27066
- __decorateParam(3, ICommandService)
27067
- ], FormatPainterRenderController);
27068
27273
 
27069
27274
  //#endregion
27070
- //#region src/menu/header-menu-shape.ts
27071
- const HEADER_MENU_SHAPE_CIRCLE_FILL = "rgba(0, 0, 0, 0.15)";
27072
- const HEADER_MENU_SHAPE_TRIANGLE_FILL = "rgb(0, 0, 0)";
27073
- const HEADER_MENU_BACKGROUND_COLOR = "rgb(255, 255, 255, 1)";
27074
- var HeaderMenuShape = class extends Shape {
27075
- constructor(key, props) {
27076
- super(key, props);
27077
- _defineProperty(this, "_size", 12);
27078
- _defineProperty(this, "_iconRatio", .4);
27079
- _defineProperty(this, "_mode", 0);
27080
- this.setShapeProps(props);
27275
+ //#region src/controllers/permission/sheet-permission-render.controller.ts
27276
+ let SheetPermissionRenderManagerController = class SheetPermissionRenderManagerController extends Disposable {
27277
+ constructor(_injector, _componentManager) {
27278
+ super();
27279
+ this._injector = _injector;
27280
+ this._componentManager = _componentManager;
27281
+ this._init();
27081
27282
  }
27082
- setShapeProps(props) {
27083
- if (props === null || props === void 0 ? void 0 : props.size) this._size = props.size;
27084
- if (props === null || props === void 0 ? void 0 : props.mode) this._mode = props.mode;
27085
- this.transformByState({
27086
- width: this._size,
27087
- height: this._size
27088
- });
27283
+ _init() {
27284
+ this._initComponents();
27285
+ this._initUiPartComponents();
27089
27286
  }
27090
- _draw(ctx) {
27091
- if (this._mode === 1) Rect.drawWith(ctx, {
27092
- width: this._size,
27093
- height: this._size,
27094
- radius: this._size,
27095
- fill: HEADER_MENU_SHAPE_CIRCLE_FILL
27096
- });
27097
- const iconSize = this._size * .5 * this._iconRatio;
27098
- const sixtyDegree = Math.PI / 180 * 60;
27099
- const left = iconSize * Math.sin(sixtyDegree);
27100
- const top = iconSize * Math.cos(sixtyDegree);
27101
- RegularPolygon.drawWith(ctx, {
27102
- pointsGroup: [[
27103
- {
27104
- x: -left + this._size / 2,
27105
- y: -top + this._size / 2
27106
- },
27107
- {
27108
- x: left + this._size / 2,
27109
- y: -top + this._size / 2
27110
- },
27111
- {
27112
- x: this._size / 2,
27113
- y: iconSize + this._size / 2
27114
- }
27115
- ]],
27116
- fill: HEADER_MENU_SHAPE_TRIANGLE_FILL
27287
+ _initComponents() {
27288
+ [
27289
+ [permissionMenuIconKey, ProtectIcon],
27290
+ [permissionDeleteIconKey, DeleteIcon],
27291
+ [permissionEditIconKey, WriteIcon],
27292
+ [permissionCheckIconKey, CheckMarkIcon],
27293
+ [permissionLockIconKey, LockIcon],
27294
+ [UNIVER_SHEET_PERMISSION_PANEL, SheetPermissionPanel],
27295
+ [UNIVER_SHEET_PERMISSION_USER_DIALOG, SheetPermissionUserDialog],
27296
+ [UNIVER_SHEET_PERMISSION_DIALOG, SheetPermissionDialog],
27297
+ [UNIVER_SHEET_PERMISSION_ALERT_DIALOG, AlertDialog]
27298
+ ].forEach(([key, comp]) => {
27299
+ this.disposeWithMe(this._componentManager.register(key, comp));
27117
27300
  });
27118
27301
  }
27302
+ _initUiPartComponents() {
27303
+ const config = this._injector.get(IConfigService).getConfig(SHEETS_UI_PLUGIN_CONFIG_KEY);
27304
+ if (config === null || config === void 0 ? void 0 : config.protectedRangeUserSelector) {
27305
+ const { component, framework } = config.protectedRangeUserSelector;
27306
+ this.disposeWithMe(this._componentManager.register(UNIVER_SHEET_PERMISSION_USER_PART, component, { framework }));
27307
+ }
27308
+ }
27119
27309
  };
27120
-
27121
- //#endregion
27122
- //#region src/controllers/render-controllers/header-menu.render-controller.ts
27123
- const HEADER_MENU_CONTROLLER_SHAPE = "__SpreadsheetHeaderMenuSHAPEControllerShape__";
27124
- const HEADER_MENU_CONTROLLER_MENU = "__SpreadsheetHeaderMenuMAINControllerShape__";
27125
- const HEADER_MENU_CONTROLLER_SHAPE_COLOR = "rgba(0, 0, 0, 0.1)";
27126
- let HeaderMenuRenderController = class HeaderMenuRenderController extends Disposable {
27127
- constructor(_context, _sheetSkeletonManagerService, _contextMenuService, _commandService, _selectionManagerService) {
27310
+ SheetPermissionRenderManagerController = __decorate([__decorateParam(0, Inject(Injector)), __decorateParam(1, Inject(ComponentManager))], SheetPermissionRenderManagerController);
27311
+ let SheetPermissionRenderController = class SheetPermissionRenderController extends Disposable {
27312
+ constructor(_context, _rangeProtectionRuleModel, _sheetSkeletonManagerService, _permissionService, _configService) {
27128
27313
  super();
27129
27314
  this._context = _context;
27315
+ this._rangeProtectionRuleModel = _rangeProtectionRuleModel;
27130
27316
  this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
27131
- this._contextMenuService = _contextMenuService;
27132
- this._commandService = _commandService;
27133
- this._selectionManagerService = _selectionManagerService;
27134
- _defineProperty(this, "_hoverRect", void 0);
27135
- _defineProperty(this, "_hoverMenu", void 0);
27136
- _defineProperty(this, "_currentColumn", Number.POSITIVE_INFINITY);
27137
- _defineProperty(this, "_headerPointerSubs", void 0);
27138
- _defineProperty(this, "_colHeaderPointerSubs", void 0);
27139
- this._initialize();
27140
- }
27141
- dispose() {
27142
- var _this$_hoverRect, _this$_hoverMenu, _this$_headerPointerS;
27143
- (_this$_hoverRect = this._hoverRect) === null || _this$_hoverRect === void 0 || _this$_hoverRect.dispose();
27144
- (_this$_hoverMenu = this._hoverMenu) === null || _this$_hoverMenu === void 0 || _this$_hoverMenu.dispose();
27145
- (_this$_headerPointerS = this._headerPointerSubs) === null || _this$_headerPointerS === void 0 || _this$_headerPointerS.unsubscribe();
27146
- this._headerPointerSubs = null;
27317
+ this._permissionService = _permissionService;
27318
+ this._configService = _configService;
27319
+ _defineProperty(this, "_rangeProtectionCanViewRenderExtension", void 0);
27320
+ _defineProperty(this, "_rangeProtectionCanNotViewRenderExtension", void 0);
27321
+ const config = this._configService.getConfig(SHEETS_UI_PLUGIN_CONFIG_KEY);
27322
+ const shadowStrategy = convertToShadowStrategy(config === null || config === void 0 ? void 0 : config.protectedRangeShadow);
27323
+ this._rangeProtectionCanViewRenderExtension = new RangeProtectionCanViewRenderExtension(shadowStrategy);
27324
+ this._rangeProtectionCanNotViewRenderExtension = new RangeProtectionCanNotViewRenderExtension(shadowStrategy);
27325
+ this._initSkeleton();
27326
+ this._initRender();
27327
+ this.disposeWithMe(this._rangeProtectionRuleModel.ruleChange$.subscribe((info) => {
27328
+ var _info$oldRule, _info$oldRule2;
27329
+ if (((_info$oldRule = info.oldRule) === null || _info$oldRule === void 0 ? void 0 : _info$oldRule.id) && this._rangeProtectionCanViewRenderExtension.renderCache.has(info.oldRule.id) || this._rangeProtectionCanViewRenderExtension.renderCache.has(info.rule.id)) this._rangeProtectionCanViewRenderExtension.clearCache();
27330
+ if (((_info$oldRule2 = info.oldRule) === null || _info$oldRule2 === void 0 ? void 0 : _info$oldRule2.id) && this._rangeProtectionCanNotViewRenderExtension.renderCache.has(info.oldRule.id) || this._rangeProtectionCanNotViewRenderExtension.renderCache.has(info.rule.id)) this._rangeProtectionCanNotViewRenderExtension.clearCache();
27331
+ }));
27147
27332
  }
27148
- _initialize() {
27149
- const scene = this._context.scene;
27150
- this._hoverRect = new Rect(HEADER_MENU_CONTROLLER_SHAPE, {
27151
- fill: HEADER_MENU_CONTROLLER_SHAPE_COLOR,
27152
- evented: false
27153
- });
27154
- this._hoverMenu = new HeaderMenuShape(HEADER_MENU_CONTROLLER_MENU, {
27155
- zIndex: 100,
27156
- visible: false
27157
- });
27158
- scene.addObjects([this._hoverRect, this._hoverMenu], 10);
27159
- this._initialHover(0);
27160
- this._initialHover(1);
27161
- this._initialHoverMenu();
27333
+ _initRender() {
27334
+ const spreadsheetRender = this._context.mainComponent;
27335
+ if (spreadsheetRender) {
27336
+ if (!spreadsheetRender.getExtensionByKey("RANGE_PROTECTION_CAN_VIEW_RENDER_EXTENSION_KEY")) spreadsheetRender.register(this._rangeProtectionCanViewRenderExtension);
27337
+ if (!spreadsheetRender.getExtensionByKey("RANGE_PROTECTION_CAN_NOT_VIEW_RENDER_EXTENSION_KEY")) spreadsheetRender.register(this._rangeProtectionCanNotViewRenderExtension);
27338
+ }
27162
27339
  }
27163
- _initialHover(initialType = 0) {
27164
- var _this$_headerPointerS2, _this$_headerPointerS3, _this$_headerPointerS4;
27165
- const spreadsheetColumnHeader = this._context.components.get("__SpreadsheetColumnHeader__");
27166
- const spreadsheetRowHeader = this._context.components.get("__SpreadsheetRowHeader__");
27167
- const eventBindingObject = initialType === 0 ? spreadsheetRowHeader : spreadsheetColumnHeader;
27168
- const pointerMoveHandler = (evt) => {
27169
- var _this$_sheetSkeletonM;
27170
- const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
27171
- if (skeleton == null) return;
27172
- const { rowHeaderWidth, columnHeaderHeight } = skeleton;
27173
- const { startX, startY, endX, endY, column } = getCoordByOffset(evt.offsetX, evt.offsetY, this._context.scene, skeleton);
27174
- if (initialType === 0) {
27175
- var _this$_hoverRect2;
27176
- (_this$_hoverRect2 = this._hoverRect) === null || _this$_hoverRect2 === void 0 || _this$_hoverRect2.transformByState({
27177
- width: rowHeaderWidth,
27178
- height: endY - startY,
27179
- left: 0,
27180
- top: startY
27181
- });
27182
- } else {
27183
- var _this$_hoverRect3;
27184
- this._currentColumn = column;
27185
- (_this$_hoverRect3 = this._hoverRect) === null || _this$_hoverRect3 === void 0 || _this$_hoverRect3.transformByState({
27186
- width: endX - startX,
27187
- height: columnHeaderHeight,
27188
- left: startX,
27189
- top: 0
27190
- });
27191
- if (this._hoverMenu == null) return;
27192
- if (endX - startX < columnHeaderHeight * 2) {
27193
- this._hoverMenu.hide();
27194
- return;
27195
- }
27196
- const menuSize = columnHeaderHeight * .8;
27197
- this._hoverMenu.transformByState({
27198
- left: endX - columnHeaderHeight,
27199
- top: columnHeaderHeight / 2 - menuSize / 2
27200
- });
27201
- this._hoverMenu.setShapeProps({ size: menuSize });
27202
- this._hoverMenu.show();
27203
- }
27204
- };
27205
- const pointerEnterHandler = () => {
27206
- var _this$_hoverRect4;
27207
- (_this$_hoverRect4 = this._hoverRect) === null || _this$_hoverRect4 === void 0 || _this$_hoverRect4.show();
27208
- };
27209
- const pointerLeaveHandler = () => {
27210
- var _this$_hoverRect5, _this$_hoverMenu2;
27211
- (_this$_hoverRect5 = this._hoverRect) === null || _this$_hoverRect5 === void 0 || _this$_hoverRect5.hide();
27212
- (_this$_hoverMenu2 = this._hoverMenu) === null || _this$_hoverMenu2 === void 0 || _this$_hoverMenu2.hide();
27340
+ _initSkeleton() {
27341
+ const markDirtySkeleton = () => {
27342
+ var _this$_context$mainCo;
27343
+ this._sheetSkeletonManagerService.reCalculate();
27344
+ (_this$_context$mainCo = this._context.mainComponent) === null || _this$_context$mainCo === void 0 || _this$_context$mainCo.makeDirty();
27213
27345
  };
27214
- this._headerPointerSubs = new Subscription();
27215
- const headerPointerMoveSub = eventBindingObject.onPointerMove$.subscribeEvent(pointerMoveHandler);
27216
- const headerPointerEnterSub = eventBindingObject.onPointerEnter$.subscribeEvent(pointerEnterHandler);
27217
- const headerPointerLeaveSub = eventBindingObject.onPointerLeave$.subscribeEvent(pointerLeaveHandler);
27218
- (_this$_headerPointerS2 = this._headerPointerSubs) === null || _this$_headerPointerS2 === void 0 || _this$_headerPointerS2.add(headerPointerMoveSub);
27219
- (_this$_headerPointerS3 = this._headerPointerSubs) === null || _this$_headerPointerS3 === void 0 || _this$_headerPointerS3.add(headerPointerEnterSub);
27220
- (_this$_headerPointerS4 = this._headerPointerSubs) === null || _this$_headerPointerS4 === void 0 || _this$_headerPointerS4.add(headerPointerLeaveSub);
27346
+ this.disposeWithMe(merge$1(this._permissionService.permissionPointUpdate$.pipe(throttleTime(300, void 0, { trailing: true })), this._rangeProtectionRuleModel.rangeRuleInitStateChange$, this._rangeProtectionRuleModel.ruleChange$).pipe().subscribe(markDirtySkeleton));
27221
27347
  }
27222
- _initialHoverMenu() {
27223
- if (this._hoverMenu == null) return;
27224
- this._hoverMenu.onPointerEnter$.subscribeEvent(() => {
27225
- if (this._hoverMenu == null) return;
27226
- this._hoverMenu.setProps({
27227
- mode: 1,
27228
- visible: true
27229
- });
27230
- this._context.scene.setCursor(CURSOR_TYPE.POINTER);
27231
- });
27232
- this._hoverMenu.onPointerLeave$.subscribeEvent(() => {
27233
- if (this._hoverMenu == null) return;
27234
- this._hoverMenu.setProps({
27235
- mode: 0,
27236
- visible: false
27237
- });
27238
- this._context.scene.resetCursor();
27239
- });
27240
- this._hoverMenu.onPointerDown$.subscribeEvent((evt) => {
27241
- var _this$_selectionManag;
27242
- const currentColumn = this._currentColumn;
27243
- const currentSelectionDatas = (_this$_selectionManag = this._selectionManagerService.getCurrentSelections()) === null || _this$_selectionManag === void 0 ? void 0 : _this$_selectionManag.map((s) => s.range);
27244
- if (!!!(currentSelectionDatas === null || currentSelectionDatas === void 0 ? void 0 : currentSelectionDatas.filter((range) => range.rangeType === RANGE_TYPE.COLUMN).find((data) => {
27245
- const { startColumn, endColumn } = data;
27246
- if (currentColumn >= startColumn && currentColumn <= endColumn) return true;
27247
- return false;
27248
- }))) {
27249
- const selection = this._getSelectionOnColumn(currentColumn);
27250
- this._commandService.syncExecuteCommand(SetSelectionsOperation.id, selection);
27251
- }
27252
- evt.stopPropagation();
27253
- evt.preventDefault();
27254
- this._contextMenuService.triggerContextMenu(evt, ContextMenuPosition.COL_HEADER);
27255
- });
27348
+ };
27349
+ SheetPermissionRenderController = __decorate([
27350
+ __decorateParam(1, Inject(RangeProtectionRuleModel)),
27351
+ __decorateParam(2, Inject(SheetSkeletonManagerService)),
27352
+ __decorateParam(3, IPermissionService),
27353
+ __decorateParam(4, IConfigService)
27354
+ ], SheetPermissionRenderController);
27355
+ let WorksheetProtectionRenderController = class WorksheetProtectionRenderController extends Disposable {
27356
+ constructor(_context, _renderManagerService, _sheetSkeletonManagerService, _worksheetProtectionRuleModel, _configService) {
27357
+ super();
27358
+ this._context = _context;
27359
+ this._renderManagerService = _renderManagerService;
27360
+ this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
27361
+ this._worksheetProtectionRuleModel = _worksheetProtectionRuleModel;
27362
+ this._configService = _configService;
27363
+ _defineProperty(this, "_worksheetProtectionRenderExtension", void 0);
27364
+ const config = this._configService.getConfig(SHEETS_UI_PLUGIN_CONFIG_KEY);
27365
+ const shadowStrategy = convertToShadowStrategy(config === null || config === void 0 ? void 0 : config.protectedRangeShadow);
27366
+ this._worksheetProtectionRenderExtension = new WorksheetProtectionRenderExtension(shadowStrategy);
27367
+ this._initSkeleton();
27368
+ if (shadowStrategy === "none") return;
27369
+ this._initRender();
27256
27370
  }
27257
- _getSelectionOnColumn(column) {
27258
- const workbook = this._context.unit;
27259
- const worksheet = workbook.getActiveSheet();
27260
- if (!worksheet) throw new Error("No active worksheet");
27261
- return {
27262
- unitId: workbook.getUnitId(),
27263
- subUnitId: worksheet.getSheetId(),
27264
- selections: [{
27265
- range: {
27266
- startRow: 0,
27267
- startColumn: column,
27268
- endRow: worksheet.getRowCount() - 1,
27269
- endColumn: column,
27270
- rangeType: RANGE_TYPE.COLUMN
27271
- },
27272
- primary: {
27273
- startRow: 0,
27274
- startColumn: column,
27275
- endRow: 0,
27276
- endColumn: column,
27277
- actualRow: 0,
27278
- actualColumn: column,
27279
- isMerged: false,
27280
- isMergedMainCell: false
27281
- },
27282
- style: null
27283
- }]
27371
+ _initRender() {
27372
+ const renderId = this._context.unitId;
27373
+ const render = renderId && this._renderManagerService.getRenderById(renderId);
27374
+ const spreadsheetRender = render && render.mainComponent;
27375
+ if (spreadsheetRender) {
27376
+ if (!spreadsheetRender.getExtensionByKey("worksheet-protection")) spreadsheetRender.register(this._worksheetProtectionRenderExtension);
27377
+ }
27378
+ }
27379
+ _initSkeleton() {
27380
+ const markDirtySkeleton = () => {
27381
+ var _this$_context$mainCo2;
27382
+ this._sheetSkeletonManagerService.reCalculate();
27383
+ (_this$_context$mainCo2 = this._context.mainComponent) === null || _this$_context$mainCo2 === void 0 || _this$_context$mainCo2.makeDirty();
27284
27384
  };
27385
+ this.disposeWithMe(merge$1(this._worksheetProtectionRuleModel.worksheetRuleInitStateChange$).pipe().subscribe(markDirtySkeleton));
27285
27386
  }
27286
27387
  };
27287
- HeaderMenuRenderController = __decorate([
27288
- __decorateParam(1, Inject(SheetSkeletonManagerService)),
27289
- __decorateParam(2, IContextMenuService),
27290
- __decorateParam(3, ICommandService),
27291
- __decorateParam(4, Inject(SheetsSelectionsService))
27292
- ], HeaderMenuRenderController);
27388
+ WorksheetProtectionRenderController = __decorate([
27389
+ __decorateParam(1, Inject(IRenderManagerService)),
27390
+ __decorateParam(2, Inject(SheetSkeletonManagerService)),
27391
+ __decorateParam(3, Inject(WorksheetProtectionRuleModel)),
27392
+ __decorateParam(4, Inject(IConfigService))
27393
+ ], WorksheetProtectionRenderController);
27293
27394
 
27294
27395
  //#endregion
27295
- //#region src/views/header-unhide-shape.ts
27296
- const UNHIDE_ICON_SIZE = 12;
27297
- const UNHIDE_ARROW_RATIO = .4;
27298
- var HeaderUnhideShape = class extends Shape {
27299
- constructor(key, props, onClick) {
27300
- super(key, props);
27301
- _defineProperty(this, "_size", 12);
27302
- _defineProperty(this, "_iconRatio", UNHIDE_ARROW_RATIO);
27303
- _defineProperty(this, "_hovered", true);
27304
- _defineProperty(this, "_hasPrevious", true);
27305
- _defineProperty(this, "_hasNext", true);
27306
- _defineProperty(this, "_unhideType", void 0);
27307
- if (props) this.setShapeProps(props);
27308
- this.onPointerEnter$.subscribeEvent(() => this.setShapeProps({ hovered: true }));
27309
- this.onPointerLeave$.subscribeEvent(() => this.setShapeProps({ hovered: false }));
27310
- this.onPointerDown$.subscribeEvent(() => onClick === null || onClick === void 0 ? void 0 : onClick());
27396
+ //#region src/controllers/render-controllers/clipboard.render-controller.ts
27397
+ let ClipboardRenderController = class ClipboardRenderController extends Disposable {
27398
+ constructor(_context, _sheetSkeletonManagerService, _sheetClipboardService, _sheetClipboardController) {
27399
+ super();
27400
+ this._context = _context;
27401
+ this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
27402
+ this._sheetClipboardService = _sheetClipboardService;
27403
+ this._sheetClipboardController = _sheetClipboardController;
27404
+ this._initialize();
27311
27405
  }
27312
- setShapeProps(props) {
27313
- if (props.type !== void 0) this._unhideType = props.type;
27314
- if (props.hovered !== void 0) this._hovered = props.hovered;
27315
- if (props.hasPrevious !== void 0) this._hasPrevious = props.hasPrevious;
27316
- if (props.hasNext !== void 0) this._hasNext = props.hasNext;
27317
- this.transformByState({
27318
- width: this._size * (this._unhideType === 1 ? 2 : 1),
27319
- height: this._size * (this._unhideType === 0 ? 2 : 1)
27320
- });
27406
+ _initialize() {
27407
+ this.disposeWithMe(toDisposable(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((skeleton) => {
27408
+ if (!(skeleton === null || skeleton === void 0 ? void 0 : skeleton.unitId)) return;
27409
+ if (!this._sheetClipboardService.getPasteMenuVisible()) return;
27410
+ const pasteOptionsCache = this._sheetClipboardService.getPasteOptionsCache();
27411
+ const menuUnitId = pasteOptionsCache === null || pasteOptionsCache === void 0 ? void 0 : pasteOptionsCache.target.unitId;
27412
+ if (skeleton.unitId === menuUnitId) this._sheetClipboardController.refreshOptionalPaste();
27413
+ })));
27321
27414
  }
27322
- _draw(ctx) {
27323
- if (this._unhideType === 0) this._drawOnRow(ctx);
27324
- else this._drawOnCol(ctx);
27415
+ };
27416
+ ClipboardRenderController = __decorate([
27417
+ __decorateParam(1, Inject(SheetSkeletonManagerService)),
27418
+ __decorateParam(2, ISheetClipboardService),
27419
+ __decorateParam(3, Inject(SheetClipboardController))
27420
+ ], ClipboardRenderController);
27421
+
27422
+ //#endregion
27423
+ //#region src/controllers/render-controllers/format-painter.render-controller.ts
27424
+ let FormatPainterRenderController = class FormatPainterRenderController extends Disposable {
27425
+ constructor(_context, _formatPainterService, _selectionRenderService, _commandService) {
27426
+ super();
27427
+ this._context = _context;
27428
+ this._formatPainterService = _formatPainterService;
27429
+ this._selectionRenderService = _selectionRenderService;
27430
+ this._commandService = _commandService;
27431
+ this._initialize();
27325
27432
  }
27326
- _drawOnRow(ctx) {
27327
- if (this._hovered) if (!this._hasNext || !this._hasPrevious) Rect.drawWith(ctx, {
27328
- width: this._size,
27329
- height: this._size,
27330
- stroke: HEADER_MENU_SHAPE_TRIANGLE_FILL,
27331
- fill: HEADER_MENU_BACKGROUND_COLOR
27332
- });
27333
- else Rect.drawWith(ctx, {
27334
- width: this._size,
27335
- height: 2 * this._size,
27336
- stroke: HEADER_MENU_SHAPE_TRIANGLE_FILL,
27337
- fill: HEADER_MENU_BACKGROUND_COLOR
27338
- });
27339
- const iconSize = this._size * .5 * this._iconRatio;
27340
- const sixtyDegree = Math.PI / 3;
27341
- const top = iconSize * Math.cos(sixtyDegree);
27342
- const left = iconSize * Math.sin(sixtyDegree);
27343
- if (this._hasPrevious) RegularPolygon.drawWith(ctx, {
27344
- pointsGroup: [[
27345
- {
27346
- x: this._size / 2,
27347
- y: this._size / 2 - left
27348
- },
27349
- {
27350
- x: this._size / 2 - left,
27351
- y: this._size / 2 + top
27352
- },
27353
- {
27354
- x: this._size / 2 + left,
27355
- y: this._size / 2 + top
27356
- }
27357
- ]],
27358
- fill: HEADER_MENU_SHAPE_TRIANGLE_FILL
27359
- });
27360
- if (this._hasNext) {
27361
- const offset = this._hasPrevious ? 3 : 1;
27362
- RegularPolygon.drawWith(ctx, {
27363
- pointsGroup: [[
27364
- {
27365
- x: this._size / 2,
27366
- y: this._size * offset / 2 + left
27367
- },
27368
- {
27369
- x: this._size / 2 - left,
27370
- y: this._size * offset / 2 - top
27371
- },
27372
- {
27373
- x: this._size / 2 + left,
27374
- y: this._size * offset / 2 - top
27375
- }
27376
- ]],
27377
- fill: HEADER_MENU_SHAPE_TRIANGLE_FILL
27378
- });
27379
- }
27433
+ _initialize() {
27434
+ this._bindFormatPainterStatus();
27435
+ this._commandExecutedListener();
27380
27436
  }
27381
- /**
27382
- *
27383
- * @param ctx
27384
- */
27385
- _drawOnCol(ctx) {
27386
- if (this._hovered) if (!this._hasNext || !this._hasPrevious) Rect.drawWith(ctx, {
27387
- width: this._size,
27388
- height: this._size,
27389
- stroke: HEADER_MENU_SHAPE_TRIANGLE_FILL,
27390
- fill: HEADER_MENU_BACKGROUND_COLOR
27391
- });
27392
- else Rect.drawWith(ctx, {
27393
- width: 2 * this._size,
27394
- height: this._size,
27395
- stroke: HEADER_MENU_SHAPE_TRIANGLE_FILL,
27396
- fill: HEADER_MENU_BACKGROUND_COLOR
27397
- });
27398
- const iconSize = this._size * .5 * this._iconRatio;
27399
- const sixtyDegree = Math.PI / 3;
27400
- const top = iconSize * Math.cos(sixtyDegree);
27401
- const left = iconSize * Math.sin(sixtyDegree);
27402
- if (this._hasPrevious) RegularPolygon.drawWith(ctx, {
27403
- pointsGroup: [[
27404
- {
27405
- x: -top + this._size / 2,
27406
- y: this._size / 2
27407
- },
27408
- {
27409
- x: this._size / 2 + left,
27410
- y: this._size / 2 - left
27411
- },
27412
- {
27413
- x: this._size / 2 + left,
27414
- y: this._size / 2 + left
27415
- }
27416
- ]],
27417
- fill: HEADER_MENU_SHAPE_TRIANGLE_FILL
27418
- });
27419
- if (this._hasNext) {
27420
- const offset = this._hasPrevious ? 3 : 1;
27421
- RegularPolygon.drawWith(ctx, {
27422
- pointsGroup: [[
27423
- {
27424
- x: top + this._size * offset / 2,
27425
- y: this._size / 2
27426
- },
27427
- {
27428
- x: -left + this._size * offset / 2,
27429
- y: this._size / 2 - left
27430
- },
27431
- {
27432
- x: -left + this._size * offset / 2,
27433
- y: this._size / 2 + left
27437
+ _commandExecutedListener() {
27438
+ this.disposeWithMe(this._selectionRenderService.selectionMoveEnd$.subscribe((selections) => {
27439
+ if (this._formatPainterService.getStatus() !== 0) {
27440
+ var _this$_context$unit$g;
27441
+ const { rangeWithCoord } = selections[selections.length - 1];
27442
+ this._commandService.executeCommand(ApplyFormatPainterCommand.id, {
27443
+ unitId: this._context.unitId,
27444
+ subUnitId: ((_this$_context$unit$g = this._context.unit.getActiveSheet()) === null || _this$_context$unit$g === void 0 ? void 0 : _this$_context$unit$g.getSheetId()) || "",
27445
+ range: {
27446
+ startRow: rangeWithCoord.startRow,
27447
+ startColumn: rangeWithCoord.startColumn,
27448
+ endRow: rangeWithCoord.endRow,
27449
+ endColumn: rangeWithCoord.endColumn
27434
27450
  }
27435
- ]],
27436
- fill: HEADER_MENU_SHAPE_TRIANGLE_FILL
27437
- });
27438
- }
27451
+ });
27452
+ if (this._formatPainterService.getStatus() === 1) this._commandService.executeCommand(SetOnceFormatPainterCommand.id);
27453
+ }
27454
+ }));
27455
+ }
27456
+ _bindFormatPainterStatus() {
27457
+ this.disposeWithMe(toDisposable(this._formatPainterService.status$.subscribe((status) => {
27458
+ const scene = this._context.scene;
27459
+ if (!scene) return;
27460
+ if (status !== 0) scene.setDefaultCursor(CURSOR_TYPE.CELL);
27461
+ else scene.setDefaultCursor(CURSOR_TYPE.DEFAULT);
27462
+ })));
27439
27463
  }
27440
27464
  };
27465
+ FormatPainterRenderController = __decorate([
27466
+ __decorateParam(1, IFormatPainterService),
27467
+ __decorateParam(2, ISheetSelectionRenderService),
27468
+ __decorateParam(3, ICommandService)
27469
+ ], FormatPainterRenderController);
27441
27470
 
27442
27471
  //#endregion
27443
- //#region src/controllers/render-controllers/header-unhide.render-controller.ts
27444
- const HEADER_UNHIDE_CONTROLLER_SHAPE = "__SpreadsheetHeaderUnhideSHAPEControllerShape__";
27445
- let HeaderUnhideRenderController = class HeaderUnhideRenderController extends RxDisposable {
27446
- get _workbook() {
27447
- return this._context.unit;
27448
- }
27449
- constructor(_context, _sheetSkeletonManagerService, _commandService) {
27472
+ //#region src/controllers/render-controllers/header-menu.render-controller.ts
27473
+ const HEADER_MENU_CONTROLLER_SHAPE = "__SpreadsheetHeaderMenuSHAPEControllerShape__";
27474
+ const HEADER_MENU_CONTROLLER_MENU = "__SpreadsheetHeaderMenuMAINControllerShape__";
27475
+ const HEADER_MENU_CONTROLLER_SHAPE_COLOR = "rgba(0, 0, 0, 0.1)";
27476
+ let HeaderMenuRenderController = class HeaderMenuRenderController extends Disposable {
27477
+ constructor(_context, _sheetSkeletonManagerService, _contextMenuService, _commandService, _selectionManagerService) {
27450
27478
  super();
27451
27479
  this._context = _context;
27452
27480
  this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
27481
+ this._contextMenuService = _contextMenuService;
27453
27482
  this._commandService = _commandService;
27454
- _defineProperty(this, "_shapes", {
27455
- cols: [],
27456
- rows: []
27457
- });
27458
- this._init();
27483
+ this._selectionManagerService = _selectionManagerService;
27484
+ _defineProperty(this, "_hoverRect", void 0);
27485
+ _defineProperty(this, "_hoverMenu", void 0);
27486
+ _defineProperty(this, "_currentColumn", Number.POSITIVE_INFINITY);
27487
+ _defineProperty(this, "_headerPointerSubs", void 0);
27488
+ _defineProperty(this, "_colHeaderPointerSubs", void 0);
27489
+ this._initialize();
27459
27490
  }
27460
27491
  dispose() {
27461
- super.dispose();
27462
- this._clearShapes();
27492
+ var _this$_hoverRect, _this$_hoverMenu, _this$_headerPointerS;
27493
+ (_this$_hoverRect = this._hoverRect) === null || _this$_hoverRect === void 0 || _this$_hoverRect.dispose();
27494
+ (_this$_hoverMenu = this._hoverMenu) === null || _this$_hoverMenu === void 0 || _this$_hoverMenu.dispose();
27495
+ (_this$_headerPointerS = this._headerPointerSubs) === null || _this$_headerPointerS === void 0 || _this$_headerPointerS.unsubscribe();
27496
+ this._headerPointerSubs = null;
27463
27497
  }
27464
- _init() {
27465
- let activeSheetId = "";
27466
- this._context.unit.activeSheet$.pipe(takeUntil(this.dispose$)).subscribe((worksheet) => {
27467
- this._clearShapes();
27468
- if (!worksheet) {
27469
- activeSheetId = "";
27470
- return;
27471
- }
27472
- activeSheetId = worksheet.getSheetId();
27473
- this._update(this._workbook, worksheet);
27498
+ _initialize() {
27499
+ const scene = this._context.scene;
27500
+ this._hoverRect = new Rect(HEADER_MENU_CONTROLLER_SHAPE, {
27501
+ fill: HEADER_MENU_CONTROLLER_SHAPE_COLOR,
27502
+ evented: false
27474
27503
  });
27475
- this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((param) => {
27476
- if (param) {
27477
- const { unitId, sheetId } = param;
27478
- if (unitId === this._workbook.getUnitId() && sheetId === activeSheetId) {
27479
- const worksheet = this._workbook.getSheetBySheetId(sheetId);
27480
- if (worksheet) this._update(this._workbook, worksheet);
27504
+ this._hoverMenu = new HeaderMenuShape(HEADER_MENU_CONTROLLER_MENU, {
27505
+ zIndex: 100,
27506
+ visible: false
27507
+ });
27508
+ scene.addObjects([this._hoverRect, this._hoverMenu], 10);
27509
+ this._initialHover(0);
27510
+ this._initialHover(1);
27511
+ this._initialHoverMenu();
27512
+ }
27513
+ _initialHover(initialType = 0) {
27514
+ var _this$_headerPointerS2, _this$_headerPointerS3, _this$_headerPointerS4;
27515
+ const spreadsheetColumnHeader = this._context.components.get("__SpreadsheetColumnHeader__");
27516
+ const spreadsheetRowHeader = this._context.components.get("__SpreadsheetRowHeader__");
27517
+ const eventBindingObject = initialType === 0 ? spreadsheetRowHeader : spreadsheetColumnHeader;
27518
+ const pointerMoveHandler = (evt) => {
27519
+ var _this$_sheetSkeletonM;
27520
+ const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
27521
+ if (skeleton == null) return;
27522
+ const { rowBaseWidth, rowGutterWidth, columnBaseHeight, columnGutterHeight } = getHeaderBaseLayout(skeleton);
27523
+ const { startX, startY, endX, endY, column } = getCoordByOffset(evt.offsetX, evt.offsetY, this._context.scene, skeleton);
27524
+ if (initialType === 0) {
27525
+ var _this$_hoverRect2;
27526
+ (_this$_hoverRect2 = this._hoverRect) === null || _this$_hoverRect2 === void 0 || _this$_hoverRect2.transformByState({
27527
+ width: rowBaseWidth,
27528
+ height: endY - startY,
27529
+ left: rowGutterWidth,
27530
+ top: startY
27531
+ });
27532
+ } else {
27533
+ var _this$_hoverRect3;
27534
+ this._currentColumn = column;
27535
+ (_this$_hoverRect3 = this._hoverRect) === null || _this$_hoverRect3 === void 0 || _this$_hoverRect3.transformByState({
27536
+ width: endX - startX,
27537
+ height: columnBaseHeight,
27538
+ left: startX,
27539
+ top: columnGutterHeight
27540
+ });
27541
+ if (this._hoverMenu == null) return;
27542
+ if (endX - startX < columnBaseHeight * 2) {
27543
+ this._hoverMenu.hide();
27544
+ return;
27481
27545
  }
27546
+ const menuSize = columnBaseHeight * .8;
27547
+ this._hoverMenu.transformByState({
27548
+ left: endX - columnBaseHeight,
27549
+ top: columnGutterHeight + columnBaseHeight / 2 - menuSize / 2
27550
+ });
27551
+ this._hoverMenu.setShapeProps({ size: menuSize });
27552
+ this._hoverMenu.show();
27482
27553
  }
27483
- }));
27554
+ };
27555
+ const pointerEnterHandler = () => {
27556
+ var _this$_hoverRect4;
27557
+ (_this$_hoverRect4 = this._hoverRect) === null || _this$_hoverRect4 === void 0 || _this$_hoverRect4.show();
27558
+ };
27559
+ const pointerLeaveHandler = () => {
27560
+ var _this$_hoverRect5, _this$_hoverMenu2;
27561
+ (_this$_hoverRect5 = this._hoverRect) === null || _this$_hoverRect5 === void 0 || _this$_hoverRect5.hide();
27562
+ (_this$_hoverMenu2 = this._hoverMenu) === null || _this$_hoverMenu2 === void 0 || _this$_hoverMenu2.hide();
27563
+ };
27564
+ this._headerPointerSubs = new Subscription();
27565
+ const headerPointerMoveSub = eventBindingObject.onPointerMove$.subscribeEvent(pointerMoveHandler);
27566
+ const headerPointerEnterSub = eventBindingObject.onPointerEnter$.subscribeEvent(pointerEnterHandler);
27567
+ const headerPointerLeaveSub = eventBindingObject.onPointerLeave$.subscribeEvent(pointerLeaveHandler);
27568
+ (_this$_headerPointerS2 = this._headerPointerSubs) === null || _this$_headerPointerS2 === void 0 || _this$_headerPointerS2.add(headerPointerMoveSub);
27569
+ (_this$_headerPointerS3 = this._headerPointerSubs) === null || _this$_headerPointerS3 === void 0 || _this$_headerPointerS3.add(headerPointerEnterSub);
27570
+ (_this$_headerPointerS4 = this._headerPointerSubs) === null || _this$_headerPointerS4 === void 0 || _this$_headerPointerS4.add(headerPointerLeaveSub);
27484
27571
  }
27485
- _update(workbook, worksheet) {
27486
- var _this$_sheetSkeletonM;
27487
- const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getSkeletonParam(worksheet.getSheetId())) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
27488
- if (!skeleton) return;
27489
- const hiddenRowRanges = worksheet.getHiddenRows();
27490
- const hiddenColRanges = worksheet.getHiddenCols();
27491
- const { scene } = this._getSheetObject();
27492
- const rowCount = worksheet.getRowCount();
27493
- const rowShapes = hiddenRowRanges.map((range) => {
27494
- const { startRow, endRow } = range;
27495
- const position = getCoordByCell(startRow, 0, scene, skeleton);
27496
- const hasPrevious = startRow !== 0;
27497
- const hasNext = endRow !== rowCount - 1;
27498
- return new HeaderUnhideShape(HEADER_UNHIDE_CONTROLLER_SHAPE, {
27499
- type: 0,
27500
- hovered: false,
27501
- hasPrevious,
27502
- hasNext,
27503
- top: position.startY - (hasPrevious ? 12 : 0),
27504
- left: position.startX - 12
27505
- }, () => this._commandService.executeCommand(SetSpecificRowsVisibleCommand.id, {
27506
- unitId: workbook.getUnitId(),
27507
- subUnitId: worksheet.getSheetId(),
27508
- ranges: [range]
27509
- }));
27572
+ _initialHoverMenu() {
27573
+ if (this._hoverMenu == null) return;
27574
+ this._hoverMenu.onPointerEnter$.subscribeEvent(() => {
27575
+ if (this._hoverMenu == null) return;
27576
+ this._hoverMenu.setProps({
27577
+ mode: 1,
27578
+ visible: true
27579
+ });
27580
+ this._context.scene.setCursor(CURSOR_TYPE.POINTER);
27510
27581
  });
27511
- const colCount = worksheet.getColumnCount();
27512
- const colShapes = hiddenColRanges.map((range) => {
27513
- const { startColumn, endColumn } = range;
27514
- const position = getCoordByCell(0, startColumn, scene, skeleton);
27515
- const hasPrevious = startColumn !== 0;
27516
- const hasNext = endColumn !== colCount - 1;
27517
- return new HeaderUnhideShape(HEADER_UNHIDE_CONTROLLER_SHAPE, {
27518
- type: 1,
27519
- hovered: false,
27520
- hasPrevious,
27521
- hasNext,
27522
- top: 20 - 12,
27523
- left: position.startX - (hasPrevious ? 12 : 0)
27524
- }, () => this._commandService.executeCommand(SetSpecificColsVisibleCommand.id, {
27525
- unitId: workbook.getUnitId(),
27526
- subUnitId: worksheet.getSheetId(),
27527
- ranges: [range]
27528
- }));
27582
+ this._hoverMenu.onPointerLeave$.subscribeEvent(() => {
27583
+ if (this._hoverMenu == null) return;
27584
+ this._hoverMenu.setProps({
27585
+ mode: 0,
27586
+ visible: false
27587
+ });
27588
+ this._context.scene.resetCursor();
27589
+ });
27590
+ this._hoverMenu.onPointerDown$.subscribeEvent((evt) => {
27591
+ var _this$_selectionManag;
27592
+ const currentColumn = this._currentColumn;
27593
+ const currentSelectionDatas = (_this$_selectionManag = this._selectionManagerService.getCurrentSelections()) === null || _this$_selectionManag === void 0 ? void 0 : _this$_selectionManag.map((s) => s.range);
27594
+ if (!!!(currentSelectionDatas === null || currentSelectionDatas === void 0 ? void 0 : currentSelectionDatas.filter((range) => range.rangeType === RANGE_TYPE.COLUMN).find((data) => {
27595
+ const { startColumn, endColumn } = data;
27596
+ if (currentColumn >= startColumn && currentColumn <= endColumn) return true;
27597
+ return false;
27598
+ }))) {
27599
+ const selection = this._getSelectionOnColumn(currentColumn);
27600
+ this._commandService.syncExecuteCommand(SetSelectionsOperation.id, selection);
27601
+ }
27602
+ evt.stopPropagation();
27603
+ evt.preventDefault();
27604
+ this._contextMenuService.triggerContextMenu(evt, ContextMenuPosition.COL_HEADER);
27529
27605
  });
27530
- scene.addObjects(colShapes, 12);
27531
- scene.addObjects(rowShapes, 12);
27532
- this._clearShapes();
27533
- this._shapes = {
27534
- cols: colShapes,
27535
- rows: rowShapes
27536
- };
27537
27606
  }
27538
- _clearShapes() {
27539
- this._shapes.cols.forEach((shape) => shape.dispose());
27540
- this._shapes.rows.forEach((shape) => shape.dispose());
27541
- this._shapes = {
27542
- cols: [],
27543
- rows: []
27607
+ _getSelectionOnColumn(column) {
27608
+ const workbook = this._context.unit;
27609
+ const worksheet = workbook.getActiveSheet();
27610
+ if (!worksheet) throw new Error("No active worksheet");
27611
+ return {
27612
+ unitId: workbook.getUnitId(),
27613
+ subUnitId: worksheet.getSheetId(),
27614
+ selections: [{
27615
+ range: {
27616
+ startRow: 0,
27617
+ startColumn: column,
27618
+ endRow: worksheet.getRowCount() - 1,
27619
+ endColumn: column,
27620
+ rangeType: RANGE_TYPE.COLUMN
27621
+ },
27622
+ primary: {
27623
+ startRow: 0,
27624
+ startColumn: column,
27625
+ endRow: 0,
27626
+ endColumn: column,
27627
+ actualRow: 0,
27628
+ actualColumn: column,
27629
+ isMerged: false,
27630
+ isMergedMainCell: false
27631
+ },
27632
+ style: null
27633
+ }]
27544
27634
  };
27545
27635
  }
27546
- _getSheetObject() {
27547
- return getSheetObject(this._workbook, this._context);
27548
- }
27549
27636
  };
27550
- HeaderUnhideRenderController = __decorate([__decorateParam(1, Inject(SheetSkeletonManagerService)), __decorateParam(2, ICommandService)], HeaderUnhideRenderController);
27637
+ HeaderMenuRenderController = __decorate([
27638
+ __decorateParam(1, Inject(SheetSkeletonManagerService)),
27639
+ __decorateParam(2, IContextMenuService),
27640
+ __decorateParam(3, ICommandService),
27641
+ __decorateParam(4, Inject(SheetsSelectionsService))
27642
+ ], HeaderMenuRenderController);
27643
+ function getHeaderBaseLayout(skeleton) {
27644
+ var _skeleton$worksheet$g, _skeleton$worksheet, _config$rowHeader, _config$columnHeader;
27645
+ const config = (_skeleton$worksheet$g = (_skeleton$worksheet = skeleton.worksheet).getConfig) === null || _skeleton$worksheet$g === void 0 ? void 0 : _skeleton$worksheet$g.call(_skeleton$worksheet);
27646
+ const configuredRowWidth = config === null || config === void 0 || (_config$rowHeader = config.rowHeader) === null || _config$rowHeader === void 0 ? void 0 : _config$rowHeader.width;
27647
+ const configuredColumnHeight = config === null || config === void 0 || (_config$columnHeader = config.columnHeader) === null || _config$columnHeader === void 0 ? void 0 : _config$columnHeader.height;
27648
+ const rowBaseWidth = typeof configuredRowWidth === "number" && configuredRowWidth > 0 ? Math.min(configuredRowWidth, skeleton.rowHeaderWidth) : skeleton.rowHeaderWidth;
27649
+ const columnBaseHeight = typeof configuredColumnHeight === "number" && configuredColumnHeight > 0 ? Math.min(configuredColumnHeight, skeleton.columnHeaderHeight) : skeleton.columnHeaderHeight;
27650
+ return {
27651
+ rowBaseWidth,
27652
+ rowGutterWidth: Math.max(0, skeleton.rowHeaderWidthAndMarginLeft - rowBaseWidth),
27653
+ columnBaseHeight,
27654
+ columnGutterHeight: Math.max(0, skeleton.columnHeaderHeightAndMarginTop - columnBaseHeight)
27655
+ };
27656
+ }
27551
27657
 
27552
27658
  //#endregion
27553
27659
  //#region src/consts/mobile-context.ts
@@ -28854,7 +28960,7 @@ let SheetSkeletonRenderController = class SheetSkeletonRenderController extends
28854
28960
  }));
28855
28961
  }
28856
28962
  _updateSceneSize(param) {
28857
- var _this$_renderManagerS;
28963
+ var _this$_renderManagerS, _scene$getViewport, _scene$getViewport2, _scene$getViewport3, _scene$getViewport4, _scene$getViewport5;
28858
28964
  if (param == null) return;
28859
28965
  const { unitId } = this._context;
28860
28966
  const { skeleton } = param;
@@ -28867,6 +28973,30 @@ let SheetSkeletonRenderController = class SheetSkeletonRenderController extends
28867
28973
  height: columnHeaderHeightAndMarginTop + rowTotalHeight
28868
28974
  });
28869
28975
  scene.getMainViewport().setMargin(rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop);
28976
+ scene.getMainViewport().resizeWhenFreezeChange({
28977
+ left: rowHeaderWidthAndMarginLeft,
28978
+ top: columnHeaderHeightAndMarginTop
28979
+ });
28980
+ (_scene$getViewport = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_LEFT)) === null || _scene$getViewport === void 0 || _scene$getViewport.resizeWhenFreezeChange({
28981
+ left: rowHeaderWidthAndMarginLeft,
28982
+ height: columnHeaderHeightAndMarginTop
28983
+ });
28984
+ (_scene$getViewport2 = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_RIGHT)) === null || _scene$getViewport2 === void 0 || _scene$getViewport2.resizeWhenFreezeChange({
28985
+ left: rowHeaderWidthAndMarginLeft,
28986
+ height: columnHeaderHeightAndMarginTop
28987
+ });
28988
+ (_scene$getViewport3 = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_ROW_BOTTOM)) === null || _scene$getViewport3 === void 0 || _scene$getViewport3.resizeWhenFreezeChange({
28989
+ width: rowHeaderWidthAndMarginLeft,
28990
+ top: columnHeaderHeightAndMarginTop
28991
+ });
28992
+ (_scene$getViewport4 = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_ROW_TOP)) === null || _scene$getViewport4 === void 0 || _scene$getViewport4.resizeWhenFreezeChange({
28993
+ width: rowHeaderWidthAndMarginLeft,
28994
+ top: columnHeaderHeightAndMarginTop
28995
+ });
28996
+ (_scene$getViewport5 = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_LEFT_TOP)) === null || _scene$getViewport5 === void 0 || _scene$getViewport5.resizeWhenFreezeChange({
28997
+ width: rowHeaderWidthAndMarginLeft,
28998
+ height: columnHeaderHeightAndMarginTop
28999
+ });
28870
29000
  }
28871
29001
  };
28872
29002
  SheetSkeletonRenderController = __decorate([__decorateParam(1, Inject(SheetSkeletonManagerService)), __decorateParam(2, IRenderManagerService)], SheetSkeletonRenderController);
@@ -29700,16 +29830,18 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
29700
29830
  */
29701
29831
  newSelectionControl(scene, skeleton, selection) {
29702
29832
  const selectionControls = this.getSelectionControls();
29703
- const { rowHeaderWidth, columnHeaderHeight } = skeleton;
29833
+ const { rowHeaderWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeight, columnHeaderHeightAndMarginTop } = skeleton;
29704
29834
  const rangeType = selection.range.rangeType;
29705
29835
  const control = new MobileSelectionControl(scene, selectionControls.length, this._themeService, {
29706
29836
  highlightHeader: this._highlightHeader,
29707
29837
  rowHeaderWidth,
29708
29838
  columnHeaderHeight,
29839
+ rowHeaderOffsetX: Math.max(0, rowHeaderWidthAndMarginLeft - rowHeaderWidth),
29840
+ columnHeaderOffsetY: Math.max(0, columnHeaderHeightAndMarginTop - columnHeaderHeight),
29709
29841
  rangeType
29710
29842
  });
29711
29843
  const selectionWithCoord = attachSelectionWithCoord(selection, skeleton);
29712
- control.updateRangeBySelectionWithCoord(selectionWithCoord);
29844
+ control.updateRangeBySelectionWithCoord(selectionWithCoord, skeleton);
29713
29845
  this._selectionControls.push(control);
29714
29846
  const { expandingModeForTopLeft, expandingModeForBottomRight } = (() => {
29715
29847
  switch (rangeType) {
@@ -29985,6 +30117,7 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends Plugin
29985
30117
  [IStatusBarService, { useClass: StatusBarService }],
29986
30118
  [IMarkSelectionService, { useClass: MarkSelectionService }],
29987
30119
  [HoverManagerService],
30120
+ [HeaderUnhideRangeService],
29988
30121
  [DragManagerService],
29989
30122
  [SheetCanvasPopManagerService],
29990
30123
  [CellPopupManagerService],
@@ -30580,6 +30713,7 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends Plugin {
30580
30713
  [IStatusBarService, { useClass: StatusBarService }],
30581
30714
  [IMarkSelectionService, { useClass: MarkSelectionService }],
30582
30715
  [HoverManagerService],
30716
+ [HeaderUnhideRangeService],
30583
30717
  [DragManagerService],
30584
30718
  [SheetCanvasPopManagerService],
30585
30719
  [CellPopupManagerService],
@@ -30708,4 +30842,4 @@ UniverSheetsUIPlugin = __decorate([
30708
30842
  ], UniverSheetsUIPlugin);
30709
30843
 
30710
30844
  //#endregion
30711
- export { AddRangeProtectionFromContextMenuCommand, AddRangeProtectionFromSheetBarCommand, AddRangeProtectionFromToolbarCommand, ApplyFormatPainterCommand, AutoFillUIController, AutoHeightController, AutoWidthController, BaseSelectionRenderService, COPY_SPECIAL_MENU_ID, COPY_TYPE, CellAlertManagerService, CellAlertType, CellCustomRenderController, CellEditorManagerService, CellPopupManagerService, ChangeSheetProtectionFromSheetBarCommand, ChangeZoomRatioCommand, DeleteRangeMoveLeftConfirmCommand, DeleteRangeMoveUpConfirmCommand, DeleteRangeProtectionFromContextMenuCommand, DeleteWorksheetProtectionFormSheetBarCommand, DragManagerService, DragRenderController, EMBEDDING_FORMULA_EDITOR, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY, EditingRenderController, EditorBridgeService, ExpandSelectionCommand, FormatPainterStatus, FormulaBar, FormulaEditorController, HeaderFreezeRenderController, HeaderMoveRenderController, HeaderResizeRenderController, HideColConfirmCommand, HideRowConfirmCommand, HoverManagerService, HoverRenderController, ICellEditorManagerService, IEditorBridgeService, IFormatPainterService, IFormulaEditorManagerService, IMarkSelectionService, IRepeatLastActionService, ISheetCellDropdownManagerService, ISheetClipboardService, ISheetSelectionRenderService, IStatusBarService, InsertRangeMoveDownConfirmCommand, InsertRangeMoveRightConfirmCommand, JumpOver, MarkSelectionService, MobileSheetBar, MoveSelectionCommand, MoveSelectionEnterAndTabCommand, PASTE_SPECIAL_MENU_ID, PREDEFINED_HOOK_NAME, PREDEFINED_HOOK_NAME_COPY, PREDEFINED_HOOK_NAME_PASTE, RANGE_SELECTOR_COMPONENT_KEY, RANGE_SELECTOR_SYMBOLS, RemoveColConfirmCommand, RemoveRowConfirmCommand, RemoveSheetConfirmCommand, RenameSheetOperation, RenderSheetContent, RenderSheetFooter, RenderSheetHeader, RepeatLastActionPermission, ResetRangeTextColorCommand, ResetScrollCommand, SELECTION_SHAPE_DEPTH, SHEET_UI_PLUGIN_NAME, SHEET_VIEW_KEY, ScrollCommand, ScrollToCellCommand, ScrollToRangeOperation, SelectAllCommand, SelectionControl, SelectionControl as SelectionShape, SelectionShapeExtension, SetActivateCellEditOperation, SetCellEditVisibleArrowOperation, SetCellEditVisibleOperation, SetCellEditVisibleWithF2Operation, SetColumnFrozenCommand, SetColumnHeaderHeightCommand, SetFirstColumnFrozenCommand, SetFirstRowFrozenCommand, SetFormatPainterOperation, SetInfiniteFormatPainterCommand, SetOnceFormatPainterCommand, SetRangeBoldCommand, SetRangeFontDecreaseCommand, SetRangeFontFamilyCommand, SetRangeFontIncreaseCommand, SetRangeFontSizeCommand, SetRangeItalicCommand, SetRangeProtectionFromContextMenuCommand, SetRangeStrickThroughCommand, SetRangeSubscriptCommand, SetRangeSuperscriptCommand, SetRangeTextColorCommand, SetRangeUnderlineCommand, SetRowFrozenCommand, SetRowHeaderWidthCommand, SetScrollOperation, SetScrollRelativeCommand, SetSelectionFrozenCommand, SetWorksheetColAutoWidthCommand, SetZoomRatioCommand, SetZoomRatioOperation, SheetBar, SheetCanvasPopManagerService, SheetCellDropdownManagerService, SheetCellEditorResizeService, SheetClipboardController, SheetClipboardService, SheetCopyCommand, SheetCopyDownCommand, SheetCopyRightCommand, SheetCutCommand, SheetMenuPosition, SheetPasteBesidesBorderCommand, SheetPasteColWidthCommand, SheetPasteCommand, SheetPasteFormatCommand, SheetPasteShortKeyCommand, SheetPasteValueCommand, SheetPermissionCheckUIController, SheetPermissionOpenDialogOperation, SheetPermissionOpenPanelOperation, SheetPermissionRenderManagerService, SheetPermissionUserManagerService, SheetPrintInterceptorService, SheetRenderController, SheetScrollManagerService, SheetSelectionRenderService, SheetSkeletonManagerService, SheetUIController, SheetsRenderService, SheetsScrollRenderController, menuSchema as SheetsUIMenuSchema, SheetsUIPart, ShowMenuListCommand, SidebarDefinedNameOperation, StatusBarController, StatusBarService, UNIVER_SHEET_PERMISSION_USER_PART, UniverSheetsMobileUIPlugin, UniverSheetsUIPlugin, ViewSheetPermissionFromContextMenuCommand, ViewSheetPermissionFromSheetBarCommand, calculateDocSkeletonRects, matchedSelectionByRowColIndex as checkInHeaderRanges, deriveStateFromActiveSheet$, functionDisplayNames, genNormalSelectionStyle, genSelectionByRange, selectionDataForSelectAll as getAllSelection, getCellRealRange, getCoordByCell, getCoordByOffset, getCurrentExclusiveRangeInterest$, getCurrentRangeDisable$, getCustomRangePosition, getEditingCustomRangePosition, getEditorObject, getMatrixPlainText, getObservableWithExclusiveRange$, getRepeatRange, getSheetObject, getTopLeftSelectionOfCurrSheet, getTransformCoord, getViewportByCell, isEmbeddingFormulaEditor, isRangeSelector, menuClipboardDisabledObservable, mergeSetRangeValues, useActiveWorkbook, useActiveWorksheet, useHighlightRange, useKeyEventConfig, useWorkbooks, virtualizeDiscreteRanges, whenFormulaEditorActivated, whenSheetEditorActivated, whenSheetEditorFocused };
30845
+ export { AddRangeProtectionFromContextMenuCommand, AddRangeProtectionFromSheetBarCommand, AddRangeProtectionFromToolbarCommand, ApplyFormatPainterCommand, AutoFillUIController, AutoHeightController, AutoWidthController, BaseSelectionRenderService, COPY_SPECIAL_MENU_ID, COPY_TYPE, CellAlertManagerService, CellAlertType, CellCustomRenderController, CellEditorManagerService, CellPopupManagerService, ChangeSheetProtectionFromSheetBarCommand, ChangeZoomRatioCommand, DeleteRangeMoveLeftConfirmCommand, DeleteRangeMoveUpConfirmCommand, DeleteRangeProtectionFromContextMenuCommand, DeleteWorksheetProtectionFormSheetBarCommand, DragManagerService, DragRenderController, EMBEDDING_FORMULA_EDITOR, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY, EditingRenderController, EditorBridgeService, ExpandSelectionCommand, FormatPainterStatus, FormulaBar, FormulaEditorController, HEADER_UNHIDE_RANGE_VISIBLE_CHECK, HeaderFreezeRenderController, HeaderMoveRenderController, HeaderResizeRenderController, HeaderUnhideRangeAxis, HeaderUnhideRangeService, HeaderUnhideRenderController, HideColConfirmCommand, HideRowConfirmCommand, HoverManagerService, HoverRenderController, ICellEditorManagerService, IEditorBridgeService, IFormatPainterService, IFormulaEditorManagerService, IMarkSelectionService, IRepeatLastActionService, ISheetCellDropdownManagerService, ISheetClipboardService, ISheetSelectionRenderService, IStatusBarService, InsertRangeMoveDownConfirmCommand, InsertRangeMoveRightConfirmCommand, JumpOver, MarkSelectionService, MobileSheetBar, MoveSelectionCommand, MoveSelectionEnterAndTabCommand, PASTE_SPECIAL_MENU_ID, PREDEFINED_HOOK_NAME, PREDEFINED_HOOK_NAME_COPY, PREDEFINED_HOOK_NAME_PASTE, RANGE_SELECTOR_COMPONENT_KEY, RANGE_SELECTOR_SYMBOLS, RemoveColConfirmCommand, RemoveRowConfirmCommand, RemoveSheetConfirmCommand, RenameSheetOperation, RenderSheetContent, RenderSheetFooter, RenderSheetHeader, RepeatLastActionPermission, ResetRangeTextColorCommand, ResetScrollCommand, SELECTION_SHAPE_DEPTH, SHEET_UI_PLUGIN_NAME, SHEET_VIEW_KEY, ScrollCommand, ScrollToCellCommand, ScrollToRangeOperation, SelectAllCommand, SelectionControl, SelectionControl as SelectionShape, SelectionShapeExtension, SetActivateCellEditOperation, SetCellEditVisibleArrowOperation, SetCellEditVisibleOperation, SetCellEditVisibleWithF2Operation, SetColumnFrozenCommand, SetColumnHeaderHeightCommand, SetFirstColumnFrozenCommand, SetFirstRowFrozenCommand, SetFormatPainterOperation, SetInfiniteFormatPainterCommand, SetOnceFormatPainterCommand, SetRangeBoldCommand, SetRangeFontDecreaseCommand, SetRangeFontFamilyCommand, SetRangeFontIncreaseCommand, SetRangeFontSizeCommand, SetRangeItalicCommand, SetRangeProtectionFromContextMenuCommand, SetRangeStrickThroughCommand, SetRangeSubscriptCommand, SetRangeSuperscriptCommand, SetRangeTextColorCommand, SetRangeUnderlineCommand, SetRowFrozenCommand, SetRowHeaderWidthCommand, SetScrollOperation, SetScrollRelativeCommand, SetSelectionFrozenCommand, SetWorksheetColAutoWidthCommand, SetZoomRatioCommand, SetZoomRatioOperation, SheetBar, SheetCanvasPopManagerService, SheetCellDropdownManagerService, SheetCellEditorResizeService, SheetClipboardController, SheetClipboardService, SheetCopyCommand, SheetCopyDownCommand, SheetCopyRightCommand, SheetCutCommand, SheetMenuPosition, SheetPasteBesidesBorderCommand, SheetPasteColWidthCommand, SheetPasteCommand, SheetPasteFormatCommand, SheetPasteShortKeyCommand, SheetPasteValueCommand, SheetPermissionCheckUIController, SheetPermissionOpenDialogOperation, SheetPermissionOpenPanelOperation, SheetPermissionRenderManagerService, SheetPermissionUserManagerService, SheetPrintInterceptorService, SheetRenderController, SheetScrollManagerService, SheetSelectionRenderService, SheetSkeletonManagerService, SheetUIController, SheetsRenderService, SheetsScrollRenderController, menuSchema as SheetsUIMenuSchema, SheetsUIPart, ShowMenuListCommand, SidebarDefinedNameOperation, StatusBarController, StatusBarService, UNIVER_SHEET_PERMISSION_USER_PART, UniverSheetsMobileUIPlugin, UniverSheetsUIPlugin, ViewSheetPermissionFromContextMenuCommand, ViewSheetPermissionFromSheetBarCommand, calculateDocSkeletonRects, matchedSelectionByRowColIndex as checkInHeaderRanges, deriveStateFromActiveSheet$, functionDisplayNames, genNormalSelectionStyle, genSelectionByRange, selectionDataForSelectAll as getAllSelection, getCellRealRange, getCoordByCell, getCoordByOffset, getCurrentExclusiveRangeInterest$, getCurrentRangeDisable$, getCustomRangePosition, getEditingCustomRangePosition, getEditorObject, getMatrixPlainText, getObservableWithExclusiveRange$, getRepeatRange, getSheetObject, getTopLeftSelectionOfCurrSheet, getTransformCoord, getViewportByCell, isEmbeddingFormulaEditor, isRangeSelector, menuClipboardDisabledObservable, mergeSetRangeValues, useActiveWorkbook, useActiveWorksheet, useHighlightRange, useKeyEventConfig, useWorkbooks, virtualizeDiscreteRanges, whenFormulaEditorActivated, whenSheetEditorActivated, whenSheetEditorFocused };