import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
/*!
 * Copyright (c) Microsoft. All rights reserved.
 * Licensed under the MIT license. See LICENSE file in the project.
 */ import { ArqueroDetailsList, ArqueroTableHeader, StatsColumnType } from '@essex/arquero-react';
import { memo } from 'react';
import { DetailText } from './DetailText.js';
import { useToggleTableFeatures } from './PreviewTable.hooks.js';
import { Container, TextContainer } from './PreviewTable.styles.js';
const statsColumnTypes = [
    StatsColumnType.Type,
    StatsColumnType.Min,
    StatsColumnType.Max,
    StatsColumnType.Distinct,
    StatsColumnType.Invalid, 
];
export const PreviewTable = /*#__PURE__*/ memo(function PreviewTable({ table , headerCommandBar , name , metadata , onChangeMetadata ,  }) {
    const { tableFeatures  } = useToggleTableFeatures();
    return /*#__PURE__*/ _jsx(_Fragment, {
        children: table ? /*#__PURE__*/ _jsxs(Container, {
            children: [
                /*#__PURE__*/ _jsx(ArqueroTableHeader, {
                    name: name,
                    table: table
                }),
                /*#__PURE__*/ _jsx(ArqueroDetailsList, {
                    isSortable: true,
                    compact: true,
                    showColumnBorders: true,
                    isHeadersFixed: true,
                    metadata: metadata,
                    onChangeMetadata: onChangeMetadata,
                    features: {
                        ...tableFeatures,
                        statsColumnTypes: statsColumnTypes,
                        commandBar: headerCommandBar ? headerCommandBar : undefined
                    },
                    table: table
                })
            ]
        }) : /*#__PURE__*/ _jsx(TextContainer, {
            children: /*#__PURE__*/ _jsx(DetailText, {
                text: "(No table selected)"
            })
        })
    });
});
