From bf46f85622d714a5131acdcd65bf4c333264fa6c Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Tue, 16 Jul 2024 12:31:06 +0530 Subject: [PATCH 1/7] Fixing CXTDT-586497 issue, table contents alignment is based on the row type, is header --- VDS/Components/Table/Table.swift | 3 ++- VDS/Components/Table/TableCellItem.swift | 10 +++++----- VDS/Components/Table/TableRowModel.swift | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/VDS/Components/Table/Table.swift b/VDS/Components/Table/Table.swift index 8ce5f462..9ce35ef6 100644 --- a/VDS/Components/Table/Table.swift +++ b/VDS/Components/Table/Table.swift @@ -147,7 +147,8 @@ extension Table: UICollectionViewDelegate, UICollectionViewDataSource, TableColl guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: TableCellItem.Identifier, for: indexPath) as? TableCellItem else { return UICollectionViewCell() } let currentItem = tableData[indexPath.section].columns[indexPath.row] let shouldStrip = striped ? (indexPath.section % 2 != 0) : false - cell.updateCell(content: currentItem, surface: surface, striped: shouldStrip, padding: padding) + let isHeader = tableData[indexPath.section].isHeader + cell.updateCell(content: currentItem, surface: surface, striped: shouldStrip, padding: padding, isHeader: isHeader) return cell } diff --git a/VDS/Components/Table/TableCellItem.swift b/VDS/Components/Table/TableCellItem.swift index 23d2df74..ddd35277 100644 --- a/VDS/Components/Table/TableCellItem.swift +++ b/VDS/Components/Table/TableCellItem.swift @@ -58,7 +58,7 @@ final class TableCellItem: UICollectionViewCell { //-------------------------------------------------- /// Updates the cell content with ``TableItemModel`` and styling/padding attributes from other parameters - public func updateCell(content: TableItemModel, surface: Surface, striped: Bool = false, padding: Table.Padding = .standard) { + public func updateCell(content: TableItemModel, surface: Surface, striped: Bool = false, padding: Table.Padding = .standard, isHeader: Bool = false) { containerView.subviews.forEach({ $0.removeFromSuperview() }) self.padding = padding @@ -83,10 +83,10 @@ final class TableCellItem: UICollectionViewCell { NSLayoutConstraint.activate([ component.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: VDSLayout.space1X), - component.topAnchor.constraint(greaterThanOrEqualTo: containerView.topAnchor, constant: padding.verticalValue()), - containerView.bottomAnchor.constraint(greaterThanOrEqualTo: component.bottomAnchor, constant: padding.verticalValue()), - containerView.trailingAnchor.constraint(greaterThanOrEqualTo: component.trailingAnchor, constant: padding.horizontalValue()), - containerView.centerYAnchor.constraint(equalTo: component.centerYAnchor) + containerView.trailingAnchor.constraint(greaterThanOrEqualTo: component.trailingAnchor, constant: padding.horizontalValue()) ]) + + component.topAnchor.constraint(equalTo: containerView.topAnchor, constant: padding.verticalValue()).isActive = !isHeader + containerView.bottomAnchor.constraint(equalTo: component.bottomAnchor, constant: padding.verticalValue()).isActive = isHeader } } diff --git a/VDS/Components/Table/TableRowModel.swift b/VDS/Components/Table/TableRowModel.swift index a838438f..22f428ce 100644 --- a/VDS/Components/Table/TableRowModel.swift +++ b/VDS/Components/Table/TableRowModel.swift @@ -11,11 +11,14 @@ public struct TableRowModel { public var columns: [TableItemModel] + public var isHeader: Bool = false + public var columnsCount: Int { return columns.count } - public init(columns: [TableItemModel]) { + public init(columns: [TableItemModel], isHeader: Bool = false) { self.columns = columns + self.isHeader = isHeader } } From 7f13aebc7ef9a78137531f7c25aaa8bd2c1e6d8b Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Thu, 18 Jul 2024 19:52:15 +0530 Subject: [PATCH 2/7] Fix for CXTDT-586375, updating the way padding is set to view, based on striped status. --- VDS/Components/Table/Table.swift | 10 +++++----- VDS/Components/Table/TableCellItem.swift | 17 +++++++---------- VDS/Components/Table/TableFlowLayout.swift | 9 ++++++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/VDS/Components/Table/Table.swift b/VDS/Components/Table/Table.swift index 9ce35ef6..39cc6698 100644 --- a/VDS/Components/Table/Table.swift +++ b/VDS/Components/Table/Table.swift @@ -51,10 +51,8 @@ open class Table: View { func horizontalValue() -> CGFloat { switch self { - case .standard: - return UIDevice.isIPad ? VDSLayout.space8X : VDSLayout.space6X - case .compact: - return UIDevice.isIPad ? VDSLayout.space8X : VDSLayout.space6X + case .standard, .compact: + return UIDevice.isIPad ? VDSLayout.space4X : VDSLayout.space3X } } @@ -148,7 +146,9 @@ extension Table: UICollectionViewDelegate, UICollectionViewDataSource, TableColl let currentItem = tableData[indexPath.section].columns[indexPath.row] let shouldStrip = striped ? (indexPath.section % 2 != 0) : false let isHeader = tableData[indexPath.section].isHeader - cell.updateCell(content: currentItem, surface: surface, striped: shouldStrip, padding: padding, isHeader: isHeader) + var edgePadding = UIEdgeInsets(top: padding.verticalValue(), left: 0, bottom: padding.verticalValue(), right: padding.horizontalValue()) + edgePadding.left = (indexPath.row == 0 && !striped) ? VDSLayout.space1X : padding.horizontalValue() + cell.updateCell(content: currentItem, surface: surface, striped: shouldStrip, padding: edgePadding, isHeader: isHeader) return cell } diff --git a/VDS/Components/Table/TableCellItem.swift b/VDS/Components/Table/TableCellItem.swift index ddd35277..0c87fb35 100644 --- a/VDS/Components/Table/TableCellItem.swift +++ b/VDS/Components/Table/TableCellItem.swift @@ -29,10 +29,7 @@ final class TableCellItem: UICollectionViewCell { /// Color configuration for striped background color private let stripedColorConfiguration = SurfaceColorConfiguration(VDSColor.backgroundSecondaryLight, VDSColor.backgroundSecondaryDark) - - /// Padding parameter to maintain the edge spacing of the containerView - private var padding: Table.Padding = .standard - + //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- @@ -58,10 +55,10 @@ final class TableCellItem: UICollectionViewCell { //-------------------------------------------------- /// Updates the cell content with ``TableItemModel`` and styling/padding attributes from other parameters - public func updateCell(content: TableItemModel, surface: Surface, striped: Bool = false, padding: Table.Padding = .standard, isHeader: Bool = false) { + public func updateCell(content: TableItemModel, surface: Surface, striped: Bool = false, padding: UIEdgeInsets, isHeader: Bool = false) { containerView.subviews.forEach({ $0.removeFromSuperview() }) - self.padding = padding + containerView.surface = surface containerView.backgroundColor = striped ? stripedColorConfiguration.getColor(surface) : backgroundColorConfiguration.getColor(surface) @@ -82,11 +79,11 @@ final class TableCellItem: UICollectionViewCell { } NSLayoutConstraint.activate([ - component.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: VDSLayout.space1X), - containerView.trailingAnchor.constraint(greaterThanOrEqualTo: component.trailingAnchor, constant: padding.horizontalValue()) + component.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: padding.left), + containerView.trailingAnchor.constraint(greaterThanOrEqualTo: component.trailingAnchor, constant: padding.right) ]) - component.topAnchor.constraint(equalTo: containerView.topAnchor, constant: padding.verticalValue()).isActive = !isHeader - containerView.bottomAnchor.constraint(equalTo: component.bottomAnchor, constant: padding.verticalValue()).isActive = isHeader + component.topAnchor.constraint(equalTo: containerView.topAnchor, constant: padding.top).isActive = !isHeader + containerView.bottomAnchor.constraint(equalTo: component.bottomAnchor, constant: padding.bottom).isActive = isHeader } } diff --git a/VDS/Components/Table/TableFlowLayout.swift b/VDS/Components/Table/TableFlowLayout.swift index 3513099d..2567f947 100644 --- a/VDS/Components/Table/TableFlowLayout.swift +++ b/VDS/Components/Table/TableFlowLayout.swift @@ -40,6 +40,9 @@ class MatrixFlowLayout : UICollectionViewFlowLayout { ///padding type to be set from Table component, which is used to calculate the size & position of the cell. var layoutPadding: Table.Padding = .standard + ///Striped status of Table, based on this status padding of leading attribute changes. + var striped: Bool = false + //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- @@ -77,7 +80,7 @@ class MatrixFlowLayout : UICollectionViewFlowLayout { let selectedItem = delegate.collectionView(collectionView, dataForItemAt: indexPath) ///Calculate the estimated height of the cell - let itemHeight = estimateHeightFor(item: selectedItem, with: itemWidth) + let itemHeight = estimateHeightFor(item: selectedItem, with: itemWidth, index: indexPath) layoutWidth += itemWidth @@ -108,8 +111,8 @@ class MatrixFlowLayout : UICollectionViewFlowLayout { } /// Fetches estimated height by calling the cell's component estimated height and adding padding - private func estimateHeightFor(item: TableItemModel, with width: CGFloat) -> CGFloat { - + private func estimateHeightFor(item: TableItemModel, with width: CGFloat, index: IndexPath) -> CGFloat { + let horizontalPadding = (index.row == 0 && !striped) ? (VDSLayout.space1X + layoutPadding.horizontalValue()) : (2 * layoutPadding.horizontalValue()) let itemWidth = width - layoutPadding.horizontalValue() - defaultLeadingPadding let maxSize = CGSize(width: itemWidth, height: CGFloat.greatestFiniteMagnitude) let estItemSize = item.component?.systemLayoutSizeFitting(maxSize, withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel) ?? CGSize(width: itemWidth, height: item.defaultHeight) From 00f73a503c03ed40c3684410dd232b23ce15015c Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 19 Jul 2024 13:13:21 -0500 Subject: [PATCH 3/7] CXTDT-581800 - Date Picker - Selected Error state icon Signed-off-by: Matt Bruce --- VDS/Components/DatePicker/DatePicker.swift | 18 +++++++++++++++++- VDS/SupportingFiles/ReleaseNotes.txt | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/VDS/Components/DatePicker/DatePicker.swift b/VDS/Components/DatePicker/DatePicker.swift index 83450403..3a41780e 100644 --- a/VDS/Components/DatePicker/DatePicker.swift +++ b/VDS/Components/DatePicker/DatePicker.swift @@ -27,6 +27,19 @@ open class DatePicker: EntryFieldBase { /// A callback when the selected option changes. Passes parameters (option). open var onDateSelected: ((Date, DatePicker) -> Void)? + /// Override UIControl state to add the .error state if showError is true. + open override var state: UIControl.State { + get { + var state = super.state + if isEnabled { + if isCalendarShowing { + state.insert(.focused) + } + } + return state + } + } + //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- @@ -35,8 +48,9 @@ open class DatePicker: EntryFieldBase { true } } - + internal override var responder: UIResponder? { hiddenView } + internal var isCalendarShowing: Bool = false { didSet { setNeedsUpdate() } } internal var hiddenView = Responder().with { $0.width(0) } internal var minWidthDefault = 186.0 internal var bottomStackView: UIStackView = { @@ -315,6 +329,7 @@ extension DatePicker { } } + isCalendarShowing = true } private func hidePopoverView() { @@ -346,6 +361,7 @@ extension DatePicker { UIAccessibility.post(notification: .layoutChanged, argument: containerView) } } + isCalendarShowing = false } private func calculatePopoverPosition(relativeTo sourceView: UIView, in parentView: UIView, size: CGSize, with spacing: CGFloat) -> CGPoint? { diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index 973e8ed8..bc182364 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,7 +1,10 @@ 1.0.71 ---------------- +- CXTDT-581800 - DatePicker - Selected Error state icon - CXTDT-581803 - DatePicker - Calendar does not switch to Dark Mode - CXTDT-584278 – InputField - Accessibility +- CXTDT-586375 - Table - Issue With Stripe +- CXTDT-577463 - InputField - Accessibility - #7 1.0.70 ---------------- From 54a2a63ba41633e753c9bc7d9f93c1301b9edbd8 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 19 Jul 2024 13:17:49 -0500 Subject: [PATCH 4/7] CXTDT-581801 - DatePicker - border disappears for on dark focus state Signed-off-by: Matt Bruce --- VDS/Components/TextFields/EntryFieldBase.swift | 4 ++-- VDS/SupportingFiles/ReleaseNotes.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/VDS/Components/TextFields/EntryFieldBase.swift b/VDS/Components/TextFields/EntryFieldBase.swift index 78c1077a..fbae1563 100644 --- a/VDS/Components/TextFields/EntryFieldBase.swift +++ b/VDS/Components/TextFields/EntryFieldBase.swift @@ -137,8 +137,8 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable { internal var borderColorConfiguration = ControlColorConfiguration().with { $0.setSurfaceColors(VDSFormControlsColor.borderOnlight, VDSFormControlsColor.borderOndark, forState: .normal) - $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOnlight, forState: .focused) - $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOnlight, forState: [.focused, .error]) + $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .focused) + $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: [.focused, .error]) $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled) $0.setSurfaceColors(VDSColor.feedbackErrorOnlight, VDSColor.feedbackErrorOndark, forState: .error) $0.setSurfaceColors(VDSFormControlsColor.borderReadonlyOnlight, VDSFormControlsColor.borderReadonlyOndark, forState: .readonly) diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index bc182364..6450add8 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,6 +1,7 @@ 1.0.71 ---------------- - CXTDT-581800 - DatePicker - Selected Error state icon +- CXTDT-581801 - DatePicker - border disappears for on dark focus state - CXTDT-581803 - DatePicker - Calendar does not switch to Dark Mode - CXTDT-584278 – InputField - Accessibility - CXTDT-586375 - Table - Issue With Stripe From a253e2efc86655ae2ef5e636b484f9e41e6c7a77 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 19 Jul 2024 13:28:08 -0500 Subject: [PATCH 5/7] =?UTF-8?q?CXTDT-565796=20-=20DropdownSelect=20?= =?UTF-8?q?=E2=80=93=20Removed=20the=20"Type"=20from=20the=20VoiceOver?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matt Bruce --- VDS/Components/TextFields/EntryFieldBase.swift | 4 +--- VDS/SupportingFiles/ReleaseNotes.txt | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/VDS/Components/TextFields/EntryFieldBase.swift b/VDS/Components/TextFields/EntryFieldBase.swift index fbae1563..571783bc 100644 --- a/VDS/Components/TextFields/EntryFieldBase.swift +++ b/VDS/Components/TextFields/EntryFieldBase.swift @@ -331,9 +331,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable { if let errorText, showError { accessibilityLabels.append("error, \(errorText)") } - - accessibilityLabels.append("\(Self.self)") - + return accessibilityLabels.joined(separator: ", ") } diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index 6450add8..69b82096 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -6,6 +6,7 @@ - CXTDT-584278 – InputField - Accessibility - CXTDT-586375 - Table - Issue With Stripe - CXTDT-577463 - InputField - Accessibility - #7 +- CXTDT-565796 - DropdownSelect – Removed the "Type" from the VoiceOver 1.0.70 ---------------- From 7cabfdb78cb9cf8260a2796d23c339bcf0b2f8e3 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 19 Jul 2024 13:29:14 -0500 Subject: [PATCH 6/7] updated version to 71 Signed-off-by: Matt Bruce --- VDS.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index 59600512..230ce227 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -1557,7 +1557,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 70; + CURRENT_PROJECT_VERSION = 71; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1595,7 +1595,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 70; + CURRENT_PROJECT_VERSION = 71; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; From 2a1b9380c82d192ef3278c79e69be0e4042c4f73 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 19 Jul 2024 13:42:57 -0500 Subject: [PATCH 7/7] updated comments Signed-off-by: Matt Bruce --- VDS/Components/TileContainer/TileContainer.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index 0852bca6..cbe68e3a 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -437,7 +437,7 @@ open class TileContainerBase: Control where Padding //------------------------------------------------------------------------- - //Width + AspectRatio Constraint - Will exit out if set + //Width + AspectRatio Constraint //------------------------------------------------------------------------- if let containerViewWidth, let multiplier, @@ -450,7 +450,7 @@ open class TileContainerBase: Control where Padding } //------------------------------------------------------------------------- - //Height + AspectRatio Constraint - Will exit out if set + //Height + AspectRatio Constraint //------------------------------------------------------------------------- else if let containerViewHeight, let multiplier,