From 7ec685136b271e003d2362449540014fd005fa49 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 11 Jul 2024 12:22:28 -0500 Subject: [PATCH] added more properties Signed-off-by: Matt Bruce --- .../FormFields/TextFields/TextViewEntryField.swift | 3 +++ .../TextFields/TextViewEntryFieldModel.swift | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift index 382c418c..9016ae5c 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift @@ -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 diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryFieldModel.swift index cfcef654..fb1c2167 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryFieldModel.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryFieldModel.swift @@ -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)