feat: update vc-calendar to 9.10.10

pull/666/head
wangxueliang 6 years ago
parent 2d2bd79f82
commit 015fca4e1b

@ -1,4 +1,4 @@
// based on rc-calendar 9.10.8
// based on rc-calendar 9.10.10
import Vue from 'vue';
import ref from 'vue-ref';
import Calendar from './src/';

@ -58,7 +58,7 @@ function generateOptions(length, extraOptionGen) {
return arr;
}
function onInputSelect(direction, value) {
function onInputSelect(direction, value, cause) {
if (!value) {
return;
}
@ -70,7 +70,7 @@ function onInputSelect(direction, value) {
selectedValue[1 - index] = this.showTimePicker ? selectedValue[index] : undefined;
}
this.__emit('inputSelect', selectedValue);
this.fireSelectValueChange(selectedValue);
this.fireSelectValueChange(selectedValue, null, cause || { source: 'dateInput' });
}
const RangeCalendar = {
@ -369,16 +369,26 @@ const RangeCalendar = {
}
},
onStartInputSelect(...oargs) {
onStartInputChange(...oargs) {
const args = ['left'].concat(oargs);
return onInputSelect.apply(this, args);
},
onEndInputSelect(...oargs) {
onEndInputChange(...oargs) {
const args = ['right'].concat(oargs);
return onInputSelect.apply(this, args);
},
onStartInputSelect(value) {
const args = ['left', value, { source: 'dateInputSelect' }];
return onInputSelect.apply(this, args);
},
onEndInputSelect(value) {
const args = ['right', value, { source: 'dateInputSelect' }];
return onInputSelect.apply(this, args);
},
onStartValueChange(leftValue) {
const value = [...this.sValue];
value[0] = leftValue;
@ -502,7 +512,7 @@ const RangeCalendar = {
return v1.diff(v2, 'days');
},
fireSelectValueChange(selectedValue, direct) {
fireSelectValueChange(selectedValue, direct, cause) {
const { timePicker, prevSelectedValue } = this;
if (timePicker) {
const timePickerProps = getOptionProps(timePicker);
@ -540,7 +550,7 @@ const RangeCalendar = {
firstSelectedValue: null,
});
this.fireHoverValueChange([]);
this.__emit('select', selectedValue);
this.__emit('select', selectedValue, cause);
}
if (!hasProp(this, 'selectedValue')) {
this.setState({
@ -677,6 +687,7 @@ const RangeCalendar = {
clearIcon,
},
on: {
inputChange: this.onStartInputChange,
inputSelect: this.onStartInputSelect,
valueChange: this.onStartValueChange,
panelChange: this.onStartPanelChange,
@ -701,6 +712,7 @@ const RangeCalendar = {
clearIcon,
},
on: {
inputChange: this.onEndInputChange,
inputSelect: this.onEndInputSelect,
valueChange: this.onEndValueChange,
panelChange: this.onEndPanelChange,

@ -138,9 +138,12 @@ const DateInput = {
}));
},
onKeyDown({ keyCode }) {
const { value } = this.$props;
const { value, disabledDate } = this.$props;
if (keyCode === KeyCode.ENTER) {
this.__emit('select', value.clone());
const validateDate = !disabledDate || !disabledDate(value);
if(validateDate) {
this.__emit('select', value.clone());
}
}
},
getRootDOMNode() {

@ -59,6 +59,7 @@ const CalendarPart = {
} = props;
const clearIcon = getComponentFromProp(this, 'clearIcon');
const {
inputChange = noop,
inputSelect = noop,
valueChange = noop,
panelChange = noop,
@ -91,7 +92,7 @@ const CalendarPart = {
value: selectedValue[index],
},
on: {
change: inputSelect,
change: inputChange,
},
});
}
@ -109,6 +110,8 @@ const CalendarPart = {
showClear={false}
selectedValue={selectedValue[index]}
onChange={inputSelect}
onChange={inputChange}
onSelect={inputSelect}
clearIcon={clearIcon}
/>
);

@ -1,4 +1,3 @@
// based on rc-upload 2.4.4
// export this package's api
import Upload from './Upload';

Loading…
Cancel
Save