-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathtypes.ts
63 lines (50 loc) · 1.48 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React from 'react';
import { StylingFunction } from 'react-base16-styling';
export type Key = string | number;
export type KeyPath = readonly (string | number)[];
export type GetItemString = (
nodeType: string,
data: unknown,
itemType: React.ReactNode,
itemString: string,
keyPath: KeyPath,
) => React.ReactNode;
export type LabelRenderer = (
keyPath: KeyPath,
nodeType: string,
expanded: boolean,
expandable: boolean,
) => React.ReactNode;
export type ValueRenderer = (
valueAsString: unknown,
value: unknown,
...keyPath: KeyPath
) => React.ReactNode;
export type ShouldExpandNodeInitially = (
keyPath: KeyPath,
data: unknown,
level: number,
) => boolean;
export type PostprocessValue = (value: unknown) => unknown;
export type IsCustomNode = (value: unknown) => boolean;
export type SortObjectKeys = ((a: unknown, b: unknown) => number) | boolean;
export type Styling = StylingFunction;
export type CircularCache = unknown[];
export interface CommonExternalProps {
keyPath: KeyPath;
labelRenderer: LabelRenderer;
valueRenderer: ValueRenderer;
shouldExpandNodeInitially: ShouldExpandNodeInitially;
hideRoot: boolean;
getItemString: GetItemString;
postprocessValue: PostprocessValue;
isCustomNode: IsCustomNode;
collectionLimit: number;
sortObjectKeys: SortObjectKeys;
}
export interface CommonInternalProps extends CommonExternalProps {
styling: StylingFunction;
circularCache?: CircularCache;
level?: number;
isCircular?: boolean;
}