@univerjs/sheets-ui 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -11460,6 +11460,29 @@ function processNumberStringWithSpaces(token, numStr) {
11460
11460
  };
11461
11461
  }
11462
11462
 
11463
+ //#endregion
11464
+ //#region src/controllers/editor/utils/get-edit-cell-input-position.ts
11465
+ /**
11466
+ * Get the position of the hidden editor input for the current edit cell.
11467
+ *
11468
+ * The OS anchors the IME candidate window to the focused input, so the input should stay on the
11469
+ * selected cell even before the cell editor opens. The position is kept inside the sheet canvas,
11470
+ * so a cell scrolled out of view never moves the input outside the sheet.
11471
+ */
11472
+ function getEditCellInputPosition(layout, canvasSize) {
11473
+ const { position, canvasOffset } = layout;
11474
+ const x = canvasOffset.left + position.startX;
11475
+ const y = canvasOffset.top + position.startY;
11476
+ if (!canvasSize) return {
11477
+ x,
11478
+ y
11479
+ };
11480
+ return {
11481
+ x: Math.min(Math.max(x, canvasOffset.left), canvasOffset.left + canvasSize.width),
11482
+ y: Math.min(Math.max(y, canvasOffset.top), canvasOffset.top + canvasSize.height)
11483
+ };
11484
+ }
11485
+
11463
11486
  //#endregion
11464
11487
  //#region src/controllers/editor/utils/is-range-selector.ts
11465
11488
  /**
@@ -11676,7 +11699,11 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
11676
11699
  if ((cellSelectionRenderManager === null || cellSelectionRenderManager === void 0 ? void 0 : cellSelectionRenderManager.canFocusing) || (formulaSelectionRenderManager === null || formulaSelectionRenderManager === void 0 ? void 0 : formulaSelectionRenderManager.canFocusing)) {
11677
11700
  this._univerInstanceService.setCurrentUnitForType(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
11678
11701
  if (this._contextService.getContextValue(_univerjs_ui.DISABLE_AUTO_FOCUS_KEY)) cellSelectionRenderManager === null || cellSelectionRenderManager === void 0 || cellSelectionRenderManager.setInputPosition(HIDDEN_EDITOR_POSITION$1, HIDDEN_EDITOR_POSITION$1);
11679
- else cellSelectionRenderManager === null || cellSelectionRenderManager === void 0 || cellSelectionRenderManager.activate(HIDDEN_EDITOR_POSITION$1, HIDDEN_EDITOR_POSITION$1, true);
11702
+ else {
11703
+ var _this$_renderManagerS5;
11704
+ const { x, y } = getEditCellInputPosition(state, (_this$_renderManagerS5 = this._renderManagerService.getRenderUnitById(state.unitId)) === null || _this$_renderManagerS5 === void 0 ? void 0 : _this$_renderManagerS5.engine);
11705
+ cellSelectionRenderManager === null || cellSelectionRenderManager === void 0 || cellSelectionRenderManager.activate(x, y, true);
11706
+ }
11680
11707
  }
11681
11708
  }));
11682
11709
  }
@@ -11750,7 +11777,7 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
11750
11777
  }));
11751
11778
  }
11752
11779
  _handleEditorVisible(param) {
11753
- var _documentDataModel$ge, _this$_renderManagerS6;
11780
+ var _documentDataModel$ge, _this$_renderManagerS7;
11754
11781
  const { eventType, keycode } = param;
11755
11782
  this._cursorChange = eventType === _univerjs_engine_render.DeviceInputEventType.PointerDown || eventType === _univerjs_engine_render.DeviceInputEventType.Dblclick ? 2 : 1;
11756
11783
  const editCellState = this._editorBridgeService.getEditLocation();
@@ -11779,8 +11806,8 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
11779
11806
  const resetPointerSelection = isInArrayFormulaRange && eventType === _univerjs_engine_render.DeviceInputEventType.PointerDown;
11780
11807
  const editorId = this._contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR) ? _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY : this._editorBridgeService.getCurrentEditorId();
11781
11808
  if (resetPointerSelection) {
11782
- var _this$_renderManagerS5;
11783
- (_this$_renderManagerS5 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS5 === void 0 || _this$_renderManagerS5.with(_univerjs_docs_ui.DocSelectionRenderService).cancelPointerSelection();
11809
+ var _this$_renderManagerS6;
11810
+ (_this$_renderManagerS6 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS6 === void 0 || _this$_renderManagerS6.with(_univerjs_docs_ui.DocSelectionRenderService).cancelPointerSelection();
11784
11811
  }
11785
11812
  this._emptyDocumentDataModel(documentDataModel.getSnapshot().documentStyle, !!isInArrayFormulaRange);
11786
11813
  document.makeDirty();
@@ -11858,7 +11885,7 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
11858
11885
  collapsed: true
11859
11886
  });
11860
11887
  }
11861
- (_this$_renderManagerS6 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS6 === void 0 || _this$_renderManagerS6.scene.resetCursor();
11888
+ (_this$_renderManagerS7 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS7 === void 0 || _this$_renderManagerS7.scene.resetCursor();
11862
11889
  }
11863
11890
  _resizeEditorOnOpen(param, editorObject, isInArrayFormulaRange) {
11864
11891
  var _this$_sheetCellEdito4;
@@ -11874,8 +11901,8 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
11874
11901
  if (!pointerPosition || isInArrayFormulaRange) return;
11875
11902
  const rect = engine.getCanvasElement().getBoundingClientRect();
11876
11903
  if (rect.width > 0 && rect.height > 0) {
11877
- var _this$_renderManagerS7;
11878
- (_this$_renderManagerS7 = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS7 === void 0 || _this$_renderManagerS7.with(_univerjs_docs_ui.DocSelectionRenderService).setCursorManually((pointerPosition.x - rect.left) * engine.width / rect.width, (pointerPosition.y - rect.top) * engine.height / rect.height, true, true, { strict: false });
11904
+ var _this$_renderManagerS8;
11905
+ (_this$_renderManagerS8 = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS8 === void 0 || _this$_renderManagerS8.with(_univerjs_docs_ui.DocSelectionRenderService).setCursorManually((pointerPosition.x - rect.left) * engine.width / rect.width, (pointerPosition.y - rect.top) * engine.height / rect.height, true, true, { strict: false });
11879
11906
  }
11880
11907
  });
11881
11908
  }
@@ -12077,12 +12104,12 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
12077
12104
  return this._univerInstanceService.getUnit(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY, _univerjs_core.UniverInstanceType.UNIVER_DOC);
12078
12105
  }
12079
12106
  _getEditorSkeleton(editorId) {
12080
- var _this$_renderManagerS8;
12081
- return (_this$_renderManagerS8 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS8 === void 0 ? void 0 : _this$_renderManagerS8.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
12107
+ var _this$_renderManagerS9;
12108
+ return (_this$_renderManagerS9 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS9 === void 0 ? void 0 : _this$_renderManagerS9.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
12082
12109
  }
12083
12110
  _getEditorViewModel(editorId) {
12084
- var _this$_renderManagerS9;
12085
- return (_this$_renderManagerS9 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS9 === void 0 ? void 0 : _this$_renderManagerS9.with(_univerjs_docs.DocSkeletonManagerService).getViewModel();
12111
+ var _this$_renderManagerS10;
12112
+ return (_this$_renderManagerS10 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS10 === void 0 ? void 0 : _this$_renderManagerS10.with(_univerjs_docs.DocSkeletonManagerService).getViewModel();
12086
12113
  }
12087
12114
  _getEditingUnit() {
12088
12115
  return this._editingUnit ? this._univerInstanceService.getUnit(this._editingUnit, _univerjs_core.UniverInstanceType.UNIVER_SHEET) : null;
@@ -12140,13 +12167,13 @@ function getCellDataByInput(cellData, snapshot, lexerTreeBuilder, localeService,
12140
12167
  cellData.si = null;
12141
12168
  cellData.p = snapshot;
12142
12169
  cellData.t = _univerjs_core.CellValueType.STRING;
12143
- } else if (cellData.s && (0, _univerjs_core.isTextFormat)(styles === null || styles === void 0 || (_styles$get = styles.get(cellData.s)) === null || _styles$get === void 0 || (_styles$get = _styles$get.n) === null || _styles$get === void 0 ? void 0 : _styles$get.pattern)) {
12170
+ } else if (newDataStream !== "" && cellData.s && (0, _univerjs_core.isTextFormat)(styles === null || styles === void 0 || (_styles$get = styles.get(cellData.s)) === null || _styles$get === void 0 || (_styles$get = _styles$get.n) === null || _styles$get === void 0 ? void 0 : _styles$get.pattern)) {
12144
12171
  cellData.v = newDataStream;
12145
12172
  cellData.f = null;
12146
12173
  cellData.si = null;
12147
12174
  cellData.p = null;
12148
12175
  cellData.t = _univerjs_core.CellValueType.STRING;
12149
- if (isRichText(body) && body.dataStream !== "\r\n") cellData.p = snapshot;
12176
+ if (isRichText(body)) cellData.p = snapshot;
12150
12177
  const style = getCellStyleBySnapshot(snapshot);
12151
12178
  if (style) cellData.s = style;
12152
12179
  } else if ((0, _univerjs_core.isFormulaString)(newDataStream)) {
@@ -12163,21 +12190,14 @@ function getCellDataByInput(cellData, snapshot, lexerTreeBuilder, localeService,
12163
12190
  cellData.si = null;
12164
12191
  cellData.p = null;
12165
12192
  cellData.t = _univerjs_core.CellValueType.FORCE_STRING;
12166
- } else if (isRichText(body)) {
12167
- if (body.dataStream === "\r\n") {
12168
- cellData.v = "";
12169
- cellData.f = null;
12170
- cellData.si = null;
12171
- cellData.p = null;
12172
- } else {
12173
- cellData.p = snapshot;
12174
- cellData.v = null;
12175
- cellData.f = null;
12176
- cellData.si = null;
12177
- }
12193
+ } else if (newDataStream !== "" && isRichText(body)) {
12194
+ cellData.p = snapshot;
12195
+ cellData.v = null;
12196
+ cellData.f = null;
12197
+ cellData.si = null;
12178
12198
  } else {
12179
- if (newDataStream === "" && cellData.v == null && cellData.p == null) return null;
12180
- cellData.v = newDataStream;
12199
+ if (newDataStream === "" && cellData.v == null && cellData.p == null && cellData.f == null && cellData.si == null) return null;
12200
+ cellData.v = newDataStream === "" ? null : newDataStream;
12181
12201
  cellData.f = null;
12182
12202
  cellData.si = null;
12183
12203
  cellData.p = null;
@@ -15897,7 +15917,7 @@ let HeaderResizeRenderController = class HeaderResizeRenderController extends _u
15897
15917
  if (Math.abs(initialType === 0 ? moveChangeY : moveChangeX) >= MINIMAL_OFFSET$1) isStartMove = true;
15898
15918
  if (initialType === 0) {
15899
15919
  if (moveChangeY > canvasMaxHeight - scrollBarHorizontalHeight + scrollXY.y - cell.startY) moveChangeY = canvasMaxHeight - scrollBarHorizontalHeight + scrollXY.y - cell.startY;
15900
- if (moveChangeY < -(cell.endY - cell.startY) + 2) moveChangeY = -(cell.endY - cell.startY) + 2;
15920
+ moveChangeY = Math.max(moveChangeY, -(cell.endY - cell.startY));
15901
15921
  if (isStartMove) {
15902
15922
  var _this$_resizeHelperSh, _this$_rowResizeRect4, _this$_rowResizeRect5;
15903
15923
  (_this$_resizeHelperSh = this._resizeHelperShape) === null || _this$_resizeHelperSh === void 0 || _this$_resizeHelperSh.transformByState({ top: currentOffsetY + moveChangeY });
@@ -15907,7 +15927,7 @@ let HeaderResizeRenderController = class HeaderResizeRenderController extends _u
15907
15927
  }
15908
15928
  } else {
15909
15929
  if (moveChangeX > canvasMaxWidth - scrollBarVerticalWidth + scrollXY.x - cell.startX) moveChangeX = canvasMaxWidth - scrollBarVerticalWidth + scrollXY.x - cell.startX;
15910
- if (moveChangeX < -(cell.endX - cell.startX) + 2) moveChangeX = -(cell.endX - cell.startX) + 2;
15930
+ moveChangeX = Math.max(moveChangeX, -(cell.endX - cell.startX));
15911
15931
  if (isStartMove) {
15912
15932
  var _this$_resizeHelperSh2, _this$_columnResizeRe4, _this$_columnResizeRe5;
15913
15933
  (_this$_resizeHelperSh2 = this._resizeHelperShape) === null || _this$_resizeHelperSh2 === void 0 || _this$_resizeHelperSh2.transformByState({ left: currentOffsetX + moveChangeX });
@@ -15917,7 +15937,7 @@ let HeaderResizeRenderController = class HeaderResizeRenderController extends _u
15917
15937
  }
15918
15938
  }
15919
15939
  });
15920
- this._scenePointerUpSub = scene.onPointerUp$.subscribeEvent((upEvt) => {
15940
+ this._scenePointerUpSub = scene.onPointerUp$.subscribeEvent(() => {
15921
15941
  var _this$_resizeHelperSh3;
15922
15942
  const scene = this._context.scene;
15923
15943
  this._clearObserverEvent();
@@ -16267,6 +16287,7 @@ let HeaderUnhideRenderController = class HeaderUnhideRenderController extends _u
16267
16287
  dispose() {
16268
16288
  super.dispose();
16269
16289
  this._clearShapes();
16290
+ this.interceptor.dispose();
16270
16291
  }
16271
16292
  _init() {
16272
16293
  let activeSheetId = "";
@@ -16295,18 +16316,54 @@ let HeaderUnhideRenderController = class HeaderUnhideRenderController extends _u
16295
16316
  if (!skeleton) return;
16296
16317
  const visibleCheck = this.interceptor.fetchThroughInterceptors(HEADER_UNHIDE_RANGE_VISIBLE_CHECK);
16297
16318
  const shouldRenderRange = (payload) => this._headerUnhideRangeService.shouldRenderRange(visibleCheck(true, payload) ?? true, payload);
16298
- const hiddenRowRanges = worksheet.getHiddenRows().filter((range) => shouldRenderRange({
16319
+ const zeroHeightRowRanges = [];
16320
+ const rowData = worksheet.getRowManager().getRowData();
16321
+ for (const rowIndex of Object.keys(rowData)) {
16322
+ const row = Number(rowIndex);
16323
+ if (row >= 0 && row < worksheet.getRowCount() && worksheet.getRowVisible(row) && worksheet.getRowHeight(row) === 0) zeroHeightRowRanges.push({
16324
+ startRow: row,
16325
+ endRow: row,
16326
+ startColumn: 0,
16327
+ endColumn: worksheet.getColumnCount() - 1
16328
+ });
16329
+ }
16330
+ const rowRanges = [...worksheet.getHiddenRows(), ..._univerjs_core.Rectangle.mergeRanges(zeroHeightRowRanges)].map((range) => ({
16331
+ ...range,
16332
+ rangeType: _univerjs_core.RANGE_TYPE.ROW
16333
+ })).filter((range) => shouldRenderRange({
16299
16334
  axis: "row",
16300
16335
  range,
16301
16336
  workbook,
16302
16337
  worksheet
16303
16338
  }));
16304
- const hiddenColRanges = worksheet.getHiddenCols().filter((range) => shouldRenderRange({
16339
+ const hiddenRowRanges = _univerjs_core.Rectangle.mergeRanges(rowRanges).map((range) => ({
16340
+ ...range,
16341
+ rangeType: _univerjs_core.RANGE_TYPE.ROW
16342
+ }));
16343
+ const zeroWidthColRanges = [];
16344
+ const columnData = worksheet.getColumnManager().getColumnData();
16345
+ for (const columnIndex of Object.keys(columnData)) {
16346
+ const column = Number(columnIndex);
16347
+ if (column >= 0 && column < worksheet.getColumnCount() && worksheet.getColVisible(column) && worksheet.getColumnWidth(column) === 0) zeroWidthColRanges.push({
16348
+ startRow: 0,
16349
+ endRow: worksheet.getRowCount() - 1,
16350
+ startColumn: column,
16351
+ endColumn: column
16352
+ });
16353
+ }
16354
+ const columnRanges = [...worksheet.getHiddenCols(), ..._univerjs_core.Rectangle.mergeRanges(zeroWidthColRanges)].map((range) => ({
16355
+ ...range,
16356
+ rangeType: _univerjs_core.RANGE_TYPE.COLUMN
16357
+ })).filter((range) => shouldRenderRange({
16305
16358
  axis: "column",
16306
16359
  range,
16307
16360
  workbook,
16308
16361
  worksheet
16309
16362
  }));
16363
+ const hiddenColRanges = _univerjs_core.Rectangle.mergeRanges(columnRanges).map((range) => ({
16364
+ ...range,
16365
+ rangeType: _univerjs_core.RANGE_TYPE.COLUMN
16366
+ }));
16310
16367
  const { scene } = this._getSheetObject();
16311
16368
  const rowCount = worksheet.getRowCount();
16312
16369
  const rowShapes = hiddenRowRanges.map((range) => {
@@ -18373,11 +18430,7 @@ const MenuItemInput = (props) => {
18373
18430
  if (compositionEndTimerRef.current !== null) clearTimeout(compositionEndTimerRef.current);
18374
18431
  }, []);
18375
18432
  const handleChange = (value) => {
18376
- if (!value) {
18377
- setInputValue(min.toString());
18378
- return;
18379
- }
18380
- const inputValue = value.toString();
18433
+ const inputValue = (value ?? min).toString();
18381
18434
  setInputValue(inputValue);
18382
18435
  onChange(inputValue);
18383
18436
  };
@@ -19101,7 +19154,7 @@ function TextColorSelectorMenuItemFactory(accessor) {
19101
19154
  type: _univerjs_ui.MenuItemType.BUTTON_SELECTOR,
19102
19155
  selections: [{
19103
19156
  label: {
19104
- name: _univerjs_ui.COLOR_PICKER_COMPONENT,
19157
+ name: _univerjs_docs_ui.EditorColorPicker.componentKey,
19105
19158
  hoverable: false,
19106
19159
  selectable: false
19107
19160
  },
@@ -19155,7 +19208,7 @@ function BackgroundColorSelectorMenuItemFactory(accessor) {
19155
19208
  icon: "PaintBucketDoubleIcon",
19156
19209
  selections: [{
19157
19210
  label: {
19158
- name: _univerjs_ui.COLOR_PICKER_COMPONENT,
19211
+ name: _univerjs_docs_ui.EditorColorPicker.componentKey,
19159
19212
  hoverable: false,
19160
19213
  selectable: false
19161
19214
  },
@@ -19763,7 +19816,7 @@ function SetRowHeightMenuItemFactory(accessor) {
19763
19816
  const commandService = accessor.get(_univerjs_core.ICommandService);
19764
19817
  const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
19765
19818
  const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
19766
- const min = 2;
19819
+ const min = 0;
19767
19820
  return {
19768
19821
  id: _univerjs_sheets.SetRowHeightCommand.id,
19769
19822
  type: _univerjs_ui.MenuItemType.BUTTON,
@@ -19802,7 +19855,7 @@ function SetColWidthMenuItemFactory(accessor) {
19802
19855
  const commandService = accessor.get(_univerjs_core.ICommandService);
19803
19856
  const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
19804
19857
  const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
19805
- const min = 2;
19858
+ const min = 0;
19806
19859
  return {
19807
19860
  id: _univerjs_sheets.SetColWidthCommand.id,
19808
19861
  type: _univerjs_ui.MenuItemType.BUTTON,
@@ -20354,15 +20407,35 @@ function RenameSheetMenuItemFactory(accessor) {
20354
20407
  };
20355
20408
  }
20356
20409
  function ChangeColorSheetMenuItemFactory(accessor) {
20410
+ const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
20411
+ const commandService = accessor.get(_univerjs_core.ICommandService);
20357
20412
  return {
20358
20413
  id: _univerjs_sheets.SetTabColorCommand.id,
20359
20414
  title: "sheets-ui.sheetConfig.changeColor",
20360
20415
  type: _univerjs_ui.MenuItemType.SELECTOR,
20361
- selections: [{ label: {
20362
- name: _univerjs_ui.COLOR_PICKER_COMPONENT,
20363
- hoverable: false,
20364
- selectable: false
20365
- } }],
20416
+ selections: [{
20417
+ label: "sheets-ui.toolbar.resetColor",
20418
+ icon: "NoColorDoubleIcon",
20419
+ value: ""
20420
+ }, {
20421
+ label: {
20422
+ name: _univerjs_docs_ui.EditorColorPicker.componentKey,
20423
+ hoverable: false,
20424
+ selectable: false
20425
+ },
20426
+ value$: new rxjs.Observable((subscriber) => {
20427
+ const updateColor = () => {
20428
+ var _workbook$getActiveSh;
20429
+ const workbook = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
20430
+ subscriber.next((workbook === null || workbook === void 0 || (_workbook$getActiveSh = workbook.getActiveSheet()) === null || _workbook$getActiveSh === void 0 ? void 0 : _workbook$getActiveSh.getTabColor()) ?? "");
20431
+ };
20432
+ updateColor();
20433
+ const disposable = commandService.onCommandExecuted(({ id }) => {
20434
+ if (id === _univerjs_sheets.SetTabColorMutation.id || id === _univerjs_sheets.SetWorksheetActiveOperation.id) updateColor();
20435
+ });
20436
+ return () => disposable.dispose();
20437
+ })
20438
+ }],
20366
20439
  hidden$: getWorkbookPermissionDisable$(accessor, [_univerjs_sheets.WorkbookEditablePermission])
20367
20440
  };
20368
20441
  }
@@ -22796,6 +22869,7 @@ function keepTextSelected(inputHtml) {
22796
22869
  if (!selection) return;
22797
22870
  const range = document.createRange();
22798
22871
  range.selectNodeContents(inputHtml);
22872
+ if (!getEditorText(inputHtml)) range.collapse(true);
22799
22873
  selection.removeAllRanges();
22800
22874
  selection.addRange(range);
22801
22875
  });
@@ -23695,7 +23769,7 @@ function SheetBarTabs() {
23695
23769
  embedChildType != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EmbedSheetTabProductIcon, { childType: embedChildType }),
23696
23770
  hasProtection && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.LockIcon, { className: "univer-shrink-0" }),
23697
23771
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
23698
- className: "univer-truncate univer-outline-none",
23772
+ className: "univer-min-w-px univer-truncate univer-outline-none",
23699
23773
  children: sheet.getName()
23700
23774
  })
23701
23775
  ] }),
@@ -25072,7 +25146,7 @@ const useHighlightRange = (ranges = []) => {
25072
25146
  //#endregion
25073
25147
  //#region package.json
25074
25148
  var name = "@univerjs/sheets-ui";
25075
- var version = "1.1.0";
25149
+ var version = "1.3.0";
25076
25150
 
25077
25151
  //#endregion
25078
25152
  //#region src/views/cell-popup/config.ts
@@ -27589,7 +27663,7 @@ const DefinedNameContainer = ({ ConfirmComponent = _univerjs_design.Confirm, Def
27589
27663
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
27590
27664
  className: "univer-my-1 univer-max-h-[100px] univer-max-w-[190px] univer-truncate univer-text-sm univer-font-medium univer-text-gray-900 dark:!univer-text-gray-0",
27591
27665
  children: [definedName.name, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
27592
- className: "univer-text-xxs univer-ml-1 univer-text-gray-400",
27666
+ className: "univer-ml-1 univer-text-xs univer-text-gray-400",
27593
27667
  children: definedName.localSheetId === _univerjs_sheets.SCOPE_WORKBOOK_VALUE_DEFINED_NAME || definedName.localSheetId == null ? "" : getSheetNameBySheetId(definedName.localSheetId)
27594
27668
  })]
27595
27669
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -28717,7 +28791,7 @@ function SheetPermissionPanelListContent({ ActionRowComponent }) {
28717
28791
  }).filter((r) => !!r).join(",") : ""})`;
28718
28792
  } else if (rule.unitType === _univerjs_protocol.UnitObject.Worksheet) ruleName = targetName || "";
28719
28793
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
28720
- className: (0, _univerjs_design.clsx)("univer-mt-3 univer-rounded-lg univer-p-3 hover:univer-bg-gray-50", _univerjs_design.borderClassName),
28794
+ className: (0, _univerjs_design.clsx)("univer-mt-3 univer-rounded-lg univer-p-3 hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800", _univerjs_design.borderClassName),
28721
28795
  onMouseMove: () => {
28722
28796
  const { subUnitId, unitType } = rule;
28723
28797
  const activeSheet = workbook.getActiveSheet();
@@ -28751,14 +28825,14 @@ function SheetPermissionPanelListContent({ ActionRowComponent }) {
28751
28825
  children: [hasManagerPermission && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
28752
28826
  title: localeService.t("sheets-ui.permission.panel.edit"),
28753
28827
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
28754
- className: "univer-box-border univer-h-6 univer-rounded-sm univer-p-1 hover:univer-bg-gray-200",
28828
+ className: "univer-box-border univer-h-6 univer-rounded-sm univer-p-1 hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-700",
28755
28829
  onClick: () => handleEdit(rule),
28756
28830
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.WriteIcon, {})
28757
28831
  })
28758
28832
  }), hasDeletePermission && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
28759
28833
  title: localeService.t("sheets-ui.permission.panel.delete"),
28760
28834
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
28761
- className: "univer-box-border univer-h-6 univer-rounded-sm univer-p-1 hover:univer-bg-gray-200",
28835
+ className: "univer-box-border univer-h-6 univer-rounded-sm univer-p-1 hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-700",
28762
28836
  onClick: () => handleDelete(rule),
28763
28837
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DeleteIcon, {})
28764
28838
  })
@@ -28801,7 +28875,7 @@ function SheetPermissionPanelListContent({ ActionRowComponent }) {
28801
28875
  rule.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
28802
28876
  title: rule.description,
28803
28877
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
28804
- className: "univer-text-3 univer-mt-2 univer-max-w-64 univer-truncate univer-text-sm univer-text-gray-400",
28878
+ className: "univer-mt-2 univer-max-w-64 univer-truncate univer-text-sm univer-text-gray-400",
28805
28879
  children: rule.description
28806
28880
  })
28807
28881
  })
@@ -32116,7 +32190,6 @@ let SheetUIMobileController = class SheetUIMobileController extends _univerjs_co
32116
32190
  const visualViewport = window.visualViewport;
32117
32191
  let stableHeight = Math.round(window.innerHeight);
32118
32192
  let stableWidth = Math.round(window.innerWidth);
32119
- let keyboardWasVisible = false;
32120
32193
  const update = () => {
32121
32194
  const width = Math.round(window.innerWidth);
32122
32195
  const visibleBottom = visualViewport ? visualViewport.offsetTop + visualViewport.height : window.innerHeight;
@@ -32126,15 +32199,6 @@ let SheetUIMobileController = class SheetUIMobileController extends _univerjs_co
32126
32199
  } else if (!isMobileKeyboardVisible(stableHeight, visibleBottom)) stableHeight = Math.round(Math.max(stableHeight, window.innerHeight, visibleBottom));
32127
32200
  const keyboardVisible = isMobileKeyboardVisible(stableHeight, visibleBottom);
32128
32201
  this._contextService.setContextValue(MOBILE_KEYBOARD_VISIBLE, keyboardVisible);
32129
- if (shouldHideMobileEditorOnKeyboardClose(keyboardWasVisible && !keyboardVisible, this._contextService.getContextValue("MOBILE_FX_EDITOR_EXPANDED"), this._contextService.getContextValue("MOBILE_FORMULA_FUNCTION_PANEL_OPEN"), this._editorBridgeService.isForceKeepVisible())) {
32130
- const visibleState = this._editorBridgeService.isVisible();
32131
- if (visibleState.visible) this._commandService.executeCommand(SetCellEditVisibleOperation.id, {
32132
- ...visibleState,
32133
- visible: false,
32134
- eventType: _univerjs_engine_render.DeviceInputEventType.PointerDown
32135
- });
32136
- }
32137
- keyboardWasVisible = keyboardVisible;
32138
32202
  };
32139
32203
  update();
32140
32204
  window.addEventListener("resize", update);
@@ -32191,9 +32255,6 @@ SheetUIMobileController = __decorate([
32191
32255
  function isMobileKeyboardVisible(stableHeight, visibleBottom) {
32192
32256
  return stableHeight - visibleBottom > 80;
32193
32257
  }
32194
- function shouldHideMobileEditorOnKeyboardClose(keyboardClosed, editorExpanded, functionPanelOpen, forceKeepVisible) {
32195
- return keyboardClosed && !editorExpanded && !functionPanelOpen && !forceKeepVisible;
32196
- }
32197
32258
 
32198
32259
  //#endregion
32199
32260
  //#region src/controllers/move-range.controller.ts
@@ -32817,7 +32878,7 @@ let FormatPainterRenderController = class FormatPainterRenderController extends
32817
32878
  getTarget: (event) => {
32818
32879
  var _this$_selections$get, _this$_context$unit$g;
32819
32880
  const picked = this._context.scene.pick(new _univerjs_engine_render.Vector2(event.offsetX, event.offsetY));
32820
- if (picked && picked !== this._context.mainComponent) return null;
32881
+ if (picked && picked !== this._context.mainComponent && picked !== this._context.components.get("__SpreadsheetRowHeader__") && picked !== this._context.components.get("__SpreadsheetColumnHeader__")) return null;
32821
32882
  const range = (_this$_selections$get = this._selections.getCurrentLastSelection()) === null || _this$_selections$get === void 0 ? void 0 : _this$_selections$get.range;
32822
32883
  return range ? {
32823
32884
  unitId: this._context.unitId,
@@ -33144,27 +33205,22 @@ let MobileHeaderResizeRenderController = class MobileHeaderResizeRenderControlle
33144
33205
  _defineProperty(this, "_columnResizeButton", void 0);
33145
33206
  _defineProperty(this, "_resizeHelperShape", void 0);
33146
33207
  _defineProperty(this, "_isDragging", false);
33147
- _defineProperty(this, "_touchStartX", 0);
33148
- _defineProperty(this, "_touchStartY", 0);
33149
- _defineProperty(this, "_touchMoveHandler", void 0);
33150
- _defineProperty(this, "_touchEndHandler", void 0);
33208
+ _defineProperty(this, "_resizeListeners", void 0);
33151
33209
  _defineProperty(this, "_selectionSubscription", void 0);
33152
33210
  _defineProperty(this, "_scrollSubscription", void 0);
33153
33211
  this._init();
33154
33212
  }
33155
33213
  dispose() {
33156
- var _this$_rowResizeButto, _this$_columnResizeBu, _this$_resizeHelperSh, _this$_selectionSubsc, _this$_scrollSubscrip;
33214
+ var _this$_rowResizeButto, _this$_columnResizeBu, _this$_selectionSubsc, _this$_scrollSubscrip;
33215
+ this._cancelResize();
33157
33216
  (_this$_rowResizeButto = this._rowResizeButton) === null || _this$_rowResizeButto === void 0 || _this$_rowResizeButto.dispose();
33158
33217
  this._rowResizeButton = null;
33159
33218
  (_this$_columnResizeBu = this._columnResizeButton) === null || _this$_columnResizeBu === void 0 || _this$_columnResizeBu.dispose();
33160
33219
  this._columnResizeButton = null;
33161
- (_this$_resizeHelperSh = this._resizeHelperShape) === null || _this$_resizeHelperSh === void 0 || _this$_resizeHelperSh.dispose();
33162
- this._resizeHelperShape = null;
33163
33220
  (_this$_selectionSubsc = this._selectionSubscription) === null || _this$_selectionSubsc === void 0 || _this$_selectionSubsc.unsubscribe();
33164
33221
  this._selectionSubscription = null;
33165
33222
  (_this$_scrollSubscrip = this._scrollSubscription) === null || _this$_scrollSubscrip === void 0 || _this$_scrollSubscrip.unsubscribe();
33166
33223
  this._scrollSubscription = null;
33167
- this._cleanupTouchHandlers();
33168
33224
  super.dispose();
33169
33225
  }
33170
33226
  _init() {
@@ -33185,8 +33241,8 @@ let MobileHeaderResizeRenderController = class MobileHeaderResizeRenderControlle
33185
33241
  zIndex: 100
33186
33242
  });
33187
33243
  scene.addObjects([this._rowResizeButton, this._columnResizeButton], 10);
33188
- this._bindTouchEventsToButton(this._rowResizeButton, "row");
33189
- this._bindTouchEventsToButton(this._columnResizeButton, "column");
33244
+ this._bindPointerEventsToButton(this._rowResizeButton, "row");
33245
+ this._bindPointerEventsToButton(this._columnResizeButton, "column");
33190
33246
  }
33191
33247
  _initSelectionListener() {
33192
33248
  this._selectionSubscription = this._selectionManagerService.selectionMoveEnd$.subscribe((selections) => {
@@ -33271,12 +33327,13 @@ let MobileHeaderResizeRenderController = class MobileHeaderResizeRenderControlle
33271
33327
  });
33272
33328
  }
33273
33329
  }
33274
- _bindTouchEventsToButton(button, type) {
33275
- button.onPointerDown$.subscribeEvent((evt) => {
33330
+ _bindPointerEventsToButton(button, type) {
33331
+ this.disposeWithMe(button.onPointerDown$.subscribeEvent((evt) => {
33332
+ if (evt.button !== 0) return;
33276
33333
  if (this._contextService.getContextValue("MOBILE_PINCH_ZOOMING")) return;
33277
33334
  if (this._contextService.getContextValue("MOBILE_EXPANDING_SELECTION")) return;
33278
33335
  this._startResize(evt, type);
33279
- });
33336
+ }));
33280
33337
  }
33281
33338
  _startResize(evt, type) {
33282
33339
  const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
@@ -33285,69 +33342,80 @@ let MobileHeaderResizeRenderController = class MobileHeaderResizeRenderControlle
33285
33342
  const engine = scene.getEngine();
33286
33343
  const canvasElement = engine === null || engine === void 0 ? void 0 : engine.getCanvasElement();
33287
33344
  if (!canvasElement) return;
33288
- this._touchStartX = evt.offsetX;
33289
- this._touchStartY = evt.offsetY;
33290
- this._isDragging = false;
33345
+ this._cancelResize();
33291
33346
  const currentOffset = type === "row" ? skeleton.getOffsetByRow(this._currentRow) : skeleton.getOffsetByColumn(this._currentColumn);
33292
33347
  this._createResizeHelper(type, currentOffset, skeleton);
33293
33348
  scene.disableObjectsEvent();
33294
- this._setupTouchHandlers(canvasElement, type, currentOffset);
33349
+ this._setupPointerHandlers(canvasElement, evt, type, currentOffset);
33295
33350
  }
33296
- _setupTouchHandlers(canvasElement, type, initialOffset) {
33297
- if (!this._sheetSkeletonManagerService.getCurrentSkeleton()) return;
33298
- const scene = this._context.scene;
33351
+ _setupPointerHandlers(canvasElement, evt, type, initialOffset) {
33299
33352
  const worksheet = this._context.unit.getActiveSheet();
33300
- const zoomRatio = (worksheet === null || worksheet === void 0 ? void 0 : worksheet.getZoomRatio()) || 1;
33353
+ if (!worksheet) {
33354
+ this._cancelResize();
33355
+ return;
33356
+ }
33357
+ const zoomRatio = worksheet.getZoomRatio() || 1;
33358
+ const initialSize = type === "row" ? worksheet.getRowHeight(this._currentRow) : worksheet.getColumnWidth(this._currentColumn);
33359
+ const anchor = type === "row" ? this._currentRow : this._currentColumn;
33360
+ const pointerId = "pointerId" in evt ? evt.pointerId : 0;
33361
+ const startX = evt.offsetX;
33362
+ const startY = evt.offsetY;
33301
33363
  let totalDelta = 0;
33302
- this._touchMoveHandler = (e) => {
33364
+ const handlePointerMove = (e) => {
33365
+ if (e.pointerId !== pointerId) return;
33303
33366
  if (this._contextService.getContextValue("MOBILE_PINCH_ZOOMING")) {
33304
33367
  this._cancelResize();
33305
33368
  return;
33306
33369
  }
33307
- if (e.touches.length !== 1) return;
33308
- const touch = e.touches[0];
33309
33370
  const rect = canvasElement.getBoundingClientRect();
33310
- const offsetX = touch.clientX - rect.left;
33311
- const offsetY = touch.clientY - rect.top;
33312
- const adjustedDelta = (type === "row" ? offsetY - this._touchStartY : offsetX - this._touchStartX) / zoomRatio;
33371
+ const offsetX = e.clientX - rect.left;
33372
+ const offsetY = e.clientY - rect.top;
33373
+ const adjustedDelta = (type === "row" ? offsetY - startY : offsetX - startX) / zoomRatio;
33313
33374
  if (Math.abs(adjustedDelta) >= MINIMAL_OFFSET) this._isDragging = true;
33314
33375
  if (this._isDragging) {
33315
- totalDelta = adjustedDelta;
33316
- this._updateResizeHelper(type, initialOffset + adjustedDelta);
33317
- this._updateResizeButton(type, initialOffset + adjustedDelta);
33376
+ totalDelta = Math.max(adjustedDelta, -initialSize);
33377
+ this._updateResizeHelper(type, initialOffset + totalDelta);
33378
+ this._updateResizeButton(type, initialOffset + totalDelta);
33318
33379
  }
33319
33380
  e.preventDefault();
33320
33381
  };
33321
- this._touchEndHandler = (e) => {
33322
- scene.enableObjectsEvent();
33323
- if (this._isDragging && Math.abs(totalDelta) >= MINIMAL_OFFSET) {
33324
- if (type === "row") this._commandService.executeCommand(_univerjs_sheets.DeltaRowHeightCommand.id, {
33325
- deltaY: totalDelta,
33326
- anchorRow: this._currentRow
33327
- });
33328
- else this._commandService.executeCommand(_univerjs_sheets.DeltaColumnWidthCommand.id, {
33329
- deltaX: totalDelta,
33330
- anchorCol: this._currentColumn
33331
- });
33332
- }
33382
+ const handlePointerUp = async (e) => {
33383
+ if (e.pointerId !== pointerId) return;
33384
+ const shouldResize = this._isDragging && totalDelta !== 0;
33333
33385
  this._cleanupResize();
33334
- if (this._touchMoveHandler) canvasElement.removeEventListener("touchmove", this._touchMoveHandler);
33335
- if (this._touchEndHandler) {
33336
- canvasElement.removeEventListener("touchend", this._touchEndHandler);
33337
- canvasElement.removeEventListener("touchcancel", this._touchEndHandler);
33338
- }
33339
33386
  e.preventDefault();
33387
+ if (shouldResize) await this._commandService.executeCommand(type === "row" ? _univerjs_sheets.DeltaRowHeightCommand.id : _univerjs_sheets.DeltaColumnWidthCommand.id, type === "row" ? {
33388
+ deltaY: totalDelta,
33389
+ anchorRow: anchor
33390
+ } : {
33391
+ deltaX: totalDelta,
33392
+ anchorCol: anchor
33393
+ });
33340
33394
  };
33341
- canvasElement.addEventListener("touchmove", this._touchMoveHandler, { passive: false });
33342
- canvasElement.addEventListener("touchend", this._touchEndHandler, { passive: false });
33343
- canvasElement.addEventListener("touchcancel", this._touchEndHandler, { passive: false });
33344
- this.disposeWithMe((0, _univerjs_core.toDisposable)(() => {
33345
- if (this._touchMoveHandler) canvasElement.removeEventListener("touchmove", this._touchMoveHandler);
33346
- if (this._touchEndHandler) {
33347
- canvasElement.removeEventListener("touchend", this._touchEndHandler);
33348
- canvasElement.removeEventListener("touchcancel", this._touchEndHandler);
33349
- }
33350
- }));
33395
+ this._bindResizeListeners(canvasElement, pointerId, handlePointerMove, handlePointerUp);
33396
+ }
33397
+ _bindResizeListeners(canvasElement, pointerId, handlePointerMove, handlePointerUp) {
33398
+ const ownerDocument = canvasElement.ownerDocument;
33399
+ const ownerWindow = ownerDocument.defaultView;
33400
+ const handlePointerCancel = (e) => {
33401
+ if (e.pointerId === pointerId) this._cancelResize();
33402
+ };
33403
+ const handlePointerDown = (e) => {
33404
+ if (e.pointerId !== pointerId) this._cancelResize();
33405
+ };
33406
+ const handleBlur = () => this._cancelResize();
33407
+ ownerDocument.addEventListener("pointermove", handlePointerMove, { passive: false });
33408
+ ownerDocument.addEventListener("pointerup", handlePointerUp);
33409
+ ownerDocument.addEventListener("pointercancel", handlePointerCancel);
33410
+ ownerDocument.addEventListener("pointerdown", handlePointerDown);
33411
+ ownerWindow === null || ownerWindow === void 0 || ownerWindow.addEventListener("blur", handleBlur);
33412
+ this._resizeListeners = (0, _univerjs_core.toDisposable)(() => {
33413
+ ownerDocument.removeEventListener("pointermove", handlePointerMove);
33414
+ ownerDocument.removeEventListener("pointerup", handlePointerUp);
33415
+ ownerDocument.removeEventListener("pointercancel", handlePointerCancel);
33416
+ ownerDocument.removeEventListener("pointerdown", handlePointerDown);
33417
+ ownerWindow === null || ownerWindow === void 0 || ownerWindow.removeEventListener("blur", handleBlur);
33418
+ });
33351
33419
  }
33352
33420
  _createResizeHelper(type, offset, skeleton) {
33353
33421
  const scene = this._context.scene;
@@ -33388,30 +33456,18 @@ let MobileHeaderResizeRenderController = class MobileHeaderResizeRenderControlle
33388
33456
  else button.transformByState({ left: newOffset - buttonSize / 2 });
33389
33457
  }
33390
33458
  _cleanupResize() {
33391
- var _this$_resizeHelperSh2;
33392
- (_this$_resizeHelperSh2 = this._resizeHelperShape) === null || _this$_resizeHelperSh2 === void 0 || _this$_resizeHelperSh2.dispose();
33459
+ var _this$_resizeListener, _this$_resizeHelperSh;
33460
+ (_this$_resizeListener = this._resizeListeners) === null || _this$_resizeListener === void 0 || _this$_resizeListener.dispose();
33461
+ this._resizeListeners = null;
33462
+ this._context.scene.enableObjectsEvent();
33463
+ (_this$_resizeHelperSh = this._resizeHelperShape) === null || _this$_resizeHelperSh === void 0 || _this$_resizeHelperSh.dispose();
33393
33464
  this._resizeHelperShape = null;
33394
33465
  this._isDragging = false;
33395
33466
  }
33396
- _cleanupTouchHandlers() {
33397
- const engine = this._context.scene.getEngine();
33398
- const canvasElement = engine === null || engine === void 0 ? void 0 : engine.getCanvasElement();
33399
- if (canvasElement) {
33400
- if (this._touchMoveHandler) {
33401
- canvasElement.removeEventListener("touchmove", this._touchMoveHandler);
33402
- this._touchMoveHandler = null;
33403
- }
33404
- if (this._touchEndHandler) {
33405
- canvasElement.removeEventListener("touchend", this._touchEndHandler);
33406
- canvasElement.removeEventListener("touchcancel", this._touchEndHandler);
33407
- this._touchEndHandler = null;
33408
- }
33409
- }
33410
- }
33411
33467
  _cancelResize() {
33412
- this._context.scene.enableObjectsEvent();
33468
+ if (!this._resizeHelperShape && !this._resizeListeners) return;
33413
33469
  this._cleanupResize();
33414
- this._cleanupTouchHandlers();
33470
+ this._updateButtonPositionOnScroll();
33415
33471
  }
33416
33472
  };
33417
33473
  MobileHeaderResizeRenderController = __decorate([
@@ -33425,6 +33481,7 @@ MobileHeaderResizeRenderController = __decorate([
33425
33481
  //#endregion
33426
33482
  //#region src/controllers/render-controllers/mobile/mobile-hover.render-controller.ts
33427
33483
  const TAP_MOVE_THRESHOLD = 10;
33484
+ const DOUBLE_TAP_MOVE_THRESHOLD = 20;
33428
33485
  const DOUBLE_TAP_DELAY = 500;
33429
33486
  function getPointerId(event) {
33430
33487
  return "pointerId" in event ? event.pointerId : void 0;
@@ -33500,6 +33557,7 @@ let MobileHoverRenderController = class MobileHoverRenderController extends _uni
33500
33557
  next: ([event, state]) => {
33501
33558
  state.stopPropagation();
33502
33559
  state.skipNextObservers = true;
33560
+ if (event.deviceType === _univerjs_engine_render.DeviceType.Touch) return;
33503
33561
  if (this._suppressEngineDoubleClick) {
33504
33562
  this._clearEngineDoubleClickSuppression();
33505
33563
  return;
@@ -33550,15 +33608,15 @@ let MobileHoverRenderController = class MobileHoverRenderController extends _uni
33550
33608
  return;
33551
33609
  }
33552
33610
  this._tapState = {
33553
- offsetX: event.offsetX,
33554
- offsetY: event.offsetY,
33611
+ clientX: event.clientX,
33612
+ clientY: event.clientY,
33555
33613
  pointerId: getPointerId(event)
33556
33614
  };
33557
33615
  }
33558
33616
  _updateTapState(event) {
33559
33617
  const pointerId = getPointerId(event);
33560
33618
  if (!this._tapState || pointerId != null && pointerId !== this._tapState.pointerId) return;
33561
- if (Math.abs(event.offsetX - this._tapState.offsetX) > TAP_MOVE_THRESHOLD || Math.abs(event.offsetY - this._tapState.offsetY) > TAP_MOVE_THRESHOLD) this._resetTapSequence();
33619
+ if (Math.abs(event.clientX - this._tapState.clientX) > TAP_MOVE_THRESHOLD || Math.abs(event.clientY - this._tapState.clientY) > TAP_MOVE_THRESHOLD) this._resetTapSequence();
33562
33620
  }
33563
33621
  _finishTap(event) {
33564
33622
  const tapState = this._tapState;
@@ -33568,14 +33626,28 @@ let MobileHoverRenderController = class MobileHoverRenderController extends _uni
33568
33626
  this._resetCompletedTap();
33569
33627
  return false;
33570
33628
  }
33571
- const completed = Math.abs(event.offsetX - tapState.offsetX) <= TAP_MOVE_THRESHOLD && Math.abs(event.offsetY - tapState.offsetY) <= TAP_MOVE_THRESHOLD && !this._contextService.getContextValue("MOBILE_PINCH_ZOOMING") && !this._contextService.getContextValue("MOBILE_EXPANDING_SELECTION") && !this._contextService.getContextValue("MOBILE_TRIGGER_CONTEXT_MENU");
33629
+ const completed = Math.abs(event.clientX - tapState.clientX) <= TAP_MOVE_THRESHOLD && Math.abs(event.clientY - tapState.clientY) <= TAP_MOVE_THRESHOLD && !this._contextService.getContextValue("MOBILE_PINCH_ZOOMING") && !this._contextService.getContextValue("MOBILE_EXPANDING_SELECTION") && !this._contextService.getContextValue("MOBILE_TRIGGER_CONTEXT_MENU");
33572
33630
  if (!completed) this._resetCompletedTap();
33573
33631
  return completed;
33574
33632
  }
33575
33633
  _completeTap(unitId, event) {
33634
+ const skeletonParam = this._sheetSkeletonManagerService.getCurrentParam();
33635
+ const cellIndex = skeletonParam && getCellIndexByOffsetWithMerge(event.offsetX, event.offsetY, this._context.scene, skeletonParam.skeleton);
33636
+ if (!cellIndex || !skeletonParam) {
33637
+ this._resetCompletedTap();
33638
+ return;
33639
+ }
33640
+ const cell = {
33641
+ unitId,
33642
+ subUnitId: skeletonParam.sheetId,
33643
+ row: cellIndex.actualRow,
33644
+ col: cellIndex.actualCol
33645
+ };
33646
+ const timeStamp = Number.isFinite(event.timeStamp) ? event.timeStamp : performance.now();
33576
33647
  const lastCompletedTap = this._lastCompletedTap;
33577
- if (lastCompletedTap && Math.abs(event.offsetX - lastCompletedTap.offsetX) <= TAP_MOVE_THRESHOLD && Math.abs(event.offsetY - lastCompletedTap.offsetY) <= TAP_MOVE_THRESHOLD) {
33648
+ if (lastCompletedTap && timeStamp >= lastCompletedTap.timeStamp && timeStamp - lastCompletedTap.timeStamp <= DOUBLE_TAP_DELAY && cell.unitId === lastCompletedTap.cell.unitId && cell.subUnitId === lastCompletedTap.cell.subUnitId && cell.row === lastCompletedTap.cell.row && cell.col === lastCompletedTap.cell.col && Math.abs(event.clientX - lastCompletedTap.clientX) <= DOUBLE_TAP_MOVE_THRESHOLD && Math.abs(event.clientY - lastCompletedTap.clientY) <= DOUBLE_TAP_MOVE_THRESHOLD) {
33578
33649
  this._resetCompletedTap();
33650
+ this._clearEngineDoubleClickSuppression();
33579
33651
  this._suppressEngineDoubleClick = true;
33580
33652
  this._suppressEngineDoubleClickTimer = setTimeout(() => {
33581
33653
  this._suppressEngineDoubleClick = false;
@@ -33586,9 +33658,10 @@ let MobileHoverRenderController = class MobileHoverRenderController extends _uni
33586
33658
  }
33587
33659
  this._resetCompletedTap();
33588
33660
  this._lastCompletedTap = {
33589
- offsetX: event.offsetX,
33590
- offsetY: event.offsetY,
33591
- pointerId: getPointerId(event)
33661
+ clientX: event.clientX,
33662
+ clientY: event.clientY,
33663
+ timeStamp,
33664
+ cell
33592
33665
  };
33593
33666
  this._completedTapTimer = setTimeout(() => this._resetCompletedTap(), DOUBLE_TAP_DELAY);
33594
33667
  }
@@ -35421,7 +35494,7 @@ _defineProperty(UniverSheetsMobileUIPlugin, "packageName", name);
35421
35494
  _defineProperty(UniverSheetsMobileUIPlugin, "version", version);
35422
35495
  _defineProperty(UniverSheetsMobileUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
35423
35496
  UniverSheetsMobileUIPlugin = __decorate([
35424
- (0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_engine_formula.UniverFormulaEnginePlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_ui.UniverMobileUIPlugin, _univerjs_docs_ui.UniverDocsUIPlugin),
35497
+ (0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_engine_formula.UniverFormulaEnginePlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_ui.UniverMobileUIPlugin, _univerjs_docs_ui.UniverDocsMobileUIPlugin),
35425
35498
  __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
35426
35499
  __decorateParam(2, _univerjs_engine_render.IRenderManagerService),
35427
35500
  __decorateParam(3, _univerjs_core.IConfigService),
@@ -35791,6 +35864,12 @@ let DesktopCellEditRenderController = class DesktopCellEditRenderController exte
35791
35864
  var _params;
35792
35865
  if (params === null || params === void 0 || (_params = params[params.length - 1]) === null || _params === void 0 ? void 0 : _params.primary) this._updateInputPosition();
35793
35866
  }));
35867
+ const viewportMain = this._context.scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
35868
+ if (viewportMain) d.add(viewportMain.onScrollEnd$.subscribeEvent(() => {
35869
+ if (this._editorBridgeService.isVisible().visible) return;
35870
+ this._editorBridgeService.refreshEditCellPosition(false);
35871
+ this._updateInputPosition();
35872
+ }));
35794
35873
  }
35795
35874
  _updateInputPosition() {
35796
35875
  var _this$_renderManagerS;
@@ -35798,8 +35877,8 @@ let DesktopCellEditRenderController = class DesktopCellEditRenderController exte
35798
35877
  const layout = this._editorBridgeService.getEditCellLayout();
35799
35878
  const docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs_ui.DocSelectionRenderService);
35800
35879
  if (!layout || !docSelectionRenderService) return;
35801
- const { position, canvasOffset } = layout;
35802
- docSelectionRenderService.setInputPosition(canvasOffset.left + position.startX, canvasOffset.top + position.startY);
35880
+ const { x, y } = getEditCellInputPosition(layout, this._context.engine);
35881
+ docSelectionRenderService.setInputPosition(x, y);
35803
35882
  }
35804
35883
  _focusCellEditorInput() {
35805
35884
  const focusedChildUnitId = (0, _univerjs_ui.getEmbedChildUnitId)(typeof document === "undefined" ? null : document.activeElement);