diff --git a/CHANGELOG.md b/CHANGELOG.md index 58653a77..ba9cd009 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change log +## 5.2.11 + +### Chore + +- Write value into control even it's null or undefined. + ## 5.2.10 ### Fix diff --git a/projects/ng-dynamic-json-form/package.json b/projects/ng-dynamic-json-form/package.json index 3ed6c5f6..3a12ce1b 100644 --- a/projects/ng-dynamic-json-form/package.json +++ b/projects/ng-dynamic-json-form/package.json @@ -1,6 +1,6 @@ { "name": "ng-dynamic-json-form", - "version": "5.2.10", + "version": "5.2.11", "author": { "name": "erqk", "url": "https://github.com/erqk" diff --git a/projects/ng-dynamic-json-form/src/lib/components/form-control/form-control.component.ts b/projects/ng-dynamic-json-form/src/lib/components/form-control/form-control.component.ts index 7520131a..ee0590b2 100644 --- a/projects/ng-dynamic-json-form/src/lib/components/form-control/form-control.component.ts +++ b/projects/ng-dynamic-json-form/src/lib/components/form-control/form-control.component.ts @@ -5,7 +5,6 @@ import { ComponentRef, DestroyRef, HostBinding, - Injector, Input, SimpleChanges, TemplateRef, @@ -60,7 +59,6 @@ import { ErrorMessageComponent } from '../error-message/error-message.component' }) export class FormControlComponent implements ControlValueAccessor, Validator { private _cd = inject(ChangeDetectorRef); - private _injector = inject(Injector); private _destroyRef = inject(DestroyRef); private _configMappingService = inject(ConfigMappingService); private _optionsDataService = inject(OptionsDataService); @@ -199,17 +197,10 @@ export class FormControlComponent implements ControlValueAccessor, Validator { this._controlComponentRef = componentRef.instance; if (!this.data?.readonly) { - const emptyValue = - this._pendingValue === '' || - this._pendingValue === null || - this._pendingValue === undefined; - componentRef.instance.registerOnChange(this._onChange); componentRef.instance.registerOnTouched(this._onTouched); - - if (!emptyValue) { - this._onChange(this._pendingValue); - } + + this._onChange(this._pendingValue); } } diff --git a/src/assets/docs/index.md b/src/assets/docs/index.md index 56d86580..67e24da2 100644 --- a/src/assets/docs/index.md +++ b/src/assets/docs/index.md @@ -1,4 +1,4 @@ -## 5.2.10 +## 5.2.11 - [English](./v5/index_en.md) - [繁中](./v5/index_zh-TW.md)