disabled some menu items

This commit is contained in:
SPRINX0\prochazka
2024-09-02 14:05:40 +02:00
parent 50583f928a
commit 31162ef175
2 changed files with 14 additions and 5 deletions

View File

@@ -36,7 +36,7 @@
category: 'Data grid',
name: 'Toggle left panel',
keyText: 'CtrlOrCommand+L',
testEnabled: () => getCurrentEditor() != null,
testEnabled: () => getCurrentEditor()?.canShowLeftPanel(),
onClick: () => getCurrentEditor().toggleLeftPanel(),
});
@@ -139,6 +139,10 @@
}
}
export function canShowLeftPanel() {
return !hideGridLeftColumn;
}
export function toggleLeftPanel() {
collapsedLeftColumnStore.update(x => !x);
}
@@ -147,7 +151,7 @@
{ command: 'dataGrid.switchToForm', tag: 'switch', hideDisabled: true },
{ command: 'dataGrid.switchToTable', tag: 'switch', hideDisabled: true },
{ command: 'dataGrid.switchToJson', tag: 'switch', hideDisabled: true },
{ command: 'dataGrid.toggleLeftPanel', tag: 'switch' }
{ command: 'dataGrid.toggleLeftPanel', tag: 'switch', hideDisabled: true }
);
$: if (managerSize) setLocalStorage('dataGridManagerWidth', managerSize);

View File

@@ -236,7 +236,7 @@
category: 'Data grid',
name: 'Hide column',
keyText: isMac() ? 'Alt+Command+F' : 'CtrlOrCommand+H',
testEnabled: () => getCurrentDataGrid() != null,
testEnabled: () => getCurrentDataGrid()?.canShowLeftPanel(),
onClick: () => getCurrentDataGrid().hideColumn(),
});
@@ -452,7 +452,6 @@
export let schemaName = undefined;
export let allowDefineVirtualReferences = false;
export let formatterFunction;
export let hideGridLeftColumn;
export let isLoadedAll;
export let loadedTime;
@@ -466,6 +465,7 @@
export let onOpenQuery = null;
export let jslid;
// export let generalAllowSave = false;
export let hideGridLeftColumn = false;
export const activator = createActivator('DataGridCore', false);
@@ -1037,6 +1037,11 @@
}
}
export function canShowLeftPanel() {
return !hideGridLeftColumn;
}
$: autofillMarkerCell =
selectedCells && selectedCells.length > 0 && _.uniq(selectedCells.map(x => x[0])).length == 1
? [_.max(selectedCells.map(x => x[0])), _.max(selectedCells.map(x => x[1]))]
@@ -1755,7 +1760,7 @@
{ placeTag: 'edit' },
{ divider: true },
{ command: 'dataGrid.findColumn' },
{ command: 'dataGrid.hideColumn' },
{ command: 'dataGrid.hideColumn', hideDisabled: true },
{ command: 'dataGrid.filterSelected' },
{ command: 'dataGrid.clearFilter' },
{ command: 'dataGrid.addNewColumn', hideDisabled: true },