Skip to content

Commit 61a8d48

Browse files
authored
feat: add new JsonViewer (#1951)
1 parent a2b7d1c commit 61a8d48

33 files changed

+1442
-317
lines changed

package-lock.json

+7-51
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@gravity-ui/react-data-table": "^2.1.1",
2525
"@gravity-ui/table": "^1.7.0",
2626
"@gravity-ui/uikit": "^6.40.0",
27+
"@gravity-ui/unipika": "^5.2.1",
2728
"@gravity-ui/websql-autocomplete": "^13.7.0",
2829
"@hookform/resolvers": "^3.10.0",
2930
"@reduxjs/toolkit": "^2.5.0",
@@ -43,7 +44,6 @@
4344
"react-error-boundary": "^4.1.2",
4445
"react-helmet-async": "^2.0.5",
4546
"react-hook-form": "^7.54.2",
46-
"react-json-inspector": "^7.1.1",
4747
"react-monaco-editor": "^0.56.2",
4848
"react-redux": "^9.2.0",
4949
"react-router-dom": "^5.3.4",

src/components/JSONTree/JSONTree.scss

-20
This file was deleted.

src/components/JSONTree/JSONTree.tsx

-61
This file was deleted.

src/components/JSONTree/i18n/en.json

-4
This file was deleted.
+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
@use '../../styles/mixins.scss';
2+
3+
.ydb-json-viewer {
4+
--data-table-row-height: 20px;
5+
--toolbar-background-color: var(--g-color-base-background);
6+
7+
&__toolbar {
8+
position: sticky;
9+
z-index: 2;
10+
top: 0;
11+
left: 0;
12+
13+
padding-bottom: var(--g-spacing-2);
14+
15+
background-color: var(--toolbar-background-color);
16+
}
17+
18+
&__content {
19+
font-family: var(--g-font-family-monospace);
20+
}
21+
22+
&__row {
23+
height: 1em;
24+
}
25+
26+
&__cell {
27+
position: relative;
28+
29+
white-space: nowrap !important;
30+
* {
31+
white-space: nowrap !important;
32+
}
33+
}
34+
35+
&__collapsed {
36+
position: absolute;
37+
38+
margin-top: -2px;
39+
margin-left: -3ex;
40+
}
41+
42+
&__match-counter {
43+
align-content: center;
44+
45+
text-wrap: nowrap;
46+
47+
color: var(--g-color-text-secondary);
48+
}
49+
50+
&__key {
51+
color: var(--g-color-text-misc);
52+
}
53+
54+
&__value {
55+
&_type {
56+
&_string {
57+
color: var(--color-unipika-string);
58+
}
59+
&_boolean {
60+
color: var(--color-unipika-bool);
61+
}
62+
&_null {
63+
color: var(--color-unipika-null);
64+
}
65+
&_int64 {
66+
color: var(--color-unipika-int);
67+
}
68+
&_double {
69+
color: var(--color-unipika-float);
70+
}
71+
}
72+
}
73+
74+
&__filter {
75+
width: 300px;
76+
}
77+
78+
&__filtered {
79+
&_highlighted {
80+
background-color: var(--g-color-base-generic-medium);
81+
}
82+
&_clickable {
83+
cursor: pointer;
84+
85+
color: var(--g-color-text-info);
86+
}
87+
}
88+
89+
&__match-btn {
90+
margin-left: -1px;
91+
}
92+
93+
&__full-value {
94+
overflow: hidden auto;
95+
96+
max-width: 90vw;
97+
max-height: 90vh;
98+
margin: var(--g-spacing-3) 0;
99+
100+
word-break: break-all;
101+
@include mixins.body-2-typography();
102+
}
103+
104+
&__extra-tools {
105+
margin-left: 1ex;
106+
}
107+
108+
.data-table__head {
109+
display: none;
110+
}
111+
112+
.data-table__td {
113+
overflow: visible;
114+
115+
padding: 0;
116+
}
117+
}

0 commit comments

Comments
 (0)