mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 18:23:59 +00:00
fixed copy (NULL) value
This commit is contained in:
@@ -150,7 +150,13 @@ function stringifyJsonToGrid(value): ReturnType<typeof stringifyCellValue> {
|
|||||||
|
|
||||||
export function stringifyCellValue(
|
export function stringifyCellValue(
|
||||||
value,
|
value,
|
||||||
intent: 'gridCellIntent' | 'inlineEditorIntent' | 'multilineEditorIntent' | 'stringConversionIntent' | 'exportIntent',
|
intent:
|
||||||
|
| 'gridCellIntent'
|
||||||
|
| 'inlineEditorIntent'
|
||||||
|
| 'multilineEditorIntent'
|
||||||
|
| 'stringConversionIntent'
|
||||||
|
| 'exportIntent'
|
||||||
|
| 'clipboardIntent',
|
||||||
editorTypes?: DataEditorTypesBehaviour,
|
editorTypes?: DataEditorTypesBehaviour,
|
||||||
gridFormattingOptions?: { useThousandsSeparator?: boolean },
|
gridFormattingOptions?: { useThousandsSeparator?: boolean },
|
||||||
jsonParsedValue?: any
|
jsonParsedValue?: any
|
||||||
@@ -209,6 +215,7 @@ export function stringifyCellValue(
|
|||||||
switch (intent) {
|
switch (intent) {
|
||||||
case 'exportIntent':
|
case 'exportIntent':
|
||||||
case 'stringConversionIntent':
|
case 'stringConversionIntent':
|
||||||
|
case 'clipboardIntent':
|
||||||
return { value: dateString };
|
return { value: dateString };
|
||||||
default:
|
default:
|
||||||
const m = dateString.match(dateTimeStorageRegex);
|
const m = dateString.match(dateTimeStorageRegex);
|
||||||
|
|||||||
@@ -673,6 +673,7 @@
|
|||||||
keyColumns: display?.baseTable?.primaryKey?.columns?.map(col => col.columnName) || [
|
keyColumns: display?.baseTable?.primaryKey?.columns?.map(col => col.columnName) || [
|
||||||
display?.columns ? display?.columns[0].columnName : columns[0],
|
display?.columns ? display?.columns[0].columnName : columns[0],
|
||||||
],
|
],
|
||||||
|
editorTypes: getEditorTypes(),
|
||||||
});
|
});
|
||||||
if (domFocusField) domFocusField.focus();
|
if (domFocusField) domFocusField.focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,20 +75,20 @@ export async function getClipboardText() {
|
|||||||
export function extractRowCopiedValue(row, col, editorTypes?: DataEditorTypesBehaviour) {
|
export function extractRowCopiedValue(row, col, editorTypes?: DataEditorTypesBehaviour) {
|
||||||
let value = row[col];
|
let value = row[col];
|
||||||
if (value === undefined) value = _.get(row, col);
|
if (value === undefined) value = _.get(row, col);
|
||||||
return stringifyCellValue(value, 'exportIntent', editorTypes).value;
|
return stringifyCellValue(value, 'clipboardIntent', editorTypes).value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const clipboardHeadersFormatter = delimiter => columns => {
|
const clipboardHeadersFormatter = delimiter => columns => {
|
||||||
return columns.join(delimiter);
|
return columns.join(delimiter);
|
||||||
};
|
};
|
||||||
|
|
||||||
const clipboardTextFormatter = (delimiter, headers) => (columns, rows) => {
|
const clipboardTextFormatter = (delimiter, headers) => (columns, rows, options) => {
|
||||||
const lines = [];
|
const lines = [];
|
||||||
if (headers) lines.push(columns.join(delimiter));
|
if (headers) lines.push(columns.join(delimiter));
|
||||||
lines.push(
|
lines.push(
|
||||||
...rows.map(row => {
|
...rows.map(row => {
|
||||||
if (!row) return '';
|
if (!row) return '';
|
||||||
const line = columns.map(col => extractRowCopiedValue(row, col)).join(delimiter);
|
const line = columns.map(col => extractRowCopiedValue(row, col, options?.editorTypes)).join(delimiter);
|
||||||
return line;
|
return line;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user