mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
simplified flow of selectedCellsPublished
This commit is contained in:
parent
0413f4b4d9
commit
0548bae7af
@ -43,7 +43,7 @@
|
||||
|
||||
export let loadedRows;
|
||||
|
||||
let selectedCellsPublished = [];
|
||||
let selectedCellsPublished = () => [];
|
||||
|
||||
const selectedMacro = writable(null);
|
||||
setContext('selectedMacro', selectedMacro);
|
||||
@ -55,7 +55,7 @@
|
||||
$: isFormView = !!(formDisplay && formDisplay.config && formDisplay.config.isFormView);
|
||||
|
||||
const handleExecuteMacro = () => {
|
||||
onRunMacro($selectedMacro, extractMacroValuesForMacro($macroValues, $selectedMacro), selectedCellsPublished);
|
||||
onRunMacro($selectedMacro, extractMacroValuesForMacro($macroValues, $selectedMacro), selectedCellsPublished());
|
||||
$selectedMacro = null;
|
||||
|
||||
// const newChangeSet = runMacroOnChangeSet(
|
||||
@ -117,11 +117,10 @@
|
||||
this={gridCoreComponent}
|
||||
{...$$props}
|
||||
formViewAvailable={!!formViewComponent && !!formDisplay}
|
||||
onSelectionChanged={value => (selectedCellsPublished = value)}
|
||||
macroValues={extractMacroValuesForMacro($macroValues, $selectedMacro)}
|
||||
macroPreview={$selectedMacro}
|
||||
{selectedCellsPublished}
|
||||
bind:loadedRows
|
||||
bind:selectedCellsPublished
|
||||
/>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
|
@ -258,7 +258,7 @@
|
||||
export let allRowCount = undefined;
|
||||
export let onReferenceSourceChanged = undefined;
|
||||
export let onReferenceClick = undefined;
|
||||
export let onSelectionChanged = undefined;
|
||||
// export let onSelectedCellsPublishedChanged = undefined;
|
||||
export let onSave;
|
||||
export let focusOnVisible = false;
|
||||
export let onExportGrid = null;
|
||||
@ -271,6 +271,7 @@
|
||||
export let loadedTime;
|
||||
export let changeSetStore;
|
||||
export let isDynamicStructure = false;
|
||||
export let selectedCellsPublished = () => [];
|
||||
// export let generalAllowSave = false;
|
||||
|
||||
const wheelRowCount = 5;
|
||||
@ -575,8 +576,10 @@
|
||||
const stringified = stableStringify(selectedCells);
|
||||
if (lastPublishledSelectedCellsRef.get() != stringified) {
|
||||
lastPublishledSelectedCellsRef.set(stringified);
|
||||
if (onSelectionChanged) onSelectionChanged(getCellsPublished(selectedCells));
|
||||
$selectedCellsCallback = () => getCellsPublished(selectedCells);
|
||||
const cellsValue = () => getCellsPublished(selectedCells);
|
||||
selectedCellsPublished = cellsValue;
|
||||
$selectedCellsCallback = cellsValue;
|
||||
// if (onSelectedCellsPublishedChanged) onSelectedCellsPublishedChanged(getCellsPublished(selectedCells));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
export let grider;
|
||||
export let display;
|
||||
export let masterLoadedTime = undefined;
|
||||
export let selectedCellsPublished;
|
||||
|
||||
// export let griderFactory;
|
||||
|
||||
export let loadedRows = [];
|
||||
@ -120,4 +122,5 @@
|
||||
{allRowCount}
|
||||
{isLoadedAll}
|
||||
{loadedTime}
|
||||
bind:selectedCellsPublished
|
||||
/>
|
||||
|
@ -68,7 +68,7 @@
|
||||
|
||||
export let macroPreview;
|
||||
export let macroValues;
|
||||
export let selectedCellsPublished;
|
||||
export let selectedCellsPublished = () => [];
|
||||
|
||||
// export let onChangeGrider = undefined;
|
||||
|
||||
@ -82,7 +82,7 @@
|
||||
display,
|
||||
macroPreview,
|
||||
macroValues,
|
||||
selectedCellsPublished
|
||||
selectedCellsPublished()
|
||||
);
|
||||
// $: console.log('GRIDER', grider);
|
||||
// $: if (onChangeGrider) onChangeGrider(grider);
|
||||
@ -177,6 +177,7 @@
|
||||
onOpenQuery={openQuery}
|
||||
onOpenActiveChart={openActiveChart}
|
||||
bind:loadedRows
|
||||
bind:selectedCellsPublished
|
||||
frameSelection={!!macroPreview}
|
||||
{grider}
|
||||
onSave={handleSave}
|
||||
|
@ -21,7 +21,7 @@
|
||||
const cache = writable(createGridCache());
|
||||
|
||||
$: grider = macroPreview
|
||||
? new MacroPreviewGrider(modelState.value, macroPreview, macroValues, selectedCellsPublished)
|
||||
? new MacroPreviewGrider(modelState.value, macroPreview, macroValues, selectedCellsPublished())
|
||||
: new FreeTableGrider(modelState, dispatchModel);
|
||||
$: display = new FreeTableGridDisplay(grider.model || modelState.value, config, setConfig, $cache, cache.update);
|
||||
|
||||
@ -36,4 +36,12 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<DataGridCore {...$$props} {grider} {display} frameSelection={!!macroPreview} {exportGrid} onExportGrid={exportGrid} />
|
||||
<DataGridCore
|
||||
{...$$props}
|
||||
{grider}
|
||||
{display}
|
||||
frameSelection={!!macroPreview}
|
||||
{exportGrid}
|
||||
onExportGrid={exportGrid}
|
||||
bind:selectedCellsPublished
|
||||
/>
|
||||
|
@ -4,7 +4,6 @@
|
||||
import ErrorInfo from '../elements/ErrorInfo.svelte';
|
||||
import LoadingInfo from '../elements/LoadingInfo.svelte';
|
||||
|
||||
import FreeTableGrid from '../freetable/FreeTableGrid.svelte';
|
||||
import FreeTableGridCore from '../freetable/FreeTableGridCore.svelte';
|
||||
import { showModal } from '../modals/modalTools';
|
||||
import SaveArchiveModal from '../modals/SaveArchiveModal.svelte';
|
||||
|
Loading…
Reference in New Issue
Block a user