From d0f5f26e823077b0f6a4d86ab7216f73406118d4 Mon Sep 17 00:00:00 2001 From: vasavk Date: Fri, 5 Apr 2024 21:36:29 +0530 Subject: [PATCH] Digital ACT-191 ONEAPP-7135 story: allowed selectedID to update selected label text --- VDS/Components/DropdownSelect/DropdownSelect.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/VDS/Components/DropdownSelect/DropdownSelect.swift b/VDS/Components/DropdownSelect/DropdownSelect.swift index ec179700..39f182ca 100644 --- a/VDS/Components/DropdownSelect/DropdownSelect.swift +++ b/VDS/Components/DropdownSelect/DropdownSelect.swift @@ -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() }