(ns, opt, cb)
| 59 | }, |
| 60 | |
| 61 | validateFieldsAndScroll(ns, opt, cb) { |
| 62 | const { names, callback, options } = getParams(ns, opt, cb); |
| 63 | |
| 64 | const newCb = (error, values) => { |
| 65 | if (error) { |
| 66 | const validNames = this.fieldsStore.getValidFieldsName(); |
| 67 | let firstNode; |
| 68 | let firstTop; |
| 69 | |
| 70 | validNames.forEach((name) => { |
| 71 | if (has(error, name)) { |
| 72 | const instance = this.getFieldInstance(name); |
| 73 | if (instance) { |
| 74 | const node = ReactDOM.findDOMNode(instance); |
| 75 | const top = node.getBoundingClientRect().top; |
| 76 | if (node.type !== 'hidden' && (firstTop === undefined || firstTop > top)) { |
| 77 | firstTop = top; |
| 78 | firstNode = node; |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | }); |
| 83 | |
| 84 | if (firstNode) { |
| 85 | const c = options.container || getScrollableContainer(firstNode); |
| 86 | scrollIntoView(firstNode, c, { |
| 87 | onlyScrollIfNeeded: true, |
| 88 | ...options.scroll, |
| 89 | }); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | if (typeof callback === 'function') { |
| 94 | callback(error, values); |
| 95 | } |
| 96 | }; |
| 97 | |
| 98 | return this.validateFields(names, options, newCb); |
| 99 | }, |
| 100 | }; |
| 101 | |
| 102 | function createDOMForm(option) { |
nothing calls this directly
no test coverage detected