0.6.1 • Published 5 years ago

ngx-mat-form-components v0.6.1

Weekly downloads
48
License
MIT
Repository
-
Last release
5 years ago

Material Form Components

###Features

  • Stylized material design form components.
  • Components with dynamic input and output properties.
  • Components:
    • Input
    • Select
    • Datepicker
    • Textfield
    • Dropzone
    • Button

A simpler way to build your material design form and make your source code cleaner.

###Install

   $ npm install --save ngx-mat-form-components

###Usage

Import the module

// in app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { MatFormComponentsModule } from 'ngx-mat-form-components';
 
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    MatFormComponentsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

###Input

// in app.component.html

<mfc-input></mfc-input>

####Input Options | Property @Input() | Type | Description | Default | :------------ |:--------:| -----:| ----:| | formGroup | FormGroup | The FormGroup which the input belongs | null | | formcontrolname | String | The input FormGroupName | null | | type | String | Type of input element to display. | text | | label | String | Input label | null | | placeholder | String | Input placeholder | null | | mask | String | Stylized mask| null | | translate | String | Translation of messages | "pt" |

####Input Example

  <mfc-input 
		  [formGroup]="formGroupName"
		  label="Name"
		  placeholder="type your name here" 
		  type="text" 
		  formcontrolname="name" 
		  fxFlex="20" >
  </mfc-input>

npm.io

  • Translate options: - PORTUGUESE ('pt') - ENGLISH ('en') - SPANISH ('es')

  • Mask options: - CPF ('cpf') - CNPJ ('cnpj') - CPF OR CNPJ ('cpf_cnpj') - PHONE BRAZIL ('phone_br') - CEP ('cep') - DATE ('date')

  <mfc-input 
		  [formGroup]="formGroupName"
		  label="Name"
		  placeholder="type your name here" 
		  type="text" 
		  formcontrolname="name" 
		  mask="phone"
		  fxFlex="20" >
  </mfc-input>

npm.io

###Select

// in app.component.html
<mfc-select></mfc-select>

####Select Options

Property @Input()TypeDescriptionDefault
formGroupFormGroupThe FormGroup which the input belongsnull
formcontrolnameStringThe input FormGroupNamenull
labelStringThe input Labelnull
searchFieldStringDisplay the search bar and sets the variable in which the search will be donetext
valueFieldStringSets which field will be the value of the selectnull
displayFieldStringSets which field will be the displayed fieldnull
dataarrayArray with the data to be displayed in the selectnull
translateStringTranslation of messages"pt"
  • Translate options: - PORTUGUESE ('pt') - ENGLISH ('en') - SPANISH ('es')

####Select Example

<mfc-select 
		[formGroup]="formGroupName" 
		searchField="name" 
		label="Clinics" 
		formcontrolname="clinic" 
		valueField="id" 
		displayField="name" 
		[data]="dataClinic" 
		fxFlex="30">
</mfc-select>

npm.io

<mfc-select 
		[formGroup]="formGroupName" 
		label="Clinics" 
		formcontrolname="clinic" 
		valueField="id" 
		displayField="name" 
		[data]="dataClinic" 
		fxFlex="30">
</mfc-select>

npm.io

###DatePicker

// in app.component.html
<mfc-datepicker></mfc-datepicker>

####DatePicker Options

Property @Input()TypeDescriptionDefault
formGroupFormGroupThe FormGroup which the datepicker belongsnull
formcontrolnameStringThe datepicker FormGroupNamenull
labelStringThe datepicker Labelnull
placeholderStringThe datepicker placeholdertext
translateStringTranslation of messages"pt"
  • Translate options: - PORTUGUESE ('pt') - ENGLISH ('en') - SPANISH ('es')

####DatePicker Example

<mfc-datepicker 
		[formGroup]="formGroupName" 
		label="Payment date" 
		formcontrolname="date" 
		fxFlex="30">
</mfc-datepicker>

npm.io

npm.io

###TextField

// in app.component.html
<mfc-textfield></mfc-textfield>

####TextField Options

Property @Input()TypeDescriptionDefault
formGroupFormGroupThe FormGroup which the textfield belongsnull
formcontrolnameStringThe textfield FormGroupNamenull
labelStringThe textfield Labelnull
placeholderStringThe textfield placeholdertext
minRowsStringmatAutosizeMinRows"1"
maxRowsStringmatAutosizeMaxRows"3"
translateStringTranslation of messages"pt"
  • Translate options: - PORTUGUESE ('pt') - ENGLISH ('en') - SPANISH ('es')

####TextField Example

<mfc-textfield 
			[formGroup]="formGroup" 
			formcontrolname="date" 
			label="Text" 
			fxFlex="30">
</mfc-textfield>

npm.io

<mfc-textfield 
			[formGroup]="formGroup" 
			formcontrolname="date" 
			label="Text" 
			minRows="2"
			maxRows="5"
			fxFlex="30">
</mfc-textfield>

npm.io

###Button

// in app.component.html
<mfc-button></mfc-button>

####Button Options

Property @Input()TypeDescriptionDefault
labelStringThe button Labelnull
colorStringThe button text colornull
backgroundStringThe button background colornull
iconStringThe mat icon namenull
widthStringThe button widthnull
heightStringThe button heightnull
fontSizeStringThe button text fontsizenull
iconSizeStringThe icon sizenull
Property @Output()TypeDescription
(click)eventThe button click event

####Button Example

<mfc-button 
			(click)="edit()" 
			icon="edit" 
			background="#039be5" 
			color="white" 
			width="100px" 
			height="40px" 
			label="Edit">
</mfc-button>

npm.io

###Dropzone

// in app.component.html
<mfc-dropzone></mfc-dropzone>
Property @Input()TypeDescriptionDefault
maxFilesizeNumberMaximum file size10
acceptedFilesStringThe types of files accepted'.png, .jpeg, .jpg, .pdf, .doc, .docx, .xls, .cvs'
resetOptionBooleanReset button to dropzonetrue
resetLabelStringThe string of reset buttom'Limpar'
resetColorStringThe reset buttom text colornull
resetBackgroundStringThe reset buttom background colornull
msgDropStringThe dropzone message'Clique ou araste o arquivo aqui!'
msgFileTooBigStringMessage for files larger than allowed'Arquivo muito grande! (Max: 10MB)'
msgInvalidFileTypeStringMessage for files not allowed'Tipo de arquivo inválido!'
msgRemoveConfirmationStringRemoval confirmation message'Confirma a remoção?'

#####To get files

####Dropzone Example

<mfc-dropzone
			acceptedFiles=".png, .jpeg, .jpg"
			dropMessage="Click or drag the file here!"
			msgFileTooBig="Very large file!"
			msgInvalidFileType="Type not allowed"
			msgRemoveConfirmation="Confirm delete?"
</mfc-dropzone>
0.6.1

5 years ago

0.6.0

5 years ago

0.5.9

5 years ago

0.5.8

5 years ago

0.5.7

5 years ago

0.5.6

5 years ago

0.5.5

5 years ago

0.5.2

5 years ago

0.5.0

5 years ago

0.5.1

5 years ago

0.4.9

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.9

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

1.0.0

5 years ago