10 lines
1.9 KiB
JavaScript
10 lines
1.9 KiB
JavaScript
/*!
|
|
* FilePondPluginGetFile 1.1.0
|
|
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
|
* Please visit undefined for details.
|
|
*/
|
|
|
|
/* eslint-disable */
|
|
|
|
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).FilePondPluginGetFile=n()}(this,(function(){"use strict";const e=e=>{let n=document.createElement("span");return n.className="filepond--download-icon",n.title=e,n},n=(e,n,o)=>{if(o&&"function"==typeof o)o(e);else if(n&&e.getMetadata("url"))location.href=e.getMetadata("url");else{const n=document.createElement("a"),o=window.URL.createObjectURL(e.file);document.body.appendChild(n),n.style.display="none",n.href=o,n.download=e.file.name,n.click(),window.URL.revokeObjectURL(o),n.remove()}},o=o=>{const{addFilter:t,utils:i}=o,{Type:l,createRoute:d}=i;return t("CREATE_VIEW",(o=>{const{is:t,view:i,query:l}=o;if(!t("file"))return;i.registerWriter(d({DID_LOAD_ITEM:({root:o,props:t})=>{const{id:i}=t,d=l("GET_ITEM",i);if(!d||d.archived)return;const r=o.query("GET_LABEL_BUTTON_DOWNLOAD_ITEM"),a=o.query("GET_ALLOW_DOWNLOAD_BY_URL"),c=o.query("GET_DOWNLOAD_FUNCTION");((o,t,i,l,d)=>{const r=t.querySelector(".filepond--file-info"),a=t.querySelector(".filepond--file-info-main"),c=e(i);let f=t.querySelector(".filepond--file-info-main-container");f||(f=document.createElement("div"),f.className="filepond--file-info-main-container",f.append(a),r.prepend(f)),f.prepend(c),c.addEventListener("click",(()=>n(o,l,d)))})(d,o.element,r,a,c)}},(({root:e,props:n})=>{const{id:o}=n;l("GET_ITEM",o);e.rect.element.hidden})))})),{options:{labelButtonDownloadItem:["Download file",l.STRING],allowDownloadByUrl:[!1,l.BOOLEAN],downloadFunction:[null,l.FUNCTION]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:o})),o}));
|