@univerjs/sheets-ui 1.0.0-alpha.5 → 1.0.0-alpha.7
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 +352 -218
- package/lib/es/index.js +352 -218
- package/lib/index.css +4 -0
- package/lib/index.js +352 -218
- package/lib/types/controllers/auto-fill-ui.controller.d.ts +18 -6
- package/lib/types/controllers/permission/sheet-permission-check-ui.controller.d.ts +2 -4
- package/lib/types/controllers/render-controllers/editor-bridge.render-controller.d.ts +1 -0
- package/lib/types/views/sheet-slider/SheetZoomInput.d.ts +1 -1
- package/lib/umd/index.js +11 -11
- package/package.json +14 -14
package/lib/cjs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
let _univerjs_docs_ui = require("@univerjs/docs-ui");
|
|
3
3
|
let _univerjs_core = require("@univerjs/core");
|
|
4
|
+
let _univerjs_sheets = require("@univerjs/sheets");
|
|
4
5
|
let _univerjs_ui = require("@univerjs/ui");
|
|
5
6
|
let _univerjs_engine_render = require("@univerjs/engine-render");
|
|
6
|
-
let _univerjs_sheets = require("@univerjs/sheets");
|
|
7
7
|
let rxjs = require("rxjs");
|
|
8
8
|
let _univerjs_docs = require("@univerjs/docs");
|
|
9
9
|
let _univerjs_protocol = require("@univerjs/protocol");
|
|
@@ -687,6 +687,10 @@ var BaseSelectionRenderService = class extends _univerjs_core.Disposable {
|
|
|
687
687
|
const startViewport = scene.getActiveViewportByCoord(_univerjs_engine_render.Vector2.FromArray([moveStartPosX, moveStartPosY]));
|
|
688
688
|
this._scenePointerMoveSub = scene.onPointerMove$.subscribeEvent((moveEvt) => {
|
|
689
689
|
var _scene$getActiveViewp;
|
|
690
|
+
if (moveEvt.buttons === 0) {
|
|
691
|
+
this.endSelection();
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
690
694
|
const { offsetX: moveOffsetX, offsetY: moveOffsetY } = moveEvt;
|
|
691
695
|
const { x: newMoveOffsetX, y: newMoveOffsetY } = scene.getCoordRelativeToViewport(_univerjs_engine_render.Vector2.FromArray([moveOffsetX, moveOffsetY]));
|
|
692
696
|
this._movingHandler(newMoveOffsetX, newMoveOffsetY, activeSelectionControl, rangeType);
|
|
@@ -5064,6 +5068,7 @@ const SheetCopyCommand = {
|
|
|
5064
5068
|
priority: SHEET_CLIPBOARD_PRIORITY,
|
|
5065
5069
|
preconditions: whenSheetFocused,
|
|
5066
5070
|
handler: async (accessor) => {
|
|
5071
|
+
checkSheetClipboardPermission(accessor, _univerjs_ui.CopyCommand.id);
|
|
5067
5072
|
return accessor.get(ISheetClipboardService).copy();
|
|
5068
5073
|
}
|
|
5069
5074
|
};
|
|
@@ -5075,6 +5080,7 @@ const SheetCutCommand = {
|
|
|
5075
5080
|
priority: SHEET_CLIPBOARD_PRIORITY,
|
|
5076
5081
|
preconditions: whenSheetFocused,
|
|
5077
5082
|
handler: async (accessor) => {
|
|
5083
|
+
checkSheetClipboardPermission(accessor, _univerjs_ui.CutCommand.id);
|
|
5078
5084
|
return accessor.get(ISheetClipboardService).cut();
|
|
5079
5085
|
}
|
|
5080
5086
|
};
|
|
@@ -5086,6 +5092,7 @@ const SheetPasteCommand = {
|
|
|
5086
5092
|
priority: SHEET_CLIPBOARD_PRIORITY,
|
|
5087
5093
|
preconditions: whenSheetFocused,
|
|
5088
5094
|
handler: async (accessor, params) => {
|
|
5095
|
+
checkSheetClipboardPermission(accessor, _univerjs_ui.PasteCommand.id, params);
|
|
5089
5096
|
const sheetClipboardService = accessor.get(ISheetClipboardService);
|
|
5090
5097
|
const clipboardInterfaceService = accessor.get(_univerjs_ui.IClipboardInterfaceService);
|
|
5091
5098
|
if (clipboardInterfaceService.supportClipboard) {
|
|
@@ -5104,12 +5111,76 @@ const SheetPasteShortKeyCommand = {
|
|
|
5104
5111
|
id: _univerjs_ui.SheetPasteShortKeyCommandName,
|
|
5105
5112
|
type: _univerjs_core.CommandType.COMMAND,
|
|
5106
5113
|
handler: async (accessor, params) => {
|
|
5114
|
+
checkSheetClipboardPermission(accessor, _univerjs_ui.PasteCommand.id);
|
|
5107
5115
|
const clipboardService = accessor.get(ISheetClipboardService);
|
|
5108
5116
|
const { htmlContent, textContent, files, formulaClipboardPayload } = params;
|
|
5109
5117
|
clipboardService.legacyPaste(htmlContent, textContent, files, formulaClipboardPayload);
|
|
5110
5118
|
return true;
|
|
5111
5119
|
}
|
|
5112
5120
|
};
|
|
5121
|
+
function checkSheetClipboardPermission(accessor, commandId, params) {
|
|
5122
|
+
const permissionCheckController = accessor.get(_univerjs_sheets.SheetPermissionCheckController);
|
|
5123
|
+
let permission = true;
|
|
5124
|
+
let errorKey = "sheets-ui.permission.dialog.commonErr";
|
|
5125
|
+
switch (commandId) {
|
|
5126
|
+
case _univerjs_ui.CopyCommand.id:
|
|
5127
|
+
permission = permissionCheckController.permissionCheckWithRanges({
|
|
5128
|
+
workbookTypes: [_univerjs_sheets.WorkbookCopyPermission],
|
|
5129
|
+
worksheetTypes: [_univerjs_sheets.WorksheetCopyPermission],
|
|
5130
|
+
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionViewPoint]
|
|
5131
|
+
});
|
|
5132
|
+
errorKey = "sheets-ui.permission.dialog.copyErr";
|
|
5133
|
+
break;
|
|
5134
|
+
case _univerjs_ui.CutCommand.id:
|
|
5135
|
+
permission = permissionCheckController.permissionCheckWithRanges({
|
|
5136
|
+
workbookTypes: [_univerjs_sheets.WorkbookCopyPermission, _univerjs_sheets.WorkbookEditablePermission],
|
|
5137
|
+
worksheetTypes: [_univerjs_sheets.WorksheetCopyPermission, _univerjs_sheets.WorksheetEditPermission],
|
|
5138
|
+
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionViewPoint, _univerjs_sheets.RangeProtectionPermissionEditPoint]
|
|
5139
|
+
});
|
|
5140
|
+
errorKey = "sheets-ui.permission.dialog.copyErr";
|
|
5141
|
+
break;
|
|
5142
|
+
case _univerjs_ui.PasteCommand.id:
|
|
5143
|
+
permission = checkSheetPastePermission(permissionCheckController, params);
|
|
5144
|
+
errorKey = "sheets-ui.permission.dialog.pasteErr";
|
|
5145
|
+
break;
|
|
5146
|
+
}
|
|
5147
|
+
if (permission) return;
|
|
5148
|
+
const localeService = accessor.get(_univerjs_core.LocaleService);
|
|
5149
|
+
let errorMsg = localeService.t(errorKey);
|
|
5150
|
+
if (commandId === _univerjs_ui.CopyCommand.id || commandId === _univerjs_ui.CutCommand.id) {
|
|
5151
|
+
var _permissionService$ge;
|
|
5152
|
+
const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService));
|
|
5153
|
+
const permissionService = accessor.get(_univerjs_core.IPermissionService);
|
|
5154
|
+
if (target && !((_permissionService$ge = permissionService.getPermissionPoint(new _univerjs_sheets.WorkbookCopyPermission(target.unitId).id)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value)) errorMsg = localeService.t("sheets-ui.permission.dialog.workbookCopyErr");
|
|
5155
|
+
}
|
|
5156
|
+
permissionCheckController.blockExecuteWithoutPermission(errorMsg);
|
|
5157
|
+
}
|
|
5158
|
+
function checkSheetPastePermission(permissionCheckController, params) {
|
|
5159
|
+
if ((params === null || params === void 0 ? void 0 : params.value) === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_VALUE || (params === null || params === void 0 ? void 0 : params.value) === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMULA || (params === null || params === void 0 ? void 0 : params.value) === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT) return permissionCheckController.permissionCheckWithRanges({
|
|
5160
|
+
workbookTypes: [_univerjs_sheets.WorkbookEditablePermission],
|
|
5161
|
+
worksheetTypes: [_univerjs_sheets.WorksheetSetCellStylePermission, _univerjs_sheets.WorksheetEditPermission],
|
|
5162
|
+
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionEditPoint]
|
|
5163
|
+
});
|
|
5164
|
+
if ((params === null || params === void 0 ? void 0 : params.value) === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_COL_WIDTH) return permissionCheckController.permissionCheckWithRanges({
|
|
5165
|
+
workbookTypes: [_univerjs_sheets.WorkbookEditablePermission],
|
|
5166
|
+
worksheetTypes: [
|
|
5167
|
+
_univerjs_sheets.WorksheetEditPermission,
|
|
5168
|
+
_univerjs_sheets.WorksheetSetCellValuePermission,
|
|
5169
|
+
_univerjs_sheets.WorksheetSetCellStylePermission,
|
|
5170
|
+
_univerjs_sheets.WorksheetSetColumnStylePermission
|
|
5171
|
+
],
|
|
5172
|
+
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionEditPoint]
|
|
5173
|
+
});
|
|
5174
|
+
return permissionCheckController.permissionCheckWithRanges({
|
|
5175
|
+
workbookTypes: [_univerjs_sheets.WorkbookEditablePermission],
|
|
5176
|
+
worksheetTypes: [
|
|
5177
|
+
_univerjs_sheets.WorksheetSetCellValuePermission,
|
|
5178
|
+
_univerjs_sheets.WorksheetSetCellStylePermission,
|
|
5179
|
+
_univerjs_sheets.WorksheetEditPermission
|
|
5180
|
+
],
|
|
5181
|
+
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionEditPoint]
|
|
5182
|
+
});
|
|
5183
|
+
}
|
|
5113
5184
|
const SheetPasteValueCommand = {
|
|
5114
5185
|
id: "sheet.command.paste-value",
|
|
5115
5186
|
type: _univerjs_core.CommandType.COMMAND,
|
|
@@ -8542,11 +8613,7 @@ const SidebarDefinedNameOperation = {
|
|
|
8542
8613
|
header: { title: localeService.t("sheets-ui.definedName.featureTitle") },
|
|
8543
8614
|
children: { label: DEFINED_NAME_CONTAINER },
|
|
8544
8615
|
onClose: () => {},
|
|
8545
|
-
width: 333
|
|
8546
|
-
bodyStyle: {
|
|
8547
|
-
height: "100%",
|
|
8548
|
-
overflow: "hidden"
|
|
8549
|
-
}
|
|
8616
|
+
width: 333
|
|
8550
8617
|
});
|
|
8551
8618
|
break;
|
|
8552
8619
|
default:
|
|
@@ -8828,21 +8895,18 @@ SheetsRenderService = __decorate([
|
|
|
8828
8895
|
//#endregion
|
|
8829
8896
|
//#region src/controllers/auto-fill-ui.controller.ts
|
|
8830
8897
|
let AutoFillUIController = class AutoFillUIController extends _univerjs_core.Disposable {
|
|
8831
|
-
constructor(_univerInstanceService, _commandService, _autoFillService, _autoFillController,
|
|
8898
|
+
constructor(_univerInstanceService, _commandService, _autoFillService, _autoFillController, _sheetsRenderService) {
|
|
8832
8899
|
super();
|
|
8833
8900
|
this._univerInstanceService = _univerInstanceService;
|
|
8834
8901
|
this._commandService = _commandService;
|
|
8835
8902
|
this._autoFillService = _autoFillService;
|
|
8836
8903
|
this._autoFillController = _autoFillController;
|
|
8837
|
-
this._editorBridgeService = _editorBridgeService;
|
|
8838
|
-
this._renderManagerService = _renderManagerService;
|
|
8839
8904
|
this._sheetsRenderService = _sheetsRenderService;
|
|
8840
8905
|
_defineProperty(this, "_currentLocation", null);
|
|
8841
8906
|
this._init();
|
|
8842
8907
|
}
|
|
8843
8908
|
_init() {
|
|
8844
8909
|
this._initDefaultHook();
|
|
8845
|
-
this._initSelectionControlFillChanged();
|
|
8846
8910
|
this._initQuitListener();
|
|
8847
8911
|
this._initSkeletonChange();
|
|
8848
8912
|
}
|
|
@@ -8897,127 +8961,120 @@ let AutoFillUIController = class AutoFillUIController extends _univerjs_core.Dis
|
|
|
8897
8961
|
this._autoFillController.quit();
|
|
8898
8962
|
this._autoFillService.setShowMenu(false);
|
|
8899
8963
|
}
|
|
8964
|
+
};
|
|
8965
|
+
AutoFillUIController = __decorate([
|
|
8966
|
+
__decorateParam(0, _univerjs_core.IUniverInstanceService),
|
|
8967
|
+
__decorateParam(1, _univerjs_core.ICommandService),
|
|
8968
|
+
__decorateParam(2, _univerjs_sheets.IAutoFillService),
|
|
8969
|
+
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_sheets.AutoFillController)),
|
|
8970
|
+
__decorateParam(4, (0, _univerjs_core.Inject)(SheetsRenderService))
|
|
8971
|
+
], AutoFillUIController);
|
|
8972
|
+
let AutoFillRenderController = class AutoFillRenderController extends _univerjs_core.Disposable {
|
|
8973
|
+
constructor(_context, _selectionRenderService, _selectionManagerService, _commandService, _editorBridgeService) {
|
|
8974
|
+
super();
|
|
8975
|
+
this._context = _context;
|
|
8976
|
+
this._selectionRenderService = _selectionRenderService;
|
|
8977
|
+
this._selectionManagerService = _selectionManagerService;
|
|
8978
|
+
this._commandService = _commandService;
|
|
8979
|
+
this._editorBridgeService = _editorBridgeService;
|
|
8980
|
+
_defineProperty(this, "_selectionControlDisposables", new _univerjs_core.DisposableCollection());
|
|
8981
|
+
this._initSelectionControlFillChanged();
|
|
8982
|
+
}
|
|
8983
|
+
dispose() {
|
|
8984
|
+
this._selectionControlDisposables.dispose();
|
|
8985
|
+
super.dispose();
|
|
8986
|
+
}
|
|
8900
8987
|
_initSelectionControlFillChanged() {
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
const scheduleUpdateListener = (listener) => {
|
|
8905
|
-
if (pendingRetry) return;
|
|
8906
|
-
pendingRetry = true;
|
|
8907
|
-
setTimeout(() => {
|
|
8908
|
-
pendingRetry = false;
|
|
8909
|
-
listener();
|
|
8910
|
-
}, 0);
|
|
8911
|
-
};
|
|
8912
|
-
const updateListener = () => {
|
|
8913
|
-
disposableCollection.dispose();
|
|
8914
|
-
const currentRenderer = (0, _univerjs_engine_render.getCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService);
|
|
8915
|
-
if (!currentRenderer) return;
|
|
8916
|
-
const selectionRenderService = getResolvedSelectionRenderService(currentRenderer);
|
|
8917
|
-
if (!selectionRenderService) {
|
|
8918
|
-
retryCount += 1;
|
|
8919
|
-
if (retryCount <= 3) scheduleUpdateListener(updateListener);
|
|
8920
|
-
return;
|
|
8921
|
-
}
|
|
8922
|
-
retryCount = 0;
|
|
8923
|
-
selectionRenderService.getSelectionControls().forEach((controlSelection) => {
|
|
8924
|
-
disposableCollection.add(controlSelection.selectionFilled$.subscribe((filled) => {
|
|
8925
|
-
if (filled == null || filled.startColumn === -1 || filled.startRow === -1 || filled.endColumn === -1 || filled.endRow === -1) return;
|
|
8926
|
-
const source = {
|
|
8927
|
-
startColumn: controlSelection.model.startColumn,
|
|
8928
|
-
endColumn: controlSelection.model.endColumn,
|
|
8929
|
-
startRow: controlSelection.model.startRow,
|
|
8930
|
-
endRow: controlSelection.model.endRow
|
|
8931
|
-
};
|
|
8932
|
-
const selection = {
|
|
8933
|
-
startColumn: filled.startColumn,
|
|
8934
|
-
endColumn: filled.endColumn,
|
|
8935
|
-
startRow: filled.startRow,
|
|
8936
|
-
endRow: filled.endRow
|
|
8937
|
-
};
|
|
8938
|
-
this._commandService.executeCommand(_univerjs_sheets.AutoFillCommand.id, {
|
|
8939
|
-
sourceRange: source,
|
|
8940
|
-
targetRange: selection
|
|
8941
|
-
});
|
|
8942
|
-
}));
|
|
8943
|
-
disposableCollection.add(controlSelection.fillControl.onDblclick$.subscribeEvent(() => {
|
|
8944
|
-
const source = {
|
|
8945
|
-
startColumn: controlSelection.model.startColumn,
|
|
8946
|
-
endColumn: controlSelection.model.endColumn,
|
|
8947
|
-
startRow: controlSelection.model.startRow,
|
|
8948
|
-
endRow: controlSelection.model.endRow
|
|
8949
|
-
};
|
|
8950
|
-
this._handleDbClickFill(source);
|
|
8951
|
-
}));
|
|
8952
|
-
disposableCollection.add(controlSelection.fillControl.onPointerDown$.subscribeEvent(() => {
|
|
8953
|
-
if (this._editorBridgeService.isVisible().visible) this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
|
|
8954
|
-
visible: false,
|
|
8955
|
-
eventType: _univerjs_engine_render.DeviceInputEventType.PointerDown,
|
|
8956
|
-
unitId: currentRenderer.unitId
|
|
8957
|
-
});
|
|
8958
|
-
}));
|
|
8959
|
-
});
|
|
8960
|
-
};
|
|
8961
|
-
scheduleUpdateListener(updateListener);
|
|
8962
|
-
this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
|
|
8963
|
-
if (command.id === _univerjs_sheets.SetSelectionsOperation.id) scheduleUpdateListener(updateListener);
|
|
8988
|
+
this._updateSelectionControlListeners();
|
|
8989
|
+
this.disposeWithMe(this._selectionManagerService.selectionChanged$.subscribe(() => {
|
|
8990
|
+
this._updateSelectionControlListeners();
|
|
8964
8991
|
}));
|
|
8965
|
-
this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).subscribe(() => scheduleUpdateListener(updateListener)));
|
|
8966
8992
|
}
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8993
|
+
_updateSelectionControlListeners() {
|
|
8994
|
+
this._selectionControlDisposables.dispose();
|
|
8995
|
+
this._selectionRenderService.getSelectionControls().forEach((controlSelection) => {
|
|
8996
|
+
this._selectionControlDisposables.add(controlSelection.selectionFilled$.subscribe((filled) => {
|
|
8997
|
+
if (filled == null || filled.startColumn === -1 || filled.startRow === -1 || filled.endColumn === -1 || filled.endRow === -1) return;
|
|
8998
|
+
const sourceRange = {
|
|
8999
|
+
startColumn: controlSelection.model.startColumn,
|
|
9000
|
+
endColumn: controlSelection.model.endColumn,
|
|
9001
|
+
startRow: controlSelection.model.startRow,
|
|
9002
|
+
endRow: controlSelection.model.endRow
|
|
9003
|
+
};
|
|
9004
|
+
const targetRange = {
|
|
9005
|
+
startColumn: filled.startColumn,
|
|
9006
|
+
endColumn: filled.endColumn,
|
|
9007
|
+
startRow: filled.startRow,
|
|
9008
|
+
endRow: filled.endRow
|
|
9009
|
+
};
|
|
9010
|
+
this._executeAutoFill(sourceRange, targetRange);
|
|
9011
|
+
}));
|
|
9012
|
+
this._selectionControlDisposables.add(controlSelection.fillControl.onDblclick$.subscribeEvent(() => {
|
|
9013
|
+
const sourceRange = {
|
|
9014
|
+
startColumn: controlSelection.model.startColumn,
|
|
9015
|
+
endColumn: controlSelection.model.endColumn,
|
|
9016
|
+
startRow: controlSelection.model.startRow,
|
|
9017
|
+
endRow: controlSelection.model.endRow
|
|
9018
|
+
};
|
|
9019
|
+
this._handleDbClickFill(sourceRange);
|
|
9020
|
+
}));
|
|
9021
|
+
this._selectionControlDisposables.add(controlSelection.fillControl.onPointerDown$.subscribeEvent(() => {
|
|
9022
|
+
if (this._editorBridgeService.isVisible().visible) this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
|
|
9023
|
+
visible: false,
|
|
9024
|
+
eventType: _univerjs_engine_render.DeviceInputEventType.PointerDown,
|
|
9025
|
+
unitId: this._context.unitId
|
|
9026
|
+
});
|
|
9027
|
+
}));
|
|
9028
|
+
});
|
|
9029
|
+
}
|
|
9030
|
+
_executeAutoFill(sourceRange, targetRange) {
|
|
9031
|
+
const subUnitId = this._context.unit.getActiveSheet().getSheetId();
|
|
8970
9032
|
this._commandService.executeCommand(_univerjs_sheets.AutoFillCommand.id, {
|
|
8971
|
-
sourceRange
|
|
8972
|
-
targetRange
|
|
9033
|
+
sourceRange,
|
|
9034
|
+
targetRange,
|
|
9035
|
+
unitId: this._context.unitId,
|
|
9036
|
+
subUnitId
|
|
8973
9037
|
});
|
|
8974
9038
|
}
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
if (!worksheet) return source;
|
|
8980
|
-
const matrix = worksheet.getCellMatrix();
|
|
8981
|
-
const maxRow = worksheet.getMaxRows();
|
|
8982
|
-
const maxColumn = worksheet.getMaxColumns();
|
|
8983
|
-
let detectEndRow = endRow + 1;
|
|
8984
|
-
if (startColumn > 0 && ((_matrix$getValue = matrix.getValue(detectEndRow, startColumn - 1)) === null || _matrix$getValue === void 0 ? void 0 : _matrix$getValue.v) != null) {
|
|
8985
|
-
var _matrix$getValue2;
|
|
8986
|
-
while (((_matrix$getValue2 = matrix.getValue(detectEndRow + 1, startColumn - 1)) === null || _matrix$getValue2 === void 0 ? void 0 : _matrix$getValue2.v) != null && detectEndRow < maxRow) detectEndRow += 1;
|
|
8987
|
-
} else if (endColumn < maxColumn - 1 && ((_matrix$getValue3 = matrix.getValue(detectEndRow, endColumn + 1)) === null || _matrix$getValue3 === void 0 ? void 0 : _matrix$getValue3.v) != null) {
|
|
8988
|
-
var _matrix$getValue4;
|
|
8989
|
-
while (((_matrix$getValue4 = matrix.getValue(detectEndRow + 1, endColumn + 1)) === null || _matrix$getValue4 === void 0 ? void 0 : _matrix$getValue4.v) != null && detectEndRow < maxRow) detectEndRow += 1;
|
|
8990
|
-
} else detectEndRow = endRow;
|
|
8991
|
-
for (let i = endRow + 1; i <= detectEndRow; i++) for (let j = startColumn; j <= endColumn; j++) {
|
|
8992
|
-
var _matrix$getValue5;
|
|
8993
|
-
if (((_matrix$getValue5 = matrix.getValue(i, j)) === null || _matrix$getValue5 === void 0 ? void 0 : _matrix$getValue5.v) != null) {
|
|
8994
|
-
detectEndRow = i - 1;
|
|
8995
|
-
break;
|
|
8996
|
-
}
|
|
8997
|
-
}
|
|
8998
|
-
return {
|
|
8999
|
-
startColumn,
|
|
9000
|
-
endColumn,
|
|
9001
|
-
startRow,
|
|
9002
|
-
endRow: detectEndRow
|
|
9003
|
-
};
|
|
9039
|
+
_handleDbClickFill(source) {
|
|
9040
|
+
const selection = detectAutoFillRange(source, this._context.unit.getActiveSheet());
|
|
9041
|
+
if (selection.endRow <= source.endRow) return;
|
|
9042
|
+
this._executeAutoFill(source, selection);
|
|
9004
9043
|
}
|
|
9005
9044
|
};
|
|
9006
|
-
|
|
9007
|
-
__decorateParam(0, _univerjs_core.
|
|
9008
|
-
__decorateParam(
|
|
9009
|
-
__decorateParam(
|
|
9010
|
-
__decorateParam(
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
const
|
|
9018
|
-
|
|
9019
|
-
if (
|
|
9020
|
-
|
|
9045
|
+
AutoFillRenderController = __decorate([
|
|
9046
|
+
__decorateParam(1, (0, _univerjs_core.Inject)(ISheetSelectionRenderService)),
|
|
9047
|
+
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetsSelectionsService)),
|
|
9048
|
+
__decorateParam(3, _univerjs_core.ICommandService),
|
|
9049
|
+
__decorateParam(4, IEditorBridgeService)
|
|
9050
|
+
], AutoFillRenderController);
|
|
9051
|
+
function detectAutoFillRange(source, worksheet) {
|
|
9052
|
+
var _matrix$getValue, _matrix$getValue3;
|
|
9053
|
+
const { startRow, endRow, startColumn, endColumn } = source;
|
|
9054
|
+
const matrix = worksheet.getCellMatrix();
|
|
9055
|
+
const maxRow = worksheet.getMaxRows();
|
|
9056
|
+
const maxColumn = worksheet.getMaxColumns();
|
|
9057
|
+
let detectEndRow = endRow + 1;
|
|
9058
|
+
if (startColumn > 0 && ((_matrix$getValue = matrix.getValue(detectEndRow, startColumn - 1)) === null || _matrix$getValue === void 0 ? void 0 : _matrix$getValue.v) != null) {
|
|
9059
|
+
var _matrix$getValue2;
|
|
9060
|
+
while (((_matrix$getValue2 = matrix.getValue(detectEndRow + 1, startColumn - 1)) === null || _matrix$getValue2 === void 0 ? void 0 : _matrix$getValue2.v) != null && detectEndRow < maxRow) detectEndRow += 1;
|
|
9061
|
+
} else if (endColumn < maxColumn - 1 && ((_matrix$getValue3 = matrix.getValue(detectEndRow, endColumn + 1)) === null || _matrix$getValue3 === void 0 ? void 0 : _matrix$getValue3.v) != null) {
|
|
9062
|
+
var _matrix$getValue4;
|
|
9063
|
+
while (((_matrix$getValue4 = matrix.getValue(detectEndRow + 1, endColumn + 1)) === null || _matrix$getValue4 === void 0 ? void 0 : _matrix$getValue4.v) != null && detectEndRow < maxRow) detectEndRow += 1;
|
|
9064
|
+
} else detectEndRow = endRow;
|
|
9065
|
+
for (let i = endRow + 1; i <= detectEndRow; i++) for (let j = startColumn; j <= endColumn; j++) {
|
|
9066
|
+
var _matrix$getValue5;
|
|
9067
|
+
if (((_matrix$getValue5 = matrix.getValue(i, j)) === null || _matrix$getValue5 === void 0 ? void 0 : _matrix$getValue5.v) != null) {
|
|
9068
|
+
detectEndRow = i - 1;
|
|
9069
|
+
break;
|
|
9070
|
+
}
|
|
9071
|
+
}
|
|
9072
|
+
return {
|
|
9073
|
+
startColumn,
|
|
9074
|
+
endColumn,
|
|
9075
|
+
startRow,
|
|
9076
|
+
endRow: detectEndRow
|
|
9077
|
+
};
|
|
9021
9078
|
}
|
|
9022
9079
|
|
|
9023
9080
|
//#endregion
|
|
@@ -10311,21 +10368,28 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10311
10368
|
}
|
|
10312
10369
|
_getEditorMaxSize(position, canvasOffset, horizontalAlign) {
|
|
10313
10370
|
if (this._getEditorObject() == null) return;
|
|
10314
|
-
function pxToNum(
|
|
10315
|
-
|
|
10371
|
+
function pxToNum(size) {
|
|
10372
|
+
var _size$replace;
|
|
10373
|
+
return Number.parseFloat((_size$replace = size === null || size === void 0 ? void 0 : size.replace("px", "")) !== null && _size$replace !== void 0 ? _size$replace : "");
|
|
10316
10374
|
}
|
|
10317
10375
|
const engine = this.engine;
|
|
10318
10376
|
if (!engine) return;
|
|
10319
10377
|
const canvasElement = engine.getCanvasElement();
|
|
10320
10378
|
const canvasClientRect = canvasElement.getBoundingClientRect();
|
|
10321
10379
|
const widthOfCanvas = pxToNum(canvasElement.style.width);
|
|
10380
|
+
const heightOfCanvas = pxToNum(canvasElement.style.height);
|
|
10322
10381
|
const { width, height } = canvasClientRect;
|
|
10323
|
-
const
|
|
10382
|
+
const contentElement = this._getEditorContentElement();
|
|
10383
|
+
const contentBoundingRect = contentElement.getBoundingClientRect();
|
|
10384
|
+
const contentScaleX = resolveElementScale(contentBoundingRect.width, contentElement.offsetWidth);
|
|
10385
|
+
const contentScaleY = resolveElementScale(contentBoundingRect.height, contentElement.offsetHeight, contentScaleX);
|
|
10386
|
+
const scaleAdjustX = width / widthOfCanvas / contentScaleX;
|
|
10387
|
+
const scaleAdjustY = Number.isFinite(heightOfCanvas) && heightOfCanvas > 0 ? height / heightOfCanvas / contentScaleY : scaleAdjustX;
|
|
10324
10388
|
const { startX, startY, endX } = position;
|
|
10325
10389
|
const enginWidth = engine.width;
|
|
10326
|
-
const maxHeight = height - startY - EDITOR_BORDER_SIZE * 2;
|
|
10390
|
+
const maxHeight = height / contentScaleY - startY - EDITOR_BORDER_SIZE * 2;
|
|
10327
10391
|
const cellWidth = endX - startX;
|
|
10328
|
-
let maxWidth = width - startX;
|
|
10392
|
+
let maxWidth = width / contentScaleX - startX;
|
|
10329
10393
|
if (horizontalAlign === _univerjs_core.HorizontalAlign.CENTER) {
|
|
10330
10394
|
const rightGap = enginWidth - endX;
|
|
10331
10395
|
maxWidth = cellWidth + Math.min(startX, rightGap) * 2;
|
|
@@ -10335,7 +10399,10 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10335
10399
|
return {
|
|
10336
10400
|
height: maxHeight,
|
|
10337
10401
|
width: maxWidth,
|
|
10338
|
-
|
|
10402
|
+
contentScaleX,
|
|
10403
|
+
contentScaleY,
|
|
10404
|
+
scaleAdjustX,
|
|
10405
|
+
scaleAdjustY
|
|
10339
10406
|
};
|
|
10340
10407
|
}
|
|
10341
10408
|
/**
|
|
@@ -10352,7 +10419,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10352
10419
|
let { startX, startY } = actualRangeWithCoord;
|
|
10353
10420
|
const { document: documentComponent, scene: editorScene, engine: docEngine } = editorObject;
|
|
10354
10421
|
const viewportMain = editorScene.getViewport(_univerjs_docs_ui.VIEWPORT_KEY.VIEW_MAIN);
|
|
10355
|
-
const { height: clientHeight, width: clientWidth,
|
|
10422
|
+
const { height: clientHeight, width: clientWidth, contentScaleX, contentScaleY, scaleAdjustX, scaleAdjustY } = this._getEditorMaxSize(actualRangeWithCoord, canvasOffset, horizontalAlign);
|
|
10356
10423
|
let physicHeight = editorHeight;
|
|
10357
10424
|
let scrollBar = viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.getScrollBar();
|
|
10358
10425
|
if (physicHeight > clientHeight) {
|
|
@@ -10373,12 +10440,12 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10373
10440
|
this._addBackground(editorScene, editorWidth / scaleX, editorHeight / scaleY, fill);
|
|
10374
10441
|
const { scaleX: precisionScaleX, scaleY: precisionScaleY } = editorScene.getPrecisionScale();
|
|
10375
10442
|
editorScene.transformByState({
|
|
10376
|
-
width: editorWidth *
|
|
10377
|
-
height: editorHeight *
|
|
10378
|
-
scaleX: scaleX *
|
|
10379
|
-
scaleY: scaleY *
|
|
10443
|
+
width: editorWidth * scaleAdjustX / scaleX,
|
|
10444
|
+
height: editorHeight * scaleAdjustY / scaleY,
|
|
10445
|
+
scaleX: scaleX * scaleAdjustX,
|
|
10446
|
+
scaleY: scaleY * scaleAdjustY
|
|
10380
10447
|
});
|
|
10381
|
-
documentComponent.resize(editorWidth *
|
|
10448
|
+
documentComponent.resize(editorWidth * scaleAdjustX / scaleX, editorHeight * scaleAdjustY / scaleY);
|
|
10382
10449
|
/**
|
|
10383
10450
|
* sometimes requestIdleCallback is invalid, so use setTimeout to ensure the successful execution of the resizeBySize method.
|
|
10384
10451
|
* resize canvas
|
|
@@ -10390,16 +10457,16 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10390
10457
|
}, 0);
|
|
10391
10458
|
const contentBoundingRect = this._getEditorContentElement().getBoundingClientRect();
|
|
10392
10459
|
const canvasBoundingRect = canvasElement.getBoundingClientRect();
|
|
10393
|
-
startX = startX *
|
|
10394
|
-
startY = startY *
|
|
10460
|
+
startX = startX * scaleAdjustX + (canvasBoundingRect.left - contentBoundingRect.left) / contentScaleX;
|
|
10461
|
+
startY = startY * scaleAdjustY + (canvasBoundingRect.top - contentBoundingRect.top) / contentScaleY;
|
|
10395
10462
|
const cellWidth = actualRangeWithCoord.endX - actualRangeWithCoord.startX;
|
|
10396
|
-
if (horizontalAlign === _univerjs_core.HorizontalAlign.RIGHT) startX += (cellWidth - editorWidth) *
|
|
10397
|
-
else if (horizontalAlign === _univerjs_core.HorizontalAlign.CENTER) startX += (cellWidth - editorWidth *
|
|
10463
|
+
if (horizontalAlign === _univerjs_core.HorizontalAlign.RIGHT) startX += (cellWidth - editorWidth) * scaleAdjustX;
|
|
10464
|
+
else if (horizontalAlign === _univerjs_core.HorizontalAlign.CENTER) startX += (cellWidth - editorWidth * scaleAdjustX) / 2;
|
|
10398
10465
|
this._cellEditorManagerService.setState({
|
|
10399
10466
|
startX,
|
|
10400
10467
|
startY,
|
|
10401
|
-
endX: editorWidth *
|
|
10402
|
-
endY: physicHeight *
|
|
10468
|
+
endX: editorWidth * scaleAdjustX + startX,
|
|
10469
|
+
endY: physicHeight * scaleAdjustY + startY,
|
|
10403
10470
|
show: true
|
|
10404
10471
|
});
|
|
10405
10472
|
}
|
|
@@ -10443,10 +10510,10 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
|
|
|
10443
10510
|
const { horizontalAlign } = documentLayoutObject;
|
|
10444
10511
|
const maxSize = this._getEditorMaxSize(position, canvasOffset, horizontalAlign);
|
|
10445
10512
|
if (!maxSize) return;
|
|
10446
|
-
const { height: clientHeight, width: clientWidth,
|
|
10513
|
+
const { height: clientHeight, width: clientWidth, scaleAdjustX, scaleAdjustY } = maxSize;
|
|
10447
10514
|
const cell = skeleton.getCellWithCoordByIndex(row, column);
|
|
10448
|
-
const height = Math.min((cell.mergeInfo.endY - cell.mergeInfo.startY) * scaleY, clientHeight) *
|
|
10449
|
-
const width = Math.min((cell.mergeInfo.endX - cell.mergeInfo.startX) * scaleX, clientWidth) *
|
|
10515
|
+
const height = Math.min((cell.mergeInfo.endY - cell.mergeInfo.startY) * scaleY, clientHeight) * scaleAdjustY;
|
|
10516
|
+
const width = Math.min((cell.mergeInfo.endX - cell.mergeInfo.startX) * scaleX, clientWidth) * scaleAdjustX;
|
|
10450
10517
|
const currentHeight = state.endY - state.startY;
|
|
10451
10518
|
const currentWidth = state.endX - state.startX;
|
|
10452
10519
|
if (currentHeight !== height || currentWidth !== width) {
|
|
@@ -10472,6 +10539,10 @@ SheetCellEditorResizeService = __decorate([
|
|
|
10472
10539
|
__decorateParam(5, _univerjs_core.IConfigService),
|
|
10473
10540
|
__decorateParam(6, (0, _univerjs_core.Optional)(ISheetEmbedFloatingGeometryService))
|
|
10474
10541
|
], SheetCellEditorResizeService);
|
|
10542
|
+
function resolveElementScale(renderedSize, layoutSize, fallback = 1) {
|
|
10543
|
+
if (!Number.isFinite(renderedSize) || !Number.isFinite(layoutSize) || renderedSize <= 0 || layoutSize <= 0) return fallback;
|
|
10544
|
+
return renderedSize / layoutSize;
|
|
10545
|
+
}
|
|
10475
10546
|
|
|
10476
10547
|
//#endregion
|
|
10477
10548
|
//#region src/controllers/render-controllers/editor-bridge.render-controller.ts
|
|
@@ -10510,12 +10581,17 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
10510
10581
|
this._d = null;
|
|
10511
10582
|
}
|
|
10512
10583
|
_initSelectionChangeListener(d) {
|
|
10513
|
-
d.add((0, rxjs.merge)(this._selectionManagerService.
|
|
10584
|
+
d.add((0, rxjs.merge)(this._selectionManagerService.selectionSet$, this._selectionManagerService.selectionMoveStart$).subscribe((params) => this._updateEditorPosition(params)));
|
|
10585
|
+
d.add(this._selectionManagerService.selectionMoveEnd$.subscribe((params) => {
|
|
10586
|
+
var _params;
|
|
10587
|
+
this._updateEditorPosition(params);
|
|
10588
|
+
if (params === null || params === void 0 || (_params = params[params.length - 1]) === null || _params === void 0 ? void 0 : _params.primary) this._updateInputPosition();
|
|
10589
|
+
}));
|
|
10514
10590
|
}
|
|
10515
10591
|
_updateEditorPosition(params) {
|
|
10516
|
-
var
|
|
10592
|
+
var _params2;
|
|
10517
10593
|
if (this._editorBridgeService.isVisible().visible) return;
|
|
10518
|
-
const primary = params === null || params === void 0 || (
|
|
10594
|
+
const primary = params === null || params === void 0 || (_params2 = params[params.length - 1]) === null || _params2 === void 0 ? void 0 : _params2.primary;
|
|
10519
10595
|
if (primary) {
|
|
10520
10596
|
var _this$_context$unit$g, _this$_sheetSkeletonM;
|
|
10521
10597
|
const sheetObject = this._getSheetObject();
|
|
@@ -10545,6 +10621,15 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends _u
|
|
|
10545
10621
|
});
|
|
10546
10622
|
}
|
|
10547
10623
|
}
|
|
10624
|
+
_updateInputPosition() {
|
|
10625
|
+
var _this$_renderManagerS;
|
|
10626
|
+
if (this._editorBridgeService.isVisible().visible) return;
|
|
10627
|
+
const layout = this._editorBridgeService.getEditCellLayout();
|
|
10628
|
+
const docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.getRenderById(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs_ui.DocSelectionRenderService);
|
|
10629
|
+
if (!layout || !docSelectionRenderService) return;
|
|
10630
|
+
const { position, canvasOffset } = layout;
|
|
10631
|
+
docSelectionRenderService.setInputPosition(canvasOffset.left + position.startX, canvasOffset.top + position.startY);
|
|
10632
|
+
}
|
|
10548
10633
|
refreshEditorPosition() {
|
|
10549
10634
|
const workbookSelections = this._selectionManagerService.getWorkbookSelections(this._context.unitId);
|
|
10550
10635
|
if (workbookSelections) {
|
|
@@ -13913,10 +13998,9 @@ const UNIVER_SHEET_PERMISSION_ALERT_DIALOG = "UNIVER_SHEET_PERMISSION_ALERT_DIAL
|
|
|
13913
13998
|
//#endregion
|
|
13914
13999
|
//#region src/controllers/permission/sheet-permission-check-ui.controller.ts
|
|
13915
14000
|
let SheetPermissionCheckUIController = class SheetPermissionCheckUIController extends _univerjs_core.Disposable {
|
|
13916
|
-
constructor(_commandService,
|
|
14001
|
+
constructor(_commandService, _permissionService, _dialogService, _rangeProtectionRuleModel, _localeService, _contextService, _sheetPermissionCheckController) {
|
|
13917
14002
|
super();
|
|
13918
14003
|
this._commandService = _commandService;
|
|
13919
|
-
this._univerInstanceService = _univerInstanceService;
|
|
13920
14004
|
this._permissionService = _permissionService;
|
|
13921
14005
|
this._dialogService = _dialogService;
|
|
13922
14006
|
this._rangeProtectionRuleModel = _rangeProtectionRuleModel;
|
|
@@ -13958,7 +14042,6 @@ let SheetPermissionCheckUIController = class SheetPermissionCheckUIController ex
|
|
|
13958
14042
|
let permission = true;
|
|
13959
14043
|
let errorMsg = "";
|
|
13960
14044
|
let params;
|
|
13961
|
-
let target;
|
|
13962
14045
|
switch (id) {
|
|
13963
14046
|
case _univerjs_docs.InsertTextCommand.id:
|
|
13964
14047
|
case _univerjs_docs_ui.IMEInputCommand.id:
|
|
@@ -13982,20 +14065,6 @@ let SheetPermissionCheckUIController = class SheetPermissionCheckUIController ex
|
|
|
13982
14065
|
});
|
|
13983
14066
|
errorMsg = this._localeService.t("sheets-ui.permission.dialog.editErr");
|
|
13984
14067
|
break;
|
|
13985
|
-
case SheetPasteColWidthCommand.id:
|
|
13986
|
-
permission = this._sheetPermissionCheckController.permissionCheckWithoutRange({
|
|
13987
|
-
workbookTypes: [_univerjs_sheets.WorkbookEditablePermission],
|
|
13988
|
-
worksheetTypes: [_univerjs_sheets.WorksheetEditPermission, _univerjs_sheets.WorksheetSetColumnStylePermission],
|
|
13989
|
-
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionEditPoint]
|
|
13990
|
-
});
|
|
13991
|
-
errorMsg = this._localeService.t("sheets-ui.permission.dialog.pasteErr");
|
|
13992
|
-
break;
|
|
13993
|
-
case SheetPasteShortKeyCommand.id:
|
|
13994
|
-
case SheetPasteCommand.id:
|
|
13995
|
-
params = commandInfo.params;
|
|
13996
|
-
permission = this._permissionCheckByPaste(params);
|
|
13997
|
-
errorMsg = this._localeService.t("sheets-ui.permission.dialog.pasteErr");
|
|
13998
|
-
break;
|
|
13999
14068
|
case ApplyFormatPainterCommand.id:
|
|
14000
14069
|
permission = this._sheetPermissionCheckController.permissionCheckWithRanges({
|
|
14001
14070
|
workbookTypes: [_univerjs_sheets.WorkbookEditablePermission],
|
|
@@ -14008,28 +14077,6 @@ let SheetPermissionCheckUIController = class SheetPermissionCheckUIController ex
|
|
|
14008
14077
|
});
|
|
14009
14078
|
errorMsg = this._localeService.t("sheets-ui.permission.dialog.commonErr");
|
|
14010
14079
|
break;
|
|
14011
|
-
case SheetCopyCommand.id:
|
|
14012
|
-
var _this$_permissionServ;
|
|
14013
|
-
permission = this._sheetPermissionCheckController.permissionCheckWithRanges({
|
|
14014
|
-
workbookTypes: [_univerjs_sheets.WorkbookCopyPermission],
|
|
14015
|
-
worksheetTypes: [_univerjs_sheets.WorksheetCopyPermission],
|
|
14016
|
-
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionViewPoint]
|
|
14017
|
-
});
|
|
14018
|
-
errorMsg = this._localeService.t("sheets-ui.permission.dialog.copyErr");
|
|
14019
|
-
target = (0, _univerjs_sheets.getSheetCommandTarget)(this._univerInstanceService);
|
|
14020
|
-
if (!permission && target && !((_this$_permissionServ = this._permissionService.getPermissionPoint(new _univerjs_sheets.WorkbookCopyPermission(target.unitId).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value)) errorMsg = this._localeService.t("sheets-ui.permission.dialog.workbookCopyErr");
|
|
14021
|
-
break;
|
|
14022
|
-
case SheetCutCommand.id:
|
|
14023
|
-
var _this$_permissionServ2;
|
|
14024
|
-
permission = this._sheetPermissionCheckController.permissionCheckWithRanges({
|
|
14025
|
-
workbookTypes: [_univerjs_sheets.WorkbookCopyPermission, _univerjs_sheets.WorkbookEditablePermission],
|
|
14026
|
-
worksheetTypes: [_univerjs_sheets.WorksheetCopyPermission, _univerjs_sheets.WorksheetEditPermission],
|
|
14027
|
-
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionViewPoint, _univerjs_sheets.RangeProtectionPermissionEditPoint]
|
|
14028
|
-
});
|
|
14029
|
-
errorMsg = this._localeService.t("sheets-ui.permission.dialog.copyErr");
|
|
14030
|
-
target = (0, _univerjs_sheets.getSheetCommandTarget)(this._univerInstanceService);
|
|
14031
|
-
if (!permission && target && !((_this$_permissionServ2 = this._permissionService.getPermissionPoint(new _univerjs_sheets.WorkbookCopyPermission(target.unitId).id)) === null || _this$_permissionServ2 === void 0 ? void 0 : _this$_permissionServ2.value)) errorMsg = this._localeService.t("sheets-ui.permission.dialog.workbookCopyErr");
|
|
14032
|
-
break;
|
|
14033
14080
|
default: break;
|
|
14034
14081
|
}
|
|
14035
14082
|
if (!permission) this._sheetPermissionCheckController.blockExecuteWithoutPermission(errorMsg);
|
|
@@ -14042,37 +14089,15 @@ let SheetPermissionCheckUIController = class SheetPermissionCheckUIController ex
|
|
|
14042
14089
|
this._getPermissionCheck(commandInfo);
|
|
14043
14090
|
}));
|
|
14044
14091
|
}
|
|
14045
|
-
_permissionCheckByPaste(params) {
|
|
14046
|
-
if (params.value === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_VALUE || params.value === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMULA) return this._sheetPermissionCheckController.permissionCheckWithRanges({
|
|
14047
|
-
workbookTypes: [_univerjs_sheets.WorkbookEditablePermission],
|
|
14048
|
-
worksheetTypes: [_univerjs_sheets.WorksheetSetCellStylePermission, _univerjs_sheets.WorksheetEditPermission],
|
|
14049
|
-
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionEditPoint]
|
|
14050
|
-
});
|
|
14051
|
-
else if (params.value === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT) return this._sheetPermissionCheckController.permissionCheckWithRanges({
|
|
14052
|
-
workbookTypes: [_univerjs_sheets.WorkbookEditablePermission],
|
|
14053
|
-
worksheetTypes: [_univerjs_sheets.WorksheetSetCellStylePermission, _univerjs_sheets.WorksheetEditPermission],
|
|
14054
|
-
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionEditPoint]
|
|
14055
|
-
});
|
|
14056
|
-
else return this._sheetPermissionCheckController.permissionCheckWithRanges({
|
|
14057
|
-
workbookTypes: [_univerjs_sheets.WorkbookEditablePermission],
|
|
14058
|
-
worksheetTypes: [
|
|
14059
|
-
_univerjs_sheets.WorksheetSetCellValuePermission,
|
|
14060
|
-
_univerjs_sheets.WorksheetSetCellStylePermission,
|
|
14061
|
-
_univerjs_sheets.WorksheetEditPermission
|
|
14062
|
-
],
|
|
14063
|
-
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionEditPoint]
|
|
14064
|
-
});
|
|
14065
|
-
}
|
|
14066
14092
|
};
|
|
14067
14093
|
SheetPermissionCheckUIController = __decorate([
|
|
14068
14094
|
__decorateParam(0, _univerjs_core.ICommandService),
|
|
14069
|
-
__decorateParam(1, _univerjs_core.
|
|
14070
|
-
__decorateParam(2,
|
|
14071
|
-
__decorateParam(3,
|
|
14072
|
-
__decorateParam(4, (0, _univerjs_core.Inject)(
|
|
14073
|
-
__decorateParam(5,
|
|
14074
|
-
__decorateParam(6, _univerjs_core.
|
|
14075
|
-
__decorateParam(7, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetPermissionCheckController))
|
|
14095
|
+
__decorateParam(1, _univerjs_core.IPermissionService),
|
|
14096
|
+
__decorateParam(2, _univerjs_ui.IDialogService),
|
|
14097
|
+
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_sheets.RangeProtectionRuleModel)),
|
|
14098
|
+
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
|
|
14099
|
+
__decorateParam(5, _univerjs_core.IContextService),
|
|
14100
|
+
__decorateParam(6, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetPermissionCheckController))
|
|
14076
14101
|
], SheetPermissionCheckUIController);
|
|
14077
14102
|
|
|
14078
14103
|
//#endregion
|
|
@@ -19480,11 +19505,11 @@ function Text2NumberContextMenuItemFactory(accessor) {
|
|
|
19480
19505
|
//#endregion
|
|
19481
19506
|
//#region src/views/sheet-slider/SheetZoomInput.tsx
|
|
19482
19507
|
const SHEET_ZOOM_INPUT_COMPONENT = "SHEET_ZOOM_INPUT_COMPONENT";
|
|
19483
|
-
function SheetZoomInput(props) {
|
|
19508
|
+
function SheetZoomInput({ className, ...props }) {
|
|
19484
19509
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
19485
19510
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_ui.ZoomInput, {
|
|
19486
19511
|
...props,
|
|
19487
|
-
className: "!univer-bg-transparent dark:!univer-bg-transparent",
|
|
19512
|
+
className: (0, _univerjs_design.clsx)("!univer-bg-transparent dark:!univer-bg-transparent", className),
|
|
19488
19513
|
onChange: (value) => commandService.executeCommand(SetZoomRatioFromToolbarCommand.id, { value })
|
|
19489
19514
|
});
|
|
19490
19515
|
}
|
|
@@ -19538,48 +19563,97 @@ const menuSchema = {
|
|
|
19538
19563
|
[_univerjs_ui.RibbonStartGroup.HISTORY]: {
|
|
19539
19564
|
[SetOnceFormatPainterCommand.id]: {
|
|
19540
19565
|
order: 2,
|
|
19566
|
+
gridLayout: {
|
|
19567
|
+
row: 1,
|
|
19568
|
+
column: 2,
|
|
19569
|
+
showLabel: true
|
|
19570
|
+
},
|
|
19541
19571
|
menuItemFactory: FormatPainterMenuItemFactory
|
|
19542
19572
|
},
|
|
19543
19573
|
[_univerjs_sheets.ClearSelectionAllCommand.id]: {
|
|
19544
19574
|
order: 3,
|
|
19575
|
+
gridLayout: {
|
|
19576
|
+
row: 2,
|
|
19577
|
+
column: 2,
|
|
19578
|
+
showLabel: true
|
|
19579
|
+
},
|
|
19545
19580
|
menuItemFactory: ClearSelectionAllToolbarMenuItemFactory
|
|
19546
19581
|
}
|
|
19547
19582
|
},
|
|
19548
19583
|
[_univerjs_ui.RibbonStartGroup.FORMAT]: {
|
|
19549
19584
|
[SetRangeFontFamilyCommand.id]: {
|
|
19550
19585
|
order: 1,
|
|
19586
|
+
gridLayout: {
|
|
19587
|
+
row: 1,
|
|
19588
|
+
column: 1,
|
|
19589
|
+
columnSpan: 4,
|
|
19590
|
+
width: 240
|
|
19591
|
+
},
|
|
19551
19592
|
menuItemFactory: FontFamilySelectorMenuItemFactory
|
|
19552
19593
|
},
|
|
19553
19594
|
[SetRangeFontSizeCommand.id]: {
|
|
19554
19595
|
order: 2,
|
|
19596
|
+
gridLayout: {
|
|
19597
|
+
row: 1,
|
|
19598
|
+
column: 5,
|
|
19599
|
+
width: 72
|
|
19600
|
+
},
|
|
19555
19601
|
menuItemFactory: FontSizeSelectorMenuItemFactory
|
|
19556
19602
|
},
|
|
19557
19603
|
[SetRangeFontIncreaseCommand.id]: {
|
|
19558
19604
|
order: 2.1,
|
|
19605
|
+
gridLayout: {
|
|
19606
|
+
row: 1,
|
|
19607
|
+
column: 6
|
|
19608
|
+
},
|
|
19559
19609
|
menuItemFactory: FontSizeIncreaseMenuItemFactory
|
|
19560
19610
|
},
|
|
19561
19611
|
[SetRangeFontDecreaseCommand.id]: {
|
|
19562
19612
|
order: 2.2,
|
|
19613
|
+
gridLayout: {
|
|
19614
|
+
row: 1,
|
|
19615
|
+
column: 7
|
|
19616
|
+
},
|
|
19563
19617
|
menuItemFactory: FontSizeDecreaseMenuItemFactory
|
|
19564
19618
|
},
|
|
19565
19619
|
[SetRangeBoldCommand.id]: {
|
|
19566
19620
|
order: 5,
|
|
19621
|
+
gridLayout: {
|
|
19622
|
+
row: 2,
|
|
19623
|
+
column: 1
|
|
19624
|
+
},
|
|
19567
19625
|
menuItemFactory: BoldMenuItemFactory
|
|
19568
19626
|
},
|
|
19569
19627
|
[SetRangeItalicCommand.id]: {
|
|
19570
19628
|
order: 6,
|
|
19629
|
+
gridLayout: {
|
|
19630
|
+
row: 2,
|
|
19631
|
+
column: 2
|
|
19632
|
+
},
|
|
19571
19633
|
menuItemFactory: ItalicMenuItemFactory
|
|
19572
19634
|
},
|
|
19573
19635
|
[SetRangeUnderlineCommand.id]: {
|
|
19574
19636
|
order: 7,
|
|
19637
|
+
gridLayout: {
|
|
19638
|
+
row: 2,
|
|
19639
|
+
column: 3
|
|
19640
|
+
},
|
|
19575
19641
|
menuItemFactory: UnderlineMenuItemFactory
|
|
19576
19642
|
},
|
|
19577
19643
|
[SetRangeStrickThroughCommand.id]: {
|
|
19578
19644
|
order: 8,
|
|
19645
|
+
gridLayout: {
|
|
19646
|
+
row: 2,
|
|
19647
|
+
column: 4
|
|
19648
|
+
},
|
|
19579
19649
|
menuItemFactory: StrikeThroughMenuItemFactory
|
|
19580
19650
|
},
|
|
19581
19651
|
[SetRangeTextColorCommand.id]: {
|
|
19582
19652
|
order: 9,
|
|
19653
|
+
gridLayout: {
|
|
19654
|
+
row: 2,
|
|
19655
|
+
column: 7
|
|
19656
|
+
},
|
|
19583
19657
|
menuItemFactory: TextColorSelectorMenuItemFactory,
|
|
19584
19658
|
[_univerjs_sheets.ResetTextColorCommand.id]: {
|
|
19585
19659
|
order: 0,
|
|
@@ -19588,6 +19662,10 @@ const menuSchema = {
|
|
|
19588
19662
|
},
|
|
19589
19663
|
[_univerjs_sheets.SetBackgroundColorCommand.id]: {
|
|
19590
19664
|
order: 10,
|
|
19665
|
+
gridLayout: {
|
|
19666
|
+
row: 2,
|
|
19667
|
+
column: 6
|
|
19668
|
+
},
|
|
19591
19669
|
menuItemFactory: BackgroundColorSelectorMenuItemFactory,
|
|
19592
19670
|
[_univerjs_sheets.ResetBackgroundColorCommand.id]: {
|
|
19593
19671
|
order: 0,
|
|
@@ -19596,32 +19674,60 @@ const menuSchema = {
|
|
|
19596
19674
|
},
|
|
19597
19675
|
[_univerjs_sheets.SetBorderBasicCommand.id]: {
|
|
19598
19676
|
order: 11,
|
|
19677
|
+
gridLayout: {
|
|
19678
|
+
row: 2,
|
|
19679
|
+
column: 5
|
|
19680
|
+
},
|
|
19599
19681
|
menuItemFactory: CellBorderSelectorMenuItemFactory
|
|
19600
19682
|
}
|
|
19601
19683
|
},
|
|
19602
19684
|
[_univerjs_ui.RibbonStartGroup.LAYOUT]: {
|
|
19603
19685
|
[_univerjs_sheets.SetHorizontalTextAlignCommand.id]: {
|
|
19604
19686
|
order: 0,
|
|
19687
|
+
gridLayout: {
|
|
19688
|
+
row: 1,
|
|
19689
|
+
column: 3
|
|
19690
|
+
},
|
|
19605
19691
|
menuItemFactory: HorizontalAlignMenuItemFactory
|
|
19606
19692
|
},
|
|
19607
19693
|
[_univerjs_sheets.SetVerticalTextAlignCommand.id]: {
|
|
19608
19694
|
order: 3,
|
|
19695
|
+
gridLayout: {
|
|
19696
|
+
row: 2,
|
|
19697
|
+
column: 1
|
|
19698
|
+
},
|
|
19609
19699
|
menuItemFactory: VerticalAlignMenuItemFactory
|
|
19610
19700
|
},
|
|
19611
19701
|
[_univerjs_sheets.SetTextWrapCommand.id]: {
|
|
19612
19702
|
order: 6,
|
|
19703
|
+
gridLayout: {
|
|
19704
|
+
row: 1,
|
|
19705
|
+
column: 2
|
|
19706
|
+
},
|
|
19613
19707
|
menuItemFactory: WrapTextMenuItemFactory
|
|
19614
19708
|
},
|
|
19615
19709
|
[_univerjs_sheets.SetShrinkToFitCommand.id]: {
|
|
19616
19710
|
order: 7,
|
|
19711
|
+
gridLayout: {
|
|
19712
|
+
row: 2,
|
|
19713
|
+
column: 2
|
|
19714
|
+
},
|
|
19617
19715
|
menuItemFactory: ShrinkToFitMenuItemFactory
|
|
19618
19716
|
},
|
|
19619
19717
|
[_univerjs_sheets.SetTextRotationCommand.id]: {
|
|
19620
19718
|
order: 8,
|
|
19719
|
+
gridLayout: {
|
|
19720
|
+
row: 1,
|
|
19721
|
+
column: 3
|
|
19722
|
+
},
|
|
19621
19723
|
menuItemFactory: TextRotateMenuItemFactory
|
|
19622
19724
|
},
|
|
19623
19725
|
[_univerjs_sheets.AddWorksheetMergeCommand.id]: {
|
|
19624
19726
|
order: 9,
|
|
19727
|
+
gridLayout: {
|
|
19728
|
+
row: 2,
|
|
19729
|
+
column: 3
|
|
19730
|
+
},
|
|
19625
19731
|
menuItemFactory: CellMergeMenuItemFactory,
|
|
19626
19732
|
[_univerjs_sheets.AddWorksheetMergeAllCommand.id]: {
|
|
19627
19733
|
order: 0,
|
|
@@ -19643,6 +19749,10 @@ const menuSchema = {
|
|
|
19643
19749
|
},
|
|
19644
19750
|
[_univerjs_ui.RibbonStartGroup.OTHERS]: { [AddRangeProtectionFromToolbarCommand.id]: {
|
|
19645
19751
|
order: 0,
|
|
19752
|
+
gridLayout: {
|
|
19753
|
+
row: 1,
|
|
19754
|
+
column: 3
|
|
19755
|
+
},
|
|
19646
19756
|
menuItemFactory: sheetPermissionToolbarMenuFactory
|
|
19647
19757
|
} }
|
|
19648
19758
|
},
|
|
@@ -19650,19 +19760,41 @@ const menuSchema = {
|
|
|
19650
19760
|
[_univerjs_ui.RibbonViewGroup.DISPLAY]: {
|
|
19651
19761
|
[SHEET_FROZEN_TOOLBAR_MENU_ID]: {
|
|
19652
19762
|
order: 0,
|
|
19763
|
+
gridLayout: {
|
|
19764
|
+
row: 1,
|
|
19765
|
+
column: 1,
|
|
19766
|
+
rowSpan: 2,
|
|
19767
|
+
showLabel: true
|
|
19768
|
+
},
|
|
19653
19769
|
menuItemFactory: SheetFrozenToolbarMenuItemFactory
|
|
19654
19770
|
},
|
|
19655
19771
|
[ZOOM_RATIO_MENU_ID]: {
|
|
19656
19772
|
order: 1,
|
|
19773
|
+
gridLayout: {
|
|
19774
|
+
row: 1,
|
|
19775
|
+
column: 2,
|
|
19776
|
+
width: 112
|
|
19777
|
+
},
|
|
19657
19778
|
menuItemFactory: ZoomRatioMenuItemFactory
|
|
19658
19779
|
},
|
|
19659
19780
|
[_univerjs_ui.ToggleFullscreenOperation.id]: {
|
|
19660
19781
|
order: 2,
|
|
19782
|
+
gridLayout: {
|
|
19783
|
+
row: 2,
|
|
19784
|
+
column: 2,
|
|
19785
|
+
showLabel: true,
|
|
19786
|
+
width: 112
|
|
19787
|
+
},
|
|
19661
19788
|
menuItemFactory: FullscreenMenuItemFactory
|
|
19662
19789
|
}
|
|
19663
19790
|
},
|
|
19664
19791
|
[_univerjs_ui.RibbonViewGroup.VISIBILITY]: { [_univerjs_sheets.ToggleGridlinesCommand.id]: {
|
|
19665
19792
|
order: 0,
|
|
19793
|
+
gridLayout: {
|
|
19794
|
+
row: 1,
|
|
19795
|
+
column: 1,
|
|
19796
|
+
showLabel: true
|
|
19797
|
+
},
|
|
19666
19798
|
menuItemFactory: ToggleGridlinesMenuFactory
|
|
19667
19799
|
} }
|
|
19668
19800
|
},
|
|
@@ -24063,7 +24195,7 @@ const useHighlightRange = (ranges = []) => {
|
|
|
24063
24195
|
//#endregion
|
|
24064
24196
|
//#region package.json
|
|
24065
24197
|
var name = "@univerjs/sheets-ui";
|
|
24066
|
-
var version = "1.0.0-alpha.
|
|
24198
|
+
var version = "1.0.0-alpha.7";
|
|
24067
24199
|
|
|
24068
24200
|
//#endregion
|
|
24069
24201
|
//#region src/views/cell-popup/config.ts
|
|
@@ -26031,7 +26163,7 @@ const DefinedNameContainer = () => {
|
|
|
26031
26163
|
};
|
|
26032
26164
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
26033
26165
|
"data-u-comp": "defined-name-container",
|
|
26034
|
-
className: "univer-relative univer-box-border univer-flex univer-h-full univer-w-full univer-flex-col",
|
|
26166
|
+
className: "univer-relative univer-box-border univer-flex univer-h-full univer-w-full univer-flex-col univer-overflow-hidden",
|
|
26035
26167
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
26036
26168
|
className: "univer-mb-4",
|
|
26037
26169
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.Button, {
|
|
@@ -31797,6 +31929,7 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends _unive
|
|
|
31797
31929
|
[SheetContextMenuMobileRenderController],
|
|
31798
31930
|
[MobileHeaderResizeRenderController],
|
|
31799
31931
|
[MoveRangeRenderController],
|
|
31932
|
+
[AutoFillRenderController],
|
|
31800
31933
|
[EditorBridgeRenderController],
|
|
31801
31934
|
[SheetPermissionInterceptorCanvasRenderController],
|
|
31802
31935
|
[SheetPermissionInterceptorFormulaRenderController],
|
|
@@ -32417,6 +32550,7 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends _univerjs_core.Plu
|
|
|
32417
32550
|
[CellCustomRenderController],
|
|
32418
32551
|
[SheetContextMenuRenderController],
|
|
32419
32552
|
[MoveRangeRenderController],
|
|
32553
|
+
[AutoFillRenderController],
|
|
32420
32554
|
[EditorBridgeRenderController],
|
|
32421
32555
|
[SheetPermissionInterceptorCanvasRenderController],
|
|
32422
32556
|
[SheetPermissionInterceptorFormulaRenderController],
|