Merge branch 'master' into feature

* master:
  📝 Add bodyStyle and style of Drawer in documentation, #13850
  🐛 Fix Drawer style not working
  🐛 fix markStyle affset style
  Update Santa.jsx
  update changelog
  bump 3.11.6
  revert Christmas egg
  [type] make type of components compatible with ComponentType<P>
  bump 3.11.5
   site: make document side bar sticky
This commit is contained in:
afc163 2018-12-25 16:28:50 +08:00
commit 30fe9918d8
No known key found for this signature in database
GPG Key ID: 738F973FCE5C6B48
38 changed files with 190 additions and 162 deletions

View File

@ -15,6 +15,18 @@ timeline: true
---
## 3.11.6
`2018-12-25`
- 📝 Remove Christmas egg. [#13098](https://github.com/ant-design/ant-design/issues/13098)
## 3.11.5
`2018-12-24`
- 🐞 Fixed `lib` missing css file match. [#13791](https://github.com/ant-design/ant-design/issues/13803)
## 3.11.4
`2018-12-23`

View File

@ -15,6 +15,18 @@ timeline: true
---
## 3.11.6
`2018-12-25`
- 📝 移除圣诞彩蛋。 [#13098](https://github.com/ant-design/ant-design/issues/13098)
## 3.11.5
`2018-12-24`
- 🐞 修复 `lib` 下样式文件路径问题。[#13791](https://github.com/ant-design/ant-design/issues/13803)
## 3.11.4
`2018-12-23`

View File

@ -1 +1,3 @@
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
// https://stackoverflow.com/questions/46176165/ways-to-get-string-literal-type-of-array-values-without-enum-overhead
export const tuple = <T extends string[]>(...args: T) => args;

View File

@ -35,8 +35,8 @@ export interface AvatarState {
export default class Avatar extends React.Component<AvatarProps, AvatarState> {
static defaultProps = {
shape: 'circle',
size: 'default',
shape: 'circle' as AvatarProps['shape'],
size: 'default' as AvatarProps['size'],
};
state = {

View File

@ -6,6 +6,7 @@ import omit from 'omit.js';
import Icon from '../icon';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import Wave from '../_util/wave';
import { tuple } from '../_util/type';
const rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/;
const isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);
@ -38,10 +39,14 @@ function insertSpace(child: React.ReactChild, needInserted: boolean) {
return child;
}
export type ButtonType = 'default' | 'primary' | 'ghost' | 'dashed' | 'danger';
export type ButtonShape = 'circle' | 'circle-outline';
export type ButtonSize = 'small' | 'default' | 'large';
export type ButtonHTMLType = 'submit' | 'button' | 'reset';
const ButtonTypes = tuple('default', 'primary', 'ghost', 'dashed', 'danger');
export type ButtonType = (typeof ButtonTypes)[number];
const ButtonShapes = tuple('circle', 'circle-outline');
export type ButtonShape = (typeof ButtonShapes)[number];
const ButtonSizes = tuple('large', 'default', 'small');
export type ButtonSize = (typeof ButtonSizes)[number];
const ButtonHTMLTypes = tuple('submit', 'button', 'reset');
export type ButtonHTMLType = (typeof ButtonHTMLTypes)[number];
export interface BaseButtonProps {
type?: ButtonType;
@ -82,10 +87,10 @@ export default class Button extends React.Component<ButtonProps, any> {
};
static propTypes = {
type: PropTypes.string,
shape: PropTypes.oneOf(['circle', 'circle-outline']),
size: PropTypes.oneOf(['large', 'default', 'small']),
htmlType: PropTypes.oneOf(['submit', 'button', 'reset']),
type: PropTypes.oneOf(ButtonTypes),
shape: PropTypes.oneOf(ButtonShapes),
size: PropTypes.oneOf(ButtonSizes),
htmlType: PropTypes.oneOf(ButtonHTMLTypes),
onClick: PropTypes.func,
loading: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
className: PropTypes.string,
@ -203,8 +208,6 @@ export default class Button extends React.Component<ButtonProps, any> {
break;
}
const now = new Date();
const isChristmas = now.getMonth() === 11 && now.getDate() === 25;
const classes = classNames(prefixCls, className, {
[`${prefixCls}-${type}`]: type,
[`${prefixCls}-${shape}`]: shape,
@ -214,7 +217,6 @@ export default class Button extends React.Component<ButtonProps, any> {
[`${prefixCls}-background-ghost`]: ghost,
[`${prefixCls}-two-chinese-chars`]: hasTwoCNChar,
[`${prefixCls}-block`]: block,
christmas: isChristmas,
});
const iconType = loading ? 'loading' : icon;
@ -224,8 +226,6 @@ export default class Button extends React.Component<ButtonProps, any> {
? React.Children.map(children, child => insertSpace(child, this.isNeedInserted()))
: null;
const title = isChristmas ? 'Ho Ho Ho!' : rest.title;
const linkButtonRestProps = omit(rest as AnchorButtonProps, ['htmlType']);
if (linkButtonRestProps.href !== undefined) {
return (
@ -233,7 +233,6 @@ export default class Button extends React.Component<ButtonProps, any> {
{...linkButtonRestProps}
className={classes}
onClick={this.handleClick}
title={title}
ref={this.saveButtonRef}
>
{iconNode}
@ -252,7 +251,6 @@ export default class Button extends React.Component<ButtonProps, any> {
type={htmlType || 'button'}
className={classes}
onClick={this.handleClick}
title={title}
ref={this.saveButtonRef}
>
{iconNode}

View File

@ -162,27 +162,6 @@
width: 100%;
}
.christmas&-primary:before {
content: '';
display: block;
position: absolute;
top: -6px;
left: 0;
right: 0;
background: url(data:image/png;base64,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)
no-repeat 50% 0;
background-size: 64px;
opacity: 1;
}
.christmas&-primary&-lg:before {
background-size: 72px;
}
.christmas&-primary&-sm:before {
background-size: 56px;
}
// https://github.com/ant-design/ant-design/issues/12681
&:empty {
vertical-align: top;

View File

@ -52,7 +52,7 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
static defaultProps = {
locale: {},
fullscreen: true,
mode: 'month',
mode: 'month' as CalendarMode,
onSelect: noop,
onPanelChange: noop,
onChange: noop,
@ -69,7 +69,7 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
className: PropTypes.string,
style: PropTypes.object,
onPanelChange: PropTypes.func,
value: PropTypes.object,
value: PropTypes.object as PropTypes.Requireable<moment.Moment>,
onSelect: PropTypes.func,
onChange: PropTypes.func,
};

View File

@ -25,7 +25,8 @@ A Drawer is a panel that is typically overlaid on top of a page and slides in fr
| mask | Whether to show mask or not. | Boolean | true |
| maskClosable | Clicking on the mask (area outside the Drawer) to close the Drawer or not. | boolean | true |
| maskStyle | Style for Drawer's mask element. | object | {} |
| style | Style of floating layer, typically used for adjusting its position. | object | - |
| style | Style of drawer wrapper | object | - |
| bodyStyle | Style of floating layer, typically used for adjusting its position. | object | - |
| title | The title for Drawer. | string\|ReactNode | - |
| visible | Whether the Drawer dialog is visible or not. | boolean | false |
| width | Width of the Drawer dialog. | string\|number | 256 |

View File

@ -6,6 +6,7 @@ import warning from 'warning';
import classNames from 'classnames';
import Icon from '../icon';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import { tuple } from '../_util/type';
const DrawerContext: Context<Drawer | null> = createReactContext(null);
@ -13,7 +14,8 @@ type EventType = React.MouseEvent<HTMLDivElement> | React.MouseEvent<HTMLButtonE
type getContainerfunc = () => HTMLElement;
type placementType = 'top' | 'right' | 'bottom' | 'left';
const PlacementTypes = tuple('top', 'right', 'bottom', 'left');
type placementType = (typeof PlacementTypes)[number];
export interface DrawerProps {
closable?: boolean;
destroyOnClose?: boolean;
@ -46,9 +48,8 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
destroyOnClose: PropTypes.bool,
getContainer: PropTypes.oneOfType([
PropTypes.string,
PropTypes.object,
PropTypes.object as PropTypes.Requireable<HTMLElement>,
PropTypes.func,
PropTypes.bool,
]),
maskClosable: PropTypes.bool,
mask: PropTypes.bool,
@ -59,7 +60,7 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
zIndex: PropTypes.number,
prefixCls: PropTypes.string,
placement: PropTypes.string,
placement: PropTypes.oneOf(PlacementTypes),
onClose: PropTypes.func,
className: PropTypes.string,
};
@ -68,7 +69,7 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
width: 256,
height: 256,
closable: true,
placement: 'right',
placement: 'right' as placementType,
maskClosable: true,
mask: true,
level: null,
@ -143,13 +144,12 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
};
getRcDrawerStyle = () => {
const { zIndex, placement, maskStyle, style } = this.props;
const { zIndex, placement, style } = this.props;
const { push } = this.state;
return {
...maskStyle,
zIndex,
transform: push ? this.getPushTransform(placement) : undefined,
style,
...style,
};
};

View File

@ -24,7 +24,8 @@ title: Drawer
| maskClosable | 点击蒙层是否允许关闭 | boolean | true |
| mask | 是否展示遮罩 | Boolean | true |
| maskStyle | 遮罩样式 | object | {} |
| style | 可用于设置 Drawer 的样式,调整浮层位置等 | object | - |
| style | 可用于设置 Drawer 最外层容器的样式 | object | - |
| bodyStyle | 可用于设置 Drawer 的样式,调整浮层位置等 | object | - |
| title | 标题 | string \| ReactNode | - |
| visible | Drawer 是否可见 | boolean | - |
| width | 宽度 | string \| number | 256 |

View File

@ -7,8 +7,10 @@ import Dropdown, { DropDownProps } from './dropdown';
import classNames from 'classnames';
const ButtonGroup = Button.Group;
type DropdownButtonType = 'primary' | 'ghost' | 'dashed';
export interface DropdownButtonProps extends ButtonGroupProps, DropDownProps {
type?: 'primary' | 'ghost' | 'dashed';
type?: DropdownButtonType;
htmlType?: ButtonHTMLType;
disabled?: boolean;
onClick?: React.MouseEventHandler<HTMLButtonElement>;
@ -18,8 +20,8 @@ export interface DropdownButtonProps extends ButtonGroupProps, DropDownProps {
export default class DropdownButton extends React.Component<DropdownButtonProps, any> {
static defaultProps = {
placement: 'bottomRight',
type: 'default',
placement: 'bottomRight' as DropDownProps['placement'],
type: 'default' as DropdownButtonType,
};
renderButton = ({

View File

@ -5,7 +5,17 @@ import DropdownButton from './dropdown-button';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import warning from '../_util/warning';
import Icon from '../icon';
import { tuple } from '../_util/type';
const Placements = tuple(
'topLeft',
'topCenter',
'topRight',
'bottomLeft',
'bottomCenter',
'bottomRight',
);
type Placement = (typeof Placements)[number];
export interface DropDownProps {
trigger?: ('click' | 'hover' | 'contextMenu')[];
overlay: React.ReactNode;
@ -17,7 +27,7 @@ export interface DropDownProps {
prefixCls?: string;
className?: string;
transitionName?: string;
placement?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
placement?: Placement;
overlayClassName?: string;
overlayStyle?: React.CSSProperties;
forceRender?: boolean;
@ -31,7 +41,7 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
static defaultProps = {
mouseEnterDelay: 0.15,
mouseLeaveDelay: 0.1,
placement: 'bottomLeft',
placement: 'bottomLeft' as Placement,
};
getTransitionName() {

View File

@ -7,7 +7,7 @@ import omit from 'omit.js';
import FormItem from './FormItem';
import { FIELD_META_PROP, FIELD_DATA_PROP } from './constants';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import { Omit } from '../_util/type';
import { Omit, tuple } from '../_util/type';
import warning from '../_util/warning';
type FormCreateOptionMessagesCallback = (...args: any[]) => string;
@ -24,7 +24,8 @@ export interface FormCreateOption<T> {
withRef?: boolean;
}
export type FormLayout = 'horizontal' | 'inline' | 'vertical';
const FormLayouts = tuple('horizontal', 'inline', 'vertical');
export type FormLayout = (typeof FormLayouts)[number];
export interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {
layout?: FormLayout;
@ -161,7 +162,7 @@ export default class Form extends React.Component<FormProps, any> {
static propTypes = {
prefixCls: PropTypes.string,
layout: PropTypes.oneOf(['horizontal', 'inline', 'vertical']),
layout: PropTypes.oneOf(FormLayouts),
children: PropTypes.any,
onSubmit: PropTypes.func,
hideRequiredMark: PropTypes.bool,

View File

@ -9,6 +9,9 @@ import Col, { ColProps } from '../grid/col';
import Icon from '../icon';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import warning from '../_util/warning';
import { tuple } from '../_util/type';
const ValidateStatuses = tuple('success', 'warning', 'error', 'validating');
export interface FormItemProps {
prefixCls?: string;
@ -19,7 +22,7 @@ export interface FormItemProps {
wrapperCol?: ColProps;
help?: React.ReactNode;
extra?: React.ReactNode;
validateStatus?: 'success' | 'warning' | 'error' | 'validating';
validateStatus?: (typeof ValidateStatuses)[number];
hasFeedback?: boolean;
required?: boolean;
style?: React.CSSProperties;
@ -45,7 +48,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
labelCol: PropTypes.object,
help: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]),
validateStatus: PropTypes.oneOf(['', 'success', 'warning', 'error', 'validating']),
validateStatus: PropTypes.oneOf(ValidateStatuses),
hasFeedback: PropTypes.bool,
wrapperCol: PropTypes.object,
className: PropTypes.string,

View File

@ -4,7 +4,6 @@ import classNames from 'classnames';
import RowContext from './RowContext';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
const stringOrNumber = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
const objectOrNumber = PropTypes.oneOfType([PropTypes.object, PropTypes.number]);
export interface ColSize {
@ -32,11 +31,11 @@ export interface ColProps extends React.HTMLAttributes<HTMLDivElement> {
export default class Col extends React.Component<ColProps, {}> {
static propTypes = {
span: stringOrNumber,
order: stringOrNumber,
offset: stringOrNumber,
push: stringOrNumber,
pull: stringOrNumber,
span: PropTypes.number,
order: PropTypes.number,
offset: PropTypes.number,
push: PropTypes.number,
pull: PropTypes.number,
className: PropTypes.string,
children: PropTypes.node,
xs: objectOrNumber,

View File

@ -20,15 +20,17 @@ import * as React from 'react';
import classNames from 'classnames';
import * as PropTypes from 'prop-types';
import RowContext from './RowContext';
import { tuple } from '../_util/type';
export type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
export type BreakpointMap = Partial<Record<Breakpoint, string>>;
const RowAligns = tuple('top', 'middle', 'bottom');
const RowJustify = tuple('start', 'end', 'center', 'space-around', 'space-between');
export interface RowProps extends React.HTMLAttributes<HTMLDivElement> {
gutter?: number | Partial<Record<Breakpoint, number>>;
type?: 'flex';
align?: 'top' | 'middle' | 'bottom';
justify?: 'start' | 'end' | 'center' | 'space-around' | 'space-between';
align?: (typeof RowAligns)[number];
justify?: (typeof RowJustify)[number];
prefixCls?: string;
}
@ -53,9 +55,9 @@ export default class Row extends React.Component<RowProps, RowState> {
};
static propTypes = {
type: PropTypes.string,
align: PropTypes.string,
justify: PropTypes.string,
type: PropTypes.oneOf<'flex'>(['flex']),
align: PropTypes.oneOf(RowAligns),
justify: PropTypes.oneOf(RowJustify),
className: PropTypes.string,
children: PropTypes.node,
gutter: PropTypes.oneOfType([PropTypes.object, PropTypes.number]),

View File

@ -7,7 +7,7 @@ import Search from './Search';
import TextArea from './TextArea';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import Password from './Password';
import { Omit } from '../_util/type';
import { Omit, tuple } from '../_util/type';
function fixControlledValue<T>(value: T) {
if (typeof value === 'undefined' || value === null) {
@ -16,10 +16,12 @@ function fixControlledValue<T>(value: T) {
return value;
}
const InputSizes = tuple('small', 'default', 'large');
export interface InputProps
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
prefixCls?: string;
size?: 'large' | 'default' | 'small';
size?: (typeof InputSizes)[number];
onPressEnter?: React.KeyboardEventHandler<HTMLInputElement>;
addonBefore?: React.ReactNode;
addonAfter?: React.ReactNode;
@ -40,9 +42,9 @@ export default class Input extends React.Component<InputProps, any> {
static propTypes = {
type: PropTypes.string,
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
size: PropTypes.oneOf(['small', 'default', 'large']),
maxLength: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
id: PropTypes.string,
size: PropTypes.oneOf(InputSizes),
maxLength: PropTypes.number,
disabled: PropTypes.bool,
value: PropTypes.any,
defaultValue: PropTypes.any,

View File

@ -61,21 +61,9 @@ function getGrid(grid: ListGridType, t: ColumnType) {
return grid[t] && Math.floor(24 / grid[t]!);
}
const GridColumns = ['', 1, 2, 3, 4, 6, 8, 12, 24];
export default class Item extends React.Component<ListItemProps, any> {
static Meta: typeof Meta = Meta;
static propTypes = {
column: PropTypes.oneOf(GridColumns),
xs: PropTypes.oneOf(GridColumns),
sm: PropTypes.oneOf(GridColumns),
md: PropTypes.oneOf(GridColumns),
lg: PropTypes.oneOf(GridColumns),
xl: PropTypes.oneOf(GridColumns),
xxl: PropTypes.oneOf(GridColumns),
};
static contextTypes = {
grid: PropTypes.any,
};

View File

@ -42,7 +42,7 @@ export interface ListProps {
itemLayout?: string;
loading?: boolean | SpinProps;
loadMore?: React.ReactNode;
pagination?: PaginationConfig;
pagination?: PaginationConfig | false;
prefixCls?: string;
rowKey?: any;
renderItem: any;
@ -69,7 +69,7 @@ export default class List extends React.Component<ListProps> {
bordered: false,
split: true,
loading: false,
pagination: false,
pagination: false as ListProps['pagination'],
};
state = {

View File

@ -43,7 +43,7 @@ class Mention extends React.Component<MentionProps, MentionState> {
notFoundContent: '无匹配结果,轻敲空格完成输入',
loading: false,
multiLines: false,
placement: 'bottom',
placement: 'bottom' as MentionPlacement,
};
static Nav = Nav;
static toString = toString;

View File

@ -125,8 +125,8 @@ export default class Modal extends React.Component<ModalProps, {}> {
prefixCls: PropTypes.string,
onOk: PropTypes.func,
onCancel: PropTypes.func,
okText: PropTypes.node,
cancelText: PropTypes.node,
okText: PropTypes.string,
cancelText: PropTypes.string,
centered: PropTypes.bool,
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
confirmLoading: PropTypes.bool,

View File

@ -33,9 +33,9 @@ export interface PopconfirmLocale {
class Popconfirm extends React.Component<PopconfirmProps, PopconfirmState> {
static defaultProps = {
transitionName: 'zoom-big',
placement: 'top',
trigger: 'click',
okType: 'primary',
placement: 'top' as PopconfirmProps['placement'],
trigger: 'click' as PopconfirmProps['trigger'],
okType: 'primary' as PopconfirmProps['okType'],
icon: <Icon type="exclamation-circle" theme="filled" />,
};

View File

@ -4,6 +4,7 @@ import Icon from '../icon';
import { Circle } from 'rc-progress';
import classNames from 'classnames';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import { tuple } from '../_util/type';
const statusColorMap: Record<string, string> = {
normal: '#108ee9',
@ -11,7 +12,9 @@ const statusColorMap: Record<string, string> = {
success: '#87d068',
};
export type ProgressType = 'line' | 'circle' | 'dashboard';
const ProgressTypes = tuple('line', 'circle', 'dashboard');
export type ProgressType = (typeof ProgressTypes)[number];
const ProgressStatuses = tuple('normal', 'exception', 'active', 'success');
export type ProgressSize = 'default' | 'small';
export interface ProgressProps {
@ -21,7 +24,7 @@ export interface ProgressProps {
percent?: number;
successPercent?: number;
format?: (percent?: number, successPercent?: number) => React.ReactNode;
status?: 'success' | 'active' | 'exception' | 'normal';
status?: (typeof ProgressStatuses)[number];
showInfo?: boolean;
strokeWidth?: number;
strokeLinecap?: string;
@ -45,16 +48,16 @@ const validProgress = (progress: number | undefined) => {
export default class Progress extends React.Component<ProgressProps, {}> {
static defaultProps = {
type: 'line',
type: 'line' as ProgressProps['type'],
percent: 0,
showInfo: true,
trailColor: '#f3f3f3',
size: 'default',
size: 'default' as ProgressSize,
};
static propTypes = {
status: PropTypes.oneOf(['normal', 'exception', 'active', 'success']),
type: PropTypes.oneOf(['line', 'circle', 'dashboard']),
status: PropTypes.oneOf(ProgressStatuses),
type: PropTypes.oneOf(ProgressTypes),
showInfo: PropTypes.bool,
percent: PropTypes.number,
width: PropTypes.number,

View File

@ -8,12 +8,15 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import omit from 'omit.js';
import warning from 'warning';
import Icon from '../icon';
import { tuple } from '../_util/type';
const SelectSizes = tuple('default', 'large', 'small');
export interface AbstractSelectProps {
prefixCls?: string;
className?: string;
showAction?: string | string[];
size?: 'default' | 'large' | 'small';
size?: (typeof SelectSizes)[number];
notFoundContent?: React.ReactNode | null;
transitionName?: string;
choiceTransitionName?: string;
@ -97,7 +100,7 @@ export interface SelectLocale {
const SelectPropTypes = {
prefixCls: PropTypes.string,
className: PropTypes.string,
size: PropTypes.oneOf(['default', 'large', 'small']),
size: PropTypes.oneOf(SelectSizes),
notFoundContent: PropTypes.any,
showSearch: PropTypes.bool,
optionLabelProp: PropTypes.string,

View File

@ -3,8 +3,10 @@ import * as PropTypes from 'prop-types';
import classNames from 'classnames';
import omit from 'omit.js';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import { tuple } from '../_util/type';
export type SpinSize = 'small' | 'default' | 'large';
const SpinSizes = tuple('small', 'default', 'large');
export type SpinSize = (typeof SpinSizes)[number];
export type SpinIndicator = React.ReactElement<any>;
export interface SpinProps {
@ -67,9 +69,9 @@ class Spin extends React.Component<SpinProps, SpinState> {
prefixCls: PropTypes.string,
className: PropTypes.string,
spinning: PropTypes.bool,
size: PropTypes.oneOf(['small', 'default', 'large']),
size: PropTypes.oneOf(SpinSizes),
wrapperClassName: PropTypes.string,
indicator: PropTypes.node,
indicator: PropTypes.element,
};
static setDefaultIndicator(indicator: React.ReactNode) {

View File

@ -27,7 +27,9 @@ export default class Switch extends React.Component<SwitchProps, {}> {
prefixCls: PropTypes.string,
// HACK: https://github.com/ant-design/ant-design/issues/5368
// size=default and size=large are the same
size: PropTypes.oneOf(['small', 'default', 'large']),
size: PropTypes.oneOf(['small', 'default', 'large']) as PropTypes.Requireable<
SwitchProps['size']
>,
className: PropTypes.string,
};

View File

@ -81,7 +81,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
useFixedHeader: PropTypes.bool,
rowSelection: PropTypes.object,
className: PropTypes.string,
size: PropTypes.string,
size: PropTypes.string as PropTypes.Requireable<TableSize>,
loading: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
bordered: PropTypes.bool,
onChange: PropTypes.func,

View File

@ -51,7 +51,7 @@ export default class Tabs extends React.Component<TabsProps, any> {
static defaultProps = {
hideAdd: false,
tabPosition: 'top',
tabPosition: 'top' as TabsPosition,
};
removeTab = (targetKey: string, e: React.MouseEvent<HTMLElement>) => {

View File

@ -16,6 +16,7 @@ export { TransferSearchProps } from './search';
function noop() {}
export type TransferDirection = 'left' | 'right';
type TransferRender = (record: TransferItem) => React.ReactNode;
export interface TransferItem {
key: string;
@ -31,7 +32,7 @@ export interface TransferProps {
dataSource: TransferItem[];
targetKeys?: string[];
selectedKeys?: string[];
render?: (record: TransferItem) => React.ReactNode;
render?: TransferRender;
onChange?: (targetKeys: string[], direction: string, moveKeys: any) => void;
onSelectChange?: (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => void;
style?: React.CSSProperties;
@ -69,7 +70,7 @@ export default class Transfer extends React.Component<TransferProps, any> {
static defaultProps = {
dataSource: [],
render: noop,
render: noop as TransferRender,
locale: {},
showSearch: false,
};
@ -77,7 +78,7 @@ export default class Transfer extends React.Component<TransferProps, any> {
static propTypes = {
prefixCls: PropTypes.string,
disabled: PropTypes.bool,
dataSource: PropTypes.array,
dataSource: PropTypes.array as PropTypes.Validator<TransferItem[]>,
render: PropTypes.func,
targetKeys: PropTypes.array,
onChange: PropTypes.func,

View File

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "3.11.4",
"version": "3.11.6",
"title": "Ant Design",
"description": "An enterprise-class UI design language and React-based implementation",
"homepage": "http://ant.design/",
@ -101,7 +101,7 @@
"ansi-styles": "^3.2.1",
"@ant-design/colors": "^2.0.0",
"antd-theme-generator": "^1.1.4",
"antd-tools": "^6.4.3",
"antd-tools": "^6.4.4",
"babel-eslint": "^10.0.1",
"bisheng": "^1.0.0",
"bisheng-plugin-antd": "^0.17.0",

View File

@ -33,20 +33,25 @@ a {
background: #fff;
min-height: 500px;
overflow: hidden;
border-left: 1px solid @site-border-color-split;
position: relative;
margin-left: -1px;
}
.main-menu {
z-index: 1;
.ant-menu {
border-color: @site-border-color-split;
&-inner {
overflow-x: hidden;
overflow-y: hidden;
max-height: 100vh;
}
&:hover &-inner {
overflow-y: auto;
}
}
.aside-container {
padding-bottom: 50px;
padding-bottom: 48px;
font-family: Avenir, @font-family;
&.ant-menu-inline .ant-menu-submenu-title h4,

View File

@ -8,8 +8,9 @@ footer {
background-color: #000;
position: relative;
z-index: 100;
margin-left: -1px;
color: rgba(255, 255, 255, 0.65);
box-shadow: 0 1000px 0 1000px #fff;
.ant-row {
text-align: center;
.footer-center {

View File

@ -1,9 +1,7 @@
.prev-next-nav {
position: absolute;
bottom: 0;
left: 0;
width: ~'calc(100% - 194px - 64px)';
margin-left: 64px;
margin-right: 64px;
overflow: hidden;
font-size: 14px;
border-top: 1px solid @site-border-color-split;

View File

@ -1,10 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'bisheng/router';
import { Row, Col, Menu, Icon } from 'antd';
import { Row, Col, Menu, Icon, Affix } from 'antd';
import classNames from 'classnames';
import MobileMenu from 'rc-drawer';
import Article from './Article';
import PrevAndNext from './PrevAndNext';
import Footer from '../Layout/Footer';
import ComponentDoc from './ComponentDoc';
import * as utils from '../utils';
@ -277,39 +279,21 @@ export default class MainContent extends React.PureComponent {
</MobileMenu>
) : (
<Col xxl={4} xl={5} lg={6} md={24} sm={24} xs={24} className="main-menu">
{menuChild}
<Affix>
<section className="main-menu-inner">{menuChild}</section>
</Affix>
</Col>
)}
<Col xxl={20} xl={19} lg={18} md={24} sm={24} xs={24} className={mainContainerClass}>
{props.demos ? (
<ComponentDoc {...props} doc={localizedPageData} demos={props.demos} />
) : (
<Article {...props} content={localizedPageData} />
)}
</Col>
</Row>
<Row>
<Col
xxl={{ span: 20, offset: 4 }}
xl={{ span: 19, offset: 5 }}
lg={{ span: 18, offset: 6 }}
md={24}
sm={24}
xs={24}
>
<section className="prev-next-nav">
{prev
? React.cloneElement(prev.props.children || prev.children[0], {
className: 'prev-page',
})
: null}
{next
? React.cloneElement(next.props.children || next.children[0], {
className: 'next-page',
})
: null}
<Col xxl={20} xl={19} lg={18} md={24} sm={24} xs={24}>
<section className={mainContainerClass}>
{props.demos ? (
<ComponentDoc {...props} doc={localizedPageData} demos={props.demos} />
) : (
<Article {...props} content={localizedPageData} />
)}
</section>
<PrevAndNext prev={prev} next={next} />
<Footer />
</Col>
</Row>
</div>

View File

@ -0,0 +1,16 @@
import React from 'react';
export default ({ prev, next }) => (
<section className="prev-next-nav">
{prev
? React.cloneElement(prev.props.children || prev.children[0], {
className: 'prev-page',
})
: null}
{next
? React.cloneElement(next.props.children || next.children[0], {
className: 'next-page',
})
: null}
</section>
);

View File

@ -6,6 +6,8 @@ import Banner from './Banner';
import Page1 from './Page1';
import Page2 from './Page2';
import Page3 from './Page3';
import Footer from '../Layout/Footer';
// To store style which is only for Home and has conflicts with others.
function getStyle() {
return `
@ -67,13 +69,14 @@ class Home extends React.Component {
const childProps = { ...this.props, isMobile, locale: intl.locale };
return (
<DocumentTitle title={`Ant Design - ${intl.formatMessage({ id: 'app.home.slogan' })}`}>
<div className="main-wrapper">
<>
<style dangerouslySetInnerHTML={{ __html: getStyle() }} /> {/* eslint-disable-line */}
<Banner {...childProps} />
<Page1 {...childProps} />
<Page2 {...childProps} />
<Page3 {...childProps} />
</div>
<Footer />
</>
</DocumentTitle>
);
}

View File

@ -6,7 +6,7 @@ export default () => {
const isChristmas = now.getMonth() === 11 && now.getDate() === 25;
return (
isChristmas && (
<Tooltip title="🎅🏻 Merry Chrismas!">
<Tooltip title="🎅🏻 Merry Christmas!">
<div className="santa">
<div className="santa-body">
<div className="santa-head">

View File

@ -7,7 +7,6 @@ import 'moment/locale/zh-cn';
import { LocaleProvider } from 'antd';
import zhCN from 'antd/lib/locale-provider/zh_CN';
import Header from './Header';
import Footer from './Footer';
import enLocale from '../../en-US';
import cnLocale from '../../zh-CN';
import * as utils from '../utils';
@ -102,7 +101,6 @@ export default class Layout extends React.Component {
<div className="page-wrapper">
<Header {...restProps} />
{children}
<Footer {...restProps} />
</div>
</LocaleProvider>
</IntlProvider>