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 1/7] 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 ( From bc39a265903990a9b36c7e8f627e7c6cc09cb7bb Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Thu, 30 Dec 2021 14:43:28 +0530 Subject: [PATCH 2/7] fix: popover issues, deprecate portal-vue --- package.json | 1 - src/App.vue | 1 - src/components/Popover.vue | 52 ++++++++++++++++++-------------------- src/main.js | 2 -- yarn.lock | 5 ---- 5 files changed, 25 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index b3c0df35..1b8e51a6 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "knex": "^0.95.12", "lodash": "^4.17.21", "luxon": "^2.0.2", - "portal-vue": "^2.1.7", "sqlite3": "^5.0.2", "vue": "^2.6.14", "vue-router": "^3.5.3" diff --git a/src/App.vue b/src/App.vue index 25f1842b..67feed74 100644 --- a/src/App.vue +++ b/src/App.vue @@ -18,7 +18,6 @@ @setup-complete="showSetupWizardOrDesk(true)" @setup-canceled="setupCanceled" /> -
diff --git a/src/components/Popover.vue b/src/components/Popover.vue index 0fee8124..9e7da5dc 100644 --- a/src/components/Popover.vue +++ b/src/components/Popover.vue @@ -3,17 +3,15 @@
- -
-
- -
-
+
+
+ +
@@ -25,17 +23,17 @@ export default { props: { hideArrow: { type: Boolean, - default: false + default: false, }, showPopup: { - default: null + default: null, }, right: Boolean, placement: { type: String, - default: 'bottom-start' + default: 'bottom-start', }, - popoverClass: [String, Object, Array] + popoverClass: [String, Object, Array], }, watch: { showPopup(value) { @@ -45,18 +43,18 @@ export default { if (value === false) { this.close(); } - } + }, }, data() { return { - isOpen: false + isOpen: false, }; }, mounted() { - let listener = e => { + let listener = (e) => { let $els = [this.$refs.reference, this.$refs.popover]; let insideClick = $els.some( - $el => $el && (e.target === $el || $el.contains(e.target)) + ($el) => $el && (e.target === $el || $el.contains(e.target)) ); if (insideClick) { return; @@ -83,17 +81,17 @@ export default { { name: 'arrow', options: { - element: this.$refs['popover-arrow'] - } + element: this.$refs['popover-arrow'], + }, }, { name: 'offset', options: { - offset: [0, 10] - } - } + offset: [0, 10], + }, + }, ] - : [] + : [], }); } else { this.popper.update(); @@ -126,8 +124,8 @@ export default { } this.isOpen = false; this.$emit('close'); - } - } + }, + }, };