github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/server/frontend/bv/src/shared/utils.ts (about) 1 // scroll and return `true` if the form is valid 2 export function scrollToError(form: HTMLElement) { 3 const errorsEls = form.getElementsByClassName("is-invalid"); 4 const el = errorsEls.item(0) || form.querySelector(".form-group:invalid"); 5 if (el != null && el.parentElement != null) { 6 el.parentElement.scrollIntoView(false); 7 } 8 return el == null; 9 } 10 11 export interface ValidEvent { 12 spinning: boolean; 13 } 14 15 export interface ValidEventFile { 16 event: ValidEvent; 17 file: File; 18 } 19 20 export enum SuccesPosition { 21 TopRight = "b-toaster-top-right", 22 BottomLeft = "b-toaster-bottom-left", 23 BottomRight = "b-toaster-bottom-right" 24 }