mirror of https://github.com/ElemeFE/element
				
				
				
			Merge remote-tracking branch 'eleme/dev' into carbon
# Conflicts: # examples/docs/en-US/input.md # examples/docs/zh-CN/input.mdpull/6214/head^2
						commit
						b922664aa6
					
				| 
						 | 
					@ -206,6 +206,7 @@ Currently Element ships with the following languages:
 | 
				
			||||||
  <li>Estonian (ee)</li>
 | 
					  <li>Estonian (ee)</li>
 | 
				
			||||||
  <li>Slovenian (sl)</li>
 | 
					  <li>Slovenian (sl)</li>
 | 
				
			||||||
  <li>Arabic (ar)</li>
 | 
					  <li>Arabic (ar)</li>
 | 
				
			||||||
 | 
					  <li>Hebrew (he)</li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If your target language is not included, you are more than welcome to contribute: just add another language config [here](https://github.com/ElemeFE/element/tree/master/src/locale/lang) and create a pull request.
 | 
					If your target language is not included, you are more than welcome to contribute: just add another language config [here](https://github.com/ElemeFE/element/tree/master/src/locale/lang) and create a pull request.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -669,7 +669,8 @@ Attribute | Description | Type | Options | Default
 | 
				
			||||||
| popper-class | custom class name for autocomplete's dropdown | string | — | — |
 | 
					| popper-class | custom class name for autocomplete's dropdown | string | — | — |
 | 
				
			||||||
| trigger-on-focus | whether show suggestions when input focus | boolean | — | true |
 | 
					| trigger-on-focus | whether show suggestions when input focus | boolean | — | true |
 | 
				
			||||||
| on-icon-click | hook function when clicking on the input icon | function | — | — |
 | 
					| on-icon-click | hook function when clicking on the input icon | function | — | — |
 | 
				
			||||||
|name | same as `name` in native input | string | — | — |
 | 
					| name | same as `name` in native input | string | — | — |
 | 
				
			||||||
 | 
					| select-when-unmatched | whether to emit a `select` event on enter when there is no autocomplete match | boolean | — | false |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### props
 | 
					### props
 | 
				
			||||||
| Attribute | Description | Type | Accepted Values | Default |
 | 
					| Attribute | Description | Type | Accepted Values | Default |
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,16 +15,42 @@
 | 
				
			||||||
        width: 110px;
 | 
					        width: 110px;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    .el-tooltip + .el-tooltip {
 | 
				
			||||||
 | 
					      margin-left: 15px;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    .box {
 | 
					    .box {
 | 
				
			||||||
 | 
					      width: 400px;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					      .top {
 | 
				
			||||||
 | 
					        text-align: center;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
      .left {
 | 
					      .left {
 | 
				
			||||||
        float: left;
 | 
					        float: left;
 | 
				
			||||||
        width: 110px;
 | 
					        width: 110px;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
      .right {
 | 
					      .right {
 | 
				
			||||||
        float: right;
 | 
					        float: right;
 | 
				
			||||||
        width: 110px;
 | 
					        width: 110px;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      .bottom {
 | 
				
			||||||
 | 
					        clear: both;
 | 
				
			||||||
 | 
					        text-align: center;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      .item {
 | 
				
			||||||
 | 
					        margin: 4px;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      .left .el-tooltip__popper,
 | 
				
			||||||
 | 
					      .right .el-tooltip__popper {
 | 
				
			||||||
 | 
					        padding: 8px 10px;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      .el-tooltip {
 | 
				
			||||||
 | 
					        margin-left: 0;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -218,6 +218,7 @@ ElementLocale.i18n((key, value) => i18n.t(key, value))
 | 
				
			||||||
  <li>爱沙尼亚语(ee)</li>
 | 
					  <li>爱沙尼亚语(ee)</li>
 | 
				
			||||||
  <li>斯洛文尼亚语(sl)</li>
 | 
					  <li>斯洛文尼亚语(sl)</li>
 | 
				
			||||||
  <li>阿拉伯语(ar)</li>
 | 
					  <li>阿拉伯语(ar)</li>
 | 
				
			||||||
 | 
					  <li>希伯来语(he)</li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
如果你需要使用其他的语言,欢迎贡献 PR:只需在 [这里](https://github.com/ElemeFE/element/tree/master/src/locale/lang) 添加一个语言配置文件即可。
 | 
					如果你需要使用其他的语言,欢迎贡献 PR:只需在 [这里](https://github.com/ElemeFE/element/tree/master/src/locale/lang) 添加一个语言配置文件即可。
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -825,6 +825,11 @@ export default {
 | 
				
			||||||
| focus | 在 Input 获得焦点时触发 | (event: Event) |
 | 
					| focus | 在 Input 获得焦点时触发 | (event: Event) |
 | 
				
			||||||
| change | 在 Input 值改变时触发 | (value: string \| number) |
 | 
					| change | 在 Input 值改变时触发 | (value: string \| number) |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Input Methods
 | 
				
			||||||
 | 
					| 方法名 | 说明 | 参数 |
 | 
				
			||||||
 | 
					| ---- | ---- | ---- |
 | 
				
			||||||
 | 
					| focus | 使 input 获取焦点 | - |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Autocomplete Attributes
 | 
					### Autocomplete Attributes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 参数          | 说明            | 类型            | 可选值                 | 默认值   |
 | 
					| 参数          | 说明            | 类型            | 可选值                 | 默认值   |
 | 
				
			||||||
| 
						 | 
					@ -840,8 +845,9 @@ export default {
 | 
				
			||||||
| on-icon-click | 点击图标的回调函数 | function | — | — |
 | 
					| on-icon-click | 点击图标的回调函数 | function | — | — |
 | 
				
			||||||
| icon          | 输入框尾部图标    | string          | — | — |
 | 
					| icon          | 输入框尾部图标    | string          | — | — |
 | 
				
			||||||
| name | 原生属性 | string | — | — |
 | 
					| name | 原生属性 | string | — | — |
 | 
				
			||||||
 | 
					| select-when-unmatched | 在输入没有任何匹配建议的情况下,按下回车是否触发 `select` 事件 | boolean | — | false |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Props
 | 
					### props
 | 
				
			||||||
| 参数     | 说明              | 类型   | 可选值 | 默认值 |
 | 
					| 参数     | 说明              | 类型   | 可选值 | 默认值 |
 | 
				
			||||||
| -------- | ----------------- | ------ | ------ | ------ |
 | 
					| -------- | ----------------- | ------ | ------ | ------ |
 | 
				
			||||||
| value    | 指定选项的值为选项对象的某个属性值 | string | — | value |
 | 
					| value    | 指定选项的值为选项对象的某个属性值 | string | — | value |
 | 
				
			||||||
| 
						 | 
					@ -851,8 +857,3 @@ export default {
 | 
				
			||||||
| 事件名称 | 说明 | 回调参数 |
 | 
					| 事件名称 | 说明 | 回调参数 |
 | 
				
			||||||
|---------|--------|---------|
 | 
					|---------|--------|---------|
 | 
				
			||||||
| select | 点击选中建议项时触发 | 选中建议项 |
 | 
					| select | 点击选中建议项时触发 | 选中建议项 |
 | 
				
			||||||
 | 
					 | 
				
			||||||
### Methods
 | 
					 | 
				
			||||||
| 方法名 | 说明 | 参数 |
 | 
					 | 
				
			||||||
| ---- | ---- | ---- |
 | 
					 | 
				
			||||||
| focus | 使 input 获取焦点 | - |
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -215,3 +215,4 @@ tooltip 内不支持 disabled form 元素,参考[MDN](https://developer.mozill
 | 
				
			||||||
| manual | 手动控制模式,设置为 true 后,mouseenter 和 mouseleave 事件将不会生效 | Boolean | — | false |
 | 
					| manual | 手动控制模式,设置为 true 后,mouseenter 和 mouseleave 事件将不会生效 | Boolean | — | false |
 | 
				
			||||||
| popper-class | 为 Tooltip 的 popper 添加类名 | String | — | — |
 | 
					| popper-class | 为 Tooltip 的 popper 添加类名 | String | — | — |
 | 
				
			||||||
| enterable | 鼠标是否可进入到 tooltip 中 | Boolean | — | true |
 | 
					| enterable | 鼠标是否可进入到 tooltip 中 | Boolean | — | true |
 | 
				
			||||||
 | 
					| hide-after | Tooltip 出现后自动隐藏延时,单位毫秒,为 0 则不会自动隐藏 | number | — | 0 |
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,11 @@
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      customItem: String,
 | 
					      customItem: String,
 | 
				
			||||||
      icon: String,
 | 
					      icon: String,
 | 
				
			||||||
      onIconClick: Function
 | 
					      onIconClick: Function,
 | 
				
			||||||
 | 
					      selectWhenUnmatched: {
 | 
				
			||||||
 | 
					        type: Boolean,
 | 
				
			||||||
 | 
					        default: false
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    data() {
 | 
					    data() {
 | 
				
			||||||
      return {
 | 
					      return {
 | 
				
			||||||
| 
						 | 
					@ -142,6 +146,12 @@
 | 
				
			||||||
        if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) {
 | 
					        if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) {
 | 
				
			||||||
          e.preventDefault();
 | 
					          e.preventDefault();
 | 
				
			||||||
          this.select(this.suggestions[this.highlightedIndex]);
 | 
					          this.select(this.suggestions[this.highlightedIndex]);
 | 
				
			||||||
 | 
					        } else if (this.selectWhenUnmatched) {
 | 
				
			||||||
 | 
					          this.$emit('select', {value: this.value});
 | 
				
			||||||
 | 
					          this.$nextTick(_ => {
 | 
				
			||||||
 | 
					            this.suggestions = [];
 | 
				
			||||||
 | 
					            this.highlightedIndex = -1;
 | 
				
			||||||
 | 
					          });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      select(item) {
 | 
					      select(item) {
 | 
				
			||||||
| 
						 | 
					@ -149,11 +159,15 @@
 | 
				
			||||||
        this.$emit('select', item);
 | 
					        this.$emit('select', item);
 | 
				
			||||||
        this.$nextTick(_ => {
 | 
					        this.$nextTick(_ => {
 | 
				
			||||||
          this.suggestions = [];
 | 
					          this.suggestions = [];
 | 
				
			||||||
 | 
					          this.highlightedIndex = -1;
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      highlight(index) {
 | 
					      highlight(index) {
 | 
				
			||||||
        if (!this.suggestionVisible || this.loading) { return; }
 | 
					        if (!this.suggestionVisible || this.loading) { return; }
 | 
				
			||||||
        if (index < 0) index = 0;
 | 
					        if (index < 0) {
 | 
				
			||||||
 | 
					          this.highlightedIndex = -1;
 | 
				
			||||||
 | 
					          return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if (index >= this.suggestions.length) {
 | 
					        if (index >= this.suggestions.length) {
 | 
				
			||||||
          index = this.suggestions.length - 1;
 | 
					          index = this.suggestions.length - 1;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,7 +67,7 @@
 | 
				
			||||||
        var year = this.date.getFullYear();
 | 
					        var year = this.date.getFullYear();
 | 
				
			||||||
        var date = new Date(0);
 | 
					        var date = new Date(0);
 | 
				
			||||||
        date.setFullYear(year);
 | 
					        date.setFullYear(year);
 | 
				
			||||||
        date.setMonth(month);
 | 
					        date.setMonth(month, 1);
 | 
				
			||||||
        date.setHours(0);
 | 
					        date.setHours(0);
 | 
				
			||||||
        var nextMonth = new Date(date);
 | 
					        var nextMonth = new Date(date);
 | 
				
			||||||
        nextMonth.setMonth(month + 1);
 | 
					        nextMonth.setMonth(month + 1);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,9 +63,7 @@
 | 
				
			||||||
      getCellStyle(year) {
 | 
					      getCellStyle(year) {
 | 
				
			||||||
        const style = {};
 | 
					        const style = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var date = new Date(0);
 | 
					        var date = new Date(year, 0, 1, 0);
 | 
				
			||||||
        date.setFullYear(year);
 | 
					 | 
				
			||||||
        date.setHours(0);
 | 
					 | 
				
			||||||
        var nextYear = new Date(date);
 | 
					        var nextYear = new Date(date);
 | 
				
			||||||
        nextYear.setFullYear(year + 1);
 | 
					        nextYear.setFullYear(year + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -156,6 +156,14 @@
 | 
				
			||||||
  import DateTable from '../basic/date-table';
 | 
					  import DateTable from '../basic/date-table';
 | 
				
			||||||
  import ElInput from 'element-ui/packages/input';
 | 
					  import ElInput from 'element-ui/packages/input';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const calcDefaultValue = defaultValue => {
 | 
				
			||||||
 | 
					    if (Array.isArray(defaultValue)) {
 | 
				
			||||||
 | 
					      return new Date(defaultValue[0]);
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      return new Date(defaultValue);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  export default {
 | 
					  export default {
 | 
				
			||||||
    mixins: [Locale],
 | 
					    mixins: [Locale],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -232,7 +240,7 @@
 | 
				
			||||||
        popperClass: '',
 | 
					        popperClass: '',
 | 
				
			||||||
        minPickerWidth: 0,
 | 
					        minPickerWidth: 0,
 | 
				
			||||||
        maxPickerWidth: 0,
 | 
					        maxPickerWidth: 0,
 | 
				
			||||||
        date: new Date(),
 | 
					        date: this.$options.defaultValue ? calcDefaultValue(this.$options.defaultValue) : new Date(),
 | 
				
			||||||
        minDate: '',
 | 
					        minDate: '',
 | 
				
			||||||
        maxDate: '',
 | 
					        maxDate: '',
 | 
				
			||||||
        rangeState: {
 | 
					        rangeState: {
 | 
				
			||||||
| 
						 | 
					@ -309,6 +317,7 @@
 | 
				
			||||||
      handleClear() {
 | 
					      handleClear() {
 | 
				
			||||||
        this.minDate = null;
 | 
					        this.minDate = null;
 | 
				
			||||||
        this.maxDate = null;
 | 
					        this.maxDate = null;
 | 
				
			||||||
 | 
					        this.date = this.$options.defaultValue ? calcDefaultValue(this.$options.defaultValue) : new Date();
 | 
				
			||||||
        this.handleConfirm(false);
 | 
					        this.handleConfirm(false);
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,7 @@
 | 
				
			||||||
    <div class="el-table-filter" v-else v-show="showPopper">
 | 
					    <div class="el-table-filter" v-else v-show="showPopper">
 | 
				
			||||||
      <ul class="el-table-filter__list">
 | 
					      <ul class="el-table-filter__list">
 | 
				
			||||||
        <li class="el-table-filter__list-item"
 | 
					        <li class="el-table-filter__list-item"
 | 
				
			||||||
            :class="{ 'is-active': !filterValue }"
 | 
					            :class="{ 'is-active': filterValue === undefined || filterValue === null }"
 | 
				
			||||||
            @click="handleSelect(null)">{{ t('el.table.clearFilter') }}</li>
 | 
					            @click="handleSelect(null)">{{ t('el.table.clearFilter') }}</li>
 | 
				
			||||||
        <li class="el-table-filter__list-item"
 | 
					        <li class="el-table-filter__list-item"
 | 
				
			||||||
            v-for="filter in filters"
 | 
					            v-for="filter in filters"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,16 +88,17 @@ export default {
 | 
				
			||||||
    if (!this.$slots.default || !this.$slots.default.length) return this.$slots.default;
 | 
					    if (!this.$slots.default || !this.$slots.default.length) return this.$slots.default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const vnode = getFirstComponentChild(this.$slots.default);
 | 
					    const vnode = getFirstComponentChild(this.$slots.default);
 | 
				
			||||||
    if (!vnode || this.handlerAdded) return vnode;
 | 
					    if (!vnode) return vnode;
 | 
				
			||||||
    const data = vnode.data = vnode.data || {};
 | 
					    const data = vnode.data = vnode.data || {};
 | 
				
			||||||
    const on = vnode.data.on = vnode.data.on || {};
 | 
					    const on = vnode.data.on = vnode.data.on || {};
 | 
				
			||||||
    const nativeOn = vnode.data.nativeOn = vnode.data.nativeOn || {};
 | 
					    const nativeOn = vnode.data.nativeOn = vnode.data.nativeOn || {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    data.staticClass = this.concatClass(data.staticClass, 'el-tooltip');
 | 
				
			||||||
 | 
					    if (this.handlerAdded) return vnode;
 | 
				
			||||||
    on.mouseenter = this.addEventHandle(on.mouseenter, () => { this.setExpectedState(true); this.handleShowPopper(); });
 | 
					    on.mouseenter = this.addEventHandle(on.mouseenter, () => { this.setExpectedState(true); this.handleShowPopper(); });
 | 
				
			||||||
    on.mouseleave = this.addEventHandle(on.mouseleave, () => { this.setExpectedState(false); this.debounceClose(); });
 | 
					    on.mouseleave = this.addEventHandle(on.mouseleave, () => { this.setExpectedState(false); this.debounceClose(); });
 | 
				
			||||||
    nativeOn.mouseenter = this.addEventHandle(nativeOn.mouseenter, () => { this.setExpectedState(true); this.handleShowPopper(); });
 | 
					    nativeOn.mouseenter = this.addEventHandle(nativeOn.mouseenter, () => { this.setExpectedState(true); this.handleShowPopper(); });
 | 
				
			||||||
    nativeOn.mouseleave = this.addEventHandle(nativeOn.mouseleave, () => { this.setExpectedState(false); this.debounceClose(); });
 | 
					    nativeOn.mouseleave = this.addEventHandle(nativeOn.mouseleave, () => { this.setExpectedState(false); this.debounceClose(); });
 | 
				
			||||||
    data.staticClass = this.concatClass(data.staticClass, 'el-tooltip');
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return vnode;
 | 
					    return vnode;
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -48,7 +48,7 @@ export default function upload(option) {
 | 
				
			||||||
  const formData = new FormData();
 | 
					  const formData = new FormData();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (option.data) {
 | 
					  if (option.data) {
 | 
				
			||||||
    Object.keys(option.data).map(key => {
 | 
					    Object.keys(option.data).forEach(key => {
 | 
				
			||||||
      formData.append(key, option.data[key]);
 | 
					      formData.append(key, option.data[key]);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -139,13 +139,13 @@ export default {
 | 
				
			||||||
      this.onChange(file, this.uploadFiles);
 | 
					      this.onChange(file, this.uploadFiles);
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    handleProgress(ev, rawFile) {
 | 
					    handleProgress(ev, rawFile) {
 | 
				
			||||||
      var file = this.getFile(rawFile);
 | 
					      const file = this.getFile(rawFile);
 | 
				
			||||||
      this.onProgress(ev, file, this.uploadFiles);
 | 
					      this.onProgress(ev, file, this.uploadFiles);
 | 
				
			||||||
      file.status = 'uploading';
 | 
					      file.status = 'uploading';
 | 
				
			||||||
      file.percentage = ev.percent || 0;
 | 
					      file.percentage = ev.percent || 0;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    handleSuccess(res, rawFile) {
 | 
					    handleSuccess(res, rawFile) {
 | 
				
			||||||
      var file = this.getFile(rawFile);
 | 
					      const file = this.getFile(rawFile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (file) {
 | 
					      if (file) {
 | 
				
			||||||
        file.status = 'success';
 | 
					        file.status = 'success';
 | 
				
			||||||
| 
						 | 
					@ -156,8 +156,8 @@ export default {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    handleError(err, rawFile) {
 | 
					    handleError(err, rawFile) {
 | 
				
			||||||
      var file = this.getFile(rawFile);
 | 
					      const file = this.getFile(rawFile);
 | 
				
			||||||
      var fileList = this.uploadFiles;
 | 
					      const fileList = this.uploadFiles;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      file.status = 'fail';
 | 
					      file.status = 'fail';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -171,13 +171,13 @@ export default {
 | 
				
			||||||
        file = this.getFile(raw);
 | 
					        file = this.getFile(raw);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      this.abort(file);
 | 
					      this.abort(file);
 | 
				
			||||||
      var fileList = this.uploadFiles;
 | 
					      let fileList = this.uploadFiles;
 | 
				
			||||||
      fileList.splice(fileList.indexOf(file), 1);
 | 
					      fileList.splice(fileList.indexOf(file), 1);
 | 
				
			||||||
      this.onRemove(file, fileList);
 | 
					      this.onRemove(file, fileList);
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    getFile(rawFile) {
 | 
					    getFile(rawFile) {
 | 
				
			||||||
      var fileList = this.uploadFiles;
 | 
					      let fileList = this.uploadFiles;
 | 
				
			||||||
      var target;
 | 
					      let target;
 | 
				
			||||||
      fileList.every(item => {
 | 
					      fileList.every(item => {
 | 
				
			||||||
        target = rawFile.uid === item.uid ? item : null;
 | 
					        target = rawFile.uid === item.uid ? item : null;
 | 
				
			||||||
        return !target;
 | 
					        return !target;
 | 
				
			||||||
| 
						 | 
					@ -209,7 +209,7 @@ export default {
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  render(h) {
 | 
					  render(h) {
 | 
				
			||||||
    var uploadList;
 | 
					    let uploadList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (this.showFileList) {
 | 
					    if (this.showFileList) {
 | 
				
			||||||
      uploadList = (
 | 
					      uploadList = (
 | 
				
			||||||
| 
						 | 
					@ -223,7 +223,7 @@ export default {
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var uploadData = {
 | 
					    const uploadData = {
 | 
				
			||||||
      props: {
 | 
					      props: {
 | 
				
			||||||
        type: this.type,
 | 
					        type: this.type,
 | 
				
			||||||
        drag: this.drag,
 | 
					        drag: this.drag,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -90,12 +90,12 @@ export default {
 | 
				
			||||||
            this.post(rawFile);
 | 
					            this.post(rawFile);
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }, () => {
 | 
					        }, () => {
 | 
				
			||||||
          this.onRemove(rawFile, true);
 | 
					          this.onRemove(null, rawFile);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      } else if (before !== false) {
 | 
					      } else if (before !== false) {
 | 
				
			||||||
        this.post(rawFile);
 | 
					        this.post(rawFile);
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        this.onRemove(rawFile, true);
 | 
					        this.onRemove(null, rawFile);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    abort(file) {
 | 
					    abort(file) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -95,10 +95,10 @@ export default {
 | 
				
			||||||
    transfer: {
 | 
					    transfer: {
 | 
				
			||||||
      noMatch: 'אין נתונים מתאימים',
 | 
					      noMatch: 'אין נתונים מתאימים',
 | 
				
			||||||
      noData: 'ללא נתונים',
 | 
					      noData: 'ללא נתונים',
 | 
				
			||||||
      titles: ['רשימה 1', 'רשימה 2'], // to be translated
 | 
					      titles: ['רשימה 1', 'רשימה 2'],
 | 
				
			||||||
      filterPlaceholder: 'הקלד', // to be translated
 | 
					      filterPlaceholder: 'הקלד',
 | 
				
			||||||
      noCheckedFormat: 'פריטים {total}', // to be translated
 | 
					      noCheckedFormat: 'פריטים {total}',
 | 
				
			||||||
      hasCheckedFormat: ' אישור {checked}/{total}' // to be translated
 | 
					      hasCheckedFormat: ' אישור {checked}/{total}'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -358,23 +358,11 @@ describe('DatePicker', () => {
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('default value', done => {
 | 
					  it('default value', done => {
 | 
				
			||||||
    const toDateStr = date => {
 | 
					    let defaultValue = '2000-01-01';
 | 
				
			||||||
      let d = new Date(date);
 | 
					    let expectValue = new Date(2000, 0, 1);
 | 
				
			||||||
      return `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    let today = new Date();
 | 
					 | 
				
			||||||
    let nextMonth = new Date(today);
 | 
					 | 
				
			||||||
    nextMonth.setDate(1);
 | 
					 | 
				
			||||||
    if (nextMonth.getMonth() === 12) {
 | 
					 | 
				
			||||||
      nextMonth.setFullYear(today.getFullYear + 1);
 | 
					 | 
				
			||||||
      nextMonth.setMonth(1);
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      nextMonth.setMonth(today.getMonth() + 1);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    let nextMonthStr = toDateStr(nextMonth);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    vm = createVue({
 | 
					    vm = createVue({
 | 
				
			||||||
      template: `<el-date-picker v-model="value" ref="compo" default-value="${nextMonthStr}" />`,
 | 
					      template: `<el-date-picker v-model="value" ref="compo" default-value="${defaultValue}" />`,
 | 
				
			||||||
      data() {
 | 
					      data() {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
          value: ''
 | 
					          value: ''
 | 
				
			||||||
| 
						 | 
					@ -389,10 +377,10 @@ describe('DatePicker', () => {
 | 
				
			||||||
      const $el = vm.$refs.compo.picker.$el;
 | 
					      const $el = vm.$refs.compo.picker.$el;
 | 
				
			||||||
      $el.querySelector('td.current').click();
 | 
					      $el.querySelector('td.current').click();
 | 
				
			||||||
      setTimeout(_ => {
 | 
					      setTimeout(_ => {
 | 
				
			||||||
        expect(vm.value).to.equal(nextMonthStr);
 | 
					        expect(+vm.value).to.equal(+expectValue);
 | 
				
			||||||
      });
 | 
					        done();
 | 
				
			||||||
      done();
 | 
					      }, 10);
 | 
				
			||||||
    });
 | 
					    }, 10);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('keydown', () => {
 | 
					  describe('keydown', () => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue