Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/carousel_fixes

This commit is contained in:
Khan, Arshad 2020-03-10 11:44:19 +05:30
commit d22147106b
4 changed files with 45 additions and 3 deletions

View File

@ -36,6 +36,13 @@ import UIKit
context?.strokePath() context?.strokePath()
} }
open override var intrinsicContentSize: CGSize {
guard let size = titleLabel?.intrinsicContentSize else {
return super.intrinsicContentSize
}
return CGSize(width: size.width, height: size.height + 2)
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - ModelMoleculeViewProtocol // MARK: - ModelMoleculeViewProtocol
//-------------------------------------------------- //--------------------------------------------------
@ -81,6 +88,7 @@ extension Link {
titleLabel?.lineBreakMode = .byTruncatingTail titleLabel?.lineBreakMode = .byTruncatingTail
titleLabel?.textAlignment = .left titleLabel?.textAlignment = .left
contentHorizontalAlignment = .left contentHorizontalAlignment = .left
contentVerticalAlignment = .top
} }
} }

View File

@ -13,5 +13,39 @@ public class RadioButtonModel: MoleculeModelProtocol {
public static var identifier: String = "radioButton" public static var identifier: String = "radioButton"
public var backgroundColor: Color? public var backgroundColor: Color?
public var state: Bool = false public var state: Bool = false
public var enabled: Bool = true
public var fieldKey: String? public var fieldKey: String?
private enum CodingKeys: String, CodingKey {
case moleculeName
case backgroundColor
case state
case enabled
case fieldKey
}
public init(_ state: Bool) {
self.state = state
}
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
if let state = try typeContainer.decodeIfPresent(Bool.self, forKey: .state) {
self.state = state
}
if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) {
self.enabled = enabled
}
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(state, forKey: .state)
try container.encode(enabled, forKey: .enabled)
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
}
} }

View File

@ -49,7 +49,7 @@ public class ToggleModel: MoleculeModelProtocol {
try container.encodeModelIfPresent(action, forKey: .action) try container.encodeModelIfPresent(action, forKey: .action)
try container.encodeModelIfPresent(alternateAction, forKey: .alternateAction) try container.encodeModelIfPresent(alternateAction, forKey: .alternateAction)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(state, forKey: .state) try container.encode(state, forKey: .state)
try container.encodeIfPresent(required, forKey: .required) try container.encodeIfPresent(required, forKey: .required)
try container.encodeIfPresent(fieldKey, forKey: .fieldKey) try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
} }

View File

@ -23,8 +23,8 @@
@"centerMoleculeStack" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeStackCenteredTemplate class]], @"centerMoleculeStack" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeStackCenteredTemplate class]],
@"list" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeListTemplate class]], @"list" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeListTemplate class]],
@"threeLayer" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[ThreeLayerTemplate class]], @"threeLayer" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[ThreeLayerTemplate class]],
@"stackModal" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[ModalMoleculeStackTemplate class]], @"modalStack" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[ModalMoleculeStackTemplate class]],
@"listModal" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[ModalMoleculeListTemplate class]] @"modalList" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[ModalMoleculeListTemplate class]]
} mutableCopy]; } mutableCopy];
}); });
return viewControllerMapping; return viewControllerMapping;