@seafile/seafile-calendar 0.0.29 → 0.0.30-beta.2
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.
- package/package.json +1 -1
- package/assets/index.css +0 -1177
- package/dist/rc-calendar.css +0 -1179
- package/dist/rc-calendar.css.map +0 -1
- package/dist/rc-calendar.js +0 -7076
- package/dist/rc-calendar.js.map +0 -1
- package/dist/rc-calendar.min.css +0 -1179
- package/dist/rc-calendar.min.css.map +0 -1
- package/dist/rc-calendar.min.js +0 -1
- package/es/Calendar.js +0 -441
- package/es/FullCalendar.js +0 -182
- package/es/MonthCalendar.js +0 -135
- package/es/Picker.js +0 -245
- package/es/RangeCalendar.js +0 -876
- package/es/calendar/CalendarFooter.js +0 -93
- package/es/calendar/CalendarHeader.js +0 -257
- package/es/calendar/CalendarRightPanel.js +0 -121
- package/es/calendar/OkButton.js +0 -22
- package/es/calendar/TimePickerButton.js +0 -28
- package/es/calendar/TodayButton.js +0 -28
- package/es/date/DateConstants.js +0 -19
- package/es/date/DateInput.js +0 -233
- package/es/date/DateTBody.js +0 -280
- package/es/date/DateTHead.js +0 -85
- package/es/date/DateTable.js +0 -32
- package/es/decade/DecadePanel.js +0 -181
- package/es/full-calendar/CalendarHeader.js +0 -180
- package/es/index.js +0 -3
- package/es/locale/ar_EG.js +0 -27
- package/es/locale/bg_BG.js +0 -27
- package/es/locale/ca_ES.js +0 -27
- package/es/locale/cs_CZ.js +0 -27
- package/es/locale/da_DK.js +0 -27
- package/es/locale/de_DE.js +0 -27
- package/es/locale/el_GR.js +0 -27
- package/es/locale/en_GB.js +0 -27
- package/es/locale/en_US.js +0 -28
- package/es/locale/es_ES.js +0 -27
- package/es/locale/et_EE.js +0 -27
- package/es/locale/fa_IR.js +0 -27
- package/es/locale/fi_FI.js +0 -27
- package/es/locale/fr_BE.js +0 -27
- package/es/locale/fr_FR.js +0 -27
- package/es/locale/he_IL.js +0 -28
- package/es/locale/hi_IN.js +0 -28
- package/es/locale/hr_HR.js +0 -28
- package/es/locale/hu_HU.js +0 -27
- package/es/locale/id_ID.js +0 -28
- package/es/locale/is_IS.js +0 -27
- package/es/locale/it_IT.js +0 -27
- package/es/locale/ja_JP.js +0 -26
- package/es/locale/kn_IN.js +0 -28
- package/es/locale/ko_KR.js +0 -27
- package/es/locale/ku_IQ.js +0 -27
- package/es/locale/lv_LV.js +0 -27
- package/es/locale/mm_MM.js +0 -28
- package/es/locale/mn_MN.js +0 -28
- package/es/locale/ms_MY.js +0 -27
- package/es/locale/nb_NO.js +0 -27
- package/es/locale/nl_BE.js +0 -27
- package/es/locale/nl_NL.js +0 -27
- package/es/locale/pl_PL.js +0 -27
- package/es/locale/pt_BR.js +0 -27
- package/es/locale/pt_PT.js +0 -27
- package/es/locale/ro_RO.js +0 -28
- package/es/locale/ru_RU.js +0 -27
- package/es/locale/sk_SK.js +0 -27
- package/es/locale/sl_SI.js +0 -27
- package/es/locale/sr_RS.js +0 -27
- package/es/locale/sv_SE.js +0 -27
- package/es/locale/ta_IN.js +0 -28
- package/es/locale/th_TH.js +0 -27
- package/es/locale/tr_TR.js +0 -27
- package/es/locale/ug_CN.js +0 -26
- package/es/locale/uk_UA.js +0 -27
- package/es/locale/vi_VN.js +0 -28
- package/es/locale/zh_CN.js +0 -27
- package/es/locale/zh_TW.js +0 -26
- package/es/mixin/CalendarMixin.js +0 -123
- package/es/mixin/CommonMixin.js +0 -85
- package/es/month/MonthPanel.js +0 -154
- package/es/month/MonthTable.js +0 -156
- package/es/picker/placements.js +0 -35
- package/es/range-calendar/CalendarPart.js +0 -151
- package/es/util/dayjs.js +0 -17
- package/es/util/index.js +0 -105
- package/es/util/toTime.js +0 -21
- package/es/year/YearPanel.js +0 -194
- package/lib/Calendar.js +0 -504
- package/lib/FullCalendar.js +0 -221
- package/lib/MonthCalendar.js +0 -172
- package/lib/Picker.js +0 -282
- package/lib/RangeCalendar.js +0 -925
- package/lib/calendar/CalendarFooter.js +0 -134
- package/lib/calendar/CalendarHeader.js +0 -290
- package/lib/calendar/CalendarRightPanel.js +0 -145
- package/lib/calendar/OkButton.js +0 -32
- package/lib/calendar/TimePickerButton.js +0 -41
- package/lib/calendar/TodayButton.js +0 -39
- package/lib/date/DateConstants.js +0 -23
- package/lib/date/DateInput.js +0 -265
- package/lib/date/DateTBody.js +0 -307
- package/lib/date/DateTHead.js +0 -105
- package/lib/date/DateTable.js +0 -54
- package/lib/decade/DecadePanel.js +0 -207
- package/lib/full-calendar/CalendarHeader.js +0 -201
- package/lib/index.js +0 -12
- package/lib/locale/ar_EG.js +0 -31
- package/lib/locale/bg_BG.js +0 -31
- package/lib/locale/ca_ES.js +0 -31
- package/lib/locale/cs_CZ.js +0 -31
- package/lib/locale/da_DK.js +0 -31
- package/lib/locale/de_DE.js +0 -31
- package/lib/locale/el_GR.js +0 -31
- package/lib/locale/en_GB.js +0 -31
- package/lib/locale/en_US.js +0 -32
- package/lib/locale/es_ES.js +0 -31
- package/lib/locale/et_EE.js +0 -31
- package/lib/locale/fa_IR.js +0 -31
- package/lib/locale/fi_FI.js +0 -31
- package/lib/locale/fr_BE.js +0 -31
- package/lib/locale/fr_FR.js +0 -31
- package/lib/locale/he_IL.js +0 -32
- package/lib/locale/hi_IN.js +0 -32
- package/lib/locale/hr_HR.js +0 -32
- package/lib/locale/hu_HU.js +0 -31
- package/lib/locale/id_ID.js +0 -32
- package/lib/locale/is_IS.js +0 -31
- package/lib/locale/it_IT.js +0 -31
- package/lib/locale/ja_JP.js +0 -30
- package/lib/locale/kn_IN.js +0 -32
- package/lib/locale/ko_KR.js +0 -31
- package/lib/locale/ku_IQ.js +0 -31
- package/lib/locale/lv_LV.js +0 -31
- package/lib/locale/mm_MM.js +0 -32
- package/lib/locale/mn_MN.js +0 -32
- package/lib/locale/ms_MY.js +0 -31
- package/lib/locale/nb_NO.js +0 -31
- package/lib/locale/nl_BE.js +0 -31
- package/lib/locale/nl_NL.js +0 -31
- package/lib/locale/pl_PL.js +0 -31
- package/lib/locale/pt_BR.js +0 -31
- package/lib/locale/pt_PT.js +0 -31
- package/lib/locale/ro_RO.js +0 -32
- package/lib/locale/ru_RU.js +0 -31
- package/lib/locale/sk_SK.js +0 -31
- package/lib/locale/sl_SI.js +0 -31
- package/lib/locale/sr_RS.js +0 -31
- package/lib/locale/sv_SE.js +0 -31
- package/lib/locale/ta_IN.js +0 -32
- package/lib/locale/th_TH.js +0 -31
- package/lib/locale/tr_TR.js +0 -31
- package/lib/locale/ug_CN.js +0 -30
- package/lib/locale/uk_UA.js +0 -31
- package/lib/locale/vi_VN.js +0 -32
- package/lib/locale/zh_CN.js +0 -31
- package/lib/locale/zh_TW.js +0 -30
- package/lib/mixin/CalendarMixin.js +0 -153
- package/lib/mixin/CommonMixin.js +0 -106
- package/lib/month/MonthPanel.js +0 -179
- package/lib/month/MonthTable.js +0 -181
- package/lib/picker/placements.js +0 -39
- package/lib/range-calendar/CalendarPart.js +0 -184
- package/lib/util/dayjs.js +0 -46
- package/lib/util/index.js +0 -130
- package/lib/util/toTime.js +0 -28
- package/lib/year/YearPanel.js +0 -219
package/es/Calendar.js
DELETED
@@ -1,441 +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
|
-
return _this;
|
52
|
-
}
|
53
|
-
|
54
|
-
Calendar.prototype.componentDidMount = function componentDidMount() {
|
55
|
-
if (this.props.showDateInput) {
|
56
|
-
this.saveFocusElement(DateInput.getInstance());
|
57
|
-
}
|
58
|
-
};
|
59
|
-
|
60
|
-
Calendar.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, state) {
|
61
|
-
var value = nextProps.value,
|
62
|
-
selectedValue = nextProps.selectedValue;
|
63
|
-
|
64
|
-
var newState = {};
|
65
|
-
|
66
|
-
if ('mode' in nextProps && state.mode !== nextProps.mode) {
|
67
|
-
newState = { mode: nextProps.mode };
|
68
|
-
}
|
69
|
-
if ('value' in nextProps) {
|
70
|
-
newState.value = getMomentObjectIfValid(value) || getMomentObjectIfValid(nextProps.defaultValue) || getNowByCurrentStateValue(state.value);
|
71
|
-
}
|
72
|
-
if ('selectedValue' in nextProps) {
|
73
|
-
newState.selectedValue = selectedValue;
|
74
|
-
}
|
75
|
-
|
76
|
-
return newState;
|
77
|
-
};
|
78
|
-
|
79
|
-
Calendar.prototype.render = function render() {
|
80
|
-
var props = this.props,
|
81
|
-
state = this.state;
|
82
|
-
var locale = props.locale,
|
83
|
-
prefixCls = props.prefixCls,
|
84
|
-
disabledDate = props.disabledDate,
|
85
|
-
dateInputPlaceholder = props.dateInputPlaceholder,
|
86
|
-
timePicker = props.timePicker,
|
87
|
-
onClickRightPanelTime = props.onClickRightPanelTime,
|
88
|
-
disabledTime = props.disabledTime,
|
89
|
-
clearIcon = props.clearIcon,
|
90
|
-
renderFooter = props.renderFooter,
|
91
|
-
inputMode = props.inputMode,
|
92
|
-
showHourAndMinute = props.showHourAndMinute,
|
93
|
-
firstDayOfWeek = props.firstDayOfWeek,
|
94
|
-
showWeekNumber = props.showWeekNumber;
|
95
|
-
var value = state.value,
|
96
|
-
selectedValue = state.selectedValue,
|
97
|
-
mode = state.mode;
|
98
|
-
|
99
|
-
var showTimePicker = mode === 'time';
|
100
|
-
var disabledTimeConfig = showTimePicker && disabledTime && timePicker ? getTimeConfig(selectedValue, disabledTime) : null;
|
101
|
-
|
102
|
-
var timePickerEle = null;
|
103
|
-
|
104
|
-
if (timePicker && showTimePicker) {
|
105
|
-
var timePickerProps = _extends({
|
106
|
-
showHour: true,
|
107
|
-
showSecond: true,
|
108
|
-
showMinute: true
|
109
|
-
}, timePicker.props, disabledTimeConfig, {
|
110
|
-
onChange: this.onDateInputChange,
|
111
|
-
value: selectedValue,
|
112
|
-
disabledTime: disabledTime
|
113
|
-
});
|
114
|
-
|
115
|
-
if (timePicker.props.defaultValue !== undefined) {
|
116
|
-
timePickerProps.defaultOpenValue = timePicker.props.defaultValue;
|
117
|
-
}
|
118
|
-
|
119
|
-
timePickerEle = React.cloneElement(timePicker, timePickerProps);
|
120
|
-
}
|
121
|
-
|
122
|
-
var dateInputElement = props.showDateInput ? React.createElement(DateInput, {
|
123
|
-
format: this.getFormat(),
|
124
|
-
key: 'date-input',
|
125
|
-
value: value,
|
126
|
-
locale: locale,
|
127
|
-
placeholder: dateInputPlaceholder,
|
128
|
-
showClear: true,
|
129
|
-
disabledTime: disabledTime,
|
130
|
-
disabledDate: disabledDate,
|
131
|
-
onClear: this.onClear,
|
132
|
-
prefixCls: prefixCls,
|
133
|
-
selectedValue: selectedValue,
|
134
|
-
onChange: this.onDateInputChange,
|
135
|
-
onSelect: this.onDateInputSelect,
|
136
|
-
clearIcon: clearIcon,
|
137
|
-
inputMode: inputMode
|
138
|
-
}) : null;
|
139
|
-
|
140
|
-
var children = [];
|
141
|
-
if (props.renderSidebar) {
|
142
|
-
children.push(props.renderSidebar());
|
143
|
-
}
|
144
|
-
children.push(React.createElement(
|
145
|
-
'div',
|
146
|
-
{ className: prefixCls + '-panel', key: 'panel' },
|
147
|
-
dateInputElement,
|
148
|
-
React.createElement(
|
149
|
-
'div',
|
150
|
-
{ className: prefixCls + '-date-panel-container' },
|
151
|
-
React.createElement(
|
152
|
-
'div',
|
153
|
-
{
|
154
|
-
tabIndex: this.props.focusablePanel ? 0 : undefined,
|
155
|
-
className: prefixCls + '-date-panel'
|
156
|
-
},
|
157
|
-
React.createElement(CalendarHeader, {
|
158
|
-
locale: locale,
|
159
|
-
mode: mode,
|
160
|
-
value: value,
|
161
|
-
onValueChange: this.setValue,
|
162
|
-
onPanelChange: this.onPanelChange,
|
163
|
-
renderFooter: renderFooter,
|
164
|
-
showTimePicker: showTimePicker,
|
165
|
-
prefixCls: prefixCls
|
166
|
-
}),
|
167
|
-
timePicker && showTimePicker ? React.createElement(
|
168
|
-
'div',
|
169
|
-
{ className: prefixCls + '-time-picker' },
|
170
|
-
React.createElement(
|
171
|
-
'div',
|
172
|
-
{ className: prefixCls + '-time-picker-panel' },
|
173
|
-
timePickerEle
|
174
|
-
)
|
175
|
-
) : null,
|
176
|
-
React.createElement(
|
177
|
-
'div',
|
178
|
-
{ className: prefixCls + '-body' },
|
179
|
-
React.createElement(DateTable, {
|
180
|
-
locale: locale,
|
181
|
-
value: value,
|
182
|
-
selectedValue: selectedValue,
|
183
|
-
prefixCls: prefixCls,
|
184
|
-
dateRender: props.dateRender,
|
185
|
-
onSelect: this.onDateTableSelect,
|
186
|
-
disabledDate: disabledDate,
|
187
|
-
showWeekNumber: showWeekNumber,
|
188
|
-
firstDayOfWeek: firstDayOfWeek
|
189
|
-
})
|
190
|
-
),
|
191
|
-
React.createElement(CalendarFooter, {
|
192
|
-
showOk: props.showOk,
|
193
|
-
mode: mode,
|
194
|
-
renderFooter: props.renderFooter,
|
195
|
-
locale: locale,
|
196
|
-
prefixCls: prefixCls,
|
197
|
-
showToday: props.showToday,
|
198
|
-
disabledTime: disabledTime,
|
199
|
-
showTimePicker: showTimePicker,
|
200
|
-
showDateInput: props.showDateInput,
|
201
|
-
timePicker: timePicker,
|
202
|
-
selectedValue: selectedValue,
|
203
|
-
value: value,
|
204
|
-
disabledDate: disabledDate,
|
205
|
-
okDisabled: props.showOk !== false && (!selectedValue || !this.isAllowedDate(selectedValue)),
|
206
|
-
onOk: this.onOk,
|
207
|
-
onSelect: this.onSelect,
|
208
|
-
onToday: this.onToday,
|
209
|
-
onOpenTimePicker: this.openTimePicker,
|
210
|
-
onCloseTimePicker: this.closeTimePicker
|
211
|
-
})
|
212
|
-
),
|
213
|
-
showHourAndMinute && React.createElement(CalendarRightPanel, {
|
214
|
-
prefixCls: prefixCls,
|
215
|
-
value: value,
|
216
|
-
locale: locale,
|
217
|
-
onSelect: this.onDateTableSelect,
|
218
|
-
onClickRightPanelTime: onClickRightPanelTime,
|
219
|
-
defaultMinutesTime: this.props.defaultMinutesTime
|
220
|
-
})
|
221
|
-
)
|
222
|
-
));
|
223
|
-
|
224
|
-
return this.renderRoot({
|
225
|
-
children: children,
|
226
|
-
className: props.showWeekNumber ? prefixCls + '-week-number' : ''
|
227
|
-
});
|
228
|
-
};
|
229
|
-
|
230
|
-
return Calendar;
|
231
|
-
}(React.Component);
|
232
|
-
|
233
|
-
Calendar.propTypes = _extends({}, calendarMixinPropTypes, propType, {
|
234
|
-
prefixCls: PropTypes.string,
|
235
|
-
className: PropTypes.string,
|
236
|
-
style: PropTypes.object,
|
237
|
-
defaultValue: PropTypes.object,
|
238
|
-
value: PropTypes.object,
|
239
|
-
selectedValue: PropTypes.object,
|
240
|
-
defaultSelectedValue: PropTypes.object,
|
241
|
-
mode: PropTypes.oneOf(['time', 'date', 'month', 'year', 'decade']),
|
242
|
-
locale: PropTypes.object,
|
243
|
-
showDateInput: PropTypes.bool,
|
244
|
-
showWeekNumber: PropTypes.bool,
|
245
|
-
showToday: PropTypes.bool,
|
246
|
-
showOk: PropTypes.bool,
|
247
|
-
showHourAndMinute: PropTypes.bool,
|
248
|
-
defaultMinutesTime: PropTypes.string,
|
249
|
-
onSelect: PropTypes.func,
|
250
|
-
onOk: PropTypes.func,
|
251
|
-
onKeyDown: PropTypes.func,
|
252
|
-
timePicker: PropTypes.element,
|
253
|
-
dateInputPlaceholder: PropTypes.any,
|
254
|
-
onClear: PropTypes.func,
|
255
|
-
onChange: PropTypes.func,
|
256
|
-
onPanelChange: PropTypes.func,
|
257
|
-
disabledDate: PropTypes.func,
|
258
|
-
disabledTime: PropTypes.any,
|
259
|
-
dateRender: PropTypes.func,
|
260
|
-
renderFooter: PropTypes.func,
|
261
|
-
renderSidebar: PropTypes.func,
|
262
|
-
clearIcon: PropTypes.node,
|
263
|
-
focusablePanel: PropTypes.bool,
|
264
|
-
inputMode: PropTypes.string,
|
265
|
-
onBlur: PropTypes.func,
|
266
|
-
onClickRightPanelTime: PropTypes.func,
|
267
|
-
firstDayOfWeek: PropTypes.string
|
268
|
-
});
|
269
|
-
Calendar.defaultProps = _extends({}, calendarMixinDefaultProps, defaultProp, {
|
270
|
-
showToday: true,
|
271
|
-
showDateInput: true,
|
272
|
-
showHourAndMinute: false,
|
273
|
-
timePicker: null,
|
274
|
-
onOk: noop,
|
275
|
-
onPanelChange: noop,
|
276
|
-
onClickRightPanelTime: noop,
|
277
|
-
focusablePanel: true,
|
278
|
-
firstDayOfWeek: 'Sunday'
|
279
|
-
});
|
280
|
-
|
281
|
-
var _initialiseProps = function _initialiseProps() {
|
282
|
-
var _this2 = this;
|
283
|
-
|
284
|
-
this.onPanelChange = function (value, mode) {
|
285
|
-
var props = _this2.props,
|
286
|
-
state = _this2.state;
|
287
|
-
|
288
|
-
if (!('mode' in props)) {
|
289
|
-
_this2.setState({ mode: mode });
|
290
|
-
}
|
291
|
-
props.onPanelChange(value || state.value, mode);
|
292
|
-
};
|
293
|
-
|
294
|
-
this.onKeyDown = function (event) {
|
295
|
-
if (event.target.nodeName.toLowerCase() === 'input') {
|
296
|
-
return undefined;
|
297
|
-
}
|
298
|
-
var keyCode = event.keyCode;
|
299
|
-
// mac
|
300
|
-
var ctrlKey = event.ctrlKey || event.metaKey;
|
301
|
-
var disabledDate = _this2.props.disabledDate;
|
302
|
-
var value = _this2.state.value;
|
303
|
-
|
304
|
-
switch (keyCode) {
|
305
|
-
case KeyCode.DOWN:
|
306
|
-
_this2.goTime(1, 'weeks');
|
307
|
-
event.preventDefault();
|
308
|
-
return 1;
|
309
|
-
case KeyCode.UP:
|
310
|
-
_this2.goTime(-1, 'weeks');
|
311
|
-
event.preventDefault();
|
312
|
-
return 1;
|
313
|
-
case KeyCode.LEFT:
|
314
|
-
if (ctrlKey) {
|
315
|
-
_this2.goTime(-1, 'years');
|
316
|
-
} else {
|
317
|
-
_this2.goTime(-1, 'days');
|
318
|
-
}
|
319
|
-
event.preventDefault();
|
320
|
-
return 1;
|
321
|
-
case KeyCode.RIGHT:
|
322
|
-
if (ctrlKey) {
|
323
|
-
_this2.goTime(1, 'years');
|
324
|
-
} else {
|
325
|
-
_this2.goTime(1, 'days');
|
326
|
-
}
|
327
|
-
event.preventDefault();
|
328
|
-
return 1;
|
329
|
-
case KeyCode.HOME:
|
330
|
-
_this2.setValue(goStartMonth(_this2.state.value));
|
331
|
-
event.preventDefault();
|
332
|
-
return 1;
|
333
|
-
case KeyCode.END:
|
334
|
-
_this2.setValue(goEndMonth(_this2.state.value));
|
335
|
-
event.preventDefault();
|
336
|
-
return 1;
|
337
|
-
case KeyCode.PAGE_DOWN:
|
338
|
-
_this2.goTime(1, 'month');
|
339
|
-
event.preventDefault();
|
340
|
-
return 1;
|
341
|
-
case KeyCode.PAGE_UP:
|
342
|
-
_this2.goTime(-1, 'month');
|
343
|
-
event.preventDefault();
|
344
|
-
return 1;
|
345
|
-
case KeyCode.ENTER:
|
346
|
-
if (!disabledDate || !disabledDate(value)) {
|
347
|
-
_this2.onSelect(value, {
|
348
|
-
source: 'keyboard'
|
349
|
-
});
|
350
|
-
}
|
351
|
-
event.preventDefault();
|
352
|
-
return 1;
|
353
|
-
default:
|
354
|
-
_this2.props.onKeyDown(event);
|
355
|
-
return 1;
|
356
|
-
}
|
357
|
-
};
|
358
|
-
|
359
|
-
this.onClear = function () {
|
360
|
-
_this2.onSelect(null);
|
361
|
-
_this2.props.onClear();
|
362
|
-
};
|
363
|
-
|
364
|
-
this.onOk = function () {
|
365
|
-
var selectedValue = _this2.state.selectedValue;
|
366
|
-
|
367
|
-
if (_this2.isAllowedDate(selectedValue)) {
|
368
|
-
_this2.props.onOk(selectedValue);
|
369
|
-
}
|
370
|
-
};
|
371
|
-
|
372
|
-
this.onDateInputChange = function (value) {
|
373
|
-
_this2.onSelect(value, {
|
374
|
-
source: 'dateInput'
|
375
|
-
});
|
376
|
-
};
|
377
|
-
|
378
|
-
this.onDateInputSelect = function (value) {
|
379
|
-
_this2.onSelect(value, {
|
380
|
-
source: 'dateInputSelect'
|
381
|
-
});
|
382
|
-
};
|
383
|
-
|
384
|
-
this.onDateTableSelect = function (value) {
|
385
|
-
var timePicker = _this2.props.timePicker;
|
386
|
-
var selectedValue = _this2.state.selectedValue;
|
387
|
-
|
388
|
-
if (!selectedValue && timePicker) {
|
389
|
-
var timePickerDefaultValue = timePicker.props.defaultValue;
|
390
|
-
if (timePickerDefaultValue) {
|
391
|
-
syncTime(timePickerDefaultValue, value);
|
392
|
-
}
|
393
|
-
}
|
394
|
-
_this2.onSelect(value);
|
395
|
-
};
|
396
|
-
|
397
|
-
this.onToday = function () {
|
398
|
-
var value = _this2.state.value;
|
399
|
-
|
400
|
-
var now = getTodayTime(value);
|
401
|
-
_this2.onSelect(now, {
|
402
|
-
source: 'todayButton'
|
403
|
-
});
|
404
|
-
};
|
405
|
-
|
406
|
-
this.onBlur = function (event) {
|
407
|
-
setTimeout(function () {
|
408
|
-
var dateInput = DateInput.getInstance();
|
409
|
-
var rootInstance = _this2.rootInstance;
|
410
|
-
|
411
|
-
if (!rootInstance || rootInstance.contains(document.activeElement) || dateInput && dateInput.contains(document.activeElement)) {
|
412
|
-
// focused element is still part of Calendar
|
413
|
-
return;
|
414
|
-
}
|
415
|
-
|
416
|
-
if (_this2.props.onBlur) {
|
417
|
-
_this2.props.onBlur(event);
|
418
|
-
}
|
419
|
-
}, 0);
|
420
|
-
};
|
421
|
-
|
422
|
-
this.getRootDOMNode = function () {
|
423
|
-
return ReactDOM.findDOMNode(_this2);
|
424
|
-
};
|
425
|
-
|
426
|
-
this.openTimePicker = function () {
|
427
|
-
_this2.onPanelChange(null, 'time');
|
428
|
-
};
|
429
|
-
|
430
|
-
this.closeTimePicker = function () {
|
431
|
-
_this2.onPanelChange(null, 'date');
|
432
|
-
};
|
433
|
-
|
434
|
-
this.goTime = function (direction, unit) {
|
435
|
-
_this2.setValue(goTime(_this2.state.value, direction, unit));
|
436
|
-
};
|
437
|
-
};
|
438
|
-
|
439
|
-
polyfill(Calendar);
|
440
|
-
|
441
|
-
export default calendarMixinWrapper(commonMixinWrapper(Calendar));
|
package/es/FullCalendar.js
DELETED
@@ -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));
|