"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MoveFormatColumn = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
const FormatColumnRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/FormatColumnRedux"));
const react_redux_1 = require("react-redux");
const AdaptableContext_1 = require("../AdaptableContext");
const MoveFormatColumn = (props) => {
    const dispatch = (0, react_redux_1.useDispatch)();
    const adaptable = (0, AdaptableContext_1.useAdaptable)();
    const formatColumn = adaptable.api.formatColumnApi.getFormatColumns();
    const handleMoveUp = React.useCallback(() => {
        dispatch(FormatColumnRedux.FormatColumnMoveUp(props.data));
    }, []);
    const handleMoveDown = React.useCallback(() => {
        dispatch(FormatColumnRedux.FormatColumnMoveDown(props.data));
    }, []);
    if (formatColumn?.length <= 1) {
        return React.createElement(React.Fragment, null);
    }
    return (React.createElement(React.Fragment, null,
        React.createElement(SimpleButton_1.default, { "data-id": "move-up", title: "move up", onClick: handleMoveUp, variant: "text", icon: "arrow-up" }),
        React.createElement(SimpleButton_1.default, { "data-name": "move-down", title: "move down", onClick: handleMoveDown, variant: "text", icon: "arrow-down" })));
};
exports.MoveFormatColumn = MoveFormatColumn;
