Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timepicker: support removing the chevrons #510

Closed
jnizet opened this issue Jul 29, 2016 · 5 comments
Closed

timepicker: support removing the chevrons #510

jnizet opened this issue Jul 29, 2016 · 5 comments

Comments

@jnizet
Copy link
Member

jnizet commented Jul 29, 2016

Especially when the keyboard and mousewheel support is there, I think the chevrons are redundant and should be removed, or at least removable:

  • they take a whole lot of vertical space, much more than traditional form inputs
  • they're less efficient than the keyboard to increase/decrease the values

So it would be nice if there was a way to hide them. Even nicer would be to have a service allowing to configure defaults, and be able to hide them globally.

@pkozlowski-opensource
Copy link
Member

Totally. Let's make it configurable.

@icfantv
Copy link
Member

icfantv commented Jul 29, 2016

We also talked about letting the user configure their own fonts via classes.

@jnizet
Copy link
Member Author

jnizet commented Jul 29, 2016

As this change is easy enough for me, I started working on it, and have it working. But I'd like to discuss the design first.

Here's what I have in mind (and implemented):

  1. Add a spinners boolean input, that works the same way as the other boolean inputs (seconds, meridian). The spinners are removed from the DOM using *ngIf in the template. That is a first change that, I guess, we can agree on.
  2. Regarding the configuration, my plan is to define a service as a NgbTimepickerConfig class, containing the three boolean flags, as well as the hour, minute and second steps, all as simple mutable fields of the class. An instance of that service is injected in the Timepicker component, annotated with @Optional. If nothing is injected, then a default constant instance is used instead. The fields of the component are initialized from the corresponding fields of the config (injected or default). That way:
    • all properties can be set individually using component inputs
    • all properties can be configured for a given component by adding NgbTimepickerConfig to the providers of the component, or globally, by adding it to the root component, and by injecting it and modifying the properties that need to be configured.

Would that be OK for you? Do you want me to submit the first change, or both changes, as PRs?

@pkozlowski-opensource
Copy link
Member

That is a first change that, I guess, we can agree on.

Definitively!

Do you want me to submit the first change, or both changes, as PRs?

Could you please open one PR for a spinner first? I'm going to open a separate issue for global config so we can come up with naming conventions etc. as this trick needs to be done for all the directives.

Thnx for stepping in and helping out 👍

@pkozlowski-opensource
Copy link
Member

@jnizet opened #518 for the global config, let's discuss the details in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants