Skip to content

Commit 542f41f

Browse files
committed
Improve visualization of nested fields
1 parent c20bd99 commit 542f41f

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

etc/js/components/widgets/inspector/entity-inspector-kv.vue

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<template>
2-
<div class="key noselect" @click.stop="toggle">
2+
<div class="chevron noselect" @click.stop="toggle">
33
<template v-if="typeof value === 'object' && value !== null">
44
<expand-button
55
:expand="expand">
66
</expand-button>
77
</template>
8+
</div>
9+
<div class="key noselect" @click.stop="toggle">
810
{{ keyname }}
911
</div>
1012
<div class="value noselect" @click.stop="toggle">
@@ -16,15 +18,6 @@
1618
:readonly="readonly"
1719
@setValue="(evt) => setValue(evt, keyname)">
1820
</entity-inspector-preview>
19-
<template v-if="expand">
20-
<entity-inspector-value
21-
:path="path"
22-
:value="value"
23-
:type="type"
24-
:readonly="readonly"
25-
@setValue="(evt) => setValue(evt, keyname)">
26-
</entity-inspector-value>
27-
</template>
2821
</template>
2922
<template v-else>
3023
<entity-inspector-field
@@ -35,6 +28,17 @@
3528
</entity-inspector-field>
3629
</template>
3730
</div>
31+
<template v-if="typeof value === 'object' && expand">
32+
<div class="nested-value">
33+
<entity-inspector-value
34+
:path="path"
35+
:value="value"
36+
:type="type"
37+
:readonly="readonly"
38+
@setValue="(evt) => setValue(evt, keyname)">
39+
</entity-inspector-value>
40+
</div>
41+
</template>
3842
</template>
3943

4044
<script>
@@ -76,8 +80,15 @@ onMounted(() => {
7680

7781
<style scoped>
7882
79-
div.key {
83+
div.chevron {
8084
grid-column: 1;
85+
width: 16px;
86+
padding-top: 4px;
87+
cursor: pointer;
88+
}
89+
90+
div.key {
91+
grid-column: 2;
8192
text-align: right;
8293
padding: 4px;
8394
padding-bottom: 0px;
@@ -88,8 +99,15 @@ div.key {
8899
}
89100
90101
div.value {
91-
grid-column: 2;
102+
grid-column: 3;
92103
cursor: pointer;
93104
}
94105
106+
div.nested-value {
107+
grid-column: 1 / -1;
108+
padding-left: 5px;
109+
margin-left: 7px; /* Align with chevron */
110+
border-left: 1px solid var(--steel-650);
111+
}
112+
95113
</style>

etc/js/components/widgets/inspector/entity-inspector-value.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function isObject(type, value) {
7575
7676
div.prop-grid {
7777
display: grid;
78-
grid-template-columns: auto 1fr;
78+
grid-template-columns: 16px auto 1fr;
7979
}
8080
8181
div.array-list {

0 commit comments

Comments
 (0)