feat(grid): copy column names using comments

This commit is contained in:
大峰 authored and GitHub committed 2026-07-31 16:23:56 +08:00
1 parent 24691ccb1e
commit c208fcdf60
5 files changed
+15 -5

No files matched your search

@@ -37,9 +37,10 @@ export function columnNamesForCopy(allColumnNames: readonly string[], visibleCol
return [...(scope === "all" ? allColumnNames : visibleColumnNames)];
}
export function formatColumnNamesForCopy(names: readonly string[], options: { separator: ColumnNameCopySeparator; quote?: boolean; databaseType?: DatabaseType }): string {
export function formatColumnNamesForCopy(names: readonly string[], options: { separator: ColumnNameCopySeparator; quote?: boolean; databaseType?: DatabaseType; showByComment?: boolean; commentByColumn?: Map<string, string> }): string {
const quote = !!options.quote && supportsColumnNameQuoting(options.databaseType);
const parts = quote ? names.map((name) => quoteTableIdentifier(options.databaseType, name)) : [...names];
const displayNames = options.showByComment && options.commentByColumn ? names.map((name) => options.commentByColumn!.get(name) || name) : [...names];
const parts = quote ? displayNames.map((name) => quoteTableIdentifier(options.databaseType, name)) : displayNames;
return parts.join(COLUMN_NAME_COPY_SEPARATOR_VALUES[options.separator]);
}