Skip to content

Commit 5fdf339

Browse files
committed
Merge branch 'v3' into v3-features/dynamic-html-attributes
* v3: added brackets to conditional cleaned up the "clean up"
2 parents e7859b7 + 3249775 commit 5fdf339

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/fields/abstractField.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ export default {
4848
cache: false,
4949
get() {
5050
let val;
51-
if (isFunction(this.schema.get)) val = this.schema.get(this.model);
52-
else if (this.model && this.schema.model) val = objGet(this.model, this.schema.model);
51+
if (isFunction(objGet(this.schema, 'get'))) {
52+
val = this.schema.get(this.model);
53+
} else {
54+
val = objGet(this.model, this.schema.model);
55+
}
5356

5457
return this.formatValueToField(val);
5558
},
@@ -156,7 +159,7 @@ export default {
156159
this.schema.onChanged.call(this, this.model, newValue, oldValue, this.schema);
157160
}
158161

159-
if (objGet(this.$parent, "options") && objGet(this.$parent, "options.validateAfterChanged", false) === true) {
162+
if (objGet(this.$parent, "options.validateAfterChanged", false) === true) {
160163
if (objGet(this.$parent, "options.validateDebounceTime", 0) > 0) {
161164
this.debouncedValidate();
162165
} else {
@@ -203,12 +206,12 @@ export default {
203206
},
204207

205208
getFieldID(schema) {
206-
const idPrefix = this.formOptions && objGet(this.formOptions, "fieldIdPrefix") ? objGet(this.formOptions, "fieldIdPrefix") : "";
209+
const idPrefix = objGet(this.formOptions, "fieldIdPrefix", "");
207210
return slugifyFormID(schema, idPrefix);
208211
},
209212

210213
getFieldClasses() {
211-
return objGet(this.schema, "fieldClasses") || [];
214+
return objGet(this.schema, "fieldClasses", []);
212215
},
213216

214217
formatValueToField(value) {

0 commit comments

Comments
 (0)