(e: MouseEvent)
| 1453 | } |
| 1454 | |
| 1455 | function documentClick(e: MouseEvent) { |
| 1456 | if (self.isOpen && !self.config.inline) { |
| 1457 | const eventTarget = getEventTarget(e); |
| 1458 | const isCalendarElement = isCalendarElem(eventTarget as HTMLElement); |
| 1459 | const isInput = |
| 1460 | eventTarget === self.input || |
| 1461 | eventTarget === self.altInput || |
| 1462 | self.element.contains(eventTarget as HTMLElement) || |
| 1463 | // web components |
| 1464 | // e.path is not present in all browsers. circumventing typechecks |
| 1465 | ((e as any).path && |
| 1466 | (e as any).path.indexOf && |
| 1467 | (~(e as any).path.indexOf(self.input) || |
| 1468 | ~(e as any).path.indexOf(self.altInput))); |
| 1469 | |
| 1470 | const lostFocus = |
| 1471 | !isInput && |
| 1472 | !isCalendarElement && |
| 1473 | !isCalendarElem(e.relatedTarget as HTMLElement); |
| 1474 | |
| 1475 | const isIgnored = !self.config.ignoredFocusElements.some((elem) => |
| 1476 | elem.contains(eventTarget as Node) |
| 1477 | ); |
| 1478 | |
| 1479 | if (lostFocus && isIgnored) { |
| 1480 | if (self.config.allowInput) { |
| 1481 | self.setDate( |
| 1482 | self._input.value, |
| 1483 | false, |
| 1484 | self.config.altInput |
| 1485 | ? self.config.altFormat |
| 1486 | : self.config.dateFormat |
| 1487 | ); |
| 1488 | } |
| 1489 | |
| 1490 | if ( |
| 1491 | self.timeContainer !== undefined && |
| 1492 | self.minuteElement !== undefined && |
| 1493 | self.hourElement !== undefined && |
| 1494 | self.input.value !== "" && |
| 1495 | self.input.value !== undefined |
| 1496 | ) { |
| 1497 | updateTime(); |
| 1498 | } |
| 1499 | |
| 1500 | self.close(); |
| 1501 | |
| 1502 | if ( |
| 1503 | self.config && |
| 1504 | self.config.mode === "range" && |
| 1505 | self.selectedDates.length === 1 |
| 1506 | ) |
| 1507 | self.clear(false); |
| 1508 | } |
| 1509 | } |
| 1510 | } |
| 1511 | |
| 1512 | function changeYear(newYear: number) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…