beginning stages of change
This commit is contained in:
parent
38e9141810
commit
fcca1e3e83
@ -68,6 +68,9 @@
|
|||||||
0A21DB83235DFBC500C160A2 /* MdnEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A21DB82235DFBC500C160A2 /* MdnEntryField.swift */; };
|
0A21DB83235DFBC500C160A2 /* MdnEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A21DB82235DFBC500C160A2 /* MdnEntryField.swift */; };
|
||||||
0A21DB91235E0EDB00C160A2 /* DigitBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A8321AE2355FE9500CB7F00 /* DigitBox.swift */; };
|
0A21DB91235E0EDB00C160A2 /* DigitBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A8321AE2355FE9500CB7F00 /* DigitBox.swift */; };
|
||||||
0A21DB94235E24ED00C160A2 /* DigitEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A21DB93235E24ED00C160A2 /* DigitEntryField.swift */; };
|
0A21DB94235E24ED00C160A2 /* DigitEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A21DB93235E24ED00C160A2 /* DigitEntryField.swift */; };
|
||||||
|
0A25209624645AFD000FA9F6 /* TextViewEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A25209524645AFD000FA9F6 /* TextViewEntryField.swift */; };
|
||||||
|
0A25209824645B76000FA9F6 /* TextViewEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A25209724645B76000FA9F6 /* TextViewEntryFieldModel.swift */; };
|
||||||
|
0A2520A924646230000FA9F6 /* TextViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A2520A824646230000FA9F6 /* TextViewModel.swift */; };
|
||||||
0A41BA6E2344FCD400D4C0BC /* CATransaction+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A41BA6D2344FCD400D4C0BC /* CATransaction+Extension.swift */; };
|
0A41BA6E2344FCD400D4C0BC /* CATransaction+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A41BA6D2344FCD400D4C0BC /* CATransaction+Extension.swift */; };
|
||||||
0A41BA7F23453A6400D4C0BC /* TextEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A41BA7E23453A6400D4C0BC /* TextEntryField.swift */; };
|
0A41BA7F23453A6400D4C0BC /* TextEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A41BA7E23453A6400D4C0BC /* TextEntryField.swift */; };
|
||||||
0A5D59C223AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */; };
|
0A5D59C223AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */; };
|
||||||
@ -76,7 +79,6 @@
|
|||||||
0A6682AA2435125F00AD3CA1 /* Styler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682A92435125F00AD3CA1 /* Styler.swift */; };
|
0A6682AA2435125F00AD3CA1 /* Styler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682A92435125F00AD3CA1 /* Styler.swift */; };
|
||||||
0A6682AC243531C300AD3CA1 /* Padding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682AB243531C300AD3CA1 /* Padding.swift */; };
|
0A6682AC243531C300AD3CA1 /* Padding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682AB243531C300AD3CA1 /* Padding.swift */; };
|
||||||
0A6682B5243769C700AD3CA1 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682B3243769C700AD3CA1 /* TextView.swift */; };
|
0A6682B5243769C700AD3CA1 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682B3243769C700AD3CA1 /* TextView.swift */; };
|
||||||
0A6682B6243769C700AD3CA1 /* TextViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682B4243769C700AD3CA1 /* TextViewModel.swift */; };
|
|
||||||
0A69F611241BDEA700F7231B /* RuleAnyRequiredModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */; };
|
0A69F611241BDEA700F7231B /* RuleAnyRequiredModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */; };
|
||||||
0A6BF4722360C56C0028F841 /* BaseDropdownEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */; };
|
0A6BF4722360C56C0028F841 /* BaseDropdownEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */; };
|
||||||
0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */; };
|
0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */; };
|
||||||
@ -475,6 +477,9 @@
|
|||||||
0A21DB7E235DECC500C160A2 /* EntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntryField.swift; sourceTree = "<group>"; };
|
0A21DB7E235DECC500C160A2 /* EntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntryField.swift; sourceTree = "<group>"; };
|
||||||
0A21DB82235DFBC500C160A2 /* MdnEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MdnEntryField.swift; sourceTree = "<group>"; };
|
0A21DB82235DFBC500C160A2 /* MdnEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MdnEntryField.swift; sourceTree = "<group>"; };
|
||||||
0A21DB93235E24ED00C160A2 /* DigitEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DigitEntryField.swift; sourceTree = "<group>"; };
|
0A21DB93235E24ED00C160A2 /* DigitEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DigitEntryField.swift; sourceTree = "<group>"; };
|
||||||
|
0A25209524645AFD000FA9F6 /* TextViewEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextViewEntryField.swift; sourceTree = "<group>"; };
|
||||||
|
0A25209724645B76000FA9F6 /* TextViewEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextViewEntryFieldModel.swift; sourceTree = "<group>"; };
|
||||||
|
0A2520A824646230000FA9F6 /* TextViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextViewModel.swift; sourceTree = "<group>"; };
|
||||||
0A41BA6D2344FCD400D4C0BC /* CATransaction+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CATransaction+Extension.swift"; sourceTree = "<group>"; };
|
0A41BA6D2344FCD400D4C0BC /* CATransaction+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CATransaction+Extension.swift"; sourceTree = "<group>"; };
|
||||||
0A41BA7E23453A6400D4C0BC /* TextEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextEntryField.swift; sourceTree = "<group>"; };
|
0A41BA7E23453A6400D4C0BC /* TextEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextEntryField.swift; sourceTree = "<group>"; };
|
||||||
0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleGuidelinesProtocol.swift; sourceTree = "<group>"; };
|
0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleGuidelinesProtocol.swift; sourceTree = "<group>"; };
|
||||||
@ -483,7 +488,6 @@
|
|||||||
0A6682A92435125F00AD3CA1 /* Styler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Styler.swift; sourceTree = "<group>"; };
|
0A6682A92435125F00AD3CA1 /* Styler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Styler.swift; sourceTree = "<group>"; };
|
||||||
0A6682AB243531C300AD3CA1 /* Padding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Padding.swift; sourceTree = "<group>"; };
|
0A6682AB243531C300AD3CA1 /* Padding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Padding.swift; sourceTree = "<group>"; };
|
||||||
0A6682B3243769C700AD3CA1 /* TextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; };
|
0A6682B3243769C700AD3CA1 /* TextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; };
|
||||||
0A6682B4243769C700AD3CA1 /* TextViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextViewModel.swift; sourceTree = "<group>"; };
|
|
||||||
0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleAnyRequiredModel.swift; sourceTree = "<group>"; };
|
0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleAnyRequiredModel.swift; sourceTree = "<group>"; };
|
||||||
0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseDropdownEntryField.swift; sourceTree = "<group>"; };
|
0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseDropdownEntryField.swift; sourceTree = "<group>"; };
|
||||||
0A7918F423F5E7EA00772FF4 /* ImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageView.swift; sourceTree = "<group>"; };
|
0A7918F423F5E7EA00772FF4 /* ImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageView.swift; sourceTree = "<group>"; };
|
||||||
@ -1638,6 +1642,8 @@
|
|||||||
0ABD136C237CAD1E0081388D /* DateDropdownEntryField.swift */,
|
0ABD136C237CAD1E0081388D /* DateDropdownEntryField.swift */,
|
||||||
0A7EF86423D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift */,
|
0A7EF86423D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift */,
|
||||||
0ABD1370237DB0450081388D /* ItemDropdownEntryField.swift */,
|
0ABD1370237DB0450081388D /* ItemDropdownEntryField.swift */,
|
||||||
|
0A25209724645B76000FA9F6 /* TextViewEntryFieldModel.swift */,
|
||||||
|
0A25209524645AFD000FA9F6 /* TextViewEntryField.swift */,
|
||||||
);
|
);
|
||||||
path = TextFields;
|
path = TextFields;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -1748,7 +1754,6 @@
|
|||||||
D2B18B7D236090D500A9AEDC /* BaseClasses */ = {
|
D2B18B7D236090D500A9AEDC /* BaseClasses */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
0A6682B4243769C700AD3CA1 /* TextViewModel.swift */,
|
|
||||||
0A6682B3243769C700AD3CA1 /* TextView.swift */,
|
0A6682B3243769C700AD3CA1 /* TextView.swift */,
|
||||||
C003506023AA94CD00B6AC29 /* Button.swift */,
|
C003506023AA94CD00B6AC29 /* Button.swift */,
|
||||||
D2B18B7E2360913400A9AEDC /* Control.swift */,
|
D2B18B7E2360913400A9AEDC /* Control.swift */,
|
||||||
@ -1760,6 +1765,7 @@
|
|||||||
D264FAA92440F97600D98315 /* CollectionView.swift */,
|
D264FAA92440F97600D98315 /* CollectionView.swift */,
|
||||||
0A5D59C323AD488600EFD9E9 /* Protocols */,
|
0A5D59C323AD488600EFD9E9 /* Protocols */,
|
||||||
0A7918F423F5E7EA00772FF4 /* ImageView.swift */,
|
0A7918F423F5E7EA00772FF4 /* ImageView.swift */,
|
||||||
|
0A2520A824646230000FA9F6 /* TextViewModel.swift */,
|
||||||
);
|
);
|
||||||
path = BaseClasses;
|
path = BaseClasses;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -2022,10 +2028,12 @@
|
|||||||
014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */,
|
014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */,
|
||||||
D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */,
|
D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */,
|
||||||
D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */,
|
D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */,
|
||||||
|
0A2520A924646230000FA9F6 /* TextViewModel.swift in Sources */,
|
||||||
94C2D9A723872DA90006CF46 /* LabelAttributeColorModel.swift in Sources */,
|
94C2D9A723872DA90006CF46 /* LabelAttributeColorModel.swift in Sources */,
|
||||||
943820842432382400B43AF3 /* WebView.swift in Sources */,
|
943820842432382400B43AF3 /* WebView.swift in Sources */,
|
||||||
0103B84E23D7E33A009C315C /* HeadlineBodyToggleModel.swift in Sources */,
|
0103B84E23D7E33A009C315C /* HeadlineBodyToggleModel.swift in Sources */,
|
||||||
D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */,
|
D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */,
|
||||||
|
0A25209624645AFD000FA9F6 /* TextViewEntryField.swift in Sources */,
|
||||||
014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */,
|
014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */,
|
||||||
AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */,
|
AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */,
|
||||||
011D9626240EBB16000E3791 /* RadioButtonLabelModel.swift in Sources */,
|
011D9626240EBB16000E3791 /* RadioButtonLabelModel.swift in Sources */,
|
||||||
@ -2138,7 +2146,6 @@
|
|||||||
012A88B1238C880100FE3DA1 /* CarouselPagingModelProtocol.swift in Sources */,
|
012A88B1238C880100FE3DA1 /* CarouselPagingModelProtocol.swift in Sources */,
|
||||||
0A9D091E2433796500D2E6C0 /* NumericCarouselIndicatorModel.swift in Sources */,
|
0A9D091E2433796500D2E6C0 /* NumericCarouselIndicatorModel.swift in Sources */,
|
||||||
D29DF2C921E7BFC6003B2FB9 /* MFSizeObject.m in Sources */,
|
D29DF2C921E7BFC6003B2FB9 /* MFSizeObject.m in Sources */,
|
||||||
0A6682B6243769C700AD3CA1 /* TextViewModel.swift in Sources */,
|
|
||||||
9445890E2385C3F800DE9FD4 /* MultiProgressModel.swift in Sources */,
|
9445890E2385C3F800DE9FD4 /* MultiProgressModel.swift in Sources */,
|
||||||
011D95A5240455DC000E3791 /* FormGroupRule.swift in Sources */,
|
011D95A5240455DC000E3791 /* FormGroupRule.swift in Sources */,
|
||||||
D2A6390522CBCE160052ED1F /* MoleculeCollectionViewCell.swift in Sources */,
|
D2A6390522CBCE160052ED1F /* MoleculeCollectionViewCell.swift in Sources */,
|
||||||
@ -2257,6 +2264,7 @@
|
|||||||
AA26850C244840AE00CE34CC /* HeadersH2TinyButton.swift in Sources */,
|
AA26850C244840AE00CE34CC /* HeadersH2TinyButton.swift in Sources */,
|
||||||
011D95AB2405C553000E3791 /* FormItemProtocol.swift in Sources */,
|
011D95AB2405C553000E3791 /* FormItemProtocol.swift in Sources */,
|
||||||
D21EE53C23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift in Sources */,
|
D21EE53C23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift in Sources */,
|
||||||
|
0A25209824645B76000FA9F6 /* TextViewEntryFieldModel.swift in Sources */,
|
||||||
525019DD2406430800EED91C /* ListProgressBarDataModel.swift in Sources */,
|
525019DD2406430800EED91C /* ListProgressBarDataModel.swift in Sources */,
|
||||||
C6FA7D5223C77A4A00A3614A /* UnOrderedList.swift in Sources */,
|
C6FA7D5223C77A4A00A3614A /* UnOrderedList.swift in Sources */,
|
||||||
01509D8F2327EC6F00EF99AA /* MoleculeTableViewCell.swift in Sources */,
|
01509D8F2327EC6F00EF99AA /* MoleculeTableViewCell.swift in Sources */,
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import Foundation
|
|||||||
public var title: String?
|
public var title: String?
|
||||||
public var feedback: String?
|
public var feedback: String?
|
||||||
public var errorMessage: String?
|
public var errorMessage: String?
|
||||||
|
public var errorTextColor: Color?
|
||||||
public var enabled: Bool = true
|
public var enabled: Bool = true
|
||||||
public var showError: Bool?
|
public var showError: Bool?
|
||||||
public var locked: Bool?
|
public var locked: Bool?
|
||||||
@ -37,7 +38,7 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Temporary binding mechanism for the view to update on enable changes.
|
/// Temporary binding mechanism for the view to update on enable changes.
|
||||||
public var updateUI: (() -> ())?
|
public var updateUI: ActionBlock?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
@ -50,6 +51,7 @@ import Foundation
|
|||||||
case enabled
|
case enabled
|
||||||
case feedback
|
case feedback
|
||||||
case errorMessage
|
case errorMessage
|
||||||
|
case errorTextColor
|
||||||
case locked
|
case locked
|
||||||
case selected
|
case selected
|
||||||
case showError
|
case showError
|
||||||
@ -89,6 +91,7 @@ import Foundation
|
|||||||
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
||||||
feedback = try typeContainer.decodeIfPresent(String.self, forKey: .feedback)
|
feedback = try typeContainer.decodeIfPresent(String.self, forKey: .feedback)
|
||||||
errorMessage = try typeContainer.decodeIfPresent(String.self, forKey: .errorMessage)
|
errorMessage = try typeContainer.decodeIfPresent(String.self, forKey: .errorMessage)
|
||||||
|
errorTextColor = try typeContainer.decodeIfPresent(Color.self, forKey: .errorTextColor)
|
||||||
enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) ?? true
|
enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) ?? true
|
||||||
locked = try typeContainer.decodeIfPresent(Bool.self, forKey: .locked)
|
locked = try typeContainer.decodeIfPresent(Bool.self, forKey: .locked)
|
||||||
selected = try typeContainer.decodeIfPresent(Bool.self, forKey: .selected)
|
selected = try typeContainer.decodeIfPresent(Bool.self, forKey: .selected)
|
||||||
@ -111,6 +114,7 @@ import Foundation
|
|||||||
try container.encodeIfPresent(locked, forKey: .locked)
|
try container.encodeIfPresent(locked, forKey: .locked)
|
||||||
try container.encodeIfPresent(showError, forKey: .showError)
|
try container.encodeIfPresent(showError, forKey: .showError)
|
||||||
try container.encodeIfPresent(selected, forKey: .selected)
|
try container.encodeIfPresent(selected, forKey: .selected)
|
||||||
|
try container.encodeIfPresent(errorTextColor, forKey: .errorTextColor)
|
||||||
try container.encodeIfPresent(errorMessage, forKey: .errorMessage)
|
try container.encodeIfPresent(errorMessage, forKey: .errorMessage)
|
||||||
try container.encode(enabled, forKey: .enabled)
|
try container.encode(enabled, forKey: .enabled)
|
||||||
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
|
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
|
||||||
|
|||||||
136
MVMCoreUI/Atomic/Atoms/TextFields/TextViewEntryField.swift
Normal file
136
MVMCoreUI/Atomic/Atoms/TextFields/TextViewEntryField.swift
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
//
|
||||||
|
// TextViewEntryField.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Kevin Christiano on 5/7/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
|
class TextViewEntryField: EntryField {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Outlets
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
open private(set) var textView: TextView = {
|
||||||
|
let textView = TextView()
|
||||||
|
textView.isAccessibilityElement = true
|
||||||
|
textView.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
|
textView.font = Styler.Font.RegularBodyLarge.getFont()
|
||||||
|
textView.textColor = .mvmBlack
|
||||||
|
textView.smartQuotesType = .no
|
||||||
|
textView.smartDashesType = .no
|
||||||
|
textView.smartInsertDeleteType = .no
|
||||||
|
return textView
|
||||||
|
}()
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Constraint
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public var heightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Lifecycle
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
@objc open override func setupFieldContainerContent(_ container: UIView) {
|
||||||
|
|
||||||
|
textView.font = Styler.Font.RegularBodyLarge.getFont()
|
||||||
|
container.addSubview(textView)
|
||||||
|
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
textView.topAnchor.constraint(equalTo: container.topAnchor),
|
||||||
|
textView.leadingAnchor.constraint(equalTo: container.leadingAnchor),
|
||||||
|
container.trailingAnchor.constraint(equalTo: textView.leadingAnchor),
|
||||||
|
container.bottomAnchor.constraint(equalTo: textView.bottomAnchor)
|
||||||
|
])
|
||||||
|
|
||||||
|
heightConstraint = textView.heightAnchor.constraint(equalToConstant: 0)
|
||||||
|
|
||||||
|
|
||||||
|
// textView.addTarget(self, action: #selector(startEditing), for: .editingDidBegin)
|
||||||
|
// textView.addTarget(self, action: #selector(dismissFieldInput), for: .editingDidEnd)
|
||||||
|
//
|
||||||
|
// let tap = UITapGestureRecognizer(target: self, action: #selector(startEditing))
|
||||||
|
// entryFieldContainer.addGestureRecognizer(tap)
|
||||||
|
|
||||||
|
accessibilityElements = [titleLabel, textView, feedbackLabel]
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc open override func updateView(_ size: CGFloat) {
|
||||||
|
super.updateView(size)
|
||||||
|
|
||||||
|
textView.font = Styler.Font.RegularBodyLarge.getFont()
|
||||||
|
layoutIfNeeded()
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func reset() {
|
||||||
|
super.reset()
|
||||||
|
|
||||||
|
textView.font = Styler.Font.RegularBodyLarge.getFont()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
|
if let color = model.backgroundColor?.uiColor {
|
||||||
|
backgroundColor = color
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let model = model as? TextViewEntryFieldModel else { return }
|
||||||
|
|
||||||
|
heightConstraint?.isActive = false
|
||||||
|
if let height = model.height {
|
||||||
|
heightConstraint?.constant = height
|
||||||
|
heightConstraint?.isActive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
textView.isEditable = model.editable
|
||||||
|
textView.textAlignment = model.textAlignment
|
||||||
|
textView.textColor = model.enabledTextColor.uiColor
|
||||||
|
// textView.hideBorders = model.hideBorders
|
||||||
|
text = model.text
|
||||||
|
textView.uiTextViewDelegate = delegateObject?.uiTextViewDelegate
|
||||||
|
|
||||||
|
if let accessibilityText = model.accessibilityText {
|
||||||
|
accessibilityLabel = accessibilityText
|
||||||
|
}
|
||||||
|
|
||||||
|
switch model.type {
|
||||||
|
case .secure, .password:
|
||||||
|
textView.isSecureTextEntry = true
|
||||||
|
case .number:
|
||||||
|
textView.keyboardType = .numberPad
|
||||||
|
case .email:
|
||||||
|
textView.keyboardType = .emailAddress
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
textView.font = model.fontStyle.getFont()
|
||||||
|
textView.setPlaceholderIfAvailable()
|
||||||
|
|
||||||
|
if isEditable {
|
||||||
|
FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate)
|
||||||
|
let observingDelegate = delegateObject?.uiTextViewDelegate ?? self
|
||||||
|
inputAccessoryView = UIToolbar.getToolbarWithDoneButton(delegate: observingDelegate,
|
||||||
|
action: #selector(textView.dismissFieldInput))
|
||||||
|
|
||||||
|
if (model.selected ?? false) && !model.wasInitiallySelected {
|
||||||
|
model.wasInitiallySelected = true
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.becomeFirstResponder()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !model.enabled {
|
||||||
|
isEnabled = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
//
|
||||||
|
// TextViewEntryFieldModel.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Kevin Christiano on 5/7/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
class TextViewEntryFieldModel: TextEntryFieldModel {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public override class var identifier: String {
|
||||||
|
return "textView"
|
||||||
|
}
|
||||||
|
|
||||||
|
public var accessibilityText: String?
|
||||||
|
public var fontStyle: Styler.Font = Styler.Font.RegularBodySmall
|
||||||
|
public var textAlignment: NSTextAlignment = .left
|
||||||
|
public var height: CGFloat?
|
||||||
|
public var placeholderTextColor: Color = Color(uiColor: .mvmCoolGray3)
|
||||||
|
public var placeholderFontStyle: Styler.Font = Styler.Font.RegularMicro
|
||||||
|
public var showsPlaceholder: Bool = false
|
||||||
|
public var hideBorders: Bool = false
|
||||||
|
public var editable: Bool = true
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case text
|
||||||
|
case accessibilityText
|
||||||
|
case fontStyle
|
||||||
|
case textAlignment
|
||||||
|
case height
|
||||||
|
case hideBorders
|
||||||
|
case placeholderFontStyle
|
||||||
|
case placeholderTextColor
|
||||||
|
case editable
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Codec
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
required public init(from decoder: Decoder) throws {
|
||||||
|
try super.init(from: decoder)
|
||||||
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
if let placeholderFontStyle = try typeContainer.decodeIfPresent(Styler.Font.self, forKey: .placeholderFontStyle) {
|
||||||
|
self.placeholderFontStyle = placeholderFontStyle
|
||||||
|
}
|
||||||
|
|
||||||
|
if let placeholderTextColor = try typeContainer.decodeIfPresent(Color.self, forKey: .placeholderTextColor) {
|
||||||
|
self.placeholderTextColor = placeholderTextColor
|
||||||
|
}
|
||||||
|
|
||||||
|
if let textAlignment = try typeContainer.decodeIfPresent(NSTextAlignment.self, forKey: .textAlignment) {
|
||||||
|
self.textAlignment = textAlignment
|
||||||
|
}
|
||||||
|
|
||||||
|
if let hideBorders = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideBorders) {
|
||||||
|
self.hideBorders = hideBorders
|
||||||
|
}
|
||||||
|
|
||||||
|
if let editable = try typeContainer.decodeIfPresent(Bool.self, forKey: .editable) {
|
||||||
|
self.editable = editable
|
||||||
|
}
|
||||||
|
|
||||||
|
if let fontStyle = try typeContainer.decodeIfPresent(Styler.Font.self, forKey: .fontStyle) {
|
||||||
|
self.fontStyle = fontStyle
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||||
|
height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height)
|
||||||
|
}
|
||||||
|
|
||||||
|
public override func encode(to encoder: Encoder) throws {
|
||||||
|
try super.encode(to: encoder)
|
||||||
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
||||||
|
try container.encodeIfPresent(height, forKey: .height)
|
||||||
|
try container.encode(fontStyle, forKey: .fontStyle)
|
||||||
|
try container.encode(hideBorders, forKey: .hideBorders)
|
||||||
|
try container.encode(text, forKey: .text)
|
||||||
|
try container.encode(placeholderFontStyle, forKey: .placeholderFontStyle)
|
||||||
|
try container.encode(placeholderTextColor, forKey: .placeholderTextColor)
|
||||||
|
try container.encode(textAlignment, forKey: .textAlignment)
|
||||||
|
try container.encode(editable, forKey: .editable)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -26,10 +26,10 @@ import UIKit
|
|||||||
/// Set to true to hide the blinking textField cursor.
|
/// Set to true to hide the blinking textField cursor.
|
||||||
public var hideBlinkingCaret = false
|
public var hideBlinkingCaret = false
|
||||||
|
|
||||||
public var textViewModel: TextViewModel? {
|
public var textViewEntryFieldModel: TextViewEntryFieldModel? {
|
||||||
return model as? TextViewModel
|
return model as? TextViewEntryFieldModel
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Drawing Properties
|
// MARK: - Drawing Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -101,7 +101,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Delegate
|
// MARK: - Delegate
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -190,7 +190,7 @@ import UIKit
|
|||||||
smartDashesType = .no
|
smartDashesType = .no
|
||||||
smartInsertDeleteType = .no
|
smartInsertDeleteType = .no
|
||||||
inputAccessoryView = nil
|
inputAccessoryView = nil
|
||||||
font = textViewModel?.fontStyle.getFont()
|
// font = textViewModel?.fontStyle.getFont()
|
||||||
isEditable = true
|
isEditable = true
|
||||||
isOpaque = false
|
isOpaque = false
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ import UIKit
|
|||||||
inputAccessoryView = nil
|
inputAccessoryView = nil
|
||||||
initialConfiguration()
|
initialConfiguration()
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
open override func layoutSubviews() {
|
open override func layoutSubviews() {
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ import UIKit
|
|||||||
bottomStrokeColor = .mvmCoolGray3
|
bottomStrokeColor = .mvmCoolGray3
|
||||||
textColor = textViewModel?.disabledTextColor.uiColor
|
textColor = textViewModel?.disabledTextColor.uiColor
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Methods
|
// MARK: - Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -424,67 +424,3 @@ import UIKit
|
|||||||
proprietorTextDelegate?.textViewDidEndEditing?(textView)
|
proprietorTextDelegate?.textViewDidEndEditing?(textView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- MoleculeViewProtocol
|
|
||||||
extension TextView: MoleculeViewProtocol {
|
|
||||||
|
|
||||||
open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
|
||||||
self.model = model
|
|
||||||
self.delegateObject = delegateObject
|
|
||||||
|
|
||||||
if let color = model.backgroundColor?.uiColor {
|
|
||||||
backgroundColor = color
|
|
||||||
}
|
|
||||||
|
|
||||||
guard let model = model as? TextViewModel else { return }
|
|
||||||
|
|
||||||
heightConstraint?.isActive = false
|
|
||||||
if let height = model.height {
|
|
||||||
heightConstraint = heightAnchor.constraint(equalToConstant: height)
|
|
||||||
heightConstraint?.isActive = true
|
|
||||||
}
|
|
||||||
|
|
||||||
isEditable = model.editable
|
|
||||||
textAlignment = model.textAlignment
|
|
||||||
textColor = model.enabledTextColor.uiColor
|
|
||||||
hideBorders = model.hideBorders
|
|
||||||
text = model.text
|
|
||||||
uiTextViewDelegate = delegateObject?.uiTextViewDelegate
|
|
||||||
|
|
||||||
if let accessibilityText = model.accessibilityText {
|
|
||||||
accessibilityLabel = accessibilityText
|
|
||||||
}
|
|
||||||
|
|
||||||
switch model.type {
|
|
||||||
case .secure, .password:
|
|
||||||
isSecureTextEntry = true
|
|
||||||
case .number:
|
|
||||||
keyboardType = .numberPad
|
|
||||||
case .email:
|
|
||||||
keyboardType = .emailAddress
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
font = model.fontStyle.getFont()
|
|
||||||
setPlaceholderIfAvailable()
|
|
||||||
|
|
||||||
if isEditable {
|
|
||||||
FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate)
|
|
||||||
let observingDelegate = delegateObject?.uiTextViewDelegate ?? self
|
|
||||||
inputAccessoryView = UIToolbar.getToolbarWithDoneButton(delegate: observingDelegate,
|
|
||||||
action: #selector(dismissFieldInput))
|
|
||||||
|
|
||||||
if (model.selected ?? false) && !model.wasInitiallySelected {
|
|
||||||
model.wasInitiallySelected = true
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
self.becomeFirstResponder()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !model.enabled {
|
|
||||||
isEnabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -2,95 +2,8 @@
|
|||||||
// TextViewModel.swift
|
// TextViewModel.swift
|
||||||
// MVMCoreUI
|
// MVMCoreUI
|
||||||
//
|
//
|
||||||
// Created by Kevin Christiano on 4/2/20.
|
// Created by Kevin Christiano on 5/7/20.
|
||||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
open class TextViewModel: TextEntryFieldModel {
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Properties
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
public override class var identifier: String {
|
|
||||||
return "textView"
|
|
||||||
}
|
|
||||||
|
|
||||||
public var accessibilityText: String?
|
|
||||||
public var fontStyle: Styler.Font = Styler.Font.RegularBodySmall
|
|
||||||
public var textAlignment: NSTextAlignment = .left
|
|
||||||
public var height: CGFloat?
|
|
||||||
public var placeholderTextColor: Color = Color(uiColor: .mvmCoolGray3)
|
|
||||||
public var placeholderFontStyle: Styler.Font = Styler.Font.RegularMicro
|
|
||||||
public var showsPlaceholder: Bool = false
|
|
||||||
public var hideBorders: Bool = false
|
|
||||||
public var editable: Bool = true
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Keys
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
|
||||||
case text
|
|
||||||
case accessibilityText
|
|
||||||
case fontStyle
|
|
||||||
case textAlignment
|
|
||||||
case height
|
|
||||||
case hideBorders
|
|
||||||
case placeholderFontStyle
|
|
||||||
case placeholderTextColor
|
|
||||||
case editable
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Codec
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
|
||||||
try super.init(from: decoder)
|
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
|
||||||
|
|
||||||
if let placeholderFontStyle = try typeContainer.decodeIfPresent(Styler.Font.self, forKey: .placeholderFontStyle) {
|
|
||||||
self.placeholderFontStyle = placeholderFontStyle
|
|
||||||
}
|
|
||||||
|
|
||||||
if let placeholderTextColor = try typeContainer.decodeIfPresent(Color.self, forKey: .placeholderTextColor) {
|
|
||||||
self.placeholderTextColor = placeholderTextColor
|
|
||||||
}
|
|
||||||
|
|
||||||
if let textAlignment = try typeContainer.decodeIfPresent(NSTextAlignment.self, forKey: .textAlignment) {
|
|
||||||
self.textAlignment = textAlignment
|
|
||||||
}
|
|
||||||
|
|
||||||
if let hideBorders = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideBorders) {
|
|
||||||
self.hideBorders = hideBorders
|
|
||||||
}
|
|
||||||
|
|
||||||
if let editable = try typeContainer.decodeIfPresent(Bool.self, forKey: .editable) {
|
|
||||||
self.editable = editable
|
|
||||||
}
|
|
||||||
|
|
||||||
if let fontStyle = try typeContainer.decodeIfPresent(Styler.Font.self, forKey: .fontStyle) {
|
|
||||||
self.fontStyle = fontStyle
|
|
||||||
}
|
|
||||||
|
|
||||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
|
||||||
height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override func encode(to encoder: Encoder) throws {
|
|
||||||
try super.encode(to: encoder)
|
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
||||||
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
|
||||||
try container.encodeIfPresent(height, forKey: .height)
|
|
||||||
try container.encode(fontStyle, forKey: .fontStyle)
|
|
||||||
try container.encode(hideBorders, forKey: .hideBorders)
|
|
||||||
try container.encode(text, forKey: .text)
|
|
||||||
try container.encode(placeholderFontStyle, forKey: .placeholderFontStyle)
|
|
||||||
try container.encode(placeholderTextColor, forKey: .placeholderTextColor)
|
|
||||||
try container.encode(textAlignment, forKey: .textAlignment)
|
|
||||||
try container.encode(editable, forKey: .editable)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user