import { observer } from 'mobx-react';
import { ah as LazyLoad, q as appContext, p as i18n, aY as getHostPath } from './MapEditView-f6381866.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 '@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';

const DataTable = LazyLoad(() => import('./index-0b8bebb4.js').then(function (n) { return n.e; }));
// 查看数据 table
const MapDataTable = observer(() => {
    const Context = appContext.getContext();
    const value = React.useContext(Context);
    const { routeStore } = value;
    const { tableDataModel, setDataTablePkg, showTableTabPopup, setTableTabPopup, SuppFiltersStore: { getSuppPackage }, setDataTableTabIndexChangeHandler, projectOption, } = routeStore;
    const rowInfoRef = useRef();
    const refCallback = (ref) => {
        if (ref) {
            const { changeTab } = ref;
            setDataTableTabIndexChangeHandler(changeTab);
        }
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    const handleClick = useCallback((rowInfo) => {
        // ...
    }, []);
    const handleDbClick = useCallback((rowInfo) => {
        setTableTabPopup(true);
        rowInfoRef.current = rowInfo;
    }, [setTableTabPopup]);
    const handleDeleteDataTablePkg = useCallback((packageUuid) => {
        setDataTablePkg(undefined, 'delete', packageUuid);
    }, [setDataTablePkg]);
    const handleInnerStoreChange = useCallback((stores) => {
        var _a;
        (_a = routeStore.editMapStore) === null || _a === void 0 ? void 0 : _a.setTableStores(stores);
    }, [routeStore]);
    const tabPopupConfirm = useMemo(() => ({
        showPopup: showTableTabPopup,
        okText: i18n.mapEdit.edit,
        cancelText: i18n.mapEdit.cancelText,
        message: i18n.mapEdit.rightTableTabHint,
        description: i18n.mapEdit.rightTableTabHintDesc,
        emotion: 'info',
        onVisibleChange: (visible) => !visible && setTableTabPopup(false),
        onConfirm: () => {
            if (rowInfoRef.current) {
                const { cTableStore } = rowInfoRef.current;
                const { tableId } = cTableStore;
                const suppPackage = getSuppPackage(tableId, undefined, 'packageUuid');
                const 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 };
