import React from "react";
import Checkbox from "../checkbox";
import Row from "../row";
import Col from "../col";
export default (function (props) {
    var columns = props.columns,
        defaultColumns = props.defaultColumns,
        handleColModelMenu = props.handleColModelMenu;

    var onChange = function onChange(val) {
        handleColModelMenu(val);
    };
    return React.createElement(
        "div",
        { className: "fdx-col-model-menu", style: { background: '#fff', padding: "8px", boxShadow: "0 4px 16px 0 rgb(0 0 0 / 12%)", border: "1px solid #e0e0e0" } },
        React.createElement(
            Checkbox.Group,
            { value: (columns === null || columns === void 0 ? void 0 : columns.map(function (opt) {
                    return opt.dataIndex || opt.key;
                })) || [], onChange: onChange },
            React.createElement(
                Row,
                { type: "flex", align: "middle" },
                defaultColumns.map(function (col) {
                    var _a, _b;
                    var val = (col === null || col === void 0 ? void 0 : col.dataIndex) || (col === null || col === void 0 ? void 0 : col.key);
                    // @ts-ignore
                    var title = typeof col.title === 'function' ? col.title() : col.title;
                    return React.createElement(
                        Col,
                        { span: 24 },
                        React.createElement(
                            Checkbox,
                            { value: val, disabled: (columns === null || columns === void 0 ? void 0 : columns.length) === 1 && (val === ((_a = columns === null || columns === void 0 ? void 0 : columns[0]) === null || _a === void 0 ? void 0 : _a.dataIndex) || val === ((_b = columns === null || columns === void 0 ? void 0 : columns[0]) === null || _b === void 0 ? void 0 : _b.key)) },
                            title
                        )
                    );
                })
            )
        )
    );
});