@seafile/seafile-calendar 0.0.29-alpha15 → 0.0.29-alpha19
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 +1177 -0
- package/dist/rc-calendar.js +1 -0
- package/dist/rc-calendar.js.map +1 -1
- package/dist/rc-calendar.min.js +1 -1
- package/es/Calendar.js +445 -0
- package/es/FullCalendar.js +182 -0
- package/es/MonthCalendar.js +135 -0
- package/es/Picker.js +246 -0
- package/es/RangeCalendar.js +876 -0
- package/es/calendar/CalendarFooter.js +93 -0
- package/es/calendar/CalendarHeader.js +257 -0
- package/es/calendar/CalendarRightPanel.js +135 -0
- package/es/calendar/OkButton.js +22 -0
- package/es/calendar/TimePickerButton.js +28 -0
- package/es/calendar/TodayButton.js +28 -0
- package/es/date/DateConstants.js +19 -0
- package/es/date/DateInput.js +249 -0
- package/es/date/DateTBody.js +280 -0
- package/es/date/DateTHead.js +86 -0
- package/es/date/DateTable.js +32 -0
- package/es/decade/DecadePanel.js +181 -0
- package/es/full-calendar/CalendarHeader.js +180 -0
- package/es/index.js +3 -0
- package/es/locale/ar_EG.js +27 -0
- package/es/locale/bg_BG.js +27 -0
- package/es/locale/ca_ES.js +27 -0
- package/es/locale/cs_CZ.js +27 -0
- package/es/locale/da_DK.js +27 -0
- package/es/locale/de_DE.js +27 -0
- package/es/locale/el_GR.js +27 -0
- package/es/locale/en_GB.js +27 -0
- package/es/locale/en_US.js +28 -0
- package/es/locale/es_ES.js +27 -0
- package/es/locale/et_EE.js +27 -0
- package/es/locale/fa_IR.js +27 -0
- package/es/locale/fi_FI.js +27 -0
- package/es/locale/fr_BE.js +27 -0
- package/es/locale/fr_FR.js +27 -0
- package/es/locale/he_IL.js +28 -0
- package/es/locale/hi_IN.js +28 -0
- package/es/locale/hr_HR.js +28 -0
- package/es/locale/hu_HU.js +27 -0
- package/es/locale/id_ID.js +28 -0
- package/es/locale/is_IS.js +27 -0
- package/es/locale/it_IT.js +27 -0
- package/es/locale/ja_JP.js +26 -0
- package/es/locale/kn_IN.js +28 -0
- package/es/locale/ko_KR.js +27 -0
- package/es/locale/ku_IQ.js +27 -0
- package/es/locale/lv_LV.js +27 -0
- package/es/locale/mm_MM.js +28 -0
- package/es/locale/mn_MN.js +28 -0
- package/es/locale/ms_MY.js +27 -0
- package/es/locale/nb_NO.js +27 -0
- package/es/locale/nl_BE.js +27 -0
- package/es/locale/nl_NL.js +27 -0
- package/es/locale/pl_PL.js +27 -0
- package/es/locale/pt_BR.js +27 -0
- package/es/locale/pt_PT.js +27 -0
- package/es/locale/ro_RO.js +28 -0
- package/es/locale/ru_RU.js +27 -0
- package/es/locale/sk_SK.js +27 -0
- package/es/locale/sl_SI.js +27 -0
- package/es/locale/sr_RS.js +27 -0
- package/es/locale/sv_SE.js +27 -0
- package/es/locale/ta_IN.js +28 -0
- package/es/locale/th_TH.js +27 -0
- package/es/locale/tr_TR.js +27 -0
- package/es/locale/ug_CN.js +26 -0
- package/es/locale/uk_UA.js +27 -0
- package/es/locale/vi_VN.js +28 -0
- package/es/locale/zh_CN.js +27 -0
- package/es/locale/zh_TW.js +26 -0
- package/es/mixin/CalendarMixin.js +123 -0
- package/es/mixin/CommonMixin.js +85 -0
- package/es/month/MonthPanel.js +154 -0
- package/es/month/MonthTable.js +156 -0
- package/es/picker/placements.js +35 -0
- package/es/range-calendar/CalendarPart.js +151 -0
- package/es/util/dayjs.js +17 -0
- package/es/util/index.js +564 -0
- package/es/util/toTime.js +21 -0
- package/es/year/YearPanel.js +194 -0
- package/lib/Calendar.js +508 -0
- package/lib/FullCalendar.js +221 -0
- package/lib/MonthCalendar.js +172 -0
- package/lib/Picker.js +283 -0
- package/lib/RangeCalendar.js +925 -0
- package/lib/calendar/CalendarFooter.js +134 -0
- package/lib/calendar/CalendarHeader.js +290 -0
- package/lib/calendar/CalendarRightPanel.js +160 -0
- package/lib/calendar/OkButton.js +32 -0
- package/lib/calendar/TimePickerButton.js +41 -0
- package/lib/calendar/TodayButton.js +39 -0
- package/lib/date/DateConstants.js +23 -0
- package/lib/date/DateInput.js +281 -0
- package/lib/date/DateTBody.js +307 -0
- package/lib/date/DateTHead.js +106 -0
- package/lib/date/DateTable.js +54 -0
- package/lib/decade/DecadePanel.js +207 -0
- package/lib/full-calendar/CalendarHeader.js +201 -0
- package/lib/index.js +12 -0
- package/lib/locale/ar_EG.js +31 -0
- package/lib/locale/bg_BG.js +31 -0
- package/lib/locale/ca_ES.js +31 -0
- package/lib/locale/cs_CZ.js +31 -0
- package/lib/locale/da_DK.js +31 -0
- package/lib/locale/de_DE.js +31 -0
- package/lib/locale/el_GR.js +31 -0
- package/lib/locale/en_GB.js +31 -0
- package/lib/locale/en_US.js +32 -0
- package/lib/locale/es_ES.js +31 -0
- package/lib/locale/et_EE.js +31 -0
- package/lib/locale/fa_IR.js +31 -0
- package/lib/locale/fi_FI.js +31 -0
- package/lib/locale/fr_BE.js +31 -0
- package/lib/locale/fr_FR.js +31 -0
- package/lib/locale/he_IL.js +32 -0
- package/lib/locale/hi_IN.js +32 -0
- package/lib/locale/hr_HR.js +32 -0
- package/lib/locale/hu_HU.js +31 -0
- package/lib/locale/id_ID.js +32 -0
- package/lib/locale/is_IS.js +31 -0
- package/lib/locale/it_IT.js +31 -0
- package/lib/locale/ja_JP.js +30 -0
- package/lib/locale/kn_IN.js +32 -0
- package/lib/locale/ko_KR.js +31 -0
- package/lib/locale/ku_IQ.js +31 -0
- package/lib/locale/lv_LV.js +31 -0
- package/lib/locale/mm_MM.js +32 -0
- package/lib/locale/mn_MN.js +32 -0
- package/lib/locale/ms_MY.js +31 -0
- package/lib/locale/nb_NO.js +31 -0
- package/lib/locale/nl_BE.js +31 -0
- package/lib/locale/nl_NL.js +31 -0
- package/lib/locale/pl_PL.js +31 -0
- package/lib/locale/pt_BR.js +31 -0
- package/lib/locale/pt_PT.js +31 -0
- package/lib/locale/ro_RO.js +32 -0
- package/lib/locale/ru_RU.js +31 -0
- package/lib/locale/sk_SK.js +31 -0
- package/lib/locale/sl_SI.js +31 -0
- package/lib/locale/sr_RS.js +31 -0
- package/lib/locale/sv_SE.js +31 -0
- package/lib/locale/ta_IN.js +32 -0
- package/lib/locale/th_TH.js +31 -0
- package/lib/locale/tr_TR.js +31 -0
- package/lib/locale/ug_CN.js +30 -0
- package/lib/locale/uk_UA.js +31 -0
- package/lib/locale/vi_VN.js +32 -0
- package/lib/locale/zh_CN.js +31 -0
- package/lib/locale/zh_TW.js +30 -0
- package/lib/mixin/CalendarMixin.js +153 -0
- package/lib/mixin/CommonMixin.js +106 -0
- package/lib/month/MonthPanel.js +179 -0
- package/lib/month/MonthTable.js +181 -0
- package/lib/picker/placements.js +39 -0
- package/lib/range-calendar/CalendarPart.js +184 -0
- package/lib/util/dayjs.js +46 -0
- package/lib/util/index.js +601 -0
- package/lib/util/toTime.js +28 -0
- package/lib/year/YearPanel.js +219 -0
- package/package.json +1 -1
@@ -0,0 +1,154 @@
|
|
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;
|
@@ -0,0 +1,156 @@
|
|
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;
|
@@ -0,0 +1,35 @@
|
|
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;
|
@@ -0,0 +1,151 @@
|
|
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
ADDED
@@ -0,0 +1,17 @@
|
|
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;
|