Merge remote-tracking branch 'iview/2.0' into 2.0

This commit is contained in:
Роман Ковжогин 2018-12-27 12:21:28 +03:00
commit ce124aeb57
16 changed files with 246 additions and 207 deletions

View file

@ -59,8 +59,8 @@
handleTriggerItem (item, fromInit = false, fromUser = false) {
if (item.disabled) return;
const cascader = findComponentUpward(this, 'Cascader');
if (item.loading !== undefined && !item.children.length) {
const cascader = findComponentUpward(this, 'Cascader');
if (cascader && cascader.loadData) {
cascader.loadData(item, () => {
// todo
@ -110,6 +110,10 @@
fromInit: fromInit
});
}
if (cascader) {
cascader.$refs.drop.update();
}
},
updateResult (item) {
this.result = [this.tmpItem].concat(item);

View file

@ -30,6 +30,9 @@
@keydown="handleKeydown"
@focus="handleFocus"
@blur="handleBlur"
@compositionstart="handleComposition"
@compositionupdate="handleComposition"
@compositionend="handleComposition"
@input="handleInput"
@change="handleChange">
<div :class="[prefixCls + '-group-append']" v-if="append" v-show="slotReady"><slot name="append"></slot></div>
@ -62,6 +65,9 @@
@keydown="handleKeydown"
@focus="handleFocus"
@blur="handleBlur"
@compositionstart="handleComposition"
@compositionupdate="handleComposition"
@compositionend="handleComposition"
@input="handleInput">
</textarea>
</div>
@ -179,7 +185,8 @@
slotReady: false,
textareaStyles: {},
showPrefix: false,
showSuffix: false
showSuffix: false,
isOnComposition: false
};
},
computed: {
@ -244,7 +251,18 @@
this.dispatch('FormItem', 'on-form-blur', this.currentValue);
}
},
handleComposition(event) {
if (event.type === 'compositionstart') {
this.isOnComposition = true;
}
if (event.type === 'compositionend') {
this.isOnComposition = false;
this.handleInput(event);
}
},
handleInput (event) {
if (this.isOnComposition) return;
let value = event.target.value;
if (this.number && value !== '') value = Number.isNaN(Number(value)) ? value : Number(value);
this.$emit('input', value);

View file

@ -762,21 +762,12 @@
},
slotOptions(options, old){
// #4626 Options label v-model
if (options && options.length && this.values.length && !this.multiple) {
this.values = this.values.map(value => {
const option = options.find(option => {
if (!option.componentOptions) return false;
return option.componentOptions.propsData.value === value.value;
});
if(!option) return null;
const label = getOptionLabel(option);
return {
value: value.value,
label: label
};
}).filter(Boolean);
// remote getInitialValue bug
if (!this.remote) {
const values = this.getInitialValue();
if (this.flatOptions && this.flatOptions.length && values.length && !this.multiple) {
this.values = values.map(this.getOptionData).filter(Boolean);
}
}
// dropdown

View file

@ -112,6 +112,10 @@
&[disabled] {
.disabled();
}
&::placeholder {
color: @input-placeholder-color;
}
}
&-large {

View file

@ -205,9 +205,21 @@
height: 24px;
line-height: 22px;
margin: 3px 4px 3px 0;
//i{
// top: 2px;
//}
max-width: 99%;
position: relative;
span{
display: block;
margin-right: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
i{
display: block;
position: absolute;
right: 4px;
top: 4px;
}
}
&-large&-multiple .@{css-prefix}tag{
@ -215,7 +227,7 @@
line-height: 26px;
font-size: @font-size-base;
i{
top: 1px;
top: 6px;
}
}
@ -225,8 +237,12 @@
font-size: @font-size-small;
padding: 0 6px;
margin: 3px 4px 2px 0;
span{
margin-right: 14px;
}
i{
top: 1px;
right: 2px;
}
}

View file

@ -6,12 +6,21 @@
margin: 0;
padding: 0;
font-size: @font-size-small;
&.@{dropdown-prefix-cls}-menu{
padding: 0;
}
li{
list-style: none;
margin: 8px 0;
padding: 0;
white-space: nowrap;
outline: none;
&.@{dropdown-item-prefix-cls}{
margin: 0;
padding: 7px 16px;
white-space: nowrap;
}
}
}
li{