1.3.0 • Published 2 years ago
thesaurus-tree v1.3.0
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 | |
---|---|---|---|---|---|
concept_id | The main concept that is the basis for the tree | + | int | - | |
getOneRequest | Function that sends a request to the server to get one concept | + | (concept_id) => IOneConcept | - | |
getPartRequest | Function that sends a request to the server to get part of thesaurus | + | (concept_id) => IPart | - | |
putRequest | Function that sends a request to the server for editing one concept | + | (concept_id, 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[];
}
License
MIT © Barashek-1507