@seafile/seafile-calendar 0.0.1 → 0.0.3-Apoi0.1
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 +15 -0
- 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 +7523 -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 +443 -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 +126 -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 +210 -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 +545 -0
- package/es/util/toTime.js +21 -0
- package/es/year/YearPanel.js +194 -0
- package/index.d.ts +12 -11
- package/lib/Calendar.js +506 -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 +151 -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 +243 -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 +580 -0
- package/lib/util/toTime.js +28 -0
- package/lib/year/YearPanel.js +219 -0
- package/package.json +7 -3
- package/HISTORY.md +0 -263
@@ -0,0 +1,194 @@
|
|
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 classnames from 'classnames';
|
7
|
+
var ROW = 4;
|
8
|
+
var COL = 3;
|
9
|
+
|
10
|
+
function goYear(direction) {
|
11
|
+
var value = this.state.value.clone();
|
12
|
+
value = value.add(direction, 'year');
|
13
|
+
this.setState({
|
14
|
+
value: value
|
15
|
+
});
|
16
|
+
}
|
17
|
+
|
18
|
+
function chooseYear(year) {
|
19
|
+
var value = this.state.value.clone();
|
20
|
+
value = value.year(year);
|
21
|
+
value = value.month(this.state.value.month());
|
22
|
+
this.setState({
|
23
|
+
value: value
|
24
|
+
});
|
25
|
+
this.props.onSelect(value);
|
26
|
+
}
|
27
|
+
|
28
|
+
var YearPanel = function (_React$Component) {
|
29
|
+
_inherits(YearPanel, _React$Component);
|
30
|
+
|
31
|
+
function YearPanel(props) {
|
32
|
+
_classCallCheck(this, YearPanel);
|
33
|
+
|
34
|
+
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
35
|
+
|
36
|
+
_this.prefixCls = props.rootPrefixCls + '-year-panel';
|
37
|
+
_this.state = {
|
38
|
+
value: props.value || props.defaultValue
|
39
|
+
};
|
40
|
+
_this.nextDecade = goYear.bind(_this, 10);
|
41
|
+
_this.previousDecade = goYear.bind(_this, -10);
|
42
|
+
return _this;
|
43
|
+
}
|
44
|
+
|
45
|
+
YearPanel.prototype.years = function years() {
|
46
|
+
var value = this.state.value;
|
47
|
+
var currentYear = value.year();
|
48
|
+
var startYear = parseInt(currentYear / 10, 10) * 10;
|
49
|
+
var previousYear = startYear - 1;
|
50
|
+
var years = [];
|
51
|
+
var index = 0;
|
52
|
+
for (var rowIndex = 0; rowIndex < ROW; rowIndex++) {
|
53
|
+
years[rowIndex] = [];
|
54
|
+
for (var colIndex = 0; colIndex < COL; colIndex++) {
|
55
|
+
var year = previousYear + index;
|
56
|
+
var content = String(year);
|
57
|
+
years[rowIndex][colIndex] = {
|
58
|
+
content: content,
|
59
|
+
year: year,
|
60
|
+
title: content
|
61
|
+
};
|
62
|
+
index++;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
return years;
|
66
|
+
};
|
67
|
+
|
68
|
+
YearPanel.prototype.render = function render() {
|
69
|
+
var _this2 = this;
|
70
|
+
|
71
|
+
var props = this.props;
|
72
|
+
var value = this.state.value;
|
73
|
+
var locale = props.locale,
|
74
|
+
renderFooter = props.renderFooter;
|
75
|
+
|
76
|
+
var years = this.years();
|
77
|
+
var currentYear = value.year();
|
78
|
+
var startYear = parseInt(currentYear / 10, 10) * 10;
|
79
|
+
var endYear = startYear + 9;
|
80
|
+
var prefixCls = this.prefixCls;
|
81
|
+
|
82
|
+
var yeasEls = years.map(function (row, index) {
|
83
|
+
var tds = row.map(function (yearData) {
|
84
|
+
var _classNameMap;
|
85
|
+
|
86
|
+
var classNameMap = (_classNameMap = {}, _classNameMap[prefixCls + '-cell'] = 1, _classNameMap[prefixCls + '-selected-cell'] = yearData.year === currentYear, _classNameMap);
|
87
|
+
return React.createElement(
|
88
|
+
'td',
|
89
|
+
{
|
90
|
+
role: 'gridcell',
|
91
|
+
title: yearData.title,
|
92
|
+
key: yearData.content,
|
93
|
+
onClick: chooseYear.bind(_this2, yearData.year),
|
94
|
+
className: classnames(classNameMap)
|
95
|
+
},
|
96
|
+
React.createElement(
|
97
|
+
'a',
|
98
|
+
{
|
99
|
+
className: prefixCls + '-year'
|
100
|
+
},
|
101
|
+
yearData.content
|
102
|
+
)
|
103
|
+
);
|
104
|
+
});
|
105
|
+
return React.createElement(
|
106
|
+
'tr',
|
107
|
+
{ key: index, role: 'row' },
|
108
|
+
tds
|
109
|
+
);
|
110
|
+
});
|
111
|
+
|
112
|
+
var footer = renderFooter && renderFooter('year');
|
113
|
+
|
114
|
+
return React.createElement(
|
115
|
+
'div',
|
116
|
+
{ className: this.prefixCls },
|
117
|
+
React.createElement(
|
118
|
+
'div',
|
119
|
+
null,
|
120
|
+
React.createElement(
|
121
|
+
'div',
|
122
|
+
{ className: prefixCls + '-header' },
|
123
|
+
React.createElement('a', {
|
124
|
+
className: prefixCls + '-prev-decade-btn',
|
125
|
+
role: 'button',
|
126
|
+
onClick: this.previousDecade,
|
127
|
+
title: locale.previousDecade
|
128
|
+
}),
|
129
|
+
React.createElement(
|
130
|
+
'a',
|
131
|
+
{
|
132
|
+
className: prefixCls + '-decade-select',
|
133
|
+
role: 'button',
|
134
|
+
onClick: props.onDecadePanelShow,
|
135
|
+
title: locale.decadeSelect
|
136
|
+
},
|
137
|
+
React.createElement(
|
138
|
+
'span',
|
139
|
+
{ className: prefixCls + '-decade-select-content' },
|
140
|
+
startYear,
|
141
|
+
'-',
|
142
|
+
endYear
|
143
|
+
),
|
144
|
+
React.createElement(
|
145
|
+
'span',
|
146
|
+
{ className: prefixCls + '-decade-select-arrow' },
|
147
|
+
'x'
|
148
|
+
)
|
149
|
+
),
|
150
|
+
React.createElement('a', {
|
151
|
+
className: prefixCls + '-next-decade-btn',
|
152
|
+
role: 'button',
|
153
|
+
onClick: this.nextDecade,
|
154
|
+
title: locale.nextDecade
|
155
|
+
})
|
156
|
+
),
|
157
|
+
React.createElement(
|
158
|
+
'div',
|
159
|
+
{ className: prefixCls + '-body' },
|
160
|
+
React.createElement(
|
161
|
+
'table',
|
162
|
+
{ className: prefixCls + '-table', cellSpacing: '0', role: 'grid' },
|
163
|
+
React.createElement(
|
164
|
+
'tbody',
|
165
|
+
{ className: prefixCls + '-tbody' },
|
166
|
+
yeasEls
|
167
|
+
)
|
168
|
+
)
|
169
|
+
),
|
170
|
+
footer && React.createElement(
|
171
|
+
'div',
|
172
|
+
{ className: prefixCls + '-footer' },
|
173
|
+
footer
|
174
|
+
)
|
175
|
+
)
|
176
|
+
);
|
177
|
+
};
|
178
|
+
|
179
|
+
return YearPanel;
|
180
|
+
}(React.Component);
|
181
|
+
|
182
|
+
export default YearPanel;
|
183
|
+
|
184
|
+
|
185
|
+
YearPanel.propTypes = {
|
186
|
+
rootPrefixCls: PropTypes.string,
|
187
|
+
value: PropTypes.object,
|
188
|
+
defaultValue: PropTypes.object,
|
189
|
+
renderFooter: PropTypes.func
|
190
|
+
};
|
191
|
+
|
192
|
+
YearPanel.defaultProps = {
|
193
|
+
onSelect: function onSelect() {}
|
194
|
+
};
|
package/index.d.ts
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
// Definitions: https://github.com/react-component/calendar
|
5
5
|
|
6
6
|
import * as React from 'react';
|
7
|
-
import {
|
7
|
+
import { Dayjs } from 'dayjs';
|
8
8
|
|
9
9
|
export type Mode = 'time' | 'date' | 'month' | 'year' | 'decade';
|
10
10
|
|
@@ -12,9 +12,9 @@ export interface Props {
|
|
12
12
|
prefixCls?: string;
|
13
13
|
className?: string;
|
14
14
|
style?: React.CSSProperties;
|
15
|
-
defaultValue?:
|
16
|
-
value?:
|
17
|
-
selectedValue?:
|
15
|
+
defaultValue?: Dayjs;
|
16
|
+
value?: Dayjs;
|
17
|
+
selectedValue?: Dayjs;
|
18
18
|
mode?: Mode;
|
19
19
|
locale?: object;
|
20
20
|
format?: string | string[];
|
@@ -22,20 +22,21 @@ export interface Props {
|
|
22
22
|
showWeekNumber?: boolean;
|
23
23
|
showToday?: boolean;
|
24
24
|
showOk?: boolean;
|
25
|
-
onSelect?: (date:
|
25
|
+
onSelect?: (date: Dayjs) => void;
|
26
26
|
onOk?: () => void;
|
27
27
|
onKeyDown?: () => void;
|
28
|
+
onClickRightPanelTime?: () => void;
|
28
29
|
timePicker?: React.ReactNode;
|
29
30
|
dateInputPlaceholder?: string;
|
30
31
|
onClear?: () => void;
|
31
|
-
onChange?: (date:
|
32
|
-
onPanelChange?: (date:
|
33
|
-
disabledDate?: (current:
|
34
|
-
disabledTime?: (current:
|
35
|
-
dateRender?: (current:
|
32
|
+
onChange?: (date: Dayjs | null) => void;
|
33
|
+
onPanelChange?: (date: Dayjs | null, mode: Mode) => void;
|
34
|
+
disabledDate?: (current: Dayjs | undefined) => boolean;
|
35
|
+
disabledTime?: (current: Dayjs | undefined) => object;
|
36
|
+
dateRender?: (current: Dayjs, value: Dayjs) => React.ReactNode;
|
36
37
|
renderFooter?: () => React.ReactNode;
|
37
38
|
renderSidebar?: () => React.ReactNode;
|
38
|
-
inputMode?:
|
39
|
+
inputMode?: string;
|
39
40
|
}
|
40
41
|
|
41
42
|
export default class ReactCalendar extends React.Component<Props> {}
|