@seafile/seafile-calendar 0.0.29 → 0.0.30-beta.2

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 (167) hide show
  1. package/package.json +1 -1
  2. package/assets/index.css +0 -1177
  3. package/dist/rc-calendar.css +0 -1179
  4. package/dist/rc-calendar.css.map +0 -1
  5. package/dist/rc-calendar.js +0 -7076
  6. package/dist/rc-calendar.js.map +0 -1
  7. package/dist/rc-calendar.min.css +0 -1179
  8. package/dist/rc-calendar.min.css.map +0 -1
  9. package/dist/rc-calendar.min.js +0 -1
  10. package/es/Calendar.js +0 -441
  11. package/es/FullCalendar.js +0 -182
  12. package/es/MonthCalendar.js +0 -135
  13. package/es/Picker.js +0 -245
  14. package/es/RangeCalendar.js +0 -876
  15. package/es/calendar/CalendarFooter.js +0 -93
  16. package/es/calendar/CalendarHeader.js +0 -257
  17. package/es/calendar/CalendarRightPanel.js +0 -121
  18. package/es/calendar/OkButton.js +0 -22
  19. package/es/calendar/TimePickerButton.js +0 -28
  20. package/es/calendar/TodayButton.js +0 -28
  21. package/es/date/DateConstants.js +0 -19
  22. package/es/date/DateInput.js +0 -233
  23. package/es/date/DateTBody.js +0 -280
  24. package/es/date/DateTHead.js +0 -85
  25. package/es/date/DateTable.js +0 -32
  26. package/es/decade/DecadePanel.js +0 -181
  27. package/es/full-calendar/CalendarHeader.js +0 -180
  28. package/es/index.js +0 -3
  29. package/es/locale/ar_EG.js +0 -27
  30. package/es/locale/bg_BG.js +0 -27
  31. package/es/locale/ca_ES.js +0 -27
  32. package/es/locale/cs_CZ.js +0 -27
  33. package/es/locale/da_DK.js +0 -27
  34. package/es/locale/de_DE.js +0 -27
  35. package/es/locale/el_GR.js +0 -27
  36. package/es/locale/en_GB.js +0 -27
  37. package/es/locale/en_US.js +0 -28
  38. package/es/locale/es_ES.js +0 -27
  39. package/es/locale/et_EE.js +0 -27
  40. package/es/locale/fa_IR.js +0 -27
  41. package/es/locale/fi_FI.js +0 -27
  42. package/es/locale/fr_BE.js +0 -27
  43. package/es/locale/fr_FR.js +0 -27
  44. package/es/locale/he_IL.js +0 -28
  45. package/es/locale/hi_IN.js +0 -28
  46. package/es/locale/hr_HR.js +0 -28
  47. package/es/locale/hu_HU.js +0 -27
  48. package/es/locale/id_ID.js +0 -28
  49. package/es/locale/is_IS.js +0 -27
  50. package/es/locale/it_IT.js +0 -27
  51. package/es/locale/ja_JP.js +0 -26
  52. package/es/locale/kn_IN.js +0 -28
  53. package/es/locale/ko_KR.js +0 -27
  54. package/es/locale/ku_IQ.js +0 -27
  55. package/es/locale/lv_LV.js +0 -27
  56. package/es/locale/mm_MM.js +0 -28
  57. package/es/locale/mn_MN.js +0 -28
  58. package/es/locale/ms_MY.js +0 -27
  59. package/es/locale/nb_NO.js +0 -27
  60. package/es/locale/nl_BE.js +0 -27
  61. package/es/locale/nl_NL.js +0 -27
  62. package/es/locale/pl_PL.js +0 -27
  63. package/es/locale/pt_BR.js +0 -27
  64. package/es/locale/pt_PT.js +0 -27
  65. package/es/locale/ro_RO.js +0 -28
  66. package/es/locale/ru_RU.js +0 -27
  67. package/es/locale/sk_SK.js +0 -27
  68. package/es/locale/sl_SI.js +0 -27
  69. package/es/locale/sr_RS.js +0 -27
  70. package/es/locale/sv_SE.js +0 -27
  71. package/es/locale/ta_IN.js +0 -28
  72. package/es/locale/th_TH.js +0 -27
  73. package/es/locale/tr_TR.js +0 -27
  74. package/es/locale/ug_CN.js +0 -26
  75. package/es/locale/uk_UA.js +0 -27
  76. package/es/locale/vi_VN.js +0 -28
  77. package/es/locale/zh_CN.js +0 -27
  78. package/es/locale/zh_TW.js +0 -26
  79. package/es/mixin/CalendarMixin.js +0 -123
  80. package/es/mixin/CommonMixin.js +0 -85
  81. package/es/month/MonthPanel.js +0 -154
  82. package/es/month/MonthTable.js +0 -156
  83. package/es/picker/placements.js +0 -35
  84. package/es/range-calendar/CalendarPart.js +0 -151
  85. package/es/util/dayjs.js +0 -17
  86. package/es/util/index.js +0 -105
  87. package/es/util/toTime.js +0 -21
  88. package/es/year/YearPanel.js +0 -194
  89. package/lib/Calendar.js +0 -504
  90. package/lib/FullCalendar.js +0 -221
  91. package/lib/MonthCalendar.js +0 -172
  92. package/lib/Picker.js +0 -282
  93. package/lib/RangeCalendar.js +0 -925
  94. package/lib/calendar/CalendarFooter.js +0 -134
  95. package/lib/calendar/CalendarHeader.js +0 -290
  96. package/lib/calendar/CalendarRightPanel.js +0 -145
  97. package/lib/calendar/OkButton.js +0 -32
  98. package/lib/calendar/TimePickerButton.js +0 -41
  99. package/lib/calendar/TodayButton.js +0 -39
  100. package/lib/date/DateConstants.js +0 -23
  101. package/lib/date/DateInput.js +0 -265
  102. package/lib/date/DateTBody.js +0 -307
  103. package/lib/date/DateTHead.js +0 -105
  104. package/lib/date/DateTable.js +0 -54
  105. package/lib/decade/DecadePanel.js +0 -207
  106. package/lib/full-calendar/CalendarHeader.js +0 -201
  107. package/lib/index.js +0 -12
  108. package/lib/locale/ar_EG.js +0 -31
  109. package/lib/locale/bg_BG.js +0 -31
  110. package/lib/locale/ca_ES.js +0 -31
  111. package/lib/locale/cs_CZ.js +0 -31
  112. package/lib/locale/da_DK.js +0 -31
  113. package/lib/locale/de_DE.js +0 -31
  114. package/lib/locale/el_GR.js +0 -31
  115. package/lib/locale/en_GB.js +0 -31
  116. package/lib/locale/en_US.js +0 -32
  117. package/lib/locale/es_ES.js +0 -31
  118. package/lib/locale/et_EE.js +0 -31
  119. package/lib/locale/fa_IR.js +0 -31
  120. package/lib/locale/fi_FI.js +0 -31
  121. package/lib/locale/fr_BE.js +0 -31
  122. package/lib/locale/fr_FR.js +0 -31
  123. package/lib/locale/he_IL.js +0 -32
  124. package/lib/locale/hi_IN.js +0 -32
  125. package/lib/locale/hr_HR.js +0 -32
  126. package/lib/locale/hu_HU.js +0 -31
  127. package/lib/locale/id_ID.js +0 -32
  128. package/lib/locale/is_IS.js +0 -31
  129. package/lib/locale/it_IT.js +0 -31
  130. package/lib/locale/ja_JP.js +0 -30
  131. package/lib/locale/kn_IN.js +0 -32
  132. package/lib/locale/ko_KR.js +0 -31
  133. package/lib/locale/ku_IQ.js +0 -31
  134. package/lib/locale/lv_LV.js +0 -31
  135. package/lib/locale/mm_MM.js +0 -32
  136. package/lib/locale/mn_MN.js +0 -32
  137. package/lib/locale/ms_MY.js +0 -31
  138. package/lib/locale/nb_NO.js +0 -31
  139. package/lib/locale/nl_BE.js +0 -31
  140. package/lib/locale/nl_NL.js +0 -31
  141. package/lib/locale/pl_PL.js +0 -31
  142. package/lib/locale/pt_BR.js +0 -31
  143. package/lib/locale/pt_PT.js +0 -31
  144. package/lib/locale/ro_RO.js +0 -32
  145. package/lib/locale/ru_RU.js +0 -31
  146. package/lib/locale/sk_SK.js +0 -31
  147. package/lib/locale/sl_SI.js +0 -31
  148. package/lib/locale/sr_RS.js +0 -31
  149. package/lib/locale/sv_SE.js +0 -31
  150. package/lib/locale/ta_IN.js +0 -32
  151. package/lib/locale/th_TH.js +0 -31
  152. package/lib/locale/tr_TR.js +0 -31
  153. package/lib/locale/ug_CN.js +0 -30
  154. package/lib/locale/uk_UA.js +0 -31
  155. package/lib/locale/vi_VN.js +0 -32
  156. package/lib/locale/zh_CN.js +0 -31
  157. package/lib/locale/zh_TW.js +0 -30
  158. package/lib/mixin/CalendarMixin.js +0 -153
  159. package/lib/mixin/CommonMixin.js +0 -106
  160. package/lib/month/MonthPanel.js +0 -179
  161. package/lib/month/MonthTable.js +0 -181
  162. package/lib/picker/placements.js +0 -39
  163. package/lib/range-calendar/CalendarPart.js +0 -184
  164. package/lib/util/dayjs.js +0 -46
  165. package/lib/util/index.js +0 -130
  166. package/lib/util/toTime.js +0 -28
  167. package/lib/year/YearPanel.js +0 -219
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- var DATE_ROW_COLUMN_COUNT = {
5
- DATE_ROW_COUNT: 6,
6
- DATE_COL_COUNT: 7
7
- };
8
-
9
- var DAY_NAME_TO_INDEX = {
10
- Sunday: 0,
11
- Monday: 1,
12
- Tuesday: 2,
13
- Wednesday: 3,
14
- Thursday: 4,
15
- Friday: 5,
16
- Saturday: 6
17
- };
18
-
19
- exports["default"] = {
20
- DATE_ROW_COLUMN_COUNT: DATE_ROW_COLUMN_COUNT,
21
- DAY_NAME_TO_INDEX: DAY_NAME_TO_INDEX
22
- };
23
- module.exports = exports['default'];
@@ -1,265 +0,0 @@
1
- 'use strict';
2
-
3
- exports.__esModule = true;
4
-
5
- var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
6
-
7
- var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
8
-
9
- var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
10
-
11
- var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
12
-
13
- var _inherits2 = require('babel-runtime/helpers/inherits');
14
-
15
- var _inherits3 = _interopRequireDefault(_inherits2);
16
-
17
- var _react = require('react');
18
-
19
- var _react2 = _interopRequireDefault(_react);
20
-
21
- var _reactDom = require('react-dom');
22
-
23
- var _reactDom2 = _interopRequireDefault(_reactDom);
24
-
25
- var _propTypes = require('prop-types');
26
-
27
- var _propTypes2 = _interopRequireDefault(_propTypes);
28
-
29
- var _KeyCode = require('rc-util/lib/KeyCode');
30
-
31
- var _KeyCode2 = _interopRequireDefault(_KeyCode);
32
-
33
- var _reactLifecyclesCompat = require('react-lifecycles-compat');
34
-
35
- var _dayjs = require('dayjs');
36
-
37
- var _dayjs2 = _interopRequireDefault(_dayjs);
38
-
39
- var _util = require('../util');
40
-
41
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
42
-
43
- var cachedSelectionStart = void 0;
44
- var cachedSelectionEnd = void 0;
45
- var dateInputInstance = void 0;
46
-
47
- var DateInput = function (_React$Component) {
48
- (0, _inherits3['default'])(DateInput, _React$Component);
49
-
50
- function DateInput(props) {
51
- (0, _classCallCheck3['default'])(this, DateInput);
52
-
53
- var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
54
-
55
- _initialiseProps.call(_this);
56
-
57
- var selectedValue = props.selectedValue;
58
-
59
- _this.state = {
60
- str: (0, _util.formatDate)(selectedValue, _this.props.format),
61
- invalid: false,
62
- hasFocus: false
63
- };
64
- return _this;
65
- }
66
-
67
- DateInput.prototype.componentDidUpdate = function componentDidUpdate() {
68
- if (dateInputInstance && this.state.hasFocus && !this.state.invalid && !(cachedSelectionStart === 0 && cachedSelectionEnd === 0)) {
69
- dateInputInstance.setSelectionRange(cachedSelectionStart, cachedSelectionEnd);
70
- }
71
- };
72
-
73
- DateInput.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, state) {
74
- var newState = {};
75
-
76
- if (dateInputInstance) {
77
- cachedSelectionStart = dateInputInstance.selectionStart;
78
- cachedSelectionEnd = dateInputInstance.selectionEnd;
79
- }
80
- // when popup show, click body will call this, bug!
81
- var selectedValue = nextProps.selectedValue;
82
- if (!state.hasFocus) {
83
- newState = {
84
- str: (0, _util.formatDate)(selectedValue, nextProps.format),
85
- invalid: false
86
- };
87
- }
88
-
89
- return newState;
90
- };
91
-
92
- DateInput.getInstance = function getInstance() {
93
- return dateInputInstance;
94
- };
95
-
96
- DateInput.prototype.render = function render() {
97
- var props = this.props;
98
- var _state = this.state,
99
- invalid = _state.invalid,
100
- str = _state.str;
101
- var locale = props.locale,
102
- prefixCls = props.prefixCls,
103
- placeholder = props.placeholder,
104
- clearIcon = props.clearIcon,
105
- inputMode = props.inputMode;
106
-
107
- var invalidClass = invalid ? prefixCls + '-input-invalid' : '';
108
- return _react2['default'].createElement(
109
- 'div',
110
- { className: prefixCls + '-input-wrap' },
111
- _react2['default'].createElement(
112
- 'div',
113
- { className: prefixCls + '-date-input-wrap' },
114
- _react2['default'].createElement('input', {
115
- ref: this.saveDateInput,
116
- className: prefixCls + '-input ' + invalidClass,
117
- value: str,
118
- disabled: props.disabled,
119
- placeholder: placeholder,
120
- onChange: this.onInputChange,
121
- onKeyDown: this.onKeyDown,
122
- onFocus: this.onFocus,
123
- onBlur: this.onBlur,
124
- inputMode: inputMode
125
- })
126
- ),
127
- props.showClear ? _react2['default'].createElement(
128
- 'a',
129
- {
130
- role: 'button',
131
- title: locale.clear,
132
- onClick: this.onClear
133
- },
134
- clearIcon || _react2['default'].createElement('span', { className: prefixCls + '-clear-btn' })
135
- ) : null
136
- );
137
- };
138
-
139
- return DateInput;
140
- }(_react2['default'].Component);
141
-
142
- DateInput.propTypes = {
143
- prefixCls: _propTypes2['default'].string,
144
- timePicker: _propTypes2['default'].object,
145
- value: _propTypes2['default'].object,
146
- disabledTime: _propTypes2['default'].any,
147
- format: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].arrayOf(_propTypes2['default'].string)]),
148
- locale: _propTypes2['default'].object,
149
- disabledDate: _propTypes2['default'].func,
150
- onChange: _propTypes2['default'].func,
151
- onClear: _propTypes2['default'].func,
152
- placeholder: _propTypes2['default'].string,
153
- onSelect: _propTypes2['default'].func,
154
- selectedValue: _propTypes2['default'].object,
155
- clearIcon: _propTypes2['default'].node,
156
- inputMode: _propTypes2['default'].string
157
- };
158
-
159
- var _initialiseProps = function _initialiseProps() {
160
- var _this2 = this;
161
-
162
- this.onClear = function () {
163
- _this2.setState({
164
- str: ''
165
- });
166
- _this2.props.onClear(null);
167
- };
168
-
169
- this.onInputChange = function (event) {
170
- var str = event.target.value;
171
- var _props = _this2.props,
172
- disabledDate = _props.disabledDate,
173
- format = _props.format,
174
- onChange = _props.onChange,
175
- selectedValue = _props.selectedValue;
176
-
177
- // 没有内容,合法并直接退出
178
-
179
- if (!str) {
180
- onChange(null);
181
- _this2.setState({
182
- invalid: false,
183
- str: str
184
- });
185
- return;
186
- }
187
-
188
- // 不合法直接退出
189
- var parsed = (0, _dayjs2['default'])(str, format, true);
190
- if (!parsed.isValid()) {
191
- _this2.setState({
192
- invalid: true,
193
- str: str
194
- });
195
- return;
196
- }
197
-
198
- var value = _this2.props.value.clone();
199
- value = value.year(parsed.year()).month(parsed.month()).date(parsed.date()).hour(parsed.hour()).minute(parsed.minute()).second(parsed.second());
200
-
201
- if (!value || disabledDate && disabledDate(value)) {
202
- _this2.setState({
203
- invalid: true,
204
- str: str
205
- });
206
- return;
207
- }
208
-
209
- if (selectedValue !== value || selectedValue && value && !selectedValue.isSame(value)) {
210
- _this2.setState({
211
- invalid: false,
212
- str: str
213
- });
214
- onChange(value);
215
- }
216
- };
217
-
218
- this.onFocus = function () {
219
- _this2.setState({ hasFocus: true });
220
- };
221
-
222
- this.onBlur = function () {
223
- _this2.setState(function (prevState, prevProps) {
224
- return {
225
- hasFocus: false,
226
- str: (0, _util.formatDate)(prevProps.value, prevProps.format)
227
- };
228
- });
229
- };
230
-
231
- this.onKeyDown = function (event) {
232
- var keyCode = event.keyCode;
233
- var _props2 = _this2.props,
234
- onSelect = _props2.onSelect,
235
- value = _props2.value,
236
- disabledDate = _props2.disabledDate;
237
-
238
- if (keyCode === _KeyCode2['default'].ENTER && onSelect) {
239
- var validateDate = !disabledDate || !disabledDate(value);
240
- if (validateDate) {
241
- onSelect(value.clone());
242
- }
243
- event.preventDefault();
244
- }
245
- };
246
-
247
- this.getRootDOMNode = function () {
248
- return _reactDom2['default'].findDOMNode(_this2);
249
- };
250
-
251
- this.focus = function () {
252
- if (dateInputInstance) {
253
- dateInputInstance.focus();
254
- }
255
- };
256
-
257
- this.saveDateInput = function (dateInput) {
258
- dateInputInstance = dateInput;
259
- };
260
- };
261
-
262
- (0, _reactLifecyclesCompat.polyfill)(DateInput);
263
-
264
- exports['default'] = DateInput;
265
- module.exports = exports['default'];
@@ -1,307 +0,0 @@
1
- 'use strict';
2
-
3
- exports.__esModule = true;
4
-
5
- var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
6
-
7
- var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
8
-
9
- var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
10
-
11
- var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
12
-
13
- var _inherits2 = require('babel-runtime/helpers/inherits');
14
-
15
- var _inherits3 = _interopRequireDefault(_inherits2);
16
-
17
- var _react = require('react');
18
-
19
- var _react2 = _interopRequireDefault(_react);
20
-
21
- var _propTypes = require('prop-types');
22
-
23
- var _propTypes2 = _interopRequireDefault(_propTypes);
24
-
25
- var _classnames = require('classnames');
26
-
27
- var _classnames2 = _interopRequireDefault(_classnames);
28
-
29
- var _DateConstants = require('./DateConstants');
30
-
31
- var _DateConstants2 = _interopRequireDefault(_DateConstants);
32
-
33
- var _util = require('../util/');
34
-
35
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
36
-
37
- var DATE_ROW_COLUMN_COUNT = _DateConstants2['default'].DATE_ROW_COLUMN_COUNT,
38
- DAY_NAME_TO_INDEX = _DateConstants2['default'].DAY_NAME_TO_INDEX;
39
-
40
-
41
- function isSameDay(one, two) {
42
- return one && two && one.isSame(two, 'day');
43
- }
44
-
45
- function beforeCurrentMonthYear(current, today) {
46
- if (current.year() < today.year()) {
47
- return 1;
48
- }
49
- return current.year() === today.year() && current.month() < today.month();
50
- }
51
-
52
- function afterCurrentMonthYear(current, today) {
53
- if (current.year() > today.year()) {
54
- return 1;
55
- }
56
- return current.year() === today.year() && current.month() > today.month();
57
- }
58
-
59
- function getIdFromDate(date) {
60
- return 'rc-calendar-' + date.year() + '-' + date.month() + '-' + date.date();
61
- }
62
-
63
- var DateTBody = function (_React$Component) {
64
- (0, _inherits3['default'])(DateTBody, _React$Component);
65
-
66
- function DateTBody() {
67
- (0, _classCallCheck3['default'])(this, DateTBody);
68
- return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
69
- }
70
-
71
- DateTBody.prototype.render = function render() {
72
- var props = this.props;
73
- var contentRender = props.contentRender,
74
- prefixCls = props.prefixCls,
75
- selectedValue = props.selectedValue,
76
- value = props.value,
77
- showWeekNumber = props.showWeekNumber,
78
- dateRender = props.dateRender,
79
- disabledDate = props.disabledDate,
80
- hoverValue = props.hoverValue,
81
- firstDayOfWeek = props.firstDayOfWeek;
82
-
83
- var iIndex = void 0;
84
- var jIndex = void 0;
85
- var current = void 0;
86
- var dateTable = [];
87
- var today = (0, _util.getTodayTime)(value);
88
- var cellClass = prefixCls + '-cell';
89
- var weekNumberCellClass = prefixCls + '-week-number-cell';
90
- var dateClass = prefixCls + '-date';
91
- var todayClass = prefixCls + '-today';
92
- var selectedClass = prefixCls + '-selected-day';
93
- var selectedDateClass = prefixCls + '-selected-date'; // do not move with mouse operation
94
- var selectedStartDateClass = prefixCls + '-selected-start-date';
95
- var selectedEndDateClass = prefixCls + '-selected-end-date';
96
- var inRangeClass = prefixCls + '-in-range-cell';
97
- var lastMonthDayClass = prefixCls + '-last-month-cell';
98
- var nextMonthDayClass = prefixCls + '-next-month-btn-day';
99
- var disabledClass = prefixCls + '-disabled-cell';
100
- var firstDisableClass = prefixCls + '-disabled-cell-first-of-row';
101
- var lastDisableClass = prefixCls + '-disabled-cell-last-of-row';
102
- var lastDayOfMonthClass = prefixCls + '-last-day-of-month';
103
- var month1 = value.clone();
104
- month1 = month1.date(1);
105
- var day = month1.day();
106
- var firstDayName = typeof firstDayOfWeek === 'string' ? firstDayOfWeek[0].toUpperCase() + firstDayOfWeek.slice(1) : 'Sunday';
107
- var firstDayIndex = DAY_NAME_TO_INDEX[firstDayName] ? DAY_NAME_TO_INDEX[firstDayName] : 0;
108
- var lastMonthDiffDay = (day + 7 - firstDayIndex) % 7;
109
- // calculate last month
110
- var lastMonth1 = month1.clone();
111
- lastMonth1 = lastMonth1.add(0 - lastMonthDiffDay, 'days');
112
- var passed = 0;
113
-
114
- for (iIndex = 0; iIndex < DATE_ROW_COLUMN_COUNT.DATE_ROW_COUNT; iIndex++) {
115
- for (jIndex = 0; jIndex < DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT; jIndex++) {
116
- current = lastMonth1;
117
- if (passed) {
118
- current = current.clone();
119
- current = current.add(passed, 'days');
120
- }
121
- dateTable.push(current);
122
- passed++;
123
- }
124
- }
125
- var tableHtml = [];
126
- passed = 0;
127
-
128
- for (iIndex = 0; iIndex < DATE_ROW_COLUMN_COUNT.DATE_ROW_COUNT; iIndex++) {
129
- var _cx;
130
-
131
- var isCurrentWeek = void 0;
132
- var weekNumberCell = void 0;
133
- var isActiveWeek = false;
134
- var dateCells = [];
135
- if (showWeekNumber) {
136
- weekNumberCell = _react2['default'].createElement(
137
- 'td',
138
- {
139
- key: dateTable[passed].week(),
140
- role: 'gridcell',
141
- className: weekNumberCellClass
142
- },
143
- dateTable[passed].week()
144
- );
145
- }
146
- for (jIndex = 0; jIndex < DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT; jIndex++) {
147
- var next = null;
148
- var last = null;
149
- current = dateTable[passed];
150
- if (jIndex < DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT - 1) {
151
- next = dateTable[passed + 1];
152
- }
153
- if (jIndex > 0) {
154
- last = dateTable[passed - 1];
155
- }
156
- var cls = cellClass;
157
- var disabled = false;
158
- var selected = false;
159
-
160
- if (isSameDay(current, today)) {
161
- cls += ' ' + todayClass;
162
- isCurrentWeek = true;
163
- }
164
-
165
- var isBeforeCurrentMonthYear = beforeCurrentMonthYear(current, value);
166
- var isAfterCurrentMonthYear = afterCurrentMonthYear(current, value);
167
-
168
- if (selectedValue && Array.isArray(selectedValue)) {
169
- var rangeValue = hoverValue.length ? hoverValue : selectedValue;
170
- if (!isBeforeCurrentMonthYear && !isAfterCurrentMonthYear) {
171
- var startValue = rangeValue[0];
172
- var endValue = rangeValue[1];
173
- if (startValue) {
174
- if (isSameDay(current, startValue)) {
175
- selected = true;
176
- isActiveWeek = true;
177
- cls += ' ' + selectedStartDateClass;
178
- }
179
- }
180
- if (startValue || endValue) {
181
- if (isSameDay(current, endValue)) {
182
- selected = true;
183
- isActiveWeek = true;
184
- cls += ' ' + selectedEndDateClass;
185
- } else if ((startValue === null || startValue === undefined) && current.isBefore(endValue, 'day')) {
186
- cls += ' ' + inRangeClass;
187
- } else if ((endValue === null || endValue === undefined) && current.isAfter(startValue, 'day')) {
188
- cls += ' ' + inRangeClass;
189
- } else if (current.isAfter(startValue, 'day') && current.isBefore(endValue, 'day')) {
190
- cls += ' ' + inRangeClass;
191
- }
192
- }
193
- }
194
- } else if (isSameDay(current, value)) {
195
- // keyboard change value, highlight works
196
- selected = true;
197
- isActiveWeek = true;
198
- }
199
-
200
- if (isSameDay(current, selectedValue)) {
201
- cls += ' ' + selectedDateClass;
202
- }
203
-
204
- if (isBeforeCurrentMonthYear) {
205
- cls += ' ' + lastMonthDayClass;
206
- }
207
-
208
- if (isAfterCurrentMonthYear) {
209
- cls += ' ' + nextMonthDayClass;
210
- }
211
-
212
- if (current.clone().endOf('month').date() === current.date()) {
213
- cls += ' ' + lastDayOfMonthClass;
214
- }
215
-
216
- if (disabledDate) {
217
- if (disabledDate(current, value)) {
218
- disabled = true;
219
-
220
- if (!last || !disabledDate(last, value)) {
221
- cls += ' ' + firstDisableClass;
222
- }
223
-
224
- if (!next || !disabledDate(next, value)) {
225
- cls += ' ' + lastDisableClass;
226
- }
227
- }
228
- }
229
-
230
- if (selected) {
231
- cls += ' ' + selectedClass;
232
- }
233
-
234
- if (disabled) {
235
- cls += ' ' + disabledClass;
236
- }
237
-
238
- var dateHtml = void 0;
239
- if (dateRender) {
240
- dateHtml = dateRender(current, value);
241
- } else {
242
- var content = contentRender ? contentRender(current, value) : current.date();
243
- dateHtml = _react2['default'].createElement(
244
- 'div',
245
- {
246
- key: getIdFromDate(current),
247
- className: dateClass,
248
- 'aria-selected': selected,
249
- 'aria-disabled': disabled
250
- },
251
- content
252
- );
253
- }
254
-
255
- dateCells.push(_react2['default'].createElement(
256
- 'td',
257
- {
258
- key: passed,
259
- onClick: disabled ? undefined : props.onSelect.bind(null, current),
260
- onMouseEnter: disabled ? undefined : props.onDayHover && props.onDayHover.bind(null, current) || undefined,
261
- role: 'gridcell',
262
- title: (0, _util.getTitleString)(current),
263
- className: cls
264
- },
265
- dateHtml
266
- ));
267
-
268
- passed++;
269
- }
270
-
271
- tableHtml.push(_react2['default'].createElement(
272
- 'tr',
273
- {
274
- key: iIndex,
275
- role: 'row',
276
- className: (0, _classnames2['default'])((_cx = {}, _cx[prefixCls + '-current-week'] = isCurrentWeek, _cx[prefixCls + '-active-week'] = isActiveWeek, _cx))
277
- },
278
- weekNumberCell,
279
- dateCells
280
- ));
281
- }
282
- return _react2['default'].createElement(
283
- 'tbody',
284
- { className: prefixCls + '-tbody' },
285
- tableHtml
286
- );
287
- };
288
-
289
- return DateTBody;
290
- }(_react2['default'].Component);
291
-
292
- DateTBody.propTypes = {
293
- contentRender: _propTypes2['default'].func,
294
- dateRender: _propTypes2['default'].func,
295
- disabledDate: _propTypes2['default'].func,
296
- prefixCls: _propTypes2['default'].string,
297
- selectedValue: _propTypes2['default'].oneOfType([_propTypes2['default'].object, _propTypes2['default'].arrayOf(_propTypes2['default'].object)]),
298
- value: _propTypes2['default'].object,
299
- hoverValue: _propTypes2['default'].any,
300
- showWeekNumber: _propTypes2['default'].bool,
301
- firstDayOfWeek: _propTypes2['default'].string
302
- };
303
- DateTBody.defaultProps = {
304
- hoverValue: []
305
- };
306
- exports['default'] = DateTBody;
307
- module.exports = exports['default'];
@@ -1,105 +0,0 @@
1
- 'use strict';
2
-
3
- exports.__esModule = true;
4
-
5
- var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
6
-
7
- var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
8
-
9
- var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
10
-
11
- var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
12
-
13
- var _inherits2 = require('babel-runtime/helpers/inherits');
14
-
15
- var _inherits3 = _interopRequireDefault(_inherits2);
16
-
17
- var _react = require('react');
18
-
19
- var _react2 = _interopRequireDefault(_react);
20
-
21
- var _DateConstants = require('./DateConstants');
22
-
23
- var _DateConstants2 = _interopRequireDefault(_DateConstants);
24
-
25
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
26
-
27
- var DAY_NAME_TO_INDEX = _DateConstants2['default'].DAY_NAME_TO_INDEX,
28
- DATE_ROW_COLUMN_COUNT = _DateConstants2['default'].DATE_ROW_COLUMN_COUNT;
29
-
30
- var DateTHead = function (_React$Component) {
31
- (0, _inherits3['default'])(DateTHead, _React$Component);
32
-
33
- function DateTHead() {
34
- (0, _classCallCheck3['default'])(this, DateTHead);
35
- return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
36
- }
37
-
38
- DateTHead.prototype.render = function render() {
39
- var props = this.props;
40
- var value = props.value;
41
- var localeData = value.localeData();
42
- var prefixCls = props.prefixCls;
43
- var veryShortWeekdays = [];
44
- var weekDays = [];
45
-
46
- var allWeekdaysMin = localeData.weekdaysMin();
47
- var allWeekdaysShort = localeData.weekdaysShort();
48
-
49
- var firstDayName = typeof props.firstDayOfWeek === 'string' ? props.firstDayOfWeek[0].toUpperCase() + props.firstDayOfWeek.slice(1) : 'Sunday';
50
- var firstDay = DAY_NAME_TO_INDEX[firstDayName] ? DAY_NAME_TO_INDEX[firstDayName] : 0;
51
-
52
- var showWeekNumberEl = void 0;
53
- for (var dateColIndex = 0; dateColIndex < DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT; dateColIndex++) {
54
- var index = (firstDay + dateColIndex) % DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT;
55
- veryShortWeekdays[dateColIndex] = allWeekdaysMin[index];
56
- weekDays[dateColIndex] = allWeekdaysShort[index];
57
- }
58
-
59
- if (props.showWeekNumber) {
60
- showWeekNumberEl = _react2['default'].createElement(
61
- 'th',
62
- {
63
- role: 'columnheader',
64
- className: prefixCls + '-column-header ' + prefixCls + '-week-number-header'
65
- },
66
- _react2['default'].createElement(
67
- 'span',
68
- { className: prefixCls + '-column-header-inner' },
69
- 'x'
70
- )
71
- );
72
- }
73
- var weekDaysEls = weekDays.map(function (day, xindex) {
74
- return _react2['default'].createElement(
75
- 'th',
76
- {
77
- key: xindex,
78
- role: 'columnheader',
79
- title: day,
80
- className: prefixCls + '-column-header'
81
- },
82
- _react2['default'].createElement(
83
- 'span',
84
- { className: prefixCls + '-column-header-inner' },
85
- veryShortWeekdays[xindex]
86
- )
87
- );
88
- });
89
- return _react2['default'].createElement(
90
- 'thead',
91
- null,
92
- _react2['default'].createElement(
93
- 'tr',
94
- { role: 'row' },
95
- showWeekNumberEl,
96
- weekDaysEls
97
- )
98
- );
99
- };
100
-
101
- return DateTHead;
102
- }(_react2['default'].Component);
103
-
104
- exports['default'] = DateTHead;
105
- module.exports = exports['default'];