added parentMoleculeModelProtocol

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-08-22 14:09:48 -05:00
parent 533bcd2dea
commit df1846c295
3 changed files with 12 additions and 14 deletions

View File

@ -10,7 +10,8 @@ import Foundation
import MVMCore import MVMCore
import VDS import VDS
public class CheckboxesModel: MoleculeModelProtocol { public class CheckboxesModel: MoleculeModelProtocol, ParentMoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
@ -30,6 +31,8 @@ public class CheckboxesModel: MoleculeModelProtocol {
public var checkboxes: [CheckboxLabelModel] public var checkboxes: [CheckboxLabelModel]
public var children: [any MoleculeModelProtocol] { checkboxes }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Keys // MARK: - Keys
//-------------------------------------------------- //--------------------------------------------------

View File

@ -8,7 +8,8 @@
import MVMCore import MVMCore
import VDS import VDS
public class RadioBoxesModel: FormFieldModel { public class RadioBoxesModel: FormFieldModel, ParentMoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
@ -17,6 +18,8 @@ public class RadioBoxesModel: FormFieldModel {
public var boxes: [RadioBoxModel] public var boxes: [RadioBoxModel]
public var children: [any MoleculeModelProtocol] { boxes }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Form Validation // MARK: - Form Validation
//-------------------------------------------------- //--------------------------------------------------
@ -74,11 +77,6 @@ public class RadioBoxesModel: FormFieldModel {
guard super.isEqual(to: model), let model = model as? Self else { return false } guard super.isEqual(to: model), let model = model as? Self else { return false }
return boxes == model.boxes return boxes == model.boxes
} }
open override func isVisuallyEquivalent(to model: any MoleculeModelComparisonProtocol) -> Bool {
guard super.isVisuallyEquivalent(to: model), let model = model as? Self else { return false }
return boxes == model.boxes
}
} }
extension Array where Element == RadioBoxModel { extension Array where Element == RadioBoxModel {

View File

@ -10,7 +10,7 @@ import Foundation
import MVMCore import MVMCore
import VDS import VDS
public class RadioButtonsModel: FormFieldModel { public class RadioButtonsModel: FormFieldModel, ParentMoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
@ -19,6 +19,8 @@ public class RadioButtonsModel: FormFieldModel {
public var radioButtons: [RadioButtonLabelModel] public var radioButtons: [RadioButtonLabelModel]
public var children: [any MoleculeModelProtocol] { radioButtons }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Form Validation // MARK: - Form Validation
//-------------------------------------------------- //--------------------------------------------------
@ -72,11 +74,6 @@ public class RadioButtonsModel: FormFieldModel {
open override func isEqual(to model: any ModelComparisonProtocol) -> Bool { open override func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard super.isEqual(to: model), let model = model as? Self else { return false } guard super.isEqual(to: model), let model = model as? Self else { return false }
return radioButtons == radioButtons return radioButtons == model.radioButtons
}
open override func isVisuallyEquivalent(to model: any MoleculeModelComparisonProtocol) -> Bool {
guard super.isVisuallyEquivalent(to: model), let model = model as? Self else { return false }
return radioButtons == radioButtons
} }
} }