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
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,7 @@ 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
|
||||||
|
|
||||||
@ -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