-
Notifications
You must be signed in to change notification settings - Fork 61
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(ui-fields): Add max rows to TableRepeaterFormField #15000
Conversation
WalkthroughThe recent changes introduce new parameters Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant TableRepeaterFormField
participant FieldBuilders
participant ApplicationTypes
User->>TableRepeaterFormField: Click "Add Item"
TableRepeaterFormField->>TableRepeaterFormField: Check maxValues and maxRows
alt Can Add Item
TableRepeaterFormField->>FieldBuilders: Add new item
else Cannot Add Item
TableRepeaterFormField->>User: Disable "Add Item" button
end
This diagram illustrates the interaction between the user and the Tip Early Access Features
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 0
Outside diff range and nitpick comments (4)
libs/application/ui-fields/src/lib/TableRepeaterFormField/TableRepeaterFormField.tsx (4)
63-63
: Ensure proper documentation for themaxValues
property in the component's prop description.
Line range hint
149-149
: JSX elements without children should be self-closing for cleaner code.- <T.HeadData></T.HeadData> + <T.HeadData />
Line range hint
161-161
: JSX elements without children should be self-closing for cleaner code.- <T.Data></T.Data> + <T.Data />
Line range hint
268-268
: Prefer template literals over string concatenation for consistency and readability.- id + 'title' + `${id}title`
Review Details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (3)
- libs/application/core/src/lib/fieldBuilders.ts (2 hunks)
- libs/application/types/src/lib/Fields.ts (1 hunks)
- libs/application/ui-fields/src/lib/TableRepeaterFormField/TableRepeaterFormField.tsx (3 hunks)
Additional Context Used
Biome (26)
libs/application/core/src/lib/fieldBuilders.ts (3)
1-44: Some named imports are only used as types.
45-46: All these imports are only used as types.
46-47: All these imports are only used as types.
libs/application/types/src/lib/Fields.ts (13)
320-320: Unexpected any. Specify a different type.
334-334: Unexpected any. Specify a different type.
10-11: All these imports are only used as types.
11-12: All these imports are only used as types.
12-13: All these imports are only used as types.
13-14: All these imports are only used as types.
14-15: All these imports are only used as types.
15-16: All these imports are only used as types.
16-17: All these imports are only used as types.
17-18: All these imports are only used as types.
18-19: All these imports are only used as types.
19-20: All these imports are only used as types.
20-21: All these imports are only used as types.
libs/application/ui-fields/src/lib/TableRepeaterFormField/TableRepeaterFormField.tsx (10)
149-149: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
158-168: Change to an optional chain.
161-161: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
268-268: Template literals are preferred over string concatenation.
1-5: All these imports are only used as types.
26-27: Some named imports are only used as types.
151-151: Avoid using the index of an array as key property in an element.
160-160: Avoid using the index of an array as key property in an element.
163-163: Avoid using the index of an array as key property in an element.
218-218: Avoid using the index of an array as key property in an element.
Path-based Instructions (3)
libs/application/ui-fields/src/lib/TableRepeaterFormField/TableRepeaterFormField.tsx (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/application/types/src/lib/Fields.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/application/core/src/lib/fieldBuilders.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
Additional comments not posted (4)
libs/application/ui-fields/src/lib/TableRepeaterFormField/TableRepeaterFormField.tsx (2)
316-316
: The logic to disable the "Add Item" button based onmaxValues
is correctly implemented and integrated into the JSX structure.
86-86
: The logic to disable the "Add Item" button based onmaxValues
is correctly implemented. However, consider adding a unit test to verify this behavior.libs/application/types/src/lib/Fields.ts (1)
509-513
: The addition of themaxValues
property to theTableRepeaterField
interface is well-documented and aligns with the PR's objectives to limit the number of items in a table.libs/application/core/src/lib/fieldBuilders.ts (1)
Line range hint
748-768
: ThebuildTableRepeaterField
function correctly integrates themaxValues
parameter, allowing it to be set when building aTableRepeaterField
. This change is consistent with the PR's objectives and the updates in other files.
Datadog ReportBranch report: ✅ 0 Failed, 312 Passed, 0 Skipped, 1m 6.99s Total Time |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15000 +/- ##
==========================================
- Coverage 37.08% 37.08% -0.01%
==========================================
Files 6393 6393
Lines 130145 130146 +1
Branches 37124 37125 +1
==========================================
Hits 48270 48270
- Misses 81875 81876 +1 Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
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.
Nice feature!
Maybe maxValues
could be more descriptive if renamed to maxRows
?
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.
Nice
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.
Actionable comments posted: 1
Outside diff range and nitpick comments (3)
libs/application/ui-fields/src/lib/TableRepeaterFormField/TableRepeaterFormField.tsx (3)
Line range hint
149-149
: JSX elements without children should be self-closing for consistency and readability.- <T.HeadData></T.HeadData> + <T.HeadData />
Line range hint
161-161
: JSX elements without children should be self-closing for consistency and readability.- <T.Data></T.Data> + <T.Data />
Line range hint
268-268
: Use template literals for string concatenation to improve readability.- id + 'title' + `${id}title`
Review Details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (3)
- libs/application/core/src/lib/fieldBuilders.ts (2 hunks)
- libs/application/types/src/lib/Fields.ts (1 hunks)
- libs/application/ui-fields/src/lib/TableRepeaterFormField/TableRepeaterFormField.tsx (3 hunks)
Additional Context Used
Biome (26)
libs/application/core/src/lib/fieldBuilders.ts (3)
1-44: Some named imports are only used as types.
45-46: All these imports are only used as types.
46-47: All these imports are only used as types.
libs/application/types/src/lib/Fields.ts (13)
320-320: Unexpected any. Specify a different type.
334-334: Unexpected any. Specify a different type.
10-11: All these imports are only used as types.
11-12: All these imports are only used as types.
12-13: All these imports are only used as types.
13-14: All these imports are only used as types.
14-15: All these imports are only used as types.
15-16: All these imports are only used as types.
16-17: All these imports are only used as types.
17-18: All these imports are only used as types.
18-19: All these imports are only used as types.
19-20: All these imports are only used as types.
20-21: All these imports are only used as types.
libs/application/ui-fields/src/lib/TableRepeaterFormField/TableRepeaterFormField.tsx (10)
149-149: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
158-168: Change to an optional chain.
161-161: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
268-268: Template literals are preferred over string concatenation.
1-5: All these imports are only used as types.
26-27: Some named imports are only used as types.
151-151: Avoid using the index of an array as key property in an element.
160-160: Avoid using the index of an array as key property in an element.
163-163: Avoid using the index of an array as key property in an element.
218-218: Avoid using the index of an array as key property in an element.
Path-based Instructions (3)
libs/application/ui-fields/src/lib/TableRepeaterFormField/TableRepeaterFormField.tsx (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/application/types/src/lib/Fields.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/application/core/src/lib/fieldBuilders.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
Additional comments not posted (4)
libs/application/ui-fields/src/lib/TableRepeaterFormField/TableRepeaterFormField.tsx (2)
86-86
: The logic for disabling the "Add Item" button based onmaxRows
is correctly implemented.
316-316
: The logic to disable the "Add Item" button based on thecanAddItem
condition is correctly implemented.libs/application/types/src/lib/Fields.ts (1)
509-513
: ThemaxRows
property is well-documented, clearly explaining its purpose and effect.libs/application/core/src/lib/fieldBuilders.ts (1)
Line range hint
748-768
: ThebuildTableRepeaterField
function correctly integrates themaxRows
parameter, ensuring it is passed along to theTableRepeaterField
type.
What
Add max rows to
TableRepeaterFormField
Why
To be able to limit the number of rows that can be added to the table. When the maximum is reached, the button to add a new row is disabled.
This is optional and is set using
maxRows: number
, e.g.maxRows: 2
allows the applicant to add two rows to the table.Screenshots / Gifs
Checklist:
Summary by CodeRabbit
New Features
maxValues
andmaxRows
parameters to limit the number of values and rows in table repeaters.Enhancements