@seafile/seafile-calendar 0.0.29-alpha.2 → 0.0.29-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/assets/index.css +1177 -0
  2. package/es/Calendar.js +440 -0
  3. package/es/FullCalendar.js +182 -0
  4. package/es/MonthCalendar.js +135 -0
  5. package/es/Picker.js +245 -0
  6. package/es/RangeCalendar.js +876 -0
  7. package/es/calendar/CalendarFooter.js +93 -0
  8. package/es/calendar/CalendarHeader.js +257 -0
  9. package/es/calendar/CalendarRightPanel.js +121 -0
  10. package/es/calendar/OkButton.js +22 -0
  11. package/es/calendar/TimePickerButton.js +28 -0
  12. package/es/calendar/TodayButton.js +28 -0
  13. package/es/date/DateConstants.js +19 -0
  14. package/es/date/DateInput.js +233 -0
  15. package/es/date/DateTBody.js +280 -0
  16. package/es/date/DateTHead.js +85 -0
  17. package/es/date/DateTable.js +32 -0
  18. package/es/decade/DecadePanel.js +181 -0
  19. package/es/full-calendar/CalendarHeader.js +180 -0
  20. package/es/index.js +3 -0
  21. package/es/locale/ar_EG.js +27 -0
  22. package/es/locale/bg_BG.js +27 -0
  23. package/es/locale/ca_ES.js +27 -0
  24. package/es/locale/cs_CZ.js +27 -0
  25. package/es/locale/da_DK.js +27 -0
  26. package/es/locale/de_DE.js +27 -0
  27. package/es/locale/el_GR.js +27 -0
  28. package/es/locale/en_GB.js +27 -0
  29. package/es/locale/en_US.js +28 -0
  30. package/es/locale/es_ES.js +27 -0
  31. package/es/locale/et_EE.js +27 -0
  32. package/es/locale/fa_IR.js +27 -0
  33. package/es/locale/fi_FI.js +27 -0
  34. package/es/locale/fr_BE.js +27 -0
  35. package/es/locale/fr_FR.js +27 -0
  36. package/es/locale/he_IL.js +28 -0
  37. package/es/locale/hi_IN.js +28 -0
  38. package/es/locale/hr_HR.js +28 -0
  39. package/es/locale/hu_HU.js +27 -0
  40. package/es/locale/id_ID.js +28 -0
  41. package/es/locale/is_IS.js +27 -0
  42. package/es/locale/it_IT.js +27 -0
  43. package/es/locale/ja_JP.js +26 -0
  44. package/es/locale/kn_IN.js +28 -0
  45. package/es/locale/ko_KR.js +27 -0
  46. package/es/locale/ku_IQ.js +27 -0
  47. package/es/locale/lv_LV.js +27 -0
  48. package/es/locale/mm_MM.js +28 -0
  49. package/es/locale/mn_MN.js +28 -0
  50. package/es/locale/ms_MY.js +27 -0
  51. package/es/locale/nb_NO.js +27 -0
  52. package/es/locale/nl_BE.js +27 -0
  53. package/es/locale/nl_NL.js +27 -0
  54. package/es/locale/pl_PL.js +27 -0
  55. package/es/locale/pt_BR.js +27 -0
  56. package/es/locale/pt_PT.js +27 -0
  57. package/es/locale/ro_RO.js +28 -0
  58. package/es/locale/ru_RU.js +27 -0
  59. package/es/locale/sk_SK.js +27 -0
  60. package/es/locale/sl_SI.js +27 -0
  61. package/es/locale/sr_RS.js +27 -0
  62. package/es/locale/sv_SE.js +27 -0
  63. package/es/locale/ta_IN.js +28 -0
  64. package/es/locale/th_TH.js +27 -0
  65. package/es/locale/tr_TR.js +27 -0
  66. package/es/locale/ug_CN.js +26 -0
  67. package/es/locale/uk_UA.js +27 -0
  68. package/es/locale/vi_VN.js +28 -0
  69. package/es/locale/zh_CN.js +27 -0
  70. package/es/locale/zh_TW.js +26 -0
  71. package/es/mixin/CalendarMixin.js +123 -0
  72. package/es/mixin/CommonMixin.js +85 -0
  73. package/es/month/MonthPanel.js +154 -0
  74. package/es/month/MonthTable.js +156 -0
  75. package/es/picker/placements.js +35 -0
  76. package/es/range-calendar/CalendarPart.js +151 -0
  77. package/es/util/dayjs.js +17 -0
  78. package/es/util/index.js +105 -0
  79. package/es/util/toTime.js +21 -0
  80. package/es/year/YearPanel.js +194 -0
  81. package/lib/Calendar.js +503 -0
  82. package/lib/FullCalendar.js +221 -0
  83. package/lib/MonthCalendar.js +172 -0
  84. package/lib/Picker.js +282 -0
  85. package/lib/RangeCalendar.js +925 -0
  86. package/lib/calendar/CalendarFooter.js +134 -0
  87. package/lib/calendar/CalendarHeader.js +290 -0
  88. package/lib/calendar/CalendarRightPanel.js +145 -0
  89. package/lib/calendar/OkButton.js +32 -0
  90. package/lib/calendar/TimePickerButton.js +41 -0
  91. package/lib/calendar/TodayButton.js +39 -0
  92. package/lib/date/DateConstants.js +23 -0
  93. package/lib/date/DateInput.js +265 -0
  94. package/lib/date/DateTBody.js +307 -0
  95. package/lib/date/DateTHead.js +105 -0
  96. package/lib/date/DateTable.js +54 -0
  97. package/lib/decade/DecadePanel.js +207 -0
  98. package/lib/full-calendar/CalendarHeader.js +201 -0
  99. package/lib/index.js +12 -0
  100. package/lib/locale/ar_EG.js +31 -0
  101. package/lib/locale/bg_BG.js +31 -0
  102. package/lib/locale/ca_ES.js +31 -0
  103. package/lib/locale/cs_CZ.js +31 -0
  104. package/lib/locale/da_DK.js +31 -0
  105. package/lib/locale/de_DE.js +31 -0
  106. package/lib/locale/el_GR.js +31 -0
  107. package/lib/locale/en_GB.js +31 -0
  108. package/lib/locale/en_US.js +32 -0
  109. package/lib/locale/es_ES.js +31 -0
  110. package/lib/locale/et_EE.js +31 -0
  111. package/lib/locale/fa_IR.js +31 -0
  112. package/lib/locale/fi_FI.js +31 -0
  113. package/lib/locale/fr_BE.js +31 -0
  114. package/lib/locale/fr_FR.js +31 -0
  115. package/lib/locale/he_IL.js +32 -0
  116. package/lib/locale/hi_IN.js +32 -0
  117. package/lib/locale/hr_HR.js +32 -0
  118. package/lib/locale/hu_HU.js +31 -0
  119. package/lib/locale/id_ID.js +32 -0
  120. package/lib/locale/is_IS.js +31 -0
  121. package/lib/locale/it_IT.js +31 -0
  122. package/lib/locale/ja_JP.js +30 -0
  123. package/lib/locale/kn_IN.js +32 -0
  124. package/lib/locale/ko_KR.js +31 -0
  125. package/lib/locale/ku_IQ.js +31 -0
  126. package/lib/locale/lv_LV.js +31 -0
  127. package/lib/locale/mm_MM.js +32 -0
  128. package/lib/locale/mn_MN.js +32 -0
  129. package/lib/locale/ms_MY.js +31 -0
  130. package/lib/locale/nb_NO.js +31 -0
  131. package/lib/locale/nl_BE.js +31 -0
  132. package/lib/locale/nl_NL.js +31 -0
  133. package/lib/locale/pl_PL.js +31 -0
  134. package/lib/locale/pt_BR.js +31 -0
  135. package/lib/locale/pt_PT.js +31 -0
  136. package/lib/locale/ro_RO.js +32 -0
  137. package/lib/locale/ru_RU.js +31 -0
  138. package/lib/locale/sk_SK.js +31 -0
  139. package/lib/locale/sl_SI.js +31 -0
  140. package/lib/locale/sr_RS.js +31 -0
  141. package/lib/locale/sv_SE.js +31 -0
  142. package/lib/locale/ta_IN.js +32 -0
  143. package/lib/locale/th_TH.js +31 -0
  144. package/lib/locale/tr_TR.js +31 -0
  145. package/lib/locale/ug_CN.js +30 -0
  146. package/lib/locale/uk_UA.js +31 -0
  147. package/lib/locale/vi_VN.js +32 -0
  148. package/lib/locale/zh_CN.js +31 -0
  149. package/lib/locale/zh_TW.js +30 -0
  150. package/lib/mixin/CalendarMixin.js +153 -0
  151. package/lib/mixin/CommonMixin.js +106 -0
  152. package/lib/month/MonthPanel.js +179 -0
  153. package/lib/month/MonthTable.js +181 -0
  154. package/lib/picker/placements.js +39 -0
  155. package/lib/range-calendar/CalendarPart.js +184 -0
  156. package/lib/util/dayjs.js +46 -0
  157. package/lib/util/index.js +130 -0
  158. package/lib/util/toTime.js +28 -0
  159. package/lib/year/YearPanel.js +219 -0
  160. package/package.json +1 -1
@@ -0,0 +1,93 @@
1
+ import _extends from 'babel-runtime/helpers/extends';
2
+ import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
3
+ import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
4
+ import _inherits from 'babel-runtime/helpers/inherits';
5
+ import React from 'react';
6
+ import ReactDOM from 'react-dom';
7
+ import PropTypes from 'prop-types';
8
+ import toFragment from 'rc-util/es/Children/mapSelf';
9
+ import cx from 'classnames';
10
+ import TodayButton from '../calendar/TodayButton';
11
+ import OkButton from '../calendar/OkButton';
12
+ import TimePickerButton from '../calendar/TimePickerButton';
13
+
14
+ var CalendarFooter = function (_React$Component) {
15
+ _inherits(CalendarFooter, _React$Component);
16
+
17
+ function CalendarFooter() {
18
+ _classCallCheck(this, CalendarFooter);
19
+
20
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
21
+ }
22
+
23
+ CalendarFooter.prototype.onSelect = function onSelect(value) {
24
+ this.props.onSelect(value);
25
+ };
26
+
27
+ CalendarFooter.prototype.getRootDOMNode = function getRootDOMNode() {
28
+ return ReactDOM.findDOMNode(this);
29
+ };
30
+
31
+ CalendarFooter.prototype.render = function render() {
32
+ var props = this.props;
33
+ var value = props.value,
34
+ prefixCls = props.prefixCls,
35
+ showOk = props.showOk,
36
+ timePicker = props.timePicker,
37
+ renderFooter = props.renderFooter,
38
+ mode = props.mode;
39
+
40
+ var footerEl = null;
41
+ var extraFooter = renderFooter && renderFooter(mode);
42
+ if (props.showToday || timePicker || extraFooter) {
43
+ var _cx;
44
+
45
+ var nowEl = void 0;
46
+ if (props.showToday) {
47
+ nowEl = React.createElement(TodayButton, _extends({}, props, { value: value }));
48
+ }
49
+ var okBtn = void 0;
50
+ if (showOk === true || showOk !== false && !!props.timePicker) {
51
+ okBtn = React.createElement(OkButton, props);
52
+ }
53
+ var timePickerBtn = void 0;
54
+ if (!!props.timePicker) {
55
+ timePickerBtn = React.createElement(TimePickerButton, props);
56
+ }
57
+
58
+ var footerBtn = void 0;
59
+ if (nowEl || timePickerBtn || okBtn || extraFooter) {
60
+ footerBtn = React.createElement(
61
+ 'span',
62
+ { className: prefixCls + '-footer-btn' },
63
+ extraFooter,
64
+ toFragment([nowEl, timePickerBtn, okBtn])
65
+ );
66
+ }
67
+ var cls = cx(prefixCls + '-footer', (_cx = {}, _cx[prefixCls + '-footer-show-ok'] = okBtn, _cx));
68
+ footerEl = React.createElement(
69
+ 'div',
70
+ { className: cls },
71
+ footerBtn
72
+ );
73
+ }
74
+ return footerEl;
75
+ };
76
+
77
+ return CalendarFooter;
78
+ }(React.Component);
79
+
80
+ CalendarFooter.propTypes = {
81
+ prefixCls: PropTypes.string,
82
+ showDateInput: PropTypes.bool,
83
+ disabledTime: PropTypes.any,
84
+ timePicker: PropTypes.element,
85
+ selectedValue: PropTypes.any,
86
+ showOk: PropTypes.bool,
87
+ onSelect: PropTypes.func,
88
+ value: PropTypes.object,
89
+ renderFooter: PropTypes.func,
90
+ defaultValue: PropTypes.object,
91
+ mode: PropTypes.string
92
+ };
93
+ export default CalendarFooter;
@@ -0,0 +1,257 @@
1
+ import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
2
+ import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
3
+ import _inherits from 'babel-runtime/helpers/inherits';
4
+ import React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import toFragment from 'rc-util/es/Children/mapSelf';
7
+ import MonthPanel from '../month/MonthPanel';
8
+ import YearPanel from '../year/YearPanel';
9
+ import DecadePanel from '../decade/DecadePanel';
10
+
11
+ function goMonth(direction) {
12
+ var next = this.props.value.clone();
13
+ next = next.add(direction, 'months');
14
+ this.props.onValueChange(next);
15
+ }
16
+
17
+ function goYear(direction) {
18
+ var next = this.props.value.clone();
19
+ next = next.add(direction, 'years');
20
+ this.props.onValueChange(next);
21
+ }
22
+
23
+ function showIf(condition, el) {
24
+ return condition ? el : null;
25
+ }
26
+
27
+ var CalendarHeader = function (_React$Component) {
28
+ _inherits(CalendarHeader, _React$Component);
29
+
30
+ function CalendarHeader(props) {
31
+ _classCallCheck(this, CalendarHeader);
32
+
33
+ var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
34
+
35
+ _initialiseProps.call(_this);
36
+
37
+ _this.nextMonth = goMonth.bind(_this, 1);
38
+ _this.previousMonth = goMonth.bind(_this, -1);
39
+ _this.nextYear = goYear.bind(_this, 1);
40
+ _this.previousYear = goYear.bind(_this, -1);
41
+
42
+ _this.state = { yearPanelReferer: null };
43
+ return _this;
44
+ }
45
+
46
+ CalendarHeader.prototype.render = function render() {
47
+ var _this2 = this;
48
+
49
+ var props = this.props;
50
+ var prefixCls = props.prefixCls,
51
+ locale = props.locale,
52
+ mode = props.mode,
53
+ value = props.value,
54
+ showTimePicker = props.showTimePicker,
55
+ enableNext = props.enableNext,
56
+ enablePrev = props.enablePrev,
57
+ disabledMonth = props.disabledMonth,
58
+ renderFooter = props.renderFooter;
59
+
60
+
61
+ var panel = null;
62
+ if (mode === 'month') {
63
+ panel = React.createElement(MonthPanel, {
64
+ locale: locale,
65
+ value: value,
66
+ rootPrefixCls: prefixCls,
67
+ onSelect: this.onMonthSelect,
68
+ onYearPanelShow: function onYearPanelShow() {
69
+ return _this2.showYearPanel('month');
70
+ },
71
+ disabledDate: disabledMonth,
72
+ cellRender: props.monthCellRender,
73
+ contentRender: props.monthCellContentRender,
74
+ renderFooter: renderFooter,
75
+ changeYear: this.changeYear
76
+ });
77
+ }
78
+ if (mode === 'year') {
79
+ panel = React.createElement(YearPanel, {
80
+ locale: locale,
81
+ defaultValue: value,
82
+ rootPrefixCls: prefixCls,
83
+ onSelect: this.onYearSelect,
84
+ onDecadePanelShow: this.showDecadePanel,
85
+ renderFooter: renderFooter
86
+ });
87
+ }
88
+ if (mode === 'decade') {
89
+ panel = React.createElement(DecadePanel, {
90
+ locale: locale,
91
+ defaultValue: value,
92
+ rootPrefixCls: prefixCls,
93
+ onSelect: this.onDecadeSelect,
94
+ renderFooter: renderFooter
95
+ });
96
+ }
97
+
98
+ return React.createElement(
99
+ 'div',
100
+ { className: prefixCls + '-header' },
101
+ React.createElement(
102
+ 'div',
103
+ { style: { position: 'relative' } },
104
+ showIf(enablePrev && !showTimePicker, React.createElement('a', {
105
+ className: prefixCls + '-prev-year-btn',
106
+ role: 'button',
107
+ onClick: this.previousYear,
108
+ title: locale.previousYear
109
+ })),
110
+ showIf(enablePrev && !showTimePicker, React.createElement('a', {
111
+ className: prefixCls + '-prev-month-btn',
112
+ role: 'button',
113
+ onClick: this.previousMonth,
114
+ title: locale.previousMonth
115
+ })),
116
+ this.monthYearElement(showTimePicker),
117
+ showIf(enableNext && !showTimePicker, React.createElement('a', {
118
+ className: prefixCls + '-next-month-btn',
119
+ onClick: this.nextMonth,
120
+ title: locale.nextMonth
121
+ })),
122
+ showIf(enableNext && !showTimePicker, React.createElement('a', {
123
+ className: prefixCls + '-next-year-btn',
124
+ onClick: this.nextYear,
125
+ title: locale.nextYear
126
+ }))
127
+ ),
128
+ panel
129
+ );
130
+ };
131
+
132
+ return CalendarHeader;
133
+ }(React.Component);
134
+
135
+ CalendarHeader.propTypes = {
136
+ prefixCls: PropTypes.string,
137
+ value: PropTypes.object,
138
+ onValueChange: PropTypes.func,
139
+ showTimePicker: PropTypes.bool,
140
+ onPanelChange: PropTypes.func,
141
+ locale: PropTypes.object,
142
+ enablePrev: PropTypes.any,
143
+ enableNext: PropTypes.any,
144
+ disabledMonth: PropTypes.func,
145
+ renderFooter: PropTypes.func,
146
+ onMonthSelect: PropTypes.func
147
+ };
148
+ CalendarHeader.defaultProps = {
149
+ enableNext: 1,
150
+ enablePrev: 1,
151
+ onPanelChange: function onPanelChange() {},
152
+ onValueChange: function onValueChange() {}
153
+ };
154
+
155
+ var _initialiseProps = function _initialiseProps() {
156
+ var _this3 = this;
157
+
158
+ this.onMonthSelect = function (value) {
159
+ _this3.props.onPanelChange(value, 'date');
160
+ if (_this3.props.onMonthSelect) {
161
+ _this3.props.onMonthSelect(value);
162
+ } else {
163
+ _this3.props.onValueChange(value);
164
+ }
165
+ };
166
+
167
+ this.onYearSelect = function (value) {
168
+ var referer = _this3.state.yearPanelReferer;
169
+ _this3.setState({ yearPanelReferer: null });
170
+ _this3.props.onPanelChange(value, referer);
171
+ _this3.props.onValueChange(value);
172
+ };
173
+
174
+ this.onDecadeSelect = function (value) {
175
+ _this3.props.onPanelChange(value, 'year');
176
+ _this3.props.onValueChange(value);
177
+ };
178
+
179
+ this.changeYear = function (direction) {
180
+ if (direction > 0) {
181
+ _this3.nextYear();
182
+ } else {
183
+ _this3.previousYear();
184
+ }
185
+ };
186
+
187
+ this.monthYearElement = function (showTimePicker) {
188
+ var props = _this3.props;
189
+ var prefixCls = props.prefixCls;
190
+ var locale = props.locale;
191
+ var value = props.value;
192
+ var localeData = value.localeData();
193
+ var monthBeforeYear = locale.monthBeforeYear;
194
+ var selectClassName = prefixCls + '-' + (monthBeforeYear ? 'my-select' : 'ym-select');
195
+ var timeClassName = showTimePicker ? ' ' + prefixCls + '-time-status' : '';
196
+ var year = React.createElement(
197
+ 'a',
198
+ {
199
+ className: prefixCls + '-year-select' + timeClassName,
200
+ role: 'button',
201
+ onClick: showTimePicker ? null : function () {
202
+ return _this3.showYearPanel('date');
203
+ },
204
+ title: showTimePicker ? null : locale.yearSelect
205
+ },
206
+ value.format(locale.yearFormat)
207
+ );
208
+ var month = React.createElement(
209
+ 'a',
210
+ {
211
+ className: prefixCls + '-month-select' + timeClassName,
212
+ role: 'button',
213
+ onClick: showTimePicker ? null : _this3.showMonthPanel,
214
+ title: showTimePicker ? null : locale.monthSelect
215
+ },
216
+ locale.monthFormat ? value.format(locale.monthFormat) : localeData.monthsShort(value)
217
+ );
218
+ var day = void 0;
219
+ if (showTimePicker) {
220
+ day = React.createElement(
221
+ 'a',
222
+ {
223
+ className: prefixCls + '-day-select' + timeClassName,
224
+ role: 'button'
225
+ },
226
+ value.format(locale.dayFormat)
227
+ );
228
+ }
229
+ var my = [];
230
+ if (monthBeforeYear) {
231
+ my = [month, day, year];
232
+ } else {
233
+ my = [year, month, day];
234
+ }
235
+ return React.createElement(
236
+ 'span',
237
+ { className: selectClassName },
238
+ toFragment(my)
239
+ );
240
+ };
241
+
242
+ this.showMonthPanel = function () {
243
+ // null means that users' interaction doesn't change value
244
+ _this3.props.onPanelChange(null, 'month');
245
+ };
246
+
247
+ this.showYearPanel = function (referer) {
248
+ _this3.setState({ yearPanelReferer: referer });
249
+ _this3.props.onPanelChange(null, 'year');
250
+ };
251
+
252
+ this.showDecadePanel = function () {
253
+ _this3.props.onPanelChange(null, 'decade');
254
+ };
255
+ };
256
+
257
+ export default CalendarHeader;
@@ -0,0 +1,121 @@
1
+ import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
2
+ import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
3
+ import _inherits from 'babel-runtime/helpers/inherits';
4
+ import React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import dayjs from 'dayjs';
7
+
8
+ var CalendarRightPanel = function (_React$Component) {
9
+ _inherits(CalendarRightPanel, _React$Component);
10
+
11
+ function CalendarRightPanel(props) {
12
+ _classCallCheck(this, CalendarRightPanel);
13
+
14
+ var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
15
+
16
+ _this.onSelect = function (value) {
17
+ _this.setState({
18
+ highlightTime: value
19
+ });
20
+ _this.props.onSelect(value);
21
+ _this.props.onClickRightPanelTime();
22
+ };
23
+
24
+ _this.getTimes = function () {
25
+ var times = [];
26
+ for (var i = 0; i < 24; i++) {
27
+ var str = (String(i) + ':00').padStart(5, '0');
28
+ var str1 = (String(i) + ':30').padStart(5, '0');
29
+ times.push(str);
30
+ times.push(str1);
31
+ }
32
+ return times;
33
+ };
34
+
35
+ _this.scrollUp = function () {
36
+ _this.timeRef.current.scrollBy(0, -200);
37
+ };
38
+
39
+ _this.scrollDown = function () {
40
+ _this.timeRef.current.scrollBy(0, 200);
41
+ };
42
+
43
+ _this.state = {
44
+ highlightTime: _this.props.value || null
45
+ };
46
+ _this.timeRef = React.createRef();
47
+ _this.times = _this.getTimes();
48
+ return _this;
49
+ }
50
+
51
+ CalendarRightPanel.prototype.componentDidMount = function componentDidMount() {
52
+ var defaultMinutesTime = this.props.defaultMinutesTime;
53
+
54
+ var showTimeIndex = this.times.findIndex(function (item) {
55
+ return item >= defaultMinutesTime;
56
+ });
57
+ var scrollTimeIndex = showTimeIndex > -1 ? showTimeIndex - 1 : 16;
58
+ this.timeRef.current.scrollTo(0, 34 * scrollTimeIndex);
59
+ };
60
+
61
+ CalendarRightPanel.prototype.render = function render() {
62
+ var _this2 = this;
63
+
64
+ var _props = this.props,
65
+ value = _props.value,
66
+ prefixCls = _props.prefixCls,
67
+ locale = _props.locale;
68
+
69
+ var selectedDate = value.format().slice(0, 10);
70
+ var highlight = this.state.highlightTime;
71
+ var highlightTime = highlight ? highlight.format().slice(11, 16) : null;
72
+ var isZhcn = locale && locale.today === '今天';
73
+ return React.createElement(
74
+ 'div',
75
+ { className: prefixCls + '-right-panel' },
76
+ React.createElement(
77
+ 'div',
78
+ { className: prefixCls + '-right-panel-header', onClick: this.scrollUp },
79
+ React.createElement('span', null)
80
+ ),
81
+ React.createElement(
82
+ 'div',
83
+ { className: prefixCls + '-right-panel-body', ref: this.timeRef },
84
+ React.createElement(
85
+ 'ul',
86
+ null,
87
+ this.times.map(function (time) {
88
+ var current = dayjs(selectedDate + ' ' + time);
89
+ current = isZhcn ? current.locale('zh-cn') : current.locale('en-gb');
90
+ return React.createElement(
91
+ 'li',
92
+ {
93
+ key: time,
94
+ onClick: _this2.onSelect.bind(_this2, current),
95
+ className: '' + (highlightTime === time ? prefixCls + '-selected-time' : '')
96
+ },
97
+ time
98
+ );
99
+ })
100
+ )
101
+ ),
102
+ React.createElement(
103
+ 'div',
104
+ { className: prefixCls + '-right-panel-footer', onClick: this.scrollDown },
105
+ React.createElement('span', null)
106
+ )
107
+ );
108
+ };
109
+
110
+ return CalendarRightPanel;
111
+ }(React.Component);
112
+
113
+ CalendarRightPanel.propTypes = {
114
+ prefixCls: PropTypes.string,
115
+ value: PropTypes.object,
116
+ onSelect: PropTypes.func,
117
+ onClickRightPanelTime: PropTypes.func,
118
+ locale: PropTypes.object,
119
+ defaultMinutesTime: PropTypes.string
120
+ };
121
+ export default CalendarRightPanel;
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+
3
+ export default function OkButton(_ref) {
4
+ var prefixCls = _ref.prefixCls,
5
+ locale = _ref.locale,
6
+ okDisabled = _ref.okDisabled,
7
+ onOk = _ref.onOk;
8
+
9
+ var className = prefixCls + "-ok-btn";
10
+ if (okDisabled) {
11
+ className += " " + prefixCls + "-ok-btn-disabled";
12
+ }
13
+ return React.createElement(
14
+ "a",
15
+ {
16
+ className: className,
17
+ role: "button",
18
+ onClick: okDisabled ? null : onOk
19
+ },
20
+ locale.ok
21
+ );
22
+ }
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames';
3
+
4
+ export default function TimePickerButton(_ref) {
5
+ var _classnames;
6
+
7
+ var prefixCls = _ref.prefixCls,
8
+ locale = _ref.locale,
9
+ showTimePicker = _ref.showTimePicker,
10
+ onOpenTimePicker = _ref.onOpenTimePicker,
11
+ onCloseTimePicker = _ref.onCloseTimePicker,
12
+ timePickerDisabled = _ref.timePickerDisabled;
13
+
14
+ var className = classnames((_classnames = {}, _classnames[prefixCls + '-time-picker-btn'] = true, _classnames[prefixCls + '-time-picker-btn-disabled'] = timePickerDisabled, _classnames));
15
+ var onClick = null;
16
+ if (!timePickerDisabled) {
17
+ onClick = showTimePicker ? onCloseTimePicker : onOpenTimePicker;
18
+ }
19
+ return React.createElement(
20
+ 'a',
21
+ {
22
+ className: className,
23
+ role: 'button',
24
+ onClick: onClick
25
+ },
26
+ showTimePicker ? locale.dateSelect : locale.timeSelect
27
+ );
28
+ }
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { getTodayTimeStr, getTodayTime, isAllowedDate } from '../util/';
3
+
4
+ export default function TodayButton(_ref) {
5
+ var prefixCls = _ref.prefixCls,
6
+ locale = _ref.locale,
7
+ value = _ref.value,
8
+ timePicker = _ref.timePicker,
9
+ disabled = _ref.disabled,
10
+ disabledDate = _ref.disabledDate,
11
+ onToday = _ref.onToday,
12
+ text = _ref.text;
13
+
14
+ var localeNow = (!text && timePicker ? locale.now : text) || locale.today;
15
+ var disabledToday = disabledDate && !isAllowedDate(getTodayTime(value), disabledDate);
16
+ var isDisabled = disabledToday || disabled;
17
+ var disabledTodayClass = isDisabled ? prefixCls + '-today-btn-disabled' : '';
18
+ return React.createElement(
19
+ 'a',
20
+ {
21
+ className: prefixCls + '-today-btn ' + disabledTodayClass,
22
+ role: 'button',
23
+ onClick: isDisabled ? null : onToday,
24
+ title: getTodayTimeStr(value)
25
+ },
26
+ localeNow
27
+ );
28
+ }
@@ -0,0 +1,19 @@
1
+ var DATE_ROW_COLUMN_COUNT = {
2
+ DATE_ROW_COUNT: 6,
3
+ DATE_COL_COUNT: 7
4
+ };
5
+
6
+ var DAY_NAME_TO_INDEX = {
7
+ Sunday: 0,
8
+ Monday: 1,
9
+ Tuesday: 2,
10
+ Wednesday: 3,
11
+ Thursday: 4,
12
+ Friday: 5,
13
+ Saturday: 6
14
+ };
15
+
16
+ export default {
17
+ DATE_ROW_COLUMN_COUNT: DATE_ROW_COLUMN_COUNT,
18
+ DAY_NAME_TO_INDEX: DAY_NAME_TO_INDEX
19
+ };