mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 09:03:58 +00:00
json view in perspective improvement
This commit is contained in:
@@ -15,8 +15,9 @@
|
|||||||
const context = getContext('json-tree-context-key');
|
const context = getContext('json-tree-context-key');
|
||||||
setContext('json-tree-context-key', { ...context, colon })
|
setContext('json-tree-context-key', { ...context, colon })
|
||||||
const elementData=getContext('json-tree-element-data');
|
const elementData=getContext('json-tree-element-data');
|
||||||
|
const slicedKeyCount = getContext('json-tree-sliced-key-count');
|
||||||
|
|
||||||
$: slicedKeys = expanded ? keys: previewKeys.slice(0, 5);
|
$: slicedKeys = expanded ? keys: previewKeys.slice(0, slicedKeyCount || 5);
|
||||||
|
|
||||||
$: if (!isParentExpanded) {
|
$: if (!isParentExpanded) {
|
||||||
expanded = false;
|
expanded = false;
|
||||||
|
|||||||
@@ -14,12 +14,15 @@
|
|||||||
export let expandAll = false;
|
export let expandAll = false;
|
||||||
export let expanded = expandAll;
|
export let expanded = expandAll;
|
||||||
export let labelOverride = null;
|
export let labelOverride = null;
|
||||||
|
export let slicedKeyCount = null;
|
||||||
|
export let disableContextMenu = null;
|
||||||
|
|
||||||
export let isDeleted = false;
|
export let isDeleted = false;
|
||||||
export let isInserted = false;
|
export let isInserted = false;
|
||||||
export let isModified = false;
|
export let isModified = false;
|
||||||
|
|
||||||
setContext('json-tree-default-expanded', expandAll);
|
setContext('json-tree-default-expanded', expandAll);
|
||||||
|
if (slicedKeyCount) setContext('json-tree-sliced-key-count', slicedKeyCount);
|
||||||
|
|
||||||
const elementData = new WeakMap();
|
const elementData = new WeakMap();
|
||||||
|
|
||||||
@@ -69,7 +72,12 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul use:contextMenu={[parentMenu, menu, getElementMenu]} class:isDeleted class:isInserted class:isModified>
|
<ul
|
||||||
|
use:contextMenu={disableContextMenu ? '__no_menu' : [parentMenu, menu, getElementMenu]}
|
||||||
|
class:isDeleted
|
||||||
|
class:isInserted
|
||||||
|
class:isModified
|
||||||
|
>
|
||||||
<JSONNode {key} {value} isParentExpanded={true} isParentArray={false} {expanded} {labelOverride} />
|
<JSONNode {key} {value} isParentExpanded={true} isParentArray={false} {expanded} {labelOverride} />
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@@ -101,7 +109,8 @@
|
|||||||
--li-line-height: var(--json-tree-li-line-height, 1.3);
|
--li-line-height: var(--json-tree-li-line-height, 1.3);
|
||||||
--li-colon-space: 0.3em;
|
--li-colon-space: 0.3em;
|
||||||
font-size: var(--json-tree-font-size, 12px);
|
font-size: var(--json-tree-font-size, 12px);
|
||||||
font-family: var(--json-tree-font-family, 'Courier New', Courier, monospace);
|
/* font-family: var(--json-tree-font-family, 'Courier New', Courier, monospace); */
|
||||||
|
font-family: var(--json-tree-font-family, monospace);
|
||||||
}
|
}
|
||||||
ul :global(li) {
|
ul :global(li) {
|
||||||
line-height: var(--li-line-height);
|
line-height: var(--li-line-height);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<td rowspan={rowSpan} data-column={columnIndex}>
|
<td rowspan={rowSpan} data-column={columnIndex}>
|
||||||
{#if value !== undefined}
|
{#if value !== undefined}
|
||||||
{#if displayType == 'json'}
|
{#if displayType == 'json'}
|
||||||
<JSONTree value={safeJsonParse(value)} />
|
<JSONTree value={safeJsonParse(value)} slicedKeyCount={1} disableContextMenu />
|
||||||
{:else}
|
{:else}
|
||||||
<CellValue {rowData} {value} />
|
<CellValue {rowData} {value} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user