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(datepicker): input datepicker global config #3275
feat(datepicker): input datepicker global config #3275
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3275 +/- ##
==========================================
+ Coverage 91.13% 91.14% +0.01%
==========================================
Files 95 96 +1
Lines 2796 2800 +4
Branches 516 516
==========================================
+ Hits 2548 2552 +4
Misses 190 190
Partials 58 58
Continue to review full report at Codecov.
|
Hey @IAfanasov! Sorry for the late review start. Even before I start the review, I think I have one overall point to raise So this placement config definitely belongs to a new Nonetheless I think it would make sense for that I don't really like that internally we have to inject both config inside the constructor of It's just a quick thought on the topic, I a not really sure nor sold about it. WDYT ? cc @pkozlowski-opensource |
Hi @benouat! No worries for late review (: Glad to receive review and make valuable contribution! (:
Don't see clear solution here as well (: My impression - To prevent injections of 2 services injection we can for sure inject config of constructor(inputDatepickerConfig: NgbInputDatepickerConfig) {
// 1. approach with getters and setters for injected into `NgbInputDatepickerConfig` `datepickerConfig`
inputDatepickerConfig.minDate = {year: 1900, month: 1, day: 1};
// 2. approach with access to `datepickerConfig`
inputDatepickerConfig.datepickerConfig.minDate = {year: 1900, month: 1, day: 1};
} Feel like option 2 reveals to developer nature of configs right away while 1 can fool developer into thinking it's independent config. |
Hey @benouat ! (: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, it's a very welcome change!
My vote also goes for extending, because I simply don't see a case when it shouldn't be a superset.
Also it should be simpler for the user to deal with 1 config, not 2. And we're duplicating all inputs already for better or worse...
@Injectable()
export class NgbInputDatepickerConfig extends NgbDatepickerConfig {
autoClose: boolean | 'inside' | 'outside' = true;
container: null | 'body';
positionTarget: string | HTMLElement;
placement: PlacementArray = ['bottom-left', 'bottom-right', 'top-left', 'top-right'];
}
406e59f
to
52ad0d6
Compare
52ad0d6
to
fbd6e8d
Compare
Closes #3273
Before submitting a pull request, please make sure you have at least performed the following: