@univerjs/sheets-ui 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +581 -326
- package/lib/es/index.js +584 -330
- package/lib/index.css +0 -8
- package/lib/index.js +584 -330
- package/lib/types/commands/commands/set-selection.command.d.ts +2 -0
- package/lib/types/{views/editor-container/index.d.ts → common/selection-input.d.ts} +3 -2
- package/lib/types/config/config.d.ts +6 -0
- package/lib/types/controllers/editor/data-sync.controller.d.ts +1 -0
- package/lib/types/controllers/editor/editing.render-controller.d.ts +1 -0
- package/lib/types/controllers/render-controllers/contextmenu.render-controller.d.ts +6 -3
- package/lib/types/controllers/render-controllers/desktop-cell-edit.render-controller.d.ts +3 -1
- package/lib/types/index.d.ts +6 -4
- package/lib/types/menu/menu.d.ts +2 -0
- package/lib/types/services/editor-bridge.service.d.ts +4 -0
- package/lib/types/services/hover-manager.service.d.ts +2 -2
- package/lib/types/services/selection/base-selection-render.service.d.ts +2 -0
- package/lib/types/services/selection/selection-control.d.ts +6 -1
- package/lib/types/services/selection/selection-render.service.d.ts +1 -0
- package/lib/types/views/defined-name/DefinedNameOverlay.d.ts +5 -2
- package/lib/types/views/editor-container/focus-editor.d.ts +3 -2
- package/lib/umd/index.js +11 -11
- package/package.json +13 -13
package/lib/cjs/index.js
CHANGED
|
@@ -438,6 +438,15 @@ const SetColumnHeaderHeightCommand = {
|
|
|
438
438
|
}
|
|
439
439
|
};
|
|
440
440
|
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region src/common/selection-input.ts
|
|
443
|
+
function isSheetContextMenuGesture(event, isMac, refSelectionsEnabled) {
|
|
444
|
+
return event.button === 2 || isMac && !refSelectionsEnabled && event.button === 0 && event.ctrlKey;
|
|
445
|
+
}
|
|
446
|
+
function isSheetMultiSelectModifier(event, isMac) {
|
|
447
|
+
return isMac ? event.metaKey : event.ctrlKey;
|
|
448
|
+
}
|
|
449
|
+
|
|
441
450
|
//#endregion
|
|
442
451
|
//#region src/services/selection/selection-layer.ts
|
|
443
452
|
var SelectionLayer = class extends _univerjs_engine_render.Layer {
|
|
@@ -942,9 +951,15 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
942
951
|
rangeWithCoord
|
|
943
952
|
};
|
|
944
953
|
}
|
|
954
|
+
_isContextMenuGesture(evt) {
|
|
955
|
+
return isSheetContextMenuGesture(evt, this._injector.get(_univerjs_ui.IPlatformService).isMac, this.inRefSelectionMode());
|
|
956
|
+
}
|
|
957
|
+
_isMultiSelectModifier(evt) {
|
|
958
|
+
return isSheetMultiSelectModifier(evt, this._injector.get(_univerjs_ui.IPlatformService).isMac);
|
|
959
|
+
}
|
|
945
960
|
_checkClearPreviousControls(evt) {
|
|
946
961
|
if (this.getSelectionControls().length === 0) return;
|
|
947
|
-
if (
|
|
962
|
+
if (this._isContextMenuGesture(evt) && !this.inRefSelectionMode() || !this._isMultiSelectModifier(evt) && !evt.shiftKey && !this._remainLastEnabled || this._singleSelectionEnabled && !evt.shiftKey) this._clearAllSelectionControls();
|
|
948
963
|
}
|
|
949
964
|
_makeSelectionByTwoCells(currentCell, startSelectionRange, skeleton, rangeType, activeControl) {
|
|
950
965
|
const { actualRow, actualColumn, mergeInfo: actualMergeInfo } = currentCell;
|
|
@@ -1850,6 +1865,7 @@ var SelectionShapeExtension = class {
|
|
|
1850
1865
|
//#endregion
|
|
1851
1866
|
//#region src/services/selection/selection-control.ts
|
|
1852
1867
|
const SELECTION_TITLE_HIGHLIGHT_ALPHA = .3;
|
|
1868
|
+
const SELECTION_MOVE_DURATION = 120;
|
|
1853
1869
|
/**
|
|
1854
1870
|
* The main selection canvas component, includes leftControl,rightControl,topControl,bottomControl,backgroundControlTop,backgroundControlMiddleLeft,backgroundControlMiddleRight,backgroundControlBottom,fillControl
|
|
1855
1871
|
*/
|
|
@@ -1859,6 +1875,9 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
1859
1875
|
this._scene = _scene;
|
|
1860
1876
|
this._zIndex = _zIndex;
|
|
1861
1877
|
this._themeService = _themeService;
|
|
1878
|
+
_defineProperty(this, "_moveAnimationFrame", -1);
|
|
1879
|
+
_defineProperty(this, "_animatedRange", null);
|
|
1880
|
+
_defineProperty(this, "_restoreMoveEvents", null);
|
|
1862
1881
|
_defineProperty(this, "_isHelperSelection", true);
|
|
1863
1882
|
_defineProperty(this, "_enableAutoFill", true);
|
|
1864
1883
|
_defineProperty(this, "_showAutoFill", false);
|
|
@@ -1970,6 +1989,7 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
1970
1989
|
scene.addObject(this._selectionShapeGroup, 1);
|
|
1971
1990
|
this.disposeWithMe((0, _univerjs_core.toDisposable)(scene.onTransformChange$.subscribeEvent((state) => {
|
|
1972
1991
|
if (state.type !== _univerjs_engine_render.TRANSFORM_CHANGE_OBSERVABLE_TYPE.scale) return;
|
|
1992
|
+
this._stopMoveAnimation();
|
|
1973
1993
|
this._updateLayoutOfSelectionControl(this._currentStyle);
|
|
1974
1994
|
this._updateControlCoord();
|
|
1975
1995
|
})));
|
|
@@ -2132,6 +2152,11 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
2132
2152
|
if (this._controlExtension) this._controlExtension.setDisabled(disable);
|
|
2133
2153
|
}
|
|
2134
2154
|
setEvent(state) {
|
|
2155
|
+
if (this._animatedRange) {
|
|
2156
|
+
this._stopMoveAnimation();
|
|
2157
|
+
this._updateLayoutOfSelectionControl();
|
|
2158
|
+
this._updateControlCoord();
|
|
2159
|
+
}
|
|
2135
2160
|
this.leftControl.evented = state;
|
|
2136
2161
|
this.rightControl.evented = state;
|
|
2137
2162
|
this.topControl.evented = state;
|
|
@@ -2158,7 +2183,7 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
2158
2183
|
autofillStrokeWidth /= scale < 1 ? 1 : scale;
|
|
2159
2184
|
const borderBuffer = _univerjs_sheets.SELECTION_CONTROL_BORDER_BUFFER_WIDTH / scale;
|
|
2160
2185
|
const fixOnePixelBlurOffset = _univerjs_engine_render.FIX_ONE_PIXEL_BLUR_OFFSET / scale;
|
|
2161
|
-
const { startX, startY, endX, endY } = this._selectionRenderModel;
|
|
2186
|
+
const { startX, startY, endX, endY } = this._animatedRange ?? this._selectionRenderModel;
|
|
2162
2187
|
this.leftControl.transformByState({
|
|
2163
2188
|
height: endY - startY,
|
|
2164
2189
|
left: -leftAdjustWidth + fixOnePixelBlurOffset,
|
|
@@ -2239,19 +2264,20 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
2239
2264
|
this._autoFillControl.show();
|
|
2240
2265
|
} else this._autoFillControl.hide();
|
|
2241
2266
|
this._updateBackgroundControl(currentStyle);
|
|
2242
|
-
this._updateHeaderBackground(currentStyle);
|
|
2267
|
+
if (!this._animatedRange) this._updateHeaderBackground(currentStyle);
|
|
2243
2268
|
this._updateWidgets(currentStyle);
|
|
2244
2269
|
}
|
|
2245
2270
|
/**
|
|
2246
2271
|
* update selection control coordination by curr selection model
|
|
2247
2272
|
*/
|
|
2248
2273
|
_updateControlCoord() {
|
|
2249
|
-
const { startX, startY } = this._selectionRenderModel;
|
|
2274
|
+
const { startX, startY } = this._animatedRange ?? this._selectionRenderModel;
|
|
2250
2275
|
this.selectionShapeGroup.show();
|
|
2251
2276
|
this.selectionShapeGroup.translate(startX, startY);
|
|
2252
2277
|
this.selectionShapeGroup.makeDirtyNoDebounce(true);
|
|
2253
2278
|
}
|
|
2254
2279
|
updateStyle(style) {
|
|
2280
|
+
this._stopMoveAnimation();
|
|
2255
2281
|
this._updateLayoutOfSelectionControl(style);
|
|
2256
2282
|
this._updateControlCoord();
|
|
2257
2283
|
}
|
|
@@ -2265,6 +2291,7 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
2265
2291
|
* @param primaryWithCoord
|
|
2266
2292
|
*/
|
|
2267
2293
|
updateRange(rangeWithCoord, primaryWithCoord) {
|
|
2294
|
+
this._stopMoveAnimation();
|
|
2268
2295
|
this._selectionRenderModel.setValue(rangeWithCoord, primaryWithCoord);
|
|
2269
2296
|
this._showAutoFill = primaryWithCoord !== null;
|
|
2270
2297
|
this._updateLayoutOfSelectionControl();
|
|
@@ -2274,7 +2301,11 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
2274
2301
|
* Update range and primary range and style.
|
|
2275
2302
|
* @param selectionWthCoord
|
|
2276
2303
|
*/
|
|
2277
|
-
updateRangeBySelectionWithCoord(selectionWthCoord, sk) {
|
|
2304
|
+
updateRangeBySelectionWithCoord(selectionWthCoord, sk, animate = false) {
|
|
2305
|
+
const previousRange = this._animatedRange ?? this.getRange();
|
|
2306
|
+
const targetRange = selectionWthCoord.rangeWithCoord;
|
|
2307
|
+
const rangeChanged = !_univerjs_core.Rectangle.equals(this.model, targetRange) || this.model.startX !== targetRange.startX || this.model.startY !== targetRange.startY || this.model.endX !== targetRange.endX || this.model.endY !== targetRange.endY;
|
|
2308
|
+
if (animate || rangeChanged || selectionWthCoord.primaryWithCoord === null) this._stopMoveAnimation();
|
|
2278
2309
|
if (sk) {
|
|
2279
2310
|
this._rowHeaderWidth = sk.rowHeaderWidth;
|
|
2280
2311
|
this._columnHeaderHeight = sk.columnHeaderHeight;
|
|
@@ -2285,6 +2316,47 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
2285
2316
|
this._showAutoFill = selectionWthCoord.primaryWithCoord !== null;
|
|
2286
2317
|
this._updateLayoutOfSelectionControl(selectionWthCoord.style);
|
|
2287
2318
|
this._updateControlCoord();
|
|
2319
|
+
if (animate && rangeChanged && !window.matchMedia("(prefers-reduced-motion: reduce)").matches) this._animateMove(previousRange);
|
|
2320
|
+
}
|
|
2321
|
+
_animateMove(from) {
|
|
2322
|
+
const target = this.getRange();
|
|
2323
|
+
const startedAt = _univerjs_core.Tools.now();
|
|
2324
|
+
const eventedShapes = this.selectionShapeGroup.getObjects().filter((shape) => shape.evented);
|
|
2325
|
+
eventedShapes.forEach((shape) => {
|
|
2326
|
+
shape.evented = false;
|
|
2327
|
+
});
|
|
2328
|
+
this._restoreMoveEvents = () => eventedShapes.forEach((shape) => {
|
|
2329
|
+
shape.evented = true;
|
|
2330
|
+
});
|
|
2331
|
+
this._animatedRange = from;
|
|
2332
|
+
this._updateLayoutOfSelectionControl();
|
|
2333
|
+
this._updateControlCoord();
|
|
2334
|
+
const frame = () => {
|
|
2335
|
+
const progress = Math.min(1, (_univerjs_core.Tools.now() - startedAt) / SELECTION_MOVE_DURATION);
|
|
2336
|
+
const eased = 1 - (1 - progress) ** 3;
|
|
2337
|
+
if (progress === 1) this._stopMoveAnimation();
|
|
2338
|
+
this._animatedRange = progress < 1 ? {
|
|
2339
|
+
...target,
|
|
2340
|
+
startX: from.startX + (target.startX - from.startX) * eased,
|
|
2341
|
+
startY: from.startY + (target.startY - from.startY) * eased,
|
|
2342
|
+
endX: from.endX + (target.endX - from.endX) * eased,
|
|
2343
|
+
endY: from.endY + (target.endY - from.endY) * eased
|
|
2344
|
+
} : null;
|
|
2345
|
+
this._updateLayoutOfSelectionControl();
|
|
2346
|
+
this._updateControlCoord();
|
|
2347
|
+
this._moveAnimationFrame = progress < 1 ? (0, _univerjs_engine_render.requestNewFrame)(frame) : -1;
|
|
2348
|
+
};
|
|
2349
|
+
this._moveAnimationFrame = (0, _univerjs_engine_render.requestNewFrame)(frame);
|
|
2350
|
+
}
|
|
2351
|
+
_stopMoveAnimation() {
|
|
2352
|
+
var _this$_restoreMoveEve;
|
|
2353
|
+
if (this._moveAnimationFrame !== -1) {
|
|
2354
|
+
(0, _univerjs_engine_render.cancelRequestFrame)(this._moveAnimationFrame);
|
|
2355
|
+
this._moveAnimationFrame = -1;
|
|
2356
|
+
}
|
|
2357
|
+
this._animatedRange = null;
|
|
2358
|
+
(_this$_restoreMoveEve = this._restoreMoveEvents) === null || _this$_restoreMoveEve === void 0 || _this$_restoreMoveEve.call(this);
|
|
2359
|
+
this._restoreMoveEvents = null;
|
|
2288
2360
|
}
|
|
2289
2361
|
/**
|
|
2290
2362
|
* Update primary range.
|
|
@@ -2299,40 +2371,22 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
2299
2371
|
this._selectionRenderModel.setCurrentCell(primaryCell);
|
|
2300
2372
|
}
|
|
2301
2373
|
clearHighlight() {
|
|
2374
|
+
this._stopMoveAnimation();
|
|
2302
2375
|
this._showAutoFill = false;
|
|
2303
2376
|
this._selectionRenderModel.clearCurrentCell();
|
|
2304
2377
|
this._updateLayoutOfSelectionControl(this._currentStyle);
|
|
2378
|
+
this._updateControlCoord();
|
|
2305
2379
|
}
|
|
2306
2380
|
getScene() {
|
|
2307
2381
|
return this._scene;
|
|
2308
2382
|
}
|
|
2309
2383
|
dispose() {
|
|
2310
|
-
var _this$
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
(_this$_backgroundCont2 = this._backgroundControlMiddleLeft) === null || _this$_backgroundCont2 === void 0 || _this$_backgroundCont2.dispose();
|
|
2317
|
-
(_this$_backgroundCont3 = this._backgroundControlMiddleRight) === null || _this$_backgroundCont3 === void 0 || _this$_backgroundCont3.dispose();
|
|
2318
|
-
(_this$_backgroundCont4 = this._backgroundControlBottom) === null || _this$_backgroundCont4 === void 0 || _this$_backgroundCont4.dispose();
|
|
2319
|
-
this._autoFillControl.dispose();
|
|
2320
|
-
(_this$_selectionShape = this._selectionShapeGroup) === null || _this$_selectionShape === void 0 || _this$_selectionShape.dispose();
|
|
2321
|
-
(_this$_rowHeaderBackg = this._rowHeaderBackground) === null || _this$_rowHeaderBackg === void 0 || _this$_rowHeaderBackg.dispose();
|
|
2322
|
-
(_this$_rowHeaderBorde = this._rowHeaderBorder) === null || _this$_rowHeaderBorde === void 0 || _this$_rowHeaderBorde.dispose();
|
|
2323
|
-
(_this$_rowHeaderGroup = this._rowHeaderGroup) === null || _this$_rowHeaderGroup === void 0 || _this$_rowHeaderGroup.dispose();
|
|
2324
|
-
(_this$_rowHeaderBackg2 = this._rowHeaderBackground) === null || _this$_rowHeaderBackg2 === void 0 || _this$_rowHeaderBackg2.dispose();
|
|
2325
|
-
(_this$_columnHeaderBa = this._columnHeaderBackground) === null || _this$_columnHeaderBa === void 0 || _this$_columnHeaderBa.dispose();
|
|
2326
|
-
(_this$_columnHeaderBo = this._columnHeaderBorder) === null || _this$_columnHeaderBo === void 0 || _this$_columnHeaderBo.dispose();
|
|
2327
|
-
(_this$_columnHeaderGr = this._columnHeaderGroup) === null || _this$_columnHeaderGr === void 0 || _this$_columnHeaderGr.dispose();
|
|
2328
|
-
(_this$_topLeftWidget = this._topLeftWidget) === null || _this$_topLeftWidget === void 0 || _this$_topLeftWidget.dispose();
|
|
2329
|
-
(_this$_topCenterWidge = this._topCenterWidget) === null || _this$_topCenterWidge === void 0 || _this$_topCenterWidge.dispose();
|
|
2330
|
-
(_this$_topRightWidget = this._topRightWidget) === null || _this$_topRightWidget === void 0 || _this$_topRightWidget.dispose();
|
|
2331
|
-
(_this$_middleLeftWidg = this._middleLeftWidget) === null || _this$_middleLeftWidg === void 0 || _this$_middleLeftWidg.dispose();
|
|
2332
|
-
(_this$_middleRightWid = this._middleRightWidget) === null || _this$_middleRightWid === void 0 || _this$_middleRightWid.dispose();
|
|
2333
|
-
(_this$_bottomLeftWidg = this._bottomLeftWidget) === null || _this$_bottomLeftWidg === void 0 || _this$_bottomLeftWidg.dispose();
|
|
2334
|
-
(_this$_bottomCenterWi = this._bottomCenterWidget) === null || _this$_bottomCenterWi === void 0 || _this$_bottomCenterWi.dispose();
|
|
2335
|
-
(_this$_bottomRightWid = this._bottomRightWidget) === null || _this$_bottomRightWid === void 0 || _this$_bottomRightWid.dispose();
|
|
2384
|
+
var _this$_controlExtensi;
|
|
2385
|
+
this._stopMoveAnimation();
|
|
2386
|
+
this._stopAntLineAnimation();
|
|
2387
|
+
this._selectionShapeGroup.dispose();
|
|
2388
|
+
this._rowHeaderGroup.dispose();
|
|
2389
|
+
this._columnHeaderGroup.dispose();
|
|
2336
2390
|
(_this$_controlExtensi = this._controlExtension) === null || _this$_controlExtensi === void 0 || _this$_controlExtensi.dispose();
|
|
2337
2391
|
super.dispose();
|
|
2338
2392
|
this._dispose$.next(this);
|
|
@@ -2432,12 +2486,12 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
2432
2486
|
this._rowHeaderGroup.makeDirty(true);
|
|
2433
2487
|
}
|
|
2434
2488
|
_updateBackgroundControl(style) {
|
|
2435
|
-
const { startX, startY, endX, endY } = this._selectionRenderModel;
|
|
2489
|
+
const { startX, startY, endX, endY } = this._animatedRange ?? this._selectionRenderModel;
|
|
2436
2490
|
const scale = this._getScale();
|
|
2437
2491
|
const { fill = style.fill } = style;
|
|
2438
2492
|
let { strokeWidth } = style;
|
|
2439
2493
|
strokeWidth /= scale;
|
|
2440
|
-
const highlightSelection = this._selectionRenderModel.highlightToSelection();
|
|
2494
|
+
const highlightSelection = this._animatedRange ?? this._selectionRenderModel.highlightToSelection();
|
|
2441
2495
|
if (!highlightSelection) {
|
|
2442
2496
|
this._backgroundControlTop.resize(endX - startX, endY - startY);
|
|
2443
2497
|
this._backgroundControlTop.setProps({ fill });
|
|
@@ -2498,7 +2552,7 @@ var SelectionControl = class extends _univerjs_core.Disposable {
|
|
|
2498
2552
|
this._backgroundControlBottom.setProps({ fill });
|
|
2499
2553
|
}
|
|
2500
2554
|
_updateWidgets(style) {
|
|
2501
|
-
const { startX, startY, endX, endY } = this._selectionRenderModel;
|
|
2555
|
+
const { startX, startY, endX, endY } = this._animatedRange ?? this._selectionRenderModel;
|
|
2502
2556
|
const { stroke = style.stroke, widgets = style.widgets, widgetStroke = style.widgetStroke } = style;
|
|
2503
2557
|
const scale = this._getScale();
|
|
2504
2558
|
let { widgetSize, widgetStrokeWidth } = style;
|
|
@@ -4622,6 +4676,19 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4622
4676
|
const start = pasteTarget.pastedRange.rows[0];
|
|
4623
4677
|
const end = range.rows[range.rows.length - 1] - range.rows[0] + start;
|
|
4624
4678
|
pasteTarget.pastedRange.rows = Array.from(new Array(end + 1).keys()).slice(start);
|
|
4679
|
+
if (!skipCellCopy) {
|
|
4680
|
+
if (!await this._injector.get(_univerjs_sheets.SheetInterceptorService).beforeCommandExecute({
|
|
4681
|
+
id: _univerjs_sheets.MoveRangeCommand.id,
|
|
4682
|
+
params: {
|
|
4683
|
+
fromUnitId: copyUnitId,
|
|
4684
|
+
fromSubUnitId: copySubUnitId,
|
|
4685
|
+
fromRange: (0, _univerjs_sheets.discreteRangeToRange)(range),
|
|
4686
|
+
toUnitId: target.unitId,
|
|
4687
|
+
toSubUnitId: target.subUnitId,
|
|
4688
|
+
toRange: (0, _univerjs_sheets.discreteRangeToRange)(pasteTarget.pastedRange)
|
|
4689
|
+
}
|
|
4690
|
+
})) return false;
|
|
4691
|
+
}
|
|
4625
4692
|
}
|
|
4626
4693
|
const pasteRes = this._pasteUSM({
|
|
4627
4694
|
cellMatrix,
|
|
@@ -4780,14 +4847,18 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
|
|
|
4780
4847
|
const pasteRangeStartColumn = cols[0];
|
|
4781
4848
|
const pasteRangeEndColumn = cols[cols.length - 1];
|
|
4782
4849
|
const needAutoHeight = [];
|
|
4783
|
-
for (let r = pasteRangeStartRow; r <= pasteRangeEndRow; r++)
|
|
4784
|
-
const
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4850
|
+
for (let r = pasteRangeStartRow; r <= pasteRangeEndRow; r++) {
|
|
4851
|
+
const rowData = rowManager.getRow(r);
|
|
4852
|
+
const hasLegacyManualHeight = (rowData === null || rowData === void 0 ? void 0 : rowData.ia) == null && (rowData === null || rowData === void 0 ? void 0 : rowData.ah) == null && typeof (rowData === null || rowData === void 0 ? void 0 : rowData.h) === "number";
|
|
4853
|
+
if (!((rowData === null || rowData === void 0 ? void 0 : rowData.ia) === _univerjs_core.BooleanNumber.FALSE || hasLegacyManualHeight)) {
|
|
4854
|
+
const autoHeight = skeleton.calculateAutoHeightInRange([{
|
|
4855
|
+
startRow: r,
|
|
4856
|
+
endRow: r,
|
|
4857
|
+
startColumn: pasteRangeStartColumn,
|
|
4858
|
+
endColumn: pasteRangeEndColumn
|
|
4859
|
+
}]).filter((info) => info.autoHeight !== defaultRowHeight);
|
|
4860
|
+
needAutoHeight.push(...autoHeight);
|
|
4861
|
+
}
|
|
4791
4862
|
}
|
|
4792
4863
|
if (needAutoHeight.length > 0) {
|
|
4793
4864
|
const setWorksheetRowAutoHeightMutationParams = {
|
|
@@ -6948,6 +7019,30 @@ const SetFirstColumnFrozenCommand = {
|
|
|
6948
7019
|
}
|
|
6949
7020
|
};
|
|
6950
7021
|
|
|
7022
|
+
//#endregion
|
|
7023
|
+
//#region src/config/config.ts
|
|
7024
|
+
const SHEETS_UI_PLUGIN_CONFIG_KEY = "sheets-ui.config";
|
|
7025
|
+
const configSymbol = Symbol(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
7026
|
+
const defaultPluginConfig = {
|
|
7027
|
+
allowArrowKeyWrapOnSheetBoundary: true,
|
|
7028
|
+
formulaBar: true,
|
|
7029
|
+
protectedRangeShadow: true,
|
|
7030
|
+
maxAutoHeightCount: 1e3
|
|
7031
|
+
};
|
|
7032
|
+
/**
|
|
7033
|
+
* Convert the protectedRangeShadow config to shadow strategy
|
|
7034
|
+
* - true -> 'always'
|
|
7035
|
+
* - false -> 'none'
|
|
7036
|
+
* - string values remain unchanged
|
|
7037
|
+
* @param config The protectedRangeShadow config value
|
|
7038
|
+
* @returns The shadow strategy
|
|
7039
|
+
*/
|
|
7040
|
+
function convertToShadowStrategy(config) {
|
|
7041
|
+
if (config === true) return "always";
|
|
7042
|
+
if (config === false) return "none";
|
|
7043
|
+
return config || "always";
|
|
7044
|
+
}
|
|
7045
|
+
|
|
6951
7046
|
//#endregion
|
|
6952
7047
|
//#region src/services/select-all/select-all.service.ts
|
|
6953
7048
|
var SelectAllService = class extends _univerjs_core.Disposable {
|
|
@@ -7041,7 +7136,9 @@ const MoveSelectionCommand = {
|
|
|
7041
7136
|
}
|
|
7042
7137
|
}
|
|
7043
7138
|
const startRange = getStartRange(range, primary, direction);
|
|
7044
|
-
const
|
|
7139
|
+
const config = accessor.get(_univerjs_core.IConfigService).getConfig(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
7140
|
+
const allowWrap = (config === null || config === void 0 ? void 0 : config.allowArrowKeyWrapOnSheetBoundary) ?? true;
|
|
7141
|
+
const next = jumpOver === 1 ? findNextGapRange(startRange, direction, worksheet) : findNextRange(startRange, direction, worksheet, void 0, true, 1, allowWrap);
|
|
7045
7142
|
const destRange = (0, _univerjs_sheets.getCellAtRowCol)(next.startRow, next.startColumn, worksheet);
|
|
7046
7143
|
if (_univerjs_core.Rectangle.equals(destRange, startRange)) return false;
|
|
7047
7144
|
const unitId = workbook.getUnitId();
|
|
@@ -7164,13 +7261,7 @@ const MoveSelectionEnterAndTabCommand = {
|
|
|
7164
7261
|
keycode: _univerjs_ui.KeyCode.TAB
|
|
7165
7262
|
});
|
|
7166
7263
|
}
|
|
7167
|
-
|
|
7168
|
-
* The start range is from the primary selection range.
|
|
7169
|
-
* If the edited cell is the last row/column of the worksheet, and the submitted operation is Enter/Tab to move down/right, the next selected cell should still be the current cell (not move to the first row/column of the worksheet).
|
|
7170
|
-
*/
|
|
7171
|
-
const isLastRowCell = keycode === _univerjs_ui.KeyCode.ENTER && direction === _univerjs_core.Direction.DOWN && startRange.endRow === worksheet.getMaxRows() - 1;
|
|
7172
|
-
const isLastColumnCell = keycode === _univerjs_ui.KeyCode.TAB && direction === _univerjs_core.Direction.RIGHT && startRange.endColumn === worksheet.getMaxColumns() - 1;
|
|
7173
|
-
const next = isLastRowCell || isLastColumnCell ? startRange : findNextRange(startRange, direction, worksheet);
|
|
7264
|
+
const next = findNextRange(startRange, direction, worksheet, void 0, true, 1, false);
|
|
7174
7265
|
const destRange = (0, _univerjs_sheets.getCellAtRowCol)(next.startRow, next.startColumn, worksheet);
|
|
7175
7266
|
if (_univerjs_core.Rectangle.equals(destRange, startRange)) return false;
|
|
7176
7267
|
resultRange = {
|
|
@@ -7214,11 +7305,19 @@ const ExpandSelectionCommand = {
|
|
|
7214
7305
|
const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService));
|
|
7215
7306
|
if (!target) return false;
|
|
7216
7307
|
const { worksheet, unitId, subUnitId } = target;
|
|
7217
|
-
const
|
|
7308
|
+
const selectionsService = (0, _univerjs_sheets.getSelectionsService)(accessor, params.fromCurrentSelection);
|
|
7309
|
+
const selection = selectionsService.getCurrentLastSelection();
|
|
7218
7310
|
if (!selection) return false;
|
|
7219
7311
|
const { jumpOver, direction, extra } = params;
|
|
7220
7312
|
let { range: startRange, primary } = selection;
|
|
7221
7313
|
if (extra === "formula-editor") {
|
|
7314
|
+
if (params.fromCurrentSelection && primary) startRange = {
|
|
7315
|
+
startRow: primary.startRow,
|
|
7316
|
+
endRow: primary.endRow,
|
|
7317
|
+
startColumn: primary.startColumn,
|
|
7318
|
+
endColumn: primary.endColumn,
|
|
7319
|
+
rangeType: _univerjs_core.RANGE_TYPE.NORMAL
|
|
7320
|
+
};
|
|
7222
7321
|
if (startRange.startRow === startRange.endRow && startRange.startColumn === startRange.endColumn) {
|
|
7223
7322
|
const mergedCell = worksheet.getMergedCell(startRange.startRow, startRange.startColumn);
|
|
7224
7323
|
if (mergedCell) startRange = {
|
|
@@ -7227,18 +7326,21 @@ const ExpandSelectionCommand = {
|
|
|
7227
7326
|
};
|
|
7228
7327
|
}
|
|
7229
7328
|
if (!primary) {
|
|
7230
|
-
const lastSelectionPrimary =
|
|
7329
|
+
const lastSelectionPrimary = selectionsService.getCurrentLastSelectionPrimaryCell();
|
|
7231
7330
|
if (lastSelectionPrimary && _univerjs_core.Rectangle.contains(startRange, lastSelectionPrimary)) primary = lastSelectionPrimary;
|
|
7232
7331
|
}
|
|
7233
7332
|
}
|
|
7234
|
-
const
|
|
7333
|
+
const isShrink = checkIfShrink({
|
|
7235
7334
|
range: startRange,
|
|
7236
7335
|
primary
|
|
7237
|
-
}, direction, worksheet)
|
|
7336
|
+
}, direction, worksheet);
|
|
7337
|
+
let destRange;
|
|
7338
|
+
if (isShrink) destRange = jumpOver === 1 ? shrinkToNextGapRange(startRange, {
|
|
7238
7339
|
..._univerjs_core.Rectangle.clone(primary),
|
|
7239
7340
|
rangeType: _univerjs_core.RANGE_TYPE.NORMAL
|
|
7240
7341
|
}, direction, worksheet) : shrinkToNextCell(startRange, direction, worksheet);
|
|
7241
|
-
destRange
|
|
7342
|
+
else destRange = jumpOver === 1 ? expandToNextGapRange(startRange, direction, worksheet) : expandToNextCell(startRange, direction, worksheet);
|
|
7343
|
+
destRange.rangeType = startRange.rangeType;
|
|
7242
7344
|
if (_univerjs_core.Rectangle.equals(destRange, startRange)) return false;
|
|
7243
7345
|
return accessor.get(_univerjs_core.ICommandService).syncExecuteCommand(_univerjs_sheets.SetSelectionsOperation.id, {
|
|
7244
7346
|
unitId,
|
|
@@ -8289,7 +8391,7 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
8289
8391
|
}
|
|
8290
8392
|
refreshEditCellPosition(resetSizeOnly) {
|
|
8291
8393
|
if (!this._currentEditCell || !this._currentEditCellState) return;
|
|
8292
|
-
const { unitId, sheetId, primary, scene, engine } = this._currentEditCell;
|
|
8394
|
+
const { unitId, sheetId, primary: selectedCell, scene, engine } = this._currentEditCell;
|
|
8293
8395
|
const workbook = this._getWorkbookForEditUnit(unitId);
|
|
8294
8396
|
if (!workbook || workbook.getUnitId() !== unitId) return;
|
|
8295
8397
|
const worksheet = workbook.getActiveSheet();
|
|
@@ -8297,6 +8399,7 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
8297
8399
|
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
8298
8400
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, sheetId);
|
|
8299
8401
|
if (!skeleton) return;
|
|
8402
|
+
const primary = worksheet.getCellInfoInMergeData(selectedCell.actualRow, selectedCell.actualColumn);
|
|
8300
8403
|
const primaryWithCoord = (0, _univerjs_sheets.attachPrimaryWithCoord)(skeleton, primary);
|
|
8301
8404
|
const actualRangeWithCoord = (0, _univerjs_core.convertCellToRange)(primaryWithCoord);
|
|
8302
8405
|
const canvasOffset = (0, _univerjs_docs_ui.getCanvasOffsetByEngine)(engine);
|
|
@@ -8394,7 +8497,7 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
8394
8497
|
getLatestEditCellState() {
|
|
8395
8498
|
var _documentLayoutObject, _documentLayoutObject2;
|
|
8396
8499
|
if (!this._currentEditCell) return;
|
|
8397
|
-
const { unitId, sheetId, primary, scene, engine } = this._currentEditCell;
|
|
8500
|
+
const { unitId, sheetId, primary: selectedCell, scene, engine } = this._currentEditCell;
|
|
8398
8501
|
const workbook = this._getWorkbookForEditUnit(unitId);
|
|
8399
8502
|
if (!workbook || workbook.getUnitId() !== unitId) return;
|
|
8400
8503
|
const worksheet = workbook.getActiveSheet();
|
|
@@ -8402,6 +8505,7 @@ let EditorBridgeService = class EditorBridgeService extends _univerjs_core.Dispo
|
|
|
8402
8505
|
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
8403
8506
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, sheetId);
|
|
8404
8507
|
if (!skeleton) return;
|
|
8508
|
+
const primary = worksheet.getCellInfoInMergeData(selectedCell.actualRow, selectedCell.actualColumn);
|
|
8405
8509
|
const { startRow, startColumn } = primary;
|
|
8406
8510
|
const primaryWithCoord = (0, _univerjs_sheets.attachPrimaryWithCoord)(skeleton, primary);
|
|
8407
8511
|
const actualRangeWithCoord = (0, _univerjs_core.convertCellToRange)(primaryWithCoord);
|
|
@@ -8773,29 +8877,6 @@ const SetActivateCellEditOperation = {
|
|
|
8773
8877
|
}
|
|
8774
8878
|
};
|
|
8775
8879
|
|
|
8776
|
-
//#endregion
|
|
8777
|
-
//#region src/config/config.ts
|
|
8778
|
-
const SHEETS_UI_PLUGIN_CONFIG_KEY = "sheets-ui.config";
|
|
8779
|
-
const configSymbol = Symbol(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
8780
|
-
const defaultPluginConfig = {
|
|
8781
|
-
formulaBar: true,
|
|
8782
|
-
protectedRangeShadow: true,
|
|
8783
|
-
maxAutoHeightCount: 1e3
|
|
8784
|
-
};
|
|
8785
|
-
/**
|
|
8786
|
-
* Convert the protectedRangeShadow config to shadow strategy
|
|
8787
|
-
* - true -> 'always'
|
|
8788
|
-
* - false -> 'none'
|
|
8789
|
-
* - string values remain unchanged
|
|
8790
|
-
* @param config The protectedRangeShadow config value
|
|
8791
|
-
* @returns The shadow strategy
|
|
8792
|
-
*/
|
|
8793
|
-
function convertToShadowStrategy(config) {
|
|
8794
|
-
if (config === true) return "always";
|
|
8795
|
-
if (config === false) return "none";
|
|
8796
|
-
return config || "always";
|
|
8797
|
-
}
|
|
8798
|
-
|
|
8799
8880
|
//#endregion
|
|
8800
8881
|
//#region src/commands/operations/cell-edit.operation.ts
|
|
8801
8882
|
const SetCellEditVisibleOperation = {
|
|
@@ -10974,27 +11055,6 @@ function generateArrowSelectionShortCutItem() {
|
|
|
10974
11055
|
}
|
|
10975
11056
|
});
|
|
10976
11057
|
}
|
|
10977
|
-
for (const [binding, macArrow, direction] of [[
|
|
10978
|
-
_univerjs_ui.KeyCode.HOME,
|
|
10979
|
-
_univerjs_ui.KeyCode.ARROW_LEFT,
|
|
10980
|
-
_univerjs_core.Direction.LEFT
|
|
10981
|
-
], [
|
|
10982
|
-
_univerjs_ui.KeyCode.END,
|
|
10983
|
-
_univerjs_ui.KeyCode.ARROW_RIGHT,
|
|
10984
|
-
_univerjs_core.Direction.RIGHT
|
|
10985
|
-
]]) for (const extend of [false, true]) {
|
|
10986
|
-
const shift = extend ? _univerjs_ui.MetaKeys.SHIFT : 0;
|
|
10987
|
-
shortcutList.push({
|
|
10988
|
-
id: extend ? _univerjs_docs_ui.MoveSelectionOperation.id : _univerjs_docs_ui.MoveCursorOperation.id,
|
|
10989
|
-
binding: binding | shift,
|
|
10990
|
-
mac: macArrow | _univerjs_ui.MetaKeys.CTRL_COMMAND | shift,
|
|
10991
|
-
preconditions: whenEditorDidNotInputFormulaActivated,
|
|
10992
|
-
staticParameters: {
|
|
10993
|
-
direction,
|
|
10994
|
-
granularity: "line"
|
|
10995
|
-
}
|
|
10996
|
-
});
|
|
10997
|
-
}
|
|
10998
11058
|
return shortcutList;
|
|
10999
11059
|
}
|
|
11000
11060
|
const StartEditWithF2Shortcut = {
|
|
@@ -11395,14 +11455,15 @@ function getPercentOffset(editCellState, dataStream) {
|
|
|
11395
11455
|
}
|
|
11396
11456
|
function getPercentEditorSelection(editCellState, visibleParam, dataStream) {
|
|
11397
11457
|
const percentOffset = getPercentOffset(editCellState, dataStream);
|
|
11398
|
-
if (percentOffset == null) return null;
|
|
11399
|
-
const {
|
|
11400
|
-
if (
|
|
11458
|
+
if (percentOffset == null || visibleParam.eventType !== _univerjs_engine_render.DeviceInputEventType.Keyboard) return null;
|
|
11459
|
+
const { initialValue, keycode } = visibleParam;
|
|
11460
|
+
if ((0, _univerjs_core.isFormulaString)(dataStream) && keycode === _univerjs_ui.KeyCode.F2) return null;
|
|
11461
|
+
if (keycode === _univerjs_ui.KeyCode.F2) return {
|
|
11401
11462
|
startOffset: percentOffset,
|
|
11402
11463
|
endOffset: percentOffset,
|
|
11403
11464
|
collapsed: true
|
|
11404
11465
|
};
|
|
11405
|
-
if (
|
|
11466
|
+
if (keycode === _univerjs_ui.KeyCode.BACKSPACE || keycode === _univerjs_ui.KeyCode.DELETE || !/^\d/.test(initialValue ?? "")) return null;
|
|
11406
11467
|
return {
|
|
11407
11468
|
startOffset: 0,
|
|
11408
11469
|
endOffset: percentOffset,
|
|
@@ -11587,28 +11648,38 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11587
11648
|
*/
|
|
11588
11649
|
_commandExecutedListener(d) {
|
|
11589
11650
|
d.add(this._commandService.beforeCommandExecuted((command) => {
|
|
11590
|
-
var _this$_getDocumentDat;
|
|
11591
|
-
if (command.id !== _univerjs_docs.InsertTextCommand.id) return;
|
|
11592
|
-
const
|
|
11651
|
+
var _this$_getDocumentDat, _pasteParams$doc$body, _this$_textSelectionM;
|
|
11652
|
+
if (command.id !== _univerjs_docs.InsertTextCommand.id && command.id !== _univerjs_docs_ui.InnerPasteCommand.id) return;
|
|
11653
|
+
const insertParams = command.id === _univerjs_docs.InsertTextCommand.id ? command.params : null;
|
|
11654
|
+
const pasteParams = command.id === _univerjs_docs_ui.InnerPasteCommand.id ? command.params : null;
|
|
11655
|
+
const unitId = (insertParams === null || insertParams === void 0 ? void 0 : insertParams.unitId) ?? (pasteParams === null || pasteParams === void 0 ? void 0 : pasteParams.unitId);
|
|
11593
11656
|
const visibleParam = this._editorBridgeService.isVisible();
|
|
11594
11657
|
const editCellState = this._editorBridgeService.getEditLocation();
|
|
11595
|
-
if (
|
|
11658
|
+
if (unitId !== _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY || !visibleParam.visible || editCellState == null) return;
|
|
11596
11659
|
const dataStream = (_this$_getDocumentDat = this._getDocumentDataModel()) === null || _this$_getDocumentDat === void 0 || (_this$_getDocumentDat = _this$_getDocumentDat.getBody()) === null || _this$_getDocumentDat === void 0 ? void 0 : _this$_getDocumentDat.dataStream;
|
|
11597
11660
|
if (dataStream == null) return;
|
|
11598
11661
|
const percentOffset = getPercentOffset(editCellState, dataStream);
|
|
11599
|
-
if (percentOffset
|
|
11600
|
-
|
|
11601
|
-
|
|
11602
|
-
|
|
11662
|
+
if (percentOffset == null) return;
|
|
11663
|
+
if (insertParams && !this._editorBridgeService.getEditorDirty() && visibleParam.eventType === _univerjs_engine_render.DeviceInputEventType.Keyboard && /^\d/.test(visibleParam.initialValue ?? "") && /^\d/.test(insertParams.body.dataStream)) insertParams.range = {
|
|
11664
|
+
startOffset: 0,
|
|
11665
|
+
endOffset: percentOffset + (insertParams.body.dataStream.endsWith("%") ? 1 : 0),
|
|
11666
|
+
collapsed: false
|
|
11667
|
+
};
|
|
11668
|
+
const selectionParams = {
|
|
11669
|
+
unitId,
|
|
11670
|
+
subUnitId: unitId
|
|
11671
|
+
};
|
|
11672
|
+
const ranges = insertParams ? [insertParams.range] : this._textSelectionManagerService.getTextRanges(selectionParams);
|
|
11673
|
+
const input = (insertParams === null || insertParams === void 0 ? void 0 : insertParams.body.dataStream) ?? (pasteParams === null || pasteParams === void 0 || (_pasteParams$doc$body = pasteParams.doc.body) === null || _pasteParams$doc$body === void 0 ? void 0 : _pasteParams$doc$body.dataStream);
|
|
11674
|
+
if (!(0, _univerjs_core.isFormulaString)(dataStream) && (input === null || input === void 0 ? void 0 : input.endsWith("%")) && (ranges === null || ranges === void 0 ? void 0 : ranges.length) === 1 && ranges[0].endOffset === percentOffset && (!pasteParams || !((_this$_textSelectionM = this._textSelectionManagerService.getRectRanges(selectionParams)) === null || _this$_textSelectionM === void 0 ? void 0 : _this$_textSelectionM.length))) {
|
|
11675
|
+
const range = {
|
|
11676
|
+
...ranges[0],
|
|
11677
|
+
endOffset: percentOffset + 1,
|
|
11603
11678
|
collapsed: false
|
|
11604
11679
|
};
|
|
11605
|
-
|
|
11680
|
+
if (insertParams) insertParams.range = range;
|
|
11681
|
+
else if (pasteParams) pasteParams.selections = [range];
|
|
11606
11682
|
}
|
|
11607
|
-
if (percentOffset != null && params.body.dataStream === "%" && params.range.collapsed && params.range.startOffset === percentOffset && params.range.endOffset === percentOffset) params.range = {
|
|
11608
|
-
...params.range,
|
|
11609
|
-
endOffset: percentOffset + 1,
|
|
11610
|
-
collapsed: false
|
|
11611
|
-
};
|
|
11612
11683
|
}));
|
|
11613
11684
|
d.add(this._commandService.onCommandExecuted((command) => {
|
|
11614
11685
|
if (command.id === _univerjs_docs.RichTextEditingMutation.id) {
|
|
@@ -11642,7 +11713,7 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11642
11713
|
}));
|
|
11643
11714
|
}
|
|
11644
11715
|
_handleEditorVisible(param) {
|
|
11645
|
-
var
|
|
11716
|
+
var _documentDataModel$ge, _this$_renderManagerS6;
|
|
11646
11717
|
const { eventType, keycode } = param;
|
|
11647
11718
|
this._cursorChange = eventType === _univerjs_engine_render.DeviceInputEventType.PointerDown || eventType === _univerjs_engine_render.DeviceInputEventType.Dblclick ? 2 : 1;
|
|
11648
11719
|
const editCellState = this._editorBridgeService.getEditLocation();
|
|
@@ -11661,21 +11732,25 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11661
11732
|
this._editorBridgeService.refreshEditCellPosition(false);
|
|
11662
11733
|
const editorObject = this._getEditorObject();
|
|
11663
11734
|
if (editorObject == null) return;
|
|
11664
|
-
const { document
|
|
11735
|
+
const { document } = editorObject;
|
|
11665
11736
|
this._contextService.setContextValue(_univerjs_core.EDITOR_ACTIVATED, true);
|
|
11666
11737
|
const documentDataModel = this._getDocumentDataModel();
|
|
11667
11738
|
const skeleton = this._getEditorSkeleton(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
11668
11739
|
if (!skeleton || !documentDataModel) return;
|
|
11669
|
-
|
|
11670
|
-
const viewMain = scene.getViewport(_univerjs_docs_ui.VIEWPORT_KEY.VIEW_MAIN);
|
|
11671
|
-
viewMain === null || viewMain === void 0 || viewMain.scrollToViewportPos({
|
|
11672
|
-
viewportScrollX: Number.POSITIVE_INFINITY,
|
|
11673
|
-
viewportScrollY: Number.POSITIVE_INFINITY
|
|
11674
|
-
});
|
|
11675
|
-
});
|
|
11740
|
+
this._resizeEditorOnOpen(param, editorObject, !!isInArrayFormulaRange);
|
|
11676
11741
|
const clearAndEdit = () => {
|
|
11742
|
+
const resetPointerSelection = isInArrayFormulaRange && eventType === _univerjs_engine_render.DeviceInputEventType.PointerDown;
|
|
11743
|
+
const editorId = this._contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR) ? _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY : this._editorBridgeService.getCurrentEditorId();
|
|
11744
|
+
if (resetPointerSelection) {
|
|
11745
|
+
var _this$_renderManagerS5;
|
|
11746
|
+
(_this$_renderManagerS5 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS5 === void 0 || _this$_renderManagerS5.with(_univerjs_docs_ui.DocSelectionRenderService).cancelPointerSelection();
|
|
11747
|
+
}
|
|
11677
11748
|
this._emptyDocumentDataModel(documentDataModel.getSnapshot().documentStyle, !!isInArrayFormulaRange);
|
|
11678
11749
|
document.makeDirty();
|
|
11750
|
+
if (resetPointerSelection) {
|
|
11751
|
+
var _this$_getEditorSkele;
|
|
11752
|
+
(_this$_getEditorSkele = this._getEditorSkeleton(editorId)) === null || _this$_getEditorSkele === void 0 || _this$_getEditorSkele.calculate();
|
|
11753
|
+
}
|
|
11679
11754
|
if (keycode === _univerjs_ui.KeyCode.BACKSPACE || eventType === _univerjs_engine_render.DeviceInputEventType.Dblclick) {
|
|
11680
11755
|
skeleton.calculate();
|
|
11681
11756
|
this._editorBridgeService.changeEditorDirty(true);
|
|
@@ -11687,6 +11762,27 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11687
11762
|
unitId: _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
11688
11763
|
subUnitId: _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY
|
|
11689
11764
|
});
|
|
11765
|
+
if (resetPointerSelection && editorId !== _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {
|
|
11766
|
+
const selectionTarget = {
|
|
11767
|
+
unitId: editorId,
|
|
11768
|
+
subUnitId: editorId
|
|
11769
|
+
};
|
|
11770
|
+
const previousSelection = this._textSelectionManagerService.getSelectionInfo(selectionTarget);
|
|
11771
|
+
this._textSelectionManagerService.replaceSelectionInfoWithoutRefresh({
|
|
11772
|
+
textRanges: [{
|
|
11773
|
+
startOffset: 0,
|
|
11774
|
+
endOffset: 0,
|
|
11775
|
+
collapsed: true,
|
|
11776
|
+
isActive: true
|
|
11777
|
+
}],
|
|
11778
|
+
rectRanges: [],
|
|
11779
|
+
segmentId: "",
|
|
11780
|
+
segmentPage: -1,
|
|
11781
|
+
style: (previousSelection === null || previousSelection === void 0 ? void 0 : previousSelection.style) ?? _univerjs_engine_render.NORMAL_TEXT_SELECTION_PLUGIN_STYLE,
|
|
11782
|
+
isEditing: true
|
|
11783
|
+
}, selectionTarget);
|
|
11784
|
+
this._textSelectionManagerService.refreshSelection(selectionTarget, true);
|
|
11785
|
+
}
|
|
11690
11786
|
};
|
|
11691
11787
|
const replaceSelection = (selection) => {
|
|
11692
11788
|
this._textSelectionManagerService.replaceDocRanges([selection], {
|
|
@@ -11697,36 +11793,54 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11697
11793
|
const percentSelection = getPercentEditorSelection(editCellState, param, (_documentDataModel$ge = documentDataModel.getBody()) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.dataStream);
|
|
11698
11794
|
const cellImage = (0, _univerjs_sheets.isCellImage)(documentDataModel.getSnapshot());
|
|
11699
11795
|
this._submitEmptyCellImageEdit = cellImage && eventType === _univerjs_engine_render.DeviceInputEventType.Keyboard && keycode === _univerjs_ui.KeyCode.BACKSPACE;
|
|
11700
|
-
if (cellImage) clearAndEdit();
|
|
11796
|
+
if (cellImage || isInArrayFormulaRange) clearAndEdit();
|
|
11701
11797
|
else if (eventType === _univerjs_engine_render.DeviceInputEventType.Keyboard && keycode === _univerjs_ui.KeyCode.F2) {
|
|
11702
11798
|
var _documentDataModel$ge2;
|
|
11703
11799
|
document.makeDirty();
|
|
11704
|
-
|
|
11800
|
+
replaceSelection({
|
|
11705
11801
|
startOffset: 0,
|
|
11706
|
-
endOffset: 0
|
|
11707
|
-
|
|
11802
|
+
endOffset: 0,
|
|
11803
|
+
collapsed: true
|
|
11804
|
+
});
|
|
11708
11805
|
const endOffset = (((_documentDataModel$ge2 = documentDataModel.getBody()) === null || _documentDataModel$ge2 === void 0 ? void 0 : _documentDataModel$ge2.dataStream.length) ?? 2) - 2;
|
|
11709
|
-
|
|
11710
|
-
else this._textSelectionManagerService.replaceDocRanges([{
|
|
11806
|
+
replaceSelection(percentSelection ?? {
|
|
11711
11807
|
startOffset: endOffset,
|
|
11712
|
-
endOffset
|
|
11713
|
-
|
|
11714
|
-
unitId: _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
11715
|
-
subUnitId: _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY
|
|
11808
|
+
endOffset,
|
|
11809
|
+
collapsed: true
|
|
11716
11810
|
});
|
|
11717
|
-
} else if (eventType === _univerjs_engine_render.DeviceInputEventType.Keyboard
|
|
11811
|
+
} else if (eventType === _univerjs_engine_render.DeviceInputEventType.Keyboard) {
|
|
11718
11812
|
if (percentSelection) replaceSelection(percentSelection);
|
|
11719
11813
|
else clearAndEdit();
|
|
11720
11814
|
} else if (eventType === _univerjs_engine_render.DeviceInputEventType.Dblclick) {
|
|
11721
11815
|
if (this._contextService.getContextValue(_univerjs_core.FOCUSING_EDITOR_INPUT_FORMULA)) return;
|
|
11722
|
-
const
|
|
11723
|
-
|
|
11724
|
-
|
|
11725
|
-
startOffset:
|
|
11726
|
-
endOffset
|
|
11727
|
-
|
|
11816
|
+
const dataStream = documentDataModel.getBody().dataStream;
|
|
11817
|
+
const endOffset = (!(0, _univerjs_core.isFormulaString)(dataStream) ? getPercentOffset(editCellState, dataStream) : null) ?? dataStream.length - 2;
|
|
11818
|
+
replaceSelection({
|
|
11819
|
+
startOffset: endOffset,
|
|
11820
|
+
endOffset,
|
|
11821
|
+
collapsed: true
|
|
11822
|
+
});
|
|
11728
11823
|
}
|
|
11729
|
-
(_this$
|
|
11824
|
+
(_this$_renderManagerS6 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS6 === void 0 || _this$_renderManagerS6.scene.resetCursor();
|
|
11825
|
+
}
|
|
11826
|
+
_resizeEditorOnOpen(param, editorObject, isInArrayFormulaRange) {
|
|
11827
|
+
var _this$_sheetCellEdito4;
|
|
11828
|
+
const pointerPosition = param.eventType === _univerjs_engine_render.DeviceInputEventType.Dblclick ? param.pointerPosition : void 0;
|
|
11829
|
+
(_this$_sheetCellEdito4 = this._sheetCellEditorResizeService) === null || _this$_sheetCellEdito4 === void 0 || _this$_sheetCellEdito4.fitTextSize(() => {
|
|
11830
|
+
var _scene$getViewport;
|
|
11831
|
+
if (pointerPosition && this._editorBridgeService.isVisible() !== param) return;
|
|
11832
|
+
const { engine, scene } = editorObject;
|
|
11833
|
+
(_scene$getViewport = scene.getViewport(_univerjs_docs_ui.VIEWPORT_KEY.VIEW_MAIN)) === null || _scene$getViewport === void 0 || _scene$getViewport.scrollToViewportPos({
|
|
11834
|
+
viewportScrollX: pointerPosition ? 0 : Number.POSITIVE_INFINITY,
|
|
11835
|
+
viewportScrollY: pointerPosition ? 0 : Number.POSITIVE_INFINITY
|
|
11836
|
+
});
|
|
11837
|
+
if (!pointerPosition || isInArrayFormulaRange) return;
|
|
11838
|
+
const rect = engine.getCanvasElement().getBoundingClientRect();
|
|
11839
|
+
if (rect.width > 0 && rect.height > 0) {
|
|
11840
|
+
var _this$_renderManagerS7;
|
|
11841
|
+
(_this$_renderManagerS7 = this._renderManagerService.getRenderUnitById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS7 === void 0 || _this$_renderManagerS7.with(_univerjs_docs_ui.DocSelectionRenderService).setCursorManually((pointerPosition.x - rect.left) * engine.width / rect.width, (pointerPosition.y - rect.top) * engine.height / rect.height, true, true, { strict: false });
|
|
11842
|
+
}
|
|
11843
|
+
});
|
|
11730
11844
|
}
|
|
11731
11845
|
_cacheEmptyCellTextStyle() {
|
|
11732
11846
|
var _this$_editorBridgeSe, _sourceBody$textRuns;
|
|
@@ -11859,8 +11973,8 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11859
11973
|
const editorUnitId = this._editorBridgeService.getCurrentEditorId();
|
|
11860
11974
|
if (editorUnitId == null || !this._editorService.isSheetEditor(editorUnitId)) return;
|
|
11861
11975
|
if (editorUnitId === _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {
|
|
11862
|
-
var _this$
|
|
11863
|
-
(_this$
|
|
11976
|
+
var _this$_getEditorSkele2;
|
|
11977
|
+
(_this$_getEditorSkele2 = this._getEditorSkeleton(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_getEditorSkele2 === void 0 || _this$_getEditorSkele2.resetInitialWidth();
|
|
11864
11978
|
}
|
|
11865
11979
|
this._clearEditorHistory();
|
|
11866
11980
|
}
|
|
@@ -11926,12 +12040,12 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
|
|
|
11926
12040
|
return this._univerInstanceService.getUnit(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
11927
12041
|
}
|
|
11928
12042
|
_getEditorSkeleton(editorId) {
|
|
11929
|
-
var _this$
|
|
11930
|
-
return (_this$
|
|
12043
|
+
var _this$_renderManagerS8;
|
|
12044
|
+
return (_this$_renderManagerS8 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS8 === void 0 ? void 0 : _this$_renderManagerS8.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
11931
12045
|
}
|
|
11932
12046
|
_getEditorViewModel(editorId) {
|
|
11933
|
-
var _this$
|
|
11934
|
-
return (_this$
|
|
12047
|
+
var _this$_renderManagerS9;
|
|
12048
|
+
return (_this$_renderManagerS9 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS9 === void 0 ? void 0 : _this$_renderManagerS9.with(_univerjs_docs.DocSkeletonManagerService).getViewModel();
|
|
11935
12049
|
}
|
|
11936
12050
|
_getEditingUnit() {
|
|
11937
12051
|
return this._editingUnit ? this._univerInstanceService.getUnit(this._editingUnit, _univerjs_core.UniverInstanceType.UNIVER_SHEET) : null;
|
|
@@ -13902,14 +14016,15 @@ let HoverManagerService = class HoverManagerService extends _univerjs_core.Dispo
|
|
|
13902
14016
|
location: getLocationBase(activeCell.location)
|
|
13903
14017
|
});
|
|
13904
14018
|
}
|
|
13905
|
-
triggerDbClick(unitId,
|
|
14019
|
+
triggerDbClick(unitId, event) {
|
|
13906
14020
|
const deps = this._getCalcDeps(unitId);
|
|
13907
14021
|
if (!deps) return;
|
|
13908
14022
|
const { currentRender, workbook, worksheet, skeletonParam } = deps;
|
|
13909
|
-
const activeCell = this._calcActiveCell(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY);
|
|
14023
|
+
const activeCell = this._calcActiveCell(currentRender, workbook, worksheet, skeletonParam, event.offsetX, event.offsetY);
|
|
13910
14024
|
if (activeCell) this._currentDbClickedCell$.next({
|
|
13911
14025
|
...activeCell,
|
|
13912
|
-
location: getLocationBase(activeCell.location)
|
|
14026
|
+
location: getLocationBase(activeCell.location),
|
|
14027
|
+
event
|
|
13913
14028
|
});
|
|
13914
14029
|
}
|
|
13915
14030
|
triggerScroll() {
|
|
@@ -13979,7 +14094,7 @@ let HoverRenderController = class HoverRenderController extends _univerjs_core.D
|
|
|
13979
14094
|
if (!skeletonParam) return;
|
|
13980
14095
|
const { mainComponent, unitId, components } = this._context;
|
|
13981
14096
|
if (!mainComponent) return;
|
|
13982
|
-
disposeSet.add(mainComponent.onPointerEnter$.subscribeEvent((
|
|
14097
|
+
disposeSet.add(mainComponent.onPointerEnter$.subscribeEvent(() => {
|
|
13983
14098
|
this._active = true;
|
|
13984
14099
|
}));
|
|
13985
14100
|
disposeSet.add((0, _univerjs_core.fromEventSubject)(mainComponent.onPointerMove$).subscribe((evt) => {
|
|
@@ -13996,7 +14111,7 @@ let HoverRenderController = class HoverRenderController extends _univerjs_core.D
|
|
|
13996
14111
|
this._hoverManagerService.triggerClick(unitId, evt.offsetX, evt.offsetY);
|
|
13997
14112
|
}));
|
|
13998
14113
|
disposeSet.add(mainComponent.onDblclick$.subscribeEvent((evt) => {
|
|
13999
|
-
this._hoverManagerService.triggerDbClick(unitId, evt
|
|
14114
|
+
this._hoverManagerService.triggerDbClick(unitId, evt);
|
|
14000
14115
|
}));
|
|
14001
14116
|
disposeSet.add(mainComponent.onPointerLeave$.subscribeEvent(() => {
|
|
14002
14117
|
this._active = false;
|
|
@@ -17189,6 +17304,10 @@ const MoveRangeConfirmCommand = {
|
|
|
17189
17304
|
id: "sheet.command.move-range-confirm",
|
|
17190
17305
|
handler: async (accessor, params) => {
|
|
17191
17306
|
if (!params) return false;
|
|
17307
|
+
if (!await accessor.get(_univerjs_sheets.SheetInterceptorService).beforeCommandExecute({
|
|
17308
|
+
id: _univerjs_sheets.MoveRangeCommand.id,
|
|
17309
|
+
params
|
|
17310
|
+
})) return false;
|
|
17192
17311
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
17193
17312
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
17194
17313
|
const sourceTarget = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService, {
|
|
@@ -19185,7 +19304,7 @@ function WrapTextMenuItemFactory(accessor) {
|
|
|
19185
19304
|
const disposable = accessor.get(_univerjs_core.ICommandService).onCommandExecuted((c) => {
|
|
19186
19305
|
var _selectionManagerServ14;
|
|
19187
19306
|
const id = c.id;
|
|
19188
|
-
if (id !== _univerjs_sheets.
|
|
19307
|
+
if (id !== _univerjs_sheets.SetRangeValuesMutation.id && id !== _univerjs_sheets.SetSelectionsOperation.id && id !== _univerjs_sheets.SetWorksheetActiveOperation.id) return;
|
|
19189
19308
|
const primary = (_selectionManagerServ14 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ14 === void 0 ? void 0 : _selectionManagerServ14.primary;
|
|
19190
19309
|
let tb;
|
|
19191
19310
|
if (primary != null) {
|
|
@@ -19217,33 +19336,34 @@ function ShrinkToFitMenuItemFactory(accessor) {
|
|
|
19217
19336
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
19218
19337
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
19219
19338
|
const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
|
|
19339
|
+
const style$ = deriveStateFromActiveSheet$(univerInstanceService, {}, ({ worksheet }) => new rxjs.Observable((subscriber) => {
|
|
19340
|
+
const update = () => {
|
|
19341
|
+
var _selectionManagerServ16;
|
|
19342
|
+
const primary = (_selectionManagerServ16 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ16 === void 0 ? void 0 : _selectionManagerServ16.primary;
|
|
19343
|
+
subscriber.next(primary != null ? worksheet.getComposedCellStyle(primary.startRow, primary.startColumn) ?? {} : {});
|
|
19344
|
+
};
|
|
19345
|
+
const disposable = commandService.onCommandExecuted((command) => {
|
|
19346
|
+
if ([
|
|
19347
|
+
_univerjs_sheets.SetRangeValuesMutation.id,
|
|
19348
|
+
_univerjs_sheets.SetSelectionsOperation.id,
|
|
19349
|
+
_univerjs_sheets.SetWorksheetActiveOperation.id
|
|
19350
|
+
].includes(command.id)) update();
|
|
19351
|
+
});
|
|
19352
|
+
update();
|
|
19353
|
+
return disposable.dispose;
|
|
19354
|
+
}));
|
|
19220
19355
|
return {
|
|
19221
19356
|
id: _univerjs_sheets.SetShrinkToFitCommand.id,
|
|
19222
19357
|
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
19223
19358
|
icon: "ShrinkToFitIcon",
|
|
19224
19359
|
title: "sheets-ui.toolbar.shrinkToFit",
|
|
19225
19360
|
tooltip: "sheets-ui.toolbar.shrinkToFit",
|
|
19226
|
-
activated$:
|
|
19227
|
-
|
|
19228
|
-
var _selectionManagerServ16, _worksheet$getCompose;
|
|
19229
|
-
const primary = (_selectionManagerServ16 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ16 === void 0 ? void 0 : _selectionManagerServ16.primary;
|
|
19230
|
-
subscriber.next(primary != null && ((_worksheet$getCompose = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn)) === null || _worksheet$getCompose === void 0 ? void 0 : _worksheet$getCompose.stf) === _univerjs_core.BooleanNumber.TRUE);
|
|
19231
|
-
};
|
|
19232
|
-
const disposable = commandService.onCommandExecuted((command) => {
|
|
19233
|
-
if ([
|
|
19234
|
-
_univerjs_sheets.SetRangeValuesMutation.id,
|
|
19235
|
-
_univerjs_sheets.SetSelectionsOperation.id,
|
|
19236
|
-
_univerjs_sheets.SetWorksheetActiveOperation.id
|
|
19237
|
-
].includes(command.id)) update();
|
|
19238
|
-
});
|
|
19239
|
-
update();
|
|
19240
|
-
return disposable.dispose;
|
|
19241
|
-
})),
|
|
19242
|
-
disabled$: getCurrentRangeDisable$(accessor, {
|
|
19361
|
+
activated$: style$.pipe((0, rxjs.map)((style) => style.stf === _univerjs_core.BooleanNumber.TRUE && style.tb !== _univerjs_core.WrapStrategy.WRAP)),
|
|
19362
|
+
disabled$: (0, rxjs.combineLatest)([getCurrentRangeDisable$(accessor, {
|
|
19243
19363
|
workbookTypes: [_univerjs_sheets.WorkbookEditablePermission],
|
|
19244
19364
|
worksheetTypes: [_univerjs_sheets.WorksheetEditPermission, _univerjs_sheets.WorksheetSetCellStylePermission],
|
|
19245
19365
|
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionEditPoint]
|
|
19246
|
-
}),
|
|
19366
|
+
}), style$]).pipe((0, rxjs.map)(([disabled, style]) => disabled || style.tb === _univerjs_core.WrapStrategy.WRAP)),
|
|
19247
19367
|
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET)
|
|
19248
19368
|
};
|
|
19249
19369
|
}
|
|
@@ -19401,6 +19521,15 @@ function PasteSpacialMenuItemFactory(accessor) {
|
|
|
19401
19521
|
hidden$: getObservableWithExclusiveRange$(accessor, (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET))
|
|
19402
19522
|
};
|
|
19403
19523
|
}
|
|
19524
|
+
const PASTE_RIBBON_MENU_ID = "sheet.menu.paste";
|
|
19525
|
+
function PasteRibbonMenuItemFactory(accessor) {
|
|
19526
|
+
return {
|
|
19527
|
+
...PasteSpacialMenuItemFactory(accessor),
|
|
19528
|
+
id: PASTE_RIBBON_MENU_ID,
|
|
19529
|
+
title: "sheets-ui.rightClick.paste",
|
|
19530
|
+
hidden$: (0, rxjs.combineLatest)([getObservableWithExclusiveRange$(accessor, (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET)), accessor.get(_univerjs_core.IContextService).subscribeContextValue$(_univerjs_core.FOCUSING_SHAPE_TEXT_EDITOR).pipe((0, rxjs.startWith)(false))]).pipe((0, rxjs.map)(([hidden, editing]) => hidden || editing))
|
|
19531
|
+
};
|
|
19532
|
+
}
|
|
19404
19533
|
function PasteValueMenuItemFactory(accessor) {
|
|
19405
19534
|
return {
|
|
19406
19535
|
id: SheetPasteValueCommand.id,
|
|
@@ -20326,6 +20455,39 @@ function ZoomRatioMenuItemFactory(accessor) {
|
|
|
20326
20455
|
//#region src/menu/schema.ts
|
|
20327
20456
|
const menuSchema = {
|
|
20328
20457
|
[_univerjs_ui.RibbonPosition.START]: {
|
|
20458
|
+
[_univerjs_ui.RibbonStartGroup.HISTORY]: { [PASTE_RIBBON_MENU_ID]: {
|
|
20459
|
+
order: 4,
|
|
20460
|
+
gridLayout: {
|
|
20461
|
+
row: 1,
|
|
20462
|
+
column: 3,
|
|
20463
|
+
rowSpan: 2,
|
|
20464
|
+
showLabel: true
|
|
20465
|
+
},
|
|
20466
|
+
menuItemFactory: PasteRibbonMenuItemFactory,
|
|
20467
|
+
[SheetPasteCommand.name]: {
|
|
20468
|
+
order: 0,
|
|
20469
|
+
menuItemFactory: (accessor) => ({
|
|
20470
|
+
...PasteMenuItemFactory(accessor),
|
|
20471
|
+
icon: void 0
|
|
20472
|
+
})
|
|
20473
|
+
},
|
|
20474
|
+
[SheetPasteValueCommand.id]: {
|
|
20475
|
+
order: 1,
|
|
20476
|
+
menuItemFactory: PasteValueMenuItemFactory
|
|
20477
|
+
},
|
|
20478
|
+
[SheetPasteFormatCommand.id]: {
|
|
20479
|
+
order: 2,
|
|
20480
|
+
menuItemFactory: PasteFormatMenuItemFactory
|
|
20481
|
+
},
|
|
20482
|
+
[SheetPasteColWidthCommand.id]: {
|
|
20483
|
+
order: 3,
|
|
20484
|
+
menuItemFactory: PasteColWidthMenuItemFactory
|
|
20485
|
+
},
|
|
20486
|
+
[SheetPasteBesidesBorderCommand.id]: {
|
|
20487
|
+
order: 4,
|
|
20488
|
+
menuItemFactory: PasteBesidesBorderMenuItemFactory
|
|
20489
|
+
}
|
|
20490
|
+
} },
|
|
20329
20491
|
[_univerjs_ui.RibbonStartGroup.FORMAT]: {
|
|
20330
20492
|
[SetRangeFontFamilyCommand.id]: {
|
|
20331
20493
|
order: 1,
|
|
@@ -21052,14 +21214,12 @@ function useWorkbooks() {
|
|
|
21052
21214
|
|
|
21053
21215
|
//#endregion
|
|
21054
21216
|
//#region src/views/editor-container/focus-editor.ts
|
|
21055
|
-
|
|
21056
|
-
|
|
21057
|
-
|
|
21058
|
-
|
|
21059
|
-
|
|
21060
|
-
|
|
21061
|
-
element.focus({ preventScroll: true });
|
|
21062
|
-
return ownerDocument.activeElement === element;
|
|
21217
|
+
function focusSheetCellEditorElement(editorService) {
|
|
21218
|
+
var _editorService$getEdi;
|
|
21219
|
+
const selection = (_editorService$getEdi = editorService.getEditor(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _editorService$getEdi === void 0 ? void 0 : _editorService$getEdi.docSelectionRenderService;
|
|
21220
|
+
if (!selection || selection.isFocusing) return false;
|
|
21221
|
+
selection.focus();
|
|
21222
|
+
return selection.isFocusing;
|
|
21063
21223
|
}
|
|
21064
21224
|
function registerSheetCellEditorRuntimePortal(options) {
|
|
21065
21225
|
const ownerDocument = options.ownerDocument ?? (typeof document === "undefined" ? void 0 : document);
|
|
@@ -21072,8 +21232,10 @@ function registerSheetCellEditorRuntimePortal(options) {
|
|
|
21072
21232
|
const frameHandles = [];
|
|
21073
21233
|
let observer;
|
|
21074
21234
|
const tryRegister = () => {
|
|
21235
|
+
var _options$editorServic;
|
|
21075
21236
|
if (disposed) return;
|
|
21076
|
-
const
|
|
21237
|
+
const selection = (_options$editorServic = options.editorService.getEditor(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _options$editorServic === void 0 ? void 0 : _options$editorServic.docSelectionRenderService;
|
|
21238
|
+
const portalRoot = (selection === null || selection === void 0 ? void 0 : selection.selectionContainer.isConnected) ? selection.selectionContainer : null;
|
|
21077
21239
|
if (portalRoot === registeredPortalRoot) return;
|
|
21078
21240
|
portalRegistration === null || portalRegistration === void 0 || portalRegistration.dispose();
|
|
21079
21241
|
portalRegistration = void 0;
|
|
@@ -21088,7 +21250,7 @@ function registerSheetCellEditorRuntimePortal(options) {
|
|
|
21088
21250
|
role: "child-editor",
|
|
21089
21251
|
element: portalRoot
|
|
21090
21252
|
}));
|
|
21091
|
-
const editorElement =
|
|
21253
|
+
const editorElement = selection === null || selection === void 0 ? void 0 : selection.inputElement;
|
|
21092
21254
|
if (editorElement && editorElement !== portalRoot) rootRegistration.add(options.focusCoordinator.registerElement({
|
|
21093
21255
|
embedId: options.embedId,
|
|
21094
21256
|
role: "child-editor",
|
|
@@ -21131,9 +21293,6 @@ function registerSheetCellEditorRuntimePortal(options) {
|
|
|
21131
21293
|
}));
|
|
21132
21294
|
return collection;
|
|
21133
21295
|
}
|
|
21134
|
-
function resolveSheetCellEditorPortalRoot(ownerDocument = document) {
|
|
21135
|
-
return ownerDocument.getElementById(SHEET_CELL_EDITOR_SELECTION_CONTAINER_ID) ?? ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
|
|
21136
|
-
}
|
|
21137
21296
|
|
|
21138
21297
|
//#endregion
|
|
21139
21298
|
//#region src/views/editor-container/hooks.ts
|
|
@@ -21203,19 +21362,6 @@ const EDITOR_DEFAULT_POSITION = {
|
|
|
21203
21362
|
};
|
|
21204
21363
|
const CELL_EDITOR_DARK_SURFACE_THEME_COLOR = "gray.800";
|
|
21205
21364
|
const CELL_EDITOR_LIGHT_SURFACE_THEME_COLOR = "gray.0";
|
|
21206
|
-
/**
|
|
21207
|
-
* @returns the host background color for the cell editor.
|
|
21208
|
-
*/
|
|
21209
|
-
function getCellEditorHostBackgroundColor(editState, options = {}) {
|
|
21210
|
-
var _options$getColorFrom;
|
|
21211
|
-
const cellFill = editState === null || editState === void 0 ? void 0 : editState.documentLayoutObject.fill;
|
|
21212
|
-
if (cellFill && !isTransparentColor(cellFill)) return cellFill;
|
|
21213
|
-
return (_options$getColorFrom = options.getColorFromTheme) === null || _options$getColorFrom === void 0 ? void 0 : _options$getColorFrom.call(options, options.darkMode ? CELL_EDITOR_DARK_SURFACE_THEME_COLOR : CELL_EDITOR_LIGHT_SURFACE_THEME_COLOR);
|
|
21214
|
-
}
|
|
21215
|
-
function isTransparentColor(color) {
|
|
21216
|
-
const normalizedColor = color.trim().toLowerCase().replace(/\s+/g, "");
|
|
21217
|
-
return normalizedColor === "transparent" || normalizedColor === "rgba(0,0,0,0)";
|
|
21218
|
-
}
|
|
21219
21365
|
function shouldRefocusCellEditorAfterPointerDown(options) {
|
|
21220
21366
|
const { root, target, activeElement, isEditorFocusing } = options;
|
|
21221
21367
|
if (!root || !(target instanceof HTMLElement) || !(activeElement instanceof HTMLElement)) return true;
|
|
@@ -21280,10 +21426,13 @@ function EditorContainer({ hidden = false }) {
|
|
|
21280
21426
|
const workbook = editState ? instanceService.getUnit(editState.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET) ?? null : null;
|
|
21281
21427
|
const activeSheet = useActiveWorksheet(workbook);
|
|
21282
21428
|
const darkMode = (0, _univerjs_ui.useObservable)(themeService.darkMode$, themeService.darkMode);
|
|
21429
|
+
const cellFill = editState === null || editState === void 0 ? void 0 : editState.documentLayoutObject.fill;
|
|
21430
|
+
const normalizedFill = cellFill === null || cellFill === void 0 ? void 0 : cellFill.trim().toLowerCase().replace(/\s+/g, "");
|
|
21431
|
+
const editorBackgroundColor = cellFill && normalizedFill !== "transparent" && normalizedFill !== "rgba(0,0,0,0)" ? cellFill : themeService.getColorFromTheme(darkMode ? CELL_EDITOR_DARK_SURFACE_THEME_COLOR : CELL_EDITOR_LIGHT_SURFACE_THEME_COLOR);
|
|
21283
21432
|
const [showEditCellAddress, setShowEditCellAddress] = (0, react.useState)(false);
|
|
21284
21433
|
const editSheetName = editState ? workbook === null || workbook === void 0 || (_workbook$getSheetByS = workbook.getSheetBySheetId(editState.sheetId)) === null || _workbook$getSheetByS === void 0 ? void 0 : _workbook$getSheetByS.getName() : null;
|
|
21285
21434
|
const editCellAddress = editState ? `${activeSheet && editSheetName && activeSheet.getSheetId() !== editState.sheetId ? `'${(0, _univerjs_engine_formula.quoteSheetName)(editSheetName)}'!` : ""}${(0, _univerjs_core.numberToABC)(editState.column)}${editState.row + 1}` : null;
|
|
21286
|
-
const editorBorderColor = genNormalSelectionStyle(themeService)
|
|
21435
|
+
const { stroke: editorBorderColor, strokeWidth: editorBorderWidth } = genNormalSelectionStyle(themeService);
|
|
21287
21436
|
const focusCoordinator = injector.has(ISheetEmbedRuntimeFocusCoordinator) ? injector.get(ISheetEmbedRuntimeFocusCoordinator) : void 0;
|
|
21288
21437
|
const resolveRuntimeFocusState = () => {
|
|
21289
21438
|
var _instanceService$getF;
|
|
@@ -21372,21 +21521,18 @@ function EditorContainer({ hidden = false }) {
|
|
|
21372
21521
|
const focusCellEditorElement = () => {
|
|
21373
21522
|
const scope = rootRef.current ? resolveSheetEmbedRuntimeDomScope(rootRef.current) ?? resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
21374
21523
|
if (shouldPreserveEmbedInteractiveFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
21375
|
-
focusSheetCellEditorElement(
|
|
21524
|
+
focusSheetCellEditorElement(editorService);
|
|
21376
21525
|
if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
|
|
21377
21526
|
delayedFocusTimer = ownerWindow.setTimeout(() => {
|
|
21378
21527
|
delayedFocusTimer = void 0;
|
|
21379
21528
|
if (shouldPreserveEmbedInteractiveFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
21380
|
-
focusSheetCellEditorElement(
|
|
21529
|
+
focusSheetCellEditorElement(editorService);
|
|
21381
21530
|
}, 0);
|
|
21382
21531
|
};
|
|
21383
21532
|
const focusEditor = () => {
|
|
21384
21533
|
if (contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR)) return;
|
|
21385
21534
|
const scope = rootRef.current ? resolveSheetEmbedRuntimeDomScope(rootRef.current) ?? resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
21386
21535
|
if (shouldPreserveEmbedControlFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
21387
|
-
const editor = editorService.getEditor(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
21388
|
-
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
21389
|
-
if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
21390
21536
|
focusCellEditorElement();
|
|
21391
21537
|
};
|
|
21392
21538
|
focusEditor();
|
|
@@ -21438,6 +21584,7 @@ function EditorContainer({ hidden = false }) {
|
|
|
21438
21584
|
element: editorRoot
|
|
21439
21585
|
}));
|
|
21440
21586
|
collection.add(registerSheetCellEditorRuntimePortal({
|
|
21587
|
+
editorService,
|
|
21441
21588
|
embedId: scope.embedId,
|
|
21442
21589
|
ownerDocument: rootRef.current.ownerDocument,
|
|
21443
21590
|
interactionBoundaryService,
|
|
@@ -21448,10 +21595,7 @@ function EditorContainer({ hidden = false }) {
|
|
|
21448
21595
|
let pointerRetryFrame = 0;
|
|
21449
21596
|
const focusEditor = () => {
|
|
21450
21597
|
if (contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR) || shouldPreserveEmbedControlFocus(scope.embedId, ownerDocument)) return;
|
|
21451
|
-
|
|
21452
|
-
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
21453
|
-
if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
21454
|
-
focusSheetCellEditorElement(ownerDocument);
|
|
21598
|
+
focusSheetCellEditorElement(editorService);
|
|
21455
21599
|
};
|
|
21456
21600
|
const refocusEditorAfterRuntimePointer = (event) => {
|
|
21457
21601
|
if (!focusCoordinator.isChildUnitRuntimeEvent(scope.childUnitId, event.target, event) || isEmbedRuntimeEditorOrPopup(event.target)) return;
|
|
@@ -21486,6 +21630,7 @@ function EditorContainer({ hidden = false }) {
|
|
|
21486
21630
|
const ownerDocument = ((_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.ownerDocument) ?? document;
|
|
21487
21631
|
const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
|
|
21488
21632
|
const portalRegistration = registerSheetCellEditorRuntimePortal({
|
|
21633
|
+
editorService,
|
|
21489
21634
|
embedId: activeSessionScope.embedId,
|
|
21490
21635
|
ownerDocument,
|
|
21491
21636
|
interactionBoundaryService,
|
|
@@ -21495,12 +21640,12 @@ function EditorContainer({ hidden = false }) {
|
|
|
21495
21640
|
let delayedFocusTimer;
|
|
21496
21641
|
const focusCellEditorElement = () => {
|
|
21497
21642
|
if (shouldPreserveEmbedInteractiveFocus(activeSessionScope.embedId, ownerDocument)) return;
|
|
21498
|
-
focusSheetCellEditorElement(
|
|
21643
|
+
focusSheetCellEditorElement(editorService);
|
|
21499
21644
|
if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
|
|
21500
21645
|
delayedFocusTimer = ownerWindow.setTimeout(() => {
|
|
21501
21646
|
delayedFocusTimer = void 0;
|
|
21502
21647
|
if (shouldPreserveEmbedInteractiveFocus(activeSessionScope.embedId, ownerDocument)) return;
|
|
21503
|
-
focusSheetCellEditorElement(
|
|
21648
|
+
focusSheetCellEditorElement(editorService);
|
|
21504
21649
|
}, 0);
|
|
21505
21650
|
};
|
|
21506
21651
|
const focusHiddenEditor = () => {
|
|
@@ -21548,9 +21693,9 @@ function EditorContainer({ hidden = false }) {
|
|
|
21548
21693
|
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
21549
21694
|
]);
|
|
21550
21695
|
(0, react.useEffect)(() => {
|
|
21696
|
+
var _rootRef$current3;
|
|
21697
|
+
const ownerWindow = (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.ownerDocument.defaultView;
|
|
21551
21698
|
return () => {
|
|
21552
|
-
var _rootRef$current3;
|
|
21553
|
-
const ownerWindow = (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.ownerDocument.defaultView;
|
|
21554
21699
|
if (ownerWindow && pointerRefocusTimerRef.current != null) ownerWindow.clearTimeout(pointerRefocusTimerRef.current);
|
|
21555
21700
|
};
|
|
21556
21701
|
}, []);
|
|
@@ -21572,12 +21717,11 @@ function EditorContainer({ hidden = false }) {
|
|
|
21572
21717
|
if (pointerRefocusTimerRef.current != null) ownerWindow.clearTimeout(pointerRefocusTimerRef.current);
|
|
21573
21718
|
pointerRefocusTimerRef.current = ownerWindow.setTimeout(() => {
|
|
21574
21719
|
pointerRefocusTimerRef.current = void 0;
|
|
21575
|
-
|
|
21576
|
-
focusSheetCellEditorElement(ownerDocument);
|
|
21720
|
+
focusSheetCellEditorElement(editorService);
|
|
21577
21721
|
}, 0);
|
|
21578
21722
|
});
|
|
21579
21723
|
const handleClickSideBar = (0, _univerjs_ui.useEvent)(() => {
|
|
21580
|
-
if (editorBridgeService.isVisible().visible) commandService.executeCommand(SetCellEditVisibleOperation.id, {
|
|
21724
|
+
if (editorBridgeService.isVisible().visible) return commandService.executeCommand(SetCellEditVisibleOperation.id, {
|
|
21581
21725
|
visible: false,
|
|
21582
21726
|
eventType: _univerjs_engine_render.DeviceInputEventType.PointerUp,
|
|
21583
21727
|
unitId: editState === null || editState === void 0 ? void 0 : editState.unitId
|
|
@@ -21586,7 +21730,7 @@ function EditorContainer({ hidden = false }) {
|
|
|
21586
21730
|
(0, _univerjs_ui.useSidebarClick)(handleClickSideBar);
|
|
21587
21731
|
const keyCodeConfig = useKeyEventConfig(editState === null || editState === void 0 ? void 0 : editState.unitId);
|
|
21588
21732
|
const onMoveInEditor = (0, _univerjs_ui.useEvent)((keycode, metaKey) => {
|
|
21589
|
-
commandService.executeCommand(SetCellEditVisibleArrowOperation.id, {
|
|
21733
|
+
return commandService.executeCommand(SetCellEditVisibleArrowOperation.id, {
|
|
21590
21734
|
keycode,
|
|
21591
21735
|
visible: false,
|
|
21592
21736
|
eventType: _univerjs_engine_render.DeviceInputEventType.Keyboard,
|
|
@@ -21606,41 +21750,51 @@ function EditorContainer({ hidden = false }) {
|
|
|
21606
21750
|
height: state.height,
|
|
21607
21751
|
opacity: hidden ? 0 : void 0,
|
|
21608
21752
|
pointerEvents: hidden ? "none" : void 0,
|
|
21609
|
-
backgroundColor:
|
|
21610
|
-
darkMode,
|
|
21611
|
-
getColorFromTheme: themeService.getColorFromTheme.bind(themeService)
|
|
21612
|
-
})
|
|
21753
|
+
backgroundColor: editorBackgroundColor
|
|
21613
21754
|
},
|
|
21614
|
-
children: [
|
|
21615
|
-
|
|
21616
|
-
|
|
21617
|
-
|
|
21618
|
-
|
|
21619
|
-
|
|
21620
|
-
|
|
21621
|
-
|
|
21622
|
-
|
|
21623
|
-
|
|
21624
|
-
|
|
21625
|
-
|
|
21626
|
-
|
|
21627
|
-
|
|
21628
|
-
|
|
21629
|
-
|
|
21630
|
-
|
|
21631
|
-
|
|
21632
|
-
|
|
21633
|
-
|
|
21634
|
-
|
|
21635
|
-
|
|
21636
|
-
|
|
21637
|
-
|
|
21638
|
-
|
|
21639
|
-
|
|
21640
|
-
|
|
21641
|
-
|
|
21642
|
-
|
|
21643
|
-
|
|
21755
|
+
children: [
|
|
21756
|
+
(visible === null || visible === void 0 ? void 0 : visible.visible) && showEditCellAddress && editCellAddress && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21757
|
+
"data-u-comp": "sheet-cell-editor-address",
|
|
21758
|
+
className: "univer-pointer-events-none univer-absolute univer-left-0 univer-top-0 univer-z-10 univer-whitespace-nowrap univer-rounded-t univer-px-1.5 univer-text-xs univer-leading-5",
|
|
21759
|
+
style: {
|
|
21760
|
+
backgroundColor: editorBorderColor,
|
|
21761
|
+
color: themeService.getColorFromTheme("gray.0"),
|
|
21762
|
+
transform: "translateY(-100%)"
|
|
21763
|
+
},
|
|
21764
|
+
children: editCellAddress
|
|
21765
|
+
}),
|
|
21766
|
+
FormulaEditor && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormulaEditor, {
|
|
21767
|
+
editorId: _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
21768
|
+
className: "univer-relative univer-flex univer-size-full [&_canvas]:univer-absolute",
|
|
21769
|
+
initValue: "",
|
|
21770
|
+
onChange: () => {},
|
|
21771
|
+
isFocus: !hidden && (visible === null || visible === void 0 ? void 0 : visible.visible),
|
|
21772
|
+
unitId: editState === null || editState === void 0 ? void 0 : editState.unitId,
|
|
21773
|
+
subUnitId: editState === null || editState === void 0 ? void 0 : editState.sheetId,
|
|
21774
|
+
keyboardEventConfig: keyCodeConfig,
|
|
21775
|
+
onMoveInEditor,
|
|
21776
|
+
isSupportAcrossSheet: true,
|
|
21777
|
+
resetSelectionOnBlur: false,
|
|
21778
|
+
isSingle: false,
|
|
21779
|
+
autoScrollbar: false,
|
|
21780
|
+
borderless: true,
|
|
21781
|
+
onFormulaSelectingChange: (isSelecting) => {
|
|
21782
|
+
if (isSelecting) editorBridgeService.enableForceKeepVisible();
|
|
21783
|
+
else editorBridgeService.disableForceKeepVisible();
|
|
21784
|
+
},
|
|
21785
|
+
disableContextMenu: false,
|
|
21786
|
+
canvasStyle: { backgroundColor: "transparent" }
|
|
21787
|
+
}),
|
|
21788
|
+
(visible === null || visible === void 0 ? void 0 : visible.visible) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21789
|
+
"aria-hidden": true,
|
|
21790
|
+
className: "univer-pointer-events-none univer-absolute univer-left-0 univer-top-0 univer-z-10 univer-box-border",
|
|
21791
|
+
style: {
|
|
21792
|
+
width: state.width + editorBorderWidth,
|
|
21793
|
+
height: state.height + editorBorderWidth,
|
|
21794
|
+
border: `${editorBorderWidth}px solid ${editorBorderColor}`
|
|
21795
|
+
}
|
|
21796
|
+
})
|
|
21797
|
+
]
|
|
21644
21798
|
});
|
|
21645
21799
|
}
|
|
21646
21800
|
|
|
@@ -21685,7 +21839,7 @@ function getAbsoluteRefStringFromSelection(workbook, selections, lexerTreeBuilde
|
|
|
21685
21839
|
|
|
21686
21840
|
//#endregion
|
|
21687
21841
|
//#region src/views/defined-name/DefinedNameOverlay.tsx
|
|
21688
|
-
function DefinedNameOverlay({ search, isInputEvent }) {
|
|
21842
|
+
function DefinedNameOverlay({ search, isInputEvent, onClose }) {
|
|
21689
21843
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
21690
21844
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
21691
21845
|
const definedNamesService = (0, _univerjs_ui.useDependency)(_univerjs_engine_formula.IDefinedNamesService);
|
|
@@ -21729,8 +21883,9 @@ function DefinedNameOverlay({ search, isInputEvent }) {
|
|
|
21729
21883
|
itemHeight: 30,
|
|
21730
21884
|
overscan: 6
|
|
21731
21885
|
});
|
|
21732
|
-
const openSlider = () => {
|
|
21733
|
-
|
|
21886
|
+
const openSlider = async () => {
|
|
21887
|
+
onClose();
|
|
21888
|
+
await commandService.executeCommand(SidebarDefinedNameOperation.id, { value: "open" });
|
|
21734
21889
|
};
|
|
21735
21890
|
const focusDefinedName = async (definedName) => {
|
|
21736
21891
|
const { formulaOrRefString, id } = definedName;
|
|
@@ -21755,8 +21910,9 @@ function DefinedNameOverlay({ search, isInputEvent }) {
|
|
|
21755
21910
|
children: virtualDefinedNames.map(({ data: definedName, index }) => {
|
|
21756
21911
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
21757
21912
|
className: "univer-cursor-pointer univer-px-2 univer-transition-colors univer-duration-200 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-600",
|
|
21758
|
-
onClick: () => {
|
|
21759
|
-
|
|
21913
|
+
onClick: async () => {
|
|
21914
|
+
onClose();
|
|
21915
|
+
await focusDefinedName(definedName);
|
|
21760
21916
|
},
|
|
21761
21917
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
21762
21918
|
"data-u-comp": "defined-name-overlay-row",
|
|
@@ -21810,6 +21966,7 @@ function DefinedName({ disable }) {
|
|
|
21810
21966
|
const themeService = (0, _univerjs_ui.useDependency)(_univerjs_core.ThemeService);
|
|
21811
21967
|
const [open, setOpen] = (0, react.useState)(false);
|
|
21812
21968
|
const [isInputEvent, setIsInputEvent] = (0, react.useState)(false);
|
|
21969
|
+
const nameBoxRef = (0, react.useRef)(null);
|
|
21813
21970
|
const inputRef = (0, react.useRef)(null);
|
|
21814
21971
|
const getDefinedNameMap = () => {
|
|
21815
21972
|
const definedNameMap = definedNamesService.getDefinedNameMap(unitId);
|
|
@@ -21962,6 +22119,7 @@ function DefinedName({ disable }) {
|
|
|
21962
22119
|
return selections;
|
|
21963
22120
|
}
|
|
21964
22121
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
22122
|
+
ref: nameBoxRef,
|
|
21965
22123
|
"data-u-comp": "defined-name",
|
|
21966
22124
|
className: "univer-relative univer-box-border univer-flex univer-h-full univer-w-24 univer-border-r-gray-200 univer-py-1.5 univer-transition-all",
|
|
21967
22125
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
@@ -21973,11 +22131,14 @@ function DefinedName({ disable }) {
|
|
|
21973
22131
|
onKeyDown: handleKeyDown,
|
|
21974
22132
|
onBlur: () => setIsInputEvent(false)
|
|
21975
22133
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
22134
|
+
align: "start",
|
|
22135
|
+
anchorRef: nameBoxRef,
|
|
21976
22136
|
overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21977
22137
|
className: "univer-z-[1001]",
|
|
21978
22138
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefinedNameOverlay, {
|
|
21979
22139
|
search: inputValue,
|
|
21980
|
-
isInputEvent
|
|
22140
|
+
isInputEvent,
|
|
22141
|
+
onClose: () => setOpen(false)
|
|
21981
22142
|
})
|
|
21982
22143
|
}),
|
|
21983
22144
|
disabled: disable,
|
|
@@ -24855,7 +25016,7 @@ const useHighlightRange = (ranges = []) => {
|
|
|
24855
25016
|
//#endregion
|
|
24856
25017
|
//#region package.json
|
|
24857
25018
|
var name = "@univerjs/sheets-ui";
|
|
24858
|
-
var version = "1.0.
|
|
25019
|
+
var version = "1.0.4";
|
|
24859
25020
|
|
|
24860
25021
|
//#endregion
|
|
24861
25022
|
//#region src/views/cell-popup/config.ts
|
|
@@ -25482,16 +25643,20 @@ let FormatPainterController = class FormatPainterController extends _univerjs_co
|
|
|
25482
25643
|
_initialize() {
|
|
25483
25644
|
this._addDefaultHook();
|
|
25484
25645
|
const session = this._injector.get(_univerjs_ui.FormatPainterSessionService);
|
|
25646
|
+
let disabled = true;
|
|
25647
|
+
const disabled$ = this._injector.invoke(ClearSelectionFormatMenuItemFactory).disabled$;
|
|
25485
25648
|
this.disposeWithMe(session.register({
|
|
25486
25649
|
id: "sheet-cells",
|
|
25487
25650
|
priority: 0,
|
|
25488
25651
|
clear: () => this._commandService.executeCommand(_univerjs_sheets.ClearSelectionFormatCommand.id),
|
|
25489
|
-
changes$:
|
|
25652
|
+
changes$: disabled$.pipe((0, rxjs.tap)((value) => {
|
|
25653
|
+
disabled = value;
|
|
25654
|
+
})),
|
|
25490
25655
|
isActive: () => {
|
|
25491
25656
|
var _this$_univerInstance;
|
|
25492
25657
|
return ((_this$_univerInstance = this._univerInstanceService.getFocusedUnit()) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.type) === _univerjs_core.UniverInstanceType.UNIVER_SHEET;
|
|
25493
25658
|
},
|
|
25494
|
-
canStart: () => !!this._selectionManagerService.getCurrentLastSelection(),
|
|
25659
|
+
canStart: () => !disabled && !!this._selectionManagerService.getCurrentLastSelection(),
|
|
25495
25660
|
capture: () => {
|
|
25496
25661
|
const workbook = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
25497
25662
|
const format = this._collectSelectionRangeFormat();
|
|
@@ -26429,6 +26594,66 @@ const BorderDashed = ({ className }) => /* @__PURE__ */ (0, react_jsx_runtime.js
|
|
|
26429
26594
|
]
|
|
26430
26595
|
});
|
|
26431
26596
|
|
|
26597
|
+
//#endregion
|
|
26598
|
+
//#region src/views/border-panel/border-line/icons/BorderDotted.tsx
|
|
26599
|
+
/**
|
|
26600
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
26601
|
+
*
|
|
26602
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
26603
|
+
* you may not use this file except in compliance with the License.
|
|
26604
|
+
* You may obtain a copy of the License at
|
|
26605
|
+
*
|
|
26606
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
26607
|
+
*
|
|
26608
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
26609
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
26610
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26611
|
+
* See the License for the specific language governing permissions and
|
|
26612
|
+
* limitations under the License.
|
|
26613
|
+
*/
|
|
26614
|
+
const BorderDotted = ({ className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
26615
|
+
className,
|
|
26616
|
+
width: "120",
|
|
26617
|
+
height: "2",
|
|
26618
|
+
viewBox: "0 0 120 2",
|
|
26619
|
+
fill: "none",
|
|
26620
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
26621
|
+
children: [
|
|
26622
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M0.491699 1.69537H1.4917V0.695374H0.491699V1.69537Z" }),
|
|
26623
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4.2981 1.69537H5.2981V0.695374H4.2981V1.69537Z" }),
|
|
26624
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9.10449 1.69537H8.10449V0.695374H9.10449V1.69537Z" }),
|
|
26625
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M11.9109 1.69537H12.9109V0.695374H11.9109V1.69537Z" }),
|
|
26626
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M16.7173 1.69537H15.7173V0.695374H16.7173V1.69537Z" }),
|
|
26627
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M19.5237 1.69537H20.5237V0.695374H19.5237V1.69537Z" }),
|
|
26628
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M24.3301 1.69537H23.3301V0.695374H24.3301V1.69537Z" }),
|
|
26629
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M27.1365 1.69537H28.1365V0.695374H27.1365V1.69537Z" }),
|
|
26630
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M31.9429 1.69537H30.9429V0.695374H31.9429V1.69537Z" }),
|
|
26631
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M34.7493 1.69537H35.7493V0.695374H34.7493V1.69537Z" }),
|
|
26632
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M39.5557 1.69537H38.5557V0.695374H39.5557V1.69537Z" }),
|
|
26633
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M42.3621 1.69537H43.3621V0.695374H42.3621V1.69537Z" }),
|
|
26634
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M47.1685 1.69537H46.1685V0.695374H47.1685V1.69537Z" }),
|
|
26635
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M49.9749 1.69537H50.9749V0.695374H49.9749V1.69537Z" }),
|
|
26636
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M54.7812 1.69537H53.7812V0.695374H54.7812V1.69537Z" }),
|
|
26637
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M57.5876 1.69537H58.5876V0.695374H57.5876V1.69537Z" }),
|
|
26638
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M62.394 1.69537H61.394V0.695374H62.394V1.69537Z" }),
|
|
26639
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M65.2004 1.69537H66.2004V0.695374H65.2004V1.69537Z" }),
|
|
26640
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M70.0068 1.69537H69.0068V0.695374H70.0068V1.69537Z" }),
|
|
26641
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M72.8132 1.69537H73.8132V0.695374H72.8132V1.69537Z" }),
|
|
26642
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M77.6196 1.69537H76.6196V0.695374H77.6196V1.69537Z" }),
|
|
26643
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M80.426 1.69537H81.426V0.695374H80.426V1.69537Z" }),
|
|
26644
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M85.2324 1.69537H84.2324V0.695374H85.2324V1.69537Z" }),
|
|
26645
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M88.0388 1.69537H89.0388V0.695374H88.0388V1.69537Z" }),
|
|
26646
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M92.8452 1.69537H91.8452V0.695374H92.8452V1.69537Z" }),
|
|
26647
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M95.6516 1.69537H96.6516V0.695374H95.6516V1.69537Z" }),
|
|
26648
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M100.458 1.69537H99.458V0.695374H100.458V1.69537Z" }),
|
|
26649
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M103.264 1.69537H104.264V0.695374H103.264V1.69537Z" }),
|
|
26650
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M108.071 1.69537H107.071V0.695374H108.071V1.69537Z" }),
|
|
26651
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M110.877 1.69537H111.877V0.695374H110.877V1.69537Z" }),
|
|
26652
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M115.684 1.69537H114.684V0.695374H115.684V1.69537Z" }),
|
|
26653
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M118.49 1.69537H119.49V0.695374H118.49V1.69537Z" })
|
|
26654
|
+
]
|
|
26655
|
+
});
|
|
26656
|
+
|
|
26432
26657
|
//#endregion
|
|
26433
26658
|
//#region src/views/border-panel/border-line/icons/BorderDouble.tsx
|
|
26434
26659
|
/**
|
|
@@ -26802,6 +27027,7 @@ function BorderLine(props) {
|
|
|
26802
27027
|
case _univerjs_core.BorderStyleTypes.DASH_DOT: return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderDashDot, { className });
|
|
26803
27028
|
case _univerjs_core.BorderStyleTypes.DASH_DOT_DOT: return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderDashDotDot, { className });
|
|
26804
27029
|
case _univerjs_core.BorderStyleTypes.DASHED: return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderDashed, { className });
|
|
27030
|
+
case _univerjs_core.BorderStyleTypes.DOTTED: return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderDotted, { className });
|
|
26805
27031
|
case _univerjs_core.BorderStyleTypes.HAIR: return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderHair, { className });
|
|
26806
27032
|
case _univerjs_core.BorderStyleTypes.MEDIUM: return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderMedium, { className });
|
|
26807
27033
|
case _univerjs_core.BorderStyleTypes.MEDIUM_DASH_DOT: return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderMediumDashDot, { className });
|
|
@@ -26816,31 +27042,21 @@ function BorderLine(props) {
|
|
|
26816
27042
|
|
|
26817
27043
|
//#endregion
|
|
26818
27044
|
//#region src/views/border-panel/BorderPanel.tsx
|
|
26819
|
-
function getBorderColor(borderData) {
|
|
26820
|
-
if (!borderData) return;
|
|
26821
|
-
for (const key in borderData) {
|
|
26822
|
-
var _border$cl;
|
|
26823
|
-
const border = borderData[key];
|
|
26824
|
-
if (border === null || border === void 0 || (_border$cl = border.cl) === null || _border$cl === void 0 ? void 0 : _border$cl.rgb) return border.cl.rgb;
|
|
26825
|
-
}
|
|
26826
|
-
}
|
|
26827
|
-
function getBorderStyle(borderData) {
|
|
26828
|
-
if (!borderData) return;
|
|
26829
|
-
for (const key in borderData) {
|
|
26830
|
-
var _border$cl2;
|
|
26831
|
-
const border = borderData[key];
|
|
26832
|
-
if (border === null || border === void 0 || (_border$cl2 = border.cl) === null || _border$cl2 === void 0 ? void 0 : _border$cl2.rgb) return border.s;
|
|
26833
|
-
}
|
|
26834
|
-
}
|
|
26835
27045
|
function BorderPanel(props) {
|
|
26836
27046
|
const iconManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.IconManager);
|
|
26837
|
-
const borderStyleManagerService = (0, _univerjs_ui.useDependency)(_univerjs_sheets.BorderStyleManagerService);
|
|
26838
27047
|
const selectionManagerService = (0, _univerjs_ui.useDependency)(_univerjs_sheets.SheetsSelectionsService);
|
|
26839
27048
|
const { direction } = (0, react.useContext)(_univerjs_design.ConfigContext);
|
|
26840
27049
|
const { isAllValuesSame, value: currentValue } = selectionManagerService.getCellStylesProperty("bd");
|
|
26841
27050
|
const color = isAllValuesSame ? getBorderColor(currentValue) : void 0;
|
|
26842
|
-
const type = isAllValuesSame ? getBorderStyle(currentValue) : void 0;
|
|
26843
27051
|
const { onChange, value, ColorPickerComponent = _univerjs_design.ColorPicker, DropdownComponent = _univerjs_design.Dropdown } = props;
|
|
27052
|
+
function getBorderColor(borderData) {
|
|
27053
|
+
if (!borderData) return;
|
|
27054
|
+
for (const key in borderData) {
|
|
27055
|
+
var _border$cl;
|
|
27056
|
+
const border = borderData[key];
|
|
27057
|
+
if (border === null || border === void 0 || (_border$cl = border.cl) === null || _border$cl === void 0 ? void 0 : _border$cl.rgb) return border.cl.rgb;
|
|
27058
|
+
}
|
|
27059
|
+
}
|
|
26844
27060
|
function handleClick(v, type) {
|
|
26845
27061
|
onChange === null || onChange === void 0 || onChange({
|
|
26846
27062
|
...value,
|
|
@@ -26858,7 +27074,7 @@ function BorderPanel(props) {
|
|
|
26858
27074
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
26859
27075
|
className: "univer-box-border univer-grid univer-grid-cols-5 univer-gap-2 univer-text-gray-600 dark:!univer-text-gray-200",
|
|
26860
27076
|
children: BORDER_LINE_CHILDREN.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
26861
|
-
className: (0, _univerjs_design.clsx)("univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-justify-self-center univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-200 dark:!univer-bg-gray-600":
|
|
27077
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-justify-self-center univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-200 dark:!univer-bg-gray-600": value.type === item.value }),
|
|
26862
27078
|
onClick: (e) => {
|
|
26863
27079
|
e.stopPropagation();
|
|
26864
27080
|
handleClick(item.value, "type");
|
|
@@ -26890,14 +27106,17 @@ function BorderPanel(props) {
|
|
|
26890
27106
|
className: "univer-rounded-lg univer-p-1.5",
|
|
26891
27107
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
26892
27108
|
className: "univer-m-0 univer-grid univer-list-none univer-gap-1 univer-p-0",
|
|
26893
|
-
children: BORDER_SIZE_CHILDREN.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.
|
|
26894
|
-
|
|
27109
|
+
children: BORDER_SIZE_CHILDREN.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
27110
|
+
type: "button",
|
|
27111
|
+
"aria-label": _univerjs_core.BorderStyleTypes[item.value],
|
|
27112
|
+
"aria-pressed": item.value === value.style,
|
|
27113
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-w-full univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-border-none univer-bg-transparent univer-px-1 univer-py-3 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-200 dark:!univer-bg-gray-600": item.value === value.style }),
|
|
26895
27114
|
onClick: () => handleClick(item.value, "style"),
|
|
26896
|
-
children:
|
|
26897
|
-
className: "univer-
|
|
27115
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderLine, {
|
|
27116
|
+
className: "univer-fill-gray-900 dark:!univer-fill-gray-0",
|
|
26898
27117
|
type: item.value
|
|
26899
|
-
})
|
|
26900
|
-
}, item.value))
|
|
27118
|
+
})
|
|
27119
|
+
}) }, item.value))
|
|
26901
27120
|
})
|
|
26902
27121
|
}),
|
|
26903
27122
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
@@ -26905,7 +27124,7 @@ function BorderPanel(props) {
|
|
|
26905
27124
|
type: "button",
|
|
26906
27125
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BorderLine, {
|
|
26907
27126
|
className: "univer-fill-gray-900 dark:!univer-fill-gray-0",
|
|
26908
|
-
type:
|
|
27127
|
+
type: value.style
|
|
26909
27128
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "dark:!univer-text-gray-0" })]
|
|
26910
27129
|
})
|
|
26911
27130
|
}) })]
|
|
@@ -28916,7 +29135,8 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
28916
29135
|
let body = _univerjs_core.Tools.deepClone((_param$documentLayout = param.documentLayoutObject.documentModel) === null || _param$documentLayout === void 0 ? void 0 : _param$documentLayout.getBody());
|
|
28917
29136
|
const drawings = _univerjs_core.Tools.deepClone((_param$documentLayout2 = param.documentLayoutObject.documentModel) === null || _param$documentLayout2 === void 0 ? void 0 : _param$documentLayout2.drawings);
|
|
28918
29137
|
const drawingsOrder = _univerjs_core.Tools.deepClone((_param$documentLayout3 = param.documentLayoutObject.documentModel) === null || _param$documentLayout3 === void 0 ? void 0 : _param$documentLayout3.getDrawingsOrder());
|
|
28919
|
-
|
|
29138
|
+
const { visible } = this._editorBridgeService.isVisible();
|
|
29139
|
+
if (!body || param.isInArrayFormulaRange === true && visible) body = {
|
|
28920
29140
|
dataStream: "\r\n",
|
|
28921
29141
|
paragraphs: [{
|
|
28922
29142
|
startIndex: 0,
|
|
@@ -29054,7 +29274,7 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
29054
29274
|
...formulaEditorStyle,
|
|
29055
29275
|
pageSize: { ...formulaEditorStyle.pageSize },
|
|
29056
29276
|
renderConfig: { ...formulaEditorStyle.renderConfig },
|
|
29057
|
-
textStyle: { cl: { rgb: this.
|
|
29277
|
+
textStyle: { cl: { rgb: this._getFormulaBarTextColor() } }
|
|
29058
29278
|
};
|
|
29059
29279
|
else snapshot.documentStyle ??= {};
|
|
29060
29280
|
let renderConfig = snapshot.documentStyle.renderConfig;
|
|
@@ -29077,6 +29297,11 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
|
|
|
29077
29297
|
const isFocusFxBar = this._contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR);
|
|
29078
29298
|
renderConfig.isRenderStyle = isFormulaBar === isFocusFxBar ? _univerjs_core.BooleanNumber.TRUE : _univerjs_core.BooleanNumber.FALSE;
|
|
29079
29299
|
}
|
|
29300
|
+
_getFormulaBarTextColor() {
|
|
29301
|
+
var _this$_editorBridgeSe;
|
|
29302
|
+
const isInheritedFormula = ((_this$_editorBridgeSe = this._editorBridgeService.getEditLocation()) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.isInArrayFormulaRange) === true && !this._editorBridgeService.isVisible().visible;
|
|
29303
|
+
return this._themeService.getColorFromTheme(isInheritedFormula ? "gray.300" : "gray.900");
|
|
29304
|
+
}
|
|
29080
29305
|
_getSourceStyleRenderValue(isFormulaBar) {
|
|
29081
29306
|
return isFormulaBar ? _univerjs_core.BooleanNumber.FALSE : _univerjs_core.BooleanNumber.TRUE;
|
|
29082
29307
|
}
|
|
@@ -32743,10 +32968,14 @@ let MobileCellEditRenderController = class MobileCellEditRenderController extend
|
|
|
32743
32968
|
if (cell.location.unitId !== this._context.unitId) return;
|
|
32744
32969
|
const snapshot = (_this$_editorBridgeSe = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe === void 0 || (_this$_editorBridgeSe = _this$_editorBridgeSe.documentLayoutObject.documentModel) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.getSnapshot();
|
|
32745
32970
|
if ((0, _univerjs_sheets.isCellImage)(snapshot)) return;
|
|
32746
|
-
this._commandService.
|
|
32971
|
+
this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
|
|
32747
32972
|
visible: true,
|
|
32748
32973
|
eventType: _univerjs_engine_render.DeviceInputEventType.Dblclick,
|
|
32749
|
-
unitId: this._context.unitId
|
|
32974
|
+
unitId: this._context.unitId,
|
|
32975
|
+
pointerPosition: {
|
|
32976
|
+
x: cell.event.clientX,
|
|
32977
|
+
y: cell.event.clientY
|
|
32978
|
+
}
|
|
32750
32979
|
});
|
|
32751
32980
|
}));
|
|
32752
32981
|
this.disposeWithMe(hoverManagerService.currentPointerDownCell$.subscribe((cell) => {
|
|
@@ -33179,7 +33408,7 @@ let MobileHoverRenderController = class MobileHoverRenderController extends _uni
|
|
|
33179
33408
|
return;
|
|
33180
33409
|
}
|
|
33181
33410
|
this._resetCompletedTap();
|
|
33182
|
-
this._hoverManagerService.triggerDbClick(unitId, event
|
|
33411
|
+
this._hoverManagerService.triggerDbClick(unitId, event);
|
|
33183
33412
|
},
|
|
33184
33413
|
priority: -1
|
|
33185
33414
|
}));
|
|
@@ -33255,7 +33484,7 @@ let MobileHoverRenderController = class MobileHoverRenderController extends _uni
|
|
|
33255
33484
|
this._suppressEngineDoubleClick = false;
|
|
33256
33485
|
this._suppressEngineDoubleClickTimer = null;
|
|
33257
33486
|
});
|
|
33258
|
-
this._hoverManagerService.triggerDbClick(unitId, event
|
|
33487
|
+
this._hoverManagerService.triggerDbClick(unitId, event);
|
|
33259
33488
|
return;
|
|
33260
33489
|
}
|
|
33261
33490
|
this._resetCompletedTap();
|
|
@@ -35263,20 +35492,22 @@ const ISheetHostChromeOverrideService = (0, _univerjs_core.createIdentifier)("sh
|
|
|
35263
35492
|
//#endregion
|
|
35264
35493
|
//#region src/controllers/render-controllers/contextmenu.render-controller.ts
|
|
35265
35494
|
let SheetContextMenuRenderController = class SheetContextMenuRenderController extends _univerjs_core.Disposable {
|
|
35266
|
-
constructor(_context, _contextMenuService, _selectionManagerService, _selectionRenderService, _injector) {
|
|
35495
|
+
constructor(_context, _contextMenuService, _selectionManagerService, _selectionRenderService, _injector, _platformService, _contextService) {
|
|
35267
35496
|
super();
|
|
35268
35497
|
this._context = _context;
|
|
35269
35498
|
this._contextMenuService = _contextMenuService;
|
|
35270
35499
|
this._selectionManagerService = _selectionManagerService;
|
|
35271
35500
|
this._selectionRenderService = _selectionRenderService;
|
|
35272
35501
|
this._injector = _injector;
|
|
35502
|
+
this._platformService = _platformService;
|
|
35503
|
+
this._contextService = _contextService;
|
|
35273
35504
|
this._init();
|
|
35274
35505
|
this._initEmbedRuntimeSessionListener();
|
|
35275
35506
|
}
|
|
35276
35507
|
_init() {
|
|
35277
35508
|
var _this$_context;
|
|
35278
35509
|
const spreadsheetSubscription = ((_this$_context = this._context) === null || _this$_context === void 0 || (_this$_context = _this$_context.mainComponent) === null || _this$_context === void 0 ? void 0 : _this$_context.onPointerDown$).subscribeEvent((event) => {
|
|
35279
|
-
if (event
|
|
35510
|
+
if (this._isContextMenuGesture(event)) {
|
|
35280
35511
|
const selections = this._selectionManagerService.getCurrentSelections();
|
|
35281
35512
|
const currentSelection = selections === null || selections === void 0 ? void 0 : selections[0];
|
|
35282
35513
|
if (!currentSelection) return;
|
|
@@ -35306,20 +35537,23 @@ let SheetContextMenuRenderController = class SheetContextMenuRenderController ex
|
|
|
35306
35537
|
this.disposeWithMe(spreadsheetSubscription);
|
|
35307
35538
|
const spreadsheetColumnHeader = this._context.components.get("__SpreadsheetColumnHeader__");
|
|
35308
35539
|
const rowHeaderSub = this._context.components.get("__SpreadsheetRowHeader__").onPointerDown$.subscribeEvent((event) => {
|
|
35309
|
-
if (event
|
|
35540
|
+
if (this._isContextMenuGesture(event)) {
|
|
35310
35541
|
if (this._shouldSuppressHostContextMenu()) return;
|
|
35311
35542
|
this._contextMenuService.triggerContextMenu(event, _univerjs_ui.ContextMenuPosition.ROW_HEADER);
|
|
35312
35543
|
}
|
|
35313
35544
|
});
|
|
35314
35545
|
this.disposeWithMe(rowHeaderSub);
|
|
35315
35546
|
const colHeaderObserver = spreadsheetColumnHeader.onPointerDown$.subscribeEvent((event) => {
|
|
35316
|
-
if (event
|
|
35547
|
+
if (this._isContextMenuGesture(event)) {
|
|
35317
35548
|
if (this._shouldSuppressHostContextMenu()) return;
|
|
35318
35549
|
this._contextMenuService.triggerContextMenu(event, _univerjs_ui.ContextMenuPosition.COL_HEADER);
|
|
35319
35550
|
}
|
|
35320
35551
|
});
|
|
35321
35552
|
this.disposeWithMe(colHeaderObserver);
|
|
35322
35553
|
}
|
|
35554
|
+
_isContextMenuGesture(event) {
|
|
35555
|
+
return isSheetContextMenuGesture(event, this._platformService.isMac, this._contextService.getContextValue(_univerjs_sheets.REF_SELECTIONS_ENABLED));
|
|
35556
|
+
}
|
|
35323
35557
|
_initEmbedRuntimeSessionListener() {
|
|
35324
35558
|
const runtimeFocusCoordinator = this._getSheetEmbedRuntimeFocusCoordinator();
|
|
35325
35559
|
if (!runtimeFocusCoordinator) return;
|
|
@@ -35342,7 +35576,9 @@ SheetContextMenuRenderController = __decorate([
|
|
|
35342
35576
|
__decorateParam(1, _univerjs_ui.IContextMenuService),
|
|
35343
35577
|
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetsSelectionsService)),
|
|
35344
35578
|
__decorateParam(3, ISheetSelectionRenderService),
|
|
35345
|
-
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_core.Injector))
|
|
35579
|
+
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
35580
|
+
__decorateParam(5, _univerjs_ui.IPlatformService),
|
|
35581
|
+
__decorateParam(6, _univerjs_core.IContextService)
|
|
35346
35582
|
], SheetContextMenuRenderController);
|
|
35347
35583
|
function shouldHideSheetHostContextMenuForEmbedSession(hostUnitId, activeScope) {
|
|
35348
35584
|
return (activeScope === null || activeScope === void 0 ? void 0 : activeScope.hostUnitId) === hostUnitId && activeScope.sessionMode !== "host-passive";
|
|
@@ -35354,7 +35590,7 @@ function shouldSuppressSheetContextMenuForEmbedOverride(hostUnitId, override) {
|
|
|
35354
35590
|
//#endregion
|
|
35355
35591
|
//#region src/controllers/render-controllers/desktop-cell-edit.render-controller.ts
|
|
35356
35592
|
let DesktopCellEditRenderController = class DesktopCellEditRenderController extends _univerjs_core.RxDisposable {
|
|
35357
|
-
constructor(_context, _instanceService, _commandService, _editorBridgeService, _selectionManagerService, _contextService, _renderManagerService, _embedRuntimeFocusCoordinator) {
|
|
35593
|
+
constructor(_context, _instanceService, _commandService, _editorBridgeService, _selectionManagerService, _contextService, _renderManagerService, _platformService, _embedRuntimeFocusCoordinator) {
|
|
35358
35594
|
super();
|
|
35359
35595
|
this._context = _context;
|
|
35360
35596
|
this._instanceService = _instanceService;
|
|
@@ -35363,6 +35599,7 @@ let DesktopCellEditRenderController = class DesktopCellEditRenderController exte
|
|
|
35363
35599
|
this._selectionManagerService = _selectionManagerService;
|
|
35364
35600
|
this._contextService = _contextService;
|
|
35365
35601
|
this._renderManagerService = _renderManagerService;
|
|
35602
|
+
this._platformService = _platformService;
|
|
35366
35603
|
this._embedRuntimeFocusCoordinator = _embedRuntimeFocusCoordinator;
|
|
35367
35604
|
_defineProperty(this, "_d", void 0);
|
|
35368
35605
|
this.disposeWithMe(this._instanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {
|
|
@@ -35390,13 +35627,17 @@ let DesktopCellEditRenderController = class DesktopCellEditRenderController exte
|
|
|
35390
35627
|
const { spreadsheet, spreadsheetColumnHeader, spreadsheetLeftTopPlaceholder, spreadsheetRowHeader } = sheetObject;
|
|
35391
35628
|
d.add(spreadsheet.onDblclick$.subscribeEvent((evt) => {
|
|
35392
35629
|
var _this$_editorBridgeSe;
|
|
35393
|
-
if (evt.
|
|
35630
|
+
if (isSheetContextMenuGesture(evt, this._platformService.isMac, this._contextService.getContextValue(_univerjs_sheets.REF_SELECTIONS_ENABLED))) return;
|
|
35394
35631
|
const snapshot = (_this$_editorBridgeSe = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe === void 0 || (_this$_editorBridgeSe = _this$_editorBridgeSe.documentLayoutObject.documentModel) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.getSnapshot();
|
|
35395
35632
|
if ((0, _univerjs_sheets.isCellImage)(snapshot)) return;
|
|
35396
|
-
this._commandService.
|
|
35633
|
+
this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
|
|
35397
35634
|
visible: true,
|
|
35398
35635
|
eventType: _univerjs_engine_render.DeviceInputEventType.Dblclick,
|
|
35399
|
-
unitId: this._context.unitId
|
|
35636
|
+
unitId: this._context.unitId,
|
|
35637
|
+
pointerPosition: {
|
|
35638
|
+
x: evt.clientX,
|
|
35639
|
+
y: evt.clientY
|
|
35640
|
+
}
|
|
35400
35641
|
});
|
|
35401
35642
|
}));
|
|
35402
35643
|
d.add(spreadsheet.onPointerDown$.subscribeEvent({
|
|
@@ -35525,7 +35766,8 @@ DesktopCellEditRenderController = __decorate([
|
|
|
35525
35766
|
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetsSelectionsService)),
|
|
35526
35767
|
__decorateParam(5, _univerjs_core.IContextService),
|
|
35527
35768
|
__decorateParam(6, _univerjs_engine_render.IRenderManagerService),
|
|
35528
|
-
__decorateParam(7,
|
|
35769
|
+
__decorateParam(7, _univerjs_ui.IPlatformService),
|
|
35770
|
+
__decorateParam(8, (0, _univerjs_core.Optional)(ISheetEmbedRuntimeFocusCoordinator))
|
|
35529
35771
|
], DesktopCellEditRenderController);
|
|
35530
35772
|
function resolvePointerEventPayload(payload) {
|
|
35531
35773
|
return Array.isArray(payload) ? payload[0] : payload;
|
|
@@ -35689,38 +35931,34 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
|
|
|
35689
35931
|
const { spreadsheetRowHeader, spreadsheetColumnHeader, spreadsheet, spreadsheetLeftTopPlaceholder } = sheetObject;
|
|
35690
35932
|
const { scene } = this._context;
|
|
35691
35933
|
this.disposeWithMe(spreadsheet === null || spreadsheet === void 0 ? void 0 : spreadsheet.onPointerDown$.subscribeEvent((evt, state) => {
|
|
35692
|
-
if (this.isSelectionDisabled()) return;
|
|
35693
|
-
if (this.inRefSelectionMode()) return;
|
|
35934
|
+
if (this.isSelectionDisabled() || this.inRefSelectionMode()) return;
|
|
35694
35935
|
this._onPointerDown(evt, spreadsheet.zIndex + 1, _univerjs_core.RANGE_TYPE.NORMAL, this._getActiveViewport(evt));
|
|
35695
|
-
if (evt
|
|
35936
|
+
if (!this._isContextMenuGesture(evt)) state.stopPropagation();
|
|
35696
35937
|
}));
|
|
35697
35938
|
this.disposeWithMe(spreadsheetRowHeader === null || spreadsheetRowHeader === void 0 ? void 0 : spreadsheetRowHeader.onPointerDown$.subscribeEvent((evt, state) => {
|
|
35698
|
-
if (this.isSelectionDisabled()) return;
|
|
35699
|
-
if (this.inRefSelectionMode()) return;
|
|
35939
|
+
if (this.isSelectionDisabled() || this.inRefSelectionMode()) return;
|
|
35700
35940
|
const skeleton = this._sheetSkeletonManagerService.getCurrentParam().skeleton;
|
|
35701
35941
|
const { row } = getCoordByOffset(evt.offsetX, evt.offsetY, scene, skeleton);
|
|
35702
35942
|
if (isThisRowSelected(this._workbookSelections.getCurrentSelections(), row)) return;
|
|
35703
35943
|
this._onPointerDown(evt, (spreadsheet.zIndex || 1) + 1, _univerjs_core.RANGE_TYPE.ROW, this._getActiveViewport(evt), _univerjs_engine_render.ScrollTimerType.Y);
|
|
35704
|
-
if (evt
|
|
35944
|
+
if (!this._isContextMenuGesture(evt)) state.stopPropagation();
|
|
35705
35945
|
}));
|
|
35706
35946
|
this.disposeWithMe(spreadsheetColumnHeader === null || spreadsheetColumnHeader === void 0 ? void 0 : spreadsheetColumnHeader.onPointerDown$.subscribeEvent((evt, state) => {
|
|
35707
|
-
if (this.isSelectionDisabled()) return;
|
|
35708
|
-
if (this.inRefSelectionMode()) return;
|
|
35947
|
+
if (this.isSelectionDisabled() || this.inRefSelectionMode()) return;
|
|
35709
35948
|
const skeleton = this._sheetSkeletonManagerService.getCurrentParam().skeleton;
|
|
35710
35949
|
const { column } = getCoordByOffset(evt.offsetX, evt.offsetY, scene, skeleton);
|
|
35711
35950
|
if (isThisColSelected(this._workbookSelections.getCurrentSelections(), column)) return;
|
|
35712
35951
|
this._onPointerDown(evt, (spreadsheet.zIndex || 1) + 1, _univerjs_core.RANGE_TYPE.COLUMN, this._getActiveViewport(evt), _univerjs_engine_render.ScrollTimerType.X);
|
|
35713
|
-
if (evt
|
|
35952
|
+
if (!this._isContextMenuGesture(evt)) state.stopPropagation();
|
|
35714
35953
|
}));
|
|
35715
35954
|
this.disposeWithMe(spreadsheetLeftTopPlaceholder === null || spreadsheetLeftTopPlaceholder === void 0 ? void 0 : spreadsheetLeftTopPlaceholder.onPointerDown$.subscribeEvent((evt, state) => {
|
|
35716
|
-
if (this.isSelectionDisabled()) return;
|
|
35717
|
-
if (this.inRefSelectionMode()) return;
|
|
35955
|
+
if (this.isSelectionDisabled() || this.inRefSelectionMode()) return;
|
|
35718
35956
|
this._reset();
|
|
35719
35957
|
const skeleton = this._sheetSkeletonManagerService.getCurrentParam().skeleton;
|
|
35720
35958
|
const selectionWithStyle = selectionDataForSelectAll(skeleton);
|
|
35721
35959
|
this._addSelectionControlByModelData(selectionWithStyle);
|
|
35722
35960
|
this.refreshSelectionMoveEnd();
|
|
35723
|
-
if (evt
|
|
35961
|
+
if (!this._isContextMenuGesture(evt)) state.stopPropagation();
|
|
35724
35962
|
}));
|
|
35725
35963
|
}
|
|
35726
35964
|
_initThemeChangeListener() {
|
|
@@ -35801,7 +36039,7 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
|
|
|
35801
36039
|
const sheetId = workbook.getActiveSheet().getSheetId();
|
|
35802
36040
|
if (selectionDataWithStyleList.length === 0) return;
|
|
35803
36041
|
const selectionWithStyles = selectionDataWithStyleList.map((selectionDataWithStyle) => (0, _univerjs_sheets.convertSelectionDataToRange)(selectionDataWithStyle));
|
|
35804
|
-
this._commandService.
|
|
36042
|
+
this._commandService.syncExecuteCommand(_univerjs_sheets.SetSelectionsOperation.id, {
|
|
35805
36043
|
unitId,
|
|
35806
36044
|
subUnitId: sheetId,
|
|
35807
36045
|
type,
|
|
@@ -35822,6 +36060,7 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
|
|
|
35822
36060
|
const prevSheetId = (_this$_skeleton = this._skeleton) === null || _this$_skeleton === void 0 || (_this$_skeleton = _this$_skeleton.worksheet) === null || _this$_skeleton === void 0 ? void 0 : _this$_skeleton.getSheetId();
|
|
35823
36061
|
this._changeRuntime(skeleton, scene, viewportMain);
|
|
35824
36062
|
if (prevSheetId !== skeleton.worksheet.getSheetId()) {
|
|
36063
|
+
this._reset();
|
|
35825
36064
|
const selections = this._workbookSelections.getCurrentSelections();
|
|
35826
36065
|
this._commandService.syncExecuteCommand(_univerjs_sheets.SetSelectionsOperation.id, {
|
|
35827
36066
|
unitId,
|
|
@@ -35856,11 +36095,10 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
|
|
|
35856
36095
|
this._rangeType = rangeType;
|
|
35857
36096
|
const skeleton = this._skeleton;
|
|
35858
36097
|
const scene = this._scene;
|
|
35859
|
-
|
|
36098
|
+
const viewportMain = scene === null || scene === void 0 ? void 0 : scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
36099
|
+
if (!scene || !skeleton || !viewportMain) return;
|
|
35860
36100
|
if (viewport) this._activeViewport = viewport;
|
|
35861
36101
|
const { offsetX: evtOffsetX, offsetY: evtOffsetY } = evt;
|
|
35862
|
-
const viewportMain = scene.getViewport(_univerjs_engine_render.SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
35863
|
-
if (!viewportMain) return;
|
|
35864
36102
|
const relativeCoords = scene.getCoordRelativeToViewport(_univerjs_engine_render.Vector2.FromArray([evtOffsetX, evtOffsetY]));
|
|
35865
36103
|
const { x: offsetX, y: offsetY } = relativeCoords;
|
|
35866
36104
|
this._startViewportPosX = offsetX;
|
|
@@ -35870,7 +36108,6 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
|
|
|
35870
36108
|
const selectCell = this._skeleton.getCellByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
35871
36109
|
if (!selectCell) return;
|
|
35872
36110
|
switch (rangeType) {
|
|
35873
|
-
case _univerjs_core.RANGE_TYPE.NORMAL: break;
|
|
35874
36111
|
case _univerjs_core.RANGE_TYPE.ROW:
|
|
35875
36112
|
selectCell.startColumn = 0;
|
|
35876
36113
|
selectCell.endColumn = this._skeleton.getColumnCount() - 1;
|
|
@@ -35897,6 +36134,11 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
|
|
|
35897
36134
|
selectionWithStyle.range.rangeType = rangeType;
|
|
35898
36135
|
const activeSelectionControl = this._updateSelectionControl(evt, selectionWithStyle);
|
|
35899
36136
|
if (!activeSelectionControl) return;
|
|
36137
|
+
if (this._isContextMenuGesture(evt)) {
|
|
36138
|
+
this._selectionMoveStart$.next(this.getSelectionDataWithStyle());
|
|
36139
|
+
this.endSelection();
|
|
36140
|
+
return;
|
|
36141
|
+
}
|
|
35900
36142
|
scene.disableObjectsEvent();
|
|
35901
36143
|
this._clearUpdatingListeners();
|
|
35902
36144
|
this._addEndingListeners();
|
|
@@ -35908,20 +36150,32 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
|
|
|
35908
36150
|
(_this$_scene$getEngin = this._scene.getEngine()) === null || _this$_scene$getEngin === void 0 || _this$_scene$getEngin.setCapture();
|
|
35909
36151
|
}
|
|
35910
36152
|
_updateSelectionControl(evt, selection) {
|
|
35911
|
-
const
|
|
36153
|
+
const selectionWithCoord = (0, _univerjs_sheets.attachSelectionWithCoord)(selection, this._skeleton);
|
|
36154
|
+
const cursorRange = selectionWithCoord.rangeWithCoord;
|
|
35912
36155
|
this._startRangeWhenPointerDown = { ...cursorRange };
|
|
35913
36156
|
const controls = this.getSelectionControls();
|
|
35914
36157
|
const isSelected = controls.some((control) => _univerjs_core.Rectangle.contains(control.model, cursorRange));
|
|
35915
|
-
if (evt
|
|
35916
|
-
if (evt.button === 0 && (evt
|
|
36158
|
+
if (this._isContextMenuGesture(evt) && isSelected) return;
|
|
36159
|
+
if (evt.button === 0 && !this._isContextMenuGesture(evt) && this._isMultiSelectModifier(evt) && !evt.shiftKey && !this._singleSelectionEnabled && this._rangeType === _univerjs_core.RANGE_TYPE.NORMAL && isSelected) this._selectionBeforeModifierClick = this.getSelectionDataWithStyle().map(_univerjs_sheets.convertSelectionDataToRange);
|
|
35917
36160
|
let activeControl = this.getActiveSelectionControl();
|
|
36161
|
+
if (activeControl && this._canAnimateSelection(evt, activeControl, cursorRange)) {
|
|
36162
|
+
activeControl.updateRangeBySelectionWithCoord(selectionWithCoord, this._skeleton, true);
|
|
36163
|
+
return activeControl;
|
|
36164
|
+
}
|
|
35918
36165
|
this._checkClearPreviousControls(evt);
|
|
35919
36166
|
const currentCell = activeControl === null || activeControl === void 0 ? void 0 : activeControl.model.currentCell;
|
|
35920
|
-
if (evt.shiftKey && currentCell && activeControl) this._makeSelectionByTwoCells(currentCell, cursorRange, this._skeleton, this._rangeType, activeControl);
|
|
36167
|
+
if (!this._isContextMenuGesture(evt) && evt.shiftKey && currentCell && activeControl) this._makeSelectionByTwoCells(currentCell, cursorRange, this._skeleton, this._rangeType, activeControl);
|
|
35921
36168
|
else activeControl = this.newSelectionControl(this._scene, this._skeleton, selection);
|
|
35922
36169
|
for (let i = 0; i < controls.length - 1; i++) controls[i].clearHighlight();
|
|
35923
36170
|
return activeControl;
|
|
35924
36171
|
}
|
|
36172
|
+
_canAnimateSelection(evt, control, target) {
|
|
36173
|
+
if (this.getSelectionControls().length !== 1 || this._rangeType !== _univerjs_core.RANGE_TYPE.NORMAL || this._remainLastEnabled || evt.button !== 0 || evt.ctrlKey || evt.metaKey || evt.shiftKey || evt.altKey) return false;
|
|
36174
|
+
const current = control.getCurrentCellInfo();
|
|
36175
|
+
if (!current || !_univerjs_core.Rectangle.equals(control.model, current)) return false;
|
|
36176
|
+
const freeze = this._skeleton.worksheet.getFreeze();
|
|
36177
|
+
return current.startRow < freeze.startRow === target.startRow < freeze.startRow && current.startColumn < freeze.startColumn === target.startColumn < freeze.startColumn;
|
|
36178
|
+
}
|
|
35925
36179
|
endSelection() {
|
|
35926
36180
|
const previousSelections = this._selectionBeforeModifierClick;
|
|
35927
36181
|
this._selectionBeforeModifierClick = null;
|
|
@@ -36162,6 +36416,7 @@ Object.defineProperty(exports, 'CellPopupManagerService', {
|
|
|
36162
36416
|
});
|
|
36163
36417
|
exports.ChangeSheetProtectionFromSheetBarCommand = ChangeSheetProtectionFromSheetBarCommand;
|
|
36164
36418
|
exports.ChangeZoomRatioCommand = ChangeZoomRatioCommand;
|
|
36419
|
+
exports.DEFINED_NAME_CONTAINER = DEFINED_NAME_CONTAINER;
|
|
36165
36420
|
exports.DeleteRangeMoveLeftConfirmCommand = DeleteRangeMoveLeftConfirmCommand;
|
|
36166
36421
|
exports.DeleteRangeMoveUpConfirmCommand = DeleteRangeMoveUpConfirmCommand;
|
|
36167
36422
|
exports.DeleteRangeProtectionFromContextMenuCommand = DeleteRangeProtectionFromContextMenuCommand;
|