feat(forms): add the form inputs and the form layouts pages

This commit is contained in:
Alexander Zhukov 2017-05-05 15:49:52 +03:00
parent 8649247f87
commit 3e47df7526
11 changed files with 685 additions and 47 deletions

View file

@ -5,19 +5,17 @@ import { NgxEditorsComponent } from './editors.component';
import { NgxTinyMCEComponent, NgxTinyMCEEditorComponent } from './tinyMCE.component';
import { NgxCKEditorComponent } from './ckeditor.component';
const routes: Routes = [
{
path: '',
component: NgxEditorsComponent,
children: [{
path: 'tinymce',
component: NgxTinyMCEComponent,
}, {
path: 'ckeditor',
component: NgxCKEditorComponent,
}],
},
];
const routes: Routes = [{
path: '',
component: NgxEditorsComponent,
children: [{
path: 'tinymce',
component: NgxTinyMCEComponent,
}, {
path: 'ckeditor',
component: NgxCKEditorComponent,
}],
}];
@NgModule({
imports: [RouterModule.forChild(routes)],

View file

@ -0,0 +1,314 @@
<div class="row">
<div class="col-md-6">
<nga-card>
<nga-card-header>Text inputs</nga-card-header>
<nga-card-body>
<div class="form-group row">
<label for="example-text-input" class="col-2 col-form-label">Text</label>
<div class="col-10">
<input class="form-control" type="text" value="Artisanal kale" id="example-text-input">
</div>
</div>
<div class="form-group row">
<label for="example-search-input" class="col-2 col-form-label">Search</label>
<div class="col-10">
<input class="form-control" type="search" value="How do I shoot web" id="example-search-input">
</div>
</div>
<div class="form-group row">
<label for="example-email-input" class="col-2 col-form-label">Email</label>
<div class="col-10">
<input class="form-control" type="email" value="bootstrap@example.com" id="example-email-input">
</div>
</div>
<div class="form-group row">
<label for="example-url-input" class="col-2 col-form-label">URL</label>
<div class="col-10">
<input class="form-control" type="url" value="https://getbootstrap.com" id="example-url-input">
</div>
</div>
<div class="form-group row">
<label for="example-tel-input" class="col-2 col-form-label">Telephone</label>
<div class="col-10">
<input class="form-control" type="tel" value="1-(555)-555-5555" id="example-tel-input">
</div>
</div>
<div class="form-group row">
<label for="example-password-input" class="col-2 col-form-label">Password</label>
<div class="col-10">
<input class="form-control" type="password" value="hunter2" id="example-password-input">
</div>
</div>
<div class="form-group row">
<label for="example-number-input" class="col-2 col-form-label">Number</label>
<div class="col-10">
<input class="form-control" type="number" value="42" id="example-number-input">
</div>
</div>
<div class="form-group row">
<label for="example-datetime-local-input" class="col-2 col-form-label">Date and time</label>
<div class="col-10">
<input class="form-control" type="datetime-local" value="2011-08-19T13:45:00" id="example-datetime-local-input">
</div>
</div>
<div class="form-group row">
<label for="example-date-input" class="col-2 col-form-label">Date</label>
<div class="col-10">
<input class="form-control" type="date" value="2011-08-19" id="example-date-input">
</div>
</div>
<div class="form-group row">
<label for="example-month-input" class="col-2 col-form-label">Month</label>
<div class="col-10">
<input class="form-control" type="month" value="2011-08" id="example-month-input">
</div>
</div>
<div class="form-group row">
<label for="example-week-input" class="col-2 col-form-label">Week</label>
<div class="col-10">
<input class="form-control" type="week" value="2011-W33" id="example-week-input">
</div>
</div>
<div class="form-group row">
<label for="example-time-input" class="col-2 col-form-label">Time</label>
<div class="col-10">
<input class="form-control" type="time" value="13:45:00" id="example-time-input">
</div>
</div>
<div class="form-group row">
<label for="example-color-input" class="col-2 col-form-label">Color</label>
<div class="col-10">
<input class="form-control" type="color" value="#563d7c" id="example-color-input">
</div>
</div>
</nga-card-body>
<nga-card-footer></nga-card-footer>
</nga-card>
</div>
<div class="col-md-6">
<nga-card>
<nga-card-header>Disabled states</nga-card-header>
<nga-card-body>
<form>
<fieldset disabled>
<div class="form-group">
<label for="disabledTextInput">Disabled input</label>
<input type="text" id="disabledTextInput" class="form-control" placeholder="Disabled input">
</div>
<div class="form-group">
<label for="disabledSelect">Disabled select menu</label>
<select id="disabledSelect" class="form-control">
<option>Disabled select</option>
</select>
</div>
<div class="checkbox">
<label>
<input type="checkbox"> Can't check this
</label>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</fieldset>
</form>
</nga-card-body>
<nga-card-footer></nga-card-footer>
</nga-card>
<nga-card>
<nga-card-header>
Validation states
</nga-card-header>
<nga-card-body>
<div class="form-group has-success">
<label class="form-control-label" for="inputSuccess1">Input with success</label>
<input type="text" class="form-control form-control-success" id="inputSuccess1">
<div class="form-control-feedback">Success! You've done it.</div>
<small class="form-text text-muted">Example help text that remains unchanged.</small>
</div>
<div class="form-group has-warning">
<label class="form-control-label" for="inputWarning1">Input with warning</label>
<input type="text" class="form-control form-control-warning" id="inputWarning1">
<div class="form-control-feedback">Shucks, check the formatting of that and try again.</div>
<small class="form-text text-muted">Example help text that remains unchanged.</small>
</div>
<div class="form-group has-danger">
<label class="form-control-label" for="inputDanger1">Input with danger</label>
<input type="text" class="form-control form-control-danger" id="inputDanger1">
<div class="form-control-feedback">Sorry, that username's taken. Try another?</div>
<small class="form-text text-muted">Example help text that remains unchanged.</small>
</div>
</nga-card-body>
<nga-card-footer></nga-card-footer>
</nga-card>
</div>
</div>
<div class="row">
<div class="col-md-6">
<nga-card>
<nga-card-header>
Form controls
</nga-card-header>
<nga-card-body>
<form>
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
</div>
<div class="form-group">
<label for="exampleSelect1">Example select</label>
<select class="form-control" id="exampleSelect1">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
<div class="form-group">
<label for="exampleSelect2">Example multiple select</label>
<select multiple class="form-control" id="exampleSelect2">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
<div class="form-group">
<label for="exampleTextarea">Example textarea</label>
<textarea class="form-control" id="exampleTextarea" rows="3"></textarea>
</div>
<div class="form-group">
<label for="exampleInputFile">File input</label>
<input type="file" class="form-control-file" id="exampleInputFile" aria-describedby="fileHelp">
<small id="fileHelp" class="form-text text-muted">This is some placeholder block-level help text for the above input. It's a bit lighter and easily wraps to a new line.</small>
</div>
<fieldset class="form-group">
<legend>Radio buttons</legend>
<div class="form-check">
<label class="form-check-label">
<input type="radio" class="form-check-input" name="optionsRadios" id="optionsRadios1" value="option1" checked>
Option one is this and that&mdash;be sure to include why it's great
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="radio" class="form-check-input" name="optionsRadios" id="optionsRadios2" value="option2">
Option two can be something else and selecting it will deselect option one
</label>
</div>
<div class="form-check disabled">
<label class="form-check-label">
<input type="radio" class="form-check-input" name="optionsRadios" id="optionsRadios3" value="option3" disabled>
Option three is disabled
</label>
</div>
</fieldset>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input">
Check me out
</label>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</nga-card-body>
<nga-card-footer></nga-card-footer>
</nga-card>
</div>
<div class="col-md-6">
<nga-card>
<nga-card-header>
Input groups
</nga-card-header>
<nga-card-body>
<div class="input-group">
<span class="input-group-addon" id="basic-addon1">@</span>
<input type="text" class="form-control" placeholder="Username" aria-describedby="basic-addon1">
</div>
<br>
<div class="input-group">
<input type="text" class="form-control" placeholder="Recipient's username" aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2">@example.com</span>
</div>
<br>
<label for="basic-url">Your vanity URL</label>
<div class="input-group">
<span class="input-group-addon" id="basic-addon3">https://example.com/users/</span>
<input type="text" class="form-control" id="basic-url" aria-describedby="basic-addon3">
</div>
<br>
<div class="input-group">
<span class="input-group-addon">$</span>
<input type="text" class="form-control" aria-label="Amount (to the nearest dollar)">
<span class="input-group-addon">.00</span>
</div>
<br>
<div class="input-group">
<span class="input-group-addon">$</span>
<span class="input-group-addon">0.00</span>
<input type="text" class="form-control" aria-label="Amount (to the nearest dollar)">
</div>
</nga-card-body>
<nga-card-footer></nga-card-footer>
</nga-card>
<nga-card>
<nga-card-header>
Rating
</nga-card-header>
<nga-card-body>
<div>
<ngb-rating [(ngModel)]="rate1" max="{{ max1 }}" class="rating">
<ng-template let-fill="fill">
<i *ngIf="fill === 100" class="ion-android-star"></i>
<i *ngIf="fill === 0" class="ion-android-star-outline"></i>
</ng-template>
</ngb-rating>
<span class="help-block">Rate: {{ rate1 }}</span>
</div>
<div>
<ngb-rating [(ngModel)]="rate2" max="{{ max2 }}" class="rating">
<ng-template let-fill="fill">
<i *ngIf="fill === 100" class="ion-ios-heart"></i>
<i *ngIf="fill === 0" class="ion-ios-heart-outline"></i>
</ng-template>
</ngb-rating>
<span class="help-block">Rate: {{ rate2 }}</span>
</div>
</nga-card-body>
<nga-card-footer></nga-card-footer>
</nga-card>
<nga-card>
<nga-card-header>
Selects
</nga-card-header>
<nga-card-body>
<div class="form-group">
<label for="exampleSelect1">Example select</label>
<select class="form-control" id="exampleSelect1">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
<div class="form-group">
<label for="exampleSelect2">Example multiple select</label>
<select multiple class="form-control" id="exampleSelect2">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
</nga-card-body>
<nga-card-footer></nga-card-footer>
</nga-card>
</div>
</div>

View file

@ -0,0 +1,15 @@
import { Component } from '@angular/core';
@Component({
selector: 'ngx-form-inputs',
templateUrl: './form-inputs.component.html',
})
export class NgxFormInputsComponent {
rate1: number = 3;
rate2: number = 4;
max1: number = 5;
max2: number = 10;
}

View file

@ -0,0 +1,217 @@
<div class="row">
<div class="col-md-12">
<nga-card>
<nga-card-header>
Inline form
</nga-card-header>
<nga-card-body>
<form class="form-inline">
<label class="sr-only" for="inlineFormInput">Name</label>
<input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" id="inlineFormInput" placeholder="Jane Doe">
<label class="sr-only" for="inlineFormInputGroup">Username</label>
<div class="input-group mb-2 mr-sm-2 mb-sm-0">
<div class="input-group-addon">@</div>
<input type="text" class="form-control" id="inlineFormInputGroup" placeholder="Username">
</div>
<div class="form-check mb-2 mr-sm-2 mb-sm-0">
<label class="form-check-label">
<input class="form-check-input" type="checkbox"> Remember me
</label>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</nga-card-body>
<nga-card-footer></nga-card-footer>
</nga-card>
</div>
</div>
<div class="row">
<div class="col-md-6">
<nga-card>
<nga-card-header>Using the Grid</nga-card-header>
<nga-card-body>
<form>
<div class="form-group row">
<label for="inputEmail3" class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="inputEmail3" placeholder="Email">
</div>
</div>
<div class="form-group row">
<label for="inputPassword3" class="col-sm-2 col-form-label">Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="inputPassword3" placeholder="Password">
</div>
</div>
<fieldset class="form-group row">
<legend class="col-form-legend col-sm-2">Radios</legend>
<div class="col-sm-10">
<div class="form-check">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="gridRadios" id="gridRadios1" value="option1" checked>
Option one is this and that&mdash;be sure to include why it's great
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="gridRadios" id="gridRadios2" value="option2">
Option two can be something else and selecting it will deselect option one
</label>
</div>
<div class="form-check disabled">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="gridRadios" id="gridRadios3" value="option3" disabled>
Option three is disabled
</label>
</div>
</div>
</fieldset>
<div class="form-group row">
<label class="col-sm-2">Checkbox</label>
<div class="col-sm-10">
<div class="form-check">
<label class="form-check-label">
<input class="form-check-input" type="checkbox"> Check me out
</label>
</div>
</div>
</div>
<div class="form-group row">
<div class="offset-sm-2 col-sm-10">
<button type="submit" class="btn btn-primary">Sign in</button>
</div>
</div>
</form>
</nga-card-body>
<nga-card-footer></nga-card-footer>
</nga-card>
<nga-card>
<nga-card-header>
Form without labels
</nga-card-header>
<nga-card-body>
<form>
<div class="form-group">
<input type="text" class="form-control" placeholder="Recipients">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Subject">
</div>
<div class="form-group">
<textarea class="form-control" placeholder="Message"></textarea>
</div>
<button type="submit" class="btn btn-success">Send</button>
</form>
</nga-card-body>
<nga-card-footer></nga-card-footer>
</nga-card>
</div>
<div class="col-md-6">
<nga-card>
<nga-card-header>
Basic form
</nga-card-header>
<nga-card-body>
<form>
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
</div>
<div class="form-group">
<label>
Check me out
<input type="checkbox"/>
</label>
</div>
<button type="submit" class="btn btn-danger">Submit</button>
</form>
</nga-card-body>
<nga-card-footer></nga-card-footer>
</nga-card>
<nga-card>
<nga-card-header>
Block form
</nga-card-header>
<nga-card-body>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label for="inputFirstName">First Name</label>
<input type="text" class="form-control" id="inputFirstName" placeholder="First Name">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label for="inputLastName">Last Name</label>
<input type="text" class="form-control" id="inputLastName" placeholder="Last Name">
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label for="inputEmail">Email</label>
<input type="email" class="form-control" id="inputEmail" placeholder="Email">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label for="inputWebsite">Website</label>
<input type="text" class="form-control" id="inputWebsite" placeholder="Website">
</div>
</div>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</nga-card-body>
<nga-card-footer></nga-card-footer>
</nga-card>
</div>
</div>
<div class="row">
<div class="col-md-6">
<nga-card>
<nga-card-header>
Horizontal form
</nga-card-header>
<nga-card-body>
<form class="form-horizontal">
<div class="form-group row">
<label for="inputEmail3" class="col-sm-2 form-control-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="inputEmail3" placeholder="Email">
</div>
</div>
<div class="form-group row">
<label for="inputPassword3" class="col-sm-2 form-control-label">Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="inputPassword3" placeholder="Password">
</div>
</div>
<div class="form-group row">
<div class="offset-sm-2 col-sm-10">
<div class="checkbox">
<label>
Remember me
<input type="checkbox"/>
</label>
</div>
</div>
</div>
<div class="form-group row">
<div class="offset-sm-2 col-sm-10">
<button type="submit" class="btn btn-warning">Sign in</button>
</div>
</div>
</form>
</nga-card-body>
<nga-card-footer></nga-card-footer>
</nga-card>
</div>
</div>

View file

@ -0,0 +1,9 @@
import { Component } from '@angular/core';
@Component({
selector: 'ngx-form-layouts',
templateUrl: './form-layouts.component.html',
})
export class NgxFormLayoutsComponent {
}

View file

@ -0,0 +1,36 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { NgxFormsComponent } from './forms.component';
import { NgxFormInputsComponent } from './form-inputs/form-inputs.component';
import { NgxFormLayoutsComponent } from './form-layouts/form-layouts.component';
const routes: Routes = [{
path: '',
component: NgxFormsComponent,
children: [{
path: 'inputs',
component: NgxFormInputsComponent,
}, {
path: 'layouts',
component: NgxFormLayoutsComponent,
}],
}];
@NgModule({
imports: [
RouterModule.forChild(routes),
],
exports: [
RouterModule,
],
})
export class NgxFormsRoutingModule {
}
export const routedComponents = [
NgxFormsComponent,
NgxFormInputsComponent,
NgxFormLayoutsComponent,
];

View file

@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'ngx-form-elements',
template: `
<router-outlet></router-outlet>
`,
})
export class NgxFormsComponent {
}

View file

@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { NgxSharedModule } from '../../@shared/shared.module';
import { NgxFormsRoutingModule, routedComponents } from './forms-routing.module';
@NgModule({
imports: [
NgxSharedModule,
NgxFormsRoutingModule,
],
declarations: [
...routedComponents,
],
})
export class NgxFormsModule { }

View file

@ -42,7 +42,6 @@ export const menuItems: List<NgaMenuItem> = List([{
}, {
title: 'Editors',
icon: 'ion ion-edit',
link: '/pages/editors',
children: List([{
title: 'TinyMCE',
link: '/pages/editors/tinymce',
@ -50,4 +49,14 @@ export const menuItems: List<NgaMenuItem> = List([{
title: 'CKEditor',
link: '/pages/editors/ckeditor',
}]),
}, {
title: 'Forms',
icon: 'ion-compose',
children: List([{
title: 'Form Inputs',
link: '/pages/forms/inputs',
}, {
title: 'Form Layouts',
link: '/pages/forms/layouts',
}]),
}]);

View file

@ -8,21 +8,36 @@ import { MapsComponent } from './maps/maps.component';
import { NgxChartsComponent } from './charts/charts.component';
import { NgxEditorsComponent } from './editors/editors.component';
const routes: Routes = [
{
const routes: Routes = [{
path: '',
component: PagesComponent,
children: [{
path: 'dashboard',
component: DashboardComponent,
}, {
path: 'ui-features',
loadChildren: './ui-features/ui-features.module#NgxUiFeaturesModule',
}, {
path: 'components',
component: ComponentsComponent,
}, {
path: 'maps',
component: MapsComponent,
}, {
path: 'charts',
component: NgxChartsComponent,
}, {
path: 'editors',
loadChildren: './editors/editors.module#NgxEditorsModule',
}, {
path: 'forms',
loadChildren: './forms/forms.module#NgxFormsModule',
}, {
path: '',
component: PagesComponent,
children: [
{ path: 'dashboard', component: DashboardComponent },
{ path: 'ui-features', loadChildren: './ui-features/ui-features.module#NgxUiFeaturesModule' },
{ path: 'components', component: ComponentsComponent },
{ path: 'maps', component: MapsComponent },
{ path: 'charts', component: NgxChartsComponent },
{ path: 'editors', loadChildren: './editors/editors.module#NgxEditorsModule' },
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' },
],
},
];
redirectTo: 'dashboard',
pathMatch: 'full',
}],
}];
@NgModule({
imports: [RouterModule.forChild(routes)],

View file

@ -15,25 +15,23 @@ import { NgxDropdownButtonsComponent } from './buttons/dropdown/dropdown.compone
import { NgxLargeButtonsComponent } from './buttons/large/large.component';
import { NgxGroupButtonsComponent } from './buttons/group/group.component';
const routes: Routes = [
{
path: '',
component: NgxUiFeaturesComponent,
children: [{
path: 'buttons',
component: NgxButtonsComponent,
}, {
path: 'grid',
component: NgxGridComponent,
}, {
path: 'icons',
component: NgxIconsComponent,
}, {
path: 'modals',
component: NgxModalsComponent,
}],
},
];
const routes: Routes = [{
path: '',
component: NgxUiFeaturesComponent,
children: [{
path: 'buttons',
component: NgxButtonsComponent,
}, {
path: 'grid',
component: NgxGridComponent,
}, {
path: 'icons',
component: NgxIconsComponent,
}, {
path: 'modals',
component: NgxModalsComponent,
}],
}];
@NgModule({
imports: [RouterModule.forChild(routes)],