Skip to content

Commit d7631c0

Browse files
jcabannesZorin95670
authored andcommitted
feat(catalog-ui): add optionLabel prop to list field for customizable UI options labels
1 parent b15357d commit d7631c0

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

apps/catalog-ui/docs/components/field/EntityAttributeListField.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ export interface FieldListValue {
7171
}
7272

7373
export interface FieldListSettings extends FieldSettings {
74+
/**
75+
* Optional key used to display a label for the field in the UI.
76+
* If omitted, the field's `value` property will be used as the label.
77+
*/
78+
optionLabel?: string;
79+
7480
/**
7581
* List of possible values for the field.
7682
* Use `string[]` for a flat list with no filtering.

apps/catalog-ui/src/components/field/EntityAttributeListField.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
:suffix="translateOrDefault('', 'suffix')"
3939
:options="options"
4040
option-value="value"
41-
option-label="value"
41+
:option-label="optionLabel"
4242
emit-value
4343
map-options
4444
:rules="rules"
@@ -84,6 +84,8 @@ const normalizedValues: FieldListValue[] = (() => {
8484
return values as FieldListValue[];
8585
})();
8686
87+
const optionLabel = props.definition.inputSettings?.optionLabel ?? 'value';
88+
8789
const defaultValue =
8890
props.definition.inputSettings?.defaultValue &&
8991
normalizedValues.some(

0 commit comments

Comments
 (0)