show selected columns in column manager

This commit is contained in:
Jan Prochazka
2021-12-30 21:45:14 +01:00
parent 69b1cdc964
commit dae7e38179
3 changed files with 14 additions and 2 deletions

View File

@@ -82,6 +82,11 @@
function copyToClipboard() {
copyTextToClipboard(selectedColumns.join('\r\n'));
}
export function setSelectedColumns(value) {
selectedColumns = value;
if (value.length > 0) currentColumnUniqueName = value[0];
}
</script>
<SearchBoxWrapper>

View File

@@ -93,6 +93,7 @@
export const activator = createActivator('DataGrid', false);
let selectedCellsPublished = () => [];
let domColumnManager;
const selectedMacro = writable(null);
setContext('selectedMacro', selectedMacro);
@@ -169,7 +170,7 @@
height="45%"
show={(!freeTableColumn || isDynamicStructure) && !isFormView}
>
<ColumnManager {...$$props} {managerSize} {isJsonView} {isDynamicStructure} />
<ColumnManager {...$$props} {managerSize} {isJsonView} {isDynamicStructure} bind:this={domColumnManager} />
</WidgetColumnBarItem>
<WidgetColumnBarItem
@@ -226,6 +227,9 @@
macroPreview={$selectedMacro}
bind:loadedRows
bind:selectedCellsPublished
onChangeSelectedColumns={cols => {
if (domColumnManager) domColumnManager.setSelectedColumns(cols);
}}
/>
{/if}
</svelte:fragment>

View File

@@ -284,7 +284,7 @@
import { findCommand } from '../commands/runCommand';
import { openJsonDocument } from '../tabs/JsonTab.svelte';
import EditJsonModal from '../modals/EditJsonModal.svelte';
import { apiCall } from '../utility/api';
import { apiCall } from '../utility/api';
export let onLoadNextData = undefined;
export let grider = undefined;
@@ -296,6 +296,7 @@ import { apiCall } from '../utility/api';
export let allRowCount = undefined;
export let onReferenceSourceChanged = undefined;
export let onReferenceClick = undefined;
export let onChangeSelectedColumns = undefined;
// export let onSelectedCellsPublishedChanged = undefined;
export let focusOnVisible = false;
export let formViewAvailable = false;
@@ -787,6 +788,8 @@ import { apiCall } from '../utility/api';
const cellsValue = () => getCellsPublished(selectedCells);
selectedCellsPublished = cellsValue;
$selectedCellsCallback = cellsValue;
if (onChangeSelectedColumns) onChangeSelectedColumns(getSelectedColumns().map(x => x.columnName));
// if (onSelectedCellsPublishedChanged) onSelectedCellsPublishedChanged(getCellsPublished(selectedCells));
}
}