Skip to content

Commit 12b87c3

Browse files
committed
update apijson document; remove custom_tcolumns_render_generator in apijson-viewedit; add custom_viewedit_componet block
1 parent b02a277 commit 12b87c3

File tree

3 files changed

+62
-4
lines changed

3 files changed

+62
-4
lines changed

demo/apps/apijson_demo/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def index():
106106
"@column":"id,username,nickname,email",
107107
"@order":"id-",
108108
"@role":"ADMIN",
109-
"@expr":[["username$","&","email$"],"&",["!","nickname$"]],,
109+
"@expr":[["username$","&","email$"],"&",["!","nickname$"]],
110110
"username$":"%b%",
111111
"nickname$":"%Admin%",
112112
"email$":"%local%"

uliweb_apijson/apijson/README.md

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
uliweb-apijson is a subset and slightly different variation of [apijson](https://github.com/TommyLemon/APIJSON/blob/master/Document.md)
44

5+
# Difference with original apijson
6+
7+
| feature | apijson(java) | uliweb-apijson | comment |
8+
| -------- | ------------- | -------------- | ------------------------------------------------------------ |
9+
| @combine | ✔️ | ✖️ | Example: "@combine":"&key0,&key1,\|key2,key3" |
10+
| @expr | ✖️ | ✔️ | Example: "@expr":[["username$","&","email$"],"&",["!","nickname$"]] |
11+
12+
13+
514
# apijson model configuration
615

716
## example
@@ -13,9 +22,16 @@ user = {
1322
"secret_fields" : ["password"],
1423
"GET" : { "roles" : ["ADMIN","OWNER"] },
1524
"HEAD" : { "roles" : ["ADMIN","OWNER"] },
16-
"POST" : { "roles" : ["ADMIN","OWNER"] },
25+
"POST" : { "roles" : ["ADMIN"] },
1726
"PUT" : { "roles" : ["ADMIN","OWNER"] },
18-
"DELETE" : { "roles" : ["ADMIN","OWNER"] },
27+
"DELETE" : { "roles" : ["ADMIN"] },
28+
}
29+
usergroup = {
30+
"GET" : { "roles" : ["ADMIN","LOGIN"] },
31+
"HEAD" : { "roles" : ["ADMIN"] },
32+
"POST" : { "roles" : ["ADMIN"] },
33+
"PUT" : { "roles" : ["ADMIN"] },
34+
"DELETE" : { "roles" : ["ADMIN"] },
1935
}
2036
```
2137

@@ -58,6 +74,48 @@ request types currently support: POST, PUT
5874

5975
request configuration currently support: ADD,DISALLOW,NECESSARY (still not fully support [all the configuration items](https://github.com/TommyLemon/APIJSON/wiki#%E5%AE%9E%E7%8E%B0%E5%8E%9F%E7%90%86))
6076

77+
# apijson table configuration
78+
79+
## example
80+
81+
```
82+
[APIJSON_TABLES]
83+
roles = {
84+
"@model_name" : "role",
85+
"editable" : "auto",
86+
"table_fields" : [
87+
{"title":"#","key":"id","width":80,"component":"id"},
88+
{"title":"Name","key":"name","component":"name_link"},
89+
{"title":"Description","key":"description"},
90+
{"title":"Is reserved","key":"reserve","component":"checkbox"},
91+
],
92+
"viewedit_fields" : [
93+
{"title":"#","key":"id","editable":False},
94+
{"title":"Name","key":"name"},
95+
{"title":"Description","key":"description"},
96+
{"title":"Is reserved","key":"reserve","component":"checkbox"},
97+
],
98+
"add_fields" : [
99+
{"title":"Name","key":"name"},
100+
{"title":"Description","key":"description"},
101+
{"title":"Is reserved","key":"reserve","component":"checkbox"},
102+
],
103+
}
104+
```
105+
106+
## document
107+
108+
Provide 2 vue component about table:
109+
110+
| | apijson-table | apijson-viewedit |
111+
| ----------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
112+
| uliweb template include | {{include "vue/inc_apijson_table.html"}} | {{include "vue/inc_apijson_viewedit.html"}} |
113+
| example: | ```<apijson-table model_name="permission" :config="tconfig" :custom_tcolumns_render_generator="custom_tcolumns_render_generator" ref="table"></apijson-table>``` | ```<apijson-viewedit model_name="permission" request_tag="{{=request_tag}}" :id="id_" :config="tconfig"></apijson-viewedit>``` |
114+
115+
116+
117+
118+
61119

62120
# Supported API Examples
63121

uliweb_apijson/apijson/templates/vue/inc_apijson_viewedit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"request_tag",
77
"id",
88
"config",
9-
"custom_tcolumns_render_generator",
109
"hook_init",
1110
"hook_ajax_params"
1211
],
@@ -16,6 +15,7 @@
1615
<i-input v-if="item.component=='input'" v-model="item.value" :readonly="!editable(item)"></i-input>
1716
<checkbox v-if="item.component=='checkbox'" v-model="item.value" :disabled="!editable(item)"></checkbox>
1817
<i-input v-if="item.component=='textarea'" v-model="item.value" type="textarea" :autosize="{minRows: 2,maxRows: 5}"></i-input>
18+
{{block custom_viewedit_componet}}{{end custom_viewedit_componet}}
1919
</form-item>
2020
<form-item v-if="config_editable" label="Action">
2121
<i-button type="info" icon="ios-download" size="large" @click="save">Save</i-button>

0 commit comments

Comments
 (0)