moved default values into setDefaults()
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
fc7650f7d9
commit
bf4ff94933
@ -104,6 +104,12 @@ open class SelectorBase: Control, SelectorControlable {
|
|||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
isAccessibilityElement = true
|
||||||
|
accessibilityTraits = .button
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
|
||||||
onClick = { control in
|
onClick = { control in
|
||||||
control.toggle()
|
control.toggle()
|
||||||
@ -118,10 +124,6 @@ open class SelectorBase: Control, SelectorControlable {
|
|||||||
guard let self else { return "" }
|
guard let self else { return "" }
|
||||||
return !isEnabled ? "" : "Double tap to activate."
|
return !isEnabled ? "" : "Double tap to activate."
|
||||||
}
|
}
|
||||||
|
|
||||||
isAccessibilityElement = true
|
|
||||||
accessibilityTraits = .button
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
|
|||||||
@ -65,6 +65,16 @@ open class SelectorGroupBase<SelectorItemType: Groupable>: Control, SelectorGrou
|
|||||||
}
|
}
|
||||||
|
|
||||||
didSet {
|
didSet {
|
||||||
|
setItemsActions()
|
||||||
|
for selector in items {
|
||||||
|
mainStackView.addArrangedSubview(selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open var onChangeSubscriber: AnyCancellable?
|
||||||
|
|
||||||
|
private func setItemsActions() {
|
||||||
for selector in items {
|
for selector in items {
|
||||||
selector.onClick = { [weak self] handler in
|
selector.onClick = { [weak self] handler in
|
||||||
self?.didSelect(handler)
|
self?.didSelect(handler)
|
||||||
@ -76,13 +86,8 @@ open class SelectorGroupBase<SelectorItemType: Groupable>: Control, SelectorGrou
|
|||||||
self?.didSelect(handler)
|
self?.didSelect(handler)
|
||||||
self?.setNeedsUpdate()
|
self?.setNeedsUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
mainStackView.addArrangedSubview(selector)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
open var onChangeSubscriber: AnyCancellable?
|
|
||||||
|
|
||||||
/// Whether the Control is enabled or not.
|
/// Whether the Control is enabled or not.
|
||||||
override open var isEnabled: Bool {
|
override open var isEnabled: Bool {
|
||||||
@ -115,6 +120,11 @@ open class SelectorGroupBase<SelectorItemType: Groupable>: Control, SelectorGrou
|
|||||||
.pinBottom(0, .defaultHigh)
|
.pinBottom(0, .defaultHigh)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
onChange = nil
|
||||||
|
}
|
||||||
|
|
||||||
/// Handler for the Group to override on a select event.
|
/// Handler for the Group to override on a select event.
|
||||||
/// - Parameter selectedControl: Selected Control the user interacted.
|
/// - Parameter selectedControl: Selected Control the user interacted.
|
||||||
open func didSelect(_ selectedControl: SelectorItemType) {
|
open func didSelect(_ selectedControl: SelectorItemType) {
|
||||||
@ -131,8 +141,8 @@ open class SelectorGroupBase<SelectorItemType: Groupable>: Control, SelectorGrou
|
|||||||
/// Resets to default settings.
|
/// Resets to default settings.
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
onChange = nil
|
|
||||||
items.forEach{ $0.reset() }
|
items.forEach{ $0.reset() }
|
||||||
|
setItemsActions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -162,6 +162,27 @@ open class SelectorItemBase<Selector: SelectorBase>: Control, Errorable, Changea
|
|||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
|
||||||
|
selectorView.isAccessibilityElement = true
|
||||||
|
isAccessibilityElement = false
|
||||||
|
addSubview(mainStackView)
|
||||||
|
|
||||||
|
mainStackView.isUserInteractionEnabled = false
|
||||||
|
mainStackView.addArrangedSubview(selectorStackView)
|
||||||
|
mainStackView.addArrangedSubview(errorLabel)
|
||||||
|
selectorStackView.addArrangedSubview(selectorView)
|
||||||
|
selectorStackView.addArrangedSubview(selectorLabelStackView)
|
||||||
|
selectorLabelStackView.addArrangedSubview(label)
|
||||||
|
selectorLabelStackView.addArrangedSubview(childLabel)
|
||||||
|
mainStackView
|
||||||
|
.pinTop()
|
||||||
|
.pinLeading()
|
||||||
|
.pinTrailing()
|
||||||
|
.pinBottom(0, .defaultHigh)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
|
||||||
onClick = { [weak self] control in
|
onClick = { [weak self] control in
|
||||||
guard let self, isEnabled else { return }
|
guard let self, isEnabled else { return }
|
||||||
toggle()
|
toggle()
|
||||||
@ -206,22 +227,22 @@ open class SelectorItemBase<Selector: SelectorBase>: Control, Errorable, Changea
|
|||||||
return !isEnabled ? "" : "Double tap to activate."
|
return !isEnabled ? "" : "Double tap to activate."
|
||||||
}
|
}
|
||||||
|
|
||||||
selectorView.isAccessibilityElement = true
|
label.textStyle = .boldBodyLarge
|
||||||
isAccessibilityElement = false
|
childLabel.textStyle = .bodyLarge
|
||||||
addSubview(mainStackView)
|
errorLabel.textStyle = .bodyMedium
|
||||||
|
|
||||||
mainStackView.isUserInteractionEnabled = false
|
labelText = nil
|
||||||
mainStackView.addArrangedSubview(selectorStackView)
|
labelTextAttributes = nil
|
||||||
mainStackView.addArrangedSubview(errorLabel)
|
labelAttributedText = nil
|
||||||
selectorStackView.addArrangedSubview(selectorView)
|
childText = nil
|
||||||
selectorStackView.addArrangedSubview(selectorLabelStackView)
|
childTextAttributes = nil
|
||||||
selectorLabelStackView.addArrangedSubview(label)
|
childAttributedText = nil
|
||||||
selectorLabelStackView.addArrangedSubview(childLabel)
|
showError = false
|
||||||
mainStackView
|
errorText = nil
|
||||||
.pinTop()
|
inputId = nil
|
||||||
.pinLeading()
|
isSelected = false
|
||||||
.pinTrailing()
|
|
||||||
.pinBottom(0, .defaultHigh)
|
onChange = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
@ -277,30 +298,10 @@ open class SelectorItemBase<Selector: SelectorBase>: Control, Errorable, Changea
|
|||||||
|
|
||||||
/// Resets to default settings.
|
/// Resets to default settings.
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
|
||||||
shouldUpdateView = false
|
|
||||||
label.reset()
|
label.reset()
|
||||||
childLabel.reset()
|
childLabel.reset()
|
||||||
errorLabel.reset()
|
errorLabel.reset()
|
||||||
|
super.reset()
|
||||||
label.textStyle = .boldBodyLarge
|
|
||||||
childLabel.textStyle = .bodyLarge
|
|
||||||
errorLabel.textStyle = .bodyMedium
|
|
||||||
|
|
||||||
labelText = nil
|
|
||||||
labelTextAttributes = nil
|
|
||||||
labelAttributedText = nil
|
|
||||||
childText = nil
|
|
||||||
childTextAttributes = nil
|
|
||||||
childAttributedText = nil
|
|
||||||
showError = false
|
|
||||||
errorText = nil
|
|
||||||
inputId = nil
|
|
||||||
isSelected = false
|
|
||||||
|
|
||||||
onChange = nil
|
|
||||||
shouldUpdateView = true
|
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -149,25 +149,28 @@ open class Badge: View {
|
|||||||
maxWidthConstraint = label.widthLessThanEqualTo(constant: 0).with { $0.isActive = false }
|
maxWidthConstraint = label.widthLessThanEqualTo(constant: 0).with { $0.isActive = false }
|
||||||
clipsToBounds = true
|
clipsToBounds = true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
|
||||||
bridge_accessibilityLabelBlock = { [weak self] in
|
bridge_accessibilityLabelBlock = { [weak self] in
|
||||||
guard let self else { return "" }
|
guard let self else { return "" }
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
shouldUpdateView = false
|
|
||||||
label.reset()
|
|
||||||
label.lineBreakMode = .byTruncatingTail
|
label.lineBreakMode = .byTruncatingTail
|
||||||
label.textStyle = .boldBodySmall
|
label.textStyle = .boldBodySmall
|
||||||
fillColor = .red
|
fillColor = .red
|
||||||
text = ""
|
text = ""
|
||||||
maxWidth = nil
|
maxWidth = nil
|
||||||
numberOfLines = 1
|
numberOfLines = 1
|
||||||
shouldUpdateView = true
|
}
|
||||||
setNeedsUpdate()
|
|
||||||
|
/// Resets to default settings.
|
||||||
|
open override func reset() {
|
||||||
|
label.reset()
|
||||||
|
super.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
|
|||||||
@ -305,17 +305,31 @@ open class BadgeIndicator: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
open override func setDefaults() {
|
||||||
open override func reset() {
|
super.setDefaults()
|
||||||
super.reset()
|
|
||||||
shouldUpdateView = false
|
|
||||||
label.reset()
|
|
||||||
label.lineBreakMode = .byTruncatingTail
|
label.lineBreakMode = .byTruncatingTail
|
||||||
label.textAlignment = .center
|
label.textAlignment = .center
|
||||||
fillColor = .red
|
fillColor = .red
|
||||||
number = nil
|
number = nil
|
||||||
shouldUpdateView = true
|
kind = .simple
|
||||||
setNeedsUpdate()
|
leadingCharacter = nil
|
||||||
|
trailingText = nil
|
||||||
|
size = .xxlarge
|
||||||
|
dotSize = nil
|
||||||
|
verticalPadding = nil
|
||||||
|
horizontalPadding = nil
|
||||||
|
hideDot = false
|
||||||
|
hideBorder = false
|
||||||
|
width = nil
|
||||||
|
height = nil
|
||||||
|
accessibilityText = nil
|
||||||
|
maximumDigits = .two
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Resets to default settings.
|
||||||
|
open override func reset() {
|
||||||
|
label.reset()
|
||||||
|
super.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
|
|||||||
@ -72,17 +72,15 @@ open class BreadcrumbItem: ButtonBase {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
open override func setDefaults() {
|
||||||
open override func setup() {
|
super.setDefaults()
|
||||||
super.setup()
|
isAccessibilityElement = true
|
||||||
|
accessibilityTraits = .link
|
||||||
|
|
||||||
titleLabel?.numberOfLines = 0
|
titleLabel?.numberOfLines = 0
|
||||||
titleLabel?.lineBreakMode = .byWordWrapping
|
titleLabel?.lineBreakMode = .byWordWrapping
|
||||||
contentHorizontalAlignment = .left
|
contentHorizontalAlignment = .left
|
||||||
|
|
||||||
isAccessibilityElement = true
|
|
||||||
accessibilityTraits = .link
|
|
||||||
|
|
||||||
bridge_accessibilityHintBlock = { [weak self] in
|
bridge_accessibilityHintBlock = { [weak self] in
|
||||||
guard let self else { return "" }
|
guard let self else { return "" }
|
||||||
return !isEnabled ? "" : "Double tap to open."
|
return !isEnabled ? "" : "Double tap to open."
|
||||||
@ -131,17 +129,4 @@ open class BreadcrumbItem: ButtonBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
shouldUpdateView = false
|
|
||||||
text = nil
|
|
||||||
accessibilityCustomActions = []
|
|
||||||
isAccessibilityElement = true
|
|
||||||
accessibilityTraits = .button
|
|
||||||
shouldUpdateView = true
|
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,10 +120,7 @@ open class Breadcrumbs: View {
|
|||||||
/// Resets to default settings.
|
/// Resets to default settings.
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
shouldUpdateView = false
|
|
||||||
breadcrumbs.forEach { $0.reset() }
|
breadcrumbs.forEach { $0.reset() }
|
||||||
shouldUpdateView = true
|
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
|
|||||||
@ -224,15 +224,11 @@ open class Button: ButtonBase, Useable {
|
|||||||
accessibilityTraits = .button
|
accessibilityTraits = .button
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
open override func setDefaults() {
|
||||||
open override func reset() {
|
super.setDefaults()
|
||||||
super.reset()
|
|
||||||
shouldUpdateView = false
|
|
||||||
use = .primary
|
use = .primary
|
||||||
width = nil
|
width = nil
|
||||||
size = .large
|
size = .large
|
||||||
shouldUpdateView = true
|
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
|
|||||||
@ -167,15 +167,17 @@ open class ButtonGroup: View {
|
|||||||
collectionView.reloadData()
|
collectionView.reloadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func setDefaults() {
|
||||||
super.reset()
|
super.setDefaults()
|
||||||
shouldUpdateView = false
|
|
||||||
rowQuantityPhone = 0
|
rowQuantityPhone = 0
|
||||||
rowQuantityTablet = 0
|
rowQuantityTablet = 0
|
||||||
alignment = .center
|
alignment = .center
|
||||||
|
childWidth = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func reset() {
|
||||||
buttons.forEach { $0.reset() }
|
buttons.forEach { $0.reset() }
|
||||||
shouldUpdateView = true
|
super.reset()
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func layoutSubviews() {
|
open override func layoutSubviews() {
|
||||||
|
|||||||
@ -91,11 +91,6 @@ open class TextLink: ButtonBase {
|
|||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityTraits = .link
|
|
||||||
|
|
||||||
//left align titleLabel in case this is pinned leading/trailing
|
|
||||||
//default is always set to center
|
|
||||||
contentHorizontalAlignment = .left
|
|
||||||
|
|
||||||
if let titleLabel {
|
if let titleLabel {
|
||||||
addSubview(line)
|
addSubview(line)
|
||||||
@ -106,12 +101,21 @@ open class TextLink: ButtonBase {
|
|||||||
lineHeightConstraint = line.height(constant: 1)
|
lineHeightConstraint = line.height(constant: 1)
|
||||||
lineHeightConstraint?.isActive = true
|
lineHeightConstraint?.isActive = true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
size = .large
|
||||||
|
accessibilityTraits = .link
|
||||||
|
|
||||||
|
//left align titleLabel in case this is pinned leading/trailing
|
||||||
|
//default is always set to center
|
||||||
|
contentHorizontalAlignment = .left
|
||||||
|
|
||||||
bridge_accessibilityHintBlock = { [weak self] in
|
bridge_accessibilityHintBlock = { [weak self] in
|
||||||
guard let self else { return "" }
|
guard let self else { return "" }
|
||||||
return !isEnabled ? "" : "Double tap to open."
|
return !isEnabled ? "" : "Double tap to open."
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
@ -124,17 +128,4 @@ open class TextLink: ButtonBase {
|
|||||||
super.updateView()
|
super.updateView()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
shouldUpdateView = false
|
|
||||||
text = nil
|
|
||||||
size = .large
|
|
||||||
accessibilityCustomActions = []
|
|
||||||
isAccessibilityElement = true
|
|
||||||
accessibilityTraits = .link
|
|
||||||
shouldUpdateView = true
|
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,10 +76,8 @@ open class TextLinkCaret: ButtonBase {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
open override func setDefaults() {
|
||||||
open override func setup() {
|
super.setDefaults()
|
||||||
super.setup()
|
|
||||||
|
|
||||||
//left align titleLabel in case this is pinned leading/trailing
|
//left align titleLabel in case this is pinned leading/trailing
|
||||||
//default is always set to center
|
//default is always set to center
|
||||||
contentHorizontalAlignment = .left
|
contentHorizontalAlignment = .left
|
||||||
@ -88,11 +86,12 @@ open class TextLinkCaret: ButtonBase {
|
|||||||
titleLabel?.numberOfLines = 0
|
titleLabel?.numberOfLines = 0
|
||||||
titleLabel?.lineBreakMode = .byWordWrapping
|
titleLabel?.lineBreakMode = .byWordWrapping
|
||||||
|
|
||||||
|
iconPosition = .right
|
||||||
|
|
||||||
bridge_accessibilityHintBlock = { [weak self] in
|
bridge_accessibilityHintBlock = { [weak self] in
|
||||||
guard let self else { return "" }
|
guard let self else { return "" }
|
||||||
return !isEnabled ? "" : "Double tap to open."
|
return !isEnabled ? "" : "Double tap to open."
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
@ -101,13 +100,6 @@ open class TextLinkCaret: ButtonBase {
|
|||||||
super.updateView()
|
super.updateView()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
iconPosition = .right
|
|
||||||
text = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The natural size for the receiving view, considering only properties of the view itself.
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
open override var intrinsicContentSize: CGSize {
|
open override var intrinsicContentSize: CGSize {
|
||||||
guard let titleLabel else { return super.intrinsicContentSize }
|
guard let titleLabel else { return super.intrinsicContentSize }
|
||||||
|
|||||||
@ -151,6 +151,19 @@ open class CalendarBase: Control, Changeable {
|
|||||||
collectionView.pinCenterX(anchor: containerView.centerXAnchor)
|
collectionView.pinCenterX(anchor: containerView.centerXAnchor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
hideContainerBorder = false
|
||||||
|
hideCurrentDateIndicator = false
|
||||||
|
transparentBackground = false
|
||||||
|
activeDates = []
|
||||||
|
inactiveDates = []
|
||||||
|
indicators = []
|
||||||
|
minDate = Date()
|
||||||
|
maxDate = Date()
|
||||||
|
selectedDate = Date()
|
||||||
|
}
|
||||||
|
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
// range check between min & max dates
|
// range check between min & max dates
|
||||||
@ -171,17 +184,6 @@ open class CalendarBase: Control, Changeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
hideContainerBorder = false
|
|
||||||
hideCurrentDateIndicator = false
|
|
||||||
transparentBackground = false
|
|
||||||
activeDates = []
|
|
||||||
inactiveDates = []
|
|
||||||
indicators = []
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Methods
|
// MARK: - Private Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -244,6 +244,18 @@ open class Carousel: View {
|
|||||||
updatePaginationInset()
|
updatePaginationInset()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
gutter = UIDevice.isIPad ? .gutter6X : .gutter3X
|
||||||
|
layout = UIDevice.isIPad ? .threeUP : .oneUP
|
||||||
|
onChange = nil
|
||||||
|
pagination = .init(kind: .lowContrast, floating: true)
|
||||||
|
paginationDisplay = .none
|
||||||
|
paginationInset = UIDevice.isIPad ? VDSLayout.space3X : VDSLayout.space2X
|
||||||
|
peek = .standard
|
||||||
|
groupIndex = 0
|
||||||
|
}
|
||||||
|
|
||||||
/// 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()
|
||||||
@ -275,18 +287,6 @@ open class Carousel: View {
|
|||||||
addCarouselSlots()
|
addCarouselSlots()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
shouldUpdateView = false
|
|
||||||
layout = UIDevice.isIPad ? .threeUP : .oneUP
|
|
||||||
pagination = .init(kind: .lowContrast, floating: true)
|
|
||||||
paginationDisplay = .none
|
|
||||||
paginationInset = UIDevice.isIPad ? VDSLayout.space3X : VDSLayout.space2X
|
|
||||||
gutter = UIDevice.isIPad ? .gutter6X : .gutter3X
|
|
||||||
peek = .standard
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Methods
|
// MARK: - Private Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -174,6 +174,14 @@ open class DatePicker: EntryFieldBase {
|
|||||||
popoverOverlayView.isHidden = true
|
popoverOverlayView.isHidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
selectedDate = nil
|
||||||
|
calendarModel = .init()
|
||||||
|
dateFormat = .shortNumeric
|
||||||
|
selectedDateLabel.textStyle = .bodyLarge
|
||||||
|
}
|
||||||
|
|
||||||
open override func getFieldContainer() -> UIView {
|
open override func getFieldContainer() -> UIView {
|
||||||
// stackview for controls in EntryFieldBase.controlContainerView
|
// stackview for controls in EntryFieldBase.controlContainerView
|
||||||
let controlStackView = UIStackView().with {
|
let controlStackView = UIStackView().with {
|
||||||
@ -200,12 +208,6 @@ open class DatePicker: EntryFieldBase {
|
|||||||
calendarIcon.color = iconColorConfiguration.getColor(self)
|
calendarIcon.color = iconColorConfiguration.getColor(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
selectedDateLabel.textStyle = .bodyLarge
|
|
||||||
}
|
|
||||||
|
|
||||||
internal func formatDate(_ date: Date) {
|
internal func formatDate(_ date: Date) {
|
||||||
let formatter = DateFormatter()
|
let formatter = DateFormatter()
|
||||||
formatter.dateFormat = dateFormat.format
|
formatter.dateFormat = dateFormat.format
|
||||||
|
|||||||
@ -162,6 +162,17 @@ open class DropdownSelect: EntryFieldBase {
|
|||||||
containerView.height(44)
|
containerView.height(44)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
showInlineLabel = false
|
||||||
|
selectId = nil
|
||||||
|
inlineDisplayLabel.textStyle = .boldBodyLarge
|
||||||
|
selectedOptionLabel.textStyle = .bodyLarge
|
||||||
|
showInlineLabel = false
|
||||||
|
options = []
|
||||||
|
selectId = nil
|
||||||
|
}
|
||||||
|
|
||||||
open override func getFieldContainer() -> UIView {
|
open override func getFieldContainer() -> UIView {
|
||||||
let controlStackView = UIStackView().with {
|
let controlStackView = UIStackView().with {
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
@ -189,17 +200,6 @@ open class DropdownSelect: EntryFieldBase {
|
|||||||
selectedOptionLabel.isEnabled = isEnabled
|
selectedOptionLabel.isEnabled = isEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
|
|
||||||
inlineDisplayLabel.textStyle = .boldBodyLarge
|
|
||||||
selectedOptionLabel.textStyle = .bodyLarge
|
|
||||||
showInlineLabel = false
|
|
||||||
options = []
|
|
||||||
selectId = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Methods
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -413,6 +413,27 @@ open class ButtonIcon: Control, Changeable {
|
|||||||
.store(in: &subscribers)
|
.store(in: &subscribers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
badgeIndicatorModel = nil
|
||||||
|
kind = .ghost
|
||||||
|
surfaceType = .colorFill
|
||||||
|
iconName = nil
|
||||||
|
selectedIconName = nil
|
||||||
|
selectedIconColorConfiguration = nil
|
||||||
|
size = .large
|
||||||
|
floating = false
|
||||||
|
fitToIcon = false
|
||||||
|
hideBorder = true
|
||||||
|
showBadgeIndicator = false
|
||||||
|
selectable = false
|
||||||
|
iconOffset = .init(x: 0, y: 0)
|
||||||
|
customContainerSize = nil
|
||||||
|
customIconSize = nil
|
||||||
|
customBadgeIndicatorOffset = nil
|
||||||
|
onChange = nil
|
||||||
|
}
|
||||||
|
|
||||||
/// 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 func toggle() {
|
open func toggle() {
|
||||||
//removed error
|
//removed error
|
||||||
@ -420,26 +441,6 @@ open class ButtonIcon: Control, Changeable {
|
|||||||
sendActions(for: .valueChanged)
|
sendActions(for: .valueChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
shouldUpdateView = false
|
|
||||||
kind = .ghost
|
|
||||||
surfaceType = .colorFill
|
|
||||||
size = .large
|
|
||||||
floating = false
|
|
||||||
hideBorder = true
|
|
||||||
iconOffset = .init(x: 0, y: 0)
|
|
||||||
iconName = nil
|
|
||||||
selectedIconName = nil
|
|
||||||
showBadgeIndicator = false
|
|
||||||
selectable = false
|
|
||||||
badgeIndicatorModel = nil
|
|
||||||
onChange = nil
|
|
||||||
shouldUpdateView = true
|
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 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()
|
||||||
|
|||||||
@ -91,21 +91,28 @@ open class Icon: View {
|
|||||||
addSubview(imageView)
|
addSubview(imageView)
|
||||||
imageView.pinToSuperView()
|
imageView.pinToSuperView()
|
||||||
|
|
||||||
backgroundColor = .clear
|
|
||||||
|
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityTraits = .none
|
accessibilityTraits = .none
|
||||||
accessibilityHint = "image"
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
backgroundColor = .clear
|
||||||
|
color = VDSColor.paletteBlack
|
||||||
|
size = .medium
|
||||||
|
name = nil
|
||||||
|
customSize = nil
|
||||||
|
imageView.image = nil
|
||||||
|
|
||||||
|
accessibilityHint = "image"
|
||||||
bridge_accessibilityLabelBlock = { [weak self] in
|
bridge_accessibilityLabelBlock = { [weak self] in
|
||||||
guard let self else { return "" }
|
guard let self else { return "" }
|
||||||
return name?.rawValue ?? "icon"
|
return name?.rawValue ?? "icon"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// 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()
|
||||||
@ -123,12 +130,6 @@ open class Icon: View {
|
|||||||
invalidateIntrinsicContentSize()
|
invalidateIntrinsicContentSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
color = VDSColor.paletteBlack
|
|
||||||
imageView.image = nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension UIImage {
|
extension UIImage {
|
||||||
|
|||||||
@ -81,11 +81,6 @@ open class Line: View {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
|
||||||
open override func setup() {
|
|
||||||
super.setup()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 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()
|
||||||
@ -94,8 +89,8 @@ open class Line: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
/// Resets to default settings.
|
||||||
open override func reset() {
|
open override func setDefaults() {
|
||||||
super.reset()
|
super.setDefaults()
|
||||||
style = .primary
|
style = .primary
|
||||||
orientation = .horizontal
|
orientation = .horizontal
|
||||||
}
|
}
|
||||||
|
|||||||
@ -274,20 +274,13 @@ open class Notification: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
open override func setDefaults() {
|
||||||
open override func reset() {
|
super.setDefaults()
|
||||||
super.reset()
|
|
||||||
|
|
||||||
shouldUpdateView = false
|
|
||||||
|
|
||||||
titleLabel.reset()
|
|
||||||
titleLabel.text = ""
|
titleLabel.text = ""
|
||||||
titleLabel.textStyle = UIDevice.isIPad ? .boldBodyLarge : .boldBodySmall
|
titleLabel.textStyle = UIDevice.isIPad ? .boldBodyLarge : .boldBodySmall
|
||||||
|
|
||||||
subTitleLabel.reset()
|
|
||||||
subTitleLabel.textStyle = UIDevice.isIPad ? .bodyLarge : .bodySmall
|
subTitleLabel.textStyle = UIDevice.isIPad ? .bodyLarge : .bodySmall
|
||||||
|
|
||||||
buttonGroup.reset()
|
|
||||||
buttonGroup.alignment = .left
|
buttonGroup.alignment = .left
|
||||||
|
|
||||||
primaryButtonModel = nil
|
primaryButtonModel = nil
|
||||||
@ -303,8 +296,14 @@ open class Notification: View {
|
|||||||
|
|
||||||
hideCloseButton = false
|
hideCloseButton = false
|
||||||
|
|
||||||
shouldUpdateView = true
|
}
|
||||||
setNeedsUpdate()
|
|
||||||
|
/// Resets to default settings.
|
||||||
|
open override func reset() {
|
||||||
|
titleLabel.reset()
|
||||||
|
subTitleLabel.reset()
|
||||||
|
buttonGroup.reset()
|
||||||
|
super.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
|
|||||||
@ -169,6 +169,31 @@ open class RadioBoxItem: Control, Changeable, FormFieldable, Groupable {
|
|||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
|
||||||
|
isAccessibilityElement = false
|
||||||
|
selectorView.isAccessibilityElement = true
|
||||||
|
selectorView.accessibilityTraits = .button
|
||||||
|
addSubview(selectorView)
|
||||||
|
selectorView.isUserInteractionEnabled = false
|
||||||
|
|
||||||
|
selectorView.addSubview(selectorStackView)
|
||||||
|
|
||||||
|
selectorStackView.addArrangedSubview(selectorLeftLabelStackView)
|
||||||
|
selectorStackView.addArrangedSubview(subTextRightLabel)
|
||||||
|
selectorLeftLabelStackView.addArrangedSubview(textLabel)
|
||||||
|
selectorLeftLabelStackView.addArrangedSubview(subTextLabel)
|
||||||
|
|
||||||
|
selectorView
|
||||||
|
.pinTop()
|
||||||
|
.pinLeading()
|
||||||
|
.pinTrailing(0, .defaultHigh)
|
||||||
|
.pinBottom(0, .defaultHigh)
|
||||||
|
|
||||||
|
selectorStackView.pinToSuperView(.uniform(VDSLayout.space3X))
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
|
||||||
onClick = { [weak self] _ in
|
onClick = { [weak self] _ in
|
||||||
guard let self, isEnabled else { return }
|
guard let self, isEnabled else { return }
|
||||||
toggle()
|
toggle()
|
||||||
@ -207,36 +232,6 @@ open class RadioBoxItem: Control, Changeable, FormFieldable, Groupable {
|
|||||||
return accessibilityLabels.joined(separator: ", ")
|
return accessibilityLabels.joined(separator: ", ")
|
||||||
}
|
}
|
||||||
|
|
||||||
isAccessibilityElement = false
|
|
||||||
selectorView.isAccessibilityElement = true
|
|
||||||
selectorView.accessibilityTraits = .button
|
|
||||||
addSubview(selectorView)
|
|
||||||
selectorView.isUserInteractionEnabled = false
|
|
||||||
|
|
||||||
selectorView.addSubview(selectorStackView)
|
|
||||||
|
|
||||||
selectorStackView.addArrangedSubview(selectorLeftLabelStackView)
|
|
||||||
selectorStackView.addArrangedSubview(subTextRightLabel)
|
|
||||||
selectorLeftLabelStackView.addArrangedSubview(textLabel)
|
|
||||||
selectorLeftLabelStackView.addArrangedSubview(subTextLabel)
|
|
||||||
|
|
||||||
selectorView
|
|
||||||
.pinTop()
|
|
||||||
.pinLeading()
|
|
||||||
.pinTrailing(0, .defaultHigh)
|
|
||||||
.pinBottom(0, .defaultHigh)
|
|
||||||
|
|
||||||
selectorStackView.pinToSuperView(.uniform(VDSLayout.space3X))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
shouldUpdateView = false
|
|
||||||
textLabel.reset()
|
|
||||||
subTextLabel.reset()
|
|
||||||
subTextRightLabel.reset()
|
|
||||||
|
|
||||||
textLabel.textStyle = .boldBodyLarge
|
textLabel.textStyle = .boldBodyLarge
|
||||||
subTextLabel.textStyle = .bodyLarge
|
subTextLabel.textStyle = .bodyLarge
|
||||||
subTextRightLabel.textStyle = .bodyLarge
|
subTextRightLabel.textStyle = .bodyLarge
|
||||||
@ -256,9 +251,14 @@ open class RadioBoxItem: Control, Changeable, FormFieldable, Groupable {
|
|||||||
|
|
||||||
isSelected = false
|
isSelected = false
|
||||||
onChange = nil
|
onChange = nil
|
||||||
|
}
|
||||||
|
|
||||||
shouldUpdateView = true
|
/// Resets to default settings.
|
||||||
setNeedsUpdate()
|
open override func reset() {
|
||||||
|
textLabel.reset()
|
||||||
|
subTextLabel.reset()
|
||||||
|
subTextRightLabel.reset()
|
||||||
|
super.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
|
|||||||
@ -77,12 +77,13 @@ open class RadioButtonGroup: SelectorGroupBase<RadioButtonItem>, SelectorGroupSi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func setDefaults() {
|
||||||
super.reset()
|
super.setDefaults()
|
||||||
|
inputId = nil
|
||||||
showError = false
|
showError = false
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func didSelect(_ selectedControl: RadioButtonItem) {
|
open override func didSelect(_ selectedControl: RadioButtonItem) {
|
||||||
if let selectedItem {
|
if let selectedItem {
|
||||||
updateToggle(selectedItem)
|
updateToggle(selectedItem)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,16 +109,14 @@ open class Table: View {
|
|||||||
matrixView.collectionViewLayout.invalidateLayout()
|
matrixView.collectionViewLayout.invalidateLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
open override func setDefaults() {
|
||||||
open override func reset() {
|
super.setDefaults()
|
||||||
super.reset()
|
|
||||||
striped = false
|
striped = false
|
||||||
padding = .standard
|
padding = .standard
|
||||||
tableHeader = []
|
tableHeader = []
|
||||||
tableRows = []
|
tableRows = []
|
||||||
fillContainer = true
|
fillContainer = true
|
||||||
columnWidths = nil
|
columnWidths = nil
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func calculateColumnWidths() -> [CGFloat] {
|
func calculateColumnWidths() -> [CGFloat] {
|
||||||
|
|||||||
@ -222,9 +222,10 @@ open class Tabs: View {
|
|||||||
updateContentView()
|
updateContentView()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func setDefaults() {
|
||||||
super.reset()
|
super.setDefaults()
|
||||||
shouldUpdateView = false
|
onTabDidSelect = nil
|
||||||
|
onTabShouldSelect = nil
|
||||||
orientation = .horizontal
|
orientation = .horizontal
|
||||||
borderLine = true
|
borderLine = true
|
||||||
fillContainer = false
|
fillContainer = false
|
||||||
@ -235,9 +236,7 @@ open class Tabs: View {
|
|||||||
selectedIndex = 0
|
selectedIndex = 0
|
||||||
size = .medium
|
size = .medium
|
||||||
sticky = false
|
sticky = false
|
||||||
tabViews.forEach{ $0.reset() }
|
tabModels = []
|
||||||
shouldUpdateView = true
|
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -316,6 +316,41 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
|||||||
errorLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
|
errorLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
|
||||||
helperLabel.textColorConfiguration = secondaryColorConfiguration.eraseToAnyColorable()
|
helperLabel.textColorConfiguration = secondaryColorConfiguration.eraseToAnyColorable()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Updates the UI
|
||||||
|
open override func updateView() {
|
||||||
|
super.updateView()
|
||||||
|
updateRules()
|
||||||
|
updateContainerView()
|
||||||
|
updateContainerWidth()
|
||||||
|
updateTitleLabel()
|
||||||
|
updateErrorLabel()
|
||||||
|
updateHelperLabel()
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
|
||||||
|
titleLabel.textStyle = .bodySmall
|
||||||
|
errorLabel.textStyle = .bodySmall
|
||||||
|
helperLabel.textStyle = .bodySmall
|
||||||
|
|
||||||
|
labelText = nil
|
||||||
|
helperText = nil
|
||||||
|
showError = false
|
||||||
|
errorText = nil
|
||||||
|
tooltipModel = nil
|
||||||
|
transparentBackground = false
|
||||||
|
width = nil
|
||||||
|
inputId = nil
|
||||||
|
defaultValue = nil
|
||||||
|
isRequired = false
|
||||||
|
isReadOnly = false
|
||||||
|
helperTextPlacement = .bottom
|
||||||
|
rules = []
|
||||||
|
onChange = nil
|
||||||
|
|
||||||
containerView.bridge_accessibilityLabelBlock = { [weak self] in
|
containerView.bridge_accessibilityLabelBlock = { [weak self] in
|
||||||
guard let self else { return "" }
|
guard let self else { return "" }
|
||||||
var accessibilityLabels = [String]()
|
var accessibilityLabels = [String]()
|
||||||
@ -350,42 +385,15 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
|||||||
guard let self else { return "" }
|
guard let self else { return "" }
|
||||||
return showError || hasInternalError ? "error" : nil
|
return showError || hasInternalError ? "error" : nil
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// Updates the UI
|
|
||||||
open override func updateView() {
|
|
||||||
super.updateView()
|
|
||||||
updateRules()
|
|
||||||
updateContainerView()
|
|
||||||
updateContainerWidth()
|
|
||||||
updateTitleLabel()
|
|
||||||
updateErrorLabel()
|
|
||||||
updateHelperLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
/// Resets to default settings.
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
|
||||||
titleLabel.reset()
|
titleLabel.reset()
|
||||||
errorLabel.reset()
|
errorLabel.reset()
|
||||||
helperLabel.reset()
|
helperLabel.reset()
|
||||||
|
super.reset()
|
||||||
titleLabel.textStyle = .bodySmall
|
|
||||||
errorLabel.textStyle = .bodySmall
|
|
||||||
helperLabel.textStyle = .bodySmall
|
|
||||||
|
|
||||||
labelText = nil
|
|
||||||
helperText = nil
|
|
||||||
showError = false
|
|
||||||
errorText = nil
|
|
||||||
tooltipModel = nil
|
|
||||||
transparentBackground = false
|
|
||||||
width = nil
|
|
||||||
inputId = nil
|
|
||||||
defaultValue = nil
|
|
||||||
isRequired = false
|
|
||||||
isReadOnly = false
|
|
||||||
onChange = nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override var canBecomeFirstResponder: Bool {
|
open override var canBecomeFirstResponder: Bool {
|
||||||
|
|||||||
@ -205,6 +205,22 @@ open class InputField: EntryFieldBase {
|
|||||||
|
|
||||||
textField.textColorConfiguration = textFieldTextColorConfiguration
|
textField.textColorConfiguration = textFieldTextColorConfiguration
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func getFieldContainer() -> UIView {
|
||||||
|
return textField
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
textField.text = ""
|
||||||
|
|
||||||
|
successLabel.textStyle = .bodySmall
|
||||||
|
|
||||||
|
fieldType = .text
|
||||||
|
showSuccess = false
|
||||||
|
successText = nil
|
||||||
|
|
||||||
containerView.bridge_accessibilityLabelBlock = { [weak self] in
|
containerView.bridge_accessibilityLabelBlock = { [weak self] in
|
||||||
guard let self else { return "" }
|
guard let self else { return "" }
|
||||||
var accessibilityLabels = [String]()
|
var accessibilityLabels = [String]()
|
||||||
@ -259,22 +275,10 @@ open class InputField: EntryFieldBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func getFieldContainer() -> UIView {
|
|
||||||
return textField
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Resets to default settings.
|
/// Resets to default settings.
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
|
||||||
textField.text = ""
|
|
||||||
|
|
||||||
successLabel.reset()
|
successLabel.reset()
|
||||||
successLabel.textStyle = .bodySmall
|
super.reset()
|
||||||
|
|
||||||
fieldType = .text
|
|
||||||
showSuccess = false
|
|
||||||
successText = nil
|
|
||||||
helperTextPlacement = .bottom
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
|
|||||||
@ -167,13 +167,18 @@ open class TextArea: EntryFieldBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
minHeight = .twoX
|
||||||
|
maxLength = nil
|
||||||
|
textView.text = ""
|
||||||
|
characterCounterLabel.textStyle = .bodySmall
|
||||||
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
/// Resets to default settings.
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
|
||||||
textView.text = ""
|
|
||||||
characterCounterLabel.reset()
|
characterCounterLabel.reset()
|
||||||
characterCounterLabel.textStyle = .bodySmall
|
super.reset()
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
|
|||||||
@ -279,19 +279,18 @@ open class TileContainerBase<PaddingType: DefaultValuing>: Control where Padding
|
|||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
open override func setDefaults() {
|
||||||
open override func reset() {
|
super.setDefaults()
|
||||||
super.reset()
|
backgroundImage = nil
|
||||||
shouldUpdateView = false
|
|
||||||
color = .white
|
color = .white
|
||||||
aspectRatio = .none
|
backgroundEffect = .none
|
||||||
|
padding = .defaultValue
|
||||||
|
aspectRatio = .ratio1x1
|
||||||
imageFallbackColor = .light
|
imageFallbackColor = .light
|
||||||
width = nil
|
width = nil
|
||||||
height = nil
|
height = nil
|
||||||
showBorder = false
|
showBorder = false
|
||||||
showDropShadow = false
|
showDropShadow = false
|
||||||
shouldUpdateView = true
|
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
|
|||||||
@ -390,20 +390,19 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
open override func setDefaults() {
|
||||||
open override func reset() {
|
super.setDefaults()
|
||||||
shouldUpdateView = false
|
|
||||||
super.reset()
|
|
||||||
aspectRatio = .none
|
aspectRatio = .none
|
||||||
color = .black
|
color = .black
|
||||||
|
textWidth = nil
|
||||||
|
textPostion = .top
|
||||||
|
|
||||||
//models
|
//models
|
||||||
badgeModel = nil
|
badgeModel = nil
|
||||||
titleModel = nil
|
titleModel = nil
|
||||||
subTitleModel = nil
|
subTitleModel = nil
|
||||||
descriptiveIconModel = nil
|
descriptiveIconModel = nil
|
||||||
directionalIconModel = nil
|
directionalIconModel = nil
|
||||||
shouldUpdateView = true
|
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
|
|||||||
@ -280,15 +280,12 @@ open class TitleLockup: View {
|
|||||||
set {}
|
set {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
open override func setDefaults() {
|
||||||
open override func reset() {
|
super.setDefaults()
|
||||||
super.reset()
|
textAlignment = .left
|
||||||
shouldUpdateView = false
|
|
||||||
eyebrowModel = nil
|
eyebrowModel = nil
|
||||||
titleModel = nil
|
titleModel = nil
|
||||||
subTitleModel = nil
|
subTitleModel = nil
|
||||||
shouldUpdateView = true
|
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var labelViews = [UIView]()
|
var labelViews = [UIView]()
|
||||||
|
|||||||
@ -159,19 +159,17 @@ open class Tooltip: Control, TooltipLaunchable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
open override func setDefaults() {
|
||||||
open override func reset() {
|
super.setDefaults()
|
||||||
super.reset()
|
|
||||||
shouldUpdateView = false
|
|
||||||
size = .medium
|
|
||||||
title = ""
|
|
||||||
content = ""
|
|
||||||
fillColor = .primary
|
|
||||||
closeButtonText = "Close"
|
closeButtonText = "Close"
|
||||||
shouldUpdateView = true
|
fillColor = .primary
|
||||||
setNeedsUpdate()
|
size = .medium
|
||||||
|
title = nil
|
||||||
|
content = nil
|
||||||
|
contentView = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// 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()
|
||||||
|
|||||||
@ -84,17 +84,13 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
open override func setDefaults() {
|
||||||
open override func reset() {
|
super.setDefaults()
|
||||||
super.reset()
|
|
||||||
shouldUpdateView = false
|
|
||||||
labelText = nil
|
labelText = nil
|
||||||
labelAttributes = nil
|
labelAttributes = nil
|
||||||
labelTextStyle = .defaultStyle
|
labelTextStyle = .defaultStyle
|
||||||
labelTextAlignment = .left
|
labelTextAlignment = .left
|
||||||
tooltipModel = nil
|
tooltipModel = nil
|
||||||
shouldUpdateView = true
|
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user