import { html } from 'lit';
import { popFilterableSimpleMenu } from '../../../_common/components/menu/index.js';
import { DeleteIcon, ExpandFullIcon, MoveLeftIcon, MoveRightIcon, } from '../../../_common/icons/index.js';
import { popSideDetail } from '../../common/detail/layout.js';
export const openDetail = (pageElement, rowId, selection) => {
    const old = selection.selection;
    selection.selection = undefined;
    popSideDetail({
        pageElement,
        view: selection.host.view,
        rowId: rowId,
        onClose: () => {
            selection.selection = old;
        },
    });
};
export const popRowMenu = (pageElement, ele, rowId, selection) => {
    popFilterableSimpleMenu(ele, [
        {
            type: 'action',
            name: 'Expand Row',
            icon: ExpandFullIcon,
            select: () => {
                openDetail(pageElement, rowId, selection);
            },
        },
        // {
        //   type: 'group',
        //   name: '',
        //   children: () => [
        //     {
        //       type: 'action',
        //       name: 'Copy',
        //       icon: CopyIcon,
        //       select: () => {
        //         //TODO
        //       },
        //     },
        //     {
        //       type: 'action',
        //       name: 'Paste',
        //       icon: PasteIcon,
        //       select: () => {
        //         //TODO
        //       },
        //     },
        //   ],
        // },
        {
            type: 'group',
            name: '',
            children: () => [
                {
                    type: 'action',
                    name: 'Insert Before',
                    icon: html ` <div
            style="transform: rotate(90deg);display:flex;align-items:center;"
          >
            ${MoveLeftIcon}
          </div>`,
                    select: () => {
                        selection.insertRowBefore(rowId);
                    },
                },
                {
                    type: 'action',
                    name: 'Insert After',
                    icon: html ` <div
            style="transform: rotate(90deg);display:flex;align-items:center;"
          >
            ${MoveRightIcon}
          </div>`,
                    select: () => {
                        selection.insertRowAfter(selection.selection?.groupKey, rowId);
                    },
                },
                // {
                //   type: 'action',
                //   name: 'Duplicate',
                //   icon: DuplicateIcon,
                //   select: () => {
                //     selection.duplicateRow(rowId);
                //   },
                // },
            ],
        },
        {
            type: 'group',
            name: '',
            children: () => [
                {
                    type: 'action',
                    name: 'Delete Row',
                    class: 'delete-item',
                    icon: DeleteIcon,
                    select: () => {
                        selection.deleteRow(rowId);
                    },
                },
            ],
        },
    ]);
};
//# sourceMappingURL=menu.js.map