Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DynamicComponent<Props, DBSchema, StoreName, Value>

A component along with the associated properties needed to render it as part of a StepDefinition.

Unlike StaticComponent, we inject some additional DynamicComponentControlledProps into the component to support interfacing with a Database. The DynamicComponentOptions.Component needs to support those extra props if it needs to interface with a Database. If not, use a StaticComponent instead.

const storeName = "myStore";

const myDatabaseMap = new ComponentDatabaseMap<
  MyDBSchema,
  typeof storeName
>({
  storeName,
  key: "input-0",
  property: ["my", "property"]
});

const myInput = new DynamicComponent({
  key: "my-input",
  Component: MyInput,
  props: {
    className: "my-input-class"
  },
  defaultValue: "Nothing here...",
  emptyValue: "",
  databaseMap: myDatabaseMap
});

Type parameters

Hierarchy

  • DynamicComponent

Index

Constructors

constructor

Properties

Component

Component: DynamicComponentType<Props, Value>

databaseMap

databaseMap: ComponentDatabaseMap<DBSchema, StoreName>

defaultValue

defaultValue: Value | null | undefined

emptyValue

emptyValue: Value

key

key: string

props

props: Props

renderWhen

renderWhen: (stepValues: {}) => boolean

Type declaration

    • (stepValues: {}): boolean
    • Parameters

      Returns boolean

required

required: ((stepValues: {}) => boolean) | boolean

Static propType

propType: Requireable<DynamicComponent<{}, NamedSchema<string, number, any>, string, any>> = PropTypes.exact({key: PropTypes.string.isRequired,Component: PropTypes.func.isRequired,props: PropTypes.object.isRequired,renderWhen: PropTypes.func.isRequired,databaseMap: ComponentDatabaseMap.propType.isRequired,defaultValue: PropTypes.any,emptyValue: PropTypes.any.isRequired,required: PropTypes.bool.isRequired,})

The proptype validator for a DynamicComponent.

Methods

Static controlledPropTypes

Generated using TypeDoc