"use strict";
/* eslint-disable react/display-name */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TableRowActions = void 0;
const react_1 = __importDefault(require("react"));
const IconButton_1 = require("../IconButton");
const TableCheckbox_1 = require("./TableCheckbox");
const Icon_1 = require("../Icon");
const icons_1 = require("../../assets/images/icons");
exports.TableRowActions = ({ hooks, selectable, setShowBatchActions, deleteRow, subRow, setSkipTableReset, }) => {
    hooks.visibleColumns.push((cols) => [
        ...(selectable
            ? [
                {
                    id: 'selection',
                    width: 30,
                    Header: ({ getToggleAllRowsSelectedProps }) => (react_1.default.createElement(TableCheckbox_1.TableCheckbox, Object.assign({}, getToggleAllRowsSelectedProps(), { setShowBatchActions: setShowBatchActions }))),
                    Cell: ({ row }) => (react_1.default.createElement(TableCheckbox_1.TableCheckbox, Object.assign({}, row.getToggleRowSelectedProps()))),
                },
            ]
            : []),
        ...cols,
        ...(deleteRow
            ? [
                {
                    id: 'deletion',
                    width: 30,
                    Cell: ({ row }) => (react_1.default.createElement(IconButton_1.IconButton, { Asset: icons_1.SvgDeleteOutline, width: 24, height: 24, color: "gray.3", className: "deleteIcon", onClick: () => {
                            setSkipTableReset(true);
                            deleteRow(row.original, row.index);
                            setTimeout(() => {
                                setSkipTableReset(false);
                            }, 300);
                        } })),
                },
            ]
            : []),
        ...(subRow
            ? [
                {
                    id: 'expansion',
                    width: 30,
                    Cell: ({ row }) => (react_1.default.createElement("span", Object.assign({}, row.getToggleRowExpandedProps()),
                        react_1.default.createElement(Icon_1.Icon, { Asset: row.isExpanded ? icons_1.SvgChevronDown : icons_1.SvgChevronLeft, width: 24, height: 24, color: "gray.3" }))),
                },
            ]
            : []),
    ]);
};
//# sourceMappingURL=TableRowActions.js.map