-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path5945.83b294467406eed5.js
1 lines (1 loc) · 16.1 KB
/
5945.83b294467406eed5.js
1
"use strict";(self.webpackChunkmaterial_angular_io=self.webpackChunkmaterial_angular_io||[]).push([[5945],{5945:(O,v,h)=>{h.r(v),h.d(v,{SortHarnessExample:()=>e,SortOverviewExample:()=>D});var t=h(4438),m=h(2042);function w(n,g){if(1&n&&(t.j41(0,"tr")(1,"td"),t.EFF(2),t.k0s(),t.j41(3,"td"),t.EFF(4),t.k0s(),t.j41(5,"td"),t.EFF(6),t.k0s(),t.j41(7,"td"),t.EFF(8),t.k0s(),t.j41(9,"td"),t.EFF(10),t.k0s()()),2&n){const a=g.$implicit;t.R7$(2),t.JRh(a.name),t.R7$(2),t.JRh(a.calories),t.R7$(2),t.JRh(a.fat),t.R7$(2),t.JRh(a.carbs),t.R7$(2),t.JRh(a.protein)}}function E(n,g){if(1&n&&(t.j41(0,"tr")(1,"td"),t.EFF(2),t.k0s(),t.j41(3,"td"),t.EFF(4),t.k0s(),t.j41(5,"td"),t.EFF(6),t.k0s(),t.j41(7,"td"),t.EFF(8),t.k0s(),t.j41(9,"td"),t.EFF(10),t.k0s()()),2&n){const a=g.$implicit;t.R7$(2),t.JRh(a.name),t.R7$(2),t.JRh(a.calories),t.R7$(2),t.JRh(a.fat),t.R7$(2),t.JRh(a.carbs),t.R7$(2),t.JRh(a.protein)}}let D=(()=>{class n{constructor(){this.desserts=[{name:"Frozen yogurt",calories:159,fat:6,carbs:24,protein:4},{name:"Ice cream sandwich",calories:237,fat:9,carbs:37,protein:4},{name:"Eclair",calories:262,fat:16,carbs:24,protein:6},{name:"Cupcake",calories:305,fat:4,carbs:67,protein:4},{name:"Gingerbread",calories:356,fat:16,carbs:49,protein:4}],this.sortedData=this.desserts.slice()}sortData(a){const d=this.desserts.slice();this.sortedData=a.active&&""!==a.direction?d.sort((c,_)=>{const l="asc"===a.direction;switch(a.active){case"name":return p(c.name,_.name,l);case"calories":return p(c.calories,_.calories,l);case"fat":return p(c.fat,_.fat,l);case"carbs":return p(c.carbs,_.carbs,l);case"protein":return p(c.protein,_.protein,l);default:return 0}}):d}static#t=this.\u0275fac=function(d){return new(d||n)};static#e=this.\u0275cmp=t.VBU({type:n,selectors:[["sort-overview-example"]],standalone:!0,features:[t.aNF],decls:14,vars:0,consts:[["matSort","",3,"matSortChange"],["mat-sort-header","name"],["mat-sort-header","calories"],["mat-sort-header","fat"],["mat-sort-header","carbs"],["mat-sort-header","protein"]],template:function(d,c){1&d&&(t.j41(0,"table",0),t.bIt("matSortChange",function(l){return c.sortData(l)}),t.j41(1,"tr")(2,"th",1),t.EFF(3,"Dessert (100g)"),t.k0s(),t.j41(4,"th",2),t.EFF(5,"Calories"),t.k0s(),t.j41(6,"th",3),t.EFF(7,"Fat (g)"),t.k0s(),t.j41(8,"th",4),t.EFF(9,"Carbs (g)"),t.k0s(),t.j41(10,"th",5),t.EFF(11,"Protein (g)"),t.k0s()(),t.Z7z(12,w,11,5,"tr",null,t.fX1),t.k0s()),2&d&&(t.R7$(12),t.Dyx(c.sortedData))},dependencies:[m.NQ,m.B4,m.aE],styles:[".mat-sort-header-container[_ngcontent-%COMP%] {\n align-items: center;\n}"]})}return n})();function p(n,g,a){return(n<g?-1:1)*(a?1:-1)}let e=(()=>{class n{constructor(){this.disableThirdHeader=!1,this.desserts=[{name:"Frozen yogurt",calories:159,fat:6,carbs:24,protein:4},{name:"Ice cream sandwich",calories:237,fat:9,carbs:37,protein:4},{name:"Eclair",calories:262,fat:16,carbs:24,protein:6},{name:"Cupcake",calories:305,fat:4,carbs:67,protein:4},{name:"Gingerbread",calories:356,fat:16,carbs:49,protein:4}],this.sortedData=this.desserts.slice()}sortData(a){const d=this.desserts.slice();this.sortedData=a.active&&""!==a.direction?d.sort((c,_)=>(c[a.active]<_[a.active]?-1:1)*("asc"===a.direction?1:-1)):d}static#t=this.\u0275fac=function(d){return new(d||n)};static#e=this.\u0275cmp=t.VBU({type:n,selectors:[["sort-harness-example"]],standalone:!0,features:[t.aNF],decls:14,vars:1,consts:[["matSort","",3,"matSortChange"],["mat-sort-header","name"],["mat-sort-header","calories"],["mat-sort-header","fat",3,"disabled"],["mat-sort-header","carbs"],["mat-sort-header","protein"]],template:function(d,c){1&d&&(t.j41(0,"table",0),t.bIt("matSortChange",function(l){return c.sortData(l)}),t.j41(1,"tr")(2,"th",1),t.EFF(3,"Dessert"),t.k0s(),t.j41(4,"th",2),t.EFF(5,"Calories"),t.k0s(),t.j41(6,"th",3),t.EFF(7,"Fat"),t.k0s(),t.j41(8,"th",4),t.EFF(9,"Carbs"),t.k0s(),t.j41(10,"th",5),t.EFF(11,"Protein"),t.k0s()(),t.Z7z(12,E,11,5,"tr",null,t.fX1),t.k0s()),2&d&&(t.R7$(6),t.Y8G("disabled",c.disableThirdHeader),t.R7$(6),t.Dyx(c.sortedData))},dependencies:[m.NQ,m.B4,m.aE],encapsulation:2})}return n})()},2042:(O,v,h)=>{h.d(v,{B4:()=>M,NQ:()=>I,aE:()=>x});var t=h(4438),m=h(8617),w=h(7336),E=h(6607),D=h(5286),p=h(4670),e=h(9969),n=h(6600);const g=["mat-sort-header",""],a=["*"];function d(r,k){if(1&r){const i=t.RV6();t.j41(0,"div",2),t.bIt("@arrowPosition.start",function(){t.eBV(i);const s=t.XpG();return t.Njj(s._disableViewStateAnimation=!0)})("@arrowPosition.done",function(){t.eBV(i);const s=t.XpG();return t.Njj(s._disableViewStateAnimation=!1)}),t.nrm(1,"div",3),t.j41(2,"div",4),t.nrm(3,"div",5)(4,"div",6)(5,"div",7),t.k0s()()}if(2&r){const i=t.XpG();t.Y8G("@arrowOpacity",i._getArrowViewState())("@arrowPosition",i._getArrowViewState())("@allowChildren",i._getArrowDirectionState()),t.R7$(2),t.Y8G("@indicator",i._getArrowDirectionState()),t.R7$(),t.Y8G("@leftPointer",i._getArrowDirectionState()),t.R7$(),t.Y8G("@rightPointer",i._getArrowDirectionState())}}const C=new t.nKC("MAT_SORT_DEFAULT_OPTIONS");let M=(()=>{class r{get direction(){return this._direction}set direction(i){this._direction=i}constructor(i){this._defaultOptions=i,this._initializedStream=new E.m(1),this.sortables=new Map,this._stateChanges=new D.B7,this.start="asc",this._direction="",this.disabled=!1,this.sortChange=new t.bkB,this.initialized=this._initializedStream}register(i){this.sortables.set(i.id,i)}deregister(i){this.sortables.delete(i.id)}sort(i){this.active!=i.id?(this.active=i.id,this.direction=i.start?i.start:this.start):this.direction=this.getNextSortDirection(i),this.sortChange.emit({active:this.active,direction:this.direction})}getNextSortDirection(i){if(!i)return"";let s=function y(r,k){let i=["asc","desc"];return"desc"==r&&i.reverse(),k||i.push(""),i}(i.start||this.start,i?.disableClear??this.disableClear??!!this._defaultOptions?.disableClear),f=s.indexOf(this.direction)+1;return f>=s.length&&(f=0),s[f]}ngOnInit(){this._initializedStream.next()}ngOnChanges(){this._stateChanges.next()}ngOnDestroy(){this._stateChanges.complete(),this._initializedStream.complete()}static#t=this.\u0275fac=function(o){return new(o||r)(t.rXU(C,8))};static#e=this.\u0275dir=t.FsC({type:r,selectors:[["","matSort",""]],hostAttrs:[1,"mat-sort"],inputs:{active:[0,"matSortActive","active"],start:[0,"matSortStart","start"],direction:[0,"matSortDirection","direction"],disableClear:[2,"matSortDisableClear","disableClear",t.L39],disabled:[2,"matSortDisabled","disabled",t.L39]},outputs:{sortChange:"matSortChange"},exportAs:["matSort"],standalone:!0,features:[t.GFd,t.OA$]})}return r})();const u=n.ed.ENTERING+" "+n.r5.STANDARD_CURVE,S={indicator:(0,e.hZ)("indicator",[(0,e.wk)("active-asc, asc",(0,e.iF)({transform:"translateY(0px)"})),(0,e.wk)("active-desc, desc",(0,e.iF)({transform:"translateY(10px)"})),(0,e.kY)("active-asc <=> active-desc",(0,e.i0)(u))]),leftPointer:(0,e.hZ)("leftPointer",[(0,e.wk)("active-asc, asc",(0,e.iF)({transform:"rotate(-45deg)"})),(0,e.wk)("active-desc, desc",(0,e.iF)({transform:"rotate(45deg)"})),(0,e.kY)("active-asc <=> active-desc",(0,e.i0)(u))]),rightPointer:(0,e.hZ)("rightPointer",[(0,e.wk)("active-asc, asc",(0,e.iF)({transform:"rotate(45deg)"})),(0,e.wk)("active-desc, desc",(0,e.iF)({transform:"rotate(-45deg)"})),(0,e.kY)("active-asc <=> active-desc",(0,e.i0)(u))]),arrowOpacity:(0,e.hZ)("arrowOpacity",[(0,e.wk)("desc-to-active, asc-to-active, active",(0,e.iF)({opacity:1})),(0,e.wk)("desc-to-hint, asc-to-hint, hint",(0,e.iF)({opacity:.54})),(0,e.wk)("hint-to-desc, active-to-desc, desc, hint-to-asc, active-to-asc, asc, void",(0,e.iF)({opacity:0})),(0,e.kY)("* => asc, * => desc, * => active, * => hint, * => void",(0,e.i0)("0ms")),(0,e.kY)("* <=> *",(0,e.i0)(u))]),arrowPosition:(0,e.hZ)("arrowPosition",[(0,e.kY)("* => desc-to-hint, * => desc-to-active",(0,e.i0)(u,(0,e.i7)([(0,e.iF)({transform:"translateY(-25%)"}),(0,e.iF)({transform:"translateY(0)"})]))),(0,e.kY)("* => hint-to-desc, * => active-to-desc",(0,e.i0)(u,(0,e.i7)([(0,e.iF)({transform:"translateY(0)"}),(0,e.iF)({transform:"translateY(25%)"})]))),(0,e.kY)("* => asc-to-hint, * => asc-to-active",(0,e.i0)(u,(0,e.i7)([(0,e.iF)({transform:"translateY(25%)"}),(0,e.iF)({transform:"translateY(0)"})]))),(0,e.kY)("* => hint-to-asc, * => active-to-asc",(0,e.i0)(u,(0,e.i7)([(0,e.iF)({transform:"translateY(0)"}),(0,e.iF)({transform:"translateY(-25%)"})]))),(0,e.wk)("desc-to-hint, asc-to-hint, hint, desc-to-active, asc-to-active, active",(0,e.iF)({transform:"translateY(0)"})),(0,e.wk)("hint-to-desc, active-to-desc, desc",(0,e.iF)({transform:"translateY(-25%)"})),(0,e.wk)("hint-to-asc, active-to-asc, asc",(0,e.iF)({transform:"translateY(25%)"}))]),allowChildren:(0,e.hZ)("allowChildren",[(0,e.kY)("* <=> *",[(0,e.P)("@*",(0,e.MA)(),{optional:!0})])])};let b=(()=>{class r{constructor(){this.changes=new D.B7}static#t=this.\u0275fac=function(o){return new(o||r)};static#e=this.\u0275prov=t.jDH({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();const P={provide:b,deps:[[new t.Xx1,new t.kdw,b]],useFactory:function T(r){return r||new b}};let x=(()=>{class r{get sortActionDescription(){return this._sortActionDescription}set sortActionDescription(i){this._updateSortActionDescription(i)}constructor(i,o,s,f,F,H,B,R){this._intl=i,this._changeDetectorRef=o,this._sort=s,this._columnDef=f,this._focusMonitor=F,this._elementRef=H,this._ariaDescriber=B,this._showIndicatorHint=!1,this._viewState={},this._arrowDirection="",this._disableViewStateAnimation=!1,this.arrowPosition="after",this.disabled=!1,this._sortActionDescription="Sort",R?.arrowPosition&&(this.arrowPosition=R?.arrowPosition),this._handleStateChanges()}ngOnInit(){!this.id&&this._columnDef&&(this.id=this._columnDef.name),this._updateArrowDirection(),this._setAnimationTransitionState({toState:this._isSorted()?"active":this._arrowDirection}),this._sort.register(this),this._sortButton=this._elementRef.nativeElement.querySelector(".mat-sort-header-container"),this._updateSortActionDescription(this._sortActionDescription)}ngAfterViewInit(){this._focusMonitor.monitor(this._elementRef,!0).subscribe(i=>{const o=!!i;o!==this._showIndicatorHint&&(this._setIndicatorHintVisible(o),this._changeDetectorRef.markForCheck())})}ngOnDestroy(){this._focusMonitor.stopMonitoring(this._elementRef),this._sort.deregister(this),this._rerenderSubscription.unsubscribe(),this._sortButton&&this._ariaDescriber?.removeDescription(this._sortButton,this._sortActionDescription)}_setIndicatorHintVisible(i){this._isDisabled()&&i||(this._showIndicatorHint=i,this._isSorted()||(this._updateArrowDirection(),this._setAnimationTransitionState(this._showIndicatorHint?{fromState:this._arrowDirection,toState:"hint"}:{fromState:"hint",toState:this._arrowDirection})))}_setAnimationTransitionState(i){this._viewState=i||{},this._disableViewStateAnimation&&(this._viewState={toState:i.toState})}_toggleOnInteraction(){this._sort.sort(this),("hint"===this._viewState.toState||"active"===this._viewState.toState)&&(this._disableViewStateAnimation=!0)}_handleClick(){this._isDisabled()||this._sort.sort(this)}_handleKeydown(i){!this._isDisabled()&&(i.keyCode===w.t6||i.keyCode===w.Fm)&&(i.preventDefault(),this._toggleOnInteraction())}_isSorted(){return this._sort.active==this.id&&("asc"===this._sort.direction||"desc"===this._sort.direction)}_getArrowDirectionState(){return`${this._isSorted()?"active-":""}${this._arrowDirection}`}_getArrowViewState(){const i=this._viewState.fromState;return(i?`${i}-to-`:"")+this._viewState.toState}_updateArrowDirection(){this._arrowDirection=this._isSorted()?this._sort.direction:this.start||this._sort.start}_isDisabled(){return this._sort.disabled||this.disabled}_getAriaSortAttribute(){return this._isSorted()?"asc"==this._sort.direction?"ascending":"descending":"none"}_renderArrow(){return!this._isDisabled()||this._isSorted()}_updateSortActionDescription(i){this._sortButton&&(this._ariaDescriber?.removeDescription(this._sortButton,this._sortActionDescription),this._ariaDescriber?.describe(this._sortButton,i)),this._sortActionDescription=i}_handleStateChanges(){this._rerenderSubscription=(0,p.h)(this._sort.sortChange,this._sort._stateChanges,this._intl.changes).subscribe(()=>{this._isSorted()&&(this._updateArrowDirection(),("hint"===this._viewState.toState||"active"===this._viewState.toState)&&(this._disableViewStateAnimation=!0),this._setAnimationTransitionState({fromState:this._arrowDirection,toState:"active"}),this._showIndicatorHint=!1),!this._isSorted()&&this._viewState&&"active"===this._viewState.toState&&(this._disableViewStateAnimation=!1,this._setAnimationTransitionState({fromState:"active",toState:this._arrowDirection})),this._changeDetectorRef.markForCheck()})}static#t=this.\u0275fac=function(o){return new(o||r)(t.rXU(b),t.rXU(t.gRc),t.rXU(M,8),t.rXU("MAT_SORT_HEADER_COLUMN_DEF",8),t.rXU(m.FN),t.rXU(t.aKT),t.rXU(m.vr,8),t.rXU(C,8))};static#e=this.\u0275cmp=t.VBU({type:r,selectors:[["","mat-sort-header",""]],hostAttrs:[1,"mat-sort-header"],hostVars:3,hostBindings:function(o,s){1&o&&t.bIt("click",function(){return s._handleClick()})("keydown",function(F){return s._handleKeydown(F)})("mouseenter",function(){return s._setIndicatorHintVisible(!0)})("mouseleave",function(){return s._setIndicatorHintVisible(!1)}),2&o&&(t.BMQ("aria-sort",s._getAriaSortAttribute()),t.AVh("mat-sort-header-disabled",s._isDisabled()))},inputs:{id:[0,"mat-sort-header","id"],arrowPosition:"arrowPosition",start:"start",disabled:[2,"disabled","disabled",t.L39],sortActionDescription:"sortActionDescription",disableClear:[2,"disableClear","disableClear",t.L39]},exportAs:["matSortHeader"],standalone:!0,features:[t.GFd,t.aNF],attrs:g,ngContentSelectors:a,decls:4,vars:7,consts:[[1,"mat-sort-header-container","mat-focus-indicator"],[1,"mat-sort-header-content"],[1,"mat-sort-header-arrow"],[1,"mat-sort-header-stem"],[1,"mat-sort-header-indicator"],[1,"mat-sort-header-pointer-left"],[1,"mat-sort-header-pointer-right"],[1,"mat-sort-header-pointer-middle"]],template:function(o,s){1&o&&(t.NAR(),t.j41(0,"div",0)(1,"div",1),t.SdG(2),t.k0s(),t.DNE(3,d,6,6,"div",2),t.k0s()),2&o&&(t.AVh("mat-sort-header-sorted",s._isSorted())("mat-sort-header-position-before","before"===s.arrowPosition),t.BMQ("tabindex",s._isDisabled()?null:0)("role",s._isDisabled()?null:"button"),t.R7$(3),t.vxM(s._renderArrow()?3:-1))},styles:[".mat-sort-header-container{display:flex;cursor:pointer;align-items:center;letter-spacing:normal;outline:0}[mat-sort-header].cdk-keyboard-focused .mat-sort-header-container,[mat-sort-header].cdk-program-focused .mat-sort-header-container{border-bottom:solid 1px currentColor}.mat-sort-header-disabled .mat-sort-header-container{cursor:default}.mat-sort-header-container::before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 2px)*-1)}.mat-sort-header-content{text-align:center;display:flex;align-items:center}.mat-sort-header-position-before{flex-direction:row-reverse}.mat-sort-header-arrow{height:12px;width:12px;min-width:12px;position:relative;display:flex;color:var(--mat-sort-arrow-color);opacity:0}.mat-sort-header-arrow,[dir=rtl] .mat-sort-header-position-before .mat-sort-header-arrow{margin:0 0 0 6px}.mat-sort-header-position-before .mat-sort-header-arrow,[dir=rtl] .mat-sort-header-arrow{margin:0 6px 0 0}.mat-sort-header-stem{background:currentColor;height:10px;width:2px;margin:auto;display:flex;align-items:center}.cdk-high-contrast-active .mat-sort-header-stem{width:0;border-left:solid 2px}.mat-sort-header-indicator{width:100%;height:2px;display:flex;align-items:center;position:absolute;top:0;left:0}.mat-sort-header-pointer-middle{margin:auto;height:2px;width:2px;background:currentColor;transform:rotate(45deg)}.cdk-high-contrast-active .mat-sort-header-pointer-middle{width:0;height:0;border-top:solid 2px;border-left:solid 2px}.mat-sort-header-pointer-left,.mat-sort-header-pointer-right{background:currentColor;width:6px;height:2px;position:absolute;top:0}.cdk-high-contrast-active .mat-sort-header-pointer-left,.cdk-high-contrast-active .mat-sort-header-pointer-right{width:0;height:0;border-left:solid 6px;border-top:solid 2px}.mat-sort-header-pointer-left{transform-origin:right;left:0}.mat-sort-header-pointer-right{transform-origin:left;right:0}"],encapsulation:2,data:{animation:[S.indicator,S.leftPointer,S.rightPointer,S.arrowOpacity,S.arrowPosition,S.allowChildren]},changeDetection:0})}return r})(),I=(()=>{class r{static#t=this.\u0275fac=function(o){return new(o||r)};static#e=this.\u0275mod=t.$C({type:r});static#i=this.\u0275inj=t.G2t({providers:[P],imports:[n.yE]})}return r})()}}]);