Skip to content

Commit 0436de9

Browse files
committedApr 15, 2025·
5.5.3
1 parent 8b9cc69 commit 0436de9

File tree

10 files changed

+98
-58
lines changed

10 files changed

+98
-58
lines changed
 

‎composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,5 @@
170170
},
171171
"minimum-stability": "dev",
172172
"prefer-stable": true,
173-
"version": "5.5.2"
173+
"version": "5.5.3"
174174
}

‎package-lock.json

+25-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@floating-ui/vue": "^1.1.6",
4242
"@headlessui/vue": "^1.7.23",
4343
"@heroicons/vue": "^2.2.0",
44-
"@inertiajs/vue3": "^2.0.7",
44+
"@inertiajs/vue3": "^2.0.8",
4545
"@popperjs/core": "^2.11.8",
4646
"@vue/compat": "^3.5.13",
4747
"@vueuse/core": "^10.11.1",

‎public/app.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎public/mix-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=e185a578441e1252fba67ff67fa4d2eb",
2+
"/app.js": "/app.js?id=2ed44de0138d16238ba20f9944de40af",
33
"/ui.js": "/ui.js?id=592866a715b1c20b43fff6ca7980b279",
44
"/manifest.js": "/manifest.js?id=3267e5c99fd7b729e2f38ec55b50397d",
55
"/app.css": "/app.css?id=4ac240e9b4c482451bf95d4161751414",

‎resources/js/fields/Detail/BooleanGroupField.vue

+12-9
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,26 @@ export default {
3232
created() {
3333
this.field.value = this.field.value || {}
3434
35-
this.value = this.field.options
36-
.filter(o => {
37-
if (this.field.hideFalseValues === true && o.checked === false) {
38-
return false
39-
} else if (this.field.hideTrueValues === true && o.checked === true) {
40-
return false
41-
}
35+
const hideTrueValues = this.field.hideTrueValues
36+
const hideFalseValues = this.field.hideFalseValues
4237
43-
return true
44-
})
38+
this.value = this.field.options
4539
.map(o => {
4640
return {
4741
name: o.name,
4842
label: o.label,
4943
checked: this.field.value[o.name] || false,
5044
}
5145
})
46+
.filter(o => {
47+
if (hideFalseValues === true && o.checked === false) {
48+
return false
49+
} else if (hideTrueValues === true && o.checked === true) {
50+
return false
51+
}
52+
53+
return true
54+
})
5255
},
5356
}
5457
</script>

‎resources/js/fields/Index/BooleanGroupField.vue

+13-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</ul>
2121
<span
2222
v-else
23-
class="max-w-xxs space-2 py-3 px-4 rounded-full text-sm leading-tight"
23+
class="block max-w-xxs space-2 my-3 mx-4 rounded-full text-sm leading-tight"
2424
>
2525
{{ field.noValueText }}
2626
</span>
@@ -51,23 +51,26 @@ export default {
5151
created() {
5252
this.field.value = this.field.value || {}
5353
54-
this.value = this.field.options
55-
.filter(o => {
56-
if (this.field.hideFalseValues === true && o.checked === false) {
57-
return false
58-
} else if (this.field.hideTrueValues === true && o.checked === true) {
59-
return false
60-
}
54+
const hideTrueValues = this.field.hideTrueValues
55+
const hideFalseValues = this.field.hideFalseValues
6156
62-
return true
63-
})
57+
this.value = this.field.options
6458
.map(o => {
6559
return {
6660
name: o.name,
6761
label: o.label,
6862
checked: this.field.value[o.name] || false,
6963
}
7064
})
65+
.filter(o => {
66+
if (hideFalseValues === true && o.checked === false) {
67+
return false
68+
} else if (hideTrueValues === true && o.checked === true) {
69+
return false
70+
}
71+
72+
return true
73+
})
7174
},
7275
}
7376
</script>

‎resources/js/nova.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export default class Nova {
228228
const page =
229229
this.pages[name] != null
230230
? this.pages[name]
231-
: require('@/pages/Error404').default
231+
: require('@/pages/Loading').default
232232

233233
page.layout = page.layout || Layout
234234

‎resources/js/pages/Loading.vue

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<template>
2+
<LoadingView />
3+
</template>
4+
5+
<script setup>
6+
import Guest from '@/layouts/Guest'
7+
8+
defineOptions({
9+
name: 'AppLoadingPage',
10+
layout: Guest,
11+
})
12+
</script>

‎src/Fields/BooleanGroup.php

+31-10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Laravel\Nova\Fields;
44

5+
use Closure;
56
use Illuminate\Support\Arr;
67
use Laravel\Nova\Contracts\FilterableField;
78
use Laravel\Nova\Fields\Filters\BooleanGroupFilter;
@@ -10,6 +11,11 @@
1011
use Laravel\Nova\Util;
1112
use Stringable;
1213

14+
/**
15+
* @phpstan-type TOptionLabel \Stringable|string
16+
* @phpstan-type TOptionValue string
17+
* @phpstan-type TOption iterable<TOptionValue|int, TOptionLabel>
18+
*/
1319
class BooleanGroup extends Field implements FilterableField
1420
{
1521
use FieldFilterable;
@@ -37,11 +43,13 @@ class BooleanGroup extends Field implements FilterableField
3743
public $noValueText = 'No Data';
3844

3945
/**
40-
* The options for the field.
46+
* The field's options callback.
4147
*
42-
* @var array|null
48+
* @var iterable<string|int, string>|callable|null
49+
*
50+
* @phpstan-var TOption|(callable(): (TOption))|null
4351
*/
44-
public $options = null;
52+
public $optionsCallback;
4553

4654
/**
4755
* Determine false values should be hidden.
@@ -65,11 +73,26 @@ class BooleanGroup extends Field implements FilterableField
6573
*/
6674
public function options(callable|iterable $options)
6775
{
68-
if (Util::isSafeCallable($options)) {
69-
$options = \call_user_func($options);
70-
}
76+
$this->optionsCallback = $options;
7177

72-
$this->options = with(collect($options), static function ($options) {
78+
return $this;
79+
}
80+
81+
/**
82+
* Serialize options for the field.
83+
*
84+
* @return array<int, array<string, mixed>>
85+
*
86+
* @phpstan-return array<int, array{label: string, value: string}>
87+
*/
88+
protected function serializeOptions(): array
89+
{
90+
/** @var TOption $options */
91+
$options = ! Util::isSafeCallable($this->optionsCallback) && ! $this->optionsCallback instanceof Closure
92+
? value($this->optionsCallback)
93+
: \call_user_func($this->optionsCallback);
94+
95+
return with(collect($options), static function ($options) {
7396
$isList = array_is_list($options->all());
7497

7598
return $options->map(static function ($label, $name) use ($isList) {
@@ -78,8 +101,6 @@ public function options(callable|iterable $options)
78101
: ['label' => $label, 'name' => $label];
79102
})->values()->all();
80103
});
81-
82-
return $this;
83104
}
84105

85106
/**
@@ -188,7 +209,7 @@ public function jsonSerialize(): array
188209
return array_merge(parent::jsonSerialize(), [
189210
'hideTrueValues' => $this->hideTrueValues,
190211
'hideFalseValues' => $this->hideFalseValues,
191-
'options' => $this->options,
212+
'options' => $this->serializeOptions(),
192213
'noValueText' => Nova::__($this->noValueText),
193214
]);
194215
}

0 commit comments

Comments
 (0)
Please sign in to comment.