-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
129 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,62 @@ | ||
import { DefaultWidgetRegistry } from 'ngx-schema-form'; | ||
import { BooleanRadioComponent } from './widget/boolean-radio/boolean-radio.component'; | ||
import { FieldsetComponent } from './widget/fieldset/fieldset.component'; | ||
import { CustomStringComponent } from './widget/text/string.component'; | ||
|
||
export class CustomWidgetRegistry extends DefaultWidgetRegistry { | ||
import { WidgetRegistry } from 'ngx-schema-form'; | ||
|
||
import { ArrayWidget } from 'ngx-schema-form'; | ||
import { ButtonWidget } from 'ngx-schema-form'; | ||
import { CheckboxWidget } from 'ngx-schema-form'; | ||
import { FileWidget } from 'ngx-schema-form'; | ||
import { IntegerWidget } from 'ngx-schema-form'; | ||
import { ObjectWidget } from 'ngx-schema-form'; | ||
import { RadioWidget } from 'ngx-schema-form'; | ||
import { RangeWidget } from 'ngx-schema-form'; | ||
import { SelectWidget } from 'ngx-schema-form'; | ||
import { StringWidget } from 'ngx-schema-form'; | ||
import { TextAreaWidget } from 'ngx-schema-form'; | ||
import { CustomSelectComponent } from './widget/select/select.component'; | ||
|
||
|
||
|
||
export class CustomWidgetRegistry extends WidgetRegistry { | ||
constructor() { | ||
super(); | ||
|
||
/* Custom */ | ||
this.register('string', CustomStringComponent); | ||
this.register('search', CustomStringComponent); | ||
this.register('tel', CustomStringComponent); | ||
this.register('url', CustomStringComponent); | ||
this.register('email', CustomStringComponent); | ||
this.register('password', CustomStringComponent); | ||
this.register('color', CustomStringComponent); | ||
this.register('date', CustomStringComponent); | ||
this.register('date-time', CustomStringComponent); | ||
this.register('time', CustomStringComponent); | ||
|
||
this.register('boolean-radio', BooleanRadioComponent); | ||
this.register('fieldset', FieldsetComponent); | ||
this.register('custom-string', CustomStringComponent); | ||
|
||
this.register('select', CustomSelectComponent); | ||
|
||
/* NGX-Form */ | ||
this.register('array', ArrayWidget); | ||
this.register('object', ObjectWidget); | ||
|
||
this.register('integer', IntegerWidget); | ||
this.register('number', IntegerWidget); | ||
this.register('range', RangeWidget); | ||
|
||
this.register('textarea', TextAreaWidget); | ||
|
||
this.register('file', FileWidget); | ||
this.register('radio', RadioWidget); | ||
this.register('boolean', CheckboxWidget); | ||
this.register('checkbox', CheckboxWidget); | ||
|
||
this.register('button', ButtonWidget); | ||
|
||
this.setDefaultWidget(CustomStringComponent); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 10 additions & 1 deletion
11
ui/src/app/schema-form/widget/boolean-radio/boolean-radio.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
ui/src/app/schema-form/widget/select/select.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<div class="widget form-group"> | ||
<label [attr.for]="id" class="horizontal control-label"> | ||
{{ schema.title }} | ||
<span> | ||
<ng-template #tooltip i18n="@@tooltip--description">{{ schema.description }}</ng-template> | ||
<i class="info-icon fa fa-fw fa-info-circle text-primary fa-lg" | ||
[ngbPopover]="tooltip" | ||
i18n-aria-label="@@tooltip--instruction" | ||
aria-label="Information icon - press spacebar to read additional information for this form field"></i> | ||
</span> | ||
</label> | ||
<span *ngIf="schema.description" class="sr-only"> | ||
{{ schema.description }} | ||
</span> | ||
<select *ngIf="schema.type != 'array'" [formControl]="control" [attr.name]="name" [attr.disabled]="schema.readOnly" class="form-control"> | ||
<option *ngFor="let option of schema.oneOf" [ngValue]="option.enum[0]">{{option.description}}</option> | ||
</select> | ||
<select *ngIf="schema.type === 'array'" multiple [formControl]="control" [attr.name]="name" [attr.disabled]="schema.readOnly" class="form-control"> | ||
<option *ngFor="let option of schema.items.oneOf" [ngValue]="option.enum[0]">{{option.description}}</option> | ||
</select> | ||
<input *ngIf="schema.readOnly" [attr.name]="name" type="hidden" [formControl]="control"> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
import { ControlWidget } from 'ngx-schema-form'; | ||
|
||
@Component({ | ||
selector: 'select-component', | ||
templateUrl: `./select.component.html` | ||
}) | ||
export class CustomSelectComponent extends ControlWidget { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
:host { | ||
.widget { | ||
.popover { | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters