Dropdown pt demo added

pull/3938/head
Tuğçe Küçükoğlu 2023-05-07 23:38:12 +03:00
parent 133c543eab
commit 2b02b89b50
4 changed files with 168 additions and 3 deletions

114
doc/dropdown/pt/PTDoc.vue Normal file
View File

@ -0,0 +1,114 @@
<template>
<DocSectionText v-bind="$attrs"></DocSectionText>
<div class="card flex justify-content-center">
<Dropdown
v-model="selectedCity"
:options="cities"
optionLabel="name"
placeholder="Select a City"
:pt="{
root: { class: 'w-full md:w-14rem' },
item: ({ props, state, context }) => ({
class: context.selected ? 'bg-primary' : context.focused ? 'bg-blue-100' : undefined
})
}"
/>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
selectedCity: null,
cities: [
{ name: 'New York', code: 'NY' },
{ name: 'Rome', code: 'RM' },
{ name: 'London', code: 'LDN' },
{ name: 'Istanbul', code: 'IST' },
{ name: 'Paris', code: 'PRS' }
],
code: {
basic: `
<Dropdown
v-model="selectedCity"
:options="cities"
optionLabel="name"
placeholder="Select a City"
:pt="{
root: { class: 'w-full md:w-14rem' },
item: ({ props, state, context }) => ({
class: context.selected ? 'bg-primary' : context.focused ? 'bg-blue-100' : undefined
})
}"
/>`,
options: `
<template>
<div class="card flex justify-content-center">
<Dropdown
v-model="selectedCity"
:options="cities"
optionLabel="name"
placeholder="Select a City"
:pt="{
root: { class: 'w-full md:w-14rem' },
item: ({ props, state, context }) => ({
class: context.selected ? 'bg-primary' : context.focused ? 'bg-blue-100' : undefined
})
}"
/>
</div>
</template>
<script>
export default {
data() {
return {
selectedCity: null,
cities: [
{ name: 'New York', code: 'NY' },
{ name: 'Rome', code: 'RM' },
{ name: 'London', code: 'LDN' },
{ name: 'Istanbul', code: 'IST' },
{ name: 'Paris', code: 'PRS' }
]
};
}
};
<\/script>`,
composition: `
<template>
<div class="card flex justify-content-center">
<Dropdown
v-model="selectedCity"
:options="cities"
optionLabel="name"
placeholder="Select a City"
:pt="{
root: { class: 'w-full md:w-14rem' },
item: ({ props, state, context }) => ({
class: context.selected ? 'bg-primary' : context.focused ? 'bg-blue-100' : undefined
})
}"
/>
</div>
</template>
<script setup>
import { ref } from "vue";
const selectedCity = ref();
const cities = ref([
{ name: 'New York', code: 'NY' },
{ name: 'Rome', code: 'RM' },
{ name: 'London', code: 'LDN' },
{ name: 'Istanbul', code: 'IST' },
{ name: 'Paris', code: 'PRS' }
]);
<\/script>`
}
};
}
};
</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/dropdown/pt/index.vue Normal file
View File

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

View File

@ -1,5 +1,5 @@
<template> <template>
<DocComponent title="Vue Select Component" header="Dropdown" description="Dropdown also known as Select, is used to choose an item from a collection of options." :componentDocs="docs" :apiDocs="['Dropdown']" /> <DocComponent title="Vue Select Component" header="Dropdown" description="Dropdown also known as Select, is used to choose an item from a collection of options." :componentDocs="docs" :apiDocs="['Dropdown']" :ptTabComponent="ptComponent" />
</template> </template>
<script> <script>
@ -10,7 +10,6 @@ import DisabledDoc from '@/doc/dropdown/DisabledDoc';
import EditableDoc from '@/doc/dropdown/EditableDoc'; import EditableDoc from '@/doc/dropdown/EditableDoc';
import FilterDoc from '@/doc/dropdown/FilterDoc'; import FilterDoc from '@/doc/dropdown/FilterDoc';
import FloatLabelDoc from '@/doc/dropdown/FloatLabelDoc'; import FloatLabelDoc from '@/doc/dropdown/FloatLabelDoc';
import VeeValidateDoc from '@/doc/dropdown/form/VeeValidateDoc';
import GroupDoc from '@/doc/dropdown/GroupDoc'; import GroupDoc from '@/doc/dropdown/GroupDoc';
import ImportDoc from '@/doc/dropdown/ImportDoc'; import ImportDoc from '@/doc/dropdown/ImportDoc';
import InvalidDoc from '@/doc/dropdown/InvalidDoc'; import InvalidDoc from '@/doc/dropdown/InvalidDoc';
@ -19,6 +18,8 @@ import LoadingStateDoc from '@/doc/dropdown/LoadingStateDoc';
import StyleDoc from '@/doc/dropdown/StyleDoc'; import StyleDoc from '@/doc/dropdown/StyleDoc';
import TemplateDoc from '@/doc/dropdown/TemplateDoc'; import TemplateDoc from '@/doc/dropdown/TemplateDoc';
import VirtualScrollDoc from '@/doc/dropdown/VirtualScrollDoc'; import VirtualScrollDoc from '@/doc/dropdown/VirtualScrollDoc';
import VeeValidateDoc from '@/doc/dropdown/form/VeeValidateDoc';
import PTComponent from '@/doc/dropdown/pt/index.vue';
export default { export default {
data() { data() {
@ -111,7 +112,8 @@ export default {
label: 'Accessibility', label: 'Accessibility',
component: AccessibilityDoc component: AccessibilityDoc
} }
] ],
ptComponent: PTComponent
}; };
} }
}; };