@uiw/react-json-view 1.12.0 → 2.0.0-alpha.0
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 +249 -265
- package/cjs/Container.d.ts +10 -0
- package/cjs/Container.js +67 -0
- package/cjs/arrow/TriangleArrow.js +3 -1
- package/cjs/arrow/TriangleSolidArrow.js +7 -3
- package/cjs/comps/Copied.d.ts +16 -0
- package/cjs/{copied.js → comps/Copied.js} +44 -32
- package/cjs/comps/CountInfo.d.ts +19 -0
- package/cjs/comps/CountInfo.js +72 -0
- package/cjs/comps/Ellipsis.d.ts +10 -0
- package/cjs/comps/Ellipsis.js +35 -0
- package/cjs/comps/Key.d.ts +7 -0
- package/cjs/comps/Key.js +39 -0
- package/cjs/comps/KeyValues.d.ts +22 -0
- package/cjs/comps/KeyValues.js +156 -0
- package/cjs/comps/NestedClose.d.ts +10 -0
- package/cjs/comps/NestedClose.js +38 -0
- package/cjs/comps/NestedOpen.d.ts +11 -0
- package/cjs/comps/NestedOpen.js +95 -0
- package/cjs/comps/ReRender/Symbols.d.ts +44 -0
- package/cjs/comps/ReRender/Symbols.js +144 -0
- package/cjs/comps/ReRender/Types.d.ts +36 -0
- package/cjs/comps/ReRender/Types.js +590 -0
- package/cjs/comps/Value.d.ts +11 -0
- package/cjs/comps/Value.js +78 -0
- package/cjs/index.d.ts +72 -52
- package/cjs/index.js +147 -27
- package/cjs/section/Copied.d.ts +6 -0
- package/cjs/section/Copied.js +17 -0
- package/cjs/section/CountInfo.d.ts +6 -0
- package/cjs/section/CountInfo.js +17 -0
- package/cjs/section/CountInfoExtra.d.ts +6 -0
- package/cjs/section/CountInfoExtra.js +17 -0
- package/cjs/section/Ellipsis.d.ts +6 -0
- package/cjs/section/Ellipsis.js +17 -0
- package/cjs/section/KeyName.d.ts +6 -0
- package/cjs/section/KeyName.js +17 -0
- package/cjs/store/Expands.d.ts +16 -0
- package/cjs/store/Expands.js +44 -0
- package/cjs/store/Section.d.ts +33 -0
- package/cjs/store/Section.js +86 -0
- package/cjs/store/ShowTools.d.ts +14 -0
- package/cjs/store/ShowTools.js +44 -0
- package/cjs/store/Symbols.d.ts +37 -0
- package/cjs/store/Symbols.js +112 -0
- package/cjs/store/Types.d.ts +52 -0
- package/cjs/store/Types.js +162 -0
- package/cjs/store.d.ts +29 -5
- package/cjs/store.js +96 -46
- package/cjs/symbol/Arrow.d.ts +6 -0
- package/cjs/symbol/Arrow.js +17 -0
- package/cjs/symbol/BraceLeft.d.ts +6 -0
- package/cjs/symbol/BraceLeft.js +17 -0
- package/cjs/symbol/BraceRight.d.ts +6 -0
- package/cjs/symbol/BraceRight.js +17 -0
- package/cjs/symbol/BracketsLeft.d.ts +6 -0
- package/cjs/symbol/BracketsLeft.js +17 -0
- package/cjs/symbol/BracketsRight.d.ts +6 -0
- package/cjs/symbol/BracketsRight.js +17 -0
- package/cjs/symbol/Colon.d.ts +6 -0
- package/cjs/symbol/Colon.js +17 -0
- package/cjs/symbol/Quote.d.ts +6 -0
- package/cjs/symbol/Quote.js +17 -0
- package/cjs/symbol/ValueQuote.d.ts +6 -0
- package/cjs/symbol/ValueQuote.js +17 -0
- package/cjs/theme/basic.js +3 -0
- package/cjs/theme/dark.js +3 -0
- package/cjs/theme/github.dark.js +3 -0
- package/cjs/theme/github.light.js +3 -0
- package/cjs/theme/gruvbox.js +3 -0
- package/cjs/theme/light.js +3 -0
- package/cjs/theme/monokai.js +3 -0
- package/cjs/theme/nord.js +3 -0
- package/cjs/theme/vscode.js +3 -0
- package/cjs/type.d.ts +50 -0
- package/cjs/type.js +57 -0
- package/cjs/types/Bigint.d.ts +5 -0
- package/cjs/types/Bigint.js +17 -0
- package/cjs/types/Date.d.ts +5 -0
- package/cjs/types/Date.js +17 -0
- package/cjs/types/False.d.ts +5 -0
- package/cjs/types/False.js +17 -0
- package/cjs/types/Float.d.ts +5 -0
- package/cjs/types/Float.js +17 -0
- package/cjs/types/Int.d.ts +5 -0
- package/cjs/types/Int.js +17 -0
- package/cjs/types/Map.d.ts +5 -0
- package/cjs/types/Map.js +17 -0
- package/cjs/types/Nan.d.ts +5 -0
- package/cjs/types/Nan.js +17 -0
- package/cjs/types/Null.d.ts +5 -0
- package/cjs/types/Null.js +17 -0
- package/cjs/types/Set.d.ts +5 -0
- package/cjs/types/Set.js +17 -0
- package/cjs/types/String.d.ts +5 -0
- package/cjs/types/String.js +17 -0
- package/cjs/types/True.d.ts +5 -0
- package/cjs/types/True.js +17 -0
- package/cjs/types/Undefined.d.ts +5 -0
- package/cjs/types/Undefined.js +17 -0
- package/cjs/types/Url.d.ts +5 -0
- package/cjs/types/Url.js +17 -0
- package/cjs/utils/useHighlight.d.ts +9 -0
- package/cjs/utils/useHighlight.js +62 -0
- package/cjs/utils/useRender.d.ts +6 -0
- package/cjs/utils/useRender.js +51 -0
- package/esm/Container.d.ts +10 -0
- package/esm/Container.js +53 -0
- package/esm/arrow/TriangleArrow.js +3 -1
- package/esm/arrow/TriangleSolidArrow.js +7 -3
- package/esm/comps/Copied.d.ts +16 -0
- package/esm/{copied.js → comps/Copied.js} +44 -29
- package/esm/comps/CountInfo.d.ts +19 -0
- package/esm/comps/CountInfo.js +70 -0
- package/esm/comps/Ellipsis.d.ts +10 -0
- package/esm/comps/Ellipsis.js +31 -0
- package/esm/comps/Key.d.ts +7 -0
- package/esm/comps/Key.js +35 -0
- package/esm/comps/KeyValues.d.ts +22 -0
- package/esm/comps/KeyValues.js +142 -0
- package/esm/comps/NestedClose.d.ts +10 -0
- package/esm/comps/NestedClose.js +34 -0
- package/esm/comps/NestedOpen.d.ts +11 -0
- package/esm/comps/NestedOpen.js +91 -0
- package/esm/comps/ReRender/Symbols.d.ts +44 -0
- package/esm/comps/ReRender/Symbols.js +155 -0
- package/esm/comps/ReRender/Types.d.ts +36 -0
- package/esm/comps/ReRender/Types.js +621 -0
- package/esm/comps/Value.d.ts +11 -0
- package/esm/comps/Value.js +69 -0
- package/esm/index.d.ts +72 -52
- package/esm/index.js +98 -18
- package/esm/section/Copied.d.ts +6 -0
- package/esm/section/Copied.js +10 -0
- package/esm/section/CountInfo.d.ts +6 -0
- package/esm/section/CountInfo.js +10 -0
- package/esm/section/CountInfoExtra.d.ts +6 -0
- package/esm/section/CountInfoExtra.js +10 -0
- package/esm/section/Ellipsis.d.ts +6 -0
- package/esm/section/Ellipsis.js +10 -0
- package/esm/section/KeyName.d.ts +6 -0
- package/esm/section/KeyName.js +10 -0
- package/esm/store/Expands.d.ts +16 -0
- package/esm/store/Expands.js +32 -0
- package/esm/store/Section.d.ts +33 -0
- package/esm/store/Section.js +73 -0
- package/esm/store/ShowTools.d.ts +14 -0
- package/esm/store/ShowTools.js +32 -0
- package/esm/store/Symbols.d.ts +37 -0
- package/esm/store/Symbols.js +100 -0
- package/esm/store/Types.d.ts +52 -0
- package/esm/store/Types.js +150 -0
- package/esm/store.d.ts +29 -5
- package/esm/store.js +66 -32
- package/esm/symbol/Arrow.d.ts +6 -0
- package/esm/symbol/Arrow.js +10 -0
- package/esm/symbol/BraceLeft.d.ts +6 -0
- package/esm/symbol/BraceLeft.js +10 -0
- package/esm/symbol/BraceRight.d.ts +6 -0
- package/esm/symbol/BraceRight.js +10 -0
- package/esm/symbol/BracketsLeft.d.ts +6 -0
- package/esm/symbol/BracketsLeft.js +10 -0
- package/esm/symbol/BracketsRight.d.ts +6 -0
- package/esm/symbol/BracketsRight.js +10 -0
- package/esm/symbol/Colon.d.ts +6 -0
- package/esm/symbol/Colon.js +10 -0
- package/esm/symbol/Quote.d.ts +6 -0
- package/esm/symbol/Quote.js +10 -0
- package/esm/symbol/ValueQuote.d.ts +6 -0
- package/esm/symbol/ValueQuote.js +10 -0
- package/esm/theme/basic.js +3 -0
- package/esm/theme/dark.js +3 -0
- package/esm/theme/github.dark.js +3 -0
- package/esm/theme/github.light.js +3 -0
- package/esm/theme/gruvbox.js +3 -0
- package/esm/theme/light.js +3 -0
- package/esm/theme/monokai.js +3 -0
- package/esm/theme/nord.js +3 -0
- package/esm/theme/vscode.js +3 -0
- package/esm/type.d.ts +50 -0
- package/esm/type.js +50 -0
- package/esm/types/Bigint.d.ts +5 -0
- package/esm/types/Bigint.js +10 -0
- package/esm/types/Date.d.ts +5 -0
- package/esm/types/Date.js +10 -0
- package/esm/types/False.d.ts +5 -0
- package/esm/types/False.js +10 -0
- package/esm/types/Float.d.ts +5 -0
- package/esm/types/Float.js +10 -0
- package/esm/types/Int.d.ts +5 -0
- package/esm/types/Int.js +10 -0
- package/esm/types/Map.d.ts +5 -0
- package/esm/types/Map.js +10 -0
- package/esm/types/Nan.d.ts +5 -0
- package/esm/types/Nan.js +10 -0
- package/esm/types/Null.d.ts +5 -0
- package/esm/types/Null.js +10 -0
- package/esm/types/Set.d.ts +5 -0
- package/esm/types/Set.js +10 -0
- package/esm/types/String.d.ts +5 -0
- package/esm/types/String.js +10 -0
- package/esm/types/True.d.ts +5 -0
- package/esm/types/True.js +10 -0
- package/esm/types/Undefined.d.ts +5 -0
- package/esm/types/Undefined.js +10 -0
- package/esm/types/Url.d.ts +5 -0
- package/esm/types/Url.js +10 -0
- package/esm/utils/useHighlight.d.ts +9 -0
- package/esm/{semicolon.js → utils/useHighlight.js} +1 -52
- package/esm/utils/useRender.d.ts +6 -0
- package/esm/utils/useRender.js +41 -0
- package/package.json +1 -1
- package/cjs/comps/ellipsis.d.ts +0 -7
- package/cjs/comps/ellipsis.js +0 -37
- package/cjs/comps/meta.d.ts +0 -12
- package/cjs/comps/meta.js +0 -46
- package/cjs/copied.d.ts +0 -11
- package/cjs/editor/countInfoExtra.d.ts +0 -28
- package/cjs/editor/countInfoExtra.js +0 -101
- package/cjs/editor/icon/add.d.ts +0 -4
- package/cjs/editor/icon/add.js +0 -30
- package/cjs/editor/icon/delete.d.ts +0 -4
- package/cjs/editor/icon/delete.js +0 -30
- package/cjs/editor/icon/edit.d.ts +0 -4
- package/cjs/editor/icon/edit.js +0 -30
- package/cjs/editor/index.d.ts +0 -31
- package/cjs/editor/index.js +0 -60
- package/cjs/editor/objectKey.d.ts +0 -11
- package/cjs/editor/objectKey.js +0 -169
- package/cjs/editor/value.d.ts +0 -22
- package/cjs/editor/value.js +0 -240
- package/cjs/node.d.ts +0 -15
- package/cjs/node.js +0 -343
- package/cjs/semicolon.d.ts +0 -22
- package/cjs/semicolon.js +0 -115
- package/cjs/value.d.ts +0 -93
- package/cjs/value.js +0 -356
- package/esm/comps/ellipsis.d.ts +0 -7
- package/esm/comps/ellipsis.js +0 -31
- package/esm/comps/meta.d.ts +0 -12
- package/esm/comps/meta.js +0 -39
- package/esm/copied.d.ts +0 -11
- package/esm/editor/countInfoExtra.d.ts +0 -28
- package/esm/editor/countInfoExtra.js +0 -68
- package/esm/editor/icon/add.d.ts +0 -4
- package/esm/editor/icon/add.js +0 -24
- package/esm/editor/icon/delete.d.ts +0 -4
- package/esm/editor/icon/delete.js +0 -24
- package/esm/editor/icon/edit.d.ts +0 -4
- package/esm/editor/icon/edit.js +0 -24
- package/esm/editor/index.d.ts +0 -31
- package/esm/editor/index.js +0 -47
- package/esm/editor/objectKey.d.ts +0 -11
- package/esm/editor/objectKey.js +0 -135
- package/esm/editor/value.d.ts +0 -22
- package/esm/editor/value.js +0 -192
- package/esm/node.d.ts +0 -15
- package/esm/node.js +0 -299
- package/esm/semicolon.d.ts +0 -22
- package/esm/value.d.ts +0 -93
- package/esm/value.js +0 -331
package/cjs/editor/value.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.ReValue = ReValue;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
-
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
10
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
var _react = require("react");
|
|
14
|
-
var _value = require("../value");
|
|
15
|
-
var _edit = require("./icon/edit");
|
|
16
|
-
var _delete = require("./icon/delete");
|
|
17
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
var _excluded = ["type", "value", "setValue", "data", "keyName", "visible", "quotes", "style", "children", "namespace", "displayDataTypes", "editableValue", "parentValue", "onDelete", "onEdit"];
|
|
19
|
-
var Quotes = function Quotes(_ref) {
|
|
20
|
-
var show = _ref.show,
|
|
21
|
-
style = _ref.style,
|
|
22
|
-
quotes = _ref.quotes;
|
|
23
|
-
if (!quotes || !show) return;
|
|
24
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
25
|
-
style: style,
|
|
26
|
-
children: quotes
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
function ReValue(props) {
|
|
30
|
-
var _ref2, _typeMap$typeStr, _ref3;
|
|
31
|
-
var type = props.type,
|
|
32
|
-
value = props.value,
|
|
33
|
-
setValue = props.setValue,
|
|
34
|
-
data = props.data,
|
|
35
|
-
keyName = props.keyName,
|
|
36
|
-
visible = props.visible,
|
|
37
|
-
quotes = props.quotes,
|
|
38
|
-
style = props.style,
|
|
39
|
-
children = props.children,
|
|
40
|
-
namespace = props.namespace,
|
|
41
|
-
displayDataTypes = props.displayDataTypes,
|
|
42
|
-
editableValue = props.editableValue,
|
|
43
|
-
parentValue = props.parentValue,
|
|
44
|
-
onDelete = props.onDelete,
|
|
45
|
-
onEdit = props.onEdit,
|
|
46
|
-
reset = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
47
|
-
var _useState = (0, _react.useState)(false),
|
|
48
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
49
|
-
editable = _useState2[0],
|
|
50
|
-
setEditable = _useState2[1];
|
|
51
|
-
var $edit = (0, _react.useRef)(null);
|
|
52
|
-
var _useState3 = (0, _react.useState)(type),
|
|
53
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
54
|
-
curentType = _useState4[0],
|
|
55
|
-
setCurentType = _useState4[1];
|
|
56
|
-
var _useState5 = (0, _react.useState)(value),
|
|
57
|
-
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
58
|
-
curentChild = _useState6[0],
|
|
59
|
-
setCurentChild = _useState6[1];
|
|
60
|
-
(0, _react.useEffect)(function () {
|
|
61
|
-
return setCurentChild(value);
|
|
62
|
-
}, [value]);
|
|
63
|
-
var click = function click(evn) {
|
|
64
|
-
evn.stopPropagation();
|
|
65
|
-
if (!editableValue) return;
|
|
66
|
-
if ($edit.current) {
|
|
67
|
-
var _$edit$current;
|
|
68
|
-
setEditable(true);
|
|
69
|
-
$edit.current.setAttribute('contentEditable', 'true');
|
|
70
|
-
(_$edit$current = $edit.current) === null || _$edit$current === void 0 || _$edit$current.focus();
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
var keyDown = function keyDown(evn) {
|
|
74
|
-
if (!editableValue) return;
|
|
75
|
-
if (evn.key === 'Enter') {
|
|
76
|
-
evn.stopPropagation();
|
|
77
|
-
evn.preventDefault();
|
|
78
|
-
setEditable(false);
|
|
79
|
-
if ($edit.current) {
|
|
80
|
-
$edit.current.setAttribute('contentEditable', 'false');
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
var blur = function blur() {
|
|
85
|
-
return (_ref2 = _ref2 || (0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
86
|
-
var text, _typeStr, dt, result, _getValueString, oldChildStr;
|
|
87
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
88
|
-
while (1) switch (_context.prev = _context.next) {
|
|
89
|
-
case 0:
|
|
90
|
-
if (editableValue) {
|
|
91
|
-
_context.next = 2;
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
return _context.abrupt("return");
|
|
95
|
-
case 2:
|
|
96
|
-
setEditable(false);
|
|
97
|
-
if (!$edit.current) {
|
|
98
|
-
_context.next = 16;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
$edit.current.setAttribute('contentEditable', 'false');
|
|
102
|
-
text = $edit.current.innerHTML;
|
|
103
|
-
_typeStr = curentType;
|
|
104
|
-
if (curentType === 'number' || curentType === 'float') {
|
|
105
|
-
text = Number(text);
|
|
106
|
-
_typeStr = (0, _value.isFloat)(text) ? 'float' : 'number';
|
|
107
|
-
}
|
|
108
|
-
if (curentType === 'url' && typeof text === 'string') {
|
|
109
|
-
text = new URL(text);
|
|
110
|
-
_typeStr = 'url';
|
|
111
|
-
}
|
|
112
|
-
if (Number.isNaN(text)) {
|
|
113
|
-
_typeStr = 'number';
|
|
114
|
-
}
|
|
115
|
-
if (typeof text === 'string' && /^(true|false)$/gi.test(text)) {
|
|
116
|
-
text = /^(true)$/gi.test(text) ? true : false;
|
|
117
|
-
_typeStr = 'boolean';
|
|
118
|
-
} else if (typeof text === 'string' && /^[\d]+n$/gi.test(text)) {
|
|
119
|
-
text = BigInt(text.replace(/n$/gi, ''));
|
|
120
|
-
_typeStr = 'bigint';
|
|
121
|
-
} else if (typeof text === 'string' && /^(null)$/gi.test(text)) {
|
|
122
|
-
text = null;
|
|
123
|
-
_typeStr = 'null';
|
|
124
|
-
} else if (typeof text === 'string' && /^(NaN)$/gi.test(text)) {
|
|
125
|
-
text = NaN;
|
|
126
|
-
_typeStr = 'NaN';
|
|
127
|
-
} else if (typeof text === 'string' && /^(undefined)$/gi.test(text)) {
|
|
128
|
-
text = undefined;
|
|
129
|
-
_typeStr = 'undefined';
|
|
130
|
-
} else if (typeof text === 'string') {
|
|
131
|
-
try {
|
|
132
|
-
if (text && text.length > 10 && !isNaN(Date.parse(text))) {
|
|
133
|
-
dt = new Date(text);
|
|
134
|
-
text = dt;
|
|
135
|
-
_typeStr = 'date';
|
|
136
|
-
}
|
|
137
|
-
} catch (error) {}
|
|
138
|
-
}
|
|
139
|
-
if (!onEdit) {
|
|
140
|
-
_context.next = 16;
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
_context.next = 14;
|
|
144
|
-
return onEdit({
|
|
145
|
-
type: 'value',
|
|
146
|
-
value: text,
|
|
147
|
-
oldValue: curentChild,
|
|
148
|
-
namespace: namespace
|
|
149
|
-
});
|
|
150
|
-
case 14:
|
|
151
|
-
result = _context.sent;
|
|
152
|
-
if (result) {
|
|
153
|
-
setCurentType(_typeStr);
|
|
154
|
-
setCurentChild(text);
|
|
155
|
-
} else {
|
|
156
|
-
_getValueString = (0, _value.getValueString)(curentChild), oldChildStr = _getValueString.content;
|
|
157
|
-
$edit.current.innerHTML = String(oldChildStr);
|
|
158
|
-
}
|
|
159
|
-
case 16:
|
|
160
|
-
case "end":
|
|
161
|
-
return _context.stop();
|
|
162
|
-
}
|
|
163
|
-
}, _callee);
|
|
164
|
-
}))).apply(this, arguments);
|
|
165
|
-
};
|
|
166
|
-
var defaultStyle = {
|
|
167
|
-
minWidth: 34,
|
|
168
|
-
minHeight: 18,
|
|
169
|
-
paddingInline: 3,
|
|
170
|
-
display: 'inline-block'
|
|
171
|
-
};
|
|
172
|
-
var _getValueString2 = (0, _value.getValueString)(curentChild),
|
|
173
|
-
typeStr = _getValueString2.type,
|
|
174
|
-
childStr = _getValueString2.content;
|
|
175
|
-
var color = ((_typeMap$typeStr = _value.typeMap[typeStr]) === null || _typeMap$typeStr === void 0 ? void 0 : _typeMap$typeStr.color) || '';
|
|
176
|
-
var spanProps = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
|
|
177
|
-
onBlur: blur,
|
|
178
|
-
onKeyDown: keyDown,
|
|
179
|
-
spellCheck: false,
|
|
180
|
-
style: editable ? (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, style), defaultStyle), {}, {
|
|
181
|
-
color: color
|
|
182
|
-
}) : (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, style), {}, {
|
|
183
|
-
color: color
|
|
184
|
-
})
|
|
185
|
-
});
|
|
186
|
-
var typeView = /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Type, {
|
|
187
|
-
type: typeStr
|
|
188
|
-
});
|
|
189
|
-
if (typeStr === 'null' || typeStr === 'undefined' || type.toLocaleLowerCase() === 'nan') {
|
|
190
|
-
typeView = /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {});
|
|
191
|
-
}
|
|
192
|
-
var deleteHandle = function deleteHandle(_x) {
|
|
193
|
-
return (_ref3 = _ref3 || (0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2(evn) {
|
|
194
|
-
var maybeDelete;
|
|
195
|
-
return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
|
|
196
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
197
|
-
case 0:
|
|
198
|
-
evn.stopPropagation();
|
|
199
|
-
if (!(data && keyName && keyName in data && setValue && onDelete)) {
|
|
200
|
-
_context2.next = 6;
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
_context2.next = 4;
|
|
204
|
-
return onDelete(keyName, value, parentValue, {
|
|
205
|
-
namespace: namespace
|
|
206
|
-
});
|
|
207
|
-
case 4:
|
|
208
|
-
maybeDelete = _context2.sent;
|
|
209
|
-
if (maybeDelete) {
|
|
210
|
-
delete data[keyName];
|
|
211
|
-
setValue((0, _objectSpread2["default"])({}, data));
|
|
212
|
-
}
|
|
213
|
-
case 6:
|
|
214
|
-
case "end":
|
|
215
|
-
return _context2.stop();
|
|
216
|
-
}
|
|
217
|
-
}, _callee2);
|
|
218
|
-
}))).apply(this, arguments);
|
|
219
|
-
};
|
|
220
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
221
|
-
children: [displayDataTypes && typeView, /*#__PURE__*/(0, _jsxRuntime.jsx)(Quotes, {
|
|
222
|
-
style: style,
|
|
223
|
-
quotes: quotes,
|
|
224
|
-
show: typeStr === 'string'
|
|
225
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spanProps), {}, {
|
|
226
|
-
ref: $edit,
|
|
227
|
-
"data-value": childStr,
|
|
228
|
-
children: typeof curentChild === 'string' ? curentChild : childStr
|
|
229
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(Quotes, {
|
|
230
|
-
style: style,
|
|
231
|
-
quotes: quotes,
|
|
232
|
-
show: typeStr === 'string'
|
|
233
|
-
}), visible && editableValue && onEdit && /*#__PURE__*/(0, _jsxRuntime.jsx)(_edit.EditIcon, {
|
|
234
|
-
onClick: click
|
|
235
|
-
}), visible && editableValue && onDelete && /*#__PURE__*/(0, _jsxRuntime.jsx)(_delete.DeleteIcon, {
|
|
236
|
-
onClick: deleteHandle
|
|
237
|
-
})]
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
ReValue.displayName = 'JVR.ReValue';
|
package/cjs/node.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import { LabelProps } from './value';
|
|
3
|
-
import { JsonViewProps } from './';
|
|
4
|
-
export declare const CountInfo: FC<PropsWithChildren<LabelProps>>;
|
|
5
|
-
export interface RootNodeProps<T extends object> extends JsonViewProps<T> {
|
|
6
|
-
keyName?: string | number;
|
|
7
|
-
keyid?: string;
|
|
8
|
-
level?: number;
|
|
9
|
-
parentValue?: T;
|
|
10
|
-
isSet?: boolean;
|
|
11
|
-
isMap?: boolean;
|
|
12
|
-
namespace?: Array<string | number>;
|
|
13
|
-
setParentValue?: React.Dispatch<React.SetStateAction<T>>;
|
|
14
|
-
}
|
|
15
|
-
export declare const RootNode: import("react").ForwardRefExoticComponent<Omit<RootNodeProps<object>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
package/cjs/node.js
DELETED
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.RootNode = exports.CountInfo = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
var _react = require("react");
|
|
14
|
-
var _value = require("./value");
|
|
15
|
-
var _TriangleArrow = require("./arrow/TriangleArrow");
|
|
16
|
-
var _store = require("./store");
|
|
17
|
-
var _semicolon = require("./semicolon");
|
|
18
|
-
var _copied = require("./copied");
|
|
19
|
-
var _ellipsis = require("./comps/ellipsis");
|
|
20
|
-
var _meta = require("./comps/meta");
|
|
21
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
var _excluded = ["value", "keyName", "className", "displayDataTypes", "components", "displayObjectSize", "enableClipboard", "highlightUpdates", "objectSortKeys", "indentWidth", "shortenTextAfterLength", "collapsed", "level", "keyid", "quotes", "namespace", "isSet", "isMap", "onCopied", "onExpand", "parentValue", "setParentValue"];
|
|
23
|
-
function getLength(obj) {
|
|
24
|
-
try {
|
|
25
|
-
return Object.keys(obj).length;
|
|
26
|
-
} catch (error) {
|
|
27
|
-
return -1;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
var CountInfo = function CountInfo(_ref) {
|
|
31
|
-
var children = _ref.children;
|
|
32
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_value.Label, {
|
|
33
|
-
style: {
|
|
34
|
-
paddingLeft: 4,
|
|
35
|
-
fontStyle: 'italic'
|
|
36
|
-
},
|
|
37
|
-
color: "var(--w-rjv-info-color, #0000004d)",
|
|
38
|
-
className: "w-rjv-object-size",
|
|
39
|
-
children: [children, " items"]
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
exports.CountInfo = CountInfo;
|
|
43
|
-
CountInfo.displayName = 'JVR.CountInfo';
|
|
44
|
-
var RootNode = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
45
|
-
var _expands$keyid;
|
|
46
|
-
var _props$value = props.value,
|
|
47
|
-
value = _props$value === void 0 ? {} : _props$value,
|
|
48
|
-
keyName = props.keyName,
|
|
49
|
-
className = props.className,
|
|
50
|
-
_props$displayDataTyp = props.displayDataTypes,
|
|
51
|
-
displayDataTypes = _props$displayDataTyp === void 0 ? true : _props$displayDataTyp,
|
|
52
|
-
_props$components = props.components,
|
|
53
|
-
components = _props$components === void 0 ? {} : _props$components,
|
|
54
|
-
_props$displayObjectS = props.displayObjectSize,
|
|
55
|
-
displayObjectSize = _props$displayObjectS === void 0 ? true : _props$displayObjectS,
|
|
56
|
-
_props$enableClipboar = props.enableClipboard,
|
|
57
|
-
enableClipboard = _props$enableClipboar === void 0 ? true : _props$enableClipboar,
|
|
58
|
-
_props$highlightUpdat = props.highlightUpdates,
|
|
59
|
-
highlightUpdates = _props$highlightUpdat === void 0 ? true : _props$highlightUpdat,
|
|
60
|
-
_props$objectSortKeys = props.objectSortKeys,
|
|
61
|
-
objectSortKeys = _props$objectSortKeys === void 0 ? false : _props$objectSortKeys,
|
|
62
|
-
_props$indentWidth = props.indentWidth,
|
|
63
|
-
indentWidth = _props$indentWidth === void 0 ? 15 : _props$indentWidth,
|
|
64
|
-
_props$shortenTextAft = props.shortenTextAfterLength,
|
|
65
|
-
shortenTextAfterLength = _props$shortenTextAft === void 0 ? 20 : _props$shortenTextAft,
|
|
66
|
-
collapsed = props.collapsed,
|
|
67
|
-
_props$level = props.level,
|
|
68
|
-
level = _props$level === void 0 ? 1 : _props$level,
|
|
69
|
-
_props$keyid = props.keyid,
|
|
70
|
-
keyid = _props$keyid === void 0 ? 'root' : _props$keyid,
|
|
71
|
-
_props$quotes = props.quotes,
|
|
72
|
-
quotes = _props$quotes === void 0 ? '"' : _props$quotes,
|
|
73
|
-
_props$namespace = props.namespace,
|
|
74
|
-
namespace = _props$namespace === void 0 ? [] : _props$namespace,
|
|
75
|
-
_props$isSet = props.isSet,
|
|
76
|
-
isSet = _props$isSet === void 0 ? false : _props$isSet,
|
|
77
|
-
_props$isMap = props.isMap,
|
|
78
|
-
isMap = _props$isMap === void 0 ? false : _props$isMap,
|
|
79
|
-
onCopied = props.onCopied,
|
|
80
|
-
onExpand = props.onExpand,
|
|
81
|
-
parentValue = props.parentValue,
|
|
82
|
-
setParentValue = props.setParentValue,
|
|
83
|
-
reset = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
84
|
-
var isArray = Array.isArray(value);
|
|
85
|
-
var subkeyid = (0, _react.useId)();
|
|
86
|
-
var expands = (0, _store.useExpandsStatus)();
|
|
87
|
-
var expand = (_expands$keyid = expands[keyid]) !== null && _expands$keyid !== void 0 ? _expands$keyid : typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level <= collapsed : true;
|
|
88
|
-
var handle = function handle() {
|
|
89
|
-
onExpand && typeof onExpand === 'function' && onExpand({
|
|
90
|
-
expand: !expand,
|
|
91
|
-
keyid: keyid,
|
|
92
|
-
keyName: keyName,
|
|
93
|
-
value: value
|
|
94
|
-
});
|
|
95
|
-
!expand ? _store.store.expand(keyid) : _store.store.collapse(keyid);
|
|
96
|
-
};
|
|
97
|
-
var _useState = (0, _react.useState)(value),
|
|
98
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
99
|
-
valueData = _useState2[0],
|
|
100
|
-
setValueData = _useState2[1];
|
|
101
|
-
var subNodeProps = {
|
|
102
|
-
components: components,
|
|
103
|
-
indentWidth: indentWidth,
|
|
104
|
-
displayDataTypes: displayDataTypes,
|
|
105
|
-
displayObjectSize: displayObjectSize,
|
|
106
|
-
enableClipboard: enableClipboard,
|
|
107
|
-
highlightUpdates: highlightUpdates,
|
|
108
|
-
onCopied: onCopied,
|
|
109
|
-
onExpand: onExpand,
|
|
110
|
-
collapsed: collapsed,
|
|
111
|
-
parentValue: value,
|
|
112
|
-
setParentValue: setValueData,
|
|
113
|
-
quotes: quotes,
|
|
114
|
-
level: level + 1,
|
|
115
|
-
style: {
|
|
116
|
-
paddingLeft: indentWidth
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
var valueViewProps = {
|
|
120
|
-
displayDataTypes: displayDataTypes,
|
|
121
|
-
displayObjectSize: displayObjectSize,
|
|
122
|
-
enableClipboard: enableClipboard,
|
|
123
|
-
shortenTextAfterLength: shortenTextAfterLength,
|
|
124
|
-
level: level + 1,
|
|
125
|
-
parentValue: value,
|
|
126
|
-
indentWidth: indentWidth,
|
|
127
|
-
data: valueData,
|
|
128
|
-
quotes: quotes,
|
|
129
|
-
setValue: setValueData
|
|
130
|
-
};
|
|
131
|
-
var arrowStyle = {
|
|
132
|
-
transform: "rotate(".concat(expand ? '0' : '-90', "deg)"),
|
|
133
|
-
transition: 'all 0.3s'
|
|
134
|
-
};
|
|
135
|
-
var arrowView = components.arrow ? /*#__PURE__*/(0, _react.cloneElement)(components.arrow, {
|
|
136
|
-
style: arrowStyle,
|
|
137
|
-
'data-expand': expand,
|
|
138
|
-
className: 'w-rjv-arrow'
|
|
139
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_TriangleArrow.TriangleArrow, {
|
|
140
|
-
style: arrowStyle,
|
|
141
|
-
className: "w-rjv-arrow"
|
|
142
|
-
});
|
|
143
|
-
var _useState3 = (0, _react.useState)(false),
|
|
144
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
145
|
-
showTools = _useState4[0],
|
|
146
|
-
setShowTools = _useState4[1];
|
|
147
|
-
var eventProps = {};
|
|
148
|
-
if (enableClipboard) {
|
|
149
|
-
eventProps.onMouseEnter = function () {
|
|
150
|
-
return setShowTools(true);
|
|
151
|
-
};
|
|
152
|
-
eventProps.onMouseLeave = function () {
|
|
153
|
-
return setShowTools(false);
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
(0, _react.useEffect)(function () {
|
|
157
|
-
return setValueData(value);
|
|
158
|
-
}, [value]);
|
|
159
|
-
var nameKeys = isArray ? Object.keys(valueData).map(function (m) {
|
|
160
|
-
return Number(m);
|
|
161
|
-
}) : Object.keys(valueData);
|
|
162
|
-
|
|
163
|
-
// object
|
|
164
|
-
var entries = isArray ? Object.entries(valueData).map(function (m) {
|
|
165
|
-
return [Number(m[0]), m[1]];
|
|
166
|
-
}) : Object.entries(valueData);
|
|
167
|
-
if (objectSortKeys) {
|
|
168
|
-
entries = objectSortKeys === true ? entries.sort(function (_ref2, _ref3) {
|
|
169
|
-
var _ref4 = (0, _slicedToArray2["default"])(_ref2, 1),
|
|
170
|
-
a = _ref4[0];
|
|
171
|
-
var _ref5 = (0, _slicedToArray2["default"])(_ref3, 1),
|
|
172
|
-
b = _ref5[0];
|
|
173
|
-
return typeof a === 'string' && typeof b === 'string' ? a.localeCompare(b) : 0;
|
|
174
|
-
}) : entries.sort(function (_ref6, _ref7) {
|
|
175
|
-
var _ref8 = (0, _slicedToArray2["default"])(_ref6, 1),
|
|
176
|
-
a = _ref8[0];
|
|
177
|
-
var _ref9 = (0, _slicedToArray2["default"])(_ref7, 1),
|
|
178
|
-
b = _ref9[0];
|
|
179
|
-
return typeof a === 'string' && typeof b === 'string' ? objectSortKeys(a, b) : 0;
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
var countInfo = /*#__PURE__*/(0, _jsxRuntime.jsx)(CountInfo, {
|
|
183
|
-
children: nameKeys.length
|
|
184
|
-
});
|
|
185
|
-
if (components.countInfo) {
|
|
186
|
-
countInfo = components.countInfo({
|
|
187
|
-
count: nameKeys.length,
|
|
188
|
-
level: level,
|
|
189
|
-
visible: expand
|
|
190
|
-
}) || countInfo;
|
|
191
|
-
}
|
|
192
|
-
if (!displayObjectSize) countInfo = null;
|
|
193
|
-
var countInfoExtra = components.countInfoExtra && components.countInfoExtra({
|
|
194
|
-
count: nameKeys.length,
|
|
195
|
-
level: level,
|
|
196
|
-
showTools: showTools,
|
|
197
|
-
keyName: keyName,
|
|
198
|
-
visible: expand,
|
|
199
|
-
value: valueData,
|
|
200
|
-
namespace: (0, _toConsumableArray2["default"])(namespace),
|
|
201
|
-
parentValue: parentValue,
|
|
202
|
-
setParentValue: setParentValue,
|
|
203
|
-
setValue: setValueData
|
|
204
|
-
});
|
|
205
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
206
|
-
ref: ref
|
|
207
|
-
}, reset), {}, {
|
|
208
|
-
className: "".concat(className, " w-rjv-inner")
|
|
209
|
-
}, eventProps), {}, {
|
|
210
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_value.Line, {
|
|
211
|
-
style: {
|
|
212
|
-
display: 'inline-flex',
|
|
213
|
-
alignItems: 'center'
|
|
214
|
-
},
|
|
215
|
-
onClick: handle,
|
|
216
|
-
children: [arrowView, (typeof keyName === 'string' || typeof keyName === 'number') && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
217
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_semicolon.Semicolon, {
|
|
218
|
-
value: valueData,
|
|
219
|
-
quotes: quotes,
|
|
220
|
-
"data-keys": keyid,
|
|
221
|
-
namespace: (0, _toConsumableArray2["default"])(namespace),
|
|
222
|
-
render: components.objectKey,
|
|
223
|
-
keyName: keyName,
|
|
224
|
-
parentName: keyName,
|
|
225
|
-
color: typeof keyName === 'number' ? _value.typeMap['number'].color : ''
|
|
226
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Colon, {})]
|
|
227
|
-
}), isSet && /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Type, {
|
|
228
|
-
type: "Set"
|
|
229
|
-
}), isMap && /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Type, {
|
|
230
|
-
type: "Map"
|
|
231
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_meta.Meta, {
|
|
232
|
-
start: true,
|
|
233
|
-
isArray: isArray,
|
|
234
|
-
level: level,
|
|
235
|
-
render: components.braces
|
|
236
|
-
}), !expand && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ellipsis.Ellipsis, {
|
|
237
|
-
render: components.ellipsis,
|
|
238
|
-
count: nameKeys.length,
|
|
239
|
-
level: level
|
|
240
|
-
}), !expand && /*#__PURE__*/(0, _jsxRuntime.jsx)(_meta.Meta, {
|
|
241
|
-
isArray: isArray,
|
|
242
|
-
level: level,
|
|
243
|
-
render: components.braces
|
|
244
|
-
}), countInfo, countInfoExtra, enableClipboard && /*#__PURE__*/(0, _jsxRuntime.jsx)(_copied.Copied, {
|
|
245
|
-
show: showTools,
|
|
246
|
-
text: valueData,
|
|
247
|
-
onCopied: onCopied,
|
|
248
|
-
render: components === null || components === void 0 ? void 0 : components.copied
|
|
249
|
-
})]
|
|
250
|
-
}), expand && /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Line, {
|
|
251
|
-
className: "w-rjv-content",
|
|
252
|
-
style: {
|
|
253
|
-
borderLeft: 'var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)',
|
|
254
|
-
marginLeft: 6
|
|
255
|
-
},
|
|
256
|
-
children: entries.length > 0 && (0, _toConsumableArray2["default"])(entries).map(function (_ref10, idx) {
|
|
257
|
-
var _ref11 = (0, _slicedToArray2["default"])(_ref10, 2),
|
|
258
|
-
key = _ref11[0],
|
|
259
|
-
itemVal = _ref11[1];
|
|
260
|
-
var item = itemVal;
|
|
261
|
-
var isMySet = item instanceof Set;
|
|
262
|
-
var isMyMap = item instanceof Map;
|
|
263
|
-
var myValue = isMySet ? Array.from(item) : isMyMap ? Object.fromEntries(item) : item;
|
|
264
|
-
var isEmpty = Array.isArray(myValue) && myValue.length === 0 || (0, _typeof2["default"])(myValue) === 'object' && myValue && !(myValue instanceof Date) && Object.keys(myValue).length === 0;
|
|
265
|
-
if ((Array.isArray(myValue) || isMySet || isMyMap) && !isEmpty) {
|
|
266
|
-
var label = isArray ? idx : key;
|
|
267
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Line, {
|
|
268
|
-
className: "w-rjv-wrap",
|
|
269
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RootNode, (0, _objectSpread2["default"])({
|
|
270
|
-
value: myValue,
|
|
271
|
-
isSet: isMySet,
|
|
272
|
-
isMap: isMyMap,
|
|
273
|
-
namespace: [].concat((0, _toConsumableArray2["default"])(namespace), [label]),
|
|
274
|
-
keyName: label,
|
|
275
|
-
keyid: keyid + subkeyid + label
|
|
276
|
-
}, subNodeProps))
|
|
277
|
-
}, label + idx);
|
|
278
|
-
}
|
|
279
|
-
if ((0, _typeof2["default"])(myValue) === 'object' && myValue && !(myValue instanceof Date) && !isEmpty) {
|
|
280
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Line, {
|
|
281
|
-
className: "w-rjv-wrap",
|
|
282
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RootNode, (0, _objectSpread2["default"])({
|
|
283
|
-
value: myValue,
|
|
284
|
-
namespace: [].concat((0, _toConsumableArray2["default"])(namespace), [key]),
|
|
285
|
-
keyName: key,
|
|
286
|
-
keyid: keyid + subkeyid + key
|
|
287
|
-
}, subNodeProps))
|
|
288
|
-
}, key + '' + idx);
|
|
289
|
-
}
|
|
290
|
-
if (typeof myValue === 'function') {
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
var renderKey = /*#__PURE__*/(0, _jsxRuntime.jsx)(_semicolon.Semicolon, {
|
|
294
|
-
value: myValue,
|
|
295
|
-
"data-keys": keyid,
|
|
296
|
-
quotes: quotes,
|
|
297
|
-
namespace: [].concat((0, _toConsumableArray2["default"])(namespace), [key]),
|
|
298
|
-
parentName: keyName,
|
|
299
|
-
highlightUpdates: highlightUpdates,
|
|
300
|
-
render: components.objectKey,
|
|
301
|
-
color: typeof key === 'number' ? _value.typeMap['number'].color : '',
|
|
302
|
-
keyName: key
|
|
303
|
-
});
|
|
304
|
-
var length = Array.isArray(myValue) ? myValue.length : getLength(myValue);
|
|
305
|
-
countInfo = /*#__PURE__*/(0, _jsxRuntime.jsx)(CountInfo, {
|
|
306
|
-
children: length
|
|
307
|
-
});
|
|
308
|
-
if (components.countInfo) {
|
|
309
|
-
countInfo = components.countInfo({
|
|
310
|
-
count: length,
|
|
311
|
-
level: level,
|
|
312
|
-
visible: expand
|
|
313
|
-
}) || countInfo;
|
|
314
|
-
}
|
|
315
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.ValueView, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
316
|
-
components: components,
|
|
317
|
-
namespace: [].concat((0, _toConsumableArray2["default"])(namespace), [key])
|
|
318
|
-
}, valueViewProps), {}, {
|
|
319
|
-
countInfo: countInfo,
|
|
320
|
-
renderKey: renderKey,
|
|
321
|
-
keyName: key,
|
|
322
|
-
isSet: isSet,
|
|
323
|
-
value: myValue
|
|
324
|
-
}), idx);
|
|
325
|
-
})
|
|
326
|
-
}), expand && /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Line, {
|
|
327
|
-
style: {
|
|
328
|
-
paddingLeft: 2
|
|
329
|
-
},
|
|
330
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_meta.Meta, {
|
|
331
|
-
render: components.braces,
|
|
332
|
-
isArray: isArray,
|
|
333
|
-
level: level,
|
|
334
|
-
style: {
|
|
335
|
-
paddingLeft: 2,
|
|
336
|
-
display: 'inline-block'
|
|
337
|
-
}
|
|
338
|
-
})
|
|
339
|
-
})]
|
|
340
|
-
}));
|
|
341
|
-
});
|
|
342
|
-
exports.RootNode = RootNode;
|
|
343
|
-
RootNode.displayName = 'JVR.RootNode';
|
package/cjs/semicolon.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import type { LabelProps } from './value';
|
|
3
|
-
import type { JsonViewProps } from './';
|
|
4
|
-
export declare function usePrevious<T>(value: T): T | undefined;
|
|
5
|
-
interface UseHighlight {
|
|
6
|
-
value: any;
|
|
7
|
-
highlightUpdates?: boolean;
|
|
8
|
-
highlightContainer: React.MutableRefObject<HTMLSpanElement | null>;
|
|
9
|
-
}
|
|
10
|
-
export declare function useHighlight({ value, highlightUpdates, highlightContainer }: UseHighlight): void;
|
|
11
|
-
export interface SemicolonProps extends LabelProps {
|
|
12
|
-
highlightUpdates?: boolean;
|
|
13
|
-
keyName?: string | number;
|
|
14
|
-
parentName?: string | number;
|
|
15
|
-
quotes?: JsonViewProps<object>['quotes'];
|
|
16
|
-
value?: object;
|
|
17
|
-
label?: string;
|
|
18
|
-
namespace?: Array<string | number>;
|
|
19
|
-
render?: (props: SemicolonProps) => React.ReactNode;
|
|
20
|
-
}
|
|
21
|
-
export declare const Semicolon: FC<PropsWithChildren<SemicolonProps>>;
|
|
22
|
-
export {};
|