Improve multiselect determintation of pretty labels
This commit is contained in:
parent
6e9c3b7b5d
commit
48a85ae103
|
@ -20,7 +20,10 @@
|
||||||
|
|
||||||
const getFieldText = (value, map, placeholder) => {
|
const getFieldText = (value, map, placeholder) => {
|
||||||
if (value?.length) {
|
if (value?.length) {
|
||||||
const vals = value.map(option => map[option] || "").join(", ")
|
if (!map) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
const vals = value.map(option => map[option] || option).join(", ")
|
||||||
return `(${value.length}) ${vals}`
|
return `(${value.length}) ${vals}`
|
||||||
} else {
|
} else {
|
||||||
return placeholder || "Choose some options"
|
return placeholder || "Choose some options"
|
||||||
|
@ -40,8 +43,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const getOptionLookupMap = options => {
|
const getOptionLookupMap = options => {
|
||||||
let map = {}
|
let map = null
|
||||||
if (options) {
|
if (options?.length) {
|
||||||
|
map = {}
|
||||||
options.forEach(option => {
|
options.forEach(option => {
|
||||||
const optionValue = getOptionValue(option)
|
const optionValue = getOptionValue(option)
|
||||||
if (optionValue != null) {
|
if (optionValue != null) {
|
||||||
|
|
Loading…
Reference in New Issue