libs/core/dynamic-form/checkbox/src/checkbox.model.ts
Base configuration interface for both single checkbox and checkbox group components
Properties |
|
| label | |
| Type |
string
|
|
Description
|
This field's label. It's translatable by default and supports string interpolation. |
| labelSizeSmall (Optional) | |
| Type |
boolean
|
| Default value |
false
|
|
Description
|
Sets the checkbox label size to 'small'. The default size is 'large'. |
import {
DfInteractiveBaseConfig,
DfOptions,
VerticalLayout,
HorizontalLayout
} from '@allianz/taly-core/dynamic-form';
/**
* The value to use for the `type` attribute of checkbox formfield configs.
*/
export const DfCheckboxTypeName = 'CHECKBOX';
/**
* The value to use for the `type` attribute of checkbox group formfield configs.
*/
export const DfCheckboxGroupTypeName = 'CHECKBOX_GROUP';
/**
* Base configuration interface for both single checkbox and checkbox group components
*/
export interface DfCheckboxBaseConfig extends DfInteractiveBaseConfig {
/**
* This field's label.
* It's translatable by default and supports string interpolation.
* @examples ["My label", "My label {$['bb-pgr-simple'].person.firstName}"]
*/
label: string;
/**
* Sets the checkbox label size to 'small'. The default size is 'large'.
* @default false
*/
labelSizeSmall?: boolean;
}
/**
* Configuration for a single checkbox component
*/
export interface DfCheckboxConfig extends DfCheckboxBaseConfig {
/**
* Specifies the type of the field as `CHECKBOX`.
*/
type: typeof DfCheckboxTypeName;
}
/**
* Configuration for a checkbox group component
*/
export interface DfCheckboxGroupConfig extends DfCheckboxBaseConfig {
/**
* Specifies the type of the field as `CHECKBOX_GROUP`.
*/
type: typeof DfCheckboxGroupTypeName;
/**
* The options for the checkbox group. Can be either:
* 1. A hardcoded array of objects for direct display. Each object must have a "label" and "value".
* 2. A string expression used by an option provider service to dynamically fetch options.
*
* @examples [[{"label": "The first option", "value": "1"}], "$.myExpression"]
*/
options: DfOptions[] | string;
/**
* The layout configuration for the checkbox group.
* @default { optionsColumnSpan: 4, horizontal: false }
*/
layout?: VerticalLayout | HorizontalLayout;
}
export const CheckboxLabelSize = {
Small: 'small',
Large: 'large'
} as const;
export type CheckboxLabelSize = (typeof CheckboxLabelSize)[keyof typeof CheckboxLabelSize];