Merge branch 'release/11_4_0' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/vds_header_mapping
This commit is contained in:
commit
9b831bfa35
@ -41,16 +41,6 @@ import VDS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Properties Overrides
|
||||
//--------------------------------------------------
|
||||
open override var selectedIndex: Int {
|
||||
didSet {
|
||||
guard let viewModel else { return }
|
||||
viewModel.selectedIndex = selectedIndex
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// MARK: - Layout Views
|
||||
|
||||
@ -17,11 +17,11 @@ import VDS
|
||||
open var viewModel: TwoButtonViewModel!
|
||||
open var delegateObject: MVMCoreUIDelegateObject?
|
||||
open var additionalData: [AnyHashable : Any]?
|
||||
|
||||
|
||||
open var primaryButton = PillButton()
|
||||
open var secondaryButton = PillButton()
|
||||
private var buttonGroup = VDS.ButtonGroup()
|
||||
|
||||
private var heightConstraint: NSLayoutConstraint?
|
||||
//--------------------------------------------------
|
||||
// MARK: - Lifecycle
|
||||
//--------------------------------------------------
|
||||
@ -34,6 +34,7 @@ import VDS
|
||||
buttonGroup.alignment = .center
|
||||
buttonGroup.rowQuantityPhone = 2
|
||||
buttonGroup.rowQuantityTablet = 2
|
||||
heightConstraint = height(constant: VDS.Button.Size.large.height, priority: .required)
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -70,6 +71,8 @@ import VDS
|
||||
if buttons.count != buttonGroup.buttons.count {
|
||||
buttonGroup.buttons = buttons
|
||||
}
|
||||
|
||||
heightConstraint?.constant = primaryButton.size == .small || secondaryButton.size == .small ? VDS.Button.Size.small.height : VDS.Button.Size.large.height
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
||||
@ -55,6 +55,9 @@ open class Carousel: View {
|
||||
/// The view that we use for paging
|
||||
public var pagingView: (MoleculeViewProtocol & CarouselPageControlProtocol)?
|
||||
|
||||
/// The pagingView anchor to the bottom of the carousel. Disabled when the pagingView is hidden.
|
||||
public var pagingBottomPin: NSLayoutConstraint?
|
||||
|
||||
/// If the carousel should loop after scrolling past the first and final cells.
|
||||
public var loop = false
|
||||
|
||||
@ -89,10 +92,10 @@ open class Carousel: View {
|
||||
// Go to current cell. layoutIfNeeded is needed otherwise cellForItem returns nil for peaking logic. The dispatch is a sad way to ensure the collection view is ready to be scrolled.
|
||||
guard let model = model as? CarouselModel, !model.molecules.isEmpty,
|
||||
(model.paging == true || loop == true) else { return }
|
||||
DispatchQueue.main.async {
|
||||
self.collectionView.scrollToItem(at: IndexPath(row: self.currentIndex, section: 0), at: self.itemAlignment, animated: false)
|
||||
self.collectionView.layoutIfNeeded()
|
||||
self.showPeaking(true)
|
||||
DispatchQueue.main.async { [self] in
|
||||
collectionView.scrollToItem(at: IndexPath(row: currentIndex, section: 0), at: itemAlignment, animated: false)
|
||||
collectionView.layoutIfNeeded()
|
||||
showPeaking(true)
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,6 +140,16 @@ open class Carousel: View {
|
||||
(cell as? MVMCoreViewProtocol)?.updateView(size)
|
||||
}
|
||||
layoutCollection()
|
||||
|
||||
// Check must be dispatched to main for the layout to complete in layoutCollection.
|
||||
DispatchQueue.main.async { [self] in
|
||||
let shouldHidePager = molecules?.count ?? 0 < 2 || collectionView.contentSize.width < bounds.width
|
||||
if let pagingView = pagingView, shouldHidePager != pagingView.isHidden {
|
||||
pagingView.isHidden = shouldHidePager
|
||||
pagingBottomPin?.isActive = !shouldHidePager
|
||||
delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -276,7 +289,8 @@ open class Carousel: View {
|
||||
addSubview(pagingView)
|
||||
pagingView.centerXAnchor.constraint(equalTo: collectionView.centerXAnchor).isActive = true
|
||||
collectionView.bottomAnchor.constraint(equalTo: pagingView.centerYAnchor, constant: position).isActive = true
|
||||
bottomAnchor.constraint(greaterThanOrEqualTo: pagingView.bottomAnchor).isActive = true
|
||||
pagingBottomPin = bottomAnchor.constraint(greaterThanOrEqualTo: pagingView.bottomAnchor)
|
||||
pagingBottomPin?.isActive = true
|
||||
bottomPin = bottomAnchor.constraint(equalTo: collectionView.bottomAnchor)
|
||||
bottomPin?.priority = .defaultLow
|
||||
bottomPin?.isActive = true
|
||||
|
||||
Loading…
Reference in New Issue
Block a user