mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 03:06:00 +00:00
feat: add 'Copy only headers' feature
This commit is contained in:
@@ -77,6 +77,10 @@ export function extractRowCopiedValue(row, col) {
|
|||||||
return stringifyCellValue(value);
|
return stringifyCellValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const clipboardHeadersFormatter = (delimiter) => (columns) => {
|
||||||
|
return columns.join(delimiter);
|
||||||
|
};
|
||||||
|
|
||||||
const clipboardTextFormatter = (delimiter, headers) => (columns, rows) => {
|
const clipboardTextFormatter = (delimiter, headers) => (columns, rows) => {
|
||||||
const lines = [];
|
const lines = [];
|
||||||
if (headers) lines.push(columns.join(delimiter));
|
if (headers) lines.push(columns.join(delimiter));
|
||||||
@@ -161,6 +165,11 @@ export const copyRowsFormatDefs = {
|
|||||||
name: 'Without headers',
|
name: 'Without headers',
|
||||||
formatter: clipboardTextFormatter('\t', false),
|
formatter: clipboardTextFormatter('\t', false),
|
||||||
},
|
},
|
||||||
|
headers: {
|
||||||
|
label: 'Copy only headers',
|
||||||
|
name: 'Only Headers',
|
||||||
|
formatter: clipboardHeadersFormatter('\t'),
|
||||||
|
},
|
||||||
csv: {
|
csv: {
|
||||||
label: 'Copy as CSV',
|
label: 'Copy as CSV',
|
||||||
name: 'CSV',
|
name: 'CSV',
|
||||||
|
|||||||
Reference in New Issue
Block a user