Merge branch 'bugfix/calendar_fixes' of https://gitlab.verizon.com/BPHV_MIPS/vds_ios.git into mbruce/bugfix
This commit is contained in:
commit
e76674cfc8
@ -160,7 +160,7 @@ open class CalendarBase: Control, Changeable {
|
|||||||
if (minDate <= maxDate) {
|
if (minDate <= maxDate) {
|
||||||
// Check if current date falls between min & max dates.
|
// Check if current date falls between min & max dates.
|
||||||
let fallsBetween = displayDate.isBetweeen(date: minDate, andDate: maxDate)
|
let fallsBetween = displayDate.isBetweeen(date: minDate, andDate: maxDate)
|
||||||
displayDate = fallsBetween ? displayDate : minDate
|
displayDate = fallsBetween ? displayDate : (displayDate.monthInt == minDate.monthInt) ? minDate : maxDate
|
||||||
fetchDates(with: displayDate)
|
fetchDates(with: displayDate)
|
||||||
}
|
}
|
||||||
containerView.backgroundColor = transparentBackground ? .clear : backgroundColorConfiguration.getColor(self)
|
containerView.backgroundColor = transparentBackground ? .clear : backgroundColorConfiguration.getColor(self)
|
||||||
@ -331,38 +331,28 @@ extension CalendarBase: UICollectionViewDelegate, UICollectionViewDataSource, UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public func collectionView(_ collectionView: UICollectionView, shouldHighlightItemAt indexPath: IndexPath) -> Bool {
|
|
||||||
if let cell = collectionView.cellForItem(at: indexPath) as? CalendarDateViewCell {
|
|
||||||
let isEnabled: Bool = cell.isDateEnabled()
|
|
||||||
if isEnabled {
|
|
||||||
cell.activeModeStart()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||||
// reload selected index, if it is in enabled state.
|
// reload selected index, if it is in enabled state.
|
||||||
if let cell = collectionView.cellForItem(at: indexPath) as? CalendarDateViewCell {
|
if let cell = collectionView.cellForItem(at: indexPath) as? CalendarDateViewCell {
|
||||||
let isEnabled: Bool = cell.isDateEnabled()
|
let hasDate: Bool = cell.hasText()
|
||||||
if isEnabled {
|
if hasDate {
|
||||||
cell.activeModeEnd()
|
let isEnabled: Bool = cell.isDateEnabled()
|
||||||
|
if isEnabled {
|
||||||
|
// Callback to pass selected date if it is enabled only.
|
||||||
|
selectedDate = dates[indexPath.row]
|
||||||
|
sendActions(for: .valueChanged)
|
||||||
|
displayDate = selectedDate
|
||||||
|
|
||||||
// Callback to pass selected date if it is enabled only.
|
var reloadIndexPaths = [indexPath]
|
||||||
selectedDate = dates[indexPath.row]
|
|
||||||
sendActions(for: .valueChanged)
|
|
||||||
displayDate = selectedDate
|
|
||||||
|
|
||||||
var reloadIndexPaths = [indexPath]
|
// If an cell is already selected, then it needs to be deselected.
|
||||||
|
// Add its index path to the array of index paths to be reloaded.
|
||||||
|
if let deselectIndexPath = selectedIndexPath {
|
||||||
|
reloadIndexPaths.append(deselectIndexPath)
|
||||||
|
}
|
||||||
|
|
||||||
// If an cell is already selected, then it needs to be deselected.
|
collectionView.reloadItems(at: reloadIndexPaths)
|
||||||
// Add its index path to the array of index paths to be reloaded.
|
|
||||||
if let deselectIndexPath = selectedIndexPath {
|
|
||||||
reloadIndexPaths.append(deselectIndexPath)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
collectionView.reloadItems(at: reloadIndexPaths)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,21 @@ final class CalendarDateViewCell: UICollectionViewCell {
|
|||||||
$0.textStyle = .bodySmall
|
$0.textStyle = .bodySmall
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override var isHighlighted: Bool {
|
||||||
|
didSet{
|
||||||
|
if self.isHighlighted && hasText() && isDateEnabled() {
|
||||||
|
self.contentView.layer.borderColor = activeBorderColorConfiguration.getColor(surface).cgColor
|
||||||
|
self.contentView.layer.borderWidth = VDSFormControls.borderWidth
|
||||||
|
self.contentView.layer.cornerRadius = VDSFormControls.borderRadius
|
||||||
|
} else {
|
||||||
|
self.contentView.layer.borderColor = nil
|
||||||
|
self.contentView.layer.borderWidth = 0
|
||||||
|
self.contentView.layer.cornerRadius = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var isEnabled = false
|
||||||
private lazy var shapeLayer = CAShapeLayer()
|
private lazy var shapeLayer = CAShapeLayer()
|
||||||
private var surface: Surface = .light
|
private var surface: Surface = .light
|
||||||
private let selectedTextColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryInverseOnlight, VDSColor.elementsPrimaryInverseOndark)
|
private let selectedTextColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryInverseOnlight, VDSColor.elementsPrimaryInverseOndark)
|
||||||
@ -120,20 +135,21 @@ final class CalendarDateViewCell: UICollectionViewCell {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update text color, bg color, corner radius.
|
// Set selected/unselected state text color, bg color, corner radius if cell is in enabled state.
|
||||||
if numberLabel.text == selectedDate.getDay()
|
if isEnabled {
|
||||||
&& selectedDate.monthInt == displayDate.monthInt
|
if numberLabel.text == selectedDate.getDay()
|
||||||
&& selectedDate.yearInt == displayDate.yearInt
|
&& selectedDate.monthInt == displayDate.monthInt
|
||||||
&& numberLabel.isEnabled {
|
&& selectedDate.yearInt == displayDate.yearInt {
|
||||||
|
|
||||||
numberLabel.textColor = selectedTextColorConfiguration.getColor(surface)
|
numberLabel.textColor = selectedTextColorConfiguration.getColor(surface)
|
||||||
layer.backgroundColor = selectedBackgroundColor.getColor(surface).cgColor
|
layer.backgroundColor = selectedBackgroundColor.getColor(surface).cgColor
|
||||||
layer.cornerRadius = VDSFormControls.borderRadius
|
layer.cornerRadius = VDSFormControls.borderRadius
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
numberLabel.textColor = unselectedTextColorConfiguration.getColor(surface)
|
numberLabel.textColor = unselectedTextColorConfiguration.getColor(surface)
|
||||||
layer.backgroundColor = nil
|
layer.backgroundColor = nil
|
||||||
layer.cornerRadius = 0
|
layer.cornerRadius = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add indicators.
|
// add indicators.
|
||||||
@ -156,25 +172,17 @@ final class CalendarDateViewCell: UICollectionViewCell {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func hasText() -> Bool {
|
||||||
|
return !numberLabel.text.isEmpty
|
||||||
|
}
|
||||||
|
|
||||||
// returns cell enabled state.
|
// returns cell enabled state.
|
||||||
func isDateEnabled() -> Bool {
|
func isDateEnabled() -> Bool {
|
||||||
return numberLabel.isEnabled
|
return isEnabled
|
||||||
}
|
|
||||||
|
|
||||||
func activeModeStart() {
|
|
||||||
numberLabel.layer.borderColor = activeBorderColorConfiguration.getColor(surface).cgColor
|
|
||||||
numberLabel.layer.borderWidth = VDSFormControls.borderWidth
|
|
||||||
numberLabel.layer.cornerRadius = VDSFormControls.borderRadius
|
|
||||||
}
|
|
||||||
|
|
||||||
func activeModeEnd() {
|
|
||||||
numberLabel.layer.borderColor = nil
|
|
||||||
numberLabel.layer.borderWidth = 0
|
|
||||||
numberLabel.layer.cornerRadius = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func disableLabel(with surface: Surface) {
|
func disableLabel(with surface: Surface) {
|
||||||
numberLabel.isEnabled = false
|
isEnabled = false
|
||||||
numberLabel.textColor = disabledTextColorConfiguration.getColor(surface)
|
numberLabel.textColor = disabledTextColorConfiguration.getColor(surface)
|
||||||
layer.backgroundColor = disabledBackgroundColor.getColor(surface).cgColor
|
layer.backgroundColor = disabledBackgroundColor.getColor(surface).cgColor
|
||||||
}
|
}
|
||||||
@ -183,7 +191,7 @@ final class CalendarDateViewCell: UICollectionViewCell {
|
|||||||
for x in 0...activeDates.count-1 {
|
for x in 0...activeDates.count-1 {
|
||||||
if activeDates[x].monthInt == displayDate.monthInt && activeDates[x].yearInt == displayDate.yearInt {
|
if activeDates[x].monthInt == displayDate.monthInt && activeDates[x].yearInt == displayDate.yearInt {
|
||||||
if let day:Int = Int(numberLabel.text), day == activeDates[x].dayInt {
|
if let day:Int = Int(numberLabel.text), day == activeDates[x].dayInt {
|
||||||
numberLabel.isEnabled = true
|
isEnabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,7 +202,7 @@ final class CalendarDateViewCell: UICollectionViewCell {
|
|||||||
if activeDates.count > 0 && inactiveDates.count == 0 {
|
if activeDates.count > 0 && inactiveDates.count == 0 {
|
||||||
showActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates)
|
showActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates)
|
||||||
} else {
|
} else {
|
||||||
numberLabel.isEnabled = true
|
isEnabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +212,7 @@ final class CalendarDateViewCell: UICollectionViewCell {
|
|||||||
disableLabel(with: surface)
|
disableLabel(with: surface)
|
||||||
showActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates)
|
showActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates)
|
||||||
} else {
|
} else {
|
||||||
numberLabel.isEnabled = true
|
isEnabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +221,7 @@ final class CalendarDateViewCell: UICollectionViewCell {
|
|||||||
if let day = Int(numberLabel.text), day < minDate.dayInt {
|
if let day = Int(numberLabel.text), day < minDate.dayInt {
|
||||||
disableLabel(with: surface)
|
disableLabel(with: surface)
|
||||||
} else {
|
} else {
|
||||||
numberLabel.isEnabled = false
|
isEnabled = false
|
||||||
handleActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates)
|
handleActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,7 +231,7 @@ final class CalendarDateViewCell: UICollectionViewCell {
|
|||||||
if let day = Int(numberLabel.text), day > maxDate.dayInt {
|
if let day = Int(numberLabel.text), day > maxDate.dayInt {
|
||||||
disableLabel(with: surface)
|
disableLabel(with: surface)
|
||||||
} else {
|
} else {
|
||||||
numberLabel.isEnabled = false
|
isEnabled = false
|
||||||
handleActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates)
|
handleActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,7 +241,7 @@ final class CalendarDateViewCell: UICollectionViewCell {
|
|||||||
if let day = Int(numberLabel.text), day < minDate.dayInt || day > maxDate.dayInt {
|
if let day = Int(numberLabel.text), day < minDate.dayInt || day > maxDate.dayInt {
|
||||||
disableLabel(with: surface)
|
disableLabel(with: surface)
|
||||||
} else {
|
} else {
|
||||||
numberLabel.isEnabled = false
|
isEnabled = false
|
||||||
handleActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates)
|
handleActiveDates(with: displayDate, activeDates: activeDates, inactiveDates: inactiveDates)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -224,7 +224,7 @@ private class LegendCollectionViewCell: UICollectionViewCell {
|
|||||||
title.text = text
|
title.text = text
|
||||||
title.textColor = textColorConfiguration.getColor(surface)
|
title.textColor = textColorConfiguration.getColor(surface)
|
||||||
|
|
||||||
legendIndicator.backgroundColor = drawSemiCircle ? .clear : (clearFullcircle ? .clear : color)
|
legendIndicator.backgroundColor = drawSemiCircle ? .clear : (clearFullcircle ? .clear : indicatorColorConfiguration.getColor(surface))
|
||||||
legendIndicator.layer.borderColor = indicatorColorConfiguration.getColor(surface).cgColor
|
legendIndicator.layer.borderColor = indicatorColorConfiguration.getColor(surface).cgColor
|
||||||
|
|
||||||
self.layoutIfNeeded()
|
self.layoutIfNeeded()
|
||||||
@ -239,7 +239,7 @@ private class LegendCollectionViewCell: UICollectionViewCell {
|
|||||||
path.addArc(withCenter: center, radius: center.x, startAngle: 2 * .pi, endAngle: .pi, clockwise: true)
|
path.addArc(withCenter: center, radius: center.x, startAngle: 2 * .pi, endAngle: .pi, clockwise: true)
|
||||||
path.close()
|
path.close()
|
||||||
shapeLayer.path = path.cgPath
|
shapeLayer.path = path.cgPath
|
||||||
shapeLayer.fillColor = color.cgColor
|
shapeLayer.fillColor = indicatorColorConfiguration.getColor(surface).cgColor
|
||||||
|
|
||||||
guard legendIndicator.layer.sublayers?.contains(shapeLayer) ?? true else { return }
|
guard legendIndicator.layer.sublayers?.contains(shapeLayer) ?? true else { return }
|
||||||
legendIndicator.layer.addSublayer(shapeLayer)
|
legendIndicator.layer.addSublayer(shapeLayer)
|
||||||
|
|||||||
@ -68,16 +68,16 @@ class CalendarHeaderReusableView: UICollectionReusableView {
|
|||||||
$0.kind = .ghost
|
$0.kind = .ghost
|
||||||
$0.iconName = .leftCaret
|
$0.iconName = .leftCaret
|
||||||
$0.iconOffset = .init(x: -2, y: 0)
|
$0.iconOffset = .init(x: -2, y: 0)
|
||||||
$0.icon.size = .small
|
$0.customContainerSize = 40
|
||||||
$0.size = .small
|
$0.icon.customSize = 16
|
||||||
}
|
}
|
||||||
|
|
||||||
internal var nextButton = ButtonIcon().with {
|
internal var nextButton = ButtonIcon().with {
|
||||||
$0.kind = .ghost
|
$0.kind = .ghost
|
||||||
$0.iconName = .rightCaret
|
$0.iconName = .rightCaret
|
||||||
$0.iconOffset = .init(x: 2, y: 0)
|
$0.iconOffset = .init(x: 2, y: 0)
|
||||||
$0.icon.size = .small
|
$0.customContainerSize = 40
|
||||||
$0.size = .small
|
$0.icon.customSize = 16
|
||||||
}
|
}
|
||||||
|
|
||||||
internal var headerTitle = Label().with {
|
internal var headerTitle = Label().with {
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
1.0.67
|
1.0.67
|
||||||
----------------
|
----------------
|
||||||
- CXTDT-553663 - DropdownSelect - Accessibility - has popup
|
- CXTDT-553663 - DropdownSelect - Accessibility - has popup
|
||||||
|
- CXTDT-568463 - Calendar - On long press, hover randomizes
|
||||||
|
- CXTDT-568412 - Calendar - Incorrect side nav icon size
|
||||||
|
- CXTDT-568422 - Calendar - DarkMode Legend icon fill using Light mode color
|
||||||
|
|
||||||
1.0.66
|
1.0.66
|
||||||
----------------
|
----------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user