{#
/**
 * @file
 * Template for rendering a table in a Drupal view.
 *
 * Available variables:
 * - attributes: HTML attributes for the table element.
 * - caption: The caption for the table.
 * - header: The table header columns.
 * - rows: Table row items.
 * - responsive: Flag indicating whether the table is responsive.
 * - sticky: Flag indicating whether the table header is sticky.
 */
#}
{% set classes = [
  'viewtable',
  'cols-' ~ header|length,
  responsive ? 'responsive-enabled',
  sticky ? 'sticky-enabled',
] %}
<table{{ attributes.addClass(classes) }}>
  {% if caption %}
    <caption>{{ caption }}</caption>
  {% endif %}
  {% if header %}
    <thead>
      <tr>
        {% for column in header %}
          {% set column_classes = column.default_classes ? ['views-field'] : [] %}
          <th{{ column.attributes.addClass(column_classes) }}>
            {{ column.content }}
          </th>
        {% endfor %}
      </tr>
    </thead>
  {% endif %}
  <tbody>
    {% for row in rows %}
      <tr{{ row.attributes }}>
        {% for column in row.columns %}
          {% set column_classes = column.default_classes ? ['views-field'] : [] %}
          <td{{ column.attributes.addClass(column_classes) }}>
            {{ column.content }}
          </td>
        {% endfor %}
      </tr>
    {% endfor %}
  </tbody>
</table>
