@daltonr/pathwrite-angular 0.1.5 → 0.2.1

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/src/shell.ts CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  OnInit,
11
11
  OnDestroy,
12
12
  inject,
13
+ Injector,
13
14
  ChangeDetectionStrategy
14
15
  } from "@angular/core";
15
16
  import { CommonModule } from "@angular/common";
@@ -96,11 +97,16 @@ export class PathStepDirective {
96
97
  <div class="pw-shell__body">
97
98
  <ng-container *ngFor="let stepDir of stepDirectives">
98
99
  <ng-container *ngIf="stepDir.stepId === s.stepId">
99
- <ng-container *ngTemplateOutlet="stepDir.templateRef"></ng-container>
100
+ <ng-container *ngTemplateOutlet="stepDir.templateRef; injector: shellInjector"></ng-container>
100
101
  </ng-container>
101
102
  </ng-container>
102
103
  </div>
103
104
 
105
+ <!-- Validation messages -->
106
+ <ul class="pw-shell__validation" *ngIf="s.validationMessages.length > 0">
107
+ <li *ngFor="let msg of s.validationMessages" class="pw-shell__validation-item">{{ msg }}</li>
108
+ </ul>
109
+
104
110
  <!-- Footer — navigation buttons -->
105
111
  <div class="pw-shell__footer">
106
112
  <div class="pw-shell__footer-left">
@@ -132,14 +138,23 @@ export class PathStepDirective {
132
138
  `
133
139
  })
134
140
  export class PathShellComponent implements OnInit, OnDestroy {
135
- @Input({ required: true }) path!: PathDefinition;
141
+ /** The path definition to run. Required. */
142
+ @Input({ required: true }) path!: PathDefinition<any>;
143
+ /** Initial data merged into the path engine on start. */
136
144
  @Input() initialData: PathData = {};
145
+ /** Start the path automatically on ngOnInit. Set to false to call doStart() manually. */
137
146
  @Input() autoStart = true;
147
+ /** Label for the Back navigation button. */
138
148
  @Input() backLabel = "Back";
149
+ /** Label for the Next navigation button. */
139
150
  @Input() nextLabel = "Next";
151
+ /** Label for the Next button when on the last step. */
140
152
  @Input() finishLabel = "Finish";
153
+ /** Label for the Cancel button. */
141
154
  @Input() cancelLabel = "Cancel";
155
+ /** Hide the Cancel button entirely. */
142
156
  @Input() hideCancel = false;
157
+ /** Hide the step progress indicator in the header. */
143
158
  @Input() hideProgress = false;
144
159
 
145
160
  @Output() completed = new EventEmitter<PathData>();
@@ -149,6 +164,9 @@ export class PathShellComponent implements OnInit, OnDestroy {
149
164
  @ContentChildren(PathStepDirective) stepDirectives!: QueryList<PathStepDirective>;
150
165
 
151
166
  public readonly facade = inject(PathFacade);
167
+ /** The shell's own component-level injector. Passed to ngTemplateOutlet so that
168
+ * step components can resolve PathFacade (provided by this shell) via inject(). */
169
+ protected readonly shellInjector = inject(Injector);
152
170
  public started = false;
153
171
 
154
172
  private readonly destroy$ = new Subject<void>();