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:
Hedden, Kyle Matthew 2024-08-01 20:35:04 +00:00
commit 941312dd08
2 changed files with 21 additions and 5 deletions

View File

@ -29,17 +29,30 @@ open class ItemDropdownEntryField: VDS.DropdownSelect, VDSMoleculeViewProtocol,
}
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
//--------------------------------------------------
public var isValid: Bool = true
/// 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.
public var observeDropdownSelection: ((String) -> ())?
public var observeDropdownSelection: ((_ newValue: String) -> ())?
/// When selecting for first responder, allow initial selected value to appear in empty text field.
public var setInitialValueInTextField = true
@ -184,7 +197,7 @@ open class ItemDropdownEntryField: VDS.DropdownSelect, VDSMoleculeViewProtocol,
}
}
public func updateView(_ size: CGFloat) { }
/// 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)
viewModel.selectedIndex = pickerIndex
selectId = pickerIndex
observeDropdownChange?(selectedItem?.text, pickerData[pickerIndex])
}
}

View File

@ -38,5 +38,9 @@ extension VDSMoleculeViewProtocol {
public func update(viewModel: ViewModel){
set(with: viewModel, delegateObject, additionalData)
}
public func updateView(_ size: CGFloat) { }
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { 44 }
}