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
- Null Rendering (Notice: it also doesn't render column in table and description)
- Returns
null
if specific children or render props are null:formChildren
/descriptionChildren
/tableChildren
/formRender
/descriptionRender
/tableRender
- Returns
null
ifchildren
orrender
prop is null
- Returns
- Children Rendering
- First priority: Component-specific children
formChildren
for FormdescriptionChildren
for DescriptiontableChildren
for Table
- Second priority: Generic
children
prop
- First priority: Component-specific children
- Custom Render Functions
- First priority: Component-specific render functions
formRender
for FormdescriptionRender
for DescriptiontableRender
for Table
- Second priority: Generic
render
prop
- First priority: Component-specific render functions
- Extended Types
- Renders based on registered extended type handlers
- 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
Type Parameters
• Value = any
• Values = any
Properties
children?
optional
children:UnionFaasItemElement
<Value
,Values
>
Overrides
col?
optional
col:number
Inherited from
descriptionChildren?
optional
descriptionChildren:UnionFaasItemElement
<any
>
Inherited from
DescriptionItemProps
.descriptionChildren
descriptionRender?
optional
descriptionRender:UnionFaasItemRender
<any
>
Inherited from
DescriptionItemProps
.descriptionRender
disabled?
optional
disabled:boolean
Inherited from
extendTypes?
optional
extendTypes:ExtendTypes
Inherited from
formChildren?
optional
formChildren:UnionFaasItemElement
<any
>
Inherited from
formRender?
optional
formRender:UnionFaasItemRender
<any
>
Inherited from
id
id:
string
Inherited from
if()?
optional
if: (values
) =>boolean
trigger when any item's value changed
Parameters
values
Record
<string
, any
>
Returns
boolean
Inherited from
input?
optional
input:SelectProps
|InputProps
|RadioProps
|InputNumberProps
|SwitchProps
|DatePickerProps
Inherited from
label?
optional
label:string
|false
Inherited from
maxCount?
optional
maxCount:number
Inherited from
object?
optional
object:UnionFaasItemProps
<Value
,Values
>[]
Overrides
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
options?
optional
options:BaseOption
[]
Inherited from
optionsType?
optional
optionsType:"auto"
Inherited from
render?
optional
render:UnionFaasItemRender
<Value
,Values
>
Overrides
required?
optional
required:boolean
Inherited from
rules?
optional
rules:RuleObject
[]
Inherited from
tableChildren?
optional
tableChildren:UnionFaasItemElement
<any
>
Inherited from
tableRender?
optional
tableRender:UnionFaasItemRender
<any
>
Inherited from
title?
optional
title:string
Inherited from
type?
optional
type:FaasItemType
Support string, string[], number, number[], boolean, date, time, object, object[]
Default
'string'