Browse Source

feat(nc-gui): add detectColumnType logic

pull/4135/head
Wing-Kam Wong 2 years ago
parent
commit
5c14090e4d
  1. 10
      packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts

10
packages/nc-gui/utils/parsers/CSVTemplateAdapter.ts

@ -29,6 +29,7 @@ export default class CSVTemplateAdapter {
constructor(files: UploadFile[], parserConfig = {}) {
this.config = {
maxRowsToParse: 500,
autoSelectFieldTypes: true,
firstRowAsHeaders: true,
...parserConfig,
}
@ -224,11 +225,16 @@ export default class CSVTemplateAdapter {
tn,
[...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
that.detectColumnType(tableIdx, row.data as [])
}
} else {
that.detectColumnType(tableIdx, row.data as [])
}
}
},

Loading…
Cancel
Save