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

This commit is contained in:
Scott Pfeil 2024-03-27 09:14:48 -04:00
commit efbeadf809
5 changed files with 31 additions and 9 deletions

View File

@ -17,9 +17,9 @@ open class TileletModel: MoleculeModelProtocol {
public static var identifier: String = "tilelet"
public var id: String = UUID().uuidString
public var backgroundColor: Color?
public var color: TileContainer.BackgroundColor
public var padding: TileContainer.Padding
public var aspectRatio: TileContainer.AspectRatio
public var color: Tilelet.BackgroundColor
public var padding: Tilelet.Padding
public var aspectRatio: Tilelet.AspectRatio
public var badge: Tilelet.BadgeModel?
public var title: LabelModel?
public var subTitle: LabelModel?
@ -51,9 +51,9 @@ open class TileletModel: MoleculeModelProtocol {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
self.backgroundColor = try container.decodeIfPresent(Color.self, forKey: .backgroundColor)
self.color = try container.decodeIfPresent(TileContainer.BackgroundColor.self, forKey: .color) ?? TileContainer.BackgroundColor.black
self.padding = try container.decodeIfPresent(TileContainer.Padding.self, forKey: .padding) ?? TileContainer.Padding.padding4X
self.aspectRatio = try container.decodeIfPresent(TileContainer.AspectRatio.self, forKey: .aspectRatio) ?? TileContainer.AspectRatio.none
self.color = try container.decodeIfPresent(Tilelet.BackgroundColor.self, forKey: .color) ?? Tilelet.BackgroundColor.black
self.padding = try container.decodeIfPresent(Tilelet.Padding.self, forKey: .padding) ?? Tilelet.Padding.small
self.aspectRatio = try container.decodeIfPresent(Tilelet.AspectRatio.self, forKey: .aspectRatio) ?? Tilelet.AspectRatio.none
self.badge = try container.decodeIfPresent(Tilelet.BadgeModel.self, forKey: .badge)
self.title = try container.decodeIfPresent(LabelModel.self, forKey: .title)
self.subTitle = try container.decodeIfPresent(LabelModel.self, forKey: .subTitle)

View File

@ -25,7 +25,8 @@ extension VDS.Tabs.Overflow: Codable {}
extension VDS.Tabs.Size: Codable {}
extension VDS.TextLink.Size: Codable {}
extension VDS.TextLinkCaret.IconPosition: Codable {}
extension VDS.TileContainer.AspectRatio: Codable {}
extension VDS.TileContainerBase.AspectRatio: Codable {}
extension VDS.Tilelet.Padding: Codable {}
extension VDS.TitleLockup.TextAlignment: Codable {}
extension VDS.Tooltip.FillColor: Codable {}
extension VDS.Tooltip.Size: Codable {}
@ -61,7 +62,7 @@ extension DecodableDefault {
public typealias Surface = Wrapper<Sources.Surface>
}
extension VDS.TileContainer.BackgroundColor: Codable {
extension VDS.TileContainerBase.BackgroundColor: Codable {
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
switch self {

View File

@ -63,6 +63,10 @@ import VDS
//-------------------------------------------------
open func viewModelDidUpdate() {
borderLine = viewModel.borderLine
if let minWidth = viewModel.minWidth {
self.minWidth = minWidth
}
orientation = viewModel.orientation
indicatorPosition = viewModel.indicatorPosition
overflow = viewModel.overflow

View File

@ -23,6 +23,8 @@ open class TabsModel: MoleculeModelProtocol {
open var overflow: Tabs.Overflow = .scroll
open var fillContainer: Bool = false
open var size: Tabs.Size = .medium
open var borderLine: Bool = true
open var minWidth: CGFloat?
public var backgroundColor: Color?
// Must be capped to 0...(tabs.count - 1)
@ -39,6 +41,8 @@ open class TabsModel: MoleculeModelProtocol {
case fillContainer
case overflow
case size
case borderLine
case minWidth
case style
}
@ -75,6 +79,15 @@ open class TabsModel: MoleculeModelProtocol {
if let size = try typeContainer.decodeIfPresent(VDS.Tabs.Size.self, forKey: .orientation) {
self.size = size
}
if let borderLine = try typeContainer.decodeIfPresent(Bool.self, forKey: .borderLine) {
self.borderLine = borderLine
}
if let minWidth = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .minWidth) {
self.minWidth = minWidth
}
}
open func encode(to encoder: Encoder) throws {
@ -89,7 +102,8 @@ open class TabsModel: MoleculeModelProtocol {
try container.encode(overflow, forKey: .overflow)
try container.encode(size, forKey: .size)
try container.encode(indicatorPosition, forKey: .indicatorPosition)
try container.encode(borderLine, forKey: .borderLine)
try container.encodeIfPresent(minWidth, forKey: .minWidth)
}
}

View File

@ -57,6 +57,9 @@ public class TabsListItemModel: ListItemModel, ParentMoleculeModelProtocol {
style = nil
topPadding = 8
bottomPadding = 0
if line == nil {
line = LineModel(type: .none)
}
}
//--------------------------------------------------