Skip to content

Conversation

@b-yogesh
Copy link
Collaborator

Addresses #41

@b-yogesh b-yogesh marked this pull request as ready for review December 27, 2024 14:02
@codecov
Copy link

codecov bot commented Dec 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.36%. Comparing base (49014f4) to head (a6a6e2d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #92      +/-   ##
==========================================
+ Coverage   89.03%   89.36%   +0.32%     
==========================================
  Files          82       84       +2     
  Lines        1395     1438      +43     
  Branches      205      213       +8     
==========================================
+ Hits         1242     1285      +43     
  Misses        124      124              
  Partials       29       29              
Flag Coverage Δ
backend 100.00% <100.00%> (ø)
frontend 76.95% <100.00%> (+0.64%) ⬆️

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.

@b-yogesh b-yogesh self-assigned this Dec 27, 2024
@b-yogesh b-yogesh requested a review from forman December 27, 2024 14:09
Copy link
Member

@forman forman left a comment

Choose a reason for hiding this comment

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

Overall very good, but I don't like the way how row data is specified.

Comment on lines 6 to 31
class TableCellProps(TypedDict, total=False):
"""Represents common properties of a table cell."""

id: str | int | float
"""The unique identifier for the cell."""

size: Literal['medium', 'small'] | str | None
"""The size of the cell."""

align: Literal["inherit", "left", "center", "right", "justify"] | None
"""The alignment of the cell content."""


class TableColumn(TableCellProps):
"""Defines a column in the table."""

label: str
"""The display label for the column header."""


class TableRowData(TableCellProps):
"""Defines a row in the table."""

data: dict[str, Union[str, int, float, bool, None]]
"""The data for the row, as a dictionary where keys are the column ids."""

Copy link
Member

Choose a reason for hiding this comment

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

I suggest simplifying this for users. I have a problem with the redundancy introduced here and the being forced to provide values for all properties as there are no specified defaults. My suggestion

  • allow passing a list of lists as row data instead being forced to have dicts with data properties
  • it is unlikely that users need to format specific row cells individually, for columns this is quite common
  • please document the default values

Copy link
Member

Choose a reason for hiding this comment

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

To preserve the semantics of the id of a row, we can also specify a property row_id_column which is the ID of a column that that provides the row IDs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Have updated the component based on your comments.

# Conflicts:
#	chartlets.js/packages/lib/src/plugins/mui/index.ts
#	chartlets.py/CHANGES.md
#	chartlets.py/chartlets/components/__init__.py
#	chartlets.py/demo/my_extension/__init__.py
@b-yogesh b-yogesh requested a review from forman February 26, 2025 10:32
Copy link
Member

@forman forman left a comment

Choose a reason for hiding this comment

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

Thanks, looks good! Tiny suggestion

@b-yogesh b-yogesh merged commit 8a22ad7 into main Feb 26, 2025
9 checks passed
@b-yogesh b-yogesh deleted the yogesh-41-basic-table branch February 26, 2025 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants