refactored label to remove disabled.

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-25 15:46:00 -05:00
parent 1b9a2799b2
commit a6a0003c3b
10 changed files with 16 additions and 26 deletions

View File

@ -237,7 +237,7 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
//top label //top label
if let labelText { if let labelText {
label.surface = surface label.surface = surface
label.disabled = disabled label.isEnabled = isEnabled
label.attributes = labelTextAttributes label.attributes = labelTextAttributes
label.text = labelText label.text = labelText
label.isHidden = false label.isHidden = false
@ -252,7 +252,7 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
if let childText { if let childText {
childLabel.text = childText childLabel.text = childText
childLabel.surface = surface childLabel.surface = surface
childLabel.disabled = disabled childLabel.isEnabled = isEnabled
childLabel.attributes = childTextAttributes childLabel.attributes = childTextAttributes
childLabel.isHidden = false childLabel.isHidden = false
@ -276,7 +276,7 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
if let errorText, shouldShowError { if let errorText, shouldShowError {
errorLabel.text = errorText errorLabel.text = errorText
errorLabel.surface = surface errorLabel.surface = surface
errorLabel.disabled = disabled errorLabel.isEnabled = isEnabled
mainStackView.spacing = 8 mainStackView.spacing = 8
errorLabel.isHidden = false errorLabel.isHidden = false
} else { } else {

View File

@ -157,6 +157,6 @@ open class Badge: View {
label.numberOfLines = numberOfLines label.numberOfLines = numberOfLines
label.text = text label.text = text
label.surface = surface label.surface = surface
label.disabled = disabled label.isEnabled = isEnabled
} }
} }

View File

@ -341,7 +341,7 @@ open class BadgeIndicator: View {
label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable() label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
label.text = getText() label.text = getText()
label.surface = surface label.surface = surface
label.disabled = disabled label.isEnabled = isEnabled
label.sizeToFit() label.sizeToFit()
setNeedsLayout() setNeedsLayout()
layoutIfNeeded() layoutIfNeeded()

View File

@ -55,16 +55,6 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
} }
} }
/// Whether this object is disabled or not
open var disabled: Bool {
get { !isEnabled }
set {
if !isEnabled != newValue {
isEnabled = !newValue
}
}
}
/// Whether the View is enabled or not. /// Whether the View is enabled or not.
open override var isEnabled: Bool { didSet { setNeedsUpdate(); isUserInteractionEnabled = isEnabled } } open override var isEnabled: Bool { didSet { setNeedsUpdate(); isUserInteractionEnabled = isEnabled } }
@ -123,7 +113,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
open func reset() { open func reset() {
shouldUpdateView = false shouldUpdateView = false
surface = .light surface = .light
disabled = false isEnabled = true
attributes = nil attributes = nil
textStyle = .defaultStyle textStyle = .defaultStyle
textPosition = .left textPosition = .left

View File

@ -187,14 +187,14 @@ open class RadioBoxItem: Control, Changeable {
//text label //text label
textLabel.text = text textLabel.text = text
textLabel.surface = surface textLabel.surface = surface
textLabel.disabled = disabled textLabel.isEnabled = isEnabled
textLabel.attributes = textAttributes textLabel.attributes = textAttributes
//subText label //subText label
if let subText { if let subText {
subTextLabel.text = subText subTextLabel.text = subText
subTextLabel.surface = surface subTextLabel.surface = surface
subTextLabel.disabled = disabled subTextLabel.isEnabled = isEnabled
subTextLabel.attributes = subTextAttributes subTextLabel.attributes = subTextAttributes
subTextLabel.isHidden = false subTextLabel.isHidden = false
@ -209,7 +209,7 @@ open class RadioBoxItem: Control, Changeable {
if let subTextRight { if let subTextRight {
subTextRightLabel.text = subTextRight subTextRightLabel.text = subTextRight
subTextRightLabel.surface = surface subTextRightLabel.surface = surface
subTextRightLabel.disabled = disabled subTextRightLabel.isEnabled = isEnabled
subTextRightLabel.attributes = subTextRightAttributes subTextRightLabel.attributes = subTextRightAttributes
subTextRightLabel.isHidden = false subTextRightLabel.isHidden = false

View File

@ -132,7 +132,7 @@ open class RadioSwatchGroup: SelectorGroupSelectedHandlerBase<RadioSwatch>, UICo
label.textStyle = .bodySmall label.textStyle = .bodySmall
label.text = selectedHandler?.text ?? " " label.text = selectedHandler?.text ?? " "
label.surface = surface label.surface = surface
label.disabled = disabled label.isEnabled = isEnabled
collectionView.reloadData() collectionView.reloadData()
} }

View File

@ -301,7 +301,7 @@ open class EntryField: Control, Changeable {
titleLabel.text = updatedLabelText titleLabel.text = updatedLabelText
titleLabel.attributes = attributes titleLabel.attributes = attributes
titleLabel.surface = surface titleLabel.surface = surface
titleLabel.disabled = disabled titleLabel.isEnabled = isEnabled
} }
@ -309,7 +309,7 @@ open class EntryField: Control, Changeable {
if showError, let errorText { if showError, let errorText {
errorLabel.text = errorText errorLabel.text = errorText
errorLabel.surface = surface errorLabel.surface = surface
errorLabel.disabled = disabled errorLabel.isEnabled = isEnabled
errorLabel.isHidden = false errorLabel.isHidden = false
icon.name = .error icon.name = .error
icon.color = VDSColor.paletteBlack icon.color = VDSColor.paletteBlack
@ -326,7 +326,7 @@ open class EntryField: Control, Changeable {
if let helperText { if let helperText {
helperLabel.text = helperText helperLabel.text = helperText
helperLabel.surface = surface helperLabel.surface = surface
helperLabel.disabled = disabled helperLabel.isEnabled = isEnabled
helperLabel.isHidden = false helperLabel.isHidden = false
} else { } else {
helperLabel.isHidden = true helperLabel.isHidden = true

View File

@ -175,7 +175,7 @@ open class InputField: EntryField, UITextFieldDelegate {
} else if showSuccess, let successText { } else if showSuccess, let successText {
successLabel.text = successText successLabel.text = successText
successLabel.surface = surface successLabel.surface = surface
successLabel.disabled = disabled successLabel.isEnabled = isEnabled
successLabel.isHidden = false successLabel.isHidden = false
errorLabel.isHidden = true errorLabel.isHidden = true
icon.name = .checkmarkAlt icon.name = .checkmarkAlt

View File

@ -234,7 +234,7 @@ open class Toggle: Control, Changeable {
label.textStyle = textStyle label.textStyle = textStyle
label.text = statusText label.text = statusText
label.surface = surface label.surface = surface
label.disabled = disabled label.isEnabled = isEnabled
switch textPosition { switch textPosition {
case .left: case .left:
NSLayoutConstraint.deactivate(rightConstraints) NSLayoutConstraint.deactivate(rightConstraints)

View File

@ -71,7 +71,7 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
label.textPosition = labelTextPosition label.textPosition = labelTextPosition
label.attributes = labelAttributes label.attributes = labelAttributes
label.surface = surface label.surface = surface
label.disabled = disabled label.isEnabled = isEnabled
//add tooltip //add tooltip
if let labelText, !labelText.isEmpty { if let labelText, !labelText.isEmpty {