Merge branch 'refactor/enabling' of https://gitlab.verizon.com/BPHV_MIPS/vds_ios.git into refactor/enabling

# Conflicts:
#	VDS/Classes/SelectorGroupHandlerBase.swift
#	VDS/Components/Buttons/Button/ButtonBase.swift
#	VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift
#	VDS/Components/Label/Label.swift
#	VDS/Components/RadioButton/RadioButtonGroup.swift
#	VDS/Components/RadioSwatch/RadioSwatchGroup.swift
#	VDS/Components/TextFields/EntryField/EntryField.swift
#	VDS/Components/Tooltip/TrailingTooltipLabel.swift

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-25 16:20:00 -05:00
commit 52b08b88c9
11 changed files with 14 additions and 23 deletions

View File

@ -33,16 +33,6 @@ open class View: UIView, ViewProtocol, UserInfoable {
/// Current Surface and this is used to pass down to child objects that implement Surfacable /// Current Surface and this is used to pass down to child objects that implement Surfacable
open var surface: Surface = .light { didSet { setNeedsUpdate() } } open var surface: Surface = .light { didSet { setNeedsUpdate() } }
/// 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 var isEnabled: Bool = true { didSet { setNeedsUpdate() } } open var isEnabled: Bool = true { didSet { setNeedsUpdate() } }

View File

@ -83,7 +83,7 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab
} }
} }
} }
/// Whether the Control is enabled or not. /// Whether the Control is enabled or not.
open override var isEnabled: Bool { didSet { setNeedsUpdate() } } open override var isEnabled: Bool { didSet { setNeedsUpdate() } }

View File

@ -110,7 +110,7 @@ open class CheckboxGroup: SelectorGroupHandlerBase<CheckboxItem> {
} }
extension CheckboxGroup { extension CheckboxGroup {
public struct CheckboxModel : Surfaceable, Disabling, Initable, FormFieldable, Errorable { public struct CheckboxModel : Surfaceable, Initable, FormFieldable, Errorable {
/// Whether this object is disabled or not /// Whether this object is disabled or not
public var disabled: Bool public var disabled: Bool

View File

@ -54,7 +54,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
setNeedsUpdate() setNeedsUpdate()
} }
} }
/// Whether the View is enabled or not. /// Whether the View is enabled or not.
open override var isEnabled: Bool { didSet { setNeedsUpdate() } } open override var isEnabled: Bool { didSet { setNeedsUpdate() } }

View File

@ -106,7 +106,7 @@ open class RadioBoxGroup: SelectorGroupSelectedHandlerBase<RadioBoxItem> {
} }
extension RadioBoxGroup { extension RadioBoxGroup {
public struct RadioBoxModel: Surfaceable, Initable, Disabling, FormFieldable { public struct RadioBoxModel: Surfaceable, Initable, FormFieldable {
/// Whether this object is disabled or not /// Whether this object is disabled or not
public var disabled: Bool public var disabled: Bool
/// Current Surface and this is used to pass down to child objects that implement Surfacable /// Current Surface and this is used to pass down to child objects that implement Surfacable

View File

@ -114,7 +114,7 @@ open class RadioButtonGroup: SelectorGroupSelectedHandlerBase<RadioButtonItem> {
} }
extension RadioButtonGroup { extension RadioButtonGroup {
public struct RadioButtonModel: Surfaceable, Disabling, Initable, FormFieldable, Errorable { public struct RadioButtonModel: Surfaceable, Initable, FormFieldable, Errorable {
/// Whether this object is disabled or not /// Whether this object is disabled or not
public var disabled: Bool public var disabled: Bool

View File

@ -71,6 +71,7 @@ open class RadioSwatchGroup: SelectorGroupSelectedHandlerBase<RadioSwatch>, UICo
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Overrides // MARK: - Overrides
//-------------------------------------------------- //--------------------------------------------------
/// Whether this object is disabled or not /// Whether this object is disabled or not
override public var isEnabled: Bool { override public var isEnabled: Bool {
didSet { didSet {
@ -192,7 +193,7 @@ open class RadioSwatchGroup: SelectorGroupSelectedHandlerBase<RadioSwatch>, UICo
} }
extension RadioSwatchGroup { extension RadioSwatchGroup {
public struct RadioSwatchModel: Surfaceable, Disabling, Initable { public struct RadioSwatchModel: Surfaceable, Initable {
/// Whether this object is disabled or not /// Whether this object is disabled or not
public var disabled: Bool = false public var disabled: Bool = false
/// Current Surface and this is used to pass down to child objects that implement Surfacable /// Current Surface and this is used to pass down to child objects that implement Surfacable

View File

@ -302,7 +302,6 @@ open class EntryField: Control, Changeable {
titleLabel.attributes = attributes titleLabel.attributes = attributes
titleLabel.surface = surface titleLabel.surface = surface
titleLabel.isEnabled = isEnabled titleLabel.isEnabled = isEnabled
} }
open func updateErrorLabel(){ open func updateErrorLabel(){

View File

@ -179,6 +179,7 @@ open class Toggle: Control, Changeable {
super.reset() super.reset()
shouldUpdateView = false shouldUpdateView = false
label.reset() label.reset()
isEnabled = true
isOn = false isOn = false
isAnimated = true isAnimated = true
showText = false showText = false

View File

@ -72,7 +72,7 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
label.attributes = labelAttributes label.attributes = labelAttributes
label.surface = surface label.surface = surface
label.isEnabled = isEnabled label.isEnabled = isEnabled
//add tooltip //add tooltip
if let labelText, !labelText.isEmpty { if let labelText, !labelText.isEmpty {
label.addTooltip(model: .init(surface: surface, closeButtonText: tooltipCloseButtonText, title: tooltipTitle, content: tooltipContent, contentView: tooltipContentView)) label.addTooltip(model: .init(surface: surface, closeButtonText: tooltipCloseButtonText, title: tooltipTitle, content: tooltipContent, contentView: tooltipContentView))

View File

@ -7,8 +7,8 @@
import Foundation import Foundation
/// Any object that can be disabled, which may change the appearance ///// Any object that can be disabled, which may change the appearance
public protocol Disabling { //public protocol Disabling {
/// Whether this object is disabled or not // /// Whether this object is disabled or not
var disabled: Bool { get set } // var disabled: Bool { get set }
} //}