2022-09-06 11:52:18 +00:00
< template >
2022-09-14 14:26:41 +00:00
< div class = "layout-wrapper" :class ="containerClass" >
< app -news v -if = " $ appState.newsActive " / >
2023-02-28 08:29:30 +00:00
< app -topbar @menubutton-click ="onMenuButtonClick" @configbutton-click ="onConfigButtonClick" / >
2022-09-14 14:26:41 +00:00
< app -menu :active ="sidebarActive" / >
2023-03-29 10:29:26 +00:00
< app -configurator :configActive ="appConfigActive" @updateConfigActive ="onUpdateConfigActive" / >
2022-09-14 14:26:41 +00:00
< div : class = "['layout-mask', { 'layout-mask-active': sidebarActive }]" @click ="onMaskClick" > < / div >
< div class = "layout-content" >
< div class = "layout-content-inner" >
< slot > < / slot >
< app -footer / >
< / div >
< / div >
< Toast / >
< Toast position = "top-left" group = "tl" / >
< Toast position = "bottom-left" group = "bl" / >
< Toast position = "bottom-right" group = "br" / >
< / div >
2022-09-06 11:52:18 +00:00
< / template >
< script >
2023-03-26 05:22:57 +00:00
import DomHandler from '@/components/lib/utils/DomHandler' ;
2022-09-06 11:52:18 +00:00
import AppConfigurator from './AppConfigurator.vue' ;
2022-12-09 09:02:20 +00:00
import AppFooter from './AppFooter.vue' ;
import AppMenu from './AppMenu.vue' ;
2022-09-06 11:52:18 +00:00
import AppNews from './AppNews.vue' ;
2022-12-09 09:02:20 +00:00
import AppTopBar from './AppTopBar.vue' ;
2022-09-06 11:52:18 +00:00
export default {
2022-09-14 14:26:41 +00:00
data ( ) {
return {
2023-02-28 08:29:30 +00:00
sidebarActive : false ,
appConfigActive : false
2022-09-14 14:26:41 +00:00
} ;
} ,
2022-12-19 12:44:12 +00:00
watch : {
$route : {
immediate : true ,
handler ( to ) {
if ( ! process . client || typeof window === 'undefined' ) {
return ;
}
2022-09-06 11:52:18 +00:00
2022-12-19 12:44:12 +00:00
this . sidebarActive = false ;
DomHandler . removeClass ( document . body , 'blocked-scroll' ) ;
this . $toast . removeAllGroups ( ) ;
}
}
} ,
2022-12-20 12:32:32 +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.'
} ) ;
}
} ,
2022-09-14 14:26:41 +00:00
methods : {
onMenuButtonClick ( ) {
if ( this . sidebarActive ) {
this . sidebarActive = false ;
DomHandler . removeClass ( document . body , 'blocked-scroll' ) ;
} else {
this . sidebarActive = true ;
DomHandler . addClass ( document . body , 'blocked-scroll' ) ;
}
} ,
onMaskClick ( ) {
this . sidebarActive = false ;
DomHandler . removeClass ( document . body , 'blocked-scroll' ) ;
} ,
hideNews ( event ) {
this . $appState . newsActive = false ;
sessionStorage . setItem ( 'primevue-news-hidden' , 'true' ) ;
event . stopPropagation ( ) ;
} ,
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 ) ;
} ,
isOutdatedIE ( ) {
let ua = window . navigator . userAgent ;
2022-12-20 12:32:32 +00:00
2022-09-14 14:26:41 +00:00
if ( ua . indexOf ( 'MSIE ' ) > 0 || ua . indexOf ( 'Trident/' ) > 0 ) {
return true ;
}
2022-09-06 11:52:18 +00:00
2022-09-14 14:26:41 +00:00
return false ;
} ,
redirect ( ) {
2023-03-08 13:28:23 +00:00
window . location . href = 'https://blocks.primevue.org' ;
2023-02-28 08:29:30 +00:00
} ,
onConfigButtonClick ( ) {
this . appConfigActive = true ;
2023-03-29 10:29:26 +00:00
} ,
onUpdateConfigActive ( ) {
this . appConfigActive = false ;
2022-09-14 14:26:41 +00:00
}
} ,
computed : {
containerClass ( ) {
return [
{
'layout-news-active' : this . $appState . newsActive ,
'p-input-filled' : this . $primevue . config . inputStyle === 'filled' ,
'p-ripple-disabled' : this . $primevue . config . ripple === false ,
'layout-wrapper-dark' : this . $appState . darkTheme ,
'layout-wrapper-light' : ! this . $appState . darkTheme
}
] ;
}
} ,
components : {
'app-topbar' : AppTopBar ,
'app-menu' : AppMenu ,
'app-footer' : AppFooter ,
'app-configurator' : AppConfigurator ,
'app-news' : AppNews
}
} ;
2022-09-06 11:52:18 +00:00
< / script >