@angular/cdk 7.1.1 → 7.2.0

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.
Files changed (122) hide show
  1. package/bundles/cdk-a11y.umd.js +5 -1
  2. package/bundles/cdk-a11y.umd.js.map +1 -1
  3. package/bundles/cdk-a11y.umd.min.js +1 -1
  4. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  5. package/bundles/cdk-drag-drop.umd.js +2030 -1049
  6. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  7. package/bundles/cdk-drag-drop.umd.min.js +2 -1
  8. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  9. package/bundles/cdk-stepper.umd.js +11 -3
  10. package/bundles/cdk-stepper.umd.js.map +1 -1
  11. package/bundles/cdk-stepper.umd.min.js +1 -1
  12. package/bundles/cdk-stepper.umd.min.js.map +1 -1
  13. package/bundles/cdk-text-field.umd.js +41 -16
  14. package/bundles/cdk-text-field.umd.js.map +1 -1
  15. package/bundles/cdk-text-field.umd.min.js +1 -1
  16. package/bundles/cdk-text-field.umd.min.js.map +1 -1
  17. package/bundles/cdk-tree.umd.js +1 -1
  18. package/bundles/cdk-tree.umd.js.map +1 -1
  19. package/bundles/cdk-tree.umd.min.js +1 -1
  20. package/bundles/cdk-tree.umd.min.js.map +1 -1
  21. package/bundles/cdk.umd.js +1 -1
  22. package/bundles/cdk.umd.js.map +1 -1
  23. package/bundles/cdk.umd.min.js +1 -1
  24. package/bundles/cdk.umd.min.js.map +1 -1
  25. package/drag-drop/typings/{drag-handle.d.ts → directives/drag-handle.d.ts} +0 -0
  26. package/drag-drop/typings/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  27. package/drag-drop/typings/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  28. package/drag-drop/typings/directives/drag.d.ts +108 -0
  29. package/{typings/esm5/drag-drop → drag-drop/typings/directives}/drop-list-group.d.ts +3 -0
  30. package/drag-drop/typings/directives/drop-list.d.ts +135 -0
  31. package/drag-drop/typings/drag-drop-registry.d.ts +8 -3
  32. package/drag-drop/typings/drag-events.d.ts +14 -7
  33. package/{typings/esm5/drag-drop/drag.d.ts → drag-drop/typings/drag-ref.d.ts} +143 -82
  34. package/drag-drop/typings/drop-list-container.d.ts +19 -3
  35. package/drag-drop/typings/{drop-list.d.ts → drop-list-ref.d.ts} +132 -84
  36. package/drag-drop/typings/index.d.ts +1 -0
  37. package/drag-drop/typings/index.metadata.json +1 -1
  38. package/drag-drop/typings/public-api.d.ts +13 -6
  39. package/esm2015/a11y.js +5 -1
  40. package/esm2015/a11y.js.map +1 -1
  41. package/esm2015/cdk.js +1 -1
  42. package/esm2015/cdk.js.map +1 -1
  43. package/esm2015/drag-drop.js +1546 -811
  44. package/esm2015/drag-drop.js.map +1 -1
  45. package/esm2015/stepper.js +11 -4
  46. package/esm2015/stepper.js.map +1 -1
  47. package/esm2015/text-field.js +28 -16
  48. package/esm2015/text-field.js.map +1 -1
  49. package/esm2015/tree.js +2 -2
  50. package/esm2015/tree.js.map +1 -1
  51. package/esm5/a11y.es5.js +5 -1
  52. package/esm5/a11y.es5.js.map +1 -1
  53. package/esm5/cdk.es5.js +1 -1
  54. package/esm5/cdk.es5.js.map +1 -1
  55. package/esm5/drag-drop.es5.js +2025 -1045
  56. package/esm5/drag-drop.es5.js.map +1 -1
  57. package/esm5/stepper.es5.js +11 -4
  58. package/esm5/stepper.es5.js.map +1 -1
  59. package/esm5/text-field.es5.js +41 -16
  60. package/esm5/text-field.es5.js.map +1 -1
  61. package/esm5/tree.es5.js +2 -2
  62. package/esm5/tree.es5.js.map +1 -1
  63. package/package.json +4 -4
  64. package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts +2 -2
  65. package/schematics/ng-update/upgrade-data.js +2 -1
  66. package/schematics/ng-update/upgrade-data.js.map +1 -1
  67. package/schematics/ng-update/upgrade-rules/index.js +3 -2
  68. package/schematics/ng-update/upgrade-rules/index.js.map +1 -1
  69. package/schematics/utils/ast/ng-module-imports.d.ts +1 -1
  70. package/schematics/utils/ast/ng-module-imports.js +25 -13
  71. package/schematics/utils/ast/ng-module-imports.js.map +1 -1
  72. package/schematics/utils/get-project.js +2 -1
  73. package/schematics/utils/get-project.js.map +1 -1
  74. package/schematics/utils/parse5-element.js +3 -2
  75. package/schematics/utils/parse5-element.js.map +1 -1
  76. package/schematics/utils/project-targets.js +2 -1
  77. package/schematics/utils/project-targets.js.map +1 -1
  78. package/schematics/utils/version-agnostic-typescript.js +3 -2
  79. package/schematics/utils/version-agnostic-typescript.js.map +1 -1
  80. package/stepper/typings/index.metadata.json +1 -1
  81. package/stepper/typings/stepper.d.ts +6 -0
  82. package/text-field/typings/autosize.d.ts +6 -0
  83. package/text-field/typings/index.metadata.json +1 -1
  84. package/typings/drag-drop/{drag-handle.d.ts → directives/drag-handle.d.ts} +0 -0
  85. package/typings/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  86. package/typings/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  87. package/typings/drag-drop/directives/drag.d.ts +108 -0
  88. package/typings/drag-drop/{drop-list-group.d.ts → directives/drop-list-group.d.ts} +3 -0
  89. package/typings/drag-drop/directives/drop-list.d.ts +135 -0
  90. package/typings/drag-drop/drag-drop-registry.d.ts +8 -3
  91. package/typings/drag-drop/drag-events.d.ts +14 -7
  92. package/typings/drag-drop/{drag.d.ts → drag-ref.d.ts} +143 -82
  93. package/typings/drag-drop/drop-list-container.d.ts +19 -3
  94. package/typings/{esm5/drag-drop/drop-list.d.ts → drag-drop/drop-list-ref.d.ts} +132 -84
  95. package/typings/drag-drop/index.d.ts +1 -0
  96. package/typings/drag-drop/index.metadata.json +1 -1
  97. package/typings/drag-drop/public-api.d.ts +13 -6
  98. package/typings/esm5/drag-drop/{drag-handle.d.ts → directives/drag-handle.d.ts} +0 -0
  99. package/typings/esm5/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  100. package/typings/esm5/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  101. package/typings/esm5/drag-drop/directives/drag.d.ts +108 -0
  102. package/{drag-drop/typings → typings/esm5/drag-drop/directives}/drop-list-group.d.ts +3 -0
  103. package/typings/esm5/drag-drop/directives/drop-list.d.ts +135 -0
  104. package/typings/esm5/drag-drop/drag-drop-registry.d.ts +8 -3
  105. package/typings/esm5/drag-drop/drag-events.d.ts +14 -7
  106. package/{drag-drop/typings/drag.d.ts → typings/esm5/drag-drop/drag-ref.d.ts} +143 -82
  107. package/typings/esm5/drag-drop/drop-list-container.d.ts +19 -3
  108. package/typings/{drag-drop/drop-list.d.ts → esm5/drag-drop/drop-list-ref.d.ts} +132 -84
  109. package/typings/esm5/drag-drop/index.d.ts +1 -0
  110. package/typings/esm5/drag-drop/index.metadata.json +1 -1
  111. package/typings/esm5/drag-drop/public-api.d.ts +13 -6
  112. package/typings/esm5/index.metadata.json +1 -1
  113. package/typings/esm5/stepper/index.metadata.json +1 -1
  114. package/typings/esm5/stepper/stepper.d.ts +6 -0
  115. package/typings/esm5/text-field/autosize.d.ts +6 -0
  116. package/typings/esm5/text-field/index.metadata.json +1 -1
  117. package/typings/index.metadata.json +1 -1
  118. package/typings/schematics/utils/ast/ng-module-imports.d.ts +1 -1
  119. package/typings/stepper/index.metadata.json +1 -1
  120. package/typings/stepper/stepper.d.ts +6 -0
  121. package/typings/text-field/autosize.d.ts +6 -0
  122. package/typings/text-field/index.metadata.json +1 -1
@@ -97,7 +97,14 @@ const STEP_STATE = {
97
97
  * InjectionToken that can be used to specify the global stepper options.
98
98
  * @type {?}
99
99
  */
100
- const MAT_STEPPER_GLOBAL_OPTIONS = new InjectionToken('mat-stepper-global-options');
100
+ const STEPPER_GLOBAL_OPTIONS = new InjectionToken('STEPPER_GLOBAL_OPTIONS');
101
+ /**
102
+ * InjectionToken that can be used to specify the global stepper options.
103
+ * @deprecated Use `STEPPER_GLOBAL_OPTIONS` instead.
104
+ * \@breaking-change 8.0.0.
105
+ * @type {?}
106
+ */
107
+ const MAT_STEPPER_GLOBAL_OPTIONS = STEPPER_GLOBAL_OPTIONS;
101
108
  class CdkStep {
102
109
  /**
103
110
  * \@breaking-change 8.0.0 remove the `?` after `stepperOptions`
@@ -168,7 +175,7 @@ class CdkStep {
168
175
  * @return {?}
169
176
  */
170
177
  get hasError() {
171
- return this._customError || this._getDefaultError();
178
+ return this._customError == null ? this._getDefaultError() : this._customError;
172
179
  }
173
180
  /**
174
181
  * @param {?} value
@@ -227,7 +234,7 @@ CdkStep.decorators = [
227
234
  /** @nocollapse */
228
235
  CdkStep.ctorParameters = () => [
229
236
  { type: CdkStepper, decorators: [{ type: Inject, args: [forwardRef(() => CdkStepper),] }] },
230
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MAT_STEPPER_GLOBAL_OPTIONS,] }] }
237
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [STEPPER_GLOBAL_OPTIONS,] }] }
231
238
  ];
232
239
  CdkStep.propDecorators = {
233
240
  stepLabel: [{ type: ContentChild, args: [CdkStepLabel,] }],
@@ -701,5 +708,5 @@ CdkStepperModule.decorators = [
701
708
  * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
702
709
  */
703
710
 
704
- export { StepperSelectionEvent, STEP_STATE, MAT_STEPPER_GLOBAL_OPTIONS, CdkStep, CdkStepper, CdkStepLabel, CdkStepperNext, CdkStepperPrevious, CdkStepperModule, CdkStepHeader };
711
+ export { StepperSelectionEvent, STEP_STATE, STEPPER_GLOBAL_OPTIONS, MAT_STEPPER_GLOBAL_OPTIONS, CdkStep, CdkStepper, CdkStepLabel, CdkStepperNext, CdkStepperPrevious, CdkStepperModule, CdkStepHeader };
705
712
  //# sourceMappingURL=stepper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stepper.js","sources":["../../../src/cdk/stepper/stepper-module.ts","../../../src/cdk/stepper/stepper-button.ts","../../../src/cdk/stepper/stepper.ts","../../../src/cdk/stepper/step-header.ts","../../../src/cdk/stepper/step-label.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 {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 {CdkStepHeader} from './step-header';\nimport {BidiModule} from '@angular/cdk/bidi';\n\n@NgModule({\n imports: [BidiModule, CommonModule],\n exports: [\n CdkStep,\n CdkStepper,\n CdkStepHeader,\n CdkStepLabel,\n CdkStepperNext,\n CdkStepperPrevious,\n ],\n declarations: [\n CdkStep,\n CdkStepper,\n CdkStepHeader,\n CdkStepLabel,\n CdkStepperNext,\n CdkStepperPrevious,\n ]\n})\nexport class CdkStepperModule {}\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 {FocusableOption, FocusKeyManager} from '@angular/cdk/a11y';\nimport {Direction, Directionality} from '@angular/cdk/bidi';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {END, ENTER, HOME, SPACE, hasModifierKey} from '@angular/cdk/keycodes';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChild,\n ContentChildren,\n Directive,\n EventEmitter,\n ElementRef,\n forwardRef,\n Inject,\n Input,\n OnChanges,\n OnDestroy,\n Optional,\n Output,\n QueryList,\n TemplateRef,\n ViewChild,\n ViewEncapsulation,\n InjectionToken,\n} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\nimport {AbstractControl} from '@angular/forms';\nimport {CdkStepLabel} from './step-label';\nimport {Observable, Subject, of as obaservableOf} from 'rxjs';\nimport {startWith, takeUntil} from 'rxjs/operators';\nimport {CdkStepHeader} from './step-header';\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/** The state of each step. */\nexport type StepState = 'number' | 'edit' | 'done' | 'error' | string;\n\n/** Enum to represent the different states of the steps. */\nexport const STEP_STATE = {\n NUMBER: 'number',\n EDIT: 'edit',\n DONE: 'done',\n ERROR: 'error'\n};\n\n/** InjectionToken that can be used to specify the global stepper options. */\nexport const MAT_STEPPER_GLOBAL_OPTIONS =\n new InjectionToken<StepperOptions>('mat-stepper-global-options');\n\n/** Configurable options for stepper. */\nexport interface StepperOptions {\n /**\n * Whether the stepper should display an error state or not.\n * Default behavior is assumed to be false.\n */\n showError?: boolean;\n\n /**\n * Whether the stepper should display the default indicator type\n * or not.\n * Default behavior is assumed to be true.\n */\n displayDefaultIndicatorType?: boolean;\n}\n\n@Component({\n moduleId: module.id,\n selector: 'cdk-step',\n exportAs: 'cdkStep',\n template: '<ng-template><ng-content></ng-content></ng-template>',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CdkStep implements OnChanges {\n private _stepperOptions: StepperOptions;\n _showError: boolean;\n _displayDefaultIndicatorType: boolean;\n\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 /** Plain text label of the step. */\n @Input() label: string;\n\n /** Error message to display when there's an error. */\n @Input() errorMessage: string;\n\n /** Aria label for the tab. */\n @Input('aria-label') ariaLabel: string;\n\n /**\n * Reference to the element that the tab is labelled by.\n * Will be cleared if `aria-label` is set at the same time.\n */\n @Input('aria-labelledby') ariaLabelledby: string;\n\n /** State of the step. */\n @Input() state: StepState;\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._getDefaultCompleted() : this._customCompleted;\n }\n set completed(value: boolean) {\n this._customCompleted = coerceBooleanProperty(value);\n }\n private _customCompleted: boolean | null = null;\n\n private _getDefaultCompleted() {\n return this.stepControl ? this.stepControl.valid && this.interacted : this.interacted;\n }\n\n /** Whether step has an error. */\n @Input()\n get hasError(): boolean {\n return this._customError || this._getDefaultError();\n }\n set hasError(value: boolean) {\n this._customError = coerceBooleanProperty(value);\n }\n private _customError: boolean | null = null;\n\n private _getDefaultError() {\n return this.stepControl && this.stepControl.invalid && this.interacted;\n }\n\n /** @breaking-change 8.0.0 remove the `?` after `stepperOptions` */\n constructor(\n @Inject(forwardRef(() => CdkStepper)) private _stepper: CdkStepper,\n @Optional() @Inject(MAT_STEPPER_GLOBAL_OPTIONS) stepperOptions?: StepperOptions) {\n this._stepperOptions = stepperOptions ? stepperOptions : {};\n this._displayDefaultIndicatorType = this._stepperOptions.displayDefaultIndicatorType !== false;\n this._showError = !!this._stepperOptions.showError;\n }\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._customError != null) {\n this._customError = 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 AfterViewInit, OnDestroy {\n /** Emits when the component is destroyed. */\n protected _destroyed = new Subject<void>();\n\n /** Used for managing keyboard focus. */\n private _keyManager: FocusKeyManager<FocusableOption>;\n\n /**\n * @breaking-change 8.0.0 Remove `| undefined` once the `_document`\n * constructor param is required.\n */\n private _document: Document | undefined;\n\n /** The list of step components that the stepper is holding. */\n @ContentChildren(CdkStep) _steps: QueryList<CdkStep>;\n\n /**\n * The list of step headers of the steps in the stepper.\n * @deprecated Type to be changed to `QueryList<CdkStepHeader>`.\n * @breaking-change 8.0.0\n */\n @ContentChildren(CdkStepHeader) _stepHeader: QueryList<FocusableOption>;\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._selectedIndex != index &&\n !this._anyControlsInvalidOrPending(index) &&\n (index >= this._selectedIndex || this._steps.toArray()[index].editable)) {\n this._updateSelectedItemIndex(index);\n }\n } else {\n this._selectedIndex = index;\n }\n }\n private _selectedIndex = 0;\n\n /** The step that is selected. */\n @Input()\n get selected(): CdkStep {\n // @breaking-change 8.0.0 Change return type to `CdkStep | undefined`.\n return this._steps ? this._steps.toArray()[this.selectedIndex] : undefined!;\n }\n set selected(step: CdkStep) {\n this.selectedIndex = this._steps ? this._steps.toArray().indexOf(step) : -1;\n }\n\n /** Event emitted when the selected step has changed. */\n @Output() selectionChange: EventEmitter<StepperSelectionEvent>\n = new EventEmitter<StepperSelectionEvent>();\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 // @breaking-change 8.0.0 `_elementRef` and `_document` parameters to become required.\n private _elementRef?: ElementRef<HTMLElement>,\n @Inject(DOCUMENT) _document?: any) {\n this._groupId = nextId++;\n this._document = _document;\n }\n\n ngAfterViewInit() {\n // Note that while the step headers are content children by default, any components that\n // extend this one might have them as view chidren. We initialize the keyboard handling in\n // AfterViewInit so we're guaranteed for both view and content children to be defined.\n this._keyManager = new FocusKeyManager<FocusableOption>(this._stepHeader)\n .withWrap()\n .withVerticalOrientation(this._orientation === 'vertical');\n\n (this._dir ? this._dir.change as Observable<Direction> : obaservableOf<Direction>())\n .pipe(startWith(this._layoutDirection()), takeUntil(this._destroyed))\n .subscribe(direction => this._keyManager.withHorizontalOrientation(direction));\n\n this._keyManager.updateActiveItemIndex(this._selectedIndex);\n\n this._steps.changes.pipe(takeUntil(this._destroyed)).subscribe(() => {\n if (!this.selected) {\n this._selectedIndex = Math.max(this._selectedIndex - 1, 0);\n }\n });\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._updateSelectedItemIndex(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, state: StepState = STEP_STATE.NUMBER): StepState {\n const step = this._steps.toArray()[index];\n const isCurrentStep = this._isCurrentStep(index);\n\n return step._displayDefaultIndicatorType\n ? this._getDefaultIndicatorLogic(step, isCurrentStep)\n : this._getGuidelineLogic(step, isCurrentStep, state);\n }\n\n private _getDefaultIndicatorLogic(step: CdkStep, isCurrentStep: boolean): StepState {\n if (step._showError && step.hasError && !isCurrentStep) {\n return STEP_STATE.ERROR;\n } else if (!step.completed || isCurrentStep) {\n return STEP_STATE.NUMBER;\n } else {\n return step.editable ? STEP_STATE.EDIT : STEP_STATE.DONE;\n }\n }\n\n private _getGuidelineLogic(\n step: CdkStep,\n isCurrentStep: boolean,\n state: StepState = STEP_STATE.NUMBER): StepState {\n if (step._showError && step.hasError && !isCurrentStep) {\n return STEP_STATE.ERROR;\n } else if (step.completed && !isCurrentStep) {\n return STEP_STATE.DONE;\n } else if (step.completed && isCurrentStep) {\n return state;\n } else if (step.editable && isCurrentStep) {\n return STEP_STATE.EDIT;\n } else {\n return state;\n }\n }\n\n private _isCurrentStep(index: number) {\n return this._selectedIndex === index;\n }\n\n /** Returns the index of the currently-focused step header. */\n _getFocusIndex() {\n return this._keyManager ? this._keyManager.activeItemIndex : this._selectedIndex;\n }\n\n private _updateSelectedItemIndex(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\n // If focus is inside the stepper, move it to the next header, otherwise it may become\n // lost when the active step content is hidden. We can't be more granular with the check\n // (e.g. checking whether focus is inside the active step), because we don't have a\n // reference to the elements that are rendering out the content.\n this._containsFocus() ? this._keyManager.setActiveItem(newIndex) :\n this._keyManager.updateActiveItemIndex(newIndex);\n\n this._selectedIndex = newIndex;\n this._stateChanged();\n }\n\n _onKeydown(event: KeyboardEvent) {\n const hasModifier = hasModifierKey(event);\n const keyCode = event.keyCode;\n const manager = this._keyManager;\n\n if (manager.activeItemIndex != null && !hasModifier &&\n (keyCode === SPACE || keyCode === ENTER)) {\n this.selectedIndex = manager.activeItemIndex;\n event.preventDefault();\n } else if (keyCode === HOME) {\n manager.setFirstItemActive();\n event.preventDefault();\n } else if (keyCode === END) {\n manager.setLastItemActive();\n event.preventDefault();\n } else {\n manager.onKeydown(event);\n }\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 /** Checks whether the stepper contains the focused element. */\n private _containsFocus(): boolean {\n if (!this._document || !this._elementRef) {\n return false;\n }\n\n const stepperElement = this._elementRef.nativeElement;\n const focusedElement = this._document.activeElement;\n return stepperElement === focusedElement || stepperElement.contains(focusedElement);\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, ElementRef} from '@angular/core';\nimport {FocusableOption} from '@angular/cdk/a11y';\n\n\n@Directive({\n selector: '[cdkStepHeader]',\n host: {\n 'role': 'tab',\n },\n})\nexport class CdkStepHeader implements FocusableOption {\n constructor(protected _elementRef: ElementRef<HTMLElement>) {}\n\n /** Focuses the step header. */\n focus() {\n this._elementRef.nativeElement.focus();\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, TemplateRef} from '@angular/core';\n\n@Directive({\n selector: '[cdkStepLabel]',\n})\nexport class CdkStepLabel {\n constructor(/** @docs-private */ public template: TemplateRef<any>) { }\n}\n"],"names":["obaservableOf"],"mappings":";;;;;;;;;;;;;;;;;;;;;AIaA,MAAa,YAAY,CAAzB;;;;IACE,WAAF,sBAA0C,QAA0B,EAApE;QAA0C,IAA1C,CAAA,QAAkD,GAAR,QAAQ,CAAkB;KA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/cdk/stepper/stepper.ts","../../../src/cdk/stepper/step-header.ts","../../../src/cdk/stepper/step-label.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 {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 {CdkStepHeader} from './step-header';\nimport {BidiModule} from '@angular/cdk/bidi';\n\n@NgModule({\n imports: [BidiModule, CommonModule],\n exports: [\n CdkStep,\n CdkStepper,\n CdkStepHeader,\n CdkStepLabel,\n CdkStepperNext,\n CdkStepperPrevious,\n ],\n declarations: [\n CdkStep,\n CdkStepper,\n CdkStepHeader,\n CdkStepLabel,\n CdkStepperNext,\n CdkStepperPrevious,\n ]\n})\nexport class CdkStepperModule {}\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 {FocusableOption, FocusKeyManager} from '@angular/cdk/a11y';\nimport {Direction, Directionality} from '@angular/cdk/bidi';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {END, ENTER, HOME, SPACE, hasModifierKey} from '@angular/cdk/keycodes';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChild,\n ContentChildren,\n Directive,\n EventEmitter,\n ElementRef,\n forwardRef,\n Inject,\n Input,\n OnChanges,\n OnDestroy,\n Optional,\n Output,\n QueryList,\n TemplateRef,\n ViewChild,\n ViewEncapsulation,\n InjectionToken,\n} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\nimport {AbstractControl} from '@angular/forms';\nimport {CdkStepLabel} from './step-label';\nimport {Observable, Subject, of as obaservableOf} from 'rxjs';\nimport {startWith, takeUntil} from 'rxjs/operators';\nimport {CdkStepHeader} from './step-header';\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/** The state of each step. */\nexport type StepState = 'number' | 'edit' | 'done' | 'error' | string;\n\n/** Enum to represent the different states of the steps. */\nexport const STEP_STATE = {\n NUMBER: 'number',\n EDIT: 'edit',\n DONE: 'done',\n ERROR: 'error'\n};\n\n/** InjectionToken that can be used to specify the global stepper options. */\nexport const STEPPER_GLOBAL_OPTIONS =\n new InjectionToken<StepperOptions>('STEPPER_GLOBAL_OPTIONS');\n\n/**\n * InjectionToken that can be used to specify the global stepper options.\n * @deprecated Use `STEPPER_GLOBAL_OPTIONS` instead.\n * @breaking-change 8.0.0.\n */\nexport const MAT_STEPPER_GLOBAL_OPTIONS = STEPPER_GLOBAL_OPTIONS;\n\n/** Configurable options for stepper. */\nexport interface StepperOptions {\n /**\n * Whether the stepper should display an error state or not.\n * Default behavior is assumed to be false.\n */\n showError?: boolean;\n\n /**\n * Whether the stepper should display the default indicator type\n * or not.\n * Default behavior is assumed to be true.\n */\n displayDefaultIndicatorType?: boolean;\n}\n\n@Component({\n moduleId: module.id,\n selector: 'cdk-step',\n exportAs: 'cdkStep',\n template: '<ng-template><ng-content></ng-content></ng-template>',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CdkStep implements OnChanges {\n private _stepperOptions: StepperOptions;\n _showError: boolean;\n _displayDefaultIndicatorType: boolean;\n\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 /** Plain text label of the step. */\n @Input() label: string;\n\n /** Error message to display when there's an error. */\n @Input() errorMessage: string;\n\n /** Aria label for the tab. */\n @Input('aria-label') ariaLabel: string;\n\n /**\n * Reference to the element that the tab is labelled by.\n * Will be cleared if `aria-label` is set at the same time.\n */\n @Input('aria-labelledby') ariaLabelledby: string;\n\n /** State of the step. */\n @Input() state: StepState;\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._getDefaultCompleted() : this._customCompleted;\n }\n set completed(value: boolean) {\n this._customCompleted = coerceBooleanProperty(value);\n }\n private _customCompleted: boolean | null = null;\n\n private _getDefaultCompleted() {\n return this.stepControl ? this.stepControl.valid && this.interacted : this.interacted;\n }\n\n /** Whether step has an error. */\n @Input()\n get hasError(): boolean {\n return this._customError == null ? this._getDefaultError() : this._customError;\n }\n set hasError(value: boolean) {\n this._customError = coerceBooleanProperty(value);\n }\n private _customError: boolean | null = null;\n\n private _getDefaultError() {\n return this.stepControl && this.stepControl.invalid && this.interacted;\n }\n\n /** @breaking-change 8.0.0 remove the `?` after `stepperOptions` */\n constructor(\n @Inject(forwardRef(() => CdkStepper)) private _stepper: CdkStepper,\n @Optional() @Inject(STEPPER_GLOBAL_OPTIONS) stepperOptions?: StepperOptions) {\n this._stepperOptions = stepperOptions ? stepperOptions : {};\n this._displayDefaultIndicatorType = this._stepperOptions.displayDefaultIndicatorType !== false;\n this._showError = !!this._stepperOptions.showError;\n }\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._customError != null) {\n this._customError = 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 AfterViewInit, OnDestroy {\n /** Emits when the component is destroyed. */\n protected _destroyed = new Subject<void>();\n\n /** Used for managing keyboard focus. */\n private _keyManager: FocusKeyManager<FocusableOption>;\n\n /**\n * @breaking-change 8.0.0 Remove `| undefined` once the `_document`\n * constructor param is required.\n */\n private _document: Document | undefined;\n\n /** The list of step components that the stepper is holding. */\n @ContentChildren(CdkStep) _steps: QueryList<CdkStep>;\n\n /**\n * The list of step headers of the steps in the stepper.\n * @deprecated Type to be changed to `QueryList<CdkStepHeader>`.\n * @breaking-change 8.0.0\n */\n @ContentChildren(CdkStepHeader) _stepHeader: QueryList<FocusableOption>;\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._selectedIndex != index &&\n !this._anyControlsInvalidOrPending(index) &&\n (index >= this._selectedIndex || this._steps.toArray()[index].editable)) {\n this._updateSelectedItemIndex(index);\n }\n } else {\n this._selectedIndex = index;\n }\n }\n private _selectedIndex = 0;\n\n /** The step that is selected. */\n @Input()\n get selected(): CdkStep {\n // @breaking-change 8.0.0 Change return type to `CdkStep | undefined`.\n return this._steps ? this._steps.toArray()[this.selectedIndex] : undefined!;\n }\n set selected(step: CdkStep) {\n this.selectedIndex = this._steps ? this._steps.toArray().indexOf(step) : -1;\n }\n\n /** Event emitted when the selected step has changed. */\n @Output() selectionChange: EventEmitter<StepperSelectionEvent>\n = new EventEmitter<StepperSelectionEvent>();\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 // @breaking-change 8.0.0 `_elementRef` and `_document` parameters to become required.\n private _elementRef?: ElementRef<HTMLElement>,\n @Inject(DOCUMENT) _document?: any) {\n this._groupId = nextId++;\n this._document = _document;\n }\n\n ngAfterViewInit() {\n // Note that while the step headers are content children by default, any components that\n // extend this one might have them as view chidren. We initialize the keyboard handling in\n // AfterViewInit so we're guaranteed for both view and content children to be defined.\n this._keyManager = new FocusKeyManager<FocusableOption>(this._stepHeader)\n .withWrap()\n .withVerticalOrientation(this._orientation === 'vertical');\n\n (this._dir ? this._dir.change as Observable<Direction> : obaservableOf<Direction>())\n .pipe(startWith(this._layoutDirection()), takeUntil(this._destroyed))\n .subscribe(direction => this._keyManager.withHorizontalOrientation(direction));\n\n this._keyManager.updateActiveItemIndex(this._selectedIndex);\n\n this._steps.changes.pipe(takeUntil(this._destroyed)).subscribe(() => {\n if (!this.selected) {\n this._selectedIndex = Math.max(this._selectedIndex - 1, 0);\n }\n });\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._updateSelectedItemIndex(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, state: StepState = STEP_STATE.NUMBER): StepState {\n const step = this._steps.toArray()[index];\n const isCurrentStep = this._isCurrentStep(index);\n\n return step._displayDefaultIndicatorType\n ? this._getDefaultIndicatorLogic(step, isCurrentStep)\n : this._getGuidelineLogic(step, isCurrentStep, state);\n }\n\n private _getDefaultIndicatorLogic(step: CdkStep, isCurrentStep: boolean): StepState {\n if (step._showError && step.hasError && !isCurrentStep) {\n return STEP_STATE.ERROR;\n } else if (!step.completed || isCurrentStep) {\n return STEP_STATE.NUMBER;\n } else {\n return step.editable ? STEP_STATE.EDIT : STEP_STATE.DONE;\n }\n }\n\n private _getGuidelineLogic(\n step: CdkStep,\n isCurrentStep: boolean,\n state: StepState = STEP_STATE.NUMBER): StepState {\n if (step._showError && step.hasError && !isCurrentStep) {\n return STEP_STATE.ERROR;\n } else if (step.completed && !isCurrentStep) {\n return STEP_STATE.DONE;\n } else if (step.completed && isCurrentStep) {\n return state;\n } else if (step.editable && isCurrentStep) {\n return STEP_STATE.EDIT;\n } else {\n return state;\n }\n }\n\n private _isCurrentStep(index: number) {\n return this._selectedIndex === index;\n }\n\n /** Returns the index of the currently-focused step header. */\n _getFocusIndex() {\n return this._keyManager ? this._keyManager.activeItemIndex : this._selectedIndex;\n }\n\n private _updateSelectedItemIndex(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\n // If focus is inside the stepper, move it to the next header, otherwise it may become\n // lost when the active step content is hidden. We can't be more granular with the check\n // (e.g. checking whether focus is inside the active step), because we don't have a\n // reference to the elements that are rendering out the content.\n this._containsFocus() ? this._keyManager.setActiveItem(newIndex) :\n this._keyManager.updateActiveItemIndex(newIndex);\n\n this._selectedIndex = newIndex;\n this._stateChanged();\n }\n\n _onKeydown(event: KeyboardEvent) {\n const hasModifier = hasModifierKey(event);\n const keyCode = event.keyCode;\n const manager = this._keyManager;\n\n if (manager.activeItemIndex != null && !hasModifier &&\n (keyCode === SPACE || keyCode === ENTER)) {\n this.selectedIndex = manager.activeItemIndex;\n event.preventDefault();\n } else if (keyCode === HOME) {\n manager.setFirstItemActive();\n event.preventDefault();\n } else if (keyCode === END) {\n manager.setLastItemActive();\n event.preventDefault();\n } else {\n manager.onKeydown(event);\n }\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 /** Checks whether the stepper contains the focused element. */\n private _containsFocus(): boolean {\n if (!this._document || !this._elementRef) {\n return false;\n }\n\n const stepperElement = this._elementRef.nativeElement;\n const focusedElement = this._document.activeElement;\n return stepperElement === focusedElement || stepperElement.contains(focusedElement);\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, ElementRef} from '@angular/core';\nimport {FocusableOption} from '@angular/cdk/a11y';\n\n\n@Directive({\n selector: '[cdkStepHeader]',\n host: {\n 'role': 'tab',\n },\n})\nexport class CdkStepHeader implements FocusableOption {\n constructor(protected _elementRef: ElementRef<HTMLElement>) {}\n\n /** Focuses the step header. */\n focus() {\n this._elementRef.nativeElement.focus();\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, TemplateRef} from '@angular/core';\n\n@Directive({\n selector: '[cdkStepLabel]',\n})\nexport class CdkStepLabel {\n constructor(/** @docs-private */ public template: TemplateRef<any>) { }\n}\n"],"names":["obaservableOf"],"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;iBACnB;gBACD,YAAY,EAAE;oBACZ,OAAO;oBACP,UAAU;oBACV,aAAa;oBACb,YAAY;oBACZ,cAAc;oBACd,kBAAkB;iBACnB;aACF,EAAD,EAAA;;;;;;;;;;;;;;;"}
@@ -366,22 +366,14 @@ class CdkTextareaAutosize {
366
366
  textarea.style.height = `${height}px`;
367
367
  textarea.classList.remove('cdk-textarea-autosize-measuring');
368
368
  textarea.placeholder = placeholderText;
369
- // On Firefox resizing the textarea will prevent it from scrolling to the caret position.
370
- // We need to re-set the selection in order for it to scroll to the proper position.
371
- if (typeof requestAnimationFrame !== 'undefined') {
372
- this._ngZone.runOutsideAngular(() => requestAnimationFrame(() => {
373
- const { selectionStart, selectionEnd } = textarea;
374
- // IE will throw an "Unspecified error" if we try to set the selection range after the
375
- // element has been removed from the DOM. Assert that the directive hasn't been destroyed
376
- // between the time we requested the animation frame and when it was executed.
377
- // Also note that we have to assert that the textarea is focused before we set the
378
- // selection range. Setting the selection range on a non-focused textarea will cause
379
- // it to receive focus on IE and Edge.
380
- if (!this._destroyed.isStopped && document.activeElement === textarea) {
381
- textarea.setSelectionRange(selectionStart, selectionEnd);
382
- }
383
- }));
384
- }
369
+ this._ngZone.runOutsideAngular(() => {
370
+ if (typeof requestAnimationFrame !== 'undefined') {
371
+ requestAnimationFrame(() => this._scrollToCaretPosition(textarea));
372
+ }
373
+ else {
374
+ setTimeout(() => this._scrollToCaretPosition(textarea));
375
+ }
376
+ });
385
377
  this._previousValue = value;
386
378
  this._previousMinRows = this._minRows;
387
379
  }
@@ -403,6 +395,26 @@ class CdkTextareaAutosize {
403
395
  _noopInputHandler() {
404
396
  // no-op handler that ensures we're running change detection on input events.
405
397
  }
398
+ /**
399
+ * Scrolls a textarea to the caret position. On Firefox resizing the textarea will
400
+ * prevent it from scrolling to the caret position. We need to re-set the selection
401
+ * in order for it to scroll to the proper position.
402
+ * @private
403
+ * @param {?} textarea
404
+ * @return {?}
405
+ */
406
+ _scrollToCaretPosition(textarea) {
407
+ const { selectionStart, selectionEnd } = textarea;
408
+ // IE will throw an "Unspecified error" if we try to set the selection range after the
409
+ // element has been removed from the DOM. Assert that the directive hasn't been destroyed
410
+ // between the time we requested the animation frame and when it was executed.
411
+ // Also note that we have to assert that the textarea is focused before we set the
412
+ // selection range. Setting the selection range on a non-focused textarea will cause
413
+ // it to receive focus on IE and Edge.
414
+ if (!this._destroyed.isStopped && document.activeElement === textarea) {
415
+ textarea.setSelectionRange(selectionStart, selectionEnd);
416
+ }
417
+ }
406
418
  }
407
419
  CdkTextareaAutosize.decorators = [
408
420
  { type: Directive, args: [{
@@ -1 +1 @@
1
- {"version":3,"file":"text-field.js","sources":["../../../src/cdk/text-field/text-field-module.ts","../../../src/cdk/text-field/autosize.ts","../../../src/cdk/text-field/autofill.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 {PlatformModule} from '@angular/cdk/platform';\nimport {NgModule} from '@angular/core';\nimport {CdkAutofill} from './autofill';\nimport {CdkTextareaAutosize} from './autosize';\n\n\n@NgModule({\n declarations: [CdkAutofill, CdkTextareaAutosize],\n imports: [PlatformModule],\n exports: [CdkAutofill, CdkTextareaAutosize],\n})\nexport class TextFieldModule {}\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 {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n Input,\n AfterViewInit,\n DoCheck,\n OnDestroy,\n NgZone,\n} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\nimport {auditTime, takeUntil} from 'rxjs/operators';\nimport {fromEvent, Subject} from 'rxjs';\n\n\n/** Directive to automatically resize a textarea to fit its content. */\n@Directive({\n selector: 'textarea[cdkTextareaAutosize]',\n exportAs: 'cdkTextareaAutosize',\n host: {\n 'class': 'cdk-textarea-autosize',\n // Textarea elements that have the directive applied should have a single row by default.\n // Browsers normally show two rows by default and therefore this limits the minRows binding.\n 'rows': '1',\n '(input)': '_noopInputHandler()',\n },\n})\nexport class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {\n /** Keep track of the previous textarea value to avoid resizing when the value hasn't changed. */\n private _previousValue?: string;\n private _initialHeight: string | null;\n private readonly _destroyed = new Subject<void>();\n\n private _minRows: number;\n private _maxRows: number;\n private _enabled: boolean = true;\n\n /**\n * Value of minRows as of last resize. If the minRows has decreased, the\n * height of the textarea needs to be recomputed to reflect the new minimum. The maxHeight\n * does not have the same problem because it does not affect the textarea's scrollHeight.\n */\n private _previousMinRows: number = -1;\n\n private _textareaElement: HTMLTextAreaElement;\n\n /** Minimum amount of rows in the textarea. */\n @Input('cdkAutosizeMinRows')\n get minRows(): number { return this._minRows; }\n set minRows(value: number) {\n this._minRows = value;\n this._setMinHeight();\n }\n\n /** Maximum amount of rows in the textarea. */\n @Input('cdkAutosizeMaxRows')\n get maxRows(): number { return this._maxRows; }\n set maxRows(value: number) {\n this._maxRows = value;\n this._setMaxHeight();\n }\n\n /** Whether autosizing is enabled or not */\n @Input('cdkTextareaAutosize')\n get enabled(): boolean { return this._enabled; }\n set enabled(value: boolean) {\n value = coerceBooleanProperty(value);\n\n // Only act if the actual value changed. This specifically helps to not run\n // resizeToFitContent too early (i.e. before ngAfterViewInit)\n if (this._enabled !== value) {\n (this._enabled = value) ? this.resizeToFitContent(true) : this.reset();\n }\n }\n\n /** Cached height of a textarea with a single row. */\n private _cachedLineHeight: number;\n\n constructor(\n private _elementRef: ElementRef<HTMLElement>,\n private _platform: Platform,\n private _ngZone: NgZone) {\n this._textareaElement = this._elementRef.nativeElement as HTMLTextAreaElement;\n }\n\n /** Sets the minimum height of the textarea as determined by minRows. */\n _setMinHeight(): void {\n const minHeight = this.minRows && this._cachedLineHeight ?\n `${this.minRows * this._cachedLineHeight}px` : null;\n\n if (minHeight) {\n this._textareaElement.style.minHeight = minHeight;\n }\n }\n\n /** Sets the maximum height of the textarea as determined by maxRows. */\n _setMaxHeight(): void {\n const maxHeight = this.maxRows && this._cachedLineHeight ?\n `${this.maxRows * this._cachedLineHeight}px` : null;\n\n if (maxHeight) {\n this._textareaElement.style.maxHeight = maxHeight;\n }\n }\n\n ngAfterViewInit() {\n if (this._platform.isBrowser) {\n // Remember the height which we started with in case autosizing is disabled\n this._initialHeight = this._textareaElement.style.height;\n\n this.resizeToFitContent();\n\n this._ngZone.runOutsideAngular(() => {\n fromEvent(window, 'resize')\n .pipe(auditTime(16), takeUntil(this._destroyed))\n .subscribe(() => this.resizeToFitContent(true));\n });\n }\n }\n\n ngOnDestroy() {\n this._destroyed.next();\n this._destroyed.complete();\n }\n\n /**\n * Cache the height of a single-row textarea if it has not already been cached.\n *\n * We need to know how large a single \"row\" of a textarea is in order to apply minRows and\n * maxRows. For the initial version, we will assume that the height of a single line in the\n * textarea does not ever change.\n */\n private _cacheTextareaLineHeight(): void {\n if (this._cachedLineHeight) {\n return;\n }\n\n // Use a clone element because we have to override some styles.\n let textareaClone = this._textareaElement.cloneNode(false) as HTMLTextAreaElement;\n textareaClone.rows = 1;\n\n // Use `position: absolute` so that this doesn't cause a browser layout and use\n // `visibility: hidden` so that nothing is rendered. Clear any other styles that\n // would affect the height.\n textareaClone.style.position = 'absolute';\n textareaClone.style.visibility = 'hidden';\n textareaClone.style.border = 'none';\n textareaClone.style.padding = '0';\n textareaClone.style.height = '';\n textareaClone.style.minHeight = '';\n textareaClone.style.maxHeight = '';\n\n // In Firefox it happens that textarea elements are always bigger than the specified amount\n // of rows. This is because Firefox tries to add extra space for the horizontal scrollbar.\n // As a workaround that removes the extra space for the scrollbar, we can just set overflow\n // to hidden. This ensures that there is no invalid calculation of the line height.\n // See Firefox bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=33654\n textareaClone.style.overflow = 'hidden';\n\n this._textareaElement.parentNode!.appendChild(textareaClone);\n this._cachedLineHeight = textareaClone.clientHeight;\n this._textareaElement.parentNode!.removeChild(textareaClone);\n\n // Min and max heights have to be re-calculated if the cached line height changes\n this._setMinHeight();\n this._setMaxHeight();\n }\n\n ngDoCheck() {\n if (this._platform.isBrowser) {\n this.resizeToFitContent();\n }\n }\n\n /**\n * Resize the textarea to fit its content.\n * @param force Whether to force a height recalculation. By default the height will be\n * recalculated only if the value changed since the last call.\n */\n resizeToFitContent(force: boolean = false) {\n // If autosizing is disabled, just skip everything else\n if (!this._enabled) {\n return;\n }\n\n this._cacheTextareaLineHeight();\n\n // If we haven't determined the line-height yet, we know we're still hidden and there's no point\n // in checking the height of the textarea.\n if (!this._cachedLineHeight) {\n return;\n }\n\n const textarea = this._elementRef.nativeElement as HTMLTextAreaElement;\n const value = textarea.value;\n\n // Only resize if the value or minRows have changed since these calculations can be expensive.\n if (!force && this._minRows === this._previousMinRows && value === this._previousValue) {\n return;\n }\n\n const placeholderText = textarea.placeholder;\n\n // Reset the textarea height to auto in order to shrink back to its default size.\n // Also temporarily force overflow:hidden, so scroll bars do not interfere with calculations.\n // Long placeholders that are wider than the textarea width may lead to a bigger scrollHeight\n // value. To ensure that the scrollHeight is not bigger than the content, the placeholders\n // need to be removed temporarily.\n textarea.classList.add('cdk-textarea-autosize-measuring');\n textarea.placeholder = '';\n\n // The cdk-textarea-autosize-measuring class includes a 2px padding to workaround an issue with\n // Chrome, so we account for that extra space here by subtracting 4 (2px top + 2px bottom).\n const height = textarea.scrollHeight - 4;\n\n // Use the scrollHeight to know how large the textarea *would* be if fit its entire value.\n textarea.style.height = `${height}px`;\n textarea.classList.remove('cdk-textarea-autosize-measuring');\n textarea.placeholder = placeholderText;\n\n // On Firefox resizing the textarea will prevent it from scrolling to the caret position.\n // We need to re-set the selection in order for it to scroll to the proper position.\n if (typeof requestAnimationFrame !== 'undefined') {\n this._ngZone.runOutsideAngular(() => requestAnimationFrame(() => {\n const {selectionStart, selectionEnd} = textarea;\n\n // IE will throw an \"Unspecified error\" if we try to set the selection range after the\n // element has been removed from the DOM. Assert that the directive hasn't been destroyed\n // between the time we requested the animation frame and when it was executed.\n // Also note that we have to assert that the textarea is focused before we set the\n // selection range. Setting the selection range on a non-focused textarea will cause\n // it to receive focus on IE and Edge.\n if (!this._destroyed.isStopped && document.activeElement === textarea) {\n textarea.setSelectionRange(selectionStart, selectionEnd);\n }\n }));\n }\n\n this._previousValue = value;\n this._previousMinRows = this._minRows;\n }\n\n /**\n * Resets the textarea to it's original size\n */\n reset() {\n // Do not try to change the textarea, if the initialHeight has not been determined yet\n // This might potentially remove styles when reset() is called before ngAfterViewInit\n if (this._initialHeight === undefined) {\n return;\n }\n this._textareaElement.style.height = this._initialHeight;\n }\n\n _noopInputHandler() {\n // no-op handler that ensures we're running change detection on input events.\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 {Platform, normalizePassiveListenerOptions} from '@angular/cdk/platform';\nimport {\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n NgZone,\n OnDestroy,\n OnInit,\n Output,\n} from '@angular/core';\nimport {EMPTY, Observable, Subject} from 'rxjs';\n\n\n/** An event that is emitted when the autofill state of an input changes. */\nexport type AutofillEvent = {\n /** The element whose autofill state changes. */\n target: Element;\n /** Whether the element is currently autofilled. */\n isAutofilled: boolean;\n};\n\n\n/** Used to track info about currently monitored elements. */\ntype MonitoredElementInfo = {\n subject: Subject<AutofillEvent>;\n unlisten: () => void;\n};\n\n\n/** Options to pass to the animationstart listener. */\nconst listenerOptions = normalizePassiveListenerOptions({passive: true});\n\n\n/**\n * An injectable service that can be used to monitor the autofill state of an input.\n * Based on the following blog post:\n * https://medium.com/@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7\n */\n@Injectable({providedIn: 'root'})\nexport class AutofillMonitor implements OnDestroy {\n private _monitoredElements = new Map<Element, MonitoredElementInfo>();\n\n constructor(private _platform: Platform, private _ngZone: NgZone) {}\n\n /**\n * Monitor for changes in the autofill state of the given input element.\n * @param element The element to monitor.\n * @return A stream of autofill state changes.\n */\n monitor(element: Element): Observable<AutofillEvent>;\n\n /**\n * Monitor for changes in the autofill state of the given input element.\n * @param element The element to monitor.\n * @return A stream of autofill state changes.\n */\n monitor(element: ElementRef<Element>): Observable<AutofillEvent>;\n\n monitor(elementOrRef: Element | ElementRef<Element>): Observable<AutofillEvent> {\n if (!this._platform.isBrowser) {\n return EMPTY;\n }\n\n const element = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;\n const info = this._monitoredElements.get(element);\n\n if (info) {\n return info.subject.asObservable();\n }\n\n const result = new Subject<AutofillEvent>();\n const cssClass = 'cdk-text-field-autofilled';\n const listener = ((event: AnimationEvent) => {\n // Animation events fire on initial element render, we check for the presence of the autofill\n // CSS class to make sure this is a real change in state, not just the initial render before\n // we fire off events.\n if (event.animationName === 'cdk-text-field-autofill-start' &&\n !element.classList.contains(cssClass)) {\n element.classList.add(cssClass);\n this._ngZone.run(() => result.next({target: event.target as Element, isAutofilled: true}));\n } else if (event.animationName === 'cdk-text-field-autofill-end' &&\n element.classList.contains(cssClass)) {\n element.classList.remove(cssClass);\n this._ngZone.run(() => result.next({target: event.target as Element, isAutofilled: false}));\n }\n }) as EventListenerOrEventListenerObject;\n\n this._ngZone.runOutsideAngular(() => {\n element.addEventListener('animationstart', listener, listenerOptions);\n element.classList.add('cdk-text-field-autofill-monitored');\n });\n\n this._monitoredElements.set(element, {\n subject: result,\n unlisten: () => {\n element.removeEventListener('animationstart', listener, listenerOptions);\n }\n });\n\n return result.asObservable();\n }\n\n /**\n * Stop monitoring the autofill state of the given input element.\n * @param element The element to stop monitoring.\n */\n stopMonitoring(element: Element): void;\n\n /**\n * Stop monitoring the autofill state of the given input element.\n * @param element The element to stop monitoring.\n */\n stopMonitoring(element: ElementRef<Element>): void;\n\n stopMonitoring(elementOrRef: Element | ElementRef<Element>): void {\n const element = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;\n const info = this._monitoredElements.get(element);\n\n if (info) {\n info.unlisten();\n info.subject.complete();\n element.classList.remove('cdk-text-field-autofill-monitored');\n element.classList.remove('cdk-text-field-autofilled');\n this._monitoredElements.delete(element);\n }\n }\n\n ngOnDestroy() {\n this._monitoredElements.forEach((_info, element) => this.stopMonitoring(element));\n }\n}\n\n\n/** A directive that can be used to monitor the autofill state of an input. */\n@Directive({\n selector: '[cdkAutofill]',\n})\nexport class CdkAutofill implements OnDestroy, OnInit {\n /** Emits when the autofill state of the element changes. */\n @Output() cdkAutofill: EventEmitter<AutofillEvent> = new EventEmitter<AutofillEvent>();\n\n constructor(private _elementRef: ElementRef<HTMLElement>,\n private _autofillMonitor: AutofillMonitor) {}\n\n ngOnInit() {\n this._autofillMonitor\n .monitor(this._elementRef)\n .subscribe(event => this.cdkAutofill.emit(event));\n }\n\n ngOnDestroy() {\n this._autofillMonitor.stopMonitoring(this._elementRef);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AEuCA,MAAM,eAAe,GAAG,+BAA+B,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAxE;;;;;;AASA,AAAA,MAAa,eAAe,CAA5B;;;;;IAGE,WAAF,CAAsB,SAAmB,EAAU,OAAe,EAAlE;QAAsB,IAAtB,CAAA,SAA+B,GAAT,SAAS,CAAU;QAAU,IAAnD,CAAA,OAA0D,GAAP,OAAO,CAAQ;QAFxD,IAAV,CAAA,kBAA4B,GAAG,IAAI,GAAG,EAAiC,CAAC;KAEF;;;;;IAgBpE,OAAO,CAAC,YAA2C,EAArD;QACI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;YAC7B,OAAO,KAAK,CAAC;SACd;;QAEL,MAAU,OAAO,GAAG,YAAY,YAAY,UAAU,GAAG,YAAY,CAAC,aAAa,GAAG,YAAY,CAAlG;;QACA,MAAU,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,G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AAK,EAAR,IAAA,EAAA,CAAS,oBAAoB,EAA7B,EAAA,CAAA;IAQA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,IAAA,EAAA,CAAS,oBAAoB,EAA7B,EAAA,CAAA;IAQA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,IAAA,EAAA,CAAS,qBAAqB,EAA9B,EAAA,CAAA;;;;;;;ADpDA,MAAa,eAAe,CAA5B;;;IALA,EAAA,IAAA,EAAC,QAAQ,EAAT,IAAA,EAAA,CAAU;gBACR,YAAY,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;gBAChD,OAAO,EAAE,CAAC,cAAc,CAAC;gBACzB,OAAO,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;aAC5C,EAAD,EAAA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"text-field.js","sources":["../../../src/cdk/text-field/text-field-module.ts","../../../src/cdk/text-field/autosize.ts","../../../src/cdk/text-field/autofill.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 {PlatformModule} from '@angular/cdk/platform';\nimport {NgModule} from '@angular/core';\nimport {CdkAutofill} from './autofill';\nimport {CdkTextareaAutosize} from './autosize';\n\n\n@NgModule({\n declarations: [CdkAutofill, CdkTextareaAutosize],\n imports: [PlatformModule],\n exports: [CdkAutofill, CdkTextareaAutosize],\n})\nexport class TextFieldModule {}\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 {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n Input,\n AfterViewInit,\n DoCheck,\n OnDestroy,\n NgZone,\n} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\nimport {auditTime, takeUntil} from 'rxjs/operators';\nimport {fromEvent, Subject} from 'rxjs';\n\n\n/** Directive to automatically resize a textarea to fit its content. */\n@Directive({\n selector: 'textarea[cdkTextareaAutosize]',\n exportAs: 'cdkTextareaAutosize',\n host: {\n 'class': 'cdk-textarea-autosize',\n // Textarea elements that have the directive applied should have a single row by default.\n // Browsers normally show two rows by default and therefore this limits the minRows binding.\n 'rows': '1',\n '(input)': '_noopInputHandler()',\n },\n})\nexport class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {\n /** Keep track of the previous textarea value to avoid resizing when the value hasn't changed. */\n private _previousValue?: string;\n private _initialHeight: string | null;\n private readonly _destroyed = new Subject<void>();\n\n private _minRows: number;\n private _maxRows: number;\n private _enabled: boolean = true;\n\n /**\n * Value of minRows as of last resize. If the minRows has decreased, the\n * height of the textarea needs to be recomputed to reflect the new minimum. The maxHeight\n * does not have the same problem because it does not affect the textarea's scrollHeight.\n */\n private _previousMinRows: number = -1;\n\n private _textareaElement: HTMLTextAreaElement;\n\n /** Minimum amount of rows in the textarea. */\n @Input('cdkAutosizeMinRows')\n get minRows(): number { return this._minRows; }\n set minRows(value: number) {\n this._minRows = value;\n this._setMinHeight();\n }\n\n /** Maximum amount of rows in the textarea. */\n @Input('cdkAutosizeMaxRows')\n get maxRows(): number { return this._maxRows; }\n set maxRows(value: number) {\n this._maxRows = value;\n this._setMaxHeight();\n }\n\n /** Whether autosizing is enabled or not */\n @Input('cdkTextareaAutosize')\n get enabled(): boolean { return this._enabled; }\n set enabled(value: boolean) {\n value = coerceBooleanProperty(value);\n\n // Only act if the actual value changed. This specifically helps to not run\n // resizeToFitContent too early (i.e. before ngAfterViewInit)\n if (this._enabled !== value) {\n (this._enabled = value) ? this.resizeToFitContent(true) : this.reset();\n }\n }\n\n /** Cached height of a textarea with a single row. */\n private _cachedLineHeight: number;\n\n constructor(\n private _elementRef: ElementRef<HTMLElement>,\n private _platform: Platform,\n private _ngZone: NgZone) {\n this._textareaElement = this._elementRef.nativeElement as HTMLTextAreaElement;\n }\n\n /** Sets the minimum height of the textarea as determined by minRows. */\n _setMinHeight(): void {\n const minHeight = this.minRows && this._cachedLineHeight ?\n `${this.minRows * this._cachedLineHeight}px` : null;\n\n if (minHeight) {\n this._textareaElement.style.minHeight = minHeight;\n }\n }\n\n /** Sets the maximum height of the textarea as determined by maxRows. */\n _setMaxHeight(): void {\n const maxHeight = this.maxRows && this._cachedLineHeight ?\n `${this.maxRows * this._cachedLineHeight}px` : null;\n\n if (maxHeight) {\n this._textareaElement.style.maxHeight = maxHeight;\n }\n }\n\n ngAfterViewInit() {\n if (this._platform.isBrowser) {\n // Remember the height which we started with in case autosizing is disabled\n this._initialHeight = this._textareaElement.style.height;\n\n this.resizeToFitContent();\n\n this._ngZone.runOutsideAngular(() => {\n fromEvent(window, 'resize')\n .pipe(auditTime(16), takeUntil(this._destroyed))\n .subscribe(() => this.resizeToFitContent(true));\n });\n }\n }\n\n ngOnDestroy() {\n this._destroyed.next();\n this._destroyed.complete();\n }\n\n /**\n * Cache the height of a single-row textarea if it has not already been cached.\n *\n * We need to know how large a single \"row\" of a textarea is in order to apply minRows and\n * maxRows. For the initial version, we will assume that the height of a single line in the\n * textarea does not ever change.\n */\n private _cacheTextareaLineHeight(): void {\n if (this._cachedLineHeight) {\n return;\n }\n\n // Use a clone element because we have to override some styles.\n let textareaClone = this._textareaElement.cloneNode(false) as HTMLTextAreaElement;\n textareaClone.rows = 1;\n\n // Use `position: absolute` so that this doesn't cause a browser layout and use\n // `visibility: hidden` so that nothing is rendered. Clear any other styles that\n // would affect the height.\n textareaClone.style.position = 'absolute';\n textareaClone.style.visibility = 'hidden';\n textareaClone.style.border = 'none';\n textareaClone.style.padding = '0';\n textareaClone.style.height = '';\n textareaClone.style.minHeight = '';\n textareaClone.style.maxHeight = '';\n\n // In Firefox it happens that textarea elements are always bigger than the specified amount\n // of rows. This is because Firefox tries to add extra space for the horizontal scrollbar.\n // As a workaround that removes the extra space for the scrollbar, we can just set overflow\n // to hidden. This ensures that there is no invalid calculation of the line height.\n // See Firefox bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=33654\n textareaClone.style.overflow = 'hidden';\n\n this._textareaElement.parentNode!.appendChild(textareaClone);\n this._cachedLineHeight = textareaClone.clientHeight;\n this._textareaElement.parentNode!.removeChild(textareaClone);\n\n // Min and max heights have to be re-calculated if the cached line height changes\n this._setMinHeight();\n this._setMaxHeight();\n }\n\n ngDoCheck() {\n if (this._platform.isBrowser) {\n this.resizeToFitContent();\n }\n }\n\n /**\n * Resize the textarea to fit its content.\n * @param force Whether to force a height recalculation. By default the height will be\n * recalculated only if the value changed since the last call.\n */\n resizeToFitContent(force: boolean = false) {\n // If autosizing is disabled, just skip everything else\n if (!this._enabled) {\n return;\n }\n\n this._cacheTextareaLineHeight();\n\n // If we haven't determined the line-height yet, we know we're still hidden and there's no point\n // in checking the height of the textarea.\n if (!this._cachedLineHeight) {\n return;\n }\n\n const textarea = this._elementRef.nativeElement as HTMLTextAreaElement;\n const value = textarea.value;\n\n // Only resize if the value or minRows have changed since these calculations can be expensive.\n if (!force && this._minRows === this._previousMinRows && value === this._previousValue) {\n return;\n }\n\n const placeholderText = textarea.placeholder;\n\n // Reset the textarea height to auto in order to shrink back to its default size.\n // Also temporarily force overflow:hidden, so scroll bars do not interfere with calculations.\n // Long placeholders that are wider than the textarea width may lead to a bigger scrollHeight\n // value. To ensure that the scrollHeight is not bigger than the content, the placeholders\n // need to be removed temporarily.\n textarea.classList.add('cdk-textarea-autosize-measuring');\n textarea.placeholder = '';\n\n // The cdk-textarea-autosize-measuring class includes a 2px padding to workaround an issue with\n // Chrome, so we account for that extra space here by subtracting 4 (2px top + 2px bottom).\n const height = textarea.scrollHeight - 4;\n\n // Use the scrollHeight to know how large the textarea *would* be if fit its entire value.\n textarea.style.height = `${height}px`;\n textarea.classList.remove('cdk-textarea-autosize-measuring');\n textarea.placeholder = placeholderText;\n\n this._ngZone.runOutsideAngular(() => {\n if (typeof requestAnimationFrame !== 'undefined') {\n requestAnimationFrame(() => this._scrollToCaretPosition(textarea));\n } else {\n setTimeout(() => this._scrollToCaretPosition(textarea));\n }\n });\n\n this._previousValue = value;\n this._previousMinRows = this._minRows;\n }\n\n /**\n * Resets the textarea to it's original size\n */\n reset() {\n // Do not try to change the textarea, if the initialHeight has not been determined yet\n // This might potentially remove styles when reset() is called before ngAfterViewInit\n if (this._initialHeight === undefined) {\n return;\n }\n this._textareaElement.style.height = this._initialHeight;\n }\n\n _noopInputHandler() {\n // no-op handler that ensures we're running change detection on input events.\n }\n\n /**\n * Scrolls a textarea to the caret position. On Firefox resizing the textarea will\n * prevent it from scrolling to the caret position. We need to re-set the selection\n * in order for it to scroll to the proper position.\n */\n private _scrollToCaretPosition(textarea: HTMLTextAreaElement) {\n const {selectionStart, selectionEnd} = textarea;\n\n // IE will throw an \"Unspecified error\" if we try to set the selection range after the\n // element has been removed from the DOM. Assert that the directive hasn't been destroyed\n // between the time we requested the animation frame and when it was executed.\n // Also note that we have to assert that the textarea is focused before we set the\n // selection range. Setting the selection range on a non-focused textarea will cause\n // it to receive focus on IE and Edge.\n if (!this._destroyed.isStopped && document.activeElement === textarea) {\n textarea.setSelectionRange(selectionStart, selectionEnd);\n }\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 {Platform, normalizePassiveListenerOptions} from '@angular/cdk/platform';\nimport {\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n NgZone,\n OnDestroy,\n OnInit,\n Output,\n} from '@angular/core';\nimport {EMPTY, Observable, Subject} from 'rxjs';\n\n\n/** An event that is emitted when the autofill state of an input changes. */\nexport type AutofillEvent = {\n /** The element whose autofill state changes. */\n target: Element;\n /** Whether the element is currently autofilled. */\n isAutofilled: boolean;\n};\n\n\n/** Used to track info about currently monitored elements. */\ntype MonitoredElementInfo = {\n subject: Subject<AutofillEvent>;\n unlisten: () => void;\n};\n\n\n/** Options to pass to the animationstart listener. */\nconst listenerOptions = normalizePassiveListenerOptions({passive: true});\n\n\n/**\n * An injectable service that can be used to monitor the autofill state of an input.\n * Based on the following blog post:\n * https://medium.com/@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7\n */\n@Injectable({providedIn: 'root'})\nexport class AutofillMonitor implements OnDestroy {\n private _monitoredElements = new Map<Element, MonitoredElementInfo>();\n\n constructor(private _platform: Platform, private _ngZone: NgZone) {}\n\n /**\n * Monitor for changes in the autofill state of the given input element.\n * @param element The element to monitor.\n * @return A stream of autofill state changes.\n */\n monitor(element: Element): Observable<AutofillEvent>;\n\n /**\n * Monitor for changes in the autofill state of the given input element.\n * @param element The element to monitor.\n * @return A stream of autofill state changes.\n */\n monitor(element: ElementRef<Element>): Observable<AutofillEvent>;\n\n monitor(elementOrRef: Element | ElementRef<Element>): Observable<AutofillEvent> {\n if (!this._platform.isBrowser) {\n return EMPTY;\n }\n\n const element = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;\n const info = this._monitoredElements.get(element);\n\n if (info) {\n return info.subject.asObservable();\n }\n\n const result = new Subject<AutofillEvent>();\n const cssClass = 'cdk-text-field-autofilled';\n const listener = ((event: AnimationEvent) => {\n // Animation events fire on initial element render, we check for the presence of the autofill\n // CSS class to make sure this is a real change in state, not just the initial render before\n // we fire off events.\n if (event.animationName === 'cdk-text-field-autofill-start' &&\n !element.classList.contains(cssClass)) {\n element.classList.add(cssClass);\n this._ngZone.run(() => result.next({target: event.target as Element, isAutofilled: true}));\n } else if (event.animationName === 'cdk-text-field-autofill-end' &&\n element.classList.contains(cssClass)) {\n element.classList.remove(cssClass);\n this._ngZone.run(() => result.next({target: event.target as Element, isAutofilled: false}));\n }\n }) as EventListenerOrEventListenerObject;\n\n this._ngZone.runOutsideAngular(() => {\n element.addEventListener('animationstart', listener, listenerOptions);\n element.classList.add('cdk-text-field-autofill-monitored');\n });\n\n this._monitoredElements.set(element, {\n subject: result,\n unlisten: () => {\n element.removeEventListener('animationstart', listener, listenerOptions);\n }\n });\n\n return result.asObservable();\n }\n\n /**\n * Stop monitoring the autofill state of the given input element.\n * @param element The element to stop monitoring.\n */\n stopMonitoring(element: Element): void;\n\n /**\n * Stop monitoring the autofill state of the given input element.\n * @param element The element to stop monitoring.\n */\n stopMonitoring(element: ElementRef<Element>): void;\n\n stopMonitoring(elementOrRef: Element | ElementRef<Element>): void {\n const element = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;\n const info = this._monitoredElements.get(element);\n\n if (info) {\n info.unlisten();\n info.subject.complete();\n element.classList.remove('cdk-text-field-autofill-monitored');\n element.classList.remove('cdk-text-field-autofilled');\n this._monitoredElements.delete(element);\n }\n }\n\n ngOnDestroy() {\n this._monitoredElements.forEach((_info, element) => this.stopMonitoring(element));\n }\n}\n\n\n/** A directive that can be used to monitor the autofill state of an input. */\n@Directive({\n selector: '[cdkAutofill]',\n})\nexport class CdkAutofill implements OnDestroy, OnInit {\n /** Emits when the autofill state of the element changes. */\n @Output() cdkAutofill: EventEmitter<AutofillEvent> = new EventEmitter<AutofillEvent>();\n\n constructor(private _elementRef: ElementRef<HTMLElement>,\n private _autofillMonitor: AutofillMonitor) {}\n\n ngOnInit() {\n this._autofillMonitor\n .monitor(this._elementRef)\n .subscribe(event => this.cdkAutofill.emit(event));\n }\n\n ngOnDestroy() {\n this._autofillMonitor.stopMonitoring(this._elementRef);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AEuCA,MAAM,eAAe,GAAG,+BAA+B,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAxE;;;;;;AASA,AAAA,MAAa,eAAe,CAA5B;;;;;IAGE,WAAF,CAAsB,SAAmB,EAAU,OAAe,EAAlE;QAAsB,IAAtB,CAAA,SAA+B,GAAT,SAAS,CAAU;QAAU,IAAnD,CAAA,OAA0D,GAAP,OAAO,CAAQ;QAFxD,IAAV,CAAA,kBAA4B,GAAG,IAAI,GAAG,EAA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AiB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;SAC1D;KACF;;;IAzPH,EAAA,IAAA,EAAC,SAAS,EAAV,IAAA,EAAA,CAAW;gBACT,QAAQ,EAAE,+BAA+B;gBACzC,QAAQ,EAAE,qBAAqB;gBAC/B,IAAI,EAAE;oBACJ,OAAO,EAAE,uBAAuB;;;oBAGhC,MAAM,EAAE,GAAG;oBACX,SAAS,EAAE,qBAAqB;iBACjC;aACF,EAAD,EAAA;;;;IAvBA,EAAA,IAAA,EAAE,UAAU,EAAZ;IAOA,EAAA,IAAA,EAAQ,QAAQ,EAAhB;IAFA,EAAA,IAAA,EAAE,MAAM,EAAR;;;IAuCA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,IAAA,EAAA,CAAS,oBAAoB,EAA7B,EAAA,CAAA;IAQA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,IAAA,EAAA,CAAS,oBAAoB,EAA7B,EAAA,CAAA;IAQA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,IAAA,EAAA,CAAS,qBAAqB,EAA9B,EAAA,CAAA;;;;;;;ADpDA,MAAa,eAAe,CAA5B;;;IALA,EAAA,IAAA,EAAC,QAAQ,EAAT,IAAA,EAAA,CAAU;gBACR,YAAY,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;gBAChD,OAAO,EAAE,CAAC,cAAc,CAAC;gBACzB,OAAO,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;aAC5C,EAAD,EAAA;;;;;;;;;;;;;;;"}
package/esm2015/tree.js CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { SelectionModel } from '@angular/cdk/collections';
9
9
  import { Observable, BehaviorSubject, of, Subject } from 'rxjs';
10
- import { take, takeUntil } from 'rxjs/operators';
10
+ import { take, filter, takeUntil } from 'rxjs/operators';
11
11
  import { Directive, TemplateRef, ViewContainerRef, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, ElementRef, Input, IterableDiffers, ViewChild, ViewEncapsulation, Optional, Renderer2, NgModule } from '@angular/core';
12
12
  import { Directionality } from '@angular/cdk/bidi';
13
13
  import { coerceNumberProperty, coerceBooleanProperty } from '@angular/cdk/coercion';
@@ -215,7 +215,7 @@ class NestedTreeControl extends BaseTreeControl {
215
215
  childrenNodes.forEach((child) => this._getDescendants(descendants, child));
216
216
  }
217
217
  else if (childrenNodes instanceof Observable) {
218
- childrenNodes.pipe(take(1)).subscribe(children => {
218
+ childrenNodes.pipe(take(1), filter(Boolean)).subscribe(children => {
219
219
  children.forEach((child) => this._getDescendants(descendants, child));
220
220
  });
221
221
  }