PickList pt demo added

pull/3950/head
Tuğçe Küçükoğlu 2023-05-10 01:04:21 +03:00
parent 72059c80a4
commit 1dd42253f8
4 changed files with 268 additions and 6 deletions

195
doc/picklist/pt/PTDoc.vue Normal file
View File

@ -0,0 +1,195 @@
<template>
<DocSectionText v-bind="$attrs"></DocSectionText>
<div class="card">
<PickList
v-model="products"
dataKey="id"
:pt="{
sourceList: { style: { height: '342px' } },
targetList: { style: { height: '342px' } },
moveAllToTargetButton: {
root: { class: 'bg-teal-400 border-teal-400' }
},
moveAllToSourceButton: {
root: { class: 'bg-teal-400 border-teal-400' }
}
}"
>
<template #sourceheader> Available </template>
<template #targetheader> Selected </template>
<template #item="slotProps">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem shadow-2 flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + slotProps.item.image" :alt="slotProps.item.name" />
<div class="flex-1 flex flex-column gap-2">
<span class="font-bold">{{ slotProps.item.name }}</span>
<div class="flex align-items-center gap-2">
<i class="pi pi-tag text-sm"></i>
<span>{{ slotProps.item.category }}</span>
</div>
</div>
<span class="font-bold text-900">${{ slotProps.item.price }}</span>
</div>
</template>
</PickList>
</div>
<DocSectionCode :code="code" v-bind="$attrs" :service="['ProductService']" />
</template>
<script>
import { ProductService } from '@/service/ProductService';
export default {
data() {
return {
products: null,
code: {
basic: `
<PickList
v-model="products"
dataKey="id"
:pt="{
sourceList: { style: { height: '342px' } },
targetList: { style: { height: '342px' } },
moveAllToTargetButton: {
root: { class: 'bg-teal-400 border-teal-400' }
},
moveAllToSourceButton: {
root: { class: 'bg-teal-400 border-teal-400' }
}
}"
>
<template #sourceheader> Available </template>
<template #targetheader> Selected </template>
<template #item="slotProps">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem shadow-2 flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + slotProps.item.image" :alt="slotProps.item.name" />
<div class="flex-1 flex flex-column gap-2">
<span class="font-bold">{{ slotProps.item.name }}</span>
<div class="flex align-items-center gap-2">
<i class="pi pi-tag text-sm"></i>
<span>{{ slotProps.item.category }}</span>
</div>
</div>
<span class="font-bold text-900">$ {{ slotProps.item.price }}</span>
</div>
</template>
</PickList>`,
options: `
<template>
<div class="card">
<PickList
v-model="products"
dataKey="id"
:pt="{
sourceList: { style: { height: '342px' } },
targetList: { style: { height: '342px' } },
moveAllToTargetButton: {
root: { class: 'bg-teal-400 border-teal-400' }
},
moveAllToSourceButton: {
root: { class: 'bg-teal-400 border-teal-400' }
}
}"
>
<template #sourceheader> Available </template>
<template #targetheader> Selected </template>
<template #item="slotProps">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem shadow-2 flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + slotProps.item.image" :alt="slotProps.item.name" />
<div class="flex-1 flex flex-column gap-2">
<span class="font-bold">{{ slotProps.item.name }}</span>
<div class="flex align-items-center gap-2">
<i class="pi pi-tag text-sm"></i>
<span>{{ slotProps.item.category }}</span>
</div>
</div>
<span class="font-bold text-900">$ {{ slotProps.item.price }}</span>
</div>
</template>
</PickList>
</div>
</template>
<script>
import { ProductService } from '@/service/ProductService'
export default {
data() {
return {
products: null
}
},
mounted() {
ProductService.getProductsSmall().then((data) => (this.products = [data, []]));
}
};
<\/script>`,
composition: `
<template>
<div class="card">
<PickList
v-model="products"
dataKey="id"
:pt="{
sourceList: { style: { height: '342px' } },
targetList: { style: { height: '342px' } },
moveAllToTargetButton: {
root: { class: 'bg-teal-400 border-teal-400' }
},
moveAllToSourceButton: {
root: { class: 'bg-teal-400 border-teal-400' }
}
}"
>
<template #sourceheader> Available </template>
<template #targetheader> Selected </template>
<template #item="slotProps">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem shadow-2 flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + slotProps.item.image" :alt="slotProps.item.name" />
<div class="flex-1 flex flex-column gap-2">
<span class="font-bold">{{ slotProps.item.name }}</span>
<div class="flex align-items-center gap-2">
<i class="pi pi-tag text-sm"></i>
<span>{{ slotProps.item.category }}</span>
</div>
</div>
<span class="font-bold text-900">$ {{ slotProps.item.price }}</span>
</div>
</template>
</PickList>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { ProductService } from '@/service/ProductService'
const products = ref(null);
onMounted(() => {
ProductService.getProductsSmall().then((data) => (products.value = [data, []]));
});
<\/script>`,
data: `
/* ProductService */
{
id: '1000',
code: 'f230fh0g3',
name: 'Bamboo Watch',
description: 'Product Description',
image: '/bamboo-watch.jpg',
price: 65,
category: 'Accessories',
quantity: 24,
inventoryStatus: 'INSTOCK',
rating: 5
},
...
`
}
};
},
mounted() {
ProductService.getProductsSmall().then((data) => (this.products = [data, []]));
}
};
</script>

View File

@ -0,0 +1,8 @@
<template>
<DocSectionText v-bind="$attrs">
<p>{{ $attrs.description }}</p>
</DocSectionText>
<div class="card">
<img class="w-full" src="https://primefaces.org/cdn/primevue/images/pt/wireframe-placeholder.jpg" />
</div>
</template>

41
doc/picklist/pt/index.vue Normal file
View File

@ -0,0 +1,41 @@
<template>
<div class="doc-main">
<div class="doc-intro">
<h1>PickList Pass Through</h1>
</div>
<DocSections :docs="docs" />
</div>
<DocSectionNav :docs="docs" />
</template>
<script>
import DocApiTable from '@/components/doc/DocApiTable.vue';
import { getPTOption } from '@/components/doc/helpers/PTHelper.js';
import PtDoc from './PTDoc.vue';
import PTImage from './PTImage.vue';
export default {
data() {
return {
docs: [
{
id: 'pt.image',
label: 'Wireframe',
component: PTImage
},
{
id: 'pt.doc.picklist',
label: 'PickList PT Options',
component: DocApiTable,
data: getPTOption('PickList')
},
{
id: 'pt.demo',
label: 'Demo',
component: PtDoc
}
]
};
}
};
</script>

View File

@ -1,5 +1,5 @@
<template> <template>
<DocComponent title="Vue PickList Component" header="PickList" description="PickList is used to reorder items between different lists." :componentDocs="docs" :apiDocs="['PickList']" /> <DocComponent title="Vue PickList Component" header="PickList" description="PickList is used to reorder items between different lists." :componentDocs="docs" :apiDocs="['PickList']" :ptTabComponent="ptComponent" />
</template> </template>
<script> <script>
@ -7,16 +7,34 @@ import AccessibilityDoc from '@/doc/picklist/AccessibilityDoc.vue';
import BasicDoc from '@/doc/picklist/BasicDoc.vue'; import BasicDoc from '@/doc/picklist/BasicDoc.vue';
import ImportDoc from '@/doc/picklist/ImportDoc.vue'; import ImportDoc from '@/doc/picklist/ImportDoc.vue';
import StyleDoc from '@/doc/picklist/StyleDoc.vue'; import StyleDoc from '@/doc/picklist/StyleDoc.vue';
import PTComponent from '@/doc/picklist/pt/index.vue';
export default { export default {
data() { data() {
return { return {
docs: [ docs: [
{ id: 'import', label: 'Import', component: ImportDoc }, {
{ id: 'basic', label: 'Basic', component: BasicDoc }, id: 'import',
{ id: 'style', label: 'Style', component: StyleDoc }, label: 'Import',
{ id: 'accessibility', label: 'Accessibility', component: AccessibilityDoc } component: ImportDoc
] },
{
id: 'basic',
label: 'Basic',
component: BasicDoc
},
{
id: 'style',
label: 'Style',
component: StyleDoc
},
{
id: 'accessibility',
label: 'Accessibility',
component: AccessibilityDoc
}
],
ptComponent: PTComponent
}; };
} }
}; };