From 0efb4a58d727c208a0424ce980be8faeff79e51c Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Sat, 30 Sep 2017 15:11:27 +0800 Subject: [PATCH 1/8] add 2.0 alpha notification --- examples/app.vue | 180 ++++++++--------------------------------------- 1 file changed, 29 insertions(+), 151 deletions(-) diff --git a/examples/app.vue b/examples/app.vue index c34ddfdff..065c61878 100644 --- a/examples/app.vue +++ b/examples/app.vue @@ -119,117 +119,6 @@ margin: 20px 0; } - .carbon-teaser { - border-radius: 0; - overflow: hidden; - - .el-dialog__header { - display: none; - } - - .el-dialog__body { - padding: 0; - display: flex; - justify-content: center; - position: relative; - background: #000; - } - - .carbon-teaser__main { - height: 100vh; - min-height: 600px; - } - - .carbon-teaser__close { - position: absolute; - width: 40px; - height: 40px; - top: 25px; - right: 45px; - text-align: center; - cursor: pointer; - opacity: .8; - transition: .2s ease-out; - - &::after, - &::before { - position: absolute; - content: ''; - display: inline-block; - width: 4px; - border-radius: 1px; - height: 40px; - background: #ff3737; - box-shadow: 1px 0 1px 0 rgba(255, 255, 255, .3) inset, -2px 0 1px 0 rgba(0, 0, 0, .1) inset; - transition: .2s ease-out; - } - - &::after { - transform: rotate(45deg); - } - - &::before { - transform: rotate(-45deg); - } - - &:hover { - opacity: 1; - - &::after, - &::before { - box-shadow: 2px 0 1px 0 rgba(255, 255, 255, .4) inset, -2px 0 1px 0 rgba(0, 0, 0, .1) inset, 0 0 10px 3px #ff1616; - } - } - - } - - .carbon-teaser__button { - position: absolute; - bottom: 12%; - display: block; - width: 400px; - height: 19.11%; - - [class*=carbon-teaser__more] { - position: absolute; - top: 0; - display: block; - width: 100%; - height: 100%; - cursor: pointer; - background-repeat: no-repeat; - background-position: center; - background-size: auto 80%; - transition: .2s ease-in; - } - - [class*=dark] { - background-image: url(~examples/assets/images/button-d-cn.png); - &.is-en { - background-image: url(~examples/assets/images/button-d-en.png); - } - } - - [class*=light] { - opacity: 0; - background-image: url(~examples/assets/images/button-l-cn.png); - &.is-en { - background-image: url(~examples/assets/images/button-l-en.png); - } - } - - &:hover { - [class*=light] { - opacity: 1; - } - - [class*=dark] { - opacity: 0; - } - } - } - } - @media (max-width: 1140px) { .container, .page-container { @@ -252,23 +141,6 @@ - - - - - - - -
-
@@ -281,19 +153,9 @@ export default { name: 'app', - data() { - return { - dialogVisible: false - }; - }, - computed: { lang() { return this.$route.path.split('/')[1] || 'zh-CN'; - }, - - hrefOfCarbonLearnMore() { - return this.lang === 'zh-CN' ? 'https://github.com/ElemeFE/element/issues/7236' : 'https://github.com/ElemeFE/element/issues/7237'; } }, @@ -330,10 +192,6 @@ document.documentElement.scrollTop = document.body.scrollTop = elm.offsetTop + 120; }, 50); } - }, - - handleDialogClose() { - localStorage.setItem('CARBON_TEASER_V2', 1); } }, @@ -341,15 +199,35 @@ this.localize(); this.renderAnchorHref(); this.goAnchor(); - - const intrigued = localStorage.getItem('CARBON_TEASER_V2'); - if (!intrigued) { - const img = new Image(); - img.onload = () => { - this.dialogVisible = true; - }; - img.src = 'https://i.loli.net/2017/09/27/59cb11edaa26d.jpg'; - } + setTimeout(() => { + const notified = localStorage.getItem('ALPHA_NOTIFIED'); + if (!notified) { + const h = this.$createElement; + const title = this.lang === 'zh-CN' + ? '2.0.0-alpha.1 发布' + : '2.0.0-alpha.1 released'; + const messages = this.lang === 'zh-CN' + ? ['点击', '这里', '查看详情'] + : ['Click ', 'here', ' to learn more']; + this.$notify.success({ + title, + duration: 0, + message: h('span', [ + messages[0], + h('a', { + attrs: { + target: '_blank', + href: `https://github.com/ElemeFE/element/issues/${ this.lang === 'zh-CN' ? '7304' : '7305' }` + } + }, messages[1]), + messages[2] + ]), + onClose() { + localStorage.setItem('ALPHA_NOTIFIED', 1); + } + }); + } + }, 3500); }, created() { From 2cf9c4e7a736c229cbfe4b7592459c0fa80ca3cc Mon Sep 17 00:00:00 2001 From: Hoxton Lau Date: Thu, 28 Sep 2017 17:52:38 +0800 Subject: [PATCH 2/8] Form-item: fix "required" attribute is not effective for validation --- packages/form/src/form-item.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/form/src/form-item.vue b/packages/form/src/form-item.vue index 628e8c489..438086aba 100644 --- a/packages/form/src/form-item.vue +++ b/packages/form/src/form-item.vue @@ -148,7 +148,7 @@ methods: { validate(trigger, callback = noop) { var rules = this.getFilteredRule(trigger); - if (!rules || rules.length === 0) { + if ((!rules || rules.length === 0) && !this._props.hasOwnProperty('required')) { callback(); return true; } @@ -194,10 +194,11 @@ getRules() { var formRules = this.form.rules; var selfRules = this.rules; + var requiredRule = this._props.hasOwnProperty('required') ? { required: !!this.required } : []; formRules = formRules ? formRules[this.prop] : []; - return [].concat(selfRules || formRules || []); + return [].concat(selfRules || formRules || []).concat(requiredRule); }, getFilteredRule(trigger) { var rules = this.getRules(); @@ -232,7 +233,7 @@ let rules = this.getRules(); - if (rules.length) { + if (rules.length || this._props.hasOwnProperty('required')) { this.$on('el.form.blur', this.onFieldBlur); this.$on('el.form.change', this.onFieldChange); } From 0de6b447e5ee065e6bd768efd78bc292d99d01a3 Mon Sep 17 00:00:00 2001 From: Brad Adams Date: Mon, 9 Oct 2017 14:07:10 +0200 Subject: [PATCH 3/8] Table: Add `important` rule to `col-resize` cursor (#7381) * Table: Add `important` rule to `col-resize` cursor * Table: Add `important` rule to `col-resize` cursor * Update table-header.js --- packages/table/src/table-header.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/table/src/table-header.js b/packages/table/src/table-header.js index 4d524166c..b6674904e 100644 --- a/packages/table/src/table-header.js +++ b/packages/table/src/table-header.js @@ -369,9 +369,15 @@ export default { const bodyStyle = document.body.style; if (rect.width > 12 && rect.right - event.pageX < 8) { bodyStyle.cursor = 'col-resize'; + if (hasClass(target, 'is-sortable')) { + target.style.cursor = 'col-resize'; + } this.draggingColumn = column; } else if (!this.dragging) { bodyStyle.cursor = ''; + if (hasClass(target, 'is-sortable')) { + target.style.cursor = 'pointer'; + } this.draggingColumn = null; } } From 17c94d74104c4b7f34ad1dc14c8c50b900f32e32 Mon Sep 17 00:00:00 2001 From: rennai Date: Fri, 8 Sep 2017 23:51:28 +0800 Subject: [PATCH 4/8] fix #5813 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 autocomplete 组件 IE11 下使用搜狗输入法,无法输入中文的问题 --- packages/autocomplete/src/autocomplete.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/autocomplete/src/autocomplete.vue b/packages/autocomplete/src/autocomplete.vue index ed8877431..ceef4b970 100644 --- a/packages/autocomplete/src/autocomplete.vue +++ b/packages/autocomplete/src/autocomplete.vue @@ -115,7 +115,7 @@ handleComposition(event) { if (event.type === 'compositionend') { this.isOnComposition = false; - this.handleChange(this.value); + this.handleChange(event.target.value); } else { this.isOnComposition = true; } From 6d311ed6d3a065e35526dce0da0c5b96642e23b1 Mon Sep 17 00:00:00 2001 From: Brad Adams Date: Mon, 16 Oct 2017 09:52:10 +0200 Subject: [PATCH 5/8] Switch: Add `allowFocus` prop & focus/blur events (#7494) * Table: Add `important` rule to `col-resize` cursor * Table: Add `important` rule to `col-resize` cursor * Update table-header.js * [Switch]: Add `allowFocus` prop + blur/focus events + Add new `allowFocus` prop + Add event emitters for focus & blur events + Set `input` $ref `.focus()` on switch click event * [Switch]: Add styling for when `allowFocus: true` + Add styling for when `allowFocus` prop is set to true. + Add styling for when input is focused * [Switch]: Update docs --- examples/docs/en-US/switch.md | 7 +++++-- packages/switch/src/component.vue | 25 ++++++++++++++++++++++- packages/theme-default/src/common/var.css | 1 + packages/theme-default/src/switch.css | 19 +++++++++++++++++ 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/examples/docs/en-US/switch.md b/examples/docs/en-US/switch.md index ff9e925ea..64943aaae 100644 --- a/examples/docs/en-US/switch.md +++ b/examples/docs/en-US/switch.md @@ -122,10 +122,13 @@ on-value | switch value when in `on` state | boolean / string / number | — | off-value | switch value when in `off` state | boolean / string / number | — | false on-color | background color when in `on` state | string | — | #20A0FF off-color | background color when in `off` state | string | — | #C0CCDA -name| input name of Switch | string | — | — +name | input name of Switch | string | — | — +allow-focus | allow `.focus()` & `.blur()` methods on the `input` $ref | boolean | — | false ### Events Event Name | Description | Parameters ---- | ----| ---- -change | triggers when value changes | value after changing +change | triggers when value changes | (value: Boolean) +blur | triggers on blur (if `allowFocus` is `true`) | (event: Event) +focus | triggers on focus (if `allowFocus` is `true`) | (event: Event) diff --git a/packages/switch/src/component.vue b/packages/switch/src/component.vue index aaf9381f0..0684a83e6 100644 --- a/packages/switch/src/component.vue +++ b/packages/switch/src/component.vue @@ -3,14 +3,17 @@
- + @@ -85,6 +88,10 @@ name: { type: String, default: '' + }, + allowFocus: { + type: Boolean, + default: false } }, data() { @@ -131,6 +138,22 @@ let newColor = this.checked ? this.onColor : this.offColor; this.$refs.core.style.borderColor = newColor; this.$refs.core.style.backgroundColor = newColor; + }, + setFocus() { + // set focus on input + if (this.allowFocus) { + this.$refs.input.focus(); + } + }, + handleBlur(event) { + if (this.allowFocus) { + this.$emit('blur', event); + } + }, + handleFocus(event) { + if (this.allowFocus) { + this.$emit('focus', event); + } } }, mounted() { diff --git a/packages/theme-default/src/common/var.css b/packages/theme-default/src/common/var.css index 02de8b845..fc4f0ee8f 100644 --- a/packages/theme-default/src/common/var.css +++ b/packages/theme-default/src/common/var.css @@ -400,6 +400,7 @@ --switch-width: 46px; --switch-height: 22px; --switch-button-size: 16px; + --switch-focus-border: var(--color-primary); /* Dialog -------------------------- */ diff --git a/packages/theme-default/src/switch.css b/packages/theme-default/src/switch.css index 19cd97107..8e39225e7 100644 --- a/packages/theme-default/src/switch.css +++ b/packages/theme-default/src/switch.css @@ -26,6 +26,8 @@ display: inline-block; font-size: var(--switch-font-size); cursor: pointer; + z-index: 2; + @m left { i { left: 6px; @@ -48,6 +50,22 @@ @e input { display: none; + + &.allow-focus { + z-index: 0; + display: initial; + position: absolute; + left: 0; + top: 0; + outline: none; + opacity: 0; + + &:focus { + + .el-switch__core { + box-shadow: 0 0 2px var(--switch-focus-border); + } + } + } } @e core { @@ -62,6 +80,7 @@ background: var(--switch-off-color); cursor: pointer; transition: border-color .3s, background-color .3s; + z-index: 1; & .el-switch__button { position: absolute 0 * * 0; From a0ec1580e126c9350a2022fcb4b23bfa37c69fcd Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Mon, 16 Oct 2017 16:17:10 +0800 Subject: [PATCH 6/8] Changelog: update for 1.4.7 --- .gitignore | 1 + CHANGELOG.en-US.md | 7 +++++++ CHANGELOG.zh-CN.md | 6 ++++++ examples/app.vue | 4 ++-- examples/docs/en-US/switch.md | 8 ++++---- examples/docs/zh-CN/switch.md | 3 +++ 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 7e4e70fe0..c750822cf 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ fe.element/element-ui .npmrc coverage waiter.config.js +build/bin/algolia-key.js diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index fb8ec4653..011544ef3 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -1,5 +1,12 @@ ## Changelog +### 1.4.7 + +*2017-10-16* + +- Fixed compatibility of Autocomplete and Vue 2.5.x, #6942 (by @rennai) +- Added `allow-focus` attribute for Switch, #7494 (by @breadadams) + ### 1.4.6 *2017-09-27* diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 1d36d06c5..e7e4e92d1 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -1,5 +1,11 @@ ## 更新日志 +### 1.4.7 +*2017-10-16* + +- 修复 Autocomplete 与 Vue 2.5.x 不兼容的问题,#6942(by @rennai) +- Switch 新增 `allow-focus` 属性,#7494(by @breadadams) + ### 1.4.6 *2017-09-27* diff --git a/examples/app.vue b/examples/app.vue index 065c61878..5b6ad5cc6 100644 --- a/examples/app.vue +++ b/examples/app.vue @@ -204,8 +204,8 @@ if (!notified) { const h = this.$createElement; const title = this.lang === 'zh-CN' - ? '2.0.0-alpha.1 发布' - : '2.0.0-alpha.1 released'; + ? '2.0.0 Alpha 发布' + : '2.0.0 Alpha released'; const messages = this.lang === 'zh-CN' ? ['点击', '这里', '查看详情'] : ['Click ', 'here', ' to learn more']; diff --git a/examples/docs/en-US/switch.md b/examples/docs/en-US/switch.md index 64943aaae..bd1c72361 100644 --- a/examples/docs/en-US/switch.md +++ b/examples/docs/en-US/switch.md @@ -123,12 +123,12 @@ off-value | switch value when in `off` state | boolean / string / number | — on-color | background color when in `on` state | string | — | #20A0FF off-color | background color when in `off` state | string | — | #C0CCDA name | input name of Switch | string | — | — -allow-focus | allow `.focus()` & `.blur()` methods on the `input` $ref | boolean | — | false +allow-focus | allow `focus` and `blur` events on the input | boolean | — | false ### Events Event Name | Description | Parameters ---- | ----| ---- -change | triggers when value changes | (value: Boolean) -blur | triggers on blur (if `allowFocus` is `true`) | (event: Event) -focus | triggers on focus (if `allowFocus` is `true`) | (event: Event) +change | triggers when value changes | value after changing +blur | triggers on blur (if `allow-focus` is true) | event: Event +focus | triggers on focus (if `allow-focus` is true) | event: Event diff --git a/examples/docs/zh-CN/switch.md b/examples/docs/zh-CN/switch.md index 20ab6b79c..64d90d9d4 100644 --- a/examples/docs/zh-CN/switch.md +++ b/examples/docs/zh-CN/switch.md @@ -124,8 +124,11 @@ | on-color | switch 打开时的背景色 | string | — | #20A0FF | | off-color | switch 关闭时的背景色 | string | — | #C0CCDA | | name | switch 对应的 name 属性 | string | — | — | +| allow-focus | 允许 switch 触发 focus 和 blur 事件 | boolean | — | false | ### Events | 事件名称 | 说明 | 回调参数 | |---------- |-------- |---------- | | change | switch 状态发生变化时的回调函数 | 新状态的值 | +| blur | switch 失去焦点时触发,仅当 `allow-focus` 为 true 时生效 | Event 事件对象 | +| focus | switch 获得焦点时触发,仅当 `allow-focus` 为 true 时生效 | Event 事件对象 | From c52b64dae1ca0229407efae8d7b5ce891a85477c Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Mon, 16 Oct 2017 16:25:29 +0800 Subject: [PATCH 7/8] [build] 1.4.7 --- examples/versions.json | 2 +- packages/theme-default/package.json | 2 +- src/index.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/versions.json b/examples/versions.json index 641b20e0e..34bcb884e 100644 --- a/examples/versions.json +++ b/examples/versions.json @@ -1 +1 @@ -{"1.0.9":"1.0","1.1.6":"1.1","1.2.9":"1.2","1.3.7":"1.3","1.4.6":"1.4"} \ No newline at end of file +{"1.0.9":"1.0","1.1.6":"1.1","1.2.9":"1.2","1.3.7":"1.3","1.4.7":"1.4"} \ No newline at end of file diff --git a/packages/theme-default/package.json b/packages/theme-default/package.json index 55a9d08c4..8365a6a4a 100644 --- a/packages/theme-default/package.json +++ b/packages/theme-default/package.json @@ -1,6 +1,6 @@ { "name": "element-theme-default", - "version": "1.4.6", + "version": "1.4.7", "description": "Element component default theme.", "main": "lib/index.css", "style": "lib/index.css", diff --git a/src/index.js b/src/index.js index 97c132ebb..3a55deb8a 100644 --- a/src/index.js +++ b/src/index.js @@ -158,7 +158,7 @@ if (typeof window !== 'undefined' && window.Vue) { }; module.exports = { - version: '1.4.6', + version: '1.4.7', locale: locale.use, i18n: locale.i18n, install, From 48c3f6719b4684cd1b0bca1871f80e0a1841b94c Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Mon, 16 Oct 2017 16:25:29 +0800 Subject: [PATCH 8/8] [release] 1.4.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 87651d2d6..032bd58ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "element-ui", - "version": "1.4.6", + "version": "1.4.7", "description": "A Component Library for Vue.js.", "main": "lib/element-ui.common.js", "files": [