Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/vds_ios.git into mbruce/textArea-refactor-entryfield
# Conflicts: # VDS/Components/TextFields/TextArea/TextArea.swift Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
commit
805b0c716c
@ -154,13 +154,13 @@ open class EntryFieldBase: Control, Changeable, FormFieldable {
|
|||||||
open var showError: Bool = false { didSet { setNeedsUpdate() } }
|
open var showError: Bool = false { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
/// Whether or not to show the internal error
|
/// Whether or not to show the internal error
|
||||||
internal var showInternalError: Bool = false { didSet { setNeedsUpdate() } }
|
open internal(set) var hasInternalError: Bool = false { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
/// Override UIControl state to add the .error state if showError is true.
|
/// Override UIControl state to add the .error state if showError is true.
|
||||||
open override var state: UIControl.State {
|
open override var state: UIControl.State {
|
||||||
get {
|
get {
|
||||||
var state = super.state
|
var state = super.state
|
||||||
if showError || showInternalError {
|
if showError || hasInternalError {
|
||||||
state.insert(.error)
|
state.insert(.error)
|
||||||
}
|
}
|
||||||
return state
|
return state
|
||||||
@ -379,7 +379,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open func updateErrorLabel(){
|
open func updateErrorLabel(){
|
||||||
if showError, showInternalError, let errorText, let internalErrorText {
|
if showError, hasInternalError, let errorText, let internalErrorText {
|
||||||
errorLabel.text = [internalErrorText, errorText].joined(separator: "\n")
|
errorLabel.text = [internalErrorText, errorText].joined(separator: "\n")
|
||||||
errorLabel.surface = surface
|
errorLabel.surface = surface
|
||||||
errorLabel.isEnabled = isEnabled
|
errorLabel.isEnabled = isEnabled
|
||||||
@ -397,7 +397,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldable {
|
|||||||
icon.color = VDSColor.paletteBlack
|
icon.color = VDSColor.paletteBlack
|
||||||
icon.surface = surface
|
icon.surface = surface
|
||||||
icon.isHidden = !isEnabled
|
icon.isHidden = !isEnabled
|
||||||
} else if showInternalError, let internalErrorText {
|
} else if hasInternalError, let internalErrorText {
|
||||||
errorLabel.text = internalErrorText
|
errorLabel.text = internalErrorText
|
||||||
errorLabel.surface = surface
|
errorLabel.surface = surface
|
||||||
errorLabel.isEnabled = isEnabled
|
errorLabel.isEnabled = isEnabled
|
||||||
|
|||||||
@ -212,7 +212,7 @@ open class TextArea: EntryFieldBase {
|
|||||||
characterCounterLabel.text = ""
|
characterCounterLabel.text = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
showInternalError = !validator.validate()
|
hasInternalError = !validator.validate()
|
||||||
internalErrorText = validator.errorMessage
|
internalErrorText = validator.errorMessage
|
||||||
|
|
||||||
icon.size = .medium
|
icon.size = .medium
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user