Digital ACT-191 ONEAPP-7013 story: pasing empty data and added width property

This commit is contained in:
vasavk 2024-06-11 15:19:23 +05:30
parent 1aaab51582
commit e3eefe6f3e
2 changed files with 44 additions and 13 deletions

View File

@ -114,7 +114,7 @@ class CarouselScrollbarViewConttroller: BaseViewController<CarouselScrollbar> {
}
layoutPickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.selectedLayout = item
self?.component.layout = item
self?.component.position = Int(self?.positionTextField.text ?? "1") ?? 1
}
}

View File

@ -20,13 +20,7 @@ class CarouselViewController: BaseViewController<Carousel> {
picker: self.picker,
items: Carousel.AspectRatio.allCases)
}()
lazy var layoutPickerSelectorView = {
PickerSelectorView(title: "1UP",
picker: self.picker,
items: UIDevice.isIPad ? Carousel.Layout.allCases : [Carousel.Layout.oneUP, Carousel.Layout.twoUP, Carousel.Layout.threeUP])
}()
lazy var paginationDisplayPickerSelectorView = {
PickerSelectorView(title: "",
picker: self.picker,
@ -45,6 +39,12 @@ class CarouselViewController: BaseViewController<Carousel> {
items: Carousel.Gutter.allCases)
}()
lazy var layoutPickerSelectorView = {
PickerSelectorView(title: "1UP",
picker: self.picker,
items: UIDevice.isIPad ? Carousel.Layout.allCases : [Carousel.Layout.oneUP, Carousel.Layout.twoUP, Carousel.Layout.threeUP])
}()
lazy var paginationKindPickerSelectorView = {
PickerSelectorView(title: "",
picker: self.picker,
@ -64,7 +64,9 @@ class CarouselViewController: BaseViewController<Carousel> {
}()
var paginationFloatingSwitch = Toggle()
var paginationInsetField = TextField()
var paginationInsetField = NumericField()
var widthTextField = NumericField()
var percentageTextField = NumericField()
override func viewDidLoad() {
super.viewDidLoad()
@ -86,13 +88,41 @@ class CarouselViewController: BaseViewController<Carousel> {
addFormRow(label: "Pagination Kind", view: paginationKindPickerSelectorView)
addFormRow(label: "Pagination Float", view: paginationFloatingSwitch)
addFormRow(label: "Pagination Inset", view: paginationInsetField)
addFormRow(label: "Slot Width", view: widthTextField)
addFormRow(label: "Percentage (1-100)", view: percentageTextField)
addFormRow(label: "Slot Horizontal Alignment", view: horizAlignmtPickerSelectorView)
addFormRow(label: "Slot Vertical Alignment", view: vertAlignmtPickerSelectorView)
widthTextField
.numberPublisher
.sink { [weak self] number in
if let number {
self?.component.width = .value(number.cgFloatValue)
self?.percentageTextField.text = ""
} else {
self?.component.width = nil
}
}.store(in: &subscribers)
percentageTextField
.numberPublisher
.sink { [weak self] number in
if let number {
self?.component.width = .percentage(number.cgFloatValue)
self?.widthTextField.text = ""
} else {
self?.component.width = nil
}
}.store(in: &subscribers)
paginationInsetField
.textPublisher
.sink { [weak self] text in
self?.component.paginationInset = UIDevice.isIPad ? VDSLayout.space12X : VDSLayout.space8X
.numberPublisher
.sink { [weak self] number in
if let number {
self?.component.paginationInset = number.cgFloatValue
} else {
self?.component.paginationInset = UIDevice.isIPad ? VDSLayout.space12X : VDSLayout.space8X
}
}.store(in: &subscribers)
paginationFloatingSwitch.onChange = { [weak self] sender in
@ -113,6 +143,7 @@ class CarouselViewController: BaseViewController<Carousel> {
paginationFloatingSwitch.isOn = true
paginationInsetField.text = UIDevice.isIPad ? "12px" : "8px"
paginationInsetField.isUserInteractionEnabled = false
component.data = [{},{},{},{},{},{},{},{},{},{},{},{}]
}
func setupPicker() {