UNPKG

@aplus-frontend/ui

Version:

15 lines (14 loc) 522 B
import { isNil as r, isArray as u } from "lodash-unified"; import { valueEnumToArray as f } from "../../ap-table/utils.mjs"; function d(e) { const l = e.valueEnum ? f(e.valueEnum) : e.options || [], t = e.value, a = e.emptyText || "--"; if (r(t)) return a; const i = e.fieldNames?.label || "label", m = e.fieldNames?.value || "value"; return u(t) ? t.map( (n) => l.find((o) => o[m] === n)?.[i] ).filter(Boolean).join("、") || a : l.find((n) => n[m] === t)?.[i] || a; } export { d as selectRenderer };