forked from sheetjs/sheetjs
		
	fix: Add DenseSheetData type (#3195)
This commit is contained in:
		
							parent
							
								
									5550b90704
								
							
						
					
					
						commit
						6912bdb2d4
					
				| @ -4,7 +4,7 @@ | ||||
| /* these are type imports and do not show up in the generated JS */ | ||||
| import { CFB$Container, CFB$Entry } from 'cfb'; | ||||
| import { WorkBook, WorkSheet, Range, CellObject, ParsingOptions, WritingOptions, DenseWorkSheet, Comments } from '../'; | ||||
| import type { utils, NumberFormat } from "../"; | ||||
| import type { utils, NumberFormat, DenseSheetData } from "../"; | ||||
| 
 | ||||
| declare var encode_col: typeof utils.encode_col; | ||||
| declare var encode_row: typeof utils.encode_row; | ||||
| @ -1697,7 +1697,7 @@ function write_numbers_tma(cfb: CFB$Container, deps: Dependents, ws: WorkSheet, | ||||
| 	if(trunc) console.error(`Truncating to ${encode_range(range)}`); | ||||
| 
 | ||||
| 	/* preprocess data and build up shared string table */ | ||||
| 	var data: CellObject[][] = []; | ||||
| 	var data: DenseSheetData = []; | ||||
| 	if(ws["!data"]) data = ws["!data"]; | ||||
| 	else { | ||||
| 		var colstr: string[] = []; | ||||
| @ -1708,7 +1708,7 @@ function write_numbers_tma(cfb: CFB$Container, deps: Dependents, ws: WorkSheet, | ||||
| 			for(_C = 0; _C <= range.e.c; ++_C) { | ||||
| 				var _cell = ws[colstr[_C] + _R]; | ||||
| 				if(!_cell) continue; | ||||
| 				data[R_][_C] = _cell; | ||||
| 				data[R_]![_C] = _cell; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
							
								
								
									
										18
									
								
								types/index.d.ts
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										18
									
								
								types/index.d.ts
									
									
									
									
										vendored
									
									
								
							| @ -575,14 +575,14 @@ export interface Sheet { | ||||
|      * Dense-mode  store cells in the '!data' key | ||||
|      * Special keys start with '!' | ||||
|      */ | ||||
|     [cell: string]: CellObject | CellObject[][] | SheetKeys | any; | ||||
|     [cell: string]: CellObject | DenseSheetData | SheetKeys | any; | ||||
| 
 | ||||
|     /** | ||||
|      * Dense-mode worksheets store data in an array of arrays | ||||
|      * | ||||
|      * Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed) | ||||
|      */ | ||||
|     '!data'?: CellObject[][]; | ||||
|     '!data'?: DenseSheetData; | ||||
| 
 | ||||
|     /** Sheet type */ | ||||
|     '!type'?: SheetType; | ||||
| @ -599,15 +599,16 @@ export interface DenseSheet extends Sheet { | ||||
|      * Special keys start with '!' | ||||
|      * Dense-mode worksheets store data in the '!data' key | ||||
|      */ | ||||
|     [cell: string]: CellObject[][] | SheetKeys | any; | ||||
|     [cell: string]: DenseSheetData | SheetKeys | any; | ||||
| 
 | ||||
|     /** | ||||
|      * Dense-mode worksheets store data in an array of arrays | ||||
|      * | ||||
|      * Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed) | ||||
|      */ | ||||
|     '!data': CellObject[][]; | ||||
|     '!data': DenseSheetData; | ||||
| } | ||||
| export type DenseSheetData = ((CellObject|undefined)[]|undefined)[]; | ||||
| /** General object representing a sparse Sheet (worksheet or chartsheet) */ | ||||
| export interface SparseSheet extends Sheet { | ||||
|     /** | ||||
| @ -650,14 +651,7 @@ export interface WorkSheet extends Sheet { | ||||
|     '!autofilter'?: AutoFilterInfo; | ||||
| } | ||||
| /** Dense Worksheet Object */ | ||||
| export interface DenseWorkSheet extends DenseSheet { | ||||
|     /** | ||||
|      * Dense-mode worksheets store data in an array of arrays | ||||
|      * | ||||
|      * Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed) | ||||
|      */ | ||||
|     '!data': CellObject[][]; | ||||
| } | ||||
| export interface DenseWorkSheet extends DenseSheet {} | ||||
| 
 | ||||
| /** | ||||
|  * Worksheet Object with CellObject type | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user