added isEqual to CalendarView
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
e211d4dc22
commit
533bcd2dea
@ -113,6 +113,42 @@ open class CalendarViewModel: MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(inverted, forKey: .inverted)
|
try container.encode(inverted, forKey: .inverted)
|
||||||
|
try container.encode(dateFormat, forKey: .dateFormat)
|
||||||
|
try container.encode(hideContainerBorder, forKey: .hideContainerBorder)
|
||||||
|
try container.encode(hideCurrentDateIndicator, forKey: .hideCurrentDateIndicator)
|
||||||
|
try container.encode(activeDates, forKey: .activeDates)
|
||||||
|
try container.encode(selectedDate, forKey: .selectedDate)
|
||||||
|
try container.encode(minDate, forKey: .minDate)
|
||||||
|
try container.encode(maxDate, forKey: .maxDate)
|
||||||
|
try container.encode(indicators, forKey: .indicators)
|
||||||
|
}
|
||||||
|
|
||||||
|
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return inverted == model.inverted
|
||||||
|
&& dateFormat == model.dateFormat
|
||||||
|
&& hideContainerBorder == model.hideContainerBorder
|
||||||
|
&& hideCurrentDateIndicator == model.hideCurrentDateIndicator
|
||||||
|
&& activeDates == model.activeDates
|
||||||
|
&& inactiveDates == model.inactiveDates
|
||||||
|
&& selectedDate == model.selectedDate
|
||||||
|
&& minDate == model.minDate
|
||||||
|
&& maxDate == model.maxDate
|
||||||
|
&& indicators == model.indicators
|
||||||
|
}
|
||||||
|
|
||||||
|
open func isVisuallyEquivalent(to model: any MoleculeModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return inverted == model.inverted
|
||||||
|
&& dateFormat == model.dateFormat
|
||||||
|
&& hideContainerBorder == model.hideContainerBorder
|
||||||
|
&& hideCurrentDateIndicator == model.hideCurrentDateIndicator
|
||||||
|
&& activeDates == model.activeDates
|
||||||
|
&& inactiveDates == model.inactiveDates
|
||||||
|
&& selectedDate == model.selectedDate
|
||||||
|
&& minDate == model.minDate
|
||||||
|
&& maxDate == model.maxDate
|
||||||
|
&& indicators == model.indicators
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import VDS
|
import VDS
|
||||||
import VDSCoreTokens
|
import VDSCoreTokens
|
||||||
|
import MVMCore
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Codable Extensions
|
// MARK: - Codable Extensions
|
||||||
@ -57,7 +58,7 @@ extension VDS.Button.Size: RawRepresentableCodable {
|
|||||||
public static var defaultValue: VDS.Button.Size? { nil }
|
public static var defaultValue: VDS.Button.Size? { nil }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension VDS.CalendarBase.CalendarIndicatorModel: Codable {
|
extension VDS.CalendarBase.CalendarIndicatorModel: Codable, ModelComparisonProtocol, MoleculeModelComparisonProtocol {
|
||||||
|
|
||||||
enum CodingKeys: String, CodingKey {
|
enum CodingKeys: String, CodingKey {
|
||||||
case label
|
case label
|
||||||
@ -89,6 +90,18 @@ extension VDS.CalendarBase.CalendarIndicatorModel: Codable {
|
|||||||
formatter.formatterBehavior = .default
|
formatter.formatterBehavior = .default
|
||||||
return formatter
|
return formatter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return label == model.label
|
||||||
|
&& date == model.date
|
||||||
|
}
|
||||||
|
|
||||||
|
public func isVisuallyEquivalent(to model: any MoleculeModelComparisonProtocol) -> Bool {
|
||||||
|
guard let model = model as? Self else { return false }
|
||||||
|
return label == model.label
|
||||||
|
&& date == model.date
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user