Merge branch 'master' into unittest

pull/465/head
qingwei.li 2016-10-17 21:29:37 +08:00
commit 4f732b1b02
11 changed files with 59 additions and 51 deletions

View File

@ -4,6 +4,10 @@
*2016-XX-XX*
- 修复 Form reset method 对日期控件不起效的问题
- 修复 Dialog 和 Message Box 在 body 无溢出时错误地添加 padding-right 的问题
- 修复 Message Box 的 prompt 在打开时会携带之前的验证状态的问题
#### 非兼容性更新
- 全屏 Loading 现在默认不再锁定屏幕滚动。如果需要的话,可添加 `lock` 修饰符

View File

@ -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

View File

@ -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,6 +27,13 @@ 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/;
exports.postcss = function(webapck) {

View File

@ -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');

View File

@ -200,7 +200,6 @@
```html
<el-input
placeholder="请输入内容"
:number="true"
v-model="input">
</el-input>
```
@ -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 |

View File

@ -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

View File

@ -25,7 +25,7 @@
},
"repository": {
"type": "git",
"url": "git@github.com:elemefe/element.git"
"url": "git@github.com:ElemeFE/element.git"
},
"homepage": "http://element.eleme.io",
"keywords": [
@ -35,17 +35,14 @@
],
"license": "MIT",
"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",
"vue-popup": "^0.2.9",
"wind-dom": "0.0.3"
},
"devDependencies": {
@ -67,6 +64,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",
@ -87,10 +87,10 @@
"markdown-it": "^6.1.1",
"markdown-it-container": "^2.0.0",
"mocha": "^3.1.1",
"object-assign": "^4.1.0",
"phantomjs-prebuilt": "^2.1.13",
"postcss": "^5.1.2",
"postcss-loader": "^0.11.1",
"postcss-salad": "^1.0.5",
"rimraf": "^2.5.4",
"sinon": "^1.17.6",
"sinon-chai": "^2.8.0",
@ -103,7 +103,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"
}
}

View File

@ -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) {

View File

@ -13,27 +13,9 @@
<slot name="prepend"></slot>
</div>
<input
v-if="type === 'text'"
v-if="type !== 'textarea'"
class="el-input__inner"
v-model="currentValue"
type="text"
:name="name"
:placeholder="placeholder"
:disabled="disabled"
:readonly="readonly"
:number="number"
:maxlength="maxlength"
:minlength="minlength"
:autocomplete="autoComplete"
ref="input"
@focus="handleFocus"
@blur="handleBlur"
>
<input
v-if="type === 'password'"
class="el-input__inner"
v-model="currentValue"
type="password"
:type="type"
:name="name"
:placeholder="placeholder"
:disabled="disabled"
@ -42,7 +24,9 @@
:maxlength="maxlength"
:minlength="minlength"
:autocomplete="autoComplete"
:value="value"
ref="input"
@input="handleInput"
@focus="handleFocus"
@blur="handleBlur"
>
@ -151,6 +135,9 @@
},
handleFocus(ev) {
this.$emit('focus', ev);
},
handleInput(ev) {
this.currentValue = ev.target.value;
}
},

View File

@ -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;

View File

@ -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');
}
}
},