Skip to content

Commit

Permalink
Merge pull request #276 from Waterstraal/feature/fix-angular-14.2-sup…
Browse files Browse the repository at this point in the history
…port

fix: angular 14.2 support
  • Loading branch information
maxime1992 authored Sep 26, 2022
2 parents 1f915b1 + d01cd69 commit e8093d8
Show file tree
Hide file tree
Showing 3 changed files with 2,518 additions and 2,602 deletions.
49 changes: 24 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"cy": "cypress",
"---------------------- DEMO ----------------------": "",
"demo:start": "yarn run ng serve",
"demo:start:e2e": "yarn run ng serve --port 4765 -o",
"demo:build:base": "yarn run ng build",
"demo:build:prod": "yarn run demo:build:base --configuration production",
"demo:test": "yarn run ng test",
Expand All @@ -31,22 +32,20 @@
"commit": "git add . && git-cz",
"readme:build": "embedme README.md && yarn run prettier README.md --write",
"readme:check": "yarn readme:build && ! git status | grep README.md || (echo 'You must commit build and commit changes to README.md!' && exit 1)",
"ngcc": "[ ! -f ./node_modules/.bin/ngcc ] || node --max_old_space_size=8000 ./node_modules/.bin/ngcc",
"postinstall": "yarn run ngcc",
"lint": "ng lint"
},
"private": true,
"dependencies": {
"@angular/animations": "14.0.2",
"@angular/cdk": "14.0.2",
"@angular/common": "14.0.2",
"@angular/compiler": "14.0.2",
"@angular/core": "14.0.2",
"@angular/forms": "14.0.2",
"@angular/material": "14.0.2",
"@angular/platform-browser": "14.0.2",
"@angular/platform-browser-dynamic": "14.0.2",
"@angular/router": "14.0.2",
"@angular/animations": "14.2.2",
"@angular/cdk": "14.0.6",
"@angular/common": "14.2.2",
"@angular/compiler": "14.2.2",
"@angular/core": "14.2.2",
"@angular/forms": "14.2.2",
"@angular/material": "14.0.6",
"@angular/platform-browser": "14.2.2",
"@angular/platform-browser-dynamic": "14.2.2",
"@angular/router": "14.2.2",
"@types/uuid": "8.3.4",
"commitizen": "4.2.4",
"core-js": "3.23.1",
Expand All @@ -59,26 +58,26 @@
"zone.js": "0.11.6"
},
"devDependencies": {
"@angular-devkit/build-angular": "14.0.2",
"@angular-eslint/builder": "13.5.0",
"@angular-eslint/eslint-plugin": "13.5.0",
"@angular-eslint/eslint-plugin-template": "13.5.0",
"@angular-eslint/schematics": "13.5.0",
"@angular-eslint/template-parser": "13.5.0",
"@angular/cli": "14.0.2",
"@angular/compiler-cli": "14.0.2",
"@angular/language-service": "14.0.2",
"@angular-devkit/build-angular": "14.2.3",
"@angular-eslint/builder": "14.1.1",
"@angular-eslint/eslint-plugin": "14.1.1",
"@angular-eslint/eslint-plugin-template": "14.1.1",
"@angular-eslint/schematics": "14.1.1",
"@angular-eslint/template-parser": "14.1.1",
"@angular/cli": "14.2.3",
"@angular/compiler-cli": "14.2.2",
"@angular/language-service": "14.2.2",
"@types/jasmine": "4.0.3",
"@types/jasminewd2": "2.0.10",
"@types/lodash": "4.14.182",
"@types/lodash-es": "4.17.6",
"@types/node": "17.0.40",
"@typescript-eslint/eslint-plugin": "5.28.0",
"@typescript-eslint/parser": "5.28.0",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"cypress": "10.1.0",
"cz-conventional-changelog": "3.3.0",
"embedme": "1.22.0",
"eslint": "8.18.0",
"eslint": "^8.23.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jsdoc": "39.3.3",
Expand All @@ -91,7 +90,7 @@
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-jasmine": "5.1.0",
"karma-jasmine-html-reporter": "2.0.0",
"ng-packagr": "14.0.2",
"ng-packagr": "14.0.4",
"prettier": "2.7.1",
"semantic-release": "19.0.3",
"ts-node": "10.8.1",
Expand Down
15 changes: 5 additions & 10 deletions projects/ngx-sub-form/src/lib/create-form.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { ɵmarkDirty as markDirty } from '@angular/core';
import { ChangeDetectorRef, inject } from '@angular/core';
import { UntypedFormControl } from '@angular/forms';
import isEqual from 'fast-deep-equal';
import { getObservableLifecycle } from 'ngx-observable-lifecycle';
import { combineLatest, concat, defer, EMPTY, forkJoin, identity, merge, Observable, of, timer } from 'rxjs';
import { combineLatest, concat, EMPTY, identity, merge, Observable, of, timer } from 'rxjs';
import {
catchError,
delay,
exhaustMap,
filter,
finalize,
ignoreElements,
map,
mapTo,
shareReplay,
Expand Down Expand Up @@ -78,6 +74,8 @@ export function createForm<ControlInterface, FormInterface>(
afterViewInit: getObservableLifecycle(componentInstance).ngAfterViewInit,
};

const changeDetectorRef = inject(ChangeDetectorRef);

lifecyleHooks.onDestroy.pipe(take(1)).subscribe(() => {
isRemoved = true;
});
Expand Down Expand Up @@ -225,10 +223,7 @@ export function createForm<ControlInterface, FormInterface>(
merge(controlValue$, setDisabledState$).pipe(
delay(0),
tap(() => {
// support `changeDetection: ChangeDetectionStrategy.OnPush`
// on the component hosting a form
// fixes https://github.com/cloudnc/ngx-sub-form/issues/93
markDirty(componentInstance);
changeDetectorRef.markForCheck();
}),
),
),
Expand Down
Loading

0 comments on commit e8093d8

Please sign in to comment.