@adaptabletools/adaptable-cjs
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
26 lines (25 loc) • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PercentBarStylePreview = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const Flex_1 = require("../../../../../components/Flex");
const getText = (options) => {
let text = '';
if (options && options.includes('CellValue')) {
text += '20';
}
if (options && options.includes('PercentageValue')) {
text += ' (50%)';
}
return text.trim();
};
const PercentBarStylePreview = (props) => {
const cellText = getText(props.cellText);
const tooltip = getText(props.toolTipText);
return (React.createElement(Flex_1.Box, { title: tooltip, className: "twa:flex-1" },
React.createElement(Flex_1.Flex, { style: { backgroundColor: props.backgroundColor }, className: `twa:flex-1 ${cellText ? 'twa:h-[8px]' : 'twa:h-[18px]'}` },
React.createElement(Flex_1.Box, { className: "twa:basis-[50%]", style: { background: props.barBackgroundColor } })),
cellText && React.createElement(Flex_1.Box, { className: "twa:text-3" }, cellText)));
};
exports.PercentBarStylePreview = PercentBarStylePreview;