Refactor
parent
5309386739
commit
dcaec67475
|
@ -783,6 +783,16 @@ export default {
|
|||
this.$emit('update:modelValue', value);
|
||||
this.$emit('change', { originalEvent: event, value });
|
||||
},
|
||||
flatOptions(options = []) {
|
||||
return options.reduce((result, option, index) => {
|
||||
result.push({ optionGroup: option, group: true, index });
|
||||
|
||||
const optionGroupChildren = this.getOptionGroupChildren(option);
|
||||
optionGroupChildren && optionGroupChildren.forEach(o => result.push(o));
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
},
|
||||
overlayRef(el) {
|
||||
this.overlay = el;
|
||||
},
|
||||
|
@ -824,20 +834,7 @@ export default {
|
|||
return ['p-autocomplete-loader pi-spin', this.loadingIcon];
|
||||
},
|
||||
visibleOptions() {
|
||||
let options = this.suggestions || [];
|
||||
|
||||
if (this.optionGroupLabel) {
|
||||
options = options.reduce((result, option, index) => {
|
||||
result.push({ optionGroup: option, group: true, index });
|
||||
|
||||
let optionGroupChildren = this.getOptionGroupChildren(option);
|
||||
optionGroupChildren && optionGroupChildren.forEach(o => result.push(o));
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
}
|
||||
|
||||
return options;
|
||||
return this.optionGroupLabel ? this.flatOptions(this.suggestions) : (this.suggestions || []);
|
||||
},
|
||||
inputValue() {
|
||||
if (this.modelValue) {
|
||||
|
|
|
@ -771,6 +771,16 @@ export default {
|
|||
this.$emit('update:modelValue', value);
|
||||
this.$emit('change', { originalEvent: event, value });
|
||||
},
|
||||
flatOptions(options = []) {
|
||||
return options.reduce((result, option, index) => {
|
||||
result.push({ optionGroup: option, group: true, index });
|
||||
|
||||
const optionGroupChildren = this.getOptionGroupChildren(option);
|
||||
optionGroupChildren && optionGroupChildren.forEach(o => result.push(o));
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
},
|
||||
overlayRef(el) {
|
||||
this.overlay = el;
|
||||
},
|
||||
|
@ -809,18 +819,7 @@ export default {
|
|||
return ['p-dropdown-trigger-icon', (this.loading ? this.loadingIcon : 'pi pi-chevron-down')];
|
||||
},
|
||||
visibleOptions() {
|
||||
let options = this.options || [];
|
||||
|
||||
if (this.optionGroupLabel) {
|
||||
options = options.reduce((result, option, index) => {
|
||||
result.push({ optionGroup: option, group: true, index });
|
||||
|
||||
let optionGroupChildren = this.getOptionGroupChildren(option);
|
||||
optionGroupChildren && optionGroupChildren.forEach(o => result.push(o));
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
}
|
||||
const options = this.optionGroupLabel ? this.flatOptions(this.options) : (this.options || []);
|
||||
|
||||
return this.filterValue ? FilterService.filter(options, this.searchFields, this.filterValue, this.filterMatchMode, this.filterLocale) : options;
|
||||
},
|
||||
|
|
|
@ -621,6 +621,16 @@ export default {
|
|||
this.$emit('update:modelValue', value);
|
||||
this.$emit('change', { originalEvent: event, value });
|
||||
},
|
||||
flatOptions(options = []) {
|
||||
return options.reduce((result, option, index) => {
|
||||
result.push({ optionGroup: option, group: true, index });
|
||||
|
||||
const optionGroupChildren = this.getOptionGroupChildren(option);
|
||||
optionGroupChildren && optionGroupChildren.forEach(o => result.push(o));
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
},
|
||||
listRef(el, contentRef) {
|
||||
this.list = el;
|
||||
contentRef && contentRef(el); // For VirtualScroller
|
||||
|
@ -637,18 +647,7 @@ export default {
|
|||
}];
|
||||
},
|
||||
visibleOptions() {
|
||||
let options = this.options || [];
|
||||
|
||||
if (this.optionGroupLabel) {
|
||||
options = options.reduce((result, option, index) => {
|
||||
result.push({ optionGroup: option, group: true, index });
|
||||
|
||||
let optionGroupChildren = this.getOptionGroupChildren(option);
|
||||
optionGroupChildren && optionGroupChildren.forEach(o => result.push(o));
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
}
|
||||
const options = this.optionGroupLabel ? this.flatOptions(this.options) : (this.options || []);
|
||||
|
||||
return this.filterValue ? FilterService.filter(options, this.searchFields, this.filterValue, this.filterMatchMode, this.filterLocale) : options;
|
||||
},
|
||||
|
|
|
@ -901,6 +901,16 @@ export default {
|
|||
this.$emit('update:modelValue', value);
|
||||
this.$emit('change', { originalEvent: event, value });
|
||||
},
|
||||
flatOptions(options = []) {
|
||||
return options.reduce((result, option, index) => {
|
||||
result.push({ optionGroup: option, group: true, index });
|
||||
|
||||
const optionGroupChildren = this.getOptionGroupChildren(option);
|
||||
optionGroupChildren && optionGroupChildren.forEach(o => result.push(o));
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
},
|
||||
overlayRef(el) {
|
||||
this.overlay = el;
|
||||
},
|
||||
|
@ -939,18 +949,7 @@ export default {
|
|||
}];
|
||||
},
|
||||
visibleOptions() {
|
||||
let options = this.options || [];
|
||||
|
||||
if (this.optionGroupLabel) {
|
||||
options = options.reduce((result, option, index) => {
|
||||
result.push({ optionGroup: option, group: true, index });
|
||||
|
||||
let optionGroupChildren = this.getOptionGroupChildren(option);
|
||||
optionGroupChildren && optionGroupChildren.forEach(o => result.push(o));
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
}
|
||||
const options = this.optionGroupLabel ? this.flatOptions(this.options) : (this.options || []);
|
||||
|
||||
return this.filterValue ? FilterService.filter(options, this.searchFields, this.filterValue, this.filterMatchMode, this.filterLocale) : options;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue