fixed sample for width updates
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
70493edd0f
commit
c1c92f0926
@ -171,6 +171,7 @@ class DatePickerViewController: BaseViewController<DatePicker> {
|
|||||||
widthTextField
|
widthTextField
|
||||||
.numberPublisher
|
.numberPublisher
|
||||||
.sink { [weak self] number in
|
.sink { [weak self] number in
|
||||||
|
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||||
self?.component.width = number?.cgFloatValue
|
self?.component.width = number?.cgFloatValue
|
||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
@ -479,3 +480,12 @@ extension DatePickerViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension DatePickerViewController: ComponentSampleable {
|
||||||
|
static func makeSample() -> ComponentSample {
|
||||||
|
let c = Self()
|
||||||
|
c.setupModel()
|
||||||
|
c.setupCalendar()
|
||||||
|
return ComponentSample(component: c.component)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -131,6 +131,7 @@ class DropdownSelectViewController: BaseViewController<DropdownSelect> {
|
|||||||
widthTextField
|
widthTextField
|
||||||
.numberPublisher
|
.numberPublisher
|
||||||
.sink { [weak self] number in
|
.sink { [weak self] number in
|
||||||
|
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||||
self?.component.width = number?.cgFloatValue
|
self?.component.width = number?.cgFloatValue
|
||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class FootnoteGroupViewController: BaseViewController<FootnoteGroup> {
|
|||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
addContentTopView(view: component, pinTrailing: false)
|
addContentTopView(view: component)
|
||||||
setupPicker()
|
setupPicker()
|
||||||
setupModel()
|
setupModel()
|
||||||
}
|
}
|
||||||
@ -31,6 +31,7 @@ class FootnoteGroupViewController: BaseViewController<FootnoteGroup> {
|
|||||||
widthTextField
|
widthTextField
|
||||||
.numberPublisher
|
.numberPublisher
|
||||||
.sink { [weak self] number in
|
.sink { [weak self] number in
|
||||||
|
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||||
if let number {
|
if let number {
|
||||||
self?.component.width = .value(number.cgFloatValue)
|
self?.component.width = .value(number.cgFloatValue)
|
||||||
self?.percentageTextField.text = ""
|
self?.percentageTextField.text = ""
|
||||||
@ -42,6 +43,7 @@ class FootnoteGroupViewController: BaseViewController<FootnoteGroup> {
|
|||||||
percentageTextField
|
percentageTextField
|
||||||
.numberPublisher
|
.numberPublisher
|
||||||
.sink { [weak self] number in
|
.sink { [weak self] number in
|
||||||
|
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||||
if let number, number.intValue > 9 {
|
if let number, number.intValue > 9 {
|
||||||
self?.component.width = .percentage(number.cgFloatValue)
|
self?.component.width = .percentage(number.cgFloatValue)
|
||||||
self?.widthTextField.text = ""
|
self?.widthTextField.text = ""
|
||||||
@ -67,3 +69,11 @@ class FootnoteGroupViewController: BaseViewController<FootnoteGroup> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension FootnoteGroupViewController: ComponentSampleable {
|
||||||
|
static func makeSample() -> ComponentSample {
|
||||||
|
let c = Self()
|
||||||
|
c.setupModel()
|
||||||
|
return ComponentSample(component: c.component)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -61,7 +61,7 @@ class FootnoteItemViewController: BaseViewController<FootnoteItem> {
|
|||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
addContentTopView(view: component, pinTrailing: false)
|
addContentTopView(view: component)
|
||||||
setupPicker()
|
setupPicker()
|
||||||
setupModel()
|
setupModel()
|
||||||
}
|
}
|
||||||
@ -92,6 +92,7 @@ class FootnoteItemViewController: BaseViewController<FootnoteItem> {
|
|||||||
widthTextField
|
widthTextField
|
||||||
.numberPublisher
|
.numberPublisher
|
||||||
.sink { [weak self] number in
|
.sink { [weak self] number in
|
||||||
|
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||||
if let number {
|
if let number {
|
||||||
self?.component.width = .value(number.cgFloatValue)
|
self?.component.width = .value(number.cgFloatValue)
|
||||||
self?.percentageTextField.text = ""
|
self?.percentageTextField.text = ""
|
||||||
@ -103,6 +104,7 @@ class FootnoteItemViewController: BaseViewController<FootnoteItem> {
|
|||||||
percentageTextField
|
percentageTextField
|
||||||
.numberPublisher
|
.numberPublisher
|
||||||
.sink { [weak self] number in
|
.sink { [weak self] number in
|
||||||
|
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||||
if let number, number.intValue > 9 {
|
if let number, number.intValue > 9 {
|
||||||
self?.component.width = .percentage(number.cgFloatValue)
|
self?.component.width = .percentage(number.cgFloatValue)
|
||||||
self?.widthTextField.text = ""
|
self?.widthTextField.text = ""
|
||||||
@ -164,3 +166,11 @@ class FootnoteItemViewController: BaseViewController<FootnoteItem> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension FootnoteItemViewController: ComponentSampleable {
|
||||||
|
static func makeSample() -> ComponentSample {
|
||||||
|
let c = Self()
|
||||||
|
c.setupModel()
|
||||||
|
return ComponentSample(component: c.component)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -181,6 +181,7 @@ class InputFieldViewController: BaseViewController<InputField> {
|
|||||||
widthTextField
|
widthTextField
|
||||||
.numberPublisher
|
.numberPublisher
|
||||||
.sink { [weak self] number in
|
.sink { [weak self] number in
|
||||||
|
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||||
self?.component.width = number?.cgFloatValue
|
self?.component.width = number?.cgFloatValue
|
||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
@ -329,14 +330,8 @@ class InputFieldViewController: BaseViewController<InputField> {
|
|||||||
|
|
||||||
extension InputFieldViewController: ComponentSampleable {
|
extension InputFieldViewController: ComponentSampleable {
|
||||||
static func makeSample() -> ComponentSample {
|
static func makeSample() -> ComponentSample {
|
||||||
let component = Self.makeComponent()
|
let c = Self()
|
||||||
component.fieldType = .text
|
c.setupModel()
|
||||||
component.width = 328
|
return ComponentSample(component: c.component)
|
||||||
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")
|
|
||||||
return ComponentSample(component: component, trailingPinningType: .lessThanOrEqual)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -163,6 +163,7 @@ class InputStepperViewController: BaseViewController<InputStepper> {
|
|||||||
widthTextField
|
widthTextField
|
||||||
.numberPublisher
|
.numberPublisher
|
||||||
.sink { [weak self] number in
|
.sink { [weak self] number in
|
||||||
|
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||||
if let number {
|
if let number {
|
||||||
self?.component.widthPercentage = nil
|
self?.component.widthPercentage = nil
|
||||||
self?.component.width = number.cgFloatValue
|
self?.component.width = number.cgFloatValue
|
||||||
@ -175,6 +176,7 @@ class InputStepperViewController: BaseViewController<InputStepper> {
|
|||||||
widthPercentageTextField
|
widthPercentageTextField
|
||||||
.numberPublisher
|
.numberPublisher
|
||||||
.sink { [weak self] number in
|
.sink { [weak self] number in
|
||||||
|
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||||
if let number, number.intValue > 10 {
|
if let number, number.intValue > 10 {
|
||||||
self?.component.width = nil
|
self?.component.width = nil
|
||||||
self?.component.widthPercentage = number.cgFloatValue
|
self?.component.widthPercentage = number.cgFloatValue
|
||||||
@ -253,3 +255,11 @@ class InputStepperViewController: BaseViewController<InputStepper> {
|
|||||||
helperTextPlacementPickerSelectorView.text = component.helperTextPlacement.rawValue
|
helperTextPlacementPickerSelectorView.text = component.helperTextPlacement.rawValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension InputStepperViewController: ComponentSampleable {
|
||||||
|
static func makeSample() -> ComponentSample {
|
||||||
|
let c = Self()
|
||||||
|
c.setupModel()
|
||||||
|
return ComponentSample(component: c.component)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -101,11 +101,8 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
|||||||
widthTextField
|
widthTextField
|
||||||
.numberPublisher
|
.numberPublisher
|
||||||
.sink { [weak self] number in
|
.sink { [weak self] number in
|
||||||
guard let number else {
|
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||||
self?.component.width = nil
|
self?.component.width = number?.cgFloatValue
|
||||||
return
|
|
||||||
}
|
|
||||||
self?.component.width = number.cgFloatValue
|
|
||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
tooltipTitleTextField
|
tooltipTitleTextField
|
||||||
@ -182,13 +179,8 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
|||||||
|
|
||||||
extension TextAreaViewController: ComponentSampleable {
|
extension TextAreaViewController: ComponentSampleable {
|
||||||
static func makeSample() -> ComponentSample {
|
static func makeSample() -> ComponentSample {
|
||||||
let component = Self.makeComponent()
|
let c = Self()
|
||||||
component.width = 328
|
c.setupModel()
|
||||||
component.labelText = "Street Address"
|
return ComponentSample(component: c.component)
|
||||||
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")
|
|
||||||
return ComponentSample(component: component, trailingPinningType: .lessThanOrEqual)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user