From 3fbbe00761a43a45cd8dd5855f72355cd88f6bd6 Mon Sep 17 00:00:00 2001 From: Kruthika KP <> Date: Wed, 19 Feb 2020 15:28:51 +0530 Subject: [PATCH] 19096 - List - Progress Bar - Data - Initial commit --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++ .../LeftVariable/ListProgressBarData.swift | 89 +++++++++++++++++++ .../ListProgressBarDataModel.swift | 55 ++++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 2 + 4 files changed, 154 insertions(+) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListProgressBarData.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListProgressBarDataModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 03743382..0d9eafc8 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -100,6 +100,8 @@ 5248BFED23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */; }; 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */; }; 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */; }; + 8D4B80E623FD332F00CC7B07 /* ListProgressBarDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D4B80E423FD332C00CC7B07 /* ListProgressBarDataModel.swift */; }; + 8D4B80E723FD332F00CC7B07 /* ListProgressBarData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D4B80E523FD332D00CC7B07 /* ListProgressBarData.swift */; }; 9432A79F23DB47BA00719041 /* EntryFieldContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9432A79E23DB47BA00719041 /* EntryFieldContainer.swift */; }; 943784F5236B77BB006A1E82 /* GraphView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943784F3236B77BB006A1E82 /* GraphView.swift */; }; 943784F6236B77BB006A1E82 /* GraphViewAnimationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943784F4236B77BB006A1E82 /* GraphViewAnimationHandler.swift */; }; @@ -424,6 +426,8 @@ 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnPlanDataDividerModel.swift; sourceTree = ""; }; 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaret.swift; sourceTree = ""; }; 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretModel.swift; sourceTree = ""; }; + 8D4B80E423FD332C00CC7B07 /* ListProgressBarDataModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListProgressBarDataModel.swift; sourceTree = ""; }; + 8D4B80E523FD332D00CC7B07 /* ListProgressBarData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListProgressBarData.swift; sourceTree = ""; }; 9402C34F23A2CEA3004B974C /* LeftRightLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftRightLabelModel.swift; sourceTree = ""; }; 9432A79E23DB47BA00719041 /* EntryFieldContainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EntryFieldContainer.swift; sourceTree = ""; }; 943784F3236B77BB006A1E82 /* GraphView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphView.swift; sourceTree = ""; }; @@ -971,6 +975,8 @@ D22B38EB23F4E0AE00490EF6 /* LeftVariable */ = { isa = PBXGroup; children = ( + 8D4B80E523FD332D00CC7B07 /* ListProgressBarData.swift */, + 8D4B80E423FD332C00CC7B07 /* ListProgressBarDataModel.swift */, 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */, 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */, ); @@ -1708,6 +1714,7 @@ D2B18B812360945C00A9AEDC /* View.swift in Sources */, C6FA7D5423C77A4A00A3614A /* NumberedList.swift in Sources */, D29DF26D21E6AA0B003B2FB9 /* FLAnimatedImageView.m in Sources */, + 8D4B80E723FD332F00CC7B07 /* ListProgressBarData.swift in Sources */, 0A7EF86723D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift in Sources */, 94FB966323D797DA003D482B /* MFTextButton.m in Sources */, D260105323CEA61600764D80 /* ToggleModel.swift in Sources */, @@ -1725,6 +1732,7 @@ 0105618F224BBE7700E1557D /* FormValidator+FormParams.swift in Sources */, 01F2A03223A4498200D954D8 /* CaretLinkModel.swift in Sources */, 0A7BAFA1232BE61800FB8E22 /* Checkbox.swift in Sources */, + 8D4B80E623FD332F00CC7B07 /* ListProgressBarDataModel.swift in Sources */, 011B58F023A2AA980085F53C /* ListItemModelProtocol.swift in Sources */, D22479962316AF6E003FCCF9 /* HeadlineBodyLink.swift in Sources */, D29DF2AE21E7B3A4003B2FB9 /* MFTextView.m in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListProgressBarData.swift b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListProgressBarData.swift new file mode 100644 index 00000000..7a57a78b --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListProgressBarData.swift @@ -0,0 +1,89 @@ +// +// ListProgressBarData.swift +// MVMCoreUI +// +// Created by Kruthika KP on 18/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +import UIKit + +@objcMembers public class ListProgressBarData: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + + let progressBar = MultiProgress(frame: .zero) + let leftLabel = Label.commonLabelB1(true) + let rightLabel = Label.commonLabelB1(true) + let view = View() + let horizontalPadding = MFStyler.defaultHorizontalPaddingForApplicationWidth() + + //----------------------------------------------------- + // MARK: - View Lifecycle + //----------------------------------------------------- + + open override func updateView(_ size: CGFloat) { + super.updateView(size) + progressBar.updateView(size) + leftLabel.updateView(size) + rightLabel.updateView(size) + + } + + override open func setupView() { + super.setupView() + guard leftLabel.superview == nil else { + return + } + + contentView.addSubview(view) + view.addSubview(progressBar) + view.addSubview(leftLabel) + view.addSubview(rightLabel) + containerHelper.constrainView(view) + + //constraints + + leftLabel.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true + leftLabel.topAnchor.constraint(equalTo: view.topAnchor).isActive = true + + rightLabel.leadingAnchor.constraint(greaterThanOrEqualTo: leftLabel.trailingAnchor,constant: horizontalPadding).isActive = true + rightLabel.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true + rightLabel.topAnchor.constraint(equalTo: view.topAnchor).isActive = true + + progressBar.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true + progressBar.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true + progressBar.topAnchor.constraint(equalTo: leftLabel.bottomAnchor, constant: PaddingTwo).isActive = true + progressBar.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true + + } + + //---------------------------------------------------- + // MARK: - Molecule + //------------------------------------------------------ + override open func reset() { + super.reset() + progressBar.reset() + leftLabel.reset() + rightLabel.reset() + + } + + public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.setWithModel(model, delegateObject, additionalData) + guard let model = model as? ListProgressBarDataModel else { return} + progressBar.setWithModel(model.progressBar, delegateObject, additionalData) + leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData) + rightLabel.setWithModel(model.rightLabel, delegateObject, additionalData) +} + + public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } + + +} + diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListProgressBarDataModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListProgressBarDataModel.swift new file mode 100644 index 00000000..1b4ccaba --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListProgressBarDataModel.swift @@ -0,0 +1,55 @@ +// +// ListProgressBarDataModel.swift +// MVMCoreUI +// +// Created by Kruthika KP on 18/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListProgressBarDataModel : ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "listPrgBar" + + public var progressBar : MultiProgressBarModel + public var leftLabel: LabelModel + public var rightLabel: LabelModel + + override public func setDefaults() { + super.setDefaults() + + } + + public init (progressBar: MultiProgressBarModel, leftLabel: LabelModel, rightLabel: LabelModel){ + self.progressBar = progressBar + self.leftLabel = leftLabel + self.rightLabel = rightLabel + super.init() + } + + private enum CodingKeys: String, CodingKey{ + case moleculeName + case progressBar + case leftLabel + case rightLabel + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + progressBar = try typeContainer.decode(MultiProgressBarModel.self, forKey: .progressBar) + leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) + rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) + 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(moleculeName, forKey: .moleculeName) + try container.encode(progressBar, forKey: .progressBar) + try container.encode(leftLabel, forKey: .leftLabel) + try container.encode(rightLabel, forKey: .rightLabel) + + } +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index a04f964a..cda35b63 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -78,6 +78,8 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DropDownFilterTableViewCell.self, viewModelClass: DropDownListItemModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: AccordionMoleculeTableViewCell.self, viewModelClass: AccordionListItemModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: TabsTableViewCell.self, viewModelClass: TabsListItemModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListProgressBarData.self, viewModelClass: ListProgressBarDataModel.self) + // Other Items MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeStackItem.self, viewModelClass: MoleculeStackItemModel.self)