merge
This commit is contained in:
commit
f9cb5f77d9
@ -11,12 +11,14 @@ import UIKit
|
|||||||
public typealias FacadeElements = (fill: UIColor?, text: UIColor?, border: UIColor?)
|
public typealias FacadeElements = (fill: UIColor?, text: UIColor?, border: UIColor?)
|
||||||
|
|
||||||
|
|
||||||
public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWatcherFieldProtocol, EnableableModelProtocol {
|
open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWatcherFieldProtocol, EnableableModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
//Making static property as class property so that subclasses can override getter function of the property
|
||||||
public static var identifier: String = "button"
|
open class var identifier: String {
|
||||||
|
"button"
|
||||||
|
}
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var accessibilityIdentifier: String?
|
public var accessibilityIdentifier: String?
|
||||||
public var title: String
|
public var title: String
|
||||||
@ -247,7 +249,7 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupW
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(title, forKey: .title)
|
try container.encode(title, forKey: .title)
|
||||||
|
|||||||
@ -624,6 +624,9 @@ public typealias ActionBlock = () -> ()
|
|||||||
} else if !MVMCoreGetterUtility.fequal(a: Float(standardFontSize), b: 0.0), let sizeObject = sizeObject ?? MFStyler.sizeObjectGeneric(forCurrentDevice: standardFontSize) {
|
} else if !MVMCoreGetterUtility.fequal(a: Float(standardFontSize), b: 0.0), let sizeObject = sizeObject ?? MFStyler.sizeObjectGeneric(forCurrentDevice: standardFontSize) {
|
||||||
font = font.updateSize(sizeObject.getValueBased(onSize: size))
|
font = font.updateSize(sizeObject.getValueBased(onSize: size))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Provide the label additional size information to help calculate its intrinsic content.
|
||||||
|
preferredMaxLayoutWidth = Styler.maxAvailableLayoutWidth(size: size)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public func setFont(_ font: UIFont, scale: Bool) {
|
@objc public func setFont(_ font: UIFont, scale: Bool) {
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
// Fill for left vertical alignment because bottom constraint was breaking with leading. CXTDT-145456
|
// Fill for left vertical alignment because bottom constraint was breaking with leading. CXTDT-145456
|
||||||
stack = Stack<StackModel>.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .fill)), (view: rightLabel, model: StackItemModel(horizontalAlignment:.fill, verticalAlignment: .leading))], axis: .horizontal)
|
stack = Stack<StackModel>.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .fill)), (view: rightLabel, model: StackItemModel(horizontalAlignment: .trailing, verticalAlignment: .leading))], axis: .horizontal)
|
||||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,6 +37,8 @@
|
|||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
|
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
|
rightLabel.numberOfLines = 1
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,6 @@
|
|||||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
|
|
||||||
/// Padding is a multiple based on the number 4.
|
/// Padding is a multiple based on the number 4.
|
||||||
public struct Padding {
|
public struct Padding {
|
||||||
@ -36,7 +34,7 @@ public struct Padding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static var verticalPaddingForApplicationWidth: CGFloat {
|
public static var verticalPaddingForApplicationWidth: CGFloat {
|
||||||
return MFSizeObject(scalingStandardSize: VerticalMarginSpacing)?.getValueBasedOnApplicationWidth() ?? VerticalMarginSpacing
|
MFSizeObject(scalingStandardSize: VerticalMarginSpacing)?.getValueBasedOnApplicationWidth() ?? VerticalMarginSpacing
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func horizontalPaddingForSize(_ size: CGFloat) -> CGFloat {
|
public static func horizontalPaddingForSize(_ size: CGFloat) -> CGFloat {
|
||||||
@ -46,7 +44,7 @@ public struct Padding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static func verticalPaddingForSize(_ size: CGFloat) -> CGFloat {
|
public static func verticalPaddingForSize(_ size: CGFloat) -> CGFloat {
|
||||||
return MFSizeObject(scalingStandardSize: VerticalMarginSpacing)?.getValueBased(onSize: size) ?? VerticalMarginSpacing
|
MFSizeObject(scalingStandardSize: VerticalMarginSpacing)?.getValueBased(onSize: size) ?? VerticalMarginSpacing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -209,7 +209,14 @@ open class Styler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open class func sizeFontGeneric(forCurrentDevice size: CGFloat) -> CGFloat {
|
open class func sizeFontGeneric(forCurrentDevice size: CGFloat) -> CGFloat {
|
||||||
return sizeObjectGeneric(forCurrentDevice: size)?.getValueBasedOnApplicationWidth() ?? size
|
sizeObjectGeneric(forCurrentDevice: size)?.getValueBasedOnApplicationWidth() ?? size
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provide additional size information to help calculate its intrinsic height.
|
||||||
|
/// - Returns: The available spacing that can be used for intrinsic content width.
|
||||||
|
open class func maxAvailableLayoutWidth(size: CGFloat) -> CGFloat {
|
||||||
|
// The 2 is the product of both sides of padding.
|
||||||
|
size - (Padding.Component.horizontalPaddingForSize(size) * 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user