|
|
@ -29,6 +29,7 @@ export default class CSVTemplateAdapter { |
|
|
|
constructor(files: UploadFile[], parserConfig = {}) { |
|
|
|
constructor(files: UploadFile[], parserConfig = {}) { |
|
|
|
this.config = { |
|
|
|
this.config = { |
|
|
|
maxRowsToParse: 500, |
|
|
|
maxRowsToParse: 500, |
|
|
|
|
|
|
|
autoSelectFieldTypes: true, |
|
|
|
firstRowAsHeaders: true, |
|
|
|
firstRowAsHeaders: true, |
|
|
|
...parserConfig, |
|
|
|
...parserConfig, |
|
|
|
} |
|
|
|
} |
|
|
@ -224,11 +225,16 @@ export default class CSVTemplateAdapter { |
|
|
|
tn, |
|
|
|
tn, |
|
|
|
[...Array((row.data as []).length)].map((_, i) => `column${i + 1}`), |
|
|
|
[...Array((row.data as []).length)].map((_, i) => `column${i + 1}`), |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
if (that.config.autoSelectFieldTypes) { |
|
|
|
|
|
|
|
// row.data is data
|
|
|
|
|
|
|
|
that.detectColumnType(tableIdx, row.data as []) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (that.config.autoSelectFieldTypes) { |
|
|
|
// row.data is data
|
|
|
|
// row.data is data
|
|
|
|
that.detectColumnType(tableIdx, row.data as []) |
|
|
|
that.detectColumnType(tableIdx, row.data as []) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
that.detectColumnType(tableIdx, row.data as []) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|