Browse Source

chore: remove useless code

DaiQiangReal 3 years ago
parent
commit
7a3979d0a9

+ 0 - 14
packages/semi-ui/tooltip/CSSAnimation.tsx → packages/semi-ui/_cssAnimation/index.tsx

@@ -33,24 +33,11 @@ class CSSAnimation extends React.Component<AnimationProps, AnimationState> {
             currentClassName: this.props.startClassName,
             currentClassName: this.props.startClassName,
             extraStyle: {}
             extraStyle: {}
         };
         };
-        console.log("===>", this.props);
     }
     }
 
 
     componentDidUpdate(prevProps: Readonly<AnimationProps>, prevState: Readonly<AnimationState>, snapshot?: any) {
     componentDidUpdate(prevProps: Readonly<AnimationProps>, prevState: Readonly<AnimationState>, snapshot?: any) {
         const changedKeys = Object.keys(this.props).filter(key => !isEqual(this.props[key], prevProps[key]));
         const changedKeys = Object.keys(this.props).filter(key => !isEqual(this.props[key], prevProps[key]));
-        console.log('changedKeys', changedKeys, prevProps, this.props);
         if (changedKeys.includes("animationState")) {
         if (changedKeys.includes("animationState")) {
-            // if (this.props.animationState === "enter") {
-            //     this.setState({
-            //         currentClassName: this.props.startClassName,
-            //         extraStyle: {}
-            //     }, this.props.onAnimationStart ?? noop);
-            // } else {
-            //     this.setState({
-            //         currentClassName: this.props.endClassName,
-            //         extraStyle: {}
-            //     }, this.props.onAnimationEnd ?? noop);
-            // }
         }
         }
         if (changedKeys.includes("startClassName")){
         if (changedKeys.includes("startClassName")){
             this.setState({
             this.setState({
@@ -77,7 +64,6 @@ class CSSAnimation extends React.Component<AnimationProps, AnimationState> {
 
 
 
 
     render() {
     render() {
-        console.log("mount", this.state.currentClassName);
         return this.props.children({
         return this.props.children({
             animationClassName: this.state.currentClassName ?? "",
             animationClassName: this.state.currentClassName ?? "",
             animationStyle: this.state.extraStyle,
             animationStyle: this.state.extraStyle,

+ 0 - 31
packages/semi-ui/tooltip/TooltipStyledTransition.tsx

@@ -1,31 +0,0 @@
-/* eslint-disable max-len */
-/* eslint-disable @typescript-eslint/no-shadow */
-import { StyledTransition } from '@douyinfe/semi-animation-react';
-import React from 'react';
-import { cssClasses } from '@douyinfe/semi-foundation/tooltip/constants';
-import getMotionObjFromProps from '@douyinfe/semi-foundation/utils/getMotionObjFromProps';
-import { Motion } from '../_base/base';
-
-const enterCls = `${cssClasses.PREFIX}-bounceIn`;
-const leaveCls = `${cssClasses.PREFIX}-zoomOut`;
-
-export interface TooltipTransitionProps {
-    [key: string]: any;
-    children?: (arg: any) => React.ReactNode;
-    motion?: Motion<TooltipTransitionProps>;
-}
-const TooltipTransition: React.FC<TooltipTransitionProps> = (props = {}) => {
-    const { children } = props;
-    const motion = getMotionObjFromProps(props);
-
-    //  add fillMode forwards to fix issue 715, tooltip close will flashing under react 18
-    return (
-        <StyledTransition {...props} enter={enterCls} leave={leaveCls} duration={'100ms'} {...motion} fillMode='forwards'>
-            {typeof children === 'function' ?
-                ({ animateCls, animateEvents, animateStyle }: any) => children({ animateCls, animateEvents, animateStyle }) :
-                children}
-        </StyledTransition>
-    );
-};
-
-export default TooltipTransition;

+ 1 - 28
packages/semi-ui/tooltip/index.tsx

@@ -22,12 +22,10 @@ import Portal from '../_portal/index';
 import ConfigContext, { ContextValue } from '../configProvider/context';
 import ConfigContext, { ContextValue } from '../configProvider/context';
 import TriangleArrow from './TriangleArrow';
 import TriangleArrow from './TriangleArrow';
 import TriangleArrowVertical from './TriangleArrowVertical';
 import TriangleArrowVertical from './TriangleArrowVertical';
-import TooltipTransition from './TooltipStyledTransition';
 import ArrowBoundingShape from './ArrowBoundingShape';
 import ArrowBoundingShape from './ArrowBoundingShape';
 import { Motion } from '../_base/base';
 import { Motion } from '../_base/base';
-import CSSAnimation from "@douyinfe/semi-ui/tooltip/CSSAnimation";
+import CSSAnimation from "../_cssAnimation";
 
 
-export { TooltipTransitionProps } from './TooltipStyledTransition';
 export type Trigger = ArrayElement<typeof strings.TRIGGER_SET>;
 export type Trigger = ArrayElement<typeof strings.TRIGGER_SET>;
 
 
 export interface ArrowBounding {
 export interface ArrowBounding {
@@ -604,31 +602,6 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
                     }
                     }
                 }
                 }
             </CSSAnimation>
             </CSSAnimation>
-            // <TooltipTransition position={placement} didLeave={this.didLeave} motion={motion}>
-            //     {
-            //         transitionState === 'enter' ?
-            //             ({ animateCls, animateStyle, animateEvents }) => (
-            //                 <div
-            //                     className={classNames(className, animateCls)}
-            //                     style={{
-            //                         visibility: 'visible',
-            //                         ...animateStyle,
-            //                         transformOrigin,
-            //                         ...style,
-            //                     }}
-            //                     {...portalEventSet}
-            //                     {...animateEvents}
-            //                     role={role}
-            //                     x-placement={placement}
-            //                     id={id}
-            //                 >
-            //                     {contentNode}
-            //                     {icon}
-            //                 </div>
-            //             ) :
-            //             null
-            //     }
-            // </TooltipTransition>
         ) : (
         ) : (
             <div className={className} {...portalEventSet} x-placement={placement} style={{ visibility: motion ? 'hidden' : 'visible', ...style }}>
             <div className={className} {...portalEventSet} x-placement={placement} style={{ visibility: motion ? 'hidden' : 'visible', ...style }}>
                 {contentNode}
                 {contentNode}