@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/lib/month/MonthTable.js
DELETED
@@ -1,181 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
exports.__esModule = true;
|
4
|
-
|
5
|
-
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
6
|
-
|
7
|
-
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
8
|
-
|
9
|
-
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
10
|
-
|
11
|
-
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
12
|
-
|
13
|
-
var _inherits2 = require('babel-runtime/helpers/inherits');
|
14
|
-
|
15
|
-
var _inherits3 = _interopRequireDefault(_inherits2);
|
16
|
-
|
17
|
-
var _react = require('react');
|
18
|
-
|
19
|
-
var _react2 = _interopRequireDefault(_react);
|
20
|
-
|
21
|
-
var _propTypes = require('prop-types');
|
22
|
-
|
23
|
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
24
|
-
|
25
|
-
var _classnames = require('classnames');
|
26
|
-
|
27
|
-
var _classnames2 = _interopRequireDefault(_classnames);
|
28
|
-
|
29
|
-
var _index = require('../util/index');
|
30
|
-
|
31
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
32
|
-
|
33
|
-
var ROW = 4;
|
34
|
-
var COL = 3;
|
35
|
-
|
36
|
-
function chooseMonth(month) {
|
37
|
-
var next = this.state.value.clone();
|
38
|
-
next = next.month(month);
|
39
|
-
this.setAndSelectValue(next);
|
40
|
-
}
|
41
|
-
|
42
|
-
function noop() {}
|
43
|
-
|
44
|
-
var MonthTable = function (_Component) {
|
45
|
-
(0, _inherits3['default'])(MonthTable, _Component);
|
46
|
-
|
47
|
-
function MonthTable(props) {
|
48
|
-
(0, _classCallCheck3['default'])(this, MonthTable);
|
49
|
-
|
50
|
-
var _this = (0, _possibleConstructorReturn3['default'])(this, _Component.call(this, props));
|
51
|
-
|
52
|
-
_this.state = {
|
53
|
-
value: props.value
|
54
|
-
};
|
55
|
-
return _this;
|
56
|
-
}
|
57
|
-
|
58
|
-
MonthTable.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
59
|
-
if ('value' in nextProps) {
|
60
|
-
this.setState({
|
61
|
-
value: nextProps.value
|
62
|
-
});
|
63
|
-
}
|
64
|
-
};
|
65
|
-
|
66
|
-
MonthTable.prototype.setAndSelectValue = function setAndSelectValue(value) {
|
67
|
-
this.setState({
|
68
|
-
value: value
|
69
|
-
});
|
70
|
-
this.props.onSelect(value);
|
71
|
-
};
|
72
|
-
|
73
|
-
MonthTable.prototype.months = function months() {
|
74
|
-
var value = this.state.value;
|
75
|
-
var current = value.clone();
|
76
|
-
var months = [];
|
77
|
-
var index = 0;
|
78
|
-
for (var rowIndex = 0; rowIndex < ROW; rowIndex++) {
|
79
|
-
months[rowIndex] = [];
|
80
|
-
for (var colIndex = 0; colIndex < COL; colIndex++) {
|
81
|
-
current = current.month(index);
|
82
|
-
var content = (0, _index.getMonthName)(current);
|
83
|
-
months[rowIndex][colIndex] = {
|
84
|
-
value: index,
|
85
|
-
content: content,
|
86
|
-
title: content
|
87
|
-
};
|
88
|
-
index++;
|
89
|
-
}
|
90
|
-
}
|
91
|
-
return months;
|
92
|
-
};
|
93
|
-
|
94
|
-
MonthTable.prototype.render = function render() {
|
95
|
-
var _this2 = this;
|
96
|
-
|
97
|
-
var props = this.props;
|
98
|
-
var value = this.state.value;
|
99
|
-
var today = (0, _index.getTodayTime)(value);
|
100
|
-
var months = this.months();
|
101
|
-
var currentMonth = value.month();
|
102
|
-
var prefixCls = props.prefixCls,
|
103
|
-
locale = props.locale,
|
104
|
-
contentRender = props.contentRender,
|
105
|
-
cellRender = props.cellRender;
|
106
|
-
|
107
|
-
var monthsEls = months.map(function (month, index) {
|
108
|
-
var tds = month.map(function (monthData) {
|
109
|
-
var _classNameMap;
|
110
|
-
|
111
|
-
var disabled = false;
|
112
|
-
if (props.disabledDate) {
|
113
|
-
var testValue = value.clone();
|
114
|
-
testValue = testValue.month(monthData.value);
|
115
|
-
disabled = props.disabledDate(testValue);
|
116
|
-
}
|
117
|
-
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);
|
118
|
-
var cellEl = void 0;
|
119
|
-
if (cellRender) {
|
120
|
-
var currentValue = value.clone();
|
121
|
-
currentValue = currentValue.month(monthData.value);
|
122
|
-
cellEl = cellRender(currentValue, locale);
|
123
|
-
} else {
|
124
|
-
var content = void 0;
|
125
|
-
if (contentRender) {
|
126
|
-
var _currentValue = value.clone();
|
127
|
-
_currentValue = _currentValue.month(monthData.value);
|
128
|
-
content = contentRender(_currentValue, locale);
|
129
|
-
} else {
|
130
|
-
content = monthData.content;
|
131
|
-
}
|
132
|
-
cellEl = _react2['default'].createElement(
|
133
|
-
'a',
|
134
|
-
{ className: prefixCls + '-month' },
|
135
|
-
content
|
136
|
-
);
|
137
|
-
}
|
138
|
-
return _react2['default'].createElement(
|
139
|
-
'td',
|
140
|
-
{
|
141
|
-
role: 'gridcell',
|
142
|
-
key: monthData.value,
|
143
|
-
onClick: disabled ? null : chooseMonth.bind(_this2, monthData.value),
|
144
|
-
title: monthData.title,
|
145
|
-
className: (0, _classnames2['default'])(classNameMap)
|
146
|
-
},
|
147
|
-
cellEl
|
148
|
-
);
|
149
|
-
});
|
150
|
-
return _react2['default'].createElement(
|
151
|
-
'tr',
|
152
|
-
{ key: index, role: 'row' },
|
153
|
-
tds
|
154
|
-
);
|
155
|
-
});
|
156
|
-
|
157
|
-
return _react2['default'].createElement(
|
158
|
-
'table',
|
159
|
-
{ className: prefixCls + '-table', cellSpacing: '0', role: 'grid' },
|
160
|
-
_react2['default'].createElement(
|
161
|
-
'tbody',
|
162
|
-
{ className: prefixCls + '-tbody' },
|
163
|
-
monthsEls
|
164
|
-
)
|
165
|
-
);
|
166
|
-
};
|
167
|
-
|
168
|
-
return MonthTable;
|
169
|
-
}(_react.Component);
|
170
|
-
|
171
|
-
MonthTable.defaultProps = {
|
172
|
-
onSelect: noop
|
173
|
-
};
|
174
|
-
MonthTable.propTypes = {
|
175
|
-
onSelect: _propTypes2['default'].func,
|
176
|
-
cellRender: _propTypes2['default'].func,
|
177
|
-
prefixCls: _propTypes2['default'].string,
|
178
|
-
value: _propTypes2['default'].object
|
179
|
-
};
|
180
|
-
exports['default'] = MonthTable;
|
181
|
-
module.exports = exports['default'];
|
package/lib/picker/placements.js
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
exports.__esModule = true;
|
4
|
-
var autoAdjustOverflow = {
|
5
|
-
adjustX: 1,
|
6
|
-
adjustY: 1
|
7
|
-
};
|
8
|
-
|
9
|
-
var targetOffset = [0, 0];
|
10
|
-
|
11
|
-
var placements = {
|
12
|
-
bottomLeft: {
|
13
|
-
points: ['tl', 'tl'],
|
14
|
-
overflow: autoAdjustOverflow,
|
15
|
-
offset: [0, -3],
|
16
|
-
targetOffset: targetOffset
|
17
|
-
},
|
18
|
-
bottomRight: {
|
19
|
-
points: ['tr', 'tr'],
|
20
|
-
overflow: autoAdjustOverflow,
|
21
|
-
offset: [0, -3],
|
22
|
-
targetOffset: targetOffset
|
23
|
-
},
|
24
|
-
topRight: {
|
25
|
-
points: ['br', 'br'],
|
26
|
-
overflow: autoAdjustOverflow,
|
27
|
-
offset: [0, 3],
|
28
|
-
targetOffset: targetOffset
|
29
|
-
},
|
30
|
-
topLeft: {
|
31
|
-
points: ['bl', 'bl'],
|
32
|
-
overflow: autoAdjustOverflow,
|
33
|
-
offset: [0, 3],
|
34
|
-
targetOffset: targetOffset
|
35
|
-
}
|
36
|
-
};
|
37
|
-
|
38
|
-
exports['default'] = placements;
|
39
|
-
module.exports = exports['default'];
|
@@ -1,184 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
exports.__esModule = true;
|
4
|
-
|
5
|
-
var _extends2 = require('babel-runtime/helpers/extends');
|
6
|
-
|
7
|
-
var _extends3 = _interopRequireDefault(_extends2);
|
8
|
-
|
9
|
-
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
10
|
-
|
11
|
-
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
12
|
-
|
13
|
-
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
14
|
-
|
15
|
-
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
16
|
-
|
17
|
-
var _inherits2 = require('babel-runtime/helpers/inherits');
|
18
|
-
|
19
|
-
var _inherits3 = _interopRequireDefault(_inherits2);
|
20
|
-
|
21
|
-
var _react = require('react');
|
22
|
-
|
23
|
-
var _react2 = _interopRequireDefault(_react);
|
24
|
-
|
25
|
-
var _propTypes = require('prop-types');
|
26
|
-
|
27
|
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
28
|
-
|
29
|
-
var _CalendarHeader = require('../calendar/CalendarHeader');
|
30
|
-
|
31
|
-
var _CalendarHeader2 = _interopRequireDefault(_CalendarHeader);
|
32
|
-
|
33
|
-
var _DateTable = require('../date/DateTable');
|
34
|
-
|
35
|
-
var _DateTable2 = _interopRequireDefault(_DateTable);
|
36
|
-
|
37
|
-
var _DateInput = require('../date/DateInput');
|
38
|
-
|
39
|
-
var _DateInput2 = _interopRequireDefault(_DateInput);
|
40
|
-
|
41
|
-
var _index = require('../util/index');
|
42
|
-
|
43
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
44
|
-
|
45
|
-
var CalendarPart = function (_React$Component) {
|
46
|
-
(0, _inherits3['default'])(CalendarPart, _React$Component);
|
47
|
-
|
48
|
-
function CalendarPart() {
|
49
|
-
(0, _classCallCheck3['default'])(this, CalendarPart);
|
50
|
-
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
|
51
|
-
}
|
52
|
-
|
53
|
-
CalendarPart.prototype.render = function render() {
|
54
|
-
var props = this.props;
|
55
|
-
var prefixCls = props.prefixCls,
|
56
|
-
value = props.value,
|
57
|
-
hoverValue = props.hoverValue,
|
58
|
-
selectedValue = props.selectedValue,
|
59
|
-
mode = props.mode,
|
60
|
-
direction = props.direction,
|
61
|
-
locale = props.locale,
|
62
|
-
format = props.format,
|
63
|
-
placeholder = props.placeholder,
|
64
|
-
disabledDate = props.disabledDate,
|
65
|
-
timePicker = props.timePicker,
|
66
|
-
disabledTime = props.disabledTime,
|
67
|
-
timePickerDisabledTime = props.timePickerDisabledTime,
|
68
|
-
showTimePicker = props.showTimePicker,
|
69
|
-
onInputChange = props.onInputChange,
|
70
|
-
onInputSelect = props.onInputSelect,
|
71
|
-
enablePrev = props.enablePrev,
|
72
|
-
enableNext = props.enableNext,
|
73
|
-
clearIcon = props.clearIcon,
|
74
|
-
showClear = props.showClear,
|
75
|
-
inputMode = props.inputMode;
|
76
|
-
|
77
|
-
var shouldShowTimePicker = showTimePicker && timePicker;
|
78
|
-
var disabledTimeConfig = shouldShowTimePicker && disabledTime ? (0, _index.getTimeConfig)(selectedValue, disabledTime) : null;
|
79
|
-
var rangeClassName = prefixCls + '-range';
|
80
|
-
var newProps = {
|
81
|
-
locale: locale,
|
82
|
-
value: value,
|
83
|
-
prefixCls: prefixCls,
|
84
|
-
showTimePicker: showTimePicker
|
85
|
-
};
|
86
|
-
var index = direction === 'left' ? 0 : 1;
|
87
|
-
var timePickerEle = shouldShowTimePicker && _react2['default'].cloneElement(timePicker, (0, _extends3['default'])({
|
88
|
-
showHour: true,
|
89
|
-
showMinute: true,
|
90
|
-
showSecond: true
|
91
|
-
}, timePicker.props, disabledTimeConfig, timePickerDisabledTime, {
|
92
|
-
onChange: onInputChange,
|
93
|
-
defaultOpenValue: value,
|
94
|
-
value: selectedValue[index]
|
95
|
-
}));
|
96
|
-
|
97
|
-
var dateInputElement = props.showDateInput && _react2['default'].createElement(_DateInput2['default'], {
|
98
|
-
format: format,
|
99
|
-
locale: locale,
|
100
|
-
prefixCls: prefixCls,
|
101
|
-
timePicker: timePicker,
|
102
|
-
disabledDate: disabledDate,
|
103
|
-
placeholder: placeholder,
|
104
|
-
disabledTime: disabledTime,
|
105
|
-
value: value,
|
106
|
-
showClear: showClear || false,
|
107
|
-
selectedValue: selectedValue[index],
|
108
|
-
onChange: onInputChange,
|
109
|
-
onSelect: onInputSelect,
|
110
|
-
clearIcon: clearIcon,
|
111
|
-
inputMode: inputMode
|
112
|
-
});
|
113
|
-
|
114
|
-
return _react2['default'].createElement(
|
115
|
-
'div',
|
116
|
-
{
|
117
|
-
className: rangeClassName + '-part ' + rangeClassName + '-' + direction
|
118
|
-
},
|
119
|
-
dateInputElement,
|
120
|
-
_react2['default'].createElement(
|
121
|
-
'div',
|
122
|
-
{ style: { outline: 'none' } },
|
123
|
-
_react2['default'].createElement(_CalendarHeader2['default'], (0, _extends3['default'])({}, newProps, {
|
124
|
-
mode: mode,
|
125
|
-
enableNext: enableNext,
|
126
|
-
enablePrev: enablePrev,
|
127
|
-
onValueChange: props.onValueChange,
|
128
|
-
onPanelChange: props.onPanelChange,
|
129
|
-
disabledMonth: props.disabledMonth
|
130
|
-
})),
|
131
|
-
showTimePicker ? _react2['default'].createElement(
|
132
|
-
'div',
|
133
|
-
{ className: prefixCls + '-time-picker' },
|
134
|
-
_react2['default'].createElement(
|
135
|
-
'div',
|
136
|
-
{ className: prefixCls + '-time-picker-panel' },
|
137
|
-
timePickerEle
|
138
|
-
)
|
139
|
-
) : null,
|
140
|
-
_react2['default'].createElement(
|
141
|
-
'div',
|
142
|
-
{ className: prefixCls + '-body' },
|
143
|
-
_react2['default'].createElement(_DateTable2['default'], (0, _extends3['default'])({}, newProps, {
|
144
|
-
hoverValue: hoverValue,
|
145
|
-
selectedValue: selectedValue,
|
146
|
-
dateRender: props.dateRender,
|
147
|
-
onSelect: props.onSelect,
|
148
|
-
onDayHover: props.onDayHover,
|
149
|
-
disabledDate: disabledDate,
|
150
|
-
showWeekNumber: props.showWeekNumber
|
151
|
-
}))
|
152
|
-
)
|
153
|
-
)
|
154
|
-
);
|
155
|
-
};
|
156
|
-
|
157
|
-
return CalendarPart;
|
158
|
-
}(_react2['default'].Component);
|
159
|
-
|
160
|
-
CalendarPart.propTypes = {
|
161
|
-
prefixCls: _propTypes2['default'].string,
|
162
|
-
value: _propTypes2['default'].any,
|
163
|
-
hoverValue: _propTypes2['default'].any,
|
164
|
-
selectedValue: _propTypes2['default'].any,
|
165
|
-
direction: _propTypes2['default'].any,
|
166
|
-
locale: _propTypes2['default'].any,
|
167
|
-
showDateInput: _propTypes2['default'].bool,
|
168
|
-
showTimePicker: _propTypes2['default'].bool,
|
169
|
-
format: _propTypes2['default'].any,
|
170
|
-
placeholder: _propTypes2['default'].any,
|
171
|
-
disabledDate: _propTypes2['default'].any,
|
172
|
-
timePicker: _propTypes2['default'].any,
|
173
|
-
disabledTime: _propTypes2['default'].any,
|
174
|
-
onInputChange: _propTypes2['default'].func,
|
175
|
-
onInputSelect: _propTypes2['default'].func,
|
176
|
-
timePickerDisabledTime: _propTypes2['default'].object,
|
177
|
-
enableNext: _propTypes2['default'].any,
|
178
|
-
enablePrev: _propTypes2['default'].any,
|
179
|
-
clearIcon: _propTypes2['default'].node,
|
180
|
-
dateRender: _propTypes2['default'].func,
|
181
|
-
inputMode: _propTypes2['default'].string
|
182
|
-
};
|
183
|
-
exports['default'] = CalendarPart;
|
184
|
-
module.exports = exports['default'];
|
package/lib/util/dayjs.js
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
exports.__esModule = true;
|
4
|
-
|
5
|
-
var _dayjs = require('dayjs');
|
6
|
-
|
7
|
-
var _dayjs2 = _interopRequireDefault(_dayjs);
|
8
|
-
|
9
|
-
var _localeData = require('dayjs/plugin/localeData');
|
10
|
-
|
11
|
-
var _localeData2 = _interopRequireDefault(_localeData);
|
12
|
-
|
13
|
-
var _weekOfYear = require('dayjs/plugin/weekOfYear');
|
14
|
-
|
15
|
-
var _weekOfYear2 = _interopRequireDefault(_weekOfYear);
|
16
|
-
|
17
|
-
var _utc = require('dayjs/plugin/utc');
|
18
|
-
|
19
|
-
var _utc2 = _interopRequireDefault(_utc);
|
20
|
-
|
21
|
-
var _advancedFormat = require('dayjs/plugin/advancedFormat');
|
22
|
-
|
23
|
-
var _advancedFormat2 = _interopRequireDefault(_advancedFormat);
|
24
|
-
|
25
|
-
var _customParseFormat = require('dayjs/plugin/customParseFormat');
|
26
|
-
|
27
|
-
var _customParseFormat2 = _interopRequireDefault(_customParseFormat);
|
28
|
-
|
29
|
-
var _badMutable = require('dayjs/plugin/badMutable');
|
30
|
-
|
31
|
-
var _badMutable2 = _interopRequireDefault(_badMutable);
|
32
|
-
|
33
|
-
require('dayjs/locale/zh-cn');
|
34
|
-
|
35
|
-
require('dayjs/locale/en-gb');
|
36
|
-
|
37
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
38
|
-
|
39
|
-
_dayjs2['default'].extend(_localeData2['default']);
|
40
|
-
_dayjs2['default'].extend(_weekOfYear2['default']);
|
41
|
-
_dayjs2['default'].extend(_utc2['default']);
|
42
|
-
_dayjs2['default'].extend(_advancedFormat2['default']);
|
43
|
-
_dayjs2['default'].extend(_customParseFormat2['default']);
|
44
|
-
_dayjs2['default'].extend(_badMutable2['default']);
|
45
|
-
exports['default'] = _dayjs2['default'];
|
46
|
-
module.exports = exports['default'];
|
package/lib/util/index.js
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
exports.__esModule = true;
|
4
|
-
|
5
|
-
var _extends2 = require('babel-runtime/helpers/extends');
|
6
|
-
|
7
|
-
var _extends3 = _interopRequireDefault(_extends2);
|
8
|
-
|
9
|
-
exports.getTodayTime = getTodayTime;
|
10
|
-
exports.getTitleString = getTitleString;
|
11
|
-
exports.getTodayTimeStr = getTodayTimeStr;
|
12
|
-
exports.getMonthName = getMonthName;
|
13
|
-
exports.syncTime = syncTime;
|
14
|
-
exports.getTimeConfig = getTimeConfig;
|
15
|
-
exports.isTimeValidByConfig = isTimeValidByConfig;
|
16
|
-
exports.isTimeValid = isTimeValid;
|
17
|
-
exports.isAllowedDate = isAllowedDate;
|
18
|
-
exports.formatDate = formatDate;
|
19
|
-
|
20
|
-
var _dayjs = require('dayjs');
|
21
|
-
|
22
|
-
var _dayjs2 = _interopRequireDefault(_dayjs);
|
23
|
-
|
24
|
-
var _utc = require('dayjs/plugin/utc');
|
25
|
-
|
26
|
-
var _utc2 = _interopRequireDefault(_utc);
|
27
|
-
|
28
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
29
|
-
|
30
|
-
_dayjs2['default'].extend(_utc2['default']);
|
31
|
-
|
32
|
-
var defaultDisabledTime = {
|
33
|
-
disabledHours: function disabledHours() {
|
34
|
-
return [];
|
35
|
-
},
|
36
|
-
disabledMinutes: function disabledMinutes() {
|
37
|
-
return [];
|
38
|
-
},
|
39
|
-
disabledSeconds: function disabledSeconds() {
|
40
|
-
return [];
|
41
|
-
}
|
42
|
-
};
|
43
|
-
|
44
|
-
function getTodayTime(value) {
|
45
|
-
var today = (0, _dayjs2['default'])();
|
46
|
-
today = today.locale(value.locale()).utcOffset(value.utcOffset());
|
47
|
-
return today;
|
48
|
-
}
|
49
|
-
|
50
|
-
function getTitleString(value) {
|
51
|
-
return value.format('LL');
|
52
|
-
}
|
53
|
-
|
54
|
-
function getTodayTimeStr(value) {
|
55
|
-
var today = getTodayTime(value);
|
56
|
-
return getTitleString(today);
|
57
|
-
}
|
58
|
-
|
59
|
-
function getMonthName(month) {
|
60
|
-
var locale = month.locale();
|
61
|
-
var localeData = month.localeData();
|
62
|
-
return localeData[locale === 'zh-cn' ? 'months' : 'monthsShort'](month);
|
63
|
-
}
|
64
|
-
|
65
|
-
function syncTime(from, to) {
|
66
|
-
if (!_dayjs2['default'].isDayjs(from) || !_dayjs2['default'].isDayjs(to)) return;
|
67
|
-
to = to.hour(from.hour());
|
68
|
-
to = to.minute(from.minute());
|
69
|
-
to = to.second(from.second());
|
70
|
-
to = to.millisecond(from.millisecond());
|
71
|
-
}
|
72
|
-
|
73
|
-
function getTimeConfig(value, disabledTime) {
|
74
|
-
var disabledTimeConfig = disabledTime ? disabledTime(value) : {};
|
75
|
-
disabledTimeConfig = (0, _extends3['default'])({}, defaultDisabledTime, disabledTimeConfig);
|
76
|
-
return disabledTimeConfig;
|
77
|
-
}
|
78
|
-
|
79
|
-
function isTimeValidByConfig(value, disabledTimeConfig) {
|
80
|
-
var invalidTime = false;
|
81
|
-
if (value) {
|
82
|
-
var hour = value.hour();
|
83
|
-
var minutes = value.minute();
|
84
|
-
var seconds = value.second();
|
85
|
-
var disabledHours = disabledTimeConfig.disabledHours();
|
86
|
-
if (disabledHours.indexOf(hour) === -1) {
|
87
|
-
var disabledMinutes = disabledTimeConfig.disabledMinutes(hour);
|
88
|
-
if (disabledMinutes.indexOf(minutes) === -1) {
|
89
|
-
var disabledSeconds = disabledTimeConfig.disabledSeconds(hour, minutes);
|
90
|
-
invalidTime = disabledSeconds.indexOf(seconds) !== -1;
|
91
|
-
} else {
|
92
|
-
invalidTime = true;
|
93
|
-
}
|
94
|
-
} else {
|
95
|
-
invalidTime = true;
|
96
|
-
}
|
97
|
-
}
|
98
|
-
return !invalidTime;
|
99
|
-
}
|
100
|
-
|
101
|
-
function isTimeValid(value, disabledTime) {
|
102
|
-
var disabledTimeConfig = getTimeConfig(value, disabledTime);
|
103
|
-
return isTimeValidByConfig(value, disabledTimeConfig);
|
104
|
-
}
|
105
|
-
|
106
|
-
function isAllowedDate(value, disabledDate, disabledTime) {
|
107
|
-
if (disabledDate) {
|
108
|
-
if (disabledDate(value)) {
|
109
|
-
return false;
|
110
|
-
}
|
111
|
-
}
|
112
|
-
if (disabledTime) {
|
113
|
-
if (!isTimeValid(value, disabledTime)) {
|
114
|
-
return false;
|
115
|
-
}
|
116
|
-
}
|
117
|
-
return true;
|
118
|
-
}
|
119
|
-
|
120
|
-
function formatDate(value, format) {
|
121
|
-
if (!value) {
|
122
|
-
return '';
|
123
|
-
}
|
124
|
-
|
125
|
-
if (Array.isArray(format)) {
|
126
|
-
format = format[0];
|
127
|
-
}
|
128
|
-
|
129
|
-
return value.format(format);
|
130
|
-
}
|
package/lib/util/toTime.js
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
exports.__esModule = true;
|
4
|
-
exports.goStartMonth = goStartMonth;
|
5
|
-
exports.goEndMonth = goEndMonth;
|
6
|
-
exports.goTime = goTime;
|
7
|
-
exports.includesTime = includesTime;
|
8
|
-
function goStartMonth(time) {
|
9
|
-
return time.clone().startOf('month');
|
10
|
-
}
|
11
|
-
|
12
|
-
function goEndMonth(time) {
|
13
|
-
return time.clone().endOf('month');
|
14
|
-
}
|
15
|
-
|
16
|
-
function goTime(time, direction, unit) {
|
17
|
-
return time.clone().add(direction, unit);
|
18
|
-
}
|
19
|
-
|
20
|
-
function includesTime() {
|
21
|
-
var timeList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
22
|
-
var time = arguments[1];
|
23
|
-
var unit = arguments[2];
|
24
|
-
|
25
|
-
return timeList.some(function (t) {
|
26
|
-
return t.isSame(time, unit);
|
27
|
-
});
|
28
|
-
}
|