This commit is contained in:
picodoth 2018-11-04 16:37:05 +08:00
commit 28db7dc37f
60 changed files with 112 additions and 78 deletions

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 固钉 subtitle: 固钉
type: Navigation type: 导航
title: Affix title: Affix
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 警告提示 subtitle: 警告提示
type: Feedback type: 反馈
title: Alert title: Alert
--- ---

View File

@ -2,7 +2,7 @@
category: Components category: Components
subtitle: 锚点 subtitle: 锚点
cols: 2 cols: 2
type: Other type: 其他
title: Anchor title: Anchor
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 自动完成 subtitle: 自动完成
type: Data Entry type: 数据录入
cols: 2 cols: 2
title: AutoComplete title: AutoComplete
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 头像 subtitle: 头像
type: Data Display type: 数据展示
title: Avatar title: Avatar
--- ---

View File

@ -1,6 +1,6 @@
--- ---
category: Components category: Components
type: Other type: 其他
subtitle: 回到顶部 subtitle: 回到顶部
title: BackTop title: BackTop
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 徽标数 subtitle: 徽标数
type: Data Display type: 数据展示
title: Badge title: Badge
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 面包屑 subtitle: 面包屑
type: Navigation type: 导航
title: Breadcrumb title: Breadcrumb
--- ---

View File

@ -1,6 +1,6 @@
--- ---
category: Components category: Components
type: General type: 通用
title: Button title: Button
subtitle: 按钮 subtitle: 按钮
--- ---

View File

@ -1,6 +1,6 @@
--- ---
category: Components category: Components
type: Data Display type: 数据展示
subtitle: 日历 subtitle: 日历
cols: 1 cols: 1
title: Calendar title: Calendar

View File

@ -1,6 +1,6 @@
--- ---
category: Components category: Components
type: Data Display type: 数据展示
title: Card title: Card
subtitle: 卡片 subtitle: 卡片
cols: 1 cols: 1

View File

@ -1,6 +1,6 @@
--- ---
category: Components category: Components
type: Data Display type: 数据展示
title: Carousel title: Carousel
subtitle: 走马灯 subtitle: 走马灯
--- ---

View File

@ -1,6 +1,6 @@
--- ---
category: Components category: Components
type: Data Entry type: 数据录入
title: Cascader title: Cascader
subtitle: 级联选择 subtitle: 级联选择
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 多选框 subtitle: 多选框
type: Data Entry type: 数据录入
title: Checkbox title: Checkbox
--- ---

View File

@ -11,6 +11,7 @@ export interface CollapsePanelProps {
showArrow?: boolean; showArrow?: boolean;
prefixCls?: string; prefixCls?: string;
forceRender?: boolean; forceRender?: boolean;
id?: string;
} }
export default class CollapsePanel extends React.Component<CollapsePanelProps, {}> { export default class CollapsePanel extends React.Component<CollapsePanelProps, {}> {

View File

@ -1,6 +1,6 @@
--- ---
category: Components category: Components
type: Data Display type: 数据展示
title: Collapse title: Collapse
subtitle: 折叠面板 subtitle: 折叠面板
cols: 1 cols: 1

View File

@ -12,28 +12,40 @@ import getDataOrAriaProps from '../_util/getDataOrAriaProps';
export interface PickerProps { export interface PickerProps {
value?: moment.Moment; value?: moment.Moment;
open?: boolean;
prefixCls: string; prefixCls: string;
} }
export interface PickerState {
open: boolean;
value: moment.Moment | null;
showDate: moment.Moment | null;
}
export default function createPicker(TheCalendar: React.ComponentClass): any { export default function createPicker(TheCalendar: React.ComponentClass): any {
class CalenderWrapper extends React.Component<any, any> { class CalenderWrapper extends React.Component<any, PickerState> {
static defaultProps = { static defaultProps = {
prefixCls: 'ant-calendar', prefixCls: 'ant-calendar',
allowClear: true, allowClear: true,
showToday: true, showToday: true,
}; };
static getDerivedStateFromProps(nextProps: PickerProps, prevState: any) { static getDerivedStateFromProps(nextProps: PickerProps, prevState: PickerState) {
let state = null; const state: Partial<PickerState> = {};
let open: boolean = prevState.open;
if ('open' in nextProps) {
state.open = nextProps.open;
open = nextProps.open || false;
}
if ('value' in nextProps) { if ('value' in nextProps) {
state = { state.value = nextProps.value;
value: nextProps.value,
}; if (
if (nextProps.value !== prevState.value) { nextProps.value !== prevState.value ||
state = { (!open && nextProps.value !== prevState.showDate)
...state, ) {
showDate: nextProps.value, state.showDate = nextProps.value;
};
} }
} }
return state; return state;
@ -53,6 +65,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
this.state = { this.state = {
value, value,
showDate: value, showDate: value,
open: false,
}; };
} }
@ -87,6 +100,17 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
this.setState({ showDate: value }); this.setState({ showDate: value });
} }
handleOpenChange = (open: boolean) => {
const { onOpenChange } = this.props;
if (!('open' in this.props)) {
this.setState({ open });
}
if (onOpenChange) {
onOpenChange(open);
}
};
focus() { focus() {
this.input.focus(); this.input.focus();
} }
@ -100,7 +124,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
} }
render() { render() {
const { value, showDate } = this.state; const { value, showDate, open } = this.state;
const props = omit(this.props, ['onChange']); const props = omit(this.props, ['onChange']);
const { prefixCls, locale, localeCode, suffixIcon } = props; const { prefixCls, locale, localeCode, suffixIcon } = props;
@ -217,6 +241,8 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
value={value} value={value}
prefixCls={`${prefixCls}-picker-container`} prefixCls={`${prefixCls}-picker-container`}
style={props.popupStyle} style={props.popupStyle}
open={open}
onOpenChange={this.handleOpenChange}
> >
{input} {input}
</RcDatePicker> </RcDatePicker>

View File

@ -1,6 +1,6 @@
--- ---
category: Components category: Components
type: Data Entry type: 数据录入
title: DatePicker title: DatePicker
subtitle: 日期选择框 subtitle: 日期选择框
--- ---

View File

@ -1,6 +1,6 @@
--- ---
category: Components category: Components
type: Other type: 其他
title: Divider title: Divider
subtitle: 分割线 subtitle: 分割线
--- ---

View File

@ -1,5 +1,5 @@
--- ---
type: Feedback type: 反馈
category: Components category: Components
subtitle: 抽屉 subtitle: 抽屉
title: Drawer title: Drawer

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 下拉菜单 subtitle: 下拉菜单
type: Navigation type: 导航
title: Dropdown title: Dropdown
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 表单 subtitle: 表单
type: Data Entry type: 数据录入
cols: 1 cols: 1
title: Form title: Form
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 栅格 subtitle: 栅格
type: Layout type: 布局
cols: 1 cols: 1
title: Grid title: Grid
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 图标 subtitle: 图标
type: General type: 通用
title: Icon title: Icon
toc: false toc: false
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 数字输入框 subtitle: 数字输入框
type: Data Entry type: 数据录入
title: InputNumber title: InputNumber
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 输入框 subtitle: 输入框
type: Data Entry type: 数据录入
title: Input title: Input
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 布局 subtitle: 布局
type: Layout type: 布局
cols: 1 cols: 1
title: Layout title: Layout
--- ---

View File

@ -1,6 +1,6 @@
--- ---
category: Components category: Components
type: Data Display type: 数据展示
title: List title: List
subtitle: 列表 subtitle: 列表
cols: 1 cols: 1

View File

@ -2,7 +2,7 @@
category: Components category: Components
subtitle: 国际化 subtitle: 国际化
cols: 1 cols: 1
type: Other type: 其他
title: LocaleProvider title: LocaleProvider
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 提及 subtitle: 提及
type: Data Entry type: 数据录入
title: Mention title: Mention
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
cols: 1 cols: 1
type: Navigation type: 导航
title: Menu title: Menu
subtitle: 导航菜单 subtitle: 导航菜单
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 全局提示 subtitle: 全局提示
type: Feedback type: 反馈
noinstant: true noinstant: true
title: Message title: Message
--- ---

View File

@ -1,5 +1,5 @@
--- ---
type: Feedback type: 反馈
category: Components category: Components
subtitle: 对话框 subtitle: 对话框
title: Modal title: Modal

View File

@ -1,6 +1,6 @@
--- ---
category: Components category: Components
type: Feedback type: 反馈
noinstant: true noinstant: true
title: Notification title: Notification
subtitle: 通知提醒框 subtitle: 通知提醒框

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 分页 subtitle: 分页
type: Navigation type: 导航
title: Pagination title: Pagination
cols: 1 cols: 1
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 气泡确认框 subtitle: 气泡确认框
type: Feedback type: 反馈
title: Popconfirm title: Popconfirm
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 气泡卡片 subtitle: 气泡卡片
type: Data Display type: 数据展示
title: Popover title: Popover
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 进度条 subtitle: 进度条
type: Feedback type: 反馈
title: Progress title: Progress
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 单选框 subtitle: 单选框
type: Data Entry type: 数据录入
title: Radio title: Radio
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 评分 subtitle: 评分
type: Data Entry type: 数据录入
title: Rate title: Rate
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 选择器 subtitle: 选择器
type: Data Entry type: 数据录入
title: Select title: Select
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 骨架屏 subtitle: 骨架屏
type: Feedback type: 反馈
title: Skeleton title: Skeleton
cols: 1 cols: 1
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 滑动输入条 subtitle: 滑动输入条
type: Data Entry type: 数据录入
title: Slider title: Slider
--- ---

View File

@ -1,6 +1,6 @@
--- ---
category: Components category: Components
type: Feedback type: 反馈
title: Spin title: Spin
subtitle: 加载中 subtitle: 加载中
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 步骤条 subtitle: 步骤条
type: Navigation type: 导航
cols: 1 cols: 1
title: Steps title: Steps
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 开关 subtitle: 开关
type: Data Entry type: 数据录入
title: Switch title: Switch
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
cols: 1 cols: 1
type: Data Display type: 数据展示
title: Table title: Table
subtitle: 表格 subtitle: 表格
--- ---

View File

@ -140,17 +140,14 @@
} }
} }
// Repeat the class selector for prority // https://github.com/ant-design/ant-design/issues/12650
// https://github.com/ant-design/ant-design/commit/55a13a11fcea23fc4b5694cad7e2c32edc9128ee#r30842052
&.@{table-prefix-cls}-align-right.@{table-prefix-cls}-align-right {
&.@{table-prefix-cls}-column-has-sorters, &.@{table-prefix-cls}-column-has-sorters,
&.@{table-prefix-cls}-column-has-filters { &.@{table-prefix-cls}-column-has-filters {
padding-right: 30px; padding-right: 30px !important;
} }
&.@{table-prefix-cls}-column-has-sorters.@{table-prefix-cls}-column-has-filters { &.@{table-prefix-cls}-column-has-sorters.@{table-prefix-cls}-column-has-filters {
padding-right: 54px; padding-right: 54px !important;
}
} }
} }

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 标签页 subtitle: 标签页
type: Data Display type: 数据展示
title: Tabs title: Tabs
cols: 1 cols: 1
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 标签 subtitle: 标签
type: Data Display type: 数据展示
title: Tag title: Tag
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 时间选择框 subtitle: 时间选择框
type: Data Entry type: 数据录入
title: TimePicker title: TimePicker
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 时间轴 subtitle: 时间轴
type: Data Display type: 数据展示
title: Timeline title: Timeline
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 文字提示 subtitle: 文字提示
type: Data Display type: 数据展示
title: Tooltip title: Tooltip
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 穿梭框 subtitle: 穿梭框
type: Data Entry type: 数据录入
cols: 1 cols: 1
title: Transfer title: Transfer
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 树选择 subtitle: 树选择
type: Data Entry type: 数据录入
title: TreeSelect title: TreeSelect
--- ---

View File

@ -1,6 +1,6 @@
--- ---
category: Components category: Components
type: Data Display type: 数据展示
title: Tree title: Tree
subtitle: 树形控件 subtitle: 树形控件
--- ---

View File

@ -1,7 +1,7 @@
--- ---
category: Components category: Components
subtitle: 上传 subtitle: 上传
type: Data Entry type: 数据录入
title: Upload title: Upload
--- ---

View File

@ -31,6 +31,8 @@ Emoji | [emoji-mart](https://github.com/missive/emoji-mart)
Split View | [react-split-pane](https://github.com/tomkp/react-split-pane) Split View | [react-split-pane](https://github.com/tomkp/react-split-pane)
Image Crop | [react-image-crop](https://github.com/DominicTobias/react-image-crop) Image Crop | [react-image-crop](https://github.com/DominicTobias/react-image-crop)
Trend Lines | [react-sparklines](https://github.com/borisyankov/react-sparklines) Trend Lines | [react-sparklines](https://github.com/borisyankov/react-sparklines)
Formatted Input | [text-mask](https://github.com/text-mask/text-mask)
Animation | [react-move](https://github.com/react-tools/react-move) [Ant Motion](https://motion.ant.design/components/tween-one)
<style> <style>
.markdown table td:first-child { .markdown table td:first-child {

View File

@ -31,6 +31,8 @@ Emoji | [emoji-mart](https://github.com/missive/emoji-mart)
分割面板 | [react-split-pane](https://github.com/tomkp/react-split-pane) 分割面板 | [react-split-pane](https://github.com/tomkp/react-split-pane)
图片裁切 | [react-image-crop](https://github.com/DominicTobias/react-image-crop) 图片裁切 | [react-image-crop](https://github.com/DominicTobias/react-image-crop)
趋势线 | [react-sparklines](https://github.com/borisyankov/react-sparklines) 趋势线 | [react-sparklines](https://github.com/borisyankov/react-sparklines)
格式化输入 | [text-mask](https://github.com/text-mask/text-mask)
动画 | [react-move](https://github.com/react-tools/react-move) [Ant Motion](https://motion.ant.design/components/tween-one)
<style> <style>
.markdown table td:first-child { .markdown table td:first-child {

View File

@ -71,8 +71,14 @@ module.exports = {
'Data Entry': 3, 'Data Entry': 3,
'Data Display': 4, 'Data Display': 4,
Feedback: 5, Feedback: 5,
Localization: 6, Other: 6,
Other: 7, 通用: 0,
布局: 1,
导航: 2,
数据录入: 3,
数据展示: 4,
反馈: 5,
其他: 6,
}, },
docVersions: { docVersions: {
'0.9.x': 'http://09x.ant.design', '0.9.x': 'http://09x.ant.design',