Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function cellStyle(gridCellConfig) {
if (gridCellConfig.value === null || gridCellConfig.value === undefined) {
gridCellConfig.value = "-";
} else {
let type = this.schema[gridCellConfig.dataCell.x].type;
const type_config = get_type_config(type);
if (type_config.type) {
type = type_config.type;
}
if (["number", "float", "integer"].indexOf(type) > -1) {
if (gridCellConfig.value === 0) {
gridCellConfig.value = type === "float" ? "0.00" : "0";
} else if (isNaN(gridCellConfig.value)) {
gridCellConfig.value = "-";
} else {
if (gridCellConfig.value > 0) {
gridCellConfig.color = gridCellConfig.columnColorNumberPositive || "rgb(160,207,255)";
gridCellConfig.backgroundColor = gridCellConfig.columnBackgroundColorNumberPositive ? gridCellConfig.columnBackgroundColorNumberPositive : gridCellConfig.backgroundColor;
gridCellConfig.borderBottom = gridCellConfig.borderBottomPositive ? gridCellConfig.borderBottomPositive : gridCellConfig.borderBottom;
gridCellConfig.borderRight = gridCellConfig.borderRightPositive ? gridCellConfig.borderRightPositive : gridCellConfig.borderRight;
} else {
gridCellConfig.color = gridCellConfig.columnColorNumberNegative || "rgb(255,136,136)";