pos-gis/public/assets/js/pages/crud/file-upload/uppy.min.js
2024-10-07 13:13:42 +07:00

1 line
6.2 KiB
JavaScript
Vendored
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";var KTUppy=function(){const e=Uppy.Tus,t=Uppy.ProgressBar,i=Uppy.StatusBar,a=Uppy.FileInput,p=Uppy.Informer,s=Uppy.Dashboard,n=Uppy.Dropbox,o=Uppy.GoogleDrive,r=Uppy.Instagram,u=Uppy.Webcam;return{init:function(){var l,m,d,c;l={proudlyDisplayPoweredByUppy:!1,target:"#kt_uppy_1",inline:!0,replaceTargetContent:!0,showProgressDetails:!0,note:"No filetype restrictions.",height:470,metaFields:[{id:"name",name:"Name",placeholder:"file name"},{id:"caption",name:"Caption",placeholder:"describe what the image is about"}],browserBackButtonClose:!0},(m=Uppy.Core({autoProceed:!0,restrictions:{maxFileSize:1e6,maxNumberOfFiles:5,minNumberOfFiles:1}})).use(s,l),m.use(e,{endpoint:"https://master.tus.io/files/"}),m.use(o,{target:s,companionUrl:"https://companion.uppy.io"}),m.use(n,{target:s,companionUrl:"https://companion.uppy.io"}),m.use(r,{target:s,companionUrl:"https://companion.uppy.io"}),m.use(u,{target:s}),function(){var t={proudlyDisplayPoweredByUppy:!1,target:"#kt_uppy_2",inline:!0,replaceTargetContent:!0,showProgressDetails:!0,note:"Images and video only, 23 files, up to 1 MB",height:470,metaFields:[{id:"name",name:"Name",placeholder:"file name"},{id:"caption",name:"Caption",placeholder:"describe what the image is about"}],browserBackButtonClose:!0},i=Uppy.Core({autoProceed:!0,restrictions:{maxFileSize:1e6,maxNumberOfFiles:5,minNumberOfFiles:1,allowedFileTypes:["image/*","video/*"]}});i.use(s,t),i.use(e,{endpoint:"https://master.tus.io/files/"})}(),d="#kt_uppy_3",(c=Uppy.Core({autoProceed:!0,restrictions:{maxFileSize:1e6,maxNumberOfFiles:5,minNumberOfFiles:1,allowedFileTypes:["image/*","video/*"]}})).use(Uppy.DragDrop,{target:d+" .uppy-drag"}),c.use(t,{target:d+" .uppy-progress",hideUploadButton:!1,hideAfterFinish:!1}),c.use(p,{target:d+" .uppy-informer"}),c.use(e,{endpoint:"https://master.tus.io/files/"}),c.on("complete",function(e){var t="";$.each(e.successful,function(e,i){var a="";/image/.test(i.type)&&(a='<div class="uppy-thumbnail"><img src="'+i.uploadURL+'"/></div>');var p="bytes",s=i.size;s>1024&&(p="kb",(s/=1024)>1024&&(s/=1024,p="MB")),t+='<div class="uppy-thumbnail-container" data-id="'+i.id+'">'+a+' <span class="uppy-thumbnail-label">'+i.name+" ("+Math.round(s,2)+" "+p+')</span><span data-id="'+i.id+'" class="uppy-remove-thumbnail"><i class="flaticon2-cancel-music"></i></span></div>'}),$(d+" .uppy-thumbnails").append(t)}),$(document).on("click",d+" .uppy-thumbnails .uppy-remove-thumbnail",function(){var e=$(this).attr("data-id");c.removeFile(e),$(d+' .uppy-thumbnail-container[data-id="'+e+'"').remove()}),function(){var i="#kt_uppy_4",a=Uppy.Core({autoProceed:!1,restrictions:{maxFileSize:1e6,maxNumberOfFiles:5,minNumberOfFiles:1}});a.use(Uppy.DragDrop,{target:i+" .uppy-drag"}),a.use(t,{target:i+" .uppy-progress"}),a.use(p,{target:i+" .uppy-informer"}),a.use(e,{endpoint:"https://master.tus.io/files/"}),a.on("complete",function(e){var t="";$.each(e.successful,function(e,i){var a="";/image/.test(i.type)&&(a='<div class="uppy-thumbnail"><img src="'+i.uploadURL+'"/></div>');var p="bytes",s=i.size;s>1024&&(p="kb",(s/=1024)>1024&&(s/=1024,p="MB")),t+='<div class="uppy-thumbnail-container" data-id="'+i.id+'">'+a+' <span class="uppy-thumbnail-label">'+i.name+" ("+Math.round(s,2)+" "+p+')</span><span data-id="'+i.id+'" class="uppy-remove-thumbnail"><i class="flaticon2-cancel-music"></i></span></div>'}),$(i+" .uppy-thumbnails").append(t)}),$(i+" .uppy-btn").click(function(){a.upload()}),$(document).on("click",i+" .uppy-thumbnails .uppy-remove-thumbnail",function(){var e=$(this).attr("data-id");a.removeFile(e),$(i+' .uppy-thumbnail-container[data-id="'+e+'"').remove()})}(),function(){var t="#kt_uppy_5",s=$(t+" .uppy-status"),n=$(t+" .uppy-list"),o=Uppy.Core({debug:!0,autoProceed:!0,showProgressDetails:!0,restrictions:{maxFileSize:1e6,maxNumberOfFiles:5,minNumberOfFiles:1}});o.use(a,{target:t+" .uppy-wrapper",pretty:!1}),o.use(p,{target:t+" .uppy-informer"}),o.use(e,{endpoint:"https://master.tus.io/files/"}),o.use(i,{target:t+" .uppy-status",hideUploadButton:!0,hideAfterFinish:!1}),$(t+" .uppy-FileInput-input").addClass("uppy-input-control").attr("id","kt_uppy_5_input_control"),$(t+" .uppy-FileInput-container").append('<label class="uppy-input-label btn btn-light-primary btn-sm btn-bold" for="kt_uppy_5_input_control">Attach files</label>');var r=$(t+" .uppy-input-label");o.on("upload",function(e){r.text("Uploading..."),s.addClass("uppy-status-ongoing"),s.removeClass("uppy-status-hidden"),clearTimeout(void 0)}),o.on("complete",function(e){$.each(e.successful,function(e,t){var i="bytes",a=t.size;a>1024&&(i="kb",(a/=1024)>1024&&(a/=1024,i="MB"));var p='<div class="uppy-list-item" data-id="'+t.id+'"><div class="uppy-list-label">'+t.name+" ("+Math.round(a,2)+" "+i+')</div><span class="uppy-list-remove" data-id="'+t.id+'"><i class="flaticon2-cancel-music"></i></span></div>';n.append(p)}),r.text("Add more files"),s.addClass("uppy-status-hidden"),s.removeClass("uppy-status-ongoing")}),$(document).on("click",t+" .uppy-list .uppy-list-remove",function(){var e=$(this).attr("data-id");o.removeFile(e),$(t+' .uppy-list-item[data-id="'+e+'"').remove()})}(),function(){var t="#kt_uppy_6",i={proudlyDisplayPoweredByUppy:!1,target:t+" .uppy-dashboard",inline:!1,replaceTargetContent:!0,showProgressDetails:!0,note:"No filetype restrictions.",height:470,metaFields:[{id:"name",name:"Name",placeholder:"file name"},{id:"caption",name:"Caption",placeholder:"describe what the image is about"}],browserBackButtonClose:!0,trigger:t+" .uppy-btn"},a=Uppy.Core({autoProceed:!0,restrictions:{maxFileSize:1e6,maxNumberOfFiles:5,minNumberOfFiles:1}});a.use(s,i),a.use(e,{endpoint:"https://master.tus.io/files/"}),a.use(o,{target:s,companionUrl:"https://companion.uppy.io"}),a.use(n,{target:s,companionUrl:"https://companion.uppy.io"}),a.use(r,{target:s,companionUrl:"https://companion.uppy.io"}),a.use(u,{target:s})}(),setTimeout(function(){swal.fire({title:"Notice",html:"Uppy demos uses <b>https://master.tus.io/files/</b> URL for resumable upload examples and your uploaded files will be temporarely stored in <b>tus.io</b> servers.",type:"info",buttonsStyling:!1,confirmButtonClass:"btn btn-primary",confirmButtonText:"Ok, I understand",onClose:function(e){console.log("on close event fired!")}})},2e3)}}}();KTUtil.ready(function(){KTUppy.init()});