Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/vds_ios_sample.git into refactor/VDSTokens
This commit is contained in:
commit
d54a0659de
@ -34,6 +34,7 @@
|
|||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
1808BEBE2BA4479500129230 /* CarouselScrollbarViewConttroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */; };
|
1808BEBE2BA4479500129230 /* CarouselScrollbarViewConttroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */; };
|
||||||
1832AC5B2BA1347B008AE476 /* BreadcrumbsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */; };
|
1832AC5B2BA1347B008AE476 /* BreadcrumbsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */; };
|
||||||
|
186D13CD2BBA990800986B53 /* DropdownSelectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */; };
|
||||||
445BA07A29C088470036A7C5 /* NotificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 445BA07929C088470036A7C5 /* NotificationViewController.swift */; };
|
445BA07A29C088470036A7C5 /* NotificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 445BA07929C088470036A7C5 /* NotificationViewController.swift */; };
|
||||||
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD829CE1CF900E62B51 /* LineViewController.swift */; };
|
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD829CE1CF900E62B51 /* LineViewController.swift */; };
|
||||||
5FC35BE928D5235A004EBEAC /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */; };
|
5FC35BE928D5235A004EBEAC /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */; };
|
||||||
@ -126,6 +127,7 @@
|
|||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselScrollbarViewConttroller.swift; sourceTree = "<group>"; };
|
1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselScrollbarViewConttroller.swift; sourceTree = "<group>"; };
|
||||||
1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbsViewController.swift; sourceTree = "<group>"; };
|
1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbsViewController.swift; sourceTree = "<group>"; };
|
||||||
|
186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropdownSelectViewController.swift; sourceTree = "<group>"; };
|
||||||
445BA07929C088470036A7C5 /* NotificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewController.swift; sourceTree = "<group>"; };
|
445BA07929C088470036A7C5 /* NotificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewController.swift; sourceTree = "<group>"; };
|
||||||
44604AD829CE1CF900E62B51 /* LineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineViewController.swift; sourceTree = "<group>"; };
|
44604AD829CE1CF900E62B51 /* LineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineViewController.swift; sourceTree = "<group>"; };
|
||||||
5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = "<group>"; };
|
5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = "<group>"; };
|
||||||
@ -316,6 +318,7 @@
|
|||||||
EA89204D28B67332006B9984 /* CheckBoxGroupViewController.swift */,
|
EA89204D28B67332006B9984 /* CheckBoxGroupViewController.swift */,
|
||||||
EAF7F09B2899B92400B287F5 /* CheckboxItemViewController.swift */,
|
EAF7F09B2899B92400B287F5 /* CheckboxItemViewController.swift */,
|
||||||
EA0D1C2E2A66CFE900E5C127 /* CheckboxViewController.swift */,
|
EA0D1C2E2A66CFE900E5C127 /* CheckboxViewController.swift */,
|
||||||
|
186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */,
|
||||||
EA985C00296CC21C00F2FF2E /* IconViewController.swift */,
|
EA985C00296CC21C00F2FF2E /* IconViewController.swift */,
|
||||||
EAA5EEAC28EB6924003B3210 /* InputFieldViewController.swift */,
|
EAA5EEAC28EB6924003B3210 /* InputFieldViewController.swift */,
|
||||||
EAB1D2D328AC409F00DAE764 /* LabelViewController.swift */,
|
EAB1D2D328AC409F00DAE764 /* LabelViewController.swift */,
|
||||||
@ -492,6 +495,7 @@
|
|||||||
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */,
|
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */,
|
||||||
1808BEBE2BA4479500129230 /* CarouselScrollbarViewConttroller.swift in Sources */,
|
1808BEBE2BA4479500129230 /* CarouselScrollbarViewConttroller.swift in Sources */,
|
||||||
EA3C3BB528996775000CA526 /* StoryboardInitable.swift in Sources */,
|
EA3C3BB528996775000CA526 /* StoryboardInitable.swift in Sources */,
|
||||||
|
186D13CD2BBA990800986B53 /* DropdownSelectViewController.swift in Sources */,
|
||||||
EA89201928B56DF5006B9984 /* RadioBoxGroupViewController.swift in Sources */,
|
EA89201928B56DF5006B9984 /* RadioBoxGroupViewController.swift in Sources */,
|
||||||
EA3C3BB628996775000CA526 /* MenuViewController.swift in Sources */,
|
EA3C3BB628996775000CA526 /* MenuViewController.swift in Sources */,
|
||||||
EA3C3B9D289966EF000CA526 /* AppDelegate.swift in Sources */,
|
EA3C3B9D289966EF000CA526 /* AppDelegate.swift in Sources */,
|
||||||
@ -684,7 +688,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
CURRENT_PROJECT_VERSION = 56;
|
CURRENT_PROJECT_VERSION = 58;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = FCMA4QKS77;
|
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = FCMA4QKS77;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
@ -719,7 +723,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
CURRENT_PROJECT_VERSION = 56;
|
CURRENT_PROJECT_VERSION = 58;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = FCMA4QKS77;
|
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = FCMA4QKS77;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
|||||||
@ -89,8 +89,7 @@ class BadgeIndicatorViewController: BaseViewController<BadgeIndicator> {
|
|||||||
dotForm.addFormRow(label: "Hide Dot", view: hideDotSwitch)
|
dotForm.addFormRow(label: "Hide Dot", view: hideDotSwitch)
|
||||||
dotForm.addFormRow(label: "Dot Size", view: dotSizeTextField)
|
dotForm.addFormRow(label: "Dot Size", view: dotSizeTextField)
|
||||||
numberedForm.addFormRow(label: "Leading Character", view: leadingCharacterTextField)
|
numberedForm.addFormRow(label: "Leading Character", view: leadingCharacterTextField)
|
||||||
//Since not all of the updated specs from 7/13 & 7/18 are done, remove this for now
|
numberedForm.addFormRow(label: "Trailing Text", view: trailingTextField)
|
||||||
// numberedForm.addFormRow(label: "Trailing Text", view: trailingTextField)
|
|
||||||
numberedForm.addFormRow(label: "Number", view: textField)
|
numberedForm.addFormRow(label: "Number", view: textField)
|
||||||
numberedForm.addFormRow(label: "Max Digits", view: maxDigitsPickerSelectorView)
|
numberedForm.addFormRow(label: "Max Digits", view: maxDigitsPickerSelectorView)
|
||||||
append(section: numberedForm)
|
append(section: numberedForm)
|
||||||
|
|||||||
188
VDSSample/ViewControllers/DropdownSelectViewController.swift
Normal file
188
VDSSample/ViewControllers/DropdownSelectViewController.swift
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
//
|
||||||
|
// DropdownSelectViewController.swift
|
||||||
|
// VDSSample
|
||||||
|
//
|
||||||
|
// Created by Kanamarlapudi, Vasavi on 28/03/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import VDS
|
||||||
|
|
||||||
|
class DropdownSelectViewController: BaseViewController<DropdownSelect> {
|
||||||
|
|
||||||
|
var disabledSwitch = Toggle()
|
||||||
|
var requiredSwitch = Toggle()
|
||||||
|
var labelTextField = TextField()
|
||||||
|
var errorTextField = TextField()
|
||||||
|
var helperTextField = TextField()
|
||||||
|
var inlineLabelSwitch = Toggle()
|
||||||
|
var readonlySwitch = Toggle()
|
||||||
|
var transparentBgSwitch = Toggle()
|
||||||
|
var errorSwitch = Toggle()
|
||||||
|
var tooltipTitleTextField = TextField()
|
||||||
|
var tooltipContentTextField = TextField()
|
||||||
|
var optionsSwitch = Toggle()
|
||||||
|
var moreOptions: [DropdownSelect.DropdownOptionModel] = [
|
||||||
|
.init(text: "Alabama"),
|
||||||
|
.init(text: "Alaska"),
|
||||||
|
.init(text: "Arizona"),
|
||||||
|
.init(text: "Arkansas"),
|
||||||
|
.init(text: "California"),
|
||||||
|
.init(text: "Colorado"),
|
||||||
|
.init(text: "Connecticut"),
|
||||||
|
.init(text: "Delaware"),
|
||||||
|
.init(text: "District of Columbia"),
|
||||||
|
.init(text: "Florida"),
|
||||||
|
.init(text: "Georgia"),
|
||||||
|
.init(text: "Hawaii"),
|
||||||
|
.init(text: "Idaho"),
|
||||||
|
.init(text: "Illinois"),
|
||||||
|
.init(text: "Indiana"),
|
||||||
|
.init(text: "Iowa")
|
||||||
|
]
|
||||||
|
|
||||||
|
var some: [DropdownSelect.DropdownOptionModel] = [
|
||||||
|
.init(text: "Alabama"),
|
||||||
|
.init(text: "Alaska"),
|
||||||
|
.init(text: "Arizona"),
|
||||||
|
.init(text: "Arkansas")
|
||||||
|
]
|
||||||
|
|
||||||
|
override func viewDidLoad() {
|
||||||
|
super.viewDidLoad()
|
||||||
|
addContentTopView(view: component)
|
||||||
|
setupModel()
|
||||||
|
setupPicker()
|
||||||
|
}
|
||||||
|
|
||||||
|
override func setupForm(){
|
||||||
|
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||||
|
addFormRow(label: "Disabled", view: disabledSwitch)
|
||||||
|
addFormRow(label: "Required", view: requiredSwitch)
|
||||||
|
addFormRow(label: "Label Text", view: labelTextField)
|
||||||
|
addFormRow(label: "Helper Text", view: helperTextField)
|
||||||
|
addFormRow(label: "Inline Label", view: .makeWrapper(for: inlineLabelSwitch))
|
||||||
|
addFormRow(label: "Readonly", view: readonlySwitch)
|
||||||
|
addFormRow(label: "Transparent Background", view: transparentBgSwitch)
|
||||||
|
addFormRow(label: "Error", view: .makeWrapper(for: errorSwitch))
|
||||||
|
addFormRow(label: "Error Text", view: errorTextField)
|
||||||
|
addFormRow(label: "ToolTip Title", view: tooltipTitleTextField)
|
||||||
|
addFormRow(label: "ToolTip Content", view: tooltipContentTextField)
|
||||||
|
addFormRow(label: "More Options", view: optionsSwitch)
|
||||||
|
|
||||||
|
disabledSwitch.onChange = { [weak self] sender in
|
||||||
|
self?.component.isEnabled = !sender.isOn
|
||||||
|
}
|
||||||
|
|
||||||
|
requiredSwitch.onChange = { [weak self] sender in
|
||||||
|
self?.component.required = sender.isOn
|
||||||
|
}
|
||||||
|
|
||||||
|
optionsSwitch.onChange = { [weak self] sender in
|
||||||
|
guard let self else { return }
|
||||||
|
self.component.options = sender.isOn ? self.moreOptions : self.some
|
||||||
|
}
|
||||||
|
|
||||||
|
readonlySwitch.onChange = { [weak self] sender in
|
||||||
|
self?.component.readOnly = sender.isOn
|
||||||
|
}
|
||||||
|
|
||||||
|
transparentBgSwitch.onChange = { [weak self] sender in
|
||||||
|
self?.component.transparentBackground = sender.isOn
|
||||||
|
}
|
||||||
|
|
||||||
|
errorSwitch
|
||||||
|
.publisher(for: .valueChanged)
|
||||||
|
.sink { [weak self] sender in
|
||||||
|
guard let self else { return }
|
||||||
|
component.showError = sender.isOn
|
||||||
|
if component.showError != sender.isOn {
|
||||||
|
self.errorSwitch.isOn = self.component.showError
|
||||||
|
}
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
|
labelTextField
|
||||||
|
.textPublisher
|
||||||
|
.sink { [weak self] text in
|
||||||
|
self?.component.labelText = text
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
|
helperTextField
|
||||||
|
.textPublisher
|
||||||
|
.sink { [weak self] text in
|
||||||
|
self?.component.helperText = text
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
|
errorTextField
|
||||||
|
.textPublisher
|
||||||
|
.sink { [weak self] text in
|
||||||
|
self?.component.errorText = text
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
|
tooltipTitleTextField
|
||||||
|
.textPublisher
|
||||||
|
.sink { [weak self] text in
|
||||||
|
self?.updateTooltip()
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
|
tooltipContentTextField
|
||||||
|
.textPublisher
|
||||||
|
.sink { [weak self] text in
|
||||||
|
self?.updateTooltip()
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
|
inlineLabelSwitch
|
||||||
|
.publisher(for: .valueChanged)
|
||||||
|
.sink { [weak self] sender in
|
||||||
|
guard let self else { return }
|
||||||
|
self.component.showInlineLabel = sender.isOn
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
}
|
||||||
|
|
||||||
|
func setupModel() {
|
||||||
|
component.labelText = "Street Address"
|
||||||
|
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.options = moreOptions
|
||||||
|
|
||||||
|
/// callback to know which option chose
|
||||||
|
component.onItemSelected = { index, option in
|
||||||
|
print("selected index: \(index) text: \(option.text) value: \(option.value)")
|
||||||
|
}
|
||||||
|
|
||||||
|
component.onChange = { dropdown in
|
||||||
|
guard let option = dropdown.selectedItem, let index = dropdown.selectId else { print("nothing selected"); return }
|
||||||
|
print("selected index: \(index) text: \(option.text) value: \(option.value)")
|
||||||
|
}
|
||||||
|
|
||||||
|
//setup UI
|
||||||
|
disabledSwitch.isOn = !component.isEnabled
|
||||||
|
requiredSwitch.isOn = component.required
|
||||||
|
surfacePickerSelectorView.text = component.surface.rawValue
|
||||||
|
labelTextField.text = component.labelText
|
||||||
|
helperTextField.text = component.helperText
|
||||||
|
readonlySwitch.isOn = false
|
||||||
|
transparentBgSwitch.isOn = false
|
||||||
|
errorSwitch.isOn = component.showError
|
||||||
|
errorTextField.text = component.errorText
|
||||||
|
tooltipTitleTextField.text = component.tooltipModel?.title
|
||||||
|
tooltipContentTextField.text = component.tooltipModel?.content
|
||||||
|
optionsSwitch.isOn = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func setupPicker() {
|
||||||
|
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||||
|
self?.component.surface = item
|
||||||
|
self?.contentTopView.backgroundColor = item.color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateTooltip() {
|
||||||
|
let title = tooltipTitleTextField.text ?? ""
|
||||||
|
let content = tooltipContentTextField.text ?? ""
|
||||||
|
|
||||||
|
component.tooltipModel = !title.isEmpty || !content.isEmpty ? .init(title: title,
|
||||||
|
content: content) : nil
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -119,22 +119,21 @@ class InputFieldViewController: BaseViewController<InputField> {
|
|||||||
func setupModel() {
|
func setupModel() {
|
||||||
component.fieldType = .text
|
component.fieldType = .text
|
||||||
component.width = 328
|
component.width = 328
|
||||||
|
component.text = "Starting Text"
|
||||||
component.labelText = "Street Address"
|
component.labelText = "Street Address"
|
||||||
component.helperText = "For example: 123 Verizon St"
|
component.helperText = "For example: 123 Verizon St"
|
||||||
component.errorText = "Enter a valid address."
|
component.errorText = "Enter a valid address."
|
||||||
component.successText = "Good job entering a valid address!"
|
component.successText = "Good job entering a valid address!"
|
||||||
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
|
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
|
||||||
|
|
||||||
component
|
component.onChange = { component in
|
||||||
.publisher(for: .valueChanged)
|
if let text = component.value {
|
||||||
.sink { component in
|
print("text entry: \(text)")
|
||||||
if let text = component.value {
|
} else {
|
||||||
print("text entry: \(text)")
|
print("text entry: null")
|
||||||
} else {
|
}
|
||||||
print("text entry: null")
|
}
|
||||||
}
|
|
||||||
}.store(in: &subscribers)
|
|
||||||
|
|
||||||
//setup UI
|
//setup UI
|
||||||
surfacePickerSelectorView.text = component.surface.rawValue
|
surfacePickerSelectorView.text = component.surface.rawValue
|
||||||
helperTextPlacementPickerSelectorView.text = component.helperTextPlacement.rawValue
|
helperTextPlacementPickerSelectorView.text = component.helperTextPlacement.rawValue
|
||||||
@ -166,8 +165,11 @@ class InputFieldViewController: BaseViewController<InputField> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateTooltip() {
|
func updateTooltip() {
|
||||||
component.tooltipModel = .init(title: tooltipTitleTextField.text,
|
let title = tooltipTitleTextField.text ?? ""
|
||||||
content: tooltipContentTextField.text)
|
let content = tooltipContentTextField.text ?? ""
|
||||||
|
|
||||||
|
component.tooltipModel = !title.isEmpty || !content.isEmpty ? .init(title: title,
|
||||||
|
content: content) : nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -78,6 +78,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable {
|
|||||||
MenuComponent(title: "Checkbox", completed: true, viewController: CheckboxViewController.self),
|
MenuComponent(title: "Checkbox", completed: true, viewController: CheckboxViewController.self),
|
||||||
MenuComponent(title: "CheckboxItem", completed: true, viewController: CheckboxItemViewController.self),
|
MenuComponent(title: "CheckboxItem", completed: true, viewController: CheckboxItemViewController.self),
|
||||||
MenuComponent(title: "CheckboxGroup", completed: true, viewController: CheckboxGroupViewController.self),
|
MenuComponent(title: "CheckboxGroup", completed: true, viewController: CheckboxGroupViewController.self),
|
||||||
|
MenuComponent(title: "DropdownSelect", completed: true, viewController: DropdownSelectViewController.self),
|
||||||
MenuComponent(title: "Icon", completed: true, viewController: IconViewController.self),
|
MenuComponent(title: "Icon", completed: true, viewController: IconViewController.self),
|
||||||
MenuComponent(title: "InputField", completed: false, viewController: InputFieldViewController.self),
|
MenuComponent(title: "InputField", completed: false, viewController: InputFieldViewController.self),
|
||||||
MenuComponent(title: "Label", completed: true, viewController: LabelViewController.self),
|
MenuComponent(title: "Label", completed: true, viewController: LabelViewController.self),
|
||||||
|
|||||||
@ -97,7 +97,7 @@ class NotificationViewController: BaseViewController<VDS.Notification> {
|
|||||||
secondButtonTextField.textPublisher.sink { [weak self] newString in
|
secondButtonTextField.textPublisher.sink { [weak self] newString in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
if !(self.firstButtonTextField.text?.isEmpty ?? true){
|
if !(self.firstButtonTextField.text?.isEmpty ?? true){
|
||||||
self.setupButtons(secondButtonText: newString)
|
self.setupButtons(with: self.firstButtonTextField.text, secondButtonText: newString)
|
||||||
}
|
}
|
||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
@ -122,16 +122,20 @@ class NotificationViewController: BaseViewController<VDS.Notification> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setupButtons(with firstButtonText: String? = nil, secondButtonText: String? = nil) {
|
func setupButtons(with firstButtonText: String? = nil, secondButtonText: String? = nil) {
|
||||||
if let firstButtonText {
|
if let firstButtonText, !firstButtonText.isEmpty {
|
||||||
component.primaryButtonModel = .init(text: firstButtonText, onClick: { [weak self] button in
|
component.primaryButtonModel = .init(text: firstButtonText, onClick: { [weak self] button in
|
||||||
self?.label.text = "\(button.text!) button click"
|
self?.label.text = "\(button.text!) button click"
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
component.primaryButtonModel = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if let secondButtonText {
|
if let secondButtonText, !secondButtonText.isEmpty {
|
||||||
component.secondaryButtonModel = .init(text: secondButtonText, onClick: { [weak self] button in
|
component.secondaryButtonModel = .init(text: secondButtonText, onClick: { [weak self] button in
|
||||||
self?.label.text = "\(button.text!) button click"
|
self?.label.text = "\(button.text!) button click"
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
component.secondaryButtonModel = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,7 +69,6 @@ class RadioBoxGroupViewController: BaseViewController<RadioBoxGroup>{
|
|||||||
|
|
||||||
var radioBox1 = RadioBoxGroup.RadioBoxItemModel()
|
var radioBox1 = RadioBoxGroup.RadioBoxItemModel()
|
||||||
radioBox1.inputId = "model1"
|
radioBox1.inputId = "model1"
|
||||||
radioBox1.selected = true
|
|
||||||
radioBox1.value = "model 1 Value"
|
radioBox1.value = "model 1 Value"
|
||||||
radioBox1.text = "iPhone 11 Bundle 1"
|
radioBox1.text = "iPhone 11 Bundle 1"
|
||||||
//radioBox1.subText = "Apple iPhone 11 - 64 GB\nOtterbox Case Red\nScreen Protector"
|
//radioBox1.subText = "Apple iPhone 11 - 64 GB\nOtterbox Case Red\nScreen Protector"
|
||||||
@ -117,7 +116,6 @@ extension RadioBoxGroupViewController: ComponentSampleable {
|
|||||||
|
|
||||||
var radioBox1 = RadioBoxGroup.RadioBoxItemModel()
|
var radioBox1 = RadioBoxGroup.RadioBoxItemModel()
|
||||||
radioBox1.inputId = "model1"
|
radioBox1.inputId = "model1"
|
||||||
radioBox1.selected = true
|
|
||||||
radioBox1.value = "model 1 Value"
|
radioBox1.value = "model 1 Value"
|
||||||
radioBox1.text = "iPhone 11 Bundle 1"
|
radioBox1.text = "iPhone 11 Bundle 1"
|
||||||
radioBox1.subText = "Apple iPhone 11 - 64 GB\nOtterbox Case Red\nScreen Protector"
|
radioBox1.subText = "Apple iPhone 11 - 64 GB\nOtterbox Case Red\nScreen Protector"
|
||||||
|
|||||||
@ -131,16 +131,15 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
|||||||
component.helperText = "For example: 123 Verizon St"
|
component.helperText = "For example: 123 Verizon St"
|
||||||
component.errorText = "Enter a valid address."
|
component.errorText = "Enter a valid address."
|
||||||
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
|
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
|
||||||
component
|
|
||||||
.publisher(for: .valueChanged)
|
component.onChange = { component in
|
||||||
.sink { component in
|
if let text = component.value {
|
||||||
// if let text = component.value {
|
print("text entry: \(text)")
|
||||||
// print("text entry: \(text)")
|
} else {
|
||||||
// } else {
|
print("text entry: null")
|
||||||
// print("text entry: null")
|
}
|
||||||
// }
|
}
|
||||||
}.store(in: &subscribers)
|
|
||||||
|
|
||||||
//setup UI
|
//setup UI
|
||||||
surfacePickerSelectorView.text = component.surface.rawValue
|
surfacePickerSelectorView.text = component.surface.rawValue
|
||||||
disabledSwitch.isOn = !component.isEnabled
|
disabledSwitch.isOn = !component.isEnabled
|
||||||
@ -166,8 +165,12 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateTooltip() {
|
func updateTooltip() {
|
||||||
component.tooltipModel = .init(title: tooltipTitleTextField.text,
|
let title = tooltipTitleTextField.text ?? ""
|
||||||
content: tooltipContentTextField.text)
|
let content = tooltipContentTextField.text ?? ""
|
||||||
|
|
||||||
|
component.tooltipModel = !title.isEmpty || !content.isEmpty ? .init(title: title,
|
||||||
|
content: content) : nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user