@univerjs/sheets-ui 1.0.0-alpha.7 → 1.0.0-alpha.8
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 +2 -22
- package/lib/cjs/index.js +333 -371
- package/lib/cjs/locale/ar-SA.js +0 -2
- package/lib/cjs/locale/ca-ES.js +1 -3
- package/lib/cjs/locale/de-DE.js +0 -2
- package/lib/cjs/locale/en-US.js +0 -2
- package/lib/cjs/locale/es-ES.js +1 -3
- package/lib/cjs/locale/fa-IR.js +0 -2
- package/lib/cjs/locale/fr-FR.js +0 -2
- package/lib/cjs/locale/id-ID.js +1 -3
- package/lib/cjs/locale/it-IT.js +0 -2
- package/lib/cjs/locale/ja-JP.js +0 -2
- package/lib/cjs/locale/ko-KR.js +9 -11
- package/lib/cjs/locale/pl-PL.js +0 -2
- package/lib/cjs/locale/pt-BR.js +1 -3
- package/lib/cjs/locale/ru-RU.js +0 -2
- package/lib/cjs/locale/sk-SK.js +0 -2
- package/lib/cjs/locale/vi-VN.js +0 -2
- package/lib/cjs/locale/zh-CN.js +0 -2
- package/lib/cjs/locale/zh-HK.js +0 -2
- package/lib/cjs/locale/zh-TW.js +0 -2
- package/lib/es/facade.js +3 -23
- package/lib/es/index.js +339 -377
- package/lib/es/locale/ar-SA.js +0 -2
- package/lib/es/locale/ca-ES.js +1 -3
- package/lib/es/locale/de-DE.js +0 -2
- package/lib/es/locale/en-US.js +0 -2
- package/lib/es/locale/es-ES.js +1 -3
- package/lib/es/locale/fa-IR.js +0 -2
- package/lib/es/locale/fr-FR.js +0 -2
- package/lib/es/locale/id-ID.js +1 -3
- package/lib/es/locale/it-IT.js +0 -2
- package/lib/es/locale/ja-JP.js +0 -2
- package/lib/es/locale/ko-KR.js +9 -11
- package/lib/es/locale/pl-PL.js +0 -2
- package/lib/es/locale/pt-BR.js +1 -3
- package/lib/es/locale/ru-RU.js +0 -2
- package/lib/es/locale/sk-SK.js +0 -2
- package/lib/es/locale/vi-VN.js +0 -2
- package/lib/es/locale/zh-CN.js +0 -2
- package/lib/es/locale/zh-HK.js +0 -2
- package/lib/es/locale/zh-TW.js +0 -2
- package/lib/facade.js +3 -23
- package/lib/index.js +339 -377
- package/lib/locale/ar-SA.js +0 -2
- package/lib/locale/ca-ES.js +1 -3
- package/lib/locale/de-DE.js +0 -2
- package/lib/locale/en-US.js +0 -2
- package/lib/locale/es-ES.js +1 -3
- package/lib/locale/fa-IR.js +0 -2
- package/lib/locale/fr-FR.js +0 -2
- package/lib/locale/id-ID.js +1 -3
- package/lib/locale/it-IT.js +0 -2
- package/lib/locale/ja-JP.js +0 -2
- package/lib/locale/ko-KR.js +9 -11
- package/lib/locale/pl-PL.js +0 -2
- package/lib/locale/pt-BR.js +1 -3
- package/lib/locale/ru-RU.js +0 -2
- package/lib/locale/sk-SK.js +0 -2
- package/lib/locale/vi-VN.js +0 -2
- package/lib/locale/zh-CN.js +0 -2
- package/lib/locale/zh-HK.js +0 -2
- package/lib/locale/zh-TW.js +0 -2
- package/lib/types/commands/operations/cell-edit.operation.d.ts +0 -2
- package/lib/types/config/config.d.ts +0 -4
- package/lib/types/facade/f-workbook.d.ts +1 -63
- package/lib/types/facade/f-worksheet.d.ts +6 -35
- package/lib/types/locale/en-US.d.ts +0 -2
- package/lib/types/services/clipboard/type.d.ts +0 -1
- package/lib/types/services/editor-bridge.service.d.ts +1 -1
- package/lib/types/services/selection/base-selection-render.service.d.ts +0 -17
- package/lib/types/services/selection/selection-control.d.ts +0 -12
- package/lib/types/services/selection/selection-render-model.d.ts +1 -1
- package/lib/types/views/sheet-container/SheetContainer.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +9 -9
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +14 -14
- package/lib/types/views/editor-container/EditorContainer.spec.d.ts +0 -16
package/lib/cjs/index.js
CHANGED
|
@@ -18,7 +18,7 @@ let rxjs_operators = require("rxjs/operators");
|
|
|
18
18
|
//#region src/basics/editor/get-editor-object.ts
|
|
19
19
|
function getEditorObject(unitId, renderManagerService) {
|
|
20
20
|
if (unitId == null) return;
|
|
21
|
-
const currentRender = renderManagerService.
|
|
21
|
+
const currentRender = renderManagerService.getRenderUnitById(unitId);
|
|
22
22
|
if (currentRender == null) return;
|
|
23
23
|
const { mainComponent, scene, engine, components } = currentRender;
|
|
24
24
|
return {
|
|
@@ -186,7 +186,7 @@ let SHEET_VIEW_KEY = /* @__PURE__ */ function(SHEET_VIEW_KEY) {
|
|
|
186
186
|
}({});
|
|
187
187
|
|
|
188
188
|
//#endregion
|
|
189
|
-
//#region \0@oxc-project+runtime@0.
|
|
189
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
190
190
|
function _typeof(o) {
|
|
191
191
|
"@babel/helpers - typeof";
|
|
192
192
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -197,7 +197,7 @@ function _typeof(o) {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
//#endregion
|
|
200
|
-
//#region \0@oxc-project+runtime@0.
|
|
200
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
201
201
|
function toPrimitive(t, r) {
|
|
202
202
|
if ("object" != _typeof(t) || !t) return t;
|
|
203
203
|
var e = t[Symbol.toPrimitive];
|
|
@@ -210,14 +210,14 @@ function toPrimitive(t, r) {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
//#endregion
|
|
213
|
-
//#region \0@oxc-project+runtime@0.
|
|
213
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
214
214
|
function toPropertyKey(t) {
|
|
215
215
|
var i = toPrimitive(t, "string");
|
|
216
216
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
//#endregion
|
|
220
|
-
//#region \0@oxc-project+runtime@0.
|
|
220
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
221
221
|
function _defineProperty(e, r, t) {
|
|
222
222
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
223
223
|
value: t,
|
|
@@ -277,7 +277,7 @@ var SelectionRenderModel = class {
|
|
|
277
277
|
return this._rangeType;
|
|
278
278
|
}
|
|
279
279
|
/**
|
|
280
|
-
*
|
|
280
|
+
* Compares row and column bounds only.
|
|
281
281
|
*/
|
|
282
282
|
isEqual(rangeWithCoord) {
|
|
283
283
|
const { startColumn, startRow, endColumn, endRow } = this;
|
|
@@ -354,9 +354,9 @@ const SetRowHeaderWidthCommand = {
|
|
|
354
354
|
const renderManagerSrv = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
355
355
|
if (!renderManagerSrv) return false;
|
|
356
356
|
const { unitId, subUnitId, size } = params;
|
|
357
|
-
const render = renderManagerSrv.
|
|
357
|
+
const render = renderManagerSrv.getRenderUnitById(unitId);
|
|
358
358
|
if (render) {
|
|
359
|
-
renderManagerSrv.
|
|
359
|
+
renderManagerSrv.getRenderUnitById(unitId).with(SheetSkeletonManagerService).setRowHeaderSize(render, subUnitId, size);
|
|
360
360
|
const { components } = render;
|
|
361
361
|
const renderComponent = components.get("__SpreadsheetRowHeader__");
|
|
362
362
|
if (renderComponent) renderComponent.setCustomHeader({ headerStyle: { size } }, subUnitId);
|
|
@@ -372,9 +372,9 @@ const SetColumnHeaderHeightCommand = {
|
|
|
372
372
|
const renderManagerSrv = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
373
373
|
if (!renderManagerSrv) return false;
|
|
374
374
|
const { unitId, subUnitId, size } = params;
|
|
375
|
-
const render = renderManagerSrv.
|
|
375
|
+
const render = renderManagerSrv.getRenderUnitById(unitId);
|
|
376
376
|
if (render) {
|
|
377
|
-
renderManagerSrv.
|
|
377
|
+
renderManagerSrv.getRenderUnitById(unitId).with(SheetSkeletonManagerService).setColumnHeaderSize(render, subUnitId, size);
|
|
378
378
|
const { components } = render;
|
|
379
379
|
const renderComponent = components.get("__SpreadsheetColumnHeader__");
|
|
380
380
|
if (renderComponent) renderComponent.setCustomHeader({ headerStyle: { size } }, subUnitId);
|
|
@@ -494,10 +494,6 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
494
494
|
/**
|
|
495
495
|
* Reset this._selectionStyle to default normal selection style
|
|
496
496
|
*/
|
|
497
|
-
/** @deprecated This should not be provided by the selection render service. */
|
|
498
|
-
getViewPort() {
|
|
499
|
-
return this._activeViewport;
|
|
500
|
-
}
|
|
501
497
|
setSingleSelectionEnabled(enabled = false) {
|
|
502
498
|
this._singleSelectionEnabled = enabled;
|
|
503
499
|
}
|
|
@@ -608,7 +604,7 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
608
604
|
}
|
|
609
605
|
_getFreeze() {
|
|
610
606
|
var _this$_sheetSkeletonM;
|
|
611
|
-
return (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton.
|
|
607
|
+
return (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton.worksheet.getFreeze();
|
|
612
608
|
}
|
|
613
609
|
_getViewportByCell(row, column) {
|
|
614
610
|
if (row === void 0 || column === void 0) return null;
|
|
@@ -769,12 +765,6 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
769
765
|
});
|
|
770
766
|
});
|
|
771
767
|
}
|
|
772
|
-
/**
|
|
773
|
-
* @deprecated Please use `getCellWithCoordByOffset` instead.
|
|
774
|
-
*/
|
|
775
|
-
getSelectionCellByPosition(x, y) {
|
|
776
|
-
return this.getCellWithCoordByOffset(x, y);
|
|
777
|
-
}
|
|
778
768
|
getCellWithCoordByOffset(x, y, skeletonParam) {
|
|
779
769
|
const scene = this._scene;
|
|
780
770
|
const skeleton = skeletonParam !== null && skeletonParam !== void 0 ? skeletonParam : this._skeleton;
|
|
@@ -984,7 +974,7 @@ function genSelectionByRange(skeleton, range) {
|
|
|
984
974
|
}
|
|
985
975
|
|
|
986
976
|
//#endregion
|
|
987
|
-
//#region \0@oxc-project+runtime@0.
|
|
977
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
988
978
|
function __decorateParam(paramIndex, decorator) {
|
|
989
979
|
return function(target, key) {
|
|
990
980
|
decorator(target, key, paramIndex);
|
|
@@ -992,7 +982,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
992
982
|
}
|
|
993
983
|
|
|
994
984
|
//#endregion
|
|
995
|
-
//#region \0@oxc-project+runtime@0.
|
|
985
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
996
986
|
function __decorate(decorators, target, key, desc) {
|
|
997
987
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
998
988
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1218,7 +1208,7 @@ var SelectionShapeExtension = class {
|
|
|
1218
1208
|
}
|
|
1219
1209
|
_getFreeze() {
|
|
1220
1210
|
var _withCurrentTypeOfRen;
|
|
1221
|
-
return (_withCurrentTypeOfRen = (0, _univerjs_engine_render.withCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_SHEET, SheetSkeletonManagerService, this._injector.get(_univerjs_core.IUniverInstanceService), this._injector.get(_univerjs_engine_render.IRenderManagerService))) === null || _withCurrentTypeOfRen === void 0 || (_withCurrentTypeOfRen = _withCurrentTypeOfRen.getCurrentParam()) === null || _withCurrentTypeOfRen === void 0 ? void 0 : _withCurrentTypeOfRen.skeleton.
|
|
1211
|
+
return (_withCurrentTypeOfRen = (0, _univerjs_engine_render.withCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_SHEET, SheetSkeletonManagerService, this._injector.get(_univerjs_core.IUniverInstanceService), this._injector.get(_univerjs_engine_render.IRenderManagerService))) === null || _withCurrentTypeOfRen === void 0 || (_withCurrentTypeOfRen = _withCurrentTypeOfRen.getCurrentParam()) === null || _withCurrentTypeOfRen === void 0 ? void 0 : _withCurrentTypeOfRen.skeleton.worksheet.getFreeze();
|
|
1222
1212
|
}
|
|
1223
1213
|
_isSelectionInViewport(selection, viewport) {
|
|
1224
1214
|
const freeze = this._getFreeze() || {
|
|
@@ -2241,29 +2231,6 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
2241
2231
|
this._updateControlCoord();
|
|
2242
2232
|
}
|
|
2243
2233
|
/**
|
|
2244
|
-
* Update selection model with new range & primary cell(aka: highlight/current), also update row/col selection size & style.
|
|
2245
|
-
*
|
|
2246
|
-
* @deprecated use `updateRangeBySelectionWithCoord` and `updateStyle` to do same thing.
|
|
2247
|
-
*
|
|
2248
|
-
* @param newSelectionRange
|
|
2249
|
-
* @param rowHeaderWidth
|
|
2250
|
-
* @param columnHeaderHeight
|
|
2251
|
-
* @param style
|
|
2252
|
-
* @param primaryCell primary cell
|
|
2253
|
-
*/
|
|
2254
|
-
update(newSelectionRange, rowHeaderWidth = 0, columnHeaderHeight = 0, style, primaryCell) {
|
|
2255
|
-
this._rowHeaderWidth = rowHeaderWidth;
|
|
2256
|
-
this._columnHeaderHeight = columnHeaderHeight;
|
|
2257
|
-
this._rowHeaderOffsetX = 0;
|
|
2258
|
-
this._columnHeaderOffsetY = 0;
|
|
2259
|
-
this.updateRangeBySelectionWithCoord({
|
|
2260
|
-
rangeWithCoord: newSelectionRange,
|
|
2261
|
-
primaryWithCoord: primaryCell,
|
|
2262
|
-
style
|
|
2263
|
-
});
|
|
2264
|
-
if (style) this.updateStyle(style);
|
|
2265
|
-
}
|
|
2266
|
-
/**
|
|
2267
2234
|
* Update primary range.
|
|
2268
2235
|
* highlight cell would update if primary cell has value.
|
|
2269
2236
|
* highlight cell would be cleared if primary cell is null.
|
|
@@ -2660,7 +2627,7 @@ let MarkSelectionService = class MarkSelectionService extends _univerjs_core.Dis
|
|
|
2660
2627
|
const { unitId, subUnitId, selection, control: oldControl, zIndex } = shape;
|
|
2661
2628
|
oldControl === null || oldControl === void 0 || oldControl.dispose();
|
|
2662
2629
|
if (unitId !== currentUnitId || subUnitId !== currentSubUnitId) return;
|
|
2663
|
-
const renderUnit = this._renderManagerService.
|
|
2630
|
+
const renderUnit = this._renderManagerService.getRenderUnitById(unitId);
|
|
2664
2631
|
if (!renderUnit) return;
|
|
2665
2632
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, subUnitId);
|
|
2666
2633
|
if (!skeleton) return;
|
|
@@ -2945,7 +2912,6 @@ function convertToCellStyle(cell, dataStream, textRuns) {
|
|
|
2945
2912
|
s: textRuns[0].ts
|
|
2946
2913
|
};
|
|
2947
2914
|
else return cell;
|
|
2948
|
-
return cell;
|
|
2949
2915
|
}
|
|
2950
2916
|
|
|
2951
2917
|
//#endregion
|
|
@@ -3405,13 +3371,12 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3405
3371
|
let cellText = "";
|
|
3406
3372
|
let cellRichStyle;
|
|
3407
3373
|
if (/<[^>]+>/.test(cellHtml) && skeleton) {
|
|
3408
|
-
var _skeleton$getBlankCel;
|
|
3409
3374
|
const newDocBody = {
|
|
3410
3375
|
dataStream: "",
|
|
3411
3376
|
textRuns: []
|
|
3412
3377
|
};
|
|
3413
3378
|
this._parseCellHtml(null, cell.childNodes, newDocBody, void 0, styleStr);
|
|
3414
|
-
const documentModel = (
|
|
3379
|
+
const documentModel = (0, _univerjs_core.createDocumentModelWithStyle)("", {});
|
|
3415
3380
|
const p = documentModel === null || documentModel === void 0 ? void 0 : documentModel.getSnapshot();
|
|
3416
3381
|
const singleDataStream = `${newDocBody.dataStream}\r\n`;
|
|
3417
3382
|
const documentData = {
|
|
@@ -3432,11 +3397,8 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3432
3397
|
};
|
|
3433
3398
|
}
|
|
3434
3399
|
_generateDocumentDataModelSnapshot(snapshot) {
|
|
3435
|
-
|
|
3436
|
-
const
|
|
3437
|
-
if (currentSkeleton == null) return null;
|
|
3438
|
-
const { skeleton } = currentSkeleton;
|
|
3439
|
-
const documentModel = (_skeleton$getBlankCel2 = skeleton.getBlankCellDocumentModel()) === null || _skeleton$getBlankCel2 === void 0 ? void 0 : _skeleton$getBlankCel2.documentModel;
|
|
3400
|
+
if (this._getCurrentSkeleton() == null) return null;
|
|
3401
|
+
const documentModel = (0, _univerjs_core.createDocumentModelWithStyle)("", {});
|
|
3440
3402
|
const documentData = {
|
|
3441
3403
|
...documentModel === null || documentModel === void 0 ? void 0 : documentModel.getSnapshot(),
|
|
3442
3404
|
...snapshot
|
|
@@ -4250,7 +4212,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4250
4212
|
return this._clipboardHooks;
|
|
4251
4213
|
}
|
|
4252
4214
|
_generateCopyContent(unitId, subUnitId, range, hooks, copyHookType = PREDEFINED_HOOK_NAME_COPY.DEFAULT_COPY) {
|
|
4253
|
-
const workbook = this._univerInstanceService.
|
|
4215
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
4254
4216
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
4255
4217
|
if (!workbook || !worksheet) return null;
|
|
4256
4218
|
const filteredRows = hooks.reduce((acc, cur) => {
|
|
@@ -4455,7 +4417,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4455
4417
|
if (!cellMatrix) return false;
|
|
4456
4418
|
const pasteTarget = this._getPastedRange(cellMatrix);
|
|
4457
4419
|
if (!pasteTarget) return false;
|
|
4458
|
-
const worksheet = (_this$_univerInstance = this._univerInstanceService.
|
|
4420
|
+
const worksheet = (_this$_univerInstance = this._univerInstanceService.getUnit(pasteTarget.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getSheetBySheetId(pasteTarget.subUnitId);
|
|
4459
4421
|
if (!worksheet) return false;
|
|
4460
4422
|
const mergeData = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getMergeData();
|
|
4461
4423
|
if (mergeData.length) {
|
|
@@ -4485,7 +4447,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4485
4447
|
const { range, matrix: cachedMatrix, unitId: copyUnitId, subUnitId: copySubUnitId } = cachedData || {};
|
|
4486
4448
|
if (!cachedMatrix || !cachedData || !range || !copyUnitId || !copySubUnitId) return false;
|
|
4487
4449
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
4488
|
-
const worksheet = (_this$_univerInstance2 = this._univerInstanceService.
|
|
4450
|
+
const worksheet = (_this$_univerInstance2 = this._univerInstanceService.getUnit(copyUnitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance2 === void 0 ? void 0 : _this$_univerInstance2.getSheetBySheetId(copySubUnitId);
|
|
4489
4451
|
const cellMatrix = new _univerjs_core.ObjectMatrix();
|
|
4490
4452
|
cachedMatrix.forValue((row, col, value) => {
|
|
4491
4453
|
const { row: actualRow, col: actualColumn } = mapFunc(row, col);
|
|
@@ -4508,7 +4470,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4508
4470
|
});
|
|
4509
4471
|
const pasteTarget = this._getPastedRange(cellMatrix);
|
|
4510
4472
|
if (!pasteTarget) return false;
|
|
4511
|
-
const pasteToWorksheet = (_this$_univerInstance3 = this._univerInstanceService.
|
|
4473
|
+
const pasteToWorksheet = (_this$_univerInstance3 = this._univerInstanceService.getUnit(pasteTarget.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance3 === void 0 ? void 0 : _this$_univerInstance3.getSheetBySheetId(pasteTarget.subUnitId);
|
|
4512
4474
|
if (!pasteToWorksheet) return false;
|
|
4513
4475
|
const mergeData = pasteToWorksheet === null || pasteToWorksheet === void 0 ? void 0 : pasteToWorksheet.getMergeData();
|
|
4514
4476
|
if (mergeData) {
|
|
@@ -4684,7 +4646,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4684
4646
|
var _this$_univerInstance4, _this$_renderManagerS;
|
|
4685
4647
|
const worksheet = (_this$_univerInstance4 = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance4 === void 0 ? void 0 : _this$_univerInstance4.getSheetBySheetId(subUnitId);
|
|
4686
4648
|
if (!worksheet) return null;
|
|
4687
|
-
const skeleton = (_this$_renderManagerS = this._renderManagerService.
|
|
4649
|
+
const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
4688
4650
|
if (!skeleton) return null;
|
|
4689
4651
|
const rowManager = worksheet.getRowManager();
|
|
4690
4652
|
const defaultRowHeight = worksheet.getConfig().defaultRowHeight;
|
|
@@ -4724,7 +4686,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4724
4686
|
}
|
|
4725
4687
|
_getSetSelectionOperation(unitId, subUnitId, range, cellMatrix, pasteType) {
|
|
4726
4688
|
var _this$_univerInstance5;
|
|
4727
|
-
const worksheet = (_this$_univerInstance5 = this._univerInstanceService.
|
|
4689
|
+
const worksheet = (_this$_univerInstance5 = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance5 === void 0 ? void 0 : _this$_univerInstance5.getSheetBySheetId(subUnitId);
|
|
4728
4690
|
if (!worksheet) return null;
|
|
4729
4691
|
const { rows, cols } = range;
|
|
4730
4692
|
const startRow = rows[0];
|
|
@@ -4916,7 +4878,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4916
4878
|
if (rowCount <= 0 || colCount <= 0) return null;
|
|
4917
4879
|
const pasteSelectionRangeRowLen = discreteRange.rows.length;
|
|
4918
4880
|
const pasteSelectionRangeColLen = discreteRange.cols.length;
|
|
4919
|
-
const worksheet = (_this$_univerInstance6 = this._univerInstanceService.
|
|
4881
|
+
const worksheet = (_this$_univerInstance6 = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance6 === void 0 ? void 0 : _this$_univerInstance6.getSheetBySheetId(subUnitId);
|
|
4920
4882
|
if (!worksheet) return null;
|
|
4921
4883
|
const mergeData = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getMergeData();
|
|
4922
4884
|
if (pasteSelectionRangeRowLen % rowCount === 0 && pasteSelectionRangeColLen % colCount === 0) {
|
|
@@ -4943,7 +4905,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4943
4905
|
}
|
|
4944
4906
|
_expandOrShrinkRowsCols(unitId, subUnitId, range, colCount, rowCount) {
|
|
4945
4907
|
const { rows, cols } = range;
|
|
4946
|
-
const workbook = this._univerInstanceService.
|
|
4908
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
4947
4909
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
4948
4910
|
let newRows;
|
|
4949
4911
|
let newCols;
|
|
@@ -5241,7 +5203,7 @@ const DeleteRangeMoveLeftConfirmCommand = {
|
|
|
5241
5203
|
};
|
|
5242
5204
|
const getRowLength = (range) => range.endRow - range.startRow;
|
|
5243
5205
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
5244
|
-
const interSectedRange = _univerjs_core.
|
|
5206
|
+
const interSectedRange = (0, _univerjs_core.getIntersectRange)(mergeRange, range);
|
|
5245
5207
|
return interSectedRange ? getRowLength(mergeRange) > getRowLength(interSectedRange) : false;
|
|
5246
5208
|
})) return commandService.executeCommand(_univerjs_sheets.DeleteRangeMoveLeftCommand.id);
|
|
5247
5209
|
if (await confirmService.confirm({
|
|
@@ -5287,7 +5249,7 @@ const DeleteRangeMoveUpConfirmCommand = {
|
|
|
5287
5249
|
}
|
|
5288
5250
|
const getColLength = (range) => range.endColumn - range.startColumn;
|
|
5289
5251
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
5290
|
-
const interSectedRange = _univerjs_core.
|
|
5252
|
+
const interSectedRange = (0, _univerjs_core.getIntersectRange)(mergeRange, range);
|
|
5291
5253
|
return interSectedRange ? getColLength(mergeRange) > getColLength(interSectedRange) : false;
|
|
5292
5254
|
})) return commandService.executeCommand(_univerjs_sheets.DeleteRangeMoveUpCommand.id);
|
|
5293
5255
|
if (await confirmService.confirm({
|
|
@@ -5977,7 +5939,7 @@ const InsertRangeMoveDownConfirmCommand = {
|
|
|
5977
5939
|
}
|
|
5978
5940
|
const getColLength = (range) => range.endColumn - range.startColumn;
|
|
5979
5941
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
5980
|
-
const interSectedRange = _univerjs_core.
|
|
5942
|
+
const interSectedRange = (0, _univerjs_core.getIntersectRange)(mergeRange, range);
|
|
5981
5943
|
return interSectedRange ? getColLength(mergeRange) > getColLength(interSectedRange) : false;
|
|
5982
5944
|
})) return commandService.executeCommand(_univerjs_sheets.InsertRangeMoveDownCommand.id);
|
|
5983
5945
|
if (await confirmService.confirm({
|
|
@@ -6015,7 +5977,7 @@ const InsertRangeMoveRightConfirmCommand = {
|
|
|
6015
5977
|
};
|
|
6016
5978
|
const getRowLength = (range) => range.endRow - range.startRow;
|
|
6017
5979
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
6018
|
-
const interSectedRange = _univerjs_core.
|
|
5980
|
+
const interSectedRange = (0, _univerjs_core.getIntersectRange)(mergeRange, range);
|
|
6019
5981
|
return interSectedRange ? getRowLength(mergeRange) > getRowLength(interSectedRange) : false;
|
|
6020
5982
|
})) return commandService.executeCommand(_univerjs_sheets.InsertRangeMoveRightCommand.id);
|
|
6021
5983
|
if (await confirmService.confirm({
|
|
@@ -6732,7 +6694,7 @@ const SetSelectionFrozenCommand = {
|
|
|
6732
6694
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
6733
6695
|
const selections = accessor.get(_univerjs_sheets.SheetsSelectionsService).getCurrentSelections();
|
|
6734
6696
|
if (!selections) return false;
|
|
6735
|
-
const { sheetViewStartRow = 0, sheetViewStartColumn = 0 } = accessor.get(_univerjs_engine_render.IRenderManagerService).
|
|
6697
|
+
const { sheetViewStartRow = 0, sheetViewStartColumn = 0 } = accessor.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(unitId).with(SheetScrollManagerService).getCurrentScrollState() || {};
|
|
6736
6698
|
let startRow;
|
|
6737
6699
|
let startColumn;
|
|
6738
6700
|
let freezedRowCount;
|
|
@@ -7083,7 +7045,7 @@ const MoveSelectionEnterAndTabCommand = {
|
|
|
7083
7045
|
reveal: true,
|
|
7084
7046
|
extra: params.extra
|
|
7085
7047
|
});
|
|
7086
|
-
const selectionService = (_renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService).
|
|
7048
|
+
const selectionService = (_renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(ISheetSelectionRenderService);
|
|
7087
7049
|
selectionService === null || selectionService === void 0 || selectionService.refreshSelectionMoveEnd();
|
|
7088
7050
|
return rs;
|
|
7089
7051
|
}
|
|
@@ -7217,7 +7179,7 @@ function getSheetObject(univerInstanceService, renderManagerService) {
|
|
|
7217
7179
|
const unitId = workbook.getUnitId();
|
|
7218
7180
|
let components, mainComponent, scene, engine;
|
|
7219
7181
|
if (isRenderManagerService(renderManagerService)) {
|
|
7220
|
-
const currentRender = renderManagerService.
|
|
7182
|
+
const currentRender = renderManagerService.getRenderUnitById(unitId);
|
|
7221
7183
|
if (currentRender == null) return null;
|
|
7222
7184
|
components = currentRender.components;
|
|
7223
7185
|
components = currentRender.components;
|
|
@@ -7554,9 +7516,7 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends _u
|
|
|
7554
7516
|
}
|
|
7555
7517
|
_getFreeze() {
|
|
7556
7518
|
var _this$_sheetSkeletonM4;
|
|
7557
|
-
|
|
7558
|
-
if (snapshot == null) return;
|
|
7559
|
-
return snapshot.freeze;
|
|
7519
|
+
return (_this$_sheetSkeletonM4 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM4 === void 0 ? void 0 : _this$_sheetSkeletonM4.skeleton.worksheet.getFreeze();
|
|
7560
7520
|
}
|
|
7561
7521
|
_getSheetObject() {
|
|
7562
7522
|
return getSheetObject(this._context.unit, this._context);
|
|
@@ -7693,8 +7653,8 @@ const SetScrollOperation = {
|
|
|
7693
7653
|
if (!params) return false;
|
|
7694
7654
|
const { unitId, sheetId, offsetX = 0, offsetY = 0, sheetViewStartColumn, sheetViewStartRow, duration, screenRatioX, screenRatioY } = params;
|
|
7695
7655
|
const renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
7696
|
-
const scrollManagerService = renderManagerService.
|
|
7697
|
-
const renderUnit = renderManagerService.
|
|
7656
|
+
const scrollManagerService = renderManagerService.getRenderUnitById(unitId).with(SheetScrollManagerService);
|
|
7657
|
+
const renderUnit = renderManagerService.getRenderUnitById(unitId);
|
|
7698
7658
|
if (!renderUnit) return false;
|
|
7699
7659
|
const engine = renderUnit.engine;
|
|
7700
7660
|
const canvasWidth = engine.width;
|
|
@@ -7731,7 +7691,7 @@ const SetScrollRelativeCommand = {
|
|
|
7731
7691
|
const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService);
|
|
7732
7692
|
if (!target) return false;
|
|
7733
7693
|
const { unitId, subUnitId } = target;
|
|
7734
|
-
const currentScroll = renderManagerSrv.
|
|
7694
|
+
const currentScroll = renderManagerSrv.getRenderUnitById(unitId).with(SheetScrollManagerService).getCurrentScrollState();
|
|
7735
7695
|
const { offsetX = 0, offsetY = 0 } = params || {};
|
|
7736
7696
|
const { sheetViewStartRow = 0, sheetViewStartColumn = 0, offsetX: currentOffsetX = 0, offsetY: currentOffsetY = 0 } = currentScroll || {};
|
|
7737
7697
|
return commandService.executeCommand(SetScrollOperation.id, {
|
|
@@ -7759,7 +7719,7 @@ const ScrollCommand = {
|
|
|
7759
7719
|
const target = params.unitId ? getScrollCommandTargetByParams(univerInstanceService, params) : (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService);
|
|
7760
7720
|
if (!target) return false;
|
|
7761
7721
|
const { workbook, worksheet, unitId } = target;
|
|
7762
|
-
const renderUnit = renderManagerSrv.
|
|
7722
|
+
const renderUnit = renderManagerSrv.getRenderUnitById(unitId);
|
|
7763
7723
|
if (!renderUnit) return false;
|
|
7764
7724
|
const currentScroll = renderUnit.with(SheetScrollManagerService).getCurrentScrollState();
|
|
7765
7725
|
if (!worksheet) return false;
|
|
@@ -7797,7 +7757,7 @@ const ScrollToCellCommand = {
|
|
|
7797
7757
|
type: _univerjs_core.CommandType.COMMAND,
|
|
7798
7758
|
handler: (accessor, params) => {
|
|
7799
7759
|
const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
7800
|
-
return accessor.get(_univerjs_engine_render.IRenderManagerService).
|
|
7760
|
+
return accessor.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).getUnitId()).with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
|
|
7801
7761
|
}
|
|
7802
7762
|
};
|
|
7803
7763
|
/**
|
|
@@ -7851,7 +7811,7 @@ let AutoWidthController = class AutoWidthController extends _univerjs_core.Dispo
|
|
|
7851
7811
|
const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService, params);
|
|
7852
7812
|
if (!target) return defaultValue;
|
|
7853
7813
|
const { unitId, subUnitId, worksheet } = target;
|
|
7854
|
-
const sheetSkeletonService = this._renderManagerService.
|
|
7814
|
+
const sheetSkeletonService = this._renderManagerService.getRenderUnitById(unitId).with(SheetSkeletonManagerService);
|
|
7855
7815
|
if (!sheetSkeletonService.getCurrentParam()) return defaultValue;
|
|
7856
7816
|
const { skeleton } = sheetSkeletonService.getCurrentParam();
|
|
7857
7817
|
const colsAutoWidthInfo = skeleton.calculateAutoWidthInRange(params.ranges);
|
|
@@ -7915,6 +7875,162 @@ const SetWorksheetColAutoWidthCommand = {
|
|
|
7915
7875
|
}
|
|
7916
7876
|
};
|
|
7917
7877
|
|
|
7878
|
+
//#endregion
|
|
7879
|
+
//#region src/common/utils.ts
|
|
7880
|
+
function getUserListEqual(userList1, userList2) {
|
|
7881
|
+
if (userList1.length !== userList2.length) return false;
|
|
7882
|
+
const sorted1 = userList1.sort((a, b) => a.id.localeCompare(b.id));
|
|
7883
|
+
const sorted2 = userList2.sort((a, b) => a.id.localeCompare(b.id));
|
|
7884
|
+
return sorted1.every((user, index) => {
|
|
7885
|
+
var _user$subject, _sorted2$index$subjec;
|
|
7886
|
+
return ((_user$subject = user.subject) === null || _user$subject === void 0 ? void 0 : _user$subject.userID) === ((_sorted2$index$subjec = sorted2[index].subject) === null || _sorted2$index$subjec === void 0 ? void 0 : _sorted2$index$subjec.userID) && user.role === sorted2[index].role;
|
|
7887
|
+
});
|
|
7888
|
+
}
|
|
7889
|
+
function checkCellContentInRanges(worksheet, ranges) {
|
|
7890
|
+
return ranges.some((range) => checkCellContentInRange(worksheet, range));
|
|
7891
|
+
}
|
|
7892
|
+
function checkCellContentInRange(worksheet, range) {
|
|
7893
|
+
const { startRow, startColumn, endColumn, endRow } = range;
|
|
7894
|
+
const cellMatrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn);
|
|
7895
|
+
let someCellGoingToBeRemoved = false;
|
|
7896
|
+
cellMatrix.forValue((row, col, cellData) => {
|
|
7897
|
+
if (cellData && (row !== startRow || col !== startColumn) && worksheet.cellHasValue(cellData)) {
|
|
7898
|
+
someCellGoingToBeRemoved = true;
|
|
7899
|
+
return false;
|
|
7900
|
+
}
|
|
7901
|
+
});
|
|
7902
|
+
return someCellGoingToBeRemoved;
|
|
7903
|
+
}
|
|
7904
|
+
function getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton) {
|
|
7905
|
+
const activeViewport = scene.getActiveViewportByCoord(_univerjs_engine_render.Vector2.FromArray([offsetX, offsetY]));
|
|
7906
|
+
if (!activeViewport) return;
|
|
7907
|
+
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7908
|
+
const scrollXY = {
|
|
7909
|
+
x: activeViewport.viewportScrollX,
|
|
7910
|
+
y: activeViewport.viewportScrollY
|
|
7911
|
+
};
|
|
7912
|
+
const cellIndex = skeleton.getCellIndexByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
7913
|
+
const mergeCell = skeleton.worksheet.getMergedCell(cellIndex.row, cellIndex.column);
|
|
7914
|
+
return {
|
|
7915
|
+
actualRow: mergeCell ? mergeCell.startRow : cellIndex.row,
|
|
7916
|
+
actualCol: mergeCell ? mergeCell.startColumn : cellIndex.column,
|
|
7917
|
+
mergeCell,
|
|
7918
|
+
row: cellIndex.row,
|
|
7919
|
+
col: cellIndex.column
|
|
7920
|
+
};
|
|
7921
|
+
}
|
|
7922
|
+
function getViewportByCell(row, column, scene, worksheet) {
|
|
7923
|
+
const freeze = worksheet.getFreeze();
|
|
7924
|
+
if (!freeze || freeze.startRow <= 0 && freeze.startColumn <= 0) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7925
|
+
if (row >= freeze.startRow && column >= freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7926
|
+
if (row < freeze.startRow && column < freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP);
|
|
7927
|
+
if (row < freeze.startRow && column >= freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP);
|
|
7928
|
+
if (row >= freeze.startRow && column < freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT);
|
|
7929
|
+
}
|
|
7930
|
+
function transformBound2OffsetBound(originBound, scene, skeleton, worksheet) {
|
|
7931
|
+
const topLeft = transformPosition2Offset(originBound.left, originBound.top, scene, skeleton, worksheet);
|
|
7932
|
+
const bottomRight = transformPosition2Offset(originBound.right, originBound.bottom, scene, skeleton, worksheet);
|
|
7933
|
+
return {
|
|
7934
|
+
left: topLeft.x,
|
|
7935
|
+
top: topLeft.y,
|
|
7936
|
+
right: bottomRight.x,
|
|
7937
|
+
bottom: bottomRight.y
|
|
7938
|
+
};
|
|
7939
|
+
}
|
|
7940
|
+
function transformPosition2Offset(x, y, scene, skeleton, worksheet) {
|
|
7941
|
+
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7942
|
+
const viewMain = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7943
|
+
if (!viewMain) return {
|
|
7944
|
+
x,
|
|
7945
|
+
y
|
|
7946
|
+
};
|
|
7947
|
+
const { startColumn, startRow, xSplit, ySplit } = worksheet.getFreeze();
|
|
7948
|
+
const startSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow - ySplit, startColumn - xSplit, false);
|
|
7949
|
+
const endSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow, startColumn, false);
|
|
7950
|
+
const { rowHeaderWidth, columnHeaderHeight } = skeleton;
|
|
7951
|
+
const freezeWidth = endSheetView.startX - startSheetView.startX;
|
|
7952
|
+
const freezeHeight = endSheetView.startY - startSheetView.startY;
|
|
7953
|
+
const { top, left, viewportScrollX, viewportScrollY } = viewMain;
|
|
7954
|
+
let offsetX;
|
|
7955
|
+
if (x > left) offsetX = (x - viewportScrollX) * scaleX;
|
|
7956
|
+
else offsetX = (freezeWidth + rowHeaderWidth - (left - x)) * scaleX;
|
|
7957
|
+
let offsetY;
|
|
7958
|
+
if (y > top) offsetY = (y - viewportScrollY) * scaleY;
|
|
7959
|
+
else offsetY = (freezeHeight + columnHeaderHeight - (top - y)) * scaleX;
|
|
7960
|
+
return {
|
|
7961
|
+
x: offsetX,
|
|
7962
|
+
y: offsetY
|
|
7963
|
+
};
|
|
7964
|
+
}
|
|
7965
|
+
function getCellRealRange(workbook, worksheet, skeleton, row, col) {
|
|
7966
|
+
let actualRow = row;
|
|
7967
|
+
let actualCol = col;
|
|
7968
|
+
skeleton.overflowCache.forValue((r, c, range) => {
|
|
7969
|
+
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
7970
|
+
actualCol = c;
|
|
7971
|
+
actualRow = r;
|
|
7972
|
+
}
|
|
7973
|
+
});
|
|
7974
|
+
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
7975
|
+
return {
|
|
7976
|
+
unitId: workbook.getUnitId(),
|
|
7977
|
+
subUnitId: worksheet.getSheetId(),
|
|
7978
|
+
workbook,
|
|
7979
|
+
worksheet,
|
|
7980
|
+
row: actualCell.actualRow,
|
|
7981
|
+
col: actualCell.actualColumn
|
|
7982
|
+
};
|
|
7983
|
+
}
|
|
7984
|
+
function getHoverCellPosition(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY) {
|
|
7985
|
+
const { scene } = currentRender;
|
|
7986
|
+
const unitId = workbook.getUnitId();
|
|
7987
|
+
const { skeleton, sheetId } = skeletonParam;
|
|
7988
|
+
const cellIndex = getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton);
|
|
7989
|
+
if (!cellIndex) return null;
|
|
7990
|
+
let { actualCol, actualRow } = cellIndex;
|
|
7991
|
+
const originLocation = {
|
|
7992
|
+
unitId,
|
|
7993
|
+
subUnitId: sheetId,
|
|
7994
|
+
workbook,
|
|
7995
|
+
worksheet,
|
|
7996
|
+
row: actualRow,
|
|
7997
|
+
col: actualCol
|
|
7998
|
+
};
|
|
7999
|
+
skeleton.overflowCache.forValue((r, c, range) => {
|
|
8000
|
+
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
8001
|
+
actualCol = c;
|
|
8002
|
+
actualRow = r;
|
|
8003
|
+
}
|
|
8004
|
+
});
|
|
8005
|
+
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
8006
|
+
const location = getCellRealRange(workbook, worksheet, skeleton, actualRow, actualCol);
|
|
8007
|
+
let anchorCell;
|
|
8008
|
+
if (actualCell.mergeInfo) anchorCell = actualCell.mergeInfo;
|
|
8009
|
+
else anchorCell = {
|
|
8010
|
+
startRow: location.row,
|
|
8011
|
+
endRow: location.row,
|
|
8012
|
+
startColumn: location.col,
|
|
8013
|
+
endColumn: location.col
|
|
8014
|
+
};
|
|
8015
|
+
const activeViewport = scene.getActiveViewportByCoord(_univerjs_engine_render.Vector2.FromArray([offsetX, offsetY]));
|
|
8016
|
+
if (!activeViewport) return;
|
|
8017
|
+
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8018
|
+
const scrollXY = {
|
|
8019
|
+
x: activeViewport.viewportScrollX,
|
|
8020
|
+
y: activeViewport.viewportScrollY
|
|
8021
|
+
};
|
|
8022
|
+
return {
|
|
8023
|
+
position: {
|
|
8024
|
+
startX: (skeleton.getOffsetByColumn(anchorCell.startColumn - 1) - scrollXY.x) * scaleX,
|
|
8025
|
+
endX: (skeleton.getOffsetByColumn(anchorCell.endColumn) - scrollXY.x) * scaleX,
|
|
8026
|
+
startY: (skeleton.getOffsetByRow(anchorCell.startRow - 1) - scrollXY.y) * scaleY,
|
|
8027
|
+
endY: (skeleton.getOffsetByRow(anchorCell.endRow) - scrollXY.y) * scaleY
|
|
8028
|
+
},
|
|
8029
|
+
location: originLocation,
|
|
8030
|
+
overflowLocation: location
|
|
8031
|
+
};
|
|
8032
|
+
}
|
|
8033
|
+
|
|
7918
8034
|
//#endregion
|
|
7919
8035
|
//#region src/services/editor-bridge.service.ts
|
|
7920
8036
|
let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Disposable {
|
|
@@ -7988,15 +8104,16 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
7988
8104
|
if (!workbook || workbook.getUnitId() !== unitId) return;
|
|
7989
8105
|
const worksheet = workbook.getActiveSheet();
|
|
7990
8106
|
if (!worksheet || worksheet.getSheetId() !== sheetId) return;
|
|
7991
|
-
|
|
7992
|
-
if (!renderUnit) return;
|
|
8107
|
+
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
7993
8108
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, sheetId);
|
|
7994
8109
|
if (!skeleton) return;
|
|
7995
8110
|
const actualRangeWithCoord = (0, _univerjs_core.convertCellToRange)((0, _univerjs_sheets.attachPrimaryWithCoord)(skeleton, primary));
|
|
7996
8111
|
const canvasOffset = (0, _univerjs_docs_ui.getCanvasOffsetByEngine)(engine);
|
|
7997
8112
|
let { startX, startY, endX, endY } = actualRangeWithCoord;
|
|
7998
8113
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7999
|
-
const
|
|
8114
|
+
const viewport = getViewportByCell(primary.startRow, primary.startColumn, scene, worksheet);
|
|
8115
|
+
if (!viewport) return;
|
|
8116
|
+
const scrollXY = scene.getViewportScrollXY(viewport);
|
|
8000
8117
|
startX = (0, _univerjs_engine_render.convertTransformToOffsetX)(startX, scaleX, scrollXY);
|
|
8001
8118
|
startY = (0, _univerjs_engine_render.convertTransformToOffsetY)(startY, scaleY, scrollXY);
|
|
8002
8119
|
endX = (0, _univerjs_engine_render.convertTransformToOffsetX)(endX, scaleX, scrollXY);
|
|
@@ -8087,8 +8204,7 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
8087
8204
|
if (!workbook || workbook.getUnitId() !== unitId) return;
|
|
8088
8205
|
const worksheet = workbook.getActiveSheet();
|
|
8089
8206
|
if (!worksheet || worksheet.getSheetId() !== sheetId) return;
|
|
8090
|
-
|
|
8091
|
-
if (!renderUnit) return;
|
|
8207
|
+
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
8092
8208
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, sheetId);
|
|
8093
8209
|
if (!skeleton) return;
|
|
8094
8210
|
const { startRow, startColumn } = primary;
|
|
@@ -8096,7 +8212,9 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
8096
8212
|
const canvasOffset = (0, _univerjs_docs_ui.getCanvasOffsetByEngine)(engine);
|
|
8097
8213
|
let { startX, startY, endX, endY } = actualRangeWithCoord;
|
|
8098
8214
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8099
|
-
const
|
|
8215
|
+
const viewport = getViewportByCell(startRow, startColumn, scene, worksheet);
|
|
8216
|
+
if (!viewport) return;
|
|
8217
|
+
const scrollXY = scene.getViewportScrollXY(viewport);
|
|
8100
8218
|
startX = (0, _univerjs_engine_render.convertTransformToOffsetX)(startX, scaleX, scrollXY);
|
|
8101
8219
|
startY = (0, _univerjs_engine_render.convertTransformToOffsetY)(startY, scaleY, scrollXY);
|
|
8102
8220
|
endX = (0, _univerjs_engine_render.convertTransformToOffsetX)(endX, scaleX, scrollXY);
|
|
@@ -8278,7 +8396,7 @@ const SetZoomRatioOperation = {
|
|
|
8278
8396
|
id: "sheet.operation.set-zoom-ratio",
|
|
8279
8397
|
type: _univerjs_core.CommandType.OPERATION,
|
|
8280
8398
|
handler: (accessor, params) => {
|
|
8281
|
-
const renderUnit = accessor.get(_univerjs_engine_render.IRenderManagerService).
|
|
8399
|
+
const renderUnit = accessor.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(params.unitId);
|
|
8282
8400
|
if (!renderUnit) return false;
|
|
8283
8401
|
return renderUnit.with(SheetsZoomRenderController).updateZoom(params.subUnitId, params.zoomRatio);
|
|
8284
8402
|
}
|
|
@@ -8463,7 +8581,6 @@ const SHEETS_UI_PLUGIN_CONFIG_KEY = "sheets-ui.config";
|
|
|
8463
8581
|
const configSymbol = Symbol(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
8464
8582
|
const defaultPluginConfig = {
|
|
8465
8583
|
formulaBar: true,
|
|
8466
|
-
statusBarStatistic: true,
|
|
8467
8584
|
protectedRangeShadow: true,
|
|
8468
8585
|
maxAutoHeightCount: 1e3
|
|
8469
8586
|
};
|
|
@@ -8516,8 +8633,6 @@ const SetCellEditVisibleWithF2Operation = {
|
|
|
8516
8633
|
/**
|
|
8517
8634
|
* When the editor is not clicked to change the cursor,
|
|
8518
8635
|
* the arrow keys will exit editing and move the cell.
|
|
8519
|
-
*
|
|
8520
|
-
* @deprecated Should not use operation as an event.
|
|
8521
8636
|
*/
|
|
8522
8637
|
const SetCellEditVisibleArrowOperation = {
|
|
8523
8638
|
id: "sheet.operation.set-cell-edit-visible-arrow",
|
|
@@ -8549,7 +8664,7 @@ const ScrollToRangeOperation = {
|
|
|
8549
8664
|
const renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
8550
8665
|
const unitId = (_params$unitId = params.unitId) !== null && _params$unitId !== void 0 ? _params$unitId : (_instanceService$getC = instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _instanceService$getC === void 0 ? void 0 : _instanceService$getC.getUnitId();
|
|
8551
8666
|
if (!unitId) return false;
|
|
8552
|
-
const renderUnit = renderManagerService.
|
|
8667
|
+
const renderUnit = renderManagerService.getRenderUnitById(unitId);
|
|
8553
8668
|
if (!renderUnit) return false;
|
|
8554
8669
|
return renderUnit.with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
|
|
8555
8670
|
}
|
|
@@ -8568,7 +8683,6 @@ const SheetPermissionOpenDialogOperation = {
|
|
|
8568
8683
|
title: { title: "sheets-ui.permission.dialog.allowedPermissionType" },
|
|
8569
8684
|
children: { label: UNIVER_SHEET_PERMISSION_DIALOG },
|
|
8570
8685
|
width: 393,
|
|
8571
|
-
destroyOnClose: true,
|
|
8572
8686
|
onClose: () => dialogService.close(UNIVER_SHEET_PERMISSION_DIALOG_ID)
|
|
8573
8687
|
});
|
|
8574
8688
|
return true;
|
|
@@ -8624,162 +8738,6 @@ const SidebarDefinedNameOperation = {
|
|
|
8624
8738
|
}
|
|
8625
8739
|
};
|
|
8626
8740
|
|
|
8627
|
-
//#endregion
|
|
8628
|
-
//#region src/common/utils.ts
|
|
8629
|
-
function getUserListEqual(userList1, userList2) {
|
|
8630
|
-
if (userList1.length !== userList2.length) return false;
|
|
8631
|
-
const sorted1 = userList1.sort((a, b) => a.id.localeCompare(b.id));
|
|
8632
|
-
const sorted2 = userList2.sort((a, b) => a.id.localeCompare(b.id));
|
|
8633
|
-
return sorted1.every((user, index) => {
|
|
8634
|
-
var _user$subject, _sorted2$index$subjec;
|
|
8635
|
-
return ((_user$subject = user.subject) === null || _user$subject === void 0 ? void 0 : _user$subject.userID) === ((_sorted2$index$subjec = sorted2[index].subject) === null || _sorted2$index$subjec === void 0 ? void 0 : _sorted2$index$subjec.userID) && user.role === sorted2[index].role;
|
|
8636
|
-
});
|
|
8637
|
-
}
|
|
8638
|
-
function checkCellContentInRanges(worksheet, ranges) {
|
|
8639
|
-
return ranges.some((range) => checkCellContentInRange(worksheet, range));
|
|
8640
|
-
}
|
|
8641
|
-
function checkCellContentInRange(worksheet, range) {
|
|
8642
|
-
const { startRow, startColumn, endColumn, endRow } = range;
|
|
8643
|
-
const cellMatrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn);
|
|
8644
|
-
let someCellGoingToBeRemoved = false;
|
|
8645
|
-
cellMatrix.forValue((row, col, cellData) => {
|
|
8646
|
-
if (cellData && (row !== startRow || col !== startColumn) && worksheet.cellHasValue(cellData)) {
|
|
8647
|
-
someCellGoingToBeRemoved = true;
|
|
8648
|
-
return false;
|
|
8649
|
-
}
|
|
8650
|
-
});
|
|
8651
|
-
return someCellGoingToBeRemoved;
|
|
8652
|
-
}
|
|
8653
|
-
function getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton) {
|
|
8654
|
-
const activeViewport = scene.getActiveViewportByCoord(_univerjs_engine_render.Vector2.FromArray([offsetX, offsetY]));
|
|
8655
|
-
if (!activeViewport) return;
|
|
8656
|
-
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8657
|
-
const scrollXY = {
|
|
8658
|
-
x: activeViewport.viewportScrollX,
|
|
8659
|
-
y: activeViewport.viewportScrollY
|
|
8660
|
-
};
|
|
8661
|
-
const cellIndex = skeleton.getCellIndexByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
8662
|
-
const mergeCell = skeleton.worksheet.getMergedCell(cellIndex.row, cellIndex.column);
|
|
8663
|
-
return {
|
|
8664
|
-
actualRow: mergeCell ? mergeCell.startRow : cellIndex.row,
|
|
8665
|
-
actualCol: mergeCell ? mergeCell.startColumn : cellIndex.column,
|
|
8666
|
-
mergeCell,
|
|
8667
|
-
row: cellIndex.row,
|
|
8668
|
-
col: cellIndex.column
|
|
8669
|
-
};
|
|
8670
|
-
}
|
|
8671
|
-
function getViewportByCell(row, column, scene, worksheet) {
|
|
8672
|
-
const freeze = worksheet.getFreeze();
|
|
8673
|
-
if (!freeze || freeze.startRow <= 0 && freeze.startColumn <= 0) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
8674
|
-
if (row >= freeze.startRow && column >= freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
8675
|
-
if (row < freeze.startRow && column < freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP);
|
|
8676
|
-
if (row < freeze.startRow && column >= freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP);
|
|
8677
|
-
if (row >= freeze.startRow && column < freeze.startColumn) return scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT);
|
|
8678
|
-
}
|
|
8679
|
-
function transformBound2OffsetBound(originBound, scene, skeleton, worksheet) {
|
|
8680
|
-
const topLeft = transformPosition2Offset(originBound.left, originBound.top, scene, skeleton, worksheet);
|
|
8681
|
-
const bottomRight = transformPosition2Offset(originBound.right, originBound.bottom, scene, skeleton, worksheet);
|
|
8682
|
-
return {
|
|
8683
|
-
left: topLeft.x,
|
|
8684
|
-
top: topLeft.y,
|
|
8685
|
-
right: bottomRight.x,
|
|
8686
|
-
bottom: bottomRight.y
|
|
8687
|
-
};
|
|
8688
|
-
}
|
|
8689
|
-
function transformPosition2Offset(x, y, scene, skeleton, worksheet) {
|
|
8690
|
-
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8691
|
-
const viewMain = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
8692
|
-
if (!viewMain) return {
|
|
8693
|
-
x,
|
|
8694
|
-
y
|
|
8695
|
-
};
|
|
8696
|
-
const { startColumn, startRow, xSplit, ySplit } = worksheet.getFreeze();
|
|
8697
|
-
const startSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow - ySplit, startColumn - xSplit, false);
|
|
8698
|
-
const endSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow, startColumn, false);
|
|
8699
|
-
const { rowHeaderWidth, columnHeaderHeight } = skeleton;
|
|
8700
|
-
const freezeWidth = endSheetView.startX - startSheetView.startX;
|
|
8701
|
-
const freezeHeight = endSheetView.startY - startSheetView.startY;
|
|
8702
|
-
const { top, left, viewportScrollX, viewportScrollY } = viewMain;
|
|
8703
|
-
let offsetX;
|
|
8704
|
-
if (x > left) offsetX = (x - viewportScrollX) * scaleX;
|
|
8705
|
-
else offsetX = (freezeWidth + rowHeaderWidth - (left - x)) * scaleX;
|
|
8706
|
-
let offsetY;
|
|
8707
|
-
if (y > top) offsetY = (y - viewportScrollY) * scaleY;
|
|
8708
|
-
else offsetY = (freezeHeight + columnHeaderHeight - (top - y)) * scaleX;
|
|
8709
|
-
return {
|
|
8710
|
-
x: offsetX,
|
|
8711
|
-
y: offsetY
|
|
8712
|
-
};
|
|
8713
|
-
}
|
|
8714
|
-
function getCellRealRange(workbook, worksheet, skeleton, row, col) {
|
|
8715
|
-
let actualRow = row;
|
|
8716
|
-
let actualCol = col;
|
|
8717
|
-
skeleton.overflowCache.forValue((r, c, range) => {
|
|
8718
|
-
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
8719
|
-
actualCol = c;
|
|
8720
|
-
actualRow = r;
|
|
8721
|
-
}
|
|
8722
|
-
});
|
|
8723
|
-
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
8724
|
-
return {
|
|
8725
|
-
unitId: workbook.getUnitId(),
|
|
8726
|
-
subUnitId: worksheet.getSheetId(),
|
|
8727
|
-
workbook,
|
|
8728
|
-
worksheet,
|
|
8729
|
-
row: actualCell.actualRow,
|
|
8730
|
-
col: actualCell.actualColumn
|
|
8731
|
-
};
|
|
8732
|
-
}
|
|
8733
|
-
function getHoverCellPosition(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY) {
|
|
8734
|
-
const { scene } = currentRender;
|
|
8735
|
-
const unitId = workbook.getUnitId();
|
|
8736
|
-
const { skeleton, sheetId } = skeletonParam;
|
|
8737
|
-
const cellIndex = getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton);
|
|
8738
|
-
if (!cellIndex) return null;
|
|
8739
|
-
let { actualCol, actualRow } = cellIndex;
|
|
8740
|
-
const originLocation = {
|
|
8741
|
-
unitId,
|
|
8742
|
-
subUnitId: sheetId,
|
|
8743
|
-
workbook,
|
|
8744
|
-
worksheet,
|
|
8745
|
-
row: actualRow,
|
|
8746
|
-
col: actualCol
|
|
8747
|
-
};
|
|
8748
|
-
skeleton.overflowCache.forValue((r, c, range) => {
|
|
8749
|
-
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
8750
|
-
actualCol = c;
|
|
8751
|
-
actualRow = r;
|
|
8752
|
-
}
|
|
8753
|
-
});
|
|
8754
|
-
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
8755
|
-
const location = getCellRealRange(workbook, worksheet, skeleton, actualRow, actualCol);
|
|
8756
|
-
let anchorCell;
|
|
8757
|
-
if (actualCell.mergeInfo) anchorCell = actualCell.mergeInfo;
|
|
8758
|
-
else anchorCell = {
|
|
8759
|
-
startRow: location.row,
|
|
8760
|
-
endRow: location.row,
|
|
8761
|
-
startColumn: location.col,
|
|
8762
|
-
endColumn: location.col
|
|
8763
|
-
};
|
|
8764
|
-
const activeViewport = scene.getActiveViewportByCoord(_univerjs_engine_render.Vector2.FromArray([offsetX, offsetY]));
|
|
8765
|
-
if (!activeViewport) return;
|
|
8766
|
-
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8767
|
-
const scrollXY = {
|
|
8768
|
-
x: activeViewport.viewportScrollX,
|
|
8769
|
-
y: activeViewport.viewportScrollY
|
|
8770
|
-
};
|
|
8771
|
-
return {
|
|
8772
|
-
position: {
|
|
8773
|
-
startX: (skeleton.getOffsetByColumn(anchorCell.startColumn - 1) - scrollXY.x) * scaleX,
|
|
8774
|
-
endX: (skeleton.getOffsetByColumn(anchorCell.endColumn) - scrollXY.x) * scaleX,
|
|
8775
|
-
startY: (skeleton.getOffsetByRow(anchorCell.startRow - 1) - scrollXY.y) * scaleY,
|
|
8776
|
-
endY: (skeleton.getOffsetByRow(anchorCell.endRow) - scrollXY.y) * scaleY
|
|
8777
|
-
},
|
|
8778
|
-
location: originLocation,
|
|
8779
|
-
overflowLocation: location
|
|
8780
|
-
};
|
|
8781
|
-
}
|
|
8782
|
-
|
|
8783
8741
|
//#endregion
|
|
8784
8742
|
//#region src/consts/plugin-name.ts
|
|
8785
8743
|
/**
|
|
@@ -9131,7 +9089,7 @@ let AutoHeightController = class AutoHeightController extends _univerjs_core.Dis
|
|
|
9131
9089
|
subUnitId = worksheet.getSheetId();
|
|
9132
9090
|
}
|
|
9133
9091
|
}
|
|
9134
|
-
const skeleton = this._renderManagerService.
|
|
9092
|
+
const skeleton = this._renderManagerService.getRenderUnitById(unitId).with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
9135
9093
|
if (!skeleton) return {
|
|
9136
9094
|
redos: [],
|
|
9137
9095
|
undos: []
|
|
@@ -9197,7 +9155,7 @@ let CellCustomRenderController = class CellCustomRenderController extends _unive
|
|
|
9197
9155
|
if (!skeletonParam) return;
|
|
9198
9156
|
const unitId = this._context.unitId;
|
|
9199
9157
|
const { skeleton } = skeletonParam;
|
|
9200
|
-
const currentRender = this._renderManagerService.
|
|
9158
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
9201
9159
|
if (currentRender && currentRender.mainComponent) {
|
|
9202
9160
|
const spreadsheet = currentRender.mainComponent;
|
|
9203
9161
|
const getActiveRender = (evt) => {
|
|
@@ -9232,7 +9190,7 @@ let CellCustomRenderController = class CellCustomRenderController extends _unive
|
|
|
9232
9190
|
const subUnitId = worksheet.getSheetId();
|
|
9233
9191
|
const info = {
|
|
9234
9192
|
data: cellData,
|
|
9235
|
-
style:
|
|
9193
|
+
style: worksheet.getComposedCellStyleByCellData(row, col, cellData),
|
|
9236
9194
|
primaryWithCoord: skeleton.getCellWithCoordByIndex(cellIndex.actualRow, cellIndex.actualCol),
|
|
9237
9195
|
unitId,
|
|
9238
9196
|
subUnitId,
|
|
@@ -9717,7 +9675,7 @@ let SheetSkeletonRenderController = class SheetSkeletonRenderController extends
|
|
|
9717
9675
|
if (param == null) return;
|
|
9718
9676
|
const { unitId } = this._context;
|
|
9719
9677
|
const { skeleton } = param;
|
|
9720
|
-
const scene = (_this$_renderManagerS = this._renderManagerService.
|
|
9678
|
+
const scene = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.scene;
|
|
9721
9679
|
if (skeleton == null || scene == null) return;
|
|
9722
9680
|
const { rowTotalHeight, columnTotalWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
9723
9681
|
if (!this._context.unit.getActiveSheet()) return;
|
|
@@ -9775,7 +9733,9 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends _univerj
|
|
|
9775
9733
|
if (!loadingRender) return;
|
|
9776
9734
|
let shouldRender = false;
|
|
9777
9735
|
if (!loadingRender.render) {
|
|
9778
|
-
|
|
9736
|
+
const contentElement = this._layoutService.getContentElement();
|
|
9737
|
+
if (!contentElement) return;
|
|
9738
|
+
loadingRender.render = this._createLoadingRender(loadingRender.workbook, loadingRender.sourceUnitId, contentElement);
|
|
9779
9739
|
shouldRender = true;
|
|
9780
9740
|
}
|
|
9781
9741
|
const worksheet = loadingRender.workbook.getSheetBySheetId(activeSheetId);
|
|
@@ -9814,6 +9774,10 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends _univerj
|
|
|
9814
9774
|
async handoff(sourceUnitId, timeoutMs) {
|
|
9815
9775
|
var _this$_loadingRender2, _this$_finalCanvasGua;
|
|
9816
9776
|
if (((_this$_loadingRender2 = this._loadingRender) === null || _this$_loadingRender2 === void 0 ? void 0 : _this$_loadingRender2.sourceUnitId) !== sourceUnitId) return true;
|
|
9777
|
+
if (!this._loadingRender.render) {
|
|
9778
|
+
this.hide(sourceUnitId);
|
|
9779
|
+
return true;
|
|
9780
|
+
}
|
|
9817
9781
|
(_this$_finalCanvasGua = this._finalCanvasGuard) === null || _this$_finalCanvasGua === void 0 || _this$_finalCanvasGua.unsubscribe();
|
|
9818
9782
|
this._finalCanvasGuard = null;
|
|
9819
9783
|
try {
|
|
@@ -9849,9 +9813,8 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends _univerj
|
|
|
9849
9813
|
if (activeSheet) workbook.setActiveSheet(activeSheet);
|
|
9850
9814
|
return workbook;
|
|
9851
9815
|
}
|
|
9852
|
-
_createLoadingRender(workbook, sourceUnitId) {
|
|
9816
|
+
_createLoadingRender(workbook, sourceUnitId, contentElement) {
|
|
9853
9817
|
const previewUnitId = workbook.getUnitId();
|
|
9854
|
-
const contentElement = this._layoutService.getContentElement();
|
|
9855
9818
|
const { width, height } = contentElement.getBoundingClientRect();
|
|
9856
9819
|
const engine = this._injector.createInstance(_univerjs_engine_render.Engine, previewUnitId, void 0);
|
|
9857
9820
|
const scene = new _univerjs_engine_render.Scene(`${PREVIEW_SCENE_PREFIX}${previewUnitId}`, engine, {
|
|
@@ -9886,10 +9849,10 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends _univerj
|
|
|
9886
9849
|
_waitForFinalCanvas(render) {
|
|
9887
9850
|
return new rxjs.Observable((subscriber) => {
|
|
9888
9851
|
let frameId;
|
|
9889
|
-
const contentElement = this._layoutService.getContentElement();
|
|
9890
9852
|
const canvasElement = render.engine.getCanvasElement();
|
|
9891
9853
|
const checkMounted = () => {
|
|
9892
|
-
|
|
9854
|
+
const contentElement = this._layoutService.getContentElement();
|
|
9855
|
+
if (contentElement && canvasElement.parentElement === contentElement && canvasElement.width > 0 && canvasElement.height > 0) {
|
|
9893
9856
|
subscriber.next();
|
|
9894
9857
|
subscriber.complete();
|
|
9895
9858
|
return;
|
|
@@ -9903,7 +9866,7 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends _univerj
|
|
|
9903
9866
|
});
|
|
9904
9867
|
}
|
|
9905
9868
|
_getFinalRender$(sourceUnitId) {
|
|
9906
|
-
const existingRender = this._renderManagerService.
|
|
9869
|
+
const existingRender = this._renderManagerService.getRenderUnitById(sourceUnitId);
|
|
9907
9870
|
return existingRender ? (0, rxjs.of)(existingRender) : this._renderManagerService.created$.pipe((0, rxjs.filter)((render) => render.unitId === sourceUnitId));
|
|
9908
9871
|
}
|
|
9909
9872
|
_guardFinalCanvas(sourceUnitId) {
|
|
@@ -10043,14 +10006,14 @@ const useMenuPosition = (range) => {
|
|
|
10043
10006
|
endCol: range.cols[range.cols.length - 1]
|
|
10044
10007
|
};
|
|
10045
10008
|
if (anchor.endRow < 0 || anchor.endCol < 0) return null;
|
|
10046
|
-
const ru = renderManagerService.
|
|
10009
|
+
const ru = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
10047
10010
|
const sheetSkeletonManagerService = ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService);
|
|
10048
|
-
const selectionRenderService = ru === null || ru === void 0 ? void 0 : ru.with(ISheetSelectionRenderService);
|
|
10049
10011
|
const sheetObject = getSheetObject(univerInstanceService, renderManagerService);
|
|
10050
|
-
if (!sheetObject
|
|
10012
|
+
if (!sheetObject) return null;
|
|
10051
10013
|
const { scene } = sheetObject;
|
|
10052
10014
|
const skeleton = sheetSkeletonManagerService === null || sheetSkeletonManagerService === void 0 ? void 0 : sheetSkeletonManagerService.getCurrentSkeleton();
|
|
10053
|
-
const viewport =
|
|
10015
|
+
const viewport = getViewportByCell(anchor.endRow, anchor.endCol, scene, workbook.getActiveSheet());
|
|
10016
|
+
if (!viewport) return null;
|
|
10054
10017
|
const scaleX = scene === null || scene === void 0 ? void 0 : scene.scaleX;
|
|
10055
10018
|
const scaleY = scene === null || scene === void 0 ? void 0 : scene.scaleY;
|
|
10056
10019
|
const scrollXY = scene === null || scene === void 0 ? void 0 : scene.getViewportScrollXY(viewport);
|
|
@@ -10083,7 +10046,8 @@ const ClipboardPopupMenu = () => {
|
|
|
10083
10046
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
10084
10047
|
const [menuHovered, setMenuHovered] = (0, react.useState)(false);
|
|
10085
10048
|
const [visible, setVisible] = (0, react.useState)(false);
|
|
10086
|
-
const
|
|
10049
|
+
const range = pasteOptionsCache === null || pasteOptionsCache === void 0 ? void 0 : pasteOptionsCache.target.pastedRange;
|
|
10050
|
+
const relativePosition = useMenuPosition(range);
|
|
10087
10051
|
if (!relativePosition || !showMenu) return null;
|
|
10088
10052
|
if (relativePosition.positionX < 50 || relativePosition.positionY < 30) return null;
|
|
10089
10053
|
const showMore = menuHovered || visible;
|
|
@@ -10273,7 +10237,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10273
10237
|
return (_this$_editorBridgeSe = (_this$_editorBridgeSe2 = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe2 === void 0 ? void 0 : _this$_editorBridgeSe2.unitId) !== null && _this$_editorBridgeSe !== void 0 ? _this$_editorBridgeSe : "";
|
|
10274
10238
|
}
|
|
10275
10239
|
get _editingRenderer() {
|
|
10276
|
-
return this._renderManagerService.
|
|
10240
|
+
return this._renderManagerService.getRenderUnitById(this._editingUnitId);
|
|
10277
10241
|
}
|
|
10278
10242
|
get _renderer() {
|
|
10279
10243
|
var _this$_editingRendere;
|
|
@@ -10527,7 +10491,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10527
10491
|
}
|
|
10528
10492
|
_getEditorSkeleton() {
|
|
10529
10493
|
var _this$_renderManagerS;
|
|
10530
|
-
return (_this$_renderManagerS = this._renderManagerService.
|
|
10494
|
+
return (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
10531
10495
|
}
|
|
10532
10496
|
};
|
|
10533
10497
|
SheetCellEditorResizeService = __decorate([
|
|
@@ -10625,7 +10589,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
10625
10589
|
var _this$_renderManagerS;
|
|
10626
10590
|
if (this._editorBridgeService.isVisible().visible) return;
|
|
10627
10591
|
const layout = this._editorBridgeService.getEditCellLayout();
|
|
10628
|
-
const docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.
|
|
10592
|
+
const docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
10629
10593
|
if (!layout || !docSelectionRenderService) return;
|
|
10630
10594
|
const { position, canvasOffset } = layout;
|
|
10631
10595
|
docSelectionRenderService.setInputPosition(canvasOffset.left + position.startX, canvasOffset.top + position.startY);
|
|
@@ -10687,7 +10651,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
10687
10651
|
d.add(disposable);
|
|
10688
10652
|
}
|
|
10689
10653
|
};
|
|
10690
|
-
const render = this._renderManagerService.
|
|
10654
|
+
const render = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
10691
10655
|
if (render) addEvent(render);
|
|
10692
10656
|
else this.disposeWithMe(this._renderManagerService.created$.pipe((0, rxjs.filter)((render) => render.unitId === _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)).subscribe((render) => {
|
|
10693
10657
|
disposable === null || disposable === void 0 || disposable.dispose();
|
|
@@ -10701,7 +10665,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
10701
10665
|
}));
|
|
10702
10666
|
}
|
|
10703
10667
|
_focusCellEditorInput() {
|
|
10704
|
-
const render = this._renderManagerService.
|
|
10668
|
+
const render = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
10705
10669
|
const docSelectionRenderService = render === null || render === void 0 ? void 0 : render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
10706
10670
|
if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
10707
10671
|
}
|
|
@@ -11499,7 +11463,7 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11499
11463
|
unitId: this._editingUnit
|
|
11500
11464
|
});
|
|
11501
11465
|
if (!unit) return;
|
|
11502
|
-
const editorBridgeRenderController = (_this$_renderManagerS = this._renderManagerService.
|
|
11466
|
+
const editorBridgeRenderController = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unit.getUnitId())) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(EditorBridgeRenderController);
|
|
11503
11467
|
if (editorBridgeRenderController) editorBridgeRenderController.refreshEditorPosition();
|
|
11504
11468
|
}
|
|
11505
11469
|
}));
|
|
@@ -11532,7 +11496,7 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11532
11496
|
const editorId = this._contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR) ? _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY : this._editorBridgeService.getCurrentEditorId();
|
|
11533
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();
|
|
11534
11498
|
if (!docUnitId) return;
|
|
11535
|
-
const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.
|
|
11499
|
+
const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(docUnitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
11536
11500
|
if (!docSelectionRenderManager) return;
|
|
11537
11501
|
docSelectionRenderManager.sync();
|
|
11538
11502
|
}));
|
|
@@ -11596,7 +11560,6 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11596
11560
|
unitId: editorUnitId,
|
|
11597
11561
|
snapshot: documentModel.getSnapshot()
|
|
11598
11562
|
});
|
|
11599
|
-
this._contextService.setContextValue(_univerjs_core.FOCUSING_EDITOR_BUT_HIDDEN, true);
|
|
11600
11563
|
this._textSelectionManagerService.replaceDocRanges([{
|
|
11601
11564
|
startOffset: 0,
|
|
11602
11565
|
endOffset: 0
|
|
@@ -11604,8 +11567,8 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11604
11567
|
unitId: _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
11605
11568
|
subUnitId: _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY
|
|
11606
11569
|
});
|
|
11607
|
-
const cellSelectionRenderManager = (_this$_renderManagerS3 = this._renderManagerService.
|
|
11608
|
-
const formulaSelectionRenderManager = (_this$_renderManagerS4 = this._renderManagerService.
|
|
11570
|
+
const cellSelectionRenderManager = (_this$_renderManagerS3 = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
11571
|
+
const formulaSelectionRenderManager = (_this$_renderManagerS4 = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS4 === void 0 ? void 0 : _this$_renderManagerS4.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
11609
11572
|
if ((cellSelectionRenderManager === null || cellSelectionRenderManager === void 0 ? void 0 : cellSelectionRenderManager.canFocusing) || (formulaSelectionRenderManager === null || formulaSelectionRenderManager === void 0 ? void 0 : formulaSelectionRenderManager.canFocusing)) {
|
|
11610
11573
|
this._univerInstanceService.setCurrentUnitForType(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
11611
11574
|
cellSelectionRenderManager === null || cellSelectionRenderManager === void 0 || cellSelectionRenderManager.activate(HIDDEN_EDITOR_POSITION$1, HIDDEN_EDITOR_POSITION$1, true);
|
|
@@ -11720,7 +11683,7 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11720
11683
|
endOffset: cursor
|
|
11721
11684
|
}]);
|
|
11722
11685
|
}
|
|
11723
|
-
(_this$_renderManagerS5 = this._renderManagerService.
|
|
11686
|
+
(_this$_renderManagerS5 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS5 === void 0 || _this$_renderManagerS5.scene.resetCursor();
|
|
11724
11687
|
}
|
|
11725
11688
|
_refreshCurrentSelections(sheetId) {
|
|
11726
11689
|
const selections = this._workbookSelections.getSelectionsOfWorksheet(sheetId);
|
|
@@ -11833,7 +11796,6 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11833
11796
|
var _editorObject$scene$g;
|
|
11834
11797
|
this._contextService.setContextValue(_univerjs_core.FOCUSING_EDITOR_INPUT_FORMULA, false);
|
|
11835
11798
|
this._contextService.setContextValue(_univerjs_core.EDITOR_ACTIVATED, false);
|
|
11836
|
-
this._contextService.setContextValue(_univerjs_core.FOCUSING_EDITOR_BUT_HIDDEN, false);
|
|
11837
11799
|
this._contextService.setContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR, false);
|
|
11838
11800
|
this._cellEditorManagerService.setState({ show: param.visible });
|
|
11839
11801
|
const formulaBarEditor = this._editorService.getEditor(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
@@ -11912,11 +11874,11 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11912
11874
|
}
|
|
11913
11875
|
_getEditorSkeleton(editorId) {
|
|
11914
11876
|
var _this$_renderManagerS6;
|
|
11915
|
-
return (_this$_renderManagerS6 = this._renderManagerService.
|
|
11877
|
+
return (_this$_renderManagerS6 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS6 === void 0 ? void 0 : _this$_renderManagerS6.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
11916
11878
|
}
|
|
11917
11879
|
_getEditorViewModel(editorId) {
|
|
11918
11880
|
var _this$_renderManagerS7;
|
|
11919
|
-
return (_this$_renderManagerS7 = this._renderManagerService.
|
|
11881
|
+
return (_this$_renderManagerS7 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS7 === void 0 ? void 0 : _this$_renderManagerS7.with(_univerjs_docs.DocSkeletonManagerService).getViewModel();
|
|
11920
11882
|
}
|
|
11921
11883
|
_getEditingUnit() {
|
|
11922
11884
|
return this._editingUnit ? this._univerInstanceService.getUnit(this._editingUnit, _univerjs_core.UniverInstanceType.UNIVER_SHEET) : null;
|
|
@@ -12487,12 +12449,12 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
|
|
|
12487
12449
|
if (event.event.key === "Escape") this._sheetClipboardService.removeMarkSelection();
|
|
12488
12450
|
});
|
|
12489
12451
|
};
|
|
12490
|
-
let docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.
|
|
12452
|
+
let docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
12491
12453
|
if (docSelectionRenderService) sheetPasteShortKeyFn(docSelectionRenderService);
|
|
12492
12454
|
this._renderManagerService.created$.subscribe((renderer) => {
|
|
12493
12455
|
if (renderer.unitId === _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {
|
|
12494
12456
|
var _this$_renderManagerS2;
|
|
12495
|
-
docSelectionRenderService = (_this$_renderManagerS2 = this._renderManagerService.
|
|
12457
|
+
docSelectionRenderService = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
12496
12458
|
if (docSelectionRenderService) sheetPasteShortKeyFn(docSelectionRenderService);
|
|
12497
12459
|
}
|
|
12498
12460
|
});
|
|
@@ -12717,11 +12679,9 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
|
|
|
12717
12679
|
};
|
|
12718
12680
|
}
|
|
12719
12681
|
_generateDocumentDataModelSnapshot(snapshot) {
|
|
12720
|
-
var _withCurrentTypeOfRen
|
|
12721
|
-
|
|
12722
|
-
|
|
12723
|
-
const { skeleton } = currentSkeleton;
|
|
12724
|
-
const documentModel = (_skeleton$getBlankCel = skeleton.getBlankCellDocumentModel()) === null || _skeleton$getBlankCel === void 0 ? void 0 : _skeleton$getBlankCel.documentModel;
|
|
12682
|
+
var _withCurrentTypeOfRen;
|
|
12683
|
+
if (((_withCurrentTypeOfRen = (0, _univerjs_engine_render.withCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_SHEET, SheetSkeletonManagerService, this._instanceService, this._renderManagerService)) === null || _withCurrentTypeOfRen === void 0 ? void 0 : _withCurrentTypeOfRen.getCurrentParam()) == null) return null;
|
|
12684
|
+
const documentModel = (0, _univerjs_core.createDocumentModelWithStyle)("", {});
|
|
12725
12685
|
const documentData = {
|
|
12726
12686
|
...documentModel === null || documentModel === void 0 ? void 0 : documentModel.getSnapshot(),
|
|
12727
12687
|
...snapshot
|
|
@@ -12901,7 +12861,7 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
|
|
|
12901
12861
|
const setValuesMutation = {
|
|
12902
12862
|
unitId,
|
|
12903
12863
|
subUnitId,
|
|
12904
|
-
cellValue: valueMatrix.
|
|
12864
|
+
cellValue: valueMatrix.clone()
|
|
12905
12865
|
};
|
|
12906
12866
|
redoMutationsInfo.push({
|
|
12907
12867
|
id: _univerjs_sheets.SetRangeValuesMutation.id,
|
|
@@ -12927,7 +12887,7 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
|
|
|
12927
12887
|
}
|
|
12928
12888
|
_getWorksheet(unitId, subUnitId) {
|
|
12929
12889
|
var _this$_instanceServic;
|
|
12930
|
-
const worksheet = (_this$_instanceServic = this._instanceService.
|
|
12890
|
+
const worksheet = (_this$_instanceServic = this._instanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_instanceServic === void 0 ? void 0 : _this$_instanceServic.getSheetBySheetId(subUnitId);
|
|
12931
12891
|
if (!worksheet) throw new Error(`[SheetClipboardController]: cannot find a worksheet with unitId ${unitId} and subUnitId ${subUnitId}.`);
|
|
12932
12892
|
return worksheet;
|
|
12933
12893
|
}
|
|
@@ -13006,7 +12966,7 @@ let DragManagerService = class DragManagerService extends _univerjs_core.Disposa
|
|
|
13006
12966
|
if (!workbook) return null;
|
|
13007
12967
|
const worksheet = workbook.getActiveSheet();
|
|
13008
12968
|
if (!worksheet) return;
|
|
13009
|
-
const currentRender = this._renderManagerService.
|
|
12969
|
+
const currentRender = this._renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
13010
12970
|
if (!currentRender) return;
|
|
13011
12971
|
const skeletonParam = currentRender.with(SheetSkeletonManagerService).getCurrentParam();
|
|
13012
12972
|
const scrollInfo = currentRender.with(SheetScrollManagerService).getCurrentScrollState();
|
|
@@ -13179,7 +13139,7 @@ let FormulaEditorController = class FormulaEditorController extends _univerjs_co
|
|
|
13179
13139
|
}
|
|
13180
13140
|
_create(unitId) {
|
|
13181
13141
|
if (unitId !== _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) return;
|
|
13182
|
-
const formulaEditorDocObject = this._renderManagerService.
|
|
13142
|
+
const formulaEditorDocObject = this._renderManagerService.getRenderUnitById(unitId);
|
|
13183
13143
|
if (formulaEditorDocObject == null) return;
|
|
13184
13144
|
const { mainComponent: documentComponent } = formulaEditorDocObject;
|
|
13185
13145
|
if (documentComponent == null) return;
|
|
@@ -13187,7 +13147,7 @@ let FormulaEditorController = class FormulaEditorController extends _univerjs_co
|
|
|
13187
13147
|
}
|
|
13188
13148
|
_listenFxBtnClick() {
|
|
13189
13149
|
this._formulaEditorManagerService.fxBtnClick$.pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe(() => {
|
|
13190
|
-
if (this._contextService.getContextValue(_univerjs_core.
|
|
13150
|
+
if (this._contextService.getContextValue(_univerjs_core.FOCUSING_UNIVER_EDITOR) && !this._contextService.getContextValue(_univerjs_core.EDITOR_ACTIVATED)) {
|
|
13191
13151
|
var _formulaEditorDataMod;
|
|
13192
13152
|
this._univerInstanceService.setCurrentUnitForType(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
13193
13153
|
const formulaEditorDataModel = this._univerInstanceService.getUnit(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
@@ -13247,8 +13207,8 @@ let FormulaEditorController = class FormulaEditorController extends _univerjs_co
|
|
|
13247
13207
|
autoScroll() {
|
|
13248
13208
|
var _this$_renderManagerS;
|
|
13249
13209
|
const position = this._formulaEditorManagerService.getPosition();
|
|
13250
|
-
const skeleton = (_this$_renderManagerS = this._renderManagerService.
|
|
13251
|
-
const editorObject = this._renderManagerService.
|
|
13210
|
+
const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
13211
|
+
const editorObject = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
13252
13212
|
const formulaEditorDataModel = this._univerInstanceService.getUnit(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
13253
13213
|
if (skeleton == null || position == null || editorObject == null || formulaEditorDataModel == null) return;
|
|
13254
13214
|
const { marginTop = 0, marginBottom = 0 } = formulaEditorDataModel.getSnapshot().documentStyle;
|
|
@@ -13469,7 +13429,7 @@ const getCustomRangePosition = (injector, unitId, subUnitId, row, col, rangeId)
|
|
|
13469
13429
|
if (!workbook) return null;
|
|
13470
13430
|
const worksheet = workbook.getSheetBySheetId(subUnitId);
|
|
13471
13431
|
if (!worksheet) return null;
|
|
13472
|
-
const currentRender = renderManagerService.
|
|
13432
|
+
const currentRender = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
13473
13433
|
const skeletonParam = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(SheetSkeletonManagerService).getSkeletonParam(worksheet.getSheetId());
|
|
13474
13434
|
const skeleton = skeletonParam === null || skeletonParam === void 0 ? void 0 : skeletonParam.skeleton;
|
|
13475
13435
|
if (!skeleton || !currentRender) return;
|
|
@@ -13515,8 +13475,8 @@ const getEditingCustomRangePosition = (injector, unitId, subUnitId, row, col, ra
|
|
|
13515
13475
|
const { editorUnitId, unitId: editingUnitId, sheetId, row: editRow, column: editCol } = state;
|
|
13516
13476
|
if (unitId !== editingUnitId || subUnitId !== sheetId || editRow !== row || editCol !== col) return null;
|
|
13517
13477
|
const renderManagerService = injector.get(_univerjs_engine_render.IRenderManagerService);
|
|
13518
|
-
const renderer = renderManagerService.
|
|
13519
|
-
const sheetRenderer = renderManagerService.
|
|
13478
|
+
const renderer = renderManagerService.getRenderUnitById(editorUnitId);
|
|
13479
|
+
const sheetRenderer = renderManagerService.getRenderUnitById(unitId);
|
|
13520
13480
|
if (!renderer || !sheetRenderer) return null;
|
|
13521
13481
|
const docSkeleton = renderer.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
13522
13482
|
const sheetSkeleton = (_sheetRenderer$with$g = sheetRenderer.with(SheetSkeletonManagerService).getSkeletonParam(sheetId)) === null || _sheetRenderer$with$g === void 0 ? void 0 : _sheetRenderer$with$g.skeleton;
|
|
@@ -13668,7 +13628,7 @@ let HoverManagerService = class HoverManagerService extends _univerjs_core.Dispo
|
|
|
13668
13628
|
if (!workbook) return null;
|
|
13669
13629
|
const worksheet = workbook.getActiveSheet();
|
|
13670
13630
|
if (!worksheet) return null;
|
|
13671
|
-
const currentRender = this._renderManagerService.
|
|
13631
|
+
const currentRender = this._renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
13672
13632
|
if (!currentRender) return null;
|
|
13673
13633
|
const skeletonParam = currentRender.with(SheetSkeletonManagerService).getSkeletonParam(worksheet.getSheetId());
|
|
13674
13634
|
if (!skeletonParam) return null;
|
|
@@ -14025,7 +13985,6 @@ let SheetPermissionCheckUIController = class SheetPermissionCheckUIController ex
|
|
|
14025
13985
|
errorMsg
|
|
14026
13986
|
},
|
|
14027
13987
|
width: 320,
|
|
14028
|
-
destroyOnClose: true,
|
|
14029
13988
|
showOk: true,
|
|
14030
13989
|
onClose: () => {
|
|
14031
13990
|
this._dialogService.close(UNIVER_SHEET_PERMISSION_ALERT_DIALOG_ID);
|
|
@@ -15023,9 +14982,7 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends _u
|
|
|
15023
14982
|
}
|
|
15024
14983
|
_getFreeze() {
|
|
15025
14984
|
var _this$_sheetSkeletonM6;
|
|
15026
|
-
|
|
15027
|
-
if (config == null) return;
|
|
15028
|
-
return config.freeze;
|
|
14985
|
+
return (_this$_sheetSkeletonM6 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM6 === void 0 ? void 0 : _this$_sheetSkeletonM6.skeleton.worksheet.getFreeze();
|
|
15029
14986
|
}
|
|
15030
14987
|
_getSheetObject() {
|
|
15031
14988
|
return getSheetObject(this._context.unit, this._context);
|
|
@@ -19686,7 +19643,7 @@ const menuSchema = {
|
|
|
19686
19643
|
order: 0,
|
|
19687
19644
|
gridLayout: {
|
|
19688
19645
|
row: 1,
|
|
19689
|
-
column:
|
|
19646
|
+
column: 1
|
|
19690
19647
|
},
|
|
19691
19648
|
menuItemFactory: HorizontalAlignMenuItemFactory
|
|
19692
19649
|
},
|
|
@@ -19751,7 +19708,9 @@ const menuSchema = {
|
|
|
19751
19708
|
order: 0,
|
|
19752
19709
|
gridLayout: {
|
|
19753
19710
|
row: 1,
|
|
19754
|
-
column:
|
|
19711
|
+
column: 1,
|
|
19712
|
+
rowSpan: 2,
|
|
19713
|
+
showLabel: true
|
|
19755
19714
|
},
|
|
19756
19715
|
menuItemFactory: sheetPermissionToolbarMenuFactory
|
|
19757
19716
|
} }
|
|
@@ -20323,18 +20282,12 @@ function AutoFillPopupMenu() {
|
|
|
20323
20282
|
const selected = (0, _univerjs_ui.useObservable)(autoFillService.applyType$, _univerjs_sheets.AUTO_FILL_APPLY_TYPE.SERIES);
|
|
20324
20283
|
const [isHovered, setHovered] = (0, react.useState)(false);
|
|
20325
20284
|
const workbook = useActiveWorkbook();
|
|
20326
|
-
const
|
|
20285
|
+
const sheetSkeletonManagerService = (0, react.useMemo)(() => {
|
|
20327
20286
|
if (workbook) {
|
|
20328
|
-
const ru = renderManagerService.
|
|
20329
|
-
return
|
|
20330
|
-
sheetSkeletonManagerService: ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService),
|
|
20331
|
-
selectionRenderService: ru === null || ru === void 0 ? void 0 : ru.with(ISheetSelectionRenderService)
|
|
20332
|
-
};
|
|
20287
|
+
const ru = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
20288
|
+
return ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService);
|
|
20333
20289
|
}
|
|
20334
|
-
return
|
|
20335
|
-
sheetSkeletonManagerService: null,
|
|
20336
|
-
selectionRenderService: null
|
|
20337
|
-
};
|
|
20290
|
+
return null;
|
|
20338
20291
|
}, [workbook, renderManagerService]);
|
|
20339
20292
|
const handleMouseEnter = () => {
|
|
20340
20293
|
setHovered(true);
|
|
@@ -20365,10 +20318,11 @@ function AutoFillPopupMenu() {
|
|
|
20365
20318
|
}, [visible]);
|
|
20366
20319
|
if (anchor.col < 0 || anchor.row < 0) return null;
|
|
20367
20320
|
const sheetObject = getSheetObject(univerInstanceService, renderManagerService);
|
|
20368
|
-
if (!sheetObject || !
|
|
20321
|
+
if (!sheetObject || !workbook) return null;
|
|
20369
20322
|
const { scene } = sheetObject;
|
|
20370
20323
|
const skeleton = sheetSkeletonManagerService === null || sheetSkeletonManagerService === void 0 ? void 0 : sheetSkeletonManagerService.getCurrentSkeleton();
|
|
20371
|
-
const viewport =
|
|
20324
|
+
const viewport = getViewportByCell(anchor.row, anchor.col, scene, workbook.getActiveSheet());
|
|
20325
|
+
if (!viewport) return null;
|
|
20372
20326
|
const scaleX = scene === null || scene === void 0 ? void 0 : scene.scaleX;
|
|
20373
20327
|
const scaleY = scene === null || scene === void 0 ? void 0 : scene.scaleY;
|
|
20374
20328
|
const scrollXY = scene === null || scene === void 0 ? void 0 : scene.getViewportScrollXY(viewport);
|
|
@@ -21157,7 +21111,8 @@ function DefinedName({ disable }) {
|
|
|
21157
21111
|
const definedNames = (0, _univerjs_ui.useObservable)(() => definedNamesService.update$.pipe((0, rxjs.map)(getDefinedNameMap), (0, rxjs.startWith)(getDefinedNameMap())), getDefinedNameMap(), false, [definedNamesService, unitId]);
|
|
21158
21112
|
(0, react.useEffect)(() => {
|
|
21159
21113
|
const subscription = definedNamesService.currentRange$.subscribe(() => {
|
|
21160
|
-
const
|
|
21114
|
+
const selections = selectionManagerService.getCurrentSelections();
|
|
21115
|
+
const absoluteRef = getAbsoluteRefStringFromSelection(workbook, selections, lexerTreeBuilder);
|
|
21161
21116
|
const definedName = definedNamesService.getDefinedNameByRefString(unitId, absoluteRef);
|
|
21162
21117
|
if (definedName) {
|
|
21163
21118
|
setRangeString(definedName.name);
|
|
@@ -21591,7 +21546,7 @@ function SheetBarMenu() {
|
|
|
21591
21546
|
if (!workbook) return;
|
|
21592
21547
|
const sheets = workbook.getSheets();
|
|
21593
21548
|
const activeSheet = workbook.getActiveSheet();
|
|
21594
|
-
|
|
21549
|
+
const worksheetMenuItems = sheets.map((sheet, index) => {
|
|
21595
21550
|
return {
|
|
21596
21551
|
label: sheet.getName(),
|
|
21597
21552
|
index: `${index}`,
|
|
@@ -21599,7 +21554,8 @@ function SheetBarMenu() {
|
|
|
21599
21554
|
hidden: sheet.isSheetHidden() === _univerjs_core.BooleanNumber.TRUE,
|
|
21600
21555
|
selected: activeSheet === sheet
|
|
21601
21556
|
};
|
|
21602
|
-
})
|
|
21557
|
+
});
|
|
21558
|
+
setMenu(worksheetMenuItems);
|
|
21603
21559
|
}, [workbook, worksheetProtectionRuleModel]);
|
|
21604
21560
|
const setupStatusUpdate = (0, react.useCallback)(() => commandService.onCommandExecuted((commandInfo) => {
|
|
21605
21561
|
switch (commandInfo.id) {
|
|
@@ -22754,7 +22710,7 @@ function SheetBarTabs() {
|
|
|
22754
22710
|
var _activeSheet$getSheet;
|
|
22755
22711
|
const activeSheet = workbook.getActiveSheet();
|
|
22756
22712
|
const currentSubUnitId = (_activeSheet$getSheet = activeSheet === null || activeSheet === void 0 ? void 0 : activeSheet.getSheetId()) !== null && _activeSheet$getSheet !== void 0 ? _activeSheet$getSheet : "";
|
|
22757
|
-
|
|
22713
|
+
const sheetListItems = workbook.getSheets().filter((sheet) => !sheet.isSheetHidden()).map((sheet, index) => {
|
|
22758
22714
|
var _sheet$getTabColor;
|
|
22759
22715
|
const worksheetRule = worksheetProtectionRuleModel.getRule(workbook.getUnitId(), sheet.getSheetId());
|
|
22760
22716
|
const hasSelectionRule = rangeProtectionRuleModel.getSubunitRuleList(workbook.getUnitId(), sheet.getSheetId()).length > 0;
|
|
@@ -22772,7 +22728,8 @@ function SheetBarTabs() {
|
|
|
22772
22728
|
selected: activeSheet === sheet,
|
|
22773
22729
|
color: (_sheet$getTabColor = sheet.getTabColor()) !== null && _sheet$getTabColor !== void 0 ? _sheet$getTabColor : void 0
|
|
22774
22730
|
};
|
|
22775
|
-
})
|
|
22731
|
+
});
|
|
22732
|
+
setSheetList(sheetListItems);
|
|
22776
22733
|
setActiveSheetId(currentSubUnitId);
|
|
22777
22734
|
}, [
|
|
22778
22735
|
rangeProtectionRuleModel,
|
|
@@ -22804,7 +22761,7 @@ function SheetBarTabs() {
|
|
|
22804
22761
|
workbookRef.current = workbook;
|
|
22805
22762
|
}, [workbook]);
|
|
22806
22763
|
const syncActiveSheetRender = (0, react.useCallback)((subUnitId) => {
|
|
22807
|
-
const render = renderManagerService.
|
|
22764
|
+
const render = renderManagerService.getRenderUnitById(workbookRef.current.getUnitId());
|
|
22808
22765
|
try {
|
|
22809
22766
|
render === null || render === void 0 || render.with(SheetSkeletonManagerService).setCurrent({ sheetId: subUnitId });
|
|
22810
22767
|
render === null || render === void 0 || render.scene.makeDirty(true);
|
|
@@ -23175,7 +23132,10 @@ function ZoomSlider() {
|
|
|
23175
23132
|
(0, react.useEffect)(() => {
|
|
23176
23133
|
setZoom(getCurrentZoom());
|
|
23177
23134
|
return commandService.onCommandExecuted((commandInfo) => {
|
|
23178
|
-
if (commandInfo.id === SetZoomRatioOperation.id || commandInfo.id === _univerjs_sheets.SetWorksheetActiveOperation.id)
|
|
23135
|
+
if (commandInfo.id === SetZoomRatioOperation.id || commandInfo.id === _univerjs_sheets.SetWorksheetActiveOperation.id) {
|
|
23136
|
+
const currentZoom = getCurrentZoom();
|
|
23137
|
+
setZoom(currentZoom);
|
|
23138
|
+
}
|
|
23179
23139
|
}).dispose;
|
|
23180
23140
|
}, [commandService, getCurrentZoom]);
|
|
23181
23141
|
function handleChange(value) {
|
|
@@ -23275,8 +23235,6 @@ function formatNumber(item) {
|
|
|
23275
23235
|
const SINGLE_MODE_WIDTH = 800;
|
|
23276
23236
|
const ROW_COUNT_THRESHOLD = 3;
|
|
23277
23237
|
const StatusBar = () => {
|
|
23278
|
-
var _useConfigValue$statu, _useConfigValue;
|
|
23279
|
-
const showStatistic = (_useConfigValue$statu = (_useConfigValue = (0, _univerjs_ui.useConfigValue)("sheets-ui.config")) === null || _useConfigValue === void 0 ? void 0 : _useConfigValue.statusBarStatistic) !== null && _useConfigValue$statu !== void 0 ? _useConfigValue$statu : true;
|
|
23280
23238
|
const [isSingle, setIsSingle] = (0, react.useState)(window.innerWidth < SINGLE_MODE_WIDTH);
|
|
23281
23239
|
const statusBarService = (0, _univerjs_ui.useDependency)(IStatusBarService);
|
|
23282
23240
|
const items = statusBarService.getFunctions().map((item, index) => ({
|
|
@@ -23286,7 +23244,7 @@ const StatusBar = () => {
|
|
|
23286
23244
|
disable: false,
|
|
23287
23245
|
pattern: null
|
|
23288
23246
|
}));
|
|
23289
|
-
const useStatistics = (initialItems, statusBarService, isSingle
|
|
23247
|
+
const useStatistics = (initialItems, statusBarService, isSingle) => {
|
|
23290
23248
|
const [statistics, setStatistics] = (0, react.useState)(initialItems);
|
|
23291
23249
|
const [show, setShow] = (0, react.useState)(true);
|
|
23292
23250
|
const filteredStatistics = (0, react.useMemo)(() => statistics.filter((item) => item.show && !item.disable), [statistics]);
|
|
@@ -23314,21 +23272,16 @@ const StatusBar = () => {
|
|
|
23314
23272
|
}));
|
|
23315
23273
|
}, []);
|
|
23316
23274
|
(0, react.useEffect)(() => {
|
|
23317
|
-
if (!showStatistic) return;
|
|
23318
23275
|
const subscription = statusBarService.state$.subscribe(updateStatistics);
|
|
23319
23276
|
return () => subscription.unsubscribe();
|
|
23320
|
-
}, [
|
|
23321
|
-
showStatistic,
|
|
23322
|
-
statusBarService,
|
|
23323
|
-
updateStatistics
|
|
23324
|
-
]);
|
|
23277
|
+
}, [statusBarService, updateStatistics]);
|
|
23325
23278
|
return {
|
|
23326
23279
|
statistics,
|
|
23327
23280
|
showList,
|
|
23328
23281
|
show
|
|
23329
23282
|
};
|
|
23330
23283
|
};
|
|
23331
|
-
const { showList, show } = useStatistics(items, statusBarService, isSingle
|
|
23284
|
+
const { showList, show } = useStatistics(items, statusBarService, isSingle);
|
|
23332
23285
|
const handleResize = (0, _univerjs_core.debounce)(() => {
|
|
23333
23286
|
const newSingleState = window.innerWidth < SINGLE_MODE_WIDTH;
|
|
23334
23287
|
if (isSingle !== newSingleState) setIsSingle(newSingleState);
|
|
@@ -23340,7 +23293,6 @@ const StatusBar = () => {
|
|
|
23340
23293
|
};
|
|
23341
23294
|
}, [isSingle]);
|
|
23342
23295
|
const getStatisticLayout = (showList, rowCountThreshold, CopyableStatisticItem) => {
|
|
23343
|
-
if (!showStatistic) return null;
|
|
23344
23296
|
if (showList.length > rowCountThreshold) return showList.reduce((acc, _, index) => {
|
|
23345
23297
|
if (index % 2 === 0) acc.push(showList.slice(index, index + 2));
|
|
23346
23298
|
return acc;
|
|
@@ -23441,7 +23393,7 @@ function RenderSheetHeader() {
|
|
|
23441
23393
|
return null;
|
|
23442
23394
|
}
|
|
23443
23395
|
/**
|
|
23444
|
-
*
|
|
23396
|
+
* We should not write into this component anymore.
|
|
23445
23397
|
*/
|
|
23446
23398
|
function RenderSheetContent() {
|
|
23447
23399
|
var _componentManager$get;
|
|
@@ -24153,7 +24105,7 @@ let SheetUIController = class SheetUIController extends _univerjs_core.Disposabl
|
|
|
24153
24105
|
}
|
|
24154
24106
|
_initFocusHandler() {
|
|
24155
24107
|
this.disposeWithMe(this._layoutService.registerFocusHandler(_univerjs_core.UniverInstanceType.UNIVER_SHEET, (_unitId) => {
|
|
24156
|
-
const cellEditorRender = this._injector.get(_univerjs_engine_render.IRenderManagerService).
|
|
24108
|
+
const cellEditorRender = this._injector.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
24157
24109
|
const docSelectionRenderService = cellEditorRender === null || cellEditorRender === void 0 ? void 0 : cellEditorRender.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
24158
24110
|
docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
24159
24111
|
}));
|
|
@@ -24195,7 +24147,7 @@ const useHighlightRange = (ranges = []) => {
|
|
|
24195
24147
|
//#endregion
|
|
24196
24148
|
//#region package.json
|
|
24197
24149
|
var name = "@univerjs/sheets-ui";
|
|
24198
|
-
var version = "1.0.0-alpha.
|
|
24150
|
+
var version = "1.0.0-alpha.8";
|
|
24199
24151
|
|
|
24200
24152
|
//#endregion
|
|
24201
24153
|
//#region src/views/cell-popup/config.ts
|
|
@@ -24388,8 +24340,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24388
24340
|
};
|
|
24389
24341
|
const unitId = workbook.getUnitId();
|
|
24390
24342
|
const subUnitId = worksheet.getSheetId();
|
|
24391
|
-
const skeleton = (_this$_renderManagerS = this._renderManagerService.
|
|
24392
|
-
const currentRender = this._renderManagerService.
|
|
24343
|
+
const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24344
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24393
24345
|
if (!currentRender || !skeleton) return {
|
|
24394
24346
|
dispose: () => {},
|
|
24395
24347
|
canDispose: () => true
|
|
@@ -24442,8 +24394,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24442
24394
|
const subUnitId = worksheet.getSheetId();
|
|
24443
24395
|
if (unitId !== location.unitId || location.subUnitId !== subUnitId) return null;
|
|
24444
24396
|
if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
|
|
24445
|
-
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.
|
|
24446
|
-
const currentRender = this._renderManagerService.
|
|
24397
|
+
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24398
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24447
24399
|
if (!currentRender || !skeleton) return null;
|
|
24448
24400
|
const { position, position$, disposable } = this._createPositionObserver(bound, currentRender, skeleton, worksheet);
|
|
24449
24401
|
const { rects$, disposable: rectsObserverDisposable } = this._createHiddenRectObserver({
|
|
@@ -24496,8 +24448,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24496
24448
|
const unitId = workbook.getUnitId();
|
|
24497
24449
|
const subUnitId = worksheet.getSheetId();
|
|
24498
24450
|
if (_unitId && unitId !== _unitId || _subUnitId && _subUnitId !== subUnitId) return null;
|
|
24499
|
-
const skeleton = (_this$_renderManagerS3 = this._renderManagerService.
|
|
24500
|
-
const currentRender = this._renderManagerService.
|
|
24451
|
+
const skeleton = (_this$_renderManagerS3 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24452
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24501
24453
|
if (!currentRender || !skeleton) return null;
|
|
24502
24454
|
if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
|
|
24503
24455
|
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
@@ -24539,7 +24491,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24539
24491
|
if (!worksheet) return null;
|
|
24540
24492
|
const unitId = workbook.getUnitId();
|
|
24541
24493
|
const subUnitId = worksheet.getSheetId();
|
|
24542
|
-
const currentRender = this._renderManagerService.
|
|
24494
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24543
24495
|
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24544
24496
|
const sheetSelectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
24545
24497
|
if (!currentRender || !skeleton || !sheetSelectionRenderService) return null;
|
|
@@ -24608,7 +24560,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends _u
|
|
|
24608
24560
|
const unitId = workbook.getUnitId();
|
|
24609
24561
|
const subUnitId = worksheet.getSheetId();
|
|
24610
24562
|
if (_unitId && unitId !== _unitId || _subUnitId && subUnitId !== _subUnitId) return null;
|
|
24611
|
-
const currentRender = this._renderManagerService.
|
|
24563
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24612
24564
|
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24613
24565
|
const sheetSelectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
24614
24566
|
if (!currentRender || !skeleton || !sheetSelectionRenderService) return null;
|
|
@@ -25731,7 +25683,7 @@ let CellAlertManagerService = class CellAlertManagerService extends _univerjs_co
|
|
|
25731
25683
|
}
|
|
25732
25684
|
const { location } = alert;
|
|
25733
25685
|
const { row, col, unitId, subUnitId } = location;
|
|
25734
|
-
if (!this._renderManagerService.
|
|
25686
|
+
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
25735
25687
|
const disposable = this._cellPopupManagerService.showPopup({
|
|
25736
25688
|
unitId,
|
|
25737
25689
|
subUnitId,
|
|
@@ -25928,7 +25880,7 @@ function DefinedNameInputContent(props) {
|
|
|
25928
25880
|
const [isFocusFormulaEditor, setIsFocusFormulaEditor] = (0, react.useState)(false);
|
|
25929
25881
|
(0, _univerjs_ui.useSidebarClick)((e) => {
|
|
25930
25882
|
var _formulaEditorRef$cur;
|
|
25931
|
-
|
|
25883
|
+
(_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
|
|
25932
25884
|
});
|
|
25933
25885
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25934
25886
|
className: (0, _univerjs_design.clsx)("univer-grid univer-space-y-2 univer-pb-1", _univerjs_design.borderBottomClassName, { "univer-hidden": !state }),
|
|
@@ -26484,7 +26436,8 @@ function ListDropDown(props) {
|
|
|
26484
26436
|
multiple,
|
|
26485
26437
|
onChange: async (newValue) => {
|
|
26486
26438
|
var _newValue$;
|
|
26487
|
-
|
|
26439
|
+
const str = multiple ? (0, _univerjs_sheets.serializeListOptions)(newValue) : (_newValue$ = newValue[0]) !== null && _newValue$ !== void 0 ? _newValue$ : "";
|
|
26440
|
+
setLocalValue(str);
|
|
26488
26441
|
if (!(await (onChange === null || onChange === void 0 ? void 0 : onChange(newValue)) === false)) hideFn();
|
|
26489
26442
|
},
|
|
26490
26443
|
options,
|
|
@@ -26571,13 +26524,14 @@ const SheetPermissionDialog = () => {
|
|
|
26571
26524
|
actions: defaultWorksheetUnitActionList
|
|
26572
26525
|
}).then((result) => {
|
|
26573
26526
|
if (cancelled) return;
|
|
26574
|
-
|
|
26527
|
+
const actions = result[0].strategies.reduce((p, c) => {
|
|
26575
26528
|
if (subUnitPermissionTypeMap[c.action]) p[c.action] = {
|
|
26576
26529
|
text: localeService.t(`sheets-ui.permission.panel.${subUnitPermissionTypeMap[c.action]}`),
|
|
26577
26530
|
allowed: c.role !== _univerjs_protocol.UnitRole.Owner
|
|
26578
26531
|
};
|
|
26579
26532
|
return p;
|
|
26580
|
-
}, {})
|
|
26533
|
+
}, {});
|
|
26534
|
+
setPermissionMap(actions);
|
|
26581
26535
|
loadingTimer = setTimeout(() => {
|
|
26582
26536
|
setLoading(false);
|
|
26583
26537
|
}, 100);
|
|
@@ -26972,7 +26926,8 @@ const PermissionDetailMainPart = (props) => {
|
|
|
26972
26926
|
(0, _univerjs_sheets.setEndForRange)(range, worksheet.getRowCount(), worksheet.getColumnCount());
|
|
26973
26927
|
return range;
|
|
26974
26928
|
});
|
|
26975
|
-
|
|
26929
|
+
const rangeErrorString = checkRangeValid(injector, transformedRange, permissionId, unitId, subUnitId);
|
|
26930
|
+
onRangesChange(transformedRange, rangeErrorString);
|
|
26976
26931
|
};
|
|
26977
26932
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
|
|
26978
26933
|
className: "univer-font-medium",
|
|
@@ -27045,7 +27000,6 @@ const PermissionDetailUserPart = (props) => {
|
|
|
27045
27000
|
title: { title: "" },
|
|
27046
27001
|
children: { label: UNIVER_SHEET_PERMISSION_USER_DIALOG },
|
|
27047
27002
|
width: "auto",
|
|
27048
|
-
destroyOnClose: true,
|
|
27049
27003
|
closable: false,
|
|
27050
27004
|
onClose: () => dialogService.close(UNIVER_SHEET_PERMISSION_USER_DIALOG_ID),
|
|
27051
27005
|
className: "sheet-permission-user-dialog"
|
|
@@ -27594,10 +27548,13 @@ const SheetPermissionUserDialog = () => {
|
|
|
27594
27548
|
})) === -1) {
|
|
27595
27549
|
const select = { ...item };
|
|
27596
27550
|
setSelectUserInfo([...selectUserInfo, select]);
|
|
27597
|
-
} else
|
|
27598
|
-
|
|
27599
|
-
|
|
27600
|
-
|
|
27551
|
+
} else {
|
|
27552
|
+
const newSelectUserInfo = selectUserInfo.filter((v) => {
|
|
27553
|
+
var _v$subject2, _item$subject3;
|
|
27554
|
+
return ((_v$subject2 = v.subject) === null || _v$subject2 === void 0 ? void 0 : _v$subject2.userID) !== ((_item$subject3 = item.subject) === null || _item$subject3 === void 0 ? void 0 : _item$subject3.userID);
|
|
27555
|
+
});
|
|
27556
|
+
setSelectUserInfo(newSelectUserInfo);
|
|
27557
|
+
}
|
|
27601
27558
|
};
|
|
27602
27559
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
27603
27560
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
@@ -27962,7 +27919,7 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
27962
27919
|
}
|
|
27963
27920
|
_getEditorViewModel(unitId) {
|
|
27964
27921
|
var _this$_renderManagerS;
|
|
27965
|
-
return (_this$_renderManagerS = this._renderManagerService.
|
|
27922
|
+
return (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs.DocSkeletonManagerService).getViewModel();
|
|
27966
27923
|
}
|
|
27967
27924
|
_syncFormulaEditorContent() {
|
|
27968
27925
|
this.disposeWithMe(this._editorBridgeService.currentEditCellState$.subscribe((editCellState) => {
|
|
@@ -28031,7 +27988,7 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
28031
27988
|
}
|
|
28032
27989
|
_syncActionsAndRender(unitId, parmas) {
|
|
28033
27990
|
const INCLUDE_LIST = [_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY, _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY];
|
|
28034
|
-
const currentRender = this._renderManagerService.
|
|
27991
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
28035
27992
|
if (currentRender == null) return;
|
|
28036
27993
|
const skeleton = currentRender.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
28037
27994
|
const docDataModel = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
@@ -28058,7 +28015,7 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
28058
28015
|
if (body.paragraphs) body.paragraphs = this._clearParagraph(body.paragraphs);
|
|
28059
28016
|
}
|
|
28060
28017
|
const INCLUDE_LIST = [_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY, _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY];
|
|
28061
|
-
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.
|
|
28018
|
+
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
28062
28019
|
const docDataModel = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
28063
28020
|
const docViewModel = this._getEditorViewModel(unitId);
|
|
28064
28021
|
if (docDataModel == null || docViewModel == null || skeleton == null) return;
|
|
@@ -28067,7 +28024,7 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
28067
28024
|
docDataModel.getSnapshot().drawingsOrder = drawingsOrder !== null && drawingsOrder !== void 0 ? drawingsOrder : [];
|
|
28068
28025
|
this._checkAndSetRenderStyleConfig(docDataModel);
|
|
28069
28026
|
docViewModel.reset(docDataModel);
|
|
28070
|
-
const currentRender = this._renderManagerService.
|
|
28027
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
28071
28028
|
if (currentRender == null) return;
|
|
28072
28029
|
skeleton.calculate();
|
|
28073
28030
|
if (INCLUDE_LIST.includes(unitId)) {
|
|
@@ -28084,7 +28041,7 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
28084
28041
|
}
|
|
28085
28042
|
_refreshRenderStyleConfig(unitId) {
|
|
28086
28043
|
var _currentRender$mainCo3;
|
|
28087
|
-
const currentRender = this._renderManagerService.
|
|
28044
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
28088
28045
|
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
28089
28046
|
const docDataModel = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
28090
28047
|
const docViewModel = this._getEditorViewModel(unitId);
|
|
@@ -28587,7 +28544,7 @@ function MobileSheetBarImpl(props) {
|
|
|
28587
28544
|
const currentSubUnitId = workbook.getActiveSheet().getSheetId();
|
|
28588
28545
|
const sheets = workbook.getSheets();
|
|
28589
28546
|
const activeSheet = workbook.getActiveSheet();
|
|
28590
|
-
|
|
28547
|
+
const sheetListItems = sheets.filter((sheet) => !sheet.isSheetHidden()).map((sheet, index) => {
|
|
28591
28548
|
var _sheet$getTabColor;
|
|
28592
28549
|
return {
|
|
28593
28550
|
sheetId: sheet.getSheetId(),
|
|
@@ -28596,7 +28553,8 @@ function MobileSheetBarImpl(props) {
|
|
|
28596
28553
|
selected: activeSheet === sheet,
|
|
28597
28554
|
color: (_sheet$getTabColor = sheet.getTabColor()) !== null && _sheet$getTabColor !== void 0 ? _sheet$getTabColor : void 0
|
|
28598
28555
|
};
|
|
28599
|
-
})
|
|
28556
|
+
});
|
|
28557
|
+
setSheetList(sheetListItems);
|
|
28600
28558
|
setActiveKey(currentSubUnitId);
|
|
28601
28559
|
if (tabMapRef.current.has(currentSubUnitId)) {
|
|
28602
28560
|
const element = tabMapRef.current.get(currentSubUnitId);
|
|
@@ -29361,7 +29319,7 @@ let WorksheetProtectionRenderController = class WorksheetProtectionRenderControl
|
|
|
29361
29319
|
}
|
|
29362
29320
|
_initRender() {
|
|
29363
29321
|
const renderId = this._context.unitId;
|
|
29364
|
-
const render = renderId && this._renderManagerService.
|
|
29322
|
+
const render = renderId && this._renderManagerService.getRenderUnitById(renderId);
|
|
29365
29323
|
const spreadsheetRender = render && render.mainComponent;
|
|
29366
29324
|
if (spreadsheetRender) {
|
|
29367
29325
|
if (!spreadsheetRender.getExtensionByKey("worksheet-protection")) spreadsheetRender.register(this._worksheetProtectionRenderExtension);
|
|
@@ -29781,7 +29739,7 @@ let SheetContextMenuMobileRenderController = class SheetContextMenuMobileRenderC
|
|
|
29781
29739
|
}
|
|
29782
29740
|
_getCurrentRenderSelections() {
|
|
29783
29741
|
var _selectionRenderServi;
|
|
29784
|
-
const currentRender = this._renderManagerService.
|
|
29742
|
+
const currentRender = this._renderManagerService.getRenderUnitById(this._context.unitId);
|
|
29785
29743
|
const selectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
29786
29744
|
return (_selectionRenderServi = selectionRenderService === null || selectionRenderService === void 0 ? void 0 : selectionRenderService.getSelectionControls().map((control) => (0, _univerjs_sheets.convertSelectionDataToRange)(control.getValue()))) !== null && _selectionRenderServi !== void 0 ? _selectionRenderServi : [];
|
|
29787
29745
|
}
|
|
@@ -30265,9 +30223,7 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30265
30223
|
}
|
|
30266
30224
|
_getFreeze() {
|
|
30267
30225
|
var _this$_sheetSkeletonM;
|
|
30268
|
-
|
|
30269
|
-
if (snapshot == null) return;
|
|
30270
|
-
return snapshot.freeze;
|
|
30226
|
+
return (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton.worksheet.getFreeze();
|
|
30271
30227
|
}
|
|
30272
30228
|
_initScrollEventListener() {
|
|
30273
30229
|
const { scene } = this._context;
|
|
@@ -30433,7 +30389,10 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30433
30389
|
const speedFactor = Math.min(swipeSpeed / 2, 1);
|
|
30434
30390
|
multiplier = MIN_VELOCITY_MULTIPLIER + (MAX_VELOCITY_MULTIPLIER - MIN_VELOCITY_MULTIPLIER) * speedFactor;
|
|
30435
30391
|
if (swipeDuration < 150 && Math.abs(instantVelocity) > 3) multiplier *= 1.3;
|
|
30436
|
-
} else
|
|
30392
|
+
} else {
|
|
30393
|
+
const velocityFactor = Math.min(Math.abs(instantVelocity) / 5, 1);
|
|
30394
|
+
multiplier = MIN_VELOCITY_MULTIPLIER * (.5 + velocityFactor * .5);
|
|
30395
|
+
}
|
|
30437
30396
|
return Math.max(MIN_VELOCITY_MULTIPLIER * .5, Math.min(MAX_VELOCITY_MULTIPLIER * 1.5, multiplier));
|
|
30438
30397
|
};
|
|
30439
30398
|
/**
|
|
@@ -30759,7 +30718,10 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30759
30718
|
if (!_touchScrolling) return;
|
|
30760
30719
|
_touchScrolling = false;
|
|
30761
30720
|
const avgVelocity = calculateAverageVelocity();
|
|
30762
|
-
const
|
|
30721
|
+
const swipeDuration = performance.now() - swipeStartTime;
|
|
30722
|
+
const totalDistance = Math.sqrt(swipeTotalDisplacement.x * swipeTotalDisplacement.x + swipeTotalDisplacement.y * swipeTotalDisplacement.y);
|
|
30723
|
+
const instantVelocity = Math.sqrt(avgVelocity.x * avgVelocity.x + avgVelocity.y * avgVelocity.y);
|
|
30724
|
+
const dynamicMultiplier = calculateDynamicVelocityMultiplier(swipeDuration, totalDistance, instantVelocity);
|
|
30763
30725
|
const { maxVelocity, minVelocityThreshold } = getZoomAdjustedParams();
|
|
30764
30726
|
const cappedVelX = Math.max(-maxVelocity, Math.min(maxVelocity, avgVelocity.x * dynamicMultiplier));
|
|
30765
30727
|
const cappedVelY = Math.max(-maxVelocity, Math.min(maxVelocity, avgVelocity.y * dynamicMultiplier));
|
|
@@ -30852,7 +30814,7 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30852
30814
|
if (param == null) return;
|
|
30853
30815
|
const { unitId } = this._context;
|
|
30854
30816
|
const { skeleton } = param;
|
|
30855
|
-
const scene = (_this$_renderManagerS = this._renderManagerService.
|
|
30817
|
+
const scene = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.scene;
|
|
30856
30818
|
if (skeleton == null || scene == null) return;
|
|
30857
30819
|
const { rowTotalHeight, columnTotalWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
30858
30820
|
scene === null || scene === void 0 || scene.transformByState({
|
|
@@ -31089,7 +31051,7 @@ let SheetCellDropdownManagerService = class SheetCellDropdownManagerService exte
|
|
|
31089
31051
|
const { location, onHide, closeOnOutSide = true } = param;
|
|
31090
31052
|
const { row, col, unitId, subUnitId } = location;
|
|
31091
31053
|
const component = dropdownMap[param.type];
|
|
31092
|
-
const currentRender = this._renderManagerService.
|
|
31054
|
+
const currentRender = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
31093
31055
|
const disposable = new _univerjs_core.DisposableCollection();
|
|
31094
31056
|
const popupDisposable = this._canvasPopupManagerService.attachPopupToCell(row, col, {
|
|
31095
31057
|
componentKey: component.componentKey,
|
|
@@ -31957,7 +31919,7 @@ _defineProperty(UniverSheetsMobileUIPlugin, "packageName", name);
|
|
|
31957
31919
|
_defineProperty(UniverSheetsMobileUIPlugin, "version", version);
|
|
31958
31920
|
_defineProperty(UniverSheetsMobileUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
31959
31921
|
UniverSheetsMobileUIPlugin = __decorate([
|
|
31960
|
-
(0, _univerjs_core.DependentOn)(_univerjs_sheets.UniverSheetsPlugin, _univerjs_ui.UniverMobileUIPlugin),
|
|
31922
|
+
(0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_engine_formula.UniverFormulaEnginePlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_ui.UniverMobileUIPlugin, _univerjs_docs_ui.UniverDocsUIPlugin),
|
|
31961
31923
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
31962
31924
|
__decorateParam(2, _univerjs_engine_render.IRenderManagerService),
|
|
31963
31925
|
__decorateParam(3, _univerjs_core.IConfigService),
|
|
@@ -32578,7 +32540,7 @@ _defineProperty(UniverSheetsUIPlugin, "packageName", name);
|
|
|
32578
32540
|
_defineProperty(UniverSheetsUIPlugin, "version", version);
|
|
32579
32541
|
_defineProperty(UniverSheetsUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
32580
32542
|
UniverSheetsUIPlugin = __decorate([
|
|
32581
|
-
(0, _univerjs_core.DependentOn)(_univerjs_sheets.UniverSheetsPlugin),
|
|
32543
|
+
(0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_engine_formula.UniverFormulaEnginePlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_ui.UniverUIPlugin, _univerjs_docs_ui.UniverDocsUIPlugin),
|
|
32582
32544
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
32583
32545
|
__decorateParam(2, _univerjs_engine_render.IRenderManagerService),
|
|
32584
32546
|
__decorateParam(3, _univerjs_core.IConfigService),
|