Merge branch 'bugfix/CXTDT-530193' into 'release/11_4_0'

CXTDT-530193

### Summary
footerless list template property handling.

### JIRA Ticket
https://onejira.verizon.com/browse/CXTDT-530193

See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/1070
This commit is contained in:
Hedden, Kyle Matthew 2024-03-12 21:03:07 +00:00
commit 91423f87f4
2 changed files with 22 additions and 9 deletions

View File

@ -18,6 +18,8 @@
public var line: LineModel? public var line: LineModel?
public var scrollToRowIndex: Int? public var scrollToRowIndex: Int?
public var singleCellSelection: Bool = false public var singleCellSelection: Bool = false
public var footerlessSpacerHeight: CGFloat?
public var footerlessSpacerColor: Color?
public override var rootMolecules: [MoleculeModelProtocol] { public override var rootMolecules: [MoleculeModelProtocol] {
if let molecules = molecules { if let molecules = molecules {
@ -60,6 +62,8 @@
case line case line
case scrollToRowIndex case scrollToRowIndex
case singleCellSelection case singleCellSelection
case footerlessSpacerHeight
case footerlessSpacerColor
} }
//-------------------------------------------------- //--------------------------------------------------
@ -74,6 +78,8 @@
if let singleCellSelection = try typeContainer.decodeIfPresent(Bool.self, forKey: .singleCellSelection) { if let singleCellSelection = try typeContainer.decodeIfPresent(Bool.self, forKey: .singleCellSelection) {
self.singleCellSelection = singleCellSelection self.singleCellSelection = singleCellSelection
} }
footerlessSpacerColor = try typeContainer.decodeIfPresent(Color.self, forKey: .footerlessSpacerColor)
footerlessSpacerHeight = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .footerlessSpacerHeight)
try super.init(from: decoder) try super.init(from: decoder)
try validateModelHasContent() try validateModelHasContent()
} }
@ -85,5 +91,7 @@
try container.encode(line, forKey: .line) try container.encode(line, forKey: .line)
try container.encode(singleCellSelection, forKey: .singleCellSelection) try container.encode(singleCellSelection, forKey: .singleCellSelection)
try container.encodeIfPresent(scrollToRowIndex, forKey: .scrollToRowIndex) try container.encodeIfPresent(scrollToRowIndex, forKey: .scrollToRowIndex)
try container.encodeIfPresent(footerlessSpacerColor, forKey: .footerlessSpacerColor)
try container.encodeIfPresent(footerlessSpacerHeight, forKey: .footerlessSpacerHeight)
} }
} }

View File

@ -69,16 +69,21 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
return molecule return molecule
} }
override open func viewForBottom() -> UIView { open override func viewForBottom() -> UIView {
guard let footerModel = templateModel?.footer, // If there is a footer molecule return the molecule.
let molecule = generateMoleculeView(from: footerModel) if let footerModel = templateModel?.footer,
else { let molecule = generateMoleculeView(from: footerModel) {
let view = super.viewForBottom() return molecule
view.backgroundColor = templateModel?.backgroundColor?.uiColor ?? .clear
return view
} }
// Otherwise setup a bottom spacer view.
return molecule let view: UIView
if let footerlessSpacerHeight = templateModel?.footerlessSpacerHeight {
view = MVMCoreUICommonViewsUtility.getView(with: footerlessSpacerHeight <= 0.5 ? 0.5 : footerlessSpacerHeight)
} else {
view = super.viewForBottom()
}
view.backgroundColor = templateModel?.footerlessSpacerColor?.uiColor ?? templateModel?.backgroundColor?.uiColor ?? .clear
return view
} }
open override func handleNewData() { open override func handleNewData() {