How to use the @finos/perspective/dist/esm/config/index.js.get_type_config function in @finos/perspective

To help you get started, we’ve selected a few @finos/perspective examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github finos / perspective / packages / perspective-viewer-hypergrid / src / js / PerspectiveDataModel.js View on Github external
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)";