Digital ACT-191 ONEAPP-7013 story: added model setup
This commit is contained in:
parent
5b702f3968
commit
1aaab51582
@ -48,7 +48,7 @@ class CarouselViewController: BaseViewController<Carousel> {
|
||||
lazy var paginationKindPickerSelectorView = {
|
||||
PickerSelectorView(title: "",
|
||||
picker: self.picker,
|
||||
items: Carousel.PaginationKind.allCases)
|
||||
items: ButtonIcon.Kind.allCases)
|
||||
}()
|
||||
|
||||
lazy var horizAlignmtPickerSelectorView = {
|
||||
@ -63,9 +63,8 @@ class CarouselViewController: BaseViewController<Carousel> {
|
||||
items: Carousel.Vertical.allCases)
|
||||
}()
|
||||
|
||||
var paginationFloatSwitch = Toggle()
|
||||
var paginationFloatingSwitch = Toggle()
|
||||
var paginationInsetField = TextField()
|
||||
var slotsWidthField = TextField()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@ -80,40 +79,40 @@ class CarouselViewController: BaseViewController<Carousel> {
|
||||
addFormRow(label: "onChange", view: label)
|
||||
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||
addFormRow(label: "Aspect Ratio", view: scalingTypePickerSelectorView)
|
||||
//data addFormRow(label: "data", view: slidesTextField)
|
||||
addFormRow(label: "Pagination Display", view: paginationDisplayPickerSelectorView)
|
||||
addFormRow(label: "Peek", view: peekPickerSelectorView)
|
||||
addFormRow(label: "Gutter", view: gutterPickerSelectorView)
|
||||
addFormRow(label: "Layout", view: layoutPickerSelectorView)
|
||||
addFormRow(label: "Pagination Kind", view: paginationKindPickerSelectorView)
|
||||
addFormRow(label: "Pagination Float", view: paginationFloatSwitch)
|
||||
addFormRow(label: "Pagination Float", view: paginationFloatingSwitch)
|
||||
addFormRow(label: "Pagination Inset", view: paginationInsetField)
|
||||
addFormRow(label: "Slots Width", view: slotsWidthField)
|
||||
addFormRow(label: "Slot Horizontal Alignment", view: horizAlignmtPickerSelectorView)
|
||||
addFormRow(label: "Slot Vertical Alignment", view: vertAlignmtPickerSelectorView)
|
||||
|
||||
// slotsWidthField
|
||||
// .numberPublisher
|
||||
// .sink { [weak self] number in
|
||||
// guard let number else {
|
||||
// return
|
||||
// }
|
||||
//// self?.component.numberOfSlides = number.intValue
|
||||
//// self?.component.position = Int(self?.positionTextField.text ?? "1") ?? 1
|
||||
// }.store(in: &subscribers)
|
||||
//
|
||||
// paginationInsetField
|
||||
// .textPublisher
|
||||
// .sink { [weak self] text in
|
||||
//// self?.component.labelText = text
|
||||
// }.store(in: &subscribers)
|
||||
//
|
||||
paginationInsetField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
self?.component.paginationInset = UIDevice.isIPad ? VDSLayout.space12X : VDSLayout.space8X
|
||||
}.store(in: &subscribers)
|
||||
|
||||
paginationFloatingSwitch.onChange = { [weak self] sender in
|
||||
guard let self else { return }
|
||||
self.component.pagination = .init(kind: paginationKindPickerSelectorView.selectedItem, floating: sender.isOn)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func setupModel() {
|
||||
//setup UI
|
||||
scalingTypePickerSelectorView.text = component.aspectRatio.rawValue
|
||||
|
||||
paginationDisplayPickerSelectorView.text = component.paginationDisplay.rawValue
|
||||
peekPickerSelectorView.text = component.peek.rawValue
|
||||
gutterPickerSelectorView.text = component.gutter.rawValue
|
||||
layoutPickerSelectorView.text = component.layout.rawValue
|
||||
paginationKindPickerSelectorView.text = ButtonIcon.Kind.lowContrast.rawValue
|
||||
paginationFloatingSwitch.isOn = true
|
||||
paginationInsetField.text = UIDevice.isIPad ? "12px" : "8px"
|
||||
paginationInsetField.isUserInteractionEnabled = false
|
||||
}
|
||||
|
||||
func setupPicker() {
|
||||
@ -121,9 +120,31 @@ class CarouselViewController: BaseViewController<Carousel> {
|
||||
self?.component.surface = item
|
||||
self?.contentTopView.backgroundColor = item.color
|
||||
}
|
||||
|
||||
scalingTypePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.component.aspectRatio = item
|
||||
}
|
||||
|
||||
paginationDisplayPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.component.paginationDisplay = item
|
||||
}
|
||||
|
||||
peekPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.component.peek = item
|
||||
}
|
||||
|
||||
gutterPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.component.gutter = item
|
||||
}
|
||||
|
||||
layoutPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.component.layout = item
|
||||
}
|
||||
|
||||
paginationKindPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
guard let self else { return }
|
||||
self.component.pagination = .init(kind: item, floating: paginationFloatingSwitch.isOn)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user