JSX.Element | Function
| False | `(usage, keyPath, deep, keyName, data, dataType) => ` |
+| Key | Description | Type | Required | Default |
+| :----------: |:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| :--------------------------------------: | :------: | :------------------------------------------------------------: |
+| inputElement | Custom input element to edit a value which may be of any JSON type. It must be able to have a ref attached to it. If it's a custom element (not a DOM element), you need to use [ref forwarding](https://reactjs.org/docs/forwarding-refs.html). | JSX.Element | Function
| False | `(usage, keyPath, deep, keyName, data, dataType) => ` |
The library will add a `placeholder`, `ref`, and `defaultValue` prop to the
element. This element will be focused when possible.
diff --git a/dev_app/src/components/Body.tsx b/dev_app/src/components/Body.tsx
index 0cbb6d5..37c9ddd 100644
--- a/dev_app/src/components/Body.tsx
+++ b/dev_app/src/components/Body.tsx
@@ -5,15 +5,35 @@
*/
import _ from "lodash";
-import React, { useCallback, useRef, useState } from "react";
+import React, { ChangeEvent, useCallback, useRef, useState } from "react";
// @ts-ignore
import { JsonTree } from "react-editable-json-tree";
-import { trySetRefAttr } from "../utils/misc";
+
+const styles = {
+ table: {
+ width: "100%",
+ },
+ cell: {
+ verticalAlign: "top",
+ },
+ code: {
+ backgroundColor: "#e0e0e0",
+ border: "1px lightgrey solid",
+ },
+ container: {
+ margin: "0 15px",
+ minWidth: "200px",
+ },
+ customInput: {
+ backgroundColor: "black",
+ color: "yellow",
+ border: "1px solid green",
+ },
+};
const defaultJson = {
error: new Error("error"),
func: () => {
- // eslint-disable-next-line no-console
console.log("test");
},
text: "text",
@@ -33,27 +53,39 @@ const defaultJson = {
type ReadOnlyCallback = (
name: string,
value: unknown,
- keyPath: string
+ keyPath: string[]
) => boolean;
function Body() {
+ //region State
+
const [json, setJson] = useState(_.cloneDeep(defaultJson));
const [deltaUpdateString, setDeltaUpdateString] = useState("{}");
- const [readOnly, setReadOnly] = useState@@ -246,31 +251,31 @@ function Body() { | |||||||
---|---|---|---|---|---|---|---|
-
+
+ |
-
- |
- {globalUpdateString}+
+ |
-
+
{globalUpdateString}
- |
- {deltaUpdateString}+
+ |
-
+
{deltaUpdateString}
- |
+
+ | |