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(addon-table): add optional first/last page buttons to the TablePagination component #6652

Closed

Conversation

pubiqq
Copy link
Contributor

@pubiqq pubiqq commented Feb 1, 2024

New property for the TablePagination component - showFirstLastPageButtons:

showFirstLastPageButtons = false (default) showFirstLastPageButtons = true

Copy link

lumberjack-bot bot commented Feb 1, 2024

Pull request was closed ✔️

All saved screenshots (for current PR) were deleted 🗑️

Copy link

codecov bot commented Feb 1, 2024

Codecov Report

Attention: Patch coverage is 36.36364% with 21 lines in your changes are missing coverage. Please review.

Project coverage is 63.52%. Comparing base (43c0ebb) to head (822449c).
Report is 390 commits behind head on main.

❗ Current head 822449c differs from pull request most recent head f27dac2. Consider uploading reports for the commit f27dac2 to get more accurate results

Files Patch % Lines
...nts/table-pagination/table-pagination.component.ts 32.25% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6652      +/-   ##
==========================================
- Coverage   70.19%   63.52%   -6.68%     
==========================================
  Files        1460     1087     -373     
  Lines       15934    11753    -4181     
  Branches     2292     1642     -650     
==========================================
- Hits        11185     7466    -3719     
+ Misses       4369     4102     -267     
+ Partials      380      185     -195     
Flag Coverage Δ
summary 63.52% <36.36%> (-6.68%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

bundlemon bot commented Feb 1, 2024

BundleMon

Files updated (1)
Status Path Size Limits
demo/browser/main.(hash).js
309.39KB (+188B +0.06%) +10%
Unchanged files (4)
Status Path Size Limits
demo/browser/vendor.(hash).js
204.15KB +10%
demo/browser/runtime.(hash).js
37.74KB +10%
demo/browser/styles.(hash).css
13.89KB +10%
demo/browser/polyfills.(hash).js
11.21KB +10%

Total files change +185B +0.03%

Groups updated (1)
Status Path Size Limits
demo/browser/*..js
2.34MB (+2.08KB +0.09%) -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@splincode splincode added the v4 4.0 candidate label Feb 26, 2024
@pubiqq pubiqq force-pushed the feat/table-pagination/first-last-page branch 2 times, most recently from f533573 to f6db09e Compare February 29, 2024 13:43
@splincode splincode force-pushed the feat/table-pagination/first-last-page branch from f6db09e to e0fdf2e Compare February 29, 2024 13:47
@pubiqq pubiqq force-pushed the feat/table-pagination/first-last-page branch 2 times, most recently from 5a6d1da to 1304414 Compare February 29, 2024 16:03
@pubiqq pubiqq force-pushed the feat/table-pagination/first-last-page branch 2 times, most recently from 5b5d487 to 826074a Compare March 7, 2024 13:25
@pubiqq pubiqq force-pushed the feat/table-pagination/first-last-page branch from 826074a to 822449c Compare April 16, 2024 01:37
@pubiqq pubiqq force-pushed the feat/table-pagination/first-last-page branch from 822449c to f27dac2 Compare April 16, 2024 20:12
const previousPage = this.previousPage;

if (previousPage === null) {
return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Early returns make no sense if it's just one line. This looks like it would be better to just support null in selectPage and do the early return there.

@@ -38,6 +38,9 @@ export class TuiTablePaginationComponent {
@Input()
public size = this.options.size;

@Input()
public showFirstLastPageButtons = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking so long to review this. We need shorter names and we do not need to deprecate and rename things, let's do this with minimum intervention to how it works right now. If we only want it in 4.0, we can just rename everything to better suited names.

return this.previousPage === null;
}

protected get previousPageDisabled(): boolean {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's drop Page from all these getters. This is a pagination component, it's implicit that we are talking about pages. And class prop names are not minified by compiler so it's better to keep them sort bundlesize-wise.

}

protected get lastPageDisabled(): boolean {
return this.nextPage === null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have 2 getters that do the same?

/**
* Returns the index of the first page.
*/
private get firstPage(): number {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This getter makes no sense. It's obvious that first index is 0, there's no need to move into a semantic getter.

/**
* Returns the index of the last page.
*/
private get lastPage(): number {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is only used once, let's not bloat class with a getter for lastPage, just inline this.pageCount - 1 where you use it, it's self explanatory.

@splincode splincode closed this Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants