primevue-mirror/doc/icons/ListDoc.vue

69 lines
2.4 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Here is the full list of PrimeIcons. More icons will be added periodically and you may also <a href="https://github.com/primefaces/primeicons/issues">request new icons</a> at the issue tracker.</p>
</DocSectionText>
2024-05-20 12:14:38 +00:00
<InputText v-model="filter" class="w-full p-4 mt-4 mb-6" placeholder="Search an icon" />
2023-02-28 08:29:30 +00:00
<div class="card">
2024-05-20 12:14:38 +00:00
<div class="grid grid-cols-12 gap-4 text-center">
<div v-for="icon of filteredIcons" :key="icon.properties.name" class="col-span-12 md:col-span-2 mb-8">
<i :class="'text-2xl mb-4 text-surface-500 dark:text-surface-400 pi pi-' + icon.properties.name"></i>
2023-02-28 08:29:30 +00:00
<div>pi-{{ icon.properties.name }}</div>
</div>
</div>
</div>
</template>
<script>
import { IconService } from '@/service/IconService';
export default {
data() {
return {
icons: null,
filter: null
};
},
mounted() {
IconService.getIcons().then((data) => {
let d_data = data;
let d_icons = d_data.filter((value) => {
return value.icon.tags.indexOf('deprecate') === -1;
});
d_icons.sort((icon1, icon2) => {
if (icon1.properties.name < icon2.properties.name) return -1;
else if (icon1.properties.name < icon2.properties.name) return 1;
else return 0;
});
this.icons = d_icons;
});
},
computed: {
filteredIcons() {
2024-03-29 11:49:59 +00:00
let sanitizedInput = this.filter?.replace(/[^\w\s]/gi, '').replace(/\s/g, '');
if (this.filter)
return this.icons.filter((icon) => {
return (
icon.icon.tags.some((tag) =>
tag
.replace(/[^\w\s]/gi, '')
.replace(/\s/g, '')
.includes(sanitizedInput.toLowerCase())
) ||
icon.properties.name
.replace(/[^\w\s]/gi, '')
.replace(/\s/g, '')
.toLowerCase()
.includes(sanitizedInput.toLowerCase())
);
});
2023-02-28 08:29:30 +00:00
else return this.icons;
}
}
};
</script>