Skip to content

Commit

Permalink
feat: 🎸 [JIRA-HCPSDKFIORIUIKIT-2606]Form Cells: Mandatory Field
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoqinggracehe committed Jun 12, 2024
1 parent 9920828 commit 3931672
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ struct KeyValueFormViewExample: View {
KeyValueFormView(title: self.key3, text: self.$valueText3, placeholder: "Please enter something", errorMessage: self.getErrorMessage(), minTextEditorHeight: 50, maxTextEditorHeight: 200, hintText: self.getHintText(), allowsBeyondLimit: self.allowsBeyondLimit, isRequired: self.isRequired)

Text("Disabled")
KeyValueFormView(title: "Disabled", text: self.$disabledText, placeholder: "Disabled", controlState: .disabled, minTextEditorHeight: 50, maxTextEditorHeight: 200)
KeyValueFormView(title: "Disabled", text: self.$disabledText, placeholder: "Disabled", controlState: .disabled, minTextEditorHeight: 50, maxTextEditorHeight: 200, isRequired: self.isRequired)

Text("Read-Only")
KeyValueFormView(title: "Read-Only", text: self.$readOnlyText, placeholder: "Read-Only", controlState: .readOnly, minTextEditorHeight: 50, maxTextLength: 200, hidesReadOnlyHint: self.hidesReadonlyHint)
KeyValueFormView(title: "Read-Only", text: self.$readOnlyText, placeholder: "Read-Only", controlState: .readOnly, minTextEditorHeight: 50, maxTextLength: 200, hidesReadOnlyHint: self.hidesReadonlyHint, isRequired: self.isRequired)
}
.scrollDismissesKeyboard(.immediately)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ protocol _SubtitleComponent {
}

// sourcery: BaseComponent
protocol _MandatoryFieldIndicator {
protocol _MandatoryFieldIndicatorComponent {
// sourcery: resultBuilder.name = @ViewBuilder, resultBuilder.backingComponent = TextOrIconView
// sourcery: defaultValue = .text("*")
var mandatoryFieldIndicator: TextOrIcon? { get }
}

protocol _MandatoryField: _MandatoryFieldIndicator {
protocol _MandatoryField: _MandatoryFieldIndicatorComponent {
// sourcery: defaultValue = false
var isRequired: Bool { get }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ extension KeyValueFormViewFioriStyle {
struct ContentFioriStyle: KeyValueFormViewStyle {
func makeBody(_ configuration: KeyValueFormViewConfiguration) -> some View {
KeyValueFormView(configuration)
.mandatoryFieldIndicatorStyle { indicatorConf in
MandatoryFieldIndicator(indicatorConf)
.foregroundStyle(Color.preferredColor(configuration.controlState == .disabled ? .separator : .primaryLabel))
}
}
}

Expand Down Expand Up @@ -87,6 +83,7 @@ extension KeyValueFormViewFioriStyle {
func makeBody(_ configuration: MandatoryFieldIndicatorConfiguration) -> some View {
MandatoryFieldIndicator(configuration)
.foregroundStyle(Color.preferredColor(self.keyValueFormViewConfiguration.controlState == .disabled ? .separator : .primaryLabel))
.font(.fiori(forTextStyle: .subheadline, weight: .semibold))
.padding(.bottom, -4)
.padding(.top, 11)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extension TextFieldFormViewFioriStyle {
.mandatoryFieldIndicatorStyle { indicatorConf in
MandatoryFieldIndicator(indicatorConf)
.foregroundStyle(self.getTitleColor(configuration))
.font(.fiori(forTextStyle: .subheadline, weight: .semibold))
}
.placeholderTextFieldStyle { config in
HStack {
Expand Down

0 comments on commit 3931672

Please sign in to comment.