forked from deephaven/web-client-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Grids.tsx
92 lines (90 loc) · 3.28 KB
/
Grids.tsx
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import React, { type ReactElement, useState } from 'react';
import {
Grid,
type GridThemeType,
MockGridModel,
MockTreeGridModel,
ThemeContext,
} from '@deephaven/grid';
import { IrisGrid } from '@deephaven/iris-grid';
import { useApi } from '@deephaven/jsapi-bootstrap';
import { Flex } from '@deephaven/components';
import MockIrisGridTreeModel from './MockIrisGridTreeModel';
import StaticExample from './grid-examples/StaticExample';
import QuadrillionExample from './grid-examples/QuadrillionExample';
import TreeExample from './grid-examples/TreeExample';
import AsyncExample from './grid-examples/AsyncExample';
import DataBarExample from './grid-examples/DataBarExample';
import SampleSection from './SampleSection';
function Grids(): ReactElement {
const dh = useApi();
const [irisGridModel] = useState(
new MockIrisGridTreeModel(dh, new MockTreeGridModel())
);
const [irisGridCompactModel] = useState(
new MockIrisGridTreeModel(dh, new MockTreeGridModel())
);
const [irisGridSpaciousModel] = useState(
new MockIrisGridTreeModel(dh, new MockTreeGridModel())
);
const [model] = useState(new MockGridModel());
const [theme] = useState<Partial<GridThemeType>>({
autoSelectRow: true,
});
const [contextTheme] = useState<Partial<GridThemeType>>({
rowHeight: 40,
});
return (
<div>
<ThemeContext.Provider value={contextTheme}>
<h2 className="ui-title">Grid</h2>
<SampleSection name="grids-grid" component={Flex}>
<Grid model={model} theme={theme} />
</SampleSection>
<h2 className="ui-title">Static Data</h2>
<SampleSection name="grids-static" component={Flex} height={200}>
<StaticExample />
</SampleSection>
<h2 className="ui-title">Data Bar</h2>
<SampleSection name="grids-data-bar" component={Flex} height={500}>
<DataBarExample />
</SampleSection>
<h2 className="ui-title">Quadrillion rows and columns</h2>
<SampleSection
name="grids-quadrillion"
component={Flex}
position="relative"
height={500}
>
<QuadrillionExample />
</SampleSection>
<h2 className="ui-title">Async example</h2>
<SampleSection
name="grids-async"
component={Flex}
position="relative"
height={500}
>
<AsyncExample />
</SampleSection>
<h2 className="ui-title">Tree Grid</h2>
<SampleSection name="grids-tree" component={Flex} height={500}>
<TreeExample />
</SampleSection>
<h2 className="ui-title">Iris Grid</h2>
<SampleSection name="grids-iris" component={Flex} height={500}>
<IrisGrid model={irisGridModel} density="regular" />
</SampleSection>
<h2 className="ui-title">Iris Grid Compact</h2>
<SampleSection name="grids-iris-compact" component={Flex} height={500}>
<IrisGrid model={irisGridCompactModel} density="compact" />
</SampleSection>
<h2 className="ui-title">Iris Grid Spacious</h2>
<SampleSection name="grids-iris-spacious" component={Flex} height={500}>
<IrisGrid model={irisGridSpaciousModel} density="spacious" />
</SampleSection>
</ThemeContext.Provider>
</div>
);
}
export default Grids;