Skip to content

Commit ac7208d

Browse files
Merge pull request #53 from williamtroup/4.7.1
4.7.1
2 parents 5b12227 + 1c8b3ba commit ac7208d

File tree

88 files changed

+622
-452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+622
-452
lines changed

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 William Troup
3+
Copyright (c) 2025 William Troup
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
JsonTree.js
33

44
[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=JsonTree.js%2C%20a%20free%20JavaScript%json%20treeview&url=https://github.com/williamtroup/JsonTree.js&hashtags=javascript,treeview,json)
5-
[![npm](https://img.shields.io/badge/npmjs-v4.7.0-blue)](https://www.npmjs.com/package/jjsontree.js)
6-
[![nuget](https://img.shields.io/badge/nuget-v4.7.0-purple)](https://www.nuget.org/packages/jJsonTree.js/)
5+
[![npm](https://img.shields.io/badge/npmjs-v4.7.1-blue)](https://www.npmjs.com/package/jjsontree.js)
6+
[![nuget](https://img.shields.io/badge/nuget-v4.7.1-purple)](https://www.nuget.org/packages/jJsonTree.js/)
77
[![license](https://img.shields.io/badge/license-MIT-green)](https://github.com/williamtroup/JsonTree.js/blob/main/LICENSE.txt)
88
[![discussions Welcome](https://img.shields.io/badge/discussions-Welcome-red)](https://github.com/williamtroup/JsonTree.js/discussions)
99
[![coded by William Troup](https://img.shields.io/badge/coded_by-William_Troup-yellow)](https://william-troup.com/)
1010
</h1>
1111

1212
> <p align="center">🔗 A lightweight JavaScript library that generates customizable tree views to better visualize, and edit, JSON data.</p>
13-
> <p align="center">v4.7.0</p>
13+
> <p align="center">v4.7.1</p>
1414
<br />
1515
1616
![JsonTree.js](docs/images/main.png)
@@ -174,8 +174,8 @@ Or, you can download the latest zipped up version [here](https://www.william-tro
174174
Or, you can also use the following CDN links:
175175

176176
```markdown
177-
https://cdn.jsdelivr.net/gh/williamtroup/[email protected].0/dist/jsontree.min.js
178-
https://cdn.jsdelivr.net/gh/williamtroup/[email protected].0/dist/jsontree.js.min.css
177+
https://cdn.jsdelivr.net/gh/williamtroup/[email protected].1/dist/jsontree.min.js
178+
https://cdn.jsdelivr.net/gh/williamtroup/[email protected].1/dist/jsontree.js.min.css
179179
```
180180
<br>
181181
<br>

README_NUGET.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# JsonTree.js v4.7.0
1+
# JsonTree.js v4.7.1
22

33
[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=JsonTree.js%2C%20a%20free%20JavaScript%json%20treeview&url=https://github.com/williamtroup/JsonTree.js&hashtags=javascript,treeview,json)
4-
[![npm](https://img.shields.io/badge/npmjs-v4.7.0-blue)](https://www.npmjs.com/package/jjsontree.js)
5-
[![nuget](https://img.shields.io/badge/nuget-v4.7.0-purple)](https://www.nuget.org/packages/jJsonTree.js/)
4+
[![npm](https://img.shields.io/badge/npmjs-v4.7.1-blue)](https://www.npmjs.com/package/jjsontree.js)
5+
[![nuget](https://img.shields.io/badge/nuget-v4.7.1-purple)](https://www.nuget.org/packages/jJsonTree.js/)
66
[![license](https://img.shields.io/badge/license-MIT-green)](https://github.com/williamtroup/JsonTree.js/blob/main/LICENSE.txt)
77
[![discussions Welcome](https://img.shields.io/badge/discussions-Welcome-red)](https://github.com/williamtroup/JsonTree.js/discussions)
88
[![coded by William Troup](https://img.shields.io/badge/coded_by-William_Troup-yellow)](https://william-troup.com/)
@@ -153,8 +153,8 @@ Or, you can download the latest zipped up version [here](https://www.william-tro
153153
Or, you can also use the following CDN links:
154154

155155
```markdown
156-
https://cdn.jsdelivr.net/gh/williamtroup/[email protected].0/dist/jsontree.min.js
157-
https://cdn.jsdelivr.net/gh/williamtroup/[email protected].0/dist/jsontree.js.min.css
156+
https://cdn.jsdelivr.net/gh/williamtroup/[email protected].1/dist/jsontree.min.js
157+
https://cdn.jsdelivr.net/gh/williamtroup/[email protected].1/dist/jsontree.js.min.css
158158
```
159159

160160

dist/jsontree.esm.js

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,8 @@ var Binding;
848848
t.emptyStringValue = Default.getString(t.emptyStringValue, "");
849849
t.expandIconType = Default.getString(t.expandIconType, "arrow");
850850
t.openUrlsInSameWindow = Default.getBoolean(t.openUrlsInSameWindow, false);
851+
t.wrapTextInValues = Default.getBoolean(t.wrapTextInValues, false);
852+
t.hideRootObjectNames = Default.getBoolean(t.hideRootObjectNames, false);
851853
t.maximum = l(t);
852854
t.paging = r(t);
853855
t.title = i(t);
@@ -1578,7 +1580,7 @@ var Filename;
15781580
DomElement.createWithHTML(t, "span", "no-json-text", e.text.noJsonToViewText);
15791581
if (o.sideMenu.showImportButton) {
15801582
const n = DomElement.createWithHTML(t, "span", "no-json-import-text", `${e.text.importButtonText}${" "}${e.text.ellipsisText}`);
1581-
n.onclick = () => P(o);
1583+
n.onclick = () => j(o);
15821584
}
15831585
} else {
15841586
if (o.paging.enabled && Is.definedNumber(l)) {
@@ -1784,7 +1786,11 @@ var Filename;
17841786
const r = n.column.querySelectorAll(".object-type-title, .object-type-value-title, .object-type-end");
17851787
const i = r.length;
17861788
n.lineNumbers.innerHTML = "";
1787-
for (let s = 0; s < i; s++) {
1789+
let s = 0;
1790+
if (t.hideRootObjectNames) {
1791+
s++;
1792+
}
1793+
for (;s < i; s++) {
17881794
const a = r[s];
17891795
if (a.offsetHeight > 0) {
17901796
let r = DomElement.getOffset(a).top;
@@ -1867,7 +1873,7 @@ var Filename;
18671873
}
18681874
if (s && t.allowEditing.bulk && t.controlPanel.showImportButton) {
18691875
const n = DomElement.createWithHTML(i, "button", "control-button import", e.text.importButtonSymbolText);
1870-
n.onclick = () => P(t, l + 1);
1876+
n.onclick = () => j(t, l + 1);
18711877
ToolTip.add(n, t, e.text.importButtonText);
18721878
}
18731879
if (t.allowEditing.bulk && t.controlPanel.showRemoveButton) {
@@ -1985,7 +1991,7 @@ var Filename;
19851991
}
19861992
if (t.sideMenu.enabled) {
19871993
const n = DomElement.createWithHTML(o, "button", "side-menu jsontree-js-scroll-bars", e.text.sideMenuButtonSymbolText);
1988-
n.onclick = () => j(t);
1994+
n.onclick = () => P(t);
19891995
n.ondblclick = DomElement.cancelBubble;
19901996
ToolTip.add(n, t, e.text.sideMenuButtonText);
19911997
}
@@ -2114,7 +2120,7 @@ var Filename;
21142120
}
21152121
if (t.sideMenu.showImportButton) {
21162122
const n = DomElement.createWithHTML(o, "button", "import", e.text.importButtonSymbolText);
2117-
n.onclick = () => P(t);
2123+
n.onclick = () => j(t);
21182124
ToolTip.add(n, t, e.text.importButtonText);
21192125
}
21202126
const l = DomElement.createWithHTML(o, "button", "close", e.text.closeButtonSymbolText);
@@ -2126,7 +2132,7 @@ var Filename;
21262132
}
21272133
}
21282134
}
2129-
function P(e, t = null) {
2135+
function j(e, t = null) {
21302136
const n = DomElement.createWithNoContainer("input");
21312137
n.type = "file";
21322138
n.accept = ".json, .csv, .html, .htm";
@@ -2135,7 +2141,7 @@ var Filename;
21352141
n.onchange = () => he(n.files, e, t);
21362142
n.click();
21372143
}
2138-
function j(e) {
2144+
function P(e) {
21392145
if (!e._currentView.sideMenu.classList.contains("side-menu-open")) {
21402146
e._currentView.sideMenu.classList.add("side-menu-open");
21412147
e._currentView.disabledBackground.style.display = "block";
@@ -2352,7 +2358,7 @@ var Filename;
23522358
const m = DomElement.createWithHTML(c, "span", n.showValueColors ? `${r} main-title` : "main-title", u);
23532359
let p = null;
23542360
let x = null;
2355-
te(d, n);
2361+
te(d, n, n.hideRootObjectNames);
23562362
if (n.paging.enabled && Is.definedNumber(l)) {
23572363
let t = n.useZeroIndexingForArrays ? l.toString() : (l + 1).toString();
23582364
if (n.showArrayIndexBrackets) {
@@ -2375,6 +2381,10 @@ var Filename;
23752381
if (n.showClosedObjectCurlyBraces) {
23762382
x = DomElement.createWithHTML(c, "span", "closed-symbols", "{ ... }");
23772383
}
2384+
if (n.hideRootObjectNames) {
2385+
c.style.display = "none";
2386+
d.classList.add("root-item");
2387+
}
23782388
K(f, null, d, n, i, s, p, x, false, true, "", r, r !== "object", 1);
23792389
ie(n, m, i, r, false);
23802390
q(n, i, m);
@@ -2410,7 +2420,7 @@ var Filename;
24102420
const c = DomElement.createWithHTML(s, "span", n.showValueColors ? `${l} main-title` : "main-title", i);
24112421
let d = null;
24122422
let f = null;
2413-
te(a, n);
2423+
te(a, n, n.hideRootObjectNames);
24142424
if (n.showObjectSizes) {
24152425
DomElement.createWithHTML(s, "span", n.showValueColors ? `${l} size` : "size", `[${o.length}]`);
24162426
}
@@ -2420,6 +2430,10 @@ var Filename;
24202430
if (n.showClosedArraySquaredBrackets) {
24212431
f = DomElement.createWithHTML(s, "span", "closed-symbols", "[ ... ]");
24222432
}
2433+
if (n.hideRootObjectNames) {
2434+
s.style.display = "none";
2435+
a.classList.add("root-item");
2436+
}
24232437
X(u, null, a, n, o, d, f, false, true, "", l, l !== "array", 1);
24242438
ie(n, c, o, l, false);
24252439
q(n, o, c);
@@ -2453,7 +2467,9 @@ var Filename;
24532467
}
24542468
}
24552469
}
2456-
se(l, t, n, o, s, a, T, f);
2470+
if (!l.hideRootObjectNames || m > 1) {
2471+
se(l, t, n, o, s, a, T, f);
2472+
}
24572473
return p;
24582474
}
24592475
function X(t, n, o, l, r, i, s, a, u, c, d, f, g) {
@@ -2486,11 +2502,13 @@ var Filename;
24862502
}
24872503
}
24882504
}
2489-
se(l, t, n, o, i, s, x, d);
2505+
if (!l.hideRootObjectNames || g > 1) {
2506+
se(l, t, n, o, i, s, x, d);
2507+
}
24902508
return m;
24912509
}
24922510
function G(t, n, o, l, r, i, s, a, u, c, d) {
2493-
const f = DomElement.create(n, "div", "object-type-value");
2511+
const f = DomElement.create(n, "div", !o.wrapTextInValues ? "object-type-value" : "object-type-value-wrapped");
24942512
const g = DomElement.create(f, "div", "object-type-value-title");
24952513
const m = o.showExpandIcons ? DomElement.create(g, "div", `no-${o.expandIconType}`) : null;
24962514
let p = null;
@@ -2505,6 +2523,9 @@ var Filename;
25052523
let V = true;
25062524
let v = null;
25072525
const B = o._currentView.currentColumnBuildingIndex;
2526+
if (o.hideRootObjectNames && d === 1) {
2527+
f.classList.add("object-type-value-no-padding");
2528+
}
25082529
if (!S) {
25092530
let t = Str.getMaximumLengthDisplay(l, o.maximum.propertyNameLength, e.text.ellipsisText);
25102531
if (s || !o.showPropertyNameQuotes) {
@@ -3022,8 +3043,8 @@ var Filename;
30223043
}
30233044
e._currentView.dataTypeCounts[t]++;
30243045
}
3025-
function te(e, t) {
3026-
if (t.showOpenedObjectArrayBorders) {
3046+
function te(e, t, n = false) {
3047+
if (!n && t.showOpenedObjectArrayBorders) {
30273048
e.classList.add("object-border");
30283049
if (!t.showExpandIcons) {
30293050
e.classList.add("object-border-no-toggles");
@@ -3833,7 +3854,7 @@ var Filename;
38333854
return e;
38343855
},
38353856
getVersion: function() {
3836-
return "4.7.0";
3857+
return "4.7.1";
38373858
}
38383859
};
38393860
(() => {

dist/jsontree.esm.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)