From 497872eb845467f735ef5403b63c0d0ff62e7b92 Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Thu, 30 Dec 2021 14:30:46 +0530 Subject: [PATCH] feat: allow aribitrary values in AutoComplete - pass doc to getList --- src/components/Controls/AutoComplete.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/Controls/AutoComplete.vue b/src/components/Controls/AutoComplete.vue index f7926223..671cc81e 100644 --- a/src/components/Controls/AutoComplete.vue +++ b/src/components/Controls/AutoComplete.vue @@ -59,6 +59,9 @@ export default { }, }, }, + inject: { + doc: { default: null }, + }, computed: {}, methods: { async updateSuggestions(e) { @@ -81,7 +84,7 @@ export default { keyword = keyword.toLowerCase(); let list = this.df.getList - ? await this.df.getList() + ? await this.df.getList(this.doc) : this.df.options || []; let items = list.map((d) => { @@ -118,6 +121,12 @@ export default { async onBlur(value) { if (value === '' || value == null) { this.triggerChange(''); + return; + } + + if (value && this.suggestions.length === 0) { + this.triggerChange(value); + return; } if (