Merge pull request #16035 from calixteman/fix_combo_value
[Annotation] A combo can have a value other than one in the options
This commit is contained in:
commit
0fca6e187c
@ -1981,15 +1981,14 @@ class WidgetAnnotation extends Annotation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert(typeof value === "string", "Expected `value` to be a string.");
|
assert(typeof value === "string", "Expected `value` to be a string.");
|
||||||
|
value = value.trim();
|
||||||
|
|
||||||
if (!this.data.combo) {
|
if (this.data.combo) {
|
||||||
value = value.trim();
|
// The value can be one of the exportValue or any other values.
|
||||||
} else {
|
const option = this.data.options.find(
|
||||||
// The value is supposed to be one of the exportValue.
|
({ exportValue }) => value === exportValue
|
||||||
const option =
|
);
|
||||||
this.data.options.find(({ exportValue }) => value === exportValue) ||
|
value = (option && option.displayValue) || value;
|
||||||
this.data.options[0];
|
|
||||||
value = (option && option.displayValue) || "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value === "") {
|
if (value === "") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user