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

API ideas #1

Open
cibernox opened this issue Jun 1, 2016 · 2 comments
Open

API ideas #1

cibernox opened this issue Jun 1, 2016 · 2 comments

Comments

@cibernox
Copy link
Owner

cibernox commented Jun 1, 2016

Just a bunch of ideas for APIs

Regular datepicker for a single date, displayed inline:

{{#power-datepicker value=date onchange=(action (mut date)) as |datepicker|}}
  {{datepicker.calendar}}
{{/power-datepicker}}

Regular datepicker for a single date, with a trigger that open the dropdown when clicked. The trigger contains one input.

{{#power-datepicker value=date onchange=(action (mut date)) as |datepicker|}}
  {{#datepicker.trigger}}
    <input value={{datepicker.formatedDate}} onchange={{datepicker.actions.update}}/>
  {{/datepicker.trigger}}
  {{#datepicker.dropdown}}{{datepicker.calendar}}{{/datepicker.dropdown}}
{{/power-datepicker}}

Datepicker for a range, with one calendar for both dates and one trigger containing one input with a formatted range (2015/07/12 - 2016/02/19)

{{#power-datepicker-multiple 
  rangeStart=start 
  rangeEnd=end 
  startChange=(action (mut start)) 
  endChange=(action (mut end)) as |datepicker|}}
  {{#datepicker.trigger}}
    <input value={{datepicker.formatedRange}} onchange={{datepicker.actions.update}}/>
  {{/datepicker.trigger}}

  {{#datepicker.dropdown}}
    {{datepicker.calendar}}
  {{/datepicker.dropdown}}
{{/power-datepicker-multiple}}

Datepicker for a range, with one calendar for each date and one trigger containing one input with a formatted range (2015/07/12 - 2016/02/19)

{{#power-datepicker-multiple 
  rangeStart=start 
  rangeEnd=end 
  startChange=(action (mut start)) 
  endChange=(action (mut end)) as |datepicker|}}
  {{#datepicker.trigger}}
    <input value={{datepicker.formatedRange}} onchange={{datepicker.actions.update}}/>
  {{/datepicker.trigger}}

  {{#datepicker.dropdown}}
    {{datepicker.calendar}}
    {{datepicker.calendar}}
  {{/datepicker.dropdown}}
{{/power-datepicker-multiple}}

Datepicker for a range, with one calendar for each date and one trigger for each input too

{{#power-datepicker-multiple 
  rangeStart=start 
  rangeEnd=end 
  startChange=(action (mut start)) 
  endChange=(action (mut end)) as |datepicker|}}
  {{#datepicker.trigger}}
    <input value={{datepicker.formatedStart}} onchange={{datepicker.actions.updateStart}}/>
  {{/datepicker.trigger}}

  {{#datepicker.trigger}}
    <input value={{datepicker.formatedEnd}} onchange={{datepicker.actions.updateEnd}}/>
  {{/datepicker.trigger}}


  {{#datepicker.dropdown}}
    {{datepicker.calendar}}
    {{datepicker.calendar}}
  {{/datepicker.dropdown}}
{{/power-datepicker-multiple}}
@les2
Copy link

les2 commented Mar 29, 2017

Having a mode where the date range change is not committed until both fields have been edited might be nice, e.g.,

{{#power-datepicker-multiple 
  rangeStart=start 
  rangeEnd=end 
  dateRangeChange=(action updateDateRange) ...

@cibernox
Copy link
Owner Author

cibernox commented Apr 2, 2017

I'll consider it, but for the time being I'd handle that in userland.

{{#power-datepicker-multiple onSelect=(action "selectWhenRangeCompleted")

It's easy enough to be low priority.

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

No branches or pull requests

2 participants