@masterteam/form-builder
v0.0.61
Published
`<mt-form-builder>` resolves its properties panel via `POST context/resolve` (see `FormBuilderContextService`). The component's own request flags (`propertyFlags`, `includeVirtual`, `includeNavigationPaths`, etc.) are fixed and not configurable from ou
Readme
@masterteam/form-builder
Context Resolution — Extra Params
<mt-form-builder> resolves its properties panel via POST context/resolve
(see FormBuilderContextService). The component's own request flags
(propertyFlags, includeVirtual, includeNavigationPaths, etc.) are fixed
and not configurable from outside the package. If a host app needs to send
additional, backend-specific fields in that request body — or override one of
the package's own flags — set it via FormBuilderFacade, the same way you
already set moduleType / moduleId:
this.formBuilderFacade.setModuleInfo('processstep', stepId);
this.formBuilderFacade.setContextResolveExtraParams({
tenantId: currentTenantId,
includeVirtual: false,
});These fields are spread into the request body last, so they win over the
package's own flags on key collision. @masterteam/form-builder never
interprets or hardcodes what goes in this object — it's a pure pass-through
owned by the consumer. It lives in the same NGXS slice as moduleType /
moduleId and is reset alongside them by facade.resetState(). Read at
request time; changing it alone does not trigger a refetch (only a
context-key or scope change does).
Formula Conditions
Field condition formulas render field display names in the toolbar and visual
editor, while serialized formula tokens keep backend property keys in
FormulaToken.value. When restoring backend-saved key-only tokens, hydrate
FormulaToken.display from the available form fields before showing the editor.
Modes
mode is builder (the full editor, the default), manageProperties
(field read/write permissions only) or localFields (below). A missing value
means builder: hosts such as the admin level Form tab mount FormBuilder
directly on a route, and withComponentInputBinding() hands every input the
route does not supply undefined; the input maps that back to builder.
Loading and load failures
The store holds one form at a time, for the module last passed to
setModuleInfo. Switching to a different module clears the loaded form, and a
newer getFormConfiguration() cancels one still in flight. When the load fails
the form stays cleared: the canvas shows a "couldn't be loaded" panel with a
Try again button, and every editing action (sections, preview, validation
rules, reset) is disabled. Nothing from an earlier form is ever shown against
the new module, so it cannot be edited or saved to the wrong URL. The panel
shows fixed, translated text, not the backend message; the host's message
interceptor reports that.
Local fields mode
<mt-form-builder mode="localFields" /> edits a field list a host owns,
entirely in memory — nothing reaches the form-configuration API:
facade.enterLocalConfiguration(formConfiguration, properties); // seed
// … the user drags, orders, sizes and marks fields required …
const fields = facade.sections()[0].fields; // read back
facade.exitLocalConfiguration(); // restore whatever was loaded beforeIn this mode the toolbox lists the seeded properties (no context is
resolved), the toolbar and section editing are hidden, and the field settings
offer only Is Required and Size. Field actions (addField,
updateField, deleteField, reorderFields, moveField) change the store
only; section, settings, validation and reset actions do nothing. The store is
global, so entering stashes its previous contents and exiting restores them.
The Local EntityList "Manage Fields" drawer in @masterteam/properties is the
consumer.
🤝 Contributing
Contributions are welcome! Please feel free to open an issue or submit a pull request.
📄 License
This project is licensed under the MIT License.
