Utilizing a mat-stepper within a dialog for both new entity creation and existing entity editing of a specific type. The stepper comprises four steps, with the first three involving data entry forms and the final step serving as a summary of the entered data from the preceding steps.
The goal is to restrict users from proceeding to the last step unless valid information has been provided in all three prior steps. To enforce this, the linear
attribute was incorporated into the stepper to mandate progression through each step. This approach functions effectively for creating new entities via the dialog. However, when editing an existing entity, it prevents skipping ahead to a later step without first navigating through the required steps sequentially.
In editing mode, all fields are automatically populated with existing entity data upon dialog opening. Ideally, users should be able to directly access any step as long as valid information is entered in the current visible step. A demonstration showcasing this issue can be found on StackBlitz: stackblitz
Even though all fields are pre-filled programmatically, direct navigation to steps 3 or 4 without completing previous steps manually is not feasible.
An initial attempt to address this involved removing the linear
attribute when the dialog is initiated in edit mode. Although this allows for the desired flexibility in step navigation, it also permits users to clear fields within a step and proceed directly to the final step - contrary to the requirement that all previous steps must contain valid data before accessing the last step.
Is there a solution within mat-stepper to achieve this behavior? If further clarification is needed regarding my issue, please feel free to ask and I will provide additional details.