updated model
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
c8496194f0
commit
273f45def0
@ -5,9 +5,10 @@
|
||||
// Created by Kevin Christiano on 1/22/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
import VDS
|
||||
|
||||
|
||||
@objcMembers open class TextEntryFieldModel: EntryFieldModel {
|
||||
@objcMembers open class TextEntryFieldModel: EntryFieldModel, FormFieldInternalValidatableProtocol {
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Types
|
||||
//--------------------------------------------------
|
||||
@ -20,6 +21,39 @@
|
||||
case email
|
||||
case text
|
||||
case phone
|
||||
|
||||
//additional
|
||||
case inlineAction
|
||||
case creditCard
|
||||
case date
|
||||
case securityCode
|
||||
|
||||
public func toVDSFieldType() -> VDS.InputField.FieldType {
|
||||
switch self {
|
||||
case .password:
|
||||
.password
|
||||
case .secure:
|
||||
.text
|
||||
case .number:
|
||||
.number
|
||||
case .numberSecure:
|
||||
.number
|
||||
case .email:
|
||||
.text
|
||||
case .text:
|
||||
.text
|
||||
case .phone:
|
||||
.telephone
|
||||
case .inlineAction:
|
||||
.inlineAction
|
||||
case .creditCard:
|
||||
.creditCard
|
||||
case .date:
|
||||
.date
|
||||
case .securityCode:
|
||||
.securityCode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -33,12 +67,21 @@
|
||||
public var disabledTextColor: Color = Color(uiColor: .mvmCoolGray3)
|
||||
public var textAlignment: NSTextAlignment = .left
|
||||
public var keyboardOverride: String?
|
||||
public var type: EntryType?
|
||||
public var type: EntryType = .text
|
||||
public var clearTextOnTap: Bool = false
|
||||
public var displayFormat: String?
|
||||
public var displayMask: String?
|
||||
public var enableClipboardActions: Bool = true
|
||||
|
||||
public var tooltip: TooltipModel?
|
||||
public var transparentBackground: Bool = false
|
||||
public var width: CGFloat?
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - FormFieldInternalValidatableProtocol
|
||||
//--------------------------------------------------
|
||||
open var rules: [AnyRule<String>]?
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//--------------------------------------------------
|
||||
@ -114,6 +157,9 @@
|
||||
case displayFormat
|
||||
case displayMask
|
||||
case enableClipboardActions
|
||||
case tooltip
|
||||
case transparentBackground
|
||||
case width
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -128,7 +174,7 @@
|
||||
displayFormat = try typeContainer.decodeIfPresent(String.self, forKey: .displayFormat)
|
||||
keyboardOverride = try typeContainer.decodeIfPresent(String.self, forKey: .keyboardOverride)
|
||||
displayMask = try typeContainer.decodeIfPresent(String.self, forKey: .displayMask)
|
||||
type = try typeContainer.decodeIfPresent(EntryType.self, forKey: .type)
|
||||
type = try typeContainer.decodeIfPresent(EntryType.self, forKey: .type) ?? .text
|
||||
|
||||
if let clearTextOnTap = try typeContainer.decodeIfPresent(Bool.self, forKey: .clearTextOnTap) {
|
||||
self.clearTextOnTap = clearTextOnTap
|
||||
@ -149,6 +195,10 @@
|
||||
if let enableClipboardActions = try typeContainer.decodeIfPresent(Bool.self, forKey: .enableClipboardActions) {
|
||||
self.enableClipboardActions = enableClipboardActions
|
||||
}
|
||||
|
||||
tooltip = try typeContainer.decodeIfPresent(TooltipModel.self, forKey: .tooltip)
|
||||
transparentBackground = try typeContainer.decodeIfPresent(Bool.self, forKey: .transparentBackground) ?? false
|
||||
width = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .width)
|
||||
}
|
||||
|
||||
open override func encode(to encoder: Encoder) throws {
|
||||
@ -164,5 +214,8 @@
|
||||
try container.encode(disabledTextColor, forKey: .disabledTextColor)
|
||||
try container.encode(clearTextOnTap, forKey: .clearTextOnTap)
|
||||
try container.encode(enableClipboardActions, forKey: .enableClipboardActions)
|
||||
try container.encodeIfPresent(tooltip, forKey: .tooltip)
|
||||
try container.encode(transparentBackground, forKey: .transparentBackground)
|
||||
try container.encodeIfPresent(width, forKey: .width)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user