From 2bb1a24d7203a58986868fc9bf4227e24b7373a4 Mon Sep 17 00:00:00 2001 From: vasavk Date: Fri, 7 Jun 2024 14:34:46 +0530 Subject: [PATCH 1/3] Digital ACT-191 CXTDT-568409 defect: Width control missing - CXTDT-568398 - Calendar - Saturday missing - CXTDT-568402 - Calendar - Extra row --- VDS/Components/Calendar/Calendar.swift | 42 ++++++++++++++++++-------- VDS/SupportingFiles/ReleaseNotes.txt | 3 ++ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/VDS/Components/Calendar/Calendar.swift b/VDS/Components/Calendar/Calendar.swift index b023cf90..3736a52e 100644 --- a/VDS/Components/Calendar/Calendar.swift +++ b/VDS/Components/Calendar/Calendar.swift @@ -67,15 +67,20 @@ open class CalendarBase: Control, Changeable { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- - internal var containerSize: CGSize { CGSize(width: 328, height: 336) } + internal var containerSize: CGSize { CGSize(width: widthDefault, height: 336) } internal var calendar = Calendar.current private let cellItemSize = CGSize(width: 40, height: 40) private let headerHeight = 88.0 private let footerHeight = 40.0 private let calendarWidth = 304.0 + private let screenThreeSixty = 360.0 + private let widthDefault = 328.0 + private let widthTight = 320.0 - private var heightConstraint: NSLayoutConstraint? + private var collectionViewLeadingConstraint: NSLayoutConstraint? + private var collectionViewHeightConstraint: NSLayoutConstraint? + private var containerWidthConstraint: NSLayoutConstraint? private var containerHeightConstraint: NSLayoutConstraint? private var selectedIndexPath : IndexPath? private var dates: [Date] = [] @@ -133,21 +138,16 @@ open class CalendarBase: Control, Changeable { .pinTop() .pinBottom() .pinLeadingGreaterThanOrEqualTo() - .pinTrailingLessThanOrEqualTo() - .width(containerSize.width) .heightGreaterThanEqualTo(containerSize.height) containerView.centerXAnchor.constraint(equalTo: centerXAnchor).activate() // Calendar View containerView.addSubview(collectionView) let calendarHeight = containerSize.height - (2 * VDSLayout.space4X) - let spacing = (containerSize.width - calendarWidth) / 2 collectionView .pinTop(VDSLayout.space4X) .pinBottom(VDSLayout.space4X) - .pinLeading(spacing) - .pinTrailing(spacing) .width(calendarWidth) .heightGreaterThanEqualTo(calendarHeight) @@ -191,8 +191,6 @@ open class CalendarBase: Control, Changeable { // MARK: - Private Methods //-------------------------------------------------- func fetchDates(with aDate: Date) { - heightConstraint?.isActive = false - containerHeightConstraint?.isActive = false days.removeAll() dates = aDate.calendarDisplayDays @@ -204,17 +202,35 @@ open class CalendarBase: Control, Changeable { days.append(date.getDay()) } } - + updateViewConstraints() + } + + func updateViewConstraints() { collectionView.reloadData() + // container width && collection view leading + collectionViewLeadingConstraint?.isActive = false + containerWidthConstraint?.isActive = false + var width = containerView.frame.size.width + width = ((width > 0) && (width < screenThreeSixty)) ? ((width > widthTight) && (width < screenThreeSixty)) ? widthTight : containerView.frame.size.width : widthDefault + let spacing = (width - calendarWidth) / 2 + collectionViewLeadingConstraint = collectionView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: spacing) + containerWidthConstraint = containerView.widthAnchor.constraint(equalToConstant: calendarWidth + ( 2 * spacing)) + collectionViewLeadingConstraint?.isActive = true + containerWidthConstraint?.isActive = true + + + // container height && collection view height + collectionViewHeightConstraint?.isActive = false + containerHeightConstraint?.isActive = false var height = collectionView.collectionViewLayout.collectionViewContentSize.height height = height > 0 ? height : containerSize.height - heightConstraint = collectionView.heightAnchor.constraint(equalToConstant: height) containerHeightConstraint = containerView.heightAnchor.constraint(equalToConstant: height + (2 * VDSLayout.space4X)) - heightConstraint?.isActive = true + collectionViewHeightConstraint = collectionView.heightAnchor.constraint(equalToConstant: height) containerHeightConstraint?.isActive = true + collectionViewHeightConstraint?.isActive = true layoutIfNeeded() - } + } } extension CalendarBase: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index de8c62de..f45204f1 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -8,6 +8,9 @@ - CXTDT-544662 - Breadcrumbs - Text Wrapping - CXTDT-565105 - InputField - Date - Typeover text not working - CXTDT-565115 - InputField - CreditCard - China UnionPay does not allow longer numbers +- CXTDT-568398 - Calendar - Saturday missing (on smaller screen size devices) +- CXTDT-568402 - Calendar - Extra row (on smaller screen size devices) +- CXTDT-568409 - Calendar - Width control missing 1.0.65 ---------------- From c02ed371210ff9a819ac7f0c6301249c1dc32361 Mon Sep 17 00:00:00 2001 From: vasavk Date: Fri, 7 Jun 2024 17:35:28 +0530 Subject: [PATCH 2/3] Digital ACT-191 CXTDT-568419 defect: Calendar - When hideContainerBorder=true, corner radius disappears --- VDS/Components/Calendar/Calendar.swift | 3 +-- VDS/SupportingFiles/ReleaseNotes.txt | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VDS/Components/Calendar/Calendar.swift b/VDS/Components/Calendar/Calendar.swift index 3736a52e..b085de4c 100644 --- a/VDS/Components/Calendar/Calendar.swift +++ b/VDS/Components/Calendar/Calendar.swift @@ -165,14 +165,13 @@ open class CalendarBase: Control, Changeable { } containerView.layer.backgroundColor = backgroundColorConfiguration.getColor(self).cgColor + containerView.layer.cornerRadius = VDSFormControls.borderRadius if hideContainerBorder { containerView.layer.borderColor = nil containerView.layer.borderWidth = 0 - containerView.layer.cornerRadius = 0 } else { containerView.layer.borderColor = containerBorderColorConfiguration.getColor(self).cgColor containerView.layer.borderWidth = VDSFormControls.borderWidth - containerView.layer.cornerRadius = VDSFormControls.borderRadius } } diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index f45204f1..7ec07834 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -11,6 +11,7 @@ - CXTDT-568398 - Calendar - Saturday missing (on smaller screen size devices) - CXTDT-568402 - Calendar - Extra row (on smaller screen size devices) - CXTDT-568409 - Calendar - Width control missing +- CXTDT-568419 - Calendar - When hideContainerBorder=true, corner radius disappears 1.0.65 ---------------- From a3fe0b72788610a2822990c2a642ce5071865262 Mon Sep 17 00:00:00 2001 From: vasavk Date: Fri, 7 Jun 2024 17:59:29 +0530 Subject: [PATCH 3/3] Digital ACT-191 CXTDT-568413 defect: Calendar - Missing option for Transparent Background --- VDS/Components/Calendar/Calendar.swift | 5 ++--- VDS/SupportingFiles/ReleaseNotes.txt | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VDS/Components/Calendar/Calendar.swift b/VDS/Components/Calendar/Calendar.swift index b085de4c..04446252 100644 --- a/VDS/Components/Calendar/Calendar.swift +++ b/VDS/Components/Calendar/Calendar.swift @@ -120,7 +120,7 @@ open class CalendarBase: Control, Changeable { //-------------------------------------------------- internal var containerBorderColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryOnlight , VDSColor.elementsPrimaryOndark) internal var backgroundColorConfiguration = SurfaceColorConfiguration(VDSFormControlsColor.backgroundOnlight, VDSFormControlsColor.backgroundOndark) - + //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- @@ -163,8 +163,7 @@ open class CalendarBase: Control, Changeable { displayDate = fallsBetween ? displayDate : minDate fetchDates(with: displayDate) } - - containerView.layer.backgroundColor = backgroundColorConfiguration.getColor(self).cgColor + containerView.backgroundColor = transparentBackground ? .clear : backgroundColorConfiguration.getColor(self) containerView.layer.cornerRadius = VDSFormControls.borderRadius if hideContainerBorder { containerView.layer.borderColor = nil diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index 7ec07834..1096dd39 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -12,6 +12,7 @@ - CXTDT-568402 - Calendar - Extra row (on smaller screen size devices) - CXTDT-568409 - Calendar - Width control missing - CXTDT-568419 - Calendar - When hideContainerBorder=true, corner radius disappears +- CXTDT-568413 - Calendar - Missing option for Transparent Background 1.0.65 ----------------