Skip to content

Commit b61f430

Browse files
committed
Merge remote-tracking branch 'upstream/master'
# Conflicts: # projects/ngx-sub-form/src/lib/ngx-sub-form.types.ts
2 parents 7dc81c4 + 05ad0a8 commit b61f430

17 files changed

+4267
-3488
lines changed

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
sudo: false
22

3-
dist: trusty
3+
dist: bionic
44

55
language: node_js
66
node_js:
7-
- '10'
7+
- '12'
88

99
# https://github.com/cypress-io/cypress/issues/4069
1010
addons:
1111
apt:
1212
packages:
1313
- libgconf-2-4
14+
chrome: stable
1415

1516
cache:
1617
directories:
1718
- ~/.cache
1819
- node_modules
1920

21+
before_install:
22+
- curl -o- -L https://yarnpkg.com/install.sh | bash
23+
- export PATH="$HOME/.yarn/bin:$PATH"
24+
2025
install:
2126
- yarn --frozen-lockfile --non-interactive --no-progress
2227

@@ -28,7 +33,7 @@ script:
2833
- yarn run readme:check
2934
- yarn run lib:test:ci
3035
# build
31-
- yarn run lib:build:prod
36+
- yarn run lib:build:prod:view-engine
3237
- yarn run demo:build:prod --progress=false --base-href "https://cloudnc.github.io/ngx-sub-form/"
3338
# e2e tests
3439
- sed -i 's/<base href="https:\/\/cloudnc.github.io\/ngx-sub-form\/">/<base href="\/">/g' dist/ngx-sub-form-demo/index.html

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Install the [npm package](https://www.npmjs.com/package/ngx-sub-form): `ngx-sub-
2929
_Note about the versions:_
3030

3131
Angular <= 7: `2.7.1`
32-
Angular >= 8: Latest
32+
Angular 8.x : `4.x`
33+
Angular >= 9: Latest
3334

3435
## Demo
3536

angular.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"build": {
1818
"builder": "@angular-devkit/build-angular:browser",
1919
"options": {
20+
"aot": true,
2021
"outputPath": "dist/ngx-sub-form-demo",
2122
"index": "src/index.html",
2223
"main": "src/main.ts",
@@ -48,6 +49,10 @@
4849
"type": "initial",
4950
"maximumWarning": "2mb",
5051
"maximumError": "5mb"
52+
},
53+
{
54+
"type": "anyComponentStyle",
55+
"maximumWarning": "6kb"
5156
}
5257
]
5358
}
@@ -102,6 +107,11 @@
102107
"options": {
103108
"tsConfig": "projects/ngx-sub-form/tsconfig.lib.json",
104109
"project": "projects/ngx-sub-form/ng-package.json"
110+
},
111+
"configurations": {
112+
"production": {
113+
"tsConfig": "projects/ngx-sub-form/tsconfig.lib.prod.json"
114+
}
105115
}
106116
},
107117
"test": {

package.json

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
"demo:lint:check": "yarn run ng lint",
2121
"demo:lint:fix": "yarn run demo:lint:check --fix",
2222
"------------------ LIB ngx-sub-form ------------------": "",
23-
"lib:build:prod": "yarn run ng build --project ngx-sub-form",
24-
"lib:build:watch": "yarn run lib:build:prod --watch",
23+
"lib:build:prod:ivy": "yarn run ng build --project ngx-sub-form",
24+
"lib:build:prod:view-engine": "yarn run lib:build:prod:ivy --prod",
25+
"lib:build:watch": "yarn run lib:build:prod:view-engine --watch",
2526
"lib:test:watch": "yarn run ng test --project ngx-sub-form",
26-
"lib:test:ci": "yarn run ng test --project ngx-sub-form --watch false",
27+
"lib:test:ci": "yarn run ng test --project ngx-sub-form --watch false --browsers=ChromeHeadless",
2728
"------------------ Quick Commands ------------------": "",
2829
"lint:fix": "yarn demo:lint:fix && yarn prettier:write",
2930
"semantic-release": "semantic-release",
@@ -34,56 +35,55 @@
3435
},
3536
"private": true,
3637
"dependencies": {
37-
"@angular/animations": "8.2.14",
38-
"@angular/cdk": "8.2.3",
39-
"@angular/common": "8.2.14",
40-
"@angular/compiler": "8.2.14",
41-
"@angular/core": "8.2.14",
42-
"@angular/forms": "8.2.14",
43-
"@angular/http": "7.2.15",
44-
"@angular/material": "8.2.3",
45-
"@angular/platform-browser": "8.2.14",
46-
"@angular/platform-browser-dynamic": "8.2.14",
47-
"@angular/router": "8.2.14",
48-
"@types/uuid": "3.4.4",
49-
"commitizen": "3.1.1",
50-
"core-js": "3.1.3",
51-
"fast-deep-equal": "3.0.1",
52-
"rxjs": "6.5.2",
53-
"uuid": "3.3.2",
54-
"zone.js": "0.9.1"
38+
"@angular/animations": "9.0.1",
39+
"@angular/cdk": "9.0.0",
40+
"@angular/common": "9.0.1",
41+
"@angular/compiler": "9.0.1",
42+
"@angular/core": "9.0.1",
43+
"@angular/forms": "9.0.1",
44+
"@angular/http": "7.2.16",
45+
"@angular/material": "9.0.0",
46+
"@angular/platform-browser": "9.0.1",
47+
"@angular/platform-browser-dynamic": "9.0.1",
48+
"@angular/router": "9.0.1",
49+
"@types/uuid": "3.4.7",
50+
"commitizen": "4.0.3",
51+
"core-js": "3.6.4",
52+
"fast-deep-equal": "3.1.1",
53+
"rxjs": "6.5.4",
54+
"tslib": "1.10.0",
55+
"uuid": "3.4.0",
56+
"zone.js": "0.10.2"
5557
},
5658
"devDependencies": {
57-
"@angular-devkit/build-angular": "0.803.20",
58-
"@angular-devkit/build-ng-packagr": "0.803.20",
59-
"@angular/cli": "8.3.20",
60-
"@angular/compiler-cli": "8.2.14",
61-
"@angular/language-service": "8.2.14",
59+
"@angular-devkit/build-angular": "0.900.1",
60+
"@angular-devkit/build-ng-packagr": "0.900.1",
61+
"@angular/cli": "9.0.1",
62+
"@angular/compiler-cli": "9.0.1",
63+
"@angular/language-service": "9.0.1",
6264
"@bahmutov/add-typescript-to-cypress": "2.1.2",
63-
"@types/jasmine": "3.3.13",
64-
"@types/jasminewd2": "2.0.6",
65-
"@types/node": "12.0.7",
66-
"codelyzer": "5.1.0",
67-
"cypress": "3.2.0",
68-
"cz-conventional-changelog": "2.1.0",
69-
"embedme": "1.6.0",
65+
"@types/jasmine": "3.5.5",
66+
"@types/jasminewd2": "2.0.8",
67+
"@types/node": "13.7.2",
68+
"codelyzer": "5.2.1",
69+
"cypress": "4.0.2",
70+
"cz-conventional-changelog": "3.1.0",
71+
"embedme": "1.20.0",
7072
"http-server-spa": "1.3.0",
71-
"jasmine-core": "3.4.0",
73+
"jasmine-core": "3.5.0",
7274
"jasmine-spec-reporter": "4.2.1",
73-
"karma": "4.1.0",
74-
"karma-chrome-launcher": "2.2.0",
75-
"karma-coverage-istanbul-reporter": "2.0.5",
76-
"karma-jasmine": "2.0.1",
77-
"karma-jasmine-html-reporter": "1.4.2",
78-
"ng-packagr": "5.7.1",
75+
"karma": "4.4.1",
76+
"karma-chrome-launcher": "3.1.0",
77+
"karma-coverage-istanbul-reporter": "2.1.1",
78+
"karma-jasmine": "3.1.1",
79+
"karma-jasmine-html-reporter": "1.5.2",
80+
"ng-packagr": "9.0.1",
7981
"prettier": "1.19.1",
80-
"semantic-release": "15.13.12",
81-
"ts-node": "8.2.0",
82+
"semantic-release": "17.0.4",
83+
"ts-node": "8.6.2",
8284
"tsconfig-paths-webpack-plugin": "3.2.0",
83-
"tsickle": "0.35.0",
84-
"tslib": "1.10.0",
85-
"tslint": "5.17.0",
86-
"typescript": "3.4.5"
85+
"tslint": "6.0.0",
86+
"typescript": "3.7.5"
8787
},
8888
"repository": {
8989
"type": "git",

projects/ngx-sub-form/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"fast-deep-equal": "^3.0.1"
77
},
88
"peerDependencies": {
9-
"@angular/common": "^8.0.0",
10-
"@angular/core": "^8.0.0"
9+
"@angular/common": "^9.0.0",
10+
"@angular/core": "^9.0.0"
1111
},
1212
"keywords": [
1313
"Angular",

projects/ngx-sub-form/src/lib/ngx-automatic-root-form.component.spec.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ describe(`NgxAutomaticRootFormComponent`, () => {
112112
componentFixture.detectChanges();
113113

114114
setTimeout(() => {
115-
expect(vehicleUpdatedSpy).toHaveBeenCalledWith(getNewCorrectValues());
115+
// todo: after upgrading to ng 9 + all the deps the following
116+
// is typed from chai instead of jasmine and it triggers errors
117+
// it shouldn't block the new release though
118+
(expect(vehicleUpdatedSpy) as any).toHaveBeenCalledWith(getNewCorrectValues());
116119
done();
117120
}, 0);
118121
});
@@ -125,13 +128,19 @@ describe(`NgxAutomaticRootFormComponent`, () => {
125128
componentFixture.detectChanges();
126129

127130
setTimeout(() => {
128-
expect(vehicleUpdatedSpy).not.toHaveBeenCalled();
131+
// todo: after upgrading to ng 9 + all the deps the following
132+
// is typed from chai instead of jasmine and it triggers errors
133+
// it shouldn't block the new release though
134+
(expect(vehicleUpdatedSpy) as any).not.toHaveBeenCalled();
129135

130136
componentForm.formGroupControls.crewMemberCount.setValue(MAX_CREW_MEMBER_COUNT);
131137
// shouldn't require to call `componentForm.manualSave()`!
132138

133139
setTimeout(() => {
134-
expect(vehicleUpdatedSpy).toHaveBeenCalledWith({
140+
// todo: after upgrading to ng 9 + all the deps the following
141+
// is typed from chai instead of jasmine and it triggers errors
142+
// it shouldn't block the new release though
143+
(expect(vehicleUpdatedSpy) as any).toHaveBeenCalledWith({
135144
...getNewIncorrectValues(),
136145
crewMemberCount: MAX_CREW_MEMBER_COUNT,
137146
});

projects/ngx-sub-form/src/lib/ngx-automatic-root-form.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { OnInit } from '@angular/core';
1+
import { OnInit, Directive } from '@angular/core';
22
import { NgxRootFormComponent } from './ngx-root-form.component';
33

4+
@Directive()
5+
// tslint:disable-next-line: directive-class-suffix
46
export abstract class NgxAutomaticRootFormComponent<ControlInterface, FormInterface = ControlInterface>
57
extends NgxRootFormComponent<ControlInterface, FormInterface>
68
implements OnInit {

projects/ngx-sub-form/src/lib/ngx-root-form.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import { EventEmitter, OnInit, Input } from '@angular/core';
1+
import { EventEmitter, OnInit, Input, Component, Directive } from '@angular/core';
22
import isEqual from 'fast-deep-equal';
33
import { BehaviorSubject, Subject } from 'rxjs';
44
import { filter, tap } from 'rxjs/operators';
55
import { NgxSubFormRemapComponent } from './ngx-sub-form.component';
66
import { takeUntilDestroyed, isNullOrUndefined } from './ngx-sub-form-utils';
77

8+
@Directive()
9+
// tslint:disable-next-line: directive-class-suffix
810
export abstract class NgxRootFormComponent<ControlInterface, FormInterface = ControlInterface>
911
extends NgxSubFormRemapComponent<ControlInterface, FormInterface>
1012
implements OnInit {

projects/ngx-sub-form/src/lib/ngx-sub-form.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { OnDestroy } from '@angular/core';
1+
import { OnDestroy, Directive, Component } from '@angular/core';
22
import {
33
AbstractControl,
44
AbstractControlOptions,
@@ -36,6 +36,8 @@ type FilterControlFunction<FormInterface> = (
3636
isCtrlWithinFormArray: boolean,
3737
) => boolean;
3838

39+
@Directive()
40+
// tslint:disable-next-line: directive-class-suffix
3941
export abstract class NgxSubFormComponent<ControlInterface, FormInterface = ControlInterface>
4042
implements ControlValueAccessor, Validator, OnDestroy, OnFormUpdate<FormInterface> {
4143
public get formGroupControls(): ControlsType<FormInterface> {
@@ -425,6 +427,8 @@ export abstract class NgxSubFormComponent<ControlInterface, FormInterface = Cont
425427
}
426428
}
427429

430+
@Directive()
431+
// tslint:disable-next-line: directive-class-suffix
428432
export abstract class NgxSubFormRemapComponent<ControlInterface, FormInterface> extends NgxSubFormComponent<
429433
ControlInterface,
430434
FormInterface
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { FormControl, FormGroup } from '@angular/forms';
2+
import { TypedFormGroup } from 'ngx-sub-form';
3+
4+
describe(`TypedFormGroup`, () => {
5+
it(`should be assignable to the base @angular/forms FormGroup`, () => {
6+
let formGroup: FormGroup;
7+
8+
const typedFormGroup = new FormGroup({ foo: new FormControl() }) as TypedFormGroup<{ foo: true }>;
9+
10+
formGroup = typedFormGroup;
11+
12+
expect(true).toBe(true); // this is a type-only test, if the type breaks the test will not compile
13+
});
14+
});

0 commit comments

Comments
 (0)