@angular/material
Version:
Angular Material
23 lines • 15.8 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/accordion"),require("@angular/cdk/portal"),require("@angular/common"),require("@angular/core"),require("tslib"),require("@angular/cdk/coercion"),require("@angular/cdk/a11y"),require("@angular/cdk/keycodes"),require("rxjs/operators"),require("rxjs"),require("@angular/animations"),require("@angular/cdk/collections"),require("@angular/platform-browser/animations")):"function"==typeof define&&define.amd?define("@angular/material/expansion",["exports","@angular/cdk/accordion","@angular/cdk/portal","@angular/common","@angular/core","tslib","@angular/cdk/coercion","@angular/cdk/a11y","@angular/cdk/keycodes","rxjs/operators","rxjs","@angular/animations","@angular/cdk/collections","@angular/platform-browser/animations"],t):t(((e=e||self).ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.expansion={}),e.ng.cdk.accordion,e.ng.cdk.portal,e.ng.common,e.ng.core,e.tslib,e.ng.cdk.coercion,e.ng.cdk.a11y,e.ng.cdk.keycodes,e.rxjs.operators,e.rxjs,e.ng.animations,e.ng.cdk.collections,e.ng.platformBrowser.animations)}(this,(function(e,t,n,a,o,i,r,s,p,d,c,l,g,u){"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/var m=new o.InjectionToken("MAT_ACCORDION"),h={indicatorRotate:l.trigger("indicatorRotate",[l.state("collapsed, void",l.style({transform:"rotate(0deg)"})),l.state("expanded",l.style({transform:"rotate(180deg)"})),l.transition("expanded <=> collapsed, void => collapsed",l.animate("225ms cubic-bezier(0.4,0.0,0.2,1)"))]),expansionHeaderHeight:l.trigger("expansionHeight",[l.state("collapsed, void",l.style({height:"{{collapsedHeight}}"}),{params:{collapsedHeight:"48px"}}),l.state("expanded",l.style({height:"{{expandedHeight}}"}),{params:{expandedHeight:"64px"}}),l.transition("expanded <=> collapsed, void => collapsed",l.group([l.query("@indicatorRotate",l.animateChild(),{optional:!0}),l.animate("225ms cubic-bezier(0.4,0.0,0.2,1)")]))]),bodyExpansion:l.trigger("bodyExpansion",[l.state("collapsed, void",l.style({height:"0px",visibility:"hidden"})),l.state("expanded",l.style({height:"*",visibility:"visible"})),l.transition("expanded <=> collapsed, void => collapsed",l.animate("225ms cubic-bezier(0.4,0.0,0.2,1)"))])},x=function(){function e(e){this._template=e}return e.decorators=[{type:o.Directive,args:[{selector:"ng-template[matExpansionPanelContent]"}]}],e.ctorParameters=function(){return[{type:o.TemplateRef}]},e}(),f=0,y=new o.InjectionToken("MAT_EXPANSION_PANEL_DEFAULT_OPTIONS"),b=function(e){function t(t,n,a,i,r,s,p){var l=e.call(this,t,n,a)||this;return l._viewContainerRef=i,l._animationMode=s,l._hideToggle=!1,l.afterExpand=new o.EventEmitter,l.afterCollapse=new o.EventEmitter,l._inputChanges=new c.Subject,l._headerId="mat-expansion-panel-header-"+f++,l._bodyAnimationDone=new c.Subject,l.accordion=t,l._document=r,l._bodyAnimationDone.pipe(d.distinctUntilChanged((function(e,t){return e.fromState===t.fromState&&e.toState===t.toState}))).subscribe((function(e){"void"!==e.fromState&&("expanded"===e.toState?l.afterExpand.emit():"collapsed"===e.toState&&l.afterCollapse.emit())})),p&&(l.hideToggle=p.hideToggle),l}return i.__extends(t,e),Object.defineProperty(t.prototype,"hideToggle",{get:function(){return this._hideToggle||this.accordion&&this.accordion.hideToggle},set:function(e){this._hideToggle=r.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"togglePosition",{get:function(){return this._togglePosition||this.accordion&&this.accordion.togglePosition},set:function(e){this._togglePosition=e},enumerable:!0,configurable:!0}),t.prototype._hasSpacing=function(){return!!this.accordion&&this.expanded&&"default"===this.accordion.displayMode},t.prototype._getExpandedState=function(){return this.expanded?"expanded":"collapsed"},t.prototype.toggle=function(){this.expanded=!this.expanded},t.prototype.close=function(){this.expanded=!1},t.prototype.open=function(){this.expanded=!0},t.prototype.ngAfterContentInit=function(){var e=this;this._lazyContent&&this.opened.pipe(d.startWith(null),d.filter((function(){return e.expanded&&!e._portal})),d.take(1)).subscribe((function(){e._portal=new n.TemplatePortal(e._lazyContent._template,e._viewContainerRef)}))},t.prototype.ngOnChanges=function(e){this._inputChanges.next(e)},t.prototype.ngOnDestroy=function(){e.prototype.ngOnDestroy.call(this),this._bodyAnimationDone.complete(),this._inputChanges.complete()},t.prototype._containsFocus=function(){if(this._body){var e=this._document.activeElement,t=this._body.nativeElement;return e===t||t.contains(e)}return!1},t.decorators=[{type:o.Component,args:[{selector:"mat-expansion-panel",exportAs:"matExpansionPanel",template:'<ng-content select="mat-expansion-panel-header"></ng-content>\n<div class="mat-expansion-panel-content"\n role="region"\n [@bodyExpansion]="_getExpandedState()"\n (@bodyExpansion.done)="_bodyAnimationDone.next($event)"\n [attr.aria-labelledby]="_headerId"\n [id]="id"\n #body>\n <div class="mat-expansion-panel-body">\n <ng-content></ng-content>\n <ng-template [cdkPortalOutlet]="_portal"></ng-template>\n </div>\n <ng-content select="mat-action-row"></ng-content>\n</div>\n',encapsulation:o.ViewEncapsulation.None,changeDetection:o.ChangeDetectionStrategy.OnPush,inputs:["disabled","expanded"],outputs:["opened","closed","expandedChange"],animations:[h.bodyExpansion],providers:[{provide:m,useValue:void 0}],host:{class:"mat-expansion-panel","[class.mat-expanded]":"expanded","[class._mat-animation-noopable]":'_animationMode === "NoopAnimations"',"[class.mat-expansion-panel-spacing]":"_hasSpacing()"},styles:[".mat-expansion-panel{box-sizing:content-box;display:block;margin:0;border-radius:4px;overflow:hidden;transition:margin 225ms cubic-bezier(0.4, 0, 0.2, 1),box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-accordion .mat-expansion-panel:not(.mat-expanded),.mat-accordion .mat-expansion-panel:not(.mat-expansion-panel-spacing){border-radius:0}.mat-accordion .mat-expansion-panel:first-of-type{border-top-right-radius:4px;border-top-left-radius:4px}.mat-accordion .mat-expansion-panel:last-of-type{border-bottom-right-radius:4px;border-bottom-left-radius:4px}.cdk-high-contrast-active .mat-expansion-panel{outline:solid 1px}.mat-expansion-panel.ng-animate-disabled,.ng-animate-disabled .mat-expansion-panel,.mat-expansion-panel._mat-animation-noopable{transition:none}.mat-expansion-panel-content{display:flex;flex-direction:column;overflow:visible}.mat-expansion-panel-body{padding:0 24px 16px}.mat-expansion-panel-spacing{margin:16px 0}.mat-accordion>.mat-expansion-panel-spacing:first-child,.mat-accordion>*:first-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-top:0}.mat-accordion>.mat-expansion-panel-spacing:last-child,.mat-accordion>*:last-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-bottom:0}.mat-action-row{border-top-style:solid;border-top-width:1px;display:flex;flex-direction:row;justify-content:flex-end;padding:16px 8px 16px 24px}.mat-action-row button.mat-button-base{margin-left:8px}[dir=rtl] .mat-action-row button.mat-button-base{margin-left:0;margin-right:8px}\n"]}]}],t.ctorParameters=function(){return[{type:void 0,decorators:[{type:o.Optional},{type:o.SkipSelf},{type:o.Inject,args:[m]}]},{type:o.ChangeDetectorRef},{type:g.UniqueSelectionDispatcher},{type:o.ViewContainerRef},{type:void 0,decorators:[{type:o.Inject,args:[a.DOCUMENT]}]},{type:String,decorators:[{type:o.Optional},{type:o.Inject,args:[u.ANIMATION_MODULE_TYPE]}]},{type:void 0,decorators:[{type:o.Inject,args:[y]},{type:o.Optional}]}]},t.propDecorators={hideToggle:[{type:o.Input}],togglePosition:[{type:o.Input}],afterExpand:[{type:o.Output}],afterCollapse:[{type:o.Output}],_lazyContent:[{type:o.ContentChild,args:[x]}],_body:[{type:o.ViewChild,args:["body"]}]},t}(t.CdkAccordionItem),_=function(){function e(){}return e.decorators=[{type:o.Directive,args:[{selector:"mat-action-row",host:{class:"mat-action-row"}}]}],e}(),v=function(){function e(e,t,n,a,o){var i=this;this.panel=e,this._element=t,this._focusMonitor=n,this._changeDetectorRef=a,this._parentChangeSubscription=c.Subscription.EMPTY,this._animationsDisabled=!0;var r=e.accordion?e.accordion._stateChanges.pipe(d.filter((function(e){return!(!e.hideToggle&&!e.togglePosition)}))):c.EMPTY;this._parentChangeSubscription=c.merge(e.opened,e.closed,r,e._inputChanges.pipe(d.filter((function(e){return!!(e.hideToggle||e.disabled||e.togglePosition)})))).subscribe((function(){return i._changeDetectorRef.markForCheck()})),e.closed.pipe(d.filter((function(){return e._containsFocus()}))).subscribe((function(){return n.focusVia(t,"program")})),n.monitor(t).subscribe((function(t){t&&e.accordion&&e.accordion._handleHeaderFocus(i)})),o&&(this.expandedHeight=o.expandedHeight,this.collapsedHeight=o.collapsedHeight)}return e.prototype._animationStarted=function(){this._animationsDisabled=!1},Object.defineProperty(e.prototype,"disabled",{get:function(){return this.panel.disabled},enumerable:!0,configurable:!0}),e.prototype._toggle=function(){this.disabled||this.panel.toggle()},e.prototype._isExpanded=function(){return this.panel.expanded},e.prototype._getExpandedState=function(){return this.panel._getExpandedState()},e.prototype._getPanelId=function(){return this.panel.id},e.prototype._getTogglePosition=function(){return this.panel.togglePosition},e.prototype._showToggle=function(){return!this.panel.hideToggle&&!this.panel.disabled},e.prototype._keydown=function(e){switch(e.keyCode){case p.SPACE:case p.ENTER:p.hasModifierKey(e)||(e.preventDefault(),this._toggle());break;default:return void(this.panel.accordion&&this.panel.accordion._handleHeaderKeydown(e))}},e.prototype.focus=function(e,t){void 0===e&&(e="program"),this._focusMonitor.focusVia(this._element,e,t)},e.prototype.ngOnDestroy=function(){this._parentChangeSubscription.unsubscribe(),this._focusMonitor.stopMonitoring(this._element)},e.decorators=[{type:o.Component,args:[{selector:"mat-expansion-panel-header",template:'<span class="mat-content">\n <ng-content select="mat-panel-title"></ng-content>\n <ng-content select="mat-panel-description"></ng-content>\n <ng-content></ng-content>\n</span>\n<span [@indicatorRotate]="_getExpandedState()" *ngIf="_showToggle()"\n class="mat-expansion-indicator"></span>\n',encapsulation:o.ViewEncapsulation.None,changeDetection:o.ChangeDetectionStrategy.OnPush,animations:[h.indicatorRotate,h.expansionHeaderHeight],host:{class:"mat-expansion-panel-header",role:"button","[attr.id]":"panel._headerId","[attr.tabindex]":"disabled ? -1 : 0","[attr.aria-controls]":"_getPanelId()","[attr.aria-expanded]":"_isExpanded()","[attr.aria-disabled]":"panel.disabled","[class.mat-expanded]":"_isExpanded()","[class.mat-expansion-toggle-indicator-after]":"_getTogglePosition() === 'after'","[class.mat-expansion-toggle-indicator-before]":"_getTogglePosition() === 'before'","(click)":"_toggle()","(keydown)":"_keydown($event)","[@.disabled]":"_animationsDisabled","(@expansionHeight.start)":"_animationStarted()","[@expansionHeight]":"{\n value: _getExpandedState(),\n params: {\n collapsedHeight: collapsedHeight,\n expandedHeight: expandedHeight\n }\n }"},styles:['.mat-expansion-panel-header{display:flex;flex-direction:row;align-items:center;padding:0 24px;border-radius:inherit}.mat-expansion-panel-header:focus,.mat-expansion-panel-header:hover{outline:none}.mat-expansion-panel-header.mat-expanded:focus,.mat-expansion-panel-header.mat-expanded:hover{background:inherit}.mat-expansion-panel-header:not([aria-disabled=true]){cursor:pointer}.mat-expansion-panel-header.mat-expansion-toggle-indicator-before{flex-direction:row-reverse}.mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator{margin:0 16px 0 0}[dir=rtl] .mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator{margin:0 0 0 16px}.mat-content{display:flex;flex:1;flex-direction:row;overflow:hidden}.mat-expansion-panel-header-title,.mat-expansion-panel-header-description{display:flex;flex-grow:1;margin-right:16px}[dir=rtl] .mat-expansion-panel-header-title,[dir=rtl] .mat-expansion-panel-header-description{margin-right:0;margin-left:16px}.mat-expansion-panel-header-description{flex-grow:2}.mat-expansion-indicator::after{border-style:solid;border-width:0 2px 2px 0;content:"";display:inline-block;padding:3px;transform:rotate(45deg);vertical-align:middle}\n']}]}],e.ctorParameters=function(){return[{type:b,decorators:[{type:o.Host}]},{type:o.ElementRef},{type:s.FocusMonitor},{type:o.ChangeDetectorRef},{type:void 0,decorators:[{type:o.Inject,args:[y]},{type:o.Optional}]}]},e.propDecorators={expandedHeight:[{type:o.Input}],collapsedHeight:[{type:o.Input}]},e}(),E=function(){function e(){}return e.decorators=[{type:o.Directive,args:[{selector:"mat-panel-description",host:{class:"mat-expansion-panel-header-description"}}]}],e}(),w=function(){function e(){}return e.decorators=[{type:o.Directive,args:[{selector:"mat-panel-title",host:{class:"mat-expansion-panel-header-title"}}]}],e}(),C=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._ownHeaders=new o.QueryList,t._hideToggle=!1,t.displayMode="default",t.togglePosition="after",t}return i.__extends(t,e),Object.defineProperty(t.prototype,"hideToggle",{get:function(){return this._hideToggle},set:function(e){this._hideToggle=r.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),t.prototype.ngAfterContentInit=function(){var e=this;this._headers.changes.pipe(d.startWith(this._headers)).subscribe((function(t){e._ownHeaders.reset(t.filter((function(t){return t.panel.accordion===e}))),e._ownHeaders.notifyOnChanges()})),this._keyManager=new s.FocusKeyManager(this._ownHeaders).withWrap()},t.prototype._handleHeaderKeydown=function(e){var t=e.keyCode,n=this._keyManager;t===p.HOME?p.hasModifierKey(e)||(n.setFirstItemActive(),e.preventDefault()):t===p.END?p.hasModifierKey(e)||(n.setLastItemActive(),e.preventDefault()):this._keyManager.onKeydown(e)},t.prototype._handleHeaderFocus=function(e){this._keyManager.updateActiveItem(e)},t.decorators=[{type:o.Directive,args:[{selector:"mat-accordion",exportAs:"matAccordion",inputs:["multi"],providers:[{provide:m,useExisting:t}],host:{class:"mat-accordion","[class.mat-accordion-multi]":"this.multi"}}]}],t.propDecorators={_headers:[{type:o.ContentChildren,args:[v,{descendants:!0}]}],hideToggle:[{type:o.Input}],displayMode:[{type:o.Input}],togglePosition:[{type:o.Input}]},t}(t.CdkAccordion),P=function(){function e(){}return e.decorators=[{type:o.NgModule,args:[{imports:[a.CommonModule,t.CdkAccordionModule,n.PortalModule],exports:[C,b,_,v,w,E,x],declarations:[C,b,_,v,w,E,x]}]}],e}();
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
e.EXPANSION_PANEL_ANIMATION_TIMING="225ms cubic-bezier(0.4,0.0,0.2,1)",e.MAT_ACCORDION=m,e.MAT_EXPANSION_PANEL_DEFAULT_OPTIONS=y,e.MatAccordion=C,e.MatExpansionModule=P,e.MatExpansionPanel=b,e.MatExpansionPanelActionRow=_,e.MatExpansionPanelContent=x,e.MatExpansionPanelDescription=E,e.MatExpansionPanelHeader=v,e.MatExpansionPanelTitle=w,e.matExpansionAnimations=h,e.ɵ0=void 0,Object.defineProperty(e,"__esModule",{value:!0})}));