fixed run macro for collections

This commit is contained in:
Jan Prochazka
2021-12-08 21:48:13 +01:00
parent fca00ed248
commit 826410e5ea
3 changed files with 14 additions and 2 deletions

View File

@@ -166,7 +166,7 @@
display, display,
macroPreview, macroPreview,
macroValues, macroValues,
selectedCellsPublished selectedCellsPublished()
); );
// $: console.log('GRIDER', grider); // $: console.log('GRIDER', grider);
// $: if (onChangeGrider) onChangeGrider(grider); // $: if (onChangeGrider) onChangeGrider(grider);
@@ -237,6 +237,7 @@
{dataPageAvailable} {dataPageAvailable}
{loadRowCount} {loadRowCount}
bind:loadedRows bind:loadedRows
bind:selectedCellsPublished
frameSelection={!!macroPreview} frameSelection={!!macroPreview}
{grider} {grider}
/> />

View File

@@ -188,7 +188,7 @@
<ReferenceManager {...$$props} {managerSize} /> <ReferenceManager {...$$props} {managerSize} />
</WidgetColumnBarItem> </WidgetColumnBarItem>
<WidgetColumnBarItem title="Macros" name="macros" show={showMacros} collapsed> <WidgetColumnBarItem title="Macros" name="macros" skip={!showMacros} collapsed>
<MacroManager {...$$props} {managerSize} /> <MacroManager {...$$props} {managerSize} />
</WidgetColumnBarItem> </WidgetColumnBarItem>
</WidgetColumnBar> </WidgetColumnBar>

View File

@@ -29,6 +29,7 @@
TableFormViewDisplay, TableFormViewDisplay,
CollectionGridDisplay, CollectionGridDisplay,
changeSetContainsChanges, changeSetContainsChanges,
runMacroOnChangeSet,
} from 'dbgate-datalib'; } from 'dbgate-datalib';
import { findEngineDriver } from 'dbgate-tools'; import { findEngineDriver } from 'dbgate-tools';
import { writable } from 'svelte/store'; import { writable } from 'svelte/store';
@@ -127,6 +128,13 @@
} }
} }
function handleRunMacro(macro, params, cells) {
const newChangeSet = runMacroOnChangeSet(macro, params, cells, $changeSetStore?.value, display);
if (newChangeSet) {
dispatchChangeSet({ type: 'set', value: newChangeSet });
}
}
registerMenu({ command: 'collectionTable.save', tag: 'save' }); registerMenu({ command: 'collectionTable.save', tag: 'save' });
const collapsedLeftColumnStore = writable(false); const collapsedLeftColumnStore = writable(false);
@@ -148,4 +156,7 @@
gridCoreComponent={CollectionDataGridCore} gridCoreComponent={CollectionDataGridCore}
jsonViewComponent={CollectionJsonView} jsonViewComponent={CollectionJsonView}
isDynamicStructure isDynamicStructure
showMacros
macroCondition={macro => macro.type == 'transformValue'}
onRunMacro={handleRunMacro}
/> />