import { observer } from 'mobx-react';
import { am as LazyLoad, w as appContext, v as i18n, b1 as getHostPath } from './MapEditView-24782753.js';
import * as React from 'react';
import { useRef, useCallback, useMemo } from 'react';
import { pick } from 'lodash';
import 'maptalks';
import 'uuid';
import 'mobx';
import 'lz-string';
import 'dayjs';
import 'react-dom';
import 'classnames';
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';

var DataTable = LazyLoad(function () { return import('./index-3505e026.js').then(function (n) { return n.e; }); });
// 查看数据 table
var MapDataTable = observer(function () {
    var Context = appContext.getContext();
    var value = React.useContext(Context);
    var routeStore = value.routeStore;
    var tableDataModel = routeStore.tableDataModel, setDataTablePkg = routeStore.setDataTablePkg, showTableTabPopup = routeStore.showTableTabPopup, setTableTabPopup = routeStore.setTableTabPopup, getSuppPackage = routeStore.SuppFiltersStore.getSuppPackage, setDataTableTabIndexChangeHandler = routeStore.setDataTableTabIndexChangeHandler, projectOption = routeStore.projectOption;
    var rowInfoRef = useRef();
    var refCallback = function (ref) {
        if (ref) {
            var changeTab = ref.changeTab;
            setDataTableTabIndexChangeHandler(changeTab);
        }
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    var handleClick = useCallback(function (rowInfo) {
        // ...
    }, []);
    var handleDbClick = useCallback(function (rowInfo) {
        setTableTabPopup(true);
        rowInfoRef.current = rowInfo;
    }, [setTableTabPopup]);
    var handleDeleteDataTablePkg = useCallback(function (packageUuid) {
        setDataTablePkg(undefined, 'delete', packageUuid);
    }, [setDataTablePkg]);
    var handleInnerStoreChange = useCallback(function (stores) {
        var _a;
        (_a = routeStore.editMapStore) === null || _a === void 0 ? void 0 : _a.setTableStores(stores);
    }, [routeStore]);
    var tabPopupConfirm = useMemo(function () { return ({
        showPopup: showTableTabPopup,
        okText: i18n.mapEdit.edit,
        cancelText: i18n.mapEdit.cancelText,
        message: i18n.mapEdit.rightTableTabHint,
        description: i18n.mapEdit.rightTableTabHintDesc,
        emotion: 'info',
        onVisibleChange: function (visible) { return !visible && setTableTabPopup(false); },
        onConfirm: function () {
            if (rowInfoRef.current) {
                var cTableStore = rowInfoRef.current.cTableStore;
                var tableId = cTableStore.tableId;
                var suppPackage = getSuppPackage(tableId, undefined, 'packageUuid');
                var info = pick(suppPackage, [
                    'uuid',
                    'geometryType',
                    'objectType',
                    'packageUuid',
                    'source',
                ]);
                window.localStorage.setItem('my-data-init-supp-filter', JSON.stringify(info));
                window.open(getHostPath('/my-data'));
            }
        },
    }); }, [getSuppPackage, setTableTabPopup, showTableTabPopup]);
    return (React.createElement(DataTable, { ref: refCallback, showFullScreen: false, packages: tableDataModel, delPackage: handleDeleteDataTablePkg, tabPopupConfirm: tabPopupConfirm, onDbClick: handleDbClick, onRowClick: handleClick, handleInnerStoreChange: handleInnerStoreChange, projectOption: projectOption }));
});
var MapDataTable$1 = MapDataTable;

export { MapDataTable$1 as default };
