GithubHelp home page GithubHelp logo

pencilpix / vue2-clock-picker Goto Github PK

View Code? Open in Web Editor NEW
26.0 26.0 11.0 357 KB

Vue 2.x component plugin for picking time in `HH:MM` using text input.

License: MIT License

JavaScript 13.91% Vue 81.54% CSS 2.29% HTML 2.26%
clock picker plugin vuejs

vue2-clock-picker's People

Contributors

pencilpix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vue2-clock-picker's Issues

edge case: Innert disabled* being true when 00:00 selected

Hi,
Thanks for publishing this project.

If you don't set the disabledFrom or disabledTo inputs; and you have a CTO who likes doing things "at" midnight (i.e. he choose 00:00:00); the validation (which isn't enabled) will still say that its an error.

I resolved this on my copy of the source by adding to the top of isDisabled()
if(this.disabledFrom ==='' && this.disabledTo==='') { return false; }

CSS style modal within modal

I am using this component within a modal, but the modal of the clock is not shown. how can I modify the css style to show the clock

my CSS style for the first modal

.modal-content .modal-body {
        position: relative;
        padding: 20px 10px;
    }
    .modal-content{
        width: 100% !important;        
    }
    .mostrar{
        display: list-item !important;
        opacity: 1 !important;
        position: absolute !important;
        background-color: #3c29297a !important;        
    }
    .div-error{
        display: flex;
        justify-content: center;
    }
    .text-error{
        color: red !important;
        font-weight: bold;
    }

I appreciate your help

importing clock picker into other components

Greetings, thanks for publishing this clock picker.

In order to get this component available in other components, I needed to add a local var, so the components array worked.
I don't need to do this for other components. I am building a Vue GUI inside a completely different platform, so have less access to Node tools on this project.

...
let VueClockPicker=window['vue2-clock-picker']['default'];
...
let navBar=Vue({
components:[ VueClockPicker ...],
...
})

Either:

  • have I over looked something in the docs?
  • I should submit a documentation patch
  • I could rename several things so they are valid var names, where I think the export would be automatic.

Two way binding

Hi there,

I've tested your component and really like it,
but there is one problem that makes it not suitable for my case,
the problem is that if the value of the time is changed programmatically the input of your picker does not update.

This might be because the value of the prop "value" is being set on data->inputValue and this only happens when the component renders, the solution might be referring to the prop "value" along the component instead of referring to InputValue, making then the component dynamic.

Was this something you consider doing?

Thanks!

Wrong canvas font used first time picker is opened.

Hi,

I'm having a weird issue with the fonts used to draw on the canvas.
I'm not using a Material theme, but I've imported the Roboto font.
The first time a picker is displayed, it uses the wrong font (default serif, Times New Roman I guess) for the numbers.
When closed, and opened again, it uses the correct font (Roboto).
With multiple pickers on the same page, the issue doesn't occur with all of them - only the first one opened is affected.

Is this a bug, or am I missing a step?

problem with disabled-from disabled-to

If I define a range such as disabled-from = "17:30" disabled-to = "08:00" is not working properly.

if I just define disabled-from = "17:30" it works fine until 00:00
and if I just define disabled-to = "08:00" it works fine from 00:00 to 07:59 but with both properties together it does not work.

Events are not firing

It wont fires the alert that I set in beforeOpen

 <vue-clock-picker
                id="time-range-end"
                refs="timeRangeEnd"
                v-model="inspectionTimeRange.end"
                :beforeOpen="()=>{
                      alert();
                })"
              ></vue-clock-picker>

Solved an issue with Microsoft Edge compatibility

Sorry that I didn't make a pull request for this. But hopefully it'll help somebody who searches for this problem, likes to have Edge compatibility or want to make a PR. The function "getBoundingClientRect" doesn't have "x" and "y" available in Edge. But these values are also stored in "left" and "top". So rewriting the following will then also work with Edge:

calculateLastEvent: function calculateLastEvent(t) {
  ...
  //instead of
  r = o.x + this.width / 2,
  s = o.y + this.width / 2,

  //rewrite to
  r = o.left + this.width / 2,
  s = o.top + this.width / 2,    
  ...
}

It's also possible to have IE11 compatbility when replacing all "includes" with "indexOf". For example:

//instead of
var e = t.disabled.includes(t.defaultValue);

//rewrite to
var e = t.disabled.indexOf(t.defaultValue) > -1;

The only problem left for IE11 is to polyfill "find" with the following:
https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/find#Polyfill

Thanks for this really nice and well designed component. Looking forward to use it :).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.