@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.09 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 rebass_1 = require("rebass");
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(rebass_1.Box, { title: tooltip, flex: 1 },
React.createElement(rebass_1.Flex, { height: cellText ? 8 : 18, backgroundColor: props.backgroundColor, flex: 1 },
React.createElement(rebass_1.Box, { flexBasis: "50%", style: { background: props.barBackgroundColor } })),
cellText && React.createElement(rebass_1.Box, { fontSize: 3 }, cellText)));
};
exports.PercentBarStylePreview = PercentBarStylePreview;