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
subtitle: 固钉
type: Navigation
type: 导航
title: Affix
---

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -140,17 +140,14 @@
}
}
// Repeat the class selector for prority
// 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-filters {
padding-right: 30px;
}
// https://github.com/ant-design/ant-design/issues/12650
&.@{table-prefix-cls}-column-has-sorters,
&.@{table-prefix-cls}-column-has-filters {
padding-right: 30px !important;
}
&.@{table-prefix-cls}-column-has-sorters.@{table-prefix-cls}-column-has-filters {
padding-right: 54px;
}
&.@{table-prefix-cls}-column-has-sorters.@{table-prefix-cls}-column-has-filters {
padding-right: 54px !important;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
---
category: Components
subtitle: 上传
type: Data Entry
type: 数据录入
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)
Image Crop | [react-image-crop](https://github.com/DominicTobias/react-image-crop)
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>
.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-image-crop](https://github.com/DominicTobias/react-image-crop)
趋势线 | [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>
.markdown table td:first-child {

View File

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