2016-12-19 14:44:07 +08:00
|
|
|
const prefixCls = 'ivu-picker-panel';
|
|
|
|
const datePrefixCls = 'ivu-date-picker';
|
|
|
|
|
|
|
|
export default {
|
2018-02-05 10:01:19 +01:00
|
|
|
props: {
|
|
|
|
confirm: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
},
|
2016-12-19 14:44:07 +08:00
|
|
|
methods: {
|
|
|
|
iconBtnCls (direction, type = '') {
|
|
|
|
return [
|
|
|
|
`${prefixCls}-icon-btn`,
|
|
|
|
`${datePrefixCls}-${direction}-btn`,
|
|
|
|
`${datePrefixCls}-${direction}-btn-arrow${type}`,
|
2016-12-25 22:49:42 +08:00
|
|
|
];
|
2016-12-19 14:44:07 +08:00
|
|
|
},
|
|
|
|
handleShortcutClick (shortcut) {
|
|
|
|
if (shortcut.value) this.$emit('on-pick', shortcut.value());
|
|
|
|
if (shortcut.onClick) shortcut.onClick(this);
|
2016-12-20 13:48:39 +08:00
|
|
|
},
|
|
|
|
handlePickClear () {
|
2018-01-16 22:24:21 +01:00
|
|
|
this.resetView();
|
2016-12-20 13:48:39 +08:00
|
|
|
this.$emit('on-pick-clear');
|
|
|
|
},
|
|
|
|
handlePickSuccess () {
|
2018-01-16 22:24:21 +01:00
|
|
|
this.resetView();
|
2016-12-20 13:48:39 +08:00
|
|
|
this.$emit('on-pick-success');
|
2016-12-22 09:18:11 +08:00
|
|
|
},
|
|
|
|
handlePickClick () {
|
|
|
|
this.$emit('on-pick-click');
|
2018-01-16 22:24:21 +01:00
|
|
|
},
|
|
|
|
resetView(){
|
|
|
|
setTimeout(
|
|
|
|
() => this.currentView = this.selectionMode,
|
|
|
|
500 // 500ms so the dropdown can close before changing
|
|
|
|
);
|
|
|
|
},
|
|
|
|
handleClear() {
|
|
|
|
this.dates = this.dates.map(() => null);
|
|
|
|
this.rangeState = {};
|
|
|
|
this.$emit('on-pick', this.dates);
|
|
|
|
this.handleConfirm();
|
|
|
|
// if (this.showTime) this.$refs.timePicker.handleClear();
|
|
|
|
},
|
|
|
|
handleConfirm(visible) {
|
|
|
|
this.$emit('on-pick', this.dates, visible);
|
|
|
|
},
|
2018-02-05 07:50:23 +01:00
|
|
|
onToggleVisibility(open){
|
|
|
|
const timeSpinner = this.$refs.timeSpinner;
|
|
|
|
if (open && timeSpinner) timeSpinner.updateScroll();
|
|
|
|
}
|
2016-12-19 14:44:07 +08:00
|
|
|
}
|
2016-12-25 22:49:42 +08:00
|
|
|
};
|