@props([ 'tableId', 'columns' => [], 'rows' => [], 'types', 'selectable' => true, 'bulkDeleteUrl' => null, 'hasRowActions' => false, 'previewDrawerId', 'emptyTitle' => null, 'emptyText' => null, 'createUrl' => null, 'createLabel' => null, ]) @php $emptyTitle = $emptyTitle ?: __('kview-ui-data::table.empty_title'); $emptyText = $emptyText ?: __('kview-ui-data::table.empty_text'); $createLabel = $createLabel ?: __('kview-ui-data::table.new_record'); $hasRows = count($rows) > 0; $hasSelectionRail = $selectable && $hasRows; @endphp
@if ($hasSelectionRail)
@foreach ($rows as $row)
@endforeach
@endif
@foreach ($columns as $column) @php $key = $column['key']; @endphp @endforeach @foreach ($rows as $row) @foreach ($columns as $column) @php $key = $column['key']; $cell = $row['cells'][$key] ?? null; $cellArray = is_array($cell) ? $cell : ['value' => $cell]; $sortValue = $cellArray['sort'] ?? $cellArray['value'] ?? ''; $filterValue = $cellArray['filter'] ?? $cellArray['value'] ?? $cellArray['label'] ?? ''; $cellType = $types->normalize($cellArray['type'] ?? $column['type']); $cellTypeDefinition = $types->definition($cellType); $cellAlignment = $cellArray['alignment'] ?? $cellArray['align'] ?? $column['alignment'] ?? $cellTypeDefinition['alignment']; @endphp @endforeach @endforeach
$column['numeric'], 'is-nowrap' => $column['nowrap'], 'is-align-'.$column['alignment'], ]) @if (! empty($column['title'])) title="{{ $column['title'] }}" @endif style="width: {{ $column['width'] ?? '160px' }}; min-width: {{ $column['minWidth'] ?? '120px' }};" @if(($column['sortable'] ?? true) === true) aria-sort="none" @endif >
@if (($column['sortable'] ?? true) === true) @else {{ $column['label'] }} @endif
@if (($column['filterable'] ?? true) !== false) @endif @if (($column['resizable'] ?? true) === true) @endif
$cellTypeDefinition['numeric'], 'is-nowrap' => $column['nowrap'] || $cellTypeDefinition['nowrap'], 'is-align-'.$cellAlignment, ]) style="width: {{ $column['width'] ?? '160px' }}; min-width: {{ $column['minWidth'] ?? '120px' }};" >
@unless ($hasRows)
@endunless
@if ($hasRowActions)
{{ __('kview-ui-data::table.row_actions') }}
@foreach ($rows as $row)
@endforeach
@endif