Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(permission): rename change permission #2481

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/sheets-ui/src/views/formula-bar/FormulaBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.sheet-permission-user-dialog-wrapper {
height: 329px;
padding: var(--padding-base);
box-sizing: content-box;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议全部走flex

}

.sheet-permission-user-dialog-search {
Expand Down
10 changes: 6 additions & 4 deletions packages/sheets-ui/src/views/sheet-bar/SheetBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里当时不是引用问题么?解了?

map((permissions) => permissions?.every((permission) => permission?.value ?? false))
);

const subscription = composePermission$?.subscribe((permission) => {
setEditPermission(permission ?? false);
});

Expand Down
Loading