Merge branch 'mbruce/bugfix' into 'develop'

added TextLinkModel to the EntryFieldBase

See merge request BPHV_MIPS/vds_ios!205
This commit is contained in:
Bruce, Matt R 2024-04-16 14:52:52 +00:00
commit 2aae39f5ea
4 changed files with 49 additions and 4 deletions

View File

@ -89,6 +89,7 @@
EA5F86C82A1BD99100BC83E4 /* TabModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5F86C72A1BD99100BC83E4 /* TabModel.swift */; }; EA5F86C82A1BD99100BC83E4 /* TabModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5F86C72A1BD99100BC83E4 /* TabModel.swift */; };
EA5F86CC2A1D28B500BC83E4 /* ReleaseNotes.txt in Resources */ = {isa = PBXBuildFile; fileRef = EA5F86CB2A1D28B500BC83E4 /* ReleaseNotes.txt */; }; EA5F86CC2A1D28B500BC83E4 /* ReleaseNotes.txt in Resources */ = {isa = PBXBuildFile; fileRef = EA5F86CB2A1D28B500BC83E4 /* ReleaseNotes.txt */; };
EA5F86D02A1F936100BC83E4 /* TabsContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5F86CF2A1F936100BC83E4 /* TabsContainer.swift */; }; EA5F86D02A1F936100BC83E4 /* TabsContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5F86CF2A1F936100BC83E4 /* TabsContainer.swift */; };
EA6642952BCEBF9500D81DC4 /* TextLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA6642942BCEBF9500D81DC4 /* TextLinkModel.swift */; };
EA6F330E2B911E9000BACAB9 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA6F330D2B911E9000BACAB9 /* TextView.swift */; }; EA6F330E2B911E9000BACAB9 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA6F330D2B911E9000BACAB9 /* TextView.swift */; };
EA81410B2A0E8E3C004F60D2 /* ButtonIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA81410A2A0E8E3C004F60D2 /* ButtonIcon.swift */; }; EA81410B2A0E8E3C004F60D2 /* ButtonIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA81410A2A0E8E3C004F60D2 /* ButtonIcon.swift */; };
EA8141102A127066004F60D2 /* UIColor+VDSColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA81410F2A127066004F60D2 /* UIColor+VDSColor.swift */; }; EA8141102A127066004F60D2 /* UIColor+VDSColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA81410F2A127066004F60D2 /* UIColor+VDSColor.swift */; };
@ -278,6 +279,7 @@
EA5F86C72A1BD99100BC83E4 /* TabModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabModel.swift; sourceTree = "<group>"; }; EA5F86C72A1BD99100BC83E4 /* TabModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabModel.swift; sourceTree = "<group>"; };
EA5F86CB2A1D28B500BC83E4 /* ReleaseNotes.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = ReleaseNotes.txt; sourceTree = "<group>"; }; EA5F86CB2A1D28B500BC83E4 /* ReleaseNotes.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = ReleaseNotes.txt; sourceTree = "<group>"; };
EA5F86CF2A1F936100BC83E4 /* TabsContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsContainer.swift; sourceTree = "<group>"; }; EA5F86CF2A1F936100BC83E4 /* TabsContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsContainer.swift; sourceTree = "<group>"; };
EA6642942BCEBF9500D81DC4 /* TextLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextLinkModel.swift; sourceTree = "<group>"; };
EA6F330D2B911E9000BACAB9 /* TextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; }; EA6F330D2B911E9000BACAB9 /* TextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; };
EA81410A2A0E8E3C004F60D2 /* ButtonIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonIcon.swift; sourceTree = "<group>"; }; EA81410A2A0E8E3C004F60D2 /* ButtonIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonIcon.swift; sourceTree = "<group>"; };
EA81410F2A127066004F60D2 /* UIColor+VDSColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+VDSColor.swift"; sourceTree = "<group>"; }; EA81410F2A127066004F60D2 /* UIColor+VDSColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+VDSColor.swift"; sourceTree = "<group>"; };
@ -884,6 +886,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
EAC925872911C9DE00091998 /* InputField.swift */, EAC925872911C9DE00091998 /* InputField.swift */,
EA6642942BCEBF9500D81DC4 /* TextLinkModel.swift */,
); );
path = InputField; path = InputField;
sourceTree = "<group>"; sourceTree = "<group>";
@ -1108,6 +1111,7 @@
71BFA70A2B7F70E6000DCE33 /* DropShadowable.swift in Sources */, 71BFA70A2B7F70E6000DCE33 /* DropShadowable.swift in Sources */,
EA0D1C452A6AD73000E5C127 /* RawRepresentable.swift in Sources */, EA0D1C452A6AD73000E5C127 /* RawRepresentable.swift in Sources */,
EA985C23296E033A00F2FF2E /* TextArea.swift in Sources */, EA985C23296E033A00F2FF2E /* TextArea.swift in Sources */,
EA6642952BCEBF9500D81DC4 /* TextLinkModel.swift in Sources */,
71FC86E22B97483000700965 /* Clamping.swift in Sources */, 71FC86E22B97483000700965 /* Clamping.swift in Sources */,
EAF7F0B3289B1ADC00B287F5 /* ActionLabelAttribute.swift in Sources */, EAF7F0B3289B1ADC00B287F5 /* ActionLabelAttribute.swift in Sources */,
1855EC662BAABF2A002ACAC2 /* BreadcrumbItemModel.swift in Sources */, 1855EC662BAABF2A002ACAC2 /* BreadcrumbItemModel.swift in Sources */,

View File

@ -143,7 +143,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
} }
open var icon: Icon = Icon().with { open var icon: Icon = Icon().with {
$0.size = .small $0.size = .medium
} }
open var labelText: String? { didSet { setNeedsUpdate() } } open var labelText: String? { didSet { setNeedsUpdate() } }

View File

@ -77,6 +77,10 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
/// Representing the type of input. /// Representing the type of input.
open var fieldType: FieldType = .text { didSet { setNeedsUpdate() } } open var fieldType: FieldType = .text { didSet { setNeedsUpdate() } }
internal var actionTextLink = TextLink().with { $0.contentEdgeInsets = .top(-2) }
internal var actionTextLinkModel: TextLinkModel? { didSet { setNeedsUpdate() } }
/// The text of this TextField. /// The text of this TextField.
private var _text: String? private var _text: String?
open var text: String? { open var text: String? {
@ -134,6 +138,7 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
return state return state
} }
} }
/// If given, this will be shown if showSuccess if true. /// If given, this will be shown if showSuccess if true.
open var successText: String? { didSet { setNeedsUpdate() } } open var successText: String? { didSet { setNeedsUpdate() } }
@ -169,6 +174,8 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
stackView.addArrangedSubview(successLabel) stackView.addArrangedSubview(successLabel)
stackView.setCustomSpacing(8, after: successLabel) stackView.setCustomSpacing(8, after: successLabel)
containerStackView.addArrangedSubview(actionTextLink)
successLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable() successLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
backgroundColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessBackgroundOnlight, VDSColor.feedbackSuccessBackgroundOndark, forState: .success) backgroundColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessBackgroundOnlight, VDSColor.feedbackSuccessBackgroundOndark, forState: .success)
@ -204,6 +211,16 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
textField.isEnabled = isEnabled textField.isEnabled = isEnabled
textField.textColor = textFieldTextColorConfiguration.getColor(self) textField.textColor = textFieldTextColorConfiguration.getColor(self)
if let actionTextLinkModel {
actionTextLink.text = actionTextLinkModel.text
actionTextLink.onClick = actionTextLinkModel.onClick
actionTextLink.isHidden = false
containerStackView.setCustomSpacing(VDSLayout.space2X, after: icon)
} else {
actionTextLink.isHidden = true
containerStackView.setCustomSpacing(0, after: icon)
}
//show error or success //show error or success
if showError, let _ = errorText { if showError, let _ = errorText {
successLabel.isHidden = true successLabel.isHidden = true

View File

@ -0,0 +1,24 @@
//
// EntryFieldTextLinkModel.swift
// VDS
//
// Created by Matt Bruce on 4/16/24.
//
import Foundation
extension InputField {
public struct TextLinkModel {
///Text that goes in the Tab
public var text: String
///Click event when you click on a tab
public var onClick: ((TextLink) -> Void)?
public init(text: String, onClick: ((TextLink) -> Void)? = nil) {
self.text = text
self.onClick = onClick
}
}
}