From c75422091f53b17b7737124d5e9eeba674fa2a33 Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Tue, 31 Oct 2023 12:56:12 +1100 Subject: [PATCH] refactor(@dpc-sdp/ripple-ui-core): :recycle: rework as function props --- .../components/search-bar/RplSearchBar.vue | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/packages/ripple-ui-core/src/components/search-bar/RplSearchBar.vue b/packages/ripple-ui-core/src/components/search-bar/RplSearchBar.vue index c4198a2242..889e338d08 100644 --- a/packages/ripple-ui-core/src/components/search-bar/RplSearchBar.vue +++ b/packages/ripple-ui-core/src/components/search-bar/RplSearchBar.vue @@ -25,6 +25,8 @@ interface Props { placeholder?: string globalEvents?: boolean showNoResults?: boolean + getOptionLabel?: Function + isOptionSelectable?: Function } const props = withDefaults(defineProps(), { @@ -37,7 +39,9 @@ const props = withDefaults(defineProps(), { suggestions: () => [], maxSuggestionsDisplayed: 10, placeholder: undefined, - globalEvents: true + globalEvents: true, + getOptionLabel: (opt) => opt.toString(), + isOptionSelectable: (opt) => true }) const emit = defineEmits<{ @@ -289,38 +293,35 @@ const slug = (label: string) => label.toLowerCase().replace(/[^\w-]+/g, '-') >
- {{ option.label || option }} + {{ getOptionLabel(option) }}