-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement query editor entity inspector
- Loading branch information
1 parent
3573673
commit 1bd6f0f
Showing
19 changed files
with
702 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
etc/v4/query_editor/js/components/pages/entities/entity-inspector-component.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<template> | ||
<div class="component"> | ||
<div class="component-header noselect" @click="toggle"> | ||
<template v-if="value"> | ||
<div class="chevron-icon"> | ||
<icon src="chevron-right" | ||
:opacity="0.5" | ||
:size="16" | ||
:rotate="chevronRotation"> | ||
</icon> | ||
</div> | ||
</template> | ||
<div class="component-icon"> | ||
<icon :src="icon_src" :size="16" :opacity="0.5"></icon> | ||
</div> | ||
<div class="component-name"> | ||
{{ name }} | ||
<template v-if="singleTarget"> | ||
<icon src="arrow-right" | ||
:opacity="0.5" | ||
:size="16"> | ||
</icon> {{ shortenEntity(targets) }} | ||
</template> | ||
</div> | ||
</div> | ||
<template v-if="expand && value"> | ||
<div class="component-value"> | ||
<entity-inspector-value | ||
:value="value" | ||
:type="type"> | ||
</entity-inspector-value> | ||
</div> | ||
</template> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { name: "entity-inspector-component" } | ||
</script> | ||
|
||
<script setup> | ||
import { defineProps, ref, computed } from 'vue'; | ||
const props = defineProps({ | ||
name: {type: String, required: true}, | ||
icon_src: {type: String, required: true}, | ||
value: {type: Object, required: false}, | ||
type: {type: Object, required: false}, | ||
targets: {required: false}, | ||
}); | ||
const expand = ref(true); | ||
const chevronRotation = computed(() => { | ||
if (expand.value) { | ||
return 90; | ||
} else { | ||
return 0; | ||
} | ||
}) | ||
function toggle() { | ||
expand.value = !expand.value; | ||
} | ||
const singleTarget = computed(() => { | ||
return props.targets && !Array.isArray(props.targets); | ||
}) | ||
function shortenEntity(entity) { | ||
return entity.split(".").pop(); | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
div.component { | ||
margin-bottom: 8px; | ||
} | ||
div.component-header { | ||
display: grid; | ||
grid-template-columns: 20px 20px 1fr; | ||
padding: 4px; | ||
padding-left: 8px; | ||
cursor: pointer; | ||
border-radius: var(--border-radius-medium); | ||
background-color: rgba(0,0,0,0); | ||
color: var(--primary-text); | ||
transition: background-color 0.1s ease-out; | ||
} | ||
div.component-header:hover { | ||
background-color: var(--bg-content-hover); | ||
} | ||
div.chevron-icon { | ||
grid-column: 1; | ||
} | ||
div.component-icon { | ||
grid-column: 2; | ||
} | ||
div.component-name { | ||
grid-column: 3; | ||
padding-left: 2px; | ||
} | ||
div.component-value { | ||
padding-left: 52px; | ||
} | ||
</style> |
57 changes: 57 additions & 0 deletions
57
etc/v4/query_editor/js/components/pages/entities/entity-inspector-field.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<template> | ||
<div :class="css"> | ||
{{ value }} | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { name: "entity-inspector-field" } | ||
</script> | ||
|
||
<script setup> | ||
import { defineProps, ref, computed } from 'vue'; | ||
const props = defineProps({ | ||
value: {required: true}, | ||
type: {type: Object, required: true} | ||
}); | ||
const css = computed(() => { | ||
let classes = ["value"]; | ||
classes.push(`value-${props.type[0]}`); | ||
return classes; | ||
}); | ||
</script> | ||
|
||
<style scoped> | ||
div.value { | ||
padding: 4px; | ||
padding-left: 8px; | ||
background-color: var(--bg-content); | ||
border-radius: var(--border-radius-medium); | ||
color: var(--secondary-text); | ||
} | ||
div.value-bool { | ||
color: #4981B5; | ||
} | ||
div.value-int { | ||
color: var(--light-green); | ||
} | ||
div.value-float { | ||
color: var(--light-green); | ||
} | ||
div.value-text { | ||
color: #B5894B; | ||
} | ||
div.value-enum, div.value-bitmask { | ||
color: #7D67B5; | ||
} | ||
</style> |
49 changes: 49 additions & 0 deletions
49
etc/v4/query_editor/js/components/pages/entities/entity-inspector-kv.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template> | ||
<div class="key"> | ||
{{ keyname }} | ||
</div> | ||
<div class="value"> | ||
<entity-inspector-field | ||
:value="value" | ||
:type="type"> | ||
</entity-inspector-field> | ||
</div> | ||
<div class="edit"> | ||
<icon src="edit" :opacity="0.7"></icon> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { name: "entity-inspector-kv" } | ||
</script> | ||
|
||
<script setup> | ||
import { defineProps, ref, computed } from 'vue'; | ||
const props = defineProps({ | ||
keyname: {type: String, required: true}, | ||
value: {required: true}, | ||
type: {type: Object, required: true} | ||
}); | ||
</script> | ||
|
||
<style scoped> | ||
div.key { | ||
grid-column: 1; | ||
color: var(--secondary-text); | ||
text-align: right; | ||
padding: 4px; | ||
padding-right: 8px; | ||
} | ||
div.value { | ||
grid-column: 2; | ||
margin-bottom: 2px; | ||
} | ||
div.edit { | ||
grid-column: 3; | ||
padding-left: 4px; | ||
} | ||
</style> |
Oops, something went wrong.