251216_01_ENH : 프로젝트에 FW User 배정 구현 및 테스트 완료

This commit is contained in:
2025-12-16 16:57:03 +09:00
parent d9775c8a1d
commit bfbf4635b3
19 changed files with 813 additions and 107 deletions

View File

@@ -14,7 +14,9 @@ type KriSelectProps<T> = {
/** 현재 선택 값 */
value: string
/** 값 변경 시 호출 */
onChange: (value: string) => void
onChange?: (value: string) => void
/** 옵션 변경시 호출 */
onChangeOption?: (option: T) => void
/** placeholder 텍스트 */
placeholder?: string
/** 기타 클래스 (예: 'w-40') */
@@ -31,22 +33,31 @@ export function KriSelect<T>({
items,
value,
onChange,
onChangeOption,
placeholder,
className,
getValue,
getLabel,
useAll = true,
}: KriSelectProps<T>) {
const extractValue = (item: T) =>
getValue ? getValue(item) : String(item)
getValue ? getValue(item) : String(item);
const extractLabel = (item: T) =>
getLabel ? getLabel(item) : String(item)
getLabel ? getLabel(item) : String(item);
return (
<Select
value={value}
onValueChange={onChange}
onValueChange={(v) => {
onChange?.(v);
const selected = items.find((item) => extractValue(item) === v);
if(selected) {
onChangeOption?.(selected);
}
}}
>
<SelectTrigger
className={cn(
@@ -60,8 +71,9 @@ export function KriSelect<T>({
<SelectContent>
{ useAll? <SelectItem key="ALL" value="ALL">전체</SelectItem> :null }
{items.map((item, idx) => {
const v = extractValue(item)
const label = extractLabel(item)
const v = extractValue(item);
const label = extractLabel(item);
return (
<SelectItem key={v ?? idx} value={v}>
{label}