@uiw/react-json-view 1.12.0 → 1.12.2
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 +6 -3
- package/cjs/comps/ellipsis.js +1 -2
- package/cjs/editor/countInfoExtra.js +14 -9
- package/cjs/editor/icon/add.js +2 -3
- package/cjs/editor/icon/delete.js +2 -3
- package/cjs/editor/icon/edit.js +2 -3
- package/cjs/editor/index.js +1 -2
- package/cjs/editor/objectKey.js +8 -7
- package/cjs/editor/value.js +16 -10
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -2
- package/cjs/node.js +5 -7
- package/cjs/semicolon.js +1 -2
- package/cjs/store.js +1 -2
- package/cjs/theme/basic.js +2 -3
- package/cjs/theme/dark.js +2 -3
- package/cjs/theme/github.dark.js +2 -3
- package/cjs/theme/github.light.js +2 -3
- package/cjs/theme/gruvbox.js +2 -3
- package/cjs/theme/light.js +2 -3
- package/cjs/theme/monokai.js +2 -3
- package/cjs/theme/nord.js +2 -3
- package/cjs/theme/vscode.js +2 -3
- package/cjs/value.js +10 -14
- package/esm/editor/countInfoExtra.js +14 -9
- package/esm/editor/objectKey.js +7 -5
- package/esm/editor/value.js +16 -10
- package/esm/index.d.ts +1 -1
- package/esm/node.js +3 -3
- package/esm/value.js +3 -5
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
react-json-view
|
|
2
2
|
===
|
|
3
3
|
|
|
4
|
+
[](https://jaywcjlove.github.io/#/sponsor)
|
|
4
5
|
[](https://github.com/uiwjs/react-json-view/actions/workflows/ci.yml)
|
|
5
6
|
[](https://www.npmjs.com/package/@uiw/react-json-view)
|
|
6
7
|
[](https://www.npmjs.com/package/@uiw/react-json-view)
|
|
7
8
|
[](https://github.com/facebook/react/releases)
|
|
8
|
-
[](https://uiwjs.github.io/react-json-view/lcov-report/)
|
|
9
10
|
|
|
10
|
-
A React component for displaying and editing javascript arrays and JSON objects.
|
|
11
|
+
A React component for displaying and editing javascript arrays and JSON objects. Preview of v1 documentation is available [here](https://raw.githack.com/uiwjs/react-json-view/v1-docs/index.html).
|
|
11
12
|
|
|
12
13
|
<!--rehype:ignore:start-->
|
|
13
14
|
<a href="https://uiwjs.github.io/react-json-view/" target="_blank">
|
|
@@ -26,6 +27,8 @@ A React component for displaying and editing javascript arrays and JSON objects.
|
|
|
26
27
|
✏️ Support editing and adding features
|
|
27
28
|
♻️ Whether to highlight updates.
|
|
28
29
|
|
|
30
|
+
The new version **[v2](https://github.com/uiwjs/react-json-view/tree/v2)** 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.
|
|
31
|
+
|
|
29
32
|
## Quick Start
|
|
30
33
|
|
|
31
34
|
```bash
|
|
@@ -688,7 +691,7 @@ export interface JsonViewProps<T> extends React.DetailedHTMLProps<React.HTMLAttr
|
|
|
688
691
|
displayDataTypes?: boolean;
|
|
689
692
|
/** When set to `true`, `objects` and `arrays` are labeled with size @default true */
|
|
690
693
|
displayObjectSize?: boolean;
|
|
691
|
-
/** Shorten long JSON strings, Set to `0` to disable this feature @default
|
|
694
|
+
/** Shorten long JSON strings, Set to `0` to disable this feature @default 30 */
|
|
692
695
|
shortenTextAfterLength?: number;
|
|
693
696
|
/** Define the root node name. @default undefined */
|
|
694
697
|
keyName?: string | number;
|
package/cjs/comps/ellipsis.js
CHANGED
|
@@ -9,7 +9,7 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
var _excluded = ["style", "render", "count", "level"];
|
|
12
|
-
var Ellipsis = function Ellipsis(_ref) {
|
|
12
|
+
var Ellipsis = exports.Ellipsis = function Ellipsis(_ref) {
|
|
13
13
|
var style = _ref.style,
|
|
14
14
|
render = _ref.render,
|
|
15
15
|
count = _ref.count,
|
|
@@ -33,5 +33,4 @@ var Ellipsis = function Ellipsis(_ref) {
|
|
|
33
33
|
children: "..."
|
|
34
34
|
}));
|
|
35
35
|
};
|
|
36
|
-
exports.Ellipsis = Ellipsis;
|
|
37
36
|
Ellipsis.displayName = 'JVR.Ellipsis';
|
|
@@ -15,7 +15,6 @@ var _add = require("./icon/add");
|
|
|
15
15
|
var _delete = require("./icon/delete");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
function CountInfoExtra(props) {
|
|
18
|
-
var _ref, _ref2;
|
|
19
18
|
var visible = props.visible,
|
|
20
19
|
showTools = props.showTools,
|
|
21
20
|
editable = props.editable,
|
|
@@ -28,8 +27,8 @@ function CountInfoExtra(props) {
|
|
|
28
27
|
onAdd = props.onAdd,
|
|
29
28
|
onDelete = props.onDelete;
|
|
30
29
|
if (!visible || !showTools) return null;
|
|
31
|
-
var click = function
|
|
32
|
-
|
|
30
|
+
var click = /*#__PURE__*/function () {
|
|
31
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee(event) {
|
|
33
32
|
var keyOrValue, isArray, isAdd, result, maybeAdd;
|
|
34
33
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
35
34
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -55,10 +54,13 @@ function CountInfoExtra(props) {
|
|
|
55
54
|
return _context.stop();
|
|
56
55
|
}
|
|
57
56
|
}, _callee);
|
|
58
|
-
}))
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
}));
|
|
58
|
+
return function click(_x) {
|
|
59
|
+
return _ref.apply(this, arguments);
|
|
60
|
+
};
|
|
61
|
+
}();
|
|
62
|
+
var deleteHandle = /*#__PURE__*/function () {
|
|
63
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2(event) {
|
|
62
64
|
var maybeDelete;
|
|
63
65
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
|
|
64
66
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -88,8 +90,11 @@ function CountInfoExtra(props) {
|
|
|
88
90
|
return _context2.stop();
|
|
89
91
|
}
|
|
90
92
|
}, _callee2);
|
|
91
|
-
}))
|
|
92
|
-
|
|
93
|
+
}));
|
|
94
|
+
return function deleteHandle(_x2) {
|
|
95
|
+
return _ref2.apply(this, arguments);
|
|
96
|
+
};
|
|
97
|
+
}();
|
|
93
98
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
94
99
|
children: [editable && onAdd && /*#__PURE__*/(0, _jsxRuntime.jsx)(_add.AddIcon, {
|
|
95
100
|
onClick: click
|
package/cjs/editor/icon/add.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.AddIcon = void 0;
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
var AddIcon = function AddIcon(props) {
|
|
10
|
+
var AddIcon = exports.AddIcon = function AddIcon(props) {
|
|
11
11
|
var style = props.style;
|
|
12
12
|
var defaultStyle = {
|
|
13
13
|
verticalAlign: 'middle',
|
|
@@ -26,5 +26,4 @@ var AddIcon = function AddIcon(props) {
|
|
|
26
26
|
d: "M28.3940997,0 L11.625773,0 C4.34215619,0 0,4.34 0,11.62 L0,28.36 C0,35.66 4.34215619,40 11.625773,40 L28.3740897,40 C35.6577066,40 39.9999316,35.66 39.9999316,28.38 L39.9999316,11.62 C40.0198727,4.34 35.6777165,0 28.3940997,0 Z M30.12022,21.8947368 L21.9056145,21.8947368 L21.9056145,30.1052632 C21.9056145,31.1410526 21.0462404,32 20.0099363,32 C18.9736323,32 18.1142582,31.1410526 18.1142582,30.1052632 L18.1142582,21.8947368 L9.89965272,21.8947368 C8.86334865,21.8947368 8.00397454,21.0357895 8.00397454,20 C8.00397454,18.9642105 8.86334865,18.1052632 9.89965272,18.1052632 L18.1142582,18.1052632 L18.1142582,9.89473684 C18.1142582,8.85894737 18.9736323,8 20.0099363,8 C21.0462404,8 21.9056145,8.85894737 21.9056145,9.89473684 L21.9056145,18.1052632 L30.12022,18.1052632 C31.156524,18.1052632 32.0158982,18.9642105 32.0158982,20 C32.0158982,21.0357895 31.156524,21.8947368 30.12022,21.8947368 Z"
|
|
27
27
|
})
|
|
28
28
|
}));
|
|
29
|
-
};
|
|
30
|
-
exports.AddIcon = AddIcon;
|
|
29
|
+
};
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.DeleteIcon = void 0;
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
var DeleteIcon = function DeleteIcon(props) {
|
|
10
|
+
var DeleteIcon = exports.DeleteIcon = function DeleteIcon(props) {
|
|
11
11
|
var style = props.style;
|
|
12
12
|
var defaultStyle = {
|
|
13
13
|
verticalAlign: 'middle',
|
|
@@ -26,5 +26,4 @@ var DeleteIcon = function DeleteIcon(props) {
|
|
|
26
26
|
d: "M28.3940997,0 L11.625773,0 C4.34215619,0 0,4.34 0,11.62 L0,28.36 C0,35.66 4.34215619,40 11.625773,40 L28.3740897,40 C35.6577066,40 39.9999316,35.66 39.9999316,28.38 L39.9999316,11.62 C40.0198727,4.34 35.6777165,0 28.3940997,0 Z M30.3428039,27.0681654 C31.2346195,27.9595381 31.2346195,29.4349136 30.3428039,30.3262862 C29.88152,30.7873411 29.2972271,31.0025 28.7129341,31.0025 C28.1286412,31.0025 27.5443483,30.7873411 27.0830644,30.3262862 L20.0100446,23.2567787 L12.9370249,30.3262862 C12.475741,30.7873411 11.891448,31.0025 11.3071551,31.0025 C10.7228621,31.0025 10.1385692,30.7873411 9.67728531,30.3262862 C8.78464325,29.4234847 8.78464325,27.9709669 9.67728531,27.0681654 L16.7503051,19.9986579 L9.67728531,12.9291504 C8.78464325,12.0263488 8.78464325,10.573831 9.67728531,9.67102951 C10.5691008,8.77965683 12.0452093,8.77965683 12.9370249,9.67102951 L20.0100446,16.740537 L27.0830644,9.67102951 C27.9748799,8.77965683 29.4509884,8.77965683 30.3428039,9.67102951 C31.2346195,10.5624022 31.2346195,12.0377777 30.3428039,12.9291504 L23.2697842,19.9986579 L30.3428039,27.0681654 L30.3428039,27.0681654 Z"
|
|
27
27
|
})
|
|
28
28
|
}));
|
|
29
|
-
};
|
|
30
|
-
exports.DeleteIcon = DeleteIcon;
|
|
29
|
+
};
|
package/cjs/editor/icon/edit.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.EditIcon = void 0;
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
var EditIcon = function EditIcon(props) {
|
|
10
|
+
var EditIcon = exports.EditIcon = function EditIcon(props) {
|
|
11
11
|
var style = props.style;
|
|
12
12
|
var defaultStyle = {
|
|
13
13
|
verticalAlign: 'middle',
|
|
@@ -26,5 +26,4 @@ var EditIcon = function EditIcon(props) {
|
|
|
26
26
|
d: "M18,0 L7.74666667,0 C2.89333333,0 0,2.89333333 0,7.74666667 L0,17.9066667 C0,22.7733333 2.89333333,26 7.74666667,26 L18,26 C22.8533333,26 26.0001422,22.7733333 26.0001422,17.92 L26.0001422,7.74666667 C26.0133333,2.89333333 22.8533333,0 18,0 Z M11.9333333,20.68 C11.5466667,21.0666667 10.8133333,21.44 10.28,21.52 L7,21.9866667 C6.88,22 6.76,22.0133333 6.64,22.0133333 C6.09333333,22.0133333 5.58666667,21.8266667 5.22666667,21.4666667 C4.78666667,21.0266667 4.6,20.3866667 4.70666667,19.68 L5.17333333,16.4 C5.25333333,15.8533333 5.61333333,15.1333333 6.01333333,14.7466667 L11.96,8.8 C12.1719034,9.3972484 12.4397602,9.97314063 12.76,10.52 C12.8933333,10.7466667 13.04,10.96 13.16,11.12 C13.3066667,11.3466667 13.48,11.56 13.5866667,11.68 C13.6533333,11.7733333 13.7066667,11.84 13.7333333,11.8666667 C14.0666667,12.2666667 14.4533333,12.64 14.7866667,12.92 C14.88,13.0133333 14.9333333,13.0666667 14.96,13.08 C15.16,13.24 15.36,13.4 15.5333333,13.52 C15.7466667,13.68 15.96,13.8266667 16.1866667,13.9466667 C16.4533333,14.1066667 16.7466667,14.2533333 17.04,14.4 C17.3466667,14.5333333 17.6266667,14.6533333 17.9066667,14.7466667 L11.9333333,20.68 L11.9333333,20.68 Z M20.4933333,12.12 L19.2666667,13.36 C19.1887174,13.4373865 19.0831716,13.4805643 18.9733333,13.4800055 C18.9333333,13.4800055 18.88,13.4800055 18.8533333,13.4666667 C16.1309823,12.6775025 14.0024975,10.5490177 13.2133333,7.82666667 C13.1733333,7.68 13.2133333,7.52 13.32,7.42666667 L14.56,6.18666667 C16.5866667,4.16 18.52,4.2 20.5066667,6.18666667 C21.52,7.2 22.0133333,8.17333333 22.0133333,9.18666667 C22,10.1466667 21.5066667,11.1066667 20.4933333,12.12 L20.4933333,12.12 Z"
|
|
27
27
|
})
|
|
28
28
|
}));
|
|
29
|
-
};
|
|
30
|
-
exports.EditIcon = EditIcon;
|
|
29
|
+
};
|
package/cjs/editor/index.js
CHANGED
|
@@ -55,6 +55,5 @@ var JsonViewEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
55
55
|
}));
|
|
56
56
|
});
|
|
57
57
|
JsonViewEditor.displayName = 'JVR.JsonViewEditor';
|
|
58
|
-
var _default = JsonViewEditor;
|
|
59
|
-
exports["default"] = _default;
|
|
58
|
+
var _default = exports["default"] = JsonViewEditor;
|
|
60
59
|
module.exports = exports.default;
|
package/cjs/editor/objectKey.js
CHANGED
|
@@ -15,8 +15,7 @@ var _semicolon = require("../semicolon");
|
|
|
15
15
|
var _value = require("../value");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
var _excluded = ["className", "value", "keyName", "parentName", "quotes", "label", "namespace", "editableValue", "onEdit", "highlightUpdates", "render"];
|
|
18
|
-
var ObjectKey = function ObjectKey(props) {
|
|
19
|
-
var _ref;
|
|
18
|
+
var ObjectKey = exports.ObjectKey = function ObjectKey(props) {
|
|
20
19
|
var className = props.className,
|
|
21
20
|
value = props.value,
|
|
22
21
|
keyName = props.keyName,
|
|
@@ -59,8 +58,8 @@ var ObjectKey = function ObjectKey(props) {
|
|
|
59
58
|
(_$edit$current = $edit.current) === null || _$edit$current === void 0 || _$edit$current.focus();
|
|
60
59
|
}
|
|
61
60
|
};
|
|
62
|
-
var blur = function
|
|
63
|
-
|
|
61
|
+
var blur = /*#__PURE__*/function () {
|
|
62
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
64
63
|
var _$edit$current2, result;
|
|
65
64
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
66
65
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -99,8 +98,11 @@ var ObjectKey = function ObjectKey(props) {
|
|
|
99
98
|
return _context.stop();
|
|
100
99
|
}
|
|
101
100
|
}, _callee);
|
|
102
|
-
}))
|
|
103
|
-
|
|
101
|
+
}));
|
|
102
|
+
return function blur() {
|
|
103
|
+
return _ref.apply(this, arguments);
|
|
104
|
+
};
|
|
105
|
+
}();
|
|
104
106
|
var focus = function focus() {
|
|
105
107
|
if ($edit.current) {
|
|
106
108
|
var _$edit$current3;
|
|
@@ -165,5 +167,4 @@ var ObjectKey = function ObjectKey(props) {
|
|
|
165
167
|
ref: $edit
|
|
166
168
|
}));
|
|
167
169
|
};
|
|
168
|
-
exports.ObjectKey = ObjectKey;
|
|
169
170
|
ObjectKey.displayName = 'JVR.ObjectKey';
|
package/cjs/editor/value.js
CHANGED
|
@@ -27,7 +27,7 @@ var Quotes = function Quotes(_ref) {
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
function ReValue(props) {
|
|
30
|
-
var
|
|
30
|
+
var _typeMap$typeStr;
|
|
31
31
|
var type = props.type,
|
|
32
32
|
value = props.value,
|
|
33
33
|
setValue = props.setValue,
|
|
@@ -81,8 +81,8 @@ function ReValue(props) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
var blur = function
|
|
85
|
-
|
|
84
|
+
var blur = /*#__PURE__*/function () {
|
|
85
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
86
86
|
var text, _typeStr, dt, result, _getValueString, oldChildStr;
|
|
87
87
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
88
88
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -129,7 +129,7 @@ function ReValue(props) {
|
|
|
129
129
|
_typeStr = 'undefined';
|
|
130
130
|
} else if (typeof text === 'string') {
|
|
131
131
|
try {
|
|
132
|
-
if (text && text.length >
|
|
132
|
+
if (text && text.length > 19 && !isNaN(Date.parse(text))) {
|
|
133
133
|
dt = new Date(text);
|
|
134
134
|
text = dt;
|
|
135
135
|
_typeStr = 'date';
|
|
@@ -161,8 +161,11 @@ function ReValue(props) {
|
|
|
161
161
|
return _context.stop();
|
|
162
162
|
}
|
|
163
163
|
}, _callee);
|
|
164
|
-
}))
|
|
165
|
-
|
|
164
|
+
}));
|
|
165
|
+
return function blur() {
|
|
166
|
+
return _ref2.apply(this, arguments);
|
|
167
|
+
};
|
|
168
|
+
}();
|
|
166
169
|
var defaultStyle = {
|
|
167
170
|
minWidth: 34,
|
|
168
171
|
minHeight: 18,
|
|
@@ -189,8 +192,8 @@ function ReValue(props) {
|
|
|
189
192
|
if (typeStr === 'null' || typeStr === 'undefined' || type.toLocaleLowerCase() === 'nan') {
|
|
190
193
|
typeView = /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {});
|
|
191
194
|
}
|
|
192
|
-
var deleteHandle = function
|
|
193
|
-
|
|
195
|
+
var deleteHandle = /*#__PURE__*/function () {
|
|
196
|
+
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2(evn) {
|
|
194
197
|
var maybeDelete;
|
|
195
198
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
|
|
196
199
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -215,8 +218,11 @@ function ReValue(props) {
|
|
|
215
218
|
return _context2.stop();
|
|
216
219
|
}
|
|
217
220
|
}, _callee2);
|
|
218
|
-
}))
|
|
219
|
-
|
|
221
|
+
}));
|
|
222
|
+
return function deleteHandle(_x) {
|
|
223
|
+
return _ref3.apply(this, arguments);
|
|
224
|
+
};
|
|
225
|
+
}();
|
|
220
226
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
221
227
|
children: [displayDataTypes && typeView, /*#__PURE__*/(0, _jsxRuntime.jsx)(Quotes, {
|
|
222
228
|
style: style,
|
package/cjs/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface JsonViewProps<T extends object> extends React.DetailedHTMLProps
|
|
|
33
33
|
displayDataTypes?: boolean;
|
|
34
34
|
/** When set to `true`, `objects` and `arrays` are labeled with size @default true */
|
|
35
35
|
displayObjectSize?: boolean;
|
|
36
|
-
/** Shorten long JSON strings, Set to `0` to disable this feature @default
|
|
36
|
+
/** Shorten long JSON strings, Set to `0` to disable this feature @default 30 */
|
|
37
37
|
shortenTextAfterLength?: number;
|
|
38
38
|
/** Define the root node name. @default undefined */
|
|
39
39
|
keyName?: string | number;
|
package/cjs/index.js
CHANGED
package/cjs/node.js
CHANGED
|
@@ -27,7 +27,7 @@ function getLength(obj) {
|
|
|
27
27
|
return -1;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
var CountInfo = function CountInfo(_ref) {
|
|
30
|
+
var CountInfo = exports.CountInfo = function CountInfo(_ref) {
|
|
31
31
|
var children = _ref.children;
|
|
32
32
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_value.Label, {
|
|
33
33
|
style: {
|
|
@@ -39,9 +39,8 @@ var CountInfo = function CountInfo(_ref) {
|
|
|
39
39
|
children: [children, " items"]
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
|
-
exports.CountInfo = CountInfo;
|
|
43
42
|
CountInfo.displayName = 'JVR.CountInfo';
|
|
44
|
-
var RootNode = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
43
|
+
var RootNode = exports.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,
|
|
@@ -62,7 +61,7 @@ var RootNode = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
62
61
|
_props$indentWidth = props.indentWidth,
|
|
63
62
|
indentWidth = _props$indentWidth === void 0 ? 15 : _props$indentWidth,
|
|
64
63
|
_props$shortenTextAft = props.shortenTextAfterLength,
|
|
65
|
-
shortenTextAfterLength = _props$shortenTextAft === void 0 ?
|
|
64
|
+
shortenTextAfterLength = _props$shortenTextAft === void 0 ? 30 : _props$shortenTextAft,
|
|
66
65
|
collapsed = props.collapsed,
|
|
67
66
|
_props$level = props.level,
|
|
68
67
|
level = _props$level === void 0 ? 1 : _props$level,
|
|
@@ -132,11 +131,11 @@ var RootNode = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
132
131
|
transform: "rotate(".concat(expand ? '0' : '-90', "deg)"),
|
|
133
132
|
transition: 'all 0.3s'
|
|
134
133
|
};
|
|
135
|
-
var arrowView = components.arrow ? /*#__PURE__*/(0, _react.cloneElement)(components.arrow, {
|
|
134
|
+
var arrowView = components.arrow ? ( /*#__PURE__*/(0, _react.cloneElement)(components.arrow, {
|
|
136
135
|
style: arrowStyle,
|
|
137
136
|
'data-expand': expand,
|
|
138
137
|
className: 'w-rjv-arrow'
|
|
139
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_TriangleArrow.TriangleArrow, {
|
|
138
|
+
})) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_TriangleArrow.TriangleArrow, {
|
|
140
139
|
style: arrowStyle,
|
|
141
140
|
className: "w-rjv-arrow"
|
|
142
141
|
});
|
|
@@ -339,5 +338,4 @@ var RootNode = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
339
338
|
})]
|
|
340
339
|
}));
|
|
341
340
|
});
|
|
342
|
-
exports.RootNode = RootNode;
|
|
343
341
|
RootNode.displayName = 'JVR.RootNode';
|
package/cjs/semicolon.js
CHANGED
|
@@ -66,7 +66,7 @@ function useHighlight(_ref) {
|
|
|
66
66
|
}
|
|
67
67
|
}, [isHighlight, value, highlightContainer]);
|
|
68
68
|
}
|
|
69
|
-
var Semicolon = function Semicolon(_ref2) {
|
|
69
|
+
var Semicolon = exports.Semicolon = function Semicolon(_ref2) {
|
|
70
70
|
var children = _ref2.children,
|
|
71
71
|
render = _ref2.render,
|
|
72
72
|
color = _ref2.color,
|
|
@@ -111,5 +111,4 @@ var Semicolon = function Semicolon(_ref2) {
|
|
|
111
111
|
children: content
|
|
112
112
|
}));
|
|
113
113
|
};
|
|
114
|
-
exports.Semicolon = Semicolon;
|
|
115
114
|
Semicolon.displayName = 'JSR.Semicolon';
|
package/cjs/store.js
CHANGED
|
@@ -13,7 +13,7 @@ var _objectSpread4 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
|
13
13
|
var _react = require("react");
|
|
14
14
|
var expands = {};
|
|
15
15
|
var listeners = [];
|
|
16
|
-
var store = {
|
|
16
|
+
var store = exports.store = {
|
|
17
17
|
collapse: function collapse(id) {
|
|
18
18
|
expands = (0, _objectSpread4["default"])((0, _objectSpread4["default"])({}, expands), {}, (0, _defineProperty2["default"])({}, id, false));
|
|
19
19
|
emitChange();
|
|
@@ -23,7 +23,6 @@ var store = {
|
|
|
23
23
|
emitChange();
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
exports.store = store;
|
|
27
26
|
function getSnapshot() {
|
|
28
27
|
return expands;
|
|
29
28
|
}
|
package/cjs/theme/basic.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.basicTheme = void 0;
|
|
7
|
-
var basicTheme = {
|
|
7
|
+
var basicTheme = exports.basicTheme = {
|
|
8
8
|
'--w-rjv-font-family': 'monospace',
|
|
9
9
|
'--w-rjv-color': '#b5bd68',
|
|
10
10
|
'--w-rjv-background-color': '#2E3235',
|
|
@@ -28,5 +28,4 @@ var basicTheme = {
|
|
|
28
28
|
'--w-rjv-type-null-color': '#8abeb7',
|
|
29
29
|
'--w-rjv-type-nan-color': '#8abeb7',
|
|
30
30
|
'--w-rjv-type-undefined-color': '#8abeb7'
|
|
31
|
-
};
|
|
32
|
-
exports.basicTheme = basicTheme;
|
|
31
|
+
};
|
package/cjs/theme/dark.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.darkTheme = void 0;
|
|
7
|
-
var darkTheme = {
|
|
7
|
+
var darkTheme = exports.darkTheme = {
|
|
8
8
|
'--w-rjv-font-family': 'monospace',
|
|
9
9
|
'--w-rjv-color': '#0184a6',
|
|
10
10
|
'--w-rjv-background-color': '#202020',
|
|
@@ -27,5 +27,4 @@ var darkTheme = {
|
|
|
27
27
|
'--w-rjv-type-null-color': '#d33682',
|
|
28
28
|
'--w-rjv-type-nan-color': '#076678',
|
|
29
29
|
'--w-rjv-type-undefined-color': '#586e75'
|
|
30
|
-
};
|
|
31
|
-
exports.darkTheme = darkTheme;
|
|
30
|
+
};
|
package/cjs/theme/github.dark.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.githubDarkTheme = void 0;
|
|
7
|
-
var githubDarkTheme = {
|
|
7
|
+
var githubDarkTheme = exports.githubDarkTheme = {
|
|
8
8
|
'--w-rjv-font-family': 'monospace',
|
|
9
9
|
'--w-rjv-color': '#79c0ff',
|
|
10
10
|
'--w-rjv-background-color': '#0d1117',
|
|
@@ -28,5 +28,4 @@ var githubDarkTheme = {
|
|
|
28
28
|
'--w-rjv-type-null-color': '#ff7b72',
|
|
29
29
|
'--w-rjv-type-nan-color': '#859900',
|
|
30
30
|
'--w-rjv-type-undefined-color': '#79c0ff'
|
|
31
|
-
};
|
|
32
|
-
exports.githubDarkTheme = githubDarkTheme;
|
|
31
|
+
};
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.githubLightTheme = void 0;
|
|
7
|
-
var githubLightTheme = {
|
|
7
|
+
var githubLightTheme = exports.githubLightTheme = {
|
|
8
8
|
'--w-rjv-font-family': 'monospace',
|
|
9
9
|
'--w-rjv-color': '#6f42c1',
|
|
10
10
|
'--w-rjv-background-color': '#ffffff',
|
|
@@ -28,5 +28,4 @@ var githubLightTheme = {
|
|
|
28
28
|
'--w-rjv-type-null-color': '#d73a49',
|
|
29
29
|
'--w-rjv-type-nan-color': '#859900',
|
|
30
30
|
'--w-rjv-type-undefined-color': '#005cc5'
|
|
31
|
-
};
|
|
32
|
-
exports.githubLightTheme = githubLightTheme;
|
|
31
|
+
};
|
package/cjs/theme/gruvbox.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.gruvboxTheme = void 0;
|
|
7
|
-
var gruvboxTheme = {
|
|
7
|
+
var gruvboxTheme = exports.gruvboxTheme = {
|
|
8
8
|
'--w-rjv-font-family': 'monospace',
|
|
9
9
|
'--w-rjv-color': '#3c3836',
|
|
10
10
|
'--w-rjv-background-color': '#fbf1c7',
|
|
@@ -28,5 +28,4 @@ var gruvboxTheme = {
|
|
|
28
28
|
'--w-rjv-type-null-color': '#076678',
|
|
29
29
|
'--w-rjv-type-nan-color': '#076678',
|
|
30
30
|
'--w-rjv-type-undefined-color': '#076678'
|
|
31
|
-
};
|
|
32
|
-
exports.gruvboxTheme = gruvboxTheme;
|
|
31
|
+
};
|
package/cjs/theme/light.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.lightTheme = void 0;
|
|
7
|
-
var lightTheme = {
|
|
7
|
+
var lightTheme = exports.lightTheme = {
|
|
8
8
|
'--w-rjv-font-family': 'monospace',
|
|
9
9
|
'--w-rjv-color': '#002b36',
|
|
10
10
|
'--w-rjv-background-color': '#ffffff',
|
|
@@ -28,5 +28,4 @@ var lightTheme = {
|
|
|
28
28
|
'--w-rjv-type-null-color': '#d33682',
|
|
29
29
|
'--w-rjv-type-nan-color': '#859900',
|
|
30
30
|
'--w-rjv-type-undefined-color': '#586e75'
|
|
31
|
-
};
|
|
32
|
-
exports.lightTheme = lightTheme;
|
|
31
|
+
};
|
package/cjs/theme/monokai.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.monokaiTheme = void 0;
|
|
7
|
-
var monokaiTheme = {
|
|
7
|
+
var monokaiTheme = exports.monokaiTheme = {
|
|
8
8
|
'--w-rjv-font-family': 'monospace',
|
|
9
9
|
'--w-rjv-color': '#E6DB74',
|
|
10
10
|
'--w-rjv-background-color': '#272822',
|
|
@@ -28,5 +28,4 @@ var monokaiTheme = {
|
|
|
28
28
|
'--w-rjv-type-null-color': '#FA2672',
|
|
29
29
|
'--w-rjv-type-nan-color': '#FD971F',
|
|
30
30
|
'--w-rjv-type-undefined-color': '#FD971F'
|
|
31
|
-
};
|
|
32
|
-
exports.monokaiTheme = monokaiTheme;
|
|
31
|
+
};
|
package/cjs/theme/nord.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.nordTheme = void 0;
|
|
7
|
-
var nordTheme = {
|
|
7
|
+
var nordTheme = exports.nordTheme = {
|
|
8
8
|
'--w-rjv-font-family': 'monospace',
|
|
9
9
|
'--w-rjv-color': '#88c0d0',
|
|
10
10
|
'--w-rjv-background-color': '#2e3440',
|
|
@@ -28,5 +28,4 @@ var nordTheme = {
|
|
|
28
28
|
'--w-rjv-type-null-color': '#5e81ac',
|
|
29
29
|
'--w-rjv-type-nan-color': '#859900',
|
|
30
30
|
'--w-rjv-type-undefined-color': '#586e75'
|
|
31
|
-
};
|
|
32
|
-
exports.nordTheme = nordTheme;
|
|
31
|
+
};
|
package/cjs/theme/vscode.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.vscodeTheme = void 0;
|
|
7
|
-
var vscodeTheme = {
|
|
7
|
+
var vscodeTheme = exports.vscodeTheme = {
|
|
8
8
|
'--w-rjv-font-family': 'monospace',
|
|
9
9
|
'--w-rjv-color': '#9cdcfe',
|
|
10
10
|
'--w-rjv-background-color': '#1e1e1e',
|
|
@@ -28,5 +28,4 @@ var vscodeTheme = {
|
|
|
28
28
|
'--w-rjv-type-null-color': '#569cd6',
|
|
29
29
|
'--w-rjv-type-nan-color': '#859900',
|
|
30
30
|
'--w-rjv-type-undefined-color': '#569cd6'
|
|
31
|
-
};
|
|
32
|
-
exports.vscodeTheme = vscodeTheme;
|
|
31
|
+
};
|
package/cjs/value.js
CHANGED
|
@@ -21,16 +21,14 @@ var _excluded = ["children", "style"],
|
|
|
21
21
|
_excluded3 = ["color", "style", "isURL", "href", "children"],
|
|
22
22
|
_excluded4 = ["value", "parentValue", "setValue", "countInfo", "data", "keyName", "indentWidth", "isSet", "namespace", "renderKey", "components", "quotes", "level", "enableClipboard", "displayObjectSize", "displayDataTypes", "shortenTextAfterLength"],
|
|
23
23
|
_excluded5 = ["children", "color", "fontSize", "opacity", "paddingRight", "style"];
|
|
24
|
-
var Line = function Line(props) {
|
|
24
|
+
var Line = exports.Line = function Line(props) {
|
|
25
25
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", (0, _objectSpread2["default"])({}, props));
|
|
26
26
|
};
|
|
27
|
-
exports.Line = Line;
|
|
28
27
|
Line.displayName = 'JVR.Line';
|
|
29
|
-
var isFloat = function isFloat(n) {
|
|
28
|
+
var isFloat = exports.isFloat = function isFloat(n) {
|
|
30
29
|
return Number(n) === n && n % 1 !== 0 || isNaN(n);
|
|
31
30
|
};
|
|
32
|
-
exports.
|
|
33
|
-
var typeMap = {
|
|
31
|
+
var typeMap = exports.typeMap = {
|
|
34
32
|
string: {
|
|
35
33
|
color: 'var(--w-rjv-type-string-color, #cb4b16)',
|
|
36
34
|
label: 'string'
|
|
@@ -80,8 +78,7 @@ var typeMap = {
|
|
|
80
78
|
label: 'undefined'
|
|
81
79
|
}
|
|
82
80
|
};
|
|
83
|
-
exports.
|
|
84
|
-
var Colon = function Colon(_ref) {
|
|
81
|
+
var Colon = exports.Colon = function Colon(_ref) {
|
|
85
82
|
var _ref$children = _ref.children,
|
|
86
83
|
children = _ref$children === void 0 ? ':' : _ref$children,
|
|
87
84
|
style = _ref.style,
|
|
@@ -97,7 +94,6 @@ var Colon = function Colon(_ref) {
|
|
|
97
94
|
children: children
|
|
98
95
|
}));
|
|
99
96
|
};
|
|
100
|
-
exports.Colon = Colon;
|
|
101
97
|
Colon.displayName = 'JVR.Colon';
|
|
102
98
|
function getValueString(value) {
|
|
103
99
|
var type = (0, _typeof2["default"])(value);
|
|
@@ -153,9 +149,11 @@ var RenderShortenTextValue = function RenderShortenTextValue(_ref2) {
|
|
|
153
149
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
154
150
|
shorten = _useState2[0],
|
|
155
151
|
setShorten = _useState2[1];
|
|
152
|
+
(0, _react.useEffect)(function () {
|
|
153
|
+
return setShorten(length && childrenStr.length >= length);
|
|
154
|
+
}, [length]);
|
|
156
155
|
var click = function click() {
|
|
157
|
-
|
|
158
|
-
setShorten(!shorten);
|
|
156
|
+
return setShorten(!shorten);
|
|
159
157
|
};
|
|
160
158
|
var text = shorten ? "".concat(childrenStr.slice(0, length), "...") : childrenStr;
|
|
161
159
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RenderStringValue, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, rest), {}, {
|
|
@@ -313,7 +311,7 @@ function ValueView(props) {
|
|
|
313
311
|
}));
|
|
314
312
|
}
|
|
315
313
|
ValueView.displayName = 'JVR.ValueView';
|
|
316
|
-
var Label = /*#__PURE__*/(0, _react.forwardRef)(function (_ref4, ref) {
|
|
314
|
+
var Label = exports.Label = /*#__PURE__*/(0, _react.forwardRef)(function (_ref4, ref) {
|
|
317
315
|
var children = _ref4.children,
|
|
318
316
|
color = _ref4.color,
|
|
319
317
|
fontSize = _ref4.fontSize,
|
|
@@ -333,9 +331,8 @@ var Label = /*#__PURE__*/(0, _react.forwardRef)(function (_ref4, ref) {
|
|
|
333
331
|
children: children
|
|
334
332
|
}));
|
|
335
333
|
});
|
|
336
|
-
exports.Label = Label;
|
|
337
334
|
Label.displayName = 'JVR.Label';
|
|
338
|
-
var Type = function Type(props) {
|
|
335
|
+
var Type = exports.Type = function Type(props) {
|
|
339
336
|
var _typeMap$type2, _typeMap$type3;
|
|
340
337
|
var type = props.type;
|
|
341
338
|
var color = (_typeMap$type2 = typeMap[type]) === null || _typeMap$type2 === void 0 ? void 0 : _typeMap$type2.color;
|
|
@@ -352,5 +349,4 @@ var Type = function Type(props) {
|
|
|
352
349
|
});
|
|
353
350
|
}
|
|
354
351
|
};
|
|
355
|
-
exports.Type = Type;
|
|
356
352
|
Type.displayName = 'JVR.Type';
|
|
@@ -6,7 +6,6 @@ import { DeleteIcon } from './icon/delete';
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
export function CountInfoExtra(props) {
|
|
9
|
-
var _ref, _ref2;
|
|
10
9
|
var {
|
|
11
10
|
visible,
|
|
12
11
|
showTools,
|
|
@@ -21,8 +20,8 @@ export function CountInfoExtra(props) {
|
|
|
21
20
|
onDelete
|
|
22
21
|
} = props;
|
|
23
22
|
if (!visible || !showTools) return null;
|
|
24
|
-
var click = function
|
|
25
|
-
|
|
23
|
+
var click = /*#__PURE__*/function () {
|
|
24
|
+
var _ref = _asyncToGenerator(function* (event) {
|
|
26
25
|
event.stopPropagation();
|
|
27
26
|
var keyOrValue = 'AddKeyOrValue';
|
|
28
27
|
var isArray = Array.isArray(value);
|
|
@@ -36,10 +35,13 @@ export function CountInfoExtra(props) {
|
|
|
36
35
|
setValue(result);
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
});
|
|
39
|
+
return function click(_x) {
|
|
40
|
+
return _ref.apply(this, arguments);
|
|
41
|
+
};
|
|
42
|
+
}();
|
|
43
|
+
var deleteHandle = /*#__PURE__*/function () {
|
|
44
|
+
var _ref2 = _asyncToGenerator(function* (event) {
|
|
43
45
|
event.stopPropagation();
|
|
44
46
|
if (onDelete && (keyName || typeof keyName === 'number') && parentValue) {
|
|
45
47
|
var maybeDelete = yield onDelete(keyName, value, parentValue, {
|
|
@@ -55,8 +57,11 @@ export function CountInfoExtra(props) {
|
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
+
});
|
|
61
|
+
return function deleteHandle(_x2) {
|
|
62
|
+
return _ref2.apply(this, arguments);
|
|
63
|
+
};
|
|
64
|
+
}();
|
|
60
65
|
return /*#__PURE__*/_jsxs(Fragment, {
|
|
61
66
|
children: [editable && onAdd && /*#__PURE__*/_jsx(AddIcon, {
|
|
62
67
|
onClick: click
|
package/esm/editor/objectKey.js
CHANGED
|
@@ -7,7 +7,6 @@ import { useHighlight } from '../semicolon';
|
|
|
7
7
|
import { Label } from '../value';
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
export var ObjectKey = props => {
|
|
10
|
-
var _ref;
|
|
11
10
|
var {
|
|
12
11
|
className,
|
|
13
12
|
value,
|
|
@@ -43,8 +42,8 @@ export var ObjectKey = props => {
|
|
|
43
42
|
(_$edit$current = $edit.current) == null || _$edit$current.focus();
|
|
44
43
|
}
|
|
45
44
|
};
|
|
46
|
-
var blur = function
|
|
47
|
-
|
|
45
|
+
var blur = /*#__PURE__*/function () {
|
|
46
|
+
var _ref = _asyncToGenerator(function* () {
|
|
48
47
|
if ($edit.current) {
|
|
49
48
|
var _$edit$current2;
|
|
50
49
|
if (onEdit) {
|
|
@@ -66,8 +65,11 @@ export var ObjectKey = props => {
|
|
|
66
65
|
(_$edit$current2 = $edit.current) == null || _$edit$current2.focus();
|
|
67
66
|
}
|
|
68
67
|
setEditable(false);
|
|
69
|
-
})
|
|
70
|
-
|
|
68
|
+
});
|
|
69
|
+
return function blur() {
|
|
70
|
+
return _ref.apply(this, arguments);
|
|
71
|
+
};
|
|
72
|
+
}();
|
|
71
73
|
var focus = () => {
|
|
72
74
|
if ($edit.current) {
|
|
73
75
|
var _$edit$current3;
|
package/esm/editor/value.js
CHANGED
|
@@ -21,7 +21,7 @@ var Quotes = _ref => {
|
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
23
|
export function ReValue(props) {
|
|
24
|
-
var
|
|
24
|
+
var _typeMap$typeStr;
|
|
25
25
|
var {
|
|
26
26
|
type,
|
|
27
27
|
value,
|
|
@@ -65,8 +65,8 @@ export function ReValue(props) {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
var blur = function
|
|
69
|
-
|
|
68
|
+
var blur = /*#__PURE__*/function () {
|
|
69
|
+
var _ref2 = _asyncToGenerator(function* () {
|
|
70
70
|
if (!editableValue) return;
|
|
71
71
|
setEditable(false);
|
|
72
72
|
if ($edit.current) {
|
|
@@ -101,7 +101,7 @@ export function ReValue(props) {
|
|
|
101
101
|
_typeStr = 'undefined';
|
|
102
102
|
} else if (typeof text === 'string') {
|
|
103
103
|
try {
|
|
104
|
-
if (text && text.length >
|
|
104
|
+
if (text && text.length > 19 && !isNaN(Date.parse(text))) {
|
|
105
105
|
var dt = new Date(text);
|
|
106
106
|
text = dt;
|
|
107
107
|
_typeStr = 'date';
|
|
@@ -126,8 +126,11 @@ export function ReValue(props) {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
})
|
|
130
|
-
|
|
129
|
+
});
|
|
130
|
+
return function blur() {
|
|
131
|
+
return _ref2.apply(this, arguments);
|
|
132
|
+
};
|
|
133
|
+
}();
|
|
131
134
|
var defaultStyle = {
|
|
132
135
|
minWidth: 34,
|
|
133
136
|
minHeight: 18,
|
|
@@ -155,8 +158,8 @@ export function ReValue(props) {
|
|
|
155
158
|
if (typeStr === 'null' || typeStr === 'undefined' || type.toLocaleLowerCase() === 'nan') {
|
|
156
159
|
typeView = /*#__PURE__*/_jsx(Fragment, {});
|
|
157
160
|
}
|
|
158
|
-
var deleteHandle = function
|
|
159
|
-
|
|
161
|
+
var deleteHandle = /*#__PURE__*/function () {
|
|
162
|
+
var _ref3 = _asyncToGenerator(function* (evn) {
|
|
160
163
|
evn.stopPropagation();
|
|
161
164
|
if (data && keyName && keyName in data && setValue && onDelete) {
|
|
162
165
|
var maybeDelete = yield onDelete(keyName, value, parentValue, {
|
|
@@ -167,8 +170,11 @@ export function ReValue(props) {
|
|
|
167
170
|
setValue(_extends({}, data));
|
|
168
171
|
}
|
|
169
172
|
}
|
|
170
|
-
})
|
|
171
|
-
|
|
173
|
+
});
|
|
174
|
+
return function deleteHandle(_x) {
|
|
175
|
+
return _ref3.apply(this, arguments);
|
|
176
|
+
};
|
|
177
|
+
}();
|
|
172
178
|
return /*#__PURE__*/_jsxs(Fragment, {
|
|
173
179
|
children: [displayDataTypes && typeView, /*#__PURE__*/_jsx(Quotes, {
|
|
174
180
|
style: style,
|
package/esm/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface JsonViewProps<T extends object> extends React.DetailedHTMLProps
|
|
|
33
33
|
displayDataTypes?: boolean;
|
|
34
34
|
/** When set to `true`, `objects` and `arrays` are labeled with size @default true */
|
|
35
35
|
displayObjectSize?: boolean;
|
|
36
|
-
/** Shorten long JSON strings, Set to `0` to disable this feature @default
|
|
36
|
+
/** Shorten long JSON strings, Set to `0` to disable this feature @default 30 */
|
|
37
37
|
shortenTextAfterLength?: number;
|
|
38
38
|
/** Define the root node name. @default undefined */
|
|
39
39
|
keyName?: string | number;
|
package/esm/node.js
CHANGED
|
@@ -46,7 +46,7 @@ export var RootNode = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
46
46
|
highlightUpdates = true,
|
|
47
47
|
objectSortKeys = false,
|
|
48
48
|
indentWidth = 15,
|
|
49
|
-
shortenTextAfterLength =
|
|
49
|
+
shortenTextAfterLength = 30,
|
|
50
50
|
collapsed,
|
|
51
51
|
level = 1,
|
|
52
52
|
keyid = 'root',
|
|
@@ -108,11 +108,11 @@ export var RootNode = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
108
108
|
transform: "rotate(" + (expand ? '0' : '-90') + "deg)",
|
|
109
109
|
transition: 'all 0.3s'
|
|
110
110
|
};
|
|
111
|
-
var arrowView = components.arrow ? /*#__PURE__*/cloneElement(components.arrow, {
|
|
111
|
+
var arrowView = components.arrow ? ( /*#__PURE__*/cloneElement(components.arrow, {
|
|
112
112
|
style: arrowStyle,
|
|
113
113
|
'data-expand': expand,
|
|
114
114
|
className: 'w-rjv-arrow'
|
|
115
|
-
}) : /*#__PURE__*/_jsx(TriangleArrow, {
|
|
115
|
+
})) : /*#__PURE__*/_jsx(TriangleArrow, {
|
|
116
116
|
style: arrowStyle,
|
|
117
117
|
className: "w-rjv-arrow"
|
|
118
118
|
});
|
package/esm/value.js
CHANGED
|
@@ -5,7 +5,7 @@ var _excluded = ["children", "style"],
|
|
|
5
5
|
_excluded3 = ["color", "style", "isURL", "href", "children"],
|
|
6
6
|
_excluded4 = ["value", "parentValue", "setValue", "countInfo", "data", "keyName", "indentWidth", "isSet", "namespace", "renderKey", "components", "quotes", "level", "enableClipboard", "displayObjectSize", "displayDataTypes", "shortenTextAfterLength"],
|
|
7
7
|
_excluded5 = ["children", "color", "fontSize", "opacity", "paddingRight", "style"];
|
|
8
|
-
import { Fragment, forwardRef, useMemo, useState } from 'react';
|
|
8
|
+
import { Fragment, forwardRef, useMemo, useEffect, useState } from 'react';
|
|
9
9
|
import { Meta } from './comps/meta';
|
|
10
10
|
import { Copied } from './copied';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -134,10 +134,8 @@ var RenderShortenTextValue = _ref2 => {
|
|
|
134
134
|
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
135
135
|
var childrenStr = children;
|
|
136
136
|
var [shorten, setShorten] = useState(length && childrenStr.length >= length);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
setShorten(!shorten);
|
|
140
|
-
};
|
|
137
|
+
useEffect(() => setShorten(length && childrenStr.length >= length), [length]);
|
|
138
|
+
var click = () => setShorten(!shorten);
|
|
141
139
|
var text = shorten ? childrenStr.slice(0, length) + "..." : childrenStr;
|
|
142
140
|
return /*#__PURE__*/_jsx(RenderStringValue, _extends({}, rest, {
|
|
143
141
|
style: _extends({}, style, {
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uiw/react-json-view",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.2",
|
|
4
4
|
"description": "JSON viewer for react.",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
7
7
|
"homepage": "https://uiwjs.github.io/react-json-view",
|
|
8
|
+
"funding": "https://jaywcjlove.github.io/#/sponsor",
|
|
8
9
|
"exports": {
|
|
9
10
|
"./README.md": "./README.md",
|
|
10
11
|
".": {
|
|
@@ -93,6 +94,10 @@
|
|
|
93
94
|
"cjs",
|
|
94
95
|
"esm"
|
|
95
96
|
],
|
|
97
|
+
"publishConfig": {
|
|
98
|
+
"access": "public",
|
|
99
|
+
"provenance": true
|
|
100
|
+
},
|
|
96
101
|
"keywords": [
|
|
97
102
|
"array-viewer",
|
|
98
103
|
"component",
|