File

libs/core/dynamic-form/date/src/date.model.ts

Description

Configuration for a date input field.

Extends

DfInteractiveBaseConfig

Index

Properties

Properties

dayDisabled (Optional)
Type boolean
Description

When set to true, the user cannot choose a day. Day will always be set to 01.

displayFormat (Optional)
Type string
Description

The display format for the date input.

Refer the NDBX datefield documentation for details: https://api-test.allianz.com/ngx-ndbx-next/documentation/datefield

hideCalendarPicker (Optional)
Type boolean
inputPrefix (Optional)
Type string
Description

Prefix text to place at the start of this field's input. It's translatable by default and supports string interpolation.

inputSuffix (Optional)
Type string
Description

Suffix text to place at the end of this field's input. It's translatable by default and supports string interpolation.

nonStrictParsing (Optional)
Type boolean
Description

The ndbx date picker supports a non-strict parsing. This makes it possible to enter dates without separators like / or .

When the non strict parsing is active, the datepicker will also automatically format the date to what it detected.

onlyYears (Optional)
Type boolean
Description

When set to true, the user cannot choose a day or a month. Day and month will always be set to 01.

panelClass (Optional)
Type string | string[]
Description

Classes to be passed to the date picker panel. Supports the same syntax as ngClass.

parseFormat (Optional)
Type string | string[]
Description

The parse format for the date input.

The formats are dependent on the date-adapter.

Day.js formats: https://day.js.org/docs/en/parse/string-format

Refer the NDBX datefield documentation for details: https://api-test.allianz.com/ngx-ndbx-next/documentation/datefield

placeholder (Optional)
Type string
Description

Placeholder to be displayed in the field when the input is empty. It's translatable by default and supports string interpolation.

startAt (Optional)
Type string
Description

The date on which to open the calendar initially.

Note that this is not the same thing as the date field's initial value, which still defaults to empty.

startView (Optional)
Type DfDateStartViewType
Description

The view that the calendar should start with.

Defaults to month.

type
Description

Specifies the type of the field as DATE.

value (Optional)
Type DfDateDefaultValues |
Description

The value can be a Date or a string with "TODAY", "TOMORROW" or "YESTERDAY" In those cases, the datepicker starts prefilled with those dates.

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

/**
 * The value to use for the `type` attribute of date
 * formfield configs.
 */
export const DfDateTypeName = 'DATE';

/**
 * Available views that the date picker's calendar can start with.
 *
 * month: Start the calendar on the month view, which shows all days of that month.
 * year: Start the calendar on the year view, which shows all months of that year.
 * multi-year: Start the calendar on the multi-year view, which shows a range of years.
 */
export const DfDateStartViewType = {
  Month: 'month',
  Year: 'year',
  MultiYear: 'multi-year'
} as const;
export type DfDateStartViewType = (typeof DfDateStartViewType)[keyof typeof DfDateStartViewType];

/**
 * Configuration for a date input field.
 *
 * @additionalProperties false
 */
export interface DfDateConfig extends DfInteractiveBaseConfig {
  /**
   * The value can be a Date or a string with "TODAY", "TOMORROW" or "YESTERDAY"
   * In those cases, the datepicker starts prefilled with those dates.
   */
  value?: DfDateDefaultValues | unknown;

  /**
   * Specifies the type of the field as `DATE`.
   */
  type: typeof DfDateTypeName;

  /**
   * Placeholder to be displayed in the field when the input is empty.
   * It's translatable by default and supports string interpolation.
   * @examples ["Placeholder", "Placeholder with dynamic value {$['bb-pgr-simple'].date}"]
   */
  placeholder?: string;

  /**
   * The display format for the date input.
   *
   * Refer the NDBX datefield documentation for details:
   * https://api-test.allianz.com/ngx-ndbx-next/documentation/datefield
   */
  displayFormat?: string;

  /**
   * The date on which to open the calendar initially.
   *
   * Note that this is not the same thing as the date field's initial value, which
   * still defaults to empty.
   */
  startAt?: string;

  /**
   * The parse format for the date input.
   *
   * The formats are dependent on the date-adapter.
   *
   * Day.js formats: https://day.js.org/docs/en/parse/string-format
   *
   * Refer the NDBX datefield documentation for details:
   * https://api-test.allianz.com/ngx-ndbx-next/documentation/datefield
   */
  parseFormat?: string | string[];

  /**
   * The view that the calendar should start with.
   *
   * Defaults to month.
   */
  startView?: DfDateStartViewType;

  /**
   * The ndbx date picker supports a non-strict parsing. This
   * makes it possible to enter dates without separators like / or .
   *
   * When the non strict parsing is active, the datepicker will also automatically
   * format the date to what it detected.
   */
  nonStrictParsing?: boolean;

  /**
   * When set to true, the user cannot choose a day.
   * Day will always be set to 01.
   */
  dayDisabled?: boolean;
  /**
   * When set to true, the user cannot choose a day or a month.
   * Day and month will always be set to 01.
   */
  onlyYears?: boolean;
  /**
   * Classes to be passed to the date picker panel. Supports the same syntax as ngClass.
   */
  panelClass?: string | string[];

  /*
   * Boolean to hide the calendar picker
   */
  hideCalendarPicker?: boolean;

  /**
   * Prefix text to place at the start of this field's input.
   * It's translatable by default and supports string interpolation.
   */
  inputPrefix?: string;

  /**
   * Suffix text to place at the end of this field's input.
   * It's translatable by default and supports string interpolation.
   */
  inputSuffix?: string;
}

/**
 * Default values for the DATE
 */
export const DfDateDefaultValues = {
  Yesterday: 'YESTERDAY',
  Today: 'TODAY',
  Tomorrow: 'TOMORROW'
} as const;
export type DfDateDefaultValues = (typeof DfDateDefaultValues)[keyof typeof DfDateDefaultValues];

results matching ""

    No results matching ""