2018-12-04 07:08:40 +00:00
< template >
2020-06-20 09:40:01 +00:00
< div class = "layout-wrapper" :class ="containerClass" >
2020-10-22 13:18:06 +00:00
< div class = "layout-news" v-if ="newsActive" >
2020-04-13 16:02:51 +00:00
< div class = "layout-news-container" >
2021-03-15 14:21:25 +00:00
< a href = "https://www.primefaces.org/store" target = "_blank" >
2021-05-06 13:12:18 +00:00
< img class = "layouts-news-mockup-image" src = "./assets/images/topbar-freya-mockup.png" >
2021-03-15 14:21:25 +00:00
< / a >
< a href = "https://www.primefaces.org/store" target = "_blank" tabindex = "-1" style = "text-decoration: none" class = "layout-news-button" >
LEARN MORE
2020-10-22 13:18:06 +00:00
< / a >
< a tabindex = "0" class = "layout-news-close" @click ="hideNews" >
2020-04-13 16:02:51 +00:00
< i class = "pi pi-times" > < / i >
< / a >
< / div >
2020-10-22 13:18:06 +00:00
< / div >
2020-04-13 16:02:51 +00:00
2020-05-07 19:13:58 +00:00
< app -topbar @menubutton-click ="onMenuButtonClick" @change-theme ="changeTheme" :theme ="theme" / >
2018-12-26 09:39:12 +00:00
< app -menu :active ="sidebarActive" / >
2020-05-07 19:13:58 +00:00
< app -configurator @change-theme ="changeTheme" :theme ="theme" / >
2018-12-26 09:36:00 +00:00
< div : class = "['layout-mask', {'layout-mask-active': sidebarActive}]" @click ="onMaskClick" > < / div >
2018-12-06 18:26:49 +00:00
< div class = "layout-content" >
< router -view / >
2018-12-06 18:45:40 +00:00
< app -footer / >
2018-12-06 18:26:49 +00:00
< / div >
2019-02-08 10:55:52 +00:00
< Toast / >
2020-07-16 13:58:46 +00:00
< Toast position = "top-left" group = "tl" / >
< Toast position = "bottom-left" group = "bl" / >
< Toast position = "bottom-right" group = "br" / >
2018-12-04 07:08:40 +00:00
< / div >
< / template >
2018-12-06 18:26:49 +00:00
< script >
2020-07-03 06:51:54 +00:00
import DomHandler from '@/components/utils/DomHandler' ;
2018-12-06 18:45:40 +00:00
import AppTopBar from '@/AppTopBar.vue' ;
import AppMenu from '@/AppMenu.vue' ;
import AppFooter from '@/AppFooter.vue' ;
2019-12-20 13:49:40 +00:00
import AppConfigurator from '@/AppConfigurator.vue' ;
2021-03-02 08:54:37 +00:00
import EventBus from '@/AppEventBus' ;
2018-12-06 18:26:49 +00:00
2018-12-06 18:45:40 +00:00
export default {
2018-12-26 09:36:00 +00:00
data ( ) {
return {
2020-04-13 16:02:51 +00:00
sidebarActive : false ,
2021-05-06 13:12:18 +00:00
newsActive : true ,
2020-07-01 19:35:12 +00:00
theme : 'saga-blue'
2018-12-26 09:36:00 +00:00
}
} ,
2020-05-13 14:54:04 +00:00
mounted ( ) {
if ( this . isOutdatedIE ( ) ) {
this . $toast . add ( { severity : 'warn' , summary : 'Limited Functionality' , detail : 'Although PrimeVue supports IE11, ThemeSwitcher in this application cannot be not fully supported by your browser. Please use a modern browser for the best experience of the showcase.' } ) ;
}
2020-10-22 13:18:06 +00:00
this . newsActive = this . newsActive && sessionStorage . getItem ( 'primevue-news-hidden' ) == null ;
2021-02-18 09:57:08 +00:00
this . initTheme ( ) ;
2020-05-13 14:54:04 +00:00
} ,
2018-12-26 09:39:12 +00:00
watch : {
2020-02-27 07:47:33 +00:00
$route : {
immediate : true ,
handler ( to ) {
2020-05-27 06:52:02 +00:00
let route = window . location . href . split ( '/#' ) [ 1 ] ;
if ( to . path === route ) {
window [ 'gtag' ] ( 'config' , 'UA-93461466-1' , {
'page_path' : '/primevue' + to . path
} ) ;
}
2020-05-27 08:05:46 +00:00
2020-02-27 07:47:33 +00:00
this . sidebarActive = false ;
2020-07-03 06:51:54 +00:00
DomHandler . removeClass ( document . body , 'blocked-scroll' ) ;
2020-02-27 07:47:33 +00:00
this . $toast . removeAllGroups ( ) ;
}
2018-12-26 09:39:12 +00:00
}
} ,
2018-12-26 09:36:00 +00:00
methods : {
2021-02-18 09:57:08 +00:00
initTheme ( ) {
let appTheme ;
const queryString = window . location . search ;
if ( queryString )
appTheme = new URLSearchParams ( queryString . substring ( 1 ) ) . get ( 'theme' ) ;
else
appTheme = localStorage . getItem ( 'theme' ) ;
if ( appTheme ) {
let darkTheme = this . isDarkTheme ( appTheme ) ;
this . changeTheme ( {
theme : appTheme ,
dark : darkTheme
} ) ;
}
} ,
2018-12-26 09:36:00 +00:00
onMenuButtonClick ( ) {
2020-07-03 06:51:54 +00:00
if ( this . sidebarActive ) {
this . sidebarActive = false ;
DomHandler . removeClass ( document . body , 'blocked-scroll' ) ;
}
else {
this . sidebarActive = true ;
DomHandler . addClass ( document . body , 'blocked-scroll' ) ;
}
2018-12-26 09:36:00 +00:00
} ,
2019-02-08 14:14:35 +00:00
onMaskClick ( ) {
2018-12-26 09:36:00 +00:00
this . sidebarActive = false ;
2020-07-03 06:51:54 +00:00
DomHandler . removeClass ( document . body , 'blocked-scroll' ) ;
2020-04-13 16:02:51 +00:00
} ,
hideNews ( ) {
this . newsActive = false ;
2020-10-22 13:18:06 +00:00
sessionStorage . setItem ( 'primevue-news-hidden' , 'true' ) ;
2020-05-07 19:13:58 +00:00
} ,
changeTheme ( event ) {
let themeElement = document . getElementById ( 'theme-link' ) ;
themeElement . setAttribute ( 'href' , themeElement . getAttribute ( 'href' ) . replace ( this . theme , event . theme ) ) ;
this . theme = event . theme ;
this . activeMenuIndex = null ;
2020-05-13 12:25:03 +00:00
2020-09-11 16:50:20 +00:00
EventBus . emit ( 'change-theme' , event ) ;
2020-06-20 09:40:01 +00:00
this . $appState . darkTheme = event . dark ;
2020-05-13 12:53:01 +00:00
2020-06-25 13:04:00 +00:00
if ( event . theme . startsWith ( 'md' ) ) {
2020-12-09 12:24:11 +00:00
this . $primevue . config . ripple = true ;
2020-06-25 13:04:00 +00:00
}
2021-02-24 07:49:23 +00:00
2021-02-18 09:57:08 +00:00
localStorage . setItem ( 'theme' , this . theme ) ;
2020-05-07 19:13:58 +00:00
} ,
addClass ( element , className ) {
if ( ! this . hasClass ( 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-05-13 14:54:04 +00:00
} ,
isOutdatedIE ( ) {
let ua = window . navigator . userAgent ;
if ( ua . indexOf ( 'MSIE ' ) > 0 || ua . indexOf ( 'Trident/' ) > 0 ) {
return true ;
}
2020-05-13 15:04:28 +00:00
2020-05-13 14:54:04 +00:00
return false ;
2021-02-18 09:57:08 +00:00
} ,
isDarkTheme ( theme ) {
2021-02-25 13:38:01 +00:00
return theme . indexOf ( 'dark' ) !== - 1 || theme . indexOf ( 'vela' ) !== - 1 || theme . indexOf ( 'arya' ) !== - 1 || theme . indexOf ( 'luna' ) !== - 1 ;
2020-06-26 16:05:42 +00:00
}
2018-12-26 09:36:00 +00:00
} ,
2020-06-20 09:40:01 +00:00
computed : {
containerClass ( ) {
2020-06-25 13:04:00 +00:00
return [ {
2020-06-26 08:06:51 +00:00
'layout-news-active' : this . newsActive ,
2020-06-25 13:04:00 +00:00
'p-input-filled' : this . $appState . inputStyle === 'filled' ,
2020-12-09 12:24:11 +00:00
'p-ripple-disabled' : this . $primevue . config . ripple === false
2020-06-25 13:04:00 +00:00
} ] ;
2020-06-20 09:40:01 +00:00
}
} ,
2018-12-06 18:45:40 +00:00
components : {
'app-topbar' : AppTopBar ,
'app-menu' : AppMenu ,
2019-12-20 13:49:40 +00:00
'app-footer' : AppFooter ,
'app-configurator' : AppConfigurator
2020-06-20 09:40:01 +00:00
}
2018-12-04 07:08:40 +00:00
}
2018-12-06 18:26:49 +00:00
< / script >
< style lang = "scss" >
2020-05-12 08:31:09 +00:00
@ import './assets/styles/app/app.scss' ;
2018-12-04 07:08:40 +00:00
< / style >