excellentexport 3.9.0 → 3.9.2

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.
package/dist/format.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export declare enum CellType {
1
+ export declare enum CellTypes {
2
2
  TEXT = "s",
3
3
  NUMBER = "n",
4
4
  DATE = "d",
5
5
  BOOLEAN = "b"
6
6
  }
7
- export declare enum CellPattern {
7
+ export declare enum CellPatterns {
8
8
  INTEGER = "0",
9
9
  DECIMAL = "0.00",
10
10
  DATE = "dd/mm/yyyy",
@@ -15,9 +15,10 @@ export declare enum CellPattern {
15
15
  EXPONENT = "0.00E+00",
16
16
  TEXT = "@"
17
17
  }
18
+ export type CellType = 's' | 'n' | 'd' | 'b';
18
19
  export interface CellFormat {
19
20
  type: CellType;
20
- pattern?: CellPattern;
21
+ pattern?: string;
21
22
  }
22
23
  export interface CellFormats {
23
24
  [key: string]: CellFormat;
@@ -0,0 +1,3 @@
1
+ export * from './excellentexport';
2
+ export * from './format';
3
+ export * from './utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "excellentexport",
3
- "version": "3.9.0",
3
+ "version": "3.9.2",
4
4
  "description": "Client side JavaScript export to Excel or CSV",
5
5
  "license": "MIT",
6
6
  "homepage": "http://jordiburgos.com",
@@ -26,6 +26,7 @@
26
26
  "watch": "jest --watch"
27
27
  },
28
28
  "main": "dist/excellentexport.js",
29
+ "types": "dist/index.d.ts",
29
30
  "devDependencies": {
30
31
  "@babel/core": "7.20.12",
31
32
  "@babel/plugin-proposal-class-properties": "7.18.6",
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import * as XLSX from 'xlsx';
11
- import { CellType, FormatDefinition, PredefinedFormat } from './format';
11
+ import { CellTypes, FormatDefinition, PredefinedFormat } from './format';
12
12
 
13
13
  import * as utils from './utils';
14
14
 
@@ -44,7 +44,7 @@ export interface SheetOptions {
44
44
 
45
45
  const ExcellentExport = function() {
46
46
 
47
- const version = "3.9.0";
47
+ const version = "3.9.1";
48
48
 
49
49
  /*
50
50
  ExcellentExport.convert(options, sheets);
@@ -153,7 +153,7 @@ const ExcellentExport = function() {
153
153
  cell.t = f.format.type;
154
154
 
155
155
  // type fix
156
- if (f.format?.type == CellType.BOOLEAN) {
156
+ if (f.format?.type == CellTypes.BOOLEAN) {
157
157
  const v = cell.v.toString().toLowerCase();
158
158
  if (v == 'true' || v == '1') cell.v = true;
159
159
  if (v == 'false' || v == '0') cell.v = false;
package/src/format.ts CHANGED
@@ -1,12 +1,14 @@
1
1
 
2
- export enum CellType {
2
+ // Constants for cell types
3
+ export enum CellTypes {
3
4
  TEXT = 's',
4
5
  NUMBER = 'n',
5
6
  DATE = 'd',
6
7
  BOOLEAN = 'b',
7
8
  }
8
9
 
9
- export enum CellPattern {
10
+ // Constants for cell patterns
11
+ export enum CellPatterns {
10
12
  INTEGER = '0',
11
13
  DECIMAL = '0.00',
12
14
  DATE = 'dd/mm/yyyy',
@@ -18,9 +20,11 @@ export enum CellPattern {
18
20
  TEXT = '@',
19
21
  }
20
22
 
23
+ export type CellType = 's' | 'n' | 'd' | 'b';
24
+
21
25
  export interface CellFormat {
22
26
  type: CellType,
23
- pattern?: CellPattern,
27
+ pattern?: string,
24
28
  }
25
29
 
26
30
  // Define structure for predefined formats
@@ -28,21 +32,21 @@ export interface CellFormats {
28
32
  [key: string]: CellFormat
29
33
  }
30
34
  export const PredefinedFormat : CellFormats = {
31
- NUMBER: { type: CellType.NUMBER},
32
- INTEGER: { type: CellType.NUMBER, pattern: CellPattern.INTEGER },
33
- DECIMAL: { type: CellType.NUMBER, pattern: CellPattern.DECIMAL },
34
- CURRENCY: { type: CellType.NUMBER, pattern: CellPattern.CURRENCY },
35
- PERCENTAGE: { type: CellType.NUMBER, pattern: CellPattern.PERCENTAGE },
36
- EXPONENT: { type: CellType.NUMBER, pattern: CellPattern.EXPONENT },
35
+ NUMBER: { type: CellTypes.NUMBER},
36
+ INTEGER: { type: CellTypes.NUMBER, pattern: CellPatterns.INTEGER },
37
+ DECIMAL: { type: CellTypes.NUMBER, pattern: CellPatterns.DECIMAL },
38
+ CURRENCY: { type: CellTypes.NUMBER, pattern: CellPatterns.CURRENCY },
39
+ PERCENTAGE: { type: CellTypes.NUMBER, pattern: CellPatterns.PERCENTAGE },
40
+ EXPONENT: { type: CellTypes.NUMBER, pattern: CellPatterns.EXPONENT },
37
41
 
38
- DATE: { type: CellType.DATE, pattern: CellPattern.DATE },
42
+ DATE: { type: CellTypes.DATE, pattern: CellPatterns.DATE },
39
43
 
40
- TIME: { type: CellType.DATE, pattern: CellPattern.TIME },
41
- DATETIME: { type: CellType.DATE, pattern: CellPattern.DATETIME },
44
+ TIME: { type: CellTypes.DATE, pattern: CellPatterns.TIME },
45
+ DATETIME: { type: CellTypes.DATE, pattern: CellPatterns.DATETIME },
42
46
 
43
- TEXT: { type: CellType.TEXT, pattern: CellPattern.TEXT },
47
+ TEXT: { type: CellTypes.TEXT, pattern: CellPatterns.TEXT },
44
48
 
45
- BOOLEAN: { type: CellType.BOOLEAN },
49
+ BOOLEAN: { type: CellTypes.BOOLEAN },
46
50
  }
47
51
 
48
52
  export interface FormatDefinition {
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+
2
+ export * from './excellentexport';
3
+ export * from './format';
4
+ export * from './utils';