@seafile/seafile-calendar 0.0.28 → 0.0.29-alpha.1

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