Digital ACT-191 ONEAPP-9311 story: Check the default value and update it to max or min on button icon presses.
This commit is contained in:
parent
29d00ec352
commit
161f690488
@ -142,7 +142,6 @@ open class InputStepper: EntryFieldBase {
|
|||||||
isAccessibilityElement = false
|
isAccessibilityElement = false
|
||||||
accessibilityLabel = "Input Stepper"
|
accessibilityLabel = "Input Stepper"
|
||||||
containerView.isEnabled = false
|
containerView.isEnabled = false
|
||||||
|
|
||||||
decrementButton.onClick = { _ in self.decrementButtonClick() }
|
decrementButton.onClick = { _ in self.decrementButtonClick() }
|
||||||
incrementButton.onClick = { _ in self.incrementButtonClick() }
|
incrementButton.onClick = { _ in self.incrementButtonClick() }
|
||||||
}
|
}
|
||||||
@ -155,7 +154,6 @@ open class InputStepper: EntryFieldBase {
|
|||||||
$0.spacing = VDSLayout.space3X
|
$0.spacing = VDSLayout.space3X
|
||||||
$0.backgroundColor = .clear
|
$0.backgroundColor = .clear
|
||||||
}
|
}
|
||||||
|
|
||||||
controlStackView.addArrangedSubview(decrementButton)
|
controlStackView.addArrangedSubview(decrementButton)
|
||||||
controlStackView.addArrangedSubview(textLabel)
|
controlStackView.addArrangedSubview(textLabel)
|
||||||
controlStackView.addArrangedSubview(incrementButton)
|
controlStackView.addArrangedSubview(incrementButton)
|
||||||
@ -169,8 +167,8 @@ 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
|
||||||
|
updateButtonStates()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
/// Resets to default settings.
|
||||||
@ -189,14 +187,19 @@ open class InputStepper: EntryFieldBase {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Methods
|
// MARK: - Private Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
internal func checkDefaultValue() {
|
||||||
|
defaultValue = defaultValue > _maxValue ? _maxValue : defaultValue < _minValue ? _minValue : defaultValue
|
||||||
|
}
|
||||||
|
|
||||||
internal func decrementButtonClick() {
|
internal func decrementButtonClick() {
|
||||||
defaultValue = defaultValue - 1
|
defaultValue = defaultValue - 1
|
||||||
|
checkDefaultValue()
|
||||||
updateButtonStates()
|
updateButtonStates()
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func incrementButtonClick() {
|
internal func incrementButtonClick() {
|
||||||
defaultValue = defaultValue + 1
|
defaultValue = defaultValue + 1
|
||||||
|
checkDefaultValue()
|
||||||
updateButtonStates()
|
updateButtonStates()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,11 +218,11 @@ open class InputStepper: EntryFieldBase {
|
|||||||
let value = size == .large ? 6.0 : VDSLayout.space1X
|
let value = size == .large ? 6.0 : VDSLayout.space1X
|
||||||
updateConstraintsToFieldStackView(value: value)
|
updateConstraintsToFieldStackView(value: value)
|
||||||
|
|
||||||
// textLabel.textStyle = size == .large ? .boldBodyLarge : .boldBodySmall
|
// textLabel.textStyle = size == .large ? .boldBodyLarge : .boldBodySmall
|
||||||
// textLabel.heightAnchor.constraint(equalToConstant: size == .large ? 44 : 32).activate()
|
// textLabel.heightAnchor.constraint(equalToConstant: size == .large ? 44 : 32).activate()
|
||||||
|
|
||||||
// decrementButton.customContainerSize = size == .large ? 32 : 24
|
// decrementButton.customContainerSize = size == .large ? 32 : 24
|
||||||
// incrementButton.customContainerSize = size == .large ? 32 : 24
|
// incrementButton.customContainerSize = size == .large ? 32 : 24
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user