Skip to content

Commit

Permalink
Merge pull request #438 from quicujo/master
Browse files Browse the repository at this point in the history
Widgets condition for nullable schema.title, remove unused import in example
  • Loading branch information
ebrehault authored Jun 22, 2022
2 parents f28b338 + d236d67 commit 7451141
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { FormProperty } from '../../model';
@Component({
selector: 'sf-array-widget',
template: `<div class="widget form-group">
<label [attr.for]="id" class="horizontal control-label">
<label *ngIf="schema.title" [attr.for]="id" class="horizontal control-label">
{{ schema.title }}
</label>
<span *ngIf="schema.description" class="formHelp">{{schema.description}}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ControlWidget } from '../../widget';
@Component({
selector: 'sf-checkbox-widget',
template: `<div class="widget form-group">
<label [attr.for]="id" class="horizontal control-label">
<label *ngIf="schema.title" [attr.for]="id" class="horizontal control-label">
{{ schema.title }}
</label>
<div *ngIf="schema.type!='array'" class="checkbox">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { ControlWidget } from '../../widget';
@Component({
selector: 'sf-file-widget',
template: `<div class="widget form-group">
<label [attr.for]="id" class="horizontal control-label">
<label *ngIf="schema.title" [attr.for]="id" class="horizontal control-label">
{{ schema.title }}
</label>
<span *ngIf="schema.description" class="formHelp">{{schema.description}}</span>
<span *ngIf="schema.description" class="formHelp">{{schema.description}}</span>
<input [name]="name" class="text-widget file-widget" [attr.id]="id"
[formControl]="control" type="file" [attr.disabled]="schema.readOnly?true:null"
(change)="onFileChange($event)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ControlWidget } from '../../widget';
@Component({
selector: 'sf-integer-widget',
template: `<div class="widget form-group">
<label [attr.for]="id" class="horizontal control-label">
<label *ngIf="schema.title" [attr.for]="id" class="horizontal control-label">
{{ schema.title }}
</label>
<span *ngIf="schema.description" class="formHelp">{{schema.description}}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { ControlWidget } from '../../widget';
@Component({
selector: 'sf-radio-widget',
template: `<div class="widget form-group">
<label>{{schema.title}}</label>
<span *ngIf="schema.description" class="formHelp">{{schema.description}}</span>
<label *ngIf="schema.title">{{schema.title}}</label>
<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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ControlWidget } from '../../widget';
@Component({
selector: 'sf-range-widget',
template: `<div class="widget form-group">
<label [attr.for]="id" class="horizontal control-label">
<label *ngIf="schema.title" [attr.for]="id" class="horizontal control-label">
{{ schema.title }}
</label>
<span *ngIf="schema.description" class="formHelp">{{schema.description}}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ControlWidget } from '../../widget';
@Component({
selector: 'sf-select-widget',
template: `<div class="widget form-group">
<label [attr.for]="id" class="horizontal control-label">
<label *ngIf="schema.title" [attr.for]="id" class="horizontal control-label">
{{ schema.title }}
</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ControlWidget } from '../../widget';
[attr.name]="name" type="hidden" [formControl]="control">
<ng-template #notHiddenFieldBlock>
<div class="widget form-group">
<label [attr.for]="id" class="horizontal control-label">
<label *ngIf="schema.title" [attr.for]="id" class="horizontal control-label">
{{ schema.title }}
</label>
<span *ngIf="schema.description" class="formHelp">{{schema.description}}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { ControlWidget } from '../../widget';
@Component({
selector: 'sf-textarea-widget',
template: `<div class="widget form-group">
<label [attr.for]="id" class="horizontal control-label">
<label *ngIf="schema.title" [attr.for]="id" class="horizontal control-label">
{{ schema.title }}
</label>
<span *ngIf="schema.description" class="formHelp">{{schema.description}}</span>
<span *ngIf="schema.description" class="formHelp">{{schema.description}}</span>
<textarea [readonly]="schema.readOnly" [name]="name"
[attr.id]="id"
class="text-widget textarea-widget form-control"
Expand Down
7 changes: 1 addition & 6 deletions src/app/json-schema-example/json-schema-example.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import {
OnInit,
OnDestroy
} from '@angular/core';
import {WidgetRegistry, Validator, Binding, FormProperty, PropertyGroup} from 'ngx-schema-form';
import {Validator, Binding, FormProperty, PropertyGroup} from 'ngx-schema-form';
import {Subscription} from 'rxjs';

import sampleSchema1 from './sampleschema.json';
import sampleSchema2 from './otherschema.json';
import sampleModel from './samplemodel.json';
import binding_sample_schema from './binding_sample_schema.json';
import binding_sample_model from './binding_sample_model.json';
Expand Down Expand Up @@ -46,7 +45,6 @@ export class JsonSchemaExampleComponent implements OnInit, OnDestroy {
];

constructor(
registry: WidgetRegistry,
private appService: AppService
) {

Expand Down Expand Up @@ -181,9 +179,6 @@ export class JsonSchemaExampleComponent implements OnInit, OnDestroy {
this.actions['reset'] = (form, options) => {
form.reset();
};
this.actions['reset'] = (form, options) => {
form.reset();
};
this.actions['disable'] = this.disableAll.bind(this);

this.actions['toggle_title'] = (formProperty: FormProperty, form: PropertyGroup, params: any) => {
Expand Down

0 comments on commit 7451141

Please sign in to comment.