meilisearch-admin/app/components/royal-table/column.hbs
2022-09-10 15:26:24 +03:00

43 lines
1.2 KiB
Handlebars

{{#if this.isHead}}
{{! template-lint-disable no-invalid-interactive }}
<th
role={{if @sortable 'button'}}
align={{@align}}
...attributes
{{on 'click' this.handleClickHead}}
{{on 'click' this.handleSort}}
{{! DOTO: align is depricated, use styles align instead }}
>
<span class='inline-flex items-center'>
{{#if (has-block 'name')}}
{{yield to='name'}}
{{else if @name}}
{{@name}}
{{else if @prop}}
{{capitalize @prop}}
{{/if}}
{{#if @sortable}}
{{#if this.isAscSorted}}
<Icons::ArrowDownThin class="fill-base-3 ml-0.5" @size={{14}} />
{{else if this.isDescSorted}}
<Icons::ArrowUpThin class="fill-base-3 ml-0.5" @size={{14}} />
{{else}}
<Icons::ArrowUpDown class="fill-base-3 ml-0.5" @size={{14}} />
{{/if}}
{{/if}}
</span>
</th>
{{else if this.isBody}}
<td align={{@align}} ...attributes>
{{#if (has-block)}}
{{yield}}
{{else if @bodyComponent}}
{{#let @bodyComponent as |BodyComponent|}}
<BodyComponent @data={{@data}} />
{{/let}}
{{else}}
{{get @data @prop}}
{{/if}}
</td>
{{/if}}