Fixed #5140 - Search with `null`/`undefined` values breaks rendering
parent
2501fc91b7
commit
ea75e45b3f
|
@ -772,7 +772,7 @@ export default {
|
||||||
return this.$refs.dropdownButton ? event.target === this.$refs.dropdownButton || this.$refs.dropdownButton.$el.contains(event.target) : false;
|
return this.$refs.dropdownButton ? event.target === this.$refs.dropdownButton || this.$refs.dropdownButton.$el.contains(event.target) : false;
|
||||||
},
|
},
|
||||||
isOptionMatched(option, value) {
|
isOptionMatched(option, value) {
|
||||||
return this.isValidOption(option) && this.getOptionLabel(option).toLocaleLowerCase(this.searchLocale) === value.toLocaleLowerCase(this.searchLocale);
|
return this.isValidOption(option) && this.getOptionLabel(option)?.toLocaleLowerCase(this.searchLocale) === value.toLocaleLowerCase(this.searchLocale);
|
||||||
},
|
},
|
||||||
isValidOption(option) {
|
isValidOption(option) {
|
||||||
return ObjectUtils.isNotEmpty(option) && !(this.isOptionDisabled(option) || this.isOptionGroup(option));
|
return ObjectUtils.isNotEmpty(option) && !(this.isOptionDisabled(option) || this.isOptionGroup(option));
|
||||||
|
|
|
@ -543,7 +543,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isOptionMatched(processedOption) {
|
isOptionMatched(processedOption) {
|
||||||
return this.isValidOption(processedOption) && this.getProccessedOptionLabel(processedOption).toLocaleLowerCase(this.searchLocale).startsWith(this.searchValue.toLocaleLowerCase(this.searchLocale));
|
return this.isValidOption(processedOption) && this.getProccessedOptionLabel(processedOption)?.toLocaleLowerCase(this.searchLocale).startsWith(this.searchValue.toLocaleLowerCase(this.searchLocale));
|
||||||
},
|
},
|
||||||
isValidOption(processedOption) {
|
isValidOption(processedOption) {
|
||||||
return ObjectUtils.isNotEmpty(processedOption) && !this.isOptionDisabled(processedOption.option);
|
return ObjectUtils.isNotEmpty(processedOption) && !this.isOptionDisabled(processedOption.option);
|
||||||
|
|
|
@ -450,7 +450,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isItemMatched(processedItem) {
|
isItemMatched(processedItem) {
|
||||||
return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase());
|
return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem)?.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase());
|
||||||
},
|
},
|
||||||
isValidItem(processedItem) {
|
isValidItem(processedItem) {
|
||||||
return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item);
|
return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item);
|
||||||
|
|
|
@ -760,7 +760,7 @@ export default {
|
||||||
return DomHandler.getFocusableElements(this.overlay, ':not([data-p-hidden-focusable="true"])').length > 0;
|
return DomHandler.getFocusableElements(this.overlay, ':not([data-p-hidden-focusable="true"])').length > 0;
|
||||||
},
|
},
|
||||||
isOptionMatched(option) {
|
isOptionMatched(option) {
|
||||||
return this.isValidOption(option) && this.getOptionLabel(option).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale));
|
return this.isValidOption(option) && this.getOptionLabel(option)?.toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale));
|
||||||
},
|
},
|
||||||
isValidOption(option) {
|
isValidOption(option) {
|
||||||
return ObjectUtils.isNotEmpty(option) && !(this.isOptionDisabled(option) || this.isOptionGroup(option));
|
return ObjectUtils.isNotEmpty(option) && !(this.isOptionDisabled(option) || this.isOptionGroup(option));
|
||||||
|
|
|
@ -509,7 +509,7 @@ export default {
|
||||||
this.startRangeIndex = this.focusedOptionIndex;
|
this.startRangeIndex = this.focusedOptionIndex;
|
||||||
},
|
},
|
||||||
isOptionMatched(option) {
|
isOptionMatched(option) {
|
||||||
return this.isValidOption(option) && this.getOptionLabel(option).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale));
|
return this.isValidOption(option) && this.getOptionLabel(option)?.toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale));
|
||||||
},
|
},
|
||||||
isValidOption(option) {
|
isValidOption(option) {
|
||||||
return ObjectUtils.isNotEmpty(option) && !(this.isOptionDisabled(option) || this.isOptionGroup(option));
|
return ObjectUtils.isNotEmpty(option) && !(this.isOptionDisabled(option) || this.isOptionGroup(option));
|
||||||
|
|
|
@ -511,7 +511,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isItemMatched(processedItem) {
|
isItemMatched(processedItem) {
|
||||||
return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase());
|
return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem)?.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase());
|
||||||
},
|
},
|
||||||
isValidItem(processedItem) {
|
isValidItem(processedItem) {
|
||||||
return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item);
|
return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item);
|
||||||
|
|
|
@ -484,7 +484,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isItemMatched(processedItem) {
|
isItemMatched(processedItem) {
|
||||||
return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase());
|
return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem)?.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase());
|
||||||
},
|
},
|
||||||
isValidItem(processedItem) {
|
isValidItem(processedItem) {
|
||||||
return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item);
|
return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item);
|
||||||
|
|
|
@ -811,7 +811,7 @@ export default {
|
||||||
return DomHandler.getFocusableElements(this.overlay, ':not([data-p-hidden-focusable="true"])').length > 0;
|
return DomHandler.getFocusableElements(this.overlay, ':not([data-p-hidden-focusable="true"])').length > 0;
|
||||||
},
|
},
|
||||||
isOptionMatched(option) {
|
isOptionMatched(option) {
|
||||||
return this.isValidOption(option) && this.getOptionLabel(option).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale));
|
return this.isValidOption(option) && this.getOptionLabel(option)?.toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale));
|
||||||
},
|
},
|
||||||
isValidOption(option) {
|
isValidOption(option) {
|
||||||
return ObjectUtils.isNotEmpty(option) && !(this.isOptionDisabled(option) || this.isOptionGroup(option));
|
return ObjectUtils.isNotEmpty(option) && !(this.isOptionDisabled(option) || this.isOptionGroup(option));
|
||||||
|
|
|
@ -231,7 +231,7 @@ export default {
|
||||||
return panel && panel.contains(element);
|
return panel && panel.contains(element);
|
||||||
},
|
},
|
||||||
isItemMatched(processedItem) {
|
isItemMatched(processedItem) {
|
||||||
return this.isValidItem(processedItem) && this.getItemLabel(processedItem).toLocaleLowerCase(this.searchLocale).startsWith(this.searchValue.toLocaleLowerCase(this.searchLocale));
|
return this.isValidItem(processedItem) && this.getItemLabel(processedItem)?.toLocaleLowerCase(this.searchLocale).startsWith(this.searchValue.toLocaleLowerCase(this.searchLocale));
|
||||||
},
|
},
|
||||||
isVisibleItem(processedItem) {
|
isVisibleItem(processedItem) {
|
||||||
return !!processedItem && (processedItem.level === 0 || this.isItemActive(processedItem)) && this.isItemVisible(processedItem);
|
return !!processedItem && (processedItem.level === 0 || this.isItemActive(processedItem)) && this.isItemVisible(processedItem);
|
||||||
|
|
|
@ -479,7 +479,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isItemMatched(processedItem) {
|
isItemMatched(processedItem) {
|
||||||
return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase());
|
return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem)?.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase());
|
||||||
},
|
},
|
||||||
isValidItem(processedItem) {
|
isValidItem(processedItem) {
|
||||||
return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item);
|
return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item);
|
||||||
|
|
Loading…
Reference in New Issue