|
|
|
@ -204,6 +204,9 @@ export default class CSVTemplateAdapter {
|
|
|
|
|
for (const [tableIdx, file] of this.files.entries()) { |
|
|
|
|
let steppers = 0 |
|
|
|
|
const tn = file.name.replace(/[` ~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/g, '_').trim() |
|
|
|
|
this.data[tn] = [] |
|
|
|
|
|
|
|
|
|
// parse column meta
|
|
|
|
|
parse(file.originFileObj as File, { |
|
|
|
|
worker: true, |
|
|
|
|
skipEmptyLines: 'greedy', |
|
|
|
@ -238,23 +241,10 @@ export default class CSVTemplateAdapter {
|
|
|
|
|
console.log('complete') |
|
|
|
|
console.log(`steppers: ${steppers}`) |
|
|
|
|
that.updateTemplate(tableIdx) |
|
|
|
|
callback() |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getColumns() { |
|
|
|
|
// return this.columns
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getData() { |
|
|
|
|
const that = this |
|
|
|
|
for (const [tableIdx, file] of this.files.entries()) { |
|
|
|
|
let steppers = 0 |
|
|
|
|
const tn = file.name.replace(/[` ~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/g, '_').trim() |
|
|
|
|
this.data[tn] = [] |
|
|
|
|
if (this.config.importData) { |
|
|
|
|
// parse table data
|
|
|
|
|
if (that.config.importData) { |
|
|
|
|
steppers = 0 |
|
|
|
|
parse(file.originFileObj as File, { |
|
|
|
|
worker: true, |
|
|
|
|
skipEmptyLines: 'greedy', |
|
|
|
@ -281,10 +271,24 @@ export default class CSVTemplateAdapter {
|
|
|
|
|
complete() { |
|
|
|
|
console.log('getData(): complete') |
|
|
|
|
console.log(`getData(): steppers: ${steppers}`) |
|
|
|
|
callback() |
|
|
|
|
}, |
|
|
|
|
// TODO(import): add error
|
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
callback() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getColumns() { |
|
|
|
|
console.log(this.project.tables.map((t: Record<string, any>) => t.columns)) |
|
|
|
|
return this.project.tables.map((t: Record<string, any>) => t.columns) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getData() { |
|
|
|
|
return this.data |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|