mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 11:58:10 +08:00
Merge pull request #154 from catchonme/master
替换掉bootstrap中tabs/collapse的动画
This commit is contained in:
commit
ef679fdcc3
@ -40,4 +40,12 @@
|
||||
&--collapsable &-header {
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
&-content {
|
||||
transition: height .35s ease;
|
||||
&.in, &.out {
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,9 +61,14 @@
|
||||
|
||||
&-pane {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
transition: opacity .35s linear;
|
||||
&.is-active {
|
||||
display: block;
|
||||
}
|
||||
&.in {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&--line {
|
||||
|
@ -5,22 +5,20 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import cx from 'classnames';
|
||||
import css = require('dom-helpers/style');
|
||||
import {ClassNamesFn, themeable} from '../theme';
|
||||
import Transition, { EXITED, ENTERED, ENTERING, EXITING } from 'react-transition-group/Transition';
|
||||
import Transition, { EXITED, ENTERING, EXITING } from 'react-transition-group/Transition';
|
||||
import { autobind } from '../utils/helper';
|
||||
|
||||
const collapseStyles: {
|
||||
[propName: string]: string;
|
||||
} = {
|
||||
[EXITED]: 'collapse',
|
||||
[EXITING]: 'collapsing',
|
||||
[ENTERING]: 'collapsing',
|
||||
[ENTERED]: 'collapse show',
|
||||
[EXITED]: 'out',
|
||||
[EXITING]: 'out',
|
||||
[ENTERING]: 'in'
|
||||
};
|
||||
|
||||
export interface CollapseProps {
|
||||
export interface CollapseProps {
|
||||
show?: boolean,
|
||||
mountOnEnter?: boolean,
|
||||
unmountOnExit?: boolean,
|
||||
@ -76,6 +74,7 @@ export class Collapse extends React.Component<CollapseProps, any> {
|
||||
const {
|
||||
show,
|
||||
children,
|
||||
classnames: cx,
|
||||
mountOnEnter,
|
||||
unmountOnExit
|
||||
} = this.props;
|
||||
@ -92,16 +91,17 @@ export class Collapse extends React.Component<CollapseProps, any> {
|
||||
onExit={this.handleExit}
|
||||
onExiting={this.handleExiting}
|
||||
>
|
||||
{(status:string, innerProps:any) => {
|
||||
{(status:string) => {
|
||||
if (status === ENTERING) {
|
||||
this.contentDom.offsetWidth;
|
||||
}
|
||||
return React.cloneElement(children as any, {
|
||||
...innerProps,
|
||||
...(children as React.ReactElement).props,
|
||||
ref: this.contentRef,
|
||||
className: cx(
|
||||
collapseStyles[status],
|
||||
innerProps.className
|
||||
'Collapse-content',
|
||||
(children as React.ReactElement).props.className,
|
||||
collapseStyles[status]
|
||||
)
|
||||
})}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Schema } from '../types';
|
||||
import Transition, { ENTERED, ENTERING } from 'react-transition-group/Transition';
|
||||
import Transition, {ENTERED, ENTERING} from 'react-transition-group/Transition';
|
||||
import { ClassNamesFn, themeable } from '../theme';
|
||||
|
||||
const transitionStyles: {
|
||||
@ -174,7 +174,6 @@ export class Tab extends React.PureComponent<TabProps> {
|
||||
transitionStyles[status],
|
||||
activeKey === eventKey ? 'is-active' : '',
|
||||
'Tabs-pane',
|
||||
'fade',
|
||||
className
|
||||
)}
|
||||
>
|
||||
|
Loading…
Reference in New Issue
Block a user