@wangxinowo/vue-datepicker-next 1.0.3 → 1.0.6
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 +446 -40
- package/dist/vue-datepicker-next.min.css +201 -462
- package/dist/vue-datepicker-next.min.js +3 -3
- package/package.json +1 -1
- package/src/components/date-picker/PresetPanel.jsx +66 -20
- package/src/components/date-picker/style/RangePicker.less +9 -1
- package/src/components/date-picker/style/presets.less +51 -0
- package/src/components/date-picker/wrapPicker.js +2 -2
- package/src/components/style/core/base.less +4 -505
- package/src/components/style/core/motion/fade.less +4 -3
- package/src/components/style/core/motion/move.less +4 -3
- package/src/components/style/core/motion/other.less +3 -1
- package/src/components/style/core/motion/slide.less +4 -3
- package/src/components/style/core/motion/swing.less +5 -4
- package/src/components/style/core/motion/zoom.less +4 -3
- package/src/components/style/mixins/motion.less +7 -6
- package/src/components/time-picker/index.jsx +1 -1
- package/src/components/tooltip/abstractTooltipProps.js +1 -1
- package/src/components/vc-calendar/src/RangeCalendar.jsx +74 -0
- package/src/components/vc-calendar/src/calendar/CalendarHeader.jsx +10 -0
- package/src/components/vc-calendar/src/month/MonthPanel.jsx +6 -0
- package/src/components/vc-calendar/src/month/MonthTable.jsx +53 -15
- package/src/components/vc-calendar/src/range-calendar/CalendarPart.jsx +6 -0
- package/src/components/vc-calendar/src/year/YearPanel.jsx +44 -13
- package/src/index.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PresetPanel - 预设日期范围面板组件
|
|
3
3
|
* 用于显示快捷选择的预设日期范围
|
|
4
|
+
* 支持两种显示模式:panel(左侧面板)和 footer(底部按钮)
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
import PropTypes from '../_util/vue-types';
|
|
@@ -24,6 +25,13 @@ export default {
|
|
|
24
25
|
* 选中的预设索引
|
|
25
26
|
*/
|
|
26
27
|
selectedIndex: PropTypes.number.def(-1),
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 显示模式
|
|
31
|
+
* - panel: 左侧面板模式(垂直列表)
|
|
32
|
+
* - footer: 底部模式(水平按钮)
|
|
33
|
+
*/
|
|
34
|
+
mode: PropTypes.oneOf(['panel', 'footer']).def('footer'),
|
|
27
35
|
},
|
|
28
36
|
|
|
29
37
|
methods: {
|
|
@@ -64,39 +72,77 @@ export default {
|
|
|
64
72
|
handleMouseLeave() {
|
|
65
73
|
this.$emit('hover', null, null, -1);
|
|
66
74
|
},
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
render() {
|
|
70
|
-
const { prefixCls, presets, selectedIndex } = this;
|
|
71
|
-
|
|
72
|
-
if (!presets || presets.length === 0) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
/**
|
|
77
|
+
* 渲染底部按钮模式
|
|
78
|
+
*/
|
|
79
|
+
renderFooterMode() {
|
|
80
|
+
const { prefixCls, presets, selectedIndex } = this;
|
|
81
|
+
const footerCls = `${prefixCls}-presets-footer`;
|
|
77
82
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
<ul class={`${panelCls}-list`}>
|
|
83
|
+
return (
|
|
84
|
+
<div class={footerCls}>
|
|
81
85
|
{presets.map((preset, index) => {
|
|
82
|
-
const
|
|
83
|
-
[`${
|
|
86
|
+
const btnCls = classNames(`${footerCls}-btn`, {
|
|
87
|
+
[`${footerCls}-btn-selected`]: index === selectedIndex,
|
|
84
88
|
});
|
|
85
89
|
|
|
86
90
|
return (
|
|
87
|
-
<
|
|
91
|
+
<span
|
|
88
92
|
key={index}
|
|
89
|
-
class={
|
|
93
|
+
class={btnCls}
|
|
90
94
|
onClick={() => this.handleClick(preset, index)}
|
|
91
95
|
onMouseenter={() => this.handleMouseEnter(preset, index)}
|
|
92
96
|
onMouseleave={this.handleMouseLeave}
|
|
93
97
|
>
|
|
94
98
|
{preset.label}
|
|
95
|
-
</
|
|
99
|
+
</span>
|
|
96
100
|
);
|
|
97
101
|
})}
|
|
98
|
-
</
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 渲染左侧面板模式
|
|
108
|
+
*/
|
|
109
|
+
renderPanelMode() {
|
|
110
|
+
const { prefixCls, presets, selectedIndex } = this;
|
|
111
|
+
const panelCls = `${prefixCls}-presets`;
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<div class={panelCls}>
|
|
115
|
+
<ul class={`${panelCls}-list`}>
|
|
116
|
+
{presets.map((preset, index) => {
|
|
117
|
+
const itemCls = classNames(`${panelCls}-item`, {
|
|
118
|
+
[`${panelCls}-item-selected`]: index === selectedIndex,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<li
|
|
123
|
+
key={index}
|
|
124
|
+
class={itemCls}
|
|
125
|
+
onClick={() => this.handleClick(preset, index)}
|
|
126
|
+
onMouseenter={() => this.handleMouseEnter(preset, index)}
|
|
127
|
+
onMouseleave={this.handleMouseLeave}
|
|
128
|
+
>
|
|
129
|
+
{preset.label}
|
|
130
|
+
</li>
|
|
131
|
+
);
|
|
132
|
+
})}
|
|
133
|
+
</ul>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
render() {
|
|
140
|
+
const { presets, mode } = this;
|
|
141
|
+
|
|
142
|
+
if (!presets || presets.length === 0) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return mode === 'footer' ? this.renderFooterMode() : this.renderPanelMode();
|
|
101
147
|
},
|
|
102
148
|
};
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
.@{calendar-prefix-cls}-decade-panel-table,
|
|
308
308
|
.@{calendar-prefix-cls}-year-panel-table,
|
|
309
309
|
.@{calendar-prefix-cls}-month-panel-table {
|
|
310
|
-
height:
|
|
310
|
+
height: auto;
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
.@{calendar-prefix-cls}-in-range-cell {
|
|
@@ -374,6 +374,14 @@
|
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
+
// 年份/月份 hover 预览范围样式
|
|
378
|
+
.@{calendar-prefix-cls}-year-panel-cell.@{calendar-prefix-cls}-in-hover-range-cell,
|
|
379
|
+
.@{calendar-prefix-cls}-month-panel-cell.@{calendar-prefix-cls}-in-hover-range-cell {
|
|
380
|
+
&::before {
|
|
381
|
+
background: @primary-2;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
377
385
|
// 悬停高亮效果 - 范围起始单元格
|
|
378
386
|
.@{calendar-prefix-cls}-selected-start-date,
|
|
379
387
|
.@{calendar-prefix-cls}-selected-end-date {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Presets Panel Styles for RangePicker
|
|
2
2
|
// 预设日期范围面板样式
|
|
3
3
|
|
|
4
|
+
// 左侧面板模式样式
|
|
4
5
|
.@{calendar-prefix-cls}-presets {
|
|
5
6
|
display: flex;
|
|
6
7
|
flex-direction: column;
|
|
@@ -34,6 +35,56 @@
|
|
|
34
35
|
background: @primary-1;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
38
|
+
|
|
39
|
+
// 底部按钮模式样式
|
|
40
|
+
&-footer {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-wrap: wrap;
|
|
43
|
+
align-items: center;
|
|
44
|
+
gap: @padding-xs;
|
|
45
|
+
padding: @padding-sm @padding-md;
|
|
46
|
+
border-top: @border-width-base @border-style-base @border-color-split;
|
|
47
|
+
background: @component-background;
|
|
48
|
+
|
|
49
|
+
&-btn {
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
height: 24px;
|
|
54
|
+
padding: 0 @padding-sm;
|
|
55
|
+
font-size: @font-size-sm;
|
|
56
|
+
color: @text-color;
|
|
57
|
+
background: @background-color-light;
|
|
58
|
+
border: @border-width-base @border-style-base @border-color-base;
|
|
59
|
+
border-radius: @border-radius-sm;
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
transition: all 0.2s ease-in-out;
|
|
62
|
+
user-select: none;
|
|
63
|
+
|
|
64
|
+
&:hover {
|
|
65
|
+
color: @primary-color;
|
|
66
|
+
border-color: @primary-color;
|
|
67
|
+
background: @primary-1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&:active {
|
|
71
|
+
color: @primary-7;
|
|
72
|
+
border-color: @primary-7;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&-selected {
|
|
76
|
+
color: #fff;
|
|
77
|
+
background: @primary-color;
|
|
78
|
+
border-color: @primary-color;
|
|
79
|
+
|
|
80
|
+
&:hover {
|
|
81
|
+
color: #fff;
|
|
82
|
+
background: @primary-5;
|
|
83
|
+
border-color: @primary-5;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
37
88
|
}
|
|
38
89
|
|
|
39
90
|
// Range picker with presets layout
|
|
@@ -43,7 +43,7 @@ export default function wrapPicker(Picker, props, pickerType) {
|
|
|
43
43
|
return {
|
|
44
44
|
name: Picker.name,
|
|
45
45
|
props: initDefaultProps(props, {
|
|
46
|
-
transitionName: 'slide-up',
|
|
46
|
+
transitionName: 'ant-slide-up',
|
|
47
47
|
popupStyle: {},
|
|
48
48
|
locale: {},
|
|
49
49
|
}),
|
|
@@ -199,7 +199,7 @@ export default function wrapPicker(Picker, props, pickerType) {
|
|
|
199
199
|
...showTime,
|
|
200
200
|
prefixCls: `${prefixCls}-time-picker`,
|
|
201
201
|
placeholder: locale.timePickerLocale.placeholder,
|
|
202
|
-
transitionName: 'slide-up',
|
|
202
|
+
transitionName: 'ant-slide-up',
|
|
203
203
|
},
|
|
204
204
|
class: timePickerCls,
|
|
205
205
|
on: {
|