index.d.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. import * as i0 from '@angular/core';
  2. import { ElementRef, TemplateRef, InjectionToken, OnChanges, QueryList, EventEmitter, AfterContentInit, AfterViewInit, OnDestroy } from '@angular/core';
  3. import { NgForm, FormGroupDirective, AbstractControl } from '@angular/forms';
  4. import { Subject } from 'rxjs';
  5. import { F as FocusableOption } from '../focus-key-manager.d-BIKDy8oD.js';
  6. import { B as BidiModule } from '../bidi-module.d-D-fEBKdS.js';
  7. import '../list-key-manager.d-BlK3jyRn.js';
  8. import '../focus-monitor.d-CvvJeQRc.js';
  9. declare class CdkStepHeader implements FocusableOption {
  10. _elementRef: ElementRef<HTMLElement>;
  11. constructor(...args: unknown[]);
  12. /** Focuses the step header. */
  13. focus(): void;
  14. static ɵfac: i0.ɵɵFactoryDeclaration<CdkStepHeader, never>;
  15. static ɵdir: i0.ɵɵDirectiveDeclaration<CdkStepHeader, "[cdkStepHeader]", never, {}, {}, never, never, true, never>;
  16. }
  17. declare class CdkStepLabel {
  18. template: TemplateRef<any>;
  19. constructor(...args: unknown[]);
  20. static ɵfac: i0.ɵɵFactoryDeclaration<CdkStepLabel, never>;
  21. static ɵdir: i0.ɵɵDirectiveDeclaration<CdkStepLabel, "[cdkStepLabel]", never, {}, {}, never, never, true, never>;
  22. }
  23. /**
  24. * Position state of the content of each step in stepper that is used for transitioning
  25. * the content into correct position upon step selection change.
  26. */
  27. type StepContentPositionState = 'previous' | 'current' | 'next';
  28. /** Possible orientation of a stepper. */
  29. type StepperOrientation = 'horizontal' | 'vertical';
  30. /** Change event emitted on selection changes. */
  31. declare class StepperSelectionEvent {
  32. /** Index of the step now selected. */
  33. selectedIndex: number;
  34. /** Index of the step previously selected. */
  35. previouslySelectedIndex: number;
  36. /** The step instance now selected. */
  37. selectedStep: CdkStep;
  38. /** The step instance previously selected. */
  39. previouslySelectedStep: CdkStep;
  40. }
  41. /** The state of each step. */
  42. type StepState = 'number' | 'edit' | 'done' | 'error' | string;
  43. /** Enum to represent the different states of the steps. */
  44. declare const STEP_STATE: {
  45. NUMBER: string;
  46. EDIT: string;
  47. DONE: string;
  48. ERROR: string;
  49. };
  50. /** InjectionToken that can be used to specify the global stepper options. */
  51. declare const STEPPER_GLOBAL_OPTIONS: InjectionToken<StepperOptions>;
  52. /** Configurable options for stepper. */
  53. interface StepperOptions {
  54. /**
  55. * Whether the stepper should display an error state or not.
  56. * Default behavior is assumed to be false.
  57. */
  58. showError?: boolean;
  59. /**
  60. * Whether the stepper should display the default indicator type
  61. * or not.
  62. * Default behavior is assumed to be true.
  63. */
  64. displayDefaultIndicatorType?: boolean;
  65. }
  66. declare class CdkStep implements OnChanges {
  67. private _stepperOptions;
  68. _stepper: CdkStepper;
  69. _displayDefaultIndicatorType: boolean;
  70. /** Template for step label if it exists. */
  71. stepLabel: CdkStepLabel;
  72. /** Forms that have been projected into the step. */
  73. protected _childForms: QueryList<Partial<NgForm | FormGroupDirective>> | undefined;
  74. /** Template for step content. */
  75. content: TemplateRef<any>;
  76. /** The top level abstract control of the step. */
  77. stepControl: AbstractControl;
  78. /** Whether user has attempted to move away from the step. */
  79. interacted: boolean;
  80. /** Emits when the user has attempted to move away from the step. */
  81. readonly interactedStream: EventEmitter<CdkStep>;
  82. /** Plain text label of the step. */
  83. label: string;
  84. /** Error message to display when there's an error. */
  85. errorMessage: string;
  86. /** Aria label for the tab. */
  87. ariaLabel: string;
  88. /**
  89. * Reference to the element that the tab is labelled by.
  90. * Will be cleared if `aria-label` is set at the same time.
  91. */
  92. ariaLabelledby: string;
  93. /** State of the step. */
  94. state: StepState;
  95. /** Whether the user can return to this step once it has been marked as completed. */
  96. editable: boolean;
  97. /** Whether the completion of step is optional. */
  98. optional: boolean;
  99. /** Whether step is marked as completed. */
  100. get completed(): boolean;
  101. set completed(value: boolean);
  102. _completedOverride: boolean | null;
  103. private _getDefaultCompleted;
  104. /** Whether step has an error. */
  105. get hasError(): boolean;
  106. set hasError(value: boolean);
  107. private _customError;
  108. private _getDefaultError;
  109. constructor(...args: unknown[]);
  110. /** Selects this step component. */
  111. select(): void;
  112. /** Resets the step to its initial state. Note that this includes resetting form data. */
  113. reset(): void;
  114. ngOnChanges(): void;
  115. _markAsInteracted(): void;
  116. /** Determines whether the error state can be shown. */
  117. _showError(): boolean;
  118. static ɵfac: i0.ɵɵFactoryDeclaration<CdkStep, never>;
  119. static ɵcmp: i0.ɵɵComponentDeclaration<CdkStep, "cdk-step", ["cdkStep"], { "stepControl": { "alias": "stepControl"; "required": false; }; "label": { "alias": "label"; "required": false; }; "errorMessage": { "alias": "errorMessage"; "required": false; }; "ariaLabel": { "alias": "aria-label"; "required": false; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; }; "state": { "alias": "state"; "required": false; }; "editable": { "alias": "editable"; "required": false; }; "optional": { "alias": "optional"; "required": false; }; "completed": { "alias": "completed"; "required": false; }; "hasError": { "alias": "hasError"; "required": false; }; }, { "interactedStream": "interacted"; }, ["stepLabel", "_childForms"], ["*"], true, never>;
  120. static ngAcceptInputType_editable: unknown;
  121. static ngAcceptInputType_optional: unknown;
  122. static ngAcceptInputType_completed: unknown;
  123. static ngAcceptInputType_hasError: unknown;
  124. }
  125. declare class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
  126. private _dir;
  127. private _changeDetectorRef;
  128. protected _elementRef: ElementRef<HTMLElement>;
  129. /** Emits when the component is destroyed. */
  130. protected readonly _destroyed: Subject<void>;
  131. /** Used for managing keyboard focus. */
  132. private _keyManager;
  133. /** Full list of steps inside the stepper, including inside nested steppers. */
  134. _steps: QueryList<CdkStep>;
  135. /** Steps that belong to the current stepper, excluding ones from nested steppers. */
  136. readonly steps: QueryList<CdkStep>;
  137. /** The list of step headers of the steps in the stepper. */
  138. _stepHeader: QueryList<CdkStepHeader>;
  139. /** List of step headers sorted based on their DOM order. */
  140. private _sortedHeaders;
  141. /** Whether the validity of previous steps should be checked or not. */
  142. linear: boolean;
  143. /** The index of the selected step. */
  144. get selectedIndex(): number;
  145. set selectedIndex(index: number);
  146. private _selectedIndex;
  147. /** The step that is selected. */
  148. get selected(): CdkStep | undefined;
  149. set selected(step: CdkStep | undefined);
  150. /** Event emitted when the selected step has changed. */
  151. readonly selectionChange: EventEmitter<StepperSelectionEvent>;
  152. /** Output to support two-way binding on `[(selectedIndex)]` */
  153. readonly selectedIndexChange: EventEmitter<number>;
  154. /** Used to track unique ID for each stepper component. */
  155. private _groupId;
  156. /** Orientation of the stepper. */
  157. get orientation(): StepperOrientation;
  158. set orientation(value: StepperOrientation);
  159. private _orientation;
  160. constructor(...args: unknown[]);
  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 ɵfac: i0.ɵɵFactoryDeclaration<CdkStepper, never>;
  194. static ɵdir: i0.ɵɵDirectiveDeclaration<CdkStepper, "[cdkStepper]", ["cdkStepper"], { "linear": { "alias": "linear"; "required": false; }; "selectedIndex": { "alias": "selectedIndex"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "orientation": { "alias": "orientation"; "required": false; }; }, { "selectionChange": "selectionChange"; "selectedIndexChange": "selectedIndexChange"; }, ["_steps", "_stepHeader"], never, true, never>;
  195. static ngAcceptInputType_linear: unknown;
  196. static ngAcceptInputType_selectedIndex: unknown;
  197. }
  198. /** Button that moves to the next step in a stepper workflow. */
  199. declare class CdkStepperNext {
  200. _stepper: CdkStepper;
  201. /** Type of the next button. Defaults to "submit" if not specified. */
  202. type: string;
  203. constructor(...args: unknown[]);
  204. static ɵfac: i0.ɵɵFactoryDeclaration<CdkStepperNext, never>;
  205. static ɵdir: i0.ɵɵDirectiveDeclaration<CdkStepperNext, "button[cdkStepperNext]", never, { "type": { "alias": "type"; "required": false; }; }, {}, never, never, true, never>;
  206. }
  207. /** Button that moves to the previous step in a stepper workflow. */
  208. declare class CdkStepperPrevious {
  209. _stepper: CdkStepper;
  210. /** Type of the previous button. Defaults to "button" if not specified. */
  211. type: string;
  212. constructor(...args: unknown[]);
  213. static ɵfac: i0.ɵɵFactoryDeclaration<CdkStepperPrevious, never>;
  214. static ɵdir: i0.ɵɵDirectiveDeclaration<CdkStepperPrevious, "button[cdkStepperPrevious]", never, { "type": { "alias": "type"; "required": false; }; }, {}, never, never, true, never>;
  215. }
  216. declare class CdkStepperModule {
  217. static ɵfac: i0.ɵɵFactoryDeclaration<CdkStepperModule, never>;
  218. static ɵmod: i0.ɵɵNgModuleDeclaration<CdkStepperModule, never, [typeof BidiModule, typeof CdkStep, typeof CdkStepper, typeof CdkStepHeader, typeof CdkStepLabel, typeof CdkStepperNext, typeof CdkStepperPrevious], [typeof CdkStep, typeof CdkStepper, typeof CdkStepHeader, typeof CdkStepLabel, typeof CdkStepperNext, typeof CdkStepperPrevious]>;
  219. static ɵinj: i0.ɵɵInjectorDeclaration<CdkStepperModule>;
  220. }
  221. export { CdkStep, CdkStepHeader, CdkStepLabel, CdkStepper, CdkStepperModule, CdkStepperNext, CdkStepperPrevious, STEPPER_GLOBAL_OPTIONS, STEP_STATE, StepperSelectionEvent };
  222. export type { StepContentPositionState, StepState, StepperOptions, StepperOrientation };