@commodo/fields
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -74,10 +74,62 @@ "use strict"; | ||
return false; | ||
}), (0, _repropose.withProps)(props => { | ||
}), (0, _repropose.withProps)(instance => { | ||
const { | ||
setValue, | ||
validate | ||
} = props; | ||
validate, | ||
isDirty, | ||
clean | ||
} = instance; | ||
return { | ||
instanceOf, | ||
isDirty() { | ||
if (isDirty.call(this)) { | ||
return true; | ||
} | ||
if (instance.current === null) { | ||
return false; | ||
} | ||
if (instance.list) { | ||
for (let i = 0; i < instance.current.length; i++) { | ||
let currentElement = instance.current[i]; | ||
if (currentElement.isDirty()) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
return (0, _fields.hasFields)(instance.current) && instance.current.isDirty(); | ||
}, | ||
clean() { | ||
clean.call(this); | ||
if (instance.current === null) { | ||
return this; | ||
} | ||
if (instance.list) { | ||
for (let i = 0; i < instance.current.length; i++) { | ||
let currentElement = instance.current[i]; | ||
if (currentElement.isDirty()) { | ||
currentElement.clean(); | ||
} | ||
} | ||
return this; | ||
} | ||
if (instance.current.isDirty()) { | ||
instance.current.clean(); | ||
} | ||
return this; | ||
}, | ||
setValue(value) { | ||
@@ -84,0 +136,0 @@ if (value === null) { |
{ | ||
"name": "@commodo/fields", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"main": "index.js", | ||
@@ -31,3 +31,3 @@ "repository": { | ||
}, | ||
"gitHead": "5ca5b6c976577b58f5dbed8a5ef97663df6ea004" | ||
"gitHead": "c520a46ef8589ffdd9ce4c34583be5fd6da49671" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67880
741