Skip to content

Commit d58b4d3

Browse files
committed
fix: componentProps not being passed to custom component
The field `props` was being passed to child component, but not `componentProps`
1 parent fc88eb8 commit d58b4d3

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/parser/index.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,38 +33,37 @@ export class Parser {
3333
if (field.props.options) return 'select'
3434
return 'custom'
3535
}
36-
36+
3737
getFieldComponent(field: Field): VueComponent {
3838
return field.component || this.components[field.type]
3939
}
40-
40+
4141
getFieldComponentProps(field: Field): VueComponentProps {
42-
let props = {... field.props }
42+
let props = { ...field.props, ...field.componentProps }
4343
if (!props.name)
4444
props.name = field.name
45-
if (this.attachRandomId && field.label !== 'none' && !props.hidden)
45+
if (this.attachRandomId && field.label !== 'none' && !props.hidden)
4646
props.id = 'VFB' + generateRandomDigits(10)
4747
return props
4848
}
49-
49+
5050
getFieldWrapperComponent(field: Field): VueComponent {
5151
let defaultWrapper = this.wrapper
5252
if (field.props.hidden === true)
5353
defaultWrapper = 'div'
5454
return field.componentWrapper || field.wrapper || defaultWrapper
5555
}
56-
56+
5757
getFieldWrapperComponentProps(field: Field): VueComponentProps {
5858
// if already set, return it
5959
if (field.propsWrapper)
6060
return field.propsWrapper
6161

6262
// begin with empty props
63-
const props : VueComponentProps = {}
63+
const props: VueComponentProps = {}
6464

6565
// add label information
66-
if (!field.props.hidden && field.label !== 'none')
67-
{
66+
if (!field.props.hidden && field.label !== 'none') {
6867
if (field.props.id && !['radio', 'checkboxes'].includes(field.type))
6968
props.labelFor = field.props.id
7069
if (field.label)

0 commit comments

Comments
 (0)