@seafile/seafile-calendar 0.0.13 → 0.0.17

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 (166) hide show
  1. package/index.d.ts +10 -10
  2. package/package.json +2 -2
  3. package/assets/index.css +0 -1186
  4. package/dist/rc-calendar.css +0 -1188
  5. package/dist/rc-calendar.css.map +0 -1
  6. package/dist/rc-calendar.js +0 -12626
  7. package/dist/rc-calendar.js.map +0 -1
  8. package/dist/rc-calendar.min.css +0 -1188
  9. package/dist/rc-calendar.min.css.map +0 -1
  10. package/dist/rc-calendar.min.js +0 -1
  11. package/es/Calendar.js +0 -428
  12. package/es/FullCalendar.js +0 -182
  13. package/es/MonthCalendar.js +0 -135
  14. package/es/Picker.js +0 -245
  15. package/es/RangeCalendar.js +0 -876
  16. package/es/calendar/CalendarFooter.js +0 -93
  17. package/es/calendar/CalendarHeader.js +0 -257
  18. package/es/calendar/CalendarRightPanel.js +0 -110
  19. package/es/calendar/OkButton.js +0 -22
  20. package/es/calendar/TimePickerButton.js +0 -28
  21. package/es/calendar/TodayButton.js +0 -28
  22. package/es/date/DateConstants.js +0 -4
  23. package/es/date/DateInput.js +0 -233
  24. package/es/date/DateTBody.js +0 -275
  25. package/es/date/DateTHead.js +0 -81
  26. package/es/date/DateTable.js +0 -32
  27. package/es/decade/DecadePanel.js +0 -181
  28. package/es/full-calendar/CalendarHeader.js +0 -180
  29. package/es/index.js +0 -3
  30. package/es/locale/ar_EG.js +0 -27
  31. package/es/locale/bg_BG.js +0 -27
  32. package/es/locale/ca_ES.js +0 -27
  33. package/es/locale/cs_CZ.js +0 -27
  34. package/es/locale/da_DK.js +0 -27
  35. package/es/locale/de_DE.js +0 -27
  36. package/es/locale/el_GR.js +0 -27
  37. package/es/locale/en_GB.js +0 -27
  38. package/es/locale/en_US.js +0 -28
  39. package/es/locale/es_ES.js +0 -27
  40. package/es/locale/et_EE.js +0 -27
  41. package/es/locale/fa_IR.js +0 -27
  42. package/es/locale/fi_FI.js +0 -27
  43. package/es/locale/fr_BE.js +0 -27
  44. package/es/locale/fr_FR.js +0 -27
  45. package/es/locale/he_IL.js +0 -28
  46. package/es/locale/hi_IN.js +0 -28
  47. package/es/locale/hr_HR.js +0 -28
  48. package/es/locale/hu_HU.js +0 -27
  49. package/es/locale/id_ID.js +0 -28
  50. package/es/locale/is_IS.js +0 -27
  51. package/es/locale/it_IT.js +0 -27
  52. package/es/locale/ja_JP.js +0 -26
  53. package/es/locale/kn_IN.js +0 -28
  54. package/es/locale/ko_KR.js +0 -27
  55. package/es/locale/ku_IQ.js +0 -27
  56. package/es/locale/lv_LV.js +0 -27
  57. package/es/locale/mm_MM.js +0 -28
  58. package/es/locale/mn_MN.js +0 -28
  59. package/es/locale/ms_MY.js +0 -27
  60. package/es/locale/nb_NO.js +0 -27
  61. package/es/locale/nl_BE.js +0 -27
  62. package/es/locale/nl_NL.js +0 -27
  63. package/es/locale/pl_PL.js +0 -27
  64. package/es/locale/pt_BR.js +0 -27
  65. package/es/locale/pt_PT.js +0 -27
  66. package/es/locale/ro_RO.js +0 -28
  67. package/es/locale/ru_RU.js +0 -27
  68. package/es/locale/sk_SK.js +0 -27
  69. package/es/locale/sl_SI.js +0 -27
  70. package/es/locale/sr_RS.js +0 -27
  71. package/es/locale/sv_SE.js +0 -27
  72. package/es/locale/ta_IN.js +0 -28
  73. package/es/locale/th_TH.js +0 -27
  74. package/es/locale/tr_TR.js +0 -27
  75. package/es/locale/ug_CN.js +0 -26
  76. package/es/locale/uk_UA.js +0 -27
  77. package/es/locale/vi_VN.js +0 -28
  78. package/es/locale/zh_CN.js +0 -27
  79. package/es/locale/zh_TW.js +0 -26
  80. package/es/mixin/CalendarMixin.js +0 -123
  81. package/es/mixin/CommonMixin.js +0 -85
  82. package/es/month/MonthPanel.js +0 -154
  83. package/es/month/MonthTable.js +0 -156
  84. package/es/picker/placements.js +0 -35
  85. package/es/range-calendar/CalendarPart.js +0 -151
  86. package/es/util/index.js +0 -102
  87. package/es/util/toTime.js +0 -21
  88. package/es/year/YearPanel.js +0 -202
  89. package/lib/Calendar.js +0 -481
  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 -134
  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 -8
  101. package/lib/date/DateInput.js +0 -265
  102. package/lib/date/DateTBody.js +0 -302
  103. package/lib/date/DateTHead.js +0 -104
  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/index.js +0 -124
  165. package/lib/util/toTime.js +0 -28
  166. package/lib/year/YearPanel.js +0 -227
@@ -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 _moment = require('moment');
36
-
37
- var _moment2 = _interopRequireDefault(_moment);
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, _moment2['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.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,302 +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
- function isSameDay(one, two) {
38
- return one && two && one.isSame(two, 'day');
39
- }
40
-
41
- function beforeCurrentMonthYear(current, today) {
42
- if (current.year() < today.year()) {
43
- return 1;
44
- }
45
- return current.year() === today.year() && current.month() < today.month();
46
- }
47
-
48
- function afterCurrentMonthYear(current, today) {
49
- if (current.year() > today.year()) {
50
- return 1;
51
- }
52
- return current.year() === today.year() && current.month() > today.month();
53
- }
54
-
55
- function getIdFromDate(date) {
56
- return 'rc-calendar-' + date.year() + '-' + date.month() + '-' + date.date();
57
- }
58
-
59
- var DateTBody = function (_React$Component) {
60
- (0, _inherits3['default'])(DateTBody, _React$Component);
61
-
62
- function DateTBody() {
63
- (0, _classCallCheck3['default'])(this, DateTBody);
64
- return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
65
- }
66
-
67
- DateTBody.prototype.render = function render() {
68
- var props = this.props;
69
- var contentRender = props.contentRender,
70
- prefixCls = props.prefixCls,
71
- selectedValue = props.selectedValue,
72
- value = props.value,
73
- showWeekNumber = props.showWeekNumber,
74
- dateRender = props.dateRender,
75
- disabledDate = props.disabledDate,
76
- hoverValue = props.hoverValue;
77
-
78
- var iIndex = void 0;
79
- var jIndex = void 0;
80
- var current = void 0;
81
- var dateTable = [];
82
- var today = (0, _util.getTodayTime)(value);
83
- var cellClass = prefixCls + '-cell';
84
- var weekNumberCellClass = prefixCls + '-week-number-cell';
85
- var dateClass = prefixCls + '-date';
86
- var todayClass = prefixCls + '-today';
87
- var selectedClass = prefixCls + '-selected-day';
88
- var selectedDateClass = prefixCls + '-selected-date'; // do not move with mouse operation
89
- var selectedStartDateClass = prefixCls + '-selected-start-date';
90
- var selectedEndDateClass = prefixCls + '-selected-end-date';
91
- var inRangeClass = prefixCls + '-in-range-cell';
92
- var lastMonthDayClass = prefixCls + '-last-month-cell';
93
- var nextMonthDayClass = prefixCls + '-next-month-btn-day';
94
- var disabledClass = prefixCls + '-disabled-cell';
95
- var firstDisableClass = prefixCls + '-disabled-cell-first-of-row';
96
- var lastDisableClass = prefixCls + '-disabled-cell-last-of-row';
97
- var lastDayOfMonthClass = prefixCls + '-last-day-of-month';
98
- var month1 = value.clone();
99
- month1.date(1);
100
- var day = month1.day();
101
- // const firstDayOfWeek = value.localeData().firstDayOfWeek();
102
- // We set Sunday(7) as the first day of the week in seafile-calendar.
103
- var firstDayOfWeek = 7;
104
- var lastMonthDiffDay = (day + 7 - firstDayOfWeek) % 7;
105
- // calculate last month
106
- var lastMonth1 = month1.clone();
107
- lastMonth1.add(0 - lastMonthDiffDay, 'days');
108
- var passed = 0;
109
-
110
- for (iIndex = 0; iIndex < _DateConstants2['default'].DATE_ROW_COUNT; iIndex++) {
111
- for (jIndex = 0; jIndex < _DateConstants2['default'].DATE_COL_COUNT; jIndex++) {
112
- current = lastMonth1;
113
- if (passed) {
114
- current = current.clone();
115
- current.add(passed, 'days');
116
- }
117
- dateTable.push(current);
118
- passed++;
119
- }
120
- }
121
- var tableHtml = [];
122
- passed = 0;
123
-
124
- for (iIndex = 0; iIndex < _DateConstants2['default'].DATE_ROW_COUNT; iIndex++) {
125
- var _cx;
126
-
127
- var isCurrentWeek = void 0;
128
- var weekNumberCell = void 0;
129
- var isActiveWeek = false;
130
- var dateCells = [];
131
- if (showWeekNumber) {
132
- weekNumberCell = _react2['default'].createElement(
133
- 'td',
134
- {
135
- key: dateTable[passed].week(),
136
- role: 'gridcell',
137
- className: weekNumberCellClass
138
- },
139
- dateTable[passed].week()
140
- );
141
- }
142
- for (jIndex = 0; jIndex < _DateConstants2['default'].DATE_COL_COUNT; jIndex++) {
143
- var next = null;
144
- var last = null;
145
- current = dateTable[passed];
146
- if (jIndex < _DateConstants2['default'].DATE_COL_COUNT - 1) {
147
- next = dateTable[passed + 1];
148
- }
149
- if (jIndex > 0) {
150
- last = dateTable[passed - 1];
151
- }
152
- var cls = cellClass;
153
- var disabled = false;
154
- var selected = false;
155
-
156
- if (isSameDay(current, today)) {
157
- cls += ' ' + todayClass;
158
- isCurrentWeek = true;
159
- }
160
-
161
- var isBeforeCurrentMonthYear = beforeCurrentMonthYear(current, value);
162
- var isAfterCurrentMonthYear = afterCurrentMonthYear(current, value);
163
-
164
- if (selectedValue && Array.isArray(selectedValue)) {
165
- var rangeValue = hoverValue.length ? hoverValue : selectedValue;
166
- if (!isBeforeCurrentMonthYear && !isAfterCurrentMonthYear) {
167
- var startValue = rangeValue[0];
168
- var endValue = rangeValue[1];
169
- if (startValue) {
170
- if (isSameDay(current, startValue)) {
171
- selected = true;
172
- isActiveWeek = true;
173
- cls += ' ' + selectedStartDateClass;
174
- }
175
- }
176
- if (startValue || endValue) {
177
- if (isSameDay(current, endValue)) {
178
- selected = true;
179
- isActiveWeek = true;
180
- cls += ' ' + selectedEndDateClass;
181
- } else if ((startValue === null || startValue === undefined) && current.isBefore(endValue, 'day')) {
182
- cls += ' ' + inRangeClass;
183
- } else if ((endValue === null || endValue === undefined) && current.isAfter(startValue, 'day')) {
184
- cls += ' ' + inRangeClass;
185
- } else if (current.isAfter(startValue, 'day') && current.isBefore(endValue, 'day')) {
186
- cls += ' ' + inRangeClass;
187
- }
188
- }
189
- }
190
- } else if (isSameDay(current, value)) {
191
- // keyboard change value, highlight works
192
- selected = true;
193
- isActiveWeek = true;
194
- }
195
-
196
- if (isSameDay(current, selectedValue)) {
197
- cls += ' ' + selectedDateClass;
198
- }
199
-
200
- if (isBeforeCurrentMonthYear) {
201
- cls += ' ' + lastMonthDayClass;
202
- }
203
-
204
- if (isAfterCurrentMonthYear) {
205
- cls += ' ' + nextMonthDayClass;
206
- }
207
-
208
- if (current.clone().endOf('month').date() === current.date()) {
209
- cls += ' ' + lastDayOfMonthClass;
210
- }
211
-
212
- if (disabledDate) {
213
- if (disabledDate(current, value)) {
214
- disabled = true;
215
-
216
- if (!last || !disabledDate(last, value)) {
217
- cls += ' ' + firstDisableClass;
218
- }
219
-
220
- if (!next || !disabledDate(next, value)) {
221
- cls += ' ' + lastDisableClass;
222
- }
223
- }
224
- }
225
-
226
- if (selected) {
227
- cls += ' ' + selectedClass;
228
- }
229
-
230
- if (disabled) {
231
- cls += ' ' + disabledClass;
232
- }
233
-
234
- var dateHtml = void 0;
235
- if (dateRender) {
236
- dateHtml = dateRender(current, value);
237
- } else {
238
- var content = contentRender ? contentRender(current, value) : current.date();
239
- dateHtml = _react2['default'].createElement(
240
- 'div',
241
- {
242
- key: getIdFromDate(current),
243
- className: dateClass,
244
- 'aria-selected': selected,
245
- 'aria-disabled': disabled
246
- },
247
- content
248
- );
249
- }
250
-
251
- dateCells.push(_react2['default'].createElement(
252
- 'td',
253
- {
254
- key: passed,
255
- onClick: disabled ? undefined : props.onSelect.bind(null, current),
256
- onMouseEnter: disabled ? undefined : props.onDayHover && props.onDayHover.bind(null, current) || undefined,
257
- role: 'gridcell',
258
- title: (0, _util.getTitleString)(current),
259
- className: cls
260
- },
261
- dateHtml
262
- ));
263
-
264
- passed++;
265
- }
266
-
267
- tableHtml.push(_react2['default'].createElement(
268
- 'tr',
269
- {
270
- key: iIndex,
271
- role: 'row',
272
- className: (0, _classnames2['default'])((_cx = {}, _cx[prefixCls + '-current-week'] = isCurrentWeek, _cx[prefixCls + '-active-week'] = isActiveWeek, _cx))
273
- },
274
- weekNumberCell,
275
- dateCells
276
- ));
277
- }
278
- return _react2['default'].createElement(
279
- 'tbody',
280
- { className: prefixCls + '-tbody' },
281
- tableHtml
282
- );
283
- };
284
-
285
- return DateTBody;
286
- }(_react2['default'].Component);
287
-
288
- DateTBody.propTypes = {
289
- contentRender: _propTypes2['default'].func,
290
- dateRender: _propTypes2['default'].func,
291
- disabledDate: _propTypes2['default'].func,
292
- prefixCls: _propTypes2['default'].string,
293
- selectedValue: _propTypes2['default'].oneOfType([_propTypes2['default'].object, _propTypes2['default'].arrayOf(_propTypes2['default'].object)]),
294
- value: _propTypes2['default'].object,
295
- hoverValue: _propTypes2['default'].any,
296
- showWeekNumber: _propTypes2['default'].bool
297
- };
298
- DateTBody.defaultProps = {
299
- hoverValue: []
300
- };
301
- exports['default'] = DateTBody;
302
- module.exports = exports['default'];
@@ -1,104 +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
- var _moment = require('moment');
26
-
27
- var _moment2 = _interopRequireDefault(_moment);
28
-
29
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
30
-
31
- var DateTHead = function (_React$Component) {
32
- (0, _inherits3['default'])(DateTHead, _React$Component);
33
-
34
- function DateTHead() {
35
- (0, _classCallCheck3['default'])(this, DateTHead);
36
- return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
37
- }
38
-
39
- DateTHead.prototype.render = function render() {
40
- var props = this.props;
41
- var value = props.value;
42
- var localeData = value.localeData();
43
- var prefixCls = props.prefixCls;
44
- var veryShortWeekdays = [];
45
- var weekDays = [];
46
- // const firstDayOfWeek = localeData.firstDayOfWeek();
47
- // We set Sunday(7) as the first day of the week in seafile-calendar.
48
- var firstDayOfWeek = 7;
49
- var showWeekNumberEl = void 0;
50
- var now = (0, _moment2['default'])();
51
- for (var dateColIndex = 0; dateColIndex < _DateConstants2['default'].DATE_COL_COUNT; dateColIndex++) {
52
- var index = (firstDayOfWeek + dateColIndex) % _DateConstants2['default'].DATE_COL_COUNT;
53
- now.day(index);
54
- veryShortWeekdays[dateColIndex] = localeData.weekdaysMin(now);
55
- weekDays[dateColIndex] = localeData.weekdaysShort(now);
56
- }
57
-
58
- if (props.showWeekNumber) {
59
- showWeekNumberEl = _react2['default'].createElement(
60
- 'th',
61
- {
62
- role: 'columnheader',
63
- className: prefixCls + '-column-header ' + prefixCls + '-week-number-header'
64
- },
65
- _react2['default'].createElement(
66
- 'span',
67
- { className: prefixCls + '-column-header-inner' },
68
- 'x'
69
- )
70
- );
71
- }
72
- var weekDaysEls = weekDays.map(function (day, xindex) {
73
- return _react2['default'].createElement(
74
- 'th',
75
- {
76
- key: xindex,
77
- role: 'columnheader',
78
- title: day,
79
- className: prefixCls + '-column-header'
80
- },
81
- _react2['default'].createElement(
82
- 'span',
83
- { className: prefixCls + '-column-header-inner' },
84
- veryShortWeekdays[xindex]
85
- )
86
- );
87
- });
88
- return _react2['default'].createElement(
89
- 'thead',
90
- null,
91
- _react2['default'].createElement(
92
- 'tr',
93
- { role: 'row' },
94
- showWeekNumberEl,
95
- weekDaysEls
96
- )
97
- );
98
- };
99
-
100
- return DateTHead;
101
- }(_react2['default'].Component);
102
-
103
- exports['default'] = DateTHead;
104
- module.exports = exports['default'];