diff options
author | 崖鹰 <zhao.wuz@alipay.com> | 2015-11-17 22:22:04 +0800 |
---|---|---|
committer | 崖鹰 <zhao.wuz@alipay.com> | 2015-11-17 22:22:04 +0800 |
commit | 5f023ca8d12cabc6b03e6d83f4fd8486819bb38f (patch) | |
tree | dffbb56d5245f4e37a3744abcfdef1a11dcf09a4 /examples/pick-time.js | |
parent | 80256746c1b81af8b19a4df9a93029e904d03859 (diff) | |
download | time-picker-5f023ca8d12cabc6b03e6d83f4fd8486819bb38f.tar.gz time-picker-5f023ca8d12cabc6b03e6d83f4fd8486819bb38f.tar.zst time-picker-5f023ca8d12cabc6b03e6d83f4fd8486819bb38f.zip |
Updates
Diffstat (limited to 'examples/pick-time.js')
-rw-r--r-- | examples/pick-time.js | 480 |
1 files changed, 246 insertions, 234 deletions
diff --git a/examples/pick-time.js b/examples/pick-time.js index 0bce1d3..09503fd 100644 --- a/examples/pick-time.js +++ b/examples/pick-time.js | |||
@@ -39,10 +39,6 @@ webpackJsonp([0,1],[ | |||
39 | 39 | ||
40 | var _rcTimePickerSrcTimePicker2 = _interopRequireDefault(_rcTimePickerSrcTimePicker); | 40 | var _rcTimePickerSrcTimePicker2 = _interopRequireDefault(_rcTimePickerSrcTimePicker); |
41 | 41 | ||
42 | var _rcTimePickerSrcTimePanel = __webpack_require__(230); | ||
43 | |||
44 | var _rcTimePickerSrcTimePanel2 = _interopRequireDefault(_rcTimePickerSrcTimePanel); | ||
45 | |||
46 | var _rcTimePickerSrcLocaleZh_CN = __webpack_require__(234); | 42 | var _rcTimePickerSrcLocaleZh_CN = __webpack_require__(234); |
47 | 43 | ||
48 | var _rcTimePickerSrcLocaleZh_CN2 = _interopRequireDefault(_rcTimePickerSrcLocaleZh_CN); | 44 | var _rcTimePickerSrcLocaleZh_CN2 = _interopRequireDefault(_rcTimePickerSrcLocaleZh_CN); |
@@ -52,22 +48,7 @@ webpackJsonp([0,1],[ | |||
52 | var now = new _gregorianCalendar2['default'](_gregorianCalendarLibLocaleZh_CN2['default']); | 48 | var now = new _gregorianCalendar2['default'](_gregorianCalendarLibLocaleZh_CN2['default']); |
53 | now.setTime(Date.now()); | 49 | now.setTime(Date.now()); |
54 | 50 | ||
55 | var timePanel = _react2['default'].createElement(_rcTimePickerSrcTimePanel2['default'], { | 51 | _reactDom2['default'].render(_react2['default'].createElement(_rcTimePickerSrcTimePicker2['default'], { formatter: formatter, locale: _rcTimePickerSrcLocaleZh_CN2['default'], value: now }), document.getElementById('__react-content')); |
56 | defaultValue: now, | ||
57 | locale: _rcTimePickerSrcLocaleZh_CN2['default'], | ||
58 | formatter: formatter, | ||
59 | minuteOptions: [0, 30] | ||
60 | }); | ||
61 | |||
62 | _reactDom2['default'].render(_react2['default'].createElement( | ||
63 | _rcTimePickerSrcTimePicker2['default'], | ||
64 | { panel: timePanel, value: now }, | ||
65 | function (_ref) { | ||
66 | var value = _ref.value; | ||
67 | |||
68 | return _react2['default'].createElement('input', { type: 'text', placeholder: '请选择时间', readOnly: true, value: value && formatter.format(value) }); | ||
69 | } | ||
70 | ), document.getElementById('__react-content')); | ||
71 | 52 | ||
72 | /***/ }, | 53 | /***/ }, |
73 | /* 2 */ | 54 | /* 2 */ |
@@ -22234,7 +22215,11 @@ webpackJsonp([0,1],[ | |||
22234 | 22215 | ||
22235 | var _rcUtil = __webpack_require__(211); | 22216 | var _rcUtil = __webpack_require__(211); |
22236 | 22217 | ||
22237 | var _utilPlacements = __webpack_require__(226); | 22218 | var _rcTimePickerSrcModulePanel = __webpack_require__(226); |
22219 | |||
22220 | var _rcTimePickerSrcModulePanel2 = _interopRequireDefault(_rcTimePickerSrcModulePanel); | ||
22221 | |||
22222 | var _utilPlacements = __webpack_require__(233); | ||
22238 | 22223 | ||
22239 | var _utilPlacements2 = _interopRequireDefault(_utilPlacements); | 22224 | var _utilPlacements2 = _interopRequireDefault(_utilPlacements); |
22240 | 22225 | ||
@@ -22253,7 +22238,7 @@ webpackJsonp([0,1],[ | |||
22253 | 22238 | ||
22254 | propTypes: { | 22239 | propTypes: { |
22255 | prefixCls: _react.PropTypes.string, | 22240 | prefixCls: _react.PropTypes.string, |
22256 | panel: _react.PropTypes.element, | 22241 | locale: _react.PropTypes.object, |
22257 | children: _react.PropTypes.func, | 22242 | children: _react.PropTypes.func, |
22258 | disabled: _react.PropTypes.bool, | 22243 | disabled: _react.PropTypes.bool, |
22259 | value: _react.PropTypes.object, | 22244 | value: _react.PropTypes.object, |
@@ -22261,6 +22246,11 @@ webpackJsonp([0,1],[ | |||
22261 | align: _react.PropTypes.object, | 22246 | align: _react.PropTypes.object, |
22262 | placement: _react.PropTypes.any, | 22247 | placement: _react.PropTypes.any, |
22263 | transitionName: _react.PropTypes.string, | 22248 | transitionName: _react.PropTypes.string, |
22249 | placeholder: _react.PropTypes.string, | ||
22250 | formatter: _react.PropTypes.object, | ||
22251 | hourOptions: _react.PropTypes.array, | ||
22252 | minuteOptions: _react.PropTypes.array, | ||
22253 | secondOptions: _react.PropTypes.array, | ||
22264 | onChange: _react.PropTypes.func, | 22254 | onChange: _react.PropTypes.func, |
22265 | onOpen: _react.PropTypes.func, | 22255 | onOpen: _react.PropTypes.func, |
22266 | onClose: _react.PropTypes.func | 22256 | onClose: _react.PropTypes.func |
@@ -22309,7 +22299,7 @@ webpackJsonp([0,1],[ | |||
22309 | }, | 22299 | }, |
22310 | 22300 | ||
22311 | onPanelClear: function onPanelClear() { | 22301 | onPanelClear: function onPanelClear() { |
22312 | this.setOpen(false, this.focus); | 22302 | this.setOpen(false); |
22313 | }, | 22303 | }, |
22314 | 22304 | ||
22315 | onVisibleChange: function onVisibleChange(open) { | 22305 | onVisibleChange: function onVisibleChange(open) { |
@@ -22317,13 +22307,35 @@ webpackJsonp([0,1],[ | |||
22317 | 22307 | ||
22318 | this.setOpen(open, function () { | 22308 | this.setOpen(open, function () { |
22319 | if (open) { | 22309 | if (open) { |
22310 | _reactDom2['default'].findDOMNode(_this.refs.picker).blur(); | ||
22320 | _reactDom2['default'].findDOMNode(_this.panelInstance).focus(); | 22311 | _reactDom2['default'].findDOMNode(_this.panelInstance).focus(); |
22321 | } | 22312 | } |
22322 | }); | 22313 | }); |
22323 | }, | 22314 | }, |
22324 | 22315 | ||
22316 | getPanel: function getPanel() { | ||
22317 | var _props2 = this.props; | ||
22318 | var value = _props2.value; | ||
22319 | var locale = _props2.locale; | ||
22320 | var formatter = _props2.formatter; | ||
22321 | var placeholder = _props2.placeholder; | ||
22322 | var hourOptions = _props2.hourOptions; | ||
22323 | var minuteOptions = _props2.minuteOptions; | ||
22324 | var secondOptions = _props2.secondOptions; | ||
22325 | |||
22326 | return _react2['default'].createElement(_rcTimePickerSrcModulePanel2['default'], { | ||
22327 | defaultValue: value, | ||
22328 | locale: locale, | ||
22329 | formatter: formatter, | ||
22330 | placeholder: placeholder, | ||
22331 | hourOptions: hourOptions, | ||
22332 | minuteOptions: minuteOptions, | ||
22333 | secondOptions: secondOptions | ||
22334 | }); | ||
22335 | }, | ||
22336 | |||
22325 | getPanelElement: function getPanelElement() { | 22337 | getPanelElement: function getPanelElement() { |
22326 | var panel = this.props.panel; | 22338 | var panel = this.getPanel(); |
22327 | var extraProps = { | 22339 | var extraProps = { |
22328 | ref: this.savePanelRef, | 22340 | ref: this.savePanelRef, |
22329 | defaultValue: this.state.value || panel.props.defaultValue, | 22341 | defaultValue: this.state.value || panel.props.defaultValue, |
@@ -22335,9 +22347,9 @@ webpackJsonp([0,1],[ | |||
22335 | }, | 22347 | }, |
22336 | 22348 | ||
22337 | setOpen: function setOpen(open, callback) { | 22349 | setOpen: function setOpen(open, callback) { |
22338 | var _props2 = this.props; | 22350 | var _props3 = this.props; |
22339 | var onOpen = _props2.onOpen; | 22351 | var onOpen = _props3.onOpen; |
22340 | var onClose = _props2.onClose; | 22352 | var onClose = _props3.onClose; |
22341 | 22353 | ||
22342 | if (this.state.open !== open) { | 22354 | if (this.state.open !== open) { |
22343 | this.setState({ | 22355 | this.setState({ |
@@ -22354,21 +22366,18 @@ webpackJsonp([0,1],[ | |||
22354 | } | 22366 | } |
22355 | }, | 22367 | }, |
22356 | 22368 | ||
22357 | focus: function focus() { | ||
22358 | if (!this.state.open) { | ||
22359 | _reactDom2['default'].findDOMNode(this).focus(); | ||
22360 | } | ||
22361 | }, | ||
22362 | |||
22363 | render: function render() { | 22369 | render: function render() { |
22364 | var state = this.state; | 22370 | var _props4 = this.props; |
22365 | var props = this.props; | 22371 | var prefixCls = _props4.prefixCls; |
22366 | var prefixCls = props.prefixCls; | 22372 | var placement = _props4.placement; |
22367 | var placement = props.placement; | 22373 | var align = _props4.align; |
22368 | var align = props.align; | 22374 | var disabled = _props4.disabled; |
22369 | var disabled = props.disabled; | 22375 | var transitionName = _props4.transitionName; |
22370 | var transitionName = props.transitionName; | 22376 | var children = _props4.children; |
22371 | var children = props.children; | 22377 | var formatter = _props4.formatter; |
22378 | var _state = this.state; | ||
22379 | var open = _state.open; | ||
22380 | var value = _state.value; | ||
22372 | 22381 | ||
22373 | return _react2['default'].createElement( | 22382 | return _react2['default'].createElement( |
22374 | _rcTrigger2['default'], | 22383 | _rcTrigger2['default'], |
@@ -22381,13 +22390,13 @@ webpackJsonp([0,1],[ | |||
22381 | action: disabled ? [] : ['click'], | 22390 | action: disabled ? [] : ['click'], |
22382 | destroyPopupOnHide: true, | 22391 | destroyPopupOnHide: true, |
22383 | popupTransitionName: transitionName, | 22392 | popupTransitionName: transitionName, |
22384 | popupVisible: state.open, | 22393 | popupVisible: open, |
22385 | onPopupVisibleChange: this.onVisibleChange | 22394 | onPopupVisibleChange: this.onVisibleChange |
22386 | }, | 22395 | }, |
22387 | _react2['default'].createElement( | 22396 | _react2['default'].createElement( |
22388 | 'span', | 22397 | 'span', |
22389 | { className: prefixCls + '-picker' }, | 22398 | { className: prefixCls + '-picker' }, |
22390 | children(state, props) | 22399 | _react2['default'].createElement('input', { ref: 'picker', type: 'text', placeholder: '请选择时间', readOnly: true, disabled: disabled, value: value && formatter.format(value) }) |
22391 | ) | 22400 | ) |
22392 | ); | 22401 | ); |
22393 | } | 22402 | } |
@@ -24445,23 +24454,13 @@ webpackJsonp([0,1],[ | |||
24445 | offset[1] = convertOffset(offset[1], el.height); | 24454 | offset[1] = convertOffset(offset[1], el.height); |
24446 | } | 24455 | } |
24447 | 24456 | ||
24448 | /* | ||
24449 | * align node | ||
24450 | * @param {Element} node current dom node | ||
24451 | * @param {Object} align align config | ||
24452 | * | ||
24453 | * @example | ||
24454 | * { | ||
24455 | * node: null, // 参考元素, falsy 或 window 为可视区域, 'trigger' 为触发元素, 其他为指定元素 | ||
24456 | * points: ['cc','cc'], // ['tr', 'tl'] 表示 overlay 的 tr 与参考节点的 tl 对齐 | ||
24457 | * offset: [0, 0] // 有效值为 [n, m] | ||
24458 | * } | ||
24459 | */ | ||
24460 | function domAlign(el, refNode, align) { | 24457 | function domAlign(el, refNode, align) { |
24461 | var points = align.points; | 24458 | var points = align.points; |
24462 | var offset = align.offset || [0, 0]; | 24459 | var offset = align.offset || [0, 0]; |
24463 | var targetOffset = align.targetOffset || [0, 0]; | 24460 | var targetOffset = align.targetOffset || [0, 0]; |
24464 | var overflow = align.overflow; | 24461 | var overflow = align.overflow; |
24462 | var target = align.target || refNode; | ||
24463 | var source = align.source || el; | ||
24465 | offset = [].concat(offset); | 24464 | offset = [].concat(offset); |
24466 | targetOffset = [].concat(targetOffset); | 24465 | targetOffset = [].concat(targetOffset); |
24467 | overflow = overflow || {}; | 24466 | overflow = overflow || {}; |
@@ -24469,11 +24468,11 @@ webpackJsonp([0,1],[ | |||
24469 | 24468 | ||
24470 | var fail = 0; | 24469 | var fail = 0; |
24471 | // 当前节点可以被放置的显示区域 | 24470 | // 当前节点可以被放置的显示区域 |
24472 | var visibleRect = (0, _getVisibleRectForElement2['default'])(el); | 24471 | var visibleRect = (0, _getVisibleRectForElement2['default'])(source); |
24473 | // 当前节点所占的区域, left/top/width/height | 24472 | // 当前节点所占的区域, left/top/width/height |
24474 | var elRegion = (0, _getRegion2['default'])(el); | 24473 | var elRegion = (0, _getRegion2['default'])(source); |
24475 | // 参照节点所占的区域, left/top/width/height | 24474 | // 参照节点所占的区域, left/top/width/height |
24476 | var refNodeRegion = (0, _getRegion2['default'])(refNode); | 24475 | var refNodeRegion = (0, _getRegion2['default'])(target); |
24477 | // 将 offset 转换成数值,支持百分比 | 24476 | // 将 offset 转换成数值,支持百分比 |
24478 | normalizeOffset(offset, elRegion); | 24477 | normalizeOffset(offset, elRegion); |
24479 | normalizeOffset(targetOffset, refNodeRegion); | 24478 | normalizeOffset(targetOffset, refNodeRegion); |
@@ -24534,18 +24533,18 @@ webpackJsonp([0,1],[ | |||
24534 | 24533 | ||
24535 | // need judge to in case set fixed with in css on height auto element | 24534 | // need judge to in case set fixed with in css on height auto element |
24536 | if (newElRegion.width !== elRegion.width) { | 24535 | if (newElRegion.width !== elRegion.width) { |
24537 | _utils2['default'].css(el, 'width', el.width() + newElRegion.width - elRegion.width); | 24536 | _utils2['default'].css(source, 'width', source.width() + newElRegion.width - elRegion.width); |
24538 | } | 24537 | } |
24539 | 24538 | ||
24540 | if (newElRegion.height !== elRegion.height) { | 24539 | if (newElRegion.height !== elRegion.height) { |
24541 | _utils2['default'].css(el, 'height', el.height() + newElRegion.height - elRegion.height); | 24540 | _utils2['default'].css(source, 'height', source.height() + newElRegion.height - elRegion.height); |
24542 | } | 24541 | } |
24543 | 24542 | ||
24544 | // https://github.com/kissyteam/kissy/issues/190 | 24543 | // https://github.com/kissyteam/kissy/issues/190 |
24545 | // http://localhost:8888/kissy/src/overlay/demo/other/relative_align/align.html | 24544 | // http://localhost:8888/kissy/src/overlay/demo/other/relative_align/align.html |
24546 | // 相对于屏幕位置没变,而 left/top 变了 | 24545 | // 相对于屏幕位置没变,而 left/top 变了 |
24547 | // 例如 <div 'relative'><el absolute></div> | 24546 | // 例如 <div 'relative'><el absolute></div> |
24548 | _utils2['default'].offset(el, { | 24547 | _utils2['default'].offset(source, { |
24549 | left: newElRegion.left, | 24548 | left: newElRegion.left, |
24550 | top: newElRegion.top | 24549 | top: newElRegion.top |
24551 | }, { | 24550 | }, { |
@@ -27558,52 +27557,6 @@ webpackJsonp([0,1],[ | |||
27558 | 27557 | ||
27559 | /***/ }, | 27558 | /***/ }, |
27560 | /* 226 */ | 27559 | /* 226 */ |
27561 | /***/ function(module, exports) { | ||
27562 | |||
27563 | 'use strict'; | ||
27564 | |||
27565 | Object.defineProperty(exports, '__esModule', { | ||
27566 | value: true | ||
27567 | }); | ||
27568 | var autoAdjustOverflow = { | ||
27569 | adjustX: 1, | ||
27570 | adjustY: 1 | ||
27571 | }; | ||
27572 | |||
27573 | var targetOffset = [0, 0]; | ||
27574 | |||
27575 | var placements = { | ||
27576 | topLeft: { | ||
27577 | points: ['tl', 'tl'], | ||
27578 | overflow: autoAdjustOverflow, | ||
27579 | offset: [0, -3], | ||
27580 | targetOffset: targetOffset | ||
27581 | }, | ||
27582 | topRight: { | ||
27583 | points: ['tr', 'tr'], | ||
27584 | overflow: autoAdjustOverflow, | ||
27585 | offset: [0, -3], | ||
27586 | targetOffset: targetOffset | ||
27587 | }, | ||
27588 | bottomRight: { | ||
27589 | points: ['br', 'br'], | ||
27590 | overflow: autoAdjustOverflow, | ||
27591 | offset: [0, 3], | ||
27592 | targetOffset: targetOffset | ||
27593 | }, | ||
27594 | bottomLeft: { | ||
27595 | points: ['bl', 'bl'], | ||
27596 | overflow: autoAdjustOverflow, | ||
27597 | offset: [0, 3], | ||
27598 | targetOffset: targetOffset | ||
27599 | } | ||
27600 | }; | ||
27601 | |||
27602 | exports['default'] = placements; | ||
27603 | module.exports = exports['default']; | ||
27604 | |||
27605 | /***/ }, | ||
27606 | /* 227 */ | ||
27607 | /***/ function(module, exports, __webpack_require__) { | 27560 | /***/ function(module, exports, __webpack_require__) { |
27608 | 27561 | ||
27609 | 'use strict'; | 27562 | 'use strict'; |
@@ -27616,136 +27569,31 @@ webpackJsonp([0,1],[ | |||
27616 | 27569 | ||
27617 | var _react = __webpack_require__(3); | 27570 | var _react = __webpack_require__(3); |
27618 | 27571 | ||
27619 | var _localeEn_US = __webpack_require__(228); | 27572 | var _react2 = _interopRequireDefault(_react); |
27620 | |||
27621 | var _localeEn_US2 = _interopRequireDefault(_localeEn_US); | ||
27622 | |||
27623 | var _utilIndex = __webpack_require__(229); | ||
27624 | |||
27625 | exports['default'] = { | ||
27626 | propTypes: { | ||
27627 | prefixCls: _react.PropTypes.string, | ||
27628 | locale: _react.PropTypes.object | ||
27629 | }, | ||
27630 | |||
27631 | getDefaultProps: function getDefaultProps() { | ||
27632 | return { | ||
27633 | prefixCls: 'rc-time-picker', | ||
27634 | locale: _localeEn_US2['default'] | ||
27635 | }; | ||
27636 | }, | ||
27637 | |||
27638 | getFormatter: function getFormatter() { | ||
27639 | var formatter = this.props.formatter; | ||
27640 | var locale = this.props.locale; | ||
27641 | if (formatter) { | ||
27642 | if (formatter === this.lastFormatter) { | ||
27643 | return this.normalFormatter; | ||
27644 | } | ||
27645 | this.normalFormatter = (0, _utilIndex.getFormatter)(formatter, locale); | ||
27646 | this.lastFormatter = formatter; | ||
27647 | return this.normalFormatter; | ||
27648 | } | ||
27649 | if (!this.showSecond) { | ||
27650 | if (!this.notShowSecondFormatter) { | ||
27651 | this.notShowSecondFormatter = (0, _utilIndex.getFormatter)('HH:mm', locale); | ||
27652 | } | ||
27653 | return this.notShowSecondFormatter; | ||
27654 | } | ||
27655 | if (!this.showHour) { | ||
27656 | if (!this.notShowHourFormatter) { | ||
27657 | this.notShowHourFormatter = (0, _utilIndex.getFormatter)('mm:ss', locale); | ||
27658 | } | ||
27659 | return this.notShowHourFormatter; | ||
27660 | } | ||
27661 | if (!this.normalFormatter) { | ||
27662 | this.normalFormatter = (0, _utilIndex.getFormatter)('HH:mm:ss', locale); | ||
27663 | } | ||
27664 | return this.normalFormatter; | ||
27665 | } | ||
27666 | }; | ||
27667 | module.exports = exports['default']; | ||
27668 | |||
27669 | /***/ }, | ||
27670 | /* 228 */ | ||
27671 | /***/ function(module, exports, __webpack_require__) { | ||
27672 | |||
27673 | 'use strict'; | ||
27674 | |||
27675 | Object.defineProperty(exports, '__esModule', { | ||
27676 | value: true | ||
27677 | }); | ||
27678 | |||
27679 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27680 | |||
27681 | var _gregorianCalendarFormatLibLocaleEn_US = __webpack_require__(166); | ||
27682 | |||
27683 | var _gregorianCalendarFormatLibLocaleEn_US2 = _interopRequireDefault(_gregorianCalendarFormatLibLocaleEn_US); | ||
27684 | |||
27685 | exports['default'] = { | ||
27686 | placeholderHHmmss: 'HH:MM:SS', | ||
27687 | placeholderHHmm: 'HH:MM', | ||
27688 | placeholdermmss: 'MM:SS', | ||
27689 | clear: 'Clear', | ||
27690 | format: _gregorianCalendarFormatLibLocaleEn_US2['default'] | ||
27691 | }; | ||
27692 | module.exports = exports['default']; | ||
27693 | |||
27694 | /***/ }, | ||
27695 | /* 229 */ | ||
27696 | /***/ function(module, exports, __webpack_require__) { | ||
27697 | |||
27698 | 'use strict'; | ||
27699 | |||
27700 | Object.defineProperty(exports, '__esModule', { | ||
27701 | value: true | ||
27702 | }); | ||
27703 | exports.getFormatter = getFormatter; | ||
27704 | |||
27705 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27706 | |||
27707 | var _gregorianCalendarFormat = __webpack_require__(165); | ||
27708 | |||
27709 | var _gregorianCalendarFormat2 = _interopRequireDefault(_gregorianCalendarFormat); | ||
27710 | |||
27711 | function getFormatter(format, locale) { | ||
27712 | if (typeof format === 'string') { | ||
27713 | return new _gregorianCalendarFormat2['default'](format, locale.format); | ||
27714 | } | ||
27715 | return format; | ||
27716 | } | ||
27717 | |||
27718 | /***/ }, | ||
27719 | /* 230 */ | ||
27720 | /***/ function(module, exports, __webpack_require__) { | ||
27721 | |||
27722 | 'use strict'; | ||
27723 | 27573 | ||
27724 | Object.defineProperty(exports, '__esModule', { | 27574 | var _classnames = __webpack_require__(175); |
27725 | value: true | ||
27726 | }); | ||
27727 | 27575 | ||
27728 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 27576 | var _classnames2 = _interopRequireDefault(_classnames); |
27729 | 27577 | ||
27730 | var _react = __webpack_require__(3); | 27578 | var _gregorianCalendar = __webpack_require__(161); |
27731 | 27579 | ||
27732 | var _react2 = _interopRequireDefault(_react); | 27580 | var _gregorianCalendar2 = _interopRequireDefault(_gregorianCalendar); |
27733 | 27581 | ||
27734 | var _classnames = __webpack_require__(175); | 27582 | var _gregorianCalendarLibLocaleZh_CN = __webpack_require__(168); |
27735 | 27583 | ||
27736 | var _classnames2 = _interopRequireDefault(_classnames); | 27584 | var _gregorianCalendarLibLocaleZh_CN2 = _interopRequireDefault(_gregorianCalendarLibLocaleZh_CN); |
27737 | 27585 | ||
27738 | var _mixinCommonMixin = __webpack_require__(227); | 27586 | var _mixinCommonMixin = __webpack_require__(227); |
27739 | 27587 | ||
27740 | var _mixinCommonMixin2 = _interopRequireDefault(_mixinCommonMixin); | 27588 | var _mixinCommonMixin2 = _interopRequireDefault(_mixinCommonMixin); |
27741 | 27589 | ||
27742 | var _moduleHeader = __webpack_require__(231); | 27590 | var _Header = __webpack_require__(230); |
27743 | 27591 | ||
27744 | var _moduleHeader2 = _interopRequireDefault(_moduleHeader); | 27592 | var _Header2 = _interopRequireDefault(_Header); |
27745 | 27593 | ||
27746 | var _moduleCombobox = __webpack_require__(232); | 27594 | var _Combobox = __webpack_require__(231); |
27747 | 27595 | ||
27748 | var _moduleCombobox2 = _interopRequireDefault(_moduleCombobox); | 27596 | var _Combobox2 = _interopRequireDefault(_Combobox); |
27749 | 27597 | ||
27750 | function noop() {} | 27598 | function noop() {} |
27751 | 27599 | ||
@@ -27755,8 +27603,8 @@ webpackJsonp([0,1],[ | |||
27755 | }); | 27603 | }); |
27756 | } | 27604 | } |
27757 | 27605 | ||
27758 | var TimePanel = _react2['default'].createClass({ | 27606 | var Panel = _react2['default'].createClass({ |
27759 | displayName: 'TimePanel', | 27607 | displayName: 'Panel', |
27760 | 27608 | ||
27761 | propTypes: { | 27609 | propTypes: { |
27762 | prefixCls: _react.PropTypes.string, | 27610 | prefixCls: _react.PropTypes.string, |
@@ -27784,8 +27632,13 @@ webpackJsonp([0,1],[ | |||
27784 | }, | 27632 | }, |
27785 | 27633 | ||
27786 | getInitialState: function getInitialState() { | 27634 | getInitialState: function getInitialState() { |
27635 | var defaultValue = this.props.defaultValue; | ||
27636 | if (!defaultValue) { | ||
27637 | defaultValue = new _gregorianCalendar2['default'](_gregorianCalendarLibLocaleZh_CN2['default']); | ||
27638 | defaultValue.setTime(Date.now()); | ||
27639 | } | ||
27787 | return { | 27640 | return { |
27788 | value: this.props.defaultValue | 27641 | value: defaultValue |
27789 | }; | 27642 | }; |
27790 | }, | 27643 | }, |
27791 | 27644 | ||
@@ -27842,9 +27695,9 @@ webpackJsonp([0,1],[ | |||
27842 | return _react2['default'].createElement( | 27695 | return _react2['default'].createElement( |
27843 | 'div', | 27696 | 'div', |
27844 | { className: prefixCls + '-panel ' + cls }, | 27697 | { className: prefixCls + '-panel ' + cls }, |
27845 | _react2['default'].createElement(_moduleHeader2['default'], { | 27698 | _react2['default'].createElement(_Header2['default'], { |
27846 | prefixCls: prefixCls, | 27699 | prefixCls: prefixCls, |
27847 | gregorianTimePickerLocale: defaultValue.locale, | 27700 | gregorianTimePickerLocale: value.locale, |
27848 | locale: locale, | 27701 | locale: locale, |
27849 | value: value, | 27702 | value: value, |
27850 | formatter: this.getFormatter(), | 27703 | formatter: this.getFormatter(), |
@@ -27856,7 +27709,7 @@ webpackJsonp([0,1],[ | |||
27856 | onClear: this.onClear, | 27709 | onClear: this.onClear, |
27857 | showClear: true | 27710 | showClear: true |
27858 | }), | 27711 | }), |
27859 | _react2['default'].createElement(_moduleCombobox2['default'], { | 27712 | _react2['default'].createElement(_Combobox2['default'], { |
27860 | prefixCls: prefixCls, | 27713 | prefixCls: prefixCls, |
27861 | value: value, | 27714 | value: value, |
27862 | formatter: this.getFormatter(), | 27715 | formatter: this.getFormatter(), |
@@ -27871,11 +27724,124 @@ webpackJsonp([0,1],[ | |||
27871 | } | 27724 | } |
27872 | }); | 27725 | }); |
27873 | 27726 | ||
27874 | exports['default'] = TimePanel; | 27727 | exports['default'] = Panel; |
27875 | module.exports = exports['default']; | 27728 | module.exports = exports['default']; |
27876 | 27729 | ||
27877 | /***/ }, | 27730 | /***/ }, |
27878 | /* 231 */ | 27731 | /* 227 */ |
27732 | /***/ function(module, exports, __webpack_require__) { | ||
27733 | |||
27734 | 'use strict'; | ||
27735 | |||
27736 | Object.defineProperty(exports, '__esModule', { | ||
27737 | value: true | ||
27738 | }); | ||
27739 | |||
27740 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27741 | |||
27742 | var _react = __webpack_require__(3); | ||
27743 | |||
27744 | var _localeEn_US = __webpack_require__(228); | ||
27745 | |||
27746 | var _localeEn_US2 = _interopRequireDefault(_localeEn_US); | ||
27747 | |||
27748 | var _utilIndex = __webpack_require__(229); | ||
27749 | |||
27750 | exports['default'] = { | ||
27751 | propTypes: { | ||
27752 | prefixCls: _react.PropTypes.string, | ||
27753 | locale: _react.PropTypes.object | ||
27754 | }, | ||
27755 | |||
27756 | getDefaultProps: function getDefaultProps() { | ||
27757 | return { | ||
27758 | prefixCls: 'rc-time-picker', | ||
27759 | locale: _localeEn_US2['default'] | ||
27760 | }; | ||
27761 | }, | ||
27762 | |||
27763 | getFormatter: function getFormatter() { | ||
27764 | var formatter = this.props.formatter; | ||
27765 | var locale = this.props.locale; | ||
27766 | if (formatter) { | ||
27767 | if (formatter === this.lastFormatter) { | ||
27768 | return this.normalFormatter; | ||
27769 | } | ||
27770 | this.normalFormatter = (0, _utilIndex.getFormatter)(formatter, locale); | ||
27771 | this.lastFormatter = formatter; | ||
27772 | return this.normalFormatter; | ||
27773 | } | ||
27774 | if (!this.showSecond) { | ||
27775 | if (!this.notShowSecondFormatter) { | ||
27776 | this.notShowSecondFormatter = (0, _utilIndex.getFormatter)('HH:mm', locale); | ||
27777 | } | ||
27778 | return this.notShowSecondFormatter; | ||
27779 | } | ||
27780 | if (!this.showHour) { | ||
27781 | if (!this.notShowHourFormatter) { | ||
27782 | this.notShowHourFormatter = (0, _utilIndex.getFormatter)('mm:ss', locale); | ||
27783 | } | ||
27784 | return this.notShowHourFormatter; | ||
27785 | } | ||
27786 | if (!this.normalFormatter) { | ||
27787 | this.normalFormatter = (0, _utilIndex.getFormatter)('HH:mm:ss', locale); | ||
27788 | } | ||
27789 | return this.normalFormatter; | ||
27790 | } | ||
27791 | }; | ||
27792 | module.exports = exports['default']; | ||
27793 | |||
27794 | /***/ }, | ||
27795 | /* 228 */ | ||
27796 | /***/ function(module, exports, __webpack_require__) { | ||
27797 | |||
27798 | 'use strict'; | ||
27799 | |||
27800 | Object.defineProperty(exports, '__esModule', { | ||
27801 | value: true | ||
27802 | }); | ||
27803 | |||
27804 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27805 | |||
27806 | var _gregorianCalendarFormatLibLocaleEn_US = __webpack_require__(166); | ||
27807 | |||
27808 | var _gregorianCalendarFormatLibLocaleEn_US2 = _interopRequireDefault(_gregorianCalendarFormatLibLocaleEn_US); | ||
27809 | |||
27810 | exports['default'] = { | ||
27811 | placeholderHHmmss: 'HH:MM:SS', | ||
27812 | placeholderHHmm: 'HH:MM', | ||
27813 | placeholdermmss: 'MM:SS', | ||
27814 | clear: 'Clear', | ||
27815 | format: _gregorianCalendarFormatLibLocaleEn_US2['default'] | ||
27816 | }; | ||
27817 | module.exports = exports['default']; | ||
27818 | |||
27819 | /***/ }, | ||
27820 | /* 229 */ | ||
27821 | /***/ function(module, exports, __webpack_require__) { | ||
27822 | |||
27823 | 'use strict'; | ||
27824 | |||
27825 | Object.defineProperty(exports, '__esModule', { | ||
27826 | value: true | ||
27827 | }); | ||
27828 | exports.getFormatter = getFormatter; | ||
27829 | |||
27830 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27831 | |||
27832 | var _gregorianCalendarFormat = __webpack_require__(165); | ||
27833 | |||
27834 | var _gregorianCalendarFormat2 = _interopRequireDefault(_gregorianCalendarFormat); | ||
27835 | |||
27836 | function getFormatter(format, locale) { | ||
27837 | if (typeof format === 'string') { | ||
27838 | return new _gregorianCalendarFormat2['default'](format, locale.format); | ||
27839 | } | ||
27840 | return format; | ||
27841 | } | ||
27842 | |||
27843 | /***/ }, | ||
27844 | /* 230 */ | ||
27879 | /***/ function(module, exports, __webpack_require__) { | 27845 | /***/ function(module, exports, __webpack_require__) { |
27880 | 27846 | ||
27881 | 'use strict'; | 27847 | 'use strict'; |
@@ -28028,7 +27994,7 @@ webpackJsonp([0,1],[ | |||
28028 | module.exports = exports['default']; | 27994 | module.exports = exports['default']; |
28029 | 27995 | ||
28030 | /***/ }, | 27996 | /***/ }, |
28031 | /* 232 */ | 27997 | /* 231 */ |
28032 | /***/ function(module, exports, __webpack_require__) { | 27998 | /***/ function(module, exports, __webpack_require__) { |
28033 | 27999 | ||
28034 | 'use strict'; | 28000 | 'use strict'; |
@@ -28043,7 +28009,7 @@ webpackJsonp([0,1],[ | |||
28043 | 28009 | ||
28044 | var _react2 = _interopRequireDefault(_react); | 28010 | var _react2 = _interopRequireDefault(_react); |
28045 | 28011 | ||
28046 | var _Select = __webpack_require__(233); | 28012 | var _Select = __webpack_require__(232); |
28047 | 28013 | ||
28048 | var _Select2 = _interopRequireDefault(_Select); | 28014 | var _Select2 = _interopRequireDefault(_Select); |
28049 | 28015 | ||
@@ -28161,7 +28127,7 @@ webpackJsonp([0,1],[ | |||
28161 | module.exports = exports['default']; | 28127 | module.exports = exports['default']; |
28162 | 28128 | ||
28163 | /***/ }, | 28129 | /***/ }, |
28164 | /* 233 */ | 28130 | /* 232 */ |
28165 | /***/ function(module, exports, __webpack_require__) { | 28131 | /***/ function(module, exports, __webpack_require__) { |
28166 | 28132 | ||
28167 | 'use strict'; | 28133 | 'use strict'; |
@@ -28289,6 +28255,52 @@ webpackJsonp([0,1],[ | |||
28289 | module.exports = exports['default']; | 28255 | module.exports = exports['default']; |
28290 | 28256 | ||
28291 | /***/ }, | 28257 | /***/ }, |
28258 | /* 233 */ | ||
28259 | /***/ function(module, exports) { | ||
28260 | |||
28261 | 'use strict'; | ||
28262 | |||
28263 | Object.defineProperty(exports, '__esModule', { | ||
28264 | value: true | ||
28265 | }); | ||
28266 | var autoAdjustOverflow = { | ||
28267 | adjustX: 1, | ||
28268 | adjustY: 1 | ||
28269 | }; | ||
28270 | |||
28271 | var targetOffset = [0, 0]; | ||
28272 | |||
28273 | var placements = { | ||
28274 | topLeft: { | ||
28275 | points: ['tl', 'tl'], | ||
28276 | overflow: autoAdjustOverflow, | ||
28277 | offset: [0, -3], | ||
28278 | targetOffset: targetOffset | ||
28279 | }, | ||
28280 | topRight: { | ||
28281 | points: ['tr', 'tr'], | ||
28282 | overflow: autoAdjustOverflow, | ||
28283 | offset: [0, -3], | ||
28284 | targetOffset: targetOffset | ||
28285 | }, | ||
28286 | bottomRight: { | ||
28287 | points: ['br', 'br'], | ||
28288 | overflow: autoAdjustOverflow, | ||
28289 | offset: [0, 3], | ||
28290 | targetOffset: targetOffset | ||
28291 | }, | ||
28292 | bottomLeft: { | ||
28293 | points: ['bl', 'bl'], | ||
28294 | overflow: autoAdjustOverflow, | ||
28295 | offset: [0, 3], | ||
28296 | targetOffset: targetOffset | ||
28297 | } | ||
28298 | }; | ||
28299 | |||
28300 | exports['default'] = placements; | ||
28301 | module.exports = exports['default']; | ||
28302 | |||
28303 | /***/ }, | ||
28292 | /* 234 */ | 28304 | /* 234 */ |
28293 | /***/ function(module, exports, __webpack_require__) { | 28305 | /***/ function(module, exports, __webpack_require__) { |
28294 | 28306 | ||