@uiw/react-json-view 1.8.3 → 1.8.4
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/index.js +1 -1
- package/cjs/node.d.ts +2 -2
- package/cjs/node.js +9 -27
- package/esm/index.js +2 -2
- package/esm/node.d.ts +2 -2
- package/esm/node.js +8 -26
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -49,7 +49,7 @@ var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
49
49
|
}, style);
|
|
50
50
|
var cls = "w-json-view-container w-rjv ".concat(className || '');
|
|
51
51
|
var keyid = (0, _react.useId)();
|
|
52
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_node.
|
|
52
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_node.RootNode, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
53
53
|
className: cls,
|
|
54
54
|
value: value
|
|
55
55
|
}, reset), {}, {
|
package/cjs/node.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { FC, PropsWithChildren } from 'react';
|
|
|
2
2
|
import { LabelProps } from './value';
|
|
3
3
|
import { JsonViewProps } from './';
|
|
4
4
|
export declare const CountInfo: FC<PropsWithChildren<LabelProps>>;
|
|
5
|
-
export interface
|
|
5
|
+
export interface RootNodeProps<T extends object> extends JsonViewProps<T> {
|
|
6
6
|
keyName?: string | number;
|
|
7
7
|
keyid?: string;
|
|
8
8
|
level?: number;
|
|
@@ -10,4 +10,4 @@ export interface RooNodeProps<T extends object> extends JsonViewProps<T> {
|
|
|
10
10
|
namespace?: Array<string | number>;
|
|
11
11
|
setParentValue?: React.Dispatch<React.SetStateAction<T>>;
|
|
12
12
|
}
|
|
13
|
-
export declare
|
|
13
|
+
export declare const RootNode: import("react").ForwardRefExoticComponent<Omit<RootNodeProps<object>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
package/cjs/node.js
CHANGED
|
@@ -4,8 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.CountInfo = void 0;
|
|
8
|
-
exports.RooNode = RooNode;
|
|
7
|
+
exports.RootNode = exports.CountInfo = void 0;
|
|
9
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
@@ -41,7 +40,7 @@ var CountInfo = function CountInfo(_ref) {
|
|
|
41
40
|
});
|
|
42
41
|
};
|
|
43
42
|
exports.CountInfo = CountInfo;
|
|
44
|
-
function
|
|
43
|
+
var RootNode = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
45
44
|
var _expands$keyid;
|
|
46
45
|
var _props$value = props.value,
|
|
47
46
|
value = _props$value === void 0 ? {} : _props$value,
|
|
@@ -195,7 +194,9 @@ function RooNode(props) {
|
|
|
195
194
|
setParentValue: setParentValue,
|
|
196
195
|
setValue: setValueData
|
|
197
196
|
});
|
|
198
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
197
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
198
|
+
ref: ref
|
|
199
|
+
}, reset), {}, {
|
|
199
200
|
className: "".concat(className, " w-rjv-inner")
|
|
200
201
|
}, eventProps), {}, {
|
|
201
202
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_value.Line, {
|
|
@@ -250,7 +251,7 @@ function RooNode(props) {
|
|
|
250
251
|
var label = isArray ? idx : key;
|
|
251
252
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Line, {
|
|
252
253
|
className: "w-rjv-wrap",
|
|
253
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
254
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RootNode, (0, _objectSpread2["default"])({
|
|
254
255
|
value: item,
|
|
255
256
|
namespace: [].concat((0, _toConsumableArray2["default"])(namespace), [label]),
|
|
256
257
|
keyName: label,
|
|
@@ -261,7 +262,7 @@ function RooNode(props) {
|
|
|
261
262
|
if ((0, _typeof2["default"])(item) === 'object' && item && !(item instanceof Date) && !isEmpty) {
|
|
262
263
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Line, {
|
|
263
264
|
className: "w-rjv-wrap",
|
|
264
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
265
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RootNode, (0, _objectSpread2["default"])({
|
|
265
266
|
value: item,
|
|
266
267
|
namespace: [].concat((0, _toConsumableArray2["default"])(namespace), [key]),
|
|
267
268
|
keyName: key,
|
|
@@ -294,26 +295,6 @@ function RooNode(props) {
|
|
|
294
295
|
visible: expand
|
|
295
296
|
}) || countInfo;
|
|
296
297
|
}
|
|
297
|
-
// if (length > -1) {
|
|
298
|
-
// countInfo = (
|
|
299
|
-
// <Fragment>
|
|
300
|
-
// {countInfo}
|
|
301
|
-
// {components.countInfoExtra &&
|
|
302
|
-
// components.countInfoExtra({
|
|
303
|
-
// count: length,
|
|
304
|
-
// level,
|
|
305
|
-
// showTools,
|
|
306
|
-
// keyName,
|
|
307
|
-
// visible: expand,
|
|
308
|
-
// value: valueData,
|
|
309
|
-
// namespace: [...namespace],
|
|
310
|
-
// parentValue,
|
|
311
|
-
// setParentValue,
|
|
312
|
-
// setValue: setValueData,
|
|
313
|
-
// })}
|
|
314
|
-
// </Fragment>
|
|
315
|
-
// )
|
|
316
|
-
// }
|
|
317
298
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.ValueView, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
318
299
|
components: components,
|
|
319
300
|
namespace: [].concat((0, _toConsumableArray2["default"])(namespace), [key])
|
|
@@ -339,4 +320,5 @@ function RooNode(props) {
|
|
|
339
320
|
})
|
|
340
321
|
})]
|
|
341
322
|
}));
|
|
342
|
-
}
|
|
323
|
+
});
|
|
324
|
+
exports.RootNode = RootNode;
|
package/esm/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutP
|
|
|
3
3
|
var _excluded = ["value", "style", "className"];
|
|
4
4
|
import React, { useId } from 'react';
|
|
5
5
|
import { forwardRef } from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { RootNode } from './node';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
export * from './node';
|
|
9
9
|
export * from './value';
|
|
@@ -22,7 +22,7 @@ var JsonView = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22
22
|
}, style);
|
|
23
23
|
var cls = "w-json-view-container w-rjv " + (className || '');
|
|
24
24
|
var keyid = useId();
|
|
25
|
-
return /*#__PURE__*/_jsx(
|
|
25
|
+
return /*#__PURE__*/_jsx(RootNode, _extends({
|
|
26
26
|
className: cls,
|
|
27
27
|
value: value
|
|
28
28
|
}, reset, {
|
package/esm/node.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { FC, PropsWithChildren } from 'react';
|
|
|
2
2
|
import { LabelProps } from './value';
|
|
3
3
|
import { JsonViewProps } from './';
|
|
4
4
|
export declare const CountInfo: FC<PropsWithChildren<LabelProps>>;
|
|
5
|
-
export interface
|
|
5
|
+
export interface RootNodeProps<T extends object> extends JsonViewProps<T> {
|
|
6
6
|
keyName?: string | number;
|
|
7
7
|
keyid?: string;
|
|
8
8
|
level?: number;
|
|
@@ -10,4 +10,4 @@ export interface RooNodeProps<T extends object> extends JsonViewProps<T> {
|
|
|
10
10
|
namespace?: Array<string | number>;
|
|
11
11
|
setParentValue?: React.Dispatch<React.SetStateAction<T>>;
|
|
12
12
|
}
|
|
13
|
-
export declare
|
|
13
|
+
export declare const RootNode: import("react").ForwardRefExoticComponent<Omit<RootNodeProps<object>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
package/esm/node.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
3
|
var _excluded = ["value", "keyName", "className", "displayDataTypes", "components", "displayObjectSize", "enableClipboard", "highlightUpdates", "objectSortKeys", "indentWidth", "collapsed", "level", "keyid", "quotes", "namespace", "onCopied", "onExpand", "parentValue", "setParentValue"];
|
|
4
|
-
import { Fragment, useId, cloneElement, useState, useEffect } from 'react';
|
|
4
|
+
import { Fragment, useId, cloneElement, useState, useEffect, forwardRef } from 'react';
|
|
5
5
|
import { ValueView, Colon, Label, Line, typeMap } from './value';
|
|
6
6
|
import { TriangleArrow } from './arrow/TriangleArrow';
|
|
7
7
|
import { useExpandsStatus, store } from './store';
|
|
@@ -32,7 +32,7 @@ export var CountInfo = _ref => {
|
|
|
32
32
|
children: [children, " items"]
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
|
-
export
|
|
35
|
+
export var RootNode = /*#__PURE__*/forwardRef((props, ref) => {
|
|
36
36
|
var _expands$keyid;
|
|
37
37
|
var {
|
|
38
38
|
value = {},
|
|
@@ -156,7 +156,9 @@ export function RooNode(props) {
|
|
|
156
156
|
setParentValue,
|
|
157
157
|
setValue: setValueData
|
|
158
158
|
});
|
|
159
|
-
return /*#__PURE__*/_jsxs("div", _extends({
|
|
159
|
+
return /*#__PURE__*/_jsxs("div", _extends({
|
|
160
|
+
ref: ref
|
|
161
|
+
}, reset, {
|
|
160
162
|
className: className + " w-rjv-inner"
|
|
161
163
|
}, eventProps, {
|
|
162
164
|
children: [/*#__PURE__*/_jsxs(Line, {
|
|
@@ -209,7 +211,7 @@ export function RooNode(props) {
|
|
|
209
211
|
var label = isArray ? idx : key;
|
|
210
212
|
return /*#__PURE__*/_jsx(Line, {
|
|
211
213
|
className: "w-rjv-wrap",
|
|
212
|
-
children: /*#__PURE__*/_jsx(
|
|
214
|
+
children: /*#__PURE__*/_jsx(RootNode, _extends({
|
|
213
215
|
value: item,
|
|
214
216
|
namespace: [...namespace, label],
|
|
215
217
|
keyName: label,
|
|
@@ -220,7 +222,7 @@ export function RooNode(props) {
|
|
|
220
222
|
if (typeof item === 'object' && item && !(item instanceof Date) && !isEmpty) {
|
|
221
223
|
return /*#__PURE__*/_jsx(Line, {
|
|
222
224
|
className: "w-rjv-wrap",
|
|
223
|
-
children: /*#__PURE__*/_jsx(
|
|
225
|
+
children: /*#__PURE__*/_jsx(RootNode, _extends({
|
|
224
226
|
value: item,
|
|
225
227
|
namespace: [...namespace, key],
|
|
226
228
|
keyName: key,
|
|
@@ -253,26 +255,6 @@ export function RooNode(props) {
|
|
|
253
255
|
visible: expand
|
|
254
256
|
}) || countInfo;
|
|
255
257
|
}
|
|
256
|
-
// if (length > -1) {
|
|
257
|
-
// countInfo = (
|
|
258
|
-
// <Fragment>
|
|
259
|
-
// {countInfo}
|
|
260
|
-
// {components.countInfoExtra &&
|
|
261
|
-
// components.countInfoExtra({
|
|
262
|
-
// count: length,
|
|
263
|
-
// level,
|
|
264
|
-
// showTools,
|
|
265
|
-
// keyName,
|
|
266
|
-
// visible: expand,
|
|
267
|
-
// value: valueData,
|
|
268
|
-
// namespace: [...namespace],
|
|
269
|
-
// parentValue,
|
|
270
|
-
// setParentValue,
|
|
271
|
-
// setValue: setValueData,
|
|
272
|
-
// })}
|
|
273
|
-
// </Fragment>
|
|
274
|
-
// )
|
|
275
|
-
// }
|
|
276
258
|
return /*#__PURE__*/_jsx(ValueView, _extends({
|
|
277
259
|
components: components,
|
|
278
260
|
namespace: [...namespace, key]
|
|
@@ -298,4 +280,4 @@ export function RooNode(props) {
|
|
|
298
280
|
})
|
|
299
281
|
})]
|
|
300
282
|
}));
|
|
301
|
-
}
|
|
283
|
+
});
|