import { isArray, isValid } from "@visactor/vutils";

export function getHorizontalScrollBarSize(scrollStyle) {
    var _a;
    return (null == scrollStyle ? void 0 : scrollStyle.hoverOn) || (null == scrollStyle ? void 0 : scrollStyle.horizontalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.horizontalVisible) || !(null == scrollStyle ? void 0 : scrollStyle.horizontalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.visible) ? 0 : null !== (_a = null == scrollStyle ? void 0 : scrollStyle.width) && void 0 !== _a ? _a : 7;
}

export function getVerticalScrollBarSize(scrollStyle) {
    var _a;
    return (null == scrollStyle ? void 0 : scrollStyle.hoverOn) || (null == scrollStyle ? void 0 : scrollStyle.verticalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.verticalVisible) || !(null == scrollStyle ? void 0 : scrollStyle.verticalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.visible) ? 0 : null !== (_a = null == scrollStyle ? void 0 : scrollStyle.width) && void 0 !== _a ? _a : 7;
}

export function isValidStyle(style) {
    return !!isValid(style) && (!isArray(style) || style.some((s => isValid(s))));
}

export function isZeroStyle(style) {
    return 0 === style || isArray(style) && style.every((s => 0 === s));
}

export function setActiveCellRangeState(table) {
    const selectRanges = table.stateManager.select.ranges, setRanges = [];
    for (let i = 0; i < selectRanges.length; i++) {
        const range = selectRanges[i];
        setRanges.push({
            range: range,
            style: {
                cellBorderColor: "blue",
                cellBorderLineWidth: 2,
                cellBorderLineDash: [ 5, 5 ]
            }
        });
    }
    table.stateManager.setCustomSelectRanges(setRanges);
}

export function clearActiveCellRangeState(table) {
    table.stateManager.setCustomSelectRanges([]);
}
//# sourceMappingURL=style.js.map
