@univerjs/sheets-ui 0.5.5-nightly.202501221606 → 0.5.5-nightly.202501241606
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 +5 -5
- package/lib/es/facade.js +3 -0
- package/lib/es/index.js +104 -72
- package/lib/types/facade/f-event.d.ts +41 -32
- package/lib/types/facade/f-permission.d.ts +3 -0
- package/lib/types/facade/f-range.d.ts +3 -0
- package/lib/types/facade/f-sheet-hooks.d.ts +3 -0
- package/lib/types/facade/f-univer.d.ts +6 -0
- package/lib/types/facade/f-workbook.d.ts +3 -0
- package/lib/types/facade/f-worksheet.d.ts +3 -0
- package/lib/types/services/clipboard/utils.d.ts +1 -1
- package/lib/umd/index.js +5 -5
- package/package.json +14 -14
- package/lib/types/commands/commands/__tests__/add-worksheet-merge.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/auto-fill.controller.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +0 -7
- package/lib/types/commands/commands/__tests__/create-selection-command-test-bed.d.ts +0 -28
- package/lib/types/commands/commands/__tests__/create-sheet-skeleton-test-bed.d.ts +0 -22
- package/lib/types/commands/commands/__tests__/hide-row-col-confirm.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/remove-row-col-confirm.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/selection-utils.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-format-painter.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-frozen.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-selections.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/sheet-skeleton.spec.d.ts +0 -16
- package/lib/types/controllers/editor/__tests__/create-test-bed.d.ts +0 -7
- package/lib/types/controllers/editor/__tests__/end-edit.controller.spec.d.ts +0 -16
- package/lib/types/controllers/editor/__tests__/mock-function.service.d.ts +0 -5
- package/lib/types/controllers/menu/__tests__/create-menu-test-bed.d.ts +0 -13
- package/lib/types/controllers/menu/__tests__/menu.spec.d.ts +0 -16
- package/lib/types/controllers/menu/__tests__/row-col.menu.spec.d.ts +0 -16
- package/lib/types/controllers/utils/__tests__/cell-tools.spec.d.ts +0 -16
- package/lib/types/facade/__tests__/create-test-bed.d.ts +0 -10
- package/lib/types/facade/__tests__/f-sheet-hooks.spec.d.ts +0 -16
- package/lib/types/services/auto-fill/__tests__/tool.spec.d.ts +0 -16
- package/lib/types/services/clipboard/__tests__/clipboard-copy-filter.spec.d.ts +0 -16
- package/lib/types/services/clipboard/__tests__/clipboard-paste-alignment.spec.d.ts +0 -16
- package/lib/types/services/clipboard/__tests__/clipboard-paste-border.spec.d.ts +0 -16
- package/lib/types/services/clipboard/__tests__/clipboard-paste-col-width.spec.d.ts +0 -16
- package/lib/types/services/clipboard/__tests__/clipboard-paste-font.spec.d.ts +0 -16
- package/lib/types/services/clipboard/__tests__/clipboard-paste-form-excel.spec.d.ts +0 -16
- package/lib/types/services/clipboard/__tests__/clipboard-paste-from-google.spec.d.ts +0 -16
- package/lib/types/services/clipboard/__tests__/clipboard-paste-from-notepad.spec.d.ts +0 -16
- package/lib/types/services/clipboard/__tests__/clipboard-paste-rotate.spec.d.ts +0 -16
- package/lib/types/services/clipboard/__tests__/clipboard-service.spec.d.ts +0 -16
- package/lib/types/services/clipboard/__tests__/clipboard-test-bed.d.ts +0 -29
- package/lib/types/services/clipboard/__tests__/constant.d.ts +0 -28
- package/lib/types/services/clipboard/__tests__/mock-clipboard.d.ts +0 -39
- package/lib/types/services/clipboard/__tests__/sheet-paste.spec.d.ts +0 -16
- package/lib/types/services/clipboard/__tests__/utils.spec.d.ts +0 -16
package/lib/es/facade.js
CHANGED
|
@@ -130,6 +130,9 @@ const _FUniverSheetsUIMixin = class _FUniverSheetsUIMixin extends FUniver {
|
|
|
130
130
|
}
|
|
131
131
|
})), this._initObserverListener(injector);
|
|
132
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* @ignore
|
|
135
|
+
*/
|
|
133
136
|
// eslint-disable-next-line max-lines-per-function
|
|
134
137
|
_initObserverListener(injector) {
|
|
135
138
|
const unitM = injector.get(IUniverInstanceService).getFocusedUnit(), unitId = unitM == null ? void 0 : unitM.getUnitId(), renderManagerService = injector.get(IRenderManagerService);
|
package/lib/es/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { IRenderManagerService, SHEET_VIEWPORT_KEY, CURSOR_TYPE, Vector2, Rect,
|
|
|
8
8
|
import { useObservable, KeyCode, ILayoutService, MetaKeys, DEFAULT_BACKGROUND_COLOR_RGB, DEFAULT_BACKGROUND_COLOR_RGBA, handleStringToStyle, textTrim, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, HTML_CLIPBOARD_MIME_TYPE, imageMimeTypeSet, IClipboardInterfaceService, INotificationService, IPlatformService, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, CopyCommand, CutCommand, PasteCommand, SheetPasteShortKeyCommandName, IConfirmService, IContextMenuService, MenuItemType, getMenuHiddenObservable, FONT_FAMILY_LIST, FONT_SIZE_LIST, ISidebarService, IDialogService, ComponentManager, useSidebarClick, DISABLE_AUTO_FOCUS_KEY, useEvent, useComponentsOfPart, ComponentContainer, UI_PLUGIN_CONFIG_KEY, UIMenu, ContextMenuPosition, IMessageService, IMenuManagerService, ToolbarItem, RibbonStartGroup, ContextMenuGroup, FontFamily, FontFamilyItem, FontSize, BuiltInUIPart, IShortcutService, IUIPartsService, ICanvasPopupService, IZenZoneService, UniverMobileUIPlugin } from "@univerjs/ui";
|
|
9
9
|
import React, { useMemo, useState, useEffect, forwardRef, useRef, createElement, useCallback, useLayoutEffect } from "react";
|
|
10
10
|
import { BehaviorSubject, Subject, of, merge, map, startWith, switchMap, takeUntil, distinctUntilChanged, throttleTime, filter, combineLatest, debounceTime, Observable, combineLatestWith, Subscription, withLatestFrom, EMPTY } from "rxjs";
|
|
11
|
-
import { SELECTION_CONTROL_BORDER_BUFFER_WIDTH, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTIONS_ENABLED, REF_SELECTIONS_ENABLED, SheetsSelectionsService, SheetInterceptorService, SetWorksheetRowAutoHeightMutationFactory, SetWorksheetRowAutoHeightMutation, SetRangeValuesCommand, SetWorksheetRowIsAutoHeightCommand, SetStyleCommand, MoveRangeCommand, ReorderRangeCommand, SetSelectionsOperation, SetRangeValuesMutation, getSheetCommandTarget, generateNullCellValue, SetRangeValuesUndoMutationFactory, BEFORE_CELL_EDIT, IRefSelectionsService, SetWorksheetActiveOperation, MoveRangeMutation, RemoveRowMutation, RemoveColMutation, InsertRowMutation, InsertColMutation, MoveRowsMutation, MoveColsMutation, SetWorksheetColWidthMutation, SetWorksheetRowHeightMutation, RemoveSheetMutation, RemoveMergeUndoMutationFactory, RemoveWorksheetMergeMutation, AddWorksheetMergeMutation, getAddMergeMutationRangeByType, AddMergeUndoMutationFactory, WorkbookEditablePermission, WorksheetEditPermission, UnitAction, alignToMergedCellsBorders, getSelectionsService, getCellAtRowCol, SelectionMoveType, expandToContinuousRange, ScrollToCellOperation, COMMAND_LISTENER_SKELETON_CHANGE, SetWorksheetActivateCommand, getPrimaryForRange, SetRowHiddenCommand, SetColHiddenCommand, SetBoldCommand, SetItalicCommand, SetUnderlineCommand, SetStrikeThroughCommand, SetFontSizeCommand, SetFontFamilyCommand, SetTextColorCommand, SetFrozenMutationFactory, SetFrozenMutation, IExclusiveRangeService, RangeProtectionRuleModel, WorksheetProtectionRuleModel, RangeProtectionPermissionEditPoint, WorksheetCopyPermission, WorksheetSetCellStylePermission, ResetBackgroundColorCommand, SetBackgroundColorCommand, SetHorizontalTextAlignCommand, SetVerticalTextAlignCommand, SetTextWrapCommand, SetTextRotationCommand, WorkbookCopyPermission, RangeProtectionPermissionViewPoint, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, CancelFrozenCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectedRowsVisibleCommand, SetColHiddenMutation, SetColVisibleMutation, SetSelectedColsVisibleCommand, SetRowHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetColWidthCommand, SetFrozenCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowCommand, InsertColCommand, MoveColsCommand, MoveRowsCommand, RemoveColCommand, RemoveRowCommand, MergeCellController, MERGE_CELL_INTERCEPTOR_CHECK, DeltaRowHeightCommand, DeltaColumnWidthCommand, COMMAND_LISTENER_VALUE_CHANGE, AddMergeRedoSelectionsOperationFactory, AddMergeUndoSelectionsOperationFactory, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, UnitObject, ViewStateEnum, EditStateEnum, DeleteWorksheetProtectionCommand, DeleteRangeProtectionMutation, AddRangeProtectionMutation, RemoveSheetCommand, AddWorksheetProtectionCommand, BorderStyleManagerService, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, InsertDefinedNameCommand, SetDefinedNameCommand, RemoveDefinedNameCommand, SetWorksheetShowCommand, SetWorksheetOrderMutation, InsertSheetMutation, SetWorksheetNameMutation, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetOrderCommand, WorkbookManageCollaboratorPermission, WorkbookRenameSheetPermission, SetTabColorMutation, WorkbookCreateSheetPermission, InsertSheetCommand, SetBorderBasicCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, ClearSelectionAllCommand, WorksheetDeleteColumnPermission, WorksheetDeleteRowPermission, ToggleGridlinesCommand, ToggleGridlinesMutation, WorksheetInsertColumnPermission, WorksheetInsertRowPermission, InsertRowBeforeCommand, InsertRowAfterCommand, InsertColBeforeCommand, InsertColAfterCommand, RemoveWorksheetMergeCommand, WorksheetManageCollaboratorPermission,
|
|
11
|
+
import { SELECTION_CONTROL_BORDER_BUFFER_WIDTH, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTIONS_ENABLED, REF_SELECTIONS_ENABLED, SheetsSelectionsService, SheetInterceptorService, SetWorksheetRowAutoHeightMutationFactory, SetWorksheetRowAutoHeightMutation, SetRangeValuesCommand, SetWorksheetRowIsAutoHeightCommand, SetStyleCommand, MoveRangeCommand, ReorderRangeCommand, SetSelectionsOperation, SetRangeValuesMutation, getSheetCommandTarget, generateNullCellValue, SetRangeValuesUndoMutationFactory, BEFORE_CELL_EDIT, IRefSelectionsService, SetWorksheetActiveOperation, MoveRangeMutation, RemoveRowMutation, RemoveColMutation, InsertRowMutation, InsertColMutation, MoveRowsMutation, MoveColsMutation, SetWorksheetColWidthMutation, SetWorksheetRowHeightMutation, RemoveSheetMutation, RemoveMergeUndoMutationFactory, RemoveWorksheetMergeMutation, AddWorksheetMergeMutation, getAddMergeMutationRangeByType, AddMergeUndoMutationFactory, WorkbookEditablePermission, WorksheetEditPermission, UnitAction, alignToMergedCellsBorders, getSelectionsService, getCellAtRowCol, SelectionMoveType, expandToContinuousRange, ScrollToCellOperation, COMMAND_LISTENER_SKELETON_CHANGE, SetWorksheetActivateCommand, getPrimaryForRange, SetRowHiddenCommand, SetColHiddenCommand, SetBoldCommand, SetItalicCommand, SetUnderlineCommand, SetStrikeThroughCommand, SetFontSizeCommand, SetFontFamilyCommand, SetTextColorCommand, SetFrozenMutationFactory, SetFrozenMutation, IExclusiveRangeService, RangeProtectionRuleModel, WorksheetProtectionRuleModel, RangeProtectionPermissionEditPoint, WorksheetCopyPermission, WorksheetSetCellStylePermission, ResetBackgroundColorCommand, SetBackgroundColorCommand, SetHorizontalTextAlignCommand, SetVerticalTextAlignCommand, SetTextWrapCommand, SetTextRotationCommand, WorkbookCopyPermission, RangeProtectionPermissionViewPoint, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, CancelFrozenCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectedRowsVisibleCommand, SetColHiddenMutation, SetColVisibleMutation, SetSelectedColsVisibleCommand, SetRowHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetColWidthCommand, SetFrozenCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowCommand, InsertColCommand, MoveColsCommand, MoveRowsCommand, RemoveColCommand, RemoveRowCommand, MergeCellController, MERGE_CELL_INTERCEPTOR_CHECK, DeltaRowHeightCommand, DeltaColumnWidthCommand, COMMAND_LISTENER_VALUE_CHANGE, AddMergeRedoSelectionsOperationFactory, AddMergeUndoSelectionsOperationFactory, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, UnitObject, ViewStateEnum, EditStateEnum, DeleteWorksheetProtectionCommand, DeleteRangeProtectionMutation, AddRangeProtectionMutation, RemoveSheetCommand, AddWorksheetProtectionCommand, BorderStyleManagerService, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, InsertDefinedNameCommand, SetDefinedNameCommand, RemoveDefinedNameCommand, SetWorksheetShowCommand, RangeProtectionCache, WorksheetViewPermission, SetWorksheetOrderMutation, InsertSheetMutation, SetWorksheetNameMutation, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetOrderCommand, WorkbookManageCollaboratorPermission, WorkbookRenameSheetPermission, SetTabColorMutation, WorkbookCreateSheetPermission, InsertSheetCommand, SetBorderBasicCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, ClearSelectionAllCommand, WorksheetDeleteColumnPermission, WorksheetDeleteRowPermission, ToggleGridlinesCommand, ToggleGridlinesMutation, WorksheetInsertColumnPermission, WorksheetInsertRowPermission, InsertRowBeforeCommand, InsertRowAfterCommand, InsertColBeforeCommand, InsertColAfterCommand, RemoveWorksheetMergeCommand, WorksheetManageCollaboratorPermission, WorkbookCreateProtectPermission, WorksheetDeleteProtectionPermission, CopySheetCommand, SetTabColorCommand, SetWorksheetHideCommand, WorkbookDeleteSheetPermission, WorkbookHideSheetPermission, ResetTextColorCommand, AddWorksheetMergeCommand as AddWorksheetMergeCommand$1, AddWorksheetMergeAllCommand as AddWorksheetMergeAllCommand$1, AddWorksheetMergeVerticalCommand as AddWorksheetMergeVerticalCommand$1, AddWorksheetMergeHorizontalCommand as AddWorksheetMergeHorizontalCommand$1, RefRangeService, MAX_CELL_PER_SHEET_KEY, INTERCEPTOR_POINT, SheetPermissionCheckController, INumfmtService, SetProtectionCommand, AddRangeProtectionCommand, setEndForRange, baseProtectionActions, DeleteRangeProtectionCommand, WorksheetProtectionPointModel, SetWorksheetPermissionPointsCommand, getAllWorksheetPermissionPoint, convertSelectionDataToRange, UniverSheetsPlugin, RefSelectionsService, ToggleCellCheckboxCommand, SetSpecificRowsVisibleCommand, SetSpecificColsVisibleCommand } from "@univerjs/sheets";
|
|
12
12
|
import { DocSkeletonManagerService, DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from "@univerjs/docs";
|
|
13
13
|
import { sequenceNodeType, matchToken, LexerTreeBuilder, IFunctionService, SetFormulaCalculationNotificationMutation, IDefinedNamesService, operatorToken, isReferenceStrings, isReferenceStringWithEffectiveColumn, serializeRangeWithSheet, FUNCTION_NAMES_STATISTICAL, FUNCTION_NAMES_MATH, FUNCTION_NAMES_TEXT, NullValueObject, serializeRange, deserializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
14
14
|
import { DEFAULT_TEXT_FORMAT } from "@univerjs/engine-numfmt";
|
|
@@ -7305,10 +7305,23 @@ const getRepeatRange = /* @__PURE__ */ __name((sourceRange, targetRange, isStric
|
|
|
7305
7305
|
}
|
|
7306
7306
|
return repeatList;
|
|
7307
7307
|
}, "getRepeatRange");
|
|
7308
|
-
|
|
7309
|
-
return html ?
|
|
7310
|
-
|
|
7311
|
-
|
|
7308
|
+
function htmlIsFromExcel(html) {
|
|
7309
|
+
return html ? [
|
|
7310
|
+
// Excel class names
|
|
7311
|
+
/<td[^>]*class=".*?xl.*?"[^>]*>/i,
|
|
7312
|
+
// Excel namespace
|
|
7313
|
+
/xmlns:x="urn:schemas-microsoft-com:office:excel"/i,
|
|
7314
|
+
// Excel ProgID
|
|
7315
|
+
/ProgId="Excel.Sheet"/i,
|
|
7316
|
+
// Office specific namespace
|
|
7317
|
+
/xmlns:o="urn:schemas-microsoft-com:office:office"/i,
|
|
7318
|
+
// Excel specific style markers
|
|
7319
|
+
/@mso-|mso-excel/i,
|
|
7320
|
+
// Excel workbook metadata
|
|
7321
|
+
/<x:ExcelWorkbook>/i
|
|
7322
|
+
].some((marker) => marker.test(html)) : !1;
|
|
7323
|
+
}
|
|
7324
|
+
__name(htmlIsFromExcel, "htmlIsFromExcel");
|
|
7312
7325
|
function mergeCellValues(...cellValues) {
|
|
7313
7326
|
if (cellValues.length === 1)
|
|
7314
7327
|
return cellValues[0];
|
|
@@ -7467,8 +7480,8 @@ let SheetClipboardService = (_a15 = class extends Disposable {
|
|
|
7467
7480
|
return this.copy(COPY_TYPE.CUT);
|
|
7468
7481
|
}
|
|
7469
7482
|
async paste(item, pasteType = PREDEFINED_HOOK_NAME.DEFAULT_PASTE) {
|
|
7470
|
-
const types = item.types, text = types.indexOf(PLAIN_TEXT_CLIPBOARD_MIME_TYPE) !== -1 ? await item.getType(PLAIN_TEXT_CLIPBOARD_MIME_TYPE).then((blob) => blob && blob.text()) : "", html = types.indexOf(HTML_CLIPBOARD_MIME_TYPE) !== -1 ? await item.getType(HTML_CLIPBOARD_MIME_TYPE).then((blob) => blob && blob.text()) : "", imageIndex = types.findIndex((type) => imageMimeTypeSet.has(type));
|
|
7471
|
-
if (imageIndex !== -1) {
|
|
7483
|
+
const types = item.types, text = types.indexOf(PLAIN_TEXT_CLIPBOARD_MIME_TYPE) !== -1 ? await item.getType(PLAIN_TEXT_CLIPBOARD_MIME_TYPE).then((blob) => blob && blob.text()) : "", html = types.indexOf(HTML_CLIPBOARD_MIME_TYPE) !== -1 ? await item.getType(HTML_CLIPBOARD_MIME_TYPE).then((blob) => blob && blob.text()) : "", isFromExcel = htmlIsFromExcel(html), imageIndex = types.findIndex((type) => imageMimeTypeSet.has(type));
|
|
7484
|
+
if (imageIndex !== -1 && !isFromExcel) {
|
|
7472
7485
|
const imageMimeType = types[imageIndex], imageBlob = await item.getType(imageMimeType);
|
|
7473
7486
|
if (imageBlob) {
|
|
7474
7487
|
const file = new File(
|
|
@@ -7479,14 +7492,15 @@ let SheetClipboardService = (_a15 = class extends Disposable {
|
|
|
7479
7492
|
return this._pasteFiles([file], pasteType);
|
|
7480
7493
|
}
|
|
7481
7494
|
}
|
|
7482
|
-
return html ? (this._platformService.isWindows &&
|
|
7495
|
+
return html ? (this._platformService.isWindows && isFromExcel && this._notificationService.show({
|
|
7483
7496
|
type: "warning",
|
|
7484
7497
|
title: this._localeService.t("clipboard.shortCutNotify.title"),
|
|
7485
7498
|
content: this._localeService.t("clipboard.shortCutNotify.useShortCutInstead")
|
|
7486
7499
|
}), this._pasteHTML(html, pasteType)) : text ? this._pastePlainText(text, pasteType) : (this._logService.error("[SheetClipboardService]", "No valid data on clipboard"), !1);
|
|
7487
7500
|
}
|
|
7488
|
-
legacyPaste(html, text, files) {
|
|
7489
|
-
|
|
7501
|
+
async legacyPaste(html, text, files) {
|
|
7502
|
+
const isFromExcel = htmlIsFromExcel(html != null ? html : "");
|
|
7503
|
+
return files && !isFromExcel ? this._pasteFiles(files, PREDEFINED_HOOK_NAME.DEFAULT_PASTE) : html ? this._pasteHTML(html, PREDEFINED_HOOK_NAME.DEFAULT_PASTE) : text ? /[\n\t]/.test(text) ? this._pasteHTML(convertTextToTable(text), PREDEFINED_HOOK_NAME.DEFAULT_PASTE) : this._pastePlainText(text, PREDEFINED_HOOK_NAME.DEFAULT_PASTE) : this._pasteUnrecognized();
|
|
7490
7504
|
}
|
|
7491
7505
|
rePasteWithPasteType(type) {
|
|
7492
7506
|
const pasteOptionsCache = this._pasteOptionsCache$.getValue();
|
|
@@ -11913,38 +11927,38 @@ const AddWorksheetMergeCommand = {
|
|
|
11913
11927
|
}) ? commandService.executeCommand(InsertRangeMoveRightCommand.id) : !0 : commandService.executeCommand(InsertRangeMoveRightCommand.id);
|
|
11914
11928
|
}, "handler")
|
|
11915
11929
|
};
|
|
11916
|
-
var _ = /* @__PURE__ */ ((E) => (E[E.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", E[E.UNIVER_DOC = 1] = "UNIVER_DOC", E[E.UNIVER_SHEET = 2] = "UNIVER_SHEET", E[E.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", E[E.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(_ || {}),
|
|
11930
|
+
var _ = /* @__PURE__ */ ((E) => (E[E.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", E[E.UNIVER_DOC = 1] = "UNIVER_DOC", E[E.UNIVER_SHEET = 2] = "UNIVER_SHEET", E[E.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", E[E.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(_ || {}), D = /* @__PURE__ */ ((E) => (E[E.View = 0] = "View", E[E.Edit = 1] = "Edit", E[E.ManageCollaborator = 2] = "ManageCollaborator", E[E.Print = 3] = "Print", E[E.Duplicate = 4] = "Duplicate", E[E.Comment = 5] = "Comment", E[E.Copy = 6] = "Copy", E[E.Share = 7] = "Share", E[E.Export = 8] = "Export", E[E.MoveWorksheet = 9] = "MoveWorksheet", E[E.DeleteWorksheet = 10] = "DeleteWorksheet", E[E.HideWorksheet = 11] = "HideWorksheet", E[E.RenameWorksheet = 12] = "RenameWorksheet", E[E.CreateWorksheet = 13] = "CreateWorksheet", E[E.SetWorksheetStyle = 14] = "SetWorksheetStyle", E[E.EditWorksheetCell = 15] = "EditWorksheetCell", E[E.InsertHyperlink = 16] = "InsertHyperlink", E[E.Sort = 17] = "Sort", E[E.Filter = 18] = "Filter", E[E.PivotTable = 19] = "PivotTable", E[E.FloatImg = 20] = "FloatImg", E[E.History = 21] = "History", E[E.RwHgtClWdt = 22] = "RwHgtClWdt", E[E.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", E[E.ViewFilter = 24] = "ViewFilter", E[E.MoveSheet = 25] = "MoveSheet", E[E.DeleteSheet = 26] = "DeleteSheet", E[E.HideSheet = 27] = "HideSheet", E[E.CopySheet = 28] = "CopySheet", E[E.RenameSheet = 29] = "RenameSheet", E[E.CreateSheet = 30] = "CreateSheet", E[E.SelectProtectedCells = 31] = "SelectProtectedCells", E[E.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", E[E.SetCellStyle = 33] = "SetCellStyle", E[E.SetCellValue = 34] = "SetCellValue", E[E.SetRowStyle = 35] = "SetRowStyle", E[E.SetColumnStyle = 36] = "SetColumnStyle", E[E.InsertRow = 37] = "InsertRow", E[E.InsertColumn = 38] = "InsertColumn", E[E.DeleteRow = 39] = "DeleteRow", E[E.DeleteColumn = 40] = "DeleteColumn", E[E.EditExtraObject = 41] = "EditExtraObject", E[E.Delete = 42] = "Delete", E[E.RecoverHistory = 43] = "RecoverHistory", E[E.ViewHistory = 44] = "ViewHistory", E[E.CreatePermissionObject = 45] = "CreatePermissionObject", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(D || {}), S = /* @__PURE__ */ ((E) => (E[E.Reader = 0] = "Reader", E[E.Editor = 1] = "Editor", E[E.Owner = 2] = "Owner", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(S || {}), L = /* @__PURE__ */ ((E) => (E[E.Unkonwn = 0] = "Unkonwn", E[E.Workbook = 1] = "Workbook", E[E.Worksheet = 2] = "Worksheet", E[E.SelectRange = 3] = "SelectRange", E[E.Document = 4] = "Document", E[E.Slide = 5] = "Slide", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(L || {}), M = /* @__PURE__ */ ((E) => (E[E.SomeCollaborator = 0] = "SomeCollaborator", E[E.AllCollaborator = 1] = "AllCollaborator", E[E.OneSelf = 2] = "OneSelf", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(M || {});
|
|
11917
11931
|
const UNIVER_SHEET_PERMISSION_PANEL = "UNIVER_SHEET_PERMISSION_PANEL", UNIVER_SHEET_PERMISSION_USER_PART = "UNIVER_SHEET_PERMISSION_USER_PART", UNIVER_SHEET_PERMISSION_BACKGROUND = "UNIVER_SHEET_PERMISSION_BACKGROUND", UNIVER_SHEET_PERMISSION_USER_DIALOG = "UNIVER_SHEET_PERMISSION_USER_DIALOG", UNIVER_SHEET_PERMISSION_DIALOG = "UNIVER_SHEET_PERMISSION_DIALOG", UNIVER_SHEET_PERMISSION_USER_DIALOG_ID = "UNIVER_SHEET_PERMISSION_USER_DIALOG_ID", UNIVER_SHEET_PERMISSION_DIALOG_ID = "UNIVER_SHEET_PERMISSION_DIALOG_ID", subUnitPermissionTypeMap = {
|
|
11918
|
-
[
|
|
11919
|
-
[
|
|
11920
|
-
[
|
|
11921
|
-
[
|
|
11922
|
-
[
|
|
11923
|
-
[
|
|
11924
|
-
[
|
|
11925
|
-
[
|
|
11926
|
-
[
|
|
11927
|
-
[
|
|
11928
|
-
[
|
|
11929
|
-
[
|
|
11930
|
-
[
|
|
11931
|
-
[
|
|
11932
|
+
[D.Copy]: "Copy",
|
|
11933
|
+
[D.SetCellStyle]: "SetCellStyle",
|
|
11934
|
+
[D.SetCellValue]: "SetCellValue",
|
|
11935
|
+
[D.SetRowStyle]: "SetRowStyle",
|
|
11936
|
+
[D.SetColumnStyle]: "SetColumnStyle",
|
|
11937
|
+
[D.InsertRow]: "InsertRow",
|
|
11938
|
+
[D.InsertColumn]: "InsertColumn",
|
|
11939
|
+
[D.InsertHyperlink]: "InsertHyperlink",
|
|
11940
|
+
[D.DeleteRow]: "DeleteRow",
|
|
11941
|
+
[D.DeleteColumn]: "DeleteColumn",
|
|
11942
|
+
[D.Sort]: "Sort",
|
|
11943
|
+
[D.Filter]: "Filter",
|
|
11944
|
+
[D.PivotTable]: "PivotTable",
|
|
11945
|
+
[D.EditExtraObject]: "EditExtraObject"
|
|
11932
11946
|
}, defaultWorksheetUnitActionList = [
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
11944
|
-
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
|
|
11947
|
+
D.Copy,
|
|
11948
|
+
D.SetCellStyle,
|
|
11949
|
+
D.SetCellValue,
|
|
11950
|
+
D.SetRowStyle,
|
|
11951
|
+
D.SetColumnStyle,
|
|
11952
|
+
D.InsertRow,
|
|
11953
|
+
D.InsertColumn,
|
|
11954
|
+
D.InsertHyperlink,
|
|
11955
|
+
D.DeleteRow,
|
|
11956
|
+
D.DeleteColumn,
|
|
11957
|
+
D.Sort,
|
|
11958
|
+
D.Filter,
|
|
11959
|
+
D.PivotTable,
|
|
11960
|
+
D.EditExtraObject,
|
|
11961
|
+
D.View
|
|
11948
11962
|
], permissionMenuIconKey = "sheet-permission-menu-icon", permissionDeleteIconKey = "sheet-permission-delete-icon", permissionEditIconKey = "sheet-permission-edit-icon", permissionCheckIconKey = "sheet-permission-check-icon", permissionLockIconKey = "sheet-permission-lock-icon", DEFAULT_RANGE_RULE = {
|
|
11949
11963
|
unitId: "",
|
|
11950
11964
|
subUnitId: "",
|
|
@@ -13462,17 +13476,13 @@ function FormulaBar() {
|
|
|
13462
13476
|
const [iconStyle, setIconStyle] = useState(styles$f.formulaGrey), [arrowDirection, setArrowDirection] = useState(
|
|
13463
13477
|
0
|
|
13464
13478
|
/* Down */
|
|
13465
|
-
), formulaEditorManagerService = useDependency(IFormulaEditorManagerService), editorBridgeService = useDependency(IEditorBridgeService), worksheetProtectionRuleModel = useDependency(WorksheetProtectionRuleModel), rangeProtectionRuleModel = useDependency(RangeProtectionRuleModel), univerInstanceService = useDependency(IUniverInstanceService), selectionManager = useDependency(SheetsSelectionsService), permissionService = useDependency(IPermissionService),
|
|
13479
|
+
), formulaEditorManagerService = useDependency(IFormulaEditorManagerService), editorBridgeService = useDependency(IEditorBridgeService), worksheetProtectionRuleModel = useDependency(WorksheetProtectionRuleModel), rangeProtectionRuleModel = useDependency(RangeProtectionRuleModel), univerInstanceService = useDependency(IUniverInstanceService), selectionManager = useDependency(SheetsSelectionsService), permissionService = useDependency(IPermissionService), rangeProtectionCache = useDependency(RangeProtectionCache), [disableInfo, setDisableInfo] = useState({
|
|
13480
|
+
editDisable: !1,
|
|
13481
|
+
viewDisable: !1
|
|
13482
|
+
}), [imageDisable, setImageDisable] = useState(!1), currentWorkbook = useActiveWorkbook(), componentManager = useDependency(ComponentManager), workbook = useObservable$1(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), void 0, void 0, []), isRefSelecting = useRef(0), editState = editorBridgeService.getEditLocation(), keyCodeConfig = useKeyEventConfig(isRefSelecting, (_a61 = editState == null ? void 0 : editState.unitId) != null ? _a61 : ""), FormulaEditor = componentManager.get(EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY), formulaAuxUIParts = useComponentsOfPart(SheetsUIPart.FORMULA_AUX), contextService = useDependency(IContextService);
|
|
13466
13483
|
useObservable$1(useMemo(() => contextService.subscribeContextValue$(FOCUSING_FX_BAR_EDITOR), [contextService]));
|
|
13467
13484
|
const isFocusFxBar = contextService.getContextValue(FOCUSING_FX_BAR_EDITOR), ref = useRef(null);
|
|
13468
|
-
|
|
13469
|
-
return [
|
|
13470
|
-
new WorkbookEditablePermission(unitId).id,
|
|
13471
|
-
new WorksheetSetCellValuePermission(unitId, subUnitId).id,
|
|
13472
|
-
new WorksheetEditPermission(unitId, subUnitId).id
|
|
13473
|
-
];
|
|
13474
|
-
}
|
|
13475
|
-
__name(getPermissionIds, "getPermissionIds"), useLayoutEffect(() => {
|
|
13485
|
+
useLayoutEffect(() => {
|
|
13476
13486
|
const subscription = workbook.activeSheet$.pipe(
|
|
13477
13487
|
switchMap((worksheet) => worksheet ? merge(
|
|
13478
13488
|
worksheetProtectionRuleModel.ruleChange$,
|
|
@@ -13484,14 +13494,36 @@ function FormulaBar() {
|
|
|
13484
13494
|
var _a62, _b;
|
|
13485
13495
|
const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId();
|
|
13486
13496
|
if (!((_a62 = selectionManager.getCurrentLastSelection()) == null ? void 0 : _a62.range)) return EMPTY;
|
|
13487
|
-
const
|
|
13488
|
-
return
|
|
13489
|
-
|
|
13490
|
-
|
|
13497
|
+
const primary = (_b = selectionManager.getCurrentLastSelection()) == null ? void 0 : _b.primary;
|
|
13498
|
+
return primary ? of({
|
|
13499
|
+
unitId,
|
|
13500
|
+
subUnitId,
|
|
13501
|
+
primary
|
|
13502
|
+
}) : of(null);
|
|
13491
13503
|
})
|
|
13492
13504
|
) : EMPTY)
|
|
13493
|
-
).subscribe((
|
|
13494
|
-
|
|
13505
|
+
).subscribe((cellInfo) => {
|
|
13506
|
+
var _a62, _b, _c, _d, _e, _f;
|
|
13507
|
+
if (cellInfo) {
|
|
13508
|
+
const { unitId, subUnitId, primary } = cellInfo;
|
|
13509
|
+
if (worksheetProtectionRuleModel.getRule(unitId, subUnitId)) {
|
|
13510
|
+
const editDisable2 = !((_b = (_a62 = permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id)) == null ? void 0 : _a62.value) == null || _b), viewDisable2 = !((_d = (_c = permissionService.getPermissionPoint(new WorksheetViewPermission(unitId, subUnitId).id)) == null ? void 0 : _c.value) == null || _d);
|
|
13511
|
+
setDisableInfo({
|
|
13512
|
+
viewDisable: viewDisable2,
|
|
13513
|
+
editDisable: editDisable2
|
|
13514
|
+
});
|
|
13515
|
+
return;
|
|
13516
|
+
}
|
|
13517
|
+
const { actualRow, actualColumn } = primary, cellInfoWithPermission = rangeProtectionCache.getCellInfo(unitId, subUnitId, actualRow, actualColumn);
|
|
13518
|
+
setDisableInfo({
|
|
13519
|
+
editDisable: !((_e = cellInfoWithPermission == null ? void 0 : cellInfoWithPermission[UnitAction.Edit]) == null || _e),
|
|
13520
|
+
viewDisable: !((_f = cellInfoWithPermission == null ? void 0 : cellInfoWithPermission[UnitAction.View]) == null || _f)
|
|
13521
|
+
});
|
|
13522
|
+
} else
|
|
13523
|
+
setDisableInfo({
|
|
13524
|
+
viewDisable: !1,
|
|
13525
|
+
editDisable: !1
|
|
13526
|
+
});
|
|
13495
13527
|
});
|
|
13496
13528
|
return () => {
|
|
13497
13529
|
subscription.unsubscribe();
|
|
@@ -13553,17 +13585,17 @@ function FormulaBar() {
|
|
|
13553
13585
|
formulaEditorManagerService.handleFxBtnClick(!0);
|
|
13554
13586
|
}
|
|
13555
13587
|
__name(handlerFxBtnClick, "handlerFxBtnClick");
|
|
13556
|
-
const disabled =
|
|
13588
|
+
const { viewDisable, editDisable } = disableInfo, disabled = editDisable || imageDisable;
|
|
13557
13589
|
return /* @__PURE__ */ jsxs(
|
|
13558
13590
|
"div",
|
|
13559
13591
|
{
|
|
13560
13592
|
className: styles$f.formulaBox,
|
|
13561
13593
|
style: {
|
|
13562
13594
|
height: arrowDirection === 0 ? "28px" : "82px",
|
|
13563
|
-
pointerEvents:
|
|
13595
|
+
pointerEvents: editDisable ? "none" : "auto"
|
|
13564
13596
|
},
|
|
13565
13597
|
children: [
|
|
13566
|
-
/* @__PURE__ */ jsx("div", { className: styles$f.nameRanges, children: /* @__PURE__ */ jsx(DefinedName, { disable }) }),
|
|
13598
|
+
/* @__PURE__ */ jsx("div", { className: styles$f.nameRanges, children: /* @__PURE__ */ jsx(DefinedName, { disable: editDisable }) }),
|
|
13567
13599
|
/* @__PURE__ */ jsxs("div", { className: styles$f.formulaBar, children: [
|
|
13568
13600
|
/* @__PURE__ */ jsx("div", { className: clsx(styles$f.formulaIcon, { [styles$f.formulaIconDisable]: disabled }), children: /* @__PURE__ */ jsxs("div", { className: styles$f.formulaIconWrapper, children: [
|
|
13569
13601
|
/* @__PURE__ */ jsx(
|
|
@@ -13608,7 +13640,7 @@ function FormulaBar() {
|
|
|
13608
13640
|
disableContextMenu: !1
|
|
13609
13641
|
}
|
|
13610
13642
|
) }),
|
|
13611
|
-
/* @__PURE__ */ jsx("div", { className: clsx(styles$f.arrowContainer, { [styles$f.arrowContainerDisable]:
|
|
13643
|
+
/* @__PURE__ */ jsx("div", { className: clsx(styles$f.arrowContainer, { [styles$f.arrowContainerDisable]: editDisable }), onClick: handleArrowClick, children: arrowDirection === 0 ? /* @__PURE__ */ jsx(DropdownSingle, {}) : /* @__PURE__ */ jsx(DropdownSingle, { style: { transform: "rotateZ(180deg)" } }) })
|
|
13612
13644
|
] })
|
|
13613
13645
|
] }),
|
|
13614
13646
|
/* @__PURE__ */ jsx(ComponentContainer, { components: formulaAuxUIParts }, "formula-aux")
|
|
@@ -19640,7 +19672,7 @@ let SheetPermissionCheckUIController = (_a36 = class extends Disposable {
|
|
|
19640
19672
|
for (let row = range.startRow; row <= range.endRow; row++)
|
|
19641
19673
|
for (let col = range.startColumn; col <= range.endColumn; col++) {
|
|
19642
19674
|
const permission = (_b = (_a61 = worksheet.getCell(row, col)) == null ? void 0 : _a61.selectionProtection) == null ? void 0 : _b[0];
|
|
19643
|
-
if ((permission == null ? void 0 : permission[
|
|
19675
|
+
if ((permission == null ? void 0 : permission[D.Edit]) === !1)
|
|
19644
19676
|
return !0;
|
|
19645
19677
|
}
|
|
19646
19678
|
return !1;
|
|
@@ -19686,11 +19718,11 @@ let SheetPermissionInterceptorCanvasRenderController = (_a37 = class extends RxD
|
|
|
19686
19718
|
return defaultValue;
|
|
19687
19719
|
if (selectionRange.rangeType === RANGE_TYPE.ROW) {
|
|
19688
19720
|
for (let i = selectionRange.startRow; i <= selectionRange.endRow; i++)
|
|
19689
|
-
if (this._rangeProtectionCache.getRowPermissionInfo(unitId, subUnitId, i, [
|
|
19721
|
+
if (this._rangeProtectionCache.getRowPermissionInfo(unitId, subUnitId, i, [D.Edit]) === !1)
|
|
19690
19722
|
return !1;
|
|
19691
19723
|
} else
|
|
19692
19724
|
for (let i = selectionRange.startColumn; i <= selectionRange.endColumn; i++)
|
|
19693
|
-
if (this._rangeProtectionCache.getColPermissionInfo(unitId, subUnitId, i, [
|
|
19725
|
+
if (this._rangeProtectionCache.getColPermissionInfo(unitId, subUnitId, i, [D.Edit]) === !1)
|
|
19694
19726
|
return !1;
|
|
19695
19727
|
return !0;
|
|
19696
19728
|
}, "handler")
|
|
@@ -19742,7 +19774,7 @@ let SheetPermissionInterceptorCanvasRenderController = (_a37 = class extends RxD
|
|
|
19742
19774
|
for (let row = startRow; row <= endRow; row++)
|
|
19743
19775
|
for (let col = startColumn; col <= endColumn; col++) {
|
|
19744
19776
|
const permission = (_c = (_b = worksheet.getCell(row, col)) == null ? void 0 : _b.selectionProtection) == null ? void 0 : _c[0];
|
|
19745
|
-
if ((permission == null ? void 0 : permission[
|
|
19777
|
+
if ((permission == null ? void 0 : permission[D.Edit]) === !1 || (permission == null ? void 0 : permission[D.View]) === !1)
|
|
19746
19778
|
return !1;
|
|
19747
19779
|
}
|
|
19748
19780
|
return !0;
|
|
@@ -19768,7 +19800,7 @@ let SheetPermissionInterceptorCanvasRenderController = (_a37 = class extends RxD
|
|
|
19768
19800
|
for (let row = startRow; row <= endRow; row++)
|
|
19769
19801
|
for (let col = startColumn; col <= endColumn; col++) {
|
|
19770
19802
|
const permission = (_b = (_a62 = worksheet.getCell(row, col)) == null ? void 0 : _a62.selectionProtection) == null ? void 0 : _b[0];
|
|
19771
|
-
if ((permission == null ? void 0 : permission[
|
|
19803
|
+
if ((permission == null ? void 0 : permission[D.Edit]) === !1)
|
|
19772
19804
|
return !0;
|
|
19773
19805
|
}
|
|
19774
19806
|
return !1;
|
|
@@ -19835,7 +19867,7 @@ let SheetPermissionInterceptorClipboardController = (_a38 = class extends Dispos
|
|
|
19835
19867
|
for (let row = startRow; row <= endRow; row++)
|
|
19836
19868
|
for (let col = startColumn; col <= endColumn; col++) {
|
|
19837
19869
|
const permission = (_c = (_b = worksheet.getCell(row, col)) == null ? void 0 : _b.selectionProtection) == null ? void 0 : _c[0];
|
|
19838
|
-
if ((permission == null ? void 0 : permission[
|
|
19870
|
+
if ((permission == null ? void 0 : permission[D.Edit]) === !1) {
|
|
19839
19871
|
hasPermission = !1;
|
|
19840
19872
|
break;
|
|
19841
19873
|
}
|
|
@@ -20076,7 +20108,7 @@ let SheetPermissionInterceptorFormulaRenderController = (_a40 = class extends Rx
|
|
|
20076
20108
|
if (((_a62 = worksheet.getCellRaw(rowIndex + startRow, colIndex + startCol)) == null ? void 0 : _a62.v) === void 0)
|
|
20077
20109
|
return;
|
|
20078
20110
|
const permission = this._rangeProtectionCache.getCellInfo(unitId, subUnitId, rowIndex + startRow, colIndex + startCol);
|
|
20079
|
-
(permission == null ? void 0 : permission[
|
|
20111
|
+
(permission == null ? void 0 : permission[D.View]) === !1 && (itemValue[rowIndex][colIndex] = NullValueObject.create());
|
|
20080
20112
|
});
|
|
20081
20113
|
});
|
|
20082
20114
|
}), originValue;
|
|
@@ -20226,7 +20258,7 @@ const checkRangeValid = /* @__PURE__ */ __name((injector, permissionRanges, perm
|
|
|
20226
20258
|
collaborators,
|
|
20227
20259
|
unitID: activeRule.unitId,
|
|
20228
20260
|
name: "",
|
|
20229
|
-
strategies: [{ role: S.Editor, action:
|
|
20261
|
+
strategies: [{ role: S.Editor, action: D.Edit }, { role: S.Reader, action: D.View }],
|
|
20230
20262
|
scope: scopeObj
|
|
20231
20263
|
},
|
|
20232
20264
|
objectType: UnitObject.Worksheet
|
|
@@ -20252,7 +20284,7 @@ const checkRangeValid = /* @__PURE__ */ __name((injector, permissionRanges, perm
|
|
|
20252
20284
|
collaborators,
|
|
20253
20285
|
unitID: activeRule.unitId,
|
|
20254
20286
|
name: "",
|
|
20255
|
-
strategies: [{ role: S.Editor, action:
|
|
20287
|
+
strategies: [{ role: S.Editor, action: D.Edit }, { role: S.Reader, action: D.View }],
|
|
20256
20288
|
scope: scopeObj
|
|
20257
20289
|
},
|
|
20258
20290
|
objectType: UnitObject.Worksheet
|
|
@@ -20533,7 +20565,7 @@ const checkRangeValid = /* @__PURE__ */ __name((injector, permissionRanges, perm
|
|
|
20533
20565
|
const rule = allRuleMap.get(item.objectID);
|
|
20534
20566
|
if (!rule)
|
|
20535
20567
|
return null;
|
|
20536
|
-
const editAction = item.actions.find((action) => action.action ===
|
|
20568
|
+
const editAction = item.actions.find((action) => action.action === D.Edit), editPermission = editAction == null ? void 0 : editAction.allowed, viewAction = item.actions.find((action) => action.action === D.View), viewPermission = viewAction == null ? void 0 : viewAction.allowed, manageCollaboratorAction = item.actions.find((action) => action.action === D.ManageCollaborator), deleteAction = item.actions.find((action) => action.action === D.Delete), hasManagerPermission = (manageCollaboratorAction == null ? void 0 : manageCollaboratorAction.allowed) || currentUser.userID === ((_a62 = item.creator) == null ? void 0 : _a62.userID), hasDeletePermission = (deleteAction == null ? void 0 : deleteAction.allowed) || currentUser.userID === ((_b = item.creator) == null ? void 0 : _b.userID);
|
|
20537
20569
|
let ruleName = "";
|
|
20538
20570
|
const targetSheet = workbook.getSheetBySheetId(rule.subUnitId), targetName = targetSheet == null ? void 0 : targetSheet.getName();
|
|
20539
20571
|
if (rule.unitType === L.SelectRange) {
|
|
@@ -20906,7 +20938,7 @@ const _RangeProtectionCanViewRenderExtension = class _RangeProtectionCanViewRend
|
|
|
20906
20938
|
__publicField(this, "Z_INDEX", EXTENSION_CAN_VIEW_Z_INDEX$1);
|
|
20907
20939
|
}
|
|
20908
20940
|
shouldRender(config) {
|
|
20909
|
-
return (config == null ? void 0 : config[
|
|
20941
|
+
return (config == null ? void 0 : config[D.View]) !== !1;
|
|
20910
20942
|
}
|
|
20911
20943
|
};
|
|
20912
20944
|
__name(_RangeProtectionCanViewRenderExtension, "RangeProtectionCanViewRenderExtension");
|
|
@@ -20918,7 +20950,7 @@ const _RangeProtectionCanNotViewRenderExtension = class _RangeProtectionCanNotVi
|
|
|
20918
20950
|
__publicField(this, "Z_INDEX", EXTENSION_CAN_NOT_VIEW_Z_INDEX$1);
|
|
20919
20951
|
}
|
|
20920
20952
|
shouldRender(config) {
|
|
20921
|
-
return (config == null ? void 0 : config[
|
|
20953
|
+
return (config == null ? void 0 : config[D.View]) === !1;
|
|
20922
20954
|
}
|
|
20923
20955
|
};
|
|
20924
20956
|
__name(_RangeProtectionCanNotViewRenderExtension, "RangeProtectionCanNotViewRenderExtension");
|
|
@@ -20941,7 +20973,7 @@ const worksheetProtectionKey = "worksheet-protection", EXTENSION_CAN_VIEW_Z_INDE
|
|
|
20941
20973
|
if (this._pattern) {
|
|
20942
20974
|
if (selectionProtection.length > 0) {
|
|
20943
20975
|
const cellProtectionConfig = selectionProtection[0];
|
|
20944
|
-
(cellProtectionConfig == null ? void 0 : cellProtectionConfig[
|
|
20976
|
+
(cellProtectionConfig == null ? void 0 : cellProtectionConfig[D.View]) ? this.setZIndex(EXTENSION_CAN_VIEW_Z_INDEX) : this.setZIndex(EXTENSION_CAN_NOT_VIEW_Z_INDEX);
|
|
20945
20977
|
}
|
|
20946
20978
|
ctx.fillStyle = this._pattern, hasWorksheetRule && ctx.fillRect(start.startX, start.startY, end.endX - start.startX, end.endY - start.startY), ctx.restore();
|
|
20947
20979
|
}
|
|
@@ -126,6 +126,9 @@ export declare const CellFEventName: {
|
|
|
126
126
|
readonly SelectionMoveEnd: "SelectionMoveEnd";
|
|
127
127
|
readonly SelectionChanged: "SelectionChanged";
|
|
128
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* @ignore
|
|
131
|
+
*/
|
|
129
132
|
export interface IFSheetsUIEventNameMixin {
|
|
130
133
|
/**
|
|
131
134
|
* Trigger this event before the clipboard content changes.
|
|
@@ -159,10 +162,10 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
159
162
|
* @example
|
|
160
163
|
* ```ts
|
|
161
164
|
* univerAPI.addEvent(univerAPI.Event.BeforeClipboardPaste, (param) => {
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
165
|
+
* const {text, html} = param;
|
|
166
|
+
* console.log('debugger', text, html);
|
|
167
|
+
* // if want to cancel the clipboard paste
|
|
168
|
+
* param.cancel = true;
|
|
166
169
|
* })
|
|
167
170
|
* ```
|
|
168
171
|
*/
|
|
@@ -173,8 +176,8 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
173
176
|
* @example
|
|
174
177
|
* ```ts
|
|
175
178
|
* univerAPI.addEvent(univerAPI.Event.ClipboardPasted, (param) => {
|
|
176
|
-
*
|
|
177
|
-
*
|
|
179
|
+
* const {text, html} = param;
|
|
180
|
+
* console.log('debugger', text, html); // {text: '...', html: '...'}
|
|
178
181
|
* })
|
|
179
182
|
* ```
|
|
180
183
|
*/
|
|
@@ -185,7 +188,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
185
188
|
* @example
|
|
186
189
|
* ```ts
|
|
187
190
|
* univerAPI.addEvent(univerAPI.Event.BeforeSheetEditStart, (params) => {
|
|
188
|
-
*
|
|
191
|
+
* const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params;
|
|
189
192
|
* });
|
|
190
193
|
* ```
|
|
191
194
|
*/
|
|
@@ -196,7 +199,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
196
199
|
* @example
|
|
197
200
|
* ```ts
|
|
198
201
|
* univerAPI.addEvent(univerAPI.Event.SheetEditStarted, (params) => {
|
|
199
|
-
*
|
|
202
|
+
* const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params;
|
|
200
203
|
* });
|
|
201
204
|
* ```
|
|
202
205
|
*/
|
|
@@ -207,7 +210,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
207
210
|
* @example
|
|
208
211
|
* ```ts
|
|
209
212
|
* univerAPI.addEvent(univerAPI.Event.SheetEditChanging, (params) => {
|
|
210
|
-
*
|
|
213
|
+
* const { worksheet, workbook, row, column, value, isZenEditor } = params;
|
|
211
214
|
* });
|
|
212
215
|
* ```
|
|
213
216
|
*/
|
|
@@ -218,7 +221,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
218
221
|
* @example
|
|
219
222
|
* ```ts
|
|
220
223
|
* univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => {
|
|
221
|
-
*
|
|
224
|
+
* const { worksheet, workbook, row, column, value, eventType, keycode, isZenEditor } = params;
|
|
222
225
|
* });
|
|
223
226
|
* ```
|
|
224
227
|
*/
|
|
@@ -229,7 +232,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
229
232
|
* @example
|
|
230
233
|
* ```ts
|
|
231
234
|
* univerAPI.addEvent(univerAPI.Event.SheetEditEnded, (params) => {
|
|
232
|
-
*
|
|
235
|
+
* const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params;
|
|
233
236
|
* });
|
|
234
237
|
* ```
|
|
235
238
|
*/
|
|
@@ -239,7 +242,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
239
242
|
* @see {@link ICellEventParam}
|
|
240
243
|
* @example
|
|
241
244
|
* ```ts
|
|
242
|
-
* univerAPI.addEvent(univerAPI.Event.CellClicked, (params)=> {
|
|
245
|
+
* univerAPI.addEvent(univerAPI.Event.CellClicked, (params) => {
|
|
243
246
|
* const { worksheet, workbook, row, column, value, isZenEditor } = params;
|
|
244
247
|
* });
|
|
245
248
|
* ```
|
|
@@ -250,8 +253,8 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
250
253
|
* @see {@link ICellEventParam}
|
|
251
254
|
* @example
|
|
252
255
|
* ```ts
|
|
253
|
-
* univerAPI.addEvent(univerAPI.Event.CellPointerDown, (params)=> {
|
|
254
|
-
*
|
|
256
|
+
* univerAPI.addEvent(univerAPI.Event.CellPointerDown, (params) => {
|
|
257
|
+
* const { worksheet, workbook, row, column } = params;
|
|
255
258
|
* });
|
|
256
259
|
* ```
|
|
257
260
|
*/
|
|
@@ -261,8 +264,8 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
261
264
|
* @see {@link ICellEventParam}
|
|
262
265
|
* @example
|
|
263
266
|
* ```ts
|
|
264
|
-
* univerAPI.addEvent(univerAPI.Event.CellPointerUp, (params)=> {
|
|
265
|
-
*
|
|
267
|
+
* univerAPI.addEvent(univerAPI.Event.CellPointerUp, (params) => {
|
|
268
|
+
* const { worksheet, workbook, row, column } = params;
|
|
266
269
|
* });
|
|
267
270
|
* ```
|
|
268
271
|
*/
|
|
@@ -272,8 +275,8 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
272
275
|
* @see {@link ICellEventParam}
|
|
273
276
|
* @example
|
|
274
277
|
* ```ts
|
|
275
|
-
* univerAPI.addEvent(univerAPI.Event.CellHover, (params)=> {
|
|
276
|
-
*
|
|
278
|
+
* univerAPI.addEvent(univerAPI.Event.CellHover, (params) => {
|
|
279
|
+
* const { worksheet, workbook, row, column } = params;
|
|
277
280
|
* });
|
|
278
281
|
* ```
|
|
279
282
|
*/
|
|
@@ -283,8 +286,8 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
283
286
|
* @see {@link ICellEventParam}
|
|
284
287
|
* @example
|
|
285
288
|
* ```ts
|
|
286
|
-
* univerAPI.addEvent(univerAPI.Event.CellPointerMove, (params)=> {
|
|
287
|
-
*
|
|
289
|
+
* univerAPI.addEvent(univerAPI.Event.CellPointerMove, (params) => {
|
|
290
|
+
* const { worksheet, workbook, row, column } = params;
|
|
288
291
|
* });
|
|
289
292
|
* ```
|
|
290
293
|
*/
|
|
@@ -382,8 +385,8 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
382
385
|
* @see {@link ICellEventParam}
|
|
383
386
|
* @example
|
|
384
387
|
* ```ts
|
|
385
|
-
* univerAPI.getActiveWorkbook().addEvent(univerAPI.Event.DragOver, (params)=> {
|
|
386
|
-
*
|
|
388
|
+
* univerAPI.getActiveWorkbook().addEvent(univerAPI.Event.DragOver, (params) => {
|
|
389
|
+
* const { worksheet, workbook, row, column } = params;
|
|
387
390
|
* });
|
|
388
391
|
* ```
|
|
389
392
|
*/
|
|
@@ -393,7 +396,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
393
396
|
* @see {@link ICellEventParam}
|
|
394
397
|
* @example
|
|
395
398
|
* ```ts
|
|
396
|
-
* univerAPI.getActiveWorkbook().addEvent(univerAPI.Event.Drop, (params)=> {
|
|
399
|
+
* univerAPI.getActiveWorkbook().addEvent(univerAPI.Event.Drop, (params) => {
|
|
397
400
|
* const { worksheet, workbook, row, column } = params;
|
|
398
401
|
* });
|
|
399
402
|
* ```
|
|
@@ -404,8 +407,8 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
404
407
|
* @see {@link IScrollEventParam}
|
|
405
408
|
* @example
|
|
406
409
|
* ```ts
|
|
407
|
-
* univerAPI.addEvent(univerAPI.Event.Scroll, (params)=> {
|
|
408
|
-
*
|
|
410
|
+
* univerAPI.addEvent(univerAPI.Event.Scroll, (params) => {
|
|
411
|
+
* const { worksheet, workbook, scrollX, scrollY } = params;
|
|
409
412
|
* });
|
|
410
413
|
* ```
|
|
411
414
|
*/
|
|
@@ -416,7 +419,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
416
419
|
* @example
|
|
417
420
|
* ```ts
|
|
418
421
|
* univerAPI.addEvent(univerAPI.Event.SelectionChanged, (p)=> {
|
|
419
|
-
*
|
|
422
|
+
* const { worksheet, workbook, selections } = p;
|
|
420
423
|
* });
|
|
421
424
|
* ```
|
|
422
425
|
*/
|
|
@@ -427,7 +430,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
427
430
|
* @example
|
|
428
431
|
* ```ts
|
|
429
432
|
* univerAPI.addEvent(univerAPI.Event.SelectionMoveStart, (p)=> {
|
|
430
|
-
*
|
|
433
|
+
* const { worksheet, workbook, selections } = p;
|
|
431
434
|
* });
|
|
432
435
|
* ```
|
|
433
436
|
*/
|
|
@@ -438,7 +441,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
438
441
|
* @example
|
|
439
442
|
* ```ts
|
|
440
443
|
* univerAPI.addEvent(univerAPI.Event.SelectionMoving, (p)=> {
|
|
441
|
-
*
|
|
444
|
+
* const { worksheet, workbook, selections } = p;
|
|
442
445
|
* });
|
|
443
446
|
* ```
|
|
444
447
|
*/
|
|
@@ -449,7 +452,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
449
452
|
* @example
|
|
450
453
|
* ```ts
|
|
451
454
|
* univerAPI.addEvent(univerAPI.Event.SelectionMoveEnd, (p)=> {
|
|
452
|
-
*
|
|
455
|
+
* const { worksheet, workbook, selections } = p;
|
|
453
456
|
* });
|
|
454
457
|
* ```
|
|
455
458
|
*/
|
|
@@ -460,7 +463,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
460
463
|
* @example
|
|
461
464
|
* ```ts
|
|
462
465
|
* univerAPI.addEvent(univerAPI.Event.SheetZoomChanged, (p)=> {
|
|
463
|
-
*
|
|
466
|
+
* const { worksheet, workbook, zoom } = p;
|
|
464
467
|
* });
|
|
465
468
|
* ```
|
|
466
469
|
*/
|
|
@@ -471,7 +474,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
471
474
|
* @example
|
|
472
475
|
* ```ts
|
|
473
476
|
* univerAPI.addEvent(univerAPI.Event.BeforeSheetZoomChange, (p)=> {
|
|
474
|
-
*
|
|
477
|
+
* const { worksheet, workbook, zoom } = p;
|
|
475
478
|
* });
|
|
476
479
|
* ```
|
|
477
480
|
*/
|
|
@@ -482,7 +485,7 @@ export interface IFSheetsUIEventNameMixin {
|
|
|
482
485
|
* @example
|
|
483
486
|
* ```ts
|
|
484
487
|
* univerAPI.addEvent(univerAPI.Event.SheetSkeletonChanged, (p)=> {
|
|
485
|
-
*
|
|
488
|
+
* const { worksheet, workbook } = p;
|
|
486
489
|
* });
|
|
487
490
|
* ```
|
|
488
491
|
*/
|
|
@@ -520,6 +523,9 @@ export declare class FSheetsUIEventName extends FEventName implements IFSheetsUI
|
|
|
520
523
|
get ColumnHeaderHover(): 'ColumnHeaderHover';
|
|
521
524
|
get SheetSkeletonChanged(): 'SheetSkeletonChanged';
|
|
522
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* @ignore
|
|
528
|
+
*/
|
|
523
529
|
export interface ISheetUIEventBase extends IEventBase {
|
|
524
530
|
/**
|
|
525
531
|
* The workbook instance currently being operated on. {@link FWorkbook}
|
|
@@ -612,6 +618,9 @@ export interface ISheetSkeletonChangedEvent extends ISheetUIEventBase {
|
|
|
612
618
|
payload: CommandListenerSkeletonChange;
|
|
613
619
|
effectedRanges: FRange[];
|
|
614
620
|
}
|
|
621
|
+
/**
|
|
622
|
+
* @ignore
|
|
623
|
+
*/
|
|
615
624
|
export interface IFSheetsUIEventParamConfig {
|
|
616
625
|
BeforeClipboardChange: IBeforeClipboardChangeParam;
|
|
617
626
|
ClipboardChanged: IClipboardChangedParam;
|