From 4f6139a329e1a40da21c363febb9d3e7ce61e304 Mon Sep 17 00:00:00 2001 From: danstarns Date: Fri, 16 Aug 2024 16:58:22 -0700 Subject: [PATCH] docs: init DataSources --- docs/api.js | 1 + docs/api/component.md | 9 +++++ docs/api/data_source_manager.md | 61 +++++++++++++++++++++++++++++++++ docs/modules/DataSources.md | 7 ++++ 4 files changed, 78 insertions(+) create mode 100644 docs/api/data_source_manager.md create mode 100644 docs/modules/DataSources.md diff --git a/docs/api.js b/docs/api.js index 0ac85a300..bda6d43cd 100644 --- a/docs/api.js +++ b/docs/api.js @@ -79,6 +79,7 @@ async function generateDocs () { ['pages/index.ts', 'pages.md'], ['pages/model/Page.ts', 'page.md'], ['parser/index.ts', 'parser.md'], + ['data_sources/index.ts', 'data_source_manager.md'], ].map(async (file) => { const filePath = `${srcRoot}/${file[0]}`; diff --git a/docs/api/component.md b/docs/api/component.md index f335ce9b4..a5af275a6 100644 --- a/docs/api/component.md +++ b/docs/api/component.md @@ -659,6 +659,15 @@ Get the name of the component. Returns **[String][1]** +## setName + +Update component name. + +### Parameters + +* `name` **[String][1]** New name. +* `opts` **SetOptions** (optional, default `{}`) + ## getIcon Get the icon string diff --git a/docs/api/data_source_manager.md b/docs/api/data_source_manager.md new file mode 100644 index 000000000..a0f6a04b1 --- /dev/null +++ b/docs/api/data_source_manager.md @@ -0,0 +1,61 @@ + + +## add + +Add new data source. + +### Parameters + +* `props` **[Object][1]** Data source properties. +* `opts` **AddOptions** (optional, default `{}`) + +### Examples + +```javascript +const ds = dsm.add({ + id: 'my_data_source_id', + records: [ + { id: 'id1', name: 'value1' }, + { id: 'id2', name: 'value2' } + ] +}); +``` + +Returns **[DataSource]** Added data source. + +## get + +Get data source. + +### Parameters + +* `id` **[String][2]** Data source id. + +### Examples + +```javascript +const ds = dsm.get('my_data_source_id'); +``` + +Returns **[DataSource]** Data source. + +## remove + +Remove data source. + +### Parameters + +* `id` **([String][2] | [DataSource])** Id of the data source. +* `opts` **RemoveOptions?** + +### Examples + +```javascript +const removed = dsm.remove('DS_ID'); +``` + +Returns **[DataSource]** Removed data source. + +[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object + +[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String diff --git a/docs/modules/DataSources.md b/docs/modules/DataSources.md new file mode 100644 index 000000000..6de30e8cc --- /dev/null +++ b/docs/modules/DataSources.md @@ -0,0 +1,7 @@ +--- +title: Data Sources +--- + +# Data Sources + +Hey World \ No newline at end of file