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

refactor(date picker): implement date picker as standalone component #1251

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/dsp-app/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ import {
BuildTagToken,
} from '@dasch-swiss/vre/shared/app-config';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { AppDatePickerModule } from '@dasch-swiss/vre/shared/app-date-picker';
import { AppDatePickerComponent } from '@dasch-swiss/vre/shared/app-date-picker';
import { AdvancedSearchComponent } from '@dasch-swiss/vre/advanced-search';
import { AppProgressIndicatorComponent } from "@dasch-swiss/vre/shared/app-progress-indicator";
import {AppStringLiteralComponent} from "@dasch-swiss/vre/shared/app-string-literal";
Expand Down Expand Up @@ -295,7 +295,7 @@ export function httpLoaderFactory(httpClient: HttpClient) {
],
imports: [
AngularSplitModule,
AppDatePickerModule,
AppDatePickerComponent,
AppProgressIndicatorComponent,
AppRoutingModule,
BrowserAnimationsModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ import { MatInputModule } from '@angular/material/input';
import { MatMenuModule } from '@angular/material/menu';
import { MatButtonModule } from '@angular/material/button';
import { ErrorStateMatcher } from '@angular/material/core';
import { AppDatePickerModule } from '@dasch-swiss/vre/shared/app-date-picker';
import { ResourceLabel } from '../../../data-access/advanced-search-service/advanced-search.service';
import { PropertyFormItem } from '../../../data-access/advanced-search-store/advanced-search-store.service';
import { AppDatePickerComponent } from '@dasch-swiss/vre/shared/app-date-picker';
@Component({
selector: 'dasch-swiss-property-form-value',
standalone: true,
imports: [
AppDatePickerComponent,
CommonModule,
MatButtonModule,
MatInputModule,
MatMenuModule,
MatSelectModule,
FormsModule,
ReactiveFormsModule,
AppDatePickerModule,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add the import for the AppDatePickerComponent here

],
templateUrl: './property-form-value.component.html',
styleUrls: ['./property-form-value.component.scss'],
Expand Down
2 changes: 1 addition & 1 deletion libs/vre/shared/app-date-picker/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './lib/app-date-picker.module';
export * from './lib/app-date-picker/app-date-picker.component';
33 changes: 0 additions & 33 deletions libs/vre/shared/app-date-picker/src/lib/app-date-picker.module.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ describe('DatePickerComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [AppDatePickerComponent],
imports: [
AppDatePickerComponent,
BrowserAnimationsModule,
MatButtonModule,
MatButtonToggleModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ import {
FormGroupDirective,
NgControl,
NgForm,
Validators,
Validators, FormsModule, ReactiveFormsModule
} from '@angular/forms';
import {
CanUpdateErrorState,
ErrorStateMatcher,
mixinErrorState,
_AbstractConstructor,
_Constructor,
_Constructor, MatOptionModule
} from '@angular/material/core';
import { MatFormFieldControl } from '@angular/material/form-field';
import { MatMenuTrigger } from '@angular/material/menu';
import { MatFormFieldControl, MatFormFieldModule } from '@angular/material/form-field';
import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
import { KnoraDate } from '@dasch-swiss/dsp-js';
import { Subject } from 'rxjs';
import {
Expand All @@ -43,6 +43,12 @@ import {
IslamicCalendarDate,
JulianCalendarDate,
} from '@dasch-swiss/jdnconvertiblecalendar';
import { CommonModule } from '@angular/common';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { MatSelectModule } from '@angular/material/select';

/** error when invalid control is dirty, touched, or submitted. */
export class DatePickerErrorStateMatcher implements ErrorStateMatcher {
Expand Down Expand Up @@ -85,9 +91,23 @@ const _MatInputMixinBase: CanUpdateErrorStateCtor & typeof MatInputBase =
mixinErrorState(MatInputBase);

@Component({
standalone: true,
selector: 'dasch-swiss-app-date-picker',
templateUrl: './app-date-picker.component.html',
styleUrls: ['./app-date-picker.component.scss'],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
MatIconModule,
MatInputModule,
MatFormFieldModule,
MatOptionModule,
MatMenuModule,
MatButtonModule,
MatButtonToggleModule,
MatSelectModule,
]
})
export class AppDatePickerComponent
extends _MatInputMixinBase
Expand Down