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