Skip to content

Commit

Permalink
refactor: move SelectOption interface to the model folder (#953)
Browse files Browse the repository at this point in the history
BREAKING CHANGES: The `SelectOption` interface has been moved to the select-option.model.ts file of the core/model folder, the related import statements have been adapted.
  • Loading branch information
SGrueber committed Dec 10, 2021
1 parent 12c52ae commit c634b58
Show file tree
Hide file tree
Showing 23 changed files with 32 additions and 25 deletions.
2 changes: 2 additions & 0 deletions docs/guides/migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ With version 2.0 we introduce a renaming of the two standard PWA themes and chan
With this change the according folders and references had to be renamed/moved and need to be adapted in customer projects as well.
In projects where the recommended procedure for using a custom theme has been followed (see [Customization Guide - Start Customization](./customizations.md#start-customization)), minimal migration effort should be required.

We moved the model `SelectOption` from the select.component.ts to the select-option.model.ts and adapted all necessary imports.

## 1.1 to 1.2

The `dist` folder now only contains results of the build process (except for `healthcheck.js`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { pick } from 'lodash-es';
import { Observable } from 'rxjs';

import { HttpError } from 'ish-core/models/http-error/http-error.model';
import { SelectOption } from 'ish-shared/forms/components/select/select.component';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { FormsService } from 'ish-shared/forms/utils/forms.service';
import { SpecialValidators } from 'ish-shared/forms/validators/special-validators';

Expand Down
4 changes: 4 additions & 0 deletions src/app/core/models/select-option/select-option.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface SelectOption {
value: string;
label: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Observable } from 'rxjs';
import { map, startWith, withLatestFrom } from 'rxjs/operators';

import { HttpError } from 'ish-core/models/http-error/http-error.model';
import { SelectOption } from 'ish-shared/forms/components/select/select.component';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';

import { OrderTemplate, OrderTemplateHeader } from '../models/order-template/order-template.model';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

import { SelectOption } from 'ish-shared/forms/components/select/select.component';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';

import { OrderTemplatesFacade } from '../../facades/order-templates.facade';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { TranslateService } from '@ngx-translate/core';
import { Observable, Subject, of } from 'rxjs';
import { filter, map, take, takeUntil } from 'rxjs/operators';

import { SelectOption } from 'ish-shared/forms/components/select/select.component';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { markAsDirtyRecursive } from 'ish-shared/forms/utils/form-utils';

import { OrderTemplatesFacade } from '../../facades/order-templates.facade';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

import { SelectOption } from 'ish-shared/forms/components/select/select.component';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';

import { WishlistsFacade } from '../../facades/wishlists.facade';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { FormlyFieldConfig } from '@ngx-formly/core';
import { Observable, Subject, of } from 'rxjs';
import { filter, map, take, takeUntil } from 'rxjs/operators';

import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { whenTruthy } from 'ish-core/utils/operators';
import { SelectOption } from 'ish-shared/forms/components/select/select.component';
import { markAsDirtyRecursive } from 'ish-shared/forms/utils/form-utils';

import { WishlistsFacade } from '../../facades/wishlists.facade';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { pick } from 'lodash-es';
import { Observable } from 'rxjs';

import { HttpError } from 'ish-core/models/http-error/http-error.model';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { User } from 'ish-core/models/user/user.model';
import { SelectOption } from 'ish-shared/forms/components/select/select.component';
import { markAsDirtyRecursive } from 'ish-shared/forms/utils/form-utils';
import { FormsService } from 'ish-shared/forms/utils/forms.service';
import { SpecialValidators } from 'ish-shared/forms/validators/special-validators';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { FormControl, Validators } from '@angular/forms';
import { range } from 'lodash-es';
import { takeUntil } from 'rxjs/operators';

import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { ScriptLoaderService } from 'ish-core/utils/script-loader/script-loader.service';
import { SelectOption } from 'ish-shared/forms/components/select/select.component';
import { markAsDirtyRecursive } from 'ish-shared/forms/utils/form-utils';

import { PaymentConcardisComponent } from '../payment-concardis/payment-concardis.component';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { takeUntil } from 'rxjs/operators';

import { Attribute } from 'ish-core/models/attribute/attribute.model';
import { PaymentMethod } from 'ish-core/models/payment-method/payment-method.model';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { ScriptLoaderService } from 'ish-core/utils/script-loader/script-loader.service';
import { SelectOption } from 'ish-shared/forms/components/select/select.component';
import { markAsDirtyRecursive } from 'ish-shared/forms/utils/form-utils';

// tslint:disable:no-any - allows access to cybersource js functionality
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { distinctUntilChanged, map, shareReplay, switchMap, take, takeUntil } fr

import { AccountFacade } from 'ish-core/facades/account.facade';
import { CheckoutFacade } from 'ish-core/facades/checkout.facade';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { whenTruthy } from 'ish-core/utils/operators';
import { SelectOption } from 'ish-shared/forms/components/select/select.component';
import { markAsDirtyRecursive } from 'ish-shared/forms/utils/form-utils';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/c
import { ActivatedRoute, Router } from '@angular/router';

import { SortableAttributesType } from 'ish-core/models/product-listing/product-listing.model';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { ViewType } from 'ish-core/models/viewtype/viewtype.types';
import { SelectOption } from 'ish-shared/forms/components/select/select.component';

@Component({
selector: 'ish-product-list-toolbar',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { map } from 'rxjs/operators';

import { AppFacade } from 'ish-core/facades/app.facade';
import { Address } from 'ish-core/models/address/address.model';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { AddressFormConfigurationProvider } from 'ish-shared/formly-address-forms/configurations/address-form-configuration.provider';
import { SelectOption } from 'ish-shared/forms/components/select/select.component';

@Component({
selector: 'ish-formly-address-form',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
import { FormControl } from '@angular/forms';
import { FieldType } from '@ngx-formly/core';

import { SelectOption } from 'ish-shared/forms/components/select/select.component';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';

/**
* Type for a basic select field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core';

import { Address } from 'ish-core/models/address/address.model';
import { SelectComponent, SelectOption } from 'ish-shared/forms/components/select/select.component';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { SelectComponent } from 'ish-shared/forms/components/select/select.component';

// tslint:disable ish-deprecation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core';

import { Country } from 'ish-core/models/country/country.model';
import { SelectComponent, SelectOption } from 'ish-shared/forms/components/select/select.component';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { SelectComponent } from 'ish-shared/forms/components/select/select.component';

// tslint:disable ish-deprecation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core';

import { Region } from 'ish-core/models/region/region.model';
import { SelectComponent, SelectOption } from 'ish-shared/forms/components/select/select.component';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { SelectComponent } from 'ish-shared/forms/components/select/select.component';

// tslint:disable ish-deprecation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ChangeDetectionStrategy, Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';

import { SelectComponent, SelectOption } from 'ish-shared/forms/components/select/select.component';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { SelectComponent } from 'ish-shared/forms/components/select/select.component';

// tslint:disable ish-deprecation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angula
import { TranslateModule } from '@ngx-translate/core';
import { MockComponent, MockDirective } from 'ng-mocks';

import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { FormControlFeedbackComponent } from 'ish-shared/forms/components/form-control-feedback/form-control-feedback.component';
import { ShowFormFeedbackDirective } from 'ish-shared/forms/directives/show-form-feedback.directive';

import { SelectComponent, SelectOption } from './select.component';
import { SelectComponent } from './select.component';

// tslint:disable ish-deprecation

Expand Down
6 changes: 1 addition & 5 deletions src/app/shared/forms/components/select/select.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';

import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { FormElementComponent } from 'ish-shared/forms/components/form-element/form-element.component';

export interface SelectOption {
value: string;
label: string;
}

// tslint:disable ish-deprecation

/**
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/forms/utils/forms.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { of } from 'rxjs';
import { instance, mock } from 'ts-mockito';

import { Address } from 'ish-core/models/address/address.model';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { CoreStoreModule } from 'ish-core/store/core/core-store.module';
import { SelectOption } from 'ish-shared/forms/components/select/select.component';

import { FormsService } from './forms.service';

Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/forms/utils/forms.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { Observable, OperatorFunction } from 'rxjs';
import { map } from 'rxjs/operators';

import { Address } from 'ish-core/models/address/address.model';
import { SelectOption } from 'ish-core/models/select-option/select-option.model';
import { getCurrentLocale } from 'ish-core/store/core/configuration';
import { whenTruthy } from 'ish-core/utils/operators';
import { SelectOption } from 'ish-shared/forms/components/select/select.component';

/**
* FormsService.getAddressOptions as a pipeable operator
Expand Down

0 comments on commit c634b58

Please sign in to comment.