|
|
|
@ -59,7 +59,16 @@ const stringifyRolesObj = (roles?: RolesObj | null): string => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const getAvailableRollupForUiType = (type: string) => { |
|
|
|
|
if ([UITypes.Year].includes(type as UITypes)) { |
|
|
|
|
if ( |
|
|
|
|
[ |
|
|
|
|
UITypes.Year, |
|
|
|
|
UITypes.Time, |
|
|
|
|
UITypes.Date, |
|
|
|
|
UITypes.DateTime, |
|
|
|
|
UITypes.CreatedTime, |
|
|
|
|
UITypes.LastModifiedTime, |
|
|
|
|
].includes(type as UITypes) |
|
|
|
|
) { |
|
|
|
|
return ['count', 'min', 'max', 'countDistinct']; |
|
|
|
|
} |
|
|
|
|
if (isNumericCol(type as UITypes)) { |
|
|
|
@ -75,16 +84,7 @@ const getAvailableRollupForUiType = (type: string) => {
|
|
|
|
|
'avgDistinct', |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
if ( |
|
|
|
|
[ |
|
|
|
|
UITypes.Date, |
|
|
|
|
UITypes.DateTime, |
|
|
|
|
UITypes.CreatedTime, |
|
|
|
|
UITypes.LastModifiedTime, |
|
|
|
|
].includes(type as UITypes) |
|
|
|
|
) { |
|
|
|
|
return ['count', 'min', 'max', 'countDistinct']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
[ |
|
|
|
|
UITypes.SingleLineText, |
|
|
|
@ -119,6 +119,35 @@ const getAvailableRollupForUiType = (type: string) => {
|
|
|
|
|
]; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const getRenderAsTextFunForUiType = (type: UITypes) => { |
|
|
|
|
if ( |
|
|
|
|
[ |
|
|
|
|
UITypes.Year, |
|
|
|
|
UITypes.Time, |
|
|
|
|
UITypes.Date, |
|
|
|
|
UITypes.DateTime, |
|
|
|
|
UITypes.CreatedTime, |
|
|
|
|
UITypes.LastModifiedTime, |
|
|
|
|
UITypes.Decimal, |
|
|
|
|
UITypes.Currency, |
|
|
|
|
UITypes.Duration, |
|
|
|
|
].includes(type) |
|
|
|
|
) { |
|
|
|
|
return ['count', 'countDistinct']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return [ |
|
|
|
|
'sum', |
|
|
|
|
'count', |
|
|
|
|
'avg', |
|
|
|
|
'min', |
|
|
|
|
'max', |
|
|
|
|
'countDistinct', |
|
|
|
|
'sumDistinct', |
|
|
|
|
'avgDistinct', |
|
|
|
|
]; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const getFileName = ({ name, count, ext }) => |
|
|
|
|
`${name}${count ? `(${count})` : ''}${ext ? `${ext}` : ''}`; |
|
|
|
|
|
|
|
|
@ -170,6 +199,7 @@ export {
|
|
|
|
|
extractRolesObj, |
|
|
|
|
stringifyRolesObj, |
|
|
|
|
getAvailableRollupForUiType, |
|
|
|
|
getRenderAsTextFunForUiType, |
|
|
|
|
populateUniqueFileName, |
|
|
|
|
roundUpToPrecision, |
|
|
|
|
}; |
|
|
|
|