( inputClassName: string, opts?: Record<string, any> )
| 39 | } |
| 40 | |
| 41 | export function createNumberInput( |
| 42 | inputClassName: string, |
| 43 | opts?: Record<string, any> |
| 44 | ) { |
| 45 | const wrapper = createElement<HTMLDivElement>("div", "numInputWrapper"), |
| 46 | numInput = createElement<HTMLInputElement>( |
| 47 | "input", |
| 48 | "numInput " + inputClassName |
| 49 | ), |
| 50 | arrowUp = createElement<HTMLSpanElement>("span", "arrowUp"), |
| 51 | arrowDown = createElement<HTMLSpanElement>("span", "arrowDown"); |
| 52 | |
| 53 | if (navigator.userAgent.indexOf("MSIE 9.0") === -1) { |
| 54 | numInput.type = "number"; |
| 55 | } else { |
| 56 | numInput.type = "text"; |
| 57 | numInput.pattern = "\\d*"; |
| 58 | } |
| 59 | |
| 60 | if (opts !== undefined) |
| 61 | for (const key in opts) numInput.setAttribute(key, opts[key]); |
| 62 | |
| 63 | wrapper.appendChild(numInput); |
| 64 | wrapper.appendChild(arrowUp); |
| 65 | wrapper.appendChild(arrowDown); |
| 66 | |
| 67 | return wrapper; |
| 68 | } |
| 69 | |
| 70 | export function getEventTarget(event: Event): EventTarget | null { |
| 71 | try { |
no test coverage detected
searching dependent graphs…