mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 19:03:58 +00:00
Merge branch 'selected-cells-refactor' into develop
This commit is contained in:
@@ -135,12 +135,13 @@
|
|||||||
|
|
||||||
export let macroPreview;
|
export let macroPreview;
|
||||||
export let macroValues;
|
export let macroValues;
|
||||||
export let selectedCellsPublished;
|
|
||||||
export let setLoadedRows = null;
|
export let setLoadedRows = null;
|
||||||
|
export let onPublishedCellsChanged;
|
||||||
|
|
||||||
// export let onChangeGrider = undefined;
|
// export let onChangeGrider = undefined;
|
||||||
|
|
||||||
let loadedRows = [];
|
let loadedRows = [];
|
||||||
|
let publishedCells = [];
|
||||||
|
|
||||||
export const activator = createActivator('CollectionDataGridCore', false);
|
export const activator = createActivator('CollectionDataGridCore', false);
|
||||||
|
|
||||||
@@ -152,7 +153,7 @@
|
|||||||
display,
|
display,
|
||||||
macroPreview,
|
macroPreview,
|
||||||
macroValues,
|
macroValues,
|
||||||
selectedCellsPublished()
|
publishedCells
|
||||||
);
|
);
|
||||||
// $: console.log('GRIDER', grider);
|
// $: console.log('GRIDER', grider);
|
||||||
// $: if (onChangeGrider) onChangeGrider(grider);
|
// $: if (onChangeGrider) onChangeGrider(grider);
|
||||||
@@ -239,7 +240,12 @@
|
|||||||
{dataPageAvailable}
|
{dataPageAvailable}
|
||||||
{loadRowCount}
|
{loadRowCount}
|
||||||
setLoadedRows={handleSetLoadedRows}
|
setLoadedRows={handleSetLoadedRows}
|
||||||
bind:selectedCellsPublished
|
onPublishedCellsChanged={value => {
|
||||||
|
publishedCells = value;
|
||||||
|
if (onPublishedCellsChanged) {
|
||||||
|
onPublishedCellsChanged(value);
|
||||||
|
}
|
||||||
|
}}
|
||||||
frameSelection={!!macroPreview}
|
frameSelection={!!macroPreview}
|
||||||
onOpenQuery={openQuery}
|
onOpenQuery={openQuery}
|
||||||
{grider}
|
{grider}
|
||||||
|
|||||||
@@ -91,11 +91,13 @@
|
|||||||
export let setLoadedRows = null;
|
export let setLoadedRows = null;
|
||||||
export let hideGridLeftColumn = false;
|
export let hideGridLeftColumn = false;
|
||||||
|
|
||||||
|
export let onPublishedCellsChanged;
|
||||||
|
|
||||||
let loadedRows;
|
let loadedRows;
|
||||||
|
let publishedCells = [];
|
||||||
|
|
||||||
export const activator = createActivator('DataGrid', false);
|
export const activator = createActivator('DataGrid', false);
|
||||||
|
|
||||||
export let selectedCellsPublished = () => [];
|
|
||||||
let domColumnManager;
|
let domColumnManager;
|
||||||
|
|
||||||
const selectedMacro = writable(null);
|
const selectedMacro = writable(null);
|
||||||
@@ -111,7 +113,7 @@
|
|||||||
$: isJsonView = !!config?.isJsonView;
|
$: isJsonView = !!config?.isJsonView;
|
||||||
|
|
||||||
const handleExecuteMacro = () => {
|
const handleExecuteMacro = () => {
|
||||||
onRunMacro($selectedMacro, extractMacroValuesForMacro($macroValues, $selectedMacro), selectedCellsPublished());
|
onRunMacro($selectedMacro, extractMacroValuesForMacro($macroValues, $selectedMacro), publishedCells);
|
||||||
$selectedMacro = null;
|
$selectedMacro = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -123,7 +125,7 @@
|
|||||||
|
|
||||||
export function switchToView(view) {
|
export function switchToView(view) {
|
||||||
if (view == 'form') {
|
if (view == 'form') {
|
||||||
display.switchToFormView(selectedCellsPublished()[0]?.row);
|
display.switchToFormView(publishedCells[0]?.row);
|
||||||
}
|
}
|
||||||
if (view == 'table') {
|
if (view == 'table') {
|
||||||
setConfig(cfg => ({
|
setConfig(cfg => ({
|
||||||
@@ -220,7 +222,12 @@
|
|||||||
macroValues={extractMacroValuesForMacro($macroValues, $selectedMacro)}
|
macroValues={extractMacroValuesForMacro($macroValues, $selectedMacro)}
|
||||||
macroPreview={$selectedMacro}
|
macroPreview={$selectedMacro}
|
||||||
{setLoadedRows}
|
{setLoadedRows}
|
||||||
bind:selectedCellsPublished
|
onPublishedCellsChanged={value => {
|
||||||
|
publishedCells = value;
|
||||||
|
if (onPublishedCellsChanged) {
|
||||||
|
onPublishedCellsChanged(value);
|
||||||
|
}
|
||||||
|
}}
|
||||||
onChangeSelectedColumns={cols => {
|
onChangeSelectedColumns={cols => {
|
||||||
if (domColumnManager) domColumnManager.setSelectedColumns(cols);
|
if (domColumnManager) domColumnManager.setSelectedColumns(cols);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -411,6 +411,7 @@
|
|||||||
export let isLoading = false;
|
export let isLoading = false;
|
||||||
export let allRowCount = undefined;
|
export let allRowCount = undefined;
|
||||||
export let onReferenceSourceChanged = undefined;
|
export let onReferenceSourceChanged = undefined;
|
||||||
|
export let onPublishedCellsChanged = undefined;
|
||||||
export let onReferenceClick = undefined;
|
export let onReferenceClick = undefined;
|
||||||
export let onChangeSelectedColumns = undefined;
|
export let onChangeSelectedColumns = undefined;
|
||||||
// export let onSelectedCellsPublishedChanged = undefined;
|
// export let onSelectedCellsPublishedChanged = undefined;
|
||||||
@@ -427,7 +428,7 @@
|
|||||||
export let loadedTime;
|
export let loadedTime;
|
||||||
export let changeSetStore;
|
export let changeSetStore;
|
||||||
export let isDynamicStructure = false;
|
export let isDynamicStructure = false;
|
||||||
export let selectedCellsPublished = () => [];
|
// export let selectedCellsPublished = () => [];
|
||||||
export let collapsedLeftColumnStore;
|
export let collapsedLeftColumnStore;
|
||||||
export let multipleGridsOnTab = false;
|
export let multipleGridsOnTab = false;
|
||||||
export let tabControlHiddenTab = false;
|
export let tabControlHiddenTab = false;
|
||||||
@@ -1077,15 +1078,31 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const lastPublishledSelectedCellsRef = createRef('');
|
const lastPublishledSelectedCellsRef = createRef('');
|
||||||
|
const changeSetValueRef = createRef(null);
|
||||||
$: {
|
$: {
|
||||||
const stringified = stableStringify(selectedCells);
|
const stringified = stableStringify(selectedCells);
|
||||||
if (lastPublishledSelectedCellsRef.get() != stringified) {
|
if (
|
||||||
lastPublishledSelectedCellsRef.set(stringified);
|
(lastPublishledSelectedCellsRef.get() != stringified || changeSetValueRef.get() != $changeSetStore.value) &&
|
||||||
const cellsValue = () => getCellsPublished(selectedCells);
|
realColumnUniqueNames?.length > 0
|
||||||
selectedCellsPublished = cellsValue;
|
) {
|
||||||
$selectedCellsCallback = cellsValue;
|
const rowIndexes = _.uniq(selectedCells.map(x => x[0]));
|
||||||
|
if (rowIndexes.every(x => grider.getRowData(x))) {
|
||||||
|
tick().then(() => {
|
||||||
|
lastPublishledSelectedCellsRef.set(stringified);
|
||||||
|
const cellsValue = () => getCellsPublished(selectedCells);
|
||||||
|
changeSetValueRef.set($changeSetStore.value);
|
||||||
|
// selectedCellsPublished = cellsValue;
|
||||||
|
$selectedCellsCallback = cellsValue;
|
||||||
|
|
||||||
if (onChangeSelectedColumns) onChangeSelectedColumns(getSelectedColumns().map(x => x.columnName));
|
if (onChangeSelectedColumns) {
|
||||||
|
onChangeSelectedColumns(getSelectedColumns().map(x => x.columnName));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onPublishedCellsChanged) {
|
||||||
|
onPublishedCellsChanged(getCellsPublished(selectedCells));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
// if (onSelectedCellsPublishedChanged) onSelectedCellsPublishedChanged(getCellsPublished(selectedCells));
|
// if (onSelectedCellsPublishedChanged) onSelectedCellsPublishedChanged(getCellsPublished(selectedCells));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,11 +69,13 @@
|
|||||||
|
|
||||||
export let macroPreview;
|
export let macroPreview;
|
||||||
export let macroValues;
|
export let macroValues;
|
||||||
export let selectedCellsPublished = () => [];
|
export let onPublishedCellsChanged
|
||||||
export const activator = createActivator('JslDataGridCore', false);
|
export const activator = createActivator('JslDataGridCore', false);
|
||||||
|
|
||||||
export let setLoadedRows;
|
export let setLoadedRows;
|
||||||
|
|
||||||
|
let publishedCells = [];
|
||||||
|
|
||||||
let loadedRows = [];
|
let loadedRows = [];
|
||||||
let domGrid;
|
let domGrid;
|
||||||
|
|
||||||
@@ -113,7 +115,7 @@
|
|||||||
display,
|
display,
|
||||||
macroPreview,
|
macroPreview,
|
||||||
macroValues,
|
macroValues,
|
||||||
selectedCellsPublished(),
|
publishedCells,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -199,7 +201,12 @@
|
|||||||
bind:this={domGrid}
|
bind:this={domGrid}
|
||||||
{...$$props}
|
{...$$props}
|
||||||
setLoadedRows={handleSetLoadedRows}
|
setLoadedRows={handleSetLoadedRows}
|
||||||
bind:selectedCellsPublished
|
onPublishedCellsChanged={value => {
|
||||||
|
publishedCells = value;
|
||||||
|
if (onPublishedCellsChanged) {
|
||||||
|
onPublishedCellsChanged(value);
|
||||||
|
}
|
||||||
|
}}
|
||||||
{loadDataPage}
|
{loadDataPage}
|
||||||
{dataPageAvailable}
|
{dataPageAvailable}
|
||||||
{loadRowCount}
|
{loadRowCount}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
export let grider;
|
export let grider;
|
||||||
export let display;
|
export let display;
|
||||||
export let masterLoadedTime = undefined;
|
export let masterLoadedTime = undefined;
|
||||||
export let selectedCellsPublished;
|
|
||||||
export let rowCountLoaded = null;
|
export let rowCountLoaded = null;
|
||||||
|
|
||||||
export let preprocessLoadedRow = null;
|
export let preprocessLoadedRow = null;
|
||||||
@@ -128,7 +127,6 @@
|
|||||||
<DataGridCore
|
<DataGridCore
|
||||||
{...$$props}
|
{...$$props}
|
||||||
bind:this={domGrid}
|
bind:this={domGrid}
|
||||||
bind:selectedCellsPublished
|
|
||||||
onLoadNextData={handleLoadNextData}
|
onLoadNextData={handleLoadNextData}
|
||||||
{errorMessage}
|
{errorMessage}
|
||||||
{isLoading}
|
{isLoading}
|
||||||
|
|||||||
@@ -95,7 +95,9 @@
|
|||||||
|
|
||||||
export let macroPreview;
|
export let macroPreview;
|
||||||
export let macroValues;
|
export let macroValues;
|
||||||
export let selectedCellsPublished = () => [];
|
export let onPublishedCellsChanged;
|
||||||
|
|
||||||
|
let publishedCells = [];
|
||||||
|
|
||||||
// export let onChangeGrider = undefined;
|
// export let onChangeGrider = undefined;
|
||||||
|
|
||||||
@@ -116,7 +118,7 @@
|
|||||||
display,
|
display,
|
||||||
macroPreview,
|
macroPreview,
|
||||||
macroValues,
|
macroValues,
|
||||||
selectedCellsPublished()
|
publishedCells
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,7 +226,12 @@
|
|||||||
{dataPageAvailable}
|
{dataPageAvailable}
|
||||||
{loadRowCount}
|
{loadRowCount}
|
||||||
setLoadedRows={handleSetLoadedRows}
|
setLoadedRows={handleSetLoadedRows}
|
||||||
bind:selectedCellsPublished
|
onPublishedCellsChanged={value => {
|
||||||
|
publishedCells = value;
|
||||||
|
if (onPublishedCellsChanged) {
|
||||||
|
onPublishedCellsChanged(value);
|
||||||
|
}
|
||||||
|
}}
|
||||||
frameSelection={!!macroPreview}
|
frameSelection={!!macroPreview}
|
||||||
{grider}
|
{grider}
|
||||||
{display}
|
{display}
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
export let cache;
|
export let cache;
|
||||||
export let setCache;
|
export let setCache;
|
||||||
export let multipleGridsOnTab = false;
|
export let multipleGridsOnTab = false;
|
||||||
export let selectedCellsPublished = () => [];
|
|
||||||
|
|
||||||
$: connection = useConnectionInfo({ conid });
|
$: connection = useConnectionInfo({ conid });
|
||||||
$: dbinfo = useDatabaseInfo({ conid, database });
|
$: dbinfo = useDatabaseInfo({ conid, database });
|
||||||
@@ -173,7 +172,6 @@
|
|||||||
}
|
}
|
||||||
setChildConfig(createGridConfig(), value);
|
setChildConfig(createGridConfig(), value);
|
||||||
}}
|
}}
|
||||||
bind:selectedCellsPublished
|
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<div slot="2" class="reference-container">
|
<div slot="2" class="reference-container">
|
||||||
|
|||||||
Reference in New Issue
Block a user