Skip to content

Commit 3353860

Browse files
committed
Add empty formatValueToField & formatValueToModel. Fix #308 #276
1 parent 5cdc4ce commit 3353860

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/fields/abstractField.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,13 @@ export default {
3939
else if (this.model && this.schema.model)
4040
val = objGet(this.model, this.schema.model);
4141

42-
if (isFunction(this.formatValueToField))
43-
val = this.formatValueToField(val);
44-
45-
return val;
42+
return this.formatValueToField(val);
4643
},
4744

4845
set(newValue) {
4946
let oldValue = this.value;
5047

51-
if (isFunction(this.formatValueToModel))
52-
newValue = this.formatValueToModel(newValue);
48+
newValue = this.formatValueToModel(newValue);
5349

5450
let changed = false;
5551
if (isFunction(this.schema.set)) {
@@ -167,7 +163,14 @@ export default {
167163
getFieldID(schema) {
168164
const idPrefix = this.formOptions && this.formOptions.fieldIdPrefix ? this.formOptions.fieldIdPrefix : "";
169165
return slugifyFormID(schema, idPrefix);
170-
}
166+
},
171167

168+
formatValueToField(value) {
169+
return value;
170+
},
171+
172+
formatValueToModel(value) {
173+
return value;
174+
}
172175
}
173176
};

0 commit comments

Comments
 (0)