diff --git a/components/time-picker/demo/disable-options.md b/components/time-picker/demo/disable-options.md new file mode 100644 index 0000000000000000000000000000000000000000..eb783c1f2deed0cd1bc2f467c46e9376bbf00476 --- /dev/null +++ b/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( + +, document.getElementById('components-time-picker-demo-disable-options')); +```` diff --git a/components/time-picker/demo/hide-options.md b/components/time-picker/demo/hide-options.md new file mode 100644 index 0000000000000000000000000000000000000000..5245e69164bd7b6aa223e80a075ab65804304cbf --- /dev/null +++ b/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( + +, document.getElementById('components-time-picker-demo-hide-options')); +```` diff --git a/components/time-picker/demo/size.md b/components/time-picker/demo/size.md index bd1db78974706e92d5802495038f7ec8ed9208e3..4f7c63148fcf0acb1f7258368cfccee446b164f4 100644 --- a/components/time-picker/demo/size.md +++ b/components/time-picker/demo/size.md @@ -1,6 +1,6 @@ # 三种大小 -- order: 6 +- order: 2 三种大小的输入框,大的用在表单中,中的为默认。 diff --git a/components/time-picker/demo/special-minutes.md b/components/time-picker/demo/special-minutes.md deleted file mode 100644 index 8a266ef0b892da0f973503ff3dca868d2bd9ba39..0000000000000000000000000000000000000000 --- a/components/time-picker/demo/special-minutes.md +++ /dev/null @@ -1,15 +0,0 @@ -# 特定选项 - -- order: 3 - -分钟只提供特定的选择,同时可以通过 `hourOptions` 和 `secondOptions` 对小时和秒进行特殊的限定。 - ---- - -````jsx -import { TimePicker } from 'antd'; - -ReactDOM.render( - -, document.getElementById('components-time-picker-demo-special-minutes')); -```` diff --git a/components/time-picker/demo/value.md b/components/time-picker/demo/value.md index bfdbe9bdde19edd6c1f63985122e17ceb88757df..6ceec1dc9383c76284c28844b61d02f78b2d5fab 100644 --- a/components/time-picker/demo/value.md +++ b/components/time-picker/demo/value.md @@ -1,6 +1,6 @@ # 受控组件 -- order: 6 +- order: 1 value 和 onChange 需要配合使用。 diff --git a/components/time-picker/demo/without-seconds.md b/components/time-picker/demo/without-seconds.md index 3d2e484c7561da4ee392a6e918c5c3c30184a5af..bc0992bf16ebe27b6faa3d7731a46ecdf6e0b5ed 100644 --- a/components/time-picker/demo/without-seconds.md +++ b/components/time-picker/demo/without-seconds.md @@ -1,6 +1,6 @@ # 不展示秒 -- order: 2 +- order: 3 不展示秒,也不允许选择。 diff --git a/components/time-picker/index.jsx b/components/time-picker/index.jsx index 721025a054f5a4852aec2cc07f3a192e18f21e9b..259773e6c52b282e428b76a3472885fe5448a72a 100644 --- a/components/time-picker/index.jsx +++ b/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 ( ``` -| 参数 | 说明 | 类型 | 默认值 | -|-----------------|-----|-----|-------| -| 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) | diff --git a/package.json b/package.json index cf2d28bf6004a1484d880f2b12a1d47f6136349c..c65d44d41b95be31997653ea169fc33a82864ee3 100644 --- a/package.json +++ b/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", diff --git a/style/components/timepicker/Select.less b/style/components/timepicker/Select.less index 9bce4570e624015c19c8f60d65c29be6cb0d820c..c73cab4be5ad0a386718647449e0369be0c0925f 100644 --- a/style/components/timepicker/Select.less +++ b/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; + } + } } }