@@ -169,6 +171,12 @@
rightDatePanelLabel(){
return this.panelLabelConfig('right');
},
+ leftDatePanelView(){
+ return this.leftPickerTable.split('-').shift();
+ },
+ rightDatePanelView(){
+ return this.rightPickerTable.split('-').shift();
+ },
timeDisabled(){
return !(this.dates[0] && this.dates[1]);
},
@@ -287,7 +295,16 @@
},
handlePreSelection(panel, value){
this[`${panel}PanelDate`] = value;
- this[`${panel}PickerTable`] = `${this.currentView}-table`;
+ const currentViewType = this[`${panel}PickerTable`];
+ if (currentViewType === 'year-table') this[`${panel}PickerTable`] = 'month-table';
+ else this[`${panel}PickerTable`] = `${this.currentView}-table`;
+
+ if (!this.splitPanels){
+ const otherPanel = panel === 'left' ? 'right' : 'left';
+ const type = currentViewType === 'year-table' ? 'FullYear' : 'Month';
+ this[`${otherPanel}PanelDate`] = value;
+ this.changePanelDate(otherPanel, type, 1);
+ }
},
handleRangePick (val) {
if (this.rangeState.selecting || this.currentView === 'time'){
diff --git a/src/components/date-picker/panel/Date/date.vue b/src/components/date-picker/panel/Date/date.vue
index 10912f7..7cf9775 100644
--- a/src/components/date-picker/panel/Date/date.vue
+++ b/src/components/date-picker/panel/Date/date.vue
@@ -12,17 +12,19 @@
:class="iconBtnCls('prev', '-double')"
@click="changeYear(-1)">
@@ -155,7 +157,7 @@
this.pickerTable = this.getTableType(this.currentView);
},
changeYear(dir){
- if (this.selectionMode === 'year'){
+ if (this.selectionMode === 'year' || this.pickerTable === 'year-table'){
this.panelDate = new Date(this.panelDate.getFullYear() + dir * 10, 0, 1);
} else {
this.panelDate = siblingMonth(this.panelDate, dir * 12);
@@ -169,7 +171,9 @@
},
handlePreSelection(value){
this.panelDate = value;
- this.pickerTable = this.getTableType(this.currentView);
+ if (this.pickerTable === 'year-table') this.pickerTable = 'month-table';
+ else this.pickerTable = this.getTableType(this.currentView);
+
},
handlePick (value) {
const {selectionMode, panelDate} = this;
--
libgit2 0.21.4