windows-plus-utilities 0.0.84 → 0.0.86
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.
- package/esm2022/modal-wizard/components/step/step.component.mjs +9 -9
- package/esm2022/modal-wizard/util/helper/wizard-builder.service.mjs +15 -1
- package/esm2022/modal-wizard/util/interface/step-definition.interface.mjs +1 -1
- package/esm2022/modal-wizard/util/interface/wizard-state.interface.mjs +1 -1
- package/esm2022/modal-wizard/util/service/wizard-step.service.mjs +115 -4
- package/fesm2022/windows-plus-utilities-modal-wizard.mjs +240 -115
- package/fesm2022/windows-plus-utilities-modal-wizard.mjs.map +1 -1
- package/modal-wizard/components/step/step.component.d.ts +6 -6
- package/modal-wizard/util/helper/wizard-builder.service.d.ts +14 -0
- package/modal-wizard/util/interface/step-definition.interface.d.ts +6 -1
- package/modal-wizard/util/interface/wizard-state.interface.d.ts +4 -0
- package/modal-wizard/util/service/wizard-step.service.d.ts +103 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "../../util/service/step.service";
|
|
4
|
+
import * as i1 from "../../util/service/wizard-step.service";
|
|
5
5
|
import * as i2 from "@angular/common";
|
|
6
6
|
export class StepComponent {
|
|
7
7
|
/**
|
|
@@ -17,8 +17,8 @@ export class StepComponent {
|
|
|
17
17
|
* @description the method to be run when the component is rendered
|
|
18
18
|
*/
|
|
19
19
|
ngOnInit() {
|
|
20
|
-
this.steps = this.stepService.
|
|
21
|
-
this.
|
|
20
|
+
this.steps = this.stepService.getSteps$();
|
|
21
|
+
this.currentIndex = this.stepService.getCurrentIndex$();
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* @author Alex Hodson
|
|
@@ -26,13 +26,13 @@ export class StepComponent {
|
|
|
26
26
|
* @param step the step clicked
|
|
27
27
|
*/
|
|
28
28
|
onStepClick(step) {
|
|
29
|
-
this.stepService.setCurrentStep(step);
|
|
29
|
+
// this.stepService.setCurrentStep(step);
|
|
30
30
|
}
|
|
31
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: StepComponent, deps: [{ token: i1.
|
|
32
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.8", type: StepComponent, isStandalone: true, selector: "step", ngImport: i0, template: "<div class=\"form-steps-container\">\r\n\t<ng-container *ngFor=\"let step of steps | async; let i = index;\">\r\n\t\t<div class=\"d-flex flex-column align-items-center\">\r\n\t\t\t<div \r\n\t\t\t\t(click)=\"onStepClick(step)\"\r\n\t\t\t\t[ngClass]=\"{ 'step-complete': step.isComplete, 'step-incomplete': !step.isComplete, 'step-current': (
|
|
31
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: StepComponent, deps: [{ token: i1.WizardStepService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
32
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.8", type: StepComponent, isStandalone: true, selector: "step", ngImport: i0, template: "<div class=\"form-steps-container\">\r\n\t<ng-container *ngFor=\"let step of steps | async; let i = index;\">\r\n\t\t<div class=\"d-flex flex-column align-items-center\">\r\n\t\t\t<div \r\n\t\t\t\t(click)=\"onStepClick(step)\"\r\n\t\t\t\t[ngClass]=\"{ 'step-complete': step.isComplete, 'step-incomplete': !step.isComplete, 'step-current': (currentIndex | async)?.stepIndex === step.stepIndex }\"\r\n\t\t\t\tclass=\"step-bubble cursor-pointer\"\r\n\t\t\t>{{ step.stepIndex }}</div>\r\n\t\t\t<div>\r\n\t\t\t\t<span class=\"text-grey\">{{step.title}}</span>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div *ngIf=\"i < (steps | async)?.length - 1\" class=\"step-divider\"></div>\r\n\t</ng-container>\r\n</div>", styles: [".form-steps-container{display:flex;justify-content:space-between;align-items:center;padding:0 32px;margin-bottom:32px}.step-bubble{padding:20px;border:3px solid var(--wp-primaryBlue);width:12px;height:12px;display:flex;justify-content:center;align-items:center;border-radius:50%;color:var(--wp-primaryBlue);font-size:1em;cursor:pointer;-webkit-user-select:none;user-select:none}.step-divider{height:2px;background:var(--wp-primaryBlue);flex:1;margin:0 10px}.step-current,.step-complete{background:var(--wp-primaryBlue);color:#fff}.step-incomplete{cursor:not-allowed;pointer-events:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] }); }
|
|
33
33
|
}
|
|
34
34
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: StepComponent, decorators: [{
|
|
35
35
|
type: Component,
|
|
36
|
-
args: [{ selector: 'step', standalone: true, imports: [CommonModule], template: "<div class=\"form-steps-container\">\r\n\t<ng-container *ngFor=\"let step of steps | async; let i = index;\">\r\n\t\t<div class=\"d-flex flex-column align-items-center\">\r\n\t\t\t<div \r\n\t\t\t\t(click)=\"onStepClick(step)\"\r\n\t\t\t\t[ngClass]=\"{ 'step-complete': step.isComplete, 'step-incomplete': !step.isComplete, 'step-current': (
|
|
37
|
-
}], ctorParameters: () => [{ type: i1.
|
|
38
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
36
|
+
args: [{ selector: 'step', standalone: true, imports: [CommonModule], template: "<div class=\"form-steps-container\">\r\n\t<ng-container *ngFor=\"let step of steps | async; let i = index;\">\r\n\t\t<div class=\"d-flex flex-column align-items-center\">\r\n\t\t\t<div \r\n\t\t\t\t(click)=\"onStepClick(step)\"\r\n\t\t\t\t[ngClass]=\"{ 'step-complete': step.isComplete, 'step-incomplete': !step.isComplete, 'step-current': (currentIndex | async)?.stepIndex === step.stepIndex }\"\r\n\t\t\t\tclass=\"step-bubble cursor-pointer\"\r\n\t\t\t>{{ step.stepIndex }}</div>\r\n\t\t\t<div>\r\n\t\t\t\t<span class=\"text-grey\">{{step.title}}</span>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div *ngIf=\"i < (steps | async)?.length - 1\" class=\"step-divider\"></div>\r\n\t</ng-container>\r\n</div>", styles: [".form-steps-container{display:flex;justify-content:space-between;align-items:center;padding:0 32px;margin-bottom:32px}.step-bubble{padding:20px;border:3px solid var(--wp-primaryBlue);width:12px;height:12px;display:flex;justify-content:center;align-items:center;border-radius:50%;color:var(--wp-primaryBlue);font-size:1em;cursor:pointer;-webkit-user-select:none;user-select:none}.step-divider{height:2px;background:var(--wp-primaryBlue);flex:1;margin:0 10px}.step-current,.step-complete{background:var(--wp-primaryBlue);color:#fff}.step-incomplete{cursor:not-allowed;pointer-events:none}\n"] }]
|
|
37
|
+
}], ctorParameters: () => [{ type: i1.WizardStepService }] });
|
|
38
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RlcC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy93aW5kb3dzLXBsdXMtdXRpbGl0aWVzL21vZGFsLXdpemFyZC9jb21wb25lbnRzL3N0ZXAvc3RlcC5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy93aW5kb3dzLXBsdXMtdXRpbGl0aWVzL21vZGFsLXdpemFyZC9jb21wb25lbnRzL3N0ZXAvc3RlcC5jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI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hc3RlcC5pc0NvbXBsZXRlLCAnc3RlcC1jdXJyZW50JzogKGN1cnJlbnRJbmRleCB8IGFzeW5jKT8uc3RlcEluZGV4ID09PSBzdGVwLnN0ZXBJbmRleCB9XCJcclxuXHRcdFx0XHRjbGFzcz1cInN0ZXAtYnViYmxlIGN1cnNvci1wb2ludGVyXCJcclxuXHRcdFx0Pnt7IHN0ZXAuc3RlcEluZGV4IH19PC9kaXY+XHJcblx0XHRcdDxkaXY+XHJcblx0XHRcdFx0PHNwYW4gY2xhc3M9XCJ0ZXh0LWdyZXlcIj57e3N0ZXAudGl0bGV9fTwvc3Bhbj5cclxuXHRcdFx0PC9kaXY+XHJcblx0XHQ8L2Rpdj5cclxuXHRcdDxkaXYgKm5nSWY9XCJpIDwgKHN0ZXBzIHwgYXN5bmMpPy5sZW5ndGggLSAxXCIgY2xhc3M9XCJzdGVwLWRpdmlkZXJcIj48L2Rpdj5cclxuXHQ8L25nLWNvbnRhaW5lcj5cclxuPC9kaXY+Il19
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
export class WizardBuilder {
|
|
2
2
|
constructor() {
|
|
3
|
+
/**
|
|
4
|
+
* @description an array containing the configuration for the wizard's steps
|
|
5
|
+
*/
|
|
3
6
|
this.steps = [];
|
|
4
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* @author Alex Hodson
|
|
10
|
+
* @description adds the specified step to the step array
|
|
11
|
+
* @param step the step to be added
|
|
12
|
+
* @returns {WizardBuilder<T>} the wizard builder instance
|
|
13
|
+
*/
|
|
5
14
|
addStep(step) {
|
|
6
15
|
this.steps.push(step);
|
|
7
16
|
return this;
|
|
8
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* @author Alex Hodson
|
|
20
|
+
* @description builds the wizard steps to be used
|
|
21
|
+
* @returns {StepDefinition<T>[]} an immutable copy of the steps
|
|
22
|
+
*/
|
|
9
23
|
build() {
|
|
10
24
|
return [...this.steps]; // Immutable copy
|
|
11
25
|
}
|
|
12
26
|
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0ZXBEZWZpbml0aW9uPFQ+W10gPSBbXVxyXG5cdC8qKlxyXG5cdCAqIEBhdXRob3IgQWxleCBIb2Rzb25cclxuXHQgKiBAZGVzY3JpcHRpb24gYWRkcyB0aGUgc3BlY2lmaWVkIHN0ZXAgdG8gdGhlIHN0ZXAgYXJyYXlcclxuXHQgKiBAcGFyYW0gc3RlcCB0aGUgc3RlcCB0byBiZSBhZGRlZFxyXG5cdCAqIEByZXR1cm5zIHtXaXphcmRCdWlsZGVyPFQ+fSB0aGUgd2l6YXJkIGJ1aWxkZXIgaW5zdGFuY2VcclxuXHQgKi9cclxuXHRhZGRTdGVwKHN0ZXA6IFN0ZXBEZWZpbml0aW9uPFQ+KTogV2l6YXJkQnVpbGRlcjxUPiB7XHJcblx0XHR0aGlzLnN0ZXBzLnB1c2goc3RlcClcclxuXHJcblx0XHRyZXR1cm4gdGhpc1xyXG5cdH1cclxuXHQvKipcclxuXHQgKiBAYXV0aG9yIEFsZXggSG9kc29uXHJcblx0ICogQGRlc2NyaXB0aW9uIGJ1aWxkcyB0aGUgd2l6YXJkIHN0ZXBzIHRvIGJlIHVzZWRcclxuXHQgKiBAcmV0dXJucyB7U3RlcERlZmluaXRpb248VD5bXX0gYW4gaW1tdXRhYmxlIGNvcHkgb2YgdGhlIHN0ZXBzXHJcblx0ICovXHJcblx0YnVpbGQoKTogU3RlcERlZmluaXRpb248VD5bXSB7XHJcblx0XHRyZXR1cm4gWy4uLnRoaXMuc3RlcHNdIC8vIEltbXV0YWJsZSBjb3B5XHJcblx0fVxyXG59Il19
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RlcC1kZWZpbml0aW9uLmludGVyZmFjZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL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AnLi9zdGVwLWRlZmluaXRpb24uaW50ZXJmYWNlJ1xyXG4vKipcclxuICogQGF1dGhvciBBbGV4IEhvZHNvblxyXG4gKiBAZGVzY3JpcHRpb24gYW4gaW50ZXJmYWNlIGRlZmluaW5nIHRoZSBwcm9wZXJ0aWVzIGZvciB0aGUgd2l6YXJkIG1vZGFsJ3Mgc3RhdGVcclxuICovXHJcbmV4cG9ydCBpbnRlcmZhY2UgV2l6YXJkU3RhdGU8VD4ge1xyXG5cdHN0ZXBzOiBTdGVwRGVmaW5pdGlvbjxUPltdXHJcblx0Y3VycmVudEluZGV4OiBudW1iZXJcclxufSJdfQ==
|
|
@@ -2,32 +2,107 @@ import { Injectable } from '@angular/core';
|
|
|
2
2
|
import { BehaviorSubject, map } from 'rxjs';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
import * as i1 from "@angular/router";
|
|
5
|
+
/**
|
|
6
|
+
* A finite state machine service used to manage wizard-style step navigation.
|
|
7
|
+
*
|
|
8
|
+
* This service maintains an immutable list of {@link StepDefinition} objects and
|
|
9
|
+
* tracks the current active step index internally. It exposes reactive streams
|
|
10
|
+
* for step data and navigation state, and coordinates router navigation when
|
|
11
|
+
* transitions occur.
|
|
12
|
+
*
|
|
13
|
+
* The service is intentionally component-scoped and must be provided at the
|
|
14
|
+
* component level. Each wizard instance should create and initialize its own
|
|
15
|
+
* service instance.
|
|
16
|
+
*
|
|
17
|
+
* @typeParam T - The type used for step parameter definitions.
|
|
18
|
+
*/
|
|
5
19
|
export class WizardStepService {
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new WizardStepService instance.
|
|
22
|
+
*
|
|
23
|
+
* @param router - Angular Router used to update the URL when step changes occur.
|
|
24
|
+
* @param activatedRoute - The current route used as the relative base for navigation.
|
|
25
|
+
*/
|
|
6
26
|
constructor(router, activatedRoute) {
|
|
7
27
|
this.router = router;
|
|
8
28
|
this.activatedRoute = activatedRoute;
|
|
29
|
+
/**
|
|
30
|
+
* Internal state container for the wizard.
|
|
31
|
+
*
|
|
32
|
+
* Holds the ordered step definitions and the currently active index.
|
|
33
|
+
* A `null` value indicates the wizard has not yet been initialized.
|
|
34
|
+
*/
|
|
9
35
|
this.state$ = new BehaviorSubject(null);
|
|
36
|
+
/**
|
|
37
|
+
* Emits whether forward navigation is currently allowed.
|
|
38
|
+
*
|
|
39
|
+
* This can be controlled externally (e.g., form validity).
|
|
40
|
+
*/
|
|
41
|
+
this.stepForwardAvailability$ = new BehaviorSubject(false);
|
|
10
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Initializes the wizard with an ordered list of step definitions.
|
|
45
|
+
*
|
|
46
|
+
* This method must be called before navigation methods are used.
|
|
47
|
+
* It resets the wizard state and navigates to the first step.
|
|
48
|
+
*
|
|
49
|
+
* @param steps - The ordered collection of step definitions.
|
|
50
|
+
*/
|
|
11
51
|
initialize(steps) {
|
|
12
52
|
this.state$.next({
|
|
13
|
-
steps: [...steps],
|
|
53
|
+
steps: [...steps], // defensive copy
|
|
14
54
|
currentIndex: 0
|
|
15
55
|
});
|
|
16
56
|
this.navigate();
|
|
17
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Returns the currently active step synchronously.
|
|
60
|
+
*
|
|
61
|
+
* @returns The active {@link StepDefinition}, or `null` if not initialized.
|
|
62
|
+
*/
|
|
18
63
|
getCurrentStep() {
|
|
19
64
|
return this.state$.value?.steps[this.state$.value.currentIndex] ?? null;
|
|
20
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Emits the currently active step whenever the wizard state changes.
|
|
68
|
+
*
|
|
69
|
+
* @returns Observable stream of the active step or `null` if uninitialized.
|
|
70
|
+
*/
|
|
21
71
|
getCurrentStep$() {
|
|
22
72
|
return this.state$.pipe(map(state => state ? state.steps[state.currentIndex] : null));
|
|
23
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Emits the full ordered list of wizard steps.
|
|
76
|
+
*
|
|
77
|
+
* @returns Observable stream of step definitions.
|
|
78
|
+
*/
|
|
79
|
+
getSteps$() {
|
|
80
|
+
return this.state$.pipe(map(state => state?.steps ?? []));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Emits the current active step index.
|
|
84
|
+
*
|
|
85
|
+
* @returns Observable stream of the current index (0-based).
|
|
86
|
+
*/
|
|
87
|
+
getCurrentIndex$() {
|
|
88
|
+
return this.state$.pipe(map(state => state?.currentIndex ?? 0));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Attempts to transition to the next step.
|
|
92
|
+
*
|
|
93
|
+
* If the current step defines an `onExit` guard, it will be executed before
|
|
94
|
+
* transitioning. If the guard returns `false` (or resolves to `false`),
|
|
95
|
+
* the transition is cancelled.
|
|
96
|
+
*
|
|
97
|
+
* @param context - Optional contextual data passed to the `onExit` guard.
|
|
98
|
+
*/
|
|
24
99
|
async next(context) {
|
|
25
100
|
const state = this.state$.value;
|
|
26
101
|
if (!state)
|
|
27
102
|
return;
|
|
28
103
|
const current = state.steps[state.currentIndex];
|
|
29
|
-
if (current.
|
|
30
|
-
const allowed = await current.
|
|
104
|
+
if (current.onExit) {
|
|
105
|
+
const allowed = await current.onExit(context);
|
|
31
106
|
if (!allowed)
|
|
32
107
|
return;
|
|
33
108
|
}
|
|
@@ -39,6 +114,11 @@ export class WizardStepService {
|
|
|
39
114
|
this.navigate();
|
|
40
115
|
}
|
|
41
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Moves the wizard to the previous step if possible.
|
|
119
|
+
*
|
|
120
|
+
* No guards are executed during backward navigation.
|
|
121
|
+
*/
|
|
42
122
|
previous() {
|
|
43
123
|
const state = this.state$.value;
|
|
44
124
|
if (!state)
|
|
@@ -51,12 +131,43 @@ export class WizardStepService {
|
|
|
51
131
|
this.navigate();
|
|
52
132
|
}
|
|
53
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Determines whether the current step is the final step.
|
|
136
|
+
*
|
|
137
|
+
* @returns `true` if on the last step; otherwise `false`.
|
|
138
|
+
*/
|
|
54
139
|
isLast() {
|
|
55
140
|
const state = this.state$.value;
|
|
56
141
|
if (!state)
|
|
57
142
|
return false;
|
|
58
143
|
return state.currentIndex === state.steps.length - 1;
|
|
59
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Sets whether forward navigation is currently permitted.
|
|
147
|
+
*
|
|
148
|
+
* This is typically controlled by external validation logic (e.g., form state).
|
|
149
|
+
*
|
|
150
|
+
* @param available - `true` if forward navigation should be allowed.
|
|
151
|
+
*/
|
|
152
|
+
setStepForwardAvailability(available) {
|
|
153
|
+
this.stepForwardAvailability$.next(available);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Emits the forward navigation availability state.
|
|
157
|
+
*
|
|
158
|
+
* @returns Observable stream of the forward navigation flag.
|
|
159
|
+
*/
|
|
160
|
+
getStepForwardAvailability() {
|
|
161
|
+
return this.stepForwardAvailability$.asObservable();
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Navigates the router to the currently active step.
|
|
165
|
+
*
|
|
166
|
+
* This method updates the URL relative to the injected route
|
|
167
|
+
* using the pattern: `step-{slug}`.
|
|
168
|
+
*
|
|
169
|
+
* @internal
|
|
170
|
+
*/
|
|
60
171
|
navigate() {
|
|
61
172
|
const step = this.getCurrentStep();
|
|
62
173
|
if (!step)
|
|
@@ -69,4 +180,4 @@ export class WizardStepService {
|
|
|
69
180
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: WizardStepService, decorators: [{
|
|
70
181
|
type: Injectable
|
|
71
182
|
}], ctorParameters: () => [{ type: i1.Router }, { type: i1.ActivatedRoute }] });
|
|
72
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2l6YXJkLXN0ZXAuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3dpbmRvd3MtcGx1c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YHN0ZXAte3NsdWd9YC5cclxuXHQgKlxyXG5cdCAqIEBpbnRlcm5hbFxyXG5cdCAqL1xyXG5cdHByaXZhdGUgbmF2aWdhdGUoKTogdm9pZCB7XHJcblx0XHRjb25zdCBzdGVwID0gdGhpcy5nZXRDdXJyZW50U3RlcCgpXHJcblx0XHRpZiAoIXN0ZXApIHJldHVyblxyXG5cclxuXHRcdHRoaXMucm91dGVyLm5hdmlnYXRlKFxyXG5cdFx0XHRbYHN0ZXAtJHtzdGVwLnNsdWd9YF0sXHJcblx0XHRcdHsgcmVsYXRpdmVUbzogdGhpcy5hY3RpdmF0ZWRSb3V0ZSB9XHJcblx0XHQpXHJcblx0fVxyXG59XHJcblxyXG4iXX0=
|
|
@@ -1,10 +1,249 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable,
|
|
2
|
+
import { Injectable, Component, Inject } from '@angular/core';
|
|
3
3
|
import * as i2 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import { BehaviorSubject, map } from 'rxjs';
|
|
6
6
|
import * as i1 from '@angular/router';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A finite state machine service used to manage wizard-style step navigation.
|
|
10
|
+
*
|
|
11
|
+
* This service maintains an immutable list of {@link StepDefinition} objects and
|
|
12
|
+
* tracks the current active step index internally. It exposes reactive streams
|
|
13
|
+
* for step data and navigation state, and coordinates router navigation when
|
|
14
|
+
* transitions occur.
|
|
15
|
+
*
|
|
16
|
+
* The service is intentionally component-scoped and must be provided at the
|
|
17
|
+
* component level. Each wizard instance should create and initialize its own
|
|
18
|
+
* service instance.
|
|
19
|
+
*
|
|
20
|
+
* @typeParam T - The type used for step parameter definitions.
|
|
21
|
+
*/
|
|
22
|
+
class WizardStepService {
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new WizardStepService instance.
|
|
25
|
+
*
|
|
26
|
+
* @param router - Angular Router used to update the URL when step changes occur.
|
|
27
|
+
* @param activatedRoute - The current route used as the relative base for navigation.
|
|
28
|
+
*/
|
|
29
|
+
constructor(router, activatedRoute) {
|
|
30
|
+
this.router = router;
|
|
31
|
+
this.activatedRoute = activatedRoute;
|
|
32
|
+
/**
|
|
33
|
+
* Internal state container for the wizard.
|
|
34
|
+
*
|
|
35
|
+
* Holds the ordered step definitions and the currently active index.
|
|
36
|
+
* A `null` value indicates the wizard has not yet been initialized.
|
|
37
|
+
*/
|
|
38
|
+
this.state$ = new BehaviorSubject(null);
|
|
39
|
+
/**
|
|
40
|
+
* Emits whether forward navigation is currently allowed.
|
|
41
|
+
*
|
|
42
|
+
* This can be controlled externally (e.g., form validity).
|
|
43
|
+
*/
|
|
44
|
+
this.stepForwardAvailability$ = new BehaviorSubject(false);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Initializes the wizard with an ordered list of step definitions.
|
|
48
|
+
*
|
|
49
|
+
* This method must be called before navigation methods are used.
|
|
50
|
+
* It resets the wizard state and navigates to the first step.
|
|
51
|
+
*
|
|
52
|
+
* @param steps - The ordered collection of step definitions.
|
|
53
|
+
*/
|
|
54
|
+
initialize(steps) {
|
|
55
|
+
this.state$.next({
|
|
56
|
+
steps: [...steps], // defensive copy
|
|
57
|
+
currentIndex: 0
|
|
58
|
+
});
|
|
59
|
+
this.navigate();
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Returns the currently active step synchronously.
|
|
63
|
+
*
|
|
64
|
+
* @returns The active {@link StepDefinition}, or `null` if not initialized.
|
|
65
|
+
*/
|
|
66
|
+
getCurrentStep() {
|
|
67
|
+
return this.state$.value?.steps[this.state$.value.currentIndex] ?? null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Emits the currently active step whenever the wizard state changes.
|
|
71
|
+
*
|
|
72
|
+
* @returns Observable stream of the active step or `null` if uninitialized.
|
|
73
|
+
*/
|
|
74
|
+
getCurrentStep$() {
|
|
75
|
+
return this.state$.pipe(map(state => state ? state.steps[state.currentIndex] : null));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Emits the full ordered list of wizard steps.
|
|
79
|
+
*
|
|
80
|
+
* @returns Observable stream of step definitions.
|
|
81
|
+
*/
|
|
82
|
+
getSteps$() {
|
|
83
|
+
return this.state$.pipe(map(state => state?.steps ?? []));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Emits the current active step index.
|
|
87
|
+
*
|
|
88
|
+
* @returns Observable stream of the current index (0-based).
|
|
89
|
+
*/
|
|
90
|
+
getCurrentIndex$() {
|
|
91
|
+
return this.state$.pipe(map(state => state?.currentIndex ?? 0));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Attempts to transition to the next step.
|
|
95
|
+
*
|
|
96
|
+
* If the current step defines an `onExit` guard, it will be executed before
|
|
97
|
+
* transitioning. If the guard returns `false` (or resolves to `false`),
|
|
98
|
+
* the transition is cancelled.
|
|
99
|
+
*
|
|
100
|
+
* @param context - Optional contextual data passed to the `onExit` guard.
|
|
101
|
+
*/
|
|
102
|
+
async next(context) {
|
|
103
|
+
const state = this.state$.value;
|
|
104
|
+
if (!state)
|
|
105
|
+
return;
|
|
106
|
+
const current = state.steps[state.currentIndex];
|
|
107
|
+
if (current.onExit) {
|
|
108
|
+
const allowed = await current.onExit(context);
|
|
109
|
+
if (!allowed)
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (state.currentIndex < state.steps.length - 1) {
|
|
113
|
+
this.state$.next({
|
|
114
|
+
...state,
|
|
115
|
+
currentIndex: state.currentIndex + 1
|
|
116
|
+
});
|
|
117
|
+
this.navigate();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Moves the wizard to the previous step if possible.
|
|
122
|
+
*
|
|
123
|
+
* No guards are executed during backward navigation.
|
|
124
|
+
*/
|
|
125
|
+
previous() {
|
|
126
|
+
const state = this.state$.value;
|
|
127
|
+
if (!state)
|
|
128
|
+
return;
|
|
129
|
+
if (state.currentIndex > 0) {
|
|
130
|
+
this.state$.next({
|
|
131
|
+
...state,
|
|
132
|
+
currentIndex: state.currentIndex - 1
|
|
133
|
+
});
|
|
134
|
+
this.navigate();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Determines whether the current step is the final step.
|
|
139
|
+
*
|
|
140
|
+
* @returns `true` if on the last step; otherwise `false`.
|
|
141
|
+
*/
|
|
142
|
+
isLast() {
|
|
143
|
+
const state = this.state$.value;
|
|
144
|
+
if (!state)
|
|
145
|
+
return false;
|
|
146
|
+
return state.currentIndex === state.steps.length - 1;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Sets whether forward navigation is currently permitted.
|
|
150
|
+
*
|
|
151
|
+
* This is typically controlled by external validation logic (e.g., form state).
|
|
152
|
+
*
|
|
153
|
+
* @param available - `true` if forward navigation should be allowed.
|
|
154
|
+
*/
|
|
155
|
+
setStepForwardAvailability(available) {
|
|
156
|
+
this.stepForwardAvailability$.next(available);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Emits the forward navigation availability state.
|
|
160
|
+
*
|
|
161
|
+
* @returns Observable stream of the forward navigation flag.
|
|
162
|
+
*/
|
|
163
|
+
getStepForwardAvailability() {
|
|
164
|
+
return this.stepForwardAvailability$.asObservable();
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Navigates the router to the currently active step.
|
|
168
|
+
*
|
|
169
|
+
* This method updates the URL relative to the injected route
|
|
170
|
+
* using the pattern: `step-{slug}`.
|
|
171
|
+
*
|
|
172
|
+
* @internal
|
|
173
|
+
*/
|
|
174
|
+
navigate() {
|
|
175
|
+
const step = this.getCurrentStep();
|
|
176
|
+
if (!step)
|
|
177
|
+
return;
|
|
178
|
+
this.router.navigate([`step-${step.slug}`], { relativeTo: this.activatedRoute });
|
|
179
|
+
}
|
|
180
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: WizardStepService, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
181
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: WizardStepService }); }
|
|
182
|
+
}
|
|
183
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: WizardStepService, decorators: [{
|
|
184
|
+
type: Injectable
|
|
185
|
+
}], ctorParameters: () => [{ type: i1.Router }, { type: i1.ActivatedRoute }] });
|
|
186
|
+
|
|
187
|
+
class StepComponent {
|
|
188
|
+
/**
|
|
189
|
+
* @author Alex Hodson
|
|
190
|
+
* @description class constructor specifying the required services and properties
|
|
191
|
+
* @param stepService the service class which contains access to the modal steps functionality
|
|
192
|
+
*/
|
|
193
|
+
constructor(stepService) {
|
|
194
|
+
this.stepService = stepService;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* @author Alex Hodson
|
|
198
|
+
* @description the method to be run when the component is rendered
|
|
199
|
+
*/
|
|
200
|
+
ngOnInit() {
|
|
201
|
+
this.steps = this.stepService.getSteps$();
|
|
202
|
+
this.currentIndex = this.stepService.getCurrentIndex$();
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* @author Alex Hodson
|
|
206
|
+
* @description handles the user clicking a step
|
|
207
|
+
* @param step the step clicked
|
|
208
|
+
*/
|
|
209
|
+
onStepClick(step) {
|
|
210
|
+
// this.stepService.setCurrentStep(step);
|
|
211
|
+
}
|
|
212
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: StepComponent, deps: [{ token: WizardStepService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
213
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.8", type: StepComponent, isStandalone: true, selector: "step", ngImport: i0, template: "<div class=\"form-steps-container\">\r\n\t<ng-container *ngFor=\"let step of steps | async; let i = index;\">\r\n\t\t<div class=\"d-flex flex-column align-items-center\">\r\n\t\t\t<div \r\n\t\t\t\t(click)=\"onStepClick(step)\"\r\n\t\t\t\t[ngClass]=\"{ 'step-complete': step.isComplete, 'step-incomplete': !step.isComplete, 'step-current': (currentIndex | async)?.stepIndex === step.stepIndex }\"\r\n\t\t\t\tclass=\"step-bubble cursor-pointer\"\r\n\t\t\t>{{ step.stepIndex }}</div>\r\n\t\t\t<div>\r\n\t\t\t\t<span class=\"text-grey\">{{step.title}}</span>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div *ngIf=\"i < (steps | async)?.length - 1\" class=\"step-divider\"></div>\r\n\t</ng-container>\r\n</div>", styles: [".form-steps-container{display:flex;justify-content:space-between;align-items:center;padding:0 32px;margin-bottom:32px}.step-bubble{padding:20px;border:3px solid var(--wp-primaryBlue);width:12px;height:12px;display:flex;justify-content:center;align-items:center;border-radius:50%;color:var(--wp-primaryBlue);font-size:1em;cursor:pointer;-webkit-user-select:none;user-select:none}.step-divider{height:2px;background:var(--wp-primaryBlue);flex:1;margin:0 10px}.step-current,.step-complete{background:var(--wp-primaryBlue);color:#fff}.step-incomplete{cursor:not-allowed;pointer-events:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] }); }
|
|
214
|
+
}
|
|
215
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: StepComponent, decorators: [{
|
|
216
|
+
type: Component,
|
|
217
|
+
args: [{ selector: 'step', standalone: true, imports: [CommonModule], template: "<div class=\"form-steps-container\">\r\n\t<ng-container *ngFor=\"let step of steps | async; let i = index;\">\r\n\t\t<div class=\"d-flex flex-column align-items-center\">\r\n\t\t\t<div \r\n\t\t\t\t(click)=\"onStepClick(step)\"\r\n\t\t\t\t[ngClass]=\"{ 'step-complete': step.isComplete, 'step-incomplete': !step.isComplete, 'step-current': (currentIndex | async)?.stepIndex === step.stepIndex }\"\r\n\t\t\t\tclass=\"step-bubble cursor-pointer\"\r\n\t\t\t>{{ step.stepIndex }}</div>\r\n\t\t\t<div>\r\n\t\t\t\t<span class=\"text-grey\">{{step.title}}</span>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div *ngIf=\"i < (steps | async)?.length - 1\" class=\"step-divider\"></div>\r\n\t</ng-container>\r\n</div>", styles: [".form-steps-container{display:flex;justify-content:space-between;align-items:center;padding:0 32px;margin-bottom:32px}.step-bubble{padding:20px;border:3px solid var(--wp-primaryBlue);width:12px;height:12px;display:flex;justify-content:center;align-items:center;border-radius:50%;color:var(--wp-primaryBlue);font-size:1em;cursor:pointer;-webkit-user-select:none;user-select:none}.step-divider{height:2px;background:var(--wp-primaryBlue);flex:1;margin:0 10px}.step-current,.step-complete{background:var(--wp-primaryBlue);color:#fff}.step-incomplete{cursor:not-allowed;pointer-events:none}\n"] }]
|
|
218
|
+
}], ctorParameters: () => [{ type: WizardStepService }] });
|
|
219
|
+
|
|
220
|
+
class WizardBuilder {
|
|
221
|
+
constructor() {
|
|
222
|
+
/**
|
|
223
|
+
* @description an array containing the configuration for the wizard's steps
|
|
224
|
+
*/
|
|
225
|
+
this.steps = [];
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* @author Alex Hodson
|
|
229
|
+
* @description adds the specified step to the step array
|
|
230
|
+
* @param step the step to be added
|
|
231
|
+
* @returns {WizardBuilder<T>} the wizard builder instance
|
|
232
|
+
*/
|
|
233
|
+
addStep(step) {
|
|
234
|
+
this.steps.push(step);
|
|
235
|
+
return this;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* @author Alex Hodson
|
|
239
|
+
* @description builds the wizard steps to be used
|
|
240
|
+
* @returns {StepDefinition<T>[]} an immutable copy of the steps
|
|
241
|
+
*/
|
|
242
|
+
build() {
|
|
243
|
+
return [...this.steps]; // Immutable copy
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
8
247
|
class StepService {
|
|
9
248
|
/**
|
|
10
249
|
* @author Alex Hodson
|
|
@@ -208,120 +447,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImpor
|
|
|
208
447
|
args: ['steps']
|
|
209
448
|
}] }] });
|
|
210
449
|
|
|
211
|
-
class StepComponent {
|
|
212
|
-
/**
|
|
213
|
-
* @author Alex Hodson
|
|
214
|
-
* @description class constructor specifying the required services and properties
|
|
215
|
-
* @param stepService the service class which contains access to the modal steps functionality
|
|
216
|
-
*/
|
|
217
|
-
constructor(stepService) {
|
|
218
|
-
this.stepService = stepService;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* @author Alex Hodson
|
|
222
|
-
* @description the method to be run when the component is rendered
|
|
223
|
-
*/
|
|
224
|
-
ngOnInit() {
|
|
225
|
-
this.steps = this.stepService.getStepsObservable();
|
|
226
|
-
this.currentStep = this.stepService.getCurrentStepObservable();
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* @author Alex Hodson
|
|
230
|
-
* @description handles the user clicking a step
|
|
231
|
-
* @param step the step clicked
|
|
232
|
-
*/
|
|
233
|
-
onStepClick(step) {
|
|
234
|
-
this.stepService.setCurrentStep(step);
|
|
235
|
-
}
|
|
236
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: StepComponent, deps: [{ token: StepService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
237
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.8", type: StepComponent, isStandalone: true, selector: "step", ngImport: i0, template: "<div class=\"form-steps-container\">\r\n\t<ng-container *ngFor=\"let step of steps | async; let i = index;\">\r\n\t\t<div class=\"d-flex flex-column align-items-center\">\r\n\t\t\t<div \r\n\t\t\t\t(click)=\"onStepClick(step)\"\r\n\t\t\t\t[ngClass]=\"{ 'step-complete': step.isComplete, 'step-incomplete': !step.isComplete, 'step-current': (currentStep | async)?.stepIndex === step.stepIndex }\"\r\n\t\t\t\tclass=\"step-bubble cursor-pointer\"\r\n\t\t\t>{{ step.stepIndex }}</div>\r\n\t\t\t<div>\r\n\t\t\t\t<span class=\"text-grey\">{{step.title}}</span>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div *ngIf=\"i < (steps | async)?.length - 1\" class=\"step-divider\"></div>\r\n\t</ng-container>\r\n</div>", styles: [".form-steps-container{display:flex;justify-content:space-between;align-items:center;padding:0 32px;margin-bottom:32px}.step-bubble{padding:20px;border:3px solid var(--wp-primaryBlue);width:12px;height:12px;display:flex;justify-content:center;align-items:center;border-radius:50%;color:var(--wp-primaryBlue);font-size:1em;cursor:pointer;-webkit-user-select:none;user-select:none}.step-divider{height:2px;background:var(--wp-primaryBlue);flex:1;margin:0 10px}.step-current,.step-complete{background:var(--wp-primaryBlue);color:#fff}.step-incomplete{cursor:not-allowed;pointer-events:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] }); }
|
|
238
|
-
}
|
|
239
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: StepComponent, decorators: [{
|
|
240
|
-
type: Component,
|
|
241
|
-
args: [{ selector: 'step', standalone: true, imports: [CommonModule], template: "<div class=\"form-steps-container\">\r\n\t<ng-container *ngFor=\"let step of steps | async; let i = index;\">\r\n\t\t<div class=\"d-flex flex-column align-items-center\">\r\n\t\t\t<div \r\n\t\t\t\t(click)=\"onStepClick(step)\"\r\n\t\t\t\t[ngClass]=\"{ 'step-complete': step.isComplete, 'step-incomplete': !step.isComplete, 'step-current': (currentStep | async)?.stepIndex === step.stepIndex }\"\r\n\t\t\t\tclass=\"step-bubble cursor-pointer\"\r\n\t\t\t>{{ step.stepIndex }}</div>\r\n\t\t\t<div>\r\n\t\t\t\t<span class=\"text-grey\">{{step.title}}</span>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div *ngIf=\"i < (steps | async)?.length - 1\" class=\"step-divider\"></div>\r\n\t</ng-container>\r\n</div>", styles: [".form-steps-container{display:flex;justify-content:space-between;align-items:center;padding:0 32px;margin-bottom:32px}.step-bubble{padding:20px;border:3px solid var(--wp-primaryBlue);width:12px;height:12px;display:flex;justify-content:center;align-items:center;border-radius:50%;color:var(--wp-primaryBlue);font-size:1em;cursor:pointer;-webkit-user-select:none;user-select:none}.step-divider{height:2px;background:var(--wp-primaryBlue);flex:1;margin:0 10px}.step-current,.step-complete{background:var(--wp-primaryBlue);color:#fff}.step-incomplete{cursor:not-allowed;pointer-events:none}\n"] }]
|
|
242
|
-
}], ctorParameters: () => [{ type: StepService }] });
|
|
243
|
-
|
|
244
|
-
class WizardBuilder {
|
|
245
|
-
constructor() {
|
|
246
|
-
this.steps = [];
|
|
247
|
-
}
|
|
248
|
-
addStep(step) {
|
|
249
|
-
this.steps.push(step);
|
|
250
|
-
return this;
|
|
251
|
-
}
|
|
252
|
-
build() {
|
|
253
|
-
return [...this.steps]; // Immutable copy
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
class WizardStepService {
|
|
258
|
-
constructor(router, activatedRoute) {
|
|
259
|
-
this.router = router;
|
|
260
|
-
this.activatedRoute = activatedRoute;
|
|
261
|
-
this.state$ = new BehaviorSubject(null);
|
|
262
|
-
}
|
|
263
|
-
initialize(steps) {
|
|
264
|
-
this.state$.next({
|
|
265
|
-
steps: [...steps],
|
|
266
|
-
currentIndex: 0
|
|
267
|
-
});
|
|
268
|
-
this.navigate();
|
|
269
|
-
}
|
|
270
|
-
getCurrentStep() {
|
|
271
|
-
return this.state$.value?.steps[this.state$.value.currentIndex] ?? null;
|
|
272
|
-
}
|
|
273
|
-
getCurrentStep$() {
|
|
274
|
-
return this.state$.pipe(map(state => state ? state.steps[state.currentIndex] : null));
|
|
275
|
-
}
|
|
276
|
-
async next(context) {
|
|
277
|
-
const state = this.state$.value;
|
|
278
|
-
if (!state)
|
|
279
|
-
return;
|
|
280
|
-
const current = state.steps[state.currentIndex];
|
|
281
|
-
if (current.onEnter) {
|
|
282
|
-
const allowed = await current.onEnter(context);
|
|
283
|
-
if (!allowed)
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
if (state.currentIndex < state.steps.length - 1) {
|
|
287
|
-
this.state$.next({
|
|
288
|
-
...state,
|
|
289
|
-
currentIndex: state.currentIndex + 1
|
|
290
|
-
});
|
|
291
|
-
this.navigate();
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
previous() {
|
|
295
|
-
const state = this.state$.value;
|
|
296
|
-
if (!state)
|
|
297
|
-
return;
|
|
298
|
-
if (state.currentIndex > 0) {
|
|
299
|
-
this.state$.next({
|
|
300
|
-
...state,
|
|
301
|
-
currentIndex: state.currentIndex - 1
|
|
302
|
-
});
|
|
303
|
-
this.navigate();
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
isLast() {
|
|
307
|
-
const state = this.state$.value;
|
|
308
|
-
if (!state)
|
|
309
|
-
return false;
|
|
310
|
-
return state.currentIndex === state.steps.length - 1;
|
|
311
|
-
}
|
|
312
|
-
navigate() {
|
|
313
|
-
const step = this.getCurrentStep();
|
|
314
|
-
if (!step)
|
|
315
|
-
return;
|
|
316
|
-
this.router.navigate([`step-${step.slug}`], { relativeTo: this.activatedRoute });
|
|
317
|
-
}
|
|
318
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: WizardStepService, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
319
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: WizardStepService }); }
|
|
320
|
-
}
|
|
321
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: WizardStepService, decorators: [{
|
|
322
|
-
type: Injectable
|
|
323
|
-
}], ctorParameters: () => [{ type: i1.Router }, { type: i1.ActivatedRoute }] });
|
|
324
|
-
|
|
325
450
|
/*
|
|
326
451
|
* Public API Surface of windows-plus-utilities
|
|
327
452
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windows-plus-utilities-modal-wizard.mjs","sources":["../../../projects/windows-plus-utilities/modal-wizard/util/service/step.service.ts","../../../projects/windows-plus-utilities/modal-wizard/components/step/step.component.ts","../../../projects/windows-plus-utilities/modal-wizard/components/step/step.component.html","../../../projects/windows-plus-utilities/modal-wizard/util/helper/wizard-builder.service.ts","../../../projects/windows-plus-utilities/modal-wizard/util/service/wizard-step.service.ts","../../../projects/windows-plus-utilities/modal-wizard/public-api.ts","../../../projects/windows-plus-utilities/modal-wizard/windows-plus-utilities-modal-wizard.ts"],"sourcesContent":["import { Inject, Injectable } from '@angular/core'\r\nimport { BehaviorSubject, Observable } from 'rxjs'\r\nimport { StepModel } from '../interface/modal-step.interface'\r\nimport { ActivatedRoute, Router } from '@angular/router'\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root'\r\n})\r\nexport class StepService<T> {\r\n\t/**\r\n\t * @description the current index\r\n\t */\r\n\tprivate currentIndex = 0\r\n\t/**\r\n\t * @description the original step configuration\r\n\t */\r\n\toriginalSteps: StepModel<T>[]\r\n\t/**\r\n\t * @description the subject for the modal steps\r\n\t */\r\n\tsteps$: BehaviorSubject<StepModel<T>[]>\r\n\t/**\r\n\t * @description the subject for the current modal step\r\n\t */\r\n\tcurrentStep$: BehaviorSubject<StepModel<T> | null> = new BehaviorSubject<StepModel<T> | null>(null);\r\n\t/**\r\n\t * @description the subject for the step forward availability\r\n\t */\r\n\tstepForwardAvailability$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false)\r\n\t/**\r\n * @author Alex Hodson\r\n * @description class constructor specifying the required services and properties\r\n * @param steps the steps in the modal\r\n */\r\n\tconstructor(\r\n\t\tprivate router: Router,\r\n\t\tprivate activatedRoute: ActivatedRoute,\r\n\t\t@Inject('steps') private stepConfig: StepModel<T>[]\r\n\t) {\r\n\t\tthis.originalSteps = this.buildSteps(stepConfig)\r\n\t\tthis.steps$ = new BehaviorSubject(this.originalSteps)\r\n\t\tthis.currentStep$.next(this.originalSteps[0])\r\n\t}\r\n\tprivate buildSteps(config: Omit<StepModel<T>, 'stepIndex'>[]): StepModel<T>[] {\r\n\t\treturn config.map((step, index) => ({\r\n\t\t\t...step,\r\n\t\t\tstepIndex: index + 1\r\n\t\t}))\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description adjusts the step indexes to be sequential based on their position in the steps array\r\n\t */\r\n\tadjustStepIndexes(): void {\r\n\t\tconst rebuilt = this.steps$.value.map((step, index) => ({\r\n\t\t\t...step,\r\n\t\t\tstepIndex: index + 1\r\n\t\t}))\r\n\r\n\t\tthis.steps$.next(rebuilt)\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description inserts a new step at a specific index, specified by the step index property\r\n\t * @param step the step to be inserted\r\n\t */\r\n\tinsertStep(step: StepModel<T>): void {\r\n\t\tconst current = this.steps$.value\r\n\r\n\t\tconst updated = [\r\n\t\t\t...current.slice(0, step.stepIndex - 1),\r\n\t\t\tstep,\r\n\t\t\t...current.slice(step.stepIndex - 1)\r\n\t\t].map((s, index) => ({\r\n\t\t\t...s,\r\n\t\t\tstepIndex: index + 1\r\n\t\t}))\r\n\r\n\t\tthis.steps$.next(updated)\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description sets the current modal step\r\n\t * @param step the step to be set\r\n\t */\r\n\tsetCurrentStep(step: StepModel<T>): void {\r\n\t\tthis.currentStep$.next(step)\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description returns the current modal step observable\r\n\t * @returns the current modal step observable\r\n\t */\r\n\tgetCurrentStepObservable(): Observable<StepModel<T> | null> {\r\n\t\treturn this.currentStep$.asObservable()\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description returns the current modal step observable\r\n\t * @returns the current modal step observable\r\n\t */\r\n\tgetCurrentStep(): StepModel<T> | null {\r\n\t\treturn this.currentStep$.getValue()\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description retrieves the current steps\r\n\t * @returns the current steps\r\n\t */\r\n\tgetSteps(): StepModel<T>[] {\r\n\t\treturn this.steps$.getValue()\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description returns the modal step observable\r\n\t * @returns the modal step observable\r\n\t */\r\n\tgetStepsObservable(): Observable<StepModel<T>[]> {\r\n\t\treturn this.steps$.asObservable()\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description sets the step forward availability\r\n\t * @param available whether a step forward is available\r\n\t */\r\n\tsetStepForwardAvailability(available: boolean): void {\r\n\t\tthis.stepForwardAvailability$.next(available)\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description returns the step forward availability observable\r\n\t * @returns the step forward availability observable\r\n\t */\r\n\tgetStepForwardAvailability(): Observable<boolean> {\r\n\t\treturn this.stepForwardAvailability$.asObservable()\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description moves to the next modal step\r\n\t */\r\n\tmoveToNextStep(): void {\r\n\t\tif (this.currentIndex < this.steps$.value.length - 1) {\r\n\t\t\tthis.currentIndex++\r\n\t\t\tthis.currentStep$.next(this.steps$.value[this.currentIndex])\r\n\t\t}\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description moves to the previous modal step\r\n\t */\r\n\tmoveToPreviousStep(): void {\r\n\t\tconst previous = this.steps$.getValue()[this.currentIndex - 1]\r\n\r\n\t\tif (!previous) return\r\n\r\n\t\tthis.currentStep$.next({\r\n\t\t\t...previous,\r\n\t\t\t'triggerCallback': false\r\n\t\t})\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description determines whether the current step is the last\r\n\t * @returns whether the step is the last one\r\n\t */\r\n\tisLastStep(): boolean {\r\n\t\treturn this.currentIndex === this.steps$.value.length\r\n\t}\r\n\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description triggers any potential \"after-step\" functionality for the current step and changes the current route with any required parameters\r\n\t * @param getParameterValue the callback which retrieves the value for a step parameter\r\n\t * @param triggerStepCallback the callback which triggers the specific functionality for the specified step index\r\n\t */\r\n\tasync handleStepChange(getParameterValue?: (...args: any) => any, triggerStepCallback?: (...args: any) => Promise<boolean>, revert: boolean = false): Promise<void | null> {\r\n\t\tconst currentStep = this.currentStep$.value\r\n\r\n\t\tif (!currentStep) return\r\n\r\n\t\tconst { stepIndex, triggerCallback } = currentStep\r\n\r\n\t\tif (triggerCallback && triggerStepCallback) {\r\n\t\t\tconst results = await triggerStepCallback(stepIndex)\r\n\r\n\t\t\tif (!results && revert) return this.moveToPreviousStep()\r\n\t\t}\r\n\r\n\t\tthis.handleNavigation(getParameterValue, currentStep)\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description handles the modification of the system route which will navigate to the specified step. If no step is provided, then the stored current step is used\r\n\t * @param getParameterValue the callback which retrieves the value for a step parameter\r\n\t * @param step an optional step which will be used to navigate to\r\n\t */\r\n\thandleNavigation(getParameterValue?: (...args: any) => any, step?: StepModel<T>): void {\r\n\t\tconst currentStep = step || this.currentStep$.value\r\n\r\n\t\tif (!currentStep) return\r\n\r\n\t\tconst { slug, parameters } = currentStep\r\n\r\n\t\tlet route = `step-${slug}`\r\n\t\tif (getParameterValue) parameters.forEach((element) => route += `/${getParameterValue(element)}`)\r\n\t\tthis.router.navigate([route], { relativeTo: this.activatedRoute })\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description clears any route paths and/or parameters created during the step functionality, reverting the url back to the original state when the step paths were appended\r\n\t */\r\n\tclearStepRoute(): void {\r\n\t\tconst url = this.router.url\r\n\t\tconst [initial] = url.split('/step-')\r\n\t\tthis.router.navigate([initial])\r\n\t}\r\n}\r\n","import { Component } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { Observable } from 'rxjs'\r\nimport { StepModel } from '../../util/interface/modal-step.interface'\r\nimport { StepService } from '../../util/service/step.service'\r\n\r\n@Component({\r\n selector: 'step',\r\n standalone: true,\r\n imports: [CommonModule],\r\n templateUrl: './step.component.html',\r\n styleUrls: ['./step.component.sass']\r\n})\r\nexport class StepComponent {\r\n\t/**\r\n\t * @description an observable to the modal steps\r\n\t */\r\n steps: Observable<StepModel<any>[]>\r\n\t/**\r\n\t * @description an observable to the current step\r\n\t */\r\n currentStep: Observable<StepModel<any>|null>;\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description class constructor specifying the required services and properties\r\n\t * @param stepService the service class which contains access to the modal steps functionality\r\n\t */\r\n constructor(private stepService: StepService<any>) { }\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description the method to be run when the component is rendered\r\n\t */\r\n ngOnInit(): void {\r\n this.steps = this.stepService.getStepsObservable();\r\n this.currentStep = this.stepService.getCurrentStepObservable();\r\n }\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description handles the user clicking a step\r\n\t * @param step the step clicked\r\n\t */\r\n onStepClick(step: StepModel<any>) {\r\n this.stepService.setCurrentStep(step);\r\n }\r\n}\r\n","<div class=\"form-steps-container\">\r\n\t<ng-container *ngFor=\"let step of steps | async; let i = index;\">\r\n\t\t<div class=\"d-flex flex-column align-items-center\">\r\n\t\t\t<div \r\n\t\t\t\t(click)=\"onStepClick(step)\"\r\n\t\t\t\t[ngClass]=\"{ 'step-complete': step.isComplete, 'step-incomplete': !step.isComplete, 'step-current': (currentStep | async)?.stepIndex === step.stepIndex }\"\r\n\t\t\t\tclass=\"step-bubble cursor-pointer\"\r\n\t\t\t>{{ step.stepIndex }}</div>\r\n\t\t\t<div>\r\n\t\t\t\t<span class=\"text-grey\">{{step.title}}</span>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div *ngIf=\"i < (steps | async)?.length - 1\" class=\"step-divider\"></div>\r\n\t</ng-container>\r\n</div>","import { StepModel } from '../interface/modal-step.interface'\r\nimport { StepDefinition } from '../interface/step-definition.interface'\r\n\r\nexport class WizardBuilder<T> {\r\n\tprivate steps: StepDefinition<T>[] = []\r\n\r\n\taddStep(step: StepDefinition<T>): WizardBuilder<T> {\r\n\t\tthis.steps.push(step)\r\n\r\n\t\treturn this\r\n\t}\r\n\r\n\tbuild(): StepDefinition<T>[] {\r\n\t\treturn [...this.steps] // Immutable copy\r\n\t}\r\n}","import { Injectable } from '@angular/core'\r\nimport { Router, ActivatedRoute } from '@angular/router'\r\nimport { BehaviorSubject, Observable, map } from 'rxjs'\r\nimport { StepDefinition } from '../interface/step-definition.interface'\r\nimport { WizardState } from '../interface/wizard-state.interface'\r\n\r\n@Injectable()\r\nexport class WizardStepService<T> {\r\n\r\n private state$ = new BehaviorSubject<WizardState<T> | null>(null)\r\n\r\n constructor(\r\n private router: Router,\r\n private activatedRoute: ActivatedRoute\r\n ) {}\r\n\r\n initialize(steps: StepDefinition<T>[]): void {\r\n this.state$.next({\r\n steps: [...steps],\r\n currentIndex: 0\r\n })\r\n\r\n this.navigate()\r\n }\r\n\r\n getCurrentStep(): StepDefinition<T> | null {\r\n return this.state$.value?.steps[this.state$.value.currentIndex] ?? null\r\n }\r\n\r\n getCurrentStep$(): Observable<StepDefinition<T> | null> {\r\n return this.state$.pipe(\r\n map(state =>\r\n state ? state.steps[state.currentIndex] : null\r\n )\r\n )\r\n }\r\n\r\n async next(context?: any): Promise<void> {\r\n const state = this.state$.value\r\n if (!state) return\r\n\r\n const current = state.steps[state.currentIndex]\r\n\r\n if (current.onEnter) {\r\n const allowed = await current.onEnter(context)\r\n if (!allowed) return\r\n }\r\n\r\n if (state.currentIndex < state.steps.length - 1) {\r\n this.state$.next({\r\n ...state,\r\n currentIndex: state.currentIndex + 1\r\n })\r\n\r\n this.navigate()\r\n }\r\n }\r\n\r\n previous(): void {\r\n const state = this.state$.value\r\n if (!state) return\r\n\r\n if (state.currentIndex > 0) {\r\n this.state$.next({\r\n ...state,\r\n currentIndex: state.currentIndex - 1\r\n })\r\n\r\n this.navigate()\r\n }\r\n }\r\n\r\n isLast(): boolean {\r\n const state = this.state$.value\r\n if (!state) return false\r\n return state.currentIndex === state.steps.length - 1\r\n }\r\n\r\n private navigate(): void {\r\n const step = this.getCurrentStep()\r\n if (!step) return\r\n\r\n this.router.navigate(\r\n [`step-${step.slug}`],\r\n { relativeTo: this.activatedRoute }\r\n )\r\n }\r\n}\r\n","/*\r\n * Public API Surface of windows-plus-utilities\r\n */\r\nexport * from './components/step/step.component';\r\n\r\nexport * from './util/helper/wizard-builder.service'\r\n\r\nexport * from './util/interface/modal-step.interface'\r\nexport * from './util/interface/step-definition.interface'\r\nexport * from './util/interface/stepped-modal.interface'\r\nexport * from './util/interface/wizard-state.interface'\r\n\r\nexport * from './util/service/wizard-step.service'\r\nexport * from './util/service/step.service'","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.StepService"],"mappings":";;;;;;;MAQa,WAAW,CAAA;AAqBvB;;;;AAIE;AACF,IAAA,WAAA,C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;kBAD7B,UAAU;;;ACNX;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"windows-plus-utilities-modal-wizard.mjs","sources":["../../../projects/windows-plus-utilities/modal-wizard/util/service/wizard-step.service.ts","../../../projects/windows-plus-utilities/modal-wizard/components/step/step.component.ts","../../../projects/windows-plus-utilities/modal-wizard/components/step/step.component.html","../../../projects/windows-plus-utilities/modal-wizard/util/helper/wizard-builder.service.ts","../../../projects/windows-plus-utilities/modal-wizard/util/service/step.service.ts","../../../projects/windows-plus-utilities/modal-wizard/public-api.ts","../../../projects/windows-plus-utilities/modal-wizard/windows-plus-utilities-modal-wizard.ts"],"sourcesContent":["import { Injectable } from '@angular/core'\r\nimport { Router, ActivatedRoute } from '@angular/router'\r\nimport { BehaviorSubject, Observable, map } from 'rxjs'\r\nimport { StepDefinition } from '../interface/step-definition.interface'\r\nimport { WizardState } from '../interface/wizard-state.interface'\r\n/**\r\n * A finite state machine service used to manage wizard-style step navigation.\r\n *\r\n * This service maintains an immutable list of {@link StepDefinition} objects and\r\n * tracks the current active step index internally. It exposes reactive streams\r\n * for step data and navigation state, and coordinates router navigation when\r\n * transitions occur.\r\n *\r\n * The service is intentionally component-scoped and must be provided at the\r\n * component level. Each wizard instance should create and initialize its own\r\n * service instance.\r\n *\r\n * @typeParam T - The type used for step parameter definitions.\r\n */\r\n@Injectable()\r\nexport class WizardStepService<T> {\r\n\r\n\t/**\r\n\t * Internal state container for the wizard.\r\n\t *\r\n\t * Holds the ordered step definitions and the currently active index.\r\n\t * A `null` value indicates the wizard has not yet been initialized.\r\n\t */\r\n\tprivate state$ = new BehaviorSubject<WizardState<T> | null>(null)\r\n\r\n\t/**\r\n\t * Emits whether forward navigation is currently allowed.\r\n\t *\r\n\t * This can be controlled externally (e.g., form validity).\r\n\t */\r\n\tprivate stepForwardAvailability$ = new BehaviorSubject<boolean>(false)\r\n\r\n\t/**\r\n\t * Creates a new WizardStepService instance.\r\n\t *\r\n\t * @param router - Angular Router used to update the URL when step changes occur.\r\n\t * @param activatedRoute - The current route used as the relative base for navigation.\r\n\t */\r\n\tconstructor(\r\n\t\tprivate router: Router,\r\n\t\tprivate activatedRoute: ActivatedRoute\r\n\t) { }\r\n\r\n\t/**\r\n\t * Initializes the wizard with an ordered list of step definitions.\r\n\t *\r\n\t * This method must be called before navigation methods are used.\r\n\t * It resets the wizard state and navigates to the first step.\r\n\t *\r\n\t * @param steps - The ordered collection of step definitions.\r\n\t */\r\n\tinitialize(steps: StepDefinition<T>[]): void {\r\n\t\tthis.state$.next({\r\n\t\t\tsteps: [...steps], // defensive copy\r\n\t\t\tcurrentIndex: 0\r\n\t\t})\r\n\r\n\t\tthis.navigate()\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the currently active step synchronously.\r\n\t *\r\n\t * @returns The active {@link StepDefinition}, or `null` if not initialized.\r\n\t */\r\n\tgetCurrentStep(): StepDefinition<T> | null {\r\n\t\treturn this.state$.value?.steps[this.state$.value.currentIndex] ?? null\r\n\t}\r\n\r\n\t/**\r\n\t * Emits the currently active step whenever the wizard state changes.\r\n\t *\r\n\t * @returns Observable stream of the active step or `null` if uninitialized.\r\n\t */\r\n\tgetCurrentStep$(): Observable<StepDefinition<T> | null> {\r\n\t\treturn this.state$.pipe(\r\n\t\t\tmap(state =>\r\n\t\t\t\tstate ? state.steps[state.currentIndex] : null\r\n\t\t\t)\r\n\t\t)\r\n\t}\r\n\r\n\t/**\r\n\t * Emits the full ordered list of wizard steps.\r\n\t *\r\n\t * @returns Observable stream of step definitions.\r\n\t */\r\n\tgetSteps$(): Observable<StepDefinition<T>[]> {\r\n\t\treturn this.state$.pipe(\r\n\t\t\tmap(state => state?.steps ?? [])\r\n\t\t)\r\n\t}\r\n\r\n\t/**\r\n\t * Emits the current active step index.\r\n\t *\r\n\t * @returns Observable stream of the current index (0-based).\r\n\t */\r\n\tgetCurrentIndex$(): Observable<number> {\r\n\t\treturn this.state$.pipe(\r\n\t\t\tmap(state => state?.currentIndex ?? 0)\r\n\t\t)\r\n\t}\r\n\r\n\t/**\r\n\t * Attempts to transition to the next step.\r\n\t *\r\n\t * If the current step defines an `onExit` guard, it will be executed before\r\n\t * transitioning. If the guard returns `false` (or resolves to `false`),\r\n\t * the transition is cancelled.\r\n\t *\r\n\t * @param context - Optional contextual data passed to the `onExit` guard.\r\n\t */\r\n\tasync next(context?: any): Promise<void> {\r\n\t\tconst state = this.state$.value\r\n\t\tif (!state) return\r\n\r\n\t\tconst current = state.steps[state.currentIndex]\r\n\r\n\t\tif (current.onExit) {\r\n\t\t\tconst allowed = await current.onExit(context)\r\n\t\t\tif (!allowed) return\r\n\t\t}\r\n\r\n\t\tif (state.currentIndex < state.steps.length - 1) {\r\n\t\t\tthis.state$.next({\r\n\t\t\t\t...state,\r\n\t\t\t\tcurrentIndex: state.currentIndex + 1\r\n\t\t\t})\r\n\r\n\t\t\tthis.navigate()\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Moves the wizard to the previous step if possible.\r\n\t *\r\n\t * No guards are executed during backward navigation.\r\n\t */\r\n\tprevious(): void {\r\n\t\tconst state = this.state$.value\r\n\t\tif (!state) return\r\n\r\n\t\tif (state.currentIndex > 0) {\r\n\t\t\tthis.state$.next({\r\n\t\t\t\t...state,\r\n\t\t\t\tcurrentIndex: state.currentIndex - 1\r\n\t\t\t})\r\n\r\n\t\t\tthis.navigate()\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Determines whether the current step is the final step.\r\n\t *\r\n\t * @returns `true` if on the last step; otherwise `false`.\r\n\t */\r\n\tisLast(): boolean {\r\n\t\tconst state = this.state$.value\r\n\t\tif (!state) return false\r\n\t\treturn state.currentIndex === state.steps.length - 1\r\n\t}\r\n\r\n\t/**\r\n\t * Sets whether forward navigation is currently permitted.\r\n\t *\r\n\t * This is typically controlled by external validation logic (e.g., form state).\r\n\t *\r\n\t * @param available - `true` if forward navigation should be allowed.\r\n\t */\r\n\tsetStepForwardAvailability(available: boolean): void {\r\n\t\tthis.stepForwardAvailability$.next(available)\r\n\t}\r\n\r\n\t/**\r\n\t * Emits the forward navigation availability state.\r\n\t *\r\n\t * @returns Observable stream of the forward navigation flag.\r\n\t */\r\n\tgetStepForwardAvailability(): Observable<boolean> {\r\n\t\treturn this.stepForwardAvailability$.asObservable()\r\n\t}\r\n\r\n\t/**\r\n\t * Navigates the router to the currently active step.\r\n\t *\r\n\t * This method updates the URL relative to the injected route\r\n\t * using the pattern: `step-{slug}`.\r\n\t *\r\n\t * @internal\r\n\t */\r\n\tprivate navigate(): void {\r\n\t\tconst step = this.getCurrentStep()\r\n\t\tif (!step) return\r\n\r\n\t\tthis.router.navigate(\r\n\t\t\t[`step-${step.slug}`],\r\n\t\t\t{ relativeTo: this.activatedRoute }\r\n\t\t)\r\n\t}\r\n}\r\n\r\n","import { Component } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { Observable } from 'rxjs'\r\nimport { StepDefinition } from '../../util/interface/step-definition.interface'\r\nimport { WizardStepService } from '../../util/service/wizard-step.service'\r\n\r\n@Component({\r\n selector: 'step',\r\n standalone: true,\r\n imports: [CommonModule],\r\n templateUrl: './step.component.html',\r\n styleUrls: ['./step.component.sass']\r\n})\r\nexport class StepComponent {\r\n\t/**\r\n\t * @description an observable to the modal steps\r\n\t */\r\n steps: Observable<StepDefinition<any>[]>\r\n\t/**\r\n\t * @description an observable to the current step\r\n\t */\r\n currentIndex: Observable<number>;\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description class constructor specifying the required services and properties\r\n\t * @param stepService the service class which contains access to the modal steps functionality\r\n\t */\r\n constructor(private stepService: WizardStepService<any>) { }\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description the method to be run when the component is rendered\r\n\t */\r\n ngOnInit(): void {\r\n this.steps = this.stepService.getSteps$();\r\n this.currentIndex = this.stepService.getCurrentIndex$();\r\n }\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description handles the user clicking a step\r\n\t * @param step the step clicked\r\n\t */\r\n onStepClick(step: StepDefinition<any>) {\r\n // this.stepService.setCurrentStep(step);\r\n }\r\n}\r\n","<div class=\"form-steps-container\">\r\n\t<ng-container *ngFor=\"let step of steps | async; let i = index;\">\r\n\t\t<div class=\"d-flex flex-column align-items-center\">\r\n\t\t\t<div \r\n\t\t\t\t(click)=\"onStepClick(step)\"\r\n\t\t\t\t[ngClass]=\"{ 'step-complete': step.isComplete, 'step-incomplete': !step.isComplete, 'step-current': (currentIndex | async)?.stepIndex === step.stepIndex }\"\r\n\t\t\t\tclass=\"step-bubble cursor-pointer\"\r\n\t\t\t>{{ step.stepIndex }}</div>\r\n\t\t\t<div>\r\n\t\t\t\t<span class=\"text-grey\">{{step.title}}</span>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div *ngIf=\"i < (steps | async)?.length - 1\" class=\"step-divider\"></div>\r\n\t</ng-container>\r\n</div>","import { StepDefinition } from '../interface/step-definition.interface'\r\n\r\nexport class WizardBuilder<T> {\r\n\t/**\r\n\t * @description an array containing the configuration for the wizard's steps\r\n\t */\r\n\tprivate steps: StepDefinition<T>[] = []\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description adds the specified step to the step array\r\n\t * @param step the step to be added\r\n\t * @returns {WizardBuilder<T>} the wizard builder instance\r\n\t */\r\n\taddStep(step: StepDefinition<T>): WizardBuilder<T> {\r\n\t\tthis.steps.push(step)\r\n\r\n\t\treturn this\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description builds the wizard steps to be used\r\n\t * @returns {StepDefinition<T>[]} an immutable copy of the steps\r\n\t */\r\n\tbuild(): StepDefinition<T>[] {\r\n\t\treturn [...this.steps] // Immutable copy\r\n\t}\r\n}","import { Inject, Injectable } from '@angular/core'\r\nimport { BehaviorSubject, Observable } from 'rxjs'\r\nimport { StepModel } from '../interface/modal-step.interface'\r\nimport { ActivatedRoute, Router } from '@angular/router'\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root'\r\n})\r\nexport class StepService<T> {\r\n\t/**\r\n\t * @description the current index\r\n\t */\r\n\tprivate currentIndex = 0\r\n\t/**\r\n\t * @description the original step configuration\r\n\t */\r\n\toriginalSteps: StepModel<T>[]\r\n\t/**\r\n\t * @description the subject for the modal steps\r\n\t */\r\n\tsteps$: BehaviorSubject<StepModel<T>[]>\r\n\t/**\r\n\t * @description the subject for the current modal step\r\n\t */\r\n\tcurrentStep$: BehaviorSubject<StepModel<T> | null> = new BehaviorSubject<StepModel<T> | null>(null);\r\n\t/**\r\n\t * @description the subject for the step forward availability\r\n\t */\r\n\tstepForwardAvailability$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false)\r\n\t/**\r\n * @author Alex Hodson\r\n * @description class constructor specifying the required services and properties\r\n * @param steps the steps in the modal\r\n */\r\n\tconstructor(\r\n\t\tprivate router: Router,\r\n\t\tprivate activatedRoute: ActivatedRoute,\r\n\t\t@Inject('steps') private stepConfig: StepModel<T>[]\r\n\t) {\r\n\t\tthis.originalSteps = this.buildSteps(stepConfig)\r\n\t\tthis.steps$ = new BehaviorSubject(this.originalSteps)\r\n\t\tthis.currentStep$.next(this.originalSteps[0])\r\n\t}\r\n\tprivate buildSteps(config: Omit<StepModel<T>, 'stepIndex'>[]): StepModel<T>[] {\r\n\t\treturn config.map((step, index) => ({\r\n\t\t\t...step,\r\n\t\t\tstepIndex: index + 1\r\n\t\t}))\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description adjusts the step indexes to be sequential based on their position in the steps array\r\n\t */\r\n\tadjustStepIndexes(): void {\r\n\t\tconst rebuilt = this.steps$.value.map((step, index) => ({\r\n\t\t\t...step,\r\n\t\t\tstepIndex: index + 1\r\n\t\t}))\r\n\r\n\t\tthis.steps$.next(rebuilt)\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description inserts a new step at a specific index, specified by the step index property\r\n\t * @param step the step to be inserted\r\n\t */\r\n\tinsertStep(step: StepModel<T>): void {\r\n\t\tconst current = this.steps$.value\r\n\r\n\t\tconst updated = [\r\n\t\t\t...current.slice(0, step.stepIndex - 1),\r\n\t\t\tstep,\r\n\t\t\t...current.slice(step.stepIndex - 1)\r\n\t\t].map((s, index) => ({\r\n\t\t\t...s,\r\n\t\t\tstepIndex: index + 1\r\n\t\t}))\r\n\r\n\t\tthis.steps$.next(updated)\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description sets the current modal step\r\n\t * @param step the step to be set\r\n\t */\r\n\tsetCurrentStep(step: StepModel<T>): void {\r\n\t\tthis.currentStep$.next(step)\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description returns the current modal step observable\r\n\t * @returns the current modal step observable\r\n\t */\r\n\tgetCurrentStepObservable(): Observable<StepModel<T> | null> {\r\n\t\treturn this.currentStep$.asObservable()\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description returns the current modal step observable\r\n\t * @returns the current modal step observable\r\n\t */\r\n\tgetCurrentStep(): StepModel<T> | null {\r\n\t\treturn this.currentStep$.getValue()\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description retrieves the current steps\r\n\t * @returns the current steps\r\n\t */\r\n\tgetSteps(): StepModel<T>[] {\r\n\t\treturn this.steps$.getValue()\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description returns the modal step observable\r\n\t * @returns the modal step observable\r\n\t */\r\n\tgetStepsObservable(): Observable<StepModel<T>[]> {\r\n\t\treturn this.steps$.asObservable()\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description sets the step forward availability\r\n\t * @param available whether a step forward is available\r\n\t */\r\n\tsetStepForwardAvailability(available: boolean): void {\r\n\t\tthis.stepForwardAvailability$.next(available)\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description returns the step forward availability observable\r\n\t * @returns the step forward availability observable\r\n\t */\r\n\tgetStepForwardAvailability(): Observable<boolean> {\r\n\t\treturn this.stepForwardAvailability$.asObservable()\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description moves to the next modal step\r\n\t */\r\n\tmoveToNextStep(): void {\r\n\t\tif (this.currentIndex < this.steps$.value.length - 1) {\r\n\t\t\tthis.currentIndex++\r\n\t\t\tthis.currentStep$.next(this.steps$.value[this.currentIndex])\r\n\t\t}\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description moves to the previous modal step\r\n\t */\r\n\tmoveToPreviousStep(): void {\r\n\t\tconst previous = this.steps$.getValue()[this.currentIndex - 1]\r\n\r\n\t\tif (!previous) return\r\n\r\n\t\tthis.currentStep$.next({\r\n\t\t\t...previous,\r\n\t\t\t'triggerCallback': false\r\n\t\t})\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description determines whether the current step is the last\r\n\t * @returns whether the step is the last one\r\n\t */\r\n\tisLastStep(): boolean {\r\n\t\treturn this.currentIndex === this.steps$.value.length\r\n\t}\r\n\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description triggers any potential \"after-step\" functionality for the current step and changes the current route with any required parameters\r\n\t * @param getParameterValue the callback which retrieves the value for a step parameter\r\n\t * @param triggerStepCallback the callback which triggers the specific functionality for the specified step index\r\n\t */\r\n\tasync handleStepChange(getParameterValue?: (...args: any) => any, triggerStepCallback?: (...args: any) => Promise<boolean>, revert: boolean = false): Promise<void | null> {\r\n\t\tconst currentStep = this.currentStep$.value\r\n\r\n\t\tif (!currentStep) return\r\n\r\n\t\tconst { stepIndex, triggerCallback } = currentStep\r\n\r\n\t\tif (triggerCallback && triggerStepCallback) {\r\n\t\t\tconst results = await triggerStepCallback(stepIndex)\r\n\r\n\t\t\tif (!results && revert) return this.moveToPreviousStep()\r\n\t\t}\r\n\r\n\t\tthis.handleNavigation(getParameterValue, currentStep)\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description handles the modification of the system route which will navigate to the specified step. If no step is provided, then the stored current step is used\r\n\t * @param getParameterValue the callback which retrieves the value for a step parameter\r\n\t * @param step an optional step which will be used to navigate to\r\n\t */\r\n\thandleNavigation(getParameterValue?: (...args: any) => any, step?: StepModel<T>): void {\r\n\t\tconst currentStep = step || this.currentStep$.value\r\n\r\n\t\tif (!currentStep) return\r\n\r\n\t\tconst { slug, parameters } = currentStep\r\n\r\n\t\tlet route = `step-${slug}`\r\n\t\tif (getParameterValue) parameters.forEach((element) => route += `/${getParameterValue(element)}`)\r\n\t\tthis.router.navigate([route], { relativeTo: this.activatedRoute })\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description clears any route paths and/or parameters created during the step functionality, reverting the url back to the original state when the step paths were appended\r\n\t */\r\n\tclearStepRoute(): void {\r\n\t\tconst url = this.router.url\r\n\t\tconst [initial] = url.split('/step-')\r\n\t\tthis.router.navigate([initial])\r\n\t}\r\n}\r\n","/*\r\n * Public API Surface of windows-plus-utilities\r\n */\r\nexport * from './components/step/step.component';\r\n\r\nexport * from './util/helper/wizard-builder.service'\r\n\r\nexport * from './util/interface/modal-step.interface'\r\nexport * from './util/interface/step-definition.interface'\r\nexport * from './util/interface/stepped-modal.interface'\r\nexport * from './util/interface/wizard-state.interface'\r\n\r\nexport * from './util/service/wizard-step.service'\r\nexport * from './util/service/step.service'","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.WizardStepService"],"mappings":";;;;;;;AAKA;;;;;;;;;;;;;AAaG;MAEU,iBAAiB,CAAA;AAiB7B;;;;;AAKG;IACH,WACS,CAAA,MAAc,EACd,cAA8B,EAAA;QAD9B,IAAM,CAAA,MAAA,GAAN,MAAM,CAAQ;QACd,IAAc,CAAA,cAAA,GAAd,cAAc,CAAgB;AAvBvC;;;;;AAKG;AACK,QAAA,IAAA,CAAA,MAAM,GAAG,IAAI,eAAe,CAAwB,IAAI,CAAC,CAAA;AAEjE;;;;AAIG;AACK,QAAA,IAAA,CAAA,wBAAwB,GAAG,IAAI,eAAe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EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,sEA6Bd,OAAO,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AA7BJ,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,cAFX,MAAM,EAAA,CAAA,CAAA,EAAA;;2FAEN,WAAW,EAAA,UAAA,EAAA,CAAA;kBAHvB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACX,oBAAA,UAAU,EAAE,MAAM;AAClB,iBAAA,CAAA;;0BA8BE,MAAM;2BAAC,OAAO,CAAA;;;ACrCjB;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { StepDefinition } from '../../util/interface/step-definition.interface';
|
|
3
|
+
import { WizardStepService } from '../../util/service/wizard-step.service';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export declare class StepComponent {
|
|
6
6
|
private stepService;
|
|
7
7
|
/**
|
|
8
8
|
* @description an observable to the modal steps
|
|
9
9
|
*/
|
|
10
|
-
steps: Observable<
|
|
10
|
+
steps: Observable<StepDefinition<any>[]>;
|
|
11
11
|
/**
|
|
12
12
|
* @description an observable to the current step
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
currentIndex: Observable<number>;
|
|
15
15
|
/**
|
|
16
16
|
* @author Alex Hodson
|
|
17
17
|
* @description class constructor specifying the required services and properties
|
|
18
18
|
* @param stepService the service class which contains access to the modal steps functionality
|
|
19
19
|
*/
|
|
20
|
-
constructor(stepService:
|
|
20
|
+
constructor(stepService: WizardStepService<any>);
|
|
21
21
|
/**
|
|
22
22
|
* @author Alex Hodson
|
|
23
23
|
* @description the method to be run when the component is rendered
|
|
@@ -28,7 +28,7 @@ export declare class StepComponent {
|
|
|
28
28
|
* @description handles the user clicking a step
|
|
29
29
|
* @param step the step clicked
|
|
30
30
|
*/
|
|
31
|
-
onStepClick(step:
|
|
31
|
+
onStepClick(step: StepDefinition<any>): void;
|
|
32
32
|
static ɵfac: i0.ɵɵFactoryDeclaration<StepComponent, never>;
|
|
33
33
|
static ɵcmp: i0.ɵɵComponentDeclaration<StepComponent, "step", never, {}, {}, never, never, true, never>;
|
|
34
34
|
}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { StepDefinition } from '../interface/step-definition.interface';
|
|
2
2
|
export declare class WizardBuilder<T> {
|
|
3
|
+
/**
|
|
4
|
+
* @description an array containing the configuration for the wizard's steps
|
|
5
|
+
*/
|
|
3
6
|
private steps;
|
|
7
|
+
/**
|
|
8
|
+
* @author Alex Hodson
|
|
9
|
+
* @description adds the specified step to the step array
|
|
10
|
+
* @param step the step to be added
|
|
11
|
+
* @returns {WizardBuilder<T>} the wizard builder instance
|
|
12
|
+
*/
|
|
4
13
|
addStep(step: StepDefinition<T>): WizardBuilder<T>;
|
|
14
|
+
/**
|
|
15
|
+
* @author Alex Hodson
|
|
16
|
+
* @description builds the wizard steps to be used
|
|
17
|
+
* @returns {StepDefinition<T>[]} an immutable copy of the steps
|
|
18
|
+
*/
|
|
5
19
|
build(): StepDefinition<T>[];
|
|
6
20
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Alex Hodson
|
|
3
|
+
* @description an interface defining the configuration for a single wizard step
|
|
4
|
+
*/
|
|
1
5
|
export interface StepDefinition<T> {
|
|
2
6
|
id: string;
|
|
3
7
|
title: string;
|
|
4
8
|
slug: string;
|
|
9
|
+
isComplete: boolean;
|
|
5
10
|
parameters?: T[];
|
|
6
|
-
|
|
11
|
+
onExit?: (context?: any) => Promise<boolean> | boolean;
|
|
7
12
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { StepDefinition } from './step-definition.interface';
|
|
2
|
+
/**
|
|
3
|
+
* @author Alex Hodson
|
|
4
|
+
* @description an interface defining the properties for the wizard modal's state
|
|
5
|
+
*/
|
|
2
6
|
export interface WizardState<T> {
|
|
3
7
|
steps: StepDefinition<T>[];
|
|
4
8
|
currentIndex: number;
|
|
@@ -2,17 +2,120 @@ import { Router, ActivatedRoute } from '@angular/router';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { StepDefinition } from '../interface/step-definition.interface';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* A finite state machine service used to manage wizard-style step navigation.
|
|
7
|
+
*
|
|
8
|
+
* This service maintains an immutable list of {@link StepDefinition} objects and
|
|
9
|
+
* tracks the current active step index internally. It exposes reactive streams
|
|
10
|
+
* for step data and navigation state, and coordinates router navigation when
|
|
11
|
+
* transitions occur.
|
|
12
|
+
*
|
|
13
|
+
* The service is intentionally component-scoped and must be provided at the
|
|
14
|
+
* component level. Each wizard instance should create and initialize its own
|
|
15
|
+
* service instance.
|
|
16
|
+
*
|
|
17
|
+
* @typeParam T - The type used for step parameter definitions.
|
|
18
|
+
*/
|
|
5
19
|
export declare class WizardStepService<T> {
|
|
6
20
|
private router;
|
|
7
21
|
private activatedRoute;
|
|
22
|
+
/**
|
|
23
|
+
* Internal state container for the wizard.
|
|
24
|
+
*
|
|
25
|
+
* Holds the ordered step definitions and the currently active index.
|
|
26
|
+
* A `null` value indicates the wizard has not yet been initialized.
|
|
27
|
+
*/
|
|
8
28
|
private state$;
|
|
29
|
+
/**
|
|
30
|
+
* Emits whether forward navigation is currently allowed.
|
|
31
|
+
*
|
|
32
|
+
* This can be controlled externally (e.g., form validity).
|
|
33
|
+
*/
|
|
34
|
+
private stepForwardAvailability$;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new WizardStepService instance.
|
|
37
|
+
*
|
|
38
|
+
* @param router - Angular Router used to update the URL when step changes occur.
|
|
39
|
+
* @param activatedRoute - The current route used as the relative base for navigation.
|
|
40
|
+
*/
|
|
9
41
|
constructor(router: Router, activatedRoute: ActivatedRoute);
|
|
42
|
+
/**
|
|
43
|
+
* Initializes the wizard with an ordered list of step definitions.
|
|
44
|
+
*
|
|
45
|
+
* This method must be called before navigation methods are used.
|
|
46
|
+
* It resets the wizard state and navigates to the first step.
|
|
47
|
+
*
|
|
48
|
+
* @param steps - The ordered collection of step definitions.
|
|
49
|
+
*/
|
|
10
50
|
initialize(steps: StepDefinition<T>[]): void;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the currently active step synchronously.
|
|
53
|
+
*
|
|
54
|
+
* @returns The active {@link StepDefinition}, or `null` if not initialized.
|
|
55
|
+
*/
|
|
11
56
|
getCurrentStep(): StepDefinition<T> | null;
|
|
57
|
+
/**
|
|
58
|
+
* Emits the currently active step whenever the wizard state changes.
|
|
59
|
+
*
|
|
60
|
+
* @returns Observable stream of the active step or `null` if uninitialized.
|
|
61
|
+
*/
|
|
12
62
|
getCurrentStep$(): Observable<StepDefinition<T> | null>;
|
|
63
|
+
/**
|
|
64
|
+
* Emits the full ordered list of wizard steps.
|
|
65
|
+
*
|
|
66
|
+
* @returns Observable stream of step definitions.
|
|
67
|
+
*/
|
|
68
|
+
getSteps$(): Observable<StepDefinition<T>[]>;
|
|
69
|
+
/**
|
|
70
|
+
* Emits the current active step index.
|
|
71
|
+
*
|
|
72
|
+
* @returns Observable stream of the current index (0-based).
|
|
73
|
+
*/
|
|
74
|
+
getCurrentIndex$(): Observable<number>;
|
|
75
|
+
/**
|
|
76
|
+
* Attempts to transition to the next step.
|
|
77
|
+
*
|
|
78
|
+
* If the current step defines an `onExit` guard, it will be executed before
|
|
79
|
+
* transitioning. If the guard returns `false` (or resolves to `false`),
|
|
80
|
+
* the transition is cancelled.
|
|
81
|
+
*
|
|
82
|
+
* @param context - Optional contextual data passed to the `onExit` guard.
|
|
83
|
+
*/
|
|
13
84
|
next(context?: any): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Moves the wizard to the previous step if possible.
|
|
87
|
+
*
|
|
88
|
+
* No guards are executed during backward navigation.
|
|
89
|
+
*/
|
|
14
90
|
previous(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Determines whether the current step is the final step.
|
|
93
|
+
*
|
|
94
|
+
* @returns `true` if on the last step; otherwise `false`.
|
|
95
|
+
*/
|
|
15
96
|
isLast(): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Sets whether forward navigation is currently permitted.
|
|
99
|
+
*
|
|
100
|
+
* This is typically controlled by external validation logic (e.g., form state).
|
|
101
|
+
*
|
|
102
|
+
* @param available - `true` if forward navigation should be allowed.
|
|
103
|
+
*/
|
|
104
|
+
setStepForwardAvailability(available: boolean): void;
|
|
105
|
+
/**
|
|
106
|
+
* Emits the forward navigation availability state.
|
|
107
|
+
*
|
|
108
|
+
* @returns Observable stream of the forward navigation flag.
|
|
109
|
+
*/
|
|
110
|
+
getStepForwardAvailability(): Observable<boolean>;
|
|
111
|
+
/**
|
|
112
|
+
* Navigates the router to the currently active step.
|
|
113
|
+
*
|
|
114
|
+
* This method updates the URL relative to the injected route
|
|
115
|
+
* using the pattern: `step-{slug}`.
|
|
116
|
+
*
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
16
119
|
private navigate;
|
|
17
120
|
static ɵfac: i0.ɵɵFactoryDeclaration<WizardStepService<any>, never>;
|
|
18
121
|
static ɵprov: i0.ɵɵInjectableDeclaration<WizardStepService<any>>;
|