Merge branch 'bug/CXTDT-412383-Label' into 'develop'

fixed issues with disabled state overwriting layers.

See merge request BPHV_MIPS/vds_ios!77
This commit is contained in:
Bruce, Matt R 2023-06-07 21:01:43 +00:00
commit 1f6b9fc3f1
9 changed files with 55 additions and 58 deletions

View File

@ -1090,7 +1090,7 @@
buildSettings = { buildSettings = {
BUILD_LIBRARY_FOR_DISTRIBUTION = YES; BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 20; CURRENT_PROJECT_VERSION = 21;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
@ -1123,7 +1123,7 @@
buildSettings = { buildSettings = {
BUILD_LIBRARY_FOR_DISTRIBUTION = YES; BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 20; CURRENT_PROJECT_VERSION = 21;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;

View File

@ -43,7 +43,19 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable, UserInfoab
open var surface: Surface = .light { didSet { setNeedsUpdate() } } open var surface: Surface = .light { didSet { setNeedsUpdate() } }
/// Control is disabled or not /// Control is disabled or not
open var disabled: Bool = false { didSet { isEnabled = !disabled } } open var disabled: Bool = false { didSet { setNeedsUpdate(); isUserInteractionEnabled = !disabled } }
open override var state: UIControl.State {
get {
var state = super.state
if disabled {
state.insert(.disabled)
} else {
state.remove(.disabled)
}
return state
}
}
/// Override for isSelected to handle setNeedsUpdate() on changes /// Override for isSelected to handle setNeedsUpdate() on changes
open override var isSelected: Bool { didSet { setNeedsUpdate() } } open override var isSelected: Bool { didSet { setNeedsUpdate() } }
@ -71,18 +83,18 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable, UserInfoab
} }
} }
/// Override to deal with setNeedsUpdate() // /// Override to deal with setNeedsUpdate()
open override var isEnabled: Bool { // open override var isEnabled: Bool {
get { !disabled } // get { !disabled }
set { // set {
if disabled != !newValue { // if disabled != !newValue {
disabled = !newValue // disabled = !newValue
} // }
isUserInteractionEnabled = isEnabled // isUserInteractionEnabled = isEnabled
setNeedsUpdate() // setNeedsUpdate()
} // }
} // }
//
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializers // MARK: - Initializers
//-------------------------------------------------- //--------------------------------------------------

View File

@ -45,6 +45,8 @@ open class SelectorBase: Control, SelectorControlable {
var state = super.state var state = super.state
if showError { if showError {
state.insert(.error) state.insert(.error)
} else {
state.remove(.error)
} }
return state return state
} }

View File

@ -33,19 +33,7 @@ open class View: UIView, Handlerable, ViewProtocol, Resettable, UserInfoable {
open var surface: Surface = .light { didSet { setNeedsUpdate() } } open var surface: Surface = .light { didSet { setNeedsUpdate() } }
/// Control is disabled or not /// Control is disabled or not
open var disabled: Bool = false { didSet { isEnabled = !disabled } } open var disabled: Bool = false { didSet { setNeedsUpdate(); isUserInteractionEnabled = !disabled } }
/// Override to deal with setNeedsUpdate()
open var isEnabled: Bool {
get { !disabled }
set {
if disabled != !newValue {
disabled = !newValue
}
isUserInteractionEnabled = isEnabled
setNeedsUpdate()
}
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializers // MARK: - Initializers

View File

@ -55,8 +55,8 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
open var surface: Surface = .light { didSet { setNeedsUpdate() }} open var surface: Surface = .light { didSet { setNeedsUpdate() }}
open var disabled: Bool = false { didSet { isEnabled = !disabled } } open var disabled: Bool = false { didSet { setNeedsUpdate(); isUserInteractionEnabled = !disabled } }
open var userInfo = [String: Primitive]() open var userInfo = [String: Primitive]()
public var touchUpInsideCount: Int = 0 public var touchUpInsideCount: Int = 0
@ -80,21 +80,22 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
} }
} }
open override var state: UIControl.State {
get {
var state = super.state
if disabled {
state.insert(.disabled)
} else {
state.remove(.disabled)
}
return state
}
}
open var textStyle: TextStyle { .defaultStyle } open var textStyle: TextStyle { .defaultStyle }
open var textColor: UIColor { .black } open var textColor: UIColor { .black }
open override var isEnabled: Bool {
get { !disabled }
set {
if disabled != !newValue {
disabled = !newValue
}
isUserInteractionEnabled = isEnabled
setNeedsUpdate()
}
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializers // MARK: - Initializers
//-------------------------------------------------- //--------------------------------------------------

View File

@ -29,8 +29,8 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
open var surface: Surface = .light { didSet { setNeedsUpdate() }} open var surface: Surface = .light { didSet { setNeedsUpdate() }}
open var disabled: Bool = false { didSet { isEnabled = !disabled } } open var disabled: Bool = false { didSet { setNeedsUpdate(); isUserInteractionEnabled = !disabled } }
open var attributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }} open var attributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
open var textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }} open var textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }}
@ -39,17 +39,6 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
open var userInfo = [String: Primitive]() open var userInfo = [String: Primitive]()
open override var isEnabled: Bool {
get { !disabled }
set {
if disabled != !newValue {
disabled = !newValue
}
isUserInteractionEnabled = isEnabled
setNeedsUpdate()
}
}
override open var text: String? { override open var text: String? {
didSet { didSet {
attributes = nil attributes = nil

View File

@ -104,7 +104,7 @@ open class InputField: EntryField, UITextFieldDelegate {
} }
public var textFieldTextColorConfiguration: AnyColorable = ViewColorConfiguration().with { public var textFieldTextColorConfiguration: AnyColorable = ViewColorConfiguration().with {
$0.setSurfaceColors(VDSColor.elementsSecondaryOnlight, VDSColor.elementsSecondaryOndark, forDisabled: true) $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false) $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
}.eraseToAnyColorable() }.eraseToAnyColorable()
@ -163,7 +163,7 @@ open class InputField: EntryField, UITextFieldDelegate {
open override func updateView() { open override func updateView() {
super.updateView() super.updateView()
textField.isEnabled = isEnabled textField.isEnabled = !disabled
textField.textColor = textFieldTextColorConfiguration.getColor(self) textField.textColor = textFieldTextColorConfiguration.getColor(self)
//show error or success //show error or success

View File

@ -54,7 +54,7 @@ open class TextArea: EntryField {
} }
public var textViewTextColorConfiguration: AnyColorable = ViewColorConfiguration().with { public var textViewTextColorConfiguration: AnyColorable = ViewColorConfiguration().with {
$0.setSurfaceColors(VDSColor.elementsSecondaryOnlight, VDSColor.elementsSecondaryOndark, forDisabled: true) $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false) $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
}.eraseToAnyColorable() }.eraseToAnyColorable()
@ -95,7 +95,7 @@ open class TextArea: EntryField {
open override func updateView() { open override func updateView() {
super.updateView() super.updateView()
textView.isEditable = isEnabled textView.isEditable = !disabled
textView.textColor = textViewTextColorConfiguration.getColor(self) textView.textColor = textViewTextColorConfiguration.getColor(self)
//set the width constraints //set the width constraints

View File

@ -1,3 +1,8 @@
1.0.21
=======
- CXTDT-412383 - Label - Disabled Font color
- CXTDT-420483 - Checkbox - Disabled Label Font Color
1.0.20 1.0.20
======= =======
- CXTDT-420885 - CheckboxGroup - Spacing between CheckboxItems - CXTDT-420885 - CheckboxGroup - Spacing between CheckboxItems