added more properties

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-07-11 12:22:28 -05:00
parent bd4c7780b0
commit 7ec685136b
2 changed files with 13 additions and 2 deletions

View File

@ -118,6 +118,9 @@ class TextViewEntryField: VDS.TextArea, VDSMoleculeViewProtocol, ObservingTextFi
open func viewModelDidUpdate() {
text = viewModel.text
minHeight = viewModel.minHeight
maxLength = viewModel.maxLength
labelText = viewModel.title
helperText = viewModel.feedback
isEnabled = viewModel.enabled

View File

@ -7,7 +7,7 @@
//
import UIKit
import VDS
class TextViewEntryFieldModel: TextEntryFieldModel {
//--------------------------------------------------
@ -20,9 +20,11 @@ class TextViewEntryFieldModel: TextEntryFieldModel {
public var editable: Bool = true
public var showsPlaceholder: Bool = false
public var tooltip: TooltipModel?
public var minHeight: VDS.TextArea.Height = .twoX
public var maxLength: Int?
public var transparentBackground: Bool = false
public var width: CGFloat?
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
@ -30,6 +32,8 @@ class TextViewEntryFieldModel: TextEntryFieldModel {
private enum CodingKeys: String, CodingKey {
case accessibilityText
case editable
case minHeight
case maxLength
case tooltip
case transparentBackground
case width
@ -44,6 +48,8 @@ class TextViewEntryFieldModel: TextEntryFieldModel {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
editable = try typeContainer.decodeIfPresent(Bool.self, forKey: .editable) ?? true
minHeight = try typeContainer.decodeIfPresent(VDS.TextArea.Height.self, forKey: .minHeight) ?? .twoX
maxLength = try typeContainer.decodeIfPresent(Int.self, forKey: .maxLength)
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
tooltip = try typeContainer.decodeIfPresent(TooltipModel.self, forKey: .tooltip)
transparentBackground = try typeContainer.decodeIfPresent(Bool.self, forKey: .transparentBackground) ?? false
@ -55,6 +61,8 @@ class TextViewEntryFieldModel: TextEntryFieldModel {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
try container.encode(editable, forKey: .editable)
try container.encode(minHeight, forKey: .minHeight)
try container.encodeIfPresent(maxLength, forKey: .maxLength)
try container.encodeIfPresent(tooltip, forKey: .tooltip)
try container.encode(transparentBackground, forKey: .transparentBackground)
try container.encodeIfPresent(width, forKey: .width)