@univerjs/sheets-ui 1.0.0-alpha.2 → 1.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +47 -37
- package/lib/cjs/index.js +1161 -272
- package/lib/cjs/locale/ar-SA.js +5 -0
- package/lib/cjs/locale/ca-ES.js +5 -0
- package/lib/cjs/locale/de-DE.js +5 -0
- package/lib/cjs/locale/en-US.js +5 -0
- package/lib/cjs/locale/es-ES.js +6 -1
- package/lib/cjs/locale/fa-IR.js +5 -0
- package/lib/cjs/locale/fr-FR.js +5 -0
- package/lib/cjs/locale/id-ID.js +5 -0
- package/lib/cjs/locale/it-IT.js +5 -0
- package/lib/cjs/locale/ja-JP.js +5 -0
- package/lib/cjs/locale/ko-KR.js +5 -0
- package/lib/cjs/locale/pl-PL.js +5 -0
- package/lib/cjs/locale/pt-BR.js +5 -0
- package/lib/cjs/locale/ru-RU.js +5 -0
- package/lib/cjs/locale/sk-SK.js +5 -0
- package/lib/cjs/locale/vi-VN.js +5 -0
- package/lib/cjs/locale/zh-CN.js +5 -0
- package/lib/cjs/locale/zh-HK.js +5 -0
- package/lib/cjs/locale/zh-TW.js +5 -0
- package/lib/es/facade.js +47 -37
- package/lib/es/index.js +1140 -247
- package/lib/es/locale/ar-SA.js +5 -0
- package/lib/es/locale/ca-ES.js +5 -0
- package/lib/es/locale/de-DE.js +5 -0
- package/lib/es/locale/en-US.js +5 -0
- package/lib/es/locale/es-ES.js +6 -1
- package/lib/es/locale/fa-IR.js +5 -0
- package/lib/es/locale/fr-FR.js +5 -0
- package/lib/es/locale/id-ID.js +5 -0
- package/lib/es/locale/it-IT.js +5 -0
- package/lib/es/locale/ja-JP.js +5 -0
- package/lib/es/locale/ko-KR.js +5 -0
- package/lib/es/locale/pl-PL.js +5 -0
- package/lib/es/locale/pt-BR.js +5 -0
- package/lib/es/locale/ru-RU.js +5 -0
- package/lib/es/locale/sk-SK.js +5 -0
- package/lib/es/locale/vi-VN.js +5 -0
- package/lib/es/locale/zh-CN.js +5 -0
- package/lib/es/locale/zh-HK.js +5 -0
- package/lib/es/locale/zh-TW.js +5 -0
- package/lib/facade.js +47 -37
- package/lib/index.css +4 -0
- package/lib/index.js +1140 -247
- package/lib/locale/ar-SA.js +5 -0
- package/lib/locale/ca-ES.js +5 -0
- package/lib/locale/de-DE.js +5 -0
- package/lib/locale/en-US.js +5 -0
- package/lib/locale/es-ES.js +6 -1
- package/lib/locale/fa-IR.js +5 -0
- package/lib/locale/fr-FR.js +5 -0
- package/lib/locale/id-ID.js +5 -0
- package/lib/locale/it-IT.js +5 -0
- package/lib/locale/ja-JP.js +5 -0
- package/lib/locale/ko-KR.js +5 -0
- package/lib/locale/pl-PL.js +5 -0
- package/lib/locale/pt-BR.js +5 -0
- package/lib/locale/ru-RU.js +5 -0
- package/lib/locale/sk-SK.js +5 -0
- package/lib/locale/vi-VN.js +5 -0
- package/lib/locale/zh-CN.js +5 -0
- package/lib/locale/zh-HK.js +5 -0
- package/lib/locale/zh-TW.js +5 -0
- package/lib/types/commands/commands/set-scroll.command.d.ts +3 -0
- package/lib/types/controllers/editor/editing.render-controller.d.ts +1 -0
- package/lib/types/controllers/editor/formula-editor.controller.d.ts +1 -0
- package/lib/types/controllers/render-controllers/contextmenu.render-controller.d.ts +7 -2
- package/lib/types/controllers/render-controllers/editor-bridge.render-controller.d.ts +7 -1
- package/lib/types/controllers/render-controllers/header-unhide.render-controller.d.ts +0 -1
- package/lib/types/embed-tab-anchor.d.ts +23 -0
- package/lib/types/facade/f-univer.d.ts +1 -0
- package/lib/types/index.d.ts +16 -3
- package/lib/types/locale/en-US.d.ts +5 -0
- package/lib/types/services/canvas-pop-manager.service.d.ts +9 -0
- package/lib/types/services/cell-popup-manager.service.d.ts +1 -0
- package/lib/types/services/editor/cell-editor-resize.service.d.ts +4 -1
- package/lib/types/services/editor-bridge.service.d.ts +2 -0
- package/lib/types/services/print-interceptor.service.d.ts +8 -0
- package/lib/types/services/selection/base-selection-render.service.d.ts +1 -0
- package/lib/types/services/sheet-embed-integration.service.d.ts +126 -0
- package/lib/types/services/sheet-embed-runtime.service.d.ts +26 -0
- package/lib/types/services/sheet-host-chrome-override.service.d.ts +25 -0
- package/lib/types/services/sheet-skeleton-manager.service.d.ts +2 -0
- package/lib/types/views/border-panel/interface.d.ts +63 -2
- package/lib/types/views/editor-container/EditorContainer.d.ts +7 -5
- package/lib/types/{menu/mobile-menu.d.ts → views/editor-container/EditorContainer.spec.d.ts} +1 -1
- package/lib/types/views/editor-container/focus-editor.d.ts +25 -0
- package/lib/types/views/sheet-bar/sheet-bar-tabs/SheetBarItem.d.ts +2 -1
- package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-drag-sort.d.ts +1 -0
- package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/slide-tab-bar.d.ts +2 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +12 -12
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +15 -15
package/lib/cjs/index.js
CHANGED
|
@@ -1,31 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
//#region \0rolldown/runtime.js
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
-
key = keys[i];
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
14
|
-
__defProp(to, key, {
|
|
15
|
-
get: ((k) => from[k]).bind(null, key),
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return to;
|
|
22
|
-
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
-
value: mod,
|
|
25
|
-
enumerable: true
|
|
26
|
-
}) : target, mod));
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
2
|
let _univerjs_docs_ui = require("@univerjs/docs-ui");
|
|
30
3
|
let _univerjs_core = require("@univerjs/core");
|
|
31
4
|
let _univerjs_ui = require("@univerjs/ui");
|
|
@@ -37,7 +10,6 @@ let _univerjs_protocol = require("@univerjs/protocol");
|
|
|
37
10
|
let _univerjs_design = require("@univerjs/design");
|
|
38
11
|
let _univerjs_icons = require("@univerjs/icons");
|
|
39
12
|
let react = require("react");
|
|
40
|
-
react = __toESM(react);
|
|
41
13
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
42
14
|
let _univerjs_engine_formula = require("@univerjs/engine-formula");
|
|
43
15
|
let _univerjs_telemetry = require("@univerjs/telemetry");
|
|
@@ -489,6 +461,19 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
489
461
|
this._initSelectionThemeFromThemeService();
|
|
490
462
|
this._initMoving();
|
|
491
463
|
}
|
|
464
|
+
dispose() {
|
|
465
|
+
var _this$_escapeShortcut;
|
|
466
|
+
if (this._disposed) return;
|
|
467
|
+
this._clearUpdatingListeners();
|
|
468
|
+
this._reset();
|
|
469
|
+
(_this$_escapeShortcut = this._escapeShortcutDisposable) === null || _this$_escapeShortcut === void 0 || _this$_escapeShortcut.dispose();
|
|
470
|
+
this._escapeShortcutDisposable = null;
|
|
471
|
+
this._controlFillConfig$.complete();
|
|
472
|
+
this._selectionMoveEnd$.complete();
|
|
473
|
+
this._selectionMoving$.complete();
|
|
474
|
+
this._selectionMoveStart$.complete();
|
|
475
|
+
super.dispose();
|
|
476
|
+
}
|
|
492
477
|
/**
|
|
493
478
|
* If true, the selector will respond to the range of merged cells and automatically extend the selected range. If false, it will ignore the merged cells.
|
|
494
479
|
*/
|
|
@@ -665,10 +650,10 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
665
650
|
}
|
|
666
651
|
}
|
|
667
652
|
endSelection() {
|
|
668
|
-
var _this$
|
|
653
|
+
var _this$_escapeShortcut2;
|
|
669
654
|
this._clearUpdatingListeners();
|
|
670
655
|
this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
|
|
671
|
-
(_this$
|
|
656
|
+
(_this$_escapeShortcut2 = this._escapeShortcutDisposable) === null || _this$_escapeShortcut2 === void 0 || _this$_escapeShortcut2.dispose();
|
|
672
657
|
this._escapeShortcutDisposable = null;
|
|
673
658
|
}
|
|
674
659
|
/**
|
|
@@ -1116,10 +1101,7 @@ let SheetSkeletonManagerService = class SheetSkeletonManagerService extends _uni
|
|
|
1116
1101
|
render.scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_ROW_BOTTOM).setViewportSize({ top: size });
|
|
1117
1102
|
render.scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_ROW_TOP).setViewportSize({ top: size });
|
|
1118
1103
|
render.scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_LEFT_TOP).setViewportSize({ height: size });
|
|
1119
|
-
|
|
1120
|
-
const selectionRenderService = render === null || render === void 0 ? void 0 : render.with(ISheetSelectionRenderService);
|
|
1121
|
-
const currSelections = selectionService.getCurrentSelections();
|
|
1122
|
-
selectionRenderService.resetSelectionsByModelData(currSelections);
|
|
1104
|
+
this._resetSelectionsIfAvailable(render);
|
|
1123
1105
|
const sheetSkeletonManagerParam = this._sheetSkeletonService.getSkeletonParam(render.unitId, sheetId);
|
|
1124
1106
|
if (sheetSkeletonManagerParam) {
|
|
1125
1107
|
sheetSkeletonManagerParam.commandId = SetColumnHeaderHeightCommand.id;
|
|
@@ -1140,16 +1122,28 @@ let SheetSkeletonManagerService = class SheetSkeletonManagerService extends _uni
|
|
|
1140
1122
|
const prevLeft = render.scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_COLUMN_RIGHT).left || 0;
|
|
1141
1123
|
render.scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_COLUMN_RIGHT).setViewportSize({ left: prevLeft + deltaX });
|
|
1142
1124
|
render.scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_LEFT_TOP).setViewportSize({ width: size });
|
|
1143
|
-
|
|
1144
|
-
const selectionRenderService = render === null || render === void 0 ? void 0 : render.with(ISheetSelectionRenderService);
|
|
1145
|
-
const currSelections = selectionService.getCurrentSelections();
|
|
1146
|
-
selectionRenderService.resetSelectionsByModelData(currSelections);
|
|
1125
|
+
this._resetSelectionsIfAvailable(render);
|
|
1147
1126
|
const sheetSkeletonManagerParam = this._sheetSkeletonService.getSkeletonParam(render.unitId, sheetId);
|
|
1148
1127
|
if (sheetSkeletonManagerParam) {
|
|
1149
1128
|
sheetSkeletonManagerParam.commandId = SetRowHeaderWidthCommand.id;
|
|
1150
1129
|
this._currentSkeleton$.next(sheetSkeletonManagerParam);
|
|
1151
1130
|
}
|
|
1152
1131
|
}
|
|
1132
|
+
_resetSelectionsIfAvailable(render) {
|
|
1133
|
+
const selectionService = this._tryGetRenderDependency(render, _univerjs_sheets.SheetsSelectionsService);
|
|
1134
|
+
const selectionRenderService = this._tryGetRenderDependency(render, ISheetSelectionRenderService);
|
|
1135
|
+
if (!selectionService || !selectionRenderService) return;
|
|
1136
|
+
const currSelections = selectionService.getCurrentSelections();
|
|
1137
|
+
selectionRenderService.resetSelectionsByModelData(currSelections);
|
|
1138
|
+
}
|
|
1139
|
+
_tryGetRenderDependency(render, dependency) {
|
|
1140
|
+
try {
|
|
1141
|
+
return render.with(dependency);
|
|
1142
|
+
} catch (error) {
|
|
1143
|
+
if (error instanceof Error && (error.message.includes("DependencyNotFoundError") || error.message.includes("Cannot find"))) return null;
|
|
1144
|
+
throw error;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1153
1147
|
};
|
|
1154
1148
|
SheetSkeletonManagerService = __decorate([__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetSkeletonService))], SheetSkeletonManagerService);
|
|
1155
1149
|
|
|
@@ -1259,7 +1253,7 @@ var SelectionShapeExtension = class {
|
|
|
1259
1253
|
].forEach((control) => {
|
|
1260
1254
|
control.onPointerEnter$.subscribeEvent(() => {
|
|
1261
1255
|
var _this$_injector$get;
|
|
1262
|
-
if (((_this$_injector$get = this._injector.get(ISheetSelectionRenderService, _univerjs_core.Quantity.OPTIONAL)) === null || _this$_injector$get === void 0 ? void 0 : _this$_injector$get.interceptor.fetchThroughInterceptors(RANGE_MOVE_PERMISSION_CHECK)(false, null)) === false) return;
|
|
1256
|
+
if (((_this$_injector$get = this._injector.get(ISheetSelectionRenderService, _univerjs_core.Quantity.OPTIONAL, _univerjs_core.LookUp.SELF)) === null || _this$_injector$get === void 0 ? void 0 : _this$_injector$get.interceptor.fetchThroughInterceptors(RANGE_MOVE_PERMISSION_CHECK)(false, null)) === false) return;
|
|
1263
1257
|
control.setCursor(_univerjs_engine_render.CURSOR_TYPE.MOVE);
|
|
1264
1258
|
});
|
|
1265
1259
|
control.onPointerLeave$.subscribeEvent(() => {
|
|
@@ -1364,7 +1358,7 @@ var SelectionShapeExtension = class {
|
|
|
1364
1358
|
var _this$_injector$get2;
|
|
1365
1359
|
if (this._disabled) return;
|
|
1366
1360
|
const { offsetX: moveOffsetX, offsetY: moveOffsetY } = moveEvt;
|
|
1367
|
-
if (((_this$_injector$get2 = this._injector.get(ISheetSelectionRenderService, _univerjs_core.Quantity.OPTIONAL)) === null || _this$_injector$get2 === void 0 ? void 0 : _this$_injector$get2.interceptor.fetchThroughInterceptors(RANGE_MOVE_PERMISSION_CHECK)(false, null)) === false) return;
|
|
1361
|
+
if (((_this$_injector$get2 = this._injector.get(ISheetSelectionRenderService, _univerjs_core.Quantity.OPTIONAL, _univerjs_core.LookUp.SELF)) === null || _this$_injector$get2 === void 0 ? void 0 : _this$_injector$get2.interceptor.fetchThroughInterceptors(RANGE_MOVE_PERMISSION_CHECK)(false, null)) === false) return;
|
|
1368
1362
|
const { x: newMoveOffsetX, y: newMoveOffsetY } = scene.getCoordRelativeToViewport(_univerjs_engine_render.Vector2.FromArray([moveOffsetX, moveOffsetY]));
|
|
1369
1363
|
this._controlMoving(newMoveOffsetX, newMoveOffsetY);
|
|
1370
1364
|
scene.setCursor(_univerjs_engine_render.CURSOR_TYPE.MOVE);
|
|
@@ -1529,7 +1523,7 @@ var SelectionShapeExtension = class {
|
|
|
1529
1523
|
_initialAutoFill() {
|
|
1530
1524
|
const { fillControl } = this._control;
|
|
1531
1525
|
fillControl.onPointerEnter$.subscribeEvent((evt) => {
|
|
1532
|
-
if (!this._injector.get(ISheetSelectionRenderService).interceptor.fetchThroughInterceptors(RANGE_FILL_PERMISSION_CHECK)(false, {
|
|
1526
|
+
if (!this._injector.get(ISheetSelectionRenderService, _univerjs_core.LookUp.SELF).interceptor.fetchThroughInterceptors(RANGE_FILL_PERMISSION_CHECK)(false, {
|
|
1533
1527
|
x: evt.offsetX,
|
|
1534
1528
|
y: evt.offsetY,
|
|
1535
1529
|
skeleton: this._skeleton,
|
|
@@ -1660,7 +1654,7 @@ var SelectionShapeExtension = class {
|
|
|
1660
1654
|
var _this$_activeViewport;
|
|
1661
1655
|
const { offsetX: moveOffsetX, offsetY: moveOffsetY } = moveEvt;
|
|
1662
1656
|
const currentViewport = scene.getActiveViewportByCoord(_univerjs_engine_render.Vector2.FromArray([moveOffsetX, moveOffsetY]));
|
|
1663
|
-
if (!this._injector.get(ISheetSelectionRenderService).interceptor.fetchThroughInterceptors(RANGE_FILL_PERMISSION_CHECK)(false, {
|
|
1657
|
+
if (!this._injector.get(ISheetSelectionRenderService, _univerjs_core.LookUp.SELF).interceptor.fetchThroughInterceptors(RANGE_FILL_PERMISSION_CHECK)(false, {
|
|
1664
1658
|
x: evt.offsetX,
|
|
1665
1659
|
y: evt.offsetY,
|
|
1666
1660
|
skeleton: this._skeleton,
|
|
@@ -7329,12 +7323,14 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends _u
|
|
|
7329
7323
|
this.disposeWithMe(viewportMain.onScrollByBar$.subscribeEvent((param) => {
|
|
7330
7324
|
var _this$_sheetSkeletonM3;
|
|
7331
7325
|
const skeleton = (_this$_sheetSkeletonM3 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM3 === void 0 ? void 0 : _this$_sheetSkeletonM3.skeleton;
|
|
7332
|
-
if (skeleton == null || param.isTrigger === false) return;
|
|
7326
|
+
if (skeleton == null || param.isTrigger === false || param.isBarDragging && !param.isBarDragEnd) return;
|
|
7333
7327
|
const sheetObject = this._getSheetObject();
|
|
7334
7328
|
if (skeleton == null || sheetObject == null) return;
|
|
7335
7329
|
const { viewportScrollX = 0, viewportScrollY = 0 } = param;
|
|
7336
7330
|
const { row, column, rowOffset, columnOffset } = skeleton.getOffsetRelativeToRowCol(viewportScrollX, viewportScrollY);
|
|
7337
7331
|
this._commandService.executeCommand(ScrollCommand.id, {
|
|
7332
|
+
unitId: this._context.unitId,
|
|
7333
|
+
sheetId: skeleton.getLocation()[1],
|
|
7338
7334
|
sheetViewStartRow: row,
|
|
7339
7335
|
sheetViewStartColumn: column,
|
|
7340
7336
|
offsetX: columnOffset,
|
|
@@ -7422,8 +7418,11 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends _u
|
|
|
7422
7418
|
* @returns {boolean} - true if scroll is successful
|
|
7423
7419
|
*/
|
|
7424
7420
|
scrollToCell(row, column, duration) {
|
|
7425
|
-
const
|
|
7421
|
+
const worksheet = this._context.unit.getActiveSheet();
|
|
7422
|
+
const { ySplit: freezeYSplit, xSplit: freezeXSplit } = worksheet.getFreeze();
|
|
7426
7423
|
return this._commandService.syncExecuteCommand(ScrollCommand.id, {
|
|
7424
|
+
unitId: this._context.unitId,
|
|
7425
|
+
sheetId: worksheet.getSheetId(),
|
|
7427
7426
|
sheetViewStartRow: row - freezeYSplit,
|
|
7428
7427
|
sheetViewStartColumn: column - freezeXSplit,
|
|
7429
7428
|
offsetX: 0,
|
|
@@ -7596,6 +7595,8 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends _u
|
|
|
7596
7595
|
startSheetViewRow = startSheetViewRow - hiddenRows.length;
|
|
7597
7596
|
}
|
|
7598
7597
|
return this._commandService.syncExecuteCommand(ScrollCommand.id, {
|
|
7598
|
+
unitId: this._context.unitId,
|
|
7599
|
+
sheetId: worksheet.getSheetId(),
|
|
7599
7600
|
sheetViewStartRow: Math.max(0, startSheetViewRow - freezedRowCount),
|
|
7600
7601
|
sheetViewStartColumn: Math.max(0, startSheetViewColumn - freezedColCount),
|
|
7601
7602
|
offsetX,
|
|
@@ -7684,10 +7685,12 @@ const ScrollCommand = {
|
|
|
7684
7685
|
if (!params) return false;
|
|
7685
7686
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
7686
7687
|
const renderManagerSrv = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
7687
|
-
const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService);
|
|
7688
|
+
const target = params.unitId ? getScrollCommandTargetByParams(univerInstanceService, params) : (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService);
|
|
7688
7689
|
if (!target) return false;
|
|
7689
7690
|
const { workbook, worksheet, unitId } = target;
|
|
7690
|
-
const
|
|
7691
|
+
const renderUnit = renderManagerSrv.getRenderById(unitId);
|
|
7692
|
+
if (!renderUnit) return false;
|
|
7693
|
+
const currentScroll = renderUnit.with(SheetScrollManagerService).getCurrentScrollState();
|
|
7691
7694
|
if (!worksheet) return false;
|
|
7692
7695
|
const { sheetViewStartRow, sheetViewStartColumn, offsetX, offsetY, duration } = params;
|
|
7693
7696
|
const { sheetViewStartColumn: currentColumn, sheetViewStartRow: currentRow, offsetX: currentOffsetX, offsetY: currentOffsetY } = currentScroll || {};
|
|
@@ -7703,6 +7706,18 @@ const ScrollCommand = {
|
|
|
7703
7706
|
});
|
|
7704
7707
|
}
|
|
7705
7708
|
};
|
|
7709
|
+
function getScrollCommandTargetByParams(univerInstanceService, params) {
|
|
7710
|
+
if (!params.unitId) return null;
|
|
7711
|
+
const workbook = univerInstanceService.getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
7712
|
+
const worksheet = params.sheetId ? workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(params.sheetId) : workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
|
|
7713
|
+
if (!workbook || !worksheet) return null;
|
|
7714
|
+
return {
|
|
7715
|
+
workbook,
|
|
7716
|
+
worksheet,
|
|
7717
|
+
unitId: params.unitId,
|
|
7718
|
+
subUnitId: worksheet.getSheetId()
|
|
7719
|
+
};
|
|
7720
|
+
}
|
|
7706
7721
|
/**
|
|
7707
7722
|
* The command is used to scroll to the specific cell if the target cell is not in the viewport.
|
|
7708
7723
|
*/
|
|
@@ -7898,7 +7913,7 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
7898
7913
|
refreshEditCellPosition(resetSizeOnly) {
|
|
7899
7914
|
if (!this._currentEditCell || !this._currentEditCellState) return;
|
|
7900
7915
|
const { unitId, sheetId, primary, scene, engine } = this._currentEditCell;
|
|
7901
|
-
const workbook = this.
|
|
7916
|
+
const workbook = this._getWorkbookForEditUnit(unitId);
|
|
7902
7917
|
if (!workbook || workbook.getUnitId() !== unitId) return;
|
|
7903
7918
|
const worksheet = workbook.getActiveSheet();
|
|
7904
7919
|
if (!worksheet || worksheet.getSheetId() !== sheetId) return;
|
|
@@ -7997,7 +8012,7 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
7997
8012
|
var _documentLayoutObject, _documentLayoutObject2;
|
|
7998
8013
|
if (!this._currentEditCell) return;
|
|
7999
8014
|
const { unitId, sheetId, primary, scene, engine } = this._currentEditCell;
|
|
8000
|
-
const workbook = this.
|
|
8015
|
+
const workbook = this._getWorkbookForEditUnit(unitId);
|
|
8001
8016
|
if (!workbook || workbook.getUnitId() !== unitId) return;
|
|
8002
8017
|
const worksheet = workbook.getActiveSheet();
|
|
8003
8018
|
if (!worksheet || worksheet.getSheetId() !== sheetId) return;
|
|
@@ -8075,6 +8090,10 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
8075
8090
|
isInArrayFormulaRange: cell === null || cell === void 0 ? void 0 : cell.isInArrayFormulaRange
|
|
8076
8091
|
};
|
|
8077
8092
|
}
|
|
8093
|
+
_getWorkbookForEditUnit(unitId) {
|
|
8094
|
+
var _this$_univerInstance;
|
|
8095
|
+
return (_this$_univerInstance = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) !== null && _this$_univerInstance !== void 0 ? _this$_univerInstance : this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
8096
|
+
}
|
|
8078
8097
|
getCurrentEditorId() {
|
|
8079
8098
|
return this._editorUnitId;
|
|
8080
8099
|
}
|
|
@@ -8453,9 +8472,15 @@ const ScrollToRangeOperation = {
|
|
|
8453
8472
|
id: "sheet.operation.scroll-to-range",
|
|
8454
8473
|
type: _univerjs_core.CommandType.OPERATION,
|
|
8455
8474
|
handler: (accessor, params) => {
|
|
8475
|
+
var _params$unitId, _instanceService$getC;
|
|
8456
8476
|
if (!params) return false;
|
|
8457
8477
|
const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
8458
|
-
|
|
8478
|
+
const renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
8479
|
+
const unitId = (_params$unitId = params.unitId) !== null && _params$unitId !== void 0 ? _params$unitId : (_instanceService$getC = instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _instanceService$getC === void 0 ? void 0 : _instanceService$getC.getUnitId();
|
|
8480
|
+
if (!unitId) return false;
|
|
8481
|
+
const renderUnit = renderManagerService.getRenderById(unitId);
|
|
8482
|
+
if (!renderUnit) return false;
|
|
8483
|
+
return renderUnit.with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
|
|
8459
8484
|
}
|
|
8460
8485
|
};
|
|
8461
8486
|
|
|
@@ -8767,18 +8792,19 @@ let SheetsRenderService = class SheetsRenderService extends _univerjs_core.RxDis
|
|
|
8767
8792
|
}
|
|
8768
8793
|
_initWorkbookListener() {
|
|
8769
8794
|
this._instanceSrv.getTypeOfUnitAdded$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe((event) => this._createRenderer(event.unit, event.options));
|
|
8770
|
-
this._instanceSrv.getAllUnitsForType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).forEach((workbook) =>
|
|
8795
|
+
this._instanceSrv.getAllUnitsForType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).forEach((workbook) => {
|
|
8796
|
+
var _this$_instanceSrv$ge;
|
|
8797
|
+
return this._createRenderer(workbook, (_this$_instanceSrv$ge = this._instanceSrv.getUnitCreateOptions(workbook.getUnitId())) !== null && _this$_instanceSrv$ge !== void 0 ? _this$_instanceSrv$ge : void 0);
|
|
8798
|
+
});
|
|
8771
8799
|
this._instanceSrv.getTypeOfUnitDisposed$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe((workbook) => this._disposeRenderer(workbook));
|
|
8772
8800
|
}
|
|
8773
8801
|
_createRenderer(workbook, createUnitOptions) {
|
|
8802
|
+
if (createUnitOptions === null || createUnitOptions === void 0 ? void 0 : createUnitOptions.skipAutoRender) return;
|
|
8774
8803
|
const unitId = workbook.getUnitId();
|
|
8775
|
-
this._renderManagerService.
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
}
|
|
8780
|
-
});
|
|
8781
|
-
this._renderManagerService.createRender(unitId, createUnitOptions);
|
|
8804
|
+
const canvas = this._renderManagerService.createRender(unitId, createUnitOptions).engine.getCanvas();
|
|
8805
|
+
canvas.setId(`${SHEET_MAIN_CANVAS_ID}_${unitId}`);
|
|
8806
|
+
canvas.getCanvasEle().dataset.uUnitId = unitId;
|
|
8807
|
+
canvas.getContext().setId(`${SHEET_MAIN_CANVAS_ID}_${unitId}`);
|
|
8782
8808
|
}
|
|
8783
8809
|
_disposeRenderer(workbook) {
|
|
8784
8810
|
const unitId = workbook.getUnitId();
|
|
@@ -8873,11 +8899,28 @@ let AutoFillUIController = class AutoFillUIController extends _univerjs_core.Dis
|
|
|
8873
8899
|
}
|
|
8874
8900
|
_initSelectionControlFillChanged() {
|
|
8875
8901
|
const disposableCollection = new _univerjs_core.DisposableCollection();
|
|
8902
|
+
let pendingRetry = false;
|
|
8903
|
+
let retryCount = 0;
|
|
8904
|
+
const scheduleUpdateListener = (listener) => {
|
|
8905
|
+
if (pendingRetry) return;
|
|
8906
|
+
pendingRetry = true;
|
|
8907
|
+
setTimeout(() => {
|
|
8908
|
+
pendingRetry = false;
|
|
8909
|
+
listener();
|
|
8910
|
+
}, 0);
|
|
8911
|
+
};
|
|
8876
8912
|
const updateListener = () => {
|
|
8877
8913
|
disposableCollection.dispose();
|
|
8878
8914
|
const currentRenderer = (0, _univerjs_engine_render.getCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService);
|
|
8879
8915
|
if (!currentRenderer) return;
|
|
8880
|
-
currentRenderer
|
|
8916
|
+
const selectionRenderService = getResolvedSelectionRenderService(currentRenderer);
|
|
8917
|
+
if (!selectionRenderService) {
|
|
8918
|
+
retryCount += 1;
|
|
8919
|
+
if (retryCount <= 3) scheduleUpdateListener(updateListener);
|
|
8920
|
+
return;
|
|
8921
|
+
}
|
|
8922
|
+
retryCount = 0;
|
|
8923
|
+
selectionRenderService.getSelectionControls().forEach((controlSelection) => {
|
|
8881
8924
|
disposableCollection.add(controlSelection.selectionFilled$.subscribe((filled) => {
|
|
8882
8925
|
if (filled == null || filled.startColumn === -1 || filled.startRow === -1 || filled.endColumn === -1 || filled.endRow === -1) return;
|
|
8883
8926
|
const source = {
|
|
@@ -8915,11 +8958,11 @@ let AutoFillUIController = class AutoFillUIController extends _univerjs_core.Dis
|
|
|
8915
8958
|
}));
|
|
8916
8959
|
});
|
|
8917
8960
|
};
|
|
8918
|
-
updateListener
|
|
8961
|
+
scheduleUpdateListener(updateListener);
|
|
8919
8962
|
this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
|
|
8920
|
-
if (command.id === _univerjs_sheets.SetSelectionsOperation.id) updateListener
|
|
8963
|
+
if (command.id === _univerjs_sheets.SetSelectionsOperation.id) scheduleUpdateListener(updateListener);
|
|
8921
8964
|
}));
|
|
8922
|
-
this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).subscribe(() => updateListener
|
|
8965
|
+
this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).subscribe(() => scheduleUpdateListener(updateListener)));
|
|
8923
8966
|
}
|
|
8924
8967
|
_handleDbClickFill(source) {
|
|
8925
8968
|
const selection = this._detectFillRange(source);
|
|
@@ -8969,6 +9012,13 @@ AutoFillUIController = __decorate([
|
|
|
8969
9012
|
__decorateParam(5, _univerjs_engine_render.IRenderManagerService),
|
|
8970
9013
|
__decorateParam(6, (0, _univerjs_core.Inject)(SheetsRenderService))
|
|
8971
9014
|
], AutoFillUIController);
|
|
9015
|
+
function getResolvedSelectionRenderService(renderer) {
|
|
9016
|
+
var _getInjector, _resolvedDependencyCo;
|
|
9017
|
+
const injector = (_getInjector = renderer.getInjector) === null || _getInjector === void 0 ? void 0 : _getInjector.call(renderer);
|
|
9018
|
+
const resolvedDependencies = injector === null || injector === void 0 || (_resolvedDependencyCo = injector.resolvedDependencyCollection) === null || _resolvedDependencyCo === void 0 ? void 0 : _resolvedDependencyCo.resolvedDependencies;
|
|
9019
|
+
if (!resolvedDependencies) return;
|
|
9020
|
+
for (const [identifier, values] of resolvedDependencies) if (identifier.decoratorName === ISheetSelectionRenderService.decoratorName) return values.length === 1 ? values[0] : void 0;
|
|
9021
|
+
}
|
|
8972
9022
|
|
|
8973
9023
|
//#endregion
|
|
8974
9024
|
//#region src/controllers/auto-height.controller.ts
|
|
@@ -9421,12 +9471,60 @@ var CellEditorManagerService = class {
|
|
|
9421
9471
|
};
|
|
9422
9472
|
const ICellEditorManagerService = (0, _univerjs_core.createIdentifier)("univer.sheet-cell-editor-manager.service");
|
|
9423
9473
|
|
|
9474
|
+
//#endregion
|
|
9475
|
+
//#region src/services/sheet-embed-integration.service.ts
|
|
9476
|
+
const SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE = "data-embed-interaction-boundary-owner";
|
|
9477
|
+
const SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE = "data-embed-runtime-focus-role";
|
|
9478
|
+
const SHEET_EMBED_FLOAT_DOM_ATTRIBUTE = "data-embed-float-dom";
|
|
9479
|
+
const SHEET_EMBED_ID_ATTRIBUTE = "data-embed-id";
|
|
9480
|
+
const SHEET_EMBED_HOST_UNIT_ID_ATTRIBUTE = "data-embed-host-unit-id";
|
|
9481
|
+
const SHEET_EMBED_CHILD_UNIT_ID_ATTRIBUTE = "data-embed-child-unit-id";
|
|
9482
|
+
const SHEET_EMBED_CHILD_TYPE_ATTRIBUTE = "data-embed-child-type";
|
|
9483
|
+
const ISheetEmbedInteractionBoundaryService = (0, _univerjs_core.createIdentifier)("sheets-ui.embed-interaction-boundary.service");
|
|
9484
|
+
const ISheetEmbedRuntimeFocusCoordinator = (0, _univerjs_core.createIdentifier)("sheets-ui.embed-runtime-focus-coordinator");
|
|
9485
|
+
const ISheetEmbedFloatingGeometryService = (0, _univerjs_core.createIdentifier)("sheets-ui.embed-floating-geometry.service");
|
|
9486
|
+
function resolveSheetEmbedRuntimeDomScope(element) {
|
|
9487
|
+
var _element$closest$getA, _element$closest, _container$getAttribu, _container$getAttribu2, _container$getAttribu3;
|
|
9488
|
+
if (!element) return;
|
|
9489
|
+
const embedId = (_element$closest$getA = (_element$closest = element.closest(`[${"data-embed-interaction-boundary-owner"}]`)) === null || _element$closest === void 0 ? void 0 : _element$closest.getAttribute("data-embed-interaction-boundary-owner")) !== null && _element$closest$getA !== void 0 ? _element$closest$getA : void 0;
|
|
9490
|
+
const container = resolveSheetEmbedFloatDomContainer(element, embedId);
|
|
9491
|
+
const resolvedEmbedId = (_container$getAttribu = container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-id")) !== null && _container$getAttribu !== void 0 ? _container$getAttribu : embedId;
|
|
9492
|
+
if (!resolvedEmbedId) return;
|
|
9493
|
+
return {
|
|
9494
|
+
embedId: resolvedEmbedId,
|
|
9495
|
+
hostUnitId: (_container$getAttribu2 = container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-host-unit-id")) !== null && _container$getAttribu2 !== void 0 ? _container$getAttribu2 : void 0,
|
|
9496
|
+
childUnitId: (_container$getAttribu3 = container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-child-unit-id")) !== null && _container$getAttribu3 !== void 0 ? _container$getAttribu3 : void 0,
|
|
9497
|
+
childType: readChildType(container)
|
|
9498
|
+
};
|
|
9499
|
+
}
|
|
9500
|
+
function resolveActiveSheetEmbedRuntimeDomScope(ownerDocument = document) {
|
|
9501
|
+
const activeContainer = ownerDocument.querySelector(`[${SHEET_EMBED_FLOAT_DOM_ATTRIBUTE}="true"][data-embed-float-stage="stage2"]`);
|
|
9502
|
+
if (!activeContainer) return;
|
|
9503
|
+
return resolveSheetEmbedRuntimeDomScope(activeContainer);
|
|
9504
|
+
}
|
|
9505
|
+
function resolveSheetEmbedFloatDomContainer(element, embedId) {
|
|
9506
|
+
var _element$ownerDocumen, _ownerDocument$queryS;
|
|
9507
|
+
const ownContainer = element === null || element === void 0 ? void 0 : element.closest(`[${SHEET_EMBED_FLOAT_DOM_ATTRIBUTE}="true"]`);
|
|
9508
|
+
if (ownContainer && (!embedId || ownContainer.getAttribute("data-embed-id") === embedId)) return ownContainer;
|
|
9509
|
+
const ownerDocument = (_element$ownerDocumen = element === null || element === void 0 ? void 0 : element.ownerDocument) !== null && _element$ownerDocumen !== void 0 ? _element$ownerDocumen : typeof document === "undefined" ? void 0 : document;
|
|
9510
|
+
if (!ownerDocument || !embedId) return ownContainer !== null && ownContainer !== void 0 ? ownContainer : void 0;
|
|
9511
|
+
return (_ownerDocument$queryS = ownerDocument.querySelector(`[${"data-embed-float-dom"}="true"][${"data-embed-id"}="${escapeAttributeValue(embedId)}"]`)) !== null && _ownerDocument$queryS !== void 0 ? _ownerDocument$queryS : void 0;
|
|
9512
|
+
}
|
|
9513
|
+
function escapeAttributeValue(value) {
|
|
9514
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
9515
|
+
}
|
|
9516
|
+
function readChildType(container) {
|
|
9517
|
+
const value = container === null || container === void 0 ? void 0 : container.getAttribute(SHEET_EMBED_CHILD_TYPE_ATTRIBUTE);
|
|
9518
|
+
if (value == null || value === "") return;
|
|
9519
|
+
return Number(value);
|
|
9520
|
+
}
|
|
9521
|
+
|
|
9424
9522
|
//#endregion
|
|
9425
9523
|
//#region src/services/editor/cell-editor-resize.service.ts
|
|
9426
9524
|
const EDITOR_INPUT_SELF_EXTEND_GAP = 5;
|
|
9427
9525
|
const EDITOR_BORDER_SIZE = 2;
|
|
9428
9526
|
let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _univerjs_core.Disposable {
|
|
9429
|
-
constructor(_layoutService, _cellEditorManagerService, _editorBridgeService, _renderManagerService, _univerInstanceService, _configService) {
|
|
9527
|
+
constructor(_layoutService, _cellEditorManagerService, _editorBridgeService, _renderManagerService, _univerInstanceService, _configService, _embedFloatingGeometryService) {
|
|
9430
9528
|
super();
|
|
9431
9529
|
this._layoutService = _layoutService;
|
|
9432
9530
|
this._cellEditorManagerService = _cellEditorManagerService;
|
|
@@ -9434,6 +9532,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
9434
9532
|
this._renderManagerService = _renderManagerService;
|
|
9435
9533
|
this._univerInstanceService = _univerInstanceService;
|
|
9436
9534
|
this._configService = _configService;
|
|
9535
|
+
this._embedFloatingGeometryService = _embedFloatingGeometryService;
|
|
9437
9536
|
}
|
|
9438
9537
|
get _currentRenderer() {
|
|
9439
9538
|
return (0, _univerjs_engine_render.getCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService);
|
|
@@ -9446,9 +9545,8 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
9446
9545
|
return this._renderManagerService.getRenderById(this._editingUnitId);
|
|
9447
9546
|
}
|
|
9448
9547
|
get _renderer() {
|
|
9449
|
-
var _this$
|
|
9450
|
-
|
|
9451
|
-
return this._editingUnitId === currentUnitId ? this._editingRenderer : this._currentRenderer;
|
|
9548
|
+
var _this$_editingRendere;
|
|
9549
|
+
return (_this$_editingRendere = this._editingRenderer) !== null && _this$_editingRendere !== void 0 ? _this$_editingRendere : this._currentRenderer;
|
|
9452
9550
|
}
|
|
9453
9551
|
get _sheetSkeletonManagerService() {
|
|
9454
9552
|
var _this$_renderer;
|
|
@@ -9552,13 +9650,14 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
9552
9650
|
const { startX, startY, endX } = position;
|
|
9553
9651
|
const enginWidth = engine.width;
|
|
9554
9652
|
const maxHeight = height - startY - EDITOR_BORDER_SIZE * 2;
|
|
9653
|
+
const cellWidth = endX - startX;
|
|
9555
9654
|
let maxWidth = width - startX;
|
|
9556
9655
|
if (horizontalAlign === _univerjs_core.HorizontalAlign.CENTER) {
|
|
9557
9656
|
const rightGap = enginWidth - endX;
|
|
9558
|
-
|
|
9559
|
-
maxWidth = endX - startX + Math.min(leftGap, rightGap) * 2;
|
|
9657
|
+
maxWidth = cellWidth + Math.min(startX, rightGap) * 2;
|
|
9560
9658
|
} else if (horizontalAlign === _univerjs_core.HorizontalAlign.RIGHT) maxWidth = endX;
|
|
9561
9659
|
maxWidth = maxWidth - EDITOR_BORDER_SIZE * 2;
|
|
9660
|
+
maxWidth = Math.max(maxWidth, cellWidth);
|
|
9562
9661
|
return {
|
|
9563
9662
|
height: maxHeight,
|
|
9564
9663
|
width: maxWidth,
|
|
@@ -9615,7 +9714,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
9615
9714
|
docEngine.resizeBySize((0, _univerjs_engine_render.fixLineWidthByScale)(editorWidth, precisionScaleX), (0, _univerjs_engine_render.fixLineWidthByScale)(physicHeight, precisionScaleY));
|
|
9616
9715
|
callback === null || callback === void 0 || callback();
|
|
9617
9716
|
}, 0);
|
|
9618
|
-
const contentBoundingRect = this.
|
|
9717
|
+
const contentBoundingRect = this._getEditorContentElement().getBoundingClientRect();
|
|
9619
9718
|
const canvasBoundingRect = canvasElement.getBoundingClientRect();
|
|
9620
9719
|
startX = startX * scaleAdjust + (canvasBoundingRect.left - contentBoundingRect.left);
|
|
9621
9720
|
startY = startY * scaleAdjust + (canvasBoundingRect.top - contentBoundingRect.top);
|
|
@@ -9630,6 +9729,10 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
9630
9729
|
show: true
|
|
9631
9730
|
});
|
|
9632
9731
|
}
|
|
9732
|
+
_getEditorContentElement() {
|
|
9733
|
+
var _this$_embedFloatingG, _this$_embedFloatingG2;
|
|
9734
|
+
return (_this$_embedFloatingG = (_this$_embedFloatingG2 = this._embedFloatingGeometryService) === null || _this$_embedFloatingG2 === void 0 || (_this$_embedFloatingG2 = _this$_embedFloatingG2.getRegistrationByChildUnitId(this._editingUnitId)) === null || _this$_embedFloatingG2 === void 0 ? void 0 : _this$_embedFloatingG2.contentRoot) !== null && _this$_embedFloatingG !== void 0 ? _this$_embedFloatingG : this._layoutService.getContentElement();
|
|
9735
|
+
}
|
|
9633
9736
|
/**
|
|
9634
9737
|
* Since the document does not support cell background color, an additional rect needs to be added.
|
|
9635
9738
|
*/
|
|
@@ -9692,13 +9795,14 @@ SheetCellEditorResizeService = __decorate([
|
|
|
9692
9795
|
__decorateParam(2, IEditorBridgeService),
|
|
9693
9796
|
__decorateParam(3, _univerjs_engine_render.IRenderManagerService),
|
|
9694
9797
|
__decorateParam(4, _univerjs_core.IUniverInstanceService),
|
|
9695
|
-
__decorateParam(5, _univerjs_core.IConfigService)
|
|
9798
|
+
__decorateParam(5, _univerjs_core.IConfigService),
|
|
9799
|
+
__decorateParam(6, (0, _univerjs_core.Optional)(ISheetEmbedFloatingGeometryService))
|
|
9696
9800
|
], SheetCellEditorResizeService);
|
|
9697
9801
|
|
|
9698
9802
|
//#endregion
|
|
9699
9803
|
//#region src/controllers/render-controllers/editor-bridge.render-controller.ts
|
|
9700
9804
|
let EditorBridgeRenderController = class EditorBridgeRenderController extends _univerjs_core.RxDisposable {
|
|
9701
|
-
constructor(_context, _instanceSrv, _commandService, _editorBridgeService, _selectionManagerService, _contextService, _renderManagerService, _sheetSkeletonManagerService) {
|
|
9805
|
+
constructor(_context, _instanceSrv, _commandService, _editorBridgeService, _selectionManagerService, _contextService, _renderManagerService, _sheetSkeletonManagerService, _embedRuntimeFocusCoordinator) {
|
|
9702
9806
|
super();
|
|
9703
9807
|
this._context = _context;
|
|
9704
9808
|
this._instanceSrv = _instanceSrv;
|
|
@@ -9708,10 +9812,13 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
9708
9812
|
this._contextService = _contextService;
|
|
9709
9813
|
this._renderManagerService = _renderManagerService;
|
|
9710
9814
|
this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
|
|
9815
|
+
this._embedRuntimeFocusCoordinator = _embedRuntimeFocusCoordinator;
|
|
9711
9816
|
_defineProperty(this, "_d", void 0);
|
|
9712
9817
|
this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {
|
|
9713
|
-
if (workbook && workbook.getUnitId() === this._context.unitId)
|
|
9714
|
-
|
|
9818
|
+
if (workbook && workbook.getUnitId() === this._context.unitId) {
|
|
9819
|
+
if (this._d) return;
|
|
9820
|
+
this._d = this._init();
|
|
9821
|
+
} else this._disposeCurrent();
|
|
9715
9822
|
}));
|
|
9716
9823
|
}
|
|
9717
9824
|
_init() {
|
|
@@ -9720,6 +9827,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
9720
9827
|
this._initEventListener(d);
|
|
9721
9828
|
this._commandExecutedListener(d);
|
|
9722
9829
|
this._initialKeyboardListener(d);
|
|
9830
|
+
this._initSheetFocusListener(d);
|
|
9723
9831
|
return d;
|
|
9724
9832
|
}
|
|
9725
9833
|
_disposeCurrent() {
|
|
@@ -9736,7 +9844,9 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
9736
9844
|
const primary = params === null || params === void 0 || (_params = params[params.length - 1]) === null || _params === void 0 ? void 0 : _params.primary;
|
|
9737
9845
|
if (primary) {
|
|
9738
9846
|
var _this$_context$unit$g, _this$_sheetSkeletonM;
|
|
9739
|
-
const
|
|
9847
|
+
const sheetObject = this._getSheetObject();
|
|
9848
|
+
if (!sheetObject) return;
|
|
9849
|
+
const { scene, engine } = sheetObject;
|
|
9740
9850
|
const unitId = this._context.unitId;
|
|
9741
9851
|
const sheetId = (_this$_context$unit$g = this._context.unit.getActiveSheet()) === null || _this$_context$unit$g === void 0 ? void 0 : _this$_context$unit$g.getSheetId();
|
|
9742
9852
|
if (!sheetId) return;
|
|
@@ -9751,6 +9861,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
9751
9861
|
endColumn: mergeInfo.mergeInfo.endColumn,
|
|
9752
9862
|
isMergedMainCell: mergeInfo.isMergedMainCell
|
|
9753
9863
|
} : primary;
|
|
9864
|
+
if (isSameEditCell(this._editorBridgeService.getEditLocation(), unitId, sheetId, newPrimary)) return;
|
|
9754
9865
|
this._commandService.executeCommand(SetActivateCellEditOperation.id, {
|
|
9755
9866
|
scene,
|
|
9756
9867
|
engine,
|
|
@@ -9768,7 +9879,9 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
9768
9879
|
}
|
|
9769
9880
|
}
|
|
9770
9881
|
_initEventListener(d) {
|
|
9771
|
-
const
|
|
9882
|
+
const sheetObject = this._getSheetObject();
|
|
9883
|
+
if (!sheetObject) return;
|
|
9884
|
+
const { spreadsheet, spreadsheetColumnHeader, spreadsheetLeftTopPlaceholder, spreadsheetRowHeader } = sheetObject;
|
|
9772
9885
|
d.add(spreadsheet.onDblclick$.subscribeEvent((evt) => {
|
|
9773
9886
|
if (evt.button === 2) return;
|
|
9774
9887
|
this._commandService.executeCommand(SetCellEditVisibleOperation.id, {
|
|
@@ -9778,19 +9891,19 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
9778
9891
|
});
|
|
9779
9892
|
}));
|
|
9780
9893
|
d.add(spreadsheet.onPointerDown$.subscribeEvent({
|
|
9781
|
-
next: this._tryHideEditor
|
|
9894
|
+
next: (payload) => this._tryHideEditor(resolvePointerEventPayload(payload)),
|
|
9782
9895
|
priority: -1
|
|
9783
9896
|
}));
|
|
9784
9897
|
d.add(spreadsheetColumnHeader.onPointerDown$.subscribeEvent({
|
|
9785
|
-
next: this._tryHideEditor
|
|
9898
|
+
next: (payload) => this._tryHideEditor(resolvePointerEventPayload(payload)),
|
|
9786
9899
|
priority: -1
|
|
9787
9900
|
}));
|
|
9788
9901
|
d.add(spreadsheetLeftTopPlaceholder.onPointerDown$.subscribeEvent({
|
|
9789
|
-
next: this._tryHideEditor
|
|
9902
|
+
next: (payload) => this._tryHideEditor(resolvePointerEventPayload(payload)),
|
|
9790
9903
|
priority: -1
|
|
9791
9904
|
}));
|
|
9792
9905
|
d.add(spreadsheetRowHeader.onPointerDown$.subscribeEvent({
|
|
9793
|
-
next: this._tryHideEditor
|
|
9906
|
+
next: (payload) => this._tryHideEditor(resolvePointerEventPayload(payload)),
|
|
9794
9907
|
priority: -1
|
|
9795
9908
|
}));
|
|
9796
9909
|
}
|
|
@@ -9804,9 +9917,10 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
9804
9917
|
const docSelectionRenderService = render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
9805
9918
|
if (docSelectionRenderService) {
|
|
9806
9919
|
disposable = (0, _univerjs_core.toDisposable)(docSelectionRenderService.onInputBefore$.subscribe((config) => {
|
|
9920
|
+
var _this$_embedRuntimeFo;
|
|
9807
9921
|
if (!this._isCurrentSheetFocused()) return;
|
|
9808
9922
|
const isFocusFormulaEditor = this._contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR);
|
|
9809
|
-
const isFocusSheets = this._contextService.getContextValue(_univerjs_core.FOCUSING_SHEET);
|
|
9923
|
+
const isFocusSheets = this._contextService.getContextValue(_univerjs_core.FOCUSING_SHEET) || ((_this$_embedRuntimeFo = this._embedRuntimeFocusCoordinator) === null || _this$_embedRuntimeFo === void 0 ? void 0 : _this$_embedRuntimeFo.isChildUnitInActiveSession(this._context.unitId)) === true;
|
|
9810
9924
|
const unitId = render.unitId;
|
|
9811
9925
|
if (this._editorBridgeService.isVisible().visible) return;
|
|
9812
9926
|
if (unitId && isFocusSheets && !isFocusFormulaEditor) this._showEditorByKeyboard(config);
|
|
@@ -9821,6 +9935,17 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
9821
9935
|
addEvent(render);
|
|
9822
9936
|
}));
|
|
9823
9937
|
}
|
|
9938
|
+
_initSheetFocusListener(d) {
|
|
9939
|
+
d.add(this._contextService.subscribeContextValue$(_univerjs_core.FOCUSING_SHEET).subscribe((isFocusingSheet) => {
|
|
9940
|
+
if (!isFocusingSheet || !this._isCurrentSheetFocused() || this._contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR) || this._editorBridgeService.isVisible().visible) return;
|
|
9941
|
+
this._focusCellEditorInput();
|
|
9942
|
+
}));
|
|
9943
|
+
}
|
|
9944
|
+
_focusCellEditorInput() {
|
|
9945
|
+
const render = this._renderManagerService.getRenderById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
9946
|
+
const docSelectionRenderService = render === null || render === void 0 ? void 0 : render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
9947
|
+
if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
9948
|
+
}
|
|
9824
9949
|
_commandExecutedListener(d) {
|
|
9825
9950
|
const refreshCommandSet = /* @__PURE__ */ new Set([_univerjs_sheets.ClearSelectionFormatCommand.id, SetZoomRatioCommand.id]);
|
|
9826
9951
|
d.add(this._commandService.onCommandExecuted((command) => {
|
|
@@ -9835,19 +9960,35 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
9835
9960
|
}));
|
|
9836
9961
|
}
|
|
9837
9962
|
_showEditorByKeyboard(config) {
|
|
9963
|
+
var _ref, _config$content;
|
|
9838
9964
|
const event = config === null || config === void 0 ? void 0 : config.event;
|
|
9839
9965
|
if (config == null || !event.data && event.inputType !== "InsertParagraph") return;
|
|
9966
|
+
const initialValue = (_ref = (_config$content = config.content) !== null && _config$content !== void 0 ? _config$content : event.data) !== null && _ref !== void 0 ? _ref : "";
|
|
9840
9967
|
this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
|
|
9841
9968
|
visible: true,
|
|
9842
9969
|
eventType: _univerjs_engine_render.DeviceInputEventType.Keyboard,
|
|
9843
9970
|
keycode: event.which,
|
|
9971
|
+
initialValue,
|
|
9844
9972
|
unitId: this._context.unitId
|
|
9845
9973
|
});
|
|
9846
9974
|
}
|
|
9847
|
-
_tryHideEditor() {
|
|
9975
|
+
_tryHideEditor(evt) {
|
|
9848
9976
|
if (this._editorBridgeService.isForceKeepVisible()) return;
|
|
9977
|
+
if (!evt && this._isEmbeddedFormulaEditorActive()) return;
|
|
9978
|
+
if (this._isEmbeddedFormulaEditorActive() && this._isCurrentEmbedRuntimeEvent(evt)) return;
|
|
9979
|
+
if (isEmbedCellEditorInteraction(evt)) return;
|
|
9849
9980
|
this._hideEditor();
|
|
9850
9981
|
}
|
|
9982
|
+
_isEmbeddedFormulaEditorActive() {
|
|
9983
|
+
var _this$_embedRuntimeFo2, _this$_editorBridgeSe;
|
|
9984
|
+
if (((_this$_embedRuntimeFo2 = this._embedRuntimeFocusCoordinator) === null || _this$_embedRuntimeFo2 === void 0 ? void 0 : _this$_embedRuntimeFo2.isChildUnitInActiveSession(this._context.unitId)) !== true) return false;
|
|
9985
|
+
const dataStream = (_this$_editorBridgeSe = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe === void 0 || (_this$_editorBridgeSe = _this$_editorBridgeSe.documentLayoutObject.documentModel) === null || _this$_editorBridgeSe === void 0 || (_this$_editorBridgeSe = _this$_editorBridgeSe.getSnapshot().body) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.dataStream;
|
|
9986
|
+
return typeof dataStream === "string" && dataStream.startsWith("=");
|
|
9987
|
+
}
|
|
9988
|
+
_isCurrentEmbedRuntimeEvent(evt) {
|
|
9989
|
+
var _this$_embedRuntimeFo3;
|
|
9990
|
+
return ((_this$_embedRuntimeFo3 = this._embedRuntimeFocusCoordinator) === null || _this$_embedRuntimeFo3 === void 0 ? void 0 : _this$_embedRuntimeFo3.isChildUnitRuntimeEvent(this._context.unitId, evt === null || evt === void 0 ? void 0 : evt.target, evt instanceof Event ? evt : evt)) === true;
|
|
9991
|
+
}
|
|
9851
9992
|
_hideEditor() {
|
|
9852
9993
|
if (this._editorBridgeService.isVisible().visible !== true) return;
|
|
9853
9994
|
this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
|
|
@@ -9857,11 +9998,12 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
9857
9998
|
});
|
|
9858
9999
|
}
|
|
9859
10000
|
_getSheetObject() {
|
|
10001
|
+
if (!this._context.unit) return null;
|
|
9860
10002
|
return getSheetObject(this._context.unit, this._context);
|
|
9861
10003
|
}
|
|
9862
10004
|
_isCurrentSheetFocused() {
|
|
9863
|
-
var _this$_instanceSrv$ge;
|
|
9864
|
-
return ((_this$_instanceSrv$ge = this._instanceSrv.getFocusedUnit()) === null || _this$_instanceSrv$ge === void 0 ? void 0 : _this$_instanceSrv$ge.getUnitId()) === this._context.unitId;
|
|
10005
|
+
var _this$_instanceSrv$ge, _this$_embedRuntimeFo4;
|
|
10006
|
+
return ((_this$_instanceSrv$ge = this._instanceSrv.getFocusedUnit()) === null || _this$_instanceSrv$ge === void 0 ? void 0 : _this$_instanceSrv$ge.getUnitId()) === this._context.unitId || ((_this$_embedRuntimeFo4 = this._embedRuntimeFocusCoordinator) === null || _this$_embedRuntimeFo4 === void 0 ? void 0 : _this$_embedRuntimeFo4.isChildUnitInActiveSession(this._context.unitId)) === true;
|
|
9865
10007
|
}
|
|
9866
10008
|
};
|
|
9867
10009
|
EditorBridgeRenderController = __decorate([
|
|
@@ -9871,8 +10013,46 @@ EditorBridgeRenderController = __decorate([
|
|
|
9871
10013
|
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetsSelectionsService)),
|
|
9872
10014
|
__decorateParam(5, _univerjs_core.IContextService),
|
|
9873
10015
|
__decorateParam(6, _univerjs_engine_render.IRenderManagerService),
|
|
9874
|
-
__decorateParam(7, (0, _univerjs_core.Inject)(SheetSkeletonManagerService))
|
|
10016
|
+
__decorateParam(7, (0, _univerjs_core.Inject)(SheetSkeletonManagerService)),
|
|
10017
|
+
__decorateParam(8, (0, _univerjs_core.Optional)(ISheetEmbedRuntimeFocusCoordinator))
|
|
9875
10018
|
], EditorBridgeRenderController);
|
|
10019
|
+
function resolvePointerEventPayload(payload) {
|
|
10020
|
+
return Array.isArray(payload) ? payload[0] : payload;
|
|
10021
|
+
}
|
|
10022
|
+
function isEmbedCellEditorInteraction(evt) {
|
|
10023
|
+
return isEmbedCellEditorInteractionTarget(evt === null || evt === void 0 ? void 0 : evt.target) || isEmbedCellEditorInteractionPoint(resolvePointerEventPoint(evt));
|
|
10024
|
+
}
|
|
10025
|
+
function isEmbedCellEditorInteractionTarget(target) {
|
|
10026
|
+
if (typeof HTMLElement === "undefined" || !(target instanceof HTMLElement)) return false;
|
|
10027
|
+
return target.closest(`[${"data-embed-runtime-focus-role"}="child-editor"]`) != null || target.closest("[data-u-comp=\"editor\"]") != null || target.closest("[id^=\"__editor___INTERNAL_EDITOR__\"]") != null || target.closest("[id^=\"univer-doc-selection-container-__INTERNAL_EDITOR__\"]") != null;
|
|
10028
|
+
}
|
|
10029
|
+
function resolvePointerEventPoint(evt) {
|
|
10030
|
+
if (!evt) return;
|
|
10031
|
+
return {
|
|
10032
|
+
clientX: "clientX" in evt ? evt.clientX : void 0,
|
|
10033
|
+
clientY: "clientY" in evt ? evt.clientY : void 0,
|
|
10034
|
+
x: "x" in evt ? evt.x : void 0,
|
|
10035
|
+
y: "y" in evt ? evt.y : void 0
|
|
10036
|
+
};
|
|
10037
|
+
}
|
|
10038
|
+
function isEmbedCellEditorInteractionPoint(evt) {
|
|
10039
|
+
if (typeof document === "undefined") return false;
|
|
10040
|
+
const clientX = Number.isFinite(evt === null || evt === void 0 ? void 0 : evt.clientX) ? evt === null || evt === void 0 ? void 0 : evt.clientX : evt === null || evt === void 0 ? void 0 : evt.x;
|
|
10041
|
+
const clientY = Number.isFinite(evt === null || evt === void 0 ? void 0 : evt.clientY) ? evt === null || evt === void 0 ? void 0 : evt.clientY : evt === null || evt === void 0 ? void 0 : evt.y;
|
|
10042
|
+
if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) return false;
|
|
10043
|
+
return [...document.querySelectorAll([
|
|
10044
|
+
`[${SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE}="child-editor"]`,
|
|
10045
|
+
"[data-u-comp=\"editor\"]",
|
|
10046
|
+
"[id^=\"__editor___INTERNAL_EDITOR__\"]",
|
|
10047
|
+
"[id^=\"univer-doc-selection-container-__INTERNAL_EDITOR__\"]"
|
|
10048
|
+
].join(","))].some((element) => {
|
|
10049
|
+
const rect = element.getBoundingClientRect();
|
|
10050
|
+
return rect.width > 0 && rect.height > 0 && clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom;
|
|
10051
|
+
});
|
|
10052
|
+
}
|
|
10053
|
+
function isSameEditCell(current, unitId, sheetId, primary) {
|
|
10054
|
+
return (current === null || current === void 0 ? void 0 : current.unitId) === unitId && current.sheetId === sheetId && current.row === primary.startRow && current.column === primary.startColumn;
|
|
10055
|
+
}
|
|
9876
10056
|
|
|
9877
10057
|
//#endregion
|
|
9878
10058
|
//#region src/services/repeat-last-action.service.ts
|
|
@@ -10589,10 +10769,11 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
10589
10769
|
}
|
|
10590
10770
|
_initialCursorSync(d) {
|
|
10591
10771
|
d.add(this._cellEditorManagerService.focus$.pipe((0, rxjs.filter)((f) => !!f)).subscribe(() => {
|
|
10592
|
-
var _this$_renderManagerS2;
|
|
10593
|
-
const
|
|
10594
|
-
|
|
10595
|
-
|
|
10772
|
+
var _this$_univerInstance, _this$_renderManagerS2;
|
|
10773
|
+
const editorId = this._contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR) ? _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY : this._editorBridgeService.getCurrentEditorId();
|
|
10774
|
+
const docUnitId = editorId !== null && editorId !== void 0 ? editorId : (_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId();
|
|
10775
|
+
if (!docUnitId) return;
|
|
10776
|
+
const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.getRenderById(docUnitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
10596
10777
|
if (!docSelectionRenderManager) return;
|
|
10597
10778
|
docSelectionRenderManager.sync();
|
|
10598
10779
|
}));
|
|
@@ -10713,14 +10894,17 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
10713
10894
|
this._cursorChange = eventType === _univerjs_engine_render.DeviceInputEventType.PointerDown || eventType === _univerjs_engine_render.DeviceInputEventType.Dblclick ? 2 : 1;
|
|
10714
10895
|
const editCellState = this._editorBridgeService.getEditLocation();
|
|
10715
10896
|
if (editCellState == null) return;
|
|
10716
|
-
this._commandService.syncExecuteCommand(ScrollToRangeOperation.id, { range: {
|
|
10717
|
-
startRow: editCellState.row,
|
|
10718
|
-
startColumn: editCellState.column,
|
|
10719
|
-
endRow: editCellState.row,
|
|
10720
|
-
endColumn: editCellState.column
|
|
10721
|
-
} });
|
|
10722
|
-
this._editorBridgeService.refreshEditCellPosition(false);
|
|
10723
10897
|
const { unitId, isInArrayFormulaRange = false } = editCellState;
|
|
10898
|
+
this._commandService.syncExecuteCommand(ScrollToRangeOperation.id, {
|
|
10899
|
+
unitId,
|
|
10900
|
+
range: {
|
|
10901
|
+
startRow: editCellState.row,
|
|
10902
|
+
startColumn: editCellState.column,
|
|
10903
|
+
endRow: editCellState.row,
|
|
10904
|
+
endColumn: editCellState.column
|
|
10905
|
+
}
|
|
10906
|
+
});
|
|
10907
|
+
this._editorBridgeService.refreshEditCellPosition(false);
|
|
10724
10908
|
const editorObject = this._getEditorObject();
|
|
10725
10909
|
if (editorObject == null) return;
|
|
10726
10910
|
const { document, scene } = editorObject;
|
|
@@ -11106,8 +11290,9 @@ function getCellStyleBySnapshot(snapshot) {
|
|
|
11106
11290
|
return null;
|
|
11107
11291
|
}
|
|
11108
11292
|
function emptyBody(body, removeStyle = false) {
|
|
11293
|
+
var _body$textRuns;
|
|
11109
11294
|
body.dataStream = _univerjs_core.DEFAULT_EMPTY_DOCUMENT_VALUE;
|
|
11110
|
-
if (body.textRuns
|
|
11295
|
+
if ((_body$textRuns = body.textRuns) === null || _body$textRuns === void 0 ? void 0 : _body$textRuns.length) if (body.textRuns.length === 1 && !removeStyle) {
|
|
11111
11296
|
body.textRuns[0].st = 0;
|
|
11112
11297
|
body.textRuns[0].ed = 1;
|
|
11113
11298
|
} else body.textRuns = void 0;
|
|
@@ -11474,7 +11659,10 @@ function generateBody(text) {
|
|
|
11474
11659
|
return {
|
|
11475
11660
|
dataStream,
|
|
11476
11661
|
paragraphs,
|
|
11477
|
-
sectionBreaks: [{
|
|
11662
|
+
sectionBreaks: [{
|
|
11663
|
+
sectionId: (0, _univerjs_core.createSectionId)(/* @__PURE__ */ new Set()),
|
|
11664
|
+
startIndex: dataStream.indexOf("\n")
|
|
11665
|
+
}]
|
|
11478
11666
|
};
|
|
11479
11667
|
}
|
|
11480
11668
|
|
|
@@ -12210,11 +12398,18 @@ let FormulaEditorController = class FormulaEditorController extends _univerjs_co
|
|
|
12210
12398
|
});
|
|
12211
12399
|
this._create(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
12212
12400
|
this.disposeWithMe(this._editorService.focus$.subscribe(() => {
|
|
12213
|
-
|
|
12214
|
-
if (((_this$_editorService$ = this._editorService.getFocusEditor()) === null || _this$_editorService$ === void 0 ? void 0 : _this$_editorService$.getEditorId()) !== _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) this._contextService.setContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR, false);
|
|
12215
|
-
else this._contextService.setContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR, true);
|
|
12401
|
+
this._syncFxBarFocusContext();
|
|
12216
12402
|
}));
|
|
12217
12403
|
}
|
|
12404
|
+
_syncFxBarFocusContext() {
|
|
12405
|
+
var _this$_editorService$;
|
|
12406
|
+
if (((_this$_editorService$ = this._editorService.getFocusEditor()) === null || _this$_editorService$ === void 0 ? void 0 : _this$_editorService$.getEditorId()) === _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) {
|
|
12407
|
+
this._contextService.setContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR, true);
|
|
12408
|
+
return;
|
|
12409
|
+
}
|
|
12410
|
+
if (this._contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR) && this._contextService.getContextValue(_univerjs_core.EDITOR_ACTIVATED)) return;
|
|
12411
|
+
this._contextService.setContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR, false);
|
|
12412
|
+
}
|
|
12218
12413
|
_handleContentChange() {
|
|
12219
12414
|
this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
|
|
12220
12415
|
if (commandInfo.id === _univerjs_docs.RichTextEditingMutation.id) {
|
|
@@ -16079,6 +16274,56 @@ const BORDER_LINE_CHILDREN = [
|
|
|
16079
16274
|
value: "mltr_bctr"
|
|
16080
16275
|
}
|
|
16081
16276
|
];
|
|
16277
|
+
const BORDER_SIZE_CHILDREN = [
|
|
16278
|
+
{
|
|
16279
|
+
label: _univerjs_core.BorderStyleTypes.THIN,
|
|
16280
|
+
value: _univerjs_core.BorderStyleTypes.THIN
|
|
16281
|
+
},
|
|
16282
|
+
{
|
|
16283
|
+
label: _univerjs_core.BorderStyleTypes.HAIR,
|
|
16284
|
+
value: _univerjs_core.BorderStyleTypes.HAIR
|
|
16285
|
+
},
|
|
16286
|
+
{
|
|
16287
|
+
label: _univerjs_core.BorderStyleTypes.DOTTED,
|
|
16288
|
+
value: _univerjs_core.BorderStyleTypes.DOTTED
|
|
16289
|
+
},
|
|
16290
|
+
{
|
|
16291
|
+
label: _univerjs_core.BorderStyleTypes.DASHED,
|
|
16292
|
+
value: _univerjs_core.BorderStyleTypes.DASHED
|
|
16293
|
+
},
|
|
16294
|
+
{
|
|
16295
|
+
label: _univerjs_core.BorderStyleTypes.DASH_DOT,
|
|
16296
|
+
value: _univerjs_core.BorderStyleTypes.DASH_DOT
|
|
16297
|
+
},
|
|
16298
|
+
{
|
|
16299
|
+
label: _univerjs_core.BorderStyleTypes.DASH_DOT_DOT,
|
|
16300
|
+
value: _univerjs_core.BorderStyleTypes.DASH_DOT_DOT
|
|
16301
|
+
},
|
|
16302
|
+
{
|
|
16303
|
+
label: _univerjs_core.BorderStyleTypes.MEDIUM,
|
|
16304
|
+
value: _univerjs_core.BorderStyleTypes.MEDIUM
|
|
16305
|
+
},
|
|
16306
|
+
{
|
|
16307
|
+
label: _univerjs_core.BorderStyleTypes.MEDIUM_DASHED,
|
|
16308
|
+
value: _univerjs_core.BorderStyleTypes.MEDIUM_DASHED
|
|
16309
|
+
},
|
|
16310
|
+
{
|
|
16311
|
+
label: _univerjs_core.BorderStyleTypes.MEDIUM_DASH_DOT,
|
|
16312
|
+
value: _univerjs_core.BorderStyleTypes.MEDIUM_DASH_DOT
|
|
16313
|
+
},
|
|
16314
|
+
{
|
|
16315
|
+
label: _univerjs_core.BorderStyleTypes.MEDIUM_DASH_DOT_DOT,
|
|
16316
|
+
value: _univerjs_core.BorderStyleTypes.MEDIUM_DASH_DOT_DOT
|
|
16317
|
+
},
|
|
16318
|
+
{
|
|
16319
|
+
label: _univerjs_core.BorderStyleTypes.THICK,
|
|
16320
|
+
value: _univerjs_core.BorderStyleTypes.THICK
|
|
16321
|
+
},
|
|
16322
|
+
{
|
|
16323
|
+
label: _univerjs_core.BorderStyleTypes.DOUBLE,
|
|
16324
|
+
value: _univerjs_core.BorderStyleTypes.DOUBLE
|
|
16325
|
+
}
|
|
16326
|
+
];
|
|
16082
16327
|
|
|
16083
16328
|
//#endregion
|
|
16084
16329
|
//#region src/menu/menu-util.ts
|
|
@@ -16839,6 +17084,9 @@ const MenuItemInput = (props) => {
|
|
|
16839
17084
|
function handlePressEnter() {
|
|
16840
17085
|
if (inputValue) onChange(inputValue);
|
|
16841
17086
|
}
|
|
17087
|
+
function handleKeyDown(event) {
|
|
17088
|
+
event.stopPropagation();
|
|
17089
|
+
}
|
|
16842
17090
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
16843
17091
|
className: "univer-inline-flex univer-items-center univer-gap-1",
|
|
16844
17092
|
children: [
|
|
@@ -16854,6 +17102,7 @@ const MenuItemInput = (props) => {
|
|
|
16854
17102
|
max,
|
|
16855
17103
|
disabled,
|
|
16856
17104
|
onPressEnter: handlePressEnter,
|
|
17105
|
+
onKeyDown: handleKeyDown,
|
|
16857
17106
|
onChange: handleChange
|
|
16858
17107
|
})
|
|
16859
17108
|
}),
|
|
@@ -19410,6 +19659,25 @@ const menuSchema = {
|
|
|
19410
19659
|
} } }
|
|
19411
19660
|
};
|
|
19412
19661
|
|
|
19662
|
+
//#endregion
|
|
19663
|
+
//#region src/embed-tab-anchor.ts
|
|
19664
|
+
const EMBED_SHEETS_TAB_CUSTOM_KEY = "UNIVER_EMBED_SHEETS_TAB";
|
|
19665
|
+
function getEmbedSheetsTabCustomData(snapshot) {
|
|
19666
|
+
var _snapshot$custom;
|
|
19667
|
+
const value = (_snapshot$custom = snapshot.custom) === null || _snapshot$custom === void 0 ? void 0 : _snapshot$custom[EMBED_SHEETS_TAB_CUSTOM_KEY];
|
|
19668
|
+
if (!isEmbedSheetsTabCustomData(value)) return;
|
|
19669
|
+
return value;
|
|
19670
|
+
}
|
|
19671
|
+
function isEmbedSheetsTabCustomData(value) {
|
|
19672
|
+
if (!value || typeof value !== "object") return false;
|
|
19673
|
+
const candidate = value;
|
|
19674
|
+
return candidate.version === 1 && typeof candidate.embedId === "string" && typeof candidate.hostAnchorId === "string";
|
|
19675
|
+
}
|
|
19676
|
+
|
|
19677
|
+
//#endregion
|
|
19678
|
+
//#region src/services/sheet-embed-runtime.service.ts
|
|
19679
|
+
const ISheetEmbedRuntimeService = (0, _univerjs_core.createIdentifier)("sheet-ui.embed-runtime.service");
|
|
19680
|
+
|
|
19413
19681
|
//#endregion
|
|
19414
19682
|
//#region src/views/auto-fill-popup-menu/AutoFillPopupMenu.tsx
|
|
19415
19683
|
const useUpdate = () => {
|
|
@@ -19559,6 +19827,93 @@ function AutoFillPopupMenu() {
|
|
|
19559
19827
|
});
|
|
19560
19828
|
}
|
|
19561
19829
|
|
|
19830
|
+
//#endregion
|
|
19831
|
+
//#region src/views/editor-container/focus-editor.ts
|
|
19832
|
+
const SHEET_CELL_EDITOR_ELEMENT_ID = `__editor_${_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY}`;
|
|
19833
|
+
const SHEET_CELL_EDITOR_SELECTION_CONTAINER_ID = `univer-doc-selection-container-${_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY}`;
|
|
19834
|
+
function focusSheetCellEditorElement(ownerDocument = document) {
|
|
19835
|
+
const element = ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
|
|
19836
|
+
if (element == null || ownerDocument.activeElement === element) return false;
|
|
19837
|
+
if (!element.hasAttribute("tabindex")) element.tabIndex = -1;
|
|
19838
|
+
element.focus({ preventScroll: true });
|
|
19839
|
+
return ownerDocument.activeElement === element;
|
|
19840
|
+
}
|
|
19841
|
+
function registerSheetCellEditorRuntimePortal(options) {
|
|
19842
|
+
var _options$ownerDocumen;
|
|
19843
|
+
const ownerDocument = (_options$ownerDocumen = options.ownerDocument) !== null && _options$ownerDocumen !== void 0 ? _options$ownerDocumen : typeof document === "undefined" ? void 0 : document;
|
|
19844
|
+
if (!ownerDocument) return (0, _univerjs_core.toDisposable)(() => {});
|
|
19845
|
+
const collection = new _univerjs_core.DisposableCollection();
|
|
19846
|
+
const view = ownerDocument.defaultView;
|
|
19847
|
+
let disposed = false;
|
|
19848
|
+
let registeredPortalRoot = null;
|
|
19849
|
+
let portalRegistration;
|
|
19850
|
+
const frameHandles = [];
|
|
19851
|
+
let observer;
|
|
19852
|
+
const tryRegister = () => {
|
|
19853
|
+
if (disposed) return;
|
|
19854
|
+
const portalRoot = resolveSheetCellEditorPortalRoot(ownerDocument);
|
|
19855
|
+
if (portalRoot === registeredPortalRoot) return;
|
|
19856
|
+
portalRegistration === null || portalRegistration === void 0 || portalRegistration.dispose();
|
|
19857
|
+
portalRegistration = void 0;
|
|
19858
|
+
registeredPortalRoot = null;
|
|
19859
|
+
if (!portalRoot) return;
|
|
19860
|
+
const rootRegistration = new _univerjs_core.DisposableCollection();
|
|
19861
|
+
registeredPortalRoot = portalRoot;
|
|
19862
|
+
if (options.interactionBoundaryService) rootRegistration.add(options.interactionBoundaryService.registerOwnedElement(options.embedId, portalRoot));
|
|
19863
|
+
if (options.focusCoordinator) {
|
|
19864
|
+
rootRegistration.add(options.focusCoordinator.registerElement({
|
|
19865
|
+
embedId: options.embedId,
|
|
19866
|
+
role: "child-editor",
|
|
19867
|
+
element: portalRoot
|
|
19868
|
+
}));
|
|
19869
|
+
const editorElement = ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
|
|
19870
|
+
if (editorElement && editorElement !== portalRoot) rootRegistration.add(options.focusCoordinator.registerElement({
|
|
19871
|
+
embedId: options.embedId,
|
|
19872
|
+
role: "child-editor",
|
|
19873
|
+
element: editorElement
|
|
19874
|
+
}));
|
|
19875
|
+
}
|
|
19876
|
+
portalRegistration = rootRegistration;
|
|
19877
|
+
};
|
|
19878
|
+
const scheduleRetry = (remaining) => {
|
|
19879
|
+
if (remaining <= 0 || !(view === null || view === void 0 ? void 0 : view.requestAnimationFrame)) return;
|
|
19880
|
+
const handle = view.requestAnimationFrame(() => {
|
|
19881
|
+
const index = frameHandles.indexOf(handle);
|
|
19882
|
+
if (index >= 0) frameHandles.splice(index, 1);
|
|
19883
|
+
tryRegister();
|
|
19884
|
+
if (!registeredPortalRoot) scheduleRetry(remaining - 1);
|
|
19885
|
+
});
|
|
19886
|
+
frameHandles.push(handle);
|
|
19887
|
+
};
|
|
19888
|
+
tryRegister();
|
|
19889
|
+
if (!registeredPortalRoot) scheduleRetry(2);
|
|
19890
|
+
if ((view === null || view === void 0 ? void 0 : view.MutationObserver) && ownerDocument.body) {
|
|
19891
|
+
observer = new view.MutationObserver(() => tryRegister());
|
|
19892
|
+
observer.observe(ownerDocument.body, {
|
|
19893
|
+
childList: true,
|
|
19894
|
+
subtree: true
|
|
19895
|
+
});
|
|
19896
|
+
}
|
|
19897
|
+
collection.add((0, _univerjs_core.toDisposable)(() => {
|
|
19898
|
+
disposed = true;
|
|
19899
|
+
frameHandles.forEach((handle) => {
|
|
19900
|
+
var _view$cancelAnimation;
|
|
19901
|
+
return view === null || view === void 0 || (_view$cancelAnimation = view.cancelAnimationFrame) === null || _view$cancelAnimation === void 0 ? void 0 : _view$cancelAnimation.call(view, handle);
|
|
19902
|
+
});
|
|
19903
|
+
frameHandles.length = 0;
|
|
19904
|
+
observer === null || observer === void 0 || observer.disconnect();
|
|
19905
|
+
observer = void 0;
|
|
19906
|
+
portalRegistration === null || portalRegistration === void 0 || portalRegistration.dispose();
|
|
19907
|
+
portalRegistration = void 0;
|
|
19908
|
+
registeredPortalRoot = null;
|
|
19909
|
+
}));
|
|
19910
|
+
return collection;
|
|
19911
|
+
}
|
|
19912
|
+
function resolveSheetCellEditorPortalRoot(ownerDocument = document) {
|
|
19913
|
+
var _ref;
|
|
19914
|
+
return (_ref = ownerDocument.getElementById(SHEET_CELL_EDITOR_SELECTION_CONTAINER_ID)) !== null && _ref !== void 0 ? _ref : ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
|
|
19915
|
+
}
|
|
19916
|
+
|
|
19562
19917
|
//#endregion
|
|
19563
19918
|
//#region src/views/editor-container/hooks.ts
|
|
19564
19919
|
/**
|
|
@@ -19628,19 +19983,65 @@ function isTransparentColor(color) {
|
|
|
19628
19983
|
const normalizedColor = color.trim().toLowerCase().replace(/\s+/g, "");
|
|
19629
19984
|
return normalizedColor === "transparent" || normalizedColor === "rgba(0,0,0,0)";
|
|
19630
19985
|
}
|
|
19986
|
+
function shouldRefocusCellEditorAfterPointerDown(options) {
|
|
19987
|
+
const { root, target, activeElement, isEditorFocusing } = options;
|
|
19988
|
+
if (!root || !(target instanceof HTMLElement) || !(activeElement instanceof HTMLElement)) return true;
|
|
19989
|
+
const owner = root.closest(`[${SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE}]`);
|
|
19990
|
+
const embedId = owner === null || owner === void 0 ? void 0 : owner.getAttribute(SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE);
|
|
19991
|
+
if (!embedId) return true;
|
|
19992
|
+
const targetInOwner = target.closest(`[${SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE}="${embedId}"]`) != null;
|
|
19993
|
+
const activeOwnerElement = activeElement.closest(`[${SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE}="${embedId}"]`);
|
|
19994
|
+
if (targetInOwner && activeOwnerElement && isEmbedRuntimeInteractiveElement(activeElement)) return false;
|
|
19995
|
+
if (!isEditorFocusing) return true;
|
|
19996
|
+
return target.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`) == null || activeOwnerElement == null;
|
|
19997
|
+
}
|
|
19998
|
+
function isEmbedRuntimeInteractiveElement(element) {
|
|
19999
|
+
const role = element.getAttribute(SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE);
|
|
20000
|
+
return role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20001
|
+
}
|
|
20002
|
+
function shouldPreserveEmbedPopupFocus(embedId, ownerDocument) {
|
|
20003
|
+
var _activeElement$getAtt, _activeElement$closes;
|
|
20004
|
+
if (!embedId) return false;
|
|
20005
|
+
const activeElement = ownerDocument.activeElement;
|
|
20006
|
+
if (!(activeElement instanceof HTMLElement)) return false;
|
|
20007
|
+
if (!activeElement.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`)) return false;
|
|
20008
|
+
const role = (_activeElement$getAtt = activeElement.getAttribute("data-embed-runtime-focus-role")) !== null && _activeElement$getAtt !== void 0 ? _activeElement$getAtt : (_activeElement$closes = activeElement.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _activeElement$closes === void 0 ? void 0 : _activeElement$closes.getAttribute(SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE);
|
|
20009
|
+
return role === "child-popup" || role === "floating-menu";
|
|
20010
|
+
}
|
|
20011
|
+
function shouldPreserveEmbedInteractiveFocus(embedId, ownerDocument) {
|
|
20012
|
+
var _activeElement$getAtt2, _activeElement$closes2;
|
|
20013
|
+
if (!embedId) return false;
|
|
20014
|
+
const activeElement = ownerDocument.activeElement;
|
|
20015
|
+
if (!(activeElement instanceof HTMLElement)) return false;
|
|
20016
|
+
if (!activeElement.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`)) return false;
|
|
20017
|
+
const role = (_activeElement$getAtt2 = activeElement.getAttribute("data-embed-runtime-focus-role")) !== null && _activeElement$getAtt2 !== void 0 ? _activeElement$getAtt2 : (_activeElement$closes2 = activeElement.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _activeElement$closes2 === void 0 ? void 0 : _activeElement$closes2.getAttribute(SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE);
|
|
20018
|
+
return role == null && activeElement.tagName !== "CANVAS" || role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20019
|
+
}
|
|
20020
|
+
function isEmbedRuntimeEditorOrPopup(target) {
|
|
20021
|
+
var _target$getAttribute, _target$closest;
|
|
20022
|
+
if (!(target instanceof HTMLElement)) return false;
|
|
20023
|
+
const role = (_target$getAttribute = target.getAttribute("data-embed-runtime-focus-role")) !== null && _target$getAttribute !== void 0 ? _target$getAttribute : (_target$closest = target.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _target$closest === void 0 ? void 0 : _target$closest.getAttribute(SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE);
|
|
20024
|
+
return role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20025
|
+
}
|
|
19631
20026
|
/**
|
|
19632
20027
|
* Cell editor container.
|
|
19633
20028
|
* @returns the rendered cell editor container.
|
|
19634
20029
|
*/
|
|
19635
|
-
|
|
20030
|
+
function EditorContainer() {
|
|
19636
20031
|
const [state, setState] = (0, react.useState)({ ...EDITOR_DEFAULT_POSITION });
|
|
19637
20032
|
const cellEditorManagerService = (0, _univerjs_ui.useDependency)(ICellEditorManagerService);
|
|
20033
|
+
const injector = (0, _univerjs_ui.useDependency)(_univerjs_core.Injector);
|
|
19638
20034
|
const editorService = (0, _univerjs_ui.useDependency)(_univerjs_docs_ui.IEditorService);
|
|
20035
|
+
const instanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
19639
20036
|
const contextService = (0, _univerjs_ui.useDependency)(_univerjs_core.IContextService);
|
|
19640
20037
|
const themeService = (0, _univerjs_ui.useDependency)(_univerjs_core.ThemeService);
|
|
19641
20038
|
const componentManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.ComponentManager);
|
|
19642
20039
|
const editorBridgeService = (0, _univerjs_ui.useDependency)(IEditorBridgeService);
|
|
20040
|
+
const cellEditorResizeService = (0, _univerjs_ui.useDependency)(SheetCellEditorResizeService);
|
|
20041
|
+
const rootRef = (0, react.useRef)(null);
|
|
20042
|
+
const pointerRefocusTimerRef = (0, react.useRef)(void 0);
|
|
19643
20043
|
const visible = (0, _univerjs_ui.useObservable)(editorBridgeService.visible$);
|
|
20044
|
+
const [runtimeFocusRevision, setRuntimeFocusRevision] = (0, react.useState)(0);
|
|
19644
20045
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
19645
20046
|
const disableAutoFocus = (0, _univerjs_ui.useObservable)(() => contextService.subscribeContextValue$(_univerjs_ui.DISABLE_AUTO_FOCUS_KEY), false, void 0, [contextService, _univerjs_ui.DISABLE_AUTO_FOCUS_KEY]);
|
|
19646
20047
|
const FormulaEditor = componentManager.get(EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY);
|
|
@@ -19673,17 +20074,54 @@ const EditorContainer = () => {
|
|
|
19673
20074
|
sub.unsubscribe();
|
|
19674
20075
|
};
|
|
19675
20076
|
}, []);
|
|
20077
|
+
(0, react.useEffect)(() => {
|
|
20078
|
+
if (!injector.has(ISheetEmbedFloatingGeometryService)) return;
|
|
20079
|
+
const subscription = injector.get(ISheetEmbedFloatingGeometryService).geometryInvalidated$.subscribe(() => {
|
|
20080
|
+
cellEditorResizeService.resizeCellEditor();
|
|
20081
|
+
});
|
|
20082
|
+
return () => subscription.unsubscribe();
|
|
20083
|
+
}, [cellEditorResizeService, injector]);
|
|
20084
|
+
(0, react.useEffect)(() => {
|
|
20085
|
+
if (!injector.has(ISheetEmbedRuntimeFocusCoordinator)) return;
|
|
20086
|
+
const subscription = injector.get(ISheetEmbedRuntimeFocusCoordinator).runtimeSessionChanged$.subscribe(() => {
|
|
20087
|
+
setRuntimeFocusRevision((revision) => revision + 1);
|
|
20088
|
+
});
|
|
20089
|
+
return () => subscription.unsubscribe();
|
|
20090
|
+
}, [injector]);
|
|
19676
20091
|
(0, react.useEffect)(() => {
|
|
19677
20092
|
if (!disableAutoFocus) cellEditorManagerService.setFocus(true);
|
|
19678
20093
|
}, [disableAutoFocus, state]);
|
|
19679
20094
|
(0, react.useEffect)(() => {
|
|
20095
|
+
var _rootRef$current$owne, _rootRef$current, _ownerDocument$defaul;
|
|
19680
20096
|
if (!(visible === null || visible === void 0 ? void 0 : visible.visible)) return;
|
|
20097
|
+
cellEditorResizeService.fitTextSize();
|
|
20098
|
+
if (contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR)) return;
|
|
20099
|
+
const ownerDocument = (_rootRef$current$owne = (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.ownerDocument) !== null && _rootRef$current$owne !== void 0 ? _rootRef$current$owne : document;
|
|
20100
|
+
const ownerWindow = (_ownerDocument$defaul = ownerDocument.defaultView) !== null && _ownerDocument$defaul !== void 0 ? _ownerDocument$defaul : window;
|
|
19681
20101
|
let focusRetryFrame = 0;
|
|
19682
20102
|
let finalFocusRetryFrame = 0;
|
|
20103
|
+
let delayedFocusTimer;
|
|
20104
|
+
const focusCellEditorElement = () => {
|
|
20105
|
+
var _resolveSheetEmbedRun;
|
|
20106
|
+
const scope = rootRef.current ? (_resolveSheetEmbedRun = resolveSheetEmbedRuntimeDomScope(rootRef.current)) !== null && _resolveSheetEmbedRun !== void 0 ? _resolveSheetEmbedRun : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
20107
|
+
if (shouldPreserveEmbedInteractiveFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
20108
|
+
focusSheetCellEditorElement(ownerDocument);
|
|
20109
|
+
if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
|
|
20110
|
+
delayedFocusTimer = ownerWindow.setTimeout(() => {
|
|
20111
|
+
delayedFocusTimer = void 0;
|
|
20112
|
+
if (shouldPreserveEmbedInteractiveFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
20113
|
+
focusSheetCellEditorElement(ownerDocument);
|
|
20114
|
+
}, 0);
|
|
20115
|
+
};
|
|
19683
20116
|
const focusEditor = () => {
|
|
20117
|
+
var _resolveSheetEmbedRun2;
|
|
20118
|
+
if (contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR)) return;
|
|
20119
|
+
const scope = rootRef.current ? (_resolveSheetEmbedRun2 = resolveSheetEmbedRuntimeDomScope(rootRef.current)) !== null && _resolveSheetEmbedRun2 !== void 0 ? _resolveSheetEmbedRun2 : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
20120
|
+
if (shouldPreserveEmbedPopupFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
19684
20121
|
const editor = editorService.getEditor(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
19685
20122
|
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
19686
20123
|
if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
20124
|
+
focusCellEditorElement();
|
|
19687
20125
|
};
|
|
19688
20126
|
focusEditor();
|
|
19689
20127
|
focusRetryFrame = requestAnimationFrame(() => {
|
|
@@ -19693,8 +20131,185 @@ const EditorContainer = () => {
|
|
|
19693
20131
|
return () => {
|
|
19694
20132
|
cancelAnimationFrame(focusRetryFrame);
|
|
19695
20133
|
cancelAnimationFrame(finalFocusRetryFrame);
|
|
20134
|
+
if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
|
|
19696
20135
|
};
|
|
19697
|
-
}, [
|
|
20136
|
+
}, [
|
|
20137
|
+
cellEditorResizeService,
|
|
20138
|
+
editorService,
|
|
20139
|
+
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20140
|
+
]);
|
|
20141
|
+
(0, react.useEffect)(() => {
|
|
20142
|
+
var _instanceService$getF, _ref;
|
|
20143
|
+
if (!(visible === null || visible === void 0 ? void 0 : visible.visible) || !rootRef.current || !injector.has(ISheetEmbedRuntimeFocusCoordinator)) return;
|
|
20144
|
+
const focusCoordinator = injector.get(ISheetEmbedRuntimeFocusCoordinator);
|
|
20145
|
+
const focusedUnitId = (_instanceService$getF = instanceService.getFocusedUnit()) === null || _instanceService$getF === void 0 ? void 0 : _instanceService$getF.getUnitId();
|
|
20146
|
+
const rootRuntimeScope = resolveSheetEmbedRuntimeDomScope(rootRef.current);
|
|
20147
|
+
const unitRuntimeScope = [
|
|
20148
|
+
editState === null || editState === void 0 ? void 0 : editState.unitId,
|
|
20149
|
+
visible.unitId,
|
|
20150
|
+
focusedUnitId
|
|
20151
|
+
].map((unitId) => focusCoordinator.resolveRuntimeScopeByChildUnitId(unitId)).find((resolvedScope) => resolvedScope != null);
|
|
20152
|
+
if (rootRuntimeScope && unitRuntimeScope && rootRuntimeScope.embedId !== unitRuntimeScope.embedId) return;
|
|
20153
|
+
const activeSessionScope = focusCoordinator.resolveActiveChildSessionRuntimeScope();
|
|
20154
|
+
const explicitRuntimeScope = unitRuntimeScope !== null && unitRuntimeScope !== void 0 ? unitRuntimeScope : rootRuntimeScope;
|
|
20155
|
+
if (activeSessionScope && rootRuntimeScope && !unitRuntimeScope && rootRuntimeScope.embedId !== activeSessionScope.embedId) return;
|
|
20156
|
+
const scope = (_ref = explicitRuntimeScope !== null && explicitRuntimeScope !== void 0 ? explicitRuntimeScope : activeSessionScope) !== null && _ref !== void 0 ? _ref : resolveActiveSheetEmbedRuntimeDomScope(rootRef.current.ownerDocument);
|
|
20157
|
+
if (!scope) return;
|
|
20158
|
+
const collection = new _univerjs_core.DisposableCollection();
|
|
20159
|
+
const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
|
|
20160
|
+
const editorRoot = rootRef.current;
|
|
20161
|
+
collection.add(focusCoordinator.acquireLease({
|
|
20162
|
+
embedId: scope.embedId,
|
|
20163
|
+
role: "child-editor",
|
|
20164
|
+
owner: "sheet-cell-editor",
|
|
20165
|
+
hostUnitId: scope.hostUnitId,
|
|
20166
|
+
childUnitId: scope.childUnitId,
|
|
20167
|
+
associatedChildUnitIds: [_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY]
|
|
20168
|
+
}));
|
|
20169
|
+
if (interactionBoundaryService) collection.add(interactionBoundaryService.registerOwnedElement(scope.embedId, editorRoot));
|
|
20170
|
+
collection.add(focusCoordinator.registerElement({
|
|
20171
|
+
embedId: scope.embedId,
|
|
20172
|
+
role: "child-editor",
|
|
20173
|
+
element: editorRoot
|
|
20174
|
+
}));
|
|
20175
|
+
collection.add(registerSheetCellEditorRuntimePortal({
|
|
20176
|
+
embedId: scope.embedId,
|
|
20177
|
+
ownerDocument: rootRef.current.ownerDocument,
|
|
20178
|
+
interactionBoundaryService,
|
|
20179
|
+
focusCoordinator
|
|
20180
|
+
}));
|
|
20181
|
+
if (scope.childType === _univerjs_core.UniverInstanceType.UNIVER_SHEET && scope.childUnitId) {
|
|
20182
|
+
const ownerDocument = rootRef.current.ownerDocument;
|
|
20183
|
+
let pointerRetryFrame = 0;
|
|
20184
|
+
const focusEditor = () => {
|
|
20185
|
+
if (contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR) || shouldPreserveEmbedPopupFocus(scope.embedId, ownerDocument)) return;
|
|
20186
|
+
const editor = editorService.getEditor(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
20187
|
+
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
20188
|
+
if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
20189
|
+
focusSheetCellEditorElement(ownerDocument);
|
|
20190
|
+
};
|
|
20191
|
+
const refocusEditorAfterRuntimePointer = (event) => {
|
|
20192
|
+
if (!focusCoordinator.isChildUnitRuntimeEvent(scope.childUnitId, event.target, event) || isEmbedRuntimeEditorOrPopup(event.target)) return;
|
|
20193
|
+
cancelAnimationFrame(pointerRetryFrame);
|
|
20194
|
+
pointerRetryFrame = requestAnimationFrame(focusEditor);
|
|
20195
|
+
};
|
|
20196
|
+
ownerDocument.addEventListener("pointerdown", refocusEditorAfterRuntimePointer, true);
|
|
20197
|
+
ownerDocument.addEventListener("pointerup", refocusEditorAfterRuntimePointer, true);
|
|
20198
|
+
ownerDocument.addEventListener("click", refocusEditorAfterRuntimePointer, true);
|
|
20199
|
+
collection.add((0, _univerjs_core.toDisposable)(() => {
|
|
20200
|
+
cancelAnimationFrame(pointerRetryFrame);
|
|
20201
|
+
ownerDocument.removeEventListener("pointerdown", refocusEditorAfterRuntimePointer, true);
|
|
20202
|
+
ownerDocument.removeEventListener("pointerup", refocusEditorAfterRuntimePointer, true);
|
|
20203
|
+
ownerDocument.removeEventListener("click", refocusEditorAfterRuntimePointer, true);
|
|
20204
|
+
}));
|
|
20205
|
+
}
|
|
20206
|
+
return () => collection.dispose();
|
|
20207
|
+
}, [
|
|
20208
|
+
contextService,
|
|
20209
|
+
editState === null || editState === void 0 ? void 0 : editState.unitId,
|
|
20210
|
+
editorService,
|
|
20211
|
+
injector,
|
|
20212
|
+
instanceService,
|
|
20213
|
+
runtimeFocusRevision,
|
|
20214
|
+
visible === null || visible === void 0 ? void 0 : visible.unitId,
|
|
20215
|
+
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20216
|
+
]);
|
|
20217
|
+
(0, react.useEffect)(() => {
|
|
20218
|
+
var _rootRef$current$owne2, _rootRef$current2, _ownerDocument$defaul2;
|
|
20219
|
+
if ((visible === null || visible === void 0 ? void 0 : visible.visible) || !injector.has(ISheetEmbedRuntimeFocusCoordinator)) return;
|
|
20220
|
+
const focusCoordinator = injector.get(ISheetEmbedRuntimeFocusCoordinator);
|
|
20221
|
+
const activeSessionScope = focusCoordinator.resolveActiveChildSessionRuntimeScope();
|
|
20222
|
+
const childUnitId = activeSessionScope === null || activeSessionScope === void 0 ? void 0 : activeSessionScope.childUnitId;
|
|
20223
|
+
if (!activeSessionScope || activeSessionScope.childType !== _univerjs_core.UniverInstanceType.UNIVER_SHEET || !childUnitId || !instanceService.getUnit(childUnitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) return;
|
|
20224
|
+
const ownerDocument = (_rootRef$current$owne2 = (_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.ownerDocument) !== null && _rootRef$current$owne2 !== void 0 ? _rootRef$current$owne2 : document;
|
|
20225
|
+
const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
|
|
20226
|
+
const portalRegistration = registerSheetCellEditorRuntimePortal({
|
|
20227
|
+
embedId: activeSessionScope.embedId,
|
|
20228
|
+
ownerDocument,
|
|
20229
|
+
interactionBoundaryService,
|
|
20230
|
+
focusCoordinator
|
|
20231
|
+
});
|
|
20232
|
+
const ownerWindow = (_ownerDocument$defaul2 = ownerDocument.defaultView) !== null && _ownerDocument$defaul2 !== void 0 ? _ownerDocument$defaul2 : window;
|
|
20233
|
+
let delayedFocusTimer;
|
|
20234
|
+
const focusCellEditorElement = () => {
|
|
20235
|
+
if (shouldPreserveEmbedInteractiveFocus(activeSessionScope.embedId, ownerDocument)) return;
|
|
20236
|
+
focusSheetCellEditorElement(ownerDocument);
|
|
20237
|
+
if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
|
|
20238
|
+
delayedFocusTimer = ownerWindow.setTimeout(() => {
|
|
20239
|
+
delayedFocusTimer = void 0;
|
|
20240
|
+
if (shouldPreserveEmbedInteractiveFocus(activeSessionScope.embedId, ownerDocument)) return;
|
|
20241
|
+
focusSheetCellEditorElement(ownerDocument);
|
|
20242
|
+
}, 0);
|
|
20243
|
+
};
|
|
20244
|
+
const focusHiddenEditor = () => {
|
|
20245
|
+
if (shouldPreserveEmbedPopupFocus(activeSessionScope.embedId, ownerDocument)) return;
|
|
20246
|
+
const editor = editorService.getEditor(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
20247
|
+
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
20248
|
+
if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
20249
|
+
focusCellEditorElement();
|
|
20250
|
+
};
|
|
20251
|
+
let retryFrame = 0;
|
|
20252
|
+
let finalRetryFrame = 0;
|
|
20253
|
+
let pointerRetryFrame = 0;
|
|
20254
|
+
focusHiddenEditor();
|
|
20255
|
+
retryFrame = requestAnimationFrame(() => {
|
|
20256
|
+
focusHiddenEditor();
|
|
20257
|
+
finalRetryFrame = requestAnimationFrame(focusHiddenEditor);
|
|
20258
|
+
});
|
|
20259
|
+
const refocusHiddenEditorAfterRuntimePointer = (event) => {
|
|
20260
|
+
if (!focusCoordinator.isChildUnitRuntimeEvent(childUnitId, event.target, event) || isEmbedRuntimeEditorOrPopup(event.target)) return;
|
|
20261
|
+
cancelAnimationFrame(pointerRetryFrame);
|
|
20262
|
+
pointerRetryFrame = requestAnimationFrame(focusHiddenEditor);
|
|
20263
|
+
};
|
|
20264
|
+
ownerDocument.addEventListener("pointerdown", refocusHiddenEditorAfterRuntimePointer, true);
|
|
20265
|
+
ownerDocument.addEventListener("pointerup", refocusHiddenEditorAfterRuntimePointer, true);
|
|
20266
|
+
ownerDocument.addEventListener("click", refocusHiddenEditorAfterRuntimePointer, true);
|
|
20267
|
+
return () => {
|
|
20268
|
+
cancelAnimationFrame(retryFrame);
|
|
20269
|
+
cancelAnimationFrame(finalRetryFrame);
|
|
20270
|
+
cancelAnimationFrame(pointerRetryFrame);
|
|
20271
|
+
if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
|
|
20272
|
+
ownerDocument.removeEventListener("pointerdown", refocusHiddenEditorAfterRuntimePointer, true);
|
|
20273
|
+
ownerDocument.removeEventListener("pointerup", refocusHiddenEditorAfterRuntimePointer, true);
|
|
20274
|
+
ownerDocument.removeEventListener("click", refocusHiddenEditorAfterRuntimePointer, true);
|
|
20275
|
+
portalRegistration.dispose();
|
|
20276
|
+
};
|
|
20277
|
+
}, [
|
|
20278
|
+
editorService,
|
|
20279
|
+
injector,
|
|
20280
|
+
instanceService,
|
|
20281
|
+
runtimeFocusRevision,
|
|
20282
|
+
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20283
|
+
]);
|
|
20284
|
+
(0, react.useEffect)(() => {
|
|
20285
|
+
return () => {
|
|
20286
|
+
var _rootRef$current3;
|
|
20287
|
+
const ownerWindow = (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.ownerDocument.defaultView;
|
|
20288
|
+
if (ownerWindow && pointerRefocusTimerRef.current != null) ownerWindow.clearTimeout(pointerRefocusTimerRef.current);
|
|
20289
|
+
};
|
|
20290
|
+
}, []);
|
|
20291
|
+
const refocusEditorAfterPointerDown = (0, _univerjs_ui.useEvent)((event) => {
|
|
20292
|
+
var _rootRef$current$owne3, _rootRef$current4, _ownerDocument$defaul3;
|
|
20293
|
+
if (!(visible === null || visible === void 0 ? void 0 : visible.visible)) return;
|
|
20294
|
+
const ownerDocument = (_rootRef$current$owne3 = (_rootRef$current4 = rootRef.current) === null || _rootRef$current4 === void 0 ? void 0 : _rootRef$current4.ownerDocument) !== null && _rootRef$current$owne3 !== void 0 ? _rootRef$current$owne3 : document;
|
|
20295
|
+
const ownerWindow = (_ownerDocument$defaul3 = ownerDocument.defaultView) !== null && _ownerDocument$defaul3 !== void 0 ? _ownerDocument$defaul3 : window;
|
|
20296
|
+
const editor = editorService.getEditor(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
20297
|
+
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
20298
|
+
const pointerTarget = event.target;
|
|
20299
|
+
const activeElementAtPointerDown = ownerDocument.activeElement;
|
|
20300
|
+
if (!shouldRefocusCellEditorAfterPointerDown({
|
|
20301
|
+
root: rootRef.current,
|
|
20302
|
+
target: pointerTarget,
|
|
20303
|
+
activeElement: activeElementAtPointerDown,
|
|
20304
|
+
isEditorFocusing: docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing
|
|
20305
|
+
})) return;
|
|
20306
|
+
if (pointerRefocusTimerRef.current != null) ownerWindow.clearTimeout(pointerRefocusTimerRef.current);
|
|
20307
|
+
pointerRefocusTimerRef.current = ownerWindow.setTimeout(() => {
|
|
20308
|
+
pointerRefocusTimerRef.current = void 0;
|
|
20309
|
+
if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
20310
|
+
focusSheetCellEditorElement(ownerDocument);
|
|
20311
|
+
}, 0);
|
|
20312
|
+
});
|
|
19698
20313
|
(0, _univerjs_ui.useSidebarClick)((0, _univerjs_ui.useEvent)(() => {
|
|
19699
20314
|
if (editorBridgeService.isVisible().visible) commandService.executeCommand(SetCellEditVisibleOperation.id, {
|
|
19700
20315
|
visible: false,
|
|
@@ -19713,7 +20328,10 @@ const EditorContainer = () => {
|
|
|
19713
20328
|
});
|
|
19714
20329
|
});
|
|
19715
20330
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
20331
|
+
ref: rootRef,
|
|
20332
|
+
"data-u-comp": "editor",
|
|
19716
20333
|
className: "univer-absolute univer-z-10 univer-flex",
|
|
20334
|
+
onPointerDownCapture: refocusEditorAfterPointerDown,
|
|
19717
20335
|
style: {
|
|
19718
20336
|
left: state.left,
|
|
19719
20337
|
top: state.top,
|
|
@@ -19738,17 +20356,15 @@ const EditorContainer = () => {
|
|
|
19738
20356
|
resetSelectionOnBlur: false,
|
|
19739
20357
|
isSingle: false,
|
|
19740
20358
|
autoScrollbar: false,
|
|
19741
|
-
onFormulaSelectingChange: (isSelecting
|
|
19742
|
-
if (!isFocusing) return;
|
|
20359
|
+
onFormulaSelectingChange: (isSelecting) => {
|
|
19743
20360
|
if (isSelecting) editorBridgeService.enableForceKeepVisible();
|
|
19744
20361
|
else editorBridgeService.disableForceKeepVisible();
|
|
19745
20362
|
},
|
|
19746
|
-
disableSelectionOnClick: true,
|
|
19747
20363
|
disableContextMenu: false,
|
|
19748
20364
|
canvasStyle: { backgroundColor: "transparent" }
|
|
19749
20365
|
})
|
|
19750
20366
|
});
|
|
19751
|
-
}
|
|
20367
|
+
}
|
|
19752
20368
|
|
|
19753
20369
|
//#endregion
|
|
19754
20370
|
//#region src/services/utils/defined-name-utils.ts
|
|
@@ -20238,9 +20854,9 @@ function FormulaBar(props) {
|
|
|
20238
20854
|
const shouldSkipFocus = (0, react.useRef)(false);
|
|
20239
20855
|
const handlePointerDown = () => {
|
|
20240
20856
|
try {
|
|
20857
|
+
contextService.setContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR, true);
|
|
20241
20858
|
if (editorBridgeService.isVisible().visible === false) {
|
|
20242
20859
|
if (editorActivationDisable) {
|
|
20243
|
-
contextService.setContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR, true);
|
|
20244
20860
|
editorService.focus(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
20245
20861
|
return;
|
|
20246
20862
|
}
|
|
@@ -20249,12 +20865,12 @@ function FormulaBar(props) {
|
|
|
20249
20865
|
eventType: _univerjs_engine_render.DeviceInputEventType.PointerDown,
|
|
20250
20866
|
unitId: editState.unitId
|
|
20251
20867
|
})) {
|
|
20868
|
+
contextService.setContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR, false);
|
|
20252
20869
|
shouldSkipFocus.current = true;
|
|
20253
|
-
return;
|
|
20254
20870
|
}
|
|
20255
20871
|
}
|
|
20256
|
-
contextService.setContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR, true);
|
|
20257
20872
|
} catch (e) {
|
|
20873
|
+
contextService.setContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR, false);
|
|
20258
20874
|
shouldSkipFocus.current = true;
|
|
20259
20875
|
throw e;
|
|
20260
20876
|
}
|
|
@@ -20335,7 +20951,7 @@ function FormulaBar(props) {
|
|
|
20335
20951
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
20336
20952
|
className: (0, _univerjs_design.clsx)("univer-flex univer-h-full univer-w-5 univer-cursor-pointer univer-items-center univer-justify-center univer-text-xs univer-text-gray-700 dark:!univer-text-gray-200", { "univer-cursor-not-allowed univer-text-gray-200 dark:!univer-text-gray-700": editDisable }),
|
|
20337
20953
|
onClick: handleArrowClick,
|
|
20338
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.
|
|
20954
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: (0, _univerjs_design.clsx)({ "univer-rotate-180": arrowDirection === 1 }) })
|
|
20339
20955
|
})]
|
|
20340
20956
|
})]
|
|
20341
20957
|
}),
|
|
@@ -20467,7 +21083,7 @@ function SheetBarMenu() {
|
|
|
20467
21083
|
//#endregion
|
|
20468
21084
|
//#region src/views/sheet-bar/sheet-bar-tabs/SheetBarItem.tsx
|
|
20469
21085
|
function SheetBarItem(props) {
|
|
20470
|
-
const { sheetId, label, color, selected, className, onKeyDown, tabIndex } = props;
|
|
21086
|
+
const { sheetId, label, color, selected, className, onKeyDown, onClick, tabIndex } = props;
|
|
20471
21087
|
const themeService = (0, _univerjs_ui.useDependency)(_univerjs_core.ThemeService);
|
|
20472
21088
|
const getTextColor = (color) => {
|
|
20473
21089
|
const darkTextColor = themeService.getColorFromTheme("gray.900");
|
|
@@ -20483,6 +21099,7 @@ function SheetBarItem(props) {
|
|
|
20483
21099
|
"aria-selected": currentSelected,
|
|
20484
21100
|
tabIndex: tabIndex !== null && tabIndex !== void 0 ? tabIndex : currentSelected ? 0 : -1,
|
|
20485
21101
|
onKeyDown,
|
|
21102
|
+
onClick,
|
|
20486
21103
|
className: (0, _univerjs_design.clsx)("univer-mx-1 univer-box-border univer-flex univer-flex-grow univer-cursor-pointer univer-select-none univer-flex-row univer-items-center univer-rounded univer-text-xs univer-transition-[colors,box-shadow] focus-visible:univer-ring-2 focus-visible:univer-ring-primary-500", {
|
|
20487
21104
|
"dark:!univer-text-white": !color || color && !textColor,
|
|
20488
21105
|
"univer-justify-center univer-bg-white univer-font-bold univer-text-primary-700 univer-shadow": currentSelected,
|
|
@@ -20525,6 +21142,49 @@ function SheetBarTabsContextMenu(props) {
|
|
|
20525
21142
|
})] });
|
|
20526
21143
|
}
|
|
20527
21144
|
|
|
21145
|
+
//#endregion
|
|
21146
|
+
//#region src/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-drag-sort.ts
|
|
21147
|
+
function getMidline(item) {
|
|
21148
|
+
return item.left + item.width / 2;
|
|
21149
|
+
}
|
|
21150
|
+
function calculateSheetTabDragSort(items, activeIndex, dragOffsetX) {
|
|
21151
|
+
const itemOffsets = items.map(() => 0);
|
|
21152
|
+
const activeItem = items[activeIndex];
|
|
21153
|
+
if (!activeItem) return {
|
|
21154
|
+
targetIndex: activeIndex,
|
|
21155
|
+
itemOffsets
|
|
21156
|
+
};
|
|
21157
|
+
itemOffsets[activeIndex] = dragOffsetX;
|
|
21158
|
+
const activeLeft = activeItem.left + dragOffsetX;
|
|
21159
|
+
const activeRight = activeLeft + activeItem.width;
|
|
21160
|
+
let targetIndex = activeIndex;
|
|
21161
|
+
if (dragOffsetX > 0) {
|
|
21162
|
+
for (let index = activeIndex + 1; index < items.length; index++) if (activeRight > getMidline(items[index])) {
|
|
21163
|
+
itemOffsets[index] = -activeItem.width;
|
|
21164
|
+
targetIndex = index;
|
|
21165
|
+
}
|
|
21166
|
+
} else if (dragOffsetX < 0) {
|
|
21167
|
+
for (let index = activeIndex - 1; index >= 0; index--) if (activeLeft < getMidline(items[index])) {
|
|
21168
|
+
itemOffsets[index] = activeItem.width;
|
|
21169
|
+
targetIndex = index;
|
|
21170
|
+
}
|
|
21171
|
+
}
|
|
21172
|
+
return {
|
|
21173
|
+
targetIndex,
|
|
21174
|
+
itemOffsets
|
|
21175
|
+
};
|
|
21176
|
+
}
|
|
21177
|
+
function reorderItems(items, fromIndex, toIndex) {
|
|
21178
|
+
if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length) return [...items];
|
|
21179
|
+
const nextItems = [...items];
|
|
21180
|
+
const [movedItem] = nextItems.splice(fromIndex, 1);
|
|
21181
|
+
nextItems.splice(toIndex, 0, movedItem);
|
|
21182
|
+
return nextItems;
|
|
21183
|
+
}
|
|
21184
|
+
function getSheetTabTargetOrder(sheetOrder, visibleSheetIds, targetIndex) {
|
|
21185
|
+
return sheetOrder.indexOf(visibleSheetIds[targetIndex]);
|
|
21186
|
+
}
|
|
21187
|
+
|
|
20528
21188
|
//#endregion
|
|
20529
21189
|
//#region src/views/sheet-bar/sheet-bar-tabs/utils/animate.ts
|
|
20530
21190
|
/**
|
|
@@ -20637,46 +21297,6 @@ var Animate = class {
|
|
|
20637
21297
|
}
|
|
20638
21298
|
};
|
|
20639
21299
|
|
|
20640
|
-
//#endregion
|
|
20641
|
-
//#region src/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-drag-sort.ts
|
|
20642
|
-
function getMidline(item) {
|
|
20643
|
-
return item.left + item.width / 2;
|
|
20644
|
-
}
|
|
20645
|
-
function calculateSheetTabDragSort(items, activeIndex, dragOffsetX) {
|
|
20646
|
-
const itemOffsets = items.map(() => 0);
|
|
20647
|
-
const activeItem = items[activeIndex];
|
|
20648
|
-
if (!activeItem) return {
|
|
20649
|
-
targetIndex: activeIndex,
|
|
20650
|
-
itemOffsets
|
|
20651
|
-
};
|
|
20652
|
-
itemOffsets[activeIndex] = dragOffsetX;
|
|
20653
|
-
const activeLeft = activeItem.left + dragOffsetX;
|
|
20654
|
-
const activeRight = activeLeft + activeItem.width;
|
|
20655
|
-
let targetIndex = activeIndex;
|
|
20656
|
-
if (dragOffsetX > 0) {
|
|
20657
|
-
for (let index = activeIndex + 1; index < items.length; index++) if (activeRight > getMidline(items[index])) {
|
|
20658
|
-
itemOffsets[index] = -activeItem.width;
|
|
20659
|
-
targetIndex = index;
|
|
20660
|
-
}
|
|
20661
|
-
} else if (dragOffsetX < 0) {
|
|
20662
|
-
for (let index = activeIndex - 1; index >= 0; index--) if (activeLeft < getMidline(items[index])) {
|
|
20663
|
-
itemOffsets[index] = activeItem.width;
|
|
20664
|
-
targetIndex = index;
|
|
20665
|
-
}
|
|
20666
|
-
}
|
|
20667
|
-
return {
|
|
20668
|
-
targetIndex,
|
|
20669
|
-
itemOffsets
|
|
20670
|
-
};
|
|
20671
|
-
}
|
|
20672
|
-
function reorderItems(items, fromIndex, toIndex) {
|
|
20673
|
-
if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length) return [...items];
|
|
20674
|
-
const nextItems = [...items];
|
|
20675
|
-
const [movedItem] = nextItems.splice(fromIndex, 1);
|
|
20676
|
-
nextItems.splice(toIndex, 0, movedItem);
|
|
20677
|
-
return nextItems;
|
|
20678
|
-
}
|
|
20679
|
-
|
|
20680
21300
|
//#endregion
|
|
20681
21301
|
//#region src/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-name-editor.ts
|
|
20682
21302
|
const MAX_SHEET_NAME_LENGTH = 31;
|
|
@@ -20846,7 +21466,7 @@ var SlideTabItem = class SlideTabItem {
|
|
|
20846
21466
|
startSheetTabNameEditor({
|
|
20847
21467
|
slideTabItem: this._slideTabItem,
|
|
20848
21468
|
canStart: () => this._slideTabBar.getConfig().onNameChangeCheck(),
|
|
20849
|
-
checkName: (name) => this._slideTabBar.getConfig().onNameCheckAlert(name),
|
|
21469
|
+
checkName: (name) => this._slideTabBar.getConfig().onNameCheckAlert(name, this.getId()),
|
|
20850
21470
|
setEditMode: (editing) => {
|
|
20851
21471
|
this._editMode = editing;
|
|
20852
21472
|
},
|
|
@@ -20855,8 +21475,12 @@ var SlideTabItem = class SlideTabItem {
|
|
|
20855
21475
|
this._slideTabBar.updateItems();
|
|
20856
21476
|
},
|
|
20857
21477
|
onCommit: (name, focusEvent) => {
|
|
20858
|
-
|
|
20859
|
-
|
|
21478
|
+
try {
|
|
21479
|
+
this._slideTabBar.getConfig().onChangeName(this.getId(), name);
|
|
21480
|
+
if (callback) callback(focusEvent);
|
|
21481
|
+
} finally {
|
|
21482
|
+
this._slideTabBar.addListener();
|
|
21483
|
+
}
|
|
20860
21484
|
}
|
|
20861
21485
|
});
|
|
20862
21486
|
}
|
|
@@ -20865,7 +21489,7 @@ var SlideTabItem = class SlideTabItem {
|
|
|
20865
21489
|
const input = this._slideTabItem.querySelector("span");
|
|
20866
21490
|
if (!input) return false;
|
|
20867
21491
|
const text = (_input$textContent = input.textContent) !== null && _input$textContent !== void 0 ? _input$textContent : "";
|
|
20868
|
-
return this._slideTabBar.getConfig().onNameCheckAlert(text);
|
|
21492
|
+
return this._slideTabBar.getConfig().onNameCheckAlert(text, this.getId());
|
|
20869
21493
|
}
|
|
20870
21494
|
animate() {
|
|
20871
21495
|
return {
|
|
@@ -21018,6 +21642,7 @@ var SlideTabBar = class SlideTabBar {
|
|
|
21018
21642
|
_defineProperty(this, "_downAction", void 0);
|
|
21019
21643
|
_defineProperty(this, "_wheelAction", void 0);
|
|
21020
21644
|
_defineProperty(this, "_scrollIncremental", 0);
|
|
21645
|
+
_defineProperty(this, "_dragStartScrollX", 0);
|
|
21021
21646
|
_defineProperty(this, "_compareDirection", 0);
|
|
21022
21647
|
_defineProperty(this, "_autoScrollTime", null);
|
|
21023
21648
|
_defineProperty(this, "_slideScrollbar", void 0);
|
|
@@ -21050,7 +21675,6 @@ var SlideTabBar = class SlideTabBar {
|
|
|
21050
21675
|
var _this$_activeTabItem2, _this$_activeTabItem3;
|
|
21051
21676
|
(_this$_activeTabItem2 = this._activeTabItem) === null || _this$_activeTabItem2 === void 0 || _this$_activeTabItem2.removeEventListener("pointermove", this._moveAction);
|
|
21052
21677
|
(_this$_activeTabItem3 = this._activeTabItem) === null || _this$_activeTabItem3 === void 0 || _this$_activeTabItem3.removeEventListener("pointerup", this._upAction);
|
|
21053
|
-
this.removeListener();
|
|
21054
21678
|
this._config.onChangeTab(downEvent, slideItemId);
|
|
21055
21679
|
return;
|
|
21056
21680
|
}
|
|
@@ -21058,6 +21682,7 @@ var SlideTabBar = class SlideTabBar {
|
|
|
21058
21682
|
this._downActionX = downEvent.pageX;
|
|
21059
21683
|
this._moveActionX = 0;
|
|
21060
21684
|
this._scrollIncremental = 0;
|
|
21685
|
+
this._dragStartScrollX = this._slideScrollbar.getScrollX();
|
|
21061
21686
|
this._activeTabItem = this._slideTabItems[slideItemIndex];
|
|
21062
21687
|
if (!this._activeTabItem) {
|
|
21063
21688
|
console.error("Not found active slide-tab-item in sheet bar");
|
|
@@ -21094,23 +21719,29 @@ var SlideTabBar = class SlideTabBar {
|
|
|
21094
21719
|
}, SlideTabBar.LongPressDelay);
|
|
21095
21720
|
};
|
|
21096
21721
|
this._upAction = (upEvent) => {
|
|
21097
|
-
var _this$_activeTabItem8, _this$_activeTabItem9, _this$_activeTabItem10
|
|
21098
|
-
if ((_this$_activeTabItem8 = this._activeTabItem) === null || _this$_activeTabItem8 === void 0 ? void 0 : _this$_activeTabItem8.isEditMode()) return;
|
|
21722
|
+
var _this$_activeTabItem8, _this$_activeTabItem9, _this$_activeTabItem10;
|
|
21099
21723
|
if (this._longPressTimer) {
|
|
21100
21724
|
clearTimeout(this._longPressTimer);
|
|
21101
21725
|
this._longPressTimer = null;
|
|
21102
21726
|
}
|
|
21103
21727
|
if (!this._activeTabItem) return;
|
|
21728
|
+
if (this._activeTabItem.isEditMode()) {
|
|
21729
|
+
const activeSlideItemElement = this._activeTabItem.getSlideTabItem();
|
|
21730
|
+
const pointerId = upEvent.pointerId;
|
|
21731
|
+
if (pointerId != null && activeSlideItemElement.hasPointerCapture(pointerId)) activeSlideItemElement.releasePointerCapture(pointerId);
|
|
21732
|
+
this._activeTabItem.removeEventListener("pointerup", this._upAction);
|
|
21733
|
+
return;
|
|
21734
|
+
}
|
|
21104
21735
|
const isFromScroll = this._autoScrollTime !== null;
|
|
21105
21736
|
this._closeAutoScroll();
|
|
21106
21737
|
this._activeTabItem.disableFixed();
|
|
21107
21738
|
this.updateItems();
|
|
21108
|
-
const activeSlideItemElement = (_this$
|
|
21739
|
+
const activeSlideItemElement = (_this$_activeTabItem8 = this._activeTabItem) === null || _this$_activeTabItem8 === void 0 ? void 0 : _this$_activeTabItem8.getSlideTabItem();
|
|
21109
21740
|
if (!activeSlideItemElement) return;
|
|
21110
21741
|
activeSlideItemElement.style.cursor = "";
|
|
21111
21742
|
activeSlideItemElement.releasePointerCapture(upEvent.pointerId);
|
|
21112
|
-
(_this$
|
|
21113
|
-
(_this$
|
|
21743
|
+
(_this$_activeTabItem9 = this._activeTabItem) === null || _this$_activeTabItem9 === void 0 || _this$_activeTabItem9.removeEventListener("pointermove", this._moveAction);
|
|
21744
|
+
(_this$_activeTabItem10 = this._activeTabItem) === null || _this$_activeTabItem10 === void 0 || _this$_activeTabItem10.removeEventListener("pointerup", this._upAction);
|
|
21114
21745
|
if (this._config.onSlideEnd && this._activeTabItemIndex !== this._compareIndex && isFromScroll) {
|
|
21115
21746
|
this.removeListener();
|
|
21116
21747
|
this._config.onSlideEnd(upEvent, this._compareIndex || 0);
|
|
@@ -21118,6 +21749,7 @@ var SlideTabBar = class SlideTabBar {
|
|
|
21118
21749
|
this._scrollIncremental = 0;
|
|
21119
21750
|
this._downActionX = 0;
|
|
21120
21751
|
this._moveActionX = 0;
|
|
21752
|
+
this._dragStartScrollX = this._slideScrollbar.getScrollX();
|
|
21121
21753
|
this._compareIndex = 0;
|
|
21122
21754
|
};
|
|
21123
21755
|
this._moveAction = (moveEvent) => {
|
|
@@ -21154,9 +21786,9 @@ var SlideTabBar = class SlideTabBar {
|
|
|
21154
21786
|
* @param currentIndex
|
|
21155
21787
|
*/
|
|
21156
21788
|
update(currentIndex) {
|
|
21789
|
+
this.removeListener();
|
|
21157
21790
|
this._config.currentIndex = currentIndex;
|
|
21158
21791
|
this._initConfig();
|
|
21159
|
-
this.removeListener();
|
|
21160
21792
|
this.addListener();
|
|
21161
21793
|
this.scrollToItem(currentIndex);
|
|
21162
21794
|
}
|
|
@@ -21293,13 +21925,13 @@ var SlideTabBar = class SlideTabBar {
|
|
|
21293
21925
|
return scrollX;
|
|
21294
21926
|
}
|
|
21295
21927
|
calculateActiveTabItemScrollX() {
|
|
21296
|
-
var _this$
|
|
21928
|
+
var _this$_activeTabItem11;
|
|
21297
21929
|
let scrollX = 0;
|
|
21298
21930
|
const padding = 4;
|
|
21299
21931
|
const containerRect = this._slideTabBar.getBoundingClientRect();
|
|
21300
21932
|
const containerLeftPosition = containerRect.left;
|
|
21301
21933
|
const containerRightPosition = containerRect.left + containerRect.width;
|
|
21302
|
-
const itemReact = (_this$
|
|
21934
|
+
const itemReact = (_this$_activeTabItem11 = this._activeTabItem) === null || _this$_activeTabItem11 === void 0 ? void 0 : _this$_activeTabItem11.getSlideTabItem().getBoundingClientRect();
|
|
21303
21935
|
if (!itemReact) return 0;
|
|
21304
21936
|
const itemLeft = itemReact.left;
|
|
21305
21937
|
const itemWidth = itemReact.width;
|
|
@@ -21311,6 +21943,7 @@ var SlideTabBar = class SlideTabBar {
|
|
|
21311
21943
|
this.removeListener();
|
|
21312
21944
|
this._downActionX = 0;
|
|
21313
21945
|
this._moveActionX = 0;
|
|
21946
|
+
this._dragStartScrollX = this._slideScrollbar.getScrollX();
|
|
21314
21947
|
this._compareDirection = 0;
|
|
21315
21948
|
this._compareIndex = 0;
|
|
21316
21949
|
this._slideTabItems = [];
|
|
@@ -21364,17 +21997,18 @@ var SlideTabBar = class SlideTabBar {
|
|
|
21364
21997
|
}
|
|
21365
21998
|
_updateDragSortState() {
|
|
21366
21999
|
if (!this._activeTabItem) return;
|
|
22000
|
+
const dragSortOffsetX = this._moveActionX + this._slideScrollbar.getScrollX() - this._dragStartScrollX;
|
|
21367
22001
|
const dragSortResult = calculateSheetTabDragSort(this._slideTabItems.map((item) => ({
|
|
21368
22002
|
id: item.getId(),
|
|
21369
22003
|
left: item.getMidLine() - item.getWidth() / 2,
|
|
21370
22004
|
width: item.getWidth()
|
|
21371
|
-
})), this._activeTabItemIndex,
|
|
22005
|
+
})), this._activeTabItemIndex, dragSortOffsetX);
|
|
21372
22006
|
this._compareIndex = dragSortResult.targetIndex;
|
|
21373
22007
|
dragSortResult.itemOffsets.forEach((offset, index) => {
|
|
21374
22008
|
const item = this._slideTabItems[index];
|
|
21375
22009
|
if (!item) return;
|
|
21376
22010
|
if (item.equals(this._activeTabItem)) {
|
|
21377
|
-
this._compareDirection = item.translateX(
|
|
22011
|
+
this._compareDirection = item.translateX(this._moveActionX);
|
|
21378
22012
|
return;
|
|
21379
22013
|
}
|
|
21380
22014
|
item.animate().translateX(offset);
|
|
@@ -21428,7 +22062,9 @@ function SheetBarTabs() {
|
|
|
21428
22062
|
const [contextMenuAnchorRect, setContextMenuAnchorRect] = (0, react.useState)(null);
|
|
21429
22063
|
const slideTabBarRef = (0, react.useRef)(null);
|
|
21430
22064
|
const slideTabBarContainerRef = (0, react.useRef)(null);
|
|
22065
|
+
const activeSheetIdRef = (0, react.useRef)(activeSheetId);
|
|
21431
22066
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
22067
|
+
const renderManagerService = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService);
|
|
21432
22068
|
const sheetBarService = (0, _univerjs_ui.useDependency)(ISheetBarService);
|
|
21433
22069
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
21434
22070
|
const confirmService = (0, _univerjs_ui.useDependency)(_univerjs_core.IConfirmService);
|
|
@@ -21437,6 +22073,7 @@ function SheetBarTabs() {
|
|
|
21437
22073
|
const rangeProtectionRuleModel = (0, _univerjs_ui.useDependency)(_univerjs_sheets.RangeProtectionRuleModel);
|
|
21438
22074
|
const permissionService = (0, _univerjs_ui.useDependency)(_univerjs_core.IPermissionService);
|
|
21439
22075
|
const workbook = useActiveWorkbook();
|
|
22076
|
+
const workbookRef = (0, react.useRef)(workbook);
|
|
21440
22077
|
const resetOrder = (0, _univerjs_ui.useObservable)(worksheetProtectionRuleModel.resetOrder$);
|
|
21441
22078
|
const config = (0, _univerjs_ui.useConfigValue)(_univerjs_ui.UI_PLUGIN_CONFIG_KEY);
|
|
21442
22079
|
const showContextMenu = (_config$contextMenu = config === null || config === void 0 ? void 0 : config.contextMenu) !== null && _config$contextMenu !== void 0 ? _config$contextMenu : true;
|
|
@@ -21490,9 +22127,9 @@ function SheetBarTabs() {
|
|
|
21490
22127
|
openSheetNameErrorDialog("sheetNameSpecCharAlert", localeService.t("sheets-ui.sheetConfig.sheetNameSpecCharError"));
|
|
21491
22128
|
return true;
|
|
21492
22129
|
}, [localeService, openSheetNameErrorDialog]);
|
|
21493
|
-
const nameRepeatCheck = (0, react.useCallback)((name) => {
|
|
21494
|
-
var _workbook$getActiveSh;
|
|
21495
|
-
if (((_workbook$getActiveSh = workbook.getActiveSheet()) === null || _workbook$getActiveSh === void 0 ? void 0 : _workbook$getActiveSh.getName()) === name) return false;
|
|
22130
|
+
const nameRepeatCheck = (0, react.useCallback)((name, subUnitId) => {
|
|
22131
|
+
var _workbook$getSheetByS, _workbook$getActiveSh;
|
|
22132
|
+
if ((subUnitId ? (_workbook$getSheetByS = workbook.getSheetBySheetId(subUnitId)) === null || _workbook$getSheetByS === void 0 ? void 0 : _workbook$getSheetByS.getName() : (_workbook$getActiveSh = workbook.getActiveSheet()) === null || _workbook$getActiveSh === void 0 ? void 0 : _workbook$getActiveSh.getName()) === name) return false;
|
|
21496
22133
|
if (!workbook.checkSheetName(name)) return false;
|
|
21497
22134
|
const id = "sheetNameRepeatAlert";
|
|
21498
22135
|
confirmService.open({
|
|
@@ -21583,6 +22220,34 @@ function SheetBarTabs() {
|
|
|
21583
22220
|
rightEnd: slideTabBar.isRightEnd()
|
|
21584
22221
|
});
|
|
21585
22222
|
}, [sheetBarService]);
|
|
22223
|
+
(0, react.useEffect)(() => {
|
|
22224
|
+
activeSheetIdRef.current = activeSheetId;
|
|
22225
|
+
}, [activeSheetId]);
|
|
22226
|
+
(0, react.useEffect)(() => {
|
|
22227
|
+
workbookRef.current = workbook;
|
|
22228
|
+
}, [workbook]);
|
|
22229
|
+
const syncActiveSheetRender = (0, react.useCallback)((subUnitId) => {
|
|
22230
|
+
const render = renderManagerService.getRenderById(workbookRef.current.getUnitId());
|
|
22231
|
+
try {
|
|
22232
|
+
render === null || render === void 0 || render.with(SheetSkeletonManagerService).setCurrent({ sheetId: subUnitId });
|
|
22233
|
+
render === null || render === void 0 || render.scene.makeDirty(true);
|
|
22234
|
+
render === null || render === void 0 || render.scene.render();
|
|
22235
|
+
} catch {}
|
|
22236
|
+
}, [renderManagerService]);
|
|
22237
|
+
const activateSheetTab = (0, react.useCallback)((subUnitId) => {
|
|
22238
|
+
if (!subUnitId || subUnitId === activeSheetIdRef.current) return;
|
|
22239
|
+
commandService.executeCommand(_univerjs_sheets.SetWorksheetActiveOperation.id, {
|
|
22240
|
+
subUnitId,
|
|
22241
|
+
unitId: workbookRef.current.getUnitId()
|
|
22242
|
+
}).then((result) => {
|
|
22243
|
+
if (result !== false) return;
|
|
22244
|
+
const worksheet = workbookRef.current.getSheetBySheetId(subUnitId);
|
|
22245
|
+
if (worksheet) {
|
|
22246
|
+
workbookRef.current.setActiveSheet(worksheet);
|
|
22247
|
+
syncActiveSheetRender(subUnitId);
|
|
22248
|
+
}
|
|
22249
|
+
});
|
|
22250
|
+
}, [commandService, syncActiveSheetRender]);
|
|
21586
22251
|
const observeResize = (0, react.useCallback)((slideTabBar) => {
|
|
21587
22252
|
var _slideTabBarContainer;
|
|
21588
22253
|
const slideTabBarContainer = (_slideTabBarContainer = slideTabBarContainerRef.current) === null || _slideTabBarContainer === void 0 ? void 0 : _slideTabBarContainer.querySelector("[data-u-comp=slide-tab-bar]");
|
|
@@ -21691,8 +22356,8 @@ function SheetBarTabs() {
|
|
|
21691
22356
|
slideTabBarContainer: slideTabBarContainerRef.current,
|
|
21692
22357
|
currentIndex: 0,
|
|
21693
22358
|
onChangeName: (subUnitId, worksheetName) => {
|
|
21694
|
-
var _workbook$
|
|
21695
|
-
if (((_workbook$
|
|
22359
|
+
var _workbook$getSheetByS2;
|
|
22360
|
+
if (((_workbook$getSheetByS2 = workbook.getSheetBySheetId(subUnitId)) === null || _workbook$getSheetByS2 === void 0 ? void 0 : _workbook$getSheetByS2.getName()) === worksheetName) {
|
|
21696
22361
|
updateSheetItems();
|
|
21697
22362
|
return;
|
|
21698
22363
|
}
|
|
@@ -21702,7 +22367,8 @@ function SheetBarTabs() {
|
|
|
21702
22367
|
});
|
|
21703
22368
|
},
|
|
21704
22369
|
onSlideEnd: async (event, order) => {
|
|
21705
|
-
|
|
22370
|
+
const targetOrder = getSheetTabTargetOrder(workbook.getSheetOrders(), workbook.getUnhiddenWorksheets(), order);
|
|
22371
|
+
await commandService.executeCommand(_univerjs_sheets.SetWorksheetOrderCommand.id, { order: targetOrder });
|
|
21706
22372
|
},
|
|
21707
22373
|
onChangeTab: (_event, subUnitId) => {
|
|
21708
22374
|
commandService.executeCommand(_univerjs_sheets.SetWorksheetActiveOperation.id, {
|
|
@@ -21713,8 +22379,8 @@ function SheetBarTabs() {
|
|
|
21713
22379
|
onScroll: (state) => {
|
|
21714
22380
|
sheetBarService.setScroll(state);
|
|
21715
22381
|
},
|
|
21716
|
-
onNameCheckAlert: (name) => {
|
|
21717
|
-
return nameEmptyCheck(name) || sheetNameSpecCharCheck(name) || nameRepeatCheck(name);
|
|
22382
|
+
onNameCheckAlert: (name, subUnitId) => {
|
|
22383
|
+
return nameEmptyCheck(name) || sheetNameSpecCharCheck(name) || nameRepeatCheck(name, subUnitId);
|
|
21718
22384
|
},
|
|
21719
22385
|
onNameChangeCheck: canRenameActiveSheet
|
|
21720
22386
|
});
|
|
@@ -21748,6 +22414,9 @@ function SheetBarTabs() {
|
|
|
21748
22414
|
const renameSubscription = sheetBarService.renameId$.subscribe(() => {
|
|
21749
22415
|
setTabEditor();
|
|
21750
22416
|
});
|
|
22417
|
+
const activeSheetSubscription = workbook.activeSheet$.subscribe(() => {
|
|
22418
|
+
updateSheetItems();
|
|
22419
|
+
});
|
|
21751
22420
|
return () => {
|
|
21752
22421
|
commandDisposable.dispose();
|
|
21753
22422
|
slideTabBar.destroy();
|
|
@@ -21755,6 +22424,7 @@ function SheetBarTabs() {
|
|
|
21755
22424
|
scrollSubscription.unsubscribe();
|
|
21756
22425
|
scrollXSubscription.unsubscribe();
|
|
21757
22426
|
renameSubscription.unsubscribe();
|
|
22427
|
+
activeSheetSubscription.unsubscribe();
|
|
21758
22428
|
disconnectResizeObserver === null || disconnectResizeObserver === void 0 || disconnectResizeObserver();
|
|
21759
22429
|
};
|
|
21760
22430
|
}, [
|
|
@@ -21773,6 +22443,19 @@ function SheetBarTabs() {
|
|
|
21773
22443
|
const currentIndex = sheetList.findIndex((item) => item.sheetId === activeSheetId);
|
|
21774
22444
|
(_slideTabBarRef$curre5 = slideTabBarRef.current) === null || _slideTabBarRef$curre5 === void 0 || _slideTabBarRef$curre5.update(currentIndex >= 0 ? currentIndex : 0);
|
|
21775
22445
|
}, [activeSheetId, sheetList]);
|
|
22446
|
+
(0, react.useEffect)(() => {
|
|
22447
|
+
const handlePointerDownCapture = (event) => {
|
|
22448
|
+
var _tabElement$getAttrib;
|
|
22449
|
+
const container = slideTabBarContainerRef.current;
|
|
22450
|
+
const target = event.target;
|
|
22451
|
+
if (!container || !(target instanceof Element)) return;
|
|
22452
|
+
const tabElement = target.closest("[data-u-comp=slide-tab-item]");
|
|
22453
|
+
if (!tabElement || !container.contains(tabElement)) return;
|
|
22454
|
+
activateSheetTab((_tabElement$getAttrib = tabElement.getAttribute("data-id")) !== null && _tabElement$getAttrib !== void 0 ? _tabElement$getAttrib : void 0);
|
|
22455
|
+
};
|
|
22456
|
+
document.addEventListener("pointerdown", handlePointerDownCapture, true);
|
|
22457
|
+
return () => document.removeEventListener("pointerdown", handlePointerDownCapture, true);
|
|
22458
|
+
}, [activateSheetTab]);
|
|
21776
22459
|
(0, react.useEffect)(() => {
|
|
21777
22460
|
const subscription = (0, rxjs.merge)(worksheetProtectionRuleModel.ruleChange$, rangeProtectionRuleModel.ruleChange$).subscribe(() => {
|
|
21778
22461
|
updateSheetItems();
|
|
@@ -22120,31 +22803,52 @@ function RenderSheetFooter() {
|
|
|
22120
22803
|
const config = (0, _univerjs_ui.useConfigValue)(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
22121
22804
|
const menuManagerService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IMenuManagerService);
|
|
22122
22805
|
const showFooter = (_config$footer = config === null || config === void 0 ? void 0 : config.footer) !== null && _config$footer !== void 0 ? _config$footer : true;
|
|
22123
|
-
|
|
22806
|
+
const workbook = useActiveWorkbook();
|
|
22807
|
+
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
22808
|
+
const focusedUnitType = useFocusedUnitType();
|
|
22809
|
+
const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
|
|
22810
|
+
if (!workbook || !showFooter) return null;
|
|
22811
|
+
if (activeWorkbookEmbeddedRender) return null;
|
|
22812
|
+
if (!activeEmbedTab && focusedUnitType != null && focusedUnitType !== _univerjs_core.UniverInstanceType.UNIVER_SHEET) return null;
|
|
22124
22813
|
const footerMenus = menuManagerService.getMenuByPositionKey(_univerjs_ui.ContextMenuPosition.FOOTER_MENU);
|
|
22125
22814
|
const { sheetBar = true, statisticBar = true, menus = true, zoomSlider = true } = (config === null || config === void 0 ? void 0 : config.footer) || {};
|
|
22126
|
-
|
|
22815
|
+
const showStatisticBar = activeEmbedTab ? false : statisticBar;
|
|
22816
|
+
const showMenus = activeEmbedTab ? false : menus;
|
|
22817
|
+
const showZoomSlider = activeEmbedTab ? false : zoomSlider;
|
|
22818
|
+
if (!sheetBar && !showStatisticBar && !showMenus && !showZoomSlider) return null;
|
|
22127
22819
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
22128
22820
|
className: "univer-box-border univer-grid univer-w-full univer-grid-flow-col univer-grid-cols-[1fr,auto,auto,auto] univer-items-center univer-justify-between univer-bg-white univer-px-5 univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-gray-200",
|
|
22129
22821
|
style: { height: 36 },
|
|
22130
22822
|
"data-range-selector": true,
|
|
22131
22823
|
children: [
|
|
22132
22824
|
sheetBar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SheetBar, {}),
|
|
22133
|
-
|
|
22134
|
-
|
|
22825
|
+
showStatisticBar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusBar, {}),
|
|
22826
|
+
showMenus && footerMenus.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
22135
22827
|
className: "univer-box-border univer-flex univer-gap-2 univer-px-2",
|
|
22136
22828
|
children: footerMenus.map((item) => {
|
|
22137
22829
|
var _item$children;
|
|
22138
22830
|
return (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.map((child) => (child === null || child === void 0 ? void 0 : child.item) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_ui.ToolbarItem, { ...child.item }, child.key));
|
|
22139
22831
|
})
|
|
22140
22832
|
}),
|
|
22141
|
-
|
|
22833
|
+
showZoomSlider && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SheetZoomSlider, {})
|
|
22142
22834
|
]
|
|
22143
22835
|
});
|
|
22144
22836
|
}
|
|
22145
22837
|
function RenderSheetHeader() {
|
|
22146
22838
|
const config = (0, _univerjs_ui.useConfigValue)(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
22147
|
-
|
|
22839
|
+
const workbook = useActiveWorkbook();
|
|
22840
|
+
const hasWorkbook = !!workbook;
|
|
22841
|
+
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
22842
|
+
const focusedUnitType = useFocusedUnitType();
|
|
22843
|
+
const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
|
|
22844
|
+
if (!hasWorkbook) return null;
|
|
22845
|
+
if (activeWorkbookEmbeddedRender) return null;
|
|
22846
|
+
if (activeEmbedTab) return null;
|
|
22847
|
+
if (focusedUnitType != null && focusedUnitType !== _univerjs_core.UniverInstanceType.UNIVER_SHEET) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
22848
|
+
"aria-hidden": true,
|
|
22849
|
+
className: "univer-h-7 univer-border-b univer-border-gray-200 univer-bg-white dark:!univer-border-gray-700 dark:!univer-bg-gray-900",
|
|
22850
|
+
"data-u-comp": "formula-bar-placeholder"
|
|
22851
|
+
});
|
|
22148
22852
|
if ((config === null || config === void 0 ? void 0 : config.formulaBar) !== false) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormulaBar, {});
|
|
22149
22853
|
return null;
|
|
22150
22854
|
}
|
|
@@ -22152,19 +22856,108 @@ function RenderSheetHeader() {
|
|
|
22152
22856
|
* @deprecated We should not write into this component anymore.
|
|
22153
22857
|
*/
|
|
22154
22858
|
function RenderSheetContent() {
|
|
22859
|
+
var _componentManager$get;
|
|
22155
22860
|
const config = (0, _univerjs_ui.useConfigValue)(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
22156
22861
|
const hasWorkbook = useHasWorkbook();
|
|
22157
|
-
const
|
|
22862
|
+
const componentManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.ComponentManager);
|
|
22863
|
+
const workbook = useActiveWorkbook();
|
|
22864
|
+
const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
|
|
22865
|
+
const injector = (0, _univerjs_ui.useDependency)(_univerjs_core.Injector);
|
|
22866
|
+
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
22867
|
+
const ShapeTextEditorContainer = (_componentManager$get = componentManager.get("SheetShapeTextEditorContainer")) !== null && _componentManager$get !== void 0 ? _componentManager$get : componentManager.get("ShapeTextEditorContainer");
|
|
22868
|
+
(0, react.useEffect)(() => {
|
|
22869
|
+
var _tryGetSheetEmbedRunt;
|
|
22870
|
+
if (!workbook || activeEmbedTab || activeWorkbookEmbeddedRender) return;
|
|
22871
|
+
const instanceService = injector.get(_univerjs_core.IUniverInstanceService);
|
|
22872
|
+
instanceService.setCurrentUnitForType(workbook.getUnitId());
|
|
22873
|
+
instanceService.focusUnit(workbook.getUnitId());
|
|
22874
|
+
(_tryGetSheetEmbedRunt = tryGetSheetEmbedRuntimeService(injector)) === null || _tryGetSheetEmbedRunt === void 0 || _tryGetSheetEmbedRunt.clearTab();
|
|
22875
|
+
}, [
|
|
22876
|
+
activeEmbedTab,
|
|
22877
|
+
activeWorkbookEmbeddedRender,
|
|
22878
|
+
injector,
|
|
22879
|
+
workbook
|
|
22880
|
+
]);
|
|
22158
22881
|
if (!hasWorkbook) return null;
|
|
22882
|
+
if (activeWorkbookEmbeddedRender) return null;
|
|
22883
|
+
if (activeEmbedTab && workbook) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderSheetEmbedTabHost, {
|
|
22884
|
+
workbook,
|
|
22885
|
+
worksheet: activeEmbedTab.worksheet
|
|
22886
|
+
});
|
|
22159
22887
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
22160
22888
|
ShapeTextEditorContainer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShapeTextEditorContainer, {}),
|
|
22161
22889
|
!(config === null || config === void 0 ? void 0 : config.disableEdit) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditorContainer, {}),
|
|
22162
22890
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AutoFillPopupMenu, {})
|
|
22163
22891
|
] });
|
|
22164
22892
|
}
|
|
22893
|
+
function RenderSheetEmbedTabHost(props) {
|
|
22894
|
+
const { workbook, worksheet } = props;
|
|
22895
|
+
const injector = (0, _univerjs_ui.useDependency)(_univerjs_core.Injector);
|
|
22896
|
+
const embedData = getEmbedSheetsTabCustomData(worksheet.getConfig());
|
|
22897
|
+
const hostUnitId = workbook.getUnitId();
|
|
22898
|
+
const hostAnchorId = embedData === null || embedData === void 0 ? void 0 : embedData.hostAnchorId;
|
|
22899
|
+
const embedId = embedData === null || embedData === void 0 ? void 0 : embedData.embedId;
|
|
22900
|
+
(0, react.useEffect)(() => {
|
|
22901
|
+
if (!embedId || !hostAnchorId) return;
|
|
22902
|
+
const embedRuntimeService = tryGetSheetEmbedRuntimeService(injector);
|
|
22903
|
+
if (!embedRuntimeService) return;
|
|
22904
|
+
try {
|
|
22905
|
+
const disposable = embedRuntimeService.mountSheetTab({
|
|
22906
|
+
hostUnitId,
|
|
22907
|
+
hostAnchorId,
|
|
22908
|
+
embedId
|
|
22909
|
+
});
|
|
22910
|
+
return () => {
|
|
22911
|
+
disposable === null || disposable === void 0 || disposable.dispose();
|
|
22912
|
+
};
|
|
22913
|
+
} catch (error) {
|
|
22914
|
+
console.warn("[sheets-ui] failed to mount embedded sheet-tab block", error);
|
|
22915
|
+
}
|
|
22916
|
+
}, [
|
|
22917
|
+
embedId,
|
|
22918
|
+
hostAnchorId,
|
|
22919
|
+
hostUnitId,
|
|
22920
|
+
injector
|
|
22921
|
+
]);
|
|
22922
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
22923
|
+
"data-embed-sheets-sheet-tab-host": hostAnchorId,
|
|
22924
|
+
className: "univer-absolute univer-inset-0 univer-z-40 univer-bg-white dark:!univer-bg-gray-900"
|
|
22925
|
+
});
|
|
22926
|
+
}
|
|
22165
22927
|
function useHasWorkbook() {
|
|
22166
22928
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
22167
|
-
|
|
22929
|
+
const workbook = (0, _univerjs_ui.useObservable)(() => univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), null, false, []);
|
|
22930
|
+
return (0, react.useMemo)(() => !!workbook, [workbook]);
|
|
22931
|
+
}
|
|
22932
|
+
function useActiveWorkbookIsEmbeddedRender(workbook) {
|
|
22933
|
+
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
22934
|
+
return (0, react.useMemo)(() => {
|
|
22935
|
+
var _univerInstanceServic;
|
|
22936
|
+
if (!workbook) return false;
|
|
22937
|
+
return ((_univerInstanceServic = univerInstanceService.getUnitCreateOptions(workbook.getUnitId())) === null || _univerInstanceServic === void 0 ? void 0 : _univerInstanceServic.embeddedRender) === true;
|
|
22938
|
+
}, [univerInstanceService, workbook]);
|
|
22939
|
+
}
|
|
22940
|
+
function useFocusedUnitType() {
|
|
22941
|
+
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
22942
|
+
const focusedUnitId = (0, _univerjs_ui.useObservable)(() => univerInstanceService.focused$, null, false, [univerInstanceService]);
|
|
22943
|
+
return (0, react.useMemo)(() => {
|
|
22944
|
+
var _focusedUnit$type;
|
|
22945
|
+
if (!focusedUnitId) return null;
|
|
22946
|
+
if ((0, _univerjs_core.isInternalEditorID)(focusedUnitId) && univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET)) return _univerjs_core.UniverInstanceType.UNIVER_SHEET;
|
|
22947
|
+
const focusedUnit = univerInstanceService.getUnit(focusedUnitId);
|
|
22948
|
+
return (_focusedUnit$type = focusedUnit === null || focusedUnit === void 0 ? void 0 : focusedUnit.type) !== null && _focusedUnit$type !== void 0 ? _focusedUnit$type : null;
|
|
22949
|
+
}, [focusedUnitId, univerInstanceService]);
|
|
22950
|
+
}
|
|
22951
|
+
function useActiveSheetEmbedTabData(workbook) {
|
|
22952
|
+
const worksheet = useActiveWorksheet(workbook);
|
|
22953
|
+
return worksheet && getEmbedSheetsTabCustomData(worksheet.getConfig()) ? { worksheet } : void 0;
|
|
22954
|
+
}
|
|
22955
|
+
function tryGetSheetEmbedRuntimeService(injector) {
|
|
22956
|
+
try {
|
|
22957
|
+
return injector.get(ISheetEmbedRuntimeService);
|
|
22958
|
+
} catch {
|
|
22959
|
+
return;
|
|
22960
|
+
}
|
|
22168
22961
|
}
|
|
22169
22962
|
|
|
22170
22963
|
//#endregion
|
|
@@ -22735,10 +23528,8 @@ let SheetUIController = class SheetUIController extends _univerjs_core.Disposabl
|
|
|
22735
23528
|
}
|
|
22736
23529
|
_initFocusHandler() {
|
|
22737
23530
|
this.disposeWithMe(this._layoutService.registerFocusHandler(_univerjs_core.UniverInstanceType.UNIVER_SHEET, (_unitId) => {
|
|
22738
|
-
const
|
|
22739
|
-
const
|
|
22740
|
-
const currentEditorRender = (0, _univerjs_engine_render.getCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_DOC, instanceService, renderManagerService);
|
|
22741
|
-
const docSelectionRenderService = currentEditorRender === null || currentEditorRender === void 0 ? void 0 : currentEditorRender.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
23531
|
+
const cellEditorRender = this._injector.get(_univerjs_engine_render.IRenderManagerService).getRenderById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
23532
|
+
const docSelectionRenderService = cellEditorRender === null || cellEditorRender === void 0 ? void 0 : cellEditorRender.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
22742
23533
|
docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
22743
23534
|
}));
|
|
22744
23535
|
}
|
|
@@ -22779,7 +23570,7 @@ const useHighlightRange = (ranges = []) => {
|
|
|
22779
23570
|
//#endregion
|
|
22780
23571
|
//#region package.json
|
|
22781
23572
|
var name = "@univerjs/sheets-ui";
|
|
22782
|
-
var version = "1.0.0-alpha.
|
|
23573
|
+
var version = "1.0.0-alpha.3";
|
|
22783
23574
|
|
|
22784
23575
|
//#endregion
|
|
22785
23576
|
//#region src/controllers/cell-alert.controller.ts
|
|
@@ -22825,6 +23616,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
22825
23616
|
this._selectionManagerService = _selectionManagerService;
|
|
22826
23617
|
_defineProperty(this, "_popupMenuFeatureMap", /* @__PURE__ */ new Map());
|
|
22827
23618
|
_defineProperty(this, "_popupMenuOffsetMap", /* @__PURE__ */ new Map());
|
|
23619
|
+
_defineProperty(this, "_popupDisposables", /* @__PURE__ */ new Set());
|
|
22828
23620
|
_defineProperty(this, "_isSelectionMoving", false);
|
|
22829
23621
|
this._initMoving();
|
|
22830
23622
|
}
|
|
@@ -22873,6 +23665,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
22873
23665
|
if (callback) return callback(unitId, subUnitId, drawingId, drawingType);
|
|
22874
23666
|
}
|
|
22875
23667
|
dispose() {
|
|
23668
|
+
Array.from(this._popupDisposables).forEach((disposable) => disposable.dispose());
|
|
23669
|
+
this._popupDisposables.clear();
|
|
22876
23670
|
super.dispose();
|
|
22877
23671
|
this._popupMenuFeatureMap.clear();
|
|
22878
23672
|
this._popupMenuOffsetMap.clear();
|
|
@@ -23003,20 +23797,25 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
23003
23797
|
bottom: top + height
|
|
23004
23798
|
};
|
|
23005
23799
|
const { position, position$, disposable } = this._createPositionObserver(bound, currentRender, skeleton, worksheet);
|
|
23800
|
+
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
23006
23801
|
const id = this._globalPopupManagerService.addPopup({
|
|
23007
23802
|
...popup,
|
|
23008
23803
|
unitId,
|
|
23009
23804
|
subUnitId,
|
|
23805
|
+
connectorInjector: popupInjector,
|
|
23010
23806
|
anchorRect: position,
|
|
23011
23807
|
anchorRect$: position$,
|
|
23012
23808
|
canvasElement: currentRender.engine.getCanvasElement()
|
|
23013
23809
|
});
|
|
23810
|
+
const disposableCollection = new _univerjs_core.DisposableCollection();
|
|
23811
|
+
disposableCollection.add(disposable);
|
|
23812
|
+
disposableCollection.add((0, _univerjs_core.toDisposable)(() => {
|
|
23813
|
+
this._globalPopupManagerService.removePopup(id);
|
|
23814
|
+
position$.complete();
|
|
23815
|
+
}));
|
|
23816
|
+
const trackedDisposable = this._trackPopupDisposable(disposableCollection);
|
|
23014
23817
|
return {
|
|
23015
|
-
dispose: () =>
|
|
23016
|
-
this._globalPopupManagerService.removePopup(id);
|
|
23017
|
-
position$.complete();
|
|
23018
|
-
disposable.dispose();
|
|
23019
|
-
},
|
|
23818
|
+
dispose: () => trackedDisposable.dispose(),
|
|
23020
23819
|
canDispose: () => this._globalPopupManagerService.activePopupId !== id
|
|
23021
23820
|
};
|
|
23022
23821
|
}
|
|
@@ -23040,28 +23839,42 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
23040
23839
|
skeleton,
|
|
23041
23840
|
currentRender
|
|
23042
23841
|
});
|
|
23842
|
+
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
23043
23843
|
const id = this._globalPopupManagerService.addPopup({
|
|
23044
23844
|
...popup,
|
|
23045
23845
|
unitId,
|
|
23046
23846
|
subUnitId,
|
|
23847
|
+
connectorInjector: popupInjector,
|
|
23047
23848
|
anchorRect: position,
|
|
23048
23849
|
anchorRect$: position$,
|
|
23049
23850
|
hiddenRects$: rects$,
|
|
23050
23851
|
canvasElement: currentRender.engine.getCanvasElement()
|
|
23051
23852
|
});
|
|
23853
|
+
const disposableCollection = new _univerjs_core.DisposableCollection();
|
|
23854
|
+
disposableCollection.add(disposable);
|
|
23855
|
+
disposableCollection.add(rectsObserverDisposable);
|
|
23856
|
+
disposableCollection.add((0, _univerjs_core.toDisposable)(() => {
|
|
23857
|
+
this._globalPopupManagerService.removePopup(id);
|
|
23858
|
+
position$.complete();
|
|
23859
|
+
workbook = null;
|
|
23860
|
+
worksheet = null;
|
|
23861
|
+
}));
|
|
23862
|
+
const trackedDisposable = this._trackPopupDisposable(disposableCollection);
|
|
23052
23863
|
return {
|
|
23053
|
-
dispose: () =>
|
|
23054
|
-
this._globalPopupManagerService.removePopup(id);
|
|
23055
|
-
position$.complete();
|
|
23056
|
-
disposable.dispose();
|
|
23057
|
-
rectsObserverDisposable.dispose();
|
|
23058
|
-
workbook = null;
|
|
23059
|
-
worksheet = null;
|
|
23060
|
-
},
|
|
23864
|
+
dispose: () => trackedDisposable.dispose(),
|
|
23061
23865
|
canDispose: () => this._globalPopupManagerService.activePopupId !== id
|
|
23062
23866
|
};
|
|
23063
23867
|
}
|
|
23064
23868
|
attachPopupToAbsolutePosition(bound, popup, _unitId, _subUnitId) {
|
|
23869
|
+
const position$ = new rxjs.BehaviorSubject(bound);
|
|
23870
|
+
const disposable = this._attachAbsolutePopup(bound, position$.asObservable(), popup, _unitId, _subUnitId, () => position$.complete());
|
|
23871
|
+
if (!disposable) position$.complete();
|
|
23872
|
+
return disposable;
|
|
23873
|
+
}
|
|
23874
|
+
attachPopupToDynamicAbsolutePosition(bound, anchorRect$, popup, _unitId, _subUnitId) {
|
|
23875
|
+
return this._attachAbsolutePopup(bound, anchorRect$, popup, _unitId, _subUnitId);
|
|
23876
|
+
}
|
|
23877
|
+
_attachAbsolutePopup(bound, anchorRect$, popup, _unitId, _subUnitId, onDispose) {
|
|
23065
23878
|
var _this$_renderManagerS3;
|
|
23066
23879
|
const workbook = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
23067
23880
|
const worksheet = workbook.getActiveSheet();
|
|
@@ -23073,20 +23886,24 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
23073
23886
|
const currentRender = this._renderManagerService.getRenderById(unitId);
|
|
23074
23887
|
if (!currentRender || !skeleton) return null;
|
|
23075
23888
|
if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
|
|
23076
|
-
const
|
|
23889
|
+
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
23077
23890
|
const id = this._globalPopupManagerService.addPopup({
|
|
23078
23891
|
...popup,
|
|
23079
23892
|
unitId,
|
|
23080
23893
|
subUnitId,
|
|
23894
|
+
connectorInjector: popupInjector,
|
|
23081
23895
|
anchorRect: bound,
|
|
23082
|
-
anchorRect
|
|
23896
|
+
anchorRect$,
|
|
23083
23897
|
canvasElement: currentRender.engine.getCanvasElement()
|
|
23084
23898
|
});
|
|
23899
|
+
const disposableCollection = new _univerjs_core.DisposableCollection();
|
|
23900
|
+
disposableCollection.add((0, _univerjs_core.toDisposable)(() => {
|
|
23901
|
+
this._globalPopupManagerService.removePopup(id);
|
|
23902
|
+
onDispose === null || onDispose === void 0 || onDispose();
|
|
23903
|
+
}));
|
|
23904
|
+
const trackedDisposable = this._trackPopupDisposable(disposableCollection);
|
|
23085
23905
|
return {
|
|
23086
|
-
dispose: () =>
|
|
23087
|
-
this._globalPopupManagerService.removePopup(id);
|
|
23088
|
-
position$.complete();
|
|
23089
|
-
},
|
|
23906
|
+
dispose: () => trackedDisposable.dispose(),
|
|
23090
23907
|
canDispose: () => this._globalPopupManagerService.activePopupId !== id
|
|
23091
23908
|
};
|
|
23092
23909
|
}
|
|
@@ -23123,10 +23940,12 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
23123
23940
|
skeleton,
|
|
23124
23941
|
currentRender
|
|
23125
23942
|
});
|
|
23943
|
+
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
23126
23944
|
const id = this._globalPopupManagerService.addPopup({
|
|
23127
23945
|
...popup,
|
|
23128
23946
|
unitId,
|
|
23129
23947
|
subUnitId,
|
|
23948
|
+
connectorInjector: popupInjector,
|
|
23130
23949
|
anchorRect: position,
|
|
23131
23950
|
anchorRect$: position$,
|
|
23132
23951
|
canvasElement: currentRender.engine.getCanvasElement(),
|
|
@@ -23145,13 +23964,14 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
23145
23964
|
startColumn: col,
|
|
23146
23965
|
endColumn: col
|
|
23147
23966
|
};
|
|
23967
|
+
const trackedDisposable = this._trackPopupDisposable(disposableCollection);
|
|
23148
23968
|
disposableCollection.add(this._refRangeService.watchRange(unitId, subUnitId, watchedRange, (_, after) => {
|
|
23149
|
-
if (!after)
|
|
23969
|
+
if (!after) trackedDisposable.dispose();
|
|
23150
23970
|
else updateRowCol(after.startRow, after.startColumn);
|
|
23151
23971
|
}));
|
|
23152
23972
|
return {
|
|
23153
23973
|
dispose() {
|
|
23154
|
-
|
|
23974
|
+
trackedDisposable.dispose();
|
|
23155
23975
|
worksheet = null;
|
|
23156
23976
|
workbook = null;
|
|
23157
23977
|
},
|
|
@@ -23189,10 +24009,12 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
23189
24009
|
skeleton,
|
|
23190
24010
|
currentRender
|
|
23191
24011
|
});
|
|
24012
|
+
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
23192
24013
|
const id = this._globalPopupManagerService.addPopup({
|
|
23193
24014
|
...popup,
|
|
23194
24015
|
unitId,
|
|
23195
24016
|
subUnitId,
|
|
24017
|
+
connectorInjector: popupInjector,
|
|
23196
24018
|
anchorRect: position,
|
|
23197
24019
|
anchorRect$: position$,
|
|
23198
24020
|
canvasElement: currentRender.engine.getCanvasElement(),
|
|
@@ -23207,17 +24029,34 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
23207
24029
|
}));
|
|
23208
24030
|
disposableCollection.add(rectsObserverDisposable);
|
|
23209
24031
|
const watchedRange = { ...range };
|
|
24032
|
+
const trackedDisposable = this._trackPopupDisposable(disposableCollection);
|
|
23210
24033
|
disposableCollection.add(this._refRangeService.watchRange(unitId, subUnitId, watchedRange, (_, after) => {
|
|
23211
|
-
if (!after)
|
|
24034
|
+
if (!after) trackedDisposable.dispose();
|
|
23212
24035
|
else updateRange(after);
|
|
23213
24036
|
}));
|
|
23214
24037
|
return {
|
|
23215
24038
|
dispose() {
|
|
23216
|
-
|
|
24039
|
+
trackedDisposable.dispose();
|
|
23217
24040
|
},
|
|
23218
24041
|
canDispose: () => this._globalPopupManagerService.activePopupId !== id
|
|
23219
24042
|
};
|
|
23220
24043
|
}
|
|
24044
|
+
_resolveEmbeddedPopupInjector(unitId, currentRender) {
|
|
24045
|
+
var _this$_univerInstance, _currentRender$getInj;
|
|
24046
|
+
return ((_this$_univerInstance = this._univerInstanceService.getUnitCreateOptions(unitId)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.embeddedRender) === true ? (_currentRender$getInj = currentRender.getInjector) === null || _currentRender$getInj === void 0 ? void 0 : _currentRender$getInj.call(currentRender) : void 0;
|
|
24047
|
+
}
|
|
24048
|
+
_trackPopupDisposable(disposable) {
|
|
24049
|
+
let disposed = false;
|
|
24050
|
+
const trackedDisposables = this._popupDisposables;
|
|
24051
|
+
const trackedDisposable = { dispose: () => {
|
|
24052
|
+
if (disposed) return;
|
|
24053
|
+
disposed = true;
|
|
24054
|
+
trackedDisposables.delete(trackedDisposable);
|
|
24055
|
+
disposable.dispose();
|
|
24056
|
+
} };
|
|
24057
|
+
trackedDisposables.add(trackedDisposable);
|
|
24058
|
+
return { dispose: () => trackedDisposable.dispose() };
|
|
24059
|
+
}
|
|
23221
24060
|
/**
|
|
23222
24061
|
*
|
|
23223
24062
|
* @param initialRow
|
|
@@ -23233,7 +24072,10 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
23233
24072
|
const position$ = new rxjs.BehaviorSubject(position);
|
|
23234
24073
|
const updatePosition = () => position$.next(this._calcCellPositionByCell(row, col, currentRender, skeleton, activeViewport));
|
|
23235
24074
|
const disposable = new _univerjs_core.DisposableCollection();
|
|
23236
|
-
disposable.add(currentRender.engine.clientRect$.subscribe(
|
|
24075
|
+
disposable.add(currentRender.engine.clientRect$.subscribe({
|
|
24076
|
+
next: () => updatePosition(),
|
|
24077
|
+
error: () => {}
|
|
24078
|
+
}));
|
|
23237
24079
|
disposable.add((0, _univerjs_core.fromEventSubject)(currentRender.engine.onTransformChange$).pipe((0, rxjs.throttleTime)(16)).subscribe(() => updatePosition()));
|
|
23238
24080
|
disposable.add(this._commandService.onCommandExecuted((commandInfo) => {
|
|
23239
24081
|
if (commandInfo.id === _univerjs_sheets.SetWorksheetRowAutoHeightMutation.id) {
|
|
@@ -23310,7 +24152,10 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
23310
24152
|
rightBottomPos$.next(rightBottomCoord);
|
|
23311
24153
|
};
|
|
23312
24154
|
const disposable = new _univerjs_core.DisposableCollection();
|
|
23313
|
-
disposable.add(currentRender.engine.clientRect$.subscribe(
|
|
24155
|
+
disposable.add(currentRender.engine.clientRect$.subscribe({
|
|
24156
|
+
next: () => updatePosition(),
|
|
24157
|
+
error: () => {}
|
|
24158
|
+
}));
|
|
23314
24159
|
disposable.add(this._commandService.onCommandExecuted((commandInfo) => {
|
|
23315
24160
|
if (commandInfo.id === _univerjs_sheets.SetWorksheetRowAutoHeightMutation.id) {
|
|
23316
24161
|
if (commandInfo.params.rowsAutoHeightInfo.findIndex((item) => item.row === startRow) > -1) {
|
|
@@ -23482,6 +24327,23 @@ let CellPopupManagerService = class CellPopupManagerService extends _univerjs_co
|
|
|
23482
24327
|
}
|
|
23483
24328
|
if (!cache.horizontal && !cache.vertical) subUnitMap.realDeleteValue(row, col);
|
|
23484
24329
|
}
|
|
24330
|
+
hidePopupsForUnit(unitId, subUnitId) {
|
|
24331
|
+
const unitMap = this._cellPopupMap.get(unitId);
|
|
24332
|
+
if (!unitMap) return;
|
|
24333
|
+
const targets = [];
|
|
24334
|
+
(subUnitId ? [[subUnitId, unitMap.get(subUnitId)]] : [...unitMap.entries()]).forEach(([currentSubUnitId, subUnitMap]) => {
|
|
24335
|
+
subUnitMap === null || subUnitMap === void 0 || subUnitMap.forValue((row, col) => {
|
|
24336
|
+
targets.push({
|
|
24337
|
+
subUnitId: currentSubUnitId,
|
|
24338
|
+
row,
|
|
24339
|
+
col
|
|
24340
|
+
});
|
|
24341
|
+
});
|
|
24342
|
+
});
|
|
24343
|
+
targets.forEach((target) => this.hidePopup(unitId, target.subUnitId, target.row, target.col));
|
|
24344
|
+
if (subUnitId) unitMap.delete(subUnitId);
|
|
24345
|
+
else this._cellPopupMap.delete(unitId);
|
|
24346
|
+
}
|
|
23485
24347
|
};
|
|
23486
24348
|
CellPopupManagerService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(SheetCanvasPopManagerService))], CellPopupManagerService);
|
|
23487
24349
|
|
|
@@ -24120,56 +24982,6 @@ function BorderLine(props) {
|
|
|
24120
24982
|
|
|
24121
24983
|
//#endregion
|
|
24122
24984
|
//#region src/views/border-panel/BorderPanel.tsx
|
|
24123
|
-
const BORDER_SIZE_CHILDREN = [
|
|
24124
|
-
{
|
|
24125
|
-
label: _univerjs_core.BorderStyleTypes.THIN,
|
|
24126
|
-
value: _univerjs_core.BorderStyleTypes.THIN
|
|
24127
|
-
},
|
|
24128
|
-
{
|
|
24129
|
-
label: _univerjs_core.BorderStyleTypes.HAIR,
|
|
24130
|
-
value: _univerjs_core.BorderStyleTypes.HAIR
|
|
24131
|
-
},
|
|
24132
|
-
{
|
|
24133
|
-
label: _univerjs_core.BorderStyleTypes.DOTTED,
|
|
24134
|
-
value: _univerjs_core.BorderStyleTypes.DOTTED
|
|
24135
|
-
},
|
|
24136
|
-
{
|
|
24137
|
-
label: _univerjs_core.BorderStyleTypes.DASHED,
|
|
24138
|
-
value: _univerjs_core.BorderStyleTypes.DASHED
|
|
24139
|
-
},
|
|
24140
|
-
{
|
|
24141
|
-
label: _univerjs_core.BorderStyleTypes.DASH_DOT,
|
|
24142
|
-
value: _univerjs_core.BorderStyleTypes.DASH_DOT
|
|
24143
|
-
},
|
|
24144
|
-
{
|
|
24145
|
-
label: _univerjs_core.BorderStyleTypes.DASH_DOT_DOT,
|
|
24146
|
-
value: _univerjs_core.BorderStyleTypes.DASH_DOT_DOT
|
|
24147
|
-
},
|
|
24148
|
-
{
|
|
24149
|
-
label: _univerjs_core.BorderStyleTypes.MEDIUM,
|
|
24150
|
-
value: _univerjs_core.BorderStyleTypes.MEDIUM
|
|
24151
|
-
},
|
|
24152
|
-
{
|
|
24153
|
-
label: _univerjs_core.BorderStyleTypes.MEDIUM_DASHED,
|
|
24154
|
-
value: _univerjs_core.BorderStyleTypes.MEDIUM_DASHED
|
|
24155
|
-
},
|
|
24156
|
-
{
|
|
24157
|
-
label: _univerjs_core.BorderStyleTypes.MEDIUM_DASH_DOT,
|
|
24158
|
-
value: _univerjs_core.BorderStyleTypes.MEDIUM_DASH_DOT
|
|
24159
|
-
},
|
|
24160
|
-
{
|
|
24161
|
-
label: _univerjs_core.BorderStyleTypes.MEDIUM_DASH_DOT_DOT,
|
|
24162
|
-
value: _univerjs_core.BorderStyleTypes.MEDIUM_DASH_DOT_DOT
|
|
24163
|
-
},
|
|
24164
|
-
{
|
|
24165
|
-
label: _univerjs_core.BorderStyleTypes.THICK,
|
|
24166
|
-
value: _univerjs_core.BorderStyleTypes.THICK
|
|
24167
|
-
},
|
|
24168
|
-
{
|
|
24169
|
-
label: _univerjs_core.BorderStyleTypes.DOUBLE,
|
|
24170
|
-
value: _univerjs_core.BorderStyleTypes.DOUBLE
|
|
24171
|
-
}
|
|
24172
|
-
];
|
|
24173
24985
|
function getBorderColor(borderData) {
|
|
24174
24986
|
if (!borderData) return;
|
|
24175
24987
|
for (const key in borderData) {
|
|
@@ -28655,7 +29467,7 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
28655
29467
|
this.disposeWithMe(viewportMain.onScrollByBar$.subscribeEvent((param) => {
|
|
28656
29468
|
var _this$_sheetSkeletonM4;
|
|
28657
29469
|
const skeleton = (_this$_sheetSkeletonM4 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM4 === void 0 ? void 0 : _this$_sheetSkeletonM4.skeleton;
|
|
28658
|
-
if (skeleton == null || param.isTrigger === false) return;
|
|
29470
|
+
if (skeleton == null || param.isTrigger === false || param.isBarDragging && !param.isBarDragEnd) return;
|
|
28659
29471
|
const sheetObject = this._getSheetObject();
|
|
28660
29472
|
if (skeleton == null || sheetObject == null) return;
|
|
28661
29473
|
const { viewportScrollX = 0, viewportScrollY = 0 } = param;
|
|
@@ -29530,7 +30342,7 @@ function getListDropdownValue(value, multiple) {
|
|
|
29530
30342
|
//#endregion
|
|
29531
30343
|
//#region src/views/dropdown/ListDropDown.tsx
|
|
29532
30344
|
function SelectList(props) {
|
|
29533
|
-
const { value, onChange, multiple, options,
|
|
30345
|
+
const { value, onChange, multiple, options, onEdit, style, location, showEdit: showEditOnDropdown, showSearch: showSearchOnDropdown } = props;
|
|
29534
30346
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
29535
30347
|
const { row, col, unitId, subUnitId } = location;
|
|
29536
30348
|
const searchRef = (0, react.useRef)(null);
|
|
@@ -29586,7 +30398,7 @@ function SelectList(props) {
|
|
|
29586
30398
|
}),
|
|
29587
30399
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
29588
30400
|
className: "univer-px-3.5 univer-py-1 univer-pt-2 univer-text-xs",
|
|
29589
|
-
children:
|
|
30401
|
+
children: localeService.t(multiple ? "sheets-ui.data-validation.listMultiple.dropdown" : "sheets-ui.data-validation.list.dropdown")
|
|
29590
30402
|
}),
|
|
29591
30403
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
29592
30404
|
className: (0, _univerjs_design.clsx)("univer-flex univer-max-h-52 univer-flex-col univer-gap-1 univer-overflow-y-auto univer-px-2 univer-py-1", _univerjs_design.scrollbarClassName),
|
|
@@ -29645,7 +30457,6 @@ function ListDropDown(props) {
|
|
|
29645
30457
|
const { location, hideFn, onChange, onEdit, options, defaultValue, multiple, showSearch, showEdit } = extraProps;
|
|
29646
30458
|
const { worksheet } = location;
|
|
29647
30459
|
if (!worksheet) return null;
|
|
29648
|
-
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
29649
30460
|
const [localValue, setLocalValue] = (0, react.useState)(defaultValue);
|
|
29650
30461
|
const cellWidth = ((_anchorRect$right = anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.right) !== null && _anchorRect$right !== void 0 ? _anchorRect$right : 0) - ((_anchorRect$left = anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.left) !== null && _anchorRect$left !== void 0 ? _anchorRect$left : 0);
|
|
29651
30462
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectList, {
|
|
@@ -29653,7 +30464,6 @@ function ListDropDown(props) {
|
|
|
29653
30464
|
minWidth: cellWidth,
|
|
29654
30465
|
maxWidth: Math.max(cellWidth, 200)
|
|
29655
30466
|
},
|
|
29656
|
-
title: multiple ? localeService.t("sheets-ui.data-validation.listMultiple.dropdown") : localeService.t("sheets-ui.data-validation.list.dropdown"),
|
|
29657
30467
|
value: getListDropdownValue(localValue, multiple),
|
|
29658
30468
|
multiple,
|
|
29659
30469
|
onChange: async (newValue) => {
|
|
@@ -29729,6 +30539,28 @@ SheetCellDropdownManagerService = __decorate([
|
|
|
29729
30539
|
|
|
29730
30540
|
//#endregion
|
|
29731
30541
|
//#region src/services/print-interceptor.service.ts
|
|
30542
|
+
/** Tracks asynchronous resources registered by all interceptors for one print page. */
|
|
30543
|
+
var SheetPrintingResourceCollector = class {
|
|
30544
|
+
constructor() {
|
|
30545
|
+
_defineProperty(this, "_pending", /* @__PURE__ */ new Set());
|
|
30546
|
+
}
|
|
30547
|
+
add(resource) {
|
|
30548
|
+
const tracked = Promise.resolve(resource).catch(() => void 0).finally(() => this._pending.delete(tracked));
|
|
30549
|
+
this._pending.add(tracked);
|
|
30550
|
+
}
|
|
30551
|
+
async wait(timeout = 1e4) {
|
|
30552
|
+
const deadline = Date.now() + timeout;
|
|
30553
|
+
while (this._pending.size > 0) {
|
|
30554
|
+
const remaining = deadline - Date.now();
|
|
30555
|
+
if (remaining <= 0) return;
|
|
30556
|
+
let timeoutId;
|
|
30557
|
+
await Promise.race([Promise.allSettled(Array.from(this._pending)), new Promise((resolve) => {
|
|
30558
|
+
timeoutId = setTimeout(resolve, remaining);
|
|
30559
|
+
})]);
|
|
30560
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
30561
|
+
}
|
|
30562
|
+
}
|
|
30563
|
+
};
|
|
29732
30564
|
const PRINTING_RANGE = (0, _univerjs_core.createInterceptorKey)("PRINTING_RANGE");
|
|
29733
30565
|
const PRINTING_COMPONENT_COLLECT = (0, _univerjs_core.createInterceptorKey)("PRINTING_COMPONENT_COLLECT");
|
|
29734
30566
|
const PRINTING_DOM_COLLECT = (0, _univerjs_core.createInterceptorKey)("PRINTING_DOM_COLLECT");
|
|
@@ -30535,7 +31367,12 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends _unive
|
|
|
30535
31367
|
}
|
|
30536
31368
|
_initAutoFocus() {
|
|
30537
31369
|
const univerInstanceService = this._univerInstanceService;
|
|
30538
|
-
this.disposeWithMe(univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs_operators.filter)((v) => !!v)).subscribe((workbook) =>
|
|
31370
|
+
this.disposeWithMe(univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs_operators.filter)((v) => !!v)).subscribe((workbook) => {
|
|
31371
|
+
const unitId = workbook.getUnitId();
|
|
31372
|
+
const createOptions = univerInstanceService.getUnitCreateOptions(unitId);
|
|
31373
|
+
if ((createOptions === null || createOptions === void 0 ? void 0 : createOptions.makeCurrent) === false) return;
|
|
31374
|
+
univerInstanceService.focusUnit(unitId);
|
|
31375
|
+
}));
|
|
30539
31376
|
}
|
|
30540
31377
|
};
|
|
30541
31378
|
_defineProperty(UniverSheetsMobileUIPlugin, "pluginName", "SHEET_UI_PLUGIN");
|
|
@@ -30550,15 +31387,20 @@ UniverSheetsMobileUIPlugin = __decorate([
|
|
|
30550
31387
|
__decorateParam(4, _univerjs_core.IUniverInstanceService)
|
|
30551
31388
|
], UniverSheetsMobileUIPlugin);
|
|
30552
31389
|
|
|
31390
|
+
//#endregion
|
|
31391
|
+
//#region src/services/sheet-host-chrome-override.service.ts
|
|
31392
|
+
const ISheetHostChromeOverrideService = (0, _univerjs_core.createIdentifier)("sheet-ui.host-chrome-override.service");
|
|
31393
|
+
|
|
30553
31394
|
//#endregion
|
|
30554
31395
|
//#region src/controllers/render-controllers/contextmenu.render-controller.ts
|
|
30555
31396
|
let SheetContextMenuRenderController = class SheetContextMenuRenderController extends _univerjs_core.Disposable {
|
|
30556
|
-
constructor(_context, _contextMenuService, _selectionManagerService, _selectionRenderService) {
|
|
31397
|
+
constructor(_context, _contextMenuService, _selectionManagerService, _selectionRenderService, _injector) {
|
|
30557
31398
|
super();
|
|
30558
31399
|
this._context = _context;
|
|
30559
31400
|
this._contextMenuService = _contextMenuService;
|
|
30560
31401
|
this._selectionManagerService = _selectionManagerService;
|
|
30561
31402
|
this._selectionRenderService = _selectionRenderService;
|
|
31403
|
+
this._injector = _injector;
|
|
30562
31404
|
this._init();
|
|
30563
31405
|
}
|
|
30564
31406
|
_init() {
|
|
@@ -30581,6 +31423,7 @@ let SheetContextMenuRenderController = class SheetContextMenuRenderController ex
|
|
|
30581
31423
|
}
|
|
30582
31424
|
};
|
|
30583
31425
|
const triggerMenu = (position) => {
|
|
31426
|
+
if (this._shouldSuppressHostContextMenu()) return;
|
|
30584
31427
|
this._contextMenuService.triggerContextMenu(event, position);
|
|
30585
31428
|
};
|
|
30586
31429
|
if (!isPointerInRange()) triggerMenu(_univerjs_ui.ContextMenuPosition.MAIN_AREA);
|
|
@@ -30592,20 +31435,37 @@ let SheetContextMenuRenderController = class SheetContextMenuRenderController ex
|
|
|
30592
31435
|
this.disposeWithMe(spreadsheetSubscription);
|
|
30593
31436
|
const spreadsheetColumnHeader = this._context.components.get("__SpreadsheetColumnHeader__");
|
|
30594
31437
|
const rowHeaderSub = this._context.components.get("__SpreadsheetRowHeader__").onPointerDown$.subscribeEvent((event) => {
|
|
30595
|
-
if (event.button === 2)
|
|
31438
|
+
if (event.button === 2) {
|
|
31439
|
+
if (this._shouldSuppressHostContextMenu()) return;
|
|
31440
|
+
this._contextMenuService.triggerContextMenu(event, _univerjs_ui.ContextMenuPosition.ROW_HEADER);
|
|
31441
|
+
}
|
|
30596
31442
|
});
|
|
30597
31443
|
this.disposeWithMe(rowHeaderSub);
|
|
30598
31444
|
const colHeaderObserver = spreadsheetColumnHeader.onPointerDown$.subscribeEvent((event) => {
|
|
30599
|
-
if (event.button === 2)
|
|
31445
|
+
if (event.button === 2) {
|
|
31446
|
+
if (this._shouldSuppressHostContextMenu()) return;
|
|
31447
|
+
this._contextMenuService.triggerContextMenu(event, _univerjs_ui.ContextMenuPosition.COL_HEADER);
|
|
31448
|
+
}
|
|
30600
31449
|
});
|
|
30601
31450
|
this.disposeWithMe(colHeaderObserver);
|
|
30602
31451
|
}
|
|
31452
|
+
_shouldSuppressHostContextMenu() {
|
|
31453
|
+
var _this$_getSheetHostCh, _this$_getSheetHostCh2;
|
|
31454
|
+
return shouldSuppressSheetContextMenuForEmbedOverride(this._context.unitId, (_this$_getSheetHostCh = this._getSheetHostChromeOverrideService()) === null || _this$_getSheetHostCh === void 0 || (_this$_getSheetHostCh2 = _this$_getSheetHostCh.getOverride) === null || _this$_getSheetHostCh2 === void 0 ? void 0 : _this$_getSheetHostCh2.call(_this$_getSheetHostCh));
|
|
31455
|
+
}
|
|
31456
|
+
_getSheetHostChromeOverrideService() {
|
|
31457
|
+
return this._injector.has(ISheetHostChromeOverrideService) ? this._injector.get(ISheetHostChromeOverrideService) : void 0;
|
|
31458
|
+
}
|
|
30603
31459
|
};
|
|
30604
31460
|
SheetContextMenuRenderController = __decorate([
|
|
30605
31461
|
__decorateParam(1, _univerjs_ui.IContextMenuService),
|
|
30606
31462
|
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetsSelectionsService)),
|
|
30607
|
-
__decorateParam(3, ISheetSelectionRenderService)
|
|
31463
|
+
__decorateParam(3, ISheetSelectionRenderService),
|
|
31464
|
+
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_core.Injector))
|
|
30608
31465
|
], SheetContextMenuRenderController);
|
|
31466
|
+
function shouldSuppressSheetContextMenuForEmbedOverride(hostUnitId, override) {
|
|
31467
|
+
return override != null && override.hostUnitId === hostUnitId && override.entry === "sheets-sheet-tab";
|
|
31468
|
+
}
|
|
30609
31469
|
|
|
30610
31470
|
//#endregion
|
|
30611
31471
|
//#region src/controllers/repeat-last-action.controller.ts
|
|
@@ -31129,7 +31989,12 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends _univerjs_core.Plu
|
|
|
31129
31989
|
}
|
|
31130
31990
|
_initAutoFocus() {
|
|
31131
31991
|
const univerInstanceService = this._univerInstanceService;
|
|
31132
|
-
this.disposeWithMe(univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs_operators.filter)((v) => !!v)).subscribe((workbook) =>
|
|
31992
|
+
this.disposeWithMe(univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs_operators.filter)((v) => !!v)).subscribe((workbook) => {
|
|
31993
|
+
const unitId = workbook.getUnitId();
|
|
31994
|
+
const createOptions = univerInstanceService.getUnitCreateOptions(unitId);
|
|
31995
|
+
if ((createOptions === null || createOptions === void 0 ? void 0 : createOptions.makeCurrent) === false) return;
|
|
31996
|
+
univerInstanceService.focusUnit(unitId);
|
|
31997
|
+
}));
|
|
31133
31998
|
}
|
|
31134
31999
|
};
|
|
31135
32000
|
_defineProperty(UniverSheetsUIPlugin, "pluginName", "SHEET_UI_PLUGIN");
|
|
@@ -31149,6 +32014,7 @@ exports.AddRangeProtectionFromContextMenuCommand = AddRangeProtectionFromContext
|
|
|
31149
32014
|
exports.AddRangeProtectionFromSheetBarCommand = AddRangeProtectionFromSheetBarCommand;
|
|
31150
32015
|
exports.AddRangeProtectionFromToolbarCommand = AddRangeProtectionFromToolbarCommand;
|
|
31151
32016
|
exports.ApplyFormatPainterCommand = ApplyFormatPainterCommand;
|
|
32017
|
+
exports.AutoFillPopupMenu = AutoFillPopupMenu;
|
|
31152
32018
|
Object.defineProperty(exports, 'AutoFillUIController', {
|
|
31153
32019
|
enumerable: true,
|
|
31154
32020
|
get: function () {
|
|
@@ -31167,7 +32033,10 @@ Object.defineProperty(exports, 'AutoWidthController', {
|
|
|
31167
32033
|
return AutoWidthController;
|
|
31168
32034
|
}
|
|
31169
32035
|
});
|
|
32036
|
+
exports.BORDER_LINE_CHILDREN = BORDER_LINE_CHILDREN;
|
|
32037
|
+
exports.BORDER_SIZE_CHILDREN = BORDER_SIZE_CHILDREN;
|
|
31170
32038
|
exports.BaseSelectionRenderService = BaseSelectionRenderService;
|
|
32039
|
+
exports.BorderLine = BorderLine;
|
|
31171
32040
|
exports.COPY_SPECIAL_MENU_ID = COPY_SPECIAL_MENU_ID;
|
|
31172
32041
|
exports.COPY_TYPE = COPY_TYPE;
|
|
31173
32042
|
Object.defineProperty(exports, 'CellAlertManagerService', {
|
|
@@ -31222,9 +32091,11 @@ Object.defineProperty(exports, 'EditorBridgeService', {
|
|
|
31222
32091
|
return EditorBridgeService;
|
|
31223
32092
|
}
|
|
31224
32093
|
});
|
|
32094
|
+
exports.EditorContainer = EditorContainer;
|
|
31225
32095
|
exports.ExpandSelectionCommand = ExpandSelectionCommand;
|
|
31226
32096
|
exports.FORMULA_CLIPBOARD_MIME_TYPE = FORMULA_CLIPBOARD_MIME_TYPE;
|
|
31227
32097
|
exports.FormatPainterStatus = FormatPainterStatus;
|
|
32098
|
+
exports.FormulaBar = FormulaBar;
|
|
31228
32099
|
Object.defineProperty(exports, 'FormulaEditorController', {
|
|
31229
32100
|
enumerable: true,
|
|
31230
32101
|
get: function () {
|
|
@@ -31280,6 +32151,11 @@ exports.IMarkSelectionService = IMarkSelectionService;
|
|
|
31280
32151
|
exports.IRepeatLastActionService = IRepeatLastActionService;
|
|
31281
32152
|
exports.ISheetCellDropdownManagerService = ISheetCellDropdownManagerService;
|
|
31282
32153
|
exports.ISheetClipboardService = ISheetClipboardService;
|
|
32154
|
+
exports.ISheetEmbedFloatingGeometryService = ISheetEmbedFloatingGeometryService;
|
|
32155
|
+
exports.ISheetEmbedInteractionBoundaryService = ISheetEmbedInteractionBoundaryService;
|
|
32156
|
+
exports.ISheetEmbedRuntimeFocusCoordinator = ISheetEmbedRuntimeFocusCoordinator;
|
|
32157
|
+
exports.ISheetEmbedRuntimeService = ISheetEmbedRuntimeService;
|
|
32158
|
+
exports.ISheetHostChromeOverrideService = ISheetHostChromeOverrideService;
|
|
31283
32159
|
exports.ISheetSelectionRenderService = ISheetSelectionRenderService;
|
|
31284
32160
|
exports.IStatusBarService = IStatusBarService;
|
|
31285
32161
|
exports.InsertRangeMoveDownConfirmCommand = InsertRangeMoveDownConfirmCommand;
|
|
@@ -31307,6 +32183,15 @@ exports.RepeatLastActionPermission = RepeatLastActionPermission;
|
|
|
31307
32183
|
exports.ResetRangeTextColorCommand = ResetRangeTextColorCommand;
|
|
31308
32184
|
exports.ResetScrollCommand = ResetScrollCommand;
|
|
31309
32185
|
exports.SELECTION_SHAPE_DEPTH = SELECTION_SHAPE_DEPTH;
|
|
32186
|
+
exports.SHEETS_UI_PLUGIN_CONFIG_KEY = SHEETS_UI_PLUGIN_CONFIG_KEY;
|
|
32187
|
+
exports.SHEET_EMBED_CHILD_TYPE_ATTRIBUTE = SHEET_EMBED_CHILD_TYPE_ATTRIBUTE;
|
|
32188
|
+
exports.SHEET_EMBED_CHILD_UNIT_ID_ATTRIBUTE = SHEET_EMBED_CHILD_UNIT_ID_ATTRIBUTE;
|
|
32189
|
+
exports.SHEET_EMBED_FLOAT_DOM_ATTRIBUTE = SHEET_EMBED_FLOAT_DOM_ATTRIBUTE;
|
|
32190
|
+
exports.SHEET_EMBED_HOST_UNIT_ID_ATTRIBUTE = SHEET_EMBED_HOST_UNIT_ID_ATTRIBUTE;
|
|
32191
|
+
exports.SHEET_EMBED_ID_ATTRIBUTE = SHEET_EMBED_ID_ATTRIBUTE;
|
|
32192
|
+
exports.SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE = SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE;
|
|
32193
|
+
exports.SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE = SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE;
|
|
32194
|
+
exports.SHEET_FOOTER_BAR_HEIGHT = SHEET_FOOTER_BAR_HEIGHT;
|
|
31310
32195
|
exports.SHEET_UI_PLUGIN_NAME = SHEET_UI_PLUGIN_NAME;
|
|
31311
32196
|
exports.SHEET_VIEW_KEY = SHEET_VIEW_KEY;
|
|
31312
32197
|
exports.ScrollCommand = ScrollCommand;
|
|
@@ -31347,6 +32232,7 @@ exports.SetSelectionFrozenCommand = SetSelectionFrozenCommand;
|
|
|
31347
32232
|
exports.SetWorksheetColAutoWidthCommand = SetWorksheetColAutoWidthCommand;
|
|
31348
32233
|
exports.SetZoomRatioCommand = SetZoomRatioCommand;
|
|
31349
32234
|
exports.SetZoomRatioOperation = SetZoomRatioOperation;
|
|
32235
|
+
exports.SheetBar = SheetBar;
|
|
31350
32236
|
Object.defineProperty(exports, 'SheetCanvasPopManagerService', {
|
|
31351
32237
|
enumerable: true,
|
|
31352
32238
|
get: function () {
|
|
@@ -31402,6 +32288,7 @@ Object.defineProperty(exports, 'SheetPermissionRenderManagerService', {
|
|
|
31402
32288
|
});
|
|
31403
32289
|
exports.SheetPermissionUserManagerService = SheetPermissionUserManagerService;
|
|
31404
32290
|
exports.SheetPrintInterceptorService = SheetPrintInterceptorService;
|
|
32291
|
+
exports.SheetPrintingResourceCollector = SheetPrintingResourceCollector;
|
|
31405
32292
|
Object.defineProperty(exports, 'SheetRenderController', {
|
|
31406
32293
|
enumerable: true,
|
|
31407
32294
|
get: function () {
|
|
@@ -31496,6 +32383,8 @@ exports.isEmbeddingFormulaEditor = isEmbeddingFormulaEditor;
|
|
|
31496
32383
|
exports.isRangeSelector = isRangeSelector;
|
|
31497
32384
|
exports.menuClipboardDisabledObservable = menuClipboardDisabledObservable;
|
|
31498
32385
|
exports.mergeSetRangeValues = mergeSetRangeValues;
|
|
32386
|
+
exports.resolveActiveSheetEmbedRuntimeDomScope = resolveActiveSheetEmbedRuntimeDomScope;
|
|
32387
|
+
exports.resolveSheetEmbedRuntimeDomScope = resolveSheetEmbedRuntimeDomScope;
|
|
31499
32388
|
exports.useActiveWorkbook = useActiveWorkbook;
|
|
31500
32389
|
exports.useActiveWorksheet = useActiveWorksheet;
|
|
31501
32390
|
exports.useHighlightRange = useHighlightRange;
|