libs/core/dynamic-form/toggle-button/src/toggle-button.model.ts
Configuration for a dynamic toggle button field.
Omit<DfInteractiveBaseConfig, 'hint' | 'columnSpan'>
Properties |
|
| options | |
| Type |
DfOptions[] | string
|
|
Description
|
The
|
| size (Optional) | |
| Type |
DfToggleButtonSize
|
|
Description
|
To set the size of the toggle button ( |
| type | |
| Type |
typeof DfToggleButtonTypeName
|
|
Description
|
Specifies the type of the field as |
| value (Optional) | |
| Type |
string | number | boolean
|
|
Description
|
The initially selected option value.
Must match the |
| note (Optional) | |
| Type |
string
|
|
Description
|
The note text is displayed in an info message box below the field. It's translatable by default and supports string interpolation. Example : |
| onBlurEvent (Optional) | |
| Type |
DfInteractiveEventConfig
|
|
Description
|
Configure either a PFE action or service activator configuration handler for the field's |
| onValueChangesEvent (Optional) | |
| Type |
DfInteractiveEventConfig
|
|
Description
|
Configure either a PFE action or service activator configuration handler for the field's |
| validators (Optional) | |
| Type |
DynamicFormValidationConfig[]
|
|
Description
|
Validators to set on this form field. |
| acl (Optional) | |
| Type |
DfFieldAcl[]
|
|
Description
|
ACL rules to be applied to this field. |
| id | |
| Type |
string
|
|
Description
|
This field's ID. The ID will serve as the ACL resource name for the form field. If the field is a form element, it will also be used as a form control name within the FormGroup to which it is added. IDs must be unique within your form. Example : |
| infoIcon (Optional) | |
| Type |
DfInfoIconConfig
|
|
Description
|
Info icon with associated pop-over. |
| label (Optional) | |
| Type |
string
|
|
Description
|
This field's label. It's translatable by default and supports string interpolation. Example : |
| onInitEvent (Optional) | |
| Type |
DfInteractiveEventConfig
|
|
Description
|
Configure either a PFE action or service activator configuration handler when the field's |
| renderName (Optional) | |
| Type |
string
|
|
Description
|
The optional renderName is added as the attribute "data-render-name" to the df-formfield elements in the DOM. It can be used to find the rendered element of a specific field of a form. |
| spacing (Optional) | |
| Type |
DfFormfieldSpacing
|
|
Description
|
This field's custom spacing. If defined, it will be used to set the spacing between this field and the next one. |
| testId (Optional) | |
| Type |
string
|
|
Description
|
The id used to select the element in the tests (unit test, e2e testing) |
| columnSpan (Optional) | |
| Type |
number
|
|
Description
|
This field's custom size. Number of column(s) the element should span. It's only applicable with the "CUSTOM_COLUMN" layout. The value can be 1-12, following the 12-column grid system. The default value is 12. |
import { DfInteractiveBaseConfig, DfOptions } from '@allianz/taly-core/dynamic-form';
/**
* The value to use for the `type` attribute of toggle button
* formfield configs.
*/
export const DfToggleButtonTypeName = 'TOGGLE_BUTTON';
/**
* Configuration for a dynamic toggle button field.
*/
export interface DfToggleButtonConfig extends Omit<DfInteractiveBaseConfig, 'hint' | 'columnSpan'> {
/**
* Specifies the type of the field as `TOGGLE_BUTTON`.
*/
type: typeof DfToggleButtonTypeName;
/**
* The `options` property can take one of two forms:
* 1. It can be a hardcoded array of objects for direct display in a toggle button. Each object must have a `label` to display and a corresponding `value`.
* 2. A string that represents an expression. This expression is used by an option provider service to dynamically fetch the toggle button options.
*
* @examples [[{"label": "The first option", "value": "1"}], "$.myExpression"]
*/
options: DfOptions[] | string;
/**
* To set the size of the toggle button (`'small'` or `'large'`). The default size is `'large'`. In Expert journeys only `'small'` size is allowed.
*/
size?: DfToggleButtonSize;
/**
* The initially selected option value.
* Must match the `value` of one of the configured options.
*/
value?: string | number | boolean;
}
export const DfToggleButtonSize = {
Small: 'small',
Large: 'large'
} as const;
type DfToggleButtonSize = (typeof DfToggleButtonSize)[keyof typeof DfToggleButtonSize];