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
refactor(design): remove react-grid-layout for DraggableList (#6632)
白熱d1e58da12fd5
diff --git a/packages/design/package.json b/packages/design/package.jsonindex 384c93c81c..dae0969fd9 100644--- a/packages/design/package.json+++ b/packages/design/package.json@@ -75,13 +75,11 @@"@radix-ui/react-separator": "^1.1.8","@radix-ui/react-slot": "^1.2.4","@univerjs/icons": "^1.1.1",- "@univerjs/themes": "workspace:*","class-variance-authority": "^0.7.1","clsx": "^2.1.1","dayjs": "^1.11.19","rc-dropdown": "^4.2.1","rc-menu": "^9.16.0",- "react-grid-layout": "^1.5.1","react-transition-group": "^4.4.5","sonner": "^2.0.7","tailwind-merge": "2.6.0"@@ -89,7 +87,6 @@"devDependencies": {"@testing-library/jest-dom": "6.9.1","@testing-library/react": "^16.3.2",- "@types/react-grid-layout": "^1.3.6","@types/react-transition-group": "^4.4.12","@univerjs-infra/shared": "workspace:*","@univerjs/core": "workspace:*",diff --git a/packages/design/src/components/draggable-list/DraggableList.tsx b/packages/design/src/components/draggable-list/DraggableList.tsxindex 181458ff1b..5df4cbe7f9 100644--- a/packages/design/src/components/draggable-list/DraggableList.tsx+++ b/packages/design/src/components/draggable-list/DraggableList.tsx@@ -14,61 +14,268 @@* limitations under the License.*/-import type { ReactNode } from 'react';-import type { Layout, ReactGridLayoutProps } from 'react-grid-layout';-import { useMemo } from 'react';-import RGL, { WidthProvider } from 'react-grid-layout';-import 'react-grid-layout/css/styles.css';+import type { CSSProperties, HTMLAttributes, PointerEvent, ReactNode } from 'react';+import { useEffect, useMemo, useRef, useState } from 'react';+import { createPortal } from 'react-dom';+import { clsx } from '../../helper/clsx';-export const ReactGridLayout = WidthProvider(RGL);+interface IDragPosition {+ y: number;+}++interface IDraggableListDragCallbacks {+ onDragStart?: (layout: unknown, from: IDragPosition) => void;+ onDragStop?: (layout: unknown, from: IDragPosition, to: IDragPosition) => void;+}-export interface IDraggableListProps<T> extends Omit<ReactGridLayoutProps, 'layout' | 'onLayoutChange' | 'cols' | 'isResizable'> {+export interface IDraggableListProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, 'onDragStart'>, IDraggableListDragCallbacks {list: T[];onListChange: (list: T[]) => void;idKey: keyof T;itemRender: (item: T, index: number) => ReactNode;+ draggableHandle?: string;+ rowHeight?: number;+ margin?: [number, number];+}++function moveItemByIndex<T>(list: T[], fromIndex: number, toIndex: number) {+ if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= list.length || toIndex >= list.length) {+ return list;+ }+ const next = [...list];+ const [item] = next.splice(fromIndex, 1);+ next.splice(toIndex, 0, item);+ return next;}export function DraggableList<T = any>(props: IDraggableListProps<T>) {- const { list, onListChange, idKey, itemRender, ...gridProps } = props;-- const listMap = useMemo(() => {- const listMap = new Map<unknown, T>();- list.forEach((item: T) => {- const key = item[idKey];- listMap.set(key, item);- });- return listMap;- }, [idKey, list]);-- const layouts: Layout[] = useMemo(() => {- return list.map((item, index) => ({- i: item[idKey] as string,- w: 12,- h: 1,- x: 0,- y: index,- col: 12,- }));- }, [idKey, list]);+ const {+ list,+ onListChange,+ idKey,+ itemRender,+ className,+ style,+ draggableHandle,+ rowHeight,+ margin = [0, 0],+ onDragStart,+ onDragStop,+ ...restProps+ } = props;++ const [displayList, setDisplayList] = useState(list);+ const displayListRef = useRef(list);+ const [draggingId, setDraggingId] = useState<string | null>(null);+ const [dragOverId, setDragOverId] = useState<string | null>(null);+ const [ghostMarkup, setGhostMarkup] = useState<string | null>(null);+ const [ghostPosition, setGhostPosition] = useState<{ x: number; y: number } | null>(null);+ const [canUsePortal, setCanUsePortal] = useState(false);+ const pointerIdRef = useRef<number | null>(null);+ const dragPointerOffsetRef = useRef({ x: 0, y: 0 });+ const dragItemSizeRef = useRef({ width: 0, height: 0 });++ const pressedHandleIdRef = useRef<string | null>(null);+ const dragSourceIdRef = useRef<string | null>(null);+ const dragStartIndexRef = useRef(-1);++ useEffect(() => {+ if (!draggingId) {+ setDisplayList(list);+ displayListRef.current = list;+ }+ }, [draggingId, list]);++ useEffect(() => {+ setCanUsePortal(typeof document !== 'undefined');+ }, []);++ useEffect(() => {+ if (!draggingId) {+ return;+ }++ const handlePointerMove = (evt: PointerEvent | globalThis.PointerEvent) => {+ const sourceId = dragSourceIdRef.current;+ if (!sourceId || pointerIdRef.current !== evt.pointerId) {+ return;+ }+ setGhostPosition({+ x: evt.clientX - dragPointerOffsetRef.current.x,+ y: evt.clientY - dragPointerOffsetRef.current.y,+ });++ const element = document.elementFromPoint(evt.clientX, evt.clientY);+ const itemElement = element?.closest('[data-draggable-list-item-id]') as HTMLElement | null;+ const targetId = itemElement?.dataset.draggableListItemId;+ if (!targetId || targetId === sourceId) {+ return;+ }+ setDragOverId(targetId);++ setDisplayList((prev) => {+ const fromIndex = prev.findIndex((it) => getItemId(it) === sourceId);+ const toIndex = prev.findIndex((it) => getItemId(it) === targetId);+ if (fromIndex < 0 || toIndex < 0 || fromIndex === toIndex) {+ return prev;+ }+ const next = moveItemByIndex(prev, fromIndex, toIndex);+ displayListRef.current = next;+ return next;+ });+ };++ const handlePointerUp = (evt: globalThis.PointerEvent) => {+ if (pointerIdRef.current !== evt.pointerId) {+ return;+ }+ const sourceId = dragSourceIdRef.current;+ const startIndex = dragStartIndexRef.current;+ const currentList = displayListRef.current;+ if (sourceId) {+ const finalIndex = currentList.findIndex((it) => getItemId(it) === sourceId);+ onDragStop?.(undefined, { y: startIndex }, { y: finalIndex });+ if (startIndex >= 0) {+ onListChange([...currentList]);+ }+ }++ pointerIdRef.current = null;+ pressedHandleIdRef.current = null;+ dragSourceIdRef.current = null;+ dragStartIndexRef.current = -1;+ setDragOverId(null);+ setGhostMarkup(null);+ setGhostPosition(null);+ setDraggingId(null);+ };++ window.addEventListener('pointermove', handlePointerMove as any);+ window.addEventListener('pointerup', handlePointerUp);+ window.addEventListener('pointercancel', handlePointerUp);++ return () => {+ window.removeEventListener('pointermove', handlePointerMove as any);+ window.removeEventListener('pointerup', handlePointerUp);+ window.removeEventListener('pointercancel', handlePointerUp);+ };+ }, [draggingId, onDragStop, onListChange]);++ const gapStyle: CSSProperties = useMemo(() => {+ const [horizontal, vertical] = margin;+ return {+ rowGap: `${vertical}px`,+ paddingLeft: horizontal ? `${horizontal}px` : undefined,+ paddingRight: horizontal ? `${horizontal}px` : undefined,+ ...style,+ };+ }, [margin, style]);++ const getItemId = (item: T) => String(item[idKey]);+ const draggingItem = draggingId ? displayList.find((item) => getItemId(item) === draggingId) : null;return (- <ReactGridLayout- {...gridProps}- cols={12}- preventCollision={false}- isResizable={false}- isDraggable- onLayoutChange={(layout) => {- const newList = layout.sort((prev, aft) => prev.y - aft.y).map((item) => listMap.get(item.i)!);- onListChange(newList);- }}- >- {layouts.map((item, index) => (- <div key={item.i} data-grid={item}>- {itemRender(listMap.get(item.i)!, index)}+ <>+ <div+ {...restProps}+ className={clsx('univer-flex univer-flex-col', draggingId && 'univer-cursor-grabbing univer-select-none', className)}+ style={gapStyle}+ >+ {displayList.map((item, index) => {+ const itemId = getItemId(item);+ const isDraggingItem = draggingId === itemId;+ const isDragOverItem = dragOverId === itemId && !isDraggingItem;++ return (+ <div+ key={itemId}+ data-draggable-list-item-id={itemId}+ className={clsx(+ 'univer-relative univer-transition-all univer-duration-150',+ isDraggingItem && 'univer-opacity-0',+ isDragOverItem && `+ univer-bg-primary-50/60+ dark:!univer-bg-primary-900/20+ univer-rounded univer-border univer-border-primary-200+ dark:!univer-border-primary-700+ `+ )}+ onPointerDownCapture={(e: PointerEvent<HTMLDivElement>) => {+ if (pointerIdRef.current !== null) {+ return;+ }+ if (!draggableHandle) {+ pressedHandleIdRef.current = itemId;+ } else {+ const target = e.target as HTMLElement;+ const isMatched = !!target.closest(draggableHandle);+ pressedHandleIdRef.current = isMatched ? itemId : null;+ }+ if (pressedHandleIdRef.current !== itemId) {+ return;+ }++ const rect = (e.currentTarget as HTMLDivElement).getBoundingClientRect();+ dragPointerOffsetRef.current = {+ x: e.clientX - rect.left,+ y: e.clientY - rect.top,+ };+ dragItemSizeRef.current = {+ width: rect.width,+ height: rect.height,+ };+ setGhostPosition({ x: rect.left, y: rect.top });+ setGhostMarkup((e.currentTarget as HTMLDivElement).innerHTML);++ pointerIdRef.current = e.pointerId;+ dragSourceIdRef.current = itemId;+ dragStartIndexRef.current = index;+ setDraggingId(itemId);+ displayListRef.current = displayList;+ onDragStart?.(undefined, { y: index });+ e.preventDefault();+ (e.currentTarget as HTMLDivElement).setPointerCapture(e.pointerId);+ }}+ style={{+ ...(rowHeight ? { minHeight: `${rowHeight}px` } : undefined),+ cursor: draggingId ? 'grabbing' : undefined,+ }}+ >+ {isDraggingItem && (+ <div+ className="+ univer-bg-primary-50/50 univer-absolute univer-inset-0 univer-rounded+ univer-border univer-border-dashed univer-border-primary-300+ "+ />+ )}+ {itemRender(item, index)}+ </div>+ );+ })}+ </div>+ {canUsePortal && draggingItem && ghostPosition && createPortal((+ <div+ className={clsx(`+ univer-pointer-events-none univer-fixed univer-rounded-md univer-border univer-border-gray-200+ univer-bg-white univer-shadow-lg+ dark:!univer-border-gray-700 dark:!univer-bg-gray-800+ `)}+ style={{+ zIndex: 2147483647,+ left: `${ghostPosition.x}px`,+ top: `${ghostPosition.y}px`,+ width: `${dragItemSizeRef.current.width}px`,+ height: `${dragItemSizeRef.current.height}px`,+ opacity: 0.95,+ }}+ >+ {ghostMarkup+ ? <div dangerouslySetInnerHTML={{ __html: ghostMarkup }} />+ : itemRender(draggingItem, displayList.findIndex((item) => getItemId(item) === getItemId(draggingItem)))}</div>- ))}- </ReactGridLayout>+ ), document.body+ )}+ </>);}diff --git a/packages/design/src/components/draggable-list/index.ts b/packages/design/src/components/draggable-list/index.tsindex d449bf9a53..a3416a02b3 100644--- a/packages/design/src/components/draggable-list/index.ts+++ b/packages/design/src/components/draggable-list/index.ts@@ -14,5 +14,5 @@* limitations under the License.*/-export { DraggableList, ReactGridLayout } from './DraggableList';+export { DraggableList } from './DraggableList';export type { IDraggableListProps } from './DraggableList';diff --git a/packages/design/src/index.ts b/packages/design/src/index.tsindex 7fecd149e6..20a342b98a 100644--- a/packages/design/src/index.ts+++ b/packages/design/src/index.ts@@ -31,7 +31,7 @@ export { Confirm, type IConfirmProps } from './components/confirm/Confirm';export { DatePicker } from './components/date-picker/DatePicker';export { DateRangePicker } from './components/date-range-picker';export { Dialog, type IDialogProps } from './components/dialog/Dialog';-export { DraggableList, type IDraggableListProps, ReactGridLayout } from './components/draggable-list';+export { DraggableList, type IDraggableListProps } from './components/draggable-list';export { DropdownMenu, type IDropdownMenuProps } from './components/dropdown-menu/DropdownMenu';export { Dropdown, type IDropdownProps } from './components/dropdown/Dropdown';export { FormDualColumnLayout, FormLayout, type IFormDualColumnLayoutProps, type IFormLayoutProps } from './components/form-layout';@@ -82,6 +82,3 @@ export { clsx } from './helper/clsx';export { isBrowser } from './helper/is-browser';export { render, unmount } from './helper/react-dom';export { resizeObserverCtor } from './helper/resize-observer';--/** @deprecated Only for compatibility with versions before 0.7.0, will be removed in future versions */-export { defaultTheme, greenTheme } from '@univerjs/themes';diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsxindex 225a87da55..f079e73917 100644--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsx+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsx@@ -17,7 +17,7 @@import type { IRange, Workbook } from '@univerjs/core';import type { IConditionFormattingRule, IDeleteCfCommandParams, IMoveCfCommandParams } from '@univerjs/sheets-conditional-formatting';import { ICommandService, Injector, IUniverInstanceService, LocaleService, Rectangle, UniverInstanceType } from '@univerjs/core';-import { clsx, ReactGridLayout, Select, Tooltip } from '@univerjs/design';+import { clsx, DraggableList, Select, Tooltip } from '@univerjs/design';import { serializeRange } from '@univerjs/engine-formula';import { DeleteIcon, IncreaseIcon, SequenceIcon } from '@univerjs/icons';import { checkRangesEditablePermission, SetSelectionsOperation, SetWorksheetActiveOperation, SheetsSelectionsService } from '@univerjs/sheets';@@ -34,8 +34,8 @@ import {SetConditionalRuleMutation,} from '@univerjs/sheets-conditional-formatting';import { useHighlightRange } from '@univerjs/sheets-ui';-import { ISidebarService, useDependency, useObservable } from '@univerjs/ui';-import { useEffect, useMemo, useRef, useState } from 'react';+import { useDependency, useObservable } from '@univerjs/ui';+import { useEffect, useMemo, useState } from 'react';import { debounceTime, Observable } from 'rxjs';import { ConditionalFormattingI18nController } from '../../../controllers/cf.i18n.controller';import { Preview } from '../../preview';@@ -104,7 +104,6 @@ const getRuleDescribe = (rule: IConditionFormattingRule, localeService: LocaleSe}};-let defaultWidth = 0;export const RuleList = (props: IRuleListProps) => {const { onClick } = props;const conditionalFormattingRuleModel = useDependency(ConditionalFormattingRuleModel);@@ -113,7 +112,6 @@ export const RuleList = (props: IRuleListProps) => {const commandService = useDependency(ICommandService);const localeService = useDependency(LocaleService);const injector = useDependency(Injector);- const sidebarService = useDependency(ISidebarService);const conditionalFormattingI18nController = useDependency(ConditionalFormattingI18nController);@@ -129,9 +127,7 @@ export const RuleList = (props: IRuleListProps) => {const [currentRuleRanges, setCurrentRuleRanges] = useState<IRange[]>([]);const [selectValue, setSelectValue] = useState('2');const [fetchRuleListId, setFetchRuleListId] = useState(0);- const [draggingId, setDraggingId] = useState<number>(-1);- const [layoutWidth, setLayoutWidth] = useState(defaultWidth);- const layoutContainerRef = useRef<HTMLDivElement>(null);+ const [draggingId, setDraggingId] = useState<string>('');const selectOption = [{ label: localeService.t('sheet.cf.panel.workSheet'), value: '2' },@@ -206,46 +202,6 @@ export const RuleList = (props: IRuleListProps) => {return () => dispose.unsubscribe();}, [conditionalFormattingRuleModel]);- useEffect(() => {- // Because univer-sidebar contains animations, accurate width values can not be obtained in real time。- // Also set a global width as the default width to avoid a gap before the first calculation.- const getWidth = () => {- // 8 is padding-left- const width = Math.max(0, (layoutContainerRef.current?.getBoundingClientRect().width ?? 0) - 8);- defaultWidth = width;- return width;- };- const observer = new Observable((subscribe) => {- const targetElement = sidebarService.getContainer();- if (targetElement) {- let time = setTimeout(() => {- subscribe.next(undefined);- }, 150);- const clearTime = () => {- time && clearTimeout(time);- time = null as any;- };- const handle: any = (e: TransitionEvent) => {- if (e.propertyName === 'width') {- clearTime();- subscribe.next(undefined);- }- };- targetElement.addEventListener('transitionend', handle);- return () => {- clearTime();- targetElement.removeEventListener('transitionend', handle);- };- }- });- const subscription = observer.pipe(debounceTime(16)).subscribe(() => {- setLayoutWidth(getWidth());- });- return () => {- subscription.unsubscribe();- };- }, []);-const handleDelete = (rule: IConditionFormattingRule) => {const unitId = univerInstanceService.getCurrentUnitOfType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();const subUnitId = univerInstanceService.getCurrentUnitOfType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()?.getSheetId();@@ -256,11 +212,12 @@ export const RuleList = (props: IRuleListProps) => {};const handleDragStart = (_layout: unknown, from: { y: number }) => {- setDraggingId(from.y);+ const dragRule = ruleListByPermissionCheck[from.y];+ setDraggingId(dragRule?.cfId ?? '');};const handleDragStop = (_layout: unknown, from: { y: number }, to: { y: number }) => {- setDraggingId(-1);+ setDraggingId('');const unitId = univerInstanceService.getCurrentUnitOfType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();const subUnitId = univerInstanceService.getCurrentUnitOfType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getActiveSheet()?.getSheetId();if (!unitId || !subUnitId) {@@ -268,11 +225,14 @@ export const RuleList = (props: IRuleListProps) => {}const getSaveIndex = (index: number) => {- const length = ruleList.length;+ const length = ruleListByPermissionCheck.length;return Math.min(length - 1, Math.max(0, index));};- const cfId = ruleList[getSaveIndex(from.y)].cfId;- const targetCfId = ruleList[getSaveIndex(to.y)].cfId;+ const cfId = ruleListByPermissionCheck[getSaveIndex(from.y)]?.cfId;+ const targetCfId = ruleListByPermissionCheck[getSaveIndex(to.y)]?.cfId;+ if (!cfId || !targetCfId) {+ return;+ }if (cfId !== targetCfId) {commandService.executeCommand(MoveCfCommand.id, { unitId, subUnitId, start: { id: cfId, type: 'self' }, end: { id: targetCfId, type: to.y > from.y ? 'after' : 'before' } } as IMoveCfCommandParams);}@@ -302,8 +262,6 @@ export const RuleList = (props: IRuleListProps) => {});}, [ruleList]);- const layout = ruleListByPermissionCheck.map((rule, index) => ({ i: rule.cfId, x: 0, w: 12, y: index, h: 1, isResizable: false }));-const isHasAllRuleEditPermission = useMemo(() => {const workbook = univerInstanceService.getCurrentUnitOfType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const worksheet = workbook.getActiveSheet();@@ -316,7 +274,11 @@ export const RuleList = (props: IRuleListProps) => {return (<div>- <div className="univer-flex univer-items-center univer-justify-between univer-gap-2 univer-text-sm">+ <div+ className="+ univer-mb-2 univer-flex univer-items-center univer-justify-between univer-gap-2 univer-text-sm+ "+ ><div className="univer-flex univer-items-center univer-gap-2">{conditionalFormattingI18nController.tWithReactNode('sheet.cf.panel.managerRuleSelect',@@ -328,7 +290,7 @@ export const RuleList = (props: IRuleListProps) => {/>).map((ele, index) => <span key={index}>{ele}</span>)}</div>- <div className="univer-flex univer-justify-end">+ <div className="univer-flex univer-justify-end univer-space-x-2"><Tooltip title={localeService.t('sheet.cf.panel.createRule')} placement="bottom"><aclassName="univer-size-5 univer-cursor-pointer"@@ -358,97 +320,83 @@ export const RuleList = (props: IRuleListProps) => {</div>- <div ref={layoutContainerRef}>- {layoutWidth > 0 && (- <ReactGridLayout- className={`- [&_.react-grid-item]:univer-transition-none- [&_.react-grid-placeholder]:univer-rounded [&_.react-grid-placeholder]:!univer-bg-gray-200- `}- draggableHandle=".draggableHandle"- layout={layout}- cols={12}- rowHeight={60}- width={layoutWidth}- margin={[0, 10]}- onDragStop={handleDragStop}- onDragStart={handleDragStart}- >- {ruleListByPermissionCheck?.map((rule, index) => {- return (- <div key={`${rule.cfId}`}>- <div- className={clsx(`- univer-group univer-relative univer-flex univer-items-center- univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8- hover:univer-bg-gray-100- dark:hover:!univer-bg-gray-700- `, {- 'univer-bg-gray-100 dark:!univer-bg-gray-700': draggingId === index,- })}- onMouseMove={() => {- rule.ranges !== currentRuleRanges && setCurrentRuleRanges(rule.ranges);- }}- onMouseLeave={() => setCurrentRuleRanges([])}- onClick={() => {- onClick(rule);- }}- >- <div- className={clsx(`- univer-absolute univer-left-0 univer-hidden univer-size-5- univer-cursor-grab univer-items-center univer-justify-center- univer-rounded- group-hover:univer-flex- `, 'draggableHandle')}- onClick={(e) => e.stopPropagation()}- >- <SequenceIcon />- </div>- <div- className={`- univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden- `}- >- <div- className={`- univer-text-sm univer-text-gray-900- dark:!univer-text-white- `}- >- {getRuleDescribe(rule, localeService)}- </div>- <div className="univer-text-xs univer-text-gray-400">- {rule.ranges.map((range) => serializeRange(range)).join(',')}- </div>- </div>- <div>- <Preview rule={rule.rule} />- </div>- <div- className={clsx(`- univer-absolute univer-right-1 univer-hidden univer-size-6- univer-cursor-pointer univer-items-center univer-justify-center- univer-rounded- group-hover:univer-flex- hover:univer-bg-gray-200- `, {- 'univer-flex univer-items-center univer-justify-center': draggingId === index,- })}- onClick={(e) => {- e.stopPropagation();- handleDelete(rule);- setCurrentRuleRanges([]);- }}- >- <DeleteIcon />- </div>- </div>+ <div>+ <DraggableList+ className="univer-w-full"+ draggableHandle=".draggableHandle"+ list={ruleListByPermissionCheck}+ onListChange={() => undefined}+ idKey="cfId"+ rowHeight={60}+ margin={[0, 10]}+ onDragStop={handleDragStop}+ onDragStart={handleDragStart}+ itemRender={(rule) => (+ <div+ className={clsx(`+ univer-group univer-relative univer-flex univer-items-center univer-justify-between+ univer-rounded univer-py-2 univer-pl-5 univer-pr-8+ hover:univer-bg-gray-100+ dark:hover:!univer-bg-gray-700+ `, {+ 'univer-bg-gray-100 dark:!univer-bg-gray-700': draggingId === rule.cfId,+ })}+ onMouseMove={() => {+ rule.ranges !== currentRuleRanges && setCurrentRuleRanges(rule.ranges);+ }}+ onMouseLeave={() => setCurrentRuleRanges([])}+ onClick={() => {+ onClick(rule);+ }}+ >+ <div+ className={clsx(`+ univer-absolute univer-left-0 univer-hidden univer-size-5 univer-cursor-grab+ univer-items-center univer-justify-center univer-rounded+ group-hover:univer-flex+ `, 'draggableHandle')}+ onClick={(e) => e.stopPropagation()}+ >+ <SequenceIcon />+ </div>+ <div+ className="univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden"+ >+ <div+ className={`+ univer-text-sm univer-text-gray-900+ dark:!univer-text-white+ `}+ >+ {getRuleDescribe(rule, localeService)}</div>- );- })}- </ReactGridLayout>- ) }+ <div className="univer-text-xs univer-text-gray-400">+ {rule.ranges.map((range) => serializeRange(range)).join(',')}+ </div>+ </div>+ <div>+ <Preview rule={rule.rule} />+ </div>+ <div+ className={clsx(`+ univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer+ univer-items-center univer-justify-center univer-rounded univer-text-red-500+ group-hover:univer-flex+ hover:univer-bg-gray-200+ `, {+ 'univer-flex univer-items-center univer-justify-center': draggingId === rule.cfId,+ })}+ onClick={(e) => {+ e.stopPropagation();+ handleDelete(rule);+ setCurrentRuleRanges([]);+ }}+ >+ <DeleteIcon />+ </div>+ </div>+ )}+ /></div></div>);diff --git a/packages/sheets-sort-ui/src/views/CustomSortPanel.tsx b/packages/sheets-sort-ui/src/views/CustomSortPanel.tsxindex d5fd5e5fac..d645ae5c3f 100644--- a/packages/sheets-sort-ui/src/views/CustomSortPanel.tsx+++ b/packages/sheets-sort-ui/src/views/CustomSortPanel.tsx@@ -112,7 +112,7 @@ function CustomSortPanelImpl({ state }: { state: ICustomSortState }) {return (<div><div onMouseDown={(e) => { e.stopPropagation(); }}>- <div className="univer-flex univer-items-center univer-justify-between">+ <div className="univer-mb-2 univer-flex univer-items-center univer-justify-between"><Checkbox checked={hasTitle} onChange={(value) => setTitle(!!value)}>{localeService.t('sheets-sort.dialog.first-row-check')}</Checkbox>@@ -153,10 +153,6 @@ function CustomSortPanelImpl({ state }: { state: ICustomSortState }) {}}><DraggableList- className={`- [&_.react-grid-item]:univer-transition-none- [&_.react-grid-placeholder]:univer-rounded [&_.react-grid-placeholder]:!univer-bg-gray-200- `}list={dragList}onListChange={setList}idKey="id"diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex a5f2f19880..cc456bb063 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -886,9 +886,6 @@ importers:'@univerjs/icons':specifier: ^1.1.1- '@univerjs/themes':- specifier: workspace:*- version: link:../themesclass-variance-authority:specifier: ^0.7.1version: 0.7.1@@ -904,9 +901,6 @@ importers:rc-menu:specifier: ^9.16.0- react-grid-layout:- specifier: ^1.5.1react-transition-group:specifier: ^4.4.5@@ -923,9 +917,6 @@ importers:'@testing-library/react':specifier: ^16.3.2version: 16.3.2(@testing-library/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])- '@types/react-grid-layout':- specifier: ^1.3.6- version: 1.3.6'@types/react-transition-group':specifier: ^4.4.12version: 4.4.12(@types/[email protected])@@ -5875,9 +5866,6 @@ packages:peerDependencies:'@types/react': 19.2.14- '@types/[email protected]':- resolution: {integrity: sha512-Cw7+sb3yyjtmxwwJiXtEXcu5h4cgs+sCGkHwHXsFmPyV30bf14LeD/fa2LwQovuD2HWxCcjIdNhDlcYGj95qGA==}-'@types/[email protected]':resolution: {integrity: sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w==}peerDependencies:@@ -6729,10 +6717,6 @@ packages:resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==}engines: {node: '>=12'}- resolution: {integrity: sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==}- engines: {node: '>=6'}-resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}engines: {node: '>=6'}@@ -7722,9 +7706,6 @@ packages:resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==}- resolution: {integrity: sha512-G3BSX9cfKttjr+2o1O22tYMLq0DPluZnYtq1rXumE1SpL/F/SLIfHx08WYQoWSIpeMYf8sRbJ8++71+v6Pnxfg==}-resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==}engines: {node: '>=8.6.0'}@@ -9793,18 +9774,6 @@ packages:peerDependencies:react: 19.2.4- resolution: {integrity: sha512-LtY5Xw1zTPqHkVmtM3X8MUOxNDOUhv/khTgBgrUvwaS064bwVvxT+q5El0uUFNx5IEPKXuRejr7UqLwBIg5pdw==}- peerDependencies:- react: 19.2.4- react-dom: 19.2.4-- resolution: {integrity: sha512-4Fr+kKMk0+m1HL/BWfHxi/lRuaOmDNNKQDcu7m12+NEYcen20wIuZFo789u3qWCyvUsNUxCiyf0eKq4WiJSNYw==}- peerDependencies:- react: 19.2.4- react-dom: 19.2.4-resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}@@ -9843,11 +9812,6 @@ packages:'@types/react':optional: true- resolution: {integrity: sha512-vKpeHhI5OZvYn82kXOs1bC8aOXktGU5AmKAgaZS4F5JPburCtbmDPqE7Pzp+1kN4+Wb81LlF33VpGwWwtXem+w==}- peerDependencies:- react: 19.2.4-resolution: {integrity: sha512-b6jSvxvVnyptAiLjbkWLE/lOnR4lfTtDAl+eUC7RZy+QQWc6wRzIV2CE6xBuMmDxc2qIihtDCZD5NPOFl7fRBQ==}engines: {node: '>=10'}@@ -13734,10 +13698,6 @@ snapshots:dependencies:'@types/react': 19.2.14- '@types/[email protected]':- dependencies:- '@types/react': 19.2.14-'@types/[email protected](@types/[email protected])':dependencies:'@types/react': 19.2.14@@ -14724,8 +14684,6 @@ snapshots:strip-ansi: 6.0.1wrap-ansi: 7.0.0- [email protected]: {}-@@ -15957,8 +15915,6 @@ snapshots:- [email protected]: {}-dependencies:'@nodelib/fs.stat': 2.0.5@@ -18374,24 +18330,6 @@ snapshots:react: 19.2.4scheduler: 0.27.0- dependencies:- clsx: 1.2.1- prop-types: 15.8.1- react: 19.2.4- react-dom: 19.2.4([email protected])-- dependencies:- clsx: 2.1.1- fast-equals: 4.0.3- prop-types: 15.8.1- react: 19.2.4- react-dom: 19.2.4([email protected])- resize-observer-polyfill: 1.5.1-@@ -18439,14 +18377,6 @@ snapshots:optionalDependencies:'@types/react': 19.2.14- dependencies:- prop-types: 15.8.1- react: 19.2.4- transitivePeerDependencies:- - react-dom-dependencies:get-nonce: 1.0.1