diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index 62838196..cd68f3c9 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -1090,7 +1090,7 @@ buildSettings = { BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 20; + CURRENT_PROJECT_VERSION = 21; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1123,7 +1123,7 @@ buildSettings = { BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 20; + CURRENT_PROJECT_VERSION = 21; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; diff --git a/VDS/Classes/Control.swift b/VDS/Classes/Control.swift index 0ca1715f..50a10326 100644 --- a/VDS/Classes/Control.swift +++ b/VDS/Classes/Control.swift @@ -43,7 +43,19 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable, UserInfoab open var surface: Surface = .light { didSet { setNeedsUpdate() } } /// 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 open override var isSelected: Bool { didSet { setNeedsUpdate() } } @@ -71,18 +83,18 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable, UserInfoab } } - /// Override to deal with setNeedsUpdate() - open override var isEnabled: Bool { - get { !disabled } - set { - if disabled != !newValue { - disabled = !newValue - } - isUserInteractionEnabled = isEnabled - setNeedsUpdate() - } - } - +// /// Override to deal with setNeedsUpdate() +// open override var isEnabled: Bool { +// get { !disabled } +// set { +// if disabled != !newValue { +// disabled = !newValue +// } +// isUserInteractionEnabled = isEnabled +// setNeedsUpdate() +// } +// } +// //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- diff --git a/VDS/Classes/SelectorBase.swift b/VDS/Classes/SelectorBase.swift index 9ba1066c..2d692f48 100644 --- a/VDS/Classes/SelectorBase.swift +++ b/VDS/Classes/SelectorBase.swift @@ -45,6 +45,8 @@ open class SelectorBase: Control, SelectorControlable { var state = super.state if showError { state.insert(.error) + } else { + state.remove(.error) } return state } diff --git a/VDS/Classes/View.swift b/VDS/Classes/View.swift index 8513bd7e..56dae7bd 100644 --- a/VDS/Classes/View.swift +++ b/VDS/Classes/View.swift @@ -33,19 +33,7 @@ open class View: UIView, Handlerable, ViewProtocol, Resettable, UserInfoable { open var surface: Surface = .light { didSet { setNeedsUpdate() } } /// Control is disabled or not - open var disabled: Bool = false { didSet { isEnabled = !disabled } } - - /// Override to deal with setNeedsUpdate() - open var isEnabled: Bool { - get { !disabled } - set { - if disabled != !newValue { - disabled = !newValue - } - isUserInteractionEnabled = isEnabled - setNeedsUpdate() - } - } + open var disabled: Bool = false { didSet { setNeedsUpdate(); isUserInteractionEnabled = !disabled } } //-------------------------------------------------- // MARK: - Initializers diff --git a/VDS/Components/Buttons/Button/ButtonBase.swift b/VDS/Components/Buttons/Button/ButtonBase.swift index 1e403570..a7f5ca17 100644 --- a/VDS/Components/Buttons/Button/ButtonBase.swift +++ b/VDS/Components/Buttons/Button/ButtonBase.swift @@ -55,8 +55,8 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab 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]() 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 textColor: UIColor { .black } - open override var isEnabled: Bool { - get { !disabled } - set { - if disabled != !newValue { - disabled = !newValue - } - isUserInteractionEnabled = isEnabled - setNeedsUpdate() - } - } - //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index baa0c33a..c88ab853 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -29,8 +29,8 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable { 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 textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }} @@ -39,17 +39,6 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable { 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? { didSet { attributes = nil diff --git a/VDS/Components/TextFields/InputField/InputField.swift b/VDS/Components/TextFields/InputField/InputField.swift index ce2aca7d..ffac7e34 100644 --- a/VDS/Components/TextFields/InputField/InputField.swift +++ b/VDS/Components/TextFields/InputField/InputField.swift @@ -104,7 +104,7 @@ open class InputField: EntryField, UITextFieldDelegate { } 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) }.eraseToAnyColorable() @@ -163,7 +163,7 @@ open class InputField: EntryField, UITextFieldDelegate { open override func updateView() { super.updateView() - textField.isEnabled = isEnabled + textField.isEnabled = !disabled textField.textColor = textFieldTextColorConfiguration.getColor(self) //show error or success diff --git a/VDS/Components/TextFields/TextArea/TextArea.swift b/VDS/Components/TextFields/TextArea/TextArea.swift index c109ea77..31ade50c 100644 --- a/VDS/Components/TextFields/TextArea/TextArea.swift +++ b/VDS/Components/TextFields/TextArea/TextArea.swift @@ -54,7 +54,7 @@ open class TextArea: EntryField { } 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) }.eraseToAnyColorable() @@ -95,7 +95,7 @@ open class TextArea: EntryField { open override func updateView() { super.updateView() - textView.isEditable = isEnabled + textView.isEditable = !disabled textView.textColor = textViewTextColorConfiguration.getColor(self) //set the width constraints diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index b641760d..e12f2220 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,3 +1,8 @@ +1.0.21 +======= +- CXTDT-412383 - Label - Disabled Font color +- CXTDT-420483 - Checkbox - Disabled Label Font Color + 1.0.20 ======= - CXTDT-420885 - CheckboxGroup - Spacing between CheckboxItems