Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 🎸 [JIRA-2222] Duration Picker Support #484

Merged
merged 2 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Apps/Examples/Examples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
99B6EF8C2672224D00515E8E /* UserConsentSample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99B6EF8B2672224C00515E8E /* UserConsentSample.swift */; };
AB988B102631270300483D87 /* DataTableExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB988B0F2631270300483D87 /* DataTableExample.swift */; };
B141D6BB29261F9E008A8BD6 /* SearchableListViewExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = B141D6BA29261F9E008A8BD6 /* SearchableListViewExample.swift */; };
B1D41B20291A2D97004E64A5 /* DurationPickerExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1D41B1F291A2D97004E64A5 /* DurationPickerExample.swift */; };
B80DA9BA260BBF8600C0B2E9 /* SingleActionProfiles.swift in Sources */ = {isa = PBXBuildFile; fileRef = B80DA9B9260BBF8600C0B2E9 /* SingleActionProfiles.swift */; };
B80DA9BC260BED9400C0B2E9 /* SingleActionCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B80DA9BB260BED9400C0B2E9 /* SingleActionCollectionView.swift */; };
B80DA9BE260C1CC200C0B2E9 /* ListDataProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B80DA9BD260C1CC200C0B2E9 /* ListDataProtocol.swift */; };
Expand Down Expand Up @@ -224,6 +225,7 @@
99B6EF8B2672224C00515E8E /* UserConsentSample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserConsentSample.swift; sourceTree = "<group>"; };
AB988B0F2631270300483D87 /* DataTableExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataTableExample.swift; sourceTree = "<group>"; };
B141D6BA29261F9E008A8BD6 /* SearchableListViewExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchableListViewExample.swift; sourceTree = "<group>"; };
B1D41B1F291A2D97004E64A5 /* DurationPickerExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DurationPickerExample.swift; sourceTree = "<group>"; };
B80DA9B9260BBF8600C0B2E9 /* SingleActionProfiles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SingleActionProfiles.swift; sourceTree = "<group>"; };
B80DA9BB260BED9400C0B2E9 /* SingleActionCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SingleActionCollectionView.swift; sourceTree = "<group>"; };
B80DA9BD260C1CC200C0B2E9 /* ListDataProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDataProtocol.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -419,6 +421,7 @@
isa = PBXGroup;
children = (
108E43D3292DAB3E006532F3 /* EmptyStateView */,
B1D41B1E291A2D2E004E64A5 /* Picker */,
B8239D8626815C11003455D2 /* ContactItem */,
692F338926556A34009B98DA /* SideBar */,
1FF3662C264C662A00AB8BD8 /* DimensionSelector */,
Expand Down Expand Up @@ -539,6 +542,14 @@
path = DataTable;
sourceTree = "<group>";
};
B1D41B1E291A2D2E004E64A5 /* Picker */ = {
isa = PBXGroup;
children = (
B1D41B1F291A2D97004E64A5 /* DurationPickerExample.swift */,
);
path = Picker;
sourceTree = "<group>";
};
B80DA9C32612A54E00C0B2E9 /* Onboarding */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -726,6 +737,7 @@
B84D24F02652F343007F2373 /* ObjectHeaderExample.swift in Sources */,
9996CD00262EB4E8001B99AE /* EULAViewSample.swift in Sources */,
1F3C92F125DF12C100A99A07 /* ListPicker.swift in Sources */,
B1D41B20291A2D97004E64A5 /* DurationPickerExample.swift in Sources */,
1FC30414270541BF004BEE00 /* FioriThemeManagerContentView.swift in Sources */,
99942D59261698FC001912C5 /* InfoViewSample.swift in Sources */,
B80DA9BE260C1CC200C0B2E9 /* ListDataProtocol.swift in Sources */,
Expand Down
35 changes: 15 additions & 20 deletions Apps/Examples/Examples/FioriSwiftUICore/CoreContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ struct CoreContentView: View {
var body: some View {
List {
NavigationLink(
destination: DataTableExample())
{
destination: DataTableExample()) {
Text("Data Table")
}

Expand All @@ -20,38 +19,38 @@ struct CoreContentView: View {
)

NavigationLink(
destination: DimensionSelector_Chart())
{
destination: DimensionSelector_Chart()) {
Text("Dimension Selector")
}

Group {
NavigationLink(
destination: SignatureCaptureViewExample())
{
destination: SignatureCaptureViewExample()) {
Text("Signature Inline View")
}

NavigationLink(
destination: SignatureCaptureViewExample2())
{
destination: SignatureCaptureViewExample2()) {
Text("Customized Signature Inline View")
}
}

NavigationLink(
destination: ExperimentalContentView())
{
destination: ExperimentalContentView()) {
Text("🚧 Experimental 🚧")
}

Group {
NavigationLink(
destination: ListPickerItemExample())
{
destination: ListPickerItemExample()) {
Text("ListPickerItem")
}

NavigationLink(
destination: DurationPickerExample()) {
Text("DurationPicker")
}

NavigationLink(
destination: FioriButtonContentView(),
label: {
Expand All @@ -60,20 +59,17 @@ struct CoreContentView: View {
)

NavigationLink(
destination: KPIExample())
{
destination: KPIExample()) {
Text("KPI")
}

NavigationLink(
destination: KPIProgressExample())
{
destination: KPIProgressExample()) {
Text("KPIProgressItem")
}

NavigationLink(
destination: OnboardingExamples())
{
destination: OnboardingExamples()) {
Text("Onboarding")
}

Expand All @@ -96,8 +92,7 @@ struct CoreContentView: View {
}

NavigationLink(
destination: EmptyStateViewExample())
{
destination: EmptyStateViewExample()) {
Text("EmptyStateViewExample")
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import FioriSwiftUICore
import SwiftUI

struct DurationPickerExample: View {
@State var selection1: Int = 0
@State var selection2: Int = 244
@State var selection3: Int = 100

var formatter: MeasurementFormatter {
let formatter = MeasurementFormatter()
formatter.locale = Locale(identifier: "zh-CN")
formatter.unitStyle = .long
formatter.unitOptions = .providedUnit
return formatter
}

var body: some View {
VStack {
DurationPicker(selection: $selection1)
Divider()
Text("Total \(selection1) minutes")
Text("\(selection1 / 60) Hrs, \(selection1 % 60) Min")

DurationPicker(selection: $selection2, minimumMinutes: 1, minuteInterval: 2)
Divider()
Text("Total \(selection2) minutes")

DurationPicker(selection: $selection3, maximumMinutes: 120, minimumMinutes: 60, minuteInterval: 2)
.measurementFormatter(formatter)
Divider()
Text("Total \(selection3) minutes")
}
}
}

struct DurationPickerExample_Previews: PreviewProvider {
static var previews: some View {
DurationPickerExample()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,25 @@ internal protocol _KpiProgress: KpiComponent, _ComponentMultiPropGenerating {
internal protocol _ProgressIndicator: _ComponentMultiPropGenerating {
var progressIndicatorText_: String? { get }
}

internal protocol _DurationPicker: _ComponentMultiPropGenerating, AnyObject {
// sourcery: bindingProperty
// sourcery: no_view
var selection: Int { get set }

// sourcery: no_view
// sourcery: default.value = 1439
var maximumMinutes: Int { get set }

// sourcery: no_view
// sourcery: default.value = 0
var minimumMinutes: Int { get set }

// sourcery: no_view
// sourcery: default.value = 1
var minuteInterval: Int { get set }

// sourcery: no_view
// sourcery: default.value = MeasurementFormatter()
var measurementFormatter: MeasurementFormatter { get set }
}
Loading