added more properties
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
bd4c7780b0
commit
7ec685136b
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user