Skip to content

Commit 9e09369

Browse files
committed
Merge branch 'master' into production
2 parents 2a7787b + 09b3f1c commit 9e09369

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/formGenerator.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</fieldset>
1818

1919
<template v-for="group in groups" :key="group">
20-
<fieldset :is="tag" :class="getFieldRowClasses(group)">
20+
<fieldset :is="tag" v-if="groupVisible(group)" :class="getFieldRowClasses(group)">
2121
<legend v-if="group.legend">
2222
{{ group.legend }}
2323
</legend>
@@ -159,7 +159,11 @@ export default {
159159
},
160160
161161
methods: {
162-
// Get visible prop of field
162+
/**
163+
* Determine visibility of the field.
164+
* @param field
165+
* @returns {boolean|*|boolean}
166+
*/
163167
fieldVisible(field) {
164168
if (isFunction(field.visible)) return field.visible.call(this, this.model, field, this)
165169
@@ -168,6 +172,19 @@ export default {
168172
return field.visible
169173
},
170174
175+
/**
176+
* Determine if the group should be visible.
177+
* @param group
178+
* @returns {boolean|*|boolean}
179+
*/
180+
groupVisible (group) {
181+
if (isFunction(group.visible)) return group.visible.call(this, this.model, group, this)
182+
183+
if (isNil(group.visible)) return true
184+
185+
return group.visible
186+
},
187+
171188
// Child field executed validation
172189
onFieldValidated(res, errors, field) {
173190
// Remove old errors for this field

0 commit comments

Comments
 (0)