collection toolstrip

This commit is contained in:
Jan Prochazka 2022-02-17 15:13:49 +01:00
parent 108a49b3e8
commit 96136fe443
3 changed files with 38 additions and 19 deletions

View File

@ -15,6 +15,7 @@
id: 'dataGrid.switchToJson', id: 'dataGrid.switchToJson',
category: 'Data grid', category: 'Data grid',
name: 'Switch to JSON', name: 'Switch to JSON',
icon: 'icon json',
keyText: 'F4', keyText: 'F4',
testEnabled: () => getCurrentEditor()?.switchViewEnabled('json'), testEnabled: () => getCurrentEditor()?.switchViewEnabled('json'),
onClick: () => getCurrentEditor().switchToView('json'), onClick: () => getCurrentEditor().switchToView('json'),

View File

@ -92,6 +92,7 @@
'icon dots-horizontal': 'mdi mdi-dots-horizontal', 'icon dots-horizontal': 'mdi mdi-dots-horizontal',
'icon dots-vertical': 'mdi mdi-dots-vertical', 'icon dots-vertical': 'mdi mdi-dots-vertical',
'icon add': 'mdi mdi-plus-circle', 'icon add': 'mdi mdi-plus-circle',
'icon json': 'mdi mdi-code-json',
'icon run': 'mdi mdi-play', 'icon run': 'mdi mdi-play',
'icon chevron-down': 'mdi mdi-chevron-down', 'icon chevron-down': 'mdi mdi-chevron-down',

View File

@ -51,6 +51,9 @@
import _ from 'lodash'; import _ from 'lodash';
import { apiCall } from '../utility/api'; import { apiCall } from '../utility/api';
import { getLocalStorage, setLocalStorage } from '../utility/storageCache'; import { getLocalStorage, setLocalStorage } from '../utility/storageCache';
import ToolStripContainer from '../buttons/ToolStripContainer.svelte';
import ToolStripCommandButton from '../buttons/ToolStripCommandButton.svelte';
import ToolStripExportButton, { createQuickExportHandlerRef } from '../buttons/ToolStripExportButton.svelte';
export let tabid; export let tabid;
export let conid; export let conid;
@ -137,24 +140,38 @@
const collapsedLeftColumnStore = writable(getLocalStorage('collection_collapsedLeftColumn', false)); const collapsedLeftColumnStore = writable(getLocalStorage('collection_collapsedLeftColumn', false));
setContext('collapsedLeftColumnStore', collapsedLeftColumnStore); setContext('collapsedLeftColumnStore', collapsedLeftColumnStore);
$: setLocalStorage('collection_collapsedLeftColumn', $collapsedLeftColumnStore); $: setLocalStorage('collection_collapsedLeftColumn', $collapsedLeftColumnStore);
const quickExportHandlerRef = createQuickExportHandlerRef();
</script> </script>
<DataGrid <ToolStripContainer>
bind:loadedRows <DataGrid
{...$$props} bind:loadedRows
config={$config} {...$$props}
setConfig={config.update} config={$config}
cache={$cache} setConfig={config.update}
setCache={cache.update} cache={$cache}
changeSetState={$changeSetStore} setCache={cache.update}
focusOnVisible changeSetState={$changeSetStore}
{display} focusOnVisible
{changeSetStore} {display}
{dispatchChangeSet} {changeSetStore}
gridCoreComponent={CollectionDataGridCore} {dispatchChangeSet}
jsonViewComponent={CollectionJsonView} gridCoreComponent={CollectionDataGridCore}
isDynamicStructure jsonViewComponent={CollectionJsonView}
showMacros isDynamicStructure
macroCondition={macro => macro.type == 'transformValue'} showMacros
onRunMacro={handleRunMacro} macroCondition={macro => macro.type == 'transformValue'}
/> onRunMacro={handleRunMacro}
/>
<svelte:fragment slot="toolstrip">
<ToolStripCommandButton command="dataGrid.refresh" hideDisabled />
<ToolStripCommandButton command="dataForm.refresh" hideDisabled />
<ToolStripCommandButton command="collectionTable.save" />
<ToolStripCommandButton command="dataGrid.insertNewRow" hideDisabled />
<ToolStripCommandButton command="dataGrid.deleteSelectedRows" hideDisabled />
<ToolStripCommandButton command="dataGrid.switchToJson" hideDisabled />
<ToolStripCommandButton command="dataGrid.switchToTable" hideDisabled />
<ToolStripExportButton {quickExportHandlerRef} />
</svelte:fragment>
</ToolStripContainer>