Merge pull request #366 from QingWei-Li/fix/datepicker-dropdown-steps

DatePicker/Dropdown/Steps/Badge(docs): fix style bug
pull/372/head
baiyaaaaa 2016-10-12 23:43:12 +08:00 committed by GitHub
commit f02c3421cb
12 changed files with 84 additions and 26 deletions

View File

@ -21,15 +21,20 @@
<el-button size="small">回复</el-button> <el-button size="small">回复</el-button>
</el-badge> </el-badge>
<el-dropdown text="点我查看" type="text" :icon-separate="false" trigger="click"> <el-dropdown trigger="click">
<el-dropdown-item class="clearfix"> <span class="el-dropdown-link">
评论 点我查看<i class="el-icon-caret-bottom el-icon-right"></i>
<el-badge class="mark" :value="12" /> </span>
</el-dropdown-item> <el-dropdown-menu slot="dropdown">
<el-dropdown-item class="clearfix"> <el-dropdown-item class="clearfix">
回复 评论
<el-badge class="mark" :value="3" /> <el-badge class="mark" :value="12" />
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item class="clearfix">
回复
<el-badge class="mark" :value="3" />
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown> </el-dropdown>
``` ```
::: :::

View File

@ -5,8 +5,12 @@
@b date-picker { @b date-picker {
min-width: 254px; min-width: 254px;
&.has-sidebar.has-time {
min-width: 434px;
}
&.has-sidebar { &.has-sidebar {
min-width: 368px; min-width: 370px;
} }
&.has-time { &.has-time {

View File

@ -2,6 +2,20 @@
@component-namespace el { @component-namespace el {
@b date-range-picker { @b date-range-picker {
min-width: 520px;
&.has-sidebar.has-time {
min-width: 766px;
}
&.has-sidebar {
min-width: 620px;
}
&.has-time {
min-width: 660px;
}
table { table {
table-layout: fixed; table-layout: fixed;
width: 100%; width: 100%;

View File

@ -9,11 +9,6 @@
border-radius: 2px; border-radius: 2px;
line-height: 20px; line-height: 20px;
margin: 5px 0; margin: 5px 0;
min-width: 513px;
&.has-sidebar {
min-width: 620px;
}
@e body, body-wrapper { @e body, body-wrapper {
&::after { &::after {
@ -68,6 +63,7 @@
cursor: pointer; cursor: pointer;
background-color: transparent; background-color: transparent;
outline: none; outline: none;
font-size: 12px;
&[disabled] { &[disabled] {
color: #cccccc; color: #cccccc;

View File

@ -2,7 +2,7 @@
@component-namespace el { @component-namespace el {
@b time-range-picker { @b time-range-picker {
width: 354px; min-width: 354px;
overflow: visible; overflow: visible;
@e content { @e content {

View File

@ -36,6 +36,7 @@
@focus="leftTimePickerVisible = true" @focus="leftTimePickerVisible = true"
@change="handleTimeChange($event, 'min')"/> @change="handleTimeChange($event, 'min')"/>
<time-picker <time-picker
:picker-width="leftPickerWidth"
ref="lefttimepicker" ref="lefttimepicker"
:date="minDate" :date="minDate"
@pick="handleLeftTimePick" @pick="handleLeftTimePick"
@ -46,6 +47,7 @@
<span class="el-icon-arrow-right"></span> <span class="el-icon-arrow-right"></span>
<span class="el-date-range-picker__editors-wrap is-right"> <span class="el-date-range-picker__editors-wrap is-right">
<input <input
ref="leftInput"
placeholder="结束日期" placeholder="结束日期"
class="el-date-range-picker__editor" class="el-date-range-picker__editor"
v-model="rightVisibleDate" v-model="rightVisibleDate"
@ -56,6 +58,7 @@
class="el-date-range-picker__time-picker-wrap" class="el-date-range-picker__time-picker-wrap"
v-clickoutside="closeRightTimePicker"> v-clickoutside="closeRightTimePicker">
<input <input
ref="rightInput"
placeholder="结束时间" placeholder="结束时间"
class="el-date-range-picker__editor" class="el-date-range-picker__editor"
v-model="rightVisibleTime" v-model="rightVisibleTime"
@ -63,6 +66,7 @@
:readonly="!minDate" :readonly="!minDate"
@change="handleTimeChange($event, 'max')" /> @change="handleTimeChange($event, 'max')" />
<time-picker <time-picker
:picker-width="rightPickerWidth"
ref="righttimepicker" ref="righttimepicker"
:date="maxDate" :date="maxDate"
@pick="handleRightTimePick" @pick="handleRightTimePick"
@ -259,6 +263,8 @@
data() { data() {
return { return {
leftPickerWidth: 0,
rightPickerWidth: 0,
date: new Date(), date: new Date(),
minDate: '', minDate: '',
maxDate: '', maxDate: '',
@ -275,11 +281,25 @@
disabledDate: '', disabledDate: '',
leftTimePickerVisible: false, leftTimePickerVisible: false,
rightTimePickerVisible: false, rightTimePickerVisible: false,
width: '' width: 0
}; };
}, },
watch: { watch: {
showTime(val) {
if (!val) return;
this.$nextTick(_ => {
const leftInputElm = this.$refs.leftInput;
const rightInputElm = this.$refs.rightInput;
if (leftInputElm) {
this.leftPickerWidth = leftInputElm.getBoundingClientRect().width + 10;
}
if (rightInputElm) {
this.rightPickerWidth = rightInputElm.getBoundingClientRect().width + 10;
}
});
},
minDate() { minDate() {
this.$nextTick(() => { this.$nextTick(() => {
if (this.maxDate && this.maxDate < this.minDate) { if (this.maxDate && this.maxDate < this.minDate) {

View File

@ -2,7 +2,9 @@
<transition name="md-fade-bottom" @after-leave="$emit('dodestroy')"> <transition name="md-fade-bottom" @after-leave="$emit('dodestroy')">
<div <div
v-show="visible" v-show="visible"
:style="{ width: width + 'px' }" :style="{
width: width + 'px'
}"
class="el-picker-panel el-date-picker" class="el-picker-panel el-date-picker"
:class="{ :class="{
'has-sidebar': $slots.sidebar || shortcuts, 'has-sidebar': $slots.sidebar || shortcuts,
@ -26,6 +28,7 @@
class="el-date-picker__editor"> class="el-date-picker__editor">
<span style="position: relative" v-clickoutside="closeTimePicker"> <span style="position: relative" v-clickoutside="closeTimePicker">
<input <input
ref="input"
@focus="timePickerVisible = true" @focus="timePickerVisible = true"
v-model="visibleTime" v-model="visibleTime"
:placehoder="$t('datepicker.selectTime')" :placehoder="$t('datepicker.selectTime')"
@ -34,6 +37,7 @@
<time-picker <time-picker
ref="timepicker" ref="timepicker"
:date="date" :date="date"
:picker-width="pickerWidth"
@pick="handleTimePick" @pick="handleTimePick"
:visible="timePickerVisible"> :visible="timePickerVisible">
</time-picker> </time-picker>
@ -120,6 +124,16 @@
export default { export default {
watch: { watch: {
showTime(val) {
if (!val) return;
this.$nextTick(_ => {
const inputElm = this.$refs.input;
if (inputElm) {
this.pickerWidth = inputElm.getBoundingClientRect().width + 10;
}
});
},
value(newVal) { value(newVal) {
if (this.selectionMode === 'day' && newVal instanceof Date) { if (this.selectionMode === 'day' && newVal instanceof Date) {
this.date = newVal; this.date = newVal;
@ -333,6 +347,7 @@
data() { data() {
return { return {
pickerWidth: 0,
date: new Date(), date: new Date(),
value: '', value: '',
showTime: false, showTime: false,
@ -345,7 +360,7 @@
month: null, month: null,
week: null, week: null,
timePickerVisible: false, timePickerVisible: false,
width: '' width: 0
}; };
}, },

View File

@ -93,7 +93,7 @@
minSeconds: minTime.getSeconds(), minSeconds: minTime.getSeconds(),
format: 'HH:mm:ss', format: 'HH:mm:ss',
visible: false, visible: false,
width: '' width: 0
}; };
}, },

View File

@ -93,7 +93,7 @@
value: '', value: '',
visible: false, visible: false,
minTime: '', minTime: '',
width: '' width: 0
}; };
}, },

View File

@ -40,12 +40,12 @@
}, },
props: { props: {
pickerWidth: {},
date: { date: {
default() { default() {
return new Date(); return new Date();
} }
}, },
visible: Boolean visible: Boolean
}, },
@ -54,6 +54,10 @@
this.currentVisible = val; this.currentVisible = val;
}, },
pickerWidth(val) {
this.width = val;
},
value(newVal) { value(newVal) {
let date; let date;
if (newVal instanceof Date) { if (newVal instanceof Date) {
@ -83,7 +87,7 @@
selectableRange: [], selectableRange: [],
currentDate: this.$options.defaultValue || this.date, currentDate: this.$options.defaultValue || this.date,
currentVisible: this.visible, currentVisible: this.visible,
width: '' width: this.pickerWidth || 0
}; };
}, },

View File

@ -22,7 +22,7 @@
}, },
mounted() { mounted() {
this.popperElm = this.$el; this.$parent.popperElm = this.popperElm = this.$el;
this.referenceElm = this.$parent.$el; this.referenceElm = this.$parent.$el;
}, },

View File

@ -60,8 +60,8 @@ export default {
data() { data() {
return { return {
index: -1, index: -1,
style: { width: 0, height: 0 }, style: { width: '', height: '' },
lineStyle: { width: 0, height: 0 }, lineStyle: { width: '', height: '' },
mainOffset: 0, mainOffset: 0,
currentStatus: this.status currentStatus: this.status
}; };