"use strict";

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _react = require("react");

var _react2 = _interopRequireDefault(_react);

var _checkbox = require("../checkbox");

var _checkbox2 = _interopRequireDefault(_checkbox);

var _row = require("../row");

var _row2 = _interopRequireDefault(_row);

var _col = require("../col");

var _col2 = _interopRequireDefault(_col);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

exports["default"] = function (props) {
    var columns = props.columns,
        defaultColumns = props.defaultColumns,
        handleColModelMenu = props.handleColModelMenu;

    var onChange = function onChange(val) {
        handleColModelMenu(val);
    };
    return _react2["default"].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" } },
        _react2["default"].createElement(
            _checkbox2["default"].Group,
            { value: (columns === null || columns === void 0 ? void 0 : columns.map(function (opt) {
                    return opt.dataIndex || opt.key;
                })) || [], onChange: onChange },
            _react2["default"].createElement(
                _row2["default"],
                { 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 _react2["default"].createElement(
                        _col2["default"],
                        { span: 24 },
                        _react2["default"].createElement(
                            _checkbox2["default"],
                            { 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
                        )
                    );
                })
            )
        )
    );
};

module.exports = exports['default'];