From 2ec963e2b63f25eb05a7180db262e1887f8e7b1f Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 7 Jan 2020 16:08:53 -0500 Subject: [PATCH] latest changes of pr. --- MVMCoreUI/Atoms/TextFields/DigitBox.swift | 9 +++++---- MVMCoreUI/Atoms/TextFields/DigitEntryField.swift | 1 + MVMCoreUI/Atoms/TextFields/ItemDropdownEntryField.swift | 4 +--- MVMCoreUI/Atoms/TextFields/MdnEntryField.swift | 7 +++++-- MVMCoreUI/Atoms/TextFields/TextEntryField.swift | 4 +--- MVMCoreUI/Atoms/Views/DashLine.swift | 2 +- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/MVMCoreUI/Atoms/TextFields/DigitBox.swift b/MVMCoreUI/Atoms/TextFields/DigitBox.swift index 46f17ca6..dc6fc254 100644 --- a/MVMCoreUI/Atoms/TextFields/DigitBox.swift +++ b/MVMCoreUI/Atoms/TextFields/DigitBox.swift @@ -73,7 +73,7 @@ import UIKit private weak var widthConstraint: NSLayoutConstraint? private weak var heightConstraint: NSLayoutConstraint? - private weak var digitFieldHeight: NSLayoutConstraint? +// private weak var digitFieldHeight: NSLayoutConstraint? //-------------------------------------------------- // MARK: - Initializers @@ -108,8 +108,8 @@ import UIKit digitField.delegate = self digitField.didDeleteDelegate = self - digitFieldHeight = digitField.heightAnchor.constraint(equalToConstant: 24) - digitFieldHeight?.isActive = true +// digitFieldHeight = digitField.heightAnchor.constraint(equalToConstant: 24) +// digitFieldHeight?.isActive = true NSLayoutConstraint.activate([ digitField.topAnchor.constraint(equalTo: topAnchor, constant: PaddingOne), @@ -131,7 +131,7 @@ import UIKit let tap = UITapGestureRecognizer(target: self, action: #selector(callTextField)) addGestureRecognizer(tap) - updateView(MVMCoreUISplitViewController.getDetailViewWidth()) + updateView(MVMCoreUIUtility.getWidth()) } @objc public func textFieldDidDelete() { @@ -188,6 +188,7 @@ import UIKit }) sizeObject?.performBlockBase(onSize: size) +// digitFieldHeight?.constant = floor(height * 0.55) widthConstraint?.constant = width heightConstraint?.constant = height digitField.font = MFFonts.mfFont55Rg(pointSize) diff --git a/MVMCoreUI/Atoms/TextFields/DigitEntryField.swift b/MVMCoreUI/Atoms/TextFields/DigitEntryField.swift index 3dd0b014..7ebac501 100644 --- a/MVMCoreUI/Atoms/TextFields/DigitEntryField.swift +++ b/MVMCoreUI/Atoms/TextFields/DigitEntryField.swift @@ -224,6 +224,7 @@ import UIKit self.layoutIfNeeded() } } + setNeedsLayout() } //-------------------------------------------------- diff --git a/MVMCoreUI/Atoms/TextFields/ItemDropdownEntryField.swift b/MVMCoreUI/Atoms/TextFields/ItemDropdownEntryField.swift index 4915f6cc..7eaf6c5c 100644 --- a/MVMCoreUI/Atoms/TextFields/ItemDropdownEntryField.swift +++ b/MVMCoreUI/Atoms/TextFields/ItemDropdownEntryField.swift @@ -17,8 +17,6 @@ open class ItemDropdownEntryField: BaseDropdownEntryField { open var pickerData: [String] = [] open var pickerView: UIPickerView? - open var componentsCount = 1 - /// When selecting for first responder, allow initial selected value to appear in empty text field. public var setInitialValueInTextField = true @@ -98,7 +96,7 @@ open class ItemDropdownEntryField: BaseDropdownEntryField { extension ItemDropdownEntryField: UIPickerViewDelegate, UIPickerViewDataSource { @objc public func numberOfComponents(in pickerView: UIPickerView) -> Int { - return componentsCount + return 1 } @objc public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { diff --git a/MVMCoreUI/Atoms/TextFields/MdnEntryField.swift b/MVMCoreUI/Atoms/TextFields/MdnEntryField.swift index 3612f5a2..1b687a41 100644 --- a/MVMCoreUI/Atoms/TextFields/MdnEntryField.swift +++ b/MVMCoreUI/Atoms/TextFields/MdnEntryField.swift @@ -88,7 +88,7 @@ import MVMCore @objc public func hasValidMDN() -> Bool { - guard let MDN = mdn, !MDN.isEmpty else { return true } + guard let MDN = mdn, MDN.isEmpty else { return false } if isNationalMDN { return MVMCoreUIUtility.validateMDNString(MDN) @@ -99,7 +99,10 @@ import MVMCore @objc public override func validateTextField() -> Bool { - guard !shouldValidateMDN else { return true } + guard !shouldValidateMDN, let MDN = mdn, !MDN.isEmpty else { + isValid = true + return true + } let isValid = hasValidMDN() diff --git a/MVMCoreUI/Atoms/TextFields/TextEntryField.swift b/MVMCoreUI/Atoms/TextFields/TextEntryField.swift index d82da76d..0c004509 100644 --- a/MVMCoreUI/Atoms/TextFields/TextEntryField.swift +++ b/MVMCoreUI/Atoms/TextFields/TextEntryField.swift @@ -79,9 +79,7 @@ import UIKit /// The text of this TextField. open override var text: String? { get { return textField.text } - set { - textField.text = newValue - } + set { textField.text = newValue } } /// Placeholder access for the TextField. diff --git a/MVMCoreUI/Atoms/Views/DashLine.swift b/MVMCoreUI/Atoms/Views/DashLine.swift index 2b887c09..edd911e0 100644 --- a/MVMCoreUI/Atoms/Views/DashLine.swift +++ b/MVMCoreUI/Atoms/Views/DashLine.swift @@ -31,7 +31,7 @@ open class DashLine: View { required public init?(coder: NSCoder) { super.init(coder: coder) -// fatalError("DashLine xib not supported") + fatalError("DashLine xib not supported") } //------------------------------------------------------