@@ -14,14 +14,12 @@ interface TabularChunk {
1414
1515interface TabularChunkedViewProps {
1616 options: {
17- dataset_config: {
18- id: string ;
19- file_ext: string ;
20- first_data_chunk: TabularChunk ;
21- metadata_columns: number ;
22- metadata_column_types: string [];
23- metadata_column_names: string [];
24- };
17+ id: string ;
18+ file_ext: string ;
19+ first_data_chunk: TabularChunk ;
20+ metadata_columns: number ;
21+ metadata_column_types: string [];
22+ metadata_column_names: string [];
2523 };
2624}
2725
@@ -37,32 +35,32 @@ const tabularData = reactive<{ rows: string[][] }>({
3735});
3836
3937const columns = computed (() => {
40- const columns = Array (props .options .dataset_config . metadata_columns );
38+ const columns = Array (props .options .metadata_columns );
4139 // for each column_name, inject header
42- if (props .options .dataset_config . metadata_column_names ?.length > 0 ) {
43- props .options .dataset_config . metadata_column_names .forEach ((column_name , index ) => {
40+ if (props .options .metadata_column_names ?.length > 0 ) {
41+ props .options .metadata_column_names .forEach ((column_name , index ) => {
4442 columns [index ] = column_name ;
4543 });
4644 }
4745 return columns ;
4846});
4947
5048const columnStyle = computed (() => {
51- const columnStyle = Array (props .options .dataset_config . metadata_columns );
52- if (props .options .dataset_config . metadata_column_types ?.length > 0 ) {
53- props .options .dataset_config . metadata_column_types .forEach ((column_type , index ) => {
49+ const columnStyle = Array (props .options .metadata_columns );
50+ if (props .options .metadata_column_types ?.length > 0 ) {
51+ props .options .metadata_column_types .forEach ((column_type , index ) => {
5452 columnStyle [index ] = column_type === " str" || column_type === " list" ? " string-align" : " number-align" ;
5553 });
5654 }
5755 return columnStyle ;
5856});
5957
6058const delimiter = computed (() => {
61- return props .options .dataset_config . file_ext === " csv" ? " ," : " \t " ;
59+ return props .options .file_ext === " csv" ? " ," : " \t " ;
6260});
6361
6462const chunkUrl = computed (() => {
65- return ` ${getAppRoot ()}dataset/display?dataset_id=${props .options .dataset_config . id } ` ;
63+ return ` ${getAppRoot ()}dataset/display?dataset_id=${props .options .id } ` ;
6664});
6765
6866// Loading more data on user scroll to (near) bottom.
@@ -164,8 +162,8 @@ function nextChunk() {
164162
165163onMounted (() => {
166164 // Render first chunk if available.
167- if (props .options .dataset_config . first_data_chunk ) {
168- processChunk (props .options .dataset_config . first_data_chunk );
165+ if (props .options .first_data_chunk ) {
166+ processChunk (props .options .first_data_chunk );
169167 loading .value = false ;
170168 }
171169});
0 commit comments