261023_03_ENH: 프로젝트·필터 선택 검색을 부분 문자열 일치로 변경
This commit is contained in:
@@ -313,6 +313,11 @@ When implementing or changing frontend UI, use this order:
|
|||||||
- `kri-auto-complete` exposes `optionTooltip?: 'singleLine' | 'wrap'` and `optionTooltipClassName?: string` on `KriSingleSelect`, `KriMultiSelect`, and `MultiSelect`. It is off by default, preserving existing behavior.
|
- `kri-auto-complete` exposes `optionTooltip?: 'singleLine' | 'wrap'` and `optionTooltipClassName?: string` on `KriSingleSelect`, `KriMultiSelect`, and `MultiSelect`. It is off by default, preserving existing behavior.
|
||||||
- When enabled, hovering an option shows its full `label` in a right-side tooltip. `singleLine` stays on one line until the available viewport width; `wrap` wraps at 28rem. The item depends on the shadcn `tooltip` component and provides its own `TooltipProvider`.
|
- When enabled, hovering an option shows its full `label` in a right-side tooltip. `singleLine` stays on one line until the available viewport width; `wrap` wraps at 28rem. The item depends on the shadcn `tooltip` component and provides its own `TooltipProvider`.
|
||||||
|
|
||||||
|
### KriAutoComplete Search Match
|
||||||
|
|
||||||
|
- `kri-auto-complete` exposes `searchMatch?: 'fuzzy' | 'contains'` on `KriSingleSelect`, `KriMultiSelect`, and `MultiSelect`. It defaults to `fuzzy` (cmdk's default subsequence scoring), preserving existing behavior.
|
||||||
|
- `contains` keeps only options whose label or value contains the search text as a case-insensitive substring, in the original option order. It applies only when `searchMode` is `filter`.
|
||||||
|
|
||||||
### KriEditor SMS Preview
|
### KriEditor SMS Preview
|
||||||
|
|
||||||
- `changeSmsType` reports `SMS | LMS | MMS`. Update consumer callbacks to handle `MMS`; this widens the previous callback contract.
|
- `changeSmsType` reports `SMS | LMS | MMS`. Update consumer callbacks to handle `MMS`; this widens the previous callback contract.
|
||||||
|
|||||||
@@ -3,14 +3,25 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { MultiSelect } from '@/components/common/multi-select'
|
import { MultiSelect } from '@/components/common/multi-select'
|
||||||
import type { MultiSelectOption, MultiSelectOptionTooltip, MultiSelectRef } from '@/components/common/multi-select'
|
import type {
|
||||||
|
MultiSelectOption,
|
||||||
|
MultiSelectOptionTooltip,
|
||||||
|
MultiSelectRef,
|
||||||
|
MultiSelectSearchMatch,
|
||||||
|
} from '@/components/common/multi-select'
|
||||||
|
|
||||||
export type { MultiSelectOption, MultiSelectOptionTooltip, MultiSelectRef } from '@/components/common/multi-select'
|
export type {
|
||||||
|
MultiSelectOption,
|
||||||
|
MultiSelectOptionTooltip,
|
||||||
|
MultiSelectRef,
|
||||||
|
MultiSelectSearchMatch,
|
||||||
|
} from '@/components/common/multi-select'
|
||||||
|
|
||||||
export interface KriAutoCompleteBaseProps<T> {
|
export interface KriAutoCompleteBaseProps<T> {
|
||||||
items: T[]
|
items: T[]
|
||||||
searchable?: boolean
|
searchable?: boolean
|
||||||
searchMode?: 'filter' | 'inputOnly'
|
searchMode?: 'filter' | 'inputOnly'
|
||||||
|
searchMatch?: MultiSelectSearchMatch
|
||||||
resetScrollOnSearch?: boolean
|
resetScrollOnSearch?: boolean
|
||||||
defaultSearchValue?: string
|
defaultSearchValue?: string
|
||||||
onSearchValueChange?: (value: string) => void
|
onSearchValueChange?: (value: string) => void
|
||||||
@@ -59,6 +70,7 @@ export function KriMultiSelect<T = unknown>({
|
|||||||
onChange,
|
onChange,
|
||||||
searchable = true,
|
searchable = true,
|
||||||
searchMode = 'filter',
|
searchMode = 'filter',
|
||||||
|
searchMatch = 'fuzzy',
|
||||||
resetScrollOnSearch = false,
|
resetScrollOnSearch = false,
|
||||||
defaultSearchValue = '',
|
defaultSearchValue = '',
|
||||||
onSearchValueChange,
|
onSearchValueChange,
|
||||||
@@ -102,6 +114,7 @@ export function KriMultiSelect<T = unknown>({
|
|||||||
badgeClassName={badgeClassName}
|
badgeClassName={badgeClassName}
|
||||||
searchable={searchable}
|
searchable={searchable}
|
||||||
searchMode={searchMode}
|
searchMode={searchMode}
|
||||||
|
searchMatch={searchMatch}
|
||||||
resetScrollOnSearch={resetScrollOnSearch}
|
resetScrollOnSearch={resetScrollOnSearch}
|
||||||
defaultSearchValue={defaultSearchValue}
|
defaultSearchValue={defaultSearchValue}
|
||||||
onSearchValueChange={onSearchValueChange}
|
onSearchValueChange={onSearchValueChange}
|
||||||
@@ -140,6 +153,7 @@ function KriSingleSelectInner<T>({
|
|||||||
onChange,
|
onChange,
|
||||||
searchable = true,
|
searchable = true,
|
||||||
searchMode = 'filter',
|
searchMode = 'filter',
|
||||||
|
searchMatch = 'fuzzy',
|
||||||
resetScrollOnSearch = false,
|
resetScrollOnSearch = false,
|
||||||
defaultSearchValue = '',
|
defaultSearchValue = '',
|
||||||
onSearchValueChange,
|
onSearchValueChange,
|
||||||
@@ -220,6 +234,7 @@ function KriSingleSelectInner<T>({
|
|||||||
badgeClassName={badgeClassName}
|
badgeClassName={badgeClassName}
|
||||||
searchable={searchable}
|
searchable={searchable}
|
||||||
searchMode={searchMode}
|
searchMode={searchMode}
|
||||||
|
searchMatch={searchMatch}
|
||||||
resetScrollOnSearch={resetScrollOnSearch}
|
resetScrollOnSearch={resetScrollOnSearch}
|
||||||
defaultSearchValue={defaultSearchValue}
|
defaultSearchValue={defaultSearchValue}
|
||||||
onSearchValueChange={onSearchValueChange}
|
onSearchValueChange={onSearchValueChange}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ function MultiSelectInner<T>(
|
|||||||
hideSelectAll = false,
|
hideSelectAll = false,
|
||||||
searchable = true,
|
searchable = true,
|
||||||
searchMode = 'filter',
|
searchMode = 'filter',
|
||||||
|
searchMatch = 'fuzzy',
|
||||||
resetScrollOnSearch = false,
|
resetScrollOnSearch = false,
|
||||||
defaultSearchValue = '',
|
defaultSearchValue = '',
|
||||||
onSearchValueChange,
|
onSearchValueChange,
|
||||||
@@ -202,6 +203,7 @@ function MultiSelectInner<T>(
|
|||||||
selectedValues={selectedValues}
|
selectedValues={selectedValues}
|
||||||
searchable={searchable}
|
searchable={searchable}
|
||||||
searchMode={searchMode}
|
searchMode={searchMode}
|
||||||
|
searchMatch={searchMatch}
|
||||||
resetScrollOnSearch={resetScrollOnSearch}
|
resetScrollOnSearch={resetScrollOnSearch}
|
||||||
searchValue={searchValue}
|
searchValue={searchValue}
|
||||||
onSearchValueChange={handleSearchChange}
|
onSearchValueChange={handleSearchChange}
|
||||||
|
|||||||
@@ -13,14 +13,26 @@ import {
|
|||||||
} from '@/components/ui/command'
|
} from '@/components/ui/command'
|
||||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import type { MultiSelectGroup, MultiSelectOption, MultiSelectOptionTooltip, MultiSelectOptions } from './types'
|
import type {
|
||||||
|
MultiSelectGroup,
|
||||||
|
MultiSelectOption,
|
||||||
|
MultiSelectOptionTooltip,
|
||||||
|
MultiSelectOptions,
|
||||||
|
MultiSelectSearchMatch,
|
||||||
|
} from './types'
|
||||||
import { isGroupedOptions } from './utils'
|
import { isGroupedOptions } from './utils'
|
||||||
|
|
||||||
|
// Case-insensitive substring match; equal scores keep the original option order.
|
||||||
|
function containsFilter(value: string, search: string) {
|
||||||
|
return value.toLowerCase().includes(search.toLowerCase()) ? 1 : 0
|
||||||
|
}
|
||||||
|
|
||||||
interface MultiSelectContentProps<T> {
|
interface MultiSelectContentProps<T> {
|
||||||
options: MultiSelectOptions<T>
|
options: MultiSelectOptions<T>
|
||||||
selectedValues: string[]
|
selectedValues: string[]
|
||||||
searchable: boolean
|
searchable: boolean
|
||||||
searchMode: 'filter' | 'inputOnly'
|
searchMode: 'filter' | 'inputOnly'
|
||||||
|
searchMatch?: MultiSelectSearchMatch
|
||||||
searchValue: string
|
searchValue: string
|
||||||
resetScrollOnSearch?: boolean
|
resetScrollOnSearch?: boolean
|
||||||
onSearchValueChange: (value: string) => void
|
onSearchValueChange: (value: string) => void
|
||||||
@@ -134,6 +146,7 @@ export function MultiSelectContent<T>({
|
|||||||
selectedValues,
|
selectedValues,
|
||||||
searchable,
|
searchable,
|
||||||
searchMode,
|
searchMode,
|
||||||
|
searchMatch = 'fuzzy',
|
||||||
searchValue,
|
searchValue,
|
||||||
resetScrollOnSearch = false,
|
resetScrollOnSearch = false,
|
||||||
onSearchValueChange,
|
onSearchValueChange,
|
||||||
@@ -164,7 +177,10 @@ export function MultiSelectContent<T>({
|
|||||||
const tooltip = optionTooltip ? { mode: optionTooltip, className: optionTooltipClassName } : undefined
|
const tooltip = optionTooltip ? { mode: optionTooltip, className: optionTooltipClassName } : undefined
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<Command shouldFilter={searchMode === 'filter'}>
|
<Command
|
||||||
|
shouldFilter={searchMode === 'filter'}
|
||||||
|
filter={searchMatch === 'contains' ? containsFilter : undefined}
|
||||||
|
>
|
||||||
{searchable ? (
|
{searchable ? (
|
||||||
<CommandInput
|
<CommandInput
|
||||||
value={searchValue}
|
value={searchValue}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export type {
|
|||||||
MultiSelectRef,
|
MultiSelectRef,
|
||||||
MultiSelectResponsiveConfig,
|
MultiSelectResponsiveConfig,
|
||||||
MultiSelectResponsiveSettings,
|
MultiSelectResponsiveSettings,
|
||||||
|
MultiSelectSearchMatch,
|
||||||
MultiSelectSelectionMode,
|
MultiSelectSelectionMode,
|
||||||
MultiSelectVariant,
|
MultiSelectVariant,
|
||||||
} from './types'
|
} from './types'
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export type MultiSelectOptions<T = unknown> = MultiSelectOption<T>[] | MultiSele
|
|||||||
export type MultiSelectSelectionMode = 'single' | 'multiple'
|
export type MultiSelectSelectionMode = 'single' | 'multiple'
|
||||||
export type MultiSelectVariant = 'default' | 'secondary' | 'destructive' | 'inverted'
|
export type MultiSelectVariant = 'default' | 'secondary' | 'destructive' | 'inverted'
|
||||||
export type MultiSelectOptionTooltip = 'singleLine' | 'wrap'
|
export type MultiSelectOptionTooltip = 'singleLine' | 'wrap'
|
||||||
|
export type MultiSelectSearchMatch = 'fuzzy' | 'contains'
|
||||||
|
|
||||||
export interface MultiSelectResponsiveSettings {
|
export interface MultiSelectResponsiveSettings {
|
||||||
maxCount?: number
|
maxCount?: number
|
||||||
@@ -65,6 +66,7 @@ export interface MultiSelectProps<T = unknown>
|
|||||||
hideSelectAll?: boolean
|
hideSelectAll?: boolean
|
||||||
searchable?: boolean
|
searchable?: boolean
|
||||||
searchMode?: 'filter' | 'inputOnly'
|
searchMode?: 'filter' | 'inputOnly'
|
||||||
|
searchMatch?: MultiSelectSearchMatch
|
||||||
resetScrollOnSearch?: boolean
|
resetScrollOnSearch?: boolean
|
||||||
defaultSearchValue?: string
|
defaultSearchValue?: string
|
||||||
onSearchValueChange?: (value: string) => void
|
onSearchValueChange?: (value: string) => void
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ export function ProjectSelector() {
|
|||||||
className="h-8 min-h-8 rounded-[39px] border-[#d0d0d0] bg-kart-soft px-[22px] py-0 text-sm shadow-none"
|
className="h-8 min-h-8 rounded-[39px] border-[#d0d0d0] bg-kart-soft px-[22px] py-0 text-sm shadow-none"
|
||||||
spanClassName="text-sm [&_span]:text-kart-text"
|
spanClassName="text-sm [&_span]:text-kart-text"
|
||||||
searchable
|
searchable
|
||||||
|
// Legacy Dropdown search: case-insensitive substring, not fuzzy.
|
||||||
|
searchMatch="contains"
|
||||||
resetScrollOnSearch
|
resetScrollOnSearch
|
||||||
// Legacy react-tooltip: full "(pkey) title" on hover, right side, 65% opacity.
|
// Legacy react-tooltip: full "(pkey) title" on hover, right side, 65% opacity.
|
||||||
optionTooltip="singleLine"
|
optionTooltip="singleLine"
|
||||||
|
|||||||
@@ -243,6 +243,8 @@ function FilterLineRow({
|
|||||||
className="h-[38px] min-h-[38px] rounded-[4px] border-[#d0d0d0] text-sm"
|
className="h-[38px] min-h-[38px] rounded-[4px] border-[#d0d0d0] text-sm"
|
||||||
spanClassName="text-sm"
|
spanClassName="text-sm"
|
||||||
searchable
|
searchable
|
||||||
|
// Legacy Dropdown search: case-insensitive substring, not fuzzy.
|
||||||
|
searchMatch="contains"
|
||||||
preventDeselect
|
preventDeselect
|
||||||
hideOptionCheck
|
hideOptionCheck
|
||||||
// Legacy QuestionSelect tooltip: full title on hover.
|
// Legacy QuestionSelect tooltip: full title on hover.
|
||||||
@@ -305,6 +307,8 @@ function FilterLineRow({
|
|||||||
badgeClassName="text-xs"
|
badgeClassName="text-xs"
|
||||||
maxSelected={multi ? undefined : 1}
|
maxSelected={multi ? undefined : 1}
|
||||||
hideSelectAll={!multi}
|
hideSelectAll={!multi}
|
||||||
|
// Legacy ValueSelect search: case-insensitive substring.
|
||||||
|
searchMatch="contains"
|
||||||
// Legacy ValueSelect tooltip: full label on hover.
|
// Legacy ValueSelect tooltip: full label on hover.
|
||||||
optionTooltip="singleLine"
|
optionTooltip="singleLine"
|
||||||
optionTooltipClassName="opacity-65"
|
optionTooltipClassName="opacity-65"
|
||||||
|
|||||||
Reference in New Issue
Block a user