more refactoring

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-05-21 14:44:20 -05:00
parent 522624b403
commit e70d160619

View File

@ -97,16 +97,7 @@ open class InputField: EntryFieldBase {
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true) $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false) $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
}.eraseToAnyColorable() }.eraseToAnyColorable()
open var leftImageView = UIImageView().with {
$0.height(20)
$0.width(32)
$0.isAccessibilityElement = false
$0.translatesAutoresizingMaskIntoConstraints = false
$0.contentMode = .scaleAspectFill
$0.clipsToBounds = true
}
open var actionTextLink = TextLink().with { $0.contentEdgeInsets = .top(-2) } open var actionTextLink = TextLink().with { $0.contentEdgeInsets = .top(-2) }
open var actionTextLinkModel: TextLinkModel? { didSet { setNeedsUpdate() } } open var actionTextLinkModel: TextLinkModel? { didSet { setNeedsUpdate() } }
@ -177,11 +168,10 @@ open class InputField: EntryFieldBase {
//-------------------------------------------------- //--------------------------------------------------
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
open override func setup() { open override func setup() {
super.setup() super.setup()
textField.heightAnchor.constraint(equalToConstant: 20).isActive = true textField.heightAnchor.constraint(equalToConstant: 20).isActive = true
textField.delegate = self textField.delegate = self
mainStackView.addArrangedSubview(successLabel) bottomContainerStackView.insertArrangedSubview(successLabel, at: 0)
mainStackView.setCustomSpacing(8, after: successLabel)
fieldStackView.addArrangedSubview(actionTextLink) fieldStackView.addArrangedSubview(actionTextLink)
@ -194,15 +184,7 @@ open class InputField: EntryFieldBase {
} }
open override func getFieldContainer() -> UIView { open override func getFieldContainer() -> UIView {
// stackview for controls in EntryFieldBase.controlContainerView return textField
let stackView = UIStackView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
$0.axis = .horizontal
$0.spacing = VDSLayout.space3X
}
stackView.addArrangedSubview(leftImageView)
stackView.addArrangedSubview(textField)
return stackView
} }
/// Resets to default settings. /// Resets to default settings.
@ -322,6 +304,7 @@ extension InputField: UITextFieldDelegate {
validate() validate()
} }
sendActions(for: .valueChanged) sendActions(for: .valueChanged)
setNeedsUpdate()
} }
public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {