(fields)
| 52 | } |
| 53 | |
| 54 | setFields(fields) { |
| 55 | const fieldsMeta = this.fieldsMeta; |
| 56 | const nowFields = { |
| 57 | ...this.fields, |
| 58 | ...fields, |
| 59 | }; |
| 60 | const nowValues = {}; |
| 61 | Object.keys(fieldsMeta) |
| 62 | .forEach((f) => { |
| 63 | nowValues[f] = this.getValueFromFields(f, nowFields); |
| 64 | }); |
| 65 | Object.keys(nowValues).forEach((f) => { |
| 66 | const value = nowValues[f]; |
| 67 | const fieldMeta = this.getFieldMeta(f); |
| 68 | if (fieldMeta && fieldMeta.normalize) { |
| 69 | const nowValue = |
| 70 | fieldMeta.normalize(value, this.getValueFromFields(f, this.fields), nowValues); |
| 71 | if (nowValue !== value) { |
| 72 | nowFields[f] = { |
| 73 | ...nowFields[f], |
| 74 | value: nowValue, |
| 75 | }; |
| 76 | } |
| 77 | } |
| 78 | }); |
| 79 | this.fields = nowFields; |
| 80 | } |
| 81 | |
| 82 | resetFields(ns) { |
| 83 | const { fields } = this; |
no test coverage detected