@erpsquad/common 1.8.102 → 1.8.104

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.
Files changed (85) hide show
  1. package/dist/_virtual/index/index.esm10.js +3 -3
  2. package/dist/_virtual/index/index.esm11.js +4 -2
  3. package/dist/_virtual/index/index.esm11.js.map +1 -1
  4. package/dist/_virtual/index/index.esm2.js +2 -4
  5. package/dist/_virtual/index/index.esm2.js.map +1 -1
  6. package/dist/_virtual/index/index.esm3.js +3 -3
  7. package/dist/_virtual/index/index.esm4.js +3 -3
  8. package/dist/_virtual/index/index.esm5.js +3 -3
  9. package/dist/_virtual/index/index.esm6.js +3 -3
  10. package/dist/_virtual/index/index.esm7.js +3 -3
  11. package/dist/_virtual/index/index.esm8.js +3 -3
  12. package/dist/_virtual/index/index.esm9.js +3 -3
  13. package/dist/_virtual/index/index10.js +1 -1
  14. package/dist/_virtual/index/index11.js +1 -1
  15. package/dist/_virtual/index/index2.js +1 -1
  16. package/dist/_virtual/index/index3.js +1 -1
  17. package/dist/_virtual/index/index4.js +1 -1
  18. package/dist/_virtual/index/index5.js +1 -1
  19. package/dist/_virtual/index/index6.js +1 -1
  20. package/dist/_virtual/index/index7.js +1 -1
  21. package/dist/_virtual/index/index8.js +1 -1
  22. package/dist/_virtual/index/index9.js +1 -1
  23. package/dist/api-client/api.inventory/api/index.esm.js +95 -30
  24. package/dist/api-client/api.inventory/api/index.esm.js.map +1 -1
  25. package/dist/api-client/api.inventory/api/index.js +1 -1
  26. package/dist/api-client/api.inventory/api/index.js.map +1 -1
  27. package/dist/api-client/api.inventory/api-types.d.ts +930 -425
  28. package/dist/api-client/api.inventory/api.d.ts +14 -10
  29. package/dist/api-client/api.rbac/api/index.esm2.js +218 -0
  30. package/dist/api-client/api.rbac/api/index.esm2.js.map +1 -1
  31. package/dist/api-client/api.rbac/api/index2.js +1 -1
  32. package/dist/api-client/api.rbac/api/index2.js.map +1 -1
  33. package/dist/components/filter/components/delete-group/index.esm.js +1 -0
  34. package/dist/components/filter/components/delete-group/index.esm.js.map +1 -1
  35. package/dist/components/filter/components/delete-group/index.js +1 -1
  36. package/dist/components/filter/components/delete-group/index.js.map +1 -1
  37. package/dist/components/listing/listing/index.esm.js +2 -2
  38. package/dist/components/listing/listing/index.esm.js.map +1 -1
  39. package/dist/components/listing/listing/index.js +5 -5
  40. package/dist/components/listing/listing/index.js.map +1 -1
  41. package/dist/components/providers/ERPUIProvider/index.esm.js +0 -6
  42. package/dist/components/providers/ERPUIProvider/index.esm.js.map +1 -1
  43. package/dist/components/providers/ERPUIProvider/index.js +1 -2
  44. package/dist/components/providers/ERPUIProvider/index.js.map +1 -1
  45. package/dist/components/uom-field-wrapper/uom-field-wrapper/index.esm.js.map +1 -1
  46. package/dist/components/uom-field-wrapper/uom-field-wrapper/index.js.map +1 -1
  47. package/dist/hooks/index.esm.js +4 -4
  48. package/dist/hooks/index.js +1 -1
  49. package/dist/hooks/use-translations/index.esm.js +1 -2
  50. package/dist/hooks/use-translations/index.esm.js.map +1 -1
  51. package/dist/hooks/use-translations/index.js +1 -1
  52. package/dist/hooks/use-translations/index.js.map +1 -1
  53. package/dist/hooks/useDataFetcher/index.esm.js +2 -3
  54. package/dist/hooks/useDataFetcher/index.esm.js.map +1 -1
  55. package/dist/hooks/useDataFetcher/index.js +1 -1
  56. package/dist/hooks/useDataFetcher/index.js.map +1 -1
  57. package/dist/hooks/useDataFetcher.d.ts +2 -2
  58. package/dist/index.esm.js +69 -69
  59. package/dist/index.js +1 -1
  60. package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.esm.js +1 -1
  61. package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.js +1 -1
  62. package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.js.map +1 -1
  63. package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.esm.js +1 -1
  64. package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js +1 -1
  65. package/dist/node_modules/@mui/system/colorManipulator/index.esm.js +2 -2
  66. package/dist/node_modules/@mui/system/colorManipulator/index.js +1 -1
  67. package/dist/node_modules/@mui/system/colorManipulator/index.js.map +1 -1
  68. package/dist/node_modules/@mui/system/createStyled/index.esm.js +6 -6
  69. package/dist/node_modules/@mui/system/createStyled/index.js +1 -1
  70. package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.esm.js +1 -1
  71. package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.js +1 -1
  72. package/dist/src/api-client/api.inventory/api.d.ts +14 -10
  73. package/dist/src/hooks/useDataFetcher.d.ts +2 -2
  74. package/dist/src/utils/api.d.ts +18 -8
  75. package/dist/style.css +65 -65
  76. package/dist/utils/api/index.esm.js +45 -22
  77. package/dist/utils/api/index.esm.js.map +1 -1
  78. package/dist/utils/api/index.js +1 -1
  79. package/dist/utils/api/index.js.map +1 -1
  80. package/dist/utils/api.d.ts +18 -8
  81. package/dist/utils/common-utility/index.esm.js +13 -7
  82. package/dist/utils/common-utility/index.esm.js.map +1 -1
  83. package/dist/utils/common-utility/index.js +5 -5
  84. package/dist/utils/common-utility/index.js.map +1 -1
  85. package/package.json +1 -1
@@ -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,OA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ESf,GAAkC,eAAfU,EAAOvC,KAAuB,CACzD,MAAM4E,EAAKjC,EAAIkC,SAAS7C,GAAS,MAC3B8C,EAAOjD,aAA2BuB,SAAW2B,EAAAA,oBAAoBlD,EAAgBc,GAAK,MAAAiC,OAAA,EAAAA,EAAII,YAAcD,EAAAA,oBAAoBlD,QAAgB+C,WAAII;AACtJ,OACCpF,EAAAA,IAACqF,EAAAA,KAAA,CAAKC,GAAIJ,EACTK,MAAO,MAAArD,OAAA,EAAAA,EAAuBa,GAC7BhD,SAAAiD,GAGJ,CACA,OAAOA,MAEJ7D,QAAQ6C,IAAiB,CAC5BwD,OAAQ,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, toFixedWithNumbers } 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\tif (typeof v === 'number' && v && String(v)?.includes('.')) {\n\t\t\t\treturn v = toFixedWithNumbers(v)\n\t\t\t}\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\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{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\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 = toFixedWithNumbers(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","includes","toFixedWithNumbers","formatLabel","formatDate","editProperties","dateFormat","_c","cs","showDefaultCurrency","defaultCurrencySymbol","Function","formatAmount","Fragment","flexWrap","rcv","Chip","custom_class","_","get","typeArrayAccessorKey","theme","backgroundColor","palette","tertiary4","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,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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,OACCtF,EAAAA,IAACuF,EAAAA,KAAA,CAAKC,GAAIJ,EACRrF,SAAAiD,GAGJ,CACD,MAAA,GAESf,GAAkC,eAAfU,EAAOvC,KAAuB,CACzD,MAAM8E,EAAKnC,EAAIoC,SAAS/C,GAAS,MAC3BgD,EAAOnD,aAA2B0B,SAAW0B,EAAAA,oBAAoBpD,EAAgBc,GAAK,MAAAmC,OAAA,EAAAA,EAAII,YAAcD,EAAAA,oBAAoBpD,QAAgBiD,WAAII;AACtJ,OACCtF,EAAAA,IAACuF,EAAAA,KAAA,CAAKC,GAAIJ,EACTK,MAAO,MAAAvD,OAAA,EAAAA,EAAuBa,GAC7BhD,SAAAiD,GAGJ,CACA,OAAOA,MAEJ7D,QAAQ6C,IAAiB,CAC5B0D,OAAQ,EAAG/C,OAAAA,sBACV3C,IAAC2F,EAAAA,mBAAA,CAAmBC,KAAMtD,EAAMK,OAAQkD,OAAOlD,EAAOuC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erpsquad/common",
3
- "version": "1.8.102",
3
+ "version": "1.8.104",
4
4
  "description": "Shared UI component library for ERP modules",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",