File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import deletePropByName from "../utils/delete-prop-by-name";
1414import getPropFromObject from "../utils/get-prop-from-object" ;
1515import { IComparisonResult , searchByComparison , searchChangesByComparison } from "../utils/search-changes-by-comparison" ;
1616import debug from "../debug/debug" ;
17+ import checkNameInObject from "../utils/check-name-in-object" ;
1718
1819export default class Form extends EventEmitter implements FormDependence {
1920 static PROVIDE_NAME = 'form-controller' ;
@@ -130,7 +131,7 @@ export default class Form extends EventEmitter implements FormDependence{
130131 * @description Method check name for including in changes.
131132 * */
132133 checkNameForChangedStatus ( dependenceName : string ) {
133-
134+ return checkNameInObject ( this . changes , dependenceName ) ;
134135 }
135136
136137 /**
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export default class Input extends EventEmitter {
4040 get changed ( ) {
4141 if ( ! this . name ) return false ;
4242 if ( ! this . parentForm ) return false ;
43- return this . parentForm . changed
43+ return this . parentForm . checkNameForChangedStatus ( this . name ) ;
4444 }
4545
4646 /**
Original file line number Diff line number Diff line change 1- import { onUnmounted , reactive , watch } from "vue" ;
1+ import { onUnmounted , reactive } from "vue" ;
22import Input from "../classes/Input" ;
33
44export default function useInputState ( name : string , validation : any [ ] = [ ] ) {
@@ -18,16 +18,19 @@ function useInputController(input: Input) {
1818 const state = reactive < {
1919 value : any ,
2020 disabled : boolean ,
21- errors : string [ ]
21+ errors : string [ ] ,
22+ changed : boolean
2223 } > ( {
2324 value : input . value ,
2425 disabled : input . disabled ,
25- errors : [ ]
26+ errors : [ ] ,
27+ changed : input . changed
2628 } )
2729
2830 const controls = {
2931 change : ( v :any ) => {
3032 state . value = v ;
33+ state . changed = true
3134 } ,
3235 setValues ( v : any ) {
3336 state . value = v ;
You can’t perform that action at this time.
0 commit comments