"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StyledColumnBadgePreview = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const GeneralConstants_1 = require("../../../../../Utilities/Constants/GeneralConstants");
const AdaptableContext_1 = require("../../../../AdaptableContext");
const Badge_1 = require("../../../../Components/Badge");
const Flex_1 = require("../../../../../components/Flex");
const StyledColumnBadgePreview = ({ data }) => {
    const adaptable = (0, AdaptableContext_1.useAdaptable)();
    const badgeStyle = data.BadgeStyle;
    if (!badgeStyle || badgeStyle.Badges.length === 0) {
        return React.createElement("div", null, "No Badges Defined");
    }
    return (React.createElement(Flex_1.Flex, { flexDirection: "column" }, badgeStyle.Badges.map((badge, index) => {
        const badgeValue = badge.IconOnly
            ? ''
            : adaptable.api.columnApi.getColumnDataTypeForColumnId(data.ColumnId) === 'number'
                ? GeneralConstants_1.DEFAULT_INTEGER_DISPLAY_VALUE
                : GeneralConstants_1.DEFAULT_STRING_DISPLAY_VALUE;
        return (React.createElement(Flex_1.Box, { className: "twa:mb-1", key: index },
            React.createElement(Badge_1.Badge, { icon: badge.Icon, adaptableStyle: badge.Style, iconPosition: badge.IconPosition }, badgeValue)));
    })));
};
exports.StyledColumnBadgePreview = StyledColumnBadgePreview;
