Skip to content

Commit 4de95b5

Browse files
committed
Merge branch '4.x' into 5.x
2 parents fa22094 + 2f47433 commit 4de95b5

13 files changed

Lines changed: 276 additions & 31 deletions

File tree

.github/workflows/format-and-build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
- name: Checkout code
2323
# Uses a maintainer PAT so the auto-commit push can bypass branch protection;
2424
# the default GITHUB_TOKEN pushes as `github-actions[bot]` and gets rejected.
25-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 # zizmor: ignore[artipacked]
25+
# zizmor: ignore[artipacked]
26+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2627
with:
2728
token: ${{ secrets.GH_ACCESS_TOKEN || github.token }}
2829
- name: Cache Composer package downloads

.github/workflows/sync-docs.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
# persist-credentials: true is required so the final `git push` to
1717
# filamentphp/mintlify-docs uses the GH_ACCESS_TOKEN written into
1818
# docs/.git/config. Subsequent steps in this job are maintainer-controlled.
19-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 # zizmor: ignore[artipacked]
19+
# zizmor: ignore[artipacked]
20+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2021
with:
2122
repository: filamentphp/mintlify-docs
2223
token: ${{ secrets.GH_ACCESS_TOKEN }}
@@ -27,7 +28,8 @@ jobs:
2728
# (read-only against the docs repo's working tree) and then pushes to a separate
2829
# repo via PAT. No cache contents reach a release-distributed artifact, so the
2930
# cache-poisoning vector zizmor flags doesn't apply.
30-
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # zizmor: ignore[cache-poisoning]
31+
# zizmor: ignore[cache-poisoning]
32+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
3133
with:
3234
node-version: '20'
3335

packages/actions/resources/lang/ar/delete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
'deleted_partial' => [
5858
'title' => 'تم حذف :count من :total',
5959
'missing_authorization_failure_message' => 'ليس لديك إذن لحذف :count.',
60-
'missing_processing_failure_message' => ':count لم يتم حذفه.',
60+
'missing_processing_failure_message' => 'تعذر حذف :count.',
6161
],
6262

6363
'deleted_none' => [

packages/actions/resources/lang/ar/export.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
'max_rows' => [
7676
'title' => 'التصدير كبير جداً',
77-
'body' => 'لا يمكنك تصدير أكثر من صف واحد في المرة الواحدة.|لا يمكنك تصدير أكثر من :count صف في المرة الواحدة.',
77+
'body' => '{1} لا يمكنك تصدير أكثر من صف واحد في المرة الواحدة.|{2} لا يمكنك تصدير أكثر من صفين في المرة الواحدة|[3,10] لا يمكنك تصدير أكثر من :count صفوف في المرة الواحدة|[11,*] لا يمكنك تصدير أكثر من :count صفاً في المرة الواحدة',
7878
],
7979

8080
'no_columns' => [
@@ -84,7 +84,7 @@
8484

8585
'started' => [
8686
'title' => 'بدأ التصدير',
87-
'body' => 'بدأ التصدير الخاص بك وسيتم معالجة صف واحد في الخلفية. ستتلقى إشعاراً برابط التنزيل عند الانتهاء.|بدأ التصدير الخاص بك وسيتم معالجة :count صف في الخلفية. ستتلقى إشعاراً برابط التنزيل عند الانتهاء.',
87+
'body' => '{1} بدأ التصدير الخاص بك وسيتم معالجة صف واحد في الخلفية. ستتلقى إشعاراً برابط التنزيل عند الانتهاء.|{2} بدأ التصدير الخاص بك وسيتم معالجة صفين في الخلفية. ستتلقى إشعاراً برابط التنزيل عند الانتهاء|[3,10] بدأ التصدير الخاص بك وسيتم معالجة :count صفوف في الخلفية. ستتلقى إشعاراً برابط التنزيل عند الانتهاء|[11,*] بدأ التصدير الخاص بك وسيتم معالجة :count صفاً في الخلفية. ستتلقى إشعاراً برابط التنزيل عند الانتهاء',
8888
],
8989

9090
],

packages/actions/resources/lang/ar/import.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
'actions' => [
4949

5050
'download_failed_rows_csv' => [
51-
'label' => 'تنزيل معلومات حول الصف الفاشل|تنزيل معلومات حول الصفوف الفاشلة',
51+
'label' => '{1} تنزيل معلومات حول الصف الفاشل|{2} تنزيل معلومات حول الصفين الفاشلين|[3,*] تنزيل معلومات حول الصفوف الفاشلة',
5252
],
5353

5454
],
@@ -57,12 +57,12 @@
5757

5858
'max_rows' => [
5959
'title' => 'ملف CSV الذي تم تحميله كبير جدًا',
60-
'body' => 'لا تستطيع استيراد أكثر من صف واحد في كل مرة.|لا تستطيع استيراد أكثر من :count صف في كل مرة.',
60+
'body' => '{1} لا يمكنك استيراد أكثر من صف واحد في كل مرة.|{2} لا يمكنك استيراد أكثر من صفين في كل مرة.|[3,10] لا يمكنك استيراد أكثر من :count صفوف في كل مرة.|[11,*] لا يمكنك استيراد أكثر من :count صفاً في كل مرة.',
6161
],
6262

6363
'started' => [
6464
'title' => 'بدء الاستيراد',
65-
'body' => 'بدأت عملية الاستيراد الخاصة بك وستتم معالجة صف واحد في الخلفية.|بدأت عملية الاستيراد الخاصة بك وستتم معالجة :count صفوف في الخلفية.',
65+
'body' => '{1} بدأت عملية الاستيراد الخاصة بك وستتم معالجة صف واحد في الخلفية.|{2} بدأت عملية الاستيراد الخاصة بك وستتم معالجة صفين في الخلفية.|[3,10] بدأت عملية الاستيراد الخاصة بك وستتم معالجة :count صفوف في الخلفية.|[11,*] بدأت عملية الاستيراد الخاصة بك وستتم معالجة :count صفاً في الخلفية.',
6666
],
6767

6868
],

packages/support/resources/lang/ar/components/pagination.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
'label' => 'التنقل بين الصفحات',
66

7-
'overview' => '{1} عرض نتيجة واحدة|[3,10] عرض :first إلى :last من :total نتائج|[2,*] عرض :first إلى :last من :total نتيجة',
7+
'overview' => '{1} عرض نتيجة واحدة|{2} عرض :first إلى :last من نتيجتين|[3,10] عرض :first إلى :last من :total نتائج|[11,*] عرض :first إلى :last من :total نتيجة',
88

99
'fields' => [
1010

packages/tables/resources/lang/ar/table.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414

1515
'reset' => [
16-
'label' => 'إعادة ضبط التصفيات',
16+
'label' => 'إعادة تعيين',
1717
],
1818

1919
],
@@ -28,15 +28,15 @@
2828

2929
'select' => [
3030

31-
'loading_message' => 'جاري التحميل...',
31+
'loading_message' => 'جارٍ التحميل...',
3232

3333
'no_options_message' => 'لا توجد خيارات متاحة.',
3434

3535
'no_search_results_message' => 'لا توجد خيارات مطابقة لبحثك.',
3636

3737
'placeholder' => 'اختر',
3838

39-
'searching_message' => 'جاري البحث...',
39+
'searching_message' => 'جارٍ البحث...',
4040

4141
'search_prompt' => 'ابدأ الكتابة للبحث...',
4242

@@ -206,7 +206,7 @@
206206

207207
'direction' => [
208208

209-
'label' => 'إتجاه التجميع',
209+
'label' => 'اتجاه التجميع',
210210

211211
'options' => [
212212
'asc' => 'تصاعدي',
@@ -223,7 +223,7 @@
223223

224224
'selection_indicator' => [
225225

226-
'selected_count' => '{1} تم تحديد سجل واحد|[3,10] تم تحديد :count سجلات |[2,*] تم تحديد :count سجل',
226+
'selected_count' => '{1} تم تحديد سجل واحد|{2} تم تحديد سجلين|[3,10] تم تحديد :count سجلات|[11,*] تم تحديد :count سجل',
227227

228228
'actions' => [
229229

packages/tables/resources/lang/uk/table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
'actions' => [
226226

227227
'select_all' => [
228-
'label' => 'Обрати все :count',
228+
'label' => 'Обрати всі :count',
229229
],
230230

231231
'deselect_all' => [

packages/tables/resources/views/index.blade.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,7 @@ class="fi-ta-sorting-settings"
10121012
$recordGroupKey = $group?->getStringKey($record);
10131013
$recordGroupTitle = $group?->getTitle($record);
10141014
$isRecordGroupCollapsible = $group?->isCollapsible();
1015+
$recordIsSelectable = $isSelectionEnabled && $isRecordSelectable($record);
10151016
10161017
$collapsibleColumnsLayout?->record($record)->recordKey($recordKey);
10171018
$hasCollapsibleColumnsLayout = (bool) $collapsibleColumnsLayout?->isVisible();
@@ -1165,17 +1166,17 @@ class="fi-icon-btn fi-size-sm"
11651166
@class([
11661167
'fi-ta-record',
11671168
'fi-clickable' => $recordUrl || $recordAction,
1168-
'fi-ta-record-with-content-prefix' => $isReordering || ($isSelectionEnabled && $isRecordSelectable($record)),
1169+
'fi-ta-record-with-content-prefix' => $isReordering || $recordIsSelectable,
11691170
'fi-ta-record-with-content-suffix' => $hasCollapsibleColumnsLayout && (! $isReordering),
11701171
...$getRecordClasses($record),
11711172
])
11721173
x-bind:class="{
11731174
{{ $group?->isCollapsible() ? '\'fi-collapsed\': isGroupCollapsed(' . \Illuminate\Support\Js::from($recordGroupTitle) . '),' : '' }}
1174-
'fi-selected': isRecordSelected(@js($recordKey)),
1175+
'fi-selected': @js($recordIsSelectable) && isRecordSelected(@js($recordKey)),
11751176
}"
11761177
>
11771178
@php
1178-
$hasItemBeforeRecordContent = $isReordering || ($isSelectionEnabled && $isRecordSelectable($record));
1179+
$hasItemBeforeRecordContent = $isReordering || $recordIsSelectable;
11791180
$hasItemAfterRecordContent = $hasCollapsibleColumnsLayout && (! $isReordering);
11801181
@endphp
11811182

@@ -1186,7 +1187,7 @@ class="fi-ta-reorder-handle fi-icon-btn"
11861187
>
11871188
{{ \Filament\Support\generate_icon_html(\Filament\Support\Icons\Heroicon::Bars2, alias: \Filament\Tables\View\TablesIconAlias::REORDER_HANDLE) }}
11881189
</button>
1189-
@elseif ($isSelectionEnabled && $isRecordSelectable($record))
1190+
@elseif ($recordIsSelectable)
11901191
<input
11911192
aria-label="{{ __('filament-tables::table.fields.bulk_select_record.label', ['key' => $recordKey]) }}"
11921193
type="checkbox"
@@ -1915,6 +1916,7 @@ class="fi-ta-row fi-ta-row-not-reorderable"
19151916
$openRecordUrlInNewTab = $shouldOpenRecordUrlInNewTab($record);
19161917
$recordGroupKey = $group?->getStringKey($record);
19171918
$recordGroupTitle = $group?->getTitle($record);
1919+
$recordIsSelectable = $isSelectionEnabled && $isRecordSelectable($record);
19181920
19191921
$recordActions = array_reduce(
19201922
$defaultRecordActions,
@@ -2130,7 +2132,7 @@ class="fi-ta-group-checkbox fi-checkbox-input"
21302132
{!! $isReordering ? 'x-sortable-item="' . e($recordKey) . '"' : null !!}
21312133
x-bind:class="{
21322134
{{ $group?->isCollapsible() ? '\'fi-collapsed\': isGroupCollapsed(' . \Illuminate\Support\Js::from($recordGroupTitle) . '),' : '' }}
2133-
'fi-selected': isRecordSelected(@js($recordKey)),
2135+
'fi-selected': @js($recordIsSelectable) && isRecordSelected(@js($recordKey)),
21342136
}"
21352137
@class([
21362138
'fi-ta-row',
@@ -2175,7 +2177,7 @@ class="fi-ta-reorder-handle fi-icon-btn"
21752177
<td
21762178
class="fi-ta-cell fi-ta-selection-cell"
21772179
>
2178-
@if ($isRecordSelectable($record))
2180+
@if ($recordIsSelectable)
21792181
<input
21802182
aria-label="{{ __('filament-tables::table.fields.bulk_select_record.label', ['key' => $recordKey]) }}"
21812183
type="checkbox"
@@ -2311,7 +2313,7 @@ class="fi-ta-record-checkbox fi-checkbox-input"
23112313
<td
23122314
class="fi-ta-cell fi-ta-selection-cell"
23132315
>
2314-
@if ($isRecordSelectable($record))
2316+
@if ($recordIsSelectable)
23152317
<input
23162318
aria-label="{{ __('filament-tables::table.fields.bulk_select_record.label', ['key' => $recordKey]) }}"
23172319
type="checkbox"

packages/tables/src/Concerns/HasBulkActions.php

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ public function getSelectedTableRecords(bool $shouldFetchSelectedRecords = true,
252252
]) :
253253
($this->isTrackingDeselectedTableRecords ? $this->getTableRecords()->except($this->deselectedTableRecords) : $this->getTableRecords()->only($this->selectedTableRecords));
254254

255+
if ($table->checksIfRecordIsSelectable()) {
256+
$resolvedSelectedRecords = $resolvedSelectedRecords->filter(
257+
fn (Model | array $record): bool => $table->isRecordSelectable($record)
258+
);
259+
}
260+
255261
$maxSelectableRecords = $table->getMaxSelectableRecords();
256262

257263
if ($maxSelectableRecords && ($resolvedSelectedRecords->count() > $maxSelectableRecords)) {
@@ -270,15 +276,21 @@ public function getSelectedTableRecords(bool $shouldFetchSelectedRecords = true,
270276
if ($chunkSize && $table->getRelationship() instanceof BelongsToMany && ! $table->allowsDuplicates()) {
271277
$invadedRelationship = invade($table->getRelationship());
272278

273-
return $this->cachedSelectedTableRecords = $query->lazyById($chunkSize)
279+
$resolvedSelectedRecords = $query->lazyById($chunkSize)
274280
->tapEach(fn (Model $record) => $invadedRelationship->hydratePivotRelation([$record]));
281+
} elseif ($chunkSize) {
282+
$resolvedSelectedRecords = $query->lazyById($chunkSize);
283+
} else {
284+
$resolvedSelectedRecords = $this->hydratePivotRelationForTableRecords($query->get());
275285
}
276286

277-
if ($chunkSize) {
278-
return $this->cachedSelectedTableRecords = $query->lazyById($chunkSize);
287+
if ($table->checksIfRecordIsSelectable()) {
288+
$resolvedSelectedRecords = $resolvedSelectedRecords->filter(
289+
fn (Model | array $record): bool => $table->isRecordSelectable($record)
290+
);
279291
}
280292

281-
return $this->cachedSelectedTableRecords = $this->hydratePivotRelationForTableRecords($query->get());
293+
return $this->cachedSelectedTableRecords = $resolvedSelectedRecords;
282294
}
283295

284296
public function getSelectedTableRecordsQuery(bool $shouldFetchSelectedRecords = true, ?int $chunkSize = null): Builder
@@ -312,6 +324,10 @@ public function getSelectedTableRecordsQuery(bool $shouldFetchSelectedRecords =
312324
$this->filterTableQuery($query);
313325
}
314326

327+
if (! $shouldFetchSelectedRecords) {
328+
$this->constrainQueryToSelectableTableRecords($query);
329+
}
330+
315331
return $query;
316332
}
317333

@@ -346,9 +362,32 @@ public function getSelectedTableRecordsQuery(bool $shouldFetchSelectedRecords =
346362
$this->applySortingToTableQuery($query);
347363
}
348364

365+
if (! $shouldFetchSelectedRecords) {
366+
$this->constrainQueryToSelectableTableRecords($query);
367+
}
368+
349369
return $query;
350370
}
351371

372+
protected function constrainQueryToSelectableTableRecords(Builder $query): void
373+
{
374+
$table = $this->getTable();
375+
376+
if (! $table->checksIfRecordIsSelectable()) {
377+
return;
378+
}
379+
380+
$selectableKeys = [];
381+
382+
(clone $query)->lazyById()->each(function (Model $record) use (&$selectableKeys, $table): void {
383+
if ($table->isRecordSelectable($record)) {
384+
$selectableKeys[] = $record->getKey();
385+
}
386+
});
387+
388+
$query->whereKey($selectableKeys);
389+
}
390+
352391
/**
353392
* @deprecated Override the `table()` method to configure the table.
354393
*/

0 commit comments

Comments
 (0)