Merge branch 'mbruce/bugfix' of https://gitlab.verizon.com/BPHV_MIPS/vds_ios.git into mbruce/bugfix
This commit is contained in:
commit
1647e44e2f
@ -92,12 +92,6 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
||||
}
|
||||
}()
|
||||
|
||||
/// This is the view that will be wrapped with the border for userInteraction.
|
||||
/// The only subview of this view is the fieldStackView
|
||||
internal var containerView = View().with {
|
||||
$0.isAccessibilityElement = true
|
||||
}
|
||||
|
||||
/// This is set by a local method.
|
||||
internal var bottomContainerView: UIView!
|
||||
|
||||
@ -163,6 +157,12 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Properties
|
||||
//--------------------------------------------------
|
||||
/// This is the view that will be wrapped with the border for userInteraction.
|
||||
/// The only subview of this view is the fieldStackView
|
||||
open var containerView = View().with {
|
||||
$0.isAccessibilityElement = true
|
||||
}
|
||||
|
||||
open var onChangeSubscriber: AnyCancellable?
|
||||
|
||||
open var titleLabel = Label().with {
|
||||
@ -186,6 +186,8 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
||||
$0.isAccessibilityElement = true
|
||||
}
|
||||
|
||||
open var useRequiredRule: Bool = true { didSet { setNeedsUpdate() } }
|
||||
|
||||
open var labelText: String? { didSet { setNeedsUpdate() } }
|
||||
|
||||
open var helperText: String? { didSet { setNeedsUpdate() } }
|
||||
@ -453,27 +455,34 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
||||
}
|
||||
|
||||
open func updateErrorLabel(){
|
||||
if showError, let errorText {
|
||||
errorLabel.text = errorText
|
||||
errorLabel.surface = surface
|
||||
errorLabel.isEnabled = isEnabled
|
||||
errorLabel.isHidden = false
|
||||
statusIcon.name = .error
|
||||
statusIcon.surface = surface
|
||||
statusIcon.isHidden = !isEnabled || state.contains(.focused)
|
||||
} else if hasInternalError, let internalErrorText {
|
||||
errorLabel.text = internalErrorText
|
||||
errorLabel.surface = surface
|
||||
errorLabel.isEnabled = isEnabled
|
||||
errorLabel.isHidden = false
|
||||
|
||||
/// always show the errorIcon if there is an error
|
||||
if showError || hasInternalError {
|
||||
statusIcon.name = .error
|
||||
statusIcon.surface = surface
|
||||
statusIcon.isHidden = !isEnabled || state.contains(.focused)
|
||||
} else {
|
||||
statusIcon.isHidden = true
|
||||
errorLabel.isHidden = true
|
||||
}
|
||||
statusIcon.color = iconColorConfiguration.getColor(self)
|
||||
|
||||
// only show errorLabel if there is a message
|
||||
var message: String?
|
||||
if showError, let errorText {
|
||||
message = errorText
|
||||
} else if hasInternalError, let internalErrorText {
|
||||
message = internalErrorText
|
||||
}
|
||||
|
||||
if let message {
|
||||
errorLabel.text = message
|
||||
errorLabel.surface = surface
|
||||
errorLabel.isEnabled = isEnabled
|
||||
errorLabel.isHidden = false
|
||||
} else {
|
||||
errorLabel.isHidden = true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open func updateHelperLabel(){
|
||||
@ -515,7 +524,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
||||
//--------------------------------------------------
|
||||
internal func updateRules() {
|
||||
rules.removeAll()
|
||||
if self.isRequired {
|
||||
if isRequired && useRequiredRule {
|
||||
let rule = RequiredRule()
|
||||
if let errorText, !errorText.isEmpty {
|
||||
rule.errorMessage = errorText
|
||||
|
||||
@ -107,6 +107,9 @@ open class InputField: EntryFieldBase {
|
||||
$0.isAccessibilityElement = false
|
||||
$0.autocorrectionType = .no
|
||||
$0.spellCheckingType = .no
|
||||
$0.smartQuotesType = .no
|
||||
$0.smartDashesType = .no
|
||||
$0.smartInsertDeleteType = .no
|
||||
}
|
||||
|
||||
/// Color configuration for the textField.
|
||||
|
||||
@ -47,6 +47,11 @@ open class TextField: UITextField, ViewProtocol, Errorable {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
/// Set to true to hide the blinking textField cursor.
|
||||
open var hideBlinkingCaret = false
|
||||
open var enableClipboardActions: Bool = true
|
||||
open var onDidDeleteBackwards: (() -> Void)?
|
||||
|
||||
/// Key of whether or not updateView() is called in setNeedsUpdate()
|
||||
open var shouldUpdateView: Bool = true
|
||||
|
||||
@ -209,6 +214,23 @@ open class TextField: UITextField, ViewProtocol, Errorable {
|
||||
return success
|
||||
}
|
||||
|
||||
open override func caretRect(for position: UITextPosition) -> CGRect {
|
||||
|
||||
if hideBlinkingCaret {
|
||||
return .zero
|
||||
}
|
||||
|
||||
let caretRect = super.caretRect(for: position)
|
||||
return CGRect(origin: caretRect.origin, size: CGSize(width: 1, height: caretRect.height))
|
||||
}
|
||||
|
||||
open override func deleteBackward() {
|
||||
super.deleteBackward()
|
||||
onDidDeleteBackwards?()
|
||||
}
|
||||
|
||||
open override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { enableClipboardActions }
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Private Methods
|
||||
//--------------------------------------------------
|
||||
|
||||
@ -111,9 +111,11 @@ open class TextArea: EntryFieldBase {
|
||||
}
|
||||
|
||||
didSet {
|
||||
if textView.isFirstResponder {
|
||||
validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Color configuration for character counter's highlight background color
|
||||
internal var highlightBackgroundColor = ControlColorConfiguration().with {
|
||||
|
||||
@ -45,11 +45,7 @@ open class TextView: UITextView, ViewProtocol, Errorable {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
open var placeholder: String? {
|
||||
didSet {
|
||||
placeholderLabel.text = placeholder
|
||||
}
|
||||
}
|
||||
open var placeholder: String? { didSet { setNeedsUpdate() } }
|
||||
|
||||
open var placeholderLabel = Label().with {
|
||||
$0.textColorConfiguration = ViewColorConfiguration().with {
|
||||
@ -319,8 +315,9 @@ open class TextView: UITextView, ViewProtocol, Errorable {
|
||||
attributedText = nil
|
||||
}
|
||||
placeholderLabel.textStyle = textStyle
|
||||
placeholderLabel.isHidden = !text.isEmpty
|
||||
placeholderLabel.surface = surface
|
||||
placeholderLabel.text = placeholder
|
||||
placeholderLabel.isHidden = !text.isEmpty
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user