This content is for the 19.0.0 version. Switch to thelatest versionfor up-to-date documentation.
The Angular WML Field library is an Angular-based framework designed to enhance the functionality and management of form fields within web applications. It provides a robust set of components and services that simplify the creation, validation, and handling of form fields, addressing common challenges faced by developers in form management. The library integrates seamlessly with Angular’s reactive forms module, offering additional utilities for field state management, validation messaging, and dynamic content loading, thereby streamlining the form development process and improving user interaction.
At the core of the angular-wml-field
library are several central components, including WMLFieldZero
and WMLLabelZero
, each serving a distinct purpose within the form management ecosystem. WMLFieldZero
acts as a container for individual form fields, encapsulating the logic for field rendering, validation, and interaction. It allows for the integration of custom components, enhancing flexibility and extensibility. WMLLabelZero
, on the other hand, is dedicated to managing field labels and validation messages, supporting dynamic content capabilities. These components are designed to work in unison, with WMLFieldZero
typically serving as a parent container that orchestrates the behavior of nested label and input components. Developers can customize these components through various input parameters and methods, enabling the creation of tailored form experiences that cater to specific application needs.
Terminal window
npm install -s --verbose @windmillcode/angular-wml-field
# needed to practically work with the field
npm install -s --verbose @windmillcode/angular-wml-input
For advanced customization you can have as many labels and errors<iframe src="https://stackblitz.com/edit/stackblitz-starters-hs4nsx?ctl=1&embed=1&file=src%2Fmain.ts&theme=dark" style="width: 100%; height: calc(500/16 * 1em) !important;"></iframe>
<iframe src="https://stackblitz.com/edit/stackblitz-starters-g2agli?ctl=1&embed=1&file=src%2Fmain.ts&theme=dark" style="width: 100%; height: calc(500/16 * 1em) !important;"></iframe> <iframe src="https://stackblitz.com/edit/stackblitz-starters-jaykgw?ctl=1&embed=1&file=src%2Fmain.ts&theme=dark" style="width: 100%; height: calc(500/16 * 1em) !important;"></iframe> <iframe src="https://stackblitz.com/edit/stackblitz-starters-kufze9?ctl=1&embed=1&file=src%2Fmain.ts&theme=dark" style="width: 100%; height: calc(500/16 * 1em) !important;"></iframe>Property | Type | Description |
---|---|---|
self.type | "standalone" | "wml-card" | Determines the type of field, either standalone or wrapped in a card. |
label.type | "custom" | Specifies the type of label component; currently, only custom labels are supported. |
field.type | "input" | "custom" | Indicates the type of field, either a standard input or a custom field component. |
field.parentForm | FormGroup | The parent FormGroup instance to which this field belongs. |
field.formControlName | string | The name of the form control within the parent form group. |
error.type | "custom" | Specifies the type of error display; currently, only custom error components are supported. |
Method | Signature | Description |
---|---|---|
getReactiveFormControl | () => AbstractControl | Retrieves the AbstractControl associated with this field. |
getParentForm | () => FormGroup | Returns the parent FormGroup of this field. |
getFormControlName | () => string | Gets the name of the form control associated with this field. |
getLabel | () => string | Retrieves the label’s text value. |
getRequiredLabel | () => string | Fetches the required label’s text value if it exists. |
updateLabel | (label: string) => void | Updates the label’s text value. |
updateRequiredLabel | (label: string) => void | Updates the required label’s text value. |
deleteLabel | () => void | Removes the label text. |
deleteRequiredLabelPart | () => void | Removes the required label text. |
Property | Type | Description |
---|---|---|
cdref | ChangeDetectorRef? | Optional reference to Angular’s change detection mechanism. |
type | 'label' | 'error' | Determines the label type, either for standard labels or error messages. |
isPresent | boolean | Flag indicating if the label should be displayed. |
errorMsgs | Object | An object containing error message mappings. |
labels | Array<Array<{ type?: 'default' | 'error' | 'required' | 'errorLink' | 'defaultLink', value: string, isPresent?: boolean }>> | Defines the label parts and their properties. |
wmlField | WMLFieldZeroProps | Reference to the associated WMLField instance. |
Method | Signature | Description |
---|---|---|
toggleErrors | (formControl: AbstractControl) => string[] | Determines which error messages to display based on the form control’s state. Used interally probably triggerable plans to make it fully triggerable so if the errorMsgs are updated you can manually update the erros in the view |
added updateLabel and updateRequiredLabel wrappers for updateLabelPart which allow to update the input of a field
ensured that there is support for ngx-translate and non ngx-translate featuresto enable translation
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http);
}
HttpClientModule,
WMLFieldModule
.forChild(
new WMLModuleForRootProps({
ngxTranslateLoaderFactory:HttpLoaderFactory
})
),
to disable translation
WMLFieldModule
MAJOR rename to angular-wml-fieldfixed major problems concerning ngx-translate
// translate
// first make sure to have ONLY ONE in the imports for AppModule
TranslateModule.forRoot({
defaultLanguage: 'en',
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps:[HttpClient]
}
}),
// then
WMLFieldNGXTranslateModule
// for regular
WMLFieldModule
package uses @windmillcode/angular-wml-components-base
provided serveral methods to help with retrieving different values realted to the fields
getReactiveFormControl
getLabel
getRequiredLabel
getLabelPart
updateLabel
updateRequiredLabel
updateLabelPart
deleteLabelPart
deleteRequiredLabelPart
deleteLabel
made id accessible on selector itself, access via wmlField.view.id
added WMLField#getParentForm WMLField#getFormControlName as additional methods
added addititional features %!(EXTRA string=
updated package to reflect the version 16.2.80 of @angular/core package),
updated package to reflect the version 16.2.80 of @angular/core package,
updated package to reflect the version 16.2.90 of @angular/core package,
updated package to reflect the version 16.2.91 of @angular/core package
made BREAKING CHANGES to wmlfield replacing all WMLCustomComponent.meta with WMLCustomComponent.props ,
updated package to conform with @windmillcode/angular-wml-components-base for unit testing features ,
updated package to conform with @windmillcode/angular-wml-components-base for unit testing features ,
updated package to conform with @windmillcode/angular-wml-components-base for unit testing features ,
updated package to conform with @windmillcode/angular-wml-components-base for unit testing features ,
updated package to conform with @windmillcode/angular-wml-components-base for unit testing features ,
updated package to conform with @windmillcode/angular-wml-components-base for unit testing features ,
updated package to reflect the version ^17.0.2 of @angular/core package,
updated package to reflect the version ^17.0.4 of @angular/core package,
updated package to reflect the version ^17.0.5 of @angular/core package,
updated package to reflect the version ^17.0.6 of @angular/core package,
updated package to reflect the version ^17.0.7 of @angular/core package,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to reflect the version ^17.0.8 of @angular/core package,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to reflect the version ^17.1.0 of @angular/core package,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to reflect the version ^17.1.2 of @angular/core package,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to reflect the version ^17.1.3 of @angular/core package,
updated package to reflect the version ^17.2.1 of @angular/core package,
updated package to reflect the version ^17.2.2 of @angular/core package,
updated package to reflect the version ^17.2.2 of @angular/core package,
updated package to reflect the version ^17.2.3 of @angular/core package,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to reflect the version ^17.2.4 of @angular/core package,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to reflect the version ^17.3.0 of @angular/core package ,
updated package to reflect the version ^17.3.1 of @angular/core package,
updated package to reflect the version ^17.3.2 of @angular/core package,
updated package to reflect the version ^17.3.3 of @angular/core package,
updated package to reflect the version ^17.3.4 of @angular/core package,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to reflect the version ^17.3.5 of @angular/core package,
updated package to conform with @windmillcode/angular-wml-components-base [PATCH] Enhanced WMLField class in wml-field.component.ts by adding generic types for form control and parameters, allowing more flexible and type-safe custom component integrations.[UPDATE] Added getFieldProps and updated getReactiveFormControl methods in WMLField class for better handling and customization of form controls and their properties. ,
updated package to reflect the version ^17.3.6 of @angular/core package,
updated package to reflect the version ^17.3.7 of @angular/core package,
updated package to reflect the version ^17.3.8 of @angular/core package,
updated package to reflect the version ^17.3.9 of @angular/core package,
updated package to reflect the version ^18.0.0 of @angular/core package,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to reflect the version ^18.0.1 of @angular/core package,
updated package to reflect the version ^18.0.2 of @angular/core package,
updated package to reflect the version ^18.0.3 of @angular/core package,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to reflect the version ^18.0.5 of @angular/core package,
updated package to reflect the version ^18.0.6 of @angular/core package,
updated package to reflect the version ^18.1.0 of @angular/core package,
updated package to reflect the version ^18.1.0 of @angular/core package,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to reflect the version ^18.1.1 of @angular/core package,
updated package to reflect the version ^18.1.2 of @angular/core package
[BREAKING CHANGE] replaced main tags with div tags ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base ,
updated package to conform with @windmillcode/angular-wml-components-base
[BREAKING CHANGES] WMLFieldZero props default constructor object property is now a WMLDeepPartial of the class
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to reflect the version 18.2.1 of @angular/core package
updated package to reflect the version 18.2.2 of @angular/core package
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to reflect the version 18.2.3 of @angular/core package
updated package to reflect the version 18.2.3 of @angular/core package
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/angular-wml-components-base
updated package to conform with @windmillcode/wml-components-base
updated package to reflect the version 18.2.4 of @angular/core package
updated package to conform with @windmillcode/wml-components-base
updated package to conform with @windmillcode/wml-components-base
updated package to reflect the version 18.2.5 of @angular/core package
updated package to reflect the version 18.2.6 of @angular/core package
updated package to reflect the version 18.2.7 of @angular/core package
updated package to conform with @windmillcode/wml-components-base
updated package to conform with @windmillcode/wml-components-base
updated package to conform with @windmillcode/wml-components-base
updated package to reflect the version 18.2.8 of @angular/core package
updated package to reflect the version 18.2.8 of @angular/core package
updated package to conform with @windmillcode/wml-components-base
updated package to conform with @windmillcode/wml-components-base
updated package to conform with @windmillcode/wml-components-base
updated package to conform with @windmillcode/wml-components-base
updated package to conform with @windmillcode/wml-components-base
updated package to conform with @windmillcode/wml-components-base
updated package to conform with @windmillcode/wml-components-base
updated package to conform with @windmillcode/wml-components-base
updated package to conform with @windmillcode/wml-components-base
updated package to conform with @windmillcode/wml-components-base