import { forEach } from '../../renderer/utils';
import { cssClass } from '../../styles';
/** @internal */
export function updateFilterState(attachment, column, filtered) {
    var toggle = function (e) {
        var n = e;
        if (filtered) {
            n.dataset.active = '';
        }
        else {
            delete n.dataset.active;
        }
    };
    toggle(attachment);
    var root = attachment.closest("." + cssClass());
    if (!root) {
        return;
    }
    Array.from(root.querySelectorAll("[data-col-id=\"" + column.id + "\"] i[title^=Filter]")).forEach(toggle);
}
/** @internal */
export function sortMethods(node, column, methods) {
    var bak = column.getSortMethod();
    methods.forEach(function (d) { return node.insertAdjacentHTML('beforeend', "<label class=\"" + cssClass('checkbox') + "\"><input type=\"radio\" name=\"multivaluesort\" value=\"" + d + "\"  " + ((bak === d) ? 'checked' : '') + " ><span>" + (d.slice(0, 1).toUpperCase() + d.slice(1)) + "</span></label>"); });
    forEach(node, 'input[name=multivaluesort]', function (n) {
        n.addEventListener('change', function () { return column.setSortMethod(n.value); }, {
            passive: true
        });
    });
}
/** @internal */
export { uniqueId, forEach, forEachChild, colorOf } from '../../renderer/utils';
//# sourceMappingURL=utils.js.map