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(design): remove DropdownLegacy (#6622)

白熱cd61b7f0e5fe
diff --git a/packages/design/src/components/dropdown-legacy/DropdownLegacy.stories.tsx b/packages/design/src/components/dropdown-legacy/DropdownLegacy.stories.tsx
deleted file mode 100644
index 8f79785f1a..0000000000
--- a/packages/design/src/components/dropdown-legacy/DropdownLegacy.stories.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import type { Meta } from '@storybook/react';
-
-import { Button } from '../button/Button';
-import { DropdownLegacy } from './DropdownLegacy';
-
-const meta: Meta<typeof DropdownLegacy> = {
- title: 'Components / Dropdown Legacy',
- component: DropdownLegacy,
- parameters: {
- layout: 'centered',
- },
- tags: ['autodocs'],
-};
-
-export default meta;
-
-export const Playground = {
- render() {
- return (
- <DropdownLegacy overlay={<div>overlay</div>}>
- <Button>Basic</Button>
- </DropdownLegacy>
- );
- },
-};
diff --git a/packages/design/src/components/dropdown-legacy/DropdownLegacy.tsx b/packages/design/src/components/dropdown-legacy/DropdownLegacy.tsx
deleted file mode 100644
index c6fbc4251d..0000000000
--- a/packages/design/src/components/dropdown-legacy/DropdownLegacy.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import type Placements from 'rc-dropdown/lib/placements';
-import type { ReactElement } from 'react';
-import RcDropdown from 'rc-dropdown';
-import { useContext } from 'react';
-import { ConfigContext } from '../config-provider/ConfigProvider';
-import './index.css';
-
-type ActionType = 'hover' | 'focus' | 'click' | 'contextMenu';
-
-export interface IDropdownLegacyProps {
- /** Semantic DOM class */
- className?: string;
-
- /**
- * The dropdown content
- */
- children: ReactElement;
-
- /**
- * Whether the dropdown is visible
- */
- visible?: boolean;
-
- /**
- * Whether to force render the dropdown
- * @default false
- */
- forceRender?: boolean;
-
- /**
- * The trigger mode which executes the dropdown action
- * @default ['click']
- */
- trigger?: ActionType | ActionType[];
-
- /**
- * The placement of the dropdown
- */
- placement?: keyof typeof Placements;
-
- /**
- * The dropdown overlay
- */
- overlay: React.ReactElement;
-
- /**
- * Whether the dropdown aligns to the point
- * @default false
- */
- alignPoint?: boolean;
-
- /**
- * The align of the dropdown
- */
- align?: {
- offset?: number[];
- };
-
- /**
- * Triggered after the dropdown visibility changes
- * @param visible
- */
- onVisibleChange?: (visible: boolean) => void;
-
- /** Disable dropdown from showing up. */
- disabled?: boolean;
-}
-
-/** @deprecated */
-export function DropdownLegacy(props: IDropdownLegacyProps) {
- const {
- className,
- placement,
- children,
- overlay,
- alignPoint = false,
- align,
- disabled,
- onVisibleChange,
- } = props;
-
- const trigger = disabled ? [] : (props.trigger || ['click']);
-
- const { mountContainer } = useContext(ConfigContext);
-
- return mountContainer && (
- <RcDropdown
- {...props}
- overlayClassName={className}
- prefixCls="univer-dropdown"
- getPopupContainer={() => mountContainer}
- trigger={trigger}
- animation="slide-up"
- placement={placement}
- overlay={overlay}
- alignPoint={alignPoint}
- align={align}
- onVisibleChange={onVisibleChange}
- >
- {children}
- </RcDropdown>
- );
-}
diff --git a/packages/design/src/components/dropdown-legacy/index.css b/packages/design/src/components/dropdown-legacy/index.css
deleted file mode 100644
index 7a9f301964..0000000000
--- a/packages/design/src/components/dropdown-legacy/index.css
+++ /dev/null
@@ -1,122 +0,0 @@
-.univer-dropdown {
- position: absolute;
- z-index: 1070;
- top: -9999px;
- left: -9999px;
- display: block;
-}
-
-.univer-dropdown-hidden {
- display: none;
-}
-
-.univer-dropdown-slide-up-enter,
-.univer-dropdown-slide-up-appear {
- transform-origin: 0 0;
- display: block !important;
- animation-duration: 0.15s;
- animation-fill-mode: both;
- opacity: 0;
- animation-play-state: paused;
- animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1);
-}
-
-.univer-dropdown-slide-up-leave {
- transform-origin: 0 0;
- display: block !important;
- animation-duration: 0.15s;
- animation-fill-mode: both;
- opacity: 1;
- animation-play-state: paused;
- animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34);
-}
-
-.univer-dropdown-slide-up-enter.univer-dropdown-slide-up-enter-active.univer-dropdown-placement-bottomLeft,
-.univer-dropdown-slide-up-appear.univer-dropdown-slide-up-appear-active.univer-dropdown-placement-bottomLeft,
-.univer-dropdown-slide-up-enter.univer-dropdown-slide-up-enter-active.univer-dropdown-placement-bottomCenter,
-.univer-dropdown-slide-up-appear.univer-dropdown-slide-up-appear-active.univer-dropdown-placement-bottomCenter,
-.univer-dropdown-slide-up-enter.univer-dropdown-slide-up-enter-active.univer-dropdown-placement-bottomRight,
-.univer-dropdown-slide-up-appear.univer-dropdown-slide-up-appear-active.univer-dropdown-placement-bottomRight {
- animation-name: dropdown-slide-up-in;
- animation-play-state: running;
-}
-
-.univer-dropdown-slide-up-enter.univer-dropdown-slide-up-enter-active.univer-dropdown-placement-topLeft,
-.univer-dropdown-slide-up-appear.univer-dropdown-slide-up-appear-active.univer-dropdown-placement-topLeft,
-.univer-dropdown-slide-up-enter.univer-dropdown-slide-up-enter-active.univer-dropdown-placement-topCenter,
-.univer-dropdown-slide-up-appear.univer-dropdown-slide-up-appear-active.univer-dropdown-placement-topCenter,
-.univer-dropdown-slide-up-enter.univer-dropdown-slide-up-enter-active.univer-dropdown-placement-topRight,
-.univer-dropdown-slide-up-appear.univer-dropdown-slide-up-appear-active.univer-dropdown-placement-topRight {
- animation-name: dropdown-slide-down-in;
- animation-play-state: running;
-}
-
-.univer-dropdown-slide-up-leave.univer-dropdown-slide-up-leave-active.univer-dropdown-placement-bottomLeft,
-.univer-dropdown-slide-up-leave.univer-dropdown-slide-up-leave-active.univer-dropdown-placement-bottomCenter,
-.univer-dropdown-slide-up-leave.univer-dropdown-slide-up-leave-active.univer-dropdown-placement-bottomRight {
- animation-name: dropdown-slide-up-out;
- animation-play-state: running;
-}
-
-.univer-dropdown-slide-up-leave.univer-dropdown-slide-up-leave-active.univer-dropdown-placement-topLeft,
-.univer-dropdown-slide-up-leave.univer-dropdown-slide-up-leave-active.univer-dropdown-placement-topCenter,
-.univer-dropdown-slide-up-leave.univer-dropdown-slide-up-leave-active.univer-dropdown-placement-topRight {
- animation-name: dropdown-slide-down-out;
- animation-play-state: running;
-}
-
-@keyframes dropdown-slide-up-in {
- 0% {
- transform-origin: 0% 0%;
- transform: scaleY(0);
- opacity: 0;
- }
-
- 100% {
- transform-origin: 0% 0%;
- transform: scaleY(1);
- opacity: 1;
- }
-}
-
-@keyframes dropdown-slide-up-out {
- 0% {
- transform-origin: 0% 0%;
- transform: scaleY(1);
- opacity: 1;
- }
-
- 100% {
- transform-origin: 0% 0%;
- transform: scaleY(0);
- opacity: 0;
- }
-}
-
-@keyframes dropdown-slide-down-in {
- 0% {
- transform-origin: 0% 100%;
- transform: scaleY(0);
- opacity: 0;
- }
-
- 100% {
- transform-origin: 0% 100%;
- transform: scaleY(1);
- opacity: 1;
- }
-}
-
-@keyframes dropdown-slide-down-out {
- 0% {
- transform-origin: 0% 100%;
- transform: scaleY(1);
- opacity: 1;
- }
-
- 100% {
- transform-origin: 0% 100%;
- transform: scaleY(0);
- opacity: 0;
- }
-}
diff --git a/packages/design/src/components/dropdown-legacy/index.ts b/packages/design/src/components/dropdown-legacy/index.ts
deleted file mode 100644
index 2d830e5aa4..0000000000
--- a/packages/design/src/components/dropdown-legacy/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { DropdownLegacy, type IDropdownLegacyProps } from './DropdownLegacy';
diff --git a/packages/design/src/index.ts b/packages/design/src/index.ts
index a344d3e73d..7fecd149e6 100644
--- a/packages/design/src/index.ts
+++ b/packages/design/src/index.ts
@@ -32,7 +32,6 @@ 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 { DropdownLegacy, type IDropdownLegacyProps } from './components/dropdown-legacy';
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';