2018-12-06 18:45:40 +00:00
|
|
|
<template>
|
|
|
|
<div class="layout-topbar">
|
2018-12-26 09:36:00 +00:00
|
|
|
<a class="menu-button" @click="$emit('menubutton-click')">
|
|
|
|
<i class="pi pi-bars"></i>
|
|
|
|
</a>
|
2018-12-06 18:45:40 +00:00
|
|
|
<router-link to="/" class="logo">
|
|
|
|
<img alt="logo" src="./assets/images/primevue-logo.png">
|
|
|
|
</router-link>
|
2020-01-08 08:06:24 +00:00
|
|
|
<ul ref="topbarMenu" class="topbar-menu">
|
2018-12-06 18:45:40 +00:00
|
|
|
<li><router-link to="/setup">Get Started</router-link></li>
|
2019-12-11 09:35:13 +00:00
|
|
|
<li class="topbar-submenu">
|
2020-01-08 08:06:24 +00:00
|
|
|
<a tabindex="0" @click="toggleMenu($event, 0)" class="themes-menu-link">Themes</a>
|
|
|
|
<transition name="p-input-overlay" @enter="onMenuEnter" @leave="onMenuLeave">
|
|
|
|
<ul v-show="activeMenuIndex === 0">
|
2019-05-21 12:54:05 +00:00
|
|
|
<li class="topbar-submenu-header">THEMING</li>
|
2020-01-08 08:06:24 +00:00
|
|
|
<li><router-link to="/theming"><i class="pi pi-fw pi-file"/><span>Guide</span></router-link></li>
|
2019-12-09 11:48:49 +00:00
|
|
|
<li><a href="https://www.primefaces.org/designer/primevue"><i class="pi pi-fw pi-palette" /><span>Designer</span></a></li>
|
2020-01-08 08:06:24 +00:00
|
|
|
<li><router-link to="/icons"><i class="pi pi-fw pi-info-circle"/><span>Icons</span></router-link></li>
|
2019-12-09 11:48:49 +00:00
|
|
|
<li class="topbar-submenu-header">FREE COMPONENT THEMES</li>
|
2019-05-21 12:54:05 +00:00
|
|
|
<li><a href="#" @click="changeTheme($event, 'nova-light', false)"><img src="./assets/images/layouts/themeswitcher-nova-light.png" alt="Nova Light" /><span>Nova Light</span></a></li>
|
|
|
|
<li><a @click="changeTheme($event, 'nova-dark', false)"><img src="./assets/images/layouts/themeswitcher-nova-dark.png" alt="Nova Dark" /><span>Nova Dark</span></a></li>
|
|
|
|
<li><a @click="changeTheme($event, 'nova-colored', false)"><img src="./assets/images/layouts/themeswitcher-nova-colored.png" alt="Nova Colored" /><span>Nova Colored</span></a></li>
|
2019-12-20 14:22:50 +00:00
|
|
|
<li><a @click="changeTheme($event, 'nova-vue', false)"><img src="./assets/images/layouts/themeswitcher-nova-vue.png" alt="Nova Vue" /><span>Nova Vue</span></a></li>
|
2019-05-21 12:54:05 +00:00
|
|
|
<li><a @click="changeTheme($event, 'luna-amber', true)"><img src="./assets/images/layouts/themeswitcher-luna-amber.png" alt="Luna Amber" /><span>Luna Amber</span></a></li>
|
|
|
|
<li><a @click="changeTheme($event, 'luna-blue', true)"><img src="./assets/images/layouts/themeswitcher-luna-blue.png" alt="Luna Blue" /><span>Luna Blue</span></a></li>
|
|
|
|
<li><a @click="changeTheme($event, 'luna-green', true)"><img src="./assets/images/layouts/themeswitcher-luna-green.png" alt="Luna Green" /><span>Luna Green</span></a></li>
|
|
|
|
<li><a @click="changeTheme($event, 'luna-pink', true)"><img src="./assets/images/layouts/themeswitcher-luna-pink.png" alt="Luna Pink" /><span>Luna Pink</span></a></li>
|
|
|
|
<li><a @click="changeTheme($event, 'rhea', false)"><img src="./assets/images/layouts/themeswitcher-rhea.png" alt="Rhea" /><span>Rhea</span></a></li>
|
|
|
|
</ul>
|
|
|
|
</transition>
|
2018-12-06 18:45:40 +00:00
|
|
|
</li>
|
2019-12-11 09:35:13 +00:00
|
|
|
<li class="topbar-submenu">
|
2020-01-08 08:06:24 +00:00
|
|
|
<a tabindex="0" @click="toggleMenu($event, 1)" class="templates-menu-link">Templates</a>
|
|
|
|
<transition name="p-input-overlay" @enter="onMenuEnter" @leave="onMenuLeave">
|
|
|
|
<ul v-show="activeMenuIndex === 1">
|
2019-12-10 08:05:47 +00:00
|
|
|
<li class="topbar-submenu-header">FREE ADMIN TEMPLATE</li>
|
|
|
|
<li><a href="https://www.primefaces.org/sigma-vue"><img src="./assets/images/layouts/themeswitcher-sigma.png" alt="Sigma" /><span>Sigma</span></a></li>
|
|
|
|
<li class="topbar-submenu-header">PREMIUM ADMIN TEMPLATES</li>
|
|
|
|
<li><a href="https://www.primefaces.org/sapphire-vue"><img src="./assets/images/layouts/themeswitcher-sapphire.png" alt="Sapphire" /><span>Sapphire</span><span class="theme-badge material">material</span></a></li>
|
|
|
|
<li><a href="https://www.primefaces.org/avalon-vue"><img src="./assets/images/layouts/themeswitcher-avalon.png" alt="Avalon" /><span>Avalon</span><span class="theme-badge bootstrap">bootstrap</span></a></li>
|
|
|
|
<li><a href="https://www.primefaces.org/babylon-vue"><img src="./assets/images/layouts/themeswitcher-babylon.png" alt="Babylon" /><span>Babylon</span></a></li>
|
2019-12-24 08:45:43 +00:00
|
|
|
<li><a href="https://www.primefaces.org/apollo-vue"><img src="./assets/images/layouts/themeswitcher-apollo.png" alt="Apollo" /><span>Apollo</span><span class="theme-badge darkmode">dark mode</span></a></li>
|
2020-01-07 15:38:02 +00:00
|
|
|
<li><a href="https://www.primefaces.org/roma-vue"><img src="./assets/images/layouts/themeswitcher-roma.jpg" alt="Roma" /><span>Roma</span></a></li>
|
2019-12-10 08:05:47 +00:00
|
|
|
</ul>
|
|
|
|
</transition>
|
|
|
|
</li>
|
2019-12-11 09:35:13 +00:00
|
|
|
<li class="topbar-submenu topbar-resources-submenu">
|
2020-01-08 08:06:24 +00:00
|
|
|
<a tabindex="0" @click="toggleMenu($event, 2)" class="resources-menu-link">Resources</a>
|
|
|
|
<transition name="p-input-overlay" @enter="onMenuEnter" @leave="onMenuLeave">
|
|
|
|
<ul v-show="activeMenuIndex === 2">
|
|
|
|
<li><router-link to="/support"><span>Support</span></router-link></li>
|
2019-12-11 09:35:13 +00:00
|
|
|
<li><a href="https://github.com/primefaces/primevue" target="_blank"><span>Source Code</span></a></li>
|
|
|
|
<li><a href="https://www.primefaces.org/store" target="_blank"><span>PrimeStore</span></a></li>
|
|
|
|
<li><a href="https://www.primefaces.org/category/primevue/" target="_blank"><span>Blog</span></a></li>
|
|
|
|
<li><a href="https://twitter.com/primevue?lang=en" target="_blank"><span>Twitter</span></a></li>
|
|
|
|
<li><a href="https://www.primefaces.org/whouses/" target="_blank"><span>Who Uses</span></a></li>
|
|
|
|
<li><a href="https://www.primetek.com.tr" target="_blank"><span>About PrimeTek</span></a></li>
|
|
|
|
</ul>
|
|
|
|
</transition>
|
|
|
|
</li>
|
2018-12-06 18:45:40 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
2019-05-21 12:54:05 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2020-01-08 08:06:24 +00:00
|
|
|
outsideClickListener: null,
|
2019-05-21 12:54:05 +00:00
|
|
|
darkDemoStyle: null,
|
2020-01-08 08:06:24 +00:00
|
|
|
watch: {
|
|
|
|
$route() {
|
|
|
|
this.activeMenuIndex = null;
|
|
|
|
}
|
|
|
|
},
|
2019-05-21 12:54:05 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
theme: 'nova-light',
|
2020-01-08 08:06:24 +00:00
|
|
|
activeMenuIndex: null
|
2019-05-21 12:54:05 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
changeTheme(event, theme, dark) {
|
|
|
|
let themeElement = document.getElementById('theme-link');
|
|
|
|
themeElement.setAttribute('href', themeElement.getAttribute('href').replace(this.theme, theme));
|
|
|
|
this.theme = theme;
|
2019-10-22 12:38:18 +00:00
|
|
|
const hasBodyDarkTheme = this.hasClass(document.body, 'dark-theme');
|
2019-10-01 13:00:26 +00:00
|
|
|
|
2019-05-21 12:54:05 +00:00
|
|
|
if (dark) {
|
2019-10-22 12:38:18 +00:00
|
|
|
if (!hasBodyDarkTheme) {
|
|
|
|
this.addClass(document.body, 'dark-theme');
|
2019-05-21 12:54:05 +00:00
|
|
|
}
|
|
|
|
}
|
2019-10-22 12:38:18 +00:00
|
|
|
else if(hasBodyDarkTheme) {
|
|
|
|
this.removeClass(document.body, 'dark-theme');
|
2019-05-21 12:54:05 +00:00
|
|
|
}
|
|
|
|
|
2020-01-08 08:06:24 +00:00
|
|
|
this.activeMenuIndex = null;
|
2019-05-21 12:54:05 +00:00
|
|
|
event.preventDefault();
|
|
|
|
},
|
2019-10-22 12:38:18 +00:00
|
|
|
addClass(element, className) {
|
|
|
|
if (element.classList)
|
|
|
|
element.classList.add(className);
|
|
|
|
else
|
|
|
|
element.className += ' ' + className;
|
|
|
|
},
|
|
|
|
removeClass(element, className) {
|
|
|
|
if (element.classList)
|
|
|
|
element.classList.remove(className);
|
|
|
|
else
|
|
|
|
element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
|
|
|
|
},
|
|
|
|
hasClass(element, className) {
|
|
|
|
if (element.classList)
|
|
|
|
return element.classList.contains(className);
|
|
|
|
else
|
|
|
|
return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
|
|
|
|
},
|
2020-01-08 08:06:24 +00:00
|
|
|
toggleMenu(event, index) {
|
|
|
|
this.activeMenuIndex = (this.activeMenuIndex === index) ? null : index;
|
2019-12-10 08:05:47 +00:00
|
|
|
event.preventDefault();
|
|
|
|
},
|
2020-01-08 08:06:24 +00:00
|
|
|
onMenuEnter() {
|
|
|
|
this.bindOutsideClickListener();
|
2019-12-10 08:05:47 +00:00
|
|
|
},
|
2020-01-08 08:06:24 +00:00
|
|
|
onMenuLeave() {
|
|
|
|
this.unbindOutsideClickListener();
|
2019-12-10 08:05:47 +00:00
|
|
|
},
|
2020-01-08 08:06:24 +00:00
|
|
|
bindOutsideClickListener() {
|
|
|
|
if (!this.outsideClickListener) {
|
|
|
|
this.outsideClickListener = (event) => {
|
|
|
|
if ((this.activeMenuIndex != null && this.isOutsideTopbarMenuClicked(event))) {
|
|
|
|
this.activeMenuIndex = null;
|
2019-05-21 12:54:05 +00:00
|
|
|
}
|
|
|
|
};
|
2020-01-08 08:06:24 +00:00
|
|
|
document.addEventListener('click', this.outsideClickListener);
|
2019-05-21 12:54:05 +00:00
|
|
|
}
|
|
|
|
},
|
2020-01-08 08:06:24 +00:00
|
|
|
unbindOutsideClickListener() {
|
|
|
|
if (this.outsideClickListener) {
|
|
|
|
document.removeEventListener('click', this.outsideClickListener);
|
|
|
|
this.outsideClickListener = null;
|
2019-05-21 12:54:05 +00:00
|
|
|
}
|
|
|
|
},
|
2020-01-08 08:06:24 +00:00
|
|
|
isOutsideTopbarMenuClicked(event, element) {
|
|
|
|
return !(this.$refs.topbarMenu.isSameNode(event.target) || this.$refs.topbarMenu.contains(event.target));
|
2019-05-21 15:42:06 +00:00
|
|
|
}
|
2019-05-21 12:54:05 +00:00
|
|
|
}
|
|
|
|
}
|
2019-12-20 14:22:50 +00:00
|
|
|
</script>
|