Gone changes for the list item

This commit is contained in:
Scott Pfeil 2024-02-22 17:39:36 -05:00
parent 1098584756
commit 8f3bf61574
3 changed files with 7 additions and 1 deletions

View File

@ -6,7 +6,7 @@
// Copyright © 2020 Verizon Wireless. All rights reserved. // Copyright © 2020 Verizon Wireless. All rights reserved.
// //
// A base class that has common list item boilerplate model stuffs. // A base class that has common list item boilerplate model stuffs.
import MVMCore
@objcMembers open class ListItemModel: ContainerModel, ListItemModelProtocol { @objcMembers open class ListItemModel: ContainerModel, ListItemModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
@ -18,6 +18,7 @@
public var hideArrow: Bool? public var hideArrow: Bool?
public var line: LineModel? public var line: LineModel?
public var style: ListItemStyle? public var style: ListItemStyle?
@DecodableDefault.False public var gone: Bool
public var accessibilityTraits: UIAccessibilityTraits? public var accessibilityTraits: UIAccessibilityTraits?
public var accessibilityValue: String? public var accessibilityValue: String?
public var accessibilityText: String? public var accessibilityText: String?

View File

@ -20,6 +20,7 @@ public protocol ListItemModelProtocol: ContainerModelProtocol, AccessibilityMode
var action: ActionModelProtocol? { get set } var action: ActionModelProtocol? { get set }
var hideArrow: Bool? { get set } var hideArrow: Bool? { get set }
var style: ListItemStyle? { get set } var style: ListItemStyle? { get set }
var gone: Bool { get set }
} }
// Not a strict requirement. // Not a strict requirement.

View File

@ -135,6 +135,10 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
} }
} }
public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return (getMoleculeInfo(for: indexPath)?.molecule as? ListItemModelProtocol)?.gone == true ? 0 : UITableView.automaticDimension
}
open func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { open func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
guard let moleculeInfo = getMoleculeInfo(for: indexPath), guard let moleculeInfo = getMoleculeInfo(for: indexPath),
let estimatedHeight = (moleculeInfo.class as? MoleculeViewProtocol.Type)?.estimatedHeight(with: moleculeInfo.molecule, delegateObject() as? MVMCoreUIDelegateObject) let estimatedHeight = (moleculeInfo.class as? MoleculeViewProtocol.Type)?.estimatedHeight(with: moleculeInfo.molecule, delegateObject() as? MVMCoreUIDelegateObject)