add autoscrollFields prop

This commit is contained in:
Pete Matsyburka
2024-04-08 18:34:27 +03:00
parent 04e30dbdd6
commit dcb963b623
3 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
</label> </label>
<button <button
class="btn btn-outline btn-sm !normal-case font-normal" class="btn btn-outline btn-sm !normal-case font-normal"
@click.prevent="setCurrentDate" @click.prevent="[setCurrentDate(), $emit('focus')]"
> >
<IconCalendarCheck :width="16" /> <IconCalendarCheck :width="16" />
{{ t('set_today') }} {{ t('set_today') }}
+8 -3
View File
@@ -544,6 +544,11 @@ export default {
required: false, required: false,
default: false default: false
}, },
autoscrollFields: {
type: Boolean,
required: false,
default: true
},
showFieldNames: { showFieldNames: {
type: Boolean, type: Boolean,
required: false, required: false,
@@ -900,9 +905,9 @@ export default {
if (scrollToArea) { if (scrollToArea) {
this.scrollIntoField(step[0]) this.scrollIntoField(step[0])
}
this.$refs.form.querySelector('input[type="date"], input[type="number"], input[type="text"], select')?.focus() this.$refs.form.querySelector('input[type="date"], input[type="number"], input[type="text"], select')?.focus()
}
if (clickUpload && !this.values[this.currentField.uuid] && ['file', 'image'].includes(this.currentField.type)) { if (clickUpload && !this.values[this.currentField.uuid] && ['file', 'image'].includes(this.currentField.type)) {
this.$refs.form.querySelector('input[type="file"]')?.click() this.$refs.form.querySelector('input[type="file"]')?.click()
@@ -976,7 +981,7 @@ export default {
const nextStep = (isLastStep && emptyRequiredField) || this.stepFields[this.currentStep + 1] const nextStep = (isLastStep && emptyRequiredField) || this.stepFields[this.currentStep + 1]
if (nextStep) { if (nextStep) {
this.goToStep(nextStep, true) this.goToStep(nextStep, this.autoscrollFields)
if (emptyRequiredField === nextStep) { if (emptyRequiredField === nextStep) {
this.showFillAllRequiredFields = true this.showFillAllRequiredFields = true
@@ -193,8 +193,6 @@ export default {
this.$refs.canvas.getContext('2d').scale(scale, scale) this.$refs.canvas.getContext('2d').scale(scale, scale)
} }
this.$refs.textInput?.focus()
}) })
if (this.$refs.canvas) { if (this.$refs.canvas) {