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]?) {
|
||||
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?
|
||||
|
||||
private var delegateObject: MVMCoreUIDelegateObject?
|
||||
var additionalData: [AnyHashable: Any]?
|
||||
|
||||
public var radioBoxModel: RadioBoxModel? {
|
||||
return model as? RadioBoxModel
|
||||
@ -80,6 +81,7 @@ open class RadioBox: Control, MFButtonProtocol {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
guard let model = model as? RadioBoxModel else { return }
|
||||
self.delegateObject = delegateObject
|
||||
self.additionalData = additionalData
|
||||
label.text = model.text
|
||||
subTextLabel.text = model.subText
|
||||
isOutOfStock = model.strikethrough
|
||||
@ -139,7 +141,9 @@ open class RadioBox: Control, MFButtonProtocol {
|
||||
isSelected = true
|
||||
radioBoxModel?.selected = isSelected
|
||||
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()
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ import UIKit
|
||||
public var enabledColor: UIColor = .mvmBlack
|
||||
public var disabledColor: UIColor = .mvmCoolGray3
|
||||
public var delegateObject: MVMCoreUIDelegateObject?
|
||||
var additionalData: [AnyHashable: Any]?
|
||||
|
||||
public var radioModel: RadioButtonModel? {
|
||||
return model as? RadioButtonModel
|
||||
@ -100,7 +101,9 @@ import UIKit
|
||||
isSelected = !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)
|
||||
setNeedsDisplay()
|
||||
@ -158,6 +161,7 @@ import UIKit
|
||||
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
self.delegateObject = delegateObject
|
||||
self.additionalData = additionalData
|
||||
|
||||
guard let model = model as? RadioButtonModel else { return }
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ open class RadioSwatch: Control, MFButtonProtocol {
|
||||
private var maskLayer: CALayer?
|
||||
|
||||
private var delegateObject: MVMCoreUIDelegateObject?
|
||||
var additionalData: [AnyHashable: Any]?
|
||||
|
||||
public var radioSwatchModel: RadioSwatchModel? {
|
||||
return model as? RadioSwatchModel
|
||||
@ -60,6 +61,7 @@ open class RadioSwatch: Control, MFButtonProtocol {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
guard let model = model as? RadioSwatchModel else { return }
|
||||
self.delegateObject = delegateObject
|
||||
self.additionalData = additionalData
|
||||
bottomText.text = model.text
|
||||
isSelected = model.selected
|
||||
isEnabled = model.enabled
|
||||
@ -121,7 +123,9 @@ open class RadioSwatch: Control, MFButtonProtocol {
|
||||
isSelected = true
|
||||
radioSwatchModel?.selected = isSelected
|
||||
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()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user