Digital ACT-191 ONEAPP-7016 story: added properties
This commit is contained in:
parent
2b16fecdc3
commit
58ceee5d47
@ -29,6 +29,45 @@ open class CalendarBase: View {
|
|||||||
super.init(coder: coder)
|
super.init(coder: coder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Public Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
/// If set to true, the calendar will not have a border.
|
||||||
|
open var hideContainerBorder: Bool = false
|
||||||
|
|
||||||
|
/// If set to true, the calendar will not have current date indication.
|
||||||
|
open var hideCurrentDateIndicator: Bool = false
|
||||||
|
|
||||||
|
/// Enable specific days. Pass an array of string value in date format e.g. ['07/21/2024', '07/24/2024', 07/28/2024'].
|
||||||
|
/// All other dates will be inactive
|
||||||
|
open var activeDates: [Date] = []
|
||||||
|
|
||||||
|
/// Disable specific days. Pass an array of string value in date format e.g. ['07/21/2024', '07/24/2024', 07/28/2024'].
|
||||||
|
/// All other dates will be active.
|
||||||
|
open var inactiveDates: [Date] = []
|
||||||
|
|
||||||
|
/// If provided, the calendar will allow a selection to be made from this date forward. Defaults to today.
|
||||||
|
open var minDate: Date?
|
||||||
|
|
||||||
|
/// If provided, the calendar will allow a selection to be made up to this date.
|
||||||
|
open var maxDate: Date?
|
||||||
|
|
||||||
|
/// If provided, this is the date that will show as selected by the Calendar.
|
||||||
|
/// If no value is provided, the current date will be used. If null is provided, no date will be selected.
|
||||||
|
open var selectedDate: Date?
|
||||||
|
|
||||||
|
/// If provided, the calendar will be rendered with transparent background.
|
||||||
|
open var transparentBackground: Bool = false
|
||||||
|
|
||||||
|
/// Array of ``CalendarIndicatorModel`` you are wanting to show on legend.
|
||||||
|
open var indicators: [CalendarIndicatorModel] = [] { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
|
/// Array of indicators for the legend.
|
||||||
|
open var indicatorData: [CalendarIndicatorModel] = [] { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
|
/// A callback when the selected date changes..
|
||||||
|
open var onChangeSelectedDate: ((Date) -> String)?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -37,12 +76,12 @@ open class CalendarBase: View {
|
|||||||
private let headerHeight = 104.0
|
private let headerHeight = 104.0
|
||||||
private let footerHeight = 56.0
|
private let footerHeight = 56.0
|
||||||
private let items = 35
|
private let items = 35
|
||||||
|
|
||||||
internal var containerView = View().with {
|
internal var containerView = View().with {
|
||||||
$0.clipsToBounds = true
|
$0.clipsToBounds = true
|
||||||
}
|
}
|
||||||
|
|
||||||
///Collectionview to render Breadcrumb Items
|
/// Collectionview to load calendar month view
|
||||||
private lazy var collectionView: UICollectionView = {
|
private lazy var collectionView: UICollectionView = {
|
||||||
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout())
|
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout())
|
||||||
collectionView.isScrollEnabled = false
|
collectionView.isScrollEnabled = false
|
||||||
@ -53,11 +92,11 @@ open class CalendarBase: View {
|
|||||||
collectionView.showsVerticalScrollIndicator = false
|
collectionView.showsVerticalScrollIndicator = false
|
||||||
collectionView.register(CalendarDateCollectionViewCell.self, forCellWithReuseIdentifier: CalendarDateCollectionViewCell.identifier)
|
collectionView.register(CalendarDateCollectionViewCell.self, forCellWithReuseIdentifier: CalendarDateCollectionViewCell.identifier)
|
||||||
collectionView.register(CalendarHeaderReusableView.self,
|
collectionView.register(CalendarHeaderReusableView.self,
|
||||||
forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader,
|
forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader,
|
||||||
withReuseIdentifier: CalendarHeaderReusableView.identifier)
|
withReuseIdentifier: CalendarHeaderReusableView.identifier)
|
||||||
collectionView.register(CalendarFooterReusableView.self,
|
collectionView.register(CalendarFooterReusableView.self,
|
||||||
forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter,
|
forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter,
|
||||||
withReuseIdentifier: CalendarFooterReusableView.identifier)
|
withReuseIdentifier: CalendarFooterReusableView.identifier)
|
||||||
return collectionView
|
return collectionView
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -85,9 +124,9 @@ open class CalendarBase: View {
|
|||||||
|
|
||||||
// Calendar View
|
// Calendar View
|
||||||
containerView.addSubview(collectionView)
|
containerView.addSubview(collectionView)
|
||||||
collectionView.pinToSuperView()
|
collectionView.pinToSuperView()
|
||||||
}
|
}
|
||||||
|
|
||||||
override open func layoutSubviews() {
|
override open func layoutSubviews() {
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
}
|
}
|
||||||
@ -146,9 +185,8 @@ extension CalendarBase: UICollectionViewDelegate, UICollectionViewDataSource, UI
|
|||||||
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
|
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
|
||||||
return VDSLayout.space1X
|
return VDSLayout.space1X
|
||||||
}
|
}
|
||||||
|
|
||||||
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
|
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
|
||||||
return cellItemSize
|
return cellItemSize
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user