"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.closeComponent = exports.openComponent = exports.closeFlyout = exports.openFlyout = exports.closeContextMenu = exports.openContextMenu = void 0;
var tslib_1 = require("tslib");
var actions_1 = require("../constants/actions");
/**
 * Opens the context menu at the specific position
 *
 * @param position The client x/y position
 * @since 0.13
 */
function openContextMenu(position) {
    return {
        type: actions_1.ActionType.CONTEXT_MENU_OPEN,
        payload: tslib_1.__assign({}, position)
    };
}
exports.openContextMenu = openContextMenu;
/**
 * Closes the context menu
 *
 * @since 0.13
 */
function closeContextMenu() {
    return {
        type: actions_1.ActionType.CONTEXT_MENU_CLOSE
    };
}
exports.closeContextMenu = closeContextMenu;
/**
 * Opens the specified flyout menu
 *
 * @export
 * @param {string} id
 * @param {IDOMElementMetrics} metrics
 * @returns {IOpenFlyoutAction}
 */
function openFlyout(id, metrics) {
    return {
        type: actions_1.ActionType.FLYOUT_OPEN,
        payload: {
            flyoutId: id,
            metrics: metrics
        }
    };
}
exports.openFlyout = openFlyout;
/**
 * Closes the specified flyout menu
 *
 * @export
 * @param {string} id
 * @returns {ICloseFlyoutAction}
 */
function closeFlyout(id) {
    return {
        type: actions_1.ActionType.FLYOUT_CLOSE,
        payload: {
            flyoutId: id
        }
    };
}
exports.closeFlyout = closeFlyout;
/**
 * Load the specified component in the given flyout with the given component props
 *
 * @export
 * @param {string} id
 * @param {IDOMElementMetrics} metrics
 * @param {string} name
 * @param {*} props
 * @returns {IOpenComponentInFlyoutAction}
 */
function openComponent(id, metrics, name, props) {
    return {
        type: actions_1.ActionType.COMPONENT_OPEN,
        payload: {
            flyoutId: id,
            metrics: metrics,
            name: name,
            props: props
        }
    };
}
exports.openComponent = openComponent;
/**
 * Closes the component in the given flyout
 *
 * @export
 * @param {string} id
 * @returns {ICloseComponentInFlyoutAction}
 */
function closeComponent(id) {
    return {
        type: actions_1.ActionType.COMPONENT_CLOSE,
        payload: {
            flyoutId: id
        }
    };
}
exports.closeComponent = closeComponent;
//# sourceMappingURL=flyout.js.map