From 8bd61a22a10f2d30584c9defe3498c133086e1c3 Mon Sep 17 00:00:00 2001 From: fnematov Date: Sat, 29 Jul 2023 10:44:13 +0500 Subject: [PATCH 1/2] Add ability to customize center coordinates --- config/nova-google-polygon.php | 6 +- dist/js/field.js | 15830 +++++++++++++++++++++- dist/js/field.js.LICENSE.txt | 4 +- package-lock.json | 312 +- resources/js/components/DetailField.vue | 9 +- resources/js/components/FormField.vue | 9 +- src/FieldServiceProvider.php | 1 + 7 files changed, 16007 insertions(+), 164 deletions(-) diff --git a/config/nova-google-polygon.php b/config/nova-google-polygon.php index 75f1e33..a2e03a1 100644 --- a/config/nova-google-polygon.php +++ b/config/nova-google-polygon.php @@ -2,5 +2,9 @@ return [ // Get your key from https://console.developers.google.com - 'api_key' => env('NOVA_GOOGLE_POLYGON_API_KEY', '') + 'api_key' => env('NOVA_GOOGLE_POLYGON_API_KEY', ''), + 'center' => [ + 'lat' => env('NOVA_GOOGLE_POLYGON_CENTER_LAT', 48.858361), + 'lng' => env('NOVA_GOOGLE_POLYGON_CENTER_LNG', 2.336164), + ] ]; diff --git a/dist/js/field.js b/dist/js/field.js index 9e06a85..f4a8684 100644 --- a/dist/js/field.js +++ b/dist/js/field.js @@ -1,2 +1,15828 @@ -/*! For license information please see field.js.LICENSE.txt */ -(()=>{var t={4369:(t,e,r)=>{"use strict";r.d(e,{Z:()=>i});var n=r(3645),o=r.n(n)()((function(t){return t[1]}));o.push([t.id,'.nova-google-polygon-map{border-radius:5px;height:500px;overflow:hidden;width:100%}.nova-google-polygon-map .gm-style-cc,.nova-google-polygon-map a[href^="http://maps.google.com/maps"],.nova-google-polygon-map a[href^="https://maps.google.com/maps"],.nova-google-polygon-map a[href^="https://www.google.com/maps"]{display:none!important}',""]);const i=o},3645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r=t(e);return e[2]?"@media ".concat(e[2]," {").concat(r,"}"):r})).join("")},e.i=function(t,r,n){"string"==typeof t&&(t=[[null,t,""]]);var o={};if(n)for(var i=0;i{const e="__googleMapsApiOnLoadCallback",r=["channel","client","key","language","region","v"];let n=null;t.exports=function(t={}){return n=n||new Promise((function(n,o){const i=setTimeout((function(){window[e]=function(){},o(new Error("Could not load the Google Maps API"))}),t.timeout||1e4);window[e]=function(){null!==i&&clearTimeout(i),n(window.google.maps),delete window[e]};const a=document.createElement("script"),s=[`callback=${e}`];r.forEach((function(e){t[e]&&s.push(`${e}=${t[e]}`)})),t.libraries&&t.libraries.length&&s.push(`libraries=${t.libraries.join(",")}`),a.src=`${t.apiUrl||"https://maps.googleapis.com/maps/api/js"}?${s.join("&")}`,document.body.appendChild(a)})),n}},3379:(t,e,r)=>{"use strict";var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},i=function(){var t={};return function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}t[e]=r}return t[e]}}(),a=[];function s(t){for(var e=-1,r=0;r{"use strict";e.Z=(t,e)=>{const r=t.__vccOpts||t;for(const[t,n]of e)r[t]=n;return r}},8336:(t,e,r)=>{function n(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var o=n(r(20)),i=r(6878),a=n(r(308));function s(){return(s=Object.assign||function(t){for(var e=1;e0&&"back_forward"===window.performance.getEntriesByType("navigation")[0].type},r.handleBackForwardVisit=function(t){var e=this;window.history.state.version=t.version,this.setPage(window.history.state,{preserveScroll:!0,preserveState:!0}).then((function(){e.restoreScrollPositions(),b(t)}))},r.locationVisit=function(t,e){try{window.sessionStorage.setItem("inertiaLocationVisit",JSON.stringify({preserveScroll:e})),window.location.href=t.href,v(window.location).href===v(t).href&&window.location.reload()}catch(t){return!1}},r.isLocationVisit=function(){try{return null!==window.sessionStorage.getItem("inertiaLocationVisit")}catch(t){return!1}},r.handleLocationVisit=function(t){var e,r,n,o,i=this,a=JSON.parse(window.sessionStorage.getItem("inertiaLocationVisit")||"");window.sessionStorage.removeItem("inertiaLocationVisit"),t.url+=window.location.hash,t.rememberedState=null!=(e=null==(r=window.history.state)?void 0:r.rememberedState)?e:{},t.scrollRegions=null!=(n=null==(o=window.history.state)?void 0:o.scrollRegions)?n:[],this.setPage(t,{preserveScroll:a.preserveScroll,preserveState:!0}).then((function(){a.preserveScroll&&i.restoreScrollPositions(),b(t)}))},r.isLocationVisitResponse=function(t){return t&&409===t.status&&t.headers["x-inertia-location"]},r.isInertiaResponse=function(t){return null==t?void 0:t.headers["x-inertia"]},r.createVisitId=function(){return this.visitId={},this.visitId},r.cancelVisit=function(t,e){var r=e.cancelled,n=void 0!==r&&r,o=e.interrupted,i=void 0!==o&&o;!t||t.completed||t.cancelled||t.interrupted||(t.cancelToken.cancel(),t.onCancel(),t.completed=!1,t.cancelled=n,t.interrupted=i,g(t),t.onFinish(t))},r.finishVisit=function(t){t.cancelled||t.interrupted||(t.completed=!0,t.cancelled=!1,t.interrupted=!1,g(t),t.onFinish(t))},r.resolvePreserveOption=function(t,e){return"function"==typeof t?t(e):"errors"===t?Object.keys(e.props.errors||{}).length>0:t},r.visit=function(t,r){var n=this,i=void 0===r?{}:r,a=i.method,c=void 0===a?e.n$.GET:a,l=i.data,p=void 0===l?{}:l,h=i.replace,g=void 0!==h&&h,b=i.preserveScroll,w=void 0!==b&&b,O=i.preserveState,x=void 0!==O&&O,j=i.only,S=void 0===j?[]:j,_=i.headers,P=void 0===_?{}:_,E=i.errorBag,A=void 0===E?"":E,k=i.forceFormData,T=void 0!==k&&k,C=i.onCancelToken,I=void 0===C?function(){}:C,N=i.onBefore,L=void 0===N?function(){}:N,M=i.onStart,F=void 0===M?function(){}:M,R=i.onProgress,D=void 0===R?function(){}:R,V=i.onFinish,U=void 0===V?function(){}:V,B=i.onCancel,$=void 0===B?function(){}:B,q=i.onSuccess,W=void 0===q?function(){}:q,G=i.onError,z=void 0===G?function(){}:G,H=i.queryStringArrayFormat,J=void 0===H?"brackets":H,Q="string"==typeof t?d(t):t;if(!function t(e){return e instanceof File||e instanceof Blob||e instanceof FileList&&e.length>0||e instanceof FormData&&Array.from(e.values()).some((function(e){return t(e)}))||"object"==typeof e&&null!==e&&Object.values(e).some((function(e){return t(e)}))}(p)&&!T||p instanceof FormData||(p=f(p)),!(p instanceof FormData)){var X=y(c,Q,p,J),Z=X[1];Q=d(X[0]),p=Z}var K={url:Q,method:c,data:p,replace:g,preserveScroll:w,preserveState:x,only:S,headers:P,errorBag:A,forceFormData:T,queryStringArrayFormat:J,cancelled:!1,completed:!1,interrupted:!1};if(!1!==L(K)&&function(t){return m("before",{cancelable:!0,detail:{visit:t}})}(K)){this.activeVisit&&this.cancelVisit(this.activeVisit,{interrupted:!0}),this.saveScrollPositions();var Y=this.createVisitId();this.activeVisit=s({},K,{onCancelToken:I,onBefore:L,onStart:F,onProgress:D,onFinish:U,onCancel:$,onSuccess:W,onError:z,queryStringArrayFormat:J,cancelToken:o.CancelToken.source()}),I({cancel:function(){n.activeVisit&&n.cancelVisit(n.activeVisit,{cancelled:!0})}}),function(t){m("start",{detail:{visit:t}})}(K),F(K),o({method:c,url:v(Q).href,data:c===e.n$.GET?{}:p,params:c===e.n$.GET?p:{},cancelToken:this.activeVisit.cancelToken.token,headers:s({},P,{Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0},S.length?{"X-Inertia-Partial-Component":this.page.component,"X-Inertia-Partial-Data":S.join(",")}:{},A&&A.length?{"X-Inertia-Error-Bag":A}:{},this.page.version?{"X-Inertia-Version":this.page.version}:{}),onUploadProgress:function(t){p instanceof FormData&&(t.percentage=Math.round(t.loaded/t.total*100),function(t){m("progress",{detail:{progress:t}})}(t),D(t))}}).then((function(t){var e;if(!n.isInertiaResponse(t))return Promise.reject({response:t});var r=t.data;S.length&&r.component===n.page.component&&(r.props=s({},n.page.props,r.props)),w=n.resolvePreserveOption(w,r),(x=n.resolvePreserveOption(x,r))&&null!=(e=window.history.state)&&e.rememberedState&&r.component===n.page.component&&(r.rememberedState=window.history.state.rememberedState);var o=Q,i=d(r.url);return o.hash&&!i.hash&&v(o).href===i.href&&(i.hash=o.hash,r.url=i.href),n.setPage(r,{visitId:Y,replace:g,preserveScroll:w,preserveState:x})})).then((function(){var t=n.page.props.errors||{};if(Object.keys(t).length>0){var e=A?t[A]?t[A]:{}:t;return function(t){m("error",{detail:{errors:t}})}(e),z(e)}return m("success",{detail:{page:n.page}}),W(n.page)})).catch((function(t){if(n.isInertiaResponse(t.response))return n.setPage(t.response.data,{visitId:Y});if(n.isLocationVisitResponse(t.response)){var e=d(t.response.headers["x-inertia-location"]),r=Q;r.hash&&!e.hash&&v(r).href===e.href&&(e.hash=r.hash),n.locationVisit(e,!0===w)}else{if(!t.response)return Promise.reject(t);m("invalid",{cancelable:!0,detail:{response:t.response}})&&u.show(t.response.data)}})).then((function(){n.activeVisit&&n.finishVisit(n.activeVisit)})).catch((function(t){if(!o.isCancel(t)){var e=m("exception",{cancelable:!0,detail:{exception:t}});if(n.activeVisit&&n.finishVisit(n.activeVisit),e)return Promise.reject(t)}}))}},r.setPage=function(t,e){var r=this,n=void 0===e?{}:e,o=n.visitId,i=void 0===o?this.createVisitId():o,a=n.replace,s=void 0!==a&&a,c=n.preserveScroll,u=void 0!==c&&c,l=n.preserveState,f=void 0!==l&&l;return Promise.resolve(this.resolveComponent(t.component)).then((function(e){i===r.visitId&&(t.scrollRegions=t.scrollRegions||[],t.rememberedState=t.rememberedState||{},(s=s||d(t.url).href===window.location.href)?r.replaceState(t):r.pushState(t),r.swapComponent({component:e,page:t,preserveState:f}).then((function(){u||r.resetScrollPositions(),s||b(t)})))}))},r.pushState=function(t){this.page=t,window.history.pushState(t,"",t.url)},r.replaceState=function(t){this.page=t,window.history.replaceState(t,"",t.url)},r.handlePopstateEvent=function(t){var e=this;if(null!==t.state){var r=t.state,n=this.createVisitId();Promise.resolve(this.resolveComponent(r.component)).then((function(t){n===e.visitId&&(e.page=r,e.swapComponent({component:t,page:r,preserveState:!1}).then((function(){e.restoreScrollPositions(),b(r)})))}))}else{var o=d(this.page.url);o.hash=window.location.hash,this.replaceState(s({},this.page,{url:o.href})),this.resetScrollPositions()}},r.get=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),this.visit(t,s({},n,{method:e.n$.GET,data:r}))},r.reload=function(t){return void 0===t&&(t={}),this.visit(window.location.href,s({},t,{preserveScroll:!0,preserveState:!0}))},r.replace=function(t,e){var r;return void 0===e&&(e={}),console.warn("Inertia.replace() has been deprecated and will be removed in a future release. Please use Inertia."+(null!=(r=e.method)?r:"get")+"() instead."),this.visit(t,s({preserveState:!0},e,{replace:!0}))},r.post=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),this.visit(t,s({preserveState:!0},n,{method:e.n$.POST,data:r}))},r.put=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),this.visit(t,s({preserveState:!0},n,{method:e.n$.PUT,data:r}))},r.patch=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),this.visit(t,s({preserveState:!0},n,{method:e.n$.PATCH,data:r}))},r.delete=function(t,r){return void 0===r&&(r={}),this.visit(t,s({preserveState:!0},r,{method:e.n$.DELETE}))},r.remember=function(t,e){var r,n;void 0===e&&(e="default"),w||this.replaceState(s({},this.page,{rememberedState:s({},null==(r=this.page)?void 0:r.rememberedState,(n={},n[e]=t,n))}))},r.restore=function(t){var e,r;if(void 0===t&&(t="default"),!w)return null==(e=window.history.state)||null==(r=e.rememberedState)?void 0:r[t]},r.on=function(t,e){var r=function(t){var r=e(t);t.cancelable&&!t.defaultPrevented&&!1===r&&t.preventDefault()};return document.addEventListener("inertia:"+t,r),function(){return document.removeEventListener("inertia:"+t,r)}},t}(),x={buildDOMElement:function(t){var e=document.createElement("template");e.innerHTML=t;var r=e.content.firstChild;if(!t.startsWith("