becklyn / rad
用于在 Symfony 中使用的 RAD 相关功能。
8.6.1
2022-02-23 13:26 UTC
Requires
- php: >=7.4
- ext-json: *
- beberlei/doctrineextensions: ^1.3.0
- becklyn/rad-bundles: ^1.1.0
- doctrine/doctrine-bundle: ^2.3.2
- doctrine/orm: ^2.10.3
- psr/log: ^1.1.4
- scienta/doctrine-json-functions: ^4.5.0 || ^5.0.0
- symfony/config: ^5.4.3 || ^6.0.3
- symfony/dependency-injection: ^5.4.3 || ^6.0.3
- symfony/form: ^5.4.3 || ^6.0.3
- symfony/http-kernel: ^5.4.3 || ^6.0.4
- symfony/property-access: ^5.4.3 || ^6.0.3
- symfony/translation-contracts: ^v2.5.0 || ^v3.0.0
- symfony/validator: ^5.4.3 || ^6.0.3
- twig/twig: ^v3.3.4
Requires (Dev)
- algolia/search-bundle: ^5.2.1 || ^6.0.0
- roave/security-advisories: dev-master
- symfony/phpunit-bridge: ^5.4.3 || ^6.0.3
- symfony/twig-bridge: ^5.4.3 || ^6.0.3
Suggests
- symfony/twig-bridge: To use the default form theme.
Conflicts
README
此包为在 Symfony 中使用提供 RAD 相关功能。
⚠️ 新的 Composer 包名
此包已被重命名为 becklyn/rad
(v8.0 版本),从 becklyn/rad-bundle
更名。7.x 版本以下仍可在 becklyn/rad-bundle
下找到。
AJAX 协议
此包使用默认的 AJAX 协议,该协议在 AjaxResponseBuilder
中使用,也可用于您的项目。AJAX 调用将始终返回错误 200,因为它不应该使错误跟踪(错误 400 AJAX 请求)过载。
协议如下所示
interface AjaxResponse { /** * Whether the call succeeded. */ ok: boolean; /** * Any string status, like "ok" or "invalid-id" that * you can react to in your code (if you need to). */ status: string; /** * The response data. */ data: Record<number|string, any> | Array<any>; /** * A redirect target, where the AJAX handler should * redirect to. */ redirect?: string; /** * A toast message with optional type and action target. */ message?: { text: string; impact: "positive" | "negative" | "neutral"; action?: { label: string; url: string; }; }; }
在 mojave
中有相应的 fetch 客户端实现,可以使用。上述类型在 mojave
中也作为通用 TypeScript 类型提供。
表单扩展
此包自动添加几个表单扩展。
集合标签扩展
此扩展为 Collection
表单字段添加三个额外的可选标签
empty_message
在没有条目时显示。entry_add_label
是 "添加条目" 按钮的标签。entry_remove_label
是每个 "删除条目" 按钮的标签。