dcasia / conditional-container

Provides an easy way to conditionally show and hide fields in your Nova resources.
MIT License
115 stars 37 forks source link

TypeError: this.field.expressionsMap is undefined #54

Closed rela589n closed 3 years ago

rela589n commented 3 years ago

I have nova version 3.16.3 and this package 1.2.2, but that doesn't seem to be working:

In my fields list:

use Benjacho\BelongsToManyField\BelongsToManyField;
use DigitalCreative\ConditionalContainer\ConditionalContainer;

ConditionalContainer::make(
                [
                    BelongsToManyField::make('Відділення', 'departments', Department::class),
                ]
            )->if('patronymic = "teacher"'),
TypeError: this.field.expressionsMap is undefined
    watchableAttributes http://localhost:8077/nova-api/scripts/conditional-container:1
    get http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    evaluate http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    yn http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    registerDependencyWatchers http://localhost:8077/nova-api/scripts/conditional-container:1
    deepSearch http://localhost:8077/nova-api/scripts/conditional-container:1
    deepSearch http://localhost:8077/nova-api/scripts/conditional-container:1
    deepSearch http://localhost:8077/nova-api/scripts/conditional-container:1
    deepSearch http://localhost:8077/nova-api/scripts/conditional-container:1
    deepSearch http://localhost:8077/nova-api/scripts/conditional-container:1
    mounted http://localhost:8077/nova-api/scripts/conditional-container:1
    It http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    en http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    insert http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    x http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    Ii http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    _update http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    mount http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    get http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    run http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    fn http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    ee http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    Gt http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    promise callback*Ut http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    ee http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    update http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    update http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    notify http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    set http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    set http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    e http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    x http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    _invoke http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    t http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    o http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    o http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    promise callback*o http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    default http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    t http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    default http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    getFields http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    e http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    x http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    _invoke http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    t http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    o http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    default http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    t http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    default http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    created http://localhost:8077/vendor/nova/app.js?id=ceb1f62e6f9ca43eed65:1
    It http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    en http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    _init http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    a http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    componentInstance http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    init http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    n http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    d http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    d http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    Ii http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    _update http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    mount http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    get http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    run http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
    fn http://localhost:8077/vendor/nova/vendor.js?id=3810bf2033e3670b2acc:1
milewski commented 3 years ago

It's likely that you have forgotten to include the trait:

use HasConditionalContainer; // Important!!