@univerjs/sheets-ui 1.0.0-alpha.7 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +14 -41
- package/lib/cjs/index.js +736 -838
- package/lib/cjs/locale/ar-SA.js +0 -2
- package/lib/cjs/locale/ca-ES.js +1 -3
- package/lib/cjs/locale/de-DE.js +0 -2
- package/lib/cjs/locale/en-US.js +0 -2
- package/lib/cjs/locale/es-ES.js +1 -3
- package/lib/cjs/locale/fa-IR.js +0 -2
- package/lib/cjs/locale/fr-FR.js +0 -2
- package/lib/cjs/locale/id-ID.js +1 -3
- package/lib/cjs/locale/it-IT.js +0 -2
- package/lib/cjs/locale/ja-JP.js +0 -2
- package/lib/cjs/locale/ko-KR.js +9 -11
- package/lib/cjs/locale/pl-PL.js +0 -2
- package/lib/cjs/locale/pt-BR.js +1 -3
- package/lib/cjs/locale/ru-RU.js +0 -2
- package/lib/cjs/locale/sk-SK.js +0 -2
- package/lib/cjs/locale/vi-VN.js +0 -2
- package/lib/cjs/locale/zh-CN.js +1 -3
- package/lib/cjs/locale/zh-HK.js +3 -5
- package/lib/cjs/locale/zh-TW.js +3 -5
- package/lib/es/facade.js +15 -42
- package/lib/es/index.js +743 -845
- package/lib/es/locale/ar-SA.js +0 -2
- package/lib/es/locale/ca-ES.js +1 -3
- package/lib/es/locale/de-DE.js +0 -2
- package/lib/es/locale/en-US.js +0 -2
- package/lib/es/locale/es-ES.js +1 -3
- package/lib/es/locale/fa-IR.js +0 -2
- package/lib/es/locale/fr-FR.js +0 -2
- package/lib/es/locale/id-ID.js +1 -3
- package/lib/es/locale/it-IT.js +0 -2
- package/lib/es/locale/ja-JP.js +0 -2
- package/lib/es/locale/ko-KR.js +9 -11
- package/lib/es/locale/pl-PL.js +0 -2
- package/lib/es/locale/pt-BR.js +1 -3
- package/lib/es/locale/ru-RU.js +0 -2
- package/lib/es/locale/sk-SK.js +0 -2
- package/lib/es/locale/vi-VN.js +0 -2
- package/lib/es/locale/zh-CN.js +1 -3
- package/lib/es/locale/zh-HK.js +3 -5
- package/lib/es/locale/zh-TW.js +3 -5
- package/lib/facade.js +15 -42
- package/lib/index.css +6 -5
- package/lib/index.js +743 -845
- package/lib/locale/ar-SA.js +0 -2
- package/lib/locale/ca-ES.js +1 -3
- package/lib/locale/de-DE.js +0 -2
- package/lib/locale/en-US.js +0 -2
- package/lib/locale/es-ES.js +1 -3
- package/lib/locale/fa-IR.js +0 -2
- package/lib/locale/fr-FR.js +0 -2
- package/lib/locale/id-ID.js +1 -3
- package/lib/locale/it-IT.js +0 -2
- package/lib/locale/ja-JP.js +0 -2
- package/lib/locale/ko-KR.js +9 -11
- package/lib/locale/pl-PL.js +0 -2
- package/lib/locale/pt-BR.js +1 -3
- package/lib/locale/ru-RU.js +0 -2
- package/lib/locale/sk-SK.js +0 -2
- package/lib/locale/vi-VN.js +0 -2
- package/lib/locale/zh-CN.js +1 -3
- package/lib/locale/zh-HK.js +3 -5
- package/lib/locale/zh-TW.js +3 -5
- package/lib/types/commands/operations/cell-edit.operation.d.ts +0 -2
- package/lib/types/config/config.d.ts +0 -4
- package/lib/types/controllers/editor/editing.render-controller.d.ts +0 -1
- package/lib/types/facade/f-workbook.d.ts +1 -63
- package/lib/types/facade/f-worksheet.d.ts +6 -35
- package/lib/types/locale/en-US.d.ts +0 -2
- package/lib/types/services/clipboard/type.d.ts +0 -1
- package/lib/types/services/editor-bridge.service.d.ts +1 -1
- package/lib/types/services/selection/base-selection-render.service.d.ts +0 -17
- package/lib/types/services/selection/selection-control.d.ts +0 -12
- package/lib/types/services/selection/selection-render-model.d.ts +1 -1
- package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/slide-tab-bar.d.ts +0 -1
- package/lib/types/views/sheet-container/SheetContainer.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +11 -11
- 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/types/views/editor-container/EditorContainer.spec.d.ts +0 -16
package/lib/cjs/index.js
CHANGED
|
@@ -18,7 +18,7 @@ let rxjs_operators = require("rxjs/operators");
|
|
|
18
18
|
//#region src/basics/editor/get-editor-object.ts
|
|
19
19
|
function getEditorObject(unitId, renderManagerService) {
|
|
20
20
|
if (unitId == null) return;
|
|
21
|
-
const currentRender = renderManagerService.
|
|
21
|
+
const currentRender = renderManagerService.getRenderUnitById(unitId);
|
|
22
22
|
if (currentRender == null) return;
|
|
23
23
|
const { mainComponent, scene, engine, components } = currentRender;
|
|
24
24
|
return {
|
|
@@ -186,7 +186,7 @@ let SHEET_VIEW_KEY = /* @__PURE__ */ function(SHEET_VIEW_KEY) {
|
|
|
186
186
|
}({});
|
|
187
187
|
|
|
188
188
|
//#endregion
|
|
189
|
-
//#region \0@oxc-project+runtime@0.
|
|
189
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
190
190
|
function _typeof(o) {
|
|
191
191
|
"@babel/helpers - typeof";
|
|
192
192
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -197,7 +197,7 @@ function _typeof(o) {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
//#endregion
|
|
200
|
-
//#region \0@oxc-project+runtime@0.
|
|
200
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
201
201
|
function toPrimitive(t, r) {
|
|
202
202
|
if ("object" != _typeof(t) || !t) return t;
|
|
203
203
|
var e = t[Symbol.toPrimitive];
|
|
@@ -210,14 +210,14 @@ function toPrimitive(t, r) {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
//#endregion
|
|
213
|
-
//#region \0@oxc-project+runtime@0.
|
|
213
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
214
214
|
function toPropertyKey(t) {
|
|
215
215
|
var i = toPrimitive(t, "string");
|
|
216
216
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
//#endregion
|
|
220
|
-
//#region \0@oxc-project+runtime@0.
|
|
220
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
221
221
|
function _defineProperty(e, r, t) {
|
|
222
222
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
223
223
|
value: t,
|
|
@@ -277,7 +277,7 @@ var SelectionRenderModel = class {
|
|
|
277
277
|
return this._rangeType;
|
|
278
278
|
}
|
|
279
279
|
/**
|
|
280
|
-
*
|
|
280
|
+
* Compares row and column bounds only.
|
|
281
281
|
*/
|
|
282
282
|
isEqual(rangeWithCoord) {
|
|
283
283
|
const { startColumn, startRow, endColumn, endRow } = this;
|
|
@@ -354,9 +354,9 @@ const SetRowHeaderWidthCommand = {
|
|
|
354
354
|
const renderManagerSrv = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
355
355
|
if (!renderManagerSrv) return false;
|
|
356
356
|
const { unitId, subUnitId, size } = params;
|
|
357
|
-
const render = renderManagerSrv.
|
|
357
|
+
const render = renderManagerSrv.getRenderUnitById(unitId);
|
|
358
358
|
if (render) {
|
|
359
|
-
renderManagerSrv.
|
|
359
|
+
renderManagerSrv.getRenderUnitById(unitId).with(SheetSkeletonManagerService).setRowHeaderSize(render, subUnitId, size);
|
|
360
360
|
const { components } = render;
|
|
361
361
|
const renderComponent = components.get("__SpreadsheetRowHeader__");
|
|
362
362
|
if (renderComponent) renderComponent.setCustomHeader({ headerStyle: { size } }, subUnitId);
|
|
@@ -372,9 +372,9 @@ const SetColumnHeaderHeightCommand = {
|
|
|
372
372
|
const renderManagerSrv = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
373
373
|
if (!renderManagerSrv) return false;
|
|
374
374
|
const { unitId, subUnitId, size } = params;
|
|
375
|
-
const render = renderManagerSrv.
|
|
375
|
+
const render = renderManagerSrv.getRenderUnitById(unitId);
|
|
376
376
|
if (render) {
|
|
377
|
-
renderManagerSrv.
|
|
377
|
+
renderManagerSrv.getRenderUnitById(unitId).with(SheetSkeletonManagerService).setColumnHeaderSize(render, subUnitId, size);
|
|
378
378
|
const { components } = render;
|
|
379
379
|
const renderComponent = components.get("__SpreadsheetColumnHeader__");
|
|
380
380
|
if (renderComponent) renderComponent.setCustomHeader({ headerStyle: { size } }, subUnitId);
|
|
@@ -494,10 +494,6 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
494
494
|
/**
|
|
495
495
|
* Reset this._selectionStyle to default normal selection style
|
|
496
496
|
*/
|
|
497
|
-
/** @deprecated This should not be provided by the selection render service. */
|
|
498
|
-
getViewPort() {
|
|
499
|
-
return this._activeViewport;
|
|
500
|
-
}
|
|
501
497
|
setSingleSelectionEnabled(enabled = false) {
|
|
502
498
|
this._singleSelectionEnabled = enabled;
|
|
503
499
|
}
|
|
@@ -594,9 +590,8 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
594
590
|
* @param {ISelectionWithCoord} selectionWithStyle
|
|
595
591
|
*/
|
|
596
592
|
_addSelectionControlByModelData(selectionWithStyle) {
|
|
597
|
-
var _selectionWithStyle$s;
|
|
598
593
|
const skeleton = this._skeleton;
|
|
599
|
-
const style =
|
|
594
|
+
const style = selectionWithStyle.style ?? genNormalSelectionStyle(this._selectionTheme);
|
|
600
595
|
const scene = this._scene;
|
|
601
596
|
selectionWithStyle.style = style;
|
|
602
597
|
return this.newSelectionControl(scene, skeleton, selectionWithStyle);
|
|
@@ -608,7 +603,7 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
608
603
|
}
|
|
609
604
|
_getFreeze() {
|
|
610
605
|
var _this$_sheetSkeletonM;
|
|
611
|
-
return (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton.
|
|
606
|
+
return (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton.worksheet.getFreeze();
|
|
612
607
|
}
|
|
613
608
|
_getViewportByCell(row, column) {
|
|
614
609
|
if (row === void 0 || column === void 0) return null;
|
|
@@ -676,17 +671,15 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
676
671
|
* @param moveStartPosY
|
|
677
672
|
*/
|
|
678
673
|
_setupPointerMoveListener(viewportMain, activeSelectionControl, rangeType, scrollTimerType = _univerjs_engine_render.ScrollTimerType.ALL, moveStartPosX, moveStartPosY) {
|
|
679
|
-
var _viewportMain$left, _viewportMain$top;
|
|
680
674
|
let xCrossTime = 0;
|
|
681
675
|
let yCrossTime = 0;
|
|
682
676
|
let lastX = moveStartPosX;
|
|
683
677
|
let lastY = moveStartPosY;
|
|
684
678
|
this._scrollTimer = _univerjs_engine_render.ScrollTimer.create(this._scene, scrollTimerType);
|
|
685
|
-
this._scrollTimer.startScroll((
|
|
679
|
+
this._scrollTimer.startScroll((viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.left) ?? 0, (viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.top) ?? 0, viewportMain);
|
|
686
680
|
const scene = this._scene;
|
|
687
681
|
const startViewport = scene.getActiveViewportByCoord(_univerjs_engine_render.Vector2.FromArray([moveStartPosX, moveStartPosY]));
|
|
688
682
|
this._scenePointerMoveSub = scene.onPointerMove$.subscribeEvent((moveEvt) => {
|
|
689
|
-
var _scene$getActiveViewp;
|
|
690
683
|
if (moveEvt.buttons === 0) {
|
|
691
684
|
this.endSelection();
|
|
692
685
|
return;
|
|
@@ -699,7 +692,7 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
699
692
|
const currentSelection = this.getActiveSelectionControl();
|
|
700
693
|
const freeze = this._getFreeze();
|
|
701
694
|
const selection = currentSelection === null || currentSelection === void 0 ? void 0 : currentSelection.model;
|
|
702
|
-
const endViewport =
|
|
695
|
+
const endViewport = scene.getActiveViewportByCoord(_univerjs_engine_render.Vector2.FromArray([moveOffsetX, moveOffsetY])) ?? this._getViewportByCell(selection === null || selection === void 0 ? void 0 : selection.endRow, selection === null || selection === void 0 ? void 0 : selection.endColumn);
|
|
703
696
|
const isCrossableViewports = () => {
|
|
704
697
|
if (!startViewport || !endViewport || !viewportMain) return false;
|
|
705
698
|
const crossableViewports = [
|
|
@@ -719,15 +712,12 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
719
712
|
const startKey = startViewport.viewportKey;
|
|
720
713
|
const endKey = endViewport.viewportKey;
|
|
721
714
|
if (startKey === _univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_ROW_TOP) {
|
|
722
|
-
|
|
723
|
-
if (moveOffsetY < viewportMain.top && ((_selection$endRow = selection === null || selection === void 0 ? void 0 : selection.endRow) !== null && _selection$endRow !== void 0 ? _selection$endRow : 0) < ((_freeze$startRow = freeze === null || freeze === void 0 ? void 0 : freeze.startRow) !== null && _freeze$startRow !== void 0 ? _freeze$startRow : 0)) scrollOffsetY = viewportMain.top;
|
|
715
|
+
if (moveOffsetY < viewportMain.top && ((selection === null || selection === void 0 ? void 0 : selection.endRow) ?? 0) < ((freeze === null || freeze === void 0 ? void 0 : freeze.startRow) ?? 0)) scrollOffsetY = viewportMain.top;
|
|
724
716
|
else if (isCrossingY && yCrossTime % 2 === 1) viewportMain.scrollToViewportPos({ viewportScrollY: 0 });
|
|
725
717
|
} else if (startKey === _univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_COLUMN_LEFT) {
|
|
726
|
-
|
|
727
|
-
if (moveOffsetX < viewportMain.left && ((_selection$endColumn = selection === null || selection === void 0 ? void 0 : selection.endColumn) !== null && _selection$endColumn !== void 0 ? _selection$endColumn : 0) < ((_freeze$startColumn = freeze === null || freeze === void 0 ? void 0 : freeze.startColumn) !== null && _freeze$startColumn !== void 0 ? _freeze$startColumn : 0)) scrollOffsetX = viewportMain.left;
|
|
718
|
+
if (moveOffsetX < viewportMain.left && ((selection === null || selection === void 0 ? void 0 : selection.endColumn) ?? 0) < ((freeze === null || freeze === void 0 ? void 0 : freeze.startColumn) ?? 0)) scrollOffsetX = viewportMain.left;
|
|
728
719
|
else if (isCrossingX && xCrossTime % 2 === 1) viewportMain.scrollToViewportPos({ viewportScrollX: 0 });
|
|
729
720
|
} else if (startKey === endKey) {
|
|
730
|
-
var _selection$endRow2, _freeze$startRow2, _selection$endColumn2, _freeze$startColumn2;
|
|
731
721
|
let disableX = false;
|
|
732
722
|
let disableY = false;
|
|
733
723
|
if (startKey === _univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP) {
|
|
@@ -735,8 +725,8 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
735
725
|
disableY = true;
|
|
736
726
|
} else if (startKey === _univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP) disableY = true;
|
|
737
727
|
else if (startKey === _univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT) disableX = true;
|
|
738
|
-
if (((
|
|
739
|
-
if (((
|
|
728
|
+
if (((selection === null || selection === void 0 ? void 0 : selection.endRow) ?? 0) > ((freeze === null || freeze === void 0 ? void 0 : freeze.startRow) ?? 0)) disableY = false;
|
|
729
|
+
if (((selection === null || selection === void 0 ? void 0 : selection.endColumn) ?? 0) > ((freeze === null || freeze === void 0 ? void 0 : freeze.startColumn) ?? 0)) disableX = false;
|
|
740
730
|
if (disableX) scrollOffsetX = viewportMain.left;
|
|
741
731
|
if (disableY) scrollOffsetY = viewportMain.top;
|
|
742
732
|
} else {
|
|
@@ -769,15 +759,9 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
769
759
|
});
|
|
770
760
|
});
|
|
771
761
|
}
|
|
772
|
-
/**
|
|
773
|
-
* @deprecated Please use `getCellWithCoordByOffset` instead.
|
|
774
|
-
*/
|
|
775
|
-
getSelectionCellByPosition(x, y) {
|
|
776
|
-
return this.getCellWithCoordByOffset(x, y);
|
|
777
|
-
}
|
|
778
762
|
getCellWithCoordByOffset(x, y, skeletonParam) {
|
|
779
763
|
const scene = this._scene;
|
|
780
|
-
const skeleton = skeletonParam
|
|
764
|
+
const skeleton = skeletonParam ?? this._skeleton;
|
|
781
765
|
const scrollXY = scene.getViewportScrollXY(scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN));
|
|
782
766
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
783
767
|
return skeleton.getCellWithCoordByOffset(x - scrollXY.x, y - scrollXY.y, scaleX, scaleY, scrollXY);
|
|
@@ -786,20 +770,19 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
786
770
|
* When mousedown and mouseup need to go to the coordination and undo stack, when mousemove does not need to go to the coordination and undo stack
|
|
787
771
|
*/
|
|
788
772
|
_movingHandler(offsetX, offsetY, activeSelectionControl, rangeType) {
|
|
789
|
-
var _activeSelectionContr, _activeSelectionContr2, _activeSelectionContr3, _activeSelectionContr4, _this$_getViewportByC;
|
|
790
773
|
const skeleton = this._skeleton;
|
|
791
774
|
const scene = this._scene;
|
|
792
775
|
const [unitId, sheetId] = skeleton.getLocation();
|
|
793
776
|
const currSelectionRange = {
|
|
794
|
-
startRow: (
|
|
795
|
-
endRow: (
|
|
796
|
-
startColumn: (
|
|
797
|
-
endColumn: (
|
|
777
|
+
startRow: (activeSelectionControl === null || activeSelectionControl === void 0 ? void 0 : activeSelectionControl.model.startRow) ?? -1,
|
|
778
|
+
endRow: (activeSelectionControl === null || activeSelectionControl === void 0 ? void 0 : activeSelectionControl.model.endRow) ?? -1,
|
|
779
|
+
startColumn: (activeSelectionControl === null || activeSelectionControl === void 0 ? void 0 : activeSelectionControl.model.startColumn) ?? -1,
|
|
780
|
+
endColumn: (activeSelectionControl === null || activeSelectionControl === void 0 ? void 0 : activeSelectionControl.model.endColumn) ?? -1,
|
|
798
781
|
unitId,
|
|
799
782
|
sheetId
|
|
800
783
|
};
|
|
801
784
|
const viewportMain = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
802
|
-
const targetViewport =
|
|
785
|
+
const targetViewport = this._getViewportByCell(currSelectionRange.endRow, currSelectionRange.endColumn) ?? viewportMain;
|
|
803
786
|
const scrollXY = scene.getScrollXYInfoByViewport(_univerjs_engine_render.Vector2.FromArray([this._startViewportPosX, this._startViewportPosY]), targetViewport);
|
|
804
787
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
805
788
|
if (rangeType === _univerjs_core.RANGE_TYPE.ROW) offsetX = Number.POSITIVE_INFINITY;
|
|
@@ -984,7 +967,7 @@ function genSelectionByRange(skeleton, range) {
|
|
|
984
967
|
}
|
|
985
968
|
|
|
986
969
|
//#endregion
|
|
987
|
-
//#region \0@oxc-project+runtime@0.
|
|
970
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
988
971
|
function __decorateParam(paramIndex, decorator) {
|
|
989
972
|
return function(target, key) {
|
|
990
973
|
decorator(target, key, paramIndex);
|
|
@@ -992,7 +975,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
992
975
|
}
|
|
993
976
|
|
|
994
977
|
//#endregion
|
|
995
|
-
//#region \0@oxc-project+runtime@0.
|
|
978
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
996
979
|
function __decorate(decorators, target, key, desc) {
|
|
997
980
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
998
981
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1218,7 +1201,7 @@ var SelectionShapeExtension = class {
|
|
|
1218
1201
|
}
|
|
1219
1202
|
_getFreeze() {
|
|
1220
1203
|
var _withCurrentTypeOfRen;
|
|
1221
|
-
return (_withCurrentTypeOfRen = (0, _univerjs_engine_render.withCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_SHEET, SheetSkeletonManagerService, this._injector.get(_univerjs_core.IUniverInstanceService), this._injector.get(_univerjs_engine_render.IRenderManagerService))) === null || _withCurrentTypeOfRen === void 0 || (_withCurrentTypeOfRen = _withCurrentTypeOfRen.getCurrentParam()) === null || _withCurrentTypeOfRen === void 0 ? void 0 : _withCurrentTypeOfRen.skeleton.
|
|
1204
|
+
return (_withCurrentTypeOfRen = (0, _univerjs_engine_render.withCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_SHEET, SheetSkeletonManagerService, this._injector.get(_univerjs_core.IUniverInstanceService), this._injector.get(_univerjs_engine_render.IRenderManagerService))) === null || _withCurrentTypeOfRen === void 0 || (_withCurrentTypeOfRen = _withCurrentTypeOfRen.getCurrentParam()) === null || _withCurrentTypeOfRen === void 0 ? void 0 : _withCurrentTypeOfRen.skeleton.worksheet.getFreeze();
|
|
1222
1205
|
}
|
|
1223
1206
|
_isSelectionInViewport(selection, viewport) {
|
|
1224
1207
|
const freeze = this._getFreeze() || {
|
|
@@ -1808,7 +1791,6 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = .3;
|
|
|
1808
1791
|
*/
|
|
1809
1792
|
var SelectionControl = class extends _univerjs_core.Disposable {
|
|
1810
1793
|
constructor(_scene, _zIndex, _themeService, options) {
|
|
1811
|
-
var _options$enableAutoFi, _options$highlightHea, _options$rowHeaderWid, _options$columnHeader, _options$rowHeaderOff, _options$columnHeader2;
|
|
1812
1794
|
super();
|
|
1813
1795
|
this._scene = _scene;
|
|
1814
1796
|
this._zIndex = _zIndex;
|
|
@@ -1862,12 +1844,12 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
1862
1844
|
_defineProperty(this, "selectionFilled$", this._selectionFilled$.asObservable());
|
|
1863
1845
|
_defineProperty(this, "_antLineOffset", 0);
|
|
1864
1846
|
_defineProperty(this, "_antRequestNewFrame", -1);
|
|
1865
|
-
this._enableAutoFill = (
|
|
1866
|
-
this._highlightHeader = (
|
|
1867
|
-
this._rowHeaderWidth = (
|
|
1868
|
-
this._columnHeaderHeight = (
|
|
1869
|
-
this._rowHeaderOffsetX = (
|
|
1870
|
-
this._columnHeaderOffsetY = (
|
|
1847
|
+
this._enableAutoFill = (options === null || options === void 0 ? void 0 : options.enableAutoFill) ?? true;
|
|
1848
|
+
this._highlightHeader = (options === null || options === void 0 ? void 0 : options.highlightHeader) ?? true;
|
|
1849
|
+
this._rowHeaderWidth = (options === null || options === void 0 ? void 0 : options.rowHeaderWidth) ?? 0;
|
|
1850
|
+
this._columnHeaderHeight = (options === null || options === void 0 ? void 0 : options.columnHeaderHeight) ?? 0;
|
|
1851
|
+
this._rowHeaderOffsetX = (options === null || options === void 0 ? void 0 : options.rowHeaderOffsetX) ?? 0;
|
|
1852
|
+
this._columnHeaderOffsetY = (options === null || options === void 0 ? void 0 : options.columnHeaderOffsetY) ?? 0;
|
|
1871
1853
|
this._initializeSheetBody();
|
|
1872
1854
|
this._initialHeader();
|
|
1873
1855
|
}
|
|
@@ -2241,29 +2223,6 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
2241
2223
|
this._updateControlCoord();
|
|
2242
2224
|
}
|
|
2243
2225
|
/**
|
|
2244
|
-
* Update selection model with new range & primary cell(aka: highlight/current), also update row/col selection size & style.
|
|
2245
|
-
*
|
|
2246
|
-
* @deprecated use `updateRangeBySelectionWithCoord` and `updateStyle` to do same thing.
|
|
2247
|
-
*
|
|
2248
|
-
* @param newSelectionRange
|
|
2249
|
-
* @param rowHeaderWidth
|
|
2250
|
-
* @param columnHeaderHeight
|
|
2251
|
-
* @param style
|
|
2252
|
-
* @param primaryCell primary cell
|
|
2253
|
-
*/
|
|
2254
|
-
update(newSelectionRange, rowHeaderWidth = 0, columnHeaderHeight = 0, style, primaryCell) {
|
|
2255
|
-
this._rowHeaderWidth = rowHeaderWidth;
|
|
2256
|
-
this._columnHeaderHeight = columnHeaderHeight;
|
|
2257
|
-
this._rowHeaderOffsetX = 0;
|
|
2258
|
-
this._columnHeaderOffsetY = 0;
|
|
2259
|
-
this.updateRangeBySelectionWithCoord({
|
|
2260
|
-
rangeWithCoord: newSelectionRange,
|
|
2261
|
-
primaryWithCoord: primaryCell,
|
|
2262
|
-
style
|
|
2263
|
-
});
|
|
2264
|
-
if (style) this.updateStyle(style);
|
|
2265
|
-
}
|
|
2266
|
-
/**
|
|
2267
2226
|
* Update primary range.
|
|
2268
2227
|
* highlight cell would update if primary cell has value.
|
|
2269
2228
|
* highlight cell would be cleared if primary cell is null.
|
|
@@ -2660,7 +2619,7 @@ let MarkSelectionService = class MarkSelectionService extends _univerjs_core.Dis
|
|
|
2660
2619
|
const { unitId, subUnitId, selection, control: oldControl, zIndex } = shape;
|
|
2661
2620
|
oldControl === null || oldControl === void 0 || oldControl.dispose();
|
|
2662
2621
|
if (unitId !== currentUnitId || subUnitId !== currentSubUnitId) return;
|
|
2663
|
-
const renderUnit = this._renderManagerService.
|
|
2622
|
+
const renderUnit = this._renderManagerService.getRenderUnitById(unitId);
|
|
2664
2623
|
if (!renderUnit) return;
|
|
2665
2624
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, subUnitId);
|
|
2666
2625
|
if (!skeleton) return;
|
|
@@ -2784,7 +2743,7 @@ const copyContentCache = new CopyContentCache();
|
|
|
2784
2743
|
//#endregion
|
|
2785
2744
|
//#region src/services/clipboard/html-to-usm/parse-node-style.ts
|
|
2786
2745
|
function extractNodeStyle(node, predefinedStyles) {
|
|
2787
|
-
const styles = predefinedStyles
|
|
2746
|
+
const styles = predefinedStyles ?? node.style;
|
|
2788
2747
|
const docStyles = {};
|
|
2789
2748
|
const tagName = node.tagName.toLowerCase();
|
|
2790
2749
|
switch (tagName) {
|
|
@@ -2928,9 +2887,8 @@ function generateParagraphs(dataStream, prevParagraph) {
|
|
|
2928
2887
|
return paragraphs;
|
|
2929
2888
|
}
|
|
2930
2889
|
function convertToCellStyle(cell, dataStream, textRuns) {
|
|
2931
|
-
var _textRuns$length;
|
|
2932
2890
|
const dataStreamLength = dataStream.length;
|
|
2933
|
-
const canConvertToCellStyle = ((
|
|
2891
|
+
const canConvertToCellStyle = ((textRuns === null || textRuns === void 0 ? void 0 : textRuns.length) ?? 0) === 1 && textRuns[0].st === 0 && textRuns[0].ed === dataStreamLength;
|
|
2934
2892
|
if (cell.p) {
|
|
2935
2893
|
var _cell$p$body;
|
|
2936
2894
|
if (canConvertToCellStyle && ((_cell$p$body = cell.p.body) === null || _cell$p$body === void 0 || (_cell$p$body = _cell$p$body.textRuns) === null || _cell$p$body === void 0 ? void 0 : _cell$p$body.length)) {
|
|
@@ -2945,7 +2903,6 @@ function convertToCellStyle(cell, dataStream, textRuns) {
|
|
|
2945
2903
|
s: textRuns[0].ts
|
|
2946
2904
|
};
|
|
2947
2905
|
else return cell;
|
|
2948
|
-
return cell;
|
|
2949
2906
|
}
|
|
2950
2907
|
|
|
2951
2908
|
//#endregion
|
|
@@ -3003,8 +2960,7 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3003
2960
|
this._dom = parseToDom(html);
|
|
3004
2961
|
const style = this._dom.querySelector("style");
|
|
3005
2962
|
if (style) {
|
|
3006
|
-
|
|
3007
|
-
this._parseMsoNumfmtFromCssText((_style$textContent = style.textContent) !== null && _style$textContent !== void 0 ? _style$textContent : "");
|
|
2963
|
+
this._parseMsoNumfmtFromCssText(style.textContent ?? "");
|
|
3008
2964
|
const shadowHost = document.createElement("div");
|
|
3009
2965
|
const shadowRoot = shadowHost.attachShadow({ mode: "open" });
|
|
3010
2966
|
document.body.appendChild(shadowHost);
|
|
@@ -3199,9 +3155,9 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3199
3155
|
return style;
|
|
3200
3156
|
}
|
|
3201
3157
|
_parseTable(html, tableElIndex) {
|
|
3202
|
-
var
|
|
3158
|
+
var _this$_getCurrentSkel;
|
|
3203
3159
|
const valueMatrix = new _univerjs_core.ObjectMatrix();
|
|
3204
|
-
const colProperties =
|
|
3160
|
+
const colProperties = parseColGroup(html) ?? [];
|
|
3205
3161
|
const { rowProperties = [] } = parseTableRows(html);
|
|
3206
3162
|
const parsedCellMatrix = this._parseTableByHtml(this._dom, tableElIndex, (_this$_getCurrentSkel = this._getCurrentSkeleton()) === null || _this$_getCurrentSkel === void 0 ? void 0 : _this$_getCurrentSkel.skeleton);
|
|
3207
3163
|
parsedCellMatrix && parsedCellMatrix.forValue((row, col, value) => {
|
|
@@ -3294,8 +3250,7 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3294
3250
|
let numfmtPattern;
|
|
3295
3251
|
const pattern = this._getMsoNumfmtForNode(cell);
|
|
3296
3252
|
if (!(0, _univerjs_core.isDefaultFormat)(pattern)) {
|
|
3297
|
-
|
|
3298
|
-
cellText = cell.childElementCount === 0 ? normalizePlainCellText((_cell$textContent = cell.textContent) !== null && _cell$textContent !== void 0 ? _cell$textContent : "") : cell.innerHTML;
|
|
3253
|
+
cellText = cell.childElementCount === 0 ? normalizePlainCellText(cell.textContent ?? "") : cell.innerHTML;
|
|
3299
3254
|
if (cellText.includes("mso-spacerun:yes")) cellText = cleanMsoSpaceRun(cellText);
|
|
3300
3255
|
const parseData = (0, _univerjs_core.getNumfmtParseValueFilter)(cellText);
|
|
3301
3256
|
if (typeof (parseData === null || parseData === void 0 ? void 0 : parseData.v) === "number" && (parseData.z === pattern || _univerjs_core.numfmt.format(pattern, parseData.v) === cellText)) {
|
|
@@ -3380,13 +3335,10 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3380
3335
|
}
|
|
3381
3336
|
}
|
|
3382
3337
|
_getCellTextAndRichText(cell, styleStr, skeleton) {
|
|
3383
|
-
if (cell.childElementCount === 0) {
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
cellRichStyle: void 0
|
|
3388
|
-
};
|
|
3389
|
-
}
|
|
3338
|
+
if (cell.childElementCount === 0) return {
|
|
3339
|
+
cellText: normalizePlainCellText(cell.textContent ?? ""),
|
|
3340
|
+
cellRichStyle: void 0
|
|
3341
|
+
};
|
|
3390
3342
|
const cellHtml = cell.innerHTML;
|
|
3391
3343
|
/**
|
|
3392
3344
|
* mso-spacerun:yes is used to force spaces in html copied from excel.
|
|
@@ -3405,13 +3357,12 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3405
3357
|
let cellText = "";
|
|
3406
3358
|
let cellRichStyle;
|
|
3407
3359
|
if (/<[^>]+>/.test(cellHtml) && skeleton) {
|
|
3408
|
-
var _skeleton$getBlankCel;
|
|
3409
3360
|
const newDocBody = {
|
|
3410
3361
|
dataStream: "",
|
|
3411
3362
|
textRuns: []
|
|
3412
3363
|
};
|
|
3413
3364
|
this._parseCellHtml(null, cell.childNodes, newDocBody, void 0, styleStr);
|
|
3414
|
-
const documentModel = (
|
|
3365
|
+
const documentModel = (0, _univerjs_core.createDocumentModelWithStyle)("", {});
|
|
3415
3366
|
const p = documentModel === null || documentModel === void 0 ? void 0 : documentModel.getSnapshot();
|
|
3416
3367
|
const singleDataStream = `${newDocBody.dataStream}\r\n`;
|
|
3417
3368
|
const documentData = {
|
|
@@ -3432,11 +3383,8 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3432
3383
|
};
|
|
3433
3384
|
}
|
|
3434
3385
|
_generateDocumentDataModelSnapshot(snapshot) {
|
|
3435
|
-
|
|
3436
|
-
const
|
|
3437
|
-
if (currentSkeleton == null) return null;
|
|
3438
|
-
const { skeleton } = currentSkeleton;
|
|
3439
|
-
const documentModel = (_skeleton$getBlankCel2 = skeleton.getBlankCellDocumentModel()) === null || _skeleton$getBlankCel2 === void 0 ? void 0 : _skeleton$getBlankCel2.documentModel;
|
|
3386
|
+
if (this._getCurrentSkeleton() == null) return null;
|
|
3387
|
+
const documentModel = (0, _univerjs_core.createDocumentModelWithStyle)("", {});
|
|
3440
3388
|
const documentData = {
|
|
3441
3389
|
...documentModel === null || documentModel === void 0 ? void 0 : documentModel.getSnapshot(),
|
|
3442
3390
|
...snapshot
|
|
@@ -3505,14 +3453,13 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3505
3453
|
const body = doc.body;
|
|
3506
3454
|
const element = node;
|
|
3507
3455
|
if (element.tagName.toUpperCase() === "A") {
|
|
3508
|
-
var _body$customRanges, _element$dataset$rang;
|
|
3509
3456
|
const href = element.href;
|
|
3510
3457
|
if (!(0, _univerjs_core.isSafeUrl)(href)) return;
|
|
3511
|
-
body.customRanges =
|
|
3458
|
+
body.customRanges = body.customRanges ?? [];
|
|
3512
3459
|
body.customRanges.push({
|
|
3513
3460
|
startIndex: start,
|
|
3514
3461
|
endIndex: body.dataStream.length - 1,
|
|
3515
|
-
rangeId:
|
|
3462
|
+
rangeId: element.dataset.rangeid ?? (0, _univerjs_core.generateRandomId)(),
|
|
3516
3463
|
rangeType: _univerjs_core.CustomRangeType.HYPERLINK,
|
|
3517
3464
|
properties: { url: href }
|
|
3518
3465
|
});
|
|
@@ -4201,7 +4148,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4201
4148
|
return this._pasteInternal(copyId, pasteType);
|
|
4202
4149
|
}
|
|
4203
4150
|
async legacyPaste(html, text, files, formulaClipboardPayload) {
|
|
4204
|
-
const isFromExcel = htmlIsFromExcel(html
|
|
4151
|
+
const isFromExcel = htmlIsFromExcel(html ?? "");
|
|
4205
4152
|
if (files && !isFromExcel) return this._pasteFiles(files, PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE);
|
|
4206
4153
|
else if (html) return this._pasteHTML(html, PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE, formulaClipboardPayload);
|
|
4207
4154
|
else if (text) if (/[\n\t]/.test(text)) return this._pasteHTML(convertTextToTable(text), PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE);
|
|
@@ -4250,7 +4197,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4250
4197
|
return this._clipboardHooks;
|
|
4251
4198
|
}
|
|
4252
4199
|
_generateCopyContent(unitId, subUnitId, range, hooks, copyHookType = PREDEFINED_HOOK_NAME_COPY.DEFAULT_COPY) {
|
|
4253
|
-
const workbook = this._univerInstanceService.
|
|
4200
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
4254
4201
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
4255
4202
|
if (!workbook || !worksheet) return null;
|
|
4256
4203
|
const filteredRows = hooks.reduce((acc, cur) => {
|
|
@@ -4455,7 +4402,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4455
4402
|
if (!cellMatrix) return false;
|
|
4456
4403
|
const pasteTarget = this._getPastedRange(cellMatrix);
|
|
4457
4404
|
if (!pasteTarget) return false;
|
|
4458
|
-
const worksheet = (_this$_univerInstance = this._univerInstanceService.
|
|
4405
|
+
const worksheet = (_this$_univerInstance = this._univerInstanceService.getUnit(pasteTarget.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getSheetBySheetId(pasteTarget.subUnitId);
|
|
4459
4406
|
if (!worksheet) return false;
|
|
4460
4407
|
const mergeData = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getMergeData();
|
|
4461
4408
|
if (mergeData.length) {
|
|
@@ -4485,7 +4432,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4485
4432
|
const { range, matrix: cachedMatrix, unitId: copyUnitId, subUnitId: copySubUnitId } = cachedData || {};
|
|
4486
4433
|
if (!cachedMatrix || !cachedData || !range || !copyUnitId || !copySubUnitId) return false;
|
|
4487
4434
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
4488
|
-
const worksheet = (_this$_univerInstance2 = this._univerInstanceService.
|
|
4435
|
+
const worksheet = (_this$_univerInstance2 = this._univerInstanceService.getUnit(copyUnitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance2 === void 0 ? void 0 : _this$_univerInstance2.getSheetBySheetId(copySubUnitId);
|
|
4489
4436
|
const cellMatrix = new _univerjs_core.ObjectMatrix();
|
|
4490
4437
|
cachedMatrix.forValue((row, col, value) => {
|
|
4491
4438
|
const { row: actualRow, col: actualColumn } = mapFunc(row, col);
|
|
@@ -4508,7 +4455,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4508
4455
|
});
|
|
4509
4456
|
const pasteTarget = this._getPastedRange(cellMatrix);
|
|
4510
4457
|
if (!pasteTarget) return false;
|
|
4511
|
-
const pasteToWorksheet = (_this$_univerInstance3 = this._univerInstanceService.
|
|
4458
|
+
const pasteToWorksheet = (_this$_univerInstance3 = this._univerInstanceService.getUnit(pasteTarget.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance3 === void 0 ? void 0 : _this$_univerInstance3.getSheetBySheetId(pasteTarget.subUnitId);
|
|
4512
4459
|
if (!pasteToWorksheet) return false;
|
|
4513
4460
|
const mergeData = pasteToWorksheet === null || pasteToWorksheet === void 0 ? void 0 : pasteToWorksheet.getMergeData();
|
|
4514
4461
|
if (mergeData) {
|
|
@@ -4684,7 +4631,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4684
4631
|
var _this$_univerInstance4, _this$_renderManagerS;
|
|
4685
4632
|
const worksheet = (_this$_univerInstance4 = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance4 === void 0 ? void 0 : _this$_univerInstance4.getSheetBySheetId(subUnitId);
|
|
4686
4633
|
if (!worksheet) return null;
|
|
4687
|
-
const skeleton = (_this$_renderManagerS = this._renderManagerService.
|
|
4634
|
+
const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
4688
4635
|
if (!skeleton) return null;
|
|
4689
4636
|
const rowManager = worksheet.getRowManager();
|
|
4690
4637
|
const defaultRowHeight = worksheet.getConfig().defaultRowHeight;
|
|
@@ -4724,7 +4671,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4724
4671
|
}
|
|
4725
4672
|
_getSetSelectionOperation(unitId, subUnitId, range, cellMatrix, pasteType) {
|
|
4726
4673
|
var _this$_univerInstance5;
|
|
4727
|
-
const worksheet = (_this$_univerInstance5 = this._univerInstanceService.
|
|
4674
|
+
const worksheet = (_this$_univerInstance5 = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance5 === void 0 ? void 0 : _this$_univerInstance5.getSheetBySheetId(subUnitId);
|
|
4728
4675
|
if (!worksheet) return null;
|
|
4729
4676
|
const { rows, cols } = range;
|
|
4730
4677
|
const startRow = rows[0];
|
|
@@ -4916,7 +4863,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4916
4863
|
if (rowCount <= 0 || colCount <= 0) return null;
|
|
4917
4864
|
const pasteSelectionRangeRowLen = discreteRange.rows.length;
|
|
4918
4865
|
const pasteSelectionRangeColLen = discreteRange.cols.length;
|
|
4919
|
-
const worksheet = (_this$_univerInstance6 = this._univerInstanceService.
|
|
4866
|
+
const worksheet = (_this$_univerInstance6 = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance6 === void 0 ? void 0 : _this$_univerInstance6.getSheetBySheetId(subUnitId);
|
|
4920
4867
|
if (!worksheet) return null;
|
|
4921
4868
|
const mergeData = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getMergeData();
|
|
4922
4869
|
if (pasteSelectionRangeRowLen % rowCount === 0 && pasteSelectionRangeColLen % colCount === 0) {
|
|
@@ -4943,7 +4890,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4943
4890
|
}
|
|
4944
4891
|
_expandOrShrinkRowsCols(unitId, subUnitId, range, colCount, rowCount) {
|
|
4945
4892
|
const { rows, cols } = range;
|
|
4946
|
-
const workbook = this._univerInstanceService.
|
|
4893
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
4947
4894
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
4948
4895
|
let newRows;
|
|
4949
4896
|
let newCols;
|
|
@@ -5241,7 +5188,7 @@ const DeleteRangeMoveLeftConfirmCommand = {
|
|
|
5241
5188
|
};
|
|
5242
5189
|
const getRowLength = (range) => range.endRow - range.startRow;
|
|
5243
5190
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
5244
|
-
const interSectedRange = _univerjs_core.
|
|
5191
|
+
const interSectedRange = (0, _univerjs_core.getIntersectRange)(mergeRange, range);
|
|
5245
5192
|
return interSectedRange ? getRowLength(mergeRange) > getRowLength(interSectedRange) : false;
|
|
5246
5193
|
})) return commandService.executeCommand(_univerjs_sheets.DeleteRangeMoveLeftCommand.id);
|
|
5247
5194
|
if (await confirmService.confirm({
|
|
@@ -5287,7 +5234,7 @@ const DeleteRangeMoveUpConfirmCommand = {
|
|
|
5287
5234
|
}
|
|
5288
5235
|
const getColLength = (range) => range.endColumn - range.startColumn;
|
|
5289
5236
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
5290
|
-
const interSectedRange = _univerjs_core.
|
|
5237
|
+
const interSectedRange = (0, _univerjs_core.getIntersectRange)(mergeRange, range);
|
|
5291
5238
|
return interSectedRange ? getColLength(mergeRange) > getColLength(interSectedRange) : false;
|
|
5292
5239
|
})) return commandService.executeCommand(_univerjs_sheets.DeleteRangeMoveUpCommand.id);
|
|
5293
5240
|
if (await confirmService.confirm({
|
|
@@ -5636,15 +5583,13 @@ function checkIfShrink(selection, direction, worksheet) {
|
|
|
5636
5583
|
switch (direction) {
|
|
5637
5584
|
case _univerjs_core.Direction.UP:
|
|
5638
5585
|
case _univerjs_core.Direction.DOWN:
|
|
5639
|
-
|
|
5640
|
-
startRange.
|
|
5641
|
-
startRange.endRow = (_primary$endRow = primary === null || primary === void 0 ? void 0 : primary.endRow) !== null && _primary$endRow !== void 0 ? _primary$endRow : range.startRow;
|
|
5586
|
+
startRange.startRow = (primary === null || primary === void 0 ? void 0 : primary.startRow) ?? range.startRow;
|
|
5587
|
+
startRange.endRow = (primary === null || primary === void 0 ? void 0 : primary.endRow) ?? range.startRow;
|
|
5642
5588
|
break;
|
|
5643
5589
|
case _univerjs_core.Direction.LEFT:
|
|
5644
5590
|
case _univerjs_core.Direction.RIGHT:
|
|
5645
|
-
|
|
5646
|
-
startRange.
|
|
5647
|
-
startRange.endColumn = (_primary$endColumn = primary === null || primary === void 0 ? void 0 : primary.endColumn) !== null && _primary$endColumn !== void 0 ? _primary$endColumn : range.startColumn;
|
|
5591
|
+
startRange.startColumn = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
|
|
5592
|
+
startRange.endColumn = (primary === null || primary === void 0 ? void 0 : primary.endColumn) ?? range.startColumn;
|
|
5648
5593
|
break;
|
|
5649
5594
|
}
|
|
5650
5595
|
const anchorRange = getEdgeOfRange(startRange, direction, worksheet);
|
|
@@ -5769,10 +5714,10 @@ const HideColConfirmCommand = {
|
|
|
5769
5714
|
//#endregion
|
|
5770
5715
|
//#region src/menu/utils.ts
|
|
5771
5716
|
function getFontStyleAtCursor(accessor) {
|
|
5772
|
-
var
|
|
5717
|
+
var _editorDataModel$getB;
|
|
5773
5718
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
5774
5719
|
const textSelectionService = accessor.get(_univerjs_docs.DocSelectionManagerService);
|
|
5775
|
-
const editorUnitId =
|
|
5720
|
+
const editorUnitId = accessor.get(_univerjs_docs_ui.IEditorService).getFocusId() ?? _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY;
|
|
5776
5721
|
const editorDataModel = univerInstanceService.getUnit(editorUnitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
5777
5722
|
const activeTextRange = textSelectionService.getActiveTextRange();
|
|
5778
5723
|
if (editorDataModel == null || activeTextRange == null) return null;
|
|
@@ -5869,15 +5814,14 @@ const SetRangeFontIncreaseCommand = {
|
|
|
5869
5814
|
if (isCellEditorFocus) {
|
|
5870
5815
|
const textRun = getFontStyleAtCursor(accessor);
|
|
5871
5816
|
if (textRun != null) {
|
|
5872
|
-
var _textRun$ts
|
|
5873
|
-
const value = (
|
|
5817
|
+
var _textRun$ts;
|
|
5818
|
+
const value = ((_textRun$ts = textRun.ts) === null || _textRun$ts === void 0 ? void 0 : _textRun$ts.fs) ?? defaultValue;
|
|
5874
5819
|
params.value = value >= 400 ? 400 : value + 1;
|
|
5875
5820
|
}
|
|
5876
5821
|
return commandService.executeCommand(_univerjs_docs_ui.SetInlineFormatFontSizeCommand.id, params);
|
|
5877
5822
|
}
|
|
5878
5823
|
if (primary != null) {
|
|
5879
|
-
|
|
5880
|
-
const value = (_style$fs = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn).fs) !== null && _style$fs !== void 0 ? _style$fs : defaultValue;
|
|
5824
|
+
const value = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn).fs ?? defaultValue;
|
|
5881
5825
|
params.value = value >= 400 ? 400 : value + 1;
|
|
5882
5826
|
return commandService.executeCommand(_univerjs_sheets.SetFontSizeCommand.id, params);
|
|
5883
5827
|
}
|
|
@@ -5900,15 +5844,14 @@ const SetRangeFontDecreaseCommand = {
|
|
|
5900
5844
|
if (isCellEditorFocus) {
|
|
5901
5845
|
const textRun = getFontStyleAtCursor(accessor);
|
|
5902
5846
|
if (textRun != null) {
|
|
5903
|
-
var _textRun$
|
|
5904
|
-
const value = (
|
|
5847
|
+
var _textRun$ts2;
|
|
5848
|
+
const value = ((_textRun$ts2 = textRun.ts) === null || _textRun$ts2 === void 0 ? void 0 : _textRun$ts2.fs) ?? defaultValue;
|
|
5905
5849
|
params.value = value <= 6 ? 6 : value - 1;
|
|
5906
5850
|
}
|
|
5907
5851
|
return commandService.executeCommand(_univerjs_docs_ui.SetInlineFormatFontSizeCommand.id, params);
|
|
5908
5852
|
}
|
|
5909
5853
|
if (primary != null) {
|
|
5910
|
-
|
|
5911
|
-
const value = (_style$fs2 = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn).fs) !== null && _style$fs2 !== void 0 ? _style$fs2 : defaultValue;
|
|
5854
|
+
const value = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn).fs ?? defaultValue;
|
|
5912
5855
|
params.value = value <= 6 ? 6 : value - 1;
|
|
5913
5856
|
return commandService.executeCommand(_univerjs_sheets.SetFontSizeCommand.id, params);
|
|
5914
5857
|
}
|
|
@@ -5977,7 +5920,7 @@ const InsertRangeMoveDownConfirmCommand = {
|
|
|
5977
5920
|
}
|
|
5978
5921
|
const getColLength = (range) => range.endColumn - range.startColumn;
|
|
5979
5922
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
5980
|
-
const interSectedRange = _univerjs_core.
|
|
5923
|
+
const interSectedRange = (0, _univerjs_core.getIntersectRange)(mergeRange, range);
|
|
5981
5924
|
return interSectedRange ? getColLength(mergeRange) > getColLength(interSectedRange) : false;
|
|
5982
5925
|
})) return commandService.executeCommand(_univerjs_sheets.InsertRangeMoveDownCommand.id);
|
|
5983
5926
|
if (await confirmService.confirm({
|
|
@@ -6015,7 +5958,7 @@ const InsertRangeMoveRightConfirmCommand = {
|
|
|
6015
5958
|
};
|
|
6016
5959
|
const getRowLength = (range) => range.endRow - range.startRow;
|
|
6017
5960
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
6018
|
-
const interSectedRange = _univerjs_core.
|
|
5961
|
+
const interSectedRange = (0, _univerjs_core.getIntersectRange)(mergeRange, range);
|
|
6019
5962
|
return interSectedRange ? getRowLength(mergeRange) > getRowLength(interSectedRange) : false;
|
|
6020
5963
|
})) return commandService.executeCommand(_univerjs_sheets.InsertRangeMoveRightCommand.id);
|
|
6021
5964
|
if (await confirmService.confirm({
|
|
@@ -6462,8 +6405,8 @@ let FormatPainterService = class FormatPainterService extends _univerjs_core.Dis
|
|
|
6462
6405
|
};
|
|
6463
6406
|
}
|
|
6464
6407
|
addHook(hook) {
|
|
6465
|
-
var
|
|
6466
|
-
if (hook.isDefaultHook && (
|
|
6408
|
+
var _this$_defaultHook;
|
|
6409
|
+
if (hook.isDefaultHook && (hook.priority ?? 0) > (((_this$_defaultHook = this._defaultHook) === null || _this$_defaultHook === void 0 ? void 0 : _this$_defaultHook.priority) ?? -1)) this._defaultHook = hook;
|
|
6467
6410
|
else {
|
|
6468
6411
|
this._extendHooks.push(hook);
|
|
6469
6412
|
this._extendHooks.sort((a, b) => (a.priority || 0) - (b.priority || 0));
|
|
@@ -6610,7 +6553,7 @@ let SheetScrollManagerService = class SheetScrollManagerService {
|
|
|
6610
6553
|
this._rawScrollInfo$.complete();
|
|
6611
6554
|
}
|
|
6612
6555
|
calcViewportScrollFromRowColOffset(scrollInfo) {
|
|
6613
|
-
var _skeleton$getCellWith
|
|
6556
|
+
var _skeleton$getCellWith;
|
|
6614
6557
|
if (!scrollInfo) return {
|
|
6615
6558
|
viewportScrollX: 0,
|
|
6616
6559
|
viewportScrollY: 0
|
|
@@ -6619,7 +6562,7 @@ let SheetScrollManagerService = class SheetScrollManagerService {
|
|
|
6619
6562
|
sheetViewStartRow = sheetViewStartRow || 0;
|
|
6620
6563
|
offsetY = offsetY || 0;
|
|
6621
6564
|
const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
|
|
6622
|
-
const { startX: colStart = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.columnWidthAccumulation[sheetViewStartColumn - 1]) || 0, startY: rowStart = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.rowHeightAccumulation[sheetViewStartRow - 1]) || 0 } = (
|
|
6565
|
+
const { startX: colStart = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.columnWidthAccumulation[sheetViewStartColumn - 1]) || 0, startY: rowStart = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.rowHeightAccumulation[sheetViewStartRow - 1]) || 0 } = (skeleton === null || skeleton === void 0 || (_skeleton$getCellWith = skeleton.getCellWithCoordByIndex) === null || _skeleton$getCellWith === void 0 ? void 0 : _skeleton$getCellWith.call(skeleton, sheetViewStartRow, sheetViewStartColumn, false)) ?? {};
|
|
6623
6566
|
return {
|
|
6624
6567
|
viewportScrollX: colStart + offsetX,
|
|
6625
6568
|
viewportScrollY: rowStart + offsetY
|
|
@@ -6700,10 +6643,10 @@ let SheetScrollManagerService = class SheetScrollManagerService {
|
|
|
6700
6643
|
return ((_this$_scrollStateMap = this._scrollStateMap.get(unitId)) === null || _this$_scrollStateMap === void 0 ? void 0 : _this$_scrollStateMap.get(sheetId)) || this._getDefaultScrollState(param);
|
|
6701
6644
|
}
|
|
6702
6645
|
_getDefaultScrollState(param) {
|
|
6703
|
-
var _this$_sheetSkeletonM, _this$_sheetSkeletonM2, _this$_sheetSkeletonM3, _this$_sheetSkeletonM4
|
|
6704
|
-
const skeleton = (_this$_sheetSkeletonM = (_this$_sheetSkeletonM2 =
|
|
6705
|
-
const colGapSize = (
|
|
6706
|
-
const rowGapSize = (
|
|
6646
|
+
var _this$_sheetSkeletonM, _this$_sheetSkeletonM2, _this$_sheetSkeletonM3, _this$_sheetSkeletonM4;
|
|
6647
|
+
const skeleton = ((_this$_sheetSkeletonM = (_this$_sheetSkeletonM2 = this._sheetSkeletonManagerService).getSkeleton) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.call(_this$_sheetSkeletonM2, param.sheetId)) ?? ((_this$_sheetSkeletonM3 = (_this$_sheetSkeletonM4 = this._sheetSkeletonManagerService).getCurrentSkeleton) === null || _this$_sheetSkeletonM3 === void 0 ? void 0 : _this$_sheetSkeletonM3.call(_this$_sheetSkeletonM4));
|
|
6648
|
+
const colGapSize = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.getColGapSize(0)) ?? 0;
|
|
6649
|
+
const rowGapSize = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.getRowGapSize(0)) ?? 0;
|
|
6707
6650
|
return {
|
|
6708
6651
|
sheetViewStartRow: 0,
|
|
6709
6652
|
sheetViewStartColumn: 0,
|
|
@@ -6732,7 +6675,7 @@ const SetSelectionFrozenCommand = {
|
|
|
6732
6675
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
6733
6676
|
const selections = accessor.get(_univerjs_sheets.SheetsSelectionsService).getCurrentSelections();
|
|
6734
6677
|
if (!selections) return false;
|
|
6735
|
-
const { sheetViewStartRow = 0, sheetViewStartColumn = 0 } = accessor.get(_univerjs_engine_render.IRenderManagerService).
|
|
6678
|
+
const { sheetViewStartRow = 0, sheetViewStartColumn = 0 } = accessor.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(unitId).with(SheetScrollManagerService).getCurrentScrollState() || {};
|
|
6736
6679
|
let startRow;
|
|
6737
6680
|
let startColumn;
|
|
6738
6681
|
let freezedRowCount;
|
|
@@ -6748,11 +6691,10 @@ const SetSelectionFrozenCommand = {
|
|
|
6748
6691
|
startColumn = sheetViewStartColumn + 1;
|
|
6749
6692
|
freezedColCount = 1;
|
|
6750
6693
|
} else {
|
|
6751
|
-
var _primary$startRow, _primary$startColumn;
|
|
6752
6694
|
const { primary, range } = selections[(selections === null || selections === void 0 ? void 0 : selections.length) - 1];
|
|
6753
|
-
let selectRow = (
|
|
6695
|
+
let selectRow = (primary === null || primary === void 0 ? void 0 : primary.startRow) ?? range.startRow;
|
|
6754
6696
|
if (selectRow === 0) selectRow = 1;
|
|
6755
|
-
let selectColumn = (
|
|
6697
|
+
let selectColumn = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
|
|
6756
6698
|
if (selectColumn === 0) selectColumn = 1;
|
|
6757
6699
|
const rangeType = range.rangeType;
|
|
6758
6700
|
if (rangeType === _univerjs_core.RANGE_TYPE.ROW || type === 1) {
|
|
@@ -7083,7 +7025,7 @@ const MoveSelectionEnterAndTabCommand = {
|
|
|
7083
7025
|
reveal: true,
|
|
7084
7026
|
extra: params.extra
|
|
7085
7027
|
});
|
|
7086
|
-
const selectionService = (_renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService).
|
|
7028
|
+
const selectionService = (_renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(ISheetSelectionRenderService);
|
|
7087
7029
|
selectionService === null || selectionService === void 0 || selectionService.refreshSelectionMoveEnd();
|
|
7088
7030
|
return rs;
|
|
7089
7031
|
}
|
|
@@ -7217,7 +7159,7 @@ function getSheetObject(univerInstanceService, renderManagerService) {
|
|
|
7217
7159
|
const unitId = workbook.getUnitId();
|
|
7218
7160
|
let components, mainComponent, scene, engine;
|
|
7219
7161
|
if (isRenderManagerService(renderManagerService)) {
|
|
7220
|
-
const currentRender = renderManagerService.
|
|
7162
|
+
const currentRender = renderManagerService.getRenderUnitById(unitId);
|
|
7221
7163
|
if (currentRender == null) return null;
|
|
7222
7164
|
components = currentRender.components;
|
|
7223
7165
|
components = currentRender.components;
|
|
@@ -7554,9 +7496,7 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends _u
|
|
|
7554
7496
|
}
|
|
7555
7497
|
_getFreeze() {
|
|
7556
7498
|
var _this$_sheetSkeletonM4;
|
|
7557
|
-
|
|
7558
|
-
if (snapshot == null) return;
|
|
7559
|
-
return snapshot.freeze;
|
|
7499
|
+
return (_this$_sheetSkeletonM4 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM4 === void 0 ? void 0 : _this$_sheetSkeletonM4.skeleton.worksheet.getFreeze();
|
|
7560
7500
|
}
|
|
7561
7501
|
_getSheetObject() {
|
|
7562
7502
|
return getSheetObject(this._context.unit, this._context);
|
|
@@ -7575,12 +7515,11 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends _u
|
|
|
7575
7515
|
this._scrollToCell(row, column);
|
|
7576
7516
|
}
|
|
7577
7517
|
_scrollToSelection(targetIsActualRowAndColumn = true) {
|
|
7578
|
-
var _selection$primary;
|
|
7579
7518
|
const selection = this._getSelectionsService().getCurrentLastSelection();
|
|
7580
7519
|
if (!selection) return;
|
|
7581
|
-
const { startRow, startColumn, actualRow, actualColumn } =
|
|
7582
|
-
const selectionStartRow = targetIsActualRowAndColumn ? actualRow
|
|
7583
|
-
const selectionStartColumn = targetIsActualRowAndColumn ? actualColumn
|
|
7520
|
+
const { startRow, startColumn, actualRow, actualColumn } = selection.primary ?? selection.range;
|
|
7521
|
+
const selectionStartRow = targetIsActualRowAndColumn ? actualRow ?? startRow : startRow;
|
|
7522
|
+
const selectionStartColumn = targetIsActualRowAndColumn ? actualColumn ?? startColumn : startColumn;
|
|
7584
7523
|
this._scrollToCell(selectionStartRow, selectionStartColumn);
|
|
7585
7524
|
}
|
|
7586
7525
|
_getSelectionsService() {
|
|
@@ -7598,14 +7537,14 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends _u
|
|
|
7598
7537
|
return skeleton.getRangeByViewBound(vpInfo.viewBound);
|
|
7599
7538
|
}
|
|
7600
7539
|
_scrollToCell(row, column, forceTop = false, forceLeft = false) {
|
|
7601
|
-
var _this$
|
|
7602
|
-
const { rowHeightAccumulation, columnWidthAccumulation } =
|
|
7540
|
+
var _this$_getSheetObject2, _this$_sheetSkeletonM6;
|
|
7541
|
+
const { rowHeightAccumulation, columnWidthAccumulation } = this._sheetSkeletonManagerService.getCurrentSkeleton() ?? {};
|
|
7603
7542
|
if (rowHeightAccumulation == null || columnWidthAccumulation == null) return false;
|
|
7604
7543
|
const scene = (_this$_getSheetObject2 = this._getSheetObject()) === null || _this$_getSheetObject2 === void 0 ? void 0 : _this$_getSheetObject2.scene;
|
|
7605
7544
|
if (scene == null) return false;
|
|
7606
7545
|
const viewport = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7607
7546
|
if (viewport == null) return false;
|
|
7608
|
-
const skeleton = (_this$
|
|
7547
|
+
const skeleton = (_this$_sheetSkeletonM6 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM6 === void 0 ? void 0 : _this$_sheetSkeletonM6.skeleton;
|
|
7609
7548
|
if (skeleton == null) return false;
|
|
7610
7549
|
const worksheet = this._context.unit.getActiveSheet();
|
|
7611
7550
|
if (!worksheet) return false;
|
|
@@ -7693,8 +7632,8 @@ const SetScrollOperation = {
|
|
|
7693
7632
|
if (!params) return false;
|
|
7694
7633
|
const { unitId, sheetId, offsetX = 0, offsetY = 0, sheetViewStartColumn, sheetViewStartRow, duration, screenRatioX, screenRatioY } = params;
|
|
7695
7634
|
const renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
7696
|
-
const scrollManagerService = renderManagerService.
|
|
7697
|
-
const renderUnit = renderManagerService.
|
|
7635
|
+
const scrollManagerService = renderManagerService.getRenderUnitById(unitId).with(SheetScrollManagerService);
|
|
7636
|
+
const renderUnit = renderManagerService.getRenderUnitById(unitId);
|
|
7698
7637
|
if (!renderUnit) return false;
|
|
7699
7638
|
const engine = renderUnit.engine;
|
|
7700
7639
|
const canvasWidth = engine.width;
|
|
@@ -7731,7 +7670,7 @@ const SetScrollRelativeCommand = {
|
|
|
7731
7670
|
const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService);
|
|
7732
7671
|
if (!target) return false;
|
|
7733
7672
|
const { unitId, subUnitId } = target;
|
|
7734
|
-
const currentScroll = renderManagerSrv.
|
|
7673
|
+
const currentScroll = renderManagerSrv.getRenderUnitById(unitId).with(SheetScrollManagerService).getCurrentScrollState();
|
|
7735
7674
|
const { offsetX = 0, offsetY = 0 } = params || {};
|
|
7736
7675
|
const { sheetViewStartRow = 0, sheetViewStartColumn = 0, offsetX: currentOffsetX = 0, offsetY: currentOffsetY = 0 } = currentScroll || {};
|
|
7737
7676
|
return commandService.executeCommand(SetScrollOperation.id, {
|
|
@@ -7759,7 +7698,7 @@ const ScrollCommand = {
|
|
|
7759
7698
|
const target = params.unitId ? getScrollCommandTargetByParams(univerInstanceService, params) : (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService);
|
|
7760
7699
|
if (!target) return false;
|
|
7761
7700
|
const { workbook, worksheet, unitId } = target;
|
|
7762
|
-
const renderUnit = renderManagerSrv.
|
|
7701
|
+
const renderUnit = renderManagerSrv.getRenderUnitById(unitId);
|
|
7763
7702
|
if (!renderUnit) return false;
|
|
7764
7703
|
const currentScroll = renderUnit.with(SheetScrollManagerService).getCurrentScrollState();
|
|
7765
7704
|
if (!worksheet) return false;
|
|
@@ -7769,10 +7708,10 @@ const ScrollCommand = {
|
|
|
7769
7708
|
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetScrollOperation.id, {
|
|
7770
7709
|
unitId: workbook.getUnitId(),
|
|
7771
7710
|
sheetId: worksheet.getSheetId(),
|
|
7772
|
-
sheetViewStartRow: sheetViewStartRow
|
|
7773
|
-
sheetViewStartColumn: sheetViewStartColumn
|
|
7774
|
-
offsetX: offsetX
|
|
7775
|
-
offsetY: offsetY
|
|
7711
|
+
sheetViewStartRow: sheetViewStartRow ?? currentRow ?? 0 + ySplit,
|
|
7712
|
+
sheetViewStartColumn: sheetViewStartColumn ?? currentColumn ?? 0 + xSplit,
|
|
7713
|
+
offsetX: offsetX ?? currentOffsetX,
|
|
7714
|
+
offsetY: offsetY ?? currentOffsetY,
|
|
7776
7715
|
duration
|
|
7777
7716
|
});
|
|
7778
7717
|
}
|
|
@@ -7797,7 +7736,7 @@ const ScrollToCellCommand = {
|
|
|
7797
7736
|
type: _univerjs_core.CommandType.COMMAND,
|
|
7798
7737
|
handler: (accessor, params) => {
|
|
7799
7738
|
const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
7800
|
-
return accessor.get(_univerjs_engine_render.IRenderManagerService).
|
|
7739
|
+
return accessor.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).getUnitId()).with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
|
|
7801
7740
|
}
|
|
7802
7741
|
};
|
|
7803
7742
|
/**
|
|
@@ -7851,7 +7790,7 @@ let AutoWidthController = class AutoWidthController extends _univerjs_core.Dispo
|
|
|
7851
7790
|
const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService, params);
|
|
7852
7791
|
if (!target) return defaultValue;
|
|
7853
7792
|
const { unitId, subUnitId, worksheet } = target;
|
|
7854
|
-
const sheetSkeletonService = this._renderManagerService.
|
|
7793
|
+
const sheetSkeletonService = this._renderManagerService.getRenderUnitById(unitId).with(SheetSkeletonManagerService);
|
|
7855
7794
|
if (!sheetSkeletonService.getCurrentParam()) return defaultValue;
|
|
7856
7795
|
const { skeleton } = sheetSkeletonService.getCurrentParam();
|
|
7857
7796
|
const colsAutoWidthInfo = skeleton.calculateAutoWidthInRange(params.ranges);
|
|
@@ -7915,6 +7854,162 @@ const SetWorksheetColAutoWidthCommand = {
|
|
|
7915
7854
|
}
|
|
7916
7855
|
};
|
|
7917
7856
|
|
|
7857
|
+
//#endregion
|
|
7858
|
+
//#region src/common/utils.ts
|
|
7859
|
+
function getUserListEqual(userList1, userList2) {
|
|
7860
|
+
if (userList1.length !== userList2.length) return false;
|
|
7861
|
+
const sorted1 = userList1.sort((a, b) => a.id.localeCompare(b.id));
|
|
7862
|
+
const sorted2 = userList2.sort((a, b) => a.id.localeCompare(b.id));
|
|
7863
|
+
return sorted1.every((user, index) => {
|
|
7864
|
+
var _user$subject, _sorted2$index$subjec;
|
|
7865
|
+
return ((_user$subject = user.subject) === null || _user$subject === void 0 ? void 0 : _user$subject.userID) === ((_sorted2$index$subjec = sorted2[index].subject) === null || _sorted2$index$subjec === void 0 ? void 0 : _sorted2$index$subjec.userID) && user.role === sorted2[index].role;
|
|
7866
|
+
});
|
|
7867
|
+
}
|
|
7868
|
+
function checkCellContentInRanges(worksheet, ranges) {
|
|
7869
|
+
return ranges.some((range) => checkCellContentInRange(worksheet, range));
|
|
7870
|
+
}
|
|
7871
|
+
function checkCellContentInRange(worksheet, range) {
|
|
7872
|
+
const { startRow, startColumn, endColumn, endRow } = range;
|
|
7873
|
+
const cellMatrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn);
|
|
7874
|
+
let someCellGoingToBeRemoved = false;
|
|
7875
|
+
cellMatrix.forValue((row, col, cellData) => {
|
|
7876
|
+
if (cellData && (row !== startRow || col !== startColumn) && worksheet.cellHasValue(cellData)) {
|
|
7877
|
+
someCellGoingToBeRemoved = true;
|
|
7878
|
+
return false;
|
|
7879
|
+
}
|
|
7880
|
+
});
|
|
7881
|
+
return someCellGoingToBeRemoved;
|
|
7882
|
+
}
|
|
7883
|
+
function getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton) {
|
|
7884
|
+
const activeViewport = scene.getActiveViewportByCoord(_univerjs_engine_render.Vector2.FromArray([offsetX, offsetY]));
|
|
7885
|
+
if (!activeViewport) return;
|
|
7886
|
+
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7887
|
+
const scrollXY = {
|
|
7888
|
+
x: activeViewport.viewportScrollX,
|
|
7889
|
+
y: activeViewport.viewportScrollY
|
|
7890
|
+
};
|
|
7891
|
+
const cellIndex = skeleton.getCellIndexByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
7892
|
+
const mergeCell = skeleton.worksheet.getMergedCell(cellIndex.row, cellIndex.column);
|
|
7893
|
+
return {
|
|
7894
|
+
actualRow: mergeCell ? mergeCell.startRow : cellIndex.row,
|
|
7895
|
+
actualCol: mergeCell ? mergeCell.startColumn : cellIndex.column,
|
|
7896
|
+
mergeCell,
|
|
7897
|
+
row: cellIndex.row,
|
|
7898
|
+
col: cellIndex.column
|
|
7899
|
+
};
|
|
7900
|
+
}
|
|
7901
|
+
function getViewportByCell(row, column, scene, worksheet) {
|
|
7902
|
+
const freeze = worksheet.getFreeze();
|
|
7903
|
+
if (!freeze || freeze.startRow <= 0 && freeze.startColumn <= 0) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7904
|
+
if (row >= freeze.startRow && column >= freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7905
|
+
if (row < freeze.startRow && column < freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP);
|
|
7906
|
+
if (row < freeze.startRow && column >= freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP);
|
|
7907
|
+
if (row >= freeze.startRow && column < freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT);
|
|
7908
|
+
}
|
|
7909
|
+
function transformBound2OffsetBound(originBound, scene, skeleton, worksheet) {
|
|
7910
|
+
const topLeft = transformPosition2Offset(originBound.left, originBound.top, scene, skeleton, worksheet);
|
|
7911
|
+
const bottomRight = transformPosition2Offset(originBound.right, originBound.bottom, scene, skeleton, worksheet);
|
|
7912
|
+
return {
|
|
7913
|
+
left: topLeft.x,
|
|
7914
|
+
top: topLeft.y,
|
|
7915
|
+
right: bottomRight.x,
|
|
7916
|
+
bottom: bottomRight.y
|
|
7917
|
+
};
|
|
7918
|
+
}
|
|
7919
|
+
function transformPosition2Offset(x, y, scene, skeleton, worksheet) {
|
|
7920
|
+
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7921
|
+
const viewMain = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7922
|
+
if (!viewMain) return {
|
|
7923
|
+
x,
|
|
7924
|
+
y
|
|
7925
|
+
};
|
|
7926
|
+
const { startColumn, startRow, xSplit, ySplit } = worksheet.getFreeze();
|
|
7927
|
+
const startSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow - ySplit, startColumn - xSplit, false);
|
|
7928
|
+
const endSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow, startColumn, false);
|
|
7929
|
+
const { rowHeaderWidth, columnHeaderHeight } = skeleton;
|
|
7930
|
+
const freezeWidth = endSheetView.startX - startSheetView.startX;
|
|
7931
|
+
const freezeHeight = endSheetView.startY - startSheetView.startY;
|
|
7932
|
+
const { top, left, viewportScrollX, viewportScrollY } = viewMain;
|
|
7933
|
+
let offsetX;
|
|
7934
|
+
if (x > left) offsetX = (x - viewportScrollX) * scaleX;
|
|
7935
|
+
else offsetX = (freezeWidth + rowHeaderWidth - (left - x)) * scaleX;
|
|
7936
|
+
let offsetY;
|
|
7937
|
+
if (y > top) offsetY = (y - viewportScrollY) * scaleY;
|
|
7938
|
+
else offsetY = (freezeHeight + columnHeaderHeight - (top - y)) * scaleX;
|
|
7939
|
+
return {
|
|
7940
|
+
x: offsetX,
|
|
7941
|
+
y: offsetY
|
|
7942
|
+
};
|
|
7943
|
+
}
|
|
7944
|
+
function getCellRealRange(workbook, worksheet, skeleton, row, col) {
|
|
7945
|
+
let actualRow = row;
|
|
7946
|
+
let actualCol = col;
|
|
7947
|
+
skeleton.overflowCache.forValue((r, c, range) => {
|
|
7948
|
+
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
7949
|
+
actualCol = c;
|
|
7950
|
+
actualRow = r;
|
|
7951
|
+
}
|
|
7952
|
+
});
|
|
7953
|
+
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
7954
|
+
return {
|
|
7955
|
+
unitId: workbook.getUnitId(),
|
|
7956
|
+
subUnitId: worksheet.getSheetId(),
|
|
7957
|
+
workbook,
|
|
7958
|
+
worksheet,
|
|
7959
|
+
row: actualCell.actualRow,
|
|
7960
|
+
col: actualCell.actualColumn
|
|
7961
|
+
};
|
|
7962
|
+
}
|
|
7963
|
+
function getHoverCellPosition(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY) {
|
|
7964
|
+
const { scene } = currentRender;
|
|
7965
|
+
const unitId = workbook.getUnitId();
|
|
7966
|
+
const { skeleton, sheetId } = skeletonParam;
|
|
7967
|
+
const cellIndex = getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton);
|
|
7968
|
+
if (!cellIndex) return null;
|
|
7969
|
+
let { actualCol, actualRow } = cellIndex;
|
|
7970
|
+
const originLocation = {
|
|
7971
|
+
unitId,
|
|
7972
|
+
subUnitId: sheetId,
|
|
7973
|
+
workbook,
|
|
7974
|
+
worksheet,
|
|
7975
|
+
row: actualRow,
|
|
7976
|
+
col: actualCol
|
|
7977
|
+
};
|
|
7978
|
+
skeleton.overflowCache.forValue((r, c, range) => {
|
|
7979
|
+
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
7980
|
+
actualCol = c;
|
|
7981
|
+
actualRow = r;
|
|
7982
|
+
}
|
|
7983
|
+
});
|
|
7984
|
+
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
7985
|
+
const location = getCellRealRange(workbook, worksheet, skeleton, actualRow, actualCol);
|
|
7986
|
+
let anchorCell;
|
|
7987
|
+
if (actualCell.mergeInfo) anchorCell = actualCell.mergeInfo;
|
|
7988
|
+
else anchorCell = {
|
|
7989
|
+
startRow: location.row,
|
|
7990
|
+
endRow: location.row,
|
|
7991
|
+
startColumn: location.col,
|
|
7992
|
+
endColumn: location.col
|
|
7993
|
+
};
|
|
7994
|
+
const activeViewport = scene.getActiveViewportByCoord(_univerjs_engine_render.Vector2.FromArray([offsetX, offsetY]));
|
|
7995
|
+
if (!activeViewport) return;
|
|
7996
|
+
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7997
|
+
const scrollXY = {
|
|
7998
|
+
x: activeViewport.viewportScrollX,
|
|
7999
|
+
y: activeViewport.viewportScrollY
|
|
8000
|
+
};
|
|
8001
|
+
return {
|
|
8002
|
+
position: {
|
|
8003
|
+
startX: (skeleton.getOffsetByColumn(anchorCell.startColumn - 1) - scrollXY.x) * scaleX,
|
|
8004
|
+
endX: (skeleton.getOffsetByColumn(anchorCell.endColumn) - scrollXY.x) * scaleX,
|
|
8005
|
+
startY: (skeleton.getOffsetByRow(anchorCell.startRow - 1) - scrollXY.y) * scaleY,
|
|
8006
|
+
endY: (skeleton.getOffsetByRow(anchorCell.endRow) - scrollXY.y) * scaleY
|
|
8007
|
+
},
|
|
8008
|
+
location: originLocation,
|
|
8009
|
+
overflowLocation: location
|
|
8010
|
+
};
|
|
8011
|
+
}
|
|
8012
|
+
|
|
7918
8013
|
//#endregion
|
|
7919
8014
|
//#region src/services/editor-bridge.service.ts
|
|
7920
8015
|
let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Disposable {
|
|
@@ -7988,15 +8083,16 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
7988
8083
|
if (!workbook || workbook.getUnitId() !== unitId) return;
|
|
7989
8084
|
const worksheet = workbook.getActiveSheet();
|
|
7990
8085
|
if (!worksheet || worksheet.getSheetId() !== sheetId) return;
|
|
7991
|
-
|
|
7992
|
-
if (!renderUnit) return;
|
|
8086
|
+
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
7993
8087
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, sheetId);
|
|
7994
8088
|
if (!skeleton) return;
|
|
7995
8089
|
const actualRangeWithCoord = (0, _univerjs_core.convertCellToRange)((0, _univerjs_sheets.attachPrimaryWithCoord)(skeleton, primary));
|
|
7996
8090
|
const canvasOffset = (0, _univerjs_docs_ui.getCanvasOffsetByEngine)(engine);
|
|
7997
8091
|
let { startX, startY, endX, endY } = actualRangeWithCoord;
|
|
7998
8092
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7999
|
-
const
|
|
8093
|
+
const viewport = getViewportByCell(primary.startRow, primary.startColumn, scene, worksheet);
|
|
8094
|
+
if (!viewport) return;
|
|
8095
|
+
const scrollXY = scene.getViewportScrollXY(viewport);
|
|
8000
8096
|
startX = (0, _univerjs_engine_render.convertTransformToOffsetX)(startX, scaleX, scrollXY);
|
|
8001
8097
|
startY = (0, _univerjs_engine_render.convertTransformToOffsetY)(startY, scaleY, scrollXY);
|
|
8002
8098
|
endX = (0, _univerjs_engine_render.convertTransformToOffsetX)(endX, scaleX, scrollXY);
|
|
@@ -8087,8 +8183,7 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
8087
8183
|
if (!workbook || workbook.getUnitId() !== unitId) return;
|
|
8088
8184
|
const worksheet = workbook.getActiveSheet();
|
|
8089
8185
|
if (!worksheet || worksheet.getSheetId() !== sheetId) return;
|
|
8090
|
-
|
|
8091
|
-
if (!renderUnit) return;
|
|
8186
|
+
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
8092
8187
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, sheetId);
|
|
8093
8188
|
if (!skeleton) return;
|
|
8094
8189
|
const { startRow, startColumn } = primary;
|
|
@@ -8096,7 +8191,9 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
8096
8191
|
const canvasOffset = (0, _univerjs_docs_ui.getCanvasOffsetByEngine)(engine);
|
|
8097
8192
|
let { startX, startY, endX, endY } = actualRangeWithCoord;
|
|
8098
8193
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8099
|
-
const
|
|
8194
|
+
const viewport = getViewportByCell(startRow, startColumn, scene, worksheet);
|
|
8195
|
+
if (!viewport) return;
|
|
8196
|
+
const scrollXY = scene.getViewportScrollXY(viewport);
|
|
8100
8197
|
startX = (0, _univerjs_engine_render.convertTransformToOffsetX)(startX, scaleX, scrollXY);
|
|
8101
8198
|
startY = (0, _univerjs_engine_render.convertTransformToOffsetY)(startY, scaleY, scrollXY);
|
|
8102
8199
|
endX = (0, _univerjs_engine_render.convertTransformToOffsetX)(endX, scaleX, scrollXY);
|
|
@@ -8162,8 +8259,7 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
8162
8259
|
};
|
|
8163
8260
|
}
|
|
8164
8261
|
_getWorkbookForEditUnit(unitId) {
|
|
8165
|
-
|
|
8166
|
-
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);
|
|
8262
|
+
return this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET) ?? this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
8167
8263
|
}
|
|
8168
8264
|
getCurrentEditorId() {
|
|
8169
8265
|
return this._editorUnitId;
|
|
@@ -8278,7 +8374,7 @@ const SetZoomRatioOperation = {
|
|
|
8278
8374
|
id: "sheet.operation.set-zoom-ratio",
|
|
8279
8375
|
type: _univerjs_core.CommandType.OPERATION,
|
|
8280
8376
|
handler: (accessor, params) => {
|
|
8281
|
-
const renderUnit = accessor.get(_univerjs_engine_render.IRenderManagerService).
|
|
8377
|
+
const renderUnit = accessor.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(params.unitId);
|
|
8282
8378
|
if (!renderUnit) return false;
|
|
8283
8379
|
return renderUnit.with(SheetsZoomRenderController).updateZoom(params.subUnitId, params.zoomRatio);
|
|
8284
8380
|
}
|
|
@@ -8463,7 +8559,6 @@ const SHEETS_UI_PLUGIN_CONFIG_KEY = "sheets-ui.config";
|
|
|
8463
8559
|
const configSymbol = Symbol(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
8464
8560
|
const defaultPluginConfig = {
|
|
8465
8561
|
formulaBar: true,
|
|
8466
|
-
statusBarStatistic: true,
|
|
8467
8562
|
protectedRangeShadow: true,
|
|
8468
8563
|
maxAutoHeightCount: 1e3
|
|
8469
8564
|
};
|
|
@@ -8495,7 +8590,7 @@ const SetCellEditVisibleOperation = {
|
|
|
8495
8590
|
if (!workbook) return false;
|
|
8496
8591
|
accessor.get(IEditorBridgeService).changeVisible({
|
|
8497
8592
|
...params,
|
|
8498
|
-
unitId: unitId
|
|
8593
|
+
unitId: unitId ?? workbook.getUnitId()
|
|
8499
8594
|
});
|
|
8500
8595
|
return true;
|
|
8501
8596
|
}
|
|
@@ -8516,8 +8611,6 @@ const SetCellEditVisibleWithF2Operation = {
|
|
|
8516
8611
|
/**
|
|
8517
8612
|
* When the editor is not clicked to change the cursor,
|
|
8518
8613
|
* the arrow keys will exit editing and move the cell.
|
|
8519
|
-
*
|
|
8520
|
-
* @deprecated Should not use operation as an event.
|
|
8521
8614
|
*/
|
|
8522
8615
|
const SetCellEditVisibleArrowOperation = {
|
|
8523
8616
|
id: "sheet.operation.set-cell-edit-visible-arrow",
|
|
@@ -8543,13 +8636,13 @@ const ScrollToRangeOperation = {
|
|
|
8543
8636
|
id: "sheet.operation.scroll-to-range",
|
|
8544
8637
|
type: _univerjs_core.CommandType.OPERATION,
|
|
8545
8638
|
handler: (accessor, params) => {
|
|
8546
|
-
var
|
|
8639
|
+
var _instanceService$getC;
|
|
8547
8640
|
if (!params) return false;
|
|
8548
8641
|
const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
8549
8642
|
const renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
8550
|
-
const unitId =
|
|
8643
|
+
const unitId = params.unitId ?? ((_instanceService$getC = instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _instanceService$getC === void 0 ? void 0 : _instanceService$getC.getUnitId());
|
|
8551
8644
|
if (!unitId) return false;
|
|
8552
|
-
const renderUnit = renderManagerService.
|
|
8645
|
+
const renderUnit = renderManagerService.getRenderUnitById(unitId);
|
|
8553
8646
|
if (!renderUnit) return false;
|
|
8554
8647
|
return renderUnit.with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
|
|
8555
8648
|
}
|
|
@@ -8568,7 +8661,6 @@ const SheetPermissionOpenDialogOperation = {
|
|
|
8568
8661
|
title: { title: "sheets-ui.permission.dialog.allowedPermissionType" },
|
|
8569
8662
|
children: { label: UNIVER_SHEET_PERMISSION_DIALOG },
|
|
8570
8663
|
width: 393,
|
|
8571
|
-
destroyOnClose: true,
|
|
8572
8664
|
onClose: () => dialogService.close(UNIVER_SHEET_PERMISSION_DIALOG_ID)
|
|
8573
8665
|
});
|
|
8574
8666
|
return true;
|
|
@@ -8624,162 +8716,6 @@ const SidebarDefinedNameOperation = {
|
|
|
8624
8716
|
}
|
|
8625
8717
|
};
|
|
8626
8718
|
|
|
8627
|
-
//#endregion
|
|
8628
|
-
//#region src/common/utils.ts
|
|
8629
|
-
function getUserListEqual(userList1, userList2) {
|
|
8630
|
-
if (userList1.length !== userList2.length) return false;
|
|
8631
|
-
const sorted1 = userList1.sort((a, b) => a.id.localeCompare(b.id));
|
|
8632
|
-
const sorted2 = userList2.sort((a, b) => a.id.localeCompare(b.id));
|
|
8633
|
-
return sorted1.every((user, index) => {
|
|
8634
|
-
var _user$subject, _sorted2$index$subjec;
|
|
8635
|
-
return ((_user$subject = user.subject) === null || _user$subject === void 0 ? void 0 : _user$subject.userID) === ((_sorted2$index$subjec = sorted2[index].subject) === null || _sorted2$index$subjec === void 0 ? void 0 : _sorted2$index$subjec.userID) && user.role === sorted2[index].role;
|
|
8636
|
-
});
|
|
8637
|
-
}
|
|
8638
|
-
function checkCellContentInRanges(worksheet, ranges) {
|
|
8639
|
-
return ranges.some((range) => checkCellContentInRange(worksheet, range));
|
|
8640
|
-
}
|
|
8641
|
-
function checkCellContentInRange(worksheet, range) {
|
|
8642
|
-
const { startRow, startColumn, endColumn, endRow } = range;
|
|
8643
|
-
const cellMatrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn);
|
|
8644
|
-
let someCellGoingToBeRemoved = false;
|
|
8645
|
-
cellMatrix.forValue((row, col, cellData) => {
|
|
8646
|
-
if (cellData && (row !== startRow || col !== startColumn) && worksheet.cellHasValue(cellData)) {
|
|
8647
|
-
someCellGoingToBeRemoved = true;
|
|
8648
|
-
return false;
|
|
8649
|
-
}
|
|
8650
|
-
});
|
|
8651
|
-
return someCellGoingToBeRemoved;
|
|
8652
|
-
}
|
|
8653
|
-
function getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton) {
|
|
8654
|
-
const activeViewport = scene.getActiveViewportByCoord(_univerjs_engine_render.Vector2.FromArray([offsetX, offsetY]));
|
|
8655
|
-
if (!activeViewport) return;
|
|
8656
|
-
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8657
|
-
const scrollXY = {
|
|
8658
|
-
x: activeViewport.viewportScrollX,
|
|
8659
|
-
y: activeViewport.viewportScrollY
|
|
8660
|
-
};
|
|
8661
|
-
const cellIndex = skeleton.getCellIndexByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
8662
|
-
const mergeCell = skeleton.worksheet.getMergedCell(cellIndex.row, cellIndex.column);
|
|
8663
|
-
return {
|
|
8664
|
-
actualRow: mergeCell ? mergeCell.startRow : cellIndex.row,
|
|
8665
|
-
actualCol: mergeCell ? mergeCell.startColumn : cellIndex.column,
|
|
8666
|
-
mergeCell,
|
|
8667
|
-
row: cellIndex.row,
|
|
8668
|
-
col: cellIndex.column
|
|
8669
|
-
};
|
|
8670
|
-
}
|
|
8671
|
-
function getViewportByCell(row, column, scene, worksheet) {
|
|
8672
|
-
const freeze = worksheet.getFreeze();
|
|
8673
|
-
if (!freeze || freeze.startRow <= 0 && freeze.startColumn <= 0) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
8674
|
-
if (row >= freeze.startRow && column >= freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
8675
|
-
if (row < freeze.startRow && column < freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP);
|
|
8676
|
-
if (row < freeze.startRow && column >= freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP);
|
|
8677
|
-
if (row >= freeze.startRow && column < freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT);
|
|
8678
|
-
}
|
|
8679
|
-
function transformBound2OffsetBound(originBound, scene, skeleton, worksheet) {
|
|
8680
|
-
const topLeft = transformPosition2Offset(originBound.left, originBound.top, scene, skeleton, worksheet);
|
|
8681
|
-
const bottomRight = transformPosition2Offset(originBound.right, originBound.bottom, scene, skeleton, worksheet);
|
|
8682
|
-
return {
|
|
8683
|
-
left: topLeft.x,
|
|
8684
|
-
top: topLeft.y,
|
|
8685
|
-
right: bottomRight.x,
|
|
8686
|
-
bottom: bottomRight.y
|
|
8687
|
-
};
|
|
8688
|
-
}
|
|
8689
|
-
function transformPosition2Offset(x, y, scene, skeleton, worksheet) {
|
|
8690
|
-
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8691
|
-
const viewMain = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
8692
|
-
if (!viewMain) return {
|
|
8693
|
-
x,
|
|
8694
|
-
y
|
|
8695
|
-
};
|
|
8696
|
-
const { startColumn, startRow, xSplit, ySplit } = worksheet.getFreeze();
|
|
8697
|
-
const startSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow - ySplit, startColumn - xSplit, false);
|
|
8698
|
-
const endSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow, startColumn, false);
|
|
8699
|
-
const { rowHeaderWidth, columnHeaderHeight } = skeleton;
|
|
8700
|
-
const freezeWidth = endSheetView.startX - startSheetView.startX;
|
|
8701
|
-
const freezeHeight = endSheetView.startY - startSheetView.startY;
|
|
8702
|
-
const { top, left, viewportScrollX, viewportScrollY } = viewMain;
|
|
8703
|
-
let offsetX;
|
|
8704
|
-
if (x > left) offsetX = (x - viewportScrollX) * scaleX;
|
|
8705
|
-
else offsetX = (freezeWidth + rowHeaderWidth - (left - x)) * scaleX;
|
|
8706
|
-
let offsetY;
|
|
8707
|
-
if (y > top) offsetY = (y - viewportScrollY) * scaleY;
|
|
8708
|
-
else offsetY = (freezeHeight + columnHeaderHeight - (top - y)) * scaleX;
|
|
8709
|
-
return {
|
|
8710
|
-
x: offsetX,
|
|
8711
|
-
y: offsetY
|
|
8712
|
-
};
|
|
8713
|
-
}
|
|
8714
|
-
function getCellRealRange(workbook, worksheet, skeleton, row, col) {
|
|
8715
|
-
let actualRow = row;
|
|
8716
|
-
let actualCol = col;
|
|
8717
|
-
skeleton.overflowCache.forValue((r, c, range) => {
|
|
8718
|
-
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
8719
|
-
actualCol = c;
|
|
8720
|
-
actualRow = r;
|
|
8721
|
-
}
|
|
8722
|
-
});
|
|
8723
|
-
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
8724
|
-
return {
|
|
8725
|
-
unitId: workbook.getUnitId(),
|
|
8726
|
-
subUnitId: worksheet.getSheetId(),
|
|
8727
|
-
workbook,
|
|
8728
|
-
worksheet,
|
|
8729
|
-
row: actualCell.actualRow,
|
|
8730
|
-
col: actualCell.actualColumn
|
|
8731
|
-
};
|
|
8732
|
-
}
|
|
8733
|
-
function getHoverCellPosition(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY) {
|
|
8734
|
-
const { scene } = currentRender;
|
|
8735
|
-
const unitId = workbook.getUnitId();
|
|
8736
|
-
const { skeleton, sheetId } = skeletonParam;
|
|
8737
|
-
const cellIndex = getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton);
|
|
8738
|
-
if (!cellIndex) return null;
|
|
8739
|
-
let { actualCol, actualRow } = cellIndex;
|
|
8740
|
-
const originLocation = {
|
|
8741
|
-
unitId,
|
|
8742
|
-
subUnitId: sheetId,
|
|
8743
|
-
workbook,
|
|
8744
|
-
worksheet,
|
|
8745
|
-
row: actualRow,
|
|
8746
|
-
col: actualCol
|
|
8747
|
-
};
|
|
8748
|
-
skeleton.overflowCache.forValue((r, c, range) => {
|
|
8749
|
-
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
8750
|
-
actualCol = c;
|
|
8751
|
-
actualRow = r;
|
|
8752
|
-
}
|
|
8753
|
-
});
|
|
8754
|
-
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
8755
|
-
const location = getCellRealRange(workbook, worksheet, skeleton, actualRow, actualCol);
|
|
8756
|
-
let anchorCell;
|
|
8757
|
-
if (actualCell.mergeInfo) anchorCell = actualCell.mergeInfo;
|
|
8758
|
-
else anchorCell = {
|
|
8759
|
-
startRow: location.row,
|
|
8760
|
-
endRow: location.row,
|
|
8761
|
-
startColumn: location.col,
|
|
8762
|
-
endColumn: location.col
|
|
8763
|
-
};
|
|
8764
|
-
const activeViewport = scene.getActiveViewportByCoord(_univerjs_engine_render.Vector2.FromArray([offsetX, offsetY]));
|
|
8765
|
-
if (!activeViewport) return;
|
|
8766
|
-
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8767
|
-
const scrollXY = {
|
|
8768
|
-
x: activeViewport.viewportScrollX,
|
|
8769
|
-
y: activeViewport.viewportScrollY
|
|
8770
|
-
};
|
|
8771
|
-
return {
|
|
8772
|
-
position: {
|
|
8773
|
-
startX: (skeleton.getOffsetByColumn(anchorCell.startColumn - 1) - scrollXY.x) * scaleX,
|
|
8774
|
-
endX: (skeleton.getOffsetByColumn(anchorCell.endColumn) - scrollXY.x) * scaleX,
|
|
8775
|
-
startY: (skeleton.getOffsetByRow(anchorCell.startRow - 1) - scrollXY.y) * scaleY,
|
|
8776
|
-
endY: (skeleton.getOffsetByRow(anchorCell.endRow) - scrollXY.y) * scaleY
|
|
8777
|
-
},
|
|
8778
|
-
location: originLocation,
|
|
8779
|
-
overflowLocation: location
|
|
8780
|
-
};
|
|
8781
|
-
}
|
|
8782
|
-
|
|
8783
8719
|
//#endregion
|
|
8784
8720
|
//#region src/consts/plugin-name.ts
|
|
8785
8721
|
/**
|
|
@@ -8859,10 +8795,7 @@ let SheetsRenderService = class SheetsRenderService extends _univerjs_core.RxDis
|
|
|
8859
8795
|
}
|
|
8860
8796
|
_initWorkbookListener() {
|
|
8861
8797
|
this._instanceSrv.getTypeOfUnitAdded$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe((event) => this._createRenderer(event.unit, event.options));
|
|
8862
|
-
this._instanceSrv.getAllUnitsForType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).forEach((workbook) =>
|
|
8863
|
-
var _this$_instanceSrv$ge;
|
|
8864
|
-
return this._createRenderer(workbook, (_this$_instanceSrv$ge = this._instanceSrv.getUnitCreateOptions(workbook.getUnitId())) !== null && _this$_instanceSrv$ge !== void 0 ? _this$_instanceSrv$ge : void 0);
|
|
8865
|
-
});
|
|
8798
|
+
this._instanceSrv.getAllUnitsForType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).forEach((workbook) => this._createRenderer(workbook, this._instanceSrv.getUnitCreateOptions(workbook.getUnitId()) ?? void 0));
|
|
8866
8799
|
this._instanceSrv.getTypeOfUnitDisposed$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe((workbook) => this._disposeRenderer(workbook));
|
|
8867
8800
|
}
|
|
8868
8801
|
_createRenderer(workbook, createUnitOptions) {
|
|
@@ -9131,7 +9064,7 @@ let AutoHeightController = class AutoHeightController extends _univerjs_core.Dis
|
|
|
9131
9064
|
subUnitId = worksheet.getSheetId();
|
|
9132
9065
|
}
|
|
9133
9066
|
}
|
|
9134
|
-
const skeleton = this._renderManagerService.
|
|
9067
|
+
const skeleton = this._renderManagerService.getRenderUnitById(unitId).with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
9135
9068
|
if (!skeleton) return {
|
|
9136
9069
|
redos: [],
|
|
9137
9070
|
undos: []
|
|
@@ -9166,7 +9099,7 @@ let AutoHeightController = class AutoHeightController extends _univerjs_core.Dis
|
|
|
9166
9099
|
_initialize() {
|
|
9167
9100
|
this.disposeWithMe(this._sheetInterceptorService.interceptAutoHeight({ getMutations: (info) => {
|
|
9168
9101
|
const { unitId, subUnitId, ranges, autoHeightRanges, lazyAutoHeightRanges, cellHeights } = info;
|
|
9169
|
-
const undoRedoItem = this.getUndoRedoParamsOfAutoHeight(autoHeightRanges
|
|
9102
|
+
const undoRedoItem = this.getUndoRedoParamsOfAutoHeight(autoHeightRanges ?? ranges, subUnitId, cellHeights);
|
|
9170
9103
|
return this._processLazyAutoHeight(undoRedoItem, unitId, subUnitId, lazyAutoHeightRanges);
|
|
9171
9104
|
} }));
|
|
9172
9105
|
}
|
|
@@ -9197,7 +9130,7 @@ let CellCustomRenderController = class CellCustomRenderController extends _unive
|
|
|
9197
9130
|
if (!skeletonParam) return;
|
|
9198
9131
|
const unitId = this._context.unitId;
|
|
9199
9132
|
const { skeleton } = skeletonParam;
|
|
9200
|
-
const currentRender = this._renderManagerService.
|
|
9133
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
9201
9134
|
if (currentRender && currentRender.mainComponent) {
|
|
9202
9135
|
const spreadsheet = currentRender.mainComponent;
|
|
9203
9136
|
const getActiveRender = (evt) => {
|
|
@@ -9232,7 +9165,7 @@ let CellCustomRenderController = class CellCustomRenderController extends _unive
|
|
|
9232
9165
|
const subUnitId = worksheet.getSheetId();
|
|
9233
9166
|
const info = {
|
|
9234
9167
|
data: cellData,
|
|
9235
|
-
style:
|
|
9168
|
+
style: worksheet.getComposedCellStyleByCellData(row, col, cellData),
|
|
9236
9169
|
primaryWithCoord: skeleton.getCellWithCoordByIndex(cellIndex.actualRow, cellIndex.actualCol),
|
|
9237
9170
|
unitId,
|
|
9238
9171
|
subUnitId,
|
|
@@ -9693,10 +9626,9 @@ SheetRenderController = __decorate([
|
|
|
9693
9626
|
__decorateParam(5, (0, _univerjs_core.Optional)(_univerjs_telemetry.ITelemetryService))
|
|
9694
9627
|
], SheetRenderController);
|
|
9695
9628
|
function getLeftTopPlaceholderSize(skeleton) {
|
|
9696
|
-
var _skeleton$rowHeaderWi, _skeleton$columnHeade;
|
|
9697
9629
|
return {
|
|
9698
|
-
width:
|
|
9699
|
-
height:
|
|
9630
|
+
width: skeleton.rowHeaderWidthAndMarginLeft ?? skeleton.rowHeaderWidth,
|
|
9631
|
+
height: skeleton.columnHeaderHeightAndMarginTop ?? skeleton.columnHeaderHeight
|
|
9700
9632
|
};
|
|
9701
9633
|
}
|
|
9702
9634
|
|
|
@@ -9717,7 +9649,7 @@ let SheetSkeletonRenderController = class SheetSkeletonRenderController extends
|
|
|
9717
9649
|
if (param == null) return;
|
|
9718
9650
|
const { unitId } = this._context;
|
|
9719
9651
|
const { skeleton } = param;
|
|
9720
|
-
const scene = (_this$_renderManagerS = this._renderManagerService.
|
|
9652
|
+
const scene = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.scene;
|
|
9721
9653
|
if (skeleton == null || scene == null) return;
|
|
9722
9654
|
const { rowTotalHeight, columnTotalWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
9723
9655
|
if (!this._context.unit.getActiveSheet()) return;
|
|
@@ -9775,7 +9707,9 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends _univerj
|
|
|
9775
9707
|
if (!loadingRender) return;
|
|
9776
9708
|
let shouldRender = false;
|
|
9777
9709
|
if (!loadingRender.render) {
|
|
9778
|
-
|
|
9710
|
+
const contentElement = this._layoutService.getContentElement();
|
|
9711
|
+
if (!contentElement) return;
|
|
9712
|
+
loadingRender.render = this._createLoadingRender(loadingRender.workbook, loadingRender.sourceUnitId, contentElement);
|
|
9779
9713
|
shouldRender = true;
|
|
9780
9714
|
}
|
|
9781
9715
|
const worksheet = loadingRender.workbook.getSheetBySheetId(activeSheetId);
|
|
@@ -9814,6 +9748,10 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends _univerj
|
|
|
9814
9748
|
async handoff(sourceUnitId, timeoutMs) {
|
|
9815
9749
|
var _this$_loadingRender2, _this$_finalCanvasGua;
|
|
9816
9750
|
if (((_this$_loadingRender2 = this._loadingRender) === null || _this$_loadingRender2 === void 0 ? void 0 : _this$_loadingRender2.sourceUnitId) !== sourceUnitId) return true;
|
|
9751
|
+
if (!this._loadingRender.render) {
|
|
9752
|
+
this.hide(sourceUnitId);
|
|
9753
|
+
return true;
|
|
9754
|
+
}
|
|
9817
9755
|
(_this$_finalCanvasGua = this._finalCanvasGuard) === null || _this$_finalCanvasGua === void 0 || _this$_finalCanvasGua.unsubscribe();
|
|
9818
9756
|
this._finalCanvasGuard = null;
|
|
9819
9757
|
try {
|
|
@@ -9849,9 +9787,8 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends _univerj
|
|
|
9849
9787
|
if (activeSheet) workbook.setActiveSheet(activeSheet);
|
|
9850
9788
|
return workbook;
|
|
9851
9789
|
}
|
|
9852
|
-
_createLoadingRender(workbook, sourceUnitId) {
|
|
9790
|
+
_createLoadingRender(workbook, sourceUnitId, contentElement) {
|
|
9853
9791
|
const previewUnitId = workbook.getUnitId();
|
|
9854
|
-
const contentElement = this._layoutService.getContentElement();
|
|
9855
9792
|
const { width, height } = contentElement.getBoundingClientRect();
|
|
9856
9793
|
const engine = this._injector.createInstance(_univerjs_engine_render.Engine, previewUnitId, void 0);
|
|
9857
9794
|
const scene = new _univerjs_engine_render.Scene(`${PREVIEW_SCENE_PREFIX}${previewUnitId}`, engine, {
|
|
@@ -9886,10 +9823,10 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends _univerj
|
|
|
9886
9823
|
_waitForFinalCanvas(render) {
|
|
9887
9824
|
return new rxjs.Observable((subscriber) => {
|
|
9888
9825
|
let frameId;
|
|
9889
|
-
const contentElement = this._layoutService.getContentElement();
|
|
9890
9826
|
const canvasElement = render.engine.getCanvasElement();
|
|
9891
9827
|
const checkMounted = () => {
|
|
9892
|
-
|
|
9828
|
+
const contentElement = this._layoutService.getContentElement();
|
|
9829
|
+
if (contentElement && canvasElement.parentElement === contentElement && canvasElement.width > 0 && canvasElement.height > 0) {
|
|
9893
9830
|
subscriber.next();
|
|
9894
9831
|
subscriber.complete();
|
|
9895
9832
|
return;
|
|
@@ -9903,7 +9840,7 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends _univerj
|
|
|
9903
9840
|
});
|
|
9904
9841
|
}
|
|
9905
9842
|
_getFinalRender$(sourceUnitId) {
|
|
9906
|
-
const existingRender = this._renderManagerService.
|
|
9843
|
+
const existingRender = this._renderManagerService.getRenderUnitById(sourceUnitId);
|
|
9907
9844
|
return existingRender ? (0, rxjs.of)(existingRender) : this._renderManagerService.created$.pipe((0, rxjs.filter)((render) => render.unitId === sourceUnitId));
|
|
9908
9845
|
}
|
|
9909
9846
|
_guardFinalCanvas(sourceUnitId) {
|
|
@@ -9970,29 +9907,22 @@ SheetLoadingRenderService = __decorate([
|
|
|
9970
9907
|
//#region src/views/hook.ts
|
|
9971
9908
|
const SheetLoadingWorkbookContext = (0, react.createContext)(null);
|
|
9972
9909
|
function useActiveWorkbook() {
|
|
9973
|
-
var _ref;
|
|
9974
9910
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
9975
9911
|
const loadingWorkbook = (0, react.useContext)(SheetLoadingWorkbookContext);
|
|
9976
9912
|
const workbook = (0, _univerjs_ui.useObservable)(() => univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), void 0, void 0, []);
|
|
9977
|
-
return
|
|
9913
|
+
return loadingWorkbook ?? workbook ?? null;
|
|
9978
9914
|
}
|
|
9979
9915
|
function useSheetLoadingWorkbook() {
|
|
9980
|
-
|
|
9981
|
-
return (_useObservable = (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(ISheetLoadingRenderService).workbook$)) !== null && _useObservable !== void 0 ? _useObservable : null;
|
|
9916
|
+
return (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(ISheetLoadingRenderService).workbook$) ?? null;
|
|
9982
9917
|
}
|
|
9983
9918
|
function useSheetLoading() {
|
|
9984
|
-
|
|
9985
|
-
return (_useObservable2 = (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(ISheetLoadingRenderService).loading$)) !== null && _useObservable2 !== void 0 ? _useObservable2 : false;
|
|
9919
|
+
return (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(ISheetLoadingRenderService).loading$) ?? false;
|
|
9986
9920
|
}
|
|
9987
9921
|
function useSheetLoadingPreviewReady() {
|
|
9988
|
-
|
|
9989
|
-
return (_useObservable3 = (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(ISheetLoadingRenderService).previewReady$)) !== null && _useObservable3 !== void 0 ? _useObservable3 : false;
|
|
9922
|
+
return (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(ISheetLoadingRenderService).previewReady$) ?? false;
|
|
9990
9923
|
}
|
|
9991
9924
|
function useActiveWorksheet(workbook) {
|
|
9992
|
-
return (0, _univerjs_ui.useObservable)(() =>
|
|
9993
|
-
var _workbook$activeSheet;
|
|
9994
|
-
return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : (0, rxjs.of)(null);
|
|
9995
|
-
}, void 0, void 0, [workbook]);
|
|
9925
|
+
return (0, _univerjs_ui.useObservable)(() => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? (0, rxjs.of)(null), void 0, void 0, [workbook]);
|
|
9996
9926
|
}
|
|
9997
9927
|
function useWorkbooks() {
|
|
9998
9928
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
@@ -10031,7 +9961,7 @@ const SheetPasteOptions = [
|
|
|
10031
9961
|
}
|
|
10032
9962
|
];
|
|
10033
9963
|
const useMenuPosition = (range) => {
|
|
10034
|
-
var _scene$getEngine
|
|
9964
|
+
var _scene$getEngine;
|
|
10035
9965
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
10036
9966
|
const renderManagerService = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService);
|
|
10037
9967
|
const workbook = useActiveWorkbook();
|
|
@@ -10043,24 +9973,24 @@ const useMenuPosition = (range) => {
|
|
|
10043
9973
|
endCol: range.cols[range.cols.length - 1]
|
|
10044
9974
|
};
|
|
10045
9975
|
if (anchor.endRow < 0 || anchor.endCol < 0) return null;
|
|
10046
|
-
const ru = renderManagerService.
|
|
9976
|
+
const ru = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
10047
9977
|
const sheetSkeletonManagerService = ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService);
|
|
10048
|
-
const selectionRenderService = ru === null || ru === void 0 ? void 0 : ru.with(ISheetSelectionRenderService);
|
|
10049
9978
|
const sheetObject = getSheetObject(univerInstanceService, renderManagerService);
|
|
10050
|
-
if (!sheetObject
|
|
9979
|
+
if (!sheetObject) return null;
|
|
10051
9980
|
const { scene } = sheetObject;
|
|
10052
9981
|
const skeleton = sheetSkeletonManagerService === null || sheetSkeletonManagerService === void 0 ? void 0 : sheetSkeletonManagerService.getCurrentSkeleton();
|
|
10053
|
-
const viewport =
|
|
9982
|
+
const viewport = getViewportByCell(anchor.endRow, anchor.endCol, scene, workbook.getActiveSheet());
|
|
9983
|
+
if (!viewport) return null;
|
|
10054
9984
|
const scaleX = scene === null || scene === void 0 ? void 0 : scene.scaleX;
|
|
10055
9985
|
const scaleY = scene === null || scene === void 0 ? void 0 : scene.scaleY;
|
|
10056
9986
|
const scrollXY = scene === null || scene === void 0 ? void 0 : scene.getViewportScrollXY(viewport);
|
|
10057
9987
|
const canvas = (_scene$getEngine = scene.getEngine()) === null || _scene$getEngine === void 0 ? void 0 : _scene$getEngine.getCanvas();
|
|
10058
9988
|
if (!scaleX || !scene || !scaleX || !scaleY || !scrollXY) return null;
|
|
10059
9989
|
const endPosition = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getNoMergeCellWithCoordByIndex(anchor.endRow, anchor.endCol);
|
|
10060
|
-
const endX = (
|
|
10061
|
-
const endY = (
|
|
10062
|
-
const positionEndX = (
|
|
10063
|
-
const positionEndY = (
|
|
9990
|
+
const endX = (endPosition === null || endPosition === void 0 ? void 0 : endPosition.endX) ?? 0;
|
|
9991
|
+
const endY = (endPosition === null || endPosition === void 0 ? void 0 : endPosition.endY) ?? 0;
|
|
9992
|
+
const positionEndX = (0, _univerjs_engine_render.convertTransformToOffsetX)(endX, scaleX, scrollXY) ?? -9999;
|
|
9993
|
+
const positionEndY = (0, _univerjs_engine_render.convertTransformToOffsetY)(endY, scaleY, scrollXY) ?? -9999;
|
|
10064
9994
|
const canvasWidth = canvas === null || canvas === void 0 ? void 0 : canvas.getWidth();
|
|
10065
9995
|
const canvasHeight = canvas === null || canvas === void 0 ? void 0 : canvas.getHeight();
|
|
10066
9996
|
if (!canvasWidth || !canvasHeight) return null;
|
|
@@ -10083,7 +10013,8 @@ const ClipboardPopupMenu = () => {
|
|
|
10083
10013
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
10084
10014
|
const [menuHovered, setMenuHovered] = (0, react.useState)(false);
|
|
10085
10015
|
const [visible, setVisible] = (0, react.useState)(false);
|
|
10086
|
-
const
|
|
10016
|
+
const range = pasteOptionsCache === null || pasteOptionsCache === void 0 ? void 0 : pasteOptionsCache.target.pastedRange;
|
|
10017
|
+
const relativePosition = useMenuPosition(range);
|
|
10087
10018
|
if (!relativePosition || !showMenu) return null;
|
|
10088
10019
|
if (relativePosition.positionX < 50 || relativePosition.positionY < 30) return null;
|
|
10089
10020
|
const showMore = menuHovered || visible;
|
|
@@ -10215,16 +10146,16 @@ const ISheetEmbedInteractionBoundaryService = (0, _univerjs_core.createIdentifie
|
|
|
10215
10146
|
const ISheetEmbedRuntimeFocusCoordinator = (0, _univerjs_core.createIdentifier)("sheets-ui.embed-runtime-focus-coordinator");
|
|
10216
10147
|
const ISheetEmbedFloatingGeometryService = (0, _univerjs_core.createIdentifier)("sheets-ui.embed-floating-geometry.service");
|
|
10217
10148
|
function resolveSheetEmbedRuntimeDomScope(element) {
|
|
10218
|
-
var _element$closest
|
|
10149
|
+
var _element$closest;
|
|
10219
10150
|
if (!element) return;
|
|
10220
|
-
const embedId = (
|
|
10151
|
+
const embedId = ((_element$closest = element.closest(`[${"data-embed-interaction-boundary-owner"}]`)) === null || _element$closest === void 0 ? void 0 : _element$closest.getAttribute("data-embed-interaction-boundary-owner")) ?? void 0;
|
|
10221
10152
|
const container = resolveSheetEmbedFloatDomContainer(element, embedId);
|
|
10222
|
-
const resolvedEmbedId = (
|
|
10153
|
+
const resolvedEmbedId = (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-id")) ?? embedId;
|
|
10223
10154
|
if (!resolvedEmbedId) return;
|
|
10224
10155
|
return {
|
|
10225
10156
|
embedId: resolvedEmbedId,
|
|
10226
|
-
hostUnitId: (
|
|
10227
|
-
childUnitId: (
|
|
10157
|
+
hostUnitId: (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-host-unit-id")) ?? void 0,
|
|
10158
|
+
childUnitId: (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-child-unit-id")) ?? void 0,
|
|
10228
10159
|
childType: readChildType(container)
|
|
10229
10160
|
};
|
|
10230
10161
|
}
|
|
@@ -10234,12 +10165,11 @@ function resolveActiveSheetEmbedRuntimeDomScope(ownerDocument = document) {
|
|
|
10234
10165
|
return resolveSheetEmbedRuntimeDomScope(activeContainer);
|
|
10235
10166
|
}
|
|
10236
10167
|
function resolveSheetEmbedFloatDomContainer(element, embedId) {
|
|
10237
|
-
var _element$ownerDocumen, _ownerDocument$queryS;
|
|
10238
10168
|
const ownContainer = element === null || element === void 0 ? void 0 : element.closest(`[${SHEET_EMBED_FLOAT_DOM_ATTRIBUTE}="true"]`);
|
|
10239
10169
|
if (ownContainer && (!embedId || ownContainer.getAttribute("data-embed-id") === embedId)) return ownContainer;
|
|
10240
|
-
const ownerDocument = (
|
|
10241
|
-
if (!ownerDocument || !embedId) return ownContainer
|
|
10242
|
-
return
|
|
10170
|
+
const ownerDocument = (element === null || element === void 0 ? void 0 : element.ownerDocument) ?? (typeof document === "undefined" ? void 0 : document);
|
|
10171
|
+
if (!ownerDocument || !embedId) return ownContainer ?? void 0;
|
|
10172
|
+
return ownerDocument.querySelector(`[${"data-embed-float-dom"}="true"][${"data-embed-id"}="${escapeAttributeValue(embedId)}"]`) ?? void 0;
|
|
10243
10173
|
}
|
|
10244
10174
|
function escapeAttributeValue(value) {
|
|
10245
10175
|
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
@@ -10269,15 +10199,14 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10269
10199
|
return (0, _univerjs_engine_render.getCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService);
|
|
10270
10200
|
}
|
|
10271
10201
|
get _editingUnitId() {
|
|
10272
|
-
var _this$_editorBridgeSe
|
|
10273
|
-
return (_this$_editorBridgeSe =
|
|
10202
|
+
var _this$_editorBridgeSe;
|
|
10203
|
+
return ((_this$_editorBridgeSe = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.unitId) ?? "";
|
|
10274
10204
|
}
|
|
10275
10205
|
get _editingRenderer() {
|
|
10276
|
-
return this._renderManagerService.
|
|
10206
|
+
return this._renderManagerService.getRenderUnitById(this._editingUnitId);
|
|
10277
10207
|
}
|
|
10278
10208
|
get _renderer() {
|
|
10279
|
-
|
|
10280
|
-
return (_this$_editingRendere = this._editingRenderer) !== null && _this$_editingRendere !== void 0 ? _this$_editingRendere : this._currentRenderer;
|
|
10209
|
+
return this._editingRenderer ?? this._currentRenderer;
|
|
10281
10210
|
}
|
|
10282
10211
|
get _sheetSkeletonManagerService() {
|
|
10283
10212
|
var _this$_renderer;
|
|
@@ -10288,7 +10217,6 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10288
10217
|
return (_this$_renderer2 = this._renderer) === null || _this$_renderer2 === void 0 ? void 0 : _this$_renderer2.engine;
|
|
10289
10218
|
}
|
|
10290
10219
|
fitTextSize(callback) {
|
|
10291
|
-
var _paddingData$l, _paddingData$r, _paddingData$t, _paddingData$b;
|
|
10292
10220
|
const param = this._editorBridgeService.getEditCellState();
|
|
10293
10221
|
if (!param) return;
|
|
10294
10222
|
const { position, documentLayoutObject, canvasOffset, scaleX, scaleY } = param;
|
|
@@ -10302,8 +10230,8 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10302
10230
|
if (!info || info.actualWidth <= 0) return;
|
|
10303
10231
|
let { actualWidth, actualHeight } = info;
|
|
10304
10232
|
const { verticalAlign, horizontalAlign, paddingData, fill } = documentLayoutObject;
|
|
10305
|
-
actualWidth = actualWidth + (
|
|
10306
|
-
actualHeight = actualHeight + (
|
|
10233
|
+
actualWidth = actualWidth + (paddingData.l ?? 0) * scaleX + (paddingData.r ?? 0) * scaleX;
|
|
10234
|
+
actualHeight = actualHeight + (paddingData.t ?? 0) * scaleY + (paddingData.b ?? 0) * scaleY;
|
|
10307
10235
|
let editorWidth = endX - startX;
|
|
10308
10236
|
let editorHeight = endY - startY;
|
|
10309
10237
|
if (editorWidth < actualWidth) editorWidth = Math.ceil(actualWidth);
|
|
@@ -10369,8 +10297,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10369
10297
|
_getEditorMaxSize(position, canvasOffset, horizontalAlign) {
|
|
10370
10298
|
if (this._getEditorObject() == null) return;
|
|
10371
10299
|
function pxToNum(size) {
|
|
10372
|
-
|
|
10373
|
-
return Number.parseFloat((_size$replace = size === null || size === void 0 ? void 0 : size.replace("px", "")) !== null && _size$replace !== void 0 ? _size$replace : "");
|
|
10300
|
+
return Number.parseFloat((size === null || size === void 0 ? void 0 : size.replace("px", "")) ?? "");
|
|
10374
10301
|
}
|
|
10375
10302
|
const engine = this.engine;
|
|
10376
10303
|
if (!engine) return;
|
|
@@ -10471,8 +10398,8 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10471
10398
|
});
|
|
10472
10399
|
}
|
|
10473
10400
|
_getEditorContentElement() {
|
|
10474
|
-
var _this$_embedFloatingG
|
|
10475
|
-
return (_this$_embedFloatingG =
|
|
10401
|
+
var _this$_embedFloatingG;
|
|
10402
|
+
return ((_this$_embedFloatingG = this._embedFloatingGeometryService) === null || _this$_embedFloatingG === void 0 || (_this$_embedFloatingG = _this$_embedFloatingG.getRegistrationByChildUnitId(this._editingUnitId)) === null || _this$_embedFloatingG === void 0 ? void 0 : _this$_embedFloatingG.contentRoot) ?? this._layoutService.getContentElement();
|
|
10476
10403
|
}
|
|
10477
10404
|
/**
|
|
10478
10405
|
* Since the document does not support cell background color, an additional rect needs to be added.
|
|
@@ -10527,7 +10454,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10527
10454
|
}
|
|
10528
10455
|
_getEditorSkeleton() {
|
|
10529
10456
|
var _this$_renderManagerS;
|
|
10530
|
-
return (_this$_renderManagerS = this._renderManagerService.
|
|
10457
|
+
return (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
10531
10458
|
}
|
|
10532
10459
|
};
|
|
10533
10460
|
SheetCellEditorResizeService = __decorate([
|
|
@@ -10625,7 +10552,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
10625
10552
|
var _this$_renderManagerS;
|
|
10626
10553
|
if (this._editorBridgeService.isVisible().visible) return;
|
|
10627
10554
|
const layout = this._editorBridgeService.getEditCellLayout();
|
|
10628
|
-
const docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.
|
|
10555
|
+
const docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
10629
10556
|
if (!layout || !docSelectionRenderService) return;
|
|
10630
10557
|
const { position, canvasOffset } = layout;
|
|
10631
10558
|
docSelectionRenderService.setInputPosition(canvasOffset.left + position.startX, canvasOffset.top + position.startY);
|
|
@@ -10687,7 +10614,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
10687
10614
|
d.add(disposable);
|
|
10688
10615
|
}
|
|
10689
10616
|
};
|
|
10690
|
-
const render = this._renderManagerService.
|
|
10617
|
+
const render = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
10691
10618
|
if (render) addEvent(render);
|
|
10692
10619
|
else this.disposeWithMe(this._renderManagerService.created$.pipe((0, rxjs.filter)((render) => render.unitId === _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)).subscribe((render) => {
|
|
10693
10620
|
disposable === null || disposable === void 0 || disposable.dispose();
|
|
@@ -10701,7 +10628,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
10701
10628
|
}));
|
|
10702
10629
|
}
|
|
10703
10630
|
_focusCellEditorInput() {
|
|
10704
|
-
const render = this._renderManagerService.
|
|
10631
|
+
const render = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
10705
10632
|
const docSelectionRenderService = render === null || render === void 0 ? void 0 : render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
10706
10633
|
if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
10707
10634
|
}
|
|
@@ -10719,10 +10646,9 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
10719
10646
|
}));
|
|
10720
10647
|
}
|
|
10721
10648
|
_showEditorByKeyboard(config) {
|
|
10722
|
-
var _ref, _config$content;
|
|
10723
10649
|
const event = config === null || config === void 0 ? void 0 : config.event;
|
|
10724
10650
|
if (config == null || !event.data && event.inputType !== "InsertParagraph") return;
|
|
10725
|
-
const initialValue =
|
|
10651
|
+
const initialValue = config.content ?? event.data ?? "";
|
|
10726
10652
|
this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
|
|
10727
10653
|
visible: true,
|
|
10728
10654
|
eventType: _univerjs_engine_render.DeviceInputEventType.Keyboard,
|
|
@@ -11499,7 +11425,7 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11499
11425
|
unitId: this._editingUnit
|
|
11500
11426
|
});
|
|
11501
11427
|
if (!unit) return;
|
|
11502
|
-
const editorBridgeRenderController = (_this$_renderManagerS = this._renderManagerService.
|
|
11428
|
+
const editorBridgeRenderController = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unit.getUnitId())) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(EditorBridgeRenderController);
|
|
11503
11429
|
if (editorBridgeRenderController) editorBridgeRenderController.refreshEditorPosition();
|
|
11504
11430
|
}
|
|
11505
11431
|
}));
|
|
@@ -11529,10 +11455,9 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11529
11455
|
_initialCursorSync(d) {
|
|
11530
11456
|
d.add(this._cellEditorManagerService.focus$.pipe((0, rxjs.filter)((f) => !!f)).subscribe(() => {
|
|
11531
11457
|
var _this$_univerInstance, _this$_renderManagerS2;
|
|
11532
|
-
const
|
|
11533
|
-
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();
|
|
11458
|
+
const docUnitId = (this._contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR) ? _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY : this._editorBridgeService.getCurrentEditorId()) ?? ((_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId());
|
|
11534
11459
|
if (!docUnitId) return;
|
|
11535
|
-
const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.
|
|
11460
|
+
const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(docUnitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
11536
11461
|
if (!docSelectionRenderManager) return;
|
|
11537
11462
|
docSelectionRenderManager.sync();
|
|
11538
11463
|
}));
|
|
@@ -11596,7 +11521,6 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11596
11521
|
unitId: editorUnitId,
|
|
11597
11522
|
snapshot: documentModel.getSnapshot()
|
|
11598
11523
|
});
|
|
11599
|
-
this._contextService.setContextValue(_univerjs_core.FOCUSING_EDITOR_BUT_HIDDEN, true);
|
|
11600
11524
|
this._textSelectionManagerService.replaceDocRanges([{
|
|
11601
11525
|
startOffset: 0,
|
|
11602
11526
|
endOffset: 0
|
|
@@ -11604,8 +11528,8 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11604
11528
|
unitId: _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
11605
11529
|
subUnitId: _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY
|
|
11606
11530
|
});
|
|
11607
|
-
const cellSelectionRenderManager = (_this$_renderManagerS3 = this._renderManagerService.
|
|
11608
|
-
const formulaSelectionRenderManager = (_this$_renderManagerS4 = this._renderManagerService.
|
|
11531
|
+
const cellSelectionRenderManager = (_this$_renderManagerS3 = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
11532
|
+
const formulaSelectionRenderManager = (_this$_renderManagerS4 = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS4 === void 0 ? void 0 : _this$_renderManagerS4.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
11609
11533
|
if ((cellSelectionRenderManager === null || cellSelectionRenderManager === void 0 ? void 0 : cellSelectionRenderManager.canFocusing) || (formulaSelectionRenderManager === null || formulaSelectionRenderManager === void 0 ? void 0 : formulaSelectionRenderManager.canFocusing)) {
|
|
11610
11534
|
this._univerInstanceService.setCurrentUnitForType(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
11611
11535
|
cellSelectionRenderManager === null || cellSelectionRenderManager === void 0 || cellSelectionRenderManager.activate(HIDDEN_EDITOR_POSITION$1, HIDDEN_EDITOR_POSITION$1, true);
|
|
@@ -11693,17 +11617,17 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11693
11617
|
subUnitId: _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY
|
|
11694
11618
|
});
|
|
11695
11619
|
};
|
|
11696
|
-
const
|
|
11697
|
-
this._submitEmptyCellImageEdit =
|
|
11698
|
-
if (
|
|
11620
|
+
const cellImage = (0, _univerjs_sheets.isCellImage)(documentDataModel.getSnapshot());
|
|
11621
|
+
this._submitEmptyCellImageEdit = cellImage && eventType === _univerjs_engine_render.DeviceInputEventType.Keyboard && keycode === _univerjs_ui.KeyCode.BACKSPACE;
|
|
11622
|
+
if (cellImage) clearAndEdit();
|
|
11699
11623
|
else if (eventType === _univerjs_engine_render.DeviceInputEventType.Keyboard && keycode === _univerjs_ui.KeyCode.F2) {
|
|
11700
|
-
var _documentDataModel$ge
|
|
11624
|
+
var _documentDataModel$ge;
|
|
11701
11625
|
document.makeDirty();
|
|
11702
11626
|
this._textSelectionManagerService.replaceDocRanges([{
|
|
11703
11627
|
startOffset: 0,
|
|
11704
11628
|
endOffset: 0
|
|
11705
11629
|
}]);
|
|
11706
|
-
const endOffset = ((_documentDataModel$ge =
|
|
11630
|
+
const endOffset = (((_documentDataModel$ge = documentDataModel.getBody()) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.dataStream.length) ?? 2) - 2;
|
|
11707
11631
|
this._textSelectionManagerService.replaceDocRanges([{
|
|
11708
11632
|
startOffset: endOffset,
|
|
11709
11633
|
endOffset
|
|
@@ -11720,7 +11644,7 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11720
11644
|
endOffset: cursor
|
|
11721
11645
|
}]);
|
|
11722
11646
|
}
|
|
11723
|
-
(_this$_renderManagerS5 = this._renderManagerService.
|
|
11647
|
+
(_this$_renderManagerS5 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS5 === void 0 || _this$_renderManagerS5.scene.resetCursor();
|
|
11724
11648
|
}
|
|
11725
11649
|
_refreshCurrentSelections(sheetId) {
|
|
11726
11650
|
const selections = this._workbookSelections.getSelectionsOfWorksheet(sheetId);
|
|
@@ -11734,7 +11658,7 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11734
11658
|
}
|
|
11735
11659
|
}
|
|
11736
11660
|
async _handleEditorInvisible(param) {
|
|
11737
|
-
var
|
|
11661
|
+
var _snapshot$body;
|
|
11738
11662
|
const editCellState = this._editorBridgeService.getEditCellState();
|
|
11739
11663
|
const documentDataModel = this._univerInstanceService.getUnit(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
11740
11664
|
const snapshot = _univerjs_core.Tools.deepClone(documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getSnapshot());
|
|
@@ -11742,7 +11666,7 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11742
11666
|
const shouldSubmitEmptyCellImageEdit = this._submitEmptyCellImageEdit;
|
|
11743
11667
|
this._submitEmptyCellImageEdit = false;
|
|
11744
11668
|
this._cursorChange = 0;
|
|
11745
|
-
const currentUnitId = (
|
|
11669
|
+
const currentUnitId = (editCellState === null || editCellState === void 0 ? void 0 : editCellState.unitId) ?? "";
|
|
11746
11670
|
this._exitInput(param);
|
|
11747
11671
|
if (editCellState == null) return;
|
|
11748
11672
|
const workbook = this._univerInstanceService.getUnit(currentUnitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
@@ -11764,10 +11688,10 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11764
11688
|
return;
|
|
11765
11689
|
}
|
|
11766
11690
|
const isEmpty = (snapshot === null || snapshot === void 0 || (_snapshot$body = snapshot.body) === null || _snapshot$body === void 0 ? void 0 : _snapshot$body.dataStream.length) === 2;
|
|
11767
|
-
const
|
|
11691
|
+
const cellImage = editCellState.documentLayoutObject.documentModel ? (0, _univerjs_sheets.isCellImage)(editCellState.documentLayoutObject.documentModel.getSnapshot()) : false;
|
|
11768
11692
|
if (snapshot && shouldSubmitCellEdit({
|
|
11769
11693
|
isEmpty,
|
|
11770
|
-
isCellImage,
|
|
11694
|
+
isCellImage: cellImage,
|
|
11771
11695
|
shouldSubmitEmptyCellImageEdit
|
|
11772
11696
|
})) {
|
|
11773
11697
|
if (await this._submitEdit(snapshot, keycode === (_univerjs_ui.MetaKeys.CTRL_COMMAND | _univerjs_ui.KeyCode.ENTER) || keycode === (_univerjs_ui.MetaKeys.MAC_CTRL | _univerjs_ui.KeyCode.ENTER)) === false) return;
|
|
@@ -11777,10 +11701,6 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11777
11701
|
_getEditorObject() {
|
|
11778
11702
|
return getEditorObject(this._editorBridgeService.getCurrentEditorId(), this._renderManagerService);
|
|
11779
11703
|
}
|
|
11780
|
-
_isCellImageData(snapshot) {
|
|
11781
|
-
var _snapshot$drawingsOrd, _snapshot$drawingsOrd2;
|
|
11782
|
-
return ((_snapshot$drawingsOrd = (_snapshot$drawingsOrd2 = snapshot.drawingsOrder) === null || _snapshot$drawingsOrd2 === void 0 ? void 0 : _snapshot$drawingsOrd2.length) !== null && _snapshot$drawingsOrd !== void 0 ? _snapshot$drawingsOrd : 0) > 0;
|
|
11783
|
-
}
|
|
11784
11704
|
submitCellData(documentDataModel) {
|
|
11785
11705
|
return this._submitEdit(documentDataModel.getSnapshot());
|
|
11786
11706
|
}
|
|
@@ -11833,7 +11753,6 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11833
11753
|
var _editorObject$scene$g;
|
|
11834
11754
|
this._contextService.setContextValue(_univerjs_core.FOCUSING_EDITOR_INPUT_FORMULA, false);
|
|
11835
11755
|
this._contextService.setContextValue(_univerjs_core.EDITOR_ACTIVATED, false);
|
|
11836
|
-
this._contextService.setContextValue(_univerjs_core.FOCUSING_EDITOR_BUT_HIDDEN, false);
|
|
11837
11756
|
this._contextService.setContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR, false);
|
|
11838
11757
|
this._cellEditorManagerService.setState({ show: param.visible });
|
|
11839
11758
|
const formulaBarEditor = this._editorService.getEditor(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
@@ -11912,11 +11831,11 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11912
11831
|
}
|
|
11913
11832
|
_getEditorSkeleton(editorId) {
|
|
11914
11833
|
var _this$_renderManagerS6;
|
|
11915
|
-
return (_this$_renderManagerS6 = this._renderManagerService.
|
|
11834
|
+
return (_this$_renderManagerS6 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS6 === void 0 ? void 0 : _this$_renderManagerS6.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
11916
11835
|
}
|
|
11917
11836
|
_getEditorViewModel(editorId) {
|
|
11918
11837
|
var _this$_renderManagerS7;
|
|
11919
|
-
return (_this$_renderManagerS7 = this._renderManagerService.
|
|
11838
|
+
return (_this$_renderManagerS7 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS7 === void 0 ? void 0 : _this$_renderManagerS7.with(_univerjs_docs.DocSkeletonManagerService).getViewModel();
|
|
11920
11839
|
}
|
|
11921
11840
|
_getEditingUnit() {
|
|
11922
11841
|
return this._editingUnit ? this._univerInstanceService.getUnit(this._editingUnit, _univerjs_core.UniverInstanceType.UNIVER_SHEET) : null;
|
|
@@ -11958,7 +11877,7 @@ EditingRenderController = __decorate([
|
|
|
11958
11877
|
__decorateParam(15, _univerjs_core.IConfigService)
|
|
11959
11878
|
], EditingRenderController);
|
|
11960
11879
|
function getCellDataByInput(cellData, snapshot, lexerTreeBuilder, localeService, functionService, styles) {
|
|
11961
|
-
var
|
|
11880
|
+
var _styles$get;
|
|
11962
11881
|
if ((snapshot === null || snapshot === void 0 ? void 0 : snapshot.body) == null) return null;
|
|
11963
11882
|
const { body } = snapshot;
|
|
11964
11883
|
cellData.t = void 0;
|
|
@@ -11966,7 +11885,7 @@ function getCellDataByInput(cellData, snapshot, lexerTreeBuilder, localeService,
|
|
|
11966
11885
|
let newDataStream = data.substring(data.length - 2, data.length) === _univerjs_core.DEFAULT_EMPTY_DOCUMENT_VALUE ? data.substring(0, data.length - 2) : data;
|
|
11967
11886
|
const currentLocale = localeService.getCurrentLocale();
|
|
11968
11887
|
newDataStream = normalizeString(newDataStream, lexerTreeBuilder, currentLocale, functionService);
|
|
11969
|
-
if ((
|
|
11888
|
+
if ((0, _univerjs_sheets.isCellImage)(snapshot)) {
|
|
11970
11889
|
cellData.v = "";
|
|
11971
11890
|
cellData.f = null;
|
|
11972
11891
|
cellData.si = null;
|
|
@@ -12022,10 +11941,9 @@ function isRichText(body) {
|
|
|
12022
11941
|
const bodyNoLineBreak = body.dataStream.replace(/(\r\n)+$/, "");
|
|
12023
11942
|
const richTextStyle = ["va"];
|
|
12024
11943
|
return textRuns.filter((ts) => ts.st < bodyNoLineBreak.length).some((textRun) => {
|
|
12025
|
-
var _textRun$ts;
|
|
12026
11944
|
return Boolean(textRun.ts && Object.keys(textRun.ts).some((property) => {
|
|
12027
11945
|
return richTextStyle.includes(property);
|
|
12028
|
-
})) || Object.keys(
|
|
11946
|
+
})) || Object.keys(textRun.ts ?? {}).length && textRun.ed - textRun.st < bodyNoLineBreak.length;
|
|
12029
11947
|
}) || paragraphs.some((paragraph) => paragraph.bullet) || paragraphs.length >= 2 || Boolean(customRanges === null || customRanges === void 0 ? void 0 : customRanges.length) || customBlocks.length > 0;
|
|
12030
11948
|
}
|
|
12031
11949
|
function shouldSubmitCellEdit({ isEmpty, isCellImage, shouldSubmitEmptyCellImageEdit }) {
|
|
@@ -12154,9 +12072,9 @@ function getSetCellDataMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12154
12072
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
12155
12073
|
const cellValueMatrix = new _univerjs_core.ObjectMatrix();
|
|
12156
12074
|
matrix.forValue((rowIndex, columnIndex, value) => {
|
|
12157
|
-
var _value$
|
|
12075
|
+
var _value$p, _newStyle$n;
|
|
12158
12076
|
const { row, col } = mapFunc(rowIndex, columnIndex);
|
|
12159
|
-
const newStyle = { ...
|
|
12077
|
+
const newStyle = { ...value.s ?? {} };
|
|
12160
12078
|
if (newStyle.bd && Object.keys(newStyle.bd).length === 0) newStyle.bd = {
|
|
12161
12079
|
t: null,
|
|
12162
12080
|
r: null,
|
|
@@ -12217,7 +12135,7 @@ function getSetCellValueMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12217
12135
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
12218
12136
|
const cellValueMatrix = new _univerjs_core.ObjectMatrix();
|
|
12219
12137
|
matrix.forValue((rowIndex, columnIndex, value) => {
|
|
12220
|
-
var _value$p2, _value$
|
|
12138
|
+
var _value$p2, _value$s;
|
|
12221
12139
|
const { row, col } = mapFunc(rowIndex, columnIndex);
|
|
12222
12140
|
let cellValue = {
|
|
12223
12141
|
p: null,
|
|
@@ -12228,7 +12146,7 @@ function getSetCellValueMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12228
12146
|
p: value.p,
|
|
12229
12147
|
v: value.v
|
|
12230
12148
|
};
|
|
12231
|
-
else if (value.v && !pasteFrom && !((_value$
|
|
12149
|
+
else if (value.v && !pasteFrom && !((_value$s = value.s) === null || _value$s === void 0 || (_value$s = _value$s.n) === null || _value$s === void 0 ? void 0 : _value$s.pattern)) {
|
|
12232
12150
|
/**
|
|
12233
12151
|
* The `pasteFrom` is null, means the data is pasted from outside.
|
|
12234
12152
|
* If the value's style has no number format, handle it as follows:
|
|
@@ -12270,9 +12188,9 @@ function getSetCellStyleMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12270
12188
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
12271
12189
|
const cellValueMatrix = new _univerjs_core.ObjectMatrix();
|
|
12272
12190
|
matrix.forValue((rowIndex, columnIndex, value) => {
|
|
12273
|
-
var
|
|
12191
|
+
var _newStyle$n2;
|
|
12274
12192
|
const { row, col } = mapFunc(rowIndex, columnIndex);
|
|
12275
|
-
const newStyle = { ...
|
|
12193
|
+
const newStyle = { ...value.s ?? {} };
|
|
12276
12194
|
if (newStyle.bd && Object.keys(newStyle.bd).length === 0) newStyle.bd = {
|
|
12277
12195
|
t: null,
|
|
12278
12196
|
r: null,
|
|
@@ -12487,12 +12405,12 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
|
|
|
12487
12405
|
if (event.event.key === "Escape") this._sheetClipboardService.removeMarkSelection();
|
|
12488
12406
|
});
|
|
12489
12407
|
};
|
|
12490
|
-
let docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.
|
|
12408
|
+
let docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
12491
12409
|
if (docSelectionRenderService) sheetPasteShortKeyFn(docSelectionRenderService);
|
|
12492
12410
|
this._renderManagerService.created$.subscribe((renderer) => {
|
|
12493
12411
|
if (renderer.unitId === _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {
|
|
12494
12412
|
var _this$_renderManagerS2;
|
|
12495
|
-
docSelectionRenderService = (_this$_renderManagerS2 = this._renderManagerService.
|
|
12413
|
+
docSelectionRenderService = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
12496
12414
|
if (docSelectionRenderService) sheetPasteShortKeyFn(docSelectionRenderService);
|
|
12497
12415
|
}
|
|
12498
12416
|
});
|
|
@@ -12717,11 +12635,9 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
|
|
|
12717
12635
|
};
|
|
12718
12636
|
}
|
|
12719
12637
|
_generateDocumentDataModelSnapshot(snapshot) {
|
|
12720
|
-
var _withCurrentTypeOfRen
|
|
12721
|
-
|
|
12722
|
-
|
|
12723
|
-
const { skeleton } = currentSkeleton;
|
|
12724
|
-
const documentModel = (_skeleton$getBlankCel = skeleton.getBlankCellDocumentModel()) === null || _skeleton$getBlankCel === void 0 ? void 0 : _skeleton$getBlankCel.documentModel;
|
|
12638
|
+
var _withCurrentTypeOfRen;
|
|
12639
|
+
if (((_withCurrentTypeOfRen = (0, _univerjs_engine_render.withCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_SHEET, SheetSkeletonManagerService, this._instanceService, this._renderManagerService)) === null || _withCurrentTypeOfRen === void 0 ? void 0 : _withCurrentTypeOfRen.getCurrentParam()) == null) return null;
|
|
12640
|
+
const documentModel = (0, _univerjs_core.createDocumentModelWithStyle)("", {});
|
|
12725
12641
|
const documentData = {
|
|
12726
12642
|
...documentModel === null || documentModel === void 0 ? void 0 : documentModel.getSnapshot(),
|
|
12727
12643
|
...snapshot
|
|
@@ -12826,7 +12742,6 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
|
|
|
12826
12742
|
};
|
|
12827
12743
|
},
|
|
12828
12744
|
onPasteColumns(pasteTo, colProperties, payload) {
|
|
12829
|
-
var _self$_configService$;
|
|
12830
12745
|
const redos = [];
|
|
12831
12746
|
const undos = [];
|
|
12832
12747
|
if (payload.pasteType !== PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_COL_WIDTH) return {
|
|
@@ -12840,7 +12755,7 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
|
|
|
12840
12755
|
undos
|
|
12841
12756
|
};
|
|
12842
12757
|
const worksheet = self._getWorksheet(unitId, subUnitId);
|
|
12843
|
-
const defaultColumnWidth =
|
|
12758
|
+
const defaultColumnWidth = self._configService.getConfig(_univerjs_core.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY) ?? _univerjs_core.DEFAULT_WORKSHEET_COLUMN_WIDTH;
|
|
12844
12759
|
const pasteRangeStartRow = rows[0];
|
|
12845
12760
|
const pasteRangeEndRow = rows[rows.length - 1];
|
|
12846
12761
|
const pasteRangeStartColumn = cols[0];
|
|
@@ -12901,7 +12816,7 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
|
|
|
12901
12816
|
const setValuesMutation = {
|
|
12902
12817
|
unitId,
|
|
12903
12818
|
subUnitId,
|
|
12904
|
-
cellValue: valueMatrix.
|
|
12819
|
+
cellValue: valueMatrix.clone()
|
|
12905
12820
|
};
|
|
12906
12821
|
redoMutationsInfo.push({
|
|
12907
12822
|
id: _univerjs_sheets.SetRangeValuesMutation.id,
|
|
@@ -12927,7 +12842,7 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
|
|
|
12927
12842
|
}
|
|
12928
12843
|
_getWorksheet(unitId, subUnitId) {
|
|
12929
12844
|
var _this$_instanceServic;
|
|
12930
|
-
const worksheet = (_this$_instanceServic = this._instanceService.
|
|
12845
|
+
const worksheet = (_this$_instanceServic = this._instanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_instanceServic === void 0 ? void 0 : _this$_instanceServic.getSheetBySheetId(subUnitId);
|
|
12931
12846
|
if (!worksheet) throw new Error(`[SheetClipboardController]: cannot find a worksheet with unitId ${unitId} and subUnitId ${subUnitId}.`);
|
|
12932
12847
|
return worksheet;
|
|
12933
12848
|
}
|
|
@@ -13006,7 +12921,7 @@ let DragManagerService = class DragManagerService extends _univerjs_core.Disposa
|
|
|
13006
12921
|
if (!workbook) return null;
|
|
13007
12922
|
const worksheet = workbook.getActiveSheet();
|
|
13008
12923
|
if (!worksheet) return;
|
|
13009
|
-
const currentRender = this._renderManagerService.
|
|
12924
|
+
const currentRender = this._renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
13010
12925
|
if (!currentRender) return;
|
|
13011
12926
|
const skeletonParam = currentRender.with(SheetSkeletonManagerService).getCurrentParam();
|
|
13012
12927
|
const scrollInfo = currentRender.with(SheetScrollManagerService).getCurrentScrollState();
|
|
@@ -13179,7 +13094,7 @@ let FormulaEditorController = class FormulaEditorController extends _univerjs_co
|
|
|
13179
13094
|
}
|
|
13180
13095
|
_create(unitId) {
|
|
13181
13096
|
if (unitId !== _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) return;
|
|
13182
|
-
const formulaEditorDocObject = this._renderManagerService.
|
|
13097
|
+
const formulaEditorDocObject = this._renderManagerService.getRenderUnitById(unitId);
|
|
13183
13098
|
if (formulaEditorDocObject == null) return;
|
|
13184
13099
|
const { mainComponent: documentComponent } = formulaEditorDocObject;
|
|
13185
13100
|
if (documentComponent == null) return;
|
|
@@ -13187,7 +13102,7 @@ let FormulaEditorController = class FormulaEditorController extends _univerjs_co
|
|
|
13187
13102
|
}
|
|
13188
13103
|
_listenFxBtnClick() {
|
|
13189
13104
|
this._formulaEditorManagerService.fxBtnClick$.pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe(() => {
|
|
13190
|
-
if (this._contextService.getContextValue(_univerjs_core.
|
|
13105
|
+
if (this._contextService.getContextValue(_univerjs_core.FOCUSING_UNIVER_EDITOR) && !this._contextService.getContextValue(_univerjs_core.EDITOR_ACTIVATED)) {
|
|
13191
13106
|
var _formulaEditorDataMod;
|
|
13192
13107
|
this._univerInstanceService.setCurrentUnitForType(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
13193
13108
|
const formulaEditorDataModel = this._univerInstanceService.getUnit(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
@@ -13247,8 +13162,8 @@ let FormulaEditorController = class FormulaEditorController extends _univerjs_co
|
|
|
13247
13162
|
autoScroll() {
|
|
13248
13163
|
var _this$_renderManagerS;
|
|
13249
13164
|
const position = this._formulaEditorManagerService.getPosition();
|
|
13250
|
-
const skeleton = (_this$_renderManagerS = this._renderManagerService.
|
|
13251
|
-
const editorObject = this._renderManagerService.
|
|
13165
|
+
const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
13166
|
+
const editorObject = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
13252
13167
|
const formulaEditorDataModel = this._univerInstanceService.getUnit(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
13253
13168
|
if (skeleton == null || position == null || editorObject == null || formulaEditorDataModel == null) return;
|
|
13254
13169
|
const { marginTop = 0, marginBottom = 0 } = formulaEditorDataModel.getSnapshot().documentStyle;
|
|
@@ -13321,8 +13236,8 @@ const calcDocRangePositions = (range, skeleton) => {
|
|
|
13321
13236
|
const skeletonData = skeleton.getSkeletonData();
|
|
13322
13237
|
let end = range.endOffset;
|
|
13323
13238
|
if (range.segmentId) {
|
|
13324
|
-
var
|
|
13325
|
-
const root =
|
|
13239
|
+
var _skeletonData$skeFoot, _skeletonData$skeHead;
|
|
13240
|
+
const root = Array.from((skeletonData === null || skeletonData === void 0 || (_skeletonData$skeFoot = skeletonData.skeFooters.get(range.segmentId)) === null || _skeletonData$skeFoot === void 0 ? void 0 : _skeletonData$skeFoot.values()) ?? [])[0] ?? Array.from((skeletonData === null || skeletonData === void 0 || (_skeletonData$skeHead = skeletonData.skeHeaders.get(range.segmentId)) === null || _skeletonData$skeHead === void 0 ? void 0 : _skeletonData$skeHead.values()) ?? [])[0];
|
|
13326
13241
|
if (root) end = Math.min(root.ed, end);
|
|
13327
13242
|
}
|
|
13328
13243
|
const endPosition = skeleton.findNodePositionByCharIndex(end, true, range.segmentId, pageIndex);
|
|
@@ -13403,13 +13318,13 @@ const calcBulletPosition = (skeleton, paragraph, paddingLeft = 0, paddingTop = 0
|
|
|
13403
13318
|
};
|
|
13404
13319
|
};
|
|
13405
13320
|
const calculateDocSkeletonRects = (docSkeleton, paddingLeft = 0, paddingTop = 0) => {
|
|
13406
|
-
var _docModel$getBody
|
|
13321
|
+
var _docModel$getBody, _docModel$getBody2, _docSkeleton$getSkele;
|
|
13407
13322
|
const docModel = docSkeleton.getViewModel().getDataModel();
|
|
13408
|
-
const hyperLinks = (
|
|
13409
|
-
const checkLists = (
|
|
13323
|
+
const hyperLinks = ((_docModel$getBody = docModel.getBody()) === null || _docModel$getBody === void 0 || (_docModel$getBody = _docModel$getBody.customRanges) === null || _docModel$getBody === void 0 ? void 0 : _docModel$getBody.filter((range) => range.rangeType === _univerjs_core.CustomRangeType.HYPERLINK)) ?? [];
|
|
13324
|
+
const checkLists = ((_docModel$getBody2 = docModel.getBody()) === null || _docModel$getBody2 === void 0 || (_docModel$getBody2 = _docModel$getBody2.paragraphs) === null || _docModel$getBody2 === void 0 ? void 0 : _docModel$getBody2.filter((p) => {
|
|
13410
13325
|
var _p$bullet;
|
|
13411
13326
|
return ((_p$bullet = p.bullet) === null || _p$bullet === void 0 ? void 0 : _p$bullet.listType.indexOf(_univerjs_core.PresetListType.CHECK_LIST)) === 0;
|
|
13412
|
-
}))
|
|
13327
|
+
})) ?? [];
|
|
13413
13328
|
const drawings = (_docSkeleton$getSkele = docSkeleton.getSkeletonData()) === null || _docSkeleton$getSkele === void 0 ? void 0 : _docSkeleton$getSkele.pages[0].skeDrawings;
|
|
13414
13329
|
return {
|
|
13415
13330
|
links: hyperLinks.map((link) => calcLinkPosition(docSkeleton, link, paddingLeft, paddingTop)).filter(Boolean),
|
|
@@ -13427,9 +13342,9 @@ const calculateDocSkeletonRects = (docSkeleton, paddingLeft = 0, paddingTop = 0)
|
|
|
13427
13342
|
};
|
|
13428
13343
|
};
|
|
13429
13344
|
function calcPadding(cell, font, isNum) {
|
|
13430
|
-
var _font$documentSkeleto, _font$documentSkeleto2
|
|
13431
|
-
const height = (_font$documentSkeleto =
|
|
13432
|
-
const width = (
|
|
13345
|
+
var _font$documentSkeleto, _font$documentSkeleto2;
|
|
13346
|
+
const height = ((_font$documentSkeleto = font.documentSkeleton) === null || _font$documentSkeleto === void 0 || (_font$documentSkeleto = _font$documentSkeleto.getSkeletonData()) === null || _font$documentSkeleto === void 0 ? void 0 : _font$documentSkeleto.pages[0].height) ?? 0;
|
|
13347
|
+
const width = ((_font$documentSkeleto2 = font.documentSkeleton) === null || _font$documentSkeleto2 === void 0 || (_font$documentSkeleto2 = _font$documentSkeleto2.getSkeletonData()) === null || _font$documentSkeleto2 === void 0 ? void 0 : _font$documentSkeleto2.pages[0].width) ?? 0;
|
|
13433
13348
|
const vt = font.verticalAlign;
|
|
13434
13349
|
const ht = font.horizontalAlign;
|
|
13435
13350
|
let paddingTop = 0;
|
|
@@ -13462,14 +13377,14 @@ function calcPadding(cell, font, isNum) {
|
|
|
13462
13377
|
};
|
|
13463
13378
|
}
|
|
13464
13379
|
const getCustomRangePosition = (injector, unitId, subUnitId, row, col, rangeId) => {
|
|
13465
|
-
var _docSkeleton$getViewM
|
|
13380
|
+
var _docSkeleton$getViewM;
|
|
13466
13381
|
const univerInstanceService = injector.get(_univerjs_core.IUniverInstanceService);
|
|
13467
13382
|
const renderManagerService = injector.get(_univerjs_engine_render.IRenderManagerService);
|
|
13468
13383
|
const workbook = univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
13469
13384
|
if (!workbook) return null;
|
|
13470
13385
|
const worksheet = workbook.getSheetBySheetId(subUnitId);
|
|
13471
13386
|
if (!worksheet) return null;
|
|
13472
|
-
const currentRender = renderManagerService.
|
|
13387
|
+
const currentRender = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
13473
13388
|
const skeletonParam = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(SheetSkeletonManagerService).getSkeletonParam(worksheet.getSheetId());
|
|
13474
13389
|
const skeleton = skeletonParam === null || skeletonParam === void 0 ? void 0 : skeletonParam.skeleton;
|
|
13475
13390
|
if (!skeleton || !currentRender) return;
|
|
@@ -13488,7 +13403,7 @@ const getCustomRangePosition = (injector, unitId, subUnitId, row, col, rangeId)
|
|
|
13488
13403
|
});
|
|
13489
13404
|
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualColumn);
|
|
13490
13405
|
const cellData = worksheet.getCell(actualCell.actualRow, actualCell.actualColumn);
|
|
13491
|
-
const { topOffset = 0, leftOffset = 0 } = (
|
|
13406
|
+
const { topOffset = 0, leftOffset = 0 } = (cellData === null || cellData === void 0 ? void 0 : cellData.fontRenderExtension) ?? {};
|
|
13492
13407
|
const { paddingLeft, paddingTop } = calcPadding(actualCell, font, false);
|
|
13493
13408
|
const rects = calcDocRangePositions({
|
|
13494
13409
|
startOffset: customRange.startIndex,
|
|
@@ -13515,8 +13430,8 @@ const getEditingCustomRangePosition = (injector, unitId, subUnitId, row, col, ra
|
|
|
13515
13430
|
const { editorUnitId, unitId: editingUnitId, sheetId, row: editRow, column: editCol } = state;
|
|
13516
13431
|
if (unitId !== editingUnitId || subUnitId !== sheetId || editRow !== row || editCol !== col) return null;
|
|
13517
13432
|
const renderManagerService = injector.get(_univerjs_engine_render.IRenderManagerService);
|
|
13518
|
-
const renderer = renderManagerService.
|
|
13519
|
-
const sheetRenderer = renderManagerService.
|
|
13433
|
+
const renderer = renderManagerService.getRenderUnitById(editorUnitId);
|
|
13434
|
+
const sheetRenderer = renderManagerService.getRenderUnitById(unitId);
|
|
13520
13435
|
if (!renderer || !sheetRenderer) return null;
|
|
13521
13436
|
const docSkeleton = renderer.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
13522
13437
|
const sheetSkeleton = (_sheetRenderer$with$g = sheetRenderer.with(SheetSkeletonManagerService).getSkeletonParam(sheetId)) === null || _sheetRenderer$with$g === void 0 ? void 0 : _sheetRenderer$with$g.skeleton;
|
|
@@ -13548,6 +13463,33 @@ function getLocationBase(location) {
|
|
|
13548
13463
|
const { workbook, worksheet, ...locBase } = location;
|
|
13549
13464
|
return locBase;
|
|
13550
13465
|
}
|
|
13466
|
+
function calculateCellDrawingRects(font, cell, drawings) {
|
|
13467
|
+
var _font$documentSkeleto;
|
|
13468
|
+
const drawingData = (_font$documentSkeleto = font.documentSkeleton) === null || _font$documentSkeleto === void 0 ? void 0 : _font$documentSkeleto.getViewModel().getDataModel().getDrawings();
|
|
13469
|
+
const cellRect = {
|
|
13470
|
+
left: 0,
|
|
13471
|
+
top: 0,
|
|
13472
|
+
right: cell.mergeInfo.endX - cell.mergeInfo.startX,
|
|
13473
|
+
bottom: cell.mergeInfo.endY - cell.mergeInfo.startY
|
|
13474
|
+
};
|
|
13475
|
+
return drawings.map((drawing) => {
|
|
13476
|
+
var _drawingOrigin$docTra, _drawingOrigin$docTra2, _font$style;
|
|
13477
|
+
const drawingOrigin = drawingData === null || drawingData === void 0 ? void 0 : drawingData[drawing.drawingId];
|
|
13478
|
+
const imageWidth = (drawingOrigin === null || drawingOrigin === void 0 || (_drawingOrigin$docTra = drawingOrigin.docTransform) === null || _drawingOrigin$docTra === void 0 ? void 0 : _drawingOrigin$docTra.size.width) ?? drawing.drawing.width;
|
|
13479
|
+
const imageHeight = (drawingOrigin === null || drawingOrigin === void 0 || (_drawingOrigin$docTra2 = drawingOrigin.docTransform) === null || _drawingOrigin$docTra2 === void 0 ? void 0 : _drawingOrigin$docTra2.size.height) ?? drawing.drawing.height;
|
|
13480
|
+
return {
|
|
13481
|
+
...drawing,
|
|
13482
|
+
rect: (0, _univerjs_engine_render.calculateCellImageRect)({
|
|
13483
|
+
cellRect,
|
|
13484
|
+
imageWidth,
|
|
13485
|
+
imageHeight,
|
|
13486
|
+
horizontalAlign: font.horizontalAlign,
|
|
13487
|
+
verticalAlign: font.verticalAlign,
|
|
13488
|
+
padding: (_font$style = font.style) === null || _font$style === void 0 ? void 0 : _font$style.pd
|
|
13489
|
+
})
|
|
13490
|
+
};
|
|
13491
|
+
});
|
|
13492
|
+
}
|
|
13551
13493
|
let HoverManagerService = class HoverManagerService extends _univerjs_core.Disposable {
|
|
13552
13494
|
constructor(_univerInstanceService, _renderManagerService) {
|
|
13553
13495
|
super();
|
|
@@ -13668,7 +13610,7 @@ let HoverManagerService = class HoverManagerService extends _univerjs_core.Dispo
|
|
|
13668
13610
|
if (!workbook) return null;
|
|
13669
13611
|
const worksheet = workbook.getActiveSheet();
|
|
13670
13612
|
if (!worksheet) return null;
|
|
13671
|
-
const currentRender = this._renderManagerService.
|
|
13613
|
+
const currentRender = this._renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
13672
13614
|
if (!currentRender) return null;
|
|
13673
13615
|
const skeletonParam = currentRender.with(SheetSkeletonManagerService).getSkeletonParam(worksheet.getSheetId());
|
|
13674
13616
|
if (!skeletonParam) return null;
|
|
@@ -13682,7 +13624,6 @@ let HoverManagerService = class HoverManagerService extends _univerjs_core.Dispo
|
|
|
13682
13624
|
};
|
|
13683
13625
|
}
|
|
13684
13626
|
_calcActiveCell(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY) {
|
|
13685
|
-
var _cellData$fontRenderE, _ref, _customRange$rects$po;
|
|
13686
13627
|
const hoverPosition = getHoverCellPosition(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY);
|
|
13687
13628
|
const skeleton = skeletonParam.skeleton;
|
|
13688
13629
|
if (!hoverPosition) return null;
|
|
@@ -13693,17 +13634,18 @@ let HoverManagerService = class HoverManagerService extends _univerjs_core.Dispo
|
|
|
13693
13634
|
let drawing = null;
|
|
13694
13635
|
const cell = skeleton.getCellWithCoordByIndex(overflowLocation.row, overflowLocation.col);
|
|
13695
13636
|
const cellData = worksheet.getCell(overflowLocation.row, overflowLocation.col);
|
|
13696
|
-
const { topOffset = 0, leftOffset = 0 } = (
|
|
13637
|
+
const { topOffset = 0, leftOffset = 0 } = (cellData === null || cellData === void 0 ? void 0 : cellData.fontRenderExtension) ?? {};
|
|
13697
13638
|
if (font === null || font === void 0 ? void 0 : font.documentSkeleton) {
|
|
13698
13639
|
const { paddingLeft, paddingTop } = calcPadding(cell, font, (cellData === null || cellData === void 0 ? void 0 : cellData.p) ? false : (0, _univerjs_core.isRealNum)(cellData === null || cellData === void 0 ? void 0 : cellData.v) && (!(cellData === null || cellData === void 0 ? void 0 : cellData.t) || cellData.t === _univerjs_core.CellValueType.NUMBER));
|
|
13699
13640
|
const rects = calculateDocSkeletonRects(font.documentSkeleton, paddingLeft, paddingTop);
|
|
13641
|
+
const drawingRects = calculateCellDrawingRects(font, cell, rects.drawings);
|
|
13700
13642
|
const innerX = offsetX - position.startX - leftOffset;
|
|
13701
13643
|
const innerY = offsetY - position.startY - topOffset;
|
|
13702
13644
|
customRange = rects.links.find((link) => link.rects.some((rect) => rect.left <= innerX && innerX <= rect.right && rect.top <= innerY && innerY <= rect.bottom));
|
|
13703
13645
|
bullet = rects.checkLists.find((list) => list.rect.left <= innerX && innerX <= list.rect.right && list.rect.top <= innerY && innerY <= list.rect.bottom);
|
|
13704
|
-
drawing =
|
|
13646
|
+
drawing = drawingRects.find((drawing) => drawing.rect.left <= innerX && innerX <= drawing.rect.right && drawing.rect.top <= innerY && innerY <= drawing.rect.bottom);
|
|
13705
13647
|
}
|
|
13706
|
-
const rect = (
|
|
13648
|
+
const rect = (customRange === null || customRange === void 0 ? void 0 : customRange.rects.pop()) ?? (bullet === null || bullet === void 0 ? void 0 : bullet.rect) ?? (drawing === null || drawing === void 0 ? void 0 : drawing.rect);
|
|
13707
13649
|
const displayRect = rect && (() => {
|
|
13708
13650
|
const absoluteTop = rect.top + cell.mergeInfo.startY + topOffset;
|
|
13709
13651
|
const absoluteBottom = rect.bottom + cell.mergeInfo.startY + topOffset;
|
|
@@ -14025,7 +13967,6 @@ let SheetPermissionCheckUIController = class SheetPermissionCheckUIController ex
|
|
|
14025
13967
|
errorMsg
|
|
14026
13968
|
},
|
|
14027
13969
|
width: 320,
|
|
14028
|
-
destroyOnClose: true,
|
|
14029
13970
|
showOk: true,
|
|
14030
13971
|
onClose: () => {
|
|
14031
13972
|
this._dialogService.close(UNIVER_SHEET_PERMISSION_ALERT_DIALOG_ID);
|
|
@@ -14156,7 +14097,7 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends _u
|
|
|
14156
14097
|
}
|
|
14157
14098
|
_createFreeze(freezeDirectionType = 0, freezeConfig) {
|
|
14158
14099
|
var _this$_sheetSkeletonM;
|
|
14159
|
-
const config = freezeConfig
|
|
14100
|
+
const config = freezeConfig ?? this._getFreeze();
|
|
14160
14101
|
if (config == null) return null;
|
|
14161
14102
|
const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
|
|
14162
14103
|
const { startRow: freezeRow, startColumn: freezeColumn } = config;
|
|
@@ -14279,7 +14220,7 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends _u
|
|
|
14279
14220
|
if (s2) this._freezeDownSubs.add(s2);
|
|
14280
14221
|
}
|
|
14281
14222
|
_getCurrentLastVisible() {
|
|
14282
|
-
var _this$_sheetSkeletonM2
|
|
14223
|
+
var _this$_sheetSkeletonM2;
|
|
14283
14224
|
const sheetObject = this._getSheetObject();
|
|
14284
14225
|
if (sheetObject == null) return;
|
|
14285
14226
|
const skeleton = (_this$_sheetSkeletonM2 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM2 === void 0 ? void 0 : _this$_sheetSkeletonM2.skeleton;
|
|
@@ -14289,8 +14230,8 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends _u
|
|
|
14289
14230
|
const currentScroll = this._scrollManagerService.getCurrentScrollState();
|
|
14290
14231
|
const skeletonViewHeight = (sheetObject.engine.height - skeleton.columnHeaderHeight) / scale;
|
|
14291
14232
|
const skeletonViewWidth = (sheetObject.engine.width - skeleton.rowHeaderWidth) / scale;
|
|
14292
|
-
const startRow = (
|
|
14293
|
-
const startHeight = startRow === 0 ? -((
|
|
14233
|
+
const startRow = (currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.sheetViewStartRow) ?? 0;
|
|
14234
|
+
const startHeight = startRow === 0 ? -((currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.offsetY) ?? 0) : skeleton.rowHeightAccumulation[startRow - 1] - ((currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.offsetY) ?? 0);
|
|
14294
14235
|
let lastRow = 0;
|
|
14295
14236
|
let hadFind = false;
|
|
14296
14237
|
for (let i = startRow, len = skeleton.rowHeightAccumulation.length; i < len; i++) if (skeleton.rowHeightAccumulation[i] - startHeight > skeletonViewHeight) {
|
|
@@ -14299,8 +14240,8 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends _u
|
|
|
14299
14240
|
break;
|
|
14300
14241
|
}
|
|
14301
14242
|
if (!hadFind) lastRow = skeleton.rowHeightAccumulation.length - 1;
|
|
14302
|
-
const startColumn = (
|
|
14303
|
-
const startWidth = startColumn === 0 ? -((
|
|
14243
|
+
const startColumn = (currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.sheetViewStartColumn) ?? 0;
|
|
14244
|
+
const startWidth = startColumn === 0 ? -((currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.offsetX) ?? 0) : skeleton.columnWidthAccumulation[startColumn - 1] - ((currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.offsetX) ?? 0);
|
|
14304
14245
|
let lastColumn = 0;
|
|
14305
14246
|
let hadFindCol = false;
|
|
14306
14247
|
for (let i = startColumn, len = skeleton.columnWidthAccumulation.length; i < len; i++) if (skeleton.columnWidthAccumulation[i] - startWidth > skeletonViewWidth) {
|
|
@@ -15023,9 +14964,7 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends _u
|
|
|
15023
14964
|
}
|
|
15024
14965
|
_getFreeze() {
|
|
15025
14966
|
var _this$_sheetSkeletonM6;
|
|
15026
|
-
|
|
15027
|
-
if (config == null) return;
|
|
15028
|
-
return config.freeze;
|
|
14967
|
+
return (_this$_sheetSkeletonM6 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM6 === void 0 ? void 0 : _this$_sheetSkeletonM6.skeleton.worksheet.getFreeze();
|
|
15029
14968
|
}
|
|
15030
14969
|
_getSheetObject() {
|
|
15031
14970
|
return getSheetObject(this._context.unit, this._context);
|
|
@@ -15073,14 +15012,8 @@ function getSheetSelectionsDisabled$(accessor) {
|
|
|
15073
15012
|
const workbook$ = univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
15074
15013
|
return (0, rxjs.combineLatest)([
|
|
15075
15014
|
selectionManagerService.selectionMoveEnd$,
|
|
15076
|
-
workbook$.pipe((0, rxjs.map)((workbook) =>
|
|
15077
|
-
|
|
15078
|
-
return (_workbook$getUnitId = workbook === null || workbook === void 0 ? void 0 : workbook.getUnitId()) !== null && _workbook$getUnitId !== void 0 ? _workbook$getUnitId : "";
|
|
15079
|
-
})),
|
|
15080
|
-
workbook$.pipe((0, rxjs.switchMap)((workbook) => {
|
|
15081
|
-
var _workbook$activeSheet;
|
|
15082
|
-
return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : (0, rxjs.of)(null);
|
|
15083
|
-
}))
|
|
15015
|
+
workbook$.pipe((0, rxjs.map)((workbook) => (workbook === null || workbook === void 0 ? void 0 : workbook.getUnitId()) ?? "")),
|
|
15016
|
+
workbook$.pipe((0, rxjs.switchMap)((workbook) => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? (0, rxjs.of)(null)))
|
|
15084
15017
|
]).pipe((0, rxjs.map)(([selection, unitId, sheet]) => {
|
|
15085
15018
|
if (!sheet) return false;
|
|
15086
15019
|
if (!selection || selection.length === 0) return false;
|
|
@@ -16070,10 +16003,7 @@ let HeaderUnhideRenderController = class HeaderUnhideRenderController extends _u
|
|
|
16070
16003
|
const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getSkeletonParam(worksheet.getSheetId())) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
|
|
16071
16004
|
if (!skeleton) return;
|
|
16072
16005
|
const visibleCheck = this.interceptor.fetchThroughInterceptors(HEADER_UNHIDE_RANGE_VISIBLE_CHECK);
|
|
16073
|
-
const shouldRenderRange = (payload) =>
|
|
16074
|
-
var _visibleCheck;
|
|
16075
|
-
return this._headerUnhideRangeService.shouldRenderRange((_visibleCheck = visibleCheck(true, payload)) !== null && _visibleCheck !== void 0 ? _visibleCheck : true, payload);
|
|
16076
|
-
};
|
|
16006
|
+
const shouldRenderRange = (payload) => this._headerUnhideRangeService.shouldRenderRange(visibleCheck(true, payload) ?? true, payload);
|
|
16077
16007
|
const hiddenRowRanges = worksheet.getHiddenRows().filter((range) => shouldRenderRange({
|
|
16078
16008
|
axis: "row",
|
|
16079
16009
|
range,
|
|
@@ -16159,43 +16089,43 @@ var StatusBarService = class {
|
|
|
16159
16089
|
{
|
|
16160
16090
|
func: _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.MAX,
|
|
16161
16091
|
filter: (status) => {
|
|
16162
|
-
var _status$values$find
|
|
16163
|
-
return ((
|
|
16092
|
+
var _status$values$find, _status$values$find2;
|
|
16093
|
+
return (((_status$values$find = status.values.find((item) => item.func === _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find === void 0 ? void 0 : _status$values$find.value) ?? 0) > 1 && (((_status$values$find2 = status.values.find((item) => item.func === _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find2 === void 0 ? void 0 : _status$values$find2.value) ?? 0) > 0;
|
|
16164
16094
|
}
|
|
16165
16095
|
},
|
|
16166
16096
|
{
|
|
16167
16097
|
func: _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.MIN,
|
|
16168
16098
|
filter: (status) => {
|
|
16169
|
-
var _status$values$
|
|
16170
|
-
return ((
|
|
16099
|
+
var _status$values$find3, _status$values$find4;
|
|
16100
|
+
return (((_status$values$find3 = status.values.find((item) => item.func === _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find3 === void 0 ? void 0 : _status$values$find3.value) ?? 0) > 1 && (((_status$values$find4 = status.values.find((item) => item.func === _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find4 === void 0 ? void 0 : _status$values$find4.value) ?? 0) > 0;
|
|
16171
16101
|
}
|
|
16172
16102
|
},
|
|
16173
16103
|
{
|
|
16174
16104
|
func: _univerjs_engine_formula.FUNCTION_NAMES_MATH.SUM,
|
|
16175
16105
|
filter: (status) => {
|
|
16176
|
-
var _status$values$
|
|
16177
|
-
return ((
|
|
16106
|
+
var _status$values$find5, _status$values$find6;
|
|
16107
|
+
return (((_status$values$find5 = status.values.find((item) => item.func === _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find5 === void 0 ? void 0 : _status$values$find5.value) ?? 0) > 1 && (((_status$values$find6 = status.values.find((item) => item.func === _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find6 === void 0 ? void 0 : _status$values$find6.value) ?? 0) > 0;
|
|
16178
16108
|
}
|
|
16179
16109
|
},
|
|
16180
16110
|
{
|
|
16181
16111
|
func: _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNTA,
|
|
16182
16112
|
filter: (status) => {
|
|
16183
|
-
var _status$values$
|
|
16184
|
-
return ((
|
|
16113
|
+
var _status$values$find7;
|
|
16114
|
+
return (((_status$values$find7 = status.values.find((item) => item.func === _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find7 === void 0 ? void 0 : _status$values$find7.value) ?? 0) > 1;
|
|
16185
16115
|
}
|
|
16186
16116
|
},
|
|
16187
16117
|
{
|
|
16188
16118
|
func: _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNT,
|
|
16189
16119
|
filter: (status) => {
|
|
16190
|
-
var _status$values$
|
|
16191
|
-
return ((
|
|
16120
|
+
var _status$values$find8, _status$values$find9;
|
|
16121
|
+
return (((_status$values$find8 = status.values.find((item) => item.func === _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find8 === void 0 ? void 0 : _status$values$find8.value) ?? 0) > 1 && (((_status$values$find9 = status.values.find((item) => item.func === _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find9 === void 0 ? void 0 : _status$values$find9.value) ?? 0) > 0;
|
|
16192
16122
|
}
|
|
16193
16123
|
},
|
|
16194
16124
|
{
|
|
16195
16125
|
func: _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.AVERAGE,
|
|
16196
16126
|
filter: (status) => {
|
|
16197
|
-
var _status$values$
|
|
16198
|
-
return ((
|
|
16127
|
+
var _status$values$find10, _status$values$find11;
|
|
16128
|
+
return (((_status$values$find10 = status.values.find((item) => item.func === _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find10 === void 0 ? void 0 : _status$values$find10.value) ?? 0) > 1 && (((_status$values$find11 = status.values.find((item) => item.func === _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find11 === void 0 ? void 0 : _status$values$find11.value) ?? 0) > 0;
|
|
16199
16129
|
}
|
|
16200
16130
|
}
|
|
16201
16131
|
]);
|
|
@@ -16206,7 +16136,6 @@ var StatusBarService = class {
|
|
|
16206
16136
|
this._state$.complete();
|
|
16207
16137
|
}
|
|
16208
16138
|
setState(param) {
|
|
16209
|
-
var _param$pattern;
|
|
16210
16139
|
const newState = {
|
|
16211
16140
|
values: [],
|
|
16212
16141
|
pattern: null
|
|
@@ -16215,7 +16144,7 @@ var StatusBarService = class {
|
|
|
16215
16144
|
const func = this._functions.find((func) => func.func === item.func);
|
|
16216
16145
|
if (func && (func.filter === void 0 || func.filter(param))) newState.values.push(item);
|
|
16217
16146
|
});
|
|
16218
|
-
newState.pattern = (
|
|
16147
|
+
newState.pattern = (param === null || param === void 0 ? void 0 : param.pattern) ?? null;
|
|
16219
16148
|
this._state$.next(newState);
|
|
16220
16149
|
}
|
|
16221
16150
|
getState() {
|
|
@@ -16394,14 +16323,11 @@ let StatusBarController = class StatusBarController extends _univerjs_core.Dispo
|
|
|
16394
16323
|
var _sheetArrayFormulaCel;
|
|
16395
16324
|
const rawCell = sheet.getCellRaw(row, col);
|
|
16396
16325
|
const arrayCell = sheetArrayFormulaCellData === null || sheetArrayFormulaCellData === void 0 || (_sheetArrayFormulaCel = sheetArrayFormulaCellData[row]) === null || _sheetArrayFormulaCel === void 0 ? void 0 : _sheetArrayFormulaCel[col];
|
|
16397
|
-
if (arrayCell) {
|
|
16398
|
-
|
|
16399
|
-
|
|
16400
|
-
|
|
16401
|
-
|
|
16402
|
-
s: (_arrayCell$s = arrayCell.s) !== null && _arrayCell$s !== void 0 ? _arrayCell$s : rawCell === null || rawCell === void 0 ? void 0 : rawCell.s
|
|
16403
|
-
};
|
|
16404
|
-
}
|
|
16326
|
+
if (arrayCell) return {
|
|
16327
|
+
t: arrayCell.t ?? (rawCell === null || rawCell === void 0 ? void 0 : rawCell.t),
|
|
16328
|
+
v: arrayCell.v ?? (rawCell === null || rawCell === void 0 ? void 0 : rawCell.v),
|
|
16329
|
+
s: arrayCell.s ?? (rawCell === null || rawCell === void 0 ? void 0 : rawCell.s)
|
|
16330
|
+
};
|
|
16405
16331
|
return rawCell;
|
|
16406
16332
|
}
|
|
16407
16333
|
_calculateSelection(selections, primary) {
|
|
@@ -16699,12 +16625,11 @@ function getObservableWithExclusiveRange$(accessor, observable$, disableGroupSet
|
|
|
16699
16625
|
return (0, rxjs.combineLatest)([observable$, getCurrentExclusiveRangeInterest$(accessor, disableGroupSet)]).pipe((0, rxjs_operators.map)(([observable, exclusiveRangeDisable]) => observable || exclusiveRangeDisable));
|
|
16700
16626
|
}
|
|
16701
16627
|
function getCurrentRangeDisable$(accessor, permissionTypes = {}, supportCellEdit = false) {
|
|
16702
|
-
var _editorBridgeService$;
|
|
16703
16628
|
const workbook$ = accessor.get(_univerjs_core.IUniverInstanceService).getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
16704
16629
|
const userManagerService = accessor.get(_univerjs_core.UserManagerService);
|
|
16705
16630
|
const editorBridgeService = accessor.has(IEditorBridgeService) ? accessor.get(IEditorBridgeService) : null;
|
|
16706
16631
|
const contextService = accessor.get(_univerjs_core.IContextService);
|
|
16707
|
-
const editorVisible$ = ((
|
|
16632
|
+
const editorVisible$ = ((editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.visible$) ?? (0, rxjs.of)(null)).pipe((0, rxjs_operators.startWith)(null), (0, rxjs_operators.shareReplay)({
|
|
16708
16633
|
bufferSize: 1,
|
|
16709
16634
|
refCount: true
|
|
16710
16635
|
}));
|
|
@@ -16883,7 +16808,6 @@ function getWorkbookPermissionDisable$(accessor, workbookPermissionTypes) {
|
|
|
16883
16808
|
return (0, rxjs.combineLatest)([accessor.get(_univerjs_core.UserManagerService).currentUser$, workbook$]).pipe((0, rxjs_operators.switchMap)(([_user, workbook]) => {
|
|
16884
16809
|
if (!workbook) return (0, rxjs.of)(true);
|
|
16885
16810
|
return workbook.activeSheet$.pipe((0, rxjs_operators.switchMap)((worksheet) => {
|
|
16886
|
-
var _permissionService$co;
|
|
16887
16811
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
16888
16812
|
const unitId = workbook.getUnitId();
|
|
16889
16813
|
const subUnitId = worksheet.getSheetId();
|
|
@@ -16891,7 +16815,7 @@ function getWorkbookPermissionDisable$(accessor, workbookPermissionTypes) {
|
|
|
16891
16815
|
const worksheetProtectionRuleModel = accessor.get(_univerjs_sheets.WorksheetProtectionRuleModel);
|
|
16892
16816
|
const workbookPermissionIds = [];
|
|
16893
16817
|
workbookPermissionTypes.forEach((F) => workbookPermissionIds.push(new F(unitId).id));
|
|
16894
|
-
return (0, rxjs.combineLatest)([
|
|
16818
|
+
return (0, rxjs.combineLatest)([permissionService.composePermission$(workbookPermissionIds).pipe((0, rxjs_operators.map)((list) => list.every((item) => item.value === true))) ?? (0, rxjs.of)(false), (0, rxjs.merge)(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe((0, rxjs_operators.startWith)(null))]).pipe((0, rxjs_operators.map)(([permission, _]) => {
|
|
16895
16819
|
var _selectionProtectionR;
|
|
16896
16820
|
if (!permission) return true;
|
|
16897
16821
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
@@ -16917,11 +16841,10 @@ function CellBorderSelectorMenuItemFactory(accessor) {
|
|
|
16917
16841
|
const defaultIcon = "AllBorderIcon";
|
|
16918
16842
|
const borderManager = accessor.get(_univerjs_sheets.BorderStyleManagerService);
|
|
16919
16843
|
const disposable = accessor.get(_univerjs_core.ICommandService).onCommandExecuted((c) => {
|
|
16920
|
-
var _item$icon;
|
|
16921
16844
|
if (c.id !== _univerjs_sheets.SetBorderBasicCommand.id) return;
|
|
16922
16845
|
const { type } = borderManager.getBorderInfo();
|
|
16923
16846
|
const item = BORDER_LINE_CHILDREN.find((item) => item.value === type);
|
|
16924
|
-
const icon = (
|
|
16847
|
+
const icon = (item === null || item === void 0 ? void 0 : item.icon) ?? defaultIcon;
|
|
16925
16848
|
subscriber.next(icon);
|
|
16926
16849
|
});
|
|
16927
16850
|
subscriber.next(defaultIcon);
|
|
@@ -17111,8 +17034,8 @@ function updateFontSizeValue(accessor, defaultValue) {
|
|
|
17111
17034
|
const updateSheetEditor = () => {
|
|
17112
17035
|
const textRun = getFontStyleAtCursor(accessor);
|
|
17113
17036
|
if (textRun != null) {
|
|
17114
|
-
var _textRun$ts
|
|
17115
|
-
const fs = (
|
|
17037
|
+
var _textRun$ts;
|
|
17038
|
+
const fs = ((_textRun$ts = textRun.ts) === null || _textRun$ts === void 0 ? void 0 : _textRun$ts.fs) ?? defaultValue;
|
|
17116
17039
|
subscriber.next(fs);
|
|
17117
17040
|
}
|
|
17118
17041
|
};
|
|
@@ -17192,11 +17115,10 @@ const defaultValue = {
|
|
|
17192
17115
|
col: "A"
|
|
17193
17116
|
};
|
|
17194
17117
|
function getFrozenValue(selection) {
|
|
17195
|
-
var _primary$startRow, _primary$startColumn;
|
|
17196
17118
|
if (!selection) return defaultValue;
|
|
17197
17119
|
const { primary, range } = selection;
|
|
17198
|
-
const row = (
|
|
17199
|
-
const col = (
|
|
17120
|
+
const row = (primary === null || primary === void 0 ? void 0 : primary.startRow) ?? range.startRow;
|
|
17121
|
+
const col = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
|
|
17200
17122
|
return {
|
|
17201
17123
|
row: row === 0 ? "1" : String(row),
|
|
17202
17124
|
col: col === 0 ? "A" : _univerjs_core.Tools.chatAtABC(col - 1)
|
|
@@ -17226,11 +17148,10 @@ const getMenuHiddenByCurrentSelectionChangedObservable$$1 = (accessor, type) =>
|
|
|
17226
17148
|
const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
|
|
17227
17149
|
return new rxjs.Observable((subscriber) => {
|
|
17228
17150
|
const update = (selection) => {
|
|
17229
|
-
var _primary$startRow, _primary$startColumn;
|
|
17230
17151
|
if (!selection) return subscriber.next(true);
|
|
17231
17152
|
const { primary, range } = selection;
|
|
17232
|
-
const row = (
|
|
17233
|
-
const col = (
|
|
17153
|
+
const row = (primary === null || primary === void 0 ? void 0 : primary.startRow) ?? range.startRow;
|
|
17154
|
+
const col = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
|
|
17234
17155
|
if (type === "row" && row <= 0) return subscriber.next(true);
|
|
17235
17156
|
if (type === "col" && col <= 0) return subscriber.next(true);
|
|
17236
17157
|
subscriber.next(false);
|
|
@@ -17470,7 +17391,7 @@ const MenuItemInput = (props) => {
|
|
|
17470
17391
|
const { prefix, suffix, value, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, disabled$, onChange } = props;
|
|
17471
17392
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
17472
17393
|
const contextMenuService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IContextMenuService);
|
|
17473
|
-
const disabled = (0, _univerjs_ui.useObservable)(disabled$
|
|
17394
|
+
const disabled = (0, _univerjs_ui.useObservable)(disabled$ ?? null, false);
|
|
17474
17395
|
const [inputValue, setInputValue] = (0, react.useState)();
|
|
17475
17396
|
const handleChange = (value) => {
|
|
17476
17397
|
if (!value) {
|
|
@@ -18141,8 +18062,8 @@ function FontFamilySelectorMenuItemFactory(accessor) {
|
|
|
18141
18062
|
if ((id === _univerjs_docs.SetTextSelectionsOperation.id || id === _univerjs_docs_ui.SetInlineFormatCommand.id) && accessor.get(_univerjs_core.IContextService).getContextValue(_univerjs_core.EDITOR_ACTIVATED) && (accessor.get(_univerjs_core.IContextService).getContextValue(_univerjs_core.FOCUSING_SHEET) || accessor.get(_univerjs_core.IContextService).getContextValue(_univerjs_core.FOCUSING_SHAPE_TEXT_EDITOR))) {
|
|
18142
18063
|
const textRun = getFontStyleAtCursor(accessor);
|
|
18143
18064
|
if (textRun != null) {
|
|
18144
|
-
var _textRun$
|
|
18145
|
-
const ff = (
|
|
18065
|
+
var _textRun$ts5;
|
|
18066
|
+
const ff = ((_textRun$ts5 = textRun.ts) === null || _textRun$ts5 === void 0 ? void 0 : _textRun$ts5.ff) ?? defaultValue;
|
|
18146
18067
|
subscriber.next(ff);
|
|
18147
18068
|
}
|
|
18148
18069
|
}
|
|
@@ -18185,10 +18106,8 @@ function TextColorSelectorMenuItemFactory(accessor) {
|
|
|
18185
18106
|
value$: new rxjs.Observable((subscriber) => {
|
|
18186
18107
|
const defaultValue = _univerjs_core.DEFAULT_STYLES.cl.rgb;
|
|
18187
18108
|
const { isAllValuesSame, value: currentValue } = selectionManagerService.getCellStylesProperty("cl");
|
|
18188
|
-
if (isAllValuesSame)
|
|
18189
|
-
|
|
18190
|
-
subscriber.next((_rgb = currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) !== null && _rgb !== void 0 ? _rgb : defaultValue);
|
|
18191
|
-
} else subscriber.next(defaultValue);
|
|
18109
|
+
if (isAllValuesSame) subscriber.next((currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) ?? defaultValue);
|
|
18110
|
+
else subscriber.next(defaultValue);
|
|
18192
18111
|
})
|
|
18193
18112
|
}],
|
|
18194
18113
|
value$: new rxjs.Observable((subscriber) => {
|
|
@@ -18196,7 +18115,7 @@ function TextColorSelectorMenuItemFactory(accessor) {
|
|
|
18196
18115
|
const disposable = commandService.onCommandExecuted((c) => {
|
|
18197
18116
|
if (c.id === SetRangeTextColorCommand.id) {
|
|
18198
18117
|
const color = c.params.value;
|
|
18199
|
-
subscriber.next(color
|
|
18118
|
+
subscriber.next(color ?? defaultValue);
|
|
18200
18119
|
}
|
|
18201
18120
|
});
|
|
18202
18121
|
subscriber.next(defaultValue);
|
|
@@ -18241,10 +18160,8 @@ function BackgroundColorSelectorMenuItemFactory(accessor) {
|
|
|
18241
18160
|
value$: new rxjs.Observable((subscriber) => {
|
|
18242
18161
|
const defaultValue = themeService.getColorFromTheme("primary.600");
|
|
18243
18162
|
const { isAllValuesSame, value: currentValue } = selectionManagerService.getCellStylesProperty("bg");
|
|
18244
|
-
if (isAllValuesSame)
|
|
18245
|
-
|
|
18246
|
-
subscriber.next((_rgb2 = currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) !== null && _rgb2 !== void 0 ? _rgb2 : defaultValue);
|
|
18247
|
-
} else subscriber.next(defaultValue);
|
|
18163
|
+
if (isAllValuesSame) subscriber.next((currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) ?? defaultValue);
|
|
18164
|
+
else subscriber.next(defaultValue);
|
|
18248
18165
|
})
|
|
18249
18166
|
}],
|
|
18250
18167
|
value$: new rxjs.Observable((subscriber) => {
|
|
@@ -18252,7 +18169,7 @@ function BackgroundColorSelectorMenuItemFactory(accessor) {
|
|
|
18252
18169
|
const disposable = commandService.onCommandExecuted((c) => {
|
|
18253
18170
|
if (c.id === _univerjs_sheets.SetBackgroundColorCommand.id) {
|
|
18254
18171
|
const color = c.params.value;
|
|
18255
|
-
subscriber.next(color
|
|
18172
|
+
subscriber.next(color ?? defaultValue);
|
|
18256
18173
|
}
|
|
18257
18174
|
});
|
|
18258
18175
|
subscriber.next(defaultValue);
|
|
@@ -18284,12 +18201,12 @@ const HORIZONTAL_ALIGN_CHILDREN = [
|
|
|
18284
18201
|
}
|
|
18285
18202
|
];
|
|
18286
18203
|
function HorizontalAlignMenuItemFactory(accessor) {
|
|
18287
|
-
var
|
|
18204
|
+
var _HORIZONTAL_ALIGN_CHI;
|
|
18288
18205
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
18289
18206
|
const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
|
|
18290
18207
|
const workbook = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
18291
18208
|
const defaultStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getDefaultCellStyleInternal();
|
|
18292
|
-
const defaultValue = (
|
|
18209
|
+
const defaultValue = (defaultStyle === null || defaultStyle === void 0 ? void 0 : defaultStyle.ht) ?? _univerjs_core.HorizontalAlign.LEFT;
|
|
18293
18210
|
return {
|
|
18294
18211
|
id: _univerjs_sheets.SetHorizontalTextAlignCommand.id,
|
|
18295
18212
|
icon: (_HORIZONTAL_ALIGN_CHI = HORIZONTAL_ALIGN_CHILDREN.find((child) => child.value === defaultValue)) === null || _HORIZONTAL_ALIGN_CHI === void 0 ? void 0 : _HORIZONTAL_ALIGN_CHI.icon,
|
|
@@ -18297,30 +18214,28 @@ function HorizontalAlignMenuItemFactory(accessor) {
|
|
|
18297
18214
|
type: _univerjs_ui.MenuItemType.SELECTOR,
|
|
18298
18215
|
selections: HORIZONTAL_ALIGN_CHILDREN,
|
|
18299
18216
|
value$: deriveStateFromActiveSheet$(univerInstanceService, defaultValue, ({ worksheet }) => new rxjs.Observable((subscriber) => {
|
|
18300
|
-
var _selectionManagerServ11
|
|
18217
|
+
var _selectionManagerServ11;
|
|
18301
18218
|
const disposable = accessor.get(_univerjs_core.ICommandService).onCommandExecuted((c) => {
|
|
18302
|
-
var _selectionManagerServ10
|
|
18219
|
+
var _selectionManagerServ10;
|
|
18303
18220
|
const id = c.id;
|
|
18304
18221
|
if (id !== _univerjs_sheets.SetHorizontalTextAlignCommand.id && id !== _univerjs_sheets.SetSelectionsOperation.id && id !== _univerjs_sheets.SetWorksheetActiveOperation.id) return;
|
|
18305
18222
|
const primary = (_selectionManagerServ10 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ10 === void 0 ? void 0 : _selectionManagerServ10.primary;
|
|
18306
18223
|
let ht;
|
|
18307
18224
|
if (primary != null) {
|
|
18308
|
-
var _defaultCellStyle$ht;
|
|
18309
18225
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18310
18226
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18311
|
-
ht = (
|
|
18227
|
+
ht = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.ht) ?? (range === null || range === void 0 ? void 0 : range.getHorizontalAlignment());
|
|
18312
18228
|
}
|
|
18313
|
-
subscriber.next(
|
|
18229
|
+
subscriber.next(ht ?? defaultValue);
|
|
18314
18230
|
});
|
|
18315
18231
|
const primary = (_selectionManagerServ11 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ11 === void 0 ? void 0 : _selectionManagerServ11.primary;
|
|
18316
18232
|
let ht;
|
|
18317
18233
|
if (primary != null) {
|
|
18318
|
-
var _defaultCellStyle$ht2;
|
|
18319
18234
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18320
18235
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18321
|
-
ht = (
|
|
18236
|
+
ht = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.ht) ?? (range === null || range === void 0 ? void 0 : range.getHorizontalAlignment());
|
|
18322
18237
|
}
|
|
18323
|
-
subscriber.next(
|
|
18238
|
+
subscriber.next(ht ?? defaultValue);
|
|
18324
18239
|
return disposable.dispose;
|
|
18325
18240
|
})),
|
|
18326
18241
|
hidden$: (0, rxjs.combineLatest)([(0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET), accessor.get(_univerjs_core.IContextService).subscribeContextValue$(_univerjs_core.FOCUSING_COMMON_DRAWINGS).pipe((0, rxjs.startWith)(false))]).pipe((0, rxjs.map)(([hidden, focusingDrawing]) => hidden || focusingDrawing)),
|
|
@@ -18349,12 +18264,12 @@ const VERTICAL_ALIGN_CHILDREN = [
|
|
|
18349
18264
|
}
|
|
18350
18265
|
];
|
|
18351
18266
|
function VerticalAlignMenuItemFactory(accessor) {
|
|
18352
|
-
var
|
|
18267
|
+
var _VERTICAL_ALIGN_CHILD;
|
|
18353
18268
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
18354
18269
|
const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
|
|
18355
18270
|
const workbook = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
18356
18271
|
const defaultStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getDefaultCellStyleInternal();
|
|
18357
|
-
const defaultValue = (
|
|
18272
|
+
const defaultValue = (defaultStyle === null || defaultStyle === void 0 ? void 0 : defaultStyle.vt) ?? _univerjs_core.VerticalAlign.BOTTOM;
|
|
18358
18273
|
return {
|
|
18359
18274
|
id: _univerjs_sheets.SetVerticalTextAlignCommand.id,
|
|
18360
18275
|
icon: (_VERTICAL_ALIGN_CHILD = VERTICAL_ALIGN_CHILDREN.find((child) => child.value === defaultValue)) === null || _VERTICAL_ALIGN_CHILD === void 0 ? void 0 : _VERTICAL_ALIGN_CHILD.icon,
|
|
@@ -18362,30 +18277,28 @@ function VerticalAlignMenuItemFactory(accessor) {
|
|
|
18362
18277
|
type: _univerjs_ui.MenuItemType.SELECTOR,
|
|
18363
18278
|
selections: VERTICAL_ALIGN_CHILDREN,
|
|
18364
18279
|
value$: deriveStateFromActiveSheet$(univerInstanceService, defaultValue, ({ worksheet }) => new rxjs.Observable((subscriber) => {
|
|
18365
|
-
var _selectionManagerServ13
|
|
18280
|
+
var _selectionManagerServ13;
|
|
18366
18281
|
const disposable = accessor.get(_univerjs_core.ICommandService).onCommandExecuted((c) => {
|
|
18367
|
-
var _selectionManagerServ12
|
|
18282
|
+
var _selectionManagerServ12;
|
|
18368
18283
|
const id = c.id;
|
|
18369
18284
|
if (id !== _univerjs_sheets.SetVerticalTextAlignCommand.id && id !== _univerjs_sheets.SetSelectionsOperation.id && id !== _univerjs_sheets.SetWorksheetActiveOperation.id) return;
|
|
18370
18285
|
const primary = (_selectionManagerServ12 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ12 === void 0 ? void 0 : _selectionManagerServ12.primary;
|
|
18371
18286
|
let vt;
|
|
18372
18287
|
if (primary != null) {
|
|
18373
|
-
var _defaultCellStyle$vt;
|
|
18374
18288
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18375
18289
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18376
|
-
vt = (
|
|
18290
|
+
vt = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.vt) ?? (range === null || range === void 0 ? void 0 : range.getVerticalAlignment());
|
|
18377
18291
|
}
|
|
18378
|
-
subscriber.next(
|
|
18292
|
+
subscriber.next(vt ?? defaultValue);
|
|
18379
18293
|
});
|
|
18380
18294
|
const primary = (_selectionManagerServ13 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ13 === void 0 ? void 0 : _selectionManagerServ13.primary;
|
|
18381
18295
|
let vt;
|
|
18382
18296
|
if (primary != null) {
|
|
18383
|
-
var _defaultCellStyle$vt2;
|
|
18384
18297
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18385
18298
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18386
|
-
vt = (
|
|
18299
|
+
vt = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.vt) ?? (range === null || range === void 0 ? void 0 : range.getVerticalAlignment());
|
|
18387
18300
|
}
|
|
18388
|
-
subscriber.next(
|
|
18301
|
+
subscriber.next(vt ?? defaultValue);
|
|
18389
18302
|
return disposable.dispose;
|
|
18390
18303
|
})),
|
|
18391
18304
|
hidden$: (0, rxjs.combineLatest)([(0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET), accessor.get(_univerjs_core.IContextService).subscribeContextValue$(_univerjs_core.FOCUSING_COMMON_DRAWINGS).pipe((0, rxjs.startWith)(false))]).pipe((0, rxjs.map)(([hidden, focusingDrawing]) => hidden || focusingDrawing)),
|
|
@@ -18414,12 +18327,12 @@ const TEXT_WRAP_CHILDREN = [
|
|
|
18414
18327
|
}
|
|
18415
18328
|
];
|
|
18416
18329
|
function WrapTextMenuItemFactory(accessor) {
|
|
18417
|
-
var
|
|
18330
|
+
var _TEXT_WRAP_CHILDREN$f;
|
|
18418
18331
|
const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
|
|
18419
18332
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
18420
18333
|
const workbook = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
18421
18334
|
const defaultStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getDefaultCellStyleInternal();
|
|
18422
|
-
const defaultValue = (
|
|
18335
|
+
const defaultValue = (defaultStyle === null || defaultStyle === void 0 ? void 0 : defaultStyle.tb) ?? _univerjs_core.WrapStrategy.OVERFLOW;
|
|
18423
18336
|
return {
|
|
18424
18337
|
id: _univerjs_sheets.SetTextWrapCommand.id,
|
|
18425
18338
|
tooltip: "sheets-ui.toolbar.textWrapMode.main",
|
|
@@ -18427,30 +18340,28 @@ function WrapTextMenuItemFactory(accessor) {
|
|
|
18427
18340
|
type: _univerjs_ui.MenuItemType.SELECTOR,
|
|
18428
18341
|
selections: TEXT_WRAP_CHILDREN,
|
|
18429
18342
|
value$: deriveStateFromActiveSheet$(univerInstanceService, defaultValue, ({ worksheet }) => new rxjs.Observable((subscriber) => {
|
|
18430
|
-
var _selectionManagerServ15
|
|
18343
|
+
var _selectionManagerServ15;
|
|
18431
18344
|
const disposable = accessor.get(_univerjs_core.ICommandService).onCommandExecuted((c) => {
|
|
18432
|
-
var _selectionManagerServ14
|
|
18345
|
+
var _selectionManagerServ14;
|
|
18433
18346
|
const id = c.id;
|
|
18434
18347
|
if (id !== _univerjs_sheets.SetTextWrapCommand.id && id !== _univerjs_sheets.SetSelectionsOperation.id && id !== _univerjs_sheets.SetWorksheetActiveOperation.id) return;
|
|
18435
18348
|
const primary = (_selectionManagerServ14 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ14 === void 0 ? void 0 : _selectionManagerServ14.primary;
|
|
18436
18349
|
let tb;
|
|
18437
18350
|
if (primary != null) {
|
|
18438
|
-
var _defaultCellStyle$tb;
|
|
18439
18351
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18440
18352
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18441
|
-
tb = (
|
|
18353
|
+
tb = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.tb) ?? (range === null || range === void 0 ? void 0 : range.getWrapStrategy());
|
|
18442
18354
|
}
|
|
18443
|
-
subscriber.next(
|
|
18355
|
+
subscriber.next(tb ?? defaultValue);
|
|
18444
18356
|
});
|
|
18445
18357
|
const primary = (_selectionManagerServ15 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ15 === void 0 ? void 0 : _selectionManagerServ15.primary;
|
|
18446
18358
|
let tb;
|
|
18447
18359
|
if (primary != null) {
|
|
18448
|
-
var _defaultCellStyle$tb2;
|
|
18449
18360
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18450
18361
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18451
|
-
tb = (
|
|
18362
|
+
tb = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.tb) ?? (range === null || range === void 0 ? void 0 : range.getWrapStrategy());
|
|
18452
18363
|
}
|
|
18453
|
-
subscriber.next(
|
|
18364
|
+
subscriber.next(tb ?? defaultValue);
|
|
18454
18365
|
return disposable.dispose;
|
|
18455
18366
|
})),
|
|
18456
18367
|
hidden$: (0, rxjs.combineLatest)([(0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET), accessor.get(_univerjs_core.IContextService).subscribeContextValue$(_univerjs_core.FOCUSING_COMMON_DRAWINGS).pipe((0, rxjs.startWith)(false))]).pipe((0, rxjs.map)(([hidden, focusingDrawing]) => hidden || focusingDrawing)),
|
|
@@ -18550,10 +18461,7 @@ function TextRotateMenuItemFactory(accessor) {
|
|
|
18550
18461
|
tr = range === null || range === void 0 ? void 0 : range.getTextRotation();
|
|
18551
18462
|
}
|
|
18552
18463
|
if ((tr === null || tr === void 0 ? void 0 : tr.v) === _univerjs_core.BooleanNumber.TRUE) subscriber.next("v");
|
|
18553
|
-
else
|
|
18554
|
-
var _ref;
|
|
18555
|
-
subscriber.next((_ref = tr && tr.a) !== null && _ref !== void 0 ? _ref : defaultValue);
|
|
18556
|
-
}
|
|
18464
|
+
else subscriber.next((tr && tr.a) ?? defaultValue);
|
|
18557
18465
|
});
|
|
18558
18466
|
const primary = (_selectionManagerServ18 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ18 === void 0 ? void 0 : _selectionManagerServ18.primary;
|
|
18559
18467
|
let tr;
|
|
@@ -18562,10 +18470,7 @@ function TextRotateMenuItemFactory(accessor) {
|
|
|
18562
18470
|
tr = range === null || range === void 0 ? void 0 : range.getTextRotation();
|
|
18563
18471
|
}
|
|
18564
18472
|
if ((tr === null || tr === void 0 ? void 0 : tr.v) === _univerjs_core.BooleanNumber.TRUE) subscriber.next("v");
|
|
18565
|
-
else
|
|
18566
|
-
var _ref2;
|
|
18567
|
-
subscriber.next((_ref2 = tr && tr.a) !== null && _ref2 !== void 0 ? _ref2 : defaultValue);
|
|
18568
|
-
}
|
|
18473
|
+
else subscriber.next((tr && tr.a) ?? defaultValue);
|
|
18569
18474
|
return disposable.dispose;
|
|
18570
18475
|
})),
|
|
18571
18476
|
hidden$: (0, rxjs.combineLatest)([(0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET), accessor.get(_univerjs_core.IContextService).subscribeContextValue$(_univerjs_core.FOCUSING_COMMON_DRAWINGS).pipe((0, rxjs.startWith)(false))]).pipe((0, rxjs.map)(([hidden, focusingDrawing]) => hidden || focusingDrawing)),
|
|
@@ -19057,14 +18962,13 @@ function getPermissionDisableBase$(accessor) {
|
|
|
19057
18962
|
return (0, rxjs.combineLatest)([univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), accessor.get(_univerjs_core.UserManagerService).currentUser$]).pipe((0, rxjs.switchMap)(([workbook, _]) => {
|
|
19058
18963
|
if (!workbook) return (0, rxjs.of)(true);
|
|
19059
18964
|
return workbook.activeSheet$.pipe((0, rxjs.switchMap)((worksheet) => {
|
|
19060
|
-
var _permissionService$co;
|
|
19061
18965
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
19062
18966
|
const unitId = workbook.getUnitId();
|
|
19063
18967
|
const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
|
|
19064
18968
|
const selectionProtectionRuleModel = accessor.get(_univerjs_sheets.RangeProtectionRuleModel);
|
|
19065
18969
|
const worksheetProtectionRuleModel = accessor.get(_univerjs_sheets.WorksheetProtectionRuleModel);
|
|
19066
18970
|
return (0, rxjs.combineLatest)([
|
|
19067
|
-
|
|
18971
|
+
permissionService.composePermission$([new _univerjs_sheets.WorkbookEditablePermission(unitId).id]).pipe((0, rxjs.map)((permissions) => permissions.every((permission) => permission.value))) ?? (0, rxjs.of)(false),
|
|
19068
18972
|
(0, rxjs.merge)(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe((0, rxjs.startWith)(null)),
|
|
19069
18973
|
selectionManagerService.selectionMoveEnd$
|
|
19070
18974
|
]).pipe((0, rxjs.map)(([permission, _, __]) => {
|
|
@@ -19079,7 +18983,6 @@ function getPermissionDisableBase$(accessor) {
|
|
|
19079
18983
|
}));
|
|
19080
18984
|
}
|
|
19081
18985
|
function getAddPermissionDisableBase$(accessor) {
|
|
19082
|
-
var _editorBridgeService$;
|
|
19083
18986
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
19084
18987
|
const permissionService = accessor.get(_univerjs_core.IPermissionService);
|
|
19085
18988
|
const workbook$ = univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
@@ -19089,10 +18992,10 @@ function getAddPermissionDisableBase$(accessor) {
|
|
|
19089
18992
|
bufferSize: 1,
|
|
19090
18993
|
refCount: true
|
|
19091
18994
|
}));
|
|
19092
|
-
const editorVisible$ = (
|
|
18995
|
+
const editorVisible$ = (editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.visible$.pipe((0, rxjs.startWith)(null), (0, rxjs.shareReplay)({
|
|
19093
18996
|
bufferSize: 1,
|
|
19094
18997
|
refCount: true
|
|
19095
|
-
})))
|
|
18998
|
+
}))) ?? (0, rxjs.of)(null);
|
|
19096
18999
|
return (0, rxjs.combineLatest)([
|
|
19097
19000
|
workbook$,
|
|
19098
19001
|
userManagerService.currentUser$,
|
|
@@ -19101,7 +19004,6 @@ function getAddPermissionDisableBase$(accessor) {
|
|
|
19101
19004
|
]).pipe((0, rxjs.switchMap)(([workbook, _, visible, formulaEditorFocus]) => {
|
|
19102
19005
|
if (!workbook || (visible === null || visible === void 0 ? void 0 : visible.visible) && visible.unitId === workbook.getUnitId() || formulaEditorFocus) return (0, rxjs.of)(true);
|
|
19103
19006
|
return workbook.activeSheet$.pipe((0, rxjs.switchMap)((worksheet) => {
|
|
19104
|
-
var _permissionService$co2;
|
|
19105
19007
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
19106
19008
|
const focusingDrawing$ = accessor.get(_univerjs_core.IContextService).subscribeContextValue$(_univerjs_core.FOCUSING_COMMON_DRAWINGS).pipe((0, rxjs.startWith)(false));
|
|
19107
19009
|
const unitId = workbook.getUnitId();
|
|
@@ -19110,7 +19012,7 @@ function getAddPermissionDisableBase$(accessor) {
|
|
|
19110
19012
|
const worksheetProtectionRuleModel = accessor.get(_univerjs_sheets.WorksheetProtectionRuleModel);
|
|
19111
19013
|
const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
|
|
19112
19014
|
return (0, rxjs.combineLatest)([
|
|
19113
|
-
|
|
19015
|
+
permissionService.composePermission$([new _univerjs_sheets.WorkbookCreateProtectPermission(unitId).id]).pipe((0, rxjs.map)((permissions) => permissions.every((permission) => permission.value))) ?? (0, rxjs.of)(false),
|
|
19114
19016
|
(0, rxjs.merge)(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe((0, rxjs.startWith)(null)),
|
|
19115
19017
|
selectionManagerService.selectionMoveEnd$,
|
|
19116
19018
|
focusingDrawing$
|
|
@@ -19139,13 +19041,12 @@ function getAddPermissionFromSheetBarDisable$(accessor) {
|
|
|
19139
19041
|
return (0, rxjs.combineLatest)([univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), accessor.get(_univerjs_core.UserManagerService).currentUser$]).pipe((0, rxjs.switchMap)(([workbook, _]) => {
|
|
19140
19042
|
if (!workbook) return (0, rxjs.of)(true);
|
|
19141
19043
|
return workbook.activeSheet$.pipe((0, rxjs.switchMap)((worksheet) => {
|
|
19142
|
-
var _permissionService$co3;
|
|
19143
19044
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
19144
19045
|
const unitId = workbook.getUnitId();
|
|
19145
19046
|
const subUnitId = worksheet.getSheetId();
|
|
19146
19047
|
const selectionProtectionRuleModel = accessor.get(_univerjs_sheets.RangeProtectionRuleModel);
|
|
19147
19048
|
const worksheetProtectionRuleModel = accessor.get(_univerjs_sheets.WorksheetProtectionRuleModel);
|
|
19148
|
-
return (0, rxjs.combineLatest)([
|
|
19049
|
+
return (0, rxjs.combineLatest)([permissionService.composePermission$([new _univerjs_sheets.WorkbookCreateProtectPermission(unitId).id]).pipe((0, rxjs.map)((permissions) => permissions.every((permission) => permission.value))) ?? (0, rxjs.of)(false), (0, rxjs.merge)(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe((0, rxjs.startWith)(null))]).pipe((0, rxjs.map)(([permission, _]) => {
|
|
19149
19050
|
var _selectionProtectionR;
|
|
19150
19051
|
if (!permission) return true;
|
|
19151
19052
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
@@ -19161,12 +19062,12 @@ function getRemovePermissionFromSheetBarDisable$(accessor) {
|
|
|
19161
19062
|
return (0, rxjs.combineLatest)([univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), accessor.get(_univerjs_core.UserManagerService).currentUser$]).pipe((0, rxjs.switchMap)(([workbook, _]) => {
|
|
19162
19063
|
if (!workbook) return (0, rxjs.of)(true);
|
|
19163
19064
|
return workbook.activeSheet$.pipe((0, rxjs.switchMap)((worksheet) => {
|
|
19164
|
-
var _permissionService$ge2
|
|
19065
|
+
var _permissionService$ge2;
|
|
19165
19066
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
19166
19067
|
const unitId = workbook.getUnitId();
|
|
19167
19068
|
const subUnitId = worksheet.getSheetId();
|
|
19168
19069
|
const worksheetProtectionRuleModel = accessor.get(_univerjs_sheets.WorksheetProtectionRuleModel);
|
|
19169
|
-
return (0, rxjs.combineLatest)([(_permissionService$ge2 =
|
|
19070
|
+
return (0, rxjs.combineLatest)([((_permissionService$ge2 = permissionService.getPermissionPoint$(new _univerjs_sheets.WorksheetDeleteProtectionPermission(unitId, subUnitId).id)) === null || _permissionService$ge2 === void 0 ? void 0 : _permissionService$ge2.pipe((0, rxjs.map)((e) => !!e.value))) ?? (0, rxjs.of)(false), worksheetProtectionRuleModel.ruleChange$.pipe((0, rxjs.startWith)(null))]).pipe((0, rxjs.map)(([permission, _]) => {
|
|
19170
19071
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
19171
19072
|
if (worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) return !permission;
|
|
19172
19073
|
return true;
|
|
@@ -19180,13 +19081,12 @@ function getSetPermissionFromSheetBarDisable$(accessor) {
|
|
|
19180
19081
|
return (0, rxjs.combineLatest)([univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), accessor.get(_univerjs_core.UserManagerService).currentUser$]).pipe((0, rxjs.switchMap)(([workbook, _]) => {
|
|
19181
19082
|
if (!workbook) return (0, rxjs.of)(true);
|
|
19182
19083
|
return workbook.activeSheet$.pipe((0, rxjs.switchMap)((worksheet) => {
|
|
19183
|
-
var _permissionService$co4;
|
|
19184
19084
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
19185
19085
|
const unitId = workbook.getUnitId();
|
|
19186
19086
|
const subUnitId = worksheet.getSheetId();
|
|
19187
19087
|
const selectionProtectionRuleModel = accessor.get(_univerjs_sheets.RangeProtectionRuleModel);
|
|
19188
19088
|
const worksheetProtectionRuleModel = accessor.get(_univerjs_sheets.WorksheetProtectionRuleModel);
|
|
19189
|
-
return (0, rxjs.combineLatest)([
|
|
19089
|
+
return (0, rxjs.combineLatest)([permissionService.composePermission$([new _univerjs_sheets.WorkbookCreateProtectPermission(unitId).id, new _univerjs_sheets.WorkbookManageCollaboratorPermission(unitId).id]).pipe((0, rxjs.map)((permissions) => permissions.every((permission) => permission.value))) ?? (0, rxjs.of)(false), (0, rxjs.merge)(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe((0, rxjs.startWith)(null))]).pipe((0, rxjs.map)(([permission, _]) => {
|
|
19190
19090
|
var _selectionProtectionR2;
|
|
19191
19091
|
if (!permission) return true;
|
|
19192
19092
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
@@ -19216,8 +19116,8 @@ function getRemovePermissionDisable$(accessor) {
|
|
|
19216
19116
|
if ((selectionRange === null || selectionRange === void 0 ? void 0 : selectionRange.rangeType) === _univerjs_core.RANGE_TYPE.ALL || (selectionRange === null || selectionRange === void 0 ? void 0 : selectionRange.rangeType) === _univerjs_core.RANGE_TYPE.COLUMN || (selectionRange === null || selectionRange === void 0 ? void 0 : selectionRange.rangeType) === _univerjs_core.RANGE_TYPE.ROW) return true;
|
|
19217
19117
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
19218
19118
|
if (worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) {
|
|
19219
|
-
var _permissionService$
|
|
19220
|
-
return ((_permissionService$
|
|
19119
|
+
var _permissionService$ge3;
|
|
19120
|
+
return ((_permissionService$ge3 = permissionService.getPermissionPoint(new _univerjs_sheets.WorksheetDeleteProtectionPermission(unitId, subUnitId).id)) === null || _permissionService$ge3 === void 0 ? void 0 : _permissionService$ge3.value) === false;
|
|
19221
19121
|
}
|
|
19222
19122
|
if (selectionProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).filter((rule) => {
|
|
19223
19123
|
return rule.ranges.some((range) => {
|
|
@@ -19236,14 +19136,13 @@ function getRemovePermissionDisable$(accessor) {
|
|
|
19236
19136
|
}));
|
|
19237
19137
|
}
|
|
19238
19138
|
function getViewPermissionDisable$(accessor) {
|
|
19239
|
-
var _editorBridgeService$2;
|
|
19240
19139
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
19241
19140
|
const permissionService = accessor.get(_univerjs_core.IPermissionService);
|
|
19242
19141
|
const workbook$ = univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
19243
19142
|
const userManagerService = accessor.get(_univerjs_core.UserManagerService);
|
|
19244
19143
|
const editorBridgeService = accessor.has(IEditorBridgeService) ? accessor.get(IEditorBridgeService) : null;
|
|
19245
19144
|
const formulaEditorFocus$ = accessor.get(_univerjs_core.IContextService).subscribeContextValue$(_univerjs_core.FOCUSING_FX_BAR_EDITOR);
|
|
19246
|
-
const editorVisible$ = (
|
|
19145
|
+
const editorVisible$ = (editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.visible$) ?? (0, rxjs.of)(null);
|
|
19247
19146
|
return (0, rxjs.combineLatest)([
|
|
19248
19147
|
workbook$,
|
|
19249
19148
|
userManagerService.currentUser$,
|
|
@@ -19252,10 +19151,10 @@ function getViewPermissionDisable$(accessor) {
|
|
|
19252
19151
|
]).pipe((0, rxjs.switchMap)(([workbook, _, visible, formulaEditorFocus]) => {
|
|
19253
19152
|
if (!workbook || (visible === null || visible === void 0 ? void 0 : visible.visible) && visible.unitId === workbook.getUnitId() || formulaEditorFocus) return (0, rxjs.of)(true);
|
|
19254
19153
|
return workbook.activeSheet$.pipe((0, rxjs.switchMap)((worksheet) => {
|
|
19255
|
-
var _permissionService$
|
|
19154
|
+
var _permissionService$ge4;
|
|
19256
19155
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
19257
19156
|
const unitId = workbook.getUnitId();
|
|
19258
|
-
return ((
|
|
19157
|
+
return (((_permissionService$ge4 = permissionService.getPermissionPoint$(new _univerjs_sheets.WorkbookEditablePermission(unitId).id)) === null || _permissionService$ge4 === void 0 ? void 0 : _permissionService$ge4.pipe((0, rxjs.map)((e) => !!e.value))) ?? (0, rxjs.of)(false)).pipe((0, rxjs.map)((permission) => !permission));
|
|
19259
19158
|
}));
|
|
19260
19159
|
}));
|
|
19261
19160
|
}
|
|
@@ -19686,7 +19585,7 @@ const menuSchema = {
|
|
|
19686
19585
|
order: 0,
|
|
19687
19586
|
gridLayout: {
|
|
19688
19587
|
row: 1,
|
|
19689
|
-
column:
|
|
19588
|
+
column: 1
|
|
19690
19589
|
},
|
|
19691
19590
|
menuItemFactory: HorizontalAlignMenuItemFactory
|
|
19692
19591
|
},
|
|
@@ -19751,7 +19650,9 @@ const menuSchema = {
|
|
|
19751
19650
|
order: 0,
|
|
19752
19651
|
gridLayout: {
|
|
19753
19652
|
row: 1,
|
|
19754
|
-
column:
|
|
19653
|
+
column: 1,
|
|
19654
|
+
rowSpan: 2,
|
|
19655
|
+
showLabel: true
|
|
19755
19656
|
},
|
|
19756
19657
|
menuItemFactory: sheetPermissionToolbarMenuFactory
|
|
19757
19658
|
} }
|
|
@@ -20323,18 +20224,12 @@ function AutoFillPopupMenu() {
|
|
|
20323
20224
|
const selected = (0, _univerjs_ui.useObservable)(autoFillService.applyType$, _univerjs_sheets.AUTO_FILL_APPLY_TYPE.SERIES);
|
|
20324
20225
|
const [isHovered, setHovered] = (0, react.useState)(false);
|
|
20325
20226
|
const workbook = useActiveWorkbook();
|
|
20326
|
-
const
|
|
20227
|
+
const sheetSkeletonManagerService = (0, react.useMemo)(() => {
|
|
20327
20228
|
if (workbook) {
|
|
20328
|
-
const ru = renderManagerService.
|
|
20329
|
-
return
|
|
20330
|
-
sheetSkeletonManagerService: ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService),
|
|
20331
|
-
selectionRenderService: ru === null || ru === void 0 ? void 0 : ru.with(ISheetSelectionRenderService)
|
|
20332
|
-
};
|
|
20229
|
+
const ru = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
20230
|
+
return ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService);
|
|
20333
20231
|
}
|
|
20334
|
-
return
|
|
20335
|
-
sheetSkeletonManagerService: null,
|
|
20336
|
-
selectionRenderService: null
|
|
20337
|
-
};
|
|
20232
|
+
return null;
|
|
20338
20233
|
}, [workbook, renderManagerService]);
|
|
20339
20234
|
const handleMouseEnter = () => {
|
|
20340
20235
|
setHovered(true);
|
|
@@ -20365,10 +20260,11 @@ function AutoFillPopupMenu() {
|
|
|
20365
20260
|
}, [visible]);
|
|
20366
20261
|
if (anchor.col < 0 || anchor.row < 0) return null;
|
|
20367
20262
|
const sheetObject = getSheetObject(univerInstanceService, renderManagerService);
|
|
20368
|
-
if (!sheetObject || !
|
|
20263
|
+
if (!sheetObject || !workbook) return null;
|
|
20369
20264
|
const { scene } = sheetObject;
|
|
20370
20265
|
const skeleton = sheetSkeletonManagerService === null || sheetSkeletonManagerService === void 0 ? void 0 : sheetSkeletonManagerService.getCurrentSkeleton();
|
|
20371
|
-
const viewport =
|
|
20266
|
+
const viewport = getViewportByCell(anchor.row, anchor.col, scene, workbook.getActiveSheet());
|
|
20267
|
+
if (!viewport) return null;
|
|
20372
20268
|
const scaleX = scene === null || scene === void 0 ? void 0 : scene.scaleX;
|
|
20373
20269
|
const scaleY = scene === null || scene === void 0 ? void 0 : scene.scaleY;
|
|
20374
20270
|
const scrollXY = scene === null || scene === void 0 ? void 0 : scene.getViewportScrollXY(viewport);
|
|
@@ -20434,8 +20330,7 @@ function focusSheetCellEditorElement(ownerDocument = document) {
|
|
|
20434
20330
|
return ownerDocument.activeElement === element;
|
|
20435
20331
|
}
|
|
20436
20332
|
function registerSheetCellEditorRuntimePortal(options) {
|
|
20437
|
-
|
|
20438
|
-
const ownerDocument = (_options$ownerDocumen = options.ownerDocument) !== null && _options$ownerDocumen !== void 0 ? _options$ownerDocumen : typeof document === "undefined" ? void 0 : document;
|
|
20333
|
+
const ownerDocument = options.ownerDocument ?? (typeof document === "undefined" ? void 0 : document);
|
|
20439
20334
|
if (!ownerDocument) return (0, _univerjs_core.toDisposable)(() => {});
|
|
20440
20335
|
const collection = new _univerjs_core.DisposableCollection();
|
|
20441
20336
|
const view = ownerDocument.defaultView;
|
|
@@ -20505,8 +20400,7 @@ function registerSheetCellEditorRuntimePortal(options) {
|
|
|
20505
20400
|
return collection;
|
|
20506
20401
|
}
|
|
20507
20402
|
function resolveSheetCellEditorPortalRoot(ownerDocument = document) {
|
|
20508
|
-
|
|
20509
|
-
return (_ref = ownerDocument.getElementById(SHEET_CELL_EDITOR_SELECTION_CONTAINER_ID)) !== null && _ref !== void 0 ? _ref : ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
|
|
20403
|
+
return ownerDocument.getElementById(SHEET_CELL_EDITOR_SELECTION_CONTAINER_ID) ?? ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
|
|
20510
20404
|
}
|
|
20511
20405
|
|
|
20512
20406
|
//#endregion
|
|
@@ -20595,27 +20489,27 @@ function isEmbedRuntimeInteractiveElement(element) {
|
|
|
20595
20489
|
return role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20596
20490
|
}
|
|
20597
20491
|
function shouldPreserveEmbedPopupFocus(embedId, ownerDocument) {
|
|
20598
|
-
var _activeElement$
|
|
20492
|
+
var _activeElement$closes;
|
|
20599
20493
|
if (!embedId) return false;
|
|
20600
20494
|
const activeElement = ownerDocument.activeElement;
|
|
20601
20495
|
if (!(activeElement instanceof HTMLElement)) return false;
|
|
20602
20496
|
if (!activeElement.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`)) return false;
|
|
20603
|
-
const role =
|
|
20497
|
+
const role = activeElement.getAttribute("data-embed-runtime-focus-role") ?? ((_activeElement$closes = activeElement.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _activeElement$closes === void 0 ? void 0 : _activeElement$closes.getAttribute("data-embed-runtime-focus-role"));
|
|
20604
20498
|
return role === "child-popup" || role === "floating-menu";
|
|
20605
20499
|
}
|
|
20606
20500
|
function shouldPreserveEmbedInteractiveFocus(embedId, ownerDocument) {
|
|
20607
|
-
var _activeElement$
|
|
20501
|
+
var _activeElement$closes2;
|
|
20608
20502
|
if (!embedId) return false;
|
|
20609
20503
|
const activeElement = ownerDocument.activeElement;
|
|
20610
20504
|
if (!(activeElement instanceof HTMLElement)) return false;
|
|
20611
20505
|
if (!activeElement.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`)) return false;
|
|
20612
|
-
const role =
|
|
20506
|
+
const role = activeElement.getAttribute("data-embed-runtime-focus-role") ?? ((_activeElement$closes2 = activeElement.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _activeElement$closes2 === void 0 ? void 0 : _activeElement$closes2.getAttribute("data-embed-runtime-focus-role"));
|
|
20613
20507
|
return role == null && activeElement.tagName !== "CANVAS" || role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20614
20508
|
}
|
|
20615
20509
|
function isEmbedRuntimeEditorOrPopup(target) {
|
|
20616
|
-
var _target$
|
|
20510
|
+
var _target$closest;
|
|
20617
20511
|
if (!(target instanceof HTMLElement)) return false;
|
|
20618
|
-
const role =
|
|
20512
|
+
const role = target.getAttribute("data-embed-runtime-focus-role") ?? ((_target$closest = target.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _target$closest === void 0 ? void 0 : _target$closest.getAttribute("data-embed-runtime-focus-role"));
|
|
20619
20513
|
return role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20620
20514
|
}
|
|
20621
20515
|
/**
|
|
@@ -20633,6 +20527,7 @@ function EditorContainer() {
|
|
|
20633
20527
|
const componentManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.ComponentManager);
|
|
20634
20528
|
const editorBridgeService = (0, _univerjs_ui.useDependency)(IEditorBridgeService);
|
|
20635
20529
|
const cellEditorResizeService = (0, _univerjs_ui.useDependency)(SheetCellEditorResizeService);
|
|
20530
|
+
const renderManagerService = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService);
|
|
20636
20531
|
const rootRef = (0, react.useRef)(null);
|
|
20637
20532
|
const pointerRefocusTimerRef = (0, react.useRef)(void 0);
|
|
20638
20533
|
const visible = (0, _univerjs_ui.useObservable)(editorBridgeService.visible$);
|
|
@@ -20641,6 +20536,9 @@ function EditorContainer() {
|
|
|
20641
20536
|
const FormulaEditor = componentManager.get(EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY);
|
|
20642
20537
|
const editState = (0, _univerjs_ui.useObservable)(editorBridgeService.currentEditCellState$);
|
|
20643
20538
|
const darkMode = (0, _univerjs_ui.useObservable)(themeService.darkMode$, themeService.darkMode);
|
|
20539
|
+
const [showEditCellAddress, setShowEditCellAddress] = (0, react.useState)(false);
|
|
20540
|
+
const editCellAddress = editState ? `${(0, _univerjs_core.numberToABC)(editState.column)}${editState.row + 1}` : null;
|
|
20541
|
+
const editorBorderColor = genNormalSelectionStyle(themeService).stroke;
|
|
20644
20542
|
const focusCoordinator = injector.has(ISheetEmbedRuntimeFocusCoordinator) ? injector.get(ISheetEmbedRuntimeFocusCoordinator) : void 0;
|
|
20645
20543
|
const resolveRuntimeFocusState = () => {
|
|
20646
20544
|
var _instanceService$getF;
|
|
@@ -20657,6 +20555,24 @@ function EditorContainer() {
|
|
|
20657
20555
|
instanceService,
|
|
20658
20556
|
visible === null || visible === void 0 ? void 0 : visible.unitId
|
|
20659
20557
|
]);
|
|
20558
|
+
(0, react.useEffect)(() => {
|
|
20559
|
+
var _renderManagerService;
|
|
20560
|
+
setShowEditCellAddress(false);
|
|
20561
|
+
if (!(visible === null || visible === void 0 ? void 0 : visible.visible) || !(editState === null || editState === void 0 ? void 0 : editState.unitId)) return;
|
|
20562
|
+
const scrollManagerService = (_renderManagerService = renderManagerService.getRenderUnitById(editState.unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(SheetScrollManagerService);
|
|
20563
|
+
if (!scrollManagerService) return;
|
|
20564
|
+
const subscription = scrollManagerService.validViewportScrollInfo$.pipe((0, rxjs.skip)(1)).subscribe((scrollInfo) => {
|
|
20565
|
+
if (scrollInfo) setShowEditCellAddress(true);
|
|
20566
|
+
});
|
|
20567
|
+
return () => subscription.unsubscribe();
|
|
20568
|
+
}, [
|
|
20569
|
+
editState === null || editState === void 0 ? void 0 : editState.column,
|
|
20570
|
+
editState === null || editState === void 0 ? void 0 : editState.row,
|
|
20571
|
+
editState === null || editState === void 0 ? void 0 : editState.sheetId,
|
|
20572
|
+
editState === null || editState === void 0 ? void 0 : editState.unitId,
|
|
20573
|
+
renderManagerService,
|
|
20574
|
+
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20575
|
+
]);
|
|
20660
20576
|
(0, react.useEffect)(() => {
|
|
20661
20577
|
const subscription = cellEditorManagerService.state$.subscribe((param) => {
|
|
20662
20578
|
if (param == null) return;
|
|
@@ -20693,18 +20609,17 @@ function EditorContainer() {
|
|
|
20693
20609
|
if (!disableAutoFocus) cellEditorManagerService.setFocus(true);
|
|
20694
20610
|
}, [disableAutoFocus, state]);
|
|
20695
20611
|
(0, react.useEffect)(() => {
|
|
20696
|
-
var _rootRef$current
|
|
20612
|
+
var _rootRef$current;
|
|
20697
20613
|
if (!(visible === null || visible === void 0 ? void 0 : visible.visible)) return;
|
|
20698
20614
|
cellEditorResizeService.fitTextSize();
|
|
20699
20615
|
if (contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR)) return;
|
|
20700
|
-
const ownerDocument = (
|
|
20701
|
-
const ownerWindow =
|
|
20616
|
+
const ownerDocument = ((_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.ownerDocument) ?? document;
|
|
20617
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
20702
20618
|
let focusRetryFrame = 0;
|
|
20703
20619
|
let finalFocusRetryFrame = 0;
|
|
20704
20620
|
let delayedFocusTimer;
|
|
20705
20621
|
const focusCellEditorElement = () => {
|
|
20706
|
-
|
|
20707
|
-
const scope = rootRef.current ? (_resolveSheetEmbedRun = resolveSheetEmbedRuntimeDomScope(rootRef.current)) !== null && _resolveSheetEmbedRun !== void 0 ? _resolveSheetEmbedRun : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
20622
|
+
const scope = rootRef.current ? resolveSheetEmbedRuntimeDomScope(rootRef.current) ?? resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
20708
20623
|
if (shouldPreserveEmbedInteractiveFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
20709
20624
|
focusSheetCellEditorElement(ownerDocument);
|
|
20710
20625
|
if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
|
|
@@ -20715,9 +20630,8 @@ function EditorContainer() {
|
|
|
20715
20630
|
}, 0);
|
|
20716
20631
|
};
|
|
20717
20632
|
const focusEditor = () => {
|
|
20718
|
-
var _resolveSheetEmbedRun2;
|
|
20719
20633
|
if (contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR)) return;
|
|
20720
|
-
const scope = rootRef.current ?
|
|
20634
|
+
const scope = rootRef.current ? resolveSheetEmbedRuntimeDomScope(rootRef.current) ?? resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
20721
20635
|
if (shouldPreserveEmbedPopupFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
20722
20636
|
const editor = editorService.getEditor(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
20723
20637
|
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
@@ -20740,7 +20654,6 @@ function EditorContainer() {
|
|
|
20740
20654
|
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20741
20655
|
]);
|
|
20742
20656
|
(0, react.useEffect)(() => {
|
|
20743
|
-
var _ref;
|
|
20744
20657
|
if (!(visible === null || visible === void 0 ? void 0 : visible.visible) || !rootRef.current || !focusCoordinator) return;
|
|
20745
20658
|
const rootRuntimeScope = resolveSheetEmbedRuntimeDomScope(rootRef.current);
|
|
20746
20659
|
const unitRuntimeScope = [
|
|
@@ -20750,9 +20663,9 @@ function EditorContainer() {
|
|
|
20750
20663
|
].find((resolvedScope) => resolvedScope != null);
|
|
20751
20664
|
if (rootRuntimeScope && unitRuntimeScope && rootRuntimeScope.embedId !== unitRuntimeScope.embedId) return;
|
|
20752
20665
|
const activeSessionScope = runtimeFocusState.activeSessionScope;
|
|
20753
|
-
const explicitRuntimeScope = unitRuntimeScope
|
|
20666
|
+
const explicitRuntimeScope = unitRuntimeScope ?? rootRuntimeScope;
|
|
20754
20667
|
if (activeSessionScope && rootRuntimeScope && !unitRuntimeScope && rootRuntimeScope.embedId !== activeSessionScope.embedId) return;
|
|
20755
|
-
const scope =
|
|
20668
|
+
const scope = explicitRuntimeScope ?? activeSessionScope ?? resolveActiveSheetEmbedRuntimeDomScope(rootRef.current.ownerDocument);
|
|
20756
20669
|
if (!scope) return;
|
|
20757
20670
|
const collection = new _univerjs_core.DisposableCollection();
|
|
20758
20671
|
const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
|
|
@@ -20812,12 +20725,12 @@ function EditorContainer() {
|
|
|
20812
20725
|
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20813
20726
|
]);
|
|
20814
20727
|
(0, react.useEffect)(() => {
|
|
20815
|
-
var _rootRef$
|
|
20728
|
+
var _rootRef$current2;
|
|
20816
20729
|
if ((visible === null || visible === void 0 ? void 0 : visible.visible) || !focusCoordinator) return;
|
|
20817
20730
|
const activeSessionScope = runtimeFocusState.activeSessionScope;
|
|
20818
20731
|
const childUnitId = activeSessionScope === null || activeSessionScope === void 0 ? void 0 : activeSessionScope.childUnitId;
|
|
20819
20732
|
if (!activeSessionScope || activeSessionScope.childType !== _univerjs_core.UniverInstanceType.UNIVER_SHEET || !childUnitId || !instanceService.getUnit(childUnitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) return;
|
|
20820
|
-
const ownerDocument = (
|
|
20733
|
+
const ownerDocument = ((_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.ownerDocument) ?? document;
|
|
20821
20734
|
const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
|
|
20822
20735
|
const portalRegistration = registerSheetCellEditorRuntimePortal({
|
|
20823
20736
|
embedId: activeSessionScope.embedId,
|
|
@@ -20825,7 +20738,7 @@ function EditorContainer() {
|
|
|
20825
20738
|
interactionBoundaryService,
|
|
20826
20739
|
focusCoordinator
|
|
20827
20740
|
});
|
|
20828
|
-
const ownerWindow =
|
|
20741
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
20829
20742
|
let delayedFocusTimer;
|
|
20830
20743
|
const focusCellEditorElement = () => {
|
|
20831
20744
|
if (shouldPreserveEmbedInteractiveFocus(activeSessionScope.embedId, ownerDocument)) return;
|
|
@@ -20886,10 +20799,10 @@ function EditorContainer() {
|
|
|
20886
20799
|
};
|
|
20887
20800
|
}, []);
|
|
20888
20801
|
const refocusEditorAfterPointerDown = (0, _univerjs_ui.useEvent)((event) => {
|
|
20889
|
-
var _rootRef$
|
|
20802
|
+
var _rootRef$current4;
|
|
20890
20803
|
if (!(visible === null || visible === void 0 ? void 0 : visible.visible)) return;
|
|
20891
|
-
const ownerDocument = (
|
|
20892
|
-
const ownerWindow =
|
|
20804
|
+
const ownerDocument = ((_rootRef$current4 = rootRef.current) === null || _rootRef$current4 === void 0 ? void 0 : _rootRef$current4.ownerDocument) ?? document;
|
|
20805
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
20893
20806
|
const editor = editorService.getEditor(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
20894
20807
|
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
20895
20808
|
const pointerTarget = event.target;
|
|
@@ -20924,7 +20837,7 @@ function EditorContainer() {
|
|
|
20924
20837
|
unitId: editState === null || editState === void 0 ? void 0 : editState.unitId
|
|
20925
20838
|
});
|
|
20926
20839
|
});
|
|
20927
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.
|
|
20840
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
20928
20841
|
ref: rootRef,
|
|
20929
20842
|
"data-u-comp": "editor",
|
|
20930
20843
|
className: "univer-absolute univer-z-10 univer-flex",
|
|
@@ -20939,7 +20852,16 @@ function EditorContainer() {
|
|
|
20939
20852
|
getColorFromTheme: themeService.getColorFromTheme.bind(themeService)
|
|
20940
20853
|
})
|
|
20941
20854
|
},
|
|
20942
|
-
children:
|
|
20855
|
+
children: [(visible === null || visible === void 0 ? void 0 : visible.visible) && showEditCellAddress && editCellAddress && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
20856
|
+
"data-u-comp": "sheet-cell-editor-address",
|
|
20857
|
+
className: "univer-pointer-events-none univer-absolute univer-left-0 univer-top-0 univer-z-10 univer-whitespace-nowrap univer-rounded-t univer-px-1.5 univer-text-xs univer-leading-5",
|
|
20858
|
+
style: {
|
|
20859
|
+
backgroundColor: editorBorderColor,
|
|
20860
|
+
color: themeService.getColorFromTheme("white"),
|
|
20861
|
+
transform: "translateY(-100%)"
|
|
20862
|
+
},
|
|
20863
|
+
children: editCellAddress
|
|
20864
|
+
}), FormulaEditor && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormulaEditor, {
|
|
20943
20865
|
editorId: _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
20944
20866
|
className: "univer-relative univer-flex univer-size-full [&_canvas]:univer-absolute",
|
|
20945
20867
|
initValue: "",
|
|
@@ -20959,7 +20881,7 @@ function EditorContainer() {
|
|
|
20959
20881
|
},
|
|
20960
20882
|
disableContextMenu: false,
|
|
20961
20883
|
canvasStyle: { backgroundColor: "transparent" }
|
|
20962
|
-
})
|
|
20884
|
+
})]
|
|
20963
20885
|
});
|
|
20964
20886
|
}
|
|
20965
20887
|
|
|
@@ -21157,7 +21079,8 @@ function DefinedName({ disable }) {
|
|
|
21157
21079
|
const definedNames = (0, _univerjs_ui.useObservable)(() => definedNamesService.update$.pipe((0, rxjs.map)(getDefinedNameMap), (0, rxjs.startWith)(getDefinedNameMap())), getDefinedNameMap(), false, [definedNamesService, unitId]);
|
|
21158
21080
|
(0, react.useEffect)(() => {
|
|
21159
21081
|
const subscription = definedNamesService.currentRange$.subscribe(() => {
|
|
21160
|
-
const
|
|
21082
|
+
const selections = selectionManagerService.getCurrentSelections();
|
|
21083
|
+
const absoluteRef = getAbsoluteRefStringFromSelection(workbook, selections, lexerTreeBuilder);
|
|
21161
21084
|
const definedName = definedNamesService.getDefinedNameByRefString(unitId, absoluteRef);
|
|
21162
21085
|
if (definedName) {
|
|
21163
21086
|
setRangeString(definedName.name);
|
|
@@ -21302,7 +21225,7 @@ function DefinedName({ disable }) {
|
|
|
21302
21225
|
//#endregion
|
|
21303
21226
|
//#region src/views/formula-bar/FormulaBar.tsx
|
|
21304
21227
|
function FormulaBar(props) {
|
|
21305
|
-
var
|
|
21228
|
+
var _editState$documentLa;
|
|
21306
21229
|
const { className, disableDefinedName } = props;
|
|
21307
21230
|
const editorBridgeService = (0, _univerjs_ui.useDependency)(IEditorBridgeService);
|
|
21308
21231
|
const iconActivated = (0, _univerjs_ui.useObservable)(() => editorBridgeService.visible$.pipe((0, rxjs.map)((visibleInfo) => visibleInfo.visible)), false, false, [editorBridgeService]);
|
|
@@ -21353,21 +21276,20 @@ function FormulaBar(props) {
|
|
|
21353
21276
|
}));
|
|
21354
21277
|
}), (0, rxjs.map)((cellInfo) => {
|
|
21355
21278
|
if (cellInfo) {
|
|
21356
|
-
var _cellInfoWithPermissi, _cellInfoWithPermissi2;
|
|
21357
21279
|
const { unitId, subUnitId, primary } = cellInfo;
|
|
21358
21280
|
if (worksheetProtectionRuleModel.getRule(unitId, subUnitId)) {
|
|
21359
|
-
var _permissionService$ge, _permissionService$ge2
|
|
21360
|
-
const editDisable = !((_permissionService$ge =
|
|
21281
|
+
var _permissionService$ge, _permissionService$ge2;
|
|
21282
|
+
const editDisable = !(((_permissionService$ge = permissionService.getPermissionPoint(new _univerjs_sheets.WorksheetEditPermission(unitId, subUnitId).id)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value) ?? true);
|
|
21361
21283
|
return {
|
|
21362
|
-
viewDisable: !((
|
|
21284
|
+
viewDisable: !(((_permissionService$ge2 = permissionService.getPermissionPoint(new _univerjs_sheets.WorksheetViewPermission(unitId, subUnitId).id)) === null || _permissionService$ge2 === void 0 ? void 0 : _permissionService$ge2.value) ?? true),
|
|
21363
21285
|
editDisable
|
|
21364
21286
|
};
|
|
21365
21287
|
}
|
|
21366
21288
|
const { actualRow, actualColumn } = primary;
|
|
21367
21289
|
const cellInfoWithPermission = rangeProtectionCache.getCellInfo(unitId, subUnitId, actualRow, actualColumn);
|
|
21368
21290
|
return {
|
|
21369
|
-
editDisable: !((
|
|
21370
|
-
viewDisable: !((
|
|
21291
|
+
editDisable: !((cellInfoWithPermission === null || cellInfoWithPermission === void 0 ? void 0 : cellInfoWithPermission[_univerjs_protocol.UnitAction.Edit]) ?? true),
|
|
21292
|
+
viewDisable: !((cellInfoWithPermission === null || cellInfoWithPermission === void 0 ? void 0 : cellInfoWithPermission[_univerjs_protocol.UnitAction.View]) ?? true)
|
|
21371
21293
|
};
|
|
21372
21294
|
}
|
|
21373
21295
|
return {
|
|
@@ -21425,7 +21347,7 @@ function FormulaBar(props) {
|
|
|
21425
21347
|
}
|
|
21426
21348
|
const { viewDisable, editDisable: permissionEditDisable } = disableInfo;
|
|
21427
21349
|
const editDisable = permissionEditDisable || !!disableEdit;
|
|
21428
|
-
const workbookEditDisable = !((
|
|
21350
|
+
const workbookEditDisable = !((workbookEditablePermission === null || workbookEditablePermission === void 0 ? void 0 : workbookEditablePermission.value) ?? true);
|
|
21429
21351
|
const editorActivationDisable = editDisable || workbookEditDisable;
|
|
21430
21352
|
const disabled = editDisable || imageDisable;
|
|
21431
21353
|
const shouldSkipFocus = (0, react.useRef)(false);
|
|
@@ -21458,7 +21380,7 @@ function FormulaBar(props) {
|
|
|
21458
21380
|
}, 30);
|
|
21459
21381
|
shouldSkipFocus.current = false;
|
|
21460
21382
|
};
|
|
21461
|
-
const hideEditor = ((
|
|
21383
|
+
const hideEditor = (0, _univerjs_sheets.isCellImage)(editState === null || editState === void 0 || (_editState$documentLa = editState.documentLayoutObject.documentModel) === null || _editState$documentLa === void 0 ? void 0 : _editState$documentLa.getSnapshot()) || viewDisable;
|
|
21462
21384
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21463
21385
|
"data-u-comp": "formula-bar",
|
|
21464
21386
|
className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-bg-white univer-transition-[height] univer-ease-linear dark:!univer-bg-gray-800", _univerjs_design.borderBottomClassName, className, {
|
|
@@ -21469,7 +21391,7 @@ function FormulaBar(props) {
|
|
|
21469
21391
|
children: [
|
|
21470
21392
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21471
21393
|
className: "univer-relative univer-box-border univer-h-full univer-w-[100px]",
|
|
21472
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefinedName, { disable: disableDefinedName
|
|
21394
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefinedName, { disable: disableDefinedName ?? editDisable })
|
|
21473
21395
|
}),
|
|
21474
21396
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21475
21397
|
className: "univer-flex univer-size-full",
|
|
@@ -21591,7 +21513,7 @@ function SheetBarMenu() {
|
|
|
21591
21513
|
if (!workbook) return;
|
|
21592
21514
|
const sheets = workbook.getSheets();
|
|
21593
21515
|
const activeSheet = workbook.getActiveSheet();
|
|
21594
|
-
|
|
21516
|
+
const worksheetMenuItems = sheets.map((sheet, index) => {
|
|
21595
21517
|
return {
|
|
21596
21518
|
label: sheet.getName(),
|
|
21597
21519
|
index: `${index}`,
|
|
@@ -21599,7 +21521,8 @@ function SheetBarMenu() {
|
|
|
21599
21521
|
hidden: sheet.isSheetHidden() === _univerjs_core.BooleanNumber.TRUE,
|
|
21600
21522
|
selected: activeSheet === sheet
|
|
21601
21523
|
};
|
|
21602
|
-
})
|
|
21524
|
+
});
|
|
21525
|
+
setMenu(worksheetMenuItems);
|
|
21603
21526
|
}, [workbook, worksheetProtectionRuleModel]);
|
|
21604
21527
|
const setupStatusUpdate = (0, react.useCallback)(() => commandService.onCommandExecuted((commandInfo) => {
|
|
21605
21528
|
switch (commandInfo.id) {
|
|
@@ -21674,7 +21597,7 @@ function SheetBarItem(props) {
|
|
|
21674
21597
|
"data-id": sheetId,
|
|
21675
21598
|
role: "tab",
|
|
21676
21599
|
"aria-selected": currentSelected,
|
|
21677
|
-
tabIndex: tabIndex
|
|
21600
|
+
tabIndex: tabIndex ?? (currentSelected ? 0 : -1),
|
|
21678
21601
|
onKeyDown,
|
|
21679
21602
|
onClick,
|
|
21680
21603
|
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", {
|
|
@@ -21712,9 +21635,8 @@ function SheetBarTabsContextMenu(props) {
|
|
|
21712
21635
|
menuOffset: MENU_OFFSET,
|
|
21713
21636
|
onRequestClose: () => onVisibleChange(false),
|
|
21714
21637
|
onOptionSelect: (option) => {
|
|
21715
|
-
var _ref;
|
|
21716
21638
|
const { label, id, commandId, value } = option;
|
|
21717
|
-
onCommandSelect(
|
|
21639
|
+
onCommandSelect(commandId ?? id ?? label, value);
|
|
21718
21640
|
}
|
|
21719
21641
|
})] });
|
|
21720
21642
|
}
|
|
@@ -21878,8 +21800,7 @@ var Animate = class {
|
|
|
21878
21800
|
//#region src/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-name-editor.ts
|
|
21879
21801
|
const MAX_SHEET_NAME_LENGTH = 31;
|
|
21880
21802
|
function getEditorText(input) {
|
|
21881
|
-
|
|
21882
|
-
return (_input$textContent = input.textContent) !== null && _input$textContent !== void 0 ? _input$textContent : "";
|
|
21803
|
+
return input.textContent ?? "";
|
|
21883
21804
|
}
|
|
21884
21805
|
function keepLastTextIndex(inputHtml) {
|
|
21885
21806
|
setTimeout(() => {
|
|
@@ -22062,10 +21983,9 @@ var SlideTabItem = class SlideTabItem {
|
|
|
22062
21983
|
});
|
|
22063
21984
|
}
|
|
22064
21985
|
nameCheck() {
|
|
22065
|
-
var _input$textContent;
|
|
22066
21986
|
const input = this._slideTabItem.querySelector("span");
|
|
22067
21987
|
if (!input) return false;
|
|
22068
|
-
const text =
|
|
21988
|
+
const text = input.textContent ?? "";
|
|
22069
21989
|
return this._slideTabBar.getConfig().onNameCheckAlert(text, this.getId());
|
|
22070
21990
|
}
|
|
22071
21991
|
animate() {
|
|
@@ -22185,23 +22105,21 @@ var SlideTabItem = class SlideTabItem {
|
|
|
22185
22105
|
var SlideScrollbar = class {
|
|
22186
22106
|
constructor(slideTabBar) {
|
|
22187
22107
|
_defineProperty(this, "_slideTabBar", void 0);
|
|
22188
|
-
_defineProperty(this, "_scrollX", void 0);
|
|
22189
|
-
const primeval = slideTabBar.primeval();
|
|
22190
|
-
this._scrollX = primeval.scrollLeft;
|
|
22191
22108
|
this._slideTabBar = slideTabBar;
|
|
22192
22109
|
}
|
|
22193
22110
|
scrollX(x) {
|
|
22111
|
+
var _primeval$parentEleme;
|
|
22194
22112
|
const primeval = this._slideTabBar.primeval();
|
|
22195
|
-
primeval.
|
|
22196
|
-
|
|
22113
|
+
const viewportWidth = ((_primeval$parentEleme = primeval.parentElement) === null || _primeval$parentEleme === void 0 ? void 0 : _primeval$parentEleme.clientWidth) ?? primeval.clientWidth;
|
|
22114
|
+
const maxScrollX = Math.max(0, primeval.scrollWidth - viewportWidth);
|
|
22115
|
+
primeval.scrollLeft = Math.min(maxScrollX, Math.max(0, x));
|
|
22197
22116
|
}
|
|
22198
22117
|
scrollRight() {
|
|
22199
22118
|
const primeval = this._slideTabBar.primeval();
|
|
22200
|
-
|
|
22201
|
-
this._scrollX = primeval.scrollLeft;
|
|
22119
|
+
this.scrollX(primeval.scrollWidth);
|
|
22202
22120
|
}
|
|
22203
22121
|
getScrollX() {
|
|
22204
|
-
return this.
|
|
22122
|
+
return this._slideTabBar.primeval().scrollLeft;
|
|
22205
22123
|
}
|
|
22206
22124
|
};
|
|
22207
22125
|
var SlideTabBar = class SlideTabBar {
|
|
@@ -22340,7 +22258,14 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22340
22258
|
}
|
|
22341
22259
|
};
|
|
22342
22260
|
this._wheelAction = (wheelEvent) => {
|
|
22343
|
-
|
|
22261
|
+
var _this$_slideTabBar$pa;
|
|
22262
|
+
const viewportWidth = ((_this$_slideTabBar$pa = this._slideTabBar.parentElement) === null || _this$_slideTabBar$pa === void 0 ? void 0 : _this$_slideTabBar$pa.clientWidth) ?? this._slideTabBar.clientWidth;
|
|
22263
|
+
if (this._slideTabBar.scrollWidth <= viewportWidth) return;
|
|
22264
|
+
const dominantDelta = Math.abs(wheelEvent.deltaX) > Math.abs(wheelEvent.deltaY) ? wheelEvent.deltaX : wheelEvent.deltaY;
|
|
22265
|
+
if (dominantDelta === 0) return;
|
|
22266
|
+
const deltaModeMultiplier = wheelEvent.deltaMode === WheelEvent.DOM_DELTA_LINE ? 16 : wheelEvent.deltaMode === WheelEvent.DOM_DELTA_PAGE ? viewportWidth : 1;
|
|
22267
|
+
wheelEvent.preventDefault();
|
|
22268
|
+
this.setScroll(dominantDelta * deltaModeMultiplier);
|
|
22344
22269
|
};
|
|
22345
22270
|
this.addListener();
|
|
22346
22271
|
}
|
|
@@ -22395,15 +22320,15 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22395
22320
|
return this._activeTabItem;
|
|
22396
22321
|
}
|
|
22397
22322
|
isLeftEnd() {
|
|
22398
|
-
return this._slideTabBar.scrollLeft
|
|
22323
|
+
return this._slideTabBar.scrollLeft <= 1;
|
|
22399
22324
|
}
|
|
22400
22325
|
isRightEnd() {
|
|
22401
22326
|
const parent = this._slideTabBar.parentElement;
|
|
22402
22327
|
if (!parent) return false;
|
|
22403
|
-
return this._slideTabBar.scrollWidth - parent.clientWidth
|
|
22328
|
+
return Math.max(0, this._slideTabBar.scrollWidth - parent.clientWidth) - this._slideTabBar.scrollLeft <= 1;
|
|
22404
22329
|
}
|
|
22405
22330
|
addListener() {
|
|
22406
|
-
this._slideTabBar.addEventListener("wheel", this._wheelAction);
|
|
22331
|
+
this._slideTabBar.addEventListener("wheel", this._wheelAction, { passive: false });
|
|
22407
22332
|
this._slideTabItems.forEach((item) => {
|
|
22408
22333
|
item.addEventListener("pointerdown", this._downAction);
|
|
22409
22334
|
});
|
|
@@ -22416,13 +22341,6 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22416
22341
|
}
|
|
22417
22342
|
setScroll(x) {
|
|
22418
22343
|
this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + x);
|
|
22419
|
-
if (x > 0) {
|
|
22420
|
-
const left = this.calculateLeftScrollX();
|
|
22421
|
-
this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + left);
|
|
22422
|
-
} else if (x < 0) {
|
|
22423
|
-
const right = this.calculateRightScrollX();
|
|
22424
|
-
this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + right);
|
|
22425
|
-
}
|
|
22426
22344
|
this._config.onScroll({
|
|
22427
22345
|
leftEnd: this.isLeftEnd(),
|
|
22428
22346
|
rightEnd: this.isRightEnd()
|
|
@@ -22442,7 +22360,7 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22442
22360
|
});
|
|
22443
22361
|
}
|
|
22444
22362
|
scrollToItem(index) {
|
|
22445
|
-
const targetIndex = index
|
|
22363
|
+
const targetIndex = index ?? this._config.currentIndex;
|
|
22446
22364
|
if (targetIndex < 0 || targetIndex >= this._slideTabItems.length) {
|
|
22447
22365
|
console.error("Index out of bounds");
|
|
22448
22366
|
return;
|
|
@@ -22631,7 +22549,6 @@ function shouldRefreshSheetTabs(commandInfo) {
|
|
|
22631
22549
|
}
|
|
22632
22550
|
}
|
|
22633
22551
|
function SheetBarTabs() {
|
|
22634
|
-
var _config$contextMenu;
|
|
22635
22552
|
const [sheetList, setSheetList] = (0, react.useState)([]);
|
|
22636
22553
|
const [activeSheetId, setActiveSheetId] = (0, react.useState)("");
|
|
22637
22554
|
const [scrollShadow, setScrollShadow] = (0, react.useState)("");
|
|
@@ -22653,7 +22570,7 @@ function SheetBarTabs() {
|
|
|
22653
22570
|
const workbookRef = (0, react.useRef)(workbook);
|
|
22654
22571
|
const resetOrder = (0, _univerjs_ui.useObservable)(worksheetProtectionRuleModel.resetOrder$);
|
|
22655
22572
|
const config = (0, _univerjs_ui.useConfigValue)(_univerjs_ui.UI_PLUGIN_CONFIG_KEY);
|
|
22656
|
-
const showContextMenu = (
|
|
22573
|
+
const showContextMenu = (config === null || config === void 0 ? void 0 : config.contextMenu) ?? true;
|
|
22657
22574
|
const getActiveTabRect = (0, react.useCallback)(() => {
|
|
22658
22575
|
var _slideTabBarRef$curre;
|
|
22659
22576
|
const activeTabRect = (_slideTabBarRef$curre = slideTabBarRef.current) === null || _slideTabBarRef$curre === void 0 || (_slideTabBarRef$curre = _slideTabBarRef$curre.getActiveItem()) === null || _slideTabBarRef$curre === void 0 ? void 0 : _slideTabBarRef$curre.getSlideTabItem().getBoundingClientRect();
|
|
@@ -22732,7 +22649,7 @@ function SheetBarTabs() {
|
|
|
22732
22649
|
workbook
|
|
22733
22650
|
]);
|
|
22734
22651
|
const canRenameActiveSheet = (0, react.useCallback)(() => {
|
|
22735
|
-
var _permissionService$
|
|
22652
|
+
var _permissionService$ge2;
|
|
22736
22653
|
const unitId = workbook.getUnitId();
|
|
22737
22654
|
const activeSheet = workbook.getActiveSheet();
|
|
22738
22655
|
if (!activeSheet) return false;
|
|
@@ -22740,10 +22657,10 @@ function SheetBarTabs() {
|
|
|
22740
22657
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
22741
22658
|
const hasSelectionRule = rangeProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).length > 0;
|
|
22742
22659
|
if (worksheetRule || hasSelectionRule) {
|
|
22743
|
-
var _permissionService$ge
|
|
22744
|
-
return (_permissionService$ge =
|
|
22660
|
+
var _permissionService$ge;
|
|
22661
|
+
return ((_permissionService$ge = permissionService.getPermissionPoint(new _univerjs_sheets.WorkbookManageCollaboratorPermission(unitId).id)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value) ?? false;
|
|
22745
22662
|
}
|
|
22746
|
-
return (
|
|
22663
|
+
return ((_permissionService$ge2 = permissionService.getPermissionPoint(new _univerjs_sheets.WorkbookRenameSheetPermission(unitId).id)) === null || _permissionService$ge2 === void 0 ? void 0 : _permissionService$ge2.value) ?? false;
|
|
22747
22664
|
}, [
|
|
22748
22665
|
permissionService,
|
|
22749
22666
|
rangeProtectionRuleModel,
|
|
@@ -22751,11 +22668,9 @@ function SheetBarTabs() {
|
|
|
22751
22668
|
worksheetProtectionRuleModel
|
|
22752
22669
|
]);
|
|
22753
22670
|
const updateSheetItems = (0, react.useCallback)(() => {
|
|
22754
|
-
var _activeSheet$getSheet;
|
|
22755
22671
|
const activeSheet = workbook.getActiveSheet();
|
|
22756
|
-
const currentSubUnitId = (
|
|
22757
|
-
|
|
22758
|
-
var _sheet$getTabColor;
|
|
22672
|
+
const currentSubUnitId = (activeSheet === null || activeSheet === void 0 ? void 0 : activeSheet.getSheetId()) ?? "";
|
|
22673
|
+
const sheetListItems = workbook.getSheets().filter((sheet) => !sheet.isSheetHidden()).map((sheet, index) => {
|
|
22759
22674
|
const worksheetRule = worksheetProtectionRuleModel.getRule(workbook.getUnitId(), sheet.getSheetId());
|
|
22760
22675
|
const hasSelectionRule = rangeProtectionRuleModel.getSubunitRuleList(workbook.getUnitId(), sheet.getSheetId()).length > 0;
|
|
22761
22676
|
const hasProtection = Boolean((worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) || hasSelectionRule);
|
|
@@ -22770,9 +22685,10 @@ function SheetBarTabs() {
|
|
|
22770
22685
|
}),
|
|
22771
22686
|
index,
|
|
22772
22687
|
selected: activeSheet === sheet,
|
|
22773
|
-
color:
|
|
22688
|
+
color: sheet.getTabColor() ?? void 0
|
|
22774
22689
|
};
|
|
22775
|
-
})
|
|
22690
|
+
});
|
|
22691
|
+
setSheetList(sheetListItems);
|
|
22776
22692
|
setActiveSheetId(currentSubUnitId);
|
|
22777
22693
|
}, [
|
|
22778
22694
|
rangeProtectionRuleModel,
|
|
@@ -22804,7 +22720,7 @@ function SheetBarTabs() {
|
|
|
22804
22720
|
workbookRef.current = workbook;
|
|
22805
22721
|
}, [workbook]);
|
|
22806
22722
|
const syncActiveSheetRender = (0, react.useCallback)((subUnitId) => {
|
|
22807
|
-
const render = renderManagerService.
|
|
22723
|
+
const render = renderManagerService.getRenderUnitById(workbookRef.current.getUnitId());
|
|
22808
22724
|
try {
|
|
22809
22725
|
render === null || render === void 0 || render.with(SheetSkeletonManagerService).setCurrent({ sheetId: subUnitId });
|
|
22810
22726
|
render === null || render === void 0 || render.scene.makeDirty(true);
|
|
@@ -22897,7 +22813,7 @@ function SheetBarTabs() {
|
|
|
22897
22813
|
workbook
|
|
22898
22814
|
]);
|
|
22899
22815
|
const onTabListKeyDown = (0, react.useCallback)((event) => {
|
|
22900
|
-
var _slideTabBarContainer2
|
|
22816
|
+
var _slideTabBarContainer2;
|
|
22901
22817
|
const target = event.target;
|
|
22902
22818
|
if (target.closest("[contenteditable=true]")) return;
|
|
22903
22819
|
const currentTab = target.closest("[data-u-comp=slide-tab-item]");
|
|
@@ -22912,7 +22828,7 @@ function SheetBarTabs() {
|
|
|
22912
22828
|
return;
|
|
22913
22829
|
}
|
|
22914
22830
|
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
22915
|
-
const tabItems = Array.from((_slideTabBarContainer2 =
|
|
22831
|
+
const tabItems = Array.from(((_slideTabBarContainer2 = slideTabBarContainerRef.current) === null || _slideTabBarContainer2 === void 0 ? void 0 : _slideTabBarContainer2.querySelectorAll("[data-u-comp=slide-tab-item]")) ?? []);
|
|
22916
22832
|
const currentIndex = tabItems.findIndex((tabItem) => tabItem.dataset.id === currentSheetId);
|
|
22917
22833
|
if (currentIndex < 0) return;
|
|
22918
22834
|
event.preventDefault();
|
|
@@ -23022,13 +22938,12 @@ function SheetBarTabs() {
|
|
|
23022
22938
|
}, [activeSheetId, sheetList]);
|
|
23023
22939
|
(0, react.useEffect)(() => {
|
|
23024
22940
|
const handlePointerDownCapture = (event) => {
|
|
23025
|
-
var _tabElement$getAttrib;
|
|
23026
22941
|
const container = slideTabBarContainerRef.current;
|
|
23027
22942
|
const target = event.target;
|
|
23028
22943
|
if (!container || !(target instanceof Element)) return;
|
|
23029
22944
|
const tabElement = target.closest("[data-u-comp=slide-tab-item]");
|
|
23030
22945
|
if (!tabElement || !container.contains(tabElement)) return;
|
|
23031
|
-
activateSheetTab(
|
|
22946
|
+
activateSheetTab(tabElement.getAttribute("data-id") ?? void 0);
|
|
23032
22947
|
};
|
|
23033
22948
|
document.addEventListener("pointerdown", handlePointerDownCapture, true);
|
|
23034
22949
|
return () => document.removeEventListener("pointerdown", handlePointerDownCapture, true);
|
|
@@ -23175,7 +23090,10 @@ function ZoomSlider() {
|
|
|
23175
23090
|
(0, react.useEffect)(() => {
|
|
23176
23091
|
setZoom(getCurrentZoom());
|
|
23177
23092
|
return commandService.onCommandExecuted((commandInfo) => {
|
|
23178
|
-
if (commandInfo.id === SetZoomRatioOperation.id || commandInfo.id === _univerjs_sheets.SetWorksheetActiveOperation.id)
|
|
23093
|
+
if (commandInfo.id === SetZoomRatioOperation.id || commandInfo.id === _univerjs_sheets.SetWorksheetActiveOperation.id) {
|
|
23094
|
+
const currentZoom = getCurrentZoom();
|
|
23095
|
+
setZoom(currentZoom);
|
|
23096
|
+
}
|
|
23179
23097
|
}).dispose;
|
|
23180
23098
|
}, [commandService, getCurrentZoom]);
|
|
23181
23099
|
function handleChange(value) {
|
|
@@ -23275,8 +23193,6 @@ function formatNumber(item) {
|
|
|
23275
23193
|
const SINGLE_MODE_WIDTH = 800;
|
|
23276
23194
|
const ROW_COUNT_THRESHOLD = 3;
|
|
23277
23195
|
const StatusBar = () => {
|
|
23278
|
-
var _useConfigValue$statu, _useConfigValue;
|
|
23279
|
-
const showStatistic = (_useConfigValue$statu = (_useConfigValue = (0, _univerjs_ui.useConfigValue)("sheets-ui.config")) === null || _useConfigValue === void 0 ? void 0 : _useConfigValue.statusBarStatistic) !== null && _useConfigValue$statu !== void 0 ? _useConfigValue$statu : true;
|
|
23280
23196
|
const [isSingle, setIsSingle] = (0, react.useState)(window.innerWidth < SINGLE_MODE_WIDTH);
|
|
23281
23197
|
const statusBarService = (0, _univerjs_ui.useDependency)(IStatusBarService);
|
|
23282
23198
|
const items = statusBarService.getFunctions().map((item, index) => ({
|
|
@@ -23286,7 +23202,7 @@ const StatusBar = () => {
|
|
|
23286
23202
|
disable: false,
|
|
23287
23203
|
pattern: null
|
|
23288
23204
|
}));
|
|
23289
|
-
const useStatistics = (initialItems, statusBarService, isSingle
|
|
23205
|
+
const useStatistics = (initialItems, statusBarService, isSingle) => {
|
|
23290
23206
|
const [statistics, setStatistics] = (0, react.useState)(initialItems);
|
|
23291
23207
|
const [show, setShow] = (0, react.useState)(true);
|
|
23292
23208
|
const filteredStatistics = (0, react.useMemo)(() => statistics.filter((item) => item.show && !item.disable), [statistics]);
|
|
@@ -23304,31 +23220,26 @@ const StatusBar = () => {
|
|
|
23304
23220
|
}
|
|
23305
23221
|
setShow(true);
|
|
23306
23222
|
setStatistics((prevStats) => prevStats.map((stat) => {
|
|
23307
|
-
var _items$find
|
|
23223
|
+
var _items$find;
|
|
23308
23224
|
return {
|
|
23309
23225
|
...stat,
|
|
23310
|
-
value: (
|
|
23226
|
+
value: ((_items$find = items.find((i) => i.func === stat.name)) === null || _items$find === void 0 ? void 0 : _items$find.value) ?? stat.value,
|
|
23311
23227
|
disable: !items.some((i) => i.func === stat.name),
|
|
23312
|
-
pattern: (
|
|
23228
|
+
pattern: (state === null || state === void 0 ? void 0 : state.pattern) ?? null
|
|
23313
23229
|
};
|
|
23314
23230
|
}));
|
|
23315
23231
|
}, []);
|
|
23316
23232
|
(0, react.useEffect)(() => {
|
|
23317
|
-
if (!showStatistic) return;
|
|
23318
23233
|
const subscription = statusBarService.state$.subscribe(updateStatistics);
|
|
23319
23234
|
return () => subscription.unsubscribe();
|
|
23320
|
-
}, [
|
|
23321
|
-
showStatistic,
|
|
23322
|
-
statusBarService,
|
|
23323
|
-
updateStatistics
|
|
23324
|
-
]);
|
|
23235
|
+
}, [statusBarService, updateStatistics]);
|
|
23325
23236
|
return {
|
|
23326
23237
|
statistics,
|
|
23327
23238
|
showList,
|
|
23328
23239
|
show
|
|
23329
23240
|
};
|
|
23330
23241
|
};
|
|
23331
|
-
const { showList, show } = useStatistics(items, statusBarService, isSingle
|
|
23242
|
+
const { showList, show } = useStatistics(items, statusBarService, isSingle);
|
|
23332
23243
|
const handleResize = (0, _univerjs_core.debounce)(() => {
|
|
23333
23244
|
const newSingleState = window.innerWidth < SINGLE_MODE_WIDTH;
|
|
23334
23245
|
if (isSingle !== newSingleState) setIsSingle(newSingleState);
|
|
@@ -23340,7 +23251,6 @@ const StatusBar = () => {
|
|
|
23340
23251
|
};
|
|
23341
23252
|
}, [isSingle]);
|
|
23342
23253
|
const getStatisticLayout = (showList, rowCountThreshold, CopyableStatisticItem) => {
|
|
23343
|
-
if (!showStatistic) return null;
|
|
23344
23254
|
if (showList.length > rowCountThreshold) return showList.reduce((acc, _, index) => {
|
|
23345
23255
|
if (index % 2 === 0) acc.push(showList.slice(index, index + 2));
|
|
23346
23256
|
return acc;
|
|
@@ -23370,13 +23280,11 @@ const StatusBar = () => {
|
|
|
23370
23280
|
//#region src/views/sheet-container/SheetContainer.tsx
|
|
23371
23281
|
const SHEET_FOOTER_BAR_HEIGHT = 36;
|
|
23372
23282
|
function RenderSheetFooter() {
|
|
23373
|
-
var _config$footer;
|
|
23374
23283
|
const config = (0, _univerjs_ui.useConfigValue)(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23375
23284
|
const menuManagerService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IMenuManagerService);
|
|
23376
|
-
const showFooter = (
|
|
23285
|
+
const showFooter = (config === null || config === void 0 ? void 0 : config.footer) ?? true;
|
|
23377
23286
|
const activeWorkbook = useActiveWorkbook();
|
|
23378
|
-
const
|
|
23379
|
-
const workbook = loadingWorkbook !== null && loadingWorkbook !== void 0 ? loadingWorkbook : activeWorkbook;
|
|
23287
|
+
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23380
23288
|
const isLoading = useSheetLoading();
|
|
23381
23289
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
23382
23290
|
const focusedUnitType = useFocusedUnitType();
|
|
@@ -23415,8 +23323,7 @@ function RenderSheetFooter() {
|
|
|
23415
23323
|
function RenderSheetHeader() {
|
|
23416
23324
|
const config = (0, _univerjs_ui.useConfigValue)(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23417
23325
|
const activeWorkbook = useActiveWorkbook();
|
|
23418
|
-
const
|
|
23419
|
-
const workbook = loadingWorkbook !== null && loadingWorkbook !== void 0 ? loadingWorkbook : activeWorkbook;
|
|
23326
|
+
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23420
23327
|
const isLoading = useSheetLoading();
|
|
23421
23328
|
const hasWorkbook = !!workbook;
|
|
23422
23329
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
@@ -23441,21 +23348,19 @@ function RenderSheetHeader() {
|
|
|
23441
23348
|
return null;
|
|
23442
23349
|
}
|
|
23443
23350
|
/**
|
|
23444
|
-
*
|
|
23351
|
+
* We should not write into this component anymore.
|
|
23445
23352
|
*/
|
|
23446
23353
|
function RenderSheetContent() {
|
|
23447
|
-
var _componentManager$get;
|
|
23448
23354
|
const config = (0, _univerjs_ui.useConfigValue)(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23449
23355
|
const isLoading = useSheetLoading();
|
|
23450
23356
|
const isPreviewReady = useSheetLoadingPreviewReady();
|
|
23451
23357
|
const componentManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.ComponentManager);
|
|
23452
23358
|
const activeWorkbook = useActiveWorkbook();
|
|
23453
|
-
const
|
|
23454
|
-
const workbook = loadingWorkbook !== null && loadingWorkbook !== void 0 ? loadingWorkbook : activeWorkbook;
|
|
23359
|
+
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23455
23360
|
const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
|
|
23456
23361
|
const injector = (0, _univerjs_ui.useDependency)(_univerjs_core.Injector);
|
|
23457
23362
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
23458
|
-
const ShapeTextEditorContainer =
|
|
23363
|
+
const ShapeTextEditorContainer = componentManager.get("SheetShapeTextEditorContainer") ?? componentManager.get("ShapeTextEditorContainer");
|
|
23459
23364
|
(0, react.useEffect)(() => {
|
|
23460
23365
|
var _tryGetSheetEmbedRunt;
|
|
23461
23366
|
if (!workbook || isLoading || activeEmbedTab || activeWorkbookEmbeddedRender) return;
|
|
@@ -23565,11 +23470,10 @@ function useFocusedUnitType() {
|
|
|
23565
23470
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
23566
23471
|
const focusedUnitId = (0, _univerjs_ui.useObservable)(() => univerInstanceService.focused$, null, false, [univerInstanceService]);
|
|
23567
23472
|
return (0, react.useMemo)(() => {
|
|
23568
|
-
var _focusedUnit$type;
|
|
23569
23473
|
if (!focusedUnitId) return null;
|
|
23570
23474
|
if ((0, _univerjs_core.isInternalEditorID)(focusedUnitId) && univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET)) return _univerjs_core.UniverInstanceType.UNIVER_SHEET;
|
|
23571
23475
|
const focusedUnit = univerInstanceService.getUnit(focusedUnitId);
|
|
23572
|
-
return (
|
|
23476
|
+
return (focusedUnit === null || focusedUnit === void 0 ? void 0 : focusedUnit.type) ?? null;
|
|
23573
23477
|
}, [focusedUnitId, univerInstanceService]);
|
|
23574
23478
|
}
|
|
23575
23479
|
function useActiveSheetEmbedTabData(workbook) {
|
|
@@ -24153,7 +24057,7 @@ let SheetUIController = class SheetUIController extends _univerjs_core.Disposabl
|
|
|
24153
24057
|
}
|
|
24154
24058
|
_initFocusHandler() {
|
|
24155
24059
|
this.disposeWithMe(this._layoutService.registerFocusHandler(_univerjs_core.UniverInstanceType.UNIVER_SHEET, (_unitId) => {
|
|
24156
|
-
const cellEditorRender = this._injector.get(_univerjs_engine_render.IRenderManagerService).
|
|
24060
|
+
const cellEditorRender = this._injector.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
24157
24061
|
const docSelectionRenderService = cellEditorRender === null || cellEditorRender === void 0 ? void 0 : cellEditorRender.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
24158
24062
|
docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
24159
24063
|
}));
|
|
@@ -24195,7 +24099,7 @@ const useHighlightRange = (ranges = []) => {
|
|
|
24195
24099
|
//#endregion
|
|
24196
24100
|
//#region package.json
|
|
24197
24101
|
var name = "@univerjs/sheets-ui";
|
|
24198
|
-
var version = "1.0.0-
|
|
24102
|
+
var version = "1.0.0-beta.0";
|
|
24199
24103
|
|
|
24200
24104
|
//#endregion
|
|
24201
24105
|
//#region src/views/cell-popup/config.ts
|
|
@@ -24288,13 +24192,12 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24288
24192
|
_createHiddenRectObserver(params) {
|
|
24289
24193
|
const { row, column, worksheet, skeleton, currentRender } = params;
|
|
24290
24194
|
const calc = () => {
|
|
24291
|
-
var _columnWidthAccumulat, _rowHeightAccumulatio;
|
|
24292
24195
|
const { startRow: freezeStartRow, startColumn: freezeStartColumn, xSplit, ySplit } = worksheet.getFreeze();
|
|
24293
24196
|
const startRow = freezeStartRow - ySplit;
|
|
24294
24197
|
const startColumn = freezeStartColumn - xSplit;
|
|
24295
24198
|
const { rowHeightAccumulation, columnWidthAccumulation, rowHeaderWidth, columnHeaderHeight } = skeleton;
|
|
24296
|
-
const canvasFreezeWidth = rowHeaderWidth + (startColumn === -1 ? 0 : columnWidthAccumulation[startColumn + xSplit - 1] - (
|
|
24297
|
-
const canvasFreezeHeight = columnHeaderHeight + (startRow === -1 ? 0 : rowHeightAccumulation[startRow + ySplit - 1] - (
|
|
24199
|
+
const canvasFreezeWidth = rowHeaderWidth + (startColumn === -1 ? 0 : columnWidthAccumulation[startColumn + xSplit - 1] - (columnWidthAccumulation[startColumn - 1] ?? 0));
|
|
24200
|
+
const canvasFreezeHeight = columnHeaderHeight + (startRow === -1 ? 0 : rowHeightAccumulation[startRow + ySplit - 1] - (rowHeightAccumulation[startRow] ?? 0));
|
|
24298
24201
|
const canvasElement = currentRender.engine.getCanvasElement();
|
|
24299
24202
|
const canvasClientRect = canvasElement.getBoundingClientRect();
|
|
24300
24203
|
const widthOfCanvas = pxToNum(canvasElement.style.width);
|
|
@@ -24388,8 +24291,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24388
24291
|
};
|
|
24389
24292
|
const unitId = workbook.getUnitId();
|
|
24390
24293
|
const subUnitId = worksheet.getSheetId();
|
|
24391
|
-
const skeleton = (_this$_renderManagerS = this._renderManagerService.
|
|
24392
|
-
const currentRender = this._renderManagerService.
|
|
24294
|
+
const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24295
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24393
24296
|
if (!currentRender || !skeleton) return {
|
|
24394
24297
|
dispose: () => {},
|
|
24395
24298
|
canDispose: () => true
|
|
@@ -24442,8 +24345,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24442
24345
|
const subUnitId = worksheet.getSheetId();
|
|
24443
24346
|
if (unitId !== location.unitId || location.subUnitId !== subUnitId) return null;
|
|
24444
24347
|
if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
|
|
24445
|
-
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.
|
|
24446
|
-
const currentRender = this._renderManagerService.
|
|
24348
|
+
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24349
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24447
24350
|
if (!currentRender || !skeleton) return null;
|
|
24448
24351
|
const { position, position$, disposable } = this._createPositionObserver(bound, currentRender, skeleton, worksheet);
|
|
24449
24352
|
const { rects$, disposable: rectsObserverDisposable } = this._createHiddenRectObserver({
|
|
@@ -24496,8 +24399,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24496
24399
|
const unitId = workbook.getUnitId();
|
|
24497
24400
|
const subUnitId = worksheet.getSheetId();
|
|
24498
24401
|
if (_unitId && unitId !== _unitId || _subUnitId && _subUnitId !== subUnitId) return null;
|
|
24499
|
-
const skeleton = (_this$_renderManagerS3 = this._renderManagerService.
|
|
24500
|
-
const currentRender = this._renderManagerService.
|
|
24402
|
+
const skeleton = (_this$_renderManagerS3 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24403
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24501
24404
|
if (!currentRender || !skeleton) return null;
|
|
24502
24405
|
if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
|
|
24503
24406
|
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
@@ -24539,12 +24442,12 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24539
24442
|
if (!worksheet) return null;
|
|
24540
24443
|
const unitId = workbook.getUnitId();
|
|
24541
24444
|
const subUnitId = worksheet.getSheetId();
|
|
24542
|
-
const currentRender = this._renderManagerService.
|
|
24445
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24543
24446
|
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24544
24447
|
const sheetSelectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
24545
24448
|
if (!currentRender || !skeleton || !sheetSelectionRenderService) return null;
|
|
24546
24449
|
if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
|
|
24547
|
-
const activeViewport = viewport
|
|
24450
|
+
const activeViewport = viewport ?? getViewportByCell(row, col, currentRender.scene, worksheet);
|
|
24548
24451
|
if (!activeViewport) return null;
|
|
24549
24452
|
const { position, position$, disposable: positionObserverDisposable, updateRowCol } = this._createCellPositionObserver(row, col, currentRender, skeleton, activeViewport);
|
|
24550
24453
|
const { rects$, disposable: rectsObserverDisposable } = this._createHiddenRectObserver({
|
|
@@ -24608,12 +24511,12 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24608
24511
|
const unitId = workbook.getUnitId();
|
|
24609
24512
|
const subUnitId = worksheet.getSheetId();
|
|
24610
24513
|
if (_unitId && unitId !== _unitId || _subUnitId && subUnitId !== _subUnitId) return null;
|
|
24611
|
-
const currentRender = this._renderManagerService.
|
|
24514
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24612
24515
|
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24613
24516
|
const sheetSelectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
24614
24517
|
if (!currentRender || !skeleton || !sheetSelectionRenderService) return null;
|
|
24615
24518
|
if (sheetSelectionRenderService.selectionMoving && !showOnSelectionMoving) return;
|
|
24616
|
-
const activeViewport = viewport
|
|
24519
|
+
const activeViewport = viewport ?? getViewportByCell(range.startRow, range.startColumn, currentRender.scene, worksheet);
|
|
24617
24520
|
if (!activeViewport) return null;
|
|
24618
24521
|
const { position, position$, disposable: positionObserverDisposable, updateRange, topLeftPos$, rightBottomPos$ } = this._createRangePositionObserver(range, currentRender, skeleton, activeViewport);
|
|
24619
24522
|
const { rects$, disposable: rectsObserverDisposable } = this._createHiddenRectObserver({
|
|
@@ -24854,12 +24757,12 @@ let CellPopupManagerService = class CellPopupManagerService extends _univerjs_co
|
|
|
24854
24757
|
return subUnitMap;
|
|
24855
24758
|
}
|
|
24856
24759
|
showPopup(location, popup) {
|
|
24857
|
-
var _subUnitMap$getValue
|
|
24760
|
+
var _subUnitMap$getValue;
|
|
24858
24761
|
const { direction = "horizontal" } = popup;
|
|
24859
24762
|
const { unitId, subUnitId, row, col } = location;
|
|
24860
24763
|
const subUnitMap = this._ensureCellPopupMap(unitId, subUnitId);
|
|
24861
24764
|
const directionCache = (_subUnitMap$getValue = subUnitMap.getValue(row, col)) === null || _subUnitMap$getValue === void 0 ? void 0 : _subUnitMap$getValue[direction];
|
|
24862
|
-
popup.id =
|
|
24765
|
+
popup.id = popup.id ?? (0, _univerjs_core.generateRandomId)();
|
|
24863
24766
|
const hidePopup = () => {
|
|
24864
24767
|
const root = subUnitMap.getValue(row, col);
|
|
24865
24768
|
if (!root) return;
|
|
@@ -25613,7 +25516,6 @@ function getBorderStyle(borderData) {
|
|
|
25613
25516
|
}
|
|
25614
25517
|
}
|
|
25615
25518
|
function BorderPanel(props) {
|
|
25616
|
-
var _value$color;
|
|
25617
25519
|
const iconManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.IconManager);
|
|
25618
25520
|
const borderStyleManagerService = (0, _univerjs_ui.useDependency)(_univerjs_sheets.BorderStyleManagerService);
|
|
25619
25521
|
const selectionManagerService = (0, _univerjs_ui.useDependency)(_univerjs_sheets.SheetsSelectionsService);
|
|
@@ -25663,7 +25565,7 @@ function BorderPanel(props) {
|
|
|
25663
25565
|
type: "button",
|
|
25664
25566
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.PaintBucketDoubleIcon, {
|
|
25665
25567
|
className: "univer-fill-primary-600 dark:!univer-text-white",
|
|
25666
|
-
extend: { colorChannel1: (
|
|
25568
|
+
extend: { colorChannel1: (value === null || value === void 0 ? void 0 : value.color) ?? "" }
|
|
25667
25569
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "dark:!univer-text-white" })]
|
|
25668
25570
|
})
|
|
25669
25571
|
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
@@ -25686,7 +25588,7 @@ function BorderPanel(props) {
|
|
|
25686
25588
|
type: "button",
|
|
25687
25589
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderLine, {
|
|
25688
25590
|
className: "univer-fill-gray-900 dark:!univer-fill-white",
|
|
25689
|
-
type: type
|
|
25591
|
+
type: type ?? _univerjs_core.BorderStyleTypes.THIN
|
|
25690
25592
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "dark:!univer-text-white" })]
|
|
25691
25593
|
})
|
|
25692
25594
|
}) })]
|
|
@@ -25731,7 +25633,7 @@ let CellAlertManagerService = class CellAlertManagerService extends _univerjs_co
|
|
|
25731
25633
|
}
|
|
25732
25634
|
const { location } = alert;
|
|
25733
25635
|
const { row, col, unitId, subUnitId } = location;
|
|
25734
|
-
if (!this._renderManagerService.
|
|
25636
|
+
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
25735
25637
|
const disposable = this._cellPopupManagerService.showPopup({
|
|
25736
25638
|
unitId,
|
|
25737
25639
|
subUnitId,
|
|
@@ -25822,9 +25724,8 @@ const CellPopup = (props) => {
|
|
|
25822
25724
|
"data-u-comp": "sheets-ui-cell-popup",
|
|
25823
25725
|
className: "univer-ml-px univer-flex univer-flex-col",
|
|
25824
25726
|
children: popups.map((popup) => {
|
|
25825
|
-
var _popup$id;
|
|
25826
25727
|
const Component = componentManager.get(popup.componentKey);
|
|
25827
|
-
return Component ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, { popup },
|
|
25728
|
+
return Component ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, { popup }, popup.id ?? popup.componentKey) : null;
|
|
25828
25729
|
})
|
|
25829
25730
|
});
|
|
25830
25731
|
};
|
|
@@ -25928,7 +25829,7 @@ function DefinedNameInputContent(props) {
|
|
|
25928
25829
|
const [isFocusFormulaEditor, setIsFocusFormulaEditor] = (0, react.useState)(false);
|
|
25929
25830
|
(0, _univerjs_ui.useSidebarClick)((e) => {
|
|
25930
25831
|
var _formulaEditorRef$cur;
|
|
25931
|
-
|
|
25832
|
+
(_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
|
|
25932
25833
|
});
|
|
25933
25834
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25934
25835
|
className: (0, _univerjs_design.clsx)("univer-grid univer-space-y-2 univer-pb-1", _univerjs_design.borderBottomClassName, { "univer-hidden": !state }),
|
|
@@ -26066,8 +25967,7 @@ const DefinedNameContainer = () => {
|
|
|
26066
25967
|
if (!workbook || !unitId) return;
|
|
26067
25968
|
const checkWorkbookPermission = permissionState.workbook;
|
|
26068
25969
|
const checkDefinedNamePermission = (definedName) => {
|
|
26069
|
-
|
|
26070
|
-
return (_permissionState$work = permissionState.worksheets.get(definedName.id)) !== null && _permissionState$work !== void 0 ? _permissionState$work : checkWorkbookPermission;
|
|
25970
|
+
return permissionState.worksheets.get(definedName.id) ?? checkWorkbookPermission;
|
|
26071
25971
|
};
|
|
26072
25972
|
const insertConfirm = (param) => {
|
|
26073
25973
|
const { name, formulaOrRefString, comment, localSheetId, hidden } = param;
|
|
@@ -26270,7 +26170,7 @@ function CascaderDropdown(props) {
|
|
|
26270
26170
|
const { popup } = props;
|
|
26271
26171
|
const { extraProps } = popup;
|
|
26272
26172
|
const { options, defaultValue, onChange } = extraProps;
|
|
26273
|
-
const [localValue, setLocalValue] = (0, react.useState)(defaultValue
|
|
26173
|
+
const [localValue, setLocalValue] = (0, react.useState)(defaultValue ?? []);
|
|
26274
26174
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.CascaderList, {
|
|
26275
26175
|
options,
|
|
26276
26176
|
value: localValue,
|
|
@@ -26315,7 +26215,7 @@ function DateDropdown(props) {
|
|
|
26315
26215
|
}
|
|
26316
26216
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Calendar, {
|
|
26317
26217
|
value: date.toDate(),
|
|
26318
|
-
showTime: showTime
|
|
26218
|
+
showTime: showTime ?? patternType === "datetime",
|
|
26319
26219
|
onValueChange: (newValue) => {
|
|
26320
26220
|
setLocalDate((0, _univerjs_core.dateKit)(newValue));
|
|
26321
26221
|
}
|
|
@@ -26468,13 +26368,12 @@ function SelectList(props) {
|
|
|
26468
26368
|
});
|
|
26469
26369
|
}
|
|
26470
26370
|
function ListDropDown(props) {
|
|
26471
|
-
var _anchorRect$right, _anchorRect$left;
|
|
26472
26371
|
const { popup: { extraProps, anchorRect } } = props;
|
|
26473
26372
|
const { location, hideFn, onChange, onEdit, options, defaultValue, multiple, showSearch, showEdit } = extraProps;
|
|
26474
26373
|
const { worksheet } = location;
|
|
26475
26374
|
const [localValue, setLocalValue] = (0, react.useState)(defaultValue);
|
|
26476
26375
|
if (!worksheet) return null;
|
|
26477
|
-
const cellWidth = ((
|
|
26376
|
+
const cellWidth = ((anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.right) ?? 0) - ((anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.left) ?? 0);
|
|
26478
26377
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectList, {
|
|
26479
26378
|
style: {
|
|
26480
26379
|
minWidth: cellWidth,
|
|
@@ -26483,8 +26382,8 @@ function ListDropDown(props) {
|
|
|
26483
26382
|
value: getListDropdownValue(localValue, multiple),
|
|
26484
26383
|
multiple,
|
|
26485
26384
|
onChange: async (newValue) => {
|
|
26486
|
-
|
|
26487
|
-
setLocalValue(
|
|
26385
|
+
const str = multiple ? (0, _univerjs_sheets.serializeListOptions)(newValue) : newValue[0] ?? "";
|
|
26386
|
+
setLocalValue(str);
|
|
26488
26387
|
if (!(await (onChange === null || onChange === void 0 ? void 0 : onChange(newValue)) === false)) hideFn();
|
|
26489
26388
|
},
|
|
26490
26389
|
options,
|
|
@@ -26571,13 +26470,14 @@ const SheetPermissionDialog = () => {
|
|
|
26571
26470
|
actions: defaultWorksheetUnitActionList
|
|
26572
26471
|
}).then((result) => {
|
|
26573
26472
|
if (cancelled) return;
|
|
26574
|
-
|
|
26473
|
+
const actions = result[0].strategies.reduce((p, c) => {
|
|
26575
26474
|
if (subUnitPermissionTypeMap[c.action]) p[c.action] = {
|
|
26576
26475
|
text: localeService.t(`sheets-ui.permission.panel.${subUnitPermissionTypeMap[c.action]}`),
|
|
26577
26476
|
allowed: c.role !== _univerjs_protocol.UnitRole.Owner
|
|
26578
26477
|
};
|
|
26579
26478
|
return p;
|
|
26580
|
-
}, {})
|
|
26479
|
+
}, {});
|
|
26480
|
+
setPermissionMap(actions);
|
|
26581
26481
|
loadingTimer = setTimeout(() => {
|
|
26582
26482
|
setLoading(false);
|
|
26583
26483
|
}, 100);
|
|
@@ -26739,13 +26639,13 @@ const checkRangesIsWholeSheet = (ranges, sheet) => {
|
|
|
26739
26639
|
return startRow === 0 && startColumn === 0 && endRow === rowCount - 1 && endColumn === colCount - 1;
|
|
26740
26640
|
};
|
|
26741
26641
|
const generateDefaultRule = (injector, fromSheetBar) => {
|
|
26742
|
-
var _selectionManagerServ
|
|
26642
|
+
var _selectionManagerServ;
|
|
26743
26643
|
const univerInstanceService = injector.get(_univerjs_core.IUniverInstanceService);
|
|
26744
26644
|
const selectionManagerService = injector.get(_univerjs_sheets.SheetsSelectionsService);
|
|
26745
26645
|
const workbook = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
26746
26646
|
const worksheet = workbook.getActiveSheet();
|
|
26747
26647
|
let unitType = _univerjs_protocol.UnitObject.SelectRange;
|
|
26748
|
-
let ranges = (_selectionManagerServ =
|
|
26648
|
+
let ranges = ((_selectionManagerServ = selectionManagerService.getCurrentSelections()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.map((s) => s.range)) ?? [];
|
|
26749
26649
|
if (fromSheetBar) {
|
|
26750
26650
|
unitType = _univerjs_protocol.UnitObject.Worksheet;
|
|
26751
26651
|
ranges = [{
|
|
@@ -26972,7 +26872,8 @@ const PermissionDetailMainPart = (props) => {
|
|
|
26972
26872
|
(0, _univerjs_sheets.setEndForRange)(range, worksheet.getRowCount(), worksheet.getColumnCount());
|
|
26973
26873
|
return range;
|
|
26974
26874
|
});
|
|
26975
|
-
|
|
26875
|
+
const rangeErrorString = checkRangeValid(injector, transformedRange, permissionId, unitId, subUnitId);
|
|
26876
|
+
onRangesChange(transformedRange, rangeErrorString);
|
|
26976
26877
|
};
|
|
26977
26878
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
|
|
26978
26879
|
className: "univer-font-medium",
|
|
@@ -27017,7 +26918,6 @@ const UserEmptyBase64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAADwC
|
|
|
27017
26918
|
//#endregion
|
|
27018
26919
|
//#region src/views/permission/panel-detail/PermissionDetailUserPart.tsx
|
|
27019
26920
|
const PermissionDetailUserPart = (props) => {
|
|
27020
|
-
var _workbook$getUnitId;
|
|
27021
26921
|
const { editState, onEditStateChange, viewState, onViewStateChange, permissionId } = props;
|
|
27022
26922
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
27023
26923
|
const dialogService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IDialogService);
|
|
@@ -27028,7 +26928,7 @@ const PermissionDetailUserPart = (props) => {
|
|
|
27028
26928
|
const selectUserList = (0, _univerjs_ui.useObservable)(sheetPermissionUserManagerService.selectUserList$, sheetPermissionUserManagerService.selectUserList);
|
|
27029
26929
|
const workbook = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
27030
26930
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
|
|
27031
|
-
const unitId = (
|
|
26931
|
+
const unitId = (workbook === null || workbook === void 0 ? void 0 : workbook.getUnitId()) ?? "";
|
|
27032
26932
|
const handleEditStateChange = (0, _univerjs_ui.useEvent)(onEditStateChange);
|
|
27033
26933
|
const handleAddPerson = async () => {
|
|
27034
26934
|
const userList = await authzIoService.listCollaborators({
|
|
@@ -27045,7 +26945,6 @@ const PermissionDetailUserPart = (props) => {
|
|
|
27045
26945
|
title: { title: "" },
|
|
27046
26946
|
children: { label: UNIVER_SHEET_PERMISSION_USER_DIALOG },
|
|
27047
26947
|
width: "auto",
|
|
27048
|
-
destroyOnClose: true,
|
|
27049
26948
|
closable: false,
|
|
27050
26949
|
onClose: () => dialogService.close(UNIVER_SHEET_PERMISSION_USER_DIALOG_ID),
|
|
27051
26950
|
className: "sheet-permission-user-dialog"
|
|
@@ -27179,7 +27078,6 @@ const PermissionDetailUserPart = (props) => {
|
|
|
27179
27078
|
//#endregion
|
|
27180
27079
|
//#region src/views/permission/panel-detail/PermissionDetailPanel.tsx
|
|
27181
27080
|
const SheetPermissionPanelDetail = (props) => {
|
|
27182
|
-
var _activeRule$editState, _activeRule$viewState;
|
|
27183
27081
|
const { fromSheetBar, rule, oldRule } = props;
|
|
27184
27082
|
const injector = (0, _univerjs_ui.useDependency)(_univerjs_core.Injector);
|
|
27185
27083
|
const componentManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.ComponentManager);
|
|
@@ -27189,10 +27087,9 @@ const SheetPermissionPanelDetail = (props) => {
|
|
|
27189
27087
|
return checkRangeValid(injector, activeRule.ranges, activeRule.permissionId, activeRule.unitId, activeRule.subUnitId);
|
|
27190
27088
|
});
|
|
27191
27089
|
const [desc, setDesc] = (0, react.useState)(activeRule.description);
|
|
27192
|
-
const [editState, setEditState] = (0, react.useState)(
|
|
27193
|
-
const [viewState, setViewState] = (0, react.useState)(
|
|
27194
|
-
const
|
|
27195
|
-
const PermissionDetailUser = CustomPermissionDetailUserPart !== null && CustomPermissionDetailUserPart !== void 0 ? CustomPermissionDetailUserPart : PermissionDetailUserPart;
|
|
27090
|
+
const [editState, setEditState] = (0, react.useState)(activeRule.editState ?? _univerjs_sheets.EditStateEnum.OnlyMe);
|
|
27091
|
+
const [viewState, setViewState] = (0, react.useState)(activeRule.viewState ?? _univerjs_sheets.ViewStateEnum.OthersCanView);
|
|
27092
|
+
const PermissionDetailUser = componentManager.get("UNIVER_SHEET_PERMISSION_USER_PART") ?? PermissionDetailUserPart;
|
|
27196
27093
|
(0, react.useEffect)(() => {
|
|
27197
27094
|
const univerInstanceService = injector.get(_univerjs_core.IUniverInstanceService);
|
|
27198
27095
|
const sidebarService = injector.get(_univerjs_ui.ISidebarService);
|
|
@@ -27404,7 +27301,7 @@ function SheetPermissionPanelListContent() {
|
|
|
27404
27301
|
})]
|
|
27405
27302
|
}),
|
|
27406
27303
|
(ruleList === null || ruleList === void 0 ? void 0 : ruleList.length) > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: ruleList === null || ruleList === void 0 ? void 0 : ruleList.map((item) => {
|
|
27407
|
-
var _item$creator, _item$creator2, _item$
|
|
27304
|
+
var _item$creator, _item$creator2, _item$creator3, _item$creator4;
|
|
27408
27305
|
const rule = allRuleMap.get(item.objectID);
|
|
27409
27306
|
if (!rule) return null;
|
|
27410
27307
|
const editAction = item.actions.find((action) => action.action === _univerjs_protocol.UnitAction.Edit);
|
|
@@ -27480,7 +27377,7 @@ function SheetPermissionPanelListContent() {
|
|
|
27480
27377
|
className: "univer-flex univer-items-center",
|
|
27481
27378
|
children: [
|
|
27482
27379
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
|
|
27483
|
-
title: (
|
|
27380
|
+
title: ((_item$creator3 = item.creator) === null || _item$creator3 === void 0 ? void 0 : _item$creator3.name) ?? "",
|
|
27484
27381
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Avatar, {
|
|
27485
27382
|
src: (_item$creator4 = item.creator) === null || _item$creator4 === void 0 ? void 0 : _item$creator4.avatar,
|
|
27486
27383
|
className: "univer-mr-1.5",
|
|
@@ -27574,19 +27471,19 @@ const SheetPermissionPanel = ({ showDetail, fromSheetBar, rule, oldRule }) => {
|
|
|
27574
27471
|
//#endregion
|
|
27575
27472
|
//#region src/views/permission/SheetPermissionUserDialog.tsx
|
|
27576
27473
|
const SheetPermissionUserDialog = () => {
|
|
27577
|
-
var
|
|
27474
|
+
var _authzIoService$getCf;
|
|
27578
27475
|
const [inputValue, setInputValue] = (0, react.useState)("");
|
|
27579
27476
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
27580
27477
|
const dialogService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IDialogService);
|
|
27581
27478
|
const sheetPermissionUserManagerService = (0, _univerjs_ui.useDependency)(SheetPermissionUserManagerService);
|
|
27582
27479
|
const authzIoService = (0, _univerjs_ui.useDependency)(_univerjs_core.IAuthzIoService);
|
|
27583
27480
|
const userList = (0, _univerjs_ui.useObservable)(sheetPermissionUserManagerService.userList$, sheetPermissionUserManagerService.userList);
|
|
27584
|
-
const searchUserList = (
|
|
27481
|
+
const searchUserList = (userList === null || userList === void 0 ? void 0 : userList.filter((item) => {
|
|
27585
27482
|
var _item$subject;
|
|
27586
27483
|
return ((_item$subject = item.subject) === null || _item$subject === void 0 ? void 0 : _item$subject.name.toLocaleLowerCase().includes(inputValue.toLocaleLowerCase())) && (item.role === _univerjs_protocol.UnitRole.Owner || item.role === _univerjs_protocol.UnitRole.Editor);
|
|
27587
|
-
}))
|
|
27484
|
+
})) ?? [];
|
|
27588
27485
|
const [selectUserInfo, setSelectUserInfo] = (0, react.useState)(sheetPermissionUserManagerService.selectUserList);
|
|
27589
|
-
const cfgEnableObjInherit = (_authzIoService$getCf =
|
|
27486
|
+
const cfgEnableObjInherit = ((_authzIoService$getCf = authzIoService.getCfgEnableObjInherit) === null || _authzIoService$getCf === void 0 ? void 0 : _authzIoService$getCf.call(authzIoService)) ?? false;
|
|
27590
27487
|
const handleChangeUser = (item) => {
|
|
27591
27488
|
if ((selectUserInfo === null || selectUserInfo === void 0 ? void 0 : selectUserInfo.findIndex((v) => {
|
|
27592
27489
|
var _v$subject, _item$subject2;
|
|
@@ -27594,10 +27491,13 @@ const SheetPermissionUserDialog = () => {
|
|
|
27594
27491
|
})) === -1) {
|
|
27595
27492
|
const select = { ...item };
|
|
27596
27493
|
setSelectUserInfo([...selectUserInfo, select]);
|
|
27597
|
-
} else
|
|
27598
|
-
|
|
27599
|
-
|
|
27600
|
-
|
|
27494
|
+
} else {
|
|
27495
|
+
const newSelectUserInfo = selectUserInfo.filter((v) => {
|
|
27496
|
+
var _v$subject2, _item$subject3;
|
|
27497
|
+
return ((_v$subject2 = v.subject) === null || _v$subject2 === void 0 ? void 0 : _v$subject2.userID) !== ((_item$subject3 = item.subject) === null || _item$subject3 === void 0 ? void 0 : _item$subject3.userID);
|
|
27498
|
+
});
|
|
27499
|
+
setSelectUserInfo(newSelectUserInfo);
|
|
27500
|
+
}
|
|
27601
27501
|
};
|
|
27602
27502
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
27603
27503
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
@@ -27962,7 +27862,7 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
27962
27862
|
}
|
|
27963
27863
|
_getEditorViewModel(unitId) {
|
|
27964
27864
|
var _this$_renderManagerS;
|
|
27965
|
-
return (_this$_renderManagerS = this._renderManagerService.
|
|
27865
|
+
return (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs.DocSkeletonManagerService).getViewModel();
|
|
27966
27866
|
}
|
|
27967
27867
|
_syncFormulaEditorContent() {
|
|
27968
27868
|
this.disposeWithMe(this._editorBridgeService.currentEditCellState$.subscribe((editCellState) => {
|
|
@@ -28031,7 +27931,7 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
28031
27931
|
}
|
|
28032
27932
|
_syncActionsAndRender(unitId, parmas) {
|
|
28033
27933
|
const INCLUDE_LIST = [_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY, _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY];
|
|
28034
|
-
const currentRender = this._renderManagerService.
|
|
27934
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
28035
27935
|
if (currentRender == null) return;
|
|
28036
27936
|
const skeleton = currentRender.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
28037
27937
|
const docDataModel = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
@@ -28058,16 +27958,16 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
28058
27958
|
if (body.paragraphs) body.paragraphs = this._clearParagraph(body.paragraphs);
|
|
28059
27959
|
}
|
|
28060
27960
|
const INCLUDE_LIST = [_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY, _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY];
|
|
28061
|
-
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.
|
|
27961
|
+
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
28062
27962
|
const docDataModel = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
28063
27963
|
const docViewModel = this._getEditorViewModel(unitId);
|
|
28064
27964
|
if (docDataModel == null || docViewModel == null || skeleton == null) return;
|
|
28065
27965
|
docDataModel.getSnapshot().body = body;
|
|
28066
|
-
docDataModel.getSnapshot().drawings = drawings
|
|
28067
|
-
docDataModel.getSnapshot().drawingsOrder = drawingsOrder
|
|
27966
|
+
docDataModel.getSnapshot().drawings = drawings ?? {};
|
|
27967
|
+
docDataModel.getSnapshot().drawingsOrder = drawingsOrder ?? [];
|
|
28068
27968
|
this._checkAndSetRenderStyleConfig(docDataModel);
|
|
28069
27969
|
docViewModel.reset(docDataModel);
|
|
28070
|
-
const currentRender = this._renderManagerService.
|
|
27970
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
28071
27971
|
if (currentRender == null) return;
|
|
28072
27972
|
skeleton.calculate();
|
|
28073
27973
|
if (INCLUDE_LIST.includes(unitId)) {
|
|
@@ -28084,7 +27984,7 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
28084
27984
|
}
|
|
28085
27985
|
_refreshRenderStyleConfig(unitId) {
|
|
28086
27986
|
var _currentRender$mainCo3;
|
|
28087
|
-
const currentRender = this._renderManagerService.
|
|
27987
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
28088
27988
|
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
28089
27989
|
const docDataModel = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
28090
27990
|
const docViewModel = this._getEditorViewModel(unitId);
|
|
@@ -28096,15 +27996,12 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
28096
27996
|
if (unitId === _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) this._formulaEditorController.autoScroll();
|
|
28097
27997
|
}
|
|
28098
27998
|
_checkAndSetRenderStyleConfig(documentDataModel) {
|
|
28099
|
-
var _snapshot$body
|
|
27999
|
+
var _snapshot$body;
|
|
28100
28000
|
const snapshot = documentDataModel.getSnapshot();
|
|
28101
28001
|
if (snapshot.id !== _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY && snapshot.id !== _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY) return;
|
|
28102
28002
|
const isFormulaBar = snapshot.id === _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY;
|
|
28103
28003
|
if (isFormulaBar) snapshot.documentStyle = formulaEditorStyle;
|
|
28104
|
-
else {
|
|
28105
|
-
var _snapshot$documentSty;
|
|
28106
|
-
(_snapshot$documentSty = snapshot.documentStyle) !== null && _snapshot$documentSty !== void 0 || (snapshot.documentStyle = {});
|
|
28107
|
-
}
|
|
28004
|
+
else snapshot.documentStyle ??= {};
|
|
28108
28005
|
let renderConfig = snapshot.documentStyle.renderConfig;
|
|
28109
28006
|
if (renderConfig == null) {
|
|
28110
28007
|
renderConfig = {};
|
|
@@ -28118,7 +28015,7 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
28118
28015
|
height: Infinity
|
|
28119
28016
|
};
|
|
28120
28017
|
}
|
|
28121
|
-
if (!((
|
|
28018
|
+
if (!(((_snapshot$body = snapshot.body) === null || _snapshot$body === void 0 ? void 0 : _snapshot$body.dataStream) ?? "").startsWith("=")) {
|
|
28122
28019
|
renderConfig.isRenderStyle = isFormulaBar ? _univerjs_core.BooleanNumber.FALSE : _univerjs_core.BooleanNumber.TRUE;
|
|
28123
28020
|
return;
|
|
28124
28021
|
}
|
|
@@ -28587,16 +28484,16 @@ function MobileSheetBarImpl(props) {
|
|
|
28587
28484
|
const currentSubUnitId = workbook.getActiveSheet().getSheetId();
|
|
28588
28485
|
const sheets = workbook.getSheets();
|
|
28589
28486
|
const activeSheet = workbook.getActiveSheet();
|
|
28590
|
-
|
|
28591
|
-
var _sheet$getTabColor;
|
|
28487
|
+
const sheetListItems = sheets.filter((sheet) => !sheet.isSheetHidden()).map((sheet, index) => {
|
|
28592
28488
|
return {
|
|
28593
28489
|
sheetId: sheet.getSheetId(),
|
|
28594
28490
|
label: sheet.getName(),
|
|
28595
28491
|
index,
|
|
28596
28492
|
selected: activeSheet === sheet,
|
|
28597
|
-
color:
|
|
28493
|
+
color: sheet.getTabColor() ?? void 0
|
|
28598
28494
|
};
|
|
28599
|
-
})
|
|
28495
|
+
});
|
|
28496
|
+
setSheetList(sheetListItems);
|
|
28600
28497
|
setActiveKey(currentSubUnitId);
|
|
28601
28498
|
if (tabMapRef.current.has(currentSubUnitId)) {
|
|
28602
28499
|
const element = tabMapRef.current.get(currentSubUnitId);
|
|
@@ -28932,11 +28829,11 @@ let SheetPermissionInterceptorCanvasRenderController = class SheetPermissionInte
|
|
|
28932
28829
|
if (!target) return false;
|
|
28933
28830
|
const { unitId, subUnitId } = target;
|
|
28934
28831
|
if (rangeParams.row) {
|
|
28935
|
-
var _this$_permissionServ
|
|
28936
|
-
if (((_this$_permissionServ =
|
|
28832
|
+
var _this$_permissionServ;
|
|
28833
|
+
if ((((_this$_permissionServ = this._permissionService.getPermissionPoint(new _univerjs_sheets.WorksheetSetRowStylePermission(unitId, subUnitId).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value) ?? false) === false) return false;
|
|
28937
28834
|
} else if (rangeParams.col) {
|
|
28938
|
-
var _this$
|
|
28939
|
-
if (((
|
|
28835
|
+
var _this$_permissionServ2;
|
|
28836
|
+
if ((((_this$_permissionServ2 = this._permissionService.getPermissionPoint(new _univerjs_sheets.WorksheetSetColumnStylePermission(unitId, subUnitId).id)) === null || _this$_permissionServ2 === void 0 ? void 0 : _this$_permissionServ2.value) ?? false) === false) return false;
|
|
28940
28837
|
}
|
|
28941
28838
|
return true;
|
|
28942
28839
|
} }));
|
|
@@ -29004,10 +28901,10 @@ let SheetPermissionInterceptorCanvasRenderController = class SheetPermissionInte
|
|
|
29004
28901
|
}
|
|
29005
28902
|
_initFreezePermissionInterceptor() {
|
|
29006
28903
|
this.disposeWithMe(this._headerFreezeRenderController.interceptor.intercept(this._headerFreezeRenderController.interceptor.getInterceptPoints().FREEZE_PERMISSION_CHECK, { handler: (_, __) => {
|
|
29007
|
-
var _this$
|
|
28904
|
+
var _this$_permissionServ3;
|
|
29008
28905
|
const workbook = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
29009
28906
|
if (!(workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet()) || !workbook) return false;
|
|
29010
|
-
return (
|
|
28907
|
+
return ((_this$_permissionServ3 = this._permissionService.getPermissionPoint(new _univerjs_sheets.WorkbookEditablePermission(workbook.getUnitId()).id)) === null || _this$_permissionServ3 === void 0 ? void 0 : _this$_permissionServ3.value) ?? false;
|
|
29011
28908
|
} }));
|
|
29012
28909
|
}
|
|
29013
28910
|
};
|
|
@@ -29096,7 +28993,7 @@ let SheetPermissionInterceptorFormulaRenderController = class SheetPermissionInt
|
|
|
29096
28993
|
handler: (defaultValue, originValue) => {
|
|
29097
28994
|
var _this$_permissionServ;
|
|
29098
28995
|
const target = (0, _univerjs_sheets.getSheetCommandTarget)(this._univerInstanceService);
|
|
29099
|
-
if (!target) return defaultValue
|
|
28996
|
+
if (!target) return defaultValue ?? [];
|
|
29100
28997
|
const { worksheet, unitId, subUnitId } = target;
|
|
29101
28998
|
if (((_this$_permissionServ = this._permissionService.getPermissionPoint(new _univerjs_sheets.WorksheetViewPermission(unitId, subUnitId).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value) === false) originValue.forEach((item) => {
|
|
29102
28999
|
const itemValue = item.getArrayValue();
|
|
@@ -29361,7 +29258,7 @@ let WorksheetProtectionRenderController = class WorksheetProtectionRenderControl
|
|
|
29361
29258
|
}
|
|
29362
29259
|
_initRender() {
|
|
29363
29260
|
const renderId = this._context.unitId;
|
|
29364
|
-
const render = renderId && this._renderManagerService.
|
|
29261
|
+
const render = renderId && this._renderManagerService.getRenderUnitById(renderId);
|
|
29365
29262
|
const spreadsheetRender = render && render.mainComponent;
|
|
29366
29263
|
if (spreadsheetRender) {
|
|
29367
29264
|
if (!spreadsheetRender.getExtensionByKey("worksheet-protection")) spreadsheetRender.register(this._worksheetProtectionRenderExtension);
|
|
@@ -29780,10 +29677,9 @@ let SheetContextMenuMobileRenderController = class SheetContextMenuMobileRenderC
|
|
|
29780
29677
|
return skeleton.getCellWithCoordByOffset(relativeCoords.x - scrollXY.x, relativeCoords.y - scrollXY.y, scaleX, scaleY, scrollXY);
|
|
29781
29678
|
}
|
|
29782
29679
|
_getCurrentRenderSelections() {
|
|
29783
|
-
|
|
29784
|
-
const currentRender = this._renderManagerService.getRenderById(this._context.unitId);
|
|
29680
|
+
const currentRender = this._renderManagerService.getRenderUnitById(this._context.unitId);
|
|
29785
29681
|
const selectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
29786
|
-
return (
|
|
29682
|
+
return (selectionRenderService === null || selectionRenderService === void 0 ? void 0 : selectionRenderService.getSelectionControls().map((control) => (0, _univerjs_sheets.convertSelectionDataToRange)(control.getValue()))) ?? [];
|
|
29787
29683
|
}
|
|
29788
29684
|
_cloneSelections(selections) {
|
|
29789
29685
|
return selections.map((selection) => ({
|
|
@@ -30265,9 +30161,7 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30265
30161
|
}
|
|
30266
30162
|
_getFreeze() {
|
|
30267
30163
|
var _this$_sheetSkeletonM;
|
|
30268
|
-
|
|
30269
|
-
if (snapshot == null) return;
|
|
30270
|
-
return snapshot.freeze;
|
|
30164
|
+
return (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton.worksheet.getFreeze();
|
|
30271
30165
|
}
|
|
30272
30166
|
_initScrollEventListener() {
|
|
30273
30167
|
const { scene } = this._context;
|
|
@@ -30433,7 +30327,10 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30433
30327
|
const speedFactor = Math.min(swipeSpeed / 2, 1);
|
|
30434
30328
|
multiplier = MIN_VELOCITY_MULTIPLIER + (MAX_VELOCITY_MULTIPLIER - MIN_VELOCITY_MULTIPLIER) * speedFactor;
|
|
30435
30329
|
if (swipeDuration < 150 && Math.abs(instantVelocity) > 3) multiplier *= 1.3;
|
|
30436
|
-
} else
|
|
30330
|
+
} else {
|
|
30331
|
+
const velocityFactor = Math.min(Math.abs(instantVelocity) / 5, 1);
|
|
30332
|
+
multiplier = MIN_VELOCITY_MULTIPLIER * (.5 + velocityFactor * .5);
|
|
30333
|
+
}
|
|
30437
30334
|
return Math.max(MIN_VELOCITY_MULTIPLIER * .5, Math.min(MAX_VELOCITY_MULTIPLIER * 1.5, multiplier));
|
|
30438
30335
|
};
|
|
30439
30336
|
/**
|
|
@@ -30759,7 +30656,10 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30759
30656
|
if (!_touchScrolling) return;
|
|
30760
30657
|
_touchScrolling = false;
|
|
30761
30658
|
const avgVelocity = calculateAverageVelocity();
|
|
30762
|
-
const
|
|
30659
|
+
const swipeDuration = performance.now() - swipeStartTime;
|
|
30660
|
+
const totalDistance = Math.sqrt(swipeTotalDisplacement.x * swipeTotalDisplacement.x + swipeTotalDisplacement.y * swipeTotalDisplacement.y);
|
|
30661
|
+
const instantVelocity = Math.sqrt(avgVelocity.x * avgVelocity.x + avgVelocity.y * avgVelocity.y);
|
|
30662
|
+
const dynamicMultiplier = calculateDynamicVelocityMultiplier(swipeDuration, totalDistance, instantVelocity);
|
|
30763
30663
|
const { maxVelocity, minVelocityThreshold } = getZoomAdjustedParams();
|
|
30764
30664
|
const cappedVelX = Math.max(-maxVelocity, Math.min(maxVelocity, avgVelocity.x * dynamicMultiplier));
|
|
30765
30665
|
const cappedVelY = Math.max(-maxVelocity, Math.min(maxVelocity, avgVelocity.y * dynamicMultiplier));
|
|
@@ -30852,7 +30752,7 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30852
30752
|
if (param == null) return;
|
|
30853
30753
|
const { unitId } = this._context;
|
|
30854
30754
|
const { skeleton } = param;
|
|
30855
|
-
const scene = (_this$_renderManagerS = this._renderManagerService.
|
|
30755
|
+
const scene = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.scene;
|
|
30856
30756
|
if (skeleton == null || scene == null) return;
|
|
30857
30757
|
const { rowTotalHeight, columnTotalWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
30858
30758
|
scene === null || scene === void 0 || scene.transformByState({
|
|
@@ -30882,14 +30782,14 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30882
30782
|
return skeleton.getRangeByViewport(viewport.calcViewportInfo());
|
|
30883
30783
|
}
|
|
30884
30784
|
_scrollToCell(row, column) {
|
|
30885
|
-
var _this$_sheetSkeletonM10, _this$
|
|
30886
|
-
const { rowHeightAccumulation, columnWidthAccumulation } = (_this$_sheetSkeletonM10 =
|
|
30785
|
+
var _this$_sheetSkeletonM10, _this$_getSheetObject2, _this$_sheetSkeletonM11;
|
|
30786
|
+
const { rowHeightAccumulation, columnWidthAccumulation } = ((_this$_sheetSkeletonM10 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM10 === void 0 ? void 0 : _this$_sheetSkeletonM10.skeleton) ?? {};
|
|
30887
30787
|
if (rowHeightAccumulation == null || columnWidthAccumulation == null) return false;
|
|
30888
30788
|
const scene = (_this$_getSheetObject2 = this._getSheetObject()) === null || _this$_getSheetObject2 === void 0 ? void 0 : _this$_getSheetObject2.scene;
|
|
30889
30789
|
if (scene == null) return false;
|
|
30890
30790
|
const viewport = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
30891
30791
|
if (viewport == null) return false;
|
|
30892
|
-
if (((_this$
|
|
30792
|
+
if (((_this$_sheetSkeletonM11 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM11 === void 0 ? void 0 : _this$_sheetSkeletonM11.skeleton) == null) return false;
|
|
30893
30793
|
const worksheet = this._context.unit.getActiveSheet();
|
|
30894
30794
|
if (!worksheet) return false;
|
|
30895
30795
|
const { startColumn: freezeStartColumn, startRow: freezeStartRow, ySplit: freezeYSplit, xSplit: freezeXSplit } = worksheet.getFreeze();
|
|
@@ -31089,7 +30989,7 @@ let SheetCellDropdownManagerService = class SheetCellDropdownManagerService exte
|
|
|
31089
30989
|
const { location, onHide, closeOnOutSide = true } = param;
|
|
31090
30990
|
const { row, col, unitId, subUnitId } = location;
|
|
31091
30991
|
const component = dropdownMap[param.type];
|
|
31092
|
-
const currentRender = this._renderManagerService.
|
|
30992
|
+
const currentRender = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
31093
30993
|
const disposable = new _univerjs_core.DisposableCollection();
|
|
31094
30994
|
const popupDisposable = this._canvasPopupManagerService.attachPopupToCell(row, col, {
|
|
31095
30995
|
componentKey: component.componentKey,
|
|
@@ -31690,9 +31590,8 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31690
31590
|
* When pinch zooming, we should not process pointer move events for selection.
|
|
31691
31591
|
*/
|
|
31692
31592
|
_setupPointerMoveListener(viewportMain, activeSelectionControl, rangeType, scrollTimerType = _univerjs_engine_render.ScrollTimerType.ALL, moveStartPosX, moveStartPosY) {
|
|
31693
|
-
var _viewportMain$left, _viewportMain$top;
|
|
31694
31593
|
this._scrollTimer = _univerjs_engine_render.ScrollTimer.create(this._scene, scrollTimerType);
|
|
31695
|
-
this._scrollTimer.startScroll((
|
|
31594
|
+
this._scrollTimer.startScroll((viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.left) ?? 0, (viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.top) ?? 0, viewportMain);
|
|
31696
31595
|
const scene = this._scene;
|
|
31697
31596
|
this._scenePointerMoveSub = scene.onPointerMove$.subscribeEvent((moveEvt) => {
|
|
31698
31597
|
if (this._contextService.getContextValue("MOBILE_PINCH_ZOOMING")) return;
|
|
@@ -31714,7 +31613,7 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31714
31613
|
* In Mobile version, new selection is determined by cursor cell and current of activeSelectionControl.model
|
|
31715
31614
|
*/
|
|
31716
31615
|
_movingHandler(offsetX, offsetY, activeSelectionControl, rangeType) {
|
|
31717
|
-
var
|
|
31616
|
+
var _anchorCell$mergeInfo, _anchorCell$mergeInfo2, _anchorCell$mergeInfo3, _anchorCell$mergeInfo4;
|
|
31718
31617
|
this._rangeType = rangeType;
|
|
31719
31618
|
const skeleton = this._skeleton;
|
|
31720
31619
|
const scene = this._scene;
|
|
@@ -31725,7 +31624,7 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31725
31624
|
endColumn: activeSelectionControl.model.endColumn
|
|
31726
31625
|
};
|
|
31727
31626
|
const viewportMain = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
31728
|
-
const targetViewport =
|
|
31627
|
+
const targetViewport = this._getViewportByCell(currSelectionRange.endRow, currSelectionRange.endColumn) ?? viewportMain;
|
|
31729
31628
|
const scrollXY = scene.getScrollXYInfoByViewport(_univerjs_engine_render.Vector2.FromArray([this._startViewportPosX, this._startViewportPosY]), targetViewport);
|
|
31730
31629
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
31731
31630
|
if (rangeType === _univerjs_core.RANGE_TYPE.ROW) offsetX = Number.POSITIVE_INFINITY;
|
|
@@ -31733,11 +31632,11 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31733
31632
|
const cursorCellRangeInfo = this._getSelectionWithCoordByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
31734
31633
|
if (!cursorCellRangeInfo) return false;
|
|
31735
31634
|
const { rangeWithCoord: cursorCellRange } = cursorCellRangeInfo;
|
|
31736
|
-
const anchorCell =
|
|
31737
|
-
const startRowOfActiveCell = (
|
|
31738
|
-
const endRowOfActiveCell = (
|
|
31739
|
-
const startColumnOfActiveCell = (
|
|
31740
|
-
const endColOfActiveCell = (
|
|
31635
|
+
const anchorCell = this._anchorCellForExpanding ?? activeSelectionControl.model.currentCell;
|
|
31636
|
+
const startRowOfActiveCell = (anchorCell === null || anchorCell === void 0 || (_anchorCell$mergeInfo = anchorCell.mergeInfo) === null || _anchorCell$mergeInfo === void 0 ? void 0 : _anchorCell$mergeInfo.startRow) ?? (anchorCell === null || anchorCell === void 0 ? void 0 : anchorCell.actualRow) ?? -1;
|
|
31637
|
+
const endRowOfActiveCell = (anchorCell === null || anchorCell === void 0 || (_anchorCell$mergeInfo2 = anchorCell.mergeInfo) === null || _anchorCell$mergeInfo2 === void 0 ? void 0 : _anchorCell$mergeInfo2.endRow) ?? (anchorCell === null || anchorCell === void 0 ? void 0 : anchorCell.actualRow) ?? -1;
|
|
31638
|
+
const startColumnOfActiveCell = (anchorCell === null || anchorCell === void 0 || (_anchorCell$mergeInfo3 = anchorCell.mergeInfo) === null || _anchorCell$mergeInfo3 === void 0 ? void 0 : _anchorCell$mergeInfo3.startColumn) ?? (anchorCell === null || anchorCell === void 0 ? void 0 : anchorCell.actualColumn) ?? -1;
|
|
31639
|
+
const endColOfActiveCell = (anchorCell === null || anchorCell === void 0 || (_anchorCell$mergeInfo4 = anchorCell.mergeInfo) === null || _anchorCell$mergeInfo4 === void 0 ? void 0 : _anchorCell$mergeInfo4.endColumn) ?? (anchorCell === null || anchorCell === void 0 ? void 0 : anchorCell.actualColumn) ?? -1;
|
|
31741
31640
|
let startRow = Math.min(cursorCellRange.startRow, startRowOfActiveCell);
|
|
31742
31641
|
if (startRowOfActiveCell === -1) startRow = cursorCellRange.startRow;
|
|
31743
31642
|
let startColumn = Math.min(cursorCellRange.startColumn, startColumnOfActiveCell);
|
|
@@ -31844,6 +31743,7 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends _unive
|
|
|
31844
31743
|
[SelectAllService],
|
|
31845
31744
|
[ISheetCellDropdownManagerService, { useClass: SheetCellDropdownManagerService }],
|
|
31846
31745
|
[SheetCellEditorResizeService],
|
|
31746
|
+
[ISheetLoadingRenderService, { useClass: SheetLoadingRenderService }],
|
|
31847
31747
|
[AutoHeightController],
|
|
31848
31748
|
[AutoWidthController],
|
|
31849
31749
|
[FormulaEditorController],
|
|
@@ -31909,7 +31809,6 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends _unive
|
|
|
31909
31809
|
});
|
|
31910
31810
|
}
|
|
31911
31811
|
_registerRenderModules() {
|
|
31912
|
-
var _config$contextMenu;
|
|
31913
31812
|
const modules = [
|
|
31914
31813
|
[HeaderMoveRenderController],
|
|
31915
31814
|
[HeaderUnhideRenderController],
|
|
@@ -31937,7 +31836,7 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends _unive
|
|
|
31937
31836
|
[WorksheetProtectionRenderController]
|
|
31938
31837
|
];
|
|
31939
31838
|
const config = this._configService.getConfig(_univerjs_ui.UI_PLUGIN_CONFIG_KEY);
|
|
31940
|
-
if ((
|
|
31839
|
+
if ((config === null || config === void 0 ? void 0 : config.contextMenu) ?? true) modules.push([HeaderMenuRenderController]);
|
|
31941
31840
|
modules.forEach((m) => {
|
|
31942
31841
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(_univerjs_core.UniverInstanceType.UNIVER_SHEET, m));
|
|
31943
31842
|
});
|
|
@@ -31957,7 +31856,7 @@ _defineProperty(UniverSheetsMobileUIPlugin, "packageName", name);
|
|
|
31957
31856
|
_defineProperty(UniverSheetsMobileUIPlugin, "version", version);
|
|
31958
31857
|
_defineProperty(UniverSheetsMobileUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
31959
31858
|
UniverSheetsMobileUIPlugin = __decorate([
|
|
31960
|
-
(0, _univerjs_core.DependentOn)(_univerjs_sheets.UniverSheetsPlugin, _univerjs_ui.UniverMobileUIPlugin),
|
|
31859
|
+
(0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_engine_formula.UniverFormulaEnginePlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_ui.UniverMobileUIPlugin, _univerjs_docs_ui.UniverDocsUIPlugin),
|
|
31961
31860
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
31962
31861
|
__decorateParam(2, _univerjs_engine_render.IRenderManagerService),
|
|
31963
31862
|
__decorateParam(3, _univerjs_core.IConfigService),
|
|
@@ -32530,7 +32429,6 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends _univerjs_core.Plu
|
|
|
32530
32429
|
});
|
|
32531
32430
|
}
|
|
32532
32431
|
_registerRenderModules() {
|
|
32533
|
-
var _config$contextMenu;
|
|
32534
32432
|
const modules = [
|
|
32535
32433
|
[HeaderMoveRenderController],
|
|
32536
32434
|
[HeaderUnhideRenderController],
|
|
@@ -32558,7 +32456,7 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends _univerjs_core.Plu
|
|
|
32558
32456
|
[WorksheetProtectionRenderController]
|
|
32559
32457
|
];
|
|
32560
32458
|
const config = this._configService.getConfig(_univerjs_ui.UI_PLUGIN_CONFIG_KEY);
|
|
32561
|
-
if ((
|
|
32459
|
+
if ((config === null || config === void 0 ? void 0 : config.contextMenu) ?? true) modules.push([HeaderMenuRenderController]);
|
|
32562
32460
|
modules.forEach((m) => {
|
|
32563
32461
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(_univerjs_core.UniverInstanceType.UNIVER_SHEET, m));
|
|
32564
32462
|
});
|
|
@@ -32578,7 +32476,7 @@ _defineProperty(UniverSheetsUIPlugin, "packageName", name);
|
|
|
32578
32476
|
_defineProperty(UniverSheetsUIPlugin, "version", version);
|
|
32579
32477
|
_defineProperty(UniverSheetsUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
32580
32478
|
UniverSheetsUIPlugin = __decorate([
|
|
32581
|
-
(0, _univerjs_core.DependentOn)(_univerjs_sheets.UniverSheetsPlugin),
|
|
32479
|
+
(0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_engine_formula.UniverFormulaEnginePlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_docs_ui.UniverDocsUIPlugin),
|
|
32582
32480
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
32583
32481
|
__decorateParam(2, _univerjs_engine_render.IRenderManagerService),
|
|
32584
32482
|
__decorateParam(3, _univerjs_core.IConfigService),
|