From 9ed8daea4b48e25acd788769a109813983ecef41 Mon Sep 17 00:00:00 2001 From: Francisco Solis Date: Wed, 9 Nov 2022 12:02:06 -0300 Subject: [PATCH 1/4] Composition API Support --- src/main.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main.js b/src/main.js index 8b639a7..6b883d2 100644 --- a/src/main.js +++ b/src/main.js @@ -17,6 +17,9 @@ import buildComponent from './components/build-component' import MountableMixin from './utils/mountableMixin' import {Env} from "./utils/env"; let GMapApi = null; +let gmapApiPromiseLazy = null; +let gmapOptions = {} +let defaultResizeBus = null; export { loadGMapApi, @@ -35,6 +38,18 @@ export { MountableMixin, } +export default function useGMapApiPromiseLazy() { + return gmapApiPromiseLazy; +} + +export default function useGMapOptions() { + return gmapOptions; +} + +export default function useGMapDefaultResizeBus() { + return defaultResizeBus +} + export default function install(Vue, options) { options = { installComponents: true, @@ -48,16 +63,17 @@ export default function install(Vue, options) { }, }) - const defaultResizeBus = createApp() + defaultResizeBus = createApp() // Use a lazy to only load the API when // a VGM component is loaded - let gmapApiPromiseLazy = makeGMapApiPromiseLazy(options) + gmapApiPromiseLazy = makeGMapApiPromiseLazy(options); + gmapOptions = options; Vue.mixin({ created() { this.$gmapDefaultResizeBus = defaultResizeBus - this.$gmapOptions = options + this.$gmapOptions = gmapOptions this.$gmapApiPromiseLazy = gmapApiPromiseLazy }, }) From 4bcacc1e2afc4d08476935e582461b96193bd7b0 Mon Sep 17 00:00:00 2001 From: Francisco Solis Date: Mon, 14 Nov 2022 10:24:04 -0300 Subject: [PATCH 2/4] Fix AutoComplete Component --- src/components/autocomplete.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/autocomplete.vue b/src/components/autocomplete.vue index 7ee1279..bff3e1a 100644 --- a/src/components/autocomplete.vue +++ b/src/components/autocomplete.vue @@ -57,7 +57,7 @@ export default { const refName = _this.$slots.input()[0].props.ref; const scopedInput = _this.$slots.input()[0].ref.i.ctx.$refs[refName]; if (scopedInput) { - refInput = scopedInput.$el.getElementsByTagName('input')[0]; + refInput = scopedInput; } } if (this.selectFirstOnEnter) { From 34d2a88127148186922308651d7bd249f9c78364 Mon Sep 17 00:00:00 2001 From: Francisco Solis Date: Mon, 14 Nov 2022 10:35:53 -0300 Subject: [PATCH 3/4] Remove default from function export --- src/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.js b/src/main.js index 6b883d2..8424c45 100644 --- a/src/main.js +++ b/src/main.js @@ -38,15 +38,15 @@ export { MountableMixin, } -export default function useGMapApiPromiseLazy() { +export function useGMapApiPromiseLazy() { return gmapApiPromiseLazy; } -export default function useGMapOptions() { +export function useGMapOptions() { return gmapOptions; } -export default function useGMapDefaultResizeBus() { +export function useGMapDefaultResizeBus() { return defaultResizeBus } From 64e69acf0f4f0c8d58e143df3f333c43dccf8069 Mon Sep 17 00:00:00 2001 From: Francisco Solis Date: Mon, 14 Nov 2022 11:02:53 -0300 Subject: [PATCH 4/4] Look for child inputs --- src/components/autocomplete.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/autocomplete.vue b/src/components/autocomplete.vue index bff3e1a..7b08be4 100644 --- a/src/components/autocomplete.vue +++ b/src/components/autocomplete.vue @@ -58,6 +58,16 @@ export default { const scopedInput = _this.$slots.input()[0].ref.i.ctx.$refs[refName]; if (scopedInput) { refInput = scopedInput; + if(refInput.tagName.toLowerCase() !== 'input'){ + const inputs = refInput.querySelectorAll('input') + if(inputs.length == 0){ + console.error('No input tag found inside ref "'+refName+'"') + } else { + refInput = inputs[0] + } + } + } else { + console.error("Failed to find scopedInput (element with ref='"+refName+"')") } } if (this.selectFirstOnEnter) {