mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-24 01:25:59 +00:00
quick export from table data grid toolstrip
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user