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';
All notable changes to this project will be documented in this file. See standard-version for commit guidelines.
+ +fromJson(jsonGroups: [])
+
+ fromJson(jsonGroups: Group[])
| Name | +Type | +Optional | +Description | +
| jsonGroups | +
+ Group[]
+ |
+ + | ++ |
[]
getTranslation(lang: string)
| Name | +Type | +Optional | +Description | +
| lang | +
+ string
+ |
+ + | ++ |
Observable<any>
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)
| Name | +Type | +Optional | +Description | +
| name | +
+ string
+ |
+ + | ++ |
| description | +
+ string
+ |
+ + | ++ |
| dependencies | +
+ Dependency[]
+ |
+ + | ++ |
| answer | +
+ boolean
+ |
+ + | ++ |
| validations | +
+ Validation[]
+ |
+ + | ++ |
| disabled | +
+ boolean
+ |
+ + | ++ |
| _defaultOption | +
+ boolean
+ |
+ + | ++ |
fromJson(question: Checkbox)
| Name | +Type | +Optional | +Description | +
| question | +
+ Checkbox
+ |
+ + | ++ |
Checkbox
defaultOption: boolean
+ defaultOption: boolean
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)
| Name | +Type | +Optional | +Description | +
| name | +
+ string
+ |
+ + | ++ |
| description | +
+ string
+ |
+ + | ++ |
| type | +
+ QuestionType
+ |
+ + | ++ |
| dependencies | +
+ Dependency[]
+ |
+ + | ++ |
| answer | +
+ string
+ |
+ + | ++ |
| validations | +
+ Validation[]
+ |
+ + | ++ |
| disabled | +
+ boolean
+ |
+ + | ++ |
| _options | +
+ [] | []
+ |
+ + | ++ |
| _defaultOption | +
+ string
+ |
+ + | ++ |
defaultOption: string
+ defaultOption: string
options: []|[]
+ options: [] | []
[]|[]
+ Type : [] | []
constructor(code: string, description: string, _questions: [][], _validations: [])
+ constructor(code: string, description: string, _questions: [][], _validations: Validation[])
| Name | +Type | +Optional | +Description | +
| code | +
+ string
+ |
+ + | ++ |
| description | +
+ string
+ |
+ + | ++ |
| _questions | +
+ [][]
+ |
+ + | ++ |
| _validations | +
+ Validation[]
+ |
+ + | ++ |
isRequired()
questions: [][]
+ questions: [][]
validations: []
+ validations: Validation[]
[]
+ Type : Validation[]
constructor(code: string, description: string, validations: [])
+ constructor(code: string, description: string, validations: Validation[])
| Name | +Type | +Optional | +Description | +
| code | +
+ string
+ |
+ + | ++ |
| description | +
+ string
+ |
+ + | ++ |
| validations | +
+ Validation[]
+ |
+ + | ++ |
addQuestion(question: [])
+
+ addQuestion(question: Question[])
| Name | +Type | +Optional | +Description | +
| question | +
+ Question[]
+ |
+ + | ++ |
void
build()
| Name | +Type | +Optional | +Description | +
| _code | +
+ string
+ |
+ + | ++ |
| _criteria | +
+ DependencyCriteria
+ |
+ + | ++ |
| _expectedAnswer | +
+ string
+ |
+ + | ++ |
code: string
+ code: string
criteria: DependencyCriteria
+ criteria: DependencyCriteria
expectedAnswer: string
+ expectedAnswer: string
hideQuestion(question: Question , formGroup: FormGroup)
| Name | +Type | +Optional | +Description | +
| question | +
+ Question<any>
+ |
+ + | ++ |
| formGroup | +
+ FormGroup
+ |
+ + | ++ |
boolean
| Name | +Type | +Optional | +Description | +
| message | +
+ string
+ |
+ + | ++ |
handle(validation: Validation)
| Name | +Type | +Optional | +Description | +
| validation | +
+ Validation
+ |
+ + | ++ |
ValidatorFn
constructor(code: string, description: string, _questions: [])
+ constructor(code: string, description: string, _questions: Question[])
| Name | +Type | +Optional | +Description | +
| code | +
+ string
+ |
+ + | ++ |
| description | +
+ string
+ |
+ + | ++ |
| _questions | +
+ Question[]
+ |
+ + | ++ |
questions: []
+ questions: Question[]
[]
+ Type : Question[]
addQuestion(question: Question )
| Name | +Type | +Optional | +Description | +
| question | +
+ Question<any>
+ |
+ + | ++ |
void
build()
code: string
+ code: string
description: string
+ description: string
type: GroupType
+ type: GroupType
addQuestion(question: QuestionListType)
| Name | +Type | +Optional | +Description | +
| question | +
+ QuestionListType
+ |
+ + | ++ |
void
build()
questions: []
+ questions: QuestionListType[]
[]
+ Type : QuestionListType[]
value: number
+ value: number
value: number
+ value: number
handle(validation: Validation)
| Name | +Type | +Optional | +Description | +
| validation | +
+ Validation
+ |
+ + | ++ |
ValidatorFn
handle(validation: Validation)
| Name | +Type | +Optional | +Description | +
| validation | +
+ Validation
+ |
+ + | ++ |
ValidatorFn
value: number
+ value: number
value: number
+ value: number
handle(validation: Validation)
| Name | +Type | +Optional | +Description | +
| validation | +
+ Validation
+ |
+ + | ++ |
ValidatorFn
handle(validation: Validation)
| Name | +Type | +Optional | +Description | +
| validation | +
+ Validation
+ |
+ + | ++ |
ValidatorFn
isRequired()
boolean
value: string
+ value: string
handle(validation: Validation)
| Name | +Type | +Optional | +Description | +
| validation | +
+ Validation
+ |
+ + | ++ |
ValidatorFn
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)
| Name | +Type | +Optional | +Description | +
| _name | +
+ string
+ |
+ + | ++ |
| _description | +
+ string
+ |
+ + | ++ |
| _type | +
+ QuestionType
+ |
+ + | ++ |
| _dependencies | +
+ Dependency[]
+ |
+ + | ++ |
| _answer | +
+ Answer
+ |
+ + | ++ |
| _validations | +
+ Validation[]
+ |
+ + | ++ |
| _disabled | +
+ boolean
+ |
+ + | ++ |
isRequired()
answer: Answer
+ answer: Answer
dependencies: []
+ dependencies: Dependency[]
[]
+ Type : Dependency[]
description: string
+ description: string
disabled: boolean
+ disabled: boolean
name: string
+ name: string
type: QuestionType
+ type: QuestionType
validations: []
+ validations: Validation[]
[]
+ Type : Validation[]
createQuestion(question: Question )
| Name | +Type | +Optional | +Description | +
| question | +
+ Question<any>
+ |
+ + | ++ |
Question<any>
createQuestionList(questionList: [])
+
+ createQuestionList(questionList: Question[])
| Name | +Type | +Optional | +Description | +
| questionList | +
+ Question[]
+ |
+ + | ++ |
[]
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)
| Name | +Type | +Optional | +Description | +
| name | +
+ string
+ |
+ + | ++ |
| description | +
+ string
+ |
+ + | ++ |
| dependencies | +
+ Dependency[]
+ |
+ + | ++ |
| answer | +
+ string
+ |
+ + | ++ |
| validations | +
+ Validation[]
+ |
+ + | ++ |
| disabled | +
+ boolean
+ |
+ + | ++ |
| options | +
+ [] | []
+ |
+ + | ++ |
| defaultOption | +
+ string
+ |
+ + | ++ |
fromJson(question: Radio)
| Name | +Type | +Optional | +Description | +
| question | +
+ Radio
+ |
+ + | ++ |
Radio
createFormArrayFromQuestions(questions: [][])
| Name | +Type | +Optional | +Description | +
| questions | +
+ [][]
+ |
+ + | ++ |
FormArray
createFormGroupFromGroups(groups: [])
+
+ createFormGroupFromGroups(groups: Group[])
| Name | +Type | +Optional | +Description | +
| groups | +
+ Group[]
+ |
+ + | ++ |
FormGroup
createFormGroupFromQuestions(questions: [], checkDisabledQuestions: boolean)
+
+ createFormGroupFromQuestions(questions: Question[], checkDisabledQuestions: boolean)
| Name | +Type | +Optional | +Description | +
| questions | +
+ Question[]
+ |
+ + | ++ |
| checkDisabledQuestions | +
+ boolean
+ |
+ + | ++ |
FormGroup
createValidators(validations: [])
+
+ createValidators(validations: Validation[])
| Name | +Type | +Optional | +Description | +
| validations | +
+ Validation[]
+ |
+ + | ++ |
[]
requiredTrue: boolean
+ requiredTrue: boolean
handle(validation: Validation)
| Name | +Type | +Optional | +Description | +
| validation | +
+ Validation
+ |
+ + | ++ |
ValidatorFn
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)
| Name | +Type | +Optional | +Description | +
| name | +
+ string
+ |
+ + | ++ |
| description | +
+ string
+ |
+ + | ++ |
| dependencies | +
+ Dependency[]
+ |
+ + | ++ |
| answer | +
+ string
+ |
+ + | ++ |
| validations | +
+ Validation[]
+ |
+ + | ++ |
| disabled | +
+ boolean
+ |
+ + | ++ |
| options | +
+ [] | []
+ |
+ + | ++ |
| defaultOption | +
+ string
+ |
+ + | ++ |
| _editableOption | +
+ string
+ |
+ + | ++ |
| _placeholder | +
+ string
+ |
+ + | ++ |
fromJson(question: Select)
| Name | +Type | +Optional | +Description | +
| question | +
+ Select
+ |
+ + | ++ |
Select
editableOption: string
+ editableOption: string
placeholder: string
+ placeholder: string
onChangeOption(htmlFormControl: HTMLInputElement, formControl: FormControl, question: Select)
| Name | +Type | +Optional | +Description | +
| htmlFormControl | +
+ HTMLInputElement
+ |
+ + | ++ |
| formControl | +
+ FormControl
+ |
+ + | ++ |
| question | +
+ Select
+ |
+ + | ++ |
void
convertToString(value: any)
| Name | +Type | +Optional | +Description | +
| value | +
+ any
+ |
+ + | ++ |
string
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)
| Name | +Type | +Optional | +Description | +
| name | +
+ string
+ |
+ + | ++ |
| description | +
+ string
+ |
+ + | ++ |
| dependencies | +
+ Dependency[]
+ |
+ + | ++ |
| answer | +
+ string
+ |
+ + | ++ |
| validations | +
+ Validation[]
+ |
+ + | ++ |
| disabled | +
+ boolean
+ |
+ + | ++ |
| _mask | +
+ string
+ |
+ + | ++ |
| _placeholder | +
+ string
+ |
+ + | ++ |
fromJson(question: Text)
| Name | +Type | +Optional | +Description | +
| question | +
+ Text
+ |
+ + | ++ |
Text
mask: string
+ mask: string
placeholder: string
+ placeholder: string
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)
| Name | +Type | +Optional | +Description | +
| name | +
+ string
+ |
+ + | ++ |
| description | +
+ string
+ |
+ + | ++ |
| dependencies | +
+ Dependency[]
+ |
+ + | ++ |
| answer | +
+ string
+ |
+ + | ++ |
| validations | +
+ Validation[]
+ |
+ + | ++ |
| disabled | +
+ boolean
+ |
+ + | ++ |
| _placeholder | +
+ string
+ |
+ + | ++ |
fromJson(question: TextArea)
| Name | +Type | +Optional | +Description | +
| question | +
+ TextArea
+ |
+ + | ++ |
TextArea
placeholder: string
+ placeholder: string
| Name | +Type | +Optional | +Description | +
| _type | +
+ ValidationType
+ |
+ + | ++ |
| _message | +
+ string
+ |
+ + | ++ |
isRequired()
message: string
+ message: string
type: ValidationType
+ type: ValidationType
createValidation(validation: Validation)
| Name | +Type | +Optional | +Description | +
| validation | +
+ Validation
+ |
+ + | ++ |
Validation
createValidationList(validationList: [])
+
+ createValidationList(validationList: Validation[])
| Name | +Type | +Optional | +Description | +
| validationList | +
+ Validation[]
+ |
+ + | ++ |
[]
| Name | +Type | +Optional | +Description | +
| _message | +
+ string
+ |
+ + | ++ |
message: string
+ message: string
name: string
+ name: string
| Name | +Type | +Optional | +Description | +
| validation | +
+ Validation
+ |
+ + | ++ |
createEmailValidator()
createMaxLengthValidator()
createMaxValidator()
createMinLengthValidator()
createMinValidator()
createPatternValidator()
createRequiredValidator()
append(handler: ValidatorFactoryHandler)
| Name | +Type | +Optional | +Description | +
| handler | +
+ ValidatorFactoryHandler
+ |
+ + | ++ |
ValidatorFactoryHandler
handle(validation: Validation)
| Name | +Type | +Optional | +Description | +
| validation | +
+ Validation
+ |
+ + | ++ |
ValidatorFn
| Name | +Type | +Optional | +Description | +
| changeDetectorRef | +
+ ChangeDetectorRef
+ |
+ + | ++ |
| translateService | +
+ TranslateService
+ |
+ + | ++ |
- Type: []
+ Type: Group[]
getAnswers()
getAnswersGroups()
getForm()
hideQuestion(question: Question , formGroup: FormGroup)
| Name | +Type | +Optional | +Description | +
| question | +
+ Question<any>
+ |
+ + | ++ |
| formGroup | +
+ FormGroup
+ |
+ + | ++ |
boolean
+
+ | + + Public isDirty + | +
+
+ isDirty()
+ |
+
|
+ Defined in src/angular-forms.component.ts:216
+ |
+
|
+
+
+ Returns :
+ boolean
+
+ |
+
| + + Public isPristine + | +||||||||||||||||||||||
+
+ isPristine()
+ |
+ ||||||||||||||||||||||
|
+ Defined in src/angular-forms.component.ts:212
+ |
+ ||||||||||||||||||||||
@@ -1172,12 +1321,12 @@
- Public isValid
+ Public isValid
|
- |
Defined in src/angular-forms.component.ts:212
+ Defined in src/angular-forms.component.ts:220
- Public onChangeOptionSelect
+ Public onChangeOptionSelect
|
+ |
+ Parameters :
+
+
+
Returns :
+ void
+
+
| ||||||||||||||||||
| - Public submit + Public submit | ||||||||||||||||||||||
-
+
submit()
|
||||||||||||||||||||||
| - Public formGroup + Public formGroup | ||||||||||||||||||||||
- formGroup: |
||||||||||||||||||||||
| - Public submitted + Public submitted | ||||||||||||||||||||||
- submitted: |
||||||||||||||||||||||
| - Public addData + Public addData | ||||||||||||||||||||||
-
+
addData()
|
||||||||||||||||||||||
| - Public getKeysFromObject + Public getKeysFromObject | ||||||||||||||||||||||
-
+
getKeysFromObject(object: Object)
|
||||||||||||||||||||||
|
+
+ Parameters :
+
+
+
Returns :
+ string[]
+
+
|
||||||||||||||||||||||
| - Public getQuestionByName + Public getQuestionByName | ||||||||||||||||||||||
-
+
getQuestionByName(name: string)
|
||||||||||||||||||||||
|
+
+ Parameters :
+
+
+
Returns :
+ Question<any>
+
+
|
||||||||||||||||||||||
| - Public isCheckbox + Public isCheckbox | ||||||||||||||||||||||
-
+
isCheckbox(question: Question
|
||||||||||||||||||||||
|
+
+ Parameters :
+
+
+
Returns :
+ boolean
+
+
|
||||||||||||||||||||||
| - Public onChangeOptionSelect + Public onChangeOptionSelect | ||||||||||||||||||||||
-
+
onChangeOptionSelect(htmlFormControl: HTMLInputElement, formControl: FormControl, question: Select)
|
||||||||||||||||||||||
|
+
+ Parameters :
+
+
+
Returns :
+ void
+
+
|
||||||||||||||||||||||
| - Public removeData + Public removeData | ||||||||||||||||||||||
-
+
removeData(index: number)
|
||||||||||||||||||||||
|
+
+ Parameters :
+
+
+
Returns :
+ void
+
+
|
||||||||||||||||||||||
| - Public resetForms + Public resetForms | ||||||||||||||||||||||
-
+
resetForms()
|
||||||||||||||||||||||
| - Public formArray + Public formArray | ||||||||||||||||||||||
- formArray: |
||||||||||||||||||||||
| - Public newFormGroup + Public newFormGroup | ||||||||||||||||||||||
- newFormGroup: |
||||||||||||||||||||||
| - Public submitted + Public submitted | ||||||||||||||||||||||
- submitted: |
|
@@ -757,6 +761,12 @@ |||||||||||||||||||||
|
- Defined in demo/demo.component.ts:24
+ Defined in demo/demo.component.ts:28
|
||||||||||||||||||||||
|
+
+ Parameters :
+
+
|
+
isValid()
onChangeOptionSelect(htmlFormControl: HTMLInputElement, formControl: FormControl, question: Select)
getAnswers()
getAnswersGroups()
getForm()
void
+
+ | + + Public isDirty + | +
+
+ isDirty()
+ |
+
|
+ Defined in demo/demo.component.ts:44
+ |
+
|
+
+
+ Returns :
+ void
+
+ |
+
| + + Public isPristine + | +
+
+ isPristine()
+ |
+
|
+ Defined in demo/demo.component.ts:40
|
| - Public isValid + Public isValid |
-
+
isValid()
|
|
- Defined in demo/demo.component.ts:36
+ Defined in demo/demo.component.ts:48
|
| - Public angularForms + Public angularForms |
- angularForms: |
|
- Defined in demo/demo.component.ts:24
+ Defined in demo/demo.component.ts:28
|
| - Public customForm + Public customForm |
- customForm: |
|
- Defined in demo/demo.component.ts:22
+ Defined in demo/demo.component.ts:26
|