@seafile/seafile-calendar 0.0.88899 → 0.1.0

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/dist/rc-calendar.css +11 -12
  2. package/dist/rc-calendar.css.map +1 -1
  3. package/dist/rc-calendar.js +116 -87
  4. package/dist/rc-calendar.js.map +1 -1
  5. package/dist/rc-calendar.min.css +11 -12
  6. package/dist/rc-calendar.min.css.map +1 -1
  7. package/dist/rc-calendar.min.js +1 -1
  8. package/package.json +2 -5
  9. package/assets/index.css +0 -1177
  10. package/es/Calendar.js +0 -449
  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 -126
  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 -208
  23. package/es/date/DateTBody.js +0 -287
  24. package/es/date/DateTHead.js +0 -86
  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 -545
  87. package/es/util/toTime.js +0 -21
  88. package/es/year/YearPanel.js +0 -194
  89. package/lib/Calendar.js +0 -512
  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 -151
  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 -241
  102. package/lib/date/DateTBody.js +0 -317
  103. package/lib/date/DateTHead.js +0 -106
  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 -580
  166. package/lib/util/toTime.js +0 -28
  167. package/lib/year/YearPanel.js +0 -219
@@ -1,208 +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, initializeStr } from '../util';
11
- var customParseFormat = require('dayjs/plugin/customParseFormat');
12
-
13
- dayjs.extend(customParseFormat);
14
-
15
- var cachedSelectionStart = void 0;
16
- var cachedSelectionEnd = void 0;
17
- var dateInputInstance = void 0;
18
-
19
- var DateInput = function (_React$Component) {
20
- _inherits(DateInput, _React$Component);
21
-
22
- function DateInput(props) {
23
- _classCallCheck(this, DateInput);
24
-
25
- var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
26
-
27
- _initialiseProps.call(_this);
28
-
29
- var selectedValue = props.selectedValue;
30
-
31
- _this.state = {
32
- str: formatDate(selectedValue, _this.props.format),
33
- hasFocus: false,
34
- localFormat: _this.props.format[0]
35
- };
36
- return _this;
37
- }
38
-
39
- DateInput.prototype.componentDidUpdate = function componentDidUpdate() {
40
- if (dateInputInstance && this.state.hasFocus && !(cachedSelectionStart === 0 && cachedSelectionEnd === 0)) {
41
- dateInputInstance.setSelectionRange(cachedSelectionStart, cachedSelectionEnd);
42
- }
43
- };
44
-
45
- DateInput.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, state) {
46
- var newState = {};
47
-
48
- if (dateInputInstance) {
49
- cachedSelectionStart = dateInputInstance.selectionStart;
50
- cachedSelectionEnd = dateInputInstance.selectionEnd;
51
- }
52
- // when popup show, click body will call this, bug!
53
- var selectedValue = nextProps.selectedValue;
54
- if (!state.hasFocus) {
55
- newState = { str: formatDate(selectedValue, nextProps.format) };
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 str = this.state.str;
68
- var locale = props.locale,
69
- prefixCls = props.prefixCls,
70
- placeholder = props.placeholder,
71
- clearIcon = props.clearIcon,
72
- inputMode = props.inputMode;
73
-
74
- return React.createElement(
75
- 'div',
76
- { className: prefixCls + '-input-wrap' },
77
- React.createElement(
78
- 'div',
79
- { className: prefixCls + '-date-input-wrap' },
80
- React.createElement('input', {
81
- ref: this.saveDateInput,
82
- className: prefixCls + '-input',
83
- value: str,
84
- disabled: props.disabled,
85
- placeholder: placeholder,
86
- onChange: this.onInputChange,
87
- onKeyDown: this.onKeyDown,
88
- onFocus: this.onFocus,
89
- onBlur: this.onBlur,
90
- inputMode: inputMode
91
- })
92
- ),
93
- props.showClear ? React.createElement(
94
- 'a',
95
- {
96
- role: 'button',
97
- title: locale.clear,
98
- onClick: this.onClear
99
- },
100
- clearIcon || React.createElement('span', { className: prefixCls + '-clear-btn' })
101
- ) : null
102
- );
103
- };
104
-
105
- return DateInput;
106
- }(React.Component);
107
-
108
- DateInput.propTypes = {
109
- prefixCls: PropTypes.string,
110
- timePicker: PropTypes.object,
111
- value: PropTypes.object,
112
- disabledTime: PropTypes.any,
113
- format: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
114
- locale: PropTypes.object,
115
- disabledDate: PropTypes.func,
116
- onChange: PropTypes.func,
117
- onClear: PropTypes.func,
118
- placeholder: PropTypes.string,
119
- onSelect: PropTypes.func,
120
- selectedValue: PropTypes.object,
121
- clearIcon: PropTypes.node,
122
- inputMode: PropTypes.string
123
- };
124
-
125
- var _initialiseProps = function _initialiseProps() {
126
- var _this2 = this;
127
-
128
- this.onClear = function () {
129
- _this2.setState({ str: '' });
130
- _this2.props.onClear(null);
131
- };
132
-
133
- this.onInputChange = function (event) {
134
- var str = event.target.value;
135
- var calendarStr = initializeStr(str, _this2.state.localFormat) || '';
136
- var _props = _this2.props,
137
- disabledDate = _props.disabledDate,
138
- format = _props.format,
139
- onChange = _props.onChange,
140
- selectedValue = _props.selectedValue;
141
- // 没有内容,合法并直接退出
142
-
143
- if (!str || !calendarStr) {
144
- _this2.onClear();
145
- return;
146
- }
147
- var parsed = dayjs(calendarStr, format[0]);
148
- var value = _this2.props.value.clone();
149
- value = value.year(parsed.year()).month(parsed.month()).date(parsed.date()).hour(parsed.hour()).minute(parsed.minute()).second(parsed.second());
150
-
151
- if (!value || disabledDate && disabledDate(value)) {
152
- _this2.setState({ str: str });
153
- return;
154
- }
155
-
156
- if (selectedValue !== value || selectedValue && value && !selectedValue.isSame(value)) {
157
- _this2.setState({ str: str });
158
- onChange(value);
159
- }
160
- };
161
-
162
- this.onFocus = function () {
163
- _this2.setState({ hasFocus: true });
164
- };
165
-
166
- this.onBlur = function () {
167
- _this2.setState(function (prevState, prevProps) {
168
- return {
169
- hasFocus: false,
170
- str: formatDate(prevProps.value, prevProps.format)
171
- };
172
- });
173
- };
174
-
175
- this.onKeyDown = function (event) {
176
- var keyCode = event.keyCode;
177
- var _props2 = _this2.props,
178
- onSelect = _props2.onSelect,
179
- value = _props2.value,
180
- disabledDate = _props2.disabledDate;
181
-
182
- if (keyCode === KeyCode.ENTER && onSelect) {
183
- var validateDate = !disabledDate || !disabledDate(value);
184
- if (validateDate) {
185
- onSelect(value.clone());
186
- }
187
- event.preventDefault();
188
- }
189
- };
190
-
191
- this.getRootDOMNode = function () {
192
- return ReactDOM.findDOMNode(_this2);
193
- };
194
-
195
- this.focus = function () {
196
- if (dateInputInstance) {
197
- dateInputInstance.focus();
198
- }
199
- };
200
-
201
- this.saveDateInput = function (dateInput) {
202
- dateInputInstance = dateInput;
203
- };
204
- };
205
-
206
- polyfill(DateInput);
207
-
208
- export default DateInput;
@@ -1,287 +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
- import dayjs from 'dayjs';
10
-
11
- var DATE_ROW_COLUMN_COUNT = DateConstants.DATE_ROW_COLUMN_COUNT,
12
- DAY_NAME_TO_INDEX = DateConstants.DAY_NAME_TO_INDEX;
13
-
14
-
15
- function isSameDay(one, two) {
16
- return one && two && one.isSame(two, 'day');
17
- }
18
-
19
- function beforeCurrentMonthYear(current, today) {
20
- if (current.year() < today.year()) {
21
- return 1;
22
- }
23
- return current.year() === today.year() && current.month() < today.month();
24
- }
25
-
26
- function afterCurrentMonthYear(current, today) {
27
- if (current.year() > today.year()) {
28
- return 1;
29
- }
30
- return current.year() === today.year() && current.month() > today.month();
31
- }
32
-
33
- function getIdFromDate(date) {
34
- return 'rc-calendar-' + date.year() + '-' + date.month() + '-' + date.date();
35
- }
36
-
37
- var DateTBody = function (_React$Component) {
38
- _inherits(DateTBody, _React$Component);
39
-
40
- function DateTBody() {
41
- _classCallCheck(this, DateTBody);
42
-
43
- return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
44
- }
45
-
46
- DateTBody.prototype.render = function render() {
47
- var props = this.props;
48
- var contentRender = props.contentRender,
49
- prefixCls = props.prefixCls,
50
- selectedValue = props.selectedValue,
51
- value = props.value,
52
- showWeekNumber = props.showWeekNumber,
53
- dateRender = props.dateRender,
54
- disabledDate = props.disabledDate,
55
- hoverValue = props.hoverValue,
56
- firstDayOfWeek = props.firstDayOfWeek,
57
- currentStatus = props.currentStatus;
58
-
59
- var iIndex = void 0;
60
- var jIndex = void 0;
61
- var current = void 0;
62
- var dateTable = [];
63
- var today = getTodayTime(value);
64
- var cellClass = prefixCls + '-cell';
65
- var weekNumberCellClass = prefixCls + '-week-number-cell';
66
- var dateClass = prefixCls + '-date';
67
- var todayClass = prefixCls + '-today';
68
- var selectedClass = prefixCls + '-selected-day';
69
- var selectedDateClass = prefixCls + '-selected-date'; // do not move with mouse operation
70
- var selectedStartDateClass = prefixCls + '-selected-start-date';
71
- var selectedEndDateClass = prefixCls + '-selected-end-date';
72
- var inRangeClass = prefixCls + '-in-range-cell';
73
- var lastMonthDayClass = prefixCls + '-last-month-cell';
74
- var nextMonthDayClass = prefixCls + '-next-month-btn-day';
75
- var disabledClass = prefixCls + '-disabled-cell';
76
- var firstDisableClass = prefixCls + '-disabled-cell-first-of-row';
77
- var lastDisableClass = prefixCls + '-disabled-cell-last-of-row';
78
- var lastDayOfMonthClass = prefixCls + '-last-day-of-month';
79
- var month1 = value.clone();
80
- month1 = month1.date(1);
81
- var day = month1.day();
82
- var firstDayName = typeof firstDayOfWeek === 'string' ? firstDayOfWeek[0].toUpperCase() + firstDayOfWeek.slice(1) : 'Sunday';
83
- var firstDayIndex = DAY_NAME_TO_INDEX[firstDayName] ? DAY_NAME_TO_INDEX[firstDayName] : 0;
84
- var lastMonthDiffDay = (day + 7 - firstDayIndex) % 7;
85
- // calculate last month
86
- var lastMonth1 = month1.clone();
87
- lastMonth1 = lastMonth1.add(0 - lastMonthDiffDay, 'days');
88
- var passed = 0;
89
-
90
- for (iIndex = 0; iIndex < DATE_ROW_COLUMN_COUNT.DATE_ROW_COUNT; iIndex++) {
91
- for (jIndex = 0; jIndex < DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT; jIndex++) {
92
- current = lastMonth1;
93
- if (passed) {
94
- current = current.clone();
95
- current = current.add(passed, 'days');
96
- }
97
- dateTable.push(current);
98
- passed++;
99
- }
100
- }
101
- var tableHtml = [];
102
- passed = 0;
103
-
104
- for (iIndex = 0; iIndex < DATE_ROW_COLUMN_COUNT.DATE_ROW_COUNT; iIndex++) {
105
- var _cx;
106
-
107
- var isCurrentWeek = void 0;
108
- var weekNumberCell = void 0;
109
- var isActiveWeek = false;
110
- var dateCells = [];
111
- if (showWeekNumber) {
112
- weekNumberCell = React.createElement(
113
- 'td',
114
- {
115
- key: dateTable[passed].week(),
116
- role: 'gridcell',
117
- className: weekNumberCellClass
118
- },
119
- dateTable[passed].week()
120
- );
121
- }
122
- for (jIndex = 0; jIndex < DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT; jIndex++) {
123
- var next = null;
124
- var last = null;
125
- if (currentStatus === 'todayTime') {
126
- current = dateTable[passed].hour(dayjs().hour()).minute(dayjs().minute()).second(dayjs().second()); // eslint-disable-line max-len
127
- } else {
128
- current = dateTable[passed];
129
- }
130
- if (jIndex < DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT - 1) {
131
- next = dateTable[passed + 1];
132
- }
133
- if (jIndex > 0) {
134
- last = dateTable[passed - 1];
135
- }
136
- var cls = cellClass;
137
- var disabled = false;
138
- var selected = false;
139
-
140
- if (isSameDay(current, today)) {
141
- cls += ' ' + todayClass;
142
- isCurrentWeek = true;
143
- }
144
-
145
- var isBeforeCurrentMonthYear = beforeCurrentMonthYear(current, value);
146
- var isAfterCurrentMonthYear = afterCurrentMonthYear(current, value);
147
-
148
- if (selectedValue && Array.isArray(selectedValue)) {
149
- var rangeValue = hoverValue.length ? hoverValue : selectedValue;
150
- if (!isBeforeCurrentMonthYear && !isAfterCurrentMonthYear) {
151
- var startValue = rangeValue[0];
152
- var endValue = rangeValue[1];
153
- if (startValue) {
154
- if (isSameDay(current, startValue)) {
155
- selected = true;
156
- isActiveWeek = true;
157
- cls += ' ' + selectedStartDateClass;
158
- }
159
- }
160
- if (startValue || endValue) {
161
- if (isSameDay(current, endValue)) {
162
- selected = true;
163
- isActiveWeek = true;
164
- cls += ' ' + selectedEndDateClass;
165
- } else if ((startValue === null || startValue === undefined) && current.isBefore(endValue, 'day')) {
166
- cls += ' ' + inRangeClass;
167
- } else if ((endValue === null || endValue === undefined) && current.isAfter(startValue, 'day')) {
168
- cls += ' ' + inRangeClass;
169
- } else if (current.isAfter(startValue, 'day') && current.isBefore(endValue, 'day')) {
170
- cls += ' ' + inRangeClass;
171
- }
172
- }
173
- }
174
- } else if (isSameDay(current, value)) {
175
- // keyboard change value, highlight works
176
- selected = true;
177
- isActiveWeek = true;
178
- }
179
-
180
- if (isSameDay(current, selectedValue)) {
181
- cls += ' ' + selectedDateClass;
182
- }
183
-
184
- if (isBeforeCurrentMonthYear) {
185
- cls += ' ' + lastMonthDayClass;
186
- }
187
-
188
- if (isAfterCurrentMonthYear) {
189
- cls += ' ' + nextMonthDayClass;
190
- }
191
-
192
- if (current.clone().endOf('month').date() === current.date()) {
193
- cls += ' ' + lastDayOfMonthClass;
194
- }
195
-
196
- if (disabledDate) {
197
- if (disabledDate(current, value)) {
198
- disabled = true;
199
-
200
- if (!last || !disabledDate(last, value)) {
201
- cls += ' ' + firstDisableClass;
202
- }
203
-
204
- if (!next || !disabledDate(next, value)) {
205
- cls += ' ' + lastDisableClass;
206
- }
207
- }
208
- }
209
-
210
- if (selected) {
211
- cls += ' ' + selectedClass;
212
- }
213
-
214
- if (disabled) {
215
- cls += ' ' + disabledClass;
216
- }
217
-
218
- var dateHtml = void 0;
219
- if (dateRender) {
220
- dateHtml = dateRender(current, value);
221
- } else {
222
- var content = contentRender ? contentRender(current, value) : current.date();
223
- dateHtml = React.createElement(
224
- 'div',
225
- {
226
- key: getIdFromDate(current),
227
- className: dateClass,
228
- 'aria-selected': selected,
229
- 'aria-disabled': disabled
230
- },
231
- content
232
- );
233
- }
234
-
235
- dateCells.push(React.createElement(
236
- 'td',
237
- {
238
- key: passed,
239
- onClick: disabled ? undefined : props.onSelect.bind(null, current),
240
- onMouseEnter: disabled ? undefined : props.onDayHover && props.onDayHover.bind(null, current) || undefined,
241
- role: 'gridcell',
242
- title: getTitleString(current),
243
- className: cls
244
- },
245
- dateHtml
246
- ));
247
-
248
- passed++;
249
- }
250
-
251
- tableHtml.push(React.createElement(
252
- 'tr',
253
- {
254
- key: iIndex,
255
- role: 'row',
256
- className: cx((_cx = {}, _cx[prefixCls + '-current-week'] = isCurrentWeek, _cx[prefixCls + '-active-week'] = isActiveWeek, _cx))
257
- },
258
- weekNumberCell,
259
- dateCells
260
- ));
261
- }
262
- return React.createElement(
263
- 'tbody',
264
- { className: prefixCls + '-tbody' },
265
- tableHtml
266
- );
267
- };
268
-
269
- return DateTBody;
270
- }(React.Component);
271
-
272
- DateTBody.propTypes = {
273
- contentRender: PropTypes.func,
274
- dateRender: PropTypes.func,
275
- disabledDate: PropTypes.func,
276
- prefixCls: PropTypes.string,
277
- selectedValue: PropTypes.oneOfType([PropTypes.object, PropTypes.arrayOf(PropTypes.object)]),
278
- value: PropTypes.object,
279
- hoverValue: PropTypes.any,
280
- showWeekNumber: PropTypes.bool,
281
- firstDayOfWeek: PropTypes.string,
282
- currentStatus: PropTypes.string
283
- };
284
- DateTBody.defaultProps = {
285
- hoverValue: []
286
- };
287
- export default DateTBody;
@@ -1,86 +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 DateConstants from './DateConstants';
6
-
7
- var DAY_NAME_TO_INDEX = DateConstants.DAY_NAME_TO_INDEX,
8
- DATE_ROW_COLUMN_COUNT = DateConstants.DATE_ROW_COLUMN_COUNT;
9
-
10
- var DateTHead = function (_React$Component) {
11
- _inherits(DateTHead, _React$Component);
12
-
13
- function DateTHead() {
14
- _classCallCheck(this, DateTHead);
15
-
16
- return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
17
- }
18
-
19
- DateTHead.prototype.render = function render() {
20
- var props = this.props;
21
- var value = props.value;
22
- var localeData = value.localeData();
23
- var prefixCls = props.prefixCls;
24
- var veryShortWeekdays = [];
25
- var weekDays = [];
26
-
27
- var allWeekdaysMin = localeData.weekdaysMin();
28
- var allWeekdaysShort = localeData.weekdaysShort();
29
-
30
- var firstDayName = typeof props.firstDayOfWeek === 'string' ? props.firstDayOfWeek[0].toUpperCase() + props.firstDayOfWeek.slice(1) : 'Sunday';
31
- var firstDay = DAY_NAME_TO_INDEX[firstDayName] ? DAY_NAME_TO_INDEX[firstDayName] : 0;
32
-
33
- var showWeekNumberEl = void 0;
34
- var dateColumnCount = DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT;
35
- for (var dateColIndex = 0; dateColIndex < dateColumnCount; dateColIndex++) {
36
- var index = (firstDay + dateColIndex) % dateColumnCount;
37
- veryShortWeekdays[dateColIndex] = allWeekdaysMin[index];
38
- weekDays[dateColIndex] = allWeekdaysShort[index];
39
- }
40
-
41
- if (props.showWeekNumber) {
42
- showWeekNumberEl = React.createElement(
43
- 'th',
44
- {
45
- role: 'columnheader',
46
- className: prefixCls + '-column-header ' + prefixCls + '-week-number-header'
47
- },
48
- React.createElement(
49
- 'span',
50
- { className: prefixCls + '-column-header-inner' },
51
- 'x'
52
- )
53
- );
54
- }
55
- var weekDaysEls = weekDays.map(function (day, xindex) {
56
- return React.createElement(
57
- 'th',
58
- {
59
- key: xindex,
60
- role: 'columnheader',
61
- title: day,
62
- className: prefixCls + '-column-header'
63
- },
64
- React.createElement(
65
- 'span',
66
- { className: prefixCls + '-column-header-inner' },
67
- veryShortWeekdays[xindex]
68
- )
69
- );
70
- });
71
- return React.createElement(
72
- 'thead',
73
- null,
74
- React.createElement(
75
- 'tr',
76
- { role: 'row' },
77
- showWeekNumberEl,
78
- weekDaysEls
79
- )
80
- );
81
- };
82
-
83
- return DateTHead;
84
- }(React.Component);
85
-
86
- 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;