@splunk/react-ui 4.47.0 → 4.47.1
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/CHANGELOG.md +5 -0
- package/JSONTree.js +320 -307
- package/package.json +1 -1
- package/types/src/JSONTree/JSONTreeItem.d.ts +3 -1
- package/types/src/JSONTree/renderTreeItems.d.ts +2 -1
package/CHANGELOG.md
CHANGED
package/JSONTree.js
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
light: "rgba(0, 0, 0, 0.03)"
|
|
48
48
|
}));
|
|
49
49
|
// CONCATENATED MODULE: ./src/Tree/TreeStyles.ts
|
|
50
|
-
var
|
|
50
|
+
var b = d().ul.withConfig({
|
|
51
51
|
displayName: "TreeStyles__StyledUnorderedList",
|
|
52
52
|
componentId: "sc-13pokwt-0"
|
|
53
53
|
})([ "", ";font-family:inherit;list-style:none;white-space:inherit;", ";" ], s.mixins.reset("ul"), (function(e) {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
* @param ref - The React callback or object ref. Can be `null` or `undefined`.
|
|
62
62
|
* @param current - The new value of the ref.
|
|
63
63
|
*/
|
|
64
|
-
function
|
|
64
|
+
function m(e, n) {
|
|
65
65
|
if (e) {
|
|
66
66
|
if (typeof e === "function") {
|
|
67
67
|
e(n);
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
}
|
|
204
204
|
return r;
|
|
205
205
|
}
|
|
206
|
-
var
|
|
206
|
+
var D = {
|
|
207
207
|
id: i().string,
|
|
208
208
|
children: i().node,
|
|
209
209
|
content: i().node,
|
|
@@ -217,12 +217,12 @@
|
|
|
217
217
|
onToggleExpansion: i().func
|
|
218
218
|
};
|
|
219
219
|
/** @public */
|
|
220
|
-
/** @public */ function
|
|
220
|
+
/** @public */ function K(e) {
|
|
221
221
|
var n = e.id, r = e.children, a = e.content, i = e.customIndent, l = e.elementRef, u = e.endAdornment, f = e.expanded, d = e.onFocus, s = e.onKeyDown, h = e.onToggleExpansion, S = e.onToggleSelection, O = A(e, [ "id", "children", "content", "customIndent", "elementRef", "endAdornment", "expanded", "onFocus", "onKeyDown", "onToggleExpansion", "onToggleSelection" ]);
|
|
222
222
|
// @docs-props-type TreeItemPropsBase
|
|
223
|
-
var w = (0, t.useContext)(c), I = w.defaultIndent, C = I === void 0 ? true : I, j = w.onItemKeyDown, E = w.onItemClick, T = w.removeNode, P = w.setNode, R = w.itemPaths,
|
|
223
|
+
var w = (0, t.useContext)(c), I = w.defaultIndent, C = I === void 0 ? true : I, j = w.onItemKeyDown, E = w.onItemClick, T = w.removeNode, P = w.setNode, R = w.itemPaths, D = w.focusedItemId;
|
|
224
224
|
// make first tree item tabbable
|
|
225
|
-
var
|
|
225
|
+
var K = (0, t.useState)((R === null || R === void 0 ? void 0 : R.get("".concat(n))) === "0" ? 0 : -1), _ = x(K, 2), N = _[0], V = _[1];
|
|
226
226
|
var L = (0, t.useRef)(null);
|
|
227
227
|
var q = (0, t.useRef)(null);
|
|
228
228
|
var F = t.Children.toArray(r).filter(t.isValidElement);
|
|
@@ -236,8 +236,8 @@
|
|
|
236
236
|
}
|
|
237
237
|
}));
|
|
238
238
|
var M = (0, t.useCallback)((function(e) {
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
m(L, e);
|
|
240
|
+
m(l, e);
|
|
241
241
|
}), [ l ]);
|
|
242
242
|
var $ = (0, t.useCallback)((function(e) {
|
|
243
243
|
var n;
|
|
@@ -265,11 +265,11 @@
|
|
|
265
265
|
}
|
|
266
266
|
}), [ n, R ]);
|
|
267
267
|
(0, t.useEffect)((function() {
|
|
268
|
-
if (
|
|
268
|
+
if (D === n) {
|
|
269
269
|
var e;
|
|
270
270
|
L === null || L === void 0 ? void 0 : (e = L.current) === null || e === void 0 ? void 0 : e.focus();
|
|
271
271
|
}
|
|
272
|
-
}), [
|
|
272
|
+
}), [ D, n, L ]);
|
|
273
273
|
var B = (0, t.useCallback)((function(e) {
|
|
274
274
|
e.stopPropagation();
|
|
275
275
|
}), []);
|
|
@@ -309,13 +309,13 @@
|
|
|
309
309
|
tabIndex: -1,
|
|
310
310
|
onFocus: B,
|
|
311
311
|
onClick: J
|
|
312
|
-
}, a, !f && u)), f && o().createElement(o().Fragment, null, o().createElement(
|
|
312
|
+
}, a, !f && u)), f && o().createElement(o().Fragment, null, o().createElement(b, {
|
|
313
313
|
role: "group",
|
|
314
314
|
$defaultIndent: C
|
|
315
315
|
}, r), u));
|
|
316
316
|
}
|
|
317
|
-
|
|
318
|
-
/* harmony default export */ const _ =
|
|
317
|
+
K.propTypes = D;
|
|
318
|
+
/* harmony default export */ const _ = K;
|
|
319
319
|
// CONCATENATED MODULE: ./src/Tree/treeUtils.ts
|
|
320
320
|
function N(e, n) {
|
|
321
321
|
return M(e) || F(e, n) || L(e, n) || V();
|
|
@@ -644,7 +644,7 @@
|
|
|
644
644
|
// do nothing
|
|
645
645
|
}
|
|
646
646
|
};
|
|
647
|
-
var
|
|
647
|
+
var m = function e(n, r) {
|
|
648
648
|
n.preventDefault();
|
|
649
649
|
v(r);
|
|
650
650
|
};
|
|
@@ -664,7 +664,7 @@
|
|
|
664
664
|
return {
|
|
665
665
|
defaultIndent: a,
|
|
666
666
|
onItemKeyDown: y,
|
|
667
|
-
onItemClick:
|
|
667
|
+
onItemClick: m,
|
|
668
668
|
removeNode: h,
|
|
669
669
|
setNode: g,
|
|
670
670
|
itemPaths: p,
|
|
@@ -674,7 +674,7 @@
|
|
|
674
674
|
|
|
675
675
|
return o().createElement(c.Provider, {
|
|
676
676
|
value: k
|
|
677
|
-
}, o().createElement(
|
|
677
|
+
}, o().createElement(b, Z({
|
|
678
678
|
"data-test": "tree",
|
|
679
679
|
ref: i,
|
|
680
680
|
role: "tree",
|
|
@@ -792,7 +792,7 @@
|
|
|
792
792
|
r.r(t);
|
|
793
793
|
// EXPORTS
|
|
794
794
|
r.d(t, {
|
|
795
|
-
default: () => /* reexport */
|
|
795
|
+
default: () => /* reexport */ xe
|
|
796
796
|
});
|
|
797
797
|
// EXTERNAL MODULE: external "react"
|
|
798
798
|
var e = r(9497);
|
|
@@ -803,53 +803,55 @@
|
|
|
803
803
|
// CONCATENATED MODULE: external "lodash/isString"
|
|
804
804
|
const i = require("lodash/isString");
|
|
805
805
|
var l = r.n(i);
|
|
806
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/id"
|
|
807
|
+
const u = require("@splunk/ui-utils/id");
|
|
806
808
|
// EXTERNAL MODULE: external "styled-components"
|
|
807
|
-
var
|
|
808
|
-
var
|
|
809
|
+
var c = r(232);
|
|
810
|
+
var f = r.n(c);
|
|
809
811
|
// EXTERNAL MODULE: external "@splunk/themes"
|
|
810
|
-
var
|
|
812
|
+
var d = r(3563);
|
|
811
813
|
// CONCATENATED MODULE: ./src/JSONTree/JSONTreeStyles.ts
|
|
812
|
-
var
|
|
814
|
+
var s = (0, c.css)([ "", ";", ";" ], d.mixins.reset("block"), d.mixins.typography({
|
|
813
815
|
family: "monospace"
|
|
814
816
|
}));
|
|
815
|
-
var
|
|
817
|
+
var v = f().code.withConfig({
|
|
816
818
|
displayName: "JSONTreeStyles__StyledScrollCode",
|
|
817
819
|
componentId: "vrdt21-0"
|
|
818
|
-
})([ "", ";overflow-x:auto;white-space:nowrap;" ],
|
|
819
|
-
var
|
|
820
|
+
})([ "", ";overflow-x:auto;white-space:nowrap;" ], s);
|
|
821
|
+
var p = f().code.withConfig({
|
|
820
822
|
displayName: "JSONTreeStyles__StyledWrapCode",
|
|
821
823
|
componentId: "vrdt21-1"
|
|
822
|
-
})([ "", ";white-space:pre-wrap;" ],
|
|
824
|
+
})([ "", ";white-space:pre-wrap;" ], s);
|
|
823
825
|
// CONCATENATED MODULE: external "lodash/fill"
|
|
824
|
-
const
|
|
825
|
-
var
|
|
826
|
+
const y = require("lodash/fill");
|
|
827
|
+
var b = r.n(y);
|
|
826
828
|
// CONCATENATED MODULE: external "lodash/isArray"
|
|
827
829
|
const m = require("lodash/isArray");
|
|
828
|
-
var
|
|
830
|
+
var h = r.n(m);
|
|
829
831
|
// CONCATENATED MODULE: external "lodash/isEmpty"
|
|
830
|
-
const
|
|
831
|
-
var
|
|
832
|
+
const g = require("lodash/isEmpty");
|
|
833
|
+
var S = r.n(g);
|
|
832
834
|
// CONCATENATED MODULE: external "lodash/isNumber"
|
|
833
|
-
const
|
|
834
|
-
var
|
|
835
|
+
const k = require("lodash/isNumber");
|
|
836
|
+
var O = r.n(k);
|
|
835
837
|
// CONCATENATED MODULE: external "lodash/isObject"
|
|
836
|
-
const
|
|
837
|
-
var
|
|
838
|
+
const w = require("lodash/isObject");
|
|
839
|
+
var I = r.n(w);
|
|
838
840
|
// CONCATENATED MODULE: external "lodash/keys"
|
|
839
|
-
const
|
|
840
|
-
var
|
|
841
|
+
const x = require("lodash/keys");
|
|
842
|
+
var C = r.n(x);
|
|
841
843
|
// CONCATENATED MODULE: external "lodash/repeat"
|
|
842
|
-
const
|
|
843
|
-
var
|
|
844
|
+
const j = require("lodash/repeat");
|
|
845
|
+
var E = r.n(j);
|
|
844
846
|
// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
|
|
845
|
-
const
|
|
847
|
+
const T = require("@splunk/ui-utils/i18n");
|
|
846
848
|
// EXTERNAL MODULE: external "@splunk/ui-utils/keyboard"
|
|
847
|
-
var
|
|
849
|
+
var P = r(5295);
|
|
848
850
|
// EXTERNAL MODULE: ./src/Tree/index.ts + 7 modules
|
|
849
|
-
var
|
|
851
|
+
var A = r(8655);
|
|
850
852
|
// CONCATENATED MODULE: ./src/JSONTree/JSONTreeItem.tsx
|
|
851
|
-
function
|
|
852
|
-
return
|
|
853
|
+
function R() {
|
|
854
|
+
return R = Object.assign ? Object.assign.bind() : function(e) {
|
|
853
855
|
for (var n = 1; n < arguments.length; n++) {
|
|
854
856
|
var r = arguments[n];
|
|
855
857
|
for (var t in r) {
|
|
@@ -857,29 +859,29 @@
|
|
|
857
859
|
}
|
|
858
860
|
}
|
|
859
861
|
return e;
|
|
860
|
-
},
|
|
862
|
+
}, R.apply(null, arguments);
|
|
861
863
|
}
|
|
862
|
-
function
|
|
863
|
-
return
|
|
864
|
+
function D(e, n) {
|
|
865
|
+
return L(e) || V(e, n) || _(e, n) || K();
|
|
864
866
|
}
|
|
865
867
|
function K() {
|
|
866
868
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
867
869
|
}
|
|
868
|
-
function
|
|
870
|
+
function _(e, n) {
|
|
869
871
|
if (e) {
|
|
870
|
-
if ("string" == typeof e) return
|
|
872
|
+
if ("string" == typeof e) return N(e, n);
|
|
871
873
|
var r = {}.toString.call(e).slice(8, -1);
|
|
872
|
-
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ?
|
|
874
|
+
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? N(e, n) : void 0;
|
|
873
875
|
}
|
|
874
876
|
}
|
|
875
|
-
function
|
|
877
|
+
function N(e, n) {
|
|
876
878
|
(null == n || n > e.length) && (n = e.length);
|
|
877
879
|
for (var r = 0, t = Array(n); r < n; r++) {
|
|
878
880
|
t[r] = e[r];
|
|
879
881
|
}
|
|
880
882
|
return t;
|
|
881
883
|
}
|
|
882
|
-
function
|
|
884
|
+
function V(e, n) {
|
|
883
885
|
var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
884
886
|
if (null != r) {
|
|
885
887
|
var t, o, a, i, l = [], u = !0, c = !1;
|
|
@@ -901,12 +903,12 @@
|
|
|
901
903
|
return l;
|
|
902
904
|
}
|
|
903
905
|
}
|
|
904
|
-
function
|
|
906
|
+
function L(e) {
|
|
905
907
|
if (Array.isArray(e)) return e;
|
|
906
908
|
}
|
|
907
|
-
function
|
|
909
|
+
function q(e, n) {
|
|
908
910
|
if (null == e) return {};
|
|
909
|
-
var r, t, o =
|
|
911
|
+
var r, t, o = F(e, n);
|
|
910
912
|
if (Object.getOwnPropertySymbols) {
|
|
911
913
|
var a = Object.getOwnPropertySymbols(e);
|
|
912
914
|
for (t = 0; t < a.length; t++) {
|
|
@@ -915,7 +917,7 @@
|
|
|
915
917
|
}
|
|
916
918
|
return o;
|
|
917
919
|
}
|
|
918
|
-
function
|
|
920
|
+
function F(e, n) {
|
|
919
921
|
if (null == e) return {};
|
|
920
922
|
var r = {};
|
|
921
923
|
for (var t in e) {
|
|
@@ -926,13 +928,14 @@
|
|
|
926
928
|
}
|
|
927
929
|
return r;
|
|
928
930
|
}
|
|
929
|
-
var
|
|
931
|
+
var M = {
|
|
930
932
|
clickableKeyRef: a().object,
|
|
931
933
|
clickableValRef: a().object,
|
|
932
934
|
hasChildren: a().bool,
|
|
933
935
|
indentArray: a().arrayOf(a().string),
|
|
934
936
|
index: a().number,
|
|
935
937
|
initialOpenState: a().bool,
|
|
938
|
+
isRoot: a().bool,
|
|
936
939
|
properties: a().arrayOf(a().string),
|
|
937
940
|
propertyDataPath: a().string,
|
|
938
941
|
propertyElement: a().node,
|
|
@@ -940,43 +943,43 @@
|
|
|
940
943
|
representation: a().node,
|
|
941
944
|
value: a().oneOfType([ a().string, a().object, a().array, a().number, a().bool ])
|
|
942
945
|
};
|
|
943
|
-
function
|
|
944
|
-
var t = r.clickableKeyRef, o = r.clickableValRef, a = r.hasChildren, i = r.indentArray, l = r.index, u = r.initialOpenState, c = r.
|
|
945
|
-
var
|
|
946
|
-
var
|
|
947
|
-
|
|
946
|
+
function $(r) {
|
|
947
|
+
var t = r.clickableKeyRef, o = r.clickableValRef, a = r.hasChildren, i = r.indentArray, l = r.index, u = r.initialOpenState, c = r.isRoot, f = r.onFocus, d = r.properties, s = r.propertyDataPath, v = r.propertyElement, p = r.renderExpandLink, y = r.representation, b = r.value, m = q(r, [ "clickableKeyRef", "clickableValRef", "hasChildren", "indentArray", "index", "initialOpenState", "isRoot", "onFocus", "properties", "propertyDataPath", "propertyElement", "renderExpandLink", "representation", "value" ]);
|
|
948
|
+
var g = (0, e.useState)(u), S = D(g, 2), k = S[0], O = S[1];
|
|
949
|
+
var w = (0, e.useCallback)((function() {
|
|
950
|
+
O((function(e) {
|
|
948
951
|
return !e;
|
|
949
952
|
}));
|
|
950
953
|
}), []);
|
|
951
|
-
var
|
|
952
|
-
var
|
|
953
|
-
onToggleExpansion:
|
|
954
|
-
open:
|
|
954
|
+
var I = (0, e.useRef)(null);
|
|
955
|
+
var x = p ? p({
|
|
956
|
+
onToggleExpansion: w,
|
|
957
|
+
open: k,
|
|
955
958
|
withTooltip: true,
|
|
956
|
-
expandLinkRef:
|
|
959
|
+
expandLinkRef: I
|
|
957
960
|
}) : {
|
|
958
961
|
expandLink: undefined
|
|
959
|
-
},
|
|
960
|
-
var
|
|
962
|
+
}, C = x.expandLink;
|
|
963
|
+
var j = (d === null || d === void 0 ? void 0 : d.length) && l + 1 < (d === null || d === void 0 ? void 0 : d.length) ? "," : null;
|
|
961
964
|
|
|
962
|
-
return n().createElement(
|
|
963
|
-
content: n().createElement(n().Fragment, null,
|
|
965
|
+
return n().createElement(A["default"].Item, R({
|
|
966
|
+
content: n().createElement(n().Fragment, null, v, a && (h()(b) ? "[" : "{"), !a && n().createElement(n().Fragment, null, y, j), a && C),
|
|
964
967
|
customIndent: i,
|
|
965
968
|
"data-test": a ? "node" : null,
|
|
966
|
-
"data-test-path":
|
|
967
|
-
endAdornment: a && n().createElement(n().Fragment, null,
|
|
968
|
-
expanded:
|
|
969
|
+
"data-test-path": s,
|
|
970
|
+
endAdornment: a && n().createElement(n().Fragment, null, k && i, h()(b) ? "]" : "}", j),
|
|
971
|
+
expanded: k,
|
|
969
972
|
onFocus: function e(n) {
|
|
970
|
-
|
|
973
|
+
f === null || f === void 0 ? void 0 : f(n);
|
|
971
974
|
// check if onFocus was triggered by a click event or expand link
|
|
972
|
-
var r = n.relatedTarget === (t === null || t === void 0 ? void 0 : t.current) || n.relatedTarget === (o === null || o === void 0 ? void 0 : o.current) || n.relatedTarget === (
|
|
973
|
-
if (
|
|
975
|
+
var r = n.relatedTarget === (t === null || t === void 0 ? void 0 : t.current) || n.relatedTarget === (o === null || o === void 0 ? void 0 : o.current) || n.relatedTarget === (I === null || I === void 0 ? void 0 : I.current) ? n.relatedTarget : null;
|
|
976
|
+
if (c) {
|
|
974
977
|
var a;
|
|
975
|
-
|
|
978
|
+
I === null || I === void 0 ? void 0 : (a = I.current) === null || a === void 0 ? void 0 : a.focus();
|
|
976
979
|
}
|
|
977
980
|
if (!r) {
|
|
978
981
|
// if JSONTreeItem contains clickable keys/vals, focus should go there
|
|
979
|
-
if (
|
|
982
|
+
if (v && (t === null || t === void 0 ? void 0 : t.current)) {
|
|
980
983
|
var i;
|
|
981
984
|
(i = t.current) === null || i === void 0 ? void 0 : i.focus();
|
|
982
985
|
} else if (o === null || o === void 0 ? void 0 : o.current) {
|
|
@@ -987,136 +990,136 @@
|
|
|
987
990
|
r.focus();
|
|
988
991
|
}
|
|
989
992
|
},
|
|
990
|
-
onToggleExpansion:
|
|
993
|
+
onToggleExpansion: w,
|
|
991
994
|
tabIndex: 0
|
|
992
|
-
}, m), a &&
|
|
995
|
+
}, m), a && y);
|
|
993
996
|
}
|
|
994
|
-
|
|
997
|
+
$.propTypes = M;
|
|
995
998
|
// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
|
|
996
|
-
const
|
|
997
|
-
var
|
|
999
|
+
const J = require("@splunk/react-ui/Clickable");
|
|
1000
|
+
var U = r.n(J);
|
|
998
1001
|
// CONCATENATED MODULE: external "@splunk/react-ui/Tooltip"
|
|
999
|
-
const
|
|
1000
|
-
var
|
|
1002
|
+
const H = require("@splunk/react-ui/Tooltip");
|
|
1003
|
+
var B = r.n(H);
|
|
1001
1004
|
// CONCATENATED MODULE: ./src/JSONTree/JSONTreeItemStyles.ts
|
|
1002
|
-
var
|
|
1003
|
-
string:
|
|
1004
|
-
number:
|
|
1005
|
-
boolean:
|
|
1006
|
-
null:
|
|
1007
|
-
object:
|
|
1005
|
+
var X = {
|
|
1006
|
+
string: d.variables.syntaxTeal,
|
|
1007
|
+
number: d.variables.syntaxBlue,
|
|
1008
|
+
boolean: d.variables.syntaxPurple,
|
|
1009
|
+
null: d.variables.syntaxBrown,
|
|
1010
|
+
object: d.variables.contentColorDefault
|
|
1008
1011
|
};
|
|
1009
|
-
var
|
|
1010
|
-
var
|
|
1011
|
-
var
|
|
1012
|
+
var W = (0, c.css)([ "word-break:break-word;word-wrap:break-word;" ]);
|
|
1013
|
+
var z = (0, c.css)([ "white-space:nowrap;" ]);
|
|
1014
|
+
var G = (0, c.css)([ "color:", ";", ";" ], (function(e) {
|
|
1012
1015
|
var n = e.valueType;
|
|
1013
|
-
return
|
|
1016
|
+
return X[n];
|
|
1014
1017
|
}), (function(e) {
|
|
1015
1018
|
var n = e.overflowType;
|
|
1016
|
-
return n === "wrap" ?
|
|
1019
|
+
return n === "wrap" ? W : z;
|
|
1017
1020
|
}));
|
|
1018
|
-
var
|
|
1021
|
+
var Q = f().span.withConfig({
|
|
1019
1022
|
displayName: "JSONTreeItemStyles__StyledValue",
|
|
1020
1023
|
componentId: "o558h3-0"
|
|
1021
|
-
})([ "", "" ],
|
|
1022
|
-
var
|
|
1024
|
+
})([ "", "" ], G);
|
|
1025
|
+
var Y = f()(U()).withConfig({
|
|
1023
1026
|
displayName: "JSONTreeItemStyles__StyledValueInteractiveClickable",
|
|
1024
1027
|
componentId: "o558h3-1"
|
|
1025
|
-
})([ "", " font-family:inherit;&:focus{box-shadow:0 0 1px 3px ", ";outline:0;&:active{box-shadow:none;}}&:hover{background-color:", ";}" ],
|
|
1026
|
-
|
|
1027
|
-
enterprise:
|
|
1028
|
-
prisma:
|
|
1028
|
+
})([ "", " font-family:inherit;&:focus{box-shadow:0 0 1px 3px ", ";outline:0;&:active{box-shadow:none;}}&:hover{background-color:", ";}" ], G, d.variables.focusColor, (0,
|
|
1029
|
+
d.pick)({
|
|
1030
|
+
enterprise: d.variables.backgroundColorHover,
|
|
1031
|
+
prisma: d.variables.interactiveColorOverlayHover
|
|
1029
1032
|
}));
|
|
1030
|
-
var
|
|
1033
|
+
var Z = (0, c.css)([ "font-weight:bold;color:", ";" ], (0, d.pick)({
|
|
1031
1034
|
enterprise: {
|
|
1032
1035
|
dark: "#ec9f98",
|
|
1033
|
-
light:
|
|
1036
|
+
light: d.variables.syntaxRed
|
|
1034
1037
|
},
|
|
1035
|
-
prisma:
|
|
1038
|
+
prisma: d.variables.syntaxRed
|
|
1036
1039
|
}));
|
|
1037
|
-
var
|
|
1040
|
+
var ee = f().span.withConfig({
|
|
1038
1041
|
displayName: "JSONTreeItemStyles__StyledProperty",
|
|
1039
1042
|
componentId: "o558h3-2"
|
|
1040
|
-
})([ "", "" ],
|
|
1041
|
-
var
|
|
1043
|
+
})([ "", "" ], Z);
|
|
1044
|
+
var ne = f()(U()).withConfig({
|
|
1042
1045
|
displayName: "JSONTreeItemStyles__StyledPropertyInteractiveClickable",
|
|
1043
1046
|
componentId: "o558h3-3"
|
|
1044
|
-
})([ "", " font-family:inherit;&:focus{box-shadow:0 0 1px 3px ", ";outline:0;&:active{box-shadow:none;}}&:hover{background-color:", ";}" ],
|
|
1045
|
-
|
|
1046
|
-
enterprise:
|
|
1047
|
-
prisma:
|
|
1047
|
+
})([ "", " font-family:inherit;&:focus{box-shadow:0 0 1px 3px ", ";outline:0;&:active{box-shadow:none;}}&:hover{background-color:", ";}" ], Z, d.variables.focusColor, (0,
|
|
1048
|
+
d.pick)({
|
|
1049
|
+
enterprise: d.variables.backgroundColorHover,
|
|
1050
|
+
prisma: d.variables.interactiveColorOverlayHover
|
|
1048
1051
|
}));
|
|
1049
|
-
var
|
|
1052
|
+
var re = f()(U()).withConfig({
|
|
1050
1053
|
displayName: "JSONTreeItemStyles__StyledExpandLinkClickable",
|
|
1051
1054
|
componentId: "o558h3-4"
|
|
1052
1055
|
})([ "cursor:pointer;color:", ";font-family:inherit;&:hover{background-color:", ";text-decoration:none;}&:focus{box-shadow:", ";&:active{box-shadow:none;}}", "" ], (0,
|
|
1053
|
-
|
|
1056
|
+
d.pick)({
|
|
1054
1057
|
enterprise: {
|
|
1055
|
-
dark:
|
|
1056
|
-
light:
|
|
1058
|
+
dark: d.variables.accentColorL20,
|
|
1059
|
+
light: d.variables.accentColorD20
|
|
1057
1060
|
},
|
|
1058
|
-
prisma:
|
|
1059
|
-
}), (0,
|
|
1060
|
-
enterprise:
|
|
1061
|
-
prisma:
|
|
1062
|
-
}),
|
|
1063
|
-
prisma: (0,
|
|
1061
|
+
prisma: d.variables.interactiveColorPrimary
|
|
1062
|
+
}), (0, d.pick)({
|
|
1063
|
+
enterprise: d.variables.backgroundColorHover,
|
|
1064
|
+
prisma: d.variables.interactiveColorOverlayHover
|
|
1065
|
+
}), d.variables.focusShadowInset, (0, d.pick)({
|
|
1066
|
+
prisma: (0, c.css)([ "border-radius:", ";" ], d.variables.borderRadius)
|
|
1064
1067
|
}));
|
|
1065
|
-
var
|
|
1068
|
+
var te = f()(B()).withConfig({
|
|
1066
1069
|
displayName: "JSONTreeItemStyles__StyledTooltip",
|
|
1067
1070
|
componentId: "o558h3-5"
|
|
1068
|
-
})([ "font-family:", ";" ],
|
|
1071
|
+
})([ "font-family:", ";" ], d.variables.monoFontFamily);
|
|
1069
1072
|
// CONCATENATED MODULE: ./src/JSONTree/renderTreeItems.tsx
|
|
1070
|
-
function
|
|
1073
|
+
function oe(e) {
|
|
1071
1074
|
"@babel/helpers - typeof";
|
|
1072
|
-
return
|
|
1075
|
+
return oe = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
1073
1076
|
return typeof e;
|
|
1074
1077
|
} : function(e) {
|
|
1075
1078
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
1076
|
-
},
|
|
1079
|
+
}, oe(e);
|
|
1077
1080
|
}
|
|
1078
|
-
function
|
|
1079
|
-
return
|
|
1081
|
+
function ae(e) {
|
|
1082
|
+
return ce(e) || ue(e) || le(e) || ie();
|
|
1080
1083
|
}
|
|
1081
|
-
function
|
|
1084
|
+
function ie() {
|
|
1082
1085
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1083
1086
|
}
|
|
1084
|
-
function
|
|
1087
|
+
function le(e, n) {
|
|
1085
1088
|
if (e) {
|
|
1086
|
-
if ("string" == typeof e) return
|
|
1089
|
+
if ("string" == typeof e) return fe(e, n);
|
|
1087
1090
|
var r = {}.toString.call(e).slice(8, -1);
|
|
1088
|
-
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ?
|
|
1091
|
+
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? fe(e, n) : void 0;
|
|
1089
1092
|
}
|
|
1090
1093
|
}
|
|
1091
|
-
function
|
|
1094
|
+
function ue(e) {
|
|
1092
1095
|
if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
|
|
1093
1096
|
}
|
|
1094
|
-
function
|
|
1095
|
-
if (Array.isArray(e)) return
|
|
1097
|
+
function ce(e) {
|
|
1098
|
+
if (Array.isArray(e)) return fe(e);
|
|
1096
1099
|
}
|
|
1097
|
-
function
|
|
1100
|
+
function fe(e, n) {
|
|
1098
1101
|
(null == n || n > e.length) && (n = e.length);
|
|
1099
1102
|
for (var r = 0, t = Array(n); r < n; r++) {
|
|
1100
1103
|
t[r] = e[r];
|
|
1101
1104
|
}
|
|
1102
1105
|
return t;
|
|
1103
1106
|
}
|
|
1104
|
-
function
|
|
1107
|
+
function de(r) {
|
|
1105
1108
|
var t = r.id, o = r.childKey, a = r.index, i = r.value, l = r.properties, u = r.propertyDataPath, c = r.obj, f = r.renderValue, d = r.renderKey, s = r.getInitialOpenState, v = r.indentArray, p = r.renderExpandLink, y = r.onFocus;
|
|
1109
|
+
var b = (0, e.useRef)(null);
|
|
1106
1110
|
var m = (0, e.useRef)(null);
|
|
1107
|
-
var
|
|
1108
|
-
var S = f({
|
|
1111
|
+
var g = f({
|
|
1109
1112
|
key: o,
|
|
1110
1113
|
value: i,
|
|
1111
|
-
clickValueRef:
|
|
1112
|
-
}), k =
|
|
1113
|
-
var
|
|
1114
|
+
clickValueRef: b
|
|
1115
|
+
}), k = g.representation, O = g.clickableValRef;
|
|
1116
|
+
var w = !h()(c) ? d(o, m) : {
|
|
1114
1117
|
propertyElement: undefined,
|
|
1115
1118
|
clickableKeyRef: undefined
|
|
1116
|
-
}, x =
|
|
1117
|
-
var j =
|
|
1119
|
+
}, x = w.propertyElement, C = w.clickableKeyRef;
|
|
1120
|
+
var j = I()(i) && !S()(i) || h()(i) && i.length > 0;
|
|
1118
1121
|
|
|
1119
|
-
return n().createElement(
|
|
1122
|
+
return n().createElement($, {
|
|
1120
1123
|
id: t,
|
|
1121
1124
|
propertyDataPath: u,
|
|
1122
1125
|
propertyElement: x,
|
|
@@ -1135,99 +1138,99 @@
|
|
|
1135
1138
|
}
|
|
1136
1139
|
});
|
|
1137
1140
|
}
|
|
1138
|
-
function
|
|
1139
|
-
var t = r.
|
|
1140
|
-
var
|
|
1141
|
-
var
|
|
1142
|
-
value:
|
|
1143
|
-
clickValueRef:
|
|
1144
|
-
}),
|
|
1141
|
+
function se(r) {
|
|
1142
|
+
var t = r.baseId, o = r.renderValue, a = r.obj;
|
|
1143
|
+
var i = (0, e.useRef)(null);
|
|
1144
|
+
var l = o({
|
|
1145
|
+
value: a,
|
|
1146
|
+
clickValueRef: i
|
|
1147
|
+
}), u = l.representation;
|
|
1145
1148
|
|
|
1146
|
-
return n().createElement(
|
|
1147
|
-
id: "0",
|
|
1149
|
+
return n().createElement(A["default"].Item, {
|
|
1150
|
+
id: "".concat(t, "-0"),
|
|
1148
1151
|
"data-test-path": ".",
|
|
1149
|
-
content:
|
|
1152
|
+
content: u
|
|
1150
1153
|
});
|
|
1151
1154
|
}
|
|
1152
|
-
function
|
|
1153
|
-
var r = e.
|
|
1154
|
-
var
|
|
1155
|
-
var
|
|
1155
|
+
function ve(e) {
|
|
1156
|
+
var r = e.baseId, t = e.defaultOpen, o = t === void 0 ? false : t, a = e.expandChildren, i = a === void 0 ? false : a, u = e.expandChildrenOnShiftKey, c = u === void 0 ? false : u, f = e.indent, d = f === void 0 ? 4 : f, s = e.indentLevel, v = s === void 0 ? 1 : s, p = e.obj, y = e.onClickKey, m = e.onClickValue, g = e.overflow, k = g === void 0 ? "scroll" : g, w = e.path, x = w === void 0 ? [] : w, j = e.shift, A = e.updateShift;
|
|
1157
|
+
var R = b()(Array(v), E()(" ", d));
|
|
1158
|
+
var D;
|
|
1156
1159
|
var K;
|
|
1157
|
-
var
|
|
1158
|
-
if (
|
|
1159
|
-
return
|
|
1160
|
+
var _ = function e() {
|
|
1161
|
+
if (i === true) {
|
|
1162
|
+
return o;
|
|
1160
1163
|
}
|
|
1161
|
-
if (
|
|
1162
|
-
return !!
|
|
1164
|
+
if (i === "withShiftModifier" || c) {
|
|
1165
|
+
return !!j;
|
|
1163
1166
|
}
|
|
1164
1167
|
return false;
|
|
1165
1168
|
};
|
|
1166
|
-
var
|
|
1167
|
-
if (
|
|
1168
|
-
if (
|
|
1169
|
-
|
|
1169
|
+
var N = function e(n) {
|
|
1170
|
+
if (i === "withShiftModifier" || c) {
|
|
1171
|
+
if (A != null) {
|
|
1172
|
+
A(n.shiftKey);
|
|
1170
1173
|
}
|
|
1171
1174
|
}
|
|
1172
1175
|
};
|
|
1173
|
-
var
|
|
1176
|
+
var V = function e(n, r) {
|
|
1174
1177
|
var t, o;
|
|
1175
1178
|
// When rendering a single value key is not present, here we prevent `[undefined]` in path
|
|
1176
|
-
var a = r !== undefined ? [].concat(
|
|
1179
|
+
var a = r !== undefined ? [].concat(ae(x), [ r ]) : ae(x);
|
|
1177
1180
|
var i = ".".concat(a.join("."));
|
|
1178
1181
|
(t = K) === null || t === void 0 ? void 0 : (o = t.current) === null || o === void 0 ? void 0 : o.focus();
|
|
1179
|
-
|
|
1182
|
+
y === null || y === void 0 ? void 0 : y(n, {
|
|
1180
1183
|
key: i,
|
|
1181
1184
|
keyPath: a
|
|
1182
1185
|
});
|
|
1183
1186
|
};
|
|
1184
|
-
var
|
|
1187
|
+
var L = function e(n, r) {
|
|
1185
1188
|
var t, o;
|
|
1186
1189
|
// When rendering a single value key is not present, here we prevent `[undefined]` in path
|
|
1187
|
-
var a = r !== undefined ? [].concat(
|
|
1190
|
+
var a = r !== undefined ? [].concat(ae(x), [ r ]) : ae(x);
|
|
1188
1191
|
var i = ".".concat(a.join("."));
|
|
1189
|
-
(t =
|
|
1192
|
+
(t = D) === null || t === void 0 ? void 0 : (o = t.current) === null || o === void 0 ? void 0 : o.focus();
|
|
1190
1193
|
m === null || m === void 0 ? void 0 : m(n, {
|
|
1191
1194
|
key: i,
|
|
1192
1195
|
keyPath: a,
|
|
1193
1196
|
value: n.target.textContent
|
|
1194
1197
|
});
|
|
1195
1198
|
};
|
|
1196
|
-
var
|
|
1199
|
+
var q = function e(n, r) {
|
|
1197
1200
|
var t, o;
|
|
1198
|
-
var a = (0,
|
|
1199
|
-
if (a === "left" &&
|
|
1201
|
+
var a = (0, P.keycode)(n.nativeEvent);
|
|
1202
|
+
if (a === "left" && y && ((t = K) === null || t === void 0 ? void 0 : t.current) && !r) {
|
|
1200
1203
|
var i;
|
|
1201
1204
|
n.stopPropagation();
|
|
1202
1205
|
(i = K.current) === null || i === void 0 ? void 0 : i.focus();
|
|
1203
1206
|
}
|
|
1204
|
-
if (a === "right" && m && ((o =
|
|
1207
|
+
if (a === "right" && m && ((o = D) === null || o === void 0 ? void 0 : o.current) && r) {
|
|
1205
1208
|
var l;
|
|
1206
1209
|
n.stopPropagation();
|
|
1207
|
-
(l =
|
|
1210
|
+
(l = D.current) === null || l === void 0 ? void 0 : l.focus();
|
|
1208
1211
|
}
|
|
1209
1212
|
};
|
|
1210
|
-
var
|
|
1213
|
+
var F = function e(r) {
|
|
1211
1214
|
var t = r.onToggleExpansion, o = r.open, a = r.withTooltip, i = r.expandLinkRef;
|
|
1212
1215
|
var l = o ? "[-]" : "[+]";
|
|
1213
|
-
var
|
|
1214
|
-
var f = n().createElement(
|
|
1216
|
+
var u = o ? (0, T._)("Collapse all") : (0, T._)("Shift click to expand all");
|
|
1217
|
+
var f = n().createElement(re, {
|
|
1215
1218
|
elementRef: i,
|
|
1216
1219
|
tabIndex: -1,
|
|
1217
1220
|
onClick: function e(n) {
|
|
1218
|
-
|
|
1221
|
+
N(n);
|
|
1219
1222
|
t === null || t === void 0 ? void 0 : t(n);
|
|
1220
1223
|
},
|
|
1221
1224
|
"aria-expanded": o,
|
|
1222
1225
|
"data-test": "toggle"
|
|
1223
1226
|
}, " ", l, " ");
|
|
1224
|
-
if (
|
|
1227
|
+
if (c && a) {
|
|
1225
1228
|
return {
|
|
1226
|
-
expandLink: n().createElement(
|
|
1229
|
+
expandLink: n().createElement(te, {
|
|
1227
1230
|
contentRelationship: "description",
|
|
1228
1231
|
openDelay: "secondary",
|
|
1229
1232
|
defaultPlacement: "above",
|
|
1230
|
-
content: (0,
|
|
1233
|
+
content: (0, T._)(u)
|
|
1231
1234
|
}, f),
|
|
1232
1235
|
expandLinkRef: i
|
|
1233
1236
|
};
|
|
@@ -1237,144 +1240,147 @@
|
|
|
1237
1240
|
expandLinkRef: i
|
|
1238
1241
|
};
|
|
1239
1242
|
};
|
|
1240
|
-
var
|
|
1241
|
-
var
|
|
1242
|
-
var
|
|
1243
|
-
if (!
|
|
1244
|
-
if (typeof
|
|
1245
|
-
|
|
1246
|
-
} else if (typeof
|
|
1247
|
-
|
|
1248
|
-
} else if (
|
|
1249
|
-
|
|
1243
|
+
var M = function e(t) {
|
|
1244
|
+
var o = t.value, a = t.key, u = t.clickValueRef;
|
|
1245
|
+
var f;
|
|
1246
|
+
if (!I()(o)) {
|
|
1247
|
+
if (typeof o === "string") {
|
|
1248
|
+
f = '"'.concat(o, '"');
|
|
1249
|
+
} else if (typeof o === "boolean") {
|
|
1250
|
+
f = o.toString();
|
|
1251
|
+
} else if (o === null) {
|
|
1252
|
+
f = "null";
|
|
1250
1253
|
} else {
|
|
1251
|
-
|
|
1254
|
+
f = o;
|
|
1252
1255
|
}
|
|
1253
|
-
} else if (
|
|
1256
|
+
} else if (S()(o)) {
|
|
1254
1257
|
// isObject is true for arrays
|
|
1255
|
-
|
|
1258
|
+
f = h()(o) ? "[]" : "{}";
|
|
1256
1259
|
} else {
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1260
|
+
f = ve({
|
|
1261
|
+
baseId: r,
|
|
1262
|
+
defaultOpen: i === true,
|
|
1263
|
+
expandChildren: i,
|
|
1264
|
+
expandChildrenOnShiftKey: c,
|
|
1265
|
+
onClickKey: y,
|
|
1262
1266
|
onClickValue: m,
|
|
1263
|
-
overflow:
|
|
1264
|
-
obj:
|
|
1265
|
-
path:
|
|
1266
|
-
indentLevel:
|
|
1267
|
-
shift:
|
|
1268
|
-
updateShift:
|
|
1267
|
+
overflow: k,
|
|
1268
|
+
obj: o,
|
|
1269
|
+
path: a !== undefined ? [].concat(ae(x), [ a ]) : ae(x),
|
|
1270
|
+
indentLevel: v + 1,
|
|
1271
|
+
shift: j,
|
|
1272
|
+
updateShift: A
|
|
1269
1273
|
});
|
|
1270
1274
|
}
|
|
1271
|
-
if (l()(
|
|
1272
|
-
var
|
|
1273
|
-
|
|
1275
|
+
if (l()(f) || O()(f)) {
|
|
1276
|
+
var d = o === null ? "null" : // TS: bigint, function, symbol are prevented by JSONElement type
|
|
1277
|
+
oe(o);
|
|
1274
1278
|
if (m) {
|
|
1275
1279
|
return {
|
|
1276
|
-
representation: n().createElement(
|
|
1277
|
-
elementRef:
|
|
1278
|
-
valueType:
|
|
1279
|
-
overflowType:
|
|
1280
|
+
representation: n().createElement(Y, {
|
|
1281
|
+
elementRef: u,
|
|
1282
|
+
valueType: d,
|
|
1283
|
+
overflowType: k,
|
|
1280
1284
|
onClick: function e(n) {
|
|
1281
|
-
|
|
1282
|
-
|
|
1285
|
+
D = u;
|
|
1286
|
+
L(n, a);
|
|
1283
1287
|
},
|
|
1284
1288
|
onKeyDown: function e(n) {
|
|
1285
|
-
|
|
1289
|
+
q(n, false);
|
|
1286
1290
|
},
|
|
1287
1291
|
tabIndex: -1
|
|
1288
|
-
},
|
|
1289
|
-
clickableValRef:
|
|
1292
|
+
}, f),
|
|
1293
|
+
clickableValRef: u
|
|
1290
1294
|
};
|
|
1291
1295
|
}
|
|
1292
1296
|
return {
|
|
1293
|
-
representation: n().createElement(
|
|
1294
|
-
valueType:
|
|
1295
|
-
overflowType:
|
|
1296
|
-
},
|
|
1297
|
+
representation: n().createElement(Q, {
|
|
1298
|
+
valueType: d,
|
|
1299
|
+
overflowType: k
|
|
1300
|
+
}, f)
|
|
1297
1301
|
};
|
|
1298
1302
|
}
|
|
1299
1303
|
return {
|
|
1300
|
-
representation:
|
|
1304
|
+
representation: f
|
|
1301
1305
|
};
|
|
1302
1306
|
};
|
|
1303
|
-
var
|
|
1304
|
-
if (
|
|
1307
|
+
var J = function e(r, t) {
|
|
1308
|
+
if (y) {
|
|
1305
1309
|
return {
|
|
1306
|
-
propertyElement: n().createElement("span", null, n().createElement(
|
|
1310
|
+
propertyElement: n().createElement("span", null, n().createElement(ne, {
|
|
1307
1311
|
elementRef: t,
|
|
1308
1312
|
tabIndex: -1,
|
|
1309
1313
|
onClick: function e(n) {
|
|
1310
1314
|
K = t;
|
|
1311
|
-
|
|
1315
|
+
V(n, r);
|
|
1312
1316
|
},
|
|
1313
1317
|
onKeyDown: function e(n) {
|
|
1314
|
-
|
|
1318
|
+
q(n, true);
|
|
1315
1319
|
}
|
|
1316
1320
|
}, r), ":", " "),
|
|
1317
1321
|
clickableKeyRef: t
|
|
1318
1322
|
};
|
|
1319
1323
|
}
|
|
1320
1324
|
return {
|
|
1321
|
-
propertyElement: n().createElement("span", null, n().createElement(
|
|
1325
|
+
propertyElement: n().createElement("span", null, n().createElement(ee, null, r), ":", " ")
|
|
1322
1326
|
};
|
|
1323
1327
|
};
|
|
1324
|
-
if (
|
|
1325
|
-
var
|
|
1326
|
-
var
|
|
1328
|
+
if (I()(p) && !S()(p) || h()(p) && p.length > 0) {
|
|
1329
|
+
var U = C()(p).map((function(e, t, o) {
|
|
1330
|
+
var a = p[e];
|
|
1327
1331
|
// TS: should be safe based on (recursive) JSONElement type
|
|
1328
|
-
var
|
|
1329
|
-
var
|
|
1332
|
+
var i = h()(p) ? parseInt(e, 10) : e;
|
|
1333
|
+
var l = x.length === 0 ? ".".concat(i) : ".".concat(x.join("."), ".").concat(i);
|
|
1330
1334
|
|
|
1331
|
-
return n().createElement(
|
|
1332
|
-
id:
|
|
1333
|
-
key:
|
|
1334
|
-
propertyDataPath:
|
|
1335
|
-
childKey:
|
|
1336
|
-
index:
|
|
1337
|
-
value:
|
|
1338
|
-
properties:
|
|
1339
|
-
obj:
|
|
1340
|
-
renderValue:
|
|
1341
|
-
renderKey:
|
|
1342
|
-
getInitialOpenState:
|
|
1343
|
-
indentArray:
|
|
1344
|
-
renderExpandLink:
|
|
1335
|
+
return n().createElement(de, {
|
|
1336
|
+
id: "".concat(r, "-").concat(l),
|
|
1337
|
+
key: l,
|
|
1338
|
+
propertyDataPath: l,
|
|
1339
|
+
childKey: i,
|
|
1340
|
+
index: t,
|
|
1341
|
+
value: a,
|
|
1342
|
+
properties: o,
|
|
1343
|
+
obj: p,
|
|
1344
|
+
renderValue: M,
|
|
1345
|
+
renderKey: J,
|
|
1346
|
+
getInitialOpenState: _,
|
|
1347
|
+
indentArray: R,
|
|
1348
|
+
renderExpandLink: F,
|
|
1345
1349
|
onFocus: function e(n, r) {
|
|
1346
1350
|
K = n;
|
|
1347
|
-
|
|
1351
|
+
D = r;
|
|
1348
1352
|
}
|
|
1349
1353
|
});
|
|
1350
1354
|
}));
|
|
1351
|
-
if (
|
|
1352
|
-
var
|
|
1355
|
+
if (x.length === 0) {
|
|
1356
|
+
var H = I()(p) && !S()(p) || h()(p) && p.length > 0;
|
|
1353
1357
|
|
|
1354
|
-
return n().createElement(
|
|
1355
|
-
id: "root",
|
|
1358
|
+
return n().createElement($, {
|
|
1359
|
+
id: "".concat(r, "-root"),
|
|
1360
|
+
isRoot: true,
|
|
1356
1361
|
propertyDataPath: ".",
|
|
1357
1362
|
key: ".",
|
|
1358
|
-
hasChildren:
|
|
1359
|
-
initialOpenState:
|
|
1360
|
-
value:
|
|
1363
|
+
hasChildren: H,
|
|
1364
|
+
initialOpenState: o,
|
|
1365
|
+
value: p,
|
|
1361
1366
|
index: 0,
|
|
1362
|
-
renderExpandLink:
|
|
1363
|
-
representation:
|
|
1367
|
+
renderExpandLink: F,
|
|
1368
|
+
representation: U
|
|
1364
1369
|
});
|
|
1365
1370
|
}
|
|
1366
|
-
return
|
|
1371
|
+
return U;
|
|
1367
1372
|
}
|
|
1368
1373
|
// edge case: a single number/string/boolean being rendered (still valid JSON)
|
|
1369
1374
|
|
|
1370
|
-
return n().createElement(
|
|
1371
|
-
|
|
1372
|
-
|
|
1375
|
+
return n().createElement(se, {
|
|
1376
|
+
baseId: r,
|
|
1377
|
+
obj: p,
|
|
1378
|
+
renderValue: M
|
|
1373
1379
|
});
|
|
1374
1380
|
}
|
|
1375
1381
|
// CONCATENATED MODULE: ./src/JSONTree/JSONTree.tsx
|
|
1376
|
-
function
|
|
1377
|
-
return
|
|
1382
|
+
function pe() {
|
|
1383
|
+
return pe = Object.assign ? Object.assign.bind() : function(e) {
|
|
1378
1384
|
for (var n = 1; n < arguments.length; n++) {
|
|
1379
1385
|
var r = arguments[n];
|
|
1380
1386
|
for (var t in r) {
|
|
@@ -1382,29 +1388,29 @@
|
|
|
1382
1388
|
}
|
|
1383
1389
|
}
|
|
1384
1390
|
return e;
|
|
1385
|
-
},
|
|
1391
|
+
}, pe.apply(null, arguments);
|
|
1386
1392
|
}
|
|
1387
|
-
function
|
|
1388
|
-
return
|
|
1393
|
+
function ye(e, n) {
|
|
1394
|
+
return Se(e) || ge(e, n) || me(e, n) || be();
|
|
1389
1395
|
}
|
|
1390
|
-
function
|
|
1396
|
+
function be() {
|
|
1391
1397
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1392
1398
|
}
|
|
1393
1399
|
function me(e, n) {
|
|
1394
1400
|
if (e) {
|
|
1395
|
-
if ("string" == typeof e) return
|
|
1401
|
+
if ("string" == typeof e) return he(e, n);
|
|
1396
1402
|
var r = {}.toString.call(e).slice(8, -1);
|
|
1397
|
-
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ?
|
|
1403
|
+
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? he(e, n) : void 0;
|
|
1398
1404
|
}
|
|
1399
1405
|
}
|
|
1400
|
-
function
|
|
1406
|
+
function he(e, n) {
|
|
1401
1407
|
(null == n || n > e.length) && (n = e.length);
|
|
1402
1408
|
for (var r = 0, t = Array(n); r < n; r++) {
|
|
1403
1409
|
t[r] = e[r];
|
|
1404
1410
|
}
|
|
1405
1411
|
return t;
|
|
1406
1412
|
}
|
|
1407
|
-
function
|
|
1413
|
+
function ge(e, n) {
|
|
1408
1414
|
var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
1409
1415
|
if (null != r) {
|
|
1410
1416
|
var t, o, a, i, l = [], u = !0, c = !1;
|
|
@@ -1426,12 +1432,12 @@
|
|
|
1426
1432
|
return l;
|
|
1427
1433
|
}
|
|
1428
1434
|
}
|
|
1429
|
-
function
|
|
1435
|
+
function Se(e) {
|
|
1430
1436
|
if (Array.isArray(e)) return e;
|
|
1431
1437
|
}
|
|
1432
|
-
function
|
|
1438
|
+
function ke(e, n) {
|
|
1433
1439
|
if (null == e) return {};
|
|
1434
|
-
var r, t, o =
|
|
1440
|
+
var r, t, o = Oe(e, n);
|
|
1435
1441
|
if (Object.getOwnPropertySymbols) {
|
|
1436
1442
|
var a = Object.getOwnPropertySymbols(e);
|
|
1437
1443
|
for (t = 0; t < a.length; t++) {
|
|
@@ -1440,7 +1446,7 @@
|
|
|
1440
1446
|
}
|
|
1441
1447
|
return o;
|
|
1442
1448
|
}
|
|
1443
|
-
function
|
|
1449
|
+
function Oe(e, n) {
|
|
1444
1450
|
if (null == e) return {};
|
|
1445
1451
|
var r = {};
|
|
1446
1452
|
for (var t in e) {
|
|
@@ -1453,7 +1459,7 @@
|
|
|
1453
1459
|
}
|
|
1454
1460
|
/** @public */
|
|
1455
1461
|
/** @public */
|
|
1456
|
-
/** @public */ var
|
|
1462
|
+
/** @public */ var we = {
|
|
1457
1463
|
elementRef: a().oneOfType([ a().func, a().object ]),
|
|
1458
1464
|
expandChildren: a().oneOfType([ a().bool, a().oneOf([ "withShiftModifier" ]) ]),
|
|
1459
1465
|
indent: a().number,
|
|
@@ -1465,38 +1471,45 @@
|
|
|
1465
1471
|
};
|
|
1466
1472
|
/**
|
|
1467
1473
|
* Used to visualize a JSON string.
|
|
1468
|
-
*/ function
|
|
1469
|
-
var t = r.elementRef, o = r.expandChildren, a = o === void 0 ? false : o, i = r.indent,
|
|
1474
|
+
*/ function Ie(r) {
|
|
1475
|
+
var t = r.elementRef, o = r.expandChildren, a = o === void 0 ? false : o, i = r.indent, c = i === void 0 ? 4 : i, f = r.json, d = r.onClickKey, s = r.onClickValue, y = r.overflow, b = y === void 0 ? "scroll" : y, m = r.expandChildrenOnShiftKey, h = m === void 0 ? false : m, g = ke(r, [ "elementRef", "expandChildren", "indent", "json", "onClickKey", "onClickValue", "overflow", "expandChildrenOnShiftKey" ]);
|
|
1470
1476
|
// @docs-props-type JSONTreePropsBase
|
|
1471
|
-
var
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
var
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
+
var S = (0, e.useMemo)((function() {
|
|
1478
|
+
return g.id || (0, u.createDOMID)("json-tree");
|
|
1479
|
+
}), [ g.id ]);
|
|
1480
|
+
var k = l()(f) ? JSON.parse(f) : f;
|
|
1481
|
+
var O = b === "wrap" ? p : v;
|
|
1482
|
+
var w = (0, e.useState)(undefined), I = ye(w, 2), x = I[0], C = I[1];
|
|
1483
|
+
var j = (0, e.useCallback)((function(e) {
|
|
1484
|
+
C(e);
|
|
1485
|
+
}), []);
|
|
1486
|
+
var E = (0, e.useMemo)((function() {
|
|
1487
|
+
return ve({
|
|
1488
|
+
baseId: S,
|
|
1489
|
+
defaultOpen: true,
|
|
1490
|
+
expandChildren: a,
|
|
1491
|
+
expandChildrenOnShiftKey: h,
|
|
1492
|
+
indent: c,
|
|
1493
|
+
obj: k,
|
|
1494
|
+
onClickKey: d,
|
|
1495
|
+
onClickValue: s,
|
|
1496
|
+
overflow: b,
|
|
1497
|
+
shift: x,
|
|
1498
|
+
updateShift: j
|
|
1499
|
+
});
|
|
1500
|
+
}), [ S, a, h, c, k, d, s, b, x, j ]);
|
|
1477
1501
|
|
|
1478
|
-
return n().createElement(
|
|
1502
|
+
return n().createElement(O, pe({
|
|
1479
1503
|
"data-language": "language-json",
|
|
1480
1504
|
"data-test": "json-tree",
|
|
1481
1505
|
ref: t,
|
|
1482
1506
|
role: "tree"
|
|
1483
|
-
},
|
|
1507
|
+
}, g), n().createElement(A["default"], {
|
|
1484
1508
|
defaultIndent: false
|
|
1485
|
-
},
|
|
1486
|
-
defaultOpen: true,
|
|
1487
|
-
expandChildren: a,
|
|
1488
|
-
expandChildrenOnShiftKey: b,
|
|
1489
|
-
indent: u,
|
|
1490
|
-
obj: g,
|
|
1491
|
-
onClickKey: f,
|
|
1492
|
-
onClickValue: d,
|
|
1493
|
-
overflow: y,
|
|
1494
|
-
shift: w,
|
|
1495
|
-
updateShift: x
|
|
1496
|
-
})));
|
|
1509
|
+
}, E));
|
|
1497
1510
|
}
|
|
1498
|
-
|
|
1499
|
-
/* harmony default export */ const
|
|
1511
|
+
Ie.propTypes = we;
|
|
1512
|
+
/* harmony default export */ const xe = Ie;
|
|
1500
1513
|
}) // CONCATENATED MODULE: ./src/JSONTree/index.ts
|
|
1501
1514
|
();
|
|
1502
1515
|
module.exports = t;
|
package/package.json
CHANGED
|
@@ -20,6 +20,7 @@ interface JSONTreeItemPropsBase extends TreeItemPropsBase {
|
|
|
20
20
|
indentArray?: string[];
|
|
21
21
|
index: number;
|
|
22
22
|
initialOpenState: boolean;
|
|
23
|
+
isRoot?: boolean;
|
|
23
24
|
properties?: string[];
|
|
24
25
|
propertyDataPath: string;
|
|
25
26
|
propertyElement?: JSX.Element | undefined;
|
|
@@ -28,7 +29,7 @@ interface JSONTreeItemPropsBase extends TreeItemPropsBase {
|
|
|
28
29
|
value?: JSONElement;
|
|
29
30
|
}
|
|
30
31
|
type JSONTreeItemProps = ComponentProps<JSONTreeItemPropsBase, 'li'>;
|
|
31
|
-
export declare function JSONTreeItem({ clickableKeyRef, clickableValRef, hasChildren, indentArray, index, initialOpenState, onFocus, properties, propertyDataPath, propertyElement, renderExpandLink, representation, value, ...otherProps }: JSONTreeItemProps): JSX.Element;
|
|
32
|
+
export declare function JSONTreeItem({ clickableKeyRef, clickableValRef, hasChildren, indentArray, index, initialOpenState, isRoot, onFocus, properties, propertyDataPath, propertyElement, renderExpandLink, representation, value, ...otherProps }: JSONTreeItemProps): JSX.Element;
|
|
32
33
|
export declare namespace JSONTreeItem {
|
|
33
34
|
var propTypes: {
|
|
34
35
|
clickableKeyRef: PropTypes.Requireable<object>;
|
|
@@ -37,6 +38,7 @@ export declare namespace JSONTreeItem {
|
|
|
37
38
|
indentArray: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
38
39
|
index: PropTypes.Requireable<number>;
|
|
39
40
|
initialOpenState: PropTypes.Requireable<boolean>;
|
|
41
|
+
isRoot: PropTypes.Requireable<boolean>;
|
|
40
42
|
properties: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
41
43
|
propertyDataPath: PropTypes.Requireable<string>;
|
|
42
44
|
propertyElement: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JSONElement, JSONTreeClickKeyHandler, JSONTreeClickValueHandler } from './JSONTree';
|
|
2
2
|
type RenderTreeItemsProps = {
|
|
3
|
+
baseId: string;
|
|
3
4
|
defaultOpen?: boolean;
|
|
4
5
|
expandChildren?: boolean | 'withShiftModifier';
|
|
5
6
|
expandChildrenOnShiftKey?: boolean;
|
|
@@ -13,5 +14,5 @@ type RenderTreeItemsProps = {
|
|
|
13
14
|
shift?: boolean;
|
|
14
15
|
updateShift: ((newShift: boolean) => void) | undefined;
|
|
15
16
|
};
|
|
16
|
-
export declare function renderTreeItems({ defaultOpen, expandChildren, expandChildrenOnShiftKey, indent, indentLevel, obj, onClickKey, onClickValue, overflow, path, shift, updateShift, }: RenderTreeItemsProps): JSX.Element | JSX.Element[];
|
|
17
|
+
export declare function renderTreeItems({ baseId, defaultOpen, expandChildren, expandChildrenOnShiftKey, indent, indentLevel, obj, onClickKey, onClickValue, overflow, path, shift, updateShift, }: RenderTreeItemsProps): JSX.Element | JSX.Element[];
|
|
17
18
|
export {};
|