diff --git a/projects/common-form-elements/src/lib/common-form-config.ts b/projects/common-form-elements/src/lib/common-form-config.ts index 318374c0040dfea8a9d7534333461b242f8bbb6d..1c5a9cf5ac1853d0188ae66b6945d0b5ecea1055 100644 --- a/projects/common-form-elements/src/lib/common-form-config.ts +++ b/projects/common-form-elements/src/lib/common-form-config.ts @@ -146,5 +146,6 @@ export interface CustomFormControl extends FormControl { customEventHandler$?: Subject<any>; shouldListenToCustomEvent?: Boolean; isVisible?: any; + range?: any; richTextCharacterCount?: any; } diff --git a/projects/common-form-elements/src/lib/dynamic-checkbox/dynamic-checkbox.component.html b/projects/common-form-elements/src/lib/dynamic-checkbox/dynamic-checkbox.component.html index 2d720d37d5266f43d41fbd803037c936958a55e7..c32dfe71dc87b4c6cc825517a16a52e5af296883 100644 --- a/projects/common-form-elements/src/lib/dynamic-checkbox/dynamic-checkbox.component.html +++ b/projects/common-form-elements/src/lib/dynamic-checkbox/dynamic-checkbox.component.html @@ -1,6 +1,6 @@ <ng-container *ngIf="visible"> <div class="sb-checkbox sb-checkbox-primary" [attr.data-title]="field.description ? field.description : null"> - <input [attr.disabled]="disabled ? true : null" type="checkbox" [formControl]="formControlRef" id="{{_.kebabCase(field.name) || field.code}}" + <input [attr.disabled]="disabled ? true : null" type="checkbox" id="{{_.kebabCase(field.name) || field.code}}" name="{{_.kebabCase(field.name) || field.code}}" [checked]="checked" (change)="onChecklistChange($event.target.checked)"> <label *ngIf="label" for="{{_.kebabCase(field.name) || field.code}}">{{label}}</label> <label class="label-html" *ngIf="labelHtml"> diff --git a/projects/common-form-elements/src/lib/dynamic-checkbox/dynamic-checkbox.component.ts b/projects/common-form-elements/src/lib/dynamic-checkbox/dynamic-checkbox.component.ts index dcd32e251e0a36319bb06531aabbbfac74f44ee9..94c39564042b934adb2c6028ec89534d76628c7b 100644 --- a/projects/common-form-elements/src/lib/dynamic-checkbox/dynamic-checkbox.component.ts +++ b/projects/common-form-elements/src/lib/dynamic-checkbox/dynamic-checkbox.component.ts @@ -43,7 +43,7 @@ export class DynamicCheckboxComponent implements OnInit { _: any = _; - public checked: boolean; + public checked: any; constructor() { } diff --git a/projects/common-form-elements/src/lib/dynamic-multi-select/dynamic-multi-select.component.ts b/projects/common-form-elements/src/lib/dynamic-multi-select/dynamic-multi-select.component.ts index b776a0ddfdba1c175a6e31a9ac50fad4dafbcafb..64492c8195c5adf5b4461ad9d658419afcd9e3a9 100644 --- a/projects/common-form-elements/src/lib/dynamic-multi-select/dynamic-multi-select.component.ts +++ b/projects/common-form-elements/src/lib/dynamic-multi-select/dynamic-multi-select.component.ts @@ -123,8 +123,17 @@ export class DynamicMultiSelectComponent implements OnInit, OnChanges, OnDestroy ); } + this.handleDependsWithDefault(); + } - + handleDependsWithDefault() { + const value = _.first(_.map(this.depends, depend => depend.value)); + if (!_.isEmpty(value) && _.toLower(value) === 'yes') { + this.formControlRef.isVisible = 'yes'; + this.field.range = this.formControlRef.range; + } else { + this.formControlRef.isVisible = 'no'; + } } ngOnDestroy(): void { diff --git a/projects/common-form-elements/src/lib/dynamic-timer/dynamic-timer.component.html b/projects/common-form-elements/src/lib/dynamic-timer/dynamic-timer.component.html index 1d3b0267b64fa151d2d8facbea1d6dd8ce14d474..f01c0cfac8cc4a8e1fbbdff009c4ba928ade190d 100644 --- a/projects/common-form-elements/src/lib/dynamic-timer/dynamic-timer.component.html +++ b/projects/common-form-elements/src/lib/dynamic-timer/dynamic-timer.component.html @@ -3,23 +3,23 @@ <ng-container> <div class="d-flex"> <div> - <input class="p-10 mr-20" list="hours" #hourField name="hour" maxlength="2" + <input class="sb-timer-input" list="hours" #hourField name="hour" maxlength="2" placeholder="{{placeholders[0]}}" (change)="onChangeTimer('hr', $event.target.value)" (keyup)="onChangeTimer('hr', $event.target.value);" (focusout)="onFocusOutEvent('hr', $event.target.value)" - [attr.disabled]="disabled ? true : ( depends ? (isDependsInvalid ? true : null) : null )"> + [attr.disabled]="disabled ? true : null"> <datalist id="hours"> <option *ngFor="let hour of hourOptions" [value]="hour"> </datalist> </div> <div> - <input class="p-10 mr-20" list="minutes" #minField name="minute" maxlength="2" + <input class="sb-timer-input" list="minutes" #minField name="minute" maxlength="2" placeholder="{{placeholders[1]}}" (change)="onChangeTimer('min', $event.target.value)" (keyup)="onChangeTimer('min', $event.target.value)" (focusout)="onFocusOutEvent('min', $event.target.value)" - [attr.disabled]="disabled ? true : ( depends ? (isDependsInvalid ? true : null) : null )"> + [attr.disabled]="disabled ? true : null"> <datalist id="minutes"> <ng-container> <option *ngFor="let minute of minuteOptions" [value]="minute">{{minute}}</option> diff --git a/src/app/app.component.ts b/src/app/app.component.ts index e54188777ed7aa08c717eacad8d613a86ecb6151..6573b2fa53a212f5015567eae5f4958ae0d537f7 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -361,6 +361,7 @@ export class AppComponent implements OnInit { setEvidence(control, depends: FormControl[], formGroup: FormGroup, loading, loaded) { control.isVisible = 'no'; + control.range = evidenceMimeType; const response = merge(..._.map(depends, depend => depend.valueChanges)).pipe( switchMap((value: any) => { if (!_.isEmpty(value) && _.toLower(value) === 'yes') {