Merge branch 'develop' into feature/list_leftvariable_radiobutton_alltextlinks
This commit is contained in:
commit
b35fb69e18
@ -402,11 +402,11 @@ public typealias ActionBlock = () -> ()
|
|||||||
attributedString.insert(mutableString, at: imageAtt.location)
|
attributedString.insert(mutableString, at: imageAtt.location)
|
||||||
|
|
||||||
case let fontAtt as LabelAttributeFontModel:
|
case let fontAtt as LabelAttributeFontModel:
|
||||||
if let fontStyle = fontAtt.style?.rawValue {
|
if let fontStyle = fontAtt.style {
|
||||||
let styles = MFStyler.styleGetAttributedString("0", withStyle: fontStyle)
|
|
||||||
attributedString.removeAttribute(.font, range: range)
|
attributedString.removeAttribute(.font, range: range)
|
||||||
attributedString.removeAttribute(.foregroundColor, range: range)
|
attributedString.removeAttribute(.foregroundColor, range: range)
|
||||||
attributedString.addAttributes(styles.attributes(at: 0, effectiveRange: nil), range: range)
|
attributedString.addAttribute(.font, value: fontStyle.getFont(), range: range)
|
||||||
|
attributedString.addAttribute(.foregroundColor, value: fontStyle.color(), range: range)
|
||||||
} else {
|
} else {
|
||||||
let fontSize = fontAtt.size
|
let fontSize = fontAtt.size
|
||||||
var font: UIFont?
|
var font: UIFont?
|
||||||
|
|||||||
@ -10,10 +10,11 @@ import UIKit
|
|||||||
|
|
||||||
/// A collection item that is a container for any molecule.
|
/// A collection item that is a container for any molecule.
|
||||||
open class MoleculeCollectionViewCell: CollectionViewCell {
|
open class MoleculeCollectionViewCell: CollectionViewCell {
|
||||||
|
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let collectionModel = model as? MoleculeCollectionItemModel else { return }
|
guard let collectionModel = model as? MoleculeCollectionItemModel else { return }
|
||||||
|
|
||||||
if molecule == nil {
|
if molecule == nil {
|
||||||
if let moleculeView = MoleculeObjectMapping.shared()?.createMolecule(collectionModel.molecule, delegateObject: delegateObject, additionalData: additionalData) {
|
if let moleculeView = MoleculeObjectMapping.shared()?.createMolecule(collectionModel.molecule, delegateObject: delegateObject, additionalData: additionalData) {
|
||||||
addMolecule(moleculeView)
|
addMolecule(moleculeView)
|
||||||
@ -21,16 +22,15 @@ open class MoleculeCollectionViewCell: CollectionViewCell {
|
|||||||
} else {
|
} else {
|
||||||
molecule?.set(with: collectionModel.molecule, delegateObject, additionalData)
|
molecule?.set(with: collectionModel.molecule, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let molecule = molecule as? (UIView & MVMCoreUIViewConstrainingProtocol) else { return }
|
guard let molecule = molecule as? (UIView & MVMCoreUIViewConstrainingProtocol) else { return }
|
||||||
containerHelper.set(with: collectionModel, for: molecule)
|
containerHelper.set(with: collectionModel, for: molecule)
|
||||||
accessibilityElements = molecule.subviews
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
molecule?.reset()
|
molecule?.reset()
|
||||||
backgroundColor = .white
|
backgroundColor = .mvmWhite
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func nameForReuse(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
open class func nameForReuse(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
open class ModalMoleculeListTemplate: MoleculeListTemplate {
|
open class ModalMoleculeListTemplate: MoleculeListTemplate {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
@ -15,13 +16,20 @@ open class ModalMoleculeListTemplate: MoleculeListTemplate {
|
|||||||
|
|
||||||
public var closeButton: Button?
|
public var closeButton: Button?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Lifecycle
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
override open func handleNewData() {
|
override open func handleNewData() {
|
||||||
super.handleNewData()
|
super.handleNewData()
|
||||||
|
|
||||||
closeButton = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: { _ in
|
closeButton = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: { _ in
|
||||||
MVMCoreNavigationHandler.shared()?.removeCurrentViewController()
|
MVMCoreNavigationHandler.shared()?.removeCurrentViewController()
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func viewDidLayoutSubviews() {
|
||||||
|
super.viewDidLayoutSubviews()
|
||||||
accessibilityElements = [closeButton as Any, tableView as Any]
|
accessibilityElements = [closeButton as Any, tableView as Any]
|
||||||
UIAccessibility.post(notification: .layoutChanged, argument: closeButton)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol {
|
open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Stored Properties
|
// MARK: - Stored Properties
|
||||||
|
|||||||
@ -8,9 +8,13 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
/// A base collection view cell with basic mvm functionality.
|
/// A base collection view cell with basic mvm functionality.
|
||||||
open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCoreViewProtocol, CollectionTemplateItemProtocol {
|
open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCoreViewProtocol, CollectionTemplateItemProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
// Convenience helpers
|
// Convenience helpers
|
||||||
open var molecule: MoleculeViewProtocol?
|
open var molecule: MoleculeViewProtocol?
|
||||||
public let containerHelper = ContainerHelper()
|
public let containerHelper = ContainerHelper()
|
||||||
@ -18,9 +22,13 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
|
|||||||
|
|
||||||
/// The width, used for establishing columns
|
/// The width, used for establishing columns
|
||||||
open var width: CGFloat?
|
open var width: CGFloat?
|
||||||
|
|
||||||
private var initialSetupPerformed = false
|
private var initialSetupPerformed = false
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
// MARK: - Inits
|
// MARK: - Inits
|
||||||
public override init(frame: CGRect) {
|
public override init(frame: CGRect) {
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
@ -39,6 +47,10 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
open func setupView() {
|
open func setupView() {
|
||||||
isAccessibilityElement = false
|
isAccessibilityElement = false
|
||||||
@ -58,15 +70,19 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
|
|||||||
|
|
||||||
open func reset() {
|
open func reset() {
|
||||||
molecule?.reset()
|
molecule?.reset()
|
||||||
backgroundColor = .white
|
backgroundColor = .mvmWhite
|
||||||
width = nil
|
width = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
// MARK: - MoleculeViewProtocol
|
// MARK: - MoleculeViewProtocol
|
||||||
open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let model = model as? CollectionItemModelProtocol else { return }
|
guard let model = model as? CollectionItemModelProtocol else { return }
|
||||||
self.model = model
|
self.model = model
|
||||||
|
|
||||||
if let moleculeModel = model as? MoleculeModelProtocol,
|
if let moleculeModel = model as? MoleculeModelProtocol,
|
||||||
let backgroundColor = moleculeModel.backgroundColor {
|
let backgroundColor = moleculeModel.backgroundColor {
|
||||||
self.backgroundColor = backgroundColor.uiColor
|
self.backgroundColor = backgroundColor.uiColor
|
||||||
@ -84,8 +100,11 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
|
|||||||
containerHelper.constrainView(molecule)
|
containerHelper.constrainView(molecule)
|
||||||
self.molecule = molecule
|
self.molecule = molecule
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
// MARK: - CollectionTemplateItemProtocol
|
// MARK: - CollectionTemplateItemProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func set(width: CGFloat) {
|
public func set(width: CGFloat) {
|
||||||
self.width = width
|
self.width = width
|
||||||
}
|
}
|
||||||
@ -94,11 +113,11 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
|
|||||||
override open func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes {
|
override open func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes {
|
||||||
let autoLayoutAttributes = super.preferredLayoutAttributesFitting(layoutAttributes)
|
let autoLayoutAttributes = super.preferredLayoutAttributesFitting(layoutAttributes)
|
||||||
guard let width = width else { return autoLayoutAttributes }
|
guard let width = width else { return autoLayoutAttributes }
|
||||||
|
|
||||||
let targetSize = CGSize(width: width, height: 0)
|
let targetSize = CGSize(width: width, height: 0)
|
||||||
let newSize = contentView.systemLayoutSizeFitting(targetSize, withHorizontalFittingPriority: UILayoutPriority.required, verticalFittingPriority: UILayoutPriority.defaultLow)
|
let newSize = contentView.systemLayoutSizeFitting(targetSize, withHorizontalFittingPriority: .required, verticalFittingPriority: .defaultLow)
|
||||||
let newFrame = CGRect(origin: autoLayoutAttributes.frame.origin, size: newSize)
|
let newFrame = CGRect(origin: autoLayoutAttributes.frame.origin, size: newSize)
|
||||||
autoLayoutAttributes.frame = newFrame
|
autoLayoutAttributes.frame = newFrame
|
||||||
return autoLayoutAttributes
|
return autoLayoutAttributes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -206,7 +206,6 @@ import UIKit
|
|||||||
caret.translatesAutoresizingMaskIntoConstraints = true
|
caret.translatesAutoresizingMaskIntoConstraints = true
|
||||||
caret.isAccessibilityElement = true
|
caret.isAccessibilityElement = true
|
||||||
caret.accessibilityTraits = .button
|
caret.accessibilityTraits = .button
|
||||||
caret.accessibilityLabel = "Caret,"
|
|
||||||
caret.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint")
|
caret.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint")
|
||||||
caret.size = .small(.vertical)
|
caret.size = .small(.vertical)
|
||||||
if let size = caret.size?.dimensions() {
|
if let size = caret.size?.dimensions() {
|
||||||
|
|||||||
@ -81,6 +81,16 @@ open class Styler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func color() -> UIColor {
|
||||||
|
switch self {
|
||||||
|
case .B3:
|
||||||
|
return .mvmCoolGray6
|
||||||
|
|
||||||
|
default:
|
||||||
|
return .mvmBlack
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Determines if the selected font case is bold or regular.
|
/// Determines if the selected font case is bold or regular.
|
||||||
public func isBold() -> Bool {
|
public func isBold() -> Bool {
|
||||||
|
|
||||||
|
|||||||
@ -248,6 +248,8 @@
|
|||||||
|
|
||||||
// Sets the color
|
// Sets the color
|
||||||
if (color) {
|
if (color) {
|
||||||
|
self.button.layer.borderColor = color.CGColor;
|
||||||
|
[self.button setTitleColor:color forState:UIControlStateNormal];
|
||||||
[self.closeButton setTintColor:color];
|
[self.closeButton setTintColor:color];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user