File

libs/core/dynamic-form/circle-toggle-group/src/circle-toggle-group.model.ts

Description

Definition of circle toggles

Extends

Omit<DfInteractiveBaseConfig, 'hint' | 'columnSpan'>

Index

Properties

Properties

label
Type string
Description

This field's label. It's translatable by default and supports string interpolation.

Example :
layout (Optional)
Type { optionsColumnSpan?: "2" | "3" | "4"; optionsLeftAlignInExpert?: boolean }
Description

The layout of the field.

options
Type DfCircleToggle[]
Description

Configuration for all options to be displayed on a page. For the best user experience, retail journeys should not have more than 3 options.

type
Type typeof DfCircleToggleGroupTypeName
Description

Specifies the type of the field as CIRCLE_TOGGLE_GROUP.

value (Optional)
Type string
Description

The initially selected option value. Must match the value of one of the configured options.

Example :
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 blur event.

onValueChangesEvent (Optional)
Type DfInteractiveEventConfig
Description

Configure either a PFE action or service activator configuration handler for the field's valueChanges event.

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.

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.

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.

onInitEvent (Optional)
Type DfInteractiveEventConfig
Description

Configure either a PFE action or service activator configuration handler when the field's ngOnInit method is triggered.

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)

import { DfInteractiveBaseConfig } from '@allianz/taly-core/dynamic-form';

/**
 * Definition of the type - dynamic circle toggles
 */
export const DfCircleToggleGroupTypeName = 'CIRCLE_TOGGLE_GROUP';

/**
 * Definition of circle toggles
 */
export interface DfCircleToggleGroupConfig
  extends Omit<DfInteractiveBaseConfig, 'hint' | 'columnSpan'> {
  /**
   * Specifies the type of the field as `CIRCLE_TOGGLE_GROUP`.
   */
  type: typeof DfCircleToggleGroupTypeName;

  /**
   * Configuration for all options to be displayed on a page.
   * For the best user experience, retail journeys should not have more than 3 options.
   */
  options: DfCircleToggle[];

  /**
   * 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;
  /**
   * The layout of the field.
   */
  layout?: {
    /**
     * This size of each option.
     * By default, each option takes 4 columns but you have an option to configure it to 2 or 3 columns.
     * For the best user experience, a 2-column span should be used only in expert journeys when `fullWidthFormInExpert` is set to `true`.
     * @default 4
     *
     */
    optionsColumnSpan?: 2 | 3 | 4;
    /**
     * Controls alignment for the circle toggle options.
     * Set to `true` to left-align the options. Defaults to center alignment. Ignored in retail journeys.
     * @default false
     *
     */
    optionsLeftAlignInExpert?: boolean;
  };

  /**
   * The initially selected option value.
   * Must match the `value` of one of the configured options.
   * @examples ["option-1"]
   */
  value?: string;
}

export interface DfCircleToggle {
  /**
   * Value of the option to be used as a form value when the option is selected.
   */
  value: string;

  /**
   * The label to be displayed as bold text under the option.
   * It's translatable by default and supports string interpolation.
   * @examples ["Option 1", "My option {$['bb-pgr-simple'].person.firstName}"]
   */
  label: string;

  /**
   * The hint text to be displayed under the label.
   * It's translatable by default and supports string interpolation.
   * @examples ["Hint 1", "My hint {$['bb-pgr-simple'].person.firstName}"]
   */
  hint?: string;

  /**
   * Name of the icon representing the option.
   * Available icon names can be found in the NDBX documentation: https://ngx-brand-kit.frameworks.allianz.io/documentation/icon/overview.
   * @examples ["product-car-front", "product-house"]
   *
   */
  icon?: string;

  /**
   * Path to an SVG file to be used as the icon for this option.
   * @examples ["assets/images/car-b-crash.svg"]
   */
  svg?: string;

  /**
   * Path to an SVG file to be used as the icon when this option is selected.
   * @examples ["assets/images/car-b-crash_active.svg"]
   */
  svgChecked?: string;

  /**
   * Text displayed in the option.
   * It's translatable by default and supports string interpolation.
   * @examples ["Option 1", "My option {$['bb-pgr-simple'].person.firstName}"]
   */
  circleText?: string;
}

results matching ""

    No results matching ""