-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathchunk-2L4Y4L4P.js
More file actions
1 lines (1 loc) · 9.38 KB
/
chunk-2L4Y4L4P.js
File metadata and controls
1 lines (1 loc) · 9.38 KB
1
import{$a as h,Aa as R,Ab as fe,C as X,Cb as ge,Eb as ze,Ee as Ie,Fa as j,Fe as ke,Ga as le,L as Y,La as S,N as Z,Ne as xe,Of as Ve,Pa as y,Qa as de,Rb as be,Se as Te,T as J,Tc as De,Tf as $e,U as ee,Ua as D,Ue as W,V as te,Wa as N,Y as r,Za as me,_a as ce,aa as O,ab as d,ac as Ce,ba as E,bb as m,c as V,cb as ue,d as q,dc as z,e as C,ea as ne,ga as M,ha as ie,hc as k,i as G,ic as _e,j as $,ja as v,jb as he,jc as ve,k as K,ka as ae,kd as p,lb as w,lc as Se,m as U,ma as oe,md as Q,nb as c,ne as Ne,oa as se,ob as A,pb as F,pc as b,pe as we,ub as pe,uc as ye,vb as B,w as _,wb as I,xa as l,xb as H,za as re,zb as P}from"./chunk-NAM4QUWH.js";var Fe=["content"],Be=["nz-segmented-item",""],Oe=["*"];function He(n,o){}function Pe(n,o){if(n&1&&(d(0,"span"),S(1,He,0,0,"ng-template",3),m()),n&2){c(2);let t=H(5);l(),h("ngTemplateOutlet",t)}}function Qe(n,o){if(n&1&&(d(0,"span",4),ue(1,"nz-icon",5),m(),D(2,Pe,2,1,"span")),n&2){let t=c();l(),h("nzType",o),l(),N(t.hasLabel()?2:-1)}}function We(n,o){}function Le(n,o){if(n&1&&S(0,We,0,0,"ng-template",3),n&2){c();let t=H(5);h("ngTemplateOutlet",t)}}function qe(n,o){n&1&&F(0)}var Ge=(n,o)=>o.value;function Ke(n,o){if(n&1){let t=he();d(0,"div",2),de(function(){O(t);let e=c();return E(e.thumbAnimationEnter())}),w("transitionend",function(e){O(t);let i=c();return E(i.handleTransitionEnd(e))}),m()}if(n&2){let t=c();fe(t.thumbStyle())}}function Ue(n,o){if(n&1&&(d(0,"label",3),ge(1),m()),n&2){let t=o.$implicit;h("nzIcon",t.icon)("nzValue",t.value)("nzDisabled",t.disabled),l(),ze(" ",t.label," ")}}function Xe(n,o){if(n&1&&me(0,Ue,2,4,"label",3,Ge),n&2){let t=c();ce(t.normalizedOptions)}}var L=(()=>{class n{defaultName=r(Ve).getId("segmented_");name=v(this.defaultName);selected$=new C(1);activated$=new C(1);change$=new V;disabled$=new C(1);animating$=new q(!1);keydown$=new V;_animating=Q(this.animating$,{initialValue:!1});animationEnabled=Ie(()=>!0);showThumb=z(()=>this.animationEnabled()&&this._animating());constructor(){r(M).onDestroy(()=>{this.selected$.complete(),this.activated$.complete(),this.change$.complete(),this.disabled$.complete(),this.animating$.complete(),this.keydown$.complete()})}setName(t){this.name.set(typeof t>"u"?this.defaultName:t)}static \u0275fac=function(s){return new(s||n)};static \u0275prov=ee({token:n,factory:n.\u0275fac})}return n})(),f=(()=>{class n{service=r(L);elementRef=r(se);destroyRef=r(M);templateRef=_e.required("content",{read:R});nzValue=k.required();nzIcon=k();nzDisabled=k(!1,{transform:b});hasLabel=z(()=>this.templateRef().createEmbeddedView({}).rootNodes.some(t=>t.textContent.trim().length>0));showThumb=this.service.showThumb;name=this.service.name.asReadonly();isChecked=v(!1);parentDisabled=Q(this.service.disabled$,{initialValue:!1});finalDisabled=z(()=>this.nzDisabled()||this.parentDisabled());ngOnInit(){this.service.selected$.pipe(Z(t=>{this.isChecked.set(!1),t===this.nzValue()&&this.service.activated$.next(this.elementRef.nativeElement)}),Y(t=>this.service.animationEnabled()?this.service.animating$.pipe(_(s=>!s),X(1),U(()=>t)):K(t)),_(t=>t===this.nzValue()),p(this.destroyRef)).subscribe(()=>this.isChecked.set(!0))}handleClick(){!this.nzDisabled()&&!this.parentDisabled()&&(this.service.selected$.next(this.nzValue()),this.service.change$.next(this.nzValue()))}handleKeydown(t){this.finalDisabled()||(t.keyCode===37||t.keyCode===39||t.keyCode===38||t.keyCode===40)&&this.service.keydown$.next(t)}static \u0275fac=function(s){return new(s||n)};static \u0275cmp=j({type:n,selectors:[["label","nz-segmented-item",""],["label","nzSegmentedItem",""]],viewQuery:function(s,e){s&1&&B(e.templateRef,Fe,5,R),s&2&&I()},hostAttrs:[1,"ant-segmented-item"],hostVars:4,hostBindings:function(s,e){s&1&&w("click",function(){return e.handleClick()})("keydown",function(a){return e.handleKeydown(a)}),s&2&&P("ant-segmented-item-selected",!e.showThumb()&&e.isChecked())("ant-segmented-item-disabled",e.finalDisabled())},inputs:{nzValue:[1,"nzValue"],nzIcon:[1,"nzIcon"],nzDisabled:[1,"nzDisabled"]},exportAs:["nzSegmentedItem"],attrs:Be,ngContentSelectors:Oe,decls:6,vars:5,consts:[["content",""],["type","radio",1,"ant-segmented-item-input",3,"click","disabled","checked"],[1,"ant-segmented-item-label"],[3,"ngTemplateOutlet"],[1,"ant-segmented-item-icon"],[3,"nzType"]],template:function(s,e){if(s&1&&(A(),d(0,"input",1),w("click",function(a){return a.stopPropagation()}),m(),d(1,"div",2),D(2,Qe,3,2)(3,Le,1,1,null,3),m(),S(4,qe,1,0,"ng-template",null,0,Ce)),s&2){let i;h("disabled",e.finalDisabled())("checked",e.isChecked()),y("name",e.name()),l(),y("aria-selected",e.isChecked()),l(),N((i=e.nzIcon())?2:3,i)}},dependencies:[W,Te,ye],encapsulation:2,changeDetection:0})}return n})();function Ye(n){return n.map(o=>typeof o=="string"||typeof o=="number"?{label:`${o}`,value:o}:o)}var Ze="segmented",Je=(()=>{let n,o=[],t=[];return class x{static{let e=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;n=[Ne()],G(null,null,n,{kind:"field",name:"nzSize",static:!1,private:!1,access:{has:i=>"nzSize"in i,get:i=>i.nzSize,set:(i,a)=>{i.nzSize=a}},metadata:e},o,t),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}_nzModuleName=Ze;service=r(L);injector=r(ne);dir=r(De).valueSignal;nzBlock=!1;nzDisabled=!1;nzOptions=[];nzVertical=!1;nzShape="default";nzSize=$(this,o,"default");nzName=$(this,t);nzValueChange=new ie;viewItemCmps=ve(f);contentItemCmps=Se(f);renderedItemCmps=z(()=>this.viewItemCmps().concat(this.contentItemCmps()));isDisabledFirstChange=!0;value;thumbStyle=v(null);thumbAnimationEnter=ke(()=>"ant-segmented-thumb-motion-appear-active");showThumb=this.service.showThumb;normalizedOptions=[];onChange=()=>{};onTouched=()=>{};constructor(){this.service.selected$.pipe(p()).subscribe(e=>{this.value=e}),this.service.activated$.pipe(p()).subscribe(e=>{this.thumbStyle.update(i=>{let a=this.calcThumbStyle(e);if(i&&a)we(()=>{this.thumbStyle.set(this.getThumbStyle(a))});else if(a)return this.getThumbStyle(a);return i})}),this.service.change$.pipe(p()).subscribe(e=>{this.nzValueChange.emit(e),this.onChange(e),this.service.animating$.next(!0)}),this.service.keydown$.pipe(_(()=>!this.nzDisabled),p()).subscribe(e=>this.onKeyDown(e)),re(()=>{ae(()=>{let e=this.renderedItemCmps();e.length&&(this.value===void 0||!e.some(i=>i.nzValue()===this.value))&&this.service.selected$.next(e[0].nzValue())},{injector:this.injector})})}ngOnChanges(e){let{nzName:i,nzOptions:a,nzDisabled:u}=e;i&&this.service.setName(this.nzName),a&&(this.normalizedOptions=Ye(a.currentValue)),u&&this.service.disabled$.next(u.currentValue)}onOffset(e){let i=this.renderedItemCmps(),a=i.length,u=i.findIndex(Ee=>Ee.nzValue()===this.value),g=(u+e+a)%a;for(;i[g].nzDisabled()&&(g=(g+Math.sign(e)+a)%a,g!==u););let T=i[g];T&&(this.service.selected$.next(T.nzValue()),this.service.change$.next(T.nzValue()))}onKeyDown(e){switch(e.keyCode){case 38:this.onOffset(-1);break;case 37:this.onOffset(this.dir()==="rtl"?1:-1);break;case 40:this.onOffset(1);break;case 39:this.onOffset(this.dir()==="rtl"?-1:1);break}}writeValue(e){this.service.selected$.next(e)}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){this.nzDisabled=this.isDisabledFirstChange&&this.nzDisabled||e,this.isDisabledFirstChange=!1}calcThumbStyle(e){if(!e||!e.offsetParent)return null;let i=e.parentElement;if(!i)return null;let a={left:e.offsetLeft,right:i.clientWidth-e.clientWidth-e.offsetLeft,width:e.clientWidth,top:e.offsetTop,bottom:i.clientHeight-e.clientHeight-e.offsetTop,height:e.clientHeight};return this.nzVertical?{left:0,right:0,width:0,top:a.top,bottom:a.bottom,height:a.height}:{left:a.left,right:a.right,width:a.width,top:0,bottom:0,height:0}}getThumbStyle(e){return this.nzVertical?{transform:`translateY(${e.top}px)`,width:"100%",height:`${e.height}px`}:{transform:`translateX(${this.dir()==="rtl"?-e.right:e.left}px)`,width:`${e.width}px`,height:"100%"}}handleTransitionEnd(e){e.propertyName==="transform"&&this.service.animating$.next(!1)}static \u0275fac=function(i){return new(i||x)};static \u0275cmp=j({type:x,selectors:[["nz-segmented"]],contentQueries:function(i,a,u){i&1&&pe(u,a.contentItemCmps,f,4),i&2&&I()},viewQuery:function(i,a){i&1&&B(a.viewItemCmps,f,5),i&2&&I()},hostAttrs:["role","radiogroup","aria-label","segmented control",1,"ant-segmented"],hostVars:15,hostBindings:function(i,a){i&2&&(y("tabindex",a.nzDisabled?void 0:0),P("ant-segmented-disabled",a.nzDisabled)("ant-segmented-rtl",a.dir()==="rtl")("ant-segmented-lg",a.nzSize==="large")("ant-segmented-sm",a.nzSize==="small")("ant-segmented-block",a.nzBlock)("ant-segmented-vertical",a.nzVertical)("ant-segmented-shape-round",a.nzShape==="round"))},inputs:{nzBlock:[2,"nzBlock","nzBlock",b],nzDisabled:[2,"nzDisabled","nzDisabled",b],nzOptions:"nzOptions",nzVertical:[2,"nzVertical","nzVertical",b],nzShape:"nzShape",nzSize:"nzSize",nzName:"nzName"},outputs:{nzValueChange:"nzValueChange"},exportAs:["nzSegmented"],features:[be([L,{provide:$e,useExisting:J(()=>x),multi:!0}]),oe],ngContentSelectors:Oe,decls:4,vars:1,consts:[[1,"ant-segmented-group"],[1,"ant-segmented-thumb",3,"style"],[1,"ant-segmented-thumb",3,"transitionend"],["nz-segmented-item","",3,"nzIcon","nzValue","nzDisabled"]],template:function(i,a){i&1&&(A(),d(0,"div",0),D(1,Ke,1,2,"div",1),F(2,0,null,Xe,2,0),m()),i&2&&(l(),N(a.showThumb()?1:-1))},dependencies:[W,xe,f],encapsulation:2,changeDetection:0})}})(),yt=(()=>{class n{static \u0275fac=function(s){return new(s||n)};static \u0275mod=le({type:n});static \u0275inj=te({imports:[Je,f]})}return n})();export{f as a,Je as b,yt as c};