Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Pikaday from "pikaday"
import {InputWidget, InputWidgetView} from "./input_widget"
import {input} from "core/dom"
import * as p from "core/properties"
import {bk_input} from "styles/widgets/inputs"
import "styles/widgets/pikaday"
Pikaday.prototype.adjustPosition = function(this: Pikaday & {_o: Pikaday.PikadayOptions}): void {
if (this._o.container)
return
this.el.style.position = 'absolute'
const field = this._o.trigger!
const width = this.el.offsetWidth
const height = this.el.offsetHeight
const viewportWidth = window.innerWidth || document.documentElement!.clientWidth
const viewportHeight = window.innerHeight || document.documentElement!.clientHeight
const scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement!.scrollTop
const clientRect = field.getBoundingClientRect()
let left = clientRect.left + window.pageXOffset
let top = clientRect.bottom + window.pageYOffset
adjustPickerPosition(...args) {
window.Pikaday = Pikaday;
Pikaday.prototype.adjustPosition.apply(this.picker, args);
const shadowSpread = parseInt(this.input.css('--focus-shadow-spread')) || 0;
if (shadowSpread) {
const isOnTop = this.picker.el.classList.contains('top-aligned');
const offset = isOnTop ? -shadowSpread : shadowSpread;
const newTop = parseInt(this.picker.el.style.top) + offset;
this.picker.el.style.top = `${newTop}px`;
}
}
import {InputWidget, InputWidgetView} from "./input_widget"
import {empty, input, label} from "core/dom"
import * as p from "core/properties"
import * as Pikaday from "pikaday"
Pikaday.prototype.adjustPosition = function(this: Pikaday & {_o: Pikaday.PikadayOptions}): void {
if (this._o.container)
return
this.el.style.position = 'absolute'
const field = this._o.trigger!
const width = this.el.offsetWidth
const height = this.el.offsetHeight
const viewportWidth = window.innerWidth || document.documentElement.clientWidth
const viewportHeight = window.innerHeight || document.documentElement.clientHeight
const scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop
const clientRect = field.getBoundingClientRect()
let left = clientRect.left + window.pageXOffset
let top = clientRect.bottom + window.pageYOffset