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