Digital ACT191 story ONEAPP-6682 Character limit, readonly changes.
This commit is contained in:
parent
44deb6a680
commit
16d35a215e
@ -23,6 +23,7 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
||||
var tooltipTitleTextField = TextField()
|
||||
var tooltipContentTextField = TextField()
|
||||
var maxLengthTextField = NumericField()
|
||||
var readOnlySwitch = Toggle()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@ -39,12 +40,12 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
||||
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||
addFormRow(label: "Label Text", view: labelTextField)
|
||||
addFormRow(label: "Helper Text", view: helperTextField)
|
||||
addFormRow(label: "Read Only", view: readOnlySwitch)
|
||||
addFormRow(label: "Error", view: showErrorSwitch)
|
||||
addFormRow(label: "Error Text", view: errorTextField)
|
||||
addFormRow(label: "Width", view: widthTextField)
|
||||
addFormRow(label: "ToolTip Title", view: tooltipTitleTextField)
|
||||
addFormRow(label: "ToolTip Content", view: tooltipContentTextField)
|
||||
addFormRow(label: "Max Length", view: maxLengthTextField)
|
||||
addFormRow(label: "Character Count", view: maxLengthTextField)
|
||||
|
||||
requiredSwitch.onChange = { [weak self] sender in
|
||||
self?.component.required = sender.isOn
|
||||
@ -62,6 +63,10 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
||||
self?.component.isEnabled = !sender.isOn
|
||||
}
|
||||
|
||||
readOnlySwitch.onChange = { [weak self] sender in
|
||||
self?.component.readOnly = sender.isOn
|
||||
}
|
||||
|
||||
labelTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
@ -113,7 +118,6 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
||||
component.helperText = "For example: 123 Verizon St"
|
||||
component.errorText = "Enter a valid address."
|
||||
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
|
||||
component.maxLength = 10
|
||||
component
|
||||
.publisher(for: .valueChanged)
|
||||
.sink { component in
|
||||
@ -132,7 +136,6 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
||||
helperTextField.text = component.helperText
|
||||
showErrorSwitch.isOn = component.showError
|
||||
errorTextField.text = component.errorText
|
||||
maxLengthTextField.text = String(component.maxLength ?? 0)
|
||||
tooltipTitleTextField.text = component.tooltipModel?.title
|
||||
tooltipContentTextField.text = component.tooltipModel?.content
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user