From 031ce77eb279096e3b8d4c7f79436dea71b9343e Mon Sep 17 00:00:00 2001 From: Andrea Vesterhus Date: Fri, 10 May 2024 12:18:59 +0200 Subject: [PATCH] feat: listplugin docs --- .../blueprints/list/docs/Documentation.md | 27 +++++ .../blueprints/list/docs/Examples/Basic.json | 100 ++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 packages/dm-core-plugins/blueprints/list/docs/Documentation.md create mode 100644 packages/dm-core-plugins/blueprints/list/docs/Examples/Basic.json diff --git a/packages/dm-core-plugins/blueprints/list/docs/Documentation.md b/packages/dm-core-plugins/blueprints/list/docs/Documentation.md new file mode 100644 index 000000000..aa0837458 --- /dev/null +++ b/packages/dm-core-plugins/blueprints/list/docs/Documentation.md @@ -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"] +} +``` \ No newline at end of file diff --git a/packages/dm-core-plugins/blueprints/list/docs/Examples/Basic.json b/packages/dm-core-plugins/blueprints/list/docs/Examples/Basic.json new file mode 100644 index 000000000..6b07ccf21 --- /dev/null +++ b/packages/dm-core-plugins/blueprints/list/docs/Examples/Basic.json @@ -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 + } + ] + } + ] +}