From 1d3c366dbabd03f93f8fbfa49b415c74532f8b41 Mon Sep 17 00:00:00 2001 From: Anand Date: Mon, 11 Sep 2023 12:53:41 +0530 Subject: [PATCH 1/3] add method show name of image --- src/Fields/Images.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Fields/Images.php b/src/Fields/Images.php index 1342ef03..702f1f65 100644 --- a/src/Fields/Images.php +++ b/src/Fields/Images.php @@ -40,6 +40,11 @@ public function showStatistics(bool $showStatistics = true): self return $this->withMeta(compact('showStatistics')); } + public function showName(bool $showName = true): self + { + return $this->withMeta(compact('showName')); + } + public function showDimensions(bool $showDimensions = true): self { return $this->showStatistics(); From c8d9dc492db94e2efd1477f302cdae22e450e611 Mon Sep 17 00:00:00 2001 From: Anand Date: Mon, 11 Sep 2023 13:36:28 +0530 Subject: [PATCH 2/3] show filename in single media; adjust display when showName and showStatistics are set --- dist/js/field.js | 2 +- resources/js/components/SingleMedia.vue | 428 +++++++++++++----------- 2 files changed, 226 insertions(+), 204 deletions(-) diff --git a/dist/js/field.js b/dist/js/field.js index 905c88ff..66a200df 100644 --- a/dist/js/field.js +++ b/dist/js/field.js @@ -1,2 +1,2 @@ /*! For license information please see field.js.LICENSE.txt */ -(()=>{var t,e={7757:(t,e,n)=>{t.exports=n(5666)},9680:(t,e,n)=>{function r(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var i=r(n(9669)),o=n(3454),a=r(n(9996));function s(){return(s=Object.assign||function(t){for(var e=1;e0&&"back_forward"===window.performance.getEntriesByType("navigation")[0].type},n.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)}))},n.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}},n.isLocationVisit=function(){try{return null!==window.sessionStorage.getItem("inertiaLocationVisit")}catch(t){return!1}},n.handleLocationVisit=function(t){var e,n,r,i,o=this,a=JSON.parse(window.sessionStorage.getItem("inertiaLocationVisit")||"");window.sessionStorage.removeItem("inertiaLocationVisit"),t.url+=window.location.hash,t.rememberedState=null!=(e=null==(n=window.history.state)?void 0:n.rememberedState)?e:{},t.scrollRegions=null!=(r=null==(i=window.history.state)?void 0:i.scrollRegions)?r:[],this.setPage(t,{preserveScroll:a.preserveScroll,preserveState:!0}).then((function(){a.preserveScroll&&o.restoreScrollPositions(),b(t)}))},n.isLocationVisitResponse=function(t){return t&&409===t.status&&t.headers["x-inertia-location"]},n.isInertiaResponse=function(t){return null==t?void 0:t.headers["x-inertia"]},n.createVisitId=function(){return this.visitId={},this.visitId},n.cancelVisit=function(t,e){var n=e.cancelled,r=void 0!==n&&n,i=e.interrupted,o=void 0!==i&&i;!t||t.completed||t.cancelled||t.interrupted||(t.cancelToken.cancel(),t.onCancel(),t.completed=!1,t.cancelled=r,t.interrupted=o,y(t),t.onFinish(t))},n.finishVisit=function(t){t.cancelled||t.interrupted||(t.completed=!0,t.cancelled=!1,t.interrupted=!1,y(t),t.onFinish(t))},n.resolvePreserveOption=function(t,e){return"function"==typeof t?t(e):"errors"===t?Object.keys(e.props.errors||{}).length>0:t},n.visit=function(t,n){var r=this,o=void 0===n?{}:n,a=o.method,c=void 0===a?e.n$.GET:a,u=o.data,h=void 0===u?{}:u,d=o.replace,y=void 0!==d&&d,b=o.preserveScroll,w=void 0!==b&&b,x=o.preserveState,S=void 0!==x&&x,E=o.only,_=void 0===E?[]:E,O=o.headers,A=void 0===O?{}:O,j=o.errorBag,C=void 0===j?"":j,k=o.forceFormData,P=void 0!==k&&k,M=o.onCancelToken,T=void 0===M?function(){}:M,R=o.onBefore,D=void 0===R?function(){}:R,I=o.onStart,N=void 0===I?function(){}:I,B=o.onProgress,z=void 0===B?function(){}:B,L=o.onFinish,F=void 0===L?function(){}:L,V=o.onCancel,U=void 0===V?function(){}:V,$=o.onSuccess,W=void 0===$?function(){}:$,H=o.onError,q=void 0===H?function(){}:H,X=o.queryStringArrayFormat,Y=void 0===X?"brackets":X,G="string"==typeof t?p(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)}))}(h)&&!P||h instanceof FormData||(h=f(h)),!(h instanceof FormData)){var Z=m(c,G,h,Y),K=Z[1];G=p(Z[0]),h=K}var Q={url:G,method:c,data:h,replace:y,preserveScroll:w,preserveState:S,only:_,headers:A,errorBag:C,forceFormData:P,queryStringArrayFormat:Y,cancelled:!1,completed:!1,interrupted:!1};if(!1!==D(Q)&&function(t){return g("before",{cancelable:!0,detail:{visit:t}})}(Q)){this.activeVisit&&this.cancelVisit(this.activeVisit,{interrupted:!0}),this.saveScrollPositions();var J=this.createVisitId();this.activeVisit=s({},Q,{onCancelToken:T,onBefore:D,onStart:N,onProgress:z,onFinish:F,onCancel:U,onSuccess:W,onError:q,queryStringArrayFormat:Y,cancelToken:i.CancelToken.source()}),T({cancel:function(){r.activeVisit&&r.cancelVisit(r.activeVisit,{cancelled:!0})}}),function(t){g("start",{detail:{visit:t}})}(Q),N(Q),i({method:c,url:v(G).href,data:c===e.n$.GET?{}:h,params:c===e.n$.GET?h:{},cancelToken:this.activeVisit.cancelToken.token,headers:s({},A,{Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0},_.length?{"X-Inertia-Partial-Component":this.page.component,"X-Inertia-Partial-Data":_.join(",")}:{},C&&C.length?{"X-Inertia-Error-Bag":C}:{},this.page.version?{"X-Inertia-Version":this.page.version}:{}),onUploadProgress:function(t){h instanceof FormData&&(t.percentage=Math.round(t.loaded/t.total*100),function(t){g("progress",{detail:{progress:t}})}(t),z(t))}}).then((function(t){var e;if(!r.isInertiaResponse(t))return Promise.reject({response:t});var n=t.data;_.length&&n.component===r.page.component&&(n.props=s({},r.page.props,n.props)),w=r.resolvePreserveOption(w,n),(S=r.resolvePreserveOption(S,n))&&null!=(e=window.history.state)&&e.rememberedState&&n.component===r.page.component&&(n.rememberedState=window.history.state.rememberedState);var i=G,o=p(n.url);return i.hash&&!o.hash&&v(i).href===o.href&&(o.hash=i.hash,n.url=o.href),r.setPage(n,{visitId:J,replace:y,preserveScroll:w,preserveState:S})})).then((function(){var t=r.page.props.errors||{};if(Object.keys(t).length>0){var e=C?t[C]?t[C]:{}:t;return function(t){g("error",{detail:{errors:t}})}(e),q(e)}return g("success",{detail:{page:r.page}}),W(r.page)})).catch((function(t){if(r.isInertiaResponse(t.response))return r.setPage(t.response.data,{visitId:J});if(r.isLocationVisitResponse(t.response)){var e=p(t.response.headers["x-inertia-location"]),n=G;n.hash&&!e.hash&&v(n).href===e.href&&(e.hash=n.hash),r.locationVisit(e,!0===w)}else{if(!t.response)return Promise.reject(t);g("invalid",{cancelable:!0,detail:{response:t.response}})&&l.show(t.response.data)}})).then((function(){r.activeVisit&&r.finishVisit(r.activeVisit)})).catch((function(t){if(!i.isCancel(t)){var e=g("exception",{cancelable:!0,detail:{exception:t}});if(r.activeVisit&&r.finishVisit(r.activeVisit),e)return Promise.reject(t)}}))}},n.setPage=function(t,e){var n=this,r=void 0===e?{}:e,i=r.visitId,o=void 0===i?this.createVisitId():i,a=r.replace,s=void 0!==a&&a,c=r.preserveScroll,l=void 0!==c&&c,u=r.preserveState,f=void 0!==u&&u;return Promise.resolve(this.resolveComponent(t.component)).then((function(e){o===n.visitId&&(t.scrollRegions=t.scrollRegions||[],t.rememberedState=t.rememberedState||{},(s=s||p(t.url).href===window.location.href)?n.replaceState(t):n.pushState(t),n.swapComponent({component:e,page:t,preserveState:f}).then((function(){l||n.resetScrollPositions(),s||b(t)})))}))},n.pushState=function(t){this.page=t,window.history.pushState(t,"",t.url)},n.replaceState=function(t){this.page=t,window.history.replaceState(t,"",t.url)},n.handlePopstateEvent=function(t){var e=this;if(null!==t.state){var n=t.state,r=this.createVisitId();Promise.resolve(this.resolveComponent(n.component)).then((function(t){r===e.visitId&&(e.page=n,e.swapComponent({component:t,page:n,preserveState:!1}).then((function(){e.restoreScrollPositions(),b(n)})))}))}else{var i=p(this.page.url);i.hash=window.location.hash,this.replaceState(s({},this.page,{url:i.href})),this.resetScrollPositions()}},n.get=function(t,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),this.visit(t,s({},r,{method:e.n$.GET,data:n}))},n.reload=function(t){return void 0===t&&(t={}),this.visit(window.location.href,s({},t,{preserveScroll:!0,preserveState:!0}))},n.replace=function(t,e){var n;return void 0===e&&(e={}),console.warn("Inertia.replace() has been deprecated and will be removed in a future release. Please use Inertia."+(null!=(n=e.method)?n:"get")+"() instead."),this.visit(t,s({preserveState:!0},e,{replace:!0}))},n.post=function(t,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),this.visit(t,s({preserveState:!0},r,{method:e.n$.POST,data:n}))},n.put=function(t,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),this.visit(t,s({preserveState:!0},r,{method:e.n$.PUT,data:n}))},n.patch=function(t,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),this.visit(t,s({preserveState:!0},r,{method:e.n$.PATCH,data:n}))},n.delete=function(t,n){return void 0===n&&(n={}),this.visit(t,s({preserveState:!0},n,{method:e.n$.DELETE}))},n.remember=function(t,e){var n,r;void 0===e&&(e="default"),w||this.replaceState(s({},this.page,{rememberedState:s({},null==(n=this.page)?void 0:n.rememberedState,(r={},r[e]=t,r))}))},n.restore=function(t){var e,n;if(void 0===t&&(t="default"),!w)return null==(e=window.history.state)||null==(n=e.rememberedState)?void 0:n[t]},n.on=function(t,e){var n=function(t){var n=e(t);t.cancelable&&!t.defaultPrevented&&!1===n&&t.preventDefault()};return document.addEventListener("inertia:"+t,n),function(){return document.removeEventListener("inertia:"+t,n)}},t}(),S={buildDOMElement:function(t){var e=document.createElement("template");e.innerHTML=t;var n=e.content.firstChild;if(!t.startsWith(" From 39169c5d67fde35cad0317600611de31fdeffebe Mon Sep 17 00:00:00 2001 From: Anand Date: Mon, 11 Sep 2023 13:46:59 +0530 Subject: [PATCH 3/3] break word for the filename --- dist/js/field.js | 2 +- resources/js/components/SingleMedia.vue | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dist/js/field.js b/dist/js/field.js index 66a200df..56ad5090 100644 --- a/dist/js/field.js +++ b/dist/js/field.js @@ -1,2 +1,2 @@ /*! For license information please see field.js.LICENSE.txt */ -(()=>{var e,t={7757:(e,t,n)=>{e.exports=n(5666)},9680:(e,t,n)=>{function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var i=r(n(9669)),o=n(3454),a=r(n(9996));function s(){return(s=Object.assign||function(e){for(var t=1;t0&&"back_forward"===window.performance.getEntriesByType("navigation")[0].type},n.handleBackForwardVisit=function(e){var t=this;window.history.state.version=e.version,this.setPage(window.history.state,{preserveScroll:!0,preserveState:!0}).then((function(){t.restoreScrollPositions(),b(e)}))},n.locationVisit=function(e,t){try{window.sessionStorage.setItem("inertiaLocationVisit",JSON.stringify({preserveScroll:t})),window.location.href=e.href,v(window.location).href===v(e).href&&window.location.reload()}catch(e){return!1}},n.isLocationVisit=function(){try{return null!==window.sessionStorage.getItem("inertiaLocationVisit")}catch(e){return!1}},n.handleLocationVisit=function(e){var t,n,r,i,o=this,a=JSON.parse(window.sessionStorage.getItem("inertiaLocationVisit")||"");window.sessionStorage.removeItem("inertiaLocationVisit"),e.url+=window.location.hash,e.rememberedState=null!=(t=null==(n=window.history.state)?void 0:n.rememberedState)?t:{},e.scrollRegions=null!=(r=null==(i=window.history.state)?void 0:i.scrollRegions)?r:[],this.setPage(e,{preserveScroll:a.preserveScroll,preserveState:!0}).then((function(){a.preserveScroll&&o.restoreScrollPositions(),b(e)}))},n.isLocationVisitResponse=function(e){return e&&409===e.status&&e.headers["x-inertia-location"]},n.isInertiaResponse=function(e){return null==e?void 0:e.headers["x-inertia"]},n.createVisitId=function(){return this.visitId={},this.visitId},n.cancelVisit=function(e,t){var n=t.cancelled,r=void 0!==n&&n,i=t.interrupted,o=void 0!==i&&i;!e||e.completed||e.cancelled||e.interrupted||(e.cancelToken.cancel(),e.onCancel(),e.completed=!1,e.cancelled=r,e.interrupted=o,y(e),e.onFinish(e))},n.finishVisit=function(e){e.cancelled||e.interrupted||(e.completed=!0,e.cancelled=!1,e.interrupted=!1,y(e),e.onFinish(e))},n.resolvePreserveOption=function(e,t){return"function"==typeof e?e(t):"errors"===e?Object.keys(t.props.errors||{}).length>0:e},n.visit=function(e,n){var r=this,o=void 0===n?{}:n,a=o.method,c=void 0===a?t.n$.GET:a,u=o.data,h=void 0===u?{}:u,d=o.replace,y=void 0!==d&&d,b=o.preserveScroll,w=void 0!==b&&b,x=o.preserveState,S=void 0!==x&&x,E=o.only,_=void 0===E?[]:E,O=o.headers,A=void 0===O?{}:O,j=o.errorBag,C=void 0===j?"":j,k=o.forceFormData,P=void 0!==k&&k,M=o.onCancelToken,T=void 0===M?function(){}:M,R=o.onBefore,D=void 0===R?function(){}:R,I=o.onStart,N=void 0===I?function(){}:I,B=o.onProgress,z=void 0===B?function(){}:B,L=o.onFinish,F=void 0===L?function(){}:L,V=o.onCancel,U=void 0===V?function(){}:V,$=o.onSuccess,W=void 0===$?function(){}:$,H=o.onError,q=void 0===H?function(){}:H,X=o.queryStringArrayFormat,Y=void 0===X?"brackets":X,G="string"==typeof e?p(e):e;if(!function e(t){return t instanceof File||t instanceof Blob||t instanceof FileList&&t.length>0||t instanceof FormData&&Array.from(t.values()).some((function(t){return e(t)}))||"object"==typeof t&&null!==t&&Object.values(t).some((function(t){return e(t)}))}(h)&&!P||h instanceof FormData||(h=f(h)),!(h instanceof FormData)){var Z=m(c,G,h,Y),K=Z[1];G=p(Z[0]),h=K}var Q={url:G,method:c,data:h,replace:y,preserveScroll:w,preserveState:S,only:_,headers:A,errorBag:C,forceFormData:P,queryStringArrayFormat:Y,cancelled:!1,completed:!1,interrupted:!1};if(!1!==D(Q)&&function(e){return g("before",{cancelable:!0,detail:{visit:e}})}(Q)){this.activeVisit&&this.cancelVisit(this.activeVisit,{interrupted:!0}),this.saveScrollPositions();var J=this.createVisitId();this.activeVisit=s({},Q,{onCancelToken:T,onBefore:D,onStart:N,onProgress:z,onFinish:F,onCancel:U,onSuccess:W,onError:q,queryStringArrayFormat:Y,cancelToken:i.CancelToken.source()}),T({cancel:function(){r.activeVisit&&r.cancelVisit(r.activeVisit,{cancelled:!0})}}),function(e){g("start",{detail:{visit:e}})}(Q),N(Q),i({method:c,url:v(G).href,data:c===t.n$.GET?{}:h,params:c===t.n$.GET?h:{},cancelToken:this.activeVisit.cancelToken.token,headers:s({},A,{Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0},_.length?{"X-Inertia-Partial-Component":this.page.component,"X-Inertia-Partial-Data":_.join(",")}:{},C&&C.length?{"X-Inertia-Error-Bag":C}:{},this.page.version?{"X-Inertia-Version":this.page.version}:{}),onUploadProgress:function(e){h instanceof FormData&&(e.percentage=Math.round(e.loaded/e.total*100),function(e){g("progress",{detail:{progress:e}})}(e),z(e))}}).then((function(e){var t;if(!r.isInertiaResponse(e))return Promise.reject({response:e});var n=e.data;_.length&&n.component===r.page.component&&(n.props=s({},r.page.props,n.props)),w=r.resolvePreserveOption(w,n),(S=r.resolvePreserveOption(S,n))&&null!=(t=window.history.state)&&t.rememberedState&&n.component===r.page.component&&(n.rememberedState=window.history.state.rememberedState);var i=G,o=p(n.url);return i.hash&&!o.hash&&v(i).href===o.href&&(o.hash=i.hash,n.url=o.href),r.setPage(n,{visitId:J,replace:y,preserveScroll:w,preserveState:S})})).then((function(){var e=r.page.props.errors||{};if(Object.keys(e).length>0){var t=C?e[C]?e[C]:{}:e;return function(e){g("error",{detail:{errors:e}})}(t),q(t)}return g("success",{detail:{page:r.page}}),W(r.page)})).catch((function(e){if(r.isInertiaResponse(e.response))return r.setPage(e.response.data,{visitId:J});if(r.isLocationVisitResponse(e.response)){var t=p(e.response.headers["x-inertia-location"]),n=G;n.hash&&!t.hash&&v(n).href===t.href&&(t.hash=n.hash),r.locationVisit(t,!0===w)}else{if(!e.response)return Promise.reject(e);g("invalid",{cancelable:!0,detail:{response:e.response}})&&l.show(e.response.data)}})).then((function(){r.activeVisit&&r.finishVisit(r.activeVisit)})).catch((function(e){if(!i.isCancel(e)){var t=g("exception",{cancelable:!0,detail:{exception:e}});if(r.activeVisit&&r.finishVisit(r.activeVisit),t)return Promise.reject(e)}}))}},n.setPage=function(e,t){var n=this,r=void 0===t?{}:t,i=r.visitId,o=void 0===i?this.createVisitId():i,a=r.replace,s=void 0!==a&&a,c=r.preserveScroll,l=void 0!==c&&c,u=r.preserveState,f=void 0!==u&&u;return Promise.resolve(this.resolveComponent(e.component)).then((function(t){o===n.visitId&&(e.scrollRegions=e.scrollRegions||[],e.rememberedState=e.rememberedState||{},(s=s||p(e.url).href===window.location.href)?n.replaceState(e):n.pushState(e),n.swapComponent({component:t,page:e,preserveState:f}).then((function(){l||n.resetScrollPositions(),s||b(e)})))}))},n.pushState=function(e){this.page=e,window.history.pushState(e,"",e.url)},n.replaceState=function(e){this.page=e,window.history.replaceState(e,"",e.url)},n.handlePopstateEvent=function(e){var t=this;if(null!==e.state){var n=e.state,r=this.createVisitId();Promise.resolve(this.resolveComponent(n.component)).then((function(e){r===t.visitId&&(t.page=n,t.swapComponent({component:e,page:n,preserveState:!1}).then((function(){t.restoreScrollPositions(),b(n)})))}))}else{var i=p(this.page.url);i.hash=window.location.hash,this.replaceState(s({},this.page,{url:i.href})),this.resetScrollPositions()}},n.get=function(e,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),this.visit(e,s({},r,{method:t.n$.GET,data:n}))},n.reload=function(e){return void 0===e&&(e={}),this.visit(window.location.href,s({},e,{preserveScroll:!0,preserveState:!0}))},n.replace=function(e,t){var n;return void 0===t&&(t={}),console.warn("Inertia.replace() has been deprecated and will be removed in a future release. Please use Inertia."+(null!=(n=t.method)?n:"get")+"() instead."),this.visit(e,s({preserveState:!0},t,{replace:!0}))},n.post=function(e,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),this.visit(e,s({preserveState:!0},r,{method:t.n$.POST,data:n}))},n.put=function(e,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),this.visit(e,s({preserveState:!0},r,{method:t.n$.PUT,data:n}))},n.patch=function(e,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),this.visit(e,s({preserveState:!0},r,{method:t.n$.PATCH,data:n}))},n.delete=function(e,n){return void 0===n&&(n={}),this.visit(e,s({preserveState:!0},n,{method:t.n$.DELETE}))},n.remember=function(e,t){var n,r;void 0===t&&(t="default"),w||this.replaceState(s({},this.page,{rememberedState:s({},null==(n=this.page)?void 0:n.rememberedState,(r={},r[t]=e,r))}))},n.restore=function(e){var t,n;if(void 0===e&&(e="default"),!w)return null==(t=window.history.state)||null==(n=t.rememberedState)?void 0:n[e]},n.on=function(e,t){var n=function(e){var n=t(e);e.cancelable&&!e.defaultPrevented&&!1===n&&e.preventDefault()};return document.addEventListener("inertia:"+e,n),function(){return document.removeEventListener("inertia:"+e,n)}},e}(),S={buildDOMElement:function(e){var t=document.createElement("template");t.innerHTML=e;var n=t.content.firstChild;if(!e.startsWith("