OrderList pt demo added

pull/3950/head
Tuğçe Küçükoğlu 2023-05-09 19:04:28 +03:00
parent 6f6a1e617b
commit 586978e34a
4 changed files with 228 additions and 2 deletions

174
doc/orderlist/pt/PTDoc.vue Normal file
View File

@ -0,0 +1,174 @@
<template>
<DocSectionText v-bind="$attrs"></DocSectionText>
<div class="card xl:flex xl:justify-content-center">
<OrderList
v-model="products"
dataKey="id"
:pt="{
list: { style: { height: 'auto' } },
moveUpButton: {
root: { class: 'bg-teal-400 border-teal-400' }
}
}"
>
<template #header> List of Products </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>
</OrderList>
</div>
<DocSectionCode :code="code" v-bind="$attrs" :service="['ProductService']" />
</template>
<script>
import { ProductService } from '@/service/ProductService';
export default {
data() {
return {
products: null,
code: {
basic: `
<OrderList
v-model="products"
dataKey="id"
:pt="{
list: { style: { height: 'auto' } },
moveUpButton: {
root: { class: 'bg-teal-400 border-teal-400' }
}
}"
>
<template #header> List of Products </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>
</OrderList>`,
options: `
<template>
<div class="card xl:flex xl:justify-content-center">
<OrderList
v-model="products"
dataKey="id"
:pt="{
list: { style: { height: 'auto' } },
moveUpButton: {
root: { class: 'bg-teal-400 border-teal-400' }
}
}"
>
<template #header> List of Products </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>
</OrderList>
</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 xl:flex xl:justify-content-center">
<OrderList
v-model="products"
dataKey="id"
:pt="{
list: { style: { height: 'auto' } },
moveUpButton: {
root: { class: 'bg-teal-400 border-teal-400' }
}
}"
>
<template #header> List of Products </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>
</OrderList>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { ProductService } from '@/service/ProductService'
const products = ref(null);
onMounted(() => {
ProductService.getProductsSmall().then((data) => (this.products = 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>

View File

@ -0,0 +1,41 @@
<template>
<div class="doc-main">
<div class="doc-intro">
<h1>OrderList 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.orderlist',
label: 'OrderList PT Options',
component: DocApiTable,
data: getPTOption('OrderList')
},
{
id: 'pt.demo',
label: 'Demo',
component: PtDoc
}
]
};
}
};
</script>

View File

@ -1,5 +1,5 @@
<template> <template>
<DocComponent title="Vue OrderList Component" header="OrderList" description="OrderList is used to sort a collection." :componentDocs="docs" :apiDocs="['OrderList']" /> <DocComponent title="Vue OrderList Component" header="OrderList" description="OrderList is used to sort a collection." :componentDocs="docs" :apiDocs="['OrderList']" :ptTabComponent="ptComponent" />
</template> </template>
<script> <script>
@ -7,6 +7,8 @@ import AccessibilityDoc from '@/doc/orderlist/AccessibilityDoc.vue';
import BasicDoc from '@/doc/orderlist/BasicDoc.vue'; import BasicDoc from '@/doc/orderlist/BasicDoc.vue';
import ImportDoc from '@/doc/orderlist/ImportDoc.vue'; import ImportDoc from '@/doc/orderlist/ImportDoc.vue';
import StyleDoc from '@/doc/orderlist/StyleDoc.vue'; import StyleDoc from '@/doc/orderlist/StyleDoc.vue';
import PTComponent from '@/doc/orderlist/pt/index.vue';
export default { export default {
data() { data() {
return { return {
@ -31,7 +33,8 @@ export default {
label: 'Accessibility', label: 'Accessibility',
component: AccessibilityDoc component: AccessibilityDoc
} }
] ],
ptComponent: PTComponent
}; };
} }
}; };