Skip to content

@serenity-is/corelib / FormatterBase

Abstract Class: FormatterBase

Defined in: src/ui/formatters/formatterbase.ts:9

Base class for Serenity formatters. Provides the static registerFormatter helper used by formatter subclasses with static [Symbol.typeInfo] = this.registerFormatter(...).

Implements

Constructors

Constructor

new FormatterBase(): FormatterBase

Returns

FormatterBase

Properties

[typeInfo]

static [typeInfo]: FormatterTypeInfo<"Serenity.">

Defined in: src/ui/formatters/formatterbase.ts:33

Methods

format()

abstract format(ctx): FormatterResult

Defined in: src/ui/formatters/formatterbase.ts:15

Formats the cell value.

Parameters

ctx

FormatterContext

Formatter context containing item/column/value/grid.

Returns

FormatterResult

Rendered content for the cell.

Implementation of

Formatter.format


registerFormatter()

protected static registerFormatter<TypeName>(typeName, intfAndAttr?): FormatterTypeInfo<TypeName>

Defined in: src/ui/formatters/formatterbase.ts:24

Registers the formatter type under the given formal name.

Type Parameters

TypeName

TypeName

String literal for the formatter's full name.

Parameters

typeName

StringLiteral<TypeName>

Full name (e.g. "MyProject.MyFormatter").

intfAndAttr?

(InterfaceType | AttributeSpecifier)[]

Optional interfaces / attribute specifiers.

Returns

FormatterTypeInfo<TypeName>

The created type info.