diff --git a/data/templates/common/StrongFB-validator.ts b/data/templates/common/StrongFB-validator.ts index a1635cc..ebcbe5a 100644 --- a/data/templates/common/StrongFB-validator.ts +++ b/data/templates/common/StrongFB-validator.ts @@ -131,7 +131,7 @@ export class StrongFBValidator { } protected validateNumber(value: string) { - return /^\d+$/.test(String(value)); + return /^\d+$/.test(String(value)) || value === ''; } protected validateRequired(value: string | number, widgetName?: string) { diff --git a/data/templates/widgets/form-field/form-field.component.ts b/data/templates/widgets/form-field/form-field.component.ts index db6c5cb..adf6d8a 100644 --- a/data/templates/widgets/form-field/form-field.component.ts +++ b/data/templates/widgets/form-field/form-field.component.ts @@ -95,7 +95,7 @@ export class StrongFBFormFieldWidgetComponent extends StrongFBBaseWidgetlisten on ngModelChange - this.formFieldInstance[0].instance['ngModelChange'].pipe(takeUntil(this.destroy$)).subscribe(it => this.changeFormFieldValue(it)); + this.formFieldInstance[0].instance['ngModelChange'].pipe(takeUntil(this.destroy$)).subscribe(it => { if (it !== undefined) this.changeFormFieldValue(it) }); // =>listen on showChange this.showChange.pipe(takeUntil(this.destroy$)).subscribe(it => { // =>set show state diff --git a/data/templates/widgets/input/input.component.ts b/data/templates/widgets/input/input.component.ts index 73e2d1a..3f79231 100644 --- a/data/templates/widgets/input/input.component.ts +++ b/data/templates/widgets/input/input.component.ts @@ -2,6 +2,7 @@ import { Component, Output, EventEmitter } from '@angular/core'; import { StrongFBBaseWidget } from '../../common/StrongFB-widget'; import { InputSchema } from './input-interfaces'; import { syncSchema } from './convertor'; +import { takeUntil } from 'rxjs'; @Component({ selector: 'input-widget', @@ -22,6 +23,14 @@ export class StrongFBInputWidgetComponent extends StrongFBBaseWidgetlisten on value change + this.valueChanges$.pipe(takeUntil(this.destroy$)).subscribe(async (it: [boolean, any]) => { + if (!it || !it[0]) return; + this.schema.value = it[1]; + if (it[1] === undefined || it[1] === null) { + this.changeValue(); + } + }); } normalizeSchema(schema: InputSchema) { @@ -35,7 +44,7 @@ export class StrongFBInputWidgetComponent extends StrongFBBaseWidget {{schema?._form?.suffixText}} + + + \ No newline at end of file diff --git a/src/common.ts b/src/common.ts index 6e7a5fc..82e0ceb 100644 --- a/src/common.ts +++ b/src/common.ts @@ -6,7 +6,7 @@ import { error } from '@dat/lib/log'; import { UIFrameWorkType } from './types'; -export const VERSION = '0.147'; +export const VERSION = '0.148'; export async function detectAngularSourcePath() { let cwdir = await cwd();