browser source added for overlays
parent
83c48d23b2
commit
27536912a3
|
@ -426,6 +426,115 @@ export default defineComponent({
|
|||
}
|
||||
});
|
||||
<\\/script>
|
||||
`
|
||||
},
|
||||
'browser-source': {
|
||||
tabName: 'Browser Source',
|
||||
imports: `<script src="https://unpkg.com/primevue@^3/confirmdialog/confirmdialog.min.js"><\\/script>
|
||||
<script src="https://unpkg.com/primevue@^3/confirmationservice/confirmationservice.min.js"><\\/script>
|
||||
<script src="https://unpkg.com/primevue@^3/toast/toast.min.js"><\\/script>
|
||||
<script src="https://unpkg.com/primevue@^3/toastservice/toastservice.min.js"><\\/script>`,
|
||||
content: `
|
||||
<div id="app">
|
||||
<p-toast></p-toast>
|
||||
<p-confirmdialog></p-confirmdialog>
|
||||
<p-confirmdialog group="positionDialog"></p-confirmdialog>
|
||||
|
||||
<div class="card">
|
||||
<h5>Basic</h5>
|
||||
<p-button @click="confirm1()" icon="pi pi-check" label="Confirm" class="p-mr-2"></p-button>
|
||||
<p-button @click="confirm2()" icon="pi pi-times" label="Delete"></p-button>
|
||||
|
||||
<h5>Position</h5>
|
||||
<div class="p-grid p-dir-col">
|
||||
<div class="p-col">
|
||||
<p-button @click="confirmPosition('left')" icon="pi pi-arrow-right" label="Left" class="p-button-help p-mr-2"></p-button>
|
||||
<p-button @click="confirmPosition('right')" icon="pi pi-arrow-left" label="Right" class="p-button-help"></p-button>
|
||||
</div>
|
||||
<div class="p-col">
|
||||
<p-button @click="confirmPosition('topleft')" icon="pi pi-arrow-down" label="TopLeft" class="p-button-warning p-mr-2"></p-button>
|
||||
<p-button @click="confirmPosition('top')" icon="pi pi-arrow-down" label="Top" class="p-button-warning p-mr-2"></p-button>
|
||||
<p-button @click="confirmPosition('topright')" icon="pi pi-arrow-down" label="TopRight" class="p-button-warning"></p-button>
|
||||
</div>
|
||||
<div class="p-col">
|
||||
<p-button @click="confirmPosition('bottomleft')" icon="pi pi-arrow-up" label="BottomLeft" class="p-button-success p-mr-2"></p-button>
|
||||
<p-button @click="confirmPosition('bottom')" icon="pi pi-arrow-up" label="Bottom" class="p-button-success p-mr-2"></p-button>
|
||||
<p-button @click="confirmPosition('bottomright')" icon="pi pi-arrow-up" label="BottomRight" class="p-button-success"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
const { createApp } = Vue;
|
||||
const { useConfirm } = primevue.useconfirm;
|
||||
const { useToast } = primevue.usetoast;
|
||||
|
||||
const App = {
|
||||
setup() {
|
||||
const confirm = useConfirm();
|
||||
const toast = useToast();
|
||||
|
||||
const confirm1 = () => {
|
||||
confirm.require({
|
||||
message: 'Are you sure you want to proceed?',
|
||||
header: 'Confirmation',
|
||||
icon: 'pi pi-exclamation-triangle',
|
||||
accept: () => {
|
||||
toast.add({severity:'info', summary:'Confirmed', detail:'You have accepted', life: 3000});
|
||||
},
|
||||
reject: () => {
|
||||
toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const confirm2 = () => {
|
||||
confirm.require({
|
||||
message: 'Do you want to delete this record?',
|
||||
header: 'Delete Confirmation',
|
||||
icon: 'pi pi-info-circle',
|
||||
acceptClass: 'p-button-danger',
|
||||
accept: () => {
|
||||
toast.add({severity:'info', summary:'Confirmed', detail:'Record deleted', life: 3000});
|
||||
},
|
||||
reject: () => {
|
||||
toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const confirmPosition = (position) => {
|
||||
confirm.require({
|
||||
group: 'positionDialog',
|
||||
message: 'Do you want to delete this record?',
|
||||
header: 'Delete Confirmation',
|
||||
icon: 'pi pi-info-circle',
|
||||
position: position,
|
||||
accept: () => {
|
||||
toast.add({severity:'info', summary:'Confirmed', detail:'Record deleted', life: 3000});
|
||||
},
|
||||
reject: () => {
|
||||
toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return { confirm1, confirm2, confirmPosition };
|
||||
},
|
||||
components: {
|
||||
"p-confirmdialog": primevue.confirmdialog,
|
||||
"p-toast": primevue.toast,
|
||||
"p-button": primevue.button
|
||||
}
|
||||
};
|
||||
|
||||
createApp(App)
|
||||
.use(primevue.config.default)
|
||||
.use(primevue.confirmationservice)
|
||||
.use(primevue.toastservice)
|
||||
.mount("#app");
|
||||
<\\/script>
|
||||
`
|
||||
}
|
||||
}
|
||||
|
|
|
@ -354,6 +354,79 @@ export default defineComponent({
|
|||
},
|
||||
})
|
||||
<\\/script>
|
||||
`
|
||||
},
|
||||
'browser-source': {
|
||||
tabName: 'Browser Source',
|
||||
imports: `<script src="https://unpkg.com/primevue@^3/confirmpopup/confirmpopup.min.js"><\\/script>
|
||||
<script src="https://unpkg.com/primevue@^3/confirmationservice/confirmationservice.min.js"><\\/script>
|
||||
<script src="https://unpkg.com/primevue@^3/toast/toast.min.js"><\\/script>
|
||||
<script src="https://unpkg.com/primevue@^3/toastservice/toastservice.min.js"><\\/script>`,
|
||||
content: `
|
||||
<div id="app">
|
||||
<p-confirmpopup></p-confirmpopup>
|
||||
<p-toast></p-toast>
|
||||
|
||||
<div class="card">
|
||||
<p-button @click="confirm1($event)" icon="pi pi-check" label="Confirm" class="p-mr-2"></p-button>
|
||||
<p-button @click="confirm2($event)" icon="pi pi-times" label="Delete" class="p-button-danger p-button-outlined"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
const { createApp } = Vue;
|
||||
const { useConfirm } = primevue.useconfirm;
|
||||
const { useToast } = primevue.usetoast;
|
||||
|
||||
const App = {
|
||||
setup() {
|
||||
const confirm = useConfirm();
|
||||
const toast = useToast();
|
||||
|
||||
const confirm1 = (event) => {
|
||||
confirm.require({
|
||||
target: event.currentTarget,
|
||||
message: 'Are you sure you want to proceed?',
|
||||
icon: 'pi pi-exclamation-triangle',
|
||||
accept: () => {
|
||||
toast.add({severity:'info', summary:'Confirmed', detail:'You have accepted', life: 3000});
|
||||
},
|
||||
reject: () => {
|
||||
toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const confirm2 = (event) => {
|
||||
confirm.require({
|
||||
target: event.currentTarget,
|
||||
message: 'Do you want to delete this record?',
|
||||
icon: 'pi pi-info-circle',
|
||||
acceptClass: 'p-button-danger',
|
||||
accept: () => {
|
||||
toast.add({severity:'info', summary:'Confirmed', detail:'Record deleted', life: 3000});
|
||||
},
|
||||
reject: () => {
|
||||
toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return { confirm1, confirm2 };
|
||||
},
|
||||
components: {
|
||||
"p-confirmpopup": primevue.confirmpopup,
|
||||
"p-toast": primevue.toast,
|
||||
"p-button": primevue.button
|
||||
}
|
||||
};
|
||||
|
||||
createApp(App)
|
||||
.use(primevue.config.default)
|
||||
.use(primevue.confirmationservice)
|
||||
.use(primevue.toastservice)
|
||||
.mount("#app");
|
||||
<\\/script>
|
||||
`
|
||||
}
|
||||
}
|
||||
|
|
|
@ -751,6 +751,220 @@ p {
|
|||
min-width: 6rem;
|
||||
}
|
||||
</style>`
|
||||
},
|
||||
'browser-source': {
|
||||
tabName: 'Browser Source',
|
||||
content: `
|
||||
<div id="app">
|
||||
<h5>Basic</h5>
|
||||
<p-button label="Show" icon="pi pi-external-link" @click="openBasic"></p-button>
|
||||
<p-dialog header="Header" v-model:visible="displayBasic" :style="{width: '50vw'}">
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
||||
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
|
||||
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
<template #footer>
|
||||
<p-button label="No" icon="pi pi-times" @click="closeBasic" class="p-button-text"></p-button>
|
||||
<p-button label="Yes" icon="pi pi-check" @click="closeBasic" autofocus></p-button>
|
||||
</template>
|
||||
</p-dialog>
|
||||
|
||||
<p-button label="Long Content" icon="pi pi-external-link" @click="openBasic2"></p-button>
|
||||
<p-dialog header="Header" v-model:visible="displayBasic2" :style="{width: '50vw'}">
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
|
||||
ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
|
||||
culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
|
||||
<p>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae
|
||||
dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est,
|
||||
qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam,
|
||||
quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur,
|
||||
vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
|
||||
|
||||
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident,
|
||||
similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio
|
||||
cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe
|
||||
eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.</p>
|
||||
<template #footer>
|
||||
<p-button label="No" icon="pi pi-times" @click="closeBasic2" class="p-button-text"></p-button>
|
||||
<p-button label="Yes" icon="pi pi-check" @click="closeBasic2" autofocus></p-button>
|
||||
</template>
|
||||
</p-dialog>
|
||||
|
||||
<h5>Modal</h5>
|
||||
<p-button label="Show" icon="pi pi-external-link" @click="openModal"></p-button>
|
||||
<p-dialog header="Header" v-model:visible="displayModal" :style="{width: '50vw'}" :modal="true">
|
||||
<p class="p-m-0">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
|
||||
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
<template #footer>
|
||||
<p-button label="No" icon="pi pi-times" @click="closeModal" class="p-button-text"></p-button>
|
||||
<p-button label="Yes" icon="pi pi-check" @click="closeModal" autofocus></p-button>
|
||||
</template>
|
||||
</p-dialog>
|
||||
|
||||
<h5>Responsive</h5>
|
||||
<p-button label="Show" icon="pi pi-external-link" @click="openResponsive"></p-button>
|
||||
<p-dialog header="Header" v-model:visible="displayResponsive" :breakpoints="{'960px': '75vw'}" :style="{width: '50vw'}">
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
||||
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
|
||||
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
<template #footer>
|
||||
<p-button label="No" icon="pi pi-times" @click="closeResponsive" class="p-button-text"></p-button>
|
||||
<p-button label="Yes" icon="pi pi-check" @click="closeResponsive" autofocus></p-button>
|
||||
</template>
|
||||
</p-dialog>
|
||||
|
||||
<h5>Confirmation</h5>
|
||||
<p-button label="Confirm" icon="pi pi-external-link" @click="openConfirmation"></p-button>
|
||||
<p-dialog header="Confirmation" v-model:visible="displayConfirmation" :style="{width: '350px'}" :modal="true">
|
||||
<div class="confirmation-content">
|
||||
<i class="pi pi-exclamation-triangle p-mr-3" style="font-size: 2rem"></i>
|
||||
<span>Are you sure you want to proceed?</span>
|
||||
</div>
|
||||
<template #footer>
|
||||
<p-button label="No" icon="pi pi-times" @click="closeConfirmation" class="p-button-text"></p-button>
|
||||
<p-button label="Yes" icon="pi pi-check" @click="closeConfirmation" class="p-button-text" autofocus></p-button>
|
||||
</template>
|
||||
</p-dialog>
|
||||
|
||||
<h5>Maximizable</h5>
|
||||
<p-button label="Show" icon="pi pi-external-link" @click="openMaximizable"></p-button>
|
||||
<p-dialog header="Header" v-model:visible="displayMaximizable" :style="{width: '50vw'}" :maximizable="true" :modal="true">
|
||||
<p class="p-m-0">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
|
||||
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
<template #footer>
|
||||
<p-button label="No" icon="pi pi-times" @click="closeMaximizable" class="p-button-text"></p-button>
|
||||
<p-button label="Yes" icon="pi pi-check" @click="closeMaximizable" autofocus></p-button>
|
||||
</template>
|
||||
</p-dialog>
|
||||
|
||||
<h5>Position</h5>
|
||||
<div class="p-grid p-dir-col">
|
||||
<div class="p-col">
|
||||
<p-button label="Left" icon="pi pi-arrow-right" @click="openPosition('left')" class="p-button-warning"></p-button>
|
||||
<p-button label="Right" icon="pi pi-arrow-left" @click="openPosition('right')" class="p-button-warning"></p-button>
|
||||
</div>
|
||||
<div class="p-col">
|
||||
<p-button label="Top" icon="pi pi-arrow-down" @click="openPosition('top')" class="p-button-warning"></p-button>
|
||||
<p-button label="TopLeft" icon="pi pi-arrow-down" @click="openPosition('topleft')" class="p-button-warning"></p-button>
|
||||
<p-button label="TopRight" icon="pi pi-arrow-down" @click="openPosition('topright')" class="p-button-warning"></p-button>
|
||||
</div>
|
||||
<div class="p-col">
|
||||
<p-button label="Bottom" icon="pi pi-arrow-up" @click="openPosition('bottom')" class="p-button-warning"></p-button>
|
||||
<p-button label="BottomLeft" icon="pi pi-arrow-up" @click="openPosition('bottomleft')" class="p-button-warning"></p-button>
|
||||
<p-button label="BottomRight" icon="pi pi-arrow-up" @click="openPosition('bottomright')" class="p-button-warning"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p-dialog header="Header" v-model:visible="displayPosition" :style="{width: '50vw'}" :position="position" :modal="true">
|
||||
<p class="p-m-0">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
|
||||
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
<template #footer>
|
||||
<p-button label="No" icon="pi pi-times" @click="closePosition" class="p-button-text"></p-button>
|
||||
<p-button label="Yes" icon="pi pi-check" @click="closePosition" autofocus></p-button>
|
||||
</template>
|
||||
</p-dialog>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
const { createApp, ref } = Vue;
|
||||
|
||||
const App = {
|
||||
setup() {
|
||||
const displayBasic = ref(false);
|
||||
const displayBasic2 = ref(false);
|
||||
const displayModal = ref(false);
|
||||
const displayResponsive = ref(false);
|
||||
const displayConfirmation = ref(false);
|
||||
const displayMaximizable = ref(false);
|
||||
const displayPosition = ref(false);
|
||||
const position = ref('center');
|
||||
|
||||
const openBasic = () => {
|
||||
displayBasic.value = true;
|
||||
};
|
||||
const closeBasic = () => {
|
||||
displayBasic.value = false;
|
||||
};
|
||||
const openBasic2 = () => {
|
||||
displayBasic2.value = true;
|
||||
};
|
||||
const closeBasic2 = () => {
|
||||
displayBasic2.value = false;
|
||||
};
|
||||
const openResponsive = () => {
|
||||
displayResponsive.value = true;
|
||||
};
|
||||
const closeResponsive = () => {
|
||||
displayResponsive.value = false;
|
||||
};
|
||||
const openModal = () => {
|
||||
displayModal.value = true;
|
||||
};
|
||||
const closeModal = () => {
|
||||
displayModal.value = false;
|
||||
}
|
||||
const openConfirmation = () => {
|
||||
displayConfirmation.value = true;
|
||||
};
|
||||
const closeConfirmation = () => {
|
||||
displayConfirmation.value = false;
|
||||
};
|
||||
const openMaximizable = () => {
|
||||
displayMaximizable.value = true;
|
||||
};
|
||||
const closeMaximizable = () => {
|
||||
displayMaximizable.value = false;
|
||||
};
|
||||
const openPosition = (pos) => {
|
||||
position.value = pos;
|
||||
displayPosition.value = true;
|
||||
};
|
||||
const closePosition = () => {
|
||||
displayPosition.value = false;
|
||||
};
|
||||
|
||||
return { displayBasic, displayBasic2, displayModal, displayResponsive, displayConfirmation, displayMaximizable,
|
||||
displayPosition, position, openBasic, openBasic2, closeBasic, closeBasic2, openResponsive, closeResponsive,
|
||||
openModal, closeModal, openConfirmation, closeConfirmation, openMaximizable, closeMaximizable, openPosition, closePosition}
|
||||
},
|
||||
components: {
|
||||
"p-dialog": primevue.dialog,
|
||||
"p-button": primevue.button
|
||||
}
|
||||
};
|
||||
|
||||
createApp(App)
|
||||
.use(primevue.config.default)
|
||||
.mount("#app");
|
||||
<\\/script>
|
||||
|
||||
<style>
|
||||
.p-button {
|
||||
margin: 0.3rem .5rem;
|
||||
min-width: 10rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.confirmation-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.p-dialog .p-button {
|
||||
min-width: 6rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,6 +327,91 @@ button {
|
|||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23)
|
||||
}
|
||||
</style>`
|
||||
},
|
||||
'browser-source': {
|
||||
tabName: 'Browser Source',
|
||||
imports: `<script src="https://unpkg.com/primevue@^3/overlaypanel/overlaypanel.min.js"><\\/script>
|
||||
<script src="https://unpkg.com/primevue@^3/datatable/datatable.min.js"><\\/script>
|
||||
<script src="https://unpkg.com/primevue@^3/column/column.min.js"><\\/script>
|
||||
<script src="https://unpkg.com/primevue@^3/toast/toast.min.js"><\\/script>
|
||||
<script src="https://unpkg.com/primevue@^3/toastservice/toastservice.min.js"><\\/script>
|
||||
<script src="./ProductService.js"><\\/script>`,
|
||||
content: `
|
||||
<div id="app">
|
||||
<p-toast></p-toast>
|
||||
|
||||
<p-button type="button" icon="pi pi-search" :label="selectedProduct ? selectedProduct.name : 'Select a Product'" @click="toggle" aria:haspopup="true" aria-controls="overlay_panel"></p-button>
|
||||
|
||||
<p-overlaypanel ref="op" append-to="body" :show-close-icon="true" id="overlay_panel" style="width: 450px" :breakpoints="{'960px': '75vw'}">
|
||||
<p-datatable :value="products" v-model:selection="selectedProduct" selection-mode="single" :paginator="true" :rows="5" @row-select="onProductSelect" responsive-layout="scroll" >
|
||||
<p-column field="name" header="Name" sortable style="width: 50%"></p-column>
|
||||
<p-column header="Image" style="width: 20%">
|
||||
<template #body="slotProps">
|
||||
<img src="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" :alt="slotProps.data.image" class="product-image" />
|
||||
</template>
|
||||
</p-column>
|
||||
<p-column field="price" header="Price" sortable style="width: 30%">
|
||||
<template #body="slotProps">
|
||||
{{formatCurrency(slotProps.data.price)}}
|
||||
</template>
|
||||
</p-column>
|
||||
</p-datatable>
|
||||
</p-overlaypanel>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
const { createApp, ref, onMounted } = Vue;
|
||||
const { useToast } = primevue.usetoast;
|
||||
|
||||
const App = {
|
||||
setup() {
|
||||
onMounted(() => {
|
||||
productService.value.getProductsSmall().then(data => products.value = data);
|
||||
})
|
||||
|
||||
const toast = useToast();
|
||||
const op = ref();
|
||||
const productService = ref(new ProductService());
|
||||
const products = ref();
|
||||
const selectedProduct = ref();
|
||||
const toggle = (event) => {
|
||||
op.value.toggle(event);
|
||||
};
|
||||
const formatCurrency = (value) => {
|
||||
return value.toLocaleString('en-US', {style: 'currency', currency: 'USD'});
|
||||
};
|
||||
const onProductSelect = (event) => {
|
||||
op.value.hide();
|
||||
toast.add({severity:'info', summary: 'Product Selected', detail: event.data.name, life: 3000});
|
||||
};
|
||||
|
||||
return { op, productService, products, selectedProduct, toggle, formatCurrency, onProductSelect}
|
||||
},
|
||||
components: {
|
||||
"p-overlaypanel": primevue.overlaypanel,
|
||||
"p-datatable": primevue.datatable,
|
||||
"p-column": primevue.column,
|
||||
"p-button": primevue.button,
|
||||
"p-toast": primevue.toast
|
||||
}
|
||||
};
|
||||
|
||||
createApp(App)
|
||||
.use(primevue.config.default)
|
||||
.use(primevue.toastservice)
|
||||
.mount("#app");
|
||||
<\\/script>
|
||||
|
||||
<style>
|
||||
.p-button {
|
||||
min-width: 15rem;
|
||||
}
|
||||
|
||||
.product-image {
|
||||
width: 50px;
|
||||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23)
|
||||
}
|
||||
</style>`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -303,6 +303,63 @@ export default {
|
|||
}
|
||||
}
|
||||
<\\/script>
|
||||
`
|
||||
},
|
||||
'browser-source': {
|
||||
tabName: 'Browser Source',
|
||||
imports: `<script src="https://unpkg.com/primevue@^3/sidebar/sidebar.min.js"><\\/script>`,
|
||||
content: `
|
||||
<div id="app">
|
||||
<p-button icon="pi pi-arrow-right" @click="visibleLeft = true" class="p-mr-2"></p-button>
|
||||
<p-button icon="pi pi-arrow-left" @click="visibleRight = true" class="p-mr-2"></p-button>
|
||||
<p-button icon="pi pi-arrow-down" @click="visibleTop = true" class="p-mr-2"></p-button>
|
||||
<p-button icon="pi pi-arrow-up" @click="visibleBottom = true" class="p-mr-2"></p-button>
|
||||
<p-button icon="pi pi-th-large" @click="visibleFull = true"></p-button>
|
||||
|
||||
<p-sidebar v-model:visible="visibleLeft" :base-z-index="1000">
|
||||
<h3>Left Sidebar</h3>
|
||||
</p-sidebar>
|
||||
|
||||
<p-sidebar v-model:visible="visibleRight" :base-z-index="1000" position="right">
|
||||
<h3>Right Sidebar</h3>
|
||||
</p-sidebar>
|
||||
|
||||
<p-sidebar v-model:visible="visibleTop" :base-z-index="1000" position="top">
|
||||
<h3>Top Sidebar</h3>
|
||||
</p-sidebar>
|
||||
|
||||
<p-sidebar v-model:visible="visibleBottom" :base-z-index="1000" position="bottom">
|
||||
<h3>Bottom Sidebar</h3>
|
||||
</p-sidebar>
|
||||
|
||||
<p-sidebar v-model:visible="visibleFull" :base-z-index="1000" position="full">
|
||||
<h3>Full Screen</h3>
|
||||
</p-sidebar>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const { createApp, ref } = Vue;
|
||||
|
||||
const App = {
|
||||
setup() {
|
||||
const visibleLeft = ref(false);
|
||||
const visibleRight = ref(false);
|
||||
const visibleTop = ref(false);
|
||||
const visibleBottom = ref(false);
|
||||
const visibleFull = ref(false);
|
||||
|
||||
return { visibleLeft, visibleRight, visibleTop, visibleBottom, visibleFull }
|
||||
},
|
||||
components: {
|
||||
"p-sidebar": primevue.sidebar,
|
||||
"p-button": primevue.button
|
||||
}
|
||||
};
|
||||
|
||||
createApp(App)
|
||||
.use(primevue.config.default)
|
||||
.mount("#app");
|
||||
<\\/script>
|
||||
`
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,6 +218,65 @@ export default {
|
|||
border-right-color: var(--pink-800);
|
||||
}
|
||||
</style>
|
||||
`
|
||||
},
|
||||
'browser-source': {
|
||||
tabName: 'Browser Source',
|
||||
imports: `<script src="https://unpkg.com/primevue@^3/tooltip/tooltip.min.js"><\\/script>`,
|
||||
content: `
|
||||
<div id="app">
|
||||
<h5>Positions</h5>
|
||||
<div class="p-grid p-fluid">
|
||||
<div class="p-col-12 p-md-3">
|
||||
<p-inputtext type="text" placeholder="Right" v-tooltip.right="'Enter your username'"></p-inputtext>
|
||||
</div>
|
||||
<div class="p-col-12 p-md-3">
|
||||
<p-inputtext type="text" placeholder="Top" v-tooltip.top="'Enter your username'"></p-inputtext>
|
||||
</div>
|
||||
<div class="p-col-12 p-md-3">
|
||||
<p-inputtext type="text" placeholder="Bottom" v-tooltip.bottom="'Enter your username'"></p-inputtext>
|
||||
</div>
|
||||
<div class="p-col-12 p-md-3">
|
||||
<p-inputtext type="text" placeholder="Left" v-tooltip.left="'Enter your username'"></p-inputtext>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5>Focus and Blur</h5>
|
||||
<p-inputtext type="text" placeholder="Focus" v-tooltip.bottom.focus="'Enter your username'"></p-inputtext>
|
||||
|
||||
<h5>Button</h5>
|
||||
<p-button type="button" label="Save" icon="pi pi-check" v-tooltip="'Click to proceed'"></p-button>
|
||||
|
||||
<h5>Custom Class</h5>
|
||||
<p-inputtext type="text" placeholder="Custom Class" v-tooltip.right="{value:'Invalid username', class: 'custom-error'}"></p-inputtext>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
const { createApp } = Vue;
|
||||
const Tooltip = primevue.tooltip;
|
||||
|
||||
const App = {
|
||||
components: {
|
||||
"p-inputtext": primevue.inputtext,
|
||||
"p-button": primevue.button
|
||||
}
|
||||
};
|
||||
|
||||
createApp(App)
|
||||
.use(primevue.config.default)
|
||||
.directive("tooltip", Tooltip)
|
||||
.mount("#app");
|
||||
<\\/script>
|
||||
|
||||
<style>
|
||||
.custom-error .p-tooltip-text {
|
||||
background-color: var(--pink-800);
|
||||
color: rgb(255, 255, 255);
|
||||
}
|
||||
.custom-error.p-tooltip-right .p-tooltip-arrow {
|
||||
border-right-color: var(--pink-800);
|
||||
}
|
||||
</style>
|
||||
`
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue