2018-09-11 17:10:59 +00:00
|
|
|
<template>
|
|
|
|
<div class="c-create-button--w">
|
2018-10-04 21:47:12 +00:00
|
|
|
<button class="c-create-button c-button--menu c-button--major icon-plus"
|
2018-09-11 17:10:59 +00:00
|
|
|
@click="toggleCreateMenu">
|
2018-09-13 22:14:28 +00:00
|
|
|
<span class="c-button__label">Create</span>
|
2018-10-04 21:47:12 +00:00
|
|
|
</button>
|
2018-09-11 17:10:59 +00:00
|
|
|
<div class="c-create-menu c-super-menu"
|
|
|
|
v-if="showCreateMenu">
|
|
|
|
<div class="c-super-menu__menu">
|
|
|
|
<ul>
|
2018-09-13 22:15:01 +00:00
|
|
|
<li v-for="(item, index) in items"
|
|
|
|
:key="index"
|
2018-09-11 17:10:59 +00:00
|
|
|
:class="item.class"
|
|
|
|
:title="item.title"
|
2018-09-13 22:15:01 +00:00
|
|
|
@mouseover="showItemDescription(item)">
|
2018-09-11 17:10:59 +00:00
|
|
|
{{ item.name }}
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div class="c-super-menu__item-description">
|
2018-09-13 22:15:01 +00:00
|
|
|
<div :class="['l-item-description__icon', 'bg-' + selectedMenuItem.class]"></div>
|
|
|
|
<div class="l-item-description__name">{{selectedMenuItem.name}}</div>
|
|
|
|
<div class="l-item-description__description">{{selectedMenuItem.title}}</div>
|
2018-09-11 17:10:59 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import "~styles/sass-base";
|
|
|
|
|
|
|
|
.c-create-button,
|
|
|
|
.c-create-menu {
|
|
|
|
|
|
|
|
font-size: 1.1em;
|
|
|
|
}
|
|
|
|
|
2018-09-13 22:14:28 +00:00
|
|
|
.c-create-button .c-button__label {
|
|
|
|
text-transform: $createBtnTextTransform;
|
|
|
|
}
|
|
|
|
|
2018-09-11 17:10:59 +00:00
|
|
|
.c-create-menu {
|
|
|
|
max-height: 80vh;
|
|
|
|
max-width: 500px;
|
|
|
|
min-height: 250px;
|
|
|
|
z-index: 70;
|
|
|
|
|
|
|
|
[class*="__icon"] {
|
|
|
|
filter: $colorKeyFilter;
|
|
|
|
}
|
|
|
|
|
|
|
|
[class*="__item-description"] {
|
|
|
|
min-width: 200px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2018-09-13 22:15:01 +00:00
|
|
|
inject: ['openmct'],
|
2018-09-11 17:10:59 +00:00
|
|
|
props: {
|
|
|
|
showCreateMenu: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toggleCreateMenu: function () {
|
|
|
|
this.showCreateMenu = !this.showCreateMenu;
|
|
|
|
},
|
2018-09-13 22:15:01 +00:00
|
|
|
showItemDescription: function (menuItem) {
|
|
|
|
this.selectedMenuItem = menuItem;
|
|
|
|
}
|
2018-09-11 17:10:59 +00:00
|
|
|
},
|
|
|
|
data: function() {
|
2018-09-13 22:15:01 +00:00
|
|
|
let items = [];
|
|
|
|
|
|
|
|
this.openmct.types.listKeys().forEach(key => {
|
|
|
|
let menuItem = openmct.types.get(key).definition;
|
|
|
|
|
|
|
|
if (menuItem.creatable) {
|
|
|
|
let menuItemTemplate = {
|
|
|
|
name: menuItem.name,
|
|
|
|
class: menuItem.cssClass,
|
|
|
|
title: menuItem.description
|
|
|
|
};
|
|
|
|
|
|
|
|
items.push(menuItemTemplate);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-09-11 17:10:59 +00:00
|
|
|
return {
|
2018-09-13 22:15:01 +00:00
|
|
|
items: items,
|
|
|
|
selectedMenuItem: {}
|
2018-09-11 17:10:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|