MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / getColumns

Function getColumns

frontend/packages/common/src/hooks/excel.ts:42–61  ·  view source on GitHub ↗
(tableId: string, tableColumnConfig: (ProColumnType<T> & { eoTitle: string })[])

Source from the content-addressed store, hash-verified

40 }
41
42 const getColumns = (tableId: string, tableColumnConfig: (ProColumnType<T> & { eoTitle: string })[]) => {
43 let tableConfig: Record<string, { show: boolean }> | null
44 try {
45 const storedConfig = localStorage.getItem(tableId)
46 tableConfig = storedConfig ? JSON.parse(storedConfig) : {}
47 } catch (error) {
48 console.error('Error parsing localStorage config:', error)
49 tableConfig = {}
50 }
51 return tableColumnConfig
52 .filter((head: ProColumnType<T> & { eoTitle: string }) => tableConfig?.[head.dataIndex as string]?.show)
53 .map((head) => {
54 return {
55 header: $t(head.eoTitle),
56 key: head.dataIndex,
57 width: (head.eoTitle as string).length > 5 ? (head.eoTitle as string).length * 3 : 15,
58 style: (head.dataIndex as string).includes('Rate') ? { numFmt: '0.00%' } : undefined
59 }
60 })
61 }
62
63 const getFileName = (fileTitle: string, date: [number, number]): string => {
64 const [start, end] = date.map((time) => getDateFormat(time))

Callers 1

exportExcelFunction · 0.85

Calls 1

$tFunction · 0.90

Tested by

no test coverage detected