260714_01_ENH: 테스트 서버에서 기동 후 중간 테스트를 위한 커밋
This commit is contained in:
77
src/components/list/ListManageActions.tsx
Normal file
77
src/components/list/ListManageActions.tsx
Normal file
@@ -0,0 +1,77 @@
|
||||
'use client'
|
||||
|
||||
import {
|
||||
Download,
|
||||
FileClock,
|
||||
Mail,
|
||||
MessageSquareMore,
|
||||
RotateCcw,
|
||||
Upload,
|
||||
} from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import type { ListDownloadMode } from '@/types/list'
|
||||
import type { MessageSendMode } from '@/components/dialog/MessageSendDialog'
|
||||
|
||||
export type ListManageActionsProps = {
|
||||
onReset: () => void
|
||||
onHeaderManage: () => void
|
||||
onUpload: () => void
|
||||
onDownload: (mode: ListDownloadMode) => void
|
||||
onMessageSend: (mode: MessageSendMode) => void
|
||||
onMessageHistory: () => void
|
||||
}
|
||||
|
||||
export function ListManageActions({
|
||||
onReset,
|
||||
onHeaderManage,
|
||||
onUpload,
|
||||
onDownload,
|
||||
onMessageSend,
|
||||
onMessageHistory,
|
||||
}: ListManageActionsProps) {
|
||||
return (
|
||||
<div className="flex gap-2 items-center">
|
||||
<div className="flex flex-1 items-center gap-2 flex-wrap">
|
||||
<Button variant="destructive" className="text-base gap-2" onClick={onReset}>
|
||||
<RotateCcw className="w-4 h-4" />
|
||||
리스트 초기화
|
||||
</Button>
|
||||
<Button className="text-base" onClick={onHeaderManage}>
|
||||
헤더 관리
|
||||
</Button>
|
||||
<Button className="text-base gap-2" onClick={onUpload}>
|
||||
<Upload className="w-4 h-4" />
|
||||
리스트 업로드
|
||||
</Button>
|
||||
<Button className="text-base bg-excel gap-2" onClick={() => onDownload('list')}>
|
||||
<Download className="w-4 h-4" />
|
||||
리스트
|
||||
</Button>
|
||||
<Button className="text-base bg-excel gap-2" onClick={() => onDownload('contact-history')}>
|
||||
<Download className="w-4 h-4" />
|
||||
컨택 이력
|
||||
</Button>
|
||||
<Button className="text-base bg-excel gap-2" onClick={() => onDownload('list-change-history')}>
|
||||
<Download className="w-4 h-4" />
|
||||
리스트 변경 이력
|
||||
</Button>
|
||||
<Button className="text-base gap-2" onClick={() => onDownload('upload-file')}>
|
||||
<Download className="w-4 h-4" />
|
||||
업로드 파일(.zip)
|
||||
</Button>
|
||||
</div>
|
||||
<Button className="text-base bg-blue gap-2" onClick={() => onMessageSend('email')}>
|
||||
<Mail className="w-4 h-4" />
|
||||
이메일 발송
|
||||
</Button>
|
||||
<Button className="text-base bg-blue gap-2" onClick={() => onMessageSend('sms')}>
|
||||
<MessageSquareMore className="w-4 h-4" />
|
||||
문자 발송
|
||||
</Button>
|
||||
<Button className="text-base gap-2" onClick={onMessageHistory}>
|
||||
<FileClock className="w-4 h-4" />
|
||||
발송 이력
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
500
src/components/list/ListSearchTable.tsx
Normal file
500
src/components/list/ListSearchTable.tsx
Normal file
@@ -0,0 +1,500 @@
|
||||
'use client'
|
||||
|
||||
import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react'
|
||||
import type { PaginationState, SortingState } from '@tanstack/react-table'
|
||||
import { Funnel, PencilLine } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { DataTable } from '@/components/data-table/DataTable'
|
||||
import type { DataTableColumn, SelectMode } from '@/components/data-table/DataTable.type'
|
||||
import { KriMultiSelect } from '@/components/common/KriAutoComplete'
|
||||
import ListBatchEditDialog, { type BatchEditRow } from '@/components/dialog/ListBatchEditDialog'
|
||||
import ListFilterDialog from '@/components/dialog/ListFilterDialog'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import { useListSearchQuery, useUpdateListMutation } from '@/query/list'
|
||||
import { getListColumns, LIST_IS_USE_LABEL, type ListTableRow } from '@/components/table-column/ListTableColumn'
|
||||
import { useAssignTargetRows } from '@/components/assign/AssignTargetList'
|
||||
import { ListHeaderAssignConst, ListHeaderConst } from '@/const/listConst'
|
||||
import {
|
||||
createEmptyListFilter,
|
||||
type FilterHeaderOption,
|
||||
type FilterOperator,
|
||||
type FilterRow,
|
||||
type FilterValueOption,
|
||||
type listHeader,
|
||||
type ListFilter,
|
||||
ListFilterMatchType,
|
||||
ListFilterOperator,
|
||||
type ListHeaderAssignType,
|
||||
type ListOtherItemFilterCondition,
|
||||
type ListSearchRequest,
|
||||
} from '@/types/list'
|
||||
import { type ResultCode, ResultCodeType } from '@/types/project'
|
||||
import {
|
||||
applyListAccessFilter,
|
||||
getLockedListFilterHeaderTypes,
|
||||
isListFilterVisibleByAccess,
|
||||
isListHeaderVisibleByAccess,
|
||||
} from '@/utils/listAccess'
|
||||
|
||||
export type ListSearchTableProps = {
|
||||
prjctIdx: number
|
||||
enabled: boolean
|
||||
userRole: number
|
||||
userId: string
|
||||
userCmpn: string
|
||||
resultCodes: ResultCode[]
|
||||
listHeaders: listHeader[]
|
||||
enableBatchEdit?: boolean
|
||||
refreshKey?: number
|
||||
selectMode?: SelectMode
|
||||
filterActions?: ReactNode
|
||||
rightActions?: ReactNode
|
||||
excludeFilterHeaderTypes?: number[]
|
||||
externalAssignFilter?: { type: ListHeaderAssignType; values: string[]; condition?: 'assigned' | 'unassigned' }
|
||||
onCurrentFilterChange?: (filter: ListFilter) => void
|
||||
onSelectedRowsChange?: (rows: ListTableRow[]) => void
|
||||
onRowClick?: (row: ListTableRow) => void
|
||||
onRowDoubleClick?: (row: ListTableRow) => void
|
||||
maxTableHeight?: string
|
||||
initialPagination?: PaginationState
|
||||
onPaginationChange?: (pagination: PaginationState) => void
|
||||
focusRowId?: string
|
||||
}
|
||||
|
||||
const toSidSet = (value: string) =>
|
||||
value
|
||||
.split(',')
|
||||
.map((item) => item.trim())
|
||||
.filter((item) => item.length > 0)
|
||||
|
||||
const sanitizeSidInput = (value: string) => {
|
||||
let result = ''
|
||||
let lastChar: 'digit' | 'comma' | 'tilde' | null = null
|
||||
let segmentHasTilde = false
|
||||
|
||||
for (const ch of value) {
|
||||
if (/[0-9]/.test(ch)) {
|
||||
result += ch
|
||||
lastChar = 'digit'
|
||||
continue
|
||||
}
|
||||
|
||||
if (ch === ',' && lastChar === 'digit') {
|
||||
result += ch
|
||||
lastChar = 'comma'
|
||||
segmentHasTilde = false
|
||||
continue
|
||||
}
|
||||
|
||||
if (ch === '~' && lastChar === 'digit' && !segmentHasTilde) {
|
||||
result += ch
|
||||
lastChar = 'tilde'
|
||||
segmentHasTilde = true
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
const toFilterCondition = (row: FilterRow, usesListValue: boolean): Omit<ListOtherItemFilterCondition, 'listHderId'> => {
|
||||
if (row.operator === 'empty') {
|
||||
return { operator: ListFilterOperator.POSITIVE, matchType: ListFilterMatchType.EMPTY, values: [] }
|
||||
}
|
||||
if (row.operator === 'notEmpty') {
|
||||
return { operator: ListFilterOperator.NEGATIVE, matchType: ListFilterMatchType.EMPTY, values: [] }
|
||||
}
|
||||
|
||||
const values = usesListValue ? row.multiValues : [row.textValue.trim()]
|
||||
|
||||
if (row.operator === 'eq') {
|
||||
return { operator: ListFilterOperator.POSITIVE, matchType: ListFilterMatchType.EXACT, values }
|
||||
}
|
||||
if (row.operator === 'neq') {
|
||||
return { operator: ListFilterOperator.NEGATIVE, matchType: ListFilterMatchType.EXACT, values }
|
||||
}
|
||||
if (row.operator === 'contains') {
|
||||
return { operator: ListFilterOperator.POSITIVE, matchType: ListFilterMatchType.CONTAINS, values }
|
||||
}
|
||||
return { operator: ListFilterOperator.NEGATIVE, matchType: ListFilterMatchType.CONTAINS, values }
|
||||
}
|
||||
|
||||
const isAssignHeaderType = (value: number): value is ListHeaderAssignType =>
|
||||
value === ListHeaderAssignConst.OUTSOURCE ||
|
||||
value === ListHeaderAssignConst.CONTACT_INTERVIEWER ||
|
||||
value === ListHeaderAssignConst.FIELD_INTERVIEWER
|
||||
|
||||
const TEXT_LIKE_OPERATORS: FilterOperator[] = ['eq', 'neq', 'contains', 'notContains', 'empty', 'notEmpty']
|
||||
const ASSIGN_LIKE_OPERATORS: FilterOperator[] = ['eq', 'neq', 'empty', 'notEmpty']
|
||||
const IS_USE_OPERATORS: FilterOperator[] = ['eq', 'neq']
|
||||
const FILE_OPERATORS: FilterOperator[] = ['empty', 'notEmpty']
|
||||
|
||||
const getAllowedOperators = (listHderTy: number): FilterOperator[] => {
|
||||
if (listHderTy === ListHeaderConst.IS_USE) return IS_USE_OPERATORS
|
||||
if (isAssignHeaderType(listHderTy) || listHderTy === ListHeaderConst.CONTENT_ITEM) return ASSIGN_LIKE_OPERATORS
|
||||
if (listHderTy === ListHeaderConst.FILE) return FILE_OPERATORS
|
||||
return TEXT_LIKE_OPERATORS
|
||||
}
|
||||
|
||||
const IS_USE_VALUE_OPTIONS: FilterValueOption[] = Object.entries(LIST_IS_USE_LABEL).map(([value, label]) => ({
|
||||
value,
|
||||
label,
|
||||
}))
|
||||
|
||||
export function ListSearchTable({
|
||||
prjctIdx,
|
||||
enabled,
|
||||
userRole,
|
||||
userId,
|
||||
userCmpn,
|
||||
resultCodes,
|
||||
listHeaders,
|
||||
enableBatchEdit = false,
|
||||
refreshKey = 0,
|
||||
selectMode = 'multi',
|
||||
filterActions,
|
||||
rightActions,
|
||||
excludeFilterHeaderTypes,
|
||||
externalAssignFilter,
|
||||
onCurrentFilterChange,
|
||||
onSelectedRowsChange,
|
||||
onRowClick,
|
||||
onRowDoubleClick,
|
||||
maxTableHeight = '66vh',
|
||||
initialPagination,
|
||||
onPaginationChange,
|
||||
focusRowId,
|
||||
}: ListSearchTableProps) {
|
||||
const { showDialog } = useDialog()
|
||||
const [searchText, setSearchText] = useState('')
|
||||
const [searchContactResult, setSearchContactResult] = useState<string[]>([])
|
||||
const [searchInterviewResult, setSearchInterviewResult] = useState<string[]>([])
|
||||
const [searchSurveyResult, setSearchSurveyResult] = useState<string[]>([])
|
||||
const [pagination, setPagination] = useState<PaginationState>(initialPagination ?? { pageIndex: 0, pageSize: 25 })
|
||||
const [sorting, setSorting] = useState<SortingState>([])
|
||||
const [filterRows, setFilterRows] = useState<FilterRow[]>([])
|
||||
const [batchRows, setBatchRows] = useState<BatchEditRow[]>([])
|
||||
|
||||
const updateListMutation = useUpdateListMutation(prjctIdx)
|
||||
|
||||
const outsourceTargetRows = useAssignTargetRows({ prjctIdx, enabled, assignType: ListHeaderAssignConst.OUTSOURCE })
|
||||
const contactTargetRows = useAssignTargetRows({
|
||||
prjctIdx,
|
||||
enabled,
|
||||
assignType: ListHeaderAssignConst.CONTACT_INTERVIEWER,
|
||||
})
|
||||
const fieldTargetRows = useAssignTargetRows({ prjctIdx, enabled, assignType: ListHeaderAssignConst.FIELD_INTERVIEWER })
|
||||
|
||||
const getValueOptionsForHeader = useCallback(
|
||||
(header: listHeader): FilterValueOption[] | undefined => {
|
||||
if (header.listHderTy === ListHeaderConst.IS_USE) return IS_USE_VALUE_OPTIONS
|
||||
if (header.listHderTy === ListHeaderAssignConst.OUTSOURCE) {
|
||||
return outsourceTargetRows.map((row) => ({ value: row.id, label: row.name }))
|
||||
}
|
||||
if (header.listHderTy === ListHeaderAssignConst.CONTACT_INTERVIEWER) {
|
||||
return contactTargetRows.map((row) => ({ value: row.id, label: row.name }))
|
||||
}
|
||||
if (header.listHderTy === ListHeaderAssignConst.FIELD_INTERVIEWER) {
|
||||
return fieldTargetRows.map((row) => ({ value: row.id, label: row.name }))
|
||||
}
|
||||
if (header.listHderTy === ListHeaderConst.CONTENT_ITEM) {
|
||||
return header.filterContents?.map((content) => ({ value: content, label: content }))
|
||||
}
|
||||
return undefined
|
||||
},
|
||||
[contactTargetRows, fieldTargetRows, outsourceTargetRows],
|
||||
)
|
||||
|
||||
const accessibleListHeaders = useMemo(
|
||||
() => listHeaders.filter((header) => isListHeaderVisibleByAccess(header, userRole)),
|
||||
[listHeaders, userRole],
|
||||
)
|
||||
|
||||
const accessibleFilterHeaders = useMemo(
|
||||
() =>
|
||||
listHeaders.filter(
|
||||
(header) =>
|
||||
header.listHderTy !== ListHeaderConst.SID &&
|
||||
isListFilterVisibleByAccess(header, userRole) &&
|
||||
!excludeFilterHeaderTypes?.includes(header.listHderTy),
|
||||
),
|
||||
[listHeaders, userRole, excludeFilterHeaderTypes],
|
||||
)
|
||||
|
||||
const accessibleFilterHeaderById = useMemo(
|
||||
() => new Map(accessibleFilterHeaders.map((header) => [header.listHderId, header])),
|
||||
[accessibleFilterHeaders],
|
||||
)
|
||||
|
||||
const lockedListFilterHeaderTypes = useMemo(() => getLockedListFilterHeaderTypes(userRole), [userRole])
|
||||
|
||||
const listSearchRequest = useMemo<ListSearchRequest>(() => {
|
||||
const sort = sorting?.[0] ?? { id: 'sid', desc: false as const }
|
||||
const listFilter = createEmptyListFilter()
|
||||
listFilter.sidSet = toSidSet(searchText)
|
||||
listFilter.memoConditions = []
|
||||
listFilter.resultCodeMap = {
|
||||
[ResultCodeType.CONTACT]: searchContactResult.map(Number),
|
||||
[ResultCodeType.INTERVIEW]: searchInterviewResult.map(Number),
|
||||
[ResultCodeType.SURVEY]: searchSurveyResult.map(Number),
|
||||
}
|
||||
|
||||
filterRows.forEach((row) => {
|
||||
const header = accessibleFilterHeaderById.get(row.headerId)
|
||||
if (!header || lockedListFilterHeaderTypes.has(header.listHderTy)) return
|
||||
|
||||
const isEmptyOperator = row.operator === 'empty' || row.operator === 'notEmpty'
|
||||
const usesListValue = getValueOptionsForHeader(header) !== undefined
|
||||
const condition = toFilterCondition(row, usesListValue)
|
||||
const hasValue = isEmptyOperator || condition.values.some((value) => value.trim().length > 0)
|
||||
if (!hasValue) return
|
||||
|
||||
if (header.listHderTy === ListHeaderConst.IS_USE) {
|
||||
listFilter.listUseConditions.push(condition)
|
||||
return
|
||||
}
|
||||
|
||||
if (isAssignHeaderType(header.listHderTy)) {
|
||||
listFilter.assignConditions.push({ assignType: header.listHderTy, ...condition })
|
||||
return
|
||||
}
|
||||
|
||||
if (header.listHderTy === ListHeaderConst.MEMO) {
|
||||
listFilter.memoConditions.push(condition)
|
||||
return
|
||||
}
|
||||
|
||||
listFilter.otherItemConditions.push({
|
||||
listHderId: row.headerId,
|
||||
...condition,
|
||||
})
|
||||
})
|
||||
|
||||
if (externalAssignFilter) {
|
||||
if (externalAssignFilter.condition === 'assigned') {
|
||||
listFilter.assignConditions.push({
|
||||
assignType: externalAssignFilter.type,
|
||||
operator: ListFilterOperator.NEGATIVE,
|
||||
matchType: ListFilterMatchType.EMPTY,
|
||||
})
|
||||
} else if (externalAssignFilter.condition === 'unassigned') {
|
||||
listFilter.assignConditions.push({
|
||||
assignType: externalAssignFilter.type,
|
||||
operator: ListFilterOperator.POSITIVE,
|
||||
matchType: ListFilterMatchType.EMPTY,
|
||||
})
|
||||
} else {
|
||||
listFilter.assignUserMap[externalAssignFilter.type] = externalAssignFilter.values
|
||||
}
|
||||
}
|
||||
|
||||
const restrictedListFilter = applyListAccessFilter(listFilter, { userRole, userId, userCmpn })
|
||||
|
||||
return {
|
||||
listFilter: restrictedListFilter,
|
||||
pageRequest: {
|
||||
pageIndex: pagination.pageIndex,
|
||||
pageSize: pagination.pageSize,
|
||||
sortBy: sort.id,
|
||||
sortDir: sort.desc ? 'desc' : 'asc',
|
||||
},
|
||||
}
|
||||
}, [
|
||||
accessibleFilterHeaderById,
|
||||
externalAssignFilter,
|
||||
filterRows,
|
||||
getValueOptionsForHeader,
|
||||
lockedListFilterHeaderTypes,
|
||||
pagination.pageIndex,
|
||||
pagination.pageSize,
|
||||
searchContactResult,
|
||||
searchInterviewResult,
|
||||
searchSurveyResult,
|
||||
searchText,
|
||||
sorting,
|
||||
userCmpn,
|
||||
userId,
|
||||
userRole,
|
||||
])
|
||||
|
||||
const listSearchQuery = useListSearchQuery(prjctIdx, listSearchRequest, enabled)
|
||||
const { refetch } = listSearchQuery
|
||||
|
||||
const columns = useMemo<DataTableColumn<ListTableRow, unknown>[]>(() => {
|
||||
if (!listHeaders.length) return []
|
||||
return getListColumns(listHeaders, resultCodes, userRole)
|
||||
}, [listHeaders, resultCodes, userRole])
|
||||
|
||||
const viewList = useMemo<ListTableRow[]>(
|
||||
() => (listSearchQuery.data?.content ?? []).map((row) => ({ ...row, ...row.itemList })),
|
||||
[listSearchQuery.data],
|
||||
)
|
||||
|
||||
const totalCount = listSearchQuery.data?.totalElements ?? 0
|
||||
const pageCount = listSearchQuery.data?.totalPages ?? 0
|
||||
|
||||
const headerOptions = useMemo(
|
||||
() =>
|
||||
accessibleListHeaders.map((header) => ({
|
||||
id: header.listHderId,
|
||||
label: header.listHderNm,
|
||||
})),
|
||||
[accessibleListHeaders],
|
||||
)
|
||||
|
||||
const filterHeaderOptions = useMemo<FilterHeaderOption[]>(
|
||||
() =>
|
||||
accessibleFilterHeaders.map((header) => ({
|
||||
id: header.listHderId,
|
||||
label: header.listHderNm,
|
||||
allowedOperators: getAllowedOperators(header.listHderTy),
|
||||
valueOptions: getValueOptionsForHeader(header),
|
||||
disabled: lockedListFilterHeaderTypes.has(header.listHderTy),
|
||||
})),
|
||||
[accessibleFilterHeaders, getValueOptionsForHeader, lockedListFilterHeaderTypes],
|
||||
)
|
||||
|
||||
const handleSearchClick = () => {
|
||||
setPagination((prev) => ({ ...prev, pageIndex: 0 }))
|
||||
}
|
||||
|
||||
const handleFilterConfirm = async (rows: FilterRow[]) => {
|
||||
setFilterRows(rows)
|
||||
setPagination((prev) => ({ ...prev, pageIndex: 0 }))
|
||||
}
|
||||
|
||||
const handleBatchConfirm = async (rows: BatchEditRow[]) => {
|
||||
setBatchRows(rows)
|
||||
const updateContents = Object.fromEntries(rows.map((row) => [String(row.headerId), row.value]))
|
||||
await updateListMutation.mutateAsync({
|
||||
updateContents,
|
||||
listFilter: listSearchRequest.listFilter,
|
||||
})
|
||||
await listSearchQuery.refetch()
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
onCurrentFilterChange?.(listSearchRequest.listFilter)
|
||||
}, [listSearchRequest.listFilter, onCurrentFilterChange])
|
||||
|
||||
useEffect(() => {
|
||||
onPaginationChange?.(pagination)
|
||||
}, [pagination, onPaginationChange])
|
||||
|
||||
useEffect(() => {
|
||||
setFilterRows((prev) => {
|
||||
const next = prev.filter((row) => {
|
||||
const header = accessibleFilterHeaderById.get(row.headerId)
|
||||
return !!header && !lockedListFilterHeaderTypes.has(header.listHderTy)
|
||||
})
|
||||
return next.length === prev.length ? prev : next
|
||||
})
|
||||
}, [accessibleFilterHeaderById, lockedListFilterHeaderTypes])
|
||||
|
||||
useEffect(() => {
|
||||
if (!refreshKey) return
|
||||
refetch()
|
||||
}, [refetch, refreshKey])
|
||||
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Input
|
||||
placeholder="Search SID"
|
||||
className="h-9 bg-white flex-1 min-w-0"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(sanitizeSidInput(e.target.value))}
|
||||
/>
|
||||
<div className="flex-1 min-w-0">
|
||||
<KriMultiSelect
|
||||
items={resultCodes.filter((item) => item.resultCdTy === ResultCodeType.CONTACT)}
|
||||
value={searchContactResult}
|
||||
onChange={setSearchContactResult}
|
||||
getValue={(item) => String(item.resultCd)}
|
||||
getLabel={(item) => item.resultCdLbl}
|
||||
placeholder="컨택 결과"
|
||||
widthClassName="w-full"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<KriMultiSelect
|
||||
items={resultCodes.filter((item) => item.resultCdTy === ResultCodeType.INTERVIEW)}
|
||||
value={searchInterviewResult}
|
||||
onChange={setSearchInterviewResult}
|
||||
getValue={(item) => String(item.resultCd)}
|
||||
getLabel={(item) => item.resultCdLbl}
|
||||
placeholder="면접 결과"
|
||||
widthClassName="w-full"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<KriMultiSelect
|
||||
items={resultCodes.filter((item) => item.resultCdTy === ResultCodeType.SURVEY)}
|
||||
value={searchSurveyResult}
|
||||
onChange={setSearchSurveyResult}
|
||||
getValue={(item) => String(item.resultCd)}
|
||||
getLabel={(item) => item.resultCdLbl}
|
||||
placeholder="설문 결과"
|
||||
widthClassName="w-full"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
</div>
|
||||
<Button className="text-lg shrink-0" onClick={handleSearchClick}>
|
||||
검색
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2 flex-wrap justify-between">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<Button type="button" variant="outline" className="gap-2" onClick={() => showDialog('listFilterDialog')}>
|
||||
<Funnel className="w-4 h-4" />
|
||||
필터
|
||||
</Button>
|
||||
{filterActions}
|
||||
{enableBatchEdit ? (
|
||||
<Button type="button" variant="outline" className="gap-2" onClick={() => showDialog('listBatchEditDialog')}>
|
||||
<PencilLine className="w-4 h-4" />
|
||||
일괄 수정
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
{rightActions ? <div className="flex items-center gap-2 flex-wrap">{rightActions}</div> : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-lg border border-gray-200 overflow-hidden">
|
||||
<DataTable<ListTableRow>
|
||||
columns={columns}
|
||||
data={viewList}
|
||||
getRowId={(row) => String(row.sid)}
|
||||
focusRowId={focusRowId}
|
||||
isClient={false}
|
||||
pageCount={pageCount}
|
||||
totalCount={totalCount}
|
||||
pagination={pagination}
|
||||
onPaginationChange={setPagination}
|
||||
onSortingChange={setSorting}
|
||||
selectMode={selectMode}
|
||||
onRowSelectionChange={onSelectedRowsChange}
|
||||
onRowClick={onRowClick}
|
||||
onRowDoubleClick={onRowDoubleClick}
|
||||
pageSizeOptions={[25, 50, 100]}
|
||||
maxBodyHeight={maxTableHeight}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<ListFilterDialog headerOptions={filterHeaderOptions} initialRows={filterRows} onConfirm={handleFilterConfirm} />
|
||||
{enableBatchEdit ? (
|
||||
<ListBatchEditDialog
|
||||
headerOptions={headerOptions}
|
||||
appliedFilters={Object.fromEntries(filterRows.map((row) => [row.headerId, row.multiValues]))}
|
||||
initialRows={batchRows}
|
||||
onConfirm={handleBatchConfirm}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user