@uiw/react-json-view 2.0.0-alpha.4 → 2.0.0-alpha.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +279 -39
- package/basic.d.ts +4 -0
- package/cjs/Container.d.ts +2 -0
- package/cjs/Container.js +15 -6
- package/cjs/arrow/TriangleArrow.js +1 -1
- package/cjs/comps/Copied.d.ts +3 -4
- package/cjs/comps/Copied.js +61 -18
- package/cjs/comps/KeyValues.d.ts +2 -4
- package/cjs/comps/KeyValues.js +73 -28
- package/cjs/comps/NestedClose.d.ts +2 -2
- package/cjs/comps/NestedClose.js +42 -12
- package/cjs/comps/NestedOpen.d.ts +2 -3
- package/cjs/comps/NestedOpen.js +42 -20
- package/cjs/comps/Value.d.ts +2 -2
- package/cjs/comps/Value.js +5 -7
- package/cjs/comps/useIdCompat.d.ts +1 -0
- package/cjs/comps/useIdCompat.js +14 -0
- package/cjs/editor/KeyName.d.ts +2 -0
- package/cjs/editor/KeyName.js +82 -0
- package/cjs/editor/index.d.ts +18 -0
- package/cjs/editor/index.js +44 -0
- package/cjs/editor/store.d.ts +27 -0
- package/cjs/editor/store.js +23 -0
- package/cjs/index.d.ts +26 -4
- package/cjs/index.js +17 -7
- package/cjs/section/Copied.d.ts +4 -1
- package/cjs/section/Copied.js +1 -2
- package/cjs/section/CountInfo.d.ts +1 -2
- package/cjs/section/CountInfo.js +3 -5
- package/cjs/section/CountInfoExtra.d.ts +1 -2
- package/cjs/section/CountInfoExtra.js +2 -4
- package/cjs/section/Ellipsis.d.ts +0 -1
- package/cjs/section/Ellipsis.js +4 -5
- package/cjs/section/KeyName.d.ts +7 -6
- package/cjs/section/KeyName.js +8 -6
- package/cjs/section/Row.d.ts +13 -0
- package/cjs/section/Row.js +51 -0
- package/cjs/store/Expands.js +2 -4
- package/cjs/store/Section.d.ts +12 -6
- package/cjs/store/Section.js +6 -4
- package/cjs/store/ShowTools.js +2 -4
- package/cjs/store/Symbols.d.ts +10 -3
- package/cjs/store/Symbols.js +2 -4
- package/cjs/store/Types.d.ts +30 -25
- package/cjs/store/Types.js +8 -8
- package/cjs/store.d.ts +12 -6
- package/cjs/store.js +5 -10
- package/cjs/symbol/Arrow.d.ts +1 -1
- package/cjs/symbol/Arrow.js +1 -2
- package/cjs/symbol/BraceLeft.d.ts +1 -1
- package/cjs/symbol/BraceLeft.js +1 -2
- package/cjs/symbol/BraceRight.d.ts +1 -1
- package/cjs/symbol/BraceRight.js +1 -2
- package/cjs/symbol/BracketsLeft.d.ts +1 -1
- package/cjs/symbol/BracketsLeft.js +1 -2
- package/cjs/symbol/BracketsRight.d.ts +1 -1
- package/cjs/symbol/BracketsRight.js +1 -2
- package/cjs/symbol/Colon.d.ts +1 -1
- package/cjs/symbol/Colon.js +1 -2
- package/cjs/symbol/Quote.d.ts +1 -1
- package/cjs/symbol/Quote.js +1 -2
- package/cjs/symbol/ValueQuote.d.ts +1 -1
- package/cjs/symbol/ValueQuote.js +1 -2
- package/cjs/symbol/index.d.ts +12 -17
- package/cjs/symbol/index.js +75 -30
- package/cjs/theme/basic.d.ts +2 -2
- package/cjs/theme/basic.js +4 -3
- package/cjs/theme/dark.d.ts +2 -2
- package/cjs/theme/dark.js +2 -3
- package/cjs/theme/github.dark.d.ts +2 -2
- package/cjs/theme/github.dark.js +2 -3
- package/cjs/theme/github.light.d.ts +2 -2
- package/cjs/theme/github.light.js +2 -3
- package/cjs/theme/gruvbox.d.ts +2 -2
- package/cjs/theme/gruvbox.js +2 -3
- package/cjs/theme/light.d.ts +2 -2
- package/cjs/theme/light.js +2 -3
- package/cjs/theme/monokai.d.ts +2 -2
- package/cjs/theme/monokai.js +2 -3
- package/cjs/theme/nord.d.ts +2 -2
- package/cjs/theme/nord.js +2 -3
- package/cjs/theme/vscode.d.ts +2 -2
- package/cjs/theme/vscode.js +2 -3
- package/cjs/types/Bigint.d.ts +1 -1
- package/cjs/types/Bigint.js +1 -2
- package/cjs/types/Date.d.ts +1 -1
- package/cjs/types/Date.js +1 -2
- package/cjs/types/False.d.ts +1 -1
- package/cjs/types/False.js +1 -2
- package/cjs/types/Float.d.ts +1 -1
- package/cjs/types/Float.js +1 -2
- package/cjs/types/Int.d.ts +1 -1
- package/cjs/types/Int.js +1 -2
- package/cjs/types/Map.d.ts +1 -1
- package/cjs/types/Map.js +1 -2
- package/cjs/types/Nan.d.ts +1 -1
- package/cjs/types/Nan.js +1 -2
- package/cjs/types/Null.d.ts +1 -1
- package/cjs/types/Null.js +1 -2
- package/cjs/types/Set.d.ts +1 -1
- package/cjs/types/Set.js +1 -2
- package/cjs/types/String.d.ts +1 -1
- package/cjs/types/String.js +1 -2
- package/cjs/types/True.d.ts +1 -1
- package/cjs/types/True.js +1 -2
- package/cjs/types/Undefined.d.ts +1 -1
- package/cjs/types/Undefined.js +1 -2
- package/cjs/types/Url.d.ts +1 -1
- package/cjs/types/Url.js +1 -2
- package/cjs/types/index.d.ts +5 -2
- package/cjs/types/index.js +174 -166
- package/cjs/utils/useHighlight.d.ts +0 -1
- package/cjs/utils/useRender.d.ts +1 -1
- package/dark.d.ts +2 -1
- package/editor.d.ts +22 -20
- package/esm/Container.d.ts +2 -0
- package/esm/Container.js +21 -11
- package/esm/arrow/TriangleArrow.js +1 -1
- package/esm/comps/Copied.d.ts +3 -4
- package/esm/comps/Copied.js +61 -19
- package/esm/comps/KeyValues.d.ts +2 -4
- package/esm/comps/KeyValues.js +71 -27
- package/esm/comps/NestedClose.d.ts +2 -2
- package/esm/comps/NestedClose.js +40 -11
- package/esm/comps/NestedOpen.d.ts +2 -3
- package/esm/comps/NestedOpen.js +47 -26
- package/esm/comps/Value.d.ts +2 -2
- package/esm/comps/Value.js +3 -3
- package/esm/comps/useIdCompat.d.ts +1 -0
- package/esm/comps/useIdCompat.js +8 -0
- package/esm/editor/KeyName.d.ts +2 -0
- package/esm/editor/KeyName.js +77 -0
- package/esm/editor/index.d.ts +18 -0
- package/esm/editor/index.js +33 -0
- package/esm/editor/store.d.ts +27 -0
- package/esm/editor/store.js +13 -0
- package/esm/index.d.ts +26 -4
- package/esm/index.js +50 -41
- package/esm/section/Copied.d.ts +4 -1
- package/esm/section/Copied.js +2 -2
- package/esm/section/CountInfo.d.ts +1 -2
- package/esm/section/CountInfo.js +4 -4
- package/esm/section/CountInfoExtra.d.ts +1 -2
- package/esm/section/CountInfoExtra.js +2 -2
- package/esm/section/Ellipsis.d.ts +0 -1
- package/esm/section/Ellipsis.js +3 -3
- package/esm/section/KeyName.d.ts +7 -6
- package/esm/section/KeyName.js +8 -4
- package/esm/section/Row.d.ts +13 -0
- package/esm/section/Row.js +47 -0
- package/esm/store/Section.d.ts +12 -6
- package/esm/store/Section.js +4 -0
- package/esm/store/Symbols.d.ts +10 -3
- package/esm/store/Symbols.js +1 -1
- package/esm/store/Types.d.ts +30 -25
- package/esm/store/Types.js +6 -4
- package/esm/store.d.ts +12 -6
- package/esm/store.js +5 -5
- package/esm/symbol/Arrow.d.ts +1 -1
- package/esm/symbol/Arrow.js +2 -2
- package/esm/symbol/BraceLeft.d.ts +1 -1
- package/esm/symbol/BraceLeft.js +2 -2
- package/esm/symbol/BraceRight.d.ts +1 -1
- package/esm/symbol/BraceRight.js +2 -2
- package/esm/symbol/BracketsLeft.d.ts +1 -1
- package/esm/symbol/BracketsLeft.js +2 -2
- package/esm/symbol/BracketsRight.d.ts +1 -1
- package/esm/symbol/BracketsRight.js +2 -2
- package/esm/symbol/Colon.d.ts +1 -1
- package/esm/symbol/Colon.js +2 -2
- package/esm/symbol/Quote.d.ts +1 -1
- package/esm/symbol/Quote.js +2 -2
- package/esm/symbol/ValueQuote.d.ts +1 -1
- package/esm/symbol/ValueQuote.js +2 -2
- package/esm/symbol/index.d.ts +12 -17
- package/esm/symbol/index.js +78 -25
- package/esm/theme/basic.d.ts +2 -2
- package/esm/theme/basic.js +2 -0
- package/esm/theme/dark.d.ts +2 -2
- package/esm/theme/github.dark.d.ts +2 -2
- package/esm/theme/github.light.d.ts +2 -2
- package/esm/theme/gruvbox.d.ts +2 -2
- package/esm/theme/light.d.ts +2 -2
- package/esm/theme/monokai.d.ts +2 -2
- package/esm/theme/nord.d.ts +2 -2
- package/esm/theme/vscode.d.ts +2 -2
- package/esm/types/Bigint.d.ts +1 -1
- package/esm/types/Bigint.js +2 -2
- package/esm/types/Date.d.ts +1 -1
- package/esm/types/Date.js +2 -2
- package/esm/types/False.d.ts +1 -1
- package/esm/types/False.js +2 -2
- package/esm/types/Float.d.ts +1 -1
- package/esm/types/Float.js +2 -2
- package/esm/types/Int.d.ts +1 -1
- package/esm/types/Int.js +2 -2
- package/esm/types/Map.d.ts +1 -1
- package/esm/types/Map.js +2 -2
- package/esm/types/Nan.d.ts +1 -1
- package/esm/types/Nan.js +2 -2
- package/esm/types/Null.d.ts +1 -1
- package/esm/types/Null.js +2 -2
- package/esm/types/Set.d.ts +1 -1
- package/esm/types/Set.js +2 -2
- package/esm/types/String.d.ts +1 -1
- package/esm/types/String.js +2 -2
- package/esm/types/True.d.ts +1 -1
- package/esm/types/True.js +2 -2
- package/esm/types/Undefined.d.ts +1 -1
- package/esm/types/Undefined.js +2 -2
- package/esm/types/Url.d.ts +1 -1
- package/esm/types/Url.js +2 -2
- package/esm/types/index.d.ts +5 -2
- package/esm/types/index.js +148 -131
- package/esm/utils/useHighlight.d.ts +0 -1
- package/esm/utils/useRender.d.ts +1 -1
- package/esm/utils/useRender.js +3 -3
- package/githubDark.d.ts +4 -0
- package/githubLight.d.ts +4 -0
- package/gruvbox.d.ts +4 -0
- package/light.d.ts +2 -1
- package/monokai.d.ts +4 -0
- package/nord.d.ts +4 -0
- package/package.json +11 -5
- package/triangle-arrow.d.ts +2 -2
- package/triangle-solid-arrow.d.ts +2 -2
- package/vscode.d.ts +4 -0
package/README.md
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
|
+
<div markdown="1">
|
|
2
|
+
<sup>Using <a href="https://wangchujiang.com/#/app" target="_blank">my app</a> is also a way to <a href="https://wangchujiang.com/#/sponsor" target="_blank">support</a> me:</sup>
|
|
3
|
+
<br>
|
|
4
|
+
<a target="_blank" href="https://apps.apple.com/app/Deskmark/6755948110" title="Deskmark for macOS"><img alt="Deskmark" height="52" width="52" src="https://wangchujiang.com/appicon/deskmark.png"></a>
|
|
5
|
+
<a target="_blank" href="https://apps.apple.com/app/Keyzer/6500434773" title="Keyzer for macOS"><img alt="Keyzer" height="52" width="52" src="https://wangchujiang.com/appicon/keyzer.png"></a>
|
|
6
|
+
<a target="_blank" href="https://github.com/jaywcjlove/vidwall-hub" title="Vidwall Hub for macOS"><img alt="Vidwall Hub" height="52" width="52" src="https://wangchujiang.com/appicon/vidwall-hub.png"></a>
|
|
7
|
+
<a target="_blank" href="https://apps.apple.com/app/VidCrop/6752624705" title="VidCrop for macOS"><img alt="VidCrop" height="52" width="52" src="https://wangchujiang.com/appicon/vidcrop.png"></a>
|
|
8
|
+
<a target="_blank" href="https://apps.apple.com/app/Vidwall/6747587746" title="Vidwall for macOS"><img alt="Vidwall" height="52" width="52" src="https://wangchujiang.com/appicon/vidwall.png"></a>
|
|
9
|
+
<a target="_blank" href="https://wangchujiang.com/mousio-hint/" title="Mousio Hint for macOS"><img alt="Mousio Hint" height="52" width="52" src="https://wangchujiang.com/appicon/mousio-hint.png"></a>
|
|
10
|
+
<a target="_blank" href="https://apps.apple.com/app/6746747327" title="Mousio for macOS"><img alt="Mousio" height="52" width="52" src="https://wangchujiang.com/appicon/mousio.png"></a>
|
|
11
|
+
<a target="_blank" href="https://apps.apple.com/app/6745227444" title="Musicer for macOS"><img alt="Musicer" height="52" width="52" src="https://wangchujiang.com/appicon/musicer.png"></a>
|
|
12
|
+
<a target="_blank" href="https://apps.apple.com/app/6743841447" title="Audioer for macOS"><img alt="Audioer" height="52" width="52" src="https://wangchujiang.com/appicon/audioer.png"></a>
|
|
13
|
+
<a target="_blank" href="https://apps.apple.com/app/6744690194" title="FileSentinel for macOS"><img alt="FileSentinel" height="52" width="52" src="https://wangchujiang.com/appicon/file-sentinel.png"></a>
|
|
14
|
+
<a target="_blank" href="https://apps.apple.com/app/6743495172" title="FocusCursor for macOS"><img alt="FocusCursor" height="52" width="52" src="https://wangchujiang.com/appicon/focus-cursor.png"></a>
|
|
15
|
+
<a target="_blank" href="https://apps.apple.com/app/6742680573" title="Videoer for macOS"><img alt="Videoer" height="52" width="52" src="https://wangchujiang.com/appicon/videoer.png"></a>
|
|
16
|
+
<a target="_blank" href="https://apps.apple.com/app/6740425504" title="KeyClicker for macOS"><img alt="KeyClicker" height="52" width="52" src="https://wangchujiang.com/appicon/key-clicker.png"></a>
|
|
17
|
+
<a target="_blank" href="https://apps.apple.com/app/6739052447" title="DayBar for macOS"><img alt="DayBar" height="52" width="52" src="https://wangchujiang.com/appicon/daybar.png"></a>
|
|
18
|
+
<a target="_blank" href="https://apps.apple.com/app/6739444407" title="Iconed for macOS"><img alt="Iconed" height="52" width="52" src="https://wangchujiang.com/appicon/iconed.png"></a>
|
|
19
|
+
<a target="_blank" href="https://apps.apple.com/app/6737160756" title="Mousio for macOS"><img alt="Mousio" height="52" width="52" src="https://wangchujiang.com/appicon/rightmenu-master.png"></a>
|
|
20
|
+
<a target="_blank" href="https://apps.apple.com/app/6723903021" title="Paste Quick for macOS"><img alt="Quick RSS" height="52" width="52" src="https://wangchujiang.com/appicon/paste-quick.png"></a>
|
|
21
|
+
<a target="_blank" href="https://apps.apple.com/app/6670696072" title="Quick RSS for macOS/iOS"><img alt="Quick RSS" height="52" width="52" src="https://wangchujiang.com/appicon/quick-rss.png"></a>
|
|
22
|
+
<a target="_blank" href="https://apps.apple.com/app/6670167443" title="Web Serve for macOS"><img alt="Web Serve" height="52" width="52" src="https://wangchujiang.com/appicon/web-serve.png"></a>
|
|
23
|
+
<a target="_blank" href="https://apps.apple.com/app/6503953628" title="Copybook Generator for macOS/iOS"><img alt="Copybook Generator" height="52" width="52" src="https://wangchujiang.com/appicon/copybook-generator.png"></a>
|
|
24
|
+
<a target="_blank" href="https://apps.apple.com/app/6471227008" title="DevTutor for macOS/iOS"><img alt="DevTutor for SwiftUI" height="52" width="52" src="https://wangchujiang.com/appicon/devtutor.png"></a>
|
|
25
|
+
<a target="_blank" href="https://apps.apple.com/app/6479819388" title="RegexMate for macOS/iOS"><img alt="RegexMate" height="52" width="52" src="https://wangchujiang.com/appicon/regex-mate.png"></a>
|
|
26
|
+
<a target="_blank" href="https://apps.apple.com/app/6479194014" title="Time Passage for macOS/iOS"><img alt="Time Passage" height="52" width="52" src="https://wangchujiang.com/appicon/time-passage.png"></a>
|
|
27
|
+
<a target="_blank" href="https://apps.apple.com/app/6478772538" title="IconizeFolder for macOS"><img alt="Iconize Folder" height="52" width="52" src="https://wangchujiang.com/appicon/iconize-folder.png"></a>
|
|
28
|
+
<a target="_blank" href="https://apps.apple.com/app/6478511402" title="Textsound Saver for macOS/iOS"><img alt="Textsound Saver" height="52" width="52" src="https://wangchujiang.com/appicon/textsound-saver.png"></a>
|
|
29
|
+
<a target="_blank" href="https://apps.apple.com/app/6476924627" title="Create Custom Symbols for macOS"><img alt="Create Custom Symbols" height="52" width="52" src="https://wangchujiang.com/appicon/create-custom-symbols.png"></a>
|
|
30
|
+
<a target="_blank" href="https://apps.apple.com/app/6476452351" title="DevHub for macOS"><img alt="DevHub" height="52" width="52" src="https://wangchujiang.com/appicon/devhub.png"></a>
|
|
31
|
+
<a target="_blank" href="https://apps.apple.com/app/6476400184" title="Resume Revise for macOS"><img alt="Resume Revise" height="52" width="52" src="https://wangchujiang.com/appicon/resume-revise.png"></a>
|
|
32
|
+
<a target="_blank" href="https://apps.apple.com/app/6472593276" title="Palette Genius for macOS"><img alt="Palette Genius" height="52" width="52" src="https://wangchujiang.com/appicon/palette-genius.png"></a>
|
|
33
|
+
<a target="_blank" href="https://apps.apple.com/app/6470879005" title="Symbol Scribe for macOS"><img alt="Symbol Scribe" height="52" width="52" src="https://wangchujiang.com/appicon/symbol-scribe.png"></a>
|
|
34
|
+
</div>
|
|
35
|
+
<hr>
|
|
36
|
+
|
|
1
37
|
react-json-view
|
|
2
38
|
===
|
|
3
39
|
|
|
40
|
+
[](https://jaywcjlove.github.io/#/sponsor)
|
|
4
41
|
[](https://github.com/uiwjs/react-json-view/actions/workflows/ci.yml)
|
|
5
42
|
[](https://www.npmjs.com/package/@uiw/react-json-view)
|
|
6
43
|
[](https://www.npmjs.com/package/@uiw/react-json-view)
|
|
@@ -18,20 +55,19 @@ A React component for displaying and editing javascript arrays and JSON objects.
|
|
|
18
55
|
|
|
19
56
|
## Features
|
|
20
57
|
|
|
21
|
-
|
|
22
|
-
🎨
|
|
23
|
-
🌒
|
|
24
|
-
📦 Zero
|
|
25
|
-
📋
|
|
26
|
-
✏️
|
|
27
|
-
♻️
|
|
28
|
-
|
|
29
|
-
The new version [**v2**](https://uiwjs.github.io/react-json-view/) has redesigned the API to make the code more maintainable and introduced a simpler and more flexible component customization rendering API. Each component can now have custom rendering, and the new API resembles React more closely. Preview [v2 documentation](https://uiwjs.github.io/react-json-view/) and [examples](https://uiwjs.github.io/react-json-view/).
|
|
58
|
+
🚀 **Improved with TypeScript** – Better code hints for a smoother development experience.
|
|
59
|
+
🎨 **Customizable Themes** – Supports theme customization & [`online editing`](https://uiwjs.github.io/react-json-view/#online-editing-theme).
|
|
60
|
+
🌒 **Dark/Light Mode** – Seamless switching between themes.
|
|
61
|
+
📦 **Zero Dependencies** – Lightweight and efficient.
|
|
62
|
+
📋 **Clipboard Support** – Easily copy JSON data.
|
|
63
|
+
✏️ **Editable & Extendable** – Supports editing and adding new properties.
|
|
64
|
+
♻️ **Update Highlighting** – Option to highlight changes.
|
|
30
65
|
|
|
31
|
-
|
|
32
|
-
- [ ] Add editing functionality to v2.
|
|
33
|
-
- [x] Add test cases to v2.
|
|
66
|
+
The latest version [**v2**](https://uiwjs.github.io/react-json-view/) features a redesigned API for better maintainability, a more flexible component customization system, and fully customizable rendering, making it more aligned with React’s component model. 📖 Check out the [v2 documentation](https://uiwjs.github.io/react-json-view/) and [examples](https://uiwjs.github.io/react-json-view/).
|
|
34
67
|
|
|
68
|
+
- [x] Fully implemented all v1 JSON display features.
|
|
69
|
+
- [ ] Adding editing functionality to v2.
|
|
70
|
+
- [x] Added comprehensive test cases for v2.
|
|
35
71
|
|
|
36
72
|
## Quick Start
|
|
37
73
|
|
|
@@ -126,7 +162,6 @@ export default function Demo() {
|
|
|
126
162
|
}
|
|
127
163
|
```
|
|
128
164
|
|
|
129
|
-
|
|
130
165
|
Example of custom `vscode` theme styles:
|
|
131
166
|
|
|
132
167
|
```tsx mdx:preview
|
|
@@ -146,6 +181,7 @@ const object = {
|
|
|
146
181
|
const customTheme = {
|
|
147
182
|
'--w-rjv-font-family': 'monospace',
|
|
148
183
|
'--w-rjv-color': '#9cdcfe',
|
|
184
|
+
'--w-rjv-key-number': '#268bd2',
|
|
149
185
|
'--w-rjv-key-string': '#9cdcfe',
|
|
150
186
|
'--w-rjv-background-color': '#1e1e1e',
|
|
151
187
|
'--w-rjv-line-color': '#36334280',
|
|
@@ -159,6 +195,7 @@ const customTheme = {
|
|
|
159
195
|
'--w-rjv-curlybraces-color': '#d4d4d4',
|
|
160
196
|
'--w-rjv-colon-color': '#d4d4d4',
|
|
161
197
|
'--w-rjv-brackets-color': '#d4d4d4',
|
|
198
|
+
'--w-rjv-ellipsis-color': '#cb4b16',
|
|
162
199
|
'--w-rjv-quotes-color': 'var(--w-rjv-key-string)',
|
|
163
200
|
'--w-rjv-quotes-string-color': 'var(--w-rjv-type-string-color)',
|
|
164
201
|
|
|
@@ -216,6 +253,7 @@ const object = {
|
|
|
216
253
|
}
|
|
217
254
|
const customTheme = {
|
|
218
255
|
'--w-rjv-color': '#9cdcfe',
|
|
256
|
+
'--w-rjv-key-number': '#268bd2',
|
|
219
257
|
'--w-rjv-key-string': '#9cdcfe',
|
|
220
258
|
'--w-rjv-background-color': '#1e1e1e',
|
|
221
259
|
'--w-rjv-line-color': '#36334280',
|
|
@@ -229,6 +267,7 @@ const customTheme = {
|
|
|
229
267
|
'--w-rjv-curlybraces-color': '#d4d4d4',
|
|
230
268
|
'--w-rjv-colon-color': '#d4d4d4',
|
|
231
269
|
'--w-rjv-brackets-color': '#d4d4d4',
|
|
270
|
+
'--w-rjv-ellipsis-color': '#cb4b16',
|
|
232
271
|
'--w-rjv-quotes-color': '#9cdcfe',
|
|
233
272
|
'--w-rjv-quotes-string-color': '#ce9178',
|
|
234
273
|
|
|
@@ -278,21 +317,31 @@ export default function Demo() {
|
|
|
278
317
|
/>
|
|
279
318
|
<div>
|
|
280
319
|
<Colorful color={hex} onChange={onChange} />
|
|
281
|
-
<div style={{ display: 'flex', gap: '0.4rem', flexDirection: 'column' }}>
|
|
320
|
+
<div style={{ display: 'flex', gap: '0.4rem', flexDirection: 'column', ...customTheme }}>
|
|
282
321
|
{Object.keys(customTheme).map((varname, idx) => {
|
|
283
322
|
const click = () => {
|
|
284
323
|
setCssvar(varname);
|
|
285
324
|
setHex(customTheme[varname]);
|
|
286
325
|
};
|
|
287
326
|
const active = cssvar === varname ? '#a8a8a8' : '';
|
|
288
|
-
return
|
|
327
|
+
return (
|
|
328
|
+
<button key={idx}
|
|
329
|
+
style={{ background: active, border: 0,boxShadow: 'inset 0px 0px 1px #000', display: 'flex', alignItems: 'center', gap: 5, padding: '1px 3px' }}
|
|
330
|
+
onClick={click}
|
|
331
|
+
>
|
|
332
|
+
<span style={{ display: 'inline-block', width: 12, height: 12, background: `var(${varname})` }}></span>
|
|
333
|
+
{varname}
|
|
334
|
+
</button>
|
|
335
|
+
)
|
|
289
336
|
})}
|
|
290
337
|
</div>
|
|
291
338
|
</div>
|
|
292
339
|
</div>
|
|
293
|
-
<
|
|
340
|
+
<div>
|
|
294
341
|
Copy the theme configuration below into your project.
|
|
295
|
-
|
|
342
|
+
</div>
|
|
343
|
+
<pre style={{ padding: 10 }}>
|
|
344
|
+
{JSON.stringify(theme, null, 2)}
|
|
296
345
|
</pre>
|
|
297
346
|
</React.Fragment>
|
|
298
347
|
);
|
|
@@ -324,13 +373,13 @@ export default function Demo() {
|
|
|
324
373
|
}}
|
|
325
374
|
>
|
|
326
375
|
<JsonView.String
|
|
327
|
-
render={({ children, ...reset }, { type }) => {
|
|
328
|
-
const isImg = /^https?.*\.(jpg|png)$/i.test(
|
|
376
|
+
render={({ children, ...reset }, { type, value, keyName }) => {
|
|
377
|
+
const isImg = /^https?.*\.(jpg|png)$/i.test(value)
|
|
329
378
|
if (type === 'type' && isImg) {
|
|
330
379
|
return <span />
|
|
331
380
|
}
|
|
332
381
|
if (type === 'value' && isImg) {
|
|
333
|
-
return <img {...reset} height="26" src={
|
|
382
|
+
return <img {...reset} height="26" src={value} />
|
|
334
383
|
}
|
|
335
384
|
}}
|
|
336
385
|
/>
|
|
@@ -362,7 +411,7 @@ export default function Demo() {
|
|
|
362
411
|
}
|
|
363
412
|
```
|
|
364
413
|
|
|
365
|
-
Supports certain partial customizations such as: `<Copied />`, `<CountInfo />`, `<CountInfoExtra />`, `<Ellipsis />`, `<KeyName />`
|
|
414
|
+
Supports certain partial customizations such as: `<Copied />`, `<CountInfo />`, `<CountInfoExtra />`, `<Ellipsis />`, `<KeyName />`, `<Row />`
|
|
366
415
|
|
|
367
416
|
```tsx mdx:preview
|
|
368
417
|
import React, { Fragment } from 'react';
|
|
@@ -415,6 +464,59 @@ export default function Demo() {
|
|
|
415
464
|
}
|
|
416
465
|
```
|
|
417
466
|
|
|
467
|
+
More in-depth customization ([#19](https://github.com/uiwjs/react-json-view/issues/19))
|
|
468
|
+
|
|
469
|
+
```tsx mdx:preview
|
|
470
|
+
import React from 'react';
|
|
471
|
+
import JsonView from '@uiw/react-json-view';
|
|
472
|
+
|
|
473
|
+
const object = {
|
|
474
|
+
_id: "ObjectId('13212hakjdhajksd')",
|
|
475
|
+
uid: "test1",
|
|
476
|
+
attival_time: new Date('Tue Sep 13 2022 14:07:44 GMT-0500 (Central Daylight Time)'),
|
|
477
|
+
__v: 0
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
export default function Demo() {
|
|
481
|
+
return (
|
|
482
|
+
<JsonView
|
|
483
|
+
value={object}
|
|
484
|
+
// keyName="root"
|
|
485
|
+
displayObjectSize={false}
|
|
486
|
+
style={{
|
|
487
|
+
'--w-rjv-background-color': '#ffffff',
|
|
488
|
+
}}
|
|
489
|
+
>
|
|
490
|
+
<JsonView.Quote render={() => <span />}/>
|
|
491
|
+
<JsonView.String
|
|
492
|
+
render={({ children, ...reset }, { type, value, keyName }) => {
|
|
493
|
+
if (type === 'type') {
|
|
494
|
+
return <span />
|
|
495
|
+
}
|
|
496
|
+
if (type === 'value' && /ObjectId\(['"](.*?)['"]\)/.test(value)) {
|
|
497
|
+
return <span {...reset}>{children}</span>
|
|
498
|
+
}
|
|
499
|
+
}}
|
|
500
|
+
/>
|
|
501
|
+
<JsonView.Date
|
|
502
|
+
render={({ children, ...reset }, { type, value, keyName }) => {
|
|
503
|
+
if (type === 'type') {
|
|
504
|
+
return <span />
|
|
505
|
+
}
|
|
506
|
+
}}
|
|
507
|
+
/>
|
|
508
|
+
<JsonView.Int
|
|
509
|
+
render={({ children, ...reset }, { type, value, keyName }) => {
|
|
510
|
+
if (type === 'type') {
|
|
511
|
+
return <span />
|
|
512
|
+
}
|
|
513
|
+
}}
|
|
514
|
+
/>
|
|
515
|
+
</JsonView>
|
|
516
|
+
)
|
|
517
|
+
}
|
|
518
|
+
```
|
|
519
|
+
|
|
418
520
|
Inspector
|
|
419
521
|
|
|
420
522
|
```tsx mdx:preview
|
|
@@ -526,6 +628,52 @@ Passing **as="tagName"** will automatically infer the type.
|
|
|
526
628
|
/>
|
|
527
629
|
```
|
|
528
630
|
|
|
631
|
+
Add a click event on the data row
|
|
632
|
+
|
|
633
|
+
```tsx mdx:preview
|
|
634
|
+
import React from 'react';
|
|
635
|
+
import JsonView from '@uiw/react-json-view';
|
|
636
|
+
|
|
637
|
+
export default function Demo() {
|
|
638
|
+
return (
|
|
639
|
+
<JsonView
|
|
640
|
+
style={{
|
|
641
|
+
'--w-rjv-background-color': '#ffffff',
|
|
642
|
+
}}
|
|
643
|
+
value={{
|
|
644
|
+
name: 'John',
|
|
645
|
+
age: 30,
|
|
646
|
+
hobbies: ['reading', 'coding', 'swimming'],
|
|
647
|
+
address: {
|
|
648
|
+
street: '123 Main St',
|
|
649
|
+
city: 'New York',
|
|
650
|
+
country: {
|
|
651
|
+
name: 'Main ',
|
|
652
|
+
codex: '123'
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}}
|
|
656
|
+
>
|
|
657
|
+
<JsonView.Row
|
|
658
|
+
as="div"
|
|
659
|
+
render={(props, { keyName, value, parentValue }) => {
|
|
660
|
+
return (
|
|
661
|
+
<div
|
|
662
|
+
{...props}
|
|
663
|
+
onClick={() => {
|
|
664
|
+
console.log("keyName", keyName)
|
|
665
|
+
console.log("value", value)
|
|
666
|
+
console.log("parentValue", parentValue)
|
|
667
|
+
}}
|
|
668
|
+
/>
|
|
669
|
+
)
|
|
670
|
+
}}
|
|
671
|
+
/>
|
|
672
|
+
</JsonView>
|
|
673
|
+
)
|
|
674
|
+
}
|
|
675
|
+
```
|
|
676
|
+
|
|
529
677
|
## Highlight Updates
|
|
530
678
|
|
|
531
679
|
```tsx mdx:preview
|
|
@@ -568,6 +716,82 @@ export default function Demo() {
|
|
|
568
716
|
|
|
569
717
|
This feature can be disabled with `highlightUpdates={false}`, and the default color can be changed with `--w-rjv-update-color`.
|
|
570
718
|
|
|
719
|
+
## Do not display array index
|
|
720
|
+
|
|
721
|
+
```tsx mdx:preview
|
|
722
|
+
import React, { Fragment } from 'react';
|
|
723
|
+
import JsonView from '@uiw/react-json-view';
|
|
724
|
+
|
|
725
|
+
export default function Demo() {
|
|
726
|
+
const value = { data: ["123", 23] }
|
|
727
|
+
return (
|
|
728
|
+
<JsonView value={value} style={{ '--w-rjv-background-color': '#ffffff' }}>
|
|
729
|
+
<JsonView.Colon render={(props, { parentValue, value, keyName }) => {
|
|
730
|
+
if (Array.isArray(parentValue) && props.children == ":") {
|
|
731
|
+
return <span />
|
|
732
|
+
}
|
|
733
|
+
return <span {...props} />
|
|
734
|
+
}}/>
|
|
735
|
+
<JsonView.KeyName
|
|
736
|
+
render={({ ...props }, { type, parentValue, value, keyName }) => {
|
|
737
|
+
if (Array.isArray(parentValue) && Number.isFinite( props.children)) {
|
|
738
|
+
return <span />
|
|
739
|
+
}
|
|
740
|
+
return <span {...props} />
|
|
741
|
+
}}
|
|
742
|
+
/>
|
|
743
|
+
</JsonView>
|
|
744
|
+
)
|
|
745
|
+
}
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
## Default Collapse/Expand
|
|
749
|
+
|
|
750
|
+
Determines whether the node should be expanded on the first render. The default value of `collapsed` is `false`.
|
|
751
|
+
If both `collapsed` and `shouldExpandNodeInitially` are set, `collapsed` takes precedence; `shouldExpandNodeInitially` only takes effect when `collapsed` is `false`.
|
|
752
|
+
|
|
753
|
+
```tsx mdx:preview
|
|
754
|
+
import React, { useState } from 'react';
|
|
755
|
+
import JsonView from '@uiw/react-json-view';
|
|
756
|
+
const object = {
|
|
757
|
+
string: 'Lorem ipsum dolor sit amet',
|
|
758
|
+
integer: 42,
|
|
759
|
+
float: 114.514,
|
|
760
|
+
object: {
|
|
761
|
+
'first-child': true,
|
|
762
|
+
'second-child': false,
|
|
763
|
+
'last-child': null,
|
|
764
|
+
},
|
|
765
|
+
nestedArray: [
|
|
766
|
+
[1, 2],
|
|
767
|
+
[3, 4],
|
|
768
|
+
],
|
|
769
|
+
}
|
|
770
|
+
export default function Demo() {
|
|
771
|
+
const [collapsed, setCollapsed] = useState(false)
|
|
772
|
+
return (
|
|
773
|
+
<>
|
|
774
|
+
<input type="checkbox" id="collapsed" checked={collapsed} onChange={(e) => setCollapsed(e.target.checked)} />
|
|
775
|
+
<label for="collapsed"> collapsed={collapsed == true ? "false" : "2"} </label>
|
|
776
|
+
<JsonView
|
|
777
|
+
value={object}
|
|
778
|
+
collapsed={collapsed == true ? false : 2}
|
|
779
|
+
shouldExpandNodeInitially={(isExpanded, { value, keys, level }) => {
|
|
780
|
+
if (keys.length > 0 && keys[0] == "object") {
|
|
781
|
+
return false
|
|
782
|
+
}
|
|
783
|
+
return isExpanded
|
|
784
|
+
}}
|
|
785
|
+
style={{
|
|
786
|
+
'--w-rjv-background-color': '#ffffff',
|
|
787
|
+
}}
|
|
788
|
+
>
|
|
789
|
+
</JsonView>
|
|
790
|
+
</>
|
|
791
|
+
)
|
|
792
|
+
}
|
|
793
|
+
```
|
|
794
|
+
|
|
571
795
|
## Modify Icon Style
|
|
572
796
|
|
|
573
797
|
Use built-in default icons.
|
|
@@ -653,13 +877,13 @@ export default function Demo() {
|
|
|
653
877
|
if (!isExpanded) {
|
|
654
878
|
return (
|
|
655
879
|
<svg viewBox="0 0 24 24" {...svgProps}>
|
|
656
|
-
<path d="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,
|
|
880
|
+
<path d="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M7,13H17V11H7" />
|
|
657
881
|
</svg>
|
|
658
882
|
);
|
|
659
883
|
}
|
|
660
884
|
return (
|
|
661
885
|
<svg viewBox="0 0 24 24" {...svgProps}>
|
|
662
|
-
<path d="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,
|
|
886
|
+
<path d="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,7H11V11H7V13H11V17H13V13H17V11H13V7Z" />
|
|
663
887
|
</svg>
|
|
664
888
|
);
|
|
665
889
|
}}
|
|
@@ -696,18 +920,28 @@ export interface JsonViewProps<T extends object> extends React.DetailedHTMLProps
|
|
|
696
920
|
displayDataTypes?: boolean;
|
|
697
921
|
/** The user can copy objects and arrays to clipboard by clicking on the clipboard icon. @default true */
|
|
698
922
|
enableClipboard?: boolean;
|
|
923
|
+
/** When set to true, all nodes will be collapsed by default. Use an integer value to collapse at a particular depth. @default false */
|
|
924
|
+
collapsed?: boolean | number;
|
|
925
|
+
/** Determine whether the node should be expanded on the first render, or you can use collapsed to control the level of expansion (by default, the root is expanded). */
|
|
926
|
+
shouldExpandNodeInitially?: ShouldExpandNodeInitially<T>;
|
|
699
927
|
/** Whether to highlight updates. @default true */
|
|
700
928
|
highlightUpdates?: boolean;
|
|
929
|
+
/** Shorten long JSON strings, Set to `0` to disable this feature @default 30 */
|
|
930
|
+
shortenTextAfterLength?: number;
|
|
931
|
+
/** When the text exceeds the length, `...` will be displayed. Currently, this `...` can be customized. @default "..." */
|
|
932
|
+
stringEllipsis?: number;
|
|
701
933
|
/** Callback function for when a treeNode is expanded or collapsed */
|
|
702
|
-
onExpand?: (props: {
|
|
703
|
-
expand: boolean;
|
|
704
|
-
value?: T;
|
|
705
|
-
keyid: string;
|
|
706
|
-
keyName?: string | number;
|
|
707
|
-
}) => void;
|
|
934
|
+
onExpand?: (props: { expand: boolean; value?: T; keyid: string; keyName?: string | number }) => void;
|
|
708
935
|
/** Fires event when you copy */
|
|
709
936
|
onCopied?: (text: string, value?: T) => void;
|
|
710
937
|
}
|
|
938
|
+
export type ShouldExpandNodeInitially<T extends object> = (isExpanded: boolean, props: {
|
|
939
|
+
keyName?: string | number;
|
|
940
|
+
value?: T;
|
|
941
|
+
parentValue?: T;
|
|
942
|
+
keys: (number | string)[];
|
|
943
|
+
level: number;
|
|
944
|
+
}) => boolean;
|
|
711
945
|
```
|
|
712
946
|
|
|
713
947
|
```ts
|
|
@@ -719,6 +953,7 @@ import { Arrow } from './symbol/Arrow';
|
|
|
719
953
|
import { Colon } from './symbol/Colon';
|
|
720
954
|
import { Quote } from './symbol/Quote';
|
|
721
955
|
import { ValueQuote } from './symbol/ValueQuote';
|
|
956
|
+
|
|
722
957
|
import { Bigint } from './types/Bigint';
|
|
723
958
|
import { Date } from './types/Date';
|
|
724
959
|
import { False } from './types/False';
|
|
@@ -732,13 +967,24 @@ import { StringText } from './types/String';
|
|
|
732
967
|
import { True } from './types/True';
|
|
733
968
|
import { Undefined } from './types/Undefined';
|
|
734
969
|
import { Url } from './types/Url';
|
|
970
|
+
|
|
735
971
|
import { Copied } from './section/Copied';
|
|
736
972
|
import { CountInfo } from './section/CountInfo';
|
|
737
973
|
import { CountInfoExtra } from './section/CountInfoExtra';
|
|
738
974
|
import { Ellipsis } from './section/Ellipsis';
|
|
739
975
|
import { KeyName } from './section/KeyName';
|
|
976
|
+
import { Row } from './section/Row';
|
|
740
977
|
|
|
741
978
|
type JsonViewComponent = React.FC<React.PropsWithRef<JsonViewProps<object>>> & {
|
|
979
|
+
BraceLeft: typeof BraceLeft;
|
|
980
|
+
BraceRight: typeof BraceRight;
|
|
981
|
+
BracketsLeft: typeof BracketsLeft;
|
|
982
|
+
BracketsRight: typeof BracketsRight;
|
|
983
|
+
Arrow: typeof Arrow;
|
|
984
|
+
Colon: typeof Colon;
|
|
985
|
+
Quote: typeof Quote;
|
|
986
|
+
ValueQuote: typeof ValueQuote;
|
|
987
|
+
|
|
742
988
|
Bigint: typeof Bigint;
|
|
743
989
|
Date: typeof Date;
|
|
744
990
|
False: typeof False;
|
|
@@ -752,19 +998,13 @@ type JsonViewComponent = React.FC<React.PropsWithRef<JsonViewProps<object>>> & {
|
|
|
752
998
|
True: typeof True;
|
|
753
999
|
Undefined: typeof Undefined;
|
|
754
1000
|
Url: typeof Url;
|
|
755
|
-
|
|
756
|
-
BraceRight: typeof BraceRight;
|
|
757
|
-
BracketsLeft: typeof BracketsLeft;
|
|
758
|
-
BracketsRight: typeof BracketsRight;
|
|
759
|
-
Colon: typeof Colon;
|
|
760
|
-
Ellipsis: typeof Ellipsis;
|
|
761
|
-
Quote: typeof Quote;
|
|
762
|
-
ValueQuote: typeof ValueQuote;
|
|
763
|
-
Arrow: typeof Arrow;
|
|
1001
|
+
|
|
764
1002
|
Copied: typeof Copied;
|
|
765
1003
|
CountInfo: typeof CountInfo;
|
|
766
1004
|
CountInfoExtra: typeof CountInfoExtra;
|
|
1005
|
+
Ellipsis: typeof Ellipsis;
|
|
767
1006
|
KeyName: typeof KeyName;
|
|
1007
|
+
Row: typeof Row;
|
|
768
1008
|
};
|
|
769
1009
|
declare const JsonView: JsonViewComponent;
|
|
770
1010
|
export default JsonView;
|
|
@@ -786,7 +1026,7 @@ Here is the size benchmark (using [bundlephobia.com](https://bundlephobia.com))
|
|
|
786
1026
|
| [react-domify](https://github.com/JedWatson/react-domify) | [](https://bundlephobia.com/result?p=react-domify) [](https://bundlephobia.com/result?p=react-domify) | [](https://bundlephobia.com/result?p=react-domify) | [](https://github.com/JedWatson/react-domify/commits) | [](https://www.npmjs.com/package/react-domify) | ❌ | [demo](https://jedwatson.github.io/react-domify/) |
|
|
787
1027
|
| [react18-json-view](https://github.com/YYsuni/react18-json-view) | [](https://bundlephobia.com/result?p=react18-json-view) [](https://bundlephobia.com/result?p=react18-json-view) | [](https://bundlephobia.com/result?p=react18-json-view) | [](https://github.com/YYsuni/react18-json-view/commits) | [](https://www.npmjs.com/package/react18-json-view) | ❌ | [demo](https://jv.yysuni.com/) |
|
|
788
1028
|
| [@textea/json-viewer](https://github.com/TexteaInc/json-viewer) | [](https://bundlephobia.com/result?p=@textea/json-viewer) [](https://bundlephobia.com/result?p=@textea/json-viewer) | [](https://bundlephobia.com/result?p=@textea/json-viewer) | [](https://github.com/TexteaInc/json-viewer/commits) | [](https://www.npmjs.com/package/@textea/json-viewer) | ✅ | [demo](https://stackblitz.com/edit/textea-json-viewer-v3-b4wgxq) |
|
|
789
|
-
| [react-editable-json-tree](https://github.com/oxyno-zeta/react-editable-json-tree) | [](https://bundlephobia.com/result?p=react-editable-json-tree) [](https://bundlephobia.com/result?p=react-editable-json-tree) | [](https://bundlephobia.com/result?p=react-editable-json-tree) | [ | [](https://bundlephobia.com/result?p=react-editable-json-tree) [](https://bundlephobia.com/result?p=react-editable-json-tree) | [](https://bundlephobia.com/result?p=react-editable-json-tree) | [](https://github.com/oxyno-zeta/react-editable-json-tree/commits) | [](https://www.npmjs.com/package/react-editable-json-tree) | ✅ | [demo](https://oxyno-zeta.github.io/react-editable-json-tree/) |
|
|
790
1030
|
| [react-json-view](https://github.com/HuolalaTech/react-json-view) | [](https://bundlephobia.com/result?p=@huolala-tech/react-json-view) [](https://bundlephobia.com/result?p=@huolala-tech/react-json-view) | [](https://bundlephobia.com/result?p=@huolala-tech/react-json-view) | [](https://github.com/HuolalaTech/react-json-view/commits) | [](https://www.npmjs.com/package/@huolala-tech/react-json-view) | ❌ | [demo](https://huolalatech.github.io/react-json-view/) |
|
|
791
1031
|
|
|
792
1032
|
## Development
|
package/basic.d.ts
ADDED
package/cjs/Container.d.ts
CHANGED
|
@@ -6,5 +6,7 @@ export interface ContainerProps<T extends object> extends React.HTMLAttributes<H
|
|
|
6
6
|
level?: number;
|
|
7
7
|
value?: T;
|
|
8
8
|
initialValue?: T;
|
|
9
|
+
/** Index of the parent `keyName` */
|
|
10
|
+
keys?: (string | number)[];
|
|
9
11
|
}
|
|
10
12
|
export declare const Container: React.ForwardRefExoticComponent<ContainerProps<object> & React.RefAttributes<HTMLDivElement>>;
|
package/cjs/Container.js
CHANGED
|
@@ -13,10 +13,11 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _NestedClose = require("./comps/NestedClose");
|
|
14
14
|
var _NestedOpen = require("./comps/NestedOpen");
|
|
15
15
|
var _KeyValues = require("./comps/KeyValues");
|
|
16
|
+
var _useIdCompat = require("./comps/useIdCompat");
|
|
16
17
|
var _ShowTools = require("./store/ShowTools");
|
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
var _excluded = ["className", "children", "parentValue", "keyid", "level", "value", "initialValue", "keyName"];
|
|
19
|
-
var Container = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
19
|
+
var _excluded = ["className", "children", "parentValue", "keyid", "level", "value", "initialValue", "keys", "keyName"];
|
|
20
|
+
var Container = exports.Container = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
20
21
|
var _props$className = props.className,
|
|
21
22
|
className = _props$className === void 0 ? '' : _props$className,
|
|
22
23
|
children = props.children,
|
|
@@ -26,10 +27,11 @@ var Container = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
26
27
|
level = _props$level === void 0 ? 1 : _props$level,
|
|
27
28
|
value = props.value,
|
|
28
29
|
initialValue = props.initialValue,
|
|
30
|
+
keys = props.keys,
|
|
29
31
|
keyName = props.keyName,
|
|
30
32
|
elmProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
31
33
|
var dispatch = (0, _ShowTools.useShowToolsDispatch)();
|
|
32
|
-
var subkeyid = (0,
|
|
34
|
+
var subkeyid = (0, _useIdCompat.useIdCompat)();
|
|
33
35
|
var defaultClassNames = [className, 'w-rjv-inner'].filter(Boolean).join(' ');
|
|
34
36
|
var reset = {
|
|
35
37
|
onMouseEnter: function onMouseEnter() {
|
|
@@ -47,18 +49,25 @@ var Container = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
47
49
|
expandKey: subkeyid,
|
|
48
50
|
value: value,
|
|
49
51
|
level: level,
|
|
52
|
+
keys: keys,
|
|
53
|
+
parentValue: parentValue,
|
|
50
54
|
keyName: keyName,
|
|
51
55
|
initialValue: initialValue
|
|
52
56
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_KeyValues.KeyValues, {
|
|
53
57
|
expandKey: subkeyid,
|
|
54
58
|
value: value,
|
|
55
|
-
level: level
|
|
59
|
+
level: level,
|
|
60
|
+
keys: keys,
|
|
61
|
+
parentValue: parentValue,
|
|
62
|
+
keyName: keyName
|
|
56
63
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_NestedClose.NestedClose, {
|
|
57
64
|
expandKey: subkeyid,
|
|
58
65
|
value: value,
|
|
59
|
-
level: level
|
|
66
|
+
level: level,
|
|
67
|
+
keys: keys,
|
|
68
|
+
parentValue: parentValue,
|
|
69
|
+
keyName: keyName
|
|
60
70
|
})]
|
|
61
71
|
}));
|
|
62
72
|
});
|
|
63
|
-
exports.Container = Container;
|
|
64
73
|
Container.displayName = 'JVR.Container';
|
|
@@ -18,7 +18,7 @@ function TriangleArrow(props) {
|
|
|
18
18
|
height: '1em',
|
|
19
19
|
width: '1em',
|
|
20
20
|
userSelect: 'none',
|
|
21
|
-
display: 'flex'
|
|
21
|
+
display: 'inline-flex'
|
|
22
22
|
}, style);
|
|
23
23
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
24
24
|
viewBox: "0 0 24 24",
|
package/cjs/comps/Copied.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { type SectionElementResult } from '../store/Section';
|
|
2
2
|
import { type TagType } from '../store/Types';
|
|
3
3
|
export type CopiedOption<T extends object> = {
|
|
4
4
|
value?: T;
|
|
5
5
|
copied: boolean;
|
|
6
6
|
setCopied: React.Dispatch<React.SetStateAction<boolean>>;
|
|
7
7
|
};
|
|
8
|
-
export interface CopiedProps<T extends object> extends React.SVGProps<SVGSVGElement> {
|
|
9
|
-
value?: T;
|
|
10
|
-
keyName: string | number;
|
|
8
|
+
export interface CopiedProps<T extends object> extends React.SVGProps<SVGSVGElement>, SectionElementResult<T> {
|
|
11
9
|
expandKey: string;
|
|
10
|
+
beforeCopy?: (copyText: string, keyName?: string | number, value?: T, parentValue?: T, expandKey?: string, keys?: (number | string)[]) => string;
|
|
12
11
|
}
|
|
13
12
|
export declare const Copied: {
|
|
14
13
|
<T extends object, K extends TagType>(props: CopiedProps<T>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|