forked from alibaba-fusion/next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.jsx
69 lines (51 loc) · 1.84 KB
/
index.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import ConfigProvider from '../config-provider';
import { preFormatDateValue } from './utils';
import Calendar from './calendar';
/* istanbul ignore next */
const transform = (props, deprecated) => {
const { type, onChange, base, disabledMonth, disabledYear, ...others } = props;
const newProps = others;
if ('type' in props) {
deprecated('type', 'shape', 'Calendar');
newProps.shape = type;
if ('shape' in props) {
newProps.shape = props.shape;
}
}
if ('base' in props) {
deprecated('base', 'defaultVisibleMonth', 'Calendar');
let newDefaultVisibleMonth = () => {
preFormatDateValue(base, 'YYYY-MM-DD');
};
if ('defaultVisibleMonth' in props) {
newDefaultVisibleMonth = props.defaultVisibleMonth;
}
newProps.defaultVisibleMonth = newDefaultVisibleMonth;
}
if ('onChange' in props && typeof onChange === 'function') {
deprecated('onChange', 'onSelect', 'Calendar');
const newOnSelect = (date) => {
onChange({mode: others.mode, value: date});
if ('onSelect' in props) {
props.onSelect(date);
}
};
newProps.onSelect = newOnSelect;
}
if ('disabledMonth' in props && typeof disabledMonth === 'function') {
deprecated('disabledMonth', 'disabledDate', 'Calendar');
}
if ('disabledYear' in props && typeof disabledYear === 'function') {
deprecated('disabledYear', 'disabledDate', 'Calendar');
}
if ('yearCellRender' in props) {
deprecated('yearCellRender', 'monthCellRender/dateCellRender', 'Calendar');
}
if ('language' in props) {
deprecated('language', 'moment.locale', 'Calendar');
}
return newProps;
};
export default ConfigProvider.config(Calendar, {
transform
});