From 417516b0845d13d4a516379d47a6557d9544bdf0 Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Thu, 14 May 2020 11:48:25 +0300 Subject: [PATCH] Add icons slot to panel and demo --- src/assets/styles/app/_content.scss | 5 -- src/components/panel/Panel.vue | 11 +++-- src/views/panel/PanelDemo.vue | 52 +++++++++++++++++++- src/views/panel/PanelDoc.vue | 73 ++++++++++++++++++++++++++++- 4 files changed, 130 insertions(+), 11 deletions(-) diff --git a/src/assets/styles/app/_content.scss b/src/assets/styles/app/_content.scss index adcc7e7fb..01721ffd8 100644 --- a/src/assets/styles/app/_content.scss +++ b/src/assets/styles/app/_content.scss @@ -74,11 +74,6 @@ font-size: 1.5rem; font-weight: 500; color: var(--text-color); - - &:first-child, - &.first { - margin-top: 0; - } } a { diff --git a/src/components/panel/Panel.vue b/src/components/panel/Panel.vue index 5fefd0226..b194e7807 100755 --- a/src/components/panel/Panel.vue +++ b/src/components/panel/Panel.vue @@ -4,10 +4,13 @@ {{header}} - - - +
+ + + + +
diff --git a/src/views/panel/PanelDemo.vue b/src/views/panel/PanelDemo.vue index 0523fde92..25971835e 100755 --- a/src/views/panel/PanelDemo.vue +++ b/src/views/panel/PanelDemo.vue @@ -16,8 +16,14 @@ kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.

-

Toggleable

+

Advanced

+

The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding. His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, @@ -32,6 +38,50 @@ import PanelDoc from './PanelDoc'; export default { + data() { + return { + items: [ + { + label: 'Options', + items: [{ + label: 'Update', + icon: 'pi pi-refresh', + command: () => { + this.$toast.add({severity:'success', summary:'Updated', detail:'Data Updated', life: 3000}); + } + }, + { + label: 'Delete', + icon: 'pi pi-times', + command: () => { + this.$toast.add({ severity: 'warn', summary: 'Delete', detail: 'Data Deleted', life: 3000}); + } + } + ]}, + { + label: 'Navigate', + items: [{ + label: 'Vue Website', + icon: 'pi pi-external-link', + url: 'https://vuejs.org/' + }, + { + label: 'Router', + icon: 'pi pi-upload', + to: '/fileupload' + } + ]} + ] + } + }, + methods: { + toggle(event) { + this.$refs.menu.toggle(event); + }, + save() { + this.$toast.add({severity: 'success', summary: 'Success', detail: 'Data Saved', life: 3000}); + } + }, components: { 'PanelDoc': PanelDoc } diff --git a/src/views/panel/PanelDoc.vue b/src/views/panel/PanelDoc.vue index a3304caa2..cc89014e3 100755 --- a/src/views/panel/PanelDoc.vue +++ b/src/views/panel/PanelDoc.vue @@ -54,6 +54,21 @@ import Panel from 'primevue/panel'; <Panel header="Header Text" :toggleable="true" :collapsed.sync="isCollapsed"> Content </Panel> + + +

Custom Icons

+

Additional icons can be placed at the header section of the panel using the special icons slot. For a unified look, it is suggest to add .p-panel-titlebar-icon + class to your icons.

+ +<h3>Advanced</h3> +<Panel header="Godfather I"> + <template #icons> + <a tabindex="0" class="p-panel-titlebar-icon" @click="toggle"> + <span class="pi pi-cog"></span> + </a> + <Menu id="config_menu" ref="menu" :model="items" :popup="true" /> + </template> +</Panel>

Properties

@@ -156,6 +171,7 @@ import Panel from 'primevue/panel'; View on GitHub + + + + +export default { + data() { + return { + items: [ + { + label: 'Options', + items: [{ + label: 'Update', + icon: 'pi pi-refresh', + command: () => { + this.$toast.add({severity:'success', summary:'Updated', detail:'Data Updated', life: 3000}); + } + }, + { + label: 'Delete', + icon: 'pi pi-times', + command: () => { + this.$toast.add({ severity: 'warn', summary: 'Delete', detail: 'Data Deleted', life: 3000}); + } + } + ]}, + { + label: 'Navigate', + items: [{ + label: 'Vue Website', + icon: 'pi pi-external-link', + url: 'https://vuejs.org/' + }, + { + label: 'Router', + icon: 'pi pi-upload', + to: '/fileupload' + } + ]} + ] + } + }, + methods: { + toggle(event) { + this.$refs.menu.toggle(event); + }, + save() { + this.$toast.add({severity: 'success', summary: 'Success', detail: 'Data Saved', life: 3000}); + } + } +}