@@ -33,7 +33,8 @@ public static function make(?string $fieldType = null): array
3333 ->preload ()
3434 ->options ($ validationOptions )
3535 ->reactive ()
36- ->required (),
36+ ->required ()
37+ ->columnSpanFull (),
3738 TextInput::make ('parameters.value ' )
3839 ->label (__ ('Value ' ))
3940 ->required (fn (Get $ get ): bool => in_array ($ get ('type ' ), ['min ' , 'max ' , 'min_length ' , 'max_length ' , 'decimal ' , 'multiple_of ' , 'prohibited_if ' , 'prohibited_unless ' , 'required_if ' , 'required_unless ' ]))
@@ -69,6 +70,36 @@ public static function make(?string $fieldType = null): array
6970
7071 return FieldOptionsHelper::getFieldOptions ($ livewire , $ excludeUlid );
7172 })
73+ ->disabled (function ($ livewire ) {
74+ $ excludeUlid = null ;
75+ if (method_exists ($ livewire , 'getMountedTableActionRecord ' )) {
76+ $ record = $ livewire ->getMountedTableActionRecord ();
77+ if ($ record && isset ($ record ->ulid )) {
78+ $ excludeUlid = $ record ->ulid ;
79+ }
80+ }
81+
82+ $ options = FieldOptionsHelper::getFieldOptions ($ livewire , $ excludeUlid );
83+
84+ return empty ($ options );
85+ })
86+ ->helperText (function ($ livewire ) {
87+ $ excludeUlid = null ;
88+ if (method_exists ($ livewire , 'getMountedTableActionRecord ' )) {
89+ $ record = $ livewire ->getMountedTableActionRecord ();
90+ if ($ record && isset ($ record ->ulid )) {
91+ $ excludeUlid = $ record ->ulid ;
92+ }
93+ }
94+
95+ $ options = FieldOptionsHelper::getFieldOptions ($ livewire , $ excludeUlid );
96+
97+ if (empty ($ options )) {
98+ return __ ('No other fields available to depend on. Please create other fields first. ' );
99+ }
100+
101+ return null ;
102+ })
72103 ->visible (fn (Get $ get ): bool => in_array ($ get ('type ' ), ['different ' , 'same ' , 'prohibited_if ' , 'prohibited_unless ' , 'prohibits ' , 'required_if ' , 'required_unless ' , 'required_if_accepted ' , 'greater_than ' , 'greater_than_or_equal ' , 'less_than ' , 'less_than_or_equal ' ])),
73104 Select::make ('parameters.fields ' )
74105 ->label (__ ('Field names ' ))
@@ -87,6 +118,36 @@ public static function make(?string $fieldType = null): array
87118
88119 return FieldOptionsHelper::getFieldOptions ($ livewire , $ excludeUlid );
89120 })
121+ ->disabled (function ($ livewire ) {
122+ $ excludeUlid = null ;
123+ if (method_exists ($ livewire , 'getMountedTableActionRecord ' )) {
124+ $ record = $ livewire ->getMountedTableActionRecord ();
125+ if ($ record && isset ($ record ->ulid )) {
126+ $ excludeUlid = $ record ->ulid ;
127+ }
128+ }
129+
130+ $ options = FieldOptionsHelper::getFieldOptions ($ livewire , $ excludeUlid );
131+
132+ return empty ($ options );
133+ })
134+ ->helperText (function ($ livewire ) {
135+ $ excludeUlid = null ;
136+ if (method_exists ($ livewire , 'getMountedTableActionRecord ' )) {
137+ $ record = $ livewire ->getMountedTableActionRecord ();
138+ if ($ record && isset ($ record ->ulid )) {
139+ $ excludeUlid = $ record ->ulid ;
140+ }
141+ }
142+
143+ $ options = FieldOptionsHelper::getFieldOptions ($ livewire , $ excludeUlid );
144+
145+ if (empty ($ options )) {
146+ return __ ('No other fields available to depend on. Please create other fields first. ' );
147+ }
148+
149+ return null ;
150+ })
90151 ->visible (fn (Get $ get ): bool => in_array ($ get ('type ' ), ['required_with ' , 'required_with_all ' , 'required_without ' , 'required_without_all ' ])),
91152 TextInput::make ('parameters.date ' )
92153 ->label (__ ('Date ' ))
0 commit comments