260810_01_ENH: sid 필터 복붙, 리스트 배정 화면에서 대상 선택시 필터 자동적용, pw 제한, timepicker 수정
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react'
|
||||
import { useCallback, useEffect, useMemo, useState, type ClipboardEvent, type ReactNode } from 'react'
|
||||
import type { PaginationState, SortingState } from '@tanstack/react-table'
|
||||
import { Funnel, PencilLine } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -77,6 +77,8 @@ const toSidSet = (value: string) =>
|
||||
.map((item) => item.trim())
|
||||
.filter((item) => item.length > 0)
|
||||
|
||||
const deduplicateSidInput = (value: string) => [...new Set(toSidSet(value))].join(',')
|
||||
|
||||
const sanitizeSidInput = (value: string) => {
|
||||
let result = ''
|
||||
let lastChar: 'digit' | 'comma' | 'tilde' | null = null
|
||||
@@ -485,6 +487,17 @@ export function ListSearchTable({
|
||||
setPagination((prev) => ({ ...prev, pageIndex: 0 }))
|
||||
}
|
||||
|
||||
const handleSidPaste = (e: ClipboardEvent<HTMLInputElement>) => {
|
||||
const pastedText = e.clipboardData.getData('text')
|
||||
const normalizedText = pastedText.replace(/\t|\r\n|\r|\n/g, ',')
|
||||
|
||||
e.preventDefault()
|
||||
const selectionStart = e.currentTarget.selectionStart ?? searchText.length
|
||||
const selectionEnd = e.currentTarget.selectionEnd ?? selectionStart
|
||||
const nextValue = `${searchText.slice(0, selectionStart)}${normalizedText}${searchText.slice(selectionEnd)}`
|
||||
setSearchText(deduplicateSidInput(sanitizeSidInput(nextValue)))
|
||||
}
|
||||
|
||||
const handleFilterConfirm = async (rows: FilterRow[]) => {
|
||||
setFilterRows(rows)
|
||||
setPagination((prev) => ({ ...prev, pageIndex: 0 }))
|
||||
@@ -565,6 +578,7 @@ export function ListSearchTable({
|
||||
className="h-9 bg-white flex-1 min-w-0 max-w-xs"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(sanitizeSidInput(e.target.value))}
|
||||
onPaste={handleSidPaste}
|
||||
/>
|
||||
<div className="flex-1 min-w-0 max-w-xs">
|
||||
<KriMultiSelect
|
||||
|
||||
Reference in New Issue
Block a user