Browse Source

update time-picker to 1.0.0-alpha9

pull/691/head
MG12 9 years ago
parent
commit
ece8eaa7ad
  1. 27
      components/time-picker/demo/disable-options.md
  2. 27
      components/time-picker/demo/hide-options.md
  3. 2
      components/time-picker/demo/size.md
  4. 15
      components/time-picker/demo/special-minutes.md
  5. 2
      components/time-picker/demo/value.md
  6. 2
      components/time-picker/demo/without-seconds.md
  7. 8
      components/time-picker/index.jsx
  8. 25
      components/time-picker/index.md
  9. 6
      package.json
  10. 8
      style/components/timepicker/Select.less

27
components/time-picker/demo/disable-options.md

@ -0,0 +1,27 @@
# 禁止选项
- order: 5
禁止部分选项。
---
````jsx
import { TimePicker } from 'antd';
function disabledHours() {
return [0, 4, 8, 12, 16, 20];
}
function disabledMinutes(h) {
return [h % 60];
}
function disabledSeconds(h, m) {
return [h + m % 60];
}
ReactDOM.render(
<TimePicker defaultValue="12:08:23" disabledHours={disabledHours} disabledMinutes={disabledMinutes} disabledSeconds={disabledSeconds} />
, document.getElementById('components-time-picker-demo-disable-options'));
````

27
components/time-picker/demo/hide-options.md

@ -0,0 +1,27 @@
# 隐藏选项
- order: 6
禁止部分选项。
---
````jsx
import { TimePicker } from 'antd';
function disabledHours() {
return [0, 4, 8, 12, 16, 20];
}
function disabledMinutes(h) {
return [h % 60];
}
function disabledSeconds(h, m) {
return [h + m % 60];
}
ReactDOM.render(
<TimePicker defaultValue="12:08:23" disabledHours={disabledHours} disabledMinutes={disabledMinutes} disabledSeconds={disabledSeconds} hideDisabledOptions />
, document.getElementById('components-time-picker-demo-hide-options'));
````

2
components/time-picker/demo/size.md

@ -1,6 +1,6 @@
# 三种大小
- order: 6
- order: 2
三种大小的输入框,大的用在表单中,中的为默认。

15
components/time-picker/demo/special-minutes.md

@ -1,15 +0,0 @@
# 特定选项
- order: 3
分钟只提供特定的选择,同时可以通过 `hourOptions``secondOptions` 对小时和秒进行特殊的限定。
---
````jsx
import { TimePicker } from 'antd';
ReactDOM.render(
<TimePicker defaultValue="12:30:23" format="HH:mm" minuteOptions={[0, 30]} />
, document.getElementById('components-time-picker-demo-special-minutes'));
````

2
components/time-picker/demo/value.md

@ -1,6 +1,6 @@
# 受控组件
- order: 6
- order: 1
value 和 onChange 需要配合使用。

2
components/time-picker/demo/without-seconds.md

@ -1,6 +1,6 @@
# 不展示秒
- order: 2
- order: 3
不展示秒,也不允许选择。

8
components/time-picker/index.jsx

@ -17,9 +17,10 @@ const AntTimePicker = React.createClass({
},
open: false,
disabled: false,
hourOptions: undefined,
minuteOptions: undefined,
secondOptions: undefined,
disabledHours: undefined,
disabledMinutes: undefined,
disabledSeconds: undefined,
hideDisabledOptions: false,
size: 'default',
placement: 'bottomLeft',
transitionName: 'slide-up',
@ -91,6 +92,7 @@ const AntTimePicker = React.createClass({
if (props.format.indexOf('HH') < 0) {
props.showHour = false;
}
return (
<TimePicker
{...props}

25
components/time-picker/index.md

@ -20,17 +20,18 @@ API
<TimePicker defaultValue="13:30:56" />
```
| 参数 | 说明 | 类型 | 默认值 |
|-----------------|-----|-----|-------|
| defaultValue | 初始默认时间 | string | 无 |
| value | 默认时间 | string | 无 |
| placeholder | 没有值的时候显示的内容 | string | "请选择时间" |
| onChange | 时间发生变化的回调 | function(Date value) | 无 |
| format | 展示的时间格式 | string | "HH:mm:ss"、"HH:mm"、"mm:ss" |
| disabled | 禁用 | bool | false |
| hourOptions | 特定可选择的小时 | array | 0 到 24 组成的数组 |
| minuteOptions | 特定可选择的分钟 | array | 0 到 60 组成的数组 |
| secondOptions | 特定可选择的秒 | array | 0 到 60 组成的数组 |
| locale | 国际化配置 | Object | [默认配置](https://github.com/ant-design/ant-design/issues/424) |
| 参数 | 说明 | 类型 | 默认值 |
|---------------------|-----|-----|-------|
| defaultValue | 初始默认时间 | string | 无 |
| value | 默认时间 | string | 无 |
| placeholder | 没有值的时候显示的内容 | string | "请选择时间" |
| onChange | 时间发生变化的回调 | function(Date value) | 无 |
| format | 展示的时间格式 | string | "HH:mm:ss"、"HH:mm"、"mm:ss" |
| disabled | 禁用全部操作 | bool | false |
| disabledHours | 禁止选择部分小时选项 | function() | 无 |
| disabledMinutes | 禁止选择部分分钟选项 | function(selectedHour) | 无 |
| disabledSeconds | 禁止选择部分秒选项 | function(selectedHour, selectedMinute) | 无 |
| hideDisabledOptions | 隐藏禁止选择的选项 | boolean | false |
| locale | 国际化配置 | Object | [默认配置](https://github.com/ant-design/ant-design/issues/424) |
<style>.code-box-demo .ant-time-picker { margin: 0 8px 12px 0; }</style>

6
package.json

@ -1,7 +1,7 @@
{
"name": "antd",
"version": "0.10.4",
"stableVersion": "0.10.4",
"version": "0.10.5",
"stableVersion": "0.10.5",
"title": "Ant Design",
"description": "一个 UI 设计语言",
"homepage": "http://ant.design/",
@ -58,7 +58,7 @@
"rc-switch": "~1.3.1",
"rc-table": "~3.6.2",
"rc-tabs": "~5.5.0",
"rc-time-picker": "1.0.0-alpha6",
"rc-time-picker": "1.0.0-alpha9",
"rc-tooltip": "~3.2.0",
"rc-tree": "~0.19.0",
"rc-trigger": "~1.0.6",

8
style/components/timepicker/Select.less

@ -51,5 +51,13 @@
&.@{timepicker-prefix-cls}-panel-select-option-selected {
background: tint(@primary-color, 80%);
}
&.@{timepicker-prefix-cls}-panel-select-option-disabled {
color: @btn-disable-color;
&:hover {
background: transparent;
cursor: @cursor-disabled;
}
}
}
}

Loading…
Cancel
Save