| !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/cdk/coercion"),require("@angular/material/core"),require("@angular/cdk/a11y"),require("@angular/cdk/keycodes"),require("rxjs"),require("@angular/animations"),require("@angular/common")):"function"==typeof define&&define.amd?define("@angular/material/sort",["exports","@angular/core","@angular/cdk/coercion","@angular/material/core","@angular/cdk/a11y","@angular/cdk/keycodes","rxjs","@angular/animations","@angular/common"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.sort={}),t.ng.core,t.ng.cdk.coercion,t.ng.material.core,t.ng.cdk.a11y,t.ng.cdk.keycodes,t.rxjs,t.ng.animations,t.ng.common)}(this,(function(t,e,r,i,a,o,n,s,c){"use strict"; |
| ***************************************************************************** */var d=function(t,e){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var h=new e.InjectionToken("MAT_SORT_DEFAULT_OPTIONS"),p=function(t){function i(r){var i=t.call(this)||this;return i._defaultOptions=r,i.sortables=new Map,i._stateChanges=new n.Subject,i.start="asc",i._direction="",i.sortChange=new e.EventEmitter,i}return l(i,t),Object.defineProperty(i.prototype,"direction",{get:function(){return this._direction},set:function(t){this._direction=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"disableClear",{get:function(){return this._disableClear},set:function(t){this._disableClear=r.coerceBooleanProperty(t)},enumerable:!1,configurable:!0}),i.prototype.register=function(t){this.sortables.set(t.id,t)},i.prototype.deregister=function(t){this.sortables.delete(t.id)},i.prototype.sort=function(t){this.active!=t.id?(this.active=t.id,this.direction=t.start?t.start:this.start):this.direction=this.getNextSortDirection(t),this.sortChange.emit({active:this.active,direction:this.direction})},i.prototype.getNextSortDirection=function(t){var e,r,i;if(!t)return"";var a=null!==(r=null!==(e=null==t?void 0:t.disableClear)&&void 0!==e?e:this.disableClear)&&void 0!==r?r:!!(null===(i=this._defaultOptions)||void 0===i?void 0:i.disableClear),o=function n(t,e){var r=["asc","desc"];return"desc"==t&&r.reverse(),e||r.push(""),r} |
| */(t.start||this.start,a),s=o.indexOf(this.direction)+1;return s>=o.length&&(s=0),o[s]},i.prototype.ngOnInit=function(){this._markInitialized()},i.prototype.ngOnChanges=function(){this._stateChanges.next()},i.prototype.ngOnDestroy=function(){this._stateChanges.complete()},i}(i.mixinInitialized(i.mixinDisabled((function u(){}))));p.decorators=[{type:e.Directive,args:[{selector:"[matSort]",exportAs:"matSort",host:{class:"mat-sort"},inputs:["disabled: matSortDisabled"]}]}],p.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[h]}]}]},p.propDecorators={active:[{type:e.Input,args:["matSortActive"]}],start:[{type:e.Input,args:["matSortStart"]}],direction:[{type:e.Input,args:["matSortDirection"]}],disableClear:[{type:e.Input,args:["matSortDisableClear"]}],sortChange:[{type:e.Output,args:["matSortChange"]}]};var m,f=i.AnimationDurations.ENTERING+" "+i.AnimationCurves.STANDARD_CURVE,g={indicator:s.trigger("indicator",[s.state("active-asc, asc",s.style({transform:"translateY(0px)"})),s.state("active-desc, desc",s.style({transform:"translateY(10px)"})),s.transition("active-asc <=> active-desc",s.animate(f))]),leftPointer:s.trigger("leftPointer",[s.state("active-asc, asc",s.style({transform:"rotate(-45deg)"})),s.state("active-desc, desc",s.style({transform:"rotate(45deg)"})),s.transition("active-asc <=> active-desc",s.animate(f))]),rightPointer:s.trigger("rightPointer",[s.state("active-asc, asc",s.style({transform:"rotate(45deg)"})),s.state("active-desc, desc",s.style({transform:"rotate(-45deg)"})),s.transition("active-asc <=> active-desc",s.animate(f))]),arrowOpacity:s.trigger("arrowOpacity",[s.state("desc-to-active, asc-to-active, active",s.style({opacity:1})),s.state("desc-to-hint, asc-to-hint, hint",s.style({opacity:.54})),s.state("hint-to-desc, active-to-desc, desc, hint-to-asc, active-to-asc, asc, void",s.style({opacity:0})),s.transition("* => asc, * => desc, * => active, * => hint, * => void",s.animate("0ms")),s.transition("* <=> *",s.animate(f))]),arrowPosition:s.trigger("arrowPosition",[s.transition("* => desc-to-hint, * => desc-to-active",s.animate(f,s.keyframes([s.style({transform:"translateY(-25%)"}),s.style({transform:"translateY(0)"})]))),s.transition("* => hint-to-desc, * => active-to-desc",s.animate(f,s.keyframes([s.style({transform:"translateY(0)"}),s.style({transform:"translateY(25%)"})]))),s.transition("* => asc-to-hint, * => asc-to-active",s.animate(f,s.keyframes([s.style({transform:"translateY(25%)"}),s.style({transform:"translateY(0)"})]))),s.transition("* => hint-to-asc, * => active-to-asc",s.animate(f,s.keyframes([s.style({transform:"translateY(0)"}),s.style({transform:"translateY(-25%)"})]))),s.state("desc-to-hint, asc-to-hint, hint, desc-to-active, asc-to-active, active",s.style({transform:"translateY(0)"})),s.state("hint-to-desc, active-to-desc, desc",s.style({transform:"translateY(-25%)"})),s.state("hint-to-asc, active-to-asc, asc",s.style({transform:"translateY(25%)"}))]),allowChildren:s.trigger("allowChildren",[s.transition("* <=> *",[s.query("@*",s.animateChild(),{optional:!0})])])};function _(t){return t||new m}(m=function m(){this.changes=new n.Subject,this.sortButtonLabel=function(t){return"Change sorting for "+t}}).ɵprov=e.ɵɵdefineInjectable({factory:function t(){return new m},token:m,providedIn:"root"}),m.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var y,v={provide:m,deps:[[new e.Optional,new e.SkipSelf,m]],useFactory:_},b=function(t){function e(e,r,i,a,o,n){var s=t.call(this)||this;return s._intl=e,s._changeDetectorRef=r,s._sort=i,s._columnDef=a,s._focusMonitor=o,s._elementRef=n,s._showIndicatorHint=!1,s._viewState={},s._arrowDirection="",s._disableViewStateAnimation=!1,s.arrowPosition="after",s._handleStateChanges(),s}return l(e,t),Object.defineProperty(e.prototype,"disableClear",{get:function(){return this._disableClear},set:function(t){this._disableClear=r.coerceBooleanProperty(t)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){!this.id&&this._columnDef&&(this.id=this._columnDef.name),this._updateArrowDirection(),this._setAnimationTransitionState({toState:this._isSorted()?"active":this._arrowDirection}),this._sort.register(this)},e.prototype.ngAfterViewInit=function(){var t=this;this._focusMonitor.monitor(this._elementRef,!0).subscribe((function(e){var r=!!e;r!==t._showIndicatorHint&&(t._setIndicatorHintVisible(r),t._changeDetectorRef.markForCheck())}))},e.prototype.ngOnDestroy=function(){this._focusMonitor.stopMonitoring(this._elementRef),this._sort.deregister(this),this._rerenderSubscription.unsubscribe()},e.prototype._setIndicatorHintVisible=function(t){this._isDisabled()&&t||(this._showIndicatorHint=t,this._isSorted()||(this._updateArrowDirection(),this._setAnimationTransitionState(this._showIndicatorHint?{fromState:this._arrowDirection,toState:"hint"}:{fromState:"hint",toState:this._arrowDirection})))},e.prototype._setAnimationTransitionState=function(t){this._viewState=t||{},this._disableViewStateAnimation&&(this._viewState={toState:t.toState})},e.prototype._toggleOnInteraction=function(){this._sort.sort(this),"hint"!==this._viewState.toState&&"active"!==this._viewState.toState||(this._disableViewStateAnimation=!0)},e.prototype._handleClick=function(){this._isDisabled()||this._sort.sort(this)},e.prototype._handleKeydown=function(t){this._isDisabled()||t.keyCode!==o.SPACE&&t.keyCode!==o.ENTER||(t.preventDefault(),this._toggleOnInteraction())},e.prototype._isSorted=function(){return this._sort.active==this.id&&("asc"===this._sort.direction||"desc"===this._sort.direction)},e.prototype._getArrowDirectionState=function(){return(this._isSorted()?"active-":"")+this._arrowDirection},e.prototype._getArrowViewState=function(){var t=this._viewState.fromState;return(t?t+"-to-":"")+this._viewState.toState},e.prototype._updateArrowDirection=function(){this._arrowDirection=this._isSorted()?this._sort.direction:this.start||this._sort.start},e.prototype._isDisabled=function(){return this._sort.disabled||this.disabled},e.prototype._getAriaSortAttribute=function(){return this._isSorted()?"asc"==this._sort.direction?"ascending":"descending":"none"},e.prototype._renderArrow=function(){return!this._isDisabled()||this._isSorted()},e.prototype._handleStateChanges=function(){var t=this;this._rerenderSubscription=n.merge(this._sort.sortChange,this._sort._stateChanges,this._intl.changes).subscribe((function(){t._isSorted()&&(t._updateArrowDirection(),"hint"!==t._viewState.toState&&"active"!==t._viewState.toState||(t._disableViewStateAnimation=!0),t._setAnimationTransitionState({fromState:t._arrowDirection,toState:"active"}),t._showIndicatorHint=!1),!t._isSorted()&&t._viewState&&"active"===t._viewState.toState&&(t._disableViewStateAnimation=!1,t._setAnimationTransitionState({fromState:"active",toState:t._arrowDirection})),t._changeDetectorRef.markForCheck()}))},e}(i.mixinDisabled((function w(){})));b.decorators=[{type:e.Component,args:[{selector:"[mat-sort-header]",exportAs:"matSortHeader",template:'\x3c!--\n We set the `tabindex` on an element inside the table header, rather than the header itself,\n because of a bug in NVDA where having a `tabindex` on a `th` breaks keyboard navigation in the\n table (see https://github.com/nvaccess/nvda/issues/7718). This allows for the header to both\n be focusable, and have screen readers read out its `aria-sort` state. We prefer this approach\n over having a button with an `aria-label` inside the header, because the button\'s `aria-label`\n will be read out as the user is navigating the table\'s cell (see #13012).\n\n The approach is based off of: https://dequeuniversity.com/library/aria/tables/sf-sortable-grid\n--\x3e\n<div class="mat-sort-header-container mat-focus-indicator"\n [class.mat-sort-header-sorted]="_isSorted()"\n [class.mat-sort-header-position-before]="arrowPosition == \'before\'"\n [attr.tabindex]="_isDisabled() ? null : 0"\n role="button">\n\n \x3c!--\n TODO(crisbeto): this div isn\'t strictly necessary, but we have to keep it due to a large\n number of screenshot diff failures. It should be removed eventually. Note that the difference\n isn\'t visible with a shorter header, but once it breaks up into multiple lines, this element\n causes it to be center-aligned, whereas removing it will keep the text to the left.\n --\x3e\n <div class="mat-sort-header-content">\n <ng-content></ng-content>\n </div>\n\n \x3c!-- Disable animations while a current animation is running --\x3e\n <div class="mat-sort-header-arrow"\n *ngIf="_renderArrow()"\n [@arrowOpacity]="_getArrowViewState()"\n [@arrowPosition]="_getArrowViewState()"\n [@allowChildren]="_getArrowDirectionState()"\n (@arrowPosition.start)="_disableViewStateAnimation = true"\n (@arrowPosition.done)="_disableViewStateAnimation = false">\n <div class="mat-sort-header-stem"></div>\n <div class="mat-sort-header-indicator" [@indicator]="_getArrowDirectionState()">\n <div class="mat-sort-header-pointer-left" [@leftPointer]="_getArrowDirectionState()"></div>\n <div class="mat-sort-header-pointer-right" [@rightPointer]="_getArrowDirectionState()"></div>\n <div class="mat-sort-header-pointer-middle"></div>\n </div>\n </div>\n</div>\n',host:{class:"mat-sort-header","(click)":"_handleClick()","(keydown)":"_handleKeydown($event)","(mouseenter)":"_setIndicatorHintVisible(true)","(mouseleave)":"_setIndicatorHintVisible(false)","[attr.aria-sort]":"_getAriaSortAttribute()","[class.mat-sort-header-disabled]":"_isDisabled()"},encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,inputs:["disabled"],animations:[g.indicator,g.leftPointer,g.rightPointer,g.arrowOpacity,g.arrowPosition,g.allowChildren],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-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;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}\n"]}]}],b.ctorParameters=function(){return[{type:m},{type:e.ChangeDetectorRef},{type:p,decorators:[{type:e.Optional}]},{type:void 0,decorators:[{type:e.Inject,args:["MAT_SORT_HEADER_COLUMN_DEF"]},{type:e.Optional}]},{type:a.FocusMonitor},{type:e.ElementRef}]},b.propDecorators={id:[{type:e.Input,args:["mat-sort-header"]}],arrowPosition:[{type:e.Input}],start:[{type:e.Input}],disableClear:[{type:e.Input}]},(y=function y(){}).decorators=[{type:e.NgModule,args:[{imports:[c.CommonModule,i.MatCommonModule],exports:[p,b],declarations:[p,b],providers:[v]}]}], |