@seafile/seafile-calendar 0.0.30-beta.3 → 0.0.30-beta.4

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 +459 -436
  2. package/dist/rc-calendar.js.map +1 -1
  3. package/dist/rc-calendar.min.js +1 -1
  4. package/package.json +1 -2
  5. package/assets/index.css +0 -1177
  6. package/es/Calendar.js +0 -454
  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 -135
  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 -444
  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 -272
  83. package/es/util/toTime.js +0 -21
  84. package/es/year/YearPanel.js +0 -194
  85. package/lib/Calendar.js +0 -517
  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 -160
  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 -476
  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 -307
  162. package/lib/util/toTime.js +0 -28
  163. package/lib/year/YearPanel.js +0 -219
package/es/Calendar.js DELETED
@@ -1,454 +0,0 @@
1
- import _extends from 'babel-runtime/helpers/extends';
2
- import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
3
- import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
4
- import _inherits from 'babel-runtime/helpers/inherits';
5
- import React from 'react';
6
- import ReactDOM from 'react-dom';
7
- import PropTypes from 'prop-types';
8
- import KeyCode from 'rc-util/es/KeyCode';
9
- import { polyfill } from 'react-lifecycles-compat';
10
- import dayjs from 'dayjs';
11
- import DateTable from './date/DateTable';
12
- import CalendarHeader from './calendar/CalendarHeader';
13
- import CalendarFooter from './calendar/CalendarFooter';
14
- import CalendarRightPanel from './calendar/CalendarRightPanel';
15
- import { calendarMixinWrapper, calendarMixinPropTypes, calendarMixinDefaultProps, getNowByCurrentStateValue } from './mixin/CalendarMixin';
16
- import { commonMixinWrapper, propType, defaultProp } from './mixin/CommonMixin';
17
- import DateInput from './date/DateInput';
18
- import { getTimeConfig, getTodayTime, syncTime } from './util';
19
- import { goStartMonth, goEndMonth, goTime } from './util/toTime';
20
- import localeData from 'dayjs/plugin/localeData';
21
- import utc from 'dayjs/plugin/utc';
22
- import weekOfYear from 'dayjs/plugin/weekOfYear';
23
- dayjs.extend(utc);
24
- dayjs.extend(localeData);
25
- dayjs.extend(weekOfYear);
26
-
27
- function noop() {}
28
-
29
- var getMomentObjectIfValid = function getMomentObjectIfValid(date) {
30
- if (dayjs.isDayjs(date) && date.isValid()) {
31
- return date;
32
- }
33
- return false;
34
- };
35
-
36
- var Calendar = function (_React$Component) {
37
- _inherits(Calendar, _React$Component);
38
-
39
- function Calendar(props) {
40
- _classCallCheck(this, Calendar);
41
-
42
- var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
43
-
44
- _initialiseProps.call(_this);
45
-
46
- _this.state = {
47
- mode: _this.props.mode || 'date',
48
- value: getMomentObjectIfValid(props.value) || getMomentObjectIfValid(props.defaultValue) || dayjs(),
49
- selectedValue: props.selectedValue || props.defaultSelectedValue
50
- };
51
- _this.dateInputRef = React.createRef();
52
- return _this;
53
- }
54
-
55
- Calendar.prototype.componentDidMount = function componentDidMount() {
56
- if (this.props.showDateInput) {
57
- this.saveFocusElement(DateInput.getInstance());
58
- }
59
- };
60
-
61
- Calendar.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, state) {
62
- var value = nextProps.value,
63
- selectedValue = nextProps.selectedValue;
64
-
65
- var newState = {};
66
-
67
- if ('mode' in nextProps && state.mode !== nextProps.mode) {
68
- newState = { mode: nextProps.mode };
69
- }
70
- if ('value' in nextProps) {
71
- newState.value = getMomentObjectIfValid(value) || getMomentObjectIfValid(nextProps.defaultValue) || getNowByCurrentStateValue(state.value);
72
- }
73
- if ('selectedValue' in nextProps) {
74
- newState.selectedValue = selectedValue;
75
- }
76
-
77
- return newState;
78
- };
79
-
80
- Calendar.prototype.render = function render() {
81
- var props = this.props,
82
- state = this.state;
83
- var locale = props.locale,
84
- prefixCls = props.prefixCls,
85
- disabledDate = props.disabledDate,
86
- dateInputPlaceholder = props.dateInputPlaceholder,
87
- timePicker = props.timePicker,
88
- onClickRightPanelTime = props.onClickRightPanelTime,
89
- disabledTime = props.disabledTime,
90
- clearIcon = props.clearIcon,
91
- renderFooter = props.renderFooter,
92
- inputMode = props.inputMode,
93
- showHourAndMinute = props.showHourAndMinute,
94
- firstDayOfWeek = props.firstDayOfWeek,
95
- showWeekNumber = props.showWeekNumber;
96
- var value = state.value,
97
- selectedValue = state.selectedValue,
98
- mode = state.mode;
99
-
100
- var showTimePicker = mode === 'time';
101
- var disabledTimeConfig = showTimePicker && disabledTime && timePicker ? getTimeConfig(selectedValue, disabledTime) : null;
102
-
103
- var timePickerEle = null;
104
-
105
- if (timePicker && showTimePicker) {
106
- var timePickerProps = _extends({
107
- showHour: true,
108
- showSecond: true,
109
- showMinute: true
110
- }, timePicker.props, disabledTimeConfig, {
111
- onChange: this.onDateInputChange,
112
- value: selectedValue,
113
- disabledTime: disabledTime
114
- });
115
-
116
- if (timePicker.props.defaultValue !== undefined) {
117
- timePickerProps.defaultOpenValue = timePicker.props.defaultValue;
118
- }
119
-
120
- timePickerEle = React.cloneElement(timePicker, timePickerProps);
121
- }
122
-
123
- var dateInputElement = props.showDateInput ? React.createElement(DateInput, {
124
- ref: this.dateInputRef,
125
- format: this.getFormat(),
126
- key: 'date-input',
127
- value: value,
128
- locale: locale,
129
- placeholder: dateInputPlaceholder || this.getFormat()[0],
130
- showClear: true,
131
- disabledTime: disabledTime,
132
- disabledDate: disabledDate,
133
- onClear: this.onClear,
134
- prefixCls: prefixCls,
135
- selectedValue: selectedValue,
136
- onChange: this.onDateInputChange,
137
- onSelect: this.onDateInputSelect,
138
- clearIcon: clearIcon,
139
- inputMode: inputMode,
140
- showHourAndMinute: showHourAndMinute
141
- }) : null;
142
-
143
- var children = [];
144
- if (props.renderSidebar) {
145
- children.push(props.renderSidebar());
146
- }
147
- children.push(React.createElement(
148
- 'div',
149
- { className: prefixCls + '-panel', key: 'panel' },
150
- dateInputElement,
151
- React.createElement(
152
- 'div',
153
- { className: prefixCls + '-date-panel-container' },
154
- React.createElement(
155
- 'div',
156
- {
157
- tabIndex: this.props.focusablePanel ? 0 : undefined,
158
- className: prefixCls + '-date-panel'
159
- },
160
- React.createElement(CalendarHeader, {
161
- locale: locale,
162
- mode: mode,
163
- value: value,
164
- onValueChange: this.setValue,
165
- onPanelChange: this.onPanelChange,
166
- renderFooter: renderFooter,
167
- showTimePicker: showTimePicker,
168
- prefixCls: prefixCls
169
- }),
170
- timePicker && showTimePicker ? React.createElement(
171
- 'div',
172
- { className: prefixCls + '-time-picker' },
173
- React.createElement(
174
- 'div',
175
- { className: prefixCls + '-time-picker-panel' },
176
- timePickerEle
177
- )
178
- ) : null,
179
- React.createElement(
180
- 'div',
181
- { className: prefixCls + '-body' },
182
- React.createElement(DateTable, {
183
- locale: locale,
184
- value: value,
185
- selectedValue: selectedValue,
186
- prefixCls: prefixCls,
187
- dateRender: props.dateRender,
188
- onSelect: this.onDateTableSelect,
189
- disabledDate: disabledDate,
190
- showWeekNumber: showWeekNumber,
191
- firstDayOfWeek: firstDayOfWeek
192
- })
193
- ),
194
- React.createElement(CalendarFooter, {
195
- showOk: props.showOk,
196
- mode: mode,
197
- renderFooter: props.renderFooter,
198
- locale: locale,
199
- prefixCls: prefixCls,
200
- showToday: props.showToday,
201
- disabledTime: disabledTime,
202
- showTimePicker: showTimePicker,
203
- showDateInput: props.showDateInput,
204
- timePicker: timePicker,
205
- selectedValue: selectedValue,
206
- value: value,
207
- disabledDate: disabledDate,
208
- okDisabled: props.showOk !== false && (!selectedValue || !this.isAllowedDate(selectedValue)),
209
- onOk: this.onOk,
210
- onSelect: this.onSelect,
211
- onToday: this.onToday,
212
- onOpenTimePicker: this.openTimePicker,
213
- onCloseTimePicker: this.closeTimePicker
214
- })
215
- ),
216
- showHourAndMinute && React.createElement(CalendarRightPanel, {
217
- prefixCls: prefixCls,
218
- value: value,
219
- locale: locale,
220
- onSelect: this.onDateTableSelect,
221
- onClickRightPanelTime: onClickRightPanelTime,
222
- defaultMinutesTime: this.props.defaultMinutesTime,
223
- showHourAndMinute: showHourAndMinute,
224
- format: this.getFormat()
225
- })
226
- )
227
- ));
228
-
229
- return this.renderRoot({
230
- children: children,
231
- className: props.showWeekNumber ? prefixCls + '-week-number' : ''
232
- });
233
- };
234
-
235
- return Calendar;
236
- }(React.Component);
237
-
238
- Calendar.propTypes = _extends({}, calendarMixinPropTypes, propType, {
239
- prefixCls: PropTypes.string,
240
- className: PropTypes.string,
241
- style: PropTypes.object,
242
- defaultValue: PropTypes.object,
243
- value: PropTypes.object,
244
- selectedValue: PropTypes.object,
245
- defaultSelectedValue: PropTypes.object,
246
- mode: PropTypes.oneOf(['time', 'date', 'month', 'year', 'decade']),
247
- locale: PropTypes.object,
248
- showDateInput: PropTypes.bool,
249
- showWeekNumber: PropTypes.bool,
250
- showToday: PropTypes.bool,
251
- showOk: PropTypes.bool,
252
- showHourAndMinute: PropTypes.bool,
253
- defaultMinutesTime: PropTypes.string,
254
- onSelect: PropTypes.func,
255
- onOk: PropTypes.func,
256
- onKeyDown: PropTypes.func,
257
- timePicker: PropTypes.element,
258
- dateInputPlaceholder: PropTypes.any,
259
- onClear: PropTypes.func,
260
- onChange: PropTypes.func,
261
- onPanelChange: PropTypes.func,
262
- disabledDate: PropTypes.func,
263
- disabledTime: PropTypes.any,
264
- dateRender: PropTypes.func,
265
- renderFooter: PropTypes.func,
266
- renderSidebar: PropTypes.func,
267
- clearIcon: PropTypes.node,
268
- focusablePanel: PropTypes.bool,
269
- inputMode: PropTypes.string,
270
- onBlur: PropTypes.func,
271
- onClickRightPanelTime: PropTypes.func,
272
- firstDayOfWeek: PropTypes.string
273
- });
274
- Calendar.defaultProps = _extends({}, calendarMixinDefaultProps, defaultProp, {
275
- showToday: true,
276
- showDateInput: true,
277
- showHourAndMinute: false,
278
- timePicker: null,
279
- onOk: noop,
280
- onPanelChange: noop,
281
- onClickRightPanelTime: noop,
282
- focusablePanel: true,
283
- firstDayOfWeek: 'Sunday'
284
- });
285
-
286
- var _initialiseProps = function _initialiseProps() {
287
- var _this2 = this;
288
-
289
- this.onPanelChange = function (value, mode) {
290
- var props = _this2.props,
291
- state = _this2.state;
292
-
293
- if (!('mode' in props)) {
294
- _this2.setState({ mode: mode });
295
- }
296
- props.onPanelChange(value || state.value, mode);
297
- };
298
-
299
- this.onKeyDown = function (event) {
300
- if (event.target.nodeName.toLowerCase() === 'input') {
301
- return undefined;
302
- }
303
- var keyCode = event.keyCode;
304
- // mac
305
- var ctrlKey = event.ctrlKey || event.metaKey;
306
- var disabledDate = _this2.props.disabledDate;
307
- var value = _this2.state.value;
308
-
309
- switch (keyCode) {
310
- case KeyCode.DOWN:
311
- _this2.goTime(1, 'weeks');
312
- event.preventDefault();
313
- return 1;
314
- case KeyCode.UP:
315
- _this2.goTime(-1, 'weeks');
316
- event.preventDefault();
317
- return 1;
318
- case KeyCode.LEFT:
319
- if (ctrlKey) {
320
- _this2.goTime(-1, 'years');
321
- } else {
322
- _this2.goTime(-1, 'days');
323
- }
324
- event.preventDefault();
325
- return 1;
326
- case KeyCode.RIGHT:
327
- if (ctrlKey) {
328
- _this2.goTime(1, 'years');
329
- } else {
330
- _this2.goTime(1, 'days');
331
- }
332
- event.preventDefault();
333
- return 1;
334
- case KeyCode.HOME:
335
- _this2.setValue(goStartMonth(_this2.state.value));
336
- event.preventDefault();
337
- return 1;
338
- case KeyCode.END:
339
- _this2.setValue(goEndMonth(_this2.state.value));
340
- event.preventDefault();
341
- return 1;
342
- case KeyCode.PAGE_DOWN:
343
- _this2.goTime(1, 'month');
344
- event.preventDefault();
345
- return 1;
346
- case KeyCode.PAGE_UP:
347
- _this2.goTime(-1, 'month');
348
- event.preventDefault();
349
- return 1;
350
- case KeyCode.ENTER:
351
- if (!disabledDate || !disabledDate(value)) {
352
- _this2.onSelect(value, {
353
- source: 'keyboard'
354
- });
355
- }
356
- event.preventDefault();
357
- return 1;
358
- default:
359
- _this2.props.onKeyDown(event);
360
- return 1;
361
- }
362
- };
363
-
364
- this.onClear = function () {
365
- _this2.onSelect(null);
366
- _this2.props.onClear();
367
- };
368
-
369
- this.onOk = function () {
370
- var selectedValue = _this2.state.selectedValue;
371
-
372
- if (_this2.isAllowedDate(selectedValue)) {
373
- _this2.props.onOk(selectedValue);
374
- }
375
- };
376
-
377
- this.onDateInputChange = function (value) {
378
- _this2.onSelect(value, {
379
- source: 'dateInput'
380
- });
381
- };
382
-
383
- this.onDateInputSelect = function (value) {
384
- _this2.onSelect(value, {
385
- source: 'dateInputSelect'
386
- });
387
- };
388
-
389
- this.onDateTableSelect = function (value) {
390
- var timePicker = _this2.props.timePicker;
391
- var selectedValue = _this2.state.selectedValue;
392
-
393
- if (!selectedValue && timePicker) {
394
- var timePickerDefaultValue = timePicker.props.defaultValue;
395
- if (timePickerDefaultValue) {
396
- syncTime(timePickerDefaultValue, value);
397
- }
398
- }
399
- var time = String(value.hour()).padStart(2, 0) + ':' + String(value.minute()).padStart(2, 0);
400
- _this2.focusTimeInput(time);
401
- _this2.onSelect(value);
402
- };
403
-
404
- this.onToday = function () {
405
- var value = _this2.state.value;
406
-
407
- var now = getTodayTime(value);
408
- _this2.onSelect(now, {
409
- source: 'todayButton'
410
- });
411
- };
412
-
413
- this.onBlur = function (event) {
414
- setTimeout(function () {
415
- var dateInput = DateInput.getInstance();
416
- var rootInstance = _this2.rootInstance;
417
-
418
- if (!rootInstance || rootInstance.contains(document.activeElement) || dateInput && dateInput.contains(document.activeElement)) {
419
- // focused element is still part of Calendar
420
- return;
421
- }
422
-
423
- if (_this2.props.onBlur) {
424
- _this2.props.onBlur(event);
425
- }
426
- }, 0);
427
- };
428
-
429
- this.getRootDOMNode = function () {
430
- return ReactDOM.findDOMNode(_this2);
431
- };
432
-
433
- this.focusTimeInput = function (value) {
434
- if (_this2.dateInputRef.current) {
435
- _this2.dateInputRef.current.focusTimeInput(value);
436
- }
437
- };
438
-
439
- this.openTimePicker = function () {
440
- _this2.onPanelChange(null, 'time');
441
- };
442
-
443
- this.closeTimePicker = function () {
444
- _this2.onPanelChange(null, 'date');
445
- };
446
-
447
- this.goTime = function (direction, unit) {
448
- _this2.setValue(goTime(_this2.state.value, direction, unit));
449
- };
450
- };
451
-
452
- polyfill(Calendar);
453
-
454
- export default calendarMixinWrapper(commonMixinWrapper(Calendar));
@@ -1,182 +0,0 @@
1
- import _extends from 'babel-runtime/helpers/extends';
2
- import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
3
- import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
4
- import _inherits from 'babel-runtime/helpers/inherits';
5
- import React from 'react';
6
- import PropTypes from 'prop-types';
7
- import { polyfill } from 'react-lifecycles-compat';
8
- import DateTable from './date/DateTable';
9
- import MonthTable from './month/MonthTable';
10
- import { calendarMixinWrapper, calendarMixinPropTypes, calendarMixinDefaultProps, getNowByCurrentStateValue } from './mixin/CalendarMixin';
11
- import { commonMixinWrapper, propType, defaultProp } from './mixin/CommonMixin';
12
- import CalendarHeader from './full-calendar/CalendarHeader';
13
- import dayjs from './util/dayjs';
14
-
15
- var FullCalendar = function (_React$Component) {
16
- _inherits(FullCalendar, _React$Component);
17
-
18
- function FullCalendar(props) {
19
- _classCallCheck(this, FullCalendar);
20
-
21
- var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
22
-
23
- _initialiseProps.call(_this);
24
-
25
- var type = void 0;
26
- if ('type' in props) {
27
- type = props.type;
28
- } else {
29
- type = props.defaultType;
30
- }
31
-
32
- _this.state = {
33
- type: type,
34
- value: props.value || props.defaultValue || dayjs(),
35
- selectedValue: props.selectedValue || props.defaultSelectedValue
36
- };
37
- return _this;
38
- }
39
-
40
- FullCalendar.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, state) {
41
- var newState = {};
42
- var value = nextProps.value,
43
- selectedValue = nextProps.selectedValue;
44
-
45
-
46
- if ('type' in nextProps) {
47
- newState = {
48
- type: nextProps.type
49
- };
50
- }
51
- if ('value' in nextProps) {
52
- newState.value = value || nextProps.defaultValue || getNowByCurrentStateValue(state.value);
53
- }
54
- if ('selectedValue' in nextProps) {
55
- newState.selectedValue = selectedValue;
56
- }
57
-
58
- return newState;
59
- };
60
-
61
- FullCalendar.prototype.render = function render() {
62
- var props = this.props;
63
- var locale = props.locale,
64
- prefixCls = props.prefixCls,
65
- fullscreen = props.fullscreen,
66
- showHeader = props.showHeader,
67
- headerComponent = props.headerComponent,
68
- headerRender = props.headerRender,
69
- disabledDate = props.disabledDate;
70
- var _state = this.state,
71
- value = _state.value,
72
- type = _state.type;
73
-
74
-
75
- var header = null;
76
- if (showHeader) {
77
- if (headerRender) {
78
- header = headerRender(value, type, locale);
79
- } else {
80
- var TheHeader = headerComponent || CalendarHeader;
81
- header = React.createElement(TheHeader, _extends({
82
- key: 'calendar-header'
83
- }, props, {
84
- prefixCls: prefixCls + '-full',
85
- type: type,
86
- value: value,
87
- onTypeChange: this.setType,
88
- onValueChange: this.setValue
89
- }));
90
- }
91
- }
92
-
93
- var table = type === 'date' ? React.createElement(DateTable, {
94
- dateRender: props.dateCellRender,
95
- contentRender: props.dateCellContentRender,
96
- locale: locale,
97
- prefixCls: prefixCls,
98
- onSelect: this.onSelect,
99
- value: value,
100
- disabledDate: disabledDate
101
- }) : React.createElement(MonthTable, {
102
- cellRender: props.monthCellRender,
103
- contentRender: props.monthCellContentRender,
104
- locale: locale,
105
- onSelect: this.onMonthSelect,
106
- prefixCls: prefixCls + '-month-panel',
107
- value: value,
108
- disabledDate: disabledDate
109
- });
110
-
111
- var children = [header, React.createElement(
112
- 'div',
113
- { key: 'calendar-body', className: prefixCls + '-calendar-body' },
114
- table
115
- )];
116
-
117
- var className = [prefixCls + '-full'];
118
-
119
- if (fullscreen) {
120
- className.push(prefixCls + '-fullscreen');
121
- }
122
-
123
- return this.renderRoot({
124
- children: children,
125
- className: className.join(' ')
126
- });
127
- };
128
-
129
- return FullCalendar;
130
- }(React.Component);
131
-
132
- FullCalendar.propTypes = _extends({}, calendarMixinPropTypes, propType, {
133
- defaultType: PropTypes.string,
134
- type: PropTypes.string,
135
- prefixCls: PropTypes.string,
136
- locale: PropTypes.object,
137
- onTypeChange: PropTypes.func,
138
- fullscreen: PropTypes.bool,
139
- monthCellRender: PropTypes.func,
140
- dateCellRender: PropTypes.func,
141
- showTypeSwitch: PropTypes.bool,
142
- Select: PropTypes.func.isRequired,
143
- headerComponents: PropTypes.array,
144
- headerComponent: PropTypes.object, // The whole header component
145
- headerRender: PropTypes.func,
146
- showHeader: PropTypes.bool,
147
- disabledDate: PropTypes.func,
148
- value: PropTypes.object,
149
- defaultValue: PropTypes.object,
150
- selectedValue: PropTypes.object,
151
- defaultSelectedValue: PropTypes.object
152
- });
153
- FullCalendar.defaultProps = _extends({}, calendarMixinDefaultProps, defaultProp, {
154
- defaultType: 'date',
155
- fullscreen: false,
156
- showTypeSwitch: true,
157
- showHeader: true,
158
- onTypeChange: function onTypeChange() {}
159
- });
160
-
161
- var _initialiseProps = function _initialiseProps() {
162
- var _this2 = this;
163
-
164
- this.onMonthSelect = function (value) {
165
- _this2.onSelect(value, {
166
- target: 'month'
167
- });
168
- };
169
-
170
- this.setType = function (type) {
171
- if (!('type' in _this2.props)) {
172
- _this2.setState({
173
- type: type
174
- });
175
- }
176
- _this2.props.onTypeChange(type);
177
- };
178
- };
179
-
180
- polyfill(FullCalendar);
181
-
182
- export default calendarMixinWrapper(commonMixinWrapper(FullCalendar));