feat(grid): support selecting multiple fields for sorting
This commit is contained in:
1 parent
c840206b25
commit
a1e2d39ed3
37 files changed
+2033
-48
No files matched your search
@@ -103,6 +103,7 @@ import { replaceSqlServerLeadingUseQuery, sqlServerLeadingUseScript, switchesDat
|
||||
import { classifySqlRisk } from "@/lib/sql/sqlRisk";
|
||||
import { externalSqlFileDisplayTitles, normalizeExternalSqlPath } from "@/lib/sql/sqlFileOpen";
|
||||
import { clearDataGridPendingSnapshot, clearDataGridPendingSnapshotsForTab } from "@/composables/useDataGridEditor";
|
||||
import { combineDataGridOrderByInputs } from "@/composables/useDataGridSortBuilder";
|
||||
import { beginClosingDataGridViewSnapshotsForTab, clearDataGridViewSnapshot, clearDataGridViewSnapshotsForTab } from "@/lib/dataGrid/dataGridViewStateCache";
|
||||
import { beginClosingBrowserState } from "@/lib/tabs/documentBrowserStateCache";
|
||||
import { clearDataGridStructuredFilterStatesForTab } from "@/lib/dataGrid/dataGridFilterBuilderPersistence";
|
||||
@@ -1776,6 +1777,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
tab.resultLocalSortOriginalMongoDocuments = undefined;
|
||||
tab.resultLocalSortOriginalMongoCopyDocuments = undefined;
|
||||
tab.orderByInput = undefined;
|
||||
tab.structuredOrderByInput = undefined;
|
||||
tab.resultPageSql = undefined;
|
||||
tab.resultPageLimit = undefined;
|
||||
tab.resultPageOffset = undefined;
|
||||
@@ -2597,6 +2599,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
resultSortDirection: t.resultSortDirection,
|
||||
resultSortMode: t.resultSortMode,
|
||||
orderByInput: t.orderByInput,
|
||||
structuredOrderByInput: t.structuredOrderByInput,
|
||||
whereInput: t.whereInput,
|
||||
pinned: t.pinned,
|
||||
mode: t.mode,
|
||||
@@ -4660,6 +4663,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
resultLocalSortOriginalMongoDocuments: undefined,
|
||||
resultLocalSortOriginalMongoCopyDocuments: undefined,
|
||||
orderByInput: original.mode === "data" ? original.orderByInput : undefined,
|
||||
structuredOrderByInput: original.mode === "data" ? original.structuredOrderByInput : undefined,
|
||||
resultPageSql: undefined,
|
||||
resultPageLimit: original.mode === "data" ? original.resultPageLimit : undefined,
|
||||
resultPageOffset: original.mode === "data" ? original.resultPageOffset : undefined,
|
||||
@@ -4890,7 +4894,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
clearInvalidDataTabSortState(tab, tableMeta.columns);
|
||||
const primaryKeys = tab.tableMeta ? tab.tableMeta.primaryKeys : tableMeta.primaryKeys;
|
||||
const sortOrder = tab.resultSortColumn && tab.resultSortDirection ? `${quoteTableDataIdentifier(effectiveDbType, tab.resultSortColumn, identifierQuote)} ${tab.resultSortDirection.toUpperCase()}` : undefined;
|
||||
const orderBy = tab.orderByInput?.trim() || sortOrder;
|
||||
const orderBy = combineDataGridOrderByInputs(tab.orderByInput, tab.structuredOrderByInput) || sortOrder;
|
||||
const limit = tab.resultPageLimit ?? tableOpenPageLimit(settingsStore.editorSettings.tableOpenPageSize);
|
||||
const offset = tab.resultPageOffset ?? 0;
|
||||
const useDriverRowOffset = jdbcConnectionUsesDriverRowOffset(conn, effectiveDbType);
|
||||
@@ -5638,7 +5642,11 @@ export const useQueryStore = defineStore("query", () => {
|
||||
tab.orderByInput,
|
||||
columns.map((column) => column.name),
|
||||
);
|
||||
if (!structuredSortMissing && !simpleOrderMissing) return false;
|
||||
const structuredOrderMissing = simpleDataGridOrderByReferencesMissingColumn(
|
||||
tab.structuredOrderByInput,
|
||||
columns.map((column) => column.name),
|
||||
);
|
||||
if (!structuredSortMissing && !simpleOrderMissing && !structuredOrderMissing) return false;
|
||||
if (structuredSortMissing) {
|
||||
tab.resultSortColumn = undefined;
|
||||
tab.resultSortColumnIndex = undefined;
|
||||
@@ -5651,6 +5659,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
tab.resultLocalSortOriginalMongoCopyDocuments = undefined;
|
||||
}
|
||||
if (simpleOrderMissing) tab.orderByInput = undefined;
|
||||
if (structuredOrderMissing) tab.structuredOrderByInput = undefined;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -9037,7 +9046,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
const identifierQuote = connStore.connectionIdentifierQuote?.(tab.connectionId);
|
||||
const primaryKeys = tab.tableMeta ? tab.tableMeta.primaryKeys : tableMeta.primaryKeys;
|
||||
const sortOrder = tab.resultSortColumn && tab.resultSortDirection ? `${quoteTableDataIdentifier(effectiveDbType, tab.resultSortColumn, identifierQuote)} ${tab.resultSortDirection.toUpperCase()}` : undefined;
|
||||
const orderBy = tab.orderByInput?.trim() || sortOrder;
|
||||
const orderBy = combineDataGridOrderByInputs(tab.orderByInput, tab.structuredOrderByInput) || sortOrder;
|
||||
const queryTimeoutSecs = queryTimeoutSecsForConnection(conn, settingsStore.editorSettings.globalQueryTimeoutSecs);
|
||||
const executionDatabase = tab.database;
|
||||
const rows: QueryResult["rows"] = [];
|
||||
|
||||
Reference in new issue
Block a user