From bcc1f91352716134501124016cbfcc8e3a85de48 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Wed, 7 Apr 2021 21:41:10 +0200 Subject: [PATCH] datagrid menu refactor --- packages/web/src/datagrid/DataGridCore.svelte | 25 +++---------------- .../web/src/datagrid/SqlDataGridCore.svelte | 17 +++++++++++-- packages/web/src/modals/DropDownMenu.svelte | 5 +++- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/packages/web/src/datagrid/DataGridCore.svelte b/packages/web/src/datagrid/DataGridCore.svelte index 03bd99f90..97c81968b 100644 --- a/packages/web/src/datagrid/DataGridCore.svelte +++ b/packages/web/src/datagrid/DataGridCore.svelte @@ -185,14 +185,6 @@ onClick: () => getCurrentDataGrid().openChartFromSelection(), }); - registerCommand({ - id: 'dataGrid.openActiveChart', - category: 'Data grid', - name: 'Open active chart', - testEnabled: () => getCurrentDataGrid()?.openActiveChartEnabled(), - onClick: () => getCurrentDataGrid().openActiveChart(), - }); - function getRowCountInfo(selectedCells, grider, realColumnUniqueNames, selectedRowData, allRowCount) { if (selectedCells.length > 1 && selectedCells.every(x => _.isNumber(x[0]) && _.isNumber(x[1]))) { let sum = _.sumBy(selectedCells, cell => { @@ -273,7 +265,6 @@ export let focusOnVisible = false; export let onExportGrid = null; export let onOpenQuery = null; - export let onOpenActiveChart = null; export let formViewAvailable = false; export let jsonViewAvailable = false; export let errorMessage = undefined; @@ -466,14 +457,6 @@ return onOpenQuery != null; } - export function openActiveChart() { - if (onOpenActiveChart) onOpenActiveChart(); - } - - export function openActiveChartEnabled() { - return onOpenActiveChart != null; - } - export function openFreeTable() { openNewTab( { @@ -1037,9 +1020,9 @@ { command: 'dataGrid.refresh' }, { command: 'dataGrid.copyToClipboard' }, { command: 'dataGrid.export' }, - { command: 'dataGrid.switchToForm' }, - { command: 'dataGrid.switchToJson' }, - { command: 'dataGrid.editJsonDocument' }, + { command: 'dataGrid.switchToForm', hideDisabled: true }, + { command: 'dataGrid.switchToJson', hideDisabled: true }, + { command: 'dataGrid.editJsonDocument', hideDisabled: true }, { divider: true }, { command: 'dataGrid.save' }, { command: 'dataGrid.revertRowChanges' }, @@ -1056,7 +1039,7 @@ { command: 'dataGrid.openQuery' }, { command: 'dataGrid.openFreeTable' }, { command: 'dataGrid.openChartFromSelection' }, - { command: 'dataGrid.openActiveChart' }, + { command: 'dataGrid.openActiveChart', hideDisabled: true }, ]; } diff --git a/packages/web/src/datagrid/SqlDataGridCore.svelte b/packages/web/src/datagrid/SqlDataGridCore.svelte index 26fce1932..dd7fc091e 100644 --- a/packages/web/src/datagrid/SqlDataGridCore.svelte +++ b/packages/web/src/datagrid/SqlDataGridCore.svelte @@ -1,4 +1,14 @@