Digital ACT-191 CXTDT-568463 defect: Calendar - On long press, hover randomizes
This commit is contained in:
parent
17d119fa6c
commit
b8326faa16
@ -331,24 +331,13 @@ 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 hasDate: Bool = cell.hasText()
|
||||||
|
if hasDate {
|
||||||
let isEnabled: Bool = cell.isDateEnabled()
|
let isEnabled: Bool = cell.isDateEnabled()
|
||||||
if isEnabled {
|
if isEnabled {
|
||||||
cell.activeModeEnd()
|
|
||||||
|
|
||||||
// Callback to pass selected date if it is enabled only.
|
// Callback to pass selected date if it is enabled only.
|
||||||
selectedDate = dates[indexPath.row]
|
selectedDate = dates[indexPath.row]
|
||||||
sendActions(for: .valueChanged)
|
sendActions(for: .valueChanged)
|
||||||
@ -366,6 +355,7 @@ extension CalendarBase: UICollectionViewDelegate, UICollectionViewDataSource, UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
|
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
|
||||||
return CGSize(width: collectionView.frame.size.width, height: headerHeight)
|
return CGSize(width: collectionView.frame.size.width, height: headerHeight)
|
||||||
|
|||||||
@ -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 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)
|
||||||
@ -156,23 +171,15 @@ 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 numberLabel.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
|
numberLabel.isEnabled = false
|
||||||
numberLabel.textColor = disabledTextColorConfiguration.getColor(surface)
|
numberLabel.textColor = disabledTextColorConfiguration.getColor(surface)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
1.0.67
|
1.0.67
|
||||||
----------------
|
----------------
|
||||||
- CXTDT-553663 - DropdownSelect - Accessibility - has popup
|
- CXTDT-568463 - Calendar - On long press, hover randomizes
|
||||||
|
|
||||||
1.0.66
|
1.0.66
|
||||||
----------------
|
----------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user