1
0
mirror of synced 2024-11-21 21:06:04 +03:00

refactor!: FormularioFieldGroup - isArrayItem prop no longer required, replaced with integer name value detection

This commit is contained in:
Zaytsev Kirill 2021-05-30 14:12:58 +03:00
parent 0cba9e56b3
commit 6612d8a5f9
3 changed files with 8 additions and 9 deletions

View File

@ -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()
}
}

View File

@ -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>

View File

@ -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