quick export from table data grid toolstrip

This commit is contained in:
Jan Prochazka
2022-02-12 18:08:25 +01:00
parent e06b030707
commit a8265cebff
10 changed files with 83 additions and 35 deletions

View File

@@ -95,7 +95,7 @@ function mapItem(item, commands) {
const command = commands[item.command];
if (command) {
return {
text: command.menuName || command.toolbarName || command.name,
text: item.text || command.menuName || command.toolbarName || command.name,
keyText: command.keyText || command.keyTextFromGroup,
onClick: () => {
if (command.getSubCommands) visibleCommandPalette.set(command);

View File

@@ -1,6 +1,20 @@
import { ExtensionsDirectory, QuickExportDefinition } from 'dbgate-types';
import getElectron from './getElectron';
export function createQuickExportMenuItems(
extensions: ExtensionsDirectory,
handler: (fmt: QuickExportDefinition) => Function
) {
const electron = getElectron();
if (!electron) {
return null;
}
return extensions.quickExports.map(fmt => ({
text: fmt.label,
onClick: handler(fmt),
}));
}
export default function createQuickExportMenu(
extensions: ExtensionsDirectory,
handler: (fmt: QuickExportDefinition) => Function
@@ -11,9 +25,6 @@ export default function createQuickExportMenu(
}
return {
text: 'Quick export',
submenu: extensions.quickExports.map(fmt => ({
text: fmt.label,
onClick: handler(fmt),
})),
submenu: createQuickExportMenuItems(extensions, handler),
};
}