3
3
use Filament\Support\Enums\ Alignment ;
4
4
use Filament\Support\Enums\ MaxWidth ;
5
5
6
+ $isMinimal = $isMinimal ();
7
+
6
8
$containers = $getChildComponentContainers ();
7
9
8
10
$addAction = $getAction ($getAddActionName ());
27
29
$statePath = $getStatePath ();
28
30
29
31
foreach ($extraActions as $extraAction ) {
30
- $visibleExtraActions = array_filter (
31
- $extraActions ,
32
- fn (Action $action ): bool => $action -> isVisible (),
33
- );
32
+ $visibleExtraActions = array_filter ($extraActions , fn (Action $action ): bool => $action -> isVisible ());
34
33
}
35
34
36
35
foreach ($extraItemActions as $extraItemAction ) {
37
- $visibleExtraItemActions = array_filter (
38
- $extraItemActions ,
39
- fn (Action $action ): bool => $action -> isVisible (),
40
- );
36
+ $visibleExtraItemActions = array_filter ($extraItemActions , fn (Action $action ): bool => $action -> isVisible ());
41
37
}
42
38
43
- $hasActions = $reorderAction -> isVisible ()
44
- || $cloneAction -> isVisible ()
45
- || $deleteAction -> isVisible ()
46
- || $moveUpAction -> isVisible ()
47
- || $moveDownAction -> isVisible ()
48
- || filled ($visibleExtraItemActions );
39
+ $hasActions =
40
+ $reorderAction -> isVisible () ||
41
+ $cloneAction -> isVisible () ||
42
+ $deleteAction -> isVisible () ||
43
+ $moveUpAction -> isVisible () ||
44
+ $moveDownAction -> isVisible () ||
45
+ filled ($visibleExtraItemActions );
49
46
@endphp
50
47
51
- <x-dynamic-component :component =" $getFieldWrapperView()" :field =" $field" >
48
+ <x-dynamic-component
49
+ :component =" $getFieldWrapperView()"
50
+ :field =" $field"
51
+ >
52
52
<div
53
53
x-data =" {}"
54
54
{{ $attributes -> merge ($getExtraAttributes ())-> class ([
60
60
' xl' , MaxWidth:: ExtraLarge => ' break-point-xl' ,
61
61
' 2xl' , MaxWidth:: TwoExtraLarge => ' break-point-2xl' ,
62
62
default => ' break-point-md' ,
63
- }
63
+ },
64
64
]) } }
65
65
>
66
+
66
67
@if (count ($containers ) || $emptyLabel !== false )
67
- <div class =" table-repeater-container rounded-xl relative ring-1 ring-gray-950/5 dark:ring-white/20" >
68
+ <div @class ([
69
+ ' table-repeater-container relative' ,
70
+ ' ring-1 ring-gray-950/5 dark:ring-white/20 rounded-xl' => ! $isMinimal ,
71
+ ] )>
72
+
68
73
<table class =" w-full" >
69
74
<thead @class ([
70
- ' table-repeater-header-hidden sr-only' => ! $renderHeader ,
71
- ' table-repeater-header rounded-t-xl overflow-hidden border-b border-gray-950/5 dark:border-white/20' => $renderHeader ,
75
+ ' table-repeater-header-hidden sr-only' => ! $renderHeader ,
76
+ ' table-repeater-header overflow-hidden' => $renderHeader ,
77
+ ' border-b border-gray-950/5 dark:border-white/10 rounded-t-xl' => ! $isMinimal ,
72
78
] )>
73
- <tr class =" text-xs md:divide-x md:divide-gray-950/5 dark:md:divide-white/20" >
74
- @foreach ($headers as $key => $header )
75
- <th
76
- @class ([
77
- ' table-repeater-header-column p-2 font-medium first:rounded-tl-xl last:rounded-tr-xl bg-gray-100 dark:text-gray-300 dark:bg-gray-900/60' ,
78
- match ($header -> getAlignment ()) {
79
- ' center' , Alignment:: Center => ' text-center' ,
80
- ' right' , ' end' , Alignment:: Right , Alignment:: End => ' text-end' ,
81
- default => ' text-start'
82
- }
83
- ] )
84
- style =" width : {{ $header->getWidth() }}"
85
- >
86
- {{ $header -> getLabel () } }
87
- @if ($header -> isRequired () )
88
- <span class =" whitespace-nowrap" >
89
- <sup class =" font-medium text-danger-700 dark:text-danger-400" >*</sup >
79
+ <tr @class ([
80
+ ' text-xs' ,
81
+ ' md:divide-x md:divide-gray-950/5 dark:md:divide-white/20' => ! $isMinimal ,
82
+ ] )>
83
+ @foreach ($headers as $key => $header )
84
+ <th
85
+ @class ([
86
+ ' table-repeater-header-column' ,
87
+ ' first:rounded-tl-xl last:rounded-tr-xl bg-gray-100 dark:text-gray-300 dark:bg-gray-900/60 font-medium p-2' => ! $isMinimal ,
88
+ // 'font-medium text-regular' => $isMinimal,
89
+ match ($header -> getAlignment ()) {
90
+ ' center' , Alignment:: Center => ' text-center' ,
91
+ ' right' , ' end' , Alignment:: Right , Alignment:: End => ' text-end' ,
92
+ default => ' text-start' ,
93
+ },
94
+ ] )
95
+ style =" width : {{ $header->getWidth() }}"
96
+ >
97
+ {{ $header -> getLabel () } }
98
+ @if ($header -> isRequired () )
99
+ <span class =" whitespace-nowrap" >
100
+ <sup class =" font-medium text-danger-700 dark:text-danger-400" >*</sup >
101
+ </span >
102
+ @endif
103
+ </th >
104
+ @endforeach
105
+ @if ($hasActions && count ($containers ) )
106
+ <th @class ([
107
+ ' table-repeater-header-column w-px ' ,
108
+ ' last:rounded-tr-xl p-2 bg-gray-100 dark:bg-gray-900/60' => ! $isMinimal ,
109
+ ] )>
110
+ <span class =" sr-only" >
111
+ {{ trans (' table-repeater::components.repeater.row_actions.label' ) } }
90
112
</span >
91
- @endif
92
- </th >
93
- @endforeach
94
- @if ($hasActions && count ($containers ) )
95
- <th class =" table-repeater-header-column w-px last:rounded-tr-xl p-2 bg-gray-100 dark:bg-gray-900/60" >
96
- <span class =" sr-only" >
97
- {{ trans (' table-repeater::components.repeater.row_actions.label' ) } }
98
- </span >
99
- </th >
100
- @endif
101
- </tr >
113
+ </th >
114
+ @endif
115
+ </tr >
102
116
</thead >
103
117
<tbody
104
118
x-sortable
105
119
wire:end.stop =" {{ ' mountFormComponentAction(\' ' . $statePath . ' \' , \' reorder\' , { items: $event.target.sortable.toArray() })' } }"
106
- class =" table-repeater-rows-wrapper divide-y divide-gray-950/5 dark:divide-white/20"
120
+ @class ([
121
+ ' table-repeater-rows-wrapper' ,
122
+ ' divide-y divide-gray-950/5 dark:divide-white/20 pr-2' => ! $isMinimal ,
123
+ ] )
107
124
>
108
- @if (count ($containers ) )
109
- @foreach ($containers as $uuid => $row )
110
- @php
111
- $visibleExtraItemActions = array_filter (
112
- $extraItemActions ,
113
- fn (Action $action ): bool => $action ([' item' => $uuid ])-> isVisible (),
114
- );
115
- @endphp
116
- <tr
117
- wire:key =" {{ $this -> getId () } } .{{ $row -> getStatePath () } } .{{ $field :: class } } .item"
118
- x-sortable-item =" {{ $uuid } }"
119
- class =" table-repeater-row"
120
- >
121
- @php ($counter = 0 )
122
- @foreach ($row -> getComponents () as $cell )
123
- @if ($cell instanceof \Filament\Forms\Components\ Hidden || $cell -> isHidden () )
124
- {{ $cell } }
125
- @else
126
- <td
127
- @class ([
128
- ' table-repeater-column' ,
129
- ' p-2' => ! $streamlined ,
130
- ' has-hidden-label' => $cell -> isLabelHidden (),
131
- match ($headers [$counter ++ ]-> getAlignment ()) {
132
- ' center' , Alignment:: Center => ' text-center' ,
133
- ' right' , ' end' , Alignment:: Right , Alignment:: End => ' text-end' ,
134
- default => ' text-start'
135
- }
136
- ] )
137
- style =" width : {{ $cell->getMaxWidth() ?? 'auto ' }}"
138
- >
125
+ @if (count ($containers ) )
126
+ @foreach ($containers as $uuid => $row )
127
+ @php
128
+ $visibleExtraItemActions = array_filter (
129
+ $extraItemActions ,
130
+ fn (Action $action ): bool => $action ([' item' => $uuid ])-> isVisible (),
131
+ );
132
+ @endphp
133
+ <tr
134
+ wire:key =" {{ $this -> getId () } } .{{ $row -> getStatePath () } } .{{ $field :: class } } .item"
135
+ x-sortable-item =" {{ $uuid } }"
136
+ class =" table-repeater-row "
137
+ >
138
+ @php ($counter = 0 )
139
+ @foreach ($row -> getComponents () as $cell )
140
+ @if ($cell instanceof \Filament\Forms\Components\ Hidden || $cell -> isHidden () )
139
141
{{ $cell } }
140
- </td >
141
- @endif
142
- @endforeach
143
-
144
- @if ($hasActions )
145
- <td class =" table-repeater-column p-2 w-px" >
146
- <ul class =" flex items-center table-repeater-row-actions gap-x-3 px-2" >
147
- @foreach ($visibleExtraItemActions as $extraItemAction )
148
- <li >
149
- {{ $extraItemAction ([' item' => $uuid ]) } }
150
- </li >
151
- @endforeach
152
-
153
- @if ($reorderAction -> isVisible () )
154
- <li x-sortable-handle class =" shrink-0" >
155
- {{ $reorderAction } }
156
- </li >
157
- @endif
158
-
159
- @if ($isReorderableWithButtons )
160
- @if (! $loop -> first )
142
+ @else
143
+ <td
144
+ @class ([
145
+ ' table-repeater-column' ,
146
+ ' p-2' => ! $streamlined && ! $isMinimal ,
147
+ ' pr-3 pt-5' => $isMinimal ,
148
+ ' has-hidden-label' => $cell -> isLabelHidden (),
149
+ match ($headers [$counter ++ ]-> getAlignment ()) {
150
+ ' center' , Alignment:: Center => ' text-center' ,
151
+ ' right' , ' end' , Alignment:: Right , Alignment:: End => ' text-end' ,
152
+ default => ' text-start' ,
153
+ },
154
+ ] )
155
+ style =" width : {{ $cell->getMaxWidth() ?? 'auto ' }}"
156
+ >
157
+ {{ $cell } }
158
+ </td >
159
+ @endif
160
+ @endforeach
161
+
162
+ @if ($hasActions )
163
+ <td class =" table-repeater-column p-2 w-px" >
164
+ <ul class =" flex items-center table-repeater-row-actions gap-x-3 px-2" >
165
+ @foreach ($visibleExtraItemActions as $extraItemAction )
166
+ <li >
167
+ {{ $extraItemAction ([' item' => $uuid ]) } }
168
+ </li >
169
+ @endforeach
170
+
171
+ @if ($reorderAction -> isVisible () )
172
+ <li
173
+ x-sortable-handle
174
+ class =" shrink-0"
175
+ >
176
+ {{ $reorderAction } }
177
+ </li >
178
+ @endif
179
+
180
+ @if ($isReorderableWithButtons )
181
+ @if (! $loop -> first )
182
+ <li >
183
+ {{ $moveUpAction ([' item' => $uuid ]) } }
184
+ </li >
185
+ @endif
186
+
187
+ @if (! $loop -> last )
188
+ <li >
189
+ {{ $moveDownAction ([' item' => $uuid ]) } }
190
+ </li >
191
+ @endif
192
+ @endif
193
+
194
+ @if ($cloneAction -> isVisible () )
161
195
<li >
162
- {{ $moveUpAction ([' item' => $uuid ]) } }
196
+ {{ $cloneAction ([' item' => $uuid ]) } }
163
197
</li >
164
198
@endif
165
199
166
- @if (! $loop -> last )
200
+ @if ($deleteAction -> isVisible () )
167
201
<li >
168
- {{ $moveDownAction ([' item' => $uuid ]) } }
202
+ {{ $deleteAction ([' item' => $uuid ]) } }
169
203
</li >
170
204
@endif
171
- @endif
172
-
173
- @if ($cloneAction -> isVisible () )
174
- <li >
175
- {{ $cloneAction ([' item' => $uuid ]) } }
176
- </li >
177
- @endif
178
-
179
- @if ($deleteAction -> isVisible () )
180
- <li >
181
- {{ $deleteAction ([' item' => $uuid ]) } }
182
- </li >
183
- @endif
184
- </ul >
185
- </td >
186
- @endif
205
+ </ul >
206
+ </td >
207
+ @endif
208
+ </tr >
209
+ @endforeach
210
+ @else
211
+ <tr class =" table-repeater-row table-repeater-empty-row" >
212
+ <td
213
+ colspan =" {{ count ($headers ) + intval ($hasActions ) } }"
214
+ class =" table-repeater-column table-repeater-empty-column p-4 w-px text-center italic"
215
+ >
216
+ {{ $emptyLabel ?: trans (' table-repeater::components.repeater.empty.label' ) } }
217
+ </td >
187
218
</tr >
188
- @endforeach
189
- @else
190
- <tr class =" table-repeater-row table-repeater-empty-row" >
191
- <td colspan =" {{ count ($headers ) + intval ($hasActions ) } }"
192
- class =" table-repeater-column table-repeater-empty-column p-4 w-px text-center italic" >
193
- {{ $emptyLabel ?: trans (' table-repeater::components.repeater.empty.label' ) } }
194
- </td >
195
- </tr >
196
- @endif
219
+ @endif
197
220
</tbody >
198
221
</table >
199
222
</div >
@@ -209,7 +232,7 @@ class="table-repeater-column table-repeater-empty-column p-4 w-px text-center it
209
232
@if (filled ($visibleExtraActions ) )
210
233
@foreach ($visibleExtraActions as $extraAction )
211
234
<li >
212
- {{ ( $extraAction ) } }
235
+ {{ $extraAction } }
213
236
</li >
214
237
@endforeach
215
238
@endif
0 commit comments