diff --git a/packages/sheets-ui/src/views/formula-bar/FormulaBar.tsx b/packages/sheets-ui/src/views/formula-bar/FormulaBar.tsx index c5807702613..b890a7d0a6e 100644 --- a/packages/sheets-ui/src/views/formula-bar/FormulaBar.tsx +++ b/packages/sheets-ui/src/views/formula-bar/FormulaBar.tsx @@ -63,8 +63,8 @@ export function FormulaBar() { const subUnitId = worksheet.getSheetId(); const range = selectionManager.getLast()?.range; if (!range) return; - const worksheetSetCellValuePermission = permissionService.getPermissionPoint(new WorksheetSetCellValuePermission(unitId, subUnitId).id); - const worksheetEditPermission = permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id); + const worksheetSetCellValuePermission = permissionService.getPermissionPoint(new WorksheetSetCellValuePermission(unitId, subUnitId).id)?.value; + const worksheetEditPermission = permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id)?.value; if (!worksheetSetCellValuePermission || !worksheetEditPermission) { setDisable(true); @@ -94,7 +94,7 @@ export function FormulaBar() { } } ); - // eslint-disable-next-line react-hooks/exhaustive-deps + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const INITIAL_SNAPSHOT = { diff --git a/packages/sheets-ui/src/views/permission/user-dialog/index.module.less b/packages/sheets-ui/src/views/permission/user-dialog/index.module.less index d416450493c..3c564b2e5b7 100644 --- a/packages/sheets-ui/src/views/permission/user-dialog/index.module.less +++ b/packages/sheets-ui/src/views/permission/user-dialog/index.module.less @@ -1,6 +1,7 @@ .sheet-permission-user-dialog-wrapper { height: 329px; padding: var(--padding-base); + box-sizing: content-box; } .sheet-permission-user-dialog-search { diff --git a/packages/sheets-ui/src/views/sheet-bar/SheetBar.tsx b/packages/sheets-ui/src/views/sheet-bar/SheetBar.tsx index bc3ff0377d9..14c67eb9c23 100644 --- a/packages/sheets-ui/src/views/sheet-bar/SheetBar.tsx +++ b/packages/sheets-ui/src/views/sheet-bar/SheetBar.tsx @@ -17,7 +17,7 @@ import type { Workbook } from '@univerjs/core'; import { ICommandService, IPermissionService, IUniverInstanceService, UniverInstanceType } from '@univerjs/core'; import { IncreaseSingle, MoreSingle } from '@univerjs/icons'; -import { InsertSheetCommand, WorkbookEditablePermission } from '@univerjs/sheets'; +import { InsertSheetCommand, WorkbookCreateSheetPermission, WorkbookEditablePermission } from '@univerjs/sheets'; import { useDependency } from '@wendellhu/redi/react-bindings'; import React, { useEffect, useState } from 'react'; @@ -56,9 +56,11 @@ export const SheetBar = () => { }, []); useEffect(() => { - const subscription = permissionService.getPermissionPoint$(new WorkbookEditablePermission(unitId)?.id)?.pipe( - map((permission) => permission?.value ?? false) - )?.subscribe((permission) => { + const composePermission$ = permissionService.composePermission$([new WorkbookEditablePermission(unitId)?.id, new WorkbookCreateSheetPermission(unitId)?.id])?.pipe( + map((permissions) => permissions?.every((permission) => permission?.value ?? false)) + ); + + const subscription = composePermission$?.subscribe((permission) => { setEditPermission(permission ?? false); });