foxes
This commit is contained in:
parent
b3c0c6124e
commit
aac8246e10
2 changed files with 53 additions and 50 deletions
|
@ -1,54 +1,56 @@
|
||||||
<template>
|
<template>
|
||||||
<div tabindex="-1" v-focus>
|
<div tabindex="-1" v-focus>
|
||||||
<div
|
<FocusTrap v-bind:active="isActive">
|
||||||
ref="itemsEl"
|
<div
|
||||||
class="rrevdjwt _popup _shadow"
|
ref="itemsEl"
|
||||||
:class="{ center: align === 'center', asDrawer }"
|
class="rrevdjwt _popup _shadow"
|
||||||
:style="{ width: (width && !asDrawer) ? width + 'px' : '', maxHeight: maxHeight ? maxHeight + 'px' : '' }"
|
:class="{ center: align === 'center', asDrawer }"
|
||||||
@contextmenu.self="e => e.preventDefault()"
|
:style="{ width: (width && !asDrawer) ? width + 'px' : '', maxHeight: maxHeight ? maxHeight + 'px' : '' }"
|
||||||
>
|
@contextmenu.self="e => e.preventDefault()"
|
||||||
<template v-for="(item, i) in items2">
|
>
|
||||||
<div v-if="item === null" class="divider"></div>
|
<template v-for="(item, i) in items2">
|
||||||
<span v-else-if="item.type === 'label'" class="label item">
|
<div v-if="item === null" class="divider"></div>
|
||||||
<span>{{ item.text }}</span>
|
<span v-else-if="item.type === 'label'" class="label item">
|
||||||
|
<span>{{ item.text }}</span>
|
||||||
|
</span>
|
||||||
|
<span v-else-if="item.type === 'pending'" :tabindex="0" class="pending item">
|
||||||
|
<span><MkEllipsis/></span>
|
||||||
|
</span>
|
||||||
|
<MkA v-else-if="item.type === 'link'" :to="item.to" :tabindex="0" class="_button item" @click.passive="close(true)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
||||||
|
<i v-if="item.icon" class="ph-fw ph-lg" :class="item.icon"></i>
|
||||||
|
<MkAvatar v-if="item.avatar" :user="item.avatar" class="avatar"/>
|
||||||
|
<span>{{ item.text }}</span>
|
||||||
|
<span v-if="item.indicate" class="indicator"><i class="ph-circle-fill"></i></span>
|
||||||
|
</MkA>
|
||||||
|
<a v-else-if="item.type === 'a'" :href="item.href" :target="item.target" :download="item.download" :tabindex="0" class="_button item" @click="close(true)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
||||||
|
<i v-if="item.icon" class="ph-fw ph-lg" :class="item.icon"></i>
|
||||||
|
<span>{{ item.text }}</span>
|
||||||
|
<span v-if="item.indicate" class="indicator"><i class="ph-circle-fill"></i></span>
|
||||||
|
</a>
|
||||||
|
<button v-else-if="item.type === 'user' && !items.hidden" :tabindex="0" class="_button item" :class="{ active: item.active }" :disabled="item.active" @click="clicked(item.action, $event)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
||||||
|
<MkAvatar :user="item.user" class="avatar"/><MkUserName :user="item.user"/>
|
||||||
|
<span v-if="item.indicate" class="indicator"><i class="ph-circle-fill"></i></span>
|
||||||
|
</button>
|
||||||
|
<span v-else-if="item.type === 'switch'" :tabindex="0" class="item" @click.passive="onItemMouseEnter(item)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
||||||
|
<FormSwitch v-model="item.ref" :disabled="item.disabled" class="form-switch">{{ item.text }}</FormSwitch>
|
||||||
|
</span>
|
||||||
|
<button v-else-if="item.type === 'parent'" :tabindex="0" class="_button item parent" :class="{ childShowing: childShowingItem === item }" @mouseenter="showChildren(item, $event)" @click="showChildren(item, $event)">
|
||||||
|
<i v-if="item.icon" class="ph-fw ph-lg" :class="item.icon"></i>
|
||||||
|
<span>{{ item.text }}</span>
|
||||||
|
<span class="caret"><i class="ph-caret-right-bold ph-lg ph-fw ph-lg"></i></span>
|
||||||
|
</button>
|
||||||
|
<button v-else-if="!item.hidden" :tabindex="0" class="_button item" :class="{ danger: item.danger, active: item.active }" :disabled="item.active" @click="clicked(item.action, $event)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
||||||
|
<i v-if="item.icon" class="ph-fw ph-lg" :class="item.icon"></i>
|
||||||
|
<MkAvatar v-if="item.avatar" :user="item.avatar" class="avatar"/>
|
||||||
|
<span>{{ item.text }}</span>
|
||||||
|
<span v-if="item.indicate" class="indicator"><i class="ph-circle-fill"></i></span>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
<span v-if="items2.length === 0" class="none item">
|
||||||
|
<span>{{ i18n.ts.none }}</span>
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="item.type === 'pending'" :tabindex="0" class="pending item">
|
</div>
|
||||||
<span><MkEllipsis/></span>
|
</FocusTrap>
|
||||||
</span>
|
|
||||||
<MkA v-else-if="item.type === 'link'" :to="item.to" :tabindex="0" class="_button item" @click.passive="close(true)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
|
||||||
<i v-if="item.icon" class="ph-fw ph-lg" :class="item.icon"></i>
|
|
||||||
<MkAvatar v-if="item.avatar" :user="item.avatar" class="avatar"/>
|
|
||||||
<span>{{ item.text }}</span>
|
|
||||||
<span v-if="item.indicate" class="indicator"><i class="ph-circle-fill"></i></span>
|
|
||||||
</MkA>
|
|
||||||
<a v-else-if="item.type === 'a'" :href="item.href" :target="item.target" :download="item.download" :tabindex="0" class="_button item" @click="close(true)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
|
||||||
<i v-if="item.icon" class="ph-fw ph-lg" :class="item.icon"></i>
|
|
||||||
<span>{{ item.text }}</span>
|
|
||||||
<span v-if="item.indicate" class="indicator"><i class="ph-circle-fill"></i></span>
|
|
||||||
</a>
|
|
||||||
<button v-else-if="item.type === 'user' && !items.hidden" :tabindex="0" class="_button item" :class="{ active: item.active }" :disabled="item.active" @click="clicked(item.action, $event)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
|
||||||
<MkAvatar :user="item.user" class="avatar"/><MkUserName :user="item.user"/>
|
|
||||||
<span v-if="item.indicate" class="indicator"><i class="ph-circle-fill"></i></span>
|
|
||||||
</button>
|
|
||||||
<span v-else-if="item.type === 'switch'" :tabindex="0" class="item" @click.passive="onItemMouseEnter(item)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
|
||||||
<FormSwitch v-model="item.ref" :disabled="item.disabled" class="form-switch">{{ item.text }}</FormSwitch>
|
|
||||||
</span>
|
|
||||||
<button v-else-if="item.type === 'parent'" :tabindex="0" class="_button item parent" :class="{ childShowing: childShowingItem === item }" @mouseenter="showChildren(item, $event)" @click="showChildren(item, $event)">
|
|
||||||
<i v-if="item.icon" class="ph-fw ph-lg" :class="item.icon"></i>
|
|
||||||
<span>{{ item.text }}</span>
|
|
||||||
<span class="caret"><i class="ph-caret-right-bold ph-lg ph-fw ph-lg"></i></span>
|
|
||||||
</button>
|
|
||||||
<button v-else-if="!item.hidden" :tabindex="0" class="_button item" :class="{ danger: item.danger, active: item.active }" :disabled="item.active" @click="clicked(item.action, $event)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
|
|
||||||
<i v-if="item.icon" class="ph-fw ph-lg" :class="item.icon"></i>
|
|
||||||
<MkAvatar v-if="item.avatar" :user="item.avatar" class="avatar"/>
|
|
||||||
<span>{{ item.text }}</span>
|
|
||||||
<span v-if="item.indicate" class="indicator"><i class="ph-circle-fill"></i></span>
|
|
||||||
</button>
|
|
||||||
</template>
|
|
||||||
<span v-if="items2.length === 0" class="none item">
|
|
||||||
<span>{{ i18n.ts.none }}</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="childMenu" class="child">
|
<div v-if="childMenu" class="child">
|
||||||
<XChild ref="child" :items="childMenu" :target-element="childTarget" :root-element="itemsEl" showing @actioned="childActioned"/>
|
<XChild ref="child" :items="childMenu" :target-element="childTarget" :root-element="itemsEl" showing @actioned="childActioned"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -62,6 +64,7 @@ import FormSwitch from '@/components/form/switch.vue';
|
||||||
import { MenuItem, InnerMenuItem, MenuPending, MenuAction } from '@/types/menu';
|
import { MenuItem, InnerMenuItem, MenuPending, MenuAction } from '@/types/menu';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
|
import { FocusTrap } from 'focus-trap-vue';
|
||||||
|
|
||||||
const XChild = defineAsyncComponent(() => import('./MkMenu.child.vue'));
|
const XChild = defineAsyncComponent(() => import('./MkMenu.child.vue'));
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<transition :name="$store.state.animation ? (type === 'drawer') ? 'modal-drawer' : (type === 'popup') ? 'modal-popup' : 'modal' : ''" :duration="$store.state.animation ? 200 : 0" appear @after-leave="emit('closed')" @enter="emit('opening')" @keyup.esc="emit('click')" @after-enter="onOpened">
|
<transition :name="$store.state.animation ? (type === 'drawer') ? 'modal-drawer' : (type === 'popup') ? 'modal-popup' : 'modal' : ''" :duration="$store.state.animation ? 200 : 0" appear @after-leave="emit('closed')" @enter="emit('opening')" @keyup.esc="emit('click')" @after-enter="onOpened">
|
||||||
<focus-trap v-model:active="isActive">
|
<focus-trap v-model:active="isActive">
|
||||||
<div v-show="manualShowing != null ? manualShowing : showing" v-hotkey.global="keymap" class="qzhlnise" :class="{ drawer: type === 'drawer', dialog: type === 'dialog' || type === 'dialog:top', popup: type === 'popup' }" :style="{ zIndex, pointerEvents: (manualShowing != null ? manualShowing : showing) ? 'auto' : 'none', '--transformOrigin': transformOrigin }">
|
<div v-show="manualShowing != null ? manualShowing : showing" v-hotkey.global="keymap" class="qzhlnise" :class="{ drawer: type === 'drawer', dialog: type === 'dialog' || type === 'dialog:top', popup: type === 'popup' }" :style="{ zIndex, pointerEvents: (manualShowing != null ? manualShowing : showing) ? 'auto' : 'none', '--transformOrigin': transformOrigin }" tabindex="-1" v-focus>
|
||||||
<div class="bg _modalBg" :class="{ transparent: transparentBg && (type === 'popup') }" :style="{ zIndex }" @click="onBgClick" @contextmenu.prevent.stop="() => {}"></div>
|
<div class="bg _modalBg" :class="{ transparent: transparentBg && (type === 'popup') }" :style="{ zIndex }" @click="onBgClick" @contextmenu.prevent.stop="() => {}"></div>
|
||||||
<div ref="content" class="content" :class="{ fixed, top: type === 'dialog:top' }" :style="{ zIndex }" @click.self="onBgClick" tabindex="-1" v-focus>
|
<div ref="content" class="content" :class="{ fixed, top: type === 'dialog:top' }" :style="{ zIndex }" @click.self="onBgClick">
|
||||||
<slot :max-height="maxHeight" :type="type"></slot>
|
<slot :max-height="maxHeight" :type="type"></slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue