import { j as __rest, y as IconButton, kB as ExpandDirect, ls as GEO_TYPE_ICON_MAP, ar as Tooltip, I as Icon, x as Popconfirm, s as __assign } from './MapEditView-24782753.js';
import React__default from 'react';
import { observer } from 'mobx-react';
import classNames from 'classnames';
import { M as MyDataTableContext, p as prefixCls } from './index-3505e026.js';
import 'maptalks';
import 'lodash';
import 'uuid';
import 'mobx';
import 'lz-string';
import 'dayjs';
import 'react-dom';
import 'react-is';
import '@loadable/component';
import 'js-beautify';
import 'axios';
import 'superstruct';
import '@tanem/react-nprogress';
import 'jquery';
import 'chroma-js';
import 'js-cookie';
import 'is-email';
import 'is-uuid';
import 'is-url';
import 'anymatch';
import 'perf-request';
import '@syncpoint/wkx';
import 'buffer';
import '@turf/turf';
import '@mapbox/polylabel';
import 'turf-multipolygon';
import 'turf-polygon';
import 'gcoord';
import 'eventemitter2';
import 'geobuf';
import 'localforage';
import 'rc-menu';
import 'perfect-scrollbar';
import 'ahooks';
import 'jszip';
import 'file-saver';
import 'screenfull';
import 'sql-formatter-fork';
import 'array-move';
import 'turf-multilinestring';
import 'copy-to-clipboard';
import 'maptalks.three';
import 'ajv';
import 'spark-md5';
import 'react-draggable';
import 'react-virtualized';
import 'turf-point';
import 'decamelize';
import 'rbush';
import 'qs';
import 'maptalks.snap';
import 'react-use';
import 'react-rnd';
import 'react-beautiful-dnd';
import 'react-contextmenu';
import 'coordtransform';
import './compact-6f8b3541.js';
import './useDataValue-8bdb351c.js';
import 'react-dnd-html5-backend';
import 'ali-react-table-fork';
import './Transfer-f55a5877.js';
import 'ismobilejs';

var DataTableHeader = observer(function (_a) {
    var expand = _a.expand, expandRight = _a.expandRight;
    var _b = React__default.useContext(MyDataTableContext), store = _b.store, delPackage = _b.delPackage, tabPopupConfirm = _b.tabPopupConfirm;
    var _c = tabPopupConfirm || {}, showPopup = _c.showPopup, showPopupIndex = _c.tabIndex, message = _c.message, otherPopupProps = __rest(_c, ["showPopup", "tabIndex", "message"]);
    var packages = store.packages, tableIndex = store.tableIndex, changeTab = store.changeTab, showFullScreen = store.showFullScreen;
    var _showPopupIndex = showPopupIndex !== null && showPopupIndex !== void 0 ? showPopupIndex : tableIndex;
    var expandNode = React__default.useMemo(function () {
        return (showFullScreen && (React__default.createElement("div", { className: "".concat(prefixCls, "-header-expand") },
            React__default.createElement(IconButton, { icon: (expand.direction === ExpandDirect.Right && expand.expanded) ||
                    (expand.direction === ExpandDirect.Left && !expand.expanded && packages.length > 0)
                    ? 'minimize'
                    : 'maximize', onClick: expandRight, ghost: true }))));
    }, [expand.direction, expand.expanded, expandRight, packages.length, showFullScreen]);
    return (React__default.createElement("div", { className: "".concat(prefixCls, "-header") },
        React__default.createElement("div", { className: "".concat(prefixCls, "-tabs") }, packages.map(function (pack, index) {
            var _a;
            var _b;
            var tabCls = classNames("".concat(prefixCls, "-tab"), (_a = {},
                _a["".concat(prefixCls, "-tab-active")] = tableIndex === index,
                _a));
            var tabName = React__default.createElement("div", { className: "".concat(prefixCls, "-tab-name") }, pack.name);
            var icon = (_b = GEO_TYPE_ICON_MAP[pack.geometryType]) !== null && _b !== void 0 ? _b : 'file';
            return (React__default.createElement("div", { className: tabCls, onClick: function () { return changeTab(index); }, key: index },
                React__default.createElement(Tooltip, { title: pack.name },
                    React__default.createElement("div", { className: "".concat(prefixCls, "-tab-left") },
                        React__default.createElement(Icon, { icon: icon, className: "".concat(prefixCls, "-tab-icon-package") }),
                        showPopup && _showPopupIndex === index ? (React__default.createElement(Popconfirm, __assign({ message: message, defaultVisible: true }, otherPopupProps), tabName)) : (tabName))),
                React__default.createElement(IconButton, { type: "only-icon", icon: "close", onClick: function (e) {
                        e.stopPropagation();
                        var packageUuid = pack.packageUuid;
                        delPackage && delPackage(packageUuid, e);
                    }, className: "".concat(prefixCls, "-tab-icon-close") })));
        })),
        expandNode));
});

export { DataTableHeader as default };
