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(date input): create new component for date input (DSP-94) #298
Conversation
@gautschr To test this in the playground, follow these steps:
|
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.
works perfectly!
|
||
// recalculate days of month when era changes | ||
const eraChangesSubscription = this.eraControl.valueChanges.subscribe( | ||
data => { |
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.
do you need data
here for the future or can it simply be ()
(also for the year and month subscriptions)
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.
done in 1f5f699
|
||
.date-form-grid { | ||
display: grid; | ||
grid-template-columns: 49% 49%; |
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.
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.
good point, I thought myself that side by side would be better
I'll do that in an subsequent PR.
@@ -0,0 +1,39 @@ | |||
<div [formGroup]="form"> | |||
|
|||
<div class="era-radio"> |
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.
I'd argue that this should actually be hidden in the case of an Islamic date instead of just disabled. I think UIs shouldn't show something that isn't relevant to the user regardless of whether or not they can interact with it.
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.
surely worth thinking about it ...
</mat-form-field> | ||
<mat-form-field> | ||
<mat-label>Month</mat-label> | ||
<mat-select class="month" [formControlName]="'month'" (selectionChange)="_handleInput()"> |
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.
I'm not a huge fan of this dropdown for months but I know why you did it. Do you think it would be possible to open a calendar that is locked to the month view for this instead? Same for the days but the calendar would be locked to the days. dismissed
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.
I don't really understand what you mean. Could we briefly talk about this?
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.
There would be more attractive ways to solve this in the UI but the main purpose of this PR was to provide a solution that works for dates of arbitrary precision and BCE and CE dates. As soon as the MatDatePicker supports this (if ever) it could be used instead.
|
||
// TODO: find better way to detect changes | ||
const startValueSubscription = this.startDate.valueChanges.subscribe( | ||
data => { |
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.
is data
needed here?
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.
done in 1f5f699
|
||
// TODO: find better way to detect changes | ||
const endValueSubscription = this.endDate.valueChanges.subscribe( | ||
data => { |
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.
is data
needed here?
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.
done in 1f5f699
|
||
this._subscriptions.push(eraChangesSubscription); | ||
|
||
// TODO: find better way to detect changes |
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.
should this TODO be handled in this PR?
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.
I'll consider this in a subsequent PR.
|
||
this._subscriptions.push(startValueSubscription); | ||
|
||
// TODO: find better way to detect changes |
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.
should this TODO be handled in this PR?
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.
I'll consider this in a subsequent PR.
@@ -45,8 +45,6 @@ export class DateValueComponent extends BaseValueComponent implements OnInit, On | |||
|
|||
matcher = new ValueErrorStateMatcher(); | |||
|
|||
dateEditable = true; | |||
|
|||
constructor(@Inject(FormBuilder) private _fb: FormBuilder, | |||
private _valueService: ValueService) { |
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.
I don't think you need the ValueService
here anymore
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.
done in 7a2d826
resolves DSP-94
TODO:
@Input() valueRequiredValidator = true;
toDateInputTextComponent
@Input() valueRequiredValidator = true;
toDateEditComponent
DateInputTextComponent
andDateEditComponent
)createJDNCalendarDateFromKnoraDate
to value servicefollowing PR:
@Input() errorStateMatcher: ErrorStateMatcher;
toDateInputTextComponent
@Input() errorStateMatcher: ErrorStateMatcher;
toDateEditComponent