@seafile/seafile-calendar 0.0.29-alpha.2 → 0.0.29-alpha10
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.css +1179 -0
- package/dist/rc-calendar.css.map +1 -0
- package/dist/rc-calendar.js +7588 -0
- package/dist/rc-calendar.js.map +1 -0
- package/dist/rc-calendar.min.css +1179 -0
- package/dist/rc-calendar.min.css.map +1 -0
- package/dist/rc-calendar.min.js +1 -0
- package/es/Calendar.js +444 -0
- package/es/FullCalendar.js +182 -0
- package/es/MonthCalendar.js +135 -0
- package/es/Picker.js +245 -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 +507 -0
- package/lib/FullCalendar.js +221 -0
- package/lib/MonthCalendar.js +172 -0
- package/lib/Picker.js +282 -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,219 @@
|
|
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
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
30
|
+
|
31
|
+
var ROW = 4;
|
32
|
+
var COL = 3;
|
33
|
+
|
34
|
+
function goYear(direction) {
|
35
|
+
var value = this.state.value.clone();
|
36
|
+
value = value.add(direction, 'year');
|
37
|
+
this.setState({
|
38
|
+
value: value
|
39
|
+
});
|
40
|
+
}
|
41
|
+
|
42
|
+
function chooseYear(year) {
|
43
|
+
var value = this.state.value.clone();
|
44
|
+
value = value.year(year);
|
45
|
+
value = value.month(this.state.value.month());
|
46
|
+
this.setState({
|
47
|
+
value: value
|
48
|
+
});
|
49
|
+
this.props.onSelect(value);
|
50
|
+
}
|
51
|
+
|
52
|
+
var YearPanel = function (_React$Component) {
|
53
|
+
(0, _inherits3['default'])(YearPanel, _React$Component);
|
54
|
+
|
55
|
+
function YearPanel(props) {
|
56
|
+
(0, _classCallCheck3['default'])(this, YearPanel);
|
57
|
+
|
58
|
+
var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
|
59
|
+
|
60
|
+
_this.prefixCls = props.rootPrefixCls + '-year-panel';
|
61
|
+
_this.state = {
|
62
|
+
value: props.value || props.defaultValue
|
63
|
+
};
|
64
|
+
_this.nextDecade = goYear.bind(_this, 10);
|
65
|
+
_this.previousDecade = goYear.bind(_this, -10);
|
66
|
+
return _this;
|
67
|
+
}
|
68
|
+
|
69
|
+
YearPanel.prototype.years = function years() {
|
70
|
+
var value = this.state.value;
|
71
|
+
var currentYear = value.year();
|
72
|
+
var startYear = parseInt(currentYear / 10, 10) * 10;
|
73
|
+
var previousYear = startYear - 1;
|
74
|
+
var years = [];
|
75
|
+
var index = 0;
|
76
|
+
for (var rowIndex = 0; rowIndex < ROW; rowIndex++) {
|
77
|
+
years[rowIndex] = [];
|
78
|
+
for (var colIndex = 0; colIndex < COL; colIndex++) {
|
79
|
+
var year = previousYear + index;
|
80
|
+
var content = String(year);
|
81
|
+
years[rowIndex][colIndex] = {
|
82
|
+
content: content,
|
83
|
+
year: year,
|
84
|
+
title: content
|
85
|
+
};
|
86
|
+
index++;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
return years;
|
90
|
+
};
|
91
|
+
|
92
|
+
YearPanel.prototype.render = function render() {
|
93
|
+
var _this2 = this;
|
94
|
+
|
95
|
+
var props = this.props;
|
96
|
+
var value = this.state.value;
|
97
|
+
var locale = props.locale,
|
98
|
+
renderFooter = props.renderFooter;
|
99
|
+
|
100
|
+
var years = this.years();
|
101
|
+
var currentYear = value.year();
|
102
|
+
var startYear = parseInt(currentYear / 10, 10) * 10;
|
103
|
+
var endYear = startYear + 9;
|
104
|
+
var prefixCls = this.prefixCls;
|
105
|
+
|
106
|
+
var yeasEls = years.map(function (row, index) {
|
107
|
+
var tds = row.map(function (yearData) {
|
108
|
+
var _classNameMap;
|
109
|
+
|
110
|
+
var classNameMap = (_classNameMap = {}, _classNameMap[prefixCls + '-cell'] = 1, _classNameMap[prefixCls + '-selected-cell'] = yearData.year === currentYear, _classNameMap);
|
111
|
+
return _react2['default'].createElement(
|
112
|
+
'td',
|
113
|
+
{
|
114
|
+
role: 'gridcell',
|
115
|
+
title: yearData.title,
|
116
|
+
key: yearData.content,
|
117
|
+
onClick: chooseYear.bind(_this2, yearData.year),
|
118
|
+
className: (0, _classnames2['default'])(classNameMap)
|
119
|
+
},
|
120
|
+
_react2['default'].createElement(
|
121
|
+
'a',
|
122
|
+
{
|
123
|
+
className: prefixCls + '-year'
|
124
|
+
},
|
125
|
+
yearData.content
|
126
|
+
)
|
127
|
+
);
|
128
|
+
});
|
129
|
+
return _react2['default'].createElement(
|
130
|
+
'tr',
|
131
|
+
{ key: index, role: 'row' },
|
132
|
+
tds
|
133
|
+
);
|
134
|
+
});
|
135
|
+
|
136
|
+
var footer = renderFooter && renderFooter('year');
|
137
|
+
|
138
|
+
return _react2['default'].createElement(
|
139
|
+
'div',
|
140
|
+
{ className: this.prefixCls },
|
141
|
+
_react2['default'].createElement(
|
142
|
+
'div',
|
143
|
+
null,
|
144
|
+
_react2['default'].createElement(
|
145
|
+
'div',
|
146
|
+
{ className: prefixCls + '-header' },
|
147
|
+
_react2['default'].createElement('a', {
|
148
|
+
className: prefixCls + '-prev-decade-btn',
|
149
|
+
role: 'button',
|
150
|
+
onClick: this.previousDecade,
|
151
|
+
title: locale.previousDecade
|
152
|
+
}),
|
153
|
+
_react2['default'].createElement(
|
154
|
+
'a',
|
155
|
+
{
|
156
|
+
className: prefixCls + '-decade-select',
|
157
|
+
role: 'button',
|
158
|
+
onClick: props.onDecadePanelShow,
|
159
|
+
title: locale.decadeSelect
|
160
|
+
},
|
161
|
+
_react2['default'].createElement(
|
162
|
+
'span',
|
163
|
+
{ className: prefixCls + '-decade-select-content' },
|
164
|
+
startYear,
|
165
|
+
'-',
|
166
|
+
endYear
|
167
|
+
),
|
168
|
+
_react2['default'].createElement(
|
169
|
+
'span',
|
170
|
+
{ className: prefixCls + '-decade-select-arrow' },
|
171
|
+
'x'
|
172
|
+
)
|
173
|
+
),
|
174
|
+
_react2['default'].createElement('a', {
|
175
|
+
className: prefixCls + '-next-decade-btn',
|
176
|
+
role: 'button',
|
177
|
+
onClick: this.nextDecade,
|
178
|
+
title: locale.nextDecade
|
179
|
+
})
|
180
|
+
),
|
181
|
+
_react2['default'].createElement(
|
182
|
+
'div',
|
183
|
+
{ className: prefixCls + '-body' },
|
184
|
+
_react2['default'].createElement(
|
185
|
+
'table',
|
186
|
+
{ className: prefixCls + '-table', cellSpacing: '0', role: 'grid' },
|
187
|
+
_react2['default'].createElement(
|
188
|
+
'tbody',
|
189
|
+
{ className: prefixCls + '-tbody' },
|
190
|
+
yeasEls
|
191
|
+
)
|
192
|
+
)
|
193
|
+
),
|
194
|
+
footer && _react2['default'].createElement(
|
195
|
+
'div',
|
196
|
+
{ className: prefixCls + '-footer' },
|
197
|
+
footer
|
198
|
+
)
|
199
|
+
)
|
200
|
+
);
|
201
|
+
};
|
202
|
+
|
203
|
+
return YearPanel;
|
204
|
+
}(_react2['default'].Component);
|
205
|
+
|
206
|
+
exports['default'] = YearPanel;
|
207
|
+
|
208
|
+
|
209
|
+
YearPanel.propTypes = {
|
210
|
+
rootPrefixCls: _propTypes2['default'].string,
|
211
|
+
value: _propTypes2['default'].object,
|
212
|
+
defaultValue: _propTypes2['default'].object,
|
213
|
+
renderFooter: _propTypes2['default'].func
|
214
|
+
};
|
215
|
+
|
216
|
+
YearPanel.defaultProps = {
|
217
|
+
onSelect: function onSelect() {}
|
218
|
+
};
|
219
|
+
module.exports = exports['default'];
|