@@ -4,6 +4,7 @@ import axios from "axios";
44import { parse } from " csv-parse/sync" ;
55import { computed , onMounted , reactive , ref , watch } from " vue" ;
66
7+ import type { HDADetailed } from " @/api" ;
78import { getAppRoot } from " @/onload/loadConfig" ;
89
910interface TabularChunk {
@@ -12,14 +13,14 @@ interface TabularChunk {
1213 data_line_offset: number ;
1314}
1415
16+ interface TabularDataset extends HDADetailed {
17+ metadata_columns? : number ;
18+ metadata_column_types? : string [];
19+ metadata_column_names? : string [];
20+ }
21+
1522interface TabularChunkedViewProps {
16- options: {
17- id: string ;
18- file_ext: string ;
19- metadata_columns: number ;
20- metadata_column_types: string [];
21- metadata_column_names: string [];
22- };
23+ options: TabularDataset ;
2324}
2425
2526const props = defineProps <TabularChunkedViewProps >();
@@ -36,7 +37,7 @@ const tabularData = reactive<{ rows: string[][] }>({
3637const columns = computed (() => {
3738 const columns = Array (props .options .metadata_columns );
3839 // for each column_name, inject header
39- if (props .options .metadata_column_names ?.length > 0 ) {
40+ if (props .options .metadata_column_names && props . options . metadata_column_names ?.length > 0 ) {
4041 props .options .metadata_column_names .forEach ((column_name , index ) => {
4142 columns [index ] = column_name ;
4243 });
@@ -46,7 +47,7 @@ const columns = computed(() => {
4647
4748const columnStyle = computed (() => {
4849 const columnStyle = Array (props .options .metadata_columns );
49- if (props .options .metadata_column_types ?.length > 0 ) {
50+ if (props .options .metadata_column_types && props . options . metadata_column_types ?.length > 0 ) {
5051 props .options .metadata_column_types .forEach ((column_type , index ) => {
5152 columnStyle [index ] = column_type === " str" || column_type === " list" ? " string-align" : " number-align" ;
5253 });
0 commit comments