@seafile/seafile-calendar 0.0.13 → 0.0.17-beta
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/assets/index.css +1 -3
- package/dist/rc-calendar.css +1 -3
- package/dist/rc-calendar.css.map +1 -1
- package/dist/rc-calendar.js +307 -5929
- package/dist/rc-calendar.js.map +1 -1
- package/dist/rc-calendar.min.css +1 -3
- package/dist/rc-calendar.min.css.map +1 -1
- package/dist/rc-calendar.min.js +1 -1
- package/es/Calendar.js +12 -4
- package/es/FullCalendar.js +2 -2
- package/es/MonthCalendar.js +8 -8
- package/es/RangeCalendar.js +4 -4
- package/es/calendar/CalendarHeader.js +2 -2
- package/es/calendar/CalendarRightPanel.js +24 -13
- package/es/date/DateInput.js +3 -3
- package/es/date/DateTBody.js +3 -3
- package/es/date/DateTHead.js +27 -30
- package/es/decade/DecadePanel.js +3 -3
- package/es/full-calendar/CalendarHeader.js +3 -3
- package/es/mixin/CalendarMixin.js +2 -2
- package/es/month/MonthTable.js +5 -5
- package/es/util/index.js +11 -8
- package/es/year/YearPanel.js +3 -3
- package/index.d.ts +10 -10
- package/lib/Calendar.js +23 -5
- package/lib/FullCalendar.js +3 -3
- package/lib/MonthCalendar.js +9 -9
- package/lib/RangeCalendar.js +5 -5
- package/lib/calendar/CalendarHeader.js +2 -2
- package/lib/calendar/CalendarRightPanel.js +25 -14
- package/lib/date/DateInput.js +4 -4
- package/lib/date/DateTBody.js +3 -3
- package/lib/date/DateTHead.js +41 -50
- package/lib/decade/DecadePanel.js +3 -3
- package/lib/full-calendar/CalendarHeader.js +3 -3
- package/lib/mixin/CalendarMixin.js +3 -3
- package/lib/month/MonthTable.js +5 -5
- package/lib/util/index.js +15 -9
- package/lib/year/YearPanel.js +3 -3
- package/package.json +2 -2
package/lib/MonthCalendar.js
CHANGED
@@ -44,9 +44,9 @@ var _CalendarMixin = require('./mixin/CalendarMixin');
|
|
44
44
|
|
45
45
|
var _CommonMixin = require('./mixin/CommonMixin');
|
46
46
|
|
47
|
-
var
|
47
|
+
var _dayjs = require('dayjs');
|
48
48
|
|
49
|
-
var
|
49
|
+
var _dayjs2 = _interopRequireDefault(_dayjs);
|
50
50
|
|
51
51
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
52
52
|
|
@@ -68,26 +68,26 @@ var MonthCalendar = function (_React$Component) {
|
|
68
68
|
switch (keyCode) {
|
69
69
|
case _KeyCode2['default'].DOWN:
|
70
70
|
value = stateValue.clone();
|
71
|
-
value.add(3, 'months');
|
71
|
+
value = value.add(3, 'months');
|
72
72
|
break;
|
73
73
|
case _KeyCode2['default'].UP:
|
74
74
|
value = stateValue.clone();
|
75
|
-
value.add(-3, 'months');
|
75
|
+
value = value.add(-3, 'months');
|
76
76
|
break;
|
77
77
|
case _KeyCode2['default'].LEFT:
|
78
78
|
value = stateValue.clone();
|
79
79
|
if (ctrlKey) {
|
80
|
-
value.add(-1, 'years');
|
80
|
+
value = value.add(-1, 'years');
|
81
81
|
} else {
|
82
|
-
value.add(-1, 'months');
|
82
|
+
value = value.add(-1, 'months');
|
83
83
|
}
|
84
84
|
break;
|
85
85
|
case _KeyCode2['default'].RIGHT:
|
86
86
|
value = stateValue.clone();
|
87
87
|
if (ctrlKey) {
|
88
|
-
value.add(1, 'years');
|
88
|
+
value = value.add(1, 'years');
|
89
89
|
} else {
|
90
|
-
value.add(1, 'months');
|
90
|
+
value = value.add(1, 'months');
|
91
91
|
}
|
92
92
|
break;
|
93
93
|
case _KeyCode2['default'].ENTER:
|
@@ -114,7 +114,7 @@ var MonthCalendar = function (_React$Component) {
|
|
114
114
|
|
115
115
|
_this.state = {
|
116
116
|
mode: 'month',
|
117
|
-
value: props.value || props.defaultValue || (0,
|
117
|
+
value: props.value || props.defaultValue || (0, _dayjs2['default'])(),
|
118
118
|
selectedValue: props.selectedValue || props.defaultSelectedValue
|
119
119
|
};
|
120
120
|
return _this;
|
package/lib/RangeCalendar.js
CHANGED
@@ -26,9 +26,9 @@ var _propTypes = require('prop-types');
|
|
26
26
|
|
27
27
|
var _propTypes2 = _interopRequireDefault(_propTypes);
|
28
28
|
|
29
|
-
var
|
29
|
+
var _dayjs = require('dayjs');
|
30
30
|
|
31
|
-
var
|
31
|
+
var _dayjs2 = _interopRequireDefault(_dayjs);
|
32
32
|
|
33
33
|
var _classnames2 = require('classnames');
|
34
34
|
|
@@ -103,7 +103,7 @@ function normalizeAnchor(props, init) {
|
|
103
103
|
var selectedValue = props.selectedValue || init && props.defaultSelectedValue;
|
104
104
|
var value = props.value || init && props.defaultValue;
|
105
105
|
var normalizedValue = value ? getValueFromSelectedValue(value) : getValueFromSelectedValue(selectedValue);
|
106
|
-
return !isEmptyArray(normalizedValue) ? normalizedValue : init && [(0,
|
106
|
+
return !isEmptyArray(normalizedValue) ? normalizedValue : init && [(0, _dayjs2['default'])(), (0, _dayjs2['default'])().add(1, 'months')];
|
107
107
|
}
|
108
108
|
|
109
109
|
function generateOptions(length, extraOptionGen) {
|
@@ -462,7 +462,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
462
462
|
var nextHoverValue = void 0;
|
463
463
|
|
464
464
|
if (!firstSelectedValue) {
|
465
|
-
currentHoverTime = hoverValue[0] || selectedValue[0] || value[0] || (0,
|
465
|
+
currentHoverTime = hoverValue[0] || selectedValue[0] || value[0] || (0, _dayjs2['default'])();
|
466
466
|
nextHoverTime = func(currentHoverTime);
|
467
467
|
nextHoverValue = [nextHoverTime];
|
468
468
|
_this2.fireHoverValueChange(nextHoverValue);
|
@@ -852,7 +852,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
852
852
|
|
853
853
|
// 尚未选择过时间,直接输入的话
|
854
854
|
if (!_this2.state.selectedValue[0] || !_this2.state.selectedValue[1]) {
|
855
|
-
var startValue = selectedValue[0] || (0,
|
855
|
+
var startValue = selectedValue[0] || (0, _dayjs2['default'])();
|
856
856
|
var endValue = selectedValue[1] || startValue.clone().add(1, 'months');
|
857
857
|
_this2.setState({
|
858
858
|
selectedValue: selectedValue,
|
@@ -42,13 +42,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'd
|
|
42
42
|
|
43
43
|
function goMonth(direction) {
|
44
44
|
var next = this.props.value.clone();
|
45
|
-
next.add(direction, 'months');
|
45
|
+
next = next.add(direction, 'months');
|
46
46
|
this.props.onValueChange(next);
|
47
47
|
}
|
48
48
|
|
49
49
|
function goYear(direction) {
|
50
50
|
var next = this.props.value.clone();
|
51
|
-
next.add(direction, 'years');
|
51
|
+
next = next.add(direction, 'years');
|
52
52
|
this.props.onValueChange(next);
|
53
53
|
}
|
54
54
|
|
@@ -22,9 +22,9 @@ var _propTypes = require('prop-types');
|
|
22
22
|
|
23
23
|
var _propTypes2 = _interopRequireDefault(_propTypes);
|
24
24
|
|
25
|
-
var
|
25
|
+
var _dayjs = require('dayjs');
|
26
26
|
|
27
|
-
var
|
27
|
+
var _dayjs2 = _interopRequireDefault(_dayjs);
|
28
28
|
|
29
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
30
30
|
|
@@ -44,6 +44,17 @@ var CalendarRightPanel = function (_React$Component) {
|
|
44
44
|
_this.props.onClickRightPanelTime();
|
45
45
|
};
|
46
46
|
|
47
|
+
_this.getTimes = function () {
|
48
|
+
var times = [];
|
49
|
+
for (var i = 0; i < 24; i++) {
|
50
|
+
var str = (String(i) + ':00').padStart(5, '0');
|
51
|
+
var str1 = (String(i) + ':30').padStart(5, '0');
|
52
|
+
times.push(str);
|
53
|
+
times.push(str1);
|
54
|
+
}
|
55
|
+
return times;
|
56
|
+
};
|
57
|
+
|
47
58
|
_this.scrollUp = function () {
|
48
59
|
_this.timeRef.current.scrollBy(0, -200);
|
49
60
|
};
|
@@ -56,12 +67,18 @@ var CalendarRightPanel = function (_React$Component) {
|
|
56
67
|
highlightTime: _this.props.value || null
|
57
68
|
};
|
58
69
|
_this.timeRef = _react2['default'].createRef();
|
70
|
+
_this.times = _this.getTimes();
|
59
71
|
return _this;
|
60
72
|
}
|
61
73
|
|
62
74
|
CalendarRightPanel.prototype.componentDidMount = function componentDidMount() {
|
63
|
-
|
64
|
-
|
75
|
+
var defaultMinutesTime = this.props.defaultMinutesTime;
|
76
|
+
|
77
|
+
var showTimeIndex = this.times.findIndex(function (item) {
|
78
|
+
return item === defaultMinutesTime;
|
79
|
+
});
|
80
|
+
var scrollTimeIndex = showTimeIndex > -1 ? showTimeIndex : 16;
|
81
|
+
this.timeRef.current.scrollTo(0, 34 * scrollTimeIndex);
|
65
82
|
};
|
66
83
|
|
67
84
|
CalendarRightPanel.prototype.render = function render() {
|
@@ -73,13 +90,6 @@ var CalendarRightPanel = function (_React$Component) {
|
|
73
90
|
locale = _props.locale;
|
74
91
|
|
75
92
|
var selectedDate = value.format().slice(0, 10);
|
76
|
-
var times = [];
|
77
|
-
for (var i = 0; i < 24; i++) {
|
78
|
-
var str = (String(i) + ':00').padStart(5, '0');
|
79
|
-
var str1 = (String(i) + ':30').padStart(5, '0');
|
80
|
-
times.push(str);
|
81
|
-
times.push(str1);
|
82
|
-
}
|
83
93
|
var highlight = this.state.highlightTime;
|
84
94
|
var highlightTime = highlight ? highlight.format().slice(11, 16) : null;
|
85
95
|
var isZhcn = locale && locale.today === '今天';
|
@@ -97,8 +107,8 @@ var CalendarRightPanel = function (_React$Component) {
|
|
97
107
|
_react2['default'].createElement(
|
98
108
|
'ul',
|
99
109
|
null,
|
100
|
-
times.map(function (time) {
|
101
|
-
var current = (0,
|
110
|
+
this.times.map(function (time) {
|
111
|
+
var current = (0, _dayjs2['default'])(selectedDate + ' ' + time);
|
102
112
|
current = isZhcn ? current.locale('zh-cn') : current.locale('en-gb');
|
103
113
|
return _react2['default'].createElement(
|
104
114
|
'li',
|
@@ -128,7 +138,8 @@ CalendarRightPanel.propTypes = {
|
|
128
138
|
value: _propTypes2['default'].object,
|
129
139
|
onSelect: _propTypes2['default'].func,
|
130
140
|
onClickRightPanelTime: _propTypes2['default'].func,
|
131
|
-
locale: _propTypes2['default'].object
|
141
|
+
locale: _propTypes2['default'].object,
|
142
|
+
defaultMinutesTime: _propTypes2['default'].string
|
132
143
|
};
|
133
144
|
exports['default'] = CalendarRightPanel;
|
134
145
|
module.exports = exports['default'];
|
package/lib/date/DateInput.js
CHANGED
@@ -32,9 +32,9 @@ var _KeyCode2 = _interopRequireDefault(_KeyCode);
|
|
32
32
|
|
33
33
|
var _reactLifecyclesCompat = require('react-lifecycles-compat');
|
34
34
|
|
35
|
-
var
|
35
|
+
var _dayjs = require('dayjs');
|
36
36
|
|
37
|
-
var
|
37
|
+
var _dayjs2 = _interopRequireDefault(_dayjs);
|
38
38
|
|
39
39
|
var _util = require('../util');
|
40
40
|
|
@@ -186,7 +186,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
186
186
|
}
|
187
187
|
|
188
188
|
// 不合法直接退出
|
189
|
-
var parsed = (0,
|
189
|
+
var parsed = (0, _dayjs2['default'])(str, format, true);
|
190
190
|
if (!parsed.isValid()) {
|
191
191
|
_this2.setState({
|
192
192
|
invalid: true,
|
@@ -196,7 +196,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
196
196
|
}
|
197
197
|
|
198
198
|
var value = _this2.props.value.clone();
|
199
|
-
value.year(parsed.year()).month(parsed.month()).date(parsed.date()).hour(parsed.hour()).minute(parsed.minute()).second(parsed.second());
|
199
|
+
value = value.year(parsed.year()).month(parsed.month()).date(parsed.date()).hour(parsed.hour()).minute(parsed.minute()).second(parsed.second());
|
200
200
|
|
201
201
|
if (!value || disabledDate && disabledDate(value)) {
|
202
202
|
_this2.setState({
|
package/lib/date/DateTBody.js
CHANGED
@@ -96,7 +96,7 @@ var DateTBody = function (_React$Component) {
|
|
96
96
|
var lastDisableClass = prefixCls + '-disabled-cell-last-of-row';
|
97
97
|
var lastDayOfMonthClass = prefixCls + '-last-day-of-month';
|
98
98
|
var month1 = value.clone();
|
99
|
-
month1.date(1);
|
99
|
+
month1 = month1.date(1);
|
100
100
|
var day = month1.day();
|
101
101
|
// const firstDayOfWeek = value.localeData().firstDayOfWeek();
|
102
102
|
// We set Sunday(7) as the first day of the week in seafile-calendar.
|
@@ -104,7 +104,7 @@ var DateTBody = function (_React$Component) {
|
|
104
104
|
var lastMonthDiffDay = (day + 7 - firstDayOfWeek) % 7;
|
105
105
|
// calculate last month
|
106
106
|
var lastMonth1 = month1.clone();
|
107
|
-
lastMonth1.add(0 - lastMonthDiffDay, 'days');
|
107
|
+
lastMonth1 = lastMonth1.add(0 - lastMonthDiffDay, 'days');
|
108
108
|
var passed = 0;
|
109
109
|
|
110
110
|
for (iIndex = 0; iIndex < _DateConstants2['default'].DATE_ROW_COUNT; iIndex++) {
|
@@ -112,7 +112,7 @@ var DateTBody = function (_React$Component) {
|
|
112
112
|
current = lastMonth1;
|
113
113
|
if (passed) {
|
114
114
|
current = current.clone();
|
115
|
-
current.add(passed, 'days');
|
115
|
+
current = current.add(passed, 'days');
|
116
116
|
}
|
117
117
|
dateTable.push(current);
|
118
118
|
passed++;
|
package/lib/date/DateTHead.js
CHANGED
@@ -1,39 +1,31 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
|
5
|
-
var _classCallCheck2 = require(
|
5
|
+
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
6
6
|
|
7
7
|
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
8
8
|
|
9
|
-
var _possibleConstructorReturn2 = require(
|
9
|
+
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
|
10
10
|
|
11
11
|
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
12
12
|
|
13
|
-
var _inherits2 = require(
|
13
|
+
var _inherits2 = require("babel-runtime/helpers/inherits");
|
14
14
|
|
15
15
|
var _inherits3 = _interopRequireDefault(_inherits2);
|
16
16
|
|
17
|
-
var _react = require(
|
17
|
+
var _react = require("react");
|
18
18
|
|
19
19
|
var _react2 = _interopRequireDefault(_react);
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
var _DateConstants2 = _interopRequireDefault(_DateConstants);
|
24
|
-
|
25
|
-
var _moment = require('moment');
|
26
|
-
|
27
|
-
var _moment2 = _interopRequireDefault(_moment);
|
28
|
-
|
29
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
30
22
|
|
31
23
|
var DateTHead = function (_React$Component) {
|
32
|
-
(0, _inherits3[
|
24
|
+
(0, _inherits3["default"])(DateTHead, _React$Component);
|
33
25
|
|
34
26
|
function DateTHead() {
|
35
|
-
(0, _classCallCheck3[
|
36
|
-
return (0, _possibleConstructorReturn3[
|
27
|
+
(0, _classCallCheck3["default"])(this, DateTHead);
|
28
|
+
return (0, _possibleConstructorReturn3["default"])(this, _React$Component.apply(this, arguments));
|
37
29
|
}
|
38
30
|
|
39
31
|
DateTHead.prototype.render = function render() {
|
@@ -41,56 +33,55 @@ var DateTHead = function (_React$Component) {
|
|
41
33
|
var value = props.value;
|
42
34
|
var localeData = value.localeData();
|
43
35
|
var prefixCls = props.prefixCls;
|
44
|
-
|
45
|
-
|
36
|
+
// const veryShortWeekdays = [];
|
37
|
+
// const weekDays = [];
|
46
38
|
// const firstDayOfWeek = localeData.firstDayOfWeek();
|
47
39
|
// We set Sunday(7) as the first day of the week in seafile-calendar.
|
48
|
-
var firstDayOfWeek = 7;
|
49
40
|
var showWeekNumberEl = void 0;
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
41
|
+
// for (let dateColIndex = 0; dateColIndex < DateConstants.DATE_COL_COUNT; dateColIndex++) {
|
42
|
+
// const index = (firstDayOfWeek + dateColIndex) % DateConstants.DATE_COL_COUNT;
|
43
|
+
// now.day(index);
|
44
|
+
// veryShortWeekdays[dateColIndex] = localeData.weekdaysMin();
|
45
|
+
// weekDays[dateColIndex] = localeData.weekdaysShort();
|
46
|
+
// }
|
47
|
+
var veryShortWeekdays = localeData.weekdaysMin();
|
48
|
+
var weekDays = localeData.weekdaysShort();
|
58
49
|
if (props.showWeekNumber) {
|
59
|
-
showWeekNumberEl = _react2[
|
60
|
-
|
50
|
+
showWeekNumberEl = _react2["default"].createElement(
|
51
|
+
"th",
|
61
52
|
{
|
62
|
-
role:
|
63
|
-
className: prefixCls +
|
53
|
+
role: "columnheader",
|
54
|
+
className: prefixCls + "-column-header " + prefixCls + "-week-number-header"
|
64
55
|
},
|
65
|
-
_react2[
|
66
|
-
|
67
|
-
{ className: prefixCls +
|
68
|
-
|
56
|
+
_react2["default"].createElement(
|
57
|
+
"span",
|
58
|
+
{ className: prefixCls + "-column-header-inner" },
|
59
|
+
"x"
|
69
60
|
)
|
70
61
|
);
|
71
62
|
}
|
72
63
|
var weekDaysEls = weekDays.map(function (day, xindex) {
|
73
|
-
return _react2[
|
74
|
-
|
64
|
+
return _react2["default"].createElement(
|
65
|
+
"th",
|
75
66
|
{
|
76
67
|
key: xindex,
|
77
|
-
role:
|
68
|
+
role: "columnheader",
|
78
69
|
title: day,
|
79
|
-
className: prefixCls +
|
70
|
+
className: prefixCls + "-column-header"
|
80
71
|
},
|
81
|
-
_react2[
|
82
|
-
|
83
|
-
{ className: prefixCls +
|
72
|
+
_react2["default"].createElement(
|
73
|
+
"span",
|
74
|
+
{ className: prefixCls + "-column-header-inner" },
|
84
75
|
veryShortWeekdays[xindex]
|
85
76
|
)
|
86
77
|
);
|
87
78
|
});
|
88
|
-
return _react2[
|
89
|
-
|
79
|
+
return _react2["default"].createElement(
|
80
|
+
"thead",
|
90
81
|
null,
|
91
|
-
_react2[
|
92
|
-
|
93
|
-
{ role:
|
82
|
+
_react2["default"].createElement(
|
83
|
+
"tr",
|
84
|
+
{ role: "row" },
|
94
85
|
showWeekNumberEl,
|
95
86
|
weekDaysEls
|
96
87
|
)
|
@@ -98,7 +89,7 @@ var DateTHead = function (_React$Component) {
|
|
98
89
|
};
|
99
90
|
|
100
91
|
return DateTHead;
|
101
|
-
}(_react2[
|
92
|
+
}(_react2["default"].Component);
|
102
93
|
|
103
|
-
exports[
|
94
|
+
exports["default"] = DateTHead;
|
104
95
|
module.exports = exports['default'];
|
@@ -34,7 +34,7 @@ var COL = 3;
|
|
34
34
|
|
35
35
|
function goYear(direction) {
|
36
36
|
var next = this.state.value.clone();
|
37
|
-
next.add(direction, 'years');
|
37
|
+
next = next.add(direction, 'years');
|
38
38
|
this.setState({
|
39
39
|
value: next
|
40
40
|
});
|
@@ -42,8 +42,8 @@ function goYear(direction) {
|
|
42
42
|
|
43
43
|
function chooseDecade(year, event) {
|
44
44
|
var next = this.state.value.clone();
|
45
|
-
next.year(year);
|
46
|
-
next.month(this.state.value.month());
|
45
|
+
next = next.year(year);
|
46
|
+
next = next.month(this.state.value.month());
|
47
47
|
this.props.onSelect(next);
|
48
48
|
event.preventDefault();
|
49
49
|
}
|
@@ -38,13 +38,13 @@ var CalendarHeader = function (_Component) {
|
|
38
38
|
|
39
39
|
CalendarHeader.prototype.onYearChange = function onYearChange(year) {
|
40
40
|
var newValue = this.props.value.clone();
|
41
|
-
newValue.year(parseInt(year, 10));
|
41
|
+
newValue = newValue.year(parseInt(year, 10));
|
42
42
|
this.props.onValueChange(newValue);
|
43
43
|
};
|
44
44
|
|
45
45
|
CalendarHeader.prototype.onMonthChange = function onMonthChange(month) {
|
46
46
|
var newValue = this.props.value.clone();
|
47
|
-
newValue.month(parseInt(month, 10));
|
47
|
+
newValue = newValue.month(parseInt(month, 10));
|
48
48
|
this.props.onValueChange(newValue);
|
49
49
|
};
|
50
50
|
|
@@ -90,7 +90,7 @@ var CalendarHeader = function (_Component) {
|
|
90
90
|
var Select = props.Select;
|
91
91
|
|
92
92
|
for (var index = 0; index < 12; index++) {
|
93
|
-
t.month(index);
|
93
|
+
t = t.month(index);
|
94
94
|
options.push(_react2['default'].createElement(
|
95
95
|
Select.Option,
|
96
96
|
{ key: '' + index },
|
@@ -29,9 +29,9 @@ var _classnames = require('classnames');
|
|
29
29
|
|
30
30
|
var _classnames2 = _interopRequireDefault(_classnames);
|
31
31
|
|
32
|
-
var
|
32
|
+
var _dayjs = require('dayjs');
|
33
33
|
|
34
|
-
var
|
34
|
+
var _dayjs2 = _interopRequireDefault(_dayjs);
|
35
35
|
|
36
36
|
var _index = require('../util/index');
|
37
37
|
|
@@ -44,7 +44,7 @@ function getNowByCurrentStateValue(value) {
|
|
44
44
|
if (value) {
|
45
45
|
ret = (0, _index.getTodayTime)(value);
|
46
46
|
} else {
|
47
|
-
ret = (0,
|
47
|
+
ret = (0, _dayjs2['default'])();
|
48
48
|
}
|
49
49
|
return ret;
|
50
50
|
}
|
package/lib/month/MonthTable.js
CHANGED
@@ -35,7 +35,7 @@ var COL = 3;
|
|
35
35
|
|
36
36
|
function chooseMonth(month) {
|
37
37
|
var next = this.state.value.clone();
|
38
|
-
next.month(month);
|
38
|
+
next = next.month(month);
|
39
39
|
this.setAndSelectValue(next);
|
40
40
|
}
|
41
41
|
|
@@ -78,7 +78,7 @@ var MonthTable = function (_Component) {
|
|
78
78
|
for (var rowIndex = 0; rowIndex < ROW; rowIndex++) {
|
79
79
|
months[rowIndex] = [];
|
80
80
|
for (var colIndex = 0; colIndex < COL; colIndex++) {
|
81
|
-
current.month(index);
|
81
|
+
current = current.month(index);
|
82
82
|
var content = (0, _index.getMonthName)(current);
|
83
83
|
months[rowIndex][colIndex] = {
|
84
84
|
value: index,
|
@@ -111,20 +111,20 @@ var MonthTable = function (_Component) {
|
|
111
111
|
var disabled = false;
|
112
112
|
if (props.disabledDate) {
|
113
113
|
var testValue = value.clone();
|
114
|
-
testValue.month(monthData.value);
|
114
|
+
testValue = testValue.month(monthData.value);
|
115
115
|
disabled = props.disabledDate(testValue);
|
116
116
|
}
|
117
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
118
|
var cellEl = void 0;
|
119
119
|
if (cellRender) {
|
120
120
|
var currentValue = value.clone();
|
121
|
-
currentValue.month(monthData.value);
|
121
|
+
currentValue = currentValue.month(monthData.value);
|
122
122
|
cellEl = cellRender(currentValue, locale);
|
123
123
|
} else {
|
124
124
|
var content = void 0;
|
125
125
|
if (contentRender) {
|
126
126
|
var _currentValue = value.clone();
|
127
|
-
_currentValue.month(monthData.value);
|
127
|
+
_currentValue = _currentValue.month(monthData.value);
|
128
128
|
content = contentRender(_currentValue, locale);
|
129
129
|
} else {
|
130
130
|
content = monthData.content;
|
package/lib/util/index.js
CHANGED
@@ -17,12 +17,18 @@ exports.isTimeValid = isTimeValid;
|
|
17
17
|
exports.isAllowedDate = isAllowedDate;
|
18
18
|
exports.formatDate = formatDate;
|
19
19
|
|
20
|
-
var
|
20
|
+
var _dayjs = require('dayjs');
|
21
21
|
|
22
|
-
var
|
22
|
+
var _dayjs2 = _interopRequireDefault(_dayjs);
|
23
|
+
|
24
|
+
var _utc = require('dayjs/plugin/utc');
|
25
|
+
|
26
|
+
var _utc2 = _interopRequireDefault(_utc);
|
23
27
|
|
24
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
25
29
|
|
30
|
+
_dayjs2['default'].extend(_utc2['default']);
|
31
|
+
|
26
32
|
var defaultDisabledTime = {
|
27
33
|
disabledHours: function disabledHours() {
|
28
34
|
return [];
|
@@ -36,8 +42,8 @@ var defaultDisabledTime = {
|
|
36
42
|
};
|
37
43
|
|
38
44
|
function getTodayTime(value) {
|
39
|
-
var today = (0,
|
40
|
-
today.locale(value.locale()).utcOffset(value.utcOffset());
|
45
|
+
var today = (0, _dayjs2['default'])();
|
46
|
+
today = today.locale(value.locale()).utcOffset(value.utcOffset());
|
41
47
|
return today;
|
42
48
|
}
|
43
49
|
|
@@ -57,11 +63,11 @@ function getMonthName(month) {
|
|
57
63
|
}
|
58
64
|
|
59
65
|
function syncTime(from, to) {
|
60
|
-
if (!
|
61
|
-
to.hour(from.hour());
|
62
|
-
to.minute(from.minute());
|
63
|
-
to.second(from.second());
|
64
|
-
to.millisecond(from.millisecond());
|
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());
|
65
71
|
}
|
66
72
|
|
67
73
|
function getTimeConfig(value, disabledTime) {
|
package/lib/year/YearPanel.js
CHANGED
@@ -33,7 +33,7 @@ var COL = 3;
|
|
33
33
|
|
34
34
|
function goYear(direction) {
|
35
35
|
var value = this.state.value.clone();
|
36
|
-
value.add(direction, 'year');
|
36
|
+
value = value.add(direction, 'year');
|
37
37
|
this.setState({
|
38
38
|
value: value
|
39
39
|
});
|
@@ -41,8 +41,8 @@ function goYear(direction) {
|
|
41
41
|
|
42
42
|
function chooseYear(year) {
|
43
43
|
var value = this.state.value.clone();
|
44
|
-
value.year(year);
|
45
|
-
value.month(this.state.value.month());
|
44
|
+
value = value.year(year);
|
45
|
+
value = value.month(this.state.value.month());
|
46
46
|
this.setState({
|
47
47
|
value: value
|
48
48
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@seafile/seafile-calendar",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.17beta",
|
4
4
|
"description": "React Calendar",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -91,7 +91,7 @@
|
|
91
91
|
"dependencies": {
|
92
92
|
"babel-runtime": "6.x",
|
93
93
|
"classnames": "2.x",
|
94
|
-
"
|
94
|
+
"dayjs": "1.10.7",
|
95
95
|
"prop-types": "^15.5.8",
|
96
96
|
"rc-trigger": "^2.2.0",
|
97
97
|
"rc-util": "^4.1.1",
|