@erpsquad/common 1.8.96 → 1.8.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index/index.esm3.js +2 -4
- package/dist/_virtual/index/index.esm3.js.map +1 -1
- package/dist/_virtual/index/index.esm4.js +3 -3
- package/dist/_virtual/index/index.esm5.js +4 -2
- package/dist/_virtual/index/index.esm5.js.map +1 -1
- package/dist/_virtual/index/index3.js +1 -1
- package/dist/_virtual/index/index4.js +1 -1
- package/dist/_virtual/index/index5.js +1 -1
- package/dist/components/material-table/components/inline-edit-fields/index.esm.js.map +1 -1
- package/dist/components/material-table/components/inline-edit-fields/index.js.map +1 -1
- package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.esm.js +1 -1
- package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.js +1 -1
- package/dist/node_modules/@mui/system/colorManipulator/index.esm.js +2 -2
- package/dist/node_modules/@mui/system/colorManipulator/index.js +1 -1
- package/dist/style.css +67 -67
- package/dist/utils/common-utility/index.esm.js +3 -0
- package/dist/utils/common-utility/index.esm.js.map +1 -1
- package/dist/utils/common-utility/index.js +1 -1
- package/dist/utils/common-utility/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -197,6 +197,9 @@ const transformTableColumns = ({
|
|
|
197
197
|
case "custom_link":
|
|
198
198
|
v = customizeValue == null ? void 0 : customizeValue(row, column.accessorKey, renderedCellValue);
|
|
199
199
|
break;
|
|
200
|
+
case "toFixed":
|
|
201
|
+
v = renderedCellValue ? renderedCellValue.toFixed(2) : renderedCellValue;
|
|
202
|
+
break;
|
|
200
203
|
}
|
|
201
204
|
if (redirectionPathWithId && column.type != "custom_link") {
|
|
202
205
|
const id = row.original[idField || "id"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../src/utils/common-utility.tsx"],"sourcesContent":["\nimport React from 'react';\n\nimport { Box } from '@mui/material';\n/* eslint-disable no-mixed-spaces-and-tabs */\nimport Typography from '../components/typography/typography';\nimport { Document } from '../components/icons';\nimport { MaterialTableColumnProps, TypeBooleanLabels } from '../components/material-table/material-table';\nimport { TFunction } from 'i18next';\nimport { formatDate } from './dateFormat';\nimport { MRT_Row, MRT_RowData } from 'material-react-table';\nimport { Link } from 'react-router-dom';\nimport DefaultAggregation from '../components/material-table/components/default-aggregation';\nimport Chip from '../components/chip/chip';\nimport _ from 'lodash';\nimport images from '../assets/images';\nimport { formatAmount } from \"./common\";\nimport { defaultCurrencyFormat } from './common';\n\nimport { defaultCurrencySymbol } from './common';\nimport ValueField from '../components/value-field/value-field';\nimport { formatLabel } from './format-text';\nimport { generateRouteWithId } from './route-utils';\nconst downloadFile = async (url, fileName) => {\n\ttry {\n\t\t\t// Fetch the file from the provided URL\n\t\t\tconst response = await fetch(url);\n\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new Error(`Failed to fetch file: ${response.statusText}`);\n\t\t\t}\n\n\t\t\t// Convert the response to a blob\n\t\t\tconst blob = await response.blob();\n\n\t\t\t// Create a temporary URL for the blob\n\t\t\tconst blobUrl = window.URL.createObjectURL(blob);\n\n\t\t\t// Create a link element\n\t\t\tconst link = document.createElement('a');\n\t\t\tlink.href = blobUrl;\n\t\t\tlink.download = fileName || 'downloaded-file'; // Fallback filename if none provided\n\n\t\t\t// Append link to the body, trigger click, and remove it\n\t\t\tdocument.body.appendChild(link);\n\t\t\tlink.click();\n\t\t\tdocument.body.removeChild(link);\n\n\t\t\t// Revoke the blob URL to free up memory\n\t\t\twindow.URL.revokeObjectURL(blobUrl);\n\t} catch (error) {\n\t\t\tconsole.error('Error downloading file:', error);\n\t\t\tthrow error; // Re-throw to allow caller to handle the error\n\t}\n};\n\nexport const getFileNamesFromUrlsAsLink = (fileUrls: string | string[], mode?: string) => {\n\tconst fUrls = fileUrls\n\t\t? Array.isArray(fileUrls)\n\t\t\t? fileUrls\n\t\t\t: [fileUrls]\n\t\t: [];\n\n\tif (fUrls && fUrls.length) {\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tdisplay='flex'\n\t\t\t\tgap={1}\n\t\t\t\tmb={1}\n\t\t\t\talignItems='center'\n\t\t\t\tflexDirection='column'>\n\t\t\t\t{fUrls.map((url) => {\n\t\t\t\t\tconst fileName = url.substring(url.lastIndexOf('/') + 1);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Typography\n\t\t\t\t\t\t\ttype='s3'\n\t\t\t\t\t\t\tweight='medium'\n\t\t\t\t\t\t\tcolor='#246DFF'\n\t\t\t\t\t\t\tsx={{ textDecoration: 'underline', textUnderlineOffset: '3px', cursor:'pointer' }}\n\t\t\t\t\t\t\tnoWrap \n\t\t\t\t\t\t\tonClick={() => mode === 'add' ? undefined : downloadFile(url, fileName)}>\n\t\t\t\t\t\t\t{fileName}\n\t\t\t\t\t\t</Typography>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn null;\n};\n\nexport const getFileNamesFromUrls = (fileUrls: string[]) => {\n\tif (!fileUrls) return null;\n\n\tif (!fileUrls?.filter(Boolean)?.length) return null;\n\n\treturn fileUrls?.filter(Boolean)?.map((url) => {\n\t\tconst fileName = url?.substring(url?.lastIndexOf('/') + 1) || '';\n\t\treturn (\n\t\t\t<Box display='flex' gap={1} mb={1} alignItems='center'>\n\t\t\t\t<Document fontSize='small' />\n\t\t\t\t<Typography\n\t\t\t\t\ttype='s3'\n\t\t\t\t\tweight='medium'\n\t\t\t\t\tcolor={'theme.secondary.1000'}\n\t\t\t\t\tsx={{cursor: 'pointer'}}\n\t\t\t\t\tnoWrap onClick={() => downloadFile(url, fileName)}>\n\t\t\t\t\t{fileName}\n\t\t\t\t</Typography>\n\t\t\t</Box>\n\t\t);\n\t});\n};\n\nexport type CurrencySymbolFn = (row: MRT_Row<MRT_RowData>) => string;\nexport type StatusClassesFn = (row: MRT_Row<MRT_RowData>) => string;\nexport type RedirectionLinkFn = (row: MRT_Row<MRT_RowData>) => string;\n\nexport interface ITransformTableColumns {\n\tcolumns: MaterialTableColumnProps[];\n\tcurrencySymbol?: string | CurrencySymbolFn;\n\ttranslationFn?: TFunction<'translation', undefined>;\n\tenableFooter?: boolean;\n\tredirectionLink?: string | RedirectionLinkFn;\n\tredirectionLinkState?: (row: MRT_Row<MRT_RowData>) => void;\n\tredirectionPathWithId?: string;\n\tidField?: string;\n\tcustomizeValue?: (row: MRT_Row<MRT_RowData>, columnAccessorKey?: string, value?: any) => any;\n\tstatusClasses?: string | StatusClassesFn;\n\trows: any[];\n\tcurrencyFormat?: boolean\n}\n\nconst jsonArrayToString = (json: any) => {\n\tif (!json) return '';\n\n\ttry {\n\t\treturn JSON.parse(json)?.join(', ');\n\t} catch (error) {\n\t\treturn '';\n\t}\n};\nconst getStatusClass = (status: any) => {\n\tif (typeof status === 'string') {\n\t\treturn status?.toLowerCase()?.replace(' ', '');\n\t} else if (typeof status === 'number') {\n\t\treturn status ? 'enabled' : 'disabled';\n\t}\n};\n\nexport const transformTableColumns = ({\n\tcolumns = [],\n\tcurrencySymbol,\n\ttranslationFn = undefined,\n\tenableFooter = false,\n\tredirectionLink = '',\n\tredirectionLinkState = undefined,\n\tredirectionPathWithId = '',\n\tidField = 'id',\n\tstatusClasses = '',\n\trows = [],\n\tcustomizeValue = undefined,\n\tcurrencyFormat\n}: ITransformTableColumns) => {\n\tconst currencyFormatData = currencyFormat ? currencyFormat : defaultCurrencyFormat()\n\n\treturn columns.map((column) => ({\n\t\t...column,\n\t\theader: translationFn ? translationFn(column.header) : column.header,\n\t\tCell: ({ renderedCellValue, row }: any) => {\n\t\t\tlet v = renderedCellValue;\n\t\t\tconst columnType = column.type || (column.header === \"Amount\" || column.header === \"Rate\" ? \"currency\" : undefined);\n\t\t\tswitch (columnType) {\n\t\t\t\tcase 'formattedString':\n\t\t\t\t\tv = formatLabel(renderedCellValue) || '-';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'date':\n\t\t\t\t\tv = formatDate(\n\t\t\t\t\t\trenderedCellValue,\n\t\t\t\t\t\tcolumn.editProperties?.dateFormat || 'DD-MM-YYYY'\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'datetime':\n\t\t\t\t\tv = formatDate(\n\t\t\t\t\t\trenderedCellValue,\n\t\t\t\t\t\tcolumn.editProperties?.dateFormat || 'DD-MM-YYYY hh:mm A'\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'currency':\n\t\t\t\tcase 'amount':{\n\t\t\t\t\tconst cs =column?.showDefaultCurrency? defaultCurrencySymbol(): currencySymbol instanceof Function ? currencySymbol(row) : (currencySymbol || defaultCurrencySymbol());\n\t\t\t\t\tv = renderedCellValue || renderedCellValue == 0\n\t\t\t\t\t\t? `${formatAmount(renderedCellValue,currencyFormatData,'before',cs)||'-'}`\n\t\t\t\t\t\t: null;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase 'status':\n\t\t\t\tcase 'enum':\n\t\t\t\tcase 'array':\n\t\t\t\t\t{\n\t\t\t\t\t\tv = renderedCellValue || renderedCellValue === 0 ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{Array.isArray(renderedCellValue) ? (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{renderedCellValue?.length ? <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, flexWrap: 'wrap' }}>\n\t\t\t\t\t\t\t\t\t{renderedCellValue.map((rcv) => (\n\t\t\t\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\t\t\t\ttype='normal'\n\t\t\t\t\t\t\t\t\t\t\tclassName={column.custom_class?column?.custom_class:(typeof rcv === 'string' ? rcv : '')}\n\t\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\t\t<Typography type='s4' weight='medium' color={'inherit'}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{typeof rcv === 'object' ? _.get(rcv, column?.typeArrayAccessorKey||'', '') : rcv}\n\t\t\t\t\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</Box> : '-'}\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\t\ttype='normal'\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\tcolumn.custom_class?column?.custom_class:\n\t\t\t\t\t\t\t\t\t\t(statusClasses instanceof Function\n\t\t\t\t\t\t\t\t\t\t\t? statusClasses(row)\n\t\t\t\t\t\t\t\t\t\t\t: `${statusClasses}${getStatusClass(renderedCellValue)}`)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t<Typography type='s4' weight='medium' color={'inherit'}>\n\t\t\t\t\t\t\t\t\t\t\t{renderedCellValue}\n\t\t\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t'-'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'boolean':\n\t\t\t\t\tv = (\n\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\ttype='normal'\n\t\t\t\t\t\t\t// active={Boolean(renderedCellValue)}\n\t\t\t\t\t\t\t// inActive={Boolean(!renderedCellValue)}\n\t\t\t\t\t\t\tsx={(theme) => ({\n\t\t\t\t\t\t\t\t\t...(renderedCellValue ? \n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: theme.palette?.theme.tertiary4[200],\n\t\t\t\t\t\t\t\t\t\t\t\tcolor: theme.palette?.theme.tertiary4[900]\n\t\t\t\t\t\t\t\t\t\t\t} :\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: theme.palette?.theme.tertiary6[200],\n\t\t\t\t\t\t\t\t\t\t\t\tcolor: theme.palette?.theme.tertiary6[900]\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t<Typography type='s4' weight='medium' color={'inherit'}>\n\t\t\t\t\t\t\t\t\t{column?.typeBooleanLabels?.[renderedCellValue as keyof TypeBooleanLabels] || '-'}\n\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'jsonArray':\n\t\t\t\t\tv = jsonArrayToString(renderedCellValue);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'custom':\n\t\t\t\tcase 'custom_link':\n\t\t\t\t\tv = customizeValue?.(row, column.accessorKey, renderedCellValue);\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// If redirectionPathWithId is provided, use it for URL parameter-based navigation\n\t\t\tif (redirectionPathWithId && column.type != 'custom_link') {\n\t\t\t\tconst id = row.original[idField||'id'];\n\t\t\t\tif (id) {\n\t\t\t\t\tconst path = redirectionPathWithId instanceof Function ? generateRouteWithId(redirectionPathWithId(row),id?.toString()) : generateRouteWithId(redirectionPathWithId,id?.toString());\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Link to={path}>\n\t\t\t\t\t\t\t{v}\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Fall back to the existing redirection logic\n\t\t\telse if (redirectionLink && column.type != 'custom_link') {\n\t\t\t\tconst id = row.original[idField||'id'];\n\t\t\t\tconst path = redirectionLink instanceof Function ? generateRouteWithId(redirectionLink(row),id?.toString()) : generateRouteWithId(redirectionLink,id?.toString());\n\t\t\t\treturn (\n\t\t\t\t\t<Link to={path} \n\t\t\t\t\t\tstate={redirectionLinkState?.(row)}>\n\t\t\t\t\t\t{v}\n\t\t\t\t\t</Link>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn v;\n\t\t},\n\t\t...(Boolean(enableFooter) && {\n\t\t\tFooter: ({ column }) => (\n\t\t\t\t<DefaultAggregation data={rows} column={String(column.id)} />\n\t\t\t)\n\t\t})\n\t}));\n};\n\nexport const renderEmptyRowsFallback = (text:string) => (\n\t<Box className='no-data'>\n\t\t<img src={images.common.tableNoData} />\n\t\t<Typography type='s3' weight='medium' color='theme.secondary.1000'>\n\t\t\t{text}\n\t\t</Typography>\n\t</Box>\n)\n\n/* eslint-disable no-mixed-spaces-and-tabs */\nexport const renderValueField = (label: string, value: any, t: any, formatFn?: (val: any) => string) => {\n\treturn (\n\t <ValueField key={label} label={t?.(label)}>\n\t\t{formatFn ? formatFn(value) : value ?? '-'}\n\t </ValueField>\n\t);\n };\n"],"names":["_a","_b","_c","column"],"mappings":";;;;;;;;;;;;;;AAuBA,MAAM,eAAe,OAAO,KAAK,aAAa;AAC7C,MAAI;AAEF,UAAM,WAAW,MAAM,MAAM,GAAG;AAChC,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,IAAI,MAAM,yBAAyB,SAAS,UAAU,EAAE;AAAA,IAChE;AAGA,UAAM,OAAO,MAAM,SAAS,KAAA;AAG5B,UAAM,UAAU,OAAO,IAAI,gBAAgB,IAAI;AAG/C,UAAM,OAAO,SAAS,cAAc,GAAG;AACvC,SAAK,OAAO;AACZ,SAAK,WAAW,YAAY;AAG5B,aAAS,KAAK,YAAY,IAAI;AAC9B,SAAK,MAAA;AACL,aAAS,KAAK,YAAY,IAAI;AAG9B,WAAO,IAAI,gBAAgB,OAAO;AAAA,EACpC,SA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AO,2BAA2B,WAAW,oBAAoB,gBAAgB,GAAG,GAAE,yBAAI,UAAU,IAAI,oBAAoB,iBAAgB,yBAAI,UAAU;AAChK,eACC;AAAA,UAAC;AAAA,UAAA;AAAA,YAAK,IAAI;AAAA,YACT,OAAO,6DAAuB;AAAA,YAC7B,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAGJ;AACA,aAAO;AAAA,IACR;AAAA,IACA,GAAI,QAAQ,YAAY,KAAK;AAAA,MAC5B,QAAQ,CAAC,EAAE,QAAAC,cACV,oBAAC,oBAAA,EAAmB,MAAM,MAAM,QAAQ,OAAOA,QAAO,EAAE,EAAA,CAAG;AAAA,IAAA;AAAA,EAE7D,EACC;AACH;AAEO,MAAM,0BAA0B,CAAC,SACvC,qBAAC,KAAA,EAAI,WAAU,WACd,UAAA;AAAA,EAAA,oBAAC,OAAA,EAAI,KAAK,OAAO,OAAO,aAAa;AAAA,EACrC,oBAAC,cAAW,MAAK,MAAK,QAAO,UAAS,OAAM,wBAC1C,UAAA,KAAA,CACF;AAAA,EAAA,CACD;AAIM,MAAM,mBAAmB,CAAC,OAAe,OAAY,GAAQ,aAAoC;AACvG,SACE,oBAAC,YAAA,EAAuB,OAAO,uBAAI,QACnC,UAAA,WAAW,SAAS,KAAK,IAAI,SAAS,IAAA,GADrB,KAEjB;AAED;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../src/utils/common-utility.tsx"],"sourcesContent":["\nimport React from 'react';\n\nimport { Box } from '@mui/material';\n/* eslint-disable no-mixed-spaces-and-tabs */\nimport Typography from '../components/typography/typography';\nimport { Document } from '../components/icons';\nimport { MaterialTableColumnProps, TypeBooleanLabels } from '../components/material-table/material-table';\nimport { TFunction } from 'i18next';\nimport { formatDate } from './dateFormat';\nimport { MRT_Row, MRT_RowData } from 'material-react-table';\nimport { Link } from 'react-router-dom';\nimport DefaultAggregation from '../components/material-table/components/default-aggregation';\nimport Chip from '../components/chip/chip';\nimport _ from 'lodash';\nimport images from '../assets/images';\nimport { formatAmount } from \"./common\";\nimport { defaultCurrencyFormat } from './common';\n\nimport { defaultCurrencySymbol } from './common';\nimport ValueField from '../components/value-field/value-field';\nimport { formatLabel } from './format-text';\nimport { generateRouteWithId } from './route-utils';\nconst downloadFile = async (url, fileName) => {\n\ttry {\n\t\t// Fetch the file from the provided URL\n\t\tconst response = await fetch(url);\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`Failed to fetch file: ${response.statusText}`);\n\t\t}\n\n\t\t// Convert the response to a blob\n\t\tconst blob = await response.blob();\n\n\t\t// Create a temporary URL for the blob\n\t\tconst blobUrl = window.URL.createObjectURL(blob);\n\n\t\t// Create a link element\n\t\tconst link = document.createElement('a');\n\t\tlink.href = blobUrl;\n\t\tlink.download = fileName || 'downloaded-file'; // Fallback filename if none provided\n\n\t\t// Append link to the body, trigger click, and remove it\n\t\tdocument.body.appendChild(link);\n\t\tlink.click();\n\t\tdocument.body.removeChild(link);\n\n\t\t// Revoke the blob URL to free up memory\n\t\twindow.URL.revokeObjectURL(blobUrl);\n\t} catch (error) {\n\t\tconsole.error('Error downloading file:', error);\n\t\tthrow error; // Re-throw to allow caller to handle the error\n\t}\n};\n\nexport const getFileNamesFromUrlsAsLink = (fileUrls: string | string[], mode?: string) => {\n\tconst fUrls = fileUrls\n\t\t? Array.isArray(fileUrls)\n\t\t\t? fileUrls\n\t\t\t: [fileUrls]\n\t\t: [];\n\n\tif (fUrls && fUrls.length) {\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tdisplay='flex'\n\t\t\t\tgap={1}\n\t\t\t\tmb={1}\n\t\t\t\talignItems='center'\n\t\t\t\tflexDirection='column'>\n\t\t\t\t{fUrls.map((url) => {\n\t\t\t\t\tconst fileName = url.substring(url.lastIndexOf('/') + 1);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Typography\n\t\t\t\t\t\t\ttype='s3'\n\t\t\t\t\t\t\tweight='medium'\n\t\t\t\t\t\t\tcolor='#246DFF'\n\t\t\t\t\t\t\tsx={{ textDecoration: 'underline', textUnderlineOffset: '3px', cursor: 'pointer' }}\n\t\t\t\t\t\t\tnoWrap\n\t\t\t\t\t\t\tonClick={() => mode === 'add' ? undefined : downloadFile(url, fileName)}>\n\t\t\t\t\t\t\t{fileName}\n\t\t\t\t\t\t</Typography>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn null;\n};\n\nexport const getFileNamesFromUrls = (fileUrls: string[]) => {\n\tif (!fileUrls) return null;\n\n\tif (!fileUrls?.filter(Boolean)?.length) return null;\n\n\treturn fileUrls?.filter(Boolean)?.map((url) => {\n\t\tconst fileName = url?.substring(url?.lastIndexOf('/') + 1) || '';\n\t\treturn (\n\t\t\t<Box display='flex' gap={1} mb={1} alignItems='center'>\n\t\t\t\t<Document fontSize='small' />\n\t\t\t\t<Typography\n\t\t\t\t\ttype='s3'\n\t\t\t\t\tweight='medium'\n\t\t\t\t\tcolor={'theme.secondary.1000'}\n\t\t\t\t\tsx={{ cursor: 'pointer' }}\n\t\t\t\t\tnoWrap onClick={() => downloadFile(url, fileName)}>\n\t\t\t\t\t{fileName}\n\t\t\t\t</Typography>\n\t\t\t</Box>\n\t\t);\n\t});\n};\n\nexport type CurrencySymbolFn = (row: MRT_Row<MRT_RowData>) => string;\nexport type StatusClassesFn = (row: MRT_Row<MRT_RowData>) => string;\nexport type RedirectionLinkFn = (row: MRT_Row<MRT_RowData>) => string;\n\nexport interface ITransformTableColumns {\n\tcolumns: MaterialTableColumnProps[];\n\tcurrencySymbol?: string | CurrencySymbolFn;\n\ttranslationFn?: TFunction<'translation', undefined>;\n\tenableFooter?: boolean;\n\tredirectionLink?: string | RedirectionLinkFn;\n\tredirectionLinkState?: (row: MRT_Row<MRT_RowData>) => void;\n\tredirectionPathWithId?: string;\n\tidField?: string;\n\tcustomizeValue?: (row: MRT_Row<MRT_RowData>, columnAccessorKey?: string, value?: any) => any;\n\tstatusClasses?: string | StatusClassesFn;\n\trows: any[];\n\tcurrencyFormat?: boolean\n}\n\nconst jsonArrayToString = (json: any) => {\n\tif (!json) return '';\n\n\ttry {\n\t\treturn JSON.parse(json)?.join(', ');\n\t} catch (error) {\n\t\treturn '';\n\t}\n};\nconst getStatusClass = (status: any) => {\n\tif (typeof status === 'string') {\n\t\treturn status?.toLowerCase()?.replace(' ', '');\n\t} else if (typeof status === 'number') {\n\t\treturn status ? 'enabled' : 'disabled';\n\t}\n};\n\nexport const transformTableColumns = ({\n\tcolumns = [],\n\tcurrencySymbol,\n\ttranslationFn = undefined,\n\tenableFooter = false,\n\tredirectionLink = '',\n\tredirectionLinkState = undefined,\n\tredirectionPathWithId = '',\n\tidField = 'id',\n\tstatusClasses = '',\n\trows = [],\n\tcustomizeValue = undefined,\n\tcurrencyFormat\n}: ITransformTableColumns) => {\n\tconst currencyFormatData = currencyFormat ? currencyFormat : defaultCurrencyFormat()\n\n\treturn columns.map((column) => ({\n\t\t...column,\n\t\theader: translationFn ? translationFn(column.header) : column.header,\n\t\tCell: ({ renderedCellValue, row }: any) => {\n\t\t\tlet v = renderedCellValue;\n\t\t\tconst columnType = column.type || (column.header === \"Amount\" || column.header === \"Rate\" ? \"currency\" : undefined);\n\t\t\tswitch (columnType) {\n\t\t\t\tcase 'formattedString':\n\t\t\t\t\tv = formatLabel(renderedCellValue) || '-';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'date':\n\t\t\t\t\tv = formatDate(\n\t\t\t\t\t\trenderedCellValue,\n\t\t\t\t\t\tcolumn.editProperties?.dateFormat || 'DD-MM-YYYY'\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'datetime':\n\t\t\t\t\tv = formatDate(\n\t\t\t\t\t\trenderedCellValue,\n\t\t\t\t\t\tcolumn.editProperties?.dateFormat || 'DD-MM-YYYY hh:mm A'\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'currency':\n\t\t\t\tcase 'amount': {\n\t\t\t\t\tconst cs = column?.showDefaultCurrency ? defaultCurrencySymbol() : currencySymbol instanceof Function ? currencySymbol(row) : (currencySymbol || defaultCurrencySymbol());\n\t\t\t\t\tv = renderedCellValue || renderedCellValue == 0\n\t\t\t\t\t\t? `${formatAmount(renderedCellValue, currencyFormatData, 'before', cs) || '-'}`\n\t\t\t\t\t\t: null;\n\n\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'status':\n\t\t\t\tcase 'enum':\n\t\t\t\tcase 'array':\n\t\t\t\t\t{\n\t\t\t\t\t\tv = renderedCellValue || renderedCellValue === 0 ? (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{Array.isArray(renderedCellValue) ? (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{renderedCellValue?.length ? <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, flexWrap: 'wrap' }}>\n\t\t\t\t\t\t\t\t\t\t\t{renderedCellValue.map((rcv) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype='normal'\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={column.custom_class ? column?.custom_class : (typeof rcv === 'string' ? rcv : '')}\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Typography type='s4' weight='medium' color={'inherit'}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{typeof rcv === 'object' ? _.get(rcv, column?.typeArrayAccessorKey || '', '') : rcv}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</Box> : '-'}\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\t\t\ttype='normal'\n\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\tcolumn.custom_class ? column?.custom_class :\n\t\t\t\t\t\t\t\t\t\t\t\t(statusClasses instanceof Function\n\t\t\t\t\t\t\t\t\t\t\t\t\t? statusClasses(row)\n\t\t\t\t\t\t\t\t\t\t\t\t\t: `${statusClasses}${getStatusClass(renderedCellValue)}`)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tlabel={\n\n\t\t\t\t\t\t\t\t\t\t\t<Typography type='s4' weight='medium' color={'inherit'}>\n\t\t\t\t\t\t\t\t\t\t\t\t{renderedCellValue}\n\t\t\t\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t'-'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'boolean':\n\t\t\t\t\tv = (\n\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\ttype='normal'\n\t\t\t\t\t\t\t// active={Boolean(renderedCellValue)}\n\t\t\t\t\t\t\t// inActive={Boolean(!renderedCellValue)}\n\t\t\t\t\t\t\tsx={(theme) => ({\n\t\t\t\t\t\t\t\t...(renderedCellValue ?\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tbackgroundColor: theme.palette?.theme.tertiary4[200],\n\t\t\t\t\t\t\t\t\t\tcolor: theme.palette?.theme.tertiary4[900]\n\t\t\t\t\t\t\t\t\t} :\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tbackgroundColor: theme.palette?.theme.tertiary6[200],\n\t\t\t\t\t\t\t\t\t\tcolor: theme.palette?.theme.tertiary6[900]\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t<Typography type='s4' weight='medium' color={'inherit'}>\n\t\t\t\t\t\t\t\t\t{column?.typeBooleanLabels?.[renderedCellValue as keyof TypeBooleanLabels] || '-'}\n\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'jsonArray':\n\t\t\t\t\tv = jsonArrayToString(renderedCellValue);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'custom':\n\t\t\t\tcase 'custom_link':\n\t\t\t\t\tv = customizeValue?.(row, column.accessorKey, renderedCellValue);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'toFixed':\n\t\t\t\t\tv = renderedCellValue ? renderedCellValue.toFixed(2) : renderedCellValue\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// If redirectionPathWithId is provided, use it for URL parameter-based navigation\n\t\t\tif (redirectionPathWithId && column.type != 'custom_link') {\n\t\t\t\tconst id = row.original[idField || 'id'];\n\t\t\t\tif (id) {\n\t\t\t\t\tconst path = redirectionPathWithId instanceof Function ? generateRouteWithId(redirectionPathWithId(row), id?.toString()) : generateRouteWithId(redirectionPathWithId, id?.toString());\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Link to={path}>\n\t\t\t\t\t\t\t{v}\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Fall back to the existing redirection logic\n\t\t\telse if (redirectionLink && column.type != 'custom_link') {\n\t\t\t\tconst id = row.original[idField || 'id'];\n\t\t\t\tconst path = redirectionLink instanceof Function ? generateRouteWithId(redirectionLink(row), id?.toString()) : generateRouteWithId(redirectionLink, id?.toString());\n\t\t\t\treturn (\n\t\t\t\t\t<Link to={path}\n\t\t\t\t\t\tstate={redirectionLinkState?.(row)}>\n\t\t\t\t\t\t{v}\n\t\t\t\t\t</Link>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn v;\n\t\t},\n\t\t...(Boolean(enableFooter) && {\n\t\t\tFooter: ({ column }) => (\n\t\t\t\t<DefaultAggregation data={rows} column={String(column.id)} />\n\t\t\t)\n\t\t})\n\t}));\n};\n\nexport const renderEmptyRowsFallback = (text: string) => (\n\t<Box className='no-data'>\n\t\t<img src={images.common.tableNoData} />\n\t\t<Typography type='s3' weight='medium' color='theme.secondary.1000'>\n\t\t\t{text}\n\t\t</Typography>\n\t</Box>\n)\n\n/* eslint-disable no-mixed-spaces-and-tabs */\nexport const renderValueField = (label: string, value: any, t: any, formatFn?: (val: any) => string) => {\n\treturn (\n\t\t<ValueField key={label} label={t?.(label)}>\n\t\t\t{formatFn ? formatFn(value) : value ?? '-'}\n\t\t</ValueField>\n\t);\n};\n"],"names":["_a","_b","_c","column"],"mappings":";;;;;;;;;;;;;;AAuBA,MAAM,eAAe,OAAO,KAAK,aAAa;AAC7C,MAAI;AAEH,UAAM,WAAW,MAAM,MAAM,GAAG;AAChC,QAAI,CAAC,SAAS,IAAI;AACjB,YAAM,IAAI,MAAM,yBAAyB,SAAS,UAAU,EAAE;AAAA,IAC/D;AAGA,UAAM,OAAO,MAAM,SAAS,KAAA;AAG5B,UAAM,UAAU,OAAO,IAAI,gBAAgB,IAAI;AAG/C,UAAM,OAAO,SAAS,cAAc,GAAG;AACvC,SAAK,OAAO;AACZ,SAAK,WAAW,YAAY;AAG5B,aAAS,KAAK,YAAY,IAAI;AAC9B,SAAK,MAAA;AACL,aAAS,KAAK,YAAY,IAAI;AAG9B,WAAO,IAAI,gBAAgB,OAAO;AAAA,EACnC,SAAS,OAAO;AACf,YAAQ,MAAM,2BAA2B,KAAK;AAC9C,UAAM;AAAA,EACP;AACD;AAEO,MAAM,6BAA6B,CAAC,UAA6B,SAAkB;AACzF,QAAM,QAAQ,WACX,MAAM,QAAQ,QAAQ,IACrB,WACA,CAA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AAClK,eACC;AAAA,UAAC;AAAA,UAAA;AAAA,YAAK,IAAI;AAAA,YACT,OAAO,6DAAuB;AAAA,YAC7B,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAGJ;AACA,aAAO;AAAA,IACR;AAAA,IACA,GAAI,QAAQ,YAAY,KAAK;AAAA,MAC5B,QAAQ,CAAC,EAAE,QAAAC,cACV,oBAAC,oBAAA,EAAmB,MAAM,MAAM,QAAQ,OAAOA,QAAO,EAAE,EAAA,CAAG;AAAA,IAAA;AAAA,EAE7D,EACC;AACH;AAEO,MAAM,0BAA0B,CAAC,SACvC,qBAAC,KAAA,EAAI,WAAU,WACd,UAAA;AAAA,EAAA,oBAAC,OAAA,EAAI,KAAK,OAAO,OAAO,aAAa;AAAA,EACrC,oBAAC,cAAW,MAAK,MAAK,QAAO,UAAS,OAAM,wBAC1C,UAAA,KAAA,CACF;AAAA,EAAA,CACD;AAIM,MAAM,mBAAmB,CAAC,OAAe,OAAY,GAAQ,aAAoC;AACvG,SACC,oBAAC,YAAA,EAAuB,OAAO,uBAAI,QACjC,UAAA,WAAW,SAAS,KAAK,IAAI,SAAS,IAAA,GADvB,KAEjB;AAEF;"}
|
|
@@ -4,7 +4,7 @@ return e.jsxs(m.default,{display:"flex",gap:1,mb:1,alignItems:"center",children:
|
|
|
4
4
|
/* @__PURE__ */e.jsx(t.Typography,{type:"s3",weight:"medium",color:"theme.secondary.1000",sx:{cursor:"pointer"},noWrap:!0,onClick:()=>x(r,o),children:o})]})}):null},exports.getFileNamesFromUrlsAsLink=(r,o)=>{const n=r?Array.isArray(r)?r:[r]:[];return n&&n.length?/* @__PURE__ */e.jsx(m.default,{display:"flex",gap:1,mb:1,alignItems:"center",flexDirection:"column",children:n.map(r=>{const n=r.substring(r.lastIndexOf("/")+1);/* @__PURE__ */
|
|
5
5
|
return e.jsx(t.Typography,{type:"s3",weight:"medium",color:"#246DFF",sx:{textDecoration:"underline",textUnderlineOffset:"3px",cursor:"pointer"},noWrap:!0,onClick:()=>"add"===o?void 0:x(r,n),children:n})})}):null},exports.renderEmptyRowsFallback=r=>/* @__PURE__ */e.jsxs(m.default,{className:"no-data",children:[
|
|
6
6
|
/* @__PURE__ */e.jsx("img",{src:i.images.common.tableNoData}),
|
|
7
|
-
/* @__PURE__ */e.jsx(t.Typography,{type:"s3",weight:"medium",color:"theme.secondary.1000",children:r})]}),exports.renderValueField=(t,r,o,n)=>/* @__PURE__ */e.jsx(d.ValueField,{label:null==o?void 0:o(t),children:n?n(r):r??"-"},t),exports.transformTableColumns=({columns:a=[],currencySymbol:i,translationFn:d,enableFooter:p=!1,redirectionLink:h="",redirectionLinkState:x,redirectionPathWithId:g="",idField:v="id",statusClasses:b="",rows:j=[],customizeValue:F,currencyFormat:
|
|
7
|
+
/* @__PURE__ */e.jsx(t.Typography,{type:"s3",weight:"medium",color:"theme.secondary.1000",children:r})]}),exports.renderValueField=(t,r,o,n)=>/* @__PURE__ */e.jsx(d.ValueField,{label:null==o?void 0:o(t),children:n?n(r):r??"-"},t),exports.transformTableColumns=({columns:a=[],currencySymbol:i,translationFn:d,enableFooter:p=!1,redirectionLink:h="",redirectionLinkState:x,redirectionPathWithId:g="",idField:v="id",statusClasses:b="",rows:j=[],customizeValue:F,currencyFormat:k})=>{const w=k||s.defaultCurrencyFormat();return a.map(a=>({...a,header:d?d(a.header):a.header,Cell:({renderedCellValue:n,row:d})=>{var p,j,k;let C=n;switch(a.type||("Amount"===a.header||"Rate"===a.header?"currency":void 0)){case"formattedString":C=c.formatLabel(n)||"-";break;case"date":C=r.formatDate(n,(null==(p=a.editProperties)?void 0:p.dateFormat)||"DD-MM-YYYY");break;case"datetime":C=r.formatDate(n,(null==(j=a.editProperties)?void 0:j.dateFormat)||"DD-MM-YYYY hh:mm A");break;case"currency":case"amount":{const e=(null==a?void 0:a.showDefaultCurrency)?s.defaultCurrencySymbol():i instanceof Function?i(d):i||s.defaultCurrencySymbol();C=n||0==n?`${s.formatAmount(n,w,"before",e)||"-"}`:null}break;case"status":case"enum":case"array":C=n||0===n?/* @__PURE__ */e.jsx(e.Fragment,{children:Array.isArray(n)?/* @__PURE__ */e.jsx(e.Fragment,{children:(null==n?void 0:n.length)?/* @__PURE__ */e.jsx(m.default,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:n.map(r=>/* @__PURE__ */e.jsx(l.Chip,{type:"normal",className:a.custom_class?null==a?void 0:a.custom_class:"string"==typeof r?r:"",label:/* @__PURE__ */e.jsx(t.Typography,{type:"s4",weight:"medium",color:"inherit",children:"object"==typeof r?y.default.get(r,(null==a?void 0:a.typeArrayAccessorKey)||"",""):r})}))}):"-"}):/* @__PURE__ */e.jsx(l.Chip,{type:"normal",className:a.custom_class?null==a?void 0:a.custom_class:b instanceof Function?b(d):`${b}${f(n)}`,label:/* @__PURE__ */e.jsx(t.Typography,{type:"s4",weight:"medium",color:"inherit",children:n})})}):"-";break;case"boolean":C=/* @__PURE__ */e.jsx(l.Chip,{type:"normal",sx:e=>{var t,r,o,l;return{...n?{backgroundColor:null==(t=e.palette)?void 0:t.theme.tertiary4[200],color:null==(r=e.palette)?void 0:r.theme.tertiary4[900]}:{backgroundColor:null==(o=e.palette)?void 0:o.theme.tertiary6[200],color:null==(l=e.palette)?void 0:l.theme.tertiary6[900]}}},label:/* @__PURE__ */e.jsx(t.Typography,{type:"s4",weight:"medium",color:"inherit",children:(null==(k=null==a?void 0:a.typeBooleanLabels)?void 0:k[n])||"-"})});break;case"jsonArray":C=(e=>{var t;if(!e)return"";try{return null==(t=JSON.parse(e))?void 0:t.join(", ")}catch(r){return""}})(n);break;case"custom":case"custom_link":C=null==F?void 0:F(d,a.accessorKey,n);break;case"toFixed":C=n?n.toFixed(2):n}if(g&&"custom_link"!=a.type){const t=d.original[v||"id"];if(t){const r=g instanceof Function?u.generateRouteWithId(g(d),null==t?void 0:t.toString()):u.generateRouteWithId(g,null==t?void 0:t.toString());/* @__PURE__ */
|
|
8
8
|
return e.jsx(o.Link,{to:r,children:C})}}else if(h&&"custom_link"!=a.type){const t=d.original[v||"id"],r=h instanceof Function?u.generateRouteWithId(h(d),null==t?void 0:t.toString()):u.generateRouteWithId(h,null==t?void 0:t.toString());/* @__PURE__ */
|
|
9
9
|
return e.jsx(o.Link,{to:r,state:null==x?void 0:x(d),children:C})}return C},...Boolean(p)&&{Footer:({column:t})=>/* @__PURE__ */e.jsx(n.DefaultAggregation,{data:j,column:String(t.id)})}}))};
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/utils/common-utility.tsx"],"sourcesContent":["\nimport React from 'react';\n\nimport { Box } from '@mui/material';\n/* eslint-disable no-mixed-spaces-and-tabs */\nimport Typography from '../components/typography/typography';\nimport { Document } from '../components/icons';\nimport { MaterialTableColumnProps, TypeBooleanLabels } from '../components/material-table/material-table';\nimport { TFunction } from 'i18next';\nimport { formatDate } from './dateFormat';\nimport { MRT_Row, MRT_RowData } from 'material-react-table';\nimport { Link } from 'react-router-dom';\nimport DefaultAggregation from '../components/material-table/components/default-aggregation';\nimport Chip from '../components/chip/chip';\nimport _ from 'lodash';\nimport images from '../assets/images';\nimport { formatAmount } from \"./common\";\nimport { defaultCurrencyFormat } from './common';\n\nimport { defaultCurrencySymbol } from './common';\nimport ValueField from '../components/value-field/value-field';\nimport { formatLabel } from './format-text';\nimport { generateRouteWithId } from './route-utils';\nconst downloadFile = async (url, fileName) => {\n\ttry {\n\t\t\t// Fetch the file from the provided URL\n\t\t\tconst response = await fetch(url);\n\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new Error(`Failed to fetch file: ${response.statusText}`);\n\t\t\t}\n\n\t\t\t// Convert the response to a blob\n\t\t\tconst blob = await response.blob();\n\n\t\t\t// Create a temporary URL for the blob\n\t\t\tconst blobUrl = window.URL.createObjectURL(blob);\n\n\t\t\t// Create a link element\n\t\t\tconst link = document.createElement('a');\n\t\t\tlink.href = blobUrl;\n\t\t\tlink.download = fileName || 'downloaded-file'; // Fallback filename if none provided\n\n\t\t\t// Append link to the body, trigger click, and remove it\n\t\t\tdocument.body.appendChild(link);\n\t\t\tlink.click();\n\t\t\tdocument.body.removeChild(link);\n\n\t\t\t// Revoke the blob URL to free up memory\n\t\t\twindow.URL.revokeObjectURL(blobUrl);\n\t} catch (error) {\n\t\t\tconsole.error('Error downloading file:', error);\n\t\t\tthrow error; // Re-throw to allow caller to handle the error\n\t}\n};\n\nexport const getFileNamesFromUrlsAsLink = (fileUrls: string | string[], mode?: string) => {\n\tconst fUrls = fileUrls\n\t\t? Array.isArray(fileUrls)\n\t\t\t? fileUrls\n\t\t\t: [fileUrls]\n\t\t: [];\n\n\tif (fUrls && fUrls.length) {\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tdisplay='flex'\n\t\t\t\tgap={1}\n\t\t\t\tmb={1}\n\t\t\t\talignItems='center'\n\t\t\t\tflexDirection='column'>\n\t\t\t\t{fUrls.map((url) => {\n\t\t\t\t\tconst fileName = url.substring(url.lastIndexOf('/') + 1);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Typography\n\t\t\t\t\t\t\ttype='s3'\n\t\t\t\t\t\t\tweight='medium'\n\t\t\t\t\t\t\tcolor='#246DFF'\n\t\t\t\t\t\t\tsx={{ textDecoration: 'underline', textUnderlineOffset: '3px', cursor:'pointer' }}\n\t\t\t\t\t\t\tnoWrap \n\t\t\t\t\t\t\tonClick={() => mode === 'add' ? undefined : downloadFile(url, fileName)}>\n\t\t\t\t\t\t\t{fileName}\n\t\t\t\t\t\t</Typography>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn null;\n};\n\nexport const getFileNamesFromUrls = (fileUrls: string[]) => {\n\tif (!fileUrls) return null;\n\n\tif (!fileUrls?.filter(Boolean)?.length) return null;\n\n\treturn fileUrls?.filter(Boolean)?.map((url) => {\n\t\tconst fileName = url?.substring(url?.lastIndexOf('/') + 1) || '';\n\t\treturn (\n\t\t\t<Box display='flex' gap={1} mb={1} alignItems='center'>\n\t\t\t\t<Document fontSize='small' />\n\t\t\t\t<Typography\n\t\t\t\t\ttype='s3'\n\t\t\t\t\tweight='medium'\n\t\t\t\t\tcolor={'theme.secondary.1000'}\n\t\t\t\t\tsx={{cursor: 'pointer'}}\n\t\t\t\t\tnoWrap onClick={() => downloadFile(url, fileName)}>\n\t\t\t\t\t{fileName}\n\t\t\t\t</Typography>\n\t\t\t</Box>\n\t\t);\n\t});\n};\n\nexport type CurrencySymbolFn = (row: MRT_Row<MRT_RowData>) => string;\nexport type StatusClassesFn = (row: MRT_Row<MRT_RowData>) => string;\nexport type RedirectionLinkFn = (row: MRT_Row<MRT_RowData>) => string;\n\nexport interface ITransformTableColumns {\n\tcolumns: MaterialTableColumnProps[];\n\tcurrencySymbol?: string | CurrencySymbolFn;\n\ttranslationFn?: TFunction<'translation', undefined>;\n\tenableFooter?: boolean;\n\tredirectionLink?: string | RedirectionLinkFn;\n\tredirectionLinkState?: (row: MRT_Row<MRT_RowData>) => void;\n\tredirectionPathWithId?: string;\n\tidField?: string;\n\tcustomizeValue?: (row: MRT_Row<MRT_RowData>, columnAccessorKey?: string, value?: any) => any;\n\tstatusClasses?: string | StatusClassesFn;\n\trows: any[];\n\tcurrencyFormat?: boolean\n}\n\nconst jsonArrayToString = (json: any) => {\n\tif (!json) return '';\n\n\ttry {\n\t\treturn JSON.parse(json)?.join(', ');\n\t} catch (error) {\n\t\treturn '';\n\t}\n};\nconst getStatusClass = (status: any) => {\n\tif (typeof status === 'string') {\n\t\treturn status?.toLowerCase()?.replace(' ', '');\n\t} else if (typeof status === 'number') {\n\t\treturn status ? 'enabled' : 'disabled';\n\t}\n};\n\nexport const transformTableColumns = ({\n\tcolumns = [],\n\tcurrencySymbol,\n\ttranslationFn = undefined,\n\tenableFooter = false,\n\tredirectionLink = '',\n\tredirectionLinkState = undefined,\n\tredirectionPathWithId = '',\n\tidField = 'id',\n\tstatusClasses = '',\n\trows = [],\n\tcustomizeValue = undefined,\n\tcurrencyFormat\n}: ITransformTableColumns) => {\n\tconst currencyFormatData = currencyFormat ? currencyFormat : defaultCurrencyFormat()\n\n\treturn columns.map((column) => ({\n\t\t...column,\n\t\theader: translationFn ? translationFn(column.header) : column.header,\n\t\tCell: ({ renderedCellValue, row }: any) => {\n\t\t\tlet v = renderedCellValue;\n\t\t\tconst columnType = column.type || (column.header === \"Amount\" || column.header === \"Rate\" ? \"currency\" : undefined);\n\t\t\tswitch (columnType) {\n\t\t\t\tcase 'formattedString':\n\t\t\t\t\tv = formatLabel(renderedCellValue) || '-';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'date':\n\t\t\t\t\tv = formatDate(\n\t\t\t\t\t\trenderedCellValue,\n\t\t\t\t\t\tcolumn.editProperties?.dateFormat || 'DD-MM-YYYY'\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'datetime':\n\t\t\t\t\tv = formatDate(\n\t\t\t\t\t\trenderedCellValue,\n\t\t\t\t\t\tcolumn.editProperties?.dateFormat || 'DD-MM-YYYY hh:mm A'\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'currency':\n\t\t\t\tcase 'amount':{\n\t\t\t\t\tconst cs =column?.showDefaultCurrency? defaultCurrencySymbol(): currencySymbol instanceof Function ? currencySymbol(row) : (currencySymbol || defaultCurrencySymbol());\n\t\t\t\t\tv = renderedCellValue || renderedCellValue == 0\n\t\t\t\t\t\t? `${formatAmount(renderedCellValue,currencyFormatData,'before',cs)||'-'}`\n\t\t\t\t\t\t: null;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase 'status':\n\t\t\t\tcase 'enum':\n\t\t\t\tcase 'array':\n\t\t\t\t\t{\n\t\t\t\t\t\tv = renderedCellValue || renderedCellValue === 0 ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{Array.isArray(renderedCellValue) ? (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{renderedCellValue?.length ? <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, flexWrap: 'wrap' }}>\n\t\t\t\t\t\t\t\t\t{renderedCellValue.map((rcv) => (\n\t\t\t\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\t\t\t\ttype='normal'\n\t\t\t\t\t\t\t\t\t\t\tclassName={column.custom_class?column?.custom_class:(typeof rcv === 'string' ? rcv : '')}\n\t\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\t\t<Typography type='s4' weight='medium' color={'inherit'}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{typeof rcv === 'object' ? _.get(rcv, column?.typeArrayAccessorKey||'', '') : rcv}\n\t\t\t\t\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</Box> : '-'}\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\t\ttype='normal'\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\tcolumn.custom_class?column?.custom_class:\n\t\t\t\t\t\t\t\t\t\t(statusClasses instanceof Function\n\t\t\t\t\t\t\t\t\t\t\t? statusClasses(row)\n\t\t\t\t\t\t\t\t\t\t\t: `${statusClasses}${getStatusClass(renderedCellValue)}`)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t<Typography type='s4' weight='medium' color={'inherit'}>\n\t\t\t\t\t\t\t\t\t\t\t{renderedCellValue}\n\t\t\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t'-'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'boolean':\n\t\t\t\t\tv = (\n\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\ttype='normal'\n\t\t\t\t\t\t\t// active={Boolean(renderedCellValue)}\n\t\t\t\t\t\t\t// inActive={Boolean(!renderedCellValue)}\n\t\t\t\t\t\t\tsx={(theme) => ({\n\t\t\t\t\t\t\t\t\t...(renderedCellValue ? \n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: theme.palette?.theme.tertiary4[200],\n\t\t\t\t\t\t\t\t\t\t\t\tcolor: theme.palette?.theme.tertiary4[900]\n\t\t\t\t\t\t\t\t\t\t\t} :\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: theme.palette?.theme.tertiary6[200],\n\t\t\t\t\t\t\t\t\t\t\t\tcolor: theme.palette?.theme.tertiary6[900]\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t<Typography type='s4' weight='medium' color={'inherit'}>\n\t\t\t\t\t\t\t\t\t{column?.typeBooleanLabels?.[renderedCellValue as keyof TypeBooleanLabels] || '-'}\n\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'jsonArray':\n\t\t\t\t\tv = jsonArrayToString(renderedCellValue);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'custom':\n\t\t\t\tcase 'custom_link':\n\t\t\t\t\tv = customizeValue?.(row, column.accessorKey, renderedCellValue);\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// If redirectionPathWithId is provided, use it for URL parameter-based navigation\n\t\t\tif (redirectionPathWithId && column.type != 'custom_link') {\n\t\t\t\tconst id = row.original[idField||'id'];\n\t\t\t\tif (id) {\n\t\t\t\t\tconst path = redirectionPathWithId instanceof Function ? generateRouteWithId(redirectionPathWithId(row),id?.toString()) : generateRouteWithId(redirectionPathWithId,id?.toString());\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Link to={path}>\n\t\t\t\t\t\t\t{v}\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Fall back to the existing redirection logic\n\t\t\telse if (redirectionLink && column.type != 'custom_link') {\n\t\t\t\tconst id = row.original[idField||'id'];\n\t\t\t\tconst path = redirectionLink instanceof Function ? generateRouteWithId(redirectionLink(row),id?.toString()) : generateRouteWithId(redirectionLink,id?.toString());\n\t\t\t\treturn (\n\t\t\t\t\t<Link to={path} \n\t\t\t\t\t\tstate={redirectionLinkState?.(row)}>\n\t\t\t\t\t\t{v}\n\t\t\t\t\t</Link>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn v;\n\t\t},\n\t\t...(Boolean(enableFooter) && {\n\t\t\tFooter: ({ column }) => (\n\t\t\t\t<DefaultAggregation data={rows} column={String(column.id)} />\n\t\t\t)\n\t\t})\n\t}));\n};\n\nexport const renderEmptyRowsFallback = (text:string) => (\n\t<Box className='no-data'>\n\t\t<img src={images.common.tableNoData} />\n\t\t<Typography type='s3' weight='medium' color='theme.secondary.1000'>\n\t\t\t{text}\n\t\t</Typography>\n\t</Box>\n)\n\n/* eslint-disable no-mixed-spaces-and-tabs */\nexport const renderValueField = (label: string, value: any, t: any, formatFn?: (val: any) => string) => {\n\treturn (\n\t <ValueField key={label} label={t?.(label)}>\n\t\t{formatFn ? formatFn(value) : value ?? '-'}\n\t </ValueField>\n\t);\n };\n"],"names":["downloadFile","async","url","fileName","response","fetch","ok","Error","statusText","blob","blobUrl","window","URL","createObjectURL","link","document","createElement","href","download","body","appendChild","click","removeChild","revokeObjectURL","error","getStatusClass","status","_a","toLowerCase","replace","fileUrls","filter","Boolean","length","_b","map","substring","lastIndexOf","jsxs","Box","display","gap","mb","alignItems","children","jsx","Document","fontSize","Typography","type","weight","color","sx","cursor","noWrap","onClick","mode","fUrls","Array","isArray","flexDirection","textDecoration","textUnderlineOffset","text","className","src","images","common","tableNoData","label","value","t","formatFn","ValueField","columns","currencySymbol","translationFn","enableFooter","redirectionLink","redirectionLinkState","redirectionPathWithId","idField","statusClasses","rows","customizeValue","currencyFormat","currencyFormatData","defaultCurrencyFormat","column","header","Cell","renderedCellValue","row","v","formatLabel","formatDate","editProperties","dateFormat","cs","showDefaultCurrency","defaultCurrencySymbol","Function","formatAmount","Fragment","flexWrap","rcv","Chip","custom_class","_","get","typeArrayAccessorKey","theme","backgroundColor","palette","tertiary4","_c","tertiary6","_d","typeBooleanLabels","json","JSON","parse","join","jsonArrayToString","accessorKey","id","original","path","generateRouteWithId","toString","Link","to","state","Footer","DefaultAggregation","data","String"],"mappings":"myBAuBA,MAAMA,EAAeC,MAAOC,EAAKC,KAChC,IAEE,MAAMC,QAAiBC,MAAMH,GAC7B,IAAKE,EAASE,GACZ,MAAM,IAAIC,MAAM,yBAAyBH,EAASI,cAIpD,MAAMC,QAAaL,EAASK,OAGtBC,EAAUC,OAAOC,IAAIC,gBAAgBJ,GAGrCK,EAAOC,SAASC,cAAc,KACpCF,EAAKG,KAAOP,EACZI,EAAKI,SAAWf,GAAY,kBAG5BY,SAASI,KAAKC,YAAYN,GAC1BA,EAAKO,QACLN,SAASI,KAAKG,YAAYR,GAG1BH,OAAOC,IAAIW,gBAAgBb,EAC7B,OAASc,GAEP,MAAMA,CACR,GA0FKC,EAAkBC,UACvB,MAAsB,iBAAXA,EACH,OAAAC,EAAA,MAAAD,OAAA,EAAAA,EAAQE,oBAAR,EAAAD,EAAuBE,QAAQ,IAAK,IACf,iBAAXH,EACVA,EAAS,UAAY,gBAD7B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,EAAG7C,OAAAA,sBACV3C,IAACyF,EAAAA,mBAAA,CAAmBC,KAAMpD,EAAMK,OAAQgD,OAAOhD,EAAOqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/utils/common-utility.tsx"],"sourcesContent":["\nimport React from 'react';\n\nimport { Box } from '@mui/material';\n/* eslint-disable no-mixed-spaces-and-tabs */\nimport Typography from '../components/typography/typography';\nimport { Document } from '../components/icons';\nimport { MaterialTableColumnProps, TypeBooleanLabels } from '../components/material-table/material-table';\nimport { TFunction } from 'i18next';\nimport { formatDate } from './dateFormat';\nimport { MRT_Row, MRT_RowData } from 'material-react-table';\nimport { Link } from 'react-router-dom';\nimport DefaultAggregation from '../components/material-table/components/default-aggregation';\nimport Chip from '../components/chip/chip';\nimport _ from 'lodash';\nimport images from '../assets/images';\nimport { formatAmount } from \"./common\";\nimport { defaultCurrencyFormat } from './common';\n\nimport { defaultCurrencySymbol } from './common';\nimport ValueField from '../components/value-field/value-field';\nimport { formatLabel } from './format-text';\nimport { generateRouteWithId } from './route-utils';\nconst downloadFile = async (url, fileName) => {\n\ttry {\n\t\t// Fetch the file from the provided URL\n\t\tconst response = await fetch(url);\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`Failed to fetch file: ${response.statusText}`);\n\t\t}\n\n\t\t// Convert the response to a blob\n\t\tconst blob = await response.blob();\n\n\t\t// Create a temporary URL for the blob\n\t\tconst blobUrl = window.URL.createObjectURL(blob);\n\n\t\t// Create a link element\n\t\tconst link = document.createElement('a');\n\t\tlink.href = blobUrl;\n\t\tlink.download = fileName || 'downloaded-file'; // Fallback filename if none provided\n\n\t\t// Append link to the body, trigger click, and remove it\n\t\tdocument.body.appendChild(link);\n\t\tlink.click();\n\t\tdocument.body.removeChild(link);\n\n\t\t// Revoke the blob URL to free up memory\n\t\twindow.URL.revokeObjectURL(blobUrl);\n\t} catch (error) {\n\t\tconsole.error('Error downloading file:', error);\n\t\tthrow error; // Re-throw to allow caller to handle the error\n\t}\n};\n\nexport const getFileNamesFromUrlsAsLink = (fileUrls: string | string[], mode?: string) => {\n\tconst fUrls = fileUrls\n\t\t? Array.isArray(fileUrls)\n\t\t\t? fileUrls\n\t\t\t: [fileUrls]\n\t\t: [];\n\n\tif (fUrls && fUrls.length) {\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tdisplay='flex'\n\t\t\t\tgap={1}\n\t\t\t\tmb={1}\n\t\t\t\talignItems='center'\n\t\t\t\tflexDirection='column'>\n\t\t\t\t{fUrls.map((url) => {\n\t\t\t\t\tconst fileName = url.substring(url.lastIndexOf('/') + 1);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Typography\n\t\t\t\t\t\t\ttype='s3'\n\t\t\t\t\t\t\tweight='medium'\n\t\t\t\t\t\t\tcolor='#246DFF'\n\t\t\t\t\t\t\tsx={{ textDecoration: 'underline', textUnderlineOffset: '3px', cursor: 'pointer' }}\n\t\t\t\t\t\t\tnoWrap\n\t\t\t\t\t\t\tonClick={() => mode === 'add' ? undefined : downloadFile(url, fileName)}>\n\t\t\t\t\t\t\t{fileName}\n\t\t\t\t\t\t</Typography>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn null;\n};\n\nexport const getFileNamesFromUrls = (fileUrls: string[]) => {\n\tif (!fileUrls) return null;\n\n\tif (!fileUrls?.filter(Boolean)?.length) return null;\n\n\treturn fileUrls?.filter(Boolean)?.map((url) => {\n\t\tconst fileName = url?.substring(url?.lastIndexOf('/') + 1) || '';\n\t\treturn (\n\t\t\t<Box display='flex' gap={1} mb={1} alignItems='center'>\n\t\t\t\t<Document fontSize='small' />\n\t\t\t\t<Typography\n\t\t\t\t\ttype='s3'\n\t\t\t\t\tweight='medium'\n\t\t\t\t\tcolor={'theme.secondary.1000'}\n\t\t\t\t\tsx={{ cursor: 'pointer' }}\n\t\t\t\t\tnoWrap onClick={() => downloadFile(url, fileName)}>\n\t\t\t\t\t{fileName}\n\t\t\t\t</Typography>\n\t\t\t</Box>\n\t\t);\n\t});\n};\n\nexport type CurrencySymbolFn = (row: MRT_Row<MRT_RowData>) => string;\nexport type StatusClassesFn = (row: MRT_Row<MRT_RowData>) => string;\nexport type RedirectionLinkFn = (row: MRT_Row<MRT_RowData>) => string;\n\nexport interface ITransformTableColumns {\n\tcolumns: MaterialTableColumnProps[];\n\tcurrencySymbol?: string | CurrencySymbolFn;\n\ttranslationFn?: TFunction<'translation', undefined>;\n\tenableFooter?: boolean;\n\tredirectionLink?: string | RedirectionLinkFn;\n\tredirectionLinkState?: (row: MRT_Row<MRT_RowData>) => void;\n\tredirectionPathWithId?: string;\n\tidField?: string;\n\tcustomizeValue?: (row: MRT_Row<MRT_RowData>, columnAccessorKey?: string, value?: any) => any;\n\tstatusClasses?: string | StatusClassesFn;\n\trows: any[];\n\tcurrencyFormat?: boolean\n}\n\nconst jsonArrayToString = (json: any) => {\n\tif (!json) return '';\n\n\ttry {\n\t\treturn JSON.parse(json)?.join(', ');\n\t} catch (error) {\n\t\treturn '';\n\t}\n};\nconst getStatusClass = (status: any) => {\n\tif (typeof status === 'string') {\n\t\treturn status?.toLowerCase()?.replace(' ', '');\n\t} else if (typeof status === 'number') {\n\t\treturn status ? 'enabled' : 'disabled';\n\t}\n};\n\nexport const transformTableColumns = ({\n\tcolumns = [],\n\tcurrencySymbol,\n\ttranslationFn = undefined,\n\tenableFooter = false,\n\tredirectionLink = '',\n\tredirectionLinkState = undefined,\n\tredirectionPathWithId = '',\n\tidField = 'id',\n\tstatusClasses = '',\n\trows = [],\n\tcustomizeValue = undefined,\n\tcurrencyFormat\n}: ITransformTableColumns) => {\n\tconst currencyFormatData = currencyFormat ? currencyFormat : defaultCurrencyFormat()\n\n\treturn columns.map((column) => ({\n\t\t...column,\n\t\theader: translationFn ? translationFn(column.header) : column.header,\n\t\tCell: ({ renderedCellValue, row }: any) => {\n\t\t\tlet v = renderedCellValue;\n\t\t\tconst columnType = column.type || (column.header === \"Amount\" || column.header === \"Rate\" ? \"currency\" : undefined);\n\t\t\tswitch (columnType) {\n\t\t\t\tcase 'formattedString':\n\t\t\t\t\tv = formatLabel(renderedCellValue) || '-';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'date':\n\t\t\t\t\tv = formatDate(\n\t\t\t\t\t\trenderedCellValue,\n\t\t\t\t\t\tcolumn.editProperties?.dateFormat || 'DD-MM-YYYY'\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'datetime':\n\t\t\t\t\tv = formatDate(\n\t\t\t\t\t\trenderedCellValue,\n\t\t\t\t\t\tcolumn.editProperties?.dateFormat || 'DD-MM-YYYY hh:mm A'\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'currency':\n\t\t\t\tcase 'amount': {\n\t\t\t\t\tconst cs = column?.showDefaultCurrency ? defaultCurrencySymbol() : currencySymbol instanceof Function ? currencySymbol(row) : (currencySymbol || defaultCurrencySymbol());\n\t\t\t\t\tv = renderedCellValue || renderedCellValue == 0\n\t\t\t\t\t\t? `${formatAmount(renderedCellValue, currencyFormatData, 'before', cs) || '-'}`\n\t\t\t\t\t\t: null;\n\n\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'status':\n\t\t\t\tcase 'enum':\n\t\t\t\tcase 'array':\n\t\t\t\t\t{\n\t\t\t\t\t\tv = renderedCellValue || renderedCellValue === 0 ? (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{Array.isArray(renderedCellValue) ? (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{renderedCellValue?.length ? <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, flexWrap: 'wrap' }}>\n\t\t\t\t\t\t\t\t\t\t\t{renderedCellValue.map((rcv) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype='normal'\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={column.custom_class ? column?.custom_class : (typeof rcv === 'string' ? rcv : '')}\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Typography type='s4' weight='medium' color={'inherit'}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{typeof rcv === 'object' ? _.get(rcv, column?.typeArrayAccessorKey || '', '') : rcv}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</Box> : '-'}\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\t\t\ttype='normal'\n\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\tcolumn.custom_class ? column?.custom_class :\n\t\t\t\t\t\t\t\t\t\t\t\t(statusClasses instanceof Function\n\t\t\t\t\t\t\t\t\t\t\t\t\t? statusClasses(row)\n\t\t\t\t\t\t\t\t\t\t\t\t\t: `${statusClasses}${getStatusClass(renderedCellValue)}`)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tlabel={\n\n\t\t\t\t\t\t\t\t\t\t\t<Typography type='s4' weight='medium' color={'inherit'}>\n\t\t\t\t\t\t\t\t\t\t\t\t{renderedCellValue}\n\t\t\t\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t'-'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'boolean':\n\t\t\t\t\tv = (\n\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\ttype='normal'\n\t\t\t\t\t\t\t// active={Boolean(renderedCellValue)}\n\t\t\t\t\t\t\t// inActive={Boolean(!renderedCellValue)}\n\t\t\t\t\t\t\tsx={(theme) => ({\n\t\t\t\t\t\t\t\t...(renderedCellValue ?\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tbackgroundColor: theme.palette?.theme.tertiary4[200],\n\t\t\t\t\t\t\t\t\t\tcolor: theme.palette?.theme.tertiary4[900]\n\t\t\t\t\t\t\t\t\t} :\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tbackgroundColor: theme.palette?.theme.tertiary6[200],\n\t\t\t\t\t\t\t\t\t\tcolor: theme.palette?.theme.tertiary6[900]\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t<Typography type='s4' weight='medium' color={'inherit'}>\n\t\t\t\t\t\t\t\t\t{column?.typeBooleanLabels?.[renderedCellValue as keyof TypeBooleanLabels] || '-'}\n\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'jsonArray':\n\t\t\t\t\tv = jsonArrayToString(renderedCellValue);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'custom':\n\t\t\t\tcase 'custom_link':\n\t\t\t\t\tv = customizeValue?.(row, column.accessorKey, renderedCellValue);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'toFixed':\n\t\t\t\t\tv = renderedCellValue ? renderedCellValue.toFixed(2) : renderedCellValue\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// If redirectionPathWithId is provided, use it for URL parameter-based navigation\n\t\t\tif (redirectionPathWithId && column.type != 'custom_link') {\n\t\t\t\tconst id = row.original[idField || 'id'];\n\t\t\t\tif (id) {\n\t\t\t\t\tconst path = redirectionPathWithId instanceof Function ? generateRouteWithId(redirectionPathWithId(row), id?.toString()) : generateRouteWithId(redirectionPathWithId, id?.toString());\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Link to={path}>\n\t\t\t\t\t\t\t{v}\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Fall back to the existing redirection logic\n\t\t\telse if (redirectionLink && column.type != 'custom_link') {\n\t\t\t\tconst id = row.original[idField || 'id'];\n\t\t\t\tconst path = redirectionLink instanceof Function ? generateRouteWithId(redirectionLink(row), id?.toString()) : generateRouteWithId(redirectionLink, id?.toString());\n\t\t\t\treturn (\n\t\t\t\t\t<Link to={path}\n\t\t\t\t\t\tstate={redirectionLinkState?.(row)}>\n\t\t\t\t\t\t{v}\n\t\t\t\t\t</Link>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn v;\n\t\t},\n\t\t...(Boolean(enableFooter) && {\n\t\t\tFooter: ({ column }) => (\n\t\t\t\t<DefaultAggregation data={rows} column={String(column.id)} />\n\t\t\t)\n\t\t})\n\t}));\n};\n\nexport const renderEmptyRowsFallback = (text: string) => (\n\t<Box className='no-data'>\n\t\t<img src={images.common.tableNoData} />\n\t\t<Typography type='s3' weight='medium' color='theme.secondary.1000'>\n\t\t\t{text}\n\t\t</Typography>\n\t</Box>\n)\n\n/* eslint-disable no-mixed-spaces-and-tabs */\nexport const renderValueField = (label: string, value: any, t: any, formatFn?: (val: any) => string) => {\n\treturn (\n\t\t<ValueField key={label} label={t?.(label)}>\n\t\t\t{formatFn ? formatFn(value) : value ?? '-'}\n\t\t</ValueField>\n\t);\n};\n"],"names":["downloadFile","async","url","fileName","response","fetch","ok","Error","statusText","blob","blobUrl","window","URL","createObjectURL","link","document","createElement","href","download","body","appendChild","click","removeChild","revokeObjectURL","error","getStatusClass","status","_a","toLowerCase","replace","fileUrls","filter","Boolean","length","_b","map","substring","lastIndexOf","jsxs","Box","display","gap","mb","alignItems","children","jsx","Document","fontSize","Typography","type","weight","color","sx","cursor","noWrap","onClick","mode","fUrls","Array","isArray","flexDirection","textDecoration","textUnderlineOffset","text","className","src","images","common","tableNoData","label","value","t","formatFn","ValueField","columns","currencySymbol","translationFn","enableFooter","redirectionLink","redirectionLinkState","redirectionPathWithId","idField","statusClasses","rows","customizeValue","currencyFormat","currencyFormatData","defaultCurrencyFormat","column","header","Cell","renderedCellValue","row","v","formatLabel","formatDate","editProperties","dateFormat","cs","showDefaultCurrency","defaultCurrencySymbol","Function","formatAmount","Fragment","flexWrap","rcv","Chip","custom_class","_","get","typeArrayAccessorKey","theme","backgroundColor","palette","tertiary4","_c","tertiary6","_d","typeBooleanLabels","json","JSON","parse","join","jsonArrayToString","accessorKey","toFixed","id","original","path","generateRouteWithId","toString","Link","to","state","Footer","DefaultAggregation","data","String"],"mappings":"myBAuBA,MAAMA,EAAeC,MAAOC,EAAKC,KAChC,IAEC,MAAMC,QAAiBC,MAAMH,GAC7B,IAAKE,EAASE,GACb,MAAM,IAAIC,MAAM,yBAAyBH,EAASI,cAInD,MAAMC,QAAaL,EAASK,OAGtBC,EAAUC,OAAOC,IAAIC,gBAAgBJ,GAGrCK,EAAOC,SAASC,cAAc,KACpCF,EAAKG,KAAOP,EACZI,EAAKI,SAAWf,GAAY,kBAG5BY,SAASI,KAAKC,YAAYN,GAC1BA,EAAKO,QACLN,SAASI,KAAKG,YAAYR,GAG1BH,OAAOC,IAAIW,gBAAgBb,EAC5B,OAASc,GAER,MAAMA,CACP,GA0FKC,EAAkBC,UACvB,MAAsB,iBAAXA,EACH,OAAAC,EAAA,MAAAD,OAAA,EAAAA,EAAQE,oBAAR,EAAAD,EAAuBE,QAAQ,IAAK,IACf,iBAAXH,EACVA,EAAS,UAAY,gBAD7B,gCAtDoCI,YACpC,OAAKA,IAEA,OAAAH,EAAA,MAAAG,OAAA,EAAAA,EAAUC,OAAOC,eAAjB,EAAAL,EAA2BM,QAEzB,OAAAC,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