2021-06-24 16:06:13 +00:00
|
|
|
<template>
|
|
|
|
|
<div id="my-container">
|
|
|
|
|
<div
|
|
|
|
|
v-if="item.header && !isItemHidden"
|
|
|
|
|
class="vsm--header"
|
|
|
|
|
:class="item.class"
|
|
|
|
|
v-bind="item.attributes"
|
|
|
|
|
>
|
2021-08-20 04:16:37 +00:00
|
|
|
{{ item.title }}
|
|
|
|
|
<b-icon
|
|
|
|
|
:icon="item.icon || ''"
|
|
|
|
|
@click="item.onClick(item) || function() {}"
|
|
|
|
|
></b-icon>
|
2021-06-24 16:06:13 +00:00
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
v-else-if="!isItemHidden"
|
|
|
|
|
class="vsm--item"
|
|
|
|
|
:class="[{ 'vsm--item_open': show }]"
|
|
|
|
|
@mouseover="mouseOverEvent"
|
|
|
|
|
@mouseout="mouseOutEvent"
|
|
|
|
|
>
|
|
|
|
|
<custom-sidebar-menu-link
|
|
|
|
|
:item="item"
|
|
|
|
|
:class="itemLinkClass"
|
|
|
|
|
:attributes="item.attributes"
|
|
|
|
|
@click.native="clickEvent"
|
|
|
|
|
>
|
|
|
|
|
<custom-sidebar-menu-icon
|
2021-09-17 23:14:57 +00:00
|
|
|
v-if="item.icon && !isMobileItem && item.specialType !='header'"
|
2021-06-24 16:06:13 +00:00
|
|
|
:icon="item.icon"
|
2021-09-03 16:07:56 -04:00
|
|
|
v-bind:style="setIconColor"
|
2021-06-24 16:06:13 +00:00
|
|
|
/>
|
|
|
|
|
<transition name="fade-animation" :appear="isMobileItem">
|
|
|
|
|
<template
|
|
|
|
|
v-if="
|
|
|
|
|
(isCollapsed && !isFirstLevel) ||
|
|
|
|
|
!isCollapsed ||
|
|
|
|
|
isMobileItem
|
|
|
|
|
"
|
2021-09-17 23:18:59 +00:00
|
|
|
>
|
2021-09-17 23:14:57 +00:00
|
|
|
<span :class="item.specialType != 'header'?'vsm--title': 'vsm--header vsm--title--header'">
|
2021-09-29 14:57:07 -04:00
|
|
|
<template v-if="!verifyTaskMetrics">
|
|
|
|
|
<custom-tooltip
|
|
|
|
|
:data="item"
|
|
|
|
|
ref="tooltip"
|
|
|
|
|
></custom-tooltip>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
|
|
|
|
<span>
|
|
|
|
|
{{ item.title }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
2021-09-20 17:43:12 -04:00
|
|
|
<span v-if="item.sortable">
|
|
|
|
|
<b-icon
|
|
|
|
|
:id="`gear-${item.id}`"
|
|
|
|
|
:icon="item.sortIcon"
|
|
|
|
|
@click="onClickSortSettings"
|
|
|
|
|
@mouseover="hoverHandler"
|
|
|
|
|
@mouseleave="unhoverHandler"
|
|
|
|
|
v-bind:style="{color: sortColor}"
|
|
|
|
|
></b-icon>
|
|
|
|
|
<b-tooltip
|
|
|
|
|
:target="`gear-${item.id}`"
|
|
|
|
|
triggers="hover"
|
|
|
|
|
>
|
|
|
|
|
{{ $t("ID_CASES_LIST_SETTINGS") }}
|
|
|
|
|
</b-tooltip>
|
|
|
|
|
</span>
|
2021-06-24 16:06:13 +00:00
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</transition>
|
2021-09-17 23:14:57 +00:00
|
|
|
<custom-sidebar-menu-icon
|
|
|
|
|
v-if="item.icon && !isMobileItem && item.specialType =='header'"
|
|
|
|
|
:icon="item.icon"
|
|
|
|
|
v-bind:style="setIconColor"
|
|
|
|
|
/>
|
2021-06-24 16:06:13 +00:00
|
|
|
<template
|
|
|
|
|
v-if="
|
|
|
|
|
(isCollapsed && !isFirstLevel) ||
|
|
|
|
|
!isCollapsed ||
|
|
|
|
|
isMobileItem
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
v-if="itemHasChild"
|
|
|
|
|
class="vsm--arrow"
|
|
|
|
|
:class="[
|
|
|
|
|
{ 'vsm--arrow_open': show },
|
|
|
|
|
{ 'vsm--arrow_slot': $slots['dropdown-icon'] },
|
|
|
|
|
]"
|
|
|
|
|
>
|
|
|
|
|
<slot name="dropdown-icon" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</custom-sidebar-menu-link>
|
|
|
|
|
|
|
|
|
|
<template v-if="itemHasChild">
|
|
|
|
|
<template
|
|
|
|
|
v-if="
|
|
|
|
|
(isCollapsed && !isFirstLevel) ||
|
|
|
|
|
!isCollapsed ||
|
|
|
|
|
isMobileItem
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<transition
|
|
|
|
|
:appear="isMobileItem"
|
|
|
|
|
name="expand"
|
|
|
|
|
@enter="expandEnter"
|
|
|
|
|
@afterEnter="expandAfterEnter"
|
|
|
|
|
@beforeLeave="expandBeforeLeave"
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
v-if="show"
|
|
|
|
|
class="vsm--dropdown"
|
|
|
|
|
:class="isMobileItem && 'vsm--dropdown_mobile-item'"
|
|
|
|
|
:style="isMobileItem && mobileItemStyle.dropdown"
|
|
|
|
|
>
|
|
|
|
|
<div class="vsm--list">
|
|
|
|
|
<custom-sidebar-menu-item
|
|
|
|
|
v-for="(subItem, index) in item.child"
|
|
|
|
|
:key="index"
|
|
|
|
|
:item="subItem"
|
|
|
|
|
:level="level + 1"
|
|
|
|
|
:show-child="showChild"
|
|
|
|
|
:rtl="rtl"
|
|
|
|
|
:is-collapsed="isCollapsed"
|
|
|
|
|
>
|
|
|
|
|
<slot
|
|
|
|
|
slot="dropdown-icon"
|
|
|
|
|
name="dropdown-icon"
|
|
|
|
|
/>
|
|
|
|
|
</custom-sidebar-menu-item>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</transition>
|
|
|
|
|
</template>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<b-modal
|
|
|
|
|
ref="modal"
|
|
|
|
|
v-if="item.sortable"
|
|
|
|
|
id="my-modal"
|
|
|
|
|
static
|
|
|
|
|
title="Custom Case List Order"
|
|
|
|
|
>
|
|
|
|
|
<draggable
|
|
|
|
|
:list="item.child"
|
|
|
|
|
:disabled="!enabled"
|
|
|
|
|
class="list-group"
|
|
|
|
|
ghost-class="ghost"
|
|
|
|
|
@end="checkMove"
|
|
|
|
|
@start="dragging = true"
|
|
|
|
|
handle=".handle"
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
class="list-group-item"
|
|
|
|
|
v-for="element in item.child"
|
|
|
|
|
:key="element.title"
|
|
|
|
|
>
|
|
|
|
|
<b-row>
|
|
|
|
|
<b-col
|
|
|
|
|
><b-icon icon="check-circle"></b-icon>
|
|
|
|
|
</b-col>
|
|
|
|
|
<b-col cols="9">{{ element.title }}</b-col>
|
|
|
|
|
<b-col
|
|
|
|
|
><i class="fa fa-align-justify handle"></i
|
|
|
|
|
></b-col>
|
|
|
|
|
</b-row>
|
|
|
|
|
</div>
|
|
|
|
|
</draggable>
|
|
|
|
|
|
2021-07-22 16:12:03 -04:00
|
|
|
<template #modal-footer="{ cancel }">
|
2021-06-24 16:06:13 +00:00
|
|
|
<b-button size="sm" variant="danger" @click="cancel()">
|
2021-08-20 03:50:06 +00:00
|
|
|
{{ $t("ID_CLOSE") }}
|
2021-06-24 16:06:13 +00:00
|
|
|
</b-button>
|
|
|
|
|
</template>
|
|
|
|
|
</b-modal>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import draggable from "vuedraggable";
|
|
|
|
|
import CustomSidebarMenuLink from "./CustomSidebarMenuLink";
|
|
|
|
|
import CustomSidebarMenuIcon from "./CustomSidebarMenuIcon";
|
2021-07-22 16:12:03 -04:00
|
|
|
import CustomTooltip from "./../utils/CustomTooltip.vue";
|
2021-08-20 04:16:37 +00:00
|
|
|
import eventBus from "./../../home/EventBus/eventBus";
|
2021-07-22 16:12:03 -04:00
|
|
|
|
2021-06-24 16:06:13 +00:00
|
|
|
export default {
|
|
|
|
|
name: "CustomSidebarMenuItem",
|
|
|
|
|
props: {
|
|
|
|
|
item: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
|
|
|
|
level: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: 1,
|
|
|
|
|
},
|
|
|
|
|
isMobileItem: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
mobileItem: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: null,
|
|
|
|
|
},
|
|
|
|
|
activeShow: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: null,
|
|
|
|
|
},
|
|
|
|
|
showChild: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
showOneChild: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
rtl: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
disableHover: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
mobileItemStyle: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: null,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
draggable,
|
|
|
|
|
CustomSidebarMenuLink,
|
|
|
|
|
CustomSidebarMenuIcon,
|
2021-08-20 04:16:37 +00:00
|
|
|
CustomTooltip,
|
2021-06-24 16:06:13 +00:00
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
enabled: true,
|
|
|
|
|
dragging: false,
|
|
|
|
|
itemShow: false,
|
|
|
|
|
itemHover: false,
|
|
|
|
|
exactActive: false,
|
|
|
|
|
active: false,
|
2021-08-20 04:16:37 +00:00
|
|
|
titleHover: "",
|
2021-09-09 09:29:46 -04:00
|
|
|
menuMap: {
|
|
|
|
|
CASES_INBOX: "inbox",
|
|
|
|
|
CASES_DRAFT: "draft",
|
|
|
|
|
CASES_PAUSED: "paused",
|
|
|
|
|
CASES_SELFSERVICE: "unassigned"
|
|
|
|
|
},
|
2021-09-20 17:43:12 -04:00
|
|
|
sortColor: "white",
|
2021-06-24 16:06:13 +00:00
|
|
|
};
|
|
|
|
|
},
|
2021-08-26 20:29:51 -04:00
|
|
|
mounted() {
|
|
|
|
|
this.setHighlight();
|
|
|
|
|
},
|
2021-06-24 16:06:13 +00:00
|
|
|
computed: {
|
|
|
|
|
isCollapsed() {
|
|
|
|
|
return this.$parent.isCollapsed;
|
|
|
|
|
},
|
|
|
|
|
itemLinkClass() {
|
|
|
|
|
return [
|
|
|
|
|
"vsm--link",
|
|
|
|
|
!this.isMobileItem ? `vsm--link_level-${this.level}` : "",
|
|
|
|
|
{ "vsm--link_mobile-item": this.isMobileItem },
|
|
|
|
|
{ "vsm--link_hover": this.hover },
|
|
|
|
|
{ "vsm--link_active": this.active },
|
|
|
|
|
{ "vsm--link_exact-active": this.exactActive },
|
|
|
|
|
{ "vsm--link_disabled": this.item.disabled },
|
|
|
|
|
this.item.class,
|
|
|
|
|
];
|
|
|
|
|
},
|
|
|
|
|
draggingInfo() {
|
|
|
|
|
return this.dragging ? "under drag" : "";
|
|
|
|
|
},
|
|
|
|
|
show: {
|
|
|
|
|
get() {
|
|
|
|
|
if (!this.itemHasChild) return false;
|
|
|
|
|
if (this.showChild || this.isMobileItem) return true;
|
|
|
|
|
return this.itemShow;
|
|
|
|
|
},
|
|
|
|
|
set(show) {
|
|
|
|
|
if (this.showOneChild) {
|
|
|
|
|
show
|
|
|
|
|
? this.emitActiveShow(this.item)
|
|
|
|
|
: this.emitActiveShow(null);
|
|
|
|
|
}
|
|
|
|
|
this.itemShow = show;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
isFirstLevel() {
|
|
|
|
|
return this.level === 1;
|
|
|
|
|
},
|
|
|
|
|
itemHasChild() {
|
|
|
|
|
return !!(this.item.child && this.item.child.length > 0);
|
|
|
|
|
},
|
|
|
|
|
isItemHidden() {
|
2021-08-17 21:48:08 +00:00
|
|
|
if (this.isCollapsed) {
|
2021-08-20 04:16:37 +00:00
|
|
|
if (
|
|
|
|
|
this.item.hidden &&
|
|
|
|
|
this.item.hiddenOnCollapse === undefined
|
|
|
|
|
) {
|
|
|
|
|
return true;
|
2021-08-17 21:48:08 +00:00
|
|
|
} else {
|
2021-08-20 04:16:37 +00:00
|
|
|
return this.item.hiddenOnCollapse === true;
|
2021-08-17 21:48:08 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
2021-08-20 04:16:37 +00:00
|
|
|
return this.item.hidden === true;
|
2021-08-17 21:48:08 +00:00
|
|
|
}
|
2021-06-24 16:06:13 +00:00
|
|
|
},
|
2021-09-09 09:29:46 -04:00
|
|
|
/**
|
2021-09-29 14:57:07 -04:00
|
|
|
* Verify if the item is TASK_METRICS
|
2021-09-09 09:29:46 -04:00
|
|
|
*/
|
2021-09-29 14:57:07 -04:00
|
|
|
verifyTaskMetrics() {
|
|
|
|
|
return this.item.id === "TASK_METRICS";
|
2021-09-09 09:29:46 -04:00
|
|
|
},
|
2021-09-03 16:07:56 -04:00
|
|
|
/**
|
|
|
|
|
* Set color to icon defined from custom case list
|
|
|
|
|
*/
|
|
|
|
|
setIconColor() {
|
|
|
|
|
return {
|
|
|
|
|
color: this.item.color ? this.item.color : '#fff'
|
|
|
|
|
};
|
|
|
|
|
},
|
2021-06-24 16:06:13 +00:00
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
$route() {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
if (this.item.header || this.item.component) return;
|
|
|
|
|
this.initState();
|
|
|
|
|
}, 1);
|
|
|
|
|
},
|
|
|
|
|
item(newItem, item) {
|
|
|
|
|
this.emitItemUpdate(newItem, item);
|
|
|
|
|
},
|
|
|
|
|
activeShow() {
|
|
|
|
|
this.itemShow = this.item === this.activeShow;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.initState();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2021-08-26 20:29:51 -04:00
|
|
|
/**
|
|
|
|
|
* set the highlight
|
|
|
|
|
*/
|
|
|
|
|
setHighlight() {
|
|
|
|
|
let that = this;
|
|
|
|
|
eventBus.$on('highlight', (data) => {
|
|
|
|
|
var i;
|
|
|
|
|
for (i = 0; i < data.length; i += 1) {
|
2021-08-30 11:04:40 -04:00
|
|
|
if (that.item.page && that.item.page === data[i].id) {
|
2021-09-09 09:29:46 -04:00
|
|
|
if (that.$refs.tooltip && that.menuMap[that.item.id]) {
|
2021-08-30 21:16:27 -04:00
|
|
|
that.$refs.tooltip.setHighlight()
|
|
|
|
|
}
|
2021-08-26 20:29:51 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
2021-06-24 16:06:13 +00:00
|
|
|
/**
|
|
|
|
|
* Match the route to ensure the correct location
|
|
|
|
|
* @param {string} href
|
|
|
|
|
* @param {string} exactPath
|
|
|
|
|
* @return {boolean}
|
|
|
|
|
*/
|
|
|
|
|
matchRoute({ href, exactPath }) {
|
|
|
|
|
if (!href) return false;
|
|
|
|
|
if (this.$router) {
|
|
|
|
|
const { route } = this.$router.resolve(href);
|
|
|
|
|
return exactPath
|
|
|
|
|
? route.path === this.$route.path
|
|
|
|
|
: this.matchExactRoute(href);
|
|
|
|
|
} else {
|
|
|
|
|
return exactPath
|
|
|
|
|
? href === window.location.pathname
|
|
|
|
|
: this.matchExactRoute(href);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Match the exact route with the current location
|
|
|
|
|
* @param {string} href
|
|
|
|
|
* @return {boolean}
|
|
|
|
|
*/
|
|
|
|
|
matchExactRoute(href) {
|
|
|
|
|
if (!href) return false;
|
|
|
|
|
if (this.$router) {
|
|
|
|
|
const { route } = this.$router.resolve(href);
|
|
|
|
|
return route.fullPath === this.$route.fullPath;
|
|
|
|
|
} else {
|
|
|
|
|
return (
|
|
|
|
|
href ===
|
|
|
|
|
window.location.pathname +
|
|
|
|
|
window.location.search +
|
|
|
|
|
window.location.hash
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Check if the child is active
|
|
|
|
|
* @param {object} child
|
|
|
|
|
* @return {boolean}
|
|
|
|
|
*/
|
|
|
|
|
isChildActive(child) {
|
|
|
|
|
if (!child) return false;
|
|
|
|
|
return child.some((item) => {
|
|
|
|
|
return this.isLinkActive(item);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Validate if the Alias is active
|
|
|
|
|
* @param {object} item
|
|
|
|
|
* @return {boobleam}
|
|
|
|
|
*/
|
|
|
|
|
isAliasActive(item) {
|
|
|
|
|
if (item.alias) {
|
|
|
|
|
const current = this.$router
|
|
|
|
|
? this.$route.fullPath
|
|
|
|
|
: window.location.pathname +
|
|
|
|
|
window.location.search +
|
|
|
|
|
window.location.hash;
|
|
|
|
|
if (Array.isArray(item.alias)) {
|
|
|
|
|
return item.alias.some((alias) => {
|
|
|
|
|
return pathToRegexp(alias).test(current);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
return pathToRegexp(item.alias).test(current);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Validate if the link is active
|
|
|
|
|
* @param {object} item
|
|
|
|
|
* @return {boolean}
|
|
|
|
|
*/
|
|
|
|
|
isLinkActive(item) {
|
|
|
|
|
return (
|
|
|
|
|
this.matchRoute(item) ||
|
|
|
|
|
this.isChildActive(item.child) ||
|
|
|
|
|
this.isAliasActive(item)
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
/**
|
2021-08-20 04:16:37 +00:00
|
|
|
* Ensurre if the link exact is active
|
2021-06-24 16:06:13 +00:00
|
|
|
* @param {object} item
|
|
|
|
|
* @return {boolean}
|
|
|
|
|
*/
|
|
|
|
|
isLinkExactActive(item) {
|
|
|
|
|
return this.matchExactRoute(item.href);
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Initialize the state of the menu item
|
|
|
|
|
*/
|
|
|
|
|
initState() {
|
|
|
|
|
this.initActiveState();
|
2021-09-21 21:24:18 +00:00
|
|
|
this.initShowState();
|
2021-06-24 16:06:13 +00:00
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Initalize the active state of the menu item
|
|
|
|
|
*/
|
|
|
|
|
initActiveState() {
|
|
|
|
|
this.active = this.isLinkActive(this.item);
|
|
|
|
|
this.exactActive = this.isLinkExactActive(this.item);
|
|
|
|
|
},
|
|
|
|
|
/**
|
2021-08-20 04:16:37 +00:00
|
|
|
* Initialize and show active state menu item
|
2021-06-24 16:06:13 +00:00
|
|
|
*/
|
|
|
|
|
initShowState() {
|
|
|
|
|
if (!this.itemHasChild || this.showChild) return;
|
|
|
|
|
if (
|
|
|
|
|
(this.showOneChild && this.active && !this.show) ||
|
|
|
|
|
(this.active && !this.show)
|
|
|
|
|
) {
|
|
|
|
|
this.show = true;
|
|
|
|
|
} else if (this.showOneChild && !this.active && this.show) {
|
|
|
|
|
this.show = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-08-20 04:16:37 +00:00
|
|
|
/**
|
2021-06-24 16:06:13 +00:00
|
|
|
* Handler to check if the item is moving
|
|
|
|
|
* @param {object} e
|
|
|
|
|
*/
|
|
|
|
|
checkMove: function(e) {
|
|
|
|
|
let aux = this.item.child.splice(e.newIndex, 1);
|
|
|
|
|
this.item.child.splice(e.newIndex, 0, aux[0]);
|
2021-08-20 03:40:20 +00:00
|
|
|
this.emitItemUpdate(this.item, this.item);
|
2021-08-20 04:16:37 +00:00
|
|
|
eventBus.$emit("sort-menu", this.item.child);
|
2021-06-24 16:06:13 +00:00
|
|
|
},
|
|
|
|
|
/**
|
2021-08-20 04:16:37 +00:00
|
|
|
* Click event Handler
|
2021-06-24 16:06:13 +00:00
|
|
|
* @param {object} event
|
|
|
|
|
*/
|
|
|
|
|
clickEvent(event) {
|
|
|
|
|
if (this.item.disabled) return;
|
|
|
|
|
if (!this.item.href) {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
this.emitItemClick(event, this.item, this);
|
|
|
|
|
this.emitMobileItem(event, event.currentTarget.offsetParent);
|
|
|
|
|
if (!this.itemHasChild || this.showChild || this.isMobileItem)
|
|
|
|
|
return;
|
|
|
|
|
if (!this.item.href || this.exactActive) {
|
|
|
|
|
this.show = !this.show;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Mouse over event handler
|
|
|
|
|
* @param {object} event
|
|
|
|
|
*/
|
|
|
|
|
mouseOverEvent(event) {
|
|
|
|
|
if (this.item.disabled) return;
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
this.itemHover = true;
|
|
|
|
|
if (!this.disableHover) {
|
|
|
|
|
this.emitMobileItem(event, event.currentTarget);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Mouse out event handler
|
|
|
|
|
* @param {object} event
|
|
|
|
|
*/
|
|
|
|
|
mouseOutEvent(event) {
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
this.itemHover = false;
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Expand sidebar menu item handler
|
|
|
|
|
* @param {object} el
|
|
|
|
|
*/
|
|
|
|
|
expandEnter(el) {
|
|
|
|
|
el.style.height = el.scrollHeight + "px";
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Expand after enter menu item handler
|
|
|
|
|
* @param {object} el
|
|
|
|
|
*/
|
|
|
|
|
expandAfterEnter(el) {
|
|
|
|
|
el.style.height = "auto";
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Expand before leace handler
|
|
|
|
|
* @param {object} el
|
|
|
|
|
*/
|
|
|
|
|
expandBeforeLeave(el) {
|
|
|
|
|
if (this.isCollapsed && this.isFirstLevel) {
|
|
|
|
|
el.style.display = "none";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
el.style.height = el.scrollHeight + "px";
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Emit Mobile item handler
|
|
|
|
|
* @param {object} event
|
|
|
|
|
* @param {object} itemEl
|
|
|
|
|
*/
|
|
|
|
|
emitMobileItem(event, itemEl) {
|
|
|
|
|
if (this.hover) return;
|
|
|
|
|
if (!this.isCollapsed || !this.isFirstLevel || this.isMobileItem)
|
|
|
|
|
return;
|
2021-08-20 03:40:20 +00:00
|
|
|
this.$parent.$emit("unset-mobile-item", true);
|
2021-06-24 16:06:13 +00:00
|
|
|
setTimeout(() => {
|
2021-08-17 21:48:08 +00:00
|
|
|
if (this.$parent.mobileItem !== this.item) {
|
2021-08-20 04:16:37 +00:00
|
|
|
this.$parent.$emit("set-mobile-item", {
|
|
|
|
|
item: this.item,
|
|
|
|
|
itemEl,
|
|
|
|
|
});
|
2021-06-24 16:06:13 +00:00
|
|
|
}
|
|
|
|
|
if (event.type === "click" && !this.itemHasChild) {
|
2021-08-17 21:48:08 +00:00
|
|
|
this.$parent.$emit("unset-mobile-item", false);
|
2021-06-24 16:06:13 +00:00
|
|
|
}
|
|
|
|
|
}, 0);
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Click Sort settings event handler
|
|
|
|
|
* @param {object} event
|
|
|
|
|
*/
|
|
|
|
|
onClickSortSettings(event) {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
this.$refs["modal"].show();
|
|
|
|
|
},
|
2021-09-20 17:43:12 -04:00
|
|
|
hoverHandler() {
|
|
|
|
|
this.sortColor = '#02feff';
|
|
|
|
|
},
|
|
|
|
|
unhoverHandler() {
|
|
|
|
|
this.sortColor = 'white';
|
|
|
|
|
}
|
2021-06-24 16:06:13 +00:00
|
|
|
},
|
|
|
|
|
inject: ["emitActiveShow", "emitItemClick", "emitItemUpdate"],
|
|
|
|
|
};
|
|
|
|
|
</script>
|
2021-09-17 23:14:57 +00:00
|
|
|
<style scoped>
|
|
|
|
|
.vsm--header.vsm--title--header{
|
|
|
|
|
display: initial;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
max-width: 150px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.vsm--header.vsm--title--header + .vsm--icon{
|
|
|
|
|
float: none;
|
|
|
|
|
line-height: 30px;
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
margin-left: 0px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|