Merge branch 'bugfix/setDefaults' of https://gitlab.verizon.com/BPHV_MIPS/vds_ios.git into mbruce/bugfix
This commit is contained in:
commit
c534072a12
@ -111,10 +111,14 @@ open class SelectorBase: Control, SelectorControlable {
|
|||||||
open override func setDefaults() {
|
open override func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
|
|
||||||
|
showError = false
|
||||||
|
|
||||||
onClick = { control in
|
onClick = { control in
|
||||||
control.toggle()
|
control.toggle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChange = nil
|
||||||
|
|
||||||
bridge_accessibilityLabelBlock = { [weak self] in
|
bridge_accessibilityLabelBlock = { [weak self] in
|
||||||
guard let self else { return "" }
|
guard let self else { return "" }
|
||||||
return "\(Self.self)\(showError ? ", error" : "")"
|
return "\(Self.self)\(showError ? ", error" : "")"
|
||||||
|
|||||||
@ -123,6 +123,7 @@ open class SelectorGroupBase<SelectorItemType: Groupable>: Control, SelectorGrou
|
|||||||
open override func setDefaults() {
|
open override func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
onChange = nil
|
onChange = nil
|
||||||
|
items = []
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handler for the Group to override on a select event.
|
/// Handler for the Group to override on a select event.
|
||||||
@ -137,13 +138,6 @@ open class SelectorGroupBase<SelectorItemType: Groupable>: Control, SelectorGrou
|
|||||||
self?.sendActions(for: .valueChanged)
|
self?.sendActions(for: .valueChanged)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
items.forEach{ $0.reset() }
|
|
||||||
setItemsActions()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -117,10 +117,11 @@ open class Breadcrumbs: View {
|
|||||||
containerView.pinToSuperView()
|
containerView.pinToSuperView()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
open override func setDefaults() {
|
||||||
open override func reset() {
|
super.setDefaults()
|
||||||
super.reset()
|
breadcrumbs = []
|
||||||
breadcrumbs.forEach { $0.reset() }
|
breadcrumbModels = []
|
||||||
|
isEnabled = true
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
|
|||||||
@ -173,6 +173,7 @@ open class ButtonGroup: View {
|
|||||||
rowQuantityTablet = 0
|
rowQuantityTablet = 0
|
||||||
alignment = .center
|
alignment = .center
|
||||||
childWidth = nil
|
childWidth = nil
|
||||||
|
buttons = []
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
|
|||||||
@ -106,14 +106,15 @@ open class CarouselScrollbar: View {
|
|||||||
|
|
||||||
/// A callback when the scrubber position changes. Passes parameters (position).
|
/// A callback when the scrubber position changes. Passes parameters (position).
|
||||||
open var onScrubberDrag: ((Int) -> Void)? {
|
open var onScrubberDrag: ((Int) -> Void)? {
|
||||||
get { nil }
|
didSet {
|
||||||
set {
|
|
||||||
onScrubberDragCancellable?.cancel()
|
onScrubberDragCancellable?.cancel()
|
||||||
if let newValue {
|
if let onScrubberDrag {
|
||||||
onScrubberDragCancellable = onScrubberDragPublisher
|
onScrubberDragCancellable = onScrubberDragPublisher
|
||||||
.sink { c in
|
.sink { c in
|
||||||
newValue(c)
|
onScrubberDrag(c)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
onScrubberDragCancellable = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,14 +125,15 @@ open class CarouselScrollbar: View {
|
|||||||
|
|
||||||
/// A callback when the thumb move forward. Passes parameters (position).
|
/// A callback when the thumb move forward. Passes parameters (position).
|
||||||
open var onMoveForward: ((Int) -> Void)? {
|
open var onMoveForward: ((Int) -> Void)? {
|
||||||
get { nil }
|
didSet {
|
||||||
set {
|
|
||||||
onMoveForwardCancellable?.cancel()
|
onMoveForwardCancellable?.cancel()
|
||||||
if let newValue {
|
if let onMoveForward {
|
||||||
onMoveForwardCancellable = onMoveForwardPublisher
|
onMoveForwardCancellable = onMoveForwardPublisher
|
||||||
.sink { c in
|
.sink { c in
|
||||||
newValue(c)
|
onMoveForward(c)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
onMoveForwardCancellable = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,14 +144,15 @@ open class CarouselScrollbar: View {
|
|||||||
|
|
||||||
/// A callback when the thumb move backward. Passes parameters (position).
|
/// A callback when the thumb move backward. Passes parameters (position).
|
||||||
open var onMoveBackward: ((Int) -> Void)? {
|
open var onMoveBackward: ((Int) -> Void)? {
|
||||||
get { nil }
|
didSet {
|
||||||
set {
|
|
||||||
onMoveBackwardCancellable?.cancel()
|
onMoveBackwardCancellable?.cancel()
|
||||||
if let newValue {
|
if let onMoveBackward {
|
||||||
onMoveBackwardCancellable = onMoveBackwardPublisher
|
onMoveBackwardCancellable = onMoveBackwardPublisher
|
||||||
.sink { c in
|
.sink { c in
|
||||||
newValue(c)
|
onMoveBackward(c)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
onMoveBackwardCancellable = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,14 +163,15 @@ open class CarouselScrollbar: View {
|
|||||||
|
|
||||||
/// A callback when the thumb touch start. Passes parameters (position).
|
/// A callback when the thumb touch start. Passes parameters (position).
|
||||||
open var onThumbTouchStart: ((Int) -> Void)? {
|
open var onThumbTouchStart: ((Int) -> Void)? {
|
||||||
get { nil }
|
didSet {
|
||||||
set {
|
|
||||||
onThumbTouchStartCancellable?.cancel()
|
onThumbTouchStartCancellable?.cancel()
|
||||||
if let newValue {
|
if let onThumbTouchStart {
|
||||||
onThumbTouchStartCancellable = onThumbTouchStartPublisher
|
onThumbTouchStartCancellable = onThumbTouchStartPublisher
|
||||||
.sink { c in
|
.sink { c in
|
||||||
newValue(c)
|
onThumbTouchStart(c)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
onThumbTouchStartCancellable = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,14 +182,15 @@ open class CarouselScrollbar: View {
|
|||||||
|
|
||||||
/// A callback when the thumb touch end. Passes parameters (position).
|
/// A callback when the thumb touch end. Passes parameters (position).
|
||||||
open var onThumbTouchEnd: ((Int) -> Void)? {
|
open var onThumbTouchEnd: ((Int) -> Void)? {
|
||||||
get { nil }
|
didSet {
|
||||||
set {
|
|
||||||
onThumbTouchEndCancellable?.cancel()
|
onThumbTouchEndCancellable?.cancel()
|
||||||
if let newValue {
|
if let onThumbTouchEnd {
|
||||||
onThumbTouchEndCancellable = onThumbTouchEndPublisher
|
onThumbTouchEndCancellable = onThumbTouchEndPublisher
|
||||||
.sink { c in
|
.sink { c in
|
||||||
newValue(c)
|
onThumbTouchEnd(c)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
onThumbTouchEndCancellable = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -294,6 +299,19 @@ open class CarouselScrollbar: View {
|
|||||||
thumbView.layer.addSublayer(thumbViewLayer)
|
thumbView.layer.addSublayer(thumbViewLayer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
onMoveForward = nil
|
||||||
|
onMoveBackward = nil
|
||||||
|
onScrubberDrag = nil
|
||||||
|
onThumbTouchEnd = nil
|
||||||
|
onThumbTouchStart = nil
|
||||||
|
layout = .oneUP
|
||||||
|
numberOfSlides = 1
|
||||||
|
totalPositions = 1
|
||||||
|
position = 1
|
||||||
|
}
|
||||||
|
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
trackView.backgroundColor = trackColorConfiguration.getColor(surface)
|
trackView.backgroundColor = trackColorConfiguration.getColor(surface)
|
||||||
|
|||||||
@ -62,6 +62,11 @@ open class Checkbox: SelectorBase {
|
|||||||
selectorColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOnlight, forState: .selected)
|
selectorColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOnlight, forState: .selected)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
isAnimated = false
|
||||||
|
}
|
||||||
|
|
||||||
/// This will change the state of the Selector and execute the actionBlock if provided.
|
/// This will change the state of the Selector and execute the actionBlock if provided.
|
||||||
open override func toggle() {
|
open override func toggle() {
|
||||||
guard isEnabled else { return }
|
guard isEnabled else { return }
|
||||||
|
|||||||
@ -87,6 +87,12 @@ open class CheckboxGroup: SelectorGroupBase<CheckboxItem>, SelectorGroupMultiSel
|
|||||||
mainStackView.spacing = VDSLayout.space6X
|
mainStackView.spacing = VDSLayout.space6X
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
showError = false
|
||||||
|
inputId = nil
|
||||||
|
}
|
||||||
|
|
||||||
public override func didSelect(_ selectedControl: CheckboxItem) {
|
public override func didSelect(_ selectedControl: CheckboxItem) {
|
||||||
selectedControl.toggle()
|
selectedControl.toggle()
|
||||||
if selectedControl.isSelected, showError{
|
if selectedControl.isSelected, showError{
|
||||||
|
|||||||
@ -56,6 +56,11 @@ open class CheckboxItem: SelectorItemBase<Checkbox> {
|
|||||||
print(foo.customView.isAnimated)
|
print(foo.customView.isAnimated)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
isAnimated = false
|
||||||
|
}
|
||||||
|
|
||||||
/// Used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
selectorView.isAnimated = isAnimated
|
selectorView.isAnimated = isAnimated
|
||||||
|
|||||||
@ -82,24 +82,15 @@ open class DropdownSelect: EntryFieldBase<String> {
|
|||||||
open var inlineDisplayLabel = Label().with {
|
open var inlineDisplayLabel = Label().with {
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .horizontal)
|
$0.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
$0.textAlignment = .left
|
|
||||||
$0.textStyle = .boldBodyLarge
|
|
||||||
$0.numberOfLines = 1
|
|
||||||
$0.sizeToFit()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open var selectedOptionLabel = Label().with {
|
open var selectedOptionLabel = Label().with {
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .horizontal)
|
$0.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
$0.textAlignment = .left
|
|
||||||
$0.textStyle = .bodyLarge
|
|
||||||
$0.numberOfLines = 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open var dropdownField = UITextField().with {
|
open var dropdownField = UITextField().with {
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
$0.tintColor = UIColor.clear
|
|
||||||
$0.font = TextStyle.bodyLarge.font
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open var optionsPicker = UIPickerView()
|
open var optionsPicker = UIPickerView()
|
||||||
@ -163,13 +154,25 @@ open class DropdownSelect: EntryFieldBase<String> {
|
|||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
showInlineLabel = false
|
showInlineLabel = false
|
||||||
selectId = nil
|
selectId = nil
|
||||||
|
inlineDisplayLabel.textAlignment = .left
|
||||||
inlineDisplayLabel.textStyle = .boldBodyLarge
|
inlineDisplayLabel.textStyle = .boldBodyLarge
|
||||||
|
inlineDisplayLabel.numberOfLines = 1
|
||||||
|
selectedOptionLabel.textAlignment = .left
|
||||||
selectedOptionLabel.textStyle = .bodyLarge
|
selectedOptionLabel.textStyle = .bodyLarge
|
||||||
|
selectedOptionLabel.numberOfLines = 1
|
||||||
|
dropdownField.tintColor = UIColor.clear
|
||||||
|
dropdownField.font = TextStyle.bodyLarge.font
|
||||||
showInlineLabel = false
|
showInlineLabel = false
|
||||||
options = []
|
options = []
|
||||||
selectId = nil
|
selectId = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func reset() {
|
||||||
|
inlineDisplayLabel.reset()
|
||||||
|
selectedOptionLabel.reset()
|
||||||
|
super.reset()
|
||||||
|
}
|
||||||
|
|
||||||
open override func getFieldContainer() -> UIView {
|
open override func getFieldContainer() -> UIView {
|
||||||
let controlStackView = UIStackView().with {
|
let controlStackView = UIStackView().with {
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|||||||
@ -57,7 +57,7 @@ open class Pagination: View {
|
|||||||
///Next button to select next page
|
///Next button to select next page
|
||||||
public let nextButton: PaginationButton = .init(type: .next)
|
public let nextButton: PaginationButton = .init(type: .next)
|
||||||
/// A callback when the page changes. Passes parameters (selectedPage).
|
/// A callback when the page changes. Passes parameters (selectedPage).
|
||||||
public var onPageDidSelect: ((Int) -> Void)?
|
open var onPageDidSelect: ((Int) -> Void)?
|
||||||
/// Total number of pages, allows limit ranging from 0 to 9999.
|
/// Total number of pages, allows limit ranging from 0 to 9999.
|
||||||
@Clamping(range: 0...9999)
|
@Clamping(range: 0...9999)
|
||||||
public var total: Int {
|
public var total: Int {
|
||||||
@ -70,7 +70,7 @@ open class Pagination: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
///Selected active page number and clips to total pages if selected index is greater than the total pages.
|
///Selected active page number and clips to total pages if selected index is greater than the total pages.
|
||||||
public var selectedPage: Int {
|
open var selectedPage: Int {
|
||||||
set {
|
set {
|
||||||
if newValue >= total {
|
if newValue >= total {
|
||||||
_selectedPageIndex = total - 1
|
_selectedPageIndex = total - 1
|
||||||
|
|||||||
@ -288,7 +288,6 @@ open class TitleLockup: View {
|
|||||||
subTitleModel = nil
|
subTitleModel = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var labelViews = [UIView]()
|
|
||||||
/// Used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user