fix(StatusInput)!: trigger errors bindings (#858)
Change valid to false by default Fixes https://github.com/status-im/status-desktop/issues/6825 BREAKING CHANGE: StatusInput now emits signal for errors change and is invalid by default
This commit is contained in:
parent
f157229e36
commit
2d3e7919f1
|
@ -182,9 +182,9 @@ Item {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty bool StatusBaseInput::valid
|
\qmlproperty bool StatusBaseInput::valid
|
||||||
This property sets the valid state. Default value is true.
|
This property sets the valid state. Default value is false.
|
||||||
*/
|
*/
|
||||||
property bool valid: true
|
property bool valid: false
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty bool StatusBaseInput::pristine
|
\qmlproperty bool StatusBaseInput::pristine
|
||||||
This property sets the pristine. Default value is true.
|
This property sets the pristine. Default value is true.
|
||||||
|
|
|
@ -48,6 +48,7 @@ Item {
|
||||||
This property holds a reference to the TextEdit's valid property.
|
This property holds a reference to the TextEdit's valid property.
|
||||||
*/
|
*/
|
||||||
property alias valid: statusBaseInput.valid
|
property alias valid: statusBaseInput.valid
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty alias StatusInput::pending
|
\qmlproperty alias StatusInput::pending
|
||||||
This property holds a reference to the TextEdit's pending property.
|
This property holds a reference to the TextEdit's pending property.
|
||||||
|
@ -243,7 +244,7 @@ Item {
|
||||||
This function resets the text input validation and text.
|
This function resets the text input validation and text.
|
||||||
*/
|
*/
|
||||||
function reset() {
|
function reset() {
|
||||||
statusBaseInput.valid = true
|
statusBaseInput.valid = false
|
||||||
statusBaseInput.pristine = true
|
statusBaseInput.pristine = true
|
||||||
statusBaseInput.text = ""
|
statusBaseInput.text = ""
|
||||||
root.errorMessage = ""
|
root.errorMessage = ""
|
||||||
|
@ -276,8 +277,12 @@ Item {
|
||||||
valid: result
|
valid: result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.errorMessage = validator.errorMessage
|
|
||||||
errors[validator.name] = result
|
errors[validator.name] = result
|
||||||
|
|
||||||
|
// the only way to trigger bindings for var property
|
||||||
|
errors = errors
|
||||||
|
result.errorMessage = validator.errorMessage
|
||||||
|
|
||||||
statusBaseInput.valid = statusBaseInput.valid && false
|
statusBaseInput.valid = statusBaseInput.valid && false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue