Multiselect demo update
parent
5400fe9ecc
commit
38ed215624
|
@ -11,23 +11,23 @@
|
||||||
<div class="content-section implementation">
|
<div class="content-section implementation">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h5>Basic</h5>
|
<h5>Basic</h5>
|
||||||
<MultiSelect v-model="selectedCars1" :options="cars" optionLabel="brand" placeholder="Select Brands" />
|
<MultiSelect v-model="selectedCities" :options="cities" optionLabel="name" placeholder="Select a City" />
|
||||||
|
|
||||||
<h5>Advanced with Templating and Filtering</h5>
|
<h5>Advanced with Templating and Filtering</h5>
|
||||||
<MultiSelect v-model="selectedCars2" :options="cars" optionLabel="brand" placeholder="Select a Car" :filter="true" class="multiselect-custom">
|
<MultiSelect v-model="selectedCountries" :options="countries" optionLabel="name" placeholder="Select Countries" :filter="true" class="multiselect-custom">
|
||||||
<template #value="slotProps">
|
<template #value="slotProps">
|
||||||
<div class="p-multiselect-car-token" v-for="option of slotProps.value" :key="option.brand">
|
<div class="country-item country-item-value" v-for="option of slotProps.value" :key="option.code">
|
||||||
<img :alt="option.brand" :src="'demo/images/car/' + option.brand + '.png'" />
|
<img src="../../assets/images/flag_placeholder.png" :class="'flag flag-' + option.code.toLowerCase()" />
|
||||||
<span>{{option.brand}}</span>
|
<div>{{option.name}}</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="!slotProps.value || slotProps.value.length === 0">
|
<template v-if="!slotProps.value || slotProps.value.length === 0">
|
||||||
Select Brands
|
Select Countries
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<template #option="slotProps">
|
<template #option="slotProps">
|
||||||
<div class="p-multiselect-car-option">
|
<div class="country-item">
|
||||||
<img :alt="slotProps.option.brand" :src="'demo/images/car/' + slotProps.option.brand + '.png'" />
|
<img src="../../assets/images/flag_placeholder.png" :class="'flag flag-' + slotProps.option.code.toLowerCase()" />
|
||||||
<span>{{slotProps.option.brand}}</span>
|
<div>{{slotProps.option.name}}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</MultiSelect>
|
</MultiSelect>
|
||||||
|
@ -44,18 +44,26 @@ import MultiSelectDoc from './MultiSelectDoc';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedCars1: null,
|
selectedCities: null,
|
||||||
selectedCars2: null,
|
selectedCountries: null,
|
||||||
cars: [
|
cities: [
|
||||||
{brand: 'Audi', value: 'Audi'},
|
{name: 'New York', code: 'NY'},
|
||||||
{brand: 'BMW', value: 'BMW'},
|
{name: 'Rome', code: 'RM'},
|
||||||
{brand: 'Fiat', value: 'Fiat'},
|
{name: 'London', code: 'LDN'},
|
||||||
{brand: 'Honda', value: 'Honda'},
|
{name: 'Istanbul', code: 'IST'},
|
||||||
{brand: 'Jaguar', value: 'Jaguar'},
|
{name: 'Paris', code: 'PRS'}
|
||||||
{brand: 'Mercedes', value: 'Mercedes'},
|
],
|
||||||
{brand: 'Renault', value: 'Renault'},
|
countries: [
|
||||||
{brand: 'Volkswagen', value: 'Volkswagen'},
|
{name: 'Australia', code: 'AU'},
|
||||||
{brand: 'Volvo', value: 'Volvo'}
|
{name: 'Brazil', code: 'BR'},
|
||||||
|
{name: 'China', code: 'CN'},
|
||||||
|
{name: 'Egypt', code: 'EG'},
|
||||||
|
{name: 'France', code: 'FR'},
|
||||||
|
{name: 'Germany', code: 'DE'},
|
||||||
|
{name: 'India', code: 'IN'},
|
||||||
|
{name: 'Japan', code: 'JP'},
|
||||||
|
{name: 'Spain', code: 'ES'},
|
||||||
|
{name: 'United States', code: 'US'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -76,32 +84,17 @@ export default {
|
||||||
padding-bottom: .25rem;
|
padding-bottom: .25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.p-multiselect-car-option {
|
.country-item-value {
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
img {
|
|
||||||
margin-right: .5rem;
|
|
||||||
width: 24px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.p-multiselect-car-token {
|
|
||||||
padding: .25rem .5rem;
|
padding: .25rem .5rem;
|
||||||
margin: 0 0.286rem 0 0;
|
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
}
|
|
||||||
|
|
||||||
.p-multiselect-car-token img {
|
|
||||||
width: 17px;
|
|
||||||
margin-right: .5rem;
|
margin-right: .5rem;
|
||||||
align-items: center;
|
background-color: var(--primary-color);
|
||||||
}
|
color: var(--primary-color-text);
|
||||||
|
|
||||||
.p-multiselect-car-token {
|
img.flag {
|
||||||
background: #2196f3;
|
width: 17px;
|
||||||
color: #ffffff;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -279,24 +279,24 @@ data() {
|
||||||
</a>
|
</a>
|
||||||
<CodeHighlight>
|
<CodeHighlight>
|
||||||
<template v-pre>
|
<template v-pre>
|
||||||
<h3>Basic</h3>
|
<h5>Basic</h5>
|
||||||
<MultiSelect v-model="selectedCars1" :options="cars" optionLabel="brand" placeholder="Select Brands" />
|
<MultiSelect v-model="selectedCities" :options="cities" optionLabel="name" placeholder="Select a City" />
|
||||||
|
|
||||||
<h3>Advanced with Templating and Filtering</h3>
|
<h5>Advanced with Templating and Filtering</h5>
|
||||||
<MultiSelect v-model="selectedCars2" :options="cars" optionLabel="brand" placeholder="Select a Car" :filter="true">
|
<MultiSelect v-model="selectedCountries" :options="countries" optionLabel="name" placeholder="Select Countries" :filter="true" class="multiselect-custom">
|
||||||
<template #value="slotProps">
|
<template #value="slotProps">
|
||||||
<div class="p-multiselect-car-token" v-for="option of slotProps.value" :key="option.brand">
|
<div class="country-item country-item-value" v-for="option of slotProps.value" :key="option.code">
|
||||||
<img :alt="option.brand" :src="'demo/images/car/' + option.brand + '.png'" />
|
<img src="../../assets/images/flag_placeholder.png" :class="'flag flag-' + option.code.toLowerCase()" />
|
||||||
<span>{{option.brand}}</span>
|
<div>{{option.name}}</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="!slotProps.value || slotProps.value.length === 0">
|
<template v-if="!slotProps.value || slotProps.value.length === 0">
|
||||||
Select Brands
|
Select Countries
|
||||||
<template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<template #option="slotProps">
|
<template #option="slotProps">
|
||||||
<div class="p-multiselect-car-option">
|
<div class="country-item">
|
||||||
<img :alt="slotProps.option.brand" :src="'demo/images/car/' + slotProps.option.brand + '.png'" />
|
<img src="../../assets/images/flag_placeholder.png" :class="'flag flag-' + slotProps.option.code.toLowerCase()" />
|
||||||
<span>{{slotProps.option.brand}}</span>
|
<div>{{slotProps.option.name}}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</MultiSelect>
|
</MultiSelect>
|
||||||
|
@ -307,18 +307,26 @@ data() {
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedCars1: null,
|
selectedCities: null,
|
||||||
selectedCars2: null,
|
selectedCountries: null,
|
||||||
cars: [
|
cities: [
|
||||||
{brand: 'Audi', value: 'Audi'},
|
{name: 'New York', code: 'NY'},
|
||||||
{brand: 'BMW', value: 'BMW'},
|
{name: 'Rome', code: 'RM'},
|
||||||
{brand: 'Fiat', value: 'Fiat'},
|
{name: 'London', code: 'LDN'},
|
||||||
{brand: 'Honda', value: 'Honda'},
|
{name: 'Istanbul', code: 'IST'},
|
||||||
{brand: 'Jaguar', value: 'Jaguar'},
|
{name: 'Paris', code: 'PRS'}
|
||||||
{brand: 'Mercedes', value: 'Mercedes'},
|
],
|
||||||
{brand: 'Renault', value: 'Renault'},
|
countries: [
|
||||||
{brand: 'Volkswagen', value: 'Volkswagen'},
|
{name: 'Australia', code: 'AU'},
|
||||||
{brand: 'Volvo', value: 'Volvo'}
|
{name: 'Brazil', code: 'BR'},
|
||||||
|
{name: 'China', code: 'CN'},
|
||||||
|
{name: 'Egypt', code: 'EG'},
|
||||||
|
{name: 'France', code: 'FR'},
|
||||||
|
{name: 'Germany', code: 'DE'},
|
||||||
|
{name: 'India', code: 'IN'},
|
||||||
|
{name: 'Japan', code: 'JP'},
|
||||||
|
{name: 'Spain', code: 'ES'},
|
||||||
|
{name: 'United States', code: 'US'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,32 +344,17 @@ export default {
|
||||||
padding-bottom: .25rem;
|
padding-bottom: .25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.p-multiselect-car-option {
|
.country-item-value {
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
img {
|
|
||||||
margin-right: .5rem;
|
|
||||||
width: 24px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.p-multiselect-car-token {
|
|
||||||
padding: .25rem .5rem;
|
padding: .25rem .5rem;
|
||||||
margin: 0 0.286rem 0 0;
|
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
}
|
|
||||||
|
|
||||||
.p-multiselect-car-token img {
|
|
||||||
width: 17px;
|
|
||||||
margin-right: .5rem;
|
margin-right: .5rem;
|
||||||
align-items: center;
|
background-color: var(--primary-color);
|
||||||
}
|
color: var(--primary-color-text);
|
||||||
|
|
||||||
.p-multiselect-car-token {
|
img.flag {
|
||||||
background: #2196f3;
|
width: 17px;
|
||||||
color: #ffffff;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</CodeHighlight>
|
</CodeHighlight>
|
||||||
|
|
Loading…
Reference in New Issue