@slickgrid-universal/excel-export 5.10.2 → 5.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"excelExport.service.d.ts","sourceRoot":"","sources":["../../src/excelExport.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,QAAQ,EACR,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,MAAM,EACN,gBAAgB,EAChB,kBAAkB,IAAI,sBAAsB,EAC5C,iBAAiB,EAEjB,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,UAAU,EACV,YAAY,EACZ,MAAM,EACN,aAAa,EACb,aAAa,EACb,SAAS,EACT,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAKL,QAAQ,EAIT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,iBAAiB,CAAC;AAOzB,qBAAa,kBAAmB,YAAW,gBAAgB,EAAE,sBAAsB;IACjF,SAAS,CAAC,WAAW,EAAE,QAAQ,CAAiB;IAChD,SAAS,CAAC,KAAK,EAAG,SAAS,CAAC;IAC5B,SAAS,CAAC,QAAQ,EAAG,MAAM,CAAC;IAC5B,SAAS,CAAC,qBAAqB,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IACtD,SAAS,CAAC,cAAc,EAAE,KAAK,CAAC,YAAY,CAAC,CAAM;IACnD,SAAS,CAAC,wBAAwB,UAAS;IAC3C,SAAS,CAAC,gBAAgB,UAAS;IACnC,SAAS,CAAC,mBAAmB,EAAG,iBAAiB,CAAC;IAClD,SAAS,CAAC,MAAM,EAAG,SAAS,CAAC;IAC7B,SAAS,CAAC,WAAW,EAAG,UAAU,CAAC;IACnC,SAAS,CAAC,kBAAkB,EAAE,GAAG,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SAAS,EACf,UAAU,UAAO,GAChB;IACD,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,kBAAkB,EAAE,oBAAoB,CAAC;CAC1C,CAUA;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,GAAG,CAEnG;AAED,yJAAyJ;AACzJ,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,SAAS,EACf,aAAa,EAAE,aAAa,GAC3B;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,GAAG,GAAG,GAAG,CAAC;IAC5B,iBAAiB,EAAE,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC9C,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CA6CA;AAED,wBAAgB,2BAA2B,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAwBrG;AAED,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,GAAG,EACjB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,SAAS,EACf,aAAa,EAAE,aAAa,GAC3B;IACD,WAAW,EAAE,cAAc,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB,CAwFA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slickgrid-universal/excel-export",
3
- "version": "5.10.2",
3
+ "version": "5.12.0",
4
4
  "description": "Excel Export (xls/xlsx) Service.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -38,13 +38,13 @@
38
38
  "not dead"
39
39
  ],
40
40
  "dependencies": {
41
- "@slickgrid-universal/common": "~5.10.2",
42
- "@slickgrid-universal/utils": "~5.10.2",
41
+ "@slickgrid-universal/common": "~5.12.0",
42
+ "@slickgrid-universal/utils": "~5.12.0",
43
43
  "excel-builder-vanilla": "^3.0.14"
44
44
  },
45
45
  "funding": {
46
46
  "type": "ko_fi",
47
47
  "url": "https://ko-fi.com/ghiscoding"
48
48
  },
49
- "gitHead": "61dcfac0074bedede5bed92faa49c2d42d551f4c"
49
+ "gitHead": "d7e892ebc1727d7c83cc1e5cc80db8302eef4f63"
50
50
  }
@@ -35,16 +35,11 @@ import {
35
35
  } from '@slickgrid-universal/common';
36
36
  import { addWhiteSpaces, extend, getHtmlStringOutput, stripTags, titleCase } from '@slickgrid-universal/utils';
37
37
 
38
- import {
39
- type ExcelFormatter,
40
- getGroupTotalValue,
41
- getExcelFormatFromGridFormatter,
42
- useCellFormatByFieldType,
43
- } from './excelUtils.js';
38
+ import { type ExcelFormatter, getGroupTotalValue, getExcelFormatFromGridFormatter, useCellFormatByFieldType } from './excelUtils.js';
44
39
 
45
40
  const DEFAULT_EXPORT_OPTIONS: ExcelExportOption = {
46
41
  filename: 'export',
47
- format: FileType.xlsx
42
+ format: FileType.xlsx,
48
43
  };
49
44
 
50
45
  export class ExcelExportService implements ExternalResource, BaseExcelExportService {
@@ -64,8 +59,12 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
64
59
  protected _workbook!: Workbook;
65
60
 
66
61
  // references of each detected cell and/or group total formats
67
- protected _regularCellExcelFormats: { [fieldId: string]: { excelFormatId?: number; getDataValueParser: GetDataValueCallback; }; } = {};
68
- protected _groupTotalExcelFormats: { [fieldId: string]: { groupType: string; excelFormat?: ExcelFormatter; getGroupTotalParser?: GetGroupTotalValueCallback; }; } = {};
62
+ protected _regularCellExcelFormats: {
63
+ [fieldId: string]: { excelFormatId?: number; getDataValueParser: GetDataValueCallback };
64
+ } = {};
65
+ protected _groupTotalExcelFormats: {
66
+ [fieldId: string]: { groupType: string; excelFormat?: ExcelFormatter; getGroupTotalParser?: GetGroupTotalValueCallback };
67
+ } = {};
69
68
 
70
69
  /** ExcelExportService class name which is use to find service instance in the external registered services */
71
70
  readonly className = 'ExcelExportService';
@@ -81,7 +80,7 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
81
80
 
82
81
  /** Getter for the Grid Options pulled through the Grid Object */
83
82
  protected get _gridOptions(): GridOption {
84
- return this._grid?.getOptions() || {} as GridOption;
83
+ return this._grid?.getOptions() || ({} as GridOption);
85
84
  }
86
85
 
87
86
  get stylesheet(): StyleSheet {
@@ -118,7 +117,9 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
118
117
  this._translaterService = this._gridOptions?.translater;
119
118
 
120
119
  if (this._gridOptions.enableTranslate && (!this._translaterService || !this._translaterService.translate)) {
121
- throw new Error('[Slickgrid-Universal] requires a Translate Service to be passed in the "translater" Grid Options when "enableTranslate" is enabled. (example: this.gridOptions = { enableTranslate: true, translater: this.translaterService })');
120
+ throw new Error(
121
+ '[Slickgrid-Universal] requires a Translate Service to be passed in the "translater" Grid Options when "enableTranslate" is enabled. (example: this.gridOptions = { enableTranslate: true, translater: this.translaterService })'
122
+ );
122
123
  }
123
124
  }
124
125
 
@@ -133,7 +134,9 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
133
134
  */
134
135
  exportToExcel(options?: ExcelExportOption): Promise<boolean> {
135
136
  if (!this._grid || !this._dataView || !this._pubSubService) {
136
- throw new Error('[Slickgrid-Universal] it seems that the SlickGrid & DataView objects and/or PubSubService are not initialized did you forget to enable the grid option flag "enableExcelExport"?');
137
+ throw new Error(
138
+ '[Slickgrid-Universal] it seems that the SlickGrid & DataView objects and/or PubSubService are not initialized did you forget to enable the grid option flag "enableExcelExport"?'
139
+ );
137
140
  }
138
141
  this._pubSubService?.publish(`onBeforeExportToExcel`, true);
139
142
  this._excelExportOptions = extend(true, {}, { ...DEFAULT_EXPORT_OPTIONS, ...this._gridOptions.excelExportOptions, ...options });
@@ -144,7 +147,7 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
144
147
  this._groupTotalExcelFormats = {};
145
148
 
146
149
  // wrap in a Promise so that we can add loading spinner
147
- return new Promise(resolve => {
150
+ return new Promise((resolve) => {
148
151
  // prepare the Excel Workbook & Sheet
149
152
  const worksheetOptions = { name: this._excelExportOptions.sheetName || 'Sheet1' };
150
153
  this._workbook = new Workbook();
@@ -186,7 +189,10 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
186
189
  // user could also provide its own mime type, if however an empty string is provided we will consider to be without any MIME type)
187
190
  let mimeType = this._excelExportOptions?.mimeType;
188
191
  if (mimeType === undefined) {
189
- mimeType = this._fileFormat === FileType.xls ? 'application/vnd.ms-excel' : 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
192
+ mimeType =
193
+ this._fileFormat === FileType.xls
194
+ ? 'application/vnd.ms-excel'
195
+ : 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
190
196
  }
191
197
 
192
198
  const filename = `${this._excelExportOptions.filename}.${this._fileFormat}`;
@@ -263,7 +269,7 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
263
269
  if (Array.isArray(grouping) && grouping.length > 0) {
264
270
  columnStyles.push({
265
271
  bestFit: true,
266
- columnStyles: this._gridOptions?.excelExportOptions?.customColumnWidth ?? 10
272
+ columnStyles: this._gridOptions?.excelExportOptions?.customColumnWidth ?? 10,
267
273
  });
268
274
  }
269
275
 
@@ -273,7 +279,7 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
273
279
  if ((columnDef.width === undefined || columnDef.width > 0) && !skippedField) {
274
280
  columnStyles.push({
275
281
  bestFit: true,
276
- width: columnDef.excelExportOptions?.width ?? this._gridOptions?.excelExportOptions?.customColumnWidth ?? 10
282
+ width: columnDef.excelExportOptions?.width ?? this._gridOptions?.excelExportOptions?.customColumnWidth ?? 10,
277
283
  });
278
284
  }
279
285
  });
@@ -300,7 +306,10 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
300
306
  let colspanStartIndex = 0;
301
307
  const headersLn = this._groupedColumnHeaders.length;
302
308
  for (let cellIndex = 0; cellIndex < headersLn; cellIndex++) {
303
- if ((cellIndex + 1) === headersLn || ((cellIndex + 1) < headersLn && this._groupedColumnHeaders[cellIndex].title !== this._groupedColumnHeaders[cellIndex + 1].title)) {
309
+ if (
310
+ cellIndex + 1 === headersLn ||
311
+ (cellIndex + 1 < headersLn && this._groupedColumnHeaders[cellIndex].title !== this._groupedColumnHeaders[cellIndex + 1].title)
312
+ ) {
304
313
  const leftExcelColumnChar = this.getExcelColumnNameByIndex(colspanStartIndex + 1);
305
314
  const rightExcelColumnChar = this.getExcelColumnNameByIndex(cellIndex + 1);
306
315
  this._sheet.mergeCells(`${leftExcelColumnChar}1`, `${rightExcelColumnChar}1`);
@@ -355,9 +364,9 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
355
364
  }
356
365
 
357
366
  /**
358
- * Get all Grouped Header Titles and their keys, translate the title when required.
359
- * @param {Array<object>} columns of the grid
360
- */
367
+ * Get all Grouped Header Titles and their keys, translate the title when required.
368
+ * @param {Array<object>} columns of the grid
369
+ */
361
370
  protected getColumnGroupedHeaderTitles(columns: Column[]): Array<KeyTitlePair> {
362
371
  const groupedColumnHeaders: Array<KeyTitlePair> = [];
363
372
 
@@ -376,7 +385,7 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
376
385
  if ((columnDef.width === undefined || columnDef.width > 0) && !skippedField) {
377
386
  groupedColumnHeaders.push({
378
387
  key: (columnDef.field || columnDef.id) as string,
379
- title: groupedHeaderTitle || ''
388
+ title: groupedHeaderTitle || '',
380
389
  });
381
390
  }
382
391
  });
@@ -396,7 +405,7 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
396
405
  columns.forEach((columnDef) => {
397
406
  let headerTitle = '';
398
407
  if ((columnDef.nameKey || columnDef.nameKey) && this._gridOptions.enableTranslate && this._translaterService?.translate) {
399
- headerTitle = this._translaterService.translate((columnDef.nameKey || columnDef.nameKey));
408
+ headerTitle = this._translaterService.translate(columnDef.nameKey || columnDef.nameKey);
400
409
  } else {
401
410
  headerTitle = getHtmlStringOutput(columnDef.name || '', 'innerHTML') || titleCase(columnDef.field);
402
411
  }
@@ -406,7 +415,7 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
406
415
  if ((columnDef.width === undefined || columnDef.width > 0) && !skippedField) {
407
416
  columnHeaders.push({
408
417
  key: (columnDef.field || columnDef.id) + '',
409
- title: headerTitle
418
+ title: headerTitle,
410
419
  });
411
420
  }
412
421
  });
@@ -417,7 +426,10 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
417
426
  /**
418
427
  * Get all the grid row data and return that as an output string
419
428
  */
420
- protected pushAllGridRowDataToArray(originalDaraArray: Array<Array<string | ExcelColumnMetadata | number>>, columns: Column[]): Array<Array<string | ExcelColumnMetadata | number>> {
429
+ protected pushAllGridRowDataToArray(
430
+ originalDaraArray: Array<Array<string | ExcelColumnMetadata | number>>,
431
+ columns: Column[]
432
+ ): Array<Array<string | ExcelColumnMetadata | number>> {
421
433
  const lineCount = this._dataView.getLength();
422
434
 
423
435
  // loop through all the grid rows of data
@@ -490,12 +502,12 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
490
502
  }
491
503
 
492
504
  // when using grid with colspan, we will merge some cells together
493
- if ((prevColspan === '*' && col > 0) || ((!isNaN(prevColspan as number) && +prevColspan > 1) && columnDef.id !== colspanColumnId)) {
505
+ if ((prevColspan === '*' && col > 0) || (!isNaN(prevColspan as number) && +prevColspan > 1 && columnDef.id !== colspanColumnId)) {
494
506
  // -- Merge Data
495
507
  // Excel row starts at 2 or at 3 when dealing with pre-header grouping
496
508
  const excelRowNumber = row + (this._hasColumnTitlePreHeader ? 3 : 2);
497
509
 
498
- if (typeof prevColspan === 'number' && (colspan - 1) === 1) {
510
+ if (typeof prevColspan === 'number' && colspan - 1 === 1) {
499
511
  // partial column span
500
512
  const leftExcelColumnChar = this.getExcelColumnNameByIndex(colspanStartIndex + 1);
501
513
  const rightExcelColumnChar = this.getExcelColumnNameByIndex(col + 1);
@@ -510,7 +522,7 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
510
522
  }
511
523
 
512
524
  // decrement colspan until we reach colspan of 1 then proceed with cell merge OR full row merge when colspan is (*)
513
- if (typeof prevColspan === 'number' && (!isNaN(prevColspan as number) && +prevColspan > 1)) {
525
+ if (typeof prevColspan === 'number' && !isNaN(prevColspan as number) && +prevColspan > 1) {
514
526
  colspan = prevColspan--;
515
527
  }
516
528
  } else {
@@ -531,7 +543,13 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
531
543
  // we only do this check once per column (everything after that will be pull from temp ref)
532
544
  if (!this._regularCellExcelFormats.hasOwnProperty(columnDef.id)) {
533
545
  const autoDetectCellFormat = columnDef.excelExportOptions?.autoDetectCellFormat ?? this._excelExportOptions?.autoDetectCellFormat;
534
- const cellStyleFormat = useCellFormatByFieldType(this._stylesheet, this._stylesheetFormats, columnDef, this._grid, autoDetectCellFormat);
546
+ const cellStyleFormat = useCellFormatByFieldType(
547
+ this._stylesheet,
548
+ this._stylesheetFormats,
549
+ columnDef,
550
+ this._grid,
551
+ autoDetectCellFormat
552
+ );
535
553
  // user could also override style and/or valueParserCallback
536
554
  if (columnDef.excelExportOptions?.style) {
537
555
  cellStyleFormat.excelFormatId = this._stylesheet.createFormat(columnDef.excelExportOptions.style).id;
@@ -548,7 +566,14 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
548
566
  }
549
567
 
550
568
  const { excelFormatId, getDataValueParser } = this._regularCellExcelFormats[columnDef.id];
551
- itemData = getDataValueParser(itemData, { columnDef, excelFormatId, stylesheet: this._stylesheet, gridOptions: this._gridOptions, dataRowIdx, dataContext: itemObj });
569
+ itemData = getDataValueParser(itemData, {
570
+ columnDef,
571
+ excelFormatId,
572
+ stylesheet: this._stylesheet,
573
+ gridOptions: this._gridOptions,
574
+ dataRowIdx,
575
+ dataContext: itemObj,
576
+ });
552
577
 
553
578
  rowOutputStrings.push(itemData);
554
579
  idx++;
@@ -609,10 +634,17 @@ export class ExcelExportService implements ExternalResource, BaseExcelExportServ
609
634
 
610
635
  const groupTotalParser = columnDef.groupTotalsExcelExportOptions?.valueParserCallback ?? getGroupTotalValue;
611
636
  if (itemObj[groupCellFormat.groupType]?.[columnDef.field] !== undefined) {
612
- const groupData = groupTotalParser(itemObj, { columnDef, groupType: groupCellFormat.groupType, excelFormatId: groupCellFormat.excelFormat?.id, stylesheet: this._stylesheet, dataRowIdx } as ExcelGroupValueParserArgs);
613
- itemData = (typeof groupData === 'object' && groupData.hasOwnProperty('metadata'))
614
- ? groupData
615
- : itemData = { value: groupData, metadata: { style: groupCellFormat.excelFormat?.id } };
637
+ const groupData = groupTotalParser(itemObj, {
638
+ columnDef,
639
+ groupType: groupCellFormat.groupType,
640
+ excelFormatId: groupCellFormat.excelFormat?.id,
641
+ stylesheet: this._stylesheet,
642
+ dataRowIdx,
643
+ } as ExcelGroupValueParserArgs);
644
+ itemData =
645
+ typeof groupData === 'object' && groupData.hasOwnProperty('metadata')
646
+ ? groupData
647
+ : (itemData = { value: groupData, metadata: { style: groupCellFormat.excelFormat?.id } });
616
648
  }
617
649
  } else if (columnDef.groupTotalsFormatter) {
618
650
  const totalResult = columnDef.groupTotalsFormatter(itemObj, columnDef, this._grid);
package/src/excelUtils.ts CHANGED
@@ -1,12 +1,5 @@
1
1
  import type { StyleSheet } from 'excel-builder-vanilla';
2
- import type {
3
- Column,
4
- Formatter,
5
- FormatterType,
6
- GetDataValueCallback,
7
- GridOption,
8
- SlickGrid,
9
- } from '@slickgrid-universal/common';
2
+ import type { Column, Formatter, FormatterType, GetDataValueCallback, GridOption, SlickGrid } from '@slickgrid-universal/common';
10
3
  import {
11
4
  Constants,
12
5
  FieldType,
@@ -18,34 +11,42 @@ import {
18
11
  } from '@slickgrid-universal/common';
19
12
  import { stripTags } from '@slickgrid-universal/utils';
20
13
 
21
- export type ExcelFormatter = object & { id: number; };
14
+ export type ExcelFormatter = object & { id: number };
22
15
 
23
16
  // define all type of potential excel data function callbacks
24
17
  export const getExcelSameInputDataCallback: GetDataValueCallback = (data, { excelFormatId }) => {
25
- return excelFormatId !== undefined
26
- ? { value: data, metadata: { style: excelFormatId } }
27
- : data;
18
+ return excelFormatId !== undefined ? { value: data, metadata: { style: excelFormatId } } : data;
28
19
  };
29
20
  export const getExcelNumberCallback: GetDataValueCallback = (data, { columnDef, excelFormatId, gridOptions }) => ({
30
21
  value: typeof data === 'string' && /\d/g.test(data) ? parseNumberWithFormatterOptions(data, columnDef, gridOptions) : data,
31
- metadata: { style: excelFormatId }
22
+ metadata: { style: excelFormatId },
32
23
  });
33
24
 
34
25
  /** Parse a number which the user might have provided formatter options (for example a user might have provided { decimalSeparator: ',', thousandSeparator: ' '}) */
35
26
  export function parseNumberWithFormatterOptions(value: any, column: Column, gridOptions: GridOption): any {
36
27
  let outValue = value;
37
28
  if (typeof value === 'string' && value) {
38
- const decimalSeparator = getValueFromParamsOrFormatterOptions('decimalSeparator', column, gridOptions, Constants.DEFAULT_NUMBER_DECIMAL_SEPARATOR);
39
- const val: number | string = (decimalSeparator === ',')
40
- ? parseFloat(value.replace(/[^0-9,-]+/g, '').replace(',', '.'))
41
- : parseFloat(value.replace(/[^\d.-]/g, ''));
29
+ const decimalSeparator = getValueFromParamsOrFormatterOptions(
30
+ 'decimalSeparator',
31
+ column,
32
+ gridOptions,
33
+ Constants.DEFAULT_NUMBER_DECIMAL_SEPARATOR
34
+ );
35
+ const val: number | string =
36
+ decimalSeparator === ',' ? parseFloat(value.replace(/[^0-9,-]+/g, '').replace(',', '.')) : parseFloat(value.replace(/[^\d.-]/g, ''));
42
37
  outValue = isNaN(val) ? value : val;
43
38
  }
44
39
  return outValue;
45
40
  }
46
41
 
47
42
  /** use different Excel Stylesheet Format as per the Field Type */
48
- export function useCellFormatByFieldType(stylesheet: StyleSheet, excelFormats: any, columnDef: Column, grid: SlickGrid, autoDetect = true): {
43
+ export function useCellFormatByFieldType(
44
+ stylesheet: StyleSheet,
45
+ excelFormats: any,
46
+ columnDef: Column,
47
+ grid: SlickGrid,
48
+ autoDetect = true
49
+ ): {
49
50
  excelFormatId: number | undefined;
50
51
  getDataValueParser: GetDataValueCallback;
51
52
  } {
@@ -60,12 +61,16 @@ export function useCellFormatByFieldType(stylesheet: StyleSheet, excelFormats: a
60
61
  return { excelFormatId, getDataValueParser: callback };
61
62
  }
62
63
 
63
- export function getGroupTotalValue(totals: any, args: { columnDef: Column, groupType: string; }): any {
64
+ export function getGroupTotalValue(totals: any, args: { columnDef: Column; groupType: string }): any {
64
65
  return totals?.[args.groupType]?.[args.columnDef.field] ?? 0;
65
66
  }
66
67
 
67
68
  /** Get numeric formatter options when defined or use default values (minDecimal, maxDecimal, thousandSeparator, decimalSeparator, wrapNegativeNumber) */
68
- export function getNumericFormatterOptions(columnDef: Column, grid: SlickGrid, formatterType: FormatterType): {
69
+ export function getNumericFormatterOptions(
70
+ columnDef: Column,
71
+ grid: SlickGrid,
72
+ formatterType: FormatterType
73
+ ): {
69
74
  minDecimal: number;
70
75
  maxDecimal: number;
71
76
  decimalSeparator: '.' | ',';
@@ -148,7 +153,13 @@ export function getFormatterNumericDataType(formatter?: Formatter): 'currency' |
148
153
  return dataType;
149
154
  }
150
155
 
151
- export function getExcelFormatFromGridFormatter(stylesheet: StyleSheet, excelFormats: any, columnDef: Column, grid: SlickGrid, formatterType: FormatterType): {
156
+ export function getExcelFormatFromGridFormatter(
157
+ stylesheet: StyleSheet,
158
+ excelFormats: any,
159
+ columnDef: Column,
160
+ grid: SlickGrid,
161
+ formatterType: FormatterType
162
+ ): {
152
163
  excelFormat: ExcelFormatter;
153
164
  groupType: string;
154
165
  } {
@@ -194,7 +205,13 @@ export function getExcelFormatFromGridFormatter(stylesheet: StyleSheet, excelFor
194
205
  // when formatter is a Formatter.multiple, we need to loop through each of its formatter to find the best possible Excel format
195
206
  if (Array.isArray(columnDef.params?.formatters)) {
196
207
  for (const formatter of columnDef.params.formatters) {
197
- const { excelFormat: excelFormatResult } = getExcelFormatFromGridFormatter(stylesheet, excelFormats, { ...columnDef, formatter } as Column, grid, formatterType);
208
+ const { excelFormat: excelFormatResult } = getExcelFormatFromGridFormatter(
209
+ stylesheet,
210
+ excelFormats,
211
+ { ...columnDef, formatter } as Column,
212
+ grid,
213
+ formatterType
214
+ );
198
215
  if (excelFormatResult !== excelFormats.numberFormat) {
199
216
  excelFormat = excelFormatResult;
200
217
  break;
@@ -242,16 +259,8 @@ export function getExcelFormatFromGridFormatter(stylesheet: StyleSheet, excelFor
242
259
  function createFormatFromNumber(formattedVal: string) {
243
260
  // full number syntax can have up to 7 sections, for example::
244
261
  // Total: ($10,420.55 USD) Expensed
245
- const [
246
- _,
247
- prefix,
248
- openBraquet,
249
- symbolPrefix,
250
- number,
251
- symbolSuffix,
252
- closingBraquet,
253
- suffix
254
- ] = formattedVal?.match(/^([^\d(-]*)([(]?)([^\d]*)([-]?[\w]]?[\d\s]*[.,\d]*[\d]*[^)\s%]?)([^\d.,)]*)([)]?)([^\d]*)$/i) || [];
262
+ const [_, prefix, openBraquet, symbolPrefix, number, symbolSuffix, closingBraquet, suffix] =
263
+ formattedVal?.match(/^([^\d(-]*)([(]?)([^\d]*)([-]?[\w]]?[\d\s]*[.,\d]*[\d]*[^)\s%]?)([^\d.,)]*)([)]?)([^\d]*)$/i) || [];
255
264
 
256
265
  // we use 1 so that they won't be removed when rounding numbers, however Excel uses 0 and # symbol
257
266
  // replace 1's by 0's (required numbers) and replace 2's by "#" (optional numbers)
@@ -264,7 +273,7 @@ function createFormatFromNumber(formattedVal: string) {
264
273
  replacedNumber,
265
274
  escapeQuotes(symbolSuffix ?? ''),
266
275
  closingBraquet ?? '',
267
- escapeQuotes(suffix ?? '')
276
+ escapeQuotes(suffix ?? ''),
268
277
  ].join('');
269
278
  return format.replace(',', ',');
270
279
  }
@@ -305,4 +314,4 @@ function textPadding(numberStr: string, count: number): string {
305
314
  output += numberStr;
306
315
  }
307
316
  return output;
308
- }
317
+ }