File

libs/core-forms/src/lib/summary-component-plugin/summary-config.model.ts

Description

The config a SummaryComponent field carries in a CoreForms form-config.

Kept apart from summary.component.ts so that reading the shape does not mean loading the component: apps/cmx-coreforms-editor generates the controls that author this object from the types below, and it is a React app whose TypeScript program has no Angular in it. Nothing here may import — that is what makes the file readable from both sides.

Index

Properties

Properties

fields (Optional)
Type Array<string>
Description

Optional allowlist, only fields specified here will be included in the summary. If not provided or empty, all fields will be included.

Example :
[
  "firstName",
  "lastName",
  "email"
]
translations
Type SummaryConfigTranslations
Description

Dictionary for field translations.

export interface SummaryConfig {
  /**
   * Dictionary for field translations.
   */
  translations: SummaryConfigTranslations;
  /**
   * Optional allowlist, only fields specified here will be included in the summary.
   * If not provided or empty, all fields will be included.
   *
   * @example
   * ```json
   * [
   *   "firstName",
   *   "lastName",
   *   "email"
   * ]
   * ```
   */
  fields?: Array<string>;
}

export interface SummaryConfigTranslations {
  /**
   * Translation for boolean true.
   *
   * @example
   * Yes
   */
  booleanTrue: string;
  /**
   * Translation for boolean false.
   * @example
   * No
   */
  booleanFalse: string;
}

/**
 * The `CUSTOM_COMPONENT` fields a summary never reads back, by their `name`.
 *
 * Neither holds an answer the user gave: a captcha's value is a one-time token, and a hidden field's
 * is set by the journey rather than typed. They are left out whether or not `fields` lists them.
 *
 * Exported because the editor that authors `fields` has to offer the same set of fields this component
 * will actually show — a list it offers and then silently drops is worse than no list at all.
 */
export const SUMMARY_EXCLUDED_CUSTOM_COMPONENTS: ReadonlyArray<string> = [
  'TurnstileComponent',
  'HiddenFieldComponent'
];

results matching ""

    No results matching ""