Skip to content

Commit 65ba2f0

Browse files
committed
Code review changes
1 parent 689695a commit 65ba2f0

3 files changed

Lines changed: 7 additions & 12 deletions

File tree

packages/components/src/internal/components/editable/actions.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,8 @@ function parsePaste(value: string): ParsePastePayload {
14541454
data = data.push(columns);
14551455
});
14561456
} else {
1457-
// fall back to line by line processing without parsing, to preserve quotes
1457+
// fall back to line by line processing without parsing, to preserve quotes for each cell, so multi-value fields (MVFK, MVTC) can be parsed correctly.
1458+
// Otherwise, PapaParse will strip quotes, making it impossible to distinguish between a comma that is part of the value vs a comma that is a delimiter for multi-value fields.
14581459
value.split('\n').forEach(rv => {
14591460
const columns = List(rv.split('\t'));
14601461
if (numCols < columns.size) {
@@ -1601,11 +1602,12 @@ async function insertPastedData(
16011602
} else {
16021603
let valToValidate = val;
16031604
if (Utils.isString(val)) {
1604-
// GitHub Issue 916: Copying/pasting in the grid doesn't always act as expected
1605-
// drag fill always quoteValueWithDelimiters, needs to remove the extra quotes before validating
16061605
const isMultiLinePasting = NEWLINE_CHARS.find(char => valToValidate.indexOf(char) > -1);
1607-
// multiline pasting has already been parsed
1606+
// The only case that newline charaxcters would be preserved here is if parsePaste used Papa.parse to parse the tsv,
1607+
// in which case extra qutoes are already removed by Papa.parse, so no need for extra parsing.
16081608
if (!isMultiLinePasting) {
1609+
// GitHub Issue 916: Copying/pasting in the grid doesn't always act as expected
1610+
// generateColumnFillValues/getCopyValue uses joinMultiValueForExport to prepare copied value, needs to remove the extra quotes before validating
16091611
const parsedValues = splitMultiValueForImport(val, parseDelimter);
16101612
if (parsedValues.length === 1) valToValidate = parsedValues[0].trim();
16111613
}
@@ -1761,10 +1763,7 @@ export function pasteEvent(
17611763

17621764
function getCellCopyValue(valueDescriptors: List<ValueDescriptor>, delimter: string): string {
17631765
if (valueDescriptors && valueDescriptors.size > 0) {
1764-
const values = [];
1765-
valueDescriptors.forEach(vd => {
1766-
values.push(vd.display !== undefined ? vd.display.toString().trim() : '');
1767-
});
1766+
const values = valueDescriptors.map(vd => (vd.display !== undefined ? vd.display.toString().trim() : '')).toArray();
17681767

17691768
if (values.length > 0) return joinMultiValueForExport(values, delimter);
17701769
}

packages/components/src/internal/components/forms/model.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@ export function fetchSearchResults(model: QuerySelectModel, input: any): Promise
225225
parameters: model.queryParams,
226226
},
227227
filterVal,
228-
model.valueColumn,
229-
model.delimiter,
230228
addExactFilter ? displayColumn : undefined
231229
);
232230
}

packages/components/src/internal/query/api.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,6 @@ export function handleSelectRowsResponse(response: Query.Response, queryInfo: Qu
625625
export function searchRows(
626626
selectRowsConfig,
627627
token: any,
628-
valueColumn: string,
629-
delimiter: string,
630628
exactColumn?: string,
631629
): Promise<ISelectRowsResult> {
632630
return new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)