mirror of
https://github.com/dbgate/dbgate
synced 2024-11-08 04:35:58 +00:00
35 lines
587 B
Svelte
35 lines
587 B
Svelte
<script>
|
|
import JSONNested from './JSONNested.svelte';
|
|
|
|
export let key, value, isParentExpanded, isParentArray, nodeType;
|
|
|
|
let keys = [];
|
|
|
|
$: {
|
|
let result = [];
|
|
let i = 0;
|
|
for(const entry of value) {
|
|
result.push([i++, entry]);
|
|
}
|
|
keys = result;
|
|
}
|
|
|
|
function getKey(key) {
|
|
return String(key[0]);
|
|
}
|
|
function getValue(key) {
|
|
return key[1];
|
|
}
|
|
</script>
|
|
<JSONNested
|
|
{key}
|
|
{isParentExpanded}
|
|
{isParentArray}
|
|
{keys}
|
|
{getKey}
|
|
{getValue}
|
|
isArray={true}
|
|
label="{nodeType}({keys.length})"
|
|
bracketOpen={'{'}
|
|
bracketClose={'}'}
|
|
/> |