Files
aula-manager/chunk-C2blguT0.js
2026-07-05 17:54:50 +07:00

2 lines
8.1 KiB
JavaScript

import{a as i,l as r,m as U,g as M,x as V,a3 as X,Z}from"./chunk-DhYw-kuD.js";import{f as z,u as Y,a as p,Q as O,h as ee}from"./chunk-CusLMHK2.js";import{B as A,C as f,I as _,G as te,J as ne,$ as ae}from"./app-CPb3bToC.js";import{R as ue}from"./chunk-C7mbSHwF.js";import{b as le,a as ie}from"./chunk-CoZXVP_c.js";const re={size:{type:[String,Number],default:"1em"},color:String};function oe(e){return{cSize:i(()=>e.size in z?`${z[e.size]}px`:e.size),classes:i(()=>"q-spinner"+(e.color?` text-${e.color}`:""))}}const se=A({name:"QSpinner",props:{...re,thickness:{type:Number,default:5}},setup(e){const{cSize:l,classes:v}=oe(e);return()=>r("svg",{class:v.value+" q-spinner-mat",width:l.value,height:l.value,viewBox:"25 25 50 50"},[r("circle",{class:"path",cx:"50",cy:"50",r:"20",fill:"none",stroke:"currentColor","stroke-width":e.thickness,"stroke-miterlimit":"10"})])}}),Q={left:"start",center:"center",right:"end",between:"between",around:"around",evenly:"evenly",stretch:"stretch"},ce=Object.keys(Q),de={align:{type:String,validator:e=>ce.includes(e)}};function ve(e){return i(()=>{const l=e.align===void 0?e.vertical===!0?"stretch":"left":e.align;return`${e.vertical===!0?"items":"justify"}-${Q[l]}`})}const j={none:0,xs:4,sm:8,md:16,lg:24,xl:32},fe={xs:8,sm:10,md:14,lg:20,xl:24},be=["button","submit","reset"],ge=/[^\s]\/[^\s]/,me=["flat","outline","push","unelevated"];function K(e,l){return e.flat===!0?"flat":e.outline===!0?"outline":e.push===!0?"push":e.unelevated===!0?"unelevated":l}function Le(e){const l=K(e);return l!==void 0?{[l]:!0}:{}}const he={...Y,...le,type:{type:String,default:"button"},label:[Number,String],icon:String,iconRight:String,...me.reduce((e,l)=>(e[l]=Boolean)&&e,{}),square:Boolean,rounded:Boolean,glossy:Boolean,size:String,fab:Boolean,fabMini:Boolean,padding:String,color:String,textColor:String,noCaps:Boolean,noWrap:Boolean,dense:Boolean,tabindex:[Number,String],ripple:{type:[Boolean,Object],default:!0},align:{...de.align,default:"center"},stack:Boolean,stretch:Boolean,loading:{type:Boolean,default:null},disable:Boolean},ye={...he,round:Boolean};function ke(e){const l=p(e,fe),v=ve(e),{hasRouterLink:x,hasLink:E,linkTag:B,linkAttrs:w,navigateOnClick:T}=ie({fallbackTag:"button"}),P=i(()=>{const a=e.fab===!1&&e.fabMini===!1?l.value:{};return e.padding!==void 0?Object.assign({},a,{padding:e.padding.split(/\s+/).map(d=>d in j?j[d]+"px":d).join(" "),minWidth:"0",minHeight:"0"}):a}),R=i(()=>e.rounded===!0||e.fab===!0||e.fabMini===!0),h=i(()=>e.disable!==!0&&e.loading!==!0),S=i(()=>h.value===!0?e.tabindex||0:-1),n=i(()=>K(e,"standard")),L=i(()=>{const a={tabindex:S.value};return E.value===!0?Object.assign(a,w.value):be.includes(e.type)===!0&&(a.type=e.type),B.value==="a"?(e.disable===!0?a["aria-disabled"]="true":a.href===void 0&&(a.role="button"),x.value!==!0&&ge.test(e.type)===!0&&(a.type=e.type)):e.disable===!0&&(a.disabled="",a["aria-disabled"]="true"),e.loading===!0&&e.percentage!==void 0&&Object.assign(a,{role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e.percentage}),a}),c=i(()=>{let a;e.color!==void 0?e.flat===!0||e.outline===!0?a=`text-${e.textColor||e.color}`:a=`bg-${e.color} text-${e.textColor||"white"}`:e.textColor&&(a=`text-${e.textColor}`);const d=e.round===!0?"round":`rectangle${R.value===!0?" q-btn--rounded":e.square===!0?" q-btn--square":""}`;return`q-btn--${n.value} q-btn--${d}`+(a!==void 0?" "+a:"")+(h.value===!0?" q-btn--actionable q-focusable q-hoverable":e.disable===!0?" disabled":"")+(e.fab===!0?" q-btn--fab":e.fabMini===!0?" q-btn--fab-mini":"")+(e.noCaps===!0?" q-btn--no-uppercase":"")+(e.dense===!0?" q-btn--dense":"")+(e.stretch===!0?" no-border-radius self-stretch":"")+(e.glossy===!0?" glossy":"")+(e.square?" q-btn--square":"")}),y=i(()=>v.value+(e.stack===!0?" column":" row")+(e.noWrap===!0?" no-wrap text-no-wrap":"")+(e.loading===!0?" q-btn__content--hidden":""));return{classes:c,style:P,innerClasses:y,attributes:L,hasLink:E,linkTag:B,navigateOnClick:T,isActionable:h}}const{passiveCapture:o}=ae;let b=null,g=null,m=null;const Ce=A({name:"QBtn",props:{...ye,percentage:Number,darkPercentage:Boolean,onTouchstart:[Function,Array]},emits:["click","keydown","mousedown","keyup"],setup(e,{slots:l,emit:v}){const{proxy:x}=U(),{classes:E,style:B,innerClasses:w,attributes:T,hasLink:P,linkTag:R,navigateOnClick:h,isActionable:S}=ke(e),n=M(null),L=M(null);let c=null,y,a=null;const d=i(()=>e.label!==void 0&&e.label!==null&&e.label!==""),N=i(()=>e.disable===!0||e.ripple===!1?!1:{keyCodes:P.value===!0?[13,32]:[13],...e.ripple===!0?{}:e.ripple}),D=i(()=>({center:e.round})),I=i(()=>{const t=Math.max(0,Math.min(100,e.percentage));return t>0?{transition:"transform 0.6s",transform:`translateX(${t-100}%)`}:{}}),W=i(()=>{if(e.loading===!0)return{onMousedown:q,onTouchstart:q,onClick:q,onKeydown:q,onKeyup:q};if(S.value===!0){const t={onClick:$,onKeydown:G,onMousedown:J};if(x.$q.platform.has.touch===!0){const u=e.onTouchstart!==void 0?"":"Passive";t[`onTouchstart${u}`]=H}return t}return{onClick:f}}),F=i(()=>({ref:n,class:"q-btn q-btn-item non-selectable no-outline "+E.value,style:B.value,...T.value,...W.value}));function $(t){if(n.value!==null){if(t!==void 0){if(t.defaultPrevented===!0)return;const u=document.activeElement;if(e.type==="submit"&&u!==document.body&&n.value.contains(u)===!1&&u.contains(n.value)===!1){n.value.focus();const C=()=>{document.removeEventListener("keydown",f,!0),document.removeEventListener("keyup",C,o),n.value!==null&&n.value.removeEventListener("blur",C,o)};document.addEventListener("keydown",f,!0),document.addEventListener("keyup",C,o),n.value.addEventListener("blur",C,o)}}h(t)}}function G(t){n.value!==null&&(v("keydown",t),_(t,[13,32])===!0&&g!==n.value&&(g!==null&&k(),t.defaultPrevented!==!0&&(n.value.focus(),g=n.value,n.value.classList.add("q-btn--active"),document.addEventListener("keyup",s,!0),n.value.addEventListener("blur",s,o)),f(t)))}function H(t){n.value!==null&&(v("touchstart",t),t.defaultPrevented!==!0&&(b!==n.value&&(b!==null&&k(),b=n.value,c=t.target,c.addEventListener("touchcancel",s,o),c.addEventListener("touchend",s,o)),y=!0,a!==null&&clearTimeout(a),a=setTimeout(()=>{a=null,y=!1},200)))}function J(t){n.value!==null&&(t.qSkipRipple=y===!0,v("mousedown",t),t.defaultPrevented!==!0&&m!==n.value&&(m!==null&&k(),m=n.value,n.value.classList.add("q-btn--active"),document.addEventListener("mouseup",s,o)))}function s(t){if(n.value!==null&&!(t!==void 0&&t.type==="blur"&&document.activeElement===n.value)){if(t!==void 0&&t.type==="keyup"){if(g===n.value&&_(t,[13,32])===!0){const u=new MouseEvent("click",t);u.qKeyEvent=!0,t.defaultPrevented===!0&&te(u),t.cancelBubble===!0&&ne(u),n.value.dispatchEvent(u),f(t),t.qKeyEvent=!0}v("keyup",t)}k()}}function k(t){const u=L.value;t!==!0&&(b===n.value||m===n.value)&&u!==null&&u!==document.activeElement&&(u.setAttribute("tabindex",-1),u.focus()),b===n.value&&(c!==null&&(c.removeEventListener("touchcancel",s,o),c.removeEventListener("touchend",s,o)),b=c=null),m===n.value&&(document.removeEventListener("mouseup",s,o),m=null),g===n.value&&(document.removeEventListener("keyup",s,!0),n.value!==null&&n.value.removeEventListener("blur",s,o),g=null),n.value!==null&&n.value.classList.remove("q-btn--active")}function q(t){f(t),t.qSkipRipple=!0}return V(()=>{k(!0)}),Object.assign(x,{click:t=>{S.value===!0&&$(t)}}),()=>{let t=[];e.icon!==void 0&&t.push(r(O,{name:e.icon,left:e.stack!==!0&&d.value===!0,role:"img"})),d.value===!0&&t.push(r("span",{class:"block"},[e.label])),t=ee(l.default,t),e.iconRight!==void 0&&e.round===!1&&t.push(r(O,{name:e.iconRight,right:e.stack!==!0&&d.value===!0,role:"img"}));const u=[r("span",{class:"q-focus-helper",ref:L})];return e.loading===!0&&e.percentage!==void 0&&u.push(r("span",{class:"q-btn__progress absolute-full overflow-hidden"+(e.darkPercentage===!0?" q-btn__progress--dark":"")},[r("span",{class:"q-btn__progress-indicator fit block",style:I.value})])),u.push(r("span",{class:"q-btn__content text-center col items-center q-anchor--skip "+w.value},t)),e.loading!==null&&u.push(r(X,{name:"q-transition--fade"},()=>e.loading===!0?[r("span",{key:"loading",class:"absolute-full flex flex-center"},l.loading!==void 0?l.loading():[r(se)])]:null)),Z(r(R.value,F.value,u),[[ue,N.value,void 0,D.value]])}}});export{Ce as Q,se as a,ve as b,Le as g,de as u};