Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(permission): change permission point logic (#3826)
ybzky7e491718cd7a
diff --git a/packages/core/package.json b/packages/core/package.jsonindex ba1e124967..565a2cd908 100644--- a/packages/core/package.json+++ b/packages/core/package.json@@ -63,7 +63,7 @@"rxjs": ">=7.0.0"},"dependencies": {- "@univerjs/protocol": "0.1.39-alpha.30",+ "@univerjs/protocol": "0.1.39-alpha.36","@wendellhu/redi": "0.16.1","kdbush": "^4.0.2","lodash-es": "^4.17.21",diff --git a/packages/data-validation/package.json b/packages/data-validation/package.jsonindex 1d6662959c..b908ea0039 100644--- a/packages/data-validation/package.json+++ b/packages/data-validation/package.json@@ -63,7 +63,7 @@},"dependencies": {"@univerjs/core": "workspace:*",- "@univerjs/protocol": "0.1.39-alpha.30",+ "@univerjs/protocol": "0.1.39-alpha.36","@univerjs/sheets": "workspace:*"},"devDependencies": {diff --git a/packages/sheets-conditional-formatting-ui/package.json b/packages/sheets-conditional-formatting-ui/package.jsonindex 1acf29748b..185aea97ff 100644--- a/packages/sheets-conditional-formatting-ui/package.json+++ b/packages/sheets-conditional-formatting-ui/package.json@@ -72,7 +72,7 @@"@univerjs/engine-formula": "workspace:*","@univerjs/engine-render": "workspace:*","@univerjs/icons": "^0.1.84",- "@univerjs/protocol": "0.1.39-alpha.30",+ "@univerjs/protocol": "0.1.39-alpha.36","@univerjs/sheets": "workspace:*","@univerjs/sheets-conditional-formatting": "workspace:*","@univerjs/sheets-formula-ui": "workspace:*",diff --git a/packages/sheets-conditional-formatting/package.json b/packages/sheets-conditional-formatting/package.jsonindex 2832bd2de1..7669ce93f6 100644--- a/packages/sheets-conditional-formatting/package.json+++ b/packages/sheets-conditional-formatting/package.json@@ -66,7 +66,7 @@"@univerjs/core": "workspace:*","@univerjs/engine-formula": "workspace:*","@univerjs/engine-render": "workspace:*",- "@univerjs/protocol": "0.1.39-alpha.30",+ "@univerjs/protocol": "0.1.39-alpha.36","@univerjs/sheets": "workspace:*","dayjs": "^1.11.13"},diff --git a/packages/sheets-data-validation-ui/package.json b/packages/sheets-data-validation-ui/package.jsonindex 4a2c3d4504..83ae2a1768 100644--- a/packages/sheets-data-validation-ui/package.json+++ b/packages/sheets-data-validation-ui/package.json@@ -75,7 +75,7 @@"@univerjs/engine-formula": "workspace:*","@univerjs/engine-render": "workspace:*","@univerjs/icons": "^0.1.84",- "@univerjs/protocol": "0.1.39-alpha.30",+ "@univerjs/protocol": "0.1.39-alpha.36","@univerjs/sheets": "workspace:*","@univerjs/sheets-data-validation": "workspace:*","@univerjs/sheets-formula-ui": "workspace:*",diff --git a/packages/sheets-data-validation/package.json b/packages/sheets-data-validation/package.jsonindex 8703003bd7..3cfcda1b51 100644--- a/packages/sheets-data-validation/package.json+++ b/packages/sheets-data-validation/package.json@@ -68,7 +68,7 @@"@univerjs/data-validation": "workspace:*","@univerjs/engine-formula": "workspace:*","@univerjs/icons": "^0.1.84",- "@univerjs/protocol": "0.1.39-alpha.30",+ "@univerjs/protocol": "0.1.39-alpha.36","@univerjs/sheets": "workspace:*","@univerjs/sheets-formula": "workspace:*","dayjs": "^1.11.13"diff --git a/packages/sheets-find-replace/package.json b/packages/sheets-find-replace/package.jsonindex 5f615f6ad1..5f0e3c93b5 100644--- a/packages/sheets-find-replace/package.json+++ b/packages/sheets-find-replace/package.json@@ -68,7 +68,7 @@"@univerjs/engine-formula": "workspace:*","@univerjs/engine-render": "workspace:*","@univerjs/find-replace": "workspace:*",- "@univerjs/protocol": "0.1.39-alpha.30",+ "@univerjs/protocol": "0.1.39-alpha.36","@univerjs/sheets": "workspace:*","@univerjs/sheets-ui": "workspace:*"},diff --git a/packages/sheets-hyper-link/package.json b/packages/sheets-hyper-link/package.jsonindex a0ec7ef627..dd30fd188a 100644--- a/packages/sheets-hyper-link/package.json+++ b/packages/sheets-hyper-link/package.json@@ -62,7 +62,7 @@"dependencies": {"@univerjs/core": "workspace:*","@univerjs/engine-formula": "workspace:*",- "@univerjs/protocol": "0.1.39-alpha.30",+ "@univerjs/protocol": "0.1.39-alpha.36","@univerjs/sheets": "workspace:*"},"devDependencies": {diff --git a/packages/sheets-ui/package.json b/packages/sheets-ui/package.jsonindex c523f61550..dfaaa46272 100644--- a/packages/sheets-ui/package.json+++ b/packages/sheets-ui/package.json@@ -72,7 +72,7 @@"@univerjs/engine-formula": "workspace:*","@univerjs/engine-render": "workspace:*","@univerjs/icons": "^0.1.84",- "@univerjs/protocol": "0.1.39-alpha.30",+ "@univerjs/protocol": "0.1.39-alpha.36","@univerjs/sheets": "workspace:*","@univerjs/telemetry": "workspace:*","@univerjs/ui": "workspace:*",diff --git a/packages/sheets-ui/src/commands/commands/range-protection.command.ts b/packages/sheets-ui/src/commands/commands/range-protection.command.tsindex 5b5681ea28..0b76b01470 100644--- a/packages/sheets-ui/src/commands/commands/range-protection.command.ts+++ b/packages/sheets-ui/src/commands/commands/range-protection.command.ts@@ -15,11 +15,11 @@*/import type { ICommand, Workbook } from '@univerjs/core';-import { CommandType, ICommandService, IUndoRedoService, IUniverInstanceService, Rectangle, sequenceExecute, UniverInstanceType } from '@univerjs/core';import type { IRangeProtectionRule } from '@univerjs/sheets';-import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, DeleteRangeProtectionMutation, DeleteWorksheetProtectionMutation, RangeProtectionRuleModel, SetRangeProtectionMutation, SetWorksheetProtectionMutation, SheetsSelectionsService, WorksheetProtectionRuleModel } from '@univerjs/sheets';-import { UnitObject } from '@univerjs/protocol';import type { IPermissionPanelRule } from '../../services/permission/sheet-permission-panel.model';+import { CommandType, ICommandService, IUndoRedoService, IUniverInstanceService, Rectangle, sequenceExecute, UniverInstanceType } from '@univerjs/core';+import { UnitObject } from '@univerjs/protocol';+import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, DeleteRangeProtectionMutation, DeleteWorksheetProtectionMutation, RangeProtectionRuleModel, SetRangeProtectionMutation, SetWorksheetProtectionMutation, SheetsSelectionsService, WorksheetProtectionRuleModel } from '@univerjs/sheets';import { SheetPermissionPanelModel } from '../../services/permission/sheet-permission-panel.model';import { SheetPermissionOpenPanelOperation } from '../operations/sheet-permission-open-panel.operation';import { DeleteWorksheetProtectionCommand } from './worksheet-protection.command';@@ -237,7 +237,7 @@ export const DeleteRangeProtectionFromContextMenuCommand: ICommand = {const subUnitId = worksheet.getSheetId();const worksheetRule = worksheetRuleModel.getRule(unitId, subUnitId);- if (worksheetRule?.permissionId && worksheetRule?.name) {+ if (worksheetRule?.permissionId) {return commandService.executeCommand(DeleteWorksheetProtectionCommand.id, { unitId, subUnitId, rule: worksheetRule });} else {const selectRange = selectionManagerService.getCurrentLastSelection()?.range;@@ -288,7 +288,7 @@ export const SetRangeProtectionFromContextMenuCommand: ICommand = {const subUnitId = worksheet.getSheetId();const worksheetRule = worksheetRuleModel.getRule(unitId, subUnitId);const sheetPermissionPanelModel = accessor.get(SheetPermissionPanelModel);- if (worksheetRule?.permissionId && worksheetRule?.name) {+ if (worksheetRule?.permissionId) {const oldRule = {...worksheetRule,unitId,diff --git a/packages/sheets-ui/src/controllers/menu/menu-util.ts b/packages/sheets-ui/src/controllers/menu/menu-util.tsindex 6e9a8f0433..dfb3ebe5a7 100644--- a/packages/sheets-ui/src/controllers/menu/menu-util.ts+++ b/packages/sheets-ui/src/controllers/menu/menu-util.ts@@ -17,7 +17,7 @@import type { IAccessor, IPermissionTypes, IRange, Nullable, Workbook, WorkbookPermissionPointConstructor, Worksheet } from '@univerjs/core';import type { Observable } from 'rxjs';import { FOCUSING_COMMON_DRAWINGS, FOCUSING_FX_BAR_EDITOR, IContextService, IPermissionService, IUniverInstanceService, Rectangle, Tools, UniverInstanceType, UserManagerService } from '@univerjs/core';-import { IExclusiveRangeService, RangeProtectionPermissionEditPoint, RangeProtectionRuleModel, SheetsSelectionsService, WorkbookEditablePermission, WorkbookManageCollaboratorPermission, WorksheetEditPermission, WorksheetProtectionRuleModel } from '@univerjs/sheets';+import { IExclusiveRangeService, RangeProtectionPermissionEditPoint, RangeProtectionRuleModel, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, WorksheetProtectionRuleModel } from '@univerjs/sheets';import { combineLatest, debounceTime, map, merge, of, startWith, switchMap } from 'rxjs';import { IEditorBridgeService } from '../../services/editor-bridge.service';@@ -411,19 +411,18 @@ export function getWorkbookPermissionDisable$(accessor: IAccessor, workbookPermiconst workbookPermissionIds: string[] = [];workbookPermissionTypes.forEach((F) => workbookPermissionIds.push(new F(unitId).id));const workbookPermission$ = permissionService.composePermission$(workbookPermissionIds).pipe(map((list) => list.every((item) => item.value === true)));- const workbookManageCollaboratorPermission$ = permissionService.getPermissionPoint$(new WorkbookManageCollaboratorPermission(unitId).id)?.pipe(map((permission) => permission.value)) ?? of(false);- return combineLatest([workbookPermission$, workbookManageCollaboratorPermission$]).pipe(- map(([basePermission, manageable]) => {+ return workbookPermission$.pipe(+ map((basePermission) => {if (!basePermission) {return true;}const subUnitId = activeSheet.getSheetId();const worksheetRule = worksheetRuleModel.getRule(unitId, subUnitId);- const worksheetRuleList = selectionRuleModel.getSubunitRuleList(unitId, subUnitId);- if (worksheetRule || worksheetRuleList.length) {- return !manageable;+ const rangeRuleList = selectionRuleModel.getSubunitRuleList(unitId, subUnitId);+ if (worksheetRule || rangeRuleList.length) {+ return true;}return false;})diff --git a/packages/sheets-ui/src/controllers/menu/permission-menu-util.ts b/packages/sheets-ui/src/controllers/menu/permission-menu-util.tsindex 8cce4a4688..25d7bfbcd4 100644--- a/packages/sheets-ui/src/controllers/menu/permission-menu-util.ts+++ b/packages/sheets-ui/src/controllers/menu/permission-menu-util.ts@@ -15,8 +15,8 @@*/import type { IAccessor, Workbook } from '@univerjs/core';-import { FOCUSING_COMMON_DRAWINGS, FOCUSING_FX_BAR_EDITOR, IContextService, IPermissionService, IUniverInstanceService, Rectangle, UniverInstanceType, UserManagerService } from '@univerjs/core';-import { RangeProtectionRuleModel, SheetsSelectionsService, WorkbookEditablePermission, WorkbookManageCollaboratorPermission, WorksheetProtectionRuleModel } from '@univerjs/sheets';+import { FOCUSING_COMMON_DRAWINGS, FOCUSING_FX_BAR_EDITOR, IContextService, IPermissionService, IUniverInstanceService, RANGE_TYPE, Rectangle, UniverInstanceType, UserManagerService } from '@univerjs/core';+import { RangeProtectionCache, RangeProtectionRuleModel, SheetsSelectionsService, UnitAction, WorkbookCreateProtectPermission, WorkbookEditablePermission, WorkbookManageCollaboratorPermission, WorksheetDeleteProtectionPermission, WorksheetManageCollaboratorPermission, WorksheetProtectionRuleModel } from '@univerjs/sheets';import { combineLatest, map, merge, of, startWith, switchMap } from 'rxjs';import { IEditorBridgeService } from '../../services/editor-bridge.service';@@ -55,7 +55,7 @@ export function getAddPermissionHidden$(accessor: IAccessor) {return false;}const worksheetRule = worksheetRuleModel.getRule(unitId, subUnitId);- if (worksheetRule?.permissionId && worksheetRule?.name) {+ if (worksheetRule?.permissionId) {return true;}return selectionsRanges?.some((selectionRange) => {@@ -91,6 +91,7 @@ export function getEditPermissionHidden$(accessor: IAccessor) {}const rangeProtectionRuleModel = accessor.get(RangeProtectionRuleModel);const worksheetRuleModel = accessor.get(WorksheetProtectionRuleModel);+ const permissionService = accessor.get(IPermissionService);const selectionManagerService = accessor.get(SheetsSelectionsService);return merge(@@ -104,7 +105,6 @@ export function getEditPermissionHidden$(accessor: IAccessor) {const subUnitRuleList = rangeRuleModel.getSubunitRuleList(unitId, subUnitId);const selectionRanges = selectionManagerService.getCurrentSelections()?.map((selection) => selection.range);- const ruleRanges = subUnitRuleList.map((rule) => rule.ranges).flat();if (!selectionRanges?.length) {return true;}@@ -113,16 +113,38 @@ export function getEditPermissionHidden$(accessor: IAccessor) {return true;}- const selectedRange = selectionRanges[0];+ const selectionRange = selectionRanges[0];++ if (selectionRange?.rangeType === RANGE_TYPE.ALL || selectionRange?.rangeType === RANGE_TYPE.COLUMN || selectionRange?.rangeType === RANGE_TYPE.ROW) {+ return true;+ }const worksheetRule = worksheetRuleModel.getRule(unitId, subUnitId);- if (worksheetRule?.permissionId && worksheetRule?.name) {- return false;+ if (worksheetRule?.permissionId) {+ return permissionService.getPermissionPoint(new WorksheetManageCollaboratorPermission(unitId, subUnitId).id)?.value === false;}- const lapRanges = ruleRanges.filter((ruleRange) => Rectangle.intersects(ruleRange, selectedRange));+ const overlapRule = subUnitRuleList.filter((rule) => {+ return rule.ranges.some((range) => {+ return Rectangle.intersects(range, selectionRange);+ });+ });++ if (overlapRule.length !== 1) {+ return true;+ }- return lapRanges.length !== 1;+ const { startRow, endRow, startColumn, endColumn } = selectionRange;+ const rangeProtectionCache = accessor.get(RangeProtectionCache);+ for (let i = startRow; i <= endRow; i++) {+ for (let j = startColumn; j <= endColumn; j++) {+ const cellInfo = rangeProtectionCache.getCellInfo(unitId, subUnitId, i, j);+ if (cellInfo) {+ return cellInfo[UnitAction.ManageCollaborator] === false;+ }+ }+ }+ return false;}));})@@ -152,7 +174,8 @@ export function getPermissionDisableBase$(accessor: IAccessor) {const selectionManagerService = accessor.get(SheetsSelectionsService);const selectionProtectionRuleModel = accessor.get(RangeProtectionRuleModel);const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);- const permission$ = permissionService.composePermission$([new WorkbookManageCollaboratorPermission(unitId).id, new WorkbookEditablePermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false);++ const permission$ = permissionService.composePermission$([new WorkbookEditablePermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false);const ruleChange$ = merge(selectionProtectionRuleModel.ruleChange$,worksheetProtectionRuleModel.ruleChange$@@ -210,7 +233,7 @@ export function getAddPermissionDisableBase$(accessor: IAccessor) {const selectionProtectionRuleModel = accessor.get(RangeProtectionRuleModel);const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);const selectionManagerService = accessor.get(SheetsSelectionsService);- const permission$ = permissionService.composePermission$([new WorkbookManageCollaboratorPermission(unitId).id, new WorkbookEditablePermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false);+ const permission$ = permissionService.composePermission$([new WorkbookCreateProtectPermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false);const ruleChange$ = merge(selectionProtectionRuleModel.ruleChange$,worksheetProtectionRuleModel.ruleChange$@@ -229,7 +252,7 @@ export function getAddPermissionDisableBase$(accessor: IAccessor) {}const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);- if (worksheetRule?.permissionId && worksheetRule?.name) {+ if (worksheetRule?.permissionId) {return true;}@@ -271,7 +294,7 @@ export function getAddPermissionFromSheetBarDisable$(accessor: IAccessor) {const subUnitId = worksheet.getSheetId();const selectionProtectionRuleModel = accessor.get(RangeProtectionRuleModel);const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);- const permission$ = permissionService.composePermission$([new WorkbookManageCollaboratorPermission(unitId).id, new WorkbookEditablePermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false);+ const permission$ = permissionService.composePermission$([new WorkbookCreateProtectPermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false);const ruleChange$ = merge(selectionProtectionRuleModel.ruleChange$,worksheetProtectionRuleModel.ruleChange$@@ -282,7 +305,7 @@ export function getAddPermissionFromSheetBarDisable$(accessor: IAccessor) {map(([permission, _]) => {if (!permission) return true;const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);- if (worksheetRule?.permissionId && worksheetRule?.name) return true;+ if (worksheetRule?.permissionId) return true;const subUnitRuleList = selectionProtectionRuleModel.getSubunitRuleList(unitId, subUnitId)?.filter((item) => item?.permissionId && item?.name);return subUnitRuleList.length > 0;})@@ -313,12 +336,13 @@ export function getRemovePermissionFromSheetBarDisable$(accessor: IAccessor) {const unitId = workbook.getUnitId();const subUnitId = worksheet.getSheetId();const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);- const permission$ = permissionService.composePermission$([new WorkbookManageCollaboratorPermission(unitId).id, new WorkbookEditablePermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false);- return combineLatest([permission$, worksheetProtectionRuleModel.ruleChange$.pipe(startWith(null))]).pipe(- map(([permission, _]) => {- if (!permission) return true;- const worksheetPermissionRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);- return !(worksheetPermissionRule?.permissionId && worksheetPermissionRule?.name);+ return worksheetProtectionRuleModel.ruleChange$.pipe(startWith(null)).pipe(+ map(() => {+ const rule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);+ if (rule) {+ return permissionService.getPermissionPoint(new WorksheetDeleteProtectionPermission(unitId, subUnitId).id)?.value === false;+ }+ return true;}));})@@ -347,7 +371,7 @@ export function getSetPermissionFromSheetBarDisable$(accessor: IAccessor) {const unitId = workbook.getUnitId();const selectionProtectionRuleModel = accessor.get(RangeProtectionRuleModel);const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);- const permission$ = permissionService.composePermission$([new WorkbookManageCollaboratorPermission(unitId).id, new WorkbookEditablePermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false);+ const permission$ = permissionService.composePermission$([new WorkbookCreateProtectPermission(unitId).id, new WorkbookManageCollaboratorPermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false);const worksheetRuleChange$ = worksheetProtectionRuleModel.ruleChange$.pipe(startWith(null));const selectionRuleChange$ = selectionProtectionRuleModel.ruleChange$.pipe(startWith(null));return combineLatest([permission$, worksheetRuleChange$, selectionRuleChange$]).pipe(@@ -392,18 +416,13 @@ export function getRemovePermissionDisable$(accessor: IAccessor) {const sheetSelectionsService = accessor.get(SheetsSelectionsService);const selectionProtectionRuleModel = accessor.get(RangeProtectionRuleModel);const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);- const permission$ = permissionService.composePermission$([new WorkbookManageCollaboratorPermission(unitId).id, new WorkbookEditablePermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false);-- const changes$ = merge(+ // const permission$ = permissionService.composePermission$([new WorkbookEditablePermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false);+ return merge(selectionProtectionRuleModel.ruleChange$,worksheetProtectionRuleModel.ruleChange$,sheetSelectionsService.selectionMoveEnd$- ).pipe(startWith(null));- return combineLatest([changes$, permission$]).pipe(- map(([_, permission]) => {- if (!permission) {- return true;- }+ ).pipe(startWith(null)).pipe(+ map(() => {const selections = accessor.get(SheetsSelectionsService).getCurrentSelections();const selectionRanges = selections?.map((selection) => selection.range);if (!selectionRanges?.length || selectionRanges.length > 1) {@@ -412,22 +431,36 @@ export function getRemovePermissionDisable$(accessor: IAccessor) {const selectionRange = selectionRanges[0];- const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);- if (worksheetRule?.permissionId && worksheetRule?.name) {- return false;+ if (selectionRange?.rangeType === RANGE_TYPE.ALL || selectionRange?.rangeType === RANGE_TYPE.COLUMN || selectionRange?.rangeType === RANGE_TYPE.ROW) {+ return true;}- const subUnitRuleRanges = selectionProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).map((rule) => rule.ranges).flat();+ const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);+ if (worksheetRule?.permissionId) {+ return permissionService.getPermissionPoint(new WorksheetDeleteProtectionPermission(unitId, subUnitId).id)?.value === false;+ }- const hasLap = subUnitRuleRanges.some((ruleRange) => {- return Rectangle.intersects(selectionRange, ruleRange);+ const overlapRule = selectionProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).filter((rule) => {+ return rule.ranges.some((range) => {+ return Rectangle.intersects(range, selectionRange);+ });});- if (hasLap) {- return false;- } else {+ if (overlapRule.length !== 1) {return true;}++ const { startRow, endRow, startColumn, endColumn } = selectionRange;+ const rangeProtectionCache = accessor.get(RangeProtectionCache);+ for (let i = startRow; i <= endRow; i++) {+ for (let j = startColumn; j <= endColumn; j++) {+ const cellInfo = rangeProtectionCache.getCellInfo(unitId, subUnitId, i, j);+ if (cellInfo) {+ return cellInfo[UnitAction.Delete] === false;+ }+ }+ }+ return false;}));})diff --git a/packages/sheets-ui/src/controllers/menu/permission.menu.ts b/packages/sheets-ui/src/controllers/menu/permission.menu.tsindex 136f531e0d..f654ee37dd 100644--- a/packages/sheets-ui/src/controllers/menu/permission.menu.ts+++ b/packages/sheets-ui/src/controllers/menu/permission.menu.ts@@ -14,14 +14,14 @@* limitations under the License.*/-import type { IMenuButtonItem, IMenuItem, IMenuSelectorItem } from '@univerjs/ui';-import { getMenuHiddenObservable, MenuItemType } from '@univerjs/ui';import type { IAccessor } from '@univerjs/core';-+import type { IMenuButtonItem, IMenuItem, IMenuSelectorItem } from '@univerjs/ui';import { UniverInstanceType } from '@univerjs/core';++import { getMenuHiddenObservable, MenuItemType } from '@univerjs/ui';import { AddRangeProtectionFromContextMenuCommand, AddRangeProtectionFromSheetBarCommand, AddRangeProtectionFromToolbarCommand, DeleteRangeProtectionFromContextMenuCommand, SetRangeProtectionFromContextMenuCommand, ViewSheetPermissionFromContextMenuCommand, ViewSheetPermissionFromSheetBarCommand } from '../../commands/commands/range-protection.command';-import { permissionLockIconKey, permissionMenuIconKey } from '../../consts/permission';import { ChangeSheetProtectionFromSheetBarCommand, DeleteWorksheetProtectionFormSheetBarCommand } from '../../commands/commands/worksheet-protection.command';+import { permissionLockIconKey, permissionMenuIconKey } from '../../consts/permission';import { getAddPermissionDisableBase$, getAddPermissionFromSheetBarDisable$, getAddPermissionHidden$, getEditPermissionHidden$, getPermissionDisableBase$, getRemovePermissionDisable$, getRemovePermissionFromSheetBarDisable$, getSetPermissionFromSheetBarDisable$, getViewPermissionDisable$ } from './permission-menu-util';export const SHEET_PERMISSION_CONTEXT_MENU_ID = 'sheet.contextMenu.permission';@@ -62,8 +62,8 @@ export function sheetPermissionEditProtectContextMenuFactory(accessor: IAccessorid: SetRangeProtectionFromContextMenuCommand.id,type: MenuItemType.BUTTON,title: 'rightClick.editProtectRange',- hidden$: getEditPermissionHidden$(accessor),disabled$: getPermissionDisableBase$(accessor),+ hidden$: getEditPermissionHidden$(accessor),};}diff --git a/packages/sheets-ui/src/controllers/permission/sheet-permission-init.controller.ts b/packages/sheets-ui/src/controllers/permission/sheet-permission-init.controller.tsindex cb76448b5b..ccc40fb854 100644--- a/packages/sheets-ui/src/controllers/permission/sheet-permission-init.controller.ts+++ b/packages/sheets-ui/src/controllers/permission/sheet-permission-init.controller.ts@@ -15,10 +15,11 @@*/import type { Workbook } from '@univerjs/core';-import type { IAddRangeProtectionMutationParams, IAddWorksheetProtectionParams, ISetWorksheetPermissionPointsMutationParams, IWorksheetProtectionRenderCellData } from '@univerjs/sheets';-import { Disposable, IAuthzIoService, ICommandService, Inject, InterceptorEffectEnum, IPermissionService, IUndoRedoService, IUniverInstanceService, UniverInstanceType, UserManagerService } from '@univerjs/core';-import { UnitAction, UnitObject } from '@univerjs/protocol';-import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, defaultWorkbookPermissionPoints, defaultWorksheetPermissionPoint, getAllRangePermissionPoint, getAllWorkbookPermissionPoint, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel, INTERCEPTOR_POINT, RangeProtectionCache, RangeProtectionRuleModel, SetWorksheetPermissionPointsMutation, SheetInterceptorService, WorksheetEditPermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetViewPermission } from '@univerjs/sheets';+import type { UnitAction } from '@univerjs/protocol';+import type { IAddRangeProtectionMutationParams, IAddWorksheetProtectionParams, ISetWorksheetPermissionPointsMutationParams } from '@univerjs/sheets';+import { Disposable, IAuthzIoService, ICommandService, Inject, IPermissionService, IUndoRedoService, IUniverInstanceService, UniverInstanceType, UserManagerService } from '@univerjs/core';+import { UnitObject } from '@univerjs/protocol';+import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, baseProtectionActions, defaultWorkbookPermissionPoints, defaultWorksheetPermissionPoint, getAllRangePermissionPoint, getAllWorkbookPermissionPoint, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel, RangeProtectionCache, RangeProtectionRuleModel, SetWorksheetPermissionPointsMutation, SheetInterceptorService, WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '@univerjs/sheets';import { skip } from 'rxjs';export class SheetPermissionInitController extends Disposable {@@ -43,8 +44,6 @@ export class SheetPermissionInitController extends Disposable {this._initWorksheetPermissionPointsChange();this._initWorkbookPermissionFromSnapshot();this._initUserChange();- this._initViewModelByRangeInterceptor();- this._initViewModelBySheetInterceptor();this._refreshPermissionByCollaCreate();}@@ -67,7 +66,7 @@ export class SheetPermissionInitController extends Disposable {objectID: rule.permissionId,unitID: unitId,objectType: UnitObject.SelectRange,- actions: [UnitAction.View, UnitAction.Edit],+ actions: baseProtectionActions,});});});@@ -107,7 +106,7 @@ export class SheetPermissionInitController extends Disposable {objectID: info.rule.permissionId,unitID: info.unitId,objectType: UnitObject.SelectRange,- actions: [UnitAction.Edit, UnitAction.View],+ actions: baseProtectionActions,}).then((actionList) => {getAllRangePermissionPoint().forEach((F) => {if (info.type === 'set') {@@ -174,7 +173,7 @@ export class SheetPermissionInitController extends Disposable {objectID: info.rule.permissionId,unitID: info.unitId,objectType: UnitObject.Worksheet,- actions: [UnitAction.Edit, UnitAction.View],+ actions: baseProtectionActions,}).then((actionList) => {getAllWorksheetPermissionPoint().forEach((F) => {const instance = new F(info.unitId, info.subUnitId);@@ -238,7 +237,7 @@ export class SheetPermissionInitController extends Disposable {objectID: rule.permissionId,unitID: unitId,objectType: UnitObject.Worksheet,- actions: [UnitAction.Edit, UnitAction.View],+ actions: baseProtectionActions,});}@@ -335,63 +334,6 @@ export class SheetPermissionInitController extends Disposable {);}- private _initViewModelByRangeInterceptor() {- this.disposeWithMe(this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, {- // permissions are placed at a high level to prioritize whether to filter subsequent renderings.- priority: 999,- effect: InterceptorEffectEnum.Value | InterceptorEffectEnum.Style,- handler: (cell = {}, context, next) => {- const { unitId, subUnitId, row, col } = context;-- const selectionProtection = this._rangeProtectionCache.getCellInfo(unitId, subUnitId, row, col);-- if (selectionProtection) {- const isSkipRender = selectionProtection[UnitAction.View] === false;- const _cellData = { ...cell, selectionProtection: [selectionProtection] };- if (isSkipRender) {- delete _cellData.s;- delete _cellData.v;- delete _cellData.p;- return _cellData;- }- return next(_cellData);- }- return next(cell);- },-- }- ));- }-- private _initViewModelBySheetInterceptor() {- this.disposeWithMe(this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, {- // permissions are placed at a high level to prioritize whether to filter subsequent renderings.- priority: 999,- effect: InterceptorEffectEnum.Value | InterceptorEffectEnum.Style,- handler: (cell = {}, context, next) => {- const { unitId, subUnitId } = context;- const worksheetRule = this._worksheetProtectionRuleModel.getRule(unitId, subUnitId);- if (worksheetRule?.permissionId) {- const selectionProtection = [{- [UnitAction.View]: this._permissionService.getPermissionPoint(new WorksheetViewPermission(unitId, subUnitId).id)?.value ?? false,- [UnitAction.Edit]: this._permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id)?.value ?? false,- }];- const isSkipRender = !selectionProtection[0]?.[UnitAction.View];- const _cellData: IWorksheetProtectionRenderCellData = { ...cell, hasWorksheetRule: true, selectionProtection };- if (isSkipRender) {- delete _cellData.s;- delete _cellData.v;- delete _cellData.p;- return _cellData;- }- return next(_cellData);- }- return next(cell);- },- }- ));- }-public refreshPermission(unitId: string, permissionId: string) {const sheetRuleItem = this._worksheetProtectionRuleModel.getTargetByPermissionId(unitId, permissionId);let needClearUndoRedo = false;@@ -401,7 +343,7 @@ export class SheetPermissionInitController extends Disposable {objectID: permissionId,unitID: unitId,objectType: UnitObject.Worksheet,- actions: [UnitAction.Edit, UnitAction.View],+ actions: baseProtectionActions,}).then((actionList) => {let key = '';getAllWorksheetPermissionPoint().forEach((F) => {@@ -456,7 +398,7 @@ export class SheetPermissionInitController extends Disposable {objectID: permissionId,unitID: unitId,objectType: UnitObject.SelectRange,- actions: [UnitAction.Edit, UnitAction.View],+ actions: baseProtectionActions,}).then((actionList) => {let key = '';getAllRangePermissionPoint().forEach((F) => {diff --git a/packages/sheets-ui/src/controllers/permission/sheet-permission-view-model.controller.ts b/packages/sheets-ui/src/controllers/permission/sheet-permission-view-model.controller.tsnew file mode 100644index 0000000000..ee44db7eaf--- /dev/null+++ b/packages/sheets-ui/src/controllers/permission/sheet-permission-view-model.controller.ts@@ -0,0 +1,90 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import type { IWorksheetProtectionRenderCellData } from '@univerjs/sheets';+import { Disposable, Inject, InterceptorEffectEnum, IPermissionService } from '@univerjs/core';+import { UnitAction } from '@univerjs/protocol';+import { INTERCEPTOR_POINT, RangeProtectionCache, SheetInterceptorService, WorksheetEditPermission, WorksheetProtectionRuleModel, WorksheetViewPermission } from '@univerjs/sheets';++export class SheetPermissionViewModelController extends Disposable {+ constructor(+ @IPermissionService private _permissionService: IPermissionService,+ @Inject(WorksheetProtectionRuleModel) private _worksheetProtectionRuleModel: WorksheetProtectionRuleModel,+ @Inject(SheetInterceptorService) private _sheetInterceptorService: SheetInterceptorService,+ @Inject(RangeProtectionCache) private _rangeProtectionCache: RangeProtectionCache+ ) {+ super();+ this._initViewModelByRangeInterceptor();+ this._initViewModelBySheetInterceptor();+ }++ private _initViewModelByRangeInterceptor() {+ this.disposeWithMe(this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, {+ // permissions are placed at a high level to prioritize whether to filter subsequent renderings.+ priority: 999,+ effect: InterceptorEffectEnum.Value | InterceptorEffectEnum.Style,+ handler: (cell = {}, context, next) => {+ const { unitId, subUnitId, row, col } = context;++ const selectionProtection = this._rangeProtectionCache.getCellInfo(unitId, subUnitId, row, col);++ if (selectionProtection) {+ const isSkipRender = selectionProtection[UnitAction.View] === false;+ const _cellData = { ...cell, selectionProtection: [selectionProtection] };+ if (isSkipRender) {+ delete _cellData.s;+ delete _cellData.v;+ delete _cellData.p;+ return _cellData;+ }+ return next(_cellData);+ }+ return next(cell);+ },++ }+ ));+ }++ private _initViewModelBySheetInterceptor() {+ this.disposeWithMe(this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, {+ // permissions are placed at a high level to prioritize whether to filter subsequent renderings.+ priority: 999,+ effect: InterceptorEffectEnum.Value | InterceptorEffectEnum.Style,+ handler: (cell = {}, context, next) => {+ const { unitId, subUnitId } = context;+ const worksheetRule = this._worksheetProtectionRuleModel.getRule(unitId, subUnitId);+ if (worksheetRule?.permissionId) {+ const selectionProtection = [{+ [UnitAction.View]: this._permissionService.getPermissionPoint(new WorksheetViewPermission(unitId, subUnitId).id)?.value ?? false,+ [UnitAction.Edit]: this._permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id)?.value ?? false,+ }];+ const isSkipRender = !selectionProtection[0]?.[UnitAction.View];+ const _cellData: IWorksheetProtectionRenderCellData = { ...cell, hasWorksheetRule: true, selectionProtection };+ if (isSkipRender) {+ delete _cellData.s;+ delete _cellData.v;+ delete _cellData.p;+ return _cellData;+ }+ return next(_cellData);+ }+ return next(cell);+ },+ }+ ));+ }+}diff --git a/packages/sheets-ui/src/plugin.ts b/packages/sheets-ui/src/plugin.tsindex 9ce9feb176..ac053c6fbf 100644--- a/packages/sheets-ui/src/plugin.ts+++ b/packages/sheets-ui/src/plugin.ts@@ -47,6 +47,7 @@ import { SheetPermissionInterceptorCanvasRenderController } from './controllers/import { SheetPermissionInterceptorClipboardController } from './controllers/permission/sheet-permission-interceptor-clipboard.controller';import { SheetPermissionInterceptorFormulaRenderController } from './controllers/permission/sheet-permission-interceptor-formula-render.controller';import { SheetPermissionRenderController, SheetPermissionRenderManagerController, WorksheetProtectionRenderController } from './controllers/permission/sheet-permission-render.controller';+import { SheetPermissionViewModelController } from './controllers/permission/sheet-permission-view-model.controller';import { SheetContextMenuRenderController } from './controllers/render-controllers/contextmenu.render-controller';import { EditorBridgeRenderController } from './controllers/render-controllers/editor-bridge.render-controller';import { FormatPainterRenderController } from './controllers/render-controllers/format-painter.render-controller';@@ -152,10 +153,12 @@ export class UniverSheetsUIPlugin extends Plugin {[SheetPermissionInterceptorClipboardController],[SheetPermissionInterceptorBaseController],[SheetPermissionInitController],+ [SheetPermissionViewModelController],[SheetPermissionRenderManagerController],] as Dependency[], this._config.override));touchDependencies(this._injector, [+ [SheetPermissionViewModelController],[SheetPermissionPanelModel],]);}diff --git a/packages/sheets-ui/src/views/permission/footer/permission-detail-footer.tsx b/packages/sheets-ui/src/views/permission/footer/permission-detail-footer.tsxindex 36d96c231d..9ed6ad243e 100644--- a/packages/sheets-ui/src/views/permission/footer/permission-detail-footer.tsx+++ b/packages/sheets-ui/src/views/permission/footer/permission-detail-footer.tsx@@ -14,18 +14,18 @@* limitations under the License.*/-import { Button } from '@univerjs/design';import { IAuthzIoService, ICommandService, LocaleService, useDependency } from '@univerjs/core';-import React from 'react';-import { ISidebarService, useObservable } from '@univerjs/ui';+import { Button } from '@univerjs/design';import { ObjectScope, UnitAction, UnitObject, UnitRole } from '@univerjs/protocol';import { AddRangeProtectionCommand } from '@univerjs/sheets';-import { editState, SheetPermissionPanelModel, viewState } from '../../../services/permission/sheet-permission-panel.model';-import { SheetPermissionUserManagerService } from '../../../services/permission/sheet-permission-user-list.service';-import { getUserListEqual } from '../../../common/utils';+import { ISidebarService, useObservable } from '@univerjs/ui';+import React from 'react';import { SetProtectionCommand } from '../../../commands/commands/range-protection.command';import { AddWorksheetProtectionCommand } from '../../../commands/commands/worksheet-protection.command';+import { getUserListEqual } from '../../../common/utils';import { UNIVER_SHEET_PERMISSION_PANEL, UNIVER_SHEET_PERMISSION_PANEL_FOOTER } from '../../../consts/permission';+import { editState, SheetPermissionPanelModel, viewState } from '../../../services/permission/sheet-permission-panel.model';+import { SheetPermissionUserManagerService } from '../../../services/permission/sheet-permission-user-list.service';import styles from './index.module.less';export const SheetPermissionPanelDetailFooter = () => {@@ -43,7 +43,7 @@ export const SheetPermissionPanelDetailFooter = () => {<Buttontype="primary"onClick={async () => {- if (!activeRule.name || rangeErrMsg) return;+ if (rangeErrMsg) return;let collaborators = sheetPermissionUserManagerService.selectUserList;if (activeRule.editStatus === editState.onlyMe) {collaborators = [];diff --git a/packages/sheets-ui/src/views/permission/footer/permission-list-footer.tsx b/packages/sheets-ui/src/views/permission/footer/permission-list-footer.tsxindex c46d09027d..b7f6d5c4e3 100644--- a/packages/sheets-ui/src/views/permission/footer/permission-list-footer.tsx+++ b/packages/sheets-ui/src/views/permission/footer/permission-list-footer.tsx@@ -14,14 +14,14 @@* limitations under the License.*/-import { Button } from '@univerjs/design';+import type { Workbook } from '@univerjs/core';import { IPermissionService, IUniverInstanceService, LocaleService, UniverInstanceType, useDependency } from '@univerjs/core';-import React from 'react';+import { Button } from '@univerjs/design';+import { WorkbookCreateProtectPermission, WorksheetProtectionRuleModel } from '@univerjs/sheets';import { ISidebarService, useObservable } from '@univerjs/ui';-import type { Workbook } from '@univerjs/core';-import { WorkbookEditablePermission, WorkbookManageCollaboratorPermission, WorksheetProtectionRuleModel } from '@univerjs/sheets';-import { SheetPermissionPanelModel } from '../../../services/permission/sheet-permission-panel.model';+import React from 'react';import { UNIVER_SHEET_PERMISSION_PANEL, UNIVER_SHEET_PERMISSION_PANEL_FOOTER } from '../../../consts/permission';+import { SheetPermissionPanelModel } from '../../../services/permission/sheet-permission-panel.model';import styles from './index.module.less';export const SheetPermissionPanelAddFooter = () => {@@ -34,10 +34,7 @@ export const SheetPermissionPanelAddFooter = () => {const unitId = workbook.getUnitId();const activeSheet$ = useObservable(workbook.activeSheet$);- const workbookEditPermission = permissionService.getPermissionPoint(new WorkbookEditablePermission(unitId).id)?.value ?? false;- const workbookManagePermission = permissionService.getPermissionPoint(new WorkbookManageCollaboratorPermission(unitId).id)?.value ?? false;-- const hasSetProtectPermission = workbookEditPermission && workbookManagePermission;+ const hasSetProtectPermission = permissionService.getPermissionPoint(new WorkbookCreateProtectPermission(unitId).id)?.value ?? false;const sheetPermissionPanelModel = useDependency(SheetPermissionPanelModel);const worksheetProtectionRuleModel = useDependency(WorksheetProtectionRuleModel);diff --git a/packages/sheets-ui/src/views/permission/panel-detail/index.tsx b/packages/sheets-ui/src/views/permission/panel-detail/index.tsxindex 132f957d19..d413a59aa0 100644--- a/packages/sheets-ui/src/views/permission/panel-detail/index.tsx+++ b/packages/sheets-ui/src/views/permission/panel-detail/index.tsx@@ -77,7 +77,8 @@ export const SheetPermissionPanelDetail = ({ fromSheetBar }: { fromSheetBar: boo}});- sheetPermissionUserManagerService.setUserList(userList);+ const currentUser = userManagerService.getCurrentUser();+ sheetPermissionUserManagerService.setUserList(userList.filter((user) => user.subject?.userID !== currentUser.userID));dialogService.open({id: UNIVER_SHEET_PERMISSION_USER_DIALOG_ID,@@ -136,6 +137,7 @@ export const SheetPermissionPanelDetail = ({ fromSheetBar }: { fromSheetBar: boouseEffect(() => {const isEdit = activeRule?.permissionId;+ setRangeInitialization(true);if (isEdit) {if (activeRule.unitType === UnitObject.Worksheet) {sheetPermissionPanelModel.setRule({@@ -184,7 +186,6 @@ export const SheetPermissionPanelDetail = ({ fromSheetBar }: { fromSheetBar: boounitType: fromSheetBar ? UnitObject.Worksheet : UnitObject.SelectRange,});- setRangeInitialization(true);}, [activeRule?.permissionId, fromSheetBar, selectionManagerService, sheetPermissionPanelModel, subUnitId, unitId, worksheet]);useEffect(() => {diff --git a/packages/sheets-ui/src/views/permission/panel-list/index.tsx b/packages/sheets-ui/src/views/permission/panel-list/index.tsxindex 7acd06014a..e9f7a6fe2c 100644--- a/packages/sheets-ui/src/views/permission/panel-list/index.tsx+++ b/packages/sheets-ui/src/views/permission/panel-list/index.tsx@@ -14,26 +14,26 @@* limitations under the License.*/-import React, { useCallback, useEffect, useState } from 'react';-import clsx from 'clsx';-import { Avatar, Tooltip } from '@univerjs/design';-import { IAuthzIoService, ICommandService, IPermissionService, IUniverInstanceService, LocaleService, UniverInstanceType, useDependency, UserManagerService } from '@univerjs/core';import type { IRange, Workbook } from '@univerjs/core';-import type { IRangeProtectionRule, IWorksheetProtectionRule } from '@univerjs/sheets';-import { DeleteRangeProtectionCommand, RangeProtectionRuleModel, SetWorksheetActiveOperation, WorkbookManageCollaboratorPermission, WorksheetProtectionRuleModel } from '@univerjs/sheets';-import { ISidebarService, useObservable } from '@univerjs/ui';-import { merge } from 'rxjs';import type { IPermissionPoint } from '@univerjs/protocol';-import { UnitAction, UnitObject } from '@univerjs/protocol';+import type { IRangeProtectionRule, IWorksheetProtectionRule } from '@univerjs/sheets';+import type { IPermissionPanelRule } from '../../../services/permission/sheet-permission-panel.model';+import { IAuthzIoService, ICommandService, IPermissionService, IUniverInstanceService, LocaleService, UniverInstanceType, useDependency, UserManagerService } from '@univerjs/core';+import { Avatar, Tooltip } from '@univerjs/design';+import { serializeRange } from '@univerjs/engine-formula';import { DeleteSingle, WriteSingle } from '@univerjs/icons';+import { UnitAction, UnitObject } from '@univerjs/protocol';+import { baseProtectionActions, DeleteRangeProtectionCommand, RangeProtectionRuleModel, SetWorksheetActiveOperation, WorksheetProtectionRuleModel } from '@univerjs/sheets';+import { ISidebarService, useObservable } from '@univerjs/ui';+import clsx from 'clsx';-import { serializeRange } from '@univerjs/engine-formula';+import React, { useCallback, useEffect, useState } from 'react';+import { merge } from 'rxjs';import { DeleteWorksheetProtectionCommand } from '../../../commands/commands/worksheet-protection.command';-import type { IPermissionPanelRule } from '../../../services/permission/sheet-permission-panel.model';-import { SheetPermissionPanelModel } from '../../../services/permission/sheet-permission-panel.model';import { UNIVER_SHEET_PERMISSION_PANEL, UNIVER_SHEET_PERMISSION_PANEL_FOOTER } from '../../../consts/permission';import { useHighlightRange } from '../../../hooks/useHighlightRange';+import { SheetPermissionPanelModel } from '../../../services/permission/sheet-permission-panel.model';import { panelListEmptyBase64 } from './constant';import styles from './index.module.less';@@ -72,12 +72,12 @@ export const SheetPermissionPanelList = () => {const sheetId = sheet.getSheetId();const rules = rangeProtectionRuleModel.getSubunitRuleList(unitId, sheetId);rules.forEach((rule) => {- if (rule.permissionId && rule.name) {+ if (rule.permissionId) {allRangePermissionId.push(rule.permissionId);}});const worksheetPermissionRule = worksheetProtectionModel.getRule(unitId, sheetId);- if (worksheetPermissionRule?.permissionId && worksheetPermissionRule.name) {+ if (worksheetPermissionRule?.permissionId) {allSheetPermissionId.push(worksheetPermissionRule.permissionId);}});@@ -87,7 +87,7 @@ export const SheetPermissionPanelList = () => {const allPermissionRule = await authzIoService.list({objectIDs: allPermissionId,unitID: unitId,- actions: [UnitAction.View, UnitAction.Edit],+ actions: baseProtectionActions,});const subUnitPermissionIds = rangeProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).map((item) => item.permissionId);@@ -232,9 +232,11 @@ export const SheetPermissionPanelList = () => {const viewAction = item.actions.find((action) => action.action === UnitAction.View);const viewPermission = viewAction?.allowed;- const manageCollaboratorAction = permissionService.getPermissionPoint(new WorkbookManageCollaboratorPermission(unitId).id)?.value ?? false;+ const manageCollaboratorAction = item.actions.find((action) => action.action === UnitAction.ManageCollaborator);+ const deleteAction = item.actions.find(((action) => action.action === UnitAction.Delete));- const hasManagerPermission = manageCollaboratorAction || currentUser.userID === item.creator?.userID;+ const hasManagerPermission = manageCollaboratorAction?.allowed || currentUser.userID === item.creator?.userID;+ const hasDeletePermission = deleteAction?.allowed || currentUser.userID === item.creator?.userID;let ruleName = '';@@ -282,14 +284,18 @@ export const SheetPermissionPanelList = () => {<div className={styles.sheetPermissionListItemHeaderName}>{ruleName}</div></Tooltip>- {hasManagerPermission && (+ {(hasManagerPermission || hasDeletePermission) && (<div className={styles.sheetPermissionListItemHeaderOperator}>- <Tooltip title={localeService.t('permission.panel.edit')}>- <div className={styles.sheetPermissionListItemHeaderIcon} onClick={() => handleEdit(rule as IPermissionPanelRule)}><WriteSingle /></div>- </Tooltip>- <Tooltip title={localeService.t('permission.panel.delete')}>- <div className={styles.sheetPermissionListItemHeaderIcon} onClick={() => handleDelete(rule)}><DeleteSingle /></div>- </Tooltip>+ {hasManagerPermission && (+ <Tooltip title={localeService.t('permission.panel.edit')}>+ <div className={styles.sheetPermissionListItemHeaderIcon} onClick={() => handleEdit(rule as IPermissionPanelRule)}><WriteSingle /></div>+ </Tooltip>+ )}+ {hasDeletePermission && (+ <Tooltip title={localeService.t('permission.panel.delete')}>+ <div className={styles.sheetPermissionListItemHeaderIcon} onClick={() => handleDelete(rule)}><DeleteSingle /></div>+ </Tooltip>+ )}</div>)}</div>diff --git a/packages/sheets/package.json b/packages/sheets/package.jsonindex 06a0921c5b..82cb2bc125 100644--- a/packages/sheets/package.json+++ b/packages/sheets/package.json@@ -67,7 +67,7 @@"@univerjs/core": "workspace:*","@univerjs/engine-formula": "workspace:*","@univerjs/engine-numfmt": "workspace:*",- "@univerjs/protocol": "0.1.39-alpha.30",+ "@univerjs/protocol": "0.1.39-alpha.36","@univerjs/rpc": "workspace:*"},"devDependencies": {diff --git a/packages/sheets/src/commands/mutations/add-range-protection.mutation.ts b/packages/sheets/src/commands/mutations/add-range-protection.mutation.tsindex 25b01596c8..7e9988dc90 100644--- a/packages/sheets/src/commands/mutations/add-range-protection.mutation.ts+++ b/packages/sheets/src/commands/mutations/add-range-protection.mutation.ts@@ -15,11 +15,11 @@*/import type { IMutation, IMutationInfo } from '@univerjs/core';-import { CommandType } from '@univerjs/core';-import type { IRangeProtectionRule } from '../../model/range-protection-rule.model';++import type { IDeleteRangeProtectionMutationParams } from './delete-range-protection.mutation';+import { CommandType } from '@univerjs/core';import { RangeProtectionRuleModel } from '../../model/range-protection-rule.model';-import type { IDeleteSelectionProtectionMutationParams } from './delete-range-protection.mutation';import { DeleteRangeProtectionMutation } from './delete-range-protection.mutation';export interface IAddRangeProtectionMutationParams {@@ -31,8 +31,8 @@ export interface IAddRangeProtectionMutationParams {};export const FactoryAddRangeProtectionMutation = (param: IAddRangeProtectionMutationParams) => {- const deleteParams: IDeleteSelectionProtectionMutationParams = { ...param, ruleIds: param.rules.map((rule) => rule.id) };- return { id: DeleteRangeProtectionMutation.id, params: deleteParams } as IMutationInfo<IDeleteSelectionProtectionMutationParams>;+ const deleteParams: IDeleteRangeProtectionMutationParams = { ...param, ruleIds: param.rules.map((rule) => rule.id) };+ return { id: DeleteRangeProtectionMutation.id, params: deleteParams } as IMutationInfo<IDeleteRangeProtectionMutationParams>;};export const AddRangeProtectionMutation: IMutation<IAddRangeProtectionMutationParams> = {diff --git a/packages/sheets/src/commands/mutations/delete-range-protection.mutation.ts b/packages/sheets/src/commands/mutations/delete-range-protection.mutation.tsindex 6514849e06..a3e80b73d7 100644--- a/packages/sheets/src/commands/mutations/delete-range-protection.mutation.ts+++ b/packages/sheets/src/commands/mutations/delete-range-protection.mutation.ts@@ -15,25 +15,25 @@*/import type { IAccessor, IMutation, IMutationInfo } from '@univerjs/core';-import { CommandType } from '@univerjs/core';-import type { IRangeProtectionRule } from '../../model/range-protection-rule.model';-import { RangeProtectionRuleModel } from '../../model/range-protection-rule.model';+import type { IAddRangeProtectionMutationParams } from './add-range-protection.mutation';+import { CommandType } from '@univerjs/core';+import { RangeProtectionRuleModel } from '../../model/range-protection-rule.model';import { AddRangeProtectionMutation } from './add-range-protection.mutation';-export interface IDeleteSelectionProtectionMutationParams {+export interface IDeleteRangeProtectionMutationParams {ruleIds: string[];unitId: string;subUnitId: string;};-export const FactoryDeleteRangeProtectionMutation = (accessor: IAccessor, param: IDeleteSelectionProtectionMutationParams) => {+export const FactoryDeleteRangeProtectionMutation = (accessor: IAccessor, param: IDeleteRangeProtectionMutationParams) => {const selectionProtectionRuleModel = accessor.get(RangeProtectionRuleModel);const rules = param.ruleIds.map((id) => selectionProtectionRuleModel.getRule(param.unitId, param.subUnitId, id)).filter((rule) => !!rule) as IRangeProtectionRule[];const result: IMutationInfo<Omit<IAddRangeProtectionMutationParams, 'name'>> = { id: AddRangeProtectionMutation.id, params: { subUnitId: param.subUnitId, unitId: param.unitId, rules } };return result;};-export const DeleteRangeProtectionMutation: IMutation<IDeleteSelectionProtectionMutationParams> = {+export const DeleteRangeProtectionMutation: IMutation<IDeleteRangeProtectionMutationParams> = {id: 'sheet.mutation.delete-range-protection',type: CommandType.MUTATION,handler: (accessor, params) => {diff --git a/packages/sheets/src/index.ts b/packages/sheets/src/index.tsindex b5090bbb2d..1d3b5f229c 100644--- a/packages/sheets/src/index.ts+++ b/packages/sheets/src/index.ts@@ -106,6 +106,7 @@ export { defaultWorkbookPermissionPoints, getAllWorkbookPermissionPoint } from 'export {WorkbookCommentPermission,WorkbookCopyPermission,+ WorkbookCreateProtectPermission,WorkbookCreateSheetPermission,WorkbookDeleteSheetPermission,WorkbookDuplicatePermission,@@ -122,8 +123,9 @@ export {WorkbookViewHistoryPermission,WorkbookViewPermission,WorksheetCopyPermission,- WorksheetDeleteColumnPermission,+ WorksheetDeleteColumnPermission,+ WorksheetDeleteProtectionPermission,WorksheetDeleteRowPermission,WorksheetEditExtraObjectPermission,WorksheetEditPermission,@@ -161,6 +163,9 @@ export {export { RangeProtectionPermissionEditPoint } from './services/permission/permission-point/range/edit';export { RangeProtectionPermissionViewPoint } from './services/permission/permission-point/range/view';+export { RangeProtectionPermissionManageCollaPoint } from './services/permission/permission-point/range/manage-collaborator';+export { RangeProtectionPermissionDeleteProtectionPoint } from './services/permission/permission-point/range/delete-protection';+export { baseProtectionActions } from './services/permission/range-permission/util';export { generateNullCell, generateNullCellValue } from './basics/utils';export { getSheetCommandTarget, getSheetCommandTargetWorkbook, getSheetMutationTarget } from './commands/commands/utils/target-util';@@ -308,8 +313,9 @@ export type { ISetWorksheetShowCommandParams } from './commands/commands/set-worexport { AddRangeProtectionMutation, FactoryAddRangeProtectionMutation, type IAddRangeProtectionMutationParams } from './commands/mutations/add-range-protection.mutation';export { AddMergeUndoMutationFactory, AddWorksheetMergeMutation } from './commands/mutations/add-worksheet-merge.mutation';export { AddWorksheetProtectionMutation, type IAddWorksheetProtectionParams } from './commands/mutations/add-worksheet-protection.mutation';-export { DeleteRangeProtectionMutation, FactoryDeleteRangeProtectionMutation, type IDeleteSelectionProtectionMutationParams } from './commands/mutations/delete-range-protection.mutation';+export { DeleteRangeProtectionMutation, FactoryDeleteRangeProtectionMutation, type IDeleteRangeProtectionMutationParams } from './commands/mutations/delete-range-protection.mutation';export { DeleteWorksheetProtectionMutation } from './commands/mutations/delete-worksheet-protection.mutation';+export type { IDeleteWorksheetProtectionParams } from './commands/mutations/delete-worksheet-protection.mutation';export { EmptyMutation } from './commands/mutations/empty.mutation';export {InsertColMutation,@@ -379,6 +385,7 @@ export { type ISetWorksheetOrderMutationParams, SetWorksheetOrderMutation } fromexport { SetWorksheetPermissionPointsMutation } from './commands/mutations/set-worksheet-permission-points.mutation';export type { ISetWorksheetPermissionPointsMutationParams } from './commands/mutations/set-worksheet-permission-points.mutation';export { SetWorksheetProtectionMutation } from './commands/mutations/set-worksheet-protection.mutation';+export type { ISetWorksheetProtectionParams } from './commands/mutations/set-worksheet-protection.mutation';export { SetWorksheetRightToLeftMutation } from './commands/mutations/set-worksheet-right-to-left.mutation';export {type ISetWorksheetRowAutoHeightMutationParams,diff --git a/packages/sheets/src/model/range-protection.cache.ts b/packages/sheets/src/model/range-protection.cache.tsindex e23643221f..0ed0ebfeb4 100644--- a/packages/sheets/src/model/range-protection.cache.ts+++ b/packages/sheets/src/model/range-protection.cache.ts@@ -16,11 +16,13 @@import type { IRange, Workbook } from '@univerjs/core';import type { IRangePermissionPoint } from '../services/permission/range-permission/util';-import type { IRuleChange } from './range-protection-rule.model';+import type { IRangeProtectionRule, IRuleChange } from './range-protection-rule.model';import { Disposable, Inject, IPermissionService, IUniverInstanceService, Range, UniverInstanceType } from '@univerjs/core';import { UnitAction, UnitObject } from '@univerjs/protocol';import { filter, map } from 'rxjs';import { RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint } from '../services/permission/permission-point';+import { RangeProtectionPermissionDeleteProtectionPoint } from '../services/permission/permission-point/range/delete-protection';+import { RangeProtectionPermissionManageCollaPoint } from '../services/permission/permission-point/range/manage-collaborator';import { RangeProtectionRuleModel } from './range-protection-rule.model';export class RangeProtectionCache extends Disposable {@@ -186,6 +188,20 @@ export class RangeProtectionCache extends Disposable {this._permissionIdCache.delete(rule.permissionId);}+ private _getSelectionActions(unitId: string, subUnitId: string, rule: IRangeProtectionRule) {+ const edit = this._permissionService.getPermissionPoint(new RangeProtectionPermissionEditPoint(unitId, subUnitId, rule.permissionId)?.id)?.value ?? true;+ const view = this._permissionService.getPermissionPoint(new RangeProtectionPermissionViewPoint(unitId, subUnitId, rule.permissionId)?.id)?.value ?? true;+ const manageProtection = this._permissionService.getPermissionPoint(new RangeProtectionPermissionManageCollaPoint(unitId, subUnitId, rule.permissionId)?.id)?.value ?? false;+ const deleteProtection = this._permissionService.getPermissionPoint(new RangeProtectionPermissionDeleteProtectionPoint(unitId, subUnitId, rule.permissionId)?.id)?.value ?? false;+ const selectionProtection = {+ [UnitAction.Edit]: edit,+ [UnitAction.View]: view,+ [UnitAction.ManageCollaborator]: manageProtection,+ [UnitAction.Delete]: deleteProtection,+ };+ return selectionProtection;+ }+public reBuildCache(unitId: string, subUnitId: string) {const cellRuleMap = this._ensureRuleMap(unitId, subUnitId);const cellInfoMap = this._ensureCellInfoMap(unitId, subUnitId);@@ -198,11 +214,9 @@ export class RangeProtectionCache extends Disposable {colInfoMap.clear();this._ruleModel.getSubunitRuleList(unitId, subUnitId).forEach((rule) => {- const edit = this._permissionService.getPermissionPoint(new RangeProtectionPermissionEditPoint(unitId, subUnitId, rule.permissionId)?.id)?.value ?? true;- const view = this._permissionService.getPermissionPoint(new RangeProtectionPermissionViewPoint(unitId, subUnitId, rule.permissionId)?.id)?.value ?? true;+ const selectionActions = this._getSelectionActions(unitId, subUnitId, rule);const selectionProtection = {- [UnitAction.Edit]: edit,- [UnitAction.View]: view,+ ...selectionActions,ruleId: rule.id,ranges: rule.ranges,};@@ -211,9 +225,9 @@ export class RangeProtectionCache extends Disposable {for (let i = startRow; i <= endRow; i++) {const rowInfo = rowInfoMap.get(`${i}`);if (!rowInfo) {- rowInfoMap.set(`${i}`, new Map([[rule.id, { [UnitAction.Edit]: edit, [UnitAction.View]: view }]]));+ rowInfoMap.set(`${i}`, new Map([[rule.id, selectionActions]]));} else {- rowInfo.set(rule.id, { [UnitAction.Edit]: edit, [UnitAction.View]: view });+ rowInfo.set(rule.id, selectionActions);}for (let j = startColumn; j <= endColumn; j++) {@@ -221,9 +235,9 @@ export class RangeProtectionCache extends Disposable {cellInfoMap.set(`${i}-${j}`, selectionProtection);const colInfo = colInfoMap.get(`${j}`);if (!colInfo) {- colInfoMap.set(`${j}`, new Map([[rule.id, { [UnitAction.Edit]: edit, [UnitAction.View]: view }]]));+ colInfoMap.set(`${j}`, new Map([[rule.id, selectionActions]]));} else {- colInfo.set(rule.id, { [UnitAction.Edit]: edit, [UnitAction.View]: view });+ colInfo.set(rule.id, selectionActions);}}}@@ -288,25 +302,24 @@ export class RangeProtectionCache extends Disposable {const rowInfoMap = this._ensureRowColInfoMap(unitId, subUnitId, 'row');const colInfoMap = this._ensureRowColInfoMap(unitId, subUnitId, 'col');- const edit = this._permissionService.getPermissionPoint(new RangeProtectionPermissionEditPoint(unitId, subUnitId, ruleInstance.permissionId)?.id)?.value ?? true;- const view = this._permissionService.getPermissionPoint(new RangeProtectionPermissionViewPoint(unitId, subUnitId, ruleInstance.permissionId)?.id)?.value ?? true;+ const selectionActions = this._getSelectionActions(unitId, subUnitId, ruleInstance);ruleInstance.ranges.forEach((range) => {const { startRow, endRow, startColumn, endColumn } = range;for (let i = startRow; i <= endRow; i++) {const rowInfo = rowInfoMap.get(`${i}`);if (!rowInfo) {- rowInfoMap.set(`${i}`, new Map([[ruleId, { [UnitAction.Edit]: edit, [UnitAction.View]: view }]]));+ rowInfoMap.set(`${i}`, new Map([[ruleId, selectionActions]]));} else {- rowInfo.set(ruleId, { [UnitAction.Edit]: edit, [UnitAction.View]: view });+ rowInfo.set(ruleId, selectionActions);}for (let j = startColumn; j <= endColumn; j++) {const colInfo = colInfoMap.get(`${j}`);if (!colInfo) {- colInfoMap.set(`${j}`, new Map([[ruleId, { [UnitAction.Edit]: edit, [UnitAction.View]: view }]]));+ colInfoMap.set(`${j}`, new Map([[ruleId, selectionActions]]));} else {- colInfo.set(ruleId, { [UnitAction.Edit]: edit, [UnitAction.View]: view });+ colInfo.set(ruleId, selectionActions);}}}@@ -341,9 +354,6 @@ export class RangeProtectionCache extends Disposable {if (cacheValue) {return cacheValue;}-- let view = true;- let edit = true;const ruleId = this._cellRuleCache.get(unitId)?.get(subUnitId)?.get(`${row}-${col}`);if (!ruleId) {return;@@ -351,11 +361,9 @@ export class RangeProtectionCache extends Disposable {const rule = this._ruleModel.getRule(unitId, subUnitId, ruleId);if (rule) {- view = this._permissionService.getPermissionPoint(new RangeProtectionPermissionViewPoint(unitId, subUnitId, rule.permissionId)?.id)?.value ?? true;- edit = this._permissionService.getPermissionPoint(new RangeProtectionPermissionEditPoint(unitId, subUnitId, rule.permissionId)?.id)?.value ?? true;+ const selectionActions = this._getSelectionActions(unitId, subUnitId, rule);const selectionProtection = {- [UnitAction.Edit]: edit,- [UnitAction.View]: view,+ ...selectionActions,ruleId,ranges: rule.ranges,};diff --git a/packages/sheets/src/services/permission/permission-point/index.ts b/packages/sheets/src/services/permission/permission-point/index.tsindex f083caaabd..c452e401c7 100644--- a/packages/sheets/src/services/permission/permission-point/index.ts+++ b/packages/sheets/src/services/permission/permission-point/index.ts@@ -19,6 +19,7 @@ export { RangeProtectionPermissionViewPoint } from './range/view';export { WorkbookCommentPermission } from './workbook/comment';export { WorkbookCopyPermission } from './workbook/copy';export { WorkbookCopySheetPermission } from './workbook/copy-sheet';+export { WorkbookCreateProtectPermission } from './workbook/create-permission';export { WorkbookCreateSheetPermission } from './workbook/create-sheet';export { WorkbookDeleteSheetPermission } from './workbook/delete-sheet';export { WorkbookDuplicatePermission } from './workbook/duplicate';@@ -37,6 +38,7 @@ export { WorkbookViewPermission } from './workbook/view';export { WorkbookViewHistoryPermission } from './workbook/view-history';export { WorksheetCopyPermission } from './worksheet/copy';export { WorksheetDeleteColumnPermission } from './worksheet/delete-column';+export { WorksheetDeleteProtectionPermission } from './worksheet/delete-protection';export { WorksheetDeleteRowPermission } from './worksheet/delete-row';export { WorksheetEditPermission } from './worksheet/edit';export { WorksheetEditExtraObjectPermission } from './worksheet/edit-extra-object';diff --git a/packages/sheets/src/services/permission/permission-point/range/delete-protection.ts b/packages/sheets/src/services/permission/permission-point/range/delete-protection.tsnew file mode 100644index 0000000000..f3fa913a93--- /dev/null+++ b/packages/sheets/src/services/permission/permission-point/range/delete-protection.ts@@ -0,0 +1,36 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import type { IPermissionPoint } from '@univerjs/core';+import { PermissionStatus } from '@univerjs/core';+import { UnitAction, UnitObject } from '@univerjs/protocol';++export class RangeProtectionPermissionDeleteProtectionPoint implements IPermissionPoint {+ type = UnitObject.SelectRange;+ subType = UnitAction.Delete;+ status = PermissionStatus.INIT;+ value = true;+ id: string;+ unitId: string;+ subUnitId: string;+ permissionId: string;+ constructor(unitId: string, subUnitId: string, permissionId: string) {+ this.unitId = unitId;+ this.subUnitId = subUnitId;+ this.permissionId = permissionId;+ this.id = `${UnitObject.SelectRange}.${UnitAction.Delete}.${permissionId}`;+ }+}diff --git a/packages/sheets/src/services/permission/permission-point/range/manage-collaborator.ts b/packages/sheets/src/services/permission/permission-point/range/manage-collaborator.tsnew file mode 100644index 0000000000..1b421b379b--- /dev/null+++ b/packages/sheets/src/services/permission/permission-point/range/manage-collaborator.ts@@ -0,0 +1,36 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import type { IPermissionPoint } from '@univerjs/core';+import { PermissionStatus } from '@univerjs/core';+import { UnitAction, UnitObject } from '@univerjs/protocol';++export class RangeProtectionPermissionManageCollaPoint implements IPermissionPoint {+ type = UnitObject.SelectRange;+ subType = UnitAction.ManageCollaborator;+ status = PermissionStatus.INIT;+ value = true;+ id: string;+ unitId: string;+ subUnitId: string;+ permissionId: string;+ constructor(unitId: string, subUnitId: string, permissionId: string) {+ this.unitId = unitId;+ this.subUnitId = subUnitId;+ this.permissionId = permissionId;+ this.id = `${UnitObject.SelectRange}.${UnitAction.ManageCollaborator}.${permissionId}`;+ }+}diff --git a/packages/sheets/src/services/permission/permission-point/workbook/create-permission.ts b/packages/sheets/src/services/permission/permission-point/workbook/create-permission.tsnew file mode 100644index 0000000000..78f225e895--- /dev/null+++ b/packages/sheets/src/services/permission/permission-point/workbook/create-permission.ts@@ -0,0 +1,32 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import type { IPermissionPoint } from '@univerjs/core';+import { PermissionStatus } from '@univerjs/core';+import { UnitAction, UnitObject } from '@univerjs/protocol';++export class WorkbookCreateProtectPermission implements IPermissionPoint {+ id: string;+ value = true;+ type = UnitObject.Workbook;+ status = PermissionStatus.INIT;+ subType = UnitAction.CreatePermissionObject;++ constructor(public unitId: string) {+ this.unitId = unitId;+ this.id = `${this.type}.${UnitAction.CreatePermissionObject}_${unitId}`;+ }+}diff --git a/packages/sheets/src/services/permission/permission-point/worksheet/delete-protection.ts b/packages/sheets/src/services/permission/permission-point/worksheet/delete-protection.tsnew file mode 100644index 0000000000..85cd024d01--- /dev/null+++ b/packages/sheets/src/services/permission/permission-point/worksheet/delete-protection.ts@@ -0,0 +1,30 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import type { IPermissionPoint } from '@univerjs/core';+import { PermissionStatus } from '@univerjs/core';+import { UnitAction, UnitObject } from '@univerjs/protocol';++export class WorksheetDeleteProtectionPermission implements IPermissionPoint {+ value = true;+ type = UnitObject.Worksheet;+ status = PermissionStatus.INIT;+ id: string;+ subType = UnitAction.Delete;+ constructor(public unitId: string, public subUnitId: string) {+ this.id = `${this.type}.${UnitAction.Delete}_${unitId}_${subUnitId}`;+ }+}diff --git a/packages/sheets/src/services/permission/range-permission/range-protection.ref-range.ts b/packages/sheets/src/services/permission/range-permission/range-protection.ref-range.tsindex c05a15d047..f84f43bfce 100644--- a/packages/sheets/src/services/permission/range-permission/range-protection.ref-range.ts+++ b/packages/sheets/src/services/permission/range-permission/range-protection.ref-range.ts@@ -26,7 +26,7 @@ import type {} from '../../../commands/commands/move-rows-cols.command';import type { IRemoveRowColCommandParams } from '../../../commands/commands/remove-row-col.command';import type { IAddRangeProtectionMutationParams } from '../../../commands/mutations/add-range-protection.mutation';-import type { IDeleteSelectionProtectionMutationParams } from '../../../commands/mutations/delete-range-protection.mutation';+import type { IDeleteRangeProtectionMutationParams } from '../../../commands/mutations/delete-range-protection.mutation';import type { ISetRangeProtectionMutationParams } from '../../../commands/mutations/set-range-protection.mutation';import type { IRangeProtectionRule } from '../../../model/range-protection-rule.model';import type { EffectRefRangeParams } from '../../../services/ref-range/type';@@ -165,8 +165,8 @@ export class RangeProtectionRefRangeService extends Disposable {const removeRange = params.range;if (permissionRangeLapRules.length) {- const redoMutations: IMutationInfo<ISetRangeProtectionMutationParams | IAddRangeProtectionMutationParams | IDeleteSelectionProtectionMutationParams>[] = [];- const undoMutations: IMutationInfo<ISetRangeProtectionMutationParams | IAddRangeProtectionMutationParams | IDeleteSelectionProtectionMutationParams>[] = [];+ const redoMutations: IMutationInfo<ISetRangeProtectionMutationParams | IAddRangeProtectionMutationParams | IDeleteRangeProtectionMutationParams>[] = [];+ const undoMutations: IMutationInfo<ISetRangeProtectionMutationParams | IAddRangeProtectionMutationParams | IDeleteRangeProtectionMutationParams>[] = [];permissionRangeLapRules.forEach((rule) => {const cloneRule = Tools.deepClone(rule);const rangesByRemove = cloneRule.ranges.reduce((p, c) => {diff --git a/packages/sheets/src/services/permission/range-permission/range-protection.service.ts b/packages/sheets/src/services/permission/range-permission/range-protection.service.tsindex cae95a374d..4ca6f58364 100644--- a/packages/sheets/src/services/permission/range-permission/range-protection.service.ts+++ b/packages/sheets/src/services/permission/range-permission/range-protection.service.ts@@ -14,14 +14,15 @@* limitations under the License.*/-import type { IObjectModel } from '../../../model/range-protection-rule.model';+import type { UnitAction } from '@univerjs/protocol';-import { Disposable, Inject, IPermissionService, IResourceManagerService } from '@univerjs/core';-import { UnitAction, UnitObject, UniverType } from '@univerjs/protocol';+import type { IObjectModel } from '../../../model/range-protection-rule.model';+import { Disposable, Inject, IPermissionService, IResourceManagerService, IUniverInstanceService } from '@univerjs/core';+import { UnitObject, UniverType } from '@univerjs/protocol';import { RangeProtectionCache } from '../../../model/range-protection.cache';import { RangeProtectionRuleModel } from '../../../model/range-protection-rule.model';-import { getAllRangePermissionPoint } from './util';+import { baseProtectionActions, getAllRangePermissionPoint } from './util';const PLUGIN_NAME = 'SHEET_RANGE_PROTECTION_PLUGIN';@@ -30,7 +31,8 @@ export class RangeProtectionService extends Disposable {@Inject(RangeProtectionRuleModel) private _selectionProtectionRuleModel: RangeProtectionRuleModel,@Inject(IPermissionService) private _permissionService: IPermissionService,@Inject(IResourceManagerService) private _resourceManagerService: IResourceManagerService,- @Inject(RangeProtectionCache) private _selectionProtectionCache: RangeProtectionCache+ @Inject(RangeProtectionCache) private _selectionProtectionCache: RangeProtectionCache,+ @Inject(IUniverInstanceService) private _univerInstanceService: IUniverInstanceService) {super();@@ -109,7 +111,7 @@ export class RangeProtectionService extends Disposable {objectID: rule.permissionId,unitID: unitId,objectType: UnitObject.SelectRange,- actions: [UnitAction.View, UnitAction.Edit],+ actions: baseProtectionActions,});});@@ -124,7 +126,6 @@ export class RangeProtectionService extends Disposable {});},onUnLoad: (unitId: string) => {- this._selectionProtectionRuleModel.deleteUnitModel(unitId);this._selectionProtectionCache.deleteUnit(unitId);},})diff --git a/packages/sheets/src/services/permission/range-permission/util.ts b/packages/sheets/src/services/permission/range-permission/util.tsindex 5d24381889..5ec6e32f77 100644--- a/packages/sheets/src/services/permission/range-permission/util.ts+++ b/packages/sheets/src/services/permission/range-permission/util.ts@@ -14,13 +14,17 @@* limitations under the License.*/-import type { UnitAction } from '@univerjs/protocol';+import { UnitAction } from '@univerjs/protocol';+import { RangeProtectionPermissionDeleteProtectionPoint } from '../permission-point/range/delete-protection';import { RangeProtectionPermissionEditPoint } from '../permission-point/range/edit';+import { RangeProtectionPermissionManageCollaPoint } from '../permission-point/range/manage-collaborator';import { RangeProtectionPermissionViewPoint } from '../permission-point/range/view';export type IRangePermissionPoint = RangeProtectionPermissionEditPoint | RangeProtectionPermissionViewPoint;-export const getAllRangePermissionPoint = () => [RangeProtectionPermissionViewPoint, RangeProtectionPermissionEditPoint];+export const getAllRangePermissionPoint = () => [RangeProtectionPermissionViewPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionDeleteProtectionPoint];++export const baseProtectionActions = [UnitAction.Edit, UnitAction.View, UnitAction.ManageCollaborator, UnitAction.Delete];export const getDefaultRangePermission = (unitId = 'unitId', subUnitId = 'subUnitId', permissionId = 'permissionId') => getAllRangePermissionPoint().reduce((r, F) => {const i = new F(unitId, subUnitId, permissionId);diff --git a/packages/sheets/src/services/permission/type.ts b/packages/sheets/src/services/permission/type.tsindex dd59db7996..4c8dde1a93 100644--- a/packages/sheets/src/services/permission/type.ts+++ b/packages/sheets/src/services/permission/type.ts@@ -18,11 +18,11 @@ import type { UnitObject } from '@univerjs/protocol';export interface IWorksheetProtectionRule {permissionId: string;- name?: string;description?: string;unitType: UnitObject;unitId: string;subUnitId: string;+ name: string;}export interface IWorksheetProtectionPointRule {diff --git a/packages/sheets/src/services/permission/workbook-permission/util.ts b/packages/sheets/src/services/permission/workbook-permission/util.tsindex 4563d6531a..1be4a16b41 100644--- a/packages/sheets/src/services/permission/workbook-permission/util.ts+++ b/packages/sheets/src/services/permission/workbook-permission/util.ts@@ -16,6 +16,7 @@import { UnitAction } from '@univerjs/protocol';import { WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCopySheetPermission, WorkbookCreateSheetPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission } from '../permission-point';+import { WorkbookCreateProtectPermission } from '../permission-point/workbook/create-permission';export const getAllWorkbookPermissionPoint = () => [WorkbookEditablePermission,@@ -35,6 +36,7 @@ export const getAllWorkbookPermissionPoint = () => [WorkbookCopySheetPermission,WorkbookViewHistoryPermission,WorkbookRecoverHistoryPermission,+ WorkbookCreateProtectPermission,];export const defaultWorkbookPermissionPoints = [@@ -55,4 +57,5 @@ export const defaultWorkbookPermissionPoints = [UnitAction.CopySheet,UnitAction.RecoverHistory,UnitAction.ViewHistory,+ UnitAction.CreatePermissionObject,];diff --git a/packages/sheets/src/services/permission/workbook-permission/workbook-permission.service.ts b/packages/sheets/src/services/permission/workbook-permission/workbook-permission.service.tsindex f42b569d18..a10d8b6ebb 100644--- a/packages/sheets/src/services/permission/workbook-permission/workbook-permission.service.ts+++ b/packages/sheets/src/services/permission/workbook-permission/workbook-permission.service.ts@@ -17,7 +17,8 @@import type { Workbook } from '@univerjs/core';import { Disposable, Inject, IPermissionService, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';import { RangeProtectionRuleModel } from '../../../model/range-protection-rule.model';-import { RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint } from '../permission-point';+import { getAllRangePermissionPoint } from '../range-permission/util';+import { WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '../worksheet-permission';import { getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel } from '../worksheet-permission/utils';import { getAllWorkbookPermissionPoint } from './util';@@ -25,7 +26,9 @@ export class WorkbookPermissionService extends Disposable {constructor(@Inject(IPermissionService) private _permissionService: IPermissionService,@Inject(IUniverInstanceService) private _univerInstanceService: IUniverInstanceService,- @Inject(RangeProtectionRuleModel) private _rangeProtectionRuleModel: RangeProtectionRuleModel+ @Inject(RangeProtectionRuleModel) private _rangeProtectionRuleModel: RangeProtectionRuleModel,+ @Inject(WorksheetProtectionRuleModel) private _worksheetProtectionRuleModel: WorksheetProtectionRuleModel,+ @Inject(WorksheetProtectionPointModel) private _worksheetProtectionPointModel: WorksheetProtectionPointModel) {super();@@ -56,7 +59,7 @@ export class WorkbookPermissionService extends Disposable {const rangeRuleList = this._rangeProtectionRuleModel.getSubunitRuleList(unitId, subUnitId);rangeRuleList.forEach((rule) => {- [RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint].forEach((F) => {+ [...getAllRangePermissionPoint()].forEach((F) => {const instance = new F(unitId, subUnitId, rule.permissionId);this._permissionService.deletePermissionPoint(instance.id);});@@ -71,6 +74,10 @@ export class WorkbookPermissionService extends Disposable {const instance = new F(unitId);this._permissionService.deletePermissionPoint(instance.id);});++ this._rangeProtectionRuleModel.deleteUnitModel(unitId);+ this._worksheetProtectionPointModel.deleteUnitModel(unitId);+ this._worksheetProtectionRuleModel.deleteUnitModel(unitId);}));}}diff --git a/packages/sheets/src/services/permission/worksheet-permission/utils.ts b/packages/sheets/src/services/permission/worksheet-permission/utils.tsindex b2169763d7..34b2f63921 100644--- a/packages/sheets/src/services/permission/worksheet-permission/utils.ts+++ b/packages/sheets/src/services/permission/worksheet-permission/utils.ts@@ -15,11 +15,13 @@*/import { UnitAction } from '@univerjs/protocol';-import { WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetPivotTablePermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission } from '../permission-point';+import { WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPivotTablePermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission } from '../permission-point';export const getAllWorksheetPermissionPoint = () => [WorksheetEditPermission,WorksheetViewPermission,+ WorksheetManageCollaboratorPermission,+ WorksheetDeleteProtectionPermission,];// Changes require synchronization of the following arraysdiff --git a/packages/sheets/src/services/permission/worksheet-permission/worksheet-permission.service.ts b/packages/sheets/src/services/permission/worksheet-permission/worksheet-permission.service.tsindex 32619b1cbf..3fa856bfe1 100644--- a/packages/sheets/src/services/permission/worksheet-permission/worksheet-permission.service.ts+++ b/packages/sheets/src/services/permission/worksheet-permission/worksheet-permission.service.ts@@ -21,7 +21,8 @@ import { UniverType } from '@univerjs/protocol';import { takeUntil } from 'rxjs/operators';import { RangeProtectionRuleModel } from '../../../model/range-protection-rule.model';-import { RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint } from '../permission-point';+import { getAllRangePermissionPoint } from '../range-permission/util';+import { getAllWorkbookPermissionPoint } from '../workbook-permission';import { getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel } from './utils';import { WorksheetProtectionPointModel } from './worksheet-permission-point.model';import { WorksheetProtectionRuleModel } from './worksheet-permission-rule.model';@@ -67,7 +68,7 @@ export class WorksheetPermissionService extends RxDisposable {const rangeRuleList = this._rangeProtectionRuleModel.getSubunitRuleList(unitId, subUnitId);rangeRuleList.forEach((rule) => {- [RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint].forEach((F) => {+ [...getAllRangePermissionPoint()].forEach((F) => {const instance = new F(unitId, subUnitId, rule.permissionId);this._permissionService.deletePermissionPoint(instance.id);});@@ -155,6 +156,22 @@ export class WorksheetPermissionService extends RxDisposable {this._worksheetProtectionRuleModel.changeRuleInitState(true);},onUnLoad: (unitId: string) => {+ const workbook = this._univerInstanceService.getUnit<Workbook>(unitId);+ if (workbook) {+ workbook.getSheets().forEach((worksheet) => {+ const subUnitId = worksheet.getSheetId();++ [...getAllWorksheetPermissionPoint(), ...getAllWorksheetPermissionPointByPointPanel()].forEach((F) => {+ const instance = new F(unitId, subUnitId);+ this._permissionService.deletePermissionPoint(instance.id);+ });+ });+ getAllWorkbookPermissionPoint().forEach((F) => {+ const instance = new F(unitId);+ this._permissionService.deletePermissionPoint(instance.id);+ });+ }+this._worksheetProtectionRuleModel.deleteUnitModel(unitId);},})diff --git a/packages/thread-comment-ui/package.json b/packages/thread-comment-ui/package.jsonindex e7a540691d..76388a0488 100644--- a/packages/thread-comment-ui/package.json+++ b/packages/thread-comment-ui/package.json@@ -69,7 +69,7 @@"@univerjs/docs-ui": "workspace:*","@univerjs/engine-render": "workspace:*","@univerjs/icons": "^0.1.84",- "@univerjs/protocol": "0.1.39-alpha.30",+ "@univerjs/protocol": "0.1.39-alpha.36","@univerjs/thread-comment": "workspace:*","@univerjs/ui": "workspace:*","clsx": "^2.1.1",diff --git a/packages/thread-comment/package.json b/packages/thread-comment/package.jsonindex 2fafa2662a..2e12357cc5 100644--- a/packages/thread-comment/package.json+++ b/packages/thread-comment/package.json@@ -61,7 +61,7 @@},"dependencies": {"@univerjs/core": "workspace:*",- "@univerjs/protocol": "0.1.39-alpha.30"+ "@univerjs/protocol": "0.1.39-alpha.36"},"devDependencies": {"@univerjs-infra/shared": "workspace:*",diff --git a/packages/umd/package.json b/packages/umd/package.jsonindex 0dbd4e998a..0d64b14f32 100644--- a/packages/umd/package.json+++ b/packages/umd/package.json@@ -55,7 +55,7 @@"@univerjs/facade": "workspace:*","@univerjs/find-replace": "workspace:*","@univerjs/network": "workspace:*",- "@univerjs/protocol": "0.1.39-alpha.30",+ "@univerjs/protocol": "0.1.39-alpha.36","@univerjs/rpc": "workspace:*","@univerjs/sheets": "workspace:*","@univerjs/sheets-conditional-formatting": "workspace:*",diff --git a/packages/uniscript/package.json b/packages/uniscript/package.jsonindex 2fffbd79c9..205f697011 100644--- a/packages/uniscript/package.json+++ b/packages/uniscript/package.json@@ -68,7 +68,7 @@"@univerjs/core": "workspace:*","@univerjs/design": "workspace:*","@univerjs/facade": "workspace:*",- "@univerjs/protocol": "0.1.39-alpha.30",+ "@univerjs/protocol": "0.1.39-alpha.36","@univerjs/sheets": "workspace:*","@univerjs/sheets-ui": "workspace:*","@univerjs/ui": "workspace:*",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 1e141acca5..7bf0f24810 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -10,7 +10,7 @@ importers:devDependencies:'@antfu/eslint-config':specifier: 3.7.3- version: 3.7.3(@eslint-react/[email protected]([email protected]([email protected]))([email protected]))(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))(@vue/[email protected])([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ version: 3.7.3(@eslint-react/[email protected]([email protected]([email protected]))([email protected]))(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))(@vue/[email protected])([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))'@commitlint/cli':specifier: ^19.5.0version: 19.5.0(@types/[email protected])([email protected])@@ -940,8 +940,8 @@ importers:packages/core:dependencies:'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])'@wendellhu/redi':specifier: 0.16.1version: 0.16.1@@ -1001,8 +1001,8 @@ importers:specifier: workspace:*version: link:../core'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])'@univerjs/sheets':specifier: workspace:*version: link:../sheets@@ -1826,8 +1826,8 @@ importers:specifier: workspace:*version: link:../engine-numfmt'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])'@univerjs/rpc':specifier: workspace:*version: link:../rpc@@ -1860,8 +1860,8 @@ importers:specifier: workspace:*version: link:../engine-render'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])'@univerjs/sheets':specifier: workspace:*version: link:../sheets@@ -1909,8 +1909,8 @@ importers:specifier: ^0.1.84'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])'@univerjs/sheets':specifier: workspace:*version: link:../sheets@@ -2028,8 +2028,8 @@ importers:specifier: ^0.1.84'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])'@univerjs/sheets':specifier: workspace:*version: link:../sheets@@ -2089,8 +2089,8 @@ importers:specifier: ^0.1.84'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])'@univerjs/sheets':specifier: workspace:*version: link:../sheets@@ -2319,8 +2319,8 @@ importers:specifier: workspace:*version: link:../find-replace'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])'@univerjs/sheets':specifier: workspace:*version: link:../sheets@@ -2463,8 +2463,8 @@ importers:specifier: workspace:*version: link:../engine-formula'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])'@univerjs/sheets':specifier: workspace:*version: link:../sheets@@ -2809,8 +2809,8 @@ importers:specifier: ^0.1.84'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])'@univerjs/sheets':specifier: workspace:*version: link:../sheets@@ -3027,8 +3027,8 @@ importers:specifier: workspace:*version: link:../core'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])devDependencies:'@univerjs-infra/shared':specifier: workspace:*@@ -3067,8 +3067,8 @@ importers:specifier: ^0.1.84'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])'@univerjs/thread-comment':specifier: workspace:*version: link:../thread-comment@@ -3235,8 +3235,8 @@ importers:specifier: workspace:*version: link:../network'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])'@univerjs/rpc':specifier: workspace:*version: link:../rpc@@ -3362,8 +3362,8 @@ importers:specifier: workspace:*version: link:../facade'@univerjs/protocol':- specifier: 0.1.39-alpha.30- version: 0.1.39-alpha.30(@grpc/[email protected])([email protected])+ specifier: 0.1.39-alpha.36+ version: 0.1.39-alpha.36(@grpc/[email protected])([email protected])'@univerjs/sheets':specifier: workspace:*version: link:../sheets@@ -5239,8 +5239,8 @@ packages:react: '*'react-dom: '*'- '@univerjs/[email protected]':- resolution: {integrity: sha512-mgA8MvuYTWc+E5Fedi45oLKMDBjFzEwOLpFSSZrvzA+rqRnXeVZY21wSOZPHSb+GlIKdNxVtdhg3/ahhVaKJvA==}+ '@univerjs/[email protected]':+ resolution: {integrity: sha512-mmNm+hhI30ArFDaE+rrodEpEDajw6ikTJuSZMwhJBWQRzUlGMhyq8BnlOVnEiDjf244xfjuHWnh9ItIJEKiQAw==}engines: {node: '>=16.0.0', npm: '>=8.0.0'}peerDependencies:'@grpc/grpc-js': 1.9.14@@ -10558,7 +10558,7 @@ snapshots:dependencies:'@babel/runtime': 7.25.0- '@antfu/[email protected](@eslint-react/[email protected]([email protected]([email protected]))([email protected]))(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))(@vue/[email protected])([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':+ '@antfu/[email protected](@eslint-react/[email protected]([email protected]([email protected]))([email protected]))(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))(@vue/[email protected])([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@antfu/install-pkg': 0.4.1'@clack/prompts': 0.7.0@@ -10567,7 +10567,7 @@ snapshots:'@typescript-eslint/eslint-plugin': 8.7.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])- '@vitest/eslint-plugin': 1.1.4(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ '@vitest/eslint-plugin': 1.1.4(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))eslint: 9.12.0([email protected])eslint-config-flat-gitignore: 0.3.0([email protected]([email protected]))eslint-flat-config-utils: 0.4.0@@ -12469,7 +12469,7 @@ snapshots:react: 18.3.1react-dom: 18.3.1([email protected])dependencies:'@grpc/grpc-js': 1.10.9rxjs: 7.8.1@@ -12506,7 +12506,7 @@ snapshots:transitivePeerDependencies:- supports-color- '@vitest/[email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':+ '@vitest/[email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:eslint: 9.12.0([email protected])optionalDependencies: