Skip to content

Commit

Permalink
feat: listplugin docs
Browse files Browse the repository at this point in the history
  • Loading branch information
awesthouse committed May 10, 2024
1 parent af27b61 commit 031ce77
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/dm-core-plugins/blueprints/list/docs/Documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Lists display information where objects listed are structured the same. In dm applications it's also a great way for user to navigate nested items and objects.

## Table of contents
- [Passing data](#passing-data)
- [Scope to list](#scope)
- [Headers](#headers)

## Passing data \{#passing-data}

### Scope to list \{#scope}
List expects an array of objects. Array is passed to the plugin by using the scope method in ViewConfig.
```json {4}
"viewConfig": {
"type": "CORE:ViewConfig",
"recipe": {},
"scope": "array_attribute_name"
}
```

### Headers \{#headers}
Select data fields by passing attribute name in `headers` config.
```json {3}
"config": {
"type": "PLUGINS:dm-core-plugins/table/ListPluginConfig",
"headers": ["first_name", "last_name", "age"]
}
```
100 changes: 100 additions & 0 deletions packages/dm-core-plugins/blueprints/list/docs/Examples/Basic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"title": "Basic List",
"description": "Minimal example for use of list plugin",
"note": "",
"showDemo": true,
"entityFilePrefix": "cars",
"blueprint": {
"name": "CarList",
"type": "dmss://system/SIMOS/Blueprint",
"attributes": [
{
"name": "type",
"type": "dmss://system/SIMOS/BlueprintAttribute",
"attributeType": "string"
},
{
"name": "name",
"type": "dmss://system/SIMOS/BlueprintAttribute",
"attributeType": "string"
},
{
"name": "cars",
"type": "dmss://system/SIMOS/BlueprintAttribute",
"attributeType": "./Car",
"dimensions": "*"
}
]
},
"entity": {
"type": "./CarList",
"cars": [
{
"_id": "volvo-in-car-list",
"name": "Volvo",
"type": "./Car",
"color": "White",
"model": "XC40"
},
{
"_id": "audi-in-car-list",
"name": "Audi",
"type": "./Car",
"color": "Black",
"model": "A2"
},
{
"_id": "bmw-in-car-list",
"name": "BMW",
"type": "./Car",
"color": "Blue",
"model": "X1"
}
]
},
"recipe": {
"name": "cars",
"type": "CORE:UiRecipe",
"description": "List of cars",
"plugin": "@development-framework/dm-core-plugins/list",
"config": {
"type": "PLUGINS:dm-core-plugins/list/ListPluginConfig",
"headers": ["name", "color", "model"]
}
},
"scope": "cars",
"childBlueprints": [
{
"name": "Car",
"type": "CORE:Blueprint",
"description": "",
"attributes": [
{
"name": "type",
"type": "dmss://system/SIMOS/BlueprintAttribute",
"attributeType": "string",
"optional": false
},
{
"name": "name",
"type": "CORE:BlueprintAttribute",
"attributeType": "string",
"label": "Manufacturer"
},
{
"name": "model",
"type": "CORE:BlueprintAttribute",
"attributeType": "string",
"label": "Model"
},
{
"name": "color",
"type": "CORE:BlueprintAttribute",
"attributeType": "string",
"label": "Color",
"optional": true
}
]
}
]
}

0 comments on commit 031ce77

Please sign in to comment.