@@ -2,7 +2,6 @@ import { IExcelFile } from './excel-interfaces';
22import { ExcelStrings } from './excel-strings' ;
33import { WorksheetData } from './worksheet-data' ;
44
5- import { strToU8 } from 'fflate' ;
65import { ExportHeaderType , ExportRecordType , IExportRecord , IColumnList , IColumnInfo , GRID_ROOT_SUMMARY , GRID_PARENT , GRID_LEVEL_COL } from '../exporter-common/base-export-service' ;
76import { yieldingLoop } from 'igniteui-angular/core' ;
87
@@ -11,7 +10,7 @@ import { yieldingLoop } from 'igniteui-angular/core';
1110 */
1211export class RootRelsFile implements IExcelFile {
1312 public writeElement ( folder : Object ) {
14- folder [ '.rels' ] = strToU8 ( ExcelStrings . getRels ( ) ) ;
13+ import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ '.rels' ] = strToU8 ( ExcelStrings . getRels ( ) ) ) ;
1514 }
1615}
1716
@@ -20,7 +19,7 @@ export class RootRelsFile implements IExcelFile {
2019 */
2120export class AppFile implements IExcelFile {
2221 public writeElement ( folder : Object , worksheetData : WorksheetData ) {
23- folder [ 'app.xml' ] = strToU8 ( ExcelStrings . getApp ( worksheetData . options . worksheetName ) ) ;
22+ import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'app.xml' ] = strToU8 ( ExcelStrings . getApp ( worksheetData . options . worksheetName ) ) ) ;
2423 }
2524}
2625
@@ -29,7 +28,7 @@ export class AppFile implements IExcelFile {
2928 */
3029export class CoreFile implements IExcelFile {
3130 public writeElement ( folder : Object ) {
32- folder [ 'core.xml' ] = strToU8 ( ExcelStrings . getCore ( ) ) ;
31+ import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'core.xml' ] = strToU8 ( ExcelStrings . getCore ( ) ) ) ;
3332 }
3433}
3534
@@ -39,7 +38,7 @@ export class CoreFile implements IExcelFile {
3938export class WorkbookRelsFile implements IExcelFile {
4039 public writeElement ( folder : Object , worksheetData : WorksheetData ) {
4140 const hasSharedStrings = ! worksheetData . isEmpty || worksheetData . options . alwaysExportHeaders ;
42- folder [ 'workbook.xml.rels' ] = strToU8 ( ExcelStrings . getWorkbookRels ( hasSharedStrings ) ) ;
41+ import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'workbook.xml.rels' ] = strToU8 ( ExcelStrings . getWorkbookRels ( hasSharedStrings ) ) ) ;
4342 }
4443}
4544
@@ -48,7 +47,7 @@ export class WorkbookRelsFile implements IExcelFile {
4847 */
4948export class ThemeFile implements IExcelFile {
5049 public writeElement ( folder : Object ) {
51- folder [ 'theme1.xml' ] = strToU8 ( ExcelStrings . getTheme ( ) ) ;
50+ import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'theme1.xml' ] = strToU8 ( ExcelStrings . getTheme ( ) ) ) ;
5251 }
5352}
5453
@@ -103,9 +102,10 @@ export class WorksheetFile implements IExcelFile {
103102 const hasTable = ( ! worksheetData . isEmpty || worksheetData . options . alwaysExportHeaders )
104103 && worksheetData . options . exportAsTable ;
105104
106- folder [ 'sheet1.xml' ] = strToU8 ( ExcelStrings . getSheetXML (
107- this . dimension , this . freezePane , cols , rows , hasTable , this . maxOutlineLevel , worksheetData . isHierarchical ) ) ;
108- resolve ( ) ;
105+ import ( 'fflate' ) . then ( ( { strToU8 } ) => {
106+ folder [ 'sheet1.xml' ] = strToU8 ( ExcelStrings . getSheetXML ( this . dimension , this . freezePane , cols , rows , hasTable , this . maxOutlineLevel , worksheetData . isHierarchical ) ) ;
107+ resolve ( ) ;
108+ } ) ;
109109 } ) ;
110110 } ) ;
111111 }
@@ -718,7 +718,7 @@ export class WorksheetFile implements IExcelFile {
718718 */
719719export class StyleFile implements IExcelFile {
720720 public writeElement ( folder : Object ) {
721- folder [ 'styles.xml' ] = strToU8 ( ExcelStrings . getStyles ( ) ) ;
721+ import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'styles.xml' ] = strToU8 ( ExcelStrings . getStyles ( ) ) ) ;
722722 }
723723}
724724
@@ -727,7 +727,7 @@ export class StyleFile implements IExcelFile {
727727 */
728728export class WorkbookFile implements IExcelFile {
729729 public writeElement ( folder : Object , worksheetData : WorksheetData ) {
730- folder [ 'workbook.xml' ] = strToU8 ( ExcelStrings . getWorkbook ( worksheetData . options . worksheetName ) ) ;
730+ import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'workbook.xml' ] = strToU8 ( ExcelStrings . getWorkbook ( worksheetData . options . worksheetName ) ) ) ;
731731 }
732732}
733733
@@ -737,7 +737,7 @@ export class WorkbookFile implements IExcelFile {
737737export class ContentTypesFile implements IExcelFile {
738738 public writeElement ( folder : Object , worksheetData : WorksheetData ) {
739739 const hasSharedStrings = ! worksheetData . isEmpty || worksheetData . options . alwaysExportHeaders ;
740- folder [ '[Content_Types].xml' ] = strToU8 ( ExcelStrings . getContentTypesXML ( hasSharedStrings , worksheetData . options . exportAsTable ) ) ;
740+ import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ '[Content_Types].xml' ] = strToU8 ( ExcelStrings . getContentTypesXML ( hasSharedStrings , worksheetData . options . exportAsTable ) ) ) ;
741741 }
742742}
743743
@@ -754,11 +754,13 @@ export class SharedStringsFile implements IExcelFile {
754754 sharedStrings [ dict . getSanitizedValue ( value ) ] = '<si><t>' + value + '</t></si>' ;
755755 }
756756
757- folder [ 'sharedStrings.xml' ] = strToU8 ( ExcelStrings . getSharedStringXML (
758- dict . stringsCount ,
759- sortedValues . length ,
760- sharedStrings . join ( '' ) )
761- ) ;
757+ import ( 'fflate' ) . then ( ( { strToU8 } ) => {
758+ folder [ 'sharedStrings.xml' ] = strToU8 ( ExcelStrings . getSharedStringXML (
759+ dict . stringsCount ,
760+ sortedValues . length ,
761+ sharedStrings . join ( '' ) )
762+ ) ;
763+ } ) ;
762764 }
763765}
764766
@@ -799,7 +801,7 @@ export class TablesFile implements IExcelFile {
799801 sortString = `<sortState ref="A2:${ lastColumn } "><sortCondition descending="${ dir } " ref="${ sc } 1:${ sc } 15"/></sortState>` ;
800802 }
801803
802- folder [ 'table1.xml' ] = strToU8 ( ExcelStrings . getTablesXML ( autoFilterDimension , tableDimension , tableColumns , sortString ) ) ;
804+ import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'table1.xml' ] = strToU8 ( ExcelStrings . getTablesXML ( autoFilterDimension , tableDimension , tableColumns , sortString ) ) ) ;
803805 }
804806}
805807
@@ -808,6 +810,6 @@ export class TablesFile implements IExcelFile {
808810 */
809811export class WorksheetRelsFile implements IExcelFile {
810812 public writeElement ( folder : Object ) {
811- folder [ 'sheet1.xml.rels' ] = strToU8 ( ExcelStrings . getWorksheetRels ( ) ) ;
813+ import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'sheet1.xml.rels' ] = strToU8 ( ExcelStrings . getWorksheetRels ( ) ) ) ;
812814 }
813815}
0 commit comments