Merge branch 'feature/atomic-vds-sept2024' into 'develop'
September Atomic/VDS Release ### Summary Added Breadcrumbs and Pagination ### JIRA Ticket - https://onejira.verizon.com/browse/ONEAPP-6827 - https://onejira.verizon.com/browse/ONEAPP-6978 Co-authored-by: Matt Bruce <matt.bruce@verizon.com> See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/1185
This commit is contained in:
commit
00a11cd5dc
@ -602,6 +602,10 @@
|
|||||||
EA7AE5512C74EB4500107C74 /* CalendarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE5502C74EB4500107C74 /* CalendarViewModel.swift */; };
|
EA7AE5512C74EB4500107C74 /* CalendarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE5502C74EB4500107C74 /* CalendarViewModel.swift */; };
|
||||||
EA7AE5532C74F1F600107C74 /* DatePickerEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE5522C74F1F600107C74 /* DatePickerEntryField.swift */; };
|
EA7AE5532C74F1F600107C74 /* DatePickerEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE5522C74F1F600107C74 /* DatePickerEntryField.swift */; };
|
||||||
EA7AE5552C74F20600107C74 /* DatePickerEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE5542C74F20600107C74 /* DatePickerEntryFieldModel.swift */; };
|
EA7AE5552C74F20600107C74 /* DatePickerEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE5542C74F20600107C74 /* DatePickerEntryFieldModel.swift */; };
|
||||||
|
EA7AE55C2C7D18A100107C74 /* BreadcrumbsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE55B2C7D18A100107C74 /* BreadcrumbsModel.swift */; };
|
||||||
|
EA7AE55E2C7D234500107C74 /* Breadcrumbs.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE55D2C7D234500107C74 /* Breadcrumbs.swift */; };
|
||||||
|
EA7AE5602C7E554700107C74 /* PaginationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE55F2C7E554700107C74 /* PaginationModel.swift */; };
|
||||||
|
EA7AE5622C7E555D00107C74 /* Pagination.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE5612C7E555D00107C74 /* Pagination.swift */; };
|
||||||
EA7D81602B2B6E6800D29F9E /* Icon.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7D815F2B2B6E6800D29F9E /* Icon.swift */; };
|
EA7D81602B2B6E6800D29F9E /* Icon.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7D815F2B2B6E6800D29F9E /* Icon.swift */; };
|
||||||
EA7D81622B2B6E7F00D29F9E /* IconModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7D81612B2B6E7F00D29F9E /* IconModel.swift */; };
|
EA7D81622B2B6E7F00D29F9E /* IconModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7D81612B2B6E7F00D29F9E /* IconModel.swift */; };
|
||||||
EA7D81642B2BABCB00D29F9E /* TooltipModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7D81632B2BABCB00D29F9E /* TooltipModel.swift */; };
|
EA7D81642B2BABCB00D29F9E /* TooltipModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7D81632B2BABCB00D29F9E /* TooltipModel.swift */; };
|
||||||
@ -1239,6 +1243,10 @@
|
|||||||
EA7AE5502C74EB4500107C74 /* CalendarViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarViewModel.swift; sourceTree = "<group>"; };
|
EA7AE5502C74EB4500107C74 /* CalendarViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarViewModel.swift; sourceTree = "<group>"; };
|
||||||
EA7AE5522C74F1F600107C74 /* DatePickerEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatePickerEntryField.swift; sourceTree = "<group>"; };
|
EA7AE5522C74F1F600107C74 /* DatePickerEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatePickerEntryField.swift; sourceTree = "<group>"; };
|
||||||
EA7AE5542C74F20600107C74 /* DatePickerEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatePickerEntryFieldModel.swift; sourceTree = "<group>"; };
|
EA7AE5542C74F20600107C74 /* DatePickerEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatePickerEntryFieldModel.swift; sourceTree = "<group>"; };
|
||||||
|
EA7AE55B2C7D18A100107C74 /* BreadcrumbsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbsModel.swift; sourceTree = "<group>"; };
|
||||||
|
EA7AE55D2C7D234500107C74 /* Breadcrumbs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Breadcrumbs.swift; sourceTree = "<group>"; };
|
||||||
|
EA7AE55F2C7E554700107C74 /* PaginationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaginationModel.swift; sourceTree = "<group>"; };
|
||||||
|
EA7AE5612C7E555D00107C74 /* Pagination.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pagination.swift; sourceTree = "<group>"; };
|
||||||
EA7D815F2B2B6E6800D29F9E /* Icon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Icon.swift; sourceTree = "<group>"; };
|
EA7D815F2B2B6E6800D29F9E /* Icon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Icon.swift; sourceTree = "<group>"; };
|
||||||
EA7D81612B2B6E7F00D29F9E /* IconModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconModel.swift; sourceTree = "<group>"; };
|
EA7D81612B2B6E7F00D29F9E /* IconModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconModel.swift; sourceTree = "<group>"; };
|
||||||
EA7D81632B2BABCB00D29F9E /* TooltipModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TooltipModel.swift; sourceTree = "<group>"; };
|
EA7D81632B2BABCB00D29F9E /* TooltipModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TooltipModel.swift; sourceTree = "<group>"; };
|
||||||
@ -2203,6 +2211,7 @@
|
|||||||
D29DF10E21E67A77003B2FB9 /* Molecules */ = {
|
D29DF10E21E67A77003B2FB9 /* Molecules */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
EA7AE55A2C7D188900107C74 /* Breadcrumbs */,
|
||||||
D2EC7BD22527A1E400F540AF /* HeadersAndFooters */,
|
D2EC7BD22527A1E400F540AF /* HeadersAndFooters */,
|
||||||
D2CAC7C9251104CB00C75681 /* TopNotification */,
|
D2CAC7C9251104CB00C75681 /* TopNotification */,
|
||||||
D2509ED42472EE0B001BFB9D /* NavigationBar */,
|
D2509ED42472EE0B001BFB9D /* NavigationBar */,
|
||||||
@ -2364,6 +2373,8 @@
|
|||||||
D20492A524329CE200A5EED6 /* LoadImageView.swift */,
|
D20492A524329CE200A5EED6 /* LoadImageView.swift */,
|
||||||
0A51F3E02475CB73002E08B6 /* LoadingSpinnerModel.swift */,
|
0A51F3E02475CB73002E08B6 /* LoadingSpinnerModel.swift */,
|
||||||
0A51F3E12475CB73002E08B6 /* LoadingSpinner.swift */,
|
0A51F3E12475CB73002E08B6 /* LoadingSpinner.swift */,
|
||||||
|
EA7AE55F2C7E554700107C74 /* PaginationModel.swift */,
|
||||||
|
EA7AE5612C7E555D00107C74 /* Pagination.swift */,
|
||||||
AA37CBD2251907200027344C /* StarsModel.swift */,
|
AA37CBD2251907200027344C /* StarsModel.swift */,
|
||||||
AA37CBD42519072F0027344C /* Stars.swift */,
|
AA37CBD42519072F0027344C /* Stars.swift */,
|
||||||
AA07EA902510A442009A2AE3 /* StarModel.swift */,
|
AA07EA902510A442009A2AE3 /* StarModel.swift */,
|
||||||
@ -2641,6 +2652,15 @@
|
|||||||
path = Alerts;
|
path = Alerts;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
EA7AE55A2C7D188900107C74 /* Breadcrumbs */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
EA7AE55B2C7D18A100107C74 /* BreadcrumbsModel.swift */,
|
||||||
|
EA7AE55D2C7D234500107C74 /* Breadcrumbs.swift */,
|
||||||
|
);
|
||||||
|
path = Breadcrumbs;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
EAA0CFAD275E7D5A00D65EB0 /* FormFieldEffect */ = {
|
EAA0CFAD275E7D5A00D65EB0 /* FormFieldEffect */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -2943,6 +2963,7 @@
|
|||||||
D29DF2CF21E7C104003B2FB9 /* MFLoadingViewController.m in Sources */,
|
D29DF2CF21E7C104003B2FB9 /* MFLoadingViewController.m in Sources */,
|
||||||
D28A837B23C928DA00DFE4FC /* MoleculeListCellProtocol.swift in Sources */,
|
D28A837B23C928DA00DFE4FC /* MoleculeListCellProtocol.swift in Sources */,
|
||||||
D28BA74D248589C800B75CB8 /* TabPageModelProtocol.swift in Sources */,
|
D28BA74D248589C800B75CB8 /* TabPageModelProtocol.swift in Sources */,
|
||||||
|
EA7AE5602C7E554700107C74 /* PaginationModel.swift in Sources */,
|
||||||
608211282AC6B57E00C3FC39 /* MVMCoreUILoggingHandler.swift in Sources */,
|
608211282AC6B57E00C3FC39 /* MVMCoreUILoggingHandler.swift in Sources */,
|
||||||
014AA72F23C5059B006F3E93 /* ThreeLayerPageTemplateModel.swift in Sources */,
|
014AA72F23C5059B006F3E93 /* ThreeLayerPageTemplateModel.swift in Sources */,
|
||||||
0A21DB91235E0EDB00C160A2 /* DigitBox.swift in Sources */,
|
0A21DB91235E0EDB00C160A2 /* DigitBox.swift in Sources */,
|
||||||
@ -2968,8 +2989,10 @@
|
|||||||
525239C02407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift in Sources */,
|
525239C02407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift in Sources */,
|
||||||
D2E2A99A23D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift in Sources */,
|
D2E2A99A23D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift in Sources */,
|
||||||
D202AFE6242A6A9C00E5BEDF /* UICollectionViewScrollPosition+Extension.swift in Sources */,
|
D202AFE6242A6A9C00E5BEDF /* UICollectionViewScrollPosition+Extension.swift in Sources */,
|
||||||
|
EA7AE55C2C7D18A100107C74 /* BreadcrumbsModel.swift in Sources */,
|
||||||
D20F3B44252E00E4004B3F56 /* PageProtocol.swift in Sources */,
|
D20F3B44252E00E4004B3F56 /* PageProtocol.swift in Sources */,
|
||||||
AA37CBD3251907200027344C /* StarsModel.swift in Sources */,
|
AA37CBD3251907200027344C /* StarsModel.swift in Sources */,
|
||||||
|
EA7AE5622C7E555D00107C74 /* Pagination.swift in Sources */,
|
||||||
8D084AD22410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift in Sources */,
|
8D084AD22410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift in Sources */,
|
||||||
94C0150C2421564A005811A9 /* ActionCollapseNotificationModel.swift in Sources */,
|
94C0150C2421564A005811A9 /* ActionCollapseNotificationModel.swift in Sources */,
|
||||||
D2CAC7CB251104E100C75681 /* NotificationXButtonModel.swift in Sources */,
|
D2CAC7CB251104E100C75681 /* NotificationXButtonModel.swift in Sources */,
|
||||||
@ -2996,6 +3019,7 @@
|
|||||||
AAE96FA525341F7D0037A989 /* ListStoreLocator.swift in Sources */,
|
AAE96FA525341F7D0037A989 /* ListStoreLocator.swift in Sources */,
|
||||||
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */,
|
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */,
|
||||||
944589232385DA9600DE9FD4 /* ImageViewModel.swift in Sources */,
|
944589232385DA9600DE9FD4 /* ImageViewModel.swift in Sources */,
|
||||||
|
EA7AE55E2C7D234500107C74 /* Breadcrumbs.swift in Sources */,
|
||||||
D213347723843825008E41B3 /* Line.swift in Sources */,
|
D213347723843825008E41B3 /* Line.swift in Sources */,
|
||||||
D2E2A99C23D8D975000B42E6 /* ImageHeadlineBodyModel.swift in Sources */,
|
D2E2A99C23D8D975000B42E6 /* ImageHeadlineBodyModel.swift in Sources */,
|
||||||
BB3BC1302550094500297977 /* ListLeftVariableIconWithRightCaretAllTextLinksModel.swift in Sources */,
|
BB3BC1302550094500297977 /* ListLeftVariableIconWithRightCaretAllTextLinksModel.swift in Sources */,
|
||||||
|
|||||||
57
MVMCoreUI/Atomic/Atoms/Views/Pagination.swift
Normal file
57
MVMCoreUI/Atomic/Atoms/Views/Pagination.swift
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
//
|
||||||
|
// Pagination.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 8/27/24.
|
||||||
|
// Copyright © 2024 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import VDS
|
||||||
|
|
||||||
|
@objcMembers open class Pagination: VDS.Pagination, VDSMoleculeViewProtocol {
|
||||||
|
//------------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//------------------------------------------------------
|
||||||
|
open var viewModel: PaginationModel!
|
||||||
|
open var delegateObject: MVMCoreUIDelegateObject?
|
||||||
|
open var additionalData: [AnyHashable : Any]?
|
||||||
|
|
||||||
|
// Form Validation
|
||||||
|
open var fieldKey: String?
|
||||||
|
open var fieldValue: JSONValue?
|
||||||
|
open var groupName: String?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializers
|
||||||
|
//--------------------------------------------------
|
||||||
|
public convenience required init() {
|
||||||
|
self.init(frame:.zero)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setup() {
|
||||||
|
super.setup()
|
||||||
|
pageChangedPublisher
|
||||||
|
.sink { [weak self] control in
|
||||||
|
guard let self else { return }
|
||||||
|
viewModel?.selectedPage = control.selectedPage
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
}
|
||||||
|
|
||||||
|
open func viewModelDidUpdate() {
|
||||||
|
isEnabled = viewModel.enabled
|
||||||
|
surface = viewModel.surface
|
||||||
|
total = viewModel.totalPages
|
||||||
|
selectedPage = viewModel.selectedPage
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Actions
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - MoleculeViewProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
|
public func updateView(_ size: CGFloat) {}
|
||||||
|
|
||||||
|
}
|
||||||
67
MVMCoreUI/Atomic/Atoms/Views/PaginationModel.swift
Normal file
67
MVMCoreUI/Atomic/Atoms/Views/PaginationModel.swift
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
//
|
||||||
|
// PaginationModel.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 8/27/24.
|
||||||
|
// Copyright © 2024 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import VDS
|
||||||
|
import MVMCore
|
||||||
|
|
||||||
|
open class PaginationModel: MoleculeModelProtocol {
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
open class var identifier: String { "pagination" }
|
||||||
|
open var moleculeName: String { Self.identifier }
|
||||||
|
open var backgroundColor: Color?
|
||||||
|
open var id: String = UUID().uuidString
|
||||||
|
|
||||||
|
open var totalPages: Int = 0
|
||||||
|
open var selectedPage: Int = 0
|
||||||
|
open var enabled: Bool = true
|
||||||
|
open var inverted: Bool = false
|
||||||
|
open var surface: Surface { inverted ? .dark : .light }
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case totalPages
|
||||||
|
case selectedPage
|
||||||
|
case enabled
|
||||||
|
case inverted
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializers
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
required public init(from decoder: Decoder) throws {
|
||||||
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
totalPages = try container.decode(Int.self, forKey: .totalPages)
|
||||||
|
selectedPage = try container.decodeIfPresent(Int.self, forKey: .selectedPage) ?? 0
|
||||||
|
enabled = try container.decodeIfPresent(Bool.self, forKey: .enabled) ?? false
|
||||||
|
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
||||||
|
}
|
||||||
|
|
||||||
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(totalPages, forKey: .totalPages)
|
||||||
|
try container.encode(selectedPage, forKey: .selectedPage)
|
||||||
|
try container.encode(enabled, forKey: .enabled)
|
||||||
|
try container.encode(inverted, forKey: .inverted)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return inverted == model.inverted
|
||||||
|
&& enabled == model.enabled
|
||||||
|
&& totalPages == model.totalPages
|
||||||
|
&& selectedPage == model.selectedPage
|
||||||
|
}
|
||||||
|
}
|
||||||
56
MVMCoreUI/Atomic/Molecules/Breadcrumbs/Breadcrumbs.swift
Normal file
56
MVMCoreUI/Atomic/Molecules/Breadcrumbs/Breadcrumbs.swift
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
//
|
||||||
|
// Breadcrumbs.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 8/26/24.
|
||||||
|
// Copyright © 2024 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import VDS
|
||||||
|
|
||||||
|
@objcMembers open class Breadcrumbs: VDS.Breadcrumbs, VDSMoleculeViewProtocol {
|
||||||
|
//------------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//------------------------------------------------------
|
||||||
|
open var viewModel: BreadcrumbsModel!
|
||||||
|
open var delegateObject: MVMCoreUIDelegateObject?
|
||||||
|
open var additionalData: [AnyHashable : Any]?
|
||||||
|
|
||||||
|
// Form Validation
|
||||||
|
open var fieldKey: String?
|
||||||
|
open var fieldValue: JSONValue?
|
||||||
|
open var groupName: String?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializers
|
||||||
|
//--------------------------------------------------
|
||||||
|
public convenience required init() {
|
||||||
|
self.init(frame:.zero)
|
||||||
|
}
|
||||||
|
|
||||||
|
open func viewModelDidUpdate() {
|
||||||
|
isEnabled = viewModel.enabled
|
||||||
|
surface = viewModel.surface
|
||||||
|
breadcrumbModels = viewModel.breadcrumbs.compactMap { [unowned self] breadcrumb in
|
||||||
|
return .init(text: breadcrumb.text,
|
||||||
|
selected: breadcrumb.selected,
|
||||||
|
onClick: { _ in
|
||||||
|
MVMCoreUIActionHandler.performActionUnstructured(with: breadcrumb.action,
|
||||||
|
sourceModel: breadcrumb,
|
||||||
|
additionalData: self.additionalData,
|
||||||
|
delegateObject: self.delegateObject)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Actions
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - MoleculeViewProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
|
public func updateView(_ size: CGFloat) {}
|
||||||
|
|
||||||
|
}
|
||||||
111
MVMCoreUI/Atomic/Molecules/Breadcrumbs/BreadcrumbsModel.swift
Normal file
111
MVMCoreUI/Atomic/Molecules/Breadcrumbs/BreadcrumbsModel.swift
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
//
|
||||||
|
// BreadCrumbs.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 8/26/24.
|
||||||
|
// Copyright © 2024 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import VDS
|
||||||
|
import MVMCore
|
||||||
|
|
||||||
|
open class BreadcrumbsModel: MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
open class var identifier: String { "breadcrumbs" }
|
||||||
|
open var moleculeName: String { Self.identifier }
|
||||||
|
open var backgroundColor: Color?
|
||||||
|
open var id: String = UUID().uuidString
|
||||||
|
open var children: [any MoleculeModelProtocol] { breadcrumbs }
|
||||||
|
|
||||||
|
open var breadcrumbs: [BreadcrumbModel] = []
|
||||||
|
open var enabled: Bool = true
|
||||||
|
open var inverted: Bool = false
|
||||||
|
open var surface: Surface { inverted ? .dark : .light }
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case breadcrumbs
|
||||||
|
case enabled
|
||||||
|
case inverted
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializers
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
required public init(from decoder: Decoder) throws {
|
||||||
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
breadcrumbs = try container.decode([BreadcrumbModel].self, forKey: .breadcrumbs)
|
||||||
|
enabled = try container.decodeIfPresent(Bool.self, forKey: .enabled) ?? false
|
||||||
|
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
||||||
|
}
|
||||||
|
|
||||||
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(enabled, forKey: .enabled)
|
||||||
|
try container.encode(inverted, forKey: .inverted)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return inverted == model.inverted
|
||||||
|
&& enabled == model.enabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open class BreadcrumbModel: MoleculeModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
open class var identifier: String { "breadcrumb" }
|
||||||
|
open var moleculeName: String { Self.identifier }
|
||||||
|
open var backgroundColor: Color?
|
||||||
|
open var id: String = UUID().uuidString
|
||||||
|
|
||||||
|
open var text: String = ""
|
||||||
|
open var selected: Bool = false
|
||||||
|
open var action: ActionModelProtocol
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case text
|
||||||
|
case selected
|
||||||
|
case action
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializers
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
required public init(from decoder: Decoder) throws {
|
||||||
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
text = try container.decode(String.self, forKey: .text)
|
||||||
|
selected = try container.decodeIfPresent(Bool.self, forKey: .selected) ?? false
|
||||||
|
action = try container.decodeModel(codingKey: .action)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(text, forKey: .text)
|
||||||
|
try container.encode(selected, forKey: .selected)
|
||||||
|
try container.encodeModelIfPresent(action, forKey: .action)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return text == model.text
|
||||||
|
&& selected == model.selected
|
||||||
|
&& action.isEqual(to: model.action)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -142,7 +142,10 @@ open class CoreUIModelMapping: ModelMapping {
|
|||||||
ModelRegistry.register(NavigationItemModel.self)
|
ModelRegistry.register(NavigationItemModel.self)
|
||||||
ModelRegistry.register(NavigationImageButtonModel.self)
|
ModelRegistry.register(NavigationImageButtonModel.self)
|
||||||
ModelRegistry.register(NavigationLabelButtonModel.self)
|
ModelRegistry.register(NavigationLabelButtonModel.self)
|
||||||
|
ModelRegistry.register(handler: Pagination.self, for: PaginationModel.self)
|
||||||
|
ModelRegistry.register(handler: Breadcrumbs.self, for: BreadcrumbsModel.self)
|
||||||
|
ModelRegistry.register(BreadcrumbModel.self)
|
||||||
|
|
||||||
// MARK:- Other Organisms
|
// MARK:- Other Organisms
|
||||||
ModelRegistry.register(handler: Carousel.self, for: CarouselModel.self)
|
ModelRegistry.register(handler: Carousel.self, for: CarouselModel.self)
|
||||||
ModelRegistry.register(handler: BarsIndicatorView.self, for: BarsCarouselIndicatorModel.self)
|
ModelRegistry.register(handler: BarsIndicatorView.self, for: BarsCarouselIndicatorModel.self)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user