diff --git a/composer.lock b/composer.lock index f87b58e5..7eddb12d 100644 --- a/composer.lock +++ b/composer.lock @@ -1554,7 +1554,7 @@ }, { "name": "filament/actions", - "version": "v3.1.36", + "version": "v3.1.42", "source": { "type": "git", "url": "https://github.com/filamentphp/actions.git", @@ -1605,16 +1605,16 @@ }, { "name": "filament/filament", - "version": "v3.1.36", + "version": "v3.1.42", "source": { "type": "git", "url": "https://github.com/filamentphp/panels.git", - "reference": "04a7b41e1ac425a931b5ea5672fd394e2d80aa74" + "reference": "a9da0c924682caa307f4e76e38ac9956ccb5ed4a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/panels/zipball/04a7b41e1ac425a931b5ea5672fd394e2d80aa74", - "reference": "04a7b41e1ac425a931b5ea5672fd394e2d80aa74", + "url": "https://api.github.com/repos/filamentphp/panels/zipball/a9da0c924682caa307f4e76e38ac9956ccb5ed4a", + "reference": "a9da0c924682caa307f4e76e38ac9956ccb5ed4a", "shasum": "" }, "require": { @@ -1666,20 +1666,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-01-08T12:59:20+00:00" + "time": "2024-01-09T17:55:06+00:00" }, { "name": "filament/forms", - "version": "v3.1.36", + "version": "v3.1.42", "source": { "type": "git", "url": "https://github.com/filamentphp/forms.git", - "reference": "dd9a44cff7bf647fff4faea3de4bd2166243a138" + "reference": "3eb61456e21a76094b5f7051c50f4ef0fcf72182" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/forms/zipball/dd9a44cff7bf647fff4faea3de4bd2166243a138", - "reference": "dd9a44cff7bf647fff4faea3de4bd2166243a138", + "url": "https://api.github.com/repos/filamentphp/forms/zipball/3eb61456e21a76094b5f7051c50f4ef0fcf72182", + "reference": "3eb61456e21a76094b5f7051c50f4ef0fcf72182", "shasum": "" }, "require": { @@ -1722,11 +1722,11 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-01-08T12:59:14+00:00" + "time": "2024-01-09T11:54:23+00:00" }, { "name": "filament/infolists", - "version": "v3.1.36", + "version": "v3.1.42", "source": { "type": "git", "url": "https://github.com/filamentphp/infolists.git", @@ -1777,7 +1777,7 @@ }, { "name": "filament/notifications", - "version": "v3.1.36", + "version": "v3.1.42", "source": { "type": "git", "url": "https://github.com/filamentphp/notifications.git", @@ -1829,7 +1829,7 @@ }, { "name": "filament/spatie-laravel-translatable-plugin", - "version": "v3.1.36", + "version": "v3.1.42", "source": { "type": "git", "url": "https://github.com/filamentphp/spatie-laravel-translatable-plugin.git", @@ -1874,7 +1874,7 @@ }, { "name": "filament/support", - "version": "v3.1.36", + "version": "v3.1.42", "source": { "type": "git", "url": "https://github.com/filamentphp/support.git", @@ -1931,7 +1931,7 @@ }, { "name": "filament/tables", - "version": "v3.1.36", + "version": "v3.1.42", "source": { "type": "git", "url": "https://github.com/filamentphp/tables.git", @@ -1984,7 +1984,7 @@ }, { "name": "filament/widgets", - "version": "v3.1.36", + "version": "v3.1.42", "source": { "type": "git", "url": "https://github.com/filamentphp/widgets.git", @@ -2525,16 +2525,16 @@ }, { "name": "lara-zeus/core", - "version": "v3.1.0", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/lara-zeus/core.git", - "reference": "b9a4f3e491e7662c413a6d22672c231e356261bb" + "reference": "6ca96b96b50449657613c6123ca164ad9e935b1c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lara-zeus/core/zipball/b9a4f3e491e7662c413a6d22672c231e356261bb", - "reference": "b9a4f3e491e7662c413a6d22672c231e356261bb", + "url": "https://api.github.com/repos/lara-zeus/core/zipball/6ca96b96b50449657613c6123ca164ad9e935b1c", + "reference": "6ca96b96b50449657613c6123ca164ad9e935b1c", "shasum": "" }, "require": { @@ -2608,20 +2608,20 @@ "type": "github" } ], - "time": "2024-01-08T19:26:14+00:00" + "time": "2024-01-09T03:41:53+00:00" }, { "name": "laravel/framework", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "114926b07bfb5fbf2545c03aa2ce5c8c37be650c" + "reference": "7a9470071dac9579ebf29ad1b9d73e4b8eb586fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/114926b07bfb5fbf2545c03aa2ce5c8c37be650c", - "reference": "114926b07bfb5fbf2545c03aa2ce5c8c37be650c", + "url": "https://api.github.com/repos/laravel/framework/zipball/7a9470071dac9579ebf29ad1b9d73e4b8eb586fc", + "reference": "7a9470071dac9579ebf29ad1b9d73e4b8eb586fc", "shasum": "" }, "require": { @@ -2813,20 +2813,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-12-27T14:26:28+00:00" + "time": "2024-01-09T11:46:47+00:00" }, { "name": "laravel/prompts", - "version": "v0.1.14", + "version": "v0.1.15", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "2219fa9c4b944add1e825c3bdb8ecae8bc503bc6" + "reference": "d814a27514d99b03c85aa42b22cfd946568636c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/2219fa9c4b944add1e825c3bdb8ecae8bc503bc6", - "reference": "2219fa9c4b944add1e825c3bdb8ecae8bc503bc6", + "url": "https://api.github.com/repos/laravel/prompts/zipball/d814a27514d99b03c85aa42b22cfd946568636c1", + "reference": "d814a27514d99b03c85aa42b22cfd946568636c1", "shasum": "" }, "require": { @@ -2868,9 +2868,9 @@ ], "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.14" + "source": "https://github.com/laravel/prompts/tree/v0.1.15" }, - "time": "2023-12-27T04:18:09+00:00" + "time": "2023-12-29T22:37:42+00:00" }, { "name": "laravel/serializable-closure", @@ -4173,16 +4173,16 @@ }, { "name": "openspout/openspout", - "version": "v4.22.0", + "version": "v4.23.0", "source": { "type": "git", "url": "https://github.com/openspout/openspout.git", - "reference": "ad3dd535cf01623551da401fe170355f56f4f929" + "reference": "28f6a0e45acc3377f34c26cc3866e21f0447e0c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/openspout/openspout/zipball/ad3dd535cf01623551da401fe170355f56f4f929", - "reference": "ad3dd535cf01623551da401fe170355f56f4f929", + "url": "https://api.github.com/repos/openspout/openspout/zipball/28f6a0e45acc3377f34c26cc3866e21f0447e0c8", + "reference": "28f6a0e45acc3377f34c26cc3866e21f0447e0c8", "shasum": "" }, "require": { @@ -4196,13 +4196,13 @@ }, "require-dev": { "ext-zlib": "*", - "friendsofphp/php-cs-fixer": "^3.39.0", - "infection/infection": "^0.27.8", - "phpbench/phpbench": "^1.2.14", - "phpstan/phpstan": "^1.10.44", + "friendsofphp/php-cs-fixer": "^3.46.0", + "infection/infection": "^0.27.9", + "phpbench/phpbench": "^1.2.15", + "phpstan/phpstan": "^1.10.55", "phpstan/phpstan-phpunit": "^1.3.15", "phpstan/phpstan-strict-rules": "^1.5.2", - "phpunit/phpunit": "^10.4.2" + "phpunit/phpunit": "^10.5.5" }, "suggest": { "ext-iconv": "To handle non UTF-8 CSV files (if \"php-mbstring\" is not already installed or is too limited)", @@ -4250,7 +4250,7 @@ ], "support": { "issues": "https://github.com/openspout/openspout/issues", - "source": "https://github.com/openspout/openspout/tree/v4.22.0" + "source": "https://github.com/openspout/openspout/tree/v4.23.0" }, "funding": [ { @@ -4262,7 +4262,7 @@ "type": "github" } ], - "time": "2023-11-22T15:34:18+00:00" + "time": "2024-01-09T09:30:37+00:00" }, { "name": "phenx/php-font-lib", @@ -9108,16 +9108,16 @@ }, { "name": "laravel/pint", - "version": "v1.13.7", + "version": "v1.13.8", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "4157768980dbd977f1c4b4cc94997416d8b30ece" + "reference": "69def89df9e0babc0f0a8bea184804a7d8a9c5c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/4157768980dbd977f1c4b4cc94997416d8b30ece", - "reference": "4157768980dbd977f1c4b4cc94997416d8b30ece", + "url": "https://api.github.com/repos/laravel/pint/zipball/69def89df9e0babc0f0a8bea184804a7d8a9c5c0", + "reference": "69def89df9e0babc0f0a8bea184804a7d8a9c5c0", "shasum": "" }, "require": { @@ -9128,13 +9128,13 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.38.0", - "illuminate/view": "^10.30.1", + "friendsofphp/php-cs-fixer": "^3.46.0", + "illuminate/view": "^10.39.0", + "larastan/larastan": "^2.8.1", "laravel-zero/framework": "^10.3.0", - "mockery/mockery": "^1.6.6", - "nunomaduro/larastan": "^2.6.4", + "mockery/mockery": "^1.6.7", "nunomaduro/termwind": "^1.15.1", - "pestphp/pest": "^2.24.2" + "pestphp/pest": "^2.30.0" }, "bin": [ "builds/pint" @@ -9170,29 +9170,29 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2023-12-05T19:43:12+00:00" + "time": "2024-01-09T18:03:54+00:00" }, { "name": "laravel/tinker", - "version": "v2.8.2", + "version": "v2.9.0", "source": { "type": "git", "url": "https://github.com/laravel/tinker.git", - "reference": "b936d415b252b499e8c3b1f795cd4fc20f57e1f3" + "reference": "502e0fe3f0415d06d5db1f83a472f0f3b754bafe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/b936d415b252b499e8c3b1f795cd4fc20f57e1f3", - "reference": "b936d415b252b499e8c3b1f795cd4fc20f57e1f3", + "url": "https://api.github.com/repos/laravel/tinker/zipball/502e0fe3f0415d06d5db1f83a472f0f3b754bafe", + "reference": "502e0fe3f0415d06d5db1f83a472f0f3b754bafe", "shasum": "" }, "require": { - "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", "php": "^7.2.5|^8.0", - "psy/psysh": "^0.10.4|^0.11.1", - "symfony/var-dumper": "^4.3.4|^5.0|^6.0" + "psy/psysh": "^0.11.1|^0.12.0", + "symfony/var-dumper": "^4.3.4|^5.0|^6.0|^7.0" }, "require-dev": { "mockery/mockery": "~1.3.3|^1.4.2", @@ -9200,13 +9200,10 @@ "phpunit/phpunit": "^8.5.8|^9.3.3" }, "suggest": { - "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0)." + "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0|^11.0)." }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - }, "laravel": { "providers": [ "Laravel\\Tinker\\TinkerServiceProvider" @@ -9237,9 +9234,9 @@ ], "support": { "issues": "https://github.com/laravel/tinker/issues", - "source": "https://github.com/laravel/tinker/tree/v2.8.2" + "source": "https://github.com/laravel/tinker/tree/v2.9.0" }, - "time": "2023-08-15T14:27:00+00:00" + "time": "2024-01-04T16:10:04+00:00" }, { "name": "league/container", @@ -9467,25 +9464,27 @@ }, { "name": "nikic/php-parser", - "version": "v4.18.0", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999" + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999", - "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc", + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -9493,7 +9492,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -9517,9 +9516,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0" }, - "time": "2023-12-10T21:03:43+00:00" + "time": "2024-01-07T17:17:35+00:00" }, { "name": "nunomaduro/collision", @@ -9974,24 +9973,24 @@ }, { "name": "orchestra/testbench", - "version": "v8.19.0", + "version": "v8.20.0", "source": { "type": "git", "url": "https://github.com/orchestral/testbench.git", - "reference": "a3c7b35102f76135962451324703738f5551d46b" + "reference": "533df85bd4a084b5f505ad9182cc9031b2f81a03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench/zipball/a3c7b35102f76135962451324703738f5551d46b", - "reference": "a3c7b35102f76135962451324703738f5551d46b", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/533df85bd4a084b5f505ad9182cc9031b2f81a03", + "reference": "533df85bd4a084b5f505ad9182cc9031b2f81a03", "shasum": "" }, "require": { "composer-runtime-api": "^2.2", "fakerphp/faker": "^1.21", - "laravel/framework": "^10.39", + "laravel/framework": "^10.40", "mockery/mockery": "^1.5.1", - "orchestra/testbench-core": "^8.19", + "orchestra/testbench-core": "^8.20", "orchestra/workbench": "^1.2 || ^8.2", "php": "^8.1", "phpunit/phpunit": "^9.6 || ^10.1", @@ -10023,22 +10022,22 @@ ], "support": { "issues": "https://github.com/orchestral/testbench/issues", - "source": "https://github.com/orchestral/testbench/tree/v8.19.0" + "source": "https://github.com/orchestral/testbench/tree/v8.20.0" }, - "time": "2023-12-28T14:58:57+00:00" + "time": "2024-01-10T04:33:51+00:00" }, { "name": "orchestra/testbench-core", - "version": "v8.19.0", + "version": "v8.20.0", "source": { "type": "git", "url": "https://github.com/orchestral/testbench-core.git", - "reference": "15645dd792968f48a27a26fc4f542c16d9f07e0d" + "reference": "beb3af0737b0ac49c29b4bc26de548845f097abc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/15645dd792968f48a27a26fc4f542c16d9f07e0d", - "reference": "15645dd792968f48a27a26fc4f542c16d9f07e0d", + "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/beb3af0737b0ac49c29b4bc26de548845f097abc", + "reference": "beb3af0737b0ac49c29b4bc26de548845f097abc", "shasum": "" }, "require": { @@ -10048,14 +10047,14 @@ }, "conflict": { "brianium/paratest": "<6.4.0 || >=7.0.0 <7.1.4 || >=8.0.0", - "laravel/framework": "<10.39 || >=11.0.0", + "laravel/framework": "<10.40 || >=11.0.0", "nunomaduro/collision": "<6.4.0 || >=7.0.0 <7.4.0 || >=8.0.0", "orchestra/workbench": "<1.0.0", - "phpunit/phpunit": "<9.6.0 || 10.5.4 || >=10.6.0" + "phpunit/phpunit": "<9.6.0 || >=10.6.0" }, "require-dev": { "fakerphp/faker": "^1.21", - "laravel/framework": "^10.39", + "laravel/framework": "^10.40", "laravel/pint": "^1.6", "mockery/mockery": "^1.5.1", "phpstan/phpstan": "^1.10.7", @@ -10069,14 +10068,15 @@ "brianium/paratest": "Allow using parallel testing (^6.4 || ^7.1.4).", "ext-pcntl": "Required to use all features of the console signal trapping.", "fakerphp/faker": "Allow using Faker for testing (^1.21).", - "laravel/framework": "Required for testing (^10.39).", + "laravel/framework": "Required for testing (^10.40).", "mockery/mockery": "Allow using Mockery for testing (^1.5.1).", "nunomaduro/collision": "Allow using Laravel style tests output and parallel testing (^6.4 || ^7.4).", "orchestra/testbench-browser-kit": "Allow using legacy Laravel BrowserKit for testing (^8.0).", "orchestra/testbench-dusk": "Allow using Laravel Dusk for testing (^8.0).", "phpunit/phpunit": "Allow using PHPUnit for testing (^9.6 || ^10.1).", - "symfony/yaml": "Required for CLI Commander (^6.2).", - "vlucas/phpdotenv": "Required for CLI Commander (^5.4.1)." + "symfony/process": "Required to use Orchestra\\Testbench\\remote function (^6.2).", + "symfony/yaml": "Required for Testbench CLI (^6.2).", + "vlucas/phpdotenv": "Required for Testbench CLI (^5.4.1)." }, "bin": [ "testbench" @@ -10115,7 +10115,7 @@ "issues": "https://github.com/orchestral/testbench/issues", "source": "https://github.com/orchestral/testbench-core" }, - "time": "2023-12-28T14:44:29+00:00" + "time": "2024-01-10T03:05:52+00:00" }, { "name": "orchestra/workbench", @@ -11624,25 +11624,25 @@ }, { "name": "psy/psysh", - "version": "v0.11.22", + "version": "v0.12.0", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "128fa1b608be651999ed9789c95e6e2a31b5802b" + "reference": "750bf031a48fd07c673dbe3f11f72362ea306d0d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/128fa1b608be651999ed9789c95e6e2a31b5802b", - "reference": "128fa1b608be651999ed9789c95e6e2a31b5802b", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/750bf031a48fd07c673dbe3f11f72362ea306d0d", + "reference": "750bf031a48fd07c673dbe3f11f72362ea306d0d", "shasum": "" }, "require": { "ext-json": "*", "ext-tokenizer": "*", - "nikic/php-parser": "^4.0 || ^3.1", - "php": "^8.0 || ^7.0.8", - "symfony/console": "^6.0 || ^5.0 || ^4.0 || ^3.4", - "symfony/var-dumper": "^6.0 || ^5.0 || ^4.0 || ^3.4" + "nikic/php-parser": "^5.0 || ^4.0", + "php": "^8.0 || ^7.4", + "symfony/console": "^7.0 || ^6.0 || ^5.0 || ^4.0 || ^3.4", + "symfony/var-dumper": "^7.0 || ^6.0 || ^5.0 || ^4.0 || ^3.4" }, "conflict": { "symfony/console": "4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4" @@ -11653,8 +11653,7 @@ "suggest": { "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", "ext-pdo-sqlite": "The doc command requires SQLite to work.", - "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", - "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history." + "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well." }, "bin": [ "bin/psysh" @@ -11662,7 +11661,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-0.11": "0.11.x-dev" + "dev-main": "0.12.x-dev" }, "bamarni-bin": { "bin-links": false, @@ -11698,9 +11697,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.22" + "source": "https://github.com/bobthecow/psysh/tree/v0.12.0" }, - "time": "2023-10-14T21:56:36+00:00" + "time": "2023-12-20T15:28:09+00:00" }, { "name": "ralouphie/getallheaders", diff --git a/src/Concerns/Schemata.php b/src/Concerns/Schemata.php index 51264f56..b4f0a193 100644 --- a/src/Concerns/Schemata.php +++ b/src/Concerns/Schemata.php @@ -22,12 +22,75 @@ use Filament\Forms\Set; use Guava\FilamentIconPicker\Forms\IconPicker; use Illuminate\Support\Str; +use LaraZeus\Accordion\Forms\Accordion; +use LaraZeus\Accordion\Forms\Accordions; use LaraZeus\Bolt\BoltPlugin; use LaraZeus\Bolt\Facades\Bolt; use LaraZeus\Bolt\Models\Category; trait Schemata { + protected static function getVisibleFields(array $sections, array $arguments): array + { + // @phpstan-ignore-next-line + return collect($sections) + ->map(function (array $sections) use ($arguments) { + // @phpstan-ignore-next-line + $sections['fields'] = collect($sections['fields']) + ->reject(function ($item, $key) use ($arguments) { + return $key === $arguments['item'] || + ! ( + isset($item['options']['dataSource']) || + $item['type'] === '\LaraZeus\Bolt\Fields\Classes\Toggle' + ); + })->all(); + + return $sections; + })->all(); + } + + protected static function sectionOptionsFormSchema(array $formOptions, array $allSections): array + { + return [ + TextInput::make('description') + ->nullable() + ->visible($formOptions['show-as'] !== 'tabs') + ->label(__('Section Description')), + + Accordions::make('section-options') + ->accordions([ + Accordion::make('visual-options') + ->label(__('Visual Options')) + ->columns() + ->icon('iconpark-viewgriddetail-o') + ->schema([ + Select::make('columns') + ->options(fn (): array => array_combine(range(1, 12), range(1, 12))) + ->required() + ->default(1) + ->hint(__('fields per row')) + ->label(__('Section Columns')), + IconPicker::make('icon') + ->columns([ + 'default' => 1, + 'lg' => 3, + '2xl' => 5, + ]) + ->label(__('Section icon')), + Toggle::make('aside') + ->default(false) + ->visible($formOptions['show-as'] === 'page') + ->label(__('show as aside')), + Toggle::make('compact') + ->default(false) + ->visible($formOptions['show-as'] === 'page') + ->label(__('compact section')), + ]), + self::visibility($allSections), + ]), + ]; + } + public static function getMainFormSchema(): array { return [ @@ -62,41 +125,17 @@ public static function getMainFormSchema(): array ->tooltip('more section options') ->icon('heroicon-m-cog') ->fillForm(fn ( - $state, array $arguments, Repeater $component ) => $component->getItemState($arguments['item'])) - ->form(function (array $arguments, Repeater $component, $record, Get $get) { + ->form(function (array $arguments, Get $get) { $formOptions = $get('options'); + $allSections = $get('sections'); + unset($allSections[$arguments['item']]); - return [ - TextInput::make('description') - ->nullable() - ->visible($formOptions['show-as'] !== 'tabs') - ->label(__('Section Description')), - Select::make('columns') - ->options(fn (): array => array_combine(range(1, 12), range(1, 12))) - ->required() - ->default(1) - ->hint(__('fields per row')) - ->label(__('Section Columns')), - IconPicker::make('icon') - ->columns([ - 'default' => 1, - 'lg' => 3, - '2xl' => 5, - ]) - ->label(__('Section icon')), - Toggle::make('aside') - ->default(false) - ->visible($formOptions['show-as'] === 'page') - ->label(__('show as aside')), - Toggle::make('compact') - ->default(false) - ->visible($formOptions['show-as'] === 'page') - ->label(__('compact section')), - self::visibility($get('sections')), - ]; + $allSections = self::getVisibleFields($allSections, $arguments); + + return static::sectionOptionsFormSchema($formOptions, $allSections); }) ->action(function (array $data, array $arguments, Repeater $component): void { $state = $component->getState(); @@ -351,8 +390,8 @@ public static function getSectionsSchema(): array array $arguments, Repeater $component ) => $component->getItemState($arguments['item'])) - ->form(function (Get $get) { - $sect = $get('../../sections'); + ->form(function (Get $get, array $arguments) { + $allSections = self::getVisibleFields($get('../../sections'), $arguments); return [ Textarea::make('description') @@ -363,12 +402,12 @@ public static function getSectionsSchema(): array 'lg' => 2, ]) ->label(__('Field Options')) - ->schema(function (Get $get) use ($sect) { + ->schema(function (Get $get) use ($allSections) { $class = $get('type'); if (class_exists($class)) { $newClass = (new $class); if ($newClass->hasOptions()) { - return $newClass->getOptions($sect); + return $newClass->getOptions($allSections); } }