From cfed2184bc4df8868307cda0085575f05a5fd583 Mon Sep 17 00:00:00 2001 From: baiyaaaaa Date: Mon, 17 Oct 2016 11:17:13 +0800 Subject: [PATCH 1/7] fix input type --- examples/docs/zh-cn/input.md | 2 -- packages/input/src/input.vue | 27 +++++++-------------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/examples/docs/zh-cn/input.md b/examples/docs/zh-cn/input.md index 26d0caf34..368ebf921 100644 --- a/examples/docs/zh-cn/input.md +++ b/examples/docs/zh-cn/input.md @@ -200,7 +200,6 @@ ```html ``` @@ -636,7 +635,6 @@ | disabled | 禁用 | boolean | — | false | | size | 输入框尺寸,只在 `type!="textarea"` 时有效 | string | large, small, mini | — | | icon | 输入框尾部图标 | string | — | — | -| number | 指定 model 值为 number 类型 | boolean | — | false | | rows | 输入框行数,只对 `type="textarea"` 有效 | number | — | 2 | | autosize | 自适应内容高度,只对 `type="textarea"` 有效,可传入对象,如,{ minRows: 2, maxRows: 6 } | boolean/object | — | false | diff --git a/packages/input/src/input.vue b/packages/input/src/input.vue index 0e09f9b03..50dd73929 100644 --- a/packages/input/src/input.vue +++ b/packages/input/src/input.vue @@ -13,27 +13,9 @@ - @@ -151,6 +135,9 @@ }, handleFocus(ev) { this.$emit('focus', ev); + }, + handleInput(ev) { + this.currentValue = ev.target.value; } }, From cea82e03928c23ce04627012dac196cd4568441c Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Mon, 17 Oct 2016 12:17:03 +0800 Subject: [PATCH 2/7] add padding-right only when body has overflow #414 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 17e2a5e48..5b8cf6335 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "object-equal": "^1.0.0", "postcss-salad": "^1.0.5", "throttle-debounce": "^1.0.1", - "vue-popup": "^0.2.8", + "vue-popup": "^0.2.9", "wind-dom": "0.0.3" }, "devDependencies": { From c0c64f9cce912fb6dd797bdcd8d3169aa92921cf Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Mon, 17 Oct 2016 14:14:59 +0800 Subject: [PATCH 3/7] Update package.json dependencies --- LICENSE | 2 +- package.json | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/LICENSE b/LICENSE index eaa14f832..a764a8670 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 element-ui +Copyright (c) 2016 ElemeFE Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 17e2a5e48..689754f06 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "repository": { "type": "git", - "url": "git@github.com:elemefe/element.git" + "url": "git@github.com:ElemeFE/element.git" }, "homepage": "http://element.eleme.io", "keywords": [ @@ -32,15 +32,12 @@ "components" ], "bugs": { - "url": "https://github.com/elemefe/element/issues" + "url": "https://github.com/ElemeFE/element/issues" }, "dependencies": { "async-validator": "^1.6.6", - "gulp": "^3.9.1", - "gulp-cssmin": "^0.1.7", - "gulp-postcss": "^6.1.1", + "object-assign": "^4.1.0", "object-equal": "^1.0.0", - "postcss-salad": "^1.0.5", "throttle-debounce": "^1.0.1", "vue-popup": "^0.2.8", "wind-dom": "0.0.3" @@ -63,6 +60,9 @@ "file-loader": "^0.9.0", "file-save": "^0.2.0", "gh-pages": "^0.11.0", + "gulp": "^3.9.1", + "gulp-cssmin": "^0.1.7", + "gulp-postcss": "^6.1.1", "highlight.js": "^9.3.0", "html-loader": "^0.4.3", "html-webpack-plugin": "^2.22.0", @@ -71,9 +71,9 @@ "lerna": "2.0.0-beta.18", "markdown-it": "^6.1.1", "markdown-it-container": "^2.0.0", - "object-assign": "^4.1.0", "postcss": "^5.1.2", "postcss-loader": "^0.11.1", + "postcss-salad": "^1.0.5", "rimraf": "^2.5.4", "style-loader": "^0.13.1", "theaterjs": "^3.0.0", @@ -84,7 +84,6 @@ "vue-markdown-loader": "^0.5.1", "vue-router": "^2.0.0", "webpack": "^1.13.2", - "webpack-dev-server": "^1.15.1", - "wind-dom": "0.0.3" + "webpack-dev-server": "^1.15.1" } } From eb02763837bfcaede4fbca2b4324ddfcb6b0b02f Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Mon, 17 Oct 2016 15:46:34 +0800 Subject: [PATCH 4/7] Menu: fix indexPath of undefined --- packages/menu/src/menu.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/menu/src/menu.vue b/packages/menu/src/menu.vue index 8093c47df..17225ce0b 100644 --- a/packages/menu/src/menu.vue +++ b/packages/menu/src/menu.vue @@ -46,6 +46,7 @@ watch: { defaultActive(value) { this.activeIndex = value; + if (!this.menuItems[value]) return; let indexPath = this.menuItems[value].indexPath; this.handleSelect(value, indexPath); @@ -97,6 +98,7 @@ }, openActiveItemMenus() { let index = this.activeIndex; + if (!this.menuItems[index]) return; if (index && this.mode === 'vertical') { let indexPath = this.menuItems[index].indexPath; From 0a2ec8efb085781de136c0b5a5e29346f3099db5 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Mon, 17 Oct 2016 17:47:24 +0800 Subject: [PATCH 5/7] Fix build common config --- build/config.js | 20 +++++++++++++------- build/cooking.conf.js | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/build/config.js b/build/config.js index e3a660e1f..e92b90f48 100644 --- a/build/config.js +++ b/build/config.js @@ -1,5 +1,6 @@ var Components = require('../components.json'); var path = require('path'); +var dependencies = require('../package.json').dependencies; var externals = {}; Object.keys(Components).forEach(function(key) { @@ -7,18 +8,16 @@ Object.keys(Components).forEach(function(key) { externals[`element-ui/packages/${key}/style.css`] = `element-ui/lib/${key}/style.css`; }); +Object.keys(dependencies).forEach(function (key) { + externals[key] = key; +}); + externals['element-ui/src/utils/clickoutside'] = 'element-ui/lib/utils/clickoutside'; externals['element-ui/src/utils/popper'] = 'element-ui/lib/utils/popper'; externals['element-ui/src/utils/vue-popper'] = 'element-ui/lib/utils/vue-popper'; -externals['vue-popup'] = 'vue-popup'; exports.externals = Object.assign({ - vue: { - root: 'Vue', - commonjs: 'vue', - commonjs2: 'vue', - amd: 'vue' - } + vue: 'vue' }, externals); exports.alias = { @@ -28,4 +27,11 @@ exports.alias = { 'element-ui': path.resolve(__dirname, '../') }; +exports.vue = { + root: 'Vue', + commonjs: 'vue', + commonjs2: 'vue', + amd: 'vue' +}; + exports.jsexclude = /node_modules|utils\/popper\.js|utils\/date.\js/; diff --git a/build/cooking.conf.js b/build/cooking.conf.js index b4dd70d0c..c49a3b30d 100644 --- a/build/cooking.conf.js +++ b/build/cooking.conf.js @@ -9,7 +9,7 @@ cooking.set({ moduleName: 'ELEMENT', extends: ['vue2'], alias: config.alias, - externals: { vue: config.externals.vue } + externals: { vue: config.vue } }); cooking.add('output.filename', 'index.js'); From 5b4114ea3c768bd68fdb9c7f4487fa6df1dcd6cd Mon Sep 17 00:00:00 2001 From: baiyaaaaa Date: Mon, 17 Oct 2016 19:01:23 +0800 Subject: [PATCH 6/7] fix reset method --- CHANGELOG.md | 2 ++ packages/form/src/form-item.vue | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 327a4a178..a56878e66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ *2016-XX-XX* +- 修复 Form reset method 对日期控件不起效的问题 + #### 非兼容性更新 - 全屏 Loading 现在默认不再锁定屏幕滚动。如果需要的话,可添加 `lock` 修饰符 diff --git a/packages/form/src/form-item.vue b/packages/form/src/form-item.vue index 85c92de6f..6dbf1b003 100644 --- a/packages/form/src/form-item.vue +++ b/packages/form/src/form-item.vue @@ -78,7 +78,8 @@ validateDisabled: false, validating: false, validator: {}, - isRequired: false + isRequired: false, + initialValue: null }; }, methods: { @@ -118,12 +119,9 @@ if (Array.isArray(value) && value.length > 0) { this.validateDisabled = true; model[this.prop] = []; - } else if (typeof value === 'string' && value !== '') { + } else if (value) { this.validateDisabled = true; - model[this.prop] = ''; - } else if (typeof value === 'number') { - this.validateDisabled = true; - model[this.prop] = 0; + model[this.prop] = this.initialValue; } }, getRules() { @@ -151,12 +149,22 @@ } this.validate('change'); + }, + getInitialValue() { + var value = this.form.model[this.prop]; + if (value === undefined) { + return value; + } else { + return JSON.parse(JSON.stringify(value)); + } } }, mounted() { if (this.prop) { this.dispatch('form', 'el.form.addField', [this]); + this.initialValue = this.getInitialValue(); + let rules = this.getRules(); if (rules.length) { From 4ac311868743bc089bf19de9a946408fa74c6579 Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Mon, 17 Oct 2016 12:42:02 +0800 Subject: [PATCH 7/7] remove errorMessage when prompt is closed --- CHANGELOG.md | 2 ++ examples/docs/zh-cn/message-box.md | 2 +- packages/message-box/src/main.vue | 10 +++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a56878e66..fc296bd96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ *2016-XX-XX* - 修复 Form reset method 对日期控件不起效的问题 +- 修复 Dialog 和 Message Box 在 body 无溢出时错误地添加 padding-right 的问题 +- 修复 Message Box 的 prompt 在打开时会携带之前的验证状态的问题 #### 非兼容性更新 diff --git a/examples/docs/zh-cn/message-box.md b/examples/docs/zh-cn/message-box.md index b5439b41e..e51774a19 100644 --- a/examples/docs/zh-cn/message-box.md +++ b/examples/docs/zh-cn/message-box.md @@ -143,7 +143,7 @@ this.$prompt('请输入邮箱', '提示', { inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/, inputErrorMessage: '邮箱格式不正确' - }).then(value => { + }).then(({ value }) => { this.$message({ type: 'success', message: '你的邮箱是: ' + value diff --git a/packages/message-box/src/main.vue b/packages/message-box/src/main.vue index e3dc91aa8..eabdec898 100644 --- a/packages/message-box/src/main.vue +++ b/packages/message-box/src/main.vue @@ -140,19 +140,23 @@ }, watch: { - inputValue() { - if (this.$type === 'prompt') { + inputValue(val) { + if (this.$type === 'prompt' && val !== null) { this.validate(); } }, value(val) { - if (val && this.$type === 'prompt') { + if (this.$type !== 'prompt') return; + if (val) { setTimeout(() => { if (this.$refs.input && this.$refs.input.$el) { this.$refs.input.$el.querySelector('input').focus(); } }, 500); + } else { + this.editorErrorMessage = ''; + removeClass(this.$refs.input.$el.querySelector('input'), 'invalid'); } } },