thesaurus-tree
Visualization of thesaurus
Install
npm install --save thesaurus-tree
Usage
import React, { Component } from 'react'
import ThesaurusTree from 'thesaurus-tree'
class Example extends Component {
render() {
return (
<ThesaurusTree
concept_id={id}
getOneRequest={getOneRequest}
getPartRequest={getPartRequest}
putRequest={putRequest}
/>)
}
}
Props
| Props | Description | Is required? | Type | DefaultProps | |:---------------|:--------------------------------------------------------------------:|:------------:|:---------------------------------:|:------------:| | conceptid | The main concept that is the basis for the tree | + | int | - | | getOneRequest | Function that sends a request to the server to get one concept | + | (conceptid) => IOneConcept | - | | getPartRequest | Function that sends a request to the server to get part of thesaurus | + | (conceptid) => IPart | - | | putRequest | Function that sends a request to the server for editing one concept | + | (conceptid, IOneConcept) => void | - | | isAdmin | Flag for adding admin capabilities (editing) | - | boolean | false | | orientation | Orientation of tree | - | "vertical" or "horizontal" | "vertical" | |interface IOneConcept {
ruName: string,
enName: string,
author: string,
description: string,
confirmed: boolean
}
interface IPart {
name: string;
attributes?: Record<string, string | number | boolean>;
children?: IPart[];
}