Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/StefH/jsMind.Blazor

A Blazor JSInterop wrapper for jsMind
https://github.com/StefH/jsMind.Blazor

blazor interop javascript jsmind mindmap

Last synced: 3 months ago
JSON representation

A Blazor JSInterop wrapper for jsMind

Awesome Lists containing this project

README

        

# jsMind.Blazor
A Blazor JSInterop wrapper for [jsMind](https://github.com/hizzgdev/jsmind).

[![NuGet](https://buildstats.info/nuget/jsMind.Blazor)](https://www.nuget.org/packages/jsMind.Blazor)

![Example](https://raw.githubusercontent.com/StefH/jsMind.Blazor/master/resources/example.png "example")

### Live Demo
https://stefh.github.io/jsMind.Blazor

### Supported Functionality
See [Wiki : Supported-Functionality](https://github.com/StefH/jsMind.Blazor/wiki/Supported-Functionality)

### Usage

#### Install the NuGet

```
PM> Install-Package jsMind.Blazor
```

#### Add the required javascripts and stylesheet to _Host.cshtml (Server) or index.html (WebAssembly)
``` diff

. . .
+
+

+

```

#### Add the required imports to the _Imports.razor
``` diff
. . .
@using Microsoft.JSInterop
+ @using JsMind.Blazor.Components
+ @using JsMind.Blazor.Models
+ @using JsMind.Blazor.Events
+ @using JsMind.Blazor.Constants
```

#### Use the MindMapContainer
`razor-html`
``` html
@page "/"

```
`razor - @code`
``` c#
{
private MindMapTreeContainer _myTreeNodeContainer;

// Define the MindMapOptions
readonly MindMapOptions _options = new MindMapOptions
{
Editable = false,
Theme = MindMapThemes.Primary
};

// Define some MindMapTreeData
readonly MindMapTreeData _treeData = new MindMapTreeData
{
RootNode = new MindMapTreeNode
{
Id = "root",
Topic = "-Root-",
Children = new List
{
new MindMapTreeNode
{
Id = "sub1.0",
Topic = "sub1.0-right"
},
new MindMapTreeNode
{
Id = "sub1.1",
Topic = "sub1.1-right",
Children = new List
{
new MindMapTreeNode
{
Id = "sub1.1a",
Topic = "sub1.1a-right"
}
}
},
new MindMapTreeNode
{
Id = "sub2",
Topic = "sub2-left",
Direction = MindMapNodeDirection.Left
}
}
}
};

async Task OnShowTree(EventArgs args)
{
// When the MindMap is displayed, expand all nodes
await _myTreeNodeContainer.Expand();
}
}
```