diff --git a/src/app/(pages)/(main)/assign/list/page.tsx b/src/app/(pages)/(main)/assign/list/page.tsx index 8e59f40..043e8cb 100644 --- a/src/app/(pages)/(main)/assign/list/page.tsx +++ b/src/app/(pages)/(main)/assign/list/page.tsx @@ -1,6 +1,6 @@ 'use client' -import { useEffect, useMemo, useState } from 'react' +import { useMemo, useState } from 'react' import { useMounted } from '@kri/common/hooks' import { LoadingOverlayAdapter } from '@/components/app-shell/LoadingOverlayAdapter' import { useAuth } from '@/hooks/useAuth' @@ -19,9 +19,9 @@ import { createEmptyListFilter, type ListFilter, type ListHeaderAssignType, type import type { ResultCode } from '@/types/project' const ASSIGN_TAB_TYPES: ListHeaderAssignType[] = [ - ListHeaderAssignConst.OUTSOURCE, ListHeaderAssignConst.CONTACT_INTERVIEWER, ListHeaderAssignConst.FIELD_INTERVIEWER, + ListHeaderAssignConst.OUTSOURCE, ] const ASSIGNED_SENTINEL = '__ASSIGNED__' @@ -37,7 +37,7 @@ const ListAssignPage = () => { const enabled = mounted && prjctIdx > 0 const userRole = auth?.user?.userRole ?? 0 - const [assignType, setAssignType] = useState(ListHeaderAssignConst.OUTSOURCE) + const [assignType, setAssignType] = useState(ListHeaderAssignConst.CONTACT_INTERVIEWER) const [selectedAssignId, setSelectedAssignId] = useState(undefined) const [assignFilterIds, setAssignFilterIds] = useState([]) const [transferResve, setTransferResve] = useState(false) @@ -60,11 +60,6 @@ const ListAssignPage = () => { setSelectedAssignId(undefined) } - // 좌측 테이블 선택값이 바뀌면 결과 필터 multiselect도 그 값으로 맞춘다. - useEffect(() => { - setAssignFilterIds(selectedAssignId ? [selectedAssignId] : []) - }, [selectedAssignId]) - // "배정됨"/"배정되지 않음"은 실제 대상 선택과 동시에 선택될 수 없다: 새로 클릭된 쪽만 남긴다. const handleAssignFilterChange = (next: string[]) => { const addedSentinel = next.find((value) => isAssignFilterSentinel(value) && !assignFilterIds.includes(value)) diff --git a/src/components/assign/AssignTargetList.tsx b/src/components/assign/AssignTargetList.tsx index bf590e1..9e7d5b6 100644 --- a/src/components/assign/AssignTargetList.tsx +++ b/src/components/assign/AssignTargetList.tsx @@ -61,7 +61,13 @@ export function useAssignTargetRows({ prjctIdx, enabled, assignType }: UseAssign ]) } -export function AssignTargetList({ prjctIdx, enabled, assignType, selectedId, onSelect }: AssignTargetListProps) { +export function AssignTargetList({ + prjctIdx, + enabled, + assignType, + selectedId, + onSelect +}: AssignTargetListProps) { const rows = useAssignTargetRows({ prjctIdx, enabled, assignType }) return ( diff --git a/src/components/common/KriDateTimePicker.tsx b/src/components/common/KriDateTimePicker.tsx index 5d04f08..07fb8ba 100644 --- a/src/components/common/KriDateTimePicker.tsx +++ b/src/components/common/KriDateTimePicker.tsx @@ -17,6 +17,11 @@ export type KriDateTimePickerProps = { contentClassName?: string disabled?: boolean modalPopover?: boolean + startHour?: number + endHour?: number + minuteStep?: number + hourLabel?: string + minuteLabel?: string } const parseDateTime = (value: string): { date: Date | undefined; time: string } => { @@ -59,15 +64,20 @@ const toDisplayText = (date: Date | undefined, time: string, placeholder: string } export function KriDateTimePicker({ - value, - onChange, - placeholder = '날짜/시간 선택', - className, - triggerClassName, - contentClassName, - disabled = false, - modalPopover = true, - }: KriDateTimePickerProps) { + value, + onChange, + placeholder = '날짜/시간 선택', + className, + triggerClassName, + contentClassName, + disabled = false, + modalPopover = true, + startHour, + endHour, + minuteStep, + hourLabel, + minuteLabel, +}: KriDateTimePickerProps) { const [open, setOpen] = React.useState(false) const { date, time } = parseDateTime(value) const hasValue = date !== undefined @@ -83,53 +93,59 @@ export function KriDateTimePicker({ } return ( -
- - - - - -
- - -
-
-
+
+ + + + + +
+ + +
+
+
- {hasValue && !disabled ? ( - - ) : null} -
+ {hasValue && !disabled ? ( + + ) : null} +
) } diff --git a/src/components/common/KriPassword.tsx b/src/components/common/KriPassword.tsx index bb08188..5b9182d 100644 --- a/src/components/common/KriPassword.tsx +++ b/src/components/common/KriPassword.tsx @@ -9,10 +9,10 @@ import { cn } from '@/lib/utils' import { KRI_PW_REGEX, ONLY_ALLOWED_PW_REGEX } from '@/const/validationConst' const requirements = [ - { test: (value: string) => /[A-Za-z]/.test(value), text: '영문 1개 이상' }, - { test: (value: string) => /\d/.test(value), text: '숫자 1개 이상' }, - { test: (value: string) => value.length >= 8 && value.length <= 20, text: '8~20자' }, - { test: (value: string) => !value || ONLY_ALLOWED_PW_REGEX.test(value), text: '허용 문자만 사용' }, + //{ test: (value: string) => /[A-Za-z]/.test(value), text: '영문 1개 이상' }, + //{ test: (value: string) => /\d/.test(value), text: '숫자 1개 이상' }, + //{ test: (value: string) => value.length >= 1 && value.length <= 20, text: '1~20자' }, + { test: (value: string) => !value || KRI_PW_REGEX.test(value), text: '영문, 숫자, 허용된 특수문자를 사용하여 1~20자로 입력해야 합니다.' }, ] export type KriPasswordRef = { @@ -55,12 +55,13 @@ export const KriPassword = forwardRef(function const score = checks.filter((item) => item.met).length const statusText = useMemo(() => { - if (!value) return '비밀번호를 입력하세요' - if (!hasOnlyAllowedChars) return '허용되지 않는 문자가 포함되어 있어요' - return isValid ? '사용 가능한 비밀번호입니다' : '영문과 숫자를 포함한 8~20자로 입력하세요' + if (!value) return '비밀번호를 입력하세요.' + if (!hasOnlyAllowedChars) return '허용되지 않는 문자가 포함되어 있습니다.' + return isValid ? '사용 가능한 비밀번호입니다' : '영문, 숫자, 허용된 특수문자를 사용하여 1~20자로 입력해야 합니다.' }, [hasOnlyAllowedChars, isValid, value]) - const barClass = score <= 1 ? 'bg-destructive' : score === 2 ? 'bg-orange-500' : score === 3 ? 'bg-yellow-400' : 'bg-green-500' + //const barClass = score <= 1 ? 'bg-destructive' : score === 2 ? 'bg-orange-500' : score === 3 ? 'bg-yellow-400' : 'bg-green-500' + const barClass = 'bg-green-500' return (
diff --git a/src/components/common/KriTimePicker.tsx b/src/components/common/KriTimePicker.tsx index 67d1e13..d73ca67 100644 --- a/src/components/common/KriTimePicker.tsx +++ b/src/components/common/KriTimePicker.tsx @@ -9,6 +9,10 @@ export type KriTimePickerProps = { onChange: (value: string) => void disabled?: boolean minuteStep?: number + startHour?: number + endHour?: number + hourLabel?: string + minuteLabel?: string className?: string } @@ -27,72 +31,97 @@ const formatTime = (hour: number, minute: number) => { return `${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}` } +const normalizeHour = (hour: number, fallback: number) => { + return Number.isFinite(hour) ? Math.min(23, Math.max(0, Math.trunc(hour))) : fallback +} + export function KriTimePicker({ - value, - onChange, - disabled = false, - minuteStep = 5, - className, - }: KriTimePickerProps) { + value, + onChange, + disabled = false, + minuteStep = 5, + startHour = 0, + endHour = 23, + hourLabel = '시', + minuteLabel = '분', + className, +}: KriTimePickerProps) { const { hour: selectedHour, minute: selectedMinute } = parseTime(value) const normalizedMinuteStep = Number.isFinite(minuteStep) && minuteStep > 0 - ? Math.min(Math.floor(minuteStep), 60) - : 5 - const hours = Array.from({ length: 24 }, (_, index) => index) + ? Math.min(Math.floor(minuteStep), 60) + : 5 + + const clampedStartHour = normalizeHour(startHour, 0) + const clampedEndHour = normalizeHour(endHour, 23) + // startHour > endHour로 잘못 지정된 경우, 두 값을 뒤바꿔 유효한 범위로 되돌린다. + const [normalizedStartHour, normalizedEndHour] = clampedStartHour > clampedEndHour + ? [clampedEndHour, clampedStartHour] + : [clampedStartHour, clampedEndHour] + + const hours = Array.from( + { length: normalizedEndHour - normalizedStartHour + 1 }, + (_, index) => normalizedStartHour + index, + ) const minutes = Array.from( - { length: Math.ceil(60 / normalizedMinuteStep) }, - (_, index) => index * normalizedMinuteStep, + { length: Math.ceil(60 / normalizedMinuteStep) }, + (_, index) => index * normalizedMinuteStep, ).filter((minute) => minute < 60) const handleTimeChange = (type: 'hour' | 'minute', nextValue: number) => { if (disabled) return - const nextHour = type === 'hour' ? nextValue : selectedHour ?? 0 + const nextHour = type === 'hour' ? nextValue : selectedHour ?? normalizedStartHour const nextMinute = type === 'minute' ? nextValue : selectedMinute ?? 0 onChange(formatTime(nextHour, nextMinute)) } return ( -
- +
+
+
{hourLabel}
+
{hours.map((hour) => ( - - ))} -
- -
- - -
- {minutes.map((minute) => ( - + ))}
+ +
+
{minuteLabel}
+ +
+ {minutes.map((minute) => ( + + ))} +
+ +
+
+
) } diff --git a/src/components/list-contact/ListContactEventPanel.tsx b/src/components/list-contact/ListContactEventPanel.tsx index 3d18bb3..e32d6a7 100644 --- a/src/components/list-contact/ListContactEventPanel.tsx +++ b/src/components/list-contact/ListContactEventPanel.tsx @@ -375,7 +375,7 @@ const ListContactEventPanel = ({ {useFF && .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) => { + 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} />
,.?/]+$/ // 영문 1개 이상 + 숫자 1개 이상 포함, 8~20자, 허용된 문자만 사용 -export const KRI_PW_REGEX = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d!@#$%^&*()_+\-={}\[\]:;"'<>,.?/]{8,20}$/ +//export const KRI_PW_REGEX = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d!@#$%^&*()_+\-={}\[\]:;"'<>,.?/]{1,20}$/ +export const KRI_PW_REGEX = /^[A-Za-z\d!@#$%^&*()_+\-={}\[\]:;"'<>,.?/]{1,20}$/