mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 04:16: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);
|
||||
}
|
||||
|
||||
const clipboardHeadersFormatter = (delimiter) => (columns) => {
|
||||
return columns.join(delimiter);
|
||||
};
|
||||
|
||||
const clipboardTextFormatter = (delimiter, headers) => (columns, rows) => {
|
||||
const lines = [];
|
||||
if (headers) lines.push(columns.join(delimiter));
|
||||
@@ -161,6 +165,11 @@ export const copyRowsFormatDefs = {
|
||||
name: 'Without headers',
|
||||
formatter: clipboardTextFormatter('\t', false),
|
||||
},
|
||||
headers: {
|
||||
label: 'Copy only headers',
|
||||
name: 'Only Headers',
|
||||
formatter: clipboardHeadersFormatter('\t'),
|
||||
},
|
||||
csv: {
|
||||
label: 'Copy as CSV',
|
||||
name: 'CSV',
|
||||
|
||||
Reference in New Issue
Block a user