diff --git a/composer.json b/composer.json index cbc47b9..ac426c2 100644 --- a/composer.json +++ b/composer.json @@ -10,8 +10,7 @@ "php": "^8.2", "nette/utils": "^4.0", "nette/forms": "^3.2.3", - "nette/security": "^3.1", - "nette/application": "^3.1", + "nette/application": "^3.0 || ^4.0", "kravcik/latte-font-awesome-icon": "^1" }, "require-dev": diff --git a/composer.lock b/composer.lock index 9e9f374..75e0215 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a372586d50e77f11a9fc2c67d41a01af", + "content-hash": "340fc8b24e89cd2f1ea4b49d73672be8", "packages": [ { "name": "kravcik/latte-font-awesome-icon", @@ -59,37 +59,38 @@ }, { "name": "latte/latte", - "version": "v3.0.16", + "version": "v3.0.18", "source": { "type": "git", "url": "https://github.com/nette/latte.git", - "reference": "0984953d961123075e95a9fa33ec4c4f4de266d2" + "reference": "fca0a3eddd70213201b3b3abec0cb8dde7bbc259" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/latte/zipball/0984953d961123075e95a9fa33ec4c4f4de266d2", - "reference": "0984953d961123075e95a9fa33ec4c4f4de266d2", + "url": "https://api.github.com/repos/nette/latte/zipball/fca0a3eddd70213201b3b3abec0cb8dde7bbc259", + "reference": "fca0a3eddd70213201b3b3abec0cb8dde7bbc259", "shasum": "" }, "require": { "ext-json": "*", "ext-tokenizer": "*", - "php": "8.0 - 8.3" + "php": "8.0 - 8.4" }, "conflict": { "nette/application": "<3.1.7", "nette/caching": "<3.1.4" }, "require-dev": { - "nette/php-generator": "^3.6 || ^4.0", - "nette/tester": "^2.0", - "nette/utils": "^3.0", + "nette/php-generator": "^4.0", + "nette/tester": "^2.5", + "nette/utils": "^4.0", "phpstan/phpstan": "^1", - "tracy/tracy": "^2.3" + "tracy/tracy": "^2.10" }, "suggest": { "ext-fileinfo": "to use filter |datastream", "ext-iconv": "to use filters |reverse, |substring", + "ext-intl": "to use Latte\\Engine::setLocale()", "ext-mbstring": "to use filters like lower, upper, capitalize, ...", "nette/php-generator": "to use tag {templatePrint}", "nette/utils": "to use filter |webalize" @@ -138,9 +139,9 @@ ], "support": { "issues": "https://github.com/nette/latte/issues", - "source": "https://github.com/nette/latte/tree/v3.0.16" + "source": "https://github.com/nette/latte/tree/v3.0.18" }, - "time": "2024-05-14T09:54:10+00:00" + "time": "2024-08-06T07:58:55+00:00" }, { "name": "nette/application", @@ -298,23 +299,23 @@ }, { "name": "nette/forms", - "version": "v3.2.3", + "version": "v3.2.4", "source": { "type": "git", "url": "https://github.com/nette/forms.git", - "reference": "441926313d3f7ef78e9bc6996661310ae6f1c2f7" + "reference": "e61535036669a78bcafb061dcfa46da827fcf377" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/forms/zipball/441926313d3f7ef78e9bc6996661310ae6f1c2f7", - "reference": "441926313d3f7ef78e9bc6996661310ae6f1c2f7", + "url": "https://api.github.com/repos/nette/forms/zipball/e61535036669a78bcafb061dcfa46da827fcf377", + "reference": "e61535036669a78bcafb061dcfa46da827fcf377", "shasum": "" }, "require": { "nette/component-model": "^3.1", "nette/http": "^3.3", "nette/utils": "^4.0.4", - "php": "8.1 - 8.3" + "php": "8.1 - 8.4" }, "conflict": { "latte/latte": ">=3.0.0 <3.0.12 || >=3.1" @@ -369,9 +370,9 @@ ], "support": { "issues": "https://github.com/nette/forms/issues", - "source": "https://github.com/nette/forms/tree/v3.2.3" + "source": "https://github.com/nette/forms/tree/v3.2.4" }, - "time": "2024-05-05T15:02:00+00:00" + "time": "2024-08-05T23:11:27+00:00" }, { "name": "nette/http", @@ -516,93 +517,22 @@ }, "time": "2024-01-21T21:13:45+00:00" }, - { - "name": "nette/security", - "version": "v3.2.0", - "source": { - "type": "git", - "url": "https://github.com/nette/security.git", - "reference": "fe89d52697036fb2e14835dfb46b696d28a9ebf6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/security/zipball/fe89d52697036fb2e14835dfb46b696d28a9ebf6", - "reference": "fe89d52697036fb2e14835dfb46b696d28a9ebf6", - "shasum": "" - }, - "require": { - "nette/utils": "^4.0", - "php": "8.1 - 8.3" - }, - "conflict": { - "nette/di": "<3.0-stable", - "nette/http": "<3.1.3" - }, - "require-dev": { - "mockery/mockery": "^1.5", - "nette/di": "^3.1", - "nette/http": "^3.2", - "nette/tester": "^2.5", - "phpstan/phpstan-nette": "^1.0", - "tracy/tracy": "^2.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0-only", - "GPL-3.0-only" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🔑 Nette Security: provides authentication, authorization and a role-based access control management via ACL (Access Control List)", - "homepage": "https://nette.org", - "keywords": [ - "Authentication", - "acl", - "authorization", - "nette" - ], - "support": { - "issues": "https://github.com/nette/security/issues", - "source": "https://github.com/nette/security/tree/v3.2.0" - }, - "time": "2024-01-21T21:33:53+00:00" - }, { "name": "nette/utils", - "version": "v4.0.4", + "version": "v4.0.5", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "d3ad0aa3b9f934602cb3e3902ebccf10be34d218" + "reference": "736c567e257dbe0fcf6ce81b4d6dbe05c6899f96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/d3ad0aa3b9f934602cb3e3902ebccf10be34d218", - "reference": "d3ad0aa3b9f934602cb3e3902ebccf10be34d218", + "url": "https://api.github.com/repos/nette/utils/zipball/736c567e257dbe0fcf6ce81b4d6dbe05c6899f96", + "reference": "736c567e257dbe0fcf6ce81b4d6dbe05c6899f96", "shasum": "" }, "require": { - "php": ">=8.0 <8.4" + "php": "8.0 - 8.4" }, "conflict": { "nette/finder": "<3", @@ -669,38 +599,46 @@ ], "support": { "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v4.0.4" + "source": "https://github.com/nette/utils/tree/v4.0.5" }, - "time": "2024-01-17T16:50:36+00:00" + "time": "2024-08-07T15:39:19+00:00" } ], "packages-dev": [ { "name": "composer/pcre", - "version": "3.1.3", + "version": "3.3.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8" + "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", - "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", + "url": "https://api.github.com/repos/composer/pcre/zipball/63aaeac21d7e775ff9bc9d45021e1745c97521c4", + "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4", "shasum": "" }, "require": { "php": "^7.4 || ^8.0" }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, "require-dev": { - "phpstan/phpstan": "^1.3", + "phpstan/phpstan": "^1.11.10", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^5" + "phpunit/phpunit": "^8 || ^9" }, "type": "library", "extra": { "branch-alias": { "dev-main": "3.x-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] } }, "autoload": { @@ -728,7 +666,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.3" + "source": "https://github.com/composer/pcre/tree/3.3.1" }, "funding": [ { @@ -744,20 +682,20 @@ "type": "tidelift" } ], - "time": "2024-03-19T10:26:25+00:00" + "time": "2024-08-27T18:44:43+00:00" }, { "name": "composer/semver", - "version": "3.4.0", + "version": "3.4.2", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" + "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", + "url": "https://api.github.com/repos/composer/semver/zipball/c51258e759afdb17f1fd1fe83bc12baaef6309d6", + "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6", "shasum": "" }, "require": { @@ -809,7 +747,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.4.0" + "source": "https://github.com/composer/semver/tree/3.4.2" }, "funding": [ { @@ -825,7 +763,7 @@ "type": "tidelift" } ], - "time": "2023-08-31T09:50:34+00:00" + "time": "2024-07-12T11:35:52+00:00" }, { "name": "composer/xdebug-handler", @@ -1268,16 +1206,16 @@ }, { "name": "modul-is/coding-standard", - "version": "v4.2.3", + "version": "v4.2.5", "source": { "type": "git", "url": "https://github.com/modul-is/coding-standard.git", - "reference": "b7809b681696d6e14d16b24e560d488116ac3a2d" + "reference": "03bedecded57de75bb4f480e55844e19c6c2a1cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/modul-is/coding-standard/zipball/b7809b681696d6e14d16b24e560d488116ac3a2d", - "reference": "b7809b681696d6e14d16b24e560d488116ac3a2d", + "url": "https://api.github.com/repos/modul-is/coding-standard/zipball/03bedecded57de75bb4f480e55844e19c6c2a1cd", + "reference": "03bedecded57de75bb4f480e55844e19c6c2a1cd", "shasum": "" }, "require": { @@ -1305,26 +1243,26 @@ ], "support": { "issues": "https://github.com/modul-is/coding-standard/issues", - "source": "https://github.com/modul-is/coding-standard/tree/v4.2.3" + "source": "https://github.com/modul-is/coding-standard/tree/v4.2.5" }, - "time": "2024-01-22T14:34:03+00:00" + "time": "2024-07-23T14:57:12+00:00" }, { "name": "nette/tester", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/nette/tester.git", - "reference": "328d7b64579cdbc82e0e01d92ea9c58b9cf0a327" + "reference": "ee0a4b8402a8c1831db547ec0a56d18196906b51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/tester/zipball/328d7b64579cdbc82e0e01d92ea9c58b9cf0a327", - "reference": "328d7b64579cdbc82e0e01d92ea9c58b9cf0a327", + "url": "https://api.github.com/repos/nette/tester/zipball/ee0a4b8402a8c1831db547ec0a56d18196906b51", + "reference": "ee0a4b8402a8c1831db547ec0a56d18196906b51", "shasum": "" }, "require": { - "php": ">=8.0 <8.4" + "php": "8.0 - 8.3" }, "require-dev": { "ext-simplexml": "*", @@ -1380,22 +1318,22 @@ ], "support": { "issues": "https://github.com/nette/tester/issues", - "source": "https://github.com/nette/tester/tree/v2.5.2" + "source": "https://github.com/nette/tester/tree/v2.5.3" }, - "time": "2024-01-08T11:41:26+00:00" + "time": "2024-06-18T18:44:12+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.29.0", + "version": "1.30.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" + "reference": "5ceb0e384997db59f38774bf79c2a6134252c08f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/5ceb0e384997db59f38774bf79c2a6134252c08f", + "reference": "5ceb0e384997db59f38774bf79c2a6134252c08f", "shasum": "" }, "require": { @@ -1427,22 +1365,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.0" }, - "time": "2024-05-06T12:04:23+00:00" + "time": "2024-08-29T09:54:52+00:00" }, { "name": "phpstan/phpstan", - "version": "1.11.1", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e524358f930e41a2b4cca1320e3b04fc26b39e0b" + "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e524358f930e41a2b4cca1320e3b04fc26b39e0b", - "reference": "e524358f930e41a2b4cca1320e3b04fc26b39e0b", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", + "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", "shasum": "" }, "require": { @@ -1487,25 +1425,25 @@ "type": "github" } ], - "time": "2024-05-15T08:00:59+00:00" + "time": "2024-09-03T19:55:22+00:00" }, { "name": "phpstan/phpstan-nette", - "version": "1.3.0", + "version": "1.3.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-nette.git", - "reference": "8af94743efcc6d1e685f2ffd7ab279e39c96429c" + "reference": "bc74b8b208b47f163fe55708fcf1a0333247fa79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-nette/zipball/8af94743efcc6d1e685f2ffd7ab279e39c96429c", - "reference": "8af94743efcc6d1e685f2ffd7ab279e39c96429c", + "url": "https://api.github.com/repos/phpstan/phpstan-nette/zipball/bc74b8b208b47f163fe55708fcf1a0333247fa79", + "reference": "bc74b8b208b47f163fe55708fcf1a0333247fa79", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.10" + "phpstan/phpstan": "^1.11.11" }, "conflict": { "nette/application": "<2.3.0", @@ -1523,7 +1461,7 @@ "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "~9.5.28" }, "type": "phpstan-extension", "extra": { @@ -1546,9 +1484,9 @@ "description": "Nette Framework class reflection extension for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-nette/issues", - "source": "https://github.com/phpstan/phpstan-nette/tree/1.3.0" + "source": "https://github.com/phpstan/phpstan-nette/tree/1.3.8" }, - "time": "2024-04-20T06:40:32+00:00" + "time": "2024-08-25T12:11:12+00:00" }, { "name": "psr/cache", @@ -1704,16 +1642,16 @@ }, { "name": "psr/log", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "reference": "79dff0b268932c640297f5208d6298f71855c03e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/php-fig/log/zipball/79dff0b268932c640297f5208d6298f71855c03e", + "reference": "79dff0b268932c640297f5208d6298f71855c03e", "shasum": "" }, "require": { @@ -1748,9 +1686,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "source": "https://github.com/php-fig/log/tree/3.0.1" }, - "time": "2021-07-14T16:46:02+00:00" + "time": "2024-08-21T13:31:24+00:00" }, { "name": "sebastian/diff", @@ -1886,16 +1824,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.0", + "version": "3.10.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "57e09801c2fbae2d257b8b75bebb3deeb7e9deb2" + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/57e09801c2fbae2d257b8b75bebb3deeb7e9deb2", - "reference": "57e09801c2fbae2d257b8b75bebb3deeb7e9deb2", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", "shasum": "" }, "require": { @@ -1962,20 +1900,20 @@ "type": "open_collective" } ], - "time": "2024-05-20T08:11:32+00:00" + "time": "2024-07-21T23:26:44+00:00" }, { "name": "symfony/console", - "version": "v6.4.7", + "version": "v6.4.11", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f" + "reference": "42686880adaacdad1835ee8fc2a9ec5b7bd63998" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", - "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", + "url": "https://api.github.com/repos/symfony/console/zipball/42686880adaacdad1835ee8fc2a9ec5b7bd63998", + "reference": "42686880adaacdad1835ee8fc2a9ec5b7bd63998", "shasum": "" }, "require": { @@ -2040,7 +1978,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.7" + "source": "https://github.com/symfony/console/tree/v6.4.11" }, "funding": [ { @@ -2056,7 +1994,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-08-15T22:48:29+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2127,16 +2065,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "d84384f3f67de3cb650db64d685d70395dacfc3f" + "reference": "8d7507f02b06e06815e56bb39aa0128e3806208b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d84384f3f67de3cb650db64d685d70395dacfc3f", - "reference": "d84384f3f67de3cb650db64d685d70395dacfc3f", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/8d7507f02b06e06815e56bb39aa0128e3806208b", + "reference": "8d7507f02b06e06815e56bb39aa0128e3806208b", "shasum": "" }, "require": { @@ -2187,7 +2125,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v6.4.7" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.4.8" }, "funding": [ { @@ -2203,7 +2141,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -2283,23 +2221,25 @@ }, { "name": "symfony/filesystem", - "version": "v6.4.7", + "version": "v6.4.9", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "78dde75f8f6dbbca4ec436a4b0087f7af02076d4" + "reference": "b51ef8059159330b74a4d52f68e671033c0fe463" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/78dde75f8f6dbbca4ec436a4b0087f7af02076d4", - "reference": "78dde75f8f6dbbca4ec436a4b0087f7af02076d4", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b51ef8059159330b74a4d52f68e671033c0fe463", + "reference": "b51ef8059159330b74a4d52f68e671033c0fe463", "shasum": "" }, "require": { "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8", - "symfony/process": "^5.4|^6.4" + "symfony/polyfill-mbstring": "~1.8" + }, + "require-dev": { + "symfony/process": "^5.4|^6.4|^7.0" }, "type": "library", "autoload": { @@ -2327,7 +2267,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.4.7" + "source": "https://github.com/symfony/filesystem/tree/v6.4.9" }, "funding": [ { @@ -2343,20 +2283,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-06-28T09:49:33+00:00" }, { "name": "symfony/finder", - "version": "v6.4.7", + "version": "v6.4.11", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "511c48990be17358c23bf45c5d71ab85d40fb764" + "reference": "d7eb6daf8cd7e9ac4976e9576b32042ef7253453" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/511c48990be17358c23bf45c5d71ab85d40fb764", - "reference": "511c48990be17358c23bf45c5d71ab85d40fb764", + "url": "https://api.github.com/repos/symfony/finder/zipball/d7eb6daf8cd7e9ac4976e9576b32042ef7253453", + "reference": "d7eb6daf8cd7e9ac4976e9576b32042ef7253453", "shasum": "" }, "require": { @@ -2391,7 +2331,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.4.7" + "source": "https://github.com/symfony/finder/tree/v6.4.11" }, "funding": [ { @@ -2407,20 +2347,20 @@ "type": "tidelift" } ], - "time": "2024-04-23T10:36:43+00:00" + "time": "2024-08-13T14:27:37+00:00" }, { "name": "symfony/options-resolver", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "9a3c92b490716ba6771f5beced13c6eda7183eed" + "reference": "22ab9e9101ab18de37839074f8a1197f55590c1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/9a3c92b490716ba6771f5beced13c6eda7183eed", - "reference": "9a3c92b490716ba6771f5beced13c6eda7183eed", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/22ab9e9101ab18de37839074f8a1197f55590c1b", + "reference": "22ab9e9101ab18de37839074f8a1197f55590c1b", "shasum": "" }, "require": { @@ -2458,7 +2398,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v6.4.7" + "source": "https://github.com/symfony/options-resolver/tree/v6.4.8" }, "funding": [ { @@ -2474,20 +2414,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + "reference": "0424dff1c58f028c451efff2045f5d92410bd540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", + "reference": "0424dff1c58f028c451efff2045f5d92410bd540", "shasum": "" }, "require": { @@ -2537,7 +2477,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" }, "funding": [ { @@ -2553,20 +2493,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/64647a7c30b2283f5d49b874d84a18fc22054b7a", + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a", "shasum": "" }, "require": { @@ -2615,7 +2555,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.30.0" }, "funding": [ { @@ -2631,20 +2571,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", "shasum": "" }, "require": { @@ -2696,7 +2636,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0" }, "funding": [ { @@ -2712,20 +2652,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", "shasum": "" }, "require": { @@ -2776,7 +2716,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" }, "funding": [ { @@ -2792,20 +2732,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", "shasum": "" }, "require": { @@ -2856,7 +2796,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" }, "funding": [ { @@ -2872,20 +2812,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "c565ad1e63f30e7477fc40738343c62b40bc672d" + "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/c565ad1e63f30e7477fc40738343c62b40bc672d", - "reference": "c565ad1e63f30e7477fc40738343c62b40bc672d", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/3fb075789fb91f9ad9af537c4012d523085bd5af", + "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af", "shasum": "" }, "require": { @@ -2932,7 +2872,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.30.0" }, "funding": [ { @@ -2948,20 +2888,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/process", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "cdb1c81c145fd5aa9b0038bab694035020943381" + "reference": "8d92dd79149f29e89ee0f480254db595f6a6a2c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/cdb1c81c145fd5aa9b0038bab694035020943381", - "reference": "cdb1c81c145fd5aa9b0038bab694035020943381", + "url": "https://api.github.com/repos/symfony/process/zipball/8d92dd79149f29e89ee0f480254db595f6a6a2c5", + "reference": "8d92dd79149f29e89ee0f480254db595f6a6a2c5", "shasum": "" }, "require": { @@ -2993,7 +2933,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.4.7" + "source": "https://github.com/symfony/process/tree/v6.4.8" }, "funding": [ { @@ -3009,7 +2949,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/service-contracts", @@ -3096,16 +3036,16 @@ }, { "name": "symfony/stopwatch", - "version": "v6.4.7", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "ffec95ba269e541eb2232126c0c20f83086b5c68" + "reference": "63e069eb616049632cde9674c46957819454b8aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/ffec95ba269e541eb2232126c0c20f83086b5c68", - "reference": "ffec95ba269e541eb2232126c0c20f83086b5c68", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/63e069eb616049632cde9674c46957819454b8aa", + "reference": "63e069eb616049632cde9674c46957819454b8aa", "shasum": "" }, "require": { @@ -3138,7 +3078,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v6.4.7" + "source": "https://github.com/symfony/stopwatch/tree/v6.4.8" }, "funding": [ { @@ -3154,20 +3094,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-05-31T14:49:08+00:00" }, { "name": "symfony/string", - "version": "v7.0.7", + "version": "v7.1.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63" + "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/e405b5424dc2528e02e31ba26b83a79fd4eb8f63", - "reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63", + "url": "https://api.github.com/repos/symfony/string/zipball/6cd670a6d968eaeb1c77c2e76091c45c56bc367b", + "reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b", "shasum": "" }, "require": { @@ -3181,6 +3121,7 @@ "symfony/translation-contracts": "<2.5" }, "require-dev": { + "symfony/emoji": "^7.1", "symfony/error-handler": "^6.4|^7.0", "symfony/http-client": "^6.4|^7.0", "symfony/intl": "^6.4|^7.0", @@ -3224,7 +3165,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.0.7" + "source": "https://github.com/symfony/string/tree/v7.1.4" }, "funding": [ { @@ -3240,7 +3181,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-08-12T09:59:40+00:00" } ], "aliases": [], diff --git a/src/Container.php b/src/Container.php index 87db818..1adebf1 100644 --- a/src/Container.php +++ b/src/Container.php @@ -20,6 +20,8 @@ class Container extends \Nette\Forms\Container private ?string $wrapClass = null; + private array $dividerArray = []; + public function setId(string $id): self { @@ -119,7 +121,7 @@ public function addEmail(string $name, $label = null): Control\TextInput { return $this[$name] = (new Control\TextInput($label)) ->setRequired(false) - ->addRule(Form::EMAIL); + ->addRule(Form::Email); } @@ -128,7 +130,7 @@ public function addInteger(string $name, $label = null): Control\TextInput return $this[$name] = (new Control\TextInput($label)) ->setNullable() ->setRequired(false) - ->addRule(Form::INTEGER); + ->addRule(Form::Integer); } @@ -152,6 +154,13 @@ public function addDateTime(string $name, $label = null, bool $withSeconds = fal } + public function addDateWeek(string $name, $label = null): Control\TextInput + { + return $this[$name] = (new Control\TextInput($label)) + ->setHtmlAttribute('type', 'week'); + } + + public function addTime(string $name, $label = null, bool $withSeconds = false): Control\DateTimeInput { return $this[$name] = (new Control\DateTimeInput($label, DateTimeControl::TypeTime, $withSeconds)) @@ -246,11 +255,25 @@ public function addDuplicator($name, $factory, $copyNumber = 1, $forceDefault = public function addWhisperer(string $name, $label = null, array $items = []): Control\Whisperer { return $this[$name] = (new Control\Whisperer($label, isset($items['']) ? $items : ['' => ''] + $items)) - ->setAttribute('data-placeholder', 'Vyberte') + ->setHtmlAttribute('data-placeholder', 'Vyberte') ->checkDefaultValue(false); } + public function addDivider(Html|string $content, ?string $previousControl = null): void + { + if(!$previousControl) + { + $controlArray = iterator_to_array($this->getControls()); + $lastControl = end($controlArray); + + $previousControl = $lastControl->getName(); + } + + $this->dividerArray[$previousControl] = $content; + } + + public function render(): string|Html { $components = $this->getComponents(); @@ -282,11 +305,16 @@ public function render(): string|Html foreach($inputArray as $control) { $inputs .= $control->render(); + + if(array_key_exists($control->getName(), $this->dividerArray)) + { + $inputs .= $this->dividerArray[$control->getName()]; + } } $rowDiv = Html::el('div') - ->class('row') - ->addHtml($inputs); + ->class('row') + ->addHtml($inputs); $cardBodyDiv = Html::el('div') ->class('card-body') @@ -329,6 +357,11 @@ public function render(): string|Html { \assert($control instanceof Control\Renderable); $inputs .= $control->render(); + + if(array_key_exists($control->getName(), $this->dividerArray)) + { + $inputs .= $this->dividerArray[$control->getName()]; + } } $rowDiv = Html::el('div') diff --git a/src/Form.php b/src/Form.php index 456088a..010e4c6 100644 --- a/src/Form.php +++ b/src/Form.php @@ -11,30 +11,9 @@ class Form extends UIForm { - /** @deprecated use Form::GreaterEqual */ - public const GREATER_EQUAL = UIForm::MIN; + public const GreaterEqual = UIForm::Min; - /** @deprecated use Form::LessEqual */ - public const LESS_EQUAL = UIForm::MAX; - - /** @deprecated use Form::Greater */ - public const GREATER = '\ModulIS\Form\FormValidator::greater'; - - /** @deprecated use Form::Less */ - public const LESS = 'ModulIS\Form\FormValidator::less'; - - /** @deprecated use Form::SameLength */ - public const SAME_LENGTH = 'ModulIS\Form\FormValidator::sameLength'; - - /** @deprecated use Form::validateRC */ - public const VALIDATE_RC = 'ModulIS\Form\FormValidator::validateRC'; - - /** @deprecated use Form::validateIC */ - public const VALIDATE_IC = 'ModulIS\Form\FormValidator::validateIC'; - - public const GreaterEqual = UIForm::MIN; - - public const LessEqual = UIForm::MAX; + public const LessEqual = UIForm::Max; public const Greater = '\ModulIS\Form\FormValidator::greater'; @@ -66,6 +45,8 @@ class Form extends UIForm private string $defaultInputWrapClass = 'mb-3 col-12'; + private array $dividerArray = []; + public function __construct(\Nette\ComponentModel\IContainer $parent = null, $name = null) { @@ -114,6 +95,11 @@ public function renderForm() * Nette form hidden input */ $inputs .= $input instanceof \Nette\Forms\Controls\HiddenField ? $input->getControl() : $input->render(); + + if(array_key_exists($input->getName(), $this->dividerArray)) + { + $inputs .= $this->dividerArray[$input->getName()]; + } } if($inputs === null) @@ -129,18 +115,18 @@ public function renderForm() ->class('card-body') ->setHtml($row); - $carHeader = null; + $cardHeader = null; if($groupTitle || $this->getTitle()) { $groupColor = $group->getOption('color') ? ' ' . $group->getOption('color') : null; - $carHeader = Html::el('div') + $cardHeader = Html::el('div') ->class('card-header' . $groupColor) ->setHtml($groupTitle ?: $this->getTitle()); } - $content = $carHeader . $cardBody; + $content = $cardHeader . $cardBody; /** * Last iteration - add footer with submitters @@ -304,6 +290,13 @@ public function addDate(string $name, $label = null): Control\DateTimeInput } + public function addDateWeek(string $name, $label = null): Control\TextInput + { + return $this[$name] = (new Control\TextInput($label)) + ->setHtmlAttribute('type', 'week'); + } + + public function addDateTime(string $name, $label = null, bool $withSeconds = false): Control\DateTimeInput { $dateInput = new Control\DateTimeInput($label, DateTimeControl::TypeDateTime, $withSeconds); @@ -432,7 +425,7 @@ public function addDependentMultiSelect(string $name, $label = null, array $pare public function addWhisperer(string $name, $label = null, array $items = []): Control\Whisperer { return $this[$name] = (new Control\Whisperer($label, isset($items['']) ? $items : ['' => ''] + $items)) - ->setAttribute('data-placeholder', 'Vyberte') + ->setHtmlAttribute('data-placeholder', 'Vyberte') ->checkDefaultValue(false); } @@ -450,8 +443,22 @@ public function addDuplicator($name, $factory, $copyNumber = 1, $forceDefault = public function addMultiWhisperer(string $name, $label = null, array $items = null): Control\MultiWhisperer { return $this[$name] = (new Control\MultiWhisperer($label, isset($items['']) ? $items : ['' => ''] + $items)) - ->setAttribute('class', 'form-control-chosen') - ->setAttribute('data-placeholder', 'Vyberte'); + ->setHtmlAttribute('class', 'form-control-chosen') + ->setHtmlAttribute('data-placeholder', 'Vyberte'); + } + + + public function addDivider(Html|string $content, ?string $previousControl = null): void + { + if(!$previousControl) + { + $controlArray = iterator_to_array($this->getControls()); + $lastControl = end($controlArray); + + $previousControl = $lastControl->getName(); + } + + $this->dividerArray[$previousControl] = $content; } diff --git a/src/FormComponent.php b/src/FormComponent.php index 7e8e8ed..bcca1a6 100644 --- a/src/FormComponent.php +++ b/src/FormComponent.php @@ -63,7 +63,7 @@ protected function getLatteName(string $path): string */ public function __call($name, $arguments) { - if(\Nette\Utils\Strings::startsWith($name, 'render')) + if(str_starts_with($name, 'render')) { $array = explode(DIRECTORY_SEPARATOR, $this->getReflection()->getFileName()); diff --git a/src/control/Checkbox.php b/src/control/Checkbox.php index ec297a7..6bb59e6 100644 --- a/src/control/Checkbox.php +++ b/src/control/Checkbox.php @@ -24,6 +24,10 @@ class Checkbox extends \Nette\Forms\Controls\Checkbox implements Renderable, Sig private ?string $inputClass = null; + private ?string $labelClass = null; + + private ?string $checkboxClass = null; + private ?string $wrapClass = null; @@ -49,6 +53,22 @@ public function setInputWrapClass(string $class): self } + public function setLabelWrapClass(string $class): self + { + $this->labelClass = $class; + + return $this; + } + + + public function setCheckboxWrapClass(string $class): self + { + $this->checkboxClass = $class; + + return $this; + } + + public function setWrapClass(string $class): self { $this->wrapClass = $class; @@ -72,11 +92,13 @@ public function getCoreControl(): string|Html } else { - $inputClass = 'form-check-input' . ($this->color ? ' checkbox-' . $this->color : null); + $inputClass = 'form-check-input' . ($this->color ? ' ' . $this->color : null); $labelClass = 'form-check-label'; $labelAttribute = 'width: auto'; } + $labelClass = $this->labelClass ? $labelClass . ' ' . $this->labelClass : $labelClass; + $input->class($inputClass . ' ' . $input->getAttribute('class') . ($validationClass ? ' ' . $validationClass : null)); if($this instanceof \ModulIS\Form\Control\Signalable && $this->hasSignal()) @@ -91,9 +113,10 @@ public function getCoreControl(): string|Html ->addHtml($this->caption); $switchClass = $this->switch ? ' form-switch' : null; + $checkboxClass = $this->checkboxClass ? ' ' . $this->checkboxClass : null; $wrapDiv = Html::el('div') - ->class('form-check' . $switchClass) + ->class('form-check' . $switchClass . $checkboxClass) ->addHtml($input . $label); if($this->tooltip) diff --git a/src/control/Duplicator.php b/src/control/Duplicator.php index 3930589..fd9d883 100644 --- a/src/control/Duplicator.php +++ b/src/control/Duplicator.php @@ -43,7 +43,11 @@ class Duplicator extends \ModulIS\Form\Container implements Renderable public function __construct($factory, int $createDefault = 0, bool $forceDefault = false) { - $this->monitor(Presenter::class); + $this->monitor(Presenter::class, function() + { + $this->loadHttpData(); + $this->createDefault(); + }); $this->monitor(\Nette\Forms\Form::class); if(!self::$containerClass) @@ -69,7 +73,7 @@ public function __construct($factory, int $createDefault = 0, bool $forceDefault public function setOption(string $key, $value): self { - if ($value === null) + if($value === null) { unset($this->options[$key]); } @@ -196,20 +200,6 @@ public function setFactory($factory): void } - protected function attached($obj): void - { - parent::attached($obj); - - if(!$obj instanceof Presenter && $this->form instanceof Nette\Application\UI\Form) - { - return; - } - - $this->loadHttpData(); - $this->createDefault(); - } - - public function getContainers(?bool $recursive = false) { return $this->getComponents($recursive, \ModulIS\Form\Container::class); @@ -237,7 +227,8 @@ protected function createComponent($name): ?Nette\ComponentModel\IComponent private function getFirstControlName() { - $controls = iterator_to_array($this->getComponents(false, \Nette\Forms\Control::class)); + $components = $this->getComponents(false, \Nette\Forms\Control::class); + $controls = is_array($components) ? $components : iterator_to_array($components); $firstControl = reset($controls); /* @phpstan-ignore-next-line */ return $firstControl ? $firstControl->name : null; @@ -350,7 +341,7 @@ private function getHttpData() { if($this->httpPost === null) { - $path = explode(self::NAME_SEPARATOR, $this->lookupPath(\Nette\Forms\Form::class)); + $path = explode(self::NameSeparator, $this->lookupPath(\Nette\Forms\Form::class)); $this->httpPost = Nette\Utils\Arrays::get($this->getForm()->getHttpData(), $path, null); } diff --git a/src/control/MultiSelectBox.php b/src/control/MultiSelectBox.php index 5a6318d..773d697 100644 --- a/src/control/MultiSelectBox.php +++ b/src/control/MultiSelectBox.php @@ -5,8 +5,9 @@ namespace ModulIS\Form\Control; use ModulIS\Form\Helper; +use Nette\Application\UI\SignalReceiver; -class MultiSelectBox extends \Nette\Forms\Controls\MultiSelectBox implements Renderable +class MultiSelectBox extends \Nette\Forms\Controls\MultiSelectBox implements Renderable, Signalable, SignalReceiver { use Helper\InputGroup; use Helper\Color; diff --git a/src/control/MultiWhisperer.php b/src/control/MultiWhisperer.php index dd06151..004e348 100644 --- a/src/control/MultiWhisperer.php +++ b/src/control/MultiWhisperer.php @@ -19,6 +19,11 @@ public function getCoreControl(): Html $input->addAttributes(['class' => 'form-control ' . $input->getAttribute('class') . ($validationClass ? ' ' . $validationClass : null) . $chosenClass]); + if($this instanceof \ModulIS\Form\Control\Signalable && $this->hasSignal()) + { + $this->addSignalsToInput($input); + } + return Html::el('div')->class('input-group') ->addHtml($this->getPrepend() . $input . $this->getAppend() . $validationFeedBack); } @@ -30,7 +35,7 @@ public function validate(): void foreach($this->getRules() as $rule) { - if($rule->validator == \ModulIS\Form\Form::FILLED && !$this->getValue()) + if($rule->validator == \ModulIS\Form\Form::Filled && !$this->getValue()) { $this->addError(\Nette\Forms\Validator::formatMessage($rule, true), false); } diff --git a/src/control/RadioList.php b/src/control/RadioList.php index 3c8410d..bbce834 100644 --- a/src/control/RadioList.php +++ b/src/control/RadioList.php @@ -5,6 +5,7 @@ namespace ModulIS\Form\Control; use ModulIS\Form\Helper; +use Nette\Utils\Html; class RadioList extends \Nette\Forms\Controls\RadioList implements Renderable, Signalable, \Nette\Application\UI\SignalReceiver { @@ -19,7 +20,149 @@ class RadioList extends \Nette\Forms\Controls\RadioList implements Renderable, S use Helper\WrapControl; use Helper\RenderInline; use Helper\ControlClass; - use Helper\RenderBasic; + use Helper\RenderBasic + { + render as public baseRender; + } use Helper\Signals; use Helper\ToggleButton; + use Helper\WrapControl; + + private bool $big = false; + + + public function setBig(bool $big = true): self + { + $this->big = $big; + + return $this; + } + + + public function setItemsColor(string $color): self + { + $this->color = $color; + + return $this; + } + + + /** + * @param class-string<\BackedEnum&\ModulIS\Form\Enum\RadioEnum> $enumClass + */ + public function setValuesFromEnum(string $enumClass): self + { + $this->setItems($enumClass::getList()); + + $this->setTooltips($enumClass::getDescription()); + + return $this; + } + + + public function render(): Html|string + { + if(!$this->big) + { + return $this->baseRender(); + } + + if($this->getOption('hide') || $this->autoRenderSkip) + { + return ''; + } + + $wrap = Html::el('div') + ->class('btn-group row w-100'); + + foreach($this->getItems() as $case => $caseString) + { + if(isset($this->tooltips[$case])) + { + $tooltip = Html::el('p') + ->class('mb-0 text-muted') + ->addText($this->tooltips[$case]); + } + else + { + $tooltip = ''; + } + + $input = $this->getControlPart($case); + + $currentClass = $input->getAttribute('class') ? ' ' . $input->getAttribute('class') : null; + + $input->class('btn-check z-1 top-50 start-0 ms-4 round-16 position-relative' . $currentClass); + + $labelString = Html::el('h6') + ->class('fs-4 fw-semibold mb-0') + ->addText($caseString); + + $labelStringWrap = Html::el('div') + ->class('text-start ps-2') + ->addHtml($labelString) + ->addHtml($tooltip); + + $color = $this->color ?: 'primary'; + + $label = Html::el('label') + ->class("btn btn-outline-$color mb-0 p-3 rounded ps-5 w-100") + ->for($input->id) + ->addHtml($labelStringWrap); + + $inputLabelWrap = Html::el('div') + ->class('position-relative col-lg-' . 12 / $this->itemsPerRow . ' ' . $this->itemClass) + ->addHtml($input) + ->addHtml($label); + + $wrap->addHtml($inputLabelWrap); + } + + $validationFeedBack = ''; + $validationClass = ''; + $cardClass = ''; + + $form = $this->getForm(); + \assert($form instanceof \ModulIS\Form\Form); + + if($form->isAnchored() && $form->isSubmitted()) + { + if($this->hasErrors()) + { + $cardClass = ' border-danger'; + $validationClass = ' is-invalid'; + $validationFeedBack = Html::el('div') + ->class('invalid-feedback') + ->addHtml($this->getError()); + } + elseif($this->getValidationSuccessMessage()) + { + $cardClass = ' border-success'; + $validationClass = ' is-valid'; + $validationFeedBack = Html::el('div') + ->class('valid-feedback') + ->addHtml($this->getValidationSuccessMessage()); + } + } + + $mainLabel = Html::el('h6') + ->class('mb-3 fw-semibold fs-4' . $validationClass . ' ' . $this->labelClass) + ->addHtml($this->getLabel()); + + $cardBody = Html::el('div') + ->class('card-body p-4'); + + if($this->getLabel()->getText()) + { + $cardBody->addHtml($mainLabel); + } + + $cardBody->addHtml($wrap) + ->addHtml($validationFeedBack); + + return Html::el('div') + ->id($this->options['id'] ?? null) + ->class('btn-group-active card shadow-none border' . $cardClass . $this->inputClass) + ->addHtml($cardBody); + } } diff --git a/src/control/SubmitButton.php b/src/control/SubmitButton.php index 86372dd..3e8dfc7 100644 --- a/src/control/SubmitButton.php +++ b/src/control/SubmitButton.php @@ -22,7 +22,7 @@ public function getCoreControl(): Html $button = Html::el('button') ->name($this->getName()) - ->class('btn ' . $input->getAttribute('class') . ' btn-' . $color) + ->class('btn rounded-pill px-4 ' . $input->getAttribute('class') . ' btn-' . $color) ->type('submit') ->formnovalidate(true) ->addHtml($this->icon ? \Kravcik\LatteFontAwesomeIcon\Extension::render($this->icon) . ' ' : '') diff --git a/src/control/Whisperer.php b/src/control/Whisperer.php index a00c413..a80a53d 100644 --- a/src/control/Whisperer.php +++ b/src/control/Whisperer.php @@ -290,7 +290,7 @@ public function validate(): void foreach($this->getRules() as $rule) { - if($rule->control == $this && $rule->validator == \ModulIS\Form\Form::FILLED && in_array($this->getValue(), [null, false, ''], true)) + if($rule->control == $this && $rule->validator == \ModulIS\Form\Form::Filled && in_array($this->getValue(), [null, false, ''], true)) { $this->addError(\Nette\Forms\Validator::formatMessage($rule, true), false); } @@ -313,7 +313,7 @@ private function addDividerToOption(Html $control): Html foreach($items as $item) { - if(Strings::contains($item, 'value="' . $this->dividerValue . '"')) + if(str_contains($item, 'value="' . $this->dividerValue . '"')) { $optionString .= '