FIX-1847 added all the changes and removed the truncate algo.

This commit is contained in:
Owaise Imdad committed 2025-03-04 13:36:42 +05:30
1 parent 0eebd2929b
commit 4d437a8898
5 files changed
+15 -78

No files matched your search

-38
View File
@@ -1,38 +0,0 @@
import PropTypes from "prop-types";
import { isEmpty } from "../stringUtils";
/**
* Utility function to render a truncated value with an optional title.
* @param {string} displayName - The name or text to display.
* @param {boolean} truncate - Whether to truncate the text or not.
* @param {number} maxLength - The maximum length of the text.
* @param {string} placeholder - Placeholder text if no value is provided.
* @returns {JSX.Element} - The JSX element for the rendered value.
*/
export const renderTruncatedValue = function (
displayName,
truncate,
maxLength,
placeholder
) {
if (isEmpty(displayName)) return placeholder;
const truncateTextWithDottedEnds = function (text, maxLength) {
if (!text || text.length <= maxLength) return text;
return `${text.substring(0, maxLength)}...`;
};
return truncate ? (
<span title={displayName}>{truncateTextWithDottedEnds(displayName, maxLength)}</span>
) : (
<span title={displayName}>{displayName}</span>
);
};
renderTruncatedValue.propTypes = {
displayName: PropTypes.string, // The name or text to display
truncate: PropTypes.bool, // Whether to truncate the text or not
maxLength: PropTypes.number, // The maximum length of the text
placeholder: PropTypes.string, // Placeholder text if no value is provided
};
+12
View File
@@ -382,6 +382,18 @@ const baseTheme = (palette) => ({
}),
},
},
MuiButtonGroup: {
styleOverrides: {
root: ({ theme }) => ({
ml: "auto",
"& .MuiButtonBase-root, & .MuiButtonBase-root:hover": {
borderColor: theme.palette.primary.lowContrast,
width: "auto",
whiteSpace: "nowrap",
},
}),
},
},
},
shape: {
borderRadius: 2,
+1 -10
View File
@@ -42,14 +42,5 @@ export const toLowerCaseFirstLetter = (str) => {
*/
export const isEmpty = (str) => {
// Check if string is null, undefined, or empty (including whitespace only)
return str === null || str === undefined || str.trim().length === 0;
};
/**
* Checks if a string is not null, undefined, and not empty (including strings with only whitespace).
* @param {string} str - The string to check.
* @returns {boolean} - Returns true if the string is not null, undefined, and not empty.
*/
export const isNotEmpty = (str) => {
return !isEmpty(str);
return str === null || typeof str === "undefined" || str.trim().length === 0;
};