mirror of https://github.com/ElemeFE/element
Merge branch 'master' into unittest
commit
656e59c328
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -1,9 +1,20 @@
|
||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
### 1.0.0-rc.6(待发布)
|
### 1.0.0-rc.7
|
||||||
|
|
||||||
*2016-XX-XX*
|
*2016-XX-XX*
|
||||||
|
|
||||||
|
- Upload 新增 Data 属性支持额外数据的传输
|
||||||
|
- DatePicker 修复 `$t` 报错
|
||||||
|
- Popper 重构 vue-popper
|
||||||
|
- Pagination 修复输入后再点击切换,输入框的值不更新
|
||||||
|
- Step: 修复自定义 icon 的样式
|
||||||
|
- 修复 Tree 组件 checkbox 点击失效的问题
|
||||||
|
|
||||||
|
### 1.0.0-rc.6
|
||||||
|
|
||||||
|
*2016-10-11*
|
||||||
|
|
||||||
- 修复 Tabs 切换后 Tab-panel 被销毁的问题
|
- 修复 Tabs 切换后 Tab-panel 被销毁的问题
|
||||||
- 修复 TimePicker 错误的隐藏面板
|
- 修复 TimePicker 错误的隐藏面板
|
||||||
- 修复 Table Cell 的样式, #204
|
- 修复 Table Cell 的样式, #204
|
||||||
|
|
|
@ -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>
|
||||||
```
|
```
|
||||||
:::
|
:::
|
||||||
|
|
|
@ -119,6 +119,7 @@
|
||||||
<span class="demonstration">带快捷选项</span>
|
<span class="demonstration">带快捷选项</span>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="value2"
|
v-model="value2"
|
||||||
|
align="right"
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
:picker-options="pickerOptions1">
|
:picker-options="pickerOptions1">
|
||||||
|
@ -193,6 +194,7 @@
|
||||||
<span class="demonstration">年</span>
|
<span class="demonstration">年</span>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="value5"
|
v-model="value5"
|
||||||
|
align="right"
|
||||||
type="year"
|
type="year"
|
||||||
placeholder="选择年">
|
placeholder="选择年">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
|
|
|
@ -152,7 +152,8 @@
|
||||||
### Attributes
|
### Attributes
|
||||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||||
|------------- |---------------- |---------------- |---------------------- |-------- |
|
|------------- |---------------- |---------------- |---------------------- |-------- |
|
||||||
| type | 菜单按钮类型,同 Button 组件 | string | — | — |
|
| type | 菜单按钮类型,同 Button 组件(只在`split-button`为 true 的情况下有效) | string | — | — |
|
||||||
|
| size | 菜单按钮尺寸,同 Button 组件(只在`split-button`为 true 的情况下有效) | string | hover, click | hover |
|
||||||
| split-button | 下拉触发元素呈现为按钮组 | boolean | — | false |
|
| split-button | 下拉触发元素呈现为按钮组 | boolean | — | false |
|
||||||
| menu-align | 菜单水平对齐方向 | string | start, end | end |
|
| menu-align | 菜单水平对齐方向 | string | start, end | end |
|
||||||
| trigger | 触发下拉的行为 | string | hover, click | hover |
|
| trigger | 触发下拉的行为 | string | hover, click | hover |
|
||||||
|
|
|
@ -514,7 +514,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 label="活动时间">
|
<el-form-item label="活动时间" required>
|
||||||
<el-col :span="11">
|
<el-col :span="11">
|
||||||
<el-form-item prop="date1">
|
<el-form-item prop="date1">
|
||||||
<el-date-picker type="date" placeholder="选择日期" v-model="ruleForm.date1" style="width: 100%;"></el-date-picker>
|
<el-date-picker type="date" placeholder="选择日期" v-model="ruleForm.date1" style="width: 100%;"></el-date-picker>
|
||||||
|
|
|
@ -627,7 +627,7 @@
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||||
|------------- |---------------- |---------------- |---------------------- |-------- |
|
|------------- |---------------- |---------------- |---------------------- |-------- |
|
||||||
| type | 同原生的 input 的 type 属性,另外提供 type="textarea" | string | — | — |
|
| type | 类型 | string | text/textarea | text |
|
||||||
| value | 绑定值 | string, number | — | — |
|
| value | 绑定值 | string, number | — | — |
|
||||||
| maxlength | 最大输入长度 | number | — | — |
|
| maxlength | 最大输入长度 | number | — | — |
|
||||||
| minlength | 最小输入长度 | number | — | — |
|
| minlength | 最小输入长度 | number | — | — |
|
||||||
|
|
|
@ -16,22 +16,22 @@
|
||||||
.demo-box.demo-slider .source {
|
.demo-box.demo-slider .source {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.demo-box.demo-slider .block {
|
.demo-box.demo-slider .block {
|
||||||
padding: 30px 24px;
|
padding: 30px 24px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-bottom: solid 1px #EFF2F6;
|
border-bottom: solid 1px #EFF2F6;
|
||||||
&:last-child {
|
&:last-child {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.demo-box.demo-slider .demonstration {
|
.demo-box.demo-slider .demonstration {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #8492a6;
|
color: #8492a6;
|
||||||
line-height: 44px;
|
line-height: 44px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.demo-box.demo-slider .demonstration + .el-slider {
|
.demo-box.demo-slider .demonstration + .el-slider {
|
||||||
float: right;
|
float: right;
|
||||||
width: 70%;
|
width: 70%;
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<span class="demonstration">默认</span>
|
<span class="demonstration">默认</span>
|
||||||
<el-slider v-model="value1"></el-slider>
|
<el-slider v-model="value1"></el-slider>
|
||||||
</div>
|
</div>
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<span class="demonstration">自定义初始值</span>
|
<span class="demonstration">自定义初始值</span>
|
||||||
|
@ -85,7 +85,7 @@
|
||||||
<el-slider
|
<el-slider
|
||||||
v-model="value3"
|
v-model="value3"
|
||||||
:step="10">
|
:step="10">
|
||||||
</el-slider>
|
</el-slider>
|
||||||
</div>
|
</div>
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<span class="demonstration">显示间断点</span>
|
<span class="demonstration">显示间断点</span>
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
<el-slider
|
<el-slider
|
||||||
v-model="value5"
|
v-model="value5"
|
||||||
show-input>
|
show-input>
|
||||||
</el-slider>
|
</el-slider>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "element-ui",
|
"name": "element-ui",
|
||||||
"version": "1.0.0-rc.5",
|
"version": "1.0.0-rc.6",
|
||||||
"description": "A Component Library for Vue.js.",
|
"description": "A Component Library for Vue.js.",
|
||||||
"main": "lib/element-ui.common.js",
|
"main": "lib/element-ui.common.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -89,10 +89,10 @@
|
||||||
"theaterjs": "^3.0.0",
|
"theaterjs": "^3.0.0",
|
||||||
"uppercamelcase": "^1.1.0",
|
"uppercamelcase": "^1.1.0",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
"vue": "^2.0.1",
|
"vue": "^2.0.2",
|
||||||
"vue-loader": "^9.5.1",
|
"vue-loader": "^9.5.1",
|
||||||
"vue-markdown-loader": "^0.5.1",
|
"vue-markdown-loader": "^0.5.1",
|
||||||
"vue-popup": "^0.2.6",
|
"vue-popup": "^0.2.8",
|
||||||
"vue-router": "^2.0.0",
|
"vue-router": "^2.0.0",
|
||||||
"webpack": "^1.13.2",
|
"webpack": "^1.13.2",
|
||||||
"webpack-dev-server": "^1.15.1",
|
"webpack-dev-server": "^1.15.1",
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:name='name'
|
:name='name'
|
||||||
@onchange="handleChange"
|
@change="handleChange"
|
||||||
@onfocus="handleFocus"
|
@focus="handleFocus"
|
||||||
@keydown.up.native="highlight(highlightedIndex - 1)"
|
@keydown.up.native="highlight(highlightedIndex - 1)"
|
||||||
@keydown.down.native="highlight(highlightedIndex + 1)"
|
@keydown.down.native="highlight(highlightedIndex + 1)"
|
||||||
@keydown.enter.native="select(highlightedIndex)"
|
@keydown.enter.native="select(highlightedIndex)"
|
||||||
|
|
|
@ -3,7 +3,19 @@
|
||||||
|
|
||||||
@component-namespace el {
|
@component-namespace el {
|
||||||
@b date-picker {
|
@b date-picker {
|
||||||
min-width: 300px;
|
min-width: 254px;
|
||||||
|
|
||||||
|
&.has-sidebar.has-time {
|
||||||
|
min-width: 434px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.has-sidebar {
|
||||||
|
min-width: 370px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.has-time {
|
||||||
|
min-width: 324px;
|
||||||
|
}
|
||||||
|
|
||||||
.el-picker-panel__content {
|
.el-picker-panel__content {
|
||||||
min-width: 224px;
|
min-width: 224px;
|
||||||
|
|
|
@ -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%;
|
||||||
|
|
|
@ -63,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;
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<transition name="md-fade-bottom">
|
<transition name="md-fade-bottom" @after-leave="$emit('dodestroy')">
|
||||||
<div
|
<div
|
||||||
v-show="visible"
|
v-show="visible"
|
||||||
class="el-picker-panel el-date-range-picker">
|
:style="{ width: width + 'px' }"
|
||||||
|
class="el-picker-panel el-date-range-picker"
|
||||||
|
:class="{
|
||||||
|
'has-sidebar': $slots.sidebar || shortcuts,
|
||||||
|
'has-time': showTime
|
||||||
|
}">
|
||||||
<div class="el-picker-panel__body-wrapper">
|
<div class="el-picker-panel__body-wrapper">
|
||||||
<slot name="sidebar" class="el-picker-panel__sidebar"></slot>
|
<slot name="sidebar" class="el-picker-panel__sidebar"></slot>
|
||||||
<div class="el-picker-panel__sidebar" v-if="shortcuts">
|
<div class="el-picker-panel__sidebar" v-if="shortcuts">
|
||||||
|
@ -31,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"
|
||||||
|
@ -41,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"
|
||||||
|
@ -51,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"
|
||||||
|
@ -58,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"
|
||||||
|
@ -254,6 +263,8 @@
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
leftPickerWidth: 0,
|
||||||
|
rightPickerWidth: 0,
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
minDate: '',
|
minDate: '',
|
||||||
maxDate: '',
|
maxDate: '',
|
||||||
|
@ -269,11 +280,26 @@
|
||||||
visible: '',
|
visible: '',
|
||||||
disabledDate: '',
|
disabledDate: '',
|
||||||
leftTimePickerVisible: false,
|
leftTimePickerVisible: false,
|
||||||
rightTimePickerVisible: false
|
rightTimePickerVisible: false,
|
||||||
|
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) {
|
||||||
|
@ -302,7 +328,9 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
$t,
|
$t(...args) {
|
||||||
|
return $t.apply(this, args);
|
||||||
|
},
|
||||||
|
|
||||||
closeLeftTimePicker() {
|
closeLeftTimePicker() {
|
||||||
this.leftTimePickerVisible = false;
|
this.leftTimePickerVisible = false;
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<transition name="md-fade-bottom">
|
<transition name="md-fade-bottom" @after-leave="$emit('dodestroy')">
|
||||||
<div
|
<div
|
||||||
v-show="visible"
|
v-show="visible"
|
||||||
class="el-picker-panel el-date-picker">
|
:style="{
|
||||||
|
width: width + 'px'
|
||||||
|
}"
|
||||||
|
class="el-picker-panel el-date-picker"
|
||||||
|
:class="{
|
||||||
|
'has-sidebar': $slots.sidebar || shortcuts,
|
||||||
|
'has-time': showTime
|
||||||
|
}">
|
||||||
<div class="el-picker-panel__body-wrapper">
|
<div class="el-picker-panel__body-wrapper">
|
||||||
<slot name="sidebar" class="el-picker-panel__sidebar"></slot>
|
<slot name="sidebar" class="el-picker-panel__sidebar"></slot>
|
||||||
<div class="el-picker-panel__sidebar" v-if="shortcuts">
|
<div class="el-picker-panel__sidebar" v-if="shortcuts">
|
||||||
|
@ -21,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')"
|
||||||
|
@ -29,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>
|
||||||
|
@ -115,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;
|
||||||
|
@ -328,6 +347,7 @@
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
pickerWidth: 0,
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
value: '',
|
value: '',
|
||||||
showTime: false,
|
showTime: false,
|
||||||
|
@ -339,7 +359,8 @@
|
||||||
year: null,
|
year: null,
|
||||||
month: null,
|
month: null,
|
||||||
week: null,
|
week: null,
|
||||||
timePickerVisible: false
|
timePickerVisible: false,
|
||||||
|
width: 0
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<transition name="md-fade-bottom">
|
<transition name="md-fade-bottom" @after-leave="$emit('dodestroy')">
|
||||||
<div
|
<div
|
||||||
v-show="visible"
|
v-show="visible"
|
||||||
|
:style="{ width: width + 'px' }"
|
||||||
class="el-time-range-picker el-picker-panel">
|
class="el-time-range-picker el-picker-panel">
|
||||||
<div class="el-time-range-picker__content">
|
<div class="el-time-range-picker__content">
|
||||||
<div class="el-time-range-picker__cell">
|
<div class="el-time-range-picker__cell">
|
||||||
|
@ -48,8 +49,9 @@
|
||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script type="text/ecmascript-6">
|
<script type="text/babel">
|
||||||
import { parseDate, limitRange } from '../util';
|
import { parseDate, limitRange } from '../util';
|
||||||
|
import { $t } from '../util';
|
||||||
|
|
||||||
const MIN_TIME = parseDate('00:00:00', 'HH:mm:ss');
|
const MIN_TIME = parseDate('00:00:00', 'HH:mm:ss');
|
||||||
const MAX_TIME = parseDate('23:59:59', 'HH:mm:ss');
|
const MAX_TIME = parseDate('23:59:59', 'HH:mm:ss');
|
||||||
|
@ -90,11 +92,16 @@
|
||||||
minMinutes: minTime.getMinutes(),
|
minMinutes: minTime.getMinutes(),
|
||||||
minSeconds: minTime.getSeconds(),
|
minSeconds: minTime.getSeconds(),
|
||||||
format: 'HH:mm:ss',
|
format: 'HH:mm:ss',
|
||||||
visible: false
|
visible: false,
|
||||||
|
width: 0
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
$t(...args) {
|
||||||
|
return $t.apply(this, args);
|
||||||
|
},
|
||||||
|
|
||||||
handleCancel() {
|
handleCancel() {
|
||||||
this.$emit('pick');
|
this.$emit('pick');
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<transition name="md-fade-bottom">
|
<transition name="md-fade-bottom" @after-leave="$emit('dodestroy')">
|
||||||
<div
|
<div
|
||||||
v-show="visible"
|
v-show="visible"
|
||||||
|
:style="{ width: width + 'px' }"
|
||||||
class="el-picker-panel time-select">
|
class="el-picker-panel time-select">
|
||||||
<div class="el-picker-panel__content">
|
<div class="el-picker-panel__content">
|
||||||
<div class="time-select-item"
|
<div class="time-select-item"
|
||||||
|
@ -16,7 +17,7 @@
|
||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script type="text/ecmascript-6">
|
<script type="text/babel">
|
||||||
const parseTime = function(time) {
|
const parseTime = function(time) {
|
||||||
const values = ('' || time).split(':');
|
const values = ('' || time).split(':');
|
||||||
if (values.length >= 2) {
|
if (values.length >= 2) {
|
||||||
|
@ -91,7 +92,8 @@
|
||||||
step: '00:30',
|
step: '00:30',
|
||||||
value: '',
|
value: '',
|
||||||
visible: false,
|
visible: false,
|
||||||
minTime: ''
|
minTime: '',
|
||||||
|
width: 0
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<transition name="md-fade-bottom">
|
<transition name="md-fade-bottom" @after-leave="$emit('dodestroy')">
|
||||||
<div
|
<div
|
||||||
v-show="currentVisible"
|
v-show="currentVisible"
|
||||||
|
:style="{width: width + 'px'}"
|
||||||
class="el-time-panel">
|
class="el-time-panel">
|
||||||
<div class="el-time-panel__content">
|
<div class="el-time-panel__content">
|
||||||
<time-spinner
|
<time-spinner
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
<script type="text/babel">
|
<script type="text/babel">
|
||||||
import { limitRange } from '../util';
|
import { limitRange } from '../util';
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import { $t } from '../util';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -38,12 +40,12 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
pickerWidth: {},
|
||||||
date: {
|
date: {
|
||||||
default() {
|
default() {
|
||||||
return new Date();
|
return new Date();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
visible: Boolean
|
visible: Boolean
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -52,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) {
|
||||||
|
@ -80,7 +86,8 @@
|
||||||
seconds: 0,
|
seconds: 0,
|
||||||
selectableRange: [],
|
selectableRange: [],
|
||||||
currentDate: this.$options.defaultValue || this.date,
|
currentDate: this.$options.defaultValue || this.date,
|
||||||
currentVisible: this.visible
|
currentVisible: this.visible,
|
||||||
|
width: this.pickerWidth || 0
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -91,6 +98,10 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
$t(...args) {
|
||||||
|
return $t.apply(this, args);
|
||||||
|
},
|
||||||
|
|
||||||
handleCancel() {
|
handleCancel() {
|
||||||
this.$emit('pick', null);
|
this.$emit('pick', null);
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<input
|
<input
|
||||||
class="el-date-editor__editor"
|
class="el-date-editor__editor"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:type="editorType"
|
type="text"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
@focus="handleFocus"
|
@focus="handleFocus"
|
||||||
@blur="handleBlur"
|
@blur="handleBlur"
|
||||||
|
@ -33,9 +33,20 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Clickoutside from 'main/utils/clickoutside';
|
import Clickoutside from 'main/utils/clickoutside';
|
||||||
import { merge, formatDate, parseDate, getWeekNumber } from './util';
|
import { merge, formatDate, parseDate, getWeekNumber } from './util';
|
||||||
import Popper from 'main/utils/popper';
|
import Popper from 'main/utils/vue-popper';
|
||||||
import emitter from 'main/mixins/emitter';
|
import emitter from 'main/mixins/emitter';
|
||||||
|
|
||||||
|
const newPopper = {
|
||||||
|
props: {
|
||||||
|
appendToBody: Popper.props.appendToBody,
|
||||||
|
offset: Popper.props.offset,
|
||||||
|
boundariesPadding: Popper.props.boundariesPadding
|
||||||
|
},
|
||||||
|
methods: Popper.methods,
|
||||||
|
data: Popper.data,
|
||||||
|
beforeDestroy: Popper.beforeDestroy
|
||||||
|
};
|
||||||
|
|
||||||
const FUNCTION_KEYS = [13, 16, 17, 18, 19, 20, 27, 33, 34, 35, 36, 37, 38, 39, 40];
|
const FUNCTION_KEYS = [13, 16, 17, 18, 19, 20, 27, 33, 34, 35, 36, 37, 38, 39, 40];
|
||||||
const RANGE_SEPARATOR = ' - ';
|
const RANGE_SEPARATOR = ' - ';
|
||||||
const DEFAULT_FORMATS = {
|
const DEFAULT_FORMATS = {
|
||||||
|
@ -184,7 +195,7 @@ const PLACEMENT_MAP = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [emitter],
|
mixins: [emitter, newPopper],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
format: String,
|
format: String,
|
||||||
|
@ -274,13 +285,18 @@ export default {
|
||||||
}
|
}
|
||||||
this.$emit('input', value);
|
this.$emit('input', value);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
editorType() {
|
|
||||||
return 'text';
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
// vue-popper
|
||||||
|
this.options = {
|
||||||
|
boundariesPadding: 0,
|
||||||
|
gpuAcceleration: false
|
||||||
|
};
|
||||||
|
this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
handleClose() {
|
handleClose() {
|
||||||
this.pickerVisible = false;
|
this.pickerVisible = false;
|
||||||
|
@ -386,16 +402,6 @@ export default {
|
||||||
!this.pickerVisible ? this.showPicker() : this.hidePicker();
|
!this.pickerVisible ? this.showPicker() : this.hidePicker();
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyPopper() {
|
|
||||||
if (this.popper) {
|
|
||||||
this.resetTransformOrigin(this.popper);
|
|
||||||
setTimeout(() => {
|
|
||||||
this.popper && this.popper.destroy();
|
|
||||||
this.popper = null;
|
|
||||||
}, 300);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
hidePicker() {
|
hidePicker() {
|
||||||
if (this.picker) {
|
if (this.picker) {
|
||||||
this.picker.resetView && this.picker.resetView();
|
this.picker.resetView && this.picker.resetView();
|
||||||
|
@ -410,6 +416,8 @@ export default {
|
||||||
this.picker = new Vue(merge({
|
this.picker = new Vue(merge({
|
||||||
el: document.createElement('div')
|
el: document.createElement('div')
|
||||||
}, this.panel));
|
}, this.panel));
|
||||||
|
this.popperElm = this.picker.$el;
|
||||||
|
this.picker.width = this.$refs.reference.getBoundingClientRect().width;
|
||||||
this.picker.showTime = this.type === 'datetime' || this.type === 'datetimerange';
|
this.picker.showTime = this.type === 'datetime' || this.type === 'datetimerange';
|
||||||
this.picker.selectionMode = this.selectionMode;
|
this.picker.selectionMode = this.selectionMode;
|
||||||
if (this.format) {
|
if (this.format) {
|
||||||
|
@ -445,6 +453,7 @@ export default {
|
||||||
this.pickerVisible = this.picker.visible = true;
|
this.pickerVisible = this.picker.visible = true;
|
||||||
this.picker.resetView && this.picker.resetView();
|
this.picker.resetView && this.picker.resetView();
|
||||||
|
|
||||||
|
this.picker.$on('dodestroy', this.doDestroy);
|
||||||
this.picker.$on('pick', (date, visible = false) => {
|
this.picker.$on('pick', (date, visible = false) => {
|
||||||
this.$emit('input', date);
|
this.$emit('input', date);
|
||||||
|
|
||||||
|
@ -464,20 +473,7 @@ export default {
|
||||||
this.pickerVisible = this.picker.visible = true;
|
this.pickerVisible = this.picker.visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.updatePopper();
|
||||||
if (this.popper) return;
|
|
||||||
|
|
||||||
this.popper = new Popper(this.$refs.reference, this.picker.$el, {
|
|
||||||
gpuAcceleration: false,
|
|
||||||
placement: PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left,
|
|
||||||
boundariesPadding: 0,
|
|
||||||
forceAbsolute: true
|
|
||||||
});
|
|
||||||
|
|
||||||
this.popper.onCreate(popper => {
|
|
||||||
this.resetTransformOrigin(popper);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
if (this.value instanceof Date) {
|
if (this.value instanceof Date) {
|
||||||
this.picker.date = new Date(this.value.getTime());
|
this.picker.date = new Date(this.value.getTime());
|
||||||
|
@ -492,18 +488,7 @@ export default {
|
||||||
}
|
}
|
||||||
this.picker.ajustScrollTop && this.picker.ajustScrollTop();
|
this.picker.ajustScrollTop && this.picker.ajustScrollTop();
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
|
||||||
resetTransformOrigin(popper) {
|
|
||||||
let placementMap = { top: 'bottom', bottom: 'top' };
|
|
||||||
let placement = popper._popper.getAttribute('x-placement').split('-')[0];
|
|
||||||
let origin = placementMap[placement];
|
|
||||||
popper._popper.style.transformOrigin = `center ${ origin }`;
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
beforeDestroy() {
|
|
||||||
this.popper && this.popper.destroy();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,39 +1,35 @@
|
||||||
<template>
|
<template>
|
||||||
<ul class="el-dropdown__menu">
|
<transition name="md-fade-bottom" @after-leave="doDestroy">
|
||||||
|
<ul class="el-dropdown__menu" v-show="showPopper">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</ul>
|
</ul>
|
||||||
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import Popper from 'main/utils/popper';
|
import Popper from 'main/utils/vue-popper';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ElDropdownMenu',
|
name: 'ElDropdownMenu',
|
||||||
|
|
||||||
props: {
|
componentName: 'ElDropdownMenu',
|
||||||
visible: Boolean
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
popper: null
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
menuAlign() {
|
|
||||||
return this.$parent.menuAlign;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
document.body.appendChild(this.$el);
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
mixins: [Popper],
|
||||||
this.popper = new Popper(this.$parent.$el, this.$el, { gpuAcceleration: false, placement: `bottom-${this.menuAlign}` });
|
|
||||||
|
created() {
|
||||||
|
this.$on('visible', val => {
|
||||||
|
this.showPopper = val;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyed() {
|
mounted() {
|
||||||
setTimeout(() => {
|
this.$parent.popperElm = this.popperElm = this.$el;
|
||||||
this.popper.destroy();
|
this.referenceElm = this.$parent.$el;
|
||||||
}, 300);
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
placement() {
|
||||||
|
return `bottom-${this.$parent.menuAlign}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
<script>
|
<script>
|
||||||
import Clickoutside from 'main/utils/clickoutside';
|
import Clickoutside from 'main/utils/clickoutside';
|
||||||
|
import emitter from 'main/mixins/emitter';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ElDropdown',
|
name: 'ElDropdown',
|
||||||
|
|
||||||
|
mixins: [emitter],
|
||||||
|
|
||||||
directives: { Clickoutside },
|
directives: { Clickoutside },
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
@ -15,9 +18,8 @@
|
||||||
type: String,
|
type: String,
|
||||||
default: 'end'
|
default: 'end'
|
||||||
},
|
},
|
||||||
type: {
|
type: String,
|
||||||
type: String
|
size: String,
|
||||||
},
|
|
||||||
splitButton: Boolean
|
splitButton: Boolean
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -32,6 +34,12 @@
|
||||||
this.initEvent();
|
this.initEvent();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
visible(val) {
|
||||||
|
this.broadcast('ElDropdownMenu', 'visible', val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
show() {
|
show() {
|
||||||
clearTimeout(this.timeout);
|
clearTimeout(this.timeout);
|
||||||
|
@ -51,7 +59,7 @@
|
||||||
initEvent() {
|
initEvent() {
|
||||||
let { trigger, show, hide, handleClick, splitButton } = this;
|
let { trigger, show, hide, handleClick, splitButton } = this;
|
||||||
let triggerElm = splitButton
|
let triggerElm = splitButton
|
||||||
? this.$refs.trigger
|
? this.$refs.trigger.$el
|
||||||
: this.$slots.default[0].elm;
|
: this.$slots.default[0].elm;
|
||||||
|
|
||||||
if (trigger === 'hover') {
|
if (trigger === 'hover') {
|
||||||
|
@ -74,8 +82,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
render(h) {
|
render(h) {
|
||||||
let { hide, splitButton, visible, type } = this;
|
let { hide, splitButton, type, size } = this;
|
||||||
let dropdownElm = visible ? this.$slots.dropdown : null;
|
|
||||||
|
|
||||||
var handleClick = _ => {
|
var handleClick = _ => {
|
||||||
this.$emit('click');
|
this.$emit('click');
|
||||||
|
@ -84,10 +91,10 @@
|
||||||
let triggerElm = !splitButton
|
let triggerElm = !splitButton
|
||||||
? this.$slots.default
|
? this.$slots.default
|
||||||
: (<el-button-group>
|
: (<el-button-group>
|
||||||
<el-button type={type} nativeOn-click={handleClick}>
|
<el-button type={type} size={size} nativeOn-click={handleClick}>
|
||||||
{this.$slots.default}
|
{this.$slots.default}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button ref="trigger" type={type} class="el-dropdown__icon-button">
|
<el-button ref="trigger" type={type} size={size} class="el-dropdown__icon-button">
|
||||||
<i class="el-dropdown__icon el-icon-caret-bottom"></i>
|
<i class="el-dropdown__icon el-icon-caret-bottom"></i>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-button-group>);
|
</el-button-group>);
|
||||||
|
@ -95,9 +102,7 @@
|
||||||
return (
|
return (
|
||||||
<div class="el-dropdown" v-clickoutside={hide}>
|
<div class="el-dropdown" v-clickoutside={hide}>
|
||||||
{triggerElm}
|
{triggerElm}
|
||||||
<transition name="md-fade-bottom">
|
{this.$slots.dropdown}
|
||||||
{dropdownElm}
|
|
||||||
</transition>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,9 +127,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getRules() {
|
getRules() {
|
||||||
if (!this.prop) { return []; }
|
var formRules = this.form.rules;
|
||||||
var rules = this.rules || (this.form.rules ? this.form.rules[this.prop] : []);
|
var selfRuels = this.rules;
|
||||||
return Array.isArray(rules) ? rules : [rules];
|
|
||||||
|
formRules = formRules ? formRules[this.prop] : [];
|
||||||
|
|
||||||
|
return [].concat(selfRuels || formRules || []);
|
||||||
},
|
},
|
||||||
getFilteredRule(trigger) {
|
getFilteredRule(trigger) {
|
||||||
var rules = this.getRules();
|
var rules = this.getRules();
|
||||||
|
@ -151,21 +154,22 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
var rules = this.getRules();
|
|
||||||
|
|
||||||
rules.every(rule => {
|
|
||||||
if (rule.required) {
|
|
||||||
this.isRequired = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (this.prop) {
|
if (this.prop) {
|
||||||
this.dispatch('form', 'el.form.addField', [this]);
|
this.dispatch('form', 'el.form.addField', [this]);
|
||||||
}
|
|
||||||
|
|
||||||
this.$on('el.form.blur', this.onFieldBlur);
|
let rules = this.getRules();
|
||||||
this.$on('el.form.change', this.onFieldChange);
|
|
||||||
|
if (rules.length) {
|
||||||
|
rules.every(rule => {
|
||||||
|
if (rule.required) {
|
||||||
|
this.isRequired = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.$on('el.form.blur', this.onFieldBlur);
|
||||||
|
this.$on('el.form.change', this.onFieldChange);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.dispatch('form', 'el.form.removeField', [this]);
|
this.dispatch('form', 'el.form.removeField', [this]);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<input
|
<input
|
||||||
class="el-input__inner"
|
class="el-input__inner"
|
||||||
v-model="currentValue"
|
v-model="currentValue"
|
||||||
:type="type"
|
type="text"
|
||||||
:name="name"
|
:name="name"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
:minlength="minlength"
|
:minlength="minlength"
|
||||||
:autocomplete="autoComplete"
|
:autocomplete="autoComplete"
|
||||||
ref="input"
|
ref="input"
|
||||||
@focus="$emit('onfocus', currentValue)"
|
@focus="$emit('focus', currentValue)"
|
||||||
@blur="handleBlur"
|
@blur="handleBlur"
|
||||||
>
|
>
|
||||||
<!-- input 图标 -->
|
<!-- input 图标 -->
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
:maxlength="maxlength"
|
:maxlength="maxlength"
|
||||||
:minlength="minlength"
|
:minlength="minlength"
|
||||||
@focus="$emit('onfocus', currentValue)"
|
@focus="$emit('focus', currentValue)"
|
||||||
@blur="handleBlur">
|
@blur="handleBlur">
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
@ -162,6 +162,7 @@
|
||||||
|
|
||||||
'currentValue'(val) {
|
'currentValue'(val) {
|
||||||
this.$emit('input', val);
|
this.$emit('input', val);
|
||||||
|
this.$emit('change', val);
|
||||||
this.dispatch('form-item', 'el.form.change', [val]);
|
this.dispatch('form-item', 'el.form.change', [val]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,7 @@
|
||||||
"repository": "https://github.com/element-component/element/tree/master/packages/loading",
|
"repository": "https://github.com/element-component/element/tree/master/packages/loading",
|
||||||
"author": "elemefe",
|
"author": "elemefe",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {}
|
"dependencies": {
|
||||||
|
"wind-dom": "0.0.3"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
import { addClass } from 'wind-dom/src/class';
|
||||||
|
|
||||||
class Spinner {
|
class Spinner {
|
||||||
constructor() {
|
constructor() {
|
||||||
let spinner = document.createElement('div');
|
let spinner = document.createElement('div');
|
||||||
spinner.classList.add('el-loading-spinner');
|
addClass(spinner, 'el-loading-spinner');
|
||||||
[1, 2, 3].forEach(index => {
|
[1, 2, 3].forEach(index => {
|
||||||
let bubble = document.createElement('div');
|
let bubble = document.createElement('div');
|
||||||
bubble.classList.add('el-loading-bubble', `bubble${ index }`);
|
addClass(bubble, `el-loading-bubble bubble${ index }`);
|
||||||
spinner.appendChild(bubble);
|
spinner.appendChild(bubble);
|
||||||
});
|
});
|
||||||
this.el = spinner;
|
this.el = spinner;
|
||||||
|
|
|
@ -27,12 +27,7 @@
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
defaultOpeneds: {
|
defaultOpeneds: Array,
|
||||||
type: Array,
|
|
||||||
default() {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
theme: {
|
theme: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'light'
|
default: 'light'
|
||||||
|
@ -43,7 +38,7 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeIndex: this.defaultActive,
|
activeIndex: this.defaultActive,
|
||||||
openedMenus: this.defaultOpeneds.slice(0),
|
openedMenus: this.defaultOpeneds ? this.defaultOpeneds.slice(0) : [],
|
||||||
menuItems: {},
|
menuItems: {},
|
||||||
submenus: {}
|
submenus: {}
|
||||||
};
|
};
|
||||||
|
@ -63,6 +58,7 @@
|
||||||
openMenu(index, indexPath) {
|
openMenu(index, indexPath) {
|
||||||
let openedMenus = this.openedMenus;
|
let openedMenus = this.openedMenus;
|
||||||
if (openedMenus.indexOf(index) !== -1) return;
|
if (openedMenus.indexOf(index) !== -1) return;
|
||||||
|
// 将不在该菜单路径下的其余菜单收起
|
||||||
if (this.uniqueOpened) {
|
if (this.uniqueOpened) {
|
||||||
this.openedMenus = openedMenus.filter(index => {
|
this.openedMenus = openedMenus.filter(index => {
|
||||||
return indexPath.indexOf(index) !== -1;
|
return indexPath.indexOf(index) !== -1;
|
||||||
|
@ -92,29 +88,28 @@
|
||||||
this.broadcast('submenu', 'item-select', [index, indexPath]);
|
this.broadcast('submenu', 'item-select', [index, indexPath]);
|
||||||
this.openedMenus = [];
|
this.openedMenus = [];
|
||||||
} else {
|
} else {
|
||||||
|
this.openActiveItemMenus();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.router && route) {
|
||||||
|
this.$router.push(route);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
openActiveItemMenus() {
|
||||||
|
let index = this.activeIndex;
|
||||||
|
if (index && this.mode === 'vertical') {
|
||||||
|
let indexPath = this.menuItems[index].indexPath;
|
||||||
|
|
||||||
// 展开该菜单项的路径上所有子菜单
|
// 展开该菜单项的路径上所有子菜单
|
||||||
indexPath.forEach(index => {
|
indexPath.forEach(index => {
|
||||||
let submenu = this.submenus[index];
|
let submenu = this.submenus[index];
|
||||||
submenu && this.openMenu(index, submenu.indexPath);
|
submenu && this.openMenu(index, submenu.indexPath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.router && route) {
|
|
||||||
this.$router.push(route);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let index = this.activeIndex;
|
this.openActiveItemMenus();
|
||||||
if (index && this.mode === 'vertical') {
|
|
||||||
let indexPath = this.menuItems[index].indexPath;
|
|
||||||
|
|
||||||
// 展开该菜单项的路径上所有子菜单
|
|
||||||
indexPath.forEach(index => {
|
|
||||||
let submenu = this.submenus[index];
|
|
||||||
submenu && this.openMenu(index, submenu.indexPath);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -12,5 +12,6 @@
|
||||||
"author": "elemefe",
|
"author": "elemefe",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"wind-dom": "0.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
|
|
||||||
import Popup from 'vue-popup';
|
import Popup from 'vue-popup';
|
||||||
import ElInput from 'packages/input/index.js';
|
import ElInput from 'packages/input/index.js';
|
||||||
|
import { addClass, removeClass } from 'wind-dom/src/class';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [ Popup ],
|
mixins: [ Popup ],
|
||||||
|
@ -113,7 +114,7 @@
|
||||||
var inputPattern = this.inputPattern;
|
var inputPattern = this.inputPattern;
|
||||||
if (inputPattern && !inputPattern.test(this.inputValue || '')) {
|
if (inputPattern && !inputPattern.test(this.inputValue || '')) {
|
||||||
this.editorErrorMessage = this.inputErrorMessage || '输入的数据不合法!';
|
this.editorErrorMessage = this.inputErrorMessage || '输入的数据不合法!';
|
||||||
this.$refs.input.$el.querySelector('input').classList.add('invalid');
|
addClass(this.$refs.input.$el.querySelector('input'), 'invalid');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var inputValidator = this.inputValidator;
|
var inputValidator = this.inputValidator;
|
||||||
|
@ -121,7 +122,7 @@
|
||||||
var validateResult = inputValidator(this.inputValue);
|
var validateResult = inputValidator(this.inputValue);
|
||||||
if (validateResult === false) {
|
if (validateResult === false) {
|
||||||
this.editorErrorMessage = this.inputErrorMessage || '输入的数据不合法!';
|
this.editorErrorMessage = this.inputErrorMessage || '输入的数据不合法!';
|
||||||
this.$refs.input.$el.querySelector('input').classList.add('invalid');
|
addClass(this.$refs.input.$el.querySelector('input'), 'invalid');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (typeof validateResult === 'string') {
|
if (typeof validateResult === 'string') {
|
||||||
|
@ -131,7 +132,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.editorErrorMessage = '';
|
this.editorErrorMessage = '';
|
||||||
this.$refs.input.$el.querySelector('input').classList.remove('invalid');
|
removeClass(this.$refs.input.$el.querySelector('input'), 'invalid');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -168,14 +168,9 @@ export default {
|
||||||
this.oldValue = event.target.value;
|
this.oldValue = event.target.value;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleChange(event) {
|
handleChange({ target }) {
|
||||||
const target = event.target;
|
|
||||||
this.$parent.internalCurrentPage = this.$parent.getValidCurrentPage(target.value);
|
this.$parent.internalCurrentPage = this.$parent.getValidCurrentPage(target.value);
|
||||||
|
this.$parent.$emit('currentchange', this.$parent.internalCurrentPage);
|
||||||
if (target.value !== this.oldValue && Number(target.value) === this.$parent.internalCurrentPage) {
|
|
||||||
this.$parent.$emit('currentchange', this.$parent.internalCurrentPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.oldValue = null;
|
this.oldValue = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -189,12 +184,11 @@ export default {
|
||||||
type="number"
|
type="number"
|
||||||
min={ 1 }
|
min={ 1 }
|
||||||
max={ this.pageCount }
|
max={ this.pageCount }
|
||||||
value={ this.$parent.internalCurrentPage }
|
domProps-value={ this.$parent.internalCurrentPage }
|
||||||
on-change={ this.handleChange }
|
on-change={ this.handleChange }
|
||||||
on-focus={ this.handleFocus }
|
on-focus={ this.handleFocus }
|
||||||
style={{ width: '30px' }}
|
style={{ width: '30px' }}
|
||||||
number
|
number/>
|
||||||
lazy/>
|
|
||||||
页
|
页
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
|
@ -46,65 +46,59 @@ export default {
|
||||||
transition: {
|
transition: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'fade-in-linear'
|
default: 'fade-in-linear'
|
||||||
},
|
|
||||||
options: {
|
|
||||||
default() {
|
|
||||||
return {
|
|
||||||
gpuAcceleration: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
setTimeout(() => {
|
let _timer;
|
||||||
let _timer;
|
const reference = this.reference || this.$refs.reference || this.$slots.reference[0].elm;
|
||||||
const reference = this.reference || this.$refs.reference || this.$slots.reference[0].elm;
|
const popper = this.popper || this.$refs.popper;
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.trigger === 'click') {
|
if (this.trigger === 'click') {
|
||||||
on(reference, 'click', () => { this.showPopper = !this.showPopper; });
|
on(reference, 'click', () => { this.showPopper = !this.showPopper; });
|
||||||
on(document, 'click', (e) => {
|
on(document, 'click', (e) => {
|
||||||
if (!this.$el ||
|
if (!this.$el ||
|
||||||
!reference ||
|
!reference ||
|
||||||
this.$el.contains(e.target) ||
|
this.$el.contains(e.target) ||
|
||||||
reference.contains(e.target)) return;
|
reference.contains(e.target) ||
|
||||||
|
!popper ||
|
||||||
|
popper.contains(e.target)) return;
|
||||||
|
this.showPopper = false;
|
||||||
|
});
|
||||||
|
} else if (this.trigger === 'hover') {
|
||||||
|
on(reference, 'mouseenter', () => {
|
||||||
|
this.showPopper = true;
|
||||||
|
clearTimeout(_timer);
|
||||||
|
});
|
||||||
|
on(reference, 'mouseleave', () => {
|
||||||
|
_timer = setTimeout(() => {
|
||||||
this.showPopper = false;
|
this.showPopper = false;
|
||||||
});
|
}, 200);
|
||||||
} else if (this.trigger === 'hover') {
|
});
|
||||||
on(reference, 'mouseenter', () => {
|
} else {
|
||||||
this.showPopper = true;
|
if ([].slice.call(reference.children).length) {
|
||||||
clearTimeout(_timer);
|
const children = reference.childNodes;
|
||||||
});
|
|
||||||
on(reference, 'mouseleave', () => {
|
|
||||||
_timer = setTimeout(() => {
|
|
||||||
this.showPopper = false;
|
|
||||||
}, 200);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if ([].slice.call(reference.children).length) {
|
|
||||||
const children = reference.childNodes;
|
|
||||||
|
|
||||||
for (let i = 0; i < children.length; i++) {
|
for (let i = 0; i < children.length; i++) {
|
||||||
if (children[i].nodeName === 'INPUT') {
|
if (children[i].nodeName === 'INPUT') {
|
||||||
on(children[i], 'focus', () => { this.showPopper = true; });
|
on(children[i], 'focus', () => { this.showPopper = true; });
|
||||||
on(children[i], 'blur', () => { this.showPopper = false; });
|
on(children[i], 'blur', () => { this.showPopper = false; });
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (
|
|
||||||
reference.nodeName === 'INPUT' ||
|
|
||||||
reference.nodeName === 'TEXTAREA'
|
|
||||||
) {
|
|
||||||
on(reference, 'focus', () => { this.showPopper = true; });
|
|
||||||
on(reference, 'blur', () => { this.showPopper = false; });
|
|
||||||
} else {
|
|
||||||
on(reference, 'mousedown', () => { this.showPopper = true; });
|
|
||||||
on(reference, 'mouseup', () => { this.showPopper = false; });
|
|
||||||
}
|
}
|
||||||
|
} else if (
|
||||||
|
reference.nodeName === 'INPUT' ||
|
||||||
|
reference.nodeName === 'TEXTAREA'
|
||||||
|
) {
|
||||||
|
on(reference, 'focus', () => { this.showPopper = true; });
|
||||||
|
on(reference, 'blur', () => { this.showPopper = false; });
|
||||||
|
} else {
|
||||||
|
on(reference, 'mousedown', () => { this.showPopper = true; });
|
||||||
|
on(reference, 'mouseup', () => { this.showPopper = false; });
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}, 100);
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyed() {
|
destroyed() {
|
||||||
|
|
|
@ -11,5 +11,7 @@
|
||||||
"repository": "https://github.com/element-component/element/tree/master/packages/rate",
|
"repository": "https://github.com/element-component/element/tree/master/packages/rate",
|
||||||
"author": "elemefe",
|
"author": "elemefe",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {}
|
"dependencies": {
|
||||||
|
"wind-dom": "0.0.3"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script type="text/babel">
|
<script type="text/babel">
|
||||||
|
import { hasClass } from 'wind-dom/src/class';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-rate',
|
name: 'el-rate',
|
||||||
|
|
||||||
|
@ -223,10 +225,10 @@
|
||||||
}
|
}
|
||||||
if (this.allowHalf) {
|
if (this.allowHalf) {
|
||||||
let target = event.target;
|
let target = event.target;
|
||||||
if (target.classList.contains('el-rate__item')) {
|
if (hasClass(target, 'el-rate__item')) {
|
||||||
target = target.querySelector('.el-rate__icon');
|
target = target.querySelector('.el-rate__icon');
|
||||||
}
|
}
|
||||||
if (target.classList.contains('el-rate__decimal')) {
|
if (hasClass(target, 'el-rate__decimal')) {
|
||||||
target = target.parentNode;
|
target = target.parentNode;
|
||||||
}
|
}
|
||||||
this.pointerAtLeftHalf = event.offsetX * 2 <= target.clientWidth;
|
this.pointerAtLeftHalf = event.offsetX * 2 <= target.clientWidth;
|
||||||
|
|
|
@ -1,71 +1,58 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="el-select-dropdown">
|
<div
|
||||||
|
class="el-select-dropdown"
|
||||||
|
:class="{ 'is-multiple': $parent.multiple }"
|
||||||
|
:style="{ minWidth: minWidth }">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script type="text/babel">
|
<script type="text/babel">
|
||||||
import Popper from 'main/utils/popper';
|
import Popper from 'main/utils/vue-popper';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'el-select-dropdown',
|
name: 'el-select-dropdown',
|
||||||
|
|
||||||
componentName: 'select-dropdown',
|
componentName: 'select-dropdown',
|
||||||
|
|
||||||
|
mixins: [Popper],
|
||||||
|
|
||||||
|
props: {
|
||||||
|
placement: {
|
||||||
|
default: 'bottom-start'
|
||||||
|
},
|
||||||
|
|
||||||
|
boundariesPadding: {
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
|
||||||
|
options: {
|
||||||
|
default() {
|
||||||
|
return {
|
||||||
|
forceAbsolute: true,
|
||||||
|
gpuAcceleration: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
popper: null
|
minWidth: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
watch: {
|
||||||
|
'$parent.inputWidth'() {
|
||||||
|
this.minWidth = this.$parent.$el.getBoundingClientRect().width + 'px';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.referenceElm = this.$parent.$refs.reference.$el;
|
||||||
|
this.$parent.popperElm = this.popperElm = this.$el;
|
||||||
this.$on('updatePopper', this.updatePopper);
|
this.$on('updatePopper', this.updatePopper);
|
||||||
this.$on('destroyPopper', this.destroyPopper);
|
this.$on('destroyPopper', this.destroyPopper);
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
updatePopper() {
|
|
||||||
if (this.popper) {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.popper.update();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.popper = new Popper(this.$parent.$refs.reference.$el, this.$el, {
|
|
||||||
gpuAcceleration: false,
|
|
||||||
placement: 'bottom-start',
|
|
||||||
boundariesPadding: 0,
|
|
||||||
forceAbsolute: true
|
|
||||||
});
|
|
||||||
this.popper.onCreate(popper => {
|
|
||||||
this.resetTransformOrigin(popper);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
destroyPopper() {
|
|
||||||
if (this.popper) {
|
|
||||||
this.resetTransformOrigin(this.popper);
|
|
||||||
setTimeout(() => {
|
|
||||||
this.popper.destroy();
|
|
||||||
this.popper = null;
|
|
||||||
}, 300);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
resetTransformOrigin(popper) {
|
|
||||||
let placementMap = { top: 'bottom', bottom: 'top' };
|
|
||||||
let placement = popper._popper.getAttribute('x-placement').split('-')[0];
|
|
||||||
let origin = placementMap[placement];
|
|
||||||
popper._popper.style.transformOrigin = `center ${ origin }`;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeDestroy() {
|
|
||||||
if (this.popper) {
|
|
||||||
this.popper.destroy();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
"repository": "https://github.com/element-component/element/tree/master/packages/select",
|
"repository": "https://github.com/element-component/element/tree/master/packages/select",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"throttle-debounce": "^1.0.1",
|
"throttle-debounce": "^1.0.1",
|
||||||
"vue-clickoutside": "0.0.4"
|
"vue-clickoutside": "0.0.4",
|
||||||
|
"wind-dom": "0.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="el-select" :class="{ 'is-multiple': multiple, 'is-small': size === 'small' }">
|
<div
|
||||||
|
class="el-select"
|
||||||
|
v-clickoutside="handleClose"
|
||||||
|
:class="{ 'is-multiple': multiple, 'is-small': size === 'small' }">
|
||||||
<div class="el-select__tags" v-if="multiple" @click.stop="toggleMenu" ref="tags" :style="{ 'max-width': inputWidth - 32 + 'px' }">
|
<div class="el-select__tags" v-if="multiple" @click.stop="toggleMenu" ref="tags" :style="{ 'max-width': inputWidth - 32 + 'px' }">
|
||||||
<transition-group @after-leave="resetInputHeight">
|
<transition-group @after-leave="resetInputHeight">
|
||||||
<el-tag
|
<el-tag
|
||||||
|
@ -45,10 +48,9 @@
|
||||||
@keydown.native.tab="visible = false"
|
@keydown.native.tab="visible = false"
|
||||||
@mouseenter.native="inputHovering = true"
|
@mouseenter.native="inputHovering = true"
|
||||||
@mouseleave.native="inputHovering = false"
|
@mouseleave.native="inputHovering = false"
|
||||||
:icon="iconClass"
|
:icon="iconClass">
|
||||||
v-element-clickoutside="handleClose">
|
|
||||||
</el-input>
|
</el-input>
|
||||||
<transition name="md-fade-bottom">
|
<transition name="md-fade-bottom" @after-leave="doDestroy">
|
||||||
<el-select-menu
|
<el-select-menu
|
||||||
ref="popper"
|
ref="popper"
|
||||||
v-show="visible && nodataText !== false">
|
v-show="visible && nodataText !== false">
|
||||||
|
@ -68,6 +70,7 @@
|
||||||
import ElTag from 'packages/tag/index.js';
|
import ElTag from 'packages/tag/index.js';
|
||||||
import debounce from 'throttle-debounce/debounce';
|
import debounce from 'throttle-debounce/debounce';
|
||||||
import Clickoutside from 'main/utils/clickoutside';
|
import Clickoutside from 'main/utils/clickoutside';
|
||||||
|
import { addClass, removeClass } from 'wind-dom/src/class';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [emitter],
|
mixins: [emitter],
|
||||||
|
@ -93,10 +96,10 @@
|
||||||
if (icon) {
|
if (icon) {
|
||||||
if (criteria) {
|
if (criteria) {
|
||||||
icon.addEventListener('click', this.deleteSelected);
|
icon.addEventListener('click', this.deleteSelected);
|
||||||
icon.classList.add('is-show-close');
|
addClass(icon, 'is-show-close');
|
||||||
} else {
|
} else {
|
||||||
icon.removeEventListener('click', this.deleteSelected);
|
icon.removeEventListener('click', this.deleteSelected);
|
||||||
icon.classList.remove('is-show-close');
|
removeClass(icon, 'is-show-close');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return criteria;
|
return criteria;
|
||||||
|
@ -127,9 +130,7 @@
|
||||||
ElTag
|
ElTag
|
||||||
},
|
},
|
||||||
|
|
||||||
directives: {
|
directives: { Clickoutside },
|
||||||
ElementClickoutside: Clickoutside
|
|
||||||
},
|
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
name: String,
|
name: String,
|
||||||
|
@ -270,7 +271,7 @@
|
||||||
if (!val) {
|
if (!val) {
|
||||||
this.$refs.reference.$el.querySelector('input').blur();
|
this.$refs.reference.$el.querySelector('input').blur();
|
||||||
if (this.$el.querySelector('.el-input__icon')) {
|
if (this.$el.querySelector('.el-input__icon')) {
|
||||||
this.$el.querySelector('.el-input__icon').classList.remove('is-reverse');
|
removeClass(this.$el.querySelector('.el-input__icon'), 'is-reverse');
|
||||||
}
|
}
|
||||||
this.broadcast('select-dropdown', 'destroyPopper');
|
this.broadcast('select-dropdown', 'destroyPopper');
|
||||||
if (this.$refs.input) {
|
if (this.$refs.input) {
|
||||||
|
@ -287,7 +288,7 @@
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.$el.querySelector('.el-input__icon')) {
|
if (this.$el.querySelector('.el-input__icon')) {
|
||||||
this.$el.querySelector('.el-input__icon').classList.add('is-reverse');
|
addClass(this.$el.querySelector('.el-input__icon'), 'is-reverse');
|
||||||
}
|
}
|
||||||
this.broadcast('select-dropdown', 'updatePopper');
|
this.broadcast('select-dropdown', 'updatePopper');
|
||||||
if (this.filterable) {
|
if (this.filterable) {
|
||||||
|
@ -316,6 +317,10 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
doDestroy() {
|
||||||
|
this.$refs.popper.doDestroy();
|
||||||
|
},
|
||||||
|
|
||||||
handleClose() {
|
handleClose() {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
},
|
},
|
||||||
|
|
|
@ -26,10 +26,11 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script type="text/ecmascript-6">
|
<script type="text/babel">
|
||||||
import Popper from 'main/utils/popper';
|
import Popper from 'main/utils/popper';
|
||||||
import ElInputNumber from 'packages/input-number/index.js';
|
import ElInputNumber from 'packages/input-number/index.js';
|
||||||
import { getStyle } from 'wind-dom/src/style';
|
import { getStyle } from 'wind-dom/src/style';
|
||||||
|
import { addClass, removeClass } from 'wind-dom/src/class';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ElSlider',
|
name: 'ElSlider',
|
||||||
|
@ -125,8 +126,8 @@
|
||||||
let placementMap = { top: 'bottom', bottom: 'top' };
|
let placementMap = { top: 'bottom', bottom: 'top' };
|
||||||
let placement = this.popper._popper.getAttribute('x-placement').split('-')[0];
|
let placement = this.popper._popper.getAttribute('x-placement').split('-')[0];
|
||||||
let origin = placementMap[placement];
|
let origin = placementMap[placement];
|
||||||
this.popper._popper.classList.add(placement);
|
addClass(this.popper._popper, placement);
|
||||||
this.popper._popper.classList.remove(placementMap[placement]);
|
removeClass(this.popper._popper, placementMap[placement]);
|
||||||
this.popper._popper.style.transformOrigin = `center ${ origin }`;
|
this.popper._popper.style.transformOrigin = `center ${ origin }`;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -12,17 +12,18 @@
|
||||||
<i class="el-step__line-inner" :style="lineStyle"></i>
|
<i class="el-step__line-inner" :style="lineStyle"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<slot
|
<span class="el-step__icon">
|
||||||
v-if="currentStatus !== 'success' && currentStatus !== 'error'"
|
<slot
|
||||||
name="icon">
|
v-if="currentStatus !== 'success' && currentStatus !== 'error'"
|
||||||
<i v-if="icon" :class="['el-step__icon', 'el-icon-' + icon]"></i>
|
name="icon">
|
||||||
<div v-else>{{ index + 1 }}</div>
|
<i v-if="icon" :class="['el-icon-' + icon]"></i>
|
||||||
</slot>
|
<div v-else>{{ index + 1 }}</div>
|
||||||
<i
|
</slot>
|
||||||
v-else
|
<i
|
||||||
class="el-step__icon"
|
v-else
|
||||||
:class="['el-icon-' + (currentStatus === 'success' ? 'check' : 'close')]">
|
:class="['el-icon-' + (currentStatus === 'success' ? 'check' : 'close')]">
|
||||||
</i>
|
</i>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="el-step__main"
|
class="el-step__main"
|
||||||
|
@ -59,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
|
||||||
};
|
};
|
||||||
|
|
|
@ -155,11 +155,6 @@ export default {
|
||||||
grid.$emit('rowclick', row, event);
|
grid.$emit('rowclick', row, event);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleCreate(vm) {
|
|
||||||
document.body.appendChild(vm.$refs.popper);
|
|
||||||
vm.updatePopper();
|
|
||||||
},
|
|
||||||
|
|
||||||
$getPropertyText(row, property, columnId) {
|
$getPropertyText(row, property, columnId) {
|
||||||
let grid = this.$parent;
|
let grid = this.$parent;
|
||||||
const column = getColumnById(grid, columnId);
|
const column = getColumnById(grid, columnId);
|
||||||
|
|
|
@ -190,7 +190,6 @@ export default {
|
||||||
|
|
||||||
return _self.showTooltipWhenOverflow
|
return _self.showTooltipWhenOverflow
|
||||||
? <el-tooltip
|
? <el-tooltip
|
||||||
on-created={ this.handleCreate }
|
|
||||||
effect={ this.effect }
|
effect={ this.effect }
|
||||||
placement="top"
|
placement="top"
|
||||||
disabled={ this.tooltipDisabled }>
|
disabled={ this.tooltipDisabled }>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
font-variant: normal;
|
font-variant: normal;
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
vertical-align: bottom;
|
vertical-align: baseline;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
/* Better Font Rendering =========== */
|
/* Better Font Rendering =========== */
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
@import "./radio.css";
|
@import "./radio.css";
|
||||||
@import "./switch.css";
|
@import "./switch.css";
|
||||||
@import "./dropdown.css";
|
@import "./dropdown.css";
|
||||||
|
@import "./dropdown-menu.css";
|
||||||
@import "./loading.css";
|
@import "./loading.css";
|
||||||
@import "./dialog.css";
|
@import "./dialog.css";
|
||||||
@import "./table.css";
|
@import "./table.css";
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
@component-namespace el {
|
@component-namespace el {
|
||||||
|
|
||||||
@b select-dropdown {
|
@b select-dropdown {
|
||||||
width: 100%;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 1001;
|
z-index: 1001;
|
||||||
border: solid 1px #d3dce6;
|
border: solid 1px #d3dce6;
|
||||||
|
@ -12,5 +11,44 @@
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
|
box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
margin: 5px 0;
|
||||||
|
|
||||||
|
@when multiple {
|
||||||
|
& .el-select-dropdown__item.selected {
|
||||||
|
color: #20A0FF;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
&.hover {
|
||||||
|
background-color: #E5E9F2;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
font-family: 'element-icons';
|
||||||
|
content: "\E608";
|
||||||
|
font-size: 11px;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@b select-dropdown__nodata {
|
||||||
|
padding: 10px 0;
|
||||||
|
margin: 0;
|
||||||
|
text-align: center;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
@b select-dropdown__list {
|
||||||
|
list-style: none;
|
||||||
|
padding: 6px 0;
|
||||||
|
margin: 0;
|
||||||
|
width: 100%;
|
||||||
|
max-height: 274px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,27 +25,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& .el-select-dropdown {
|
|
||||||
margin: 5px 0;
|
|
||||||
|
|
||||||
& p.el-select-dropdown__nodata {
|
|
||||||
padding: 10px 0;
|
|
||||||
margin: 0;
|
|
||||||
text-align: center;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
& .el-select-dropdown__list {
|
|
||||||
list-style: none;
|
|
||||||
padding: 6px 0;
|
|
||||||
margin: 0;
|
|
||||||
width: 100%;
|
|
||||||
max-height: 274px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
& .el-input {
|
& .el-input {
|
||||||
& .el-input__icon {
|
& .el-input__icon {
|
||||||
color: #c0ccda;
|
color: #c0ccda;
|
||||||
|
@ -95,27 +74,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@when multiple {
|
|
||||||
& .el-select-dropdown__item.selected {
|
|
||||||
color: #20A0FF;
|
|
||||||
background-color: #fff;
|
|
||||||
|
|
||||||
&.hover {
|
|
||||||
background-color: #E5E9F2;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
position: absolute;
|
|
||||||
right: 10px;
|
|
||||||
font-family: 'element-icons';
|
|
||||||
content: "\E608";
|
|
||||||
font-size: 11px;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@e input {
|
@e input {
|
||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
|
|
@ -19,10 +19,6 @@
|
||||||
& .el-step__main {
|
& .el-step__main {
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
& .el-step__description {
|
|
||||||
width: 300px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@e line {
|
@e line {
|
||||||
|
@ -69,6 +65,10 @@
|
||||||
|
|
||||||
@e icon {
|
@e icon {
|
||||||
line-height: 28px;
|
line-height: 28px;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@e head {
|
@e head {
|
||||||
|
@ -149,7 +149,7 @@
|
||||||
|
|
||||||
@e title {
|
@e title {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-top: 5px;
|
line-height: 32px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
@when process {
|
@when process {
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
@import "../../date-picker/src/css/vars.css";
|
@import "../../date-picker/src/css/vars.css";
|
||||||
|
|
||||||
.time-select {
|
.time-select {
|
||||||
min-width: 200px;
|
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
width: 100%;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-select .el-picker-panel__content {
|
.time-select .el-picker-panel__content {
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
<span
|
<span
|
||||||
v-if="node.loading"
|
v-if="node.loading"
|
||||||
class="el-tree-node__icon el-icon-loading"
|
class="el-tree-node__icon el-icon-loading"
|
||||||
>
|
>
|
||||||
</span>
|
</span>
|
||||||
<span class="el-tree-node__label">{{ node.label }}</span>
|
<span class="el-tree-node__label" v-html="node.label"></span>
|
||||||
</div>
|
</div>
|
||||||
<collapse-transition>
|
<collapse-transition>
|
||||||
<div class="el-tree-node__children"
|
<div class="el-tree-node__children"
|
||||||
|
@ -94,9 +94,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleCheckChange(checked) {
|
handleCheckChange(ev) {
|
||||||
if (!this.node.indeterminate) {
|
if (!this.node.indeterminate) {
|
||||||
this.node.setChecked(checked, true);
|
this.node.setChecked(ev.target.checked, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,18 +31,13 @@ export default {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
multiple: {
|
data: Object,
|
||||||
type: Boolean,
|
multiple: Boolean,
|
||||||
default: false
|
|
||||||
},
|
|
||||||
name: {
|
name: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'file'
|
default: 'file'
|
||||||
},
|
},
|
||||||
withCredentials: {
|
withCredentials: Boolean,
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
thumbnailMode: Boolean,
|
thumbnailMode: Boolean,
|
||||||
showUploadList: {
|
showUploadList: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -179,6 +174,7 @@ export default {
|
||||||
'with-credentials': this.withCredentials,
|
'with-credentials': this.withCredentials,
|
||||||
headers: this.headers,
|
headers: this.headers,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
|
data: this.data,
|
||||||
accept: this.thumbnailMode ? 'image/*' : this.accept,
|
accept: this.thumbnailMode ? 'image/*' : this.accept,
|
||||||
'on-start': this.handleStart,
|
'on-start': this.handleStart,
|
||||||
'on-progress': this.handleProgress,
|
'on-progress': this.handleProgress,
|
||||||
|
|
|
@ -34,6 +34,7 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'file'
|
default: 'file'
|
||||||
},
|
},
|
||||||
|
data: Object,
|
||||||
headers: Object,
|
headers: Object,
|
||||||
withCredentials: Boolean,
|
withCredentials: Boolean,
|
||||||
multiple: Boolean,
|
multiple: Boolean,
|
||||||
|
@ -133,6 +134,7 @@ export default {
|
||||||
headers: this.headers,
|
headers: this.headers,
|
||||||
withCredentials: this.withCredentials,
|
withCredentials: this.withCredentials,
|
||||||
file: file,
|
file: file,
|
||||||
|
data: this.data,
|
||||||
filename: this.name,
|
filename: this.name,
|
||||||
onProgress: e => {
|
onProgress: e => {
|
||||||
this.onProgress(e, file);
|
this.onProgress(e, file);
|
||||||
|
|
|
@ -127,7 +127,7 @@ if (typeof window !== 'undefined' && window.Vue) {
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
version: '1.0.0-rc.5',
|
version: '1.0.0-rc.6',
|
||||||
install,
|
install,
|
||||||
SelectDropdown,
|
SelectDropdown,
|
||||||
Pagination,
|
Pagination,
|
||||||
|
|
|
@ -12,7 +12,7 @@ function broadcast(componentName, eventName, params) {
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
dispatch(componentName, eventName, params) {
|
dispatch(componentName, eventName, params) {
|
||||||
var parent = this.$parent;
|
var parent = this.$parent || this.$root;
|
||||||
var name = parent.$options.componentName;
|
var name = parent.$options.componentName;
|
||||||
|
|
||||||
while (parent && (!name || name !== componentName)) {
|
while (parent && (!name || name !== componentName)) {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { on, off } from 'wind-dom/src/event';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* v-clickoutside
|
* v-clickoutside
|
||||||
* @desc 点击元素外面才会触发的事件
|
* @desc 点击元素外面才会触发的事件
|
||||||
|
@ -11,7 +13,10 @@ const clickoutsideContext = '@@clickoutsideContext';
|
||||||
export default {
|
export default {
|
||||||
bind(el, binding, vnode) {
|
bind(el, binding, vnode) {
|
||||||
const documentHandler = function(e) {
|
const documentHandler = function(e) {
|
||||||
if (!vnode.context || el.contains(e.target)) return;
|
if (!vnode.context ||
|
||||||
|
el.contains(e.target) ||
|
||||||
|
!vnode.context.popperElm ||
|
||||||
|
vnode.context.popperElm.contains(e.target)) return;
|
||||||
if (binding.expression) {
|
if (binding.expression) {
|
||||||
vnode.context[el[clickoutsideContext].methodName]();
|
vnode.context[el[clickoutsideContext].methodName]();
|
||||||
} else {
|
} else {
|
||||||
|
@ -23,7 +28,7 @@ export default {
|
||||||
methodName: binding.expression,
|
methodName: binding.expression,
|
||||||
bindingFn: binding.value
|
bindingFn: binding.value
|
||||||
};
|
};
|
||||||
document.addEventListener('click', documentHandler);
|
on(document, 'click', documentHandler);
|
||||||
},
|
},
|
||||||
|
|
||||||
update(el, binding) {
|
update(el, binding) {
|
||||||
|
@ -32,7 +37,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
unbind(el) {
|
unbind(el) {
|
||||||
document.removeEventListener('click', el[clickoutsideContext].documentHandler);
|
off(document, 'click', el[clickoutsideContext].documentHandler);
|
||||||
},
|
},
|
||||||
|
|
||||||
install(Vue) {
|
install(Vue) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import PopperJS from './popper';
|
import PopperJS from './popper';
|
||||||
|
import { PopupManager } from 'vue-popup';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {HTMLElement} [reference=$refs.reference] - The reference element used to position the popper.
|
* @param {HTMLElement} [reference=$refs.reference] - The reference element used to position the popper.
|
||||||
|
@ -26,10 +27,16 @@ export default {
|
||||||
value: Boolean,
|
value: Boolean,
|
||||||
visibleArrow: Boolean,
|
visibleArrow: Boolean,
|
||||||
transition: String,
|
transition: String,
|
||||||
|
appendToBody: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
options: {
|
options: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default() {
|
default() {
|
||||||
return {};
|
return {
|
||||||
|
gpuAcceleration: false
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -62,59 +69,48 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
const options = this.options;
|
const options = this.options;
|
||||||
const popper = this.popper || this.$refs.popper;
|
const popper = this.popperElm = this.popperElm || this.popper || this.$refs.popper;
|
||||||
const reference = this.reference || this.$refs.reference || this.$slots.reference[0].elm;
|
const reference = this.referenceElm = this.referenceElm || this.reference || this.$refs.reference || this.$slots.reference[0].elm;
|
||||||
|
|
||||||
if (!popper || !reference) return;
|
if (!popper || !reference) return;
|
||||||
if (this.visibleArrow) {
|
|
||||||
this.appendArrow(popper);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (this.visibleArrow) this.appendArrow(popper);
|
||||||
|
if (this.appendToBody) document.body.appendChild(this.popperElm);
|
||||||
if (this.popperJS && this.popperJS.hasOwnProperty('destroy')) {
|
if (this.popperJS && this.popperJS.hasOwnProperty('destroy')) {
|
||||||
this.popperJS.destroy();
|
this.popperJS.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
options.placement = this.placement;
|
options.placement = this.placement;
|
||||||
options.offset = this.offset;
|
options.offset = this.offset;
|
||||||
|
this.popperJS = new PopperJS(reference, popper, options);
|
||||||
this.$nextTick(() => {
|
this.popperJS.onCreate(_ => {
|
||||||
this.popperJS = new PopperJS(
|
this.$emit('created', this);
|
||||||
reference,
|
this.resetTransformOrigin();
|
||||||
popper,
|
|
||||||
options
|
|
||||||
);
|
|
||||||
this.popperJS.onCreate(popper => {
|
|
||||||
this.resetTransformOrigin(popper);
|
|
||||||
this.$emit('created', this);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
this.popperJS._popper.style.zIndex = PopupManager.nextZIndex();
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePopper() {
|
updatePopper() {
|
||||||
if (this.popperJS) {
|
this.popperJS ? this.popperJS.update() : this.createPopper();
|
||||||
this.popperJS.update();
|
|
||||||
} else {
|
|
||||||
this.createPopper();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
doDestroy() {
|
doDestroy() {
|
||||||
if (this.showPopper) return;
|
if (this.showPopper || !this.popperJS) return;
|
||||||
this.popperJS.destroy();
|
this.popperJS.destroy();
|
||||||
this.popperJS = null;
|
this.popperJS = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyPopper() {
|
destroyPopper() {
|
||||||
if (this.popperJS) {
|
if (this.popperJS) {
|
||||||
this.resetTransformOrigin(this.popperJS);
|
this.resetTransformOrigin();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
resetTransformOrigin(popper) {
|
resetTransformOrigin() {
|
||||||
let placementMap = { top: 'bottom', bottom: 'top', left: 'right', right: 'left' };
|
let placementMap = { top: 'bottom', bottom: 'top', left: 'right', right: 'left' };
|
||||||
let placement = popper._popper.getAttribute('x-placement').split('-')[0];
|
let placement = this.popperJS._popper.getAttribute('x-placement').split('-')[0];
|
||||||
let origin = placementMap[placement];
|
let origin = placementMap[placement];
|
||||||
popper._popper.style.transformOrigin = ['top', 'bottom'].indexOf(placement) > -1 ? `center ${ origin }` : `${ origin } center`;
|
this.popperJS._popper.style.transformOrigin = ['top', 'bottom'].indexOf(placement) > -1 ? `center ${ origin }` : `${ origin } center`;
|
||||||
},
|
},
|
||||||
|
|
||||||
appendArrow(element) {
|
appendArrow(element) {
|
||||||
|
@ -144,8 +140,9 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
if (this.popperJS) {
|
this.doDestroy();
|
||||||
this.popperJS.destroy();
|
this.popperElm &&
|
||||||
}
|
document.body.contains(this.popperElm) &&
|
||||||
|
document.body.removeChild(this.popperElm);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue