1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { Directionality } from '@angular/cdk/bidi';
|
---|
9 | import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
---|
10 | import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, InjectionToken, OnChanges, OnDestroy, QueryList, TemplateRef, AfterContentInit } from '@angular/core';
|
---|
11 | import { Observable, Subject } from 'rxjs';
|
---|
12 | import { CdkStepHeader } from './step-header';
|
---|
13 | import { CdkStepLabel } from './step-label';
|
---|
14 | /**
|
---|
15 | * Position state of the content of each step in stepper that is used for transitioning
|
---|
16 | * the content into correct position upon step selection change.
|
---|
17 | */
|
---|
18 | export declare type StepContentPositionState = 'previous' | 'current' | 'next';
|
---|
19 | /** Possible orientation of a stepper. */
|
---|
20 | export declare type StepperOrientation = 'horizontal' | 'vertical';
|
---|
21 | /** Change event emitted on selection changes. */
|
---|
22 | export declare class StepperSelectionEvent {
|
---|
23 | /** Index of the step now selected. */
|
---|
24 | selectedIndex: number;
|
---|
25 | /** Index of the step previously selected. */
|
---|
26 | previouslySelectedIndex: number;
|
---|
27 | /** The step instance now selected. */
|
---|
28 | selectedStep: CdkStep;
|
---|
29 | /** The step instance previously selected. */
|
---|
30 | previouslySelectedStep: CdkStep;
|
---|
31 | }
|
---|
32 | /** The state of each step. */
|
---|
33 | export declare type StepState = 'number' | 'edit' | 'done' | 'error' | string;
|
---|
34 | /** Enum to represent the different states of the steps. */
|
---|
35 | export declare const STEP_STATE: {
|
---|
36 | NUMBER: string;
|
---|
37 | EDIT: string;
|
---|
38 | DONE: string;
|
---|
39 | ERROR: string;
|
---|
40 | };
|
---|
41 | /** InjectionToken that can be used to specify the global stepper options. */
|
---|
42 | export declare const STEPPER_GLOBAL_OPTIONS: InjectionToken<StepperOptions>;
|
---|
43 | /** Configurable options for stepper. */
|
---|
44 | export interface StepperOptions {
|
---|
45 | /**
|
---|
46 | * Whether the stepper should display an error state or not.
|
---|
47 | * Default behavior is assumed to be false.
|
---|
48 | */
|
---|
49 | showError?: boolean;
|
---|
50 | /**
|
---|
51 | * Whether the stepper should display the default indicator type
|
---|
52 | * or not.
|
---|
53 | * Default behavior is assumed to be true.
|
---|
54 | */
|
---|
55 | displayDefaultIndicatorType?: boolean;
|
---|
56 | }
|
---|
57 | export declare class CdkStep implements OnChanges {
|
---|
58 | _stepper: CdkStepper;
|
---|
59 | private _stepperOptions;
|
---|
60 | _displayDefaultIndicatorType: boolean;
|
---|
61 | /** Template for step label if it exists. */
|
---|
62 | stepLabel: CdkStepLabel;
|
---|
63 | /** Template for step content. */
|
---|
64 | content: TemplateRef<any>;
|
---|
65 | /** The top level abstract control of the step. */
|
---|
66 | stepControl: AbstractControlLike;
|
---|
67 | /** Whether user has attempted to move away from the step. */
|
---|
68 | interacted: boolean;
|
---|
69 | /** Emits when the user has attempted to move away from the step. */
|
---|
70 | readonly interactedStream: EventEmitter<CdkStep>;
|
---|
71 | /** Plain text label of the step. */
|
---|
72 | label: string;
|
---|
73 | /** Error message to display when there's an error. */
|
---|
74 | errorMessage: string;
|
---|
75 | /** Aria label for the tab. */
|
---|
76 | ariaLabel: string;
|
---|
77 | /**
|
---|
78 | * Reference to the element that the tab is labelled by.
|
---|
79 | * Will be cleared if `aria-label` is set at the same time.
|
---|
80 | */
|
---|
81 | ariaLabelledby: string;
|
---|
82 | /** State of the step. */
|
---|
83 | state: StepState;
|
---|
84 | /** Whether the user can return to this step once it has been marked as completed. */
|
---|
85 | get editable(): boolean;
|
---|
86 | set editable(value: boolean);
|
---|
87 | private _editable;
|
---|
88 | /** Whether the completion of step is optional. */
|
---|
89 | get optional(): boolean;
|
---|
90 | set optional(value: boolean);
|
---|
91 | private _optional;
|
---|
92 | /** Whether step is marked as completed. */
|
---|
93 | get completed(): boolean;
|
---|
94 | set completed(value: boolean);
|
---|
95 | _completedOverride: boolean | null;
|
---|
96 | private _getDefaultCompleted;
|
---|
97 | /** Whether step has an error. */
|
---|
98 | get hasError(): boolean;
|
---|
99 | set hasError(value: boolean);
|
---|
100 | private _customError;
|
---|
101 | private _getDefaultError;
|
---|
102 | constructor(_stepper: CdkStepper, stepperOptions?: StepperOptions);
|
---|
103 | /** Selects this step component. */
|
---|
104 | select(): void;
|
---|
105 | /** Resets the step to its initial state. Note that this includes resetting form data. */
|
---|
106 | reset(): void;
|
---|
107 | ngOnChanges(): void;
|
---|
108 | _markAsInteracted(): void;
|
---|
109 | /** Determines whether the error state can be shown. */
|
---|
110 | _showError(): boolean;
|
---|
111 | static ngAcceptInputType_editable: BooleanInput;
|
---|
112 | static ngAcceptInputType_hasError: BooleanInput;
|
---|
113 | static ngAcceptInputType_optional: BooleanInput;
|
---|
114 | static ngAcceptInputType_completed: BooleanInput;
|
---|
115 | }
|
---|
116 | export declare class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
|
---|
117 | private _dir;
|
---|
118 | private _changeDetectorRef;
|
---|
119 | private _elementRef;
|
---|
120 | /** Emits when the component is destroyed. */
|
---|
121 | protected readonly _destroyed: Subject<void>;
|
---|
122 | /** Used for managing keyboard focus. */
|
---|
123 | private _keyManager;
|
---|
124 | /** Full list of steps inside the stepper, including inside nested steppers. */
|
---|
125 | _steps: QueryList<CdkStep>;
|
---|
126 | /** Steps that belong to the current stepper, excluding ones from nested steppers. */
|
---|
127 | readonly steps: QueryList<CdkStep>;
|
---|
128 | /** The list of step headers of the steps in the stepper. */
|
---|
129 | _stepHeader: QueryList<CdkStepHeader>;
|
---|
130 | /** List of step headers sorted based on their DOM order. */
|
---|
131 | private _sortedHeaders;
|
---|
132 | /** Whether the validity of previous steps should be checked or not. */
|
---|
133 | get linear(): boolean;
|
---|
134 | set linear(value: boolean);
|
---|
135 | private _linear;
|
---|
136 | /** The index of the selected step. */
|
---|
137 | get selectedIndex(): number;
|
---|
138 | set selectedIndex(index: number);
|
---|
139 | private _selectedIndex;
|
---|
140 | /** The step that is selected. */
|
---|
141 | get selected(): CdkStep | undefined;
|
---|
142 | set selected(step: CdkStep | undefined);
|
---|
143 | /** Event emitted when the selected step has changed. */
|
---|
144 | readonly selectionChange: EventEmitter<StepperSelectionEvent>;
|
---|
145 | /** Used to track unique ID for each stepper component. */
|
---|
146 | _groupId: number;
|
---|
147 | /** Orientation of the stepper. */
|
---|
148 | get orientation(): StepperOrientation;
|
---|
149 | set orientation(value: StepperOrientation);
|
---|
150 | /**
|
---|
151 | * @deprecated To be turned into a private property. Use `orientation` instead.
|
---|
152 | * @breaking-change 13.0.0
|
---|
153 | */
|
---|
154 | protected _orientation: StepperOrientation;
|
---|
155 | constructor(_dir: Directionality, _changeDetectorRef: ChangeDetectorRef, _elementRef: ElementRef<HTMLElement>,
|
---|
156 | /**
|
---|
157 | * @deprecated No longer in use, to be removed.
|
---|
158 | * @breaking-change 13.0.0
|
---|
159 | */
|
---|
160 | _document: any);
|
---|
161 | ngAfterContentInit(): void;
|
---|
162 | ngAfterViewInit(): void;
|
---|
163 | ngOnDestroy(): void;
|
---|
164 | /** Selects and focuses the next step in list. */
|
---|
165 | next(): void;
|
---|
166 | /** Selects and focuses the previous step in list. */
|
---|
167 | previous(): void;
|
---|
168 | /** Resets the stepper to its initial state. Note that this includes clearing form data. */
|
---|
169 | reset(): void;
|
---|
170 | /** Returns a unique id for each step label element. */
|
---|
171 | _getStepLabelId(i: number): string;
|
---|
172 | /** Returns unique id for each step content element. */
|
---|
173 | _getStepContentId(i: number): string;
|
---|
174 | /** Marks the component to be change detected. */
|
---|
175 | _stateChanged(): void;
|
---|
176 | /** Returns position state of the step with the given index. */
|
---|
177 | _getAnimationDirection(index: number): StepContentPositionState;
|
---|
178 | /** Returns the type of icon to be displayed. */
|
---|
179 | _getIndicatorType(index: number, state?: StepState): StepState;
|
---|
180 | private _getDefaultIndicatorLogic;
|
---|
181 | private _getGuidelineLogic;
|
---|
182 | private _isCurrentStep;
|
---|
183 | /** Returns the index of the currently-focused step header. */
|
---|
184 | _getFocusIndex(): number | null;
|
---|
185 | private _updateSelectedItemIndex;
|
---|
186 | _onKeydown(event: KeyboardEvent): void;
|
---|
187 | private _anyControlsInvalidOrPending;
|
---|
188 | private _layoutDirection;
|
---|
189 | /** Checks whether the stepper contains the focused element. */
|
---|
190 | private _containsFocus;
|
---|
191 | /** Checks whether the passed-in index is a valid step index. */
|
---|
192 | private _isValidIndex;
|
---|
193 | static ngAcceptInputType_editable: BooleanInput;
|
---|
194 | static ngAcceptInputType_optional: BooleanInput;
|
---|
195 | static ngAcceptInputType_completed: BooleanInput;
|
---|
196 | static ngAcceptInputType_hasError: BooleanInput;
|
---|
197 | static ngAcceptInputType_linear: BooleanInput;
|
---|
198 | static ngAcceptInputType_selectedIndex: NumberInput;
|
---|
199 | }
|
---|
200 | /**
|
---|
201 | * Simplified representation of an "AbstractControl" from @angular/forms.
|
---|
202 | * Used to avoid having to bring in @angular/forms for a single optional interface.
|
---|
203 | * @docs-private
|
---|
204 | */
|
---|
205 | interface AbstractControlLike {
|
---|
206 | asyncValidator: ((control: any) => any) | null;
|
---|
207 | dirty: boolean;
|
---|
208 | disabled: boolean;
|
---|
209 | enabled: boolean;
|
---|
210 | errors: {
|
---|
211 | [key: string]: any;
|
---|
212 | } | null;
|
---|
213 | invalid: boolean;
|
---|
214 | parent: any;
|
---|
215 | pending: boolean;
|
---|
216 | pristine: boolean;
|
---|
217 | root: AbstractControlLike;
|
---|
218 | status: string;
|
---|
219 | readonly statusChanges: Observable<any>;
|
---|
220 | touched: boolean;
|
---|
221 | untouched: boolean;
|
---|
222 | updateOn: any;
|
---|
223 | valid: boolean;
|
---|
224 | validator: ((control: any) => any) | null;
|
---|
225 | value: any;
|
---|
226 | readonly valueChanges: Observable<any>;
|
---|
227 | clearAsyncValidators(): void;
|
---|
228 | clearValidators(): void;
|
---|
229 | disable(opts?: any): void;
|
---|
230 | enable(opts?: any): void;
|
---|
231 | get(path: (string | number)[] | string): AbstractControlLike | null;
|
---|
232 | getError(errorCode: string, path?: (string | number)[] | string): any;
|
---|
233 | hasError(errorCode: string, path?: (string | number)[] | string): boolean;
|
---|
234 | markAllAsTouched(): void;
|
---|
235 | markAsDirty(opts?: any): void;
|
---|
236 | markAsPending(opts?: any): void;
|
---|
237 | markAsPristine(opts?: any): void;
|
---|
238 | markAsTouched(opts?: any): void;
|
---|
239 | markAsUntouched(opts?: any): void;
|
---|
240 | patchValue(value: any, options?: Object): void;
|
---|
241 | reset(value?: any, options?: Object): void;
|
---|
242 | setAsyncValidators(newValidator: (control: any) => any | ((control: any) => any)[] | null): void;
|
---|
243 | setErrors(errors: {
|
---|
244 | [key: string]: any;
|
---|
245 | } | null, opts?: any): void;
|
---|
246 | setParent(parent: any): void;
|
---|
247 | setValidators(newValidator: (control: any) => any | ((control: any) => any)[] | null): void;
|
---|
248 | setValue(value: any, options?: Object): void;
|
---|
249 | updateValueAndValidity(opts?: any): void;
|
---|
250 | patchValue(value: any, options?: any): void;
|
---|
251 | reset(formState?: any, options?: any): void;
|
---|
252 | setValue(value: any, options?: any): void;
|
---|
253 | }
|
---|
254 | export {};
|
---|