parent
a5589343d8
commit
e416f48719
|
@ -57,12 +57,12 @@
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-width: 0 $Tabs-borderWidth $Tabs-borderWidth;
|
border-width: 0 $Tabs-borderWidth $Tabs-borderWidth;
|
||||||
border-color: $Tabs-borderColor;
|
border-color: $Tabs-borderColor;
|
||||||
|
|
||||||
> .tab-pane {
|
|
||||||
display: none;
|
|
||||||
&.active {
|
|
||||||
display: block;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-pane {
|
||||||
|
display: none;
|
||||||
|
&.is-active {
|
||||||
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
border-bottom-color: #e2e5ec;
|
border-bottom-color: #e2e5ec;
|
||||||
|
|
||||||
> li {
|
> li {
|
||||||
&.active {
|
&.is-active {
|
||||||
> a,
|
> a,
|
||||||
> a:hover,
|
> a:hover,
|
||||||
> a:focus {
|
> a:focus {
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
border-top: px2rem(1px) solid #e2e5ec;
|
border-top: px2rem(1px) solid #e2e5ec;
|
||||||
|
|
||||||
> li {
|
> li {
|
||||||
&.active {
|
&.is-active {
|
||||||
> a,
|
> a,
|
||||||
> a:hover,
|
> a:hover,
|
||||||
> a:focus {
|
> a:focus {
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
line-height: px2rem(30px);
|
line-height: px2rem(30px);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.is-active {
|
||||||
> a,
|
> a,
|
||||||
> a:hover,
|
> a:hover,
|
||||||
> a:focus {
|
> a:focus {
|
||||||
|
@ -154,7 +154,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-content {
|
> .#{$ns}Tabs-content {
|
||||||
border-top: $Tabs-borderWidth solid $Tabs-borderColor;
|
border-top: $Tabs-borderWidth solid $Tabs-borderColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import React from 'react';
|
||||||
import { Schema } from '../types';
|
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';
|
import { ClassNamesFn, themeable } from '../theme';
|
||||||
import { RendererProps } from '../factory';
|
|
||||||
|
|
||||||
const transitionStyles: {
|
const transitionStyles: {
|
||||||
[propName: string]: string;
|
[propName: string]: string;
|
||||||
|
@ -21,18 +20,24 @@ export interface TabProps extends Schema {
|
||||||
title?: string; // 标题
|
title?: string; // 标题
|
||||||
icon?: string;
|
icon?: string;
|
||||||
eventKey: string | number;
|
eventKey: string | number;
|
||||||
tabsMode?: '' | 'line' | 'card' | 'radio';
|
|
||||||
tab?: Schema;
|
tab?: Schema;
|
||||||
className?: string;
|
className?: string;
|
||||||
location?: any;
|
classnames?: ClassNamesFn;
|
||||||
classnames: ClassNamesFn;
|
|
||||||
activeKey?: string | number;
|
activeKey?: string | number;
|
||||||
reload?: boolean;
|
reload?: boolean;
|
||||||
mountOnEnter?: boolean;
|
mountOnEnter?: boolean;
|
||||||
unmountOnExit?: boolean;
|
unmountOnExit?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface TabsProps extends RendererProps {
|
export interface TabsProps {
|
||||||
|
mode?: '' | 'line' | 'card' | 'radio';
|
||||||
|
tabsMode?: '' | 'line' | 'card' | 'radio';
|
||||||
|
handleSelect?: Function;
|
||||||
|
classPrefix: string;
|
||||||
|
classnames: ClassNamesFn;
|
||||||
|
activeKey: string | number;
|
||||||
|
contentClassName: string;
|
||||||
|
className?: string;
|
||||||
tabs?: Array<TabProps>;
|
tabs?: Array<TabProps>;
|
||||||
tabRender?: (tab: TabProps, props?: TabsProps) => JSX.Element;
|
tabRender?: (tab: TabProps, props?: TabsProps) => JSX.Element;
|
||||||
}
|
}
|
||||||
|
@ -59,8 +64,8 @@ export class Tabs extends React.Component<TabsProps> {
|
||||||
<li
|
<li
|
||||||
className={cx(
|
className={cx(
|
||||||
'Tabs-link',
|
'Tabs-link',
|
||||||
activeKey === eventKey ? 'active' : '',
|
activeKey === eventKey ? 'is-active' : '',
|
||||||
disabled ? 'disabled' : ''
|
disabled ? 'is-disabled' : ''
|
||||||
)}
|
)}
|
||||||
key={index}
|
key={index}
|
||||||
onClick={() => disabled ? '' : this.handleSelect(eventKey)}
|
onClick={() => disabled ? '' : this.handleSelect(eventKey)}
|
||||||
|
@ -124,7 +129,7 @@ export class Tabs extends React.Component<TabsProps> {
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className={cx('Tabs-content', contentClassName, 'tab-content')}
|
className={cx('Tabs-content', contentClassName)}
|
||||||
>
|
>
|
||||||
{children.map((child, index) => {
|
{children.map((child, index) => {
|
||||||
return this.renderTab(child, index);
|
return this.renderTab(child, index);
|
||||||
|
@ -167,8 +172,8 @@ export class Tab extends React.PureComponent<TabProps> {
|
||||||
ref={this.contentRef}
|
ref={this.contentRef}
|
||||||
className={cx && cx(
|
className={cx && cx(
|
||||||
transitionStyles[status],
|
transitionStyles[status],
|
||||||
activeKey === eventKey ? 'active' : '',
|
activeKey === eventKey ? 'is-active' : '',
|
||||||
'tab-pane',
|
'Tabs-pane',
|
||||||
'fade',
|
'fade',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -23,7 +23,7 @@ export class DateField extends React.Component<DateProps, DateState> {
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
valueFormat: 'X',
|
valueFormat: 'X',
|
||||||
fromNow: false,
|
fromNow: false,
|
||||||
updateFrequency: 0
|
updateFrequency: 60000
|
||||||
};
|
};
|
||||||
|
|
||||||
// 动态显示相对时间时,用来触发视图更新
|
// 动态显示相对时间时,用来触发视图更新
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Renderer, RendererProps} from '../factory';
|
import {Renderer, RendererProps} from '../factory';
|
||||||
import { Schema } from '../types';
|
import { Schema } from '../types';
|
||||||
import { evalExpression } from '../utils/tpl';
|
|
||||||
import find = require('lodash/find');
|
import find = require('lodash/find');
|
||||||
import { isVisible, autobind } from '../utils/helper';
|
import { isVisible, autobind, isDisabled } from '../utils/helper';
|
||||||
import findIndex = require('lodash/findIndex');
|
import findIndex = require('lodash/findIndex');
|
||||||
import { Tabs as CTabs, Tab } from '../components/Tabs';
|
import { Tabs as CTabs, Tab } from '../components/Tabs';
|
||||||
import { ClassNamesFn } from '../theme';
|
import { ClassNamesFn } from '../theme';
|
||||||
|
@ -12,18 +11,25 @@ export interface TabProps extends Schema {
|
||||||
title?: string; // 标题
|
title?: string; // 标题
|
||||||
icon?: string;
|
icon?: string;
|
||||||
hash?: string; // 通过 hash 来控制当前选择
|
hash?: string; // 通过 hash 来控制当前选择
|
||||||
tabsMode?: '' | 'line' | 'card' | 'radio';
|
|
||||||
tab?: Schema;
|
tab?: Schema;
|
||||||
className?: string;
|
className?: string;
|
||||||
classnames: ClassNamesFn;
|
classnames: ClassNamesFn;
|
||||||
location?: any;
|
eventKey?: string| number;
|
||||||
activeKey?: string|number;
|
activeKey?: string|number;
|
||||||
reload?: boolean;
|
reload?: boolean;
|
||||||
mountOnEnter?: boolean;
|
mountOnEnter?: boolean;
|
||||||
unmountOnExit?: boolean;
|
unmountOnExit?: boolean;
|
||||||
|
disabled?: string;
|
||||||
|
disabledOn?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface TabsProps extends RendererProps {
|
export interface TabsProps extends RendererProps {
|
||||||
|
mode?: '' | 'line' | 'card' | 'radio';
|
||||||
|
tabsMode?: '' | 'line' | 'card' | 'radio';
|
||||||
|
activeKey: string | number;
|
||||||
|
contentClassName: string;
|
||||||
|
handleSelect?: Function;
|
||||||
|
location?: any;
|
||||||
tabs?: Array<TabProps>;
|
tabs?: Array<TabProps>;
|
||||||
tabRender?: (tab: TabProps, props?: TabsProps) => JSX.Element;
|
tabRender?: (tab: TabProps, props?: TabsProps) => JSX.Element;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +211,7 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
|
||||||
|
|
||||||
const mode = tabsMode || dMode;
|
const mode = tabsMode || dMode;
|
||||||
const finallyTabs = tabs.map(tab => {
|
const finallyTabs = tabs.map(tab => {
|
||||||
tab.disabled = tab.disabled || (tab.disabledOn && evalExpression(tab.disabledOn, data));
|
tab.isDisabled = isDisabled(tab, data);
|
||||||
return tab;
|
return tab;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue