PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.0.8
JetFormBuilder — Dynamic Blocks Form Builder v3.0.8
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 / assets / js / frontend / map.field.min.js
jetformbuilder / assets / js / frontend Last commit date
lib 3 years ago advanced.reporting.js 3 years ago advanced.reporting.min.js 3 years ago calculated.field.js 3 years ago calculated.field.min.js 3 years ago conditional.block.js 3 years ago conditional.block.min.js 3 years ago deprecated.js 3 years ago deprecated.min.js 3 years ago dynamic.value.js 3 years ago dynamic.value.min.js 3 years ago jet-appointment.js 3 years ago jet-appointment.min.js 3 years ago jet-booking.js 3 years ago jet-booking.min.js 3 years ago listing.options.js 3 years ago listing.options.min.js 3 years ago main.js 3 years ago main.min.js 3 years ago map.field.js 3 years ago map.field.min.js 3 years ago media.field.js 3 years ago media.field.min.js 3 years ago media.field.restrictions.js 3 years ago media.field.restrictions.min.js 3 years ago multi.step.js 3 years ago multi.step.min.js 3 years ago repeater.field.js 3 years ago repeater.field.min.js 3 years ago
map.field.min.js
1 lines
1 (()=>{"use strict";function t(t){return t.parentElement.classList.contains("jet-fb-map-field")}var e=!1;function r(){return!1===e&&(e=new window.JetEngineMapsProvider),e}function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,i=t}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e,r){return e=function(t){var e=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,"string");if("object"!==n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===n(e)?e:String(e)}(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var u=JetFormBuilderAbstract.InputData;function c(){u.call(this),this.isSupported=function(e){return t(e)},this.setNode=function(t){u.prototype.setNode.call(this,t);var e=t.parentElement;this.nodes.push(e.querySelector('[data-map-field="hash"]'),e.querySelector('[data-map-field="lat"]'),e.querySelector('[data-map-field="lng"]')),this.fieldSettings=l(l({},this.fieldSettings),JSON.parse(t.dataset.settings))},this.setValue=function(){var t=i(this.nodes,1)[0];if(t.value)switch(this.fieldSettings.format){case"location_string":var e=t.value.split(","),r=Number(e[0]),n=Number(e[1]);if(2!==e.length||Number.isNaN(r)||Number.isNaN(n))return;this.value.current={lat:r,lng:n};break;case"location_address":var o=i(this.nodes,4),a=(o[0],o[1],o[2]),l=o[3];if(null==a||!a.value||null==l||!l.value)return!1;this.value.current={lat:Number(a.value),lng:Number(null==l?void 0:l.value)};break;case"location_array":this.value.current=JSON.parse(t.value)}},this.makeReactive=function(){var t=this;u.prototype.makeReactive.call(this),new IntersectionObserver((function(e,r){e.forEach((function(e){e.isIntersecting&&(t.callable.render(),t.silenceNotify(),r.unobserve(e.target))}))})).observe(this.nodes[0].parentElement)},this.hasAutoScroll=function(){return!1}}c.prototype=Object.create(u.prototype),c.prototype.fieldSettings={height:"300",format:"location_string",field_prefix:!1};const p=c;function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function m(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,i=t}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return h(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function d(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach((function(e){v(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function v(t,e,r){return e=function(t){var e=function(t,e){if("object"!==f(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===f(e)?e:String(e)}(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var b=JetFormBuilderAbstract.BaseSignal,g=JetFormBuilderFunctions.toHTML;function S(){b.call(this),this.lock.current=!0,this.map=null,this.marker=null,this.mapFrame=null,this.position=null,this.preview=null,this.markerDefaults=y({},S.prototype.markerDefaults),this.isSupported=function(e,r){return t(e)},this.runSignal=function(){var t,e=this,r=this.input.value.current;if(r&&Object.keys(r).length){var n=m(this.input.nodes,4),i=n[0],o=(n[1],n[2]),a=n[3];switch(this.setPreview(JetMapFieldsSettings.i18n.loading),this.input.fieldSettings.format){case"location_string":t=r.lat+","+r.lng,this.updateHashFieldPromise(t).then((function(){i.value=t,e.setPreview(r)}));break;case"location_array":t=JSON.stringify(r),this.updateHashFieldPromise(t).then((function(){i.value=t,e.setPreview(r)}));break;case"location_address":wp.apiFetch({method:"get",path:JetMapFieldsSettings.api+"?lat="+r.lat+"&lng="+r.lng,headers:{nonce:JetMapFieldsSettings.nonce}}).then((function(t){t.success?t.data?e.updateHashFieldPromise(t.data).then((function(){i.value=t.data,e.setPreview(t.data)})):(i.value=null,e.setPreview(JetMapFieldsSettings.i18n.notFound)):(i.value=null,e.setPreview(t.html))})).catch((function(t){console.log(t)}))}o&&(o.value=r.lat),a&&(a.value=r.lng)}else this.removeMarker()}}S.prototype=Object.create(b.prototype),S.prototype.map=null,S.prototype.marker=null,S.prototype.preview=null,S.prototype.position=null,S.prototype.mapFrame=null,S.prototype.mapDefaults={center:{lat:41,lng:71},zoom:1},S.prototype.markerDefaults={content:'<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24"><path d="M12 0c-4.198 0-8 3.403-8 7.602 0 4.198 3.469 9.21 8 16.398 4.531-7.188 8-12.2 8-16.398 0-4.199-3.801-7.602-8-7.602zm0 11c-1.657 0-3-1.343-3-3s1.343-3 3-3 3 1.343 3 3-1.343 3-3 3z" fill="#C92C2C"/></svg>',shadow:!1},S.prototype.removeMarker=function(){var t=m(this.input.nodes,4),e=t[0],n=t[1],i=t[2],o=t[3];this.marker&&r().removeMarker(this.marker),this.setPreview(null),e.value=null,i&&(i.value=null),o&&(o.value=null),n&&(n.value=null)},S.prototype.setPreview=function(t){var e;e=t&&t.lat&&t.lng?'<span title="Lat">'+t.lat+'</span>, <span title="Lng">'+t.lng+"</span>":t,this.position.innerHTML=e,this.preview.style.display=t?"flex":"none"},S.prototype.updateHashFieldPromise=function(t){var e=m(this.input.nodes,2),r=(e[0],e[1]);return r?wp.apiFetch({method:"get",path:JetMapFieldsSettings.apiHash+"?loc="+t,headers:{nonce:JetMapFieldsSettings.nonce}}).then((function(t){t.success&&(r.value=t.data)})).catch((function(t){console.log(t)})):new Promise((function(t){t()}))},S.prototype.render=function(){var t=this,e='<div class="jet-engine-map-field__preview" style="display: none; justify-content: space-between; padding: 0 0 5px; align-items: center;"><address class="jet-engine-map-field__position"></address><div class="jet-engine-map-field__reset" role="button" style="cursor: pointer; color: #c92c2c; font-weight: 500; flex-shrink: 0;">× '+JetMapFieldsSettings.i18n.resetBtn+'</div></div><div class="jet-engine-map-field__frame" style="height: '+this.input.fieldSettings.height+'px; width: 100%;"></div>';this.input.root.parent&&(e+='<div class="jet-engine-map-field__description"><p style="margin-bottom: 0;"><strong>'+JetMapFieldsSettings.i18n.descTitle+":</strong> <i>"+this.input.fieldSettings.field_prefix+"_lat, "+this.input.fieldSettings.field_prefix+"_lng</i></p></div>");var n=this.input.nodes[0].parentElement;n.append(g(e)),this.preview=n.querySelector(".jet-engine-map-field__preview"),this.position=n.querySelector(".jet-engine-map-field__position"),this.mapFrame=n.querySelector(".jet-engine-map-field__frame");var i=r();null!==this.input.value.current&&(this.mapDefaults=y(y({},this.mapDefaults),{},{center:this.input.value.current,zoom:14})),this.map=i.initMap(this.mapFrame,this.mapDefaults),null!==this.input.value.current&&(this.marker=i.addMarker(y(y({},this.markerDefaults),{},{position:this.input.value.current,map:this.map}))),i.markerOnClick(this.map,this.markerDefaults,(function(e){t.marker&&i.removeMarker(t.marker),t.marker=e,t.input.value.current=i.getMarkerPosition(e,!0)})),n.querySelector(".jet-engine-map-field__reset").addEventListener("click",(function(){t.input.value.current=null})),this.lock.current=!1};const w=S;function j(t){return function(t){if(Array.isArray(t))return O(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return O(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?O(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var P=JetPlugins.hooks.addFilter;P("jet.fb.inputs","jet-form-builder/map-field",(function(t){return[p].concat(j(t))})),P("jet.fb.signals","jet-form-builder/map-field",(function(t){return[w].concat(j(t))}))})();