From eea54b26ff8d1391845311bd0c3f09a05dbb4217 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 20 Aug 2024 14:00:33 -0500 Subject: [PATCH 1/5] added calendar SVG to assets Signed-off-by: Matt Bruce --- .../calendar.imageset/Contents.json | 15 +++++++++++++++ .../Icons.xcassets/calendar.imageset/calendar.svg | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 VDS/SupportingFiles/Icons.xcassets/calendar.imageset/Contents.json create mode 100644 VDS/SupportingFiles/Icons.xcassets/calendar.imageset/calendar.svg diff --git a/VDS/SupportingFiles/Icons.xcassets/calendar.imageset/Contents.json b/VDS/SupportingFiles/Icons.xcassets/calendar.imageset/Contents.json new file mode 100644 index 00000000..86c7f835 --- /dev/null +++ b/VDS/SupportingFiles/Icons.xcassets/calendar.imageset/Contents.json @@ -0,0 +1,15 @@ +{ + "images" : [ + { + "filename" : "calendar.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true + } +} diff --git a/VDS/SupportingFiles/Icons.xcassets/calendar.imageset/calendar.svg b/VDS/SupportingFiles/Icons.xcassets/calendar.imageset/calendar.svg new file mode 100644 index 00000000..4cf118e3 --- /dev/null +++ b/VDS/SupportingFiles/Icons.xcassets/calendar.imageset/calendar.svg @@ -0,0 +1,9 @@ + + + + + From 940493ef10193eac0ce0c57e5910007c444f64ef Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 20 Aug 2024 14:00:43 -0500 Subject: [PATCH 2/5] allow override Signed-off-by: Matt Bruce --- VDS/Components/Checkbox/CheckboxGroup.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VDS/Components/Checkbox/CheckboxGroup.swift b/VDS/Components/Checkbox/CheckboxGroup.swift index 226083fe..8268f90f 100644 --- a/VDS/Components/Checkbox/CheckboxGroup.swift +++ b/VDS/Components/Checkbox/CheckboxGroup.swift @@ -93,7 +93,7 @@ open class CheckboxGroup: SelectorGroupBase, SelectorGroupMultiSel inputId = nil } - public override func didSelect(_ selectedControl: CheckboxItem) { + open override func didSelect(_ selectedControl: CheckboxItem) { selectedControl.toggle() if selectedControl.isSelected, showError{ showError.toggle() From 99da32947f7acfbf953ac514ec0484142aaee4c1 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 20 Aug 2024 14:00:53 -0500 Subject: [PATCH 3/5] do the selected date Signed-off-by: Matt Bruce --- VDS/Components/DatePicker/DatePicker.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/VDS/Components/DatePicker/DatePicker.swift b/VDS/Components/DatePicker/DatePicker.swift index e8802c69..e9137ad9 100644 --- a/VDS/Components/DatePicker/DatePicker.swift +++ b/VDS/Components/DatePicker/DatePicker.swift @@ -221,6 +221,9 @@ extension DatePicker { } let calendar = CalendarBase() + if let selectedDate, selectedDate != calendar.selectedDate { + calendar.selectedDate = selectedDate + } calendar.activeDates = calendarModel.activeDates calendar.hideContainerBorder = calendarModel.hideContainerBorder calendar.hideCurrentDateIndicator = calendarModel.hideCurrentDateIndicator From 658624aaddeae92daef2557ebf31578ad2711c76 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 20 Aug 2024 14:01:04 -0500 Subject: [PATCH 4/5] set defaults to match the view Signed-off-by: Matt Bruce --- VDS/Components/DatePicker/DatePickerCalendarModel.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/VDS/Components/DatePicker/DatePickerCalendarModel.swift b/VDS/Components/DatePicker/DatePickerCalendarModel.swift index 16a46e61..da18ab2f 100644 --- a/VDS/Components/DatePicker/DatePickerCalendarModel.swift +++ b/VDS/Components/DatePicker/DatePickerCalendarModel.swift @@ -24,6 +24,8 @@ extension DatePicker { /// All other dates will be active. public let inactiveDates: [Date] + public let selectedDate: Date + /// If provided, the calendar will allow a selection to be made from this date forward. Defaults to today. public let minDate: Date @@ -37,13 +39,15 @@ extension DatePicker { hideCurrentDateIndicator: Bool = false, activeDates: [Date] = [], inactiveDates: [Date] = [], - minDate: Date = Date().startOfMonth, - maxDate: Date = Date().endOfMonth, + selectedDate: Date = Date(), + minDate: Date = Date(), + maxDate: Date = Calendar.current.date(byAdding: .year, value: 10, to: Date())!, indicators: [CalendarBase.CalendarIndicatorModel] = []) { self.hideContainerBorder = hideContainerBorder self.hideCurrentDateIndicator = hideCurrentDateIndicator self.activeDates = activeDates self.inactiveDates = inactiveDates + self.selectedDate = selectedDate self.minDate = minDate self.maxDate = maxDate self.indicators = indicators From bd2b1b0de987c14596645f2a74547249c71557b6 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 20 Aug 2024 14:01:20 -0500 Subject: [PATCH 5/5] udpate setDefaults() for the maxDate Signed-off-by: Matt Bruce --- VDS/Components/Calendar/Calendar.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VDS/Components/Calendar/Calendar.swift b/VDS/Components/Calendar/Calendar.swift index 0a6ba18c..bdb5b8a9 100644 --- a/VDS/Components/Calendar/Calendar.swift +++ b/VDS/Components/Calendar/Calendar.swift @@ -160,7 +160,7 @@ open class CalendarBase: Control, Changeable { inactiveDates = [] indicators = [] minDate = Date() - maxDate = Date() + maxDate = Calendar.current.date(byAdding: .year, value: 10, to: Date())! selectedDate = Date() }