added tooltip
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
bde65dcd13
commit
eb9a239f67
@ -71,6 +71,7 @@ public class ModelScrollViewController<ModelType: Modelable>: UIViewController,
|
||||
initialSetupPerformed = true
|
||||
setupUpdateView()
|
||||
setup()
|
||||
contentTopView.backgroundColor = Surface.light.color
|
||||
surfacePickerSelectorView.scrollToBottom = { [weak self] in self?.scrollToBottom()}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ class TextEntryFieldViewController: ModelScrollViewController<DefaultTextEntryF
|
||||
}()
|
||||
|
||||
var disabledSwitch = UISwitch()
|
||||
var requiredSwitch = UISwitch()
|
||||
var labelTextField = TextField()
|
||||
var errorTextField = TextField()
|
||||
var successTextField = TextField()
|
||||
@ -27,6 +28,8 @@ class TextEntryFieldViewController: ModelScrollViewController<DefaultTextEntryF
|
||||
var widthTextField = TextField()
|
||||
var showErrorSwitch = UISwitch()
|
||||
var showSuccessSwitch = UISwitch()
|
||||
var tooltipTitleTextField = TextField()
|
||||
var tooltipContentTextField = TextField()
|
||||
|
||||
var textEntryField = TextEntryField()
|
||||
|
||||
@ -46,11 +49,14 @@ class TextEntryFieldViewController: ModelScrollViewController<DefaultTextEntryF
|
||||
defaultModel.helperText = "For example: 123 Verizon St"
|
||||
defaultModel.errorText = "Enter a valid address."
|
||||
defaultModel.successText = "Good job entering a valid address!"
|
||||
defaultModel.tooltipTitle = "Check the formatting of your address"
|
||||
defaultModel.tooltipContent = "House/Building number then street name"
|
||||
return defaultModel
|
||||
}
|
||||
|
||||
func setupForm(){
|
||||
addFormRow(label: "Disabled", view: disabledSwitch)
|
||||
addFormRow(label: "Required", view: requiredSwitch)
|
||||
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||
addFormRow(label: "Label Text", view: labelTextField)
|
||||
addFormRow(label: "Helper Text Placement", view: helperTextPlacementPickerSelectorView)
|
||||
@ -60,6 +66,8 @@ class TextEntryFieldViewController: ModelScrollViewController<DefaultTextEntryF
|
||||
addFormRow(label: "Success", view: showSuccessSwitch)
|
||||
addFormRow(label: "Success Text", view: successTextField)
|
||||
addFormRow(label: "Width", view: widthTextField)
|
||||
addFormRow(label: "ToolTip Title", view: tooltipTitleTextField)
|
||||
addFormRow(label: "ToolTip Content", view: tooltipContentTextField)
|
||||
|
||||
textEntryField
|
||||
.handlerPublisher()
|
||||
@ -67,6 +75,12 @@ class TextEntryFieldViewController: ModelScrollViewController<DefaultTextEntryF
|
||||
self?.model = viewModel
|
||||
}.store(in: &subscribers)
|
||||
|
||||
requiredSwitch
|
||||
.publisher(for: .valueChanged)
|
||||
.sink { [weak self] sender in
|
||||
self?.textEntryField.required = sender.isOn
|
||||
}.store(in: &subscribers)
|
||||
|
||||
showErrorSwitch
|
||||
.publisher(for: .valueChanged)
|
||||
.sink { [weak self] sender in
|
||||
@ -109,7 +123,19 @@ class TextEntryFieldViewController: ModelScrollViewController<DefaultTextEntryF
|
||||
guard let width = Float(width) else { return }
|
||||
self?.textEntryField.width = CGFloat(width)
|
||||
}.store(in: &subscribers)
|
||||
|
||||
tooltipTitleTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
self?.textEntryField.tooltipTitle = text
|
||||
}.store(in: &subscribers)
|
||||
|
||||
tooltipContentTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
self?.textEntryField.tooltipContent = text
|
||||
}.store(in: &subscribers)
|
||||
|
||||
}
|
||||
|
||||
func setupModel(model: DefaultTextEntryField) {
|
||||
@ -134,12 +160,15 @@ class TextEntryFieldViewController: ModelScrollViewController<DefaultTextEntryF
|
||||
//setup UI
|
||||
surfacePickerSelectorView.text = model.surface.rawValue
|
||||
disabledSwitch.isOn = model.disabled
|
||||
requiredSwitch.isOn = model.required
|
||||
labelTextField.text = model.labelText
|
||||
helperTextField.text = model.helperText
|
||||
showErrorSwitch.isOn = model.showError
|
||||
errorTextField.text = model.errorText
|
||||
showSuccessSwitch.isOn = model.showSuccess
|
||||
successTextField.text = model.successText
|
||||
tooltipTitleTextField.text = model.tooltipTitle
|
||||
tooltipContentTextField.text = model.tooltipContent
|
||||
if let width = model.width {
|
||||
widthTextField.text = String(describing: width)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user