Skip to main content

Introducing Workflow Engine, try for FREE workflowengine.io.

Class: OneOfBuilder<T>

@react-form-builder/core.OneOfBuilder

The builder class to define the metadata property of the form builder component. Used for properties where the property value can be selected from one of the predefined values.

Type parameters

NameDescription
Tthe property type.

Hierarchy

Constructors

constructor

new OneOfBuilder<T>()

Type parameters

Name
T

Inherited from

QuantifierBuilder.constructor

Properties

annotation

annotation: PreAnnotation

Partial metadata for a component property.

Inherited from

QuantifierBuilder.annotation


labels

Optional labels: string[]

Labels for the possible values of the property.

Inherited from

QuantifierBuilder.labels


options

options: BuilderOptions

Options for building an annotation.

Inherited from

QuantifierBuilder.options


values

values: (string | number)[]

Possible values for the property.

Inherited from

QuantifierBuilder.values

Accessors

localize

get localize(): this

Returns

this

the component property that can be localized.

Inherited from

QuantifierBuilder.localize


notLocalize

get notLocalize(): this

Returns

this

the non-localizable component property.

Inherited from

QuantifierBuilder.notLocalize


required

get required(): QuantifierBuilder<NonNullable<T>>

Marks the component property as required.

Returns

QuantifierBuilder<NonNullable<T>>

the modified instance of the builder.

Inherited from

QuantifierBuilder.required


valued

get valued(): this

Returns

this

the main component property that is used as form data and for validation rules.

Inherited from

QuantifierBuilder.valued

Methods

build

build(key): Annotation

Creates component property metadata for the form builder.

Parameters

NameTypeDescription
keystringthe unique key of the component property.

Returns

Annotation

the instance of the component property metadata for the form builder.

Inherited from

QuantifierBuilder.build


calculable

calculable(calculable): OneOfBuilder<T>

Marks the component property as calculable.

Parameters

NameTypeDescription
calculablebooleantrue if the property is calculable.

Returns

OneOfBuilder<T>

the modified instance of the builder.

Inherited from

QuantifierBuilder.calculable


clone

clone(): OneOfBuilder<T>

Clones the instance of the builder.

Returns

OneOfBuilder<T>

the cloned instance of the builder.

Inherited from

QuantifierBuilder.clone


default

default(value): OneOfBuilder<T>

Sets the default value for the component property.

Parameters

NameTypeDescription
valueTthe default value.

Returns

OneOfBuilder<T>

the modified instance of the builder.

Overrides

QuantifierBuilder.default


getName

Protected getName(key): string

Returns the annotation name.

Parameters

NameTypeDescription
keystringthe property name

Returns

string

the annotation name.

Inherited from

QuantifierBuilder.getName


hinted

hinted(hint): OneOfBuilder<T>

Adds the hint to the property name of the component.

Parameters

NameTypeDescription
hintReactNodethe hint.

Returns

OneOfBuilder<T>

the modified instance of the builder.

Inherited from

QuantifierBuilder.hinted


labeled

labeled(...labels): OneOfBuilder<T>

Sets the labels for predefined values.

Parameters

NameTypeDescription
...labelsstring[]the labels.

Returns

OneOfBuilder<T>

the modified instance of the builder.

Inherited from

QuantifierBuilder.labeled


named

named(name): OneOfBuilder<T>

Specifies the name of the component property.

Parameters

NameTypeDescription
namestringthe property name.

Returns

OneOfBuilder<T>

the modified instance of the builder.

Inherited from

QuantifierBuilder.named


radio

radio(): OneOfBuilder<T>

Sets the radio buttons as the component's property editor.

Returns

OneOfBuilder<T>

the modified instance of the builder.


setup

setup(options): OneOfBuilder<T>

Modifies the component property metadata builder with custom options.

Parameters

NameTypeDescription
optionsPartial<Partial<Omit<Annotation, "key">> & Pick<Annotation, "editor"> & BuilderOptions>the custom options.

Returns

OneOfBuilder<T>

the modified instance of the builder.

Inherited from

QuantifierBuilder.setup


validated

validated(validator, errorMap): OneOfBuilder<T>

Modifies the component property metadata builder with validation properties.

Parameters

NameTypeDescription
validatorRuleValidator<T>the validation function.
errorMapErrorMapthe validation error settings.

Returns

OneOfBuilder<T>

the modified instance of the builder.

Inherited from

QuantifierBuilder.validated


withEditorProps

withEditorProps(props): OneOfBuilder<T>

Sets custom properties for the component's property editor.

Parameters

NameTypeDescription
propsanythe custom properties

Returns

OneOfBuilder<T>

the modified instance of the builder.

Inherited from

QuantifierBuilder.withEditorProps