refactor!: FormularioFieldGroup - isArrayItem prop no longer required, replaced with integer name value detection
This commit is contained in:
parent
0cba9e56b3
commit
6612d8a5f9
@ -149,10 +149,11 @@ export default class FormularioField extends Vue {
|
||||
if (!this.hasModel && !shallowEquals(newValue, oldValue)) {
|
||||
this.model = newValue
|
||||
}
|
||||
|
||||
if (this.validationBehavior === VALIDATION_BEHAVIOR.LIVE) {
|
||||
this.runValidation()
|
||||
} else {
|
||||
this.violations = []
|
||||
this.resetValidation()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,20 +20,19 @@ export default class FormularioFieldGroup extends Vue {
|
||||
@Prop({ required: true })
|
||||
readonly name!: string
|
||||
|
||||
@Prop({ default: false })
|
||||
readonly isArrayItem!: boolean
|
||||
|
||||
@Provide('__Formulario_path')
|
||||
get fullPath (): string {
|
||||
if (this.isArrayItem) {
|
||||
return `${this.__Formulario_path}[${this.name}]`
|
||||
const name = `${this.name}`
|
||||
|
||||
if (parseInt(name).toString() === name) {
|
||||
return `${this.__Formulario_path}[${name}]`
|
||||
}
|
||||
|
||||
if (this.__Formulario_path === '') {
|
||||
return this.name
|
||||
return name
|
||||
}
|
||||
|
||||
return `${this.__Formulario_path}.${this.name}`
|
||||
return `${this.__Formulario_path}.${name}`
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -11,7 +11,6 @@
|
||||
v-for="(address, addressIndex) in addressList.context.model"
|
||||
:key="'address-' + addressIndex"
|
||||
:name="addressIndex"
|
||||
:is-array-item="true"
|
||||
class="row mx-n2"
|
||||
>
|
||||
<FormularioField
|
||||
|
Loading…
Reference in New Issue
Block a user