1 | /**
|
2 | * @license
|
3 | * Copyright Akveo. All Rights Reserved.
|
4 | * Licensed under the MIT License. See License.txt in the project root for license information.
|
5 | */
|
6 | import { EventEmitter, QueryList, TemplateRef } from '@angular/core';
|
7 | import { NbBooleanInput } from '../helpers';
|
8 | import { NbStepComponent } from './step.component';
|
9 | import * as i0 from "@angular/core";
|
10 | export type NbStepperOrientation = 'vertical' | 'horizontal';
|
11 | export interface NbStepChangeEvent {
|
12 | index: number;
|
13 | step: NbStepComponent;
|
14 | previouslySelectedIndex: number;
|
15 | previouslySelectedStep: NbStepComponent;
|
16 | }
|
17 | /**
|
18 | * Stepper component
|
19 | *
|
20 | * @stacked-example(Showcase, stepper/stepper-showcase.component)
|
21 | *
|
22 | * ### Installation
|
23 | *
|
24 | * Import `NbStepperModule` to your feature module.
|
25 | * ```ts
|
26 | * @NgModule({
|
27 | * imports: [
|
28 | * // ...
|
29 | * NbStepperModule,
|
30 | * ],
|
31 | * })
|
32 | * export class PageModule { }
|
33 | * ```
|
34 | * ### Usage
|
35 | *
|
36 | * If step label is string you can pass it as `label` attribute. Otherwise ng-template should be used:
|
37 | * ```html
|
38 | * // ...
|
39 | * <nb-stepper orientation="horizontal">
|
40 | * <nb-step label="step number one">
|
41 | * // ... step content here
|
42 | * </nb-step>
|
43 | * <nb-step label="stepLabel">
|
44 | * <ng-template #stepLabel>
|
45 | * <div>
|
46 | * step number two
|
47 | * </div>
|
48 | * </ng-template>
|
49 | * // ... step content here
|
50 | * </nb-step>
|
51 | * </nb-stepper>
|
52 | * ```
|
53 | *
|
54 | * When linear mode enabled user can't move forward unless current step is complete.
|
55 | * @stacked-example(Linear, stepper/stepper-linear.component)
|
56 | *
|
57 | * Specify `[stepControl]="form"` and stepper allow go to the next step only if form is valid.
|
58 | * You can disable it via `linear` mode setting.
|
59 | * ```html
|
60 | * // ...
|
61 | * <nb-stepper orientation="horizontal">
|
62 | * <nb-step label="step number one" [stepControl]="form">
|
63 | * <form [formGroup]="form">
|
64 | * // ...
|
65 | * </form>
|
66 | * </nb-step>
|
67 | * // ...
|
68 | * </nb-stepper>
|
69 | * ```
|
70 | *
|
71 | * @stacked-example(Validation, stepper/stepper-validation.component)
|
72 | *
|
73 | * Stepper component has two layout options - `vertical` & `horizontal`
|
74 | * @stacked-example(Vertical, stepper/stepper-vertical.component)
|
75 | *
|
76 | * `disableStepNavigation` disables navigation by clicking on steps, so user can navigate only using
|
77 | * 'nbStepperPrevious' and 'nbStepperNext' buttons.
|
78 | * @stacked-example(Disabled steps navigation, stepper/stepper-disabled-step-nav.component)
|
79 | *
|
80 | * Use `stepChange` output to listening to step change event. This event emits `NbStepChangeEvent` object.
|
81 | * @stacked-example(Step change event, stepper/stepper-step-change-event.component)
|
82 | *
|
83 | * @styles
|
84 | *
|
85 | * stepper-step-text-color:
|
86 | * stepper-step-text-font-family:
|
87 | * stepper-step-text-font-size:
|
88 | * stepper-step-text-font-weight:
|
89 | * stepper-step-text-line-height:
|
90 | * stepper-step-active-text-color:
|
91 | * stepper-step-completed-text-color:
|
92 | * stepper-step-index-border-color:
|
93 | * stepper-step-index-border-style:
|
94 | * stepper-step-index-border-width:
|
95 | * stepper-step-index-border-radius:
|
96 | * stepper-step-index-width:
|
97 | * stepper-step-index-active-border-color:
|
98 | * stepper-step-index-completed-background-color:
|
99 | * stepper-step-index-completed-border-color:
|
100 | * stepper-step-index-completed-text-color:
|
101 | * stepper-connector-background-color:
|
102 | * stepper-connector-completed-background-color:
|
103 | * stepper-horizontal-connector-margin:
|
104 | * stepper-vertical-connector-margin:
|
105 | * stepper-step-content-padding:
|
106 | */
|
107 | export declare class NbStepperComponent {
|
108 | /**
|
109 | * Selected step index
|
110 | */
|
111 | get selectedIndex(): number;
|
112 | set selectedIndex(index: number);
|
113 | protected _selectedIndex: number;
|
114 | /**
|
115 | * Disables navigation by clicking on steps. False by default
|
116 | * @param {boolean} value
|
117 | */
|
118 | set disableStepNavigation(value: boolean);
|
119 | get disableStepNavigation(): boolean;
|
120 | protected _disableStepNavigation: boolean;
|
121 | static ngAcceptInputType_disableStepNavigation: NbBooleanInput;
|
122 | /**
|
123 | * Selected step component
|
124 | */
|
125 | get selected(): NbStepComponent;
|
126 | set selected(step: NbStepComponent);
|
127 | /**
|
128 | * Stepper orientation - `horizontal`|`vertical`
|
129 | */
|
130 | orientation: NbStepperOrientation;
|
131 | /**
|
132 | * Allow moving forward only if the current step is complete
|
133 | * @default true
|
134 | */
|
135 | set linear(value: boolean);
|
136 | get linear(): boolean;
|
137 | protected _linear: boolean;
|
138 | static ngAcceptInputType_linear: NbBooleanInput;
|
139 | /**
|
140 | * Emits when step changed
|
141 | * @type {EventEmitter<NbStepChangeEvent>}
|
142 | */
|
143 | stepChange: EventEmitter<NbStepChangeEvent>;
|
144 | get vertical(): boolean;
|
145 | get horizontal(): boolean;
|
146 | steps: QueryList<NbStepComponent>;
|
147 | /**
|
148 | * Navigate to next step
|
149 | * */
|
150 | next(): void;
|
151 | /**
|
152 | * Navigate to previous step
|
153 | * */
|
154 | previous(): void;
|
155 | /**
|
156 | * Select step if navigation is not disabled
|
157 | * @param { NbStepComponent } step
|
158 | */
|
159 | changeStep(step: NbStepComponent): void;
|
160 | /**
|
161 | * Reset stepper and stepControls to initial state
|
162 | * */
|
163 | reset(): void;
|
164 | isStepSelected(step: NbStepComponent): boolean;
|
165 | getStepTemplate(step: NbStepComponent): TemplateRef<any> | null;
|
166 | protected isStepValid(index: number): boolean;
|
167 | protected canBeSelected(indexToCheck: number): boolean;
|
168 | protected markCurrentStepInteracted(): void;
|
169 | static ɵfac: i0.ɵɵFactoryDeclaration<NbStepperComponent, never>;
|
170 | static ɵcmp: i0.ɵɵComponentDeclaration<NbStepperComponent, "nb-stepper", never, { "selectedIndex": { "alias": "selectedIndex"; "required": false; }; "disableStepNavigation": { "alias": "disableStepNavigation"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "orientation": { "alias": "orientation"; "required": false; }; "linear": { "alias": "linear"; "required": false; }; }, { "stepChange": "stepChange"; }, ["steps"], ["nb-step"], false, never>;
|
171 | }
|