@eherve/angular-material-entity-wizard
v22.1.0
Published
Independent creation wizard using the shared forms session and renderers. This package has no dependency on edit-entity-dialog.
Downloads
548
Readme
Angular Material entity wizard
Independent creation wizard using the shared forms session and renderers. This package has no dependency on edit-entity-dialog.
import { CreateEntityWizardService, createEntityWizardOptions, CreateEntityWizardComponentOptions } from '@eherve/angular-material-entity-wizard';
const options = createEntityWizardOptions({
title: 'Create',
steps: [{ id: 'main', label: 'Main', displayOptions: { section: { id: 'main', label: '', cards: [] } } }],
service: { create: async value => ({ _id: 'created', ...value }) },
});
wizard.open(options);CreateEntityWizardComponentOptions<TRecord> extends the canonical EditEntityComponentOptions<TRecord> from @eherve/angular-material-forms/core with wizard. The normalization helper retains the established wizard configuration shape and options identity when opened. Standard edit options contain no wizard property.
Each wizard owns one shared EntityFormSession; changing a step does not replace the form. Its scoped save policy projects only current-step and always-in-upsert fields, preserves other-step drafts during server hydration, blocks navigation during saves or pending validation and accumulates created/updated results. Component-managed steps use the supplied markUpdated callback. The independent modal wrapper retains top-dialog keyboard and focused-input key ownership behavior.
Include @eherve/angular-material-forms/styles.css once. Public EntityWizardComponent supports page or modal display, and CreateEntityWizardService opens its own EntityWizardDialog. Version 22.0.0 requires @eherve/angular-material-forms@^22.0.0 and has no dependency on edit-dialog.
Restoring navigation
CreateEntityWizardOptions accepts the shared navigation options. Each step's stable
id is its navigation.tab; child section navigation uses the existing adapters.
Initial selection applies after record hydration and visible-step computation. Existing
persisted records can select an allowed visible step; a record without an id retains
the first-step restriction. Restoration never calls create, update or Continue.
stateChanges and lifecycle-handle navigation update the actual wizard selection,
respecting pending validation/updating restrictions. User step changes publish onChange.
The forms connection lifecycle (ready, presentationChanged, failed, beforeClose)
also applies to wizard sessions.
The optional lifecycle connection opened(handle) receives a close-only requestClose(): Promise<boolean> handle before asynchronous loading. It supports cancelling loading or failed content through the existing close guards; it does not signal readiness. ready remains the rendered-content barrier. Handles from previous openings return false.
