Table

View source code

View [code example](#complete example)

Write a JSON page description and place it in `tables` In the directory, a set of interfaces for data list, data display and data editing can be realized.

In a similar way, it is also possible to describe the analytical chart interface (charts directory), the dashboard interface ( kanban directory) and data screen interface (screens directory).

For special pages, you can write HTML The page, placed in the ui directory, can be displayed as a stand-alone interface or embedded in the management system through an iframe.

handler list

processDocumentationInstructions
xiang.table.SearchCode ExampleQuery by criteria, pagination.
xiang.table.FindCode ExampleQuery a single record by primary key.
xiang.table.SaveCode ExampleSave a single record, there is a primary key update, but there is no primary key create.
xiang.table.DeleteCode ExampleDelete a single record by primary key.
xiang.table.InsertCode ExampleAdd records in batches.
xiang.table.DeleteWhereCode ExampleBatch delete records that meet the conditions.
xiang.table.DeleteInCode ExampleBatch delete data of a specified set of primary keys Record.
xiang.table.UpdateWhereCode SampleBatch update eligible records.
xiang.table.UpdateInCode ExampleBatch update data of a specified set of primary keys Record.
xiang.table.QuickSaveCode ExampleSave multiple records, there is a primary key update, but it does not exist Primary key creation.
xiang.table.SettingCode exampleRead data table configuration information for front-end interface rendering
xiang.table.SelectRead data table configuration information for front-end interface rendering
xiang.table.Exportfor data import

API list

The data table provides a set of RESTFul APIs, and the data management interface calls these APIs to realize functional interaction such as adding, deleting, modifying, and querying data forms.

APIRequest MethodRoutingDescription
searchGET/api/xiang/table/<table name>/searchQuery by criteria, pagination.
selectGET/api/xiang/table/<table name>/selectList query, return the data format agreed by the select component.
findGET/api/xiang/table/<table name>/find/:idQuery a single record by primary key.
savePOST/api/xiang/table/<table name>/saveSave a single record, there is a primary key update, there is no primary key creation.
deletePOST/api/xiang/table/<table name>/delete/:idDelete a single record by primary key.
insertPOST/api/xiang/table/<table name>/insertBatch add records.
delete-wherePOST/api/xiang/table/<table name>/delete/whereBatch delete eligible records.
delete-inPOST/api/xiang/table/<table name>/delete/inBatch delete data records with a specified set of primary keys.
update-wherePOST/api/xiang/table/<table name>/update/whereBatch update eligible records.
update-inPOST/api/xiang/table/<table name>/update/inBatch update data records with a specified set of primary keys.
quicksavePOST/api/xiang/table/<table name>/quicksaveSave multiple records, there is a primary key update, there is no primary key creation.
settingGET/api/xiang/table/<table name>/settingRead data table configuration information for front-end interface rendering

Naming conventions

The data table description file is a JSON text file named lowercase English letters <name>.tab.json

Folder (relative to application model root directory)File nameTable nameAPI routing address
/name.tab.jsonname/api/xiang/table/name/admin interface
/group/name.tab.jsongorup.name/api/xiang/table/group.name/admin interface
/group1/group2/name.tab.jsongorup1.gorup2.name/api/xiang/table/group1.group2.name/admin interface

Document structure

The data table document consists of basic table information, data model binding, business structure mapping table, field mapping table, filter mapping table, list page, edit page, batch insert page and detail page.

{
"name": "Cloud Service Library",
"version": "1.0.0",
"bind": {},
"apis": {},
"columns": {},
"filters": {},
"list": {},
"edit": {},
"view": {},
"insert": {}
}
FieldsTypeDescriptionRequired Fields
nameStringdata table nameyes
versionStringVersion number, used for dependency check and development platform renderingyes
bindObject BindBind the data model.No
hooks[key:String]:StringData table HookNo
apis[key:String]:Object APIData management API settings. For example, if the binding data model is set, the data management API will be automatically generated according to the model information, and the automatically generated API can be overwritten by setting the configuration information of the same key.No
columns[key:String]:Object ColumnField rendering settings. If the binding data model is set, the associated components are automatically set according to the field type information, and the automatically generated associated component information can be overwritten by setting the configuration information of the same key.No
filters[key:String]:Object FilterQuery filter settings. For example, if the binding data model is set, the associated components are automatically set according to the index and field information, and the automatically generated associated component information can be overwritten by setting the configuration information of the same key.No
listObject PageList page settings.yes
editObject PageEdit page settings.yes
viewObject PageView page settings.No
insertObject PageBatch input page settings.No

basic information

{
"name": "User",
"title": "Trusted Cloud Cloud Service Library | Data Management",
"decription": "trusted cloud cloud service library"
}
FieldsTypeDescriptionRequired Fields
nameStringThe name of the data table, which can be used for rendering in the development platformyes
titleStringThe title of the page rendered by the browser bar when the data table page is openedno
decriptionStringData table introduction, can be used for rendering in the development platformNo

Binding data model bind

You can bind the data table to the data model by setting model and withs. After binding, the application engine will generate apis, columns and fliters configurations according to the data model definition. If you need special declarations, you can add special configuration information with the same key. You can also add fields in columns, fliters for rendering on each page.

{
"bind": {
"model": "service",
"withs": {
"manu": {
"query": {
"select": ["id", "name", "short_name", "status"]
}
},
"kind": {
"query": {
"select": ["id", "name"]
}
}
}
}
}
FieldsTypeDescriptionRequired Fields
modelStringBinding data model nameyes
withs[key:String]:Object WithData model associated query settings.No

handler list

Data table management interface apis

The data table will provide interfaces such as adding, deleting, modifying and checking, and completing data management operations through these interfaces. For example, if the binding data model is set, the data management API will be automatically generated according to the model information. By setting the configuration information of the same key, the automatically generated API can be overwritten. The API input and output data structure must be consistent with the original interface.

Object API data structure

{
"apis": {
"search": {
"process": "models.service.Paginate",
"guard": "bearer-jwt",
"default": [
{
"withs": {
"manu": {
"query": {
"select": ["id", "name", "short_name", "status"]
}
}
}
},
null,
15
]
},
"find": {
"process": "models.service.Find",
"default": [
null,
{
"withs": {
"manu": {
"query": {
"select": ["id", "name", "short_name", "status"]
}
}
}
}
]
},
"Management interface(key)": {
"process": "process name",
"guard": "-",
"default": []
}
}
}
FieldsTypeDescriptionRequired Fields
processStringBinding process (process) input and output data structures must be consistent with the original interfaceyes
guardStringInterface authentication middleware, multiple are separated by ,, set to -, no authentication middleware is set, and no default authentication mode is set.No
defaultArray<Any>The default value of the parameter table, if there is no default value, it can be set to null, such as [null, null, 15]No

Field rendering columns

It is possible to set the presentation method of fields in list rendering (view), list editing (edit) and edit form (form). Fields can be added freely and can be used in the rendering settings of each page. For example, if the binding data model is set, the corresponding presentation is automatically generated according to the field name and field type of the data model, and the automatically generated presentation information can be overwritten by setting the configuration information of the same key. Field rendering mapping table, which can be read from the setting interface.

{
"columns": {
"name": {
"label": "Service Name",
"view": {
"type": "label",
"props": {
"value": ":name"
}
},
"edit": {
"type": "input",
"props": {
"value": ":name"
}
},
"form": {
"type": "input",
"props": {
"value": ":name"
}
}
},
"manu.name": {
"label": "Manufacturer name",
"view": {
"type": "label",
"props": {
"value": ":manu.name"
}
}
},
"Manufacturer": {
"label": "Manufacturer",
"view": {
"name": "label",
"props": {
"value": ":manu.short_name"
}
},
"edit": {
"type": "select",
"props": {
"value": ":manu.id",
"searchable": true,
"remote": {
"api": "/api/manu/get",
"query": {
"select": ["id", "name"],
"keyword": "where_name_like"
}
}
}
}
}
}
}

Object Column data structure

FieldsTypeDescriptionRequired Fields
labelStringField name of field renderingyes
viewObject RenderList or view page, the components and properties used when reading the state, the default is labelno
editObject RenderList or view page, the components and properties used when editing the state, the default is inputno
formObject RenderEdit page, components and properties used, default is inputno

query filter fliters

You can add data query conditions to display by setting query filters. Query filters are freely added and can be used in listing page rendering settings. For example, if the binding data model is set, the corresponding configuration is automatically generated according to the data model index name and field information, and the automatically generated configuration information can be overwritten by setting the configuration information of the same key. Query filter mapping table, which can be read from the setting interface.

{
"filters": {
"Key words": {
"label": "Keyword",
"bind": "where.name.like",
"input": {
"type": "input",
"props": {
"placeholder": "Please enter a keyword"
}
}
},
"Manufacturer": {
"label": "Manufacturer",
"bind": "where.manu_id.in",
"input": {
"type": "select",
"props": {
"searchable": true,
"multiple": true,
"placeholder": "Please select the manufacturer",
"remote": {
"api": "/api/manu/get",
"query": {
"select": ["id", "name"],
"keyword": "where.name.like",
"limit": 500
}
}
}
}
}
}
}

Object Filter data structure

FieldsTypeDescriptionRequired Fields
labelStringfilter display nameyes
bindStringBinding query condition URL Query String Field name, such as where.manu_id.in (used as search API query parameter)yes
inputObject Renderquery content input component, default is inputno

2.6 List page list

.

{
"list": {
"primary": "id",
"layout": {
"columns": [
{ "name": "Service Name", "width": 6 },
{ "name": "Manufacturer", "width": 6 },
{ "name": "Service Type", "width": 4 }
],
"filters": [
{ "name": "keyword", "width": 6 },
{ "name": "Manufacturer", "width": 6 }
]
},
"actions": {
"create": {
"type": "button",
"props": {
"label": "New Service"
}
},
"view": {},
"edit": {},
"import": {},
"update": {},
"delete": {},
"insert": {},
"updateWhere": {},
"deleteWhere": {},
"updateSelect": {},
"deleteSelect": {},
"pagination": {
"type": "",
"props": {
"pages": true,
"prev": true,
"next": true
}
},
"setting": {}
}
}
}

layout (layout)

FieldTypeDescription
columnsArray<Object ColumnInstance | String >Columns that the data list can render
filtersArray<Object FilterInstance | String >renderable query filters
Object ColumnInstance data structure
FieldsTypeDescriptionRequired Fields
nameStringField name. Must have been defined in field rendering (columns).yes
widthIntegerColumn width. Use grid system, valid values ​​are 1-24. Default is 6no
Object FilterInstance data structure
FieldsTypeDescriptionRequired Fields
nameStringField name. Must have been defined in query filter mode (filters).yes
widthIntegerColumn width. Use grid system, valid values ​​are 1-24. Default is 6no

Functions (actions)

NameDescription
createNew data record button
viewView data record details button
editEdit data record form button
importImport data record button
exportExport data record button
updateUpdate a single field button
deleteDelete a single record button
insertBulk insert button
deleteWhereBatch delete button by condition
updateWhereBatch update button by condition
deleteSelectBatch delete the selected data record button
updateSelectBatch update selected data record button
paginationPagination
settingData table configuration button

Edit page edit

{
"edit": {
"primary": "id",
"layout": {
"groups": [
{
"title": "Basic Information",
"description": "",
"columns": [
{ "name": "Service Name", "width": 6 },
{ "name": "Manufacturer", "width": 6 },
{ "name": "Service Type", "width": 6 },
{ "name": "state", "width": 6 },
{ "name": "rank", "width": 6 }
]
},
{
"title": "Data Label",
"description": "",
"columns": ["Service Field", "Billing Method", "Industry Coverage"]
}
]
},
"actions": {
"cancel": {},
"save": {
"type": "button",
"props": {
"label": "Save"
}
},
"delete": {}
}
}
}

layout (layout)

FieldsTypeDescriptionRequired Fields
groupsArray<Object Group>Edit form field grouping listYes

Object Group data structure

FieldsTypeDescriptionRequired Fields
titleStringgroup nameno
descriptionStringGroup introductionno
columnsArray<Object ColumnInstance | String >Columns that the data list can render [ColumnInstance data structure](#Object%20ColumnInstance%20 data structure)yes

Functions (actions)

NameDescription
cancelCancel edit button
saveSave data button
deletedelete data button

View page view

Not implemented in this version

Batch entry page insert

Not implemented in this version

Object Render data structure

{
"type": "select",
"props": {
"value": "{{manu_id}}",
"searchable": true,
"remote": {
"api": "/api/manu/get",
"query": {
"select": ["id", "name"],
"keyword": "where.name.like"
}
}
}
}
FieldsTypeDescriptionRequired Fields
typeStringComponent name used View supported componentsyes
propsObject<Any>Component properties, see the corresponding component documentation for details. String, Number and Variable can be used in property parameters.No
componentsArray<Any>Composite component, referencing an atomic component name or description. ["Billing method", "Industry coverage", {"name":"Name", "props":{}}]No

Using variables in properties (props)

CanIn properties (props), you can use {{field name}} or :field name to refer to the current record data, support using . to access Object or Array type data, such as {{ field name.foo.bar}}, {{fieldname.0.foo}}, :fieldname.foo.bar, :fieldname.0.foo

Object Page data structure

{
"edit": {
"primary": "id",
"layout": {
"groups": [
{
"title": "Data Label",
"description": "",
"columns": ["Service Field", "Billing Method", "Industry Coverage"]
}
]
},
"actions": {
"cancel": {},
"save": {
"type": "button",
"props": {
"label": "Save"
}
},
"delete": {}
}
}
}
FieldsTypeDescriptionRequired Fields
primaryStringprimary key field nameyes
layout[key:String]:AnyOptional configuration items for page layout, which are different for each page and are defined in specific pages.yes
actions[key:String]:[key:String]:Object RenderThe mapping table of available page function rendering methods, which are different for each page and are defined in specific pages.No
option[key:String]:AnyPage configuration information, freely define as needed. API Setting is returned as is.No

Write a table preprocess, using Hooks

Table API input and output data can be processed using Hooks. Hooks are divided into two categories: before and after. Before hook, which runs before the API call, can be used to process incoming parameters, and after hook, which runs after the API call and can be used to process query results.

When describing the data table, in the hooks field, declare the handler associated with the Hook, for example:

{
"name": "Category",
"version": "1.0.0",
"decription": "Category",
"bind": { "model": "category" },
"hooks": {
"before:find": "flows.hooks.before_find",
"after:find": "flows.hooks.after_find",
"before:search": "flows.hooks.before_search",
"after:search": "flows.hooks.after_search",
"before:save": "flows.hooks.before_save",
"after:save": "flows.hooks.after_save"
},
"apis": {},
"columns": {}
}

Hooks List

HookDescriptionInputOutput Specification
before:findCalled before the Find handlerThe Find interface is passed in dataThe output result is used as the input parameter of the Find correlation handler
after:findCalled after the Find handlerFind interface associated with the handler execution resultCustom (output result as the final output of the Find handler)
before:searchCalled before the Search processPass in data through the Search interfaceOutput results as input parameters of the Search correlation process
after:searchCalled after the Search handlerSearch interface associated with the handler execution resultCustom (the output result is the final output of the Search handler)
before:saveCalled before the Save handlerThe Save interface is passed in dataThe output result is used as the input parameter of the Save associated handler
after:saveCalled after the Save handlerSave interface is associated with the execution result of the handlerCustom (the output result is the final output of the Save interface)

complete example

View source code

Example 2

Create a new book category table tables/category.tab.json code:

View source code

Table

View source code

View [code example](#complete example)

Write a JSON page description and place it in `tables` In the directory, a set of interfaces for data list, data display and data editing can be realized.

In a similar way, it is also possible to describe the analytical chart interface (charts directory), the dashboard interface ( kanban directory) and data screen interface (screens directory).

For special pages, you can write HTML The page, placed in the ui directory, can be displayed as a stand-alone interface or embedded in the management system through an iframe.

handler list

processDocumentationInstructions
xiang.table.SearchCode ExampleQuery by criteria, pagination.
xiang.table.FindCode ExampleQuery a single record by primary key.
xiang.table.SaveCode ExampleSave a single record, there is a primary key update, but there is no primary key create.
xiang.table.DeleteCode ExampleDelete a single record by primary key.
xiang.table.InsertCode ExampleAdd records in batches.
xiang.table.DeleteWhereCode ExampleBatch delete records that meet the conditions.
xiang.table.DeleteInCode ExampleBatch delete data of a specified set of primary keys Record.
xiang.table.UpdateWhereCode SampleBatch update eligible records.
xiang.table.UpdateInCode ExampleBatch update data of a specified set of primary keys Record.
xiang.table.QuickSaveCode ExampleSave multiple records, there is a primary key update, but it does not exist Primary key creation.
xiang.table.SettingCode exampleRead data table configuration information for front-end interface rendering
xiang.table.SelectRead data table configuration information for front-end interface rendering
xiang.table.Exportfor data import

API list

The data table provides a set of RESTFul APIs, and the data management interface calls these APIs to realize functional interaction such as adding, deleting, modifying, and querying data forms.

APIRequest MethodRoutingDescription
searchGET/api/xiang/table/<table name>/searchQuery by criteria, pagination.
selectGET/api/xiang/table/<table name>/selectList query, return the data format agreed by the select component.
findGET/api/xiang/table/<table name>/find/:idQuery a single record by primary key.
savePOST/api/xiang/table/<table name>/saveSave a single record, there is a primary key update, there is no primary key creation.
deletePOST/api/xiang/table/<table name>/delete/:idDelete a single record by primary key.
insertPOST/api/xiang/table/<table name>/insertBatch add records.
delete-wherePOST/api/xiang/table/<table name>/delete/whereBatch delete eligible records.
delete-inPOST/api/xiang/table/<table name>/delete/inBatch delete data records with a specified set of primary keys.
update-wherePOST/api/xiang/table/<table name>/update/whereBatch update eligible records.
update-inPOST/api/xiang/table/<table name>/update/inBatch update data records with a specified set of primary keys.
quicksavePOST/api/xiang/table/<table name>/quicksaveSave multiple records, there is a primary key update, there is no primary key creation.
settingGET/api/xiang/table/<table name>/settingRead data table configuration information for front-end interface rendering

Naming conventions

The data table description file is a JSON text file named lowercase English letters <name>.tab.json

Folder (relative to application model root directory)File nameTable nameAPI routing address
/name.tab.jsonname/api/xiang/table/name/admin interface
/group/name.tab.jsongorup.name/api/xiang/table/group.name/admin interface
/group1/group2/name.tab.jsongorup1.gorup2.name/api/xiang/table/group1.group2.name/admin interface

Document structure

The data table document consists of basic table information, data model binding, business structure mapping table, field mapping table, filter mapping table, list page, edit page, batch insert page and detail page.

{
"name": "Cloud Service Library",
"version": "1.0.0",
"bind": {},
"apis": {},
"columns": {},
"filters": {},
"list": {},
"edit": {},
"view": {},
"insert": {}
}
FieldsTypeDescriptionRequired Fields
nameStringdata table nameyes
versionStringVersion number, used for dependency check and development platform renderingyes
bindObject BindBind the data model.No
hooks[key:String]:StringData table HookNo
apis[key:String]:Object APIData management API settings. For example, if the binding data model is set, the data management API will be automatically generated according to the model information, and the automatically generated API can be overwritten by setting the configuration information of the same key.No
columns[key:String]:Object ColumnField rendering settings. If the binding data model is set, the associated components are automatically set according to the field type information, and the automatically generated associated component information can be overwritten by setting the configuration information of the same key.No
filters[key:String]:Object FilterQuery filter settings. For example, if the binding data model is set, the associated components are automatically set according to the index and field information, and the automatically generated associated component information can be overwritten by setting the configuration information of the same key.No
listObject PageList page settings.yes
editObject PageEdit page settings.yes
viewObject PageView page settings.No
insertObject PageBatch input page settings.No

basic information

{
"name": "User",
"title": "Trusted Cloud Cloud Service Library | Data Management",
"decription": "trusted cloud cloud service library"
}
FieldsTypeDescriptionRequired Fields
nameStringThe name of the data table, which can be used for rendering in the development platformyes
titleStringThe title of the page rendered by the browser bar when the data table page is openedno
decriptionStringData table introduction, can be used for rendering in the development platformNo

Binding data model bind

You can bind the data table to the data model by setting model and withs. After binding, the application engine will generate apis, columns and fliters configurations according to the data model definition. If you need special declarations, you can add special configuration information with the same key. You can also add fields in columns, fliters for rendering on each page.

{
"bind": {
"model": "service",
"withs": {
"manu": {
"query": {
"select": ["id", "name", "short_name", "status"]
}
},
"kind": {
"query": {
"select": ["id", "name"]
}
}
}
}
}
FieldsTypeDescriptionRequired Fields
modelStringBinding data model nameyes
withs[key:String]:Object WithData model associated query settings.No

handler list

Data table management interface apis

The data table will provide interfaces such as adding, deleting, modifying and checking, and completing data management operations through these interfaces. For example, if the binding data model is set, the data management API will be automatically generated according to the model information. By setting the configuration information of the same key, the automatically generated API can be overwritten. The API input and output data structure must be consistent with the original interface.

Object API data structure

{
"apis": {
"search": {
"process": "models.service.Paginate",
"guard": "bearer-jwt",
"default": [
{
"withs": {
"manu": {
"query": {
"select": ["id", "name", "short_name", "status"]
}
}
}
},
null,
15
]
},
"find": {
"process": "models.service.Find",
"default": [
null,
{
"withs": {
"manu": {
"query": {
"select": ["id", "name", "short_name", "status"]
}
}
}
}
]
},
"Management interface(key)": {
"process": "process name",
"guard": "-",
"default": []
}
}
}
FieldsTypeDescriptionRequired Fields
processStringBinding process (process) input and output data structures must be consistent with the original interfaceyes
guardStringInterface authentication middleware, multiple are separated by ,, set to -, no authentication middleware is set, and no default authentication mode is set.No
defaultArray<Any>The default value of the parameter table, if there is no default value, it can be set to null, such as [null, null, 15]No

Field rendering columns

It is possible to set the presentation method of fields in list rendering (view), list editing (edit) and edit form (form). Fields can be added freely and can be used in the rendering settings of each page. For example, if the binding data model is set, the corresponding presentation is automatically generated according to the field name and field type of the data model, and the automatically generated presentation information can be overwritten by setting the configuration information of the same key. Field rendering mapping table, which can be read from the setting interface.

{
"columns": {
"name": {
"label": "Service Name",
"view": {
"type": "label",
"props": {
"value": ":name"
}
},
"edit": {
"type": "input",
"props": {
"value": ":name"
}
},
"form": {
"type": "input",
"props": {
"value": ":name"
}
}
},
"manu.name": {
"label": "Manufacturer name",
"view": {
"type": "label",
"props": {
"value": ":manu.name"
}
}
},
"Manufacturer": {
"label": "Manufacturer",
"view": {
"name": "label",
"props": {
"value": ":manu.short_name"
}
},
"edit": {
"type": "select",
"props": {
"value": ":manu.id",
"searchable": true,
"remote": {
"api": "/api/manu/get",
"query": {
"select": ["id", "name"],
"keyword": "where_name_like"
}
}
}
}
}
}
}

Object Column data structure

FieldsTypeDescriptionRequired Fields
labelStringField name of field renderingyes
viewObject RenderList or view page, the components and properties used when reading the state, the default is labelno
editObject RenderList or view page, the components and properties used when editing the state, the default is inputno
formObject RenderEdit page, components and properties used, default is inputno

query filter fliters

You can add data query conditions to display by setting query filters. Query filters are freely added and can be used in listing page rendering settings. For example, if the binding data model is set, the corresponding configuration is automatically generated according to the data model index name and field information, and the automatically generated configuration information can be overwritten by setting the configuration information of the same key. Query filter mapping table, which can be read from the setting interface.

{
"filters": {
"Key words": {
"label": "Keyword",
"bind": "where.name.like",
"input": {
"type": "input",
"props": {
"placeholder": "Please enter a keyword"
}
}
},
"Manufacturer": {
"label": "Manufacturer",
"bind": "where.manu_id.in",
"input": {
"type": "select",
"props": {
"searchable": true,
"multiple": true,
"placeholder": "Please select the manufacturer",
"remote": {
"api": "/api/manu/get",
"query": {
"select": ["id", "name"],
"keyword": "where.name.like",
"limit": 500
}
}
}
}
}
}
}

Object Filter data structure

FieldsTypeDescriptionRequired Fields
labelStringfilter display nameyes
bindStringBinding query condition URL Query String Field name, such as where.manu_id.in (used as search API query parameter)yes
inputObject Renderquery content input component, default is inputno

2.6 List page list

.

{
"list": {
"primary": "id",
"layout": {
"columns": [
{ "name": "Service Name", "width": 6 },
{ "name": "Manufacturer", "width": 6 },
{ "name": "Service Type", "width": 4 }
],
"filters": [
{ "name": "keyword", "width": 6 },
{ "name": "Manufacturer", "width": 6 }
]
},
"actions": {
"create": {
"type": "button",
"props": {
"label": "New Service"
}
},
"view": {},
"edit": {},
"import": {},
"update": {},
"delete": {},
"insert": {},
"updateWhere": {},
"deleteWhere": {},
"updateSelect": {},
"deleteSelect": {},
"pagination": {
"type": "",
"props": {
"pages": true,
"prev": true,
"next": true
}
},
"setting": {}
}
}
}

layout (layout)

FieldTypeDescription
columnsArray<Object ColumnInstance | String >Columns that the data list can render
filtersArray<Object FilterInstance | String >renderable query filters
Object ColumnInstance data structure
FieldsTypeDescriptionRequired Fields
nameStringField name. Must have been defined in field rendering (columns).yes
widthIntegerColumn width. Use grid system, valid values ​​are 1-24. Default is 6no
Object FilterInstance data structure
FieldsTypeDescriptionRequired Fields
nameStringField name. Must have been defined in query filter mode (filters).yes
widthIntegerColumn width. Use grid system, valid values ​​are 1-24. Default is 6no

Functions (actions)

NameDescription
createNew data record button
viewView data record details button
editEdit data record form button
importImport data record button
exportExport data record button
updateUpdate a single field button
deleteDelete a single record button
insertBulk insert button
deleteWhereBatch delete button by condition
updateWhereBatch update button by condition
deleteSelectBatch delete the selected data record button
updateSelectBatch update selected data record button
paginationPagination
settingData table configuration button

Edit page edit

{
"edit": {
"primary": "id",
"layout": {
"groups": [
{
"title": "Basic Information",
"description": "",
"columns": [
{ "name": "Service Name", "width": 6 },
{ "name": "Manufacturer", "width": 6 },
{ "name": "Service Type", "width": 6 },
{ "name": "state", "width": 6 },
{ "name": "rank", "width": 6 }
]
},
{
"title": "Data Label",
"description": "",
"columns": ["Service Field", "Billing Method", "Industry Coverage"]
}
]
},
"actions": {
"cancel": {},
"save": {
"type": "button",
"props": {
"label": "Save"
}
},
"delete": {}
}
}
}

layout (layout)

FieldsTypeDescriptionRequired Fields
groupsArray<Object Group>Edit form field grouping listYes

Object Group data structure

FieldsTypeDescriptionRequired Fields
titleStringgroup nameno
descriptionStringGroup introductionno
columnsArray<Object ColumnInstance | String >Columns that the data list can render [ColumnInstance data structure](#Object%20ColumnInstance%20 data structure)yes

Functions (actions)

NameDescription
cancelCancel edit button
saveSave data button
deletedelete data button

View page view

Not implemented in this version

Batch entry page insert

Not implemented in this version

Object Render data structure

{
"type": "select",
"props": {
"value": "{{manu_id}}",
"searchable": true,
"remote": {
"api": "/api/manu/get",
"query": {
"select": ["id", "name"],
"keyword": "where.name.like"
}
}
}
}
FieldsTypeDescriptionRequired Fields
typeStringComponent name used View supported componentsyes
propsObject<Any>Component properties, see the corresponding component documentation for details. String, Number and Variable can be used in property parameters.No
componentsArray<Any>Composite component, referencing an atomic component name or description. ["Billing method", "Industry coverage", {"name":"Name", "props":{}}]No

Using variables in properties (props)

CanIn properties (props), you can use {{field name}} or :field name to refer to the current record data, support using . to access Object or Array type data, such as {{ field name.foo.bar}}, {{fieldname.0.foo}}, :fieldname.foo.bar, :fieldname.0.foo

Object Page data structure

{
"edit": {
"primary": "id",
"layout": {
"groups": [
{
"title": "Data Label",
"description": "",
"columns": ["Service Field", "Billing Method", "Industry Coverage"]
}
]
},
"actions": {
"cancel": {},
"save": {
"type": "button",
"props": {
"label": "Save"
}
},
"delete": {}
}
}
}
FieldsTypeDescriptionRequired Fields
primaryStringprimary key field nameyes
layout[key:String]:AnyOptional configuration items for page layout, which are different for each page and are defined in specific pages.yes
actions[key:String]:[key:String]:Object RenderThe mapping table of available page function rendering methods, which are different for each page and are defined in specific pages.No
option[key:String]:AnyPage configuration information, freely define as needed. API Setting is returned as is.No

Write a table preprocess, using Hooks

Table API input and output data can be processed using Hooks. Hooks are divided into two categories: before and after. Before hook, which runs before the API call, can be used to process incoming parameters, and after hook, which runs after the API call and can be used to process query results.

When describing the data table, in the hooks field, declare the handler associated with the Hook, for example:

{
"name": "Category",
"version": "1.0.0",
"decription": "Category",
"bind": { "model": "category" },
"hooks": {
"before:find": "flows.hooks.before_find",
"after:find": "flows.hooks.after_find",
"before:search": "flows.hooks.before_search",
"after:search": "flows.hooks.after_search",
"before:save": "flows.hooks.before_save",
"after:save": "flows.hooks.after_save"
},
"apis": {},
"columns": {}
}

Hooks List

HookDescriptionInputOutput Specification
before:findCalled before the Find handlerThe Find interface is passed in dataThe output result is used as the input parameter of the Find correlation handler
after:findCalled after the Find handlerFind interface associated with the handler execution resultCustom (output result as the final output of the Find handler)
before:searchCalled before the Search processPass in data through the Search interfaceOutput results as input parameters of the Search correlation process
after:searchCalled after the Search handlerSearch interface associated with the handler execution resultCustom (the output result is the final output of the Search handler)
before:saveCalled before the Save handlerThe Save interface is passed in dataThe output result is used as the input parameter of the Save associated handler
after:saveCalled after the Save handlerSave interface is associated with the execution result of the handlerCustom (the output result is the final output of the Save interface)

complete example

View source code

Example 2

Create a new book category table tables/category.tab.json code:

View source code