save
This commit is contained in:
parent
8f9d3604e6
commit
5bb83ff8e5
258 changed files with 12974 additions and 7838 deletions
|
@ -7,7 +7,7 @@
|
|||
:element-id="elementId"
|
||||
ref="input"
|
||||
:readonly="!filterable"
|
||||
:disabled="disabled"
|
||||
:disabled="itemDisabled"
|
||||
:value="displayInputRender"
|
||||
@on-change="handleInput"
|
||||
:size="size"
|
||||
|
@ -23,7 +23,7 @@
|
|||
<transition name="transition-drop">
|
||||
<Drop
|
||||
v-show="visible"
|
||||
:class="{ [prefixCls + '-transfer']: transfer }"
|
||||
:class="dropdownCls"
|
||||
ref="drop"
|
||||
:data-transfer="transfer"
|
||||
:transfer="transfer"
|
||||
|
@ -34,7 +34,7 @@
|
|||
ref="caspanel"
|
||||
:prefix-cls="prefixCls"
|
||||
:data="data"
|
||||
:disabled="disabled"
|
||||
:disabled="itemDisabled"
|
||||
:change-on-select="changeOnSelect"
|
||||
:trigger="trigger"></Caspanel>
|
||||
<div :class="[prefixCls + '-dropdown']" v-show="filterable && query !== '' && querySelections.length">
|
||||
|
@ -44,7 +44,6 @@
|
|||
[selectPrefixCls + '-item-disabled']: item.disabled
|
||||
}]"
|
||||
v-for="(item, index) in querySelections"
|
||||
:key="index"
|
||||
@click="handleSelectItem(index)" v-html="item.display"></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -59,18 +58,19 @@
|
|||
import Drop from '../select/dropdown.vue';
|
||||
import Icon from '../icon/icon.vue';
|
||||
import Caspanel from './caspanel.vue';
|
||||
import {directive as clickOutside} from 'v-click-outside-x';
|
||||
import clickOutside from '../../directives/clickoutside';
|
||||
import TransferDom from '../../directives/transfer-dom';
|
||||
import { oneOf } from '../../utils/assist';
|
||||
import Emitter from '../../mixins/emitter';
|
||||
import Locale from '../../mixins/locale';
|
||||
import mixinsForm from '../../mixins/form';
|
||||
|
||||
const prefixCls = 'ivu-cascader';
|
||||
const selectPrefixCls = 'ivu-select';
|
||||
|
||||
export default {
|
||||
name: 'Cascader',
|
||||
mixins: [ Emitter, Locale ],
|
||||
mixins: [ Emitter, Locale, mixinsForm ],
|
||||
components: { iInput, Drop, Icon, Caspanel },
|
||||
directives: { clickOutside, TransferDom },
|
||||
props: {
|
||||
|
@ -142,6 +142,16 @@
|
|||
},
|
||||
elementId: {
|
||||
type: String
|
||||
},
|
||||
// 4.0.0
|
||||
capture: {
|
||||
type: Boolean,
|
||||
default () {
|
||||
return !this.$IVIEW ? true : this.$IVIEW.capture;
|
||||
}
|
||||
},
|
||||
transferClassName: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
@ -166,13 +176,13 @@
|
|||
[`${prefixCls}-show-clear`]: this.showCloseIcon,
|
||||
[`${prefixCls}-size-${this.size}`]: !!this.size,
|
||||
[`${prefixCls}-visible`]: this.visible,
|
||||
[`${prefixCls}-disabled`]: this.disabled,
|
||||
[`${prefixCls}-disabled`]: this.itemDisabled,
|
||||
[`${prefixCls}-not-found`]: this.filterable && this.query !== '' && !this.querySelections.length
|
||||
}
|
||||
];
|
||||
},
|
||||
showCloseIcon () {
|
||||
return this.currentValue && this.currentValue.length && this.clearable && !this.disabled;
|
||||
return this.currentValue && this.currentValue.length && this.clearable && !this.itemDisabled;
|
||||
},
|
||||
displayRender () {
|
||||
let label = [];
|
||||
|
@ -208,7 +218,7 @@
|
|||
for (let i = 0; i < arr.length; i++) {
|
||||
let item = arr[i];
|
||||
item.__label = label ? label + ' / ' + item.label : item.label;
|
||||
item.__value = value ? [...value, item.value] : [item.value];
|
||||
item.__value = value ? value + ',' + item.value : item.value;
|
||||
|
||||
if (item.children && item.children.length) {
|
||||
getSelections(item.children, item.__label, item.__value);
|
||||
|
@ -268,23 +278,29 @@
|
|||
}
|
||||
}
|
||||
return size;
|
||||
},
|
||||
dropdownCls () {
|
||||
return {
|
||||
[prefixCls + '-transfer']: this.transfer,
|
||||
[this.transferClassName]: this.transferClassName
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clearSelect () {
|
||||
if (this.disabled) return false;
|
||||
if (this.itemDisabled) return false;
|
||||
const oldVal = JSON.stringify(this.currentValue);
|
||||
this.currentValue = this.selected = this.tmpSelected = [];
|
||||
this.handleClose();
|
||||
this.emitValue(this.currentValue, oldVal);
|
||||
// this.$broadcast('on-clear');
|
||||
// this.$broadcast('on-clear');
|
||||
this.broadcast('Caspanel', 'on-clear');
|
||||
},
|
||||
handleClose () {
|
||||
this.visible = false;
|
||||
},
|
||||
toggleOpen () {
|
||||
if (this.disabled) return false;
|
||||
if (this.itemDisabled) return false;
|
||||
if (this.visible) {
|
||||
if (!this.filterable) this.handleClose();
|
||||
} else {
|
||||
|
@ -329,7 +345,7 @@
|
|||
this.query = '';
|
||||
this.$refs.input.currentValue = '';
|
||||
const oldVal = JSON.stringify(this.currentValue);
|
||||
this.currentValue = item.value;
|
||||
this.currentValue = item.value.split(',');
|
||||
// use setTimeout for #4786, can not use nextTick, because @on-find-selected use nextTick
|
||||
setTimeout(() => {
|
||||
this.emitValue(this.currentValue, oldVal);
|
||||
|
@ -352,7 +368,7 @@
|
|||
if ('__label' in new_item) {
|
||||
delete new_item.__label;
|
||||
}
|
||||
if (Array.isArray(new_item.children) && new_item.children.length) {
|
||||
if ('children' in new_item && new_item.children.length) {
|
||||
new_item.children = new_item.children.map(i => deleteData(i));
|
||||
}
|
||||
return new_item;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue