json-edit-react 1.0.0 → 1.1.1
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 +13 -4
- package/build/index.cjs.js +1 -1081
- package/build/index.d.ts +151 -114
- package/build/index.esm.js +1 -1078
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ Features include:
|
|
|
10
10
|
- fine-grained control over which elements can be edited, deleted, or added to
|
|
11
11
|
- customisable UI, through simple, pre-defined [themes](#themes), or specific CSS overrides
|
|
12
12
|
- self-contained — rendered with plain HTML/CSS, so no dependance on external UI libraries
|
|
13
|
+
- provide your own [custom component](#custom-nodes) to integrate specialised UI for certain data.
|
|
13
14
|
|
|
14
15
|
**[Explore the Demo](https://carlosnz.github.io/json-edit-react/)**
|
|
15
16
|
|
|
@@ -46,14 +47,21 @@ or
|
|
|
46
47
|
|
|
47
48
|
## Implementation
|
|
48
49
|
|
|
49
|
-
```
|
|
50
|
+
```jsx
|
|
50
51
|
import { JsonEditor } from 'json-edit-react'
|
|
51
52
|
|
|
52
53
|
// In your React components:
|
|
53
|
-
<JsonEditor
|
|
54
|
-
|
|
54
|
+
<JsonEditor
|
|
55
|
+
data={ myData }
|
|
56
|
+
onUpdate={ ({newData} ) => {
|
|
57
|
+
// Set "myData" state, plus
|
|
58
|
+
// any desired side-effects.
|
|
59
|
+
}}
|
|
60
|
+
{ ...otherProps } />
|
|
55
61
|
```
|
|
56
62
|
|
|
63
|
+
You are responsible for maintaining the data state — in your `onUpdate` function, use the `newData` property to set `data`, which should update inside the editor.
|
|
64
|
+
|
|
57
65
|
## Usage
|
|
58
66
|
|
|
59
67
|
**(for end user)**
|
|
@@ -68,7 +76,7 @@ It's pretty self explanatory (click the "edit" icon to edit, etc.), but there ar
|
|
|
68
76
|
|
|
69
77
|
## Props overview
|
|
70
78
|
|
|
71
|
-
The only *required* value is `data`.
|
|
79
|
+
The only *required* value is `data`.
|
|
72
80
|
|
|
73
81
|
| prop | type | default | description |
|
|
74
82
|
| ----------------------- | -------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -393,6 +401,7 @@ This component is heavily inspired by [react-json-view](https://github.com/mac-s
|
|
|
393
401
|
|
|
394
402
|
## Changelog
|
|
395
403
|
|
|
404
|
+
- **1.1.0**: Don't manage data state within component
|
|
396
405
|
- **1.0.0**:
|
|
397
406
|
- [Custom nodes](#custom-nodes)
|
|
398
407
|
- Allow editing of keys
|