Skip to content

Commit

Permalink
fix: better default settings for export
Browse files Browse the repository at this point in the history
  • Loading branch information
schummar committed Mar 27, 2024
1 parent 914c05a commit ad4b720
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/internalState/calcProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export function calcProps<T>(props: TableProps<T>): InternalTableProps<T> {
typeof v === 'number' || v instanceof Date
? v
: v === null || v === undefined
? ''
: String(v),
? ''
: String(v),
]
).map((function_, i) => cache(`columns.${cacheKey}.sortBy.${i}`, function_)),
disableSort,
Expand Down Expand Up @@ -109,20 +109,26 @@ export function calcProps<T>(props: TableProps<T>): InternalTableProps<T> {
props.enableExport === true ||
(props.enableExport instanceof Object && props.enableExport.copy === true)
) {
copy = { separator: '\t' };
copy = {};
} else if (props.enableExport && props.enableExport.copy instanceof Object) {
copy = props.enableExport.copy;
}
if (copy) {
copy.separator ??= '\t';
}

let download;
if (
props.enableExport === true ||
(props.enableExport instanceof Object && props.enableExport.download === true)
) {
download = { sepPrefix: true };
download = {};
} else if (props.enableExport && props.enableExport.download instanceof Object) {
download = props.enableExport.download;
}
if (download) {
download.sepPrefix ??= true;
}

const enableExport = { copy, download };

Expand Down

0 comments on commit ad4b720

Please sign in to comment.