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: finish migrating
Wenzhao Hud8f223d4acaf
diff --git a/packages/sheets-data-validation-ui/src/views/components/item/index.module.less b/packages/sheets-data-validation-ui/src/views/components/item/index.module.lessdeleted file mode 100644index 99352f1316..0000000000--- a/packages/sheets-data-validation-ui/src/views/components/item/index.module.less+++ /dev/null@@ -1,56 +0,0 @@-.data-validation-item {- &-container {- border-radius: var(--border-radius-base);- background-color: rgba(var(--bg-color-secondary));- padding: var(--padding-sm);- padding-right: 36px;- margin-left: -8px;- margin-right: -8px;- box-sizing: border-box;- display: flex;- flex-direction: column;- justify-content: space-between;- cursor: pointer;- position: relative;- border-radius: 6px;- width: 287px;- overflow: hidden;- }-- &-container:hover {- background-color: rgba(var(--grey-50));- }-- &-title {- font-size: var(--font-size-sm);- color: rgba(var(--color-black));- line-height: 22px;- font-weight: 500;- overflow: hidden;- text-overflow: ellipsis;- }-- &-content {- color: rgba(var(--text-color-secondary));- font-size: var(--font-size-xs);- line-height: 18px;- overflow: hidden;- text-overflow: ellipsis;- }-- &-icon {- position: absolute;- top: 19px;- right: 8px;- width: 20px;- height: 20px;- display: flex;- justify-content: center;- align-items: center;- border-radius: 4px;- }-- &-icon:hover {- background: rgba(var(--grey-200));- }-}diff --git a/packages/sheets-data-validation-ui/src/views/components/item/index.tsx b/packages/sheets-data-validation-ui/src/views/components/item/index.tsxindex 5e1ad53013..b0215fa81a 100644--- a/packages/sheets-data-validation-ui/src/views/components/item/index.tsx+++ b/packages/sheets-data-validation-ui/src/views/components/item/index.tsx@@ -76,7 +76,7 @@ export const DataValidationItem = (props: IDataValidationDetailProps) => {`univer-rounded-md univer-bg-secondary univer-relative univer--ml-2 univer--mr-2 univer-box-borderuniver-flex univer-w-[287px] univer-cursor-pointer univer-flex-col univer-justify-between- univer-overflow-hidden univer-rounded-lg univer-p-2 univer-pr-9+ univer-overflow-hidden univer-p-2 univer-pr-9`,{'hover:univer-bg-gray-50': !disable,diff --git a/packages/sheets-ui/src/views/defined-name/DefinedNameContainer.tsx b/packages/sheets-ui/src/views/defined-name/DefinedNameContainer.tsxindex c7c558e773..1957c7c338 100644--- a/packages/sheets-ui/src/views/defined-name/DefinedNameContainer.tsx+++ b/packages/sheets-ui/src/views/defined-name/DefinedNameContainer.tsx@@ -21,11 +21,17 @@ import { ICommandService, IUniverInstanceService, LocaleService, Tools, UniverInimport { clsx, Confirm, Tooltip } from '@univerjs/design';import { IDefinedNamesService, serializeRangeWithSheet } from '@univerjs/engine-formula';import { CheckMarkSingle, DeleteSingle, IncreaseSingle } from '@univerjs/icons';-import { InsertDefinedNameCommand, RemoveDefinedNameCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SetDefinedNameCommand, SetWorksheetShowCommand, SheetsSelectionsService } from '@univerjs/sheets';+import {+ InsertDefinedNameCommand,+ RemoveDefinedNameCommand,+ SCOPE_WORKBOOK_VALUE_DEFINED_NAME,+ SetDefinedNameCommand,+ SetWorksheetShowCommand,+ SheetsSelectionsService,+} from '@univerjs/sheets';import { useDependency } from '@univerjs/ui';import { useEffect, useState } from 'react';import { DefinedNameInput } from './DefinedNameInput';-import styles from './index.module.less';export const DefinedNameContainer = () => {const commandService = useDependency(ICommandService);@@ -169,12 +175,23 @@ export const DefinedNameContainer = () => {};return (- <div className={styles.definedNameContainer}>- <div className={styles.definedNameContainerScroll}>+ <div className="univer-relative univer-w-full">+ <div className="univer-absolute univer-w-full univer-overflow-hidden univer-overflow-y-auto"><div key="insertDefinedName">- <div onClick={openInsertCloseKeyEditor} className={styles.definedNameContainerAddButton} style={{ display: editState ? 'none' : 'flex' }}>+ <div+ onClick={openInsertCloseKeyEditor}+ className={clsx(+ `+ univer-flex univer-h-10 univer-w-full univer-items-center univer-justify-center+ univer-border-0 univer-border-b univer-border-t univer-border-solid univer-border-gray-200+ univer-text-base univer-text-primary univer-cursor-pointer+ hover:univer-bg-gray-50+ `,+ { 'univer-hidden': editState }+ )}+ ><IncreaseSingle />- <span className={styles.definedNameContainerAddButtonText}>{localeService.t('definedName.addButton')}</span>+ <span className="univer-ml-1">{localeService.t('definedName.addButton')}</span></div>{editState && <DefinedNameInput confirm={insertConfirm} cancel={closeInput} state={editState} inputId="insertDefinedName" name={getInsertDefinedName()} formulaOrRefString={getInertFormulaOrRefString()} />}</div>@@ -182,23 +199,74 @@ export const DefinedNameContainer = () => {{definedNames.map((definedName, index) => {return (<div key={index}>- <div onClick={() => { focusDefinedName(definedName); }} className={styles.definedNameContainerItem} style={{ display: definedName.id === editorKey ? 'none' : 'flex' }}>+ <div+ onClick={() => { focusDefinedName(definedName); }}+ className={clsx(+ 'univer-relative univer-flex univer-items-center univer-justify-between univer-p-2',+ 'univer-border-0 univer-border-b univer-border-solid univer-border-gray-200',+ `+ univer-cursor-default univer-select-none+ hover:univer-bg-gray-50+ `,+ { 'univer-hidden': definedName.id === editorKey }+ )}+ ><div title={definedName.comment}>- <div className={styles.definedNameContainerItemName}>+ <div+ className={`+ univer-my-1 univer-max-h-[100px] univer-max-w-[190px] univer-overflow-hidden+ univer-text-sm univer-font-medium univer-text-black+ `}+ >{definedName.name}- <span className={styles.definedNameContainerItemNameForSheet}>+ <span+ className={`+ univer-text-xxs univer-ml-1 univer-font-normal univer-text-gray-400+ `}+ >{(definedName.localSheetId === SCOPE_WORKBOOK_VALUE_DEFINED_NAME || definedName.localSheetId == null) ? '' : getSheetNameBySheetId(definedName.localSheetId)}</span></div>- <div className={styles.definedNameContainerItemFormulaOrRefString}>{definedName.formulaOrRefString}</div>+ <div+ className={`+ univer-m-[5px_0] univer-max-h-[100px] univer-overflow-hidden+ univer-text-ellipsis univer-text-xs univer-font-normal univer-text-gray-500+ `}+ >+ {definedName.formulaOrRefString}+ </div></div><Tooltip title={localeService.t('definedName.updateButton')} placement="top">- <div className={clsx(styles.definedNameContainerItemUpdate, styles.definedNameContainerItemShow)} onClick={() => { closeInsertOpenKeyEditor(definedName.id); }}>+ <div+ className={`+ univer-absolute univer-text-xs univer-text-primary univer-right-[60px]+ univer-top-5 univer-hidden univer-translate-y-[-50%] univer-cursor-pointer+ univer-rounded univer-p-1+ group-hover:univer-block+ hover:univer-bg-hyacinth-50+ `}+ onClick={(e) => {+ e.stopPropagation();+ closeInsertOpenKeyEditor(definedName.id);+ }}+ ><CheckMarkSingle /></div></Tooltip><Tooltip title={localeService.t('definedName.deleteButton')} placement="top">- <div className={clsx(styles.definedNameContainerItemDelete, styles.definedNameContainerItemShow)} onClick={() => { deleteDefinedName(definedName.id); }}>+ <div+ className={`+ univer-absolute univer-text-xs univer-text-error univer-right-5 univer-top-5+ univer-hidden -univer-translate-y-1/2 univer-cursor-pointer univer-rounded+ univer-p-1+ group-hover:univer-block+ hover:univer-bg-hyacinth-50+ `}+ onClick={(e) => {+ e.stopPropagation();+ deleteDefinedName(definedName.id);+ }}+ ><DeleteSingle /></div></Tooltip>@@ -225,7 +293,6 @@ export const DefinedNameContainer = () => {localSheetId={definedName.localSheetId}/>)}-</div>);})}diff --git a/packages/sheets-ui/src/views/defined-name/DefinedNameInput.tsx b/packages/sheets-ui/src/views/defined-name/DefinedNameInput.tsxindex e9a62a6821..8bb3efd989 100644--- a/packages/sheets-ui/src/views/defined-name/DefinedNameInput.tsx+++ b/packages/sheets-ui/src/views/defined-name/DefinedNameInput.tsx@@ -243,22 +243,31 @@ export const DefinedNameInput = (props: IDefinedNameInputProps) => {)): (FormulaEditor && (- <FormulaEditor- initValue={formulaOrRefStringValue as any}- unitId={unitId}- subUnitId={subUnitId}- isFocus={isFocusFormulaEditor}- isSupportAcrossSheet- onChange={(v = '') => {- const formula = v || '';- formulaEditorChange(formula);- }}- onVerify={(res: boolean) => {- setValidFormulaOrRange(res);- }}- onFocus={() => isFocusFormulaEditorSet(true)}- ref={formulaEditorRef}- />+ <div+ className={`+ univer-relative univer-mt-4 univer-h-full univer-rounded univer-border univer-border-solid+ univer-border-gray-200 univer-px-[6px] univer-transition-all univer-duration-150+ `}+ >+ <div className="univer-relative univer-h-[30px] univer-w-[95%] univer-select-none">+ <FormulaEditor+ initValue={formulaOrRefStringValue as any}+ unitId={unitId}+ subUnitId={subUnitId}+ isFocus={isFocusFormulaEditor}+ isSupportAcrossSheet+ onChange={(v = '') => {+ const formula = v || '';+ formulaEditorChange(formula);+ }}+ onVerify={(res: boolean) => {+ setValidFormulaOrRange(res);+ }}+ onFocus={() => isFocusFormulaEditorSet(true)}+ ref={formulaEditorRef}+ />+ </div>+ </div>))}<div><Selectdiff --git a/packages/sheets-ui/src/views/defined-name/index.module.less b/packages/sheets-ui/src/views/defined-name/index.module.lessdeleted file mode 100644index d3cdefd0cd..0000000000--- a/packages/sheets-ui/src/views/defined-name/index.module.less+++ /dev/null@@ -1,230 +0,0 @@-.defined-name {- &-overlay {- position: relative;- width: 300px;- background-color: rgb(var(--color-white));-- &-container {- position: relative;- height: 100%;- max-height: 400px;- width: 100%;- overflow: hidden;- overflow-y: auto;- scrollbar-color: rgba(var(--scrollbar-color), 0.7) transparent;- scrollbar-gutter: auto;- scrollbar-width: thin;- }-- &-item {- display: flex;- align-items: center;- justify-content: space-between;- padding: var(--padding-xs);- border-bottom: 1px solid rgb(var(--border-color));- user-select: none;- cursor: pointer;-- &:hover {- background-color: rgb(var(--grey-50));- }-- &-name {- font-size: var(--font-size-md);- color: rgb(var(--grey-900));- margin: 5px 0px;- overflow: hidden;- text-overflow: ellipsis;- flex: 1;-- &-for-sheet {- font-size: var(--font-size-xxs);- color: rgb(var(--grey-400));- margin-left: 5px;- font-weight: normal;- }- }-- &-formula {- font-size: var(--font-size-xs);- color: rgb(var(--grey-800));- margin: 5px 0px;- white-space: nowrap;- overflow: hidden;- text-overflow: ellipsis;- flex: 1;- }- }-- &-manager {- // position: absolute;- display: flex;- flex-direction: column;- overflow-y: auto;- width: 100%;- cursor: pointer;- overflow: hidden;- background-color: rgb(var(--color-white));-- &:hover {- background-color: rgb(var(--grey-50));- }-- &-title {- font-size: var(--font-size-xs);- font-weight: bold;- margin: var(--margin-xs);- margin-bottom: 0;- color: rgb(var(--grey-800));- }-- &-content {- font-size: var(--font-size-xxs);- margin: var(--margin-xs);- color: rgb(var(--grey-500));- }- }- }-- &-container {- width: 100%;- position: relative;-- &-scroll {- width: 100%;- overflow: hidden;- overflow-y: auto;- position: absolute;- }-- &-addButton {- display: flex;- align-items: center;- justify-content: center;- width: 100%;- height: 40px;- border-top: 1px solid rgb(var(--border-color));- border-bottom: 1px solid rgb(var(--border-color));- font-size: var(--font-size-md);-- color: rgb(var(--primary-color));-- &:hover {- background-color: rgb(var(--grey-50));- cursor: pointer;- }-- &-text {- margin-left: 5px;- }- }-- &-item {- position: relative;- display: flex;- align-items: center;- justify-content: space-between;- padding: var(--padding-xs);- border-bottom: 1px solid rgb(var(--border-color));- user-select: none;- cursor: default;-- &-name {- font-size: var(--font-size-sm);- font-weight: 500;- color: rgb(var(--color-black));- margin: 5px 0px;- max-width: 190px;- max-height: 100px;- overflow: hidden;-- &-for-sheet {- font-size: var(--font-size-xxs);- color: rgb(var(--grey-400));- margin-left: 5px;- font-weight: normal;- }- }-- &-formula-or-refString {- font-size: var(--font-size-xs);- color: rgb(var(--grey-500));- font-weight: 400;- margin: 5px 0px;- max-height: 100px;- text-overflow: ellipsis;- overflow: hidden;- }-- &-update {- position: absolute;- font-size: var(--font-size-xs);- color: rgb(var(--primary-color));- cursor: pointer;- padding: 4px;-- &:hover {- background-color: rgb(var(--hyacinth-50));- }-- transform: translate(0, -50%);- border-radius: var(--border-radius-base);- right: 60px;- top: 20px;- }-- &-delete {- position: absolute;- font-size: var(--font-size-xs);- color: rgb(var(--error-color));- cursor: pointer;- padding: 4px;- right: 20px;- top: 20px;- transform: translate(0, -50%);- border-radius: var(--border-radius-base);-- &:hover {- background-color: rgb(var(--hyacinth-50));- }- }-- &-show {- display: none;- }-- &:hover {- background-color: rgb(var(--grey-50));-- .defined-name-container-item-show {- display: block;- }- }- }- }-- &-input {- // univer-defined-name-input- &-formula-selector-text-wrap {- margin-top: 16px;- height: 100%;- position: relative;- padding: 0 0 0 6px;- border: 1px solid rgb(var(--border-color));- transition: all 0.15s;- border-radius: var(--border-radius-base);- }-- &-text-editor-container {- position: relative;- width: 95%;- height: 30px;- user-select: none;- }-- &-disable {- color: rgb(var(--grey-200));- cursor: not-allowed;- }- }-}diff --git a/packages/sheets-ui/src/views/dropdown/date-dropdown/index.module.less b/packages/sheets-ui/src/views/dropdown/date-dropdown/index.module.lessdeleted file mode 100644index 318ee25934..0000000000--- a/packages/sheets-ui/src/views/dropdown/date-dropdown/index.module.less+++ /dev/null@@ -1,13 +0,0 @@-.dv-date-dropdown {- background: #fff;- border-radius: var(--border-radius-base);- box-shadow: var(--box-shadow-lg);- padding: var(--padding-sm);-}--.dv-date-dropdown-btns {- display: flex;- justify-content: flex-end;- border-top: 1px solid rgb(var(--border-color));- padding-top: var(--padding-sm);-}diff --git a/packages/sheets-ui/src/views/dropdown/date-dropdown/index.tsx b/packages/sheets-ui/src/views/dropdown/date-dropdown/index.tsxindex 35b1acf572..4ab9987a1a 100644--- a/packages/sheets-ui/src/views/dropdown/date-dropdown/index.tsx+++ b/packages/sheets-ui/src/views/dropdown/date-dropdown/index.tsx@@ -20,7 +20,6 @@ import { dayjs, LocaleService, numfmt } from '@univerjs/core';import { Button, DatePanel } from '@univerjs/design';import { useDependency } from '@univerjs/ui';import { useMemo, useState } from 'react';-import styles from './index.module.less';export interface IDateDropdownProps {defaultValue?: dayjs.Dayjs;@@ -47,7 +46,12 @@ export function DateDropdown(props: { popup: IPopup<IDateDropdownProps & IBaseDr};return (- <div className={styles.dvDateDropdown}>+ <div+ className={`+ univer-rounded univer-bg-white univer-p-2 univer-shadow-lg+ dark:univer-bg-black+ `}+ ><DatePanelvalue={date}pickerValue={date}@@ -61,7 +65,13 @@ export function DateDropdown(props: { popup: IPopup<IDateDropdownProps & IBaseDr}}disabledDate={(current) => !numfmt.parseDate(current.format('YYYY-MM-DD'))}/>- <div className={styles.dvDateDropdownBtns}>+ <div+ className={`+ univer-flex univer-justify-end univer-border-0 univer-border-t univer-border-solid+ univer-border-t-gray-200 univer-pt-2+ dark:univer-border-t-gray-700+ `}+ ><Button size="small" variant="primary" onClick={handleSave} disabled={!date || !date.isValid()}>{localeService.t('dataValidation.alert.ok')}</Button>diff --git a/packages/sheets-ui/src/views/dropdown/list-dropdown/index.module.less b/packages/sheets-ui/src/views/dropdown/list-dropdown/index.module.lessdeleted file mode 100644index 03916e5e6f..0000000000--- a/packages/sheets-ui/src/views/dropdown/list-dropdown/index.module.less+++ /dev/null@@ -1,84 +0,0 @@-.dv-list-dropdown {- border-radius: var(--border-radius-lg);- border: 1px solid rgb(var(--border-color));- background: rgba(var(--color-white));- box-shadow: var(--box-shadow-base);- box-sizing: border-box;- padding-bottom: var(--padding-xs);-- &-title {- padding: var(--padding-sm) 14px;- color: rgb(var(--text-color));- font-size: 12px;- line-height: 1.5;- flex-shrink: 0;- flex-grow: 0;- }-- &-selected-icon {- width: 16px;- height: 16px;- font-size: 16px;- color: rgba(var(--blue-500));- flex-shrink: 0;- flex-grow: 0;- margin-left: 12px;- }-- &-item-container {- display: flex;- flex-direction: row;- align-items: center;- justify-content: space-between;- padding: var(--padding-xs) 6px;- border-radius: 6px;- margin-top: 4px;- cursor: pointer;- }-- &-item-container:hover {- background-color: rgba(var(--grey-50));- }-- &-item {- padding: 0 4px;- font-size: 12px;- font-style: normal;- font-weight: 400;- line-height: 16px;- border-radius: 8px;- height: 16px;- width: fit-content;- flex: 0 1 auto;- text-overflow: ellipsis;- overflow: hidden;- color: rgba(var(--color-black));- white-space: nowrap;- }-- &-split {- height: 1px;- margin: 4px 0;- background: rgba(var(--grey-200));- flex-shrink: 0;- flex-grow: 0;- }-- &-edit {- padding: 0 var(--padding-xs);- flex-shrink: 0;- flex-grow: 0;-- a {- padding: 3px 6px;- font-size: 12px;- line-height: 1.5;- cursor: pointer;- border-radius: 6px;- display: block;- &:hover {- background: #f5f5f5;- }- }- }-}diff --git a/packages/sheets-ui/src/views/dropdown/list-dropdown/index.tsx b/packages/sheets-ui/src/views/dropdown/list-dropdown/index.tsxindex 4de15ce56e..b9e05b6dcd 100644--- a/packages/sheets-ui/src/views/dropdown/list-dropdown/index.tsx+++ b/packages/sheets-ui/src/views/dropdown/list-dropdown/index.tsx@@ -27,7 +27,6 @@ import { RangeProtectionPermissionEditPoint, SheetPermissionCheckController, Worimport { RectPopup, useDependency } from '@univerjs/ui';import React, { useEffect, useMemo, useState } from 'react';import { IEditorBridgeService } from '../../../services/editor-bridge.service';-import styles from './index.module.less';function serializeListOptions(options: string[]) {return options.filter(Boolean).join(',');@@ -51,7 +50,7 @@ interface ISelectListProps {}const SelectList = (props: ISelectListProps) => {- const { value, onChange, multiple, options, title, onEdit, style, filter, location, showEdit: showEditOnDropdown } = props;+ const { value, onChange, multiple, options, title, onEdit, filter, style, location, showEdit: showEditOnDropdown } = props;const localeService = useDependency(LocaleService);const lowerFilter = filter?.toLowerCase();const { row, col, unitId, subUnitId } = location;@@ -69,8 +68,18 @@ const SelectList = (props: ISelectListProps) => {), [sheetPermissionCheckController, col, row, unitId, subUnitId]);return (- <div className={styles.dvListDropdown} style={style}>- <div className={styles.dvListDropdownTitle}>+ <div+ data-u-comp="select-list"+ className={`+ univer-box-border univer-rounded-lg univer-border univer-border-solid univer-border-gray-200+ univer-bg-white univer-pb-1 univer-text-black univer-shadow+ dark:univer-border-gray-700 dark:univer-bg-black dark:univer-text-white+ `}+ style={style}+ >+ <div+ className="univer-flex-shrink-0 univer-flex-grow-0 univer-px-[14px] univer-py-2 univer-text-xs"+ >{title}</div><div@@ -98,8 +107,24 @@ const SelectList = (props: ISelectListProps) => {const index = item.label.toLocaleLowerCase().indexOf(lowerFilter!);return (- <div key={i} className={styles.dvListDropdownItemContainer} onClick={handleClick}>- <div className={styles.dvListDropdownItem} style={{ background: item.color }}>+ <div+ key={i}+ className={`+ univer-mt-1 univer-flex univer-cursor-pointer univer-flex-row univer-items-center+ univer-justify-between univer-rounded-md univer-px-1.5 univer-py-1+ dark:hover:univer-bg-gray-700+ hover:univer-bg-gray-50+ `}+ onClick={handleClick}+ >+ <div+ className={`+ univer-h-4 univer-w-fit univer-flex-[0_1_auto] univer-overflow-hidden univer-truncate+ univer-whitespace-nowrap univer-rounded-[8px] univer-px-1 univer-py-0 univer-text-xs+ univer-font-normal+ `}+ style={{ background: item.color }}+ >{lowerFilter && item.label.toLowerCase().includes(lowerFilter)? (<>@@ -110,7 +135,12 @@ const SelectList = (props: ISelectListProps) => {): item.label}</div>- <div className={styles.dvListDropdownSelectedIcon}>+ <div+ className={`+ univer-ml-3 univer-h-4 univer-w-4 univer-flex-shrink-0 univer-flex-grow-0+ univer-text-base univer-text-primary-500+ `}+ >{selected ? <CheckMarkSingle /> : null}</div></div>@@ -120,9 +150,26 @@ const SelectList = (props: ISelectListProps) => {{showEditOnDropdown && hasPermission? (<>- <div className={styles.dvListDropdownSplit} />- <div className={styles.dvListDropdownEdit}>- <a onClick={onEdit}>{localeService.t('dataValidation.list.edit')}</a>+ <div+ className={`+ univer-my-1 univer-h-[1px] univer-flex-shrink-0 univer-flex-grow-0 univer-bg-gray-200+ dark:univer-bg-gray-700+ `}+ />+ <div+ className="univer-flex-shrink-0 univer-flex-grow-0 univer-px-1 univer-py-0"+ >+ <a+ className={`+ univer-block univer-cursor-pointer univer-rounded univer-px-1.5 univer-py-1+ univer-text-xs+ dark:hover:univer-bg-gray-700+ hover:univer-bg-gray-200+ `}+ onClick={onEdit}+ >+ {localeService.t('dataValidation.list.edit')}+ </a></div></>)