reverted code in case the isSelected is set directly
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
c2cb8781d6
commit
5e116e3c91
@ -38,6 +38,23 @@ import VDS
|
||||
}
|
||||
}
|
||||
|
||||
/// Disables all selection logic when setting the value of isSelected, reducing it to a stored property.
|
||||
open var updateSelectionOnly: Bool = false
|
||||
|
||||
/**
|
||||
The represented state of the Checkbox.
|
||||
|
||||
Setting updateSelectionOnly to true bypasses the animation logic inherent with setting this property.
|
||||
*/
|
||||
override open var isSelected: Bool {
|
||||
didSet {
|
||||
if !updateSelectionOnly {
|
||||
viewModel.selected = isSelected
|
||||
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//--------------------------------------------------
|
||||
@ -66,16 +83,6 @@ import VDS
|
||||
isSelected = isChecked
|
||||
}
|
||||
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
publisher(for: .valueChanged)
|
||||
.sink { [weak self] control in
|
||||
guard let self, isEnabled else { return }
|
||||
viewModel?.selected = isSelected
|
||||
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
|
||||
}.store(in: &subscribers)
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Actions
|
||||
//--------------------------------------------------
|
||||
@ -136,8 +143,13 @@ import VDS
|
||||
//properties
|
||||
isEnabled = viewModel.enabled && !viewModel.readOnly
|
||||
isAnimated = viewModel.animated
|
||||
isSelected = viewModel.selected
|
||||
|
||||
|
||||
if viewModel.selected {
|
||||
updateSelectionOnly = true
|
||||
isSelected = viewModel.selected
|
||||
updateSelectionOnly = false
|
||||
}
|
||||
|
||||
//events
|
||||
viewModel.updateUI = {
|
||||
MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
|
||||
|
||||
@ -20,21 +20,23 @@ import VDS
|
||||
var fieldValue: JSONValue?
|
||||
var groupName: String?
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Life Cycle
|
||||
//--------------------------------------------------
|
||||
/// Disables all selection logic when setting the value of isSelected, reducing it to a stored property.
|
||||
open var updateSelectionOnly: Bool = false
|
||||
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
|
||||
publisher(for: .valueChanged)
|
||||
.sink { [weak self] control in
|
||||
guard let self, isEnabled else { return }
|
||||
viewModel?.checkbox.selected = isSelected
|
||||
/**
|
||||
The represented state of the Checkbox.
|
||||
|
||||
Setting updateSelectionOnly to true bypasses the animation logic inherent with setting this property.
|
||||
*/
|
||||
override open var isSelected: Bool {
|
||||
didSet {
|
||||
if !updateSelectionOnly {
|
||||
viewModel.checkbox.selected = isSelected
|
||||
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
|
||||
}.store(in: &subscribers)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Atomic
|
||||
//--------------------------------------------------
|
||||
@ -73,8 +75,13 @@ import VDS
|
||||
//properties
|
||||
isAnimated = viewModel.checkbox.animated
|
||||
isEnabled = viewModel.checkbox.enabled && !viewModel.checkbox.readOnly
|
||||
isSelected = viewModel.checkbox.selected
|
||||
|
||||
if viewModel.checkbox.selected {
|
||||
updateSelectionOnly = false
|
||||
isSelected = viewModel.checkbox.selected
|
||||
updateSelectionOnly = true
|
||||
}
|
||||
|
||||
//events
|
||||
viewModel.checkbox.updateUI = {
|
||||
MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
|
||||
|
||||
Loading…
Reference in New Issue
Block a user