import * as tslib_1 from "tslib";
import { toolbar } from './annotations';
import MapColumn from './MapColumn';
import { EAlignment } from './StringColumn';
import { isMissingValue } from './missing';
/**
 * a string column with optional alignment
 */
var StringMapColumn = /** @class */ (function (_super) {
    tslib_1.__extends(StringMapColumn, _super);
    function StringMapColumn(id, desc) {
        var _this = _super.call(this, id, desc) || this;
        _this.setDefaultWidth(200); //by default 200
        _this.alignment = desc.alignment || EAlignment.left;
        _this.escape = desc.escape !== false;
        _this.setDefaultRenderer('map');
        return _this;
    }
    StringMapColumn.prototype.on = function (type, listener) {
        return _super.prototype.on.call(this, type, listener);
    };
    StringMapColumn.prototype.getValue = function (row) {
        var r = this.getMapValue(row);
        return r.every(function (d) { return d.value === ''; }) ? null : r;
    };
    StringMapColumn.prototype.getMapValue = function (row) {
        return _super.prototype.getMap.call(this, row).map(function (_a) {
            var key = _a.key, value = _a.value;
            return ({
                key: key,
                value: isMissingValue(value) ? '' : String(value)
            });
        });
    };
    StringMapColumn = tslib_1.__decorate([
        toolbar('search')
    ], StringMapColumn);
    return StringMapColumn;
}(MapColumn));
export default StringMapColumn;
//# sourceMappingURL=StringMapColumn.js.map