Digital ACT-191 ONEAPP-9311 story: added actions to decrement and increment buttons.
This commit is contained in:
parent
17f9240c7e
commit
6c26655cbb
@ -135,7 +135,10 @@ open class InputStepper: EntryFieldBase {
|
|||||||
super.setup()
|
super.setup()
|
||||||
isAccessibilityElement = false
|
isAccessibilityElement = false
|
||||||
accessibilityLabel = "Input Stepper"
|
accessibilityLabel = "Input Stepper"
|
||||||
containerView.isEnabled = false
|
containerView.isEnabled = false
|
||||||
|
|
||||||
|
decrementButton.onClick = { _ in self.decrementButtonClick() }
|
||||||
|
incrementButton.onClick = { _ in self.incrementButtonClick() }
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func getFieldContainer() -> UIView {
|
open override func getFieldContainer() -> UIView {
|
||||||
@ -160,6 +163,7 @@ open class InputStepper: EntryFieldBase {
|
|||||||
decrementButton.surface = surface
|
decrementButton.surface = surface
|
||||||
incrementButton.surface = surface
|
incrementButton.surface = surface
|
||||||
textLabel.surface = surface
|
textLabel.surface = surface
|
||||||
|
updateButtonStates()
|
||||||
statusIcon.isHidden = true
|
statusIcon.isHidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,6 +183,27 @@ open class InputStepper: EntryFieldBase {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Methods
|
// MARK: - Private Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
internal func decrementButtonClick() {
|
||||||
|
defaultValue = defaultValue - 1
|
||||||
|
updateButtonStates()
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func incrementButtonClick() {
|
||||||
|
defaultValue = defaultValue + 1
|
||||||
|
updateButtonStates()
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func updateButtonStates() {
|
||||||
|
if isReadOnly || !isEnabled {
|
||||||
|
decrementButton.isEnabled = false
|
||||||
|
incrementButton.isEnabled = false
|
||||||
|
} else {
|
||||||
|
decrementButton.isEnabled = defaultValue > _minValue ? true : false
|
||||||
|
incrementButton.isEnabled = defaultValue < _maxValue ? true : false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal func updateSize() {
|
internal func updateSize() {
|
||||||
let value = size == .large ? 6.0 : VDSLayout.space1X
|
let value = size == .large ? 6.0 : VDSLayout.space1X
|
||||||
updateConstraintsToFieldStackView(value: value)
|
updateConstraintsToFieldStackView(value: value)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user