introduce .context-many-kids class

This commit is contained in:
geoffrey45
2022-03-26 12:39:26 +03:00
parent da06b9bcc9
commit b7f34e1677
2 changed files with 24 additions and 15 deletions
+23 -14
View File
@@ -6,7 +6,10 @@
{ 'context-menu-visible': context.visible }, { 'context-menu-visible': context.visible },
{ 'context-normalizedX': context.normalizedX }, { 'context-normalizedX': context.normalizedX },
{ {
'context-normalizedY': context.normalizedY && context.hasManyChildren(), 'context-normalizedY': context.normalizedY,
},
{
'context-many-kids': context.hasManyChildren(),
}, },
]" ]"
:style="{ :style="{
@@ -25,8 +28,13 @@
<div class="label ellip">{{ option.label }}</div> <div class="label ellip">{{ option.label }}</div>
<div class="more image" v-if="option.children"></div> <div class="more image" v-if="option.children"></div>
<div class="children rounded shadow-sm" v-if="option.children"> <div class="children rounded shadow-sm" v-if="option.children">
<div class="context-item" v-for="child in option.children" :key="child"> <div
<div class="label ellip" @click="child.action()"> class="context-item"
v-for="child in option.children"
:key="child"
@click="child.action()"
>
<div class="label ellip">
{{ child.label }} {{ child.label }}
</div> </div>
</div> </div>
@@ -53,21 +61,16 @@ const context = useContextStore();
padding: $small; padding: $small;
background: $gray3; background: $gray3;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
transform-origin: top left; transform-origin: top left;
font-size: 0.875rem; font-size: 0.875rem;
.context-item { .context-item {
width: 100%; width: 100%;
height: 2.25rem;
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
cursor: default; cursor: default;
padding: 0 $small; padding: $small;
border-radius: $small; border-radius: $small;
color: rgb(255, 255, 255); color: rgb(255, 255, 255);
position: relative; position: relative;
@@ -84,13 +87,10 @@ const context = useContextStore();
position: absolute; position: absolute;
right: -13rem; right: -13rem;
width: 13rem; width: 13rem;
max-height: 21.25rem;
padding: $small; padding: $small !important;
background: $gray3; background: $gray3;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
transform: scale(0); transform: scale(0);
transform-origin: left; transform-origin: left;
} }
@@ -145,6 +145,7 @@ const context = useContextStore();
.separator { .separator {
height: 1px; height: 1px;
padding: 0;
} }
.critical { .critical {
@@ -176,4 +177,12 @@ const context = useContextStore();
transform-origin: bottom right; transform-origin: bottom right;
} }
} }
.context-many-kids {
.context-item > .children {
top: -0.5rem;
overflow-y: auto;
scrollbar-width: none;
}
}
</style> </style>
+1 -1
View File
@@ -40,7 +40,7 @@ interface Option {
type?: string; type?: string;
label?: string; label?: string;
action?: Function; action?: Function;
children?: Option[] |Promise<Option[]>| false; children?: Option[] | false;
icon?: string; icon?: string;
critical?: Boolean; critical?: Boolean;
} }