@seafile/seafile-calendar 0.0.28 → 0.0.29-alpha.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/README.md +1 -1
- 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 -7043
- 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 -436
- 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 -4
- package/es/date/DateInput.js +0 -233
- package/es/date/DateTBody.js +0 -275
- package/es/date/DateTHead.js +0 -78
- 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 -499
- 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 -8
- package/lib/date/DateInput.js +0 -265
- package/lib/date/DateTBody.js +0 -302
- package/lib/date/DateTHead.js +0 -95
- 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/month/MonthPanel.js
DELETED
@@ -1,154 +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 { polyfill } from 'react-lifecycles-compat';
|
7
|
-
import MonthTable from './MonthTable';
|
8
|
-
|
9
|
-
function goYear(direction) {
|
10
|
-
this.props.changeYear(direction);
|
11
|
-
}
|
12
|
-
|
13
|
-
function noop() {}
|
14
|
-
|
15
|
-
var MonthPanel = function (_React$Component) {
|
16
|
-
_inherits(MonthPanel, _React$Component);
|
17
|
-
|
18
|
-
function MonthPanel(props) {
|
19
|
-
_classCallCheck(this, MonthPanel);
|
20
|
-
|
21
|
-
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
22
|
-
|
23
|
-
_this.setAndSelectValue = function (value) {
|
24
|
-
_this.setValue(value);
|
25
|
-
_this.props.onSelect(value);
|
26
|
-
};
|
27
|
-
|
28
|
-
_this.setValue = function (value) {
|
29
|
-
if ('value' in _this.props) {
|
30
|
-
_this.setState({
|
31
|
-
value: value
|
32
|
-
});
|
33
|
-
}
|
34
|
-
};
|
35
|
-
|
36
|
-
_this.nextYear = goYear.bind(_this, 1);
|
37
|
-
_this.previousYear = goYear.bind(_this, -1);
|
38
|
-
_this.prefixCls = props.rootPrefixCls + '-month-panel';
|
39
|
-
|
40
|
-
_this.state = {
|
41
|
-
value: props.value || props.defaultValue
|
42
|
-
};
|
43
|
-
return _this;
|
44
|
-
}
|
45
|
-
|
46
|
-
MonthPanel.getDerivedStateFromProps = function getDerivedStateFromProps(props) {
|
47
|
-
var newState = {};
|
48
|
-
|
49
|
-
if ('value' in props) {
|
50
|
-
newState = {
|
51
|
-
value: props.value
|
52
|
-
};
|
53
|
-
}
|
54
|
-
|
55
|
-
return newState;
|
56
|
-
};
|
57
|
-
|
58
|
-
MonthPanel.prototype.render = function render() {
|
59
|
-
var props = this.props;
|
60
|
-
var value = this.state.value;
|
61
|
-
var locale = props.locale,
|
62
|
-
cellRender = props.cellRender,
|
63
|
-
contentRender = props.contentRender,
|
64
|
-
renderFooter = props.renderFooter;
|
65
|
-
|
66
|
-
var year = value.year();
|
67
|
-
var prefixCls = this.prefixCls;
|
68
|
-
|
69
|
-
var footer = renderFooter && renderFooter('month');
|
70
|
-
|
71
|
-
return React.createElement(
|
72
|
-
'div',
|
73
|
-
{ className: prefixCls, style: props.style },
|
74
|
-
React.createElement(
|
75
|
-
'div',
|
76
|
-
null,
|
77
|
-
React.createElement(
|
78
|
-
'div',
|
79
|
-
{ className: prefixCls + '-header' },
|
80
|
-
React.createElement('a', {
|
81
|
-
className: prefixCls + '-prev-year-btn',
|
82
|
-
role: 'button',
|
83
|
-
onClick: this.previousYear,
|
84
|
-
title: locale.previousYear
|
85
|
-
}),
|
86
|
-
React.createElement(
|
87
|
-
'a',
|
88
|
-
{
|
89
|
-
className: prefixCls + '-year-select',
|
90
|
-
role: 'button',
|
91
|
-
onClick: props.onYearPanelShow,
|
92
|
-
title: locale.yearSelect
|
93
|
-
},
|
94
|
-
React.createElement(
|
95
|
-
'span',
|
96
|
-
{ className: prefixCls + '-year-select-content' },
|
97
|
-
year
|
98
|
-
),
|
99
|
-
React.createElement(
|
100
|
-
'span',
|
101
|
-
{ className: prefixCls + '-year-select-arrow' },
|
102
|
-
'x'
|
103
|
-
)
|
104
|
-
),
|
105
|
-
React.createElement('a', {
|
106
|
-
className: prefixCls + '-next-year-btn',
|
107
|
-
role: 'button',
|
108
|
-
onClick: this.nextYear,
|
109
|
-
title: locale.nextYear
|
110
|
-
})
|
111
|
-
),
|
112
|
-
React.createElement(
|
113
|
-
'div',
|
114
|
-
{ className: prefixCls + '-body' },
|
115
|
-
React.createElement(MonthTable, {
|
116
|
-
disabledDate: props.disabledDate,
|
117
|
-
onSelect: this.setAndSelectValue,
|
118
|
-
locale: locale,
|
119
|
-
value: value,
|
120
|
-
cellRender: cellRender,
|
121
|
-
contentRender: contentRender,
|
122
|
-
prefixCls: prefixCls
|
123
|
-
})
|
124
|
-
),
|
125
|
-
footer && React.createElement(
|
126
|
-
'div',
|
127
|
-
{ className: prefixCls + '-footer' },
|
128
|
-
footer
|
129
|
-
)
|
130
|
-
)
|
131
|
-
);
|
132
|
-
};
|
133
|
-
|
134
|
-
return MonthPanel;
|
135
|
-
}(React.Component);
|
136
|
-
|
137
|
-
MonthPanel.propTypes = {
|
138
|
-
onChange: PropTypes.func,
|
139
|
-
disabledDate: PropTypes.func,
|
140
|
-
onSelect: PropTypes.func,
|
141
|
-
renderFooter: PropTypes.func,
|
142
|
-
rootPrefixCls: PropTypes.string,
|
143
|
-
value: PropTypes.object,
|
144
|
-
defaultValue: PropTypes.object
|
145
|
-
};
|
146
|
-
MonthPanel.defaultProps = {
|
147
|
-
onChange: noop,
|
148
|
-
onSelect: noop
|
149
|
-
};
|
150
|
-
|
151
|
-
|
152
|
-
polyfill(MonthPanel);
|
153
|
-
|
154
|
-
export default MonthPanel;
|
package/es/month/MonthTable.js
DELETED
@@ -1,156 +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, { Component } from 'react';
|
5
|
-
import PropTypes from 'prop-types';
|
6
|
-
import classnames from 'classnames';
|
7
|
-
import { getTodayTime, getMonthName } from '../util/index';
|
8
|
-
|
9
|
-
var ROW = 4;
|
10
|
-
var COL = 3;
|
11
|
-
|
12
|
-
function chooseMonth(month) {
|
13
|
-
var next = this.state.value.clone();
|
14
|
-
next = next.month(month);
|
15
|
-
this.setAndSelectValue(next);
|
16
|
-
}
|
17
|
-
|
18
|
-
function noop() {}
|
19
|
-
|
20
|
-
var MonthTable = function (_Component) {
|
21
|
-
_inherits(MonthTable, _Component);
|
22
|
-
|
23
|
-
function MonthTable(props) {
|
24
|
-
_classCallCheck(this, MonthTable);
|
25
|
-
|
26
|
-
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
27
|
-
|
28
|
-
_this.state = {
|
29
|
-
value: props.value
|
30
|
-
};
|
31
|
-
return _this;
|
32
|
-
}
|
33
|
-
|
34
|
-
MonthTable.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
35
|
-
if ('value' in nextProps) {
|
36
|
-
this.setState({
|
37
|
-
value: nextProps.value
|
38
|
-
});
|
39
|
-
}
|
40
|
-
};
|
41
|
-
|
42
|
-
MonthTable.prototype.setAndSelectValue = function setAndSelectValue(value) {
|
43
|
-
this.setState({
|
44
|
-
value: value
|
45
|
-
});
|
46
|
-
this.props.onSelect(value);
|
47
|
-
};
|
48
|
-
|
49
|
-
MonthTable.prototype.months = function months() {
|
50
|
-
var value = this.state.value;
|
51
|
-
var current = value.clone();
|
52
|
-
var months = [];
|
53
|
-
var index = 0;
|
54
|
-
for (var rowIndex = 0; rowIndex < ROW; rowIndex++) {
|
55
|
-
months[rowIndex] = [];
|
56
|
-
for (var colIndex = 0; colIndex < COL; colIndex++) {
|
57
|
-
current = current.month(index);
|
58
|
-
var content = getMonthName(current);
|
59
|
-
months[rowIndex][colIndex] = {
|
60
|
-
value: index,
|
61
|
-
content: content,
|
62
|
-
title: content
|
63
|
-
};
|
64
|
-
index++;
|
65
|
-
}
|
66
|
-
}
|
67
|
-
return months;
|
68
|
-
};
|
69
|
-
|
70
|
-
MonthTable.prototype.render = function render() {
|
71
|
-
var _this2 = this;
|
72
|
-
|
73
|
-
var props = this.props;
|
74
|
-
var value = this.state.value;
|
75
|
-
var today = getTodayTime(value);
|
76
|
-
var months = this.months();
|
77
|
-
var currentMonth = value.month();
|
78
|
-
var prefixCls = props.prefixCls,
|
79
|
-
locale = props.locale,
|
80
|
-
contentRender = props.contentRender,
|
81
|
-
cellRender = props.cellRender;
|
82
|
-
|
83
|
-
var monthsEls = months.map(function (month, index) {
|
84
|
-
var tds = month.map(function (monthData) {
|
85
|
-
var _classNameMap;
|
86
|
-
|
87
|
-
var disabled = false;
|
88
|
-
if (props.disabledDate) {
|
89
|
-
var testValue = value.clone();
|
90
|
-
testValue = testValue.month(monthData.value);
|
91
|
-
disabled = props.disabledDate(testValue);
|
92
|
-
}
|
93
|
-
var classNameMap = (_classNameMap = {}, _classNameMap[prefixCls + '-cell'] = 1, _classNameMap[prefixCls + '-cell-disabled'] = disabled, _classNameMap[prefixCls + '-selected-cell'] = monthData.value === currentMonth, _classNameMap[prefixCls + '-current-cell'] = today.year() === value.year() && monthData.value === today.month(), _classNameMap);
|
94
|
-
var cellEl = void 0;
|
95
|
-
if (cellRender) {
|
96
|
-
var currentValue = value.clone();
|
97
|
-
currentValue = currentValue.month(monthData.value);
|
98
|
-
cellEl = cellRender(currentValue, locale);
|
99
|
-
} else {
|
100
|
-
var content = void 0;
|
101
|
-
if (contentRender) {
|
102
|
-
var _currentValue = value.clone();
|
103
|
-
_currentValue = _currentValue.month(monthData.value);
|
104
|
-
content = contentRender(_currentValue, locale);
|
105
|
-
} else {
|
106
|
-
content = monthData.content;
|
107
|
-
}
|
108
|
-
cellEl = React.createElement(
|
109
|
-
'a',
|
110
|
-
{ className: prefixCls + '-month' },
|
111
|
-
content
|
112
|
-
);
|
113
|
-
}
|
114
|
-
return React.createElement(
|
115
|
-
'td',
|
116
|
-
{
|
117
|
-
role: 'gridcell',
|
118
|
-
key: monthData.value,
|
119
|
-
onClick: disabled ? null : chooseMonth.bind(_this2, monthData.value),
|
120
|
-
title: monthData.title,
|
121
|
-
className: classnames(classNameMap)
|
122
|
-
},
|
123
|
-
cellEl
|
124
|
-
);
|
125
|
-
});
|
126
|
-
return React.createElement(
|
127
|
-
'tr',
|
128
|
-
{ key: index, role: 'row' },
|
129
|
-
tds
|
130
|
-
);
|
131
|
-
});
|
132
|
-
|
133
|
-
return React.createElement(
|
134
|
-
'table',
|
135
|
-
{ className: prefixCls + '-table', cellSpacing: '0', role: 'grid' },
|
136
|
-
React.createElement(
|
137
|
-
'tbody',
|
138
|
-
{ className: prefixCls + '-tbody' },
|
139
|
-
monthsEls
|
140
|
-
)
|
141
|
-
);
|
142
|
-
};
|
143
|
-
|
144
|
-
return MonthTable;
|
145
|
-
}(Component);
|
146
|
-
|
147
|
-
MonthTable.defaultProps = {
|
148
|
-
onSelect: noop
|
149
|
-
};
|
150
|
-
MonthTable.propTypes = {
|
151
|
-
onSelect: PropTypes.func,
|
152
|
-
cellRender: PropTypes.func,
|
153
|
-
prefixCls: PropTypes.string,
|
154
|
-
value: PropTypes.object
|
155
|
-
};
|
156
|
-
export default MonthTable;
|
package/es/picker/placements.js
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
var autoAdjustOverflow = {
|
2
|
-
adjustX: 1,
|
3
|
-
adjustY: 1
|
4
|
-
};
|
5
|
-
|
6
|
-
var targetOffset = [0, 0];
|
7
|
-
|
8
|
-
var placements = {
|
9
|
-
bottomLeft: {
|
10
|
-
points: ['tl', 'tl'],
|
11
|
-
overflow: autoAdjustOverflow,
|
12
|
-
offset: [0, -3],
|
13
|
-
targetOffset: targetOffset
|
14
|
-
},
|
15
|
-
bottomRight: {
|
16
|
-
points: ['tr', 'tr'],
|
17
|
-
overflow: autoAdjustOverflow,
|
18
|
-
offset: [0, -3],
|
19
|
-
targetOffset: targetOffset
|
20
|
-
},
|
21
|
-
topRight: {
|
22
|
-
points: ['br', 'br'],
|
23
|
-
overflow: autoAdjustOverflow,
|
24
|
-
offset: [0, 3],
|
25
|
-
targetOffset: targetOffset
|
26
|
-
},
|
27
|
-
topLeft: {
|
28
|
-
points: ['bl', 'bl'],
|
29
|
-
overflow: autoAdjustOverflow,
|
30
|
-
offset: [0, 3],
|
31
|
-
targetOffset: targetOffset
|
32
|
-
}
|
33
|
-
};
|
34
|
-
|
35
|
-
export default placements;
|
@@ -1,151 +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 CalendarHeader from '../calendar/CalendarHeader';
|
8
|
-
import DateTable from '../date/DateTable';
|
9
|
-
import DateInput from '../date/DateInput';
|
10
|
-
import { getTimeConfig } from '../util/index';
|
11
|
-
|
12
|
-
var CalendarPart = function (_React$Component) {
|
13
|
-
_inherits(CalendarPart, _React$Component);
|
14
|
-
|
15
|
-
function CalendarPart() {
|
16
|
-
_classCallCheck(this, CalendarPart);
|
17
|
-
|
18
|
-
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
19
|
-
}
|
20
|
-
|
21
|
-
CalendarPart.prototype.render = function render() {
|
22
|
-
var props = this.props;
|
23
|
-
var prefixCls = props.prefixCls,
|
24
|
-
value = props.value,
|
25
|
-
hoverValue = props.hoverValue,
|
26
|
-
selectedValue = props.selectedValue,
|
27
|
-
mode = props.mode,
|
28
|
-
direction = props.direction,
|
29
|
-
locale = props.locale,
|
30
|
-
format = props.format,
|
31
|
-
placeholder = props.placeholder,
|
32
|
-
disabledDate = props.disabledDate,
|
33
|
-
timePicker = props.timePicker,
|
34
|
-
disabledTime = props.disabledTime,
|
35
|
-
timePickerDisabledTime = props.timePickerDisabledTime,
|
36
|
-
showTimePicker = props.showTimePicker,
|
37
|
-
onInputChange = props.onInputChange,
|
38
|
-
onInputSelect = props.onInputSelect,
|
39
|
-
enablePrev = props.enablePrev,
|
40
|
-
enableNext = props.enableNext,
|
41
|
-
clearIcon = props.clearIcon,
|
42
|
-
showClear = props.showClear,
|
43
|
-
inputMode = props.inputMode;
|
44
|
-
|
45
|
-
var shouldShowTimePicker = showTimePicker && timePicker;
|
46
|
-
var disabledTimeConfig = shouldShowTimePicker && disabledTime ? getTimeConfig(selectedValue, disabledTime) : null;
|
47
|
-
var rangeClassName = prefixCls + '-range';
|
48
|
-
var newProps = {
|
49
|
-
locale: locale,
|
50
|
-
value: value,
|
51
|
-
prefixCls: prefixCls,
|
52
|
-
showTimePicker: showTimePicker
|
53
|
-
};
|
54
|
-
var index = direction === 'left' ? 0 : 1;
|
55
|
-
var timePickerEle = shouldShowTimePicker && React.cloneElement(timePicker, _extends({
|
56
|
-
showHour: true,
|
57
|
-
showMinute: true,
|
58
|
-
showSecond: true
|
59
|
-
}, timePicker.props, disabledTimeConfig, timePickerDisabledTime, {
|
60
|
-
onChange: onInputChange,
|
61
|
-
defaultOpenValue: value,
|
62
|
-
value: selectedValue[index]
|
63
|
-
}));
|
64
|
-
|
65
|
-
var dateInputElement = props.showDateInput && React.createElement(DateInput, {
|
66
|
-
format: format,
|
67
|
-
locale: locale,
|
68
|
-
prefixCls: prefixCls,
|
69
|
-
timePicker: timePicker,
|
70
|
-
disabledDate: disabledDate,
|
71
|
-
placeholder: placeholder,
|
72
|
-
disabledTime: disabledTime,
|
73
|
-
value: value,
|
74
|
-
showClear: showClear || false,
|
75
|
-
selectedValue: selectedValue[index],
|
76
|
-
onChange: onInputChange,
|
77
|
-
onSelect: onInputSelect,
|
78
|
-
clearIcon: clearIcon,
|
79
|
-
inputMode: inputMode
|
80
|
-
});
|
81
|
-
|
82
|
-
return React.createElement(
|
83
|
-
'div',
|
84
|
-
{
|
85
|
-
className: rangeClassName + '-part ' + rangeClassName + '-' + direction
|
86
|
-
},
|
87
|
-
dateInputElement,
|
88
|
-
React.createElement(
|
89
|
-
'div',
|
90
|
-
{ style: { outline: 'none' } },
|
91
|
-
React.createElement(CalendarHeader, _extends({}, newProps, {
|
92
|
-
mode: mode,
|
93
|
-
enableNext: enableNext,
|
94
|
-
enablePrev: enablePrev,
|
95
|
-
onValueChange: props.onValueChange,
|
96
|
-
onPanelChange: props.onPanelChange,
|
97
|
-
disabledMonth: props.disabledMonth
|
98
|
-
})),
|
99
|
-
showTimePicker ? React.createElement(
|
100
|
-
'div',
|
101
|
-
{ className: prefixCls + '-time-picker' },
|
102
|
-
React.createElement(
|
103
|
-
'div',
|
104
|
-
{ className: prefixCls + '-time-picker-panel' },
|
105
|
-
timePickerEle
|
106
|
-
)
|
107
|
-
) : null,
|
108
|
-
React.createElement(
|
109
|
-
'div',
|
110
|
-
{ className: prefixCls + '-body' },
|
111
|
-
React.createElement(DateTable, _extends({}, newProps, {
|
112
|
-
hoverValue: hoverValue,
|
113
|
-
selectedValue: selectedValue,
|
114
|
-
dateRender: props.dateRender,
|
115
|
-
onSelect: props.onSelect,
|
116
|
-
onDayHover: props.onDayHover,
|
117
|
-
disabledDate: disabledDate,
|
118
|
-
showWeekNumber: props.showWeekNumber
|
119
|
-
}))
|
120
|
-
)
|
121
|
-
)
|
122
|
-
);
|
123
|
-
};
|
124
|
-
|
125
|
-
return CalendarPart;
|
126
|
-
}(React.Component);
|
127
|
-
|
128
|
-
CalendarPart.propTypes = {
|
129
|
-
prefixCls: PropTypes.string,
|
130
|
-
value: PropTypes.any,
|
131
|
-
hoverValue: PropTypes.any,
|
132
|
-
selectedValue: PropTypes.any,
|
133
|
-
direction: PropTypes.any,
|
134
|
-
locale: PropTypes.any,
|
135
|
-
showDateInput: PropTypes.bool,
|
136
|
-
showTimePicker: PropTypes.bool,
|
137
|
-
format: PropTypes.any,
|
138
|
-
placeholder: PropTypes.any,
|
139
|
-
disabledDate: PropTypes.any,
|
140
|
-
timePicker: PropTypes.any,
|
141
|
-
disabledTime: PropTypes.any,
|
142
|
-
onInputChange: PropTypes.func,
|
143
|
-
onInputSelect: PropTypes.func,
|
144
|
-
timePickerDisabledTime: PropTypes.object,
|
145
|
-
enableNext: PropTypes.any,
|
146
|
-
enablePrev: PropTypes.any,
|
147
|
-
clearIcon: PropTypes.node,
|
148
|
-
dateRender: PropTypes.func,
|
149
|
-
inputMode: PropTypes.string
|
150
|
-
};
|
151
|
-
export default CalendarPart;
|
package/es/util/dayjs.js
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import dayjs from 'dayjs';
|
2
|
-
import localeData from 'dayjs/plugin/localeData';
|
3
|
-
import weekOfYear from 'dayjs/plugin/weekOfYear';
|
4
|
-
import utc from 'dayjs/plugin/utc';
|
5
|
-
import advancedFormat from 'dayjs/plugin/advancedFormat';
|
6
|
-
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
7
|
-
import badMutable from 'dayjs/plugin/badMutable';
|
8
|
-
import 'dayjs/locale/zh-cn';
|
9
|
-
import 'dayjs/locale/en-gb';
|
10
|
-
|
11
|
-
dayjs.extend(localeData);
|
12
|
-
dayjs.extend(weekOfYear);
|
13
|
-
dayjs.extend(utc);
|
14
|
-
dayjs.extend(advancedFormat);
|
15
|
-
dayjs.extend(customParseFormat);
|
16
|
-
dayjs.extend(badMutable);
|
17
|
-
export default dayjs;
|
package/es/util/index.js
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
import _extends from 'babel-runtime/helpers/extends';
|
2
|
-
import dayjs from 'dayjs';
|
3
|
-
import utc from 'dayjs/plugin/utc';
|
4
|
-
|
5
|
-
dayjs.extend(utc);
|
6
|
-
|
7
|
-
var defaultDisabledTime = {
|
8
|
-
disabledHours: function disabledHours() {
|
9
|
-
return [];
|
10
|
-
},
|
11
|
-
disabledMinutes: function disabledMinutes() {
|
12
|
-
return [];
|
13
|
-
},
|
14
|
-
disabledSeconds: function disabledSeconds() {
|
15
|
-
return [];
|
16
|
-
}
|
17
|
-
};
|
18
|
-
|
19
|
-
export function getTodayTime(value) {
|
20
|
-
var today = dayjs();
|
21
|
-
today = today.locale(value.locale()).utcOffset(value.utcOffset());
|
22
|
-
return today;
|
23
|
-
}
|
24
|
-
|
25
|
-
export function getTitleString(value) {
|
26
|
-
return value.format('LL');
|
27
|
-
}
|
28
|
-
|
29
|
-
export function getTodayTimeStr(value) {
|
30
|
-
var today = getTodayTime(value);
|
31
|
-
return getTitleString(today);
|
32
|
-
}
|
33
|
-
|
34
|
-
export function getMonthName(month) {
|
35
|
-
var locale = month.locale();
|
36
|
-
var localeData = month.localeData();
|
37
|
-
return localeData[locale === 'zh-cn' ? 'months' : 'monthsShort'](month);
|
38
|
-
}
|
39
|
-
|
40
|
-
export function syncTime(from, to) {
|
41
|
-
if (!dayjs.isDayjs(from) || !dayjs.isDayjs(to)) return;
|
42
|
-
to = to.hour(from.hour());
|
43
|
-
to = to.minute(from.minute());
|
44
|
-
to = to.second(from.second());
|
45
|
-
to = to.millisecond(from.millisecond());
|
46
|
-
}
|
47
|
-
|
48
|
-
export function getTimeConfig(value, disabledTime) {
|
49
|
-
var disabledTimeConfig = disabledTime ? disabledTime(value) : {};
|
50
|
-
disabledTimeConfig = _extends({}, defaultDisabledTime, disabledTimeConfig);
|
51
|
-
return disabledTimeConfig;
|
52
|
-
}
|
53
|
-
|
54
|
-
export function isTimeValidByConfig(value, disabledTimeConfig) {
|
55
|
-
var invalidTime = false;
|
56
|
-
if (value) {
|
57
|
-
var hour = value.hour();
|
58
|
-
var minutes = value.minute();
|
59
|
-
var seconds = value.second();
|
60
|
-
var disabledHours = disabledTimeConfig.disabledHours();
|
61
|
-
if (disabledHours.indexOf(hour) === -1) {
|
62
|
-
var disabledMinutes = disabledTimeConfig.disabledMinutes(hour);
|
63
|
-
if (disabledMinutes.indexOf(minutes) === -1) {
|
64
|
-
var disabledSeconds = disabledTimeConfig.disabledSeconds(hour, minutes);
|
65
|
-
invalidTime = disabledSeconds.indexOf(seconds) !== -1;
|
66
|
-
} else {
|
67
|
-
invalidTime = true;
|
68
|
-
}
|
69
|
-
} else {
|
70
|
-
invalidTime = true;
|
71
|
-
}
|
72
|
-
}
|
73
|
-
return !invalidTime;
|
74
|
-
}
|
75
|
-
|
76
|
-
export function isTimeValid(value, disabledTime) {
|
77
|
-
var disabledTimeConfig = getTimeConfig(value, disabledTime);
|
78
|
-
return isTimeValidByConfig(value, disabledTimeConfig);
|
79
|
-
}
|
80
|
-
|
81
|
-
export function isAllowedDate(value, disabledDate, disabledTime) {
|
82
|
-
if (disabledDate) {
|
83
|
-
if (disabledDate(value)) {
|
84
|
-
return false;
|
85
|
-
}
|
86
|
-
}
|
87
|
-
if (disabledTime) {
|
88
|
-
if (!isTimeValid(value, disabledTime)) {
|
89
|
-
return false;
|
90
|
-
}
|
91
|
-
}
|
92
|
-
return true;
|
93
|
-
}
|
94
|
-
|
95
|
-
export function formatDate(value, format) {
|
96
|
-
if (!value) {
|
97
|
-
return '';
|
98
|
-
}
|
99
|
-
|
100
|
-
if (Array.isArray(format)) {
|
101
|
-
format = format[0];
|
102
|
-
}
|
103
|
-
|
104
|
-
return value.format(format);
|
105
|
-
}
|
package/es/util/toTime.js
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
export function goStartMonth(time) {
|
2
|
-
return time.clone().startOf('month');
|
3
|
-
}
|
4
|
-
|
5
|
-
export function goEndMonth(time) {
|
6
|
-
return time.clone().endOf('month');
|
7
|
-
}
|
8
|
-
|
9
|
-
export function goTime(time, direction, unit) {
|
10
|
-
return time.clone().add(direction, unit);
|
11
|
-
}
|
12
|
-
|
13
|
-
export function includesTime() {
|
14
|
-
var timeList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
15
|
-
var time = arguments[1];
|
16
|
-
var unit = arguments[2];
|
17
|
-
|
18
|
-
return timeList.some(function (t) {
|
19
|
-
return t.isSame(time, unit);
|
20
|
-
});
|
21
|
-
}
|