@wangxinowo/vue-datepicker-next 1.0.3 → 1.0.5
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 +510 -104
- package/dist/vue-datepicker-next.min.css +48 -1
- package/dist/vue-datepicker-next.min.js +3 -3
- package/package.json +88 -88
- package/src/components/date-picker/PresetPanel.jsx +148 -102
- package/src/components/date-picker/style/RangePicker.less +515 -507
- package/src/components/date-picker/style/presets.less +120 -69
- package/src/components/vc-calendar/src/RangeCalendar.jsx +1105 -1031
- package/src/components/vc-calendar/src/calendar/CalendarHeader.jsx +277 -267
- package/src/components/vc-calendar/src/month/MonthPanel.jsx +130 -124
- package/src/components/vc-calendar/src/month/MonthTable.jsx +252 -214
- package/src/components/vc-calendar/src/range-calendar/CalendarPart.jsx +180 -174
- package/src/components/vc-calendar/src/year/YearPanel.jsx +242 -211
- package/src/index.js +48 -44
|
@@ -1,124 +1,130 @@
|
|
|
1
|
-
import PropTypes from '../../../_util/vue-types';
|
|
2
|
-
import BaseMixin from '../../../_util/BaseMixin';
|
|
3
|
-
import { hasProp, getListeners } from '../../../_util/props-util';
|
|
4
|
-
import MonthTable from './MonthTable';
|
|
5
|
-
|
|
6
|
-
function goYear(direction) {
|
|
7
|
-
this.changeYear(direction);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function noop() {}
|
|
11
|
-
|
|
12
|
-
const MonthPanel = {
|
|
13
|
-
name: 'MonthPanel',
|
|
14
|
-
mixins: [BaseMixin],
|
|
15
|
-
props: {
|
|
16
|
-
value: PropTypes.any,
|
|
17
|
-
defaultValue: PropTypes.any,
|
|
18
|
-
// 支持单个值或数组(范围选择)
|
|
19
|
-
selectedValue: PropTypes.oneOfType([PropTypes.any, PropTypes.array]),
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
class={`${prefixCls}-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
1
|
+
import PropTypes from '../../../_util/vue-types';
|
|
2
|
+
import BaseMixin from '../../../_util/BaseMixin';
|
|
3
|
+
import { hasProp, getListeners } from '../../../_util/props-util';
|
|
4
|
+
import MonthTable from './MonthTable';
|
|
5
|
+
|
|
6
|
+
function goYear(direction) {
|
|
7
|
+
this.changeYear(direction);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function noop() {}
|
|
11
|
+
|
|
12
|
+
const MonthPanel = {
|
|
13
|
+
name: 'MonthPanel',
|
|
14
|
+
mixins: [BaseMixin],
|
|
15
|
+
props: {
|
|
16
|
+
value: PropTypes.any,
|
|
17
|
+
defaultValue: PropTypes.any,
|
|
18
|
+
// 支持单个值或数组(范围选择)
|
|
19
|
+
selectedValue: PropTypes.oneOfType([PropTypes.any, PropTypes.array]),
|
|
20
|
+
// hover 值,用于范围选择时的预览效果
|
|
21
|
+
hoverValue: PropTypes.array.def([]),
|
|
22
|
+
cellRender: PropTypes.any,
|
|
23
|
+
contentRender: PropTypes.any,
|
|
24
|
+
locale: PropTypes.any,
|
|
25
|
+
rootPrefixCls: PropTypes.string,
|
|
26
|
+
// onChange: PropTypes.func,
|
|
27
|
+
disabledDate: PropTypes.func,
|
|
28
|
+
// onSelect: PropTypes.func,
|
|
29
|
+
renderFooter: PropTypes.func,
|
|
30
|
+
changeYear: PropTypes.func.def(noop),
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
data() {
|
|
34
|
+
const { value, defaultValue } = this;
|
|
35
|
+
// bind methods
|
|
36
|
+
this.nextYear = goYear.bind(this, 1);
|
|
37
|
+
this.previousYear = goYear.bind(this, -1);
|
|
38
|
+
return {
|
|
39
|
+
sValue: value || defaultValue,
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
watch: {
|
|
43
|
+
value(val) {
|
|
44
|
+
this.setState({
|
|
45
|
+
sValue: val,
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
methods: {
|
|
50
|
+
setAndSelectValue(value) {
|
|
51
|
+
this.setValue(value);
|
|
52
|
+
this.__emit('select', value);
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
setValue(value) {
|
|
56
|
+
if (hasProp(this, 'value')) {
|
|
57
|
+
this.setState({
|
|
58
|
+
sValue: value,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
render() {
|
|
65
|
+
const {
|
|
66
|
+
sValue,
|
|
67
|
+
cellRender,
|
|
68
|
+
contentRender,
|
|
69
|
+
locale,
|
|
70
|
+
rootPrefixCls,
|
|
71
|
+
disabledDate,
|
|
72
|
+
renderFooter,
|
|
73
|
+
selectedValue,
|
|
74
|
+
hoverValue,
|
|
75
|
+
} = this;
|
|
76
|
+
const year = sValue.year();
|
|
77
|
+
const prefixCls = `${rootPrefixCls}-month-panel`;
|
|
78
|
+
const monthHover = getListeners(this).monthHover || noop;
|
|
79
|
+
|
|
80
|
+
const footer = renderFooter && renderFooter('month');
|
|
81
|
+
return (
|
|
82
|
+
<div class={prefixCls}>
|
|
83
|
+
<div>
|
|
84
|
+
<div class={`${prefixCls}-header`}>
|
|
85
|
+
<a
|
|
86
|
+
class={`${prefixCls}-prev-year-btn`}
|
|
87
|
+
role="button"
|
|
88
|
+
onClick={this.previousYear}
|
|
89
|
+
title={locale.previousYear}
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
<a
|
|
93
|
+
class={`${prefixCls}-year-select`}
|
|
94
|
+
role="button"
|
|
95
|
+
onClick={getListeners(this).yearPanelShow || noop}
|
|
96
|
+
title={locale.yearSelect}
|
|
97
|
+
>
|
|
98
|
+
<span class={`${prefixCls}-year-select-content`}>{year}</span>
|
|
99
|
+
<span class={`${prefixCls}-year-select-arrow`}>x</span>
|
|
100
|
+
</a>
|
|
101
|
+
|
|
102
|
+
<a
|
|
103
|
+
class={`${prefixCls}-next-year-btn`}
|
|
104
|
+
role="button"
|
|
105
|
+
onClick={this.nextYear}
|
|
106
|
+
title={locale.nextYear}
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
<div class={`${prefixCls}-body`}>
|
|
110
|
+
<MonthTable
|
|
111
|
+
disabledDate={disabledDate}
|
|
112
|
+
onSelect={this.setAndSelectValue}
|
|
113
|
+
onMonthHover={monthHover}
|
|
114
|
+
locale={locale}
|
|
115
|
+
value={sValue}
|
|
116
|
+
selectedValue={selectedValue}
|
|
117
|
+
hoverValue={hoverValue}
|
|
118
|
+
cellRender={cellRender}
|
|
119
|
+
contentRender={contentRender}
|
|
120
|
+
prefixCls={prefixCls}
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
123
|
+
{footer && <div class={`${prefixCls}-footer`}>{footer}</div>}
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export default MonthPanel;
|