Digital ACT-191 ONEAPP-7135 story: allowed selectedID to update selected label text

This commit is contained in:
vasavk 2024-04-05 21:36:29 +05:30
parent 5173e5b9c6
commit d0f5f26e82

View File

@ -59,7 +59,7 @@ open class DropdownSelect: Control {
open var required: Bool = false { didSet { setNeedsUpdate() }}
/// Allows unique ID to be passed to the element.
open var selectId: String? { didSet { setNeedsUpdate() }}
open var selectId: Int? { didSet { setNeedsUpdate() }}
/// Config object for tooltip option, is optional.
open var tooltipModel: Tooltip.TooltipModel? { didSet { setNeedsUpdate() } }
@ -357,6 +357,10 @@ open class DropdownSelect: Control {
/// Update width as per updated text size
inlineWidthConstraint = inlineDisplayLabel.widthAnchor.constraint(equalToConstant: inlineDisplayLabel.intrinsicContentSize.width)
inlineWidthConstraint?.isActive = true
if let selectId, selectId < options.count {
updateSelectedOptionLabel(text: options[selectId].text)
}
}
open func updateSelectedOptionLabel(text: String? = nil) {
@ -392,6 +396,7 @@ open class DropdownSelect: Control {
}
@objc open func pickerDoneClicked() {
optionsPicker.isHidden = true
dropdownField.resignFirstResponder()
}