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

feat(input): allow custom date component to be configured #861

Merged
merged 1 commit into from Sep 16, 2022

Conversation

velrest
Copy link
Contributor

@velrest velrest commented Sep 14, 2022

If none is set we just default to the inputComponent aka HTML5 picker.

@velrest
Copy link
Contributor Author

velrest commented Sep 14, 2022

This allows you to set types/date in your configuration and use a custom date component:

 "ember-validated-form": {
    theme: "bootstrap",
    defaults: {
      "types/date": "myapp/components/my-date-picker",
    },
  },

The arguments passed to the datepicker are:

 @autocomplete={{@autocomplete}}
@autofocus={{@autofocus}}
@disabled={{@disabled}}
@id={{@inputId}}
@name={{or @inputName @name}}
@placeholder={{@placeholder}}
@type={{@type}}
@value={{@value}}
@isInvalid={{@isInvalid}}
@isValid={{@isValid}}
@setDirty={{@setDirty}}
@update={{@update}}
...attributes

@czosel what do you think?

@velrest
Copy link
Contributor Author

velrest commented Sep 14, 2022

Example: inosca/ember-ebau-gwr#382

@czosel
Copy link
Contributor

czosel commented Sep 15, 2022

I like the idea 👍 @anehx what do you think?

Copy link
Member

@anehx anehx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea! However, we should make sure that the default is an input with type date. Also, tests!

addon/components/validated-input/render.hbs Show resolved Hide resolved
@velrest
Copy link
Contributor Author

velrest commented Sep 15, 2022

I like the idea! However, we should make sure that the default is an input with type date. Also, tests!

What do you mean by "we should make sure that the default is an input"? If we render the inputComponent if its not type date and the component has been overwritten then the default would be just a plain input with type=date. Maybe i don't understand your statement though.

@velrest
Copy link
Contributor Author

velrest commented Sep 15, 2022

Added some doc in customization:
image

@velrest velrest force-pushed the feat-custom-date-component branch 2 times, most recently from 06586f2 to 3462d80 Compare September 15, 2022 12:20
Copy link
Member

@anehx anehx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor nitpicks, otherwise LGTM! Awesome work! 🎉

package.json Outdated Show resolved Hide resolved
tests/dummy/app/components/flatpickr-wrapper.hbs Outdated Show resolved Hide resolved
@velrest velrest force-pushed the feat-custom-date-component branch 3 times, most recently from b2cdb38 to 182eca9 Compare September 15, 2022 17:43
If none is set we just default to the `inputComponent` aka HTML5 picker.
Co-authored-by: Jonas Metzener <jonas.metzener@adfinis.com>
@velrest velrest marked this pull request as ready for review September 15, 2022 17:54
@velrest velrest requested a review from anehx September 15, 2022 17:54
@velrest velrest merged commit 33bbafa into adfinis:main Sep 16, 2022
czosel pushed a commit that referenced this pull request Sep 16, 2022
# [6.1.0](v6.0.2...v6.1.0) (2022-09-16)

### Features

* **input:** allow custom date component to be configured ([#861](#861)) ([33bbafa](33bbafa))
@czosel
Copy link
Contributor

czosel commented Sep 16, 2022

🎉 This PR is included in version 6.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

3 participants