Skip to content

Commit 30bf6a4

Browse files
committed
fix(protosearch): honor multiselect+custom_values for chip search fields
1 parent ae37aec commit 30bf6a4

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

src/app/components/widgets/protosearch-widget/protosearch-widget.component.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ interface SearchFieldItem {
4747
selector?: Array<any>;
4848
type: string;
4949
value?: string;
50+
/** Copied from mapping fields_mapping when present (multiselect + free-text). */
51+
custom_values?: boolean;
5052
}
5153

5254
@Component({
@@ -675,6 +677,14 @@ export class ProtosearchWidgetComponent implements IWidget, OnInit, OnDestroy, A
675677

676678
return 'input-multi-select-with-chips';
677679
}
680+
// multiselect in mapping + custom_values → same chip UI as input_multi_select (mat-select multiple has no custom tag).
681+
if (
682+
item.form_type === 'multiselect' &&
683+
item.form_default &&
684+
(item.custom_values || item.__mapping?.custom_values)
685+
) {
686+
return 'input-multi-select-with-chips';
687+
}
678688
if (item.type === 'array_string' && !this.isMulti(item.field_name) && !this.isAliasField(item.field_name)) {
679689
return 'chip-list-array-string';
680690
}
@@ -751,6 +761,12 @@ export class ProtosearchWidgetComponent implements IWidget, OnInit, OnDestroy, A
751761

752762
i.__mapping = f;
753763

764+
if (f && 'custom_values' in f) {
765+
i.custom_values = !!(f as { custom_values?: boolean }).custom_values;
766+
} else {
767+
delete i.custom_values;
768+
}
769+
754770
if (f?.type) {
755771
i.type = f.type;
756772
}

src/app/models/preference-mapping-field.model.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ export interface PreferenceMappingFieldModel {
3131
vdata?:string;
3232
grid?:string;
3333
transform?:string;
34+
/** When form_type is multiselect, use chip widget with free-text entries (Homer UI). */
35+
custom_values?: boolean;
3436
}

0 commit comments

Comments
 (0)