@uiw/react-json-view 2.0.0-alpha.12 → 2.0.0-alpha.14
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/cjs/Container.d.ts +2 -0
- package/cjs/Container.js +4 -2
- package/cjs/comps/KeyValues.d.ts +2 -4
- package/cjs/comps/KeyValues.js +10 -2
- package/cjs/index.js +3 -1
- package/cjs/section/KeyName.d.ts +7 -7
- package/cjs/section/KeyName.js +4 -2
- package/cjs/section/Row.d.ts +3 -5
- package/cjs/section/Row.js +10 -9
- package/cjs/store/Section.d.ts +8 -5
- package/esm/Container.d.ts +2 -0
- package/esm/Container.js +4 -2
- package/esm/comps/KeyValues.d.ts +2 -4
- package/esm/comps/KeyValues.js +7 -2
- package/esm/index.js +4 -2
- package/esm/section/KeyName.d.ts +7 -7
- package/esm/section/KeyName.js +4 -2
- package/esm/section/Row.d.ts +3 -5
- package/esm/section/Row.js +9 -7
- package/esm/store/Section.d.ts +8 -5
- package/package.json +1 -1
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
|
@@ -15,7 +15,7 @@ var _NestedOpen = require("./comps/NestedOpen");
|
|
|
15
15
|
var _KeyValues = require("./comps/KeyValues");
|
|
16
16
|
var _ShowTools = require("./store/ShowTools");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
var _excluded = ["className", "children", "parentValue", "keyid", "level", "value", "initialValue", "keyName"];
|
|
18
|
+
var _excluded = ["className", "children", "parentValue", "keyid", "level", "value", "initialValue", "keys", "keyName"];
|
|
19
19
|
var Container = exports.Container = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
20
20
|
var _props$className = props.className,
|
|
21
21
|
className = _props$className === void 0 ? '' : _props$className,
|
|
@@ -26,6 +26,7 @@ var Container = exports.Container = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
26
26
|
level = _props$level === void 0 ? 1 : _props$level,
|
|
27
27
|
value = props.value,
|
|
28
28
|
initialValue = props.initialValue,
|
|
29
|
+
keys = props.keys,
|
|
29
30
|
keyName = props.keyName,
|
|
30
31
|
elmProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
31
32
|
var dispatch = (0, _ShowTools.useShowToolsDispatch)();
|
|
@@ -52,7 +53,8 @@ var Container = exports.Container = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
52
53
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_KeyValues.KeyValues, {
|
|
53
54
|
expandKey: subkeyid,
|
|
54
55
|
value: value,
|
|
55
|
-
level: level
|
|
56
|
+
level: level,
|
|
57
|
+
keys: keys
|
|
56
58
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_NestedClose.NestedClose, {
|
|
57
59
|
expandKey: subkeyid,
|
|
58
60
|
value: value,
|
package/cjs/comps/KeyValues.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
value?: T;
|
|
4
|
-
parentValue?: T;
|
|
1
|
+
import { type SectionElementResult } from '../store/Section';
|
|
2
|
+
interface KeyValuesProps<T extends object> extends SectionElementResult<T> {
|
|
5
3
|
expandKey?: string;
|
|
6
4
|
level: number;
|
|
7
5
|
}
|
package/cjs/comps/KeyValues.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.KeyValuesItem = exports.KeyValues = exports.KayName = void 0;
|
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
13
|
var _react = require("react");
|
|
13
14
|
var _store = require("../store");
|
|
@@ -25,7 +26,9 @@ var KeyValues = exports.KeyValues = function KeyValues(props) {
|
|
|
25
26
|
var value = props.value,
|
|
26
27
|
_props$expandKey = props.expandKey,
|
|
27
28
|
expandKey = _props$expandKey === void 0 ? '' : _props$expandKey,
|
|
28
|
-
level = props.level
|
|
29
|
+
level = props.level,
|
|
30
|
+
_props$keys = props.keys,
|
|
31
|
+
keys = _props$keys === void 0 ? [] : _props$keys;
|
|
29
32
|
var expands = (0, _Expands.useExpandsStore)();
|
|
30
33
|
var _useStore = (0, _store.useStore)(),
|
|
31
34
|
objectSortKeys = _useStore.objectSortKeys,
|
|
@@ -72,6 +75,7 @@ var KeyValues = exports.KeyValues = function KeyValues(props) {
|
|
|
72
75
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(KeyValuesItem, {
|
|
73
76
|
parentValue: value,
|
|
74
77
|
keyName: key,
|
|
78
|
+
keys: [].concat((0, _toConsumableArray2["default"])(keys), [key]),
|
|
75
79
|
value: val,
|
|
76
80
|
level: level
|
|
77
81
|
}, idx);
|
|
@@ -116,7 +120,9 @@ var KeyValuesItem = exports.KeyValuesItem = function KeyValuesItem(props) {
|
|
|
116
120
|
value = props.value,
|
|
117
121
|
parentValue = props.parentValue,
|
|
118
122
|
_props$level = props.level,
|
|
119
|
-
level = _props$level === void 0 ? 0 : _props$level
|
|
123
|
+
level = _props$level === void 0 ? 0 : _props$level,
|
|
124
|
+
_props$keys2 = props.keys,
|
|
125
|
+
keys = _props$keys2 === void 0 ? [] : _props$keys2;
|
|
120
126
|
var dispatch = (0, _ShowTools.useShowToolsDispatch)();
|
|
121
127
|
var subkeyid = (0, _react.useId)();
|
|
122
128
|
var isMyArray = Array.isArray(value);
|
|
@@ -133,6 +139,7 @@ var KeyValuesItem = exports.KeyValuesItem = function KeyValuesItem(props) {
|
|
|
133
139
|
value: myValue,
|
|
134
140
|
parentValue: parentValue,
|
|
135
141
|
initialValue: value,
|
|
142
|
+
keys: keys,
|
|
136
143
|
level: level + 1
|
|
137
144
|
});
|
|
138
145
|
}
|
|
@@ -148,6 +155,7 @@ var KeyValuesItem = exports.KeyValuesItem = function KeyValuesItem(props) {
|
|
|
148
155
|
className: "w-rjv-line",
|
|
149
156
|
value: value,
|
|
150
157
|
keyName: keyName,
|
|
158
|
+
keys: keys,
|
|
151
159
|
parentValue: parentValue
|
|
152
160
|
}, reset), {}, {
|
|
153
161
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(KayName, {
|
package/cjs/index.js
CHANGED
|
@@ -110,7 +110,7 @@ Object.keys(_symbol).forEach(function (key) {
|
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
|
-
var _excluded = ["className", "style", "value", "children", "collapsed", "indentWidth", "displayObjectSize", "shortenTextAfterLength", "highlightUpdates", "enableClipboard", "displayDataTypes", "objectSortKeys", "onExpand"];
|
|
113
|
+
var _excluded = ["className", "style", "value", "children", "collapsed", "indentWidth", "displayObjectSize", "shortenTextAfterLength", "highlightUpdates", "enableClipboard", "displayDataTypes", "objectSortKeys", "onExpand", "onCopied"];
|
|
114
114
|
var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
115
115
|
var _props$className = props.className,
|
|
116
116
|
className = _props$className === void 0 ? '' : _props$className,
|
|
@@ -133,6 +133,7 @@ var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
133
133
|
_props$objectSortKeys = props.objectSortKeys,
|
|
134
134
|
objectSortKeys = _props$objectSortKeys === void 0 ? false : _props$objectSortKeys,
|
|
135
135
|
onExpand = props.onExpand,
|
|
136
|
+
onCopied = props.onCopied,
|
|
136
137
|
elmProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
137
138
|
var defaultStyle = (0, _objectSpread2["default"])({
|
|
138
139
|
lineHeight: 1.4,
|
|
@@ -152,6 +153,7 @@ var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
152
153
|
enableClipboard: enableClipboard,
|
|
153
154
|
shortenTextAfterLength: shortenTextAfterLength,
|
|
154
155
|
highlightUpdates: highlightUpdates,
|
|
156
|
+
onCopied: onCopied,
|
|
155
157
|
onExpand: onExpand
|
|
156
158
|
},
|
|
157
159
|
initialTypes: {
|
package/cjs/section/KeyName.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
2
|
import { type TagType } from '../store/Types';
|
|
3
3
|
import { type SectionElement } from '../store/Section';
|
|
4
|
+
import { type SectionElementResult } from '../store/Section';
|
|
4
5
|
export declare const KeyName: {
|
|
5
6
|
<K extends TagType>(props: SectionElement<K>): null;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
export interface KeyNameCompProps<T extends object> extends React.HTMLAttributes<HTMLSpanElement>, SectionElementResult<T> {
|
|
10
|
+
}
|
|
11
|
+
export declare const KeyNameComp: {
|
|
12
|
+
<T extends object>(props: PropsWithChildren<KeyNameCompProps<T>>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
displayName: string;
|
|
12
14
|
};
|
|
13
|
-
export declare const KeyNameComp: FC<PropsWithChildren<KeyNameCompProps>>;
|
|
14
|
-
export {};
|
package/cjs/section/KeyName.js
CHANGED
|
@@ -23,7 +23,8 @@ var KeyNameComp = exports.KeyNameComp = function KeyNameComp(props) {
|
|
|
23
23
|
var children = props.children,
|
|
24
24
|
value = props.value,
|
|
25
25
|
parentValue = props.parentValue,
|
|
26
|
-
keyName = props.keyName
|
|
26
|
+
keyName = props.keyName,
|
|
27
|
+
keys = props.keys;
|
|
27
28
|
var isNumber = typeof children === 'number';
|
|
28
29
|
var style = {
|
|
29
30
|
color: isNumber ? 'var(--w-rjv-key-number, #268bd2)' : 'var(--w-rjv-key-string, #002b36)'
|
|
@@ -41,7 +42,8 @@ var KeyNameComp = exports.KeyNameComp = function KeyNameComp(props) {
|
|
|
41
42
|
}), {
|
|
42
43
|
value: value,
|
|
43
44
|
parentValue: parentValue,
|
|
44
|
-
keyName: keyName
|
|
45
|
+
keyName: keyName,
|
|
46
|
+
keys: keys
|
|
45
47
|
});
|
|
46
48
|
if (child) return child;
|
|
47
49
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
|
package/cjs/section/Row.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type TagType } from '../store/Types';
|
|
3
3
|
import { type SectionElement } from '../store/Section';
|
|
4
|
+
import { type SectionElementResult } from '../store/Section';
|
|
4
5
|
export declare const Row: {
|
|
5
6
|
<K extends TagType>(props: SectionElement<K>): null;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
8
|
-
export interface RowCompProps<T extends object> extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
-
value?: T;
|
|
10
|
-
keyName?: string | number;
|
|
11
|
-
parentValue?: unknown;
|
|
9
|
+
export interface RowCompProps<T extends object> extends React.HTMLAttributes<HTMLDivElement>, SectionElementResult<T> {
|
|
12
10
|
}
|
|
13
11
|
export declare const RowComp: {
|
|
14
|
-
<T extends object>(
|
|
12
|
+
<T extends object>(props: import("react").PropsWithChildren<RowCompProps<T>>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element;
|
|
15
13
|
displayName: string;
|
|
16
14
|
};
|
package/cjs/section/Row.js
CHANGED
|
@@ -10,7 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _Section = require("../store/Section");
|
|
11
11
|
var _useRender = require("../utils/useRender");
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
var _excluded = ["children", "value", "keyName", "
|
|
13
|
+
var _excluded = ["children", "value", "parentValue", "keyName", "keys"],
|
|
14
14
|
_excluded2 = ["as", "render", "children"];
|
|
15
15
|
var Row = exports.Row = function Row(props) {
|
|
16
16
|
var _useSectionStore = (0, _Section.useSectionStore)(),
|
|
@@ -20,13 +20,13 @@ var Row = exports.Row = function Row(props) {
|
|
|
20
20
|
return null;
|
|
21
21
|
};
|
|
22
22
|
Row.displayName = 'JVR.Row';
|
|
23
|
-
var RowComp = exports.RowComp = function RowComp(
|
|
24
|
-
var children =
|
|
25
|
-
value =
|
|
26
|
-
|
|
27
|
-
keyName =
|
|
28
|
-
|
|
29
|
-
other = (0, _objectWithoutProperties2["default"])(
|
|
23
|
+
var RowComp = exports.RowComp = function RowComp(props) {
|
|
24
|
+
var children = props.children,
|
|
25
|
+
value = props.value,
|
|
26
|
+
parentValue = props.parentValue,
|
|
27
|
+
keyName = props.keyName,
|
|
28
|
+
keys = props.keys,
|
|
29
|
+
other = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
30
30
|
var _useSectionStore2 = (0, _Section.useSectionStore)(),
|
|
31
31
|
_useSectionStore2$Row = _useSectionStore2.Row,
|
|
32
32
|
Comp = _useSectionStore2$Row === void 0 ? {} : _useSectionStore2$Row;
|
|
@@ -40,7 +40,8 @@ var RowComp = exports.RowComp = function RowComp(_ref) {
|
|
|
40
40
|
}), {
|
|
41
41
|
value: value,
|
|
42
42
|
keyName: keyName,
|
|
43
|
-
parentValue: parentValue
|
|
43
|
+
parentValue: parentValue,
|
|
44
|
+
keys: keys
|
|
44
45
|
});
|
|
45
46
|
if (child) return child;
|
|
46
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, other), reset), {}, {
|
package/cjs/store/Section.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import React, { FC, PropsWithChildren, ComponentPropsWithoutRef } from 'react';
|
|
2
2
|
import { type TagType } from './Types';
|
|
3
|
+
export interface SectionElementResult<T extends object, K = string | number> {
|
|
4
|
+
value?: T;
|
|
5
|
+
parentValue?: T;
|
|
6
|
+
keyName?: K;
|
|
7
|
+
/** Index of the parent `keyName` */
|
|
8
|
+
keys?: K[];
|
|
9
|
+
}
|
|
3
10
|
export type SectionElementProps<T extends TagType = 'span'> = {
|
|
4
11
|
as?: T;
|
|
5
|
-
render?: (props: SectionElement<T>, result:
|
|
6
|
-
value: unknown;
|
|
7
|
-
parentValue?: unknown;
|
|
8
|
-
keyName: string | number;
|
|
9
|
-
}) => React.ReactNode;
|
|
12
|
+
render?: (props: SectionElement<T>, result: SectionElementResult<object>) => React.ReactNode;
|
|
10
13
|
};
|
|
11
14
|
export type SectionElement<T extends TagType = 'span'> = SectionElementProps<T> & ComponentPropsWithoutRef<T>;
|
|
12
15
|
type InitialState<T extends TagType> = {
|
package/esm/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/esm/Container.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["className", "children", "parentValue", "keyid", "level", "value", "initialValue", "keyName"];
|
|
3
|
+
var _excluded = ["className", "children", "parentValue", "keyid", "level", "value", "initialValue", "keys", "keyName"];
|
|
4
4
|
import React, { forwardRef, useId } from 'react';
|
|
5
5
|
import { NestedClose } from './comps/NestedClose';
|
|
6
6
|
import { NestedOpen } from './comps/NestedOpen';
|
|
@@ -14,6 +14,7 @@ export var Container = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
14
14
|
level = 1,
|
|
15
15
|
value,
|
|
16
16
|
initialValue,
|
|
17
|
+
keys,
|
|
17
18
|
keyName
|
|
18
19
|
} = props,
|
|
19
20
|
elmProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
@@ -41,7 +42,8 @@ export var Container = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
41
42
|
}), /*#__PURE__*/_jsx(KeyValues, {
|
|
42
43
|
expandKey: subkeyid,
|
|
43
44
|
value: value,
|
|
44
|
-
level: level
|
|
45
|
+
level: level,
|
|
46
|
+
keys: keys
|
|
45
47
|
}), /*#__PURE__*/_jsx(NestedClose, {
|
|
46
48
|
expandKey: subkeyid,
|
|
47
49
|
value: value,
|
package/esm/comps/KeyValues.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
value?: T;
|
|
4
|
-
parentValue?: T;
|
|
1
|
+
import { type SectionElementResult } from '../store/Section';
|
|
2
|
+
interface KeyValuesProps<T extends object> extends SectionElementResult<T> {
|
|
5
3
|
expandKey?: string;
|
|
6
4
|
level: number;
|
|
7
5
|
}
|
package/esm/comps/KeyValues.js
CHANGED
|
@@ -16,7 +16,8 @@ export var KeyValues = props => {
|
|
|
16
16
|
var {
|
|
17
17
|
value,
|
|
18
18
|
expandKey = '',
|
|
19
|
-
level
|
|
19
|
+
level,
|
|
20
|
+
keys = []
|
|
20
21
|
} = props;
|
|
21
22
|
var expands = useExpandsStore();
|
|
22
23
|
var {
|
|
@@ -55,6 +56,7 @@ export var KeyValues = props => {
|
|
|
55
56
|
return /*#__PURE__*/_jsx(KeyValuesItem, {
|
|
56
57
|
parentValue: value,
|
|
57
58
|
keyName: key,
|
|
59
|
+
keys: [...keys, key],
|
|
58
60
|
value: val,
|
|
59
61
|
level: level
|
|
60
62
|
}, idx);
|
|
@@ -102,7 +104,8 @@ export var KeyValuesItem = props => {
|
|
|
102
104
|
keyName,
|
|
103
105
|
value,
|
|
104
106
|
parentValue,
|
|
105
|
-
level = 0
|
|
107
|
+
level = 0,
|
|
108
|
+
keys = []
|
|
106
109
|
} = props;
|
|
107
110
|
var dispatch = useShowToolsDispatch();
|
|
108
111
|
var subkeyid = useId();
|
|
@@ -120,6 +123,7 @@ export var KeyValuesItem = props => {
|
|
|
120
123
|
value: myValue,
|
|
121
124
|
parentValue: parentValue,
|
|
122
125
|
initialValue: value,
|
|
126
|
+
keys: keys,
|
|
123
127
|
level: level + 1
|
|
124
128
|
});
|
|
125
129
|
}
|
|
@@ -135,6 +139,7 @@ export var KeyValuesItem = props => {
|
|
|
135
139
|
className: "w-rjv-line",
|
|
136
140
|
value: value,
|
|
137
141
|
keyName: keyName,
|
|
142
|
+
keys: keys,
|
|
138
143
|
parentValue: parentValue
|
|
139
144
|
}, reset, {
|
|
140
145
|
children: [/*#__PURE__*/_jsx(KayName, {
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["className", "style", "value", "children", "collapsed", "indentWidth", "displayObjectSize", "shortenTextAfterLength", "highlightUpdates", "enableClipboard", "displayDataTypes", "objectSortKeys", "onExpand"];
|
|
3
|
+
var _excluded = ["className", "style", "value", "children", "collapsed", "indentWidth", "displayObjectSize", "shortenTextAfterLength", "highlightUpdates", "enableClipboard", "displayDataTypes", "objectSortKeys", "onExpand", "onCopied"];
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
5
|
import { Provider } from './store';
|
|
6
6
|
import { Container } from './Container';
|
|
@@ -53,7 +53,8 @@ var JsonView = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
53
53
|
enableClipboard = true,
|
|
54
54
|
displayDataTypes = true,
|
|
55
55
|
objectSortKeys = false,
|
|
56
|
-
onExpand
|
|
56
|
+
onExpand,
|
|
57
|
+
onCopied
|
|
57
58
|
} = props,
|
|
58
59
|
elmProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
59
60
|
var defaultStyle = _extends({
|
|
@@ -74,6 +75,7 @@ var JsonView = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
74
75
|
enableClipboard,
|
|
75
76
|
shortenTextAfterLength,
|
|
76
77
|
highlightUpdates,
|
|
78
|
+
onCopied,
|
|
77
79
|
onExpand
|
|
78
80
|
},
|
|
79
81
|
initialTypes: {
|
package/esm/section/KeyName.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
2
|
import { type TagType } from '../store/Types';
|
|
3
3
|
import { type SectionElement } from '../store/Section';
|
|
4
|
+
import { type SectionElementResult } from '../store/Section';
|
|
4
5
|
export declare const KeyName: {
|
|
5
6
|
<K extends TagType>(props: SectionElement<K>): null;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
export interface KeyNameCompProps<T extends object> extends React.HTMLAttributes<HTMLSpanElement>, SectionElementResult<T> {
|
|
10
|
+
}
|
|
11
|
+
export declare const KeyNameComp: {
|
|
12
|
+
<T extends object>(props: PropsWithChildren<KeyNameCompProps<T>>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
displayName: string;
|
|
12
14
|
};
|
|
13
|
-
export declare const KeyNameComp: FC<PropsWithChildren<KeyNameCompProps>>;
|
|
14
|
-
export {};
|
package/esm/section/KeyName.js
CHANGED
|
@@ -17,7 +17,8 @@ export var KeyNameComp = props => {
|
|
|
17
17
|
children,
|
|
18
18
|
value,
|
|
19
19
|
parentValue,
|
|
20
|
-
keyName
|
|
20
|
+
keyName,
|
|
21
|
+
keys
|
|
21
22
|
} = props;
|
|
22
23
|
var isNumber = typeof children === 'number';
|
|
23
24
|
var style = {
|
|
@@ -38,7 +39,8 @@ export var KeyNameComp = props => {
|
|
|
38
39
|
}), {
|
|
39
40
|
value,
|
|
40
41
|
parentValue,
|
|
41
|
-
keyName
|
|
42
|
+
keyName,
|
|
43
|
+
keys
|
|
42
44
|
});
|
|
43
45
|
if (child) return child;
|
|
44
46
|
return /*#__PURE__*/_jsx(Elm, _extends({}, reset, {
|
package/esm/section/Row.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type TagType } from '../store/Types';
|
|
3
3
|
import { type SectionElement } from '../store/Section';
|
|
4
|
+
import { type SectionElementResult } from '../store/Section';
|
|
4
5
|
export declare const Row: {
|
|
5
6
|
<K extends TagType>(props: SectionElement<K>): null;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
8
|
-
export interface RowCompProps<T extends object> extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
-
value?: T;
|
|
10
|
-
keyName?: string | number;
|
|
11
|
-
parentValue?: unknown;
|
|
9
|
+
export interface RowCompProps<T extends object> extends React.HTMLAttributes<HTMLDivElement>, SectionElementResult<T> {
|
|
12
10
|
}
|
|
13
11
|
export declare const RowComp: {
|
|
14
|
-
<T extends object>(
|
|
12
|
+
<T extends object>(props: import("react").PropsWithChildren<RowCompProps<T>>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element;
|
|
15
13
|
displayName: string;
|
|
16
14
|
};
|
package/esm/section/Row.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["children", "value", "keyName", "
|
|
3
|
+
var _excluded = ["children", "value", "parentValue", "keyName", "keys"],
|
|
4
4
|
_excluded2 = ["as", "render", "children"];
|
|
5
5
|
import { useSectionStore } from '../store/Section';
|
|
6
6
|
import { useSectionRender } from '../utils/useRender';
|
|
@@ -13,14 +13,15 @@ export var Row = props => {
|
|
|
13
13
|
return null;
|
|
14
14
|
};
|
|
15
15
|
Row.displayName = 'JVR.Row';
|
|
16
|
-
export var RowComp =
|
|
16
|
+
export var RowComp = props => {
|
|
17
17
|
var {
|
|
18
18
|
children,
|
|
19
19
|
value,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
parentValue,
|
|
21
|
+
keyName,
|
|
22
|
+
keys
|
|
23
|
+
} = props,
|
|
24
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
24
25
|
var {
|
|
25
26
|
Row: Comp = {}
|
|
26
27
|
} = useSectionStore();
|
|
@@ -35,7 +36,8 @@ export var RowComp = _ref => {
|
|
|
35
36
|
}), {
|
|
36
37
|
value,
|
|
37
38
|
keyName,
|
|
38
|
-
parentValue
|
|
39
|
+
parentValue,
|
|
40
|
+
keys
|
|
39
41
|
});
|
|
40
42
|
if (child) return child;
|
|
41
43
|
return /*#__PURE__*/_jsx(Elm, _extends({}, other, reset, {
|
package/esm/store/Section.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import React, { FC, PropsWithChildren, ComponentPropsWithoutRef } from 'react';
|
|
2
2
|
import { type TagType } from './Types';
|
|
3
|
+
export interface SectionElementResult<T extends object, K = string | number> {
|
|
4
|
+
value?: T;
|
|
5
|
+
parentValue?: T;
|
|
6
|
+
keyName?: K;
|
|
7
|
+
/** Index of the parent `keyName` */
|
|
8
|
+
keys?: K[];
|
|
9
|
+
}
|
|
3
10
|
export type SectionElementProps<T extends TagType = 'span'> = {
|
|
4
11
|
as?: T;
|
|
5
|
-
render?: (props: SectionElement<T>, result:
|
|
6
|
-
value: unknown;
|
|
7
|
-
parentValue?: unknown;
|
|
8
|
-
keyName: string | number;
|
|
9
|
-
}) => React.ReactNode;
|
|
12
|
+
render?: (props: SectionElement<T>, result: SectionElementResult<object>) => React.ReactNode;
|
|
10
13
|
};
|
|
11
14
|
export type SectionElement<T extends TagType = 'span'> = SectionElementProps<T> & ComponentPropsWithoutRef<T>;
|
|
12
15
|
type InitialState<T extends TagType> = {
|