Merge branch 'feature/coding' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/unordered_numbered_list_from_coding

This commit is contained in:
Pfeil, Scott Robert 2020-01-17 14:01:17 -05:00
commit 6aba575703
4 changed files with 9 additions and 9 deletions

View File

@ -149,7 +149,7 @@ open class CaretButton: MFCustomButton, MVMCoreUIMoleculeViewProtocol, MVMCoreUI
}
isEnabled = caretLinkModel.enabled
set(with: caretLinkModel.action, delegateObject: delegateObject, additionalData: additionalData)
setTitle(caretLinkModel.label.text, for: .normal)
setTitle(caretLinkModel.title, for: .normal)
}
public func needsToBeConstrained() -> Bool {

View File

@ -12,20 +12,20 @@ import MVMCore
public class CaretLinkModel: MoleculeProtocol {
public static var identifier: String = "caretLink"
public var backgroundColor: Color?
public var label: LabelModel
public var title: String
public var action: ActionProtocol
public var enabledColor: Color = Color(uiColor: .black)
public var disabledColor: Color? = Color(uiColor: .mfSilver())
public var enabled: Bool = true
public init(label: LabelModel, action: ActionProtocol) {
self.label = label
public init(title: String, action: ActionProtocol) {
self.title = title
self.action = action
}
enum CodingKeys: String, CodingKey {
case backgroundColor
case label
case title
case action
case enabledColor
case disabledColor
@ -35,7 +35,7 @@ public class CaretLinkModel: MoleculeProtocol {
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
label = try typeContainer.decode(LabelModel.self, forKey: .label)
title = try typeContainer.decode(String.self, forKey: .title)
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .enabledColor) {
enabledColor = color
}
@ -50,7 +50,7 @@ public class CaretLinkModel: MoleculeProtocol {
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(label, forKey: .label)
try container.encode(title, forKey: .title)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encodeModel(action, forKey: .action)
try container.encode(enabled, forKey: .enabledColor)

View File

@ -398,7 +398,7 @@ extension Toggle {
changeStateNoAnimation(state)
}
if let actionMap = dictionary.optionalDictionaryForKey("actionMap") {
if let actionMap = dictionary.optionalDictionaryForKey("action") {
didToggleAction = { MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) }
}

View File

@ -93,7 +93,7 @@ import UIKit
viewForButtons.addSubview(secondaryButton)
secondaryButton.widthAnchor.constraint(equalTo: primaryButton.widthAnchor, multiplier: 1).isActive = true
NSLayoutConstraint.constraintPinSubview(primaryButton, pinTop: true, pinBottom: true, pinLeft: true, pinRight: false)
NSLayoutConstraint.constraintPinSubview(secondaryButton, pinTop: false, pinBottom: false, pinLeft: false, pinRight: true)
NSLayoutConstraint.constraintPinSubview(secondaryButton, pinTop: true, pinBottom: false, pinLeft: false, pinRight: true)
let constraint = secondaryButton.leadingAnchor.constraint(equalTo: primaryButton.trailingAnchor, constant: 10)
constraint.priority = UILayoutPriority(900)
constraint.isActive = true