From 586bde090cac7551afc2d8c74db8c99da4452b6f Mon Sep 17 00:00:00 2001 From: ryatziv Date: Thu, 14 Sep 2017 20:11:07 -0700 Subject: [PATCH 01/10] Autocomplete: emit select of textbox value when no selection is made. (#6428) * when pressing enter without a selection, select the currently entered text and clear selections. * added "select-when-unmatched" flag * restored "???" to "-" --- examples/docs/en-US/input.md | 63 +++++++++++----------- packages/autocomplete/src/autocomplete.vue | 18 ++++++- 2 files changed, 48 insertions(+), 33 deletions(-) diff --git a/examples/docs/en-US/input.md b/examples/docs/en-US/input.md index dd0b0b78b..75ea5dc2e 100644 --- a/examples/docs/en-US/input.md +++ b/examples/docs/en-US/input.md @@ -596,26 +596,26 @@ Search data from server-side. | Attribute | Description | Type | Accepted Values | Default | | ----| ----| ----| ---- | ----- | -|type| Same as the `type` attribute of native input, except that it can be `textarea` | string | — | text | -|value| binding value | string/number| — | — | -|maxlength| maximum Input text length| number| — | — | -|minlength| minimum Input text length| number | — | — | -|placeholder| placeholder of Input| string | — | — | -|disabled | whether Input is disabled | boolean | — | false | -|size | size of Input, works when `type` is not 'textarea' | string | large/small/mini | — | -|icon | icon name | string | — | — | -|rows | number of rows of textarea, only works when `type` is 'textarea' | number | — | 2 | -|autosize | whether textarea has an adaptive height, only works when `type` is 'textarea'. Can accept an object, e.g. { minRows: 2, maxRows: 6 } | boolean/object | — | false | +|type| Same as the `type` attribute of native input, except that it can be `textarea` | string | - | text | +|value| binding value | string/number| - | - | +|maxlength| maximum Input text length| number| - | - | +|minlength| minimum Input text length| number | - | - | +|placeholder| placeholder of Input| string | - | - | +|disabled | whether Input is disabled | boolean | - | false | +|size | size of Input, works when `type` is not 'textarea' | string | large/small/mini | - | +|icon | icon name | string | - | - | +|rows | number of rows of textarea, only works when `type` is 'textarea' | number | - | 2 | +|autosize | whether textarea has an adaptive height, only works when `type` is 'textarea'. Can accept an object, e.g. { minRows: 2, maxRows: 6 } | boolean/object | - | false | |auto-complete | same as `auto-complete` in native input | string | on/off | off | -|name | same as `name` in native input | string | — | — | -| readonly | same as `readonly` in native input | boolean | — | false | -|max | same as `max` in native input | — | — | — | -|min | same as `min` in native input | — | — | — | -|step| same as `step` in native input | — | — | — | -|resize| control the resizability | string | none, both, horizontal, vertical | — | -|autofocus | same as `autofocus` in native input | boolean | — | false | -|form | same as `form` in native input | string | — | — | -| on-icon-click | hook function when clicking on the input icon | function | — | — | +|name | same as `name` in native input | string | - | - | +| readonly | same as `readonly` in native input | boolean | - | false | +|max | same as `max` in native input | - | - | - | +|min | same as `min` in native input | - | - | - | +|step| same as `step` in native input | - | - | - | +|resize| control the resizability | string | none, both, horizontal, vertical | - | +|autofocus | same as `autofocus` in native input | boolean | - | false | +|form | same as `form` in native input | string | - | - | +| on-icon-click | hook function when clicking on the input icon | function | - | - | ### Input Events @@ -630,22 +630,23 @@ Search data from server-side. Attribute | Description | Type | Options | Default |----| ----| ----| ---- | -----| -|placeholder| the placeholder of Autocomplete| string | — | — | -|disabled | whether Autocomplete is disabled | boolean | — | false| -| props | configuration options, see the following table | object | — | — | -|icon | icon name | string | — | — | -|value | binding value | string | — | — | -|custom-item | component name of your customized suggestion list item | string | — | — | -|fetch-suggestions | a method to fetch input suggestions. When suggestions are ready, invoke `callback(data:[])` to return them to Autocomplete | Function(queryString, callback) | — | — | -| popper-class | custom class name for autocomplete's dropdown | string | — | — | -| trigger-on-focus | whether show suggestions when input focus | boolean | — | true | -| on-icon-click | hook function when clicking on the input icon | function | — | — | +|placeholder| the placeholder of Autocomplete| string | - | - | +|disabled | whether Autocomplete is disabled | boolean | - | false| +| props | configuration options, see the following table | object | - | - | +|icon | icon name | string | - | - | +|value | binding value | string | - | - | +|custom-item | component name of your customized suggestion list item | string | - | - | +|fetch-suggestions | a method to fetch input suggestions. When suggestions are ready, invoke `callback(data:[])` to return them to Autocomplete | Function(queryString, callback) | - | - | +| popper-class | custom class name for autocomplete's dropdown | string | - | - | +| trigger-on-focus | whether show suggestions when input focus | boolean | - | true | +| on-icon-click | hook function when clicking on the input icon | function | - | - | +| select-when-unmatched | whether to emit a `select` event on enter when there is no autocomplete match | boolean | - | false | ### props | Attribute | Description | Type | Accepted Values | Default | | --------- | ----------------- | ------ | ------ | ------ | -| label | specify which key of option object is used as the option's label | string | — | value | -| value | specify which key of option object is used as the option's value | string | — | value | +| label | specify which key of option object is used as the option's label | string | - | value | +| value | specify which key of option object is used as the option's value | string | - | value | ### Autocomplete Events diff --git a/packages/autocomplete/src/autocomplete.vue b/packages/autocomplete/src/autocomplete.vue index 1476e7fcc..ed8877431 100644 --- a/packages/autocomplete/src/autocomplete.vue +++ b/packages/autocomplete/src/autocomplete.vue @@ -73,7 +73,11 @@ }, customItem: String, icon: String, - onIconClick: Function + onIconClick: Function, + selectWhenUnmatched: { + type: Boolean, + default: false + } }, data() { return { @@ -137,6 +141,12 @@ if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) { e.preventDefault(); 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) { @@ -144,11 +154,15 @@ this.$emit('select', item); this.$nextTick(_ => { this.suggestions = []; + this.highlightedIndex = -1; }); }, highlight(index) { if (!this.suggestionVisible || this.loading) { return; } - if (index < 0) index = 0; + if (index < 0) { + this.highlightedIndex = -1; + return; + } if (index >= this.suggestions.length) { index = this.suggestions.length - 1; } From 9be1a0ae8a3d6c68d71695ea23f6afbeb0c054a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=A5=95?= Date: Thu, 14 Sep 2017 23:16:45 -0500 Subject: [PATCH 02/10] update doc (#7033) * Tooltip: update zh-CN doc * Tooltip: update en doc * Autocomplete: update docs --- examples/docs/en-US/input.md | 64 +++++++++++++++++----------------- examples/docs/en-US/tooltip.md | 28 ++++++++++++++- examples/docs/zh-CN/input.md | 1 + examples/docs/zh-CN/tooltip.md | 1 + packages/tooltip/src/main.js | 5 +-- 5 files changed, 64 insertions(+), 35 deletions(-) diff --git a/examples/docs/en-US/input.md b/examples/docs/en-US/input.md index 75ea5dc2e..ce152ac18 100644 --- a/examples/docs/en-US/input.md +++ b/examples/docs/en-US/input.md @@ -596,26 +596,26 @@ Search data from server-side. | Attribute | Description | Type | Accepted Values | Default | | ----| ----| ----| ---- | ----- | -|type| Same as the `type` attribute of native input, except that it can be `textarea` | string | - | text | -|value| binding value | string/number| - | - | -|maxlength| maximum Input text length| number| - | - | -|minlength| minimum Input text length| number | - | - | -|placeholder| placeholder of Input| string | - | - | -|disabled | whether Input is disabled | boolean | - | false | -|size | size of Input, works when `type` is not 'textarea' | string | large/small/mini | - | -|icon | icon name | string | - | - | -|rows | number of rows of textarea, only works when `type` is 'textarea' | number | - | 2 | -|autosize | whether textarea has an adaptive height, only works when `type` is 'textarea'. Can accept an object, e.g. { minRows: 2, maxRows: 6 } | boolean/object | - | false | +|type| Same as the `type` attribute of native input, except that it can be `textarea` | string | — | text | +|value| binding value | string/number| — | — | +|maxlength| maximum Input text length| number| — | — | +|minlength| minimum Input text length| number | — | — | +|placeholder| placeholder of Input| string | — | — | +|disabled | whether Input is disabled | boolean | — | false | +|size | size of Input, works when `type` is not 'textarea' | string | large/small/mini | — | +|icon | icon name | string | — | — | +|rows | number of rows of textarea, only works when `type` is 'textarea' | number | — | 2 | +|autosize | whether textarea has an adaptive height, only works when `type` is 'textarea'. Can accept an object, e.g. { minRows: 2, maxRows: 6 } | boolean/object | — | false | |auto-complete | same as `auto-complete` in native input | string | on/off | off | -|name | same as `name` in native input | string | - | - | -| readonly | same as `readonly` in native input | boolean | - | false | -|max | same as `max` in native input | - | - | - | -|min | same as `min` in native input | - | - | - | -|step| same as `step` in native input | - | - | - | -|resize| control the resizability | string | none, both, horizontal, vertical | - | -|autofocus | same as `autofocus` in native input | boolean | - | false | -|form | same as `form` in native input | string | - | - | -| on-icon-click | hook function when clicking on the input icon | function | - | - | +|name | same as `name` in native input | string | — | — | +| readonly | same as `readonly` in native input | boolean | — | false | +|max | same as `max` in native input | — | — | — | +|min | same as `min` in native input | — | — | — | +|step| same as `step` in native input | — | — | — | +|resize| control the resizability | string | none, both, horizontal, vertical | — | +|autofocus | same as `autofocus` in native input | boolean | — | false | +|form | same as `form` in native input | string | — | — | +| on-icon-click | hook function when clicking on the input icon | function | — | — | ### Input Events @@ -630,23 +630,23 @@ Search data from server-side. Attribute | Description | Type | Options | Default |----| ----| ----| ---- | -----| -|placeholder| the placeholder of Autocomplete| string | - | - | -|disabled | whether Autocomplete is disabled | boolean | - | false| -| props | configuration options, see the following table | object | - | - | -|icon | icon name | string | - | - | -|value | binding value | string | - | - | -|custom-item | component name of your customized suggestion list item | string | - | - | -|fetch-suggestions | a method to fetch input suggestions. When suggestions are ready, invoke `callback(data:[])` to return them to Autocomplete | Function(queryString, callback) | - | - | -| popper-class | custom class name for autocomplete's dropdown | string | - | - | -| trigger-on-focus | whether show suggestions when input focus | boolean | - | true | -| on-icon-click | hook function when clicking on the input icon | function | - | - | -| select-when-unmatched | whether to emit a `select` event on enter when there is no autocomplete match | boolean | - | false | +|placeholder| the placeholder of Autocomplete| string | — | — | +|disabled | whether Autocomplete is disabled | boolean | — | false| +| props | configuration options, see the following table | object | — | — | +|icon | icon name | string | — | — | +|value | binding value | string | — | — | +|custom-item | component name of your customized suggestion list item | string | — | — | +|fetch-suggestions | a method to fetch input suggestions. When suggestions are ready, invoke `callback(data:[])` to return them to Autocomplete | Function(queryString, callback) | — | — | +| popper-class | custom class name for autocomplete's dropdown | string | — | — | +| trigger-on-focus | whether show suggestions when input focus | boolean | — | true | +| on-icon-click | hook function when clicking on the input icon | function | — | — | +| select-when-unmatched | whether to emit a `select` event on enter when there is no autocomplete match | boolean | — | false | ### props | Attribute | Description | Type | Accepted Values | Default | | --------- | ----------------- | ------ | ------ | ------ | -| label | specify which key of option object is used as the option's label | string | - | value | -| value | specify which key of option object is used as the option's value | string | - | value | +| label | specify which key of option object is used as the option's label | string | — | value | +| value | specify which key of option object is used as the option's value | string | — | value | ### Autocomplete Events diff --git a/examples/docs/en-US/tooltip.md b/examples/docs/en-US/tooltip.md index d3fed443c..728867f52 100644 --- a/examples/docs/en-US/tooltip.md +++ b/examples/docs/en-US/tooltip.md @@ -15,16 +15,42 @@ width: 110px; } } + .el-tooltip + .el-tooltip { + margin-left: 15px; + } .box { + width: 400px; + + .top { + text-align: center; + } + .left { float: left; width: 110px; } - + .right { float: right; 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; + } } } diff --git a/examples/docs/zh-CN/input.md b/examples/docs/zh-CN/input.md index 42168cc62..29fb40042 100644 --- a/examples/docs/zh-CN/input.md +++ b/examples/docs/zh-CN/input.md @@ -801,6 +801,7 @@ export default { | trigger-on-focus | 是否在输入框 focus 时显示建议列表 | boolean | — | true | | on-icon-click | 点击图标的回调函数 | function | — | — | | icon | 输入框尾部图标 | string | — | — | +| select-when-unmatched | 在输入没有任何匹配建议的情况下,按下回车是否触发 `select` 事件 | boolean | — | false | ### props | 参数 | 说明 | 类型 | 可选值 | 默认值 | diff --git a/examples/docs/zh-CN/tooltip.md b/examples/docs/zh-CN/tooltip.md index 0522516e5..07eb8d03f 100644 --- a/examples/docs/zh-CN/tooltip.md +++ b/examples/docs/zh-CN/tooltip.md @@ -215,3 +215,4 @@ tooltip 内不支持 disabled form 元素,参考[MDN](https://developer.mozill | manual | 手动控制模式,设置为 true 后,mouseenter 和 mouseleave 事件将不会生效 | Boolean | — | false | | popper-class | 为 Tooltip 的 popper 添加类名 | String | — | — | | enterable | 鼠标是否可进入到 tooltip 中 | Boolean | — | true | +| hide-after | Tooltip 出现后自动隐藏延时,单位毫秒,为 0 则不会自动隐藏 | number | — | 0 | diff --git a/packages/tooltip/src/main.js b/packages/tooltip/src/main.js index 3ec0638fe..2a9fe2c90 100644 --- a/packages/tooltip/src/main.js +++ b/packages/tooltip/src/main.js @@ -88,16 +88,17 @@ export default { if (!this.$slots.default || !this.$slots.default.length) return 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 on = vnode.data.on = vnode.data.on || {}; 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.mouseleave = this.addEventHandle(on.mouseleave, () => { this.setExpectedState(false); this.debounceClose(); }); nativeOn.mouseenter = this.addEventHandle(nativeOn.mouseenter, () => { this.setExpectedState(true); this.handleShowPopper(); }); nativeOn.mouseleave = this.addEventHandle(nativeOn.mouseleave, () => { this.setExpectedState(false); this.debounceClose(); }); - data.staticClass = this.concatClass(data.staticClass, 'el-tooltip'); return vnode; }, From 6e3f46a500b6b3d19eacc8f7c27620494d10b6ad Mon Sep 17 00:00:00 2001 From: thegatheringstorm Date: Fri, 15 Sep 2017 16:04:43 +0800 Subject: [PATCH 03/10] Upload: convert map to forEach --- packages/upload/src/ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/upload/src/ajax.js b/packages/upload/src/ajax.js index de05bdb7c..0d62e0855 100644 --- a/packages/upload/src/ajax.js +++ b/packages/upload/src/ajax.js @@ -48,7 +48,7 @@ export default function upload(option) { const formData = new FormData(); if (option.data) { - Object.keys(option.data).map(key => { + Object.keys(option.data).forEach(key => { formData.append(key, option.data[key]); }); } From 4d2fac6f60034b20c6fed1638b1471f43774d47c Mon Sep 17 00:00:00 2001 From: thegatheringstorm Date: Sat, 16 Sep 2017 20:08:34 +0800 Subject: [PATCH 04/10] Upload: convert var to const and let --- packages/upload/src/index.vue | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/upload/src/index.vue b/packages/upload/src/index.vue index 58b37b23a..a0baaa571 100644 --- a/packages/upload/src/index.vue +++ b/packages/upload/src/index.vue @@ -139,13 +139,13 @@ export default { this.onChange(file, this.uploadFiles); }, handleProgress(ev, rawFile) { - var file = this.getFile(rawFile); + const file = this.getFile(rawFile); this.onProgress(ev, file, this.uploadFiles); file.status = 'uploading'; file.percentage = ev.percent || 0; }, handleSuccess(res, rawFile) { - var file = this.getFile(rawFile); + const file = this.getFile(rawFile); if (file) { file.status = 'success'; @@ -156,8 +156,8 @@ export default { } }, handleError(err, rawFile) { - var file = this.getFile(rawFile); - var fileList = this.uploadFiles; + const file = this.getFile(rawFile); + const fileList = this.uploadFiles; file.status = 'fail'; @@ -171,13 +171,13 @@ export default { file = this.getFile(raw); } this.abort(file); - var fileList = this.uploadFiles; + let fileList = this.uploadFiles; fileList.splice(fileList.indexOf(file), 1); this.onRemove(file, fileList); }, getFile(rawFile) { - var fileList = this.uploadFiles; - var target; + let fileList = this.uploadFiles; + let target; fileList.every(item => { target = rawFile.uid === item.uid ? item : null; return !target; @@ -209,7 +209,7 @@ export default { }, render(h) { - var uploadList; + let uploadList; if (this.showFileList) { uploadList = ( @@ -223,7 +223,7 @@ export default { ); } - var uploadData = { + const uploadData = { props: { type: this.type, drag: this.drag, From 678cf1103f520ffbd900691db9046d4570b8c0bd Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Sun, 17 Sep 2017 09:59:34 +0800 Subject: [PATCH 05/10] Table: fix single filter active state --- packages/table/src/filter-panel.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/table/src/filter-panel.vue b/packages/table/src/filter-panel.vue index 50c2f141e..af26cd785 100644 --- a/packages/table/src/filter-panel.vue +++ b/packages/table/src/filter-panel.vue @@ -19,7 +19,7 @@
  • {{ t('el.table.clearFilter') }}
  • Date: Sun, 17 Sep 2017 20:47:27 +0800 Subject: [PATCH 06/10] update i18n doc --- examples/docs/en-US/i18n.md | 1 + examples/docs/zh-CN/i18n.md | 1 + src/locale/lang/he.js | 8 ++++---- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/docs/en-US/i18n.md b/examples/docs/en-US/i18n.md index 7c61b87fe..a59044db0 100644 --- a/examples/docs/en-US/i18n.md +++ b/examples/docs/en-US/i18n.md @@ -206,6 +206,7 @@ Currently Element ships with the following languages:
  • Estonian (ee)
  • Slovenian (sl)
  • Arabic (ar)
  • +
  • Hebrew (he)
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. diff --git a/examples/docs/zh-CN/i18n.md b/examples/docs/zh-CN/i18n.md index 3d27379aa..27945dfe4 100644 --- a/examples/docs/zh-CN/i18n.md +++ b/examples/docs/zh-CN/i18n.md @@ -218,6 +218,7 @@ ElementLocale.i18n((key, value) => i18n.t(key, value))
  • 爱沙尼亚语(ee)
  • 斯洛文尼亚语(sl)
  • 阿拉伯语(ar)
  • +
  • 希伯来语(he)
  • 如果你需要使用其他的语言,欢迎贡献 PR:只需在 [这里](https://github.com/ElemeFE/element/tree/master/src/locale/lang) 添加一个语言配置文件即可。 diff --git a/src/locale/lang/he.js b/src/locale/lang/he.js index c0d39364c..1ca78514d 100644 --- a/src/locale/lang/he.js +++ b/src/locale/lang/he.js @@ -95,10 +95,10 @@ export default { transfer: { noMatch: 'אין נתונים מתאימים', noData: 'ללא נתונים', - titles: ['רשימה 1', 'רשימה 2'], // to be translated - filterPlaceholder: 'הקלד', // to be translated - noCheckedFormat: 'פריטים {total}', // to be translated - hasCheckedFormat: ' אישור {checked}/{total}' // to be translated + titles: ['רשימה 1', 'רשימה 2'], + filterPlaceholder: 'הקלד', + noCheckedFormat: 'פריטים {total}', + hasCheckedFormat: ' אישור {checked}/{total}' } } }; From d35ae010425b3e42eff147fef23b30874ba907ff Mon Sep 17 00:00:00 2001 From: "wacky6.AriesMBP" <416707889@qq.com> Date: Mon, 18 Sep 2017 02:12:21 +1000 Subject: [PATCH 07/10] DatePicker: support default-value for date-range --- packages/date-picker/src/panel/date-range.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/date-picker/src/panel/date-range.vue b/packages/date-picker/src/panel/date-range.vue index c417a33f6..a3753847e 100644 --- a/packages/date-picker/src/panel/date-range.vue +++ b/packages/date-picker/src/panel/date-range.vue @@ -153,6 +153,14 @@ import DateTable from '../basic/date-table'; 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 { mixins: [Locale], @@ -221,7 +229,7 @@ popperClass: '', minPickerWidth: 0, maxPickerWidth: 0, - date: new Date(), + date: this.$options.defaultValue ? calcDefaultValue(this.$options.defaultValue) : new Date(), minDate: '', maxDate: '', rangeState: { @@ -297,6 +305,7 @@ handleClear() { this.minDate = null; this.maxDate = null; + this.date = this.$options.defaultValue ? calcDefaultValue(this.$options.defaultValue) : new Date(); this.handleConfirm(false); }, From 848346c95461e746bfecdb0b6b7bb4054fe9d0e5 Mon Sep 17 00:00:00 2001 From: "wacky6.AriesMBP" <416707889@qq.com> Date: Mon, 18 Sep 2017 04:17:21 +1000 Subject: [PATCH 08/10] test: fix broken date-picker default-value test --- test/unit/specs/date-picker.spec.js | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/test/unit/specs/date-picker.spec.js b/test/unit/specs/date-picker.spec.js index 2c163e20c..3ce757930 100644 --- a/test/unit/specs/date-picker.spec.js +++ b/test/unit/specs/date-picker.spec.js @@ -319,23 +319,11 @@ describe('DatePicker', () => { }); it('default value', done => { - const toDateStr = date => { - let d = new Date(date); - 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); + let defaultValue = '2000-01-01'; + let expectValue = new Date(2000, 0, 1); vm = createVue({ - template: ``, + template: ``, data() { return { value: '' @@ -350,10 +338,10 @@ describe('DatePicker', () => { const $el = vm.$refs.compo.picker.$el; $el.querySelector('td.current').click(); setTimeout(_ => { - expect(vm.value).to.equal(nextMonthStr); - }); - done(); - }); + expect(+vm.value).to.equal(+expectValue); + done(); + }, 10); + }, 10); }); describe('keydown', () => { From 9f9629d2bb5041affe16f11ff13bed96b14b1717 Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Mon, 18 Sep 2017 12:37:32 +0800 Subject: [PATCH 09/10] Upload: fix handleRemove param error --- packages/upload/src/upload.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/upload/src/upload.vue b/packages/upload/src/upload.vue index 4caa6c7b2..6e3598ed9 100644 --- a/packages/upload/src/upload.vue +++ b/packages/upload/src/upload.vue @@ -90,12 +90,12 @@ export default { this.post(rawFile); } }, () => { - this.onRemove(rawFile, true); + this.onRemove(null, rawFile); }); } else if (before !== false) { this.post(rawFile); } else { - this.onRemove(rawFile, true); + this.onRemove(null, rawFile); } }, abort(file) { From dba797416e2afeb143d22ce1118f37731da4b9f9 Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Wed, 20 Sep 2017 11:47:15 +0800 Subject: [PATCH 10/10] DatePicker: fix disabled dates for the west hemisphere --- packages/date-picker/src/basic/month-table.vue | 2 +- packages/date-picker/src/basic/year-table.vue | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/date-picker/src/basic/month-table.vue b/packages/date-picker/src/basic/month-table.vue index d16a560fe..238cb99c6 100644 --- a/packages/date-picker/src/basic/month-table.vue +++ b/packages/date-picker/src/basic/month-table.vue @@ -67,7 +67,7 @@ var year = this.date.getFullYear(); var date = new Date(0); date.setFullYear(year); - date.setMonth(month); + date.setMonth(month, 1); date.setHours(0); var nextMonth = new Date(date); nextMonth.setMonth(month + 1); diff --git a/packages/date-picker/src/basic/year-table.vue b/packages/date-picker/src/basic/year-table.vue index 8bc2e8cba..95de39df7 100644 --- a/packages/date-picker/src/basic/year-table.vue +++ b/packages/date-picker/src/basic/year-table.vue @@ -63,9 +63,7 @@ getCellStyle(year) { const style = {}; - var date = new Date(0); - date.setFullYear(year); - date.setHours(0); + var date = new Date(year, 0, 1, 0); var nextYear = new Date(date); nextYear.setFullYear(year + 1);