Figure out how we can support configuration that depends on the value of the field or values of the entry it belongs to. Example:
select('Status', {
width: 0.2,
initialValue: 'draft',
options(entry) {
if (entry.status === 'something') return {sent: 'Different options'}
return {
draft: 'Draft',
sent: 'Sent'
}
},
readOnly(entry) {
return entry.status === 'sent'
},
visible(entry) {
return entry.status !== 'paid' && entry.status !== 'credited'
}
})
The type of entry cannot be inferred in any way so it will have to be user supplied. We might possibly use to the generated types but that could cause potential circular issues with typescript compiler. Especially if it changes the underlying value, like in the options example above it will be impossible and we'll have to force a return type. We'll need a section in the docs that highlights how to manage these.
Figure out how we can support configuration that depends on the value of the field or values of the entry it belongs to. Example:
The type of entry cannot be inferred in any way so it will have to be user supplied. We might possibly use to the generated types but that could cause potential circular issues with typescript compiler. Especially if it changes the underlying value, like in the options example above it will be impossible and we'll have to force a return type. We'll need a section in the docs that highlights how to manage these.