Merge branch 'bugfix/dropDownSelect' into 'release/20_1_0'
DropDownSelect update ### Summary fixed issue with EstimatedHeight and delegate callback. ### JIRA Ticket https://onejira.verizon.com/browse/ONEAPP-7135 Co-authored-by: Matt Bruce <matt.bruce@verizon.com> See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/1162
This commit is contained in:
commit
941312dd08
@ -29,17 +29,30 @@ open class ItemDropdownEntryField: VDS.DropdownSelect, VDSMoleculeViewProtocol,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var isEditting: Bool = false
|
private var isEditting: Bool = false
|
||||||
|
|
||||||
|
//override for to deal with getting the
|
||||||
|
//old selectedItem to pass down to the observeDropdownChange
|
||||||
|
open override var selectId: Int? {
|
||||||
|
didSet {
|
||||||
|
guard let observeDropdownChange, let selectedItem else { return }
|
||||||
|
var oldSelectedItem: DropdownOptionModel?
|
||||||
|
if let oldValue {
|
||||||
|
oldSelectedItem = options[oldValue]
|
||||||
|
}
|
||||||
|
observeDropdownChange(oldSelectedItem?.text, selectedItem.text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public var isValid: Bool = true
|
public var isValid: Bool = true
|
||||||
|
|
||||||
/// Closure passed here will run as picker changes items.
|
/// Closure passed here will run as picker changes items.
|
||||||
public var observeDropdownChange: ((String?, String) -> ())?
|
public var observeDropdownChange: ((_ oldValue: String?, _ newValue: String) -> ())?
|
||||||
|
|
||||||
/// Closure passed here will run upon dismissing the selection picker.
|
/// Closure passed here will run upon dismissing the selection picker.
|
||||||
public var observeDropdownSelection: ((String) -> ())?
|
public var observeDropdownSelection: ((_ newValue: String) -> ())?
|
||||||
|
|
||||||
/// When selecting for first responder, allow initial selected value to appear in empty text field.
|
/// When selecting for first responder, allow initial selected value to appear in empty text field.
|
||||||
public var setInitialValueInTextField = true
|
public var setInitialValueInTextField = true
|
||||||
@ -184,7 +197,7 @@ open class ItemDropdownEntryField: VDS.DropdownSelect, VDSMoleculeViewProtocol,
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func updateView(_ size: CGFloat) { }
|
public func updateView(_ size: CGFloat) { }
|
||||||
|
|
||||||
/// Sets the textField with the first value of the available picker data.
|
/// Sets the textField with the first value of the available picker data.
|
||||||
@ -196,7 +209,6 @@ open class ItemDropdownEntryField: VDS.DropdownSelect, VDSMoleculeViewProtocol,
|
|||||||
let pickerIndex = optionsPicker.selectedRow(inComponent: 0)
|
let pickerIndex = optionsPicker.selectedRow(inComponent: 0)
|
||||||
viewModel.selectedIndex = pickerIndex
|
viewModel.selectedIndex = pickerIndex
|
||||||
selectId = pickerIndex
|
selectId = pickerIndex
|
||||||
observeDropdownChange?(selectedItem?.text, pickerData[pickerIndex])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,5 +38,9 @@ extension VDSMoleculeViewProtocol {
|
|||||||
public func update(viewModel: ViewModel){
|
public func update(viewModel: ViewModel){
|
||||||
set(with: viewModel, delegateObject, additionalData)
|
set(with: viewModel, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func updateView(_ size: CGFloat) { }
|
||||||
|
|
||||||
|
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { 44 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user