FaasJS
Home
  • Guide
  • Documents
  • Starter Template
  • Changelog
  • Ecosystem

    • VS Code Plugin
    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security
  • English
  • 简体中文
Home
  • Guide
  • Documents
  • Starter Template
  • Changelog
  • Ecosystem

    • VS Code Plugin
    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security
  • English
  • 简体中文

Documents / @faasjs/ant-design / UnionFaasItemProps

Interface: UnionFaasItemProps<Value, Values>

Interface representing the properties of a UnionFaas item.

The UnionFaas item can be used in a form, description, or table.

Render Priority Order

  1. Null Rendering (Notice: it also doesn't render column in table and description)
    1. Returns null if specific children or render props are null:
      • formChildren / descriptionChildren / tableChildren / formRender / descriptionRender / tableRender
    2. Returns null if children or render prop is null
  2. Children Rendering
    1. First priority: Component-specific children
      • formChildren for Form
      • descriptionChildren for Description
      • tableChildren for Table
    2. Second priority: Generic children prop
  3. Custom Render Functions
    1. First priority: Component-specific render functions
      • formRender for Form
      • descriptionRender for Description
      • tableRender for Table
    2. Second priority: Generic render prop
  4. Extended Types
    • Renders based on registered extended type handlers
  5. Default Rendering
    • Renders primitive types (string, number, etc.)
    • Uses default formatting based on data type

Example

import { type UnionFaasItemProps, Form, Table, Description } from '@faasjs/ant-design'

const item: UnionFaasItemProps[] = [
  {
    id: 'id',
    formChildren: null, // Don't show in form, only in description and table
  },
  {
    id: 'name',
    required: true, // Required in form
  },
  {
    id: 'age',
    type: 'number', // Number type in form, description and table
    options: ['< 18', '>= 18'], // Options in form and table
  }
]

const data = {
  id: '1',
  name: 'John',
  age: '>= 18',
}

function App() {
  return <>
    <Form items={item} /> // Use in form
    <Description items={item} dataSource={data} /> // Use in description
    <Table items={item} dataSource={[ data ]} /> // Use in table
  </>
}

Extends

  • FormItemProps.DescriptionItemProps.TableItemProps

Type Parameters

Value

Value = any

Values

Values = any

Properties

children?

optional children: UnionFaasItemElement<Value, Values>

Overrides

TableItemProps.children

col?

optional col: number

Inherited from

FormItemProps.col

descriptionChildren?

optional descriptionChildren: UnionFaasItemElement<any>

Inherited from

DescriptionItemProps.descriptionChildren

descriptionRender?

optional descriptionRender: UnionFaasItemRender<any>

Inherited from

DescriptionItemProps.descriptionRender

disabled?

optional disabled: boolean

Inherited from

FormItemProps.disabled

extendTypes?

optional extendTypes: ExtendTypes

Inherited from

FormItemProps.extendTypes

formChildren?

optional formChildren: UnionFaasItemElement<any>

Inherited from

FormItemProps.formChildren

formRender?

optional formRender: UnionFaasItemRender<any>

Inherited from

FormItemProps.formRender

id

id: string

Inherited from

TableItemProps.id

if()?

optional if: (values) => boolean

trigger when any item's value changed

Parameters

values

Record<string, any>

Returns

boolean

Inherited from

DescriptionItemProps.if

input?

optional input: SelectProps<any, DefaultOptionType> | InputProps | RadioProps | InputNumberProps<ValueType> | SwitchProps | DatePickerProps

Inherited from

FormItemProps.input

label?

optional label: string | false

Inherited from

FormItemProps.label

maxCount?

optional maxCount: number

Inherited from

FormItemProps.maxCount

object?

optional object: UnionFaasItemProps<Value, Values>[]

Overrides

TableItemProps.object

onValueChange()?

optional onValueChange: (value, values, form) => void

trigger when current item's value changed

Parameters

value

any

values

any

form

FormInstance

Returns

void

Inherited from

FormItemProps.onValueChange

options?

optional options: BaseOption[]

Inherited from

TableItemProps.options

optionsType?

optional optionsType: "auto"

Inherited from

TableItemProps.optionsType

render?

optional render: UnionFaasItemRender<Value, Values>

Overrides

TableItemProps.render

required?

optional required: boolean

Inherited from

FormItemProps.required

rules?

optional rules: RuleObject[]

Inherited from

FormItemProps.rules

tableChildren?

optional tableChildren: UnionFaasItemElement<any>

Inherited from

TableItemProps.tableChildren

tableRender?

optional tableRender: UnionFaasItemRender<any>

Inherited from

TableItemProps.tableRender

title?

optional title: string

Inherited from

TableItemProps.title

type?

optional type: FaasItemType

Support string, string[], number, number[], boolean, date, time, object, object[]

Default

'string'

Inherited from

TableItemProps.type