diff --git a/src/components/date-picker/base/month-table.vue b/src/components/date-picker/base/month-table.vue deleted file mode 100644 index c01556b..0000000 --- a/src/components/date-picker/base/month-table.vue +++ /dev/null @@ -1,79 +0,0 @@ - - diff --git a/src/components/date-picker/base/year-table.vue b/src/components/date-picker/base/year-table.vue index 6bc8467..00ab9f5 100644 --- a/src/components/date-picker/base/year-table.vue +++ b/src/components/date-picker/base/year-table.vue @@ -1,30 +1,34 @@ diff --git a/src/components/date-picker/panel/Date/date-panel-label.vue b/src/components/date-picker/panel/Date/date-panel-label.vue new file mode 100644 index 0000000..91f0fc4 --- /dev/null +++ b/src/components/date-picker/panel/Date/date-panel-label.vue @@ -0,0 +1,25 @@ + + + diff --git a/src/components/date-picker/panel/Date/date-panel-mixin.js b/src/components/date-picker/panel/Date/date-panel-mixin.js new file mode 100644 index 0000000..3c4ec99 --- /dev/null +++ b/src/components/date-picker/panel/Date/date-panel-mixin.js @@ -0,0 +1,50 @@ + +import { oneOf } from '../../../../utils/assist'; +import {initTimeDate } from '../../util'; + + +export default { + props: { + confirm: { + type: Boolean, + default: false + }, + showTime: { + type: Boolean, + default: false + }, + format: { + type: String, + default: 'yyyy-MM-dd' + }, + selectionMode: { + type: String, + validator (value) { + return oneOf(value, ['year', 'month', 'date', 'time']); + }, + default: 'date' + }, + shortcuts: { + type: Array, + default: () => [] + }, + disabledDate: { + type: Function, + default: () => false + }, + value: { + type: Array, + default: () => [initTimeDate(), initTimeDate()] + } + }, + computed: { + isTime(){ + return this.currentView === 'time'; + } + }, + methods: { + handleToggleTime(){ + this.currentView = this.currentView === 'time' ? this.selectionMode : 'time'; + }, + } +}; diff --git a/src/components/date-picker/panel/Time/time-range.vue b/src/components/date-picker/panel/Time/time-range.vue new file mode 100644 index 0000000..aea53d2 --- /dev/null +++ b/src/components/date-picker/panel/Time/time-range.vue @@ -0,0 +1,163 @@ + + diff --git a/src/components/date-picker/panel/Time/time.vue b/src/components/date-picker/panel/Time/time.vue new file mode 100644 index 0000000..35a2688 --- /dev/null +++ b/src/components/date-picker/panel/Time/time.vue @@ -0,0 +1,104 @@ + + diff --git a/src/components/date-picker/panel/date-panel-label.vue b/src/components/date-picker/panel/date-panel-label.vue deleted file mode 100644 index 91f0fc4..0000000 --- a/src/components/date-picker/panel/date-panel-label.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - diff --git a/src/components/date-picker/panel/mixin.js b/src/components/date-picker/panel/mixin.js deleted file mode 100644 index bc93a9c..0000000 --- a/src/components/date-picker/panel/mixin.js +++ /dev/null @@ -1,27 +0,0 @@ -const prefixCls = 'ivu-picker-panel'; -const datePrefixCls = 'ivu-date-picker'; - -export default { - methods: { - iconBtnCls (direction, type = '') { - return [ - `${prefixCls}-icon-btn`, - `${datePrefixCls}-${direction}-btn`, - `${datePrefixCls}-${direction}-btn-arrow${type}`, - ]; - }, - handleShortcutClick (shortcut) { - if (shortcut.value) this.$emit('on-pick', shortcut.value()); - if (shortcut.onClick) shortcut.onClick(this); - }, - handlePickClear () { - this.$emit('on-pick-clear'); - }, - handlePickSuccess () { - this.$emit('on-pick-success'); - }, - handlePickClick () { - this.$emit('on-pick-click'); - } - } -}; diff --git a/src/components/date-picker/panel/panel-mixin.js b/src/components/date-picker/panel/panel-mixin.js new file mode 100644 index 0000000..d227725 --- /dev/null +++ b/src/components/date-picker/panel/panel-mixin.js @@ -0,0 +1,46 @@ +const prefixCls = 'ivu-picker-panel'; +const datePrefixCls = 'ivu-date-picker'; + +export default { + methods: { + iconBtnCls (direction, type = '') { + return [ + `${prefixCls}-icon-btn`, + `${datePrefixCls}-${direction}-btn`, + `${datePrefixCls}-${direction}-btn-arrow${type}`, + ]; + }, + handleShortcutClick (shortcut) { + if (shortcut.value) this.$emit('on-pick', shortcut.value()); + if (shortcut.onClick) shortcut.onClick(this); + }, + handlePickClear () { + this.resetView(); + this.$emit('on-pick-clear'); + }, + handlePickSuccess () { + this.resetView(); + this.$emit('on-pick-success'); + }, + handlePickClick () { + this.$emit('on-pick-click'); + }, + 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); + }, + + } +}; diff --git a/src/components/date-picker/panel/time-range.vue b/src/components/date-picker/panel/time-range.vue deleted file mode 100644 index 3aad9e3..0000000 --- a/src/components/date-picker/panel/time-range.vue +++ /dev/null @@ -1,214 +0,0 @@ - - diff --git a/src/components/date-picker/panel/time.vue b/src/components/date-picker/panel/time.vue deleted file mode 100644 index e6646b5..0000000 --- a/src/components/date-picker/panel/time.vue +++ /dev/null @@ -1,123 +0,0 @@ - - -- libgit2 0.21.4