A facade to access the formatters from client code. The idea is that for a column the resolveFormattingInfo method is used to lookup a matching formatter for the column values. This formatting infos can be used during column rendering to trigger the formatters.

interface FormatterFacade {
    format(values: any[], options: FormattingInfo): string;
    hasFormatter(formatterId: string): boolean;
    resolveFormattingInfo(
        fields: FieldData[],
        context: {
            dataSourceId: string;
            isDomainValueField(fieldName: string): boolean;
            resolveDefaultOptions(fieldName: string): undefined | FormatterOptions;
        },
    ): undefined
    | FormattingInfo;
}

Methods

  • Formats values using the resolved formatter infos.

    Parameters

    • values: any[]

      values to format

    • options: FormattingInfo

      infos resolved by the resolveFormattingInfo method.

    Returns string

  • Allows Testing for the existence of a given formatter id.

    Parameters

    • formatterId: string

    Returns boolean

  • Resolve a formatting infos for a column, which may be a combination of multiple fields.

    Parameters

    • fields: FieldData[]
    • context: {
          dataSourceId: string;
          isDomainValueField(fieldName: string): boolean;
          resolveDefaultOptions(fieldName: string): undefined | FormatterOptions;
      }

    Returns undefined | FormattingInfo

    FormattingInfo or undefined. Undefined has the effect that the fields are not displayed.