PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.1
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.1
3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / compatibility / jet-engine / blocks / map-field / assets / build / frontend / autocomplete.js
jetformbuilder / compatibility / jet-engine / blocks / map-field / assets / build / frontend Last commit date
autocomplete.asset.php 2 months ago autocomplete.css 2 years ago autocomplete.js 2 months ago map.asset.php 2 months ago map.css 2 years ago map.js 2 months ago
autocomplete.js
1 lines
1 (()=>{"use strict";var t={n:e=>{var s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},d:(e,s)=>{for(var o in s)t.o(s,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:s[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=window.wp.apiFetch;var s=t.n(e);const o=window.wp.url,{ReactiveVar:n,LoadingReactiveVar:r}=JetFormBuilderAbstract;function i(t){this.searchNode=t,this.controller=null,this.search=new n(""),this.search.make(),this.search.watch(this.onChangeSearch.bind(this)),this.response=new n(!1),this.response.make(),this.loading=new r,this.loading.make(),this.initEventListeners()}i.prototype.initEventListeners=function(){this.searchNode.addEventListener("input",t=>{this.search.current=t.target.value})},i.prototype.onChangeSearch=function(){if(this.abort(),this.searchNode.value!==this.search.current&&(this.searchNode.value=this.search.current),2>this.search.current?.length)return void this.loading.end();const t=(0,o.addQueryArgs)(JetMapFieldsSettings.apiAutocomplete,{query:this.search.current});this.loading.start(),s()({path:t,signal:this.controller.signal}).then(t=>{this.response.current={success:!!t.success,response:t},this.loading.end()}).catch(t=>{"AbortError"!==t.name&&(this.response.current={success:!1,response:t},this.loading.end())})},i.prototype.abort=function(){this.controller?.abort?.(),this.controller=new AbortController};const a=i,{ReactiveVar:c}=JetFormBuilderAbstract;function h(t){this.listNode=t,this.selected=new c,this.selected.make(),this.initEventListeners()}h.prototype.createItem=function(t){const e=document.createElement("li");return e.textContent=t.label,e.tabIndex=0,e},h.prototype.setItems=function(t){this.listNode.innerHTML="";const e=t.map(this.createItem.bind(this));this.listNode.append(...e)},h.prototype.showList=function(){this.listNode.querySelector("li")&&this.listNode.classList.add("show")},h.prototype.hideList=function(){this.listNode.classList.remove("show")},h.prototype.onSelect=function(){this.listNode.querySelectorAll(".selected").forEach(function(t){t.classList.remove("selected")}),this.selected.current.classList.add("selected")},h.prototype.initEventListeners=function(){this.listNode.addEventListener("click",t=>{"LI"===t.target.tagName&&(this.selected.current=t.target)}),this.listNode.addEventListener("keydown",t=>{const e=document.activeElement;if("LI"===e.tagName&&e.parentNode===this.listNode)switch(t.key){case"ArrowDown":this.focusNextItem(e),t.preventDefault();break;case"ArrowUp":this.focusPreviousItem(e),t.preventDefault();break;case"Enter":this.selected.current=e,t.preventDefault()}}),this.selected.watch(this.onSelect.bind(this))},h.prototype.focusNextItem=function(t){const e=t.nextElementSibling;e&&e.focus()},h.prototype.focusPreviousItem=function(t){const e=t.previousElementSibling;e?e.focus():this.focusTopOutside()},h.prototype.focusTopOutside=function(){},h.prototype.focusFirstItem=function(){const t=this.listNode.querySelector("li");t&&t.focus()};const l=h;function p(t,e){this.searchInput=t,this.dropDown=e,this.getDropDown().selected.signals=[],this.getDropDown().selected.watch(()=>{this.searchInput.searchNode.value=this.getDropDown().selected.current.textContent,this.getDropDown().hideList()}),this.getDropDown().focusTopOutside=()=>{this.getSearchInput().searchNode.focus()},this.getSearchInput().searchNode.addEventListener("keydown",t=>{"ArrowDown"===t.key&&(this.dropDown.focusFirstItem(),t.preventDefault())}),this.getSearchInput().searchNode.addEventListener("focus",t=>{this.getDropDown().showList()}),this.getSearchInput().searchNode.addEventListener("blur",t=>{t.relatedTarget?.parentElement!==this.getDropDown().listNode&&this.getDropDown().hideList()}),this.getDropDown().listNode.addEventListener("focusout",t=>{t.relatedTarget!==this.getSearchInput().searchNode&&t.relatedTarget?.parentElement!==this.getDropDown().listNode&&this.getDropDown().hideList()})}p.prototype.getDropDown=function(){return this.dropDown},p.prototype.getSearchInput=function(){return this.searchInput};const d=p;function u(t,e){d.call(this,t,e)}u.prototype=Object.create(d.prototype),u.prototype.initHooks=function(){this.getDropDown().selected.watch(()=>{const t=this.getDropDown().selected.current;t.dataset.lat&&t.dataset.lng?this.getMapInput().callable.setMarker({lat:t.dataset.lat,lng:t.dataset.lng}):this.geocodeSearch(t.textContent)}),this.getSearchInput().loading.watch(()=>{this.getLoaderNode().classList.toggle("show",this.getSearchInput().loading.current)}),this.getSearchInput().response.watch(()=>{const{current:t}=this.getSearchInput().response,e=t.success?t.response?.data:[{label:t.response.html}];this.getDropDown().setItems(e),this.getDropDown().showList()}),this.getDropDown().createItem=t=>{const e=l.prototype.createItem.call(this.dropDown,t);return e.classList.add("jet-fb-map-field__search-item"),"label"in t||(e.textContent=t.address,t?.lat&&t?.lng&&(e.dataset.lat=t.lat,e.dataset.lng=t.lng)),e},this.getMapInput().value.watch(()=>{this.getMapInput().value.current||(this.getSearchInput().search.current="",this.getDropDown().setItems([]))})},u.prototype.setLoaderNode=function(t){this.loader=t},u.prototype.getLoaderNode=function(){return this.loader},u.prototype.setMapInput=function(t){this.input=t},u.prototype.getMapInput=function(){return this.input},u.prototype.geocodeSearch=function(t){t=t||this.getSearchInput().search.current;const e=(0,o.addQueryArgs)(JetMapFieldsSettings.apiLocation,{address:t});s()({path:e}).then(t=>{t.success?this.getMapInput().callable.setMarker(t.data):window.alert(t.html)}).catch(function(t){console.error(t)})};const g=u,{addAction:f}=JetPlugins.hooks;f("jet.fb.input.makeReactive","jet-form-builder/map-field-autocomplete",function(t){if("map"!==t.inputType||!t.nodes?.[0]?.parentElement?.querySelector?.(".jet-fb-map-field__search"))return;const e=t.nodes[0].parentElement.querySelector(".jet-fb-map-field__search"),s=new l(e.querySelector(".jet-fb-map-field__search-list")),o=new a(e.querySelector('[type="text"]')),n=new g(o,s);n.setLoaderNode(e.querySelector(".jet-fb-map-field__search-loader")),n.setMapInput(t),n.initHooks()})})();