@angular/cdk 5.2.1 → 5.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_overlay.scss +6 -0
- package/a11y/typings/aria-describer/aria-describer.d.ts +2 -0
- package/a11y/typings/index.metadata.json +1 -1
- package/a11y/typings/key-manager/list-key-manager.d.ts +11 -0
- package/bundles/cdk-a11y.umd.js +65 -13
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +1 -1
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-collections.umd.js +7 -11
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.min.js +1 -1
- package/bundles/cdk-collections.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +24 -5
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +2 -2
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +3 -3
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +1 -1
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +17 -4
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +1 -1
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-stepper.umd.js +3 -1
- package/bundles/cdk-stepper.umd.js.map +1 -1
- package/bundles/cdk-stepper.umd.min.js +1 -1
- package/bundles/cdk-stepper.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/collections/typings/index.metadata.json +1 -1
- package/collections/typings/selection.d.ts +3 -10
- package/esm2015/a11y.js +48 -13
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/cdk.js +1 -1
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/collections.js +8 -15
- package/esm2015/collections.js.map +1 -1
- package/esm2015/overlay.js +20 -5
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/platform.js +3 -3
- package/esm2015/platform.js.map +1 -1
- package/esm2015/scrolling.js +18 -5
- package/esm2015/scrolling.js.map +1 -1
- package/esm2015/stepper.js +3 -1
- package/esm2015/stepper.js.map +1 -1
- package/esm5/a11y.es5.js +65 -13
- package/esm5/a11y.es5.js.map +1 -1
- package/esm5/cdk.es5.js +1 -1
- package/esm5/cdk.es5.js.map +1 -1
- package/esm5/collections.es5.js +8 -11
- package/esm5/collections.es5.js.map +1 -1
- package/esm5/overlay.es5.js +24 -5
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/platform.es5.js +3 -3
- package/esm5/platform.es5.js.map +1 -1
- package/esm5/scrolling.es5.js +17 -4
- package/esm5/scrolling.es5.js.map +1 -1
- package/esm5/stepper.es5.js +3 -1
- package/esm5/stepper.es5.js.map +1 -1
- package/overlay/typings/index.metadata.json +1 -1
- package/overlay/typings/overlay-directives.d.ts +4 -1
- package/overlay/typings/overlay.d.ts +1 -1
- package/overlay/typings/position/connected-position-strategy.d.ts +0 -2
- package/overlay-prebuilt.css +1 -1
- package/package.json +3 -3
- package/scrolling/typings/index.metadata.json +1 -1
- package/scrolling/typings/viewport-ruler.d.ts +2 -1
- package/typings/a11y/aria-describer/aria-describer.d.ts +2 -0
- package/typings/a11y/index.metadata.json +1 -1
- package/typings/a11y/key-manager/list-key-manager.d.ts +11 -0
- package/typings/collections/index.metadata.json +1 -1
- package/typings/collections/selection.d.ts +3 -10
- package/typings/esm5/a11y/aria-describer/aria-describer.d.ts +2 -0
- package/typings/esm5/a11y/index.metadata.json +1 -1
- package/typings/esm5/a11y/key-manager/list-key-manager.d.ts +11 -0
- package/typings/esm5/collections/index.metadata.json +1 -1
- package/typings/esm5/collections/selection.d.ts +3 -10
- package/typings/esm5/index.metadata.json +1 -1
- package/typings/esm5/overlay/index.metadata.json +1 -1
- package/typings/esm5/overlay/overlay-directives.d.ts +4 -1
- package/typings/esm5/overlay/overlay.d.ts +1 -1
- package/typings/esm5/overlay/position/connected-position-strategy.d.ts +0 -2
- package/typings/esm5/scrolling/index.metadata.json +1 -1
- package/typings/esm5/scrolling/viewport-ruler.d.ts +2 -1
- package/typings/index.metadata.json +1 -1
- package/typings/overlay/index.metadata.json +1 -1
- package/typings/overlay/overlay-directives.d.ts +4 -1
- package/typings/overlay/overlay.d.ts +1 -1
- package/typings/overlay/position/connected-position-strategy.d.ts +0 -2
- package/typings/scrolling/index.metadata.json +1 -1
- package/typings/scrolling/viewport-ruler.d.ts +2 -1
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/cdk/keycodes"),require("@angular/cdk/coercion"),require("@angular/forms"),require("@angular/cdk/bidi"),require("rxjs/Subject"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/cdk/keycodes","@angular/cdk/coercion","@angular/forms","@angular/cdk/bidi","rxjs/Subject","@angular/common"],t):t((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.stepper=e.ng.cdk.stepper||{}),e.ng.core,e.ng.cdk.keycodes,e.ng.cdk.coercion,e.ng.forms,e.ng.cdk.bidi,e.Rx,e.ng.common)}(this,function(e,t,n,o,r,s,
|
|
8
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/cdk/keycodes"),require("@angular/cdk/coercion"),require("@angular/forms"),require("@angular/cdk/bidi"),require("rxjs/Subject"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/cdk/keycodes","@angular/cdk/coercion","@angular/forms","@angular/cdk/bidi","rxjs/Subject","@angular/common"],t):t((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.stepper=e.ng.cdk.stepper||{}),e.ng.core,e.ng.cdk.keycodes,e.ng.cdk.coercion,e.ng.forms,e.ng.cdk.bidi,e.Rx,e.ng.common)}(this,function(e,t,n,o,r,i,s,p){"use strict";var c=function(){function e(e){this.template=e}return e.decorators=[{type:t.Directive,args:[{selector:"[cdkStepLabel]"}]}],e.ctorParameters=function(){return[{type:t.TemplateRef}]},e}(),u=0,a=function(){function e(){}return e}(),d=function(){function e(e){this._stepper=e,this.interacted=!1,this._editable=!0,this._optional=!1,this._customCompleted=null}return Object.defineProperty(e.prototype,"editable",{get:function(){return this._editable},set:function(e){this._editable=o.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"optional",{get:function(){return this._optional},set:function(e){this._optional=o.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"completed",{get:function(){return null==this._customCompleted?this._defaultCompleted:this._customCompleted},set:function(e){this._customCompleted=o.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_defaultCompleted",{get:function(){return this.stepControl?this.stepControl.valid&&this.interacted:this.interacted},enumerable:!0,configurable:!0}),e.prototype.select=function(){this._stepper.selected=this},e.prototype.reset=function(){this.interacted=!1,null!=this._customCompleted&&(this._customCompleted=!1),this.stepControl&&this.stepControl.reset()},e.prototype.ngOnChanges=function(){this._stepper._stateChanged()},e.decorators=[{type:t.Component,args:[{selector:"cdk-step",exportAs:"cdkStep",template:"<ng-template><ng-content></ng-content></ng-template>",encapsulation:t.ViewEncapsulation.None,preserveWhitespaces:!1,changeDetection:t.ChangeDetectionStrategy.OnPush}]}],e.ctorParameters=function(){return[{type:l,decorators:[{type:t.Inject,args:[t.forwardRef(function(){return l})]}]}]},e.propDecorators={stepLabel:[{type:t.ContentChild,args:[c]}],content:[{type:t.ViewChild,args:[t.TemplateRef]}],stepControl:[{type:t.Input}],label:[{type:t.Input}],editable:[{type:t.Input}],optional:[{type:t.Input}],completed:[{type:t.Input}]},e}(),l=function(){function e(e,n){this._dir=e,this._changeDetectorRef=n,this._destroyed=new s.Subject,this._linear=!1,this._selectedIndex=0,this.selectionChange=new t.EventEmitter,this._focusIndex=0,this._orientation="horizontal",this._groupId=u++}return Object.defineProperty(e.prototype,"linear",{get:function(){return this._linear},set:function(e){this._linear=o.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedIndex",{get:function(){return this._selectedIndex},set:function(e){if(this._steps){if(e<0||e>this._steps.length-1)throw Error("cdkStepper: Cannot assign out-of-bounds value to `selectedIndex`.");this._anyControlsInvalidOrPending(e)||e<this._selectedIndex&&!this._steps.toArray()[e].editable?this._stepHeader.toArray()[e].nativeElement.blur():this._selectedIndex!=e&&(this._emitStepperSelectionEvent(e),this._focusIndex=this._selectedIndex)}else this._selectedIndex=this._focusIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selected",{get:function(){return this._steps.toArray()[this.selectedIndex]},set:function(e){this.selectedIndex=this._steps.toArray().indexOf(e)},enumerable:!0,configurable:!0}),e.prototype.ngOnDestroy=function(){this._destroyed.next(),this._destroyed.complete()},e.prototype.next=function(){this.selectedIndex=Math.min(this._selectedIndex+1,this._steps.length-1)},e.prototype.previous=function(){this.selectedIndex=Math.max(this._selectedIndex-1,0)},e.prototype.reset=function(){this.selectedIndex=0,this._steps.forEach(function(e){return e.reset()}),this._stateChanged()},e.prototype._getStepLabelId=function(e){return"cdk-step-label-"+this._groupId+"-"+e},e.prototype._getStepContentId=function(e){return"cdk-step-content-"+this._groupId+"-"+e},e.prototype._stateChanged=function(){this._changeDetectorRef.markForCheck()},e.prototype._getAnimationDirection=function(e){var t=e-this._selectedIndex;return t<0?"rtl"===this._layoutDirection()?"next":"previous":t>0?"rtl"===this._layoutDirection()?"previous":"next":"current"},e.prototype._getIndicatorType=function(e){var t=this._steps.toArray()[e];return t.completed&&this._selectedIndex!=e?t.editable?"edit":"done":"number"},e.prototype._emitStepperSelectionEvent=function(e){var t=this._steps.toArray();this.selectionChange.emit({selectedIndex:e,previouslySelectedIndex:this._selectedIndex,selectedStep:t[e],previouslySelectedStep:t[this._selectedIndex]}),this._selectedIndex=e,this._stateChanged()},e.prototype._onKeydown=function(e){var t=e.keyCode;t===n.RIGHT_ARROW&&("rtl"===this._layoutDirection()?this._focusPreviousStep():this._focusNextStep(),e.preventDefault()),t===n.LEFT_ARROW&&("rtl"===this._layoutDirection()?this._focusNextStep():this._focusPreviousStep(),e.preventDefault()),"vertical"!==this._orientation||t!==n.UP_ARROW&&t!==n.DOWN_ARROW||(t===n.UP_ARROW?this._focusPreviousStep():this._focusNextStep(),e.preventDefault()),t!==n.SPACE&&t!==n.ENTER||(this.selectedIndex=this._focusIndex,e.preventDefault()),t===n.HOME&&(this._focusStep(0),e.preventDefault()),t===n.END&&(this._focusStep(this._steps.length-1),e.preventDefault())},e.prototype._focusNextStep=function(){this._focusStep((this._focusIndex+1)%this._steps.length)},e.prototype._focusPreviousStep=function(){this._focusStep((this._focusIndex+this._steps.length-1)%this._steps.length)},e.prototype._focusStep=function(e){this._focusIndex=e,this._stepHeader.toArray()[this._focusIndex].nativeElement.focus()},e.prototype._anyControlsInvalidOrPending=function(e){var t=this._steps.toArray();return t[this._selectedIndex].interacted=!0,!!(this._linear&&e>=0)&&t.slice(0,e).some(function(e){var t=e.stepControl;return(t?t.invalid||t.pending||!e.interacted:!e.completed)&&!e.optional})},e.prototype._layoutDirection=function(){return this._dir&&"rtl"===this._dir.value?"rtl":"ltr"},e.decorators=[{type:t.Directive,args:[{selector:"[cdkStepper]",exportAs:"cdkStepper"}]}],e.ctorParameters=function(){return[{type:i.Directionality,decorators:[{type:t.Optional}]},{type:t.ChangeDetectorRef}]},e.propDecorators={_steps:[{type:t.ContentChildren,args:[d]}],linear:[{type:t.Input}],selectedIndex:[{type:t.Input}],selected:[{type:t.Input}],selectionChange:[{type:t.Output}]},e}(),h=function(){function e(e){this._stepper=e,this.type="submit"}return e.decorators=[{type:t.Directive,args:[{selector:"button[cdkStepperNext]",host:{"(click)":"_stepper.next()","[type]":"type"}}]}],e.ctorParameters=function(){return[{type:l}]},e.propDecorators={type:[{type:t.Input}]},e}(),f=function(){function e(e){this._stepper=e,this.type="button"}return e.decorators=[{type:t.Directive,args:[{selector:"button[cdkStepperPrevious]",host:{"(click)":"_stepper.previous()","[type]":"type"}}]}],e.ctorParameters=function(){return[{type:l}]},e.propDecorators={type:[{type:t.Input}]},e}(),_=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[i.BidiModule,p.CommonModule],exports:[d,l,c,h,f],declarations:[d,l,c,h,f]}]}],e.ctorParameters=function(){return[]},e}();e.StepperSelectionEvent=a,e.CdkStep=d,e.CdkStepper=l,e.CdkStepLabel=c,e.CdkStepperNext=h,e.CdkStepperPrevious=f,e.CdkStepperModule=_,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
9
9
|
//# sourceMappingURL=cdk-stepper.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk-stepper.umd.min.js","sources":["../../src/cdk/stepper/step-label.ts","../../src/cdk/stepper/stepper.ts","../../src/cdk/stepper/stepper-button.ts","../../src/cdk/stepper/stepper-module.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Directive, TemplateRef} from '@angular/core';\n\n@Directive({\n selector: '[cdkStepLabel]',\n})\nexport class CdkStepLabel {\n constructor(/** @docs-private */ public template: TemplateRef<any>) { }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n ContentChildren,\n EventEmitter,\n Input,\n Output,\n QueryList,\n Directive,\n ElementRef,\n Component,\n ContentChild,\n ViewChild,\n TemplateRef,\n ViewEncapsulation,\n Optional,\n Inject,\n forwardRef,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnChanges,\n OnDestroy\n} from '@angular/core';\nimport {\n LEFT_ARROW,\n RIGHT_ARROW,\n DOWN_ARROW,\n UP_ARROW,\n ENTER,\n SPACE,\n HOME,\n END,\n} from '@angular/cdk/keycodes';\nimport {CdkStepLabel} from './step-label';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {AbstractControl} from '@angular/forms';\nimport {Direction, Directionality} from '@angular/cdk/bidi';\nimport {Subject} from 'rxjs/Subject';\n\n/** Used to generate unique ID for each stepper component. */\nlet nextId = 0;\n\n/**\n * Position state of the content of each step in stepper that is used for transitioning\n * the content into correct position upon step selection change.\n */\nexport type StepContentPositionState = 'previous' | 'current' | 'next';\n\n/** Possible orientation of a stepper. */\nexport type StepperOrientation = 'horizontal' | 'vertical';\n\n/** Change event emitted on selection changes. */\nexport class StepperSelectionEvent {\n /** Index of the step now selected. */\n selectedIndex: number;\n\n /** Index of the step previously selected. */\n previouslySelectedIndex: number;\n\n /** The step instance now selected. */\n selectedStep: CdkStep;\n\n /** The step instance previously selected. */\n previouslySelectedStep: CdkStep;\n}\n\n@Component({\n moduleId: module.id,\n selector: 'cdk-step',\n exportAs: 'cdkStep',\n templateUrl: 'step.html',\n encapsulation: ViewEncapsulation.None,\n preserveWhitespaces: false,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CdkStep implements OnChanges {\n /** Template for step label if it exists. */\n @ContentChild(CdkStepLabel) stepLabel: CdkStepLabel;\n\n /** Template for step content. */\n @ViewChild(TemplateRef) content: TemplateRef<any>;\n\n /** The top level abstract control of the step. */\n @Input() stepControl: AbstractControl;\n\n /** Whether user has seen the expanded step content or not. */\n interacted = false;\n\n /** Label of the step. */\n @Input() label: string;\n\n /** Whether the user can return to this step once it has been marked as complted. */\n @Input()\n get editable(): boolean { return this._editable; }\n set editable(value: boolean) {\n this._editable = coerceBooleanProperty(value);\n }\n private _editable = true;\n\n /** Whether the completion of step is optional. */\n @Input()\n get optional(): boolean { return this._optional; }\n set optional(value: boolean) {\n this._optional = coerceBooleanProperty(value);\n }\n private _optional = false;\n\n /** Whether step is marked as completed. */\n @Input()\n get completed(): boolean {\n return this._customCompleted == null ? this._defaultCompleted : this._customCompleted;\n }\n set completed(value: boolean) {\n this._customCompleted = coerceBooleanProperty(value);\n }\n private _customCompleted: boolean | null = null;\n\n private get _defaultCompleted() {\n return this.stepControl ? this.stepControl.valid && this.interacted : this.interacted;\n }\n\n constructor(@Inject(forwardRef(() => CdkStepper)) private _stepper: CdkStepper) { }\n\n /** Selects this step component. */\n select(): void {\n this._stepper.selected = this;\n }\n\n /** Resets the step to its initial state. Note that this includes resetting form data. */\n reset(): void {\n this.interacted = false;\n\n if (this._customCompleted != null) {\n this._customCompleted = false;\n }\n\n if (this.stepControl) {\n this.stepControl.reset();\n }\n }\n\n ngOnChanges() {\n // Since basically all inputs of the MatStep get proxied through the view down to the\n // underlying MatStepHeader, we have to make sure that change detection runs correctly.\n this._stepper._stateChanged();\n }\n}\n\n@Directive({\n selector: '[cdkStepper]',\n exportAs: 'cdkStepper',\n})\nexport class CdkStepper implements OnDestroy {\n /** Emits when the component is destroyed. */\n protected _destroyed = new Subject<void>();\n\n /** The list of step components that the stepper is holding. */\n @ContentChildren(CdkStep) _steps: QueryList<CdkStep>;\n\n /** The list of step headers of the steps in the stepper. */\n _stepHeader: QueryList<ElementRef>;\n\n /** Whether the validity of previous steps should be checked or not. */\n @Input()\n get linear(): boolean { return this._linear; }\n set linear(value: boolean) { this._linear = coerceBooleanProperty(value); }\n private _linear = false;\n\n /** The index of the selected step. */\n @Input()\n get selectedIndex() { return this._selectedIndex; }\n set selectedIndex(index: number) {\n if (this._steps) {\n // Ensure that the index can't be out of bounds.\n if (index < 0 || index > this._steps.length - 1) {\n throw Error('cdkStepper: Cannot assign out-of-bounds value to `selectedIndex`.');\n }\n\n if (this._anyControlsInvalidOrPending(index) || index < this._selectedIndex &&\n !this._steps.toArray()[index].editable) {\n // remove focus from clicked step header if the step is not able to be selected\n this._stepHeader.toArray()[index].nativeElement.blur();\n } else if (this._selectedIndex != index) {\n this._emitStepperSelectionEvent(index);\n this._focusIndex = this._selectedIndex;\n }\n } else {\n this._selectedIndex = this._focusIndex = index;\n }\n }\n private _selectedIndex = 0;\n\n /** The step that is selected. */\n @Input()\n get selected(): CdkStep { return this._steps.toArray()[this.selectedIndex]; }\n set selected(step: CdkStep) {\n this.selectedIndex = this._steps.toArray().indexOf(step);\n }\n\n /** Event emitted when the selected step has changed. */\n @Output() selectionChange: EventEmitter<StepperSelectionEvent>\n = new EventEmitter<StepperSelectionEvent>();\n\n /** The index of the step that the focus can be set. */\n _focusIndex: number = 0;\n\n /** Used to track unique ID for each stepper component. */\n _groupId: number;\n\n protected _orientation: StepperOrientation = 'horizontal';\n\n constructor(\n @Optional() private _dir: Directionality,\n private _changeDetectorRef: ChangeDetectorRef) {\n this._groupId = nextId++;\n }\n\n ngOnDestroy() {\n this._destroyed.next();\n this._destroyed.complete();\n }\n\n /** Selects and focuses the next step in list. */\n next(): void {\n this.selectedIndex = Math.min(this._selectedIndex + 1, this._steps.length - 1);\n }\n\n /** Selects and focuses the previous step in list. */\n previous(): void {\n this.selectedIndex = Math.max(this._selectedIndex - 1, 0);\n }\n\n /** Resets the stepper to its initial state. Note that this includes clearing form data. */\n reset(): void {\n this.selectedIndex = 0;\n this._steps.forEach(step => step.reset());\n this._stateChanged();\n }\n\n /** Returns a unique id for each step label element. */\n _getStepLabelId(i: number): string {\n return `cdk-step-label-${this._groupId}-${i}`;\n }\n\n /** Returns unique id for each step content element. */\n _getStepContentId(i: number): string {\n return `cdk-step-content-${this._groupId}-${i}`;\n }\n\n /** Marks the component to be change detected. */\n _stateChanged() {\n this._changeDetectorRef.markForCheck();\n }\n\n /** Returns position state of the step with the given index. */\n _getAnimationDirection(index: number): StepContentPositionState {\n const position = index - this._selectedIndex;\n if (position < 0) {\n return this._layoutDirection() === 'rtl' ? 'next' : 'previous';\n } else if (position > 0) {\n return this._layoutDirection() === 'rtl' ? 'previous' : 'next';\n }\n return 'current';\n }\n\n /** Returns the type of icon to be displayed. */\n _getIndicatorType(index: number): 'number' | 'edit' | 'done' {\n const step = this._steps.toArray()[index];\n if (!step.completed || this._selectedIndex == index) {\n return 'number';\n } else {\n return step.editable ? 'edit' : 'done';\n }\n }\n\n private _emitStepperSelectionEvent(newIndex: number): void {\n const stepsArray = this._steps.toArray();\n this.selectionChange.emit({\n selectedIndex: newIndex,\n previouslySelectedIndex: this._selectedIndex,\n selectedStep: stepsArray[newIndex],\n previouslySelectedStep: stepsArray[this._selectedIndex],\n });\n this._selectedIndex = newIndex;\n this._stateChanged();\n }\n\n _onKeydown(event: KeyboardEvent) {\n const keyCode = event.keyCode;\n\n // Note that the left/right arrows work both in vertical and horizontal mode.\n if (keyCode === RIGHT_ARROW) {\n this._layoutDirection() === 'rtl' ? this._focusPreviousStep() : this._focusNextStep();\n event.preventDefault();\n }\n\n if (keyCode === LEFT_ARROW) {\n this._layoutDirection() === 'rtl' ? this._focusNextStep() : this._focusPreviousStep();\n event.preventDefault();\n }\n\n // Note that the up/down arrows only work in vertical mode.\n // See: https://www.w3.org/TR/wai-aria-practices-1.1/#tabpanel\n if (this._orientation === 'vertical' && (keyCode === UP_ARROW || keyCode === DOWN_ARROW)) {\n keyCode === UP_ARROW ? this._focusPreviousStep() : this._focusNextStep();\n event.preventDefault();\n }\n\n if (keyCode === SPACE || keyCode === ENTER) {\n this.selectedIndex = this._focusIndex;\n event.preventDefault();\n }\n\n if (keyCode === HOME) {\n this._focusStep(0);\n event.preventDefault();\n }\n\n if (keyCode === END) {\n this._focusStep(this._steps.length - 1);\n event.preventDefault();\n }\n }\n\n private _focusNextStep() {\n this._focusStep((this._focusIndex + 1) % this._steps.length);\n }\n\n private _focusPreviousStep() {\n this._focusStep((this._focusIndex + this._steps.length - 1) % this._steps.length);\n }\n\n private _focusStep(index: number) {\n this._focusIndex = index;\n this._stepHeader.toArray()[this._focusIndex].nativeElement.focus();\n }\n\n private _anyControlsInvalidOrPending(index: number): boolean {\n const steps = this._steps.toArray();\n\n steps[this._selectedIndex].interacted = true;\n\n if (this._linear && index >= 0) {\n return steps.slice(0, index).some(step => {\n const control = step.stepControl;\n const isIncomplete = control ? (control.invalid || control.pending) : !step.completed;\n return isIncomplete && !step.optional;\n });\n }\n\n return false;\n }\n\n private _layoutDirection(): Direction {\n return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Directive, Input} from '@angular/core';\nimport {CdkStepper} from './stepper';\n\n/** Button that moves to the next step in a stepper workflow. */\n@Directive({\n selector: 'button[cdkStepperNext]',\n host: {\n '(click)': '_stepper.next()',\n '[type]': 'type',\n }\n})\nexport class CdkStepperNext {\n /** Type of the next button. Defaults to \"submit\" if not specified. */\n @Input() type: string = 'submit';\n\n constructor(public _stepper: CdkStepper) {}\n}\n\n/** Button that moves to the previous step in a stepper workflow. */\n@Directive({\n selector: 'button[cdkStepperPrevious]',\n host: {\n '(click)': '_stepper.previous()',\n '[type]': 'type',\n }\n})\nexport class CdkStepperPrevious {\n /** Type of the previous button. Defaults to \"button\" if not specified. */\n @Input() type: string = 'button';\n\n constructor(public _stepper: CdkStepper) {}\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {NgModule} from '@angular/core';\nimport {CdkStepper, CdkStep} from './stepper';\nimport {CommonModule} from '@angular/common';\nimport {CdkStepLabel} from './step-label';\nimport {CdkStepperNext, CdkStepperPrevious} from './stepper-button';\nimport {BidiModule} from '@angular/cdk/bidi';\n\n@NgModule({\n imports: [BidiModule, CommonModule],\n exports: [CdkStep, CdkStepper, CdkStepLabel, CdkStepperNext, CdkStepperPrevious],\n declarations: [CdkStep, CdkStepper, CdkStepLabel, CdkStepperNext, CdkStepperPrevious]\n})\nexport class CdkStepperModule {}\n"],"names":["CdkStepLabel","template","this","type","Directive","args","selector","TemplateRef","nextId","StepperSelectionEvent","CdkStep","_stepper","interacted","_editable","_optional","_customCompleted","Object","defineProperty","prototype","value","coerceBooleanProperty","_defaultCompleted","stepControl","valid","select","selected","reset","ngOnChanges","_stateChanged","Component","exportAs","encapsulation","ViewEncapsulation","None","preserveWhitespaces","changeDetection","ChangeDetectionStrategy","OnPush","propDecorators","Input","label","editable","optional","completed","CdkStepper","_changeDetectorRef","_selectedIndex","_groupId","get","configurable","index","_steps","length","_anyControlsInvalidOrPending","toArray","_stepHeader","nativeElement","blur","_emitStepperSelectionEvent","_focusIndex","enumerable","_destroyed","complete","forEach","step","position","_layoutDirection","selectionChange","emit","selectedIndex","newIndex","previouslySelectedIndex","selectedStep","stepsArray","previouslySelectedStep","keyCode","RIGHT_ARROW","event","preventDefault","LEFT_ARROW","_focusNextStep","_focusPreviousStep","SPACE","ENTER","HOME","_focusStep","END","focus","steps","_linear","slice","some","control","invalid","pending","decorators","Output","CdkStepperNext","host","(click)","[type]","CdkStepperPrevious","CdkStepperModule","NgModule","imports","BidiModule","CommonModule","exports","declarations"],"mappings":";;;;;;;yqBAQA,IAAAA,GAAA,WAME,QAAFA,GAA0CC,GAAAC,KAA1CD,SAA0CA,EAd1C,sBAUAE,KAACC,EAAAA,UAADC,OACEC,SAAU,yDAHZH,KAAmBI,EAAAA,eARnBP,KC8CIQ,EAAS,EAYbC,EAAA,yBA1DA,MAAAA,mBA+HE,QAAFC,GAA4DC,GAAAT,KAA5DS,SAA4DA,EAnC5DT,KAAAU,YAAe,EAWfV,KAAAW,WAAsB,EAQtBX,KAAAY,WAAsB,EAUtBZ,KAAAa,iBAA6C,KAP7C,MAfAC,QAAAC,eAA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,YAAAD,UAAApD,KAAAyD,aAAAH,cAAA+B,yFAMI,OADJC,GAAuCtF,KAAa4C,gBAApDlC,YAAA,KACAV,KAAAuF,SAAAvC,GAAkB,IAEHsC,EAAfE,MAAA,EAA8BxC,GAA9ByC,KAAA,SAAA3B,GAEY,GAAqB4B,GAAjC5B,EAAA1C,WAEQ,QADRsE,EAAAA,EAAAC,SAAAD,EAAAE,SAAA9B,EAAArB,aACAqB,EAAAtB,2GAUAE,EAAWmD,6DA9MXjE,SAAA,wIAjIAc,EAAAN,mFA0IA+B,gBAAAlE,KAAAoC,EAAAA,QAMAd,WAAAtB,KAAAoC,EAAAA,QAMA4B,kBAAAhE,KAAA6F,EAAAA,UA+BApD,kBCvLE,QAAFqD,GAAqBtF,GAAAT,KAArBS,SAAqBA,EAFrBT,KAAAC,KAA0B,SArB1B,sBAYAA,KAACC,EAAAA,UAADC,OACEC,SAAU,yBACV4F,MACEC,UAAW,kBACXC,SAAU,gDAPdjG,KAAQyC,uBAYRzC,OAAAA,KAAGoC,EAAAA,SArBH0D,kBAsCE,QAAFI,GAAqB1F,GAAAT,KAArBS,SAAqBA,EAFrBT,KAAAC,KAA0B,SApC1B,sBA2BAA,KAACC,EAAAA,UAADC,OACEC,SAAU,6BACV4F,MACEC,UAAW,sBACXC,SAAU,gDAtBdjG,KAAQyC,uBA2BRzC,OAAAA,KAAGoC,EAAAA,SApCH8D,KCQAC,EAAA,yBARA,sBAeAnG,KAACoG,EAAAA,SAADlG,OACEmG,SAAUC,EAAAA,WAAYC,EAAAA,cACtBC,SAAUjG,EAASkC,EAAY5C,EAAciG,EAAgBI,GAC7DO,cAAelG,EAASkC,EAAY5C,EAAciG,EAAgBI,6CAlBpEC"}
|
|
1
|
+
{"version":3,"file":"cdk-stepper.umd.min.js","sources":["../../src/cdk/stepper/step-label.ts","../../src/cdk/stepper/stepper.ts","../../src/cdk/stepper/stepper-button.ts","../../src/cdk/stepper/stepper-module.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Directive, TemplateRef} from '@angular/core';\n\n@Directive({\n selector: '[cdkStepLabel]',\n})\nexport class CdkStepLabel {\n constructor(/** @docs-private */ public template: TemplateRef<any>) { }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n ContentChildren,\n EventEmitter,\n Input,\n Output,\n QueryList,\n Directive,\n ElementRef,\n Component,\n ContentChild,\n ViewChild,\n TemplateRef,\n ViewEncapsulation,\n Optional,\n Inject,\n forwardRef,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnChanges,\n OnDestroy\n} from '@angular/core';\nimport {\n LEFT_ARROW,\n RIGHT_ARROW,\n DOWN_ARROW,\n UP_ARROW,\n ENTER,\n SPACE,\n HOME,\n END,\n} from '@angular/cdk/keycodes';\nimport {CdkStepLabel} from './step-label';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {AbstractControl} from '@angular/forms';\nimport {Direction, Directionality} from '@angular/cdk/bidi';\nimport {Subject} from 'rxjs/Subject';\n\n/** Used to generate unique ID for each stepper component. */\nlet nextId = 0;\n\n/**\n * Position state of the content of each step in stepper that is used for transitioning\n * the content into correct position upon step selection change.\n */\nexport type StepContentPositionState = 'previous' | 'current' | 'next';\n\n/** Possible orientation of a stepper. */\nexport type StepperOrientation = 'horizontal' | 'vertical';\n\n/** Change event emitted on selection changes. */\nexport class StepperSelectionEvent {\n /** Index of the step now selected. */\n selectedIndex: number;\n\n /** Index of the step previously selected. */\n previouslySelectedIndex: number;\n\n /** The step instance now selected. */\n selectedStep: CdkStep;\n\n /** The step instance previously selected. */\n previouslySelectedStep: CdkStep;\n}\n\n@Component({\n moduleId: module.id,\n selector: 'cdk-step',\n exportAs: 'cdkStep',\n templateUrl: 'step.html',\n encapsulation: ViewEncapsulation.None,\n preserveWhitespaces: false,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CdkStep implements OnChanges {\n /** Template for step label if it exists. */\n @ContentChild(CdkStepLabel) stepLabel: CdkStepLabel;\n\n /** Template for step content. */\n @ViewChild(TemplateRef) content: TemplateRef<any>;\n\n /** The top level abstract control of the step. */\n @Input() stepControl: AbstractControl;\n\n /** Whether user has seen the expanded step content or not. */\n interacted = false;\n\n /** Label of the step. */\n @Input() label: string;\n\n /** Whether the user can return to this step once it has been marked as complted. */\n @Input()\n get editable(): boolean { return this._editable; }\n set editable(value: boolean) {\n this._editable = coerceBooleanProperty(value);\n }\n private _editable = true;\n\n /** Whether the completion of step is optional. */\n @Input()\n get optional(): boolean { return this._optional; }\n set optional(value: boolean) {\n this._optional = coerceBooleanProperty(value);\n }\n private _optional = false;\n\n /** Whether step is marked as completed. */\n @Input()\n get completed(): boolean {\n return this._customCompleted == null ? this._defaultCompleted : this._customCompleted;\n }\n set completed(value: boolean) {\n this._customCompleted = coerceBooleanProperty(value);\n }\n private _customCompleted: boolean | null = null;\n\n private get _defaultCompleted() {\n return this.stepControl ? this.stepControl.valid && this.interacted : this.interacted;\n }\n\n constructor(@Inject(forwardRef(() => CdkStepper)) private _stepper: CdkStepper) { }\n\n /** Selects this step component. */\n select(): void {\n this._stepper.selected = this;\n }\n\n /** Resets the step to its initial state. Note that this includes resetting form data. */\n reset(): void {\n this.interacted = false;\n\n if (this._customCompleted != null) {\n this._customCompleted = false;\n }\n\n if (this.stepControl) {\n this.stepControl.reset();\n }\n }\n\n ngOnChanges() {\n // Since basically all inputs of the MatStep get proxied through the view down to the\n // underlying MatStepHeader, we have to make sure that change detection runs correctly.\n this._stepper._stateChanged();\n }\n}\n\n@Directive({\n selector: '[cdkStepper]',\n exportAs: 'cdkStepper',\n})\nexport class CdkStepper implements OnDestroy {\n /** Emits when the component is destroyed. */\n protected _destroyed = new Subject<void>();\n\n /** The list of step components that the stepper is holding. */\n @ContentChildren(CdkStep) _steps: QueryList<CdkStep>;\n\n /** The list of step headers of the steps in the stepper. */\n _stepHeader: QueryList<ElementRef>;\n\n /** Whether the validity of previous steps should be checked or not. */\n @Input()\n get linear(): boolean { return this._linear; }\n set linear(value: boolean) { this._linear = coerceBooleanProperty(value); }\n private _linear = false;\n\n /** The index of the selected step. */\n @Input()\n get selectedIndex() { return this._selectedIndex; }\n set selectedIndex(index: number) {\n if (this._steps) {\n // Ensure that the index can't be out of bounds.\n if (index < 0 || index > this._steps.length - 1) {\n throw Error('cdkStepper: Cannot assign out-of-bounds value to `selectedIndex`.');\n }\n\n if (this._anyControlsInvalidOrPending(index) || index < this._selectedIndex &&\n !this._steps.toArray()[index].editable) {\n // remove focus from clicked step header if the step is not able to be selected\n this._stepHeader.toArray()[index].nativeElement.blur();\n } else if (this._selectedIndex != index) {\n this._emitStepperSelectionEvent(index);\n this._focusIndex = this._selectedIndex;\n }\n } else {\n this._selectedIndex = this._focusIndex = index;\n }\n }\n private _selectedIndex = 0;\n\n /** The step that is selected. */\n @Input()\n get selected(): CdkStep { return this._steps.toArray()[this.selectedIndex]; }\n set selected(step: CdkStep) {\n this.selectedIndex = this._steps.toArray().indexOf(step);\n }\n\n /** Event emitted when the selected step has changed. */\n @Output() selectionChange: EventEmitter<StepperSelectionEvent>\n = new EventEmitter<StepperSelectionEvent>();\n\n /** The index of the step that the focus can be set. */\n _focusIndex: number = 0;\n\n /** Used to track unique ID for each stepper component. */\n _groupId: number;\n\n protected _orientation: StepperOrientation = 'horizontal';\n\n constructor(\n @Optional() private _dir: Directionality,\n private _changeDetectorRef: ChangeDetectorRef) {\n this._groupId = nextId++;\n }\n\n ngOnDestroy() {\n this._destroyed.next();\n this._destroyed.complete();\n }\n\n /** Selects and focuses the next step in list. */\n next(): void {\n this.selectedIndex = Math.min(this._selectedIndex + 1, this._steps.length - 1);\n }\n\n /** Selects and focuses the previous step in list. */\n previous(): void {\n this.selectedIndex = Math.max(this._selectedIndex - 1, 0);\n }\n\n /** Resets the stepper to its initial state. Note that this includes clearing form data. */\n reset(): void {\n this.selectedIndex = 0;\n this._steps.forEach(step => step.reset());\n this._stateChanged();\n }\n\n /** Returns a unique id for each step label element. */\n _getStepLabelId(i: number): string {\n return `cdk-step-label-${this._groupId}-${i}`;\n }\n\n /** Returns unique id for each step content element. */\n _getStepContentId(i: number): string {\n return `cdk-step-content-${this._groupId}-${i}`;\n }\n\n /** Marks the component to be change detected. */\n _stateChanged() {\n this._changeDetectorRef.markForCheck();\n }\n\n /** Returns position state of the step with the given index. */\n _getAnimationDirection(index: number): StepContentPositionState {\n const position = index - this._selectedIndex;\n if (position < 0) {\n return this._layoutDirection() === 'rtl' ? 'next' : 'previous';\n } else if (position > 0) {\n return this._layoutDirection() === 'rtl' ? 'previous' : 'next';\n }\n return 'current';\n }\n\n /** Returns the type of icon to be displayed. */\n _getIndicatorType(index: number): 'number' | 'edit' | 'done' {\n const step = this._steps.toArray()[index];\n if (!step.completed || this._selectedIndex == index) {\n return 'number';\n } else {\n return step.editable ? 'edit' : 'done';\n }\n }\n\n private _emitStepperSelectionEvent(newIndex: number): void {\n const stepsArray = this._steps.toArray();\n this.selectionChange.emit({\n selectedIndex: newIndex,\n previouslySelectedIndex: this._selectedIndex,\n selectedStep: stepsArray[newIndex],\n previouslySelectedStep: stepsArray[this._selectedIndex],\n });\n this._selectedIndex = newIndex;\n this._stateChanged();\n }\n\n _onKeydown(event: KeyboardEvent) {\n const keyCode = event.keyCode;\n\n // Note that the left/right arrows work both in vertical and horizontal mode.\n if (keyCode === RIGHT_ARROW) {\n this._layoutDirection() === 'rtl' ? this._focusPreviousStep() : this._focusNextStep();\n event.preventDefault();\n }\n\n if (keyCode === LEFT_ARROW) {\n this._layoutDirection() === 'rtl' ? this._focusNextStep() : this._focusPreviousStep();\n event.preventDefault();\n }\n\n // Note that the up/down arrows only work in vertical mode.\n // See: https://www.w3.org/TR/wai-aria-practices-1.1/#tabpanel\n if (this._orientation === 'vertical' && (keyCode === UP_ARROW || keyCode === DOWN_ARROW)) {\n keyCode === UP_ARROW ? this._focusPreviousStep() : this._focusNextStep();\n event.preventDefault();\n }\n\n if (keyCode === SPACE || keyCode === ENTER) {\n this.selectedIndex = this._focusIndex;\n event.preventDefault();\n }\n\n if (keyCode === HOME) {\n this._focusStep(0);\n event.preventDefault();\n }\n\n if (keyCode === END) {\n this._focusStep(this._steps.length - 1);\n event.preventDefault();\n }\n }\n\n private _focusNextStep() {\n this._focusStep((this._focusIndex + 1) % this._steps.length);\n }\n\n private _focusPreviousStep() {\n this._focusStep((this._focusIndex + this._steps.length - 1) % this._steps.length);\n }\n\n private _focusStep(index: number) {\n this._focusIndex = index;\n this._stepHeader.toArray()[this._focusIndex].nativeElement.focus();\n }\n\n private _anyControlsInvalidOrPending(index: number): boolean {\n const steps = this._steps.toArray();\n\n steps[this._selectedIndex].interacted = true;\n\n if (this._linear && index >= 0) {\n return steps.slice(0, index).some(step => {\n const control = step.stepControl;\n const isIncomplete = control ?\n (control.invalid || control.pending || !step.interacted) :\n !step.completed;\n return isIncomplete && !step.optional;\n });\n }\n\n return false;\n }\n\n private _layoutDirection(): Direction {\n return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Directive, Input} from '@angular/core';\nimport {CdkStepper} from './stepper';\n\n/** Button that moves to the next step in a stepper workflow. */\n@Directive({\n selector: 'button[cdkStepperNext]',\n host: {\n '(click)': '_stepper.next()',\n '[type]': 'type',\n }\n})\nexport class CdkStepperNext {\n /** Type of the next button. Defaults to \"submit\" if not specified. */\n @Input() type: string = 'submit';\n\n constructor(public _stepper: CdkStepper) {}\n}\n\n/** Button that moves to the previous step in a stepper workflow. */\n@Directive({\n selector: 'button[cdkStepperPrevious]',\n host: {\n '(click)': '_stepper.previous()',\n '[type]': 'type',\n }\n})\nexport class CdkStepperPrevious {\n /** Type of the previous button. Defaults to \"button\" if not specified. */\n @Input() type: string = 'button';\n\n constructor(public _stepper: CdkStepper) {}\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {NgModule} from '@angular/core';\nimport {CdkStepper, CdkStep} from './stepper';\nimport {CommonModule} from '@angular/common';\nimport {CdkStepLabel} from './step-label';\nimport {CdkStepperNext, CdkStepperPrevious} from './stepper-button';\nimport {BidiModule} from '@angular/cdk/bidi';\n\n@NgModule({\n imports: [BidiModule, CommonModule],\n exports: [CdkStep, CdkStepper, CdkStepLabel, CdkStepperNext, CdkStepperPrevious],\n declarations: [CdkStep, CdkStepper, CdkStepLabel, CdkStepperNext, CdkStepperPrevious]\n})\nexport class CdkStepperModule {}\n"],"names":["CdkStepLabel","template","this","type","Directive","args","selector","TemplateRef","nextId","StepperSelectionEvent","CdkStep","_stepper","interacted","_editable","_optional","_customCompleted","Object","defineProperty","prototype","value","coerceBooleanProperty","_defaultCompleted","stepControl","valid","select","selected","reset","ngOnChanges","_stateChanged","Component","exportAs","encapsulation","ViewEncapsulation","None","preserveWhitespaces","changeDetection","ChangeDetectionStrategy","OnPush","propDecorators","Input","label","editable","optional","completed","CdkStepper","_changeDetectorRef","_selectedIndex","_groupId","get","configurable","index","_steps","length","_anyControlsInvalidOrPending","toArray","_stepHeader","nativeElement","blur","_emitStepperSelectionEvent","_focusIndex","enumerable","_destroyed","complete","forEach","step","position","_layoutDirection","selectionChange","emit","selectedIndex","newIndex","previouslySelectedIndex","selectedStep","stepsArray","previouslySelectedStep","keyCode","RIGHT_ARROW","event","preventDefault","LEFT_ARROW","_focusNextStep","_focusPreviousStep","SPACE","ENTER","HOME","_focusStep","END","focus","steps","_linear","slice","some","control","invalid","pending","decorators","Output","CdkStepperNext","host","(click)","[type]","CdkStepperPrevious","CdkStepperModule","NgModule","imports","BidiModule","CommonModule","exports","declarations"],"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C,EAAAA,SApCH8D,KCQAC,EAAA,yBARA,sBAeAnG,KAACoG,EAAAA,SAADlG,OACEmG,SAAUC,EAAAA,WAAYC,EAAAA,cACtBC,SAAUjG,EAASkC,EAAY5C,EAAciG,EAAgBI,GAC7DO,cAAelG,EAASkC,EAAY5C,EAAciG,EAAgBI,6CAlBpEC"}
|
package/bundles/cdk.umd.js
CHANGED
package/bundles/cdk.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.umd.js","sources":["../../src/cdk/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('5.2.
|
|
1
|
+
{"version":3,"file":"cdk.umd.js","sources":["../../src/cdk/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('5.2.5');\n"],"names":["Version"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAWA,IAAa,OAAO,GAAG,IAAIA,qBAAO,CAAC,mBAAmB,CAAC,CAAC;;;;;;"}
|
package/bundles/cdk.umd.min.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","@angular/core"],n):n((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{}),e.ng.core)}(this,function(e,n){"use strict";var o=new n.Version("5.2.
|
|
8
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","@angular/core"],n):n((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{}),e.ng.core)}(this,function(e,n){"use strict";var o=new n.Version("5.2.5");e.VERSION=o,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
9
9
|
//# sourceMappingURL=cdk.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.umd.min.js","sources":["../../src/cdk/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('5.2.
|
|
1
|
+
{"version":3,"file":"cdk.umd.min.js","sources":["../../src/cdk/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('5.2.5');\n"],"names":["VERSION","Version"],"mappings":";;;;;;;uQAWA,IAAaA,GAAU,GAAIC,GAAAA,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"CollectionViewer":{"__symbolic":"interface"},"DataSource":{"__symbolic":"class","arity":1,"members":{"connect":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}]}},"SelectionModel":{"__symbolic":"class","arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[null,{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":40,"character":30,"context":{"typeName":"T"},"module":"./selection"}]},null]}],"select":[{"__symbolic":"method"}],"deselect":[{"__symbolic":"method"}],"toggle":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"isSelected":[{"__symbolic":"method"}],"isEmpty":[{"__symbolic":"method"}],"hasValue":[{"__symbolic":"method"}],"sort":[{"__symbolic":"method"}],"_emitChangeEvent":[{"__symbolic":"method"}],"_markSelected":[{"__symbolic":"method"}],"_unmarkSelected":[{"__symbolic":"method"}],"_unmarkAll":[{"__symbolic":"method"}],"_verifyValueAssignment":[{"__symbolic":"method"}]}},"SelectionChange":{"__symbolic":"
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"CollectionViewer":{"__symbolic":"interface"},"DataSource":{"__symbolic":"class","arity":1,"members":{"connect":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}]}},"SelectionModel":{"__symbolic":"class","arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[null,{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":40,"character":30,"context":{"typeName":"T"},"module":"./selection"}]},null]}],"select":[{"__symbolic":"method"}],"deselect":[{"__symbolic":"method"}],"toggle":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"isSelected":[{"__symbolic":"method"}],"isEmpty":[{"__symbolic":"method"}],"hasValue":[{"__symbolic":"method"}],"sort":[{"__symbolic":"method"}],"_emitChangeEvent":[{"__symbolic":"method"}],"_markSelected":[{"__symbolic":"method"}],"_unmarkSelected":[{"__symbolic":"method"}],"_unmarkAll":[{"__symbolic":"method"}],"_verifyValueAssignment":[{"__symbolic":"method"}]}},"SelectionChange":{"__symbolic":"interface"},"getMultipleValuesInSingleSelectionError":{"__symbolic":"function","parameters":[],"value":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Error"},"arguments":["Cannot pass multiple values into SelectionModel with single-value mode."]}},"ɵa":{"__symbolic":"function","parameters":["parentDispatcher"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"reference","name":"parentDispatcher"},"right":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"UniqueSelectionDispatcher"}}}},"UniqueSelectionDispatcher":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":23,"character":1}}],"members":{"notify":[{"__symbolic":"method"}],"listen":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"UniqueSelectionDispatcherListener":{"__symbolic":"interface"},"UNIQUE_SELECTION_DISPATCHER_PROVIDER":{"provide":{"__symbolic":"reference","name":"UniqueSelectionDispatcher"},"deps":[[{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":66,"character":14}},{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":66,"character":30}},{"__symbolic":"reference","name":"UniqueSelectionDispatcher"}]],"useFactory":{"__symbolic":"reference","name":"ɵa"}}},"origins":{"CollectionViewer":"./collection-viewer","DataSource":"./data-source","SelectionModel":"./selection","SelectionChange":"./selection","getMultipleValuesInSingleSelectionError":"./selection","ɵa":"./unique-selection-dispatcher","UniqueSelectionDispatcher":"./unique-selection-dispatcher","UniqueSelectionDispatcherListener":"./unique-selection-dispatcher","UNIQUE_SELECTION_DISPATCHER_PROVIDER":"./unique-selection-dispatcher"},"importAs":"@angular/cdk/collections"}
|
|
@@ -75,20 +75,13 @@ export declare class SelectionModel<T> {
|
|
|
75
75
|
* Event emitted when the value of a MatSelectionModel has changed.
|
|
76
76
|
* @docs-private
|
|
77
77
|
*/
|
|
78
|
-
export
|
|
78
|
+
export interface SelectionChange<T> {
|
|
79
79
|
/** Model that dispatched the event. */
|
|
80
80
|
source: SelectionModel<T>;
|
|
81
81
|
/** Options that were added to the model. */
|
|
82
|
-
added: T[]
|
|
82
|
+
added: T[];
|
|
83
83
|
/** Options that were removed from the model. */
|
|
84
|
-
removed: T[]
|
|
85
|
-
constructor(
|
|
86
|
-
/** Model that dispatched the event. */
|
|
87
|
-
source: SelectionModel<T>,
|
|
88
|
-
/** Options that were added to the model. */
|
|
89
|
-
added?: T[] | undefined,
|
|
90
|
-
/** Options that were removed from the model. */
|
|
91
|
-
removed?: T[] | undefined);
|
|
84
|
+
removed: T[];
|
|
92
85
|
}
|
|
93
86
|
/**
|
|
94
87
|
* Returns an error that reports that multiple values are passed into a selection model
|
package/esm2015/a11y.js
CHANGED
|
@@ -808,7 +808,7 @@ class AriaDescriber {
|
|
|
808
808
|
* @return {?}
|
|
809
809
|
*/
|
|
810
810
|
describe(hostElement, message) {
|
|
811
|
-
if (
|
|
811
|
+
if (!this._canBeDescribed(hostElement, message)) {
|
|
812
812
|
return;
|
|
813
813
|
}
|
|
814
814
|
if (!messageRegistry.has(message)) {
|
|
@@ -825,7 +825,7 @@ class AriaDescriber {
|
|
|
825
825
|
* @return {?}
|
|
826
826
|
*/
|
|
827
827
|
removeDescription(hostElement, message) {
|
|
828
|
-
if (
|
|
828
|
+
if (!this._canBeDescribed(hostElement, message)) {
|
|
829
829
|
return;
|
|
830
830
|
}
|
|
831
831
|
if (this._isElementDescribedByMessage(hostElement, message)) {
|
|
@@ -955,6 +955,16 @@ class AriaDescriber {
|
|
|
955
955
|
const /** @type {?} */ messageId = registeredMessage && registeredMessage.messageElement.id;
|
|
956
956
|
return !!messageId && referenceIds.indexOf(messageId) != -1;
|
|
957
957
|
}
|
|
958
|
+
/**
|
|
959
|
+
* Determines whether a message can be described on a particular element.
|
|
960
|
+
* @param {?} element
|
|
961
|
+
* @param {?} message
|
|
962
|
+
* @return {?}
|
|
963
|
+
*/
|
|
964
|
+
_canBeDescribed(element, message) {
|
|
965
|
+
return element.nodeType === this._document.ELEMENT_NODE && message != null &&
|
|
966
|
+
!!`${message}`.trim();
|
|
967
|
+
}
|
|
958
968
|
}
|
|
959
969
|
AriaDescriber.decorators = [
|
|
960
970
|
{ type: Injectable },
|
|
@@ -1010,6 +1020,11 @@ class ListKeyManager {
|
|
|
1010
1020
|
this._letterKeyStream = new Subject();
|
|
1011
1021
|
this._typeaheadSubscription = Subscription.EMPTY;
|
|
1012
1022
|
this._vertical = true;
|
|
1023
|
+
/**
|
|
1024
|
+
* Predicate function that can be used to check whether an item should be skipped
|
|
1025
|
+
* by the key manager. By default, disabled items are skipped.
|
|
1026
|
+
*/
|
|
1027
|
+
this._skipPredicateFn = (item) => item.disabled;
|
|
1013
1028
|
this._pressedLetters = [];
|
|
1014
1029
|
/**
|
|
1015
1030
|
* Stream that emits any time the TAB key is pressed, so components can react
|
|
@@ -1030,6 +1045,16 @@ class ListKeyManager {
|
|
|
1030
1045
|
}
|
|
1031
1046
|
});
|
|
1032
1047
|
}
|
|
1048
|
+
/**
|
|
1049
|
+
* Sets the predicate function that determines which items should be skipped by the
|
|
1050
|
+
* list key manager.
|
|
1051
|
+
* @param {?} predicate Function that determines whether the given item should be skipped.
|
|
1052
|
+
* @return {?}
|
|
1053
|
+
*/
|
|
1054
|
+
skipPredicate(predicate) {
|
|
1055
|
+
this._skipPredicateFn = predicate;
|
|
1056
|
+
return this;
|
|
1057
|
+
}
|
|
1033
1058
|
/**
|
|
1034
1059
|
* Turns on wrapping mode, which ensures that the active item will wrap to
|
|
1035
1060
|
* the other end of list when there are no more items in the given direction.
|
|
@@ -1078,7 +1103,7 @@ class ListKeyManager {
|
|
|
1078
1103
|
for (let /** @type {?} */ i = 1; i < items.length + 1; i++) {
|
|
1079
1104
|
const /** @type {?} */ index = (this._activeItemIndex + i) % items.length;
|
|
1080
1105
|
const /** @type {?} */ item = items[index];
|
|
1081
|
-
if (!item
|
|
1106
|
+
if (!this._skipPredicateFn(item) && /** @type {?} */ ((item.getLabel))().toUpperCase().trim().indexOf(inputString) === 0) {
|
|
1082
1107
|
this.setActiveItem(index);
|
|
1083
1108
|
break;
|
|
1084
1109
|
}
|
|
@@ -1116,11 +1141,17 @@ class ListKeyManager {
|
|
|
1116
1141
|
this.setNextItemActive();
|
|
1117
1142
|
break;
|
|
1118
1143
|
}
|
|
1144
|
+
else {
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1119
1147
|
case UP_ARROW:
|
|
1120
1148
|
if (this._vertical) {
|
|
1121
1149
|
this.setPreviousItemActive();
|
|
1122
1150
|
break;
|
|
1123
1151
|
}
|
|
1152
|
+
else {
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1124
1155
|
case RIGHT_ARROW:
|
|
1125
1156
|
if (this._horizontal === 'ltr') {
|
|
1126
1157
|
this.setNextItemActive();
|
|
@@ -1130,6 +1161,9 @@ class ListKeyManager {
|
|
|
1130
1161
|
this.setPreviousItemActive();
|
|
1131
1162
|
break;
|
|
1132
1163
|
}
|
|
1164
|
+
else {
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1133
1167
|
case LEFT_ARROW:
|
|
1134
1168
|
if (this._horizontal === 'ltr') {
|
|
1135
1169
|
this.setPreviousItemActive();
|
|
@@ -1139,6 +1173,9 @@ class ListKeyManager {
|
|
|
1139
1173
|
this.setNextItemActive();
|
|
1140
1174
|
break;
|
|
1141
1175
|
}
|
|
1176
|
+
else {
|
|
1177
|
+
return;
|
|
1178
|
+
}
|
|
1142
1179
|
default:
|
|
1143
1180
|
// Attempt to use the `event.key` which also maps it to the user's keyboard language,
|
|
1144
1181
|
// otherwise fall back to resolving alphanumeric characters via the keyCode.
|
|
@@ -1227,15 +1264,13 @@ class ListKeyManager {
|
|
|
1227
1264
|
* @return {?}
|
|
1228
1265
|
*/
|
|
1229
1266
|
_setActiveInWrapMode(delta, items) {
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
else {
|
|
1238
|
-
this.setActiveItem(this._activeItemIndex);
|
|
1267
|
+
for (let /** @type {?} */ i = 1; i <= items.length; i++) {
|
|
1268
|
+
const /** @type {?} */ index = (this._activeItemIndex + (delta * i) + items.length) % items.length;
|
|
1269
|
+
const /** @type {?} */ item = items[index];
|
|
1270
|
+
if (!this._skipPredicateFn(item)) {
|
|
1271
|
+
this.setActiveItem(index);
|
|
1272
|
+
return;
|
|
1273
|
+
}
|
|
1239
1274
|
}
|
|
1240
1275
|
}
|
|
1241
1276
|
/**
|
|
@@ -1262,7 +1297,7 @@ class ListKeyManager {
|
|
|
1262
1297
|
if (!items[index]) {
|
|
1263
1298
|
return;
|
|
1264
1299
|
}
|
|
1265
|
-
while (items[index]
|
|
1300
|
+
while (this._skipPredicateFn(items[index])) {
|
|
1266
1301
|
index += fallbackDelta;
|
|
1267
1302
|
if (!items[index]) {
|
|
1268
1303
|
return;
|