How to use the pikaday.prototype function in pikaday

To help you get started, we’ve selected a few pikaday examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bokeh / bokeh / bokehjs / src / lib / models / widgets / date_picker.ts View on Github external
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
github keeweb / keeweb / app / scripts / views / fields / field-view-date.js View on Github external
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`;
        }
    }
github bokeh / bokeh / bokehjs / src / coffee / models / widgets / date_picker.ts View on Github external
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

pikaday

A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS

(0BSD OR MIT)
Latest version published 4 years ago

Package Health Score

61 / 100
Full package analysis

Popular pikaday functions