@fluid-topics/ftds-combobox 2.1.22 → 2.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ftds-combobox.d.ts +1 -0
- package/build/ftds-combobox.js +18 -2
- package/build/ftds-combobox.light.js +52 -52
- package/build/ftds-combobox.min.js +83 -83
- package/package.json +11 -11
package/build/ftds-combobox.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class FtdsCombobox extends FtdsBaseCombobox<string> implements Ft
|
|
|
14
14
|
private commit;
|
|
15
15
|
resetCombobox(): void;
|
|
16
16
|
protected updated(changedProperties: PropertyValues): void;
|
|
17
|
+
private computeNewSuggestionFromProvider;
|
|
17
18
|
isSuggestionSelected(value: string): boolean;
|
|
18
19
|
onType(e: Event): Promise<void>;
|
|
19
20
|
render(): TemplateResult;
|
package/build/ftds-combobox.js
CHANGED
|
@@ -58,12 +58,28 @@ export class FtdsCombobox extends FtdsBaseCombobox {
|
|
|
58
58
|
super.updated(changedProperties);
|
|
59
59
|
if (changedProperties.has("value")) {
|
|
60
60
|
const previous = (_a = (changedProperties.get("value"))) !== null && _a !== void 0 ? _a : "";
|
|
61
|
-
const hasValueChanged = this.value !== previous && !this.isOpen && this.inputValue ===
|
|
61
|
+
const hasValueChanged = this.value !== previous && !this.isOpen && this.inputValue === this.previousCommittedLabel;
|
|
62
62
|
if (hasValueChanged) {
|
|
63
|
-
this.
|
|
63
|
+
this.computeNewSuggestionFromProvider(this.value)
|
|
64
|
+
.then((suggestion) => {
|
|
65
|
+
this.value = suggestion.value;
|
|
66
|
+
this.inputValue = suggestion.label;
|
|
67
|
+
this.previousCommittedLabel = suggestion.label;
|
|
68
|
+
});
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
}
|
|
72
|
+
async computeNewSuggestionFromProvider(value) {
|
|
73
|
+
const suggestions = await this.suggestionsProvider(value);
|
|
74
|
+
const matchingSuggestion = suggestions.find((s) => s.value === value);
|
|
75
|
+
if (matchingSuggestion) {
|
|
76
|
+
return matchingSuggestion;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
value: this.canOfferNewValue ? value : "",
|
|
80
|
+
label: this.canOfferNewValue ? value : "",
|
|
81
|
+
};
|
|
82
|
+
}
|
|
67
83
|
isSuggestionSelected(value) {
|
|
68
84
|
return value === this.value;
|
|
69
85
|
}
|