diff options
author | yiminghe <yiminghe@gmail.com> | 2015-12-21 17:14:48 +0800 |
---|---|---|
committer | yiminghe <yiminghe@gmail.com> | 2015-12-21 17:14:48 +0800 |
commit | 89b84f104138888b074334e76bc1dc7002f2d061 (patch) | |
tree | 052a86cd9c38588dc9bdfe675baf25f27798e90b /examples/disabled.js | |
parent | 70e9ca03bb946357ea1fc7edba8d9e3b31e0d5ca (diff) | |
download | time-picker-89b84f104138888b074334e76bc1dc7002f2d061.tar.gz time-picker-89b84f104138888b074334e76bc1dc7002f2d061.tar.zst time-picker-89b84f104138888b074334e76bc1dc7002f2d061.zip |
Updates
Diffstat (limited to 'examples/disabled.js')
-rw-r--r-- | examples/disabled.js | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/examples/disabled.js b/examples/disabled.js new file mode 100644 index 0000000..3398053 --- /dev/null +++ b/examples/disabled.js | |||
@@ -0,0 +1,100 @@ | |||
1 | webpackJsonp([0],[ | ||
2 | /* 0 */ | ||
3 | /***/ function(module, exports, __webpack_require__) { | ||
4 | |||
5 | module.exports = __webpack_require__(1); | ||
6 | |||
7 | |||
8 | /***/ }, | ||
9 | /* 1 */ | ||
10 | /***/ function(module, exports, __webpack_require__) { | ||
11 | |||
12 | /* eslint no-console:0 */ | ||
13 | |||
14 | 'use strict'; | ||
15 | |||
16 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
17 | |||
18 | __webpack_require__(2); | ||
19 | |||
20 | var _react = __webpack_require__(3); | ||
21 | |||
22 | var _react2 = _interopRequireDefault(_react); | ||
23 | |||
24 | var _reactDom = __webpack_require__(160); | ||
25 | |||
26 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
27 | |||
28 | var _gregorianCalendar = __webpack_require__(161); | ||
29 | |||
30 | var _gregorianCalendar2 = _interopRequireDefault(_gregorianCalendar); | ||
31 | |||
32 | var _gregorianCalendarFormat = __webpack_require__(165); | ||
33 | |||
34 | var _gregorianCalendarFormat2 = _interopRequireDefault(_gregorianCalendarFormat); | ||
35 | |||
36 | var _gregorianCalendarLibLocaleZh_CN = __webpack_require__(168); | ||
37 | |||
38 | var _gregorianCalendarLibLocaleZh_CN2 = _interopRequireDefault(_gregorianCalendarLibLocaleZh_CN); | ||
39 | |||
40 | var _rcTimePicker = __webpack_require__(169); | ||
41 | |||
42 | var _rcTimePicker2 = _interopRequireDefault(_rcTimePicker); | ||
43 | |||
44 | var _rcTimePickerSrcLocaleZh_CN = __webpack_require__(228); | ||
45 | |||
46 | var _rcTimePickerSrcLocaleZh_CN2 = _interopRequireDefault(_rcTimePickerSrcLocaleZh_CN); | ||
47 | |||
48 | var showSecond = true; | ||
49 | var str = showSecond ? 'HH:mm:ss' : 'HH:mm'; | ||
50 | |||
51 | var formatter = new _gregorianCalendarFormat2['default'](str); | ||
52 | |||
53 | var now = new _gregorianCalendar2['default'](_gregorianCalendarLibLocaleZh_CN2['default']); | ||
54 | now.setTime(Date.now()); | ||
55 | |||
56 | function generateOptions(length, excludedOptions) { | ||
57 | var arr = []; | ||
58 | for (var value = 0; value < length; value++) { | ||
59 | if (excludedOptions.indexOf(value) < 0) { | ||
60 | arr.push(value); | ||
61 | } | ||
62 | } | ||
63 | return arr; | ||
64 | } | ||
65 | |||
66 | function onChange(value) { | ||
67 | console.log(value && formatter.format(value)); | ||
68 | } | ||
69 | |||
70 | function disabledHours() { | ||
71 | return [0, 1, 2, 3, 4, 5, 6, 7, 8, 22, 23]; | ||
72 | } | ||
73 | |||
74 | function disabledMinutes(h) { | ||
75 | switch (h) { | ||
76 | case 9: | ||
77 | return generateOptions(60, [30]); | ||
78 | case 21: | ||
79 | return generateOptions(60, [0]); | ||
80 | default: | ||
81 | return generateOptions(60, [0, 30]); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | function disabledSeconds(h, m) { | ||
86 | return [h + m % 60]; | ||
87 | } | ||
88 | |||
89 | _reactDom2['default'].render(_react2['default'].createElement(_rcTimePicker2['default'], { formatter: formatter, locale: _rcTimePickerSrcLocaleZh_CN2['default'], | ||
90 | showSecond: showSecond, | ||
91 | defaultValue: now, | ||
92 | className: 'xxx', | ||
93 | onChange: onChange, | ||
94 | disabledHours: disabledHours, | ||
95 | disabledMinutes: disabledMinutes, | ||
96 | disabledSeconds: disabledSeconds }), document.getElementById('__react-content')); | ||
97 | |||
98 | /***/ } | ||
99 | ]); | ||
100 | //# sourceMappingURL=disabled.js.map \ No newline at end of file | ||