OrderList PickList demo updates

pull/5507/head
tugcekucukoglu 2024-04-02 11:38:38 +03:00
parent f7943d7b9a
commit b9700aef2d
6 changed files with 331 additions and 120 deletions

View File

@ -2,21 +2,10 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>OrderList requires an array as its value bound with the <i>v-model</i> directive and <i>item</i> template for its content.</p> <p>OrderList requires an array as its value bound with the <i>v-model</i> directive and <i>item</i> template for its content.</p>
</DocSectionText> </DocSectionText>
<div class="card xl:flex xl:justify-content-center"> <div class="card flex justify-content-center">
<OrderList v-model="products" listStyle="height:auto" dataKey="id"> <OrderList v-model="products" dataKey="id" breakpoint="1400px">
<template #header> List of Products </template> <template #item="{ item }">
<template #item="slotProps"> {{ item.name }}
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem 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">${{ slotProps.item.price }}</span>
</div>
</template> </template>
</OrderList> </OrderList>
</div> </div>
@ -25,46 +14,25 @@
<script> <script>
import { ProductService } from '@/service/ProductService'; import { ProductService } from '@/service/ProductService';
export default { export default {
data() { data() {
return { return {
products: null, products: null,
code: { code: {
basic: ` basic: `
<OrderList v-model="products" listStyle="height:auto" dataKey="id"> <OrderList v-model="products" dataKey="id" breakpoint="1400px">
<template #header> List of Products </template> <template #item="{ item }">
<template #item="slotProps"> {{ item.name }}
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem 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">$ {{ slotProps.item.price }}</span>
</div>
</template> </template>
</OrderList> </OrderList>
`, `,
options: ` options: `
<template> <template>
<div class="card xl:flex xl:justify-content-center"> <div class="card lg:flex lg:justify-content-center">
<OrderList v-model="products" listStyle="height:auto" dataKey="id"> <OrderList v-model="products" dataKey="id" breakpoint="1400px">
<template #header> List of Products </template> <template #item="{ item }">
<template #item="slotProps"> {{ item.name }}
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem 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">$ {{ slotProps.item.price }}</span>
</div>
</template> </template>
</OrderList> </OrderList>
</div> </div>
@ -86,21 +54,10 @@ export default {
`, `,
composition: ` composition: `
<template> <template>
<div class="card xl:flex xl:justify-content-center"> <div class="card lg:flex lg:justify-content-center">
<OrderList v-model="products" listStyle="height:auto" dataKey="id"> <OrderList v-model="products" dataKey="id" breakpoint="1400px">
<template #header> List of Products </template> <template #item="{ item }">
<template #item="slotProps"> {{ item.name }}
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem 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">$ {{ slotProps.item.price }}</span>
</div>
</template> </template>
</OrderList> </OrderList>
</div> </div>

View File

@ -0,0 +1,142 @@
<template>
<DocSectionText v-bind="$attrs">
<p>For custom content support define an <i>item</i> template that gets the item instance as a parameter. In addition <i>header</i> slot is provided for further customization.</p>
</DocSectionText>
<div class="card lg:flex lg:justify-content-center">
<OrderList v-model="products" dataKey="id" breakpoint="1400px">
<template #header> List of Products </template>
<template #item="{ item }">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + item.image" :alt="item.name" />
<div class="flex-1 flex flex-column gap-2">
<span class="font-bold">{{ item.name }}</span>
<div class="flex align-items-center gap-2">
<i class="pi pi-tag text-sm"></i>
<span>{{ item.category }}</span>
</div>
</div>
<span class="font-bold">${{ 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" breakpoint="1400px">
<template #header> List of Products </template>
<template #item="{ item }">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + item.image" :alt="item.name" />
<div class="flex-1 flex flex-column gap-2">
<span class="font-bold">{{ item.name }}</span>
<div class="flex align-items-center gap-2">
<i class="pi pi-tag text-sm"></i>
<span>{{ item.category }}</span>
</div>
</div>
<span class="font-bold">$ {{ item.price }}</span>
</div>
</template>
</OrderList>
`,
options: `
<template>
<div class="card lg:flex lg:justify-content-center">
<OrderList v-model="products" dataKey="id" breakpoint="1400px">
<template #header> List of Products </template>
<template #item="{ item }">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + item.image" :alt="item.name" />
<div class="flex-1 flex flex-column gap-2">
<span class="font-bold">{{ item.name }}</span>
<div class="flex align-items-center gap-2">
<i class="pi pi-tag text-sm"></i>
<span>{{ item.category }}</span>
</div>
</div>
<span class="font-bold">$ {{ 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 lg:flex lg:justify-content-center">
<OrderList v-model="products" dataKey="id" breakpoint="1400px">
<template #header> List of Products </template>
<template #item="{ item }">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + item.image" :alt="item.name" />
<div class="flex-1 flex flex-column gap-2">
<span class="font-bold">{{ item.name }}</span>
<div class="flex align-items-center gap-2">
<i class="pi pi-tag text-sm"></i>
<span>{{ item.category }}</span>
</div>
</div>
<span class="font-bold">$ {{ 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) => (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

@ -3,21 +3,9 @@
<p>PickList requires a multidimensional array as its value bound with the <i>v-model </i>directive and a template for its content that gets the <i>item</i> instance and the index via slotProps.</p> <p>PickList requires a multidimensional array as its value bound with the <i>v-model </i>directive and a template for its content that gets the <i>item</i> instance and the index via slotProps.</p>
</DocSectionText> </DocSectionText>
<div class="card"> <div class="card">
<PickList v-model="products" listStyle="height:342px" dataKey="id" breakpoint="1400px"> <PickList v-model="products" dataKey="id" breakpoint="1400px">
<template #sourceheader> Available </template> <template #item="{ item }">
<template #targetheader> Selected </template> {{ item.name }}
<template #item="slotProps">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem 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">${{ slotProps.item.price }}</span>
</div>
</template> </template>
</PickList> </PickList>
</div> </div>
@ -33,42 +21,18 @@ export default {
products: null, products: null,
code: { code: {
basic: ` basic: `
<PickList v-model="products" listStyle="height:342px" dataKey="id" breakpoint="1400px"> <PickList v-model="products" dataKey="id" listStyle="height:342px" breakpoint="1400px">
<template #sourceheader> Available </template> <template #item="{ item }">
<template #targetheader> Selected </template> {{ item.name }}
<template #item="slotProps">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem 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">$ {{ slotProps.item.price }}</span>
</div>
</template> </template>
</PickList> </PickList>
`, `,
options: ` options: `
<template> <template>
<div class="card"> <div class="card">
<PickList v-model="products" listStyle="height:342px" dataKey="id" breakpoint="1400px"> <PickList v-model="products" dataKey="id" listStyle="height:342px" breakpoint="1400px">
<template #sourceheader> Available </template> <template #item="{ item }">
<template #targetheader> Selected </template> {{ item.name }}
<template #item="slotProps">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem 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">$ {{ slotProps.item.price }}</span>
</div>
</template> </template>
</PickList> </PickList>
</div> </div>
@ -91,21 +55,9 @@ export default {
composition: ` composition: `
<template> <template>
<div class="card"> <div class="card">
<PickList v-model="products" listStyle="height:342px" dataKey="id" breakpoint="1400px"> <PickList v-model="products" dataKey="id" listStyle="height:342px" breakpoint="1400px">
<template #sourceheader> Available </template> <template #item="{ item }">
<template #targetheader> Selected </template> {{ item.name }}
<template #item="slotProps">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem 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">$ {{ slotProps.item.price }}</span>
</div>
</template> </template>
</PickList> </PickList>
</div> </div>

View File

@ -0,0 +1,148 @@
<template>
<DocSectionText v-bind="$attrs">
<p>For custom content support define an <i>item</i> template that gets the item instance as a parameter. In addition <i>sourceheader</i> and <i>targetheader</i> slots are provided for further customization.</p>
</DocSectionText>
<div class="card">
<PickList v-model="products" dataKey="id" breakpoint="1400px" listStyle="height:342px">
<template #sourceheader> Available </template>
<template #targetheader> Selected </template>
<template #item="{ item }">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + item.image" :alt="item.name" />
<div class="flex-1 flex flex-column gap-2">
<span class="font-bold">{{ item.name }}</span>
<div class="flex align-items-center gap-2">
<i class="pi pi-tag text-sm"></i>
<span>{{ item.category }}</span>
</div>
</div>
<span class="font-bold">${{ 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" breakpoint="1400px">
<template #sourceheader> Available </template>
<template #targetheader> Selected </template>
<template #item="{ item }">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + item.image" :alt="item.name" />
<div class="flex-1 flex flex-column gap-2">
<span class="font-bold">{{ item.name }}</span>
<div class="flex align-items-center gap-2">
<i class="pi pi-tag text-sm"></i>
<span>{{ item.category }}</span>
</div>
</div>
<span class="font-bold">$ {{ item.price }}</span>
</div>
</template>
</PickList>
`,
options: `
<template>
<div class="card">
<PickList v-model="products" dataKey="id" breakpoint="1400px">
<template #sourceheader> Available </template>
<template #targetheader> Selected </template>
<template #item="{ item }">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + item.image" :alt="item.name" />
<div class="flex-1 flex flex-column gap-2">
<span class="font-bold">{{ item.name }}</span>
<div class="flex align-items-center gap-2">
<i class="pi pi-tag text-sm"></i>
<span>{{ item.category }}</span>
</div>
</div>
<span class="font-bold">$ {{ 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" breakpoint="1400px">
<template #sourceheader> Available </template>
<template #targetheader> Selected </template>
<template #item="{ item }">
<div class="flex flex-wrap p-2 align-items-center gap-3">
<img class="w-4rem flex-shrink-0 border-round" :src="'https://primefaces.org/cdn/primevue/images/product/' + item.image" :alt="item.name" />
<div class="flex-1 flex flex-column gap-2">
<span class="font-bold">{{ item.name }}</span>
<div class="flex align-items-center gap-2">
<i class="pi pi-tag text-sm"></i>
<span>{{ item.category }}</span>
</div>
</div>
<span class="font-bold">$ {{ 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

@ -6,6 +6,7 @@
import AccessibilityDoc from '@/doc/orderlist/AccessibilityDoc.vue'; 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 TemplateDoc from '@/doc/orderlist/TemplateDoc.vue';
import PTComponent from '@/doc/orderlist/pt/index.vue'; import PTComponent from '@/doc/orderlist/pt/index.vue';
import ThemingDoc from '@/doc/orderlist/theming/index.vue'; import ThemingDoc from '@/doc/orderlist/theming/index.vue';
@ -23,6 +24,11 @@ export default {
label: 'Basic', label: 'Basic',
component: BasicDoc component: BasicDoc
}, },
{
id: 'template',
label: 'Template',
component: TemplateDoc
},
{ {
id: 'accessibility', id: 'accessibility',
label: 'Accessibility', label: 'Accessibility',

View File

@ -6,6 +6,7 @@
import AccessibilityDoc from '@/doc/picklist/AccessibilityDoc.vue'; 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 TemplateDoc from '@/doc/picklist/TemplateDoc.vue';
import PTComponent from '@/doc/picklist/pt/index.vue'; import PTComponent from '@/doc/picklist/pt/index.vue';
import ThemingDoc from '@/doc/picklist/theming/index.vue'; import ThemingDoc from '@/doc/picklist/theming/index.vue';
@ -23,6 +24,11 @@ export default {
label: 'Basic', label: 'Basic',
component: BasicDoc component: BasicDoc
}, },
{
id: 'template',
label: 'Template',
component: TemplateDoc
},
{ {
id: 'accessibility', id: 'accessibility',
label: 'Accessibility', label: 'Accessibility',