Merge branch 'master' into fix/time-picker-scrollbar

pull/744/head
qingwei.li 2016-10-31 20:52:43 +08:00
commit 72bb5899e5
29 changed files with 472 additions and 357 deletions

View File

@ -1,12 +1,15 @@
## 更新日志 ## 更新日志
### 1.0.0-rc.9 ### 1.0.0-rc.9
*2016-11-xx*
*2016-11-XX*
- 新增 MessageBox 确定按钮自动获取焦点, #721 - 新增 MessageBox 确定按钮自动获取焦点, #721
- 修复 Popover focus 失效, #734 - 修复 Popover focus 失效, #734
- 修复 Clickoutside 报错, #729 - 修复 Clickoutside 报错, #729
- 修复 DatePicker 选择日期范围时当选中同一天再调整时间会出错 - 修复 DatePicker 选择日期范围时当选中同一天再调整时间会出错
- 更新 TimePicker 滚动条在 IE10+ 下隐藏 - 更新 TimePicker 滚动条在 IE10+ 下隐藏
- 新增 Dropdown 新增 command api #432
### 1.0.0-rc.8 ### 1.0.0-rc.8

View File

@ -1,6 +1,7 @@
# Element # Element
[![Build Status](https://travis-ci.org/ElemeFE/element.svg?branch=master)](https://travis-ci.org/ElemeFE/element) [![Build Status](https://travis-ci.org/ElemeFE/element.svg?branch=master)](https://travis-ci.org/ElemeFE/element)
[![Coverage Status](https://coveralls.io/repos/github/ElemeFE/element/badge.svg?branch=master)](https://coveralls.io/github/ElemeFE/element?branch=master) [![Coverage Status](https://coveralls.io/repos/github/ElemeFE/element/badge.svg?branch=master)](https://coveralls.io/github/ElemeFE/element?branch=master)
[![CDNJS](https://img.shields.io/cdnjs/v/element-ui.svg)](https://cdnjs.com/libraries/element-ui)
[![npm package](https://img.shields.io/npm/v/element-ui.svg)](https://www.npmjs.org/package/element-ui) [![npm package](https://img.shields.io/npm/v/element-ui.svg)](https://www.npmjs.org/package/element-ui)
[![NPM downloads](http://img.shields.io/npm/dm/element-ui.svg)](https://npmjs.org/package/element-ui) [![NPM downloads](http://img.shields.io/npm/dm/element-ui.svg)](https://npmjs.org/package/element-ui)
![JS gzip size](http://img.badgesize.io/https://unpkg.com/element-ui@next/lib/index.js?compression=gzip&label=gzip%20size:%20JS) ![JS gzip size](http://img.badgesize.io/https://unpkg.com/element-ui@next/lib/index.js?compression=gzip&label=gzip%20size:%20JS)

View File

@ -108,38 +108,11 @@
``` ```
::: :::
### 可切换值的多选框
多选框单独时,除了可以表示为是否选中的逻辑值以外,你还可以设定其选中和未选中所表示的值。
:::demo 使用`true-label`和`false-label`可以自定义选中时和未选中时的值,可以为`String`或`Number`类型。
```html
<template>
<el-checkbox
v-model="isValid"
true-label="可用"
false-label="不可用">
{{isValid}}
</el-checkbox>
</template>
<script>
export default {
data() {
return {
isValid: '可用'
};
}
};
</script>
```
:::
### Checkbox Attributes ### Checkbox Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 | | 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---------- |-------- |---------- |------------- |-------- | |---------- |-------- |---------- |------------- |-------- |
| label | 选中状态的值(只有在`checkbox-group`下有意义) | string | — | — | | label | 选中状态的值(只有在`checkbox-group`或者绑定对象类型为`array`时有效)| string | — | — |
| true-label | 选中时的值 | string, number | | — | | true-label | 选中时的值 | string, number | — | — |
| false-label | 没有选中时的值 | string, number | — | — | | false-label | 没有选中时的值 | string, number | — | — |
| disabled | 按钮禁用 | boolean | — | false | | disabled | 按钮禁用 | boolean | — | false |
| checked | 当前是否勾选 | boolean | — | false | | checked | 当前是否勾选 | boolean | — | false |

View File

@ -148,7 +148,7 @@
::: :::
### Attributes ### Dropdown Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 | | 参数 | 说明 | 类型 | 可选值 | 默认值 |
|------------- |---------------- |---------------- |---------------------- |-------- | |------------- |---------------- |---------------- |---------------------- |-------- |
| type | 菜单按钮类型,同 Button 组件(只在`split-button`为 true 的情况下有效) | string | — | — | | type | 菜单按钮类型,同 Button 组件(只在`split-button`为 true 的情况下有效) | string | — | — |
@ -157,7 +157,13 @@
| menu-align | 菜单水平对齐方向 | string | start, end | end | | menu-align | 菜单水平对齐方向 | string | start, end | end |
| trigger | 触发下拉的行为 | string | hover, click | hover | | trigger | 触发下拉的行为 | string | hover, click | hover |
### Events ### Dropdown Events
| 事件名称 | 说明 | 回调参数 | | 事件名称 | 说明 | 回调参数 |
|---------- |-------- |---------- | |---------- |-------- |---------- |
| click | `split-button` 为 true 时,点击左侧按钮的回调 | — | | click | `split-button` 为 true 时,点击左侧按钮的回调 | — |
| command | 点击菜单项触发的事件回调 | dropdown-item 的指令 |
### Dropdown Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|------------- |---------------- |---------------- |---------------------- |-------- |
| command | 指令 | string | — | — |

View File

@ -295,7 +295,7 @@
::: demo 在 Form 组件中,每一个表单域由一个 Form-Item 组件构成,表单域中可以放置各种类型的表单控件,包括 Input、Select、Checkbox、Radio、Switch、DatePicker、TimePicker ::: demo 在 Form 组件中,每一个表单域由一个 Form-Item 组件构成,表单域中可以放置各种类型的表单控件,包括 Input、Select、Checkbox、Radio、Switch、DatePicker、TimePicker
```html ```html
<el-form ref="form" :model="form" label-width="80px" @submit.prevent="onSubmit"> <el-form ref="form" :model="form" label-width="80px" @submit.native.prevent="onSubmit">
<el-form-item label="活动名称"> <el-form-item label="活动名称">
<el-input v-model="form.name"></el-input> <el-input v-model="form.name"></el-input>
</el-form-item> </el-form-item>
@ -335,7 +335,7 @@
<el-input type="textarea" v-model="form.desc"></el-input> <el-input type="textarea" v-model="form.desc"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary">立即创建</el-button> <el-button type="primary" native-type="submit">立即创建</el-button>
<el-button @click.native.prevent>取消</el-button> <el-button @click.native.prevent>取消</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -371,7 +371,7 @@
::: demo Form 组件的 `type` 属性可以控制表单的类型,当设为 `inline` 时可以让表单域变为行内的表单域 ::: demo Form 组件的 `type` 属性可以控制表单的类型,当设为 `inline` 时可以让表单域变为行内的表单域
```html ```html
<el-form :inline="true" :model="formInline" @submit.prevent="onSubmit" class="demo-form-inline"> <el-form :inline="true" :model="formInline" @submit.native.prevent="onSubmit" class="demo-form-inline">
<el-form-item> <el-form-item>
<el-input v-model="formInline.user" placeholder="审批人"></el-input> <el-input v-model="formInline.user" placeholder="审批人"></el-input>
</el-form-item><el-form-item> </el-form-item><el-form-item>
@ -380,7 +380,7 @@
<el-option label="区域二" value="beijing"></el-option> <el-option label="区域二" value="beijing"></el-option>
</el-select> </el-select>
</el-form-item><el-form-item> </el-form-item><el-form-item>
<el-button type="primary">查询</el-button> <el-button native-type="submit" type="primary">查询</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<script> <script>
@ -473,7 +473,7 @@
::: demo 通过设置 `label-position` 属性可以改变表单域标签的位置,可选值为 `top`、`left`,当设为 `left` 时标签会变为左对齐 ::: demo 通过设置 `label-position` 属性可以改变表单域标签的位置,可选值为 `top`、`left`,当设为 `left` 时标签会变为左对齐
```html ```html
<el-form :model="formAlignLeft" label-position="left" @submit.prevent="onSubmit" label-width="80px"> <el-form :model="formAlignLeft" label-position="left" @submit.native.prevent="onSubmit" label-width="80px">
<el-form-item label="活动名称"> <el-form-item label="活动名称">
<el-input v-model="formAlignLeft.name"></el-input> <el-input v-model="formAlignLeft.name"></el-input>
</el-form-item> </el-form-item>

View File

@ -306,7 +306,7 @@
适用性较广的基础多选,用 Tag 展示已选项 适用性较广的基础多选,用 Tag 展示已选项
:::demo 为`el-select`设置`nultiple`属性即可启用多选,此时`v-model`的值为当前选中值所组成的数组 :::demo 为`el-select`设置`multiple`属性即可启用多选,此时`v-model`的值为当前选中值所组成的数组
```html ```html
<template> <template>
<el-select v-model="value5" multiple> <el-select v-model="value5" multiple>

View File

@ -924,6 +924,7 @@
| label | 显示的标题 | string | — | — | | label | 显示的标题 | string | — | — |
| prop | 对应列内容的字段名,也可以使用 property 属性 | string | — | — | | prop | 对应列内容的字段名,也可以使用 property 属性 | string | — | — |
| width | 对应列的宽度 | string | — | — | | width | 对应列的宽度 | string | — | — |
| min-width | 对应列的最小宽度,与 width 的区别是 width 是固定的min-width 会把剩余宽度按比例分配给设置了 min-width 的列 | string | — | — |
| fixed | 列是否固定在左侧或者右侧true 表示固定在左侧 | string, boolean | true, left, right | - | | fixed | 列是否固定在左侧或者右侧true 表示固定在左侧 | string, boolean | true, left, right | - |
| sortable | 对应列是否可以排序,如果设置为 'custom',则代表用户希望远程排序,需要监听 Table 的 sort-change 事件 | boolean, string | true, false, 'custom' | false | | sortable | 对应列是否可以排序,如果设置为 'custom',则代表用户希望远程排序,需要监听 Table 的 sort-change 事件 | boolean, string | true, false, 'custom' | false |
| sort-method | 对数据进行排序的时候使用的方法,仅当 sortable 设置为 true 的时候有效 | Function(a, b) | - | - | | sort-method | 对数据进行排序的时候使用的方法,仅当 sortable 设置为 true 的时候有效 | Function(a, b) | - | - |

View File

@ -144,7 +144,7 @@
| with-credentials | 支持发送 cookie 凭证信息 | boolean | — | false | | with-credentials | 支持发送 cookie 凭证信息 | boolean | — | false |
| show-upload-list | 是否显示已上传文件列表 | boolean | — | true | | show-upload-list | 是否显示已上传文件列表 | boolean | — | true |
| type | 上传控件类型 | string | select,drag | select | | type | 上传控件类型 | string | select,drag | select |
| accept | 可选参数, 接受上传的[文件类型](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), 拖拽文件上传时不受此参数影响 | string | — | — | | accept | 可选参数, 接受上传的[文件类型](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept)thumbnail-mode 模式下此参数无效)| string | — | — |
| on-preview | 可选参数, 点击已上传的文件链接时的钩子 | function(file) | — | — | | on-preview | 可选参数, 点击已上传的文件链接时的钩子 | function(file) | — | — |
| on-remove | 可选参数, 文件列表移除文件时的钩子 | function(file, fileList) | — | — | | on-remove | 可选参数, 文件列表移除文件时的钩子 | function(file, fileList) | — | — |
| on-success | 可选参数, 文件上传成功时的钩子 | function(file, fileList) | — | — | | on-success | 可选参数, 文件上传成功时的钩子 | function(file, fileList) | — | — |

View File

@ -24,7 +24,7 @@
<input <input
:placeholder="$t('el.datepicker.startDate')" :placeholder="$t('el.datepicker.startDate')"
class="el-date-range-picker__editor" class="el-date-range-picker__editor"
:value="leftVisibleDate" :value="minVisibleDate"
@input="handleDateInput($event, 'min')" @input="handleDateInput($event, 'min')"
@change="handleDateChange($event, 'min')"/> @change="handleDateChange($event, 'min')"/>
</span> </span>
@ -32,15 +32,15 @@
<input <input
:placeholder="$t('el.datepicker.startTime')" :placeholder="$t('el.datepicker.startTime')"
class="el-date-range-picker__editor" class="el-date-range-picker__editor"
:value="leftVisibleTime" :value="minVisibleTime"
@focus="leftTimePickerVisible = !leftTimePickerVisible" @focus="minTimePickerVisible = !minTimePickerVisible"
@change="handleTimeChange($event, 'min')"/> @change="handleTimeChange($event, 'min')"/>
<time-picker <time-picker
:picker-width="leftPickerWidth" :picker-width="minPickerWidth"
ref="lefttimepicker" ref="minTimePicker"
:date="minDate" :date="minDate"
@pick="handleLeftTimePick" @pick="handleMinTimePick"
:visible="leftTimePickerVisible"> :visible="minTimePickerVisible">
</time-picker> </time-picker>
</span> </span>
</span> </span>
@ -48,29 +48,29 @@
<span class="el-date-range-picker__editors-wrap is-right"> <span class="el-date-range-picker__editors-wrap is-right">
<span class="el-date-range-picker__time-picker-wrap"> <span class="el-date-range-picker__time-picker-wrap">
<input <input
ref="leftInput" ref="minInput"
:placeholder="$t('el.datepicker.endDate')" :placeholder="$t('el.datepicker.endDate')"
class="el-date-range-picker__editor" class="el-date-range-picker__editor"
:value="rightVisibleDate" :value="maxVisibleDate"
:readonly="!minDate" :readonly="!minDate"
@input="handleDateInput($event, 'max')" @input="handleDateInput($event, 'max')"
@change="handleDateChange($event, 'max')" /> @change="handleDateChange($event, 'max')" />
</span> </span>
<span class="el-date-range-picker__time-picker-wrap"> <span class="el-date-range-picker__time-picker-wrap">
<input <input
ref="rightInput" ref="maxInput"
:placeholder="$t('el.datepicker.endTime')" :placeholder="$t('el.datepicker.endTime')"
class="el-date-range-picker__editor" class="el-date-range-picker__editor"
:value="rightVisibleTime" :value="maxVisibleTime"
@focus="minDate && (rightTimePickerVisible = !rightTimePickerVisible)" @focus="minDate && (maxTimePickerVisible = !maxTimePickerVisible)"
:readonly="!minDate" :readonly="!minDate"
@change="handleTimeChange($event, 'max')" /> @change="handleTimeChange($event, 'max')" />
<time-picker <time-picker
:picker-width="rightPickerWidth" :picker-width="maxPickerWidth"
ref="righttimepicker" ref="maxTimePicker"
:date="maxDate" :date="maxDate"
@pick="handleRightTimePick" @pick="handleMaxTimePick"
:visible="rightTimePickerVisible"></time-picker> :visible="maxTimePickerVisible"></time-picker>
</span> </span>
</span> </span>
</div> </div>
@ -126,9 +126,9 @@
</div> </div>
</div> </div>
<div class="el-picker-panel__footer" v-if="showTime"> <div class="el-picker-panel__footer" v-if="showTime">
<!-- <a <a
class="el-picker-panel__link-btn" class="el-picker-panel__link-btn"
@click="changeToToday">{{ $t('el.datepicker.now') }}</a> --> @click="handleClear">{{ $t('el.datepicker.clear') }}</a>
<button <button
type="button" type="button"
class="el-picker-panel__btn" class="el-picker-panel__btn"
@ -175,19 +175,19 @@
return this.rightDate.getMonth(); return this.rightDate.getMonth();
}, },
leftVisibleDate() { minVisibleDate() {
return formatDate(this.minDate); return formatDate(this.minDate);
}, },
rightVisibleDate() { maxVisibleDate() {
return formatDate(this.maxDate || this.minDate); return formatDate(this.maxDate || this.minDate);
}, },
leftVisibleTime() { minVisibleTime() {
return formatDate(this.minDate, 'HH:mm:ss'); return formatDate(this.minDate, 'HH:mm:ss');
}, },
rightVisibleTime() { maxVisibleTime() {
return formatDate(this.maxDate, 'HH:mm:ss'); return formatDate(this.maxDate, 'HH:mm:ss');
}, },
@ -208,8 +208,8 @@
data() { data() {
return { return {
leftPickerWidth: 0, minPickerWidth: 0,
rightPickerWidth: 0, maxPickerWidth: 0,
date: new Date(), date: new Date(),
minDate: '', minDate: '',
maxDate: '', maxDate: '',
@ -224,8 +224,8 @@
value: '', value: '',
visible: '', visible: '',
disabledDate: '', disabledDate: '',
leftTimePickerVisible: false, minTimePickerVisible: false,
rightTimePickerVisible: false, maxTimePickerVisible: false,
width: 0 width: 0
}; };
}, },
@ -234,13 +234,13 @@
showTime(val) { showTime(val) {
if (!val) return; if (!val) return;
this.$nextTick(_ => { this.$nextTick(_ => {
const leftInputElm = this.$refs.leftInput; const minInputElm = this.$refs.minInput;
const rightInputElm = this.$refs.rightInput; const maxInputElm = this.$refs.maxInput;
if (leftInputElm) { if (minInputElm) {
this.leftPickerWidth = leftInputElm.getBoundingClientRect().width + 10; this.minPickerWidth = minInputElm.getBoundingClientRect().width + 10;
} }
if (rightInputElm) { if (maxInputElm) {
this.rightPickerWidth = rightInputElm.getBoundingClientRect().width + 10; this.maxPickerWidth = maxInputElm.getBoundingClientRect().width + 10;
} }
}); });
}, },
@ -248,17 +248,24 @@
minDate() { minDate() {
this.$nextTick(() => { this.$nextTick(() => {
if (this.maxDate && this.maxDate < this.minDate) { if (this.maxDate && this.maxDate < this.minDate) {
this.maxDate = null; const format = 'HH:mm:ss';
this.$refs.maxTimePicker.selectableRange = [
[
parseDate(formatDate(this.minDate, format), format),
parseDate('23:59:59', format)
]
];
} }
}); });
}, },
leftTimePickerVisible(val) { minTimePickerVisible(val) {
if (val) this.$nextTick(() => this.$refs.lefttimepicker.ajustScrollTop()); if (val) this.$nextTick(() => this.$refs.minTimePicker.ajustScrollTop());
}, },
rightTimePickerVisible(val) { maxTimePickerVisible(val) {
if (val) this.$nextTick(() => this.$refs.righttimepicker.ajustScrollTop()); if (val) this.$nextTick(() => this.$refs.maxTimePicker.ajustScrollTop());
}, },
value(newVal) { value(newVal) {
@ -273,6 +280,12 @@
}, },
methods: { methods: {
handleClear() {
this.minDate = '';
this.maxDate = '';
this.handleConfirm();
},
handleDateInput(event, type) { handleDateInput(event, type) {
const value = event.target.value; const value = event.target.value;
const parsedValue = parseDate(value, 'yyyy-MM-dd'); const parsedValue = parseDate(value, 'yyyy-MM-dd');
@ -341,10 +354,8 @@
this.maxDate = new Date(target.getTime()); this.maxDate = new Date(target.getTime());
} }
} }
const l2r = type === 'min' ? 'left' : 'right'; this.$refs[type + 'TimePicker'].value = target;
this[type + 'TimePickerVisible'] = false;
this.$refs[l2r + 'timepicker'].value = target;
this[l2r + 'TimePickerVisible'] = false;
} }
}, },
@ -372,8 +383,8 @@
}, },
resetView() { resetView() {
this.leftTimePickerVisible = false; this.minTimePickerVisible = false;
this.rightTimePickerVisible = false; this.maxTimePickerVisible = false;
}, },
setTime(date, value) { setTime(date, value) {
@ -387,18 +398,18 @@
return new Date(oldDate.getTime()); return new Date(oldDate.getTime());
}, },
handleLeftTimePick(value, visible, first) { handleMinTimePick(value, visible, first) {
this.minDate = this.minDate || new Date(); this.minDate = this.minDate || new Date();
if (value) { if (value) {
this.minDate = this.setTime(this.minDate, value); this.minDate = this.setTime(this.minDate, value);
} }
if (!first) { if (!first) {
this.leftTimePickerVisible = visible; this.minTimePickerVisible = visible;
} }
}, },
handleRightTimePick(value, visible, first) { handleMaxTimePick(value, visible, first) {
if (!this.maxDate) { if (!this.maxDate) {
const now = new Date(); const now = new Date();
if (now >= this.minDate) { if (now >= this.minDate) {
@ -411,7 +422,7 @@
} }
if (!first) { if (!first) {
this.rightTimePickerVisible = visible; this.maxTimePickerVisible = visible;
} }
}, },

View File

@ -9,9 +9,13 @@
mixins: [Emitter], mixins: [Emitter],
props: {
command: String
},
methods: { methods: {
handleClick(e) { handleClick(e) {
this.dispatch('ElDropdown', 'visible', [false]); this.dispatch('ElDropdown', 'menu-item-click', [this.command, this]);
} }
} }
}; };

View File

@ -33,7 +33,7 @@
}, },
mounted() { mounted() {
this.$on('visible', value => { this.visible = value; }); this.$on('menu-item-click', this.handleMenuItemClick);
this.initEvent(); this.initEvent();
}, },
@ -76,6 +76,10 @@
} else if (trigger === 'click') { } else if (trigger === 'click') {
triggerElm.addEventListener('click', handleClick); triggerElm.addEventListener('click', handleClick);
} }
},
handleMenuItemClick(command, instance) {
this.visible = false;
this.$emit('command', command, instance);
} }
}, },

View File

@ -309,8 +309,10 @@ export default {
/* istanbul ignore if */ /* istanbul ignore if */
if (newVal > 0 && this.internalCurrentPage === 0) { if (newVal > 0 && this.internalCurrentPage === 0) {
this.internalCurrentPage = 1; this.internalCurrentPage = 1;
this.$emit('current-change', 1);
} else if (this.internalCurrentPage > newVal) { } else if (this.internalCurrentPage > newVal) {
this.internalCurrentPage = newVal; this.internalCurrentPage = newVal;
this.$emit('current-change', newVal);
} }
}, },

View File

@ -5,12 +5,12 @@
@b alert { @b alert {
width: 100%; width: 100%;
padding: 8px 16px; padding: var(--alert-padding);
margin: 0; margin: 0;
box-sizing: border-box; box-sizing: border-box;
border-radius: 4px; border-radius: var(--alert-border-radius);
position: relative; position: relative;
background-color: #fff; background-color: var(--color-white);
overflow: hidden; overflow: hidden;
color: #fff; color: #fff;
opacity: 1; opacity: 1;
@ -18,19 +18,19 @@
transition: opacity .2s; transition: opacity .2s;
@modifier success { @modifier success {
background-color: var(--color-success); background-color: var(--alert-success-color);
} }
@modifier info { @modifier info {
background-color: var(--color-info); background-color: var(--alert-info-color);
} }
@modifier warning { @modifier warning {
background-color: var(--color-warning); background-color: var(--alert-warning-color);
} }
@modifier error { @modifier error {
background-color: var(--color-danger); background-color: var(--alert-danger-color);
} }
@e content { @e content {
@ -39,19 +39,19 @@
} }
@e icon { @e icon {
font-size: 16px; font-size: var(--alert-icon-size);
width: 16px; width: var(--alert-icon-size);
display: table-cell; display: table-cell;
color: #fff; color: var(--color-white);
vertical-align: middle; vertical-align: middle;
@when big { @when big {
font-size: 28px; font-size: var(--alert-icon-large-size);
width: 28px; width: var(--alert-icon-large-size);
} }
} }
@e title { @e title {
font-size: 13px; font-size: var(--alert-title-font-size);
line-height: 18px; line-height: 18px;
@when bold { @when bold {
font-weight: bold; font-weight: bold;
@ -60,12 +60,12 @@
& .el-alert__description { & .el-alert__description {
color: #fff; color: #fff;
font-size: 12px; font-size: var(--alert-description-font-size-font-size);
margin: 5px 0 0 0; margin: 5px 0 0 0;
} }
@e closebtn { @e closebtn {
font-size: 12px; font-size: var(--alert-close-font-size);
color: #fff; color: #fff;
opacity: 1; opacity: 1;
position: absolute 12px 15px * *; position: absolute 12px 15px * *;
@ -73,7 +73,7 @@
@when customed { @when customed {
font-style: normal; font-style: normal;
font-size: 13px; font-size: var(--alert-close-customed-font-size);
top: 9px; top: 9px;
} }
} }

View File

@ -1,7 +1,6 @@
:root { :root {
/* /* Transition
Transition
-------------------------- */ -------------------------- */
--fade-transition: opacity 300ms cubic-bezier(0.23, 1, 0.32, 1); --fade-transition: opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
--fade-linear-transition: opacity 200ms linear; --fade-linear-transition: opacity 200ms linear;
@ -33,11 +32,18 @@
--border-width-base: 1px; --border-width-base: 1px;
--border-style-base: solid; --border-style-base: solid;
--border-color-base: var(--color-grey); --border-color-base: var(--color-grey);
--border-color-hover: #8492a6;
--border-base: var(--border-width-base) var(--border-style-base) var(--border-color-base); --border-base: var(--border-width-base) var(--border-style-base) var(--border-color-base);
--border-radius-base: 4px; --border-radius-base: 4px;
--border-radius-small: 2px;
--border-radius-circle: 100%; --border-radius-circle: 100%;
--shadow-base: 0 0 2px rgba(var(--color-black), 0.18), 0 0 1px var(--color-blue-light); --shadow-base: 0 0 2px rgba(var(--color-black), 0.18), 0 0 1px var(--color-blue-light);
/* Box-shadow
-------------------------- */
--box-shadow-base: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
--box-shadow-dark: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .12);
/* Fill /* Fill
-------------------------- */ -------------------------- */
--fill-base: var(--color-white); --fill-base: var(--color-white);
@ -124,6 +130,105 @@
--radio-button-font-size: var(--font-size-base); --radio-button-font-size: var(--font-size-base);
/* Select
-------------------------- */
--select-border-color-hover: var(--border-color-hover);
--select-disabled-border: var(--disabled-border-base);
--select-font-size: var(--font-size-base);
--select-close-hover-color: #99a9bf;
--select-input-color: var(--color-grey);
--select-multiple-input-color: #666;
--select-input-focus-background: #2ea0ff;
--select-input-font-size: 12px;
--select-tag-height: 24px;
--select-tag-color: var(--color-white);
--select-tag-background: var(--color-primary);
--select-option-color: #475669;
--select-option-disabled-color: var(--color-grey);
--select-option-height: 36px;
--select-option-hover-background: #e5e9f2;
--select-option-selected: var(--color-primary);
--select-option-selected-hover: #1D8CE0;
--select-group-color: #999;
--select-group-height: 30px;
--select-group-font-size: 12px;
--select-dropdown-background: var(--color-white);
--select-dropdown-shadow: var(--box-shadow-base);
--select-dropdown-empty-color: #999;
--select-dropdown-max-height: 274px;
--select-dropdown-padding: 6px 0;
--select-dropdown-empty-padding: 10px 0;
--select-dropdown-border: solid 1px #d3dce6;
/* Alert
-------------------------- */
--alert-padding: 8px 16px;
--alert-border-radius: var(--border-radius-base);
--alert-title-font-size: 13px;
--alert-description-font-size: 12px;
--alert-close-font-size: 12px;
--alert-close-customed-font-size: 13px;
--alert-success-color: var(--color-success);
--alert-info-color: var(--color-info);
--alert-warning-color: var(--color-warning);
--alert-danger-color: var(--color-danger);
--alert-icon-size: 16px;
--alert-icon-large-size: 28px;
/* Message Box
-------------------------- */
--msgbox-width: 420px;
--msgbox-border-radius: 3px;
--msgbox-font-size: 16px;
--msgbox-content-font-size: 14px;
--msgbox-content-color: #475669;
--msgbox-error-font-size: 12px;
--msgbox-success-color: var(--color-success);
--msgbox-info-color: var(--color-info);
--msgbox-warning-color: var(--color-warning);
--msgbox-danger-color: var(--color-danger);
/* Message
-------------------------- */
--message-shadow: var(--box-shadow-base);
--message-min-width: 300px;
--message-padding: 10px 12px;
--message-content-color: #8492a6;
--message-close-color: var(--color-grey);
--message-close-hover-color: #99A9BF;
--message-success-color: var(--color-success);
--message-info-color: var(--color-info);
--message-warning-color: var(--color-warning);
--message-danger-color: var(--color-danger);
/* Notification
-------------------------- */
--notification-width: 330px;
--notification-padding: 20px;
--notification-shadow: var(--box-shadow-base);
--notification-icon-size: 40px;
--notification-font-size: var(--font-size-base);
--notification-color: #8492a6;
--notification-title-font-size: 16px;
--notification-title-color: #1f2d3d;
--notification-close-color: var(--color-grey);
--notification-close-hover-color: #99A9BF;
--notification-success-color: var(--color-success);
--notification-info-color: var(--color-info);
--notification-warning-color: var(--color-warning);
--notification-danger-color: var(--color-danger);
/* Input /* Input
-------------------------- */ -------------------------- */
--input-font-size: var(--font-size-base); --input-font-size: var(--font-size-base);
@ -134,7 +239,7 @@
--input-border: var(--border-base); --input-border: var(--border-base);
--input-border-color: var(--border-color-base); --input-border-color: var(--border-color-base);
--input-border-radius: var(--border-radius-base); --input-border-radius: var(--border-radius-base);
--input-border-color-hover: #8492A6; --input-border-color-hover: var(--border-color-hover);
--input-fill: #fff; --input-fill: #fff;
--input-fill-disabled: var(--disabled-fill-base); --input-fill-disabled: var(--disabled-fill-base);
--input-color-disabled: var(--font-color-disabled-base); --input-color-disabled: var(--font-color-disabled-base);
@ -142,7 +247,7 @@
--input-placeholder-color: #99a9bf; --input-placeholder-color: #99a9bf;
--input-max-width: 314px; --input-max-width: 314px;
--input-hover-border: #8492A6; --input-hover-border: var(--border-color-hover);
--input-focus-border: var(--color-primary); --input-focus-border: var(--color-primary);
--input-focus-fill: #fff; --input-focus-fill: #fff;
@ -182,13 +287,6 @@
--cascader-menu-option-pinyin-color: #999; --cascader-menu-option-pinyin-color: #999;
--cascader-menu-submenu-shadow: 1px 1px 2px rgba(var(--color-black), 0.14), 1px 0 2px rgba(var(--color-black), 0.14); --cascader-menu-submenu-shadow: 1px 1px 2px rgba(var(--color-black), 0.14), 1px 0 2px rgba(var(--color-black), 0.14);
/* Tag
-------------------------- */
--tag-color: var(--font-color-base);
--tag-fill: #e2e2e2;
--tag-border-radius: var(--border-radius-base);
--tag-close-color: #666;
/* Group /* Group
-------------------------- */ -------------------------- */
--group-option-flex: 0 0 (1/5) * 100%; --group-option-flex: 0 0 (1/5) * 100%;
@ -279,10 +377,23 @@
--switch-disabled-color: #E5E9F3; --switch-disabled-color: #E5E9F3;
--switch-disabled-text-color: #F9FAFC; --switch-disabled-text-color: #F9FAFC;
--switch-font-size: var(--font-size-base);
--switch-core-border-radius: 12px;
--switch-size: 46px 22px;
--switch-button-size: 16px;
/* Dialog /* Dialog
-------------------------- */ -------------------------- */
--dialog-background-color: var(--color-blue); --dialog-background-color: var(--color-blue);
--dialog-footer-background: var(--color-blue-lighter); --dialog-footer-background: var(--color-blue-lighter);
--dialog-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
--dialog-tiny-width: 30%;
--dialog-small-width: 50%;
--dialog-large-width: 90%;
--dialog-close-color: var(--color-grey);
--dialog-close-hover-color: var(--color-primary);
--dialog-title-font-size: 16px;
--dialog-font-size: 14px;
/* Table /* Table
-------------------------- */ -------------------------- */
@ -297,7 +408,6 @@
--pagination-color: #475669; --pagination-color: #475669;
--pagination-border-radius: 2px; --pagination-border-radius: 2px;
--pagination-button-color: #99a9bf; --pagination-button-color: #99a9bf;
--pagination-button-disabled-color: #D3DCE6;
--pagination-button-size: 28px; --pagination-button-size: 28px;
--pagination-button-disabled-color: #e4e4e4; --pagination-button-disabled-color: #e4e4e4;
--pagination-button-disabled-fill: var(--color-white); --pagination-button-disabled-fill: var(--color-white);
@ -316,7 +426,7 @@
--popover-title-color: #1f2d3d; --popover-title-color: #1f2d3d;
/* Tooltip /* Tooltip
-------------------------- */ -------------------------- */
--tooltip-fill: #1f2d3d; --tooltip-fill: #1f2d3d;
--tooltip-color: #fff; --tooltip-color: #fff;
--tooltip-font-size: 12px; --tooltip-font-size: 12px;
@ -325,77 +435,93 @@
--tooltip-padding: 10px; --tooltip-padding: 10px;
/* Tag /* Tag
-------------------------- */ -------------------------- */
--tag-padding: 0 5px; --tag-padding: 0 5px;
--tag-fill: #8492a6; --tag-fill: #8492a6;
--tag-border: #8492a6; --tag-border: #8492a6;
--tag-color: #fff; --tag-color: #fff;
--tag-font-size: 12px; --tag-close-color: #666;
--tag-border-radius: 4px; --tag-font-size: 12px;
--tag-border-radius: 4px;
--tag-gray-fill: #e5e9f2; --tag-gray-fill: #e5e9f2;
--tag-gray-border: #e5e9f2; --tag-gray-border: #e5e9f2;
--tag-gray-color: #475669; --tag-gray-color: #475669;
--tag-primary-fill: rgba(32,159,255,0.10); --tag-primary-fill: rgba(32,159,255,0.10);
--tag-primary-border: rgba(32,159,255,0.20); --tag-primary-border: rgba(32,159,255,0.20);
--tag-primary-color: #20a0ff; --tag-primary-color: #20a0ff;
--tag-success-fill: rgba(18,206,102,0.10); --tag-success-fill: rgba(18,206,102,0.10);
--tag-success-border: rgba(18,206,102,0.20); --tag-success-border: rgba(18,206,102,0.20);
--tag-success-color: #13ce66; --tag-success-color: #13ce66;
--tag-warning-fill: rgba(247,186,41,0.10); --tag-warning-fill: rgba(247,186,41,0.10);
--tag-warning-border: rgba(247,186,41,0.20); --tag-warning-border: rgba(247,186,41,0.20);
--tag-warning-color: #f7ba2a; --tag-warning-color: #f7ba2a;
--tag-danger-fill: rgba(255,73,73,0.10); --tag-danger-fill: rgba(255,73,73,0.10);
--tag-danger-border: rgba(255,73,73,0.20); --tag-danger-border: rgba(255,73,73,0.20);
--tag-danger-color: #ff4949; --tag-danger-color: #ff4949;
/* Dropdown /* Dropdown
-------------------------- */ -------------------------- */
--dropdown-menu-box-shadow: 0 0 6px 0 rgba(0,0,0,.12), 0 2px 4px 0 rgba(0,0,0,.12); --dropdown-menu-box-shadow: var(--box-shadow-dark);
--dropdown-menuItem-hover-fill: #e5e9f2; --dropdown-menuItem-hover-fill: #e5e9f2;
--dropdown-menuItem-hover-color: #475669; --dropdown-menuItem-hover-color: #475669;
/* Badge /* Badge
-------------------------- */ -------------------------- */
--badge-fill: var(--color-danger); --badge-fill: var(--color-danger);
--badge-radius: 10px; --badge-radius: 10px;
--badge-font-size: 12px; --badge-font-size: 12px;
--badge-padding: 6px; --badge-padding: 6px;
--badge-size: 18px; --badge-size: 18px;
/*Card /* Card
--------------------------*/ --------------------------*/
--card-border-color: var(--disabled-border-base); --card-border-color: var(--disabled-border-base);
--card-border-radius: 4px; --card-border-radius: 4px;
--card-padding: 20px; --card-padding: 20px;
/*Slider /* Slider
--------------------------*/ --------------------------*/
--slider-main-background-color: var(--color-primary); --slider-main-background-color: var(--color-primary);
--slider-runway-background-color: #e5e9f2; --slider-runway-background-color: #e5e9f2;
--slider-button-hover-color: #1d8ce0; --slider-button-hover-color: #1d8ce0;
--slider-stop-background-color: #c0ccda; --slider-stop-background-color: var(--color-grey);
--slider-disable-color: #c0ccda; --slider-disable-color: var(--color-grey);
/*Steps --slider-margin: 20px 0;
--------------------------*/ --slider-border-radius: 3px;
--steps-border-color: var(--disabled-border-base); --slider-height: 4px;
--steps-border-radius: 4px; --slider-button-size: 12px;
--steps-padding: 20px; --slider-button-wrapper-size: 36px;
--slider-button-wrapper-offset: -16px;
/*Steps /* Steps
--------------------------*/ --------------------------*/
--menu-item-color: #475669; --steps-border-color: var(--disabled-border-base);
--menu-item-fill: #eff2f7; --steps-border-radius: 4px;
--menu-item-hover-fill: #d3dce6; --steps-padding: 20px;
--submenu-item-fill: #e5e9f2;
--dark-menu-item-color: #475669; /* Steps
--dark-menu-item-fill: #324057; --------------------------*/
--dark-menu-item-hover-fill: #475669; --menu-item-color: #475669;
--dark-submenu-item-fill: #1f2d3d; --menu-item-fill: #eff2f7;
--menu-item-hover-fill: #d3dce6;
--submenu-item-fill: #e5e9f2;
--dark-menu-item-color: #475669;
--dark-menu-item-fill: #324057;
--dark-menu-item-hover-fill: #475669;
--dark-submenu-item-fill: #1f2d3d;
/* Rate
--------------------------*/
--rate-height: 20px;
--rate-font-size: var(--font-size-base);
--rate-icon-size: 18px;
--rate-icon-margin: 6px;
--rate-icon-color: #C6D1DE;
} }

View File

@ -9,20 +9,20 @@
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
background: #fff; background: #fff;
border-radius: 2px; border-radius: var(--border-radius-small);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); box-shadow: var(--dialog-box-shadow);
box-sizing: border-box; box-sizing: border-box;
@modifier tiny { @modifier tiny {
width: 30%; width: var(--dialog-tiny-width);
} }
@modifier small { @modifier small {
width: 50%; width: var(--dialog-small-width);
} }
@modifier large { @modifier large {
width: 90%; width: var(--dialog-large-width);
} }
@modifier full { @modifier full {
@ -44,16 +44,16 @@
@e close { @e close {
cursor: pointer; cursor: pointer;
color: #C0CCDA; color: var(--dialog-close-color);
&:hover { &:hover {
color: var(--color-primary); color: var(--dialog-close-hover-color);
} }
} }
@e title { @e title {
line-height: 1; line-height: 1;
font-size: 16px; font-size: var(--dialog-title-font-size);
font-weight: bold; font-weight: bold;
color: #1f2d3d; color: #1f2d3d;
} }
@ -61,7 +61,7 @@
@e body { @e body {
padding: 30px 20px; padding: 30px 20px;
color: #475669; color: #475669;
font-size: 14px; font-size: var(--dialog-font-size);
} }
@e headerbtn { @e headerbtn {

View File

@ -12,9 +12,9 @@
left: 50%; left: 50%;
transform: translate3d(-50%, -50%, 0); transform: translate3d(-50%, -50%, 0);
background-color: #fff; background-color: #fff;
width: 420px; width: var(--msgbox-width);
border-radius: 3px; border-radius: var(--msgbox-border-radius);
font-size: 16px; font-size: var(--msgbox-font-size);
-webkit-user-select: none; -webkit-user-select: none;
overflow: hidden; overflow: hidden;
backface-visibility: hidden; backface-visibility: hidden;
@ -25,8 +25,8 @@
@e content { @e content {
padding: 30px 20px; padding: 30px 20px;
color: #475669; color: var(--msgbox-content-color);
font-size: 14px; font-size: var(--msgbox-content-font-size);
position: relative; position: relative;
} }
@ -48,16 +48,16 @@
@e input { @e input {
padding-top: 15px; padding-top: 15px;
& input.invalid { & input.invalid {
border-color: #ff4949; border-color: var(--color-danger);
&:focus { &:focus {
border-color: #ff4949; border-color: var(--color-danger);
} }
} }
} }
@e errormsg { @e errormsg {
color: red; color: var(--color-danger);
font-size: 12px; font-size: var(--msgbox-error-font-size);
min-height: 18px; min-height: 18px;
margin-top: 2px; margin-top: 2px;
} }
@ -65,7 +65,7 @@
@e title { @e title {
padding-left: 0; padding-left: 0;
margin-bottom: 0; margin-bottom: 0;
font-size: 16px; font-size: var(--msgbox-font-size);
font-weight: bold; font-weight: bold;
height: 18px; height: 18px;
color: #333; color: #333;
@ -100,19 +100,19 @@
font-size: 36px !important; font-size: 36px !important;
&.el-icon-circle-check { &.el-icon-circle-check {
color: #13ce66; color: var(--msgbox-success-color);
} }
&.el-icon-information { &.el-icon-information {
color: #50bfff; color: var(--msgbox-info-color);
} }
&.el-icon-warning { &.el-icon-warning {
color: #f7ba2a; color: var(--msgbox-warning-color);
} }
&.el-icon-circle-cross { &.el-icon-circle-cross {
color: #ff4949; color: var(--msgbox-error-color);
} }
} }
} }

View File

@ -4,11 +4,11 @@
@component-namespace el { @component-namespace el {
@b message { @b message {
box-shadow:0 2px 4px 0 rgba(0, 0, 0, .12), 0 0 6px 0 rgba(0, 0, 0, .04); box-shadow: var(--message-shadow);
min-width: 300px; min-width: var(--message-min-width);
padding: 10px 12px; padding: var(--message-padding);
box-sizing: border-box; box-sizing: border-box;
border-radius: 2px; border-radius: var(--border-radius-small);
position: fixed; position: fixed;
left: 50%; left: 50%;
top: 20px; top: 20px;
@ -23,11 +23,11 @@
position: relative; position: relative;
& p { & p {
font-size: 14px; font-size: var(--font-size-base);
line-height: 20px; line-height: 20px;
margin: 0 34px 0 0; margin: 0 34px 0 0;
white-space: nowrap; white-space: nowrap;
color: #8492a6; color: var(--message-content-color);
text-align: justify; text-align: justify;
} }
} }
@ -42,28 +42,28 @@
@e closeBtn { @e closeBtn {
position: absolute 3px 0 * *; position: absolute 3px 0 * *;
cursor: pointer; cursor: pointer;
color: #C0CCDA; color: var(--message-close-color);
font-size: 14px; font-size: var(--font-size-base);
&:hover { &:hover {
color: #99A9BF; color: var(--message-close-hover-color);
} }
} }
& .el-icon-circle-check { & .el-icon-circle-check {
color: #13ce66; color: var(--message-success-color);
} }
& .el-icon-circle-cross { & .el-icon-circle-cross {
color: #ff4949; color: var(--message-danger-color);
} }
& .el-icon-information { & .el-icon-information {
color: #50bfff; color: var(--message-info-color);
} }
& .el-icon-warning { & .el-icon-warning {
color: #f7ba2a; color: var(--message-warning-color);
} }
} }

View File

@ -4,36 +4,36 @@
@component-namespace el { @component-namespace el {
@b notification { @b notification {
width: 330px; width: var(--notification-width);
padding: 20px; padding: var(--notification-padding);
box-sizing: border-box; box-sizing: border-box;
border-radius: 2px; border-radius: var(--border-radius-small);
position: fixed; position: fixed;
right: 16px; right: 16px;
background-color: #fff; background-color: #fff;
box-shadow: 0 0 6px rgba(0, 0, 0, .04), 0 2px 4px rgba(0, 0, 0, .12); box-shadow: var(--notification-shadow);
transition: opacity 0.3s, transform .3s, right .3s, top 0.4s; transition: opacity 0.3s, transform .3s, right .3s, top 0.4s;
overflow: hidden; overflow: hidden;
z-index: var(--index-popper); z-index: var(--index-popper);
@e group { @e group {
& span { & span {
font-size: 16px; font-size: var(--notification-title-font-size);
color: #1f2d3d; color: var(--notification-title-color);
} }
& p { & p {
font-size: 14px; font-size: var(--notification-font-size);
line-height: 21px; line-height: 21px;
margin: 10px 0 0 0; margin: 10px 0 0 0;
color: #8492a6; color: var(--notification-color);
text-align: justify; text-align: justify;
} }
} }
@e icon { @e icon {
size: 40px; size: var(--notification-icon-size);
font-size: 40px; font-size: var(--notification-icon-size);
float: left; float: left;
position: relative; position: relative;
top: 3px; top: 3px;
@ -42,28 +42,28 @@
@e closeBtn { @e closeBtn {
position: absolute 20px 20px * *; position: absolute 20px 20px * *;
cursor: pointer; cursor: pointer;
color: #C0CCDA; color: var(--notification-close-color);
font-size: 14px; font-size: var(--notification-font-size);
&:hover { &:hover {
color: #99A9BF; color: var(--notification-close-hover-color);
} }
} }
& .el-icon-circle-check { & .el-icon-circle-check {
color: #13ce66; color: var(--notification-success-color);
} }
& .el-icon-circle-cross { & .el-icon-circle-cross {
color: #ff4949; color: var(--notification-danger-color);
} }
& .el-icon-information { & .el-icon-information {
color: #50bfff; color: var(--notification-info-color);
} }
& .el-icon-warning { & .el-icon-warning {
color: #f7ba2a; color: var(--notification-warning-color);
} }
} }

View File

@ -15,10 +15,10 @@
@e title { @e title {
padding-left: 10px; padding-left: 10px;
font-size: 12px; font-size: var(--select-group-font-size);
color: #999; color: var(--select-group-color);
height: 30px; height: var(--select-group-height);
line-height: 30px; line-height: var(--select-group-height);
} }
& .el-select-dropdown__item { & .el-select-dropdown__item {

View File

@ -5,37 +5,37 @@
@b select-dropdown { @b select-dropdown {
@e item { @e item {
font-size: 14px; font-size: var(--select-font-size);
padding: 8px 10px; padding: 8px 10px;
position: relative; position: relative;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
color: #475669; color: var(--select-option-color);
height: 36px; height: var(--select-option-height);
line-height: 1.5; line-height: 1.5;
box-sizing: border-box; box-sizing: border-box;
cursor: pointer; cursor: pointer;
@when disabled { @when disabled {
color: #c0ccda; color: var(--select-option-disabled-color);
cursor: not-allowed; cursor: not-allowed;
&:hover { &:hover {
background-color: #fff; background-color: var(--color-white);
} }
} }
&.hover { &.hover {
background-color: #e5e9f2; background-color: var(--select-option-hover-background);
} }
&.selected { &.selected {
color: #fff; color: var(--color-white);
background-color: #20A0FF; background-color: var(--select-option-selected);
&.hover { &.hover {
background-color: #1D8CE0; background-color: var(--select-option-selected-hover);
} }
} }

View File

@ -4,7 +4,7 @@
@component-namespace el { @component-namespace el {
@b rate { @b rate {
height: 20px; height: var(--rate-height);
@e item { @e item {
display: inline-block; display: inline-block;
position: relative; position: relative;
@ -15,9 +15,9 @@
@e icon { @e icon {
position: relative; position: relative;
display: inline-block; display: inline-block;
font-size: 18px; font-size: var(--rate-icon-size);
margin-right: 6px; margin-right: var(--rate-icon-margin);
color: #C6D1DE; color: var(--rate-icon-color);
transition: .3s; transition: .3s;
&.hover { &.hover {
transform: scale(1.15); transform: scale(1.15);
@ -39,7 +39,7 @@
} }
@e text { @e text {
font-size: 14px; font-size: var(--rate-font-size);
vertical-align: middle; vertical-align: middle;
} }
} }

View File

@ -6,20 +6,20 @@
@b select-dropdown { @b select-dropdown {
position: absolute; position: absolute;
z-index: 1001; z-index: 1001;
border: solid 1px #d3dce6; border: var(--select-dropdown-border);
border-radius: 2px; border-radius: var(--border-radius-small);
background-color: #fff; background-color: var(--select-dropdown-background);
box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04); box-shadow: var(--select-dropdown-shadow);
box-sizing: border-box; box-sizing: border-box;
margin: 5px 0; margin: 5px 0;
@when multiple { @when multiple {
& .el-select-dropdown__item.selected { & .el-select-dropdown__item.selected {
color: #20A0FF; color: var(--select-option-selected);
background-color: #fff; background-color: var(--select-dropdown-background);
&.hover { &.hover {
background-color: #E5E9F2; background-color: var(--select-option-hover-background);
} }
&::after { &::after {
@ -36,19 +36,19 @@
} }
@b select-dropdown__empty { @b select-dropdown__empty {
padding: 10px 0; padding: var(--select-dropdown-empty-padding);
margin: 0; margin: 0;
text-align: center; text-align: center;
color: #999; color: var(--select-dropdown-empty-color);
font-size: 14px; font-size: var(--select-font-size);
} }
@b select-dropdown__list { @b select-dropdown__list {
list-style: none; list-style: none;
padding: 6px 0; padding: var(--select-dropdown-padding);
margin: 0; margin: 0;
width: 100%; width: 100%;
max-height: 274px; max-height: var(--select-dropdown-max-height);
box-sizing: border-box; box-sizing: border-box;
overflow-y: auto; overflow-y: auto;
} }

View File

@ -14,21 +14,21 @@
@when small { @when small {
& input { & input {
border-radius: 2px; border-radius: var(--border-radius-small);
height: 28px; height: 28px;
} }
} }
&:hover { &:hover {
.el-input__inner { .el-input__inner {
border-color: #8492a6; border-color: var(--select-border-color-hover);
} }
} }
& .el-input { & .el-input {
& .el-input__icon { & .el-input__icon {
color: #c0ccda; color: var(--select-input-color);
font-size: 12px; font-size: var(--select-input-font-size);
transition: transform .3s; transition: transform .3s;
transform: translateY(-50%) rotateZ(180deg); transform: translateY(-50%) rotateZ(180deg);
line-height: 16px; line-height: 16px;
@ -42,15 +42,15 @@
@when show-close { @when show-close {
transition: 0s; transition: 0s;
size: 16px; size: 16px;
font-size: 14px; font-size: var(--select-font-size);
right: 8px; right: 8px;
text-align: center; text-align: center;
transform: translateY(-50%) rotateZ(180deg); transform: translateY(-50%) rotateZ(180deg);
border-radius: 50%; border-radius: var(--border-radius-circle);
color: #C0CCDA; color: var(--select-input-color);
&:hover { &:hover {
color: #99A9BF; color: var(--select-close-hover-color);
} }
} }
} }
@ -59,7 +59,7 @@
cursor: pointer; cursor: pointer;
&:focus { &:focus {
border-color: #2ea0ff; border-color: var(--select-input-focus-background);
} }
} }
@ -68,7 +68,7 @@
cursor: not-allowed; cursor: not-allowed;
&:hover { &:hover {
border-color: #D3DCE6; border-color: var(--select-disabled-border);
} }
} }
} }
@ -79,8 +79,8 @@
outline: none; outline: none;
padding: 0; padding: 0;
margin: 4px 0 -3px 10px; margin: 4px 0 -3px 10px;
color: #666; color: var(--select-multiple-input-color);
font-size: 14px; font-size: var(--select-font-size);
vertical-align: baseline; vertical-align: baseline;
appearance: none; appearance: none;
height: 28px; height: 28px;
@ -93,12 +93,12 @@
top: 8px; top: 8px;
z-index: var(--index-top); z-index: var(--index-top);
right: 25px; right: 25px;
color: #c0ccda; color: var(--select-input-color);
line-height: 18px; line-height: 18px;
font-size: 12px; font-size: var(--select-input-font-size);
&:hover { &:hover {
color: #99A9BF; color: var(--select-close-hover-color);
} }
} }
@ -114,23 +114,23 @@
} }
& .el-tag { & .el-tag {
height: 24px; height: var(--select-tag-height);
line-height: 24px; line-height: var(--select-tag-height);
box-sizing: border-box; box-sizing: border-box;
margin: 6px 0 0 6px; margin: 6px 0 0 6px;
} }
@e tag { @e tag {
display: inline-block; display: inline-block;
height: 24px; height: var(--select-tag-height);
line-height: 24px; line-height: var(--select-tag-height);
font-size: 14px; font-size: var(--select-font-size);
border-radius: 4px; border-radius: var(--border-radius-base);
color: #fff; color: var(--select-tag-color);
background-color: #20a0ff; background-color: var(--select-tag-background);
& .el-icon-close { & .el-icon-close {
font-size: 12px; font-size: var(--select-input-font-size);
} }
} }
} }

View File

@ -8,10 +8,10 @@
@utils-clearfix; @utils-clearfix;
@e runway { @e runway {
width: 100%; width: 100%;
height: 4px; height: var(--slider-height);
margin: 20px 0; margin: var(--slider-margin);
background-color: var(--slider-runway-background-color); background-color: var(--slider-runway-background-color);
border-radius: 3px; border-radius: var(--slider-border-radius);
position: relative; position: relative;
cursor: pointer; cursor: pointer;
vertical-align: middle; vertical-align: middle;
@ -64,18 +64,18 @@
} }
@e bar { @e bar {
height: 4px; height: var(--slider-height);
background-color: var(--slider-main-background-color); background-color: var(--slider-main-background-color);
border-top-left-radius: 3px; border-top-left-radius: var(--slider-border-radius);
border-bottom-left-radius: 3px; border-bottom-left-radius: var(--slider-border-radius);
position: absolute; position: absolute;
} }
@e button-wrapper { @e button-wrapper {
size: 36px; size: var(--slider-button-wrapper-size);
position: absolute; position: absolute;
z-index: 1001; z-index: 1001;
top: -16px; top: var(--slider-button-wrapper-offset);
transform: translateX(-50%); transform: translateX(-50%);
background-color: transparent; background-color: transparent;
text-align: center; text-align: center;
@ -95,7 +95,7 @@
} }
@e button { @e button {
size: 12px; size: var(--slider-button-size);
background-color: var(--slider-main-background-color); background-color: var(--slider-main-background-color);
border-radius: 50%; border-radius: 50%;
transition: .2s; transition: .2s;
@ -119,8 +119,8 @@
@e stop { @e stop {
position: absolute; position: absolute;
size: 4px; size: var(--slider-height);
border-radius: 50%; border-radius: var(--border-radius-circle);
background-color: var(--slider-stop-background-color); background-color: var(--slider-stop-background-color);
transform: translateX(-50%); transform: translateX(-50%);
} }

View File

@ -6,8 +6,7 @@
@b switch { @b switch {
display: inline-block; display: inline-block;
position: relative; position: relative;
line-height: 20px; font-size: var(--switch-font-size);
font-size: 14px;
@when disabled { @when disabled {
& .el-switch__core, & .el-switch__core,
& .el-switch__label { & .el-switch__label {
@ -19,11 +18,11 @@
transition: .2s; transition: .2s;
position: absolute; position: absolute;
z-index: 10; z-index: 10;
size: 46px 22px; size: var(--switch-size);
left: 0; left: 0;
top: 0; top: 0;
display: inline-block; display: inline-block;
font-size: 14px; font-size: var(--switch-font-size);
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
@m left { @m left {
@ -40,7 +39,7 @@
line-height: 1; line-height: 1;
top: 4px; top: 4px;
position: absolute; position: absolute;
font-size: 14px; font-size: var(--switch-font-size);
display: inline-block; display: inline-block;
color: var(--color-white); color: var(--color-white);
} }
@ -58,10 +57,10 @@
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
position: relative; position: relative;
size: 46px 22px; size: var(--switch-size);
border: 1px solid var(--switch-off-color); border: 1px solid var(--switch-off-color);
outline: none; outline: none;
border-radius: 12px; border-radius: var(--switch-core-border-radius);
box-sizing: border-box; box-sizing: border-box;
background: var(--switch-off-color); background: var(--switch-off-color);
cursor: pointer; cursor: pointer;
@ -69,9 +68,9 @@
& .el-switch__button { & .el-switch__button {
position: absolute 0 * * 0; position: absolute 0 * * 0;
border-radius: 15px; border-radius: var(--border-radius-circle);
transition: transform .3s; transition: transform .3s;
size: 16px; size: var(--switch-button-size);
z-index: 20; z-index: 20;
background-color: var(--color-white); background-color: var(--color-white);
} }

View File

@ -4,7 +4,7 @@ export default {
now: 'jetzt', now: 'jetzt',
today: 'heute', today: 'heute',
cancel: 'abbrechen', cancel: 'abbrechen',
// clear: 'leeren', clear: 'leeren',
confirm: 'OK', confirm: 'OK',
selectDate: 'Datum wählen', selectDate: 'Datum wählen',
selectTime: 'Zeit wählen', selectTime: 'Zeit wählen',

View File

@ -4,7 +4,7 @@ export default {
now: 'Now', now: 'Now',
today: 'Today', today: 'Today',
cancel: 'Cancel', cancel: 'Cancel',
// clear: 'Clear', clear: 'Clear',
confirm: 'OK', confirm: 'OK',
selectDate: 'Select date', selectDate: 'Select date',
selectTime: 'Select time', selectTime: 'Select time',

View File

@ -4,7 +4,7 @@ export default {
now: '此刻', now: '此刻',
today: '今天', today: '今天',
cancel: '取消', cancel: '取消',
// clear: '清空', clear: '清空',
confirm: '确定', confirm: '确定',
selectDate: '选择日期', selectDate: '选择日期',
selectTime: '选择时间', selectTime: '选择时间',

View File

@ -1,4 +1,4 @@
import { createVue, triggerEvent } from '../util'; import { createVue, triggerEvent, destroyVM } from '../util';
describe('Dropdown', () => { describe('Dropdown', () => {
it('create', done => { it('create', done => {
@ -29,6 +29,7 @@ describe('Dropdown', () => {
triggerEvent(triggerElm, 'mouseleave'); triggerEvent(triggerElm, 'mouseleave');
setTimeout(_ => { setTimeout(_ => {
expect(dropdown.visible).to.not.true; expect(dropdown.visible).to.not.true;
destroyVM(vm);
done(); done();
}, 300); }, 300);
}, 400); }, 400);
@ -36,43 +37,37 @@ describe('Dropdown', () => {
it('menu click', done => { it('menu click', done => {
const vm = createVue({ const vm = createVue({
template: ` template: `
<el-dropdown> <el-dropdown ref="dropdown">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
下拉菜单<i class="el-icon-caret-bottom el-icon-right"></i> 下拉菜单<i class="el-icon-caret-bottom el-icon-right"></i>
</span> </span>
<el-dropdown-menu slot="dropdown" class="dropdown-test-menu-click"> <el-dropdown-menu slot="dropdown" class="dropdown-test-menu-click">
<el-dropdown-item>黄金糕</el-dropdown-item> <el-dropdown-item command="a">黄金糕</el-dropdown-item>
<el-dropdown-item @click.native="handleClick">狮子头</el-dropdown-item> <el-dropdown-item command="b">狮子头</el-dropdown-item>
<el-dropdown-item>螺蛳粉</el-dropdown-item> <el-dropdown-item ref="commandC" command="c">螺蛳粉</el-dropdown-item>
<el-dropdown-item>双皮奶</el-dropdown-item> <el-dropdown-item command="d">双皮奶</el-dropdown-item>
<el-dropdown-item>蚵仔煎</el-dropdown-item> <el-dropdown-item command="e">蚵仔煎</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
`, `
data() {
return {
clickedItem: ''
};
},
methods: {
handleClick(ev) {
this.clickedItem = ev.target.innerText;
}
}
}, true); }, true);
let dropdownElm = vm.$el; let dropdown = vm.$refs.dropdown;
let dropdownElm = dropdown.$el;
let triggerElm = dropdownElm.children[0]; let triggerElm = dropdownElm.children[0];
let callback = sinon.spy();
dropdown.$on('command', callback);
triggerEvent(triggerElm, 'mouseenter'); triggerEvent(triggerElm, 'mouseenter');
setTimeout(_ => { setTimeout(_ => {
let dropdownMenu = document.querySelector('.dropdown-test-menu-click'); vm.$refs.commandC.$el.click();
dropdownMenu.children[1].click();
setTimeout(_ => { setTimeout(_ => {
expect(dropdownMenu.style.display).to.be.equal('none'); expect(dropdown.visible).to.not.true;
expect(vm.clickedItem).to.be.equal('狮子头'); expect(callback.calledWith('c')).to.be.true;
destroyVM(vm);
done(); done();
}, 600); }, 300);
}, 400); }, 300);
}); });
it('trigger', done => { it('trigger', done => {
const vm = createVue({ const vm = createVue({
@ -89,17 +84,7 @@ describe('Dropdown', () => {
<el-dropdown-item>蚵仔煎</el-dropdown-item> <el-dropdown-item>蚵仔煎</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
`, `
data() {
return {
clickedItem: ''
};
},
methods: {
handleClick(ev) {
this.clickedItem = ev.target.innerText;
}
}
}, true); }, true);
let dropdownElm = vm.$el; let dropdownElm = vm.$el;
let dropdown = vm.$refs.dropdown; let dropdown = vm.$refs.dropdown;
@ -109,9 +94,10 @@ describe('Dropdown', () => {
dropdown.$nextTick(_ => { dropdown.$nextTick(_ => {
expect(dropdown.visible).to.not.true; expect(dropdown.visible).to.not.true;
dropdownElm.children[0].click(); triggerElm.click();
dropdown.$nextTick(_ => { dropdown.$nextTick(_ => {
expect(dropdown.visible).to.be.true; expect(dropdown.visible).to.be.true;
destroyVM(vm);
done(); done();
}); });
}); });
@ -119,7 +105,7 @@ describe('Dropdown', () => {
it('split button', done => { it('split button', done => {
const vm = createVue({ const vm = createVue({
template: ` template: `
<el-dropdown split-button type="primary" @click="handleClick" ref="dropdown"> <el-dropdown split-button type="primary" ref="dropdown">
更多菜单 更多菜单
<el-dropdown-menu slot="dropdown" class="dropdown-test-split-button"> <el-dropdown-menu slot="dropdown" class="dropdown-test-split-button">
<el-dropdown-item>黄金糕</el-dropdown-item> <el-dropdown-item>黄金糕</el-dropdown-item>
@ -129,22 +115,20 @@ describe('Dropdown', () => {
<el-dropdown-item>蚵仔煎</el-dropdown-item> <el-dropdown-item>蚵仔煎</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
`, `
data() {
return {
btnClicked: false
};
},
methods: {
handleClick(ev) {
this.btnClicked = true;
}
}
}, true); }, true);
let dropdown = vm.$refs.dropdown; let dropdown = vm.$refs.dropdown;
let dropdownElm = dropdown.$el; let dropdownElm = dropdown.$el;
let triggerElm = dropdownElm.querySelector('.el-dropdown__caret-button'); let triggerElm = dropdownElm.querySelector('.el-dropdown__caret-button');
var callback = sinon.spy();
dropdown.$on('click', callback);
dropdownElm.querySelector('.el-button').click();
setTimeout(_ => {
expect(callback.called).to.be.true;
}, 300);
triggerEvent(triggerElm, 'mouseenter'); triggerEvent(triggerElm, 'mouseenter');
setTimeout(_ => { setTimeout(_ => {
@ -153,8 +137,9 @@ describe('Dropdown', () => {
triggerEvent(triggerElm, 'mouseleave'); triggerEvent(triggerElm, 'mouseleave');
setTimeout(_ => { setTimeout(_ => {
expect(dropdown.visible).to.not.true; expect(dropdown.visible).to.not.true;
destroyVM(vm);
done(); done();
}, 400); }, 300);
}, 400); }, 300);
}); });
}); });