diff --git a/CHANGELOG.md b/CHANGELOG.md index 69db0f5..b5b4619 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [1.2.0](https://github.com/robust-team/angular-forms/compare/v1.1.0...v1.2.0) (2017-09-22) + +### Features + +* Addition of **isPristine** and **isDirty** methods. + ## [1.1.0](https://github.com/robust-team/angular-forms/compare/v1.0.1...v1.1.0) (2017-09-21) diff --git a/README.md b/README.md index 1c95095..811fb1a 100644 --- a/README.md +++ b/README.md @@ -238,6 +238,8 @@ Example output: | Method | Function | |-|-| | **isValid()** | Returns the status of form. | +| **isPristine()** | Returns if the user has not yet changed some value in the form. | +| **isDirty()** | Returns if the user has changed some value in the form. | | **getAnswersGroups()** | Returns only the answers grouped in yours respective Groups. | | **getAnswers()** | Returns only the answers of simple Questions and of DataTables (that is considered a Question). | | **getForm()** | Returns an object with two attributes: **valid** (return of **isValid** method) and **value** (return of **getAnswersGroups** method. | diff --git a/demo/demo.component.ts b/demo/demo.component.ts index 57711ff..ba140ec 100644 --- a/demo/demo.component.ts +++ b/demo/demo.component.ts @@ -9,10 +9,14 @@ import { AngularFormsComponent } from '../src';

AngularForms

- - - - + + + + + + + +
`, providers: [DemoService] @@ -33,6 +37,14 @@ export class DemoComponent implements OnInit { console.log(this.angularForms.getForm()); } + public isPristine(): void { + console.log(this.angularForms.isPristine()); + } + + public isDirty(): void { + console.log(this.angularForms.isDirty()); + } + public isValid(): void { console.log(this.angularForms.isValid()); } diff --git a/docs/changelog.html b/docs/changelog.html index b9f2fd7..82635f7 100644 --- a/docs/changelog.html +++ b/docs/changelog.html @@ -631,6 +631,12 @@

Change Log

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

+

+

1.2.0 (2017-09-22)

+

Features

+

1.1.0 (2017-09-21)

Features

diff --git a/docs/classes/AngularForms.html b/docs/classes/AngularForms.html index e173f2d..53be300 100644 --- a/docs/classes/AngularForms.html +++ b/docs/classes/AngularForms.html @@ -698,13 +698,13 @@

- Public fromJson + Public fromJson - - fromJson(jsonGroups: []) + + fromJson(jsonGroups: Group[]) @@ -718,10 +718,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
jsonGroups + Group[] + +
+
+
+
Returns : []
+
+ +
diff --git a/docs/classes/AngularFormsTranslateLoader.html b/docs/classes/AngularFormsTranslateLoader.html index 69a6c6b..a8fb3e4 100644 --- a/docs/classes/AngularFormsTranslateLoader.html +++ b/docs/classes/AngularFormsTranslateLoader.html @@ -704,12 +704,12 @@

- Public getTranslation + Public getTranslation - + getTranslation(lang: string) @@ -724,10 +724,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
lang + string + +
+
+
+
Returns : Observable<any>
+
+ +
diff --git a/docs/classes/Checkbox.html b/docs/classes/Checkbox.html index 083bd30..268c5b7 100644 --- a/docs/classes/Checkbox.html +++ b/docs/classes/Checkbox.html @@ -713,7 +713,7 @@

Constructor

- constructor(name: string, description: string, dependencies: [], answer: boolean, validations: [], disabled: boolean, _defaultOption: boolean) + constructor(name: string, description: string, dependencies: Dependency[], answer: boolean, validations: Validation[], disabled: boolean, _defaultOption: boolean) @@ -722,6 +722,88 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
name + string + +
description + string + +
dependencies + Dependency[] + +
answer + boolean + +
validations + Validation[] + +
disabled + boolean + +
_defaultOption + boolean + +
+
+ + @@ -736,12 +818,12 @@

- Public fromJson + Public fromJson - + fromJson(question: Checkbox) @@ -756,10 +838,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
question + Checkbox + +
+
+
+
Returns : Checkbox
+
+ +
@@ -777,12 +888,12 @@

- Public defaultOption + Public defaultOption - defaultOption: boolean + defaultOption: boolean diff --git a/docs/classes/Choice.html b/docs/classes/Choice.html index 695df24..1da0237 100644 --- a/docs/classes/Choice.html +++ b/docs/classes/Choice.html @@ -702,7 +702,7 @@

Constructor

- constructor(name: string, description: string, type: QuestionType, dependencies: [], answer: string, validations: [], disabled: boolean, _options: []|[], _defaultOption: string) + constructor(name: string, description: string, type: QuestionType, dependencies: Dependency[], answer: string, validations: Validation[], disabled: boolean, _options: [] | [], _defaultOption: string) @@ -711,6 +711,106 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
name + string + +
description + string + +
type + QuestionType + +
dependencies + Dependency[] + +
answer + string + +
validations + Validation[] + +
disabled + boolean + +
_options + [] | [] + +
_defaultOption + string + +
+
+ + @@ -727,12 +827,12 @@

- Public defaultOption + Public defaultOption - defaultOption: string + defaultOption: string @@ -756,18 +856,18 @@

- Public options + Public options - options: []|[] + options: [] | [] - Type : []|[] + Type : [] | [] diff --git a/docs/classes/DataTable.html b/docs/classes/DataTable.html index 8d48c52..106908f 100644 --- a/docs/classes/DataTable.html +++ b/docs/classes/DataTable.html @@ -716,7 +716,7 @@

Constructor

- constructor(code: string, description: string, _questions: [][], _validations: []) + constructor(code: string, description: string, _questions: [][], _validations: Validation[]) @@ -725,6 +725,61 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
code + string + +
description + string + +
_questions + [][] + +
_validations + Validation[] + +
+
+ + @@ -739,12 +794,12 @@

- Public isRequired + Public isRequired - + isRequired() @@ -780,12 +835,12 @@

- Public questions + Public questions - questions: [][] + questions: [][] @@ -809,18 +864,18 @@

- Public validations + Public validations - validations: [] + validations: Validation[] - Type : [] + Type : Validation[] diff --git a/docs/classes/DataTableBuilder.html b/docs/classes/DataTableBuilder.html index e0d9341..b9012fe 100644 --- a/docs/classes/DataTableBuilder.html +++ b/docs/classes/DataTableBuilder.html @@ -702,7 +702,7 @@

Constructor

- constructor(code: string, description: string, validations: []) + constructor(code: string, description: string, validations: Validation[]) @@ -711,6 +711,52 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
code + string + +
description + string + +
validations + Validation[] + +
+
+ + @@ -725,13 +771,13 @@

- Public addQuestion + Public addQuestion - - addQuestion(question: []) + + addQuestion(question: Question[]) @@ -745,10 +791,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
question + Question[] + +
+
+
+
Returns : void
+
+ +
@@ -758,12 +833,12 @@

- Public build + Public build - + build() diff --git a/docs/classes/Dependency.html b/docs/classes/Dependency.html index 304bae6..e317645 100644 --- a/docs/classes/Dependency.html +++ b/docs/classes/Dependency.html @@ -708,6 +708,52 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
_code + string + +
_criteria + DependencyCriteria + +
_expectedAnswer + string + +
+
+ + @@ -724,12 +770,12 @@

- Public code + Public code - code: string + code: string @@ -753,12 +799,12 @@

- Public criteria + Public criteria - criteria: DependencyCriteria + criteria: DependencyCriteria @@ -782,12 +828,12 @@

- Public expectedAnswer + Public expectedAnswer - expectedAnswer: string + expectedAnswer: string diff --git a/docs/classes/DependencyService.html b/docs/classes/DependencyService.html index 4744bf3..1902a37 100644 --- a/docs/classes/DependencyService.html +++ b/docs/classes/DependencyService.html @@ -698,12 +698,12 @@

- Public hideQuestion + Public hideQuestion - + hideQuestion(question: Question, formGroup: FormGroup) @@ -718,10 +718,48 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
question + Question<any> + +
formGroup + FormGroup + +
+
+
+
Returns : boolean
+
+ +
diff --git a/docs/classes/Email.html b/docs/classes/Email.html index 825cd6a..2727ebb 100644 --- a/docs/classes/Email.html +++ b/docs/classes/Email.html @@ -687,6 +687,34 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
message + string + +
+
+ + diff --git a/docs/classes/EmailValidator.html b/docs/classes/EmailValidator.html index 14640a8..60b6003 100644 --- a/docs/classes/EmailValidator.html +++ b/docs/classes/EmailValidator.html @@ -704,12 +704,12 @@

- Public handle + Public handle - + handle(validation: Validation) @@ -724,10 +724,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
validation + Validation + +
+
+
+
Returns : ValidatorFn
+
+ +
diff --git a/docs/classes/Fieldset.html b/docs/classes/Fieldset.html index 5979866..577f78b 100644 --- a/docs/classes/Fieldset.html +++ b/docs/classes/Fieldset.html @@ -699,7 +699,7 @@

Constructor

- constructor(code: string, description: string, _questions: []) + constructor(code: string, description: string, _questions: Question[]) @@ -708,6 +708,52 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
code + string + +
description + string + +
_questions + Question[] + +
+
+ + @@ -724,18 +770,18 @@

- Public questions + Public questions - questions: [] + questions: Question[] - Type : [] + Type : Question[] diff --git a/docs/classes/FieldsetBuilder.html b/docs/classes/FieldsetBuilder.html index 3e228c2..202c551 100644 --- a/docs/classes/FieldsetBuilder.html +++ b/docs/classes/FieldsetBuilder.html @@ -711,6 +711,43 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
code + string + +
description + string + +
+
+ + @@ -725,12 +762,12 @@

- Public addQuestion + Public addQuestion - + addQuestion(question: Question) @@ -745,10 +782,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
question + Question<any> + +
+
+
+
Returns : void
+
+ +
@@ -758,12 +824,12 @@

- Public build + Public build - + build() diff --git a/docs/classes/Group.html b/docs/classes/Group.html index 814bce5..ec41f70 100644 --- a/docs/classes/Group.html +++ b/docs/classes/Group.html @@ -708,6 +708,52 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
_code + string + +
_description + string + +
_type + GroupType + +
+
+ + @@ -724,12 +770,12 @@

- Public code + Public code - code: string + code: string @@ -753,12 +799,12 @@

- Public description + Public description - description: string + description: string @@ -782,12 +828,12 @@

- Public type + Public type - type: GroupType + type: GroupType diff --git a/docs/classes/GroupBuilder.html b/docs/classes/GroupBuilder.html index d27b025..9a1e476 100644 --- a/docs/classes/GroupBuilder.html +++ b/docs/classes/GroupBuilder.html @@ -719,6 +719,43 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
code + string + +
description + string + +
+
+ + @@ -733,12 +770,12 @@

- Public addQuestion + Public addQuestion - + addQuestion(question: QuestionListType) @@ -753,10 +790,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
question + QuestionListType + +
+
+
+
Returns : void
+
+ +
@@ -766,12 +832,12 @@

- Public build + Public build - + build() @@ -807,18 +873,18 @@

- Protected questions + Protected questions - questions: [] + questions: QuestionListType[] - Type : [] + Type : QuestionListType[] diff --git a/docs/classes/Max.html b/docs/classes/Max.html index 57bd065..d586110 100644 --- a/docs/classes/Max.html +++ b/docs/classes/Max.html @@ -708,6 +708,43 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
message + string + +
_value + number + +
+
+ + @@ -724,12 +761,12 @@

- Public value + Public value - value: number + value: number diff --git a/docs/classes/MaxLength.html b/docs/classes/MaxLength.html index 7c6c61d..e7bb766 100644 --- a/docs/classes/MaxLength.html +++ b/docs/classes/MaxLength.html @@ -708,6 +708,43 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
message + string + +
_value + number + +
+
+ + @@ -724,12 +761,12 @@

- Public value + Public value - value: number + value: number diff --git a/docs/classes/MaxLengthValidator.html b/docs/classes/MaxLengthValidator.html index 7548408..68b26d3 100644 --- a/docs/classes/MaxLengthValidator.html +++ b/docs/classes/MaxLengthValidator.html @@ -704,12 +704,12 @@

- Public handle + Public handle - + handle(validation: Validation) @@ -724,10 +724,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
validation + Validation + +
+
+
+
Returns : ValidatorFn
+
+ +
diff --git a/docs/classes/MaxValidator.html b/docs/classes/MaxValidator.html index fb14019..e1bb47d 100644 --- a/docs/classes/MaxValidator.html +++ b/docs/classes/MaxValidator.html @@ -704,12 +704,12 @@

- Public handle + Public handle - + handle(validation: Validation) @@ -724,10 +724,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
validation + Validation + +
+
+
+
Returns : ValidatorFn
+
+ +
diff --git a/docs/classes/Min.html b/docs/classes/Min.html index 22e56c1..5f7e85b 100644 --- a/docs/classes/Min.html +++ b/docs/classes/Min.html @@ -708,6 +708,43 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
message + string + +
_value + number + +
+
+ + @@ -724,12 +761,12 @@

- Public value + Public value - value: number + value: number diff --git a/docs/classes/MinLength.html b/docs/classes/MinLength.html index a8e186c..6ebd1ba 100644 --- a/docs/classes/MinLength.html +++ b/docs/classes/MinLength.html @@ -708,6 +708,43 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
message + string + +
_value + number + +
+
+ + @@ -724,12 +761,12 @@

- Public value + Public value - value: number + value: number diff --git a/docs/classes/MinLengthValidator.html b/docs/classes/MinLengthValidator.html index a8923ec..d463f98 100644 --- a/docs/classes/MinLengthValidator.html +++ b/docs/classes/MinLengthValidator.html @@ -704,12 +704,12 @@

- Public handle + Public handle - + handle(validation: Validation) @@ -724,10 +724,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
validation + Validation + +
+
+
+
Returns : ValidatorFn
+
+ +
diff --git a/docs/classes/MinValidator.html b/docs/classes/MinValidator.html index d205c1a..9faa80c 100644 --- a/docs/classes/MinValidator.html +++ b/docs/classes/MinValidator.html @@ -704,12 +704,12 @@

- Public handle + Public handle - + handle(validation: Validation) @@ -724,10 +724,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
validation + Validation + +
+
+
+
Returns : ValidatorFn
+
+ +
diff --git a/docs/classes/Pattern.html b/docs/classes/Pattern.html index 304e481..c36984e 100644 --- a/docs/classes/Pattern.html +++ b/docs/classes/Pattern.html @@ -722,6 +722,43 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
message + string + +
_value + string + +
+
+ + @@ -736,12 +773,12 @@

- Public isRequired + Public isRequired - + isRequired() @@ -756,15 +793,10 @@

-
-
Returns : boolean
-
- -
@@ -782,12 +814,12 @@

- Public value + Public value - value: string + value: string diff --git a/docs/classes/PatternValidator.html b/docs/classes/PatternValidator.html index 954f470..e8d85b3 100644 --- a/docs/classes/PatternValidator.html +++ b/docs/classes/PatternValidator.html @@ -704,12 +704,12 @@

- Public handle + Public handle - + handle(validation: Validation) @@ -724,10 +724,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
validation + Validation + +
+
+
+
Returns : ValidatorFn
+
+ +
diff --git a/docs/classes/Question.html b/docs/classes/Question.html index 989aa67..f558c0e 100644 --- a/docs/classes/Question.html +++ b/docs/classes/Question.html @@ -725,7 +725,7 @@

Constructor

- constructor(_name: string, _description: string, _type: QuestionType, _dependencies: [], _answer: Answer, _validations: [], _disabled: boolean) + constructor(_name: string, _description: string, _type: QuestionType, _dependencies: Dependency[], _answer: Answer, _validations: Validation[], _disabled: boolean) @@ -734,6 +734,88 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
_name + string + +
_description + string + +
_type + QuestionType + +
_dependencies + Dependency[] + +
_answer + Answer + +
_validations + Validation[] + +
_disabled + boolean + +
+
+ + @@ -748,12 +830,12 @@

- Public isRequired + Public isRequired - + isRequired() @@ -789,12 +871,12 @@

- Public answer + Public answer - answer: Answer + answer: Answer @@ -818,18 +900,18 @@

- Public dependencies + Public dependencies - dependencies: [] + dependencies: Dependency[] - Type : [] + Type : Dependency[] @@ -847,12 +929,12 @@

- Public description + Public description - description: string + description: string @@ -876,12 +958,12 @@

- Public disabled + Public disabled - disabled: boolean + disabled: boolean @@ -905,12 +987,12 @@

- Public name + Public name - name: string + name: string @@ -934,12 +1016,12 @@

- Public type + Public type - type: QuestionType + type: QuestionType @@ -963,18 +1045,18 @@

- Public validations + Public validations - validations: [] + validations: Validation[] - Type : [] + Type : Validation[] diff --git a/docs/classes/QuestionFactory.html b/docs/classes/QuestionFactory.html index 32bd96a..f084fa8 100644 --- a/docs/classes/QuestionFactory.html +++ b/docs/classes/QuestionFactory.html @@ -701,12 +701,12 @@

- Public createQuestion + Public createQuestion - + createQuestion(question: Question) @@ -721,10 +721,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
question + Question<any> + +
+
+
+
Returns : Question<any>
+
+ +
@@ -734,13 +763,13 @@

- Public createQuestionList + Public createQuestionList - - createQuestionList(questionList: []) + + createQuestionList(questionList: Question[]) @@ -754,10 +783,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
questionList + Question[] + +
+
+
+
Returns : []
+
+ +
diff --git a/docs/classes/Radio.html b/docs/classes/Radio.html index 860e9c8..2232a39 100644 --- a/docs/classes/Radio.html +++ b/docs/classes/Radio.html @@ -699,7 +699,7 @@

Constructor

- constructor(name: string, description: string, dependencies: [], answer: string, validations: [], disabled: boolean, options: []|[], defaultOption: string) + constructor(name: string, description: string, dependencies: Dependency[], answer: string, validations: Validation[], disabled: boolean, options: [] | [], defaultOption: string) @@ -708,6 +708,97 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
name + string + +
description + string + +
dependencies + Dependency[] + +
answer + string + +
validations + Validation[] + +
disabled + boolean + +
options + [] | [] + +
defaultOption + string + +
+
+ + @@ -722,12 +813,12 @@

- Public fromJson + Public fromJson - + fromJson(question: Radio) @@ -742,10 +833,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
question + Radio + +
+
+
+
Returns : Radio
+
+ +
diff --git a/docs/classes/ReactiveFormsFactory.html b/docs/classes/ReactiveFormsFactory.html index 08f114b..323954a 100644 --- a/docs/classes/ReactiveFormsFactory.html +++ b/docs/classes/ReactiveFormsFactory.html @@ -707,12 +707,12 @@

- Public createFormArrayFromQuestions + Public createFormArrayFromQuestions - + createFormArrayFromQuestions(questions: [][]) @@ -727,10 +727,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
questions + [][] + +
+
+
+
Returns : FormArray
+
+ +
@@ -740,13 +769,13 @@

- Public createFormGroupFromGroups + Public createFormGroupFromGroups - - createFormGroupFromGroups(groups: []) + + createFormGroupFromGroups(groups: Group[]) @@ -760,10 +789,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
groups + Group[] + +
+
+
+
Returns : FormGroup
+
+ +
@@ -773,13 +831,13 @@

- Public createFormGroupFromQuestions + Public createFormGroupFromQuestions - - createFormGroupFromQuestions(questions: [], checkDisabledQuestions: boolean) + + createFormGroupFromQuestions(questions: Question[], checkDisabledQuestions: boolean) @@ -793,10 +851,48 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
questions + Question[] + +
checkDisabledQuestions + boolean + +
+
+
+
Returns : FormGroup
+
+ +
@@ -806,13 +902,13 @@

- Public createValidators + Public createValidators - - createValidators(validations: []) + + createValidators(validations: Validation[]) @@ -826,10 +922,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
validations + Validation[] + +
+
+
+
Returns : []
+
+ +
diff --git a/docs/classes/Required.html b/docs/classes/Required.html index b7c9ceb..2da5362 100644 --- a/docs/classes/Required.html +++ b/docs/classes/Required.html @@ -708,6 +708,43 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
message + string + +
_requiredTrue + boolean + +
+
+ + @@ -724,12 +761,12 @@

- Public requiredTrue + Public requiredTrue - requiredTrue: boolean + requiredTrue: boolean diff --git a/docs/classes/RequiredValidator.html b/docs/classes/RequiredValidator.html index db3e5f4..fe63f96 100644 --- a/docs/classes/RequiredValidator.html +++ b/docs/classes/RequiredValidator.html @@ -704,12 +704,12 @@

- Public handle + Public handle - + handle(validation: Validation) @@ -724,10 +724,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
validation + Validation + +
+
+
+
Returns : ValidatorFn
+
+ +
diff --git a/docs/classes/Select.html b/docs/classes/Select.html index 5dfece9..a54039a 100644 --- a/docs/classes/Select.html +++ b/docs/classes/Select.html @@ -716,7 +716,7 @@

Constructor

- constructor(name: string, description: string, dependencies: [], answer: string, validations: [], disabled: boolean, options: []|[], defaultOption: string, _editableOption: string, _placeholder: string) + constructor(name: string, description: string, dependencies: Dependency[], answer: string, validations: Validation[], disabled: boolean, options: [] | [], defaultOption: string, _editableOption: string, _placeholder: string) @@ -725,6 +725,115 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
name + string + +
description + string + +
dependencies + Dependency[] + +
answer + string + +
validations + Validation[] + +
disabled + boolean + +
options + [] | [] + +
defaultOption + string + +
_editableOption + string + +
_placeholder + string + +
+
+ + @@ -739,12 +848,12 @@

- Public fromJson + Public fromJson - + fromJson(question: Select) @@ -759,10 +868,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
question + Select + +
+
+
+
Returns : Select
+
+ +
@@ -780,12 +918,12 @@

- Public editableOption + Public editableOption - editableOption: string + editableOption: string @@ -809,12 +947,12 @@

- Public placeholder + Public placeholder - placeholder: string + placeholder: string diff --git a/docs/classes/SelectService.html b/docs/classes/SelectService.html index fc54a2c..8bed61a 100644 --- a/docs/classes/SelectService.html +++ b/docs/classes/SelectService.html @@ -698,12 +698,12 @@

- Public onChangeOption + Public onChangeOption - + onChangeOption(htmlFormControl: HTMLInputElement, formControl: FormControl, question: Select) @@ -718,10 +718,57 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
htmlFormControl + HTMLInputElement + +
formControl + FormControl + +
question + Select + +
+
+
+
Returns : void
+
+ +
diff --git a/docs/classes/StringUtils.html b/docs/classes/StringUtils.html index 6085d8e..9488ab7 100644 --- a/docs/classes/StringUtils.html +++ b/docs/classes/StringUtils.html @@ -698,12 +698,12 @@

- Public convertToString + Public convertToString - + convertToString(value: any) @@ -718,10 +718,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
value + any + +
+
+
+
Returns : string
+
+ +
diff --git a/docs/classes/Text.html b/docs/classes/Text.html index 5fec71f..78238d1 100644 --- a/docs/classes/Text.html +++ b/docs/classes/Text.html @@ -716,7 +716,7 @@

Constructor

- constructor(name: string, description: string, dependencies: [], answer: string, validations: [], disabled: boolean, _mask: string, _placeholder: string) + constructor(name: string, description: string, dependencies: Dependency[], answer: string, validations: Validation[], disabled: boolean, _mask: string, _placeholder: string) @@ -725,6 +725,97 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
name + string + +
description + string + +
dependencies + Dependency[] + +
answer + string + +
validations + Validation[] + +
disabled + boolean + +
_mask + string + +
_placeholder + string + +
+
+ + @@ -739,12 +830,12 @@

- Public fromJson + Public fromJson - + fromJson(question: Text) @@ -759,10 +850,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
question + Text + +
+
+
+
Returns : Text
+
+ +
@@ -780,12 +900,12 @@

- Public mask + Public mask - mask: string + mask: string @@ -809,12 +929,12 @@

- Public placeholder + Public placeholder - placeholder: string + placeholder: string diff --git a/docs/classes/TextArea.html b/docs/classes/TextArea.html index d7dccb1..8710021 100644 --- a/docs/classes/TextArea.html +++ b/docs/classes/TextArea.html @@ -713,7 +713,7 @@

Constructor

- constructor(name: string, description: string, dependencies: [], answer: string, validations: [], disabled: boolean, _placeholder: string) + constructor(name: string, description: string, dependencies: Dependency[], answer: string, validations: Validation[], disabled: boolean, _placeholder: string) @@ -722,6 +722,88 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
name + string + +
description + string + +
dependencies + Dependency[] + +
answer + string + +
validations + Validation[] + +
disabled + boolean + +
_placeholder + string + +
+
+ + @@ -736,12 +818,12 @@

- Public fromJson + Public fromJson - + fromJson(question: TextArea) @@ -756,10 +838,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
question + TextArea + +
+
+
+
Returns : TextArea
+
+ +
@@ -777,12 +888,12 @@

- Public placeholder + Public placeholder - placeholder: string + placeholder: string diff --git a/docs/classes/Validation.html b/docs/classes/Validation.html index 6e3c3b7..ce410e1 100644 --- a/docs/classes/Validation.html +++ b/docs/classes/Validation.html @@ -719,6 +719,43 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
_type + ValidationType + +
_message + string + +
+
+ + @@ -733,12 +770,12 @@

- Public isRequired + Public isRequired - + isRequired() @@ -774,12 +811,12 @@

- Public message + Public message - message: string + message: string @@ -803,12 +840,12 @@

- Public type + Public type - type: ValidationType + type: ValidationType diff --git a/docs/classes/ValidationFactory.html b/docs/classes/ValidationFactory.html index 4551a22..6fcce99 100644 --- a/docs/classes/ValidationFactory.html +++ b/docs/classes/ValidationFactory.html @@ -701,12 +701,12 @@

- Public createValidation + Public createValidation - + createValidation(validation: Validation) @@ -721,10 +721,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
validation + Validation + +
+
+
+
Returns : Validation
+
+ +
@@ -734,13 +763,13 @@

- Public createValidationList + Public createValidationList - - createValidationList(validationList: []) + + createValidationList(validationList: Validation[]) @@ -754,10 +783,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
validationList + Validation[] + +
+
+
+
Returns : []
+
+ +
diff --git a/docs/classes/ValidationTypeNotFoundError.html b/docs/classes/ValidationTypeNotFoundError.html index f14a9c8..765b9fa 100644 --- a/docs/classes/ValidationTypeNotFoundError.html +++ b/docs/classes/ValidationTypeNotFoundError.html @@ -711,6 +711,34 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
_message + string + +
+
+ + @@ -727,12 +755,12 @@

- Public message + Public message - message: string + message: string @@ -756,12 +784,12 @@

- Public name + Public name - name: string + name: string diff --git a/docs/classes/ValidatorFactory.html b/docs/classes/ValidatorFactory.html index a001ed4..02ef573 100644 --- a/docs/classes/ValidatorFactory.html +++ b/docs/classes/ValidatorFactory.html @@ -720,6 +720,34 @@

Constructor

+ + +
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
validation + Validation + +
+
+ + @@ -734,12 +762,12 @@

- Public createEmailValidator + Public createEmailValidator - + createEmailValidator() @@ -767,12 +795,12 @@

- Public createMaxLengthValidator + Public createMaxLengthValidator - + createMaxLengthValidator() @@ -800,12 +828,12 @@

- Public createMaxValidator + Public createMaxValidator - + createMaxValidator() @@ -833,12 +861,12 @@

- Public createMinLengthValidator + Public createMinLengthValidator - + createMinLengthValidator() @@ -866,12 +894,12 @@

- Public createMinValidator + Public createMinValidator - + createMinValidator() @@ -899,12 +927,12 @@

- Public createPatternValidator + Public createPatternValidator - + createPatternValidator() @@ -932,12 +960,12 @@

- Public createRequiredValidator + Public createRequiredValidator - + createRequiredValidator() diff --git a/docs/classes/ValidatorFactoryHandler.html b/docs/classes/ValidatorFactoryHandler.html index b285f8c..afa18de 100644 --- a/docs/classes/ValidatorFactoryHandler.html +++ b/docs/classes/ValidatorFactoryHandler.html @@ -701,12 +701,12 @@

- Public append + Public append - + append(handler: ValidatorFactoryHandler) @@ -721,10 +721,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
handler + ValidatorFactoryHandler + +
+
+
+
+
+ +
@@ -734,12 +763,12 @@

- Public handle + Public handle - + handle(validation: Validation) @@ -754,10 +783,39 @@

+
+ Parameters : + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
validation + Validation + +
+
+
+
Returns : ValidatorFn
+
+ +
diff --git a/docs/components/AngularFormsComponent.html b/docs/components/AngularFormsComponent.html index 21ef41a..156988d 100644 --- a/docs/components/AngularFormsComponent.html +++ b/docs/components/AngularFormsComponent.html @@ -901,6 +901,12 @@

Methods
  • Public hideQuestion
  • +
  • + Public isDirty +
  • +
  • + Public isPristine +
  • Public isValid
  • @@ -952,6 +958,43 @@

    Constructor

    + + +
    + Parameters : + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeOptionalDescription
    changeDetectorRef + ChangeDetectorRef + +
    translateService + TranslateService + +
    +
    + + @@ -967,7 +1010,7 @@

    Inputs

    - Type: [] + Type: Group[]

    @@ -1030,6 +1073,8 @@

    Inputs

    + +

    @@ -1040,12 +1085,12 @@

    - Public getAnswers + Public getAnswers - + getAnswers() @@ -1053,7 +1098,7 @@

    - + @@ -1073,12 +1118,12 @@

    - Public getAnswersGroups + Public getAnswersGroups - + getAnswersGroups() @@ -1086,7 +1131,7 @@

    - + @@ -1106,12 +1151,12 @@

    - Public getForm + Public getForm - + getForm() @@ -1139,12 +1184,12 @@

    - Public hideQuestion + Public hideQuestion - + hideQuestion(question: Question, formGroup: FormGroup) @@ -1156,6 +1201,110 @@

    + + + +
    + Parameters : + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeOptionalDescription
    question + Question<any> + +
    formGroup + FormGroup + +
    +
    +
    +
    +
    + Returns : boolean + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + +
    + + Public isDirty +
    + + isDirty() +
    + +
    + +
    + Returns : boolean + +
    +
    + + + + + + + + + + + + + + @@ -1185,7 +1334,7 @@

    @@ -1205,12 +1354,12 @@

    @@ -1225,10 +1374,57 @@

    @@ -1238,12 +1434,12 @@

    @@ -1278,12 +1474,12 @@

    @@ -1307,12 +1503,12 @@

    @@ -1552,6 +1748,14 @@

    return { valid: this.isValid(), value: this.getAnswersGroups() }; } + public isPristine(): boolean { + return this.formGroup.pristine; + } + + public isDirty(): boolean { + return this.formGroup.dirty; + } + public isValid(): boolean { return this.formGroup.valid; } diff --git a/docs/components/DataTableComponent.html b/docs/components/DataTableComponent.html index 74daae6..0b83ca0 100644 --- a/docs/components/DataTableComponent.html +++ b/docs/components/DataTableComponent.html @@ -1016,6 +1016,8 @@

    Inputs

    + +

    @@ -1026,12 +1028,12 @@

    @@ -1059,12 +1061,12 @@

    @@ -1079,10 +1081,39 @@

    @@ -1092,12 +1123,12 @@

    @@ -1112,10 +1143,39 @@

    @@ -1125,12 +1185,12 @@

    @@ -1145,10 +1205,39 @@

    @@ -1158,12 +1247,12 @@

    @@ -1178,10 +1267,57 @@

    @@ -1191,12 +1327,12 @@

    @@ -1211,10 +1347,39 @@

    @@ -1224,12 +1389,12 @@

    @@ -1264,12 +1429,12 @@

    @@ -1293,12 +1458,12 @@

    @@ -1322,12 +1487,12 @@

    diff --git a/docs/components/DemoComponent.html b/docs/components/DemoComponent.html index bbf6490..8731bef 100644 --- a/docs/components/DemoComponent.html +++ b/docs/components/DemoComponent.html @@ -705,10 +705,14 @@

    Metadata

    @@ -757,6 +761,12 @@
    Methods
  • Public getForm
  • +
  • + Public isDirty +
  • +
  • + Public isPristine +
  • Public isValid
  • @@ -778,16 +788,46 @@

    Constructor

    + + +
    + + Public isPristine +
    + + isPristine() +
    + +
    @@ -1172,12 +1321,12 @@

    - Public isValid + Public isValid
    - + isValid()
    - +
    - Public onChangeOptionSelect + Public onChangeOptionSelect
    - + onChangeOptionSelect(htmlFormControl: HTMLInputElement, formControl: FormControl, question: Select)
    +
    + Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeOptionalDescription
    htmlFormControl + HTMLInputElement + +
    formControl + FormControl + +
    question + Select + +
    +
    +
    +
    Returns : void
    +
    + +
    - Public submit + Public submit
    - + submit()
    - Public formGroup + Public formGroup
    - formGroup: FormGroup + formGroup: FormGroup
    - Public submitted + Public submitted
    - submitted: boolean + submitted: boolean
    - Public addData + Public addData
    - + addData()
    - Public getKeysFromObject + Public getKeysFromObject
    - + getKeysFromObject(object: Object)
    +
    + Parameters : + + + + + + + + + + + + + + + + + +
    NameTypeOptionalDescription
    object + Object + +
    +
    +
    +
    Returns : string[]
    +
    + +
    - Public getQuestionByName + Public getQuestionByName
    - + getQuestionByName(name: string)
    +
    + Parameters : + + + + + + + + + + + + + + + + + +
    NameTypeOptionalDescription
    name + string + +
    +
    +
    +
    Returns : Question<any>
    +
    + +
    - Public isCheckbox + Public isCheckbox
    - + isCheckbox(question: Question)
    +
    + Parameters : + + + + + + + + + + + + + + + + + +
    NameTypeOptionalDescription
    question + Question<any> + +
    +
    +
    +
    Returns : boolean
    +
    + +
    - Public onChangeOptionSelect + Public onChangeOptionSelect
    - + onChangeOptionSelect(htmlFormControl: HTMLInputElement, formControl: FormControl, question: Select)
    +
    + Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeOptionalDescription
    htmlFormControl + HTMLInputElement + +
    formControl + FormControl + +
    question + Select + +
    +
    +
    +
    Returns : void
    +
    + +
    - Public removeData + Public removeData
    - + removeData(index: number)
    +
    + Parameters : + + + + + + + + + + + + + + + + + +
    NameTypeOptionalDescription
    index + number + +
    +
    +
    +
    Returns : void
    +
    + +
    - Public resetForms + Public resetForms
    - + resetForms()
    - Public formArray + Public formArray
    - formArray: FormArray + formArray: FormArray
    - Public newFormGroup + Public newFormGroup
    - newFormGroup: FormGroup + newFormGroup: FormGroup
    - Public submitted + Public submitted
    - submitted: boolean + submitted: boolean
    <div class='container'>
       <h1>AngularForms</h1>
       <rb-angular-forms #angularForms [groups]="customForm" [readOnly]="false" lang="pt-BR"></rb-angular-forms>
    -  <button class="btn btn-primary" (click)="angularForms.submit(); getForm()">getForm()</button>
    -  <button class="btn btn-primary" (click)="angularForms.submit(); isValid()">isValid()</button>
    -  <button class="btn btn-primary" (click)="angularForms.submit(); getAnswersGroups()">getAnswersGroups()</button>
    -  <button class="btn btn-primary" (click)="angularForms.submit(); getAnswers()">getAnswers()</button>
    +  <button class="btn btn-primary" (click)="angularForms.submit()">submit()</button>
    +  <button class="btn btn-primary" (click)="isPristine()">isPristine()</button>
    +  <button class="btn btn-primary" (click)="isDirty()">isDirty()</button>
    +  <button class="btn btn-primary" (click)="isValid()">isValid()</button>
    +  <button class="btn btn-primary" (click)="getForm()">getForm()</button>
    +  <button class="btn btn-primary" (click)="isValid()">isValid()</button>
    +  <button class="btn btn-primary" (click)="getAnswersGroups()">getAnswersGroups()</button>
    +  <button class="btn btn-primary" (click)="getAnswers()">getAnswers()</button>
     </div>
     
    - +
    +
    + Parameters : + + + + + + + + + + + + + + + + + +
    NameTypeOptionalDescription
    demoService + DemoService + +
    +
    +

    + +

    @@ -798,12 +838,12 @@

    - Public getAnswers + Public getAnswers - + getAnswers() @@ -811,7 +851,7 @@

    - + @@ -831,12 +871,12 @@

    - Public getAnswersGroups + Public getAnswersGroups - + getAnswersGroups() @@ -844,7 +884,7 @@

    - + @@ -864,12 +904,12 @@

    - Public getForm + Public getForm - + getForm() @@ -877,7 +917,73 @@

    - + + + + + + + +
    + Returns : void + +
    + + + + + + + + + + + + + + + + + + + + + + +
    + + Public isDirty +
    + + isDirty() +
    + +
    + +
    + Returns : void + +
    +
    + + + + + + + + + + + + @@ -897,12 +1003,12 @@

    @@ -910,7 +1016,7 @@

    @@ -937,12 +1043,12 @@

    @@ -959,7 +1065,7 @@

    @@ -971,12 +1077,12 @@

    @@ -988,7 +1094,7 @@

    @@ -1011,10 +1117,14 @@

    <div class='container'> <h1>AngularForms</h1> <rb-angular-forms #angularForms [groups]="customForm" [readOnly]="false" lang="pt-BR"></rb-angular-forms> - <button class="btn btn-primary" (click)="angularForms.submit(); getForm()">getForm()</button> - <button class="btn btn-primary" (click)="angularForms.submit(); isValid()">isValid()</button> - <button class="btn btn-primary" (click)="angularForms.submit(); getAnswersGroups()">getAnswersGroups()</button> - <button class="btn btn-primary" (click)="angularForms.submit(); getAnswers()">getAnswers()</button> + <button class="btn btn-primary" (click)="angularForms.submit()">submit()</button> + <button class="btn btn-primary" (click)="isPristine()">isPristine()</button> + <button class="btn btn-primary" (click)="isDirty()">isDirty()</button> + <button class="btn btn-primary" (click)="isValid()">isValid()</button> + <button class="btn btn-primary" (click)="getForm()">getForm()</button> + <button class="btn btn-primary" (click)="isValid()">isValid()</button> + <button class="btn btn-primary" (click)="getAnswersGroups()">getAnswersGroups()</button> + <button class="btn btn-primary" (click)="getAnswers()">getAnswers()</button> </div> `, providers: [DemoService] @@ -1035,6 +1145,14 @@

    console.log(this.angularForms.getForm()); } + public isPristine(): void { + console.log(this.angularForms.isPristine()); + } + + public isDirty(): void { + console.log(this.angularForms.isDirty()); + } + public isValid(): void { console.log(this.angularForms.isValid()); } @@ -1074,7 +1192,7 @@

    + + Public isPristine +
    + + isPristine() +
    +
    - Public isValid + Public isValid
    - + isValid()
    - +
    - Public angularForms + Public angularForms
    - angularForms: AngularFormsComponent + angularForms: AngularFormsComponent
    - +
    - Public customForm + Public customForm
    - customForm: any[] + customForm: any[]
    - +