tables.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. """Tables classes."""
  2. from typing import Union
  3. from reflex.vars.base import Var
  4. from .base import BaseHTML
  5. class Caption(BaseHTML):
  6. """Display the caption element."""
  7. tag = "caption"
  8. # Alignment of the caption
  9. align: Var[Union[str, int, bool]]
  10. class Col(BaseHTML):
  11. """Display the col element."""
  12. tag = "col"
  13. # Alignment of the content within the column
  14. align: Var[Union[str, int, bool]]
  15. # Number of columns the col element spans
  16. span: Var[Union[str, int, bool]]
  17. class Colgroup(BaseHTML):
  18. """Display the colgroup element."""
  19. tag = "colgroup"
  20. # Alignment of the content within the column group
  21. align: Var[Union[str, int, bool]]
  22. # Number of columns the colgroup element spans
  23. span: Var[Union[str, int, bool]]
  24. class Table(BaseHTML):
  25. """Display the table element."""
  26. tag = "table"
  27. # Alignment of the table
  28. align: Var[Union[str, int, bool]]
  29. # Provides a summary of the table's purpose and structure
  30. summary: Var[Union[str, int, bool]]
  31. class Tbody(BaseHTML):
  32. """Display the tbody element."""
  33. tag = "tbody"
  34. # Alignment of the content within the table body
  35. align: Var[Union[str, int, bool]]
  36. class Td(BaseHTML):
  37. """Display the td element."""
  38. tag = "td"
  39. # Alignment of the content within the table cell
  40. align: Var[Union[str, int, bool]]
  41. # Number of columns a cell should span
  42. col_span: Var[Union[str, int, bool]]
  43. # IDs of the headers associated with this cell
  44. headers: Var[Union[str, int, bool]]
  45. # Number of rows a cell should span
  46. row_span: Var[Union[str, int, bool]]
  47. class Tfoot(BaseHTML):
  48. """Display the tfoot element."""
  49. tag = "tfoot"
  50. # Alignment of the content within the table footer
  51. align: Var[Union[str, int, bool]]
  52. class Th(BaseHTML):
  53. """Display the th element."""
  54. tag = "th"
  55. # Alignment of the content within the table header cell
  56. align: Var[Union[str, int, bool]]
  57. # Number of columns a header cell should span
  58. col_span: Var[Union[str, int, bool]]
  59. # IDs of the headers associated with this header cell
  60. headers: Var[Union[str, int, bool]]
  61. # Number of rows a header cell should span
  62. row_span: Var[Union[str, int, bool]]
  63. # Scope of the header cell (row, col, rowgroup, colgroup)
  64. scope: Var[Union[str, int, bool]]
  65. class Thead(BaseHTML):
  66. """Display the thead element."""
  67. tag = "thead"
  68. # Alignment of the content within the table header
  69. align: Var[Union[str, int, bool]]
  70. class Tr(BaseHTML):
  71. """Display the tr element."""
  72. tag = "tr"
  73. # Alignment of the content within the table row
  74. align: Var[Union[str, int, bool]]
  75. caption = Caption.create
  76. col = Col.create
  77. colgroup = Colgroup.create
  78. table = Table.create
  79. tbody = Tbody.create
  80. td = Td.create
  81. tfoot = Tfoot.create
  82. th = Th.create
  83. thead = Thead.create
  84. tr = Tr.create