Skip to content

Commit e756393

Browse files
committed
Further Tweaks
1 parent fe3944e commit e756393

16 files changed

+1097
-56
lines changed

resources/js/laravel-livewire-tables.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ document.addEventListener('alpine:init', () => {
4141
showFilterPillLabel: [],
4242
filterPillsSeparator: ', ',
4343
showFilterPillsSection: true,
44+
newSelectCount: 0,
45+
indeterminateCheckbox: false,
46+
bulkActionHeaderChecked: false,
4447
stripLivewireTags(data) {
4548
let localHtml = data.innerHTML;
4649
localHtml = localHtml.replace('<!--[if BLOCK]>', '')

resources/js/laravel-livewire-tables.min.js

Lines changed: 982 additions & 1 deletion
Large diffs are not rendered by default.

resources/views/components/table/collapsed-columns.blade.php

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,19 @@
2525
'text-left pt-4 pb-2 px-4' => $isTailwind,
2626
'text-start pt-3 p-2' => $isBootstrap,
2727
])>
28-
<div>
28+
<div >
2929

3030

3131
@tableloop($collapsingColumnDetails as $colIndex => $columnData)
32+
@php($key = $tableName . '_' . $rowIndex.'_'.$colIndex)
3233
<div wire:key="{{ $tableName }}-row-{{ $row->{$primaryKey} }}-collapsed-contents-{{ $colIndex }}"
3334
x-data="{ value: '',
34-
init() {
35-
$nextTick(() => {
36-
this.value = stripLivewireTags($refs.{{ $tableName . '_' . $rowIndex.'_'.$colIndex }});
37-
});
38-
}
39-
}" @class($isTailwind ? [
40-
'block mb-2 hidden',
41-
'sm:block' => $columnData['shouldCollapseAlways'],
42-
'sm:block md:hidden' => !$columnData['shouldCollapseAlways'] && !$columnData['shouldCollapseOnTablet'] && $columnData['shouldCollapseOnMobile'],
43-
'sm:block lg:hidden' => !$columnData['shouldCollapseAlways'] && ($columnData['shouldCollapseOnTablet'] || $columnData['shouldCollapseOnMobile']),
44-
] : [
45-
'd-block mb-2',
46-
'd-sm-none' => !$columnData['shouldCollapseAlways'] && !$columnData['shouldCollapseOnTablet'] && !$columnData['shouldCollapseOnMobile'],
47-
'd-md-none' => !$columnData['shouldCollapseAlways'] && !$columnData['shouldCollapseOnTablet'] && $columnData['shouldCollapseOnMobile'],
48-
'd-lg-none' => !$columnData['houldCollapseAlway'] && ($columnData['shouldCollapseOnTablet'] || $columnData['shouldCollapseOnMobile']),
49-
50-
])>
35+
init() {
36+
$watch('opening', val => {
37+
this.value = stripLivewireTags($refs.{{ $tableName . '_' . $rowIndex.'_'.$colIndex }});
38+
});
39+
}
40+
}" @class($columnData['classes'])>
5141
<strong>{{ $columnData['title'] }}</strong>: <br />
5242
<span @if($columnData['isHtml'])x-html="value" @else x-text="value"@endif></span>
5343
</div>

resources/views/components/table/tbody.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'divide-y' => $coreTableAttributes['tbody']['default-styling'] ?? ($coreTableAttributes['tbody']['default'] ?? true),
1414
])
1515
->except(['default','default-styling','default-colors'])
16-
}} x-data
16+
}} x-data="{ opening: false, }"
1717
>
1818
<x-livewire-tables::table.tr wire:key="{{ $tableName }}-row-wrap-{{ $rowPk }}" :$row :$rowIndex :$rowPk>
1919

@@ -25,6 +25,7 @@
2525
@endif
2626
@if ($showCollapsingColumnSections)
2727
<x-livewire-tables::table.td.collapsed-columns />
28+
2829
@endif
2930

3031
@tableloop($selectedVisibleColumns as $colIndex => $column)

resources/views/components/table/td.blade.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@aware([ 'row', 'rowIndex', 'tableName', 'primaryKey','isTailwind','isBootstrap'])
1+
@aware([ 'row', 'rowIndex', 'tableName', 'primaryKey','isTailwind','isBootstrap', 'collapsingColumnClasses'])
22
@props(['column', 'colIndex'])
33

44
@php
@@ -15,16 +15,11 @@
1515
$attributes->merge($customAttributes)
1616
->class($isTailwind ? [
1717
'px-6 py-4 whitespace-nowrap text-sm font-medium dark:text-white' => $isTailwind && ($customAttributes['default'] ?? true),
18-
'hidden' => $column && $column->shouldCollapseAlways(),
19-
'hidden md:table-cell' => $column && $column->shouldCollapseOnMobile(),
20-
'hidden lg:table-cell' => $column && $column->shouldCollapseOnTablet(),
2118
] : [
2219
'' => ($customAttributes['default'] ?? true),
23-
'd-none' => $column && $column->shouldCollapseAlways(),
24-
'd-none d-md-table-cell' => $column && $column->shouldCollapseOnMobile(),
25-
'd-none d-lg-table-cell' => $column && $column->shouldCollapseOnTablet(),
2620
'laravel-livewire-tables-cursor' => $column && $column->isClickable(),
2721
])
22+
->class($collapsingColumnClasses[$colIndex] ?? '')
2823
->except(['default','default-styling','default-colors'])
2924
}}
3025
>

resources/views/components/table/td/collapsed-columns.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
@if (! $hidden)
2525
<button
2626
x-cloak x-show="!currentlyReorderingStatus"
27-
x-on:click.prevent="$dispatch('toggle-row-content', {'tableName': '{{ $tableName }}', 'row': {{ $rowIndex }}}); open = !open"
27+
@mouseover="if(opening != true) { opening = true }; "
28+
x-on:click.prevent="if(opening != true) { opening = true }; $dispatch('toggle-row-content', {'tableName': '{{ $tableName }}', 'row': {{ $rowIndex }}}); open = !open;"
2829
@class([
2930
'border-0 bg-transparent p-0' => $isBootstrap
3031
])

resources/views/components/table/td/plain.blade.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@aware([ 'rowIndex', 'rowID','isTailwind','isBootstrap'])
2-
@props(['column' => null, 'customAttributes' => [], 'displayMinimisedOnReorder' => false, 'hideUntilReorder' => false])
2+
@props(['column' => null, 'colIndex' => null, 'customAttributes' => [], 'displayMinimisedOnReorder' => false, 'hideUntilReorder' => false])
33

44
<td {{ $attributes
55
->merge($customAttributes)
@@ -8,15 +8,11 @@
88
])
99
->class($isTailwind ? [
1010
'px-6 py-4 whitespace-nowrap text-sm font-medium dark:text-white' => $customAttributes['default'] ?? true,
11-
'hidden' => $column && $column->shouldCollapseAlways(),
12-
'hidden md:table-cell' => $column && $column->shouldCollapseOnMobile(),
13-
'hidden lg:table-cell' => $column && $column->shouldCollapseOnTablet(),
1411
] : [
1512
'' => $customAttributes['default'] ?? true,
16-
'd-none' => $column && $column->shouldCollapseAlways(),
17-
'd-none d-md-table-cell' => $column && $column->shouldCollapseOnMobile(),
18-
'd-none d-lg-table-cell' => $column && $column->shouldCollapseOnTablet(),
1913
])
14+
->class($collapsingColumnClasses[$colIndex] ?? '')
15+
2016
->except(['default','default-styling','default-colors'])
2117
}} @if($hideUntilReorder) x-show="reorderDisplayColumn" @endif >
2218
{{ $slot }}

resources/views/components/table/th.blade.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@aware(['isTailwind','isBootstrap'])
1+
@aware(['isTailwind','isBootstrap','collapsingColumnClasses'])
22
@props(['column', 'index'])
33

44
@php
@@ -16,15 +16,10 @@
1616
[
1717
'text-gray-500 dark:bg-gray-800 dark:text-gray-400' => (($customThAttributes['default-colors'] ?? true) || ($customThAttributes['default'] ?? true)),
1818
'px-6 py-3 text-left text-xs font-medium whitespace-nowrap uppercase tracking-wider' => (($customThAttributes['default-styling'] ?? true) || ($customThAttributes['default'] ?? true)),
19-
'hidden' => $column->shouldCollapseAlways(),
20-
'hidden md:table-cell' => $column->shouldCollapseOnMobile(),
21-
'hidden lg:table-cell' => $column->shouldCollapseOnTablet(),
2219
] : [
2320
'' => ($customThAttributes['default'] ?? true),
24-
'd-none' => $column->shouldCollapseAlways(),
25-
'd-none d-md-table-cell' => $column->shouldCollapseOnMobile(),
26-
'd-none d-lg-table-cell' => $column->shouldCollapseOnTablet(),
2721
])
22+
->class($collapsingColumnClasses[$index] ?? '')
2823
->except(['default', 'default-colors', 'default-styling'])
2924
}}>
3025
@if($column->getColumnLabelStatus())

resources/views/components/table/th/bulk-actions.blade.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
@if ($this->bulkActionsAreEnabled() && $this->hasBulkActions())
88
<x-livewire-tables::table.th.plain :displayMinimisedOnReorder="true" wire:key="{{ $tableName }}-thead-bulk-actions" :$customAttributes>
9-
<div
10-
x-data="{newSelectCount: 0, indeterminateCheckbox: false, bulkActionHeaderChecked: false}"
11-
x-init="$watch('selectedItems', value => indeterminateCheckbox = (value.length > 0 && value.length < paginationTotalItemCount))"
9+
<div x-init="$watch('selectedItems', value => indeterminateCheckbox = (value.length > 0 && value.length < paginationTotalItemCount))"
1210
x-cloak x-show="currentlyReorderingStatus !== true"
1311
@class([
1412
'inline-flex rounded-md shadow-sm' => $isTailwind,

resources/views/components/table/tr/bulk-actions.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
'bg-indigo-50 dark:bg-gray-900 dark:text-white' => $isTailwind,
1515
])
1616
>
17-
<x-livewire-tables::table.td.plain :colspan="$colspan">
17+
<x-livewire-tables::table.td.plain :colIndex="'bulkactions'" :colspan="$colspan">
1818
<template x-if="selectedItems.length == paginationTotalItemCount || selectAllStatus">
1919
<div wire:key="{{ $tableName }}-all-selected">
2020
<span>

0 commit comments

Comments
 (0)