import React from 'react'; import { type ICommand, type ICommandChildCommands, type ICommandChildHandle } from './'; export type GroupOptions = Omit, 'children'> & { children?: ICommandChildHandle['children']; }; export const group = (arr: ICommandChildCommands['children'], options?: GroupOptions): ICommand => { let data = { children: arr as any, icon: ( ), execute: () => {}, ...options, keyCommand: 'group', }; if (Array.isArray(data.children)) { data.children = data.children.map(({ ...item }: ICommand) => { item.parent = data; return { ...item }; }); } return data; };