From d024b6f25cdfbb41a2c03a5b7cbd185cd2fd101f Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Fri, 24 Feb 2023 16:48:37 +0100 Subject: [PATCH] run macro on jsl data --- packages/datalib/src/runMacro.ts | 11 ++++- packages/web/src/datagrid/JslDataGrid.svelte | 13 +++++- .../web/src/datagrid/JslDataGridCore.svelte | 45 ++++++++++++++----- .../web/src/datagrid/TableDataGrid.svelte | 2 +- .../web/src/tabs/CollectionDataTab.svelte | 2 +- packages/web/src/widgets/StatusBar.svelte | 2 +- 6 files changed, 59 insertions(+), 16 deletions(-) diff --git a/packages/datalib/src/runMacro.ts b/packages/datalib/src/runMacro.ts index 19d70385..ebd7c298 100644 --- a/packages/datalib/src/runMacro.ts +++ b/packages/datalib/src/runMacro.ts @@ -214,7 +214,8 @@ export function runMacroOnChangeSet( macroArgs: {}, selectedCells: MacroSelectedCell[], changeSet: ChangeSet, - display: GridDisplay + display: GridDisplay, + useRowIndexInsteaOfCondition: boolean ): ChangeSet { const errors = []; const compiledMacroFunc = compileMacroFunction(macro, errors); @@ -222,7 +223,13 @@ export function runMacroOnChangeSet( let res = changeSet; for (const cell of selectedCells) { - const definition = display.getChangeSetField(cell.rowData, cell.column, undefined); + const definition = display.getChangeSetField( + cell.rowData, + cell.column, + undefined, + useRowIndexInsteaOfCondition ? cell.row : undefined, + useRowIndexInsteaOfCondition + ); const macroResult = runMacroOnValue( compiledMacroFunc, macroArgs, diff --git a/packages/web/src/datagrid/JslDataGrid.svelte b/packages/web/src/datagrid/JslDataGrid.svelte index a0fac397..e9f34fe9 100644 --- a/packages/web/src/datagrid/JslDataGrid.svelte +++ b/packages/web/src/datagrid/JslDataGrid.svelte @@ -1,5 +1,5 @@