diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index e98e8f7e..d978e1b7 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -147,6 +147,8 @@ 8DD1E370243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DD1E36F243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift */; }; 8DDD6C1D244D90B8006A2232 /* ListThreeColumnDataUsage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DDD6C1C244D90B8006A2232 /* ListThreeColumnDataUsage.swift */; }; 8DDD6C1F244D90E1006A2232 /* ListThreeColumnDataUsageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DDD6C1E244D90E1006A2232 /* ListThreeColumnDataUsageModel.swift */; }; + 8DE5BECD2456F7A200772E76 /* ListTwoColumnDropdownSelectorsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE5BECC2456F7A200772E76 /* ListTwoColumnDropdownSelectorsModel.swift */; }; + 8DE5BECF2456F7B100772E76 /* ListTwoColumnDropdownSelectors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE5BECE2456F7B100772E76 /* ListTwoColumnDropdownSelectors.swift */; }; 8DEFA95C243DAC20000D27E5 /* ListThreeColumnDataUsageDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DEFA95B243DAC20000D27E5 /* ListThreeColumnDataUsageDividerModel.swift */; }; 8DEFA95E243DAC2F000D27E5 /* ListThreeColumnDataUsageDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DEFA95D243DAC2F000D27E5 /* ListThreeColumnDataUsageDivider.swift */; }; 942C372E241149170066E45E /* NHaasGroteskDSStd-75Bd.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */; }; @@ -591,6 +593,8 @@ 8DD1E36F243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnInternationalData.swift; sourceTree = ""; }; 8DDD6C1C244D90B8006A2232 /* ListThreeColumnDataUsage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnDataUsage.swift; sourceTree = ""; }; 8DDD6C1E244D90E1006A2232 /* ListThreeColumnDataUsageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnDataUsageModel.swift; sourceTree = ""; }; + 8DE5BECC2456F7A200772E76 /* ListTwoColumnDropdownSelectorsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnDropdownSelectorsModel.swift; sourceTree = ""; }; + 8DE5BECE2456F7B100772E76 /* ListTwoColumnDropdownSelectors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnDropdownSelectors.swift; sourceTree = ""; }; 8DEFA95B243DAC20000D27E5 /* ListThreeColumnDataUsageDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnDataUsageDividerModel.swift; sourceTree = ""; }; 8DEFA95D243DAC2F000D27E5 /* ListThreeColumnDataUsageDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnDataUsageDivider.swift; sourceTree = ""; }; 9402C34F23A2CEA3004B974C /* LeftRightLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftRightLabelModel.swift; sourceTree = ""; }; @@ -1454,6 +1458,8 @@ 526A265D240D200500B0D828 /* ListTwoColumnCompareChanges.swift */, 525239BF2407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift */, 525239C12407BD1000454969 /* ListTwoColumnPriceDetails.swift */, + 8DE5BECC2456F7A200772E76 /* ListTwoColumnDropdownSelectorsModel.swift */, + 8DE5BECE2456F7B100772E76 /* ListTwoColumnDropdownSelectors.swift */, ); path = TwoColumn; sourceTree = ""; @@ -2286,6 +2292,7 @@ 011B58F023A2AA980085F53C /* ListItemModelProtocol.swift in Sources */, D22479962316AF6E003FCCF9 /* HeadlineBodyLink.swift in Sources */, D29DF2AE21E7B3A4003B2FB9 /* MFTextView.m in Sources */, + 8DE5BECD2456F7A200772E76 /* ListTwoColumnDropdownSelectorsModel.swift in Sources */, 0A41BA7F23453A6400D4C0BC /* TextEntryField.swift in Sources */, BB55B51D244482C1002001AD /* ListRightVariablePriceChangeBodyText.swift in Sources */, 017BEB382360C6AC0024EF95 /* RadioButtonLabel.swift in Sources */, @@ -2380,6 +2387,7 @@ D260105F23D0BFFC00764D80 /* StackItem.swift in Sources */, 9432A79F23DB47BA00719041 /* EntryFieldContainer.swift in Sources */, 01EB369323609801006832FA /* HeaderModel.swift in Sources */, + 8DE5BECF2456F7B100772E76 /* ListTwoColumnDropdownSelectors.swift in Sources */, D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */, 0A21DB83235DFBC500C160A2 /* MdnEntryField.swift in Sources */, 0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 464238a7..755dff29 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -149,6 +149,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnDropdownSelectors.self, viewModelClass: ListTwoColumnDropdownSelectorsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnInternationalData.self, viewModelClass: ListThreeColumnInternationalDataModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnDataUsage.self, viewModelClass: ListThreeColumnDataUsageModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectors.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectors.swift new file mode 100644 index 00000000..e5ec022b --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectors.swift @@ -0,0 +1,58 @@ +// +// ListTwoColumnDropdownSelectors.swift +// MVMCoreUI +// +// Created by Kruthika KP on 27/04/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers public class ListTwoColumnDropdownSelectors: TableViewCell { + + //------------------------------------------------------- + // MARK: - Outlets + //------------------------------------------------------- + + let leftDropDown = ItemDropdownEntryField() + let rightDropDown = ItemDropdownEntryField() + var stack: Stack + + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: leftDropDown, model: StackItemModel(percent: 50, horizontalAlignment: .leading)), + (view: rightDropDown, model: StackItemModel(percent: 50, horizontalAlignment: .leading))], + axis: .horizontal) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //------------------------------------------------------- + // MARK: - View Lifecycle + //------------------------------------------------------- + open override func setupView() { + super.setupView() + addMolecule(stack) + stack.restack() + } + //---------------------------------------------------- + // MARK: - Molecule + //------------------------------------------------------ + + override open func reset() { + super.reset() + leftDropDown.reset() + rightDropDown.reset() + } + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListTwoColumnDropdownSelectorsModel else { return} + leftDropDown.set(with:model.leftDropDown, delegateObject, additionalData) + rightDropDown.set(with:model.rightDropDown, delegateObject, additionalData) + + } +} + diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectorsModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectorsModel.swift new file mode 100644 index 00000000..d8ea6223 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectorsModel.swift @@ -0,0 +1,62 @@ +// +// ListTwoColumnDropdownSelectorsModel.swift +// MVMCoreUI +// +// Created by Kruthika KP on 27/04/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListTwoColumnDropdownSelectorsModel: ListItemModel, MoleculeModelProtocol { + + public var divider: LineModel? + public static var identifier: String = "list2CDrpDrp1" + public var leftDropDown: ItemDropdownEntryFieldModel + public var rightDropDown: ItemDropdownEntryFieldModel + + /// Defaults to set + override public func setDefaults() { + if useHorizontalMargins == nil { + useHorizontalMargins = true + } + if useVerticalMargins == nil { + useVerticalMargins = true + } + if topMarginPadding == nil { + topMarginPadding = 24 + } + if bottomMarginPadding == nil { + bottomMarginPadding = 0 + } + } + + public init(leftDropDown : ItemDropdownEntryFieldModel, rightDropDown: ItemDropdownEntryFieldModel){ + self.leftDropDown = leftDropDown + self.rightDropDown = rightDropDown + super.init() + setDefaults() + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case leftDropDown + case rightDropDown + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + leftDropDown = try typeContainer.decode(ItemDropdownEntryFieldModel.self, forKey: .leftDropDown) + rightDropDown = try typeContainer.decode(ItemDropdownEntryFieldModel.self, forKey: .rightDropDown) + try super.init(from: decoder) + } + + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(ListTwoColumnDropdownSelectorsModel.identifier, forKey: .moleculeName) + try container.encode(leftDropDown, forKey: .leftDropDown) + try container.encode(rightDropDown, forKey: .rightDropDown) + } + +}