-
-
Notifications
You must be signed in to change notification settings - Fork 364
feat(BootstrapInputNumber): support NumberDecimalSeparator setting #4983
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(BootstrapInputNumber): support NumberDecimalSeparator setting #4983
Conversation
Reviewer's Guide by SourceryThis pull request implements automatic rendering of component types based on the current input language's decimal separator. When the decimal separator is not a period (.), numeric type edits are rendered as text boxes instead of number boxes. It also refactors the Sequence diagram for numeric field type renderingsequenceDiagram
participant User
participant Component
participant Utility
participant CultureInfo
User->>Component: Edit numeric field
Component->>Utility: GenerateComponentType()
Utility->>CultureInfo: Get CurrentCulture
CultureInfo-->>Utility: Return NumberFormat
Note over Utility: Check NumberDecimalSeparator
alt NumberDecimalSeparator is '.'
Utility-->>Component: Return BootstrapInputNumber
else NumberDecimalSeparator is not '.'
Utility-->>Component: Return default text input
end
Component-->>User: Display appropriate input field
Class diagram showing Utility class changesclassDiagram
class Utility {
+GetPropertyValue<TModel, TResult>(model: TModel, fieldName: string): TResult
-NumberDecimalSeparator: string
+CreateDisplayByFieldType(builder: RenderTreeBuilder, item: IEditorItem)
+CreateComponentByFieldType(builder: RenderTreeBuilder, item: IEditorItem)
-GenerateComponentType(item: IEditorItem): Type
}
note for Utility "Added NumberDecimalSeparator property
Modified GenerateComponentType to check decimal separator"
State diagram for numeric input type decisionstateDiagram-v2
[*] --> CheckFieldType
CheckFieldType --> IsNumber: Field is numeric
CheckFieldType --> OtherTypes: Field is not numeric
IsNumber --> CheckSeparator
CheckSeparator --> NumberInput: Separator is '.'
CheckSeparator --> TextInput: Separator is not '.'
OtherTypes --> [*]
NumberInput --> [*]
TextInput --> [*]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Thanks for your PR, @densen2014. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @densen2014 - I've reviewed your changes - here's some feedback:
Overall Comments:
- The current approach of checking
NumberDecimalSeparator == "."is too simplistic for proper culture handling. Consider using .NET's built-in number formatting and parsing capabilities to handle numeric input consistently across all cultures.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4983 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 630 630
Lines 28073 28077 +4
Branches 4025 4026 +1
=========================================
+ Hits 28073 28077 +4 ☔ View full report in Codecov by Sentry. |
This reverts commit 7309a05.
按当前输入语言小数点分隔符格式自动渲染组件类型
多语言: 数字类型字段在编辑对话框渲染为数字输入框格式问题
一个自动的机制, 非点号(.) 数字格式区域, 数字类型编辑自动渲染为文本框, 而不是数字框
close #4987
Regression?
[If yes, specify the version the behavior has regressed from]
[是否影响老版本]
Risk
[Justify the selection above]
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
New Features: