google / mesop

https://google.github.io/mesop/
Apache License 2.0
23 stars 8 forks source link

Add Angular Paginator Component #168

Open richard-to opened 1 month ago

richard-to commented 1 month ago

Angular's Paginator Component (https://material.angular.io/components/paginator/overview) is can be used separately from the table component.

So we should probably create the component separate since it I can definitely see use cases for a paginator that's not part of a table.

In addition the paginator can be probably declared separate of the mesop table component. The paginator event could update the the dataframe for pagination, which would then be passed to the table component.

This would require that the table component have a parameter to know what slice of the data table to show.

Alternatively, we may want to embed the paginator within the table component as well. I think this option only makes sense if the API for specifying the dataframe slice is not intuitive and easy to understand.

wwwillchen commented 1 month ago

I think it would be good to have some examples of the API for using paginator w/ the table, if it's a separate component. I'm a little concerned it would add some boilerplate for common use cases.

For example, it's quite common to have large dataframes (e.g. thousands of rows) where pagination is almost always desirable. Colab has a dataframe table component which provides pagination and is quite handy. IMO, it would be nice where something like me.table(df) would automatically do pagination (e.g. 25 rows/per page and the user can select different options for page sizes, e.g. 25, 50, 100).

Also, we could support having both paginator embedded within table (for this default/common use case) and having a separate paginator component.

richard-to commented 1 month ago

That's a good point about it being more user friendly if the paginator was embedded in the table for the common use case.

On a side note I'm planning to write up a quick design doc for the detailing the rest of the table API since I think to implement the sticky columns and column styling stuff will require some design decisions that may affect other feature.