2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
|
|
import{N as W,aC as ve,aD as Z,bW as oe,b9 as fe,Q as ue,ba as pe,c as i,U as n,bn as me,O as _e,R as ge,a as F,bS as be,bI as he,w as Fe,a1 as ye,q as qe,bf as Se,be as ke,V as ee,b0 as we,a4 as xe,ac as ae,bd as Ue}from"./index-3a2b6cd5.js";import{b as ze,h as te}from"./format-312d1398.js";import{u as Ce,a as Be,b as Re}from"./use-file-a69aa9db.js";import{g as Le}from"./mixin-183f301b.js";const Ke=W({name:"QUploaderAddTrigger",setup(){const t=ve(oe,Z);return t===Z&&console.error("QUploaderAddTrigger needs to be child of QUploader"),t}}),Pe={...fe,min:{type:Number,default:0},max:{type:Number,default:100},color:String,centerColor:String,trackColor:String,fontSize:String,rounded:Boolean,thickness:{type:Number,default:.2,validator:t=>t>=0&&t<=1},angle:{type:Number,default:0},showValue:Boolean,reverse:Boolean,instantFeedback:Boolean},H=50,re=2*H,ne=re*Math.PI,Ee=Math.round(ne*1e3)/1e3,$e=W({name:"QCircularProgress",props:{...Pe,value:{type:Number,default:0},animationSpeed:{type:[String,Number],default:600},indeterminate:Boolean},setup(t,{slots:_}){const{proxy:{$q:l}}=ue(),g=pe(t),d=i(()=>{const f=(l.lang.rtl===!0?-1:1)*t.angle;return{transform:t.reverse!==(l.lang.rtl===!0)?`scale3d(-1, 1, 1) rotate3d(0, 0, 1, ${-90-f}deg)`:`rotate3d(0, 0, 1, ${f-90}deg)`}}),h=i(()=>t.instantFeedback!==!0&&t.indeterminate!==!0?{transition:`stroke-dashoffset ${t.animationSpeed}ms ease 0s, stroke ${t.animationSpeed}ms ease`}:""),c=i(()=>re/(1-t.thickness/2)),j=i(()=>`${c.value/2} ${c.value/2} ${c.value} ${c.value}`),z=i(()=>ze(t.value,t.min,t.max)),S=i(()=>ne*(1-(z.value-t.min)/(t.max-t.min))),U=i(()=>t.thickness/2*c.value);function C({thickness:f,offset:a,color:o,cls:v,rounded:q}){return n("circle",{class:"q-circular-progress__"+v+(o!==void 0?` text-${o}`:""),style:h.value,fill:"transparent",stroke:"currentColor","stroke-width":f,"stroke-dasharray":Ee,"stroke-dashoffset":a,"stroke-linecap":q,cx:c.value,cy:c.value,r:H})}return()=>{const f=[];t.centerColor!==void 0&&t.centerColor!=="transparent"&&f.push(n("circle",{class:`q-circular-progress__center text-${t.centerColor}`,fill:"currentColor",r:H-U.value/2,cx:c.value,cy:c.value})),t.trackColor!==void 0&&t.trackColor!=="transparent"&&f.push(C({cls:"track",thickness:U.value,offset:0,color:t.trackColor})),f.push(C({cls:"circle",thickness:U.value,offset:S.value,color:t.color,rounded:t.rounded===!0?"round":void 0}));const a=[n("svg",{class:"q-circular-progress__svg",style:d.value,viewBox:j.value,"aria-hidden":"true"},f)];return t.showValue===!0&&a.push(n("div",{class:"q-circular-progress__text absolute-full row flex-center content-center",style:{fontSize:t.fontSize}},_.default!==void 0?_.default():[n("div",z.value)])),n("div",{class:`q-circular-progress q-circular-progress--${t.indeterminate===!0?"in":""}determinate`,style:g.value,role:"progressbar","aria-valuemin":t.min,"aria-valuemax":t.max,"aria-valuenow":t.indeterminate===!0?void 0:z.value},me(_.internal,a))}}});function le(t){return(t*100).toFixed(2)+"%"}const Qe={..._e,...Ce,label:String,color:String,textColor:String,square:Boolean,flat:Boolean,bordered:Boolean,noThumbnails:Boolean,autoUpload:Boolean,hideUploadBtn:Boolean,disable:Boolean,readonly:Boolean},se=[...Be,"start","finish","added","removed"];function je(t){const _=ue(),{props:l,slots:g,emit:d,proxy:h}=_,{$q:c}=h,j=ge(l,c);function z(e,r,m){if(e.__status=r,r==="idle"){e.__uploaded=0,e.__progress=0,e.__sizeLabel=te(e.size),e.__progressLabel="0.00%";return}if(r==="failed"){h.$forceUpdate();return}e.__uploaded=r==="uploaded"?e.size:m,e.__progress=r==="uploaded"?1:Math.min(.9999,e.__uploaded/e.size),e.__progressLabel=le(e.__progress),h.$forceUpdate()}const S=i(()=>l.disable!==!0&&l.readonly!==!0),U=F(!1),C=F(null),f=F(null),a={files:F([]),queuedFiles:F([]),uploadedFiles:F([]),uploadedSize:F(0),updateFileStatus:z,isAlive:()=>be(_)===!1},{pickFiles:o,addFiles:v,onDragover:q,onDragleave:s,processFiles:p,getDndNode:I,maxFilesNumber:T,maxTotalSizeNumber:D}=Re({editable:S,dnd:U,getFileInput:V,addFilesToQueue:X});Object.assign(a,t({props:l,slots:g,emit:d,helpers:a})),a.isBusy===void 0&&(a.isBusy=
|