softinline / jcrud
使用 JSON 文件定义的 crud 方法,用于 datatables、编辑和添加操作
1.0.102
2024-07-19 14:27 UTC
Requires
- php: >=7.0
- dev-master
- 1.0.102
- 1.0.101
- 1.0.100
- 1.0.99
- 1.0.98
- 1.0.97
- 1.0.96
- 1.0.95
- 1.0.94
- 1.0.93
- 1.0.92
- 1.0.91
- 1.0.90
- 1.0.89
- 1.0.88
- 1.0.87
- 1.0.86
- 1.0.85
- 1.0.84
- 1.0.83
- 1.0.82
- 1.0.81
- 1.0.80
- 1.0.79
- 1.0.78
- 1.0.77
- 1.0.76
- 1.0.75
- 1.0.74
- 1.0.73
- 1.0.72
- 1.0.71
- 1.0.70
- 1.0.69
- 1.0.68
- 1.0.67
- 1.0.66
- 1.0.65
- 1.0.64
- 1.0.63
- 1.0.62
- 1.0.61
- 1.0.60
- 1.0.59
- 1.0.58
- 1.0.57
- 1.0.56
- 1.0.55
- 1.0.54
- 1.0.53
- 1.0.52
- 1.0.51
- 1.0.50
- 1.0.49
- 1.0.48
- 1.0.47
- 1.0.46
- 1.0.45
- 1.0.44
- 1.0.43
- 1.0.42
- 1.0.41
- 1.0.40
- 1.0.39
- 1.0.38
- 1.0.37
- 1.0.36
- 1.0.35
- 1.0.34
- 1.0.33
- 1.0.32
- 1.0.31
- 1.0.30
- 1.0.29
- 1.0.28
- 1.0.27
- 1.0.26
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.0
This package is auto-updated.
Last update: 2024-09-19 14:52:05 UTC
README
关于 Softinline jCrud
Softinline jCrud 是一个用于 CRUD 数据表和表单生成的包,您可以直接在 JSON 文件中定义,这些文件直接与控制器/模型链接,支持导出、选择行、添加更多按钮,所有这些功能都使用相同的样式。
组件
Softinline jCrud 是一组组件
- jConfig (加载配置文件) 并提供实时访问配置的 get/set 方法
- jTable (从 JSON 定义文件生成,可以显示不同的数据表,设置列、可排序、可搜索等...), 一个定义文件可以在不同的名称下存储多个列表,默认我们使用 'index' 列表
- jForm,这个类提供了关于准备具有不同标签、行和多种输入类型(文本、数字、日期时间、电子邮件、密码、编辑器、自定义、查看等...)的表单的功能
- jcrud.js(这个 JS 存储有关创建的表格、选择的行、在提交表单之前验证的功能等信息...)
jForm 字段类型
- custom -> call method in controller parent to show some div or HTML code
- file
- date
- datetime
- text
- number
- password
- email
- button -> execute the 'action' key on json defines (normally javascript onclick event)
- checkbox
- textarea
- editor -> replaced with ckeditor needed the plugin installed and initialized
- select -> call controller method defined in 'selector' key on json defines see samples
- select-multiple -> call controller allow multiple selection, controller must return array with 'all' and 'selected' elements
- checkbox-multiple -> same as select-multiple but in checkbox format
- json -> displays information in json field (array) using <pre>
- view -> call view and load, view receives the $config, $item, etc vars with information (see documentation)
***
- childrens -> if field element has a children method, the fields inside can be displayed using a validation method that returns true or not, for example if you want to display more fields depends on select response.
一些示例
您可以在 app/Defines (示例) 中定义您的文件,在您的控制器中,您可以使用 jConfig 类来加载您的定义文件,如下所示
var $_jconfig; /** * Create a new controller instance. * @return void */ public function __construct() { $this->_jconfig = new \Softinline\JCrud\JConfig(); $this->_jconfig->load(app_path().'/Defines/admin-users.json', 'admin-users'); }
This is a simple basic sample define for table users: { "admin-users":{ "model":"User", "title":"users", "titleCustom":false, "url":"admin/users", "layout":"layouts.other", "lists":{ "index":{ "wrapper":false, "datatable":true, "class":false, "name":"admin-users", "cols":[ { "name":"id", "field":"id", "orderable":true, "searchable":true }, { "name":"created_at", "field":"created_at", "orderable":true, "searchable":true }, { "name":"email", "field":"email", "orderable":true, "searchable":true }, { "name":"actions", "field":"actions", "orderable":false, "searchable":false } ], "actions":{ "add":true, "export":true, "selector":true }, "options":[ ["export", "fa fa-file", "js:crud.export"], ["reports", "fa fa-list", "link:admin/users/reports"] ], "rowCallBack":false, "drawCallBack":false } }, "forms":{ "add":{ "wrapper":false, "tabs":{ "general":{ "key":"general", "title":"general", "type":"form", "fields":[ { "type":"email", "required":true, "title":"email", "field":"email" }, { "type":"password", "required":false, "title":"password", "field":"password" } ], "extraButtons":[] }, "advanced":{ "key":"advanced", "title":"advanced", "type":"form", "fields":[ { "type":"textarea", "required":true, "title":"advanced1", "field":"advanced2" } ], "extraButtons":[] }, "images":{ "key":"images", "title":"images", "type":"form", "fields":[ { "type":"file", "required":true, "title":"file", "field":"file" } ], "extraButtons":[] } } }, "edit":{ "wrapper":false, "field_title":"email", "tabs":{ "general":{ "key":"general", "title":"general", "type":"form", "fields":[ { "type":"email", "required":true, "title":"email", "field":"email" }, { "type":"password", "required":false, "title":"password", "field":"password" } ], "extraButtons":[] } } } } } }
如果您想根据 Bootstrap 使用行和列,您可以使用特殊类型字段 'row',如下所示,每个都可以有 n 个不同类型的字段(文本、密码、编辑器、日期等...)
{
"type":"row",
"fields":[
{
"type":"text",
"required":false,
"title":"field1",
"field":"field1"
},
{
"type":"text",
"required":false,
"title":"field2",
"field":"field2"
},
]
}
许可
Softinline/JCrud 是开源软件,根据 MIT 许可证 许可。