Skip to content

Commit

Permalink
Change default rendering of arrays in a table cell to display number …
Browse files Browse the repository at this point in the history
…of array elements
  • Loading branch information
lahmatiy committed Oct 17, 2023
1 parent 001f69c commit c16c1ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Uniformed font and size for monospace views
- Enlarged action buttons in `struct` and `structure` views
- Changed rendering of after-annotations to render in a prelude when a value is expanded
- Changed default rendering of arrays in a table cell to display number of array elements instead of `[…]`
- Fixed editor to not render text until gets focus
- Fixed suggestion popup positioning in query editor in some cases
- Modified `Widget` to utilize deep comparison for page params, ensuring more accurate detection of changes
Expand Down
6 changes: 3 additions & 3 deletions src/views/table/table-cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const hasOwnProperty = Object.hasOwnProperty;

function defaultCellRender(el, data, isDataObject) {
if (Array.isArray(data)) {
el.classList.add('complex');
el.textContent = data.length ? '[…]' : '[]';
el.classList.add('number');
el.textContent = data.length || '';
return;
}

Expand Down Expand Up @@ -52,7 +52,7 @@ export default function(host) {
let { content, details, colSpan, scalarAsStruct } = config;
const isDataObject =
data !== null &&
typeof data === 'object' &&
(Array.isArray(data) ? data.length > 0 : typeof data === 'object') &&
data instanceof RegExp === false;

if (typeof colSpan === 'number' && colSpan > 1) {
Expand Down

0 comments on commit c16c1ba

Please sign in to comment.