refactored to helpertext to the right
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
d870d4f385
commit
0af79c97b7
@ -92,6 +92,7 @@ open class DropdownSelect: EntryFieldBase {
|
|||||||
// MARK: - Constraints
|
// MARK: - Constraints
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
internal var inlineWidthConstraint: NSLayoutConstraint?
|
internal var inlineWidthConstraint: NSLayoutConstraint?
|
||||||
|
internal var titleLabelWidthConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Configuration Properties
|
// MARK: - Configuration Properties
|
||||||
@ -106,6 +107,10 @@ open class DropdownSelect: EntryFieldBase {
|
|||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
|
||||||
|
titleLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
|
titleLabel.setContentHuggingPriority(.required, for: .horizontal)
|
||||||
|
titleLabelWidthConstraint = titleLabel.width(constant: 0)
|
||||||
|
|
||||||
fieldStackView.isAccessibilityElement = true
|
fieldStackView.isAccessibilityElement = true
|
||||||
fieldStackView.accessibilityLabel = "Dropdown Select"
|
fieldStackView.accessibilityLabel = "Dropdown Select"
|
||||||
inlineDisplayLabel.isAccessibilityElement = true
|
inlineDisplayLabel.isAccessibilityElement = true
|
||||||
@ -305,6 +310,13 @@ open class DropdownSelect: EntryFieldBase {
|
|||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
UIAccessibility.post(notification: .layoutChanged, argument: fieldStackView)
|
UIAccessibility.post(notification: .layoutChanged, argument: fieldStackView)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func layoutSubviews() {
|
||||||
|
super.layoutSubviews()
|
||||||
|
titleLabelWidthConstraint?.constant = containerView.frame.width
|
||||||
|
titleLabelWidthConstraint?.isActive = helperTextPlacement == .right
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -58,6 +58,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
|||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
$0.axis = .vertical
|
$0.axis = .vertical
|
||||||
$0.distribution = .fill
|
$0.distribution = .fill
|
||||||
|
$0.alignment = .leading
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -209,7 +210,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
internal var heightConstraint: NSLayoutConstraint?
|
internal var heightConstraint: NSLayoutConstraint?
|
||||||
internal var widthConstraint: NSLayoutConstraint?
|
internal var widthConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -227,10 +228,10 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
|||||||
|
|
||||||
widthConstraint = containerView.widthAnchor.constraint(equalToConstant: 0)
|
widthConstraint = containerView.widthAnchor.constraint(equalToConstant: 0)
|
||||||
widthConstraint?.priority = .defaultHigh
|
widthConstraint?.priority = .defaultHigh
|
||||||
|
|
||||||
//add the containerView to the middleStack
|
//add the containerView to the middleStack
|
||||||
middleStackView.addArrangedSubview(containerView)
|
middleStackView.addArrangedSubview(containerView)
|
||||||
|
|
||||||
//add ContainerStackView
|
//add ContainerStackView
|
||||||
//this is the horizontal stack that contains
|
//this is the horizontal stack that contains
|
||||||
//the left, InputContainer, Icons, Buttons
|
//the left, InputContainer, Icons, Buttons
|
||||||
|
|||||||
@ -35,7 +35,8 @@ open class InputField: EntryFieldBase {
|
|||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
internal var minWidthConstraint: NSLayoutConstraint?
|
internal var minWidthConstraint: NSLayoutConstraint?
|
||||||
|
internal var titleLabelWidthConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public FieldType Properties
|
// MARK: - Public FieldType Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -167,6 +168,10 @@ open class InputField: EntryFieldBase {
|
|||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
|
||||||
|
titleLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
|
titleLabel.setContentHuggingPriority(.required, for: .horizontal)
|
||||||
|
titleLabelWidthConstraint = titleLabel.width(constant: 0)
|
||||||
|
|
||||||
minWidthConstraint = containerView.widthAnchor.constraint(greaterThanOrEqualToConstant: 0)
|
minWidthConstraint = containerView.widthAnchor.constraint(greaterThanOrEqualToConstant: 0)
|
||||||
minWidthConstraint?.isActive = true
|
minWidthConstraint?.isActive = true
|
||||||
|
|
||||||
@ -275,7 +280,7 @@ open class InputField: EntryFieldBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func updateRules() {
|
override func updateRules() {
|
||||||
super.updateRules()
|
super.updateRules()
|
||||||
fieldType.handler().appendRules(self)
|
fieldType.handler().appendRules(self)
|
||||||
@ -310,6 +315,12 @@ open class InputField: EntryFieldBase {
|
|||||||
set { super.accessibilityElements = newValue }
|
set { super.accessibilityElements = newValue }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func layoutSubviews() {
|
||||||
|
super.layoutSubviews()
|
||||||
|
titleLabelWidthConstraint?.constant = containerView.frame.width
|
||||||
|
titleLabelWidthConstraint?.isActive = helperTextPlacement == .right
|
||||||
|
}
|
||||||
|
|
||||||
open override var canBecomeFirstResponder: Bool { true }
|
open override var canBecomeFirstResponder: Bool { true }
|
||||||
|
|
||||||
open override func resignFirstResponder() -> Bool {
|
open override func resignFirstResponder() -> Bool {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user