260728_03_ENH: 시나리오에 치환 문자열 적용, 현황 bar chart에 bar max width 적용, 리스트 업로드 이력에서 만료된 파일은 안나오게 수정
This commit is contained in:
36
src/components/list-contact/listContactVariables.ts
Normal file
36
src/components/list-contact/listContactVariables.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { LIST_IS_USE_LABEL } from '@/components/table-column/ListTableColumn'
|
||||
import { ListHeaderConst } from '@/const/listConst'
|
||||
import type { listHeader, ListSearchWithFullResult } from '@/types/list'
|
||||
import { isAssignHeaderType } from '@/utils/listAccess'
|
||||
|
||||
export const resolveListHeaderValue = (
|
||||
header: listHeader,
|
||||
detail?: ListSearchWithFullResult,
|
||||
): string => {
|
||||
if (header.listHderTy === ListHeaderConst.MEMO) return detail?.memo ?? ''
|
||||
if (header.listHderTy === ListHeaderConst.IS_USE) {
|
||||
return detail?.use != null ? (LIST_IS_USE_LABEL[detail.use] ?? '') : ''
|
||||
}
|
||||
if (isAssignHeaderType(header.listHderTy)) {
|
||||
return detail?.assignList?.[header.listHderTy] ?? ''
|
||||
}
|
||||
return detail?.itemList?.[header.listHderId] ?? ''
|
||||
}
|
||||
|
||||
export const buildListContactVariableValues = (
|
||||
listHeaders: listHeader[],
|
||||
detail: ListSearchWithFullResult | undefined,
|
||||
sid: string,
|
||||
): Record<string, string> => {
|
||||
const values: Record<string, string> = {}
|
||||
|
||||
// 화면 노출 여부와 무관하게 전체 헤더 값을 치환 대상으로 사용한다.
|
||||
for (const header of listHeaders) {
|
||||
if (header.listHderTy === ListHeaderConst.SID) continue
|
||||
values[header.listHderNm] = resolveListHeaderValue(header, detail)
|
||||
}
|
||||
|
||||
// 같은 이름의 커스텀 헤더가 있어도 예약 토큰 SID에는 실제 SID를 사용한다.
|
||||
values.SID = sid
|
||||
return values
|
||||
}
|
||||
Reference in New Issue
Block a user