added fillContainer to model/view

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-01-30 11:31:06 -06:00
parent e7b9702fd2
commit 7469a5249f
2 changed files with 9 additions and 0 deletions

View File

@ -68,6 +68,7 @@ import VDS
size = viewModel.size
selectedIndex = viewModel.selectedIndex
surface = viewModel.style ?? .light
fillContainer = viewModel.fillContainer
tabModels = viewModel.tabs.compactMap { TabModel(text: $0.label.text) }
}
}

View File

@ -21,6 +21,7 @@ open class TabsModel: MoleculeModelProtocol {
open var orientation: Tabs.Orientation = .horizontal
open var indicatorPosition: Tabs.IndicatorPosition = .bottom
open var overflow: Tabs.Overflow = .scroll
open var fillContainer: Bool = false
open var size: Tabs.Size = .medium
public var backgroundColor: Color?
@ -35,6 +36,7 @@ open class TabsModel: MoleculeModelProtocol {
case selectedIndex
case orientation
case indicatorPosition
case fillContainer
case overflow
case size
case style
@ -49,6 +51,11 @@ open class TabsModel: MoleculeModelProtocol {
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
tabs = try typeContainer.decode([TabItemModel].self, forKey: .tabs)
style = try typeContainer.decodeIfPresent(Surface.self, forKey: .style)
if let fillContainer = try typeContainer.decodeIfPresent(Bool.self, forKey: .fillContainer) {
self.fillContainer = fillContainer
}
if let index = try typeContainer.decodeIfPresent(Int.self, forKey: .selectedIndex) {
selectedIndex = index
}
@ -76,6 +83,7 @@ open class TabsModel: MoleculeModelProtocol {
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(tabs, forKey: .tabs)
try container.encode(selectedIndex, forKey: .selectedIndex)
try container.encode(fillContainer, forKey: .fillContainer)
try container.encodeIfPresent(style, forKey: .style)
try container.encode(orientation, forKey: .orientation)
try container.encode(overflow, forKey: .overflow)