mirror of https://github.com/ElemeFE/element
commit
c9d2314750
|
@ -1,5 +1,17 @@
|
|||
## Changelog
|
||||
|
||||
### 1.1.2
|
||||
|
||||
*2016-12-30*
|
||||
|
||||
- Fixed `sortable` and `fixed` attribute of Table not working in Vue 2.1.7+
|
||||
- Fixed Input Number not resetting on blur when input with illegal values, #2098
|
||||
- Removed `title` scoped slot of Collapse, and added `title` named slot, #2100
|
||||
- Fixed range selection in TimePicker not working issue
|
||||
- Fixed Tabs' active tab switching when a non-active tab is removed, #2106
|
||||
- Fixed console error reporting when navigating Select with arrow keys, #2120
|
||||
- Fixed incorrect validation timing of filterable Select in Form, #2120
|
||||
|
||||
### 1.1.1
|
||||
|
||||
*2016-12-29*
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
## 更新日志
|
||||
|
||||
### 1.1.2
|
||||
*2016-12-30*
|
||||
|
||||
- 修复 Vue 2.1.7 升级导致的 Table `sortable` 和 `fixed` 无法使用的问题
|
||||
- 修正 Input Number 在手动输入越界值时,blur 触发时没有重置为原来的值的问题,#2098
|
||||
- 移除 Collapse 的 `title` scoped slot, 并新增 `title` named slot,#2100
|
||||
- 修复 TimePicker 范围选择无法使用的问题
|
||||
- 修复 Tabs 删除非当前激活的 tab 后,当前激活的 tab 变化的问题,#2106
|
||||
- 修复 Select 在使用方向键导航时控制台报错的问题,#2120
|
||||
- 修复 Form 中可搜索的 Select 验证时机错误的问题,#2120
|
||||
|
||||
### 1.1.1
|
||||
*2016-12-29*
|
||||
|
||||
|
|
|
@ -132,5 +132,5 @@ Set value via a input box.
|
|||
## Events
|
||||
| Event Name | Description | Parameters |
|
||||
|---------- |-------- |---------- |
|
||||
| change | triggers when the value changes | value after changing |
|
||||
| change | triggers when the value changes (if the mouse is being dragged, this event only fires when the mouse is released) | value after changing |
|
||||
|
||||
|
|
|
@ -156,4 +156,4 @@
|
|||
### Events
|
||||
| 事件名称 | 说明 | 回调参数 |
|
||||
|---------- |-------- |---------- |
|
||||
| change | 值改变时触发 | 改变后的值 |
|
||||
| change | 值改变时触发(使用鼠标拖曳时,只在松开鼠标后触发) | 改变后的值 |
|
||||
|
|
|
@ -238,7 +238,7 @@
|
|||
| highlight-current | 是否高亮当前选中节点,默认值是 false。| boolean | — | false |
|
||||
| current-node-key | 当前选中节点的 key,只写属性 | string, number | — | — |
|
||||
| default-expand-all | 是否默认展开所有节点 | boolean | — | false |
|
||||
| expand-on-click-node | 是否在点击节点的时候展开或者收缩节点,如果为 false,则只有点箭头图标的时候才会展开或者收缩节点。 | boolean | — | false |
|
||||
| expand-on-click-node | 是否在点击节点的时候展开或者收缩节点, 默认值为 true,如果为 false,则只有点箭头图标的时候才会展开或者收缩节点。 | boolean | — | true |
|
||||
| auto-expand-parent | 展开子节点的时候是否自动展开父节点 | boolean | — | true |
|
||||
| default-expanded-keys | 默认展开的节点的 key 的数组 | array | — | — |
|
||||
| show-checkbox | 节点是否可被选择 | boolean | — | false |
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"1.0.9": "1.0",
|
||||
"1.1.1": "1.1"
|
||||
"1.1.2": "1.1"
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "element-ui",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"description": "A Component Library for Vue.js.",
|
||||
"main": "lib/element-ui.common.js",
|
||||
"files": [
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
'error': 'el-icon-circle-cross'
|
||||
};
|
||||
export default {
|
||||
name: 'el-alert',
|
||||
name: 'ElAlert',
|
||||
|
||||
props: {
|
||||
title: {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<script>
|
||||
export default {
|
||||
name: 'el-badge',
|
||||
name: 'ElBadge',
|
||||
|
||||
props: {
|
||||
value: {},
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<script>
|
||||
export default {
|
||||
name: 'el-card',
|
||||
name: 'ElCard',
|
||||
|
||||
props: ['header', 'bodyStyle']
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
import Popup from 'element-ui/src/utils/popup';
|
||||
|
||||
export default {
|
||||
name: 'el-dialog',
|
||||
name: 'ElDialog',
|
||||
|
||||
mixins: [Popup],
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
@blur="handleBlur"
|
||||
:disabled="disabled"
|
||||
:size="size"
|
||||
:max="max"
|
||||
:min="min"
|
||||
ref="input"
|
||||
>
|
||||
<template slot="prepend" v-if="$slots.prepend">
|
||||
|
@ -49,8 +51,7 @@
|
|||
bind(el, binding, vnode) {
|
||||
let interval = null;
|
||||
let startTime;
|
||||
|
||||
const handler = () => vnode.context[binding.expression]();
|
||||
const handler = () => vnode.context[binding.expression].apply();
|
||||
const clear = () => {
|
||||
if (new Date() - startTime < 100) {
|
||||
handler();
|
||||
|
@ -81,7 +82,7 @@
|
|||
},
|
||||
min: {
|
||||
type: Number,
|
||||
default: 0
|
||||
default: -Infinity
|
||||
},
|
||||
value: {
|
||||
default: 0
|
||||
|
@ -104,6 +105,7 @@
|
|||
this.$emit('input', this.max);
|
||||
value = this.max;
|
||||
}
|
||||
|
||||
return {
|
||||
currentValue: value
|
||||
};
|
||||
|
@ -124,69 +126,57 @@
|
|||
},
|
||||
computed: {
|
||||
minDisabled() {
|
||||
return this.accSub(this.value, this.step) < this.min;
|
||||
return this._decrease(this.value, this.step) < this.min;
|
||||
},
|
||||
maxDisabled() {
|
||||
return this.accAdd(this.value, this.step) > this.max;
|
||||
return this._increase(this.value, this.step) > this.max;
|
||||
},
|
||||
precision() {
|
||||
const { value, step, getPrecision } = this;
|
||||
return Math.max(getPrecision(value), getPrecision(step));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
accSub(arg1, arg2) {
|
||||
var r1, r2, m, n;
|
||||
try {
|
||||
r1 = arg1.toString().split('.')[1].length;
|
||||
} catch (e) {
|
||||
r1 = 0;
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split('.')[1].length;
|
||||
} catch (e) {
|
||||
r2 = 0;
|
||||
}
|
||||
m = Math.pow(10, Math.max(r1, r2));
|
||||
n = (r1 >= r2) ? r1 : r2;
|
||||
return parseFloat(((arg1 * m - arg2 * m) / m).toFixed(n));
|
||||
toPrecision(num, precision) {
|
||||
if (precision === undefined) precision = this.precision;
|
||||
return parseFloat(parseFloat(Number(num).toFixed(precision)));
|
||||
},
|
||||
accAdd(arg1, arg2) {
|
||||
var r1, r2, m, c;
|
||||
try {
|
||||
r1 = arg1.toString().split('.')[1].length;
|
||||
} catch (e) {
|
||||
r1 = 0;
|
||||
getPrecision(value) {
|
||||
const valueString = value.toString();
|
||||
const dotPosition = valueString.indexOf('.');
|
||||
let precision = 0;
|
||||
if (dotPosition !== -1) {
|
||||
precision = valueString.length - dotPosition - 1;
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split('.')[1].length;
|
||||
} catch (e) {
|
||||
r2 = 0;
|
||||
}
|
||||
c = Math.abs(r1 - r2);
|
||||
m = Math.pow(10, Math.max(r1, r2));
|
||||
if (c > 0) {
|
||||
var cm = Math.pow(10, c);
|
||||
if (r1 > r2) {
|
||||
arg1 = Number(arg1.toString().replace('.', ''));
|
||||
arg2 = Number(arg2.toString().replace('.', '')) * cm;
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', '')) * cm;
|
||||
arg2 = Number(arg2.toString().replace('.', ''));
|
||||
}
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', ''));
|
||||
arg2 = Number(arg2.toString().replace('.', ''));
|
||||
}
|
||||
return (arg1 + arg2) / m;
|
||||
return precision;
|
||||
},
|
||||
_increase(val, step) {
|
||||
if (typeof val !== 'number') return this.currentValue;
|
||||
|
||||
const precisionFactor = Math.pow(10, this.precision);
|
||||
|
||||
return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
|
||||
},
|
||||
_decrease(val, step) {
|
||||
if (typeof val !== 'number') return this.currentValue;
|
||||
|
||||
const precisionFactor = Math.pow(10, this.precision);
|
||||
|
||||
return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor);
|
||||
},
|
||||
increase() {
|
||||
if (this.maxDisabled) return;
|
||||
if (this.disabled || this.maxDisabled) return;
|
||||
const value = this.value || 0;
|
||||
if (this.accAdd(value, this.step) > this.max || this.disabled) return;
|
||||
this.currentValue = this.accAdd(value, this.step);
|
||||
const newVal = this._increase(value, this.step);
|
||||
if (newVal > this.max) return;
|
||||
this.currentValue = newVal;
|
||||
},
|
||||
decrease() {
|
||||
if (this.minDisabled) return;
|
||||
if (this.disabled || this.minDisabled) return;
|
||||
const value = this.value || 0;
|
||||
if (this.accSub(value, this.step) < this.min || this.disabled) return;
|
||||
this.currentValue = this.accSub(value, this.step);
|
||||
const newVal = this._decrease(value, this.step);
|
||||
if (newVal < this.min) return;
|
||||
this.currentValue = newVal;
|
||||
},
|
||||
handleBlur() {
|
||||
this.$refs.input.setCurrentValue(this.currentValue);
|
||||
|
|
|
@ -20,7 +20,7 @@ import Popper from 'element-ui/src/utils/vue-popper';
|
|||
import { on, off } from 'element-ui/src/utils/dom';
|
||||
|
||||
export default {
|
||||
name: 'el-popover',
|
||||
name: 'ElPopover',
|
||||
|
||||
mixins: [Popper],
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
import { hasClass } from 'element-ui/src/utils/dom';
|
||||
|
||||
export default {
|
||||
name: 'el-rate',
|
||||
name: 'ElRate',
|
||||
|
||||
data() {
|
||||
return {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
export default {
|
||||
mixins: [Emitter],
|
||||
|
||||
name: 'el-option-group',
|
||||
name: 'ElOptionGroup',
|
||||
|
||||
componentName: 'ElOptionGroup',
|
||||
|
||||
|
@ -57,4 +57,4 @@
|
|||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
export default {
|
||||
mixins: [Emitter],
|
||||
|
||||
name: 'el-option',
|
||||
name: 'ElOption',
|
||||
|
||||
componentName: 'ElOption',
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
import Popper from 'element-ui/src/utils/vue-popper';
|
||||
|
||||
export default {
|
||||
name: 'el-select-dropdown',
|
||||
name: 'ElSelectDropdown',
|
||||
|
||||
componentName: 'ElSelectDropdown',
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
<script>
|
||||
export default {
|
||||
name: 'el-step',
|
||||
name: 'ElStep',
|
||||
|
||||
props: {
|
||||
title: String,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<script>
|
||||
export default {
|
||||
name: 'el-steps',
|
||||
name: 'ElSteps',
|
||||
|
||||
props: {
|
||||
space: Number,
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
<script>
|
||||
export default {
|
||||
name: 'el-switch',
|
||||
name: 'ElSwitch',
|
||||
props: {
|
||||
value: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
import ElCheckboxGroup from 'element-ui/packages/checkbox-group';
|
||||
|
||||
export default {
|
||||
name: 'el-table-filter-panel',
|
||||
name: 'ElTableFilterPanel',
|
||||
|
||||
mixins: [Popper, Locale],
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ const DEFAULT_RENDER_CELL = function(h, { row, column }) {
|
|||
};
|
||||
|
||||
export default {
|
||||
name: 'el-table-column',
|
||||
name: 'ElTableColumn',
|
||||
|
||||
props: {
|
||||
type: {
|
||||
|
|
|
@ -66,7 +66,7 @@ const convertToRows = (originColumns) => {
|
|||
};
|
||||
|
||||
export default {
|
||||
name: 'el-table-header',
|
||||
name: 'ElTableHeader',
|
||||
|
||||
render(h) {
|
||||
const originColumns = this.store.states.originColumns;
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
let tableIdSeed = 1;
|
||||
|
||||
export default {
|
||||
name: 'el-table',
|
||||
name: 'ElTable',
|
||||
|
||||
mixins: [Locale],
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</template>
|
||||
<script>
|
||||
module.exports = {
|
||||
name: 'el-tab-pane',
|
||||
name: 'ElTabPane',
|
||||
|
||||
props: {
|
||||
label: String,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
module.exports = {
|
||||
name: 'el-tabs',
|
||||
name: 'ElTabs',
|
||||
|
||||
props: {
|
||||
type: String,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "element-theme-default",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"description": "Element component default theme.",
|
||||
"main": "lib/index.css",
|
||||
"style": "lib/index.css",
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
import Popper from 'element-ui/src/utils/vue-popper';
|
||||
|
||||
export default {
|
||||
name: 'el-tooltip',
|
||||
name: 'ElTooltip',
|
||||
|
||||
mixins: [Popper],
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
import ElCheckbox from 'element-ui/packages/checkbox';
|
||||
|
||||
export default {
|
||||
name: 'el-tree-node',
|
||||
name: 'ElTreeNode',
|
||||
|
||||
props: {
|
||||
node: {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
import {t} from 'element-ui/src/locale';
|
||||
|
||||
export default {
|
||||
name: 'el-tree',
|
||||
name: 'ElTree',
|
||||
|
||||
props: {
|
||||
data: {
|
||||
|
|
|
@ -8,7 +8,7 @@ function noop() {
|
|||
}
|
||||
|
||||
export default {
|
||||
name: 'el-upload',
|
||||
name: 'ElUpload',
|
||||
|
||||
components: {
|
||||
ElProgress,
|
||||
|
|
|
@ -141,7 +141,7 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|||
};
|
||||
|
||||
module.exports = {
|
||||
version: '1.1.1',
|
||||
version: '1.1.2',
|
||||
locale: locale.use,
|
||||
install,
|
||||
Loading,
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
import { createTest, createVue, destroyVM, triggerEvent } from '../util';
|
||||
import {
|
||||
createTest,
|
||||
createVue,
|
||||
destroyVM,
|
||||
triggerEvent
|
||||
} from '../util';
|
||||
import DatePicker from 'packages/date-picker';
|
||||
|
||||
const DELAY = 10;
|
||||
|
@ -27,7 +32,9 @@ describe('DatePicker', () => {
|
|||
<el-date-picker ref="compo" v-model="value"></el-date-picker>
|
||||
`,
|
||||
data() {
|
||||
return { value: '' };
|
||||
return {
|
||||
value: ''
|
||||
};
|
||||
}
|
||||
}, true);
|
||||
const input = vm.$el.querySelector('input');
|
||||
|
@ -50,13 +57,13 @@ describe('DatePicker', () => {
|
|||
arrowLeftElm.click();
|
||||
}
|
||||
|
||||
count = 18;
|
||||
count = 20;
|
||||
while (--count) {
|
||||
arrowRightElm.click();
|
||||
}
|
||||
setTimeout(_ => {
|
||||
expect(spans[0].textContent).to.include(date.getFullYear() - 1);
|
||||
expect(spans[1].textContent).to.include(date.getMonth() - 1);
|
||||
expect(spans[1].textContent).to.include(date.getMonth() + 1);
|
||||
$el.querySelector('td.available').click();
|
||||
vm.$nextTick(_ => {
|
||||
expect(vm.value).to.exist;
|
||||
|
@ -72,7 +79,9 @@ describe('DatePicker', () => {
|
|||
<el-date-picker v-model="value" ref="compo"></el-date-picker>
|
||||
`,
|
||||
data() {
|
||||
return { value: '' };
|
||||
return {
|
||||
value: ''
|
||||
};
|
||||
}
|
||||
}, true);
|
||||
const input = vm.$el.querySelector('input');
|
||||
|
@ -97,7 +106,9 @@ describe('DatePicker', () => {
|
|||
<el-date-picker v-model="value" ref="compo" :clearable="false"></el-date-picker>
|
||||
`,
|
||||
data() {
|
||||
return { value: '' };
|
||||
return {
|
||||
value: ''
|
||||
};
|
||||
}
|
||||
}, true);
|
||||
const input = vm.$el.querySelector('input');
|
||||
|
@ -122,7 +133,9 @@ describe('DatePicker', () => {
|
|||
<el-date-picker ref="compo" v-model="value"></el-date-picker>
|
||||
`,
|
||||
data() {
|
||||
return { value: '' };
|
||||
return {
|
||||
value: ''
|
||||
};
|
||||
}
|
||||
}, true);
|
||||
const input = vm.$el.querySelector('input');
|
||||
|
@ -163,7 +176,9 @@ describe('DatePicker', () => {
|
|||
},
|
||||
|
||||
data() {
|
||||
return { value: '' };
|
||||
return {
|
||||
value: ''
|
||||
};
|
||||
}
|
||||
}, true);
|
||||
|
||||
|
@ -178,8 +193,10 @@ describe('DatePicker', () => {
|
|||
picker.$el.querySelector('td.available').click();
|
||||
vm.$nextTick(_ => {
|
||||
const date = picker.date;
|
||||
let month = date.getMonth() + 1;
|
||||
if (month < 10) month = '0' + month;
|
||||
|
||||
expect(inputValue).to.equal(`${date.getFullYear()}-${date.getMonth() + 1 }`);
|
||||
expect(inputValue).to.equal(`${date.getFullYear()}-${ month }`);
|
||||
done();
|
||||
});
|
||||
}, DELAY);
|
||||
|
@ -442,7 +459,10 @@ describe('DatePicker', () => {
|
|||
setTimeout(_ => {
|
||||
panels[1].querySelector('td.available').click();
|
||||
|
||||
const { minDate, maxDate } = vm.picker;
|
||||
const {
|
||||
minDate,
|
||||
maxDate
|
||||
} = vm.picker;
|
||||
expect(minDate).to.exist;
|
||||
expect(maxDate).to.exist;
|
||||
expect(maxDate > minDate).to.true;
|
||||
|
@ -534,7 +554,10 @@ describe('DatePicker', () => {
|
|||
triggerEvent(rightCell, 'click', true);
|
||||
|
||||
setTimeout(_ => {
|
||||
const { minDate, maxDate } = vm.picker;
|
||||
const {
|
||||
minDate,
|
||||
maxDate
|
||||
} = vm.picker;
|
||||
const minMonth = minDate.getMonth();
|
||||
const maxMonth = maxDate.getMonth();
|
||||
|
||||
|
@ -698,9 +721,10 @@ describe('DatePicker', () => {
|
|||
const prevMonthLen = vm.picker.$el.querySelectorAll('.prev-month').length;
|
||||
const firstWeek = vm.picker.$el.querySelector('tr th');
|
||||
const offset = i > 3 ? 7 - i : -i;
|
||||
const day = FirstDayOfCurrentMonth === 0 ? 7 : FirstDayOfCurrentMonth;
|
||||
|
||||
expect(firstWeek.innerText).to.equal(chineseWeek[i - 1]);
|
||||
expect(prevMonthLen - FirstDayOfCurrentMonth).to.equal(offset);
|
||||
expect(prevMonthLen - day).to.equal(offset);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -712,15 +736,13 @@ describe('DatePicker', () => {
|
|||
let test;
|
||||
vm = createTest(DatePicker, {
|
||||
pickerOptions: {
|
||||
shortcuts: [
|
||||
{
|
||||
text: '今天',
|
||||
onClick(picker) {
|
||||
test = true;
|
||||
picker.$emit('pick', new Date());
|
||||
}
|
||||
shortcuts: [{
|
||||
text: '今天',
|
||||
onClick(picker) {
|
||||
test = true;
|
||||
picker.$emit('pick', new Date());
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
}, true);
|
||||
const input = vm.$el.querySelector('input');
|
||||
|
|
Loading…
Reference in New Issue