@univerjs/sheets-ui 1.0.0-alpha.8 → 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 +12 -19
- package/lib/cjs/index.js +406 -470
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-HK.js +3 -3
- package/lib/cjs/locale/zh-TW.js +3 -3
- package/lib/es/facade.js +12 -19
- package/lib/es/index.js +411 -475
- package/lib/es/locale/zh-CN.js +1 -1
- package/lib/es/locale/zh-HK.js +3 -3
- package/lib/es/locale/zh-TW.js +3 -3
- package/lib/facade.js +12 -19
- package/lib/index.css +6 -5
- package/lib/index.js +411 -475
- package/lib/locale/zh-CN.js +1 -1
- package/lib/locale/zh-HK.js +3 -3
- package/lib/locale/zh-TW.js +3 -3
- package/lib/types/controllers/editor/editing.render-controller.d.ts +0 -1
- package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/slide-tab-bar.d.ts +0 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +11 -11
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +15 -15
package/lib/cjs/index.js
CHANGED
|
@@ -590,9 +590,8 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
590
590
|
* @param {ISelectionWithCoord} selectionWithStyle
|
|
591
591
|
*/
|
|
592
592
|
_addSelectionControlByModelData(selectionWithStyle) {
|
|
593
|
-
var _selectionWithStyle$s;
|
|
594
593
|
const skeleton = this._skeleton;
|
|
595
|
-
const style =
|
|
594
|
+
const style = selectionWithStyle.style ?? genNormalSelectionStyle(this._selectionTheme);
|
|
596
595
|
const scene = this._scene;
|
|
597
596
|
selectionWithStyle.style = style;
|
|
598
597
|
return this.newSelectionControl(scene, skeleton, selectionWithStyle);
|
|
@@ -672,17 +671,15 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
672
671
|
* @param moveStartPosY
|
|
673
672
|
*/
|
|
674
673
|
_setupPointerMoveListener(viewportMain, activeSelectionControl, rangeType, scrollTimerType = _univerjs_engine_render.ScrollTimerType.ALL, moveStartPosX, moveStartPosY) {
|
|
675
|
-
var _viewportMain$left, _viewportMain$top;
|
|
676
674
|
let xCrossTime = 0;
|
|
677
675
|
let yCrossTime = 0;
|
|
678
676
|
let lastX = moveStartPosX;
|
|
679
677
|
let lastY = moveStartPosY;
|
|
680
678
|
this._scrollTimer = _univerjs_engine_render.ScrollTimer.create(this._scene, scrollTimerType);
|
|
681
|
-
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);
|
|
682
680
|
const scene = this._scene;
|
|
683
681
|
const startViewport = scene.getActiveViewportByCoord(_univerjs_engine_render.Vector2.FromArray([moveStartPosX, moveStartPosY]));
|
|
684
682
|
this._scenePointerMoveSub = scene.onPointerMove$.subscribeEvent((moveEvt) => {
|
|
685
|
-
var _scene$getActiveViewp;
|
|
686
683
|
if (moveEvt.buttons === 0) {
|
|
687
684
|
this.endSelection();
|
|
688
685
|
return;
|
|
@@ -695,7 +692,7 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
695
692
|
const currentSelection = this.getActiveSelectionControl();
|
|
696
693
|
const freeze = this._getFreeze();
|
|
697
694
|
const selection = currentSelection === null || currentSelection === void 0 ? void 0 : currentSelection.model;
|
|
698
|
-
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);
|
|
699
696
|
const isCrossableViewports = () => {
|
|
700
697
|
if (!startViewport || !endViewport || !viewportMain) return false;
|
|
701
698
|
const crossableViewports = [
|
|
@@ -715,15 +712,12 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
715
712
|
const startKey = startViewport.viewportKey;
|
|
716
713
|
const endKey = endViewport.viewportKey;
|
|
717
714
|
if (startKey === _univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_ROW_TOP) {
|
|
718
|
-
|
|
719
|
-
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;
|
|
720
716
|
else if (isCrossingY && yCrossTime % 2 === 1) viewportMain.scrollToViewportPos({ viewportScrollY: 0 });
|
|
721
717
|
} else if (startKey === _univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_COLUMN_LEFT) {
|
|
722
|
-
|
|
723
|
-
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;
|
|
724
719
|
else if (isCrossingX && xCrossTime % 2 === 1) viewportMain.scrollToViewportPos({ viewportScrollX: 0 });
|
|
725
720
|
} else if (startKey === endKey) {
|
|
726
|
-
var _selection$endRow2, _freeze$startRow2, _selection$endColumn2, _freeze$startColumn2;
|
|
727
721
|
let disableX = false;
|
|
728
722
|
let disableY = false;
|
|
729
723
|
if (startKey === _univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP) {
|
|
@@ -731,8 +725,8 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
731
725
|
disableY = true;
|
|
732
726
|
} else if (startKey === _univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP) disableY = true;
|
|
733
727
|
else if (startKey === _univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT) disableX = true;
|
|
734
|
-
if (((
|
|
735
|
-
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;
|
|
736
730
|
if (disableX) scrollOffsetX = viewportMain.left;
|
|
737
731
|
if (disableY) scrollOffsetY = viewportMain.top;
|
|
738
732
|
} else {
|
|
@@ -767,7 +761,7 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
767
761
|
}
|
|
768
762
|
getCellWithCoordByOffset(x, y, skeletonParam) {
|
|
769
763
|
const scene = this._scene;
|
|
770
|
-
const skeleton = skeletonParam
|
|
764
|
+
const skeleton = skeletonParam ?? this._skeleton;
|
|
771
765
|
const scrollXY = scene.getViewportScrollXY(scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN));
|
|
772
766
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
773
767
|
return skeleton.getCellWithCoordByOffset(x - scrollXY.x, y - scrollXY.y, scaleX, scaleY, scrollXY);
|
|
@@ -776,20 +770,19 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
776
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
|
|
777
771
|
*/
|
|
778
772
|
_movingHandler(offsetX, offsetY, activeSelectionControl, rangeType) {
|
|
779
|
-
var _activeSelectionContr, _activeSelectionContr2, _activeSelectionContr3, _activeSelectionContr4, _this$_getViewportByC;
|
|
780
773
|
const skeleton = this._skeleton;
|
|
781
774
|
const scene = this._scene;
|
|
782
775
|
const [unitId, sheetId] = skeleton.getLocation();
|
|
783
776
|
const currSelectionRange = {
|
|
784
|
-
startRow: (
|
|
785
|
-
endRow: (
|
|
786
|
-
startColumn: (
|
|
787
|
-
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,
|
|
788
781
|
unitId,
|
|
789
782
|
sheetId
|
|
790
783
|
};
|
|
791
784
|
const viewportMain = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
792
|
-
const targetViewport =
|
|
785
|
+
const targetViewport = this._getViewportByCell(currSelectionRange.endRow, currSelectionRange.endColumn) ?? viewportMain;
|
|
793
786
|
const scrollXY = scene.getScrollXYInfoByViewport(_univerjs_engine_render.Vector2.FromArray([this._startViewportPosX, this._startViewportPosY]), targetViewport);
|
|
794
787
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
795
788
|
if (rangeType === _univerjs_core.RANGE_TYPE.ROW) offsetX = Number.POSITIVE_INFINITY;
|
|
@@ -1798,7 +1791,6 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = .3;
|
|
|
1798
1791
|
*/
|
|
1799
1792
|
var SelectionControl = class extends _univerjs_core.Disposable {
|
|
1800
1793
|
constructor(_scene, _zIndex, _themeService, options) {
|
|
1801
|
-
var _options$enableAutoFi, _options$highlightHea, _options$rowHeaderWid, _options$columnHeader, _options$rowHeaderOff, _options$columnHeader2;
|
|
1802
1794
|
super();
|
|
1803
1795
|
this._scene = _scene;
|
|
1804
1796
|
this._zIndex = _zIndex;
|
|
@@ -1852,12 +1844,12 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
1852
1844
|
_defineProperty(this, "selectionFilled$", this._selectionFilled$.asObservable());
|
|
1853
1845
|
_defineProperty(this, "_antLineOffset", 0);
|
|
1854
1846
|
_defineProperty(this, "_antRequestNewFrame", -1);
|
|
1855
|
-
this._enableAutoFill = (
|
|
1856
|
-
this._highlightHeader = (
|
|
1857
|
-
this._rowHeaderWidth = (
|
|
1858
|
-
this._columnHeaderHeight = (
|
|
1859
|
-
this._rowHeaderOffsetX = (
|
|
1860
|
-
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;
|
|
1861
1853
|
this._initializeSheetBody();
|
|
1862
1854
|
this._initialHeader();
|
|
1863
1855
|
}
|
|
@@ -2751,7 +2743,7 @@ const copyContentCache = new CopyContentCache();
|
|
|
2751
2743
|
//#endregion
|
|
2752
2744
|
//#region src/services/clipboard/html-to-usm/parse-node-style.ts
|
|
2753
2745
|
function extractNodeStyle(node, predefinedStyles) {
|
|
2754
|
-
const styles = predefinedStyles
|
|
2746
|
+
const styles = predefinedStyles ?? node.style;
|
|
2755
2747
|
const docStyles = {};
|
|
2756
2748
|
const tagName = node.tagName.toLowerCase();
|
|
2757
2749
|
switch (tagName) {
|
|
@@ -2895,9 +2887,8 @@ function generateParagraphs(dataStream, prevParagraph) {
|
|
|
2895
2887
|
return paragraphs;
|
|
2896
2888
|
}
|
|
2897
2889
|
function convertToCellStyle(cell, dataStream, textRuns) {
|
|
2898
|
-
var _textRuns$length;
|
|
2899
2890
|
const dataStreamLength = dataStream.length;
|
|
2900
|
-
const canConvertToCellStyle = ((
|
|
2891
|
+
const canConvertToCellStyle = ((textRuns === null || textRuns === void 0 ? void 0 : textRuns.length) ?? 0) === 1 && textRuns[0].st === 0 && textRuns[0].ed === dataStreamLength;
|
|
2901
2892
|
if (cell.p) {
|
|
2902
2893
|
var _cell$p$body;
|
|
2903
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)) {
|
|
@@ -2969,8 +2960,7 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
2969
2960
|
this._dom = parseToDom(html);
|
|
2970
2961
|
const style = this._dom.querySelector("style");
|
|
2971
2962
|
if (style) {
|
|
2972
|
-
|
|
2973
|
-
this._parseMsoNumfmtFromCssText((_style$textContent = style.textContent) !== null && _style$textContent !== void 0 ? _style$textContent : "");
|
|
2963
|
+
this._parseMsoNumfmtFromCssText(style.textContent ?? "");
|
|
2974
2964
|
const shadowHost = document.createElement("div");
|
|
2975
2965
|
const shadowRoot = shadowHost.attachShadow({ mode: "open" });
|
|
2976
2966
|
document.body.appendChild(shadowHost);
|
|
@@ -3165,9 +3155,9 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3165
3155
|
return style;
|
|
3166
3156
|
}
|
|
3167
3157
|
_parseTable(html, tableElIndex) {
|
|
3168
|
-
var
|
|
3158
|
+
var _this$_getCurrentSkel;
|
|
3169
3159
|
const valueMatrix = new _univerjs_core.ObjectMatrix();
|
|
3170
|
-
const colProperties =
|
|
3160
|
+
const colProperties = parseColGroup(html) ?? [];
|
|
3171
3161
|
const { rowProperties = [] } = parseTableRows(html);
|
|
3172
3162
|
const parsedCellMatrix = this._parseTableByHtml(this._dom, tableElIndex, (_this$_getCurrentSkel = this._getCurrentSkeleton()) === null || _this$_getCurrentSkel === void 0 ? void 0 : _this$_getCurrentSkel.skeleton);
|
|
3173
3163
|
parsedCellMatrix && parsedCellMatrix.forValue((row, col, value) => {
|
|
@@ -3260,8 +3250,7 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3260
3250
|
let numfmtPattern;
|
|
3261
3251
|
const pattern = this._getMsoNumfmtForNode(cell);
|
|
3262
3252
|
if (!(0, _univerjs_core.isDefaultFormat)(pattern)) {
|
|
3263
|
-
|
|
3264
|
-
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;
|
|
3265
3254
|
if (cellText.includes("mso-spacerun:yes")) cellText = cleanMsoSpaceRun(cellText);
|
|
3266
3255
|
const parseData = (0, _univerjs_core.getNumfmtParseValueFilter)(cellText);
|
|
3267
3256
|
if (typeof (parseData === null || parseData === void 0 ? void 0 : parseData.v) === "number" && (parseData.z === pattern || _univerjs_core.numfmt.format(pattern, parseData.v) === cellText)) {
|
|
@@ -3346,13 +3335,10 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3346
3335
|
}
|
|
3347
3336
|
}
|
|
3348
3337
|
_getCellTextAndRichText(cell, styleStr, skeleton) {
|
|
3349
|
-
if (cell.childElementCount === 0) {
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
cellRichStyle: void 0
|
|
3354
|
-
};
|
|
3355
|
-
}
|
|
3338
|
+
if (cell.childElementCount === 0) return {
|
|
3339
|
+
cellText: normalizePlainCellText(cell.textContent ?? ""),
|
|
3340
|
+
cellRichStyle: void 0
|
|
3341
|
+
};
|
|
3356
3342
|
const cellHtml = cell.innerHTML;
|
|
3357
3343
|
/**
|
|
3358
3344
|
* mso-spacerun:yes is used to force spaces in html copied from excel.
|
|
@@ -3467,14 +3453,13 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3467
3453
|
const body = doc.body;
|
|
3468
3454
|
const element = node;
|
|
3469
3455
|
if (element.tagName.toUpperCase() === "A") {
|
|
3470
|
-
var _body$customRanges, _element$dataset$rang;
|
|
3471
3456
|
const href = element.href;
|
|
3472
3457
|
if (!(0, _univerjs_core.isSafeUrl)(href)) return;
|
|
3473
|
-
body.customRanges =
|
|
3458
|
+
body.customRanges = body.customRanges ?? [];
|
|
3474
3459
|
body.customRanges.push({
|
|
3475
3460
|
startIndex: start,
|
|
3476
3461
|
endIndex: body.dataStream.length - 1,
|
|
3477
|
-
rangeId:
|
|
3462
|
+
rangeId: element.dataset.rangeid ?? (0, _univerjs_core.generateRandomId)(),
|
|
3478
3463
|
rangeType: _univerjs_core.CustomRangeType.HYPERLINK,
|
|
3479
3464
|
properties: { url: href }
|
|
3480
3465
|
});
|
|
@@ -4163,7 +4148,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4163
4148
|
return this._pasteInternal(copyId, pasteType);
|
|
4164
4149
|
}
|
|
4165
4150
|
async legacyPaste(html, text, files, formulaClipboardPayload) {
|
|
4166
|
-
const isFromExcel = htmlIsFromExcel(html
|
|
4151
|
+
const isFromExcel = htmlIsFromExcel(html ?? "");
|
|
4167
4152
|
if (files && !isFromExcel) return this._pasteFiles(files, PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE);
|
|
4168
4153
|
else if (html) return this._pasteHTML(html, PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE, formulaClipboardPayload);
|
|
4169
4154
|
else if (text) if (/[\n\t]/.test(text)) return this._pasteHTML(convertTextToTable(text), PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE);
|
|
@@ -5598,15 +5583,13 @@ function checkIfShrink(selection, direction, worksheet) {
|
|
|
5598
5583
|
switch (direction) {
|
|
5599
5584
|
case _univerjs_core.Direction.UP:
|
|
5600
5585
|
case _univerjs_core.Direction.DOWN:
|
|
5601
|
-
|
|
5602
|
-
startRange.
|
|
5603
|
-
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;
|
|
5604
5588
|
break;
|
|
5605
5589
|
case _univerjs_core.Direction.LEFT:
|
|
5606
5590
|
case _univerjs_core.Direction.RIGHT:
|
|
5607
|
-
|
|
5608
|
-
startRange.
|
|
5609
|
-
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;
|
|
5610
5593
|
break;
|
|
5611
5594
|
}
|
|
5612
5595
|
const anchorRange = getEdgeOfRange(startRange, direction, worksheet);
|
|
@@ -5731,10 +5714,10 @@ const HideColConfirmCommand = {
|
|
|
5731
5714
|
//#endregion
|
|
5732
5715
|
//#region src/menu/utils.ts
|
|
5733
5716
|
function getFontStyleAtCursor(accessor) {
|
|
5734
|
-
var
|
|
5717
|
+
var _editorDataModel$getB;
|
|
5735
5718
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
5736
5719
|
const textSelectionService = accessor.get(_univerjs_docs.DocSelectionManagerService);
|
|
5737
|
-
const editorUnitId =
|
|
5720
|
+
const editorUnitId = accessor.get(_univerjs_docs_ui.IEditorService).getFocusId() ?? _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY;
|
|
5738
5721
|
const editorDataModel = univerInstanceService.getUnit(editorUnitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
5739
5722
|
const activeTextRange = textSelectionService.getActiveTextRange();
|
|
5740
5723
|
if (editorDataModel == null || activeTextRange == null) return null;
|
|
@@ -5831,15 +5814,14 @@ const SetRangeFontIncreaseCommand = {
|
|
|
5831
5814
|
if (isCellEditorFocus) {
|
|
5832
5815
|
const textRun = getFontStyleAtCursor(accessor);
|
|
5833
5816
|
if (textRun != null) {
|
|
5834
|
-
var _textRun$ts
|
|
5835
|
-
const value = (
|
|
5817
|
+
var _textRun$ts;
|
|
5818
|
+
const value = ((_textRun$ts = textRun.ts) === null || _textRun$ts === void 0 ? void 0 : _textRun$ts.fs) ?? defaultValue;
|
|
5836
5819
|
params.value = value >= 400 ? 400 : value + 1;
|
|
5837
5820
|
}
|
|
5838
5821
|
return commandService.executeCommand(_univerjs_docs_ui.SetInlineFormatFontSizeCommand.id, params);
|
|
5839
5822
|
}
|
|
5840
5823
|
if (primary != null) {
|
|
5841
|
-
|
|
5842
|
-
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;
|
|
5843
5825
|
params.value = value >= 400 ? 400 : value + 1;
|
|
5844
5826
|
return commandService.executeCommand(_univerjs_sheets.SetFontSizeCommand.id, params);
|
|
5845
5827
|
}
|
|
@@ -5862,15 +5844,14 @@ const SetRangeFontDecreaseCommand = {
|
|
|
5862
5844
|
if (isCellEditorFocus) {
|
|
5863
5845
|
const textRun = getFontStyleAtCursor(accessor);
|
|
5864
5846
|
if (textRun != null) {
|
|
5865
|
-
var _textRun$
|
|
5866
|
-
const value = (
|
|
5847
|
+
var _textRun$ts2;
|
|
5848
|
+
const value = ((_textRun$ts2 = textRun.ts) === null || _textRun$ts2 === void 0 ? void 0 : _textRun$ts2.fs) ?? defaultValue;
|
|
5867
5849
|
params.value = value <= 6 ? 6 : value - 1;
|
|
5868
5850
|
}
|
|
5869
5851
|
return commandService.executeCommand(_univerjs_docs_ui.SetInlineFormatFontSizeCommand.id, params);
|
|
5870
5852
|
}
|
|
5871
5853
|
if (primary != null) {
|
|
5872
|
-
|
|
5873
|
-
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;
|
|
5874
5855
|
params.value = value <= 6 ? 6 : value - 1;
|
|
5875
5856
|
return commandService.executeCommand(_univerjs_sheets.SetFontSizeCommand.id, params);
|
|
5876
5857
|
}
|
|
@@ -6424,8 +6405,8 @@ let FormatPainterService = class FormatPainterService extends _univerjs_core.Dis
|
|
|
6424
6405
|
};
|
|
6425
6406
|
}
|
|
6426
6407
|
addHook(hook) {
|
|
6427
|
-
var
|
|
6428
|
-
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;
|
|
6429
6410
|
else {
|
|
6430
6411
|
this._extendHooks.push(hook);
|
|
6431
6412
|
this._extendHooks.sort((a, b) => (a.priority || 0) - (b.priority || 0));
|
|
@@ -6572,7 +6553,7 @@ let SheetScrollManagerService = class SheetScrollManagerService {
|
|
|
6572
6553
|
this._rawScrollInfo$.complete();
|
|
6573
6554
|
}
|
|
6574
6555
|
calcViewportScrollFromRowColOffset(scrollInfo) {
|
|
6575
|
-
var _skeleton$getCellWith
|
|
6556
|
+
var _skeleton$getCellWith;
|
|
6576
6557
|
if (!scrollInfo) return {
|
|
6577
6558
|
viewportScrollX: 0,
|
|
6578
6559
|
viewportScrollY: 0
|
|
@@ -6581,7 +6562,7 @@ let SheetScrollManagerService = class SheetScrollManagerService {
|
|
|
6581
6562
|
sheetViewStartRow = sheetViewStartRow || 0;
|
|
6582
6563
|
offsetY = offsetY || 0;
|
|
6583
6564
|
const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
|
|
6584
|
-
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)) ?? {};
|
|
6585
6566
|
return {
|
|
6586
6567
|
viewportScrollX: colStart + offsetX,
|
|
6587
6568
|
viewportScrollY: rowStart + offsetY
|
|
@@ -6662,10 +6643,10 @@ let SheetScrollManagerService = class SheetScrollManagerService {
|
|
|
6662
6643
|
return ((_this$_scrollStateMap = this._scrollStateMap.get(unitId)) === null || _this$_scrollStateMap === void 0 ? void 0 : _this$_scrollStateMap.get(sheetId)) || this._getDefaultScrollState(param);
|
|
6663
6644
|
}
|
|
6664
6645
|
_getDefaultScrollState(param) {
|
|
6665
|
-
var _this$_sheetSkeletonM, _this$_sheetSkeletonM2, _this$_sheetSkeletonM3, _this$_sheetSkeletonM4
|
|
6666
|
-
const skeleton = (_this$_sheetSkeletonM = (_this$_sheetSkeletonM2 =
|
|
6667
|
-
const colGapSize = (
|
|
6668
|
-
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;
|
|
6669
6650
|
return {
|
|
6670
6651
|
sheetViewStartRow: 0,
|
|
6671
6652
|
sheetViewStartColumn: 0,
|
|
@@ -6710,11 +6691,10 @@ const SetSelectionFrozenCommand = {
|
|
|
6710
6691
|
startColumn = sheetViewStartColumn + 1;
|
|
6711
6692
|
freezedColCount = 1;
|
|
6712
6693
|
} else {
|
|
6713
|
-
var _primary$startRow, _primary$startColumn;
|
|
6714
6694
|
const { primary, range } = selections[(selections === null || selections === void 0 ? void 0 : selections.length) - 1];
|
|
6715
|
-
let selectRow = (
|
|
6695
|
+
let selectRow = (primary === null || primary === void 0 ? void 0 : primary.startRow) ?? range.startRow;
|
|
6716
6696
|
if (selectRow === 0) selectRow = 1;
|
|
6717
|
-
let selectColumn = (
|
|
6697
|
+
let selectColumn = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
|
|
6718
6698
|
if (selectColumn === 0) selectColumn = 1;
|
|
6719
6699
|
const rangeType = range.rangeType;
|
|
6720
6700
|
if (rangeType === _univerjs_core.RANGE_TYPE.ROW || type === 1) {
|
|
@@ -7535,12 +7515,11 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends _u
|
|
|
7535
7515
|
this._scrollToCell(row, column);
|
|
7536
7516
|
}
|
|
7537
7517
|
_scrollToSelection(targetIsActualRowAndColumn = true) {
|
|
7538
|
-
var _selection$primary;
|
|
7539
7518
|
const selection = this._getSelectionsService().getCurrentLastSelection();
|
|
7540
7519
|
if (!selection) return;
|
|
7541
|
-
const { startRow, startColumn, actualRow, actualColumn } =
|
|
7542
|
-
const selectionStartRow = targetIsActualRowAndColumn ? actualRow
|
|
7543
|
-
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;
|
|
7544
7523
|
this._scrollToCell(selectionStartRow, selectionStartColumn);
|
|
7545
7524
|
}
|
|
7546
7525
|
_getSelectionsService() {
|
|
@@ -7558,14 +7537,14 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends _u
|
|
|
7558
7537
|
return skeleton.getRangeByViewBound(vpInfo.viewBound);
|
|
7559
7538
|
}
|
|
7560
7539
|
_scrollToCell(row, column, forceTop = false, forceLeft = false) {
|
|
7561
|
-
var _this$
|
|
7562
|
-
const { rowHeightAccumulation, columnWidthAccumulation } =
|
|
7540
|
+
var _this$_getSheetObject2, _this$_sheetSkeletonM6;
|
|
7541
|
+
const { rowHeightAccumulation, columnWidthAccumulation } = this._sheetSkeletonManagerService.getCurrentSkeleton() ?? {};
|
|
7563
7542
|
if (rowHeightAccumulation == null || columnWidthAccumulation == null) return false;
|
|
7564
7543
|
const scene = (_this$_getSheetObject2 = this._getSheetObject()) === null || _this$_getSheetObject2 === void 0 ? void 0 : _this$_getSheetObject2.scene;
|
|
7565
7544
|
if (scene == null) return false;
|
|
7566
7545
|
const viewport = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7567
7546
|
if (viewport == null) return false;
|
|
7568
|
-
const skeleton = (_this$
|
|
7547
|
+
const skeleton = (_this$_sheetSkeletonM6 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM6 === void 0 ? void 0 : _this$_sheetSkeletonM6.skeleton;
|
|
7569
7548
|
if (skeleton == null) return false;
|
|
7570
7549
|
const worksheet = this._context.unit.getActiveSheet();
|
|
7571
7550
|
if (!worksheet) return false;
|
|
@@ -7729,10 +7708,10 @@ const ScrollCommand = {
|
|
|
7729
7708
|
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(SetScrollOperation.id, {
|
|
7730
7709
|
unitId: workbook.getUnitId(),
|
|
7731
7710
|
sheetId: worksheet.getSheetId(),
|
|
7732
|
-
sheetViewStartRow: sheetViewStartRow
|
|
7733
|
-
sheetViewStartColumn: sheetViewStartColumn
|
|
7734
|
-
offsetX: offsetX
|
|
7735
|
-
offsetY: offsetY
|
|
7711
|
+
sheetViewStartRow: sheetViewStartRow ?? currentRow ?? 0 + ySplit,
|
|
7712
|
+
sheetViewStartColumn: sheetViewStartColumn ?? currentColumn ?? 0 + xSplit,
|
|
7713
|
+
offsetX: offsetX ?? currentOffsetX,
|
|
7714
|
+
offsetY: offsetY ?? currentOffsetY,
|
|
7736
7715
|
duration
|
|
7737
7716
|
});
|
|
7738
7717
|
}
|
|
@@ -8280,8 +8259,7 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
8280
8259
|
};
|
|
8281
8260
|
}
|
|
8282
8261
|
_getWorkbookForEditUnit(unitId) {
|
|
8283
|
-
|
|
8284
|
-
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);
|
|
8285
8263
|
}
|
|
8286
8264
|
getCurrentEditorId() {
|
|
8287
8265
|
return this._editorUnitId;
|
|
@@ -8612,7 +8590,7 @@ const SetCellEditVisibleOperation = {
|
|
|
8612
8590
|
if (!workbook) return false;
|
|
8613
8591
|
accessor.get(IEditorBridgeService).changeVisible({
|
|
8614
8592
|
...params,
|
|
8615
|
-
unitId: unitId
|
|
8593
|
+
unitId: unitId ?? workbook.getUnitId()
|
|
8616
8594
|
});
|
|
8617
8595
|
return true;
|
|
8618
8596
|
}
|
|
@@ -8658,11 +8636,11 @@ const ScrollToRangeOperation = {
|
|
|
8658
8636
|
id: "sheet.operation.scroll-to-range",
|
|
8659
8637
|
type: _univerjs_core.CommandType.OPERATION,
|
|
8660
8638
|
handler: (accessor, params) => {
|
|
8661
|
-
var
|
|
8639
|
+
var _instanceService$getC;
|
|
8662
8640
|
if (!params) return false;
|
|
8663
8641
|
const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
8664
8642
|
const renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
8665
|
-
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());
|
|
8666
8644
|
if (!unitId) return false;
|
|
8667
8645
|
const renderUnit = renderManagerService.getRenderUnitById(unitId);
|
|
8668
8646
|
if (!renderUnit) return false;
|
|
@@ -8817,10 +8795,7 @@ let SheetsRenderService = class SheetsRenderService extends _univerjs_core.RxDis
|
|
|
8817
8795
|
}
|
|
8818
8796
|
_initWorkbookListener() {
|
|
8819
8797
|
this._instanceSrv.getTypeOfUnitAdded$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe((event) => this._createRenderer(event.unit, event.options));
|
|
8820
|
-
this._instanceSrv.getAllUnitsForType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).forEach((workbook) =>
|
|
8821
|
-
var _this$_instanceSrv$ge;
|
|
8822
|
-
return this._createRenderer(workbook, (_this$_instanceSrv$ge = this._instanceSrv.getUnitCreateOptions(workbook.getUnitId())) !== null && _this$_instanceSrv$ge !== void 0 ? _this$_instanceSrv$ge : void 0);
|
|
8823
|
-
});
|
|
8798
|
+
this._instanceSrv.getAllUnitsForType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).forEach((workbook) => this._createRenderer(workbook, this._instanceSrv.getUnitCreateOptions(workbook.getUnitId()) ?? void 0));
|
|
8824
8799
|
this._instanceSrv.getTypeOfUnitDisposed$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe((workbook) => this._disposeRenderer(workbook));
|
|
8825
8800
|
}
|
|
8826
8801
|
_createRenderer(workbook, createUnitOptions) {
|
|
@@ -9124,7 +9099,7 @@ let AutoHeightController = class AutoHeightController extends _univerjs_core.Dis
|
|
|
9124
9099
|
_initialize() {
|
|
9125
9100
|
this.disposeWithMe(this._sheetInterceptorService.interceptAutoHeight({ getMutations: (info) => {
|
|
9126
9101
|
const { unitId, subUnitId, ranges, autoHeightRanges, lazyAutoHeightRanges, cellHeights } = info;
|
|
9127
|
-
const undoRedoItem = this.getUndoRedoParamsOfAutoHeight(autoHeightRanges
|
|
9102
|
+
const undoRedoItem = this.getUndoRedoParamsOfAutoHeight(autoHeightRanges ?? ranges, subUnitId, cellHeights);
|
|
9128
9103
|
return this._processLazyAutoHeight(undoRedoItem, unitId, subUnitId, lazyAutoHeightRanges);
|
|
9129
9104
|
} }));
|
|
9130
9105
|
}
|
|
@@ -9651,10 +9626,9 @@ SheetRenderController = __decorate([
|
|
|
9651
9626
|
__decorateParam(5, (0, _univerjs_core.Optional)(_univerjs_telemetry.ITelemetryService))
|
|
9652
9627
|
], SheetRenderController);
|
|
9653
9628
|
function getLeftTopPlaceholderSize(skeleton) {
|
|
9654
|
-
var _skeleton$rowHeaderWi, _skeleton$columnHeade;
|
|
9655
9629
|
return {
|
|
9656
|
-
width:
|
|
9657
|
-
height:
|
|
9630
|
+
width: skeleton.rowHeaderWidthAndMarginLeft ?? skeleton.rowHeaderWidth,
|
|
9631
|
+
height: skeleton.columnHeaderHeightAndMarginTop ?? skeleton.columnHeaderHeight
|
|
9658
9632
|
};
|
|
9659
9633
|
}
|
|
9660
9634
|
|
|
@@ -9933,29 +9907,22 @@ SheetLoadingRenderService = __decorate([
|
|
|
9933
9907
|
//#region src/views/hook.ts
|
|
9934
9908
|
const SheetLoadingWorkbookContext = (0, react.createContext)(null);
|
|
9935
9909
|
function useActiveWorkbook() {
|
|
9936
|
-
var _ref;
|
|
9937
9910
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
9938
9911
|
const loadingWorkbook = (0, react.useContext)(SheetLoadingWorkbookContext);
|
|
9939
9912
|
const workbook = (0, _univerjs_ui.useObservable)(() => univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), void 0, void 0, []);
|
|
9940
|
-
return
|
|
9913
|
+
return loadingWorkbook ?? workbook ?? null;
|
|
9941
9914
|
}
|
|
9942
9915
|
function useSheetLoadingWorkbook() {
|
|
9943
|
-
|
|
9944
|
-
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;
|
|
9945
9917
|
}
|
|
9946
9918
|
function useSheetLoading() {
|
|
9947
|
-
|
|
9948
|
-
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;
|
|
9949
9920
|
}
|
|
9950
9921
|
function useSheetLoadingPreviewReady() {
|
|
9951
|
-
|
|
9952
|
-
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;
|
|
9953
9923
|
}
|
|
9954
9924
|
function useActiveWorksheet(workbook) {
|
|
9955
|
-
return (0, _univerjs_ui.useObservable)(() =>
|
|
9956
|
-
var _workbook$activeSheet;
|
|
9957
|
-
return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : (0, rxjs.of)(null);
|
|
9958
|
-
}, 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]);
|
|
9959
9926
|
}
|
|
9960
9927
|
function useWorkbooks() {
|
|
9961
9928
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
@@ -9994,7 +9961,7 @@ const SheetPasteOptions = [
|
|
|
9994
9961
|
}
|
|
9995
9962
|
];
|
|
9996
9963
|
const useMenuPosition = (range) => {
|
|
9997
|
-
var _scene$getEngine
|
|
9964
|
+
var _scene$getEngine;
|
|
9998
9965
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
9999
9966
|
const renderManagerService = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService);
|
|
10000
9967
|
const workbook = useActiveWorkbook();
|
|
@@ -10020,10 +9987,10 @@ const useMenuPosition = (range) => {
|
|
|
10020
9987
|
const canvas = (_scene$getEngine = scene.getEngine()) === null || _scene$getEngine === void 0 ? void 0 : _scene$getEngine.getCanvas();
|
|
10021
9988
|
if (!scaleX || !scene || !scaleX || !scaleY || !scrollXY) return null;
|
|
10022
9989
|
const endPosition = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getNoMergeCellWithCoordByIndex(anchor.endRow, anchor.endCol);
|
|
10023
|
-
const endX = (
|
|
10024
|
-
const endY = (
|
|
10025
|
-
const positionEndX = (
|
|
10026
|
-
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;
|
|
10027
9994
|
const canvasWidth = canvas === null || canvas === void 0 ? void 0 : canvas.getWidth();
|
|
10028
9995
|
const canvasHeight = canvas === null || canvas === void 0 ? void 0 : canvas.getHeight();
|
|
10029
9996
|
if (!canvasWidth || !canvasHeight) return null;
|
|
@@ -10179,16 +10146,16 @@ const ISheetEmbedInteractionBoundaryService = (0, _univerjs_core.createIdentifie
|
|
|
10179
10146
|
const ISheetEmbedRuntimeFocusCoordinator = (0, _univerjs_core.createIdentifier)("sheets-ui.embed-runtime-focus-coordinator");
|
|
10180
10147
|
const ISheetEmbedFloatingGeometryService = (0, _univerjs_core.createIdentifier)("sheets-ui.embed-floating-geometry.service");
|
|
10181
10148
|
function resolveSheetEmbedRuntimeDomScope(element) {
|
|
10182
|
-
var _element$closest
|
|
10149
|
+
var _element$closest;
|
|
10183
10150
|
if (!element) return;
|
|
10184
|
-
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;
|
|
10185
10152
|
const container = resolveSheetEmbedFloatDomContainer(element, embedId);
|
|
10186
|
-
const resolvedEmbedId = (
|
|
10153
|
+
const resolvedEmbedId = (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-id")) ?? embedId;
|
|
10187
10154
|
if (!resolvedEmbedId) return;
|
|
10188
10155
|
return {
|
|
10189
10156
|
embedId: resolvedEmbedId,
|
|
10190
|
-
hostUnitId: (
|
|
10191
|
-
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,
|
|
10192
10159
|
childType: readChildType(container)
|
|
10193
10160
|
};
|
|
10194
10161
|
}
|
|
@@ -10198,12 +10165,11 @@ function resolveActiveSheetEmbedRuntimeDomScope(ownerDocument = document) {
|
|
|
10198
10165
|
return resolveSheetEmbedRuntimeDomScope(activeContainer);
|
|
10199
10166
|
}
|
|
10200
10167
|
function resolveSheetEmbedFloatDomContainer(element, embedId) {
|
|
10201
|
-
var _element$ownerDocumen, _ownerDocument$queryS;
|
|
10202
10168
|
const ownContainer = element === null || element === void 0 ? void 0 : element.closest(`[${SHEET_EMBED_FLOAT_DOM_ATTRIBUTE}="true"]`);
|
|
10203
10169
|
if (ownContainer && (!embedId || ownContainer.getAttribute("data-embed-id") === embedId)) return ownContainer;
|
|
10204
|
-
const ownerDocument = (
|
|
10205
|
-
if (!ownerDocument || !embedId) return ownContainer
|
|
10206
|
-
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;
|
|
10207
10173
|
}
|
|
10208
10174
|
function escapeAttributeValue(value) {
|
|
10209
10175
|
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
@@ -10233,15 +10199,14 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10233
10199
|
return (0, _univerjs_engine_render.getCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService);
|
|
10234
10200
|
}
|
|
10235
10201
|
get _editingUnitId() {
|
|
10236
|
-
var _this$_editorBridgeSe
|
|
10237
|
-
return (_this$_editorBridgeSe =
|
|
10202
|
+
var _this$_editorBridgeSe;
|
|
10203
|
+
return ((_this$_editorBridgeSe = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.unitId) ?? "";
|
|
10238
10204
|
}
|
|
10239
10205
|
get _editingRenderer() {
|
|
10240
10206
|
return this._renderManagerService.getRenderUnitById(this._editingUnitId);
|
|
10241
10207
|
}
|
|
10242
10208
|
get _renderer() {
|
|
10243
|
-
|
|
10244
|
-
return (_this$_editingRendere = this._editingRenderer) !== null && _this$_editingRendere !== void 0 ? _this$_editingRendere : this._currentRenderer;
|
|
10209
|
+
return this._editingRenderer ?? this._currentRenderer;
|
|
10245
10210
|
}
|
|
10246
10211
|
get _sheetSkeletonManagerService() {
|
|
10247
10212
|
var _this$_renderer;
|
|
@@ -10252,7 +10217,6 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10252
10217
|
return (_this$_renderer2 = this._renderer) === null || _this$_renderer2 === void 0 ? void 0 : _this$_renderer2.engine;
|
|
10253
10218
|
}
|
|
10254
10219
|
fitTextSize(callback) {
|
|
10255
|
-
var _paddingData$l, _paddingData$r, _paddingData$t, _paddingData$b;
|
|
10256
10220
|
const param = this._editorBridgeService.getEditCellState();
|
|
10257
10221
|
if (!param) return;
|
|
10258
10222
|
const { position, documentLayoutObject, canvasOffset, scaleX, scaleY } = param;
|
|
@@ -10266,8 +10230,8 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10266
10230
|
if (!info || info.actualWidth <= 0) return;
|
|
10267
10231
|
let { actualWidth, actualHeight } = info;
|
|
10268
10232
|
const { verticalAlign, horizontalAlign, paddingData, fill } = documentLayoutObject;
|
|
10269
|
-
actualWidth = actualWidth + (
|
|
10270
|
-
actualHeight = actualHeight + (
|
|
10233
|
+
actualWidth = actualWidth + (paddingData.l ?? 0) * scaleX + (paddingData.r ?? 0) * scaleX;
|
|
10234
|
+
actualHeight = actualHeight + (paddingData.t ?? 0) * scaleY + (paddingData.b ?? 0) * scaleY;
|
|
10271
10235
|
let editorWidth = endX - startX;
|
|
10272
10236
|
let editorHeight = endY - startY;
|
|
10273
10237
|
if (editorWidth < actualWidth) editorWidth = Math.ceil(actualWidth);
|
|
@@ -10333,8 +10297,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10333
10297
|
_getEditorMaxSize(position, canvasOffset, horizontalAlign) {
|
|
10334
10298
|
if (this._getEditorObject() == null) return;
|
|
10335
10299
|
function pxToNum(size) {
|
|
10336
|
-
|
|
10337
|
-
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", "")) ?? "");
|
|
10338
10301
|
}
|
|
10339
10302
|
const engine = this.engine;
|
|
10340
10303
|
if (!engine) return;
|
|
@@ -10435,8 +10398,8 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10435
10398
|
});
|
|
10436
10399
|
}
|
|
10437
10400
|
_getEditorContentElement() {
|
|
10438
|
-
var _this$_embedFloatingG
|
|
10439
|
-
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();
|
|
10440
10403
|
}
|
|
10441
10404
|
/**
|
|
10442
10405
|
* Since the document does not support cell background color, an additional rect needs to be added.
|
|
@@ -10683,10 +10646,9 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
10683
10646
|
}));
|
|
10684
10647
|
}
|
|
10685
10648
|
_showEditorByKeyboard(config) {
|
|
10686
|
-
var _ref, _config$content;
|
|
10687
10649
|
const event = config === null || config === void 0 ? void 0 : config.event;
|
|
10688
10650
|
if (config == null || !event.data && event.inputType !== "InsertParagraph") return;
|
|
10689
|
-
const initialValue =
|
|
10651
|
+
const initialValue = config.content ?? event.data ?? "";
|
|
10690
10652
|
this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
|
|
10691
10653
|
visible: true,
|
|
10692
10654
|
eventType: _univerjs_engine_render.DeviceInputEventType.Keyboard,
|
|
@@ -11493,8 +11455,7 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11493
11455
|
_initialCursorSync(d) {
|
|
11494
11456
|
d.add(this._cellEditorManagerService.focus$.pipe((0, rxjs.filter)((f) => !!f)).subscribe(() => {
|
|
11495
11457
|
var _this$_univerInstance, _this$_renderManagerS2;
|
|
11496
|
-
const
|
|
11497
|
-
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());
|
|
11498
11459
|
if (!docUnitId) return;
|
|
11499
11460
|
const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(docUnitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
11500
11461
|
if (!docSelectionRenderManager) return;
|
|
@@ -11656,17 +11617,17 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11656
11617
|
subUnitId: _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY
|
|
11657
11618
|
});
|
|
11658
11619
|
};
|
|
11659
|
-
const
|
|
11660
|
-
this._submitEmptyCellImageEdit =
|
|
11661
|
-
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();
|
|
11662
11623
|
else if (eventType === _univerjs_engine_render.DeviceInputEventType.Keyboard && keycode === _univerjs_ui.KeyCode.F2) {
|
|
11663
|
-
var _documentDataModel$ge
|
|
11624
|
+
var _documentDataModel$ge;
|
|
11664
11625
|
document.makeDirty();
|
|
11665
11626
|
this._textSelectionManagerService.replaceDocRanges([{
|
|
11666
11627
|
startOffset: 0,
|
|
11667
11628
|
endOffset: 0
|
|
11668
11629
|
}]);
|
|
11669
|
-
const endOffset = ((_documentDataModel$ge =
|
|
11630
|
+
const endOffset = (((_documentDataModel$ge = documentDataModel.getBody()) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.dataStream.length) ?? 2) - 2;
|
|
11670
11631
|
this._textSelectionManagerService.replaceDocRanges([{
|
|
11671
11632
|
startOffset: endOffset,
|
|
11672
11633
|
endOffset
|
|
@@ -11697,7 +11658,7 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11697
11658
|
}
|
|
11698
11659
|
}
|
|
11699
11660
|
async _handleEditorInvisible(param) {
|
|
11700
|
-
var
|
|
11661
|
+
var _snapshot$body;
|
|
11701
11662
|
const editCellState = this._editorBridgeService.getEditCellState();
|
|
11702
11663
|
const documentDataModel = this._univerInstanceService.getUnit(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
11703
11664
|
const snapshot = _univerjs_core.Tools.deepClone(documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getSnapshot());
|
|
@@ -11705,7 +11666,7 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11705
11666
|
const shouldSubmitEmptyCellImageEdit = this._submitEmptyCellImageEdit;
|
|
11706
11667
|
this._submitEmptyCellImageEdit = false;
|
|
11707
11668
|
this._cursorChange = 0;
|
|
11708
|
-
const currentUnitId = (
|
|
11669
|
+
const currentUnitId = (editCellState === null || editCellState === void 0 ? void 0 : editCellState.unitId) ?? "";
|
|
11709
11670
|
this._exitInput(param);
|
|
11710
11671
|
if (editCellState == null) return;
|
|
11711
11672
|
const workbook = this._univerInstanceService.getUnit(currentUnitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
@@ -11727,10 +11688,10 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11727
11688
|
return;
|
|
11728
11689
|
}
|
|
11729
11690
|
const isEmpty = (snapshot === null || snapshot === void 0 || (_snapshot$body = snapshot.body) === null || _snapshot$body === void 0 ? void 0 : _snapshot$body.dataStream.length) === 2;
|
|
11730
|
-
const
|
|
11691
|
+
const cellImage = editCellState.documentLayoutObject.documentModel ? (0, _univerjs_sheets.isCellImage)(editCellState.documentLayoutObject.documentModel.getSnapshot()) : false;
|
|
11731
11692
|
if (snapshot && shouldSubmitCellEdit({
|
|
11732
11693
|
isEmpty,
|
|
11733
|
-
isCellImage,
|
|
11694
|
+
isCellImage: cellImage,
|
|
11734
11695
|
shouldSubmitEmptyCellImageEdit
|
|
11735
11696
|
})) {
|
|
11736
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;
|
|
@@ -11740,10 +11701,6 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11740
11701
|
_getEditorObject() {
|
|
11741
11702
|
return getEditorObject(this._editorBridgeService.getCurrentEditorId(), this._renderManagerService);
|
|
11742
11703
|
}
|
|
11743
|
-
_isCellImageData(snapshot) {
|
|
11744
|
-
var _snapshot$drawingsOrd, _snapshot$drawingsOrd2;
|
|
11745
|
-
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;
|
|
11746
|
-
}
|
|
11747
11704
|
submitCellData(documentDataModel) {
|
|
11748
11705
|
return this._submitEdit(documentDataModel.getSnapshot());
|
|
11749
11706
|
}
|
|
@@ -11920,7 +11877,7 @@ EditingRenderController = __decorate([
|
|
|
11920
11877
|
__decorateParam(15, _univerjs_core.IConfigService)
|
|
11921
11878
|
], EditingRenderController);
|
|
11922
11879
|
function getCellDataByInput(cellData, snapshot, lexerTreeBuilder, localeService, functionService, styles) {
|
|
11923
|
-
var
|
|
11880
|
+
var _styles$get;
|
|
11924
11881
|
if ((snapshot === null || snapshot === void 0 ? void 0 : snapshot.body) == null) return null;
|
|
11925
11882
|
const { body } = snapshot;
|
|
11926
11883
|
cellData.t = void 0;
|
|
@@ -11928,7 +11885,7 @@ function getCellDataByInput(cellData, snapshot, lexerTreeBuilder, localeService,
|
|
|
11928
11885
|
let newDataStream = data.substring(data.length - 2, data.length) === _univerjs_core.DEFAULT_EMPTY_DOCUMENT_VALUE ? data.substring(0, data.length - 2) : data;
|
|
11929
11886
|
const currentLocale = localeService.getCurrentLocale();
|
|
11930
11887
|
newDataStream = normalizeString(newDataStream, lexerTreeBuilder, currentLocale, functionService);
|
|
11931
|
-
if ((
|
|
11888
|
+
if ((0, _univerjs_sheets.isCellImage)(snapshot)) {
|
|
11932
11889
|
cellData.v = "";
|
|
11933
11890
|
cellData.f = null;
|
|
11934
11891
|
cellData.si = null;
|
|
@@ -11984,10 +11941,9 @@ function isRichText(body) {
|
|
|
11984
11941
|
const bodyNoLineBreak = body.dataStream.replace(/(\r\n)+$/, "");
|
|
11985
11942
|
const richTextStyle = ["va"];
|
|
11986
11943
|
return textRuns.filter((ts) => ts.st < bodyNoLineBreak.length).some((textRun) => {
|
|
11987
|
-
var _textRun$ts;
|
|
11988
11944
|
return Boolean(textRun.ts && Object.keys(textRun.ts).some((property) => {
|
|
11989
11945
|
return richTextStyle.includes(property);
|
|
11990
|
-
})) || Object.keys(
|
|
11946
|
+
})) || Object.keys(textRun.ts ?? {}).length && textRun.ed - textRun.st < bodyNoLineBreak.length;
|
|
11991
11947
|
}) || paragraphs.some((paragraph) => paragraph.bullet) || paragraphs.length >= 2 || Boolean(customRanges === null || customRanges === void 0 ? void 0 : customRanges.length) || customBlocks.length > 0;
|
|
11992
11948
|
}
|
|
11993
11949
|
function shouldSubmitCellEdit({ isEmpty, isCellImage, shouldSubmitEmptyCellImageEdit }) {
|
|
@@ -12116,9 +12072,9 @@ function getSetCellDataMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12116
12072
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
12117
12073
|
const cellValueMatrix = new _univerjs_core.ObjectMatrix();
|
|
12118
12074
|
matrix.forValue((rowIndex, columnIndex, value) => {
|
|
12119
|
-
var _value$
|
|
12075
|
+
var _value$p, _newStyle$n;
|
|
12120
12076
|
const { row, col } = mapFunc(rowIndex, columnIndex);
|
|
12121
|
-
const newStyle = { ...
|
|
12077
|
+
const newStyle = { ...value.s ?? {} };
|
|
12122
12078
|
if (newStyle.bd && Object.keys(newStyle.bd).length === 0) newStyle.bd = {
|
|
12123
12079
|
t: null,
|
|
12124
12080
|
r: null,
|
|
@@ -12179,7 +12135,7 @@ function getSetCellValueMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12179
12135
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
12180
12136
|
const cellValueMatrix = new _univerjs_core.ObjectMatrix();
|
|
12181
12137
|
matrix.forValue((rowIndex, columnIndex, value) => {
|
|
12182
|
-
var _value$p2, _value$
|
|
12138
|
+
var _value$p2, _value$s;
|
|
12183
12139
|
const { row, col } = mapFunc(rowIndex, columnIndex);
|
|
12184
12140
|
let cellValue = {
|
|
12185
12141
|
p: null,
|
|
@@ -12190,7 +12146,7 @@ function getSetCellValueMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12190
12146
|
p: value.p,
|
|
12191
12147
|
v: value.v
|
|
12192
12148
|
};
|
|
12193
|
-
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)) {
|
|
12194
12150
|
/**
|
|
12195
12151
|
* The `pasteFrom` is null, means the data is pasted from outside.
|
|
12196
12152
|
* If the value's style has no number format, handle it as follows:
|
|
@@ -12232,9 +12188,9 @@ function getSetCellStyleMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12232
12188
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
12233
12189
|
const cellValueMatrix = new _univerjs_core.ObjectMatrix();
|
|
12234
12190
|
matrix.forValue((rowIndex, columnIndex, value) => {
|
|
12235
|
-
var
|
|
12191
|
+
var _newStyle$n2;
|
|
12236
12192
|
const { row, col } = mapFunc(rowIndex, columnIndex);
|
|
12237
|
-
const newStyle = { ...
|
|
12193
|
+
const newStyle = { ...value.s ?? {} };
|
|
12238
12194
|
if (newStyle.bd && Object.keys(newStyle.bd).length === 0) newStyle.bd = {
|
|
12239
12195
|
t: null,
|
|
12240
12196
|
r: null,
|
|
@@ -12786,7 +12742,6 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
|
|
|
12786
12742
|
};
|
|
12787
12743
|
},
|
|
12788
12744
|
onPasteColumns(pasteTo, colProperties, payload) {
|
|
12789
|
-
var _self$_configService$;
|
|
12790
12745
|
const redos = [];
|
|
12791
12746
|
const undos = [];
|
|
12792
12747
|
if (payload.pasteType !== PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_COL_WIDTH) return {
|
|
@@ -12800,7 +12755,7 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
|
|
|
12800
12755
|
undos
|
|
12801
12756
|
};
|
|
12802
12757
|
const worksheet = self._getWorksheet(unitId, subUnitId);
|
|
12803
|
-
const defaultColumnWidth =
|
|
12758
|
+
const defaultColumnWidth = self._configService.getConfig(_univerjs_core.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY) ?? _univerjs_core.DEFAULT_WORKSHEET_COLUMN_WIDTH;
|
|
12804
12759
|
const pasteRangeStartRow = rows[0];
|
|
12805
12760
|
const pasteRangeEndRow = rows[rows.length - 1];
|
|
12806
12761
|
const pasteRangeStartColumn = cols[0];
|
|
@@ -13281,8 +13236,8 @@ const calcDocRangePositions = (range, skeleton) => {
|
|
|
13281
13236
|
const skeletonData = skeleton.getSkeletonData();
|
|
13282
13237
|
let end = range.endOffset;
|
|
13283
13238
|
if (range.segmentId) {
|
|
13284
|
-
var
|
|
13285
|
-
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];
|
|
13286
13241
|
if (root) end = Math.min(root.ed, end);
|
|
13287
13242
|
}
|
|
13288
13243
|
const endPosition = skeleton.findNodePositionByCharIndex(end, true, range.segmentId, pageIndex);
|
|
@@ -13363,13 +13318,13 @@ const calcBulletPosition = (skeleton, paragraph, paddingLeft = 0, paddingTop = 0
|
|
|
13363
13318
|
};
|
|
13364
13319
|
};
|
|
13365
13320
|
const calculateDocSkeletonRects = (docSkeleton, paddingLeft = 0, paddingTop = 0) => {
|
|
13366
|
-
var _docModel$getBody
|
|
13321
|
+
var _docModel$getBody, _docModel$getBody2, _docSkeleton$getSkele;
|
|
13367
13322
|
const docModel = docSkeleton.getViewModel().getDataModel();
|
|
13368
|
-
const hyperLinks = (
|
|
13369
|
-
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) => {
|
|
13370
13325
|
var _p$bullet;
|
|
13371
13326
|
return ((_p$bullet = p.bullet) === null || _p$bullet === void 0 ? void 0 : _p$bullet.listType.indexOf(_univerjs_core.PresetListType.CHECK_LIST)) === 0;
|
|
13372
|
-
}))
|
|
13327
|
+
})) ?? [];
|
|
13373
13328
|
const drawings = (_docSkeleton$getSkele = docSkeleton.getSkeletonData()) === null || _docSkeleton$getSkele === void 0 ? void 0 : _docSkeleton$getSkele.pages[0].skeDrawings;
|
|
13374
13329
|
return {
|
|
13375
13330
|
links: hyperLinks.map((link) => calcLinkPosition(docSkeleton, link, paddingLeft, paddingTop)).filter(Boolean),
|
|
@@ -13387,9 +13342,9 @@ const calculateDocSkeletonRects = (docSkeleton, paddingLeft = 0, paddingTop = 0)
|
|
|
13387
13342
|
};
|
|
13388
13343
|
};
|
|
13389
13344
|
function calcPadding(cell, font, isNum) {
|
|
13390
|
-
var _font$documentSkeleto, _font$documentSkeleto2
|
|
13391
|
-
const height = (_font$documentSkeleto =
|
|
13392
|
-
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;
|
|
13393
13348
|
const vt = font.verticalAlign;
|
|
13394
13349
|
const ht = font.horizontalAlign;
|
|
13395
13350
|
let paddingTop = 0;
|
|
@@ -13422,7 +13377,7 @@ function calcPadding(cell, font, isNum) {
|
|
|
13422
13377
|
};
|
|
13423
13378
|
}
|
|
13424
13379
|
const getCustomRangePosition = (injector, unitId, subUnitId, row, col, rangeId) => {
|
|
13425
|
-
var _docSkeleton$getViewM
|
|
13380
|
+
var _docSkeleton$getViewM;
|
|
13426
13381
|
const univerInstanceService = injector.get(_univerjs_core.IUniverInstanceService);
|
|
13427
13382
|
const renderManagerService = injector.get(_univerjs_engine_render.IRenderManagerService);
|
|
13428
13383
|
const workbook = univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
@@ -13448,7 +13403,7 @@ const getCustomRangePosition = (injector, unitId, subUnitId, row, col, rangeId)
|
|
|
13448
13403
|
});
|
|
13449
13404
|
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualColumn);
|
|
13450
13405
|
const cellData = worksheet.getCell(actualCell.actualRow, actualCell.actualColumn);
|
|
13451
|
-
const { topOffset = 0, leftOffset = 0 } = (
|
|
13406
|
+
const { topOffset = 0, leftOffset = 0 } = (cellData === null || cellData === void 0 ? void 0 : cellData.fontRenderExtension) ?? {};
|
|
13452
13407
|
const { paddingLeft, paddingTop } = calcPadding(actualCell, font, false);
|
|
13453
13408
|
const rects = calcDocRangePositions({
|
|
13454
13409
|
startOffset: customRange.startIndex,
|
|
@@ -13508,6 +13463,33 @@ function getLocationBase(location) {
|
|
|
13508
13463
|
const { workbook, worksheet, ...locBase } = location;
|
|
13509
13464
|
return locBase;
|
|
13510
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
|
+
}
|
|
13511
13493
|
let HoverManagerService = class HoverManagerService extends _univerjs_core.Disposable {
|
|
13512
13494
|
constructor(_univerInstanceService, _renderManagerService) {
|
|
13513
13495
|
super();
|
|
@@ -13642,7 +13624,6 @@ let HoverManagerService = class HoverManagerService extends _univerjs_core.Dispo
|
|
|
13642
13624
|
};
|
|
13643
13625
|
}
|
|
13644
13626
|
_calcActiveCell(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY) {
|
|
13645
|
-
var _cellData$fontRenderE, _ref, _customRange$rects$po;
|
|
13646
13627
|
const hoverPosition = getHoverCellPosition(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY);
|
|
13647
13628
|
const skeleton = skeletonParam.skeleton;
|
|
13648
13629
|
if (!hoverPosition) return null;
|
|
@@ -13653,17 +13634,18 @@ let HoverManagerService = class HoverManagerService extends _univerjs_core.Dispo
|
|
|
13653
13634
|
let drawing = null;
|
|
13654
13635
|
const cell = skeleton.getCellWithCoordByIndex(overflowLocation.row, overflowLocation.col);
|
|
13655
13636
|
const cellData = worksheet.getCell(overflowLocation.row, overflowLocation.col);
|
|
13656
|
-
const { topOffset = 0, leftOffset = 0 } = (
|
|
13637
|
+
const { topOffset = 0, leftOffset = 0 } = (cellData === null || cellData === void 0 ? void 0 : cellData.fontRenderExtension) ?? {};
|
|
13657
13638
|
if (font === null || font === void 0 ? void 0 : font.documentSkeleton) {
|
|
13658
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));
|
|
13659
13640
|
const rects = calculateDocSkeletonRects(font.documentSkeleton, paddingLeft, paddingTop);
|
|
13641
|
+
const drawingRects = calculateCellDrawingRects(font, cell, rects.drawings);
|
|
13660
13642
|
const innerX = offsetX - position.startX - leftOffset;
|
|
13661
13643
|
const innerY = offsetY - position.startY - topOffset;
|
|
13662
13644
|
customRange = rects.links.find((link) => link.rects.some((rect) => rect.left <= innerX && innerX <= rect.right && rect.top <= innerY && innerY <= rect.bottom));
|
|
13663
13645
|
bullet = rects.checkLists.find((list) => list.rect.left <= innerX && innerX <= list.rect.right && list.rect.top <= innerY && innerY <= list.rect.bottom);
|
|
13664
|
-
drawing =
|
|
13646
|
+
drawing = drawingRects.find((drawing) => drawing.rect.left <= innerX && innerX <= drawing.rect.right && drawing.rect.top <= innerY && innerY <= drawing.rect.bottom);
|
|
13665
13647
|
}
|
|
13666
|
-
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);
|
|
13667
13649
|
const displayRect = rect && (() => {
|
|
13668
13650
|
const absoluteTop = rect.top + cell.mergeInfo.startY + topOffset;
|
|
13669
13651
|
const absoluteBottom = rect.bottom + cell.mergeInfo.startY + topOffset;
|
|
@@ -14115,7 +14097,7 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends _u
|
|
|
14115
14097
|
}
|
|
14116
14098
|
_createFreeze(freezeDirectionType = 0, freezeConfig) {
|
|
14117
14099
|
var _this$_sheetSkeletonM;
|
|
14118
|
-
const config = freezeConfig
|
|
14100
|
+
const config = freezeConfig ?? this._getFreeze();
|
|
14119
14101
|
if (config == null) return null;
|
|
14120
14102
|
const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
|
|
14121
14103
|
const { startRow: freezeRow, startColumn: freezeColumn } = config;
|
|
@@ -14238,7 +14220,7 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends _u
|
|
|
14238
14220
|
if (s2) this._freezeDownSubs.add(s2);
|
|
14239
14221
|
}
|
|
14240
14222
|
_getCurrentLastVisible() {
|
|
14241
|
-
var _this$_sheetSkeletonM2
|
|
14223
|
+
var _this$_sheetSkeletonM2;
|
|
14242
14224
|
const sheetObject = this._getSheetObject();
|
|
14243
14225
|
if (sheetObject == null) return;
|
|
14244
14226
|
const skeleton = (_this$_sheetSkeletonM2 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM2 === void 0 ? void 0 : _this$_sheetSkeletonM2.skeleton;
|
|
@@ -14248,8 +14230,8 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends _u
|
|
|
14248
14230
|
const currentScroll = this._scrollManagerService.getCurrentScrollState();
|
|
14249
14231
|
const skeletonViewHeight = (sheetObject.engine.height - skeleton.columnHeaderHeight) / scale;
|
|
14250
14232
|
const skeletonViewWidth = (sheetObject.engine.width - skeleton.rowHeaderWidth) / scale;
|
|
14251
|
-
const startRow = (
|
|
14252
|
-
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);
|
|
14253
14235
|
let lastRow = 0;
|
|
14254
14236
|
let hadFind = false;
|
|
14255
14237
|
for (let i = startRow, len = skeleton.rowHeightAccumulation.length; i < len; i++) if (skeleton.rowHeightAccumulation[i] - startHeight > skeletonViewHeight) {
|
|
@@ -14258,8 +14240,8 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends _u
|
|
|
14258
14240
|
break;
|
|
14259
14241
|
}
|
|
14260
14242
|
if (!hadFind) lastRow = skeleton.rowHeightAccumulation.length - 1;
|
|
14261
|
-
const startColumn = (
|
|
14262
|
-
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);
|
|
14263
14245
|
let lastColumn = 0;
|
|
14264
14246
|
let hadFindCol = false;
|
|
14265
14247
|
for (let i = startColumn, len = skeleton.columnWidthAccumulation.length; i < len; i++) if (skeleton.columnWidthAccumulation[i] - startWidth > skeletonViewWidth) {
|
|
@@ -15030,14 +15012,8 @@ function getSheetSelectionsDisabled$(accessor) {
|
|
|
15030
15012
|
const workbook$ = univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
15031
15013
|
return (0, rxjs.combineLatest)([
|
|
15032
15014
|
selectionManagerService.selectionMoveEnd$,
|
|
15033
|
-
workbook$.pipe((0, rxjs.map)((workbook) =>
|
|
15034
|
-
|
|
15035
|
-
return (_workbook$getUnitId = workbook === null || workbook === void 0 ? void 0 : workbook.getUnitId()) !== null && _workbook$getUnitId !== void 0 ? _workbook$getUnitId : "";
|
|
15036
|
-
})),
|
|
15037
|
-
workbook$.pipe((0, rxjs.switchMap)((workbook) => {
|
|
15038
|
-
var _workbook$activeSheet;
|
|
15039
|
-
return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : (0, rxjs.of)(null);
|
|
15040
|
-
}))
|
|
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)))
|
|
15041
15017
|
]).pipe((0, rxjs.map)(([selection, unitId, sheet]) => {
|
|
15042
15018
|
if (!sheet) return false;
|
|
15043
15019
|
if (!selection || selection.length === 0) return false;
|
|
@@ -16027,10 +16003,7 @@ let HeaderUnhideRenderController = class HeaderUnhideRenderController extends _u
|
|
|
16027
16003
|
const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getSkeletonParam(worksheet.getSheetId())) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
|
|
16028
16004
|
if (!skeleton) return;
|
|
16029
16005
|
const visibleCheck = this.interceptor.fetchThroughInterceptors(HEADER_UNHIDE_RANGE_VISIBLE_CHECK);
|
|
16030
|
-
const shouldRenderRange = (payload) =>
|
|
16031
|
-
var _visibleCheck;
|
|
16032
|
-
return this._headerUnhideRangeService.shouldRenderRange((_visibleCheck = visibleCheck(true, payload)) !== null && _visibleCheck !== void 0 ? _visibleCheck : true, payload);
|
|
16033
|
-
};
|
|
16006
|
+
const shouldRenderRange = (payload) => this._headerUnhideRangeService.shouldRenderRange(visibleCheck(true, payload) ?? true, payload);
|
|
16034
16007
|
const hiddenRowRanges = worksheet.getHiddenRows().filter((range) => shouldRenderRange({
|
|
16035
16008
|
axis: "row",
|
|
16036
16009
|
range,
|
|
@@ -16116,43 +16089,43 @@ var StatusBarService = class {
|
|
|
16116
16089
|
{
|
|
16117
16090
|
func: _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.MAX,
|
|
16118
16091
|
filter: (status) => {
|
|
16119
|
-
var _status$values$find
|
|
16120
|
-
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;
|
|
16121
16094
|
}
|
|
16122
16095
|
},
|
|
16123
16096
|
{
|
|
16124
16097
|
func: _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.MIN,
|
|
16125
16098
|
filter: (status) => {
|
|
16126
|
-
var _status$values$
|
|
16127
|
-
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;
|
|
16128
16101
|
}
|
|
16129
16102
|
},
|
|
16130
16103
|
{
|
|
16131
16104
|
func: _univerjs_engine_formula.FUNCTION_NAMES_MATH.SUM,
|
|
16132
16105
|
filter: (status) => {
|
|
16133
|
-
var _status$values$
|
|
16134
|
-
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;
|
|
16135
16108
|
}
|
|
16136
16109
|
},
|
|
16137
16110
|
{
|
|
16138
16111
|
func: _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNTA,
|
|
16139
16112
|
filter: (status) => {
|
|
16140
|
-
var _status$values$
|
|
16141
|
-
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;
|
|
16142
16115
|
}
|
|
16143
16116
|
},
|
|
16144
16117
|
{
|
|
16145
16118
|
func: _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.COUNT,
|
|
16146
16119
|
filter: (status) => {
|
|
16147
|
-
var _status$values$
|
|
16148
|
-
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;
|
|
16149
16122
|
}
|
|
16150
16123
|
},
|
|
16151
16124
|
{
|
|
16152
16125
|
func: _univerjs_engine_formula.FUNCTION_NAMES_STATISTICAL.AVERAGE,
|
|
16153
16126
|
filter: (status) => {
|
|
16154
|
-
var _status$values$
|
|
16155
|
-
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;
|
|
16156
16129
|
}
|
|
16157
16130
|
}
|
|
16158
16131
|
]);
|
|
@@ -16163,7 +16136,6 @@ var StatusBarService = class {
|
|
|
16163
16136
|
this._state$.complete();
|
|
16164
16137
|
}
|
|
16165
16138
|
setState(param) {
|
|
16166
|
-
var _param$pattern;
|
|
16167
16139
|
const newState = {
|
|
16168
16140
|
values: [],
|
|
16169
16141
|
pattern: null
|
|
@@ -16172,7 +16144,7 @@ var StatusBarService = class {
|
|
|
16172
16144
|
const func = this._functions.find((func) => func.func === item.func);
|
|
16173
16145
|
if (func && (func.filter === void 0 || func.filter(param))) newState.values.push(item);
|
|
16174
16146
|
});
|
|
16175
|
-
newState.pattern = (
|
|
16147
|
+
newState.pattern = (param === null || param === void 0 ? void 0 : param.pattern) ?? null;
|
|
16176
16148
|
this._state$.next(newState);
|
|
16177
16149
|
}
|
|
16178
16150
|
getState() {
|
|
@@ -16351,14 +16323,11 @@ let StatusBarController = class StatusBarController extends _univerjs_core.Dispo
|
|
|
16351
16323
|
var _sheetArrayFormulaCel;
|
|
16352
16324
|
const rawCell = sheet.getCellRaw(row, col);
|
|
16353
16325
|
const arrayCell = sheetArrayFormulaCellData === null || sheetArrayFormulaCellData === void 0 || (_sheetArrayFormulaCel = sheetArrayFormulaCellData[row]) === null || _sheetArrayFormulaCel === void 0 ? void 0 : _sheetArrayFormulaCel[col];
|
|
16354
|
-
if (arrayCell) {
|
|
16355
|
-
|
|
16356
|
-
|
|
16357
|
-
|
|
16358
|
-
|
|
16359
|
-
s: (_arrayCell$s = arrayCell.s) !== null && _arrayCell$s !== void 0 ? _arrayCell$s : rawCell === null || rawCell === void 0 ? void 0 : rawCell.s
|
|
16360
|
-
};
|
|
16361
|
-
}
|
|
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
|
+
};
|
|
16362
16331
|
return rawCell;
|
|
16363
16332
|
}
|
|
16364
16333
|
_calculateSelection(selections, primary) {
|
|
@@ -16656,12 +16625,11 @@ function getObservableWithExclusiveRange$(accessor, observable$, disableGroupSet
|
|
|
16656
16625
|
return (0, rxjs.combineLatest)([observable$, getCurrentExclusiveRangeInterest$(accessor, disableGroupSet)]).pipe((0, rxjs_operators.map)(([observable, exclusiveRangeDisable]) => observable || exclusiveRangeDisable));
|
|
16657
16626
|
}
|
|
16658
16627
|
function getCurrentRangeDisable$(accessor, permissionTypes = {}, supportCellEdit = false) {
|
|
16659
|
-
var _editorBridgeService$;
|
|
16660
16628
|
const workbook$ = accessor.get(_univerjs_core.IUniverInstanceService).getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
16661
16629
|
const userManagerService = accessor.get(_univerjs_core.UserManagerService);
|
|
16662
16630
|
const editorBridgeService = accessor.has(IEditorBridgeService) ? accessor.get(IEditorBridgeService) : null;
|
|
16663
16631
|
const contextService = accessor.get(_univerjs_core.IContextService);
|
|
16664
|
-
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)({
|
|
16665
16633
|
bufferSize: 1,
|
|
16666
16634
|
refCount: true
|
|
16667
16635
|
}));
|
|
@@ -16840,7 +16808,6 @@ function getWorkbookPermissionDisable$(accessor, workbookPermissionTypes) {
|
|
|
16840
16808
|
return (0, rxjs.combineLatest)([accessor.get(_univerjs_core.UserManagerService).currentUser$, workbook$]).pipe((0, rxjs_operators.switchMap)(([_user, workbook]) => {
|
|
16841
16809
|
if (!workbook) return (0, rxjs.of)(true);
|
|
16842
16810
|
return workbook.activeSheet$.pipe((0, rxjs_operators.switchMap)((worksheet) => {
|
|
16843
|
-
var _permissionService$co;
|
|
16844
16811
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
16845
16812
|
const unitId = workbook.getUnitId();
|
|
16846
16813
|
const subUnitId = worksheet.getSheetId();
|
|
@@ -16848,7 +16815,7 @@ function getWorkbookPermissionDisable$(accessor, workbookPermissionTypes) {
|
|
|
16848
16815
|
const worksheetProtectionRuleModel = accessor.get(_univerjs_sheets.WorksheetProtectionRuleModel);
|
|
16849
16816
|
const workbookPermissionIds = [];
|
|
16850
16817
|
workbookPermissionTypes.forEach((F) => workbookPermissionIds.push(new F(unitId).id));
|
|
16851
|
-
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, _]) => {
|
|
16852
16819
|
var _selectionProtectionR;
|
|
16853
16820
|
if (!permission) return true;
|
|
16854
16821
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
@@ -16874,11 +16841,10 @@ function CellBorderSelectorMenuItemFactory(accessor) {
|
|
|
16874
16841
|
const defaultIcon = "AllBorderIcon";
|
|
16875
16842
|
const borderManager = accessor.get(_univerjs_sheets.BorderStyleManagerService);
|
|
16876
16843
|
const disposable = accessor.get(_univerjs_core.ICommandService).onCommandExecuted((c) => {
|
|
16877
|
-
var _item$icon;
|
|
16878
16844
|
if (c.id !== _univerjs_sheets.SetBorderBasicCommand.id) return;
|
|
16879
16845
|
const { type } = borderManager.getBorderInfo();
|
|
16880
16846
|
const item = BORDER_LINE_CHILDREN.find((item) => item.value === type);
|
|
16881
|
-
const icon = (
|
|
16847
|
+
const icon = (item === null || item === void 0 ? void 0 : item.icon) ?? defaultIcon;
|
|
16882
16848
|
subscriber.next(icon);
|
|
16883
16849
|
});
|
|
16884
16850
|
subscriber.next(defaultIcon);
|
|
@@ -17068,8 +17034,8 @@ function updateFontSizeValue(accessor, defaultValue) {
|
|
|
17068
17034
|
const updateSheetEditor = () => {
|
|
17069
17035
|
const textRun = getFontStyleAtCursor(accessor);
|
|
17070
17036
|
if (textRun != null) {
|
|
17071
|
-
var _textRun$ts
|
|
17072
|
-
const fs = (
|
|
17037
|
+
var _textRun$ts;
|
|
17038
|
+
const fs = ((_textRun$ts = textRun.ts) === null || _textRun$ts === void 0 ? void 0 : _textRun$ts.fs) ?? defaultValue;
|
|
17073
17039
|
subscriber.next(fs);
|
|
17074
17040
|
}
|
|
17075
17041
|
};
|
|
@@ -17149,11 +17115,10 @@ const defaultValue = {
|
|
|
17149
17115
|
col: "A"
|
|
17150
17116
|
};
|
|
17151
17117
|
function getFrozenValue(selection) {
|
|
17152
|
-
var _primary$startRow, _primary$startColumn;
|
|
17153
17118
|
if (!selection) return defaultValue;
|
|
17154
17119
|
const { primary, range } = selection;
|
|
17155
|
-
const row = (
|
|
17156
|
-
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;
|
|
17157
17122
|
return {
|
|
17158
17123
|
row: row === 0 ? "1" : String(row),
|
|
17159
17124
|
col: col === 0 ? "A" : _univerjs_core.Tools.chatAtABC(col - 1)
|
|
@@ -17183,11 +17148,10 @@ const getMenuHiddenByCurrentSelectionChangedObservable$$1 = (accessor, type) =>
|
|
|
17183
17148
|
const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
|
|
17184
17149
|
return new rxjs.Observable((subscriber) => {
|
|
17185
17150
|
const update = (selection) => {
|
|
17186
|
-
var _primary$startRow, _primary$startColumn;
|
|
17187
17151
|
if (!selection) return subscriber.next(true);
|
|
17188
17152
|
const { primary, range } = selection;
|
|
17189
|
-
const row = (
|
|
17190
|
-
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;
|
|
17191
17155
|
if (type === "row" && row <= 0) return subscriber.next(true);
|
|
17192
17156
|
if (type === "col" && col <= 0) return subscriber.next(true);
|
|
17193
17157
|
subscriber.next(false);
|
|
@@ -17427,7 +17391,7 @@ const MenuItemInput = (props) => {
|
|
|
17427
17391
|
const { prefix, suffix, value, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, disabled$, onChange } = props;
|
|
17428
17392
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
17429
17393
|
const contextMenuService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IContextMenuService);
|
|
17430
|
-
const disabled = (0, _univerjs_ui.useObservable)(disabled$
|
|
17394
|
+
const disabled = (0, _univerjs_ui.useObservable)(disabled$ ?? null, false);
|
|
17431
17395
|
const [inputValue, setInputValue] = (0, react.useState)();
|
|
17432
17396
|
const handleChange = (value) => {
|
|
17433
17397
|
if (!value) {
|
|
@@ -18098,8 +18062,8 @@ function FontFamilySelectorMenuItemFactory(accessor) {
|
|
|
18098
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))) {
|
|
18099
18063
|
const textRun = getFontStyleAtCursor(accessor);
|
|
18100
18064
|
if (textRun != null) {
|
|
18101
|
-
var _textRun$
|
|
18102
|
-
const ff = (
|
|
18065
|
+
var _textRun$ts5;
|
|
18066
|
+
const ff = ((_textRun$ts5 = textRun.ts) === null || _textRun$ts5 === void 0 ? void 0 : _textRun$ts5.ff) ?? defaultValue;
|
|
18103
18067
|
subscriber.next(ff);
|
|
18104
18068
|
}
|
|
18105
18069
|
}
|
|
@@ -18142,10 +18106,8 @@ function TextColorSelectorMenuItemFactory(accessor) {
|
|
|
18142
18106
|
value$: new rxjs.Observable((subscriber) => {
|
|
18143
18107
|
const defaultValue = _univerjs_core.DEFAULT_STYLES.cl.rgb;
|
|
18144
18108
|
const { isAllValuesSame, value: currentValue } = selectionManagerService.getCellStylesProperty("cl");
|
|
18145
|
-
if (isAllValuesSame)
|
|
18146
|
-
|
|
18147
|
-
subscriber.next((_rgb = currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) !== null && _rgb !== void 0 ? _rgb : defaultValue);
|
|
18148
|
-
} else subscriber.next(defaultValue);
|
|
18109
|
+
if (isAllValuesSame) subscriber.next((currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) ?? defaultValue);
|
|
18110
|
+
else subscriber.next(defaultValue);
|
|
18149
18111
|
})
|
|
18150
18112
|
}],
|
|
18151
18113
|
value$: new rxjs.Observable((subscriber) => {
|
|
@@ -18153,7 +18115,7 @@ function TextColorSelectorMenuItemFactory(accessor) {
|
|
|
18153
18115
|
const disposable = commandService.onCommandExecuted((c) => {
|
|
18154
18116
|
if (c.id === SetRangeTextColorCommand.id) {
|
|
18155
18117
|
const color = c.params.value;
|
|
18156
|
-
subscriber.next(color
|
|
18118
|
+
subscriber.next(color ?? defaultValue);
|
|
18157
18119
|
}
|
|
18158
18120
|
});
|
|
18159
18121
|
subscriber.next(defaultValue);
|
|
@@ -18198,10 +18160,8 @@ function BackgroundColorSelectorMenuItemFactory(accessor) {
|
|
|
18198
18160
|
value$: new rxjs.Observable((subscriber) => {
|
|
18199
18161
|
const defaultValue = themeService.getColorFromTheme("primary.600");
|
|
18200
18162
|
const { isAllValuesSame, value: currentValue } = selectionManagerService.getCellStylesProperty("bg");
|
|
18201
|
-
if (isAllValuesSame)
|
|
18202
|
-
|
|
18203
|
-
subscriber.next((_rgb2 = currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) !== null && _rgb2 !== void 0 ? _rgb2 : defaultValue);
|
|
18204
|
-
} else subscriber.next(defaultValue);
|
|
18163
|
+
if (isAllValuesSame) subscriber.next((currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) ?? defaultValue);
|
|
18164
|
+
else subscriber.next(defaultValue);
|
|
18205
18165
|
})
|
|
18206
18166
|
}],
|
|
18207
18167
|
value$: new rxjs.Observable((subscriber) => {
|
|
@@ -18209,7 +18169,7 @@ function BackgroundColorSelectorMenuItemFactory(accessor) {
|
|
|
18209
18169
|
const disposable = commandService.onCommandExecuted((c) => {
|
|
18210
18170
|
if (c.id === _univerjs_sheets.SetBackgroundColorCommand.id) {
|
|
18211
18171
|
const color = c.params.value;
|
|
18212
|
-
subscriber.next(color
|
|
18172
|
+
subscriber.next(color ?? defaultValue);
|
|
18213
18173
|
}
|
|
18214
18174
|
});
|
|
18215
18175
|
subscriber.next(defaultValue);
|
|
@@ -18241,12 +18201,12 @@ const HORIZONTAL_ALIGN_CHILDREN = [
|
|
|
18241
18201
|
}
|
|
18242
18202
|
];
|
|
18243
18203
|
function HorizontalAlignMenuItemFactory(accessor) {
|
|
18244
|
-
var
|
|
18204
|
+
var _HORIZONTAL_ALIGN_CHI;
|
|
18245
18205
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
18246
18206
|
const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
|
|
18247
18207
|
const workbook = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
18248
18208
|
const defaultStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getDefaultCellStyleInternal();
|
|
18249
|
-
const defaultValue = (
|
|
18209
|
+
const defaultValue = (defaultStyle === null || defaultStyle === void 0 ? void 0 : defaultStyle.ht) ?? _univerjs_core.HorizontalAlign.LEFT;
|
|
18250
18210
|
return {
|
|
18251
18211
|
id: _univerjs_sheets.SetHorizontalTextAlignCommand.id,
|
|
18252
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,
|
|
@@ -18254,30 +18214,28 @@ function HorizontalAlignMenuItemFactory(accessor) {
|
|
|
18254
18214
|
type: _univerjs_ui.MenuItemType.SELECTOR,
|
|
18255
18215
|
selections: HORIZONTAL_ALIGN_CHILDREN,
|
|
18256
18216
|
value$: deriveStateFromActiveSheet$(univerInstanceService, defaultValue, ({ worksheet }) => new rxjs.Observable((subscriber) => {
|
|
18257
|
-
var _selectionManagerServ11
|
|
18217
|
+
var _selectionManagerServ11;
|
|
18258
18218
|
const disposable = accessor.get(_univerjs_core.ICommandService).onCommandExecuted((c) => {
|
|
18259
|
-
var _selectionManagerServ10
|
|
18219
|
+
var _selectionManagerServ10;
|
|
18260
18220
|
const id = c.id;
|
|
18261
18221
|
if (id !== _univerjs_sheets.SetHorizontalTextAlignCommand.id && id !== _univerjs_sheets.SetSelectionsOperation.id && id !== _univerjs_sheets.SetWorksheetActiveOperation.id) return;
|
|
18262
18222
|
const primary = (_selectionManagerServ10 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ10 === void 0 ? void 0 : _selectionManagerServ10.primary;
|
|
18263
18223
|
let ht;
|
|
18264
18224
|
if (primary != null) {
|
|
18265
|
-
var _defaultCellStyle$ht;
|
|
18266
18225
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18267
18226
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18268
|
-
ht = (
|
|
18227
|
+
ht = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.ht) ?? (range === null || range === void 0 ? void 0 : range.getHorizontalAlignment());
|
|
18269
18228
|
}
|
|
18270
|
-
subscriber.next(
|
|
18229
|
+
subscriber.next(ht ?? defaultValue);
|
|
18271
18230
|
});
|
|
18272
18231
|
const primary = (_selectionManagerServ11 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ11 === void 0 ? void 0 : _selectionManagerServ11.primary;
|
|
18273
18232
|
let ht;
|
|
18274
18233
|
if (primary != null) {
|
|
18275
|
-
var _defaultCellStyle$ht2;
|
|
18276
18234
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18277
18235
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18278
|
-
ht = (
|
|
18236
|
+
ht = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.ht) ?? (range === null || range === void 0 ? void 0 : range.getHorizontalAlignment());
|
|
18279
18237
|
}
|
|
18280
|
-
subscriber.next(
|
|
18238
|
+
subscriber.next(ht ?? defaultValue);
|
|
18281
18239
|
return disposable.dispose;
|
|
18282
18240
|
})),
|
|
18283
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)),
|
|
@@ -18306,12 +18264,12 @@ const VERTICAL_ALIGN_CHILDREN = [
|
|
|
18306
18264
|
}
|
|
18307
18265
|
];
|
|
18308
18266
|
function VerticalAlignMenuItemFactory(accessor) {
|
|
18309
|
-
var
|
|
18267
|
+
var _VERTICAL_ALIGN_CHILD;
|
|
18310
18268
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
18311
18269
|
const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
|
|
18312
18270
|
const workbook = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
18313
18271
|
const defaultStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getDefaultCellStyleInternal();
|
|
18314
|
-
const defaultValue = (
|
|
18272
|
+
const defaultValue = (defaultStyle === null || defaultStyle === void 0 ? void 0 : defaultStyle.vt) ?? _univerjs_core.VerticalAlign.BOTTOM;
|
|
18315
18273
|
return {
|
|
18316
18274
|
id: _univerjs_sheets.SetVerticalTextAlignCommand.id,
|
|
18317
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,
|
|
@@ -18319,30 +18277,28 @@ function VerticalAlignMenuItemFactory(accessor) {
|
|
|
18319
18277
|
type: _univerjs_ui.MenuItemType.SELECTOR,
|
|
18320
18278
|
selections: VERTICAL_ALIGN_CHILDREN,
|
|
18321
18279
|
value$: deriveStateFromActiveSheet$(univerInstanceService, defaultValue, ({ worksheet }) => new rxjs.Observable((subscriber) => {
|
|
18322
|
-
var _selectionManagerServ13
|
|
18280
|
+
var _selectionManagerServ13;
|
|
18323
18281
|
const disposable = accessor.get(_univerjs_core.ICommandService).onCommandExecuted((c) => {
|
|
18324
|
-
var _selectionManagerServ12
|
|
18282
|
+
var _selectionManagerServ12;
|
|
18325
18283
|
const id = c.id;
|
|
18326
18284
|
if (id !== _univerjs_sheets.SetVerticalTextAlignCommand.id && id !== _univerjs_sheets.SetSelectionsOperation.id && id !== _univerjs_sheets.SetWorksheetActiveOperation.id) return;
|
|
18327
18285
|
const primary = (_selectionManagerServ12 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ12 === void 0 ? void 0 : _selectionManagerServ12.primary;
|
|
18328
18286
|
let vt;
|
|
18329
18287
|
if (primary != null) {
|
|
18330
|
-
var _defaultCellStyle$vt;
|
|
18331
18288
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18332
18289
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18333
|
-
vt = (
|
|
18290
|
+
vt = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.vt) ?? (range === null || range === void 0 ? void 0 : range.getVerticalAlignment());
|
|
18334
18291
|
}
|
|
18335
|
-
subscriber.next(
|
|
18292
|
+
subscriber.next(vt ?? defaultValue);
|
|
18336
18293
|
});
|
|
18337
18294
|
const primary = (_selectionManagerServ13 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ13 === void 0 ? void 0 : _selectionManagerServ13.primary;
|
|
18338
18295
|
let vt;
|
|
18339
18296
|
if (primary != null) {
|
|
18340
|
-
var _defaultCellStyle$vt2;
|
|
18341
18297
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18342
18298
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18343
|
-
vt = (
|
|
18299
|
+
vt = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.vt) ?? (range === null || range === void 0 ? void 0 : range.getVerticalAlignment());
|
|
18344
18300
|
}
|
|
18345
|
-
subscriber.next(
|
|
18301
|
+
subscriber.next(vt ?? defaultValue);
|
|
18346
18302
|
return disposable.dispose;
|
|
18347
18303
|
})),
|
|
18348
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)),
|
|
@@ -18371,12 +18327,12 @@ const TEXT_WRAP_CHILDREN = [
|
|
|
18371
18327
|
}
|
|
18372
18328
|
];
|
|
18373
18329
|
function WrapTextMenuItemFactory(accessor) {
|
|
18374
|
-
var
|
|
18330
|
+
var _TEXT_WRAP_CHILDREN$f;
|
|
18375
18331
|
const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
|
|
18376
18332
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
18377
18333
|
const workbook = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
18378
18334
|
const defaultStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getDefaultCellStyleInternal();
|
|
18379
|
-
const defaultValue = (
|
|
18335
|
+
const defaultValue = (defaultStyle === null || defaultStyle === void 0 ? void 0 : defaultStyle.tb) ?? _univerjs_core.WrapStrategy.OVERFLOW;
|
|
18380
18336
|
return {
|
|
18381
18337
|
id: _univerjs_sheets.SetTextWrapCommand.id,
|
|
18382
18338
|
tooltip: "sheets-ui.toolbar.textWrapMode.main",
|
|
@@ -18384,30 +18340,28 @@ function WrapTextMenuItemFactory(accessor) {
|
|
|
18384
18340
|
type: _univerjs_ui.MenuItemType.SELECTOR,
|
|
18385
18341
|
selections: TEXT_WRAP_CHILDREN,
|
|
18386
18342
|
value$: deriveStateFromActiveSheet$(univerInstanceService, defaultValue, ({ worksheet }) => new rxjs.Observable((subscriber) => {
|
|
18387
|
-
var _selectionManagerServ15
|
|
18343
|
+
var _selectionManagerServ15;
|
|
18388
18344
|
const disposable = accessor.get(_univerjs_core.ICommandService).onCommandExecuted((c) => {
|
|
18389
|
-
var _selectionManagerServ14
|
|
18345
|
+
var _selectionManagerServ14;
|
|
18390
18346
|
const id = c.id;
|
|
18391
18347
|
if (id !== _univerjs_sheets.SetTextWrapCommand.id && id !== _univerjs_sheets.SetSelectionsOperation.id && id !== _univerjs_sheets.SetWorksheetActiveOperation.id) return;
|
|
18392
18348
|
const primary = (_selectionManagerServ14 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ14 === void 0 ? void 0 : _selectionManagerServ14.primary;
|
|
18393
18349
|
let tb;
|
|
18394
18350
|
if (primary != null) {
|
|
18395
|
-
var _defaultCellStyle$tb;
|
|
18396
18351
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18397
18352
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18398
|
-
tb = (
|
|
18353
|
+
tb = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.tb) ?? (range === null || range === void 0 ? void 0 : range.getWrapStrategy());
|
|
18399
18354
|
}
|
|
18400
|
-
subscriber.next(
|
|
18355
|
+
subscriber.next(tb ?? defaultValue);
|
|
18401
18356
|
});
|
|
18402
18357
|
const primary = (_selectionManagerServ15 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ15 === void 0 ? void 0 : _selectionManagerServ15.primary;
|
|
18403
18358
|
let tb;
|
|
18404
18359
|
if (primary != null) {
|
|
18405
|
-
var _defaultCellStyle$tb2;
|
|
18406
18360
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18407
18361
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18408
|
-
tb = (
|
|
18362
|
+
tb = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.tb) ?? (range === null || range === void 0 ? void 0 : range.getWrapStrategy());
|
|
18409
18363
|
}
|
|
18410
|
-
subscriber.next(
|
|
18364
|
+
subscriber.next(tb ?? defaultValue);
|
|
18411
18365
|
return disposable.dispose;
|
|
18412
18366
|
})),
|
|
18413
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)),
|
|
@@ -18507,10 +18461,7 @@ function TextRotateMenuItemFactory(accessor) {
|
|
|
18507
18461
|
tr = range === null || range === void 0 ? void 0 : range.getTextRotation();
|
|
18508
18462
|
}
|
|
18509
18463
|
if ((tr === null || tr === void 0 ? void 0 : tr.v) === _univerjs_core.BooleanNumber.TRUE) subscriber.next("v");
|
|
18510
|
-
else
|
|
18511
|
-
var _ref;
|
|
18512
|
-
subscriber.next((_ref = tr && tr.a) !== null && _ref !== void 0 ? _ref : defaultValue);
|
|
18513
|
-
}
|
|
18464
|
+
else subscriber.next((tr && tr.a) ?? defaultValue);
|
|
18514
18465
|
});
|
|
18515
18466
|
const primary = (_selectionManagerServ18 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ18 === void 0 ? void 0 : _selectionManagerServ18.primary;
|
|
18516
18467
|
let tr;
|
|
@@ -18519,10 +18470,7 @@ function TextRotateMenuItemFactory(accessor) {
|
|
|
18519
18470
|
tr = range === null || range === void 0 ? void 0 : range.getTextRotation();
|
|
18520
18471
|
}
|
|
18521
18472
|
if ((tr === null || tr === void 0 ? void 0 : tr.v) === _univerjs_core.BooleanNumber.TRUE) subscriber.next("v");
|
|
18522
|
-
else
|
|
18523
|
-
var _ref2;
|
|
18524
|
-
subscriber.next((_ref2 = tr && tr.a) !== null && _ref2 !== void 0 ? _ref2 : defaultValue);
|
|
18525
|
-
}
|
|
18473
|
+
else subscriber.next((tr && tr.a) ?? defaultValue);
|
|
18526
18474
|
return disposable.dispose;
|
|
18527
18475
|
})),
|
|
18528
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)),
|
|
@@ -19014,14 +18962,13 @@ function getPermissionDisableBase$(accessor) {
|
|
|
19014
18962
|
return (0, rxjs.combineLatest)([univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), accessor.get(_univerjs_core.UserManagerService).currentUser$]).pipe((0, rxjs.switchMap)(([workbook, _]) => {
|
|
19015
18963
|
if (!workbook) return (0, rxjs.of)(true);
|
|
19016
18964
|
return workbook.activeSheet$.pipe((0, rxjs.switchMap)((worksheet) => {
|
|
19017
|
-
var _permissionService$co;
|
|
19018
18965
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
19019
18966
|
const unitId = workbook.getUnitId();
|
|
19020
18967
|
const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
|
|
19021
18968
|
const selectionProtectionRuleModel = accessor.get(_univerjs_sheets.RangeProtectionRuleModel);
|
|
19022
18969
|
const worksheetProtectionRuleModel = accessor.get(_univerjs_sheets.WorksheetProtectionRuleModel);
|
|
19023
18970
|
return (0, rxjs.combineLatest)([
|
|
19024
|
-
|
|
18971
|
+
permissionService.composePermission$([new _univerjs_sheets.WorkbookEditablePermission(unitId).id]).pipe((0, rxjs.map)((permissions) => permissions.every((permission) => permission.value))) ?? (0, rxjs.of)(false),
|
|
19025
18972
|
(0, rxjs.merge)(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe((0, rxjs.startWith)(null)),
|
|
19026
18973
|
selectionManagerService.selectionMoveEnd$
|
|
19027
18974
|
]).pipe((0, rxjs.map)(([permission, _, __]) => {
|
|
@@ -19036,7 +18983,6 @@ function getPermissionDisableBase$(accessor) {
|
|
|
19036
18983
|
}));
|
|
19037
18984
|
}
|
|
19038
18985
|
function getAddPermissionDisableBase$(accessor) {
|
|
19039
|
-
var _editorBridgeService$;
|
|
19040
18986
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
19041
18987
|
const permissionService = accessor.get(_univerjs_core.IPermissionService);
|
|
19042
18988
|
const workbook$ = univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
@@ -19046,10 +18992,10 @@ function getAddPermissionDisableBase$(accessor) {
|
|
|
19046
18992
|
bufferSize: 1,
|
|
19047
18993
|
refCount: true
|
|
19048
18994
|
}));
|
|
19049
|
-
const editorVisible$ = (
|
|
18995
|
+
const editorVisible$ = (editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.visible$.pipe((0, rxjs.startWith)(null), (0, rxjs.shareReplay)({
|
|
19050
18996
|
bufferSize: 1,
|
|
19051
18997
|
refCount: true
|
|
19052
|
-
})))
|
|
18998
|
+
}))) ?? (0, rxjs.of)(null);
|
|
19053
18999
|
return (0, rxjs.combineLatest)([
|
|
19054
19000
|
workbook$,
|
|
19055
19001
|
userManagerService.currentUser$,
|
|
@@ -19058,7 +19004,6 @@ function getAddPermissionDisableBase$(accessor) {
|
|
|
19058
19004
|
]).pipe((0, rxjs.switchMap)(([workbook, _, visible, formulaEditorFocus]) => {
|
|
19059
19005
|
if (!workbook || (visible === null || visible === void 0 ? void 0 : visible.visible) && visible.unitId === workbook.getUnitId() || formulaEditorFocus) return (0, rxjs.of)(true);
|
|
19060
19006
|
return workbook.activeSheet$.pipe((0, rxjs.switchMap)((worksheet) => {
|
|
19061
|
-
var _permissionService$co2;
|
|
19062
19007
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
19063
19008
|
const focusingDrawing$ = accessor.get(_univerjs_core.IContextService).subscribeContextValue$(_univerjs_core.FOCUSING_COMMON_DRAWINGS).pipe((0, rxjs.startWith)(false));
|
|
19064
19009
|
const unitId = workbook.getUnitId();
|
|
@@ -19067,7 +19012,7 @@ function getAddPermissionDisableBase$(accessor) {
|
|
|
19067
19012
|
const worksheetProtectionRuleModel = accessor.get(_univerjs_sheets.WorksheetProtectionRuleModel);
|
|
19068
19013
|
const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
|
|
19069
19014
|
return (0, rxjs.combineLatest)([
|
|
19070
|
-
|
|
19015
|
+
permissionService.composePermission$([new _univerjs_sheets.WorkbookCreateProtectPermission(unitId).id]).pipe((0, rxjs.map)((permissions) => permissions.every((permission) => permission.value))) ?? (0, rxjs.of)(false),
|
|
19071
19016
|
(0, rxjs.merge)(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe((0, rxjs.startWith)(null)),
|
|
19072
19017
|
selectionManagerService.selectionMoveEnd$,
|
|
19073
19018
|
focusingDrawing$
|
|
@@ -19096,13 +19041,12 @@ function getAddPermissionFromSheetBarDisable$(accessor) {
|
|
|
19096
19041
|
return (0, rxjs.combineLatest)([univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), accessor.get(_univerjs_core.UserManagerService).currentUser$]).pipe((0, rxjs.switchMap)(([workbook, _]) => {
|
|
19097
19042
|
if (!workbook) return (0, rxjs.of)(true);
|
|
19098
19043
|
return workbook.activeSheet$.pipe((0, rxjs.switchMap)((worksheet) => {
|
|
19099
|
-
var _permissionService$co3;
|
|
19100
19044
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
19101
19045
|
const unitId = workbook.getUnitId();
|
|
19102
19046
|
const subUnitId = worksheet.getSheetId();
|
|
19103
19047
|
const selectionProtectionRuleModel = accessor.get(_univerjs_sheets.RangeProtectionRuleModel);
|
|
19104
19048
|
const worksheetProtectionRuleModel = accessor.get(_univerjs_sheets.WorksheetProtectionRuleModel);
|
|
19105
|
-
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, _]) => {
|
|
19106
19050
|
var _selectionProtectionR;
|
|
19107
19051
|
if (!permission) return true;
|
|
19108
19052
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
@@ -19118,12 +19062,12 @@ function getRemovePermissionFromSheetBarDisable$(accessor) {
|
|
|
19118
19062
|
return (0, rxjs.combineLatest)([univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), accessor.get(_univerjs_core.UserManagerService).currentUser$]).pipe((0, rxjs.switchMap)(([workbook, _]) => {
|
|
19119
19063
|
if (!workbook) return (0, rxjs.of)(true);
|
|
19120
19064
|
return workbook.activeSheet$.pipe((0, rxjs.switchMap)((worksheet) => {
|
|
19121
|
-
var _permissionService$ge2
|
|
19065
|
+
var _permissionService$ge2;
|
|
19122
19066
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
19123
19067
|
const unitId = workbook.getUnitId();
|
|
19124
19068
|
const subUnitId = worksheet.getSheetId();
|
|
19125
19069
|
const worksheetProtectionRuleModel = accessor.get(_univerjs_sheets.WorksheetProtectionRuleModel);
|
|
19126
|
-
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, _]) => {
|
|
19127
19071
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
19128
19072
|
if (worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) return !permission;
|
|
19129
19073
|
return true;
|
|
@@ -19137,13 +19081,12 @@ function getSetPermissionFromSheetBarDisable$(accessor) {
|
|
|
19137
19081
|
return (0, rxjs.combineLatest)([univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), accessor.get(_univerjs_core.UserManagerService).currentUser$]).pipe((0, rxjs.switchMap)(([workbook, _]) => {
|
|
19138
19082
|
if (!workbook) return (0, rxjs.of)(true);
|
|
19139
19083
|
return workbook.activeSheet$.pipe((0, rxjs.switchMap)((worksheet) => {
|
|
19140
|
-
var _permissionService$co4;
|
|
19141
19084
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
19142
19085
|
const unitId = workbook.getUnitId();
|
|
19143
19086
|
const subUnitId = worksheet.getSheetId();
|
|
19144
19087
|
const selectionProtectionRuleModel = accessor.get(_univerjs_sheets.RangeProtectionRuleModel);
|
|
19145
19088
|
const worksheetProtectionRuleModel = accessor.get(_univerjs_sheets.WorksheetProtectionRuleModel);
|
|
19146
|
-
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, _]) => {
|
|
19147
19090
|
var _selectionProtectionR2;
|
|
19148
19091
|
if (!permission) return true;
|
|
19149
19092
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
@@ -19173,8 +19116,8 @@ function getRemovePermissionDisable$(accessor) {
|
|
|
19173
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;
|
|
19174
19117
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
19175
19118
|
if (worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) {
|
|
19176
|
-
var _permissionService$
|
|
19177
|
-
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;
|
|
19178
19121
|
}
|
|
19179
19122
|
if (selectionProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).filter((rule) => {
|
|
19180
19123
|
return rule.ranges.some((range) => {
|
|
@@ -19193,14 +19136,13 @@ function getRemovePermissionDisable$(accessor) {
|
|
|
19193
19136
|
}));
|
|
19194
19137
|
}
|
|
19195
19138
|
function getViewPermissionDisable$(accessor) {
|
|
19196
|
-
var _editorBridgeService$2;
|
|
19197
19139
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
19198
19140
|
const permissionService = accessor.get(_univerjs_core.IPermissionService);
|
|
19199
19141
|
const workbook$ = univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
19200
19142
|
const userManagerService = accessor.get(_univerjs_core.UserManagerService);
|
|
19201
19143
|
const editorBridgeService = accessor.has(IEditorBridgeService) ? accessor.get(IEditorBridgeService) : null;
|
|
19202
19144
|
const formulaEditorFocus$ = accessor.get(_univerjs_core.IContextService).subscribeContextValue$(_univerjs_core.FOCUSING_FX_BAR_EDITOR);
|
|
19203
|
-
const editorVisible$ = (
|
|
19145
|
+
const editorVisible$ = (editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.visible$) ?? (0, rxjs.of)(null);
|
|
19204
19146
|
return (0, rxjs.combineLatest)([
|
|
19205
19147
|
workbook$,
|
|
19206
19148
|
userManagerService.currentUser$,
|
|
@@ -19209,10 +19151,10 @@ function getViewPermissionDisable$(accessor) {
|
|
|
19209
19151
|
]).pipe((0, rxjs.switchMap)(([workbook, _, visible, formulaEditorFocus]) => {
|
|
19210
19152
|
if (!workbook || (visible === null || visible === void 0 ? void 0 : visible.visible) && visible.unitId === workbook.getUnitId() || formulaEditorFocus) return (0, rxjs.of)(true);
|
|
19211
19153
|
return workbook.activeSheet$.pipe((0, rxjs.switchMap)((worksheet) => {
|
|
19212
|
-
var _permissionService$
|
|
19154
|
+
var _permissionService$ge4;
|
|
19213
19155
|
if (!worksheet) return (0, rxjs.of)(true);
|
|
19214
19156
|
const unitId = workbook.getUnitId();
|
|
19215
|
-
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));
|
|
19216
19158
|
}));
|
|
19217
19159
|
}));
|
|
19218
19160
|
}
|
|
@@ -20388,8 +20330,7 @@ function focusSheetCellEditorElement(ownerDocument = document) {
|
|
|
20388
20330
|
return ownerDocument.activeElement === element;
|
|
20389
20331
|
}
|
|
20390
20332
|
function registerSheetCellEditorRuntimePortal(options) {
|
|
20391
|
-
|
|
20392
|
-
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);
|
|
20393
20334
|
if (!ownerDocument) return (0, _univerjs_core.toDisposable)(() => {});
|
|
20394
20335
|
const collection = new _univerjs_core.DisposableCollection();
|
|
20395
20336
|
const view = ownerDocument.defaultView;
|
|
@@ -20459,8 +20400,7 @@ function registerSheetCellEditorRuntimePortal(options) {
|
|
|
20459
20400
|
return collection;
|
|
20460
20401
|
}
|
|
20461
20402
|
function resolveSheetCellEditorPortalRoot(ownerDocument = document) {
|
|
20462
|
-
|
|
20463
|
-
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);
|
|
20464
20404
|
}
|
|
20465
20405
|
|
|
20466
20406
|
//#endregion
|
|
@@ -20549,27 +20489,27 @@ function isEmbedRuntimeInteractiveElement(element) {
|
|
|
20549
20489
|
return role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20550
20490
|
}
|
|
20551
20491
|
function shouldPreserveEmbedPopupFocus(embedId, ownerDocument) {
|
|
20552
|
-
var _activeElement$
|
|
20492
|
+
var _activeElement$closes;
|
|
20553
20493
|
if (!embedId) return false;
|
|
20554
20494
|
const activeElement = ownerDocument.activeElement;
|
|
20555
20495
|
if (!(activeElement instanceof HTMLElement)) return false;
|
|
20556
20496
|
if (!activeElement.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`)) return false;
|
|
20557
|
-
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"));
|
|
20558
20498
|
return role === "child-popup" || role === "floating-menu";
|
|
20559
20499
|
}
|
|
20560
20500
|
function shouldPreserveEmbedInteractiveFocus(embedId, ownerDocument) {
|
|
20561
|
-
var _activeElement$
|
|
20501
|
+
var _activeElement$closes2;
|
|
20562
20502
|
if (!embedId) return false;
|
|
20563
20503
|
const activeElement = ownerDocument.activeElement;
|
|
20564
20504
|
if (!(activeElement instanceof HTMLElement)) return false;
|
|
20565
20505
|
if (!activeElement.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`)) return false;
|
|
20566
|
-
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"));
|
|
20567
20507
|
return role == null && activeElement.tagName !== "CANVAS" || role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20568
20508
|
}
|
|
20569
20509
|
function isEmbedRuntimeEditorOrPopup(target) {
|
|
20570
|
-
var _target$
|
|
20510
|
+
var _target$closest;
|
|
20571
20511
|
if (!(target instanceof HTMLElement)) return false;
|
|
20572
|
-
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"));
|
|
20573
20513
|
return role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20574
20514
|
}
|
|
20575
20515
|
/**
|
|
@@ -20587,6 +20527,7 @@ function EditorContainer() {
|
|
|
20587
20527
|
const componentManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.ComponentManager);
|
|
20588
20528
|
const editorBridgeService = (0, _univerjs_ui.useDependency)(IEditorBridgeService);
|
|
20589
20529
|
const cellEditorResizeService = (0, _univerjs_ui.useDependency)(SheetCellEditorResizeService);
|
|
20530
|
+
const renderManagerService = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService);
|
|
20590
20531
|
const rootRef = (0, react.useRef)(null);
|
|
20591
20532
|
const pointerRefocusTimerRef = (0, react.useRef)(void 0);
|
|
20592
20533
|
const visible = (0, _univerjs_ui.useObservable)(editorBridgeService.visible$);
|
|
@@ -20595,6 +20536,9 @@ function EditorContainer() {
|
|
|
20595
20536
|
const FormulaEditor = componentManager.get(EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY);
|
|
20596
20537
|
const editState = (0, _univerjs_ui.useObservable)(editorBridgeService.currentEditCellState$);
|
|
20597
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;
|
|
20598
20542
|
const focusCoordinator = injector.has(ISheetEmbedRuntimeFocusCoordinator) ? injector.get(ISheetEmbedRuntimeFocusCoordinator) : void 0;
|
|
20599
20543
|
const resolveRuntimeFocusState = () => {
|
|
20600
20544
|
var _instanceService$getF;
|
|
@@ -20611,6 +20555,24 @@ function EditorContainer() {
|
|
|
20611
20555
|
instanceService,
|
|
20612
20556
|
visible === null || visible === void 0 ? void 0 : visible.unitId
|
|
20613
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
|
+
]);
|
|
20614
20576
|
(0, react.useEffect)(() => {
|
|
20615
20577
|
const subscription = cellEditorManagerService.state$.subscribe((param) => {
|
|
20616
20578
|
if (param == null) return;
|
|
@@ -20647,18 +20609,17 @@ function EditorContainer() {
|
|
|
20647
20609
|
if (!disableAutoFocus) cellEditorManagerService.setFocus(true);
|
|
20648
20610
|
}, [disableAutoFocus, state]);
|
|
20649
20611
|
(0, react.useEffect)(() => {
|
|
20650
|
-
var _rootRef$current
|
|
20612
|
+
var _rootRef$current;
|
|
20651
20613
|
if (!(visible === null || visible === void 0 ? void 0 : visible.visible)) return;
|
|
20652
20614
|
cellEditorResizeService.fitTextSize();
|
|
20653
20615
|
if (contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR)) return;
|
|
20654
|
-
const ownerDocument = (
|
|
20655
|
-
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;
|
|
20656
20618
|
let focusRetryFrame = 0;
|
|
20657
20619
|
let finalFocusRetryFrame = 0;
|
|
20658
20620
|
let delayedFocusTimer;
|
|
20659
20621
|
const focusCellEditorElement = () => {
|
|
20660
|
-
|
|
20661
|
-
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);
|
|
20662
20623
|
if (shouldPreserveEmbedInteractiveFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
20663
20624
|
focusSheetCellEditorElement(ownerDocument);
|
|
20664
20625
|
if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
|
|
@@ -20669,9 +20630,8 @@ function EditorContainer() {
|
|
|
20669
20630
|
}, 0);
|
|
20670
20631
|
};
|
|
20671
20632
|
const focusEditor = () => {
|
|
20672
|
-
var _resolveSheetEmbedRun2;
|
|
20673
20633
|
if (contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR)) return;
|
|
20674
|
-
const scope = rootRef.current ?
|
|
20634
|
+
const scope = rootRef.current ? resolveSheetEmbedRuntimeDomScope(rootRef.current) ?? resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
20675
20635
|
if (shouldPreserveEmbedPopupFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
20676
20636
|
const editor = editorService.getEditor(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
20677
20637
|
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
@@ -20694,7 +20654,6 @@ function EditorContainer() {
|
|
|
20694
20654
|
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20695
20655
|
]);
|
|
20696
20656
|
(0, react.useEffect)(() => {
|
|
20697
|
-
var _ref;
|
|
20698
20657
|
if (!(visible === null || visible === void 0 ? void 0 : visible.visible) || !rootRef.current || !focusCoordinator) return;
|
|
20699
20658
|
const rootRuntimeScope = resolveSheetEmbedRuntimeDomScope(rootRef.current);
|
|
20700
20659
|
const unitRuntimeScope = [
|
|
@@ -20704,9 +20663,9 @@ function EditorContainer() {
|
|
|
20704
20663
|
].find((resolvedScope) => resolvedScope != null);
|
|
20705
20664
|
if (rootRuntimeScope && unitRuntimeScope && rootRuntimeScope.embedId !== unitRuntimeScope.embedId) return;
|
|
20706
20665
|
const activeSessionScope = runtimeFocusState.activeSessionScope;
|
|
20707
|
-
const explicitRuntimeScope = unitRuntimeScope
|
|
20666
|
+
const explicitRuntimeScope = unitRuntimeScope ?? rootRuntimeScope;
|
|
20708
20667
|
if (activeSessionScope && rootRuntimeScope && !unitRuntimeScope && rootRuntimeScope.embedId !== activeSessionScope.embedId) return;
|
|
20709
|
-
const scope =
|
|
20668
|
+
const scope = explicitRuntimeScope ?? activeSessionScope ?? resolveActiveSheetEmbedRuntimeDomScope(rootRef.current.ownerDocument);
|
|
20710
20669
|
if (!scope) return;
|
|
20711
20670
|
const collection = new _univerjs_core.DisposableCollection();
|
|
20712
20671
|
const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
|
|
@@ -20766,12 +20725,12 @@ function EditorContainer() {
|
|
|
20766
20725
|
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20767
20726
|
]);
|
|
20768
20727
|
(0, react.useEffect)(() => {
|
|
20769
|
-
var _rootRef$
|
|
20728
|
+
var _rootRef$current2;
|
|
20770
20729
|
if ((visible === null || visible === void 0 ? void 0 : visible.visible) || !focusCoordinator) return;
|
|
20771
20730
|
const activeSessionScope = runtimeFocusState.activeSessionScope;
|
|
20772
20731
|
const childUnitId = activeSessionScope === null || activeSessionScope === void 0 ? void 0 : activeSessionScope.childUnitId;
|
|
20773
20732
|
if (!activeSessionScope || activeSessionScope.childType !== _univerjs_core.UniverInstanceType.UNIVER_SHEET || !childUnitId || !instanceService.getUnit(childUnitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) return;
|
|
20774
|
-
const ownerDocument = (
|
|
20733
|
+
const ownerDocument = ((_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.ownerDocument) ?? document;
|
|
20775
20734
|
const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
|
|
20776
20735
|
const portalRegistration = registerSheetCellEditorRuntimePortal({
|
|
20777
20736
|
embedId: activeSessionScope.embedId,
|
|
@@ -20779,7 +20738,7 @@ function EditorContainer() {
|
|
|
20779
20738
|
interactionBoundaryService,
|
|
20780
20739
|
focusCoordinator
|
|
20781
20740
|
});
|
|
20782
|
-
const ownerWindow =
|
|
20741
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
20783
20742
|
let delayedFocusTimer;
|
|
20784
20743
|
const focusCellEditorElement = () => {
|
|
20785
20744
|
if (shouldPreserveEmbedInteractiveFocus(activeSessionScope.embedId, ownerDocument)) return;
|
|
@@ -20840,10 +20799,10 @@ function EditorContainer() {
|
|
|
20840
20799
|
};
|
|
20841
20800
|
}, []);
|
|
20842
20801
|
const refocusEditorAfterPointerDown = (0, _univerjs_ui.useEvent)((event) => {
|
|
20843
|
-
var _rootRef$
|
|
20802
|
+
var _rootRef$current4;
|
|
20844
20803
|
if (!(visible === null || visible === void 0 ? void 0 : visible.visible)) return;
|
|
20845
|
-
const ownerDocument = (
|
|
20846
|
-
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;
|
|
20847
20806
|
const editor = editorService.getEditor(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
20848
20807
|
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
20849
20808
|
const pointerTarget = event.target;
|
|
@@ -20878,7 +20837,7 @@ function EditorContainer() {
|
|
|
20878
20837
|
unitId: editState === null || editState === void 0 ? void 0 : editState.unitId
|
|
20879
20838
|
});
|
|
20880
20839
|
});
|
|
20881
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.
|
|
20840
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
20882
20841
|
ref: rootRef,
|
|
20883
20842
|
"data-u-comp": "editor",
|
|
20884
20843
|
className: "univer-absolute univer-z-10 univer-flex",
|
|
@@ -20893,7 +20852,16 @@ function EditorContainer() {
|
|
|
20893
20852
|
getColorFromTheme: themeService.getColorFromTheme.bind(themeService)
|
|
20894
20853
|
})
|
|
20895
20854
|
},
|
|
20896
|
-
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, {
|
|
20897
20865
|
editorId: _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
20898
20866
|
className: "univer-relative univer-flex univer-size-full [&_canvas]:univer-absolute",
|
|
20899
20867
|
initValue: "",
|
|
@@ -20913,7 +20881,7 @@ function EditorContainer() {
|
|
|
20913
20881
|
},
|
|
20914
20882
|
disableContextMenu: false,
|
|
20915
20883
|
canvasStyle: { backgroundColor: "transparent" }
|
|
20916
|
-
})
|
|
20884
|
+
})]
|
|
20917
20885
|
});
|
|
20918
20886
|
}
|
|
20919
20887
|
|
|
@@ -21257,7 +21225,7 @@ function DefinedName({ disable }) {
|
|
|
21257
21225
|
//#endregion
|
|
21258
21226
|
//#region src/views/formula-bar/FormulaBar.tsx
|
|
21259
21227
|
function FormulaBar(props) {
|
|
21260
|
-
var
|
|
21228
|
+
var _editState$documentLa;
|
|
21261
21229
|
const { className, disableDefinedName } = props;
|
|
21262
21230
|
const editorBridgeService = (0, _univerjs_ui.useDependency)(IEditorBridgeService);
|
|
21263
21231
|
const iconActivated = (0, _univerjs_ui.useObservable)(() => editorBridgeService.visible$.pipe((0, rxjs.map)((visibleInfo) => visibleInfo.visible)), false, false, [editorBridgeService]);
|
|
@@ -21308,21 +21276,20 @@ function FormulaBar(props) {
|
|
|
21308
21276
|
}));
|
|
21309
21277
|
}), (0, rxjs.map)((cellInfo) => {
|
|
21310
21278
|
if (cellInfo) {
|
|
21311
|
-
var _cellInfoWithPermissi, _cellInfoWithPermissi2;
|
|
21312
21279
|
const { unitId, subUnitId, primary } = cellInfo;
|
|
21313
21280
|
if (worksheetProtectionRuleModel.getRule(unitId, subUnitId)) {
|
|
21314
|
-
var _permissionService$ge, _permissionService$ge2
|
|
21315
|
-
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);
|
|
21316
21283
|
return {
|
|
21317
|
-
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),
|
|
21318
21285
|
editDisable
|
|
21319
21286
|
};
|
|
21320
21287
|
}
|
|
21321
21288
|
const { actualRow, actualColumn } = primary;
|
|
21322
21289
|
const cellInfoWithPermission = rangeProtectionCache.getCellInfo(unitId, subUnitId, actualRow, actualColumn);
|
|
21323
21290
|
return {
|
|
21324
|
-
editDisable: !((
|
|
21325
|
-
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)
|
|
21326
21293
|
};
|
|
21327
21294
|
}
|
|
21328
21295
|
return {
|
|
@@ -21380,7 +21347,7 @@ function FormulaBar(props) {
|
|
|
21380
21347
|
}
|
|
21381
21348
|
const { viewDisable, editDisable: permissionEditDisable } = disableInfo;
|
|
21382
21349
|
const editDisable = permissionEditDisable || !!disableEdit;
|
|
21383
|
-
const workbookEditDisable = !((
|
|
21350
|
+
const workbookEditDisable = !((workbookEditablePermission === null || workbookEditablePermission === void 0 ? void 0 : workbookEditablePermission.value) ?? true);
|
|
21384
21351
|
const editorActivationDisable = editDisable || workbookEditDisable;
|
|
21385
21352
|
const disabled = editDisable || imageDisable;
|
|
21386
21353
|
const shouldSkipFocus = (0, react.useRef)(false);
|
|
@@ -21413,7 +21380,7 @@ function FormulaBar(props) {
|
|
|
21413
21380
|
}, 30);
|
|
21414
21381
|
shouldSkipFocus.current = false;
|
|
21415
21382
|
};
|
|
21416
|
-
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;
|
|
21417
21384
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21418
21385
|
"data-u-comp": "formula-bar",
|
|
21419
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, {
|
|
@@ -21424,7 +21391,7 @@ function FormulaBar(props) {
|
|
|
21424
21391
|
children: [
|
|
21425
21392
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21426
21393
|
className: "univer-relative univer-box-border univer-h-full univer-w-[100px]",
|
|
21427
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefinedName, { disable: disableDefinedName
|
|
21394
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefinedName, { disable: disableDefinedName ?? editDisable })
|
|
21428
21395
|
}),
|
|
21429
21396
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21430
21397
|
className: "univer-flex univer-size-full",
|
|
@@ -21630,7 +21597,7 @@ function SheetBarItem(props) {
|
|
|
21630
21597
|
"data-id": sheetId,
|
|
21631
21598
|
role: "tab",
|
|
21632
21599
|
"aria-selected": currentSelected,
|
|
21633
|
-
tabIndex: tabIndex
|
|
21600
|
+
tabIndex: tabIndex ?? (currentSelected ? 0 : -1),
|
|
21634
21601
|
onKeyDown,
|
|
21635
21602
|
onClick,
|
|
21636
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", {
|
|
@@ -21668,9 +21635,8 @@ function SheetBarTabsContextMenu(props) {
|
|
|
21668
21635
|
menuOffset: MENU_OFFSET,
|
|
21669
21636
|
onRequestClose: () => onVisibleChange(false),
|
|
21670
21637
|
onOptionSelect: (option) => {
|
|
21671
|
-
var _ref;
|
|
21672
21638
|
const { label, id, commandId, value } = option;
|
|
21673
|
-
onCommandSelect(
|
|
21639
|
+
onCommandSelect(commandId ?? id ?? label, value);
|
|
21674
21640
|
}
|
|
21675
21641
|
})] });
|
|
21676
21642
|
}
|
|
@@ -21834,8 +21800,7 @@ var Animate = class {
|
|
|
21834
21800
|
//#region src/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-name-editor.ts
|
|
21835
21801
|
const MAX_SHEET_NAME_LENGTH = 31;
|
|
21836
21802
|
function getEditorText(input) {
|
|
21837
|
-
|
|
21838
|
-
return (_input$textContent = input.textContent) !== null && _input$textContent !== void 0 ? _input$textContent : "";
|
|
21803
|
+
return input.textContent ?? "";
|
|
21839
21804
|
}
|
|
21840
21805
|
function keepLastTextIndex(inputHtml) {
|
|
21841
21806
|
setTimeout(() => {
|
|
@@ -22018,10 +21983,9 @@ var SlideTabItem = class SlideTabItem {
|
|
|
22018
21983
|
});
|
|
22019
21984
|
}
|
|
22020
21985
|
nameCheck() {
|
|
22021
|
-
var _input$textContent;
|
|
22022
21986
|
const input = this._slideTabItem.querySelector("span");
|
|
22023
21987
|
if (!input) return false;
|
|
22024
|
-
const text =
|
|
21988
|
+
const text = input.textContent ?? "";
|
|
22025
21989
|
return this._slideTabBar.getConfig().onNameCheckAlert(text, this.getId());
|
|
22026
21990
|
}
|
|
22027
21991
|
animate() {
|
|
@@ -22141,23 +22105,21 @@ var SlideTabItem = class SlideTabItem {
|
|
|
22141
22105
|
var SlideScrollbar = class {
|
|
22142
22106
|
constructor(slideTabBar) {
|
|
22143
22107
|
_defineProperty(this, "_slideTabBar", void 0);
|
|
22144
|
-
_defineProperty(this, "_scrollX", void 0);
|
|
22145
|
-
const primeval = slideTabBar.primeval();
|
|
22146
|
-
this._scrollX = primeval.scrollLeft;
|
|
22147
22108
|
this._slideTabBar = slideTabBar;
|
|
22148
22109
|
}
|
|
22149
22110
|
scrollX(x) {
|
|
22111
|
+
var _primeval$parentEleme;
|
|
22150
22112
|
const primeval = this._slideTabBar.primeval();
|
|
22151
|
-
primeval.
|
|
22152
|
-
|
|
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));
|
|
22153
22116
|
}
|
|
22154
22117
|
scrollRight() {
|
|
22155
22118
|
const primeval = this._slideTabBar.primeval();
|
|
22156
|
-
|
|
22157
|
-
this._scrollX = primeval.scrollLeft;
|
|
22119
|
+
this.scrollX(primeval.scrollWidth);
|
|
22158
22120
|
}
|
|
22159
22121
|
getScrollX() {
|
|
22160
|
-
return this.
|
|
22122
|
+
return this._slideTabBar.primeval().scrollLeft;
|
|
22161
22123
|
}
|
|
22162
22124
|
};
|
|
22163
22125
|
var SlideTabBar = class SlideTabBar {
|
|
@@ -22296,7 +22258,14 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22296
22258
|
}
|
|
22297
22259
|
};
|
|
22298
22260
|
this._wheelAction = (wheelEvent) => {
|
|
22299
|
-
|
|
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);
|
|
22300
22269
|
};
|
|
22301
22270
|
this.addListener();
|
|
22302
22271
|
}
|
|
@@ -22351,15 +22320,15 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22351
22320
|
return this._activeTabItem;
|
|
22352
22321
|
}
|
|
22353
22322
|
isLeftEnd() {
|
|
22354
|
-
return this._slideTabBar.scrollLeft
|
|
22323
|
+
return this._slideTabBar.scrollLeft <= 1;
|
|
22355
22324
|
}
|
|
22356
22325
|
isRightEnd() {
|
|
22357
22326
|
const parent = this._slideTabBar.parentElement;
|
|
22358
22327
|
if (!parent) return false;
|
|
22359
|
-
return this._slideTabBar.scrollWidth - parent.clientWidth
|
|
22328
|
+
return Math.max(0, this._slideTabBar.scrollWidth - parent.clientWidth) - this._slideTabBar.scrollLeft <= 1;
|
|
22360
22329
|
}
|
|
22361
22330
|
addListener() {
|
|
22362
|
-
this._slideTabBar.addEventListener("wheel", this._wheelAction);
|
|
22331
|
+
this._slideTabBar.addEventListener("wheel", this._wheelAction, { passive: false });
|
|
22363
22332
|
this._slideTabItems.forEach((item) => {
|
|
22364
22333
|
item.addEventListener("pointerdown", this._downAction);
|
|
22365
22334
|
});
|
|
@@ -22372,13 +22341,6 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22372
22341
|
}
|
|
22373
22342
|
setScroll(x) {
|
|
22374
22343
|
this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + x);
|
|
22375
|
-
if (x > 0) {
|
|
22376
|
-
const left = this.calculateLeftScrollX();
|
|
22377
|
-
this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + left);
|
|
22378
|
-
} else if (x < 0) {
|
|
22379
|
-
const right = this.calculateRightScrollX();
|
|
22380
|
-
this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + right);
|
|
22381
|
-
}
|
|
22382
22344
|
this._config.onScroll({
|
|
22383
22345
|
leftEnd: this.isLeftEnd(),
|
|
22384
22346
|
rightEnd: this.isRightEnd()
|
|
@@ -22398,7 +22360,7 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22398
22360
|
});
|
|
22399
22361
|
}
|
|
22400
22362
|
scrollToItem(index) {
|
|
22401
|
-
const targetIndex = index
|
|
22363
|
+
const targetIndex = index ?? this._config.currentIndex;
|
|
22402
22364
|
if (targetIndex < 0 || targetIndex >= this._slideTabItems.length) {
|
|
22403
22365
|
console.error("Index out of bounds");
|
|
22404
22366
|
return;
|
|
@@ -22587,7 +22549,6 @@ function shouldRefreshSheetTabs(commandInfo) {
|
|
|
22587
22549
|
}
|
|
22588
22550
|
}
|
|
22589
22551
|
function SheetBarTabs() {
|
|
22590
|
-
var _config$contextMenu;
|
|
22591
22552
|
const [sheetList, setSheetList] = (0, react.useState)([]);
|
|
22592
22553
|
const [activeSheetId, setActiveSheetId] = (0, react.useState)("");
|
|
22593
22554
|
const [scrollShadow, setScrollShadow] = (0, react.useState)("");
|
|
@@ -22609,7 +22570,7 @@ function SheetBarTabs() {
|
|
|
22609
22570
|
const workbookRef = (0, react.useRef)(workbook);
|
|
22610
22571
|
const resetOrder = (0, _univerjs_ui.useObservable)(worksheetProtectionRuleModel.resetOrder$);
|
|
22611
22572
|
const config = (0, _univerjs_ui.useConfigValue)(_univerjs_ui.UI_PLUGIN_CONFIG_KEY);
|
|
22612
|
-
const showContextMenu = (
|
|
22573
|
+
const showContextMenu = (config === null || config === void 0 ? void 0 : config.contextMenu) ?? true;
|
|
22613
22574
|
const getActiveTabRect = (0, react.useCallback)(() => {
|
|
22614
22575
|
var _slideTabBarRef$curre;
|
|
22615
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();
|
|
@@ -22688,7 +22649,7 @@ function SheetBarTabs() {
|
|
|
22688
22649
|
workbook
|
|
22689
22650
|
]);
|
|
22690
22651
|
const canRenameActiveSheet = (0, react.useCallback)(() => {
|
|
22691
|
-
var _permissionService$
|
|
22652
|
+
var _permissionService$ge2;
|
|
22692
22653
|
const unitId = workbook.getUnitId();
|
|
22693
22654
|
const activeSheet = workbook.getActiveSheet();
|
|
22694
22655
|
if (!activeSheet) return false;
|
|
@@ -22696,10 +22657,10 @@ function SheetBarTabs() {
|
|
|
22696
22657
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
22697
22658
|
const hasSelectionRule = rangeProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).length > 0;
|
|
22698
22659
|
if (worksheetRule || hasSelectionRule) {
|
|
22699
|
-
var _permissionService$ge
|
|
22700
|
-
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;
|
|
22701
22662
|
}
|
|
22702
|
-
return (
|
|
22663
|
+
return ((_permissionService$ge2 = permissionService.getPermissionPoint(new _univerjs_sheets.WorkbookRenameSheetPermission(unitId).id)) === null || _permissionService$ge2 === void 0 ? void 0 : _permissionService$ge2.value) ?? false;
|
|
22703
22664
|
}, [
|
|
22704
22665
|
permissionService,
|
|
22705
22666
|
rangeProtectionRuleModel,
|
|
@@ -22707,11 +22668,9 @@ function SheetBarTabs() {
|
|
|
22707
22668
|
worksheetProtectionRuleModel
|
|
22708
22669
|
]);
|
|
22709
22670
|
const updateSheetItems = (0, react.useCallback)(() => {
|
|
22710
|
-
var _activeSheet$getSheet;
|
|
22711
22671
|
const activeSheet = workbook.getActiveSheet();
|
|
22712
|
-
const currentSubUnitId = (
|
|
22672
|
+
const currentSubUnitId = (activeSheet === null || activeSheet === void 0 ? void 0 : activeSheet.getSheetId()) ?? "";
|
|
22713
22673
|
const sheetListItems = workbook.getSheets().filter((sheet) => !sheet.isSheetHidden()).map((sheet, index) => {
|
|
22714
|
-
var _sheet$getTabColor;
|
|
22715
22674
|
const worksheetRule = worksheetProtectionRuleModel.getRule(workbook.getUnitId(), sheet.getSheetId());
|
|
22716
22675
|
const hasSelectionRule = rangeProtectionRuleModel.getSubunitRuleList(workbook.getUnitId(), sheet.getSheetId()).length > 0;
|
|
22717
22676
|
const hasProtection = Boolean((worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) || hasSelectionRule);
|
|
@@ -22726,7 +22685,7 @@ function SheetBarTabs() {
|
|
|
22726
22685
|
}),
|
|
22727
22686
|
index,
|
|
22728
22687
|
selected: activeSheet === sheet,
|
|
22729
|
-
color:
|
|
22688
|
+
color: sheet.getTabColor() ?? void 0
|
|
22730
22689
|
};
|
|
22731
22690
|
});
|
|
22732
22691
|
setSheetList(sheetListItems);
|
|
@@ -22854,7 +22813,7 @@ function SheetBarTabs() {
|
|
|
22854
22813
|
workbook
|
|
22855
22814
|
]);
|
|
22856
22815
|
const onTabListKeyDown = (0, react.useCallback)((event) => {
|
|
22857
|
-
var _slideTabBarContainer2
|
|
22816
|
+
var _slideTabBarContainer2;
|
|
22858
22817
|
const target = event.target;
|
|
22859
22818
|
if (target.closest("[contenteditable=true]")) return;
|
|
22860
22819
|
const currentTab = target.closest("[data-u-comp=slide-tab-item]");
|
|
@@ -22869,7 +22828,7 @@ function SheetBarTabs() {
|
|
|
22869
22828
|
return;
|
|
22870
22829
|
}
|
|
22871
22830
|
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
22872
|
-
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]")) ?? []);
|
|
22873
22832
|
const currentIndex = tabItems.findIndex((tabItem) => tabItem.dataset.id === currentSheetId);
|
|
22874
22833
|
if (currentIndex < 0) return;
|
|
22875
22834
|
event.preventDefault();
|
|
@@ -22979,13 +22938,12 @@ function SheetBarTabs() {
|
|
|
22979
22938
|
}, [activeSheetId, sheetList]);
|
|
22980
22939
|
(0, react.useEffect)(() => {
|
|
22981
22940
|
const handlePointerDownCapture = (event) => {
|
|
22982
|
-
var _tabElement$getAttrib;
|
|
22983
22941
|
const container = slideTabBarContainerRef.current;
|
|
22984
22942
|
const target = event.target;
|
|
22985
22943
|
if (!container || !(target instanceof Element)) return;
|
|
22986
22944
|
const tabElement = target.closest("[data-u-comp=slide-tab-item]");
|
|
22987
22945
|
if (!tabElement || !container.contains(tabElement)) return;
|
|
22988
|
-
activateSheetTab(
|
|
22946
|
+
activateSheetTab(tabElement.getAttribute("data-id") ?? void 0);
|
|
22989
22947
|
};
|
|
22990
22948
|
document.addEventListener("pointerdown", handlePointerDownCapture, true);
|
|
22991
22949
|
return () => document.removeEventListener("pointerdown", handlePointerDownCapture, true);
|
|
@@ -23262,12 +23220,12 @@ const StatusBar = () => {
|
|
|
23262
23220
|
}
|
|
23263
23221
|
setShow(true);
|
|
23264
23222
|
setStatistics((prevStats) => prevStats.map((stat) => {
|
|
23265
|
-
var _items$find
|
|
23223
|
+
var _items$find;
|
|
23266
23224
|
return {
|
|
23267
23225
|
...stat,
|
|
23268
|
-
value: (
|
|
23226
|
+
value: ((_items$find = items.find((i) => i.func === stat.name)) === null || _items$find === void 0 ? void 0 : _items$find.value) ?? stat.value,
|
|
23269
23227
|
disable: !items.some((i) => i.func === stat.name),
|
|
23270
|
-
pattern: (
|
|
23228
|
+
pattern: (state === null || state === void 0 ? void 0 : state.pattern) ?? null
|
|
23271
23229
|
};
|
|
23272
23230
|
}));
|
|
23273
23231
|
}, []);
|
|
@@ -23322,13 +23280,11 @@ const StatusBar = () => {
|
|
|
23322
23280
|
//#region src/views/sheet-container/SheetContainer.tsx
|
|
23323
23281
|
const SHEET_FOOTER_BAR_HEIGHT = 36;
|
|
23324
23282
|
function RenderSheetFooter() {
|
|
23325
|
-
var _config$footer;
|
|
23326
23283
|
const config = (0, _univerjs_ui.useConfigValue)(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23327
23284
|
const menuManagerService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IMenuManagerService);
|
|
23328
|
-
const showFooter = (
|
|
23285
|
+
const showFooter = (config === null || config === void 0 ? void 0 : config.footer) ?? true;
|
|
23329
23286
|
const activeWorkbook = useActiveWorkbook();
|
|
23330
|
-
const
|
|
23331
|
-
const workbook = loadingWorkbook !== null && loadingWorkbook !== void 0 ? loadingWorkbook : activeWorkbook;
|
|
23287
|
+
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23332
23288
|
const isLoading = useSheetLoading();
|
|
23333
23289
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
23334
23290
|
const focusedUnitType = useFocusedUnitType();
|
|
@@ -23367,8 +23323,7 @@ function RenderSheetFooter() {
|
|
|
23367
23323
|
function RenderSheetHeader() {
|
|
23368
23324
|
const config = (0, _univerjs_ui.useConfigValue)(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23369
23325
|
const activeWorkbook = useActiveWorkbook();
|
|
23370
|
-
const
|
|
23371
|
-
const workbook = loadingWorkbook !== null && loadingWorkbook !== void 0 ? loadingWorkbook : activeWorkbook;
|
|
23326
|
+
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23372
23327
|
const isLoading = useSheetLoading();
|
|
23373
23328
|
const hasWorkbook = !!workbook;
|
|
23374
23329
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
@@ -23396,18 +23351,16 @@ function RenderSheetHeader() {
|
|
|
23396
23351
|
* We should not write into this component anymore.
|
|
23397
23352
|
*/
|
|
23398
23353
|
function RenderSheetContent() {
|
|
23399
|
-
var _componentManager$get;
|
|
23400
23354
|
const config = (0, _univerjs_ui.useConfigValue)(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23401
23355
|
const isLoading = useSheetLoading();
|
|
23402
23356
|
const isPreviewReady = useSheetLoadingPreviewReady();
|
|
23403
23357
|
const componentManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.ComponentManager);
|
|
23404
23358
|
const activeWorkbook = useActiveWorkbook();
|
|
23405
|
-
const
|
|
23406
|
-
const workbook = loadingWorkbook !== null && loadingWorkbook !== void 0 ? loadingWorkbook : activeWorkbook;
|
|
23359
|
+
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23407
23360
|
const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
|
|
23408
23361
|
const injector = (0, _univerjs_ui.useDependency)(_univerjs_core.Injector);
|
|
23409
23362
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
23410
|
-
const ShapeTextEditorContainer =
|
|
23363
|
+
const ShapeTextEditorContainer = componentManager.get("SheetShapeTextEditorContainer") ?? componentManager.get("ShapeTextEditorContainer");
|
|
23411
23364
|
(0, react.useEffect)(() => {
|
|
23412
23365
|
var _tryGetSheetEmbedRunt;
|
|
23413
23366
|
if (!workbook || isLoading || activeEmbedTab || activeWorkbookEmbeddedRender) return;
|
|
@@ -23517,11 +23470,10 @@ function useFocusedUnitType() {
|
|
|
23517
23470
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
23518
23471
|
const focusedUnitId = (0, _univerjs_ui.useObservable)(() => univerInstanceService.focused$, null, false, [univerInstanceService]);
|
|
23519
23472
|
return (0, react.useMemo)(() => {
|
|
23520
|
-
var _focusedUnit$type;
|
|
23521
23473
|
if (!focusedUnitId) return null;
|
|
23522
23474
|
if ((0, _univerjs_core.isInternalEditorID)(focusedUnitId) && univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET)) return _univerjs_core.UniverInstanceType.UNIVER_SHEET;
|
|
23523
23475
|
const focusedUnit = univerInstanceService.getUnit(focusedUnitId);
|
|
23524
|
-
return (
|
|
23476
|
+
return (focusedUnit === null || focusedUnit === void 0 ? void 0 : focusedUnit.type) ?? null;
|
|
23525
23477
|
}, [focusedUnitId, univerInstanceService]);
|
|
23526
23478
|
}
|
|
23527
23479
|
function useActiveSheetEmbedTabData(workbook) {
|
|
@@ -24147,7 +24099,7 @@ const useHighlightRange = (ranges = []) => {
|
|
|
24147
24099
|
//#endregion
|
|
24148
24100
|
//#region package.json
|
|
24149
24101
|
var name = "@univerjs/sheets-ui";
|
|
24150
|
-
var version = "1.0.0-
|
|
24102
|
+
var version = "1.0.0-beta.0";
|
|
24151
24103
|
|
|
24152
24104
|
//#endregion
|
|
24153
24105
|
//#region src/views/cell-popup/config.ts
|
|
@@ -24240,13 +24192,12 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24240
24192
|
_createHiddenRectObserver(params) {
|
|
24241
24193
|
const { row, column, worksheet, skeleton, currentRender } = params;
|
|
24242
24194
|
const calc = () => {
|
|
24243
|
-
var _columnWidthAccumulat, _rowHeightAccumulatio;
|
|
24244
24195
|
const { startRow: freezeStartRow, startColumn: freezeStartColumn, xSplit, ySplit } = worksheet.getFreeze();
|
|
24245
24196
|
const startRow = freezeStartRow - ySplit;
|
|
24246
24197
|
const startColumn = freezeStartColumn - xSplit;
|
|
24247
24198
|
const { rowHeightAccumulation, columnWidthAccumulation, rowHeaderWidth, columnHeaderHeight } = skeleton;
|
|
24248
|
-
const canvasFreezeWidth = rowHeaderWidth + (startColumn === -1 ? 0 : columnWidthAccumulation[startColumn + xSplit - 1] - (
|
|
24249
|
-
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));
|
|
24250
24201
|
const canvasElement = currentRender.engine.getCanvasElement();
|
|
24251
24202
|
const canvasClientRect = canvasElement.getBoundingClientRect();
|
|
24252
24203
|
const widthOfCanvas = pxToNum(canvasElement.style.width);
|
|
@@ -24496,7 +24447,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24496
24447
|
const sheetSelectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
24497
24448
|
if (!currentRender || !skeleton || !sheetSelectionRenderService) return null;
|
|
24498
24449
|
if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
|
|
24499
|
-
const activeViewport = viewport
|
|
24450
|
+
const activeViewport = viewport ?? getViewportByCell(row, col, currentRender.scene, worksheet);
|
|
24500
24451
|
if (!activeViewport) return null;
|
|
24501
24452
|
const { position, position$, disposable: positionObserverDisposable, updateRowCol } = this._createCellPositionObserver(row, col, currentRender, skeleton, activeViewport);
|
|
24502
24453
|
const { rects$, disposable: rectsObserverDisposable } = this._createHiddenRectObserver({
|
|
@@ -24565,7 +24516,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24565
24516
|
const sheetSelectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
24566
24517
|
if (!currentRender || !skeleton || !sheetSelectionRenderService) return null;
|
|
24567
24518
|
if (sheetSelectionRenderService.selectionMoving && !showOnSelectionMoving) return;
|
|
24568
|
-
const activeViewport = viewport
|
|
24519
|
+
const activeViewport = viewport ?? getViewportByCell(range.startRow, range.startColumn, currentRender.scene, worksheet);
|
|
24569
24520
|
if (!activeViewport) return null;
|
|
24570
24521
|
const { position, position$, disposable: positionObserverDisposable, updateRange, topLeftPos$, rightBottomPos$ } = this._createRangePositionObserver(range, currentRender, skeleton, activeViewport);
|
|
24571
24522
|
const { rects$, disposable: rectsObserverDisposable } = this._createHiddenRectObserver({
|
|
@@ -24806,12 +24757,12 @@ let CellPopupManagerService = class CellPopupManagerService extends _univerjs_co
|
|
|
24806
24757
|
return subUnitMap;
|
|
24807
24758
|
}
|
|
24808
24759
|
showPopup(location, popup) {
|
|
24809
|
-
var _subUnitMap$getValue
|
|
24760
|
+
var _subUnitMap$getValue;
|
|
24810
24761
|
const { direction = "horizontal" } = popup;
|
|
24811
24762
|
const { unitId, subUnitId, row, col } = location;
|
|
24812
24763
|
const subUnitMap = this._ensureCellPopupMap(unitId, subUnitId);
|
|
24813
24764
|
const directionCache = (_subUnitMap$getValue = subUnitMap.getValue(row, col)) === null || _subUnitMap$getValue === void 0 ? void 0 : _subUnitMap$getValue[direction];
|
|
24814
|
-
popup.id =
|
|
24765
|
+
popup.id = popup.id ?? (0, _univerjs_core.generateRandomId)();
|
|
24815
24766
|
const hidePopup = () => {
|
|
24816
24767
|
const root = subUnitMap.getValue(row, col);
|
|
24817
24768
|
if (!root) return;
|
|
@@ -25565,7 +25516,6 @@ function getBorderStyle(borderData) {
|
|
|
25565
25516
|
}
|
|
25566
25517
|
}
|
|
25567
25518
|
function BorderPanel(props) {
|
|
25568
|
-
var _value$color;
|
|
25569
25519
|
const iconManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.IconManager);
|
|
25570
25520
|
const borderStyleManagerService = (0, _univerjs_ui.useDependency)(_univerjs_sheets.BorderStyleManagerService);
|
|
25571
25521
|
const selectionManagerService = (0, _univerjs_ui.useDependency)(_univerjs_sheets.SheetsSelectionsService);
|
|
@@ -25615,7 +25565,7 @@ function BorderPanel(props) {
|
|
|
25615
25565
|
type: "button",
|
|
25616
25566
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.PaintBucketDoubleIcon, {
|
|
25617
25567
|
className: "univer-fill-primary-600 dark:!univer-text-white",
|
|
25618
|
-
extend: { colorChannel1: (
|
|
25568
|
+
extend: { colorChannel1: (value === null || value === void 0 ? void 0 : value.color) ?? "" }
|
|
25619
25569
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "dark:!univer-text-white" })]
|
|
25620
25570
|
})
|
|
25621
25571
|
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
@@ -25638,7 +25588,7 @@ function BorderPanel(props) {
|
|
|
25638
25588
|
type: "button",
|
|
25639
25589
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderLine, {
|
|
25640
25590
|
className: "univer-fill-gray-900 dark:!univer-fill-white",
|
|
25641
|
-
type: type
|
|
25591
|
+
type: type ?? _univerjs_core.BorderStyleTypes.THIN
|
|
25642
25592
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "dark:!univer-text-white" })]
|
|
25643
25593
|
})
|
|
25644
25594
|
}) })]
|
|
@@ -25774,9 +25724,8 @@ const CellPopup = (props) => {
|
|
|
25774
25724
|
"data-u-comp": "sheets-ui-cell-popup",
|
|
25775
25725
|
className: "univer-ml-px univer-flex univer-flex-col",
|
|
25776
25726
|
children: popups.map((popup) => {
|
|
25777
|
-
var _popup$id;
|
|
25778
25727
|
const Component = componentManager.get(popup.componentKey);
|
|
25779
|
-
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;
|
|
25780
25729
|
})
|
|
25781
25730
|
});
|
|
25782
25731
|
};
|
|
@@ -26018,8 +25967,7 @@ const DefinedNameContainer = () => {
|
|
|
26018
25967
|
if (!workbook || !unitId) return;
|
|
26019
25968
|
const checkWorkbookPermission = permissionState.workbook;
|
|
26020
25969
|
const checkDefinedNamePermission = (definedName) => {
|
|
26021
|
-
|
|
26022
|
-
return (_permissionState$work = permissionState.worksheets.get(definedName.id)) !== null && _permissionState$work !== void 0 ? _permissionState$work : checkWorkbookPermission;
|
|
25970
|
+
return permissionState.worksheets.get(definedName.id) ?? checkWorkbookPermission;
|
|
26023
25971
|
};
|
|
26024
25972
|
const insertConfirm = (param) => {
|
|
26025
25973
|
const { name, formulaOrRefString, comment, localSheetId, hidden } = param;
|
|
@@ -26222,7 +26170,7 @@ function CascaderDropdown(props) {
|
|
|
26222
26170
|
const { popup } = props;
|
|
26223
26171
|
const { extraProps } = popup;
|
|
26224
26172
|
const { options, defaultValue, onChange } = extraProps;
|
|
26225
|
-
const [localValue, setLocalValue] = (0, react.useState)(defaultValue
|
|
26173
|
+
const [localValue, setLocalValue] = (0, react.useState)(defaultValue ?? []);
|
|
26226
26174
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.CascaderList, {
|
|
26227
26175
|
options,
|
|
26228
26176
|
value: localValue,
|
|
@@ -26267,7 +26215,7 @@ function DateDropdown(props) {
|
|
|
26267
26215
|
}
|
|
26268
26216
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Calendar, {
|
|
26269
26217
|
value: date.toDate(),
|
|
26270
|
-
showTime: showTime
|
|
26218
|
+
showTime: showTime ?? patternType === "datetime",
|
|
26271
26219
|
onValueChange: (newValue) => {
|
|
26272
26220
|
setLocalDate((0, _univerjs_core.dateKit)(newValue));
|
|
26273
26221
|
}
|
|
@@ -26420,13 +26368,12 @@ function SelectList(props) {
|
|
|
26420
26368
|
});
|
|
26421
26369
|
}
|
|
26422
26370
|
function ListDropDown(props) {
|
|
26423
|
-
var _anchorRect$right, _anchorRect$left;
|
|
26424
26371
|
const { popup: { extraProps, anchorRect } } = props;
|
|
26425
26372
|
const { location, hideFn, onChange, onEdit, options, defaultValue, multiple, showSearch, showEdit } = extraProps;
|
|
26426
26373
|
const { worksheet } = location;
|
|
26427
26374
|
const [localValue, setLocalValue] = (0, react.useState)(defaultValue);
|
|
26428
26375
|
if (!worksheet) return null;
|
|
26429
|
-
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);
|
|
26430
26377
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectList, {
|
|
26431
26378
|
style: {
|
|
26432
26379
|
minWidth: cellWidth,
|
|
@@ -26435,8 +26382,7 @@ function ListDropDown(props) {
|
|
|
26435
26382
|
value: getListDropdownValue(localValue, multiple),
|
|
26436
26383
|
multiple,
|
|
26437
26384
|
onChange: async (newValue) => {
|
|
26438
|
-
|
|
26439
|
-
const str = multiple ? (0, _univerjs_sheets.serializeListOptions)(newValue) : (_newValue$ = newValue[0]) !== null && _newValue$ !== void 0 ? _newValue$ : "";
|
|
26385
|
+
const str = multiple ? (0, _univerjs_sheets.serializeListOptions)(newValue) : newValue[0] ?? "";
|
|
26440
26386
|
setLocalValue(str);
|
|
26441
26387
|
if (!(await (onChange === null || onChange === void 0 ? void 0 : onChange(newValue)) === false)) hideFn();
|
|
26442
26388
|
},
|
|
@@ -26693,13 +26639,13 @@ const checkRangesIsWholeSheet = (ranges, sheet) => {
|
|
|
26693
26639
|
return startRow === 0 && startColumn === 0 && endRow === rowCount - 1 && endColumn === colCount - 1;
|
|
26694
26640
|
};
|
|
26695
26641
|
const generateDefaultRule = (injector, fromSheetBar) => {
|
|
26696
|
-
var _selectionManagerServ
|
|
26642
|
+
var _selectionManagerServ;
|
|
26697
26643
|
const univerInstanceService = injector.get(_univerjs_core.IUniverInstanceService);
|
|
26698
26644
|
const selectionManagerService = injector.get(_univerjs_sheets.SheetsSelectionsService);
|
|
26699
26645
|
const workbook = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
26700
26646
|
const worksheet = workbook.getActiveSheet();
|
|
26701
26647
|
let unitType = _univerjs_protocol.UnitObject.SelectRange;
|
|
26702
|
-
let ranges = (_selectionManagerServ =
|
|
26648
|
+
let ranges = ((_selectionManagerServ = selectionManagerService.getCurrentSelections()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.map((s) => s.range)) ?? [];
|
|
26703
26649
|
if (fromSheetBar) {
|
|
26704
26650
|
unitType = _univerjs_protocol.UnitObject.Worksheet;
|
|
26705
26651
|
ranges = [{
|
|
@@ -26972,7 +26918,6 @@ const UserEmptyBase64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAADwC
|
|
|
26972
26918
|
//#endregion
|
|
26973
26919
|
//#region src/views/permission/panel-detail/PermissionDetailUserPart.tsx
|
|
26974
26920
|
const PermissionDetailUserPart = (props) => {
|
|
26975
|
-
var _workbook$getUnitId;
|
|
26976
26921
|
const { editState, onEditStateChange, viewState, onViewStateChange, permissionId } = props;
|
|
26977
26922
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
26978
26923
|
const dialogService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IDialogService);
|
|
@@ -26983,7 +26928,7 @@ const PermissionDetailUserPart = (props) => {
|
|
|
26983
26928
|
const selectUserList = (0, _univerjs_ui.useObservable)(sheetPermissionUserManagerService.selectUserList$, sheetPermissionUserManagerService.selectUserList);
|
|
26984
26929
|
const workbook = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
26985
26930
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
|
|
26986
|
-
const unitId = (
|
|
26931
|
+
const unitId = (workbook === null || workbook === void 0 ? void 0 : workbook.getUnitId()) ?? "";
|
|
26987
26932
|
const handleEditStateChange = (0, _univerjs_ui.useEvent)(onEditStateChange);
|
|
26988
26933
|
const handleAddPerson = async () => {
|
|
26989
26934
|
const userList = await authzIoService.listCollaborators({
|
|
@@ -27133,7 +27078,6 @@ const PermissionDetailUserPart = (props) => {
|
|
|
27133
27078
|
//#endregion
|
|
27134
27079
|
//#region src/views/permission/panel-detail/PermissionDetailPanel.tsx
|
|
27135
27080
|
const SheetPermissionPanelDetail = (props) => {
|
|
27136
|
-
var _activeRule$editState, _activeRule$viewState;
|
|
27137
27081
|
const { fromSheetBar, rule, oldRule } = props;
|
|
27138
27082
|
const injector = (0, _univerjs_ui.useDependency)(_univerjs_core.Injector);
|
|
27139
27083
|
const componentManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.ComponentManager);
|
|
@@ -27143,10 +27087,9 @@ const SheetPermissionPanelDetail = (props) => {
|
|
|
27143
27087
|
return checkRangeValid(injector, activeRule.ranges, activeRule.permissionId, activeRule.unitId, activeRule.subUnitId);
|
|
27144
27088
|
});
|
|
27145
27089
|
const [desc, setDesc] = (0, react.useState)(activeRule.description);
|
|
27146
|
-
const [editState, setEditState] = (0, react.useState)(
|
|
27147
|
-
const [viewState, setViewState] = (0, react.useState)(
|
|
27148
|
-
const
|
|
27149
|
-
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;
|
|
27150
27093
|
(0, react.useEffect)(() => {
|
|
27151
27094
|
const univerInstanceService = injector.get(_univerjs_core.IUniverInstanceService);
|
|
27152
27095
|
const sidebarService = injector.get(_univerjs_ui.ISidebarService);
|
|
@@ -27358,7 +27301,7 @@ function SheetPermissionPanelListContent() {
|
|
|
27358
27301
|
})]
|
|
27359
27302
|
}),
|
|
27360
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) => {
|
|
27361
|
-
var _item$creator, _item$creator2, _item$
|
|
27304
|
+
var _item$creator, _item$creator2, _item$creator3, _item$creator4;
|
|
27362
27305
|
const rule = allRuleMap.get(item.objectID);
|
|
27363
27306
|
if (!rule) return null;
|
|
27364
27307
|
const editAction = item.actions.find((action) => action.action === _univerjs_protocol.UnitAction.Edit);
|
|
@@ -27434,7 +27377,7 @@ function SheetPermissionPanelListContent() {
|
|
|
27434
27377
|
className: "univer-flex univer-items-center",
|
|
27435
27378
|
children: [
|
|
27436
27379
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
|
|
27437
|
-
title: (
|
|
27380
|
+
title: ((_item$creator3 = item.creator) === null || _item$creator3 === void 0 ? void 0 : _item$creator3.name) ?? "",
|
|
27438
27381
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Avatar, {
|
|
27439
27382
|
src: (_item$creator4 = item.creator) === null || _item$creator4 === void 0 ? void 0 : _item$creator4.avatar,
|
|
27440
27383
|
className: "univer-mr-1.5",
|
|
@@ -27528,19 +27471,19 @@ const SheetPermissionPanel = ({ showDetail, fromSheetBar, rule, oldRule }) => {
|
|
|
27528
27471
|
//#endregion
|
|
27529
27472
|
//#region src/views/permission/SheetPermissionUserDialog.tsx
|
|
27530
27473
|
const SheetPermissionUserDialog = () => {
|
|
27531
|
-
var
|
|
27474
|
+
var _authzIoService$getCf;
|
|
27532
27475
|
const [inputValue, setInputValue] = (0, react.useState)("");
|
|
27533
27476
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
27534
27477
|
const dialogService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IDialogService);
|
|
27535
27478
|
const sheetPermissionUserManagerService = (0, _univerjs_ui.useDependency)(SheetPermissionUserManagerService);
|
|
27536
27479
|
const authzIoService = (0, _univerjs_ui.useDependency)(_univerjs_core.IAuthzIoService);
|
|
27537
27480
|
const userList = (0, _univerjs_ui.useObservable)(sheetPermissionUserManagerService.userList$, sheetPermissionUserManagerService.userList);
|
|
27538
|
-
const searchUserList = (
|
|
27481
|
+
const searchUserList = (userList === null || userList === void 0 ? void 0 : userList.filter((item) => {
|
|
27539
27482
|
var _item$subject;
|
|
27540
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);
|
|
27541
|
-
}))
|
|
27484
|
+
})) ?? [];
|
|
27542
27485
|
const [selectUserInfo, setSelectUserInfo] = (0, react.useState)(sheetPermissionUserManagerService.selectUserList);
|
|
27543
|
-
const cfgEnableObjInherit = (_authzIoService$getCf =
|
|
27486
|
+
const cfgEnableObjInherit = ((_authzIoService$getCf = authzIoService.getCfgEnableObjInherit) === null || _authzIoService$getCf === void 0 ? void 0 : _authzIoService$getCf.call(authzIoService)) ?? false;
|
|
27544
27487
|
const handleChangeUser = (item) => {
|
|
27545
27488
|
if ((selectUserInfo === null || selectUserInfo === void 0 ? void 0 : selectUserInfo.findIndex((v) => {
|
|
27546
27489
|
var _v$subject, _item$subject2;
|
|
@@ -28020,8 +27963,8 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
28020
27963
|
const docViewModel = this._getEditorViewModel(unitId);
|
|
28021
27964
|
if (docDataModel == null || docViewModel == null || skeleton == null) return;
|
|
28022
27965
|
docDataModel.getSnapshot().body = body;
|
|
28023
|
-
docDataModel.getSnapshot().drawings = drawings
|
|
28024
|
-
docDataModel.getSnapshot().drawingsOrder = drawingsOrder
|
|
27966
|
+
docDataModel.getSnapshot().drawings = drawings ?? {};
|
|
27967
|
+
docDataModel.getSnapshot().drawingsOrder = drawingsOrder ?? [];
|
|
28025
27968
|
this._checkAndSetRenderStyleConfig(docDataModel);
|
|
28026
27969
|
docViewModel.reset(docDataModel);
|
|
28027
27970
|
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
@@ -28053,15 +27996,12 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
28053
27996
|
if (unitId === _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) this._formulaEditorController.autoScroll();
|
|
28054
27997
|
}
|
|
28055
27998
|
_checkAndSetRenderStyleConfig(documentDataModel) {
|
|
28056
|
-
var _snapshot$body
|
|
27999
|
+
var _snapshot$body;
|
|
28057
28000
|
const snapshot = documentDataModel.getSnapshot();
|
|
28058
28001
|
if (snapshot.id !== _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY && snapshot.id !== _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY) return;
|
|
28059
28002
|
const isFormulaBar = snapshot.id === _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY;
|
|
28060
28003
|
if (isFormulaBar) snapshot.documentStyle = formulaEditorStyle;
|
|
28061
|
-
else {
|
|
28062
|
-
var _snapshot$documentSty;
|
|
28063
|
-
(_snapshot$documentSty = snapshot.documentStyle) !== null && _snapshot$documentSty !== void 0 || (snapshot.documentStyle = {});
|
|
28064
|
-
}
|
|
28004
|
+
else snapshot.documentStyle ??= {};
|
|
28065
28005
|
let renderConfig = snapshot.documentStyle.renderConfig;
|
|
28066
28006
|
if (renderConfig == null) {
|
|
28067
28007
|
renderConfig = {};
|
|
@@ -28075,7 +28015,7 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
28075
28015
|
height: Infinity
|
|
28076
28016
|
};
|
|
28077
28017
|
}
|
|
28078
|
-
if (!((
|
|
28018
|
+
if (!(((_snapshot$body = snapshot.body) === null || _snapshot$body === void 0 ? void 0 : _snapshot$body.dataStream) ?? "").startsWith("=")) {
|
|
28079
28019
|
renderConfig.isRenderStyle = isFormulaBar ? _univerjs_core.BooleanNumber.FALSE : _univerjs_core.BooleanNumber.TRUE;
|
|
28080
28020
|
return;
|
|
28081
28021
|
}
|
|
@@ -28545,13 +28485,12 @@ function MobileSheetBarImpl(props) {
|
|
|
28545
28485
|
const sheets = workbook.getSheets();
|
|
28546
28486
|
const activeSheet = workbook.getActiveSheet();
|
|
28547
28487
|
const sheetListItems = sheets.filter((sheet) => !sheet.isSheetHidden()).map((sheet, index) => {
|
|
28548
|
-
var _sheet$getTabColor;
|
|
28549
28488
|
return {
|
|
28550
28489
|
sheetId: sheet.getSheetId(),
|
|
28551
28490
|
label: sheet.getName(),
|
|
28552
28491
|
index,
|
|
28553
28492
|
selected: activeSheet === sheet,
|
|
28554
|
-
color:
|
|
28493
|
+
color: sheet.getTabColor() ?? void 0
|
|
28555
28494
|
};
|
|
28556
28495
|
});
|
|
28557
28496
|
setSheetList(sheetListItems);
|
|
@@ -28890,11 +28829,11 @@ let SheetPermissionInterceptorCanvasRenderController = class SheetPermissionInte
|
|
|
28890
28829
|
if (!target) return false;
|
|
28891
28830
|
const { unitId, subUnitId } = target;
|
|
28892
28831
|
if (rangeParams.row) {
|
|
28893
|
-
var _this$_permissionServ
|
|
28894
|
-
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;
|
|
28895
28834
|
} else if (rangeParams.col) {
|
|
28896
|
-
var _this$
|
|
28897
|
-
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;
|
|
28898
28837
|
}
|
|
28899
28838
|
return true;
|
|
28900
28839
|
} }));
|
|
@@ -28962,10 +28901,10 @@ let SheetPermissionInterceptorCanvasRenderController = class SheetPermissionInte
|
|
|
28962
28901
|
}
|
|
28963
28902
|
_initFreezePermissionInterceptor() {
|
|
28964
28903
|
this.disposeWithMe(this._headerFreezeRenderController.interceptor.intercept(this._headerFreezeRenderController.interceptor.getInterceptPoints().FREEZE_PERMISSION_CHECK, { handler: (_, __) => {
|
|
28965
|
-
var _this$
|
|
28904
|
+
var _this$_permissionServ3;
|
|
28966
28905
|
const workbook = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
28967
28906
|
if (!(workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet()) || !workbook) return false;
|
|
28968
|
-
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;
|
|
28969
28908
|
} }));
|
|
28970
28909
|
}
|
|
28971
28910
|
};
|
|
@@ -29054,7 +28993,7 @@ let SheetPermissionInterceptorFormulaRenderController = class SheetPermissionInt
|
|
|
29054
28993
|
handler: (defaultValue, originValue) => {
|
|
29055
28994
|
var _this$_permissionServ;
|
|
29056
28995
|
const target = (0, _univerjs_sheets.getSheetCommandTarget)(this._univerInstanceService);
|
|
29057
|
-
if (!target) return defaultValue
|
|
28996
|
+
if (!target) return defaultValue ?? [];
|
|
29058
28997
|
const { worksheet, unitId, subUnitId } = target;
|
|
29059
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) => {
|
|
29060
28999
|
const itemValue = item.getArrayValue();
|
|
@@ -29738,10 +29677,9 @@ let SheetContextMenuMobileRenderController = class SheetContextMenuMobileRenderC
|
|
|
29738
29677
|
return skeleton.getCellWithCoordByOffset(relativeCoords.x - scrollXY.x, relativeCoords.y - scrollXY.y, scaleX, scaleY, scrollXY);
|
|
29739
29678
|
}
|
|
29740
29679
|
_getCurrentRenderSelections() {
|
|
29741
|
-
var _selectionRenderServi;
|
|
29742
29680
|
const currentRender = this._renderManagerService.getRenderUnitById(this._context.unitId);
|
|
29743
29681
|
const selectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
29744
|
-
return (
|
|
29682
|
+
return (selectionRenderService === null || selectionRenderService === void 0 ? void 0 : selectionRenderService.getSelectionControls().map((control) => (0, _univerjs_sheets.convertSelectionDataToRange)(control.getValue()))) ?? [];
|
|
29745
29683
|
}
|
|
29746
29684
|
_cloneSelections(selections) {
|
|
29747
29685
|
return selections.map((selection) => ({
|
|
@@ -30844,14 +30782,14 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30844
30782
|
return skeleton.getRangeByViewport(viewport.calcViewportInfo());
|
|
30845
30783
|
}
|
|
30846
30784
|
_scrollToCell(row, column) {
|
|
30847
|
-
var _this$_sheetSkeletonM10, _this$
|
|
30848
|
-
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) ?? {};
|
|
30849
30787
|
if (rowHeightAccumulation == null || columnWidthAccumulation == null) return false;
|
|
30850
30788
|
const scene = (_this$_getSheetObject2 = this._getSheetObject()) === null || _this$_getSheetObject2 === void 0 ? void 0 : _this$_getSheetObject2.scene;
|
|
30851
30789
|
if (scene == null) return false;
|
|
30852
30790
|
const viewport = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
30853
30791
|
if (viewport == null) return false;
|
|
30854
|
-
if (((_this$
|
|
30792
|
+
if (((_this$_sheetSkeletonM11 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM11 === void 0 ? void 0 : _this$_sheetSkeletonM11.skeleton) == null) return false;
|
|
30855
30793
|
const worksheet = this._context.unit.getActiveSheet();
|
|
30856
30794
|
if (!worksheet) return false;
|
|
30857
30795
|
const { startColumn: freezeStartColumn, startRow: freezeStartRow, ySplit: freezeYSplit, xSplit: freezeXSplit } = worksheet.getFreeze();
|
|
@@ -31652,9 +31590,8 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31652
31590
|
* When pinch zooming, we should not process pointer move events for selection.
|
|
31653
31591
|
*/
|
|
31654
31592
|
_setupPointerMoveListener(viewportMain, activeSelectionControl, rangeType, scrollTimerType = _univerjs_engine_render.ScrollTimerType.ALL, moveStartPosX, moveStartPosY) {
|
|
31655
|
-
var _viewportMain$left, _viewportMain$top;
|
|
31656
31593
|
this._scrollTimer = _univerjs_engine_render.ScrollTimer.create(this._scene, scrollTimerType);
|
|
31657
|
-
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);
|
|
31658
31595
|
const scene = this._scene;
|
|
31659
31596
|
this._scenePointerMoveSub = scene.onPointerMove$.subscribeEvent((moveEvt) => {
|
|
31660
31597
|
if (this._contextService.getContextValue("MOBILE_PINCH_ZOOMING")) return;
|
|
@@ -31676,7 +31613,7 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31676
31613
|
* In Mobile version, new selection is determined by cursor cell and current of activeSelectionControl.model
|
|
31677
31614
|
*/
|
|
31678
31615
|
_movingHandler(offsetX, offsetY, activeSelectionControl, rangeType) {
|
|
31679
|
-
var
|
|
31616
|
+
var _anchorCell$mergeInfo, _anchorCell$mergeInfo2, _anchorCell$mergeInfo3, _anchorCell$mergeInfo4;
|
|
31680
31617
|
this._rangeType = rangeType;
|
|
31681
31618
|
const skeleton = this._skeleton;
|
|
31682
31619
|
const scene = this._scene;
|
|
@@ -31687,7 +31624,7 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31687
31624
|
endColumn: activeSelectionControl.model.endColumn
|
|
31688
31625
|
};
|
|
31689
31626
|
const viewportMain = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
31690
|
-
const targetViewport =
|
|
31627
|
+
const targetViewport = this._getViewportByCell(currSelectionRange.endRow, currSelectionRange.endColumn) ?? viewportMain;
|
|
31691
31628
|
const scrollXY = scene.getScrollXYInfoByViewport(_univerjs_engine_render.Vector2.FromArray([this._startViewportPosX, this._startViewportPosY]), targetViewport);
|
|
31692
31629
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
31693
31630
|
if (rangeType === _univerjs_core.RANGE_TYPE.ROW) offsetX = Number.POSITIVE_INFINITY;
|
|
@@ -31695,11 +31632,11 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31695
31632
|
const cursorCellRangeInfo = this._getSelectionWithCoordByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
31696
31633
|
if (!cursorCellRangeInfo) return false;
|
|
31697
31634
|
const { rangeWithCoord: cursorCellRange } = cursorCellRangeInfo;
|
|
31698
|
-
const anchorCell =
|
|
31699
|
-
const startRowOfActiveCell = (
|
|
31700
|
-
const endRowOfActiveCell = (
|
|
31701
|
-
const startColumnOfActiveCell = (
|
|
31702
|
-
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;
|
|
31703
31640
|
let startRow = Math.min(cursorCellRange.startRow, startRowOfActiveCell);
|
|
31704
31641
|
if (startRowOfActiveCell === -1) startRow = cursorCellRange.startRow;
|
|
31705
31642
|
let startColumn = Math.min(cursorCellRange.startColumn, startColumnOfActiveCell);
|
|
@@ -31806,6 +31743,7 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends _unive
|
|
|
31806
31743
|
[SelectAllService],
|
|
31807
31744
|
[ISheetCellDropdownManagerService, { useClass: SheetCellDropdownManagerService }],
|
|
31808
31745
|
[SheetCellEditorResizeService],
|
|
31746
|
+
[ISheetLoadingRenderService, { useClass: SheetLoadingRenderService }],
|
|
31809
31747
|
[AutoHeightController],
|
|
31810
31748
|
[AutoWidthController],
|
|
31811
31749
|
[FormulaEditorController],
|
|
@@ -31871,7 +31809,6 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends _unive
|
|
|
31871
31809
|
});
|
|
31872
31810
|
}
|
|
31873
31811
|
_registerRenderModules() {
|
|
31874
|
-
var _config$contextMenu;
|
|
31875
31812
|
const modules = [
|
|
31876
31813
|
[HeaderMoveRenderController],
|
|
31877
31814
|
[HeaderUnhideRenderController],
|
|
@@ -31899,7 +31836,7 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends _unive
|
|
|
31899
31836
|
[WorksheetProtectionRenderController]
|
|
31900
31837
|
];
|
|
31901
31838
|
const config = this._configService.getConfig(_univerjs_ui.UI_PLUGIN_CONFIG_KEY);
|
|
31902
|
-
if ((
|
|
31839
|
+
if ((config === null || config === void 0 ? void 0 : config.contextMenu) ?? true) modules.push([HeaderMenuRenderController]);
|
|
31903
31840
|
modules.forEach((m) => {
|
|
31904
31841
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(_univerjs_core.UniverInstanceType.UNIVER_SHEET, m));
|
|
31905
31842
|
});
|
|
@@ -32492,7 +32429,6 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends _univerjs_core.Plu
|
|
|
32492
32429
|
});
|
|
32493
32430
|
}
|
|
32494
32431
|
_registerRenderModules() {
|
|
32495
|
-
var _config$contextMenu;
|
|
32496
32432
|
const modules = [
|
|
32497
32433
|
[HeaderMoveRenderController],
|
|
32498
32434
|
[HeaderUnhideRenderController],
|
|
@@ -32520,7 +32456,7 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends _univerjs_core.Plu
|
|
|
32520
32456
|
[WorksheetProtectionRenderController]
|
|
32521
32457
|
];
|
|
32522
32458
|
const config = this._configService.getConfig(_univerjs_ui.UI_PLUGIN_CONFIG_KEY);
|
|
32523
|
-
if ((
|
|
32459
|
+
if ((config === null || config === void 0 ? void 0 : config.contextMenu) ?? true) modules.push([HeaderMenuRenderController]);
|
|
32524
32460
|
modules.forEach((m) => {
|
|
32525
32461
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(_univerjs_core.UniverInstanceType.UNIVER_SHEET, m));
|
|
32526
32462
|
});
|
|
@@ -32540,7 +32476,7 @@ _defineProperty(UniverSheetsUIPlugin, "packageName", name);
|
|
|
32540
32476
|
_defineProperty(UniverSheetsUIPlugin, "version", version);
|
|
32541
32477
|
_defineProperty(UniverSheetsUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
32542
32478
|
UniverSheetsUIPlugin = __decorate([
|
|
32543
|
-
(0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_engine_formula.UniverFormulaEnginePlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _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),
|
|
32544
32480
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
32545
32481
|
__decorateParam(2, _univerjs_engine_render.IRenderManagerService),
|
|
32546
32482
|
__decorateParam(3, _univerjs_core.IConfigService),
|