Add react-json-tree (#12304)

This commit is contained in:
Grant Nestor
2016-11-01 05:13:15 -07:00
committed by Masahiro Wakame
parent 32cfdbb3f4
commit 53ebd0025c
3 changed files with 59 additions and 0 deletions

27
react-json-tree/index.d.ts vendored Normal file
View File

@@ -0,0 +1,27 @@
// Type definitions for react-json-tree v0.6.5
// Project: https://github.com/alexkuz/react-json-tree/
// Definitions by: Grant Nestor <https://github.com/gnestor/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import {
Component,
Props
} from "react";
export interface JSONTreeProps extends Props<JSONTreeComponent> {
data: [any] | {};
hideRoot?: boolean;
theme?: {} | string;
invertTheme?: boolean;
keyPath?: [string | number];
sortObjectKeys?: Function | boolean;
shouldExpandNode?: (keyName: string, data: [any] | {}, level: number) => boolean;
getItemString?: (type: string, data: [any] | {}, itemType: string, itemString: string) => JSX.Element;
labelRenderer?: (raw: [string, string]) => JSX.Element;
valueRenderer?: (raw: string) => JSX.Element;
postprocessValue?: (raw: string) => JSX.Element;
isCustomNode?: () => boolean;
collectionLimit?: number;
}
export default class JSONTreeComponent extends Component<JSONTreeProps, {}> { }

View File

@@ -0,0 +1,12 @@
import * as React from "react";
// import * as ReactDOM from "react-dom";
import JSONTree from "react-json-tree";
<JSONTree data={{
string: "string",
array: [1, 2, 3],
bool: true,
object: {
foo: "bar"
}
}} />;

View File

@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
},
"files": [
"index.d.ts",
"react-json-tree-tests.ts"
]
}