diff --git a/app/composer.lock b/app/composer.lock index 2110711ea..ef8a91cbc 100644 --- a/app/composer.lock +++ b/app/composer.lock @@ -779,16 +779,16 @@ }, { "name": "nette/forms", - "version": "v3.2.4", + "version": "v3.2.5", "source": { "type": "git", "url": "https://github.com/nette/forms.git", - "reference": "e61535036669a78bcafb061dcfa46da827fcf377" + "reference": "7e59cee3a16e0382f83680c94babb85a0a167dd0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/forms/zipball/e61535036669a78bcafb061dcfa46da827fcf377", - "reference": "e61535036669a78bcafb061dcfa46da827fcf377", + "url": "https://api.github.com/repos/nette/forms/zipball/7e59cee3a16e0382f83680c94babb85a0a167dd0", + "reference": "7e59cee3a16e0382f83680c94babb85a0a167dd0", "shasum": "" }, "require": { @@ -850,9 +850,9 @@ ], "support": { "issues": "https://github.com/nette/forms/issues", - "source": "https://github.com/nette/forms/tree/v3.2.4" + "source": "https://github.com/nette/forms/tree/v3.2.5" }, - "time": "2024-08-05T23:11:27+00:00" + "time": "2024-10-22T18:42:14+00:00" }, { "name": "nette/http", @@ -3325,20 +3325,20 @@ }, { "name": "nette/tester", - "version": "v2.5.3", + "version": "v2.5.4", "source": { "type": "git", "url": "https://github.com/nette/tester.git", - "reference": "ee0a4b8402a8c1831db547ec0a56d18196906b51" + "reference": "c11863785779e87b40adebf150364f2e5938c111" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/tester/zipball/ee0a4b8402a8c1831db547ec0a56d18196906b51", - "reference": "ee0a4b8402a8c1831db547ec0a56d18196906b51", + "url": "https://api.github.com/repos/nette/tester/zipball/c11863785779e87b40adebf150364f2e5938c111", + "reference": "c11863785779e87b40adebf150364f2e5938c111", "shasum": "" }, "require": { - "php": "8.0 - 8.3" + "php": "8.0 - 8.4" }, "require-dev": { "ext-simplexml": "*", @@ -3394,9 +3394,9 @@ ], "support": { "issues": "https://github.com/nette/tester/issues", - "source": "https://github.com/nette/tester/tree/v2.5.3" + "source": "https://github.com/nette/tester/tree/v2.5.4" }, - "time": "2024-06-18T18:44:12+00:00" + "time": "2024-10-23T23:57:10+00:00" }, { "name": "php-parallel-lint/php-console-highlighter", @@ -3765,12 +3765,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "2db4b93f047a03be06ec0a890d252e1c8c635f74" + "reference": "bae581ca4125f92b1ad4d316ac691fa2d5231649" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/2db4b93f047a03be06ec0a890d252e1c8c635f74", - "reference": "2db4b93f047a03be06ec0a890d252e1c8c635f74", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/bae581ca4125f92b1ad4d316ac691fa2d5231649", + "reference": "bae581ca4125f92b1ad4d316ac691fa2d5231649", "shasum": "" }, "conflict": { @@ -3778,7 +3778,7 @@ "admidio/admidio": "<4.3.12", "adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3", "aheinze/cockpit": "<2.2", - "aimeos/ai-admin-graphql": ">=2022.04.1,<2022.10.10|>=2023.04.1,<2023.10.6|>=2024.04.1,<2024.04.6", + "aimeos/ai-admin-graphql": ">=2022.04.1,<2022.10.10|>=2023.04.1,<2023.10.6|>=2024.04.1,<2024.07.2", "aimeos/ai-admin-jsonadm": "<2020.10.13|>=2021.04.1,<2021.10.6|>=2022.04.1,<2022.10.3|>=2023.04.1,<2023.10.4|==2024.04.1", "aimeos/ai-client-html": ">=2020.04.1,<2020.10.27|>=2021.04.1,<2021.10.22|>=2022.04.1,<2022.10.13|>=2023.04.1,<2023.10.15|>=2024.04.1,<2024.04.7", "aimeos/ai-controller-frontend": "<2020.10.15|>=2021.04.1,<2021.10.8|>=2022.04.1,<2022.10.8|>=2023.04.1,<2023.10.9|==2024.04.1", @@ -3822,7 +3822,7 @@ "barrelstrength/sprout-forms": "<3.9", "barryvdh/laravel-translation-manager": "<0.6.2", "barzahlen/barzahlen-php": "<2.0.1", - "baserproject/basercms": "<5.0.9", + "baserproject/basercms": "<=5.1.1", "bassjobsen/bootstrap-3-typeahead": ">4.0.2", "bbpress/bbpress": "<2.6.5", "bcosca/fatfree": "<3.7.2", @@ -3990,7 +3990,7 @@ "froxlor/froxlor": "<=2.2.0.0-RC3", "frozennode/administrator": "<=5.0.12", "fuel/core": "<1.8.1", - "funadmin/funadmin": "<=3.2|>=3.3.2,<=3.3.3", + "funadmin/funadmin": "<=5.0.2", "gaoming13/wechat-php-sdk": "<=1.10.2", "genix/cms": "<=1.1.11", "getformwork/formwork": "<1.13.1|==2.0.0.0-beta1", @@ -4107,6 +4107,7 @@ "lms/routes": "<2.1.1", "localizationteam/l10nmgr": "<7.4|>=8,<8.7|>=9,<9.2", "luyadev/yii-helpers": "<1.2.1", + "maestroerror/php-heic-to-jpg": "<1.0.5", "magento/community-edition": "<2.4.5|==2.4.5|>=2.4.5.0-patch1,<2.4.5.0-patch10|==2.4.6|>=2.4.6.0-patch1,<2.4.6.0-patch8|>=2.4.7.0-beta1,<2.4.7.0-patch3", "magento/core": "<=1.9.4.5", "magento/magento1ce": "<1.9.4.3-dev", @@ -4267,7 +4268,7 @@ "processwire/processwire": "<=3.0.229", "propel/propel": ">=2.0.0.0-alpha1,<=2.0.0.0-alpha7", "propel/propel1": ">=1,<=1.7.1", - "pterodactyl/panel": "<1.11.6", + "pterodactyl/panel": "<1.11.8", "ptheofan/yii2-statemachine": ">=2.0.0.0-RC1-dev,<=2", "ptrofimov/beanstalk_console": "<1.7.14", "pubnub/pubnub": "<6.1", @@ -4589,7 +4590,7 @@ "type": "tidelift" } ], - "time": "2024-10-18T15:05:15+00:00" + "time": "2024-10-24T22:04:53+00:00" }, { "name": "shipmonk/composer-dependency-analyser", diff --git a/app/vendor/composer/installed.json b/app/vendor/composer/installed.json index 2a3b3caef..f4cd9ad0d 100644 --- a/app/vendor/composer/installed.json +++ b/app/vendor/composer/installed.json @@ -968,17 +968,17 @@ }, { "name": "nette/forms", - "version": "v3.2.4", - "version_normalized": "3.2.4.0", + "version": "v3.2.5", + "version_normalized": "3.2.5.0", "source": { "type": "git", "url": "https://github.com/nette/forms.git", - "reference": "e61535036669a78bcafb061dcfa46da827fcf377" + "reference": "7e59cee3a16e0382f83680c94babb85a0a167dd0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/forms/zipball/e61535036669a78bcafb061dcfa46da827fcf377", - "reference": "e61535036669a78bcafb061dcfa46da827fcf377", + "url": "https://api.github.com/repos/nette/forms/zipball/7e59cee3a16e0382f83680c94babb85a0a167dd0", + "reference": "7e59cee3a16e0382f83680c94babb85a0a167dd0", "shasum": "" }, "require": { @@ -1001,7 +1001,7 @@ "suggest": { "ext-intl": "to use date/time controls" }, - "time": "2024-08-05T23:11:27+00:00", + "time": "2024-10-22T18:42:14+00:00", "type": "library", "extra": { "branch-alias": { @@ -1042,7 +1042,7 @@ ], "support": { "issues": "https://github.com/nette/forms/issues", - "source": "https://github.com/nette/forms/tree/v3.2.4" + "source": "https://github.com/nette/forms/tree/v3.2.5" }, "install-path": "../nette/forms" }, @@ -1622,27 +1622,27 @@ }, { "name": "nette/tester", - "version": "v2.5.3", - "version_normalized": "2.5.3.0", + "version": "v2.5.4", + "version_normalized": "2.5.4.0", "source": { "type": "git", "url": "https://github.com/nette/tester.git", - "reference": "ee0a4b8402a8c1831db547ec0a56d18196906b51" + "reference": "c11863785779e87b40adebf150364f2e5938c111" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/tester/zipball/ee0a4b8402a8c1831db547ec0a56d18196906b51", - "reference": "ee0a4b8402a8c1831db547ec0a56d18196906b51", + "url": "https://api.github.com/repos/nette/tester/zipball/c11863785779e87b40adebf150364f2e5938c111", + "reference": "c11863785779e87b40adebf150364f2e5938c111", "shasum": "" }, "require": { - "php": "8.0 - 8.3" + "php": "8.0 - 8.4" }, "require-dev": { "ext-simplexml": "*", "phpstan/phpstan": "^1.0" }, - "time": "2024-06-18T18:44:12+00:00", + "time": "2024-10-23T23:57:10+00:00", "bin": [ "src/tester" ], @@ -1694,7 +1694,7 @@ ], "support": { "issues": "https://github.com/nette/tester/issues", - "source": "https://github.com/nette/tester/tree/v2.5.3" + "source": "https://github.com/nette/tester/tree/v2.5.4" }, "install-path": "../nette/tester" }, @@ -2588,12 +2588,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "2db4b93f047a03be06ec0a890d252e1c8c635f74" + "reference": "bae581ca4125f92b1ad4d316ac691fa2d5231649" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/2db4b93f047a03be06ec0a890d252e1c8c635f74", - "reference": "2db4b93f047a03be06ec0a890d252e1c8c635f74", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/bae581ca4125f92b1ad4d316ac691fa2d5231649", + "reference": "bae581ca4125f92b1ad4d316ac691fa2d5231649", "shasum": "" }, "conflict": { @@ -2601,7 +2601,7 @@ "admidio/admidio": "<4.3.12", "adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3", "aheinze/cockpit": "<2.2", - "aimeos/ai-admin-graphql": ">=2022.04.1,<2022.10.10|>=2023.04.1,<2023.10.6|>=2024.04.1,<2024.04.6", + "aimeos/ai-admin-graphql": ">=2022.04.1,<2022.10.10|>=2023.04.1,<2023.10.6|>=2024.04.1,<2024.07.2", "aimeos/ai-admin-jsonadm": "<2020.10.13|>=2021.04.1,<2021.10.6|>=2022.04.1,<2022.10.3|>=2023.04.1,<2023.10.4|==2024.04.1", "aimeos/ai-client-html": ">=2020.04.1,<2020.10.27|>=2021.04.1,<2021.10.22|>=2022.04.1,<2022.10.13|>=2023.04.1,<2023.10.15|>=2024.04.1,<2024.04.7", "aimeos/ai-controller-frontend": "<2020.10.15|>=2021.04.1,<2021.10.8|>=2022.04.1,<2022.10.8|>=2023.04.1,<2023.10.9|==2024.04.1", @@ -2645,7 +2645,7 @@ "barrelstrength/sprout-forms": "<3.9", "barryvdh/laravel-translation-manager": "<0.6.2", "barzahlen/barzahlen-php": "<2.0.1", - "baserproject/basercms": "<5.0.9", + "baserproject/basercms": "<=5.1.1", "bassjobsen/bootstrap-3-typeahead": ">4.0.2", "bbpress/bbpress": "<2.6.5", "bcosca/fatfree": "<3.7.2", @@ -2813,7 +2813,7 @@ "froxlor/froxlor": "<=2.2.0.0-RC3", "frozennode/administrator": "<=5.0.12", "fuel/core": "<1.8.1", - "funadmin/funadmin": "<=3.2|>=3.3.2,<=3.3.3", + "funadmin/funadmin": "<=5.0.2", "gaoming13/wechat-php-sdk": "<=1.10.2", "genix/cms": "<=1.1.11", "getformwork/formwork": "<1.13.1|==2.0.0.0-beta1", @@ -2930,6 +2930,7 @@ "lms/routes": "<2.1.1", "localizationteam/l10nmgr": "<7.4|>=8,<8.7|>=9,<9.2", "luyadev/yii-helpers": "<1.2.1", + "maestroerror/php-heic-to-jpg": "<1.0.5", "magento/community-edition": "<2.4.5|==2.4.5|>=2.4.5.0-patch1,<2.4.5.0-patch10|==2.4.6|>=2.4.6.0-patch1,<2.4.6.0-patch8|>=2.4.7.0-beta1,<2.4.7.0-patch3", "magento/core": "<=1.9.4.5", "magento/magento1ce": "<1.9.4.3-dev", @@ -3090,7 +3091,7 @@ "processwire/processwire": "<=3.0.229", "propel/propel": ">=2.0.0.0-alpha1,<=2.0.0.0-alpha7", "propel/propel1": ">=1,<=1.7.1", - "pterodactyl/panel": "<1.11.6", + "pterodactyl/panel": "<1.11.8", "ptheofan/yii2-statemachine": ">=2.0.0.0-RC1-dev,<=2", "ptrofimov/beanstalk_console": "<1.7.14", "pubnub/pubnub": "<6.1", @@ -3376,7 +3377,7 @@ "zfr/zfr-oauth2-server-module": "<0.1.2", "zoujingli/thinkadmin": "<=6.1.53" }, - "time": "2024-10-18T15:05:15+00:00", + "time": "2024-10-24T22:04:53+00:00", "default-branch": true, "type": "metapackage", "notification-url": "https://packagist.org/downloads/", diff --git a/app/vendor/composer/installed.php b/app/vendor/composer/installed.php index 7cb2c8c23..aec607d07 100644 --- a/app/vendor/composer/installed.php +++ b/app/vendor/composer/installed.php @@ -170,9 +170,9 @@ ), ), 'nette/forms' => array( - 'pretty_version' => 'v3.2.4', - 'version' => '3.2.4.0', - 'reference' => 'e61535036669a78bcafb061dcfa46da827fcf377', + 'pretty_version' => 'v3.2.5', + 'version' => '3.2.5.0', + 'reference' => '7e59cee3a16e0382f83680c94babb85a0a167dd0', 'type' => 'library', 'install_path' => __DIR__ . '/../nette/forms', 'aliases' => array(), @@ -251,9 +251,9 @@ 'dev_requirement' => false, ), 'nette/tester' => array( - 'pretty_version' => 'v2.5.3', - 'version' => '2.5.3.0', - 'reference' => 'ee0a4b8402a8c1831db547ec0a56d18196906b51', + 'pretty_version' => 'v2.5.4', + 'version' => '2.5.4.0', + 'reference' => 'c11863785779e87b40adebf150364f2e5938c111', 'type' => 'library', 'install_path' => __DIR__ . '/../nette/tester', 'aliases' => array(), @@ -421,7 +421,7 @@ 'roave/security-advisories' => array( 'pretty_version' => 'dev-latest', 'version' => 'dev-latest', - 'reference' => '2db4b93f047a03be06ec0a890d252e1c8c635f74', + 'reference' => 'bae581ca4125f92b1ad4d316ac691fa2d5231649', 'type' => 'metapackage', 'install_path' => null, 'aliases' => array( diff --git a/app/vendor/nette/forms/examples/basic-example.php b/app/vendor/nette/forms/examples/basic-example.php index d83d59817..b7074fbd4 100644 --- a/app/vendor/nette/forms/examples/basic-example.php +++ b/app/vendor/nette/forms/examples/basic-example.php @@ -123,7 +123,7 @@ Nette Forms basic example - +

Nette Forms basic example

diff --git a/app/vendor/nette/forms/examples/custom-control.php b/app/vendor/nette/forms/examples/custom-control.php index 55f1e09e3..84f33732c 100644 --- a/app/vendor/nette/forms/examples/custom-control.php +++ b/app/vendor/nette/forms/examples/custom-control.php @@ -128,7 +128,7 @@ public static function validateDate(Nette\Forms\Control $control): bool Nette Forms custom control example - +

Nette Forms custom control example

diff --git a/app/vendor/nette/forms/examples/custom-rendering.php b/app/vendor/nette/forms/examples/custom-rendering.php index 46d650997..360333b9d 100644 --- a/app/vendor/nette/forms/examples/custom-rendering.php +++ b/app/vendor/nette/forms/examples/custom-rendering.php @@ -118,7 +118,7 @@ background: #EEE; } - +

Nette Forms custom rendering example

diff --git a/app/vendor/nette/forms/examples/custom-validator.php b/app/vendor/nette/forms/examples/custom-validator.php index cf4ee5bea..ff733fcb8 100644 --- a/app/vendor/nette/forms/examples/custom-validator.php +++ b/app/vendor/nette/forms/examples/custom-validator.php @@ -49,7 +49,7 @@ public static function divisibilityValidator($item, $arg): bool Nette Forms custom validator example - + +

Nette Forms and HTML5

diff --git a/app/vendor/nette/forms/examples/live-validation.php b/app/vendor/nette/forms/examples/live-validation.php index c475519ed..63cf43480 100644 --- a/app/vendor/nette/forms/examples/live-validation.php +++ b/app/vendor/nette/forms/examples/live-validation.php @@ -52,7 +52,7 @@ Nette Forms live validation example - + +

Nette Forms localization example

diff --git a/app/vendor/nette/forms/examples/manual-rendering.php b/app/vendor/nette/forms/examples/manual-rendering.php index d63d39896..1a02e171d 100644 --- a/app/vendor/nette/forms/examples/manual-rendering.php +++ b/app/vendor/nette/forms/examples/manual-rendering.php @@ -48,7 +48,7 @@ Nette Forms manual form rendering - + diff --git a/app/vendor/nette/forms/src/Forms/Container.php b/app/vendor/nette/forms/src/Forms/Container.php index 5a5fcde1d..ceb812614 100644 --- a/app/vendor/nette/forms/src/Forms/Container.php +++ b/app/vendor/nette/forms/src/Forms/Container.php @@ -354,9 +354,13 @@ public function addTextArea( /** * Adds input for email. */ - public function addEmail(string $name, string|Stringable|null $label = null): Controls\TextInput + public function addEmail( + string $name, + string|Stringable|null $label = null, + int $maxLength = 255, + ): Controls\TextInput { - return $this[$name] = (new Controls\TextInput($label)) + return $this[$name] = (new Controls\TextInput($label, $maxLength)) ->addRule(Form::Email); } @@ -573,7 +577,7 @@ public function addContainer(string|int $name): self /********************* extension methods ****************d*g**/ - public function __call(string $name, array $args): mixed + public function __call(string $name, array $args) { if (isset(self::$extMethods[$name])) { return (self::$extMethods[$name])($this, ...$args); diff --git a/app/vendor/nette/forms/src/Forms/Controls/BaseControl.php b/app/vendor/nette/forms/src/Forms/Controls/BaseControl.php index 641102755..35f521b99 100644 --- a/app/vendor/nette/forms/src/Forms/Controls/BaseControl.php +++ b/app/vendor/nette/forms/src/Forms/Controls/BaseControl.php @@ -557,7 +557,7 @@ public function getOptions(): array /********************* extension methods ****************d*g**/ - public function __call(string $name, array $args): mixed + public function __call(string $name, array $args) { $class = static::class; do { diff --git a/app/vendor/nette/forms/src/Forms/Controls/CheckboxList.php b/app/vendor/nette/forms/src/Forms/Controls/CheckboxList.php index 8b2bcc41d..2178f4e77 100644 --- a/app/vendor/nette/forms/src/Forms/Controls/CheckboxList.php +++ b/app/vendor/nette/forms/src/Forms/Controls/CheckboxList.php @@ -46,9 +46,6 @@ public function loadHttpData(): void ? $this->getHttpData(Nette\Forms\Form::DataText) : explode(',', $data); $this->value = array_keys(array_flip($data)); - if (is_array($this->disabled)) { - $this->value = array_diff($this->value, array_keys($this->disabled)); - } } diff --git a/app/vendor/nette/forms/src/Forms/Controls/ChoiceControl.php b/app/vendor/nette/forms/src/Forms/Controls/ChoiceControl.php index 382290318..e9994a8a2 100644 --- a/app/vendor/nette/forms/src/Forms/Controls/ChoiceControl.php +++ b/app/vendor/nette/forms/src/Forms/Controls/ChoiceControl.php @@ -35,12 +35,8 @@ public function __construct($label = null, ?array $items = null) public function loadHttpData(): void { - $this->value = $this->getHttpData(Nette\Forms\Form::DataText); - if ($this->value !== null) { - $this->value = is_array($this->disabled) && isset($this->disabled[$this->value]) - ? null - : key([$this->value => null]); - } + $value = $this->getHttpData(Nette\Forms\Form::DataText); + $this->value = $value === null ? null : key([$value => null]); } @@ -57,11 +53,7 @@ public function setValue($value) } if ($this->checkDefaultValue && $value !== null && !array_key_exists((string) $value, $this->items)) { - $set = Nette\Utils\Strings::truncate( - implode(', ', array_map(fn($s) => var_export($s, return: true), array_keys($this->items))), - 70, - '...', - ); + $set = Nette\Utils\Strings::truncate(implode(', ', array_map(fn($s) => var_export($s, return: true), array_keys($this->items))), 70, '...'); throw new Nette\InvalidArgumentException("Value '$value' is out of allowed set [$set] in field '{$this->getName()}'."); } @@ -77,6 +69,7 @@ public function setValue($value) public function getValue(): mixed { return array_key_exists($this->value, $this->items) + && !isset($this->disabled[$this->value]) ? $this->value : null; } @@ -141,10 +134,6 @@ public function setDisabled(bool|array $value = true): static parent::setDisabled(false); $this->disabled = array_fill_keys($value, value: true); - if (isset($this->disabled[$this->value])) { - $this->value = null; - } - return $this; } diff --git a/app/vendor/nette/forms/src/Forms/Controls/MultiChoiceControl.php b/app/vendor/nette/forms/src/Forms/Controls/MultiChoiceControl.php index a1aade76e..3f2ef3a7c 100644 --- a/app/vendor/nette/forms/src/Forms/Controls/MultiChoiceControl.php +++ b/app/vendor/nette/forms/src/Forms/Controls/MultiChoiceControl.php @@ -36,9 +36,6 @@ public function __construct($label = null, ?array $items = null) public function loadHttpData(): void { $this->value = array_keys(array_flip($this->getHttpData(Nette\Forms\Form::DataText))); - if (is_array($this->disabled)) { - $this->value = array_diff($this->value, array_keys($this->disabled)); - } } @@ -68,11 +65,7 @@ public function setValue($values) $values = array_keys($flip); if ($this->checkDefaultValue && ($diff = array_diff($values, array_keys($this->items)))) { - $set = Nette\Utils\Strings::truncate( - implode(', ', array_map(fn($s) => var_export($s, return: true), array_keys($this->items))), - 70, - '...', - ); + $set = Nette\Utils\Strings::truncate(implode(', ', array_map(fn($s) => var_export($s, return: true), array_keys($this->items))), 70, '...'); $vals = (count($diff) > 1 ? 's' : '') . " '" . implode("', '", $diff) . "'"; throw new Nette\InvalidArgumentException("Value$vals are out of allowed set [$set] in field '{$this->getName()}'."); } @@ -87,7 +80,7 @@ public function setValue($values) */ public function getValue(): array { - return array_values(array_intersect($this->value, array_keys($this->items))); + return array_keys($this->getSelectedItems()); } @@ -100,15 +93,6 @@ public function getRawValue(): array } - /** - * Is any item selected? - */ - public function isFilled(): bool - { - return $this->getValue() !== []; - } - - /** * Sets items from which to choose. * @return static @@ -134,7 +118,10 @@ public function getItems(): array */ public function getSelectedItems(): array { - return array_intersect_key($this->items, array_flip($this->value)); + $selected = array_intersect_key($this->items, array_flip($this->value)); + return is_array($this->disabled) + ? array_diff_key($selected, $this->disabled) + : $selected; } @@ -149,7 +136,6 @@ public function setDisabled(bool|array $value = true): static parent::setDisabled(false); $this->disabled = array_fill_keys($value, value: true); - $this->value = array_diff($this->value, $value); return $this; } diff --git a/app/vendor/nette/forms/src/Forms/Controls/SelectBox.php b/app/vendor/nette/forms/src/Forms/Controls/SelectBox.php index 7207c2c2d..6f50e8822 100644 --- a/app/vendor/nette/forms/src/Forms/Controls/SelectBox.php +++ b/app/vendor/nette/forms/src/Forms/Controls/SelectBox.php @@ -102,7 +102,7 @@ public function getControl(): Nette\Utils\Html if ($this->prompt !== false) { $promptKey = ''; while (isset($items[$promptKey])) { - $promptKey .= "\x1"; + $promptKey .= "\t"; } $items = [$promptKey => $this->translate($this->prompt)] + $items; if ($this->isRequired()) { diff --git a/app/vendor/nette/forms/src/Forms/Form.php b/app/vendor/nette/forms/src/Forms/Form.php index df1a503b1..7a345df20 100644 --- a/app/vendor/nette/forms/src/Forms/Form.php +++ b/app/vendor/nette/forms/src/Forms/Form.php @@ -473,7 +473,6 @@ public function getHttpData(?int $type = null, ?string $htmlName = null): string return $htmlName === null ? $this->httpData : Helpers::extractHttpData($this->httpData, $htmlName, $type); - } diff --git a/app/vendor/nette/forms/src/assets/formValidator.ts b/app/vendor/nette/forms/src/assets/formValidator.ts index dc049588a..7718ebffc 100644 --- a/app/vendor/nette/forms/src/assets/formValidator.ts +++ b/app/vendor/nette/forms/src/assets/formValidator.ts @@ -161,8 +161,8 @@ export class FormValidator { this.formErrors = []; - if (form['nette-submittedBy'] && form['nette-submittedBy'].getAttribute('formnovalidate') !== null) { - let scopeArr = JSON.parse(form['nette-submittedBy'].getAttribute('data-nette-validation-scope') ?? '[]') as string[]; + if (sender.getAttribute('formnovalidate') !== null) { + let scopeArr = JSON.parse(sender.getAttribute('data-nette-validation-scope') ?? '[]') as string[]; if (scopeArr.length) { scope = new RegExp('^(' + scopeArr.join('-|') + '-)'); } else { @@ -437,7 +437,7 @@ export class FormValidator { form.noValidate = true; form.addEventListener('submit', (e) => { - if (!this.validateForm(form)) { + if (!this.validateForm(form.submitter || form)) { e.stopPropagation(); e.preventDefault(); } @@ -453,17 +453,6 @@ export class FormValidator { this.#onDocumentReady(() => { Array.from(document.forms) .forEach((form) => this.initForm(form)); - - document.body.addEventListener('click', (e) => { - let target = e.target as FormElement; - while (target) { - if (target.form && target.type in { submit: 1, image: 1 }) { - target.form['nette-submittedBy'] = target; - break; - } - target = target.parentNode as FormElement; - } - }); }); } } diff --git a/app/vendor/nette/forms/src/assets/netteForms.js b/app/vendor/nette/forms/src/assets/netteForms.js index 4dffc008a..87ea45df7 100644 --- a/app/vendor/nette/forms/src/assets/netteForms.js +++ b/app/vendor/nette/forms/src/assets/netteForms.js @@ -299,8 +299,8 @@ validateForm(sender, onlyCheck = false) { let form = sender.form ?? sender, scope; this.formErrors = []; - if (form['nette-submittedBy'] && form['nette-submittedBy'].getAttribute('formnovalidate') !== null) { - let scopeArr = JSON.parse(form['nette-submittedBy'].getAttribute('data-nette-validation-scope') ?? '[]'); + if (sender.getAttribute('formnovalidate') !== null) { + let scopeArr = JSON.parse(sender.getAttribute('data-nette-validation-scope') ?? '[]'); if (scopeArr.length) { scope = new RegExp('^(' + scopeArr.join('-|') + '-)'); } @@ -519,7 +519,7 @@ } form.noValidate = true; form.addEventListener('submit', (e) => { - if (!this.validateForm(form)) { + if (!this.validateForm(form.submitter || form)) { e.stopPropagation(); e.preventDefault(); } @@ -532,16 +532,6 @@ this.#onDocumentReady(() => { Array.from(document.forms) .forEach((form) => this.initForm(form)); - document.body.addEventListener('click', (e) => { - let target = e.target; - while (target) { - if (target.form && target.type in { submit: 1, image: 1 }) { - target.form['nette-submittedBy'] = target; - break; - } - target = target.parentNode; - } - }); }); } } @@ -562,7 +552,7 @@ return res.replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, ''); } - var version = "3.5.0"; + var version = "3.5.1"; let nette = new FormValidator; nette.version = version; diff --git a/app/vendor/nette/forms/src/assets/netteForms.min.js b/app/vendor/nette/forms/src/assets/netteForms.min.js index ed3025cd9..ccb3f256c 100644 --- a/app/vendor/nette/forms/src/assets/netteForms.min.js +++ b/app/vendor/nette/forms/src/assets/netteForms.min.js @@ -4,4 +4,4 @@ * This file is part of the Nette Framework (https://nette.org) * Copyright (c) 2004 David Grudl (https://davidgrudl.com) */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self,e.Nette?.noInit?e.Nette=t():(e.Nette=t()).initOnLoad())}(this,(function(){"use strict";class e{filled(e,t,r){return""!==r&&!1!==r&&null!==r&&(!Array.isArray(r)||r.length>0)&&(!(r instanceof FileList)||r.length>0)}blank(e,t,r){return!this.filled(e,t,r)}valid(e,t){return t.validateControl(e,void 0,!0)}equal(e,t,r){if(void 0===t)return null;let n=e=>"number"==typeof e||"string"==typeof e?""+e:!0===e?"1":"",i=Array.isArray(r)?r:[r],l=Array.isArray(t)?t:[t];e:for(let e of i){for(let t of l)if(n(e)===n(t))continue e;return!1}return i.length>0}notEqual(e,t,r){return void 0===t?null:!this.equal(e,t,r)}minLength(e,t,r){return(r="number"==typeof r?r.toString():r).length>=t}maxLength(e,t,r){return(r="number"==typeof r?r.toString():r).length<=t}length(e,t,r){return r="number"==typeof r?r.toString():r,(null===(t=Array.isArray(t)?t:[t,t])[0]||r.length>=t[0])&&(null===t[1]||r.length<=t[1])}email(e,t,r){return/^("([ !#-[\]-~]|\\[ -~])+"|[-a-z0-9!#$%&'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*)@([0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)+[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?$/i.test(r)}url(e,t,r,n){return/^[a-z\d+.-]+:/.test(r)||(r="https://"+r),!!/^https?:\/\/((([-_0-9a-z\u00C0-\u02FF\u0370-\u1EFF]+\.)*[0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)?[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[[0-9a-f:]{3,39}\])(:\d{1,5})?(\/\S*)?$/i.test(r)&&(n.value=r,!0)}regexp(e,t,r){let n="string"==typeof t&&t.match(/^\/(.*)\/([imu]*)$/);try{return n&&new RegExp(n[1],n[2].replace("u","")).test(r)}catch{return null}}pattern(e,t,r,n,i){if("string"!=typeof t)return null;try{let e;try{e=new RegExp("^(?:"+t+")$",i?"ui":"u")}catch{e=new RegExp("^(?:"+t+")$",i?"i":"")}return r instanceof FileList?Array.from(r).every((t=>e.test(t.name))):e.test(r)}catch{return null}}patternCaseInsensitive(e,t,r){return this.pattern(e,t,r,null,!0)}numeric(e,t,r){return/^[0-9]+$/.test(r)}integer(e,t,r,n){return!!/^-?[0-9]+$/.test(r)&&(n.value=parseFloat(r),!0)}float(e,t,r,n){return r=r.replace(/ +/g,"").replace(/,/g,"."),!!/^-?[0-9]*\.?[0-9]+$/.test(r)&&(n.value=parseFloat(r),!0)}min(e,t,r){return Number.isFinite(t)&&(r=parseFloat(r)),r>=t}max(e,t,r){return Number.isFinite(t)&&(r=parseFloat(r)),r<=t}range(e,t,r){return Array.isArray(t)?"time"===e.type&&t[0]>t[1]?r>=t[0]||r<=t[1]:(null===t[0]||this.min(e,t[0],r))&&(null===t[1]||this.max(e,t[1],r)):null}submitted(e){return e.form["nette-submittedBy"]===e}fileSize(e,t,r){return Array.from(r).every((e=>e.size<=t))}mimeType(e,t,r){let n=[];(t=Array.isArray(t)?t:[t]).forEach((e=>n.push("^"+e.replace(/([^\w])/g,"\\$1").replace("\\*",".*")+"$")));let i=new RegExp(n.join("|"));return Array.from(r).every((e=>!e.type||i.test(e.type)))}image(e,t,r){return this.mimeType(e,t??["image/gif","image/png","image/jpeg","image/webp"],r)}static(e,t){return t}}let t={"á":"a","ä":"a","č":"c","ď":"d","é":"e","ě":"e","í":"i","ľ":"l","ň":"n","ó":"o","ô":"o","ř":"r","š":"s","ť":"t","ú":"u","ů":"u","ý":"y","ž":"z"};let r=new class{formErrors=[];validators=new e;#e={};#t={};#r=new WeakMap;#n(e,t){let r=e.elements.namedItem(t);return r instanceof RadioNodeList?r[0]:r}#i(e){let t=e.form.elements.namedItem(e.name);return t instanceof RadioNodeList?Array.from(t):[t]}#l(e){"loading"!==document.readyState?e.call(this):document.addEventListener("DOMContentLoaded",e)}getValue(e){return e instanceof HTMLInputElement?"radio"===e.type?this.#i(e).find((e=>e.checked))?.value??null:"file"===e.type?e.files:"checkbox"===e.type?e.name.endsWith("[]")?this.#i(e).filter((e=>e.checked)).map((e=>e.value)):e.checked:e.value.trim():e instanceof HTMLSelectElement?e.multiple?Array.from(e.selectedOptions,(e=>e.value)):e.selectedOptions[0]?.value??null:e instanceof HTMLTextAreaElement?e.value:e instanceof RadioNodeList?this.getValue(e[0]):null}getEffectiveValue(e,t=!1){let r=this.getValue(e);if(r===e.getAttribute("data-nette-empty-value")&&(r=""),t&&void 0===this.#e[e.name]){this.#e[e.name]=!0;let t={value:r};this.validateControl(e,void 0,!0,t),r=t.value,delete this.#e[e.name]}return r}validateControl(e,t,r=!1,n,i){t??=JSON.parse(e.getAttribute("data-nette-rules")??"[]"),n??={value:this.getEffectiveValue(e)},i??=!this.validateRule(e,":filled",null,n);for(let l of t){let t=l.op.match(/(~)?([^?]+)/),a=l.control?this.#n(e.form,l.control):e;if(l.neg=!!t[1],l.op=t[2],l.condition=!!l.rules,!a)continue;if(i&&!l.condition&&":filled"!==l.op)continue;let o=this.validateRule(a,l.op,l.arg,e===a?n:void 0);if(null!==o)if(l.neg&&(o=!o),l.condition&&o){if(!this.validateControl(e,l.rules,r,n,":blank"!==l.op&&i))return!1}else if(!l.condition&&!o){if(this.isDisabled(a))continue;if(!r){let t=Array.isArray(l.arg)?l.arg:[l.arg],r=l.msg.replace(/%(value|\d+)/g,((r,n)=>this.getValue("value"===n?a:e.form.elements.namedItem(t[n].control))));this.addError(a,r)}return!1}}return!0}validateForm(e,t=!1){let r,n=e.form??e;if(this.formErrors=[],n["nette-submittedBy"]&&null!==n["nette-submittedBy"].getAttribute("formnovalidate")){let e=JSON.parse(n["nette-submittedBy"].getAttribute("data-nette-validation-scope")??"[]");if(!e.length)return this.showFormErrors(n,[]),!0;r=new RegExp("^("+e.join("-|")+"-)")}for(let e of n.elements)if(e.willValidate&&e.validity.badInput)return e.reportValidity(),!1;for(let e of n.elements)if(e.getAttribute("data-nette-rules")&&(!r||e.name.replace(/]\[|\[|]|$/g,"-").match(r))&&!this.isDisabled(e)&&!this.validateControl(e,void 0,t)&&!this.formErrors.length)return!1;let i=!this.formErrors.length;return this.showFormErrors(n,this.formErrors),i}isDisabled(e){return"radio"===e.type?this.#i(e).every((e=>e.disabled)):e.disabled}addError(e,t){this.formErrors.push({element:e,message:t})}showFormErrors(e,t){let r,n=[];for(let e of t)n.indexOf(e.message)<0&&(n.push(e.message),r??=e.element);n.length&&this.showModal(n.join("\n"),(()=>{r?.focus()}))}showModal(e,t){let r=document.createElement("dialog");if(!r.showModal)return alert(e),void t();let n=document.createElement("style");n.innerText=".netteFormsModal { text-align: center; margin: auto; border: 2px solid black; padding: 1rem } .netteFormsModal button { padding: .1em 2em }";let i=document.createElement("button");i.innerText="OK",i.onclick=()=>{r.remove(),t()},r.setAttribute("class","netteFormsModal"),r.innerText=e+"\n\n",r.append(n,i),document.body.append(r),r.showModal()}validateRule(e,t,r,n){if(e.validity.badInput)return":filled"===t;n??={value:this.getEffectiveValue(e,!0)};let i=":"===t.charAt(0)?t.substring(1):t;i=i.replace("::","_").replaceAll("\\","");let l=Array.isArray(r)?r:[r];return l=l.map((t=>{if(t?.control){let r=this.#n(e.form,t.control);return r===e?n.value:this.getEffectiveValue(r,!0)}return t})),"valid"===i&&(l[0]=this),this.validators[i]?this.validators[i](e,Array.isArray(r)?l:l[0],n.value,n):null}toggleForm(e,t){this.#t={};for(let r of Array.from(e.elements))r.getAttribute("data-nette-rules")&&this.toggleControl(r,void 0,null,!t);for(let e in this.#t)this.toggle(e,this.#t[e].state,this.#t[e].elem,t)}toggleControl(e,t,r=null,n=!1,i,l){t??=JSON.parse(e.getAttribute("data-nette-rules")??"[]"),i??={value:this.getEffectiveValue(e)},l??=!this.validateRule(e,":filled",null,i);let a,o=!1;for(let s of t){let t=s.op.match(/(~)?([^?]+)/),u=s.control?this.#n(e.form,s.control):e;if(s.neg=!!t[1],s.op=t[2],s.condition=!!s.rules,u&&(!l||s.condition||":filled"===s.op)){if(a=r,!1!==r){if(a=this.validateRule(u,s.op,s.arg,e===u?i:void 0),null===a)continue;s.neg&&(a=!a),s.condition||(r=a)}if(s.condition&&this.toggleControl(e,s.rules,a,n,i,":blank"!==s.op&&l)||s.toggle){o=!0,n&&this.#i(u).filter((e=>!this.#r.has(e))).forEach((t=>{t.addEventListener("change",(t=>this.toggleForm(e.form,t))),this.#r.set(t,null)}));for(let t in s.toggle??{})this.#t[t]??={elem:e,state:!1},this.#t[t].state||=s.toggle[t]?!!a:!a}}}return o}toggle(e,t,r,n){/^\w[\w.:-]*$/.test(e)&&(e="#"+e),Array.from(document.querySelectorAll(e)).forEach((e=>e.hidden=!t))}compactCheckboxes(e,t){let r={};for(let n of e.elements)n instanceof HTMLInputElement&&"checkbox"===n.type&&n.name.endsWith("[]")&&n.checked&&!n.disabled&&(t.delete(n.name),r[n.name]??=[],r[n.name].push(n.value));for(let e in r)t.set(e.substring(0,e.length-2),r[e].join(","))}initForm(e){"get"===e.method&&e.hasAttribute("data-nette-compact")&&e.addEventListener("formdata",(t=>this.compactCheckboxes(e,t.formData))),Array.from(e.elements).some((e=>e.getAttribute("data-nette-rules")))&&(this.toggleForm(e),e.noValidate||(e.noValidate=!0,e.addEventListener("submit",(t=>{this.validateForm(e)||(t.stopPropagation(),t.preventDefault())})),e.addEventListener("reset",(()=>{setTimeout((()=>this.toggleForm(e)))}))))}initOnLoad(){this.#l((()=>{Array.from(document.forms).forEach((e=>this.initForm(e))),document.body.addEventListener("click",(e=>{let t=e.target;for(;t;){if(t.form&&t.type in{submit:1,image:1}){t.form["nette-submittedBy"]=t;break}t=t.parentNode}}))}))}};return r.version="3.5.0",r.webalize=function(e){e=e.toLowerCase();let r="";for(let n=0;n0)&&(!(r instanceof FileList)||r.length>0)}blank(e,t,r){return!this.filled(e,t,r)}valid(e,t){return t.validateControl(e,void 0,!0)}equal(e,t,r){if(void 0===t)return null;let n=e=>"number"==typeof e||"string"==typeof e?""+e:!0===e?"1":"",l=Array.isArray(r)?r:[r],i=Array.isArray(t)?t:[t];e:for(let e of l){for(let t of i)if(n(e)===n(t))continue e;return!1}return l.length>0}notEqual(e,t,r){return void 0===t?null:!this.equal(e,t,r)}minLength(e,t,r){return(r="number"==typeof r?r.toString():r).length>=t}maxLength(e,t,r){return(r="number"==typeof r?r.toString():r).length<=t}length(e,t,r){return r="number"==typeof r?r.toString():r,(null===(t=Array.isArray(t)?t:[t,t])[0]||r.length>=t[0])&&(null===t[1]||r.length<=t[1])}email(e,t,r){return/^("([ !#-[\]-~]|\\[ -~])+"|[-a-z0-9!#$%&'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*)@([0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)+[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?$/i.test(r)}url(e,t,r,n){return/^[a-z\d+.-]+:/.test(r)||(r="https://"+r),!!/^https?:\/\/((([-_0-9a-z\u00C0-\u02FF\u0370-\u1EFF]+\.)*[0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)?[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[[0-9a-f:]{3,39}\])(:\d{1,5})?(\/\S*)?$/i.test(r)&&(n.value=r,!0)}regexp(e,t,r){let n="string"==typeof t&&t.match(/^\/(.*)\/([imu]*)$/);try{return n&&new RegExp(n[1],n[2].replace("u","")).test(r)}catch{return null}}pattern(e,t,r,n,l){if("string"!=typeof t)return null;try{let e;try{e=new RegExp("^(?:"+t+")$",l?"ui":"u")}catch{e=new RegExp("^(?:"+t+")$",l?"i":"")}return r instanceof FileList?Array.from(r).every((t=>e.test(t.name))):e.test(r)}catch{return null}}patternCaseInsensitive(e,t,r){return this.pattern(e,t,r,null,!0)}numeric(e,t,r){return/^[0-9]+$/.test(r)}integer(e,t,r,n){return!!/^-?[0-9]+$/.test(r)&&(n.value=parseFloat(r),!0)}float(e,t,r,n){return r=r.replace(/ +/g,"").replace(/,/g,"."),!!/^-?[0-9]*\.?[0-9]+$/.test(r)&&(n.value=parseFloat(r),!0)}min(e,t,r){return Number.isFinite(t)&&(r=parseFloat(r)),r>=t}max(e,t,r){return Number.isFinite(t)&&(r=parseFloat(r)),r<=t}range(e,t,r){return Array.isArray(t)?"time"===e.type&&t[0]>t[1]?r>=t[0]||r<=t[1]:(null===t[0]||this.min(e,t[0],r))&&(null===t[1]||this.max(e,t[1],r)):null}submitted(e){return e.form["nette-submittedBy"]===e}fileSize(e,t,r){return Array.from(r).every((e=>e.size<=t))}mimeType(e,t,r){let n=[];(t=Array.isArray(t)?t:[t]).forEach((e=>n.push("^"+e.replace(/([^\w])/g,"\\$1").replace("\\*",".*")+"$")));let l=new RegExp(n.join("|"));return Array.from(r).every((e=>!e.type||l.test(e.type)))}image(e,t,r){return this.mimeType(e,t??["image/gif","image/png","image/jpeg","image/webp"],r)}static(e,t){return t}}let t={"á":"a","ä":"a","č":"c","ď":"d","é":"e","ě":"e","í":"i","ľ":"l","ň":"n","ó":"o","ô":"o","ř":"r","š":"s","ť":"t","ú":"u","ů":"u","ý":"y","ž":"z"};let r=new class{formErrors=[];validators=new e;#e={};#t={};#r=new WeakMap;#n(e,t){let r=e.elements.namedItem(t);return r instanceof RadioNodeList?r[0]:r}#l(e){let t=e.form.elements.namedItem(e.name);return t instanceof RadioNodeList?Array.from(t):[t]}#i(e){"loading"!==document.readyState?e.call(this):document.addEventListener("DOMContentLoaded",e)}getValue(e){return e instanceof HTMLInputElement?"radio"===e.type?this.#l(e).find((e=>e.checked))?.value??null:"file"===e.type?e.files:"checkbox"===e.type?e.name.endsWith("[]")?this.#l(e).filter((e=>e.checked)).map((e=>e.value)):e.checked:e.value.trim():e instanceof HTMLSelectElement?e.multiple?Array.from(e.selectedOptions,(e=>e.value)):e.selectedOptions[0]?.value??null:e instanceof HTMLTextAreaElement?e.value:e instanceof RadioNodeList?this.getValue(e[0]):null}getEffectiveValue(e,t=!1){let r=this.getValue(e);if(r===e.getAttribute("data-nette-empty-value")&&(r=""),t&&void 0===this.#e[e.name]){this.#e[e.name]=!0;let t={value:r};this.validateControl(e,void 0,!0,t),r=t.value,delete this.#e[e.name]}return r}validateControl(e,t,r=!1,n,l){t??=JSON.parse(e.getAttribute("data-nette-rules")??"[]"),n??={value:this.getEffectiveValue(e)},l??=!this.validateRule(e,":filled",null,n);for(let i of t){let t=i.op.match(/(~)?([^?]+)/),a=i.control?this.#n(e.form,i.control):e;if(i.neg=!!t[1],i.op=t[2],i.condition=!!i.rules,!a)continue;if(l&&!i.condition&&":filled"!==i.op)continue;let o=this.validateRule(a,i.op,i.arg,e===a?n:void 0);if(null!==o)if(i.neg&&(o=!o),i.condition&&o){if(!this.validateControl(e,i.rules,r,n,":blank"!==i.op&&l))return!1}else if(!i.condition&&!o){if(this.isDisabled(a))continue;if(!r){let t=Array.isArray(i.arg)?i.arg:[i.arg],r=i.msg.replace(/%(value|\d+)/g,((r,n)=>this.getValue("value"===n?a:e.form.elements.namedItem(t[n].control))));this.addError(a,r)}return!1}}return!0}validateForm(e,t=!1){let r,n=e.form??e;if(this.formErrors=[],null!==e.getAttribute("formnovalidate")){let t=JSON.parse(e.getAttribute("data-nette-validation-scope")??"[]");if(!t.length)return this.showFormErrors(n,[]),!0;r=new RegExp("^("+t.join("-|")+"-)")}for(let e of n.elements)if(e.willValidate&&e.validity.badInput)return e.reportValidity(),!1;for(let e of n.elements)if(e.getAttribute("data-nette-rules")&&(!r||e.name.replace(/]\[|\[|]|$/g,"-").match(r))&&!this.isDisabled(e)&&!this.validateControl(e,void 0,t)&&!this.formErrors.length)return!1;let l=!this.formErrors.length;return this.showFormErrors(n,this.formErrors),l}isDisabled(e){return"radio"===e.type?this.#l(e).every((e=>e.disabled)):e.disabled}addError(e,t){this.formErrors.push({element:e,message:t})}showFormErrors(e,t){let r,n=[];for(let e of t)n.indexOf(e.message)<0&&(n.push(e.message),r??=e.element);n.length&&this.showModal(n.join("\n"),(()=>{r?.focus()}))}showModal(e,t){let r=document.createElement("dialog");if(!r.showModal)return alert(e),void t();let n=document.createElement("style");n.innerText=".netteFormsModal { text-align: center; margin: auto; border: 2px solid black; padding: 1rem } .netteFormsModal button { padding: .1em 2em }";let l=document.createElement("button");l.innerText="OK",l.onclick=()=>{r.remove(),t()},r.setAttribute("class","netteFormsModal"),r.innerText=e+"\n\n",r.append(n,l),document.body.append(r),r.showModal()}validateRule(e,t,r,n){if(e.validity.badInput)return":filled"===t;n??={value:this.getEffectiveValue(e,!0)};let l=":"===t.charAt(0)?t.substring(1):t;l=l.replace("::","_").replaceAll("\\","");let i=Array.isArray(r)?r:[r];return i=i.map((t=>{if(t?.control){let r=this.#n(e.form,t.control);return r===e?n.value:this.getEffectiveValue(r,!0)}return t})),"valid"===l&&(i[0]=this),this.validators[l]?this.validators[l](e,Array.isArray(r)?i:i[0],n.value,n):null}toggleForm(e,t){this.#t={};for(let r of Array.from(e.elements))r.getAttribute("data-nette-rules")&&this.toggleControl(r,void 0,null,!t);for(let e in this.#t)this.toggle(e,this.#t[e].state,this.#t[e].elem,t)}toggleControl(e,t,r=null,n=!1,l,i){t??=JSON.parse(e.getAttribute("data-nette-rules")??"[]"),l??={value:this.getEffectiveValue(e)},i??=!this.validateRule(e,":filled",null,l);let a,o=!1;for(let s of t){let t=s.op.match(/(~)?([^?]+)/),u=s.control?this.#n(e.form,s.control):e;if(s.neg=!!t[1],s.op=t[2],s.condition=!!s.rules,u&&(!i||s.condition||":filled"===s.op)){if(a=r,!1!==r){if(a=this.validateRule(u,s.op,s.arg,e===u?l:void 0),null===a)continue;s.neg&&(a=!a),s.condition||(r=a)}if(s.condition&&this.toggleControl(e,s.rules,a,n,l,":blank"!==s.op&&i)||s.toggle){o=!0,n&&this.#l(u).filter((e=>!this.#r.has(e))).forEach((t=>{t.addEventListener("change",(t=>this.toggleForm(e.form,t))),this.#r.set(t,null)}));for(let t in s.toggle??{})this.#t[t]??={elem:e,state:!1},this.#t[t].state||=s.toggle[t]?!!a:!a}}}return o}toggle(e,t,r,n){/^\w[\w.:-]*$/.test(e)&&(e="#"+e),Array.from(document.querySelectorAll(e)).forEach((e=>e.hidden=!t))}compactCheckboxes(e,t){let r={};for(let n of e.elements)n instanceof HTMLInputElement&&"checkbox"===n.type&&n.name.endsWith("[]")&&n.checked&&!n.disabled&&(t.delete(n.name),r[n.name]??=[],r[n.name].push(n.value));for(let e in r)t.set(e.substring(0,e.length-2),r[e].join(","))}initForm(e){"get"===e.method&&e.hasAttribute("data-nette-compact")&&e.addEventListener("formdata",(t=>this.compactCheckboxes(e,t.formData))),Array.from(e.elements).some((e=>e.getAttribute("data-nette-rules")))&&(this.toggleForm(e),e.noValidate||(e.noValidate=!0,e.addEventListener("submit",(t=>{this.validateForm(e.submitter||e)||(t.stopPropagation(),t.preventDefault())})),e.addEventListener("reset",(()=>{setTimeout((()=>this.toggleForm(e)))}))))}initOnLoad(){this.#i((()=>{Array.from(document.forms).forEach((e=>this.initForm(e)))}))}};return r.version="3.5.1",r.webalize=function(e){e=e.toLowerCase();let r="";for(let n=0;n diff --git a/app/vendor/nette/tester/src/Framework/DataProvider.php b/app/vendor/nette/tester/src/Framework/DataProvider.php index f413c0710..ac59b3306 100644 --- a/app/vendor/nette/tester/src/Framework/DataProvider.php +++ b/app/vendor/nette/tester/src/Framework/DataProvider.php @@ -34,7 +34,7 @@ public static function load(string $file, string $query = ''): array throw new \Exception("Data provider '$file' did not return array or Traversable."); } } else { - $data = @parse_ini_file($file, process_sections: true); // @ is escalated to exception + $data = @parse_ini_file($file, true, INI_SCANNER_TYPED); // @ is escalated to exception if ($data === false) { throw new \Exception("Cannot parse data provider file '$file'."); } diff --git a/app/vendor/nette/tester/src/Runner/CliTester.php b/app/vendor/nette/tester/src/Runner/CliTester.php index 23790c921..3354615bd 100644 --- a/app/vendor/nette/tester/src/Runner/CliTester.php +++ b/app/vendor/nette/tester/src/Runner/CliTester.php @@ -26,7 +26,7 @@ class CliTester private ?string $stdoutFormat = null; - public function run(): ?int + public function run(): int { Environment::setupColors(); $this->setupErrors(); @@ -43,7 +43,7 @@ public function run(): ?int if ($cmd->isEmpty() || $this->options['--help']) { $cmd->help(); - return null; + return 0; } $this->createPhpInterpreter(); @@ -53,7 +53,7 @@ public function run(): ?int $job->setTempDirectory($this->options['--temp']); $job->run(); echo $job->getTest()->stdout; - return null; + return 0; } $runner = $this->createRunner(); @@ -74,7 +74,7 @@ public function run(): ?int if ($this->options['--watch']) { $this->watch($runner); - return null; + return 0; } $result = $runner->run(); @@ -94,7 +94,7 @@ private function loadOptions(): CommandLine echo <<<'XX' _____ ___ ___ _____ ___ ___ |_ _/ __)( __/_ _/ __)| _ ) - |_| \___ /___) |_| \___ |_|_\ v2.5.3 + |_| \___ /___) |_| \___ |_|_\ v2.5.4 XX; diff --git a/app/vendor/nette/tester/src/Runner/TestHandler.php b/app/vendor/nette/tester/src/Runner/TestHandler.php index ebd7574c6..a4a0f0414 100644 --- a/app/vendor/nette/tester/src/Runner/TestHandler.php +++ b/app/vendor/nette/tester/src/Runner/TestHandler.php @@ -176,7 +176,7 @@ private function initiateTestCase(Test $test, $foo, PhpInterpreter $interpreter) $methods = null; if ($this->tempDir) { - $cacheFile = $this->tempDir . DIRECTORY_SEPARATOR . 'TestHandler.testCase.' . substr(md5($test->getSignature()), 0, 5) . '.list'; + $cacheFile = $this->tempDir . DIRECTORY_SEPARATOR . 'TestHandler.testCase.' . md5($test->getSignature()) . '.list'; if (is_file($cacheFile)) { $cache = unserialize(file_get_contents($cacheFile)); @@ -229,7 +229,7 @@ private function initiateTestCase(Test $test, $foo, PhpInterpreter $interpreter) return array_map( fn(string $method): Test => $test - ->withTitle("$test->title $method") + ->withTitle(trim("$test->title $method")) ->withArguments(['method' => $method]), $methods, );