(form, expectedName, failOnMissing = true)
| 27 | } |
| 28 | |
| 29 | export const findField = (form, expectedName, failOnMissing = true) => { |
| 30 | for (const child of form.$children) { |
| 31 | let fieldName; |
| 32 | if (child.$options._componentTag === ChipsList.name) { |
| 33 | fieldName = child.title; |
| 34 | } else if (child.$options._componentTag === ScriptField.name) { |
| 35 | fieldName = child.scriptPathField.name; |
| 36 | } else { |
| 37 | fieldName = child.$props.config?.name; |
| 38 | } |
| 39 | |
| 40 | if (!isNull(fieldName) && (fieldName.toLowerCase() === expectedName.toLowerCase())) { |
| 41 | return child; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | if (failOnMissing) { |
| 46 | throw Error('Failed to find field: ' + expectedName) |
| 47 | } |
| 48 | }; |
| 49 | |
| 50 | export const findUiMappingFields = (form, failOnMissing = true) => { |
| 51 | const mappingComponent = form.findComponent(ParameterValuesUiMapping) |
no test coverage detected