Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Make date edit field a basic datepicker

Oliver Günther8f8518895e98
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component.ts
index 1f8224a6d8a..3a57c1b0b02 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component.ts
+++ b/frontend/src/app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component.ts
@@ -34,32 +34,32 @@ import { TimezoneService } from 'core-app/core/datetime/timezone.service';
@Component({
template: `
- <op-single-date-picker
+ <op-basic-single-date-picker
[(ngModel)]="value"
+ (keydown.escape)="onCancel()"
[id]="handler.htmlId"
class="inline-edit--field"
- [opened]="opened"
- (closed)="onModalClosed()"
- ></op-single-date-picker>
+ [opAutofocus]="autofocus"
+ ></op-basic-single-date-picker>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DateEditFieldComponent extends EditFieldComponent implements OnInit {
@InjectField() readonly timezoneService:TimezoneService;
- opened = false;
+ autofocus = false;
ngOnInit():void {
super.ngOnInit();
// Open the datepicker when the field is not part of an editing form.
- this.opened = !this.handler.inEditMode;
+ this.autofocus = !this.handler.inEditMode;
}
- public get value() {
+ public get value():string {
return this.formatter(this.resource[this.name]) || '';
}
- public set value(value:any) {
+ public set value(value:string) {
this.resource[this.name] = this.parseValue(value);
void this.handler.handleUserSubmit();
}
@@ -78,8 +78,6 @@ export class DateEditFieldComponent extends EditFieldComponent implements OnInit
}
public onModalClosed():void {
- this.opened = false;
-
if (!this.handler.inEditMode) {
this.handler.deactivate(false);
}