"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DataGridPreferencesColumnLayoutSettings = DataGridPreferencesColumnLayoutSettings;
const react_1 = __importDefault(require("react"));
const checkbox_1 = require("../../form/checkbox");
function DataGridPreferencesColumnLayoutSettings({ value, onChange = () => null, fields, }) {
    const { columnDividers, stickyColumns } = value;
    const showColumnDividers = (fields === null || fields === void 0 ? void 0 : fields.columnDividers) !== false;
    const showStickyColumns = (fields === null || fields === void 0 ? void 0 : fields.stickyColumns) !== false;
    if (!showColumnDividers && !showStickyColumns) {
        return null;
    }
    const checkboxValues = [
        ...(columnDividers ? ["columnDividers"] : []),
        ...(stickyColumns.start ? ["sticky-start"] : []),
        ...(stickyColumns.end ? ["sticky-end"] : []),
    ];
    return (react_1.default.createElement(checkbox_1.CheckboxGroup, { legend: "Kolonneegenskaper", size: "small", value: checkboxValues, onChange: (values) => {
            onChange({
                columnDividers: showColumnDividers
                    ? values.includes("columnDividers")
                    : columnDividers,
                stickyColumns: showStickyColumns
                    ? {
                        start: values.includes("sticky-start") ? 1 : undefined,
                        end: values.includes("sticky-end") ? 1 : undefined,
                    }
                    : stickyColumns,
            });
        } },
        showColumnDividers && (react_1.default.createElement(checkbox_1.Checkbox, { value: "columnDividers" }, "Skillelinje mellom kolonner")),
        showStickyColumns && (react_1.default.createElement(checkbox_1.Checkbox, { value: "sticky-start" }, "Fest f\u00F8rste kolonne")),
        showStickyColumns && (react_1.default.createElement(checkbox_1.Checkbox, { value: "sticky-end" }, "Fest siste kolonne"))));
}
//# sourceMappingURL=DataGridPreferencesColumnLayoutSettings.js.map