Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/vds_ios_sample into vasavk/calendar
This commit is contained in:
commit
cc7b5bb093
@ -696,7 +696,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
CURRENT_PROJECT_VERSION = 61;
|
||||
CURRENT_PROJECT_VERSION = 62;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = FCMA4QKS77;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
@ -731,7 +731,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
CURRENT_PROJECT_VERSION = 61;
|
||||
CURRENT_PROJECT_VERSION = 62;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = FCMA4QKS77;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
|
||||
@ -10,6 +10,12 @@ import VDS
|
||||
|
||||
class DropdownSelectViewController: BaseViewController<DropdownSelect> {
|
||||
|
||||
lazy var helperTextPlacementPickerSelectorView = {
|
||||
PickerSelectorView(title: "",
|
||||
picker: self.picker,
|
||||
items: InputField.HelperTextPlacement.allCases)
|
||||
}()
|
||||
|
||||
var disabledSwitch = Toggle()
|
||||
var requiredSwitch = Toggle()
|
||||
var labelTextField = TextField()
|
||||
@ -21,6 +27,7 @@ class DropdownSelectViewController: BaseViewController<DropdownSelect> {
|
||||
var errorSwitch = Toggle()
|
||||
var tooltipTitleTextField = TextField()
|
||||
var tooltipContentTextField = TextField()
|
||||
var widthTextField = NumericField()
|
||||
var optionsSwitch = Toggle()
|
||||
var moreOptions: [DropdownSelect.DropdownOptionModel] = [
|
||||
.init(text: "Alabama"),
|
||||
@ -60,12 +67,14 @@ class DropdownSelectViewController: BaseViewController<DropdownSelect> {
|
||||
addFormRow(label: "Disabled", view: disabledSwitch)
|
||||
addFormRow(label: "Required", view: requiredSwitch)
|
||||
addFormRow(label: "Label Text", view: labelTextField)
|
||||
addFormRow(label: "Helper Text Placement", view: helperTextPlacementPickerSelectorView)
|
||||
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: "Width", view: widthTextField)
|
||||
addFormRow(label: "ToolTip Title", view: tooltipTitleTextField)
|
||||
addFormRow(label: "ToolTip Content", view: tooltipContentTextField)
|
||||
addFormRow(label: "More Options", view: optionsSwitch)
|
||||
@ -119,6 +128,12 @@ class DropdownSelectViewController: BaseViewController<DropdownSelect> {
|
||||
self?.component.errorText = text
|
||||
}.store(in: &subscribers)
|
||||
|
||||
widthTextField
|
||||
.numberPublisher
|
||||
.sink { [weak self] number in
|
||||
self?.component.width = number?.cgFloatValue
|
||||
}.store(in: &subscribers)
|
||||
|
||||
tooltipTitleTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
@ -161,6 +176,7 @@ class DropdownSelectViewController: BaseViewController<DropdownSelect> {
|
||||
requiredSwitch.isOn = component.isRequired
|
||||
surfacePickerSelectorView.text = component.surface.rawValue
|
||||
labelTextField.text = component.labelText
|
||||
helperTextPlacementPickerSelectorView.text = component.helperTextPlacement.rawValue
|
||||
helperTextField.text = component.helperText
|
||||
readonlySwitch.isOn = false
|
||||
transparentBgSwitch.isOn = false
|
||||
@ -176,6 +192,11 @@ class DropdownSelectViewController: BaseViewController<DropdownSelect> {
|
||||
self?.component.surface = item
|
||||
self?.contentTopView.backgroundColor = item.color
|
||||
}
|
||||
|
||||
helperTextPlacementPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.component.helperTextPlacement = item
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func updateTooltip() {
|
||||
|
||||
@ -62,6 +62,27 @@ class InputFieldViewController: BaseViewController<InputField> {
|
||||
$0.isHidden = true
|
||||
}
|
||||
|
||||
//inlineAction
|
||||
var inlineActionTextField = TextField()
|
||||
lazy var inlineActionSection = FormSection().with {
|
||||
$0.title = "inlineAction Settings"
|
||||
$0.addFormRow(label: "Action Text", view: inlineActionTextField)
|
||||
$0.isHidden = true
|
||||
}
|
||||
|
||||
//securityCode
|
||||
lazy var cardTypePickerSelectorView = {
|
||||
PickerSelectorView(title: "",
|
||||
picker: self.picker,
|
||||
items: InputField.CreditCardType.allCases)
|
||||
}()
|
||||
|
||||
lazy var securityCodeSection = FormSection().with {
|
||||
$0.title = "Security Code Settings"
|
||||
$0.addFormRow(label: "Card Type", view: cardTypePickerSelectorView)
|
||||
$0.isHidden = true
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
addContentTopView(view: component)
|
||||
@ -71,23 +92,37 @@ class InputFieldViewController: BaseViewController<InputField> {
|
||||
|
||||
override func setupForm(){
|
||||
super.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)
|
||||
addFormRow(label: "Helper Text", view: helperTextField)
|
||||
addFormRow(label: "Error", view: showErrorSwitch)
|
||||
addFormRow(label: "Error Text", view: errorTextField)
|
||||
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)
|
||||
addFormRow(label: "Field Type", view: inputTypePickerSelectorView)
|
||||
|
||||
|
||||
let fieldType = FormSection().with {
|
||||
$0.title = "Field Type Settings"
|
||||
$0.addFormRow(label: "Field Type", view: inputTypePickerSelectorView)
|
||||
}
|
||||
|
||||
let general = FormSection().with {
|
||||
$0.title = "\n\nGeneral Settings"
|
||||
}
|
||||
|
||||
general.addFormRow(label: "Disabled", view: disabledSwitch)
|
||||
general.addFormRow(label: "Required", view: requiredSwitch)
|
||||
general.addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||
general.addFormRow(label: "Label Text", view: labelTextField)
|
||||
general.addFormRow(label: "Helper Text Placement", view: helperTextPlacementPickerSelectorView)
|
||||
general.addFormRow(label: "Helper Text", view: helperTextField)
|
||||
general.addFormRow(label: "Error", view: showErrorSwitch)
|
||||
general.addFormRow(label: "Error Text", view: errorTextField)
|
||||
general.addFormRow(label: "Success", view: showSuccessSwitch)
|
||||
general.addFormRow(label: "Success Text", view: successTextField)
|
||||
general.addFormRow(label: "Width", view: widthTextField)
|
||||
general.addFormRow(label: "ToolTip Title", view: tooltipTitleTextField)
|
||||
general.addFormRow(label: "ToolTip Content", view: tooltipContentTextField)
|
||||
|
||||
append(section: fieldType)
|
||||
append(section: passwordSection)
|
||||
append(section: dateSection)
|
||||
append(section: inlineActionSection)
|
||||
append(section: securityCodeSection)
|
||||
append(section: general)
|
||||
|
||||
requiredSwitch.onChange = { [weak self] sender in
|
||||
self?.component.isRequired = sender.isOn
|
||||
@ -162,16 +197,29 @@ class InputFieldViewController: BaseViewController<InputField> {
|
||||
.sink { [weak self] text in
|
||||
self?.component.showPasswordButtonText = text
|
||||
}.store(in: &subscribers)
|
||||
|
||||
//inlineAction
|
||||
inlineActionTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
if !text.isEmpty {
|
||||
self?.component.actionTextLinkModel = .init(text: text, onClick: { inputField in
|
||||
var value = inputField.value ?? ""
|
||||
value = !value.isEmpty ? value : "nil"
|
||||
self?.present(UIAlertController(title: "inlineAction", message: "Clicked and you get the value: \(value)", preferredStyle: .alert).with{ $0.addAction(.init(title: "OK", style: .default)) }, animated: true)
|
||||
})
|
||||
} else {
|
||||
self?.component.actionTextLinkModel = nil
|
||||
}
|
||||
}.store(in: &subscribers)
|
||||
}
|
||||
|
||||
func setupModel() {
|
||||
component.fieldType = .text
|
||||
component.width = 328
|
||||
component.labelText = "Street Address"
|
||||
component.helperText = "For example: 123 Verizon St"
|
||||
component.errorText = "Enter 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.onChange = { component in
|
||||
if let text = component.value {
|
||||
@ -184,6 +232,7 @@ class InputFieldViewController: BaseViewController<InputField> {
|
||||
//setup UI
|
||||
surfacePickerSelectorView.text = component.surface.rawValue
|
||||
helperTextPlacementPickerSelectorView.text = component.helperTextPlacement.rawValue
|
||||
dateFormatPickerSelectorView.text = component.dateFormat.rawValue
|
||||
inputTypePickerSelectorView.text = component.fieldType.rawValue
|
||||
disabledSwitch.isOn = !component.isEnabled
|
||||
requiredSwitch.isOn = component.isRequired
|
||||
@ -213,6 +262,7 @@ class InputFieldViewController: BaseViewController<InputField> {
|
||||
|
||||
inputTypePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.component.fieldType = item
|
||||
self?.component.text = ""
|
||||
self?.updateFormSections()
|
||||
}
|
||||
|
||||
@ -220,6 +270,10 @@ class InputFieldViewController: BaseViewController<InputField> {
|
||||
self?.component.dateFormat = item
|
||||
self?.updateFormSections()
|
||||
}
|
||||
|
||||
cardTypePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.component.cardType = item
|
||||
}
|
||||
}
|
||||
|
||||
func updateTooltip() {
|
||||
@ -231,33 +285,30 @@ class InputFieldViewController: BaseViewController<InputField> {
|
||||
}
|
||||
|
||||
func updateFormSections() {
|
||||
[passwordSection, dateSection].forEach { $0.isHidden = true }
|
||||
[passwordSection, dateSection, inlineActionSection, securityCodeSection].forEach { $0.isHidden = true }
|
||||
//reset other fields
|
||||
component.actionTextLinkModel = nil
|
||||
component.tooltipModel = nil
|
||||
component.cardType = .generic
|
||||
tooltipTitleTextField.text = nil
|
||||
tooltipContentTextField.text = nil
|
||||
dateFormatPickerSelectorView.text = component.dateFormat.rawValue
|
||||
cardTypePickerSelectorView.text = component.cardType.rawValue
|
||||
switch component.fieldType {
|
||||
case .text:
|
||||
break
|
||||
|
||||
case .number:
|
||||
break
|
||||
|
||||
case .inlineAction:
|
||||
break
|
||||
|
||||
inlineActionTextField.text = nil
|
||||
inlineActionSection.isHidden = false
|
||||
|
||||
case .password:
|
||||
passwordSection.isHidden = false
|
||||
|
||||
case .creditCard:
|
||||
break
|
||||
|
||||
case .tel:
|
||||
break
|
||||
|
||||
case .date:
|
||||
dateSection.isHidden = false
|
||||
|
||||
case .securityCode:
|
||||
break
|
||||
securityCodeSection.isHidden = false
|
||||
|
||||
@unknown default:
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable {
|
||||
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: "InputField", completed: false, viewController: InputFieldViewController.self),
|
||||
MenuComponent(title: "InputField", completed: true, viewController: InputFieldViewController.self),
|
||||
MenuComponent(title: "Label", completed: true, viewController: LabelViewController.self),
|
||||
MenuComponent(title: "Line", completed: true, viewController: LineViewController.self),
|
||||
MenuComponent(title: "Loader", completed: true, viewController: LoaderViewController.self),
|
||||
|
||||
@ -126,7 +126,6 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
||||
}
|
||||
|
||||
func setupModel() {
|
||||
component.width = 328
|
||||
component.labelText = "Street Address"
|
||||
component.helperText = "For example: 123 Verizon St"
|
||||
component.errorText = "Enter a valid address."
|
||||
|
||||
Loading…
Reference in New Issue
Block a user