<template lang="pug">
  tbody.data-sheet-body
    slot(
      name="pre-body-rows"
      :model="model"
      :columns="columns"
    )
    tr.data-sheet-row(
      v-for="row in model"
      :key="`${row[keyProperty]}-row`"
      :class="{'is-selected': selectedRows[row[keyProperty]]}"
    )
      td.data-sheet-cell.text-align-center.vertical-align-middle
        label.checkbox
          input(
            type="checkbox"
            @change="select.toggle(row)"
            :checked="select.isSelected(row)"
          )
      td.data-sheet-cell(
        v-for="column in columns"
        :key="`${row[keyProperty]}-${column.key}-cell`"
        :class="[columnar.alignment[column.key], columnar.whitespace[column.key]]"
      )
        slot(
          :name="`${column.value.property}-cell`"
          :row="row"
          :value="column.value"
        )
          span {{ (column.value.iteratee && column.value.iteratee(row)) || row[column.value.property] || row.value || '' }}
</template>

<script>
export default {
  name: 'DataSheetBody',
  props: ['model', 'columns', 'columnar', 'keyProperty', 'selectedRows', 'select']
}
</script>

<style>
</style>
