updated additional data for selectors
This commit is contained in:
parent
9bcd35eee1
commit
b1fb3f075f
@ -397,7 +397,9 @@ import MVMCore
|
|||||||
|
|
||||||
private func performCheckboxAction(with actionModel: ActionModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
private func performCheckboxAction(with actionModel: ActionModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
if let actionMap = actionModel.toJSON() {
|
if let actionMap = actionModel.toJSON() {
|
||||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: checkboxModel?.toJSON(), delegateObject: delegateObject)
|
var additionalDatatoUpdate = additionalData ?? [:]
|
||||||
|
additionalDatatoUpdate[KeySourceModel] = checkboxModel
|
||||||
|
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalDatatoUpdate, delegateObject: delegateObject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ open class RadioBox: Control, MFButtonProtocol {
|
|||||||
public var subTextLabelHeightConstraint: NSLayoutConstraint?
|
public var subTextLabelHeightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
private var delegateObject: MVMCoreUIDelegateObject?
|
private var delegateObject: MVMCoreUIDelegateObject?
|
||||||
|
var additionalData: [AnyHashable: Any]?
|
||||||
|
|
||||||
public var radioBoxModel: RadioBoxModel? {
|
public var radioBoxModel: RadioBoxModel? {
|
||||||
return model as? RadioBoxModel
|
return model as? RadioBoxModel
|
||||||
@ -80,6 +81,7 @@ open class RadioBox: Control, MFButtonProtocol {
|
|||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? RadioBoxModel else { return }
|
guard let model = model as? RadioBoxModel else { return }
|
||||||
self.delegateObject = delegateObject
|
self.delegateObject = delegateObject
|
||||||
|
self.additionalData = additionalData
|
||||||
label.text = model.text
|
label.text = model.text
|
||||||
subTextLabel.text = model.subText
|
subTextLabel.text = model.subText
|
||||||
isOutOfStock = model.strikethrough
|
isOutOfStock = model.strikethrough
|
||||||
@ -139,7 +141,9 @@ open class RadioBox: Control, MFButtonProtocol {
|
|||||||
isSelected = true
|
isSelected = true
|
||||||
radioBoxModel?.selected = isSelected
|
radioBoxModel?.selected = isSelected
|
||||||
if let actionModel = radioBoxModel?.action {
|
if let actionModel = radioBoxModel?.action {
|
||||||
Button.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: radioBoxModel?.toJSON())
|
var additionalData = self.additionalData ?? [:]
|
||||||
|
additionalData[KeySourceModel] = radioBoxModel
|
||||||
|
Button.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
layer.setNeedsDisplay()
|
layer.setNeedsDisplay()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import UIKit
|
|||||||
public var enabledColor: UIColor = .mvmBlack
|
public var enabledColor: UIColor = .mvmBlack
|
||||||
public var disabledColor: UIColor = .mvmCoolGray3
|
public var disabledColor: UIColor = .mvmCoolGray3
|
||||||
public var delegateObject: MVMCoreUIDelegateObject?
|
public var delegateObject: MVMCoreUIDelegateObject?
|
||||||
|
var additionalData: [AnyHashable: Any]?
|
||||||
|
|
||||||
public var radioModel: RadioButtonModel? {
|
public var radioModel: RadioButtonModel? {
|
||||||
return model as? RadioButtonModel
|
return model as? RadioButtonModel
|
||||||
@ -100,7 +101,9 @@ import UIKit
|
|||||||
isSelected = !isSelected
|
isSelected = !isSelected
|
||||||
}
|
}
|
||||||
if let actionModel = radioModel?.action, isSelected {
|
if let actionModel = radioModel?.action, isSelected {
|
||||||
Button.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: radioModel?.toJSON())
|
var additionalData = self.additionalData ?? [:]
|
||||||
|
additionalData[KeySourceModel] = radioModel
|
||||||
|
Button.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
|
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
|
||||||
setNeedsDisplay()
|
setNeedsDisplay()
|
||||||
@ -158,6 +161,7 @@ import UIKit
|
|||||||
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
self.delegateObject = delegateObject
|
self.delegateObject = delegateObject
|
||||||
|
self.additionalData = additionalData
|
||||||
|
|
||||||
guard let model = model as? RadioButtonModel else { return }
|
guard let model = model as? RadioButtonModel else { return }
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@ open class RadioSwatch: Control, MFButtonProtocol {
|
|||||||
private var maskLayer: CALayer?
|
private var maskLayer: CALayer?
|
||||||
|
|
||||||
private var delegateObject: MVMCoreUIDelegateObject?
|
private var delegateObject: MVMCoreUIDelegateObject?
|
||||||
|
var additionalData: [AnyHashable: Any]?
|
||||||
|
|
||||||
public var radioSwatchModel: RadioSwatchModel? {
|
public var radioSwatchModel: RadioSwatchModel? {
|
||||||
return model as? RadioSwatchModel
|
return model as? RadioSwatchModel
|
||||||
@ -60,6 +61,7 @@ open class RadioSwatch: Control, MFButtonProtocol {
|
|||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? RadioSwatchModel else { return }
|
guard let model = model as? RadioSwatchModel else { return }
|
||||||
self.delegateObject = delegateObject
|
self.delegateObject = delegateObject
|
||||||
|
self.additionalData = additionalData
|
||||||
bottomText.text = model.text
|
bottomText.text = model.text
|
||||||
isSelected = model.selected
|
isSelected = model.selected
|
||||||
isEnabled = model.enabled
|
isEnabled = model.enabled
|
||||||
@ -121,7 +123,9 @@ open class RadioSwatch: Control, MFButtonProtocol {
|
|||||||
isSelected = true
|
isSelected = true
|
||||||
radioSwatchModel?.selected = isSelected
|
radioSwatchModel?.selected = isSelected
|
||||||
if let actionModel = radioSwatchModel?.action {
|
if let actionModel = radioSwatchModel?.action {
|
||||||
Button.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: radioSwatchModel?.toJSON())
|
var additionalData = self.additionalData ?? [:]
|
||||||
|
additionalData[KeySourceModel] = radioSwatchModel
|
||||||
|
Button.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
layer.setNeedsDisplay()
|
layer.setNeedsDisplay()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user