@seafile/seafile-calendar 0.0.31 → 0.0.32-alpha.jh6

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