UNPKG

@sync-in/server

Version:

The secure, open-source platform for file storage, sharing, collaboration, and sync

2 lines (1 loc) 9.19 kB
import{Aa as k,Ac as B,Bb as O,Eb as b,Gb as _,Gc as K,Hb as V,Ib as P,Ic as U,Jc as $,Oa as f,Qa as y,Qc as H,Ra as E,Rb as p,Ta as R,Tb as I,Ub as N,Wa as D,Xa as o,Ya as x,ab as L,bb as S,cb as T,db as F,ea as M,fa as A,fb as j,gc as z,ja as w,kb as C,oa as v,pa as g,rb as u,sb as h,tb as m}from"./chunk-D55YR5X7.js";import{n as c}from"./chunk-DM4NXKEP.js";var ne=(()=>{let s=class s{constructor(){this.cdRef=w(B),this.ngZone=w(E)}format(e){return e.from(c(),this.lastOmitSuffix)}transform(e,t,i){return this.hasChanged(e,t)?(this.lastTime=this.getTime(e),this.lastValue=e,this.lastOmitSuffix=t,this.lastLocale=this.getLocale(e),this.formatFn=i||this.format.bind(this),this.removeTimer(),this.createTimer(),this.lastText=this.formatFn(c(e))):this.createTimer(),this.lastText}ngOnDestroy(){this.removeTimer()}createTimer(){if(this.currentTimer)return;let e=c(this.lastValue),t=this.getSecondsUntilUpdate(e)*1e3;this.currentTimer=this.ngZone.runOutsideAngular(()=>typeof window<"u"?window.setTimeout(()=>{this.lastText=this.formatFn(c(this.lastValue)),this.currentTimer=null,this.ngZone.run(()=>this.cdRef.markForCheck())},t):null)}removeTimer(){this.currentTimer&&(window.clearTimeout(this.currentTimer),this.currentTimer=null)}getSecondsUntilUpdate(e){let t=Math.abs(c().diff(e,"minute"));return t<1?1:t<60?30:t<180?300:3600}hasChanged(e,t){return this.getTime(e)!==this.lastTime||this.getLocale(e)!==this.lastLocale||t!==this.lastOmitSuffix}getTime(e){return e instanceof Date?e.getTime():c.isDayjs(e)?e.valueOf():c(e).valueOf()}getLocale(e){return c.isDayjs(e)?e.locale():c.locale()}};s.\u0275fac=function(t){return new(t||s)},s.\u0275pipe=F({name:"amTimeAgo",type:s,pure:!1});let n=s;return n})();var q=["*"],J=n=>["nav-item",n];function G(n,s){if(n&1){let l=O();h(0,"span",7),b("click",function(t){v(l);let i=_().$implicit,r=_();return t.preventDefault(),g(r.removeTab(i))}),I(1," \u274C"),m()}}function Q(n,s){if(n&1){let l=O();h(0,"li",3),b("keydown",function(t){let i=v(l).index,r=_();return g(r.keyNavActions(t,i))}),h(1,"a",4),b("click",function(){let t=v(l).$implicit;return g(t.active=!0)}),h(2,"span",5),I(3),m(),j(4,G,2,0,"span",6),m()()}if(n&2){let l=s.$implicit;p("active",l.active)("disabled",l.disabled),u("ngClass",z(15,J,l.customClass||"")),f(),p("active",l.active)("disabled",l.disabled),C("aria-controls",l.id?l.id:"")("aria-selected",!!l.active)("id",l.id?l.id+"-link":""),f(),u("ngTransclude",l.headingRef),f(),N(l.heading),f(),u("ngIf",l.removable)}}var W=(()=>{let s=class s{set ngTransclude(e){this._ngTransclude=e,e&&this.viewRef.createEmbeddedView(e)}get ngTransclude(){return this._ngTransclude}constructor(e){this.viewRef=e}};s.\u0275fac=function(t){return new(t||s)(o(x))},s.\u0275dir=T({type:s,selectors:[["","ngTransclude",""]],inputs:{ngTransclude:"ngTransclude"}});let n=s;return n})(),X=(()=>{let s=class s{constructor(){this.type="tabs",this.isKeysAllowed=!0,this.ariaLabel="Tabs"}};s.\u0275fac=function(t){return new(t||s)},s.\u0275prov=M({token:s,factory:s.\u0275fac,providedIn:"root"});let n=s;return n})(),Y=(()=>{let s=class s{get vertical(){return this._vertical}set vertical(e){this._vertical=e,this.setClassMap()}get justified(){return this._justified}set justified(e){this._justified=e,this.setClassMap()}get type(){return this._type}set type(e){this._type=e,this.setClassMap()}get isKeysAllowed(){return this._isKeysAllowed}set isKeysAllowed(e){this._isKeysAllowed=e}constructor(e,t,i){this.renderer=t,this.elementRef=i,this.clazz=!0,this.tabs=[],this.classMap={},this.ariaLabel="Tabs",this.isDestroyed=!1,this._vertical=!1,this._justified=!1,this._type="tabs",this._isKeysAllowed=!0,this.defaultActivationScheduled=!1,Object.assign(this,e)}ngOnDestroy(){this.isDestroyed=!0}addTab(e){if(e.tabOrder!==void 0?this.insertTabByOrder(e):this.tabs.push(e),e.active){e.active=!0;return}this.defaultActivationScheduled||(this.defaultActivationScheduled=!0,Promise.resolve().then(()=>{if(this.defaultActivationScheduled=!1,!this.tabs.length||this.tabs.some(i=>!!i.active))return;let t=this.tabs.find(i=>!i.disabled);t&&(t.active=!0)}))}insertTabByOrder(e){let t=this.tabs.length;for(let i=0;i<this.tabs.length;i++){let r=this.tabs[i];if(r.tabOrder!==void 0&&e.tabOrder!==void 0&&e.tabOrder<r.tabOrder){t=i;break}if(r.tabOrder===void 0){t=i;break}}this.tabs.splice(t,0,e)}removeTab(e,t={reselect:!0,emit:!0}){let i=this.tabs.indexOf(e);if(!(i===-1||this.isDestroyed)){if(t.reselect&&e.active&&this.hasAvailableTabs(i)){let r=this.getClosestTabIndex(i);this.tabs[r].active=!0}t.emit&&e.removed.emit(e),this.tabs.splice(i,1),e.elementRef.nativeElement.parentNode&&this.renderer.removeChild(e.elementRef.nativeElement.parentNode,e.elementRef.nativeElement)}}keyNavActions(e,t){if(!this.isKeysAllowed)return;let i=Array.from(this.elementRef.nativeElement.querySelectorAll(".nav-link"));if(e.keyCode===13||e.key==="Enter"||e.keyCode===32||e.key==="Space"){e.preventDefault(),i[t%i.length].click();return}if(e.keyCode===39||e.key==="RightArrow"){let r,a=1;do r=i[(t+a)%i.length],a++;while(r.classList.contains("disabled"));r.focus();return}if(e.keyCode===37||e.key==="LeftArrow"){let r,a=1,d=t;do d-a<0?(d=i.length-1,r=i[d],a=0):r=i[d-a],a++;while(r.classList.contains("disabled"));r.focus();return}if(e.keyCode===36||e.key==="Home"){e.preventDefault();let r,a=0;do r=i[a%i.length],a++;while(r.classList.contains("disabled"));r.focus();return}if(e.keyCode===35||e.key==="End"){e.preventDefault();let r,a=1,d=t;do d-a<0?(d=i.length-1,r=i[d],a=0):r=i[d-a],a++;while(r.classList.contains("disabled"));r.focus();return}if((e.keyCode===46||e.key==="Delete")&&this.tabs[t].removable){if(this.removeTab(this.tabs[t]),i[t+1]){i[(t+1)%i.length].focus();return}i[i.length-1]&&i[0].focus()}}getClosestTabIndex(e){let t=this.tabs.length;if(!t)return-1;for(let i=1;i<=t;i+=1){let r=e-i,a=e+i;if(this.tabs[r]&&!this.tabs[r].disabled)return r;if(this.tabs[a]&&!this.tabs[a].disabled)return a}return-1}hasAvailableTabs(e){let t=this.tabs.length;if(!t)return!1;for(let i=0;i<t;i+=1)if(!this.tabs[i].disabled&&i!==e)return!0;return!1}setClassMap(){this.classMap={"nav-stacked":this.vertical,"flex-column":this.vertical,"nav-justified":this.justified,[`nav-${this.type}`]:!0}}};s.\u0275fac=function(t){return new(t||s)(o(X),o(D),o(k))},s.\u0275cmp=L({type:s,selectors:[["tabset"]],hostVars:2,hostBindings:function(t,i){t&2&&p("tab-container",i.clazz)},inputs:{vertical:"vertical",justified:"justified",type:"type"},ngContentSelectors:q,decls:4,vars:3,consts:[["role","tablist",1,"nav",3,"click","ngClass"],[3,"ngClass","active","disabled","keydown",4,"ngFor","ngForOf"],[1,"tab-content"],[3,"keydown","ngClass"],["href","javascript:void(0);","role","tab",1,"nav-link",3,"click"],[3,"ngTransclude"],["class","bs-remove-tab",3,"click",4,"ngIf"],[1,"bs-remove-tab",3,"click"]],template:function(t,i){t&1&&(V(),h(0,"ul",0),b("click",function(a){return a.preventDefault()}),j(1,Q,5,17,"li",1),m(),h(2,"div",2),P(3),m()),t&2&&(u("ngClass",i.classMap),C("aria-label",i.ariaLabel),f(),u("ngForOf",i.tabs))},dependencies:[K,U,W,$],styles:["[_nghost-%COMP%] .nav-tabs[_ngcontent-%COMP%] .nav-item.disabled[_ngcontent-%COMP%] a.disabled[_ngcontent-%COMP%]{cursor:default}"]});let n=s;return n})(),ee=(()=>{let s=class s{get customClass(){return this._customClass}set customClass(e){this.customClass&&this.customClass.split(" ").forEach(t=>{this.renderer.removeClass(this.elementRef.nativeElement,t)}),this._customClass=e?e.trim():"",this.customClass&&this.customClass.split(" ").forEach(t=>{this.renderer.addClass(this.elementRef.nativeElement,t)})}get active(){return this._active}set active(e){if(this._active!==e){if(this.disabled&&e||!e){this._active&&!e&&(this.deselect.emit(this),this._active=e);return}this._active=e,this.selectTab.emit(this),this.tabset.tabs.forEach(t=>{t!==this&&(t.active=!1)})}}get ariaLabelledby(){return this.id?`${this.id}-link`:""}constructor(e,t,i){this.elementRef=t,this.renderer=i,this.disabled=!1,this.removable=!1,this.selectTab=new y,this.deselect=new y,this.removed=new y,this.addClass=!0,this.role="tabpanel",this._active=!1,this._customClass="",this.tabset=e}ngOnInit(){this.removable=!!this.removable,this.tabset.addTab(this)}ngOnDestroy(){this.tabset.removeTab(this,{reselect:!1,emit:!1})}};s.\u0275fac=function(t){return new(t||s)(o(Y),o(k),o(D))},s.\u0275dir=T({type:s,selectors:[["tab"],["","tab",""]],hostVars:7,hostBindings:function(t,i){t&2&&(C("id",i.id)("role",i.role)("aria-labelledby",i.ariaLabelledby),p("active",i.active)("tab-pane",i.addClass))},inputs:{heading:"heading",id:"id",disabled:"disabled",removable:"removable",tabOrder:"tabOrder",customClass:"customClass",active:"active"},outputs:{selectTab:"selectTab",deselect:"deselect",removed:"removed"},exportAs:["tab"]});let n=s;return n})(),be=(()=>{let s=class s{constructor(e,t){t.headingRef=e}};s.\u0275fac=function(t){return new(t||s)(o(R),o(ee))},s.\u0275dir=T({type:s,selectors:[["","tabHeading",""]]});let n=s;return n})(),pe=(()=>{let s=class s{static forRoot(){return{ngModule:s,providers:[]}}};s.\u0275fac=function(t){return new(t||s)},s.\u0275mod=S({type:s}),s.\u0275inj=A({imports:[H]});let n=s;return n})();export{Y as a,ee as b,be as c,pe as d,ne as e};