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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Rename and change datepickers, have a working build
Benjamin Bädorfcbee765003fc
diff --git a/frontend/src/app/core/setup/global-dynamic-components.const.ts b/frontend/src/app/core/setup/global-dynamic-components.const.tsindex 81b8ab701fe..dfdca4efbce 100644--- a/frontend/src/app/core/setup/global-dynamic-components.const.ts+++ b/frontend/src/app/core/setup/global-dynamic-components.const.ts@@ -212,9 +212,13 @@ import {opModalOverlaySelector,} from 'core-app/shared/components/modal/modal-overlay.component';import {- OpSingleDatePickerComponent,- opSingleDatePickerSelector,-} from 'core-app/shared/components/datepicker/single-date-picker/single-date-picker.component';+ OpModalSingleDatePickerComponent,+ opModalSingleDatePickerSelector,+} from 'core-app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component';+import {+ OpBasicSingleDatePickerComponent,+ opBasicSingleDatePickerSelector,+} from 'core-app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component';import { SpotDropModalPortalComponent, spotDropModalPortalComponentSelector } from 'core-app/spot/components/drop-modal/drop-modal-portal.component';export const globalDynamicComponents:OptionalBootstrapDefinition[] = [@@ -273,9 +277,10 @@ export const globalDynamicComponents:OptionalBootstrapDefinition[] = [{ selector: opInAppNotificationBellSelector, cls: InAppNotificationBellComponent },{ selector: ianMenuSelector, cls: IanMenuComponent },{ selector: opModalOverlaySelector, cls: OpModalOverlayComponent },- // It is important to initialize the remoteFieldUpdaterSelector after the opSingleDatePickerSelector,- // because we need to access the input field of the opSingleDatePickerSelector inside the remoteFieldUpdaterSelector- { selector: opSingleDatePickerSelector, cls: OpSingleDatePickerComponent, embeddable: true },+ // It is important to initialize the remoteFieldUpdaterSelector after the opModalSingleDatePickerSelector,+ // because we need to access the input field of the opModalSingleDatePickerSelector inside the remoteFieldUpdaterSelector+ { selector: opModalSingleDatePickerSelector, cls: OpModalSingleDatePickerComponent, embeddable: true },+ { selector: opBasicSingleDatePickerSelector, cls: OpBasicSingleDatePickerComponent, embeddable: true },{ selector: remoteFieldUpdaterSelector, cls: RemoteFieldUpdaterComponent },{ selector: spotDropModalPortalComponentSelector, cls: SpotDropModalPortalComponent },];diff --git a/frontend/src/app/features/work-packages/components/filters/filter-date-time-value/filter-date-time-value.component.html b/frontend/src/app/features/work-packages/components/filters/filter-date-time-value/filter-date-time-value.component.htmlindex eafcc4c2368..97e00c37d36 100644--- a/frontend/src/app/features/work-packages/components/filters/filter-date-time-value/filter-date-time-value.component.html+++ b/frontend/src/app/features/work-packages/components/filters/filter-date-time-value/filter-date-time-value.component.html@@ -1,4 +1,4 @@-<op-single-date-picker+<op-basic-single-date-picker[id]="'values-' + filter.id"[name]="'v[' + filter.id + ']'"class="advanced-filters--date-field"@@ -8,8 +8,7 @@[value]="isoDateFormatter(value)"[opAutofocus]="shouldFocus"--></op-single-date-picker>+></op-basic-single-date-picker><spanclass="advanced-filters--tooltip-trigger -multiline"diff --git a/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.html b/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.htmlindex 5912f06cf65..ee6884b9936 100644--- a/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.html+++ b/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.html@@ -1,11 +1,25 @@-<op-multi-date-picker- [id]="'values-' + filter.id"- [name]="'v[' + filter.id + ']'"- class="advanced-filters--date-field"-- [(ngModel)]="value"+<op-basic-single-date-picker+ [ngModel]="isoDateFormatter(begin)"+ (ngModelChange)="begin = isoDateParser($event)"[opAutofocus]="shouldFocus"-></op-multi-date-picker>+ required="true"+ [id]="'values-' + filter.id + '-begin'"+ [name]="'v[' + filter.id + ']-begin'"+ classes="advanced-filters--date-field"+></op-basic-single-date-picker>++<span+ class="advanced-filters--affix"+ [textContent]="text.spacer"+></span>++<op-basic-single-date-picker+ [ngModel]="isoDateFormatter(end)"+ (ngModelChange)="end = isoDateParser($event)"+ [id]="'values-' + filter.id + '-end'"+ [name]="'v[' + filter.id + ']-end'"+ classes="advanced-filters--date-field"+></op-basic-single-date-picker><spanclass="advanced-filters--tooltip-trigger -multiline"diff --git a/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.ts b/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.tsindex 859986e555e..9fe4a6af965 100644--- a/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.ts+++ b/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.ts@@ -70,23 +70,24 @@ export class FilterDateTimesValueComponent extends AbstractDateTimeValueControllsuper(I18n, timezoneService);}- public get value():(HalResource[]|string[]) {- return this.filter.values;+ public get begin():HalResource|string {+ return this.filter.values[0];}- public set value(val:(HalResource[]|string[])) {- this.filter.values = val.map(d => this.isoDateParser(d));+ public set begin(val) {+ this.filter.values[0] = val || '';this.filterChanged.emit(this.filter);}- public get begin() {- return this.filter.values[0];- }-public get end() {return this.filter.values[1];}+ public set end(val) {+ this.filter.values[1] = val || '';+ this.filterChanged.emit(this.filter);+ }+public get lowerBoundary():Moment|null {if (this.begin && this.timezoneService.isValidISODateTime(this.begin.toString())) {return this.timezoneService.parseDatetime(this.begin.toString());diff --git a/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.html b/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.htmlindex d4ee0352b6f..e9d630d1ef6 100644--- a/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.html+++ b/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.html@@ -1,4 +1,4 @@-<op-single-date-picker+<op-basic-single-date-picker[id]="'values-' + filter.id"[name]="'v[' + filter.id + ']'"class="advanced-filters--date-field"@@ -6,4 +6,4 @@(changed)="value = parser($event)"[value]="formatter(value)"[required]="true"-></op-single-date-picker>+></op-basic-single-date-picker>diff --git a/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.html b/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.htmlnew file mode 100644index 00000000000..8503106566e--- /dev/null+++ b/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.html@@ -0,0 +1,11 @@+<input+ #input+ type="text"+ class="spot-input"+ [attr.data-value]="value"+ [id]="id"+ [name]="name"+ [value]="value"+ (change)="changeValueFromInputDebounced($event)"+ (focus)="showDatePicker()"+/>diff --git a/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.ts b/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.tsnew file mode 100644index 00000000000..fcc7f4d4b83--- /dev/null+++ b/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.ts@@ -0,0 +1,188 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2022 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//++++import {+ AfterContentInit,+ ChangeDetectionStrategy,+ ChangeDetectorRef,+ Component,+ ElementRef,+ EventEmitter,+ forwardRef,+ Injector,+ Input,+ OnInit,+ Output,+ ViewChild,+ ViewEncapsulation,+} from '@angular/core';+import { I18nService } from 'core-app/core/i18n/i18n.service';+import {+ ControlValueAccessor,+ NG_VALUE_ACCESSOR,+} from '@angular/forms';+import {+ onDayCreate,+ parseDate,+ setDates,+} from 'core-app/shared/components/datepicker/helpers/date-modal.helpers';+import { TimezoneService } from 'core-app/core/datetime/timezone.service';+import { DatePicker } from '../datepicker';+import flatpickr from 'flatpickr';+import { DayElement } from 'flatpickr/dist/types/instance';+import { populateInputsFromDataset } from '../../dataset-inputs';+import { debounce } from 'lodash';+import { SpotDropModalTeleportationService } from 'core-app/spot/components/drop-modal/drop-modal-teleportation.service';++export const opBasicRangeDatePickerSelector = 'op-basic-range-date-picker';++@Component({+ selector: opBasicRangeDatePickerSelector,+ templateUrl: './basic-range-date-picker.component.html',+ styleUrls: ['../styles/datepicker.modal.sass', '../styles/datepicker_mobile.modal.sass'],+ changeDetection: ChangeDetectionStrategy.OnPush,+ encapsulation: ViewEncapsulation.None,+ providers: [+ {+ provide: NG_VALUE_ACCESSOR,+ useExisting: forwardRef(() => OpBasicRangeDatePickerComponent),+ multi: true,+ },+ ],+})+export class OpBasicRangeDatePickerComponent implements ControlValueAccessor {+ @Output('valueChange') valueChange = new EventEmitter();++ private _value:string[] = [];++ @Input() set value(newValue:string[]) {+ this._value = newValue;+ }++ get value() {+ return this._value;+ }++ @Input() id = `flatpickr-input-${+(new Date())}`;++ @Input() name = '';++ @Input() remoteFieldKey = '';++ @Input() required = false;++ @Input() minimalDate:Date|null = null;++ @ViewChild('input') input:ElementRef;++ text = {+ date: this.I18n.t('js.work_packages.properties.date'),+ placeholder: this.I18n.t('js.placeholders.default'),+ };++ public datePickerInstance:DatePicker;++ constructor(+ readonly I18n:I18nService,+ readonly timezoneService:TimezoneService,+ readonly injector:Injector,+ readonly cdRef:ChangeDetectorRef,+ readonly elementRef:ElementRef,+ readonly spotDropModalTeleportationService:SpotDropModalTeleportationService,+ ) {+ populateInputsFromDataset(this);+ }++ changeValueFromInputDebounced = debounce(this.changeValueFromInput.bind(this), 16);++ changeValueFromInput(value:string) {+ this.valueChange.emit(value);+ this.onChange(value);+ this.writeValue(value);++ const date = parseDate(value || '');++ if (date !== '') {+ const dateString = this.timezoneService.formattedISODate(date);+ this.onTouched(dateString);+ }+ this.cdRef.detectChanges();+ }++ public showDatePicker() {+ this.datePickerInstance = new DatePicker(+ this.injector,+ this.id,+ this.value || '',+ {+ mode: 'range',+ showMonths: 1,+ onReady: (_date:Date[], _datestr:string, instance:flatpickr.Instance) => {+ instance.calendarContainer.classList.add('op-datepicker-modal--flatpickr-instance');+ },+ onChange: (dates:Date[]) => {+ if (dates.length > 1) {+ const start = this.timezoneService.formattedISODate(dates[0]);+ const end = this.timezoneService.formattedISODate(dates[1]);+ const value = [start, end];+ this.writeValue(value);+ this.onChange(value);+ this.onTouched(value);+ }++ this.cdRef.detectChanges();+ },+ onDayCreate: (dObj:Date[], dStr:string, fp:flatpickr.Instance, dayElem:DayElement) => {+ onDayCreate(+ dayElem,+ false,+ this.datePickerInstance?.weekdaysService.isNonWorkingDay(dayElem.dateObj),+ !!this.minimalDate && dayElem.dateObj <= this.minimalDate,+ );+ },+ },+ this.input.nativeElement as HTMLInputElement,+ );+ }++ writeValue(value:string[]):void {+ this.value = value;+ }++ onChange = (_:string[]):void => {};++ onTouched = (_:string[]):void => {};++ registerOnChange(fn:(_:string[]) => void):void {+ this.onChange = fn;+ }++ registerOnTouched(fn:(_:string[]) => void):void {+ this.onTouched = fn;+ }+}diff --git a/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.html b/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.htmlnew file mode 100644index 00000000000..8503106566e--- /dev/null+++ b/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.html@@ -0,0 +1,11 @@+<input+ #input+ type="text"+ class="spot-input"+ [attr.data-value]="value"+ [id]="id"+ [name]="name"+ [value]="value"+ (change)="changeValueFromInputDebounced($event)"+ (focus)="showDatePicker()"+/>diff --git a/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.ts b/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.tsnew file mode 100644index 00000000000..1470af122e8--- /dev/null+++ b/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.ts@@ -0,0 +1,186 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2022 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//++++import {+ AfterContentInit,+ ChangeDetectionStrategy,+ ChangeDetectorRef,+ Component,+ ElementRef,+ EventEmitter,+ forwardRef,+ Injector,+ Input,+ OnInit,+ Output,+ ViewChild,+ ViewEncapsulation,+} from '@angular/core';+import { I18nService } from 'core-app/core/i18n/i18n.service';+import {+ ControlValueAccessor,+ NG_VALUE_ACCESSOR,+} from '@angular/forms';+import {+ onDayCreate,+ parseDate,+ setDates,+} from 'core-app/shared/components/datepicker/helpers/date-modal.helpers';+import { TimezoneService } from 'core-app/core/datetime/timezone.service';+import { DatePicker } from '../datepicker';+import flatpickr from 'flatpickr';+import { DayElement } from 'flatpickr/dist/types/instance';+import { populateInputsFromDataset } from '../../dataset-inputs';+import { debounce } from 'lodash';+import { SpotDropModalTeleportationService } from 'core-app/spot/components/drop-modal/drop-modal-teleportation.service';++export const opBasicSingleDatePickerSelector = 'op-basic-single-date-picker';++@Component({+ selector: opBasicSingleDatePickerSelector,+ templateUrl: './basic-single-date-picker.component.html',+ styleUrls: ['../styles/datepicker.modal.sass', '../styles/datepicker_mobile.modal.sass'],+ changeDetection: ChangeDetectionStrategy.OnPush,+ encapsulation: ViewEncapsulation.None,+ providers: [+ {+ provide: NG_VALUE_ACCESSOR,+ useExisting: forwardRef(() => OpBasicSingleDatePickerComponent),+ multi: true,+ },+ ],+})+export class OpBasicSingleDatePickerComponent implements ControlValueAccessor {+ @Output('valueChange') valueChange = new EventEmitter();++ private _value = '';++ @Input() set value(newValue:string) {+ this._value = newValue;+ }++ get value() {+ return this._value;+ }++ @Input() id = `flatpickr-input-${+(new Date())}`;++ @Input() name = '';++ @Input() remoteFieldKey = '';++ @Input() required = false;++ @Input() minimalDate:Date|null = null;++ @ViewChild('input') input:ElementRef;++ text = {+ date: this.I18n.t('js.work_packages.properties.date'),+ placeholder: this.I18n.t('js.placeholders.default'),+ };++ public datePickerInstance:DatePicker;++ constructor(+ readonly I18n:I18nService,+ readonly timezoneService:TimezoneService,+ readonly injector:Injector,+ readonly cdRef:ChangeDetectorRef,+ readonly elementRef:ElementRef,+ readonly spotDropModalTeleportationService:SpotDropModalTeleportationService,+ ) {+ populateInputsFromDataset(this);+ }++ changeValueFromInputDebounced = debounce(this.changeValueFromInput.bind(this), 16);++ changeValueFromInput(value:string) {+ this.valueChange.emit(value);+ this.onChange(value);+ this.writeValue(value);++ const date = parseDate(value || '');++ if (date !== '') {+ const dateString = this.timezoneService.formattedISODate(date);+ this.onTouched(dateString);+ }+ this.cdRef.detectChanges();+ }++ public showDatePicker() {+ this.datePickerInstance = new DatePicker(+ this.injector,+ this.id,+ this.value || '',+ {+ mode: 'single',+ showMonths: 1,+ onReady: (_date:Date[], _datestr:string, instance:flatpickr.Instance) => {+ instance.calendarContainer.classList.add('op-datepicker-modal--flatpickr-instance');+ },+ onChange: (dates:Date[]) => {+ if (dates.length > 0) {+ const dateString = this.timezoneService.formattedISODate(dates[0]);+ this.writeValue(dateString);+ this.onChange(dateString);+ this.onTouched(dateString);+ }++ this.cdRef.detectChanges();+ },+ onDayCreate: (dObj:Date[], dStr:string, fp:flatpickr.Instance, dayElem:DayElement) => {+ onDayCreate(+ dayElem,+ false,+ this.datePickerInstance?.weekdaysService.isNonWorkingDay(dayElem.dateObj),+ !!this.minimalDate && dayElem.dateObj <= this.minimalDate,+ );+ },+ },+ this.input.nativeElement as HTMLInputElement,+ );+ }++ writeValue(value:string):void {+ this.value = value;+ }++ onChange = (_:string):void => {};++ onTouched = (_:string):void => {};++ registerOnChange(fn:(_:string) => void):void {+ this.onChange = fn;+ }++ registerOnTouched(fn:(_:string) => void):void {+ this.onTouched = fn;+ }+}diff --git a/frontend/src/app/shared/components/datepicker/multi-date-picker/multi-date-picker.component.html b/frontend/src/app/shared/components/datepicker/modal-range-date-picker/modal-range-date-picker.component.htmlsimilarity index 98%rename from frontend/src/app/shared/components/datepicker/multi-date-picker/multi-date-picker.component.htmlrename to frontend/src/app/shared/components/datepicker/modal-range-date-picker/modal-range-date-picker.component.htmlindex 92b7873e6f1..5ca6aed0253 100644--- a/frontend/src/app/shared/components/datepicker/multi-date-picker/multi-date-picker.component.html+++ b/frontend/src/app/shared/components/datepicker/modal-range-date-picker/modal-range-date-picker.component.html@@ -1,7 +1,7 @@<spot-drop-modal[opened]="opened"(closed)="close()"- data-qa-selector="op-multi-date-picker"+ data-qa-selector="op-modal-range-date-picker"><inputslot="trigger"diff --git a/frontend/src/app/shared/components/datepicker/multi-date-picker/multi-date-picker.component.ts b/frontend/src/app/shared/components/datepicker/modal-range-date-picker/modal-range-date-picker.component.tssimilarity index 98%rename from frontend/src/app/shared/components/datepicker/multi-date-picker/multi-date-picker.component.tsrename to frontend/src/app/shared/components/datepicker/modal-range-date-picker/modal-range-date-picker.component.tsindex 2312408a70c..837e4ec3023 100644--- a/frontend/src/app/shared/components/datepicker/multi-date-picker/multi-date-picker.component.ts+++ b/frontend/src/app/shared/components/datepicker/modal-range-date-picker/modal-range-date-picker.component.ts@@ -82,20 +82,20 @@ import { FocusHelperService } from 'core-app/shared/directives/focus/focus-helpeimport { SpotDropModalTeleportationService } from 'core-app/spot/components/drop-modal/drop-modal-teleportation.service';@Component({- selector: 'op-multi-date-picker',- templateUrl: './multi-date-picker.component.html',+ selector: 'op-modal-range-date-picker',+ templateUrl: './modal-range-date-picker.component.html',styleUrls: ['../styles/datepicker.modal.sass', '../styles/datepicker_mobile.modal.sass'],changeDetection: ChangeDetectionStrategy.OnPush,encapsulation: ViewEncapsulation.None,providers: [{provide: NG_VALUE_ACCESSOR,- useExisting: forwardRef(() => OpMultiDatePickerComponent),+ useExisting: forwardRef(() => OpModalRangeDatePickerComponent),multi: true,},],})-export class OpMultiDatePickerComponent extends UntilDestroyedMixin implements OnInit, ControlValueAccessor {+export class OpModalRangeDatePickerComponent extends UntilDestroyedMixin implements OnInit, ControlValueAccessor {@ViewChild('modalContainer') modalContainer:ElementRef<HTMLElement>;@ViewChild('flatpickrTarget') flatpickrTarget:ElementRef;diff --git a/frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.html b/frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.htmlsimilarity index 98%rename from frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.htmlrename to frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.htmlindex 8a09c09a78a..5191277a584 100644--- a/frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.html+++ b/frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.html@@ -1,7 +1,7 @@<spot-drop-modal[opened]="opened"(closed)="opened = false"- data-qa-selector="op-single-date-picker"+ data-qa-selector="op-modal-single-date-picker"><ng-contentslot="trigger"diff --git a/frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.ts b/frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.tssimilarity index 95%rename from frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.tsrename to frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.tsindex 31441990b05..2c31178b442 100644--- a/frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.ts+++ b/frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.ts@@ -59,23 +59,23 @@ import { populateInputsFromDataset } from '../../dataset-inputs';import { debounce } from 'lodash';import { SpotDropModalTeleportationService } from 'core-app/spot/components/drop-modal/drop-modal-teleportation.service';-export const opSingleDatePickerSelector = 'op-single-date-picker';+export const opModalSingleDatePickerSelector = 'op-modal-single-date-picker';@Component({- selector: opSingleDatePickerSelector,- templateUrl: './single-date-picker.component.html',+ selector: opModalSingleDatePickerSelector,+ templateUrl: './modal-single-date-picker.component.html',styleUrls: ['../styles/datepicker.modal.sass', '../styles/datepicker_mobile.modal.sass'],changeDetection: ChangeDetectionStrategy.OnPush,encapsulation: ViewEncapsulation.None,providers: [{provide: NG_VALUE_ACCESSOR,- useExisting: forwardRef(() => OpSingleDatePickerComponent),+ useExisting: forwardRef(() => OpModalSingleDatePickerComponent),multi: true,},],})-export class OpSingleDatePickerComponent implements ControlValueAccessor, OnInit, AfterContentInit {+export class OpModalSingleDatePickerComponent implements ControlValueAccessor, OnInit, AfterContentInit {@Output('closed') closed = new EventEmitter();@Output('valueChange') valueChange = new EventEmitter();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.tsindex 1f8224a6d8a..b73a2e9ce58 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,25 +34,25 @@ import { TimezoneService } from 'core-app/core/datetime/timezone.service';@Component({template: `- <op-single-date-picker+ <op-basic-single-date-picker[(ngModel)]="value"[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() {@@ -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);}diff --git a/frontend/src/app/shared/components/op-non-working-days-list/op-non-working-days-list.component.html b/frontend/src/app/shared/components/op-non-working-days-list/op-non-working-days-list.component.htmlindex b97b5d1b354..acd7caeec96 100644--- a/frontend/src/app/shared/components/op-non-working-days-list/op-non-working-days-list.component.html+++ b/frontend/src/app/shared/components/op-non-working-days-list/op-non-working-days-list.component.html@@ -19,7 +19,7 @@<divclass="op-non-working-days-list--add-button">- <op-single-date-picker+ <op-modal-single-date-pickerid="test"name="test"[showIgnoreNonWorkingDays]="false"@@ -54,6 +54,6 @@<span class="spot-icon spot-icon_add"></span><span [textContent]="text.add_non_working_day"></span></button>- </op-single-date-picker>+ </op-modal-single-date-picker></div>diff --git a/frontend/src/app/shared/shared.module.ts b/frontend/src/app/shared/shared.module.tsindex 2eae233bf2c..460df1f04ed 100644--- a/frontend/src/app/shared/shared.module.ts+++ b/frontend/src/app/shared/shared.module.ts@@ -70,8 +70,9 @@ import { OpDateTimeComponent } from './components/date/op-date-time.component';import { ToastComponent } from './components/toaster/toast.component';import { OpWpSingleDateFormComponent } from 'core-app/shared/components/datepicker/wp-single-date-form/wp-single-date-form.component';-import { OpSingleDatePickerComponent } from 'core-app/shared/components/datepicker/single-date-picker/single-date-picker.component';-import { OpMultiDatePickerComponent } from 'core-app/shared/components/datepicker/multi-date-picker/multi-date-picker.component';+import { OpModalSingleDatePickerComponent } from 'core-app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component';+import { OpBasicSingleDatePickerComponent } from 'core-app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component';+import { OpModalRangeDatePickerComponent } from 'core-app/shared/components/datepicker/modal-range-date-picker/modal-range-date-picker.component';import { OpWpMultiDateFormComponent } from 'core-app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-form.component';import { OpDatePickerBannerComponent } from 'core-app/shared/components/datepicker/banner/datepicker-banner.component';import { OpDatePickerWorkingDaysToggleComponent } from 'core-app/shared/components/datepicker/toggle/datepicker-working-days-toggle.component';@@ -210,8 +211,9 @@ export function bootstrapModule(injector:Injector):void {// Date pickersOpWpSingleDateFormComponent,- OpSingleDatePickerComponent,- OpMultiDatePickerComponent,+ OpModalSingleDatePickerComponent,+ OpBasicSingleDatePickerComponent,+ OpModalRangeDatePickerComponent,OpDatePickerBannerComponent,OpWpMultiDateFormComponent,OpDatePickerWorkingDaysToggleComponent,@@ -277,8 +279,9 @@ export function bootstrapModule(injector:Injector):void {// Date pickersOpWpSingleDateFormComponent,- OpSingleDatePickerComponent,- OpMultiDatePickerComponent,+ OpModalSingleDatePickerComponent,+ OpBasicSingleDatePickerComponent,+ OpModalRangeDatePickerComponent,OpDatePickerBannerComponent,OpWpMultiDateFormComponent,OpDatePickerWorkingDaysToggleComponent,