new rule equalsignorecase
This commit is contained in:
parent
c4fa9188b4
commit
7e3c9fdcdb
@ -92,6 +92,7 @@
|
|||||||
0A7EF86323D8AFA000B2AAD1 /* BaseDropdownEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7EF86223D8AFA000B2AAD1 /* BaseDropdownEntryFieldModel.swift */; };
|
0A7EF86323D8AFA000B2AAD1 /* BaseDropdownEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7EF86223D8AFA000B2AAD1 /* BaseDropdownEntryFieldModel.swift */; };
|
||||||
0A7EF86523D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7EF86423D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift */; };
|
0A7EF86523D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7EF86423D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift */; };
|
||||||
0A7EF86723D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7EF86623D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift */; };
|
0A7EF86723D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7EF86623D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift */; };
|
||||||
|
0A849EFE246F1775009F277F /* RuleEqualsIgnoreCaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A849EFD246F1775009F277F /* RuleEqualsIgnoreCaseModel.swift */; };
|
||||||
0A9D091D2433796500D2E6C0 /* BarsCarouselIndicatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9D09172433796500D2E6C0 /* BarsCarouselIndicatorModel.swift */; };
|
0A9D091D2433796500D2E6C0 /* BarsCarouselIndicatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9D09172433796500D2E6C0 /* BarsCarouselIndicatorModel.swift */; };
|
||||||
0A9D091E2433796500D2E6C0 /* NumericCarouselIndicatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9D09182433796500D2E6C0 /* NumericCarouselIndicatorModel.swift */; };
|
0A9D091E2433796500D2E6C0 /* NumericCarouselIndicatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9D09182433796500D2E6C0 /* NumericCarouselIndicatorModel.swift */; };
|
||||||
0A9D091F2433796500D2E6C0 /* NumericIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9D09192433796500D2E6C0 /* NumericIndicatorView.swift */; };
|
0A9D091F2433796500D2E6C0 /* NumericIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9D09192433796500D2E6C0 /* NumericIndicatorView.swift */; };
|
||||||
@ -505,6 +506,7 @@
|
|||||||
0A7EF86423D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemDropdownEntryFieldModel.swift; sourceTree = "<group>"; };
|
0A7EF86423D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemDropdownEntryFieldModel.swift; sourceTree = "<group>"; };
|
||||||
0A7EF86623D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateDropdownEntryFieldModel.swift; sourceTree = "<group>"; };
|
0A7EF86623D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateDropdownEntryFieldModel.swift; sourceTree = "<group>"; };
|
||||||
0A8321AE2355FE9500CB7F00 /* DigitBox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DigitBox.swift; sourceTree = "<group>"; };
|
0A8321AE2355FE9500CB7F00 /* DigitBox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DigitBox.swift; sourceTree = "<group>"; };
|
||||||
|
0A849EFD246F1775009F277F /* RuleEqualsIgnoreCaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleEqualsIgnoreCaseModel.swift; sourceTree = "<group>"; };
|
||||||
0A9D09172433796500D2E6C0 /* BarsCarouselIndicatorModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BarsCarouselIndicatorModel.swift; sourceTree = "<group>"; };
|
0A9D09172433796500D2E6C0 /* BarsCarouselIndicatorModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BarsCarouselIndicatorModel.swift; sourceTree = "<group>"; };
|
||||||
0A9D09182433796500D2E6C0 /* NumericCarouselIndicatorModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumericCarouselIndicatorModel.swift; sourceTree = "<group>"; };
|
0A9D09182433796500D2E6C0 /* NumericCarouselIndicatorModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumericCarouselIndicatorModel.swift; sourceTree = "<group>"; };
|
||||||
0A9D09192433796500D2E6C0 /* NumericIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumericIndicatorView.swift; sourceTree = "<group>"; };
|
0A9D09192433796500D2E6C0 /* NumericIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumericIndicatorView.swift; sourceTree = "<group>"; };
|
||||||
@ -873,6 +875,7 @@
|
|||||||
011D95A0240453D0000E3791 /* RuleEqualsModel.swift */,
|
011D95A0240453D0000E3791 /* RuleEqualsModel.swift */,
|
||||||
011D95A2240453F8000E3791 /* RuleRegexModel.swift */,
|
011D95A2240453F8000E3791 /* RuleRegexModel.swift */,
|
||||||
0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */,
|
0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */,
|
||||||
|
0A849EFD246F1775009F277F /* RuleEqualsIgnoreCaseModel.swift */,
|
||||||
);
|
);
|
||||||
name = Rules;
|
name = Rules;
|
||||||
path = Rules/Rules;
|
path = Rules/Rules;
|
||||||
@ -2038,6 +2041,7 @@
|
|||||||
AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */,
|
AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */,
|
||||||
011D9626240EBB16000E3791 /* RadioButtonLabelModel.swift in Sources */,
|
011D9626240EBB16000E3791 /* RadioButtonLabelModel.swift in Sources */,
|
||||||
8DDD6C1D244D90B8006A2232 /* ListThreeColumnDataUsage.swift in Sources */,
|
8DDD6C1D244D90B8006A2232 /* ListThreeColumnDataUsage.swift in Sources */,
|
||||||
|
0A849EFE246F1775009F277F /* RuleEqualsIgnoreCaseModel.swift in Sources */,
|
||||||
D28764FB245A33A500CB882D /* TwoLinkViewModel.swift in Sources */,
|
D28764FB245A33A500CB882D /* TwoLinkViewModel.swift in Sources */,
|
||||||
AAA74A192410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift in Sources */,
|
AAA74A192410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift in Sources */,
|
||||||
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */,
|
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */,
|
||||||
|
|||||||
@ -194,6 +194,7 @@ import Foundation
|
|||||||
try? ModelRegistry.register(RuleAnyValueChangedModel.self)
|
try? ModelRegistry.register(RuleAnyValueChangedModel.self)
|
||||||
try? ModelRegistry.register(RuleAllValueChangedModel.self)
|
try? ModelRegistry.register(RuleAllValueChangedModel.self)
|
||||||
try? ModelRegistry.register(RuleEqualsModel.self)
|
try? ModelRegistry.register(RuleEqualsModel.self)
|
||||||
|
try? ModelRegistry.register(RuleEqualsIgnoreCaseModel.self)
|
||||||
try? ModelRegistry.register(RuleRegexModel.self)
|
try? ModelRegistry.register(RuleRegexModel.self)
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|||||||
@ -0,0 +1,55 @@
|
|||||||
|
//
|
||||||
|
// RuleEqualsIgnoreCaseModel.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Kevin Christiano on 5/15/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
|
public class RuleEqualsIgnoreCaseModel: RulesProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public static var identifier: String = "equalsIgnoreCase"
|
||||||
|
public var type: String = RuleEqualsModel.identifier
|
||||||
|
public var fields: [String]
|
||||||
|
public var errorMessage: [String: String]?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Validation
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public func isValid(_ formField: FormFieldProtocol) -> Bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
public func validate(_ fieldMolecules: [String: FormFieldProtocol]) -> Bool {
|
||||||
|
var valid = true
|
||||||
|
var compareValue: AnyHashable?
|
||||||
|
|
||||||
|
for formKey in fields {
|
||||||
|
guard let formField = fieldMolecules[formKey] else { continue }
|
||||||
|
|
||||||
|
if compareValue == nil {
|
||||||
|
compareValue = formField.formFieldValue()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
let a = compareValue.caseInsensitiveCompare(formField.formFieldValue())
|
||||||
|
|
||||||
|
if compareValue != formField.formFieldValue() {
|
||||||
|
valid = false
|
||||||
|
(formField as? FormRuleWatcherFieldProtocol)?.setValidity(valid, rule: self)
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
(formField as? FormRuleWatcherFieldProtocol)?.setValidity(valid, rule: self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return valid
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -24,6 +24,7 @@ public class RuleRequiredModel: RulesProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func isValid(_ formField: FormFieldProtocol) -> Bool {
|
public func isValid(_ formField: FormFieldProtocol) -> Bool {
|
||||||
|
|
||||||
guard let value = formField.formFieldValue() else { return false }
|
guard let value = formField.formFieldValue() else { return false }
|
||||||
|
|
||||||
var valid = true
|
var valid = true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user