Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/action_modernize
This commit is contained in:
commit
126c464a92
@ -206,15 +206,14 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
title = try typeContainer.decode(String.self, forKey: .title)
|
title = try typeContainer.decode(String.self, forKey: .title)
|
||||||
action = try typeContainer.decodeModel(codingKey: .action)
|
action = try typeContainer.decodeModel(codingKey: .action)
|
||||||
|
|
||||||
if let style = decoder.context?.value(forKey: CodingKeys.style.stringValue) as? Styler.Button.Style{
|
///Style captured from the JSON
|
||||||
self.style = style
|
|
||||||
setFacade(by: style)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let style = try typeContainer.decodeIfPresent(Styler.Button.Style.self, forKey: .style){
|
if let style = try typeContainer.decodeIfPresent(Styler.Button.Style.self, forKey: .style){
|
||||||
self.style = style
|
self.style = style
|
||||||
setFacade(by: style)
|
setFacade(by: style)
|
||||||
} else {
|
} else if let style = decoder.context?.value(forKey: CodingKeys.style.stringValue) as? Styler.Button.Style { ///Reading the style param from context which is set is molecules, ex: TwoButtonView
|
||||||
|
self.style = style
|
||||||
|
setFacade(by: style)
|
||||||
|
} else { ///Default style
|
||||||
setFacade(by: .primary)
|
setFacade(by: .primary)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,14 +7,15 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import VDSColorTokens
|
||||||
|
import VDSFormControlsTokens
|
||||||
|
|
||||||
@objcMembers open class RadioButton: Control, MFButtonProtocol {
|
@objcMembers open class RadioButton: Control, MFButtonProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public var diameter: CGFloat = 30 {
|
public var diameter: CGFloat = 20 {
|
||||||
didSet { widthConstraint?.constant = diameter }
|
didSet { widthConstraint?.constant = diameter }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,9 +25,12 @@ import UIKit
|
|||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public var enabledColor: UIColor {
|
||||||
public var enabledColor: UIColor = .mvmBlack
|
return radioModel?.inverted ?? false ? VDSFormControlsColor.borderOndark : VDSFormControlsColor.borderOnlight
|
||||||
public var disabledColor: UIColor = .mvmCoolGray3
|
}
|
||||||
|
public var disabledColor: UIColor {
|
||||||
|
return radioModel?.inverted ?? false ? VDSColor.interactiveDisabledOndark : VDSColor.interactiveDisabledOnlight
|
||||||
|
}
|
||||||
public var delegateObject: MVMCoreUIDelegateObject?
|
public var delegateObject: MVMCoreUIDelegateObject?
|
||||||
var additionalData: [AnyHashable: Any]?
|
var additionalData: [AnyHashable: Any]?
|
||||||
|
|
||||||
@ -141,9 +145,9 @@ import UIKit
|
|||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
backgroundColor = .mvmWhite
|
backgroundColor = .clear
|
||||||
clipsToBounds = true
|
clipsToBounds = true
|
||||||
widthConstraint = widthAnchor.constraint(equalToConstant: 30)
|
widthConstraint = widthAnchor.constraint(equalToConstant: 20)
|
||||||
widthConstraint?.isActive = true
|
widthConstraint?.isActive = true
|
||||||
heightConstraint = heightAnchor.constraint(equalTo: widthAnchor, multiplier: 1)
|
heightConstraint = heightAnchor.constraint(equalTo: widthAnchor, multiplier: 1)
|
||||||
heightConstraint?.isActive = true
|
heightConstraint?.isActive = true
|
||||||
@ -169,6 +173,6 @@ import UIKit
|
|||||||
|
|
||||||
public override func reset() {
|
public override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
backgroundColor = .mvmWhite
|
backgroundColor = .clear
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol {
|
|||||||
public var groupName: String = FormValidator.defaultGroupName
|
public var groupName: String = FormValidator.defaultGroupName
|
||||||
public var fieldKey: String?
|
public var fieldKey: String?
|
||||||
public var action: ActionModelProtocol?
|
public var action: ActionModelProtocol?
|
||||||
|
public var inverted: Bool = false
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
@ -44,6 +45,7 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol {
|
|||||||
case groupName
|
case groupName
|
||||||
case action
|
case action
|
||||||
case readOnly
|
case readOnly
|
||||||
|
case inverted
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -94,6 +96,9 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol {
|
|||||||
}
|
}
|
||||||
fieldValue = try typeContainer.decodeIfPresent(String.self, forKey: .fieldValue)
|
fieldValue = try typeContainer.decodeIfPresent(String.self, forKey: .fieldValue)
|
||||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
|
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
|
||||||
|
if let inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) {
|
||||||
|
self.inverted = inverted
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
@ -108,5 +113,6 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol {
|
|||||||
try container.encodeIfPresent(groupName, forKey: .groupName)
|
try container.encodeIfPresent(groupName, forKey: .groupName)
|
||||||
try container.encodeIfPresent(fieldValue, forKey: .fieldValue)
|
try container.encodeIfPresent(fieldValue, forKey: .fieldValue)
|
||||||
try container.encodeModelIfPresent(action, forKey: .action)
|
try container.encodeModelIfPresent(action, forKey: .action)
|
||||||
|
try container.encodeIfPresent(inverted, forKey: .inverted)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,6 +155,9 @@ import VDSColorTokens
|
|||||||
self.additionalData = additionalData
|
self.additionalData = additionalData
|
||||||
selectedIndex = tabsModel?.selectedIndex ?? 0
|
selectedIndex = tabsModel?.selectedIndex ?? 0
|
||||||
selectionLine.backgroundColor = tabsModel?.selectedBarColor.uiColor
|
selectionLine.backgroundColor = tabsModel?.selectedBarColor.uiColor
|
||||||
|
let lineModel = bottomLine.lineModel ?? LineModel(type: .secondary)
|
||||||
|
lineModel.inverted = tabsModel?.style == .dark
|
||||||
|
bottomLine.set(with: lineModel, delegateObject, additionalData)
|
||||||
reloadData()
|
reloadData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -258,6 +261,9 @@ extension Tabs: UICollectionViewDelegateFlowLayout {
|
|||||||
} else if let action = tabsModel.tabs[selectedIndex].action {
|
} else if let action = tabsModel.tabs[selectedIndex].action {
|
||||||
MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: [KeySourceModel: tabsModel], delegateObject:delegateObject)
|
MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: [KeySourceModel: tabsModel], delegateObject:delegateObject)
|
||||||
}
|
}
|
||||||
|
if UIAccessibility.isVoiceOverRunning {
|
||||||
|
UIAccessibility.post(notification: .layoutChanged, argument: tabCell)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -66,7 +66,7 @@ public extension UINavigationController {
|
|||||||
/// Convenience function for setting the navigation bar ui
|
/// Convenience function for setting the navigation bar ui
|
||||||
func setNavigationBarUI(with model: NavigationItemModelProtocol) {
|
func setNavigationBarUI(with model: NavigationItemModelProtocol) {
|
||||||
let navigationBar = navigationBar
|
let navigationBar = navigationBar
|
||||||
let font = MFStyler.fontBoldBodyLarge(false)
|
let font = Styler.Font.BoldTitleSmall.getFont(false)
|
||||||
let backgroundColor = model.backgroundColor?.uiColor
|
let backgroundColor = model.backgroundColor?.uiColor
|
||||||
let tint = model.tintColor.uiColor
|
let tint = model.tintColor.uiColor
|
||||||
navigationBar.tintColor = tint
|
navigationBar.tintColor = tint
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user