From 9d844d5318bb6caabff8e32739df8f73fd72e7a8 Mon Sep 17 00:00:00 2001 From: 梁灏 Date: Mon, 26 Dec 2016 14:50:39 +0800 Subject: [PATCH] fixed Layout bug --- src/components/date-picker/base/time-spinner.vue | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/components/date-picker/panel/time.vue | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/components/date-picker/picker.vue | 11 ++++++++++- src/components/date-picker/picker/time-picker.js | 39 +++++++++++++++++++++++++++++++++++++++ src/components/layout/row.vue | 2 +- src/components/time-picker/index.js | 2 ++ src/index.js | 2 ++ test/routers/date.vue | 3 +++ test/routers/more.vue | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------- 9 files changed, 281 insertions(+), 23 deletions(-) create mode 100644 src/components/date-picker/base/time-spinner.vue create mode 100644 src/components/date-picker/panel/time.vue create mode 100644 src/components/date-picker/picker/time-picker.js create mode 100644 src/components/time-picker/index.js diff --git a/src/components/date-picker/base/time-spinner.vue b/src/components/date-picker/base/time-spinner.vue new file mode 100644 index 0000000..9bcef05 --- /dev/null +++ b/src/components/date-picker/base/time-spinner.vue @@ -0,0 +1,66 @@ + + \ No newline at end of file diff --git a/src/components/date-picker/panel/time.vue b/src/components/date-picker/panel/time.vue new file mode 100644 index 0000000..452776f --- /dev/null +++ b/src/components/date-picker/panel/time.vue @@ -0,0 +1,82 @@ + + \ No newline at end of file diff --git a/src/components/date-picker/picker.vue b/src/components/date-picker/picker.vue index 7b3933b..caf25c0 100644 --- a/src/components/date-picker/picker.vue +++ b/src/components/date-picker/picker.vue @@ -200,7 +200,10 @@ return this.open === null ? this.visible : this.open; }, iconType () { - return this.showClose ? 'ios-close' : 'ios-calendar-outline'; + let icon = 'ios-calendar-outline'; + if (this.type === 'time') icon = 'ios-clock-outline'; + if (this.showClose) icon = 'ios-close'; + return icon; }, transition () { if (this.placement === 'bottom-start' || this.placement === 'bottom' || this.placement === 'bottom-end') { @@ -341,6 +344,12 @@ this.picker.selectionMode = this.selectionMode; if (this.format) this.picker.format = this.format; + // TimePicker + if (this.disabledHours) this.picker.disabledHours = this.disabledHours; + if (this.disabledMinutes) this.picker.disabledMinutes = this.disabledMinutes; + if (this.disabledSeconds) this.picker.disabledSeconds = this.disabledSeconds; + if (this.hideDisabledOptions) this.picker.hideDisabledOptions = this.hideDisabledOptions; + const options = this.options; for (const option in options) { this.picker[option] = options[option]; diff --git a/src/components/date-picker/picker/time-picker.js b/src/components/date-picker/picker/time-picker.js new file mode 100644 index 0000000..0951052 --- /dev/null +++ b/src/components/date-picker/picker/time-picker.js @@ -0,0 +1,39 @@ +import Picker from '../picker.vue'; +import TimePanel from '../panel/time.vue'; + +export default { + mixins: [Picker], + props: { + value: {}, + disabledHours: { + type: Array, + default () { + return []; + } + }, + disabledMinutes: { + type: Array, + default () { + return []; + } + }, + disabledSeconds: { + type: Array, + default () { + return []; + } + }, + hideDisabledOptions: { + type: Boolean, + default: false + } + }, + data () { + return { + type: 'time' + }; + }, + created () { + this.panel = TimePanel; + } +}; \ No newline at end of file diff --git a/src/components/layout/row.vue b/src/components/layout/row.vue index c9890ce..7b076ef 100644 --- a/src/components/layout/row.vue +++ b/src/components/layout/row.vue @@ -34,8 +34,8 @@ computed: { classes () { return [ - `${prefixCls}`, { + [`${prefixCls}`]: !this.type, [`${prefixCls}-${this.type}`]: !!this.type, [`${prefixCls}-${this.type}-${this.align}`]: !!this.align, [`${prefixCls}-${this.type}-${this.justify}`]: !!this.justify, diff --git a/src/components/time-picker/index.js b/src/components/time-picker/index.js new file mode 100644 index 0000000..4dfd732 --- /dev/null +++ b/src/components/time-picker/index.js @@ -0,0 +1,2 @@ +import TimePicker from '../date-picker/picker/time-picker'; +export default TimePicker; \ No newline at end of file diff --git a/src/index.js b/src/index.js index e6348ef..6bd4737 100644 --- a/src/index.js +++ b/src/index.js @@ -34,6 +34,7 @@ import Table from './components/table'; import Tabs from './components/tabs'; import Tag from './components/tag'; import Timeline from './components/timeline'; +import TimePicker from './components/time-picker'; import Tooltip from './components/tooltip'; import Transfer from './components/transfer'; import { Row, Col } from './components/layout'; @@ -91,6 +92,7 @@ const iview = { Tag, Timeline, TimelineItem: Timeline.Item, + TimePicker, Tooltip, Transfer }; diff --git a/test/routers/date.vue b/test/routers/date.vue index 0713eb9..26b2902 100644 --- a/test/routers/date.vue +++ b/test/routers/date.vue @@ -6,6 +6,9 @@ + + + -- libgit2 0.21.4