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)) {
|
if (!this.hasModel && !shallowEquals(newValue, oldValue)) {
|
||||||
this.model = newValue
|
this.model = newValue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.validationBehavior === VALIDATION_BEHAVIOR.LIVE) {
|
if (this.validationBehavior === VALIDATION_BEHAVIOR.LIVE) {
|
||||||
this.runValidation()
|
this.runValidation()
|
||||||
} else {
|
} else {
|
||||||
this.violations = []
|
this.resetValidation()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,20 +20,19 @@ export default class FormularioFieldGroup extends Vue {
|
|||||||
@Prop({ required: true })
|
@Prop({ required: true })
|
||||||
readonly name!: string
|
readonly name!: string
|
||||||
|
|
||||||
@Prop({ default: false })
|
|
||||||
readonly isArrayItem!: boolean
|
|
||||||
|
|
||||||
@Provide('__Formulario_path')
|
@Provide('__Formulario_path')
|
||||||
get fullPath (): string {
|
get fullPath (): string {
|
||||||
if (this.isArrayItem) {
|
const name = `${this.name}`
|
||||||
return `${this.__Formulario_path}[${this.name}]`
|
|
||||||
|
if (parseInt(name).toString() === name) {
|
||||||
|
return `${this.__Formulario_path}[${name}]`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.__Formulario_path === '') {
|
if (this.__Formulario_path === '') {
|
||||||
return this.name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${this.__Formulario_path}.${this.name}`
|
return `${this.__Formulario_path}.${name}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
v-for="(address, addressIndex) in addressList.context.model"
|
v-for="(address, addressIndex) in addressList.context.model"
|
||||||
:key="'address-' + addressIndex"
|
:key="'address-' + addressIndex"
|
||||||
:name="addressIndex"
|
:name="addressIndex"
|
||||||
:is-array-item="true"
|
|
||||||
class="row mx-n2"
|
class="row mx-n2"
|
||||||
>
|
>
|
||||||
<FormularioField
|
<FormularioField
|
||||||
|
Loading…
x
Reference in New Issue
Block a user