Skip to content

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.

refactor(ui): rewrite permission style (#5121)

ybzky9923d2fd06f7
diff --git a/packages/design/src/components/switch/Switch.tsx b/packages/design/src/components/switch/Switch.tsx
index dece0bc65e..3d7e3ab1b0 100644
--- a/packages/design/src/components/switch/Switch.tsx
+++ b/packages/design/src/components/switch/Switch.tsx
@@ -15,7 +15,7 @@
*/
import React, { useEffect, useState } from 'react';
-import styles from './index.module.less';
+import { clsx } from '../../helper/clsx';
export interface ISwitchProps {
defaultChecked?: boolean;
@@ -36,10 +36,27 @@ const Switch = (props: ISwitchProps) => {
}, [defaultChecked]);
return (
- <div className={styles.switchWrapper}>
- <label className={styles.switch}>
- <input type="checkbox" checked={checked} onChange={handleChange} />
- <span className={styles.slider} />
+ <div className="univer-h-4">
+ <label className="univer-relative univer-inline-block univer-h-4 univer-w-7">
+ <input
+ type="checkbox"
+ checked={checked}
+ onChange={handleChange}
+ className="univer-opacity-0"
+ />
+ <span
+ className={clsx(`
+ univer-absolute univer-inset-0 univer-cursor-pointer univer-rounded-2xl univer-bg-gray-50
+ univer-transition-colors univer-duration-200
+ `, { 'univer-bg-primary-600': checked })}
+ >
+ <span
+ className={clsx(`
+ univer-absolute univer-bottom-0.5 univer-left-0.5 univer-h-3 univer-w-3 univer-rounded-full
+ univer-bg-white univer-transition-transform univer-duration-200
+ `, { 'univer-translate-x-3': checked })}
+ />
+ </span>
</label>
</div>
);
diff --git a/packages/design/src/components/switch/index.module.less b/packages/design/src/components/switch/index.module.less
deleted file mode 100644
index d4e2ce0355..0000000000
--- a/packages/design/src/components/switch/index.module.less
+++ /dev/null
@@ -1,46 +0,0 @@
-.switch-wrapper {
- height: 16px;
-
- .switch {
- position: relative;
- display: inline-block;
- width: 28px;
- height: 16px;
-
- input {
- opacity: 0;
- }
- }
-
- .slider {
- position: absolute;
- cursor: pointer;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgb(var(--bg-color-hover));
- transition: background-color 0.2s;
- border-radius: 16px;
- }
-
- .slider:before {
- position: absolute;
- content: '';
- height: 12px;
- width: 12px;
- left: 2px;
- bottom: 2px;
- background-color: rgb(var(--color-white));
- transition: transform 0.2s;
- border-radius: 50%;
- }
-
- input:checked + .slider {
- background-color: rgb(var(--primary-color));
- }
-
- input:checked + .slider:before {
- transform: translateX(12px);
- }
-}
diff --git a/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailFooterPart.tsx b/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailFooterPart.tsx
index 866d457ba2..2105bf6a68 100644
--- a/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailFooterPart.tsx
+++ b/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailFooterPart.tsx
@@ -27,7 +27,6 @@ import { UNIVER_SHEET_PERMISSION_PANEL } from '../../../consts/permission';
import { SheetPermissionPanelModel } from '../../../services/permission/sheet-permission-panel.model';
import { SheetPermissionUserManagerService } from '../../../services/permission/sheet-permission-user-list.service';
import { checkRangesIsWholeSheet } from '../util';
-import styles from './index.module.less';
interface IPermissionDetailFooterPartProps {
permissionId: string;
@@ -59,7 +58,7 @@ export const PermissionDetailFooterPart = (props: IPermissionDetailFooterPartPro
const subUnitId = worksheet.getSheetId();
return (
- <div className={styles.sheetPermissionPanelFooter}>
+ <div className="univer-mt-auto univer-flex univer-flex-row-reverse univer-py-5 univer-gap-2">
<Button
variant="primary"
onClick={async () => {
@@ -208,7 +207,6 @@ export const PermissionDetailFooterPart = (props: IPermissionDetailFooterPartPro
{localeService.t('permission.button.confirm')}
</Button>
<Button
- className={styles.sheetPermissionPanelFooterCancel}
onClick={() => {
sheetPermissionPanelModel.reset();
sheetPermissionUserManagerService.reset();
diff --git a/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailMainPart.tsx b/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailMainPart.tsx
index 711a8f3c8d..72718191ee 100644
--- a/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailMainPart.tsx
+++ b/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailMainPart.tsx
@@ -24,7 +24,6 @@ import { ComponentManager, useDependency } from '@univerjs/ui';
import React, { useMemo } from 'react';
import { RANGE_SELECTOR_COMPONENT_KEY } from '../../../common/keys';
import { checkRangeValid } from '../util';
-import styles from './index.module.less';
interface IPermissionDetailMainPartProps {
permissionId: string;
@@ -77,7 +76,7 @@ export const PermissionDetailMainPart = (props: IPermissionDetailMainPartProps)
return (
<>
<FormLayout
- className={styles.sheetPermissionPanelTitle}
+ className="univer-font-medium"
label={localeService.t('permission.panel.protectedRange')}
error={rangesErrMsg}
>
@@ -90,7 +89,7 @@ export const PermissionDetailMainPart = (props: IPermissionDetailMainPartProps)
/>
)}
</FormLayout>
- <FormLayout className={styles.sheetPermissionPanelTitle} label={localeService.t('permission.panel.permissionDirection')}>
+ <FormLayout className="univer-font-medium" label={localeService.t('permission.panel.permissionDirection')}>
<Input
value={desc}
onChange={(v) => onDescChange(v)}
diff --git a/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailPanel.tsx b/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailPanel.tsx
index 198e5d1dfd..71b91001a3 100644
--- a/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailPanel.tsx
+++ b/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailPanel.tsx
@@ -22,7 +22,6 @@ import { ComponentContainer, ISidebarService, useComponentsOfPart, useDependency
import React, { useEffect, useState } from 'react';
import { UNIVER_SHEET_PERMISSION_USER_PART } from '../../../consts/permission';
import { checkRangeValid, generateDefaultRule, generateRuleByUnitType } from '../util';
-import styles from './index.module.less';
import { PermissionDetailFooterPart } from './PermissionDetailFooterPart';
import { PermissionDetailMainPart } from './PermissionDetailMainPart';
@@ -63,7 +62,9 @@ export const SheetPermissionPanelDetail = (props: ISheetPermissionPanelDetailPro
}, []);
return (
- <div className={styles.permissionPanelDetailWrapper}>
+ <div
+ className="univer-mt-4 univer-flex univer-h-[calc(100%-16px)] univer-flex-col"
+ >
<PermissionDetailMainPart
permissionId={activeRule.permissionId}
ranges={ranges}
diff --git a/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailUserPart.tsx b/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailUserPart.tsx
index c8289b4c48..b3e4e1ed7f 100644
--- a/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailUserPart.tsx
+++ b/packages/sheets-ui/src/views/permission/panel-detail/PermissionDetailUserPart.tsx
@@ -25,7 +25,6 @@ import React, { useEffect } from 'react';
import { UNIVER_SHEET_PERMISSION_USER_DIALOG, UNIVER_SHEET_PERMISSION_USER_DIALOG_ID } from '../../../consts/permission';
import { SheetPermissionUserManagerService } from '../../../services/permission/sheet-permission-user-list.service';
import { UserEmptyBase64 } from '../user-dialog/constant';
-import styles from './index.module.less';
export interface IPermissionDetailUserPartProps {
editState: EditStateEnum;
@@ -97,36 +96,54 @@ export const PermissionDetailUserPart = (props: IPermissionDetailUserPartProps)
return (
<>
- <FormLayout className={styles.sheetPermissionPanelTitle} label={localeService.t('permission.panel.editPermission')}>
+ <FormLayout className="univer-font-medium" label={localeService.t('permission.panel.editPermission')}>
<RadioGroup
value={editState}
onChange={(v) => onEditStateChange(v as EditStateEnum)}
- className={styles.radioGroupVertical}
+ className="univer-flex univer-flex-col"
>
<Radio value={EditStateEnum.OnlyMe}>
- <span className={styles.text}>{localeService.t('permission.panel.onlyICanEdit')}</span>
+ <span>{localeService.t('permission.panel.onlyICanEdit')}</span>
</Radio>
<Radio value={EditStateEnum.DesignedUserCanEdit}>
- <span className={styles.text}>{localeService.t('permission.panel.designedUserCanEdit')}</span>
+ <span>{localeService.t('permission.panel.designedUserCanEdit')}</span>
</Radio>
</RadioGroup>
</FormLayout>
{editState === EditStateEnum.DesignedUserCanEdit && (
- <div className={styles.sheetPermissionDesignPersonPanel}>
- <div className={styles.sheetPermissionDesignPersonPanelHeader}>
+ <div
+ className={`
+ univer-mb-2 univer-flex univer-h-[270px] univer-flex-col univer-rounded-lg univer-border
+ univer-border-solid univer-border-gray-200 univer-p-3
+ `}
+ >
+ <div className="univer-flex univer-items-center univer-justify-between">
<span>{localeService.t('permission.panel.designedPerson')}</span>
- <span className={styles.sheetPermissionDesignPersonPanelHeaderAdd} onClick={handleAddPerson}>{localeService.t('permission.panel.addPerson')}</span>
+ <span className="univer-cursor-pointer univer-text-primary-600" onClick={handleAddPerson}>{localeService.t('permission.panel.addPerson')}</span>
</div>
- <div className={styles.sheetPermissionDesignPersonPanelSplit} />
- <div className={styles.sheetPermissionDesignPersonPanelContent}>
+ <div className="univer-my-2 univer-h-px univer-bg-gray-200" />
+ <div className="univer-flex-1">
{selectUserList?.length > 0
? selectUserList.map((item) => {
return (
- <div key={item.subject?.userID} className={styles.sheetPermissionDesignPersonPanelContentItem}>
+ <div
+ key={item.subject?.userID}
+ className={`
+ univer-mb-3 univer-flex univer-h-7 univer-items-center univer-leading-7
+ last:univer-mb-0
+ `}
+ >
<Avatar size={24} src={item.subject?.avatar} />
- <span className={styles.sheetPermissionDesignPersonPanelContentItemName}>{item.subject?.name}</span>
+ <span
+ className={`
+ univer-ml-1.5 univer-w-[130px] univer-text-ellipsis univer-text-black
+ `}
+ >
+ {item.subject?.name}
+ </span>
<Select
- className={styles.sheetPermissionDesignPersonPanelContentItemSelect}
+ className="!univer-w-[90px] univer-min-w-0 univer-cursor-pointer"
+ borderless
value="edit"
options={[
{ label: `${localeService.t('permission.panel.canEdit')}`, value: 'edit' },
@@ -142,26 +159,40 @@ export const PermissionDetailUserPart = (props: IPermissionDetailUserPartProps)
);
})
: (
- <div className={styles.sheetPermissionUserListEmpty}>
+ <div
+ className={`
+ univer-flex univer-h-full univer-flex-col univer-items-center
+ univer-justify-center
+ `}
+ >
<img width={240} height={120} src={UserEmptyBase64} alt="" />
- <p className={styles.sheetPermissionUserListEmptyText}>{localeService.t('permission.dialog.userEmpty')}</p>
+ <p
+ className={`
+ univer-w-60 univer-break-words univer-text-[13px] univer-text-gray-400
+ `}
+ >
+ {localeService.t('permission.dialog.userEmpty')}
+ </p>
</div>
)}
</div>
</div>
)}
- <FormLayout className={styles.sheetPermissionPanelTitle} label={localeService.t('permission.panel.viewPermission')}>
+ <FormLayout className="univer-font-medium" label={localeService.t('permission.panel.viewPermission')}>
<RadioGroup
value={viewState}
onChange={(v) => onViewStateChange(v as ViewStateEnum)}
- className={styles.radioGroupVertical}
+ className={`
+ univer-flex univer-flex-col
+ last:univer-mb-0
+ `}
>
<Radio value={ViewStateEnum.OthersCanView}>
- <span className={styles.text}>{localeService.t('permission.panel.othersCanView')}</span>
+ <span>{localeService.t('permission.panel.othersCanView')}</span>
</Radio>
<Radio value={ViewStateEnum.NoOneElseCanView}>
- <span className={styles.text}>{localeService.t('permission.panel.noOneElseCanView')}</span>
+ <span>{localeService.t('permission.panel.noOneElseCanView')}</span>
</Radio>
</RadioGroup>
</FormLayout>
diff --git a/packages/sheets-ui/src/views/permission/panel-detail/index.module.less b/packages/sheets-ui/src/views/permission/panel-detail/index.module.less
deleted file mode 100644
index 6bd70c2775..0000000000
--- a/packages/sheets-ui/src/views/permission/panel-detail/index.module.less
+++ /dev/null
@@ -1,141 +0,0 @@
-.permission-panel-detail-wrapper {
- margin-top: 16px;
- height: calc(100% - 16px);
- display: flex;
- flex-direction: column;
-}
-
-.radio-group-vertical {
- display: flex;
- flex-direction: column;
- font-weight: 400;
-}
-
-.sheet-permission-design-person-panel {
- height: 270px;
- border: 1px solid rgb(var(--grey-200));
- border-radius: var(--border-radius-lg);
- padding: var(--padding-base);
- margin-bottom: var(--margin-xs);
- display: flex;
- flex-direction: column;
-
- &-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
-
- &-add {
- cursor: pointer;
- color: rgb(var(--blue-500));
- }
- }
-
- &-split {
- height: 1px;
- background-color: rgb(var(--grey-200));
- margin: var(--margin-xs) 0;
- }
-
- &-content {
- &-item {
- height: 28px;
- line-height: 28px;
- margin-bottom: var(--margin-sm);
- display: flex;
- align-items: center;
-
- &:last-child {
- margin-bottom: 0;
- }
-
- &-name {
- width: 130px;
- color: rgb(var(--color-black));
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- margin-left: 6px;
- }
-
- &-select {
- width: 90px;
- cursor: pointer;
- }
- }
- }
-
- :global(
- .univer-sheet-permission-design-person-panel-content-item-select.univer-select-single:not(
- .univer-select-customize-input
- )
- .univer-select-selector
- ) {
- border: none;
- padding: 0;
- color: rgb(var(--grey-900));
- }
-
- :global(
- .univer-sheet-permission-design-person-panel-content-item-select.univer-select-show-arrow .univer-select-arrow
- ) {
- right: 0;
- }
-}
-
-.sheet-permission-design-person-panel-content {
- flex: 1;
-}
-
-.sheet-permission-user-list-empty {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- height: 100%;
-}
-
-.sheet-permission-user-list-empty-text {
- width: 240px;
- word-wrap: break-word;
- color: rgb(var(--grey-400));
- font-size: 13px;
-}
-
-.sheet-permission-panel-title {
- font-weight: 500;
-}
-
-.sheet-permission-panel-footer {
- display: flex;
- flex-direction: row-reverse;
- padding: 20px 0;
- margin-top: auto;
-
- button {
- &:first-child {
- margin-left: 8px;
- }
- }
-}
-
-.permission-range-selector {
- font-weight: 400;
-}
-
-.permission-range-selector-error,
-.sheet-permission-panel-name-input-error {
- border: 1px solid rgb(var(--red-400));
-
- &:hover {
- border: 1px solid rgb(var(--red-400));
- }
-
- &-text {
- height: 20px;
- line-height: 20px;
- color: rgb(var(--red-400));
- font-size: var(--font-size-xs);
- font-weight: 400;
- }
-}
diff --git a/packages/sheets-ui/src/views/permission/panel-list/index.module.less b/packages/sheets-ui/src/views/permission/panel-list/index.module.less
deleted file mode 100644
index 027b56062c..0000000000
--- a/packages/sheets-ui/src/views/permission/panel-list/index.module.less
+++ /dev/null
@@ -1,163 +0,0 @@
-.sheet-permission-list-panel-wrapper {
- margin-top: var(--margin-xs);
- height: calc(100% - 8px);
- display: flex;
- flex-direction: column;
-}
-
-.sheet-permission-list-panel-header {
- display: flex;
- padding: var(--padding-sm) 0;
- height: 30px;
-
- &-type {
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-right: var(--margin-lg);
- cursor: pointer;
-
- div {
- height: 24px;
- line-height: 24px;
- }
-
- &-bottom {
- height: 2px;
- width: 24px;
- background-color: rgb(var(--blue-500));
- margin-top: var(--margin-xxs);
- }
- }
-
- &-select {
- color: rgb(var(--blue-500));
- height: 24px;
- line-height: 24px;
- font-size: var(--font-size-lg);
- font-weight: 500;
- }
-}
-
-.sheet-permission-list-item-header-icon {
- border-radius: var(--border-radius-base);
-
- &:hover {
- background-color: rgb(var(--grey-200));
- }
-
- height: 24px;
- padding: 4px;
- box-sizing: border-box;
-}
-
-.sheet-permission-list-item {
- margin-top: var(--margin-sm);
- border-radius: var(--border-radius-lg);
- border: 1px solid rgb(var(--grey-200));
- padding: var(--padding-base);
-
- &:hover {
- background-color: rgb(var(--grey-50));
- }
-
- &-header {
- height: 20px;
- line-height: 20px;
-
- display: flex;
- justify-content: space-between;
-
- &-name {
- font-weight: 500;
- max-width: 200px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
-
- &-operator {
- display: flex;
- align-items: center;
-
- div {
- margin-left: var(--margin-xs);
- }
- }
- }
-
- &-split {
- height: 1px;
- background-color: rgb(var(--grey-200));
- margin: var(--margin-xs) 0;
- }
-
- &-content {
- &-edit {
- display: flex;
- align-items: center;
- }
-
- &-view {
- display: flex;
- align-items: center;
- margin-top: var(--margin-xs);
- }
-
- &-desc {
- font-size: 12px;
- color: rgb(var(--grey-400));
- max-width: 256px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- margin-top: var(--margin-xs);
- }
- }
-}
-
-.sheet-permission-list-empty {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- flex: 1;
-}
-
-.sheet-permission-list-empty-text {
- width: 240px;
- word-wrap: break-word;
- color: rgb(var(--grey-400));
- font-size: 13px;
-}
-
-.sheet-permission-list-item-content-title {
- font-size: 12px;
- height: 16px;
- line-height: 16px;
- flex-grow: 1;
- color: rgb(var(--color-black));
-}
-
-.sheet-permission-list-item-content-sub {
- font-size: 12px;
- height: 16px;
- line-height: 16px;
- color: rgb(var(--grey-600));
-}
-
-.sheet-permission-panel-add-wrapper {
- padding: 20px 0;
- margin-top: auto;
-}
-
-.sheet-permission-panel-add-button {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
-
- div {
- margin-right: 4px;
- }
-}
diff --git a/packages/sheets-ui/src/views/permission/panel-list/index.tsx b/packages/sheets-ui/src/views/permission/panel-list/index.tsx
index 75eb61c0d1..b9f04745eb 100644
--- a/packages/sheets-ui/src/views/permission/panel-list/index.tsx
+++ b/packages/sheets-ui/src/views/permission/panel-list/index.tsx
@@ -31,7 +31,6 @@ import { UNIVER_SHEET_PERMISSION_PANEL } from '../../../consts/permission';
import { useHighlightRange } from '../../../hooks/use-highlight-range';
import { SheetPermissionUserManagerService } from '../../../services/permission/sheet-permission-user-list.service';
import { panelListEmptyBase64 } from './constant';
-import styles from './index.module.less';
type IRuleItem = IRangeProtectionRule | IWorksheetProtectionRule;
export const SheetPermissionPanelList = () => {
@@ -206,21 +205,24 @@ export const SheetPermissionPanelList = () => {
const hasSetProtectPermission = permissionService.getPermissionPoint(new WorkbookCreateProtectPermission(unitId).id)?.value;
return (
- <div className={styles.sheetPermissionListPanelWrapper}>
- <div className={styles.sheetPermissionListPanelHeader}>
- <div className={styles.sheetPermissionListPanelHeaderType} onClick={() => handleChangeHeaderType(true)}>
- <div className={clsx({ [styles.sheetPermissionListPanelHeaderSelect]: isCurrentSheet })}>{localeService.t('permission.panel.currentSheet')}</div>
- {isCurrentSheet && <div className={styles.sheetPermissionListPanelHeaderTypeBottom} />}
+ <div className="univer-mt-2 univer-flex univer-h-[calc(100%-8px)] univer-flex-col">
+ <div className="univer-flex univer-h-[30px] univer-py-2">
+ <div className="univer-mr-5 univer-flex univer-cursor-pointer univer-flex-col univer-items-center" onClick={() => handleChangeHeaderType(true)}>
+ <div className={clsx('univer-h-6 univer-text-base univer-font-medium univer-leading-6', { 'univer-text-blue-500': isCurrentSheet })}>
+ {' '}
+ {localeService.t('permission.panel.currentSheet')}
+ </div>
+ <div className={clsx('univer-mt-1 univer-h-0.5 univer-w-6', { 'univer-bg-blue-500': isCurrentSheet })} />
</div>
- <div className={styles.sheetPermissionListPanelHeaderType} onClick={() => handleChangeHeaderType(false)}>
- <div className={clsx({ [styles.sheetPermissionListPanelHeaderSelect]: !isCurrentSheet })}>{localeService.t('permission.panel.allSheet')}</div>
- {!isCurrentSheet && <div className={styles.sheetPermissionListPanelHeaderTypeBottom} />}
+ <div className="univer-mr-5 univer-flex univer-cursor-pointer univer-flex-col univer-items-center" onClick={() => handleChangeHeaderType(false)}>
+ <div className={clsx('univer-h-6 univer-text-base univer-font-medium univer-leading-6', { 'univer-text-blue-500': !isCurrentSheet })}>{localeService.t('permission.panel.allSheet')}</div>
+ <div className={clsx('univer-mt-1 univer-h-0.5 univer-w-6', { 'univer-bg-blue-500': !isCurrentSheet })} />
</div>
</div>
{ruleList?.length > 0
? (
- <div className={styles.sheetPermissionListPanelContent}>
+ <div>
{ruleList?.map((item) => {
const rule = allRuleMap.get(item.objectID);
@@ -260,7 +262,11 @@ export const SheetPermissionPanelList = () => {
return (
<div
key={item.objectID}
- className={styles.sheetPermissionListItem}
+ className={`
+ univer-mt-3 univer-rounded-lg univer-border univer-border-solid
+ univer-border-gray-200 univer-p-3
+ hover:univer-bg-gray-50
+ `}
onMouseMove={() => {
const { subUnitId, unitType } = rule;
const activeSheet = workbook.getActiveSheet();
@@ -281,46 +287,86 @@ export const SheetPermissionPanelList = () => {
}}
onMouseLeave={() => currentRuleRangesSet([])}
>
- <div className={styles.sheetPermissionListItemHeader}>
+ <div className="univer-flex univer-h-5 univer-justify-between univer-leading-5">
<Tooltip title={ruleName}>
- <div className={styles.sheetPermissionListItemHeaderName}>{ruleName}</div>
+ <div
+ className={`
+ univer-max-w-[200px] univer-text-ellipsis univer-font-medium
+ `}
+ >
+ {ruleName}
+ </div>
</Tooltip>
{(hasManagerPermission || hasDeletePermission) && (
- <div className={styles.sheetPermissionListItemHeaderOperator}>
+ <div className="univer-flex univer-items-center">
{hasManagerPermission && (
<Tooltip title={localeService.t('permission.panel.edit')}>
- <div className={styles.sheetPermissionListItemHeaderIcon} onClick={() => handleEdit(rule as IPermissionPanelRule)}><WriteSingle /></div>
+ <div
+ className={`
+ univer-box-border univer-h-6 univer-rounded-sm univer-p-1
+ hover:univer-bg-gray-200
+ `}
+ 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>
+ <div
+ className={`
+ univer-box-border univer-h-6 univer-rounded-sm univer-p-1
+ hover:univer-bg-gray-200
+ `}
+ onClick={() => handleDelete(rule)}
+ >
+ <DeleteSingle />
+ </div>
</Tooltip>
)}
</div>
)}
</div>
- <div className={styles.sheetPermissionListItemSplit} />
- <div className={styles.sheetPermissionListItemContent}>
- <div className={styles.sheetPermissionListItemContentEdit}>
+ <div className="univer-my-2 univer-h-px univer-bg-gray-200" />
+ <div>
+ <div className="univer-flex univer-items-center">
<Tooltip title={item.creator?.name ?? ''}>
<div>
- <Avatar src={item.creator?.avatar} style={{ marginRight: 6 }} size={24} />
+ <Avatar src={item.creator?.avatar} className="univer-mr-1.5" size={24} />
</div>
</Tooltip>
- <span className={styles.sheetPermissionListItemContentTitle}>{localeService.t('permission.panel.created')}</span>
- <span className={styles.sheetPermissionListItemContentSub}>{editPermission ? `${localeService.t('permission.panel.iCanEdit')}` : `${localeService.t('permission.panel.iCanNotEdit')}`}</span>
+ <span
+ className={`
+ univer-h-4 univer-flex-grow univer-text-xs univer-text-black
+ `}
+ >
+ {localeService.t('permission.panel.created')}
+ </span>
+ <span className="univer-h-4 univer-text-xs univer-text-black">{editPermission ? `${localeService.t('permission.panel.iCanEdit')}` : `${localeService.t('permission.panel.iCanNotEdit')}`}</span>
</div>
- <div className={styles.sheetPermissionListItemContentView}>
- <span className={styles.sheetPermissionListItemContentTitle}>{localeService.t('permission.panel.viewPermission')}</span>
- <span className={styles.sheetPermissionListItemContentSub}>{viewPermission ? `${localeService.t('permission.panel.iCanView')}` : `${localeService.t('permission.panel.iCanNotView')}`}</span>
+ <div className="univer-mt-2 univer-flex univer-items-center">
+ <span
+ className={`
+ univer-h-4 univer-flex-grow univer-text-xs univer-text-black
+ `}
+ >
+ {localeService.t('permission.panel.viewPermission')}
+ </span>
+ <span className="univer-h-4 univer-text-xs univer-text-black">{viewPermission ? `${localeService.t('permission.panel.iCanView')}` : `${localeService.t('permission.panel.iCanNotView')}`}</span>
</div>
{rule.description && (
<Tooltip title={rule.description}>
- <div className={styles.sheetPermissionListItemContentDesc}>
+ <div
+ className={`
+ univer-text-3 univer-max-w-64 univer-overflow-hidden
+ univer-text-ellipsis univer-whitespace-nowrap univer-text-gray-400
+ univer-mt-2]
+ `}
+ >
{rule.description}
</div>
</Tooltip>
@@ -332,16 +378,18 @@ export const SheetPermissionPanelList = () => {
</div>
)
: (
- <div className={styles.sheetPermissionListEmpty}>
+ <div
+ className="univer-flex univer-flex-1 univer-flex-col univer-items-center univer-justify-center"
+ >
<img width={240} height={120} src={panelListEmptyBase64} alt="" />
- <p className={styles.sheetPermissionListEmptyText}>{localeService.t('permission.dialog.listEmpty')}</p>
+ <p className="univer-w-60 univer-break-words univer-text-[13px] univer-text-gray-400">{localeService.t('permission.dialog.listEmpty')}</p>
</div>
)}
{hasSetProtectPermission && (
- <div className={styles.sheetPermissionPanelAddWrapper}>
+ <div className="univer-mt-auto univer-py-5">
<Button
- className={styles.sheetPermissionPanelAddButton}
+ className="univer-w-full"
variant="primary"
onClick={() => {
const sidebarProps = {
diff --git a/packages/sheets-ui/src/views/permission/permission-dialog/index.module.less b/packages/sheets-ui/src/views/permission/permission-dialog/index.module.less
deleted file mode 100644
index e8555f45bd..0000000000
--- a/packages/sheets-ui/src/views/permission/permission-dialog/index.module.less
+++ /dev/null
@@ -1,38 +0,0 @@
-.sheet-permission-dialog-wrapper {
- display: flex;
- flex-direction: column;
- padding: 2px;
-}
-
-.sheet-permission-dialog-split {
- height: 1px;
- background-color: rgb(var(--grey-200));
-}
-
-.sheet-permission-dialog-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 20px;
- line-height: 20px;
- margin: 6px 0;
-}
-
-.sheet-permission-user-dialog-footer {
- height: 36px;
- padding: var(--padding-xs) 0;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- margin-top: var(--margin-xs);
-
- &-confirm {
- margin-left: var(--margin-sm);
- }
-}
-
-.sheet-permission-user-dialog-button {
- height: 32px;
- line-height: 32px;
- padding: 0px var(--padding-base);
-}
diff --git a/packages/sheets-ui/src/views/permission/permission-dialog/index.tsx b/packages/sheets-ui/src/views/permission/permission-dialog/index.tsx
index 15b9d8ea23..3dcdf9b630 100644
--- a/packages/sheets-ui/src/views/permission/permission-dialog/index.tsx
+++ b/packages/sheets-ui/src/views/permission/permission-dialog/index.tsx
@@ -18,14 +18,13 @@ import type { Workbook } from '@univerjs/core';
import type { ICollaborator, UnitAction } from '@univerjs/protocol';
import { IAuthzIoService, ICommandService, IPermissionService, IUniverInstanceService, LocaleService, UniverInstanceType } from '@univerjs/core';
-import { Button, clsx, Switch } from '@univerjs/design';
+import { Button, Switch } from '@univerjs/design';
import { ObjectScope, UnitObject, UnitRole } from '@univerjs/protocol';
import { getAllWorksheetPermissionPoint, SetWorksheetPermissionPointsCommand, WorksheetProtectionPointModel } from '@univerjs/sheets';
import { IDialogService, useDependency } from '@univerjs/ui';
import { useEffect, useState } from 'react';
import { defaultWorksheetUnitActionList, subUnitPermissionTypeMap, UNIVER_SHEET_PERMISSION_DIALOG_ID } from '../../../consts/permission';
import Spin from '../spin';
-import styles from './index.module.less';
interface IPermissionMap {
[key: string]: {
@@ -176,13 +175,19 @@ export const SheetPermissionDialog = () => {
return (
<Spin loading={loading}>
- <div className={styles.sheetPermissionDialogWrapper}>
- <div className={styles.sheetPermissionDialogSplit} />
+ <div className="univer-flex univer-flex-col univer-p-2">
+ <div className="univer-h-px univer-bg-gray-200" />
{Object.keys(permissionMap).map((action) => {
const actionItem = permissionMap[action];
const { text, allowed } = actionItem;
return (
- <div key={text} className={styles.sheetPermissionDialogItem}>
+ <div
+ key={text}
+ className={`
+ univer-my-1.5 univer-flex univer-h-5 univer-items-center univer-justify-between
+ univer-leading-5
+ `}
+ >
<div>{text}</div>
<Switch
defaultChecked={allowed}
@@ -199,11 +204,10 @@ export const SheetPermissionDialog = () => {
</div>
);
})}
- <div className={styles.sheetPermissionDialogSplit} />
- <div className={styles.sheetPermissionUserDialogFooter}>
+ <div className="univer-h-px univer-bg-gray-200" />
+ <div className="univer-mt-2 univer-flex univer-h-9 univer-items-center univer-justify-end univer-gap-2">
<Button
- className={styles.sheetPermissionUserDialogButton}
onClick={() => {
dialogService.close(UNIVER_SHEET_PERMISSION_DIALOG_ID);
}}
@@ -216,7 +220,6 @@ export const SheetPermissionDialog = () => {
handleChangeActionPermission();
dialogService.close(UNIVER_SHEET_PERMISSION_DIALOG_ID);
}}
- className={clsx(styles.sheetPermissionUserDialogFooterConfirm, styles.sheetPermissionUserDialogButton)}
>
{localeService.t('permission.button.confirm')}
</Button>
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
deleted file mode 100644
index a1f0fea0fa..0000000000
--- a/packages/sheets-ui/src/views/permission/user-dialog/index.module.less
+++ /dev/null
@@ -1,46 +0,0 @@
-.sheet-permission-user-list {
- height: 240px;
- overflow-y: auto;
-}
-
-.sheet-permission-user-list-empty {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- height: 100%;
-}
-
-.sheet-permission-user-item {
- display: flex;
- align-items: center;
- margin: var(--margin-xs) 0;
- border-radius: 6px;
- padding: var(--padding-xs) var(--padding-sm);
-
- &:hover {
- background-color: rgb(var(--grey-50));
- }
-
- div {
- margin-left: 6px;
- }
-
- &-name {
- width: 186px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
-}
-
-.sheet-permission-split {
- height: 1px;
- background-color: rgb(var(--grey-200));
-}
-
-.sheet-permission-user-dialog-button {
- height: 28px;
- line-height: 28px;
- padding: 0px var(--padding-base);
-}
diff --git a/packages/sheets-ui/src/views/permission/user-dialog/index.tsx b/packages/sheets-ui/src/views/permission/user-dialog/index.tsx
index 3b00a7cef8..8794bd0530 100644
--- a/packages/sheets-ui/src/views/permission/user-dialog/index.tsx
+++ b/packages/sheets-ui/src/views/permission/user-dialog/index.tsx
@@ -16,7 +16,7 @@
import type { ICollaborator } from '@univerjs/protocol';
import { LocaleService } from '@univerjs/core';
-import { Avatar, Button, clsx, Input } from '@univerjs/design';
+import { Avatar, Button, Input } from '@univerjs/design';
import { CheckMarkSingle } from '@univerjs/icons';
import { UnitRole } from '@univerjs/protocol';
import { IDialogService, useDependency, useObservable } from '@univerjs/ui';
@@ -24,7 +24,6 @@ import { useState } from 'react';
import { UNIVER_SHEET_PERMISSION_USER_DIALOG_ID } from '../../../consts/permission';
import { SheetPermissionUserManagerService } from '../../../services/permission/sheet-permission-user-list.service';
import { UserEmptyBase64 } from './constant';
-import styles from './index.module.less';
export const SheetPermissionUserDialog = () => {
const [inputValue, setInputValue] = useState('');
@@ -50,7 +49,7 @@ export const SheetPermissionUserDialog = () => {
return (
<div>
- <div className={styles.sheetPermissionUserDialogSearch}>
+ <div>
<Input
className="univer-w-full"
placeholder={localeService.t('permission.dialog.search')}
@@ -58,7 +57,7 @@ export const SheetPermissionUserDialog = () => {
onChange={(v) => setInputValue(v)}
/>
</div>
- <div className={styles.sheetPermissionUserList}>
+ <div className="univer-h-60 univer-overflow-y-auto">
{searchUserList?.length > 0
? (
<>
@@ -66,11 +65,14 @@ export const SheetPermissionUserDialog = () => {
return (
<div
key={item.subject?.userID}
- className={styles.sheetPermissionUserItem}
+ className={`
+ univer-my-2 univer-flex univer-items-center univer-rounded-md
+ hover:univer-bg-gray-50
+ `}
onClick={() => handleChangeUser(item)}
>
<Avatar src={item.subject?.avatar} size={24} />
- <div className={styles.sheetPermissionUserItemName}>{item.subject?.name}</div>
+ <div className="univer-ml-1.5 univer-flex-1">{item.subject?.name}</div>
{selectUserInfo?.findIndex((v) => v.subject?.userID === item.subject?.userID) !== -1 && (<div><CheckMarkSingle /></div>)}
</div>
);
@@ -78,7 +80,7 @@ export const SheetPermissionUserDialog = () => {
</>
)
: (
- <div className={styles.sheetPermissionUserListEmpty}>
+ <div className="univer-flex univer-h-full univer-flex-col univer-items-center">
<img
className="univer-w-full"
src={UserEmptyBase64}
@@ -91,10 +93,9 @@ export const SheetPermissionUserDialog = () => {
</div>
)}
</div>
- <div className={styles.sheetPermissionSplit} />
- <div className="univer-flex univer-items-center univer-justify-end univer-gap-1 univer-py-1">
+ <div className="univer-h-px univer-w-full univer-bg-gray-200" />
+ <div className="univer-flex univer-items-center univer-justify-end univer-gap-1 univer-py-2">
<Button
- className={styles.sheetPermissionUserDialogButton}
onClick={() => dialogService.close(UNIVER_SHEET_PERMISSION_USER_DIALOG_ID)}
>
{localeService.t('permission.button.cancel')}
@@ -105,7 +106,6 @@ export const SheetPermissionUserDialog = () => {
sheetPermissionUserManagerService.setSelectUserList(selectUserInfo);
dialogService.close(UNIVER_SHEET_PERMISSION_USER_DIALOG_ID);
}}
- className={clsx(styles.sheetPermissionUserDialogFooterConfirm, styles.sheetPermissionUserDialogButton)}
>
{localeService.t('permission.button.confirm')}
</Button>