From 4db09b7040f39e76d822fd6fc85918a2dfc8b478 Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Tue, 11 Dec 2018 22:37:15 +0300 Subject: [PATCH] Initiated TabView component --- src/AppMenu.vue | 1 + src/assets/styles/primevue.css | 1 + src/components/tabview/TabPanel.vue | 19 ++++ src/components/tabview/TabView.css | 147 ++++++++++++++++++++++++++++ src/components/tabview/TabView.vue | 60 ++++++++++++ src/main.js | 6 +- src/router.js | 5 + src/views/tabview/TabViewDemo.vue | 71 ++++++++++++++ 8 files changed, 309 insertions(+), 1 deletion(-) create mode 100644 src/components/tabview/TabPanel.vue create mode 100644 src/components/tabview/TabView.css create mode 100644 src/components/tabview/TabView.vue create mode 100644 src/views/tabview/TabViewDemo.vue diff --git a/src/AppMenu.vue b/src/AppMenu.vue index ac9db7d15..4d3fe946e 100644 --- a/src/AppMenu.vue +++ b/src/AppMenu.vue @@ -46,6 +46,7 @@ ● Panel ● Fieldset ● FlexGrid + ● TabView ● Toolbar diff --git a/src/assets/styles/primevue.css b/src/assets/styles/primevue.css index 9857969c1..029daab34 100644 --- a/src/assets/styles/primevue.css +++ b/src/assets/styles/primevue.css @@ -4,5 +4,6 @@ @import '../../components/button/Button.css'; @import '../../components/panel/Panel.css'; @import '../../components/fieldset/Fieldset.css'; +@import '../../components/tabview/TabView.css'; @import '../../components/textarea/Textarea.css'; @import '../../components/toolbar/Toolbar.css'; \ No newline at end of file diff --git a/src/components/tabview/TabPanel.vue b/src/components/tabview/TabPanel.vue new file mode 100644 index 000000000..b654a68bc --- /dev/null +++ b/src/components/tabview/TabPanel.vue @@ -0,0 +1,19 @@ + + + \ No newline at end of file diff --git a/src/components/tabview/TabView.css b/src/components/tabview/TabView.css new file mode 100644 index 000000000..04cbf6d95 --- /dev/null +++ b/src/components/tabview/TabView.css @@ -0,0 +1,147 @@ +.p-tabview { + padding: .25em; +} + +.p-tabview .p-tabview-nav { + margin: 0; +} + +.p-tabview .p-tabview-nav:after { + content: ""; + display: table; + clear: both; +} + +.p-tabview .p-tabview-nav li { + list-style: none; + float: left; + position: relative; + margin: 0 .125em 1px 0; + padding: 0; + white-space: nowrap; +} + +.p-tabview .p-tabview-nav li a { + float: left; + padding: .5em 1em; + text-decoration: none; +} + +.p-tabview .p-tabview-nav li.p-tabview-selected a, +.p-tabview .p-tabview-nav li.p-disabled a, +.p-tabview .p-tabview-nav li.p-state-processing a { + cursor: text; +} + +.p-tabview .p-tabview-nav li a, +.p-tabview.p-tabview-collapsible .p-tabview-nav li.p-tabview-selected a { + cursor: pointer; +} + +.p-tabview .p-tabview-panel { + border-width: 0; + padding: 1em; + background: none; +} + +.p-tabview .p-tabview-nav li { + display: block; +} + +.p-tabview .p-tabview-nav li .p-tabview-left-icon, +.p-tabview .p-tabview-nav li .p-tabview-right-icon, +.p-tabview .p-tabview-nav li .p-tabview-title { + vertical-align: middle; +} + +.p-tabview .p-tabview-nav li .p-tabview-left-icon { + margin-right: .25em; + vertical-align: middle; +} + +.p-tabview .p-tabview-nav li .p-tabview-right-icon { + margin-left: .25em; + vertical-align: middle; +} + +.p-tabview .p-tabview-nav li .p-tabview-close { + margin: 0.5em 0.3em 0 0; + cursor: pointer; +} + +/* per orientation settings */ +/* top and bottom */ +.p-tabview.p-tabview-top > .p-tabview-nav li { + border-bottom: 0; + top: 1px; +} + +.p-tabview.p-tabview-top > .p-tabview-nav { + padding: .2em .2em 0; +} + +.p-tabview.p-tabview-bottom > .p-tabview-nav { + padding: 0 .2em .2em; +} + +.p-tabview.p-tabview-bottom > .p-tabview-nav li { + border-top: 0; +} + +/* left and right*/ +.p-tabview-left:after, +.p-tabview-right:after { + clear:both; + content: "."; + display: block; + height: 0; + visibility: hidden; +} + +.p-tabview-left > .p-tabview-nav { + float:left; + width: 25%; + height: 300px; + background-image: none; + padding-top: 1px; +} + +.p-tabview-left > .p-tabview-panels { + float:right; + width: 75%; +} + +.p-tabview.p-tabview-left > .p-tabview-nav li, +.p-tabview.p-tabview-right > .p-tabview-nav li{ + display: block; + float: right; + white-space: normal; + width: 99%; +} + +.p-tabview.p-tabview-left > .p-tabview-nav li { + margin: 0 0 1px 0; + border-right:0 none; +} + +.p-tabview.p-tabview-right > .p-tabview-nav { + float:right; + width: 25%; + height: 300px; + background-image: none; + padding-top: 1px; +} + +.p-tabview.p-tabview-right > .p-tabview-panels { + float:left; + width: 75%; +} + +.p-tabview.p-tabview-right > .p-tabview-nav li { + margin: 0 0 1px 0; + border-left:0 none; +} +/* RTL */ +.p-rtl .p-tabview .p-tabview-nav li { + float: right; +} \ No newline at end of file diff --git a/src/components/tabview/TabView.vue b/src/components/tabview/TabView.vue new file mode 100644 index 000000000..0a5b244f3 --- /dev/null +++ b/src/components/tabview/TabView.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/src/main.js b/src/main.js index 6189e19ed..9c5fd43ac 100644 --- a/src/main.js +++ b/src/main.js @@ -8,6 +8,8 @@ import ListBox from './components/listbox/ListBox'; import Panel from './components/panel/Panel'; import Textarea from './components/textarea/Textarea'; import Toolbar from './components/toolbar/Toolbar'; +import TabView from './components/tabview/TabView'; +import TabPanel from './components/tabview/TabPanel'; import './assets/styles/primevue.css'; import 'primeflex/primeflex.css'; @@ -20,8 +22,10 @@ Vue.component('p-button', Button); Vue.component('p-listBox', ListBox); Vue.component('p-panel', Panel); Vue.component('p-fieldset', Fieldset); -Vue.component('p-toolbar', Toolbar); +Vue.component('p-tabView', TabView); +Vue.component('p-tabPanel', TabPanel); Vue.component('p-textarea', Textarea); +Vue.component('p-toolbar', Toolbar); new Vue({ router, diff --git a/src/router.js b/src/router.js index 9b9316dfb..e8b835ec5 100644 --- a/src/router.js +++ b/src/router.js @@ -46,6 +46,11 @@ export default new Router({ name: 'textarea', component: () => import('./views/textarea/TextareaDemo.vue') }, + { + path: '/tabview', + name: 'tabview', + component: () => import('./views/tabview/TabViewDemo.vue') + }, { path: '/toolbar', name: 'toolbar', diff --git a/src/views/tabview/TabViewDemo.vue b/src/views/tabview/TabViewDemo.vue new file mode 100644 index 000000000..81be958c3 --- /dev/null +++ b/src/views/tabview/TabViewDemo.vue @@ -0,0 +1,71 @@ + + + \ No newline at end of file