@angular/cdk 20.0.0-rc.2 → 20.0.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 (72) hide show
  1. package/accordion/index.d.ts +3 -1
  2. package/fesm2022/{a11y-module-D8XVc0lA.mjs → a11y-module-DHa4AVFz.mjs} +27 -27
  3. package/fesm2022/{a11y-module-D8XVc0lA.mjs.map → a11y-module-DHa4AVFz.mjs.map} +1 -1
  4. package/fesm2022/a11y.mjs +19 -19
  5. package/fesm2022/a11y.mjs.map +1 -1
  6. package/fesm2022/accordion.mjs +20 -14
  7. package/fesm2022/accordion.mjs.map +1 -1
  8. package/fesm2022/{activedescendant-key-manager-DC3-fwQI.mjs → activedescendant-key-manager-CZAE5aFC.mjs} +2 -2
  9. package/fesm2022/{activedescendant-key-manager-DC3-fwQI.mjs.map → activedescendant-key-manager-CZAE5aFC.mjs.map} +1 -1
  10. package/fesm2022/bidi.mjs +9 -9
  11. package/fesm2022/bidi.mjs.map +1 -1
  12. package/fesm2022/{breakpoints-observer-Bf1rpjsP.mjs → breakpoints-observer-QutrMj4x.mjs} +8 -8
  13. package/fesm2022/{breakpoints-observer-Bf1rpjsP.mjs.map → breakpoints-observer-QutrMj4x.mjs.map} +1 -1
  14. package/fesm2022/cdk.mjs +1 -1
  15. package/fesm2022/cdk.mjs.map +1 -1
  16. package/fesm2022/clipboard.mjs +10 -10
  17. package/fesm2022/clipboard.mjs.map +1 -1
  18. package/fesm2022/collections.mjs +1 -1
  19. package/fesm2022/dialog.mjs +18 -18
  20. package/fesm2022/dialog.mjs.map +1 -1
  21. package/fesm2022/{directionality-DBlSyD_q.mjs → directionality-CChdj3az.mjs} +4 -4
  22. package/fesm2022/{directionality-DBlSyD_q.mjs.map → directionality-CChdj3az.mjs.map} +1 -1
  23. package/fesm2022/drag-drop.mjs +35 -35
  24. package/fesm2022/drag-drop.mjs.map +1 -1
  25. package/fesm2022/{focus-key-manager-C1rAQJ5z.mjs → focus-key-manager-CPmlyB_c.mjs} +2 -2
  26. package/fesm2022/{focus-key-manager-C1rAQJ5z.mjs.map → focus-key-manager-CPmlyB_c.mjs.map} +1 -1
  27. package/fesm2022/{focus-monitor-B7II9-mT.mjs → focus-monitor-DLjkiju1.mjs} +11 -11
  28. package/fesm2022/{focus-monitor-B7II9-mT.mjs.map → focus-monitor-DLjkiju1.mjs.map} +1 -1
  29. package/fesm2022/{id-generator-CGk_WAHZ.mjs → id-generator-LuoRZSid.mjs} +4 -4
  30. package/fesm2022/{id-generator-CGk_WAHZ.mjs.map → id-generator-LuoRZSid.mjs.map} +1 -1
  31. package/fesm2022/layout.mjs +6 -6
  32. package/fesm2022/layout.mjs.map +1 -1
  33. package/fesm2022/{list-key-manager-CyOIXo8P.mjs → list-key-manager-C7tp3RbG.mjs} +13 -13
  34. package/fesm2022/list-key-manager-C7tp3RbG.mjs.map +1 -0
  35. package/fesm2022/listbox.mjs +15 -15
  36. package/fesm2022/listbox.mjs.map +1 -1
  37. package/fesm2022/menu.mjs +58 -58
  38. package/fesm2022/menu.mjs.map +1 -1
  39. package/fesm2022/observers/private.mjs +3 -3
  40. package/fesm2022/observers/private.mjs.map +1 -1
  41. package/fesm2022/observers.mjs +13 -13
  42. package/fesm2022/observers.mjs.map +1 -1
  43. package/fesm2022/{overlay-module-epEhkaPq.mjs → overlay-module-Bd2UplUU.mjs} +39 -39
  44. package/fesm2022/{overlay-module-epEhkaPq.mjs.map → overlay-module-Bd2UplUU.mjs.map} +1 -1
  45. package/fesm2022/overlay.mjs +9 -9
  46. package/fesm2022/overlay.mjs.map +1 -1
  47. package/fesm2022/{platform-CwM6AZ0b.mjs → platform-DNDzkVcI.mjs} +4 -4
  48. package/fesm2022/{platform-CwM6AZ0b.mjs.map → platform-DNDzkVcI.mjs.map} +1 -1
  49. package/fesm2022/platform.mjs +5 -5
  50. package/fesm2022/platform.mjs.map +1 -1
  51. package/fesm2022/portal.mjs +16 -16
  52. package/fesm2022/portal.mjs.map +1 -1
  53. package/fesm2022/private.mjs +4 -4
  54. package/fesm2022/private.mjs.map +1 -1
  55. package/fesm2022/scrolling.mjs +37 -37
  56. package/fesm2022/scrolling.mjs.map +1 -1
  57. package/fesm2022/stepper.mjs +127 -108
  58. package/fesm2022/stepper.mjs.map +1 -1
  59. package/fesm2022/{style-loader-Dwx3yBB7.mjs → style-loader-B2sGQXxD.mjs} +4 -4
  60. package/fesm2022/{style-loader-Dwx3yBB7.mjs.map → style-loader-B2sGQXxD.mjs.map} +1 -1
  61. package/fesm2022/table.mjs +75 -75
  62. package/fesm2022/table.mjs.map +1 -1
  63. package/fesm2022/text-field.mjs +18 -18
  64. package/fesm2022/text-field.mjs.map +1 -1
  65. package/fesm2022/tree.mjs +26 -26
  66. package/fesm2022/tree.mjs.map +1 -1
  67. package/fesm2022/{unique-selection-dispatcher-IvBdhaDc.mjs → unique-selection-dispatcher-Cewa_Eg3.mjs} +4 -4
  68. package/fesm2022/{unique-selection-dispatcher-IvBdhaDc.mjs.map → unique-selection-dispatcher-Cewa_Eg3.mjs.map} +1 -1
  69. package/package.json +3 -3
  70. package/schematics/ng-add/index.js +1 -1
  71. package/stepper/index.d.ts +18 -10
  72. package/fesm2022/list-key-manager-CyOIXo8P.mjs.map +0 -1
@@ -1,16 +1,16 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, Directive, TemplateRef, InjectionToken, EventEmitter, booleanAttribute, Component, ViewEncapsulation, ChangeDetectionStrategy, ContentChild, ContentChildren, ViewChild, Input, Output, ChangeDetectorRef, QueryList, numberAttribute, NgModule } from '@angular/core';
2
+ import { inject, ElementRef, Directive, TemplateRef, InjectionToken, signal, EventEmitter, computed, booleanAttribute, Component, ViewEncapsulation, ChangeDetectionStrategy, ContentChild, ContentChildren, ViewChild, Input, Output, ChangeDetectorRef, QueryList, numberAttribute, NgModule } from '@angular/core';
3
3
  import { ControlContainer } from '@angular/forms';
4
4
  import { Subject, of } from 'rxjs';
5
5
  import { startWith, takeUntil } from 'rxjs/operators';
6
- import { D as Directionality } from './directionality-DBlSyD_q.mjs';
7
- import { _ as _IdGenerator } from './id-generator-CGk_WAHZ.mjs';
8
- import { F as FocusKeyManager } from './focus-key-manager-C1rAQJ5z.mjs';
6
+ import { D as Directionality } from './directionality-CChdj3az.mjs';
7
+ import { _ as _IdGenerator } from './id-generator-LuoRZSid.mjs';
8
+ import { F as FocusKeyManager } from './focus-key-manager-CPmlyB_c.mjs';
9
9
  import { hasModifierKey } from './keycodes.mjs';
10
10
  import { S as SPACE, c as ENTER } from './keycodes-CpHkExLC.mjs';
11
11
  import { c as _getFocusedElementPierceShadowDom } from './shadow-dom-B0oHn41l.mjs';
12
12
  import { BidiModule } from './bidi.mjs';
13
- import './list-key-manager-CyOIXo8P.mjs';
13
+ import './list-key-manager-C7tp3RbG.mjs';
14
14
  import './typeahead-9ZW4Dtsf.mjs';
15
15
 
16
16
  class CdkStepHeader {
@@ -20,10 +20,10 @@ class CdkStepHeader {
20
20
  focus() {
21
21
  this._elementRef.nativeElement.focus();
22
22
  }
23
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive });
24
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0-rc.1", type: CdkStepHeader, isStandalone: true, selector: "[cdkStepHeader]", host: { attributes: { "role": "tab" } }, ngImport: i0 });
23
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStepHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive });
24
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: CdkStepHeader, isStandalone: true, selector: "[cdkStepHeader]", host: { attributes: { "role": "tab" } }, ngImport: i0 });
25
25
  }
26
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepHeader, decorators: [{
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStepHeader, decorators: [{
27
27
  type: Directive,
28
28
  args: [{
29
29
  selector: '[cdkStepHeader]',
@@ -36,10 +36,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.1", ng
36
36
  class CdkStepLabel {
37
37
  template = inject(TemplateRef);
38
38
  constructor() { }
39
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
40
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0-rc.1", type: CdkStepLabel, isStandalone: true, selector: "[cdkStepLabel]", ngImport: i0 });
39
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStepLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
40
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: CdkStepLabel, isStandalone: true, selector: "[cdkStepLabel]", ngImport: i0 });
41
41
  }
42
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepLabel, decorators: [{
42
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStepLabel, decorators: [{
43
43
  type: Directive,
44
44
  args: [{
45
45
  selector: '[cdkStepLabel]',
@@ -79,7 +79,13 @@ class CdkStep {
79
79
  /** The top level abstract control of the step. */
80
80
  stepControl;
81
81
  /** Whether user has attempted to move away from the step. */
82
- interacted = false;
82
+ get interacted() {
83
+ return this._interacted();
84
+ }
85
+ set interacted(value) {
86
+ this._interacted.set(value);
87
+ }
88
+ _interacted = signal(false);
83
89
  /** Emits when the user has attempted to move away from the step. */
84
90
  interactedStream = new EventEmitter();
85
91
  /** Plain text label of the step. */
@@ -94,32 +100,82 @@ class CdkStep {
94
100
  */
95
101
  ariaLabelledby;
96
102
  /** State of the step. */
97
- state;
103
+ get state() {
104
+ return this._state();
105
+ }
106
+ set state(value) {
107
+ this._state.set(value);
108
+ }
109
+ _state = signal(undefined);
98
110
  /** Whether the user can return to this step once it has been marked as completed. */
99
- editable = true;
111
+ get editable() {
112
+ return this._editable();
113
+ }
114
+ set editable(value) {
115
+ this._editable.set(value);
116
+ }
117
+ _editable = signal(true);
100
118
  /** Whether the completion of step is optional. */
101
119
  optional = false;
102
120
  /** Whether step is marked as completed. */
103
121
  get completed() {
104
- return this._completedOverride == null ? this._getDefaultCompleted() : this._completedOverride;
122
+ const override = this._completedOverride();
123
+ const interacted = this._interacted();
124
+ if (override != null) {
125
+ return override;
126
+ }
127
+ return interacted && (!this.stepControl || this.stepControl.valid);
105
128
  }
106
129
  set completed(value) {
107
- this._completedOverride = value;
108
- }
109
- _completedOverride = null;
110
- _getDefaultCompleted() {
111
- return this.stepControl ? this.stepControl.valid && this.interacted : this.interacted;
112
- }
130
+ this._completedOverride.set(value);
131
+ }
132
+ _completedOverride = signal(null);
133
+ /** Current index of the step within the stepper. */
134
+ index = signal(-1);
135
+ /** Whether the step is selected. */
136
+ isSelected = computed(() => this._stepper.selectedIndex === this.index());
137
+ /** Type of indicator that should be shown for the step. */
138
+ indicatorType = computed(() => {
139
+ const selected = this.isSelected();
140
+ const completed = this.completed;
141
+ const defaultState = this._state() ?? STEP_STATE.NUMBER;
142
+ const editable = this._editable();
143
+ if (this._showError() && this.hasError && !selected) {
144
+ return STEP_STATE.ERROR;
145
+ }
146
+ if (this._displayDefaultIndicatorType) {
147
+ if (!completed || selected) {
148
+ return STEP_STATE.NUMBER;
149
+ }
150
+ return editable ? STEP_STATE.EDIT : STEP_STATE.DONE;
151
+ }
152
+ else {
153
+ if (completed && !selected) {
154
+ return STEP_STATE.DONE;
155
+ }
156
+ else if (completed && selected) {
157
+ return defaultState;
158
+ }
159
+ return editable && selected ? STEP_STATE.EDIT : defaultState;
160
+ }
161
+ });
162
+ /** Whether the user can navigate to the step. */
163
+ isNavigable = computed(() => {
164
+ const isSelected = this.isSelected();
165
+ const isCompleted = this.completed;
166
+ return isCompleted || isSelected || !this._stepper.linear;
167
+ });
113
168
  /** Whether step has an error. */
114
169
  get hasError() {
115
- return this._customError == null ? this._getDefaultError() : this._customError;
170
+ const customError = this._customError();
171
+ return customError == null ? this._getDefaultError() : customError;
116
172
  }
117
173
  set hasError(value) {
118
- this._customError = value;
174
+ this._customError.set(value);
119
175
  }
120
- _customError = null;
176
+ _customError = signal(null);
121
177
  _getDefaultError() {
122
- return this.stepControl && this.stepControl.invalid && this.interacted;
178
+ return this.interacted && !!this.stepControl?.invalid;
123
179
  }
124
180
  constructor() {
125
181
  const stepperOptions = inject(STEPPER_GLOBAL_OPTIONS, { optional: true });
@@ -132,12 +188,12 @@ class CdkStep {
132
188
  }
133
189
  /** Resets the step to its initial state. Note that this includes resetting form data. */
134
190
  reset() {
135
- this.interacted = false;
136
- if (this._completedOverride != null) {
137
- this._completedOverride = false;
191
+ this._interacted.set(false);
192
+ if (this._completedOverride() != null) {
193
+ this._completedOverride.set(false);
138
194
  }
139
- if (this._customError != null) {
140
- this._customError = false;
195
+ if (this._customError() != null) {
196
+ this._customError.set(false);
141
197
  }
142
198
  if (this.stepControl) {
143
199
  // Reset the forms since the default error state matchers will show errors on submit and we
@@ -153,8 +209,8 @@ class CdkStep {
153
209
  this._stepper._stateChanged();
154
210
  }
155
211
  _markAsInteracted() {
156
- if (!this.interacted) {
157
- this.interacted = true;
212
+ if (!this._interacted()) {
213
+ this._interacted.set(true);
158
214
  this.interactedStream.emit(this);
159
215
  }
160
216
  }
@@ -162,17 +218,17 @@ class CdkStep {
162
218
  _showError() {
163
219
  // We want to show the error state either if the user opted into/out of it using the
164
220
  // global options, or if they've explicitly set it through the `hasError` input.
165
- return this._stepperOptions.showError ?? this._customError != null;
221
+ return this._stepperOptions.showError ?? this._customError() != null;
166
222
  }
167
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStep, deps: [], target: i0.ɵɵFactoryTarget.Component });
168
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "20.0.0-rc.1", type: CdkStep, isStandalone: true, selector: "cdk-step", inputs: { stepControl: "stepControl", label: "label", errorMessage: "errorMessage", ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], state: "state", editable: ["editable", "editable", booleanAttribute], optional: ["optional", "optional", booleanAttribute], completed: ["completed", "completed", booleanAttribute], hasError: ["hasError", "hasError", booleanAttribute] }, outputs: { interactedStream: "interacted" }, queries: [{ propertyName: "stepLabel", first: true, predicate: CdkStepLabel, descendants: true }, { propertyName: "_childForms", predicate:
223
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStep, deps: [], target: i0.ɵɵFactoryTarget.Component });
224
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "20.0.0", type: CdkStep, isStandalone: true, selector: "cdk-step", inputs: { stepControl: "stepControl", label: "label", errorMessage: "errorMessage", ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], state: "state", editable: ["editable", "editable", booleanAttribute], optional: ["optional", "optional", booleanAttribute], completed: ["completed", "completed", booleanAttribute], hasError: ["hasError", "hasError", booleanAttribute] }, outputs: { interactedStream: "interacted" }, queries: [{ propertyName: "stepLabel", first: true, predicate: CdkStepLabel, descendants: true }, { propertyName: "_childForms", predicate:
169
225
  // Note: we look for `ControlContainer` here, because both `NgForm` and `FormGroupDirective`
170
226
  // provides themselves as such, but we don't want to have a concrete reference to both of
171
227
  // the directives. The type is marked as `Partial` in case we run into a class that provides
172
228
  // itself as `ControlContainer` but doesn't have the same interface as the directives.
173
229
  ControlContainer, descendants: true }], viewQueries: [{ propertyName: "content", first: true, predicate: TemplateRef, descendants: true, static: true }], exportAs: ["cdkStep"], usesOnChanges: true, ngImport: i0, template: '<ng-template><ng-content/></ng-template>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
174
230
  }
175
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStep, decorators: [{
231
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStep, decorators: [{
176
232
  type: Component,
177
233
  args: [{
178
234
  selector: 'cdk-step',
@@ -248,7 +304,7 @@ class CdkStepper {
248
304
  linear = false;
249
305
  /** The index of the selected step. */
250
306
  get selectedIndex() {
251
- return this._selectedIndex;
307
+ return this._selectedIndex();
252
308
  }
253
309
  set selectedIndex(index) {
254
310
  if (this._steps) {
@@ -256,19 +312,19 @@ class CdkStepper {
256
312
  if (!this._isValidIndex(index) && (typeof ngDevMode === 'undefined' || ngDevMode)) {
257
313
  throw Error('cdkStepper: Cannot assign out-of-bounds value to `selectedIndex`.');
258
314
  }
259
- if (this._selectedIndex !== index) {
315
+ if (this.selectedIndex !== index) {
260
316
  this.selected?._markAsInteracted();
261
317
  if (!this._anyControlsInvalidOrPending(index) &&
262
- (index >= this._selectedIndex || this.steps.toArray()[index].editable)) {
318
+ (index >= this.selectedIndex || this.steps.toArray()[index].editable)) {
263
319
  this._updateSelectedItemIndex(index);
264
320
  }
265
321
  }
266
322
  }
267
323
  else {
268
- this._selectedIndex = index;
324
+ this._selectedIndex.set(index);
269
325
  }
270
326
  }
271
- _selectedIndex = 0;
327
+ _selectedIndex = signal(0);
272
328
  /** The step that is selected. */
273
329
  get selected() {
274
330
  return this.steps ? this.steps.toArray()[this.selectedIndex] : undefined;
@@ -300,6 +356,7 @@ class CdkStepper {
300
356
  .pipe(startWith(this._steps), takeUntil(this._destroyed))
301
357
  .subscribe((steps) => {
302
358
  this.steps.reset(steps.filter(step => step._stepper === this));
359
+ this.steps.forEach((step, index) => step.index.set(index));
303
360
  this.steps.notifyOnChanges();
304
361
  });
305
362
  }
@@ -336,23 +393,23 @@ class CdkStepper {
336
393
  (this._dir ? this._dir.change : of())
337
394
  .pipe(startWith(this._layoutDirection()), takeUntil(this._destroyed))
338
395
  .subscribe(direction => this._keyManager?.withHorizontalOrientation(direction));
339
- this._keyManager.updateActiveItem(this._selectedIndex);
396
+ this._keyManager.updateActiveItem(this.selectedIndex);
340
397
  // No need to `takeUntil` here, because we're the ones destroying `steps`.
341
398
  this.steps.changes.subscribe(() => {
342
399
  if (!this.selected) {
343
- this._selectedIndex = Math.max(this._selectedIndex - 1, 0);
400
+ this._selectedIndex.set(Math.max(this.selectedIndex - 1, 0));
344
401
  }
345
402
  });
346
403
  // The logic which asserts that the selected index is within bounds doesn't run before the
347
404
  // steps are initialized, because we don't how many steps there are yet so we may have an
348
405
  // invalid index on init. If that's the case, auto-correct to the default so we don't throw.
349
- if (!this._isValidIndex(this._selectedIndex)) {
350
- this._selectedIndex = 0;
406
+ if (!this._isValidIndex(this.selectedIndex)) {
407
+ this._selectedIndex.set(0);
351
408
  }
352
409
  // For linear step and selected index is greater than zero,
353
410
  // set all the previous steps to interacted so that we can navigate to previous steps.
354
- if (this.linear && this._selectedIndex > 0) {
355
- const visitedSteps = this.steps.toArray().slice(0, this._selectedIndex);
411
+ if (this.linear && this.selectedIndex > 0) {
412
+ const visitedSteps = this.steps.toArray().slice(0, this._selectedIndex());
356
413
  for (const step of visitedSteps) {
357
414
  step._markAsInteracted();
358
415
  }
@@ -367,11 +424,11 @@ class CdkStepper {
367
424
  }
368
425
  /** Selects and focuses the next step in list. */
369
426
  next() {
370
- this.selectedIndex = Math.min(this._selectedIndex + 1, this.steps.length - 1);
427
+ this.selectedIndex = Math.min(this._selectedIndex() + 1, this.steps.length - 1);
371
428
  }
372
429
  /** Selects and focuses the previous step in list. */
373
430
  previous() {
374
- this.selectedIndex = Math.max(this._selectedIndex - 1, 0);
431
+ this.selectedIndex = Math.max(this._selectedIndex() - 1, 0);
375
432
  }
376
433
  /** Resets the stepper to its initial state. Note that this includes clearing form data. */
377
434
  reset() {
@@ -393,7 +450,7 @@ class CdkStepper {
393
450
  }
394
451
  /** Returns position state of the step with the given index. */
395
452
  _getAnimationDirection(index) {
396
- const position = index - this._selectedIndex;
453
+ const position = index - this._selectedIndex();
397
454
  if (position < 0) {
398
455
  return this._layoutDirection() === 'rtl' ? 'next' : 'previous';
399
456
  }
@@ -402,56 +459,18 @@ class CdkStepper {
402
459
  }
403
460
  return 'current';
404
461
  }
405
- /** Returns the type of icon to be displayed. */
406
- _getIndicatorType(index, state = STEP_STATE.NUMBER) {
407
- const step = this.steps.toArray()[index];
408
- const isCurrentStep = this._isCurrentStep(index);
409
- return step._displayDefaultIndicatorType
410
- ? this._getDefaultIndicatorLogic(step, isCurrentStep)
411
- : this._getGuidelineLogic(step, isCurrentStep, state);
412
- }
413
- _getDefaultIndicatorLogic(step, isCurrentStep) {
414
- if (step._showError() && step.hasError && !isCurrentStep) {
415
- return STEP_STATE.ERROR;
416
- }
417
- else if (!step.completed || isCurrentStep) {
418
- return STEP_STATE.NUMBER;
419
- }
420
- else {
421
- return step.editable ? STEP_STATE.EDIT : STEP_STATE.DONE;
422
- }
423
- }
424
- _getGuidelineLogic(step, isCurrentStep, state = STEP_STATE.NUMBER) {
425
- if (step._showError() && step.hasError && !isCurrentStep) {
426
- return STEP_STATE.ERROR;
427
- }
428
- else if (step.completed && !isCurrentStep) {
429
- return STEP_STATE.DONE;
430
- }
431
- else if (step.completed && isCurrentStep) {
432
- return state;
433
- }
434
- else if (step.editable && isCurrentStep) {
435
- return STEP_STATE.EDIT;
436
- }
437
- else {
438
- return state;
439
- }
440
- }
441
- _isCurrentStep(index) {
442
- return this._selectedIndex === index;
443
- }
444
462
  /** Returns the index of the currently-focused step header. */
445
463
  _getFocusIndex() {
446
- return this._keyManager ? this._keyManager.activeItemIndex : this._selectedIndex;
464
+ return this._keyManager ? this._keyManager.activeItemIndex : this._selectedIndex();
447
465
  }
448
466
  _updateSelectedItemIndex(newIndex) {
449
467
  const stepsArray = this.steps.toArray();
468
+ const selectedIndex = this._selectedIndex();
450
469
  this.selectionChange.emit({
451
470
  selectedIndex: newIndex,
452
- previouslySelectedIndex: this._selectedIndex,
471
+ previouslySelectedIndex: selectedIndex,
453
472
  selectedStep: stepsArray[newIndex],
454
- previouslySelectedStep: stepsArray[this._selectedIndex],
473
+ previouslySelectedStep: stepsArray[selectedIndex],
455
474
  });
456
475
  // If focus is inside the stepper, move it to the next header, otherwise it may become
457
476
  // lost when the active step content is hidden. We can't be more granular with the check
@@ -462,8 +481,8 @@ class CdkStepper {
462
481
  ? this._keyManager.setActiveItem(newIndex)
463
482
  : this._keyManager.updateActiveItem(newIndex);
464
483
  }
465
- this._selectedIndex = newIndex;
466
- this.selectedIndexChange.emit(this._selectedIndex);
484
+ this._selectedIndex.set(newIndex);
485
+ this.selectedIndexChange.emit(newIndex);
467
486
  this._stateChanged();
468
487
  }
469
488
  _onKeydown(event) {
@@ -490,7 +509,7 @@ class CdkStepper {
490
509
  const isIncomplete = control
491
510
  ? control.invalid || control.pending || !step.interacted
492
511
  : !step.completed;
493
- return isIncomplete && !step.optional && !step._completedOverride;
512
+ return isIncomplete && !step.optional && !step._completedOverride();
494
513
  });
495
514
  }
496
515
  return false;
@@ -508,10 +527,10 @@ class CdkStepper {
508
527
  _isValidIndex(index) {
509
528
  return index > -1 && (!this.steps || index < this.steps.length);
510
529
  }
511
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepper, deps: [], target: i0.ɵɵFactoryTarget.Directive });
512
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.0.0-rc.1", type: CdkStepper, isStandalone: true, selector: "[cdkStepper]", inputs: { linear: ["linear", "linear", booleanAttribute], selectedIndex: ["selectedIndex", "selectedIndex", numberAttribute], selected: "selected", orientation: "orientation" }, outputs: { selectionChange: "selectionChange", selectedIndexChange: "selectedIndexChange" }, queries: [{ propertyName: "_steps", predicate: CdkStep, descendants: true }, { propertyName: "_stepHeader", predicate: CdkStepHeader, descendants: true }], exportAs: ["cdkStepper"], ngImport: i0 });
530
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStepper, deps: [], target: i0.ɵɵFactoryTarget.Directive });
531
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.0.0", type: CdkStepper, isStandalone: true, selector: "[cdkStepper]", inputs: { linear: ["linear", "linear", booleanAttribute], selectedIndex: ["selectedIndex", "selectedIndex", numberAttribute], selected: "selected", orientation: "orientation" }, outputs: { selectionChange: "selectionChange", selectedIndexChange: "selectedIndexChange" }, queries: [{ propertyName: "_steps", predicate: CdkStep, descendants: true }, { propertyName: "_stepHeader", predicate: CdkStepHeader, descendants: true }], exportAs: ["cdkStepper"], ngImport: i0 });
513
532
  }
514
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepper, decorators: [{
533
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStepper, decorators: [{
515
534
  type: Directive,
516
535
  args: [{
517
536
  selector: '[cdkStepper]',
@@ -545,10 +564,10 @@ class CdkStepperNext {
545
564
  /** Type of the next button. Defaults to "submit" if not specified. */
546
565
  type = 'submit';
547
566
  constructor() { }
548
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepperNext, deps: [], target: i0.ɵɵFactoryTarget.Directive });
549
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0-rc.1", type: CdkStepperNext, isStandalone: true, selector: "button[cdkStepperNext]", inputs: { type: "type" }, host: { listeners: { "click": "_stepper.next()" }, properties: { "type": "type" } }, ngImport: i0 });
567
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStepperNext, deps: [], target: i0.ɵɵFactoryTarget.Directive });
568
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: CdkStepperNext, isStandalone: true, selector: "button[cdkStepperNext]", inputs: { type: "type" }, host: { listeners: { "click": "_stepper.next()" }, properties: { "type": "type" } }, ngImport: i0 });
550
569
  }
551
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepperNext, decorators: [{
570
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStepperNext, decorators: [{
552
571
  type: Directive,
553
572
  args: [{
554
573
  selector: 'button[cdkStepperNext]',
@@ -566,10 +585,10 @@ class CdkStepperPrevious {
566
585
  /** Type of the previous button. Defaults to "button" if not specified. */
567
586
  type = 'button';
568
587
  constructor() { }
569
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepperPrevious, deps: [], target: i0.ɵɵFactoryTarget.Directive });
570
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0-rc.1", type: CdkStepperPrevious, isStandalone: true, selector: "button[cdkStepperPrevious]", inputs: { type: "type" }, host: { listeners: { "click": "_stepper.previous()" }, properties: { "type": "type" } }, ngImport: i0 });
588
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStepperPrevious, deps: [], target: i0.ɵɵFactoryTarget.Directive });
589
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: CdkStepperPrevious, isStandalone: true, selector: "button[cdkStepperPrevious]", inputs: { type: "type" }, host: { listeners: { "click": "_stepper.previous()" }, properties: { "type": "type" } }, ngImport: i0 });
571
590
  }
572
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepperPrevious, decorators: [{
591
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStepperPrevious, decorators: [{
573
592
  type: Directive,
574
593
  args: [{
575
594
  selector: 'button[cdkStepperPrevious]',
@@ -583,17 +602,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.1", ng
583
602
  }] } });
584
603
 
585
604
  class CdkStepperModule {
586
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
587
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepperModule, imports: [BidiModule,
605
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStepperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
606
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.0", ngImport: i0, type: CdkStepperModule, imports: [BidiModule,
588
607
  CdkStep,
589
608
  CdkStepper,
590
609
  CdkStepHeader,
591
610
  CdkStepLabel,
592
611
  CdkStepperNext,
593
612
  CdkStepperPrevious], exports: [CdkStep, CdkStepper, CdkStepHeader, CdkStepLabel, CdkStepperNext, CdkStepperPrevious] });
594
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepperModule, imports: [BidiModule] });
613
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStepperModule, imports: [BidiModule] });
595
614
  }
596
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-rc.1", ngImport: i0, type: CdkStepperModule, decorators: [{
615
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: CdkStepperModule, decorators: [{
597
616
  type: NgModule,
598
617
  args: [{
599
618
  imports: [