mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 18:16:00 +00:00
Merge branch 'master' into tableeditor2
This commit is contained in:
@@ -51,11 +51,11 @@
|
||||
}
|
||||
|
||||
:global(.theme-type-dark) .inner {
|
||||
--json-tree-string-color: #efc5c5;
|
||||
--json-tree-symbol-color: #efc5c5;
|
||||
--json-tree-boolean-color: #a6b3f5;
|
||||
--json-tree-function-color: #a6b3f5;
|
||||
--json-tree-number-color: #bfbdf2;
|
||||
--json-tree-string-color: #ffc5c5;
|
||||
--json-tree-symbol-color: #ffc5c5;
|
||||
--json-tree-boolean-color: #b6c3ff;
|
||||
--json-tree-function-color: #b6c3ff;
|
||||
--json-tree-number-color: #bfbdff;
|
||||
--json-tree-label-color: #e9aaed;
|
||||
--json-tree-arrow-color: #d4d4d4;
|
||||
--json-tree-null-color: #dcdcdc;
|
||||
|
||||
@@ -171,7 +171,6 @@
|
||||
if (_.isPlainObject(value) || _.isArray(value)) return JSON.stringify(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -666,43 +665,52 @@
|
||||
|
||||
function handleGridWheel(event) {
|
||||
if (event.shiftKey) {
|
||||
let newFirstVisibleColumnScrollIndex = firstVisibleColumnScrollIndex;
|
||||
if (event.deltaY > 0) {
|
||||
newFirstVisibleColumnScrollIndex++;
|
||||
}
|
||||
if (event.deltaY < 0) {
|
||||
newFirstVisibleColumnScrollIndex--;
|
||||
}
|
||||
if (newFirstVisibleColumnScrollIndex > maxScrollColumn) {
|
||||
newFirstVisibleColumnScrollIndex = maxScrollColumn;
|
||||
}
|
||||
if (newFirstVisibleColumnScrollIndex < 0) {
|
||||
newFirstVisibleColumnScrollIndex = 0;
|
||||
}
|
||||
firstVisibleColumnScrollIndex = newFirstVisibleColumnScrollIndex;
|
||||
|
||||
domHorizontalScroll.scroll(newFirstVisibleColumnScrollIndex);
|
||||
scrollHorizontal(event.deltaY, event.deltaX);
|
||||
} else {
|
||||
let newFirstVisibleRowScrollIndex = firstVisibleRowScrollIndex;
|
||||
if (event.deltaY > 0) {
|
||||
newFirstVisibleRowScrollIndex += wheelRowCount;
|
||||
}
|
||||
if (event.deltaY < 0) {
|
||||
newFirstVisibleRowScrollIndex -= wheelRowCount;
|
||||
}
|
||||
let rowCount = grider.rowCount;
|
||||
if (newFirstVisibleRowScrollIndex + visibleRowCountLowerBound > rowCount) {
|
||||
newFirstVisibleRowScrollIndex = rowCount - visibleRowCountLowerBound + 1;
|
||||
}
|
||||
if (newFirstVisibleRowScrollIndex < 0) {
|
||||
newFirstVisibleRowScrollIndex = 0;
|
||||
}
|
||||
firstVisibleRowScrollIndex = newFirstVisibleRowScrollIndex;
|
||||
|
||||
domVerticalScroll.scroll(newFirstVisibleRowScrollIndex);
|
||||
scrollHorizontal(event.deltaX, event.deltaY);
|
||||
scrollVertical(event.deltaX, event.deltaY);
|
||||
}
|
||||
}
|
||||
|
||||
function scrollVertical(deltaX, deltaY) {
|
||||
let newFirstVisibleRowScrollIndex = firstVisibleRowScrollIndex;
|
||||
if (deltaY > 0 && deltaX === -0) {
|
||||
newFirstVisibleRowScrollIndex += wheelRowCount;
|
||||
} else if (deltaY < 0 && deltaX === -0) {
|
||||
newFirstVisibleRowScrollIndex -= wheelRowCount;
|
||||
}
|
||||
|
||||
let rowCount = grider.rowCount;
|
||||
if (newFirstVisibleRowScrollIndex + visibleRowCountLowerBound > rowCount) {
|
||||
newFirstVisibleRowScrollIndex = rowCount - visibleRowCountLowerBound + 1;
|
||||
}
|
||||
if (newFirstVisibleRowScrollIndex < 0) {
|
||||
newFirstVisibleRowScrollIndex = 0;
|
||||
}
|
||||
|
||||
firstVisibleRowScrollIndex = newFirstVisibleRowScrollIndex;
|
||||
domVerticalScroll.scroll(newFirstVisibleRowScrollIndex);
|
||||
}
|
||||
|
||||
function scrollHorizontal(deltaX, deltaY) {
|
||||
let newFirstVisibleColumnScrollIndex = firstVisibleColumnScrollIndex;
|
||||
if (deltaX > 0 && deltaY === -0) {
|
||||
newFirstVisibleColumnScrollIndex++;
|
||||
} else if (deltaX < 0 && deltaY === -0) {
|
||||
newFirstVisibleColumnScrollIndex--;
|
||||
}
|
||||
|
||||
if (newFirstVisibleColumnScrollIndex > maxScrollColumn) {
|
||||
newFirstVisibleColumnScrollIndex = maxScrollColumn;
|
||||
}
|
||||
if (newFirstVisibleColumnScrollIndex < 0) {
|
||||
newFirstVisibleColumnScrollIndex = 0;
|
||||
}
|
||||
|
||||
firstVisibleColumnScrollIndex = newFirstVisibleColumnScrollIndex;
|
||||
domHorizontalScroll.scroll(newFirstVisibleColumnScrollIndex);
|
||||
}
|
||||
|
||||
function getSelectedRowIndexes() {
|
||||
if (selectedCells.find(x => x[0] == 'header')) return _.range(0, grider.rowCount);
|
||||
return _.uniq((selectedCells || []).map(x => x[0])).filter(x => _.isNumber(x));
|
||||
@@ -980,7 +988,6 @@
|
||||
);
|
||||
|
||||
const menu = getContextMenu();
|
||||
|
||||
</script>
|
||||
|
||||
{#if !display || (!isDynamicStructure && (!columns || columns.length == 0))}
|
||||
@@ -1001,7 +1008,13 @@
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="container" bind:clientWidth={containerWidth} bind:clientHeight={containerHeight} use:contextMenu={menu}>
|
||||
<div
|
||||
class="container"
|
||||
bind:clientWidth={containerWidth}
|
||||
bind:clientHeight={containerHeight}
|
||||
use:contextMenu={menu}
|
||||
on:wheel={handleGridWheel}
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="focus-field"
|
||||
@@ -1019,7 +1032,6 @@
|
||||
on:mousedown={handleGridMouseDown}
|
||||
on:mousemove={handleGridMouseMove}
|
||||
on:mouseup={handleGridMouseUp}
|
||||
on:wheel={handleGridWheel}
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -1187,5 +1199,4 @@
|
||||
right: 40px;
|
||||
bottom: 20px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -15,6 +15,13 @@ const jsonFormat = {
|
||||
writerFunc: 'jsonArrayWriter',
|
||||
};
|
||||
|
||||
const sqlFormat = {
|
||||
storageType: 'sql',
|
||||
extension: 'sql',
|
||||
name: 'SQL',
|
||||
writerFunc: 'sqlDataWriter',
|
||||
};
|
||||
|
||||
const jsonlQuickExport = {
|
||||
label: 'JSON lines',
|
||||
extension: 'jsonl',
|
||||
@@ -37,8 +44,19 @@ const jsonQuickExport = {
|
||||
}),
|
||||
};
|
||||
|
||||
const sqlQuickExport = {
|
||||
label: 'SQL',
|
||||
extension: 'sql',
|
||||
createWriter: fileName => ({
|
||||
functionName: 'sqlDataWriter',
|
||||
props: {
|
||||
fileName,
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
export function buildFileFormats(plugins): FileFormatDefinition[] {
|
||||
const res = [jsonlFormat, jsonFormat];
|
||||
const res = [jsonlFormat, jsonFormat, sqlFormat];
|
||||
for (const { content } of plugins) {
|
||||
const { fileFormats } = content;
|
||||
if (fileFormats) res.push(...fileFormats);
|
||||
@@ -47,7 +65,7 @@ export function buildFileFormats(plugins): FileFormatDefinition[] {
|
||||
}
|
||||
|
||||
export function buildQuickExports(plugins): QuickExportDefinition[] {
|
||||
const res = [jsonQuickExport, jsonlQuickExport];
|
||||
const res = [jsonQuickExport, jsonlQuickExport, sqlQuickExport];
|
||||
for (const { content } of plugins) {
|
||||
if (content.quickExports) res.push(...content.quickExports);
|
||||
}
|
||||
|
||||
@@ -69,11 +69,16 @@
|
||||
.main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
position: relative;
|
||||
overflow-y: scroll;
|
||||
background-color: var(--theme-bg-0);
|
||||
}
|
||||
table {
|
||||
flex: 1;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user