6
6
</div >
7
7
<form
8
8
v-else-if =" dataForm"
9
+ :style =" computedStyle"
9
10
@submit.prevent =" "
10
11
>
11
12
<template v-if =" form .show_progress_bar " >
77
78
ref =" hcaptcha"
78
79
:sitekey =" hCaptchaSiteKey"
79
80
:theme =" darkMode?'dark':'light'"
81
+ @opened =" setMinHeight(500)"
82
+ @closed =" setMinHeight(0)"
80
83
/>
81
84
<has-error
82
85
:form =" dataForm"
@@ -179,6 +182,7 @@ export default {
179
182
dataForm,
180
183
recordsStore,
181
184
workingFormStore,
185
+ isIframe: useIsIframe (),
182
186
draggingNewBlock: computed (() => workingFormStore .draggingNewBlock ),
183
187
pendingSubmission: pendingSubmission (props .form )
184
188
}
@@ -191,6 +195,7 @@ export default {
191
195
* Used to force refresh components by changing their keys
192
196
*/
193
197
isAutoSubmit: false ,
198
+ minHeight: 0
194
199
}
195
200
},
196
201
@@ -290,6 +295,11 @@ export default {
290
295
}
291
296
})
292
297
return data
298
+ },
299
+ computedStyle () {
300
+ return {
301
+ ... this .minHeight ? {minHeight: this .minHeight + ' px' } : {}
302
+ }
293
303
}
294
304
},
295
305
@@ -452,7 +462,7 @@ export default {
452
462
nextPage () {
453
463
if (this .adminPreview || this .urlPrefillPreview ) {
454
464
this .currentFieldGroupIndex += 1
455
- window .scrollTo ({ top: 0 , behavior: ' smooth' })
465
+ window .scrollTo ({top: 0 , behavior: ' smooth' })
456
466
return false
457
467
}
458
468
const fieldsToValidate = this .currentFields .map (f => f .id )
@@ -463,28 +473,28 @@ export default {
463
473
this .dataForm .busy = false
464
474
window .scrollTo ({top: 0 , behavior: ' smooth' })
465
475
}).catch (error => {
466
- console .error (error)
467
- if (error && error .data && error .data .message ) {
468
- useAlert ().error (error .data .message )
469
- }
470
- this .dataForm .busy = false
471
- })
476
+ console .error (error)
477
+ if (error && error .data && error .data .message ) {
478
+ useAlert ().error (error .data .message )
479
+ }
480
+ this .dataForm .busy = false
481
+ })
472
482
return false
473
483
},
474
484
isFieldHidden (field ) {
475
485
return (new FormLogicPropertyResolver (field, this .dataFormValue )).isHidden ()
476
486
},
477
- getTargetFieldIndex (currentFieldPageIndex ){
487
+ getTargetFieldIndex (currentFieldPageIndex ) {
478
488
let targetIndex = 0
479
- if (this .currentFieldGroupIndex > 0 ) {
480
- for (let i = 0 ; i < this .currentFieldGroupIndex ; i++ ) {
481
- targetIndex += this .fieldGroups [i].length
482
- }
483
- targetIndex += currentFieldPageIndex
484
- } else {
485
- targetIndex = currentFieldPageIndex
489
+ if (this .currentFieldGroupIndex > 0 ) {
490
+ for (let i = 0 ; i < this .currentFieldGroupIndex ; i++ ) {
491
+ targetIndex += this .fieldGroups [i].length
486
492
}
487
- return targetIndex
493
+ targetIndex += currentFieldPageIndex
494
+ } else {
495
+ targetIndex = currentFieldPageIndex
496
+ }
497
+ return targetIndex
488
498
},
489
499
handleDragDropped (data ) {
490
500
if (data .added ) {
@@ -497,6 +507,18 @@ export default {
497
507
const newTargetIndex = this .getTargetFieldIndex (data .moved .newIndex )
498
508
this .workingFormStore .moveField (oldTargetIndex, newTargetIndex)
499
509
}
510
+ },
511
+ setMinHeight (minHeight ) {
512
+ if (! this .isIframe ) {
513
+ return
514
+ }
515
+ this .minHeight = minHeight
516
+ // Trigger window iframe resize
517
+ try {
518
+ window .parentIFrame .size ()
519
+ } catch (e) {
520
+ console .error (e)
521
+ }
500
522
}
501
523
}
502
524
}
0 commit comments