From 6893848eb062636d5f834806375bcdbec78b09c5 Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Thu, 17 Oct 2019 18:49:33 +0800 Subject: [PATCH 01/13] style: format password --- components/input/Password.jsx | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/components/input/Password.jsx b/components/input/Password.jsx index 256c78081..1eceddbab 100644 --- a/components/input/Password.jsx +++ b/components/input/Password.jsx @@ -13,6 +13,7 @@ const ActionMap = { export default { name: 'AInputPassword', + mixins: [BaseMixin], model: { prop: 'value', event: 'change.value', @@ -29,7 +30,6 @@ export default { visible: false, }; }, - mixins: [BaseMixin], methods: { onChange() { this.setState({ @@ -58,7 +58,14 @@ export default { }, }, render() { - const { prefixCls, inputPrefixCls, size, suffix, visibilityToggle, ...restProps } = getOptionProps(this); + const { + prefixCls, + inputPrefixCls, + size, + suffix, + visibilityToggle, + ...restProps + } = getOptionProps(this); const suffixIcon = visibilityToggle && this.getIcon(); const inputClassName = classNames(prefixCls, { [`${prefixCls}-${size}`]: !!size, @@ -78,14 +85,8 @@ export default { type: this.visible ? 'text' : 'password', }, class: inputClassName, - on: { - ...this.$listeners, - }, + on: this.$listeners, }; - return ( - - ); + return ; }, }; From c4f668b40218cc2ae4f6db19d59f644a150a5e38 Mon Sep 17 00:00:00 2001 From: zkwolf Date: Thu, 17 Oct 2019 03:52:10 -0700 Subject: [PATCH 02/13] fix: input clear style (#1297) --- components/input/Input.jsx | 4 ++-- components/input/__tests__/index.test.js | 8 ++++++++ components/input/style/index.less | 23 +++++++++++++++++++++++ components/input/style/mixin.less | 2 ++ 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/components/input/Input.jsx b/components/input/Input.jsx index aa7ed1c70..cfa91549d 100644 --- a/components/input/Input.jsx +++ b/components/input/Input.jsx @@ -121,9 +121,9 @@ export default { }, renderClearIcon(prefixCls) { - const { allowClear } = this.$props; + const { allowClear, disabled } = this.$props; const { stateValue } = this; - if (!allowClear || stateValue === undefined || stateValue === null || stateValue === '') { + if (!allowClear || disabled || stateValue === undefined || stateValue === null || stateValue === '') { return null; } return ( diff --git a/components/input/__tests__/index.test.js b/components/input/__tests__/index.test.js index 00837b58a..72d511079 100644 --- a/components/input/__tests__/index.test.js +++ b/components/input/__tests__/index.test.js @@ -19,6 +19,14 @@ describe('Input', () => { const wrapper = mount(Input); wrapper.vm.select(); }); + + it('should not support allowClear when it is disabled', () => { + const wrapper = mount(Input, { + propsData: { allowClear: true, defaultValue: '111', disabled: true }, + sync: false, + }); + expect(wrapper.findAll('.ant-input-clear-icon').length).toBe(0); + }); }); focusTest(TextArea); diff --git a/components/input/style/index.less b/components/input/style/index.less index 390a7e39f..53fd3f0e9 100644 --- a/components/input/style/index.less +++ b/components/input/style/index.less @@ -39,4 +39,27 @@ } } +// fix style #1296, remove annotation when upgrade ant-design version > 3.21.3 +.@{ant-prefix}-input-clear-icon { + color: @disabled-color; + font-size: @font-size-sm; + // https://github.com/ant-design/ant-design/pull/18151 + // https://codesandbox.io/s/wizardly-sun-u10br + vertical-align: 0; + cursor: pointer; + transition: color 0.3s; + + &:hover { + color: @text-color-secondary; + } + + &:active { + color: @text-color; + } + + + i { + margin-left: 6px; + } +} + @import './search-input'; diff --git a/components/input/style/mixin.less b/components/input/style/mixin.less index b7d1aba8f..08c6f99bb 100644 --- a/components/input/style/mixin.less +++ b/components/input/style/mixin.less @@ -363,6 +363,8 @@ position: absolute; top: 50%; z-index: 2; + display: flex; + align-items: center; color: @input-color; line-height: 0; transform: translateY(-50%); From 723b6c6cf64122655cf68bce88bd3ca7a7cdf94b Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Thu, 17 Oct 2019 19:26:58 +0800 Subject: [PATCH 03/13] feat: input add focus when click clear button --- components/input/Input.jsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/input/Input.jsx b/components/input/Input.jsx index cfa91549d..b0315a64a 100644 --- a/components/input/Input.jsx +++ b/components/input/Input.jsx @@ -114,6 +114,9 @@ export default { handleReset(e) { this.setValue('', e); + this.$nextTick(() => { + this.focus(); + }); }, handleChange(e) { @@ -123,7 +126,13 @@ export default { renderClearIcon(prefixCls) { const { allowClear, disabled } = this.$props; const { stateValue } = this; - if (!allowClear || disabled || stateValue === undefined || stateValue === null || stateValue === '') { + if ( + !allowClear || + disabled || + stateValue === undefined || + stateValue === null || + stateValue === '' + ) { return null; } return ( From 5e4df25ee1f6718afdea768691d8bb1be556e33d Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Thu, 17 Oct 2019 19:27:21 +0800 Subject: [PATCH 04/13] test: update table test --- components/table/__tests__/Table.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/table/__tests__/Table.test.js b/components/table/__tests__/Table.test.js index 99de5bf29..4de621de8 100644 --- a/components/table/__tests__/Table.test.js +++ b/components/table/__tests__/Table.test.js @@ -97,7 +97,7 @@ describe('Table', () => { }); }); - it('align column should not override cell style', () => { + it('align column should not override cell style', done => { const columns = [ { title: 'Name', dataIndex: 'name', key: 'name' }, { From 5a94354e7371b3783115bc86c3d2c3ffaa86f69a Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Thu, 17 Oct 2019 19:27:45 +0800 Subject: [PATCH 05/13] bump 1.4.1 --- CHANGELOG.en-US.md | 11 +++++++++++ CHANGELOG.zh-CN.md | 11 +++++++++++ package.json | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index fba7cc99f..9e04255f7 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -10,6 +10,17 @@ --- +## 1.4.1 + +`2019-10-17` + +- 🐞 fix `Input.Password` cannot use `v-model` [#1306](https://github.com/vueComponent/ant-design-vue/issues/1306) +- 🌟 Optimize the clear button of `Input` to display the logic. [#1296](https://github.com/vueComponent/ant-design-vue/issues/1296) +- 🌟 After click clear button, `Input` becomes the `focus` state. +- 🐞 fix progress strokeWidth not work [#1301](https://github.com/vueComponent/ant-design-vue/issues/1301) +- 🐞 Fix Radio.Group triggers multiple change callback issues [#1280](https://github.com/vueComponent/ant-design-vue/issues/1280) +- 🐞 Fix Form initialValue error [#1291](https://github.com/vueComponent/ant-design-vue/issues/1291) + ## 1.4.0 `2019-10-14` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 9bf6f8711..95b6c4a06 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -10,6 +10,17 @@ --- +## 1.4.1 + +`2019-10-17` + +- 🐞 修复 `Input.Password` 无法使用 `v-model` 的问题 [#1306](https://github.com/vueComponent/ant-design-vue/issues/1306) +- 🌟 优化 `Input` 的清除按钮显示逻辑 [#1296](https://github.com/vueComponent/ant-design-vue/issues/1296) +- 🌟 点击清除按钮后 `Input` 变为 `focus` 状态 +- 🐞 修复 `Progress` 的 `strokeWidth` 属性失效问题 [#1301](https://github.com/vueComponent/ant-design-vue/issues/1301) +- 🐞 修复 Radio.Group 触发多次 change 回调问题 [#1280](https://github.com/vueComponent/ant-design-vue/issues/1280) +- 🐞 修复 Form initialValue 报错问题 [#1291](https://github.com/vueComponent/ant-design-vue/issues/1291) + ## 1.4.0 `2019-10-14` diff --git a/package.json b/package.json index f767ad861..2988b5dff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ant-design-vue", - "version": "1.4.0", + "version": "1.4.1", "title": "Ant Design Vue", "description": "An enterprise-class UI design language and Vue-based implementation", "keywords": [ From a0c887479a233f0539529c1cee73b2a6d0b5557f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A8=80=E8=82=86?= <18x@loacg.com> Date: Fri, 18 Oct 2019 10:21:04 +0800 Subject: [PATCH 06/13] fix: pretter Line progress style (#1310) (#1311) --- components/progress/style/index.less | 1 + 1 file changed, 1 insertion(+) diff --git a/components/progress/style/index.less b/components/progress/style/index.less index c5b09b6bf..1a5c5364f 100644 --- a/components/progress/style/index.less +++ b/components/progress/style/index.less @@ -36,6 +36,7 @@ vertical-align: middle; background-color: @progress-remaining-color; border-radius: 100px; + overflow: hidden; } &-circle-trail { From b5cd32aa1a4b8f236f5806f8cbb710cfb90fa852 Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Fri, 18 Oct 2019 13:05:35 +0800 Subject: [PATCH 07/13] fix: Radio.Group triggers multiple change callback issues #1280 --- components/radio/Group.jsx | 12 ++++++++---- components/radio/__tests__/group.test.js | 21 +++++++-------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/components/radio/Group.jsx b/components/radio/Group.jsx index 2309351f1..db13ce7f1 100644 --- a/components/radio/Group.jsx +++ b/components/radio/Group.jsx @@ -30,6 +30,7 @@ export default { }, data() { const { value, defaultValue } = this; + this.updatingValue = false; return { stateValue: value === undefined ? defaultValue : value, }; @@ -61,6 +62,7 @@ export default { }, watch: { value(val) { + this.updatingValue = false; this.stateValue = val; }, }, @@ -72,11 +74,13 @@ export default { this.stateValue = value; } // nextTick for https://github.com/vueComponent/ant-design-vue/issues/1280 + if (!this.updatingValue && value !== lastValue) { + this.updatingValue = true; + this.$emit('input', value); + this.$emit('change', ev); + } this.$nextTick(() => { - if (value !== lastValue) { - this.$emit('input', value); - this.$emit('change', ev); - } + this.updatingValue = false; }); }, }, diff --git a/components/radio/__tests__/group.test.js b/components/radio/__tests__/group.test.js index f892cf74c..2e6926412 100644 --- a/components/radio/__tests__/group.test.js +++ b/components/radio/__tests__/group.test.js @@ -80,8 +80,6 @@ describe('Radio', () => { wrapper.vm.$refs.radioGroup.stateValue = 'B'; // wrapper.setData({ value: 'B' }) radios.at(0).trigger('change'); - }); - await asyncExpect(() => { expect(onChange.mock.calls.length).toBe(1); }); await asyncExpect(() => { @@ -91,8 +89,6 @@ describe('Radio', () => { // controlled component wrapper.setProps({ value: 'A' }); radios.at(1).trigger('change'); - }); - await asyncExpect(() => { expect(onChange.mock.calls.length).toBe(2); }); await asyncExpect(() => { @@ -135,9 +131,7 @@ describe('Radio', () => { wrapper.vm.$refs.radioGroup.stateValue = 'B'; radios.at(0).trigger('change'); expect(onChange.mock.calls.length).toBe(1); - await asyncExpect(() => { - expect(onChangeRadioGroup.mock.calls.length).toBe(1); - }); + expect(onChangeRadioGroup.mock.calls.length).toBe(1); // controlled component wrapper.setProps({ value: 'A' }); @@ -159,13 +153,12 @@ describe('Radio', () => { // uncontrolled component wrapper.vm.$refs.radioGroup.stateValue = 'B'; radios.at(0).trigger('change'); - await asyncExpect(() => { - expect(onChange.mock.calls.length).toBe(1); - }); - // controlled component - wrapper.setProps({ value: 'A' }); - radios.at(1).trigger('change'); - await asyncExpect(() => { + expect(onChange.mock.calls.length).toBe(1); + + asyncExpect(() => { + // controlled component + wrapper.setProps({ value: 'A' }); + radios.at(1).trigger('change'); expect(onChange.mock.calls.length).toBe(2); }); }); From 8be7ec96a20a187ae7dc089ba1aac97430fa430c Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Mon, 21 Oct 2019 17:36:06 +0800 Subject: [PATCH 08/13] fix: pagination keyup enter not work #1316 --- components/vc-pagination/Options.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/vc-pagination/Options.jsx b/components/vc-pagination/Options.jsx index d8e31559a..13b791403 100644 --- a/components/vc-pagination/Options.jsx +++ b/components/vc-pagination/Options.jsx @@ -49,10 +49,11 @@ export default { return; } if (e.keyCode === KEYCODE.ENTER || e.type === 'click') { + // https://github.com/vueComponent/ant-design-vue/issues/1316 + this.quickGo(this.getValidValue()); this.setState({ goInputText: '', }); - this.quickGo(this.getValidValue()); } }, }, From a9622bd21aa1ef6aa795a8c599c2eb5c1f6bfa88 Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Mon, 21 Oct 2019 19:03:22 +0800 Subject: [PATCH 09/13] bump 1.4.2 --- CHANGELOG.en-US.md | 7 +++++++ CHANGELOG.zh-CN.md | 7 +++++++ package.json | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 9e04255f7..5cdd5d9fb 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -10,6 +10,13 @@ --- +## 1.4.2 + +`2019-10-21` + +- 🐞 Fix `Radio.Group` triggers multiple change callback issues [#1280](https://github.com/vueComponent/ant-design-vue/issues/1280) +- 🐞 Fix `Pagination` keyup enter not work [#1316](https://github.com/vueComponent/ant-design-vue/issues/1316) + ## 1.4.1 `2019-10-17` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 95b6c4a06..607a3477f 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -10,6 +10,13 @@ --- +## 1.4.2 + +`2019-10-21` + +- 🐞 修复 Radio.Group 触发多次 change 回调问题 [#1280](https://github.com/vueComponent/ant-design-vue/issues/1280) +- 🐞 修复 Pagination 输入框跳转无效问题 [#1316](https://github.com/vueComponent/ant-design-vue/issues/1316) + ## 1.4.1 `2019-10-17` diff --git a/package.json b/package.json index 2988b5dff..e14b27cb8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ant-design-vue", - "version": "1.4.1", + "version": "1.4.2", "title": "Ant Design Vue", "description": "An enterprise-class UI design language and Vue-based implementation", "keywords": [ From 5d3353be6b33fc20dc281f541210af1d24074e0c Mon Sep 17 00:00:00 2001 From: zkwolf Date: Mon, 21 Oct 2019 19:57:20 -0700 Subject: [PATCH 10/13] fix: input style bug (#1322) --- .../__tests__/__snapshots__/demo.test.js.snap | 6 +- .../__tests__/__snapshots__/demo.test.js.snap | 28 +-- .../__snapshots__/index.test.js.snap | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 80 ++++---- components/input/Input.jsx | 10 +- .../__snapshots__/Search.test.js.snap | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 28 ++- .../__snapshots__/index.test.js.snap | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 4 +- .../__snapshots__/index.test.js.snap | 176 +++++++++--------- .../__tests__/__snapshots__/demo.test.js.snap | 12 +- .../__snapshots__/search.test.js.snap | 4 +- 13 files changed, 176 insertions(+), 182 deletions(-) diff --git a/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap b/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap index 53563350a..50b67335f 100644 --- a/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap +++ b/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap @@ -7,7 +7,7 @@ exports[`renders ./components/auto-complete/demo/basic.md correctly 1`] = `
input here
@@ -53,7 +53,7 @@ exports[`renders ./components/auto-complete/demo/non-case-sensitive.md correctly
input here
@@ -68,7 +68,7 @@ exports[`renders ./components/auto-complete/demo/options.md correctly 1`] = `
input here
diff --git a/components/cascader/__tests__/__snapshots__/demo.test.js.snap b/components/cascader/__tests__/__snapshots__/demo.test.js.snap index 80c627a3e..13ed938e0 100644 --- a/components/cascader/__tests__/__snapshots__/demo.test.js.snap +++ b/components/cascader/__tests__/__snapshots__/demo.test.js.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders ./components/cascader/demo/basic.md correctly 1`] = ` - `; exports[`renders ./components/cascader/demo/change-on-select.md correctly 1`] = ` - `; exports[`renders ./components/cascader/demo/custom-render.md correctly 1`] = ` - + Zhejiang / Hangzhou / @@ -33,7 +33,7 @@ exports[`renders ./components/cascader/demo/custom-trigger.md correctly 1`] = ` `; exports[`renders ./components/cascader/demo/default-value.md correctly 1`] = ` -Zhejiang / Hangzhou / West LakeZhejiang / Hangzhou / West Lake `; exports[`renders ./components/cascader/demo/fields-name.md correctly 1`] = ` - `; exports[`renders ./components/cascader/demo/hover.md correctly 1`] = ` - `; exports[`renders ./components/cascader/demo/lazy.md correctly 1`] = ` - `; exports[`renders ./components/cascader/demo/search.md correctly 1`] = ` - `; exports[`renders ./components/cascader/demo/size.md correctly 1`] = ` -










`; exports[`renders ./components/cascader/demo/suffix.md correctly 1`] = ` -
ab
+
ab
`; diff --git a/components/cascader/__tests__/__snapshots__/index.test.js.snap b/components/cascader/__tests__/__snapshots__/index.test.js.snap index d54dbb0b1..5492adff5 100644 --- a/components/cascader/__tests__/__snapshots__/index.test.js.snap +++ b/components/cascader/__tests__/__snapshots__/index.test.js.snap @@ -95,7 +95,7 @@ exports[`Cascader popup correctly with defaultValue 1`] = ` `; exports[`Cascader support controlled mode 1`] = ` -Zhejiang / Hangzhou / West LakeZhejiang / Hangzhou / West Lake

TreeSelect

-

Cascader

Cascader

Transfer

diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap index d97a6a83c..e84921efa 100644 --- a/components/form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form/__tests__/__snapshots__/demo.test.js.snap @@ -8,7 +8,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
+
@@ -18,7 +18,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
+
@@ -28,7 +28,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
+
@@ -38,7 +38,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
+
@@ -48,7 +48,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
+
@@ -58,7 +58,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
+
@@ -68,7 +68,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
+
@@ -78,7 +78,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
+
@@ -88,7 +88,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
+
@@ -98,7 +98,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
-
+
@@ -123,7 +123,7 @@ exports[`renders ./components/form/demo/coordinated.vue correctly 1`] = `
-
+
@@ -152,18 +152,11 @@ exports[`renders ./components/form/demo/customized-form-controls.vue correctly 1
-
-
-
-
-
RMB
-
-
-
-
- -
-
+
RMB
+
+ +
+
@@ -199,7 +192,7 @@ exports[`renders ./components/form/demo/dynamic-rule.vue correctly 1`] = `
-
+
@@ -207,7 +200,7 @@ exports[`renders ./components/form/demo/dynamic-rule.vue correctly 1`] = `
-
+
@@ -243,7 +236,7 @@ exports[`renders ./components/form/demo/global-state.vue correctly 1`] = `
-
+
@@ -303,7 +296,7 @@ exports[`renders ./components/form/demo/layout.vue correctly 1`] = `
-
+
@@ -311,7 +304,7 @@ exports[`renders ./components/form/demo/layout.vue correctly 1`] = `
-
+
@@ -366,7 +359,7 @@ exports[`renders ./components/form/demo/register.vue correctly 1`] = `
-
+
@@ -374,7 +367,7 @@ exports[`renders ./components/form/demo/register.vue correctly 1`] = `
-
+
@@ -382,7 +375,7 @@ exports[`renders ./components/form/demo/register.vue correctly 1`] = `
-
+
@@ -392,7 +385,7 @@ exports[`renders ./components/form/demo/register.vue correctly 1`] = ` Nickname 
-
+
@@ -400,7 +393,7 @@ exports[`renders ./components/form/demo/register.vue correctly 1`] = `
-
Zhejiang / Hangzhou / West Lake
Zhejiang / Hangzhou / West Lake
+86
-
+
@@ -423,7 +416,7 @@ exports[`renders ./components/form/demo/register.vue correctly 1`] = `
-