outl1ne / nova-color-field

A Laravel Nova package that adds a color picker to Nova's arsenal of fields.
MIT License
25 stars 13 forks source link

DependsOn does not work #13

Closed holubar closed 2 years ago

holubar commented 2 years ago

I cannot seem to get it working under Nova 4. Is it supported? I could really use it in my project.

KasparRosin commented 2 years ago

We should have dependsOn support, though I haven't used it myself yet. Can you share your fields setup.

holubar commented 2 years ago

This is how I try to use it. Result is, that it's always hidden. This works on all standard Nova fields, only Color is always hidden.

Color::make(__('app.background').' - '.__('app.color'), 'properties->section_background_color_code') ->compact() ->palette(Helpers::tailwind_color_array('simple')) ->hideFromIndex() ->help(color_palette_link()) ->dependsOn('type', function (Color $field, NovaRequest $request, FormData $formData) { if (!PageContent::display_heading_first_line_options($formData->type)) { $field->hide(); } })

Thank you for help

holubar commented 2 years ago

Is there any way to achieve showing/hiding color fields? Should I use your dependency container package?

Tarpsvo commented 2 years ago

Version 2.0.2 ships with improved dependsOn support. Can you try again? Thanks!

holubar commented 2 years ago

works :)

nieto19 commented 3 weeks ago

Is there a way to change the color value when using depends on?