Commit ebf1f86b124d4630ce491e5d95207e760fdfedb3
1 parent
e8a990f5
show only 1 date in preselecting mode
Showing
1 changed file
with
12 additions
and
5 deletions
Show diff stats
src/components/date-picker/panel/Date/date-range.vue
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 | :disabled-date="disabledDate" |
41 | 41 | :range-state="rangeState" |
42 | 42 | :show-week-numbers="showWeekNumbers" |
43 | - :value="dates" | |
43 | + :value="preSelecting.left ? [dates[0]] : dates" | |
44 | 44 | @on-change-range="handleChangeRange" |
45 | 45 | @on-pick="panelPickerHandlers.left" |
46 | 46 | @on-pick-click="handlePickClick" |
... | ... | @@ -79,7 +79,7 @@ |
79 | 79 | :range-state="rangeState" |
80 | 80 | :disabled-date="disabledDate" |
81 | 81 | :show-week-numbers="showWeekNumbers" |
82 | - :value="dates" | |
82 | + :value="preSelecting.right ? [dates[dates.length - 1]] : dates" | |
83 | 83 | @on-change-range="handleChangeRange" |
84 | 84 | @on-pick="panelPickerHandlers.right" |
85 | 85 | @on-pick-click="handlePickClick"></component> |
... | ... | @@ -184,11 +184,18 @@ |
184 | 184 | timeDisabled(){ |
185 | 185 | return !(this.dates[0] && this.dates[1]); |
186 | 186 | }, |
187 | - panelPickerHandlers(){ | |
187 | + preSelecting(){ | |
188 | 188 | const tableType = `${this.currentView}-table`; |
189 | + | |
190 | + return { | |
191 | + left: this.leftPickerTable !== tableType, | |
192 | + right: this.rightPickerTable !== tableType, | |
193 | + }; | |
194 | + }, | |
195 | + panelPickerHandlers(){ | |
189 | 196 | return { |
190 | - left: this.leftPickerTable === tableType ? this.handleRangePick : this.handlePreSelection.bind(this, 'left'), | |
191 | - right: this.leftPickerTable === tableType ? this.handleRangePick : this.handlePreSelection.bind(this, 'right'), | |
197 | + left: this.preSelecting.left ? this.handlePreSelection.bind(this, 'left') : this.handleRangePick, | |
198 | + right: this.preSelecting.right ? this.handlePreSelection.bind(this, 'right') : this.handleRangePick, | |
192 | 199 | }; |
193 | 200 | } |
194 | 201 | }, | ... | ... |