Skip to content

Commit

Permalink
Merge pull request #441 from KBroichhausen/disable-directive
Browse files Browse the repository at this point in the history
Use DisableControlDirective for widgets to remove warnings for reactive forms.
  • Loading branch information
ebrehault authored Jul 15, 2022
2 parents 7cf91fb + b3d8406 commit 5adcaba
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ControlWidget } from '../../widget';
</label>
<div *ngIf="schema.type!='array'" class="checkbox">
<label class="horizontal control-label">
<input [formControl]="control" [attr.name]="name" [attr.id]="id" [indeterminate]="control.value !== false && control.value !== true ? true :null" type="checkbox" [disabled]="schema.readOnly">
<input [formControl]="control" [attr.name]="name" [attr.id]="id" [indeterminate]="control.value !== false && control.value !== true ? true :null" type="checkbox" [disableControl]="schema.readOnly">
<input *ngIf="schema.readOnly" [attr.name]="name" type="hidden" [formControl]="control">
{{schema.description}}
</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ControlWidget } from '../../widget';
<span *ngIf="schema.description" class="formHelp">{{schema.description}}</span>
<div *ngFor="let option of schema.oneOf" class="radio">
<label class="horizontal control-label">
<input [formControl]="control" [attr.name]="name" [attr.id]="id + '.' + option.enum[0]" value="{{option.enum[0]}}" type="radio" [disabled]="schema.readOnly||option.readOnly">
<input [formControl]="control" [attr.name]="name" [attr.id]="id + '.' + option.enum[0]" value="{{option.enum[0]}}" type="radio" [disableControl]="schema.readOnly||option.readOnly">
{{option.description}}
</label>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ControlWidget } from '../../widget';
</label>
<span *ngIf="schema.description" class="formHelp">{{schema.description}}</span>
<input [name]="name" class="text-widget range-widget" [attr.id]="id"
[formControl]="control" [attr.type]="'range'" [attr.min]="schema.minimum" [attr.max]="schema.maximum" [disabled]="schema.readOnly?true:null" >
[formControl]="control" [attr.type]="'range'" [attr.min]="schema.minimum" [attr.max]="schema.maximum" [disableControl]="schema.readOnly?true:null" >
<input *ngIf="schema.readOnly" [attr.name]="name" type="hidden">
</div>`
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ControlWidget } from '../../widget';
{{schema.description}}
</span>
<select *ngIf="schema.type!='array'" [formControl]="control" [attr.name]="name" [attr.id]="id" [disabled]="schema.readOnly" [disableControl]="schema.readOnly" class="form-control">
<select *ngIf="schema.type!='array'" [formControl]="control" [attr.name]="name" [attr.id]="id" [disableControl]="schema.readOnly" class="form-control">
<ng-container *ngIf="schema.oneOf; else use_enum">
<option *ngFor="let option of schema.oneOf" [ngValue]="option.enum[0]" >{{option.description}}</option>
</ng-container>
Expand All @@ -22,7 +22,7 @@ import { ControlWidget } from '../../widget';
</ng-template>
</select>
<select *ngIf="schema.type==='array'" multiple [formControl]="control" [attr.name]="name" [attr.id]="id" [disabled]="schema.readOnly" [disableControl]="schema.readOnly" class="form-control">
<select *ngIf="schema.type==='array'" multiple [formControl]="control" [attr.name]="name" [attr.id]="id" [disableControl]="schema.readOnly" class="form-control">
<option *ngFor="let option of schema.items.oneOf" [ngValue]="option.enum[0]" [disabled]="option.readOnly">{{option.description}}</option>
</select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { ControlWidget } from '../../widget';
[attr.maxLength]="schema.maxLength || null"
[attr.minLength]="schema.minLength || null"
[attr.required]="schema.isRequired || null"
[attr.disabled]="(schema.widget.id=='color' && schema.readOnly)?true:null">
[disableControl]="(schema.widget.id=='color' && schema.readOnly)?true:null">
<input *ngIf="(schema.widget.id==='color' && schema.readOnly)" [attr.name]="name" type="hidden" [formControl]="control">
</div>
</ng-template>`
Expand Down

0 comments on commit 5adcaba

Please sign in to comment.