@@ -8,45 +8,50 @@ import { yieldingLoop } from 'igniteui-angular/core';
88 * @hidden
99 */
1010export class RootRelsFile implements IExcelFile {
11- public writeElement ( folder : Object ) {
12- import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ '.rels' ] = strToU8 ( ExcelStrings . getRels ( ) ) ) ;
11+ public async writeElement ( folder : Object ) : Promise < void > {
12+ const { strToU8 } = await import ( 'fflate' ) ;
13+ folder [ '.rels' ] = strToU8 ( ExcelStrings . getRels ( ) ) ;
1314 }
1415}
1516
1617/**
1718 * @hidden
1819 */
1920export class AppFile implements IExcelFile {
20- public writeElement ( folder : Object , worksheetData : WorksheetData ) {
21- import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'app.xml' ] = strToU8 ( ExcelStrings . getApp ( worksheetData . options . worksheetName ) ) ) ;
21+ public async writeElement ( folder : Object , worksheetData : WorksheetData ) : Promise < void > {
22+ const { strToU8 } = await import ( 'fflate' ) ;
23+ folder [ 'app.xml' ] = strToU8 ( ExcelStrings . getApp ( worksheetData . options . worksheetName ) ) ;
2224 }
2325}
2426
2527/**
2628 * @hidden
2729 */
2830export class CoreFile implements IExcelFile {
29- public writeElement ( folder : Object ) {
30- import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'core.xml' ] = strToU8 ( ExcelStrings . getCore ( ) ) ) ;
31+ public async writeElement ( folder : Object ) : Promise < void > {
32+ const { strToU8 } = await import ( 'fflate' ) ;
33+ folder [ 'core.xml' ] = strToU8 ( ExcelStrings . getCore ( ) ) ;
3134 }
3235}
3336
3437/**
3538 * @hidden
3639 */
3740export class WorkbookRelsFile implements IExcelFile {
38- public writeElement ( folder : Object , worksheetData : WorksheetData ) {
41+ public async writeElement ( folder : Object , worksheetData : WorksheetData ) : Promise < void > {
3942 const hasSharedStrings = ! worksheetData . isEmpty || worksheetData . options . alwaysExportHeaders ;
40- import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'workbook.xml.rels' ] = strToU8 ( ExcelStrings . getWorkbookRels ( hasSharedStrings ) ) ) ;
43+ const { strToU8 } = await import ( 'fflate' ) ;
44+ folder [ 'workbook.xml.rels' ] = strToU8 ( ExcelStrings . getWorkbookRels ( hasSharedStrings ) ) ;
4145 }
4246}
4347
4448/**
4549 * @hidden
4650 */
4751export class ThemeFile implements IExcelFile {
48- public writeElement ( folder : Object ) {
49- import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'theme1.xml' ] = strToU8 ( ExcelStrings . getTheme ( ) ) ) ;
52+ public async writeElement ( folder : Object ) : Promise < void > {
53+ const { strToU8 } = await import ( 'fflate' ) ;
54+ folder [ 'theme1.xml' ] = strToU8 ( ExcelStrings . getTheme ( ) ) ;
5055 }
5156}
5257
@@ -716,35 +721,38 @@ export class WorksheetFile implements IExcelFile {
716721 * @hidden
717722 */
718723export class StyleFile implements IExcelFile {
719- public writeElement ( folder : Object ) {
720- import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'styles.xml' ] = strToU8 ( ExcelStrings . getStyles ( ) ) ) ;
724+ public async writeElement ( folder : Object ) : Promise < void > {
725+ const { strToU8 } = await import ( 'fflate' ) ;
726+ folder [ 'styles.xml' ] = strToU8 ( ExcelStrings . getStyles ( ) ) ;
721727 }
722728}
723729
724730/**
725731 * @hidden
726732 */
727733export class WorkbookFile implements IExcelFile {
728- public writeElement ( folder : Object , worksheetData : WorksheetData ) {
729- import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'workbook.xml' ] = strToU8 ( ExcelStrings . getWorkbook ( worksheetData . options . worksheetName ) ) ) ;
734+ public async writeElement ( folder : Object , worksheetData : WorksheetData ) : Promise < void > {
735+ const { strToU8 } = await import ( 'fflate' ) ;
736+ folder [ 'workbook.xml' ] = strToU8 ( ExcelStrings . getWorkbook ( worksheetData . options . worksheetName ) ) ;
730737 }
731738}
732739
733740/**
734741 * @hidden
735742 */
736743export class ContentTypesFile implements IExcelFile {
737- public writeElement ( folder : Object , worksheetData : WorksheetData ) {
744+ public async writeElement ( folder : Object , worksheetData : WorksheetData ) : Promise < void > {
738745 const hasSharedStrings = ! worksheetData . isEmpty || worksheetData . options . alwaysExportHeaders ;
739- import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ '[Content_Types].xml' ] = strToU8 ( ExcelStrings . getContentTypesXML ( hasSharedStrings , worksheetData . options . exportAsTable ) ) ) ;
746+ const { strToU8 } = await import ( 'fflate' ) ;
747+ folder [ '[Content_Types].xml' ] = strToU8 ( ExcelStrings . getContentTypesXML ( hasSharedStrings , worksheetData . options . exportAsTable ) ) ;
740748 }
741749}
742750
743751/**
744752 * @hidden
745753 */
746754export class SharedStringsFile implements IExcelFile {
747- public writeElement ( folder : Object , worksheetData : WorksheetData ) {
755+ public async writeElement ( folder : Object , worksheetData : WorksheetData ) : Promise < void > {
748756 const dict = worksheetData . dataDictionary ;
749757 const sortedValues = dict . getKeys ( ) ;
750758 const sharedStrings = new Array < string > ( sortedValues . length ) ;
@@ -753,21 +761,20 @@ export class SharedStringsFile implements IExcelFile {
753761 sharedStrings [ dict . getSanitizedValue ( value ) ] = '<si><t>' + value + '</t></si>' ;
754762 }
755763
756- import ( 'fflate' ) . then ( ( { strToU8 } ) => {
757- folder [ 'sharedStrings.xml' ] = strToU8 ( ExcelStrings . getSharedStringXML (
758- dict . stringsCount ,
759- sortedValues . length ,
760- sharedStrings . join ( '' ) )
761- ) ;
762- } ) ;
764+ const { strToU8 } = await import ( 'fflate' ) ;
765+ folder [ 'sharedStrings.xml' ] = strToU8 ( ExcelStrings . getSharedStringXML (
766+ dict . stringsCount ,
767+ sortedValues . length ,
768+ sharedStrings . join ( '' ) )
769+ ) ;
763770 }
764771}
765772
766773/**
767774 * @hidden
768775 */
769776export class TablesFile implements IExcelFile {
770- public writeElement ( folder : Object , worksheetData : WorksheetData ) {
777+ public async writeElement ( folder : Object , worksheetData : WorksheetData ) : Promise < void > {
771778 const columnCount = worksheetData . columnCount ;
772779 const lastColumn = ExcelStrings . getExcelColumn ( columnCount - 1 ) + worksheetData . rowCount ;
773780 const autoFilterDimension = 'A1:' + lastColumn ;
@@ -800,15 +807,17 @@ export class TablesFile implements IExcelFile {
800807 sortString = `<sortState ref="A2:${ lastColumn } "><sortCondition descending="${ dir } " ref="${ sc } 1:${ sc } 15"/></sortState>` ;
801808 }
802809
803- import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'table1.xml' ] = strToU8 ( ExcelStrings . getTablesXML ( autoFilterDimension , tableDimension , tableColumns , sortString ) ) ) ;
810+ const { strToU8 } = await import ( 'fflate' ) ;
811+ folder [ 'table1.xml' ] = strToU8 ( ExcelStrings . getTablesXML ( autoFilterDimension , tableDimension , tableColumns , sortString ) ) ;
804812 }
805813}
806814
807815/**
808816 * @hidden
809817 */
810818export class WorksheetRelsFile implements IExcelFile {
811- public writeElement ( folder : Object ) {
812- import ( 'fflate' ) . then ( ( { strToU8 } ) => folder [ 'sheet1.xml.rels' ] = strToU8 ( ExcelStrings . getWorksheetRels ( ) ) ) ;
819+ public async writeElement ( folder : Object ) : Promise < void > {
820+ const { strToU8 } = await import ( 'fflate' ) ;
821+ folder [ 'sheet1.xml.rels' ] = strToU8 ( ExcelStrings . getWorksheetRels ( ) ) ;
813822 }
814823}
0 commit comments