From 3db939b3308fdf309aec2eaefa69918765ff9e1d Mon Sep 17 00:00:00 2001 From: Maxime Robert Date: Sun, 13 Sep 2020 22:48:16 +0200 Subject: [PATCH] feat: split old and new API so that we can access them with ngx-sub-form and ngx-sub-form/new to avoid making a breaking change --- projects/ngx-sub-form/new/ng-package.json | 8 ++++++++ .../{src/lib/new => new/src}/helpers.ts | 2 +- .../{src/lib/new => new/src}/helpers.types.ts | 0 .../{src/lib/new => new/src}/ngx-sub-form.ts | 4 ++-- .../lib/new => new/src}/ngx-sub-form.types.ts | 4 ++-- projects/ngx-sub-form/public_api.new.ts | 16 ++++++++++++++++ .../ngx-automatic-root-form.component.spec.ts | 12 ++++++------ .../ngx-automatic-root-form.component.ts | 0 .../ngx-root-form.component.spec.ts | 2 +- .../{ => deprecated}/ngx-root-form.component.ts | 4 ++-- .../ngx-sub-form.component.spec.ts | 0 .../{ => deprecated}/ngx-sub-form.component.ts | 4 ++-- .../{ => deprecated}/ngx-sub-form.decorators.ts | 0 .../ngx-sub-form/src/lib/ngx-sub-form-tokens.ts | 11 ----------- .../src/lib/{ => shared}/ngx-sub-form-utils.ts | 9 ++------- .../lib/{ => shared}/ngx-sub-form.types.spec.ts | 0 .../src/lib/{ => shared}/ngx-sub-form.types.ts | 4 ++-- projects/ngx-sub-form/src/public_api.ts | 12 ++++++------ .../assassin-droid/assassin-droid.component.ts | 3 +-- .../astromech-droid/astromech-droid.component.ts | 3 +-- .../droid-listing/droid-product.component.ts | 3 +-- .../medical-droid/medical-droid.component.ts | 3 +-- .../protocol-droid/protocol-droid.component.ts | 3 +-- .../listing-form/listing-form.component.ts | 3 +-- .../crew-member/crew-member.component.ts | 3 +-- .../crew-members/crew-members.component.ts | 3 +-- .../spaceship/spaceship.component.ts | 3 +-- .../vehicle-listing/speeder/speeder.component.ts | 3 +-- .../vehicle-listing/vehicle-product.component.ts | 3 +-- tsconfig.json | 2 +- 30 files changed, 62 insertions(+), 65 deletions(-) create mode 100644 projects/ngx-sub-form/new/ng-package.json rename projects/ngx-sub-form/{src/lib/new => new/src}/helpers.ts (99%) rename projects/ngx-sub-form/{src/lib/new => new/src}/helpers.types.ts (100%) rename projects/ngx-sub-form/{src/lib/new => new/src}/ngx-sub-form.ts (98%) rename projects/ngx-sub-form/{src/lib/new => new/src}/ngx-sub-form.types.ts (96%) create mode 100644 projects/ngx-sub-form/public_api.new.ts rename projects/ngx-sub-form/src/lib/{ => deprecated}/ngx-automatic-root-form.component.spec.ts (95%) rename projects/ngx-sub-form/src/lib/{ => deprecated}/ngx-automatic-root-form.component.ts (100%) rename projects/ngx-sub-form/src/lib/{ => deprecated}/ngx-root-form.component.spec.ts (99%) rename projects/ngx-sub-form/src/lib/{ => deprecated}/ngx-root-form.component.ts (95%) rename projects/ngx-sub-form/src/lib/{ => deprecated}/ngx-sub-form.component.spec.ts (100%) rename projects/ngx-sub-form/src/lib/{ => deprecated}/ngx-sub-form.component.ts (99%) rename projects/ngx-sub-form/src/lib/{ => deprecated}/ngx-sub-form.decorators.ts (100%) delete mode 100644 projects/ngx-sub-form/src/lib/ngx-sub-form-tokens.ts rename projects/ngx-sub-form/src/lib/{ => shared}/ngx-sub-form-utils.ts (95%) rename projects/ngx-sub-form/src/lib/{ => shared}/ngx-sub-form.types.spec.ts (100%) rename projects/ngx-sub-form/src/lib/{ => shared}/ngx-sub-form.types.ts (87%) diff --git a/projects/ngx-sub-form/new/ng-package.json b/projects/ngx-sub-form/new/ng-package.json new file mode 100644 index 00000000..ac769b65 --- /dev/null +++ b/projects/ngx-sub-form/new/ng-package.json @@ -0,0 +1,8 @@ +{ + "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", + "dest": "../../dist/ngx-sub-form", + "lib": { + "entryFile": "../public_api.new.ts" + }, + "whitelistedNonPeerDependencies": ["fast-deep-equal"] +} diff --git a/projects/ngx-sub-form/src/lib/new/helpers.ts b/projects/ngx-sub-form/new/src/helpers.ts similarity index 99% rename from projects/ngx-sub-form/src/lib/new/helpers.ts rename to projects/ngx-sub-form/new/src/helpers.ts index 0c27f324..428d512f 100644 --- a/projects/ngx-sub-form/src/lib/new/helpers.ts +++ b/projects/ngx-sub-form/new/src/helpers.ts @@ -14,7 +14,7 @@ import { NewFormErrors, OneOfControlsTypes, TypedFormGroup, -} from '../ngx-sub-form-utils'; +} from '../../src/lib/shared/ngx-sub-form-utils'; import { ControlValueAccessorComponentInstance, FormBindings, diff --git a/projects/ngx-sub-form/src/lib/new/helpers.types.ts b/projects/ngx-sub-form/new/src/helpers.types.ts similarity index 100% rename from projects/ngx-sub-form/src/lib/new/helpers.types.ts rename to projects/ngx-sub-form/new/src/helpers.types.ts diff --git a/projects/ngx-sub-form/src/lib/new/ngx-sub-form.ts b/projects/ngx-sub-form/new/src/ngx-sub-form.ts similarity index 98% rename from projects/ngx-sub-form/src/lib/new/ngx-sub-form.ts rename to projects/ngx-sub-form/new/src/ngx-sub-form.ts index 6386c0ef..15a878ed 100644 --- a/projects/ngx-sub-form/src/lib/new/ngx-sub-form.ts +++ b/projects/ngx-sub-form/new/src/ngx-sub-form.ts @@ -1,9 +1,9 @@ -import { ɵivyEnabled, ɵmarkDirty as markDirty } from '@angular/core'; +import { ɵmarkDirty as markDirty } from '@angular/core'; import isEqual from 'fast-deep-equal'; import { decorateObservableLifecycle, getObservableLifecycle } from 'ngx-observable-lifecycle'; import { EMPTY, forkJoin, Observable, of } from 'rxjs'; import { delay, filter, map, mapTo, shareReplay, switchMap, take, takeUntil, tap } from 'rxjs/operators'; -import { isNullOrUndefined } from '../ngx-sub-form-utils'; +import { isNullOrUndefined } from '../../src/lib/shared/ngx-sub-form-utils'; import { createFormDataFromOptions, getControlValueAccessorBindings, diff --git a/projects/ngx-sub-form/src/lib/new/ngx-sub-form.types.ts b/projects/ngx-sub-form/new/src/ngx-sub-form.types.ts similarity index 96% rename from projects/ngx-sub-form/src/lib/new/ngx-sub-form.types.ts rename to projects/ngx-sub-form/new/src/ngx-sub-form.types.ts index a1bc31f6..b7e4237f 100644 --- a/projects/ngx-sub-form/src/lib/new/ngx-sub-form.types.ts +++ b/projects/ngx-sub-form/new/src/ngx-sub-form.types.ts @@ -8,8 +8,8 @@ import { ControlsNames, NewFormErrors, TypedFormGroup, -} from '../ngx-sub-form-utils'; -import { FormGroupOptions } from '../ngx-sub-form.types'; +} from '../../src/lib/shared/ngx-sub-form-utils'; +import { FormGroupOptions } from '../../src/lib/shared/ngx-sub-form.types'; import { AreTypesSimilar } from './helpers.types'; export interface ComponentHooks { diff --git a/projects/ngx-sub-form/public_api.new.ts b/projects/ngx-sub-form/public_api.new.ts new file mode 100644 index 00000000..8696ba26 --- /dev/null +++ b/projects/ngx-sub-form/public_api.new.ts @@ -0,0 +1,16 @@ +/* + * Public API Surface of sub-form + */ + +// in order to **not** bring a breaking change with the rewrite +// to allow incremental updates, we publish the library using +// 2 different paths: `ngx-sub-form` and `ngx-sub-form/new` +// as within the `new` package we use shared functionalities +// coming from the old code, we need to have the root of the lib +// higher than the `new` folder, see following issue +// https://github.com/ng-packagr/ng-packagr/issues/358#issuecomment-524504864 + +export * from './new/src/helpers'; +export * from './new/src/helpers.types'; +export * from './new/src/ngx-sub-form'; +export { FormType } from './new/src/ngx-sub-form.types'; diff --git a/projects/ngx-sub-form/src/lib/ngx-automatic-root-form.component.spec.ts b/projects/ngx-sub-form/src/lib/deprecated/ngx-automatic-root-form.component.spec.ts similarity index 95% rename from projects/ngx-sub-form/src/lib/ngx-automatic-root-form.component.spec.ts rename to projects/ngx-sub-form/src/lib/deprecated/ngx-automatic-root-form.component.spec.ts index 271c381d..d75cd042 100644 --- a/projects/ngx-sub-form/src/lib/ngx-automatic-root-form.component.spec.ts +++ b/projects/ngx-sub-form/src/lib/deprecated/ngx-automatic-root-form.component.spec.ts @@ -1,11 +1,11 @@ -import { EventEmitter, Input, Component, Output, DebugElement } from '@angular/core'; -import { Controls } from './ngx-sub-form-utils'; -import { FormControl, Validators, ReactiveFormsModule } from '@angular/forms'; -import { BehaviorSubject } from 'rxjs'; -import { TestBed, async, ComponentFixture } from '@angular/core/testing'; +import { Component, DebugElement, EventEmitter, Input, Output } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms'; import { By } from '@angular/platform-browser'; -import { DataInput } from './ngx-sub-form.decorators'; +import { BehaviorSubject } from 'rxjs'; +import { Controls } from '../shared/ngx-sub-form-utils'; import { NgxAutomaticRootFormComponent } from './ngx-automatic-root-form.component'; +import { DataInput } from './ngx-sub-form.decorators'; interface Vehicle { color?: string | null; diff --git a/projects/ngx-sub-form/src/lib/ngx-automatic-root-form.component.ts b/projects/ngx-sub-form/src/lib/deprecated/ngx-automatic-root-form.component.ts similarity index 100% rename from projects/ngx-sub-form/src/lib/ngx-automatic-root-form.component.ts rename to projects/ngx-sub-form/src/lib/deprecated/ngx-automatic-root-form.component.ts diff --git a/projects/ngx-sub-form/src/lib/ngx-root-form.component.spec.ts b/projects/ngx-sub-form/src/lib/deprecated/ngx-root-form.component.spec.ts similarity index 99% rename from projects/ngx-sub-form/src/lib/ngx-root-form.component.spec.ts rename to projects/ngx-sub-form/src/lib/deprecated/ngx-root-form.component.spec.ts index 12cf687e..1fcf023c 100644 --- a/projects/ngx-sub-form/src/lib/ngx-root-form.component.spec.ts +++ b/projects/ngx-sub-form/src/lib/deprecated/ngx-root-form.component.spec.ts @@ -3,8 +3,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { FormArray, FormControl, ReactiveFormsModule, Validators } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { BehaviorSubject } from 'rxjs'; +import { ArrayPropertyKey, ArrayPropertyValue, Controls } from '../shared/ngx-sub-form-utils'; import { NgxRootFormComponent } from './ngx-root-form.component'; -import { ArrayPropertyKey, ArrayPropertyValue, Controls } from './ngx-sub-form-utils'; import { DataInput } from './ngx-sub-form.decorators'; import { NgxFormWithArrayControls } from './ngx-sub-form.types'; diff --git a/projects/ngx-sub-form/src/lib/ngx-root-form.component.ts b/projects/ngx-sub-form/src/lib/deprecated/ngx-root-form.component.ts similarity index 95% rename from projects/ngx-sub-form/src/lib/ngx-root-form.component.ts rename to projects/ngx-sub-form/src/lib/deprecated/ngx-root-form.component.ts index e443bedc..eabe33d1 100644 --- a/projects/ngx-sub-form/src/lib/ngx-root-form.component.ts +++ b/projects/ngx-sub-form/src/lib/deprecated/ngx-root-form.component.ts @@ -1,9 +1,9 @@ -import { EventEmitter, OnInit, Input, Component, Directive } from '@angular/core'; +import { Directive, EventEmitter, Input, OnInit } from '@angular/core'; import isEqual from 'fast-deep-equal'; import { BehaviorSubject, Subject } from 'rxjs'; import { filter, tap } from 'rxjs/operators'; +import { isNullOrUndefined, takeUntilDestroyed } from '../shared/ngx-sub-form-utils'; import { NgxSubFormRemapComponent } from './ngx-sub-form.component'; -import { takeUntilDestroyed, isNullOrUndefined } from './ngx-sub-form-utils'; @Directive() // tslint:disable-next-line: directive-class-suffix diff --git a/projects/ngx-sub-form/src/lib/ngx-sub-form.component.spec.ts b/projects/ngx-sub-form/src/lib/deprecated/ngx-sub-form.component.spec.ts similarity index 100% rename from projects/ngx-sub-form/src/lib/ngx-sub-form.component.spec.ts rename to projects/ngx-sub-form/src/lib/deprecated/ngx-sub-form.component.spec.ts diff --git a/projects/ngx-sub-form/src/lib/ngx-sub-form.component.ts b/projects/ngx-sub-form/src/lib/deprecated/ngx-sub-form.component.ts similarity index 99% rename from projects/ngx-sub-form/src/lib/ngx-sub-form.component.ts rename to projects/ngx-sub-form/src/lib/deprecated/ngx-sub-form.component.ts index 6b52abf5..2d566b77 100644 --- a/projects/ngx-sub-form/src/lib/ngx-sub-form.component.ts +++ b/projects/ngx-sub-form/src/lib/deprecated/ngx-sub-form.component.ts @@ -23,8 +23,8 @@ import { MissingFormControlsError, TypedAbstractControl, TypedFormGroup, -} from './ngx-sub-form-utils'; -import { FormGroupOptions, NgxFormWithArrayControls, OnFormUpdate } from './ngx-sub-form.types'; +} from '../shared/ngx-sub-form-utils'; +import { FormGroupOptions, NgxFormWithArrayControls, OnFormUpdate } from '../shared/ngx-sub-form.types'; type MapControlFunction = ( ctrl: TypedAbstractControl, diff --git a/projects/ngx-sub-form/src/lib/ngx-sub-form.decorators.ts b/projects/ngx-sub-form/src/lib/deprecated/ngx-sub-form.decorators.ts similarity index 100% rename from projects/ngx-sub-form/src/lib/ngx-sub-form.decorators.ts rename to projects/ngx-sub-form/src/lib/deprecated/ngx-sub-form.decorators.ts diff --git a/projects/ngx-sub-form/src/lib/ngx-sub-form-tokens.ts b/projects/ngx-sub-form/src/lib/ngx-sub-form-tokens.ts deleted file mode 100644 index d04ff268..00000000 --- a/projects/ngx-sub-form/src/lib/ngx-sub-form-tokens.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { InjectionToken } from '@angular/core'; -import { NgxSubFormComponent } from './ngx-sub-form.component'; - -// ---------------------------------------------------------------------------------------- -// no need to expose that token out of the lib, do not export that file from public_api.ts! -// ---------------------------------------------------------------------------------------- - -// see https://github.com/angular/angular/issues/8277#issuecomment-263029485 -// this basically allows us to access the host component -// from a directive without knowing the type of the component at run time -export const SUB_FORM_COMPONENT_TOKEN = new InjectionToken>('NgxSubFormComponentToken'); diff --git a/projects/ngx-sub-form/src/lib/ngx-sub-form-utils.ts b/projects/ngx-sub-form/src/lib/shared/ngx-sub-form-utils.ts similarity index 95% rename from projects/ngx-sub-form/src/lib/ngx-sub-form-utils.ts rename to projects/ngx-sub-form/src/lib/shared/ngx-sub-form-utils.ts index f80951d8..9d184492 100644 --- a/projects/ngx-sub-form/src/lib/ngx-sub-form-utils.ts +++ b/projects/ngx-sub-form/src/lib/shared/ngx-sub-form-utils.ts @@ -1,4 +1,4 @@ -import { forwardRef, InjectionToken, Type } from '@angular/core'; +import { InjectionToken, Type } from '@angular/core'; import { AbstractControl, ControlValueAccessor, @@ -11,8 +11,7 @@ import { } from '@angular/forms'; import { Observable, Subject, timer } from 'rxjs'; import { debounce, takeUntil } from 'rxjs/operators'; -import { SUB_FORM_COMPONENT_TOKEN } from './ngx-sub-form-tokens'; -import { NgxSubFormComponent } from './ngx-sub-form.component'; +import { NgxSubFormComponent } from '../deprecated/ngx-sub-form.component'; export type Controls = { [K in keyof T]-?: AbstractControl }; @@ -111,10 +110,6 @@ export function subformComponentProviders( useExisting: component, multi: true, }, - { - provide: SUB_FORM_COMPONENT_TOKEN, - useExisting: component, - }, ]; } diff --git a/projects/ngx-sub-form/src/lib/ngx-sub-form.types.spec.ts b/projects/ngx-sub-form/src/lib/shared/ngx-sub-form.types.spec.ts similarity index 100% rename from projects/ngx-sub-form/src/lib/ngx-sub-form.types.spec.ts rename to projects/ngx-sub-form/src/lib/shared/ngx-sub-form.types.spec.ts diff --git a/projects/ngx-sub-form/src/lib/ngx-sub-form.types.ts b/projects/ngx-sub-form/src/lib/shared/ngx-sub-form.types.ts similarity index 87% rename from projects/ngx-sub-form/src/lib/ngx-sub-form.types.ts rename to projects/ngx-sub-form/src/lib/shared/ngx-sub-form.types.ts index 8f881c3d..01d6bcd1 100644 --- a/projects/ngx-sub-form/src/lib/ngx-sub-form.types.ts +++ b/projects/ngx-sub-form/src/lib/shared/ngx-sub-form.types.ts @@ -1,6 +1,6 @@ -import { FormControl, FormGroup, ValidationErrors } from '@angular/forms'; +import { FormControl, ValidationErrors } from '@angular/forms'; import { Observable } from 'rxjs'; -import { ArrayPropertyKey, ArrayPropertyValue, Controls, FormUpdate, TypedFormGroup } from './ngx-sub-form-utils'; +import { ArrayPropertyKey, ArrayPropertyValue, FormUpdate, TypedFormGroup } from './ngx-sub-form-utils'; // @deprecated export interface OnFormUpdate { diff --git a/projects/ngx-sub-form/src/public_api.ts b/projects/ngx-sub-form/src/public_api.ts index 9376102a..9f4b54fe 100644 --- a/projects/ngx-sub-form/src/public_api.ts +++ b/projects/ngx-sub-form/src/public_api.ts @@ -2,9 +2,9 @@ * Public API Surface of sub-form */ -export * from './lib/ngx-sub-form-utils'; -export * from './lib/ngx-sub-form.component'; -export * from './lib/ngx-root-form.component'; -export * from './lib/ngx-automatic-root-form.component'; -export * from './lib/ngx-sub-form.types'; -export * from './lib/ngx-sub-form.decorators'; +export * from './lib/deprecated/ngx-automatic-root-form.component'; +export * from './lib/deprecated/ngx-root-form.component'; +export * from './lib/deprecated/ngx-sub-form.component'; +export * from './lib/deprecated/ngx-sub-form.decorators'; +export * from './lib/shared/ngx-sub-form-utils'; +export * from './lib/shared/ngx-sub-form.types'; diff --git a/src/app/main-rewrite/listing/listing-form/droid-listing/assassin-droid/assassin-droid.component.ts b/src/app/main-rewrite/listing/listing-form/droid-listing/assassin-droid/assassin-droid.component.ts index 4c6ea764..c674af57 100644 --- a/src/app/main-rewrite/listing/listing-form/droid-listing/assassin-droid/assassin-droid.component.ts +++ b/src/app/main-rewrite/listing/listing-form/droid-listing/assassin-droid/assassin-droid.component.ts @@ -1,9 +1,8 @@ import { Component, forwardRef } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { subformComponentProviders } from 'ngx-sub-form'; +import { createForm, FormType, NgxSubForm } from 'ngx-sub-form/new'; import { AssassinDroid, AssassinDroidWeapon, DroidType } from 'src/app/interfaces/droid.interface'; -import { createForm, NgxSubForm } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form'; -import { FormType } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form.types'; export const ASSASSIN_DROID_WEAPON_TEXT: { [K in AssassinDroidWeapon]: string } = { [AssassinDroidWeapon.SABER]: 'Saber', diff --git a/src/app/main-rewrite/listing/listing-form/droid-listing/astromech-droid/astromech-droid.component.ts b/src/app/main-rewrite/listing/listing-form/droid-listing/astromech-droid/astromech-droid.component.ts index 9a93b6da..5d9c9d78 100644 --- a/src/app/main-rewrite/listing/listing-form/droid-listing/astromech-droid/astromech-droid.component.ts +++ b/src/app/main-rewrite/listing/listing-form/droid-listing/astromech-droid/astromech-droid.component.ts @@ -1,8 +1,7 @@ import { Component, forwardRef } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { subformComponentProviders } from 'ngx-sub-form'; -import { createForm, NgxSubForm } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form'; -import { FormType } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form.types'; +import { createForm, FormType, NgxSubForm } from 'ngx-sub-form/new'; import { AstromechDroid, AstromechDroidShape, DroidType } from '../../../../../interfaces/droid.interface'; @NgxSubForm() diff --git a/src/app/main-rewrite/listing/listing-form/droid-listing/droid-product.component.ts b/src/app/main-rewrite/listing/listing-form/droid-listing/droid-product.component.ts index 947303b2..75781590 100644 --- a/src/app/main-rewrite/listing/listing-form/droid-listing/droid-product.component.ts +++ b/src/app/main-rewrite/listing/listing-form/droid-listing/droid-product.component.ts @@ -1,6 +1,7 @@ import { Component, forwardRef } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { subformComponentProviders } from 'ngx-sub-form'; +import { createForm, FormType, NgxSubForm } from 'ngx-sub-form/new'; import { AssassinDroid, AstromechDroid, @@ -9,8 +10,6 @@ import { OneDroid, ProtocolDroid, } from 'src/app/interfaces/droid.interface'; -import { createForm, NgxSubForm } from '../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form'; -import { FormType } from '../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form.types'; import { UnreachableCase } from '../../../../shared/utils'; interface OneDroidForm { diff --git a/src/app/main-rewrite/listing/listing-form/droid-listing/medical-droid/medical-droid.component.ts b/src/app/main-rewrite/listing/listing-form/droid-listing/medical-droid/medical-droid.component.ts index 6ff174f6..d69dcb38 100644 --- a/src/app/main-rewrite/listing/listing-form/droid-listing/medical-droid/medical-droid.component.ts +++ b/src/app/main-rewrite/listing/listing-form/droid-listing/medical-droid/medical-droid.component.ts @@ -1,9 +1,8 @@ import { Component, forwardRef } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { subformComponentProviders } from 'ngx-sub-form'; +import { createForm, FormType, NgxSubForm } from 'ngx-sub-form/new'; import { DroidType, MedicalDroid } from 'src/app/interfaces/droid.interface'; -import { createForm, NgxSubForm } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form'; -import { FormType } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form.types'; @NgxSubForm() @Component({ diff --git a/src/app/main-rewrite/listing/listing-form/droid-listing/protocol-droid/protocol-droid.component.ts b/src/app/main-rewrite/listing/listing-form/droid-listing/protocol-droid/protocol-droid.component.ts index cd20360b..3de573da 100644 --- a/src/app/main-rewrite/listing/listing-form/droid-listing/protocol-droid/protocol-droid.component.ts +++ b/src/app/main-rewrite/listing/listing-form/droid-listing/protocol-droid/protocol-droid.component.ts @@ -2,8 +2,7 @@ import { Component, forwardRef } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { getObservableLifecycle } from 'ngx-observable-lifecycle'; import { subformComponentProviders } from 'ngx-sub-form'; -import { createForm, NgxSubForm } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form'; -import { FormType } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form.types'; +import { createForm, FormType, NgxSubForm } from 'ngx-sub-form/new'; import { DroidType, Languages, ProtocolDroid } from '../../../../../interfaces/droid.interface'; @NgxSubForm() diff --git a/src/app/main-rewrite/listing/listing-form/listing-form.component.ts b/src/app/main-rewrite/listing/listing-form/listing-form.component.ts index 96663835..1b8c4fc4 100644 --- a/src/app/main-rewrite/listing/listing-form/listing-form.component.ts +++ b/src/app/main-rewrite/listing/listing-form/listing-form.component.ts @@ -1,9 +1,8 @@ import { Component, Input, Output } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; +import { createForm, FormType, NgxSubForm } from 'ngx-sub-form/new'; import { Subject } from 'rxjs'; import { ListingType, OneListing } from 'src/app/interfaces/listing.interface'; -import { createForm, NgxSubForm } from '../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form'; -import { FormType } from '../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form.types'; import { OneDroid } from '../../../interfaces/droid.interface'; import { OneVehicle } from '../../../interfaces/vehicle.interface'; import { UnreachableCase } from '../../../shared/utils'; diff --git a/src/app/main-rewrite/listing/listing-form/vehicle-listing/crew-members/crew-member/crew-member.component.ts b/src/app/main-rewrite/listing/listing-form/vehicle-listing/crew-members/crew-member/crew-member.component.ts index e70fab95..22b1b1d8 100644 --- a/src/app/main-rewrite/listing/listing-form/vehicle-listing/crew-members/crew-member/crew-member.component.ts +++ b/src/app/main-rewrite/listing/listing-form/vehicle-listing/crew-members/crew-member/crew-member.component.ts @@ -1,8 +1,7 @@ import { Component, forwardRef } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { subformComponentProviders } from 'ngx-sub-form'; -import { createForm, NgxSubForm } from '../../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form'; -import { FormType } from '../../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form.types'; +import { createForm, FormType, NgxSubForm } from 'ngx-sub-form/new'; import { CrewMember } from '../../../../../../interfaces/crew-member.interface'; @NgxSubForm() diff --git a/src/app/main-rewrite/listing/listing-form/vehicle-listing/crew-members/crew-members.component.ts b/src/app/main-rewrite/listing/listing-form/vehicle-listing/crew-members/crew-members.component.ts index 556e0d03..71c7419b 100644 --- a/src/app/main-rewrite/listing/listing-form/vehicle-listing/crew-members/crew-members.component.ts +++ b/src/app/main-rewrite/listing/listing-form/vehicle-listing/crew-members/crew-members.component.ts @@ -1,8 +1,7 @@ import { Component, forwardRef } from '@angular/core'; import { FormArray, FormControl, Validators } from '@angular/forms'; import { ArrayPropertyKey, ArrayPropertyValue, subformComponentProviders } from 'ngx-sub-form'; -import { createForm, NgxSubForm } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form'; -import { FormType } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form.types'; +import { createForm, FormType, NgxSubForm } from 'ngx-sub-form/new'; import { CrewMember } from '../../../../../interfaces/crew-member.interface'; interface CrewMembersForm { diff --git a/src/app/main-rewrite/listing/listing-form/vehicle-listing/spaceship/spaceship.component.ts b/src/app/main-rewrite/listing/listing-form/vehicle-listing/spaceship/spaceship.component.ts index 4c338347..ed3dd7d2 100644 --- a/src/app/main-rewrite/listing/listing-form/vehicle-listing/spaceship/spaceship.component.ts +++ b/src/app/main-rewrite/listing/listing-form/vehicle-listing/spaceship/spaceship.component.ts @@ -1,9 +1,8 @@ import { Component, forwardRef } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { subformComponentProviders } from 'ngx-sub-form'; +import { createForm, FormType, NgxSubForm } from 'ngx-sub-form/new'; import { Spaceship, VehicleType } from 'src/app/interfaces/vehicle.interface'; -import { createForm, NgxSubForm } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form'; -import { FormType } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form.types'; @NgxSubForm() @Component({ diff --git a/src/app/main-rewrite/listing/listing-form/vehicle-listing/speeder/speeder.component.ts b/src/app/main-rewrite/listing/listing-form/vehicle-listing/speeder/speeder.component.ts index ca4e932c..d12f8af8 100644 --- a/src/app/main-rewrite/listing/listing-form/vehicle-listing/speeder/speeder.component.ts +++ b/src/app/main-rewrite/listing/listing-form/vehicle-listing/speeder/speeder.component.ts @@ -1,9 +1,8 @@ import { Component, forwardRef } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { subformComponentProviders } from 'ngx-sub-form'; +import { createForm, FormType, NgxSubForm } from 'ngx-sub-form/new'; import { Speeder, VehicleType } from 'src/app/interfaces/vehicle.interface'; -import { createForm, NgxSubForm } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form'; -import { FormType } from '../../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form.types'; @NgxSubForm() @Component({ diff --git a/src/app/main-rewrite/listing/listing-form/vehicle-listing/vehicle-product.component.ts b/src/app/main-rewrite/listing/listing-form/vehicle-listing/vehicle-product.component.ts index 3e0620d5..863c3d1a 100644 --- a/src/app/main-rewrite/listing/listing-form/vehicle-listing/vehicle-product.component.ts +++ b/src/app/main-rewrite/listing/listing-form/vehicle-listing/vehicle-product.component.ts @@ -1,10 +1,9 @@ import { Component, forwardRef } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; import { subformComponentProviders } from 'ngx-sub-form'; +import { createForm, FormType, NgxSubForm } from 'ngx-sub-form/new'; import { OneVehicle, Spaceship, Speeder, VehicleType } from 'src/app/interfaces/vehicle.interface'; import { UnreachableCase } from 'src/app/shared/utils'; -import { createForm, NgxSubForm } from '../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form'; -import { FormType } from '../../../../../../projects/ngx-sub-form/src/lib/new/ngx-sub-form.types'; export interface OneVehicleForm { speeder: Speeder | null; diff --git a/tsconfig.json b/tsconfig.json index f5ead8c0..3d161ef1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,7 +21,7 @@ "lib": ["es2018", "dom"], "paths": { "ngx-sub-form": ["projects/ngx-sub-form/src/public_api"], - "ngx-sub-form/*": ["projects/ngx-sub-form/src/public_api"] + "ngx-sub-form/new": ["projects/ngx-sub-form/public_api.new"] } } }