mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +03:00
Convert last items to flex search (#87)
* Improved performance on the Unicode Search page: - Created new flexSearch component (Faster than fuzzySearch). For more information, see https://github.com/nextapps-de/flexsearch - Replaced fuzzySearch with the flexSearch component on the unicode search page - Fixed a bug where the search limit counter didn't have any effect - Reduced the default search limit from 100 to 40 to reduce lag from loading all the ui elements * Added clarification to comment * components.d.ts update * - Replaced FuzzySearch with FlexSearch on the ISO 3166 Searcher page - Reduced the debounce from 500ms to 250ms - Reduced the default search limit from 100 to 20, and fixed a bug where the search limit wasn't applied when the value changed - Added the `readonly` prop to the `input-copyable` field - Added the `readonly` flag to all input copyable fields on the unicode search and iso 3166 searcher pages * Merged new changes to flexSearch * chore: vercel optimisation tentative * Emoji Picker: - Replaced fuzzysearch with flexsearch - Reduced debounce from 500ms to 250ms - Increased search limit from 100 to 150 - Implemented a UI loading sequence where it will load an emoji group each 150ms instead of loading all groups at once. This eliminates the lag experienced when loading the page or when removing the search query - Updated unicode-emoji-json from version 0.4.0 to 0.8.0 Emoji Card: - Fixed an issue where the country flag emojis weren't being rendered - Added row which displays the emoji keywords, and uses a tooltip to display all keywords when they are truncated to fit in the card - Moved codepoints and unicode escape lines to seperate rows instead of occasionally being displayed on the same line * - Added logic to use an emoji in the search query * small change * - Replaced fuzzysearch with flexsearch in the command pallette - Improved the performance of the collapsible tool menu by rewriting the logic to prevent the DOM elements being destroyed and recreated each time a category is expanded or collapsed - Added logic to load the home page tool cards in batches instead of all at once * Fixed linter error * Fixed an issue where the weight of a search key wasn't properly being applied * AD LDAP searcher: - Replaced fuzzysearch with flexsearch - Removed the debounce from the search field - Made all fields searchable C-Select: - Replaced fuzzysearch with flexsearch ASCII text drawer: - Fixed a bug where B1FF and Rot13 options appeared duplicate in the list, causing them to duplicate even further when searching specifically for them FuzzySearch: - Marked `useFuzzySearch` as deprecated, with the advise to use `useFlexSearch` instead * ISO 3166 searcher: - Made more fields searchable c-input-text: - Fixed an issue where country flag emojis weren't rendered * - Added batch loading for the UI elements after a search - Removed the Unicode item from the flag emoji copyable field so only the emoji is copied - Added string 'None' to be used when a country has no neighboring countries * - Disabled the cache by default because it caused minor hickups during searches and added extra documentation --------- Co-authored-by: ShareVB <sharevb@gmail.com>
This commit is contained in:
1 parent
e14fd2f9e2
commit
6f1b17fc66
7 files changed
+148
-28
No files matched your search
@@ -35,8 +35,19 @@ export function useFlexSearch<Data extends Record<string, any>>({
|
||||
* Note: The `'tolerant'` tokenizer option mentioned in the documentation doesn't exist anymore in the current version of FlexSearch.
|
||||
*/
|
||||
tokenize?: 'strict' | 'forward' | 'reverse' | 'full'
|
||||
/**
|
||||
* Resolution value for giving meaningful results when searching for partial matches.
|
||||
* @default 9
|
||||
* @see {@link https://github.com/nextapps-de/flexsearch?tab=readme-ov-file#resolution | FlexSearch Resolution Documentation}
|
||||
*/
|
||||
resolution?: number
|
||||
optimize?: boolean
|
||||
/**
|
||||
* Value to determine if the cache should be used.
|
||||
* If set to a number, the cache will use the number to assign that number of cache slots (No information in the documentation is provided about what a cache slot is exactly).
|
||||
* @default false
|
||||
* @see {@link https://github.com/nextapps-de/flexsearch?tab=readme-ov-file#auto-balanced-cache-by-popularity | FlexSearch Cache Documentation}
|
||||
*/
|
||||
cache?: boolean | number
|
||||
}
|
||||
limit?: MaybeRef<number>
|
||||
@@ -67,7 +78,7 @@ export function useFlexSearch<Data extends Record<string, any>>({
|
||||
preset: 'performance',
|
||||
resolution: 9,
|
||||
optimize: true,
|
||||
cache: 100,
|
||||
cache: false,
|
||||
fastupdate: true,
|
||||
...indexOptions,
|
||||
}),
|
||||
@@ -142,11 +153,9 @@ export function useFlexSearch<Data extends Record<string, any>>({
|
||||
})
|
||||
.map(([id]) => id);
|
||||
|
||||
// Apply limit and convert back to original items
|
||||
const limitedIds = searchLimit > 0 ? sortedIds.slice(0, searchLimit) : sortedIds;
|
||||
|
||||
// Return the limited results early if it shouldn't be sorted by similarity
|
||||
// If shouldn't be sorted by similarity, apply limit here and return early
|
||||
if (!shouldSort) {
|
||||
const limitedIds = searchLimit > 0 ? sortedIds.slice(0, searchLimit) : sortedIds;
|
||||
return limitedIds
|
||||
.map(id => dataMap.value.get(id))
|
||||
.filter(Boolean) as Data[];
|
||||
@@ -188,8 +197,8 @@ export function useFlexSearch<Data extends Record<string, any>>({
|
||||
return 1 - (distance / maxLength);
|
||||
};
|
||||
|
||||
// Sort limited results by similarity score, but maintain weight priority
|
||||
const sortedResults = limitedIds
|
||||
// Sort ALL results by similarity score, then apply limit at the end
|
||||
const sortedResults = sortedIds
|
||||
.map((id) => {
|
||||
const item = dataMap.value.get(id);
|
||||
if (!item) {
|
||||
@@ -229,7 +238,8 @@ export function useFlexSearch<Data extends Record<string, any>>({
|
||||
})
|
||||
.map(result => result!.item);
|
||||
|
||||
return sortedResults as Data[];
|
||||
// Apply limit after final sorting
|
||||
return searchLimit > 0 ? sortedResults.slice(0, searchLimit) : sortedResults;
|
||||
};
|
||||
|
||||
// Computed results
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
import { type MaybeRef, get } from '@vueuse/core';
|
||||
import Fuse, { type IFuseOptions } from 'fuse.js';
|
||||
import { computed } from 'vue';
|
||||
import { useFlexSearch } from './flexSearch';
|
||||
|
||||
export { useFuzzySearch };
|
||||
|
||||
/**
|
||||
* @deprecated This composable is deprecated and will be removed in a future version.
|
||||
* Use {@link useFlexSearch} instead.
|
||||
*/
|
||||
function useFuzzySearch<Data>({
|
||||
search,
|
||||
data,
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import mappingData from './ad-mapping.json';
|
||||
import { useFuzzySearch } from '@/composable/fuzzySearch';
|
||||
import useDebouncedRef from '@/composable/debouncedref';
|
||||
import { useFlexSearch } from '@/composable/flexSearch';
|
||||
|
||||
const data = mappingData.map(i => ({ ...i, all: `${i.TAB} - ${i.ActiveDirectoryField}` }));
|
||||
const searchQuery = useDebouncedRef('', 500);
|
||||
const data = mappingData;
|
||||
const search = ref('');
|
||||
|
||||
const { searchResult } = useFuzzySearch({
|
||||
search: searchQuery,
|
||||
const { searchResult } = useFlexSearch({
|
||||
search,
|
||||
data,
|
||||
options: {
|
||||
keys: ['all'],
|
||||
threshold: 0.2,
|
||||
isCaseSensitive: false,
|
||||
minMatchCharLength: 3,
|
||||
useExtendedSearch: true,
|
||||
keys: ['TAB', 'ActiveDirectoryField', 'LDAPAttribute'],
|
||||
filterEmpty: false,
|
||||
},
|
||||
});
|
||||
@@ -24,7 +19,7 @@ const { searchResult } = useFuzzySearch({
|
||||
<div mx-auto max-w-2400px important:flex-1>
|
||||
<div flex items-center gap-3>
|
||||
<c-input-text
|
||||
v-model:value="searchQuery"
|
||||
v-model:value="search"
|
||||
placeholder="Search Active Directory LDAP mapping"
|
||||
mx-auto max-w-600px
|
||||
>
|
||||
|
||||
@@ -49,7 +49,7 @@ watchEffect(async () => {
|
||||
processing.value = false;
|
||||
});
|
||||
|
||||
const fonts = ['1Row', '3-D', '3D Diagonal', '3D-ASCII', '3x5', '4Max', '5 Line Oblique', 'AMC 3 Line', 'AMC 3 Liv1', 'AMC AAA01', 'AMC Neko', 'AMC Razor', 'AMC Razor2', 'AMC Slash', 'AMC Slider', 'AMC Thin', 'AMC Tubes', 'AMC Untitled', 'ANSI Shadow', 'ASCII New Roman', 'Acrobatic', 'Alligator', 'Alligator2', 'Alpha', 'Alphabet', 'Arrows', 'Avatar', 'B1FF', 'B1FF', 'Banner', 'Banner3-D', 'Banner3', 'Banner4', 'Barbwire', 'Basic', 'Bear', 'Bell', 'Benjamin', 'Big Chief', 'Big Money-ne', 'Big Money-nw', 'Big Money-se', 'Big Money-sw', 'Big', 'Bigfig', 'Binary', 'Block', 'Blocks', 'Bloody', 'Bolger', 'Braced', 'Bright', 'Broadway KB', 'Broadway', 'Bubble', 'Bulbhead', 'Caligraphy', 'Caligraphy2', 'Calvin S', 'Cards', 'Catwalk', 'Chiseled', 'Chunky', 'Coinstak', 'Cola', 'Colossal', 'Computer', 'Contessa', 'Contrast', 'Cosmike', 'Crawford', 'Crawford2', 'Crazy', 'Cricket', 'Cursive', 'Cyberlarge', 'Cybermedium', 'Cybersmall', 'Cygnet', 'DANC4', 'DOS Rebel', 'DWhistled', 'Dancing Font', 'Decimal', 'Def Leppard', 'Delta Corps Priest 1', 'Diamond', 'Diet Cola', 'Digital', 'Doh', 'Doom', 'Dot Matrix', 'Double Shorts', 'Double', 'Dr Pepper', 'Efti Chess', 'Efti Font', 'Efti Italic', 'Efti Piti', 'Efti Robot', 'Efti Wall', 'Efti Water', 'Electronic', 'Elite', 'Epic', 'Fender', 'Filter', 'Fire Font-k', 'Fire Font-s', 'Flipped', 'Flower Power', 'Four Tops', 'Fraktur', 'Fun Face', 'Fun Faces', 'Fuzzy', 'Georgi16', 'Georgia11', 'Ghost', 'Ghoulish', 'Glenyn', 'Goofy', 'Gothic', 'Graceful', 'Gradient', 'Graffiti', 'Greek', 'Heart Left', 'Heart Right', 'Henry 3D', 'Hex', 'Hieroglyphs', 'Hollywood', 'Horizontal Left', 'Horizontal Right', 'ICL-1900', 'Impossible', 'Invita', 'Isometric1', 'Isometric2', 'Isometric3', 'Isometric4', 'Italic', 'Ivrit', 'JS Block Letters', 'JS Bracket Letters', 'JS Capital Curves', 'JS Cursive', 'JS Stick Letters', 'Jacky', 'Jazmine', 'Jerusalem', 'Katakana', 'Kban', 'Keyboard', 'Knob', 'Konto Slant', 'Konto', 'LCD', 'Larry 3D 2', 'Larry 3D', 'Lean', 'Letters', 'Lil Devil', 'Line Blocks', 'Linux', 'Lockergnome', 'Madrid', 'Marquee', 'Maxfour', 'Merlin1', 'Merlin2', 'Mike', 'Mini', 'Mirror', 'Mnemonic', 'Modular', 'Morse', 'Morse2', 'Moscow', 'Mshebrew210', 'Muzzle', 'NScript', 'NT Greek', 'NV Script', 'Nancyj-Fancy', 'Nancyj-Improved', 'Nancyj-Underlined', 'Nancyj', 'Nipples', 'O8', 'OS2', 'Octal', 'Ogre', 'Old Banner', 'Patorjk\'s Cheese', 'Patorjk-HeX', 'Pawp', 'Peaks Slant', 'Peaks', 'Pebbles', 'Pepper', 'Poison', 'Puffy', 'Puzzle', 'Pyramid', 'Rammstein', 'Rectangles', 'Red Phoenix', 'Relief', 'Relief2', 'Reverse', 'Roman', 'Rot13', 'Rot13', 'Rotated', 'Rounded', 'Rowan Cap', 'Rozzo', 'Runic', 'Runyc', 'S Blood', 'SL Script', 'Santa Clara', 'Script', 'Serifcap', 'Shadow', 'Shimrod', 'Short', 'Slant Relief', 'Slant', 'Slide', 'Small Caps', 'Small Isometric1', 'Small Keyboard', 'Small Poison', 'Small Script', 'Small Shadow', 'Small Slant', 'Small Tengwar', 'Small', 'Soft', 'Speed', 'Spliff', 'Stacey', 'Stampate', 'Stampatello', 'Standard', 'Star Strips', 'Star Wars', 'Stellar', 'Stforek', 'Stick Letters', 'Stop', 'Straight', 'Stronger Than All', 'Sub-Zero', 'Swamp Land', 'Swan', 'Sweet', 'THIS', 'Tanja', 'Tengwar', 'Term', 'Test1', 'The Edge', 'Thick', 'Thin', 'Thorned', 'Three Point', 'Ticks Slant', 'Ticks', 'Tiles', 'Tinker-Toy', 'Tombstone', 'Train', 'Trek', 'Tsalagi', 'Tubular', 'Twisted', 'Two Point', 'USA Flag', 'Univers', 'Varsity', 'Wavy', 'Weird', 'Wet Letter', 'Whimsy', 'Wow'];
|
||||
const fonts = ['1Row', '3-D', '3D Diagonal', '3D-ASCII', '3x5', '4Max', '5 Line Oblique', 'AMC 3 Line', 'AMC 3 Liv1', 'AMC AAA01', 'AMC Neko', 'AMC Razor', 'AMC Razor2', 'AMC Slash', 'AMC Slider', 'AMC Thin', 'AMC Tubes', 'AMC Untitled', 'ANSI Shadow', 'ASCII New Roman', 'Acrobatic', 'Alligator', 'Alligator2', 'Alpha', 'Alphabet', 'Arrows', 'Avatar', 'B1FF', 'Banner', 'Banner3-D', 'Banner3', 'Banner4', 'Barbwire', 'Basic', 'Bear', 'Bell', 'Benjamin', 'Big Chief', 'Big Money-ne', 'Big Money-nw', 'Big Money-se', 'Big Money-sw', 'Big', 'Bigfig', 'Binary', 'Block', 'Blocks', 'Bloody', 'Bolger', 'Braced', 'Bright', 'Broadway KB', 'Broadway', 'Bubble', 'Bulbhead', 'Caligraphy', 'Caligraphy2', 'Calvin S', 'Cards', 'Catwalk', 'Chiseled', 'Chunky', 'Coinstak', 'Cola', 'Colossal', 'Computer', 'Contessa', 'Contrast', 'Cosmike', 'Crawford', 'Crawford2', 'Crazy', 'Cricket', 'Cursive', 'Cyberlarge', 'Cybermedium', 'Cybersmall', 'Cygnet', 'DANC4', 'DOS Rebel', 'DWhistled', 'Dancing Font', 'Decimal', 'Def Leppard', 'Delta Corps Priest 1', 'Diamond', 'Diet Cola', 'Digital', 'Doh', 'Doom', 'Dot Matrix', 'Double Shorts', 'Double', 'Dr Pepper', 'Efti Chess', 'Efti Font', 'Efti Italic', 'Efti Piti', 'Efti Robot', 'Efti Wall', 'Efti Water', 'Electronic', 'Elite', 'Epic', 'Fender', 'Filter', 'Fire Font-k', 'Fire Font-s', 'Flipped', 'Flower Power', 'Four Tops', 'Fraktur', 'Fun Face', 'Fun Faces', 'Fuzzy', 'Georgi16', 'Georgia11', 'Ghost', 'Ghoulish', 'Glenyn', 'Goofy', 'Gothic', 'Graceful', 'Gradient', 'Graffiti', 'Greek', 'Heart Left', 'Heart Right', 'Henry 3D', 'Hex', 'Hieroglyphs', 'Hollywood', 'Horizontal Left', 'Horizontal Right', 'ICL-1900', 'Impossible', 'Invita', 'Isometric1', 'Isometric2', 'Isometric3', 'Isometric4', 'Italic', 'Ivrit', 'JS Block Letters', 'JS Bracket Letters', 'JS Capital Curves', 'JS Cursive', 'JS Stick Letters', 'Jacky', 'Jazmine', 'Jerusalem', 'Katakana', 'Kban', 'Keyboard', 'Knob', 'Konto Slant', 'Konto', 'LCD', 'Larry 3D 2', 'Larry 3D', 'Lean', 'Letters', 'Lil Devil', 'Line Blocks', 'Linux', 'Lockergnome', 'Madrid', 'Marquee', 'Maxfour', 'Merlin1', 'Merlin2', 'Mike', 'Mini', 'Mirror', 'Mnemonic', 'Modular', 'Morse', 'Morse2', 'Moscow', 'Mshebrew210', 'Muzzle', 'NScript', 'NT Greek', 'NV Script', 'Nancyj-Fancy', 'Nancyj-Improved', 'Nancyj-Underlined', 'Nancyj', 'Nipples', 'O8', 'OS2', 'Octal', 'Ogre', 'Old Banner', 'Patorjk\'s Cheese', 'Patorjk-HeX', 'Pawp', 'Peaks Slant', 'Peaks', 'Pebbles', 'Pepper', 'Poison', 'Puffy', 'Puzzle', 'Pyramid', 'Rammstein', 'Rectangles', 'Red Phoenix', 'Relief', 'Relief2', 'Reverse', 'Roman', 'Rot13', 'Rotated', 'Rounded', 'Rowan Cap', 'Rozzo', 'Runic', 'Runyc', 'S Blood', 'SL Script', 'Santa Clara', 'Script', 'Serifcap', 'Shadow', 'Shimrod', 'Short', 'Slant Relief', 'Slant', 'Slide', 'Small Caps', 'Small Isometric1', 'Small Keyboard', 'Small Poison', 'Small Script', 'Small Shadow', 'Small Slant', 'Small Tengwar', 'Small', 'Soft', 'Speed', 'Spliff', 'Stacey', 'Stampate', 'Stampatello', 'Standard', 'Star Strips', 'Star Wars', 'Stellar', 'Stforek', 'Stick Letters', 'Stop', 'Straight', 'Stronger Than All', 'Sub-Zero', 'Swamp Land', 'Swan', 'Sweet', 'THIS', 'Tanja', 'Tengwar', 'Term', 'Test1', 'The Edge', 'Thick', 'Thin', 'Thorned', 'Three Point', 'Ticks Slant', 'Ticks', 'Tiles', 'Tinker-Toy', 'Tombstone', 'Train', 'Trek', 'Tsalagi', 'Tubular', 'Twisted', 'Two Point', 'USA Flag', 'Univers', 'Varsity', 'Wavy', 'Weird', 'Wet Letter', 'Whimsy', 'Wow'];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onUnmounted, ref } from 'vue';
|
||||
import CountriesDB from 'countries-db';
|
||||
import ISO6391 from 'iso-639-1';
|
||||
import useDebouncedRef from '@/composable/debouncedref';
|
||||
@@ -11,7 +12,7 @@ const { searchResult } = useFlexSearch({
|
||||
search: searchQuery,
|
||||
data: countriesSearchData,
|
||||
options: {
|
||||
keys: ['name', { name: 'iso3', weight: 3 }, { name: 'iso2', weight: 2 }, 'domain'],
|
||||
keys: [{ name: 'name', weight: 2 }, { name: 'iso3', weight: 3 }, { name: 'iso2', weight: 2 }, 'officialName', 'domain', 'continentId', 'currencyCode', 'currencyName', 'phoneCode'],
|
||||
},
|
||||
limit,
|
||||
});
|
||||
@@ -23,6 +24,66 @@ function langToName(code: string) {
|
||||
}
|
||||
return `${code} (${name})`;
|
||||
}
|
||||
|
||||
// Batch loading logic for search results
|
||||
const RESULTS_PER_BATCH = 2; // Show 2 results per batch
|
||||
const visibleResultsCount = ref(RESULTS_PER_BATCH); // Start with first batch
|
||||
let loadingInterval: NodeJS.Timeout | null = null;
|
||||
|
||||
// Computed property for visible search results
|
||||
const visibleSearchResults = computed(() => {
|
||||
return searchResult.value.slice(0, visibleResultsCount.value);
|
||||
});
|
||||
|
||||
// Function to stop automated loading
|
||||
function stopAutomatedLoading() {
|
||||
if (loadingInterval) {
|
||||
clearInterval(loadingInterval);
|
||||
loadingInterval = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Function to start automated loading
|
||||
function startAutomatedLoading() {
|
||||
// Clear any existing interval
|
||||
if (loadingInterval) {
|
||||
clearInterval(loadingInterval);
|
||||
}
|
||||
|
||||
// Reset visible count when starting new search
|
||||
visibleResultsCount.value = RESULTS_PER_BATCH;
|
||||
|
||||
// Start loading batches every 150ms
|
||||
loadingInterval = setInterval(() => {
|
||||
if (visibleResultsCount.value < searchResult.value.length) {
|
||||
visibleResultsCount.value = Math.min(
|
||||
visibleResultsCount.value + RESULTS_PER_BATCH,
|
||||
searchResult.value.length,
|
||||
);
|
||||
}
|
||||
else {
|
||||
// Stop loading when all results are visible
|
||||
stopAutomatedLoading();
|
||||
}
|
||||
}, 150);
|
||||
}
|
||||
|
||||
// Watch for changes in search results to restart batching
|
||||
watch(searchResult, (newResults) => {
|
||||
if (newResults.length > 0) {
|
||||
nextTick(() => {
|
||||
startAutomatedLoading();
|
||||
});
|
||||
}
|
||||
else {
|
||||
stopAutomatedLoading();
|
||||
}
|
||||
}, { immediate: true });
|
||||
|
||||
// Clean up on component unmount
|
||||
onUnmounted(() => {
|
||||
stopAutomatedLoading();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -54,7 +115,7 @@ function langToName(code: string) {
|
||||
<th>Name and Info</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(result, ix) in searchResult" :key="ix">
|
||||
<tr v-for="(result, ix) in visibleSearchResults" :key="ix">
|
||||
<td style="vertical-align: top">
|
||||
<input-copyable :value="result.iso2" :readonly="true" />
|
||||
<input-copyable :value="result.iso3" :readonly="true" />
|
||||
@@ -74,7 +135,7 @@ function langToName(code: string) {
|
||||
label-width="150px"
|
||||
label="Emoji"
|
||||
label-position="left"
|
||||
:value="`${result.emoji} (${result.emojiUnicode})`"
|
||||
:value="`${result.emoji}`"
|
||||
:readonly="true"
|
||||
mb-1
|
||||
/>
|
||||
@@ -158,6 +219,7 @@ function langToName(code: string) {
|
||||
result.neighborCountryIds
|
||||
.map((id) => CountriesDB.getCountry(id, 'name')?.toString() || id)
|
||||
.join(', ')
|
||||
|| 'None'
|
||||
"
|
||||
:readonly="true"
|
||||
mb-1
|
||||
@@ -188,6 +250,13 @@ function langToName(code: string) {
|
||||
</tr>
|
||||
</tbody>
|
||||
</n-table>
|
||||
|
||||
<!-- Loading indicator when more results are coming -->
|
||||
<div v-if="visibleResultsCount < searchResult.length" mt-6 text-center>
|
||||
<div text-14px op-70>
|
||||
Loading more results... ({{ visibleSearchResults.length }}/{{ searchResult.length }})
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -277,6 +277,7 @@ defineExpose({
|
||||
flex: 1 1 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.input-wrapper {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@@ -300,8 +301,28 @@ defineExpose({
|
||||
overflow-wrap: break-word;
|
||||
border: none;
|
||||
outline: none;
|
||||
font-family: inherit;
|
||||
/* This font family structure will let the text use one of the fonts that are available on the system.
|
||||
When an emoji is used, it will fall back to the first font that has proper support for it. ('Noto Color Emoji' and below).
|
||||
Thus this structure will make sure that text and emojis are rendered correctly without interfering with each other.
|
||||
*/
|
||||
font-family:
|
||||
system-ui, /* System default */
|
||||
-apple-system, /* Apple system font */
|
||||
'Segoe UI', /* Windows */
|
||||
'Roboto', /* Android */
|
||||
'Helvetica Neue', /* macOS fallback */
|
||||
Arial, /* Universal fallback */
|
||||
'Noto Color Emoji', /* Best flag and complex emoji support */
|
||||
'Apple Color Emoji', /* Apple devices emoji */
|
||||
'Segoe UI Emoji', /* Windows emoji */
|
||||
'Twemoji Mozilla', /* Firefox emoji fallback */
|
||||
'EmojiOne Color', /* Additional emoji fallback */
|
||||
sans-serif;
|
||||
font-size: inherit;
|
||||
font-feature-settings: 'liga' off;
|
||||
font-variant-emoji: emoji;
|
||||
text-rendering: optimizeQuality;
|
||||
line-height: 1.2;
|
||||
color: v-bind('appTheme.text.baseColor');
|
||||
|
||||
&::placeholder {
|
||||
@@ -322,6 +343,27 @@ defineExpose({
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
border: none;
|
||||
/* This font family structure will let the text use one of the fonts that are available on the system.
|
||||
When an emoji is used, it will fall back to the first font that has proper support for it. ('Noto Color Emoji' and below).
|
||||
Thus this structure will make sure that text and emojis are rendered correctly without interfering with each other.
|
||||
*/
|
||||
font-family:
|
||||
system-ui, /* System default */
|
||||
-apple-system, /* Apple system font */
|
||||
'Segoe UI', /* Windows */
|
||||
'Roboto', /* Android */
|
||||
'Helvetica Neue', /* macOS fallback */
|
||||
Arial, /* Universal fallback */
|
||||
'Noto Color Emoji', /* Best flag and complex emoji support */
|
||||
'Apple Color Emoji', /* Apple devices emoji */
|
||||
'Segoe UI Emoji', /* Windows emoji */
|
||||
'Twemoji Mozilla', /* Firefox emoji fallback */
|
||||
'EmojiOne Color', /* Additional emoji fallback */
|
||||
sans-serif;
|
||||
font-feature-settings: 'liga' off;
|
||||
font-variant-emoji: emoji;
|
||||
text-rendering: optimizeQuality;
|
||||
line-height: 1.2;
|
||||
color: v-bind('appTheme.text.baseColor');
|
||||
|
||||
&::placeholder {
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { CLabelProps } from '../c-label/c-label.types';
|
||||
import type { CSelectOption } from './c-select.types';
|
||||
import { useTheme } from './c-select.theme';
|
||||
import { clamp } from '@/modules/shared/number.models';
|
||||
import { useFuzzySearch } from '@/composable/fuzzySearch';
|
||||
import { useFlexSearch } from '@/composable/flexSearch';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -74,13 +74,12 @@ watch(
|
||||
},
|
||||
);
|
||||
|
||||
const { searchResult: filteredOptions } = useFuzzySearch<CSelectOption<T>>({
|
||||
const { searchResult: filteredOptions } = useFlexSearch<CSelectOption<T>>({
|
||||
search: searchQuery,
|
||||
data: options.value,
|
||||
options: {
|
||||
keys: ['label'],
|
||||
shouldSort: false,
|
||||
threshold: 0.3,
|
||||
filterEmpty: false,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user