show shown (#14639)
This commit is contained in:
parent
b83a2f33ff
commit
27a256b502
1 changed files with 19 additions and 1 deletions
|
@ -33,7 +33,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkContainer :foldable="true" :expanded="false">
|
||||
<template #header>{{ i18n.ts.uiInspector }}</template>
|
||||
<div :class="$style.uiInspector">
|
||||
<div v-for="c in components" :key="c.value.id">
|
||||
<div v-for="c in components" :key="c.value.id" :class="{ [$style.uiInspectorUnShown]: !showns.has(c.value.id) }">
|
||||
<div :class="$style.uiInspectorType">{{ c.value.type }}</div>
|
||||
<div :class="$style.uiInspectorId">{{ c.value.id }}</div>
|
||||
<button :class="$style.uiInspectorPropsToggle" @click="() => uiInspectorOpenedComponents.set(c, !uiInspectorOpenedComponents.get(c))">
|
||||
|
@ -180,6 +180,20 @@ const headerActions = computed(() => []);
|
|||
|
||||
const headerTabs = computed(() => []);
|
||||
|
||||
const showns = computed(() => {
|
||||
const result = new Set<string>();
|
||||
(function addChildrenToResult(c: AsUiComponent) {
|
||||
result.add(c.id);
|
||||
if (c.children) {
|
||||
const childComponents = components.value.filter(v => c.children.includes(v.value.id));
|
||||
for (const child of childComponents) {
|
||||
addChildrenToResult(child.value);
|
||||
}
|
||||
}
|
||||
})(root.value);
|
||||
return result;
|
||||
});
|
||||
|
||||
definePageMetadata(() => ({
|
||||
title: i18n.ts.scratchpad,
|
||||
icon: 'ti ti-terminal-2',
|
||||
|
@ -227,6 +241,10 @@ definePageMetadata(() => ({
|
|||
padding: 16px;
|
||||
}
|
||||
|
||||
.uiInspectorUnShown {
|
||||
color: var(--fgTransparent);
|
||||
}
|
||||
|
||||
.uiInspectorType {
|
||||
display: inline-block;
|
||||
border: hidden;
|
||||
|
|
Loading…
Reference in a new issue