@uiw/react-json-view 2.0.0-alpha.32 → 2.0.0-alpha.33

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 CHANGED
@@ -735,7 +735,7 @@ export default function Demo() {
735
735
  collapsed={2}
736
736
  shouldExpandNodeInitially={(isExpanded, { value, keys, level }) => {
737
737
  if (keys.length > 0 && keys[0] == "object") {
738
- return true
738
+ return false
739
739
  }
740
740
  return isExpanded
741
741
  }}
@@ -40,11 +40,12 @@ var KeyValues = exports.KeyValues = function KeyValues(props) {
40
40
  var isMyArray = Array.isArray(value);
41
41
  var defaultExpanded = typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level > collapsed : false;
42
42
  var isExpanded = (_expands$expandKey = expands[expandKey]) !== null && _expands$expandKey !== void 0 ? _expands$expandKey : defaultExpanded;
43
- if (expands[expandKey] === undefined && shouldExpandNodeInitially && shouldExpandNodeInitially(isExpanded, {
43
+ var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(!isExpanded, {
44
44
  value: value,
45
45
  keys: keys,
46
46
  level: level
47
- })) {
47
+ });
48
+ if (expands[expandKey] === undefined && shouldExpandNodeInitially && !shouldExpand) {
48
49
  return null;
49
50
  }
50
51
  if (isExpanded) {
@@ -24,11 +24,12 @@ var NestedClose = exports.NestedClose = function NestedClose(props) {
24
24
  var defaultExpanded = typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level > collapsed : false;
25
25
  var isExpanded = (_expands$expandKey = expands[expandKey]) !== null && _expands$expandKey !== void 0 ? _expands$expandKey : defaultExpanded;
26
26
  var len = Object.keys(value).length;
27
- if (expands[expandKey] === undefined && shouldExpandNodeInitially && shouldExpandNodeInitially(isExpanded, {
27
+ var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(!isExpanded, {
28
28
  value: value,
29
29
  keys: keys,
30
30
  level: level
31
- })) {
31
+ });
32
+ if (expands[expandKey] === undefined && shouldExpandNodeInitially && !shouldExpand) {
32
33
  return null;
33
34
  }
34
35
  if (isExpanded || len === 0) {
@@ -39,13 +39,13 @@ var NestedOpen = exports.NestedOpen = function NestedOpen(props) {
39
39
  var defaultExpanded = typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level > collapsed : false;
40
40
  var isObject = (0, _typeof2["default"])(value) === 'object';
41
41
  var isExpanded = (_expands$expandKey = expands[expandKey]) !== null && _expands$expandKey !== void 0 ? _expands$expandKey : defaultExpanded;
42
- var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(isExpanded, {
42
+ var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(!isExpanded, {
43
43
  value: value,
44
44
  keys: keys,
45
45
  level: level
46
46
  });
47
- if (expands[expandKey] === undefined && shouldExpand !== undefined) {
48
- isExpanded = shouldExpand;
47
+ if (expands[expandKey] === undefined && shouldExpandNodeInitially && !shouldExpand) {
48
+ isExpanded = !shouldExpand;
49
49
  }
50
50
  var click = function click() {
51
51
  var opt = {
@@ -30,11 +30,12 @@ export var KeyValues = props => {
30
30
  var isMyArray = Array.isArray(value);
31
31
  var defaultExpanded = typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level > collapsed : false;
32
32
  var isExpanded = (_expands$expandKey = expands[expandKey]) != null ? _expands$expandKey : defaultExpanded;
33
- if (expands[expandKey] === undefined && shouldExpandNodeInitially && shouldExpandNodeInitially(isExpanded, {
33
+ var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(!isExpanded, {
34
34
  value,
35
35
  keys,
36
36
  level
37
- })) {
37
+ });
38
+ if (expands[expandKey] === undefined && shouldExpandNodeInitially && !shouldExpand) {
38
39
  return null;
39
40
  }
40
41
  if (isExpanded) {
@@ -20,11 +20,12 @@ export var NestedClose = props => {
20
20
  var defaultExpanded = typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level > collapsed : false;
21
21
  var isExpanded = (_expands$expandKey = expands[expandKey]) != null ? _expands$expandKey : defaultExpanded;
22
22
  var len = Object.keys(value).length;
23
- if (expands[expandKey] === undefined && shouldExpandNodeInitially && shouldExpandNodeInitially(isExpanded, {
23
+ var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(!isExpanded, {
24
24
  value,
25
25
  keys,
26
26
  level
27
- })) {
27
+ });
28
+ if (expands[expandKey] === undefined && shouldExpandNodeInitially && !shouldExpand) {
28
29
  return null;
29
30
  }
30
31
  if (isExpanded || len === 0) {
@@ -32,13 +32,13 @@ export var NestedOpen = props => {
32
32
  var defaultExpanded = typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level > collapsed : false;
33
33
  var isObject = typeof value === 'object';
34
34
  var isExpanded = (_expands$expandKey = expands[expandKey]) != null ? _expands$expandKey : defaultExpanded;
35
- var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(isExpanded, {
35
+ var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(!isExpanded, {
36
36
  value,
37
37
  keys,
38
38
  level
39
39
  });
40
- if (expands[expandKey] === undefined && shouldExpand !== undefined) {
41
- isExpanded = shouldExpand;
40
+ if (expands[expandKey] === undefined && shouldExpandNodeInitially && !shouldExpand) {
41
+ isExpanded = !shouldExpand;
42
42
  }
43
43
  var click = () => {
44
44
  var opt = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uiw/react-json-view",
3
- "version": "2.0.0-alpha.32",
3
+ "version": "2.0.0-alpha.33",
4
4
  "description": "JSON viewer for react.",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",